diff --git a/dist/Js/auth/apiservice.js b/dist/Js/auth/apiservice.js index f6c901b..bd08f3b 100644 --- a/dist/Js/auth/apiservice.js +++ b/dist/Js/auth/apiservice.js @@ -149,6 +149,10 @@ class API_SERVICE_CLASS{ if(response.data.code != '0'){ return failureResFun(response.data) } + + if(response.data.errors?.length){ + return failureResFun(response.data) + } return successResFun(response.data) } catch (error) { diff --git a/dist/Js/navbar.js b/dist/Js/navbar.js index 4ccf338..1d7e574 100644 --- a/dist/Js/navbar.js +++ b/dist/Js/navbar.js @@ -1,5 +1,50 @@ -let nav_html = ` -
+navINIT(); + +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(function (resolve, reject) { + var s; + s = document.createElement('script'); + s.src = src; + s.onload = resolve; + s.onerror = reject; + document.head.appendChild(s); + }); + } + async function loadCart(){ + + let files = ['./dist/js/shoppingcart/addtocart.js']; + await loadHelper(); + for(let i=0;i 0) { + continue; + } + try { + + await loadHelper(files[i]) + console.log("done"); + + } catch (error) { + console.log(error); + return; + } + } + + setLengthCart(); + //console.log("hello"); + + + + + } + let URLNAMENAV = window.location.href; + const isTransparent = URLNAMENAV.includes('login')||URLNAMENAV.includes('orderconfirmation'); + let nav_html = ` +
`; -$("#navbar-head").html(nav_html); -let width = $(window).width(); -$(".menu-negative-mrg2,.menu-negative-mrg3,.menu-negative-mrg4").css("width",width); - let ele_page = $("body").hasClass("product_pg"); - if(ele_page == true){ - $(".header-area").removeClass("bg-white"); - $(".main-menu").find("nav ul li a").addClass("text-white"); - $(".header-bottom.sticky-bar").removeClass("sticky-bar"); - let src =`../dist/assets/imgs/anwi-logo-2.png`; - $(".logo-menu-wrap").find("a img").attr("src",src); - $(".main-body").find("iframe").attr("width",width); - if (width <= 575 && width >= 390) { - $(".main-body").find("iframe").attr({ - width: width, - height: 236, - }) - } else if(width <= 390 && width >= 270){ - $(".main-body").find("iframe").attr({ - width: width, - height: 210, - }); - } else if (width <= 998 && width > 575) { - $(".main-body").find("iframe").attr({ - width: width, - height: 530, - }); - } else if(width <= 2720 && width > 1920){ - $(".main-body").find("iframe").attr({ - width: width, - height: 1440, - }); - }else { - $(".main-body").find("iframe").attr({ - width: width, - height: 860, - }); - } - } - - -$("a.ram_data").click(function () { - let item_id = $(this).attr("accessories_id"); - let loc_path = '/products.html' - if (window.location.pathname.includes(loc_path)) { - window.location.href = `?itemid=${item_id}` - } - else { - window.location.href = `/products.html#itemid=${item_id}`; - } -}) - - -$(".main-menu nav ul").find("li").each(function(){ - var current = window.location.pathname; - var $this = $(this).find("a"); - if(current != "/"){ - if($this.attr('href').indexOf(current) !== -1){ - $(this).addClass('active_nav'); + $("#navbar-head").html(nav_html); + let width = $(window).width(); + $(".menu-negative-mrg2,.menu-negative-mrg3,.menu-negative-mrg4").css("width", width); + let ele_page = $("body").hasClass("product_pg"); + if (ele_page == true) { + $(".header-area").removeClass("bg-white"); + $(".main-menu").find("nav ul li a").addClass("text-white"); + $(".header-bottom.sticky-bar").removeClass("sticky-bar"); + let src = `../dist/assets/imgs/anwi-logo-2.png`; + $(".logo-menu-wrap").find("a img").attr("src", src); + $(".main-body").find("iframe").attr("width", width); + if (width <= 575 && width >= 390) { + $(".main-body").find("iframe").attr({ + width: width, + height: 236, + }) + } else if (width <= 390 && width >= 270) { + $(".main-body").find("iframe").attr({ + width: width, + height: 210, + }); + } else if (width <= 998 && width > 575) { + $(".main-body").find("iframe").attr({ + width: width, + height: 530, + }); + } else if (width <= 2720 && width > 1920) { + $(".main-body").find("iframe").attr({ + width: width, + height: 1440, + }); + } else { + $(".main-body").find("iframe").attr({ + width: width, + height: 860, + }); } } - -}) - -// destroy localstorage data -let loc_path = '/productdetails.html'; -if (window.location.pathname.includes(loc_path) === false) { - localStorage.removeItem("product_data"); - localStorage.removeItem("top_data") -} -//services pages links and sources - -let $body_pg = $("body").hasClass("services_page"); -let $hm_pg = "../index.html"; -let $nav_img ="../dist/assets/imgs/anwi-logo-1.png"; -let $footer_img = "../dist/assets/imgs/anwi-logo-2.png"; -let $scrool_top_img = "../dist/assets/imgs/Home/rocket-footer.png"; - -if($body_pg == true){ -$(".header-large-device").find(".logo-menu-wrap .logo").find("a").attr("href",$hm_pg); -$(".header-large-device").find(".logo-menu-wrap .logo").find("a img").attr("src",$nav_img); -$(".mobile-logo").find("a").attr("href",$hm_pg); -$(".mobile-logo").find("a img").attr("src",$nav_img); - $(".main-menu").find("nav ul").find("li a").each(function(){ - let $arc = $(this).attr("href"); - let $spcial_char = $arc.includes("./"); - if($spcial_char === true){ - let $refarence = `.${$arc}` - $(this).attr("href",$refarence); + $("a.ram_data").click(function () { + let item_id = $(this).attr("accessories_id"); + let loc_path = '/products.html' + if (window.location.pathname.includes(loc_path)) { + window.location.href = `?itemid=${item_id}` } - $(".same-style").find("a").each(function(){ - let $arc1 = $(this).attr("href"); - let $spcial_char1 = $arc1.includes("./"); - if($spcial_char1 === true){ - let $refarence1 = `.${$arc1}` - $(this).attr("href",$refarence1); + else { + window.location.href = `/products.html#itemid=${item_id}`; + } + }) + + + $(".main-menu nav ul").find("li").each(function () { + var current = window.location.pathname; + var $this = $(this).find("a"); + if (current != "/") { + if ($this.attr('href').indexOf(current) !== -1) { + $(this).addClass('active_nav'); } - }) - }); - $(".clickable-mainmenu-wrap").find("nav ul").find("li a").each(function(){ - let $arc_mbil = $(this).attr("href"); - let $spcial_char_mbil = $arc_mbil.includes("./"); - if($spcial_char_mbil === true){ - let $refarence_mbil = `.${$arc_mbil}` - $(this).attr("href",$refarence_mbil); } - }); + + }) + + // destroy localstorage data + let loc_path = '/productdetails.html'; + if (window.location.pathname.includes(loc_path) === false) { + localStorage.removeItem("product_data"); + localStorage.removeItem("top_data") + } + + + //services pages links and sources + + let $body_pg = $("body").hasClass("services_page"); + let $hm_pg = "../index.html"; + let $nav_img = "../dist/assets/imgs/anwi-logo-1.png"; + let $footer_img = "../dist/assets/imgs/anwi-logo-2.png"; + let $scrool_top_img = "../dist/assets/imgs/Home/rocket-footer.png"; + + if ($body_pg == true) { + $(".header-large-device").find(".logo-menu-wrap .logo").find("a").attr("href", $hm_pg); + $(".header-large-device").find(".logo-menu-wrap .logo").find("a img").attr("src", $nav_img); + $(".mobile-logo").find("a").attr("href", $hm_pg); + $(".mobile-logo").find("a img").attr("src", $nav_img); + $(".main-menu").find("nav ul").find("li a").each(function () { + let $arc = $(this).attr("href"); + let $spcial_char = $arc.includes("./"); + if ($spcial_char === true) { + let $refarence = `.${$arc}` + $(this).attr("href", $refarence); + } + $(".same-style").find("a").each(function () { + let $arc1 = $(this).attr("href"); + let $spcial_char1 = $arc1.includes("./"); + if ($spcial_char1 === true) { + let $refarence1 = `.${$arc1}` + $(this).attr("href", $refarence1); + } + }) + }); + $(".clickable-mainmenu-wrap").find("nav ul").find("li a").each(function () { + let $arc_mbil = $(this).attr("href"); + let $spcial_char_mbil = $arc_mbil.includes("./"); + if ($spcial_char_mbil === true) { + let $refarence_mbil = `.${$arc_mbil}` + $(this).attr("href", $refarence_mbil); + } + }); + } } \ No newline at end of file diff --git a/dist/Js/orderconfirmation.js b/dist/Js/orderconfirmation.js index 86d7c91..e928a86 100644 --- a/dist/Js/orderconfirmation.js +++ b/dist/Js/orderconfirmation.js @@ -5,10 +5,13 @@ function orderConfirmation(){ getOrderStatus(); } - function orderlistsummary({name,price,qty,total}){ + function orderlistsummary({name,price,qty,total,img}){ let priceAmt = ''; let totalAmt = ''; + let defaultImg =img ? imgServerNameBuild(img): `./dist/assets/imgs/nophoto.png`; + +debugger; let [priceSysm,priceamt] = getCurrencySymbol(price) priceAmt = `${priceSysm}${priceamt}` @@ -20,6 +23,16 @@ function orderConfirmation(){ totalAmt = `${qtySymb}${qtyamt}` + return `
+ +
+
+
${name}
+
Unit Price :${priceAmt}
+
Quantity :${qty}
+
Total Amount : ${totalAmt}
+
`; + return `
@@ -112,12 +125,14 @@ function orderConfirmation(){ let orderItemsListHTML = ''; for(let i=0;i img').attr('src',defaultImg); + updateItemId(obj.itemid); } function searchComb(){ @@ -229,6 +240,8 @@ debugger; itemsName += ` ${$(e).html().trim()}`; }); + updateItemId(null); + specification_wrap_action.remove(); $('#skudetailitem').val(-1) $('.productname').html(itemsName) @@ -449,7 +462,7 @@ debugger; tagnames = tagnames.split('|'); $('.optiontaganwi').removeClass('borderselector'); currentComb = itemtagscombinationRes[0]; - + // updateItemId(itemtagscombinationRes[0].itemid); for(let i=0;i
- +
diff --git a/dist/Js/shoppingcart/addtocart.js b/dist/Js/shoppingcart/addtocart.js index 287297b..2fbd876 100644 --- a/dist/Js/shoppingcart/addtocart.js +++ b/dist/Js/shoppingcart/addtocart.js @@ -105,7 +105,7 @@ function updateSummaryPriceAdd(){ } function initAddToCart(){ - +debugger; addEventListeners(); function addToCartFun(){ @@ -124,7 +124,9 @@ function initAddToCart(){ quantity:$('#quantity').val(), img:$('.productDetailsMain img').attr('src'), sku:$('#skudetailitem').val(), - totalQty:qty + totalQty:qty, + productid:$('#productidtag').val(), + itemid:$('#itemidtag').val() } @@ -149,7 +151,9 @@ function initAddToCart(){ quantity: parseInt(data[sku].quantity)+parseInt(quantity), img:img, sku:sku, - totalQty:qty + totalQty:qty, + productid:$('#productidtag').val(), + itemid:$('#itemidtag').val() } addtoCart(data); }else{ @@ -159,13 +163,15 @@ function initAddToCart(){ quantity:parseInt(quantity), img:img, sku:sku, - totalQty:qty + totalQty:qty, + productid:$('#productidtag').val(), + itemid:$('#itemidtag').val() } addtoCart(data); } } - +debugger; setLengthCart(); } diff --git a/dist/Js/shoppingcart/shoppingcart.js b/dist/Js/shoppingcart/shoppingcart.js index bee9d1d..bad0ad5 100644 --- a/dist/Js/shoppingcart/shoppingcart.js +++ b/dist/Js/shoppingcart/shoppingcart.js @@ -4,6 +4,7 @@ debugger; function shoppingCartInit() { shoppingCartAppend(); + let DELETE_FILTER = null; let insufficientQtyActions = { moreQtyAdd(e){ @@ -40,6 +41,7 @@ function shoppingCartInit() { $('.emptyShow').removeClass('d-none'); } setLengthCart(); + console.log(products,'products'); for (let product in products) { html += shoppingCartDesktopHTML({ ...products[product], total: products[product].quantity * products[product].price, id: product }); @@ -118,6 +120,26 @@ function shoppingCartInit() { } }); + $('.removeitemcartmodal').off('click').click(function (){ + + + setCartData( DELETE_FILTER ); + setLengthCart(); + shoppingCartAppend(); + + let len = Object.keys(DELETE_FILTER).length + if(!len){ + + $('.checkoutbtn').addClass('d-none'); + $('.emptyShow').removeClass('d-none'); + }else{ + $('.checkoutbtn').removeClass('d-none'); + $('.emptyShow').addClass('d-none'); + } + + + }); + $('.btndeletecart').each(function (i, element) { $(element).click(function (e) { const cardId = $(e.target).data('cartid'); @@ -127,24 +149,20 @@ function shoppingCartInit() { debugger; const products = data; const productsFilter = {}; + + $('#modalremovecart').html(products[cardId].name); for (let product in products) { if (product != cardId) productsFilter[product] = products[product]; } data = productsFilter; - let len = Object.keys(data).length - if(!len){ - $('.checkoutbtn').addClass('d-none'); - $('.emptyShow').removeClass('d-none'); - }else{ - $('.checkoutbtn').removeClass('d-none'); - $('.emptyShow').addClass('d-none'); - } - setCartData(data); - setLengthCart(); - shoppingCartAppend(); + console.log(data); + DELETE_FILTER = data; + // setCartData(data); + // setLengthCart(); + // shoppingCartAppend(); }); }); @@ -199,14 +217,14 @@ function shoppingCartInit() {
` } - function shoppingCartDesktopHTML({ id, img, name, price, description, quantity, total,totalQty }) { + function shoppingCartDesktopHTML({ id, img, name, price, description, quantity, total,totalQty,productid,itemid }) { const [currencySymbol,amt] = getCurrencySymbol(price); return `
${name}
- ${name} + ${name} ${description||''} 8 Offers >
@@ -222,7 +240,7 @@ function shoppingCartInit() {

${total}

- x + x
diff --git a/dist/Js/utils/helpers.js b/dist/Js/utils/helpers.js index 227fd20..1674eb8 100644 --- a/dist/Js/utils/helpers.js +++ b/dist/Js/utils/helpers.js @@ -3,6 +3,17 @@ const uid = function(){ return Date.now().toString(36) + Math.random().toString(36).substr(2); } +function loadScript(src) { + return new Promise(function (resolve, reject) { + var s; + s = document.createElement('script'); + s.src = src; + s.onload = resolve; + s.onerror = reject; + document.head.appendChild(s); + }); +} + function shuffleArray(array) { for (let i = array.length - 1; i > 0; i--) { @@ -29,24 +40,27 @@ function getCurrencySymbol(value=0) { function toasterHelper(type,message){ // toasterOpts() + debugger; + toasterOpts(); Command: toastr[type](message); + function toasterOpts(){ toastr.options = { - "closeButton": true, - "debug": false, - "newestOnTop": true, - "progressBar": true, - "positionClass": "toast-top-center", - "preventDuplicates": true, - "onclick": null, - "showDuration": "300", - "hideDuration": "1000", - "timeOut": "5000", - "extendedTimeOut": "1000", - "showEasing": "swing", - "hideEasing": "linear", - "showMethod": "fadeIn", - "hideMethod": "fadeOut" + "closeButton": true, + "debug": false, + "newestOnTop": true, + "progressBar": true, + "positionClass": "toast-top-center", + "preventDuplicates": true, + "onclick": null, + "showDuration": "300", + "hideDuration": "1000", + "timeOut": "5000", + "extendedTimeOut": "1000", + "showEasing": "swing", + "hideEasing": "linear", + "showMethod": "fadeIn", + "hideMethod": "fadeOut" } } } \ No newline at end of file diff --git a/index1.html b/index1.html index 6ca5f74..beb4585 100644 --- a/index1.html +++ b/index1.html @@ -298,13 +298,16 @@ + + + - + - + diff --git a/login.html b/login.html index eac1173..9cbfd7b 100644 --- a/login.html +++ b/login.html @@ -562,6 +562,8 @@ + + @@ -583,7 +585,7 @@ - + diff --git a/orderconfirmation.html b/orderconfirmation.html index 76c51a3..2bb4ae0 100644 --- a/orderconfirmation.html +++ b/orderconfirmation.html @@ -67,7 +67,7 @@
-
+
Order Summary
@@ -81,8 +81,16 @@ Total
-
- +
+
+ +
+
+
${name}
+
${priceAmt}
+
${qty}
+
${totalAmt}
+
@@ -116,7 +124,7 @@ - + @@ -138,6 +146,7 @@ + diff --git a/press.html b/press.html index 09ae887..3b33ad9 100644 --- a/press.html +++ b/press.html @@ -305,7 +305,7 @@ - + @@ -324,8 +324,10 @@ + + + @@ -302,6 +303,7 @@ + diff --git a/shopping-cart.html b/shopping-cart.html index 8cbac30..c7bb405 100644 --- a/shopping-cart.html +++ b/shopping-cart.html @@ -361,12 +361,43 @@
+ + + + + + + + + + + @@ -388,7 +419,7 @@ - +