import{x as b,g as P,b as B,d as V,o as t,c as s,t as a,e as C,a as i,F as g,l as h,h as m,S as _,p as w,r as u}from"./app-B-4i4xU3.js";import{P as S}from"./ProductCard-Bre1aBlK.js";const $={class:"main-container pt-8 pb-12"},L={key:0,class:"text-slate-800 dark:text-slate-100 text-lg lg:text-xl font-semibold"},N={class:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 xl:grid-cols-6 gap-6 items-start mt-6"},A={key:2,class:"text-slate-950 dark:text-white text-xl font-medium leading-7"},D={key:2,class:"flex justify-between items-center w-full mt-8 gap-4 flex-wrap"},F={class:"text-slate-800 dark:text-slate-100 text-base font-normal leading-normal"},z={__name:"BestDeal",setup(T){const k=b(),x=P(),o=u(1),d=u(12),r=u([]),c=u(0),l=u(!0);B(()=>{p(),window.scrollTo(0,0)});const f=async e=>{o.value=e,p()},p=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":x.locale||"en",Authorization:k.token}}).then(e=>{c.value=e.data.data.total,r.value=e.data.data.products,setTimeout(()=>{l.value=!1},300)})};return(e,v)=>{const y=V("vue-awesome-paginate");return t(),s("div",$,[l.value?(t(),C(_,{key:1,class:"w-48 sm:w-60 md:w-72 lg:w-96 h-12 rounded-lg"})):(t(),s("div",L,a(e.$t("Best Deal")),1)),i("div",N,[l.value?(t(),s(g,{key:1},h(12,n=>i("div",{key:n},[m(_,{class:"w-full h-[220px] sm:h-[330px] rounded-lg"})])),64)):(t(!0),s(g,{key:0},h(r.value,n=>(t(),s("div",{key:n.id,class:"w-full"},[m(S,{product:n},null,8,["product"])]))),128)),r.value.length==0&&!l.value?(t(),s("div",A,a(e.$t("No Products Found")),1)):w("",!0)]),r.value.length>0&&!l.value?(t(),s("div",D,[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(y,{"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":v[0]||(v[0]=n=>o.value=n),onClick:f},null,8,["total-items","items-per-page","modelValue"])])])):w("",!0)])}}};export{z as default};
