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.225.117.89
Current Path : /var/www/html/gcg/js/ |
| Current File : /var/www/html/gcg/js/daterange.js |
function EnableDateRange()
{
$("#page_main_div").load('html_modules/datesrange.html?v=26092016',function()
{
document.getElementById('display_module_name').innerHTML = 'Update Last Date ';
document.getElementById('module_name_for_save').value = 'Update Last Date ';
getDefaultHeadFooterLinks('Update Last Date ');
document.getElementById('fdate').value = getCookie("curdate");
document.getElementById('tdate').value = getCookie("curdate");
$('#date').hide();
$('#dates').hide();
});
}
function displayDatesDetails()
{
if(document.getElementById('fdaterange').value == '')
{
alert('please select event date');
document.getElementById('fdaterange').focus();
return false;
}else if(document.getElementById('college_code_from').value == '')
{
alert('please select college range');
document.getElementById('college_code_from').focus();
return false;
}else if(document.getElementById('degree_code_from').value == '')
{
alert('please select degree range');
document.getElementById('degree_code_from').focus();
return false;
}else if(document.getElementById('Examno_from').value == '')
{
alert('please select Exam range');
document.getElementById('Examno_from').focus();
return false;
}
$('#dates').show();
$("#dates").load('html_modules/datedetails.html',function()
{
/* document.getElementById('fdaterange').disabled = true;
document.getElementById('college_code_from').disabled = true;
document.getElementById('college_code_to').disabled = true;
document.getElementById('degree_code_from').disabled = true;
document.getElementById('degree_code_to').disabled = true;
document.getElementById('Examno_from').disabled = true;
document.getElementById('Examno_to').disabled = true; */
});
}
function SaveDateRange()
{
if( document.getElementById('fdaterange').value == '')
{
alert('please select event date');
document.getElementById('fdaterange').focus();
$("#fdaterange").focus();
return;
}else if(document.getElementById('college_code_from').value == '')
{
alert('please select college range');
document.getElementById('college_code_from').focus();
$("#college_code_from").focus();
return;
}else if(document.getElementById('college_code_to').value == '')
{
alert('please select college range');
document.getElementById('college_code_to').focus();
$("#college_code_to").focus();
return;
}else if(document.getElementById('degree_code_from').value == '')
{
alert('please select degree range');
document.getElementById('degree_code_from').focus();
$("#degree_code_from").focus();
return;
}else if(document.getElementById('degree_code_to').value == '')
{
alert('please select degree range');
document.getElementById('degree_code_to').focus();
$("#degree_code_to").focus();
return;
}else if(document.getElementById('Examno_from').value == '')
{
alert('please select exam range');
document.getElementById('Examno_from').focus();
$("#Examno_from").focus();
return;
}else if(fdaterange = document.getElementById('Examno_to').value == '')
{
alert('please select exam range');
document.getElementById('Examno_to').focus();
$("#Examno_to").focus();
return;
}/* else if(document.getElementById('fdate').value == '')
{
alert('please select from date');
document.getElementById('fdate').focus();
$("#fdate").focus();
return;
}else if(fdaterange = document.getElementById('tdate').value == '')
{
alert('please select to date');
document.getElementById('tdate').focus();
$("#tdate").focus();
return;
} */
var fdaterange = document.getElementById('fdaterange').value;
var college_code_from = document.getElementById('college_code_from').value;
var college_code_to = document.getElementById('college_code_to').value;
var degree_code_from = document.getElementById('degree_code_from').value;
var degree_code_to = document.getElementById('degree_code_to').value;
var Examno_from = document.getElementById('Examno_from').value;
var Examno_to = document.getElementById('Examno_to').value;
var fdate = document.getElementById('fdate').value;
var tdate = document.getElementById('tdate').value;
if(fdaterange == 'FATT')
{
var from_month = document.getElementById('fm').value;
var to_month = document.getElementById('tm').value;
var last_date = document.getElementById('ls').value;
}
var bulkinsert = 'F';
if(document.getElementById('ckbox').checked == true)
{
if(fdate == '')
{
alert('select from date.');
doctype.getElementById('fdate').focus();
return;
}
if(tdate == '')
{
alert('select to date.');
doctype.getElementById('tdate').focus();
return;
}
if(fdaterange == 'FATT')
{
if(from_month == '')
{
alert('select from month.');
doctype.getElementById('fm').focus();
return;
}
if(to_month == '')
{
alert('select to month.');
doctype.getElementById('tm').focus();
return;
}
if(last_date == '')
{
alert('select last date.');
doctype.getElementById('ls').focus();
return;
}
}
if(confirm('Are you sure you want to update the New date range?'))
bulkinsert = 'T';
else
{
bulkinsert = '';
document.getElementById('ckbox').checked = false;
}
}
var inputFileds = document.getElementsByTagName('input');
var chkCnt = 0;
var rowCnt = 0;
var date_arr = {};
for (var counter=0; counter < inputFileds.length; counter++)
{
if (inputFileds[counter].type.toUpperCase()=='TEXT' && inputFileds[counter].name == "date" )
{
++rowCnt;
if(document.getElementById(rowCnt+'h').value == 'U')
{
++chkCnt;
date_arr[chkCnt] = new Object();
date_arr[chkCnt]['collcode'] = document.getElementById(rowCnt+'collcode').value;
date_arr[chkCnt]['degree'] = document.getElementById(rowCnt+'degree').value;
date_arr[chkCnt]['examno'] = document.getElementById(rowCnt+'exam').value;
date_arr[chkCnt]['fromdate'] = document.getElementById(rowCnt+'date1').value;
date_arr[chkCnt]['todate'] = document.getElementById(rowCnt+'date2').value;
if(fdaterange == 'FATT')
{
date_arr[chkCnt]['fmth'] = document.getElementById(rowCnt+'fmth').value;
date_arr[chkCnt]['tmth'] = document.getElementById(rowCnt+'tmth').value;
date_arr[chkCnt]['lstdate'] = document.getElementById(rowCnt+'lstdate').value;
}
}
}
}
//alert(date_arr.length);
var datastring = "&fdaterange="+fdaterange+"&from_month="+from_month+"&to_month="+to_month+"&last_date="+last_date+"&college_code_from="+college_code_from+"&college_code_to="+college_code_to+"°ree_code_to="+degree_code_to+"°ree_code_from="+degree_code_from+"&Examno_from="+Examno_from+"&Examno_to="+Examno_to+"&fdate="+fdate+"&tdate="+tdate+"&date_arr="+encodeURIComponent(JSON.stringify(date_arr))+"&bulkinsert="+bulkinsert;
//if(document.getElementById('ckbox').checked == true)
//if(confirm('Are you sure you want to update the New date range?'))
if(Object.size(date_arr) >0 || bulkinsert =='T')
{
$.ajax({
type: "POST",
url: $host_url+"SaveDateRange",
data:datastring,
success:SaveDateRangeResponse
});
}else
{
alert('No changes made');
return false;
}
}
function SaveDateRangeResponse($responce)
{
$responce = eval('('+$responce+')');
alert($responce.data);
getdatedetails();
}
var fdaterange;
function getdatedetails()
{
fdaterange = document.getElementById('fdaterange').value;
var college_code_from = document.getElementById('college_code_from').value;
var college_code_to = document.getElementById('college_code_to').value;
var degree_code_from = document.getElementById('degree_code_from').value;
var degree_code_to = document.getElementById('degree_code_to').value;
var Examno_from = document.getElementById('Examno_from').value;
var Examno_to = document.getElementById('Examno_to').value;
if(fdaterange == '')
{
alert('please select event type');
document.getElementById('fdaterange').focus();
return false;
}
var datastring = "&fdaterange="+fdaterange+"&college_code_from="+college_code_from+"&college_code_to="+college_code_to+"°ree_code_to="+degree_code_to+"°ree_code_from="+degree_code_from+"&Examno_from="+Examno_from+"&Examno_to="+Examno_to;
$.blockUI({ message: "<h1 class='h1' style='font-size:12px'><img src='images/ajax-loader.gif' border='0'></h1>" });
$.ajax({
type: "POST",
url: $host_url+"getdatedetails",
data:datastring,
success:getdatedetailsResponse
});
}
function getdatedetailsResponse($responce)
{
$.unblockUI();
$responce = eval('('+$responce+')');
$('#dates').show();
$('#date').show();
$("#ftable").empty();
if($responce.error_code == 0)
{
$("#dates").load('html_modules/datedetails.html',function()
{
$("#frmth").hide();
$("#tomth").hide();
$("#lastdate").hide();
$("#sfm").hide();
$("#stm").hide();
$("#sls").hide();
if(fdaterange == 'FATT')
{
$("#frmth").show();
$("#tomth").show();
$("#lastdate").show();
$("#sfm").show();
$("#stm").show();
$("#sls").show();
}
});
$('#ftable').append($responce.data['table']);
}
else
{
alert('No records found for given details.');
$('#date').hide();
$('#dates').hide();
}
}
function to_upperx(id)
{
var x = document.getElementById(id).value;
document.getElementById(id).value = x.toUpperCase();
}
function getid(id,a)
{
document.getElementById(a+'h').value = 'U';
}
|