import{C as g,T as u,w as e,t as f,h as c,j as h}from"./index-DDBPimHe.js";import{u as n}from"./useSuspenseQuery-BKRXugiP.js";import{A as v}from"./AppShell-EiEJ9r2t.js";import{T as j,E as b}from"./StatusBadge-CWLPiNbt.js";import{C as N}from"./clock-Cxfyef28.js";import{M as w}from"./map-pin-DXuI6B8e.js";import"./package-DE0SpHx9.js";import"./wrench-ep8n-Rsp.js";const l=["08:00","09:00","10:00","11:00","12:00","13:00","14:00","15:00","16:00","17:00"];function Q(){const{data:t}=n(g()),{data:a}=n(u()),o=t.filter(s=>s.fecha_programada).sort((s,d)=>s.fecha_programada<d.fecha_programada?-1:1).slice(0,6);return e.jsx(v,{children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs uppercase tracking-widest text-muted-foreground font-mono",children:"Planificación"}),e.jsx("h1",{className:"text-3xl font-bold mt-1",children:"Agenda"}),e.jsx("p",{className:"text-muted-foreground mt-1",children:"Asignación de técnicos · vista por jornada"})]}),e.jsxs("div",{className:"bg-card border border-border rounded-xl shadow-card overflow-hidden",children:[e.jsxs("div",{className:"grid grid-cols-[140px_1fr] divide-x divide-border",children:[e.jsx("div",{className:"bg-muted/30 p-4 text-xs uppercase tracking-wider font-mono text-muted-foreground",children:"Técnico"}),e.jsx("div",{className:"grid grid-cols-10 divide-x divide-border",children:l.map(s=>e.jsx("div",{className:"bg-muted/30 p-2 text-xs text-center font-mono text-muted-foreground",children:s},s))})]}),a.length===0&&e.jsx("div",{className:"p-6 text-sm text-muted-foreground text-center",children:"No hay técnicos cargados todavía."}),a.map(s=>{const d=t.filter(r=>r.tecnico_id===s.user_id);return e.jsxs("div",{className:"grid grid-cols-[140px_1fr] divide-x divide-border border-t border-border",children:[e.jsxs("div",{className:"p-3 flex items-center gap-2",children:[e.jsx("div",{className:"size-8 rounded-full bg-secondary grid place-items-center text-xs font-semibold",children:f(s.nombre||"?")}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-medium truncate",children:(s.nombre||"—").split(" ")[0]}),e.jsx("div",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:s.especialidad??"—"})]})]}),e.jsxs("div",{className:"relative grid grid-cols-10 divide-x divide-border min-h-[80px]",children:[l.map((r,i)=>e.jsx("div",{},i)),d.map((r,i)=>{const m=(i*2+1)%8,x=r.tipo==="abono"?2:r.tipo==="relevamiento"?3:2,p=r.tipo==="abono"?"bg-info/15 border-info/30 text-info":r.tipo==="reparacion"?"bg-destructive/10 border-destructive/30 text-destructive":r.tipo==="urgencia"?"bg-destructive border-destructive text-destructive-foreground":"bg-accent border-accent-foreground/20 text-accent-foreground";return e.jsxs("div",{className:`absolute top-1 bottom-1 rounded-md border ${p} px-2 py-1.5 text-xs overflow-hidden`,style:{left:`${m/10*100}%`,width:`${x/10*100}%`},children:[e.jsx("div",{className:"font-mono text-[10px] opacity-70",children:r.codigo}),e.jsx("div",{className:"font-medium truncate",children:c(r)})]},r.id)})]})]},s.id)})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"font-display font-semibold text-lg mb-3",children:"Próximas visitas"}),o.length===0&&e.jsx("div",{className:"text-sm text-muted-foreground",children:"Sin visitas programadas."}),e.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-3",children:o.map(s=>e.jsxs("div",{className:"bg-card border border-border rounded-lg p-4 shadow-card",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2 mb-2",children:[e.jsx(j,{tipo:s.tipo}),e.jsx(b,{estado:s.estado})]}),e.jsx("div",{className:"font-medium text-sm",children:c(s)}),e.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:s.descripcion}),e.jsxs("div",{className:"mt-3 flex items-center gap-3 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(N,{className:"size-3"})," ",s.fecha_programada?.slice(0,16).replace("T"," ")]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(w,{className:"size-3"})," ",h(s)]})]})]},s.id))})]})]})})}export{Q as component};
