import{q as j,U as u,v as g,j as e,$ as b,Y as f}from"./app-CffHYkHW.js";import{A as N,u as n}from"./app-layout-D-VS7nVU.js";import{P as y}from"./page-pagination-haDwcr6r.js";import{T as P,a as T,b as v,c as A,d as l,e as a,f as H,g as w,h as r}from"./table-DVZTgtP_.js";import{B as C}from"./button-qhe8lrPU.js";import{A as I,M}from"./modal-delete-CrQxv22H.js";import{H as k}from"./heading-YfudWo2z.js";import{C as D}from"./trash-o9eyCj69.js";import"./utils-C8zp8JNC.js";import"./sheet-Bisw0FSz.js";import"./index-C0loMkA3.js";import"./index-Cy5bElus.js";import"./index-DPkgfxsD.js";import"./x-BfabuQJD.js";import"./createLucideIcon-DAR-hy5d.js";import"./index-C9NeyPdJ.js";import"./index-CjqRk3xD.js";import"./truck-DnoS8QCL.js";import"./package-BHw0cifz.js";import"./shopping-bag-AryJS2XX.js";import"./app-logo-icon-D3Jzt_fn.js";import"./bluetooth-context-CLrE8g1i.js";import"./index-Dw4sHwMN.js";import"./sonner-CPUj7IiR.js";import"./pagination-DsNVVp24.js";import"./chevron-left-D6h0rvW2.js";import"./select-ClrGyhQo.js";import"./chevron-down-C5A3yn87.js";import"./input-Bw4IOOzt.js";import"./dialog-Djfc3pyN.js";const B=[{title:"Ingredients",href:route("apps.materials.index")}];function me(){const{materials:i,perPage:d,currentPage:m}=j().props;console.log(i);const[c,o]=u.useState(!1),{data:p,setData:x}=g({id:""}),h=s=>{o(!0),x(t=>({...t,id:s.id}))};return e.jsxs(N,{breadcrumbs:B,children:[e.jsx(b,{title:"Ingredients"}),e.jsxs("div",{className:"p-4 bg-background text-foreground transition-colors",children:[e.jsx(k,{title:"Ingredients",description:"Halaman ini digunakan untuk mengelola data bahan baku"}),e.jsxs("div",{className:"border border-border bg-card text-card-foreground shadow-sm rounded-xl p-4",children:[n(["materials-create"])&&e.jsx(C,{asChild:!0,variant:"outline",children:e.jsxs(f,{href:route("apps.materials.create"),children:[e.jsx(D,{className:"size-4"})," ",e.jsx("span",{className:"hidden sm:inline-flex font-semibold",children:"Add New Ingredients"})]})}),e.jsx("div",{className:"mt-6",children:e.jsx(P,{withFilterPage:!0,currentPage:m,perPage:d,url:route("apps.materials.index"),placeholder:"Search ingredients by ingredient name"})}),e.jsx(T,{className:"mt-5",children:e.jsxs(v,{children:[e.jsx(A,{children:e.jsxs(l,{children:[e.jsx(a,{className:"w-[10px]",children:"No"}),e.jsx(a,{children:"Name"}),e.jsx(a,{children:"Unit"}),e.jsx(a,{children:"Initial Qty"}),e.jsx(a,{children:"Minimum Qty"}),e.jsx(a,{children:"Price"}),e.jsx(a,{className:"w-[10px]",children:"Action"})]})}),e.jsx(H,{children:i.data.length===0?e.jsx(w,{colSpan:7,message:"data ingredients"}):i.data.map((s,t)=>e.jsxs(l,{children:[e.jsx(r,{className:"text-center",children:t+1}),e.jsx(r,{children:s.name}),e.jsx(r,{children:s.unit.name}),e.jsx(r,{children:s.initial_stock.quantity}),e.jsx(r,{children:s.minimum_qty}),e.jsxs(r,{children:[e.jsx("sup",{children:"Rp"})," ",s.price]}),e.jsx(r,{children:e.jsx("div",{className:"text-center",children:(n(["materials-update"])||n(["materials-delete"]))&&e.jsx(I,{permissionPrefix:"materials",actionEditHref:route("apps.materials.edit",s.id),actionDelete:()=>h(s)})})})]},t))})]})}),e.jsx(M,{open:c,onOpenChange:o,url:route("apps.materials.destroy",p.id)}),e.jsx(y,{data:i})]})]})]})}export{me as default};
