// JavaScript Document
function parallax(){
var scrolled = $(window).scrollTop();
$('.splashbg').css('top', -(scrolled * 0.2) + 'px');
}
/* REGISTRATION */
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/offreg/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();
});
// 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/offreg/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/offreg/lib/requests/shout_request.php?sec=delete",
data: "shoutid=" + commentid,
type: "POST"
})
$.ajax(
{
url: "https://portal.megaworldcorp.com/offreg/lib/requests/shout_request.php?sec=comment",
data: "shoutid=" + shoutid,
type: "POST",
success: function(data) {
$("#commentlist").html(data);
}
});
return false;
}
});
/* Registration */
$(".btnviewreg").on("click", function() {
$(".floatdiv").removeClass("invisible");
$("#fvreg").removeClass("invisible");
regid = $(this).attr('attribute');
$.ajax(
{
url: "https://portal.megaworldcorp.com/offreg/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('Alliance Global'); } 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 Alliance Global to ' + obj.activity_venue + ': ' + vrin + '
From ' + obj.activity_venue + ' to Alliance Global: ' + vrin);
}
$("#registry_platenum").html(obj.registry_platenum);
$("#registry_dependent").html(obj.registry_dependent);
$("#registry_guest").html(obj.registry_guest);
$("#registry_child").html(obj.registry_child);
$("#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 disapprove this registration?");
regid = $(this).attr('attribute');
actid = $(this).attr('attribute2');
if (r == true)
{
$.ajax(
{
url: "https://portal.megaworldcorp.com/offreg/lib/requests/act_request.php?sec=delreg",
data: "regid=" + regid,
type: "POST",
success: function(data) {
$.ajax(
{
url: "https://portal.megaworldcorp.com/offreg/lib/requests/act_request.php?sec=regtable",
data: "actid=" + actid,
type: "POST",
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/offreg/lib/requests/act_request.php?sec=delreg",
data: "regid=" + regid,
type: "POST",
success: function(data) {
$.ajax(
{
url: "https://portal.megaworldcorp.com/offreg/lib/requests/act_request.php?sec=regtable",
success: function(data) {
$(".floatdiv").addClass("invisible");
$("#fvreg").addClass("invisible");
$("#registration_table").html(data);
}
})
}
})
return false;
}
});
/* Activity */
$(".btnmviewact").on("click", function() {
$(".mfloatdiv").removeClass("invisible");
$("#mfview").removeClass("invisible");
$("#freg").addClass("invisible");
$("#fadd").addClass("invisible");
$("#fedit").addClass("invisible");
actid = $(this).attr('attribute');
$.ajax(
{
url: "https://portal.megaworldcorp.com/offreg/lib/requests/act_request.php?sec=edit",
data: "actid=" + actid,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
var obj = $.parseJSON(data);
$("#mfview_title").html(obj.activity_title);
$("#mvactivity_description").html(obj.activity_description);
if (!obj.activity_venue || obj.activity_venue == "" || obj.activity_venue == null) { $("#mvactivity_venue").html('Alliance Global'); } else { $("#mvactivity_venue").html(obj.activity_venue); }
$("#mvactivity_date").html(obj.activity_datein);
$("#mvactivity_timein").html(obj.activity_timein);
$("#mvactivity_timeout").html(obj.activity_timeout);
if (obj.activity_approve == 1) { $("#mvactivity_approve").html(''); } else { $("#mvactivity_approve").html(''); }
if (obj.activity_guest == 1) { $("#mvactivity_guest").html(''); } else { $("#mvactivity_guest").html(''); }
if (obj.activity_dependent == 1) { $("#mvactivity_dependent").html(''); } else { $("#mvactivity_dependent").html(''); }
if (obj.activity_cvehicle == 1) { $("#mvactivity_cvehicle").html(''); } else { $("#mvactivity_cvehicle").html(''); }
$("#mvactivity_slots").html(obj.activity_slots);
$("#mvactivity_img").attr('src', 'https://portal.megaworldcorp.com/offreg/image?type=1&id=' + obj.activity_id);
$("#mbtnregact").attr('attribute', obj.activity_id);
}
})
return false;
});
$(".btnviewact").on("click", function() {
$(".floatdiv").removeClass("invisible");
$("#fview").removeClass("invisible");
$("#freg").addClass("invisible");
$("#fadd").addClass("invisible");
$("#fedit").addClass("invisible");
actid = $(this).attr('attribute');
$.ajax(
{
url: "https://portal.megaworldcorp.com/offreg/lib/requests/act_request.php?sec=edit",
data: "actid=" + actid,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
var obj = $.parseJSON(data);
$("#fview_title").html(obj.activity_title);
$("#vactivity_description").html(obj.activity_description);
if (!obj.activity_venue || obj.activity_venue == "" || obj.activity_venue == null) { $("#vactivity_venue").html('Alliance Global'); } else { $("#vactivity_venue").html(obj.activity_venue); }
$("#vactivity_date").html(obj.activity_datein);
$("#vactivity_timein").html(obj.activity_timein);
$("#vactivity_timeout").html(obj.activity_timeout);
if (obj.activity_approve == 1) { $("#vactivity_approve").html(''); } else { $("#vactivity_approve").html(''); }
if (obj.activity_guest == 1) { $("#vactivity_guest").html(''); } else { $("#vactivity_guest").html(''); }
if (obj.activity_dependent == 1) { $("#vactivity_dependent").html(''); } else { $("#vactivity_dependent").html(''); }
if (obj.activity_cvehicle == 1) { $("#vactivity_cvehicle").html(''); } else { $("#vactivity_cvehicle").html(''); }
$("#vactivity_slots").html(obj.activity_slots);
$("#vactivity_img").attr('src', 'https://portal.megaworldcorp.com/offreg/image?type=1&id=' + obj.activity_id);
$("#btnregact").attr('attribute', obj.activity_id);
}
})
return false;
});
$(".btnregact").on("click", function() {
$(".freg_msg").css("display","none");
$(".floatdiv").removeClass("invisible");
$("#fview").addClass("invisible");
$("#freg").removeClass("invisible");
$("#fadd").addClass("invisible");
$("#fedit").addClass("invisible");
actid = $(this).attr('attribute');
$.ajax(
{
url: "https://portal.megaworldcorp.com/offreg/lib/requests/act_request.php?sec=edit",
data: "actid=" + actid,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
var obj = $.parseJSON(data);
if (obj.activity_venue || obj.activity_venue == 'Alliance Global' || (obj.activity_venue != "" && obj.activity_venue != null))
{
$("#cvehicle").addClass('invisible');
$("#cvehicle2").addClass('invisible');
if (obj.activity_cvehicle == 1)
{
$("#cvehicle").removeClass('invisible');
$("#cvehicle2").removeClass('invisible');
}
}
else
{
$("#cvehicle").addClass('invisible');
$("#cvehicle2").addClass('invisible');
}
if (obj.activity_guest == 1)
{
$("#guest").addClass('invisible');
$("#dependent").addClass('invisible');
$("#guest").removeClass('invisible');
if (obj.activity_dependent == 1)
{
$("#dependent").removeClass('invisible');
}
}
else
{
$("#guest").addClass('invisible');
$("#dependent").addClass('invisible');
if (obj.activity_dependent == 1)
{
$("#guest").removeClass('invisible');
}
}
if (obj.activity_approve == 1)
{
$("#approve").addClass('invisible');
$("#approve").removeClass('invisible');
}
else
{
$("#approve").addClass('invisible');
}
$("#freg_title").html(obj.activity_title + ' Registration');
$("#registry_activityid").val(obj.activity_id);
$("#reg_venue1").html(obj.activity_venue);
$("#reg_venue2").html(obj.activity_venue);
$("#registry_approve").val(obj.activity_approve);
}
})
});
$(".btnaddact").on("click", function() {
$(".fadd_msg").css("display","none");
$("#cactivity_title").val("");
$("#cactivity_description").val("");
$("#cactivity_image").val("");
$(".floatdiv").removeClass("invisible");
$("#fview").addClass("invisible");
$("#freg").addClass("invisible");
$("#fadd").removeClass("invisible");
$("#fedit").addClass("invisible");
});
$(".btneditact").on("click", function() {
$(".floatdiv").removeClass("invisible");
$("#fview").addClass("invisible");
$("#freg").addClass("invisible");
$("#fadd").addClass("invisible");
$("#fedit").removeClass("invisible");
actid = $(this).attr('attribute');
$.ajax(
{
url: "https://portal.megaworldcorp.com/offreg/lib/requests/act_request.php?sec=edit",
data: "actid=" + actid,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
var obj = $.parseJSON(data);
$("#uactivity_title").val(obj.activity_title);
$("#uactivity_description").val(obj.activity_description);
$("#uactivity_venue").val(obj.activity_venue);
$("#uactivity_date").val(obj.activity_datein);
$("#uactivity_timein").val(obj.activity_timein);
$("#uactivity_timeout").val(obj.activity_timeout);
if (obj.activity_approve == 1) { $("#uactivity_approve").prop('checked', true); } else { $("#uactivity_approve").prop('checked', false); }
if (obj.activity_guest == 1) { $("#uactivity_guest").prop('checked', true); } else { $("#uactivity_guest").prop('checked', false); }
if (obj.activity_dependent == 1) { $("#uactivity_dependent").prop('checked', true); } else { $("#uactivity_dependent").prop('checked', false); }
if (obj.activity_cvehicle == 1) { $("#uactivity_cvehicle").prop('checked', true); } else { $("#uactivity_cvehicle").prop('checked', false); }
$("#uactivity_slots").val(obj.activity_slots);
$("#uactivity_user").val(obj.activity_user);
$("#uactivity_id").val(actid);
}
})
return false;
});
$(".btndelact").on("click", function() {
var r = confirm("Are you sure you want to delete this activity?");
actid = $(this).attr('attribute');
if (r == true)
{
$.ajax(
{
url: "https://portal.megaworldcorp.com/offreg/lib/requests/act_request.php?sec=delete",
data: "actid=" + actid,
type: "POST",
success: function(data) {
$.ajax(
{
url: "https://portal.megaworldcorp.com/offreg/lib/requests/act_request.php?sec=table",
success: function(data) {
$("#activity_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/offreg/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;
}
});
$(".approveUser").live("click", function() {
empid = $(this).attr('attribute');
empstatus = $(this).attr('attribute2');
$(".ustatusDiv" + empid).html('');
$.ajax(
{
url: "https://portal.megaworldcorp.com/offreg/lib/requests/reg_request.php?sec=approveemp",
data: "empid=" + empid + "&emp_status=" + empstatus,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
$(".ustatusDiv" + empid).html(data);
}
})
return false;
});
$(".closebutton").on("click", function() {
$(".floatdiv").addClass("invisible");
$("#fview").addClass("invisible");
$("#fadd").addClass("invisible");
$("#fedit").addClass("invisible");
$("#bdayview").addClass("invisible");
});
$(".closebutton2").on("click", function() {
$(".floatdiv").addClass("invisible");
$("#fview").addClass("invisible");
$("#fadd").addClass("invisible");
$("#fedit").addClass("invisible");
$("#bdayview").addClass("invisible");
});
$(".mclosebutton").on("click", function() {
$(".mfloatdiv").addClass("invisible");
$("#mfview").addClass("invisible");
$("#fadd").addClass("invisible");
$("#fedit").addClass("invisible");
$("#bdayview").addClass("invisible");
});
/* REGISTER EMPLOYEE */
$("#searchempid").bind('keyup', function(e) {
if (e.which == 13) {
$("#waiting").html(' Searching employee…');
empid = $(this).val();
actid = $("#txtactid").val();
db = $('#dbname').val();
if (empid.length < 4) {
$("#waiting").html('It must be XXXX-XX-XXXX or XXXX');
} else {
$.ajax(
{
url: "https://portal.megaworldcorp.com/offreg/lib/requests/emp_request.php?sec=emp_search",
data: "empid=" + empid + "&actid=" + actid + "&db=" + db,
type: "POST",
success: function(data) {
var obj = $.parseJSON(data);
$("#waiting").html('');
$("#allreg1").removeClass('invisible');
if (data == 0) {
if (actid >= 282) {
$("#allreg4").removeClass('invisible');
$("#txtempid").val(0);
$("#txtregid").val(0);
$("#notfound").removeClass('invisible');
$("#txtempname").addClass('invisible');
$("#txtempcomp").addClass('invisible');
$("#emp_name").addClass('invisible');
$("#allreg11").addClass('invisible');
$("#allreg12").addClass('invisible');
$("#allreg13").addClass('invisible');
$("#allreg14").addClass('invisible');
$("#allreg15").addClass('invisible');
$("#allreg16").addClass('invisible');
$("#allreg17").addClass('invisible');
$("#allreg18").addClass('invisible');
$("#allreg20").addClass('invisible');
$("#cmdprereg").addClass('invisible');
}
else {
$("#allreg4").removeClass('invisible');
$("#txtempid").val(0);
$("#txtregid").val(0);
$("#notfound").addClass('invisible');
$("#txtempname").removeClass('invisible');
$("#txtempcomp").removeClass('invisible');
$("#emp_name").addClass('invisible');
$("#allreg11").removeClass('invisible');
$("#allreg12").addClass('invisible');
$("#allreg13").addClass('invisible');
$("#allreg14").addClass('invisible');
$("#allreg15").addClass('invisible');
$("#allreg16").addClass('invisible');
$("#allreg17").addClass('invisible');
$("#allreg18").addClass('invisible');
$("#allreg20").addClass('invisible');
}
}
else {
if (obj.registered == 1) {
$("#allreg11").addClass('invisible');
$("#allreg12").removeClass('invisible');
$("#allreg13").removeClass('invisible');
$("#allreg14").addClass('invisible');
$("#allreg15").removeClass('invisible');
$("#allreg16").removeClass('invisible');
//$("#allreg17").removeClass('invisible');
$("#allreg20").removeClass('invisible');
$("#allreg18").removeClass('invisible');
$("#allreg4").removeClass('invisible');
$("#notfound").addClass('invisible');
$("#txtempname").addClass('invisible');
$("#txtempcomp").addClass('invisible');
$("#emp_name").removeClass('invisible');
if (obj.attended == 1) {
$("#emp_name").html(obj.empfullname + " (attended)");
$("#cmdreg").addClass('invisible');
} else {
$("#emp_name").html(obj.empfullname + " (registered)");
if (actid == 1750 || actid == 1751) {
if (obj.empcomp == 'GL') {
var rdate = new Date(obj.empdatereg);
var rdate1 = new Date('December 31, 2017');
if (rdate1 >= rdate) {
$("#cmdreg").removeClass('invisible');
} else {
$("#cmdreg").addClass('invisible');
}
} else {
var hdate = new Date(obj.empdatehired);
var hdate1 = new Date('June 31, 2017');
if (hdate1 >= hdate) {
$("#cmdreg").removeClass('invisible');
} else {
$("#cmdreg").addClass('invisible');
}
}
} else {
$("#cmdreg").removeClass('invisible');
}
}
$("#emp_position").removeClass('invisible');
if (obj.empposition) {
$("#emp_position").html(obj.empposition);
} else {
$("#allreg12").addClass('invisible');
}
$("#emp_level").removeClass('invisible');
if (obj.emprank) {
$("#emp_level").html(obj.emprank);
} else {
$("#allreg13").addClass('invisible');
}
$("#emp_regular").removeClass('invisible');
if (obj.regular == 1) {
$("#emp_regular").html("Regular");
} else {
$("#emp_regular").html("Probationary");
}
$("#emp_company").removeClass('invisible');
if (obj.empcomp) {
$("#emp_company").html(obj.empcomp);
$("#txtcomp").val(obj.empcomp);
} else {
$("#allreg15").addClass('invisible');
}
$("#emp_division").removeClass('invisible');
if (obj.empdivision) {
$("#emp_division").html(obj.empdivision);
} else {
$("#allreg16").addClass('invisible');
}
$("#emp_datehired").removeClass('invisible');
if (obj.empdatehired) {
$("#emp_datehired").html(obj.empdatehired);
} else {
$("#allreg20").addClass('invisible');
}
$("#emp_datereg").removeClass('invisible');
if (obj.empdatereg) {
$("#emp_datereg").html(obj.empdatereg);
} else {
$("#allreg18").addClass('invisible');
}
$("#txtempid").val(obj.empid);
$("#txtregid").val(obj.regid);
$("#cmdprereg").addClass('invisible');
}
else {
$("#allreg11").addClass('invisible');
$("#allreg12").removeClass('invisible');
$("#allreg13").removeClass('invisible');
$("#allreg14").addClass('invisible');
$("#allreg15").removeClass('invisible');
$("#allreg16").removeClass('invisible');
$("#allreg20").removeClass('invisible');
$("#allreg18").removeClass('invisible');
$("#allreg4").removeClass('invisible');
$("#notfound").addClass('invisible');
$("#txtempname").addClass('invisible');
$("#txtempcomp").addClass('invisible');
$("#emp_name").removeClass('invisible');
$("#emp_name").html(obj.empfullname);
$("#emp_position").removeClass('invisible');
if (obj.empposition) {
$("#emp_position").html(obj.empposition);
} else {
$("#allreg12").addClass('invisible');
}
$("#emp_level").removeClass('invisible');
if (obj.emprank) {
$("#emp_level").html(obj.emprank);
} else {
$("#allreg13").addClass('invisible');
}
$("#emp_regular").removeClass('invisible');
if (obj.regular == 1) {
$("#emp_regular").html("Regular");
} else {
$("#emp_regular").html("Probationary");
}
$("#emp_company").removeClass('invisible');
if (obj.empcomp) {
$("#emp_company").html(obj.empcomp);
$("#txtcomp").val(obj.empcomp);
} else {
$("#allreg15").addClass('invisible');
}
$("#emp_division").removeClass('invisible');
if (obj.empdivision) {
$("#emp_division").html(obj.empdivision);
} else {
$("#allreg16").addClass('invisible');
}
$("#emp_gender").removeClass('invisible');
if (obj.empgender) {
$("#emp_gender").html(obj.empgender);
} else {
$("#allreg17").addClass('invisible');
}
$("#emp_datehired").removeClass('invisible');
if (obj.empdatehired) {
$("#emp_datehired").html(obj.empdatehired);
} else {
$("#allreg20").addClass('invisible');
}
$("#emp_datereg").removeClass('invisible');
if (obj.empdatereg) {
$("#emp_datereg").html(obj.empdatereg);
} else {
$("#allreg18").addClass('invisible');
}
$("#txtempid").val(obj.empid);
$("#txtregid").val(0);
if (actid == 1750 || actid == 1751) {
if (obj.empcomp == 'GL') {
var rdate = new Date(obj.empdatereg);
var rdate1 = new Date('December 31, 2017');
if (rdate1 >= rdate) {
$("#cmdprereg").removeClass('invisible');
} else {
$("#cmdprereg").addClass('invisible');
}
} else {
var hdate = new Date(obj.empdatehired);
var hdate1 = new Date('June 31, 2017');
if (hdate1 >= hdate) {
$("#cmdprereg").removeClass('invisible');
} else {
$("#cmdprereg").addClass('invisible');
}
}
} else {
$("#cmdprereg").removeClass('invisible');
}
}
}
}
})
}
return false;
}
});
$("#cmdreg").on("click", function() {
empid = $("#txtempid").val();
actid = $("#txtactid").val();
regid = $("#txtregid").val();
empcomp = $("#txtcomp").val();
empname = $("#txtempname").val();
empidnum = $("#searchempid").val();
$.ajax(
{
url: "https://portal.megaworldcorp.com/offreg/lib/requests/emp_request.php?sec=regsub",
data: "empid=" + empid + "&actid=" + actid + "®id=" + regid + "&empname=" + empname + "&empidnum=" + empidnum + "&empcomp=" + empcomp,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
if (data == 0) {
alert("Database error");
}
else {
alert("Successfully registered");
window.location.href='https://portal.megaworldcorp.com/offreg/register?id=' + actid;
}
}
})
});
$("#cmdprereg").on("click", function() {
empid = $("#txtempid").val();
actid = $("#txtactid").val();
regid = $("#txtregid").val();
empcomp = $("#txtcomp").val();
empname = $("#txtempname").val();
empidnum = $("#searchempid").val();
$.ajax(
{
url: "https://portal.megaworldcorp.com/offreg/lib/requests/emp_request.php?sec=preregsub",
data: "empid=" + empid + "&actid=" + actid + "®id=" + regid + "&empname=" + empname + "&empidnum=" + empidnum + "&empcomp=" + empcomp,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
if (data == 0) {
alert("Database error");
}
else {
alert("Successfully registered");
window.location.href='https://portal.megaworldcorp.com/offreg/register?id=' + actid + '&prereg=1';
}
}
})
});
/* CLEAR SEARCH */
$(".btnsearchallsht").on("click", function() {
$.ajax(
{
url: "https://portal.megaworldcorp.com/offreg/lib/requests/shout_request.php?sec=clear_search",
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
window.location.href='https://portal.megaworldcorp.com/offreg/shoutbox';
}
})
});
/* REGISTRATION */
$(".btnviewreg").on("click", function() {
$(".floatdiv").removeClass("invisible");
$("#fback").addClass("invisible");
$("#fvreg").removeClass("invisible");
regid = $(this).attr('attribute');
$.ajax(
{
url: "https://portal.megaworldcorp.com/offreg/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('Alliance Global'); } 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 Alliance Global to ' + obj.activity_venue + ': ' + vrin + '
From ' + obj.activity_venue + ' to Alliance Global: ' + 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'); }
$("#registry_details").html(obj.registry_details);
$("#btndelreg2").attr('attribute', obj.registry_id);
}
})
return false;
});
/* BACKOUT */
$(".btnviewback").on("click", function() {
$(".floatdiv").removeClass("invisible");
$("#fback").addClass("invisible");
$("#fvreg").removeClass("invisible");
regid = $(this).attr('attribute');
$.ajax(
{
url: "https://portal.megaworldcorp.com/offreg/lib/requests/act_request.php?sec=editback",
data: "regid=" + regid,
type: "POST",
complete: function(){
$("#loading").hide();
},
success: function(data) {
var obj = $.parseJSON(data);
$("#fvreg_title").html(obj.registry_uid);
if (!obj.activity_venue || obj.activity_venue == "" || obj.activity_venue == null) { $("#registry_venue").html('Alliance Global'); } 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);
$.ajax(
{
url: "https://portal.megaworldcorp.com/offreg/lib/requests/act_request.php?sec=logs",
data: "regid=" + obj.registry_id + "®db=" + obj.registry_db,
type: "POST",
success: function(data) {
$("#reglog").html(data);
}
});
}
})
return false;
});
/* DATE/TIME PICKER */
$(".datepick").datepicker({
dateFormat: 'yy-mm-dd',
yearRange: "-80:-16",
changeMonth: true,
changeYear: true
});
$(".datepickchild").datepicker({
dateFormat: 'yy-mm-dd',
yearRange: "-80:+1",
changeMonth: true,
changeYear: true
});
$(".datepick2").datepicker({
dateFormat: 'yy-mm-dd',
maxDate: "0D",
changeMonth: true,
changeYear: true
});
$(".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
});
/* RESIZE CROP */
$('.profile_pic').resizecrop({
width: 100,
height: 100,
vertical: "center"
});
$('.activity_img').resizecrop({
width: 200,
height: 150,
vertical: "top"
});
$('.activity_limg').resizecrop({
width: 300,
height: 450,
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/offreg/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/offreg';
}
}
})
}
});
$("#password").on("keypress", function(e) {
if (e.keyCode == 13) {
username = $("#username").val();
username = username.toUpperCase();
password = $("#password").val();
$.ajax(
{
url: "https://portal.megaworldcorp.com/offreg/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/offreg';
}
}
})
}
});
$("#btnlogin").on("click", function() {
username = $("#username").val();
password = $("#password").val();
$.ajax(
{
url: "https://portal.megaworldcorp.com/offreg/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/offreg';
}
}
})
});
});