// JavaScript Document
function parallax(){
var scrolled = $(window).scrollTop();
$('.splashbg').css('top', -(scrolled * 0.2) + 'px');
}
/* REGISTRATION */
function datetounix(resdate, seconds) {
var sresdate = resdate.split(" ");
var dresdate = sresdate[0].split("-");
var tresdate = sresdate[1].split(":");
var hresdate = parseInt(tresdate[0]);
if (hresdate == 12) {
hresdate = 0;
}
if (sresdate[2] == 'PM') {
hresdate = hresdate + 12;
}
var cresdate = dresdate[1] + "/" + dresdate[2] + "/" + dresdate[0] + " " + hresdate + ":" + tresdate[1] + ":00";
var resunix = new Date(cresdate).getTime();
var newunix = resunix + (seconds * 1000); //3 hours pickdate
return newunix;
}
function unixtodate(newt) {
var tyear = newt.getFullYear();
var tmonth = '0' + (parseInt(newt.getMonth()) + 1);
var tday = '0' + newt.getDate();
var thour = newt.getHours();
var tmin = newt.getMinutes();
var ampm = thour >= 12 ? 'PM' : 'AM';
thour = thour % 12;
thour = thour ? thour : 12;
thour = thour < 10 ? '0' + thour : thour;
tmin = tmin < 10 ? '0' + tmin : tmin;
var ttime = thour + ':' + tmin + ' ' + ampm;
var newdate = tyear + "-" + tmonth.substr(-2) + "-" + tday.substr(-2) + " " + ttime;
return newdate;
}
function unixtodatemidnight(newt) {
var tyear = newt.getFullYear();
var tmonth = '0' + (parseInt(newt.getMonth()) + 1);
var tday = '0' + newt.getDate();
var thour = newt.getHours();
var tmin = newt.getMinutes();
var ampm = thour >= 12 ? 'PM' : 'AM';
thour = thour % 12;
thour = thour ? thour : 12;
thour = thour < 10 ? '0' + thour : thour;
tmin = tmin < 10 ? '0' + tmin : tmin;
var ttime = thour + ':' + tmin + ' ' + ampm;
var newdate = tyear + "-" + tmonth.substr(-2) + "-" + tday.substr(-2) + " 11:59 PM";
return newdate;
}
function upperCase(strInput) {
var theString = strInput.value;
var strOutput = "";// Our temporary string used to build the function's output
theString = theString.toUpperCase();
strOutput = theString;
strInput.value = strOutput;
}
function updatePos(strInput) {
theString = strInput.selectedIndex;
strValue = document.getElementsByTagName("option")[theString].text;
strOutput = "";
strValue = strValue.toUpperCase();
strOutput = strValue;
document.getElementById('comp_position').value = strOutput;
}
function updatePos2(strInput) {
var theString = strInput.value;
var strOutput = "";
theString = theString.toUpperCase();
strOutput = theString;
document.getElementById('comp_position').value = strOutput;
}
function updateHired(strInput) {
var theString = strInput.value;
var strOutput = "";
theString = theString.toUpperCase();
strOutput = theString;
document.getElementById('comp_from').value = strOutput;
}
function positionChk(val) {
var p = val;
if (p.options[p.selectedIndex].value == 1000000)
{
document.getElementById('divotherpos').style.display = "inline-block";
}
else
{
document.getElementById('divotherpos').style.display = "none";
}
return false;
}
function checkID(empID) {
var theID = empID.value;
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/reg_request.php?sec=checkid",
data: "id=" + theID,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
if (data != 0) {
$('#checkIDerr').html("Someone already used this employee ID");
}
else {
$('#checkIDerr').html("");
}
}
})
}
/* COMMENT */
function chkCommentTxt() {
if ($('#comment_message').val().length < 2)
{
$("#btncreatecomment").addClass("invisible");
}
else
{
$("#btncreatecomment").removeClass("invisible");
}
}
$(function() {
// scrollable
$(window).scroll(function(){
parallax();
});
//MAIN MENU
$('#showmenu').on("click", function() {
$("#floatdiv2").show("slide");
});
$('#showmenumob').on("click", function() {
$("#floatdiv2").show("slide");
});
$('#floatdiv2').on("mouseup", function(e) {
if(e.target.id != $('#floatmenu').attr('id') && !$('#floatmenu').has(e.target).length)
{
$("#floatdiv2").hide("slide");
}
});
//STAR RATING
$('#star-rating').rating(function(vote, event){
$('#reserve_rating').val(vote);
});
//FLOAT BUTTON
$('#reservenow').on("click", function() {
var appr = $("#txtappr").val();
if (appr == 0) {
alert("You have no approver has been set to your account please call Corporate Administration.");
} else {
$(this).removeClass("floatbtnanimation");
$("#floatdiv").removeClass("invisible");
$("#freserve").removeClass("invisible");
$('.addform').trigger("reset");
$(".vreserve_msg").css("display", "none");
$("#fapp").addClass("invisible");
$("#fview").addClass("invisible");
$("#fview3").addClass("invisible");
$("#fedit").addClass("invisible");
}
});
$('#cannounce').on("click", function() {
$("#floatdiv").removeClass("invisible");
$("#freserve").addClass("invisible");
$("#fapp").addClass("invisible");
$("#fview").addClass("invisible");
$("#fview3").removeClass("invisible");
$("#fedit").addClass("invisible");
});
$('#addnow').on("click", function() {
$("#etitle").html("Add");
$('.addform').trigger("reset");
$('#btnsavefleet').removeClass("invisible");
$('#btndriversave').removeClass("invisible");
$('#btnusersave').removeClass("invisible");
$('#btndeptsave').removeClass("invisible");
$(".vfleet_msg").css("display", "none");
$(".vdriver_msg").css("display", "none");
$(".vuser_msg").css("display", "none");
$(".vdept_msg").css("display", "none");
$("#floatdiv").removeClass("invisible");
$("#fedit").removeClass("invisible");
});
// LATEST CYCLE
$('#dashlatest').cycle({
fx: 'scrollRight',
next: '#right',
delay: -4000,
easing: 'easeInOutBack'
});
/* MAIN NAVIGATION */
$("#nav1").on("click", function(){ parent.location='http://portal.megaworldcorp.com/papyrus.php'; return false; });
$("#nav2").on("click", function(){ parent.location='http://portal.megaworldcorp.com/ihelp/'; return false; });
$("#nav3").on("click", function(){ parent.location='http://portal.megaworldcorp.com/hr/'; return false; });
$("#nav4").on("click", function(){ parent.location='http://portal.megaworldcorp.com/availability/'; return false; });
$("#nav5").on("click", function(){ parent.location='http://portal.megaworldcorp.com/#'; return false; });
$("#nav1").hover(function() {
$("#ftab1").hide();
$("#ntab1").show();
$("#tabtext1").addClass("lgraytext");
},function() {
$("#ntab1").hide();
$("#ftab1").show();
$("#tabtext1").removeClass("lgraytext");
});
$("#nav2").hover(function() {
$("#ftab2").hide();
$("#ntab2").show();
$("#tabtext2").addClass("lgraytext");
},function() {
$("#ntab2").hide();
$("#ftab2").show();
$("#tabtext2").removeClass("lgraytext");
});
$("#nav3").hover(function() {
$("#ftab3").hide();
$("#ntab3").show();
$("#tabtext3").addClass("lgraytext");
},function() {
$("#ntab3").hide();
$("#ftab3").show();
$("#tabtext3").removeClass("lgraytext");
});
$("#nav4").hover(function() {
$("#ftab4").hide();
$("#ntab4").show();
$("#tabtext4").addClass("lgraytext");
},function() {
$("#ntab4").hide();
$("#ftab4").show();
$("#tabtext4").removeClass("lgraytext");
});
$("#nav5").hover(function() {
$("#ftab5").hide();
$("#ntab5").show();
$("#tabtext5").addClass("lgraytext");
},function() {
$("#ntab5").hide();
$("#ftab5").show();
$("#tabtext5").removeClass("lgraytext");
});
/* FLOAT DIV CONTROL */
/* Birthday */
$(".btnbday").on("click", function() {
$(".mfloatdiv").removeClass("invisible");
$("#bdayview").removeClass("invisible");
empid = $(this).attr('attribute');
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/reg_request.php?sec=bday",
data: "empid=" + empid,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
var obj = $.parseJSON(data);
$("#bday_subject").html(obj.bday_subject);
$("#bday_full").html(obj.bday_empname);
$("#bday_email").val(obj.bday_email);
$("#bday_tonickname").val(obj.bday_empnick);
}
})
return false;
});
/* Comment */
$(".commentdiv").on("mouseover", function() {
thisid = $(this).attr('attribute');
$("#comtrash" + thisid).removeClass("invisible");
});
$(".commentdiv").on("mouseout", function() {
$("#comtrash" + thisid).addClass("invisible");
});
$(".btndelcomment").on("click", function() {
var r = confirm("Are you sure you want to remove this comment?");
commentid = $(this).attr('attribute');
if (r == true)
{
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/shout_request.php?sec=delete",
data: "shoutid=" + commentid,
type: "POST"
})
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/shout_request.php?sec=comment",
data: "shoutid=" + shoutid,
type: "POST",
success: function(data) {
$("#commentlist").html(data);
}
});
return false;
}
});
/* Reservations */
$(".reserve_type").change(function() {
var rtype = $(this).val();
var resdate = $("#reserve_resdate").val();
//$('.datetimepick').datetimepicker('destroy');
//$('.datetimepick2').datetimepicker('destroy');
$("#dtBox").DateTimePicker('destroy');
var newunix = datetounix(resdate, 10800);
var newt = new Date(newunix);
pickdate = unixtodate(newt);
regdate = unixtodatemidnight(newt);
if (rtype == 2 || rtype == 4) {
if (rtype == 2) {
$("#dtBox").DateTimePicker({
defaultDate: new Date(),
dateTimeFormat: 'yyyy-MM-dd hh:mm aa',
buttonsToDisplay: ["SetButton"],
minDateTime: '2025-04-29 21:02:18',
maxDateTime: '2025-04-30 23:59:59',
titleContentDateTime: ''
});
/*$('.datetimepick').datetimepicker({
dateFormat: 'yy-mm-dd',
timeFormat: "hh:mmtt",
minDate: '2025-04-29',
maxDate: '2025-04-30'
});
$('.datetimepick2').datetimepicker({
dateFormat: 'yy-mm-dd',
timeFormat: "hh:mmtt",
minDate: '2025-04-29',
maxDate: '2025-05-01'
});*/
$("#datefromtxt").html("Departure Date and Time");
$("#datetotxt").html("Pick-up Date and Time");
$("#reserve_pickdate").val(pickdate);
} else if (rtype == 4) {
$("#dtBox").DateTimePicker({
defaultDate: new Date(),
dateTimeFormat: 'yyyy-MM-dd hh:mm aa',
buttonsToDisplay: ["SetButton"],
minDateTime: '2025-04-29 21:02:18',
maxDateTime: '2025-05-29 23:59:59',
minuteInterval: 10,
titleContentDateTime: ''
});
/*$('.datetimepick').datetimepicker({
dateFormat: 'yy-mm-dd',
timeFormat: "hh:mmtt",
minDate: '2025-04-29',
maxDate: '2025-04-30'
});
$('.datetimepick2').datetimepicker({
dateFormat: 'yy-mm-dd',
timeFormat: "hh:mmtt",
minDate: '2025-04-29',
maxDate: '2025-05-29'
});*/
$("#datefromtxt").html("From");
$("#datetotxt").html("To");
$("#reserve_pickdate").val(regdate);
}
$("#pickupdate").removeClass('invisible');
$(".destinetxt").html("Destination");
}
else {
if (rtype == 1 || rtype == 5) {
$("#dtBox").DateTimePicker({
defaultDate: new Date(),
dateTimeFormat: 'yyyy-MM-dd hh:mm aa',
buttonsToDisplay: ["SetButton"],
minDateTime: '2025-04-29 21:02:18',
maxDateTime: '2025-04-30 23:59:59',
minuteInterval: 10,
titleContentDateTime: ''
});
/*$('.datetimepick').datetimepicker({
dateFormat: 'yy-mm-dd',
timeFormat: "hh:mmtt",
minDate: '2025-04-29',
maxDate: '2025-04-30'
});
$('.datetimepick2').datetimepicker({
dateFormat: 'yy-mm-dd',
timeFormat: "hh:mmtt",
minDate: '2025-04-29',
maxDate: '2025-05-01'
});*/
$("#datefromtxt").html("Departure Date and Time");
$("#reserve_pickdate").val(pickdate);
if (rtype == 5) {
$(".destinetxt").html("Origin");
} else {
$(".destinetxt").html("Destination");
}
} else if (rtype == 3) {
$("#dtBox").DateTimePicker({
defaultDate: new Date(),
dateTimeFormat: 'yyyy-MM-dd hh:mm aa',
buttonsToDisplay: ["SetButton"],
minDateTime: '2025-04-29 21:02:18',
maxDateTime: '2025-04-30 23:59:59',
minuteInterval: 10,
titleContentDateTime: ''
});
/*$('.datetimepick').datetimepicker({
dateFormat: 'yy-mm-dd',
timeFormat: "hh:mmtt",
minDate: '2025-04-29',
maxDate: '2025-04-30'
});
$('.datetimepick2').datetimepicker({
dateFormat: 'yy-mm-dd',
timeFormat: "hh:mmtt",
minDate: '2025-04-29',
maxDate: '2025-04-30'
});*/
$("#datefromtxt").html("Date");
$("#reserve_pickdate").val(regdate);
$(".destinetxt").html("Destination");
}
$("#pickupdate").addClass('invisible');
}
});
$("#reserve_resdate").change(function() {
var rtype = $(".reserve_type").val();
var resdate = $(this).val();
var newunix = datetounix(resdate, 10800);
var newt = new Date(newunix);
pickdate = unixtodate(newt);
regdate = unixtodatemidnight(newt);
//alert(pickdate);
if (rtype == 2 || rtype == 4) {
if (rtype == 2) {
$("#dtBox").DateTimePicker({
defaultDate: new Date(),
dateTimeFormat: 'yyyy-MM-dd hh:mm aa',
buttonsToDisplay: ["SetButton"],
minDateTime: '2025-04-29 20:02:18',
maxDateTime: '2025-04-30 23:59:59',
minuteInterval: 10,
titleContentDateTime: ''
});
/*$('.datetimepick').datetimepicker({
dateFormat: 'yy-mm-dd',
timeFormat: "hh:mmtt",
minDate: '2025-04-29',
maxDate: '2025-04-30'
});
$('.datetimepick2').datetimepicker({
dateFormat: 'yy-mm-dd',
timeFormat: "hh:mmtt",
minDate: '2025-04-29',
maxDate: '2025-05-01'
});*/
$("#datefromtxt").html("Departure Date and Time");
$("#datetotxt").html("Pick-up Date and Time");
$("#reserve_pickdate").val(pickdate);
} else if (rtype == 4) {
$("#dtBox").DateTimePicker({
defaultDate: new Date(),
dateTimeFormat: 'yyyy-MM-dd hh:mm aa',
buttonsToDisplay: ["SetButton"],
minDateTime: '2025-04-30 00:00:00',
maxDateTime: '2025-05-29 23:59:59',
minuteInterval: 10,
titleContentDateTime: ''
});
/*$('.datetimepick').datetimepicker({
dateFormat: 'yy-mm-dd',
timeFormat: "hh:mmtt",
minDate: '2025-04-29',
maxDate: '2025-04-30'
});
$('.datetimepick2').datetimepicker({
dateFormat: 'yy-mm-dd',
timeFormat: "hh:mmtt",
minDate: '2025-04-29',
maxDate: '2025-05-29'
});*/
$("#datefromtxt").html("From");
$("#datetotxt").html("To");
$("#reserve_pickdate").val(regdate);
}
$("#pickupdate").removeClass('invisible');
$(".destinetxt").html("Destination");
}
else {
if (rtype == 1 || rtype == 5) {
$("#dtBox").DateTimePicker({
defaultDate: new Date(),
dateTimeFormat: 'yyyy-MM-dd hh:mm aa',
buttonsToDisplay: ["SetButton"],
minDateTime: '2025-04-29 20:02:18',
maxDateTime: '2025-04-30 23:59:59',
minuteInterval: 10,
titleContentDateTime: ''
});
/*$('.datetimepick').datetimepicker({
dateFormat: 'yy-mm-dd',
timeFormat: "hh:mmtt",
minDate: '2025-04-29',
maxDate: '2025-04-30'
});
$('.datetimepick2').datetimepicker({
dateFormat: 'yy-mm-dd',
timeFormat: "hh:mmtt",
minDate: '2025-04-29',
maxDate: '2025-05-01'
});*/
$("#datefromtxt").html("Departure Date and Time");
$("#reserve_pickdate").val(pickdate);
if (rtype == 5) {
$(".destinetxt").html("Origin");
} else {
$(".destinetxt").html("Destination");
}
} else if (rtype == 3) {
$("#dtBox").DateTimePicker({
defaultDate: new Date(),
dateTimeFormat: 'yyyy-MM-dd hh:mm aa',
buttonsToDisplay: ["SetButton"],
minDateTime: '2025-04-30 00:00:00',
maxDateTime: '2025-04-30 23:59:59',
minuteInterval: 10,
titleContentDateTime: ''
});
/*$('.datetimepick').datetimepicker({
dateFormat: 'yy-mm-dd',
timeFormat: "hh:mmtt",
minDate: '2025-04-29',
maxDate: '2025-04-30'
});
$('.datetimepick2').datetimepicker({
dateFormat: 'yy-mm-dd',
timeFormat: "hh:mmtt",
minDate: '2025-04-29',
maxDate: '2025-04-30'
});*/
$("#datefromtxt").html("Date");
$("#reserve_pickdate").val(regdate);
$(".destinetxt").html("Destination");
}
$("#pickupdate").addClass('invisible');
}
});
$(".reserve_numper").change(function() {
numper = $(this).val();
emptyper = 0;
for (i = 0; i < numper; i++) {
$("#reserve_person_" + i).removeClass('invisible');
$("#reserve_person_" + i).removeAttr('disabled');
}
for (i = numper; i < 10; i++) {
$("#reserve_person_" + i).addClass('invisible');
$("#reserve_person_" + i).attr('disabled', true);
}
for (i = 1; i < numper; i++) {
if ($('#reserve_person_' + i).val().length == 0) {
emptyper++;
}
}
if($("#chkreqpass:checked").length) {
$("#reserve_person_0").val($('.reqfname').html());
$("#reserve_person_0").attr('readonly', true);
if ($('#reserve_destination').val().length && $('#reserve_purpose').val().length && $('#reserve_contact').val().length && emptyper == 0) {
$('#btnreserve').removeClass('invisible');
}
else {
$('#btnreserve').addClass('invisible');
}
}
else {
$("#reserve_person_0").val('');
$("#reserve_person_0").removeAttr('readonly');
$('#btnreserve').addClass('invisible');
}
});
$("#chkreqpass").change(function() {
numper = $('#reserve_numper').val();
emptyper = 0;
for (i = 1; i < numper; i++) {
if ($('#reserve_person_' + i).val().length == 0) {
emptyper++;
}
}
if($("#chkreqpass:checked").length) {
$("#reserve_person_0").val($('.reqfname').html());
$("#reserve_person_0").attr('readonly', true);
if ($('#reserve_destination').val().length && $('#reserve_purpose').val().length && $('#reserve_contact').val().length && emptyper == 0) {
$('#btnreserve').removeClass('invisible');
}
}
else {
$("#reserve_person_0").val('');
$("#reserve_person_0").removeAttr('readonly');
$('#btnreserve').addClass('invisible');
}
});
$("#reserve_purpose").on("keyup", function() {
numper = $('#reserve_numper').val();
emptyper = 0;
for (i = 0; i < numper; i++) {
if ($('#reserve_person_' + i).val().length == 0) {
emptyper++;
}
}
if ($('#reserve_destination').val().length && $('#reserve_purpose').val().length && $('#reserve_contact').val().length && emptyper == 0) {
$('#btnreserve').removeClass('invisible');
}
else {
$('#btnreserve').addClass('invisible');
}
});
$("#reserve_destination").on("keyup", function() {
numper = $('#reserve_numper').val();
emptyper = 0;
for (i = 0; i < numper; i++) {
if ($('#reserve_person_' + i).val().length == 0) {
emptyper++;
}
}
if ($('#reserve_destination').val().length && $('#reserve_purpose').val().length && $('#reserve_contact').val().length && emptyper == 0) {
$('#btnreserve').removeClass('invisible');
}
else {
$('#btnreserve').addClass('invisible');
}
});
$('#nameper input').keyup(function(){
var sum = 0;
$(this).parent().children().each(function(){
numper = $('#reserve_numper').val();
emptyper = 0;
for (i = 0; i < numper; i++) {
if ($('#reserve_person_' + i).val().length == 0) {
emptyper++;
}
}
if ($('#reserve_destination').val().length && $('#reserve_purpose').val().length && $('#reserve_contact').val().length && emptyper == 0) {
$('#btnreserve').removeClass('invisible');
}
else {
$('#btnreserve').addClass('invisible');
}
});
});
$("#reserve_contact").on("keyup", function() {
numper = $('#reserve_numper').val();
emptyper = 0;
for (i = 0; i < numper; i++) {
if ($('#reserve_person_' + i).val().length == 0) {
emptyper++;
}
}
if ($('#reserve_destination').val().length && $('#reserve_purpose').val().length && $('#reserve_contact').val().length && emptyper == 0) {
$('#btnreserve').removeClass('invisible');
}
else {
$('#btnreserve').addClass('invisible');
}
});
$(".btnviewres").on("click", function() {
$("#floatdiv").removeClass("invisible");
$("#fview").removeClass("invisible");
$("#fview3").addClass("invisible");
$("#fapp").addClass("invisible");
$("#fedit").addClass("invisible");
$("#freserve").addClass("invisible");
resid = $(this).attr('attribute');
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dashboard_request.php?sec=edit",
data: "resid=" + resid,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
var obj = $.parseJSON(data);
$("#fview_title").html(obj.fleet_platenum);
$(".dataresdate").html(obj.reserve_resdate);
if (obj.reserve_status == 9) {
$(".datadrivername").html(obj.driver_name);
$(".datadrivertelno").html('Contact No.: ' + obj.driver_telno + '
');
$(".trdriver").removeClass('invisible');
} else {
$(".trdriver").addClass('invisible');
}
if (obj.reserve_status != 1 && obj.reserve_status != 0 && obj.reserve_approver) {
$(".dataapprover").html(obj.app_fullname + '
on ' + obj.reserve_appdate + '
Remarks: ' + obj.reserve_appremark);
$(".trapprover").removeClass('invisible');
} else {
$(".trapprover").addClass('invisible');
}
if (obj.reserve_admremark) {
$(".dataadmin").html(obj.reserve_admremark);
$(".tradmin").removeClass('invisible');
} else {
$(".tradmin").addClass('invisible');
}
if (obj.reserve_type == 2) {
$(".datapickdate").html(obj.reserve_pickdate);
$(".trpickdate").removeClass('invisible');
$(".destinetxt").html('Destination');
} else if (obj.reserve_type == 5) {
$(".trpickdate").addClass('invisible');
$(".destinetxt").html('Origin');
} else {
$(".trpickdate").addClass('invisible');
$(".destinetxt").html('Destination');
}
if (obj.reserve_carpool == 1) {
$(".trcarpool").removeClass('invisible');
} else {
$(".trcarpool").addClass('invisible');
}
if (obj.reserve_status == "10") {
$(".trfeedback").removeClass('invisible');
$(".trfeedback1").addClass('invisible');
$(".trfeedback2").addClass('invisible');
$(".datafeedback").html('' + obj.reserve_rating + ' rating
' + obj.reserve_feedback);
} else if (obj.reserve_status == "9") {
if (obj.afterride == "1" ) {
$(".trfeedback").addClass('invisible');
$(".trfeedback1").removeClass('invisible');
$(".trfeedback2").removeClass('invisible');
} else {
$(".trfeedback").addClass('invisible');
$(".trfeedback1").addClass('invisible');
$(".trfeedback2").addClass('invisible');
}
} else {
$(".trfeedback").addClass('invisible');
$(".trfeedback1").addClass('invisible');
$(".trfeedback2").addClass('invisible');
}
$("#creserve_id").val(obj.reserve_id);
$(".datadestination").html(obj.reserve_destination);
$(".datapurpose").html(obj.reserve_purpose);
$(".datapassenger").html(obj.reserve_person);
$(".datareservedby").html(obj.user_fullname);
$(".datadate").html(obj.reserve_date);
}
})
return false;
});
$("#reserve_rscdate").change(function() {
var btndisable = 0;
$(".chkfaseat").addClass("invisible");
$("#chkfadate").removeClass("invisible");
$("#thisisresched").val(1);
var rtype = $("#areserve_type").val();
var resdate = $(this).val();
var newunix = datetounix(resdate, 10800);
var newt = new Date(newunix);
pickdate = unixtodate(newt);
regdate = unixtodatemidnight(newt);
if (rtype == 2 || rtype == 1 || rtype == 5) {
$("#reserve_rscpdate").val(pickdate);
}
else {
$("#reserve_rscpdate").val(regdate);
}
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dashboard_request.php?sec=getavailfleet",
data: "resdate=" + resdate,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
if (data != 0) {
$("#setfleet option").removeAttr("disabled");
$("#setfleet").html(data);
$("#nofleet").addClass("invisible");
$("#setfleet").removeClass("invisible");
} else {
btndisable++;
$("#nofleet").removeClass("invisible");
$("#setfleet").addClass("invisible");
}
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dashboard_request.php?sec=getavaildriver",
data: "resdate=" + resdate,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
if (data != 0) {
$("#setdriver option").removeAttr("disabled");
$("#setdriver").html(data);
$("#nodriver").addClass("invisible");
$("#setdriver").removeClass("invisible");
} else {
btndisable++;
$("#nodriver").removeClass("invisible");
$("#setdriver").addClass("invisible");
}
if (btndisable != 0) {
$("#btnresched").addClass('invisible');
} else {
$("#btnresched").removeClass('invisible');
}
}
})
}
})
return false;
});
$(".btneditres").on("click", function() {
var btndisable = 0;
$("#floatdiv").removeClass("invisible");
$("#fedit").removeClass("invisible");
$("#fapp").addClass("invisible");
$("#fview").addClass("invisible");
$("#fview3").addClass("invisible");
$("#freserve").addClass("invisible");
$(".trfeedback5").addClass('invisible');
$(".redit_msg").css("display", "none");
resid = $(this).attr('attribute');
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dashboard_request.php?sec=edit",
data: "resid=" + resid,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
var obj = $.parseJSON(data);
var datafleet, datadrive;
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dashboard_request.php?sec=getavailfleet",
data: "resdate=0",
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#esetfleet option").removeAttr("disabled");
$("#esetfleet").html(data);
$("#enofleet").addClass("invisible");
$("#esetfleet").removeClass("invisible");
$("#esetfleet").val(obj.reserve_fleetid);
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dashboard_request.php?sec=getavaildriver",
data: "resdate=0",
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#esetdriver option").removeAttr("disabled");
$("#esetdriver").html(data);
$("#enodriver").addClass("invisible");
$("#esetdriver").removeClass("invisible");
$("#esetdriver").val(obj.reserve_driver);
resstatus = $("#areserve_status").val();
}
})
}
})
$(".dataresdate").html(obj.reserve_resdate);
$(".datapickdate").html(obj.reserve_pickdate);
$("#resdate").val(obj.reserve_resdate2);
$("#pickdate").val(obj.reserve_pickdate2);
if (obj.reserve_type == 5) {
$(".destinetxt").html('Origin');
} else {
$(".destinetxt").html('Destination');
}
if (obj.reserve_carpool == 1) {
$(".trcarpool").removeClass('invisible');
} else {
$(".trcarpool").addClass('invisible');
}
if (obj.reserve_status == 10) {
$(".trfeedback5").removeClass('invisible');
$(".datafeedback5").html('' + obj.reserve_rating + ' rating
' + obj.reserve_feedback);
} else {
$(".trfeedback5").addClass('invisible');
}
$(".datadestination").html(obj.reserve_destination);
$(".datapurpose").html(obj.reserve_purpose);
$(".datapassenger").html(obj.reserve_person);
$(".datareservedby").html(obj.user_fullname);
$(".datadate").html(obj.reserve_date);
$(".dataappremark").html('"' + obj.reserve_appremark + '"');
$("#ta_admremark").html(obj.reserve_admremark);
$("#ereserve_id").val(obj.reserve_id);
$("#ereserve_status").val(obj.reserve_status);
}
})
return false;
});
$(".btnappres").on("click", function() {
var btndisable = 0;
$("#floatdiv").removeClass("invisible");
$("#fapp").removeClass("invisible");
$("#fview").addClass("invisible");
$("#fview3").addClass("invisible");
$("#fedit").addClass("invisible");
$("#freserve").addClass("invisible");
$(".rapp_msg").css("display", "none");
resid = $(this).attr('attribute');
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dashboard_request.php?sec=edit",
data: "resid=" + resid,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
var obj = $.parseJSON(data);
var datafleet, datadrive;
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dashboard_request.php?sec=getavailfleet",
data: "resdate=" + obj.reserve_resdate,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
if (data != 0) {
$("#setfleet option").removeAttr("disabled");
$("#setfleet").html(data);
$("#nofleet").addClass("invisible");
$("#setfleet").removeClass("invisible");
} else {
btndisable++;
$("#nofleet").removeClass("invisible");
$("#setfleet").addClass("invisible");
}
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dashboard_request.php?sec=getavaildriver",
data: "resdate=" + obj.reserve_resdate,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
if (data != 0) {
$("#setdriver option").removeAttr("disabled");
$("#setdriver").html(data);
$("#nodriver").addClass("invisible");
$("#setdriver").removeClass("invisible");
} else {
btndisable++;
$("#nodriver").removeClass("invisible");
$("#setdriver").addClass("invisible");
}
resstatus = $("#areserve_status").val();
if (resstatus == 2) {
if (btndisable != 0) {
$(".divrescheddate").removeClass('invisible');
$("#btnapprove").addClass('invisible');
$("#thisisresched").val(1);
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dashboard_request.php?sec=carpooldata",
data: "resdate=" + obj.reserve_resdate + "&resnumper=" + obj.reserve_numper + "&restype=" + obj.reserve_type,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$(".carpoollist").html(data);
}
});
} else {
$(".divrescheddate").addClass('invisible');
$("#btnapprove").removeClass('invisible');
$("#thisisresched").val(0);
}
} else {
$(".divrescheddate").addClass('invisible');
}
}
})
}
})
$(".dataresdate").html(obj.reserve_resdate);
if (obj.reserve_type == 2 || obj.reserve_type == 3) {
if (obj.reserve_type == 2) {
$("#datefromtxt").html("Departure Date and Time");
$("#datetotxt").html("Pick-up Date and Time");
} else if (obj.reserve_type == 3) {
$("#datefromtxt").html("From");
$("#datetotxt").html("To");
}
$(".destinetxt").html('Destination');
$(".datapickdate").html(obj.reserve_pickdate);
$(".trpickdate").removeClass('invisible');
} else {
if (obj.reserve_type == 5) {
$(".destinetxt").html('Origin');
} else {
$(".destinetxt").html('Destination');
}
$(".trpickdate").addClass('invisible');
$("#datefromtxt").html("Departure Date and Time");
}
if (obj.reserve_appremark) {
$(".trappremarks").removeClass('invisible');
} else {
$(".trappremarks").addClass('invisible');
}
$(".datadestination").html(obj.reserve_destination);
$(".datapurpose").html(obj.reserve_purpose);
$(".datapassenger").html(obj.reserve_person);
$(".datareservedby").html(obj.user_fullname);
$(".datadate").html(obj.reserve_date);
$(".dataappremark").html('"' + obj.reserve_appremark + '"');
$("#reserve_rscdate").val(obj.reserve_date2);
$("#reserve_rscpdate").val(obj.reserve_pickdate2);
$("#areserve_id").val(obj.reserve_id);
$("#areserve_type").val(obj.reserve_type);
$("#areserve_status").val(obj.reserve_status);
if (obj.reserve_status == 2) {
$("#btnwait").removeClass('invisible');
} else {
$("#btnwait").addClass('invisible');
}
$("#areserve_destination").val(obj.reserve_destination);
$("#areserve_passenger").val(obj.reserve_person);
$("#areserve_resdate").val(obj.reserve_resdate);
$("#areserve_purpose").val(obj.reserve_purpose);
$("#uid").val(obj.user_empnum);
}
})
return false;
});
$(".btnresapp").on("click", function() {
var r = confirm("Are you sure you want to approve this rescheduled reservation?");
resid = $(this).attr('attribute');
pagenum = $("#cpage").val();
if (r == true)
{
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dashboard_request.php?sec=resapp",
data: "resid=" + resid,
type: "POST",
success: function(data) {
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dashboard_request.php?sec=table&page=" + pagenum,
success: function(data) {
$("#dashboard_table").html(data);
}
});
}
})
return false;
}
});
$(".btndelres").on("click", function() {
var r = confirm("Are you sure you want to cancel this reservation?");
resid = $(this).attr('attribute');
uid = $(this).attr('attribute2');
pagenum = $("#cpage").val();
clevel = $("#clevel").val();
if (r == true)
{
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dashboard_request.php?sec=delete",
data: "resid=" + resid + "&uid=" + uid + "&level=" + clevel,
type: "POST",
success: function(data) {
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dashboard_request.php?sec=table&page=" + pagenum,
success: function(data) {
$("#dashboard_table").html(data);
}
});
}
})
return false;
}
});
$(".btnvuaact").on("click", function() {
var r = confirm("Are you sure you want activate VUA request?");
resid = $(this).attr('attribute');
uid = $(this).attr('attribute2');
pagenum = $("#cpage").val();
clevel = $("#clevel").val();
if (r == true)
{
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dashboard_request.php?sec=vuaact",
data: "resid=" + resid + "&uid=" + uid + "&level=" + clevel,
type: "POST",
success: function(data) {
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dashboard_request.php?sec=table&page=" + pagenum,
success: function(data) {
$("#dashboard_table").html(data);
}
});
}
})
return false;
}
});
$(".btnvuares").on("click", function() {
var r = confirm("This make a request for Vehicle User Acknowlegdement to Admin. Are you sure?");
resid = $(this).attr('attribute');
uid = $(this).attr('attribute2');
pagenum = $("#cpage").val();
clevel = $("#clevel").val();
if (r == true)
{
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dashboard_request.php?sec=vua",
data: "resid=" + resid + "&uid=" + uid + "&level=" + clevel,
type: "POST",
success: function(data) {
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dashboard_request.php?sec=table&page=" + pagenum,
success: function(data) {
$("#dashboard_table").html(data);
}
});
}
})
return false;
}
});
$(".btnvuaprint").on("click", function() {
resid = $(this).attr('attribute');
window.open('https://portal.megaworldcorp.com/ivr/vua/' + resid, '_blank');
return false;
});
$(".btnappvua").on("click", function() {
var r = confirm("Are you sure you want to approve the VUA request?");
resid = $(this).attr('attribute');
uid = $(this).attr('attribute2');
pagenum = $("#cpage").val();
clevel = $("#clevel").val();
if (r == true)
{
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dashboard_request.php?sec=appvua",
data: "resid=" + resid + "&uid=" + uid + "&level=" + clevel,
type: "POST",
success: function(data) {
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dashboard_request.php?sec=table&page=" + pagenum,
success: function(data) {
$("#dashboard_table").html(data);
}
});
}
})
return false;
}
});
$(".btnrejvua").on("click", function() {
var r = confirm("Are you sure you want to decline the VUA request?");
resid = $(this).attr('attribute');
uid = $(this).attr('attribute2');
pagenum = $("#cpage").val();
clevel = $("#clevel").val();
if (r == true)
{
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dashboard_request.php?sec=rejvua",
data: "resid=" + resid + "&uid=" + uid + "&level=" + clevel,
type: "POST",
success: function(data) {
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dashboard_request.php?sec=table&page=" + pagenum,
success: function(data) {
$("#dashboard_table").html(data);
}
});
}
})
return false;
}
});
$(".btnrejres").on("click", function() {
var r = confirm("Are you sure you want to decline this reservation?");
resid = $(this).attr('attribute');
uid = $(this).attr('attribute2');
pagenum = $("#cpage").val();
clevel = 8;
if (r == true)
{
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dashboard_request.php?sec=delete",
data: "resid=" + resid + "&uid=" + uid + "&level=" + clevel,
type: "POST",
success: function(data) {
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dashboard_request.php?sec=table&page=" + pagenum,
success: function(data) {
$("#dashboard_table").html(data);
}
});
}
})
return false;
}
});
$("#btnswdash").on("click", function() {
$("#dashtrans").removeClass("invisible");
$("#dashwhere").addClass("invisible");
});
$("#btnswwhere").on("click", function() {
$("#dashtrans").addClass("invisible");
$("#dashwhere").removeClass("invisible");
});
$("#wheredate").change(function(e) {
wdate = $("#wheredate").val();
$("#dashboard_table").html(' Loading...');
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dashboard_request.php?sec=table",
data: "wdate=" + wdate,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#dashboard_table").html(data);
$("#dashtrans").addClass("invisible");
$("#dashwhere").removeClass("invisible");
}
})
});
$("#sltstatus").change(function() {
statusres = $("#sltstatus").val();
searchres = $("#searchres").val();
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dashboard_request.php?sec=table",
data: "statusres=" + statusres + "&searchres=" + searchres,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#btnresall").removeClass("invisible");
$("#dashboard_table").html(data);
}
})
});
$("#searchres").on("keypress", function(e) {
if (e.keyCode == 13) {
statusres = $("#sltstatus").val();
searchres = $("#searchres").val();
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dashboard_request.php?sec=table",
data: "statusres=" + statusres + "&searchres=" + searchres,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#btnresall").removeClass("invisible");
$("#dashboard_table").html(data);
}
})
}
});
$("#btnsearchres").on("click", function() {
statusres = $("#sltstatus").val();
searchres = $("#searchres").val();
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dashboard_request.php?sec=table",
data: "statusres=" + statusres + "&searchres=" + searchres,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#btnresall").removeClass("invisible");
$("#dashboard_table").html(data);
}
})
});
$("#btnresall").on("click", function() {
respage = 1;
$(this).addClass("invisible");
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dashboard_request.php?sec=table",
data: "clear_search=1",
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#searchres").val("");
$("#btnresall").addClass("invisible");
$("#dashboard_table").html(data);
}
})
});
/* Trans Viewer */
$("#searchtrans").on("keypress", function(e) {
if (e.keyCode == 13) {
searchtrans = $("#searchtrans").val();
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/trans_request.php?sec=table",
data: "searchtrans=" + searchtrans,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#btntransall").removeClass("invisible");
$("#trans_table").html(data);
}
})
}
});
$("#btnsearchres").on("click", function() {
searchtrans = $("#searchtrans").val();
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/trans_request.php?sec=table",
data: "searchtrans=" + searchtrans,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#btntransall").removeClass("invisible");
$("#trans_table").html(data);
}
})
});
$("#btntransall").on("click", function() {
respage = 1;
$(this).addClass("invisible");
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/trans_request.php?sec=table",
data: "clear_search=1",
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#searchtrans").val("");
$("#btntransall").addClass("invisible");
$("#trans_table").html(data);
}
})
});
/* FLeet Management */
$(".btneditfleet").on("click", function() {
$("#etitle").html("Edit");
$(".btnsave").removeClass("invisible");
$("#floatdiv").removeClass("invisible");
$("#fedit").removeClass("invisible");
$(".vfleet_msg").css("display", "none");
fid = $(this).attr('attribute');
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/fleet_request.php?sec=edit",
data: "fid=" + fid,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
var obj = $.parseJSON(data);
var platenum = obj.fleet_platenum.split('-');
$("#fleet_type").val(obj.fleet_type);
$("#fleet_platenum1").val(platenum[0]);
$("#fleet_platenum2").val(platenum[1]);
$("#fleet_brand").val(obj.fleet_brand);
$("#fleet_model").val(obj.fleet_model);
$("#fleet_engine").val(obj.fleet_engine);
$("#fleet_chassis").val(obj.fleet_chassis);
$("#fleet_regnum").val(obj.fleet_regnum);
$("#fleet_regexpire").val(obj.fleet_regexpire);
$("#fleet_year").val(obj.fleet_year);
$("#fleet_capacity").val(obj.fleet_capacity);
$("#fleet_id").val(obj.fleet_id);
}
})
return false;
});
$(".btndelfleet").on("click", function() {
var r = confirm("Are you sure you want to delete this vehicle?");
fid = $(this).attr('attribute');
pagenum = $("#fpage").val();
if (r == true)
{
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/fleet_request.php?sec=delete",
data: "fid=" + fid,
type: "POST",
success: function(data) {
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/fleet_request.php?sec=table&page=" + pagenum,
success: function(data) {
$("#fleet_table").html(data);
}
});
}
})
return false;
}
});
$("#searchflt").on("keypress", function(e) {
if (e.keyCode == 13) {
searchflt = $("#searchflt").val();
if (searchflt.trim() != "") {
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/fleet_request.php?sec=table",
data: "searchflt=" + searchflt,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#btnfltall").removeClass("invisible");
$("#fleet_table").html(data);
}
})
}
}
});
$("#btnsearchflt").on("click", function() {
searchflt = $("#searchflt").val();
if (searchflt.trim() != "") {
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/fleet_request.php?sec=table",
data: "searchflt=" + searchflt,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#btnfltall").removeClass("invisible");
$("#fleet_table").html(data);
}
})
}
});
$("#btnfltall").on("click", function() {
fltpage = 1;
$(this).addClass("invisible");
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/fleet_request.php?sec=table",
data: "clear_search=1",
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#searchflt").val("");
$("#btnfltall").addClass("invisible");
$("#btnfexpire").removeClass("invisible");
$("#fleet_table").html(data);
}
})
});
$("#btnfexpire").on("click", function() {
fltpage = 1;
$(this).addClass("invisible");
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/fleet_request.php?sec=table",
data: "fexpired=1",
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#btnfltall").removeClass("invisible");
$("#btnfexpire").addClass("invisible");
$("#fleet_table").html(data);
}
})
});
/* Driver Management */
$(".btneditdriver").on("click", function() {
$("#etitle").html("Edit");
$("#floatdiv").removeClass("invisible");
$("#fedit").removeClass("invisible");
$(".vdriver_msg").css("display", "none");
$(".btnsave").removeClass('invisible');
did = $(this).attr('attribute');
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/driver_request.php?sec=edit",
data: "did=" + did,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
var obj = $.parseJSON(data);
$("#driver_type").val(obj.driver_type);
$("#driver_name").val(obj.driver_name);
$("#driver_bday").val(obj.driver_bday);
$("#driver_telno").val(obj.driver_telno);
$("#driver_license").val(obj.driver_license);
$("#driver_licexpire").val(obj.driver_licexpire);
$("#driver_id").val(obj.driver_id);
}
})
return false;
});
$(".btndeldriver").on("click", function() {
var r = confirm("Are you sure you want to delete this driver?");
did = $(this).attr('attribute');
pagenum = $("#dpage").val();
if (r == true)
{
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/driver_request.php?sec=delete",
data: "did=" + did,
type: "POST",
success: function(data) {
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/driver_request.php?sec=table&page=" + pagenum,
success: function(data) {
$("#driver_table").html(data);
}
});
}
})
return false;
}
});
$("#searchdrv").on("keypress", function(e) {
if (e.keyCode == 13) {
searchdrv = $("#searchdrv").val();
if (searchdrv.trim() != "") {
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/driver_request.php?sec=table",
data: "searchdrv=" + searchdrv,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#btndrvall").removeClass("invisible");
$("#driver_table").html(data);
}
})
}
}
});
$("#btnsearchdrv").on("click", function() {
searchdrv = $("#searchdrv").val();
if (searchdrv.trim() != "") {
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/driver_request.php?sec=table",
data: "searchdrv=" + searchdrv,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#btndrvall").removeClass("invisible");
$("#driver_table").html(data);
}
})
}
});
$("#btndrvall").on("click", function() {
drvpage = 1;
$(this).addClass("invisible");
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/driver_request.php?sec=table",
data: "clear_search=1",
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#searchdrv").val("");
$("#btndrvall").addClass("invisible");
$("#btndexpire").removeClass("invisible");
$("#driver_table").html(data);
}
})
});
$("#btndexpire").on("click", function() {
drvpage = 1;
$(this).addClass("invisible");
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/driver_request.php?sec=table",
data: "dexpired=1",
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#btndrvall").removeClass("invisible");
$("#btndexpire").addClass("invisible");
$("#driver_table").html(data);
}
})
});
/* User Management */
$(".approveUser").live("click", function() {
userid = $(this).attr('attribute');
userstatus = $(this).attr('attribute2');
$(".ustatusDiv" + userid).html('');
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/user_request.php?sec=approveuser",
data: "userid=" + userid + "&user_status=" + userstatus,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$(".ustatusDiv" + userid).html(data);
}
})
return false;
});
$("#user_level").change("click", function() {
userlevel = $(this).val();
if (userlevel == 1) {
$("#tdapp").removeClass("invisible");
} else {
$("#tdapp").addClass("invisible");
$("#user_approver").val(0);
}
return false;
});
$("#user_dept").change("click", function() {
userdept = $(this).val();
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/user_request.php?sec=dropdown_approver",
data: "dept=" + userdept,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#user_approver").html(data);
}
})
return false;
});
$(".btnsendpassword").on("click", function() {
userid = $(this).attr('attribute');
useremail = $(this).attr('attribute2');
var r = confirm("Are you sure you want to send his/her password to " + useremail);
if (r == true)
{
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/user_request.php?sec=send_password",
data: "userid=" + userid,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
alert("His/her password has been successfully to " + useremail);
}
})
return false;
}
});
$(".btnsendpasswordtoall").on("click", function() {
var r = confirm("Are you sure you want to send password to all");
if (r == true)
{
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/user_request.php?sec=allsend_password",
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
alert("Password has been successfully to all");
}
})
return false;
}
});
$(".btnedituser").on("click", function() {
$("#etitle").html("Edit");
$("#floatdiv").removeClass("invisible");
$("#fedit").removeClass("invisible");
$(".vuser_msg").css("display", "none");
$(".btnsave").removeClass('invisible');
uid = $(this).attr('attribute');
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/user_request.php?sec=edit",
data: "uid=" + uid,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
var obj = $.parseJSON(data);
$("#user_empnum").val(obj.user_empnum);
$("#user_fullname").val(obj.user_fullname);
$("#user_level").val(obj.user_level);
$("#user_dept").val(obj.user_dept);
$("#user_telno").val(obj.user_telno);
$("#user_email").val(obj.user_email);
$("#user_id").val(obj.user_id);
if (obj.user_level == 1) {
$("#tdapp").removeClass('invisible');
} else {
$("#tdapp").addClass('invisible');
}
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/user_request.php?sec=dropdown_approver",
data: "dept=" + obj.user_dept,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#user_approver").html(data);
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/user_request.php?sec=edit",
data: "uid=" + obj.user_id,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
var obj = $.parseJSON(data);
$("#user_approver").val(obj.user_approver);
}
})
}
})
}
})
return false;
});
$(".btndeluser").on("click", function() {
var r = confirm("Are you sure you want to delete this user?");
uid = $(this).attr('attribute');
pagenum = $("#upage").val();
if (r == true)
{
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/user_request.php?sec=delete",
data: "uid=" + uid,
type: "POST",
success: function(data) {
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/user_request.php?sec=table&page=" + pagenum,
success: function(data) {
$("#user_table").html(data);
}
});
}
})
return false;
}
});
$("#searchusr").on("keypress", function(e) {
if (e.keyCode == 13) {
searchusr = $("#searchusr").val();
if (searchusr.trim() != "") {
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/user_request.php?sec=table",
data: "searchusr=" + searchusr,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#btnusrall").removeClass("invisible");
$("#user_table").html(data);
}
})
}
}
});
$("#btnsearchusr").on("click", function() {
searchusr = $("#searchusr").val();
if (searchusr.trim() != "") {
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/user_request.php?sec=table",
data: "searchusr=" + searchusr,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#btnusrall").removeClass("invisible");
$("#user_table").html(data);
}
})
}
});
$("#btnusrall").on("click", function() {
usrpage = 1;
$(this).addClass("invisible");
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/user_request.php?sec=table",
data: "clear_search=1",
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#searchusr").val("");
$("#btnusrall").addClass("invisible");
$("#user_table").html(data);
}
})
});
/* Department Management */
$(".btneditdept").on("click", function() {
$("#etitle").html("Edit");
$("#floatdiv").removeClass("invisible");
$("#fedit").removeClass("invisible");
$(".vdept_msg").css("display", "none");
$(".btnsave").removeClass('invisible');
did = $(this).attr('attribute');
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dept_request.php?sec=edit",
data: "did=" + did,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
var obj = $.parseJSON(data);
$("#dept_name").val(obj.dept_name);
$("#dept_abbr").val(obj.dept_abbr);
$("#dept_id").val(obj.dept_id);
}
})
return false;
});
$(".btndeldept").on("click", function() {
var r = confirm("Are you sure you want to delete this department?");
did = $(this).attr('attribute');
pagenum = $("#dpage").val();
if (r == true)
{
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dept_request.php?sec=delete",
data: "did=" + did,
type: "POST",
success: function(data) {
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dept_request.php?sec=table&page=" + pagenum,
success: function(data) {
$("#dept_table").html(data);
}
});
}
})
return false;
}
});
$("#searchdept").on("keypress", function(e) {
if (e.keyCode == 13) {
searchdept = $("#searchdept").val();
if (searchdept.trim() != "") {
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dept_request.php?sec=table",
data: "searchdept=" + searchdept,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#btndeptall").removeClass("invisible");
$("#dept_table").html(data);
}
})
}
}
});
$("#btnsearchdept").on("click", function() {
searchdept = $("#searchdept").val();
if (searchdept.trim() != "") {
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dept_request.php?sec=table",
data: "searchdept=" + searchdept,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#btndeptall").removeClass("invisible");
$("#dept_table").html(data);
}
})
}
});
$("#btndeptall").on("click", function() {
deptpage = 1;
$(this).addClass("invisible");
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/dept_request.php?sec=table",
data: "clear_search=1",
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#searchdept").val("");
$("#btndeptall").addClass("invisible");
$("#dept_table").html(data);
}
})
});
/* Holiday Management */
$(".btneditholi").on("click", function() {
$("#etitle").html("Edit");
$("#floatdiv").removeClass("invisible");
$("#fedit").removeClass("invisible");
$(".vholi_msg").css("display", "none");
$(".btnsave").removeClass('invisible');
hid = $(this).attr('attribute');
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/holi_request.php?sec=edit",
data: "hid=" + hid,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
var obj = $.parseJSON(data);
$("#holiday_name").val(obj.holi_name);
$("#holiday_month").val(obj.holi_month);
$("#holiday_day").val(obj.holi_day);
$("#holi_id").val(obj.holi_id);
}
})
return false;
});
$(".btndelholi").on("click", function() {
var r = confirm("Are you sure you want to delete this holiday?");
hid = $(this).attr('attribute');
pagenum = $("#hpage").val();
if (r == true)
{
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/holi_request.php?sec=delete",
data: "hid=" + hid,
type: "POST",
success: function(data) {
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/holi_request.php?sec=table&page=" + pagenum,
success: function(data) {
$("#holi_table").html(data);
}
});
}
})
return false;
}
});
$("#searchholi").on("keypress", function(e) {
if (e.keyCode == 13) {
searchholi = $("#searchholi").val();
if (searchholi.trim() != "") {
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/holi_request.php?sec=table",
data: "searchholi=" + searchholi,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#btnholiall").removeClass("invisible");
$("#holi_table").html(data);
}
})
}
}
});
$("#btnsearchholi").on("click", function() {
searchholi = $("#searchholi").val();
if (searchholi.trim() != "") {
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/holi_request.php?sec=table",
data: "searchholi=" + searchholi,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#btnholiall").removeClass("invisible");
$("#holi_table").html(data);
}
})
}
});
$("#btnholiall").on("click", function() {
holipage = 1;
$(this).addClass("invisible");
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/holi_request.php?sec=table",
data: "clear_search=1",
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#searchholi").val("");
$("#btnholiall").addClass("invisible");
$("#holi_table").html(data);
}
})
});
/* Registration */
$(".btnviewreg").on("click", function() {
$(".floatdiv").removeClass("invisible");
$("#fvreg").removeClass("invisible");
regid = $(this).attr('attribute');
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/act_request.php?sec=editreg",
data: "regid=" + regid,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
var obj = $.parseJSON(data);
$("#fvreg_title").html(obj.activity_title + ' Registration');
if (!obj.activity_venue || obj.activity_venue == "" || obj.activity_venue == null) { $("#registry_venue").html('The World Center'); } else { $("#registry_venue").html(obj.activity_venue); }
$("#registry_date").html(obj.activity_datein);
$("#registry_timein").html(obj.activity_timein);
$("#registry_timeout").html(obj.activity_timeout);
if (obj.registry_godirectly == 1) { $("#registry_godirectly").html(''); } else { $("#registry_godirectly").html(''); }
if (obj.activity_venue && obj.activity_venue != "" && obj.activity_venue != null) {
if (obj.registry_vrin == 1) { vrin = ''; } else { vrin = ''; }
if (obj.registry_vrout == 1) { vrout = ''; } else { vrout = ''; }
$("#registry_vr").html('Will ride the company vehicle:
From The World Center to ' + obj.activity_venue + ': ' + vrin + '
From ' + obj.activity_venue + ' to The World Center: ' + vrin);
}
$("#registry_platenum").html(obj.registry_platenum);
$("#registry_dependent").html(obj.registry_dependent);
$("#registry_guest").html(obj.registry_guest);
$("#registry_datereg").html(obj.registry_date);
if (obj.registry_status == 1) { $("#registry_status").html('For approval'); } else { $("#registry_status").html('Approved'); }
$("#btndelreg2").attr('attribute', obj.registry_id);
}
})
return false;
});
$(".btndelreg").on("click", function() {
var r = confirm("Are you sure you want to backout on this activity?");
regid = $(this).attr('attribute');
if (r == true)
{
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/act_request.php?sec=delreg",
data: "regid=" + regid,
type: "POST",
success: function(data) {
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/act_request.php?sec=regtable",
success: function(data) {
$("#registration_table").html(data);
}
})
}
})
return false;
}
});
$(".btndelreg2").on("click", function() {
var r = confirm("Are you sure you want to backout on this activity?");
regid = $(this).attr('attribute');
if (r == true)
{
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/act_request.php?sec=delreg",
data: "regid=" + regid,
type: "POST",
success: function(data) {
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/act_request.php?sec=regtable",
success: function(data) {
$(".floatdiv").addClass("invisible");
$("#fvreg").addClass("invisible");
$("#registration_table").html(data);
}
})
}
})
return false;
}
});
/* Users */
$(".delUser").live("click", function() {
empid = $(this).attr('attribute');
var r = confirm("Are you sure you want to delete this user?");
if (r == true)
{
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/reg_request.php?sec=delemp",
data: "empid=" + empid,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
window.location.href = window.location.href;
}
})
return false;
}
});
$(".closebutton, .closebutton3").on("click", function() {
$(".floatdiv").addClass("invisible");
$("#fview").addClass("invisible");
$("#fview3").addClass("invisible");
$("#fadd").addClass("invisible");
$("#fedit").addClass("invisible");
$("#bdayview").addClass("invisible");
});
$(".closebutton2").on("click", function() {
$(".floatdiv").addClass("invisible");
$("#fview").addClass("invisible");
$("#fview3").addClass("invisible");
$("#fadd").addClass("invisible");
$("#fedit").addClass("invisible");
$("#bdayview").addClass("invisible");
});
$(".mclosebutton").on("click", function() {
$(".mfloatdiv").addClass("invisible");
$("#mfview").addClass("invisible");
$("#fview3").addClass("invisible");
$("#fadd").addClass("invisible");
$("#fedit").addClass("invisible");
$("#bdayview").addClass("invisible");
});
/* CLEAR SEARCH */
$(".btnsearchallsht").on("click", function() {
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/shout_request.php?sec=clear_search",
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
window.location.href='https://portal.megaworldcorp.com/ivr/shoutbox';
}
})
});
/* REGISTRATION */
$(".iamhead").change(function() {
if ($("#iamhead").is(':checked')) {
userlevel = 1;
} else {
userlevel = 0;
}
userdept = $("#department option:selected").val();
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/reg_request.php?sec=approvesel",
data: "userlevel=" + userlevel + "&userdept=" + userdept,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#ihead").html(data);
}
})
});
$("#division").change(function() {
divid = $("#division option:selected").val();
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/reg_request.php?sec=deptsel",
data: "divid=" + divid,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#department").html(data);
}
})
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/reg_request.php?sec=dgrpsel",
data: "divid=" + divid,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#dgroup").html(data);
}
})
});
$("#department").change(function() {
if ($("#iamhead").is(':checked')) {
userlevel = 1;
} else {
userlevel = 0;
}
deptid = $("#department option:selected").val();
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/reg_request.php?sec=approvesel",
data: "userlevel=" + userlevel + "&userdept=" + deptid,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#ihead").html(data);
}
})
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/reg_request.php?sec=secsel",
data: "deptid=" + deptid,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$("#dsection").html(data);
}
});
});
/* DATE/TIME PICKER */
// report from
$(".repdatein").datepicker({
dateFormat: 'yy-mm-dd',
minDate: "2014-01-01",
maxDate: "0D",
changeMonth: true,
numberOfMonths: 2,
onSelect: function (dateText, inst) {
$('#btnlink').attr('href', "https://portal.megaworldcorp.com/ivr/report_summary/" + $(".repdatein").val() + "/" + $(".repdateout").val());
$('#btnlink2').attr('href', "https://portal.megaworldcorp.com/ivr/report_trans/" + $(".repdatein").val() + "/" + $(".repdateout").val());
},
onClose: function(selectedDate) {
$(".repdateout").datepicker("option", "minDate", selectedDate);
}
});
// report to
$(".repdateout").datepicker({
dateFormat: 'yy-mm-dd',
minDate: "2014-01-01",
maxDate: "0D",
changeMonth: true,
numberOfMonths: 2,
onSelect: function (dateText, inst) {
$('#btnlink').attr('href', "https://portal.megaworldcorp.com/ivr/report_summary/" + $(".repdatein").val() + "/" + $(".repdateout").val());
$('#btnlink2').attr('href', "https://portal.megaworldcorp.com/ivr/report_trans/" + $(".repdatein").val() + "/" + $(".repdateout").val());
},
onClose: function(selectedDate) {
$(".repdatein").datepicker("option", "maxDate", selectedDate);
}
});
$(".datepick").datepicker({
dateFormat: 'yy-mm-dd',
yearRange: "-80:-18",
changeMonth: true,
changeYear: true
});
$(".datepickchild").datepicker({
dateFormat: 'yy-mm-dd',
yearRange: "-80:+1",
changeMonth: true,
changeYear: true
});
$(".datepickreg").datepicker({
dateFormat: 'yy-mm-dd',
yearRange: "-6:+6",
changeMonth: true,
changeYear: true
});
$(".datepick2").datepicker({
dateFormat: 'yy-mm-dd',
maxDate: "0D",
changeMonth: true,
changeYear: true
});
$(".datepick3").datepicker({
dateFormat: 'yy-mm-dd',
changeMonth: true,
changeYear: true
});
$('.datetimepick').datetimepicker({
dateFormat: 'yy-mm-dd',
timeFormat: "hh:mmtt",
minDate: '2025-04-29',
maxDate: '2025-04-30'
});
$('.datetimepick2').datetimepicker({
dateFormat: 'yy-mm-dd',
timeFormat: "hh:mmtt",
minDate: '2025-04-29',
maxDate: '2025-05-01'
});
$('.datetimepickfree').datetimepicker({
dateFormat: 'yy-mm-dd',
timeFormat: "hh:mmtt",
minDate: '2024-04-29',
maxDate: '2026-04-29'
});
$('.datetimepickmonth').datepicker({
dateFormat: 'yy-mm-dd',
minDate: "-1M",
maxDate: "1M",
changeMonth: true,
changeYear: false
});
$(".checkindate").datepicker({
dateFormat: 'yy-mm-dd',
minDate: "-3M",
maxDate: "12M",
changeMonth: true
});
$('.timein').timepicker({
timeFormat: 'h:mmtt',
stepHour: 1,
stepMinute: 30,
hourMin: 6,
hourMax: 22
});
$("#dtBox").DateTimePicker({
defaultDate: new Date(),
dateTimeFormat: 'yyyy-MM-dd hh:mm aa',
buttonsToDisplay: ["SetButton"],
minDateTime: '2025-04-29 20:02:18',
maxDateTime: '2025-04-30 23:59:59',
minuteInterval: 10,
titleContentDateTime: ''
});
$("#dtBox2").DateTimePicker({
defaultDate: new Date(),
dateFormat: 'yyyy-MM-dd',
buttonsToDisplay: ["SetButton"],
titleContentDate: ''
});
/* RESIZE CROP */
$('.profile_pic').resizecrop({
width: 100,
height: 100,
vertical: "center"
});
$('.activity_img').resizecrop({
width: 200,
height: 150,
vertical: "top"
});
$('.vactivity_img').resizecrop({
width: 400,
height: 300,
vertical: "top"
});
$('.latestpic').resizecrop({
width: 300,
height: 250,
vertical: "top"
});
$('.album_thumb').resizecrop({
width: 194,
height: 150,
vertical: "center"
});
$('.picture_thumb').resizecrop({
width: 194,
height: 150,
vertical: "center"
});
$('.pixpic').resizecrop({
width: 100,
height: 75,
vertical: "center"
});
$('.smallimg').resizecrop({
width: 30,
height: 30,
vertical: "center"
});
$(".shakelog").on("click", function() {
$("html, body").animate({ scrollTop: 0 }, 100);
$('#errortd').html('Please log-in');
$('.loginheader').effect('bounce', {times: 3, distance: 10}, 420);
return false;
});
$("#username").bind('keyup', function (e) {
if (e.which >= 97 && e.which <= 122) {
var newKey = e.which - 32;
e.keyCode = newKey;
e.charCode = newKey;
}
$("#username").val(($("#username").val()).toUpperCase());
});
$("#username").on("keypress", function(e) {
if (e.keyCode == 13) {
username = $("#username").val();
password = $("#password").val();
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/login.php",
data: "username=" + username + "&password=" + password,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
if (data == 0) {
$('#errortd').html('Access denied');
$('#frmlogin').effect('shake', {times: 3, distance: 10}, 420);
}
else {
window.location.href='https://portal.megaworldcorp.com/ivr';
}
}
})
}
});
$("#password").on("keypress", function(e) {
if (e.keyCode == 13) {
username = $("#username").val();
username = username.toUpperCase();
password = $("#password").val();
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/login.php",
data: "username=" + username + "&password=" + password,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
if (data == 0) {
$('#errortd').html('Access denied');
$('#frmlogin').effect('shake', {times: 3, distance: 10}, 420);
}
else {
window.location.href='https://portal.megaworldcorp.com/ivr';
}
}
})
}
});
$("#btnlogin").on("click", function() {
username = $("#username").val();
password = $("#password").val();
$.ajax(
{
url: "https://portal.megaworldcorp.com/ivr/lib/requests/login.php",
data: "username=" + username + "&password=" + password,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
if (data == 0) {
$('#errortd').html('Access denied');
$('#frmlogin').effect('shake', {times: 3, distance: 10}, 420);
}
else {
window.location.href='https://portal.megaworldcorp.com/ivr';
}
}
})
});
});