import{q as f,v as b,U as g,j as e,$ as N,Y as P}from"./app-CffHYkHW.js";import{A as T,u as i}from"./app-layout-D-VS7nVU.js";import{P as v}from"./page-pagination-haDwcr6r.js";import{T as R,a as w,b as A,c as H,d,e as a,f as y,g as B,h as t}from"./table-DVZTgtP_.js";import{B as C}from"./badge-soq0-NVD.js";import{B as D}from"./button-qhe8lrPU.js";import{A as M,M as k}from"./modal-delete-CrQxv22H.js";import{H as E}from"./heading-YfudWo2z.js";import{C as S}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 F=[{title:"Roles",href:route("apps.roles.index")}];function he(){const{roles:o,perPage:n,currentPage:m}=f().props,{data:p,setData:c}=b({id:""}),[x,l]=g.useState(!1),h=s=>{l(!0),c(r=>({...r,id:s.id}))};return e.jsxs(T,{breadcrumbs:F,children:[e.jsx(N,{title:"Roles"}),e.jsxs("div",{className:"p-4 bg-background text-foreground transition-colors",children:[e.jsx(E,{title:"Roles",description:"Halaman ini digunakan untuk mengelola data Roles"}),e.jsxs("div",{className:"border border-border bg-card text-card-foreground shadow-sm rounded-xl p-4",children:[i(["roles-create"])&&e.jsx(D,{asChild:!0,variant:"outline",children:e.jsxs(P,{href:route("apps.roles.create"),children:[e.jsx(S,{className:"size-4"})," ",e.jsx("span",{className:"hidden sm:inline-flex font-semibold",children:"Add New Role"})]})}),e.jsx("div",{className:"mt-6",children:e.jsx(R,{withFilterPage:!0,currentPage:m,perPage:n,url:route("apps.roles.index"),placeholder:"Search roles by role name"})}),e.jsx(w,{className:"mt-5",children:e.jsxs(A,{children:[e.jsx(H,{children:e.jsxs(d,{children:[e.jsx(a,{className:"w-[10px]",children:"No"}),e.jsx(a,{children:"Role Name"}),e.jsx(a,{children:"Permission"}),e.jsx(a,{className:"w-[10px]",children:"Action"})]})}),e.jsx(y,{children:o.data.length===0?e.jsx(B,{colSpan:3,message:"data roles"}):o.data.map((s,r)=>e.jsxs(d,{children:[e.jsx(t,{className:"text-center",children:r+1}),e.jsx(t,{children:s.name}),e.jsx(t,{children:e.jsx("div",{className:"flex flex-wrap gap-1",children:s.permissions.map((j,u)=>e.jsx(C,{variant:"default",children:j.name},u))})}),e.jsx(t,{children:e.jsx("div",{className:"text-center",children:(i(["roles-update"])||i(["roles-delete"]))&&e.jsx(M,{permissionPrefix:"roles",actionEditHref:route("apps.roles.edit",s.id),actionDelete:()=>h(s)})})})]},r))})]})}),e.jsx(k,{open:x,onOpenChange:l,url:route("apps.roles.destroy",p.id)}),e.jsx(v,{data:o})]})]})]})}export{he as default};
