import"../chunks/Bzak7iHL.js";import{p as X,s as l,f as Y,a as o,b as Z,k as $,d as s,c as v,$ as ee,r as e,t as w,l as a,e as x,v as te}from"../chunks/CiQWViEs.js";import{i as k}from"../chunks/CEkQpEF5.js";import{e as A}from"../chunks/EUGRfuDz.js";import{h as ae}from"../chunks/DG4rvltU.js";import{a as I}from"../chunks/zaEOnEon.js";import{s as O}from"../chunks/Bbah6i2R.js";import{i as T,f as se,a as re}from"../chunks/C-TorKLD.js";var ie=v('<a class="card p-5 transition-shadow hover:shadow-md"><p class="text-sm font-medium text-slate-500"> </p> <p> </p></a>'),de=v('<p class="px-5 py-10 text-center text-sm text-slate-500">No hay préstamos activos.</p>'),oe=v("<span> </span>"),le=v('<span class="text-slate-400">Sin fecha</span>'),ve=v('<li class="flex items-center justify-between gap-3 px-5 py-3"><div class="min-w-0"><a class="font-medium text-slate-900 hover:underline"> </a> <span class="text-slate-500"> </span> <p class="truncate text-sm text-slate-600"> </p></div> <div class="shrink-0 text-right text-sm"><!></div></li>'),U=v('<ul class="divide-y divide-slate-100"></ul>'),ne=v('<p class="px-5 py-10 text-center text-sm text-slate-500">Aún no hay movimientos.</p>'),ce=v('<span class="text-emerald-700">devuelto</span>'),pe=v('<span class="text-amber-700"> </span>'),me=v('<li class="flex items-center justify-between gap-3 px-5 py-3"><div class="min-w-0"><p class="truncate text-sm"><span class="font-medium text-slate-900"> </span> <!></p> <p class="text-xs text-slate-500"> </p></div></li>'),_e=v('<div class="mb-6 flex flex-wrap items-center justify-between gap-3"><div><h1 class="text-2xl font-bold text-slate-900">Panel</h1> <p class="text-slate-600">Estado general del inventario del centro.</p></div> <div class="flex gap-2"><a class="btn-secondary" href="/scan">Escanear</a> <a class="btn-primary" href="/devices/new">Nuevo equipo</a></div></div> <div class="grid grid-cols-2 gap-4 lg:grid-cols-4"></div> <div class="mt-8 grid gap-6 lg:grid-cols-2"><section class="card overflow-hidden"><header class="flex items-center justify-between border-b border-slate-200 px-5 py-4"><h2 class="font-semibold text-slate-900">Préstamos activos</h2> <a class="text-sm font-medium text-brand-700 hover:underline" href="/loans">Ver todos</a></header> <!></section> <section class="card overflow-hidden"><header class="border-b border-slate-200 px-5 py-4"><h2 class="font-semibold text-slate-900">Actividad reciente</h2></header> <!></section></div>',1);function je(z,n){X(n,!0);const B=te(()=>[{label:"Equipos totales",value:n.data.counts.total,tone:"text-slate-900",href:"/devices"},{label:"Disponibles",value:n.data.counts.disponibles,tone:"text-emerald-600",href:"/devices?status=disponible"},{label:"Prestados",value:n.data.counts.prestados,tone:"text-amber-600",href:"/devices?status=prestado"},{label:"Vencidos",value:n.data.counts.overdue,tone:n.data.counts.overdue>0?"text-red-600":"text-slate-900",href:"/loans?filter=overdue"}]);var L=_e();ae("1uha8ag",r=>{$(()=>{ee.title="Panel · Inventario EDUmind"})});var D=l(Y(L),2);A(D,21,()=>a(B),r=>r.label,(r,i)=>{var d=ie(),t=s(d),_=s(t,!0);e(t);var c=l(t,2),p=s(c,!0);e(c),e(d),w(()=>{I(d,"href",a(i).href),x(_,a(i).label),O(c,1,`mt-1 text-3xl font-bold ${a(i).tone??""}`),x(p,a(i).value)}),o(r,d)}),e(D);var N=l(D,2),E=s(N),C=l(s(E),2);{var F=r=>{var i=de();o(r,i)},G=r=>{var i=U();A(i,21,()=>n.data.activeLoans,d=>d.id,(d,t)=>{var _=ve(),c=s(_),p=s(c),b=s(p,!0);e(p);var g=l(p,2),P=s(g);e(g);var j=l(g,2),V=s(j,!0);e(j),e(c);var y=l(c,2),q=s(y);{var m=u=>{var h=oe(),M=s(h);e(h),w((Q,R,W)=>{O(h,1,`font-medium ${Q??""}`),x(M,`${R??""}${W??""}`)},[()=>T(a(t).due_at,a(t).returned_at)?"text-red-600":"text-slate-500",()=>T(a(t).due_at,a(t).returned_at)?"Vencido ":"Vence ",()=>se(a(t).due_at)]),o(u,h)},f=u=>{var h=le();o(u,h)};k(q,u=>{a(t).due_at?u(m):u(f,-1)})}e(y),e(_),w(()=>{I(p,"href",`/devices/${a(t).device_id??""}`),x(b,a(t).device_code),x(P,`· ${a(t).device_name??a(t).category_name??""??""}`),x(V,a(t).borrower_name??"Sin asignar")}),o(d,_)}),e(i),o(r,i)};k(C,r=>{n.data.activeLoans.length===0?r(F):r(G,-1)})}e(E);var S=l(E,2),H=l(s(S),2);{var J=r=>{var i=ne();o(r,i)},K=r=>{var i=U();A(i,21,()=>n.data.recent,d=>d.id,(d,t)=>{var _=me(),c=s(_),p=s(c),b=s(p),g=s(b,!0);e(b);var P=l(b,2);{var j=m=>{var f=ce();o(m,f)},V=m=>{var f=pe(),u=s(f);e(f),w(()=>x(u,`prestado a ${a(t).borrower_name??"—"??""}`)),o(m,f)};k(P,m=>{a(t).returned_at?m(j):m(V,-1)})}e(p);var y=l(p,2),q=s(y,!0);e(y),e(c),e(_),w(m=>{x(g,a(t).device_code),x(q,m)},[()=>re(a(t).returned_at??a(t).checkout_at)]),o(d,_)}),e(i),o(r,i)};k(H,r=>{n.data.recent.length===0?r(J):r(K,-1)})}e(S),e(N),o(z,L),Z()}export{je as component};
