1import{r as x,j as e,s as S,P as Ws}from"./index-bMFZPluE.js";import{CoordinatorPanel as Qs}from"./CoordinatorPanel-BMsRMtOY.js";import{AdminCalendar as Ks}from"./AdminCalendar-BLnx26_2.js";import{h as Ha,b as Zs,a as Xs}from"./addressFormatting-eDBQ4TmV.js";import{b as er}from"./teacherMonthlyForecast-DGTfyxMK.js";import{T as ar,b as Ya}from"./TeacherAvailabilityEditor-CzOirxAn.js";import{s as tr}from"./emailApi-BQfIvn0G.js";import{i as Ia,g as sr,p as rr,a as nr,b as or}from"./classRoster-DcgYT_RM.js";import{e as Wt,f as Qt}from"./educationCatalog-pqwMnMBs.js";import{m as Rt,E as Fe,c as ir}from"./pricingEngine-DmHUGCKM.js";import{g as Pt,a as lr,l as dr,b as cr}from"./laborAssignmentControls-PBEP3hIy.js";import{a as xr,b as ur,v as mr,n as pr}from"./phoneFormatting-bIoASOCT.js";import{e as da,a as ca,s as Ot,p as It,g as br,b as zt,c as Bt,f as za,d as gr,h as Gt,i as hr,j as fr}from"./academicTracking-DV-rV9tC.js";import{o as yr}from"./protectedStorage-l8nXRU0Q.js";import{p as Ut,c as Kt,a as jr}from"./candidateAvailability-DgcALE0v.js";import"./laborCostReference-CzuQcRj4.js";import"./siblingDetection-CHQmQ9BJ.js";import"./leadProvisionalFamily-DVBYHIU0.js";import"./homeTutoringProposal-BrGXMNR5.js";import"./familyAgreement-Bm5j7ljB.js";import"./familyReceiptPolicy-egdKJ3_6.js";import"./holidayCalendar-CjdTLo_H.js";function vr(t,l){const d=(f,m)=>`${f}-${String(m).padStart(2,"0")}-01`;return{start:d(t,l),endExclusive:d(l===12?t+1:t,l===12?1:l+1)}}function Vt(t){const l=/^(\d{2}):(\d{2})(?::\d{2}(?:\.\d+)?)?$/.exec(t||"");if(!l)return null;const d=Number(l[1]),f=Number(l[2]);return d<24&&f<60?d*60+f:null}function wr(t,l){const d=Vt(t),f=Vt(l);return d!==null&&f!==null&&f>d?f-d:null}function Zt(t){return t.validated&&["Pendiente","En Curso"].includes(t.status||"")?"Comprobada por administracion":t.status==="Falta Injustificada"?"Registrada · alumno ausente":"Registrada"}function Ba(t){const l=new Map;let d=0;const f=t.filter(m=>!m.deleted_at&&(["Completada","Falta Injustificada","Pagado"].includes(m.status||"")||m.validated&&["Pendiente","En Curso"].includes(m.status||""))).sort((m,M)=>`${m.class_date}T${m.start_time||""}`.localeCompare(`${M.class_date}T${M.start_time||""}`));for(const m of f){const M=wr(m.start_time,m.end_time);M===null&&(d+=1);const D=l.get(m.class_date)||{date:m.class_date,minutes:0,sessions:[]};D.sessions.push({...m,durationMinutes:M}),D.minutes+=M??0,l.set(m.class_date,D)}return{days:[...l.values()],sessionCount:f.length,totalMinutes:[...l.values()].reduce((m,M)=>m+M.minutes,0),invalidDurationCount:d}}function Xt(t){return(t/60).toLocaleString("es-ES",{maximumFractionDigits:2})}function ua(t){if(t===null)return"Revisar horario";const l=Math.floor(t/60),d=t%60;return[l?`${l} h`:"",d?`${d} min`:""].filter(Boolean).join(" ")||"0 h"}const Ga=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],Ja=t=>t.split("-").reverse().join("/"),ma=t=>(t==null?void 0:t.slice(0,5))||"--:--",Ht=` 2 .monitor-hours-report { font: 12px/1.5 Arial, sans-serif; color: #172334; } 3 .monitor-hours-report h1 { font-size: 21px; margin: 0; } 4 .monitor-hours-report h2 { font-size: 13px; margin: 18px 0 6px; } 5 .monitor-hours-report p { margin: 6px 0; } 6 .monitor-hours-report .hours-total { font-size: 24px; font-weight: 800; margin: 20px 0; } 7 .monitor-hours-report .hours-day { break-inside: avoid; } 8 .monitor-hours-report .hours-row { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid #e5e7eb; } 9 .monitor-hours-report .hours-row > div { min-width: 0; overflow-wrap: anywhere; } 10 .monitor-hours-report .hours-row > strong { flex-shrink: 0; } 11 .monitor-hours-report .hours-muted { color: #526174; } 12 .monitor-hours-report .hours-note { margin-top: 22px; padding-top: 10px; border-top: 1px solid #cbd5e1; } 13`;function Nr({summary:t,profile:l,monthLabel:d}){return e.jsxs("div",{className:"monitor-hours-report",id:"printable-hours-monitor",children:[e.jsx("h1",{children:"Resumen mensual de horas"}),e.jsxs("p",{children:["Profe en Casa · ",d]}),e.jsxs("p",{children:[e.jsx("strong",{children:l.name}),e.jsx("br",{}),l.email]}),e.jsxs("p",{className:"hours-total",children:[Xt(t.totalMinutes)," horas registradas"]}),e.jsxs("p",{children:[t.sessionCount," sesiones · ",t.days.length," dias con clases registradas"]}),t.invalidDurationCount>0&&e.jsxs("p",{children:["Hay ",t.invalidDurationCount," sesiones con horario pendiente de revisar. Su duracion no se ha sumado."]}),t.days.map(f=>e.jsxs("section",{className:"hours-day",children:[e.jsxs("h2",{children:[Ja(f.date)," · ",ua(f.minutes)]}),f.sessions.map(m=>e.jsxs("div",{className:"hours-row",children:[e.jsxs("div",{children:[e.jsx("strong",{children:m.student_name||"Clase"}),e.jsxs("p",{children:[ma(m.start_time)," - ",ma(m.end_time)," · ",m.subject||"Apoyo educativo"]}),e.jsxs("p",{className:"hours-muted",children:[m.modality," · ",Zt(m)]})]}),e.jsx("strong",{children:ua(m.durationMinutes)})]},m.id))]},f.date)),e.jsx("p",{className:"hours-note",children:"Resumen de la duracion de las clases registradas en la app. Si falta una clase o hay algun horario incorrecto, comunicalo a Coordinacion. La nomina se entrega por separado al cerrar el mes."})]})}function kr({month:t,year:l,summary:d,profile:f,loading:m,error:M,onBack:D,onPreviousMonth:oe,onNextMonth:ee,onCurrentMonth:pe,onRetry:R}){const[Le,i]=x.useState(!1),ie=new Date,o=t===ie.getMonth()+1&&l===ie.getFullYear(),_=`${Ga[t-1]} ${l}`;x.useEffect(()=>{i(!1)},[t,l,f.email]);const V=()=>{const I=document.getElementById("printable-hours-monitor");if(!I)return;const E=window.open("","_blank","width=900,height=750");if(!E){alert("Permite abrir la ventana de impresion para descargar el resumen.");return}E.document.write(`<!doctype html><html lang="es"><head><meta charset="UTF-8"><title>Resumen mensual de horas</title><style>@page { size: A4; margin: 18mm; } body { margin: 0; } ${Ht}</style></head><body></body></html>`),E.document.body.appendChild(I.cloneNode(!0)),E.document.close(),E.onafterprint=()=>E.close(),E.focus(),E.print()};return e.jsxs("div",{className:"min-h-screen bg-[#F5F7FA] p-4 font-sans pb-24 text-left overflow-y-auto relative",children:[e.jsxs("div",{className:"max-w-md mx-auto
13space-y-6",children:[D&&e.jsxs("button",{onClick:D,className:"text-gray-500 hover:text-[#1c74e9] text-xs font-bold mb-2",children:["<"," Volver al tablon"]}),e.jsxs("header",{className:"flex justify-between items-end gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[#1c74e9] text-[10px] font-black uppercase tracking-widest mb-1",children:"Mi jornada"}),e.jsx("h1",{className:"text-3xl font-black text-gray-900 leading-tight",children:"Mis horas"})]}),!m&&!M&&d.sessionCount>0&&e.jsx("button",{onClick:()=>i(!0),className:"bg-white text-gray-900 border border-gray-100 shadow-sm px-4 py-3 rounded-2xl text-xs font-bold shrink-0",children:"Resumen PDF"})]}),e.jsxs("div",{className:"bg-white border border-gray-100 rounded-[24px] p-3 shadow-sm flex items-center justify-between gap-3",children:[e.jsx("button",{type:"button",onClick:oe,className:"w-11 h-11 rounded-2xl bg-gray-50 border border-gray-100 text-gray-700 font-black","aria-label":"Mes anterior",children:"<"}),e.jsxs("div",{className:"text-center min-w-0",children:[e.jsx("p",{className:"text-gray-900 text-lg font-black leading-none",children:Ga[t-1]}),e.jsx("p",{className:"text-gray-500 text-xs font-bold mt-1",children:l}),!o&&e.jsx("button",{type:"button",onClick:pe,className:"mt-2 text-[10px] font-bold text-[#1c74e9] bg-blue-50 border border-blue-100 px-3 py-1.5 rounded-full",children:"Volver a este mes"})]}),e.jsx("button",{type:"button",onClick:ee,className:"w-11 h-11 rounded-2xl bg-gray-50 border border-gray-100 text-gray-700 font-black","aria-label":"Mes siguiente",children:">"})]}),m?e.jsx("div",{role:"status",className:"text-center bg-white p-10 rounded-[32px] border border-gray-100 text-[#1c74e9] font-bold",children:"Cargando tus horas..."}):M?e.jsxs("div",{role:"alert",className:"bg-white p-6 rounded-[24px] border border-red-100 space-y-4",children:[e.jsx("p",{className:"text-red-700 text-sm",children:M}),e.jsx("button",{onClick:R,className:"bg-[#1c74e9] text-white px-4 py-3 rounded-xl font-bold text-sm",children:"Reintentar"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("section",{"aria-label":"Total de horas del mes",className:"bg-gradient-to-br from-[#1c74e9] to-blue-900 p-6 rounded-[32px] shadow-xl text-white relative overflow-hidden border border-white/10",children:[e.jsx("div",{className:"absolute top-[-50%] right-[-10%] w-[80%] h-[200%] bg-white/10 rounded-full blur-3xl"}),e.jsxs("div",{className:"relative z-10",children:[e.jsxs("p",{className:"text-blue-100 text-xs font-bold mb-3",children:["Horas registradas en ",Ga[t-1].toLowerCase()]}),e.jsxs("p",{className:"text-6xl font-black tracking-tight",children:[Xt(d.totalMinutes)," ",e.jsx("span",{className:"text-3xl",children:"h"})]}),e.jsxs("p",{className:"text-sm mt-4",children:[d.sessionCount," sesiones · ",d.days.length," dias"]}),e.jsx("p",{className:"mt-4 text-xs leading-relaxed text-blue-100",children:"Consulta el detalle de tus clases. La nomina se entrega por separado al cerrar el mes."})]})]}),d.invalidDurationCount>0&&e.jsxs("p",{role:"status",className:"bg-amber-50 border border-amber-200 rounded-2xl p-4 text-sm text-amber-900",children:["Hay ",d.invalidDurationCount," sesiones con horario pendiente de revisar. Su duracion no se ha sumado; avisa a Coordinacion."]}),d.sessionCount===0?e.jsxs("div",{className:"text-center bg-white p-8 rounded-[24px] border border-gray-100 shadow-sm",children:[e.jsxs("p",{className:"text-gray-900 font-bold",children:["Todavia no hay clases registradas en ",_,"."]}),e.jsx("p",{className:"text-gray-500 text-sm mt-2",children:"Apareceran al registrar la clase o al comprobarla Administracion. Puedes revisar las pendientes en Mi Agenda."})]}):e.jsxs("div",{className:"space-y-5",children:[e.jsx("h2",{className:"text-gray-500 text-xs font-bold uppercase tracking-widest",children:"Detalle por dia"}),d.days.map(I=>e.jsxs("section",{"aria-label":`Clases del ${Ja(I.date)}`,className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between gap-3 px-1 text-sm font-bold text-gray-700",children:[e.jsx("h3",{children:Ja(I.date)}),e.jsx("p",{children:ua(I.minutes)})]}),I.sessions.map(E=>e.jsxs("article",{className:"bg-white p-5 rounded-[24px] border border-gray-100 shadow-sm",children:[e.jsxs("div",{className:"flex justify-between items-start gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-gray-900 font-black text-sm leading-snug break-words",children:E.student_name||"Clase"}),e.jsxs("p",{className:"text-gray-600 text-xs mt-2",children:[ma(E.start_time)," - ",ma(E.end_time)]}),e.jsxs("p",{className:"text-gray-500 text-xs mt-1 break-words",children:[E.subject||"Apoyo educativo"," · ",E.modality||"Clase"]})]}),e.jsx("p",{className:"text-[#1c74e9] font-black text-lg text-right shrink-0 max-w-[40%]",children:ua(E.durationMinutes)})]}),e.jsx("p",{className:"inline-block mt-3 text-[10px] font-bold text-emerald-700 bg-emerald-50 border border-emerald-100 px-2 py-1 rounded-lg",children:Zt(E)})]},E.id))]},I.date)),e.jsx("p",{className:"text-gray-500 text-xs leading-relaxed",children:"Si falta alguna clase, revisa Mi Agenda. Si el horario o la duracion no coinciden, av
13isa a Coordinacion para corregirlo."})]})]})]}),Le&&!m&&!M&&e.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Resumen mensual de horas",className:"fixed inset-0 bg-gray-900/90 backdrop-blur-md z-[9999] p-4 flex flex-col justify-center items-center",children:[e.jsx("style",{children:Ht}),e.jsxs("div",{className:"bg-white text-black w-full max-w-xl rounded-[24px] shadow-2xl flex flex-col max-h-[90dvh]",children:[e.jsx("div",{className:"p-5 sm:p-8 overflow-y-auto flex-1",children:e.jsx(Nr,{summary:d,profile:f,monthLabel:_})}),e.jsxs("div",{className:"flex flex-wrap gap-3 p-4 bg-gray-50 border-t border-gray-100 shrink-0 rounded-b-[24px]",children:[e.jsx("button",{onClick:V,className:"flex-1 py-3 px-4 bg-[#1c74e9] text-white font-bold text-sm rounded-xl",children:"Descargar / imprimir"}),e.jsx("button",{onClick:()=>i(!1),className:"py-3 px-4 bg-gray-200 text-gray-800 font-bold text-sm rounded-xl",children:"Cerrar visor"})]})]})]})]})}const _r=({onBack:t,previewEmail:l})=>{const d=new Date,[f,m]=x.useState({year:d.getFullYear(),month:d.getMonth()+1}),[M,D]=x.useState(()=>Ba([])),[oe,ee]=x.useState({name:"",email:""}),[pe,R]=x.useState(!0),[Le,i]=x.useState(""),[ie,o]=x.useState(0),_=V=>m(I=>{const E=new Date(I.year,I.month-1+V,1);return{year:E.getFullYear(),month:E.getMonth()+1}});return x.useEffect(()=>{let V=!1;return R(!0),i(""),D(Ba([])),ee({name:"",email:""}),(async()=>{var E,we;try{let Q=l;if(!Q){const{data:pa,error:qe}=await S.auth.getUser();if(qe)throw qe;Q=(E=pa.user)==null?void 0:E.email}if(!Q)throw new Error("No se ha encontrado la sesion del profesor.");const Te=vr(f.year,f.month),[be,Ne]=await Promise.all([S.from("teachers").select("name,email").ilike("email",Q).limit(1).maybeSingle(),S.from("classes").select("id,class_date,start_time,end_time,student_name,subject,modality,status,validated").eq("monitor_email",Q).gte("class_date",Te.start).lt("class_date",Te.endExclusive).is("deleted_at",null).order("class_date",{ascending:!0})]);if(Ne.error)throw Ne.error;if(be.error)throw be.error;if(V)return;ee({name:((we=be.data)==null?void 0:we.name)||Q.split("@")[0],email:Q}),D(Ba(Ne.data||[]))}catch{V||i("No se han podido cargar tus horas. Vuelve a intentarlo.")}finally{V||R(!1)}})(),()=>{V=!0}},[l,f.year,f.month,ie]),e.jsx(kr,{month:f.month,year:f.year,summary:M,profile:oe,loading:pe,error:Le,onBack:t,onPreviousMonth:()=>_(-1),onNextMonth:()=>_(1),onCurrentMonth:()=>m({year:d.getFullYear(),month:d.getMonth()+1}),onRetry:()=>o(V=>V+1)})},Cr=t=>(t||"").trim().split(/\s+/)[0]||"familia",ve=t=>(t||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");function Sr({parentName:t,studentNames:l,classDateLabel:d,timeLabel:f,subjectLabel:m,levelLabel:M,monitorName:D}){const oe=Cr(t),ee=l.join(", ");return{subject:`Aviso de falta en clase - ${ee}`,html:` 14 <div style="font-family: Arial, sans-serif; max-width: 640px; margin: 0 auto; padding: 30px; border: 1px solid #e5e7eb; border-radius: 20px; background: #ffffff;"> 15 <div style="text-align: center; margin-bottom: 24px;"> 16 <div style="font-size: 40px; margin-bottom: 12px;">Aviso</div> 17 <h1 style="margin: 0; color: #1c74e9; font-size: 26px; font-weight: 900;">Aviso de ausencia</h1> 18 <p style="margin: 8px 0 0; color: #6b7280; font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;">Profe en Casa</p> 19 </div> 20 21 <p style="font-size: 16px; line-height: 1.7; color: #374151;">Hola ${ve(oe)},</p> 22 <p style="font-size: 16px; line-height: 1.7; color: #374151;"> 23 Te informamos de que <strong>${ve(ee)}</strong> no ha asistido hoy a su clase y no teniamos aviso previo. 24 </p> 25 26 <div style="background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 16px; padding: 18px 20px; margin: 24px 0;"> 27 <p style="margin: 0 0 8px; font-size: 12px; font-weight: 900; color: #6b7280; text-transform: uppercase; letter-spacing: 0.08em;">Detalle de la sesion</p> 28 <p style="margin: 0; font-size: 14px; line-height: 1.8; color: #374151;"> 29 <strong>Fecha:</strong> ${ve(d)}<br /> 30 <strong>Hora:</strong> ${ve(f)}<br /> 31 <strong>Asignatura:</strong> ${ve(m)}<br /> 32 <strong>Nivel:</strong> ${ve(M)}<br /> 33 <strong>Profesor/a:</strong> ${ve(D)} 34 </p> 35 </div> 36 37 <div style="background: #fffbeb; border: 1px solid #fde68a; border-radius: 16px; padding: 18px 20px; margin: 24px 0;"> 38 <p style="margin: 0; font-size: 14px; line-height: 1.8; color: #78350f;"> 39 Al no haber habido aviso previo, esta sesion queda contabilizada para proteger el tiempo reservado del profesor y la plaza del grupo. 40 </p> 41 </div> 42 43 <p style="font-size: 15px; line-height: 1.7; color: #374151;"> 44 Si se trata de una ausencia que necesitais justificar, podeis responder a este correo o avisarnos por WhatsApp para revisarlo con coordinacion. 45 </p> 46 47 <div style="background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 16px; padding: 18px 20px; margin: 24px 0;"> 48 <p style="margin: 0; font-size: 14px; line-height: 1.8; color: #1e3a8a;"> 49 Si la ausencia queda correctamente justificada despues, coordinacion podra revisar opciones de recuperacion en otros grupos o huecos del mismo mes, siempre segun disponibilidad real. 50 </p> 51 </div> 52 53 <p style="margin-top: 28px; font-size: 13px; color: #9ca3af;">Equipo de coordinacion - Profe en Casa</p> 54 </div> 55 `}}const es=t=>{const l=String(t||"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase();return l.includes("academia")||l.includes("profe a 3")},Ar=({modality:t,status:l,isRecoveryGuest:d})=>l==="presente"?!0:es(t)?l==="canjear_bono"?d:l==="falta_injustificada"||l==="falta_justificada":!1,$r=t=>t?!!(t.can_validate_classes||t.can_use_bitacora||t.can_view_team||t.can_view_students||t.can_assign_students||t.can_manage_calendar):!1,Er=["HÃbrido (Presencial y Online)","Solo Online (Nacional/Intl.)","Solo Presencial (Local)","Clases a domicilio"],Dr=[...Wt],Fr=[...Qt],Mr=["Academia Profe a 3","Profe en casa (Domicilio)","Clases Online","Por definir"],Lr=["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"],Tr=["L","M","X","J","V"],me="Cambio puntual de clase",qr=[me,"Horario","Alumno","Asignatura","Grupo","Falta clase","Sobra clase","Otro"],X=(t,l)=>sr(t,l),xa=t=>(t||"").trim().split(" ")[0]||"",O=t=>(t||"").normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g," ").trim().toLowerCase(),Rr=(t="17:00",l=90)=>{const[d,f]=t.split(":").map(Number),m=d*60+f+l,M=Math.floor(m/60),D=m%60;return`${String(M).padStart(2,"0")}
55:${String(D).padStart(2,"0")}`},Pr=t=>[...t].sort((l,d)=>{const f=String(l.start_time||"").localeCompare(String(d.start_time||""));if(f!==0)return f;const m=String(l.end_time||"").localeCompare(String(d.end_time||""));return m!==0?m:String(l.subject||"").localeCompare(String(d.subject||""))}),Or=t=>`${Lr[t.getMonth()]} ${t.getFullYear()}`,Ir=(t,l)=>{if(!t||!l)return!1;const[d,f]=t.split("-").map(Number);return d===l.getFullYear()&&f===l.getMonth()+1},Me=t=>{if((t==null?void 0:t.status)==="Cancelada")return"cancelled";const l=((t==null?void 0:t.modality)||"").toLowerCase(),d=X(t==null?void 0:t.student_name,t==null?void 0:t.recovery_students).length,f=d>=4&&String((t==null?void 0:t.opening_reason)||"").includes("Grupo excepcional de 4 plazas");if(l.includes("academia profe a 3")){if(f)return"exceptional";if(d>=3)return"closed";if(d===2)return"open"}return"individual"},Ua=t=>{const l=X(t==null?void 0:t.student_name,t==null?void 0:t.recovery_students).length,d=Me(t);return d==="cancelled"?"Anulada":d==="exceptional"?`Grupo excepcional (${l})`:d==="closed"?`Grupo cerrado (${l})`:d==="open"?`Grupo abierto (${l})`:l>1?`Grupo flexible (${l})`:"Individual / online"},Yt=t=>{var d;const l=String(t||"").match(/\[Anulacion administrativa\]\s*([^\n]+)/i);return((d=l==null?void 0:l[1])==null?void 0:d.trim())||""},zr=t=>t?t.split("-").reverse().join("/"):"Sin fecha",Br=t=>`${String((t==null?void 0:t.start_time)||"--:--").slice(0,5)} - ${String((t==null?void 0:t.end_time)||"--:--").slice(0,5)}`,Jt=t=>{const l=X(t==null?void 0:t.student_name,t==null?void 0:t.recovery_students).map(d=>xa(d)).join(", ");return[`${zr(t==null?void 0:t.class_date)} ${Br(t)}`,(t==null?void 0:t.subject)||"Clase",(t==null?void 0:t.level)||"Nivel sin concretar",l||"Sin alumnos"].join(" - ")},Va=t=>{const l=Xs(t);return{phone:(t==null?void 0:t.phone)||"",location:l.locality,address_line:l.address_line,address_details:l.address_details,postal_code:l.postal_code,province:l.province,studies:(t==null?void 0:t.studies)||"",specialty:(t==null?void 0:t.specialty)||"",subjects:(t==null?void 0:t.subjects)||"",work_modality:(t==null?void 0:t.work_modality)||"",availability_notes:(t==null?void 0:t.availability_notes)||"",winter_schedule:(t==null?void 0:t.winter_schedule)||"",summer_schedule:(t==null?void 0:t.summer_schedule)||"",weekly_availability:Ut(t==null?void 0:t.weekly_availability),summer_availability:Ut(t==null?void 0:t.summer_availability),availability_state:(t==null?void 0:t.availability_state)||"Disponible ahora",availability_update_notes:(t==null?void 0:t.availability_update_notes)||"",availability_last_confirmed_at:(t==null?void 0:t.availability_last_confirmed_at)||null,has_vehicle:!!(t!=null&&t.has_vehicle),has_metro:!!(t!=null&&t.has_metro),wants_academy:!!(t!=null&&t.wants_academy),dni:(t==null?void 0:t.dni)||"",iban:(t==null?void 0:t.iban)||""}},Gr=(t,l)=>{const d=[],f=!!Ya((t==null?void 0:t.weekly_availability)||{},Kt);return String((t==null?void 0:t.phone)||"").trim()||d.push("telefono de contacto"),String((t==null?void 0:t.studies)||"").trim()||d.push("titulacion o estudios"),String((t==null?void 0:t.specialty)||"").trim()||d.push("niveles que puede impartir"),String((t==null?void 0:t.subjects)||"").trim()||d.push("asignaturas"),String((t==null?void 0:t.work_modality)||"").trim()||d.push("modalidad de trabajo"),!String((t==null?void 0:t.availability_notes)||"").trim()&&!f&&d.push("disponibilidad"),l&&(Ha({addressLine:t==null?void 0:t.address_line,postalCode:t==null?void 0:t.postal_code,locality:t==null?void 0:t.location,province:t==null?void 0:t.province})||d.push("direccion completa"),String((t==null?void 0:t.dni)||"").trim()||d.push("DNI o NIE"),String((t==null?void 0:t.iban)||"").trim()||d.push("IBAN")),d},pn=({previewEmail:t,onBack:l})=>{var Et,Dt,Ft;const[d,f]=x.useState("dashboard"),[m,M]=x.useState([]),[D,oe]=x.useState([]),[ee,pe]=x.useState(!0),[R,Le]=x.useState(""),[i,ie]=x.useState(null),[o,_]=x.useState(Va(null)),[V,I]=x.useState(!1),[E,we]=x.useState(!1),[Q,Te]=x.useState(!1),[be,Ne]=x.useState(!1),[pa,qe]=x.useState(!1),[le,ba]=x.useState("Horario"),[Ve,ga]=x.useState(""),[Wa,ha]=x.useState(""),[H,ke]=x.use
55State({class_date:"",start_time:"",end_time:""}),[Qa,He]=x.useState(!1),[as,Ka]=x.useState(!1),[Za,fa]=x.useState(!1),[ts,ya]=x.useState(!1),[Xa,et]=x.useState(!1),[ss,at]=x.useState(!1),[rs,ns]=x.useState(Rt()),[os,tt]=x.useState([]),[Re,st]=x.useState(null),[p,Y]=x.useState({student_name:"",modality:Fe,level:"",subject:"",class_date:"",start_time:"17:00",end_time:"18:30",meet_link:"",notes:"",labor_control_id:""}),[g,G]=x.useState({parent_first_name:"",parent_last_name:"",student_first_name:"",student_last_name:"",phone:"+34 ",email:"",locality:"",province:"Granada",level:"",modality:"Academia Profe a 3",subjects:"",school_name:"",availability:"",notes:""}),[ae,rt]=x.useState(()=>{const a=new Date;return new Date(a.getFullYear(),a.getMonth(),1)}),[K,Ye]=x.useState(null),[is,Pe]=x.useState(null),nt=x.useRef({}),[ls,ot]=x.useState(!1),[it,ds]=x.useState(!1),[v,lt]=x.useState(null),[te,_e]=x.useState(""),[F,Ce]=x.useState({}),[Je,ja]=x.useState({}),[We,va]=x.useState({}),[Qe,wa]=x.useState({}),[Na,ka]=x.useState(""),[J,ne]=x.useState({}),[cs,dt]=x.useState(""),[Ke,Ze]=x.useState(!1),[se,ge]=x.useState(da),[W,he]=x.useState(ca),[xs,_a]=x.useState(!1),[ct,Ca]=x.useState(""),[us,xt]=x.useState(!1),[re,Xe]=x.useState(null),[ea,Sa]=x.useState(""),[ut,mt]=x.useState(!1),Se=a=>(a||"").trim().toLowerCase(),aa=async()=>{pe(!0);let a=t;if(!a){const{data:{user:s}}=await S.auth.getUser();a=(s==null?void 0:s.email)||""}if(a){Le(a),ot(!1);const{data:s}=await S.from("teachers").select("*").ilike("email",a).limit(1).maybeSingle();if(s&&(ie(s),_(Va(s))),s){const{data:b}=await S.from("coordinator_permissions").select("*").eq("coordinator_id",s.id).maybeSingle();ot($r(b))}const{data:r}=await S.from("classes").select("*").eq("monitor_email",a).is("deleted_at",null).order("class_date",{ascending:!1});r&&M(r);const{data:c}=await S.from("students").select("*").is("archived_at",null).order("name");c&&oe(c);const{data:n}=await S.from("global_settings").select("setting_value").eq("id","pricing_rules").maybeSingle();ns(Rt(n==null?void 0:n.setting_value));try{const b=await dr({teacherEmail:a,statuses:["verified"]});tt(b.controls),st(b.schemaReady)}catch(b){console.error("No se pudo cargar el control de altas y horas:",b),tt([]),st(!1)}}pe(!1)};x.useEffect(()=>{d==="dashboard"&&aa()},[d]),x.useEffect(()=>{Ne(!1)},[K,ae]);const ms=async a=>{if(Ca(a),!a){Xe(null);return}xt(!0);const s=new Date,r=new Date(s.getFullYear(),s.getMonth(),1).toISOString().split("T")[0],c=new Date(s.getFullYear(),s.getMonth()+1,0).toISOString().split("T")[0],{data:n}=await S.from("classes").select("attendance_data, monitor_notes, student_notes, class_date").eq("monitor_email",R).gte("class_date",r).lte("class_date",c).is("deleted_at",null).ilike("student_name",`%${a}%`);let b=0,h=0,y=0,C=0,j=0,$="";n&&n.forEach(T=>{if(T.attendance_data&&(T.attendance_data[a]==="presente"||T.attendance_data[a]==="canjear_bono")){if(j++,T.monitor_notes){const q=new RegExp(`${a}.*?Actitud:\\s*([ââ]+)`,"s"),na=T.monitor_notes.match(q);na&&(b+=na[1].split("â").length-1,h++);const oa=new RegExp(`${a}.*?Comprensión:\\s*([ââ]+)`,"s"),Ge=T.monitor_notes.match(oa);Ge&&(y+=Ge[1].split("â").length-1,C++)}let u="";T.student_notes&&T.student_notes[a]?u=T.student_notes[a].trim():T.monitor_notes&&(u=T.monitor_notes.replace(/\[ð GPS: .*?\]\s*/g,"").replace(/ð§âð.*?(?=\n\n|$)/gs,"").replace(/ð NOTAS DEL PROFESOR:\s*/g,"").trim()),u&&u!=="Sin observaciones."&&u!=="Sin comentarios adicionales."&&($+=` 56⢠${T.class_date.split("-")[2]}/${T.class_date.split("-")[1]}: ${u}`)}});const z=h>0?(b/h).toFixed(1):"0.0",N=C>0?(y/C).toFixed(1):"0.0";Xe({classesCount:j,avgAttitude:z,avgUnderstanding:N,notes:$.trim()||"No hay comentarios diarios relevantes registrados este mes."}),xt(!1)},ps=async a=>{a.preventDefault(),mt(!0);const s=new Date().toLocaleString("es-ES",{month:"long",year:"numeric"}).toUpperCase(),{error:r}=await S.from("monthly_reports").insert([{student_name:ct,monitor_email:R,month_year:s,average_attitude:parseFloat(re.avgAttitude),average_understanding:parseFloat(re.avgUnderstanding),daily_notes_summary:re.notes,monitor_conclusion:ea,status:"Pendiente"}]);mt(!1),r?alert("Error al enviar el reporte: "+r.message):(alert("â ¡Reporte enviado a Coordinación para su revisión!"),_a(!1),Sa(""),Ca(""),Xe(null))},bs=Array.from(new Set(m.flatMap(a=>X(a.student_name,a.recovery_students)))),Oe=!!(i!=null&&i.can_capture_walkin_leads),ta=!!(i!=null&&i.can_create_extra_classes),Ie=`${typeof window<"u"&&(window.location.origin.includes("localhost")||window.location.origin.includes("127.0.0.1"))?"https://app.profe-en-casa.com":typeof window<"u"?window.location.origin:"https://app.profe-en-casa.com"}/registrar-visita`,gs=`https://api.qrserver.com/v1/create-qr-code/?size=180x180&data=${encodeURIComponent(Ie)}`,pt=new Set(m.flatMap(a=>X(a.student_name,a.recovery_students).map(s=>
56s.trim().toLowerCase()).filter(Boolean))),de=D.filter(a=>{const s=O(a.name);return!!s&&(pt.has(s)||Se(a.monitor_email)===Se(R)||Se(a.tutor_email)===Se(R))}).sort((a,s)=>(a.name||"").localeCompare(s.name||"","es")),Z=D.filter(a=>Se(a.tutor_email||a.monitor_email)===Se(R)&&!pt.has((a.name||"").trim().toLowerCase())),bt=a=>{var h;const s=O(a),r=de.find(y=>O(y.name)===s),n=m.filter(y=>y.status!=="Cancelada"&&X(y.student_name,y.recovery_students).some(C=>O(C)===s)).sort((y,C)=>{const j=new Date(`${y.class_date||"2100-01-01"}T${y.start_time||"00:00"}`);return new Date(`${C.class_date||"2100-01-01"}T${C.start_time||"00:00"}`).getTime()-j.getTime()})[0],b=((r==null?void 0:r.subjects)||"").split(",").map(y=>y.trim()).filter(Boolean)[0]||"";return{modality:(n==null?void 0:n.modality)||(r==null?void 0:r.modality)||"Academia Profe a 3",level:(n==null?void 0:n.level)||(r==null?void 0:r.level)||"",subject:(n==null?void 0:n.subject)||b,startTime:(n==null?void 0:n.start_time)||"17:00",endTime:(n==null?void 0:n.end_time)||Rr((n==null?void 0:n.start_time)||"17:00",90),meetLink:(h=n==null?void 0:n.modality)!=null&&h.includes("Online")&&(n==null?void 0:n.meet_link)||""}},hs=(a,s,r,c)=>{const n=j=>{const[$,z]=j.split(":").map(Number);return $*60+z},b=n(a),h=n(s),y=n(r),C=n(c);return b<C&&h>y},fs=async a=>{const s=Ct(a);if(!s.enabled){alert(`Esta clase todavia no se puede fichar. ${s.label}.`);return}if(_e("Obteniendo ubicación de entrada..."),!navigator.geolocation){alert("Tu dispositivo no soporta GPS. Se marcará entrada sin ubicación segura."),await Aa(a,"[â ï¸ Entrada sin GPS]");return}navigator.geolocation.getCurrentPosition(async r=>{const c=r.coords.latitude.toFixed(5),n=r.coords.longitude.toFixed(5);await Aa(a,`[ð GPS Entrada: ${c}, ${n}]`)},async r=>{alert("No se pudo obtener la ubicación exacta. Asegúrate de dar permisos."),await Aa(a,"[â ï¸ Entrada sin GPS]")},{enableHighAccuracy:!0,timeout:1e4})},Aa=async(a,s)=>{const{error:r}=await S.from("classes").update({status:"En Curso",monitor_notes:s}).eq("id",a.id).is("deleted_at",null);_e(""),r?alert("Error al registrar entrada: "+r.message):aa()},$a=a=>{const s=or(a.recovery_students),r=X(a.student_name,a.recovery_students),c=a!=null&&a.attendance_data&&typeof a.attendance_data=="object"?a.attendance_data:{},n=a!=null&&a.student_notes&&typeof a.student_notes=="object"?a.student_notes:{},b=($,z)=>Object.keys($).find(N=>O(N)===O(z)),h={},y={},C={},j={};r.forEach($=>{const z=b(c,$),N=b(n,$);h[$]=z?String(c[z]||"presente"):s.includes($)?"canjear_bono":"presente",y[$]=0,C[$]=0,j[$]=N?String(n[N]||""):""}),Ce(h),ja(y),va(C),wa(j),ne({}),ka(""),dt(""),ge(da),he(ca),lt(a)},ys=a=>{const s=D.find(c=>c.name===a),r=(v==null?void 0:v.subject)||String((s==null?void 0:s.subjects)||"").split(",").map(c=>c.trim()).filter(Boolean)[0]||"";dt(c=>c===a?"":a),ge({...da,subject:r}),he({...ca,subject:r})},gt=a=>{oe(s=>s.map(r=>r.student_id===a.student_id?a:r))},js=async a=>{const s=D.find(b=>b.name===a);if(!(s!=null&&s.student_id))return;if(!se.subject.trim()||!se.exam_date){alert("Rellena asignatura y fecha antes de guardar el examen.");return}const c=[...Ot(It(s.upcoming_exams)),hr(se,"teacher")];Ze(!0);const{error:n}=await S.from("students").update({upcoming_exams:c}).eq("student_id",s.student_id);if(Ze(!1),n){alert("No se pudo guardar el examen: "+n.message);return}gt({...s,upcoming_exams:c}),ge({...da,subject:se.subject.trim()}),await S.from("parent_logs").insert([{student_name:a,contact_date:new Date().toISOString().slice(0,10),topic:"ðï¸ EXAMEN ACTUALIZADO",notes:`El profesor registró un examen de ${se.subject.trim()} para ${za(se.exam_date)}.`}])},vs=async a=>{const s=D.find(b=>b.name===a);if(!(s!=null&&s.student_id))return;if(!W.term.trim()||!W.subject.trim()||!W.grade.trim()){alert("Rellena trimestre, asignatura y nota antes de guardar.");return}const c=[...zt(Bt(s.term_grades)),fr(W,"teacher")];Ze(!0);const{error:n}=await S.from("students").update({term_grades:c}).eq("student_id",s.student_id);if(Ze(!1),n){alert("No se pudo guardar la nota: "+n.message);return}gt({...s,term_grades:c}),he({...ca,subject:W.subject.trim()}),await S.from("parent_logs").insert([{student_name:a,contact_date:new Date().toISOString().slice(0,10),topic:"ð NOTA ACTUALIZADA",notes:`El profesor registró una nota de ${W.grade.trim()} en ${W.subject.trim()} (${W.term.trim()}).`}])},Ea=()=>{lt(null),Ce({}),ja({}),va({}),wa({}),ne({}),ka("")},ws=a=>{Ce(s=>({...s,[a]:"falta_justificada"})),ne(s=>({...s,[a]:""})),window.setTimeout(()=>{var s;(s=nt.current[a])==null||s.scrollIntoView({behavior:"smooth",block:"nearest"})},180)},Ns=async(a,s)=>{if(!a||s===0)return;const r=D.find(n=>O(n==null?void 0:n.name)===O(a));if(!r)return;const c=Math.max(0,Number(r.extra_classes_balance||0)+s);if(r.student_id){await S.from("students").update({extra_classes_balance:c}).eq("student_id",r.student_id);return}await S.from("students").update({extra_classes_balance:c}).eq("name",r.name)}
56,ks=async a=>{var r;const s=(r=a.target.files)==null?void 0:r[0];if(!(!s||!i)){Te(!0);try{const c=s.name.split(".").pop(),b=`${`cert_${i.id}_${Date.now()}.${c}`}`,{error:h}=await S.storage.from("teacher_documents").upload(b,s);if(h)throw h;const{error:y}=await S.from("teachers").update({certificate_url:b}).eq("id",i.id);if(y)throw y;ie({...i,certificate_url:b}),alert("¡Genial! Certificado adjuntado correctamente. â ")}catch(c){alert("Vaya, hubo un problema al subir el archivo: "+c.message)}finally{Te(!1)}}},_s=async a=>{if(a.preventDefault(),Object.entries(F).find(([k,B])=>!Ar({modality:v==null?void 0:v.modality,status:B,isRecoveryGuest:Ia(k,v==null?void 0:v.recovery_students)}))){alert("Esta asistencia no corresponde a la modalidad o al alumno. Si la clase individual no se impartio, dejala pendiente y avisa a Coordinacion para organizarla.");return}const r=Object.values(F).some(k=>k==="falta_justificada"),c=Object.keys(F).filter(k=>F[k]==="falta_justificada"),n={shown_in_person:"Mostrado en mano",shown_by_family:"Mostrado por la familia",confirmed_by_coordination:"Confirmado por coordinación"};if(r&&c.some(k=>!J[k])){alert("Hay faltas justificadas. Marca como se ha comprobado cada justificante antes de cerrar la clase.");return}_e("Guardando evaluación...");let b="";Object.entries(F).forEach(([k,B])=>{if(B==="presente"||B==="canjear_bono"){const xe=Je[k]||0,ue=We[k]||0,ye=Qe[k]||"Sin observaciones.",ia="â".repeat(xe)+"â".repeat(5-xe),De="â".repeat(ue)+"â".repeat(5-ue),je=B==="canjear_bono"?" [Recuperacion sin cobro]":"",Ue=Ia(k,v==null?void 0:v.recovery_students)?" [Recuperacion]":"";b+=` 57ð§âð ${k}${Ue}${je}: 58 Actitud: ${ia} 59 Comprensión: ${De} 60 ð Nota: ${ye} 61`}});const h=Object.keys(F).filter(k=>F[k]==="falta_justificada"),y=Object.keys(F).filter(k=>F[k]==="falta_injustificada");let C="";h.length>0&&(C+=` 62𩺠FALTAS JUSTIFICADAS: ${h.join(", ")} 63`),y.length>0&&(C+=` 64â ï¸ FALTAS INJUSTIFICADAS (Se cobran): ${y.join(", ")} 65`);const j=b?` 66ð REPORTE ACADÃMICO:`:"",$=v.monitor_notes||"",z=Na?` 67ð OBSERVACIÃN GLOBAL: 68${Na}`:"",N=c.length>0?` 69COMPROBACION DE JUSTIFICANTES: 70${c.map(k=>`- ${k}: ${n[J[k]]||"Comprobado"}`).join(` 71`)}`:"",T=`${$} 72${C}${N}${j}${b}${z}`,Ee=v!=null&&v.attendance_data&&typeof v.attendance_data=="object"?v.attendance_data:{},u=nr(v.student_name),q=v.family_price/(u.length||1),na=u.length>0&&u.every(k=>F[k]==="falta_justificada");let oa=0;u.forEach(k=>{const B=F[k];!na&&(B==="presente"||B==="falta_injustificada"||B==="falta_justificada")&&(oa+=q)});const Ge=Object.values(F).every(k=>k==="falta_justificada");let Vs=Ge?"Cancelada":"Completada",Hs=Ge?0:v.monitor_price;const Ys={status:Vs,monitor_notes:T,student_notes:Qe,family_price:oa,monitor_price:Hs,attendance_data:F},{error:Mt}=await S.from("classes").update(Ys).eq("id",v.id).is("deleted_at",null);if(Mt)_e(""),alert("Error al guardar: "+Mt.message);else{_e("⨠¡Clase evaluada y cerrada!");const k=new Date().toISOString().split("T")[0],B=v.class_date?v.class_date.split("-").reverse().join("/"):k.split("-").reverse().join("/"),xe=`${(v.start_time||"--:--").slice(0,5)} - ${(v.end_time||"--:--").slice(0,5)}`,ue=v.subject||"Refuerzo Escolar",ye=v.level||"General",ia=(i==null?void 0:i.name)||R||"Equipo docente",De=[],je=[];for(const[A,w]of Object.entries(F))if(w==="canjear_bono"&&Ee[A]!=="canjear_bono"){const{data:P}=await S.from("students").select("student_id, name, extra_classes_balance").eq("name",A).maybeSingle();P&&P.extra_classes_balance>0&&await S.from("students").update({extra_classes_balance:P.extra_classes_balance-1}).eq("student_id",P.student_id),je.push({student_name:(P==null?void 0:P.name)||A,topic:"RECUPERACION CERRADA",notes:`Recuperacion sin cobro realizada en ${B} (${xe}) · ${ue} · ${ye}. Saldo descontado automaticamente al fichar la clase.`,contact_date:k,...i!=null&&i.id?{coordinator_id:i.id}:{}})}for(const A of h)Ee[A]!=="falta_justificada"&&await Ns(A,1);h.forEach(A=>{const w=D.find(P=>O(P==null?void 0:P.name)===O(A));je.push({student_name:(w==null?void 0:w.name)||A,topic:"𩺠FALTA JUSTIFICADA",notes:`Ausencia justificada en ${B} (${xe}) · ${ue} · ${ye}. Comprobacion: ${n[J[A]]||"Comprobado"}
72.`,contact_date:k,...i!=null&&i.id?{coordinator_id:i.id}:{}})});const la=Object.keys(F).filter(A=>F[A]==="falta_injustificada"),Ue=new Map,Pa=[];if(la.forEach(A=>{const w=D.find(Oa=>O(Oa==null?void 0:Oa.name)===O(A)),P=String((w==null?void 0:w.email)||(w==null?void 0:w.parent_email)||"").trim(),Js=String((w==null?void 0:w.parent_name)||(w==null?void 0:w.tutor_name)||"familia").trim();if(je.push({student_name:(w==null?void 0:w.name)||A,topic:"â ï¸ FALTA INJUSTIFICADA",notes:`Ausencia sin aviso previo en ${B} (${xe}) · ${ue} · ${ye}. La sesion se contabiliza y requiere seguimiento con la familia. Si luego la justifican correctamente, coordinacion podra valorar recuperacion en otro hueco del mes.${P?` Aviso por email a ${P}.`:" Pendiente de contacto: la familia no tiene email guardado."}`,contact_date:k,...i!=null&&i.id?{coordinator_id:i.id}:{}}),!P){Pa.push((w==null?void 0:w.name)||A);return}const Tt=P.toLowerCase(),qt=Ue.get(Tt);if(qt){qt.studentNames.push((w==null?void 0:w.name)||A);return}Ue.set(Tt,{email:P,parentName:Js,studentNames:[(w==null?void 0:w.name)||A]})}),je.length>0){const{error:A}=await S.from("parent_logs").insert(je);A&&De.push("No se pudo guardar la alerta interna en bitácora.")}let Lt=0;for(const A of Ue.values())try{const w=Sr({parentName:A.parentName,studentNames:A.studentNames,classDateLabel:B,timeLabel:xe,subjectLabel:ue,levelLabel:ye,monitorName:ia});await tr({to:A.email,subject:w.subject,html:w.html}),Lt+=1}catch{De.push(`No se pudo enviar el aviso a ${A.email}.`)}if(la.length>0){const A="34958891092",w=`ð¨ *AVISO DE FALTA INJUSTIFICADA* ð¨ 73 74*Alumnos implicados:* ${la.join(", ")} 75*Monitor:* ${ia} 76*Clase:* ${B} · ${xe} 77*Asignatura:* ${ue} (${ye}) 78*Emails enviados a familias:* ${Lt} 79${Pa.length>0?`*Sin email guardado:* ${Pa.join(", ")} 80`:""} 81La incidencia queda registrada ya en bitácora. Si la familia justifica despues, se puede valorar recuperacion en otro hueco del mes.`;window.open(`https://wa.me/${A}?text=${encodeURIComponent(w)}`,"_blank")}De.length>0&&setTimeout(()=>{alert(`Clase cerrada con incidencias de comunicación: 82 83- ${De.join(` 84- `)}`)},300),setTimeout(()=>{Ea(),aa(),_e("")},1500)}},ht=async()=>{await S.auth.signOut(),window.location.href="/"},Cs=(a,s,r)=>{_(c=>({...c,[a]:{...c[a]||{},[s]:r}}))},Ss=async a=>{if(a.preventDefault(),!(i!=null&&i.id)||t)return;if(String(o.phone||"").trim()){const y=xr(o.phone,"34","telefono del profesor");if(!y.ok){alert(y.error);return}}I(!0);const s=o.weekly_availability||{},r=o.summer_availability||{},c=Zs({addressLine:o.address_line,addressDetails:o.address_details,postalCode:o.postal_code,locality:o.location,province:o.province}),n={phone:ur(o.phone),location:o.location,province:o.province||null,address_line:o.address_line||null,address_details:o.address_details||null,postal_code:o.postal_code||null,postal_address:c||null,studies:o.studies,specialty:o.specialty,subjects:o.subjects,work_modality:o.work_modality||null,availability_notes:o.availability_notes||null,winter_schedule:Ya(s,Kt)||o.winter_schedule||"",summer_schedule:Ya(r,jr)||o.summer_schedule||"",weekly_availability:s,summer_availability:r,availability_state:o.availability_state||"Disponible ahora",availability_update_notes:o.availability_update_notes||null,availability_last_confirmed_at:new Date().toISOString(),has_vehicle:o.has_vehicle,has_metro:o.has_metro,wants_academy:o.wants_academy,dni:o.dni,iban:o.iban},{error:b}=await S.from("teachers").update(n).eq("id",i.id);if(I(!1),b){alert("Error al guardar tu perfil: "+b.message);return}const h={...i,...n};ie(h),_(Va(h)),alert("â Tu perfil se ha actualizado correctamente.")},Da=a=>{if(!a||!a.signature_data)return null;
84try{const s=typeof a.signature_data=="string"?JSON.parse(a.signature_data):a.signature_data;return s.image?s:{image:a.signature_data,date:"No registrada (Firma antigua)",ip:"No registrada"}}catch{return{image:a.signature_data,date:"No registrada (Firma antigua)",ip:"No registrada"}}},ft=m.filter(a=>["Pendiente","En Curso"].includes(a.status)).sort((a,s)=>{const r=new Date(`${a.class_date}T${a.start_time||"00:00"}`),c=new Date(`${s.class_date}T${s.start_time||"00:00"}`);return r.getTime()-c.getTime()}),ze=m.sort((a,s)=>{const r=new Date(`${a.class_date}T${a.start_time||"00:00"}`),c=new Date(`${s.class_date}T${s.start_time||"00:00"}`);return r.getTime()-c.getTime()}),yt=m.filter(a=>!["Pendiente","En Curso"].includes(a.status)).sort((a,s)=>{const r=new Date(`${a.class_date}T${a.start_time||"00:00"}`);return new Date(`${s.class_date}T${s.start_time||"00:00"}`).getTime()-r.getTime()}),As=new Set(ze.map(a=>a.class_date).filter(Boolean)).size,Ae=K?ze.filter(a=>a.class_date===K):ft,jt=be?Ae:Ae.slice(0,6),$s=Math.max(Ae.length-jt.length,0),Fa=ze.filter(a=>Ir(a.class_date,ae)),U=er(m,ae),Es=Or(ae),Ds=new Date(ae.getFullYear(),ae.getMonth()+1,0),vt=new Date().toISOString().split("T")[0],Ma=Fa.filter(a=>{const s=a!=null&&a.class_date?new Date(`${a.class_date}T12:00:00`):null;return!s||Number.isNaN(s.getTime())?!1:(s.getDay()+6)%7>=5}),Be=[];for(let a=1;a<=Ds.getDate();a++){const r=(new Date(ae.getFullYear(),ae.getMonth(),a).getDay()+6)%7;if(r>=5)continue;if(Be.length===0&&r>0)for(let N=0;N<r;N++)Be.push(null);const c=`${ae.getFullYear()}-${String(ae.getMonth()+1).padStart(2,"0")}-${String(a).padStart(2,"0")}`,n=Pr(Fa.filter(N=>N.class_date===c)),b=n.filter(N=>Me(N)==="exceptional").length,h=n.filter(N=>Me(N)==="open").length,y=n.filter(N=>Me(N)==="closed").length,C=n.filter(N=>Me(N)==="individual").length,j=n.filter(N=>Me(N)==="cancelled").length,$=n.filter(N=>["Pendiente","En Curso"].includes(N.status)&&N.class_date<vt).length,z=n.filter(N=>["Completada","Pagado","Falta Injustificada"].includes(N.status)).length;Be.push({date:c,dayNumber:a,classes:n,exceptionalCount:b,openCount:h,closedCount:y,individualCount:C,cancelledCount:j,overdueCount:$,completedCount:z})}const La=is||K,ce=La?Be.find(a=>a&&a.date===La):null,Fs=K?K.split("-").reverse().join("/"):"",wt=a=>{rt(s=>new Date(s.getFullYear(),s.getMonth()+a,1)),Ye(null),Pe(null)},Ms=a=>{Ye(s=>s===a?null:a),Pe(a)},Nt=a=>{ba(a?me:"Horario"),ha((a==null?void 0:a.id)||""),ke({class_date:(a==null?void 0:a.class_date)||K||"",start_time:String((a==null?void 0:a.start_time)||"").slice(0,5),end_time:String((a==null?void 0:a.end_time)||"").slice(0,5)}),ga(""),qe(!0)},kt=()=>{qe(!1),ba("Horario"),ga(""),ha(""),ke({class_date:"",start_time:"",end_time:""})},Ls=async a=>{if(a.preventDefault(),!Ve.trim()){alert("Escribe el ajuste que has visto para avisar a coordinacion.");return}He(!0);const s=m.find(h=>h.id===Wa),r=le===me;if(r&&!s){He(!1),alert("Elige la clase concreta que necesita el cambio.");return}if(r&&(!H.class_date||!H.start_time||!H.end_time)){He(!1),alert("Indica la nueva fecha y horario que te ha pedido la familia.");return}const c=U.weeklyBlocks.map(h=>({weekday:h.weekdayLabel,time:h.timeLabel,subject:h.subjectLabel,level:h.levelLabel,modality:h.modalityLabel,students:h.studentNames,variant:h.variant})),n=r&&s?[`Clase afectada: ${Jt(s)}`,`Nuevo horario pedido: ${H.class_date.split("-").reverse().join("/")} ${H.start_time} - ${H.end_time}`,`Comentario del monitor: ${Ve.trim()}`].join(` 85`):Ve.trim(),{error:b}=await S.from("teacher_schedule_feedback").insert([{teacher_email:R,teacher_name:(i==null?void 0:i.name)||"",month_key:U.monthKey,month_label:U.monthLabel,feedback_type:le,message:n,request_kind:r?"class_change_request":"forecast_adjustment",class_id:(s==null?void 0:s.id)||null,class_snapshot:s?{id:s.id,class_date:s.class_date,start_time:s.start_time,end_time:s.end_time,subject:s.subject,level:s.level,modality:s.modality,student_name:s.student_name,recovery_students:s.recovery_students}:null,requested_class_date:r?H.class_date:null,requested_start_time:r?H.start_time:null,requested_end_time:r?H.end_time:null,sessions_snapshot:c}]);
85if(He(!1),b){alert(`No se ha podido enviar el aviso: ${b.message}`);return}kt(),alert(r?"Aviso enviado al administrador para revisar el cambio de agenda.":"Aviso enviado a coordinacion para revisar tu prevision del mes.")},_t=()=>{Ka(!1),fa(!1),Y({student_name:"",modality:Fe,level:"",subject:"",class_date:"",start_time:"17:00",end_time:"18:30",meet_link:"",notes:"",labor_control_id:""})},Ts=()=>{if(!ta){alert("Coordinacion tiene que activar este permiso en tu perfil antes de crear clases extra.");return}if(de.length===0){alert("Todavia no tienes alumnos asignados con los que abrir una clase extra.");return}const a=de[0],s=bt(a.name),r=new Date().toISOString().split("T")[0],c=String(s.modality).includes("Academia")?Fe:s.modality;Y({student_name:a.name,modality:c,level:s.level,subject:s.subject,class_date:r,start_time:s.startTime,end_time:s.endTime,meet_link:s.meetLink,notes:"",labor_control_id:""}),Ka(!0)},qs=a=>{const s=bt(a),r=String(s.modality).includes("Academia")?Fe:s.modality;Y(c=>({...c,student_name:a,modality:r,level:s.level,subject:s.subject,start_time:s.startTime,end_time:s.endTime,meet_link:s.meetLink,labor_control_id:""}))},Ta=()=>{const a=de.find(s=>O(s.name)===O(p.student_name));return cr({controls:os,modality:p.modality,teacherEmail:R,classDate:p.class_date,studentIds:a?[String(a.student_id||"")].filter(Boolean):[]})},Rs=async a=>{if(a.preventDefault(),!ta){alert("Coordinacion tiene que activar este permiso en tu perfil antes de crear clases extra.");return}const s=de.find(y=>O(y.name)===O(p.student_name));if(!s){alert("Selecciona un alumno que ya tengas asignado en tu area.");return}if(!p.class_date||!p.start_time||!p.end_time||!p.subject.trim()||!p.level.trim()){alert("Rellena fecha, hora, nivel y asignatura antes de guardar la clase extra.");return}if(Pt(p.modality)&&Re===!0&&p.labor_control_id&&!Ta().some(C=>C.id===p.labor_control_id)){alert("El seguimiento laboral elegido ya no coincide con esta clase. Déjalo sin vincular o pide a Coordinacion que lo revise.");return}const r=m.find(y=>y.status!=="Cancelada"&&y.class_date===p.class_date&&hs(p.start_time,p.end_time,y.start_time||"00:00",y.end_time||"00:00"));if(r){alert(`Ya tienes una clase ese dia de ${(r.start_time||"--:--").substring(0,5)} a ${(r.end_time||"--:--").substring(0,5)} con ${r.student_name}.`);return}const c=ir({modality:p.modality,level:p.level,groupSize:1,startTime:p.start_time,endTime:p.end_time,pricingRules:rs}),n=["Clase extra creada por monitor desde su area",i!=null&&i.name?`Monitor: ${i.name}`:"",p.notes.trim()?`Nota: ${p.notes.trim()}`:""].filter(Boolean).join(" · ");fa(!0);const{error:b}=await S.from("classes").insert([{student_name:s.name,monitor_email:R,modality:p.modality,level:p.level,subject:p.subject.trim(),class_date:p.class_date,start_time:p.start_time,end_time:p.end_time,family_price:c.familyTotal,monitor_price:c.monitorTotal,status:"Pendiente",meet_link:p.modality.includes("Online")?p.meet_link.trim():"",opening_reason:n,...Re&&p.labor_control_id?{labor_control_id:p.labor_control_id}:{}}]);if(fa(!1),b){alert(`No se pudo guardar la clase extra: ${b.message}`);return}const h=new Date(`${p.class_date}T12:00:00`);rt(new Date(h.getFullYear(),h.getMonth(),1)),Ye(p.class_date),_t(),await aa(),alert(`Clase extra creada para ${s.name}. Ya queda visible en tu agenda y en la del admin.`)},Ps=()=>{Oe&&(G({parent_first_name:"",parent_last_name:"",student_first_name:"",student_last_name:"",phone:"+34 ",email:"",locality:(i==null?void 0:i.location)||"",province:(i==null?void 0:i.province)||"Granada",level:"",modality:"Academia Profe a 3",subjects:"",school_name:"",availability:"",notes:""}),ya(!0))},Os=()=>{Oe&&window.open(Ie,"_blank","noopener,noreferrer")},Is=async()=>{if(Oe)try{await navigator.clipboard.writeText(Ie),at(!0),window.setTimeout(()=>at(!1),1800)}catch{window.prompt("Copia este enlace interno:",Ie)}},zs=async a=>{if(a.preventDefault(),!Oe){alert("Esta opcion solo esta disponible si coordinacion te ha dado permiso puntual para registrar esa visita.");return}const s=`${g.parent_first_name} ${g.parent_last_name}
85`.trim(),r=`${g.student_first_name} ${g.student_last_name}`.trim();if(!s||!r||!g.phone.trim()||!g.locality.trim()||!g.level.trim()||!g.subjects.trim()){alert("Completa al menos nombre y apellidos del tutor y del alumno, telefono, localidad, curso exacto y asignatura principal.");return}const c=mr(g.phone,"telefono de WhatsApp");if(!c.ok){alert(c.error);return}et(!0);const b=[`Captado en la academia por ${(i==null?void 0:i.name)||R||"equipo docente"}.`,`[Tutor nombre] ${g.parent_first_name.trim()}`,`[Tutor apellidos] ${g.parent_last_name.trim()}`,`[Alumno nombre] ${g.student_first_name.trim()}`,`[Alumno apellidos] ${g.student_last_name.trim()}`,g.school_name.trim()?`[Centro educativo] ${g.school_name.trim()}`:null,g.availability.trim()?`Horario comentado: ${g.availability.trim()}`:null,g.notes.trim()?`Observaciones: ${g.notes.trim()}`:null].filter(Boolean),{error:h}=await S.from("leads").insert([{parent_name:s,student_name:r,email:g.email.trim(),locality:g.locality.trim(),province:g.province.trim()||"Granada",phone:pr(g.phone),origin:"Visita personal en la academia",level:g.level,modality:g.modality,subjects:g.subjects.trim(),subject_needed:g.subjects.trim(),school_name:g.school_name.trim(),notes:b.join(` 86`),status:"Nuevo"}]);if(et(!1),h){alert(`No se ha podido guardar la familia interesada: ${h.message}`);return}ya(!1),alert("â Familia interesada guardada. Ya ha entrado en seguimiento para que coordinación la continúe.")},Ct=a=>{if(!(a!=null&&a.class_date)||!(a!=null&&a.start_time)||!(a!=null&&a.end_time))return{enabled:!1,label:"Sin horario",action:"disabled"};const s=new Date,r=new Date(`${a.class_date}T${a.start_time}`),c=new Date(`${a.class_date}T${a.end_time}`),n=new Date(r.getTime()-1800*1e3),b=[s.getFullYear(),String(s.getMonth()+1).padStart(2,"0"),String(s.getDate()).padStart(2,"0")].join("-");return s>=n&&s<=c?{enabled:!0,label:"Fichar entrada",action:"clockin"}:a.class_date>b?{enabled:!1,label:"Se activa el dia de la clase",action:"disabled"}:a.class_date===b&&s<n?{enabled:!1,label:"Se activa 30 min antes",action:"disabled"}:{enabled:!0,label:"Revisar pendiente",action:"late-report"}},St=a=>{var h,y,C;const s=a.status==="Pendiente"?Ct(a):null,r=a.status==="Pendiente"&&(s==null?void 0:s.action)==="late-report",c=X(a.student_name,a.recovery_students),n=rr(a.recovery_students),b=Yt(a.monitor_notes);return e.jsxs("div",{className:`bg-white p-5 rounded-[24px] border transition-all flex flex-col relative overflow-hidden 87 ${a.status==="En Curso"?"border-blue-300 shadow-md shadow-blue-500/10":["Completada","Pagado"].includes(a.status)?"border-green-200 bg-green-50/30":a.status==="Cancelada"?"border-red-200 bg-red-50/30":"border-gray-100 shadow-sm"} 88 `,children:[e.jsx("div",{className:`absolute top-0 left-0 w-1.5 h-full 89 ${a.status==="En Curso"?"bg-blue-500 animate-pulse":["Completada","Pagado"].includes(a.status)?"bg-green-500":a.status==="Cancelada"?"bg-red-500":"bg-[#1c74e9]"} 90 `}),e.jsxs("div",{className:"flex justify-between items-start mb-2",children:[e.jsxs("h3",{className:"text-gray-900 font-black text-sm",children:[a.subject||"Clase de Refuerzo",e.jsxs("span",{className:"text-[10px] text-gray-500 font-normal ml-1",children:["(",a.level||"General",")"]})]}),e.jsx("span",{className:`text-[9px] font-black uppercase px-2 py-1 rounded border shrink-0 91 ${a.status==="En Curso"?"bg-blue-50 text-blue-600 border-blue-200 animate-pulse":"bg-gray-50 text-gray-400 border-gray-100"} 92 `,children:a.status==="En Curso"?"â³ EN CURSO":a.class_date?a.class_date.split("-").reverse().join("/"):"Sin fecha"})]}),e.jsxs("div",{className:"mb-3 space-y-2",children:[e.jsxs("p",{className:"text-gray-600 text-xs font-bold flex items-center gap-1",children:["ð¥ ",c.join(", ")||"Sin asignar"]}),n.length>0&&e.jsxs("div",{className:"bg-violet-50 border border-violet-100 rounded-xl px-3 py-2",children:[e.jsx("p",{className:"text-[9px] font-black uppercase tracking-widest text-violet-700",children:"Recuperacion sin cobro metida en este grupo"}),e.jsx("div",{className:"mt-1 space-y-1",children:n.map(j=>e.jsxs("div",{className:"text-[10px] font-bold text-violet-900 leading-relaxed",children:[e.jsx("p",{children:j.student_name}),e.jsxs("p",{className:"text-violet-700 font-semibold",children:[j.source_class_date?`Recupera falta del ${j.source_class_date.split("-").reverse().join("/")}
92. `:"",j.note||"No cobrar a la familia por esta sesion."]})]},`${j.student_name}-${j.source_class_id||j.source_class_date||"manual"}`))})]}),a.status==="Cancelada"&&e.jsxs("div",{className:"bg-red-50 border border-red-100 rounded-xl px-3 py-2",children:[e.jsx("p",{className:"text-[9px] font-black uppercase tracking-widest text-red-700",children:"Motivo de anulacion"}),e.jsx("p",{className:"text-[10px] font-bold text-red-900 mt-1",children:b||"Coordinacion no ha indicado motivo todavia."})]})]}),(((h=a.modality)==null?void 0:h.includes("Online"))||a.meet_link)&&["Pendiente","En Curso"].includes(a.status)&&e.jsxs("div",{className:"mb-4 bg-blue-50/50 p-3 rounded-xl border border-blue-100 flex items-center justify-between",children:[e.jsxs("div",{className:"min-w-0 pr-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xl",children:"ð¥"}),e.jsx("p",{className:"text-blue-900 font-black text-xs",children:"Clase Online"})]}),e.jsxs("p",{className:"text-[9px] text-blue-700 font-bold leading-relaxed mt-1",children:["Entra con ",a.monitor_email||"tu correo Workspace de Profe en Casa",". Si Google pide admision, revisa que no estes usando otro Gmail."]})]}),e.jsx("button",{onClick:()=>{a.meet_link?window.open(a.meet_link,"_blank"):alert("â ï¸ El enlace de Google Meet aún no se ha generado o configurado para esta clase. Habla con Coordinación.")},className:"bg-[#1c74e9] hover:bg-blue-600 text-white text-[10px] font-black uppercase tracking-widest px-3 py-2 rounded-lg shadow-sm shadow-blue-500/20 active:scale-95 transition-colors",children:"Entrar a Meet"})]}),e.jsxs("div",{className:"flex flex-wrap justify-between items-center gap-2 pt-2 border-t border-gray-50 mt-auto",children:[e.jsxs("span",{className:"text-[10px] text-gray-500 font-bold bg-gray-50 px-2 py-1 rounded-lg border border-gray-100",children:["â±ï¸ ",((y=a.start_time)==null?void 0:y.substring(0,5))||"--:--"," - ",((C=a.end_time)==null?void 0:C.substring(0,5))||"--:--"]}),e.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[a.status!=="Cancelada"&&e.jsx("button",{type:"button",onClick:()=>Nt(a),className:"bg-amber-50 text-amber-700 border border-amber-200 text-[9px] font-black uppercase tracking-widest px-3 py-2 rounded-xl active:scale-95 transition-all",children:"Cambio agenda"}),a.status==="Pendiente"?r?e.jsxs("button",{type:"button",onClick:()=>$a(a),className:"bg-amber-500 text-white text-[10px] font-black uppercase tracking-widest px-4 py-2 rounded-xl shadow-lg shadow-amber-500/20 active:scale-95 transition-all flex items-center gap-1",children:[e.jsx("span",{children:"ð"})," Revisar pendiente"]}):e.jsxs("button",{type:"button",onClick:()=>fs(a),disabled:!(s!=null&&s.enabled),title:(s==null?void 0:s.label)||"Fichar entrada",className:`text-[10px] font-black uppercase tracking-widest px-4 py-2 rounded-xl transition-all flex items-center gap-1 ${s!=null&&s.enabled?"bg-gray-900 text-white shadow-lg active:scale-95":"bg-gray-100 text-gray-400 border border-gray-200 cursor-not-allowed"}`,children:[e.jsx("span",{children:"ð"})," ",s!=null&&s.enabled?"Fichar Entrada":(s==null?void 0:s.label)||"Fichar Entrada"]}):a.status==="En Curso"?e.jsxs("button",{onClick:()=>$a(a),className:"bg-[#1c74e9] text-white text-[10px] font-black uppercase tracking-widest px-4 py-2 rounded-xl shadow-lg shadow-blue-500/30 active:scale-95 transition-all flex items-center gap-1",children:[e.jsx("span",{children:"ð"})," Evaluar Alumnos"]}):a.status==="Cancelada"?e.jsx("span",{className:"text-red-500 text-[10px] font-black uppercase tracking-widest bg-red-50 px-2 py-1 rounded-lg",children:"Anulada"}):t&&["Completada","Pagado","Falta Injustificada"].includes(a.status)?e.jsx("button",{type:"button",onClick:()=>$a(a),className:"bg-blue-50 text-[#1c74e9] border border-blue-100 text-[10px] font-black uppercase tracking-widest px-4 py-2 rounded-xl active:scale-95 transition-all",children:"Corregir reporte"}):e.jsx("span",{className:"text-green-600 text-[10px] font-black uppercase tracking-widest bg-green-50 px-2 py-1 rounded-lg border border-green-100",children:"â
Fichada"})]})]})]},a.id)},Bs=it?Z:Z.slice(0,2),L=!!t,qa=!!(i&&(!i.dni||!i.iban)),At=!!(i&&!Ha({addressLine:i.address_line||i.postal_address,postalCode:i.postal_code,locality:i.location,province:i.province})),$e=!o.dni||!o.iban,Ra=!Ha({addressLine:o.address_line,postalCode:o.postal_code,locality:o.location,province:o.province}),sa=m.some(a=>
92["Pendiente","En Curso","Completada","Pagado"].includes(a.status)),fe=Gr(o,sa),Gs=sa&&($e||Ra),Us=!sa&&($e||Ra),$t=()=>e.jsxs("div",{className:"space-y-3 animate-in fade-in slide-in-from-bottom-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-gray-200 pb-2",children:[e.jsx("h3",{className:"text-gray-400 text-[10px] font-black uppercase tracking-widest",children:"TutorÃas pendientes de agenda"}),e.jsx("span",{className:"bg-amber-50 text-amber-700 border border-amber-200 text-[8px] font-black uppercase px-2 py-1 rounded-full",children:Z.length})]}),e.jsx("div",{className:"space-y-2",children:Bs.map(a=>e.jsx("div",{className:"bg-gray-100/80 border border-gray-200 rounded-[20px] p-4 shadow-sm",children:e.jsxs("div",{className:"flex justify-between items-start gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-gray-900 font-black text-sm leading-tight",children:a.name}),e.jsxs("p",{className:"text-gray-500 text-[9px] font-bold uppercase mt-1 leading-relaxed",children:[a.level||"Sin nivel"," ",a.location?`⢠${a.location}`:""," ",a.modality?`⢠${a.modality}`:""]})]}),e.jsx("span",{className:"text-[8px] font-black uppercase bg-amber-100 text-amber-700 border border-amber-200 px-2 py-1 rounded-lg shrink-0",children:"TutorÃa"})]})},a.id||a.student_id||a.email||a.name))}),Z.length>2&&e.jsx("button",{onClick:()=>ds(a=>!a),className:"w-full bg-white border border-gray-200 text-gray-600 hover:text-[#1c74e9] hover:border-blue-200 text-[10px] font-black uppercase tracking-widest py-3 rounded-2xl transition-colors active:scale-95",children:it?"Ver menos tutorÃas":`Ver ${Z.length-2} más`}),e.jsx("p",{className:"text-gray-500 text-[10px] font-bold leading-relaxed",children:"Aquà ves solo las tutorÃas académicas. El grupo o la clase real se crea después en Agenda Centro."})]});if(ee)return e.jsx("div",{className:"min-h-screen bg-[#F5F7FA] flex items-center justify-center",children:e.jsx("div",{className:"w-10 h-10 border-4 border-[#1c74e9] border-t-transparent rounded-full animate-spin"})});if(!i&&!t)return e.jsx("div",{className:"min-h-screen bg-[#F5F7FA] flex flex-col items-center justify-center p-6 text-center",children:e.jsxs("div",{className:"bg-white p-8 rounded-[32px] shadow-xl max-w-sm w-full border border-gray-100",children:[e.jsx("span",{className:"text-5xl block mb-4",children:"ðµï¸ââï¸"}),e.jsx("h2",{className:"text-xl font-black text-gray-900 mb-2",children:"Perfil no encontrado"}),e.jsxs("p",{className:"text-sm text-gray-500 mb-6",children:["Estás usando el correo ",e.jsx("strong",{children:R}),", pero no constas como monitor oficial. Si eres candidato, espera a ser seleccionado por Coordinación."]}),e.jsx("button",{onClick:ht,className:"w-full bg-[#1c74e9] text-white py-4 rounded-2xl font-black uppercase text-xs tracking-widest shadow-lg",children:"Cerrar Sesión"})]})});if(d==="invoices")return e.jsx(_r,{onBack:()=>f("dashboard"),previewEmail:R});if(d==="admin_calendar")return e.jsx(Ks,{onBack:()=>f("coordinator")});if(d==="profile"&&i)return e.jsx("div",{className:"min-h-screen bg-[#F5F7FA] p-6 pb-24 font-sans",children:e.jsxs("div",{className:"max-w-md mx-auto",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("button",{onClick:()=>
92f("dashboard"),className:"text-[#1c74e9] text-sm font-black flex items-center gap-1 hover:opacity-70 transition-opacity",children:"⹠Volver"}),e.jsx("h2",{className:"text-lg font-black text-gray-900",children:"Mi Perfil"}),e.jsx("div",{className:"w-10"})]}),e.jsx("div",{className:"bg-white p-5 rounded-[28px] border border-gray-100 shadow-sm mb-4",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-900 font-black text-lg leading-tight",children:i.name}),e.jsx("p",{className:"text-gray-500 text-[10px] font-bold uppercase tracking-widest mt-1",children:i.email}),e.jsx("p",{className:"text-gray-400 text-[10px] font-bold mt-2 leading-relaxed",children:"Este correo queda fijo porque es el acceso principal a tu cuenta. Si alguna vez necesitas cambiarlo, te ayudaremos desde coordinación."})]}),L&&e.jsx("span",{className:"bg-gray-100 text-gray-500 border border-gray-200 text-[8px] font-black uppercase tracking-widest px-2 py-1 rounded-lg shrink-0",children:"Solo lectura"})]})}),e.jsxs("div",{className:`rounded-[24px] border p-4 mb-4 shadow-sm ${fe.length>0?"border-amber-200 bg-amber-50":"border-emerald-200 bg-emerald-50"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("p",{className:`text-[10px] font-black uppercase tracking-widest ${fe.length>0?"text-amber-800":"text-emerald-800"}`,children:"Estado de tu ficha"}),e.jsx("span",{className:`rounded-full px-2.5 py-1 text-[9px] font-black uppercase tracking-widest ${fe.length>0?"bg-amber-100 text-amber-800":"bg-emerald-100 text-emerald-800"}`,children:fe.length>0?`${fe.length}
92 pendientes`:"Completa"})]}),fe.length>0?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mt-2 text-xs font-bold leading-relaxed text-amber-950",children:"Revisa estos datos y guarda el formulario para que coordinacion pueda organizar las clases sin volver a pedirtelos."}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:fe.map(a=>e.jsx("span",{className:"rounded-full border border-amber-200 bg-white px-2.5 py-1 text-[9px] font-black text-amber-800",children:a},a))})]}):e.jsx("p",{className:"mt-2 text-xs font-bold leading-relaxed text-emerald-900",children:"No faltan datos necesarios en este momento. Podras actualizarlos aqui si cambian."})]}),Gs&&e.jsxs("div",{className:"bg-blue-50 border border-blue-200 rounded-[24px] p-4 mb-4 shadow-sm",children:[e.jsx("p",{className:"text-[#1c74e9] text-[10px] font-black uppercase tracking-widest mb-2",children:"Deja preparada tu ficha"}),e.jsx("p",{className:"text-slate-700 text-sm font-bold leading-relaxed",children:$e&&Ra?"Como ya tienes clases en marcha, puedes dejar lista tu ficha con DNI/NIE, IBAN y dirección para que, cuando llegue tu primer pago, todo esté preparado con tranquilidad.":$e?"Como ya tienes clases en marcha, puedes añadir tu DNI/NIE y tu IBAN para dejar preparado tu primer pago con normalidad.":"Como ya tienes clases en marcha, puedes completar tu dirección para que tu ficha quede bien cerrada desde el principio."})]}),Us&&e.jsxs("div",{className:"bg-slate-50 border border-slate-200 rounded-[24px] p-4 mb-4 shadow-sm",children:[e.jsx("p",{className:"text-slate-600 text-[10px] font-black uppercase tracking-widest mb-2",children:"Completa tu perfil poco a poco"}),e.jsx("p",{className:"text-slate-500 text-sm font-bold leading-relaxed",children:"Cuando ya tengas clases confirmadas y toque preparar tu primer pago, te pediremos estos datos dentro de la app de forma normal. No hace falta que corras ahora."})]}),e.jsx("div",{className:"bg-white p-6 rounded-[32px] border border-gray-100 shadow-sm",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"bg-slate-50 p-5 rounded-2xl border border-slate-200 shadow-inner",children:[e.jsxs("h3",{className:"text-slate-700 font-black text-xs uppercase tracking-widest flex items-center gap-2 mb-3",children:[e.jsx("span",{children:"ð¡ï¸"})," Tu documentación docente"]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex justify-between items-center bg-white p-3 rounded-xl border border-slate-100",children:e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-900 font-bold text-xs",children:"Acuerdo anterior"}),e.jsx("p",{className:`text-[9px] font-black uppercase tracking-widest mt-0.5 ${i.contract_signed?"text-slate-600":"text-gray-400"}`,children:i.contract_signed?"Archivado como histórico":"Sin documento anterior"})]})}),e.jsx("div",{className:"flex justify-between items-center bg-white p-3 rounded-xl border border-slate-100",children:e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-900 font-bold text-xs",children:"Certificado D. Sexuales"}),e.jsx("p",{className:`text-[9px] font-black uppercase tracking-widest mt-0.5 ${i.certificate_url?"text-green-600":"text-orange-500"}`,children:i.certificate_url?"Archivo recibido · pendiente de revisión":"Pendiente de aportar"})]})})]})]}),e.jsxs("form",{onSubmit:Ss,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsxs("h3",{className:"text-gray-900 font-black text-sm uppercase tracking-widest flex items-center gap-2 mb-1",children:[e.jsx("span",{children:"ð¤"})," Tus datos"]}),e.jsx("p",{className:"text-[10px] text-gray-400 font-bold leading-relaxed",children:"Puedes completar aquà tu ficha. Lo que pongas ayudará a coordinación a organizar mejor clases, cobros y asignaciones."})]}),e.jsxs("div",{className:"bg-blue-50/50 p-4 rounded-2xl border border-blue-100",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("label",{className:"text-[10px] font-black text-[#1c74e9] uppercase tracking-widest flex items-center gap-1",children:"ð³ Datos para recibir tu pago"}),e.jsx("span",{className:`text-[8px] font-black px-2 py-1 rounded uppercase tracking-widest ${$e?"bg-red-100 text-red-600":"bg-green-100 text-green-700"}`,children:$e?"Falta completar":"Listo"})]}),e.jsx("p",{className:"text-[10px] text-slate-500 font-bold leading-relaxed mb-3",children:"Estos datos solo se usan para preparar tu pago cuando ya tengas clases confirmadas. Si todavÃa estás empezando, puedes completarlos más adelante con calma."}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("input",{type:"text",placeholder:"DNI / NIE (Ej: 12345678Z)",value:o.dni,onChange:a=>_({...o,dni:a.target.value.toUpperCase()}),disabled:L,className:"w-full bg-white border border-blue-100 p-3 rounded-xl text-xs font-bold outline-none focus:border-[#1c74e9] transition-colors disabled:bg-gray-100 disabled:text-gray-400"}),e.jsx("input",{type:"text",placeholder:"IBAN (Ej: ES1234...)",value:o.iban,onChange:a=>_({...o,iban:a.target.value.toUpperCase().replace(/\s/g,"")}),disabled:L,className:"w-full bg-white border border-blue-100 p-3 rounded-xl text-xs font-bold outline-none focus:border-[#1c74e9] transition-colors disabled:bg-gray-100 disabled:text-gray-400"})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest block mb-1",children:"Teléfono (WhatsApp)"}),e.jsx("input",{type:"tel",value:o.phone,onChange:a=>_({...o,phone:a.target.value}),disabled:L,className:"w-full bg-gray-50 border border-gray-100 p-3 rounded-xl text-xs font-bold outline-none focus:border-[#1c74e9] transition-colors disabled:bg-gray-100 disabled:text-gray-400"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest block mb-1",children:"Dirección"}),e.jsx("input",{type:"text",placeholder:"Ej: Calle Real 15",value:o.address_line,onChange:a=>_({...o,address_line:a.target.value}),disabled:L,className:"w-full bg-gray-50 border border-gray-100 p-3 rounded-xl text-xs font-bold outline-none focus:border-[#1c74e9] transition-colors disabled:bg-gray-100 disabled:text-gray-400"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest block mb-1",children:"Detalles de dirección"}),e.jsx("input",{type:"text",placeholder:"Ej: Portal 2, 3ºB, Urbanización...",value:o.address_details,onChange:a=>_({...o,address_details:a.target.value}),disabled:L,className:"w-full bg-gray-50 border border-gray-100 p-3 rounded-xl text-xs font-bold outline-none focus:border-[#1c74e9] transition-colors disabled:bg-gray-100 disabled:text-gray-400"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest block mb-1",children:"Código postal"}),e.jsx("input",{type:"text",placeholder:"Ej: 18140",value:o.postal_code,onChange:a=>_({...o,postal_code:a.target.value}),disabled:L,className:"w-full bg-gray-50 border border-gray-100 p-3 rounded-xl text-xs font-bold outline-none focus:border-[#1c74e9] transition-colors disabled:bg-gray-100 disabled:text-gray-400"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest block mb-1",children:"Localidad / zona"}),e.jsx("input",{type:"text",placeholder:"Ej: La Zubia",value:o.location,onChange:a=>_({...o,location:a.target.value}),disabled:L,className:"w-full bg-gray-50 border border-gray-100 p-3 rounded-xl text-xs font-bold outline-none focus:border-[#1c74e9] transition-colors disabled:bg-gray-100 disabled:text-gray-400"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest block mb-1",children:"Provincia"}),e.jsx("input",{type:"text",placeholder:"Ej: Granada",value:o.province,onChange:a=>_({...o,province:a.target.value}),disabled:L,className:"w-full bg-gray-50 border border-gray-100 p-3 rounded-xl text-xs font-bold outline-none focus:border-[#1c74e9] transition-colors disabled:bg-gray-100 disabled:text-gray-400"})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest block mb-1",children:"Modalidad de trabajo"}),e.jsxs("select",{value:o.work_modality,onChange:a=>_({...o,work_modality:a.target.value}),disabled:L,className:"w-full bg-gray-50 border border-gray-100 p-3 rounded-xl text-xs font-bold outline-none focus:border-[#1c74e9] transition-colors disabled:bg-gray-100 disabled:text-gray-400",children:[e.jsx("option",{value:"",children:"Sin definir"}),Er.map(a=>e.jsx("option",{value:a,children:a},a))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest block mb-1",children:"Titulación / Estudios"}),e.jsx("input",{type:"text",placeholder:"Ej: Grado en Matemáticas, Magisterio...",value:o.studies,onChange:a=>_({...o,studies:a.target.value}),disabled:L,className:"w-full bg-gray-50 border border-gray-100 p-3 rounded-xl text-xs font-bold outline-none focus:border-[#1c74e9] transition-colors disabled:bg-gray-100 disabled:text-gray-400"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest block mb-1",children:"Niveles / Especialidad"}),e.jsx("textarea",{rows:2,placeholder:"Ej: Primaria, 1º ESO, 2º Bachillerato...",value:o.specialty,onChange:a=>_({...o,specialty:a.target.value}),disabled:L,className:"w-full bg-gray-50 border border-gray-100 p-3 rounded-xl text-xs font-bold outline-none focus:border-[#1c74e9] transition-colors resize-none disabled:bg-gray-100 disabled:text-gray-400"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest block mb-1",children:"Asignaturas"}),e.jsx("textarea",{rows:3,placeholder:"Ej: Matemáticas Bach Ciencias, Matemáticas Bach Sociales, FÃ
92sica...",value:o.subjects,onChange:a=>_({...o,subjects:a.target.value}),disabled:L,className:"w-full bg-gray-50 border border-gray-100 p-3 rounded-xl text-xs font-bold outline-none focus:border-[#1c74e9] transition-colors resize-none disabled:bg-gray-100 disabled:text-gray-400"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest block mb-1",children:"Disponibilidad general"}),e.jsx("textarea",{rows:3,placeholder:"Ej: tardes entre semana, mañanas en verano, disponibilidad para domicilio...",value:o.availability_notes,onChange:a=>_({...o,availability_notes:a.target.value}),disabled:L,className:"w-full bg-gray-50 border border-gray-100 p-3 rounded-xl text-xs font-bold outline-none focus:border-[#1c74e9] transition-colors resize-none disabled:bg-gray-100 disabled:text-gray-400"})]}),e.jsxs("div",{className:"rounded-2xl border border-amber-200 bg-amber-50 p-4",children:[e.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest text-amber-800",children:"Horario acordado con Coordinacion"}),e.jsx("p",{className:"mt-2 text-[11px] font-bold leading-relaxed text-amber-900",children:"Desde tu incorporacion, los dias de trabajo no se cambian desde la web porque pueden afectar a grupos y familias. Si surge una situacion importante, habla directamente con Coordinacion."})]}),e.jsx(ar,{weeklyAvailability:o.weekly_availability,summerAvailability:o.summer_availability,availabilityState:o.availability_state,availabilityNotes:o.availability_update_notes,availabilityLastConfirmedAt:o.availability_last_confirmed_at,disabled:!0,notesLabel:"Comentario sobre tus horarios",notesPlaceholder:"Ej: cambia en junio por oposiciones o por otro trabajo.",onStateChange:a=>_({...o,availability_state:a}),onNotesChange:a=>_({...o,availability_update_notes:a}),onChangeValue:Cs}),e.jsx("div",{className:"hidden",children:e.jsxs("div",{className:"grid grid-cols-2 gap-3 border-t border-gray-100 pt-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-[9px] font-black text-[#1c74e9] uppercase tracking-widest block mb-1",children:"âï¸ Disp. Invierno"}),e.jsx("input",{type:"text",value:o.winter_schedule,onChange:a=>_({...o,winter_schedule:a.target.value}),disabled:!0,className:"w-full bg-blue-50/50 border border-blue-100 p-3 rounded-xl text-xs font-bold outline-none focus:border-[#1c74e9] transition-colors disabled:bg-gray-100 disabled:text-gray-400"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-[9px] font-black text-orange-500 uppercase tracking-widest block mb-1",children:"âï¸ Disp. Verano"}),e.jsx("input",{type:"text",value:o.summer_schedule,onChange:a=>_({...o,summer_schedule:a.target.value}),disabled:!0,className:"w-full bg-orange-50/50 border border-orange-100 p-3 rounded-xl text-xs font-bold outline-none focus:border-orange-500 transition-colors disabled:bg-gray-100 disabled:text-gray-400"})]})]})}),e.jsxs("div",{className:"space-y-2 border-t border-gray-100 pt-4",children:[e.jsx("label",{className:"text-[10px] font-black text-gray-400 uppercase tracking-widest block mb-2",children:"Movilidad"}),e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-xl border border-gray-100 bg-gray-50",children:[e.jsx("p",{className:"text-gray-900 font-bold text-xs flex items-center gap-2",children:"ð VehÃculo Propio"}),e.jsx("button",{type:"button",onClick:()=>!L&&_({...o,has_vehicle:!o.has_vehicle}),disabled:L,className:`w-10 h-6 rounded-full flex items-center p-1 transition-colors shrink-0 ${o.has_vehicle?"bg-green-500":"bg-gray-300"} disabled:opacity-60`,children:e.jsx("div",{className:`w-4 h-4 bg-white rounded-full shadow-md transition-transform ${o.has_vehicle?"translate-x-4":"translate-x-0"}`})})]}),e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-xl border border-gray-100 bg-gray-50",children:[e.jsx("p",{className:"text-gray-900 font-bold text-xs flex items-center gap-2",children:"ð Llega en Metro"}),e.jsx("button",{type:"button",onClick:()=>!L&&_({...o,has_metro:!o.has_metro}),disabled:L,className:`w-10 h-6 rounded-full flex items-center p-1 transition-colors shrink-0 ${o.has_metro?"bg-[#1c74e9]":"bg-gray-300"} disabled:opacity-60`,children:e.jsx("div",{className:`w-4 h-4 bg-white rounded-full shadow-md transition-transform ${o.has_metro?"translate-x-4":"translate-x-0"}`})})]}),e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-xl border border-gray-100 bg-gray-50",children:[e.jsx("p",{className:"text-gray-900 font-bold text-xs flex items-center gap-2",children:"ð« Academia (La Zubia)"}),e.jsx("button",{type:"button",onClick:()=>!L&&_({...o,wants_academy:!o.wants_academy}),disabled:L,className:`w-10 h-6 rounded-full flex items-center p-1 transition-colors shrink-0 ${o.wants_academy?"bg-indigo-500":"bg-gray-300"} disabled:opacity-60`,children:e.jsx("div",{className:`w-4 h-4 bg-white rounded-full shadow-md transition-transform ${o.wants_academy?"translate-x-4":"translate-x-0"}`})})]})]}),!L&&e.jsx("div",{className:"pt-4",children:e.jsx("button",{type:"submit",disabled:V,className:"w-full bg-[#1c74e9] text-white font-black uppercase text-[10px] tracking-widest py-4 rounded-2xl shadow-lg shadow-blue-500/30 active:scale-95 transition-all",children:V?"Guardando...":"Guardar Mi Perfil"})})]})]})})]})});if(d==="coordinator")return e.jsx(Qs,{onBack:()=>f("dashboard"),onOpenAdminCalendar:()=>f("admin_calendar")});const ra=Object.entries(F).every(([a,s])=>s==="presente"||s==="canjear_bono"?Je[a]>0&&We[a]>0:!0);return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:` 93 @media print { 94 body * { visibility: hidden !important; } 95 #printable-contract, #printable-contract * { visibility: visible !important; color: black !important; } 96 #printable-contract { position: absolute; left: 0; top: 0; width: 100%; min-height: 100vh; background: white; margin: 0; padding: 40px; } 97 .no-print { display: none !important; } 98 } 99 `}),E&&i&&e.jsx("div",{className:"fixed inset-0 bg-gray-900/90 backdrop-blur-md z-[9999] flex flex-col justify-end sm:justify-center items-center p-0 sm:p-4 animate-in fade-in no-print",children:e.jsxs("div",{className:"bg-white w-full max-w-lg h-[90vh] sm:h-auto sm:max-h-[90vh] sm:rou
99nded-[40px] rounded-t-[40px] shadow-2xl flex flex-col overflow-hidden relative",children:[e.jsx("button",{onClick:()=>we(!1),className:"absolute top-4 right-4 bg-gray-200 text-gray-800 hover:bg-gray-300 w-8 h-8 rounded-full font-black text-xs z-20 transition-colors no-print",children:"â"}),e.jsxs("div",{id:"printable-contract",className:"overflow-y-auto flex-1 p-6 sm:p-10 font-sans",children:[e.jsxs("div",{className:"text-center mb-8 border-b-2 border-black/10 pb-6",children:[e.jsx("h2",{className:"text-2xl font-black uppercase tracking-tighter text-gray-900",children:"Profe en Casa"}),e.jsx("p",{className:"text-[10px] font-bold tracking-widest uppercase text-gray-500 mt-1",children:"Documento anterior · archivo histórico"})]}),e.jsxs("div",{className:"mb-6 text-sm text-gray-800 bg-gray-50 p-4 border border-gray-200 rounded-xl",children:[e.jsxs("p",{className:"mb-2",children:[e.jsx("strong",{className:"font-black text-gray-900 uppercase text-[10px] tracking-widest block",children:"La Empresa:"})," Profe en Casa (La Zubia)"]}),e.jsxs("p",{children:[e.jsx("strong",{className:"font-black text-gray-900 uppercase text-[10px] tracking-widest block mt-3",children:"El Colaborador:"})," ",i.name," ",e.jsx("br",{})," ",i.email]})]}),e.jsxs("div",{className:"text-xs text-gray-700 leading-relaxed text-justify space-y-4 mb-8",children:[e.jsx("p",{children:"Ambas partes acuerdan las siguientes normas de colaboración:"}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-gray-900",children:"1. MODALIDADES:"})," El colaborador se compromete a mantener los estándares de calidad exigidos: puntualidad y respeto en ",e.jsx("em",{className:"font-bold",children:"Domicilios"}),", entorno libre de ruidos en ",e.jsx("em",{className:"font-bold",children:"Online"}),", y dinamización equitativa en la ",e.jsx("em",{className:"font-bold",children:"Academia (Profe a 3)"}),"."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-gray-900",children:"2. USO DEL SISTEMA:"})," Es obligatorio el fichaje al llegar a la clase mediante la App y la redacción del reporte académico al finalizar. Las emergencias deberán comunicarse con máxima antelación."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-gray-900",children:"3. HONORARIOS:"})," Se abonarán las horas reales registradas. Los pagos se realizarán del 1 al 5 del mes vencido vÃa transferencia o Bizum."]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-gray-900",children:"4. NO COMPETENCIA:"})," El colaborador asume la prohibición expresa de ofrecer servicios particulares a las familias de la empresa por vÃas externas, asà como su responsabilidad legal sobre esta colaboración esporádica."]})]}),e.jsxs("div",{className:"border-t-2 border-gray-200 pt-6 mt-6",children:[e.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest text-gray-500 mb-4",children:"Firmado digitalmente y aceptado por el colaborador:"}),e.jsx("div",{className:"w-full max-w-[250px] mx-auto border-b border-gray-300 pb-2 mb-4",children:e.jsx("img",{src:(Et=Da(i))==null?void 0:Et.image,alt:"Firma Monitor",className:"w-full h-auto object-contain max-h-[100px] filter contrast-125"})}),e.jsxs("div",{className:"text-center font-mono text-[9px] text-gray-500",children:[e.jsxs("p",{children:["Sello de Tiempo: ",e.jsx("strong",{className:"text-gray-800",children:(Dt=Da(i))==null?void 0:Dt.date})]}),e.jsxs("p",{children:["Firma IP: ",e.jsx("strong",{className:"text-gray-800",children:(Ft=Da(i))==null?void 0:Ft.ip})]})]})]})]}),e.jsxs("div",{className:"p-6 bg-white border-t border-gray-100 shrink-0 text-center flex gap-3 no-print",children:[e.jsx("button",{onClick:()=>we(!1),className:"flex-1 bg-gray-100 text-gray-900 font-black uppercase text-[10px] tracking-widest py-4 rounded-2xl hover:bg-gray-200 active:scale-95 transition-all",children:"Cerrar Visor"}),e.jsx("button",{onClick:()=>window.print(),className:"flex-1 bg-purple-600 text-white font-black uppercase text-[10px] tracking-widest py-4 rounded-2xl shadow-lg shadow-purple-500/30 hover:bg-purple-500 active:scale-95 transition-all",children:"Imprimir PDF"})]})]})}),e.jsxs("div",{className:"w-full h-full flex flex-col relative font-sans text-left overflow-y-auto pb-24 bg-[#F5F7FA]",children:[t&&e.jsxs("div",{className:"bg-red-500 text-white p-2 text-center text-[10px] font-black uppercase tracking-widest shrink-0 flex justify-between items-center px-6 sticky top-0 z-[50]",children:[e.jsx("span",{children:"VISTA DE PROFESORA · SOLO LECTURA"}),l&&e.jsx("button",{onClick:l,className:"bg-white/20 hover:bg-white/30 px-3 py-1 rounded-md transition-colors active:scale-95",children:"CERRAR"})]}),e.jsxs("div",{className:"bg-[#1c74e9] rounded-b-[40px] p-6 pt-10 shadow-lg text-white shrink-0 relative overflow-hidden",children:[e.jsx("div",{className:"absolute top-[-50%] right-[-10%] w-[80%] h-[200%] bg-white/10 rounded-full blur-3xl"}),e.jsxs("div",{className:"flex justify-between items-start mb-6 relative z-10",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-black mb-1",children:"Mi Tablón"}),e.jsx("p",{className:"text-blue-200 text-[10px] font-bold uppercase tracking-widest",children:R})]}),!t&&e.jsx("button",{onClick:ht,className:"bg-white/20 p-3 rounded-2xl active:scale-95 transition-all shadow-sm",children:"ð"})]}),ls&&!t&&e.jsxs("div",{onClick:()=>f("coordinator"),className:"bg-purple-500 hover:bg-purple-600 rounded-2xl p-4 border border-purple-400 mb-3 flex justify-between items-center cursor-pointer active:scale-95 transition-all relative z-10 shadow-xl shadow-purple-500/30",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-white font-black uppercase tracking-widest text-xs",children:"ð PANEL DE COORDINACIÃN"}),e.jsx("p",{className:"text-purple-200 text-[9px] font-bold mt-1",children:"Gestión de Academia"})]}),e.jsx("span",{className:"text-xl",children:"â"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 relative z-10",children:[e.jsxs("div",{onClick:()=>_a(!0),className:"bg-white/10 hover:bg-white/20 rounded-2xl p-4 border border-white/20 flex flex-col justify-center items-center cursor-pointer active:scale-95 transition-all backdrop-blur-md",children:[e.jsx("span",{className:"text-2xl mb-1",children:"ð"}),e.jsx("p",{className:"text-blue-50 text-[9px] font-black uppercase tracking-widest text-center",children:"Reporte Mensual"})]}),e.jsxs("div",{onClick:()=>f("invoices"),className:"bg-white/10 hover:bg-white/20 rounded-2xl p-4 border border-white/20 flex flex-col justify-center items-center cursor-pointer active:scale-95 transition-all backdrop-blur-md",children:[e.jsx("span",{className:"text-2xl mb-1",children:"ð§¾"}),e.jsx("p",{className:"text-blue-50 text-[9px] font-black uppercase tracking-widest text-center",children:"Mis horas"})]}),e.jsxs("div",{onClick:()=>f("profile"),className:"col-span-2 bg-white/10 hover:bg-white/20 rounded-2xl p-4 border border-white/20 flex items-center justify-between cursor-pointer active:scale-95 transition-all backdrop-blur-md",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-2xl",children:"ð¤"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-blue-50 text-[9px] font-black uppercase tracking-widest",children:"Mi Perfil"}),e.jsx("p",{className:"text-blue-100 text-[9px] font-bold mt-1",children:"Completa tus datos, cobro y disponibilidad"})]})]}),e.jsx("span",{className:"text-lg text-white",children:"â"})]})]}),sa&&(qa||At)&&!t&&e.jsxs("div",{onClick:()=>f("profile"),className:"mt-3 bg-blue-50 border border-blue-200 rounded-2xl p-4 relative z-10 cursor-pointer active:scale-[0.99] transition-transform",children:[e.jsx("p",{className:"text-[#1c74e9] text-[10px] font-black uppercase tracking-widest mb-1",children:"Deja preparada tu ficha"}),e.jsx("p",{className:"text-slate-700 text-xs font-bold leading-relaxed",children:qa&&At?"Como ya tienes clases confirmadas, puedes dejar listos tu DNI/NIE, tu IBAN y tu dirección para que tu primer pago se prepare con normalidad.":qa?"Como ya tienes clases confirmadas, puedes añadir tu DNI/NIE y tu IBAN cuando quieras para dejar preparado tu primer pago.":"Cuando quieras, completa tu dirección para que tu ficha quede bien cerrada."})]}),i&&e.jsxs("div",{className:"mt-3 bg-gray-900/30 rounded-2xl p-4 border border-white/10 transition-all backdrop-blur-md relative z-10 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-white font-black uppercase tracking-widest text-[10px]",children:"Documentación docente"}),e.jsx("p",{className:"text-blue-100 text-[9px] font-bold mt-1",children:"Dirección comprueba el alta antes de la primera clase"})]}),t&&e.jsx("span",{className:"text-[8px] font-black uppercase tracking-widest bg-white/10 text-white px-2 py-1 rounded-lg border border-white/10",children:"Solo lectura"})]}),e.jsxs("div",{className:"bg-white/10 rounded-2xl border border-white/10 p-3 flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-white font-black uppercase tracking-widest text-[10px]",children:"Acuerdo anterior"}),e.jsx("p",{className:`text-[9px] font-bold mt-1 ${i.contract_signed?"text-blue-100":"text-white/60"}`,children:i.contract_signed?"Archivado como histórico":"Sin documento anterior"})]}),!t&&i.contract_signed&&e.jsx("button",{onClick:()=>we(!0),className:"bg-white/20 hover:bg-white/30 text-white text-[10px] font-black uppercase tracking-widest px-3 py-2 rounded-xl transition-colors active:scale-95",children:"Ver"})]}),e.jsxs("div",{className:"bg-white/10 rounded-2xl border border-white/10 p-3 flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-white font-black uppercase tracking-widest text-[10px]",children:"Certificado Delitos Sexuales"}),e.jsx("p",{className:`text-[9px] font-bold mt-1 ${i.certificate_url?"text-green-300":"text-orange-300"}`,children:i.certificate_url?"Archivo recibido · pendiente de revisión":"Pendiente de aportar"})]}),!t&&e.jsx("div",{children:i.certificate_url?e.jsx("button",{type:"button",onClick:()=>void yr("teacher_documents",i.certificate_url).catch(()=>alert("No se ha podido abrir el certificado. Revisa tu acceso o vuelve a intentarlo.")),className:"bg-white/20 hover:bg-white/30 text-white text-[10px] font-black uppercase tracking-widest px-3 py-2 rounded-xl transition-colors",children:"Ver"}):e.jsxs("label",{className:`text-[10px] font-black uppercase tracking-widest text-white px-3 py-2 rounded-xl transition-colors ${Q?"bg-white/10 cursor-not-allowed":"bg-white/20 cursor-pointer hover:bg-white/30"}`,children:[Q?"Subiendo...":"Subir",e.jsx("input",{type:"file",accept:".pdf,image/*",onChange:ks,disabled:Q,className:"hidden"})]})})]})]})]}),e.jsxs("div",{className:"p-6",children:[e.jsx("div",{className:"flex justify-between items-center mb-6",children:e.jsx("h2",{className:"text-gray-900 text-xl font-black tracking-tight",children:"Mi Agenda"})}),e.jsxs("div",{className:"space-y-8",children:[m.some(a=>/domicilio/i.test(String(a.modality||"")))&&e.jsxs("div",{className:"rounded-[24px] border border-violet-100 bg-violet-50 p-4",children:[e.jsx("p",{className:"text-violet-800 text-[10px] font-black uppercase tracking-widest",children:"Hoja de firmas a domicilio"}),e.jsx("p",{className:"mt-2 text-gray-700 text-[11px] font-bold leading-relaxed",children:"Lleva una hoja por familia y mes. Al terminar cada clase, anota el horario real y recoge ambas firmas. Despues registra la clase en Mi Agenda."}),e.jsx("a",{href:Ws.homeSignatureSheet,target:"_blank",rel:"noopener noreferrer",className:"mt-3 inline-flex rounded-xl bg-violet-800 px-4 py-2.5 text-[10px] font-black text-white",children:"Abrir hoja PDF"})]}),e.jsxs("div",{className:"bg-blue-50/70 border border-blue-100 rounded-[24px] p-4 space-y-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[#1c74e9] text-[10px] font-black uppercase tracking-widest",children:"Como se llena esta agenda"}),e.jsx("p",{className:"text-gray-600 text-[11px] font-bold leading-relaxed mt-2",children:"Tu agenda real se rellena automaticamente cuando coordinación crea tu grupo o clase en Agenda Centro y te asigna como profesora en esa sesión."}),e.jsx("p",{className:"text-gray-500 text-[10px] font-bold leading-relaxed mt-2",children:"La tutorÃa académica va aparte: puede aparecer primero como seguimiento, pero no se convierte en clase visible aquà hasta que exista la programación real."})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsxs("div",{className:"bg-white rounded-2xl border border-blue-100 p-3 text-center",children:[e.jsx("p",{className:"text-[#1c74e9] text-[8px] font-black uppercase tracking-widest",children:"Clases creadas"}),e.jsx("p",{className:"text-gray-900 text-lg font-black leading-none mt-1",children:ft.length})]}),e.jsxs("div",{className:"bg-white rounded-2xl border border-blue-100 p-3 text-center",children:[e.jsx("p",{className:"text-[#1c74e9] text-[8px] font-black uppercase tracking-widest",children:"DÃas cubiertos"}),e.jsx("p",{className:"text-gray-900 text-lg font-black leading-none mt-1",children:As})]}),e.jsxs("div",{className:"bg-white rounded-2xl border border-amber-100 p-3 text-center",children:[e.jsx("p",{className:"text-amber-600 text-[8px] font-black uppercase tracking-widest",children:"TutorÃas pendientes"}),e.jsx("p",{className:"text-gray-900 text-lg font-black leading-none mt-1",children:Z.length})]})]}),ta&&de.length>0&&e.jsxs("div",{className:"bg-white rounded-2xl border border-emerald-100 p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-emerald-700 text-[9px] font-black uppercase tracking-widest",children:"Clase extra puntual"}),e.jsx("p",{className:"text-gray-900 text-sm font-black mt-1",children:"Anadir clase extra a un alumno tuyo"}),e.jsx("p",{className:"text-gray-500 text-[10px] font-bold mt-1 leading-relaxed",children:"Solo para alumnos que ya tienes asignados. La clase se crea en agenda con precios automaticos y queda marcada como creada por monitor para que coordinacion la vea clara."})]}),e.jsxs("span",{className:"shrink-0 bg-emerald-50 text-emerald-700 border border-emerald-200 text-[8px] font-black uppercase px-2 py-1 rounded-full",children:[de.length," alumno(s)"]})]}),e.jsx("button",{type:"button",onClick:Ts,className:"bg-emerald-500 text-white border border-emerald-600 text-[10px] font-black uppercase tracking-widest px-4 py-3 rounded-xl shadow-lg shadow-emerald-500/20",children:"Crear clase extra"})]}),Oe&&e.jsxs("div",{className:"bg-white rounded-2xl border border-violet-100 p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-violet-700 text-[9px] font-black uppercase tracking-widest",children:"Permiso pu
99ntual en academia"}),e.jsx("p",{className:"text-gray-900 text-sm font-black mt-1",children:"Registrar visita presencial"}),e.jsx("p",{className:"text-gray-500 text-[10px] font-bold mt-1 leading-relaxed",children:"Este acceso usa el mismo registro rápido compartido de la academia. Asà no hay diferencias entre lo que recoge coordinación y lo que recoge el profesor."})]}),e.jsx("div",{className:"w-16 h-16 rounded-2xl border border-violet-100 bg-violet-50 p-1 shrink-0",children:e.jsx("img",{src:gs,alt:"QR registro rápido academia",className:"w-full h-full rounded-xl object-cover"})})]}),e.jsxs("div",{className:"bg-violet-50 border border-violet-100 rounded-xl px-3 py-2",children:[e.jsx("p",{className:"text-[8px] font-black uppercase tracking-widest text-violet-700",children:"Enlace interno"}),e.jsx("p",{className:"text-[10px] font-bold text-gray-700 break-all mt-1 leading-relaxed",children:Ie})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("button",{type:"button",onClick:Os,className:"bg-violet-500 text-white border border-violet-600 text-[10px] font-black uppercase tracking-widest px-4 py-3 rounded-xl shadow-lg shadow-violet-500/20",children:"Abrir registro"}),e.jsx("button",{type:"button",onClick:Is,className:"bg-white text-violet-700 border border-violet-100 text-[10px] font-black uppercase tracking-widest px-4 py-3 rounded-xl",children:ss?"Copiado":"Copiar enlace"}),e.jsx("button",{type:"button",onClick:Ps,className:"bg-violet-50 text-violet-700 border border-violet-100 text-[10px] font-black uppercase tracking-widest px-4 py-3 rounded-xl",children:"Modal interno"})]})]})]}),ee?e.jsx("p",{className:"text-[#1c74e9] animate-pulse text-center py-10 font-bold",children:"Sincronizando agenda..."}):m.length===0?e.jsxs(e.Fragment,{children:[Z.length>0&&$t(),e.jsxs("div",{className:"text-center bg-white p-8 rounded-[32px] border border-gray-100 shadow-sm",children:[e.jsx("span",{className:"text-4xl block mb-3",children:Z.length>0?"ð©¶":"ðï¸"}),e.jsx("p",{className:"text-gray-900 font-bold text-sm",children:Z.length>0?"No hay clases activas todavÃa":"Sin clases a la vista"}),e.jsx("p",{className:"text-gray-400 text-xs",children:Z.length>0?"Tienes tutorÃas ya asignadas, pero todavÃa falta crear los grupos o clases reales en Agenda Centro.":"En cuanto coordinación te programe una clase real en Agenda Centro, aparecerá aquà automáticamente."})]})]}):e.jsxs(e.Fragment,{children:[Z.length>0&&$t(),ze.length>0&&e.jsxs("div",{className:"space-y-4 animate-in fade-in slide-in-from-bottom-4",children:[e.jsxs("div",{className:"bg-white border border-gray-100 rounded-[28px] p-4 shadow-sm space-y-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[#1c74e9] text-[10px] font-black uppercase tracking-widest",children:"Prevision del mes"}),e.jsx("p",{className:"text-gray-900 text-lg font-black mt-1 capitalize",children:U.monthLabel}),e.jsx("p",{className:"text-gray-500 text-[10px] font-bold mt-1 leading-relaxed",children:"Revisa aqui tus horas y bloques previstos. Comprueba horarios, alumnos, asignaturas y niveles. Si algo no cuadra, pulsa `Avisar ajuste`. Si todo esta bien, no hace falta hacer nada."})]}),e.jsx("button",{type:"button",onClick:()=>Nt(),className:"shrink-0 bg-amber-50 text-amber-700 border border-amber-200 text-[10px] font-black uppercase tracking-widest px-3 py-2 rounded-xl",children:"Avisar ajuste"})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsxs("div",{className:"bg-slate-50 rounded-2xl border border-slate-200 p-3 text-center",children:[e.jsx("p",{className:"text-slate-500 text-[8px] font-black uppercase tracking-widest",children:"Clases"}),e.jsx("p",{className:"text-gray-900 text-lg font-black leading-none mt-1",children:U.totalClasses})]}),e.jsxs("div",{className:"bg-slate-50 rounded-2xl border border-slate-200 p-3 text-center",children:[e.jsx("p",{className:"text-slate-500 text-[8px] font-black uppercase tracking-widest",children:"Horas"}),e.jsxs("p",{className:"text-gray-900 text-lg font-black leading-none mt-1",children:[U.totalHours.toFixed(1)," h"]})]}),e.jsxs("div",{className:"bg-slate-50 rounded-2xl border border-slate-200 p-3 text-center",children:[e.jsx("p",{className:"text-slate-500 text-[8px] font-black uppercase tracking-widest",children:"Bloques"}),e.jsx("p",{className:"text-gray-900 text-lg font-black leading-none mt-1",children:U.weeklyBlocks.length})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs("span",{className:"bg-emerald-50 text-emerald-700 border border-emerald-200 px-3 py-2 rounded-xl text-[9px] font-black uppercase tracking-widest",children:[U.closedBlocks," cerrados"]}),e.jsxs("span",{className:"bg-amber-50 text-amber-700 border border-amber-200 px-3 py-2 rounded-xl text-[9px] font-black uppercase tracking-widest",children:[U.openBlocks," abiertos"]}),e.jsxs("span",{className:"bg-blue-50 text-blue-700 border border-blue-200 px-3 py-2 rounded-xl text-[9px] font-black uppercase tracking-widest",children:[U.individualBlocks," individuales"]})]}),e.jsx("div",{className:"space-y-2",children:U.weeklyBlocks.slice(0,4).map(a=>e.jsx("div",{className:"bg-slate-50 border border-slate-200 rounded-2xl p-3",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("p",{className:"text-sm font-black text-gray-900 leading-tight",children:[a.weekdayLabel," · ",a.timeLabel]}),e.jsxs("p",{className:"text-[10px] font-black uppercase tracking-widest text-[#1c74e9] mt-1",children:[a.subjectLabel," · ",a.levelLabel]}),e.jsxs("p",{className:"text-[10px] font-bold text-gray-500 mt-1 leading-relaxed",children:[a.studentFirstNamesLabel||"Sin alumnos"," · ",a.modalityLabel]})]}),e.jsx("span",{className:`shrink-0 px-2 py-1 rounded-lg border text-[8px] font-black uppercase tracking-widest ${a.variant==="exceptional"?"bg-violet-50 text-violet-700 border-violet-200":a.variant==="closed"?"bg-emerald-50 text-emerald-700 border-emerald-200":a.variant==="open"?"bg-amber-50 text-amber-700 border-amber-200":"bg-blue-50 text-blue-700 border-blue-200"}`,children:a.variantLabel})]})},`forecast-${a.signature}`))}),U.weeklyBlocks.length>4&&e.jsxs("p",{className:"text-[10px] text-gray-400 font-bold leading-relaxed",children:["Y ",U.weeklyBlocks.length-4," bloque(s) mas en el calendario de abajo."]})]}),e.jsxs("div",{className:"bg-white border border-gray-100 rounded-[28px] p-4 shadow-sm space-y-4 overflow-visible",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[#1c74e9] text-[10px] font-black uppercase tracking-widest",children:"Vista mensual"}),e.jsx("p",{className:"text-gray-500 text-[10px] font-bold mt-1",children:"Vista rapida para saber que dias estan cerrados, cuales siguen abiertos y que materia o nivel hay en cada hueco."})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("button",{type:"button",onClick:()=>wt(-1),className:"w-9 h-9 rounded-2xl border border-gray-200 bg-gray-50 text-gray-500 font-black text-sm",children:"â¹"}),e.jsx("button",{type:"button",onClick:()=>wt(1),className:"w-9 h-9 rounded-2xl border border-gray-200 bg-gray-50 text-gray-500 font-black text-sm",children:"âº"})]})]}),e.jsxs("div",{className:"bg-slate-50 border border-slate-200 rounded-[24px] p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 mb-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-900 text-lg font-black leading-none capitalize",children:Es}),e.jsx("p",{className:"text-gray-400 text-[9px] font-black uppercase tracking-widest mt-1",children:"Verde = cerrados · Violeta = 4 excepcional · Naranja = abiertos · Azul = individual / online"})]}),K&&e.jsx("button",{type:"button",onClick:()=>{Ye(null),Pe(null)},className:"text-[9px] font-black uppercase tracking-widest text-[#1c74e9] bg-white border border-blue-100 px-3 py-2 rounded-xl",children:"Ver todo"})]}
99),e.jsx("div",{className:"grid grid-cols-5 gap-2 mb-2",children:Tr.map(a=>e.jsx("div",{className:"text-center text-[9px] font-black uppercase tracking-widest text-gray-400 py-1",children:a},a))}),e.jsx("div",{className:"grid grid-cols-5 gap-2",children:Be.map((a,s)=>{if(!a)return e.jsx("div",{className:"h-[72px] rounded-2xl bg-transparent"},`empty-${s}`);const r=K===a.date,c=La===a.date,n=vt===a.date,b=a.classes.length>0,h=a.overdueCount>0?"border-rose-200 bg-rose-50 text-rose-700":a.exceptionalCount>0?"border-violet-200 bg-violet-50 text-violet-700":a.openCount>0?"border-amber-200 bg-amber-50 text-amber-700":a.closedCount>0?"border-emerald-200 bg-emerald-50 text-emerald-700":a.cancelledCount>0?"border-slate-200 bg-slate-50 text-slate-500":b?"border-blue-200 bg-blue-50 text-blue-700":"border-gray-200 bg-white text-gray-300",y=s%5,C=y===0?"left-0":y===4?"right-0":"left-1/2 -translate-x-1/2";return e.jsxs("div",{className:"relative",onMouseEnter:()=>b&&Pe(a.date),onMouseLeave:()=>Pe(j=>j===a.date?null:j),children:[e.jsxs("button",{type:"button",onClick:()=>b&&Ms(a.date),className:`w-full h-[72px] rounded-[22px] border px-1.5 py-2 flex flex-col items-center justify-between transition-all ${r?"ring-2 ring-[#1c74e9] shadow-md shadow-blue-500/10":n?"ring-2 ring-blue-200 shadow-sm shadow-blue-500/5":b?"hover:-translate-y-0.5 hover:shadow-sm":""} ${h}`,children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"text-sm font-black leading-none",children:a.dayNumber}),n&&e.jsx("span",{className:"text-[7px] font-black uppercase tracking-widest bg-white/80 border border-blue-100 px-1.5 py-0.5 rounded-full text-[#1c74e9]",children:"Hoy"})]}),b?e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-1 text-[8px] font-black uppercase tracking-widest leading-none",children:[a.overdueCount>0&&e.jsxs("span",{children:[a.overdueCount,"P"]}),a.exceptionalCount>0&&e.jsxs("span",{children:[a.exceptionalCount,"E"]}),a.closedCount>0&&e.jsxs("span",{children:[a.closedCount,"C"]}),a.openCount>0&&e.jsxs("span",{children:[a.openCount,"A"]}),a.individualCount>0&&e.jsxs("span",{children:[a.individualCount,"I"]}),a.cancelledCount>0&&e.jsxs("span",{children:[a.cancelledCount,"X"]})]}):e.jsx("span",{className:"text-[8px] font-black uppercase tracking-widest opacity-40",children:"-"})]}),c&&b&&e.jsxs("div",{className:`absolute top-full mt-2 z-30 w-64 max-w-[calc(100vw-3rem)] rounded-2xl border border-gray-200 bg-white shadow-xl p-3 ${C}`,children:[e.jsx("p",{className:"text-gray-900 text-[10px] font-black uppercase tracking-widest mb-2",children:a.date.split("-").reverse().join("/")}),e.jsx("div",{className:"space-y-2",children:a.classes.map(j=>e.jsxs("div",{className:"rounded-xl border border-gray-100 bg-slate-50 p-2",children:[e.jsxs("p",{className:"text-[11px] font-black text-gray-900 leading-tight",children:[j.subject||"Refuerzo"," ",e.jsxs("span",{className:"text-[9px] text-gray-400 font-bold",children:["(",j.level||"General",")"]})]}),e.jsxs("p",{className:"text-[9px] font-bold text-gray-500 mt-1",children:[j.start_time," - ",j.end_time," · ",Ua(j)]}),e.jsx("p",{className:"text-[10px] font-bold text-gray-700 mt-1",children:X(j.student_name,j.recovery_students).map($=>xa($)).join(", ")}),j.status==="Cancelada"&&e.jsxs("p",{className:"text-[9px] font-bold text-red-600 mt-1",children:["Motivo: ",Yt(j.monitor_notes)||"pendiente"]})]},`preview-${j.id}`))})]})]},a.date)})}),Fa.length===0&&e.jsx("div",{className:"mt-4 bg-white border border-dashed border-gray-200 rounded-2xl p-4 text-center",children:e.jsx("p",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest",children:"Este mes no tiene clases programadas en tu agenda"})}),Ma.length>0&&e.jsxs("div",{className:"mt-4 bg-white border border-orange-100 rounded-[22px] p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 mb-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-orange-500 text-[10px] font-black uppercase tracking-widest",children:"Fuera de lunes a viernes"}),e.jsx("p",{className:"text-gray-500 text-[10px] font-bold mt-1",children:"Estas clases no entran en la vista compacta semanal."})]}),e.jsxs("span",{className:"text-[9px] font-black uppercase tracking-widest text-orange-500",children:[Ma.length," clase(s)"]})]}),e.jsx("div",{className:"space-y-2",children:Ma.map(a=>e.jsxs("div",{className:"rounded-2xl border border-orange-100 bg-orange-50 p-3",children:[e.jsxs("p",{className:"text-sm font-black text-gray-900 leading-tight",children:[a.class_date?a.class_date.split("-").reverse().join("/"):"Sin fecha"," · ",a.subject||"Refuerzo",e.jsxs("span",{className:"text-[10px] text-gray-400 font-bold",children:[" (",a.level||"General",")"]})]}),e.jsxs("p",{className:"text-[10px] font-bold text-gray-500 mt-1",children:[a.start_time," - ",a.end_time," · ",Ua(a)]}),e.jsx("p",{className:"text-[11px] font-bold text-gray-700 mt-1",children:X(a.student_name,a.recovery_students).map(s=>xa(s)).join(", ")})]},`weekend-${a.id}`))})]}),ce&&ce.classes.length>0&&e.jsxs("div",{className:"mt-4 bg-white border border-blue-100 rounded-[22px] p-4 md:hidden",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 mb-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[#1c74e9] text-[10px] font-black uppercase tracking-widest",children:"Detalle rapido"}),e.jsx("p",{className:"text-gray-900 text-sm font-black mt-1",children:ce.date.split("-").reverse().join("/")})]}),e.jsxs("span",{className:"text-[8px] font-black uppercase tracking-widest text-gray-400",children:[ce.exceptionalCount,"E · ",ce.closedCount,"C · ",ce.openCount,"A · ",ce.individualCount,"I"]})]}),e.jsx("div",{className:"space-y-2",children:ce.classes.map(a=>e.jsxs("div",{className:"rounded-2xl border border-gray-100 bg-slate-50 p-3",children:[e.jsxs("p",{className:"text-sm font-black text-gray-900 leading-tight",children:[a.subject||"Refuerzo"," ",e.jsxs("span",{className:"text-[10px] text-gray-400 font-bold",children:["(",a.level||"General",")"]})]}),e.jsxs("p",{className:"text-[10px] font-bold text-gray-500 mt-1",children:[a.start_time," - ",a.end_time," · ",Ua(a)]}),e.jsx("p",{className:"text-[11px] font-bold text-gray-700 mt-1",children:X(a.student_name,a.recovery_students).map(s=>xa(s)).join(", ")})]},`mobile-preview-${a.id}`))})]})]})]}),e.jsx("h3",{className:"text-gray-400 text-[10px] font-black uppercase tracking-widest border-b border-gray-200 pb-2",children:"ð Próximas Clases Creadas en Agenda Centro"}),e.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-gray-200 pb-2",children:[e.jsx("h3",{className:"text-gray-400 text-[10px] font-black uppercase tracking-widest",children:K?`Clases del ${Fs}`:"Todo el calendario"}),K&&e.jsxs("span",{className:"text-[9px] font-black uppercase tracking-widest text-[#1c74e9]",children:[Ae.length," clase(s)"]})]}),jt.map(St),Ae.length>6&&e.jsx("button",{onClick:()=>Ne(a=>!a),className:"w-full bg-white border border-gray-200 text-[#1c74e9] text-[10px] font-black uppercase tracking-widest py-3 rounded-2xl",children:be?"Ver menos clases":`Ver ${$s} clases mas`}),Ae.length>6&&!be&&e.jsx("p",{className:"text-gray-400 text-[10px] font-bold leading-relaxed",children:"Mostrando solo las 6 proximas clases para que la agenda se vea mas limpia."})]}),yt.length>0&&e.jsxs("div",{className:"space-y-4 pt-4 animate-in fade-in slide-in-from-bottom-8",children:[e.jsx("h3",{className:"text-gray-400 text-[10px] font-black uppercase tracking-widest border-b border-gray-200 pb-2",children:"â
Historial Completado"}),yt.map(St)]})]})]})]}),as&&ta&&e.jsx("div",{className:"fixed inset-0 bg-gray-900/60 backdrop-blur-sm flex justify-center items-center z-[9999] p-4",children:e.jsxs("div",{className:"bg-white w-full max-w-sm rounded-[32px] shadow-2xl relative flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-5 text-center border-b border-gray-100 bg-emerald-50",children:[e.jsx("h3",{className:"text-emerald-900 font-black text-xl",children:"Clase extra puntual"}),e.jsx("p",{className:"text-[11px] text-emerald-700 font-bold mt-2",children:"Solo para alumnos que ya tienes asignados. Se crea en agenda y queda registrada como clase extra creada por monitor."})]}),e.jsx("div",{className:"p-6",children:e.jsxs("form",{id:"extraClassForm",onSubmit:Rs,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest mb-2 block",children:"Alumno asignado"}),e.jsx("select",{value:p.student_name,onChange:a=>qs(a.target.value),className:"w-full bg-gray-50 text-gray-900 p-4 rounded-xl border border-gray-200 text-sm font-bold outline-none focus:border-emerald-400 transition-colors",children:de.map(a=>e.jsx("option",{value:a.name,children:a.name},a.student_id||a.id||a.name))})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest mb-2 block",children:"Fecha"}),e.jsx("input",{type:"date",required:!0,value:p.class_date,onChange:a=>Y({...p,class_date:a.target.value,labor_control_id:""}),className:"w-full bg-gray-50 text-gray-900 p-4 rounded-xl border border-gray-200 text-sm font-bold outline-none focus:border-emerald-400 transition-colors"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest mb-2 block",children:"Modalidad"}),e.jsxs("select",{value:p.modality,onChange:a=>Y({...p,modality:a.target.value,labor_control_id:""}),className:"w-full bg-gray-50 text-gray-900 p-4 rounded-xl border border-gray-200 text-sm font-bold outline-none focus:border-emerald-400 transition-colors",children:[e.jsx("option",{value:"Academia Profe a 3",children:"Academia Profe a 3"}),e.jsx("option",{value:Fe,children:"Clase extra puntual en centro"}),e.jsx("option",{value:"Profe en casa (Domicilio)",children:"Profe en casa (Domicilio)"}),e.jsx("option",{value:"Clases Online",children:"Clases Online"})]}),p.modality===Fe&&e.jsx("p",{className:"text-[10px] text-amber-700 font-black mt-2 bg-amber-50 border border-amber-200 rounded-xl p-3 leading-relaxed",children:"Extra puntual: no abre grupo Profe a 3. Calcula por hora segun nivel y duracion."})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest mb-2 block",children:"Inicio"}),e.jsx("input",{type:"time",required:!0,value:p.start_time,onChange:a=>Y({...p,start_time:a.target.value}),className:"w-full bg-gray-50 text-gray-900 p-4 rounded-xl border border-gray-200 text-sm font-bold outline-none focus:border-emerald-400 transition-colors"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest mb-2 block",children:"Fin"}),e.jsx("input",{type:"time",required:!0,value:p.end_time,onChange:a=>Y({...p,end_time:a.target.value}),className:"w-full bg-gray-50 text-gray-900 p-4 rounded-xl border border-gray-200 text-sm font-bold outline-none focus:border-emerald-400 transition-colors"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest mb-2 block",children:"Nivel"}),e.jsxs("select",{required:!0,value:p.level,onChange:a=>Y({...p,level:a.target.value}),className:"w-full bg-gray-50 text-gray-900 p-4 rounded-xl border border-gray-200 text-sm font-bold outline-none focus:border-emerald-400 transition-colors",children:[e.jsx("option",{value:"",children:"Selecciona nivel"}),Wt.map(a=>e.jsx("option",{value:a,children:a},a))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest mb-2 block",children:"Asignatura"}),e.jsxs("select",{required:!0,value:p.subject,onChange:a=>Y({...p,subject:a.target.value}),className:"w-full bg-gray-50 text-gray-900 p-4 rounded-xl border border-gray-200 text-sm font-bold outline-none focus:border-emerald-400 transition-colors",children:[e.jsx("option",{value:"",children:"Selecciona asignatura"}),Qt.map(a=>e.jsx("option",{value:a,children:a},a))]})]})]}),Pt(p.modality)&&e.jsxs("div",{className:`rounded-2xl border p-4 ${Re?"border-orange-200 bg-orange-50":"border-red-200 bg-red-50"}`,children:[e.jsx("p",{className:`text-[10px] font-black uppercase tracking-widest ${Re?"text-[#D86C00]":"text-red-700"}`,children:"Horas presenciales"}),Re?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mt-2 text-[10px] font-bold leading-relaxed text-orange-900",children:"Una clase extra tambien puede cambiar tus horas. Puedes guardarla;
99 Coordinacion y Direccion revisaran despues el alta o la ampliacion necesaria."}),e.jsxs("select",{value:p.labor_control_id,onChange:a=>Y({...p,labor_control_id:a.target.value}),className:"mt-3 w-full rounded-xl border border-orange-200 bg-white p-3 text-xs font-black text-orange-900 outline-none",children:[e.jsx("option",{value:"",children:"Sin vincular por ahora"}),Ta().map(a=>e.jsxs("option",{value:a.id,children:[a.assignment_summary," · ",lr(a.labor_action)]},a.id))]}),Ta().length===0&&e.jsx("p",{className:"mt-3 rounded-xl border border-orange-200 bg-white p-3 text-[9px] font-black leading-relaxed text-[#D86C00]",children:"No hay un seguimiento confirmado compatible. La clase puede registrarse y quedara pendiente de revision laboral."})]}):e.jsx("p",{className:"mt-2 text-[10px] font-bold leading-relaxed text-red-800",children:"No se ha podido cargar Alta y horas. Esto no impide registrar la clase; Coordinacion debera revisarla despues."})]}),p.modality.includes("Online")&&e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest mb-2 block",children:"Enlace Meet"}),e.jsx("input",{type:"url",value:p.meet_link,onChange:a=>Y({...p,meet_link:a.target.value}),placeholder:"Opcional si ya lo tienes",className:"w-full bg-gray-50 text-gray-900 p-4 rounded-xl border border-gray-200 text-sm font-bold outline-none focus:border-emerald-400 transition-colors"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest mb-2 block",children:"Nota interna"}),e.jsx("textarea",{rows:3,value:p.notes,onChange:a=>Y({...p,notes:a.target.value}),placeholder:"Ej: clase extra acordada con la familia para repaso del examen",className:"w-full bg-gray-50 text-gray-900 p-4 rounded-xl border border-gray-200 text-sm font-bold outline-none focus:border-emerald-400 transition-colors resize-none"})]})]})}),e.jsxs("div",{className:"p-4 border-t border-gray-100 bg-gray-50 flex gap-3",children:[e.jsx("button",{type:"button",onClick:_t,className:"flex-1 py-4 text-gray-500 font-black text-[10px] uppercase tracking-widest hover:text-gray-900 transition-colors",children:"Cancelar"}),e.jsx("button",{type:"submit",form:"extraClassForm",disabled:Za,className:"flex-[2] py-4 bg-emerald-500 text-white font-black rounded-xl shadow-lg shadow-emerald-500/30 uppercase text-[10px] tracking-widest",children:Za?"Guardando...":"Guardar clase extra"})]})]})}),ts&&e.jsx("div",{className:"fixed inset-0 bg-gray-900/60 backdrop-blur-sm flex justify-center items-center z-[9999] p-4",children:e.jsxs("div",{className:"bg-white w-full max-w-sm rounded-[32px] shadow-2xl relative flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-5 text-center border-b border-gray-100 bg-violet-50",children:[e.jsx("h3",{className:"text-violet-900 font-black text-xl",children:"Registrar visita"}),e.jsx("p",{className:"text-[11px] text-violet-700 font-bold mt-2",children:"Solo para visitas personales que coordinación te haya pedido registrar. Al guardarlo entra en seguimiento de familias interesadas."})]}),e.jsx("div",{className:"p-6",children:e.jsxs("form",{id:"quickLeadForm",onSubmit:zs,className:"space-y-4",children:[e.jsxs("div",{className:"rounded-2xl border border-violet-100 bg-violet-50 px-4 py-3",children:[e.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest text-violet-700",children:"Origen"}),e.jsx("p",{className:"text-[12px] text-violet-900 font-bold mt-1",children:"Visita personal en la academia"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest mb-2 block",children:"Nombre tutor *"}),e.jsx("input",{required:!0,value:g.parent_first_name,onChange:a=>G({...g,parent_first_name:a.target.value}),className:"w-full bg-gray-50 text-gray-900 p-4 rounded-xl border border-gray-200 text-sm font-bold outline-none focus:border-violet-400 transition-colors",placeholder:"Ej: Carmen"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest mb-2 block",children:"Apellidos tutor *"}),e.jsx("input",{required:!0,value:g.parent_last_name,onChange:a=>G({...g,parent_last_name:a.target.value}),className:"w-full bg-gray-50 text-gray-900 p-4 rounded-xl border border-gray-200 text-sm font-bold outline-none focus:border-violet-400 transition-colors",placeholder:"Ej: Garcia Lopez"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest mb-2 block",children:"Nombre alumno *"}),e.jsx("input",{required:!0,value:g.student_first_name,onChange:a=>G({...g,student_first_name:a.target.value}),className:"w-full bg-gray-50 text-gray-900 p-4 rounded-xl border border-gray-200 text-sm font-bold outline-none focus:border-violet-400 transition-colors",placeholder:"Ej: Laura"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest mb-2 block",children:"Apellidos alumno *"}),e.jsx("input",{required:!0,value:g.student_last_name,onChange:a=>G({...g,student_last_name:a.target.value}),className:"w-full bg-gray-50 text-gray-900 p-4 rounded-xl border border-gray-200 text-sm font-bold outline-none focus:border-violet-400 transition-colors",placeholder:"Ej: Martin Ruiz"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest mb-2 block",children:"Teléfono *"}),e.jsx("input",{required:!0,value:g.phone,onChange:a=>G({...g,phone:a.target.value}),className:"w-full bg-gray-50 text-gray-900 p-4 rounded-xl border border-gray-200 text-sm font-bold outline-none focus:border-violet-400 transition-colors",placeholder:"+34 600 000 000"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest mb-2 block",children:"Localidad *"}),e.jsx("input",{required:!0,value:g.locality,onChange:a=>G({...g,locality:a.target.value}),className:"w-full bg-gray-50 text-gray-900 p-4 rounded-xl border border-gray-200 text-sm font-bold outline-none focus:border-violet-400 transition-colors",placeholder:"La Zubia"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest mb-2 block",children:"Curso exacto"}),e.jsxs("select",{value:g.level,onChange:a=>G({...g,level:a.target.value}),className:"w-full bg-gray-50 text-gray-900 p-4 rounded-xl border border-gray-200 text-sm font-bold outline-none focus:border-violet-400 transition-colors",children:[e.jsx("option",{value:"",children:"Selecciona curso exacto"}),Dr.map(a=>e.jsx("option",{value:a,children:a},a))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest mb-2 block",children:"Modalidad"}),e.jsx("select",{value:g.modality,onChange:a=>G({...g,modality:a.target.value}),className:"w-full bg-gray-50 text-gray-900 p-4 rounded-xl border border-gray-200 text-sm font-bold outline-none focus:border-violet-400 transition-colors",children:Mr.map(a=>e.jsx("option",{value:a,children:a},a))})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest mb-2 block",children:"Asignatura principal *"}),e.jsxs("select",{required:!0,value:g.subjects,onChange:a=>G({...g,subjects:a.target.value}),className:"w-full bg-gray-50 text-gray-900 p-4 rounded-xl border border-gray-200 text-sm font-bold outline-none focus:border-violet-400 transition-colors",children:[e.jsx("option",{value:"",children:"Selecciona asignatura"}),Fr.map(a=>e.jsx("option",{value:a,children:a},a))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest mb-2 block",children:"Colegio / instituto"}),e.jsx("input",{value:g.school_name,onChange:a=>G({...g,school_name:a.target.value}),className:"w-full bg-gray-50 text-gray-900 p-4 rounded-xl border border-gray-200 text-sm font-bold outline-none focus:border-violet-400 transition-colors",placeholder:"Opcional"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest mb-2 block",children:"Email"}),e.jsx("input",{type:"email",value:g.email,onChange:a=>G({...g,email:a.target.value}),className:"w-full bg-gray-50 text-gray-900 p-4 rounded-xl border border-gray-200 text-sm font-bold outline-none focus:border-violet-400 transition-colors",placeholder:"Opcional"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest mb-2 block",children:"Horario comentado"}),e.jsx("input",{value:g.availability,onChange:a=>G({...g,availability:a.target.value}),className:"w-full bg-gray-50 text-gray-900 p-4 rounded-xl border border-gray-200 text-sm font-bold outline-none focus:border-violet-400 transition-colors",placeholder:"Ej: martes y jueves 17:30"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest mb-2 block",children:"Observación rápida"}),e.jsx("textarea",{rows:3,value:g.notes,onChange:a=>G({...g,notes:a.target.value}),className:"w-full bg-gray-50 text-gray-900 p-4 rounded-xl border border-gray-200 text-sm font-bold outline-none focus:border-violet-400 transition-colors resize-none",placeholder:"Algo importante que haya contado la familia"})]})]})}),e.jsxs("div",{className:"p-4 border-t border-gray-100 bg-gray-50 flex gap-3",children:[e.jsx("button",{type:"button",onClick:()=>ya(!1),className:"flex-1 py-4 text-gray-500 font-black text-[10px] uppercase tracking-widest hover:text-gray-900 transition-colors",children:"Cancelar"}),e.jsx("button",{type:"submit",form:"quickLeadForm",disabled:Xa,className:"flex-[2] py-4 bg-violet-500 text-white font-black rounded-xl shadow-lg shadow-violet-500/30 uppercase text-[10px] tracking-widest",children:Xa?"Guardando...":"Guardar visita"})]})]})}),pa&&e.jsx("div",{className:"fixed inset-0 bg-gray-900/60 backdrop-blur-sm flex justify-center items-center z-[9999] p-4",children:e.jsxs("div",{className:"bg-white w-full max-w-md max-h-[90vh] rounded-[32px] shadow-2xl relative flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-5 text-center border-b border-gray-100 bg-amber-50",children:[e.jsx("h3",{className:"text-amber-900 font-black text-xl",children:le===me?"Cambio de agenda":"Avisar ajuste"}),e.jsx("p",{className:"text-[11px] text-amber-700 font-bold mt-2",children:le===me?"Esto no camb
99ia la clase directamente. Deja una alerta ordenada para que administracion revise y mueva la agenda si procede.":`Esto llega a coordinacion para revisar tu prevision de ${U.monthLabel}. Usa este aviso si ves algo raro en horario, alumnos, asignatura, nivel o clases del mes.`})]}),e.jsx("div",{className:"p-6 overflow-y-auto",children:e.jsxs("form",{id:"forecastFeedbackForm",onSubmit:Ls,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest mb-2 block",children:"Que hay que revisar"}),e.jsx("select",{value:le,onChange:a=>ba(a.target.value),className:"w-full bg-gray-50 text-gray-900 p-4 rounded-xl border border-gray-200 text-sm font-bold outline-none focus:border-amber-400 transition-colors",children:qr.map(a=>e.jsx("option",{value:a,children:a},a))})]}),le===me&&e.jsxs("div",{className:"bg-amber-50 border border-amber-100 rounded-[24px] p-4 space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-amber-700 text-[10px] font-black uppercase tracking-widest mb-2 block",children:"Clase afectada"}),e.jsxs("select",{value:Wa,onChange:a=>{const s=m.find(r=>r.id===a.target.value);ha(a.target.value),s&&ke({class_date:s.class_date||"",start_time:String(s.start_time||"").slice(0,5),end_time:String(s.end_time||"").slice(0,5)})},className:"w-full bg-white text-gray-900 p-3 rounded-xl border border-amber-100 text-xs font-bold outline-none focus:border-amber-400 transition-colors",children:[e.jsx("option",{value:"",children:"Elegir clase..."}),ze.filter(a=>a.status!=="Cancelada").slice(0,120).map(a=>e.jsx("option",{value:a.id,children:Jt(a)},a.id))]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsxs("div",{className:"col-span-3",children:[e.jsx("label",{className:"text-amber-700 text-[9px] font-black uppercase tracking-widest mb-1 block",children:"Nuevo dia"}),e.jsx("input",{type:"date",value:H.class_date,onChange:a=>ke(s=>({...s,class_date:a.target.value})),className:"w-full bg-white text-gray-900 p-3 rounded-xl border border-amber-100 text-xs font-bold outline-none focus:border-amber-400 transition-colors"})]}),e.jsxs("div",{className:"col-span-3 sm:col-span-1",children:[e.jsx("label",{className:"text-amber-700 text-[9px] font-black uppercase tracking-widest mb-1 block",children:"Inicio"}),e.jsx("input",{type:"time",value:H.start_time,onChange:a=>ke(s=>({...s,start_time:a.target.value})),className:"w-full bg-white text-gray-900 p-3 rounded-xl border border-amber-100 text-xs font-bold outline-none focus:border-amber-400 transition-colors"})]}),e.jsxs("div",{className:"col-span-3 sm:col-span-1",children:[e.jsx("label",{className:"text-amber-700 text-[9px] font-black uppercase tracking-widest mb-1 block",children:"Fin"}),e.jsx("input",{type:"time",value:H.end_time,onChange:a=>ke(s=>({...s,end_time:a.target.value})),className:"w-full bg-white text-gray-900 p-3 rounded-xl border border-amber-100 text-xs font-bold outline-none focus:border-amber-400 transition-colors"})]})]}),e.jsx("p",{className:"text-[10px] text-amber-800 font-bold leading-relaxed",children:"Administracion vera la clase original, el horario pedido y tu comentario antes de tocar la agenda."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest mb-2 block",children:"Comentario"}),e.jsx("textarea",{required:!0,rows:le===me?4:5,value:Ve,onChange:a=>ga(a.target.value),placeholder:le===me?"Ej: La familia pide pasar la clase del martes al miercoles porque ese dia no puede venir.":"Ej: En el grupo del jueves falta una clase o aparece un alumno que ya no viene.",className:"w-full bg-gray-50 text-gray-900 p-4 rounded-xl border border-gray-200 text-sm font-bold outline-none focus:border-amber-400 transition-colors resize-none"})]})]})}),e.jsxs("div",{className:"p-4 border-t border-gray-100 bg-gray-50 flex gap-3",children:[e.jsx("button",{type:"button",onClick:kt,className:"flex-1 py-4 text-gray-500 font-black text-[10px] uppercase tracking-widest hover:text-gray-900 transition-colors",children:"Cancelar"}),e.jsx("button",{type:"submit",form:"forecastFeedbackForm",disabled:Qa,className:"flex-[2] py-4 bg-amber-500 text-white font-black rounded-xl shadow-lg shadow-amber-500/30 uppercase text-[10px] tracking-widest",children:Qa?"Enviando...":"Enviar aviso"})]})]})}),xs&&e.jsx("div",{className:"fixed inset-0 bg-gray-900/60 backdrop-blur-sm flex justify-center items-center z-[9999] p-4",children:e.jsxs("div",{className:"bg-white w-full max-w-md rounded-[32px] shadow-2xl relative flex flex-col max-h-[90vh] overflow-hidden animate-in zoom-in-95 duration-200",children:[e.jsxs("div",{className:"p-5 text-center border-b border-gray-100 shrink-0 bg-[#1c74e9] text-white",children:[e.jsx("h3",{className:"font-black text-xl mb-1",children:"Reporte Mensual"}),e.jsx("p",{className:"text-blue-200 text-[10px] uppercase font-black tracking-widest",children:"IA de SÃntesis Académica"})]}),e.jsxs("div",{className:"p-6 overflow-y-auto hide-scroll flex-1 space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest mb-2 block",children:"1. Selecciona a tu alumno"}),e.jsxs("select",{value:ct,onChange:a=>ms(a.target.value),className:"w-full bg-gray-50 text-[#1c74e9] p-4 rounded-xl border border-gray-200 text-sm font-bold outline-none focus:border-[#1c74e9] transition-colors shadow-sm",children:[e.jsx("option",{value:"",children:"ð¤ -- Elige un alumno --"}),bs.map((a,s)=>e.jsx("option",{value:a,children:a},s))]})]}),us?e.jsxs("div",{className:"flex flex-col items-center py-6",children:[e.jsx("div",{className:"w-8 h-8 border-4 border-[#1c74e9] border-t-transparent roun
99ded-full animate-spin mb-3"}),e.jsx("p",{className:"text-[#1c74e9] text-[10px] font-black uppercase tracking-widest animate-pulse",children:"Analizando clases de este mes..."})]}):re?e.jsxs("div",{className:"space-y-6 animate-in fade-in slide-in-from-bottom-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest mb-2 block",children:"2. Resumen Automático (Mes Actual)"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 mb-2",children:[e.jsxs("div",{className:"bg-blue-50 p-3 rounded-xl border border-blue-100 text-center",children:[e.jsx("p",{className:"text-blue-500 text-[8px] font-black uppercase tracking-widest",children:"Actitud Media"}),e.jsxs("p",{className:"text-blue-700 font-black text-lg",children:[re.avgAttitude," ",e.jsx("span",{className:"text-sm",children:"/ 5"})]})]}),e.jsxs("div",{className:"bg-blue-50 p-3 rounded-xl border border-blue-100 text-center",children:[e.jsx("p",{className:"text-blue-500 text-[8px] font-black uppercase tracking-widest",children:"Comprensión"}),e.jsxs("p",{className:"text-blue-700 font-black text-lg",children:[re.avgUnderstanding," ",e.jsx("span",{className:"text-sm",children:"/ 5"})]})]})]}),e.jsxs("div",{className:"bg-gray-50 p-3 rounded-xl border border-gray-200",children:[e.jsxs("p",{className:"text-gray-400 text-[8px] font-black uppercase tracking-widest mb-1",children:["Registro de notas diarias (",re.classesCount," clases)"]}),e.jsx("p",{className:"text-gray-600 text-xs italic whitespace-pre-wrap leading-relaxed",children:re.notes})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest mb-2 block",children:"3. Conclusión Final del Profesor"}),e.jsx("textarea",{value:ea,onChange:a=>Sa(a.target.value),className:"w-full bg-white text-gray-900 p-4 rounded-xl border border-gray-200 outline-none text-sm min-h-[120px] focus:border-[#1c74e9] transition-colors shadow-sm",placeholder:"Escribe aquà un resumen para los padres de cómo ha ido el mes, en qué ha mejorado y qué objetivos hay para el mes que viene..."})]})]}):e.jsxs("div",{className:"text-center py-6 opacity-50",children:[e.jsx("span",{className:"text-4xl block mb-2",children:"ð¤"}),e.jsx("p",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest",children:"La IA recopilará los datos al seleccionar"})]})]}),e.jsxs("div",{className:"p-4 border-t border-gray-100 bg-gray-50 shrink-0 flex gap-3",children:[e.jsx("button",{type:"button",onClick:()=>{_a(!1),Sa(""),Xe(null),Ca("")},className:"flex-1 py-4 text-gray-500 font-black text-[10px] uppercase tracking-widest hover:text-gray-900 transition-colors",children:"Cancelar"}),e.jsx("button",{type:"button",onClick:ps,disabled:ut||!re||!ea,className:`flex-[2] py-4 font-black rounded-xl shadow-lg uppercase text-[10px] tracking-widest transition-all ${!re||!ea?"bg-gray-300 text-gray-500 shadow-none cursor-not-allowed":"bg-[#1c74e9] text-white shadow-blue-500/30 active:scale-95 hover:bg-blue-600"}`,children:ut?"Enviando...":"Enviar a Coordinación ð"})]})]})}),v&&e.jsx(e.Fragment,{children:e.jsx("div",{className:"fixed inset-0 bg-gray-900/60 backdrop-blur-sm flex justify-center items-end sm:items-center z-[9999] p-0 sm:p-4",children:e.jsxs("div",{className:"bg-white w-full max-w-md h-[100svh] min-h-[100svh] sm:h-auto sm:min-h-0 sm:max-h-[90vh] rounded-none sm:rounded-[32px] shadow-2xl relative flex flex-col overflow-hidden animate-in zoom-in-95 duration-200",children:[e.jsxs("div",{className:"px-5 pb-5 pt-10 sm:p-5 text-center border-b border-gray-100 shrink-0 bg-[#1c74e9] text-white",style:{paddingTop:"calc(env(safe-area-inset-top, 0px) + 1.5rem)"},children:[e.jsx("h3",{className:"font-black text-xl mb-1",children:"Evaluación de Alumnos"}),e.jsx("p",{className:"text-blue-200 text-[10px] uppercase font-black tracking-widest",children:v.subject})]}),e.jsx("div",{className:"p-6 overflow-y-auto hide-scroll flex-1 space-y-6 overscroll-contain pb-8",children:e.jsxs("form",{id:"fichajeForm",onSubmit:_s,className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest mb-3 border-b border-gray-100 pb-2",children:"1. Control de Asistencia y Rendimiento"}),Object.keys(F).map(a=>
99{const s=F[a],r=es(v==null?void 0:v.modality),c=s==="presente"||s==="canjear_bono",n=D.find(u=>u.name===a),b=Number((n==null?void 0:n.extra_classes_balance)||0),h=Ia(a,v==null?void 0:v.recovery_students),y=h&&(b>0||s==="canjear_bono"),C=Ot(It(n==null?void 0:n.upcoming_exams)),j=C.slice(0,3),$=br(C),z=new Set($.map(u=>u.id)),N=$[0]||null,T=zt(Bt(n==null?void 0:n.term_grades)).slice(-3),Ee=cs===a;return e.jsxs("div",{className:`p-4 rounded-2xl border mb-3 transition-colors ${c?"bg-blue-50/30 border-blue-100":"bg-gray-50 border-gray-100"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 mb-3",children:[e.jsx("p",{className:"font-black text-gray-900 text-sm",children:a}),h&&e.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest px-2 py-1 rounded-full bg-violet-50 text-violet-700 border border-violet-200",children:"Recuperacion"})]}),N&&e.jsx("div",{className:"mb-3 bg-amber-50 border border-amber-200 rounded-xl p-3",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[9px] text-amber-700 font-black uppercase tracking-widest",children:"Examen cerca"}),e.jsxs("p",{className:"text-[11px] text-gray-900 font-black mt-2 leading-5",children:[N.subject," · ",za(N.exam_date)," · ",N.urgency_label]}),$.length>1&&e.jsxs("p",{className:"text-[10px] text-amber-700 font-bold mt-2 leading-relaxed",children:["+",$.length-1," examen/es mas en los proximos dias"]})]}),e.jsx("span",{className:"shrink-0 bg-white text-amber-700 border border-amber-200 px-2 py-1 rounded-full text-[9px] font-black uppercase tracking-widest",children:N.urgency_label})]})}),e.jsxs("div",{className:`grid gap-2 mb-4 ${r?"grid-cols-2":"grid-cols-1"}`,children:[e.jsx("button",{type:"button",onClick:()=>{Ce({...F,[a]:"presente"}),ne({...J,[a]:""})},className:`p-2 rounded-xl border text-[10px] font-black uppercase tracking-widest transition-colors ${s==="presente"?"bg-[#1c74e9] text-white border-blue-600 shadow-md":"bg-white text-gray-500 border-gray-200 hover:border-blue-300"}`,children:r?"ð§âð Presente":"Clase impartida"}),r&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:()=>{Ce({...F,[a]:"falta_injustificada"}),ne({...J,[a]:""})},className:`p-2 rounded-xl border text-[10px] font-black uppercase tracking-widest transition-colors ${s==="falta_injustificada"?"bg-orange-500 text-white border-orange-600 shadow-md":"bg-white text-gray-500 border-gray-200 hover:border-orange-300"}`,children:"â ï¸ Falta"}),e.jsx("button",{type:"button",onClick:()=>ws(a),className:`p-2 rounded-xl border text-[10px] font-black uppercase tracking-widest transition-colors ${s==="falta_justificada"?"bg-green-500 text-white border-green-600 shadow-md":"bg-white text-gray-500 border-gray-200 hover:border-green-300"}`,children:"Justificada"}),h&&e.jsx("button",{type:"button",onClick:()=>{Ce({...F,[a]:"canjear_bono"}),ne({...J,[a]:""})},disabled:!y,title:y?"Marcar como recuperacion sin cobro":"Este alumno no tiene recuperaciones pendientes",className:`p-2 rounded-xl border text-[10px] font-black uppercase tracking-widest transition-colors ${s==="canjear_bono"?"bg-purple-500 text-white border-purple-600 shadow-md":y?"bg-white text-gray-500 border-gray-200 hover:border-purple-300":"bg-gray-100 text-gray-300 border-gray-200 cursor-not-allowed"}`,children:"Recuperacion sin cobro"})]})]}),!r&&e.jsx("p",{className:"text-[10px] font-bold text-blue-700 -mt-1 mb-3",children:"Si la clase no se impartio, no la cierres como falta: dejala pen
99diente y avisa a Coordinacion para organizarla."}),r&&h&&!y&&e.jsx("p",{className:"text-[10px] font-bold text-gray-400 -mt-1 mb-3",children:"Sin recuperaciones pendientes para marcar una recuperacion sin cobro."}),r&&s!=="falta_justificada"&&e.jsx("p",{className:"text-[10px] font-bold text-green-600 -mt-1 mb-3",children:"Si marcas Justificada, abajo se abrira la comprobacion en verde."}),c&&e.jsxs("div",{className:"bg-white p-3 rounded-xl border border-gray-100 space-y-3 animate-in fade-in",children:[e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("p",{className:"text-gray-500 text-[9px] font-black uppercase tracking-widest",children:"Actitud"}),e.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(u=>e.jsx("button",{type:"button",onClick:()=>ja({...Je,[a]:u}),className:`text-xl transition-transform active:scale-75 ${(Je[a]||0)>=u?"text-yellow-400 drop-shadow-sm":"text-gray-200 grayscale opacity-50 hover:text-yellow-200"}`,children:"â"},`att-${a}-${u}`))})]}),e.jsxs("div",{className:"flex justify-between items-center",children:[e.jsx("p",{className:"text-gray-500 text-[9px] font-black uppercase tracking-widest",children:"Entiende"}),e.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(u=>e.jsx("button",{type:"button",onClick:()=>va({...We,[a]:u}),className:`text-xl transition-transform active:scale-75 ${(We[a]||0)>=u?"text-yellow-400 drop-shadow-sm":"text-gray-200 grayscale opacity-50 hover:text-yellow-200"}`,children:"â"},`und-${a}-${u}`))})]}),e.jsxs("div",{className:"mt-3 border-t border-gray-200/50 pt-3",children:[e.jsx("p",{className:"text-gray-500 text-[9px] font-black uppercase tracking-widest mb-1",children:"Notas de la sesión"}),e.jsx("textarea",{value:Qe[a]||"",onChange:u=>wa({...Qe,[a]:u.target.value}),placeholder:`¿Cómo le ha ido la clase a ${a.split(" ")[0]}?`,className:"w-full bg-gray-50 text-gray-900 p-3 rounded-xl border border-gray-200 text-xs outline-none focus:border-[#1c74e9] resize-none placeholder-gray-400",rows:2})]})]}),s==="falta_justificada"&&e.jsxs("div",{ref:u=>{nt.current[a]=u},className:"bg-green-50 p-3 rounded-xl border border-green-200 space-y-3 animate-in fade-in",children:[e.jsx("p",{className:"text-green-700 text-[9px] font-black uppercase tracking-widest",children:"Justificante mostrado"}),e.jsx("p",{className:"text-[11px] text-green-800 leading-5",children:"Solo deja constancia de como se ha comprobado. No subas ni guardes el documento."}),e.jsxs("div",{className:"grid grid-cols-1 gap-2",children:[e.jsx("button",{type:"button",onClick:()=>ne({...J,[a]:"shown_in_person"}),className:`p-2 rounded-xl border text-[10px] font-black uppercase tracking-widest transition-colors ${J[a]==="shown_in_person"?"bg-green-600 text-white border-green-700 shadow-md":"bg-white text-gray-600 border-green-200 hover:border-green-400"}`,children:"En mano"}),e.jsx("button",{type:"button",onClick:()=>ne({...J,[a]:"shown_by_family"}),className:`p-2 rounded-xl border text-[10px] font-black uppercase tracking-widest transition-colors ${J[a]==="shown_by_family"?"bg-green-600 text-white border-green-700 shadow-md":"bg-white text-gray-600 border-green-200 hover:border-green-400"}`,children:"Mostrado por familia"}),e.jsx("button",{type:"button",onClick:()=>ne({...J,[a]:"confirmed_by_coordination"}),className:`p-2 rounded-xl border text-[10px] font-black uppercase tracking-widest transition-colors ${J[a]==="confirmed_by_coordination"?"bg-green-600 text-white border-green-700 shadow-md":"bg-white text-gray-600 border-green-200 hover:border-green-400"}`,children:"Confirmado por coordinacion"})]})]}),e.jsxs("div",{className:"mt-4 bg-indigo-50/70 border border-indigo-100 rounded-2xl p-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-indigo-600 text-[9px] font-black uppercase tracking-widest",children:"Seguimiento académico"}),e.jsx("p",{className:"text-[11px] text-indigo-900 font-bold mt-2 leading-5",children:"Si el alumno os comenta un examen o una nota nueva, puedes dejarlo aquà mismo."})]}),e.jsx("button",{type:"button",onClick:()=>ys(a),className:"shrink-0 px-3 py-2 rounded-xl bg-white text-indigo-700 border border-indigo-100 text-[10px] font-black uppercase tracking-widest",children:Ee?"Cerrar":"+ Seguimiento"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 mt-3",children:[e.jsxs("div",{className:"bg-white rounded-xl border border-indigo-100 px-3 py-2",children:[e.jsx("p",{className:"text-[8px] text-indigo-500 font-black uppercase tracking-widest",children:"Exámenes"}),e.jsx("p",{className:"text-sm font-black text-gray-900 mt-1",children:j.length})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-indigo-100 px-3 py-2",children:[e.jsx("p",{className:"text-[8px] text-emerald-600 font-black uppercase tracking-widest",children:"Notas"}),e.jsx("p",{className:"text-sm font-black text-gray-900 mt-1",children:T.length})]})]}),Ee&&e.jsxs("div",{className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"bg-white rounded-2xl border border-indigo-100 p-3 space-y-3",children:[e.jsx("p",{className:"text-[9px] text-indigo-600 font-black uppercase tracking-widest",children:"Registrar próximo examen"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx("input",{value:se.subject,onChange:u=>ge(q=>
99({...q,subject:u.target.value})),className:"w-full bg-gray-50 border border-gray-200 rounded-xl px-3 py-3 text-sm font-bold text-gray-900 outline-none",placeholder:"Asignatura"}),e.jsx("input",{type:"date",value:se.exam_date,onChange:u=>ge(q=>({...q,exam_date:u.target.value})),className:"w-full bg-gray-50 border border-gray-200 rounded-xl px-3 py-3 text-sm font-bold text-gray-900 outline-none"})]}),e.jsx("input",{value:se.unit,onChange:u=>ge(q=>({...q,unit:u.target.value})),className:"w-full bg-gray-50 border border-gray-200 rounded-xl px-3 py-3 text-sm font-bold text-gray-900 outline-none",placeholder:"Tema o unidad"}),e.jsx("textarea",{value:se.notes,onChange:u=>ge(q=>({...q,notes:u.target.value})),rows:2,className:"w-full bg-gray-50 border border-gray-200 rounded-xl px-3 py-3 text-sm font-bold text-gray-900 outline-none resize-none",placeholder:"Comentario opcional"}),e.jsx("button",{type:"button",onClick:()=>js(a),disabled:Ke,className:"w-full py-3 rounded-xl bg-indigo-600 text-white text-[10px] font-black uppercase tracking-widest shadow-lg shadow-indigo-500/20 disabled:opacity-60",children:Ke?"Guardando...":"Guardar examen"})]}),e.jsxs("div",{className:"bg-white rounded-2xl border border-emerald-100 p-3 space-y-3",children:[e.jsx("p",{className:"text-[9px] text-emerald-700 font-black uppercase tracking-widest",children:"Registrar nota trimestral"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx("select",{value:W.term,onChange:u=>he(q=>({...q,term:u.target.value})),className:"w-full bg-gray-50 border border-gray-200 rounded-xl px-3 py-3 text-sm font-bold text-gray-900 outline-none",children:gr.map(u=>e.jsx("option",{value:u,children:u},u))}),e.jsx("input",{value:W.grade,onChange:u=>he(q=>({...q,grade:u.target.value})),className:"w-full bg-gray-50 border border-gray-200 rounded-xl px-3 py-3 text-sm font-bold text-gray-900 outline-none",placeholder:"Nota"})]}),e.jsx("input",{value:W.subject,onChange:u=>he(q=>({...q,subject:u.target.value})),className:"w-full bg-gray-50 border border-gray-200 rounded-xl px-3 py-3 text-sm font-bold text-gray-900 outline-none",placeholder:"Asignatura"}),e.jsx("textarea",{value:W.notes,onChange:u=>he(q=>({...q,notes:u.target.value})),rows:2,className:"w-full bg-gray-50 border border-gray-200 rounded-xl px-3 py-3 text-sm font-bold text-gray-900 outline-none resize-none",placeholder:"Comentario opcional"}),e.jsx("button",{type:"button",onClick:()=>vs(a),disabled:Ke,className:"w-full py-3 rounded-xl bg-emerald-500 text-white text-[10px] font-black uppercase tracking-widest shadow-lg shadow-emerald-500/20 disabled:opacity-60",children:Ke?"Guardando...":"Guardar nota"})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[e.jsxs("div",{className:"bg-white rounded-2xl border border-indigo-100 p-3",children:[e.jsx("p",{className:"text-[9px] text-indigo-600 font-black uppercase tracking-widest mb-2",children:"Exámenes cargados"}),e.jsx("div",{className:"space-y-2",children:j.length===0?e.jsx("p",{className:"text-[11px] text-gray-500 font-bold",children:"TodavÃa no hay exámenes apuntados."}):j.map(u=>e.jsxs("div",{className:`rounded-xl border px-3 py-2 ${z.has(u.id)?"bg-amber-50 border-amber-200":"bg-indigo-50/60 border-indigo-100"}`,children:[e.jsx("p",{className:"text-sm font-black text-gray-900",children:u.subject}),e.jsxs("p",{className:`text-[10px] font-black uppercase tracking-widest mt-1 ${z.has(u.id)?"text-amber-700":"text-indigo-700"}`,children:[za(u.exam_date)," · ",Gt(u.source)]})]},u.id))})]}),e.jsxs("div",{className:"bg-white rounded-2xl border border-emerald-100 p-3",children:[e.jsx("p",{className:"text-[9px] text-emerald-700 font-black uppercase tracking-widest mb-2",children:"Notas registradas"}),e.jsx("div",{className:"space-y-2",children:T.length===0?e.jsx("p",{className:"text-[11px] text-gray-500 font-bold",children:"TodavÃa no hay notas apuntadas."}):T.map(u=>e.jsxs("div",{className:"bg-emerald-50/60 rounded-xl border border-emerald-100 px-3 py-2",children:[e.jsx("p",{className:"text-sm font-black text-gray-900",children:u.subject}),e.jsxs("p",{className:"text-[10px] text-emerald-700 font-black uppercase tracking-widest mt-1",children:[u.term," · Nota ",u.grade," · ",Gt(u.source)]})]},u.id))})]})]})]})]})]},a)}),Object.values(F).includes("falta_justificada")&&e.jsxs("div",{className:"mt-4 p-4 bg-green-50 rounded-xl border border-green-200 animate-in fade-in slide-in-from-top-2",children:[e.jsx("label",{className:"text-green-700 text-[10px] font-black uppercase tracking-widest block mb-2",children:"Justificacion revisada"}),e.jsx("p",{className:"text-[11px] text-green-800 leading-5",children:"No hace falta subir el documento. Solo marca en cada alumno si el justificante se ha mostrado en mano, por familia o por coordinacion."})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-500 text-[10px] font-black uppercase tracking-widest mb-3 border-b border-gray-100 pb-2",children:"2. Observaciones Generales (Opcional)"}),e.jsx("textarea",{value:Na,onChange:a=>ka(a.target.value),className:"w-full bg-gray-50 text-gray-900 p-4 rounded-2xl border border-gray-200 outline-none text-sm min-h-[80px] focus:border-[#1c74e9] transition-colors",placeholder:"Si necesitas comentar algo sobre el grupo en general, un examen o el motivo de alguna falta..."})]}),te&&e.jsx("p",{className:"text-[#1c74e9] text-xs font-black text-center animate-pulse bg-blue-50 py-2 rounded-lg",children:te}),e.jsx("div",{className:"sm:hidden mt-2 pt-2 pb-20",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx("button",{type:"button",onClick:Ea,disabled:te!=="",className:"flex-1 py-4 text-gray-500 font-black text-[10px] uppercase tracking-widest rounded-xl bg-gray-100 disabled:opacity-60",children:"Cancelar"}),e.jsx("button",{type:"submit",form:"fichajeForm",disabled:te!==""||!ra,className:`flex-[2] py-4 font-black rounded-xl shadow-lg uppercase text-[10px] tracking-widest transition-all ${!ra||te!==""?"bg-gray-300 text-gray-500 shadow-none cursor-not-allowed":"bg-green-500 text-white shadow-green-500/30 active:scale-95"}`,children:te!==""?"Guardando...":"Guardar Evaluación â
"})]})})]})}),e.jsxs("div",{className:"hidden sm:flex p-4 border-t border-gray-100 bg-gray-50 shrink-0 gap-3",style:{paddingBottom:"calc(env(safe-area-inset-bottom, 0px) + 1rem)"},children:[e.jsx("button",{type:"button",onClick:Ea,disabled:te!=="",className:"flex-1 py-4 text-gray-500 font-black text-[10px] uppercase tracking-widest hover:text-gray-900 transition-colors",children:"Cancelar"}),e.jsx("button",{type:"submit",form:"fichajeForm",disabled:te!==""||!ra,className:`flex-[2] py-4 font-black rounded-xl shadow-lg uppercase text-[10px] tracking-widest transition-all ${!ra||te!==""?"bg-gray-300 text-gray-500 shadow-none cursor-not-allowed":"bg-green-500 text-white shadow-green-500/30 active:scale-95 hover:bg-green-600"}`,children:te!==""?"Guardando...":"Guardar Evaluación â
"})]})]})})})]})]})};export{pn as MonitorDashboard};
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.