0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.147.126.199


Current Path : /var/www/html/sikkim/js19042016/popups/
Upload File :
Current File : /var/www/html/sikkim/js19042016/popups/SubjectDetailsPopup.js

function openSubjectDetailsPoup()
{
	switch(document.getElementById('module_name_for_save').value)
	{
		case 'SaveMarkEntrySubjectwise':
		POpupSubjectDetailstml(window.location.g_popup_degree_code,window.location.g_popup_exam_no,$("#SubCategory").val(),'ME');
		break;
		
		case 'AttendnaceEntry':
		POpupSubjectDetailstml(window.location.g_popup_degree_code,window.location.g_popup_exam_no,$("#SubCategory").val(),'ME');
		break;
		
		case 'SaveMarkEntryStudentwise':
		POpupSubjectDetailstml(window.location.g_popup_degree_code,window.location.g_popup_exam_no,$("#StudentEntry_SubCategory").val(),'ME');
		break;
		
		case 'SaveAbsentEntrySubjectwise':		
		POpupSubjectDetailstml(window.location.g_popup_degree_code,  window.location.g_popup_exam_no, $("#abs_SubCategory").val(),$g_screen_type);
		break;
		
		case 'saveDailyReport':		
		POpupSubjectDetailstml(window.location.g_popup_degree_code,  window.location.g_popup_exam_no, '','');
		break;	
		case 'saveDatewar':		
		POpupSubjectDetailstml(window.location.g_popup_degree_code,  window.location.g_popup_exam_no, '','');
		break;
		case 'SaveBatchSetup':		
		POpupSubjectDetailstml(window.location.g_popup_degree_code,  window.location.g_popup_exam_no, '12','PR');
		break;	
		case 'SavePracticalEntryFreezing':		
		POpupSubjectDetailstml(window.location.g_popup_degree_code,  window.location.g_popup_exam_no, '12','PR');
		break;
	}
}
// used to store resonce from the table
var $g_ref_data_arr='';
$host_url= getCookie('host_url');
$image_path= getCookie('image_path');

function  POpupSubjectDetailstml($degree_code,$exam_no,$category,$module)
{   
	$('#dialog').dialog('open');	
	//$("#dialog").data("height.dialog", 300);		
    $(".ui-dialog").css({width:610});
	$("#dialog").css({height:276});	
	//$(".ui-dialog").css({height:285});
	$('#ui-dialog-title-dialog').html("Subject Details"); 	
	
	$main="<table id='subject_grid' class='scroll' ondblclick='selectMarkEntrySubDetails();' ></table> <div   id='sub_grid_div3' class='scroll' style='text-align:center;'></div>";
	document.getElementById('dialog').innerHTML=$main;
	//alert('d');
var subject = jQuery("#subject_grid").jqGrid(
	{
	url:$host_url+'SubjectMarkDetailsPopup.demo&DegCode='+trim($degcode)+'&Examno='+trim($examno)+'&category='+$category+'&module='+trim($module),
	//url:$host_url+'SubjectMarkDetailsPopup.demo&DegCode='+$degree_code+'&Examno='+$exam_no+"'",
	//url:+$host_url+'ExamnoDetailsPopup.demo&DegCode='+trim($degcode)+'&searchField='+trim($Examno)+,
	datatype: 'json',
	colNames:['Subcode','SubName','SubName','ShortName','Maxmark'],
	colModel:[{name:'fcsubcode',index:'fcsubcode', width:65 },
	{name:'fsubname',index:'fsubname', width:250 },
	{name:'fssubname',index:'fssubname', width:75 },
	{name:'fshortname',index:'fshortname', width:95 },
	{name:'fsmaxmarks',index:'fsmaxmarks', width:65 }],
	rowNum:50,rowList:[5,10,15,20,30,50,100],pager: jQuery('#sub_grid_div3'),sortname: 'id',
	imgpath:$image_path,	
	height:'200',
	width:'600',
	viewrecords: true,
	sortorder: 'asc',
	multiselect: false,
	cellEdit: true,
	//caption:'Subject Details',
	addCaption: 'Add Record'
	}).navGrid('#sub_grid_div3',{edit:false,add:false,del:false,search:false},{},{},{},{multipleSearch:true}).
	navButtonAdd('#sub_grid_div3',{caption:"",
	buttonicon :'ui-icon-search', onClickButton:function(){subject[0].toggleToolbar() } }). 
	navButtonAdd('#sub_grid_div3',{caption:"Select", onClickButton:function()
		{
			selectMarkEntrySubDetails();
		}
		});
	subject.filterToolbar();
	$("#gs_ffsubcode").focus();
			   $('.ui-search-toolbar').bind('keydown',function(evt) 
				{
					var kC  = (evt.which) ? evt.which : evt.keyCode;
				 	if(kC==40)
					jQuery('#subject_grid').editCell(0,0,false);	
				/* 	if(kC==39) 
					 $('#'+evt.target.id).focusNextInputField();
					 if(kC==37) 
					 $('#'+evt.target.id).focusPreviousInputField();	 */					
				} );
}

