import{l as E,p as G,m as H,u as I,c as a,o as i,a as e,n as l,t as s,k as F,e as n,f as d,G as M}from"./app-q0jdcHwC.js";import{_ as J}from"./Bag-DDZkhCm6.js";import{r as O}from"./ArrowRightIcon-lWca2ARp.js";const K={class:"grid grid-cols-3"},L=["src"],Q={class:"bg-white p-2 flex flex-col items-start gap-2 col-span-2"},U={class:"text-primary text-base font-bold leading-normal"},W={key:0,class:"text-slate-400 text-sm font-normal line-through leading-tight"},X={key:1,class:"px-1 py-0.5 bg-red-500 rounded-2xl text-white text-xs font-medium"},Y={class:"flex justify-between items-center w-full"},Z={class:"text-slate-950 text-sm font-bold leading-tight"},tt={class:"text-slate-500 text-sm font-normal leading-tight"},et={key:0,class:"text-right text-slate-500 text-sm font-normal leading-tight"},st={key:1,class:"text-right text-red-500 text-sm font-normal leading-tight"},ot={key:0,class:"justify-start items-center gap-3 flex"},rt={class:"w-5 h-5"},at={class:"text-slate-600 text-sm font-normal leading-tight"},it={key:1,class:"justify-start items-center gap-2 flex"},lt={class:"text-red-500 text-sm font-normal leading-tight"},pt={__name:"ProductCardHorizontal",props:{product:Object},setup(T){var m;const V=new E;G();const c=H(),u=I(),t=T,P={is_buy_now:!1,product_id:(m=t.product)==null?void 0:m.id,quantity:1,size:null,color:null,unit:null},R=o=>{c.addToCart(P,o)},A=()=>{var o,r;c.addToCart({product_id:(o=t.product)==null?void 0:o.id,is_buy_now:!0,quantity:1,size:null,color:null,unit:null},t.product),c.buyNowShopId=(r=t.product)==null?void 0:r.shop.id},p=()=>{t.product.quantity>0&&V.push({name:"productDetails",params:{slug:t.product.slug}})};return(o,r)=>{var h,_,f,g,x,y,v,w,b,k,q,C,S,$,j,B,N,z,D;return i(),a("div",{class:l(["rounded-lg border transition-all duration-300 group bg-white overflow-hidden relative",((h=t.product)==null?void 0:h.quantity)>0?"hover:border-primary":""])},[e("div",K,[e("div",{class:l(["w-full h-full overflow-hidden shrink-0 cursor-pointer",((_=t.product)==null?void 0:_.quantity)>0?"":"opacity-30"]),onClick:p},[e("img",{src:(f=t.product)==null?void 0:f.thumbnail,class:"w-full h-full group-hover:scale-110 transition duration-500 object-contain",loading:"lazy"},null,8,L)],2),e("div",Q,[e("div",{class:"flex flex-col items-start gap-2 w-full cursor-pointer",onClick:p},[e("div",{class:l(["text-slate-950 text-base font-normal leading-normal truncate w-full",((g=t.product)==null?void 0:g.quantity)>0?"":"opacity-30"])},s((x=t.product)==null?void 0:x.name),3),e("div",{class:l(["flex items-center gap-2 flex-wrap",((y=t.product)==null?void 0:y.quantity)>0?"":"opacity-30"])},[e("div",U,s(n(u).showCurrency(((v=t.product)==null?void 0:v.discount_price)>0?(w=t.product)==null?void 0:w.discount_price:(b=t.product)==null?void 0:b.price)),1),((k=t.product)==null?void 0:k.discount_price)>0?(i(),a("div",W,s(n(u).showCurrency((q=t.product)==null?void 0:q.price)),1)):F("",!0),((C=t.product)==null?void 0:C.discount_percentage)>0?(i(),a("div",X,s((S=t.product)==null?void 0:S.discount_percentage)+"% "+s(o.$t("OFF")),1)):F("",!0)],2),e("div",Y,[e("div",{class:l(["flex items-center gap-1",(($=t.product)==null?void 0:$.quantity)>0?"":"opacity-30"])},[d(n(M),{class:"w-4 h-4 text-yellow-400"}),e("div",Z,s((j=t.product)==null?void 0:j.rating.toFixed(1)),1),e("div",tt," ("+s((B=t.product)==null?void 0:B.total_reviews)+") ",1)],2),r[1]||(r[1]=e("div",{class:"h-3 w-[0px] border border-slate-200"},null,-1)),((N=t.product)==null?void 0:N.quantity)>0?(i(),a("div",et,s((z=t.product)==null?void 0:z.total_sold)+" "+s(o.$t("Sold")),1)):(i(),a("div",st,s(o.$t("Stock Out")),1))])]),((D=t.product)==null?void 0:D.quantity)>0?(i(),a("div",ot,[e("button",{class:"cursor-pointer",onClick:r[0]||(r[0]=nt=>R(t.product))},[e("div",rt,[d(J)])]),r[2]||(r[2]=e("div",{class:"w-1.5 h-1.5 bg-slate-200 rounded-md"},null,-1)),e("button",{class:"justify-center items-center gap-0.5 flex",onClick:A},[e("div",at,s(o.$t("Buy Now")),1),d(n(O),{class:"w-4 h-4 text-slate-600"})])])):(i(),a("button",it,[e("div",lt,s(o.$t("Request Stock")),1),d(n(O),{class:"w-4 h-4 text-red-500"})]))])])],2)}}};export{pt as _};
