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.15.17.137


Current Path : /proc/thread-self/root/var/www/html/mum/js/
Upload File :
Current File : //proc/thread-self/root/var/www/html/mum/js/subject_freshExam.js

var prevSubjectList='';
var prevFreshSubjectList='';
function LoadIdentifySubjFreshExam()
{
	$("#page_main_div").load('html_modules/IdentifySubj_freshExam.html',function()
	{
	window.location.g_FeePopUpExamNo='';
	 
	//document.getElementById('display_module_name').innerHTML = 'Candidate List';
	document.getElementById('module_name_for_save').value = 'IdentifySubjFreshEx';
	document.getElementById('is_add_edit').value = 'Add';
	getDefaultHeadFooterLinks("Identify Subject For Fresh Exam");
	ClearIdentifySubjFreshExam();	
	$("#candidate_list_degree_code").focus();
	$("#error_msg").html("");
	$("#candidate_list_reg_no_details").html("");
	$("#candidate_list_reg_no_details").hide();
	getCategoryNames('candidate_list_category');
	$g_total_count_of_each_div=0;
	$g_student_reg_no_exam_details='';
	prevFreshSubjectList='';
	
	enableIdentifySubExamHeaderFields();
	$("#candidate_list_photo").css("left",$("#candidate_list_category").position()['left']+220);
		$("#student_entry_upload").parent().css("left",$("#candidate_list_category").position()['left']+180);

	}
	);
	$('#module_details_div').hide();
	}
	
function enableIdentifySubExamHeaderFields()
 {

 document.getElementById('candidate_list_reg_no').disabled=false;
 document.getElementById('candidate_list_degree_code').disabled=false;
$("#candidate_list_reg_no").val('');	
$("#candidate_list_reg_name").val('');	
$("#freshSubj_details").html("");	
 $g_total_exam_details='';
document.getElementById('candidate_list_reg_no').focus();

 
}

function ClearIdentifySubjFreshExam()
{
	prevFreshSubjectList='';
	$("#candidate_list_degree_code").val('');		
	$("#candidate_list_degree_name").val('');	
	$("#candidate_list_reg_no").val('');	
	$("#candidate_list_reg_name").val('');
	$("#fresh_Examno").val('');	
	$("#fresh_Exam_name").val('');	
	$("#freshSubj_details").html("");	
	document.getElementById('candidate_list_reg_no').disabled=false;
	document.getElementById('candidate_list_reg_name').disabled=false;
	document.getElementById('candidate_list_degree_code').disabled=false;
	document.getElementById('candidate_list_degree_name').disabled=false;
	document.getElementById('fresh_Examno').disabled=false;
	document.getElementById('candidate_list_reg_no').focus();
}

function PopulateFreshExamSubjectList($prevReg)
{
	var degree=$("#candidate_list_degree_code").val();
	var reg_no=$("#candidate_list_reg_no").val();
	var exam_no=$("#fresh_Examno").val();
	if(empty(reg_no))
	{
		alert("Enter Reg No ");
		$("#candidate_list_reg_no").focus();
		return;
		
	}
	if(empty(degree))
	{
		alert("Enter Degree ");
		$("#candidate_list_degree_code").focus();
		return;
		
	}
	if(empty(exam_no))
	{
		alert("Enter Exam ");
		$("#fresh_Examno").focus();
		return;
	}
		$.ajax({
		type: "POST",
		data:"degree="+degree+"&Regno="+reg_no+"&Examno="+exam_no+"&prevReg="+$prevReg+"&prevFreshSub="+prevFreshSubjectList,
		url: $host_url+"PopulateFreshExamSubjectList",
		success: PopulateExamTypeListCategoryResponce
		});
}

function PopulateExamTypeListCategoryResponce($responce)
{
	$responce = eval('('+$responce+')');
	if($responce.error_code==0)
	{
		
		$g_total_count_of_each_div=$responce.data.total_count_of_each_div;
		prevSubjectList=$responce.data.subject_pre;
		$("#freshSubj_details").html($responce.data.html_data);
		document.getElementById('candidate_list_reg_no').disabled=true;
		document.getElementById('candidate_list_reg_name').disabled=true;
		document.getElementById('candidate_list_degree_code').disabled=true;
		document.getElementById('candidate_list_degree_name').disabled=true;
		document.getElementById('fresh_Examno').disabled=true;
		
	}
	else
	{
		$("#freshSubj_details").html($responce.data.html_data);
		document.getElementById('candidate_list_reg_no').disabled=true;
		document.getElementById('candidate_list_reg_name').disabled=true;
		document.getElementById('candidate_list_degree_code').disabled=true;
		document.getElementById('candidate_list_degree_name').disabled=true;
		document.getElementById('fresh_Examno').disabled=true;
	}
	

}


