import{Kt as e,Q as t,Qt as n,R as r,Tn as i,X as a,Y as o,Z as s,at as c,fr as l,i as u,it as d,lr as f,or as p,r as m,st as h}from"./dist-CoD0k1Bd.js";import{t as g}from"./plus-DrIll_vd.js";import{t as _}from"./search-B4f4vYLn.js";import{t as v}from"./Input-C3DwKNOf.js";import{t as y}from"./button-mN_poAXs.js";import{t as b}from"./routes-BZ4t1sNs.js";import{t as x}from"./Heading-CCd5Tysh.js";import{t as S}from"./badge-n_RZ0blh.js";import{t as C}from"./Pagination-BRYVDO_a.js";var w={class:`flex flex-col space-y-6`},T={class:`flex items-center justify-between gap-4`},E={class:`w-full max-w-sm`},D={method:`GET`,action:`/users`},O={class:`relative`},k={class:`overflow-hidden rounded-xl border`},A={class:`w-full text-sm`},j={class:`divide-y`},M={class:`px-4 py-3 font-medium`},N={key:0,class:`text-xs text-muted-foreground`},P={class:`px-4 py-3 text-muted-foreground`},F={class:`px-4 py-3`},I={class:`flex flex-wrap gap-1`},L={class:`px-4 py-3 text-right tabular-nums`},R={class:`px-4 py-3 text-center`},z={class:`px-4 py-3 text-right`},B={class:`flex justify-end gap-1`},V={key:0},H=h({layout:{breadcrumbs:[{title:`Dashboard`,href:b()},{title:`Pengguna`,href:`/users`}]},__name:`Index`,props:{users:{},filters:{}},setup(h){let b=h,H={admin:`bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300`,developer:`bg-purple-100 text-purple-700 dark:bg-purple-900/40 dark:text-purple-300`,members:`bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300`},U={active:{label:`Aktif`,variant:`default`},suspended:{label:`Diskors`,variant:`destructive`},deactivated:{label:`Dinonaktifkan`,variant:`secondary`}};return(h,W)=>(e(),t(r,null,[c(p(m),{title:`Pengguna`}),o(`div`,w,[o(`div`,T,[c(x,{title:`Pengguna`,description:`Kelola akun pengguna & keanggotaan grup`}),c(p(y),{"as-child":``},{default:i(()=>[c(p(u),{href:`/users/create`},{default:i(()=>[c(p(g),{class:`size-4`}),W[0]||=d(` Tambah Pengguna `,-1)]),_:1})]),_:1})]),o(`div`,E,[o(`form`,D,[o(`div`,O,[c(p(_),{class:`absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground`}),c(p(v),{name:`search`,"default-value":b.filters.search??``,placeholder:`Cari nama, email, username…`,class:`pl-9`},null,8,[`default-value`])])])]),o(`div`,k,[o(`table`,A,[W[3]||=o(`thead`,{class:`bg-muted/50 text-left text-xs uppercase text-muted-foreground`},[o(`tr`,null,[o(`th`,{class:`px-4 py-3 font-medium`},`Nama`),o(`th`,{class:`px-4 py-3 font-medium`},`Email`),o(`th`,{class:`px-4 py-3 font-medium`},`Grup`),o(`th`,{class:`px-4 py-3 font-medium text-right`},`Kredit`),o(`th`,{class:`px-4 py-3 font-medium text-center`},`Status`),o(`th`,{class:`px-4 py-3 font-medium text-right`},`Aksi`)])],-1),o(`tbody`,j,[(e(!0),t(r,null,n(b.users.data,m=>(e(),t(`tr`,{key:m.id,class:`hover:bg-muted/30`},[o(`td`,M,[d(l(m.name)+` `,1),m.username?(e(),t(`div`,N,`@`+l(m.username),1)):s(``,!0)]),o(`td`,P,l(m.email),1),o(`td`,F,[o(`div`,I,[(e(!0),t(r,null,n(m.groups,t=>(e(),a(p(S),{key:t.id,variant:`secondary`,class:f(H[t.name]??``)},{default:i(()=>[d(l(t.name),1)]),_:2},1032,[`class`]))),128))])]),o(`td`,L,l(m.credit.toLocaleString(`id-ID`)),1),o(`td`,R,[c(p(S),{variant:U[m.status]?.variant??`outline`},{default:i(()=>[d(l(U[m.status]?.label??m.status),1)]),_:2},1032,[`variant`])]),o(`td`,z,[o(`div`,B,[c(p(y),{"as-child":``,variant:`ghost`,size:`sm`},{default:i(()=>[c(p(u),{href:`/users/${m.id}/edit`},{default:i(()=>[...W[1]||=[d(`Edit`,-1)]]),_:1},8,[`href`])]),_:2},1024)])])]))),128)),b.users.data.length===0?(e(),t(`tr`,V,[...W[2]||=[o(`td`,{colspan:`6`,class:`px-4 py-8 text-center text-muted-foreground`},` Tidak ada pengguna ditemukan. `,-1)]])):s(``,!0)])])]),c(C,{links:b.users.links,from:b.users.from,to:b.users.to,total:b.users.total},null,8,[`links`,`from`,`to`,`total`])])],64))}});export{H as default};