import{q as j,v as u,U 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}from"./page-pagination-haDwcr6r.js";import{T,a as H,b as v,c as w,d as o,e as s,f as A,g as C,h as r}from"./table-DVZTgtP_.js";import{A as D,M as k}from"./modal-delete-CrQxv22H.js";import{H as y}from"./heading-YfudWo2z.js";import{B as M}from"./button-qhe8lrPU.js";import{C as B}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 E=[{title:"Pelanggan",href:route("apps.customers.index")}];function me(){const{customers:i,perPage:d,currentPage:m}=j().props,{data:c,setData:p}=u({id:""}),[x,l]=g.useState(!1),h=a=>{l(!0),p(t=>({...t,id:a.id}))};return e.jsxs(N,{breadcrumbs:E,children:[e.jsx(b,{title:"Pelanggan"}),e.jsxs("div",{className:"p-4 bg-background text-foreground transition-colors",children:[e.jsx(y,{title:"Pelanggan",description:"Halaman ini digunakan untuk mengelola data pelanggan"}),e.jsxs("div",{className:"border border-border bg-card text-card-foreground shadow-sm rounded-xl p-4",children:[n(["customers-create"])&&e.jsx(M,{asChild:!0,variant:"outline",children:e.jsxs(f,{href:route("apps.customers.create"),children:[e.jsx(B,{className:"size-4"})," ",e.jsx("span",{className:"hidden sm:inline-flex font-semibold",children:"Tambah Pelanggan"})]})}),e.jsx("div",{className:"mt-6",children:e.jsx(T,{withFilterPage:!0,currentPage:m,perPage:d,url:route("apps.customers.index"),placeholder:"Cari data pelanggan berdasarkan nama pelanggan"})}),e.jsx(H,{className:"mt-5",children:e.jsxs(v,{children:[e.jsx(w,{children:e.jsxs(o,{children:[e.jsx(s,{className:"w-[10px]",children:"No"}),e.jsx(s,{children:"Nama Pelanggan"}),e.jsx(s,{children:"Nomor Hp"}),e.jsx(s,{children:"Email"}),e.jsx(s,{children:"Alamat"}),e.jsx(s,{className:"text-center",children:"Point"}),e.jsx(s,{className:"w-[10px] text-center",children:"Aksi"})]})}),e.jsx(A,{children:i.data.length===0?e.jsx(C,{colSpan:7,message:"data pelanggan"}):i.data.map((a,t)=>e.jsxs(o,{children:[e.jsx(r,{className:"text-center",children:t+1}),e.jsx(r,{children:a.name}),e.jsx(r,{children:a.phone}),e.jsx(r,{children:a.email}),e.jsx(r,{children:a.address}),e.jsx(r,{className:"text-center",children:a.available_points??0}),e.jsx(r,{children:e.jsx("div",{className:"text-center",children:(n(["customers-update"])||n(["customers-delete"]))&&e.jsx(D,{permissionPrefix:"customers",withDetail:!0,actionEditHref:route("apps.customers.edit",a.id),actionDetailHref:route("apps.customers.show",a.id),actionDelete:()=>h(a)})})})]},t))})]})}),e.jsx(P,{data:i}),e.jsx(k,{open:x,onOpenChange:l,url:route("apps.customers.destroy",c.id)})]})]})]})}export{me as default};