function populateFreshExamNo()
{
	var degree = $("#candidate_list_degree_code").val();
	var regNo = $("#candidate_list_reg_no").val();
	$.ajax({
		type: "POST",
		data:"degree="+degree+"&Regno="+regNo,
		url: $host_url+"PopulateFreshExamNo",
		success: PopulateFreshExamNoResponce
		});

}

function PopulateFreshExamNoResponce($responce)
{
	$responce = eval('('+$responce+')');
	if($responce.error_code==0)
	{
		document.getElementById('fresh_Examno').value = $responce.data['ffreshexam'];
		document.getElementById('fresh_Exam_name').value = $responce.data['fexamname'];
		$("#freshSubj_details").html("");	
	}
	else
	{
		document.getElementById('fresh_Examno').value = '';
		document.getElementById('fresh_Exam_name').value = '';
		$("#freshSubj_details").html("");	
		
	}
}

function saveFreshExamEntryDetails()
{		
		
		var $checkFreshSubj_dup=$checkIdentfySubj_dup;
		
		 if(trim(document.getElementById('candidate_list_reg_no').value) == '' )
		{
			alert('Please Enter the Reg No');
			document.getElementById('candidate_list_reg_no').focus();
			return;
		}
		if(trim(document.getElementById('candidate_list_degree_code').value) == '' )
		{
			alert('Please Enter the Degree. Code');
			document.getElementById('candidate_list_degree_code').focus();
			return;
		}
		 if(trim(document.getElementById('fresh_Examno').value) == '' )
		{
			alert('Please Enter the Exam No');
			document.getElementById('fresh_Examno').focus();
			return;
		}
		var $c_code = document.getElementById('fresh_Examno').value;
		var  $char_code=$c_code;
		$div_id="candidate_list_exam_"+$char_code+"_details";
		$div_id_total="candidate_list_exam_"+$char_code+"_details_total";

		/* if($g_total_count_of_each_div[$div_id]>0 )
		{
			$checked_flag=0;
			$total_rows=$g_total_count_of_each_div[$div_id];
			$n=0;
			for($k=0;$k<$total_rows;$k++)
			{
				$input_id="exam_"+$char_code+"_ce_sub_code_"+$k;
				$pass_id="exam_"+$char_code+"_ce_pass_"+$k;
				$year_id="exam_"+$char_code+"_ce_pass_"+$k;
			}
		} */

	//################Check Empty Subjects ENDS################################# 		
	
		$degree=trim(document.getElementById('candidate_list_degree_code').value);	
		$reg_no=trim(document.getElementById('candidate_list_reg_no').value);	
		$exam=trim(document.getElementById('fresh_Examno').value); 
			
		$details  = new Object();
		$fee_details  = new Object();
		$sub_details  = new Object();

			
		$char_code=$c_code;
		$div_id="candidate_list_exam_"+$char_code+"_details";
		$app_id="FAPPEAR"+$char_code;

		$details[$char_code]  = new Object();
		$fee_details[$char_code]  = new Object();
		$sub_details[$char_code]  = new Object();
		$sub_fee   = new Object();	
				 
			 
		if( $g_total_count_of_each_div[$div_id]>0 && $g_student_reg_no_exam_details[$app_id]!='N' && $g_student_reg_no_exam_details[$app_id]!='P' )
		{
			
			$total_rows=$g_total_count_of_each_div[$div_id];
			$sub_arr='';
			$sub_arr="\$exam_"+$char_code;
			$sub_arr  = new Object();
			$n=0;
			var $check_dupl_flag=0;
			for($k=0;$k<$total_rows;$k++)
			{
				$input_id="exam_"+$char_code+"_ce_sub_code_"+$k;
				if(trim($("#"+$input_id).val())=='')
				{
					alert("All Subject's should be Entered");
					$("#"+$input_id).focus();
					return;
				}
				var $check_dup=$("#"+$input_id).val();
				$check_dup_flag=0;
				for($m=0;$m<$total_rows;$m++)
				{
					
					if($m!=$k && ($check_dup==$("#exam_"+$char_code+"_ce_sub_code_"+$m).val() || $check_dup==$("#exam_"+$char_code+"_ce_sub_code_"+$m).html()) )
					{
						$check_dupl_flag=1;
						$dup_index=$m;
						break;
					}
					
				}	
				
				if($check_dupl_flag==1)
				{
					alert('Sub Code '+$check_dup+' allready Selected');
					$("#exam_"+$char_code+"_ce_sub_code_"+$dup_index).focus();
					$("#exam_"+$char_code+"_ce_short_name_"+$dup_index).html("");
					$("#exam_"+$char_code+"_ce_desc_"+$dup_index).html("");
					return;
				}  
				
				if(trim($("#"+$input_id).val())!='')
				{
					
					$sub_arr[$n]= new Object();
					$sub_arr[$n]['sub']=trim($("#"+$input_id).val());
					$sub_arr[$n]['opr']=document.getElementById($input_id).name;
					$sub_arr[$n]['ex']=$char_code;
					$n++; 
				}
				
			}
			
			var myJSONText='';
			myJSONText =($sub_arr) ;  
			$details[$char_code]=myJSONText;
	
		}
		else
		{
			$details[$char_code]='';
			
		}
		
		var freshEXformdata="&reg_no="+$reg_no+"&degree="+$degree+"&fresh_exam="+$exam+"&details="+(JSON.stringify($details))+"&prevSubj="+prevSubjectList;
		
		if($setSubjectValidate==0)
		{
		$.ajax({
	    type: "POST",
		async:false,
	    data:freshEXformdata, 
		url: $host_url+"saveFreshExamEntryDetails.demo",
		success: saveFreshExamEntryDetailsResponse
	    }); 
		}
		 
}
	
