1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9190],{61742:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/cart",function(){return a(1712)}])},1712:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return C}});var r=a(85893),o=a(28646),s=a(59417),i=a(99603),l=a(41664),c=a.n(l),d=a(67294),n=a(88446),u=a(86501),h=a(93729),p=a(29552),v=a(48583),y=a(70372),m=a(22632),x=a(11163),g=a(9008),j=a.n(g),b=a(88754),f=a(13415),w=e=>{let{productCode:t}=e,[a,o]=(0,d.useState)([]),[s,i]=(0,d.useState)(!1),[l,c]=(0,d.useState)(!1),u=[];return(0,d.useEffect)(()=>{let e=async()=>{try{var e,a,r,s;let l=await n.Z.post("/product-recommend/get-recommended-product",{code:t,table_name:"product_3"});l&&Array.isArray(null==l?void 0:null===(e=l.data)||void 0===e?void 0:e.data)&&(u.push(null==l?void 0:null===(a=l.data)||void 0===a?void 0:a.data),o(u),i(null==l?void 0:null===(r=l.data)||void 0===r?void 0:r.show_more),c(null==l?void 0:null===(s=l.data)||void 0===s?void 0:s.eshopRandomProductShowBtnThisWeek))}catch(e){console.error("Error fetching related products:",e)}};e()},[t]),console.log(a,"randomProductsInEshop"),console.log(s,"show_more"),console.log(l,"eshopRandomProductShowBtnThisWeek"),(0,r.jsx)("section",{className:"md:mx-1 px-3 lg:mx-1 lg:px-0 md:p-0",children:(0,r.jsx)("div",{className:"container mx-auto",children:a.length>0&&(0,r.jsx)(f.Z,{relatedCategoryProducts:a,auctionType:"e-shop",page:"detail",show_more:s,eshopRandomProductShowBtnThisWeek:l})})})};let S=e=>{let{initialValue:t,code:a,onUpdateQuantity:o}=e,[s,i]=(0,d.useState)(t);(0,x.useRouter)();let l=e=>{o(a,e).then(t=>{!0===t&&i(e)}).catch(e=>{console.error("Error:",e)})};return(0,r.jsx)("input",{value:s,onChange:e=>l(parseInt(e.target.value,10)),className:"border p-2 rounded-md",type:"number"})},D=e=>{let{sectionType:t,Status:a,productItems:o,Quantity:l,ProductURL:v,Images:y,TaxAmount:m,Amount:g,Code:j,ProductID:f,EshopPrice:w,Title:D,FetchData:_,setEshopCart:N,quantityValidityResults:C,quantityValidityResultsForSaveForLater:P}=e,[q,Z]=(0,d.useState)(0),T=(0,x.useRouter)(),[A,k]=(0,d.useState)("");(0,d.useEffect)(()=>{k(window.location.href)},[T]);let F=async(e,t)=>{try{if([...o],Z(t),t>0){let a=await n.Z.post("/product-cart/updateQuantity",{code:e,quantity:t});if(a.data.success.length>0)return(0,h.Z)({msg:a.data.success,type:"success"}),await _(0),!0;if(a.data.error.length>0)return(0,h.Z)({msg:a.data.error,type:"error"}),!1}}catch(e){return console.error("Error handling quantity:",e),!1}},E=async e=>{try{await n.Z.post("/product-cart/removeFromCart",{code:e},{headers:{frontendurl:A||""}}).then(e=>{if(!0===e.data.success){u.ZP.success("product is deleted from cart successfully");let e=async e=>{try{let t=await n.Z.post("/product-cart/getCartDetails",e),a=t.data.data;N(a)}catch(e){console.error(e)}};e({page_enabled:"y",page:1,limit:100,sortDetails:{sortKey:"id",sortType:1},searchDetails:[],searchDetailsAnd:[{basicSearchKey:"status",basicSearchValue:0,basicSearchType:"number"}],searchQuery:""})}0===a?_(0):-1===a&&_(-1),!1===e.data.success&&u.ZP.error("Something error occured while removing")})}catch(e){}},V=async(e,t)=>{try{let i=await n.Z.post("/product-cart/updateCartStatus",{code:e,typeOfFunction:t});if(i.data.data){var a,r,o,s;(0,h.Z)({msg:i.data.data.msg,type:"success"}),(null==i?void 0:null===(a=i.data)||void 0===a?void 0:null===(r=a.data)||void 0===r?void 0:r.status)===0?(_(0),_(-1)):(null==i?void 0:null===(o=i.data)||void 0===o?void 0:null===(s=o.data)||void 0===s?void 0:s.status)===-1&&(_(-1),_(0));let e=async e=>{try{let t=await n.Z.post("/product-cart/getCartDetails",e),a=t.data.data;N(a)}catch(e){console.error(e)}};e({page_enabled:"y",page:1,limit:100,sortDetails:{sortKey:"id",sortType:1},searchDetails:[],searchDetailsAnd:[{basicSearchKey:"status",basicSearchValue:0,basicSearchType:"number"}],searchQuery:""})}!1===i.data.success&&u.ZP.error("Something error occurred while removing")}catch(e){console.error(e)}},R={border:"0.5px solid",borderColor:"#ccc"};return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("tr",{className:"text-center border odd:bg-gray-100",children:[(0,r.jsx)("td",{style:R,className:"flex justify-center items-center p-2",children:(0,r.jsx)(c(),{href:v,children:null==y?void 0:y.slice(0,2).map((e,t)=>(0,r.jsx)("img",{height:100,width:100,src:"".concat(p.Z.CDN_URL_PUBLIC,"/uploads/t/3000/").concat(j).concat(t+1,"0.jpg"),alt:"",className:"w-50 h-30"},t))})}),(0,r.jsx)("td",{className:"w-32",style:R,children:(0,r.jsxs)(c(),{href:v,children:[(0,r.jsx)("strong",{children:"#".concat(j)}),"\xa0-\xa0",D]})}),"main"===t&&0===a&&(0,r.jsxs)("td",{style:R,children:[(0,r.jsx)(S,{initialValue:l,code:j,onUpdateQuantity:F}),C.map(e=>e.code===j&&!e.isValid&&e.quantity>0&&(0,r.jsx)("div",{style:{color:"red"},children:"".concat(e.quantity," only remaining")},e.code)),C.map(e=>e.code===j&&!e.isValid&&0===e.quantity&&(0,r.jsx)("div",{style:{color:"red"},children:"Out of Stock"},e.code))]}),"main"===t&&0===a&&(0,r.jsx)("td",{style:R,children:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.G,{icon:s.H0g}),(0,b.b)(w)]})}),(0,r.jsxs)("td",{style:R,children:[(0,r.jsx)(i.G,{icon:s.H0g}),(0,b.b)(g)]}),"main"===t&&0===a&&(0,r.jsx)("td",{style:R,children:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.G,{icon:s.H0g}),(0,b.b)(m)]})}),(0,r.jsx)("td",{className:"",style:R,children:(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center gap-y-2",children:["main"===t&&0===a&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{onClick:()=>V(j,-1),children:"Save for later"}),(0,r.jsx)("button",{className:"cursor-pointer",onClick:()=>{let e=window.confirm("Are you sure you want to Delete from the cart");e&&E(j)},children:"Delete from cart"})]}),"saveForLater"===t&&-1===a&&(0,r.jsxs)(r.Fragment,{children:[P.filter(e=>e.code===j&&!e.isValid&&0===e.quantity).map(e=>(0,r.jsx)("div",{style:{color:"red"},children:"Sorry, this product is out of stock"},e.code)),P.filter(e=>e.code===j&&!e.isValid&&e.quantity>0).map(e=>(0,r.jsx)("button",{onClick:()=>V(j,0),children:"Move to cart"},e.code)),(0,r.jsx)("button",{className:"cursor-pointer",onClick:()=>{let e=window.confirm("Are you sure you want to Remove from the Save for Later");e&&E(j)},children:"Remove"})]})]})})]},f)})};var _=()=>{var e;let[t,a]=(0,d.useState)([]),[o,l]=(0,d.useState)([]),[p,g]=(0,d.useState)(0),[f,S]=(0,d.useState)(0);(0,v.Dv)(y.Z);let _=(0,v.b9)(y.Z),N=(0,x.useRouter)(),[C,P]=(0,d.useState)("");(0,d.useEffect)(()=>{P(window.location.href)},[N]);let[q,Z]=(0,d.useState)({loading:!1,success:"",error:""}),T=async()=>{try{var e;let t=await n.Z.get("/user/viewuser");g(null==t?void 0:null===(e=t.data)||void 0===e?void 0:e.id),Z({loading:!1,success:"success",error:""})}catch(e){console.error(e),Z({loading:!1,success:"error",error:""})}};(0,d.useEffect)(()=>{T()}
1,[p]),(0,d.useEffect)(()=>{try{A(-1),A(0)}catch(e){}},[p]);let A=async e=>{try{var t,r,o;let s=await n.Z.post("/product-cart/getCartDetails",{page_enabled:"y",page:1,limit:100,sortDetails:{sortKey:"id",sortType:1},searchDetails:[],searchDetailsAnd:[{basicSearchKey:"userid",basicSearchValue:p,basicSearchType:"number"},{basicSearchKey:"status",basicSearchValue:e,basicSearchType:"number"}],searchQuery:"",...-1===e&&{product3Status:1}});Array.isArray(null==s?void 0:null===(t=s.data)||void 0===t?void 0:t.data)&&(0===e?l(null==s?void 0:null===(r=s.data)||void 0===r?void 0:r.data):-1===e&&a(null==s?void 0:null===(o=s.data)||void 0===o?void 0:o.data))}catch(e){}},[k,F]=(0,d.useState)(0);(0,d.useEffect)(()=>{let e=o.reduce((e,t)=>e+t.amount+t.tax_amount,0),t=parseFloat(e.toFixed(2));F(t)},[o]);let E=async()=>{try{let e=await n.Z.post("/product-cart/emptyCart",{},{headers:{frontendurl:C||""}});if(!0===e.data.success){u.ZP.success("Cart emptied Successfully"),A(0);let e=async e=>{try{let t=await n.Z.post("/product-cart/getCartDetails",e),a=t.data.data;_(a)}catch(e){console.error(e)}};e({page_enabled:"y",page:1,limit:100,sortDetails:{sortKey:"id",sortType:1},searchDetails:[],searchDetailsAnd:[{basicSearchKey:"status",basicSearchValue:0,basicSearchType:"number"}],searchQuery:""})}else u.ZP.error("Something error occured while emptying the cart")}catch(e){console.error(e)}},V=o.map(e=>{var t,a,r;let o=e.quantity<=(null===(t=e.productDetails[0])||void 0===t?void 0:t.quantity);return{code:e.code,quantity:null===(a=null==e?void 0:e.productDetails[0])||void 0===a?void 0:a.quantity,isValid:o,message:o?null:"Product with code ".concat(e.code," is not available. Please reduce the quantity to ").concat(null===(r=e.productDetails[0])||void 0===r?void 0:r.quantity,".")}}),R=t.map(e=>{var t,a,r;let o=e.quantity<=(null===(t=e.productDetails[0])||void 0===t?void 0:t.quantity);return{code:e.code,quantity:null===(a=null==e?void 0:e.productDetails[0])||void 0===a?void 0:a.quantity,isValid:o,message:o?null:"Product with code ".concat(e.code," is not available. Please reduce the quantity to ").concat(null===(r=e.productDetails[0])||void 0===r?void 0:r.quantity,".")}}),L=async()=>{try{var e,t;let a=[],r=await n.Z.post("/product-cart/getCartDetails",{page_enabled:"y",page:1,limit:100,sortDetails:{sortKey:"id",sortType:1},searchDetails:[],searchDetailsAnd:[{basicSearchKey:"userid",basicSearchValue:p,basicSearchType:"number"},{basicSearchKey:"status",basicSearchValue:0,basicSearchType:"number"}],searchQuery:"",...!1});Array.isArray(null==r?void 0:null===(e=r.data)||void 0===e?void 0:e.data)&&(a=null==r?void 0:null===(t=r.data)||void 0===t?void 0:t.data);let s=a.map(e=>{var t,a,r,o,s,i,l;let c=e.quantity<=(null===(t=e.productDetails[0])||void 0===t?void 0:t.quantity),d=(null==e?void 0:e.eshop_price)===(null===(a=null==e?void 0:e.productDetails[0])||void 0===a?void 0:a.eshop_price);return{code:e.code,quantity:null===(r=null==e?void 0:e.productDetails[0])||void 0===r?void 0:r.quantity,eShopPrice:null===(o=null==e?void 0:e.productDetails[0])||void 0===o?void 0:o.eshop_price,isValid:c,eshop_priceUpdatedOrNot:d,message:c?null:"Product with code ".concat(e.code," is not available. ").concat((null===(s=e.productDetails[0])||void 0===s?void 0:s.quantity)===0?"Out of stock":"Please reduce the quantity to ".concat(null===(i=e.productDetails[0])||void 0===i?void 0:i.quantity),"."),eshopPriceUpdatedMessage:d?null:"Product with code ".concat(e.code," price is updated to â¹").concat(null===(l=e.productDetails[0])||void 0===l?void 0:l.eshop_price,". Please refresh the page to view updated price")}}),i=s.some(e=>!1===e.isValid),l=s.some(e=>!1===e.eshop_priceUpdatedOrNot);i?s.filter(e=>!e.isValid).map((e,t)=>(0,h.Z)({type:"error",msg:"".concat(e.message)})):l?s.filter(e=>!e.eshop_priceUpdatedOrNot).map((e,t)=>(0,h.Z)({type:"error",msg:"".concat(e.eshopPriceUpdatedMessage)})):o.length>0&&N.push("/checkout")}catch(e){}};return(0,r.jsxs)("div",{className:"lg:mx-28",children:[(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(j(),{children:(0,r.jsx)("title",{children:"Cart"})})}),(0,r.jsxs)("div",{className:"container mx-auto",children:[(0,r.jsx)("div",{className:"flex justify-end mt-3",children:(0,r.jsxs)("button",{className:"border p-2 rounded-md bg-red-600 text-white",onClick:()=>{let e=window.confirm("Are you sure you want to empty the cart");e&&E()},children:[(0,r.jsx)(i.G,{icon:s.Vui})," Empty Cart"]})}),(0,r.jsx)("div",{className:"w-full max-w-full overflow-x-auto ",children:(0,r.jsxs)("table",{className:"w-[1137px] border rounded-md mt-5 ",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Image"}),(0,r.jsx)("th",{children:"SKU - Title"}),(0,r.jsx)("th",{children:"Quantity"}),(0,r.jsx)("th",{children:"Unit Price"}),(0,r.jsx)("th",{children:"Amount"}),(0,r.jsx)("th",{children:"Tax Amount"}),(0,r.jsx)("th",{children:"Action"})]})}),(0,r.jsxs)("tbody",{children:[o.length>0&&o.map(e=>{var t,a,s,i,l,c,d,n;let u=(0,m.Z)({category:[null===(t=e.productDetails[0])||void 0===t?void 0:t.category_2,null===(a=e.productDetails[0])||void 0===a?void 0:a.category_1,null===(s=e.productDetails[0])||void 0===s?void 0:s.category_3,null===(i=e.productDetails[0])||void 0===i?void 0:i.category_4,null===(l=e.productDetails[0])||void 0===l?void 0:l.category_5],title:null===(c=e.productDetails[0])||void 0===c?void 0:c.title,auction:0,code:e.code,auctiontype:"e-shop",type:1,isLive:0});return(0,r.jsx)(D,{productItems:o,setEshopCart:_,FetchData:A,ProductID:null==e?void 0:e.id,EshopPrice:null==e?void 0:e.eshop_price,Code:null==e?void 0:e.code,Amount:null==e?void 0:e.amount,TaxAmount:null==e?void 0:e.tax_amount,Images:null===(d=null==e?void 0:e.productDetails[0])||void 0===d?void 0:d.imagesArr,ProductURL:u,Quantity:null==e?void 0:e.quantity,Title:null===(n=null==e?void 0:e.productDetails[0])||void 0===n?void 0:n.title,Status:null==e?void 0:e.status,sectionType:"main",quantityValidityResults:V,quantityValidityResultsForSaveForLater:R})}),o.length<=0&&(0,r.jsx)("tr",{className:"text-center border",children:(0,r.jsx)("td",{colSpan:7,className:"odd:bg-gray-200",children:(0,r.jsxs)("h1",{className:"text-black",children:["Shopping Cart is Empty ..For continue to shop now \xa0",(0,r.jsx)(c(),{href:"/",children:(0,r.jsx)("button",{className:"hover:text-blue-700",children:"click here"})})]})})}),o.length>0&&(0,r.jsx)("tr",{className:"text-center border",children:(0,r.jsx)("td",{colSpan:7,className:"border",children:(0,r.jsxs)("div",{className:"flex justify-end items-end",children:[(0,r.jsx)("h1",{className:"text-black text-lg",children:"Subtotal:"})," ",(0,r.jsxs)("h2",{className:" text-lg text-red-600 ",children:[(0,r.jsx)(i.G,{icon:s.H0g}),(0,b.b)(k),"/- +Shipping Charges"]})]})})})]})]})}),(0,r.jsx)("div",{className:"flex justify-end py-3",children:(0,r.jsxs)("button",{onClick:L,className:"border p-3 rounded-md bg-green-600 text-white",children:[(0,r.jsx)(i.G,{icon:s.Ozh})," Continue with Checkout"," ",(0,r.jsx)(i.G,{icon:s.eFW})]})}),(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("h1",{children:"Did you forget something? You can go back and continue shopping"}),(0,r.jsx)(c(),{href:"/",children:(0,r.jsxs)("button",{className:"border p-3 rounded-md bg-gray-300 ",children:[(0,r.jsx)(i.G,{icon:s.acZ})," Continue Shopping"]})})]}),t&&t.length>0?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("h1",{className:"text-xl",children:["Save For Later","(".concat(t.length,")")]}),(0,r.jsx)("div",{className:"w-full max-w-full overflow-x-auto",children:(0,r.jsxs)("table",{className:"w-[1137px] border rounded-md mt-5",children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Image"}),(0,r.jsx)("th",{children:"SKU - Title"}),(0,r.jsx)("th",{children:"Amount"}),(0,r.jsx)("th",{children:"Action"})]})}),(0,r.jsx)("tbody",{children:t.map(e=>{var a,o,s,i,l,c,d,n;let u=(0,m.Z)({category:[null===(a=e.productDetails[0])||void 0===a?void 0:a.category_2,null===(o=e.productDetails[0])||void 0===o?void 0:o.category_1,null===(s=e.productDetails[0])||void 0===s?void 0:s.category_3,null===(i=e.productDetails[0])||void 0===i?void 0:i.category_4,null===(l=e.productDetails[0])||void 0===l?void 0:l.category_5],title:null===(c=e.productDetails[0])||void 0===c?void 0:c.title,auction:0,code:e.code,auctiontype:"e-shop",type:1,isLive:0});return(0,r.jsx)(D,{productItems:t,setEshopCart:_,FetchData:A,ProductID:null==e?void 0:e.id,EshopPrice:null==e?void 0:e.eshop_price,Code:null==e?void 0:e.code,Amount:null==e?void 0:e.amount,TaxAmount:null==e?void 0:e.tax_amount,Images:null===(d=null==e?void 0:e.productDetails[0])||void 0===d?void 0:d.imagesArr,ProductURL:u,Quantity:null==e?void 0:e.quantity,Title:null===(n=null==e?void 0:e.productDetails[0])||void 0===n?void 0:n.title,Status:null==e?void 0:e.status,sectionType:"saveForLater",quantityValidityResults:V,quantityValidityResultsForSaveForLater:R})})})]})})]}):"",o.length>
10&&(0,r.jsx)(w,{productCode:null===(e=o[0])||void 0===e?void 0:e.code})]})]})},N=a(94543),C=()=>{let e=(0,v.Dv)(N.ZP);return e.isLoggedIn?(0,r.jsx)(_,{}):(0,r.jsx)(o.Z,{})}},28646:function(e,t,a){"use strict";var r=a(85893),o=a(41664),s=a.n(o),i=a(11163);a(67294),t.Z=()=>{let e=(0,i.useRouter)(),t=e.asPath;return(0,r.jsxs)("div",{className:"md:mx-28 text-center text-red-500 p-10 bg-gray-100 text-xl",children:["Your are not Logged in to use this functionality .......! ",(0,r.jsx)("br",{}),(0,r.jsx)(s(),{className:"text-blue-500",href:"/login?re_url=".concat(t),children:"Click here to Login"})]})}},9008:function(e,t,a){e.exports=a(42636)}},function(e){e.O(0,[4153,3415,9774,2888,179],function(){return e(e.s=61742)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.