// 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];
$.gritter.add({
title : msg_color,
text : msg_content,
sticky: false
});
}
// Display the Browse Images
function displayBrowseImage(divBrowseId,fieldName)
{
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(divBrowseId,fieldName)
{
var input = document.getElementById(fieldName);
var dvPreview = $("#"+divBrowseId);
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);
}
// ********************** 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/report/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)
{
console.log(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)
{
//console.log(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 = "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';
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
console.log(main_console_root+"ajax/approval_records.php?status=2"+dataArr);
$.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 State List of Country
function getActiveStateList(country_id)
{
if(country_id =='All') { country_id = '';}
$.ajax({
type: "GET",
url : main_console_root+"ajax/getDropDownOption.php?id="+country_id+'&mod=stateList',
async : false,
success : function(response){
$('#statediv').html(response);
}
});
var state_id = '';
getActiveCityList(state_id);
}
//Get the Active City List of State
function getActiveCityList(state_id)
{
if(state_id =='All') { state_id = '';}
$.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)
{
if(city_id =='All') { 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 getSubCategoryList(parent_id)
{
if(parent_id =='All') { parent_id = '';}
$.ajax({
type: "GET",
url : main_console_root+"ajax/getDropDownOption.php?id="+parent_id+'&mod=SubCategoryList',
async : false,
success : function(response)
{
$('#subCatediv').html(response);
}
});
}
function getActiveDeliveryVanList(store_id)
{
if(store_id =='All') { store_id = '';}
console.log(main_console_root+"ajax/getDropDownOption.php?id="+store_id+'&mod=DeliveryVanList');
$.ajax({
type: "GET",
url : main_console_root+"ajax/getDropDownOption.php?id="+store_id+'&mod=DeliveryVanList',
async : false,
success : function(response)
{
$('#deliveryVanDiv').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);
}
//*************************** Image Slider ***************************
function updateSliderCloudinaryImagePath(slider_id)
{
if(slider_id !='' )
{
var dataArr = '&slider_id='+slider_id
console.log(main_console_root+"ajax/admin_detail.php?mod=updateSliderCloudinaryImagePath"+dataArr);
$.ajax({
type : "GET",
url : main_console_root+"ajax/admin_detail.php?mod=updateSliderCloudinaryImagePath"+dataArr,
global: false,
async : false,
success:function(result)
{
var alertMSG = "success@@@@"+"Cloudinary Image Updated Successfully";
getDisplayAlertMsg(alertMSG);
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
}
function checkPercentageNumber(fieldId,event)
{
var charAmount = $('#'+fieldId).val();
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[0].length == '3' || res[1].length > 2) { event.preventDefault(); }
}
else if(res.length == 1)
{
if(charAmount.length > 2)
{
if(charAmount != '100' && charCode != 46) { event.preventDefault(); }
}
}
else { event.preventDefault(); }
if(!(charCode == 46))
{
if (isNaN(String.fromCharCode(event.which))) { event.preventDefault(); }
}
}
function checkAmountNumber(fieldId,event)
{
var charAmount = $('#'+fieldId).val();
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 > 7)
{
if (charCode != 46) { event.preventDefault(); }
}
}
else
{
event.preventDefault();
}
if(!(charCode == 46))
{
if (isNaN(String.fromCharCode(event.which))) { event.preventDefault(); }
}
}
function checkNumaricNumber(fieldId,event)
{
var charAmount = $('#'+fieldId).val();
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)
{
}
else
{
event.preventDefault();
}
if(!(charCode == 46))
{
if (isNaN(String.fromCharCode(event.which))) { event.preventDefault(); }
}
}
//*************************** 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);
}
});
}
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 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 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
//*********************************** Customer Details **********************
// Get Customer Name
function getCustomerName(customer_id)
{
var customer_name = '';
var dataArr = '&customer_id='+customer_id;
$.ajax({
type : "GET",
url : main_console_root+"ajax/customer_detail.php?mod=customerName"+dataArr,
async : false,
success:function(result)
{
customer_name = result;
}
});
return customer_name
}
// Product Details Modal
function viewCustomerDetails(customer_id)
{
var customer_name = getCustomerName(customer_id);
var dataArr = '&customer_id='+customer_id;
var options = {
url: main_console_root+"modal/customer_detail_modal.php?modeType=CustomerDetail"+dataArr,
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 dataArr = '&customer_id='+customer_id;
var options = {
url : main_console_root+"modal/customer_detail_modal.php?modeType=CustomeLoginMapView"+dataArr,
title : 'Customer Login Map View: '+customer_name ,
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true }
],
};
return eModal.ajax(options);
}
//*********************************** Customer Wallet **********************
function customerWalletIdChoose(customer_id)
{
if(customer_id !='')
{
var redirectPath = getRedirectUrlJs('MAIN_CONSOLE_ROOT','module/customer/wallet_history');
console.log(redirectPath);
console.log(main_console_root+"ajax/customer_detail.php?mod=customerWalletIdChoose&customer_id="+customer_id);
$.ajax({
type: "GET",
url : main_console_root+"ajax/customer_detail.php?mod=customerWalletIdChoose&customer_id="+customer_id,
async : false,
success : function(response){ }
});
window.setTimeout(function(){ window.location = redirectPath; });
}
}
function custNewOrder()
{
var options = {
url: main_console_root+"modal/customer_detail_modal.php?modeType=newOrderCustInfo",
title : 'Customer Information',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true },
{text: 'Save', style: 'primary ', close: true, click: validateCustNewOrder }
],
};
return eModal.ajax(options);
}
function validateCustNewOrder()
{
var counter = 1;
var formName = '#newOrdCustForm';
var emailRegex = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/;
var custName = $(formName + " #custName").val();
var custMobile = $(formName + " #custMobile").val();
var custEmail = $(formName + " #custEmail").val();
var custType = $('input[name=custType]:checked', formName).val();
var custCate = $('input[name=custCate]:checked', formName).val();
if(custName =='') { $(formName + " #custName_EBox").html('Please Enter Name'); counter = 0; }
if(custEmail =='') { $(formName + " #custEmail_EBox").html('Please Enter Email'); counter = 0; }
else
{
if(!emailRegex.test(custEmail)) { $(formName + " #custEmail_EBox").html('Please enter a valid Email-ID'); counter = 0; }
}
if(custType === undefined || custType == '') { $(formName + " #custType_EBox").html('Please Select Customer Type'); counter = 0; }
if(custCate === undefined || custCate == '') { $(formName + " #custCate_EBox").html('Please Select Customer Category'); counter = 0; }
if(counter == 0){ return false; }
else
{
custName = encodeURIComponent(custName);
custMobile = encodeURIComponent(custMobile);
custEmail = encodeURIComponent(custEmail);
custType = encodeURIComponent(custType);
custCate = encodeURIComponent(custCate);
var dataArr = '&custName='+custName+'&custMobile='+custMobile+'&custEmail='+custEmail+'&custType='+custType+'&custCate='+custCate;
console.log(main_console_root+"ajax/order_booking_detail.php?mod=updateNewOrderCustInfo"+dataArr);
$.ajax({
type: "GET",
url : main_console_root+"ajax/order_booking_detail.php?mod=updateNewOrderCustInfo"+dataArr,
async : false,
success:function(result) { }
});
var redirectPath = getRedirectUrlJs('MAIN_CONSOLE_ROOT','module/order/order_booking');
window.setTimeout(function(){ window.location = redirectPath; });
}
}
// Get the Customer Details on the Basis of Customer Mobile
function getCustName(formName,fieldName)
{
var mobile = $("#"+formName+" #"+fieldName).val();
console.log(main_console_root+"ajax/order_booking_detail.php?mod=custDetail&mobile="+mobile);
$.ajax({
type : "GET",
url : main_console_root+"ajax/order_booking_detail.php?mod=custDetail&mobile="+mobile,
async : false,
success:function(result)
{
if(result != '')
{
var val = result.split("###");
if(val[0] === undefined) { var name = ''; } else{ var name = val[0].trim(); }
if(val[1] === undefined) { var custType = ''; } else{ var custType = val[1].trim(); }
if(val[2] === undefined) { var custCate = ''; } else{ var custCate = val[2].trim(); }
if(val[3] === undefined) { var email = ''; } else{ var email = val[3].trim(); }
if($("#"+formName+" #custName").length) { $("#"+formName+" #custName").val(name); }
if($("#"+formName+" #custEmail").length) { $("#"+formName+" #custEmail").val(email); }
$("#" + formName + " input[name='custType']").prop("checked", false);
$("#" + formName + " input[name='custCate']").prop("checked", false);
if($("#"+formName+" #custType_"+custType).length) { $("#"+formName+" #custType_"+custType).prop("checked", true); }
if($("#"+formName+" #custCate_"+custCate).length) { $("#"+formName+" #custCate_"+custCate).prop("checked", true); }
}
}
});
}
function getSelectBookingAddress(address_id)
{
if($(".serviceAddressLi").hasClass("selectedAddressLi")) { $(".serviceAddressLi").removeClass("selectedAddressLi"); }
$("#newOrdCustAddressForm #address_"+address_id).addClass("selectedAddressLi");
$("#newOrdCustAddressForm #custAddressId").val(address_id);
var formName = 'newOrdCustAddressForm';
$.ajax({
type : "GET",
url : main_console_root+"ajax/order_booking_detail.php?mod=custAddressDetail&address_id="+address_id,
async : false,
success:function(result)
{
if(result != '')
{
var val = result.split("###");
if(val[0] === undefined) { var address_title = ''; } else{ var address_title = val[0].trim(); }
if(val[1] === undefined) { var address = ''; } else{ var address = val[1].trim(); }
if(val[2] === undefined) { var landmark = ''; } else{ var landmark = val[2].trim(); }
if(val[3] === undefined) { var pincode = ''; } else{ var pincode = val[3].trim(); }
if(val[4] === undefined) { var area_id = ''; } else{ var area_id = val[4].trim(); }
if(val[5] === undefined) { var city_id = ''; } else{ var city_id = val[5].trim(); }
if(val[6] === undefined) { var state_id = ''; } else{ var state_id = val[6].trim(); }
if(val[7] === undefined) { var country_id = ''; } else{ var country_id = val[7].trim(); }
if($("#"+formName+" #addressTitle").length) { $("#"+formName+" #addressTitle").val(address_title); }
if($("#"+formName+" #custAddress").length) { $("#"+formName+" #custAddress").val(address); }
if($("#"+formName+" #custLandmark").length) { $("#"+formName+" #custLandmark").val(landmark); }
if($("#"+formName+" #custPincode").length) { $("#"+formName+" #custPincode").val(pincode); }
if($("#"+formName+" #countryId").length)
{
$("#"+formName+" #countryId").val(country_id);
getActiveStateList(country_id);
}
if($("#"+formName+" #statediv").length)
{
$("#"+formName+" #statediv").val(state_id);
getActiveCityList(state_id);
}
if($("#"+formName+" #citydiv").length)
{
$("#"+formName+" #citydiv").val(city_id);
getActiveAreaList(city_id);
}
if($("#"+formName+" #areadiv").length) { $("#"+formName+" #areadiv").val(area_id); }
}
}
});
}
function updateCustomerType(custType)
{
var listArr = new Array();
var i=0;
$.each($("input[name='chk']:checked"), function()
{
listArr[i] = $(this).val();
i++;
});
if(listArr.length >0 )
{
var dataArr = '&custType='+custType+'&listArr='+listArr;
$.ajax({
type : "GET",
url : main_console_root+"ajax/customer_detail.php?mod=changeCustType"+dataArr,
async : false,
success:function(result)
{
console.log(result);
if(result > 0)
{
var alertMSG = "success@@@@Change Customer Type 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 getCustTypeCategoryModel(custType)
{
var listArr = new Array();
var i=0;
$.each($("input[name='chk']:checked"), function()
{
listArr[i] = $(this).val();
i++;
});
if(listArr.length >0 )
{
var dataArr = '&custType='+custType+'&id='+listArr;
console.log(main_console_root+"modal/customer_detail_modal.php?modeType=custTypeCateModal"+dataArr);
var options = {
url: main_console_root+"modal/customer_detail_modal.php?modeType=custTypeCateModal"+dataArr,
title :'Customer Category',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true },
{text: 'Update', style: 'primary ', close: true, click:updateCustomerTypeCate }
],
};
return eModal.ajax(options);
}
else
{
var alertMSG = "warning@@@@"+"Please Select the Checkbox";
getDisplayAlertMsg(alertMSG);
}
}
function updateCustomerTypeCate()
{
var custType = $("#custTypeCateForm #custType").val();
var custId = $("#custTypeCateForm #custId").val();
var custCate = $('input[name=custCate]:checked', '#custTypeCateForm').val();
var dataArr = '&custType='+custType+'&custCate='+custCate+'&listArr='+custId;
$.ajax({
type : "GET",
url : main_console_root+"ajax/customer_detail.php?mod=changeCustType"+dataArr,
async : false,
success:function(result)
{
console.log(result);
if(result > 0)
{
var alertMSG = "success@@@@Change Customer Type Successfully";
getDisplayAlertMsg(alertMSG);
}
else
{
var alertMSG = "warning@@@@"+result;
getDisplayAlertMsg(alertMSG);
}
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
//*************************** 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 options = {
url: main_console_root+"modal/customer_detail_modal.php?modeType=CustomerCommunicationModal&customerIdList="+customer_id,
title :'Customer Communication :',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true }
],
};
return eModal.ajax(options);
}
//Customer Communication Modal Validate
function validateCustomerCommunication(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;
}
else if(modeType == 'Whatsapp')
{
var customer_id = $("#sendWhatsappForm #customer_id").val();
var whatsappDesc = $("#sendWhatsappForm #whatsappDesc").val();
if(whatsappDesc == ""){ $("#sendWhatsappForm #whatsappDesc").addClass("field-error"); counter = 0; }
var dataArr = 'mod=SendCustomerWhatsapp&customerIdList='+customer_id+'&whatsappDesc='+whatsappDesc;
}
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);
}
}
//*************************** Enquiry Modal ********************************
function viewEnquiryDetails(enquiry_id)
{
var options = {
url: main_console_root+"modal/enquiry_detail_modal.php?modeType=enquiryDetail&enquiry_id="+enquiry_id,
title :'Enquiry Detail',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true }
],
};
return eModal.ajax(options);
}
// Add More Enquiry Reply by Customer
function addCustomerEnquiryReply(enquiry_id)
{
var options = {
url: main_console_root+"modal/enquiry_detail_modal.php?modeType=EnqCustReplyModel&enquiry_id="+enquiry_id,
title :'Customer Reply',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true },
{text: 'Add', style: 'primary ', close: true, click:addCustomerEnquiryComment }
],
};
return eModal.ajax(options);
}
function addCustomerEnquiryComment()
{
var counter = 1;
var formName = '#custEnquiryReply';
var enquiry_id = $(formName +" #enquiry_id").val();
var replyMsg = $(formName +" #replyMsg").val();
if(replyMsg == "") { $(formName +" #custReplyMsg_EBox").html('Please Enter Enquiry Reply'); counter = 0; }
if(counter == 0) { return false; }
else
{
replyMsg = encodeURIComponent(replyMsg);
var dataArr = '&enquiry_id='+enquiry_id+'&replyMsg='+replyMsg;
$.ajax({
type : "GET",
url : main_console_root+"modal/enquiry_detail_modal.php?modeType=AddCustEnquiryComment"+dataArr,
async : false,
success:function(msg)
{
getDisplayAlertMsg(msg);
}
});
window.setTimeout(function(){ window.location.reload(); }, 1000);
}
}
//*************************** Complaint Modal ********************************
function viewComplaintDetails(complaint_id)
{
var options = {
url: main_console_root+"modal/enquiry_detail_modal.php?modeType=ComplaintDetail&complaint_id="+complaint_id,
title :'Complaint Detail',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true }
],
};
return eModal.ajax(options);
}
// Add More Enquiry Reply by Customer
function addCustomerCompaintReply(complaint_id)
{
var options = {
url: main_console_root+"modal/enquiry_detail_modal.php?modeType=CompCustReplyModel&complaint_id="+complaint_id,
title :'Customer Reply',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true },
{text: 'Add', style: 'primary ', close: true, click:addCustomerComplaintComment }
],
};
return eModal.ajax(options);
}
function addCustomerComplaintComment()
{
var counter = 1;
var formName = '#custComplaintReply';
var complaint_id = $(formName +" #complaint_id").val();
var replyMsg = $(formName +" #replyMsg").val();
if(replyMsg == "") { $(formName +" #custReplyMsg_EBox").html('Please Enter Complaint Reply'); counter = 0; }
if(counter == 0) { return false; }
else
{
replyMsg = encodeURIComponent(replyMsg);
var dataArr = '&complaint_id='+complaint_id+'&replyMsg='+replyMsg;
$.ajax({
type : "GET",
url : main_console_root+"modal/enquiry_detail_modal.php?modeType=AddCustComplaintComment"+dataArr,
async : false,
success:function(msg)
{
getDisplayAlertMsg(msg);
}
});
window.setTimeout(function(){ window.location.reload(); }, 1000);
}
}
// ********************** Order Estimation ***********
function custNewOrdEstimate()
{
var options = {
url: main_console_root+"modal/customer_detail_modal.php?modeType=newOrderCustInfo",
title : 'Customer Information',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true },
{text: 'Save', style: 'primary ', close: true, click: validateCustNewOrdEstimate }
],
};
return eModal.ajax(options);
}
function validateCustNewOrdEstimate()
{
var counter = 1;
var formName = '#newOrdCustForm';
var emailRegex = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/;
var custName = $(formName + " #custName").val();
var custMobile = $(formName + " #custMobile").val();
var custEmail = $(formName + " #custEmail").val();
var custType = $('input[name=custType]:checked', formName).val();
var custCate = $('input[name=custCate]:checked', formName).val();
if(custName =='') { $(formName + " #custName_EBox").html('Please Enter Name'); counter = 0; }
if(custEmail =='') { $(formName + " #custEmail_EBox").html('Please Enter Email'); counter = 0; }
else
{
if(!emailRegex.test(custEmail)) { $(formName + " #custEmail_EBox").html('Please enter a valid Email-ID'); counter = 0; }
}
if(custType === undefined || custType == '') { $(formName + " #custType_EBox").html('Please Select Customer Type'); counter = 0; }
if(custCate === undefined || custCate == '') { $(formName + " #custCate_EBox").html('Please Select Customer Category'); counter = 0; }
if(counter == 0){ return false; }
else
{
custName = encodeURIComponent(custName);
custMobile = encodeURIComponent(custMobile);
custEmail = encodeURIComponent(custEmail);
custType = encodeURIComponent(custType);
custCate = encodeURIComponent(custCate);
var dataArr = '&custName='+custName+'&custMobile='+custMobile+'&custEmail='+custEmail+'&custType='+custType+'&custCate='+custCate;
//console.log(main_console_root+"ajax/order_booking_detail.php?mod=updateNewEstimateCustInfo"+dataArr);
$.ajax({
type: "GET",
url : main_console_root+"ajax/order_booking_detail.php?mod=updateNewEstimateCustInfo"+dataArr,
async : false,
success:function(result) { }
});
var redirectPath = getRedirectUrlJs('MAIN_CONSOLE_ROOT','module/order/estimate_booking');
window.setTimeout(function(){ window.location = redirectPath; });
}
}
function convertLeadToCustomer()
{
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/customer_detail.php?mod=leedConvertCustomer&listArr="+listArr,
async : false,
success:function(result)
{
var alertMSG = "success@@@@Converted To Customer Successfully";
getDisplayAlertMsg(alertMSG);
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
else
{
var alertMSG = "warning@@@@"+"Please Select the Checkbox";
getDisplayAlertMsg(alertMSG);
}
}// JavaScript Document
// ************************ Seller Order Detail **************
function viewSellerOrderDetails(order_id)
{
var redirectPath = getRedirectUrlJs('MAIN_CONSOLE_ROOT','module/order/order_detail');
$.ajax({
type: "GET",
url : main_console_root+"ajax/order_detail.php?mod=changeViewSellerOrderId&order_id="+order_id,
async : false,
success : function(response){ }
});
window.setTimeout(function(){ window.location = redirectPath; });
}
function viewEstimateOrderDetails(estimate_id)
{
var redirectPath = getRedirectUrlJs('MAIN_CONSOLE_ROOT','module/order/estimate_order_detail');
$.ajax({
type: "GET",
url : main_console_root+"ajax/order_detail.php?mod=changeViewEstOrderId&estimate_id="+estimate_id,
async : false,
success : function(response){ }
});
window.setTimeout(function(){ window.location = redirectPath; });
}
function orderAddressMapView(order_id)
{
var options = {
url: main_console_root+"modal/order_detail_modal.php?modeType=orderAddressMapView&order_id="+order_id,
title :'Order Address Map View' ,
size: eModal.size.lgs,
buttons: [{text: 'Close', style: 'default ', close: true }],
};
return eModal.ajax(options);
}
function orderStatusChange(order_id,order_status)
{
var dataArr = '&order_id='+order_id+'&order_status='+order_status;
$.ajax({
type: "GET",
url : main_console_root+"ajax/order_detail.php?mod=orderStatusChange"+dataArr,
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 orderGenProductSplit(order_id)
{
var dataArr = '&order_id='+order_id;
$.ajax({
type: "GET",
url : main_console_root+"ajax/order_detail.php?mod=orderProSplit"+dataArr,
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);
}
// ************************ Order Dispatch **************
function orderStatusDispatch(order_id,order_status)
{
var dataArr = '&order_id='+order_id+'&order_status='+order_status;
var options = {
url: main_console_root+"modal/order_detail_modal.php?modeType=orderDispatchedModal"+dataArr,
title :'Order Schedule',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true },
{text: 'Save', style: 'primary ', close: true, click: validateOrderStatusDispatched }
],
};
return eModal.ajax(options);
}
function validateOrderStatusDispatched()
{
var counter = 1;
var order_id = $("#orderDispatchForm #order_id").val();
var order_status = $("#orderDispatchForm #order_status").val();
var tokenNumber = $("#orderDispatchForm #tokenNumber").val();
var dispatchComment = $("#orderDispatchForm #dispatchComment").val();
if(tokenNumber =='') { $("#orderDispatchForm #tokenNumber_EBox").html('Please Dispatch Token Number'); counter = 0; }
if(counter == 0){ return false; }
else
{
dispatchComment = encodeURIComponent(dispatchComment);
var dataArr = '&order_id='+order_id+'&order_status='+order_status+'&tokenNumber='+tokenNumber+'&dispatchComment='+dispatchComment;
$.ajax({
type: "GET",
url : main_console_root+"ajax/order_detail.php?mod=orderStatusChange"+dataArr,
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);
}
}
// ************************ Order Declined **************
function orderStatusCancelled(order_id,order_status)
{
var dataArr = '&order_id='+order_id+'&order_status='+order_status;
var options = {
url: main_console_root+"modal/order_detail_modal.php?modeType=orderDeclinedModal"+dataArr,
title : 'Order Cancelled',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true },
{text: 'Save', style: 'primary ', close: true, click: validateOrderStatusCancelled }
],
};
return eModal.ajax(options);
}
function validateOrderStatusCancelled()
{
var counter = 1;
var order_id = $("#orderDeclinedForm #order_id").val();
var order_status = $("#orderDeclinedForm #order_status").val();
var reasonComment = $("#orderDeclinedForm #reasonComment").val();
if(counter == 0){ return false; }
else
{
reasonComment = encodeURIComponent(reasonComment);
var dataArr = '&order_id='+order_id+'&order_status='+order_status+'&reasonComment='+reasonComment;
console.log(main_console_root+"ajax/order_detail.php?mod=orderStatusChange"+dataArr);
$.ajax({
type: "GET",
url : main_console_root+"ajax/order_detail.php?mod=orderStatusChange"+dataArr,
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 newEestimateOrderEdit(estimate_id)
{
console.log(main_console_root+"ajax/order_booking_detail.php?mod=editNewEstimateOrder&estimate_id="+estimate_id);
$.ajax({
type: "GET",
url : main_console_root+"ajax/order_booking_detail.php?mod=editNewEstimateOrder&estimate_id="+estimate_id,
async : false,
success:function(result)
{
var redirectPath = getRedirectUrlJs('MAIN_CONSOLE_ROOT','module/order/estimate_booking');
window.setTimeout(function(){ window.location = redirectPath; });
}
});
}
function estimateOrderEdit(estimate_id)
{
console.log(main_console_root+"ajax/order_booking_detail.php?mod=editEstimateOrder&estimate_id="+estimate_id);
$.ajax({
type: "GET",
url : main_console_root+"ajax/order_booking_detail.php?mod=editEstimateOrder&estimate_id="+estimate_id,
async : false,
success:function(result)
{
var redirectPath = getRedirectUrlJs('MAIN_CONSOLE_ROOT','module/order/estimate_edit');
window.setTimeout(function(){ window.location = redirectPath; });
}
});
}
function estimationOrdConfirmModal(estimate_id)
{
var dataArr = '&estimate_id='+estimate_id;
var options = {
url: main_console_root+"modal/order_detail_modal.php?modeType=estimatOrdConfirmModal"+dataArr,
title : 'Convert To Order',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true },
{text: 'Save', style: 'primary ', close: true, click: estimateConvertOrder }
],
};
return eModal.ajax(options);
}
function estimateConvertOrder()
{
var counter = 1;
var estimate_id = $("#estOrdConfirmForm #estimate_id").val();
var orderComment = $("#orderDeclinedForm #orderComment").val();
if(counter == 0){ return false; }
else
{
orderComment = encodeURIComponent(orderComment);
var dataArr = '&estimate_id='+estimate_id+'&orderComment='+orderComment;
console.log(main_console_root+"ajax/order_booking_detail.php?mod=orderStatusChange"+dataArr);
$.ajax({
type: "GET",
url : main_console_root+"ajax/order_booking_detail.php?mod=EstimateOrdConvertOrder"+dataArr,
async : false,
success : function(result)
{
var resultArr = result.split('@@@@');
if(resultArr[0] == 1)
{
var redirectPath = getRedirectUrlJs('MAIN_CONSOLE_ROOT','module/order/estimate_order_list');
window.setTimeout(function(){ window.location = redirectPath; });
}
else
{
var alertMSG = "warning@@@@"+resultArr[1];
getDisplayAlertMsg(alertMSG);
}
}
}); ;
}
}
//*****************************************************
function orderProAdminCommentModel(order_id,product_id)
{
var dataArr = '&order_id='+order_id+'&product_id='+product_id;
console.log(main_console_root+"modal/order_detail_modal.php?modeType=ordProAdminCommentModal"+dataArr);
var options = {
url: main_console_root+"modal/order_detail_modal.php?modeType=ordProAdminCommentModal"+dataArr,
title : 'Product Admin Comment',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true },
{text: 'Save', style: 'primary ', close: true, click: validateOrdProStatusComment }
],
};
return eModal.ajax(options);
}
function validateOrdProStatusComment()
{
var counter = 1;
var order_id = $("#adminOrdProCommentForm #order_id").val();
var product_id = $("#adminOrdProCommentForm #product_id").val();
var adminComment = $("#adminOrdProCommentForm #adminComment").val();
var itemRecQty = $("#adminOrdProCommentForm #itemRecQty").val();
if(counter == 0){ return false; }
else
{
adminComment = encodeURIComponent(adminComment);
var dataArr = '&order_id='+order_id+'&product_id='+product_id+'&itemRecQty='+itemRecQty+'&adminComment='+adminComment;
console.log(main_console_root+"ajax/order_booking_detail.php?mod=updateOrdProAdminComment"+dataArr);
$.ajax({
type: "GET",
url : main_console_root+"ajax/order_booking_detail.php?mod=updateOrdProAdminComment"+dataArr,
async : false,
success : function(result)
{
var alertMSG = "success@@@@Status Update Successfully";
getDisplayAlertMsg(alertMSG);
//window.setTimeout(function(){ window.location.reload(); }, 1000);
}
}); ;
}
}
function updateOrdInvoiceDetail(order_id)
{
var dataArr = '&order_id='+order_id;
console.log(main_console_root+"modal/order_detail_modal.php?modeType=ordEditInvoiceModal"+dataArr);
var options = {
url: main_console_root+"modal/order_detail_modal.php?modeType=ordEditInvoiceModal"+dataArr,
title : 'Invoice Detail',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true },
{text: 'Save', style: 'primary ', close: true, click: validateOrdEditInvoice }
],
};
return eModal.ajax(options);
}
function validateOrdEditInvoice()
{
var counter = 1;
var formName = '#ordEditInvoiceDetail';
var order_id = $(formName +" #order_id").val();
var contractNumber = $(formName +" #contractNumber").val();
var contractDate = $(formName +" #contractDate").val();
var contactMobile = $(formName +" #contactMobile").val();
var contactEmail = $(formName +" #contactEmail").val();
var custAddress = $(formName +" #custAddress").val();
var vatCode = $(formName +" #vatCode").val();
var companyCode = $(formName +" #companyCode").val();
var bankName = $(formName +" #bankName").val();
var bankAddress = $(formName +" #bankAddress").val();
var bankIban = $(formName +" #bankIban").val();
var bankSwift = $(formName +" #bankSwift").val();
var performaInvNum = $(formName +" #performaInvNum").val();
var performaInvDate = $(formName +" #performaInvDate").val();
var landingPort = $(formName +" #landingPort").val();
var dischargePort = $(formName +" #dischargePort").val();
var finalDestination = $(formName +" #finalDestination").val();
var freightWeight = $(formName +" #freightWeight").val();
var deliveryTerms = $('input[name=deliveryTerms]:checked', formName).val();
var deliveryPort = $(formName +" #deliveryPort").val();
var deliveryCharges = $(formName +" #deliveryCharges").val();
var paymentTerms = $(formName +" #paymentTerms").val();
var deliveryDesc = $(formName +" #deliveryDesc").val();
var freightDesc = $(formName +" #freightDesc").val();
var rcNum = $(formName +" #rcNum").val();
var nifNum = $(formName +" #nifNum").val();
var nisNum = $(formName +" #nisNum").val();
var naNum = $(formName +" #naNum").val();
var ripNum = $(formName +" #ripNum").val();
var alterDisFlag = $('input[name=alterDisFlag]:checked', formName).val();
var vesselFlightNo = $(formName +" #vesselFlightNo").val();
var shipTo = $(formName +" #shipTo").val();
var preCarriageBy = $(formName +" #preCarriageBy").val();
var exporterRef = $(formName +" #exporterRef").val();
var otherRef = $(formName +" #otherRef").val();
var receiptPreCarrier = $(formName +" #receiptPreCarrier").val();
if(deliveryTerms != 'EX-WORKS' && deliveryPort == '' ) { $(formName +' #deliveryPort_EBox').html('Please Enter Delivery Port'); counter = 0; }
if(counter == 0){ return false; }
else
{
if(deliveryTerms == 'EX-WORKS')
{
deliveryPort = deliveryTerms;
deliveryCharges = 0;
}
var form_data = new FormData();
form_data.append('mod', 'updateOrdInvoice');
form_data.append('order_id', order_id);
form_data.append('contractNumber', contractNumber);
form_data.append('contractDate', contractDate);
form_data.append('contactMobile', contactMobile);
form_data.append('contactEmail', contactEmail);
form_data.append('custAddress', custAddress);
form_data.append('vatCode', vatCode);
form_data.append('companyCode', companyCode);
form_data.append('bankName', bankName);
form_data.append('bankAddress', bankAddress);
form_data.append('bankIban', bankIban);
form_data.append('bankSwift', bankSwift);
form_data.append('performaInvNum', performaInvNum);
form_data.append('performaInvDate', performaInvDate);
form_data.append('landingPort', landingPort);
form_data.append('dischargePort', dischargePort);
form_data.append('finalDestination', finalDestination);
form_data.append('freightWeight', freightWeight);
form_data.append('deliveryPort', deliveryPort);
form_data.append('deliveryCharges', deliveryCharges);
form_data.append('paymentTerms', paymentTerms);
form_data.append('deliveryDesc', deliveryDesc);
form_data.append('freightDesc', freightDesc);
form_data.append('rcNum', rcNum);
form_data.append('nifNum', nifNum);
form_data.append('nisNum', nisNum);
form_data.append('naNum', naNum);
form_data.append('ripNum', ripNum);
form_data.append('alterDisFlag', alterDisFlag);
form_data.append('vesselFlightNo', vesselFlightNo);
form_data.append('shipTo', shipTo);
form_data.append('preCarriageBy', preCarriageBy);
form_data.append('exporterRef', exporterRef);
form_data.append('otherRef', otherRef);
form_data.append('receiptPreCarrier', receiptPreCarrier);
$.ajax({
type : "POST",
url : main_console_root+"ajax/order_booking_detail.php",
async : false,
data : form_data,
cache : false,
contentType : false,
processData :false,
success: function(response)
{
var alertMSG = "success@@@@Detail Update Successfully";
getDisplayAlertMsg(alertMSG);
//window.setTimeout(function(){ window.location.reload(); }, 1000);
}
});
}
}
function custOrderProEdit(order_id)
{
console.log(main_console_root+"ajax/order_booking_detail.php?mod=custOrdProEdit&order_id="+order_id);
$.ajax({
type: "GET",
url : main_console_root+"ajax/order_booking_detail.php?mod=custOrdProEdit&order_id="+order_id,
async : false,
success:function(result)
{
var redirectPath = getRedirectUrlJs('MAIN_CONSOLE_ROOT','module/order/order_edit');
window.setTimeout(function(){ window.location = redirectPath; });
}
});
}
// ************** Order Seler Product Change ******************
function ordProSellerUpdateModel(order_id,product_id)
{
var dataArr = '&order_id='+order_id+'&product_id='+product_id;
console.log(main_console_root+"modal/order_detail_modal.php?modeType=ordProSellerChangeModal"+dataArr);
var options = {
url: main_console_root+"modal/order_detail_modal.php?modeType=ordProSellerChangeModal"+dataArr,
title : 'Product Supplier Change',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true },
{text: 'Save', style: 'primary ', close: true, click: validateOrdProSeller }
],
};
return eModal.ajax(options);
}
function validateOrdProSeller()
{
var counter = 1;
var order_id = $("#ordProSellerUpdateForm #order_id").val();
var product_id = $("#ordProSellerUpdateForm #product_id").val();
var seller_id = $("#ordProSellerUpdateForm #sellerId").val();
if(counter == 0){ return false; }
else
{
var dataArr = '&order_id='+order_id+'&product_id='+product_id+'&seller_id='+seller_id;
console.log(main_console_root+"ajax/order_booking_detail.php?mod=updateOrdProSellerId"+dataArr);
$.ajax({
type: "GET",
url : main_console_root+"ajax/order_booking_detail.php?mod=updateOrdProSellerId"+dataArr,
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(){ window.location.reload(); }, 1000);
}
}); ;
}
}
// ************** Order Seller Product Purchase Price ******************
function updateOrdSellerProPricePrice(order_id,seller_id,product_id)
{
var purchasePrice = $('#selleProPurPrice_'+product_id).val();
var proQty = $('#selleProQty_'+product_id).val();
var totalPurchase = parseFloat(purchasePrice) * parseFloat(proQty);
$('#selleProTotalPurAmt_'+product_id).val(totalPurchase);
var dataArr = '&order_id='+order_id+'&seller_id='+seller_id+'&product_id='+product_id+'&purchasePrice='+purchasePrice;
console.log(main_console_root+"ajax/order_booking_detail.php?mod=updateOrdSellerProPrice"+dataArr);
$.ajax({
type: "GET",
url : main_console_root+"ajax/order_booking_detail.php?mod=updateOrdSellerProPrice"+dataArr,
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);
}
}
});
}
// ************** Order Packing ******************
function addOrderPackingBox(order_id)
{
var dataArr = '&order_id='+order_id;
console.log(main_console_root+"modal/order_detail_modal.php?modeType=orderPackingBoxModal"+dataArr);
var options = {
url: main_console_root+"modal/order_detail_modal.php?modeType=orderPackingBoxModal"+dataArr,
title : 'Box Packing Modal',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true },
{text: 'Save', style: 'primary ', close: true, click: validateOrdPackingBox }
],
};
return eModal.ajax(options);
}
function validateOrdPackingBox()
{
var counter = 1;
var formName = '#addOrdPackingBoxForm';
var order_id = $(formName + " #order_id").val();
var packBoxCount = $(formName + " #packBoxCount").val();
var packBoxType = $('input[name=packBoxType]:checked', formName).val();
var boxDimension = $(formName + " #boxDimension").val();
var packBoxWeight = $(formName + " #packBoxWeight").val();
if(packBoxCount == '') { $(formName + " #packBoxCount_EBox").html('Please Enter Box Count'); counter = 0; }
if(boxDimension == '') { $(formName + " #boxDimension_EBox").html('Please Enter Box Dimension'); counter = 0; }
if(packBoxWeight == '') { $(formName + " #packBoxWeight_EBox").html('Please Enter Box Weight'); counter = 0; }
if(packBoxType === undefined || packBoxType == '') { $(formName +' #packBoxType_EBox').html('Please Select Box Type'); counter = 0; }
if(counter == 0){ return false; }
else
{
var form_data = new FormData();
form_data.append('mod', 'addOrdPackingBox');
form_data.append('order_id', order_id);
form_data.append('packBoxCount', packBoxCount);
form_data.append('packBoxType', packBoxType);
form_data.append('boxDimension', boxDimension);
form_data.append('packBoxWeight', packBoxWeight);
$.ajax({
type : "POST",
url : main_console_root+"ajax/order_booking_detail.php",
async : false,
data : form_data,
cache : false,
contentType : false,
processData :false,
success: function(response)
{
var alertMSG = "success@@@@Packing Box Update Successfully";
getDisplayAlertMsg(alertMSG);
window.setTimeout(function(){ window.location.reload(); }, 1000);
}
});
}
}
//*********************************** Order Box Item **********************
function addOrdPackingBoxItem(order_id,pack_box_id)
{
var dataArr = '&order_id='+order_id+'&pack_box_id='+pack_box_id;
console.log(main_console_root+"ajax/order_booking_detail.php?mod=addOrdPackBoxItem"+dataArr);
$.ajax({
type: "GET",
url : main_console_root+"ajax/order_booking_detail.php?mod=addOrdPackBoxItem"+dataArr,
async : false,
success:function(result)
{
var redirectPath = getRedirectUrlJs('MAIN_CONSOLE_ROOT','module/order/order_packing');
window.setTimeout(function(){ window.location = redirectPath; });
}
});
}
// Product Name Auto Suggestion List
function autoCompletOrdProOemPart(order_id,formName)
{
var min_length = 0;
var keyword = $('#'+formName+' #proOemPart').val();
if (keyword.length > min_length)
{
var dataArr = '&formName='+formName+'&keyword='+keyword+'&order_id='+order_id;
console.log(main_console_root+"ajax/auto_suggestion.php?mod=autoCompleteOrderProOemPart"+dataArr);
$.ajax({
type: "GET",
url : main_console_root+"ajax/auto_suggestion.php?mod=autoCompleteOrderProOemPart"+dataArr,
success : function(response)
{
if(response == "")
{
$('#'+formName+' #autoSuggestProOemList').hide();
}
else
{
$('#'+formName+' #autoSuggestProOemList').show();
$('#'+formName+' #autoSuggestProOemList').html(response);
}
}
});
}
else { $('#'+formName+' #autoSuggestProOemList').hide(); }
}
// Select the Item Name on Auto Suggestion List
function selAutoSuggestOrdProOemPart(product_id,formName)
{
var proName = getProductName(product_id);
$('#'+formName+' #autoSuggestProOemList').hide();
$('#'+formName+' #proOemPart').val(proName);
$('#'+formName+' #saleProId').val(product_id);
}
//******************************
function genOrdCommercialInvoice(order_id)
{
var dataArr = '&order_id='+order_id;
console.log(main_console_root+"ajax/order_booking_detail.php?mod=genOrdCommercialInv"+dataArr);
$.ajax({
type: "GET",
url : main_console_root+"ajax/order_booking_detail.php?mod=genOrdCommercialInv"+dataArr,
async : false,
success:function(result)
{
var alertMSG = "success@@@@Commercial Invoice Update Successfully";
getDisplayAlertMsg(alertMSG);
window.setTimeout(function(){ window.location.reload(); }, 1000);
}
});
}// JavaScript Document
// Get Product Name
function getProductName(product_id)
{
var product_name = '';
if(product_id !='')
{
console.log(main_console_root+"ajax/product_template.php?&mod=getProductName&product_id="+product_id);
$.ajax({
type: "GET",
url : main_console_root+"ajax/product_template.php?&mod=getProductName&product_id="+product_id,
async : false,
success : function(response)
{
product_name = response;
}
});
}
return product_name;
}
// Product Details Modal
function viewProductDetailModal(product_id)
{
var options = {
url: main_console_root+"modal/product_detail_modal.php?modeType=ProductDetail&product_id="+product_id,
title :'Product Details ',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true }
],
};
return eModal.ajax(options);
}
//Get the Active Area List of City
function getSellerBrandList(seller_id)
{
if(seller_id =='All') { seller_id = '';}
$.ajax({
type : "GET",
url : main_console_root+"ajax/getDropDownOption.php?mod=sellerBrandList&id="+seller_id,
async : false,
success : function(response)
{
$('#proBrand').html(response);
}
});
}
//Get the Active Area List of City
function getSellerProMoqList(seller_id)
{
if(seller_id =='All') { seller_id = '';}
$.ajax({
type : "GET",
url : main_console_root+"ajax/getDropDownOption.php?mod=sellerProMoqList&id="+seller_id,
async : false,
success : function(response)
{
$('#proMoqId').html(response);
}
});
}
// ******************* Product Image Upload *********************
function chooseProductImageTagId(product_id)
{
if(product_id !='')
{
var redirectPath = getRedirectUrlJs('MAIN_CONSOLE_ROOT','module/image_upload/product_image');
console.log(main_console_root+"ajax/product_template.php?mod=proImageTagIdChoose&product_id="+product_id);
$.ajax({
type: "GET",
url : main_console_root+"ajax/product_template.php?mod=proImageTagIdChoose&product_id="+product_id,
async : false,
success : function(response){ }
});
window.setTimeout(function(){ window.location = redirectPath; });
}
}
function productImageRemove(product_id,image_id)
{
var dataArr = '&product_id='+product_id+'&image_id='+image_id;
console.log(main_console_root+"ajax/product_template.php?mod=productImageRemove"+dataArr);
$.ajax({
type: "GET",
url : main_console_root+"ajax/product_template.php?mod=productImageRemove"+dataArr,
async : false,
success : function(response){ }
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
function updateProductCloudinaryImagePath(image_id)
{
if(image_id !='' )
{
var dataArr = '&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(result)
{
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);
}
}
function updateProductImageSequence(product_id)
{
var dataArr = '&product_id='+product_id;
console.log(main_console_root+"modal/product_detail_modal.php?modeType=ProductImageSequence"+dataArr);
var options = {
url: main_console_root+"modal/product_detail_modal.php?modeType=ProductImageSequence"+dataArr,
title :'Product Image Sequence',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true },
{text: 'Save', style: 'primary ', close: true, click:validateProductImageSequence }
],
};
return eModal.ajax(options);
}
function validateProductImageSequence()
{
var counter =1;
var formName = '#proImageSequenceForm';
var listArr = new Array();
var i=0;
var lot_product_id = $(formName +" #lot_product_id").val();
var quant = $(formName +" input[name='imageIdArr[]']");
$.each(quant,function(index)
{
var imageId = $(formName +" input[name='imageIdArr[]']").eq(index).val();
var imageSort = $(formName +" input[name='imageSortArr[]']").eq(index).val();
listArr[i] = imageId+'@@'+imageSort;
i++;
});
if(counter == 1)
{
var dataArr = '&lot_product_id='+lot_product_id+'&listArr='+listArr;
console.log(main_console_root+"ajax/product_template.php?mod=updateProImageSortingList"+dataArr);
$.ajax({
type: "GET",
url : main_console_root+"ajax/product_template.php?mod=updateProImageSortingList"+dataArr,
async : false,
success : function(response)
{
getDisplayAlertMsg("success@@@@Image Sorting Successfully");
}
});
//window.setTimeout(function(){ window.location.reload(); }, 1000);
}
else { return false; }
}
// ********************** Import/ Export File **********************
// Get the Product List For Discount tag
function getExportDownloadFilter(fileTypeName)
{
if (fileTypeName === undefined) { fileTypeName = ''; }
if(fileTypeName !='')
{
console.log(main_console_root+"ajax/import_export_detail.php?mod=exportDownloadFilter&fileTypeName="+fileTypeName);
$.ajax({
type : "GET",
url : main_console_root+"ajax/import_export_detail.php?mod=exportDownloadFilter&fileTypeName="+fileTypeName,
async : false,
success:function(response)
{
$('#filterListDiv').html(response);
}
});
}
}
// ********************** Seller Product Detail **********************
function updateSellerProductCloudinaryImagePath(image_id)
{
if(image_id !='' )
{
var dataArr = '&image_id='+image_id
console.log(main_console_root+"ajax/product_template.php?mod=updateSellerProductCloudinaryImagePath"+dataArr);
$.ajax({
type : "GET",
url : main_console_root+"ajax/viewProductDetail.php?mod=updateSellerProductCloudinaryImagePath"+dataArr,
global: false,
async : false,
success:function(result)
{
var alertMSG = "success@@@@"+"Cloudinary Image Updated Successfully";
getDisplayAlertMsg(alertMSG);
}
});
window.open(main_console_root+"ajax/product_template.php?mod=updateSellerProductCloudinaryImagePath"+dataArr, "_blank");
window.setTimeout(function(){ location.reload(); }, 1000);
}
}
// Product Details Modal
function viewSellerProductDetailModal(lot_product_id)
{
var options = {
url: main_console_root+"modal/product_detail_modal.php?modeType=sellerProductDetail&lot_product_id="+lot_product_id,
title :'Product Details ',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true }
],
};
return eModal.ajax(options);
}
//*********************************** Auto Suggestion **********************
// Product Name Auto Suggestion List
function autoCompletProOemPart(formName)
{
var min_length = 0;
var keyword = $('#'+formName+' #proOemPart').val();
if (keyword.length > min_length)
{
var dataArr = '&formName='+formName+'&keyword='+keyword;
console.log(main_console_root+"ajax/auto_suggestion.php?mod=autoCompleteProOemPart"+dataArr);
$.ajax({
type: "GET",
url : main_console_root+"ajax/auto_suggestion.php?mod=autoCompleteProOemPart"+dataArr,
success : function(response)
{
if(response == "")
{
$('#'+formName+' #autoSuggestProOemList').hide();
}
else
{
$('#'+formName+' #autoSuggestProOemList').show();
$('#'+formName+' #autoSuggestProOemList').html(response);
}
}
});
}
else { $('#'+formName+' #autoSuggestProOemList').hide(); }
}
// Select the Item Name on Auto Suggestion List
function selAutoSuggestProOemPart(product_id,formName)
{
var proName = getProductName(product_id);
// hide proposition list
$('#'+formName+' #autoSuggestProNameList').hide();
$('#'+formName+' #proOemPart').val(proName);
$('#'+formName+' #saleProId').val(product_id);
$('#'+formName+' #submit').trigger( "click" );
}
//*********************************** Auto Suggestion **********************
// Product Name Auto Suggestion List
function autoCompletProName(formName)
{
var min_length = 0;
var keyword = $('#'+formName+' #proName').val();
var seller_id = $('#'+formName+' #seller_id').val();
if (keyword.length > min_length)
{
var dataArr = '&formName='+formName+'&seller_id='+seller_id+'&keyword='+keyword;
$.ajax({
type: "GET",
url : main_console_root+"ajax/auto_suggestion.php?mod=autoCompleteProName"+dataArr,
success : function(response)
{
if(response == "")
{
$('#'+formName+' #autoSuggestProNameList').hide();
}
else
{
$('#'+formName+' #autoSuggestProNameList').show();
$('#'+formName+' #autoSuggestProNameList').html(response);
}
}
});
}
else { $('#'+formName+' #autoSuggestProNameList').hide(); }
}
// Select the Item Name on Auto Suggestion List
function selAutoSuggestProName(product_id,formName)
{
var proName = getProductName(product_id);
// hide proposition list
$('#'+formName+' #autoSuggestProNameList').hide();
$('#'+formName+' #proName').val(proName);
}
//**************************************8888
function viewProReviewDescription(review_id)
{
var options = {
url: main_console_root+"modal/product_detail_modal.php?modeType=viewReviewDescription&id="+review_id,
title : 'Review Description',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true },
],
};
return eModal.ajax(options);
}
//**************************************
function createDeepCataloagModel()
{
console.log(main_console_root+"modal/product_detail_modal.php?modeType=deepCatalogModal");
var options = {
url: main_console_root+"modal/product_detail_modal.php?modeType=deepCatalogModal",
title :'Create Deep Catalog',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true },
{text: 'Update', style: 'primary ', close: true, click:validateDeepCatalogName }
],
};
return eModal.ajax(options);
}
function editDeepCataloagModel(id)
{
console.log(main_console_root+"modal/product_detail_modal.php?modeType=deepCatalogModal&id="+id);
var options = {
url: main_console_root+"modal/product_detail_modal.php?modeType=deepCatalogModal&id="+id,
title :'Create Deep Catalog',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true },
{text: 'Update', style: 'primary ', close: true, click:validateDeepCatalogName }
],
};
return eModal.ajax(options);
}
function validateDeepCatalogName()
{
var counter =1;
var formName = '#newDeepCatalogForm';
var imgRegex = new RegExp(IMAGE_REGEX);
var catalogId = $(formName +" #catalogId").val();
var catalogName = $(formName +" #catalogName").val();
var catalogDesc = $(formName +" #catalogDesc").val();
var catalogImage = document.getElementById('catalogImage');
if(catalogName == ""){ $(formName +' #catalogName_EBox').html('Please Enter Deep Catalog Name'); counter = 0; }
for (var i=0; i< catalogImage.files.length; i++)
{
var name = catalogImage.files[i].name.toLowerCase();
if(!imgRegex.test(name))
{
$(formName +" #catalogImage_EBox").html('Please upload Only .jpg, .jpeg, .png file '); counter = 0;
}
}
if(counter == 1)
{
var form_data = new FormData();
form_data.append('mod', 'ProductDeepCatalog');
form_data.append('catalogId', catalogId);
form_data.append('name', catalogName);
form_data.append('desc', catalogDesc);
if(parseInt(catalogImage.files.length) >0)
{
form_data.append('catalogImageFile', catalogImage.files[0]);
}
$.ajax({
type : "POST",
url : main_console_root+"ajax/product_template.php",
async : false,
data : form_data,
cache : false,
contentType : false,
processData :false,
success: function(response)
{
if(response ==1)
{
var redirectPath = main_console_root+"module/product/deep_catalog_add";
window.setTimeout(function(){ window.location = redirectPath;});
}
else
{
$(formName +' #catalogName_EBox').html('Same Catalog Name Already Exists');
return false;
}
}
});
}
else
{
return false;
}
}
function updateDeepCatalogProduct()
{
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/product_template.php?mod=updateDeepCatalog&listArr="+listArr);
$.ajax({
type : "GET",
url : main_console_root+"ajax/product_template.php?mod=updateDeepCatalog&listArr="+listArr,
async : false,
success:function(result)
{
console.log(result);
if(result > 0)
{
var alertMSG = "success@@@@Deep Catalog Update Successfully";
getDisplayAlertMsg(alertMSG);
}
else
{
var alertMSG = "warning@@@@"+result;
getDisplayAlertMsg(alertMSG);
}
}
});
var redirectPath = main_console_root+"module/product/deep_catalog_list";
window.setTimeout(function(){ window.location = redirectPath;});
}
else
{
var alertMSG = "warning@@@@"+"Please Select the Checkbox";
getDisplayAlertMsg(alertMSG);
}
}
//*****************
function updateProCatalogImgFlag(product_id,image_id,flagStatus)
{
var dataArr = '&product_id='+product_id+'&image_id='+image_id+'&flagStatus='+flagStatus
console.log(main_console_root+"ajax/product_template.php?mod=updateProImgCatalogFlag"+dataArr);
$.ajax({
type : "GET",
url : main_console_root+"ajax/product_template.php?mod=updateProImgCatalogFlag"+dataArr,
global: false,
async : false,
success:function(result)
{
var alertMSG = "success@@@@"+"Catalog Image Updated Successfully";
getDisplayAlertMsg(alertMSG);
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
function updateMasterProUsdPrice()
{
console.log(main_console_root+"ajax/product_template.php?&mod=updateMstProUsdPrice");
$.ajax({
type: "GET",
url : main_console_root+"ajax/product_template.php?&mod=updateMstProUsdPrice",
async : false,
success : function()
{
var alertMSG = "success@@@@Record Update Successfully";
getDisplayAlertMsg(alertMSG);
}
});
}
//********************** Product Seller ***************
function productSellerUpdate()
{
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=proSellerModal&proIdList="+listArr,
title :'Disable Reason',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true },
{text: 'Save', style: 'primary ', close: true, click: validateProductUpdateSellerBox }
],
};
return eModal.ajax(options);
}
else
{
var alertMSG = "warning@@@@"+"Please Select the Checkbox";
getDisplayAlertMsg(alertMSG);
}
}
function validateProductUpdateSellerBox()
{
var counter = 1;
var proIdList = $("#proSellerUpdateForm #proIdList").val();
var sellerId = $("#proSellerUpdateForm #sellerId").val();
if(sellerId == "" || sellerId == 'All') { $("#proSellerUpdateForm #sellerId_EBox").html('Please Select Seller Name'); counter = 0; }
if(counter == 0) { return false; }
else
{
var dataArr = '&sellerId='+sellerId+'&proIdList='+proIdList
$.ajax({
type : "GET",
url : main_console_root+"ajax/product_template.php?mod=updateProSellerId"+dataArr,
async : false,
success:function(result)
{
var alertMSG = "success@@@@Record Update Successfully";
getDisplayAlertMsg(alertMSG);
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
}
//********************** Product Meta tag ***************
function updateAllProMetaTagModal()
{
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=proMetaTagModal&proIdList="+listArr,
title :'Disable Reason',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true },
{text: 'Save', style: 'primary ', close: true, click: validateProMetaTag }
],
};
return eModal.ajax(options);
}
else
{
var alertMSG = "warning@@@@"+"Please Select the Checkbox";
getDisplayAlertMsg(alertMSG);
}
}
function updateProMetaTagModal(product_id)
{
var options = {
url: main_console_root+"modal/approval_deny_modal.php?modeType=proMetaTagModal&proIdList="+product_id,
title :'Disable Reason',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true },
{text: 'Save', style: 'primary ', close: true, click: validateProMetaTag }
],
};
return eModal.ajax(options);
}
function validateProMetaTag()
{
var counter = 1;
var proIdList = $("#proUpdateMetaTagForm #proIdList").val();
var proMetaTag = $("#proUpdateMetaTagForm #proMetaTag").val();
if(counter == 0) { return false; }
else
{
var dataArr = '&proIdList='+proIdList+'&proMetaTag='+proMetaTag;
$.ajax({
type : "GET",
url : main_console_root+"ajax/product_template.php?mod=updateProMetaTag"+dataArr,
async : false,
success:function(result)
{
var alertMSG = "success@@@@Product Meta Update Successfully";
getDisplayAlertMsg(alertMSG);
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
}
// JavaScript Document
function getSellerPanelLogin(seller_id)
{
var loginPath = main_console_root+"ajax/seller_login.php?mod=sellerLogin&seller_id="+seller_id;
window.open(loginPath);
//window.setTimeout(function(){ window.location = loginPath; });
}
//*********************************** Seller Registraion Approval **********************
function sellerRegApprovedStatus(seller_id)
{
var dataArr = '&listArr='+seller_id+'&status=1';
$.ajax({
type : "GET",
url : main_console_root+"ajax/approval_records.php?mod=SellerRegistrationApproval"+dataArr,
async : false,
success:function(result)
{
var resultArr = result.split('@@@@');
if(resultArr[0] > 0)
{
var alertMSG = "success@@@@"+resultArr[1];
getDisplayAlertMsg(alertMSG);
}
}
});
window.setTimeout(function(){ location.reload(); }, 1000);
}
function viewSellerDetails(seller_id)
{
var dataArr = '&seller_id='+seller_id;
var options = {
url: main_console_root+"modal/store_detail_modal.php?modeType=sellerDetail"+dataArr,
title :'Seller Details',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true }
],
};
return eModal.ajax(options);
}
//*************************** Communication Modal ********************************
function allSellerCommunicationModal()
{
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/store_detail_modal.php?modeType=StoreCommunicationModal&sellerIdList="+listArr,
title :'Store 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 viewSellerCommunicatinModal(customer_id)
{
var options = {
url: main_console_root+"modal/store_detail_modal.php?modeType=StoreCommunicationModal&sellerIdList="+customer_id,
title :'Seller Communication :',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true }
],
};
return eModal.ajax(options);
}
//Customer Communication Modal Validate
function validateSellerCommunication(modeType)
{
var counter = 1;
var dataArr = '';
if(modeType == 'Email')
{
var seller_id = $("#sendEmailForm #seller_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=SendSellerEmail&sellerIdList='+seller_id+'&emailSubject='+emailSubject+'&emailDesc='+emailDesc;
}
else if(modeType == 'Sms')
{
var seller_id = $("#sendSmsForm #seller_id").val();
var smsDesc = $("#sendSmsForm #smsDesc").val();
if(smsDesc == ""){ $("#sendSmsForm #smsDesc").addClass("field-error"); counter = 0; }
var dataArr = 'mod=SendSellerSms&sellerIdList='+seller_id+'&smsDesc='+smsDesc;
}
else if(modeType == 'Notify')
{
var seller_id = $("#sendNotifyForm #seller_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=SendSellerNotify&sellerIdList='+seller_id+'¬ifyTitle='+notifyTitle+'¬ifyDesc='+notifyDesc+'&imageSend='+imageSend;
}
else if(modeType == 'Whatsapp')
{
var seller_id = $("#sendWhatsappForm #seller_id").val();
var whatsappDesc = $("#sendWhatsappForm #whatsappDesc").val();
if(whatsappDesc == ""){ $("#sendWhatsappForm #whatsappDesc").addClass("field-error"); counter = 0; }
var dataArr = 'mod=SendSellerWhatsapp&sellerIdList='+seller_id+'&whatsappDesc='+whatsappDesc;
}
if(counter == 0) { return false; }
else
{
$.ajax({
type : "GET",
url : main_console_root+"ajax/seller_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);
}
}
// JavaScript Document
function viewCouponDetail(coupon_id)
{
console.log(main_console_root+"modal/product_detail_modal.php?modeType=ViewCouponDetail&coupon_id="+coupon_id);
var options = {
url: main_console_root+"modal/product_detail_modal.php?modeType=ViewCouponDetail&coupon_id="+coupon_id,
title :'Coupon Details ',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true }
],
};
return eModal.ajax(options);
}
function viewCouponHistory(coupon_id)
{
console.log(main_console_root+"modal/product_detail_modal.php?modeType=ViewCouponHistory&coupon_id="+coupon_id);
var options = {
url: main_console_root+"modal/product_detail_modal.php?modeType=ViewCouponHistory&coupon_id="+coupon_id,
title :'Coupon History Details ',
size: eModal.size.lgs,
buttons: [
{text: 'Close', style: 'default ', close: true }
],
};
return eModal.ajax(options);
}
Fatal error: Uncaught Error: Call to undefined function include123() in /home/insidereal/happy.sidereal.in/include/allScriptFile.php:12
Stack trace:
#0 {main}
thrown in /home/insidereal/happy.sidereal.in/include/allScriptFile.php on line 12