(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8321],{31622:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>o});var a=t(95155),l=t(97005),n=t(45002),d=t(25399),c=t(72031),i=t(77329),u=t(95604),r=t(12115);function o(e){let{params:{id:s}}=e,[t,o]=(0,r.useState)([]),[p,m]=(0,r.useState)(1),[x,g]=(0,r.useState)(1),[h,j]=(0,r.useState)(!0),[v,f]=(0,r.useState)(null),b=(0,u.useTranslations)("filter"),[N,y]=(0,r.useState)("");async function w(){j(!0);let e=await (0,l.A)({endPoint:"/brands/".concat(s,"?page=").concat(p)});if(e.error)f(e.message);else{var t,a,n,d,c,i,u,r;"success"==e.status&&(null==e||null==(a=e.data)||null==(t=a.products)?void 0:t.data.length)>0&&(y(null==e||null==(d=e.data)||null==(n=d.brand)?void 0:n.name),o(null==e||null==(i=e.data)||null==(c=i.products)?void 0:c.data),g(null==e||null==(r=e.data)||null==(u=r.products)?void 0:u.last_page)),j(!1)}}(0,r.useEffect)(()=>{w()},[p]);let S=e=>{e>=1&&e<=x&&m(e)};return h?(0,a.jsx)("div",{children:(0,a.jsx)(n.A,{})}):0===t.length?(0,a.jsx)("div",{className:"py-8",children:(0,a.jsx)(d.A,{text:b("noproducts")})}):v?(0,a.jsx)("div",{className:"py-8",children:(0,a.jsx)(d.A,{text:v})}):t.length>0?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(c.default,{route:N,subs:!0}),(0,a.jsxs)("div",{className:"container  grid grid-cols-12  gap-2 md:gap-4  my-4",children:[t.map(e=>(0,a.jsx)("div",{className:"lg:col-span-3  md:col-span-4 col-span-6",children:(0,a.jsx)(i.default,{product:e})},e.id)),(0,a.jsx)("div",{className:"col-span-12",children:(0,a.jsxs)("div",{className:"flex justify-center gap-4 items-center my-10  w-full",children:[(0,a.jsx)("button",{onClick:()=>S(p+1),disabled:p===x,className:"px-4 py-2 bg-main text-white rounded ".concat(p===x?"cursor-not-allowed bg-main/35 ":""),children:b("next")}),(0,a.jsxs)("p",{className:"text-gray-400",children:[b("page")," ",p," ",b("from")," ",x]}),(0,a.jsx)("button",{onClick:()=>S(p-1),disabled:1===p,className:"px-4 py-2 bg-main text-white rounded ".concat(1==p?"cursor-not-allowed bg-main/35 ":""),children:b("prev")})]})})]})]}):void 0}},68220:(e,s,t)=>{"use strict";t.d(s,{t:()=>a});let a=(0,t(25959).v)(e=>({settings:null,setSettings:s=>e({settings:s})}))},98605:(e,s,t)=>{Promise.resolve().then(t.bind(t,31622))}},e=>{e.O(0,[2978,6711,5897,9204,5604,4909,2619,7527,1356,581,7329,7578,8441,1255,7358],()=>e(e.s=98605)),_N_E=e.O()}]);