nav cart error fix
This commit is contained in:
Vendored
+1
-1
@@ -4,7 +4,7 @@ function navINIT() {
|
||||
loadCart();
|
||||
function loadHelper(src = './dist/js/utils/helpers.js'){
|
||||
if ($(`script[src="${src}"]`).length > 0) {
|
||||
return new Promise((resolve) => resolve);
|
||||
return new Promise((resolve) => resolve());
|
||||
}
|
||||
return new Promise(function (resolve, reject) {
|
||||
var s;
|
||||
|
||||
+68
-17
@@ -4,8 +4,10 @@ function initSelectDevlivery() {
|
||||
let currencyId = null;
|
||||
let billingInfo = null;
|
||||
let userName = null;
|
||||
let stateArr = [];
|
||||
|
||||
$('.mianselectdelivery').removeClass('d-none');
|
||||
|
||||
|
||||
let orderBtnAction = {
|
||||
removeOrdernowBtn() {
|
||||
@@ -98,6 +100,39 @@ function initSelectDevlivery() {
|
||||
|
||||
}
|
||||
|
||||
function clearAllInputs(){
|
||||
$("#state").select2({
|
||||
placeholder: "Select a City",
|
||||
allowClear: true
|
||||
});
|
||||
|
||||
$('#phonenumber').val(null);
|
||||
$('#addressdes').val(null);
|
||||
$('#zipcode').val(null);
|
||||
}
|
||||
|
||||
async function appendFormDetails(){
|
||||
let cookieRes = COOKIE_HELPER_ACTIONS.getCookie();
|
||||
console.log(cookieRes);
|
||||
const { errorMsg, isError, response } = await API_SERVICES_ACTIONS.getAPIService(`apis/v4/bizgaze/integrations/products/getbillinginfo/contactid/${cookieRes.userId}`);
|
||||
let res = JSON.parse(response.result)[0];
|
||||
debugger;
|
||||
const {cityid, lobid,organizationname,addressline,cityname,phonenumber,zipcode,name } =res;
|
||||
|
||||
setAddressHeader({name:organizationname,phonenumber,addressline,cityname,zipcode});
|
||||
|
||||
$('#phonenumber').val(phonenumber);
|
||||
$('#addressdes').val(addressline);
|
||||
$('#zipcode').val(zipcode);
|
||||
debugger;
|
||||
$('.userNamelogin').html(`${userName}`);
|
||||
|
||||
editMode = true;
|
||||
console.log(stateArr);
|
||||
renderStates(stateArr);
|
||||
|
||||
}
|
||||
|
||||
async function getAddressRes() {
|
||||
let cookieRes = COOKIE_HELPER_ACTIONS.getCookie();
|
||||
console.log(cookieRes);
|
||||
@@ -263,6 +298,8 @@ function initSelectDevlivery() {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
async function loadEvents() {
|
||||
$('.addnewAddressContainer').off('click').click(function (e) {
|
||||
$('.addnewAddressContainer').addClass('d-none');
|
||||
@@ -285,8 +322,19 @@ function initSelectDevlivery() {
|
||||
paymentContainerAction.paymentContainerAdd();
|
||||
$('.displayadress').removeClass('d-none');
|
||||
}
|
||||
|
||||
clearAllInputs();
|
||||
});
|
||||
|
||||
$('.changeAddressBtn').off('click').click(function (e){
|
||||
console.log(e.target);
|
||||
//getAddressRes();
|
||||
appendFormDetails();
|
||||
removeOrderSummary();
|
||||
changeAddressBtnAction.removeChangeAddressBtn();
|
||||
$('.displayadress').addClass('d-none')
|
||||
})
|
||||
|
||||
|
||||
$('.saveanddeliver').off('click').click(async function (e) {
|
||||
|
||||
@@ -338,12 +386,7 @@ function initSelectDevlivery() {
|
||||
|
||||
|
||||
});
|
||||
$('.changeAddressBtn').off('click').click(function (e){
|
||||
console.log(e.target);
|
||||
removeOrderSummary();
|
||||
changeAddressBtnAction.removeChangeAddressBtn();
|
||||
$('.displayadress').addClass('d-none')
|
||||
})
|
||||
|
||||
|
||||
$('.ordernowbtn').off().click(async function (e){
|
||||
let cookieRes = COOKIE_HELPER_ACTIONS.getCookie();
|
||||
@@ -488,6 +531,21 @@ function initSelectDevlivery() {
|
||||
|
||||
}
|
||||
|
||||
function renderStates(data){
|
||||
$('#state').off('select2:select');
|
||||
let html = '';
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
html += `<option value="${data[i].cityid}" data-id="${data[i].cityid}">${data[i].cityname}</option>`
|
||||
|
||||
}
|
||||
|
||||
$('#state').append(html);
|
||||
$("#state").select2({
|
||||
placeholder: "Select a City",
|
||||
allowClear: true
|
||||
});
|
||||
}
|
||||
|
||||
async function getCountryStateCurrency() {
|
||||
const countryRes = await API_SERVICES_ACTIONS.getAPIService('apis/v4/bizgaze/integrations/products/getcountry');;
|
||||
|
||||
@@ -527,17 +585,10 @@ function initSelectDevlivery() {
|
||||
console.log("start")
|
||||
let html = '';
|
||||
statesList = stateData;
|
||||
for (let i = 0; i < stateData.length; i++) {
|
||||
html += `<option value="${stateData[i].cityid}" data-id="${stateData[i].cityid}">${stateData[i].cityname}</option>`
|
||||
stateArr = stateData;
|
||||
renderStates(stateArr)
|
||||
|
||||
}
|
||||
|
||||
$('#state').append(html);
|
||||
|
||||
$("#state").select2({
|
||||
placeholder: "Select a City",
|
||||
allowClear: true
|
||||
});
|
||||
|
||||
|
||||
const currencyRes = await API_SERVICES_ACTIONS.getAPIService('apis/v4/bizgaze/integrations/products/getcurrencies');
|
||||
|
||||
@@ -580,7 +631,7 @@ debugger;
|
||||
<input checked data-op="online" name="payment" type="radio" class="paymentbtn " id="online">
|
||||
</label>
|
||||
<label for="cod">
|
||||
Cash on develiop
|
||||
Cash on delivery
|
||||
<input data-op="cod" name="payment" type="radio" class="paymentbtn " id="cod">
|
||||
</label>`);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user