// 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];
var msg_image = main_root+'image/success.png';
if(msg_color != 'success') { msg_image = main_root+'image/failed.png'; }
$.gritter.add({
//title : msg_color,
text : msg_content,
image : msg_image,
time: '1000',
sticky: false,
});
}
// 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);
}
function printOutContent(output)
{
var popupWin = window.open('','_blank','width=400,height=600');
popupWin.document.open();
popupWin.document.write('' + output + '');
popupWin.document.close();
}
// ********************** 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';
if(mod_action == 'ProductMaster' || mod_action == 'ProductApproval')
{
confirmMSG = 'Are you confirm to delete, Business Product Also 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);
}
}
// Approved Records // 1 For Approved
function approvedRecords(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_console_root+"ajax/approval_records.php?status=1&mod="+mod_action+'&listArr='+listArr);
$.ajax({
type : "GET",
url : main_console_root+"ajax/approval_records.php?status=1&mod="+mod_action+'&listArr='+listArr,
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);
}
else
{
var alertMSG = "warning@@@@"+"Please Select the Checkbox";
getDisplayAlertMsg(alertMSG);
}
}
// DisApproved / Deactive the Records With Confirm Msg
function disapprovedRecords(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 Deny';
if(mod_action == 'ProductApproval')
{
confirmMSG = 'Are you confirm to Deny, Business Product Also Disable';
}
return eModal.confirm(confirmMSG, ' '+PROJECT_SITE_NAME+' Message')
.then(function ()
{
//alert(main_console_root+"ajax/approval_records.php?status=2&mod="+mod_action+'&listArr='+listArr);
$.ajax({
type : "GET",
url : main_console_root+"ajax/approval_records.php?status=2&mod="+mod_action+'&listArr='+listArr,
async : false,
success:function(result)
{
var resultArr = result.split('@@@@');
if(resultArr[0] > 0)
{
output = 1;
var alertMSG = "success@@@@"+resultArr[1];
getDisplayAlertMsg(alertMSG);
}
else
{
var alertMSG = "warning@@@@"+resultArr[1];
getDisplayAlertMsg(alertMSG);
}
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
});
}
}
// Records Archive With Reason Comment
function denyRecordsReasonBox(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+'&denyIdList='+listArr,
title :'Deny Reason',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true },
{text: 'Save', style: 'primary ', close: true, click: validateDenyReasonBox }
],
};
return eModal.ajax(options);
}
else
{
var alertMSG = "warning@@@@"+"Please Select the Checkbox";
getDisplayAlertMsg(alertMSG);
}
}
// Validate Deny With Reason Comment
function validateDenyReasonBox()
{
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 output = 0;
var dataArr = '&mod='+mod_action+'&denyComment='+denyComment+'&listArr='+denyIdList
$.ajax({
type : "GET",
url : main_console_root+"ajax/approval_records.php?status=2"+dataArr,
global: false,
async : false,
success:function(result)
{
var resultArr = result.split('@@@@');
if(resultArr[0] > 0)
{
output = 1;
var alertMSG = "success@@@@"+resultArr[1];
getDisplayAlertMsg(alertMSG);
}
else
{
var alertMSG = "warning@@@@"+resultArr[1];
getDisplayAlertMsg(alertMSG);
}
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
}
//Get the Active City List of State
function getActiveCityList(state_id)
{
console.log(main_console_root+"ajax/getDropDownOption.php?id="+state_id+'&mod=cityList');
$.ajax({
type: "GET",
url : main_console_root+"ajax/getDropDownOption.php?id="+state_id+'&mod=cityList',
async : false,
success : function(response){
$('#citydiv').html(response);
}
});
var city_id = '';
getActiveAreaList(city_id);
}
//Get the Active Area List of City
function getActiveAreaList(city_id)
{
$.ajax({
type: "GET",
url : main_console_root+"ajax/getDropDownOption.php?id="+city_id+'&mod=areaList',
async : false,
success : function(response)
{
$('#areadiv').html(response);
}
});
}
//Get the Active Area List of City
function getActivePickDropList(central_id)
{
$.ajax({
type: "GET",
url : main_console_root+"ajax/getDropDownOption.php?id="+central_id+'&mod=pickdropList',
async : false,
success : function(response)
{
$('#routeStoppageDiv').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;
}
//*************************** Admin User ***************************
// User Details Modal
function viewAdminUserDetail(user_id)
{
var options = {
url: main_console_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);
}
// ********************** Marketing Campaign *********************
function downloadExcelListFile(fileType)
{
var options = {
url: main_console_root+"ajax/import_export_detail.php?mod=downloadExcelColumnModel&fileType="+fileType,
title :'Excel Column Lists',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true },
{text: 'Download', style: 'success ', close: true,click: validateDownloadExcelColumn }
],
};
return eModal.ajax(options);
}
function validateDownloadExcelColumn()
{
var columnList = new Array();
var i=0;
$.each($("input[name='excelColumn']:checked",'#excelColumnForm'), function()
{
columnList[i] = $(this).val();
i++;
});
var fileType = $('#excelColumnForm #fileType').val();
if(columnList.length >0 )
{
var dataArr = '&columnList='+columnList;
console.log(main_console_root+"ajax/import_export_detail.php?mod="+fileType+dataArr);
$.ajax({
type : "GET",
url : main_console_root+"ajax/import_export_detail.php?mod="+fileType+dataArr,
async : false,
success:function(result)
{
var dataArr = result.split('@@@@');
var filePath = dataArr[0];
var filename = dataArr[1];
var element = document.createElement('a');
element.setAttribute('href', filePath);
element.setAttribute('download',filename);
element.style.display = 'none';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
else
{
$("#excelColumnForm #columnExcel_EBox").html('Please Select Atleast One Column');
}
}
function checkFeesAmount(fieldId,event)
{
var charAmount = $('#'+fieldId).val();
console.log(charAmount);
if(window.getSelection().toString() !='' && charAmount !='' && window.getSelection().toString() == charAmount )
{
charAmount = '';
}
charAmount = charAmount + String.fromCharCode(event.which);
var charCode = event.which;
var res = charAmount.split(".");
if(res.length == 2)
{
if (res[1].length > 2) { event.preventDefault(); }
}
else if(res.length == 1)
{
if(charAmount.length > 5)
{
if (charCode != 46) { event.preventDefault(); }
}
}
else { event.preventDefault(); }
if (!(charCode == 46))
{
if (isNaN(String.fromCharCode(event.which))) { event.preventDefault(); }
}
}
// JavaScript Document
//*************************** SMS / Email Function ***************************
function copyTemplateParameter(paramNameId)
{
var param_name = $("#"+paramNameId).val();
var $temp = $("");
$("body").append($temp);
$temp.val(param_name).select();
document.execCommand("Copy");
$temp.remove();
}
function getParamenterList(groupName,divPlaceStoreId)
{
$.ajax({
type: "GET",
url : main_console_root+"ajax/comm_template.php?mod=ParameterDropDownList&groupName="+groupName,
async : false,
success : function(response)
{
$('#'+divPlaceStoreId).html(response);
}
});
}
// 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);
}
});
return msg;
}
// ************ Header Footer Active ************
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);
}
}
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 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);
}
}
// ************ Coumunication Templete View ************
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 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 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
//*********************************** Add Field Row **********************
function addFieldRow(FieldTypeArr)
{
var fldTypeObj = $.parseJSON(FieldTypeArr);
var msg = '';
msg += '
';
msg += '
';
// Check Box
msg += '
';
// Form Fields
msg += '
';
msg += '
';
$("#fieldDataDiv").append(msg);
$(".span12").click(function(){ if ($(this).hasClass("field-error")) { $(this).removeClass("field-error"); }});
$(".span11").click(function(){ if ($(this).hasClass("field-error")) { $(this).removeClass("field-error"); }});
}
//*********************************** Delete Field Row **********************
function delFieldRow()
{
var quant = $("input[name='chk[]']");
if(quant.length >1)
{
var indexArr = [];
$.each(quant,function(index){
if($("input[name='chk[]']").eq(index).is(':checked')) { indexArr.push(index); }
});
if(indexArr.length > 0)
{
return eModal.confirm('Are you confirm to delete', ' '+PROJECT_SITE_NAME+' Message')
.then(function ()
{
for (var i=indexArr.length-1; i>=0; i-- )
{
index = indexArr[i];
$("input[name='chk[]']").eq(index).closest('.proDynamicRow').remove();
}
});
}
else
{
var alertMSG = "warning@@@@Please Select Atleast One Checkbox";
getDisplayAlertMsg(alertMSG);
}
}
else
{
var alertMSG = "warning@@@@You cannot Delete All Field";
getDisplayAlertMsg(alertMSG);
}
}
function customeFieldValidation(formName,fldTypeObj)
{
var counter = 1;
$.each(fldTypeObj, function(key, value)
{
// Field is Mandatry or Not
if(value['fld_mdt'] == 'Yes')
{
// Get the Field Details
var fld_key = value['fld_key'];
var field_type = value['fld_type'];
var field_error = value['fld_error'];
var field_EBox = "#"+formName+" #"+fld_key+"_EBox";
if(field_type =='radio_type') // Validatation for Radio Type
{
var field_value = $('input[name='+fld_key+']:checked', formName).val();
if(field_value === undefined || field_value == '') { $(field_EBox).html(field_error); counter = 0; }
}
else if (field_type == 'checkbox_type') // Validatation for Checkbox Type
{
var atlestone = 0; // Flag Set For Checkbox Counter
var ser_quant = $("input[name='"+fld_key+"[]']");
$.each(ser_quant,function(index)
{
if($("input[name='"+fld_key+"[]']").eq(index).is(':checked')) { atlestone = 1; }
});
if(parseInt(atlestone) == 0) { $(field_EBox).html(field_error); counter = 0; }
}
else if(field_type == 'number_type') // Validatation for Number Type
{
var field_value = $("#"+fld_key).val();
if(field_value == "") { $(field_EBox).html(field_error); counter = 0; }
else if( parseInt(field_value) < 0 ){ $(field_EBox).html('Greater than and equal to Zero.'); counter = 0; }
else if(isNaN(field_value)) { $(field_EBox).html('Please Enter Only Digit.'); counter = 0; }
}
else // Other Else Field Type
{
var field_value = $("#"+fld_key).val();
if(field_value == "" ) { $(field_EBox).html(field_error); counter = 0; }
}
}
});
return counter;
}
function updateProductCloudinaryImagePath(imageType,image_id)
{
if(image_id !='' )
{
var dataArr = '&imageType='+imageType+'&image_id='+image_id
console.log(main_console_root+"ajax/product_template.php?mod=updateProductCloudinaryImagePath"+dataArr);
$.ajax({
type : "GET",
url : main_console_root+"ajax/viewProductDetail.php?mod=updateProductCloudinaryImagePath"+dataArr,
global: false,
async : false,
success:function()
{
var alertMSG = "success@@@@"+"Cloudinary Image Updated Successfully";
getDisplayAlertMsg(alertMSG);
}
});
window.open(main_console_root+"ajax/product_template.php?mod=updateProductCloudinaryImagePath"+dataArr, "_blank");
window.setTimeout(function(){ location.reload(); }, 1000);
}
}
// User Details Modal
function viewCentralVisitorDetail(central_id,visitor_id)
{
var options = {
url: main_console_root+"modal/admin_detail_modal.php?modeType=centralVisitorDetail&visitor_id="+visitor_id+'¢ral_id='+central_id,
title :'Visitor Information',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true }
],
};
return eModal.ajax(options);
}
function centralDigitalMouPublish(encryptCentralId)
{
$.ajax({
type : "GET",
url : main_console_root+"ajax/master_detail.php?mod=digitalMouPublish&id="+encryptCentralId,
global: false,
async : false,
success:function()
{
var alertMSG = "success@@@@"+"Digital Mou Published Successfully";
getDisplayAlertMsg(alertMSG);
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
// JavaScript Document
// ********************** Customer **********************
// Get Customer Name
function getCustomerName(customer_id)
{
var customer_name = '';
$.ajax({
type : "GET",
url : main_console_root+"ajax/customer_detail.php?mod=customerName&customer_id="+customer_id,
async : false,
success:function(result) { customer_name = result; }
});
return customer_name
}
// Customer Details Modal
function viewCustomerDetails(customer_id)
{
var customer_name = getCustomerName(customer_id);
var options = {
url: main_console_root+"modal/customer_detail_modal.php?modeType=CustomerDetails&customer_id="+customer_id,
title :'Customer Details : '+ customer_name,
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true }
],
};
return eModal.ajax(options);
}
function customerLoginMapView(customer_id)
{
var customer_name = getCustomerName(customer_id);
var options = {
url: main_console_root+"modal/customer_detail_modal.php?modeType=CustomeLoginMapView&customer_id="+customer_id,
title :'Customer Login Map View: '+customer_name ,
size: eModal.size.lgs,
buttons: [{text: 'Close', style: 'default ', close: true }],
};
return eModal.ajax(options);
}
// ************************* Customer Communicatio Modal ******************
// All Selected Customer Communication Modal
function allCustomerCommunicationModal()
{
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/customer_detail_modal.php?modeType=CustomerCommunicationModal&customerIdList="+listArr,
title :'Customer Communication',
size: eModal.size.lgs,
buttons: [ {text: 'Close', style: 'default ', close: true }],
};
return eModal.ajax(options);
}
else
{
var alertMSG = "warning@@@@"+"Please Select the Checkbox";
getDisplayAlertMsg(alertMSG);
}
}
// Store Communication Modal
function viewCustomerCommunicatinModal(customer_id)
{
var customer_name = getCustomerName(customer_id);
var options = {
url: main_console_root+"modal/customer_detail_modal.php?modeType=CustomerCommunicationModal&customerIdList="+customer_id,
title :'Customer Communication : '+customer_name,
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true }
],
};
return eModal.ajax(options);
}
//Customer Communication Modal Validate
function validateCustomreCommunication(modeType)
{
var counter = 1;
var dataArr = '';
if(modeType == 'Email')
{
var customer_id = $("#sendEmailForm #customer_id").val();
var emailSubject = $("#sendEmailForm #emailSubject").val();
var emailDesc = $("#sendEmailForm #emailDesc").val();
if(emailSubject == ""){ $("#sendEmailForm #emailSubject").addClass("field-error"); counter = 0; }
if(emailDesc == "") { $("#sendEmailForm #emailDesc").addClass("field-error"); counter = 0; }
var dataArr = 'mod=SendCustomerEmail&customerIdList='+customer_id+'&emailSubject='+emailSubject+'&emailDesc='+emailDesc;
}
else if(modeType == 'Sms')
{
var customer_id = $("#sendSmsForm #customer_id").val();
var smsDesc = $("#sendSmsForm #smsDesc").val();
if(smsDesc == ""){ $("#sendSmsForm #smsDesc").addClass("field-error"); counter = 0; }
var dataArr = 'mod=SendCustomerSms&customerIdList='+customer_id+'&smsDesc='+smsDesc;
}
else if(modeType == 'Notify')
{
var customer_id = $("#sendNotifyForm #customer_id").val();
var notifyTitle = $("#sendNotifyForm #notifyTitle").val();
var notifyDesc = $("#sendNotifyForm #notifyDesc").val();
var imageSend = $('input[name=imageSend]:checked', '#sendNotifyForm').val();
if(notifyTitle == ""){ $("#sendNotifyForm #notifyTitle").addClass("field-error"); counter = 0; }
if(notifyDesc == "") { $("#sendNotifyForm #notifyDesc").addClass("field-error"); counter = 0; }
if(imageSend === undefined) { imageSend = "None";}
var dataArr = 'mod=SendCustomerNotify&customerIdList='+customer_id+'¬ifyTitle='+notifyTitle+'¬ifyDesc='+notifyDesc+'&imageSend='+imageSend;
}
if(counter == 0) { return false; }
else
{
$.ajax({
type : "GET",
url : main_console_root+"ajax/customer_detail.php?"+dataArr,
async : false,
success:function(result)
{
var resultArr = result.split('@@@@');
if(resultArr[0] > 0)
{
eModal.close();
var alertMSG = "success@@@@"+resultArr[1];
getDisplayAlertMsg(alertMSG);
}
else
{
eModal.close();
var alertMSG = "warning@@@@"+resultArr[1];
getDisplayAlertMsg(alertMSG);
}
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
}
// ********************** Customer Event **********************
// Get Customer Event Detail
function getCustomerEventTitle(event_id)
{
var event_title = '';
$.ajax({
type : "GET",
url : main_console_root+"ajax/customer_detail.php?mod=customerEventTitle&event_id="+event_id,
async : false,
success:function(result) { event_title = result; }
});
return event_title
}
// Customer Details Modal
function viewCustomerEventDetail(event_id)
{
var event_title = getCustomerEventTitle(event_id);
var options = {
url: main_console_root+"modal/customer_detail_modal.php?modeType=CustomerEventDetail&event_id="+event_id,
title :'Customer Event Details : '+ event_title,
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true }
],
};
return eModal.ajax(options);
}
function customerEventMapView(event_id)
{
var event_title = getCustomerEventTitle(event_id);
var options = {
url: main_console_root+"modal/customer_detail_modal.php?modeType=CustomeEventMapView&event_id="+event_id,
title :'Event Map View: '+event_title ,
size: eModal.size.lgs,
buttons: [{text: 'Close', style: 'default ', close: true }],
};
return eModal.ajax(options);
}