import"../chunks/Bzak7iHL.js";import{p as tt,f as at,t as x,a as p,b as et,k as st,s as o,d as e,c as n,$ as rt,r as t,n as ot,l as s,e as l}from"../chunks/CiQWViEs.js";import{i as E}from"../chunks/CEkQpEF5.js";import{e as it}from"../chunks/EUGRfuDz.js";import{h as dt}from"../chunks/DG4rvltU.js";import{a as lt,e as vt}from"../chunks/BblGoPVU.js";import{r as pt,a as G,s as nt}from"../chunks/zaEOnEon.js";import{s as P}from"../chunks/Bbah6i2R.js";import{R as ct}from"../chunks/S2plRkmd.js";var mt=n('<p class="mb-4 rounded-lg bg-red-50 px-4 py-3 text-sm font-medium text-red-700" role="alert"> </p>'),xt=n('<span class="block text-xs text-slate-400"> </span>'),ft=n('<span class="text-emerald-700">Sí</span>'),bt=n('<span class="text-slate-400">Solo préstamos</span>'),_t=n('<tr><td class="px-4 py-3"><a class="font-medium text-slate-900 hover:underline"> </a> <!></td><td class="px-4 py-3 text-slate-600"> </td><td class="px-4 py-3"><span> </span></td><td class="px-4 py-3"><!></td><td class="px-4 py-3"> </td><td class="px-4 py-3"><div class="flex justify-end gap-1"><a class="btn-secondary px-2 py-1 text-xs">Editar</a> <form method="POST" action="?/toggleActive"><input type="hidden" name="id"/> <button class="btn-secondary px-2 py-1 text-xs" type="submit"> </button></form></div></td></tr>'),ht=n('<div class="mb-6 flex flex-wrap items-center justify-between gap-3"><div><h1 class="text-2xl font-bold text-slate-900">Usuarios</h1> <p class="text-slate-600"> </p></div> <div class="flex gap-2"><a class="btn-secondary" href="/users/import">Importar CSV</a> <a class="btn-primary" href="/users/new">Nuevo usuario</a></div></div> <!> <div class="card overflow-hidden"><div class="overflow-x-auto"><table class="w-full text-left text-sm"><thead class="border-b border-slate-200 bg-slate-50 text-xs uppercase text-slate-500"><tr><th class="px-4 py-3 font-semibold">Nombre</th><th class="px-4 py-3 font-semibold">Correo</th><th class="px-4 py-3 font-semibold">Rol</th><th class="px-4 py-3 font-semibold">Acceso</th><th class="px-4 py-3 font-semibold">Estado</th><th class="px-4 py-3 text-right font-semibold">Acciones</th></tr></thead><tbody class="divide-y divide-slate-100"></tbody></table></div></div>',1);function Lt(T,c){tt(c,!0);const V={admin:"bg-purple-100 text-purple-800",gestor:"bg-brand-100 text-brand-800",consulta:"bg-slate-100 text-slate-600"};var S=ht();dt("9fk07v",d=>{st(()=>{rt.title="Usuarios · Inventario EDUmind"})});var f=at(S),k=e(f),I=o(e(k),2),q=e(I);t(I),t(k),ot(2),t(f);var L=o(f,2);{var z=d=>{var a=mt(),v=e(a,!0);t(a),x(()=>l(v,c.form.error)),p(d,a)};E(L,d=>{var a;(a=c.form)!=null&&a.error&&d(z)})}var R=o(L,2),U=e(R),j=e(U),C=o(e(j));it(C,21,()=>c.data.users,d=>d.id,(d,a)=>{var v=_t(),b=e(v),m=e(b),F=e(m,!0);t(m);var H=o(m,2);{var J=r=>{var i=xt(),$=e(i,!0);t(i),x(()=>l($,s(a).identifier)),p(r,i)};E(H,r=>{s(a).identifier&&r(J)})}t(b);var _=o(b),K=e(_,!0);t(_);var h=o(_),u=e(h),M=e(u,!0);t(u),t(h);var y=o(h),Q=e(y);{var W=r=>{var i=ft();p(r,i)},X=r=>{var i=bt();p(r,i)};E(Q,r=>{s(a).has_login?r(W):r(X,-1)})}t(y);var g=o(y),Y=e(g,!0);t(g);var D=o(g),N=e(D),O=e(N),w=o(O,2),A=e(w);pt(A);var B=o(A,2),Z=e(B,!0);t(B),t(w),lt(w,r=>{var i;return(i=vt)==null?void 0:i(r)}),t(N),t(D),t(v),x(()=>{P(v,1,`hover:bg-slate-50 ${s(a).active?"":"opacity-50"}`),G(m,"href",`/users/${s(a).id??""}/edit`),l(F,s(a).name),l(K,s(a).email||"—"),P(u,1,`badge ${V[s(a).role]??""}`),l(M,ct[s(a).role]),l(Y,s(a).active?"Activo":"Inactivo"),G(O,"href",`/users/${s(a).id??""}/edit`),nt(A,s(a).id),l(Z,s(a).active?"Desactivar":"Activar")}),p(d,v)}),t(C),t(j),t(U),t(R),x(()=>l(q,`${c.data.users.length??""} usuario(s). Gestión de roles y acceso.`)),p(T,S),et()}export{Lt as component};
