import{Kt as e,M as t,Q as n,Qt as r,R as i,Tn as a,X as o,Y as s,at as c,fr as l,it as u,o as d,or as f,r as p,st as m}from"./dist-CoD0k1Bd.js";import{a as h,i as g,n as _,o as v,r as y,s as b,t as x}from"./dialog-mmWdScO2.js";import{t as S}from"./Label-DKn3cyeE.js";import{t as C}from"./plus-DrIll_vd.js";import{t as w}from"./Input-C3DwKNOf.js";import{t as T}from"./button-mN_poAXs.js";import{t as E}from"./routes-BZ4t1sNs.js";import{t as D}from"./Heading-CCd5Tysh.js";import{t as O}from"./badge-n_RZ0blh.js";import{t as k}from"./InputError-BY5lDrFd.js";var A={class:`flex flex-col space-y-6`},j={class:`flex items-center justify-between gap-4`},M={class:`grid gap-2`},N={class:`grid gap-2`},P={class:`overflow-hidden rounded-xl border`},F={class:`w-full text-sm`},I={class:`divide-y`},L={class:`px-4 py-3 font-medium capitalize`},R={class:`px-4 py-3 text-muted-foreground`},z={class:`px-4 py-3 text-center tabular-nums`},B={class:`px-4 py-3 text-center`},V=m({layout:{breadcrumbs:[{title:`Dashboard`,href:E()},{title:`Grup`,href:`/groups`}]},__name:`Index`,props:{groups:{}},setup(m){let E=[`admin`,`members`,`developer`],V=d({name:``,description:``}),H=()=>{V.post(`/groups`,{onSuccess:()=>V.reset()})};return(d,U)=>(e(),n(i,null,[c(f(p),{title:`Grup`}),s(`div`,A,[s(`div`,j,[c(D,{title:`Grup & Hak Akses`,description:`Kelola grup pengguna dan jumlah anggota`}),c(f(b),null,{default:a(()=>[c(f(x),{"as-child":``},{default:a(()=>[c(f(T),null,{default:a(()=>[c(f(C),{class:`size-4`}),U[2]||=u(` Tambah Grup `,-1)]),_:1})]),_:1}),c(f(v),null,{default:a(()=>[c(f(y),null,{default:a(()=>[c(f(_),null,{default:a(()=>[...U[3]||=[u(`Grup Baru`,-1)]]),_:1}),c(f(h),null,{default:a(()=>[...U[4]||=[u(`Buat grup untuk mengatur hak akses menu.`,-1)]]),_:1})]),_:1}),s(`form`,{onSubmit:t(H,[`prevent`]),class:`space-y-4`},[s(`div`,M,[c(f(S),{for:`name`},{default:a(()=>[...U[5]||=[u(`Nama Grup`,-1)]]),_:1}),c(f(w),{id:`name`,modelValue:f(V).name,"onUpdate:modelValue":U[0]||=e=>f(V).name=e,required:``},null,8,[`modelValue`]),c(k,{message:f(V).errors.name},null,8,[`message`])]),s(`div`,N,[c(f(S),{for:`description`},{default:a(()=>[...U[6]||=[u(`Keterangan`,-1)]]),_:1}),c(f(w),{id:`description`,modelValue:f(V).description,"onUpdate:modelValue":U[1]||=e=>f(V).description=e},null,8,[`modelValue`]),c(k,{message:f(V).errors.description},null,8,[`message`])]),c(f(g),null,{default:a(()=>[c(f(T),{type:`submit`,disabled:f(V).processing},{default:a(()=>[...U[7]||=[u(`Simpan`,-1)]]),_:1},8,[`disabled`])]),_:1})],32)]),_:1})]),_:1})]),s(`div`,P,[s(`table`,F,[U[10]||=s(`thead`,{class:`bg-muted/50 text-left text-xs uppercase text-muted-foreground`},[s(`tr`,null,[s(`th`,{class:`px-4 py-3 font-medium`},`Nama`),s(`th`,{class:`px-4 py-3 font-medium`},`Keterangan`),s(`th`,{class:`px-4 py-3 font-medium text-center`},`Anggota`),s(`th`,{class:`px-4 py-3 font-medium text-center`},`Tipe`)])],-1),s(`tbody`,I,[(e(!0),n(i,null,r(m.groups,t=>(e(),n(`tr`,{key:t.id,class:`hover:bg-muted/30`},[s(`td`,L,l(t.name),1),s(`td`,R,l(t.description??`—`),1),s(`td`,z,l(t.users_count),1),s(`td`,B,[E.includes(t.name)?(e(),o(f(O),{key:0,variant:`secondary`},{default:a(()=>[...U[8]||=[u(`Inti`,-1)]]),_:1})):(e(),o(f(O),{key:1,variant:`outline`},{default:a(()=>[...U[9]||=[u(`Kustom`,-1)]]),_:1}))])]))),128))])])])])],64))}});export{V as default};