// JavaScript Document function parallax(){ var scrolled = $(window).scrollTop(); $('.splashbg').css('top', -(scrolled * 0.2) + 'px'); } function changeUrl(page, url) { if (typeof (history.pushState) != "undefined") { var obj = { Page: page, Url: url }; history.pushState(obj, obj.Page, obj.Url); } else { alert("Browser does not support HTML5."); } } /* DISABLE LINK */ function clickAndDisable(link) { link.onclick = function(event) { event.preventDefault(); } } /* 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://www.marketingsalesagents.com/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(""); } } }) } /* HIDE OVERLAY */ function hideOverlay() { $(".floatdiv").addClass("invisible"); } /* 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 */ $("#subapp").hover(function() { $(".appsubmenu").show(); },function() { $(".appsubmenu").hide(); }); /* TABS */ $("#tabs").tabs(); /* FLOAT DIV CONTROL */ /* Birthday */ $(".btnbday").on("click", function() { $(".mfloatdiv").removeClass("invisible"); $("#bdayview").removeClass("invisible"); empid = $(this).attr('attribute'); $.ajax( { url: "https://www.marketingsalesagents.com/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; }); /* Profile */ $(".samewithadd").on("click", function() { if($(".samewithadd:checked").length) { personaladd = $("#UnitStreet").val() + ', ' + $("#Barangay").val() + ', ' + $("#TownCity").val() + ', ' + $("#StateProvince").val() + ' ' + $("#Zip").val(); $("#ContactAddress").val(personaladd); } else { $("#ContactAddress").val(''); } }); /* Notification */ $(".chkapp").on("click", function() { if($(".chkapp:checked").length) { $("#btnapprchk").removeClass('invisible'); } else { $("#btnapprchk").addClass('invisible'); } }); $(".chkappall").change(function(){ $(".chkapp").prop('checked', $(this).prop("checked")); if($(".chkapp:checked").length) { $("#btnapprchk").removeClass('invisible'); } else { $("#btnapprchk").addClass('invisible'); } }); $("#btnapprchk").on("click", function() { var r = confirm("Are you sure you want to approved all checked request?"); if (r == true) { var massapprove_msg; $(this).addClass('invisible'); error = 0; $(".chkapp:checked").each(function() { reqnbr = $(this).val(); remarks = "Approved"; doctype = $(this).attr("attribute"); user = $(this).attr("attribute2"); empid = $(this).attr("attribute3"); approvehours = $(this).attr("attribute4"); dbname = $(this).attr("attribute5"); trans = 'APPROVED'; if (approvehours != 0) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/notification_request.php?sec=approve", data: "trans=" + trans + "&remarks=" + remarks + "&doctype=" + doctype + "&reqnbr=" + reqnbr + "&user=" + user + "&empid=" + empid + "&approvehours=" + approvehours + "&dbname=" + dbname, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { if (data == 1) { error = error; } else { error = error + 1; } } }) } else { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/notification_request.php?sec=approve", data: "trans=" + trans + "&remarks=" + remarks + "&doctype=" + doctype + "&reqnbr=" + reqnbr + "&user=" + user + "&empid=" + empid + "&dbname=" + dbname, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { if (data == 1) { error = error; } else { error = error + 1; } } }) } }); if (error == 0) { alert('Request you\'ve checked has been
successfully completed.'); $("#notidata").html(' Loading...'); searchnoti = $("#searchnoti").val(); notifrom = $("#notifrom").val(); notito = $("#notito").val(); notipage = 1; $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/notification_request.php?sec=table", data: "searchnoti=" + searchnoti + "¬itype=" + notitype + "¬ifrom=" + notifrom + "¬ito=" + notito, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#btnnotiall").removeClass("invisible"); $("#notidata").html(data); changeUrl('', 'https://www.marketingsalesagents.com/notification'); } }); } else { alert("Not all checked request
has been approved."); $("#notidata").html(' Loading...'); $('#remarks').addClass("invisible"); $('#btnapp').addClass("invisible"); $('#btnrej').addClass("invisible"); searchnoti = $("#searchnoti").val(); notitype = $("#notitype").val(); notifrom = $("#notifrom").val(); notito = $("#notito").val(); notipage = 1; $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/notification_request.php?sec=table", data: "searchnoti=" + searchnoti + "¬itype=" + notitype + "¬ifrom=" + notifrom + "¬ito=" + notito, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#btnnotiall").removeClass("invisible"); $("#notidata").html(data); changeUrl('', 'https://www.marketingsalesagents.com/notification'); } }); } } }); $("#searchnoti").on("keypress", function(e) { if (e.keyCode == 13) { searchnoti = $("#searchnoti").val(); notitype = $("#notitype").val(); notifrom = $("#notifrom").val(); notito = $("#notito").val(); notipage = 1; $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/notification_request.php?sec=table", data: "searchnoti=" + searchnoti + "¬itype=" + notitype + "¬ifrom=" + notifrom + "¬ito=" + notito, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#btnnotiall").removeClass("invisible"); $("#notidata").html(data); changeUrl('', 'https://www.marketingsalesagents.com/notification'); } }) } }); $("#btnnoti").on("click", function() { searchnoti = $("#searchnoti").val(); notitype = $("#notitype").val(); notifrom = $("#notifrom").val(); notito = $("#notito").val(); notipage = 1; $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/notification_request.php?sec=table", data: "searchnoti=" + searchnoti + "¬itype=" + notitype + "¬ifrom=" + notifrom + "¬ito=" + notito, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#btnnotiall").removeClass("invisible"); $("#notidata").html(data); changeUrl('', 'https://www.marketingsalesagents.com/notification'); } }) }); $("#btnnotiall").on("click", function() { notipage = 1; $(this).addClass("invisible"); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/notification_request.php?sec=table", data: "clear_search=1", type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#searchnoti").val(""); $("#notifrom").val("2014-08-01"); $("#notito").val("2024-05-03"); $("#btnnotiall").addClass("invisible"); $("#notidata").html(data); changeUrl('', 'https://www.marketingsalesagents.com/notification'); } }) }); /* Pending */ $("#searchpend").on("keypress", function(e) { if (e.keyCode == 13) { searchpend = $("#searchpend").val(); pendtype = $("#pendtype").val(); pendfrom = $("#pendfrom").val(); pendto = $("#pendto").val(); pendpage = 1; $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/notification_request.php?sec=tablepend", data: "searchpend=" + searchpend + "&pendtype=" + pendtype + "&pendfrom=" + pendfrom + "&pendto=" + pendto, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#btnpendall").removeClass("invisible"); $("#penddata").html(data); changeUrl('', 'https://www.marketingsalesagents.com/pending'); } }) } }); $("#btnpend").on("click", function() { searchpend = $("#searchpend").val(); pendtype = $("#pendtype").val(); pendfrom = $("#pendfrom").val(); pendto = $("#pendto").val(); pendpage = 1; $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/notification_request.php?sec=tablepend", data: "searchpend=" + searchpend + "&pendtype=" + pendtype + "&pendfrom=" + pendfrom + "&pendto=" + pendto, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#btnpendall").removeClass("invisible"); $("#penddata").html(data); changeUrl('', 'https://www.marketingsalesagents.com/pending'); } }) }); $("#btnpendall").on("click", function() { pendpage = 1; $(this).addClass("invisible"); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/notification_request.php?sec=tablepend", data: "clear_search=1", type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#searchpend").val(""); $("#pendfrom").val("2014-08-01"); $("#pendto").val("2024-05-03"); $("#btnpendall").addClass("invisible"); $("#penddata").html(data); changeUrl('', 'https://www.marketingsalesagents.com/pending'); } }) }); // Request Management - START $("#searchrman").on("keypress", function(e) { if (e.keyCode == 13) { $("#rmandata").html(' Loading...'); rmantype = $("#rmantype").val(); searchrman = $("#searchrman").val(); rmanfrom = $("#rmanfrom").val(); rmanto = $("#rmanto").val(); rmanpage = 1; $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/notification_request.php?sec=tablerman", data: "searchrman=" + searchrman + "&rmanfrom=" + rmanfrom + "&rmanto=" + rmanto + "&rmantype=" + rmantype, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#btnrmanall").removeClass("invisible"); $("#rmandata").html(data); changeUrl('', 'https://www.marketingsalesagents.com/reqman'); } }) } }); $("#btnrman").on("click", function() { $("#rmandata").html(' Loading...'); rmantype = $("#rmantype").val(); searchrman = $("#searchrman").val(); rmanfrom = $("#rmanfrom").val(); rmanto = $("#rmanto").val(); rmanpage = 1; $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/notification_request.php?sec=tablerman", data: "searchrman=" + searchrman + "&rmanfrom=" + rmanfrom + "&rmanto=" + rmanto + "&rmantype=" + rmantype, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#btnrmanall").removeClass("invisible"); $("#rmandata").html(data); changeUrl('', 'https://www.marketingsalesagents.com/reqman'); } }) }); $("#btnrmanall").on("click", function() { $("#rmandata").html(' Loading...'); rmanpage = 1; $(this).addClass("invisible"); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/notification_request.php?sec=tablerman", data: "clear_search=1", type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#rmantype").val(null); $("#searchrman").val(""); $("#rmanfrom").val("2014-08-01"); $("#rmanto").val("2024-05-03"); $("#btnrmanall").addClass("invisible"); $("#rmandata").html(data); changeUrl('', 'https://www.marketingsalesagents.com/reqman'); } }) }); // Request Management - END $(".btnnotidata").on("click", function() { doctype = $(this).attr('attribute2'); refnum = $(this).attr('attribute'); if (doctype == 'LV') { title = "Notice of Unavailability Application #"; } else if (doctype == 'NP') { title = "No Log IN Authorization #"; } else if (doctype == 'MA') { title = "Meal Allowance Application #"; } else if (doctype == 'OB') { title = "OBT Application #"; } else if (doctype == 'OT') { title = "Overtime Application #"; } else if (doctype == 'MD') { title = "Manual DIR Application #"; } else if (doctype == 'SC') { title = "Itinerary Amendment Application #"; } else if (doctype == 'TS') { title = "Itinerary Amendment Application #"; } $("#noti_title").html(title + ' ' + refnum); $(".floatdiv").removeClass("invisible"); $("#nview").show({ effect : 'slide', easing : 'easeOutQuart', direction : 'up', duration : 500 }); $("#noti_data").html(' Loading...'); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/notification_request.php?sec=data", data: "refnum=" + refnum + "&doctype=" + doctype, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#noti_data").html(data); } }) }); $(".btnrnotidata").on("click", function() { doctype = $(this).attr('attribute2'); refnum = $(this).attr('attribute'); dbname = $(this).attr('attribute5'); if (doctype == 'LV') { title = "Notice of Unavailability Application #"; } else if (doctype == 'NP') { title = "No Log IN Authorization #"; } else if (doctype == 'MA') { title = "Meal Allowance Application #"; } else if (doctype == 'OB') { title = "OBT Application #"; } else if (doctype == 'OT') { title = "Overtime Application #"; } else if (doctype == 'MD') { title = "Manual DIR Application #"; } else if (doctype == 'SC') { title = "Itinerary Amendment Application #"; } else if (doctype == 'TS') { title = "Itinerary Amendment Application #"; } $("#noti_title").html(title + ' ' + refnum); $(".floatdiv").removeClass("invisible"); $("#nview").show({ effect : 'slide', easing : 'easeOutQuart', direction : 'up', duration : 500 }); $("#noti_data").html(' Loading...'); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/notification_request.php?sec=datarman", data: "refnum=" + refnum + "&doctype=" + doctype + "&dbname=" + dbname, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#noti_data").html(data); } }) }); $(".btnpenddata").on("click", function() { doctype = $(this).attr('attribute2'); refnum = $(this).attr('attribute'); dbname = $(this).attr('attribute5'); if (doctype == 'LV') { title = "Notice of Unavailability Application #"; } else if (doctype == 'NP') { title = "No Log IN Authorization #"; } else if (doctype == 'MA') { title = "Meal Allowance Application #"; } else if (doctype == 'OB') { title = "OBT Application #"; } else if (doctype == 'OT') { title = "Overtime Application #"; } else if (doctype == 'MD') { title = "Manual DIR Application #"; } else if (doctype == 'SC') { title = "Itinerary Amendment Application #"; } else if (doctype == 'TS') { title = "Itinerary Amendment Application #"; } $("#pend_title").html(title + ' ' + refnum); $(".floatdiv").removeClass("invisible"); $("#nview").show({ effect : 'slide', easing : 'easeOutQuart', direction : 'up', duration : 500 }); $("#pend_data").html(' Loading...'); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/notification_request.php?sec=datapend", data: "refnum=" + refnum + "&doctype=" + doctype + "&dbname=" + dbname, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#pend_data").html(data); } }) }); /* My Request */ $("#mreqtype").change(function() { mtype = $("#mreqtype option:selected").val(); mstatus = $("#mreqstatus").val(); mfrom = $("#mreqfrom").val(); mto = $("#mreqto").val(); mrefnum = $("#mreqrefnum").val(); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/myreq_request.php?sec=table", data: "mreqtype=" + mtype + "&mreqfrom=" + mfrom + "&mreqto=" + mto + "&mreqrefnum=" + mrefnum, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#mreqdata").html(data); } }) }); $("#mreqrefnum").on("keypress", function(e) { if (e.keyCode == 13) { mtype = $("#mreqtype option:selected").val(); mstatus = $("#mreqstatus").val(); mfrom = $("#mreqfrom").val(); mto = $("#mreqto").val(); mrefnum = $("#mreqrefnum").val(); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/myreq_request.php?sec=table", data: "mreqtype=" + mtype + "&mreqfrom=" + mfrom + "&mreqto=" + mto + "&mreqrefnum=" + mrefnum, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#mreqdata").html(data); } }) } }); $("#btnmreq").on("click", function() { mtype = $("#mreqtype option:selected").val(); mstatus = $("#mreqstatus").val(); mfrom = $("#mreqfrom").val(); mto = $("#mreqto").val(); mrefnum = $("#mreqrefnum").val(); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/myreq_request.php?sec=table", data: "mreqtype=" + mtype + "&mreqfrom=" + mfrom + "&mreqto=" + mto + "&mreqrefnum=" + mrefnum, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#mreqdata").html(data); } }) }); $("#btnmreqall").on("click", function() { mtype = $("#mreqtype option:selected").val(); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/myreq_request.php?sec=table", data: "mreqtype=" + mtype + "&clear_search=1", type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#mreqdata").html(data); } }) }); /*COE start*/ $(".btncoe").on("click", function() { id = $(this).attr('attribute'); level = $(this).attr('attribute5'); approver_level = $(this).attr('attribute6'); $("#coe_title").html('Certificate of Agency'); $("#coefloat").removeClass("invisible"); $("#coeview").show({ effect : 'slide', easing : 'easeOutQuart', direction : 'up', duration : 500 }); $("#coedata").html(' Loading...'); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/notification_request.php?sec=coeold", data: "id=" + id + "&level=" + level+ "&approver_level=" + approver_level, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#coedata").html(data); } }) }); $("#coenewreq").on("click", function() { level = $(this).attr('attribute5'); $("#coe_title").html('Certificate of Agency'); $("#coefloat").removeClass("invisible"); $("#coeview").show({ effect : 'slide', easing : 'easeOutQuart', direction : 'up', duration : 500 }); $("#coedata").html(' Loading...'); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/notification_request.php?sec=coenew", data: "level=" + level, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#loading").hide(); $("#coedata").html(data); } }) }); $("#coesearch").on("click", function() { ref_no = $("#coeref").val(); level = $(this).attr('attribute'); approver = $(this).attr('attribute6'); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/notification_request.php?sec=coesearch", data: "ref_no=" + ref_no + "&level=" + level + "&approver=" + approver, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#loading").hide(); $("#tablecoe").html(data); } }) }); /*COE end */ /* MEMO */ $(".searchmemo").on("keypress", function(e) { if (e.keyCode == 13) { $(".btnsearchallmemo").removeClass('invisible'); msearch = $("#searchmemo").val(); mfrom = $("#memofrom").val(); mto = $("#memoto").val(); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/memo_request.php?sec=table", data: "searchmemo=" + msearch + "&memofrom=" + mfrom + "&memoto=" + mto, type: "POST", success: function(data) { $("#memodata").html(data); } }) return false; } }); $(".btnsearchmemo").on("click", function() { $(".btnsearchallmemo").removeClass('invisible'); msearch = $("#searchmemo").val(); mfrom = $("#memofrom").val(); mto = $("#memoto").val(); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/memo_request.php?sec=table", data: "searchmemo=" + msearch + "&memofrom=" + mfrom + "&memoto=" + mto, type: "POST", success: function(data) { $("#memodata").html(data); } }) return false; }); $(".btnsearchallmemo").on("click", function() { $(this).addClass('invisible'); $("#searchmemo").val(''); $("#memofrom").val('08/01/2014'); $("#memoto").val('05/03/2024'); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/memo_request.php?sec=clear_search", type: "POST", success: function(data) { $("#memodata").html(data); } }) return false; }); $(".btnviewmemo").on("click", function() { memattach = $(this).attr('attribute'); window.open("https://www.marketingsalesagents.com/uploads/" + memattach, "popupWindow", "width=950, height=800, scrollbars=yes"); return false; }); $(".btnaddmemo").on("click", function() { $(".madd_msg").css("display","none"); $("#memo_title").val(""); $("#memo_attach").val(""); $(".floatdiv").removeClass("invisible"); $("#madd").show({ effect : 'slide', easing : 'easeOutQuart', direction : 'up', duration : 500 }); $("#medit").hide(); $(".madd_msg").slideUp(); }); $(".btneditmemo").on("click", function() { $(".floatdiv").removeClass("invisible"); $("#madd").hide(); $("#medit").show({ effect : 'slide', easing : 'easeOutQuart', direction : 'up', duration : 500 }); $(".medit_msg").slideUp(); memid = $(this).attr('attribute'); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/memo_request.php?sec=edit", data: "memid=" + memid, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { var obj = $.parseJSON(data); $("#umemo_title").val(obj.memo_title); $("#umemo_date").val(obj.memo_date); $("#umemo_user").val(obj.memo_user); $("#umemo_id").val(memid); } }) return false; }); $(".btndelmemo").on("click", function() { var r = confirm("Are you sure you want to delete this memo?"); memid = $(this).attr('attribute'); if (r == true) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/memo_request.php?sec=delete", data: "memid=" + memid, type: "POST", success: function(data) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/memo_request.php?sec=table", success: function(data) { $("#memodata").html(data); } }) } }) return false; } }); $(".searchann").on("keypress", function(e) { if (e.keyCode == 13) { $(".btnsearchallmemo").removeClass('invisible'); msearch = $("#searchmemo").val(); mfrom = $("#memofrom").val(); mto = $("#memoto").val(); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/announcement_request.php?sec=table", data: "searchmemo=" + msearch + "&memofrom=" + mfrom + "&memoto=" + mto, type: "POST", success: function(data) { $("#memodata").html(data); } }) return false; } }); $(".btnsearchann").on("click", function() { $(".btnsearchallmemo").removeClass('invisible'); msearch = $("#searchmemo").val(); mfrom = $("#memofrom").val(); mto = $("#memoto").val(); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/announcement_request.php?sec=table", data: "searchmemo=" + msearch + "&memofrom=" + mfrom + "&memoto=" + mto, type: "POST", success: function(data) { $("#memodata").html(data); } }) return false; }); $(".btnsearchallann").on("click", function() { $(this).addClass('invisible'); $("#searchmemo").val(''); $("#memofrom").val('08/01/2014'); $("#memoto").val('05/03/2024'); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/announcement_request.php?sec=clear_search", type: "POST", success: function(data) { $("#memodata").html(data); } }) return false; }); $(".btnaddann").on("click", function() { $(".aadd_msg").css("display","none"); $("#memo_title").val(""); $("#memo_attach").val(""); $(".floatdiv").removeClass("invisible"); $("#aadd").show({ effect : 'slide', easing : 'easeOutQuart', direction : 'up', duration : 500 }); $("#aedit").hide(); $(".aadd_msg").slideUp(); }); $(".btneditann").on("click", function() { $(".floatdiv").removeClass("invisible"); $("#aadd").hide(); $("#aedit").show({ effect : 'slide', easing : 'easeOutQuart', direction : 'up', duration : 500 }); $(".aedit_msg").slideUp(); memid = $(this).attr('attribute'); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/announcement_request.php?sec=edit", data: "memid=" + memid, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { var obj = $.parseJSON(data); $("#umemo_title").val(obj.memo_title); $("#umemo_attachment").val(obj.memo_attach); $("#umemo_date").val(obj.memo_date); $("#umemo_user").val(obj.memo_user); $("#umemo_attachment").val(obj.memo_attach); $("#umemo_id").val(memid); } }) return false; }); $(".btndelann").on("click", function() { var r = confirm("Are you sure you want to delete this announcement?"); memid = $(this).attr('attribute'); if (r == true) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/announcement_request.php?sec=delete", data: "memid=" + memid, type: "POST", success: function(data) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/announcement_request.php?sec=table", success: function(data) { $("#memodata").html(data); } }) } }) return false; } }); /* DTR */ $("#dtr_year").change(function() { dyear = $("#dtr_year option:selected").val(); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/dtr_request.php?sec=periodsel", data: "year=" + dyear, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#dtr_cover").html(data); } }) $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/dtr_request.php?sec=periodvar", data: "year=" + dyear, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { var obj = $.parseJSON(data); dcover = obj.dcover; dfrom = parseInt(obj.dfrom); dto = parseInt(obj.dto); posted = obj.posted; plus5dto = dto + 432000; curunixdate = Math.floor(Date.now() / 1000); if (posted == 0) { if (curunixdate <= plus5dto) { while(dfrom < (dto + 86400)) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/dtr_request.php?sec=calculate", data: "dateunix=" + dfrom, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) {} }) dfrom = dfrom + 86400; //alert(dfrom); } } $("#txtposted").addClass('invisible'); } else { $("#txtposted").removeClass('invisible'); } $("#dtrdata").html(' Loading...'); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/dtr_request.php?sec=table", data: "cover=" + dcover + "&dfrom=" + dfrom + "&dto=" + dto + "&posted=" + posted, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#dtrdata").html(data); } }) } }); }); $("#dtr_cover").change(function() { dcover = $("#dtr_cover option:selected").val(); dfrom = $("#dtr_cover option:selected").attr("dfrom"); dto = $("#dtr_cover option:selected").attr("dto"); posted = $("#dtr_cover option:selected").attr("posted"); dfrom = parseInt(dfrom); dto = parseInt(dto); plus5dto = dto + 432000; curunixdate = Math.floor(Date.now() / 1000); if (posted == 0) { if (curunixdate <= plus5dto) { while(dfrom < (dto + 86400)) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/dtr_request.php?sec=calculate", data: "dateunix=" + dfrom, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) {} }) dfrom = dfrom + 86400; //alert(dfrom); } } $("#txtposted").addClass('invisible'); } else { $("#txtposted").removeClass('invisible'); } $("#dtrdata").html(' Loading...'); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/dtr_request.php?sec=table", data: "cover=" + dcover + "&dfrom=" + dfrom + "&dto=" + dto + "&posted=" + posted, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#dtrdata").html(data); } }) }); /* USER DTR */ $("#udtr_year").change(function() { empid = $("#udtr_empid").val(); comp = $("#udtr_comp").val(); minothours = $("#udtr_minothours").val(); dyear = $("#udtr_year option:selected").val(); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/udtr_request.php?sec=periodsel", data: "year=" + dyear + "&comp=" + comp, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#udtr_cover").html(data); } }) $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/udtr_request.php?sec=periodvar", data: "year=" + dyear + "&comp=" + comp, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { var obj = $.parseJSON(data); dcover = obj.dcover; dfrom = parseInt(obj.dfrom); dto = parseInt(obj.dto); posted = obj.posted; plus5dto = dto + 432000; curunixdate = Math.floor(Date.now() / 1000); if (posted == 0) { if (curunixdate <= plus5dto) { while(dfrom < dto) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/udtr_request.php?sec=calculate", data: "dateunix=" + dfrom + "&empid=" + empid, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) {} }) dfrom = dfrom + 86400; //alert(dfrom); } } $("#txtposted").addClass('invisible'); } else { $("#txtposted").removeClass('invisible'); } $("#udtrdata").html(' Loading...'); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/udtr_request.php?sec=table", data: "cover=" + dcover + "&dfrom=" + dfrom + "&dto=" + dto + "&posted=" + posted + "&empid=" + empid + "&comp=" + comp + "&minothours=" + minothours, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#udtrdata").html(data); } }) } }); }); $("#udtr_cover").change(function() { empid = $("#udtr_empid").val(); comp = $("#udtr_comp").val(); minothours = $("#udtr_minothours").val(); dcover = $("#udtr_cover option:selected").val(); dfrom = $("#udtr_cover option:selected").attr("dfrom"); dto = $("#udtr_cover option:selected").attr("dto"); posted = $("#udtr_cover option:selected").attr("posted"); dbname = $("#udtr_cover option:selected").attr("dbname"); dfrom = parseInt(dfrom); dto = parseInt(dto); plus5dto = dto + 432000; curunixdate = Math.floor(Date.now() / 1000); if (posted == 0) { if (curunixdate <= plus5dto) { while(dfrom < dto) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/udtr_request.php?sec=calculate", data: "dateunix=" + dfrom + "&empid=" + empid, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) {} }) dfrom = dfrom + 86400; //alert(dfrom); } } $("#txtposted").addClass('invisible'); } else { $("#txtposted").removeClass('invisible'); } $("#udtrdata").html(' Loading...'); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/udtr_request.php?sec=table", data: "cover=" + dcover + "&dfrom=" + dfrom + "&dto=" + dto + "&posted=" + posted + "&empid=" + empid + "&comp=" + comp + "&minothours=" + minothours + "&dbname=" + dbname, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#udtrdata").html(data); } }) }); $(".dtrmentry").on("click", function() { dtrdate = $(this).attr('attribute'); empid = $("#udtr_empid").val(); comp = $("#udtr_comp").val(); dcover = $("#udtr_cover option:selected").val(); dfrom = $("#udtr_cover option:selected").attr("dfrom"); dto = $("#udtr_cover option:selected").attr("dto"); posted = $("#udtr_cover option:selected").attr("posted"); var r = confirm("Are you sure you want to delete this DTR entry as of " + dtrdate + " ?"); if (r == true) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/udtr_request.php?sec=delentry", data: "empid=" + empid + "&dtrdate=" + dtrdate, type: "POST", success: function(data) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/udtr_request.php?sec=table", data: "cover=" + dcover + "&dfrom=" + dfrom + "&dto=" + dto + "&posted=" + posted + "&empid=" + empid + "&comp=" + comp, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#udtrdata").html(data); } }) } }) return false; } }); /* LEAVE BALANCE */ $(".btnlbaldata").on("click", function() { ltype = $(this).attr('attribute'); $("#lbal_title").html(ltype + ' Summary'); $(".floatdiv").removeClass("invisible"); $("#lbview").show({ effect : 'slide', easing : 'easeOutQuart', direction : 'up', duration : 500 }); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/leavebal_request.php?sec=data", data: "type=" + ltype, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#lbal_data").html(data); } }) }); $(".btnlleddata").on("click", function() { ltype = $(this).attr('attribute'); ltype2 = $(this).attr('attribute2'); $("#lbal_title").html(ltype + ' Ledger'); $(".floatdiv").removeClass("invisible"); $("#lbview").show({ effect : 'slide', easing : 'easeOutQuart', direction : 'up', duration : 500 }); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/leavebal_request.php?sec=ledger", data: "type=" + ltype + "&type2=" + ltype2, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#lbal_data").html(data); } }) }); /* PAYSLIP */ $("#payslip_year").change(function() { dyear = $("#payslip_year option:selected").val(); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/payslip_request.php?sec=periodsel", data: "year=" + dyear, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#payslip_cover").html(data); } }) $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/payslip_request.php?sec=perioddata", data: "year=" + dyear, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { var obj = $.parseJSON(data); $("#payperiod").html(obj.periodcover); $("#payto").html(obj.prto); } }) $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/payslip_request.php?sec=periodsel2", data: "year=" + dyear, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/payslip_request.php?sec=table", data: "year=" + dyear + "&cover=" + data.trim(), type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#payslipdata").html(data); } }) } }) }); $("#payslip_cover").change(function() { dyear = $("#payslip_year option:selected").val(); dcover = $("#payslip_cover option:selected").val(); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/payslip_request.php?sec=table", data: "year=" + dyear + "&cover=" + dcover, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#payslipdata").html(data); } }) $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/payslip_request.php?sec=perioddata", data: "year=" + dyear + "&cover=" + dcover, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { var obj = $.parseJSON(data); $("#payperiod").html(obj.periodcover); $("#payto").html(obj.prto); } }) }); /* USER PAYSLIP */ $("#upayslip_year").change(function() { comp = $("#ups_comp").val(); dyear = $("#upayslip_year option:selected").val(); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/upayslip_request.php?sec=periodsel", data: "year=" + dyear + "&comp=" + comp, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#upayslip_cover").html(data); } }) $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/upayslip_request.php?sec=perioddata", data: "year=" + dyear + "&comp=" + comp, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { var obj = $.parseJSON(data); $("#payperiod").html(obj.periodcover); $("#payto").html(obj.prto); } }) }); $("#upayslip_cover").change(function() { empid = $("#ups_empid").val(); comp = $("#ups_comp").val(); dyear = $("#upayslip_year option:selected").val(); dcover = $("#upayslip_cover option:selected").val(); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/upayslip_request.php?sec=table", data: "year=" + dyear + "&cover=" + dcover + "&empid=" + empid, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#upayslipdata").html(data); } }) $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/upayslip_request.php?sec=perioddata", data: "year=" + dyear + "&cover=" + dcover + "&comp=" + comp, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { var obj = $.parseJSON(data); $("#payperiod").html(obj.periodcover); $("#payto").html(obj.prto); } }) }); /* APPLICATION */ // Overtime $("#ot_date").change(function() { odate = $("#ot_date").val(); otype = $("#ot_type").val(); if (odate) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=otparam", data: "odate=" + odate + "&otype=" + otype, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { var obj = $.parseJSON(data); if (obj.noinot == 1) { alert("It is not possible to file an OT without time in on DTR"); } else { if (obj.holirest == 1) { alert("This is not a regular day"); } else if (obj.holirest == 2) { alert("This is not a rest day"); } else if (obj.holirest == 3) { alert("This is not a holiday"); } } $("#invalid").val(obj.holirest); $("#dtrshift").html(obj.otdtr); $("#ot_from").val(obj.otin); $("#ot_to").val(obj.otout); ofrom = obj.otin; oto = obj.otout; $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=getovshift", data: "odate=" + odate + "&otype=" + otype, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#timeshift").html(data); } }) $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=getovhour", data: "odate=" + odate + "&otype=" + otype + "&ofrom=" + ofrom + "&oto=" + oto, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#othours").html(data); $("#txtothours").val(data); } }) } }) } }); $("#ot_type").change(function() { odate = $("#ot_date").val(); otype = $("#ot_type").val(); if (odate) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=otparam", data: "odate=" + odate + "&otype=" + otype, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { var obj = $.parseJSON(data); if (obj.noinot == 1) { alert("It is not possible to file an OT without time in on DTR"); } else { if (obj.holirest == 1) { alert("This is not a regular day"); } else if (obj.holirest == 2) { alert("This is not a rest day"); } else if (obj.holirest == 3) { alert("This is not a holiday"); } } $("#invalid").val(obj.holirest); $("#dtrshift").html(obj.otdtr); $("#ot_from").val(obj.otin); $("#ot_to").val(obj.otout); ofrom = obj.otin; oto = obj.otout; $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=getovshift", data: "odate=" + odate + "&otype=" + otype, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#timeshift").html(data); } }) $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=getovhour", data: "odate=" + odate + "&otype=" + otype + "&ofrom=" + ofrom + "&oto=" + oto, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#othours").html(data); $("#txtothours").val(data); } }) } }) } }); $("#ot_from").change(function() { odate = $("#ot_date").val(); otype = $("#ot_type").val(); ofrom = $("#ot_from").val(); oto = $("#ot_to").val(); if (odate) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=getovhour", data: "odate=" + odate + "&otype=" + otype + "&ofrom=" + ofrom + "&oto=" + oto, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#othours").html(data); $("#txtothours").val(data); } }) } }); $("#ot_to").change(function() { odate = $("#ot_date").val(); otype = $("#ot_type").val(); ofrom = $("#ot_from").val(); oto = $("#ot_to").val(); if (odate) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=getovhour", data: "odate=" + odate + "&otype=" + otype + "&ofrom=" + ofrom + "&oto=" + oto, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#othours").html(data); $("#txtothours").val(data); } }) } }); // Late Undertime $("#lu_date").change(function() { odate = $("#lu_date").val(); otype = $("#lu_type").val(); ooffset = $("#lu_offdate").val(); $("#offset_loading").html(''); $("#offset_noot").html(''); $("#btnluapply").addClass('invisible'); if (odate) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=luparam", data: "odate=" + odate + "&otype=" + otype + "&offset=" + ooffset, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { var obj = $.parseJSON(data); $("#offset_loading").html(''); $("#timeshift").html(obj.lushift); $("#dtrshift").html(obj.ludtr); $("#lutexttype").html(obj.lutext); $("#luhours").html(obj.luhours); $("#txtluhours").val(obj.luhours); $("#ovhours").html(obj.othours); $("#txtovhours").val(obj.othours); if (obj.othours >= obj.luhours || obj.luhours != 0) { $("#btnluapply").removeClass('invisible'); } else { $("#offset_noot").html('* You\'ve no overtime applied'); } } }) } }); $("#lu_type").change(function() { odate = $("#lu_date").val(); otype = $("#lu_type").val(); ooffset = $("#lu_offdate").val(); $("#offset_loading").html(''); $("#offset_noot").html(''); $("#btnluapply").addClass('invisible'); if (odate) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=luparam", data: "odate=" + odate + "&otype=" + otype + "&offset=" + ooffset, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { var obj = $.parseJSON(data); $("#offset_loading").html(''); $("#timeshift").html(obj.lushift); $("#dtrshift").html(obj.ludtr); $("#lutexttype").html(obj.lutext); $("#luhours").html(obj.luhours); $("#txtluhours").val(obj.luhours); $("#ovhours").html(obj.othours); $("#txtovhours").val(obj.othours); if (obj.othours >= obj.luhours || obj.luhours != 0) { $("#btnluapply").removeClass('invisible'); } else { $("#offset_noot").html('* You\'ve no overtime applied'); } } }) } }); $("#lu_offdate").change(function() { odate = $("#lu_date").val(); otype = $("#lu_type").val(); ooffset = $("#lu_offdate").val(); $("#offset_loading").html(''); $("#offset_noot").html(''); $("#btnluapply").addClass('invisible'); if (odate) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=luparam", data: "odate=" + odate + "&otype=" + otype + "&offset=" + ooffset, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { var obj = $.parseJSON(data); $("#offset_loading").html(''); $("#timeshift").html(obj.lushift); $("#dtrshift").html(obj.ludtr); $("#lutexttype").html(obj.lutext); $("#luhours").html(obj.luhours); $("#txtluhours").val(obj.luhours); $("#ovhours").html(obj.othours); $("#txtovhours").val(obj.othours); if (obj.othours >= obj.luhours || obj.luhours != 0) { $("#btnluapply").removeClass('invisible'); } else { $("#offset_noot").html('* You\'ve no overtime applied'); } } }) } }); // Notice of Unavailability $("#leave_type").change(function() { lfrom = $("#leave_from").val(); lto = $("#leave_to").val(); ltype = $("#leave_type").val(); if (ltype) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=getleavebalance", data: "ltype=" + ltype, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#tbalance").val(data); $("#btnleaveapply").addClass("invisible"); $("#leavesched").html(' Loading...'); if (lfrom && lto) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/dtr_request.php?sec=cover_calculate", data: "from=" + lfrom + "&to=" + lto, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) {} }) $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=getleavesched", data: "type=" + ltype + "&from=" + lfrom + "&to=" + lto, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#leavesched").html(data); } }) $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=getleaveapply", data: "type=" + ltype + "&from=" + lfrom + "&to=" + lto, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { if (data == 0) { $("#btnleaveapply").addClass("invisible"); } else { $("#btnleaveapply").removeClass("invisible"); } $("#leavetotal").removeClass("invisible"); $(".total_day").html(data / 8); $(".total_pay").html(data / 8); $("#tdayswop").val(data); $("#tdays").val(data); $("#totaldays").val(data); } }) } } }) } }); $("#leave_from").change(function() { lfrom = $("#leave_from").val(); lto = $("#leave_to").val(); ltype = $("#leave_type").val(); $("#btnleaveapply").addClass("invisible"); $("#leavesched").html(' Loading...'); if (lfrom && lto) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/dtr_request.php?sec=cover_calculate", data: "from=" + lfrom + "&to=" + lto, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) {} }) $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=getleavesched", data: "type=" + ltype + "&from=" + lfrom + "&to=" + lto, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#leavesched").html(data); } }) $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=getleaveapply", data: "type=" + ltype + "&from=" + lfrom + "&to=" + lto, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { if (data == 0) { $("#btnleaveapply").addClass("invisible"); } else { $("#btnleaveapply").removeClass("invisible"); } $("#leavetotal").removeClass("invisible"); $(".total_day").html(data / 8); $(".total_pay").html(data / 8); $("#tdayswop").val(data); $("#tdays").val(data); $("#totaldays").val(data); } }) } }); $("#leave_to").change(function() { lfrom = $("#leave_from").val(); lto = $("#leave_to").val(); ltype = $("#leave_type").val(); $("#btnleaveapply").addClass("invisible"); $("#leavesched").html(' Loading...'); if (lfrom && lto) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/dtr_request.php?sec=cover_calculate", data: "from=" + lfrom + "&to=" + lto, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) {} }) $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=getleavesched", data: "type=" + ltype + "&from=" + lfrom + "&to=" + lto, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#leavesched").html(data); } }) $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=getleaveapply", data: "type=" + ltype + "&from=" + lfrom + "&to=" + lto, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { if (data == 0) { $("#btnleaveapply").addClass("invisible"); } else { $("#btnleaveapply").removeClass("invisible"); } $("#leavetotal").removeClass("invisible"); $(".total_day").html(data / 8); $(".total_pay").html(data / 8); $("#tdayswop").val(data); $("#tdays").val(data); $("#totaldays").val(data); } }) } }); // OBT $("#obt_from").change(function() { ofrom = $("#obt_from").val(); oto = $("#obt_to").val(); $("#btnobapply").addClass("invisible"); if (ofrom && oto) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=gettrueto2", data: "from=" + ofrom + "&to=" + oto, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $('#obt_to').val(data); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=getobtsched", data: "from=" + ofrom + "&to=" + data, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#obtsched").html(data); } }) $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=getobndays", data: "from=" + ofrom + "&to=" + data, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { if (data == 0) { $("#btnobapply").addClass("invisible"); } else { $("#btnobapply").removeClass("invisible"); } $("#ndays").val(data); } }) } }) } }); $("#obt_to").change(function() { ofrom = $("#obt_from").val(); oto = $("#obt_to").val(); $("#btnobapply").addClass("invisible"); if (ofrom && oto) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=gettruefrom2", data: "from=" + ofrom + "&to=" + oto, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $('#obt_from').val(data); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=getobtsched", data: "from=" + data + "&to=" + oto, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#obtsched").html(data); } }) $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=getobndays", data: "from=" + data + "&to=" + oto, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { if (data == 0) { $("#btnobapply").addClass("invisible"); } else { $("#btnobapply").removeClass("invisible"); } $("#ndays").val(data); } }) } }) } }); // MEAL ALLOWANCE $("#ma_from").change(function() { mfrom = $("#ma_from").val(); mto = $("#ma_to").val(); if (mfrom && mto) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=getmealsched", data: "from=" + mfrom + "&to=" + mto, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#mealsched").html(data); } }) } }); $("#ma_to").change(function() { mfrom = $("#ma_from").val(); mto = $("#ma_to").val(); if (mfrom && mto) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=getmealsched", data: "from=" + mfrom + "&to=" + mto, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#mealsched").html(data); } }) } }); // MANUAL DTR $("#mdtr_from").change(function() { mfrom = $("#mdtr_from").val(); mto = $("#mdtr_to").val(); $("#btnmdapply").addClass("invisible"); $("#mandtr").html(' Loading...'); if (mfrom && mto) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=gettrueto", data: "from=" + mfrom, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $('#mdtr_to').datetimepicker('destroy'); $('#mdtr_to').datepicker({ dateFormat: 'yy-mm-dd', minDate: mfrom, maxDate: data }); $('#mdtr_to').val(data); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=getmandtr", data: "from=" + mfrom + "&to=" + data, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#mandtr").html(data); } }) $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=getmdndays", data: "from=" + mfrom + "&to=" + data, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { if (data == 0) { $("#btnmdapply").addClass("invisible"); } else { $("#btnmdapply").removeClass("invisible"); } $("#ndays").val(data); } }) } }) } }); $("#mdtr_to").change(function() { mfrom = $("#mdtr_from").val(); mto = $("#mdtr_to").val(); $("#btnmdapply").addClass("invisible"); $("#mandtr").html(' Loading...'); if (mfrom && mto) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=getmandtr", data: "from=" + mfrom + "&to=" + mto, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#mandtr").html(data); } }) $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=getmdndays", data: "from=" + mfrom + "&to=" + mto, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { if (data == 0) { $("#btnmdapply").addClass("invisible"); } else { $("#btnmdapply").removeClass("invisible"); } $("#ndays").val(data); } }) } }); $(".mdtr_newsched").change(function() { shiftid = $(this).val(); arrayid = $(this).attr('attribute'); dtrin = $("#mdtr_timein" + arrayid).attr('dtr'); dtrout = $("#mdtr_timeout" + arrayid).attr('dtr'); dayin = $("#mdtr_dayin" + arrayid).val(); dayout = $("#mdtr_dayout" + arrayid).val(); //if (shiftid) { $("#mdtr_timein" + arrayid).prop('readonly', false); $("#mdtr_dayout" + arrayid).prop('readonly', false); $("#mdtr_timeout" + arrayid).prop('readonly', false); $("#mdtr_timein" + arrayid).timepicker("option", "disabled", false); $("#mdtr_dayout" + arrayid).datepicker("option", "disabled", false); $("#mdtr_timeout" + arrayid).timepicker("option", "disabled", false); /*} else { $("#mdtr_timein" + arrayid).prop('readonly', true); $("#mdtr_dayout" + arrayid).prop('readonly', true); $("#mdtr_timeout" + arrayid).prop('readonly', true); $("#mdtr_timein" + arrayid).timepicker("option", "disabled", true); $("#mdtr_dayout" + arrayid).datepicker("option", "disabled", true); $("#mdtr_timeout" + arrayid).timepicker("option", "disabled", true); }*/ $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=setmddayout", data: "shiftid=" + shiftid + "&dayin=" + dayin, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#mdtr_dayout" + arrayid).val(data); } }) if ($("#mdtr_absent" + arrayid).is(':checked')) { if (dtrin == 0) { $("#mdtr_timein" + arrayid).val(''); } if (dtrout == 0) { $("#mdtr_timeout" + arrayid).val(''); } $(".mdtr_hours" + arrayid).val('0'); } else { if (dtrin == 0) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=setmdin", data: "shiftid=" + shiftid, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { timein = data; $("#mdtr_timein" + arrayid).val(data); } }) } else { timein = $("#mdtr_timein" + arrayid).val(); } if (dtrout == 0) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=setmdout", data: "shiftid=" + shiftid, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { timeout = data; $("#mdtr_timeout" + arrayid).val(data); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=gethour", data: "dayin=" + dayin + "&timein=" + timein + "&dayout=" + dayout + "&timeout=" + timeout, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $(".mdtr_hours" + arrayid).val(data); } }) } }) } else { timeout = $("#mdtr_timeout" + arrayid).val(); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=gethour", data: "dayin=" + dayin + "&timein=" + timein + "&dayout=" + dayout + "&timeout=" + timeout, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $(".mdtr_hours" + arrayid).val(data); } }) } } }); // CHANGE TIME SCHEDULE $("#cts_date").change(function() { ctsdate = $("#cts_date").val(); if (ctsdate) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=getcts", data: "date=" + ctsdate, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#divcts").html(data); } }) $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=getctsday", data: "date=" + ctsdate, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#ctsday").html(data); } }) } }); // NON PUNCH AUTHORITY $("#npa_date").change(function() { npadate = $("#npa_date").val(); if (npadate) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=getnpa", data: "date=" + npadate, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#divnpa").html(data); } }) $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=getnpabut", data: "date=" + npadate, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { if (data == 1) { $("#btnnpapply").removeClass("invisible"); } else { $("#btnnpapply").addClass("invisible"); } } }) } }); // TIME SCHEDULER $("#tsched_from").change(function() { tfrom = $("#tsched_from").val(); tto = $("#tsched_to").val(); $("#btnscapply").addClass("invisible"); if (tfrom && tto) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=gettrueto2", data: "from=" + tfrom + "&to=" + tto, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $('#tsched_to').val(data); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=gettsched", data: "from=" + tfrom + "&to=" + data, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#divtsched").html(data); } }) $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=gettsndays", data: "from=" + tfrom + "&to=" + data, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { if (data == 0) { $("#btnscapply").addClass("invisible"); } else { $("#btnscapply").removeClass("invisible"); } $("#ndays").val(data); } }) } }) } }); $("#tsched_to").change(function() { tfrom = $("#tsched_from").val(); tto = $("#tsched_to").val(); $("#btnscapply").addClass("invisible"); if (tfrom && tto) { $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=gettruefrom2", data: "from=" + tfrom + "&to=" + tto, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $('#tsched_from').val(data); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=gettsched", data: "from=" + data + "&to=" + tto, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#divtsched").html(data); } }) $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/app_request.php?sec=gettsndays", data: "from=" + data + "&to=" + tto, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { if (data == 0) { $("#btnscapply").addClass("invisible"); } else { $("#btnscapply").removeClass("invisible"); } $("#ndays").val(data); } }) } }) } }); /* EMPLOYEES MANAGEMENT */ $("#btnemp").on("click", function() { searchemp = $("#searchemp").val(); emppage = 1; $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/emp_request.php?sec=table", data: "searchemp=" + searchemp, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#btnempall").removeClass("invisible"); $("#empdata").html(data); changeUrl('', 'https://www.marketingsalesagents.com/userman'); } }) }); $("#btnempall").on("click", function() { emppage = 1; $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/emp_request.php?sec=table", data: "clear_search=1", type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#searchemp").val(""); $("#btnempall").addClass("invisible"); $("#empdata").html(data); changeUrl('', 'https://www.marketingsalesagents.com/userman'); } }) }); $(".btnempdata").on("click", function() { empid = $(this).attr('attribute'); window.location.href = "https://www.marketingsalesagents.com/profile?edit=1&id=" + empid; }); /* APPROVERS MANAGEMENT */ $("#searchappr").on("keypress", function(e) { if (e.keyCode == 13) { searchappr = $("#searchappr").val(); apprpage = 1; $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/approvers_request.php?sec=table", data: "searchappr=" + searchappr, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#btnapprall").removeClass("invisible"); $("#apprdata").html(data); changeUrl('', 'https://www.marketingsalesagents.com/approvers'); } }) } }); $("#btnappr").on("click", function() { searchappr = $("#searchappr").val(); apprpage = 1; $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/approvers_request.php?sec=table", data: "searchappr=" + searchappr, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#btnapprall").removeClass("invisible"); $("#apprdata").html(data); changeUrl('', 'https://www.marketingsalesagents.com/approvers'); } }) }); $("#btnapprall").on("click", function() { apprpage = 1; $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/approvers_request.php?sec=table", data: "clear_search=1", type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#searchappr").val(""); $("#btnapprall").addClass("invisible"); $("#apprdata").html(data); changeUrl('', 'https://www.marketingsalesagents.com/approvers'); } }) }); $(".btnapprdata").on("click", function() { empid = $(this).attr('attribute'); dbnames = $(this).attr('attribute2'); $(".btnapprovers").addClass('invisible'); $('.appr_msg').slideUp(); $("#appr_data").html(' Loading...'); $("#appr_title").html('Approver Management for Employee ID #' + empid); $(".floatdiv").removeClass("invisible"); $(".fedit2").show({ effect : 'slide', easing : 'easeOutQuart', direction : 'up', duration : 500 }); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/approvers_request.php?sec=data", data: "empid=" + empid + "&dbn=" + dbnames, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { $("#appr_data").html(data); $.ajax( { url: "https://www.marketingsalesagents.com/lib/requests/approvers_request.php?sec=chkdata", data: "empid=" + empid, type: "POST", complete: function(){ $("#loading").hide(); }, success: function(data) { if (data != 0) { $("#appcount").val(data); } else { $("#appcount").val(6); } $("#appempid").val(empid); $("#appdbname").val(dbnames); $("#txtdbname").html(dbnames); $(".btnapprovers").removeClass('invisible'); } }) } }) }); $("#btnapprovers").on("click", function() { var appr_msg; if (!$('.appr_msg').length) { $('#appr_title').after('