import{p as b,u as B,r as u,i as C,b as V,c as s,o as t,d as $,a as i,k as _,t as a,F as h,g as f,f as m}from"./app-q0jdcHwC.js";import{_ as D}from"./ProductCardToggler-Cod_9bXB.js";import{S as w}from"./SkeletonLoader-DoyP93ZN.js";import"./ProductCard-CB6dtTQd.js";import"./useTruncateText-CroACzlR.js";import"./ri-star-fill-DTNr-wIb.js";import"./EyeIcon-VDtOleu5.js";const P={class:"main-container pt-8 pb-12"},S={key:0,class:"text-slate-800 text-lg lg:text-3xl font-bold"},L={class:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 xl:grid-cols-5 gap-6 items-start mt-6"},N={key:2,class:"text-slate-950 text-xl font-medium leading-7"},A={key:2,class:"flex justify-between items-center w-full mt-8 gap-4 flex-wrap"},F={class:"text-slate-800 text-base font-normal leading-normal"},q={__name:"BestDeal",setup(T){const k=b(),p=B(),o=u(1),d=u(12),r=u([]),c=u(0),l=u(!0);C(()=>{v(),window.scrollTo(0,0)});const y=async e=>{o.value=e,v()},v=async()=>{window.scrollTo({top:0,behavior:"smooth"}),l.value=!0,axios.get("/products",{params:{page:o.value,per_page:d.value,sort_type:"top_selling"},headers:{"Accept-Language":p.locale||"en",Authorization:k.token,Currency_Id:p.selectedCurrency.id}}).then(e=>{c.value=e.data.data.total,r.value=e.data.data.products,setTimeout(()=>{l.value=!1},300)})};return(e,g)=>{const x=V("vue-awesome-paginate");return t(),s("div",P,[l.value?(t(),$(w,{key:1,class:"w-48 sm:w-60 md:w-72 lg:w-96 h-12 rounded-lg"})):(t(),s("div",S,a(e.$t("Best Deal")),1)),i("div",L,[l.value?(t(),s(h,{key:1},f(12,n=>i("div",{key:n},[m(w,{class:"w-full h-[220px] sm:h-[330px] rounded-lg"})])),64)):(t(!0),s(h,{key:0},f(r.value,n=>(t(),s("div",{key:n.id,class:"w-full"},[m(D,{productData:n},null,8,["productData"])]))),128)),r.value.length==0&&!l.value?(t(),s("div",N,a(e.$t("No Products Found")),1)):_("",!0)]),r.value.length>0&&!l.value?(t(),s("div",A,[i("div",F,a(e.$t("Showing"))+" "+a(d.value*(o.value-1)+1)+" to "+a(d.value*(o.value-1)+r.value.length)+" "+a(e.$t("of"))+" "+a(c.value)+" "+a(e.$t("results")),1),i("div",null,[m(x,{"total-items":c.value,"items-per-page":d.value,type:"button","hide-prev-next-when-ends":!0,"max-pages-shown":5,modelValue:o.value,"onUpdate:modelValue":g[0]||(g[0]=n=>o.value=n),onClick:y},null,8,["total-items","items-per-page","modelValue"])])])):_("",!0)])}}};export{q as default};
