"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8333],{78333:function(e,t,r){r.d(t,{Z:function(){return CartProductCard}});var s=r(85893),n=r(67294),a=r(36814),l=r(90200),i=r(41664),d=r.n(i);function CartProductCard(e){var t,r,i,o,c;let{removeFromCart:x,updatequantity:m,isgiftwrappadded:p,addtowishlist:h}=(0,a.ZP)(),[u,g]=(0,a.ux)(e=>[e.currency,e.currencyRate]),{item:j,idx:v}=e,b=j.imgUrl||"https://ik.imagekit.io/magrudy/noimage.jpg?tr=w-280",[f,N]=(0,n.useState)(b),y=null==j?void 0:j.isbn;(0,n.useEffect)(()=>{j.imgUrl?N(j.imgUrl):fetch("https://ik.imagekit.io/magrudy/".concat(y," - 1.jpg?tr=w-280")).then(e=>{e.ok?N("https://ik.imagekit.io/magrudy/".concat(y," - 1.jpg?tr=w-280")):N("https://ik.imagekit.io/magrudy/noimage.jpg?tr=w-280")})},[y,j.imgUrl]);let validDeliveryDate=()=>j.inventory>=j.quantity?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("p",{className:"text-[13px] mt-0.5",children:["Dispatched by"," ",(0,s.jsx)("span",{className:" text-[#11849D]",children:"Magrudy Warehouse."})," "]}),(0,s.jsxs)("p",{className:"!text-[13px] mt-0.5 text-[#444444]",children:["Estimated delivery between ",(0,s.jsx)("strong",{children:"3-7 days"})]})]}):0==j.inventory&&j.gardnerInventory>=j.quantity?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("p",{className:"text-[13px] mt-0.5",children:["Dispatched by"," ",(0,s.jsx)("span",{className:" text-[#11849D]",children:"UK Warehouse."})," "]}),(0,s.jsxs)("p",{className:"!text-[13px] mt-0.5 text-[#444444]",children:["Estimated delivery between ",(0,s.jsx)("strong",{children:"7-21 days"})]})]}):j.inventory+j.gardnerInventory>=j.quantity?(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("p",{className:"!text-[13px] mt-0.5 text-[#444444]",children:["Some of your items delivery between ",(0,s.jsx)("strong",{children:"3-7 days By Magrudy Warehouse"}),", Some of your items delivery between ",(0,s.jsx)("strong",{children:"7-21 days By UK Warehouse"})]})}):(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("p",{className:"!text-[13px] mt-0.5 text-[#444444]",children:"Stock is not sufficient"})});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"block md:flex mt-3",children:[(0,s.jsx)("img",{className:"w-24 h-40 mt-1 md:w-32 lg:w-36 lg:h-52",src:f,alt:"",onError:()=>{N("https://ik.imagekit.io/magrudy/noimage.jpg?tr=w-280")}},v),(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2",children:[(0,s.jsxs)("div",{className:"md:ml-2 xl:ml-[20px] lg:ml-[10px] md:mt-2",children:[(0,s.jsx)("h1",{className:"text-[15px] text-[#444444] font-semibold ",children:(0,s.jsxs)(d(),{href:"/product?isbn=".concat(y),className:"text-[#11849D]",children:[" ",null==j?void 0:j.title]})}),(null==j?void 0:j.author)&&(0,s.jsx)("p",{className:"text-[13px] mt-0.5 text-[#444444]",children:(0,s.jsxs)(d(),{href:"/product/all?author=".concat(null==j?void 0:j.author),children:[" ",(null==j?void 0:j.author)?(0,s.jsxs)(s.Fragment,{children:["by ",(0,s.jsx)("span",{className:"text-[#11849D]",children:null==j?void 0:j.author})]}):(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("br",{})})]})}),(0,s.jsx)("p",{className:"text-[16px] mt-0.5",children:(0,s.jsx)("p",{className:"text-[12px] mt-[5px] text-[#11849D]",children:(null==j?void 0:j.unitPriceInclVATAfterDisc)>0?(0,s.jsxs)(s.Fragment,{children:[(null==j?void 0:j.discountPerc)>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"badge badge-secondary text-[#D9534F]",children:[parseInt(null==j?void 0:j.discountPerc),"% off"]}),(0,s.jsx)("br",{})]}),(0,s.jsxs)("span",{className:"line-through text-[#D9534F]",children:[null!=u?u:"AED"," "]}),(0,s.jsx)("strong",{className:"text-sm line-through text-[#D9534F]",children:null!==(t=null==j?void 0:j.unitPriceInclVAT)&&void 0!==t?t:0}),"  \xa0",null!=u?u:"AED"," ",(0,s.jsx)("strong",{className:"text-sm font-bold",children:null!==(r=null==j?void 0:j.unitPriceInclVATAfterDisc)&&void 0!==r?r:0})]}):(null==j?void 0:j.oldPriceInclVAT)>0?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("span",{className:"line-through text-[#D9534F]",children:[null!=u?u:"AED"," "]}),(0,s.jsx)("strong",{className:"text-sm line-through text-[#D9534F]",children:null!==(i=null==j?void 0:j.oldPriceInclVAT)&&void 0!==i?i:0}),"  \xa0",null!=u?u:"AED"," ",(0,s.jsx)("strong",{className:"text-sm font-bold",children:null!==(o=null==j?void 0:j.unitPriceInclVAT)&&void 0!==o?o:0})]}):(0,s.jsxs)(s.Fragment,{children:[null!=u?u:"AED","  ",(0,s.jsx)("strong",{className:"text-sm font-bold",children:null!==(c=null==j?void 0:j.unitPriceInclVAT)&&void 0!==c?c:0})]})})}),(0,s.jsx)("p",{className:"text-[13px] mt-0.5 text-[#787878]",children:"All prices include VAT"}),(null==j?void 0:j.voucherCode)&&(0,s.jsxs)("p",{className:"text-[13px] mt-0.5 font-bold text-[#787878]",children:["PromoCode : ",j.voucherCode]}),(0,s.jsx)(l.Z,{meta:j}),(0,s.jsx)("p",{className:"md:hidden",children:validDeliveryDate()})]}),(0,s.jsxs)("div",{className:"hidden md:block mt-2 ml-20 text-end",children:[(0,s.jsxs)("p",{className:"text-[13px] mt-0.5 cursor-pointer",onClick:()=>h(j),children:["Save For Later |"," ",(0,s.jsx)("span",{className:"text-[#E01B1B] cursor-pointer",onClick:e=>{e.stopPropagation(),x(j)},children:"Remove"})]}),(0,s.jsxs)("div",{className:"flex mt-2 ml-20 text-end",children:[(0,s.jsx)("button",{className:" border-[#787878,#fff] border-t-[1px] border-b-[1px] border-l-[1px] rounded-l-md w-[48px] h-[40px] text-[#444444] hover:bg-[#f1f1f1]",onClick:e=>{e.stopPropagation(),j.quantity>1&&m(j,"decrease")},children:"-"}),(0,s.jsx)("div",{className:"h-[28px]  mt-[6px] w-px bg-gradient-to-tr from-transparent via-neutral-500 to-transparent opacity-30 "}),(0,s.jsx)("div",{className:"border-t-[1px]  border-[#787878,#fff] border-b-[1px] w-[86px] h-[40px] text-center pt-[6px] text-[#444444]",children:j.quantity}),(0,s.jsx)("div",{className:"h-[28px]  mt-[6px] w-px bg-gradient-to-tr from-transparent via-neutral-500 to-transparent opacity-30 "}),(0,s.jsx)("button",{className:"border-[#787878,#fff] border-t-[1px] border-b-[1px] border-r-[1px] rounded-r-md w-[48px] h-[40px] text-slate-600 hover:bg-[#f1f1f1]",onClick:e=>{var t;e.stopPropagation(),j.quantity+1<=(null!==(t=j.availableQty)&&void 0!==t?t:0)&&m(j,"increase")},children:"+"})]}),(0,s.jsx)("div",{className:"mt-10 -ml-4",children:(0,s.jsx)("p",{className:"hidden md:block",children:validDeliveryDate()})})]})]})]},v),(0,s.jsxs)("div",{className:"mt-1",children:[(0,s.jsxs)("p",{className:"text-[13px] mt-0.5 md:hidden",children:["Save For Later |"," ",(0,s.jsx)("span",{className:"text-[#E01B1B]",onClick:e=>{e.stopPropagation(),x(j)},children:"Remove"})]}),(0,s.jsxs)("div",{className:"flex mt-2 md:hidden",children:[(0,s.jsx)("button",{className:" border-[#787878,#fff] border-t-[1px] border-b-[1px] border-l-[1px] rounded-l-md w-[48px] h-[40px] text-[#444444] hover:bg-[#f1f1f1]",onClick:e=>{e.stopPropagation(),m(j,"decrease")},children:"-"}),(0,s.jsx)("div",{className:"h-[28px]  mt-[6px] w-px bg-gradient-to-tr from-transparent via-neutral-500 to-transparent opacity-30 "}),(0,s.jsx)("div",{className:"border-t-[1px]  border-[#787878,#fff] border-b-[1px] w-[86px] h-[40px] text-center pt-[6px] text-[#444444]",children:j.quantity}),(0,s.jsx)("div",{className:"h-[28px]  mt-[6px] w-px bg-gradient-to-tr from-transparent via-neutral-500 to-transparent opacity-30 "}),(0,s.jsx)("button",{className:"border-[#787878,#fff] border-t-[1px] border-b-[1px] border-r-[1px] rounded-r-md w-[48px] h-[40px] text-[#444444] hover:bg-[#f1f1f1]",onClick:e=>{e.stopPropagation(),m(j,"increase")},children:"+"})]})]})]})}}}]);