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


Current Path : /var/www/html/cnv/kusdde/custom_js/
Upload File :
Current File : /var/www/html/cnv/kusdde/custom_js/cms_arun.js

CMS={
	GetHeaderDetails: function ()
	{ 
		$("#T14").inputmask("d/m/y", {
			"placeholder": "dd/mm/yyyy"
		});
		$("#passport_expiry_date").inputmask("d/m/y", {
			"placeholder": "dd/mm/yyyy"
		});
		$("#visa_expiry_date").inputmask("d/m/y", {
			"placeholder": "dd/mm/yyyy"
		});
		$("#p_dob").inputmask("d/m/y", {
			"placeholder": "dd/mm/yyyy"
		});
		$("#c_dob").inputmask("d/m/y", {
			"placeholder": "dd/mm/yyyy"
		});
		$("#apps_dob").inputmask("d/m/y", {
			"placeholder": "dd/mm/yyyy"
		});
		$("#rp_dob").inputmask("d/m/y", {
			"placeholder": "dd/mm/yyyy"
		});
		$("#pd_from_date").inputmask("d/m/y", {
			"placeholder": "dd/mm/yyyy"
		});
		$("#pd_to_date").inputmask("d/m/y", {
			"placeholder": "dd/mm/yyyy"
		});
		$.ajax({
		type: "POST",
		url:$host_url+'GetHeaderDetails',
		error:AjaxErrorMessage,
		success: function GetHeaderDetailsResponce(responce)
		{
			try
			{
				responce = eval('(' + responce + ')');
				document.getElementById('header_title').innerHTML = responce.data['FUNIVNAME'];
				document.getElementById('header_addr').innerHTML = responce.data['FUNIVADD1'];
				$("#header_logo").attr('src',responce.data['FLOGOPATH']); 
				CMS.GetCMSDropDownMenuValues();	
			}	
			catch(err)
			{
				txt= err.message;
				$.unblockUI();
				bootbox.alert(txt);
			}	
		}
		});	
	},
	GetCMSDropDownMenuValues : function ()
	{
		$.ajax({
		type: "POST",
		url:$host_url+'GetCMSDropDownMenuValues',
		error:AjaxErrorMessage,
		success: function GetCMSDropDownMenuValuesResponce(responce)
		{
			try
			{
				responce = eval('(' + responce + ')');				
				var payment_arr = responce.data['acctype'];
				var conv_arr = responce.data['convtype'];
				//var cat_arr = responce.data['category'];
				CMS.FillDropdownValues(payment_arr,'T13');
				//CMS.FillDropdownValues(cat_arr,'T16');	
			}	
			catch(err)
			{
				txt= err.message;
				$.unblockUI();
			}	
		}
		});	
	},
	 FillDropdownValues:function (arr,ele_name)
	{
		document.getElementById(ele_name).options.length=0;
		var op = new Option('  Select  ', '00');
		op.id='00';
		document.getElementById(ele_name).options.add(op);
		jQuery.each(arr, function(k, v) {	 
		
		var op = new Option(v['val'], v['int_code']);
		op.id=v['int_code'];
		document.getElementById(ele_name).options.add(op);
		});
	},
	ValidateCertificateDetails:function ()
	{
		list_data="";
		var student_entry_photo =  ($("#student_entry_upload").val());
		var reg_no =  encodeURIComponent($("#T1").val()); 
		var candidate_name = encodeURIComponent($("#T2").val()) 
		var college =  encodeURIComponent($("#T3").val()); 
		var degree =  encodeURIComponent($("#T4").val()); 
		var mobileno =  encodeURIComponent($("#T5").val()); 
		var confmobileno =  encodeURIComponent($("#T6").val()); 
		var emailid =  $("#T7").val(); 
		var postaladdr =  encodeURIComponent($("#T8").val()); 
		var amount =  encodeURIComponent($("#T12").val()); 
		var convtype =  encodeURIComponent($("#T15").val()); 
		var paytype =  encodeURIComponent($("#T13").val()); 
		var dob = date_format($("#T14").val());
		var event = document.createEvent('Event');
		if(empty(reg_no))
		{
			bootbox.alert("Enter Register no.");
			$("#T1").focus();
			return false;
		}
		
		else if(empty(candidate_name))
		{
			bootbox.alert("Enter candidate name");
			$("#T2").focus();
			return false;
		}
		else if(dob=="0000-00-00")
		{
			bootbox.alert("Enter Date of Birth");
			$("#T14").focus();
			return false;
		}
		else if(empty(mobileno) || mobileno.length!=10 )
		{
			bootbox.alert("Enter 10 digit mobile number");
			$("#T5").focus();
			return false;
		}
		else if(empty(confmobileno) || confmobileno.length!=10 )
		{
			bootbox.alert("Enter 10 digit mobile number");
			$("#T6").focus();
			return false;
		}
		else if(mobileno != confmobileno)
		{
			bootbox.alert("The confirmed mobile no. does not match with mobile no.");
			$("#T6").focus();
			return false;
		}
		else if(!validateemail(event,emailid))
		{
			
			bootbox.alert('The Email ID format is invalid,the valid Email Id format is name@org.com or name@org.co.in');
			document.getElementById('T7').focus();
			return false;
		}	 
		else if(empty(postaladdr))
		{
			alert("Enter postal address");
			$("#T8").focus();
			return false;
		}
		if(paytype == '00')
		{
			alert("Select Payment Type");
			$("#T13").focus();
			return false;
		}
		if(parseInt(amount) == 0)
		{
			alert("Select Payment Type");
			$("#T13").focus();
			return false;
		}
		if (document.getElementById('student_entry_photo').getAttribute('src') == "img/default_photo.jpg")
		{
			alert("Upload photo");
			$("#student_entry_photo").focus();
			return false;
		}	
	/* 	else if(convtype == '00')
		{
			alert("Select Convocation");
			$("#T15").focus();
			return false;
		} */
		if(document.getElementById('student_declr').checked != true)
		{
			alert("Read the Declaration and check I agree to the Terms ");
			return false;
		}	
		var flag=true;
		return flag;
		 
	},
	SaveCertificateDetails : function ()
	{
		var list_data=$host_url+"SaveCertificateDetails";
		var reg_no =  encodeURIComponent($("#T1").val());list_data+="&reg_no="+reg_no;	
		var course = $("#T4").val();list_data+="&course="+course;
		var college = $("#T3").val();list_data+="&college="+college;
		var candidate_name = encodeURIComponent($("#T2").val());list_data+="&candidate_name="+candidate_name;
		var paddr1 =  encodeURIComponent($("#T8").val());list_data+="&paddr1="+paddr1;
		var paddr2 =  encodeURIComponent($("#T9").val());list_data+="&paddr2="+paddr2;
		var paddr3 =  encodeURIComponent($("#T10").val());list_data+="&paddr3="+paddr3;
		var paddr4 =  encodeURIComponent($("#T11").val());list_data+="&paddr4="+paddr4;
		var mobile_no =  encodeURIComponent($("#T5").val());list_data+="&mobile_no="+mobile_no;
		var email_id =  encodeURIComponent($("#T7").val());list_data+="&email_id="+email_id;
	    var amount =  encodeURIComponent($("#T12").val());list_data+="&amount="+amount;
		var paytype =  encodeURIComponent($("#T13").val());list_data+="&paytype="+paytype;
		var dob =  date_format($("#T14").val());list_data+="&dob="+dob;
		var valid_file_extentions = new Array("jpeg","jpg",'png','gif');
		var ext=$("#student_entry_upload").val();
		filepath=ext;
		ext = ext.substring(ext.length-3,ext.length);
		ext = ext.toLowerCase();  
		if(ext != "" && !in_array(ext,valid_file_extentions))
		{	      
			alert("Please Select the Valid Photo!");
			return false;
		}			 
		App.blockUI({boxed:true,message:"Please wait, We are saving Data"});
		list_data+="&filepath="+filepath;	

		document.getElementById("form_module_details_upload").setAttribute("action",list_data);
		return AIM.submit(document.getElementById("form_module_details_upload"), 'same_tab',{'onComplete' : CMS.SaveCertificateDetailsResponse});   
			
			 
	},
	SaveCertificateDetailsResponse : function (responce) {
		try
			{
				$.fancybox.close();
				App.unblockUI();
				responce = eval('(' + trim(responce) + ')');
				if (responce.error_code == 0)
				{
				 
					CMS.GetpaymentLinkForAppNo(responce.data['app_no']); 
					 
				}
				else
				{
					alert(responce.data);
					return false;
				}	
			}
			catch(err)
			{
				txt= err.message;
				bootbox.alert(txt+"<br>"+responce);
			}
		 
	} ,
	GetpaymentLinkForAppNo:function(app_no)
	{
			$.ajax({
				type: "POST",
				//async:false,
				url:$host_url+'GetpaymentLinkForAppNo',
				error:AjaxErrorMessage,
				data: "&app_no="+app_no, 
				success: function GetpaymentLinkForAppNoResponce(responce)
				{
				try
				{
				responce = eval('(' + responce + ')');
				$("#tasks_inbox").html(responce.data);
				}	
				catch(err)
				{
				txt= err.message;
				$.unblockUI();
				bootbox.alert(txt);
				}	
				}
			});	
	},
	ValidatePaymentApplicationData:function()
	{
		var p_appno=$("#p_appno").val();
		var p_dob=date_format($("#p_dob").val());
		var p_reg_no=$("#p_regno").val();
		if(empty(p_appno))
		{
			bootbox.alert("Please Enter Application no.");
			return false;
		}else if(empty(p_reg_no))
		{
			bootbox.alert("Please Enter Reg No");
			return false;
		}
		else if(p_dob=="0000-00-00")
		{
			bootbox.alert("Please Enter Date of Birth");
			return false;
		}
		App.blockUI({boxed:true,message:"Please wait,validating input details..."});
		$.ajax({
		type: "POST",
		url:$host_url+'ValidatePaymentApplicationData',
		error:AjaxErrorMessage,
		data: "&p_appno="+p_appno+"&p_dob="+p_dob+"&p_reg_no="+p_reg_no, 
		success: function GetpaymentLinkForAppNoResponce(responce)
		{
			try
			{
				responce = eval('(' + responce + ')');
				$.unblockUI();
				if(responce.error_code==-1)
				{
					bootbox.alert(responce.data);
				}
				else
				{
					CMS.MakeOnlinePayment(responce.data['app_no']);
				}
			}	
			catch(err)
			{
				txt= err.message;
				$.unblockUI();
				bootbox.alert(txt);
			}	
		}
		});	
	},
	ValidatePrintCertificateApplicationData:function()
	{
		var appno =$("#rp_app_no").val();
		var dob=date_format($("#rp_dob").val());
		var regno=date_format($("#rp_reg_no").val());
		if(empty(appno))
		{
			bootbox.alert("Enter Application no.");
			return false;
		}
		else if(empty(regno))
		{
			bootbox.alert("Enter Reg No");
			return false;
		}
		else if(dob=="0000-00-00")
		{
			bootbox.alert("Enter Date of Birth");
			return false;
		}
		App.blockUI({boxed:true,message:"Please wait,generating report..."});
		$.ajax({
		type: "POST",
		url:$host_url+'ValidatePrintCertificateApplicationData',
		error:AjaxErrorMessage,
		data: "&appno="+appno+"&dob="+dob+"&regno="+regno, 
		success: function ValidatePrintCertificateApplicationDataResponce(responce)
		{
			try
			{
				responce = eval('(' + responce + ')');
				$.unblockUI();
				if(responce.error_code==-1)
				{
					bootbox.alert("Invalid Inputs Entered");
				}
				else
				{
					if(responce.data['paytype'] =='POSTOFFICE' )
					{	
						//alert('');
						CMS.PrintPOSTCertifcate(responce.data['app_no']);
					}	
					if(responce.data['paytype'] == 'DEBIT/CREDIT/NET BANKING' && responce.data['paystatus'] == 'success')
					{	
						//alert('');
						CMS.PrintNETBANKCertifcate(responce.data['app_no']);
					}	
					if(responce.data['paytype'] == 'DEBIT/CREDIT/NET BANKING' && responce.data['paystatus'] != 'success')
					{
						txt = 'Online Payment Pending';
						bootbox.alert(txt);
					}	
				}
			}	
			catch(err)
			{
				txt= err.message;
				$.unblockUI();
				bootbox.alert(txt);
			}	
		}
		});	
	},
	
	MakeOnlinePayment:function (app_no)
	{
		window.location.href="payment_gateway.php?productinfo="+app_no;
	},
	PrintNETBANKCertifcate:function (app_no)
	{
		window.location.href=$host_url+"PrintNetbankCertificate&app_no="+app_no;
	},
	PrintPOSTCertifcate:function (app_no)
	{
		window.location.href=$host_url+"PrintPostCertificate&app_no="+app_no;
	},
	ValidateOTPasssword:function()
	{
			$("#otp_error").hide();
		if($("#otp_password_input").val()==document.getElementById('TH1').value)
		{
			CMS.SaveCertificateDetails();
		}
		else
		{
			$("#otp_error").show();
		}
	},
	SendMailOtPToUser:function()
	{
		if(CMS.ValidateCertificateDetails())
		{
			$("#otp_password_input").val("");
			$("#otp_error").hide();
			App.blockUI({boxed:true,message:"Please wait,System Sending OTP Password"});
			$.ajax({
			type: "POST",
			url:$host_url+'SendMailOtPToUser',
			error:AjaxErrorMessage,
			data: "s_mobile_no="+$("#T5").val()+"&s_email_id="+$("#T7").val(), 
			success: function GetPendingCertificatesDataResponce(responce)
			{
				try
				{
					$.unblockUI();
					responce = eval('(' + responce + ')');
					if(responce.error_code==-1)
					{
						
						bootbox.alert(responce.data);
					}
					else
					{
						document.getElementById('TH1').value = responce.data;
						$(".fancybox").trigger("click");						
					}
				}	
				catch(err)
				{
					txt= err.message;
					$.unblockUI();
					bootbox.alert(txt);
				}	
			}
		});	
		}
	},
	
	ShowCertficateToggle:function(id)
	{
		$("#cert_tr_"+id).toggle();
	},
	GetCollwiseCandidateList:function()
	{
		$.ajax({
		type: "POST",
		//async:false,
		url:$host_url+'GetCollwiseCandidateList',
		error:AjaxErrorMessage,
		data: "from_app="+$("#app_from_app").val()+"&to_app="+$("#app_to_app").val(), 
		success: function GetPendingCertificatesDataResponce(responce)
		{
			try
			{
				responce = eval('(' + responce + ')');
				if(responce.error_code==-1)
				{

				}
				else
				{
					$("#tasks_inbox_trial").html(responce.data['html']);
				}
			}	
			catch(err)
			{
				txt= err.message;
				$.unblockUI();
				bootbox.alert(txt);
			}	
		}
		});	
	},
	viewCandidateDetails:function(appno,collcode)
	{
		$.ajax({
		type: "POST",
		//async:false,
		url:$host_url+'GetCandidateDetails',
		error:AjaxErrorMessage,
		data: "appno="+appno+"&collcode="+collcode, 
		success: function(responce)
		{
			try
			{
				responce = eval('(' + responce + ')');
				if(responce.error_code==-1)
				{

				}
				else
				{					
					document.getElementById('cand_list').className = ' ';
					document.getElementById('cand_details').className = 'active';
					document.getElementById('tasks_inbox').className = 'tab-pane';
					document.getElementById('candidate_details').className += ' active';
					document.getElementById('cand_details').focus();
					$("#candidate_details").html(responce.data['html']);
				}
			}	
			catch(err)
			{
				txt= err.message;
				$.unblockUI();
				bootbox.alert(txt);
			}	
		}
	});
	},
	viewCollCandidateDetails:function(appno,collcode,type)
	{
		$.ajax({
		type: "POST",
		//async:false,
		url:$host_url+'GetCandidateDetails',
		error:AjaxErrorMessage,
		data: "appno="+appno+"&collcode="+collcode, 
		success: function(responce)
		{
			try
			{
				responce = eval('(' + responce + ')');
				if(responce.error_code==-1)
				{

				}
				else
				{	
					if(type == 'pending')
					{	
						document.getElementById('cand_list').className = ' ';
						document.getElementById('cand_details').className = 'active';
						document.getElementById('tasks_inbox').className = 'tab-pane';
						document.getElementById('candidate_details').className += ' active';
						document.getElementById('cand_details').focus();
						$("#candidate_details").html(responce.data['html']);
					}
					
					if(type == 'verified')
					{	
						document.getElementById('cand_verified').className = ' ';
						document.getElementById('cand_details').className = 'active';
						document.getElementById('verified_div').className = 'tab-pane';
						document.getElementById('candidate_details').className += ' active';
						document.getElementById('cand_details').focus();
						$("#candidate_details").html(responce.data['html']);
					}	
				}
			}	
			catch(err)
			{
				txt= err.message;
				$.unblockUI();
				bootbox.alert(txt);
			}	
		}
	});
	},
	Getstudentdetails:function(event,regno)
	{
		if(regno.length > 0)
		{	
			App.blockUI({boxed:true,message:"Please wait,loading data.."});
			$.ajax({
			type: "POST",
			url:$host_url+'Getstudentdetails',
			error:AjaxErrorMessage,
			data: "regno="+regno, 
			success: function(responce)
			{
				try
				{
					responce = eval('(' + responce + ')');
					$.unblockUI();
					if(responce.error_code==0)
					{
						document.getElementById('T2').value = responce.data['FNAME'];
						document.getElementById('T3').value = responce.data['FCOLLNAME'];
						document.getElementById('T4').value = responce.data['FDESCPN'];
						document.getElementById('T15').value = responce.data['FCNVNAME'];
						document.getElementById('T12').value = responce.data['Fee'];
					}
					else
					{
						document.getElementById('T2').value = '';
						document.getElementById('T3').value ='';
						document.getElementById('T4').value = '';
						document.getElementById('T15').value = '';
						document.getElementById('T12').value = '0';
						bootbox.alert(responce.data);
						
					}	
				}	
				catch(err)
				{
					txt= err.message;
					$.unblockUI();
					bootbox.alert(txt);
				}	
			}
			});
		}
	},
	ViewCertificateApplicationData:function()
	{
		var regno = document.getElementById('apps_reg_no').value;
		var appno = document.getElementById('apps_app_no').value;
		var dob = document.getElementById('apps_dob').value;
		
		if(empty(appno))
		{
			bootbox.alert("Enter Application no.");
			return false;
		}
		else if(dob=="0000-00-00")
		{
			bootbox.alert("Enter Date of Birth");
			return false;
		}else if(empty(regno))
		{
			bootbox.alert("Enter Register no.");
			return false;
		}
		App.blockUI({boxed:true,message:"Please wait, data loading..."});
		var datastring = "regno="+regno+"&appno="+appno+"&dob="+dob;
		$.ajax({
		type: "POST",
		url:$host_url+'Getapplicationstatusdetails',
		error:AjaxErrorMessage,
		data: datastring, 
		success: function(responce)
		{
			App.unblockUI();
			responce = eval('(' + responce + ')');
			if(responce.error_code==0)
			{
				try
				{					
					$("#status_task").html(responce.data['html']);
				}	
				catch(err)
				{
					txt= err.message;
					$.unblockUI();
					bootbox.alert(txt);
				}	
			}
			else
			{
				bootbox.alert(responce.data);
			}		
		}
		});	
	},
	UploadEmployeeDocuments:function(file_name)
	{
		var ext = $("#categoryatt").val();
		var filepath = ext;	
		if(empty(filepath))
		{ 
			alert("please select the file!");
			return false;
		}
		var list_data="";
		list_data = $host_url+"UploadEmployeeDocuments";			
		list_data += "&filepath="+filepath;	
		list_data += "&file_name="+file_name;	
		document.getElementById("form_module_details_upload").setAttribute("action",list_data);
		App.blockUI({boxed:true,message:"Please wait,Uploading"});
		return AIM.submit(document.getElementById("form_module_details_upload"), 'same_tab',{'onComplete' : CMS.UploadEmployeeDocumentsResponce});
	},
	UploadEmployeeDocumentsResponce:function (responce)
	{ 
		responce = eval('(' + trim(responce) + ')');
		App.unblockUI();
		var int_code=responce.data['id'];
		var path=responce.data['path'];
		var file_name=responce.data['file_name'];
		var html='<a target="_blank" href="'+path+'" style="color:#AB45F9; padding-right:5px;">'+file_name+'</a>';
		document.getElementById('categoryattpath').value = path;
		$("#attach_td_cat").html(html);
	},
	downloadstudentphotos:function()
	{
		var fromdate = date_format($("#pd_from_date").val());
		if(fromdate=="0000-00-00")
		{
			bootbox.alert("Enter from date");
			$("#pd_from_date").focus();
			return false;
		}
		var todate = date_format($("#pd_to_date").val());
		if(todate=="0000-00-00")
		{
			bootbox.alert("Enter to date");
			$("#pd_to_date").focus();
			return false;
		}
		window.location.href = $host_url+"downloadstudentphotos&fromdate="+fromdate+"&todate="+todate; 
	}
	
}