function saveFreshExamEntryDetailsResponse($responce)
{
	$responce = eval('('+$responce+')');
	document.getElementById('candidate_list_reg_no').disabled=false;
	document.getElementById('candidate_list_reg_name').disabled=false;
	document.getElementById('candidate_list_degree_code').disabled=false;
	document.getElementById('candidate_list_degree_name').disabled=false;
	document.getElementById('fresh_Examno').disabled=false;
	if($responce.error_code == 0)
	{
		$nextStudent=$responce.data.next_reg;
		$prevReg=$responce.data.prev_reg;
		prevFreshSubjectList=$responce.data.prev_subjects;
		
		if($nextStudent.FREGNO)
		{
			var module_name_for_save=document.getElementById('module_name_for_save').value;
			$.ajax({
			   type: "POST",
				async:false,
			   data: "Regno="+$nextStudent.FREGNO+"&module_name_for_save="+module_name_for_save,
			   url: $host_url+"getStudentRegisterNoName.demo",
			   success: function($resp_nxtrg)
			   {
					$resp_nxtrg = eval('('+$resp_nxtrg+')');
					if($resp_nxtrg.error_code == 0)
					{
						alert("Details Inserted Successfully");
						document.getElementById('candidate_list_reg_no').value = $resp_nxtrg.data['fregno'];
						document.getElementById('candidate_list_reg_name').value = $resp_nxtrg.data['fname']; 
						document.getElementById('candidate_list_degree_code').value = $resp_nxtrg.data['fdegree']; 
						document.getElementById('candidate_list_reg_no').focus(); 
						$("#candidate_list_degree_name").val($responce.data.FDESCPN);
						$("#freshSubj_details").html("");
						
						
					}
			   }
			}); 
			
			
		}
		else
		LoadIdentifySubjFreshExam();
	}
	else
	{
		alert("Error in Details Insertion");
	}
}

function displayCandidateEntryRegNoDetails()
{
	var module_name_for_save=document.getElementById('module_name_for_save').value;
		$.ajax({
	       type: "POST",
			async:false,
	       data: "Regno="+$("#candidate_list_reg_no").val()+"&module_name_for_save="+module_name_for_save,
	       url: $host_url+"getStudentRegisterNoName.demo",
 	       success: displayFreshExamEntryRegNoDetailsResponse
	    }); 
}
function displayFreshExamEntryRegNoDetailsResponse($responce)
{
	$responce = eval('(' + $responce + ')'); 
	if($responce.error_code==0)
	{
			document.getElementById('candidate_list_reg_no').value = $responce.data['fregno'];
			document.getElementById('candidate_list_reg_name').value = $responce.data['fname']; 
			document.getElementById('candidate_list_degree_code').value = $responce.data['fdegree']; 
			document.getElementById('candidate_list_category').focus(); 
			$("#candidate_list_degree_name").val($responce.data.FDESCPN);
			
			populateFreshExamNo();
		
		
	}
		
}