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


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

function CallenableBundleDisptch()
{
	$("#page_main_div").load('html_modules/bundle_dispatch.html',function()
	{	
		document.getElementById('display_module_name').innerHTML = 'Bundle Dispatch';
		document.getElementById('module_name_for_save').value = 'Bundle Dispatch';	 	
		getDefaultHeadFooterLinks("Bundle Dispatch");
		
	}
	);

}
var nobundle =0;
function GetDefaultBundleDetails()
{
	var qpcode = trim(document.getElementById('bun_disp_qp_code').value);
	var qpdate = trim(document.getElementById('date_of_exam').value);
	var qpsession = trim(document.getElementById('qp_session').value);
	 nobundle = trim(document.getElementById('no_of_bundle').value);

	if(qpcode == '' || qpcode == 'null')
	{
		alert('Enter QP Code ');
		document.getElementById('bun_disp_qp_code').focus;
		return false;
	}
	if(qpdate == '' || qpdate == 'null')
	{
		alert('Enter Date ');
		document.getElementById('qpdate').focus;
		return false;
	}
	if(qpsession == '' || qpsession == 'null')
	{
		alert('Select  Session ');
		document.getElementById('qp_session').focus;
		return false;
	}
	
	if(nobundle == '' || nobundle == 'null')
	{
		alert('Enter No of Bundles ');
		document.getElementById('no_of_bundle').focus;
		return false;
	}
	
	var dataString = 'qpcode='+qpcode+'&qpdate='+qpdate+'&nobundle='+nobundle+"&qpsession="+qpsession;
	$.ajax({
				type: "POST",
				async:false,
				url: $host_url+"defaultBundleDetails",
				data:dataString,	
				success: defaultBundleDetailsResponce
			}); 
			
	

}

function defaultBundleDetailsResponce($responce)
{
	$responce = eval('('+$responce+')');
	budleDispTable($responce);
	$("#bun_disp_qp_code").attr("disabled","true");
	$("#date_of_exam").attr("disabled","true");
	$("#qp_session").attr("disabled","true");
}

function budleDispTable($responce)
{
	var table_bundleEntry = '';
	var index = 0;
	
	var budleDetails = $responce.data['bundle_details'];
	var budleCnt = budleDetails.length;
	table_bundleEntry =table_bundleEntry+="<table  width='60%'  align='center' border='0' cellpadding='0' cellspacing='0'>";				
	table_bundleEntry =table_bundleEntry+="<th align='left' colspan='6' class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper' style='font-size:12px; padding-left:6px; height:24px;'>Bundle Dispatch</th>	";				
	table_bundleEntry =table_bundleEntry+="<tr class='ui-state-default ui-jqgrid-hdiv'>";
	table_bundleEntry =table_bundleEntry+="<td  id='td_dispatch_slno' style='padding:2px; width:20px;  border-bottom:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-left:1px solid #C5DBEC;'><center>SL No</center></td>";
	table_bundleEntry =table_bundleEntry+="<td id='td_dispatch_script' style='padding:2px; width:50px;  border-bottom:1px solid #C5DBEC;  border-right:1px solid #C5DBEC;'><center>No. of Scripts</center></td>";
	table_bundleEntry =table_bundleEntry+="<td id='td_dispatch_script' style='padding:2px; width:50px;  border-bottom:1px solid #C5DBEC;  border-right:1px solid #C5DBEC;'><center>Bundle No.</center></td>";
	table_bundleEntry =table_bundleEntry+="<td id='td_dispatch_delete' style='padding:2px; width:25px;  border-bottom:1px solid #C5DBEC;  border-right:1px solid #C5DBEC;'><center>Delete </center></td>";

	for(var i=0;i<budleCnt;i++)
	{
		++index;
		table_bundleEntry =table_bundleEntry+"<tr><td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC; width:80px;'>"+index+"</td>";
		table_bundleEntry =table_bundleEntry+"<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC; width:80px;'><input type='hidden' id='bundle_"+index+"' value='"+budleDetails[i]['FBUNO']+"'>";
		table_bundleEntry =table_bundleEntry+"<input name='dispatch_ans_script' id='dispatch_script_"+index+"' type='text' style='width:70px;text-align:center;' value='"+budleDetails[i]['FTOTSCRIPT']+"' /></td>";
		table_bundleEntry =table_bundleEntry+"<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC; width:80px;'>"+budleDetails[i]['FBUNO']+"</td>";
		table_bundleEntry =table_bundleEntry+"<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC; width:80px;'><input type='checkbox' id='it_fmodule_"+index+"' onclick='deleteBundleDetails("+budleDetails[i]['FBUNO']+","+budleDetails[i]['FQPCODE']+")'></td></tr>";
	}
	if(nobundle > budleCnt)
	{
		newBundle = nobundle - budleCnt;
	}
	else
	{
		document.getElementById('no_of_bundle').value = budleCnt;
		newBundle =0;
	}
	for(var i=0;i<newBundle;i++)
	{
		++index;
		table_bundleEntry =table_bundleEntry+"<tr><td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC; width:80px;'>"+index+"</td>";
		table_bundleEntry =table_bundleEntry+"<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC; width:80px;'><input type='hidden' id='bundle_"+index+"' value='0'>";
		table_bundleEntry =table_bundleEntry+"<input name='dispatch_ans_script' id='dispatch_script_"+index+"' type='text' style='width:70px;text-align:center;' /></td>";
		table_bundleEntry =table_bundleEntry+"<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC; width:80px;'></td>";
		table_bundleEntry =table_bundleEntry+"<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC; width:80px;'><input type='checkbox' id='it_fmodule_"+index+"'></td></tr>";
	}
	
	table_bundleEntry =table_bundleEntry+"</tr></table>";
	$("#Dispatch_ans_script_header").html(table_bundleEntry);

}

