import{u as f,G as g,a as b,j as e,H as k,L as N}from"./app-CyJEXGyv.js";import{A as P,u as o}from"./app-layout-DbUGBUec.js";import{P as w}from"./page-pagination-f8WRSjxd.js";import{T,a as H,b as y,c as C,d as l,e as a,f as B,g as D,h as s}from"./table-fuaFg2Mm.js";import{B as A}from"./button-COEJSQkW.js";import{A as M,M as L}from"./modal-delete-CUfNw5Hz.js";import{B as S}from"./badge-BSEA-Kjk.js";import{H as E}from"./heading-BLley4b9.js";import{C as F}from"./trash-BflsAFp1.js";import"./utils-D3rN0LeJ.js";import"./sheet-D9YCjyPN.js";import"./index-JbHgsFAK.js";import"./index-BiS8IM9B.js";import"./x-CEXz2EER.js";import"./createLucideIcon-DqnlFWer.js";import"./index-CeYyXWc4.js";import"./index-D448AvbX.js";import"./truck-DSNzHzca.js";import"./package-Ca-wQg6n.js";import"./shopping-bag-kX2qM3ec.js";import"./app-logo-icon-bwP4qd8Q.js";import"./bluetooth-context-DlC5mQaA.js";import"./index-BtT9Eyya.js";import"./index-l-_2VD5G.js";import"./sonner-DMUJNVEP.js";import"./pagination-7aOfsluw.js";import"./chevron-left-O9iIxqlL.js";import"./select-787Dhddj.js";import"./chevron-down-CelnyKCC.js";import"./input-De4RhZu7.js";import"./dialog-C64V63Fe.js";const _=[{title:"Produk",href:route("apps.products.index")}];function xe(){const{products:i,perPage:m,currentPage:p}=f().props,[c,d]=g.useState(!1),{data:u,setData:x}=b({id:""}),h=r=>{d(!0),x(t=>({...t,id:r.id}))},j=r=>typeof r=="boolean"?r:typeof r=="number"?r===1:typeof r=="string"?r==="1"||r.toLowerCase()==="true":!1;return e.jsxs(P,{breadcrumbs:_,children:[e.jsx(k,{title:"Produk"}),e.jsxs("div",{className:"p-4 bg-background text-foreground transition-colors",children:[e.jsx(E,{title:"Produk",description:"Halaman ini digunakan untuk mengelola data produk"}),e.jsxs("div",{className:"border border-border bg-card text-card-foreground shadow-sm rounded-xl p-4",children:[o(["products-create"])&&e.jsx(A,{asChild:!0,variant:"outline",children:e.jsxs(N,{href:route("apps.products.create"),children:[e.jsx(F,{className:"size-4"})," ",e.jsx("span",{className:"hidden sm:inline-flex font-semibold",children:"Tambah Produk"})]})}),e.jsx("div",{className:"mt-6",children:e.jsx(T,{withFilterPage:!0,currentPage:p,perPage:m,url:route("apps.products.index"),placeholder:"Cari data produk berdasarkan nama produk"})}),e.jsx(H,{className:"mt-5",children:e.jsxs(y,{children:[e.jsx(C,{children:e.jsxs(l,{children:[e.jsx(a,{className:"w-[10px]",children:"No"}),e.jsx(a,{className:"w-[10px]",children:"Gambar produk"}),e.jsx(a,{children:"SKU"}),e.jsx(a,{children:"Nama Produk"}),e.jsx(a,{children:"Kategori"}),e.jsx(a,{className:"w-[10px]",children:"Jenis Produk"}),e.jsx(a,{className:"w-[10px]",children:"Aksi"})]})}),e.jsx(B,{children:i.data.length===0?e.jsx(D,{colSpan:6,message:"data products"}):i.data.map((r,t)=>{var n;return e.jsxs(l,{children:[e.jsx(s,{className:"text-center",children:t+1}),e.jsx(s,{children:e.jsx("img",{src:r.image,className:"w-10 h-10"})}),e.jsx(s,{children:r.sku}),e.jsx(s,{children:r.name}),e.jsx(s,{children:(n=r.category)==null?void 0:n.name}),e.jsx(s,{className:"text-center",children:e.jsx(S,{children:j(r.has_variant)?"Varint":"Single"})}),e.jsx(s,{children:e.jsx("div",{className:"text-center",children:(o(["products-update"])||o(["products-delete"]))&&e.jsx(M,{permissionPrefix:"products",withDetail:!0,actionDetailHref:route("apps.products.show",r.id),actionEditHref:route("apps.products.edit",r.id),actionDelete:()=>h(r)})})})]},t)})})]})}),e.jsx(L,{open:c,onOpenChange:d,url:route("apps.products.destroy",u.id)}),e.jsx(w,{data:i})]})]})]})}export{xe as default};