function selectMarkEntrySubDetails()
{
  var id=jQuery("#subject_grid").getGridParam('selrow'); 
	if( id!=null  )   
	{  
	switch(document.getElementById('module_name_for_save').value)
	 {
			case 'SaveMarkEntrySubjectwise':
			$("#markentry_sub_final_subcode").val(id);
			getSubjectName();
			//$Degcode =document.getElementById('markentry_sub_degree_code').value;
			/* $.ajax({
			type: "POST",
			async:false,
			data: "subcode="+id,
			url: $host_url+"getSubMarkDetailsForPopUp.demo",
			success: PopulateSubjectDetailsResponse
			});  */
			$('#dialog').dialog("close"); 	
			break;
			case 'AttendnaceEntry':
			$("#markentry_sub_final_subcode").val(id);
			getSubjectName();
		 
			$('#dialog').dialog("close"); 	
			break;
			
			case 'SaveMarkEntryStudentwise':
			//$Degcode =document.getElementById('abs_entry_sub_degree_code').value;
			getSubjectName();
			/* $.ajax({
			type: "POST",
			async:false,
			data: "subcode="+id,
			url: $host_url+"getSubMarkDetailsForPopUp.demo",
			success: PopulateSubjectDetailsResponse
			});  */
			$('#dialog').dialog("close"); 	
			break;	
			
			case 'SaveBatchSetup':			
			$("#batch_sub_final_subcode").val(id);
			getSubjectName();
			$('#dialog').dialog("close"); 	
			break;	
			
			case 'SavePracticalEntryFreezing':			
			$("#fmacas_sub_final_subcode").val(id);
			getSubjectName();
			$('#dialog').dialog("close"); 	
			break;
				
			case 'SaveAbsentEntrySubjectwise':
			//$Degcode =document.getElementById('abs_entry_sub_degree_code').value;
			$("#abs_sub_final_subcode").val(id);	
			getSubjectName();
			/* $.ajax({
			type: "POST",
			async:false,
			data: "subcode="+id,
			url: $host_url+"getSubMarkDetailsForPopUp.demo",
			success: PopulateSubjectDetailsResponse
			}); */ 
			$('#dialog').dialog("close"); 	
			break;	
	  case 'saveDatewar':
			var sub_row=jQuery("#subject_grid").getRowData(id);
			if($g_focus_element=='report_marklist_subject_start_from')
			{
			$("#report_marklist_subject_start_from").val(sub_row['fcsubcode']);
			}
			else
			{
			$("#report_marklist_subject_end_to").val(sub_row['fcsubcode']);
			}
			$('#dialog').dialog("close"); 	
			break;			
		} 
	}
	else
	{ 
		alert("Please select row");  
	} 
	return;
	
}
function PopulateSubjectDetailsResponse($responce)
{
$responce = eval('(' + $responce + ')'); 
$id = window.location.g_mark_entry_student_id;
	if($responce.error_code == 0)
	{
		switch(document.getElementById('module_name_for_save').value)
		{
			case 'SaveMarkEntrySubjectwise':
			document.getElementById('markentry_sub_final_subcode').value = $responce.data['FCSUBCODE'];
			document.getElementById('markentry_sub_fsubname').value = $responce.data['FSUBNAME']; 
			document.getElementById('markentry_sub_fssubname').value = $responce.data['FSSUBNAME']; 
			document.getElementById('mark_entry_shortname').value = $responce.data['FSHORTNAME']; 
			document.getElementById('markentry_sub_maxmark').value = $responce.data['FSMAXMARKS'];
			document.getElementById('markentry_sub_range').focus();
			break;
			case 'AttendnaceEntry':
			document.getElementById('markentry_sub_final_subcode').value = $responce.data['FCSUBCODE'];
			document.getElementById('markentry_sub_fsubname').value = $responce.data['FSUBNAME']; 
			document.getElementById('markentry_sub_fssubname').value = $responce.data['FSSUBNAME']; 
			document.getElementById('mark_entry_shortname').value = $responce.data['FSHORTNAME']; 
			document.getElementById('markentry_sub_maxmark').value = $responce.data['FSMAXMARKS'];
			document.getElementById('markentry_sub_range').focus();
			break;
			
			case 'SaveMarkEntryStudentwise':			
			document.getElementById("markentery_stuwise_subcode_"+$id).value = $responce.data['FCSUBCODE']; 
		    document.getElementById("markentery_stuwise_subname_"+$id).value = $responce.data['FSUBNAME']; 
            document.getElementById("markentery_stuwise_subcode_"+$id).focus();					
			$g_valid_subcode=1;			
			document.getElementById("markentry_stuwise_maxmark_"+$id).innerHTML = $responce.data['FSMAXMARKS'];
			document.getElementById("markentry_stuwise_maxmark_"+$id).focus();
			
			
			break;
			
			case 'SaveAbsentEntrySubjectwise':
			document.getElementById('abs_sub_final_subcode').value = $responce.data['FCSUBCODE'];
			document.getElementById('abs_sub_fsubname').value = $responce.data['FSUBNAME']; 
			document.getElementById('abs_sub_fssubname').value = $responce.data['FSSUBNAME']; 
			document.getElementById('abs_entry_shortname').value = $responce.data['FSHORTNAME']; 
			document.getElementById('abs_sub_date').focus();
			break;
			case 'saveDispatchAnswersScript':
			if($g_dispatch_popup==3)
			{
			$Textbox = document.getElementsByName("dispatch_ans_degree");
			$NumTextBox = $Textbox.length;			
			$("#dispatch_name_"+$NumTextBox).val($responce.data.FCSUBCODE);		
			document.getElementById('dispatch_name_'+$NumTextBox).focus();
			}
			else
			{
			$("#dispatch_name_1").val($responce.data.FCSUBCODE);					
			document.getElementById('dispatch_name_1').focus();
			 }
			break;

		case 'SaveBatchSetup':
				document.getElementById('batch_sub_final_subcode').value = $responce.data['FCSUBCODE'];
				document.getElementById('batch_sub_fsubname').value = $responce.data['FSUBNAME']; 
				document.getElementById('batch_sub_fssubname').value = $responce.data['FSSUBNAME']; 
				document.getElementById('batch_entry_shortname').value = $responce.data['FSHORTNAME']; 
				document.getElementById('batch_sub_maxmark').value = $responce.data['FSMAXMARKS'];
				document.getElementById('batch_sub_range').focus();
			break; 		
			case 'SavePracticalEntryFreezing':
				document.getElementById('fmacas_sub_final_subcode').value = $responce.data['FCSUBCODE'];
				document.getElementById('fmacas_sub_fsubname').value = $responce.data['FSUBNAME']; 
				document.getElementById('fmacas_sub_fssubname').value = $responce.data['FSSUBNAME']; 
				document.getElementById('fmacas_entry_shortname').value = $responce.data['FSHORTNAME']; 
				document.getElementById('fmacas_sub_maxmark').value = $responce.data['FSMAXMARKS'];
				//document.getElementById('batch_sub_range').focus();
			break; 		
		}	
	}
}