import{q as f,R as k,v as b,j as e,$ as A,Y as v}from"./app-BGey7YPf.js";import{h as l,A as N}from"./app-layout-mnJEmZ7X.js";import{H as T}from"./header-D0w47C-P.js";import{T as H,a as P,b as y,c as C,d as o,e as t,f as B,g as w,h as i}from"./table-C3FnqSRz.js";import{B as D}from"./button-D5r5edT8.js";import{B as d}from"./badge-BVty0UEZ.js";import{C as M,A as R,M as E,P as F}from"./page-pagination-D1u9TBBY.js";import"./chevron-right-CE_1krjA.js";import"./separator-Di-l93J0.js";import"./input-CGSIKYsG.js";import"./icons-hx7HvmR4.js";import"./index-BFyaOBDQ.js";import"./x-C4WIHhXm.js";import"./index-Q2wK6uZI.js";import"./index-CwO5dfCw.js";import"./theme-provider-NKMbg-kV.js";import"./use-toast-DGElh_6W.js";import"./select-BqSuhmAT.js";import"./index-BuSoVzfP.js";import"./chevron-down-DOZGaFlM.js";import"./dialog-OAe1w9Cd.js";import"./trash-Blc6Iqr5.js";import"./chevron-left-7ssMp1N3.js";function G(){const{roles:a,currentPage:p,perPage:m}=f().props,[c,n]=k.useState(!1),{data:x,setData:u}=b({id:""}),h=s=>{n(!0),u(r=>({...r,id:s.id}))};return e.jsxs(e.Fragment,{children:[e.jsx(A,{title:"Akses Group"}),e.jsx(T,{title:"Akses Group",subtitle:"Halaman ini digunakan untuk mengelola data hak akses group pengguna",children:l(["roles-create"])&&e.jsx(D,{asChild:!0,variant:"outline",children:e.jsxs(v,{href:route("apps.roles.create"),children:[e.jsx(M,{className:"size-4"})," ",e.jsx("span",{className:"hidden sm:inline-flex",children:"Tambah Akses Group"})]})})}),e.jsxs("div",{className:"p-6",children:[e.jsx("div",{className:"mb-5",children:e.jsx(H,{withFilterPage:!0,currentPage:p,perPage:m,url:route("apps.roles.index"),placeholder:"Cari data akses group berdasarkan nama akses group"})}),e.jsx(P,{children:e.jsxs(y,{children:[e.jsx(C,{children:e.jsxs(o,{children:[e.jsx(t,{className:"w-[10px] text-center",children:"No"}),e.jsx(t,{children:"Nama Hak Akses"}),e.jsx(t,{children:"Hak Akses"}),e.jsx(t,{className:"w-[10px] text-center",children:"Aksi"})]})}),e.jsx(B,{children:a.data.length===0?e.jsx(w,{colSpan:4,message:"data akses group"}):a.data.map((s,r)=>e.jsxs(o,{children:[e.jsx(i,{className:"text-center",children:++r+(a.current_page-1)*a.per_page}),e.jsx(i,{children:s.name}),e.jsx(i,{children:s.name=="super-admin"?e.jsx(d,{variant:"destructive",children:"Semua Hak Akses"}):e.jsx("div",{className:"flex flex-wrap gap-1",children:s.permissions.map((j,g)=>e.jsx(d,{variant:"destructive",children:j.name},g))})}),e.jsx(i,{children:e.jsx("div",{className:"flex items-center justify-center",children:(l(["roles-update"])||l(["roles-delete"]))&&e.jsx(R,{permissionPrefix:"roles",actionEditHref:route("apps.roles.edit",s.id),actionDelete:()=>h(s)})})})]},r))})]})}),e.jsx(E,{open:c,onOpenChange:n,url:route("apps.roles.destroy",x.id)}),e.jsx(F,{data:a})]})]})}G.layout=a=>e.jsx(N,{children:a});export{G as default};
