import{_ as P,x as K,e as C,o as l,g as k,c as a,w as t,r as c,z as L,E as B,G as F,v as M,t as y,i as w,f as m,J as x,F as V,h as q,n as D,aD as E,aE as N,az as R,s as J,cJ as U,cK as j}from"./app-DGDivIsO.js";import{L as A}from"./LeftSidebarMenu-Cke7Ryok.js";import{P as G}from"./ProductCard-Byq6NkBj.js";import"./MailOutlined-BkPJOQow.js";import"./AppstoreOutlined-CxbokteV.js";import"./SettingOutlined-F4vTp2uH.js";import"./cart-C-GPgQf0.js";import"./filter-_TPdNMe8.js";import"./ShoppingCartOutlined-BJIcmyJ0.js";const I=K({components:{LeftSidebarMenu:A,ProductCard:G},setup(){const e=c([]),_=c([]),v=c([]),S=L(),i=c({}),h=c([]),b=c(1),o=c(1),p=c(20);B(()=>{const n=S.params;g(n)});const g=n=>{if(n&&n.slug){const s=n.slug,r=s[s.length-1];axiosFront.post(`/front/category-by-slug/${r}`).then(u=>{i.value=u.data.category,f(i.value.id),h.value=[i.value.id]})}else h.value=[],i.value={},f()},f=()=>{let n="products?fields=id,xid,name,slug,image,image_url,description,category_id,x_category_id,category{id,xid,name,slug},brand_id,x_brand_id,brand{id,xid,name,slug},unit_id,x_unit_id,unit{id,xid,name,short_name},description,details{stock_quantitiy_alert,opening_stock,opening_stock_date,wholesale_price,wholesale_quantity,mrp,purchase_price,sales_price,tax_id,x_tax_id,purchase_tax_type,sales_tax_type,current_stock,warehouse_id,x_warehouse_id,status},details:tax{id,xid,name,rate}";if(i.value&&i.value.id){const u=i.value.id;n+=`&filters=category_id eq ${u}`}const s=p.value,r=(o.value-1)*s;n+=`&offset=${r}&limit=${s}`,axiosFront.get(n).then(u=>{b.value=u.meta.paging.total,v.value=u.data})},$=(n,s)=>{o.value=n,p.value=s,f()};return F(S,(n,s)=>{g(n.params)}),{catSelectedKeys:h,category:i,categoriesSelectedKeys:e,categoriesOpenKeys:_,products:v,currentPage:o,pageSize:p,totalRecords:b,paginationClicked:$}}}),O={class:"bg-white"},T={key:0},H={key:1};function Q(e,_,v,S,i,h){const b=C("LeftSidebarMenu"),o=D,p=C("router-link"),g=E,f=N,$=R,n=J,s=C("ProductCard"),r=M,u=U,z=j;return l(),k("div",O,[a(r,{type:"flex",justify:"center"},{default:t(()=>[a(o,{span:20},{default:t(()=>[a(r,{gutter:[30,30],class:"mt-30"},{default:t(()=>[a(o,{xs:24,sm:24,md:24,lg:6,xl:6,style:{"padding-left":"0px"}},{default:t(()=>[a(b,{catSelectedKeys:e.catSelectedKeys,class:"categories-page-lefbar"},null,8,["catSelectedKeys"])]),_:1}),a(o,{xs:24,sm:24,md:24,lg:18,xl:18},{default:t(()=>[a(r,{class:"mt-30 mb-30 category-page-container"},{default:t(()=>[a(o,{span:24},{default:t(()=>[a($,{style:{"padding-left":"0px"}},{title:t(()=>[e.category&&e.category.name?(l(),k("span",T,y(e.category.name),1)):(l(),k("span",H,y(e.$t("front_setting.all_categories")),1))]),breadcrumb:t(()=>[a(f,null,{default:t(()=>[a(g,null,{default:t(()=>[a(p,{to:{name:"front.homepage"}},{default:t(()=>[w(y(e.$t("front.home")),1)]),_:1})]),_:1}),a(g,null,{default:t(()=>[a(p,{to:{name:"front.categories"}},{default:t(()=>[w(y(e.$t("menu.categories")),1)]),_:1})]),_:1}),e.category&&e.category.name?(l(),m(g,{key:0},{default:t(()=>[w(y(e.category.name),1)]),_:1})):x("",!0)]),_:1})]),_:1}),a(n,{class:"mt-0"}),e.products&&e.products.length>0?(l(),m(r,{key:0,gutter:[30,30]},{default:t(()=>[(l(!0),k(V,null,q(e.products,d=>(l(),m(o,{xs:24,sm:12,md:8,lg:6,xl:6,key:d.id},{default:t(()=>[(l(),m(s,{product:d,key:d.id},null,8,["product"]))]),_:2},1024))),128))]),_:1})):(l(),m(r,{key:1,gutter:30,class:"mt-30 mb-30"},{default:t(()=>[a(o,{span:24},{default:t(()=>[a(u,{description:e.$t("front_setting.no_results")},null,8,["description"])]),_:1})]),_:1})),e.products&&e.products.length>0?(l(),m(r,{key:2,gutter:30,class:"mt-30 mb-30"},{default:t(()=>[a(o,{span:24},{default:t(()=>[a(z,{current:e.currentPage,"onUpdate:current":_[0]||(_[0]=d=>e.currentPage=d),pageSize:e.pageSize,"onUpdate:pageSize":_[1]||(_[1]=d=>e.pageSize=d),total:e.totalRecords,onChange:e.paginationClicked,showSizeChanger:!1},null,8,["current","pageSize","total","onChange"])]),_:1})]),_:1})):x("",!0)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})])}const se=P(I,[["render",Q]]);export{se as default};
