import{u as f,a as b,G as g,j as e,H as N,L as H}from"./app-CyJEXGyv.js";import{A as P,u as o}from"./app-layout-DbUGBUec.js";import{P as T}from"./page-pagination-f8WRSjxd.js";import{T as w,a as v,b as A,c as D,d,e as a,f as y,g as B,h as r}from"./table-fuaFg2Mm.js";import{B as C}from"./badge-BSEA-Kjk.js";import{B as k}from"./button-COEJSQkW.js";import{A as M,M as U}from"./modal-delete-CUfNw5Hz.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 L=[{title:"Users",href:route("apps.users.index")}];function ue(){const{users:i,perPage:n,currentPage:m}=f().props,{data:p,setData:c}=b({id:""}),[x,l]=g.useState(!1),u=s=>{l(!0),c(t=>({...t,id:s.id}))};return e.jsxs(P,{breadcrumbs:L,children:[e.jsx(N,{title:"Users"}),e.jsxs("div",{className:"p-4 bg-background text-foreground transition-colors",children:[e.jsx(E,{title:"Users",description:"Halaman ini digunakan untuk mengelola data users akses"}),e.jsxs("div",{className:"border border-border bg-card text-card-foreground shadow-sm rounded-xl p-4",children:[o(["users-create"])&&e.jsx(k,{asChild:!0,variant:"outline",children:e.jsxs(H,{href:route("apps.users.create"),children:[e.jsx(F,{className:"size-4"})," ",e.jsx("span",{className:"hidden sm:inline-flex font-semibold",children:"Add New User"})]})}),e.jsx("div",{className:"mt-6",children:e.jsx(w,{withFilterPage:!0,currentPage:m,perPage:n,url:route("apps.users.index"),placeholder:"Search users by name or username"})}),e.jsx(v,{className:"mt-5",children:e.jsxs(A,{children:[e.jsx(D,{children:e.jsxs(d,{children:[e.jsx(a,{className:"w-[10px]",children:"No"}),e.jsx(a,{children:"Name"}),e.jsx(a,{children:"Username"}),e.jsx(a,{children:"Email"}),e.jsx(a,{children:"Role"}),e.jsx(a,{className:"w-[10px]",children:"Action"})]})}),e.jsx(y,{children:i.data.length===0?e.jsx(B,{colSpan:6,message:"data users"}):i.data.map((s,t)=>e.jsxs(d,{children:[e.jsx(r,{className:"text-center",children:t+1}),e.jsx(r,{children:s.name}),e.jsx(r,{children:s.username}),e.jsx(r,{children:s.email}),e.jsx(r,{children:e.jsx("div",{className:"flex flex-wrap gap-1",children:s.roles.map((h,j)=>e.jsx(C,{variant:"default",children:h.name},j))})}),e.jsx(r,{children:e.jsx("div",{className:"text-center",children:(o(["users-update"])||o(["users-delete"]))&&e.jsx(M,{permissionPrefix:"users",withDetail:!0,actionDetailHref:route("apps.users.show",s.id),actionEditHref:route("apps.users.edit",s.id),actionDelete:()=>u(s)})})})]},t))})]})}),e.jsx(U,{open:x,onOpenChange:l,url:route("apps.users.destroy",p.id)}),e.jsx(T,{data:i})]})]})]})}export{ue as default};
