// JavaScript Document $(function () { /* ACTIVITY */ $('#freg form').iframePostForm ({ json : true, post : function () { var freg_msg; if (!$('.freg_msg').length) { $('#freg_title').after('
'); } $('.freg_msg') .html(' Processing registration…') .css({ color : '#006100', background : '#c6efce', border : '2px solid #006100', height : 'auto' }) .slideDown(); }, complete : function (response) { var style, width, html = ''; if (!response.success) { $('.freg_msg').slideUp(function () { $(this) .html('There was a problem with the database') .css({ color : '#9c0006', background : '#ffc7ce', borderColor : '#9c0006', height : 'auto' }) .slideDown(); }); } else { html += 'Your registration has been successfully submitted.
'; $('.freg_msg').slideUp(function () { $(this) .html(html) .css({ color : '#006100', background : '#c6efce', borderColor : '#006100', height : 'auto' }) .slideDown(); }); $.ajax( { url: "https://portal.megaworldcorp.com/offreg/lib/requests/act_request.php?sec=table", success: function(data) { $("#activity_table").html(data); } }); } } }); $('#fadd form').iframePostForm ({ json : true, post : function () { var fadd_msg; if (!$('.fadd_msg').length) { $('#fadd_title').after(''); } if ($('#cactivity_image').val().length) { if ($('#cactivity_title').val().length && $('#cactivity_date').val().length && $('#cactivity_timein').val().length && $('#cactivity_timeout').val().length && $('#cactivity_slots').val().length) { $('.fadd_msg') .html(' Creating activity…') .css({ color : '#006100', background : '#c6efce', border : '2px solid #006100', height : 'auto' }) .slideDown(); } else { $('.fadd_msg') .html('Some fields are required.') .css({ color : '#9c0006', background : '#ffc7ce', border : '2px solid #9c0006', height : 'auto' }) .slideDown() .effect('shake', {times: 3, distance: 5}, 420); return false; } } else { $('.fadd_msg') .html('Please select an image for uploading.') .css({ color : '#9c0006', background : '#ffc7ce', border : '2px solid #9c0006', height : 'auto' }) .slideDown(); return false; } }, complete : function (response) { var style, width, html = ''; if (!response.success) { $('.fadd_msg').slideUp(function () { $(this) .html('There was a problem with the image you uploaded') .css({ color : '#9c0006', background : '#ffc7ce', borderColor : '#9c0006', height : 'auto' }) .slideDown(); }); } else { html += 'Activity has been successfully created.
'; $('.fadd_msg').slideUp(function () { $(this) .html(html) .css({ color : '#006100', background : '#c6efce', borderColor : '#006100', height : 'auto' }) .slideDown(); }); $.ajax( { url: "https://portal.megaworldcorp.com/offreg/lib/requests/act_request.php?sec=table", success: function(data) { $("#activity_table").html(data); } }); } } }); $('#fedit form').iframePostForm ({ json : true, post : function () { var fedit_msg; if (!$('.fedit_msg').length) { $('#fedit_title').after(''); } if ($('#uactivity_title').val().length && $('#uactivity_date').val().length && $('#uactivity_timein').val().length && $('#uactivity_timeout').val().length && $('#uactivity_slots').val().length) { $('.fedit_msg') .html(' Updating activity…') .css({ color : '#006100', background : '#c6efce', border : '2px solid #006100', height : 'auto' }) .slideDown(); } else { $('.fedit_msg') .html('Some fields are required.') .css({ color : '#9c0006', background : '#ffc7ce', border : '2px solid #9c0006', height : 'auto' }) .slideDown() .effect('shake', {times: 3, distance: 5}, 420); return false; } }, complete : function (response) { var style, width, html = ''; if (!response.success) { $('.fedit_msg').slideUp(function () { $(this) .html('There was a problem with the image you uploaded') .css({ color : '#9c0006', background : '#ffc7ce', borderColor : '#9c0006', height : 'auto' }) .slideDown(); }); } else { html += 'Activity has been successfully updated.
'; $('.fedit_msg').slideUp(function () { $(this) .html(html) .css({ color : '#006100', background : '#c6efce', borderColor : '#006100', height : 'auto' }) .slideDown(); }); $.ajax( { url: "https://portal.megaworldcorp.com/offreg/lib/requests/act_request.php?sec=table", success: function(data) { $("#activity_table").html(data); } }); } } }); /* REGISTRATION */ $('#regis form').iframePostForm ({ json : true, post : function () { var regis_msg; if (!$('.regis_msg').length) { $('#lasttable').after(''); } if ($('#binFile').val().length) { var x = new Array('empnum', 'position', 'lastname', 'firstname', 'middlename', 'nickname', 'address_num', 'address_street', 'address_brgy', 'address_city', 'address_region', 'address_zip', 'address_country', 'provincial_address', 'contact', 'email', 'birthplace', 'sss', 'tin', 'philhealth', 'pagibig', 'father_name', 'father_comp', 'mother_name', 'mother_comp', 'schoolname[0]', 'schoolname[1]', 'skill[0]', 'comp_supervisor[0]', 'department', 'local', 'corp_email', 'emergency_name', 'emergency_address', 'emergency_telno'); for (var i = 0; i < x.length; i += 1) { l = document.forms['formreg'][x[i]]; if (l.value == null || l.value == '' || l.value == 0) { $('.regis_msg') .html('Some fields are required.' + x[i]) .css({ 'color' : '#9c0006', 'background' : '#ffc7ce', 'border' : '2px solid #9c0006', 'margin-top' : '10px', 'height' : 'auto' }) .slideDown() .effect('shake', {times: 3, distance: 5}, 420); return false; } else { $('.regis_msg') .html(' Registering your profile…') .css({ 'color' : '#006100', 'background' : '#c6efce', 'border' : '2px solid #006100', 'margin-top' : '10px', 'height' : 'auto' }) .slideDown(); } } } else { $('.regis_msg') .html('Please select an image for uploading.') .css({ 'color' : '#9c0006', 'background' : '#ffc7ce', 'border' : '2px solid #9c0006', 'margin-top' : '10px', 'height' : 'auto' }) .slideDown(); return false; } }, complete : function (response) { var style, width, html = ''; if (!response.success) { $('.regis_msg').slideUp(function () { $(this) .html(response.error) .css({ 'color' : '#9c0006', 'background' : '#ffc7ce', 'borderColor' : '#9c0006', 'margin-top' : '10px', 'height' : 'auto' }) .slideDown(); }); } else { html += 'Your profile has been successfully registered and subject for approval.
'; $('.regis_msg').slideUp(function () { $(this) .html(html) .css({ 'color' : '#006100', 'background' : '#c6efce', 'borderColor' : '#006100', 'margin-top' : '10px', 'height' : 'auto' }) .slideDown(); }); $.ajax( { url: "https://portal.megaworldcorp.com/offreg/lib/requests/act_request.php?sec=table", success: function(data) { $("#activity_table").html(data); } }); } } }); /* PROFILE */ $('#uprofile form').iframePostForm ({ json : true, post : function () { var uprofile_msg; if (!$('.uprofile_msg').length) { $('#lasttable').after(''); } var x = new Array('position', 'lastname', 'firstname', 'middlename', 'nickname', 'address_num', 'address_street', 'address_brgy', 'address_city', 'address_region', 'address_zip', 'address_country', 'provincial_address', 'contact', 'email', 'birthplace', 'sss', 'tin', 'philhealth', 'pagibig', 'father_name', 'father_comp', 'mother_name', 'mother_comp', 'schoolname[0]', 'schoolname[1]', 'skill[0]', 'comp_supervisor[0]', 'department', 'local', 'corp_email', 'emergency_name', 'emergency_address', 'emergency_telno'); for (var i = 0; i < x.length; i += 1) { l = document.forms['formpro'][x[i]]; if (l.value == null || l.value == '' || l.value == 0) { $('.uprofile_msg') .html('Some fields are required.') .css({ 'color' : '#9c0006', 'background' : '#ffc7ce', 'border' : '2px solid #9c0006', 'margin-top' : '10px', 'height' : 'auto' }) .slideDown() .effect('shake', {times: 3, distance: 5}, 420); return false; } else { $('.uprofile_msg') .html(' Updating your profile…') .css({ 'color' : '#006100', 'background' : '#c6efce', 'border' : '2px solid #006100', 'margin-top' : '10px', 'height' : 'auto' }) .slideDown(); } } }, complete : function (response) { var style, width, html = ''; if (!response.success) { $('.uprofile_msg').slideUp(function () { $(this) .html(response.error) .css({ 'color' : '#9c0006', 'background' : '#ffc7ce', 'borderColor' : '#9c0006', 'margin-top' : '10px', 'height' : 'auto' }) .slideDown(); }); } else { html += 'Your profile has been successfully updated.
'; $('.uprofile_msg').slideUp(function () { $(this) .html(html) .css({ 'color' : '#006100', 'background' : '#c6efce', 'borderColor' : '#006100', 'margin-top' : '10px', 'height' : 'auto' }) .slideDown(); }); $.ajax( { url: "https://portal.megaworldcorp.com/offreg/lib/requests/act_request.php?sec=table", success: function(data) { $("#activity_table").html(data); } }); } } }); /* FORGOT PASSWORD */ $('#forgot form').iframePostForm ({ json : true, post : function () { var forgot_msg; if (!$('.forgot_msg').length) { $('#forgot_title').after(''); } if ($('#empidnum').val().length) { $('.forgot_msg') .html(' Processing…') .css({ color : '#006100', background : '#c6efce', border : '2px solid #006100', height : 'auto' }) .slideDown(); } else { $('.forgot_msg') .html('Employee ID is required.') .css({ color : '#9c0006', background : '#ffc7ce', border : '2px solid #9c0006', height : 'auto' }) .slideDown() .effect('shake', {times: 3, distance: 5}, 420); return false; } }, complete : function (response) { var style, width, html = ''; if (!response.success) { $('.forgot_msg').slideUp(function () { $(this) .html(response.error) .css({ 'color' : '#9c0006', 'background' : '#ffc7ce', 'borderColor' : '#9c0006', 'margin-top' : '10px', 'height' : 'auto' }) .slideDown(); }); } else { html += 'Your password has been successfully reset and sent you your email.
'; $('.forgot_msg').slideUp(function () { $(this) .html(html) .css({ 'color' : '#006100', 'background' : '#c6efce', 'borderColor' : '#006100', 'margin-top' : '10px', 'height' : 'auto' }) .slideDown(); }); } } }); /* CHANGE PASSWORD */ $('#fpass form').iframePostForm ({ json : true, post : function () { var fpass_msg; if (!$('.fpass_msg').length) { $('#fpass_title').after(''); } if ($('#opassword').val().length && $('#npassword').val().length && $('#cpassword').val().length) { $('.fpass_msg') .html(' Processing…') .css({ color : '#006100', background : '#c6efce', border : '2px solid #006100', height : 'auto' }) .slideDown(); } else { $('.fpass_msg') .html('All fields are required.') .css({ color : '#9c0006', background : '#ffc7ce', border : '2px solid #9c0006', height : 'auto' }) .slideDown() .effect('shake', {times: 3, distance: 5}, 420); return false; } }, complete : function (response) { var style, width, html = ''; if (!response.success) { $('.fpass_msg').slideUp(function () { $(this) .html(response.error) .css({ 'color' : '#9c0006', 'background' : '#ffc7ce', 'borderColor' : '#9c0006', 'margin-top' : '10px', 'height' : 'auto' }) .slideDown(); }); } else { html += 'Your password has been successfully changed.
'; $('.fpass_msg').slideUp(function () { $(this) .html(html) .css({ 'color' : '#006100', 'background' : '#c6efce', 'borderColor' : '#006100', 'margin-top' : '10px', 'height' : 'auto' }) .slideDown(); }); } } }); });