// 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)
{
var dataArr = displayMsg.split('@@@@');
var msg_color = dataArr[0];
var msg_content = dataArr[1];
toastr.options = {
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": false,
"positionClass": "toast-top-right",
"preventDuplicates": true,
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "3000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
};
if( msg_content === undefined ) { }
else { toastr[msg_color](msg_content); }
}
// Display the Browse Images
function displayBrowseImage(fieldName)
{
var input = document.getElementById(fieldName);
var dvPreview = $("#browseImages");
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()
{
var input = document.getElementById('uploadFile');
var dvPreview = $("#browseImages");
dvPreview.html("");
var regex = /^([a-zA-Z0-9 \s_\\.\-\(\):])+(.xls|.xlsx|.csv)$/;
var iconArr = {'xls':'icon_xls.png','xlsx':'icon_xlsx.png','csv':'icon_csv.png'};
for (var i=0; i");
img.attr("style", "height:100px;width: 100px;padding: 5px;");
img.attr("src", iconPath);
dvPreview.append(img);
}
reader.readAsDataURL(input.files[i]);
}
else
{
var alertMSG = "warning@@@@"+name + " is not a valid 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 += '
';
eModal.alert(message, title);
}
// 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';
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);
}
}
// 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_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 = "warning@@@@"+result;
getDisplayAlertMsg(alertMSG);
}
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
});
}
else
{
var alertMSG = "warning@@@@"+"Please Select the Checkbox";
getDisplayAlertMsg(alertMSG);
}
}
// 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;
}
function addSyclpShivyogi(customer_id)
{
if (customer_id === undefined) { customer_id = ''; }
var options = {
url: main_console_root+"modal/admin_detail_modal.php?modeType=addSyclpCustomerModal&customer_id="+customer_id,
title : 'Add Shivyogi',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true },
{text: 'Save', style: 'primary ', close: true, click: validateAddSyclpCustomer }
],
};
return eModal.ajax(options);
}
function validateAddSyclpCustomer()
{
var counter = 1;
var shivyogiMobile = $("#syclpCustomerModal #shivyogiMobile").val();
var shivyogiGroup = $("#syclpCustomerModal #shivyogiGroup").val();
var shivyogiName = $("#syclpCustomerModal #shivyogiName").val();
var shivyogiId = $("#syclpCustomerModal #shivyogiId").val();
if(shivyogiMobile == "") { $("#syclpCustomerModal #shivyogiMobile_EBox").html('Please Enter the Mobile Number'); counter = 0; }
else
{
//var msg = checkMobileFormat(shivyogiMobile);
//if(msg != true) { $("#syclpCustomerModal #shivyogiMobile_EBox").html(msg); counter = 0; }
}
if(shivyogiGroup == "") { $("#syclpCustomerModal #shivyogiGroup_EBox").html('Please Select Any One Group'); counter = 0; }
if(counter == 0) { return false; }
else
{
var dataArr = '&shivyogiName='+shivyogiName+'&shivyogiGroup='+shivyogiGroup+'&shivyogiMobile='+shivyogiMobile+'&shivyogiId='+shivyogiId
$.ajax({
type : "GET",
url : main_console_root+"modal/admin_detail_modal.php?modeType=addSyclpCustomer"+dataArr,
async : false,
success:function(result)
{
var alertMSG = "success@@@@Record Insert Successfully";
getDisplayAlertMsg(alertMSG);
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
}
function tagSyclpRecordModal(group_id)
{
//shivyogi_group_modal
var options = {
url: main_console_root+"modal/shivyogi_group_modal.php?modeType=tagSyclpRecordModal&group_id="+group_id,
title : 'Tag Content Record',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true },
{text: 'Save', style: 'primary ', close: true, click: validateTagSyclpRecord }
],
};
return eModal.ajax(options);
}
function validateTagSyclpRecord()
{
var counter = 1;
var group_id = $("#syclpRecordTagModal #group_id").val();
var listArr = new Array();
var i=0;
$.each($("input[name='syclpRecordTagArr[]']:checked"), function()
{
listArr[i] = $(this).val();
i++;
});
if(counter == 0) { return false; }
else
{
var dataArr = '&group_id='+group_id+'&listArr='+listArr
$.ajax({
type : "GET",
url : main_console_root+"modal/shivyogi_group_modal.php?modeType=updateTagSyclpRecord"+dataArr,
async : false,
success:function(result)
{
var alertMSG = "success@@@@Record update successfully";
getDisplayAlertMsg(alertMSG);
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
}
function lockShivyogirecordList(group_id)
{
//shivyogi_group_modal
var options = {
url: main_console_root+"modal/shivyogi_group_modal.php?modeType=lockSyclpRecordModal&group_id="+group_id,
title : 'Tag Content Record',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true },
{text: 'Save', style: 'primary ', close: true, click: validateTagSyclpRecord }
],
};
return eModal.ajax(options);
}
function syclpRecordLockStaus(group_id,id,lock_status)
{
var mod_action = 'syclpRecordLock';
var dataArr = 'mod='+mod_action+'&group_id='+group_id+'&lock_status='+lock_status+'&id='+id;
//alert(main_console_root+"ajax/disable_records.php?"+dataArr);
$.ajax({
type : "GET",
url : main_console_root+"ajax/disable_records.php?"+dataArr,
async : false,
success:function(result)
{
if(result > 0)
{
if(lock_status ==1)
{
var alertMSG = "success@@@@Record Open Successfully";
}
else
{
var alertMSG = "success@@@@Record Lock Successfully";
}
getDisplayAlertMsg(alertMSG);
}
else
{
var alertMSG = "warning@@@@"+result;
getDisplayAlertMsg(alertMSG);
}
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
function viewShivyogiGroupModal(group_id)
{
}
function syclpShivyogiReset(customer_id)
{
//alert(main_console_root+"modal/admin_detail_modal.php?modeType=SyclpCustomerReset&customer_id="+customer_id);
$.ajax({
type : "GET",
url : main_console_root+"modal/admin_detail_modal.php?modeType=SyclpCustomerReset&customer_id="+customer_id,
async : false,
success:function(result)
{
var alertMSG = "success@@@@Record Reset Successfully";
getDisplayAlertMsg(alertMSG);
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}