1import{e as ns,a as j,u as U,h as ds,d as _,j as e}from"./vendor-query-BUwfVuOG.js";import{ad as cs,aY as ke,bp as ms,B as D,ay as us,aZ as Me,a_ as Se,a$ as Ce,bb as hs,ah as g,V as k,_ as xs,aK as ps,aM as fs,b1 as js,z as H,A as I,az as gs,aA as Ns,aB as vs,aC as ys,aD as Ue,X as bs,ae as O,af as R,G as De,c as re,b as ws,ak as Ts,bA as ks,ai as Ee,U as Ms,ar as oe,e as K}from"./index-_mdjBuBr.js";import{g as Ss}from"./course-hour-slots-P3Wl80X_.js";import{U as X}from"./user-DabAyIRP.js";import{G as Cs}from"./globe-CbTdBJK1.js";import{F as Us}from"./filter-DJJHu03P.js";import{D as Ds}from"./download-B4H3Qivx.js";import{C as He}from"./chart-column-CfBxRHUN.js";import{T as Es}from"./trash-2-cShw1216.js";import{h as m,e as Ie,f as Ae,p as i,t as z}from"./vendor-dates-Dg9w3qQM.js";import"./vendor-ui-BV6bAOPF.js";import"./vendor-charts-CsidWLaS.js";import"./vendor-motion-CeFdiwAh.js";import"./vendor-forms-D-pbkChx.js";function Bs(){const G=ns(),{toast:w}=cs(),[$e,A]=j.useState(!1),{data:le}=U({queryKey:["/api/admin/me"],retry:!1}),Y=le?.role==="evaluador",[Fe,ie]=j.useState(!1),[b,qe]=j.useState(null),[N,Z]=j.useState(null),[l,p]=j.useState({name:"",email:"",color:"#3b82f6",bio:"",phone:"",instagramUrl:"",tiktokUrl:"",linkedinUrl:"",websiteUrl:""}),Pe=[{value:"#3b82f6",label:"Azul"},{value:"#22c55e",label:"Verde"},{value:"#ef4444",label:"Rojo"},{value:"#f59e0b",label:"Naranja"},{value:"#8b5cf6",label:"Morado"},{value:"#ec4899",label:"Rosa"},{value:"#14b8a6",label:"Turquesa"},{value:"#6b7280",label:"Gris"}],[$,ne]=j.useState(()=>m(Ie(new Date),"yyyy-MM-dd")),[F,de]=j.useState(()=>m(Ae(new Date),"yyyy-MM-dd")),[q,ce]=j.useState("all"),{data:v,isLoading:Le}=U({queryKey:["/api/admin/teachers"]}),{data:B}=U({queryKey:["/api/sessions"]}),{data:me}=U({queryKey:["/api/workshops"]}),{data:ue}=U({queryKey:["/api/courses"]}),{data:he}=U({queryKey:["/api/admin/course-hour-assignments"]}),{data:xe}=U({queryKey:["/api/admin/requests"]}),{data:pe}=U({queryKey:["/api/admin/external-enrollments"]}),fe=ds({queries:(v??[]).map(s=>({queryKey:["/api/admin/session-staff-by-teacher",String(s.id)]}))}),je=j.useMemo(()=>{const s=new Map;return(v??[]).forEach((r,o)=>{s.set(r.id,fe[o]?.data??[])}),s},[v,fe.map(s=>s.dataUpdatedAt).join(",")]),Q=j.useMemo(()=>{const s={};return me?.forEach(r=>{s[r.id]=r}),s},[me]),M=j.useMemo(()=>{if(!v||!B)return[];const s=i($),r=i(F);r.setHours(23,59,59);const o=y=>{const W={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},d=y.match(/(\d{1,2})\s+de\s+(\w+)\s+(\d{4})/i),n=y.match(/(\d{1,2}:\d{2})\s*-\s*(\d{1,2}:\d{2})/);if(d){const E=parseInt(d[1]),f=W[d[2].toLowerCase()],C=parseInt(d[3]);if(f!==void 0)return{date:`${C}-${String(f+1).padStart(2,"0")}-${String(E).padStart(2,"0")}`,time:n?n[1]:void 0,endTime:n?n[2]:void 0}}return null};return v.map(y=>{const d=B.filter(t=>t.teacherId===y.id).map(t=>{const a=Q[t.workshopId],c=t.time.split(":").map(Number),h=t.endTime?.split(":").map(Number)||c,x=h[0]*60+h[1]-(c[0]*60+c[1]),P=pe?.filter(L=>L.sessionId===t.id).reduce((L,V)=>L+V.tickets,0)||0;return{date:t.date,time:t.time,endTime:t.endTime||t.time,workshopName:a?.name||"Taller",attendees:(t.booked||0)+P,duration:x>0?x:90}}).sort((t,a)=>i(a.date).getTime()-i(t.date).getTime()),E=(xe?.filter(t=>t.teacherId===y.id&&t.status==="confirmed")||[]).map(t=>{const a=o(t.preferredDate);let c=90;if(a?.time&&a?.endTime){const h=a.time.split(":").map(Number),x=a.endTime.split(":").map(Number);c=x[0]*60+x[1]-(h[0]*60+h[1])}return{date:a?.date||"",time:a?.time||"",endTime:a?.endTime||"",workshopName:t.workshopName||Q[t.workshopId]?.name||"Solicitud privada",attendees:t.attendees,duration:c>0?c:90,isRequest:!0}}).filter(t=>t.date),C=(he?.filter(t=>t.teacherId===y.id)||[]).flatMap(t=>{const a=ue?.find(T=>T.id===t.courseId),c=Number(/^session-(\d+)$/.exec(t.convocatoriaId)?.[1]),h=a?.sessions?.find(T=>T.id===c),x=h?.selectedDates?.find(T=>(typeof T=="string"?T:T.date)===t.date);if(h?.selectedDates?.length&&!x)return[];const P=h?.schedule?.match(/(\d{1,2}:\d{2})\s*(?:a|-)\s*(\d{1,2}:\d{2})/),L=typeof x=="object"&&x.startTime||P?.[1],V=typeof x=="object"&&x.endTime||P?.[2],be=L&&V?Ss(L,V):[];if(h&&!be.length)return[];const ae=be.find(T=>T.hour===t.hour);if(h&&!ae)return[];const we=ae?.startTime||`${String(t.hour).padStart(2,"0")}:00`,Te=ae?.endTime||`${String(t.hour+1).padStart(2,"0")}:00`,[rs,os]=we.split(":").map(Number),[ls,is]=Te.split(":").map(Number);return[{date:t.date,time:we,endTime:Te,workshopName:a?.name||"Curso",attendees:0,duration:ls*60+is-rs*60-os,convocatoriaId:t.convocatoriaId}]}),J=(je.get(y.id)||[]).map(t=>{if(t.entityType==="session"){const a=B.find(c=>c.id===t.entityId);if(a){const c=a.time.split(":").map(Number),h=a.endTime?.split(":").map(Number)||c,x=h[0]*60+h[1]-(c[0]*60+c[1]);return{date:a.date,time:a.time,endTime:a.endTime||a.time,workshopName:`${Q[a.workshopId]?.name||"Taller"} (apoyo)`,attendees:0,duration:x>0?x:90,isStaff:!0}}}return{date:"",time:"",endTime:"",workshopName:"Apoyo en actividad",attendees:0,duration:90,isStaff:!0}}),ye=J.filter(t=>{if(!t.date)return!1;const a=i(t.date);return z(a,{start:s,end:r})}),Ve=[...d,...E,...C,...J].filter(t=>t.date).sort((t,a)=>i(a.date).getTime()-i(t.date).getTime()),ee=d.filter(t=>{const a=i(t.date);return z(a,{start:s,end:r})}),se=E.filter(t=>{if(!t.date)return!1;const a=i(t.date);return z(a,{start:s,end:r})}),te=C.filter(t=>{const a=i(t.date);return z(a,{start:s,end:r})}),_e=new Set(te.map(t=>t.convocatoriaId)).size,Xe=te.reduce((t,a)=>t+a.duration,0),Ye=new Set(C.map(t=>t.convocatoriaId)).size,Ze=ee.length+se.length,Je=d.length+E.length,es=se.reduce((t,a)=>t+a.duration,0),ss=E.reduce((t,a)=>t+a.duration,0),ts=ye.reduce((t,a)=>t+a.duration,0),as=J.reduce((t,a)=>t+a.duration,0);return{teacherId:y.id,teacherName:y.name,workshopsThisMonth:Ze,coursesThisMonth:_e,hoursThisMonth:Math.round((ee.reduce((t,a)=>t+a.duration,0)+es+Xe+ts)/60*10)/10,totalWorkshops:Je,totalCourses:Ye,totalHours:Math.round((d.reduce((t,a)=>t+a.duration,0)+ss+C.reduce((t,a)=>t+a.duration,0)+as)/60*10)/10,sessions:Ve,filteredSessions:[...ee,...se,...te,...ye]}})},[v,B,Q,$,F,he,ue,xe,pe,je]),S=j.useMemo(()=>{const s=q==="all"?M:M.filter(r=>r.teacherId.toString()===q);return{totalWorkshopsFiltered:s.reduce((r,o)=>r+o.workshopsThisMonth,0),totalHoursFiltered:Math.round(s.reduce((r,o)=>r+o.hoursThisMonth,0)*10)/10,totalWorkshopsAllTime:M.reduce((r,o)=>r+o.totalWorkshops,0),totalHoursAllTime:Math.round(M.reduce((r,o)=>r+o.totalHours,0)*10)/10}},[M,q]),We=()=>{const s=q==="all"?M:M.filter(n=>n.teacherId.toString()===q),r=i($),o=i(F);o.setHours(23,59,59);let u=`Informe de Profesores - ESCOM 2`;u+=`Periodo: ${m(r,"dd/MM/yyyy")} - ${m(o,"dd/MM/yyyy")} 3`,u+=`Generado: ${m(new Date,"dd/MM/yyyy HH:mm")} 4
5`,u+=`RESUMEN GENERAL 6`,u+=`Profesor,Talleres en periodo,Horas en periodo,Total talleres,Total horas 7`,s.forEach(n=>{u+=`${n.teacherName},${n.workshopsThisMonth},${n.hoursThisMonth},${n.totalWorkshops},${n.totalHours} 8`}),u+=`TOTAL,${S.totalWorkshopsFiltered},${S.totalHoursFiltered},${S.totalWorkshopsAllTime},${S.totalHoursAllTime} 9`,u+=` 10 11DETALLE POR TALLER 12`,u+=`Profesor,Fecha,Hora inicio,Hora fin,Taller,Asistentes,Duracion (min) 13`,s.forEach(n=>{n.sessions.filter(f=>{const C=i(f.date);return z(C,{start:r,end:o})}).forEach(f=>{u+=`${n.teacherName},${m(i(f.date),"dd/MM/yyyy")},${f.time},${f.endTime},"${f.workshopName}",${f.attendees},${f.duration} 14`})});const y=new Blob(["\uFEFF"+u],{type:"text/csv;charset=utf-8;"}),W=URL.createObjectURL(y),d=document.createElement("a");d.href=W,d.download=`informe_profesores_${m(r,"yyyyMMdd")}_${m(o,"yyyyMMdd")}.csv`,document.body.appendChild(d),d.click(),document.body.removeChild(d),URL.revokeObjectURL(W),w({title:"Informe CSV descargado"})},Oe=()=>{ne(m(Ie(new Date),"yyyy-MM-dd")),de(m(Ae(new Date),"yyyy-MM-dd")),ce("all")},ge=_({mutationFn:async s=>oe("POST","/api/admin/teachers",s),onSuccess:()=>{G.invalidateQueries({queryKey:["/api/admin/teachers"]}),A(!1),p({name:"",email:"",color:"#3b82f6",bio:"",phone:"",instagramUrl:"",tiktokUrl:"",linkedinUrl:"",websiteUrl:""}),w({title:"Profesor creado correctamente"})},onError:()=>{w({title:"Error al crear profesor",variant:"destructive"})}}),Ne=_({mutationFn:async({id:s,data:r})=>oe("PUT",`/api/admin/teachers/${s}`,r),onSuccess:()=>{G.invalidateQueries({queryKey:["/api/admin/teachers"]}),A(!1),Z(null),p({name:"",email:"",color:"#3b82f6",bio:"",phone:"",instagramUrl:"",tiktokUrl:"",linkedinUrl:"",websiteUrl:""}),w({title:"Profesor actualizado correctamente"})},onError:()=>{w({title:"Error al actualizar profesor",variant:"destructive"})}}),Re=_({mutationFn:async s=>oe("DELETE",`/api/admin/teachers/${s}`),onSuccess:()=>{G.invalidateQueries({queryKey:["/api/admin/teachers"]}),w({title:"Profesor eliminado correctamente"})},onError:()=>{w({title:"Error al eliminar profesor",variant:"destructive"})}}),Ke=s=>{s.preventDefault(),N?Ne.mutate({id:N.id,data:l}):ge.mutate(l)},ve=_({mutationFn:async({id:s,file:r})=>{const o=new FormData;o.append("photo",r);const u=await fetch(`/api/admin/teachers/${s}/photo`,{method:"POST",body:o,credentials:"include"});if(!u.ok)throw new Error("Error al subir foto");return u.json()},onSuccess:()=>{G.invalidateQueries({queryKey:["/api/admin/teachers"]}),w({title:"Foto actualizada correctamente"})},onError:()=>{w({title:"Error al subir la foto",variant:"destructive"})}}),ze=s=>{Z(s),p({name:s.name,email:s.email,color:s.color||"#3b82f6",bio:s.bio||"",phone:s.phone||"",instagramUrl:s.instagramUrl||"",tiktokUrl:s.tiktokUrl||"",linkedinUrl:s.linkedinUrl||"",websiteUrl:s.websiteUrl||""}),A(!0)},Ge=()=>{Z(null),p({name:"",email:"",color:"#3b82f6",bio:"",phone:"",instagramUrl:"",tiktokUrl:"",linkedinUrl:"",websiteUrl:""}),A(!0)},Be=s=>{qe(s),ie(!0)};return Le?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold",children:"Profesores"}),e.jsx("p",{className:"text-muted-foreground",children:"Gestión del equipo docente de ESCOM"})]}),!Y&&e.jsxs(ke,{open:$e,onOpenChange:A,children:[e.jsx(ms,{asChild:!0,children:e.jsxs(D,{onClick:Ge,children:[e.jsx(us,{className:"h-4 w-4 mr-2"}),"Añadir profesor"]})}),e.jsxs(Me,{className:"max-h-[80vh] overflow-y-auto",children:[e.jsx(Se,{children:e.jsx(Ce,{children:N?"Editar profesor":"Nuevo profesor"})}),e.jsxs("form",{onSubmit:Ke,className:"space-y-4",children:[N&&e.jsxs("div",{className:"flex items-center gap-4 pb-2",children:[N.photoUrl?e.jsx("img",{src:N.photoUrl,alt:N.name,className:"h-16 w-16 rounded-full object-cover"}):e.jsx("div",{className:"h-16 w-16 rounded-full bg-muted flex items-center justify-center",children:e.jsx(X,{className:"h-8 w-8 text-muted-foreground"})}),e.jsx("div",{children:e.jsxs("label",{className:"cursor-pointer",children:[e.jsx("input",{type:"file",accept:"image/jpeg,image/png,image/webp",className:"hidden",onChange:s=>{const r=s.target.files?.[0];r&&N&&ve.mutate({id:N.id,file:r})}}),e.jsxs("span",{className:"inline-flex items-center gap-1 text-sm text-primary hover:underline",children:[e.jsx(hs,{className:"h-4 w-4"}),ve.isPending?"Subiendo...":"Cambiar foto"]})]})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{htmlFor:"name",children:"Nombre"}),e.jsx(k,{id:"name",value:l.name,onChange:s=>p({...l,name:s.target.value}),placeholder:"Nombre del profesor",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{htmlFor:"email",children:"Email de notificación"}),e.jsx(k,{id:"email",type:"email",value:l.email,onChange:s=>p({...l,email:s.target.value}),placeholder:"[email protected]",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{children:"Color de etiqueta"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:Pe.map(s=>e.jsx("button",{type:"button",className:`w-8 h-8 rounded-full border-2 transition-all ${l.color===s.value?"border-gray-900 scale-110":"border-transparent hover:scale-105"}`,style:{backgroundColor:s.value},onClick:()=>p({...l,color:s.value}),title:s.label},s.value))})]}),N&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"border-t pt-4",children:[e.jsx("h3",{className:"font-medium mb-3",children:"Perfil del profesor"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{htmlFor:"edit-bio",children:"BiografÃa"}),e.jsx(xs,{id:"edit-bio",value:l.bio,onChange:s=>p({...l,bio:s.target.value}),placeholder:"BiografÃa del profesor...",rows:3})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(g,{htmlFor:"edit-phone",className:"flex items-center gap-2",children:[e.jsx(ps,{className:"h-4 w-4"})," Teléfono"]}),e.jsx(k,{id:"edit-phone",value:l.phone,onChange:s=>p({...l,phone:s.target.value}),placeholder:"+34 600 000 000"})]})]})]}),e.jsxs("div",{className:"border-t pt-4",children:[e.jsx("h3",{className:"font-medium mb-3",children:"Redes sociales"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(g,{htmlFor:"edit-instagram",className:"flex items-center gap-2",children:[e.jsx(fs,{className:"h-4 w-4"})," Instagram"]}),e.jsx(k,{id:"edit-instagram",value:l.instagramUrl,onChange:s=>p({...l,instagramUrl:s.target.value}),placeholder:"https://instagram.com/perfil"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{htmlFor:"edit-tiktok",children:"TikTok"}),e.jsx(k,{id:"edit-tiktok",value:l.tiktokUrl,onChange:s=>p({...l,tiktokUrl:s.target.value}),placeholder:"https://tiktok.com/@perfil"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(g,{htmlFor:"edit-linkedin",className:"flex items-center gap-2",children:[e.jsx(js,{className:"h-4 w-4"})," LinkedIn"]}),e.jsx(k,{id:"edit-linkedin",value:l.linkedinUrl,onChange:s=>p({...l,linkedinUrl:s.target.value}),placeholder:"https://linkedin.com/in/perfil"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(g,{htmlFor:"edit-website",className:"flex items-center gap-2",children:[e.jsx(Cs,{className:"h-4 w-4"})," Web personal"]}),e.jsx(k,{id:"edit-website",value:l.websiteUrl,onChange:s=>p({...l,websiteUrl:s.target.value}),placeholder:"https://web.com"})]})]})]})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(D,{type:"button",variant:"outline",onClick:()=>A(!1),children:"Cancelar"}),e.jsx(D,{type:"submit",disabled:ge.isPending||Ne.isPending,children:N?"Guardar cambios":"Crear profesor"})]})]})]})]})]}),e.jsx(H,{children:e.jsx(I,{className:"pt-6",children:e.jsxs("div",{className:"flex flex-wrap items-end gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Us,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium",children:"Filtrar por periodo:"})]}),e.jsxs("div",{className:"flex-1 flex flex-wrap items-end gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(g,{className:"text-xs",children:"Desde"}),e.jsx(k,{type:"date",value:$,onChange:s=>ne(s.target.value),className:"w-40"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(g,{className:"text-xs",children:"Hasta"}),e.jsx(k,{type:"date",value:F,onChange:s=>de(s.target.value),className:"w-40"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(g,{className:"text-xs",children:"Profesor"}),e.jsxs(gs,{value:q,onValueChange:ce,children:[e.jsx(Ns,{className:"w-44",children:e.jsx(vs,{placeholder:"Todos"})}),e.jsxs(ys,{children:[e.jsx(Ue,{value:"all",children:"Todos los profesores"}),v?.map(s=>e.jsx(Ue,{value:s.id.toString(),children:s.name},s.id))]})]})]}),e.jsx(D,{variant:"ghost",size:"icon",onClick:Oe,title:"Limpiar filtros",children:e.jsx(bs,{className:"h-4 w-4"})})]}),e.jsxs(D,{onClick:We,variant:"outline",children:[e.jsx(Ds,{className:"h-4 w-4 mr-2"}),"Descargar CSV"]})]})})}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[e.jsxs(H,{
14children:[e.jsxs(O,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(R,{className:"text-sm font-medium",children:"Talleres en periodo"}),e.jsx(De,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(I,{children:[e.jsx("div",{className:"text-2xl font-bold",children:S.totalWorkshopsFiltered}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[m(i($),"d MMM",{locale:K})," - ",m(i(F),"d MMM",{locale:K})]})]})]}),e.jsxs(H,{children:[e.jsxs(O,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(R,{className:"text-sm font-medium",children:"Horas en periodo"}),e.jsx(re,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(I,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[S.totalHoursFiltered,"h"]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[m(i($),"d MMM",{locale:K})," - ",m(i(F),"d MMM",{locale:K})]})]})]}),e.jsxs(H,{children:[e.jsxs(O,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(R,{className:"text-sm font-medium",children:"Total talleres"}),e.jsx(He,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(I,{children:[e.jsx("div",{className:"text-2xl font-bold",children:S.totalWorkshopsAllTime}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Histórico completo"})]})]}
14),e.jsxs(H,{children:[e.jsxs(O,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(R,{className:"text-sm font-medium",children:"Total horas"}),e.jsx(re,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(I,{children:[e.jsxs("div",{className:"text-2xl font-bold",children:[S.totalHoursAllTime,"h"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Histórico completo"})]})]})]}),e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:(Y?v?.filter(s=>{const r=le?.name?.toLowerCase()||"",o=s.name.toLowerCase();return r.includes(o)||o.includes(r.split(" ")[0])}):v)?.map(s=>{const r=M.find(o=>o.teacherId===s.id);return e.jsxs(H,{className:"hover:shadow-md transition-shadow",children:[e.jsx(O,{className:"pb-3",children:e.jsx("div",{className:"flex items-start justify-between",children:e.jsxs("div",{className:"flex items-center gap-3",children:[s.photoUrl?e.jsx("img",{src:s.photoUrl,alt:s.name,className:"h-10 w-10 rounded-full object-cover"}):e.jsx("div",{className:"h-10 w-10 rounded-full flex items-center justify-center",style:{backgroundColor:`${s.color||"#3b82f6"}20`},children:e.jsx(X,{className:"h-5 w-5",style:{color:s.color||"#3b82f6"}})}),e.jsxs("div",{children:[e.jsx(R,{className:"text-lg",children:s.name}),e.jsx(ws,{className:"text-white",style:{backgroundColor:s.color||"#3b82f6"},children:s.isActive?"Activo":"Inactivo"})]})]})})}),e.jsxs(I,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Ts,{className:"h-4 w-4"}),e.jsx("span",{className:"truncate",children:s.email})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-2 p-3 bg-muted/50 rounded-lg",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-lg font-bold text-primary",children:r?.totalWorkshops||0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Total talleres"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-lg font-bold text-purple-600",children:r?.totalCourses||0}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Total cursos"})]}),e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"text-lg font-bold text-primary",children:[r?.totalHours||0,"h"]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Total horas"})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(D,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>r&&Be(r),children:[e.jsx(He,{className:"h-4 w-4 mr-1"}),"Ver detalle"]}),!Y&&e.jsxs(e.Fragment,{children:[e.jsx(D,{variant:"outline",size:"sm",onClick:()=>ze(s),children:e.jsx(ks,{className:"h-4 w-4"})}),e.jsx(D,{variant:"outline",size:"sm",onClick:()=>{confirm("¿Estás seguro de eliminar este profesor?")&&Re.mutate(s.id)},children:e.jsx(Es,{className:"h-4 w-4"})})]})]})]})]},s.id)})}),(!v||v.length===0)&&e.jsx(H,{children:e.jsxs(I,{className:"flex flex-col items-center justify-center py-12",children:[e.jsx(X,{className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("p",{className:"text-lg font-medium",children:"No hay profesores"}),e.jsx("p",{className:"text-muted-foreground",children:"Añade el primer profesor del equipo"})]})}),e.jsx(ke,{open:Fe,onOpenChange:ie,children:e.jsxs(Me,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[e.jsx(Se,{children:e.jsxs(Ce,{className:"flex items-center gap-2",children:[e.jsx(X,{className:"h-5 w-5"}),b?.teacherName]})}),b&&e.jsxs("div",{className:"flex-1 overflow-y-auto space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-3 md:grid-cols-6 gap-3",children:[e.jsxs("div",{className:"bg-primary/10 rounded-lg p-3 text-center",children:[e.jsx("div",{className:"text-xl font-bold text-primary",children:b.workshopsThisMonth}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Talleres (mes)"})]}),e.jsxs("div",{className:"bg-purple-100 rounded-lg p-3 text-center",children:[e.jsx("div",{className:"text-xl font-bold text-purple-600",children:b.coursesThisMonth}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Cursos (mes)"})]}),e.jsxs("div",{className:"bg-primary/10 rounded-lg p-3 text-center",children:[e.jsxs("div",{className:"text-xl font-bold text-primary",children:[b.hoursThisMonth,"h"]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Horas (mes)"})]}),e.jsxs("div",{className:"bg-muted rounded-lg p-3 text-center",children:[e.jsx("div",{className:"text-xl font-bold",children:b.totalWorkshops}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Total talleres"})]}),e.jsxs("div",{className:"bg-muted rounded-lg p-3 text-center",children:[e.jsx("div",{className:"text-xl font-bold",children:b.totalCourses}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Total cursos"})]}),e.jsxs("div",{className:"bg-muted rounded-lg p-3 text-center",children:[e.jsxs("div",{className:"text-xl font-bold",children:[b.totalHours,"h"]}),e.jsx("div",{className:"text-xs text-muted-foreground",children:"Total horas"})]})]}),e.jsxs("div",{children:[e.jsxs("h4",{className:"font-medium mb-3 flex items-center gap-2",children:[e.jsx(Ee,{className:"h-4 w-4"}),"Historial de talleres impartidos"]}),b.sessions.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(De,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"No hay talleres asignados aún"})]}):e.jsx("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:b.sessions.map((s,r)=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg hover:bg-muted transition-colors",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium text-sm",children:s.workshopName}),e.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-2",children:[e.jsx(Ee,{className:"h-3 w-3"}),m(i(s.date),"EEE d MMM yyyy",{locale:K}),e.jsx("span",{children:"·"}),e.jsx(re,{className:"h-3 w-3"}),s.time," - ",s.endTime]})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("div",{className:"text-sm font-medium",children:[Math.round(s.duration/60*10)/10,"h"]}),e.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1 justify-end",children:[e.jsx(Ms,{className:"h-3 w-3"}),s.attendees," asist."]})]})]},r))})]})]})]})})]})}export{Bs as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.