function ClearBundleDetails()
{
	CallenableBundleDisptch();
}


function SaveBundleDetails()
{
		var att_data = new Object();
 
			html_objects =$("input[id*='bundle_']");
			jQuery.each(html_objects, function(k, v) {
			var internal_code=v['id'].split("_")[1];
		
			att_data[internal_code]=new Object();
			att_data[internal_code]['c']=$("#dispatch_script_"+internal_code).val();
			att_data[internal_code]['d']=$("#bundle_"+internal_code).val();

			
	  	});	
		var qpcode = trim(document.getElementById('bun_disp_qp_code').value);
		var qpdate = date_format(document.getElementById('date_of_exam').value);
		var qpsession = trim(document.getElementById('qp_session').value);
	
		var dataString = '&qpcode='+qpcode+'&qpdate='+qpdate+"&qpsession="+qpsession;
		var myJSONText = encodeURIComponent(JSON.stringify(att_data));  
		$list_data="output_details="+myJSONText+dataString;
		$.ajax({
				type: "POST",
				async:false,
				url: $host_url+"saveBundleDetails",
				data:$list_data,	
				success: saveBundleDetailsResponce
			}); 
		
}

function saveBundleDetailsResponce($responce)
{
	$responce = eval('('+$responce+')');
	alert($responce.data);
	GetDefaultBundleDetails();	
}

function generateBundleDispatchQPWise()
{
	var qpcode = trim(document.getElementById('bun_disp_qp_code').value);
	var qpdate = trim(document.getElementById('date_of_exam').value);
	var qpsession = trim(document.getElementById('qp_session').value);
	 nobundle = trim(document.getElementById('no_of_bundle').value);

	if(qpcode == '' || qpcode == 'null')
	{
		alert('Enter QP Code ');
		document.getElementById('bun_disp_qp_code').focus;
		return false;
	}
	if(qpdate == '' || qpdate == 'null')
	{
		alert('Enter Date ');
		document.getElementById('qpdate').focus;
		return false;
	}
	if(nobundle == '' || nobundle == 'null')
	{
		alert('Enter No of Bundles ');
		document.getElementById('no_of_bundle').focus;
		return false;
	}

	
	var dataString = '&qpcode='+qpcode+'&qpdate='+qpdate+'&nobundle='+nobundle+"&qpsession="+qpsession;
	window.location.href = $host_url+"generateBundleDispatchQPWise"+dataString; 

}


function deleteBundleDetails(bunid,qpcode)
{
	if (confirm(" Are you sure you want to Delete, Then Press 'OK' Else 'Cancel' ") == true) 
	{
		
		$.ajax({
				type: "POST",
				async:false,
				url: $host_url+"deleteBundleDetails",
				data:"bunid="+bunid+"&qpcode="+qpcode,	
				success:deleteBundleDetailsResponce
			}); 
	}
}


function deleteBundleDetailsResponce($responce)
{
	$responce = eval('('+$responce+')');
	
	alert($responce.data);
	GetDefaultBundleDetails();
	
}