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 : 18.224.45.82


Current Path : /var/www/website/gaccta/js/
Upload File :
Current File : /var/www/website/gaccta/js/cms.js

CMS={
	getheaderdetails: function ()
	{ 		
		$.ajax({
		type: "POST",
		url:$host_url+'getheaderdetails',
		success: function (responce)
		{
			try
			{
				responce = eval('(' + responce + ')');				
				setCookie("title",responce.data.FUNIVNAME);
				setCookie("datestr",responce.data.datestr);
				document.getElementById("datestr").innerHTML = responce.data.datestr;
			}	
			catch(err)
			{
				txt= err.message;
				//$.unblockUI();
				//bootbox.alert(txt);
			}	
		}
		});	
	},
	GetCMSDropDownMenuValues : function ()
	{
		$.ajax({
		type: "POST",
		url:$host_url+'getcmsdropdownmenuvalues',
		success: function GetCMSDropDownMenuValuesResponce(responce)
		{
			try
			{
				responce = eval('(' + responce + ')');				
				var serv_arr = responce.data['serv_type'];
				var serv_title = '';
				CMS.FillDropdownValues(serv_arr,'S2',serv_title);
				
				var pay_arr = responce.data['pay_type'];
				var pay_title = '';
				CMS.FillDropdownValues(pay_arr,'S3',pay_title);
				
				var category = responce.data['category'];
				var cat_title = '';
				CMS.FillDropdownValues(category,'S1',cat_title);
			}	
			catch(err)
			{
				txt= err.message;
				bootbox.alert(txt);
			}	
		}
		});	
	},
	FillDropdownValues:function (arr,ele_name,def_title)
	{
		document.getElementById(ele_name).options.length=0;
		var op = new Option('  Select  '+def_title, '#');
		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);
		});
	},
	loadserviceslist:function(servcode)
	{
		$("#dyserviceslist  tbody tr").html("");
		document.getElementById("T26").value = 0;
		$.ajax({
		type: "POST",
		url:$host_url+'loadserviceslist'+"&servcode="+servcode,
		success: function(responce)
		{
			responce = eval('(' + responce + ')');	
				
			try
			{
				if(responce.error_code == 0)
				{
					if(responce.data['servtype'] == 'single')
					{
						var servdet = responce.data['services'];
						CMS.getservicefee(servdet[0].int_code,responce.data['servtype']);
						document.getElementById("cont_serviceslist").innerHTML = responce.data['servtablist'];
						document.getElementById("T27").innerHTML = responce.data['servpro'];
						document.getElementById("HA1").value = responce.data['servtype'];
					}	
					else
					{	
						serviceslist = responce.data['services'];
						document.getElementById("cont_serviceslist").innerHTML = responce.data['servtablist'];
						document.getElementById("T27").innerHTML = responce.data['servpro'];
						document.getElementById("HA1").value = responce.data['servtype'];
						var serv_title = '';			
						$("#dyserviceslist").append(responce.data['servmandatory']);
						CMS.addservicedet();						
					}	
				}
				else
				{
					document.getElementById("cont_serviceslist").innerHTML = '';
					document.getElementById("T26").innerHTML = 0;
					document.getElementById("T27").innerHTML = '';
				}	
			}	
			catch(err)
			{
				txt= err.message;
				$.unblockUI();
				bootbox.alert(txt);
			}				
		}
		});	
	},
	SaveApplicationDetails : function ()
	{
		var myobject;
		fldorder = 'S2,T1,T2,T3,T4,S1,T5,T10,T11,T12,T13,T14,T15';
		mandfields = 'S2,T1,T2,T3,T4,S1,T5,T10,T14,T15';
		myobject = onsavevalidate.call(myobject, 999);
		if (myobject != 999)
		{
			document.getElementById(myobject).focus();
			return false;
		}
		var list_data=$host_url+"SaveApplicationDetails";	
		var reg_no =  encodeURIComponent($("#T1").val());list_data+="&reg_no="+reg_no;	
		var degree = $("#HT4").val();list_data+="&degree="+degree;
		var college = $("#HT3").val();list_data+="&college="+college;
		var candidate_name = encodeURIComponent($("#T2").val());list_data+="&candidate_name="+candidate_name;
		var paddr1 =  encodeURIComponent($("#T10").val());list_data+="&paddr1="+paddr1;
		var paddr2 =  encodeURIComponent($("#T11").val());list_data+="&paddr2="+paddr2;
		var paddr3 =  encodeURIComponent($("#T12").val());list_data+="&paddr3="+paddr3;
		var paddr4 =  encodeURIComponent($("#T13").val());list_data+="&paddr4="+paddr4;
		var mobile_no =  encodeURIComponent($("#T15").val());list_data+="&mobile_no="+mobile_no;
		var emailid = $("#T14").val();list_data+="&emailid="+emailid;
	    var amount =  $("#T26").val();list_data+="&amount="+amount;
		var paytype =  $("#S3").val();list_data+="&paytype="+paytype;
		var dob =  $("#T5").val();list_data+="&dob="+dob; 
		var category = $("#S1").val();list_data+="&category="+category;
		var servicetype = $("#S2").val();list_data+="&servicetype="+servicetype;
	
		var event = document.createEvent('Event');
		if(!validateemail(event,emailid))
		{			
			alert('The Email ID format is invalid,the valid Email Id format is name@org.com or name@org.co.in');
			document.getElementById('T14').focus();
			return false;
		}
		if(category == "#")
		{
			alert("Select category");
			$("#S1").focus();
			return false;
		}
		if(servicetype == "#")
		{
			alert("Select Application for");
			$("#S2").focus();
			return false;
		}
		if(parseInt(amount) == 0)
		{
			alert("Amount cannot be zero");
			$("#S2").focus();
			return false;
		}
		if(paytype == "#")
		{
			alert("Select Payment mode");
			$("#S3").focus();
			return false;
		}
		if(document.getElementById("HA1").value == 'multiple')
		{	
			var inputFileds = document.getElementsByTagName('input');
			var chkCnt = 0;
			var rowCnt = 0;
			var serv_arr = {};
			for (var counter=0; counter < inputFileds.length; counter++) 
			{       
				if ( inputFileds[counter].type.toUpperCase() == 'HIDDEN'  && inputFileds[counter].name == "servicename" )
				{   
					++rowCnt;					
					if(document.getElementById(rowCnt+'GD4').value != 'T' && document.getElementById(rowCnt+'GD1').value != '#')
					{						
						serv_arr[chkCnt] = new Object();
						serv_arr[chkCnt]['feecode'] = document.getElementById(rowCnt+'GD1').value;
						serv_arr[chkCnt]['examyear'] = document.getElementById(rowCnt+'GD2').value;
						serv_arr[chkCnt]['fee']  = document.getElementById(rowCnt+'GD3').value;
						++chkCnt;
					} 	
				}
			}
			
			
		}
		else
		{
			var serv_arr = {};
			serv_arr[0] = new Object();
			serv_arr[0]['feecode'] = document.getElementById("HSR1").value;
			serv_arr[0]['examyear'] = '';
			serv_arr[0]['fee']  = document.getElementById('HSR2').value;	
		}	
		if(Object.size(serv_arr) > 0)
		{	
			list_data +="&serv_arr="+encodeURIComponent(JSON.stringify(serv_arr));
			//document.getElementById("serviceform_module").setAttribute("action",list_data);
			//return AIM.submit(document.getElementById("serviceform_module"), 'same_tab',{'onComplete' : CMS.SaveApplicationDetailsResponse});   		 
			$.ajax({
			type: "POST",
			url:$host_url+'ValidatePaymentApplicationData',
			//error:AjaxErrorMessage,
			data:list_data,
			success:CMS.SaveApplicationDetailsResponse
			});
		}	
	},
	SaveApplicationDetailsResponse : function(responce) 
	{
		try
		{
			responce = eval('(' + trim(responce) + ')');
			if (responce.error_code == 0)
			{
				document.getElementById("form_reg_success").style.display = "block";
				document.getElementById("form_reg_page").style.display = "none";
				document.getElementById("APT1").innerHTML = responce.data['appno'];
				var paytype = responce.data['paylink'];
				var paylink = '';	
				if(paytype == 'POSTOFFICE')
				{
					paylink +='<div class="row mb40" ><div class="col-md-9 mb5" align="center">';
					paylink +='<center><span  class="btn btn_3 btn-lg btn-info" onclick=CMS.PrintPOSTCertifcate("'+responce.data['appno']+'")>Print Acknowledgement</span></center></div></div>';	
				}	
				
				if(paytype == 'DEBIT/CREDIT/NET BANKING')
				{
					paylink +='<div class="row mb40" ><div class="col-md-9 mb5" align="center">';
					paylink +='<center><span  class="btn btn_3 btn-lg btn-info" onclick=CMS.MakeOnlinePayment("'+responce.data['appno']+'")>Make Payment</span></center></div></div>';	
				}  
				document.getElementById("payment_link").innerHTML = paylink;	
			}
			else
			{
				alert(responce.data);
				return false;
			}	
		}
		catch(err)
		{
			txt= err.message;
			bootbox.alert(txt+"<br>"+responce);
		}
		 
	},
	ValidatePaymentApplicationData:function()
	{
		var myobject;
		fldorder = 'T17,T18,T19';
		mandfields = 'T17,T18,T19';
		myobject = onsavevalidate.call(myobject, 999);
		if (myobject != 999)
		{
			document.getElementById(myobject).focus();
			return false;
		}
		var pappno 	= 	$("#T17").val();
		var pregno	=	$("#T18").val();
		var pdob	=	$("#T19").val();
		
		//App.blockUI({boxed:true,message:"Please wait,validating input details..."});
		$.ajax({
		type: "POST",
		url:$host_url+'ValidatePaymentApplicationData',
		//error:AjaxErrorMessage,
		data: "&pappno="+pappno+"&pdob="+pdob+"&pregno="+pregno, 
		success: function GetpaymentLinkForAppNoResponce(responce)
		{
			try
			{
				responce = eval('(' + responce + ')');
				//$.unblockUI();
				if(responce.error_code == -1)
				{
					alert(responce.data);
				}
				else
				{
					CMS.MakeOnlinePayment(responce.data['appno']);
				}
			}	
			catch(err)
			{
				txt= err.message;
				//$.unblockUI();
				bootbox.alert(txt);
			}	
		}
		});	
	},
	ValidatePrintCertificateApplicationData:function()
	{
		var myobject;
		fldorder = 'T20,T21,T22';
		mandfields = 'T20,T21,T22';
		myobject = onsavevalidate.call(myobject, 999);
		if (myobject != 999)
		{
			document.getElementById(myobject).focus();
			return false;
		}
		var appno 	=	$("#T20").val();		
		var regno	=	$("#T21").val();
		var dob		=	$("#T22").val();
		//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' )
					{	
						CMS.PrintPOSTCertifcate(responce.data['app_no']);
					}	
					if(responce.data['paytype'] == 'DEBIT/CREDIT/NET BANKING' && responce.data['paystatus'] == 'success')
					{	
						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);
			}	
		}
		});	
	},
	ValidateApplicationstatus:function()
	{
		var myobject;
		fldorder = 'T23,T24,T25';
		mandfields = 'T23,T24,T25';
		myobject = onsavevalidate.call(myobject, 999);
		if (myobject != 999)
		{
			document.getElementById(myobject).focus();
			return false;
		}
		var appno = $("#T23").val();		
		var regno = $("#T24").val();
		var dob	  = $("#T25").val();
		
		$.ajax({
		type: "POST",
		//async:false,
		url:$host_url+'ValidateApplicationstatus',
		//error:AjaxErrorMessage,
		data: "sappno="+appno+"&sregno="+regno+"&sdob="+dob, 
		success: function(responce)
		{
			try
			{
				responce = eval('(' + responce + ')');
				if(responce.error_code == 0)
				{
					$("#application_info").html(responce.data['html']);
				}
				else
				{					
					bootbox.alert(responce.data);
				}
			}	
			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',
			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('HT3').value = responce.data['FCOLLCODE'];
						document.getElementById('HT4').value = responce.data['FDEGREE'];						
						document.getElementById("S2").disabled = false;
						document.getElementById("S2").focus();
					}
					else
					{
						document.getElementById('T2').value = '';
						document.getElementById('T3').value = '';
						document.getElementById('T4').value = '';
						document.getElementById('HT3').value = responce.data['FCOLLCODE'];
						document.getElementById('HT4').value = responce.data['FDEGREE'];	
						document.getElementById('S2').value = '#';		
						document.getElementById('S1').value = '#';	
						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);
			}		
		}
		});	
	},
	MakeOnlinePayment:function (app_no)
	{
		window.location.href="payment_gateway.php?productinfo="+app_no+"&cdb="+getCookie("curuniv");
	},
	PrintNETBANKCertifcate:function (app_no)
	{
		//window.location.href=$host_url+"PrintNetbankCertificate&app_no="+app_no;
		window.location.href=$host_url+"printapplicationfrom&app_no="+app_no;
	},
	PrintPOSTCertifcate:function (app_no)
	{
		window.location.href=$host_url+"printapplicationfrom&app_no="+app_no;
		//window.location.href=$host_url+"appFormPOSTOFFICE&app_no="+app_no;
	},
	caltotservicefee: function(id,value)
	{
		if(document.getElementById(id).checked == true)
		{
			var totfee = parseInt(document.getElementById("T16").value);
			document.getElementById("T16").value = totfee + parseInt(value);
		}	
		else
		{
			var totfee = parseInt(document.getElementById("T16").value);
			document.getElementById("T16").value = totfee - parseInt(value);
		}	
	},
	addservicedet:function()
	{
		
			
		if(document.getElementById("S2").value == '#')
		{
			alert("Select service type");
			document.getElementById("S2").focus();
			return false;
		}	
		
		var inputFileds = document.getElementsByTagName('input');
		var chkCnt = 0;
		var slno = 0;
		for (var counter=0; counter < inputFileds.length; counter++) 
		{       
			if ( inputFileds[counter].type.toUpperCase()=='HIDDEN'  && inputFileds[counter].name == "servicename"  )
			{   
				++chkCnt;
				if(document.getElementById(chkCnt+'GD4').value == 'F')
					++slno;
			}
		}
		/* if(chkCnt != 1)
		{
			if(document.getElementById(chkCnt+'GD1').value == '#')
			{
				document.getElementById(chkCnt+'GD1').focus();
				return false;
			}	
		}	 */
		var dellink ='';
		if(chkCnt!=1)
		{
			dellink = "<img src='images/Remove-icon.png' />";
		} 	
		var curindex = chkCnt+1;
		var curslno = slno+1;
		var dyrow =	'<tbody id="servdet'+curindex+'"><tr>';
		dyrow +='<td align="center">'+curslno+'</td>';
		dyrow +='<td><input type="hidden" name="servicename" /><select id = "'+curindex+'GD1" class="form-control1" onchange = "CMS.getservicefee(this.value,'+curindex+')"></select></td>'; 
		dyrow += '<td><input type="text" id = "'+curindex+'GD2" value=""/></td>';
		dyrow += '<td><input type=text style="width:80px;" id = "'+curindex+'GD3"  disabled /></td>';
		dyrow += '<td><input type="hidden" id = "'+curindex+'GD4" value="F"/><span onclick ="CMS.removeservice('+curindex+')">'+dellink+'</span></td>';
		dyrow += '</tr></tbody>';
		$("#dyserviceslist").append(dyrow);
		var serv_title = '';
		CMS.FillDropdownValues(serviceslist,curindex+'GD1',serv_title);
	},
	 removeservice:function(rowid)
	{
		if(confirm("Are you sure do you want to remove this details"))
		{
			$("#servdet"+rowid).hide();
			document.getElementById(rowid+"GD4").value = 'T';	
			CMS.updatetotalservfee();
		}	
	},
	getservicefee:function(servcode,rowid)
	{
		var datastring = "&feecode="+servcode;
		$.ajax({
		type: "POST",
		url:$host_url+'getservicefee',
		data: datastring, 
		success: function(responce)
		{
			responce = eval('(' + responce + ')');
			if(responce.error_code == 0)
			{
				if(rowid == 'single')
				{	
					document.getElementById("T26").value = responce.data.FFEE;
					document.getElementById("HSR1").value = responce.data.FFEECODE
					document.getElementById("HSR2").value = responce.data.FFEE
				}
				else
				{	
					document.getElementById(rowid+"GD3").value = responce.data.FFEE;
					CMS.updatetotalservfee();
				}	
			}	
			else
			{	
				if(rowid == 'single')
				{
					document.getElementById("T26").value = 0;
				}
				else
				{		
					document.getElementById(rowid+"GD3").value = 0;
					CMS.updatetotalservfee();
				}	
			}	
		}	
		});
		
		
	},
	updatetotalservfee:function()
	{
		document.getElementById("T26").value = 0;
		var inputFileds = document.getElementsByTagName('input');
		var chkCnt = 0;
		var totalamt = 0;
		for (var counter=0; counter < inputFileds.length; counter++) 
		{       
			if ( inputFileds[counter].type.toUpperCase()=='HIDDEN'  && inputFileds[counter].name == "servicename"  )
			{   
				++chkCnt;
				if(document.getElementById(chkCnt+'GD4').value == 'F')
				{
					totalamt = parseInt(totalamt)+parseInt(document.getElementById(chkCnt+'GD3').value);
				}	
			}
		}	
		document.getElementById("T26").value = totalamt;
	},
	RestablishConnection:function (app_no,crmode) // return from payment gateway
	{
		if(trim(crmode) != '')
		{	
			var urlarr = window.location.pathname.split('/');
			var $url="http://"+window.location.host+"/";
			$hoststr = '';
			for(var j=1;j<urlarr.length-1;j++)
			{
				$hoststr += window.location.pathname.split('/')[j]+"/"; 
			}	
			$host_url = $url+$hoststr+"app.php?cdb="+crmode+"&a=";
			CMS.PrintNETBANKCertifcate(app_no);	
			
		}
		else
		{
			window.location.href = "index.html";
		}	
	}
}