// JavaScript Document
// ************** Make the URL **********************
function getRedirectUrlJs(cont,page,param)
{
//getRedirectUrlJs('MAIN_CONSOLE_ROOT','index','id@2@@name@chanchal');
if (param === undefined) { param = ''; }
var result = "";
var dataArr = '&cont='+cont+'&page='+page+'¶m='+param;
$.ajax({
type : "GET",
global: false,
url : main_console_root+"ajax/pageQuerySave.php?mod=GetUrlPath"+dataArr,
async : false,
success:function(msg) { result = msg; }
});
return result;
}
// ************** Display Alret Msg ***************
function getDisplayAlertMsg(displayMsg)
{
//console.log(displayMsg);
var dataArr = displayMsg.split('@@@@');
var msg_color = dataArr[0];
var msg_content = dataArr[1];
console.log(msg_color);
$(function()
{
if(1!=1)
{
var Toast = Swal.mixin(
{
toast: true,
position: 'top-end',
showConfirmButton: false,
timer: 3000
});
Toast.fire(
{
icon: msg_color,
title: msg_content
});
}
if(2==2)
{
if(msg_color == 'danger') { toastr.error(msg_content); }
else if(msg_color == 'warning') { toastr.warning(msg_content); }
else
{
toastr.success(msg_content);
}
}
});
}
// Display the Browse Images
function displayBrowseImage(fieldName,divBrowseId)
{
if(divBrowseId === undefined) { divBrowseId = 'browseImages'; }
var input = document.getElementById(fieldName);
var dvPreview = $("#"+divBrowseId);
dvPreview.html("");
// Constant Define In constantJavascriptDefine File
var regex = new RegExp(IMAGE_REGEX);
for (var i=0; i");
img.attr("style", "height:100px;width: 100px;padding: 5px;");
img.attr("src", e.target.result);
dvPreview.append(img);
}
reader.readAsDataURL(input.files[i]);
}
else
{
var alertMSG = "warning@@@@"+name + " is not a valid image file.";
getDisplayAlertMsg(alertMSG);
dvPreview.html("");
}
}
}
// Display the Browse Images
function displayBrowseXlsImage(fieldName,divBrowseId)
{
if(divBrowseId === undefined) { divBrowseId = 'browseImages'; }
var input = document.getElementById(fieldName);
var dvPreview = $("#"+divBrowseId);
dvPreview.html("");
// Constant Define In constantJavascriptDefine File
var regex = new RegExp(IMAGE_REGEX);
for (var i=0; i");
img.attr("style", "height:100px;width: 100px;padding: 5px;");
img.attr("src", e.target.result);
dvPreview.append(img);
}
reader.readAsDataURL(input.files[i]);
}
else
{
var alertMSG = "warning@@@@"+name + " is not a valid image file.";
getDisplayAlertMsg(alertMSG);
dvPreview.html("");
}
}
}
function permissionDeniedMsg()
{
var alertMSG = "warning@@@@Permission Denied";
getDisplayAlertMsg(alertMSG);
}
// ************** Remove Page Query ***************
function removePageQuery(pageName)
{
if(pageName !='')
{
$.ajax({
type : "GET",
url : main_console_root+"ajax/pageQuerySave.php?mod=RemoveQuery&page="+pageName,
async : false,
success:function(msg) { }
});
}
}
// Displaye Large Image
function viewLargeImage(title,imagePath)
{
var message = '';
message += "";
message += '
';
message += '

';
message += '
';
eModal.alert(message, title);
}
// ********************** Export File **********************
// Get the Product List For Discount tag
function getDownloadReport(report_name)
{
if(report_name === undefined) { report_name = ''; }
if(report_name !='')
{
var redirectPath = main_console_root+"module/transaction/download_file.php?report_name="+report_name
window.setTimeout(function(){ window.location = redirectPath;});
}
}
// Enable/ Active the Records // 1 For Enable/ Active Records
function enableRecords(mod_action)
{
var listArr = new Array();
var i=0;
$.each($("input[name='chk']:checked"), function()
{
listArr[i] = $(this).val();
i++;
});
if(listArr.length >0 )
{
$.ajax({
type : "GET",
url : main_console_root+"ajax/disable_records.php?status=1&mod="+mod_action+'&listArr='+listArr,
async : false,
success:function(result)
{
if(result > 0)
{
var alertMSG = "success@@@@Record Enable Successfully";
getDisplayAlertMsg(alertMSG);
}
else
{
var alertMSG = "warning@@@@"+result;
getDisplayAlertMsg(alertMSG);
}
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
else
{
var alertMSG = "warning@@@@"+"Please Select the Checkbox";
getDisplayAlertMsg(alertMSG);
}
}
// Disable/ Deactive the Records // 0 For Disable/ Deactive Records
function disableRecords(mod_action)
{
var listArr = new Array();
var i=0;
$.each($("input[name='chk']:checked"), function()
{
listArr[i] = $(this).val();
i++;
});
if(listArr.length >0 )
{
var confirmMSG = 'Are you confirm to Disable';
if(mod_action == 'ProductMaster')
{
confirmMSG = 'Are you confirm to disable, Business Product Also disable';
}
return eModal.confirm(confirmMSG, ' '+PROJECT_SITE_NAME+' Message')
.then(function ()
{
$.ajax({
type : "GET",
url : main_console_root+"ajax/disable_records.php?status=0&mod="+mod_action+'&listArr='+listArr,
async : false,
success:function(result)
{
if(result > 0)
{
var alertMSG = "success@@@@Record Disable Successfully";
getDisplayAlertMsg(alertMSG);
}
else
{
var alertMSG = "warning@@@@"+result;
getDisplayAlertMsg(alertMSG);
}
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
});
}
else
{
var alertMSG = "warning@@@@"+"Please Select the Checkbox";
getDisplayAlertMsg(alertMSG);
}
}
function getDisableReasonBoxModal(mod_action)
{
var listArr = new Array();
var i=0;
$.each($("input[name='chk']:checked"), function()
{
var id = $(this).val();
listArr[i] = id;
i++;
});
if(listArr.length >0 )
{
var options = {
url: main_console_root+"modal/approval_deny_modal.php?modeType=denyReasonBox&mod_action="+mod_action+'&disableIdList='+listArr,
title :'Disable Reason',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true },
{text: 'Save', style: 'primary ', close: true, click: validateDisableReasonBox }
],
};
return eModal.ajax(options);
}
else
{
var alertMSG = "warning@@@@"+"Please Select the Checkbox";
getDisplayAlertMsg(alertMSG);
}
}
function validateDisableReasonBox()
{
var counter = 1;
var mod_action = $("#denyReasonBoxForm #mod_action").val();
var denyIdList = $("#denyReasonBoxForm #denyIdList").val();
var denyComment = $("#denyReasonBoxForm #denyComment").val();
if(denyComment == "") { $("#denyReasonBoxForm #denyComment_EBox").html('Please Enter Comment'); counter = 0; }
else if(parseInt(denyComment.length) < 20)
{
$("#denyReasonBoxForm #denyComment_EBox").html('Please Enter Comment Greater Than 20 Characters'); counter = 0;
}
if(counter == 0) { return false; }
else
{
var dataArr = '&mod='+mod_action+'&denyComment='+denyComment+'&listArr='+disableIdList
$.ajax({
type : "GET",
url : main_console_root+"ajax/disable_records.php?status=0"+dataArr,
async : false,
success:function(result)
{
if(result > 0)
{
var alertMSG = "success@@@@Record Disable Successfully";
getDisplayAlertMsg(alertMSG);
}
else
{
var alertMSG = "warning@@@@"+result;
getDisplayAlertMsg(alertMSG);
}
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
}
// Delete the Records
function deleteRecords(mod_action)
{
var listArr = new Array();
var i=0;
$.each($("input[name='chk']:checked"), function()
{
listArr[i] = $(this).val();
i++;
});
if(listArr.length >0 )
{
var confirmMSG = 'Are you confirm to delete';
return eModal.confirm(confirmMSG, ' '+PROJECT_SITE_NAME+' Message')
.then(function ()
{
console.log(main_console_root+"ajax/delete_records.php?mod="+mod_action+'&listArr='+listArr);
$.ajax({
type : "GET",
url : main_console_root+"ajax/delete_records.php?mod="+mod_action+'&listArr='+listArr,
async : false,
success:function(result)
{
if(result > 0)
{
var alertMSG = "success@@@@Record Delete Successfully";
getDisplayAlertMsg(alertMSG);
}
else
{
var alertMSG = "danger@@@@"+result;
getDisplayAlertMsg(alertMSG);
}
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
});
}
else
{
var alertMSG = "warning@@@@"+"Please Select the Checkbox";
getDisplayAlertMsg(alertMSG);
}
}
//Get the Active State List of Country
function getActiveStateList(country_id)
{
console.log(main_console_root+"ajax/getDropDownOption.php?mod=stateList&id="+country_id);
$.ajax({
type: "GET",
url : main_console_root+"ajax/getDropDownOption.php?mod=stateList&id="+country_id,
async : false,
success : function(response)
{
$('#statediv').html(response);
}
});
if($("#citydiv").length>0)
{
var state_id = '';
getActiveCityList(state_id);
}
}
//Get the Active City List of State
function getActiveCityList(state_id)
{
console.log(main_console_root+"ajax/getDropDownOption.php?mod=cityList&id="+state_id);
$.ajax({
type: "GET",
url : main_console_root+"ajax/getDropDownOption.php?mod=cityList&id="+state_id,
async : false,
success : function(response)
{
$('#citydiv').html(response);
}
});
}
// Check Mobile Format
function checkMobileFormat(mobile)
{
var msg = true;
var mobileRegex = /^[0-9]+$/;
if(!mobileRegex.test(mobile)) { msg = "Please enter a valid Mobile Number"; }
else if(isNaN(mobile)) { msg = "Please enter only digits. ";}
else if(CONST_MOBILE_LENGTH !=0 && mobile.length != CONST_MOBILE_LENGTH){ msg = "Mobile must have 10 digits "; }
return msg;
}
// Check Email Format
function checkEmailFormat(email)
{
var msg = true;
var emailRegex = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/;
if(!emailRegex.test(email)) { msg = "Please enter a valid Email-ID"; }
return msg;
}
function checkPasswordFormat(password)
{
var msg = true;
var digitRegex = /^(?=.*\d)/;
var lowercaseRegex = /^(?=.*[a-z])/;
var specialcaseRegex = /^(?=.*[!@#$%^&*])/;
if(password == '') { msg = "Please enter a valid Mobile Number"; }
else if(password.length < '7' ) { msg = 'Password length must be 7 characters'; }
else if(!digitRegex.test(password)) { msg = 'Password must contain at least one digit';}
else if(!lowercaseRegex.test(password)) { msg = 'Password must contain at least one lowercase letter';}
else if(!specialcaseRegex.test(password)) { msg = 'Password must contain at least one Special character';}
return msg;
}
// User Details Modal
function viewDeviceListModal(staff_id)
{
var options = {
url: main_console_root+"modal/admin_detail_modal.php?modeType=attendanceDevice&staff_id="+staff_id,
title :'Attendance Device',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true },
{text: 'Update', style: 'success ', close: true,click: validateStaffTagDevice }
],
};
return eModal.ajax(options);
}
function validateStaffTagDevice()
{
var deviceId = new Array();
var i=0;
var staff_id = $("#tagDeviceForm #staff_id").val();
$.each($("input[name='deviceId']:checked",'#tagDeviceForm'), function()
{
deviceId[i] = $(this).val();
i++;
});
if(deviceId.length >0 )
{
var dataArr = '&staff_id='+staff_id+'&deviceId='+deviceId;
console.log(main_console_root+"ajax/staff_detail.php?mod=staffSyncFaceDevice"+dataArr);
$.ajax({
type: "GET",
url : main_console_root+"ajax/staff_detail.php?mod=staffSyncFaceDevice"+dataArr,
async : false,
success : function(result)
{
var resultArr = result.split('@@@@');
if(resultArr[0] ==1)
{
var alertMSG = "success@@@@"+resultArr[1];
getDisplayAlertMsg(alertMSG);
}
else
{
var alertMSG = "warning@@@@"+resultArr[1];
getDisplayAlertMsg(alertMSG);
}
}
});
}
}
function intranetAttendanceReport(device_id)
{
var dataArr = '&device_id='+device_id;
console.log(main_console_root+"ajax/staff_detail.php?mod=IntranetDeviceAttendance"+dataArr);
$.ajax({
type: "GET",
url : main_console_root+"ajax/staff_detail.php?mod=IntranetDeviceAttendance"+dataArr,
async : false,
success : function(result)
{
var alertMSG = "success@@@@Record Sync Successfuly";
getDisplayAlertMsg(alertMSG);
}
});
}
function viewGoogleMapLocation(latitude,longitude)
{
var options = {
url: main_console_root+"modal/admin_detail_modal.php?modeType=locationMapView&latitude="+latitude+'&longitude='+longitude,
title :'Location Map View' ,
size: eModal.size.lgs,
buttons: [{text: 'Close', style: 'default ', close: true }],
};
return eModal.ajax(options);
}
function getDownloadAttenaceReport(staff_id,report_name)
{
if(report_name === undefined) { report_name = ''; }
if(report_name !='')
{
var redirectPath = main_console_root+"ajax/download_file.php?report_name="+report_name+'&staff_id='+staff_id
window.setTimeout(function(){ window.location = redirectPath;});
}
}//*************************** SMS / Email Function ***************************
function emailHeaderActive(header_id)
{
if(header_id !='')
{
$.ajax({
type: "GET",
url : main_console_root+"ajax/comm_template.php?mod=EmailHeaderActive&header_id="+header_id,
async : false,
success : function(result)
{
var resultArr = result.split('@@@@');
if(resultArr[0] > 0)
{
var alertMSG = "success@@@@"+resultArr[1];
getDisplayAlertMsg(alertMSG);
}
else
{
var alertMSG = "warning@@@@"+resultArr[1];
getDisplayAlertMsg(alertMSG);
}
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
}
// Get the Parameter New Row for the Tempalte
function getParameterNewRow(paramCount)
{
if(isNaN(paramCount)){ paramCount = '0'; }
var paramGroupArr = document.getElementsByName("paramGroupArr[]");
var paramNameArr = document.getElementsByName("paramNameArr[]");
var paramArr = new Array();
for(var i= 0; i< paramGroupArr.length; i++)
{
var j = i+1;
var pGroup = $("#paramGroup_"+j).val();
var pName = $("#paramName_"+j).val();
paramArr[i] = pGroup+'@@@@'+pName;
}
var dataArr = '¶mCount='+paramCount+'¶mArr='+paramArr;
$.ajax({
type: "GET",
url : main_console_root+"ajax/comm_template.php?mod=parameterDivContent"+dataArr,
async : false,
success : function(response){
$('#parameterDivContent').html(response);
}
});
}
function getParamenterList(groupName,divPlaceStoreId)
{
console.log(main_console_root+"ajax/comm_template.php?mod=ParameterDropDownList&groupName="+groupName);
$.ajax({
type: "GET",
url : main_console_root+"ajax/comm_template.php?mod=ParameterDropDownList&groupName="+groupName,
async : false,
success : function(response)
{
$('#'+divPlaceStoreId).html(response);
}
});
}
function copyTemplateParameter(paramNameId)
{
var param_name = $("#"+paramNameId).val();
var $temp = $("");
$("body").append($temp);
$temp.val(param_name).select();
document.execCommand("Copy");
$temp.remove();
}
function viewEmailTemplateDetail(template_id)
{
var options = {
url: main_console_root+"modal/comm_template_modal.php?modeType=EmailTemplateView&template_id="+template_id,
title :'Email Template Details',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true }
],
};
return eModal.ajax(options);
}
function viewSMSTemplateDetail(template_id)
{
var options = {
url: main_console_root+"modal/comm_template_modal.php?modeType=SMSTemplateView&template_id="+template_id,
title :'SMS Template Details',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true }
],
};
return eModal.ajax(options);
}
function viewNotificationTemplateDetail(template_id)
{
var options = {
url: main_console_root+"modal/comm_template_modal.php?modeType=NotificationTemplateView&template_id="+template_id,
title :'Notification Template Details',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true }
],
};
return eModal.ajax(options);
}
function viewWhatsappTemplateDetail(template_id)
{
var options = {
url: main_console_root+"modal/comm_template_modal.php?modeType=WhatsappTemplateView&template_id="+template_id,
title :'Notification Template Details',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true }
],
};
return eModal.ajax(options);
}
function emailFooterActive(footer_id)
{
if(footer_id !='')
{
$.ajax({
type: "GET",
url : main_console_root+"ajax/comm_template.php?mod=EmailFooterActive&footer_id="+footer_id,
async : false,
success : function(result)
{
var resultArr = result.split('@@@@');
if(resultArr[0] > 0)
{
var alertMSG = "success@@@@"+resultArr[1];
getDisplayAlertMsg(alertMSG);
}
else
{
var alertMSG = "warning@@@@"+resultArr[1];
getDisplayAlertMsg(alertMSG);
}
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
}
function viewEmailFooterContent(footer_id)
{
var options = {
url: main_console_root+"modal/comm_template_modal.php?modeType=EmailFooterContent&id="+footer_id,
title :'Email Footer Content',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true }
],
};
return eModal.ajax(options);
}
function smsFooterActive(footer_id)
{
if(footer_id !='')
{
$.ajax({
type: "GET",
url : main_console_root+"ajax/comm_template.php?mod=SmsFooterActive&footer_id="+footer_id,
async : false,
success : function(result)
{
var resultArr = result.split('@@@@');
if(resultArr[0] > 0)
{
var alertMSG = "success@@@@"+resultArr[1];
getDisplayAlertMsg(alertMSG);
}
else
{
var alertMSG = "warning@@@@"+resultArr[1];
getDisplayAlertMsg(alertMSG);
}
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
}
function viewEventTagDetail(event_key)
{
var options = {
url: main_console_root+"modal/comm_template_modal.php?modeType=EventDetail&event_key="+event_key,
title :'Event Details',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true }
],
};
return eModal.ajax(options);
}
function viewNotifyImageFolder()
{
var options = {
url: main_console_root+"modal/comm_template_modal.php?modeType=viewNotifyImageFolder",
title :'Notification Image',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true }
],
};
return eModal.ajax(options);
}
function getNotifyImageName(imageName)
{
if(imageName !='')
{
var dvPreview = $("#browseImages");
dvPreview.html("");
eModal.close();
$("#selNotifyImage").val(imageName);
// Notificaiton Image Full Path
var fullPath = main_root_image+'data/notification/'+imageName
var img = $("
");
img.attr("style", "height:100px;width: 100px;padding: 5px;");
img.attr("src", fullPath);
dvPreview.append(img);
}
}
function notificationRemove(template_id)
{
if(template_id !='')
{
$.ajax({
type: "GET",
url : main_console_root+"ajax/comm_template.php?mod=RemoveNotifyImage&template_id="+template_id,
async : false,
success : function(result)
{
var alertMSG = "success@@@@Notificaiton Image Remove Successfully";
getDisplayAlertMsg(alertMSG);
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
}
// JavaScript Document
// ************** Make the URL **********************
function getRedirectUrlJs(cont,page,param)
{
//getRedirectUrlJs('MAIN_COMPANY_ROOT','index','id@2@@name@chanchal');
if (param === undefined) { param = ''; }
var result = "";
var dataArr = '&cont='+cont+'&page='+page+'¶m='+param;
$.ajax({
type : "GET",
global: false,
url : main_company_root+"ajax/pageQuerySave.php?mod=GetUrlPath"+dataArr,
async : false,
success:function(msg) { result = msg; }
});
return result;
}
// ************** Display Alret Msg ***************
function getDisplayAlertMsg(displayMsg)
{
//console.log(displayMsg);
var dataArr = displayMsg.split('@@@@');
var msg_color = dataArr[0];
var msg_content = dataArr[1];
console.log(msg_color);
$(function()
{
if(1!=1)
{
var Toast = Swal.mixin(
{
toast: true,
position: 'top-end',
showConfirmButton: false,
timer: 3000
});
Toast.fire(
{
icon: msg_color,
title: msg_content
});
}
if(2==2)
{
if(msg_color == 'danger') { toastr.error(msg_content); }
else if(msg_color == 'warning') { toastr.warning(msg_content); }
else
{
toastr.success(msg_content);
}
}
});
}
// Display the Browse Images
function displayBrowseImage(fieldName,divBrowseId)
{
if(divBrowseId === undefined) { divBrowseId = 'browseImages'; }
var input = document.getElementById(fieldName);
var dvPreview = $("#"+divBrowseId);
dvPreview.html("");
// Constant Define In constantJavascriptDefine File
var regex = new RegExp(IMAGE_REGEX);
for (var i=0; i");
img.attr("style", "height:100px;width: 100px;padding: 5px;");
img.attr("src", e.target.result);
dvPreview.append(img);
}
reader.readAsDataURL(input.files[i]);
}
else
{
var alertMSG = "warning@@@@"+name + " is not a valid image file.";
getDisplayAlertMsg(alertMSG);
dvPreview.html("");
}
}
}
// Display the Browse Images
function displayBrowseXlsImage(fieldName,divBrowseId)
{
if(divBrowseId === undefined) { divBrowseId = 'browseImages'; }
var input = document.getElementById(fieldName);
var dvPreview = $("#"+divBrowseId);
dvPreview.html("");
// Constant Define In constantJavascriptDefine File
var regex = new RegExp(IMAGE_REGEX);
for (var i=0; i");
img.attr("style", "height:100px;width: 100px;padding: 5px;");
img.attr("src", e.target.result);
dvPreview.append(img);
}
reader.readAsDataURL(input.files[i]);
}
else
{
var alertMSG = "warning@@@@"+name + " is not a valid image file.";
getDisplayAlertMsg(alertMSG);
dvPreview.html("");
}
}
}
function permissionDeniedMsg()
{
var alertMSG = "warning@@@@Permission Denied";
getDisplayAlertMsg(alertMSG);
}
// ************** Remove Page Query ***************
function removePageQuery(pageName)
{
if(pageName !='')
{
$.ajax({
type : "GET",
url : main_company_root+"ajax/pageQuerySave.php?mod=RemoveQuery&page="+pageName,
async : false,
success:function(msg) { }
});
}
}
// Displaye Large Image
function viewLargeImage(title,imagePath)
{
var message = '';
message += "";
message += ' ';
message += '

';
message += '
';
eModal.alert(message, title);
}
// ********************** Export File **********************
// Get the Product List For Discount tag
function getDownloadReport(report_name)
{
if(report_name === undefined) { report_name = ''; }
if(report_name !='')
{
var redirectPath = main_company_root+"module/transaction/download_file.php?report_name="+report_name
window.setTimeout(function(){ window.location = redirectPath;});
}
}
// Enable/ Active the Records // 1 For Enable/ Active Records
function enableRecords(mod_action)
{
var listArr = new Array();
var i=0;
$.each($("input[name='chk']:checked"), function()
{
listArr[i] = $(this).val();
i++;
});
if(listArr.length >0 )
{
console.log(main_company_root+"ajax/disable_records.php?status=1&mod="+mod_action+'&listArr='+listArr);
$.ajax({
type : "GET",
url : main_company_root+"ajax/disable_records.php?status=1&mod="+mod_action+'&listArr='+listArr,
async : false,
success:function(result)
{
if(result > 0)
{
var alertMSG = "success@@@@Record Enable Successfully";
getDisplayAlertMsg(alertMSG);
}
else
{
var alertMSG = "warning@@@@"+result;
getDisplayAlertMsg(alertMSG);
}
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
else
{
var alertMSG = "warning@@@@"+"Please Select the Checkbox";
getDisplayAlertMsg(alertMSG);
}
}
// Disable/ Deactive the Records // 0 For Disable/ Deactive Records
function disableRecords(mod_action)
{
var listArr = new Array();
var i=0;
$.each($("input[name='chk']:checked"), function()
{
listArr[i] = $(this).val();
i++;
});
if(listArr.length >0 )
{
var confirmMSG = 'Are you confirm to Disable';
if(mod_action == 'ProductMaster')
{
confirmMSG = 'Are you confirm to disable, Business Product Also disable';
}
return eModal.confirm(confirmMSG, ' '+PROJECT_SITE_NAME+' Message')
.then(function ()
{
$.ajax({
type : "GET",
url : main_company_root+"ajax/disable_records.php?status=0&mod="+mod_action+'&listArr='+listArr,
async : false,
success:function(result)
{
if(result > 0)
{
var alertMSG = "success@@@@Record Disable Successfully";
getDisplayAlertMsg(alertMSG);
}
else
{
var alertMSG = "warning@@@@"+result;
getDisplayAlertMsg(alertMSG);
}
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
});
}
else
{
var alertMSG = "warning@@@@"+"Please Select the Checkbox";
getDisplayAlertMsg(alertMSG);
}
}
function getDisableReasonBoxModal(mod_action)
{
var listArr = new Array();
var i=0;
$.each($("input[name='chk']:checked"), function()
{
var id = $(this).val();
listArr[i] = id;
i++;
});
if(listArr.length >0 )
{
var options = {
url: main_company_root+"modal/approval_deny_modal.php?modeType=denyReasonBox&mod_action="+mod_action+'&disableIdList='+listArr,
title :'Disable Reason',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true },
{text: 'Save', style: 'primary ', close: true, click: validateDisableReasonBox }
],
};
return eModal.ajax(options);
}
else
{
var alertMSG = "warning@@@@"+"Please Select the Checkbox";
getDisplayAlertMsg(alertMSG);
}
}
function validateDisableReasonBox()
{
var counter = 1;
var mod_action = $("#denyReasonBoxForm #mod_action").val();
var denyIdList = $("#denyReasonBoxForm #denyIdList").val();
var denyComment = $("#denyReasonBoxForm #denyComment").val();
if(denyComment == "") { $("#denyReasonBoxForm #denyComment_EBox").html('Please Enter Comment'); counter = 0; }
else if(parseInt(denyComment.length) < 20)
{
$("#denyReasonBoxForm #denyComment_EBox").html('Please Enter Comment Greater Than 20 Characters'); counter = 0;
}
if(counter == 0) { return false; }
else
{
var dataArr = '&mod='+mod_action+'&denyComment='+denyComment+'&listArr='+disableIdList
$.ajax({
type : "GET",
url : main_company_root+"ajax/disable_records.php?status=0"+dataArr,
async : false,
success:function(result)
{
if(result > 0)
{
var alertMSG = "success@@@@Record Disable Successfully";
getDisplayAlertMsg(alertMSG);
}
else
{
var alertMSG = "warning@@@@"+result;
getDisplayAlertMsg(alertMSG);
}
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
}
// Delete the Records
function deleteRecords(mod_action)
{
var listArr = new Array();
var i=0;
$.each($("input[name='chk']:checked"), function()
{
listArr[i] = $(this).val();
i++;
});
if(listArr.length >0 )
{
var confirmMSG = 'Are you confirm to delete';
return eModal.confirm(confirmMSG, ' '+PROJECT_SITE_NAME+' Message')
.then(function ()
{
$.ajax({
type : "GET",
url : main_company_root+"ajax/delete_records.php?mod="+mod_action+'&listArr='+listArr,
async : false,
success:function(result)
{
if(result > 0)
{
var alertMSG = "success@@@@Record Delete Successfully";
getDisplayAlertMsg(alertMSG);
}
else
{
var alertMSG = "danger@@@@"+result;
getDisplayAlertMsg(alertMSG);
}
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
});
}
else
{
var alertMSG = "warning@@@@"+"Please Select the Checkbox";
getDisplayAlertMsg(alertMSG);
}
}
//Get the Active State List of Country
function getActiveStateList(country_id)
{
console.log(main_company_root+"ajax/getDropDownOption.php?mod=stateList&id="+country_id);
$.ajax({
type: "GET",
url : main_company_root+"ajax/getDropDownOption.php?mod=stateList&id="+country_id,
async : false,
success : function(response)
{
$('#statediv').html(response);
}
});
if($("#citydiv").length>0)
{
var state_id = '';
getActiveCityList(state_id);
}
}
//Get the Active City List of State
function getActiveCityList(state_id)
{
console.log(main_company_root+"ajax/getDropDownOption.php?mod=cityList&id="+state_id);
$.ajax({
type: "GET",
url : main_company_root+"ajax/getDropDownOption.php?mod=cityList&id="+state_id,
async : false,
success : function(response)
{
$('#citydiv').html(response);
}
});
}
//Get the Active City List of State
function getActiveDepartmentList(division_id)
{
console.log(main_company_root+"ajax/getDropDownOption.php?mod=departmentList&id="+division_id);
$.ajax({
type: "GET",
url : main_company_root+"ajax/getDropDownOption.php?mod=departmentList&id="+division_id,
async : false,
success : function(response)
{
$('#departmentId').html(response);
}
});
}
//Get the Active City List of State
function getActiveDeptStaffList()
{
var divisionId = $('#divisionId').val();
var departmentId = $('#departmentId').val();
if(divisionId == "All") { divisionId = ''; }
if(departmentId == "All") { departmentId = ''; }
var dataArr = '&division_id='+divisionId+'&department_id='+departmentId
console.log(main_company_root+"ajax/getDropDownOption.php?mod=deptStaffList"+dataArr);
$.ajax({
type: "GET",
url : main_company_root+"ajax/getDropDownOption.php?mod=deptStaffList"+dataArr,
async : false,
success : function(response)
{
$('#staffId').html(response);
}
});
}
// Check Mobile Format
function checkMobileFormat(mobile)
{
var msg = true;
var mobileRegex = /^[0-9]+$/;
if(!mobileRegex.test(mobile)) { msg = "Please enter a valid Mobile Number"; }
else if(isNaN(mobile)) { msg = "Please enter only digits. ";}
else if(CONST_MOBILE_LENGTH !=0 && mobile.length != CONST_MOBILE_LENGTH){ msg = "Mobile must have 10 digits "; }
return msg;
}
// Check Email Format
function checkEmailFormat(email)
{
var msg = true;
var emailRegex = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/;
if(!emailRegex.test(email)) { msg = "Please enter a valid Email-ID"; }
return msg;
}
function checkPasswordFormat(password)
{
var msg = true;
var digitRegex = /^(?=.*\d)/;
var lowercaseRegex = /^(?=.*[a-z])/;
var specialcaseRegex = /^(?=.*[!@#$%^&*])/;
if(password == '') { msg = "Please enter a valid Mobile Number"; }
else if(password.length < '7' ) { msg = 'Password length must be 7 characters'; }
else if(!digitRegex.test(password)) { msg = 'Password must contain at least one digit';}
else if(!lowercaseRegex.test(password)) { msg = 'Password must contain at least one lowercase letter';}
else if(!specialcaseRegex.test(password)) { msg = 'Password must contain at least one Special character';}
return msg;
}
// User Details Modal
function viewDeviceListModal(staff_id)
{
var options = {
url: main_company_root+"modal/admin_detail_modal.php?modeType=attendanceDevice&staff_id="+staff_id,
title :'Attendance Device',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true },
{text: 'Update', style: 'success ', close: true,click: validateStaffTagDevice }
],
};
return eModal.ajax(options);
}
function validateStaffTagDevice()
{
var deviceId = new Array();
var i=0;
var staff_id = $("#tagDeviceForm #staff_id").val();
$.each($("input[name='deviceId']:checked",'#tagDeviceForm'), function()
{
deviceId[i] = $(this).val();
i++;
});
if(deviceId.length >0 )
{
var dataArr = '&staff_id='+staff_id+'&deviceId='+deviceId;
console.log(main_company_root+"ajax/staff_detail.php?mod=staffSyncFaceDevice"+dataArr);
$.ajax({
type: "GET",
url : main_company_root+"ajax/staff_detail.php?mod=staffSyncFaceDevice"+dataArr,
async : false,
success : function(result)
{
var resultArr = result.split('@@@@');
if(resultArr[0] ==1)
{
var alertMSG = "success@@@@"+resultArr[1];
getDisplayAlertMsg(alertMSG);
}
else
{
var alertMSG = "warning@@@@"+resultArr[1];
getDisplayAlertMsg(alertMSG);
}
}
});
}
}
function intranetAttendanceReport(device_id)
{
var dataArr = '&device_id='+device_id;
console.log(main_company_root+"ajax/staff_detail.php?mod=IntranetDeviceAttendance"+dataArr);
$.ajax({
type: "GET",
url : main_company_root+"ajax/staff_detail.php?mod=IntranetDeviceAttendance"+dataArr,
async : false,
success : function(result)
{
var resultArr = result.split('@@@@');
if(resultArr[0] ==1)
{
var alertMSG = "success@@@@"+resultArr[1];
getDisplayAlertMsg(alertMSG);
}
else
{
var alertMSG = "warning@@@@"+resultArr[1];
getDisplayAlertMsg(alertMSG);
}
}
});
}
function viewGoogleMapLocation(latitude,longitude)
{
var options = {
url: main_company_root+"modal/admin_detail_modal.php?modeType=locationMapView&latitude="+latitude+'&longitude='+longitude,
title :'Location Map View' ,
size: eModal.size.lgs,
buttons: [{text: 'Close', style: 'default ', close: true }],
};
return eModal.ajax(options);
}
function getDownloadReport(report_name)
{
if(report_name === undefined) { report_name = ''; }
if(report_name !='')
{
var redirectPath = main_company_root+"ajax/download_file.php?report_name="+report_name
window.setTimeout(function(){ window.location = redirectPath;});
}
}
function getDownloadAttenaceReport(staff_id,report_name)
{
if(report_name === undefined) { report_name = ''; }
if(report_name !='')
{
var redirectPath = main_company_root+"ajax/download_file.php?report_name="+report_name+'&staff_id='+staff_id
console.log(redirectPath);
window.setTimeout(function(){ window.location = redirectPath;});
}
}
//***************** Device Access Code *********************
function deviceAccessCodeModel(device_id)
{
console.log(main_company_root+"modal/device_detail_modal.php?modeType=DeviceAccessCodeModal&device_id="+device_id);
var options = {
url: main_company_root+"modal/device_detail_modal.php?modeType=DeviceAccessCodeModal&device_id="+device_id,
title :'Attendance Device',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true },
{text: 'Update', style: 'success ', close: true,click: validateDeviceAccessCode }
],
};
return eModal.ajax(options);
}
function validateDeviceAccessCode()
{
var specialcaseRegex = /^(?=.*[!@#$%^&*])/;
var formName = '#updateAccessCodeForm';
var device_id = $(formName + " #device_id").val();
var accessCode = $(formName + " #accessCode").val();
var counter = 1;
if(accessCode == "")
{
counter = 0;
$(formName + " #accessCode_EBox").html('Please Enter Device Access Code');
$(formName + " #accessCode").addClass("is-invalid");
}
else if(accessCode.length != '6')
{
counter = 0;
$(formName + " #accessCode_EBox").html('Please Enter Digit 6 Only');
$(formName + " #accessCode").addClass("is-invalid");
}
else if(accessCode.length != '6')
{
counter = 0;
$(formName + " #accessCode_EBox").html('Please Enter Digit 6 Only');
$(formName + " #accessCode").addClass("is-invalid");
}
else if(specialcaseRegex.test(accessCode))
{
counter = 0;
$(formName + " #accessCode_EBox").html('Please Remove Special character');
$(formName + " #accessCode").addClass("is-invalid");
}
if(counter ==1 )
{
var dataArr = '&device_id='+device_id+'&accessCode='+accessCode;
console.log(main_company_root+"ajax/staff_detail.php?mod=updateDeviceAccessCode"+dataArr);
$.ajax({
type: "GET",
url : main_company_root+"ajax/staff_detail.php?mod=updateDeviceAccessCode"+dataArr,
async : false,
success : function(result)
{
var alertMSG = "success@@@@Access Code Update Successfully";
getDisplayAlertMsg(alertMSG);
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
else
{
return false;
}
}
//***************** Device Access Code *********************
function StaffAccessCodeModel(staff_id)
{
console.log(main_company_root+"modal/device_detail_modal.php?modeType=StaffAccessCodeModal&staff_id="+staff_id);
var options = {
url: main_company_root+"modal/device_detail_modal.php?modeType=StaffAccessCodeModal&staff_id="+staff_id,
title :'Attendance Device',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true },
{text: 'Update', style: 'success ', close: true,click: validateStaffAccessCode }
],
};
return eModal.ajax(options);
}
function validateStaffAccessCode()
{
var specialcaseRegex = /^(?=.*[!@#$%^&*])/;
var formName = '#updateAccessCodeForm';
var staff_id = $(formName + " #staff_id").val();
var accessCode = $(formName + " #accessCode").val();
var counter = 1;
if(accessCode == "")
{
counter = 0;
$(formName + " #accessCode_EBox").html('Please Enter Device Access Code');
$(formName + " #accessCode").addClass("is-invalid");
}
else if(accessCode.length != '6')
{
counter = 0;
$(formName + " #accessCode_EBox").html('Please Enter Digit 6 Only');
$(formName + " #accessCode").addClass("is-invalid");
}
else if(accessCode.length != '6')
{
counter = 0;
$(formName + " #accessCode_EBox").html('Please Enter Digit 6 Only');
$(formName + " #accessCode").addClass("is-invalid");
}
else if(specialcaseRegex.test(accessCode))
{
counter = 0;
$(formName + " #accessCode_EBox").html('Please Remove Special character');
$(formName + " #accessCode").addClass("is-invalid");
}
if(counter ==1 )
{
var dataArr = '&staff_id='+staff_id+'&accessCode='+accessCode;
console.log(main_company_root+"ajax/staff_detail.php?mod=updateStaffAccessCode"+dataArr);
$.ajax({
type: "GET",
url : main_company_root+"ajax/staff_detail.php?mod=updateStaffAccessCode"+dataArr,
async : false,
success : function(result)
{
var alertMSG = "success@@@@Access Code Update Successfully";
getDisplayAlertMsg(alertMSG);
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
else
{
return false;
}
}
// *************** App Access Request ***********8
function staffAppAccessApproved(staff_id,accessCode)
{
var dataArr = '&staff_id='+staff_id+'&accessCode='+accessCode;
console.log(main_company_root+"ajax/staff_detail.php?mod=updateStaffAccessCode"+dataArr);
$.ajax({
type: "GET",
url : main_company_root+"ajax/staff_detail.php?mod=updateStaffAccessCode"+dataArr,
async : false,
success : function(result)
{
var alertMSG = "success@@@@Access Code Update Successfully";
getDisplayAlertMsg(alertMSG);
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
function staffAppAccessDeny(request_id)
{
var dataArr = '&request_id='+request_id;
console.log(main_company_root+"ajax/staff_detail.php?mod=denyStaffAccessCode"+dataArr);
$.ajax({
type: "GET",
url : main_company_root+"ajax/staff_detail.php?mod=denyStaffAccessCode"+dataArr,
async : false,
success : function(result)
{
var alertMSG = "success@@@@Request Delete Successfully";
getDisplayAlertMsg(alertMSG);
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
function editAccessRequestModel(request_id)
{
console.log(main_company_root+"modal/device_detail_modal.php?modeType=editReqAccesModel&request_id="+request_id);
var options = {
url: main_company_root+"modal/device_detail_modal.php?modeType=editReqAccesModel&request_id="+request_id,
title :'Attendance Device',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true },
{text: 'Update', style: 'success ', close: true,click: validateEditReqAccess }
],
};
return eModal.ajax(options);
}
function validateEditReqAccess()
{
var formName = '#editAccessRequestForm';
var request_id = $(formName + " #request_id").val();
var staffMobile = $(formName + " #staffMobile").val();
var counter = 1;
if(staffMobile == "")
{
counter = 0;
$(formName + " #staffMobile_EBox").html('Please Enter Mobile Number');
$(formName + " #staffMobile").addClass("is-invalid");
}
if(counter ==1 )
{
var dataArr = '&request_id='+request_id+'&staffMobile='+staffMobile;
console.log(main_company_root+"ajax/staff_detail.php?mod=updateAccessReqMobile"+dataArr);
$.ajax({
type: "GET",
url : main_company_root+"ajax/staff_detail.php?mod=updateAccessReqMobile"+dataArr,
async : false,
success : function(result)
{
var resultArr = result.split('@@@@');
if(resultArr[0] ==1)
{
var alertMSG = "success@@@@"+resultArr[1];
getDisplayAlertMsg(alertMSG);
}
else
{
var alertMSG = "warning@@@@"+resultArr[1];
getDisplayAlertMsg(alertMSG);
}
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
else
{
return false;
}
}
function tagStaffEssFlag(staff_id,essFlag)
{
var dataArr = '&staff_id='+staff_id+'&essFlag='+essFlag;
console.log(main_company_root+"ajax/staff_detail.php?mod=updateStaffEssFlag"+dataArr);
$.ajax({
type: "GET",
url : main_company_root+"ajax/staff_detail.php?mod=updateStaffEssFlag"+dataArr,
async : false,
success : function(result)
{
var resultArr = result.split('@@@@');
if(resultArr[0] ==1)
{
var alertMSG = "success@@@@"+resultArr[1];
getDisplayAlertMsg(alertMSG);
}
else
{
var alertMSG = "warning@@@@"+resultArr[1];
getDisplayAlertMsg(alertMSG);
}
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
function tagFieldStaffType(staff_id,staffType)
{
var dataArr = '&staff_id='+staff_id+'&staffType='+staffType;
console.log(main_company_root+"ajax/staff_detail.php?mod=updateFieldStaffType"+dataArr);
$.ajax({
type: "GET",
url : main_company_root+"ajax/staff_detail.php?mod=updateFieldStaffType"+dataArr,
async : false,
success : function(result)
{
var resultArr = result.split('@@@@');
if(resultArr[0] ==1)
{
var alertMSG = "success@@@@"+resultArr[1];
getDisplayAlertMsg(alertMSG);
}
else
{
var alertMSG = "warning@@@@"+resultArr[1];
getDisplayAlertMsg(alertMSG);
}
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
function tagManagerStaffType(staff_id,roleType)
{
var dataArr = '&staff_id='+staff_id+'&roleType='+roleType;
console.log(main_company_root+"ajax/staff_detail.php?mod=updateManagerStaffRole"+dataArr);
$.ajax({
type: "GET",
url : main_company_root+"ajax/staff_detail.php?mod=updateManagerStaffRole"+dataArr,
async : false,
success : function(result)
{
var resultArr = result.split('@@@@');
if(resultArr[0] ==1)
{
var alertMSG = "success@@@@"+resultArr[1];
getDisplayAlertMsg(alertMSG);
}
else
{
var alertMSG = "warning@@@@"+resultArr[1];
getDisplayAlertMsg(alertMSG);
}
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
function staffDummyExcelDownload()
{
console.log(main_company_root+"ajax/staff_detail.php?mod=staff_dummy_excel");
var redirectPath = main_company_root+"ajax/staff_detail.php?mod=staff_dummy_excel"
window.setTimeout(function(){ window.location = redirectPath;});
}
function staffDataExcelDownload()
{
console.log(main_company_root+"ajax/staff_detail.php?mod=staff_data_excel");
var redirectPath = main_company_root+"ajax/staff_detail.php?mod=staff_data_excel"
window.setTimeout(function(){ window.location = redirectPath;});
}
//*************************** Admin User ***************************
// User Details Modal
function viewCompanyUserDetail(user_id)
{
console.log(main_company_root+"modal/admin_detail_modal.php?modeType=UserDetails&user_id="+user_id);
var options = {
url: main_company_root+"modal/admin_detail_modal.php?modeType=UserDetails&user_id="+user_id,
title :'User Information',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true }
],
};
return eModal.ajax(options);
}
function removeStaffDocImage(staff_id,docType)
{
var result = '';
if(staff_id !='' && docType !='')
{
var dataArr = '&staff_id='+staff_id+'&doc_type='+docType
$.ajax({
type : "GET",
url : main_company_root+"ajax/delete_records.php?mod=staffDocTypeImageRemove"+dataArr,
async : false,
success:function(result)
{
if(result > 0)
{
var alertMSG = "success@@@@Image Remove Successfully";
getDisplayAlertMsg(alertMSG);
}
else
{
var alertMSG = "warning@@@@"+result;
getDisplayAlertMsg(alertMSG);
}
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
}