PageSourceSearch

https://school-crm-telegram-production.up.railway.app/static/js/5728.d8aed291.chunk.js

js school-crm-telegram-production.up.railway.app collected 2026-10-03 12:13:50 UTC 40,874 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunkschool_crm_desktop=self.webpackChunkschool_crm_desktop||[]).push([[5728],{5728(e,r,t){t.r(r),t.d(r,{default:()=>b});var o=t(9379),n=t(5043),i=t(3216),a=t(3862),s=t(579);function l(e){var r,t,o,n,i,a,l,d;let{teacher:c,theme:m,onEdit:g,onDelete:u,onUnlink:f,onSetLogin:h,onSchedule:p,onAchievements:b,onToggleAssistant:x,onCardClick:y}=e;const v="light"===m,j=null!==(r=null===(t=c.user)||void 0===t?void 0:t.isActive)&&void 0!==r&&r,S=null===(o=c.user.email)||void 0===o?void 0:o.includes("@placeholder.local");return(0,s.jsxs)("div",{onClick:y,style:{background:v?"white":"rgba(255, 255, 255, 0.08)",borderRadius:"14px",padding:"1.25rem",border:"2px solid ".concat(v?"#e5e7eb":"rgba(255, 255, 255, 0.12)"),boxShadow:v?"0 2px 8px rgba(0, 0, 0, 0.04)":"0 4px 16px rgba(0, 0, 0, 0.2)",transition:"all 0.3s",position:"relative",cursor:"pointer"},onMouseEnter:e=>{e.currentTarget.style.transform="translateY(-4px)",e.currentTarget.style.boxShadow=v?"0 8px 16px rgba(0, 0, 0, 0.08)":"0 8px 24px rgba(0, 0, 0, 0.3)",e.currentTarget.style.borderColor=v?"#10b981":"#818cf8"},onMouseLeave:e=>{e.currentTarget.style.transform="translateY(0)",e.currentTarget.style.boxShadow=v?"0 2px 8px rgba(0, 0, 0, 0.04)":"0 4px 16px rgba(0, 0, 0, 0.2)",e.currentTarget.style.borderColor=v?"#e5e7eb":"rgba(255, 255, 255, 0.12)"},children:[c.isGuestTeacher&&(0,s.jsx)("div",{style:{position:"absolute",top:"0.75rem",left:"0.75rem",backgroundColor:"#e0e7ff",color:"#6366f1",padding:"0.15rem 0.5rem",borderRadius:"6px",fontSize:"0.65rem",fontWeight:"700"},children:"\ud83d\udd17 LINKED"}),(0,s.jsx)("div",{style:{position:"absolute",top:"1rem",right:"1rem",padding:"0.375rem 0.75rem",background:j?v?"#d1fae5":"rgba(16, 185, 129, 0.2)":v?"#fee2e2":"rgba(239, 68, 68, 0.2)",color:j?v?"#10b981":"#34d399":v?"#ef4444":"#f87171",borderRadius:"8px",fontSize:"0.7rem",fontWeight:"700",textTransform:"uppercase"},children:j?"\u25cf Active":"\u25cf Inactive"}),(0,s.jsxs)("div",{style:{width:"56px",height:"56px",borderRadius:"14px",background:v?"linear-gradient(135deg, #10b981, #34d399)":"linear-gradient(135deg, #667eea, #764ba2)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",fontSize:"1.5rem",fontWeight:"700",marginBottom:"1rem"},children:[c.user.firstName[0],c.user.lastName[0]]}),(0,s.jsxs)("h3",{style:{fontSize:"1.1rem",fontWeight:"700",color:v?"#1f2937":"#f1f5f9",marginBottom:"0.375rem"},children:[c.user.firstName," ",c.user.lastName]}),(0,s.jsxs)("p",{style:{fontSize:"0.8rem",color:S?"#f59e0b":v?"#6b7280":"#94a3b8",marginBottom:"0.5rem",display:"flex",alignItems:"center",gap:"0.375rem"},children:["\ud83d\udce7 ",S?"\u26a0\ufe0f No login set":c.user.email]}),c.phone&&(0,s.jsxs)("p",{style:{fontSize:"0.8rem",color:v?"#6b7280":"#94a3b8",marginBottom:"0.75rem",display:"flex",alignItems:"center",gap:"0.375rem"},children:["\ud83d\udcf1 ",c.phone]}),(null===(n=c.specialization)||void 0===n?void 0:n.length)>0&&(0,s.jsxs)("div",{style:{padding:"0.5rem 0.875rem",background:v?"#f9fafb":"rgba(255, 255, 255, 0.05)",borderRadius:"8px",fontSize:"0.8rem",color:v?"#10b981":"#34d399",fontWeight:"600",marginBottom:"0.75rem",display:"inline-block"},children:["\ud83c\udfaf ",Array.isArray(c.specialization)?c.specialization.join(", "):c.specialization]}),(0,s.jsx)("div",{style:{display:"flex",gap:"0.75rem",marginBottom:"1rem",paddingTop:"0.75rem",borderTop:"1px solid ".concat(v?"#e5e7eb":"rgba(255, 255, 255, 0.08)")},children:(0,s.jsxs)("div",{style:{flex:1,textAlign:"center",padding:"0.625rem",background:v?"#f9fafb":"rgba(255, 255, 255, 0.05)",borderRadius:"8px"},children:[(0,s.jsx)("div",{style:{fontSize:"1.25rem",fontWeight:"700",color:v?"#10b981":"#34d399"},children:null!==(i=null!==(a=null===(l=c._count)||void 0===l?void 0:l.groups)&&void 0!==a?a:null===(d=c._count)||void 0===d?void 0:d.teachingGroups)&&void 0!==i?i:0}),(0,s.jsx)("div",{style:{fontSize:"0.7rem",color:v?"#6b7280":"#94a3b8",textTransform:"uppercase",fontWeight:"600",marginTop:"0.25rem"},children:"Groups"})]})}),(0,s.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"0.4rem",marginBottom:"0.5rem",background:v?"#f0fdf4":"rgba(16,185,129,0.08)",borderRadius:"8px",fontSize:"0.72rem",color:v?"#059669":"#34d399",fontWeight:"600",letterSpacing:"0.02em"},children:"\ud83d\udc46 Click card to view full profile"}),(0,s.jsxs)("div",{style:{display:"flex",gap:"0.625rem",flexWrap:"wrap"},children:[f&&(0,s.jsx)("button",{onClick:e=>{e.stopPropagation(),f()},style:{width:"100%",padding:"0.5rem",background:"#ede9fe",color:"#7c3aed",border:"none",borderRadius:"8px",cursor:"pointer",fontWeight:"600",fontSize:"0.75rem",marginBottom:"0.25rem"},children:"\ud83d\udd17 Unlink from this school"}),(0,s.jsxs)("button",{onClick:e=>{e.stopPropagation(),h()},style:{width:"100%",padding:"0.5rem",background:S?"#fef3c7":v?"#f0fdf4":"rgba(16,185,129,0.1)",color:S?"#b45309":v?"#059669":"#34d399",border:"1px solid ".concat(S?"#fcd34d":v?"#bbf7d0":"rgba(52,211,153,0.3)"),borderRadius:"8px",cursor:"pointer",fontWeight:"600",fontSize:"0.75rem",marginBottom:"0.25rem"},children:["\ud83d\udd11 ",S?"Set Login Credentials":"Change Login / Password"]}),(0,s.jsx)("button",{onClick:e=>{e.stopPropagation(),b()},style:{flex:1,padding:"0.625rem",background:v?"#fef9c3":"rgba(234,179,8,0.15)",color:v?"#a16207":"#fbbf24",border:"none",borderRadius:"8px",cursor:"pointer",fontWeight:"600",fontSize:"0.8rem",transition:"all 0.3s"},onMouseEnter:e=>{e.currentTarget.style.background=v?"#fef08a":"rgba(234,179,8,0.25)"},onMouseLeave:e=>{e.currentTarget.style.background=v?"#fef9c3":"rgba(234,179,8,0.15)"},children:"\ud83c\udfc6 Achievements"}),(0,s.jsx)("button",{onClick:e=>{e.stopPropagation(),p()},style:{flex:1,padding:"0.625rem",background:v?"#eff6ff":"rgba(59,130,246,0.15)",color:v?"#2563eb":"#60a5fa",border:"none",borderRadius:"8px",cursor:"pointer",fontWeight:"600",fontSize:"0.8rem",transition:"all 0.3s"},onMouseEnter:e=>{e.currentTarget.style.background=v?"#dbeafe":"rgba(59,130,246,0.25)"},onMouseLeave:e=>{e.currentTarget.style.background=v?"#eff6ff":"rgba(59,130,246,0.15)"},children:"\ud83d\uddd3\ufe0f Schedule"}),(0,s.jsx)("button",{onClick:e=>{e.stopPropagation(),x()},title:c.isAssistant?"Remove assistant role":"Make assistant",style:{flex:1,padding:"0.625rem",background:c.isAssistant?v?"#fef3c7":"rgba(245,158,11,0.2)":v?"#eff6ff":"rgba(59,130,246,0.15)",color:c.isAssistant?v?"#92400e":"#fbbf24":v?"#1d4ed8":"#60a5fa",border:"none",borderRadius:"8px",cursor:"pointer",fontWeight:"600",fontSize:"0.8rem",transition:"all 0.3s"}
1,children:c.isAssistant?"\ud83d\udc64 Unset TA":"\ud83c\udf93 Set TA"}),(0,s.jsx)("button",{onClick:e=>{e.stopPropagation(),g()},style:{flex:1,padding:"0.625rem",background:v?"#d1fae5":"rgba(16, 185, 129, 0.15)",color:v?"#10b981":"#34d399",border:"none",borderRadius:"8px",cursor:"pointer",fontWeight:"600",fontSize:"0.8rem",transition:"all 0.3s"},onMouseEnter:e=>{e.currentTarget.style.background=v?"#a7f3d0":"rgba(16, 185, 129, 0.25)"},onMouseLeave:e=>{e.currentTarget.style.background=v?"#d1fae5":"rgba(16, 185, 129, 0.15)"},children:"\u270f\ufe0f Edit"}),(0,s.jsx)("button",{onClick:e=>{e.stopPropagation(),u()},style:{flex:1,padding:"0.625rem",background:v?"#fee2e2":"rgba(239, 68, 68, 0.15)",color:v?"#ef4444":"#f87171",border:"none",borderRadius:"8px",cursor:"pointer",fontWeight:"600",fontSize:"0.8rem",transition:"all 0.3s"},onMouseEnter:e=>{e.currentTarget.style.background=v?"#fecaca":"rgba(239, 68, 68, 0.25)"},onMouseLeave:e=>{e.currentTarget.style.background=v?"#fee2e2":"rgba(239, 68, 68, 0.15)"},children:"\ud83d\uddd1\ufe0f Delete"})]})]})}function d(e){let{theme:r,teacher:t,onClose:i,onSubmit:a}=e;const l="light"===r,[d,c]=(0,n.useState)({firstName:(null===t||void 0===t?void 0:t.user.firstName)||"",lastName:(null===t||void 0===t?void 0:t.user.lastName)||"",middleName:(null===t||void 0===t?void 0:t.user.middleName)||"",email:(null===t||void 0===t?void 0:t.user.email)||"",phoneNumber:(null===t||void 0===t?void 0:t.phone)||"",dateOfBirth:null!==t&&void 0!==t&&t.dateOfBirth?t.dateOfBirth.slice(0,10):"",specialization:(Array.isArray(null===t||void 0===t?void 0:t.specialization)?t.specialization.join(", "):null===t||void 0===t?void 0:t.specialization)||"",status:(null===t||void 0===t?void 0:t.status)||"ACTIVE",password:""});return(0,s.jsx)("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3,padding:"1rem"},children:(0,s.jsxs)("div",{onClick:e=>e.stopPropagation(),style:{background:l?"white":"#1e293b",borderRadius:"16px",padding:"2rem",maxWidth:"500px",width:"100%",maxHeight:"90vh",overflowY:"auto"},children:[(0,s.jsx)("h2",{style:{fontSize:"1.5rem",fontWeight:"700",color:l?"#1f2937":"#f1f5f9",marginBottom:"1.5rem"},children:t?"\u270f\ufe0f Edit Teacher":"\u2795 Add Teacher"}),(0,s.jsxs)("form",{onSubmit:e=>{e.preventDefault();const r=(0,o.A)({},d);t&&!r.password&&delete r.password,"string"===typeof r.specialization&&(r.specialization=r.specialization.split(",").map(e=>e.trim()).filter(Boolean)),a(r)},children:[(0,s.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:"1rem",marginBottom:"1rem"},children:[(0,s.jsx)(f,{label:"First Name",value:d.firstName,onChange:e=>c((0,o.A)((0,o.A)({},d),{},{firstName:e})),theme:r,required:!0}),(0,s.jsx)(f,{label:"Last Name",value:d.lastName,onChange:e=>c((0,o.A)((0,o.A)({},d),{},{lastName:e})),theme:r,required:!0})]}),(0,s.jsx)(f,{label:"Middle Name",value:d.middleName,onChange:e=>c((0,o.A)((0,o.A)({},d),{},{middleName:e})),theme:r}),(0,s.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:"1rem",marginBottom:"1rem"},children:[(0,s.jsx)(f,{label:"Phone",value:d.phoneNumber,onChange:e=>c((0,o.A)((0,o.A)({},d),{},{phoneNumber:e})),theme:r}),(0,s.jsx)(f,{label:"Date of Birth",type:"date",value:d.dateOfBirth,onChange:e=>c((0,o.A)((0,o.A)({},d),{},{dateOfBirth:e})),theme:r})]}),(0,s.jsx)(f,{label:"Email",type:"email",value:d.email,onChange:e=>c((0,o.A)((0,o.A)({},d),{},{email:e})),theme:r,disabled:!!t}),(0,s.jsx)(f,{label:"Specialization",value:d.specialization,onChange:e=>c((0,o.A)((0,o.A)({},d),{},{specialization:e})),theme:r}),!t&&(0,s.jsx)(f,{label:"Password",type:"password",value:d.password,onChange:e=>c((0,o.A)((0,o.A)({},d),{},{password:e})),theme:r,required:!0}),(0,s.jsxs)("div",{style:{marginBottom:"1.5rem"},children:[(0,s.jsx)("label",{style:{display:"block",fontSize:"0.875rem",fontWeight:"600",color:l?"#374151":"#cbd5e1",marginBottom:"0.5rem"},children:"Status"}),(0,s.jsxs)("select",{value:d.status,onChange:e=>c((0,o.A)((0,o.A)({},d),{},{status:e.target.value})),style:{width:"100%",padding:"0.75rem",background:l?"#f9fafb":"rgba(255, 255, 255, 0.05)",border:"2px s
1olid ".concat(l?"#e5e7eb":"rgba(255, 255, 255, 0.1)"),borderRadius:"10px",color:l?"#1f2937":"#f1f5f9",fontSize:"0.875rem",outline:"none"},children:[(0,s.jsx)("option",{value:"ACTIVE",children:"Active"}),(0,s.jsx)("option",{value:"INACTIVE",children:"Inactive"})]})]}),(0,s.jsxs)("div",{style:{display:"flex",gap:"0.75rem"},children:[(0,s.jsx)("button",{type:"button",onClick:i,style:{flex:1,padding:"0.875rem",background:l?"#f3f4f6":"rgba(255, 255, 255, 0.05)",color:l?"#6b7280":"#94a3b8",border:"none",borderRadius:"10px",cursor:"pointer",fontWeight:"600",fontSize:"0.875rem"},children:"Cancel"}),(0,s.jsxs)("button",{type:"submit",style:{flex:1,padding:"0.875rem",background:l?"linear-gradient(135deg, #10b981, #34d399)":"linear-gradient(135deg, #667eea, #764ba2)",color:"white",border:"none",borderRadius:"10px",cursor:"pointer",fontWeight:"600",fontSize:"0.875rem"},children:[t?"Update":"Add"," Teacher"]})]})]})]})})}const c=["","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],m=["","#3b82f6","#8b5cf6","#10b981","#f59e0b","#ef4444","#06b6d4","#f97316"];function g(e){let{theme:r,teacher:t,onClose:o}=e;const i="light"===r,[l,d]=(0,n.useState)([]),[g,u]=(0,n.useState)(!0);return(0,n.useEffect)(()=>{(0,a.n)("/teachers/".concat(t.user.id,"/schedule")).then(e=>e.json()).then(e=>{e.success&&d(e.data)}).catch(()=>{}).finally(()=>u(!1))},[t.user.id]),(0,s.jsx)("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.6)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1100,padding:"1rem"},children:(0,s.jsxs)("div",{onClick:e=>e.stopPropagation(),style:{background:i?"white":"#1e293b",borderRadius:"16px",padding:"2rem",maxWidth:"600px",width:"100%",maxHeight:"85vh",overflowY:"auto"},children:[(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"1.5rem"},children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{style:{fontSize:"1.3rem",fontWeight:"700",color:i?"#1f2937":"#f1f5f9",marginBottom:"0.25rem"},children:"\ud83d\uddd3\ufe0f Schedule"}),(0,s.jsxs)("p",{style:{fontSize:"0.85rem",color:i?"#6b7280":"#94a3b8"},children:[t.user.firstName," ",t.user.lastName," \u2022 ",l.length," group",1!==l.length?"s":""]})]}),(0,s.jsx)("button",{onClick:o,style:{background:"none",border:"none",fontSize:"1.4rem",cursor:"pointer",color:i?"#6b7280":"#94a3b8",lineHeight:1},children:"\u2716"})]}),g?(0,s.jsx)("div",{style:{textAlign:"center",padding:"2rem",color:i?"#6b7280":"#94a3b8"},children:"Loading..."}):0===l.length?(0,s.jsxs)("div",{style:{textAlign:"center",padding:"2.5rem",color:i?"#6b7280":"#94a3b8"},children:[(0,s.jsx)("div",{style:{fontSize:"2.5rem",marginBottom:"0.75rem"},children:"\ud83d\udced"}),(0,s.jsx)("div",{children:"No groups assigned to this teacher."})]}):(0,s.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"0.875rem"},children:l.map((e,r)=>{var t,o;const n=m[r%7+1],a=(e.daysOfWeek||[]).sort((e,r)=>e-r);return(0,s.jsxs)("div",{style:{border:"2px solid ".concat(n,"22"),borderLeft:"4px solid ".concat(n),borderRadius:"10px",padding:"1rem 1.25rem",background:"".concat(n,i?"08":"12")},children:[(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"0.5rem"},children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{style:{fontWeight:"700",fontSize:"1rem",color:i?"#1f2937":"#f1f5f9"},children:e.name}),e.groupCode&&(0,s.jsxs)("span",{style:{marginLeft:"0.5rem",fontSize:"0.75rem",color:i?"#6b7280":"#94a3b8"},children:["#",e.groupCode]}),e.level&&(0,s.jsx)("span",{style:{marginLeft:"0.5rem",fontSize:"0.72rem",background:"".concat(n,"22"),color:n,padding:"0.1rem 0.5rem",borderRadius:"4px",fontWeight:"600"},children:e.level})]}),(0,s.jsxs)("span",{style:{fontSize:"0.75rem",color:i?"#6b7280":"#94a3b8",whiteSpace:"nowrap"},children:["\ud83d\udc65 ",null!==(t=null===(o=e._count)||void 0===o?void 0:o.enrollments)&&void 0!==t?t:0," students"]})]}),(0,s.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:"0.5rem",alignItems:"center"},children:[a.length>0?a.map(e=>(0,s.jsx)("span",{style:{background:n,color:"white",padding:"0.2rem 0.6rem",borderRadius:"6px",fontSize:"0.72rem",fontWeight:"700"},children:c[e]||e},e)):(0,s.jsx)("span",{style:{fontSize:"0.8rem",color:i?"#9ca3af":"#64748b"},children:"No days set"}),e.startTime&&e.endTime&&(0,s.jsxs)("span",{style:{fontSize:"0.8rem",color:i?"#374151":"#cbd5e1",fontWeight:"600",marginLeft:"0.25rem"},children:["\ud83d\udd50 ",e.startTime," \u2013 ",e.endTime]}),e.room&&(0,s.jsxs)("span",{style:{fontSize:"0.8rem",color:i?"#6b7280":"#94a3b8"},children:["\ud83d\udccd ",e.room]})]})]},e.id)})}),(0,s.jsx)("div",{style:{marginTop:"1.5rem",textAlign:"right"},children:(0,s.jsx)("button",{onClick:o,style:{padding:"0.75rem 1.75rem",background:i?"#f3f4f6":"rgba(255,255,255,0.08)",color:i?"#374151":"#cbd5e1",border:"none",borderRadius:"10px",cursor:"pointer",fontWeight:"600",fontSize:"0.875rem"},children:"Close"})})]})})}function u(e){var r;let{theme:t,teacher:o,onClose:i,onSubmit:a}=e;const l="light"===t,d=null===(r=o.user.email)||void 0===r?void 0:r.includes("@placeholder.local"),[c,m]=(0,n.use
1State)(d?"":o.user.email),[g,u]=(0,n.useState)(""),[f,h]=(0,n.useState)(""),[p,b]=(0,n.useState)(""),x={width:"100%",padding:"0.75rem",background:l?"#f9fafb":"rgba(255,255,255,0.05)",border:"2px solid ".concat(l?"#e5e7eb":"rgba(255,255,255,0.1)"),borderRadius:"10px",color:l?"#1f2937":"#f1f5f9",fontSize:"0.875rem",outline:"none",marginBottom:"1rem",boxSizing:"border-box"};return(0,s.jsx)("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.6)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1100,padding:"1rem"},children:(0,s.jsxs)("div",{onClick:e=>e.stopPropagation(),style:{background:l?"white":"#1e293b",borderRadius:"16px",padding:"2rem",maxWidth:"420px",width:"100%"},children:[(0,s.jsx)("h2",{style:{fontSize:"1.3rem",fontWeight:"700",color:l?"#1f2937":"#f1f5f9",marginBottom:"0.5rem"},children:"\ud83d\udd11 Set Login Credentials"}),(0,s.jsxs)("p",{style:{fontSize:"0.85rem",color:l?"#6b7280":"#94a3b8",marginBottom:"1.25rem"},children:["for ",(0,s.jsxs)("strong",{children:[o.user.firstName," ",o.user.lastName]})]}),d&&(0,s.jsx)("div",{style:{background:"#fef3c7",border:"1px solid #fcd34d",borderRadius:"8px",padding:"0.75rem 1rem",fontSize:"0.8rem",color:"#92400e",marginBottom:"1rem"},children:"\u26a0\ufe0f This teacher has no login yet. Set an email and password so they can sign in."}),(0,s.jsxs)("form",{onSubmit:e=>{e.preventDefault(),b(""),g&&g!==f?b("Passwords do not match"):c||g?a(c||void 0,g||void 0):b("Enter an email or password to update")},children:[(0,s.jsx)("label",{style:{display:"block",fontSize:"0.85rem",fontWeight:"600",color:l?"#374151":"#cbd5e1",marginBottom:"0.375rem"},children:"Email (login)"}),(0,s.jsx)("input",{type:"email",value:c,onChange:e=>m(e.target.value),placeholder:"[email protected]",style:x}),(0,s.jsxs)("label",{style:{display:"block",fontSize:"0.85rem",fontWeight:"600",color:l?"#374151":"#cbd5e1",marginBottom:"0.375rem"},children:["New Password ",!d&&(0,s.jsx)("span",{style:{fontWeight:"400",color:"#9ca3af"},children:"(leave blank to keep current)"})]}),(0,s.jsx)("input",{type:"password",value:g,onChange:e=>u(e.target.value),placeholder:"Min 6 characters",style:x}),(0,s.jsx)("label",{style:{display:"block",fontSize:"0.85rem",fontWeight:"600",color:l?"#374151":"#cbd5e1",marginBottom:"0.375rem"},children:"Confirm Password"}),(0,s.jsx)("input",{type:"password",value:f,onChange:e=>h(e.target.value),placeholder:"Repeat password",style:x}),p&&(0,s.jsx)("p",{style:{color:"#ef4444",fontSize:"0.8rem",marginBottom:"0.75rem"},children:p}),(0,s.jsxs)("div",{style:{display:"flex",gap:"0.75rem"},children:[(0,s.jsx)("button",{type:"button",onClick:i,style:{flex:1,padding:"0.875rem",background:l?"#f3f4f6":"rgba(255,255,255,0.05)",color:l?"#6b7280":"#94a3b8",border:"none",borderRadius:"10px",cursor:"pointer",fontWeight:"600",fontSize:"0.875rem"},children:"Cancel"}),(0,s.jsx)("button",{type:"submit",style:{flex:1,padding:"0.875rem",background:"linear-gradient(135deg, #f59e0b, #d97706)",color:"white",border:"none",borderRadius:"10px",cursor:"pointer",fontWeight:"600",fontSize:"0.875rem"},children:"Save Credentials"})]})]})]})})}function f(e){let{label:r,value:t,onChange:o,theme:n,type:i="text",required:a=!1,disabled:l=!1}=e;const d="light"===n;return(0,s.jsxs)("div",{style:{marginBottom:"1rem"},children:[(0,s.jsxs)("label",{style:{display:"block",fontSize:"0.875rem",fontWeight:"600",color:d?"#374151":"#cbd5e1",marginBottom:"0.5rem"},children:[r," ",a&&(0,s.jsx)("span",{style:{color:"#ef4444"},children:"*"})]}),(0,s.jsx)("input",{type:i,value:t,onChange:e=>o(e.target.value),required:a,disabled:l,style:{width:"100%",padding:"0.75rem",background:d?"#f9fafb":"rgba(255, 255, 255, 0.05)",border:"2px solid ".concat(d?"#e5e7eb":"rgba(255, 255, 255, 0.1)"),borderRadius:"10px",color:d?"#1f2937":"#f1f5f9",fontSize:"0.875rem",outline:"none",opacity:l?.6:1,cursor:l?"not-allowed":"text"}})]})}const h={APPROVED:{bg:"#d1fae5",color:"#065f46"},PENDING:{bg:"#fef3c7",color:"#92400e"},REJECTED:{bg:"#fee2e2",color:"#991b1b"}};function p(e){let{theme:r,teacher:t,onClose:o}=e;
1const i="light"===r,[l,d]=(0,n.useState)([]),[c,m]=(0,n.useState)(!0);return(0,n.useEffect)(()=>{(0,a.n)("/teacher-certificates?teacherId=".concat(t.userId||t.user.id,"&limit=100")).then(e=>e.json()).then(e=>{var r;e.success&&d((null===(r=e.data)||void 0===r?void 0:r.certificates)||[])}).catch(()=>{}).finally(()=>m(!1))},[t]),(0,s.jsx)("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.6)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1100,padding:"1rem"},children:(0,s.jsxs)("div",{onClick:e=>e.stopPropagation(),style:{background:i?"white":"#1e293b",borderRadius:"16px",padding:"2rem",maxWidth:"640px",width:"100%",maxHeight:"85vh",overflowY:"auto"},children:[(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"1.5rem"},children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{style:{fontSize:"1.3rem",fontWeight:"700",color:i?"#1f2937":"#f1f5f9",marginBottom:"0.25rem"},children:"\ud83c\udfc6 Achievements & Certificates"}),(0,s.jsxs)("p",{style:{fontSize:"0.85rem",color:i?"#6b7280":"#94a3b8"},children:[t.user.firstName," ",t.user.lastName]})]}),(0,s.jsx)("button",{onClick:o,style:{background:"none",border:"none",fontSize:"1.4rem",cursor:"pointer",color:i?"#6b7280":"#94a3b8",lineHeight:1},children:"\u2716"})]}),c?(0,s.jsx)("div",{style:{textAlign:"center",padding:"2rem",color:i?"#6b7280":"#94a3b8"},children:"Loading..."}):0===l.length?(0,s.jsxs)("div",{style:{textAlign:"center",padding:"2.5rem",color:i?"#6b7280":"#94a3b8"},children:[(0,s.jsx)("div",{style:{fontSize:"2.5rem",marginBottom:"0.75rem"},children:"\ud83c\udfc5"}),(0,s.jsx)("div",{children:"No certificates recorded for this teacher."})]}):(0,s.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"0.875rem"},children:l.map(e=>{const r=h[e.status]||h.PENDING;return(0,s.jsxs)("div",{style:{border:"1px solid ".concat(i?"#e5e7eb":"rgba(255,255,255,0.12)"),borderLeft:"4px solid ".concat("APPROVED"===e.status?"#10b981":"REJECTED"===e.status?"#ef4444":"#f59e0b"),borderRadius:"10px",padding:"1rem 1.25rem",background:i?"#f9fafb":"rgba(255,255,255,0.04)"},children:[(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:"0.4rem"},children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{style:{fontWeight:"700",fontSize:"0.95rem",color:i?"#1f2937":"#f1f5f9"},children:e.name}),e.issuingBody&&(0,s.jsxs)("span",{style:{marginLeft:"0.5rem",fontSize:"0.8rem",color:i?"#6b7280":"#94a3b8"},children:["\xb7 ",e.issuingBody]})]}),(0,s.jsx)("span",{style:{fontSize:"0.72rem",fontWeight:"700",padding:"0.2rem 0.6rem",borderRadius:"6px",background:r.bg,color:r.color,whiteSpace:"nowrap",marginLeft:"0.5rem"},children:e.status})]}),(0,s.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:"0.5rem",fontSize:"0.8rem",color:i?"#6b7280":"#94a3b8"},children:[(0,s.jsx)("span",{style:{background:i?"#e0e7ff":"rgba(99,102,241,0.2)",color:i?"#4338ca":"#818cf8",padding:"0.15rem 0.5rem",borderRadius:"4px",fontWeight:"600"},children:e.type}),e.result&&(0,s.jsxs)("span",{children:["Result: ",(0,s.jsx)("strong",{children:e.result})]}),e.certificateNumber&&(0,s.jsxs)("span",{children:["#",e.certificateNumber]}),e.issueDate&&(0,s.jsxs)("span",{children:["Issued: ",new Date(e.issueDate).toLocaleDateString("en-GB")]}),e.expiryDate&&(0,s.jsxs)("span",{children:["Expires: ",new Date(e.expiryDate).toLocaleDateString("en-GB")]})]}),e.rejectionReason&&(0,s.jsxs)("div",{style:{marginTop:"0.5rem",padding:"0.4rem 0.75rem",background:"#fee2e2",borderRadius:"6px",fontSize:"0.78rem",color:"#991b1b"},children:["Rejection reason: ",e.rejectionReason]})]},e.id)})}),(0,s.jsx)("div",{style:{marginTop:"1.5rem",textAlign:"right"},children:(0,s.jsx)("button",{onClick:o,style:{padding:"0.75rem 1.75rem",background:i?"#f3f4f6":"rgba(255,255,255,0.08)",color:i?"#374151":"#cbd5e1",border:"none",borderRadius:"10px",cursor:"pointer",fontWeight:"600",fontSize:"0.875rem"},children:"Close"})})]})})}const b=function(){const e=(0,i.Zp)(),[r,t]=(0,n.useState)([]),[c,m]=(0,n.use
1State)(!0),[f,h]=(0,n.useState)(""),[b,x]=(0,n.useState)("all"),[y,v]=(0,n.useState)(!1),[j,S]=(0,n.useState)(!1),[k,C]=(0,n.useState)(null),[w,z]=(0,n.useState)(!1),[T,A]=(0,n.useState)(""),[W,R]=(0,n.useState)([]),[N,B]=(0,n.useState)(!1),[E,I]=(0,n.useState)(""),[L,D]=(0,n.useState)(!1),[P,M]=(0,n.useState)(null),[F,O]=(0,n.useState)(!1),[U,V]=(0,n.useState)(null),[G,J]=(0,n.useState)(!1),[Y,H]=(0,n.useState)(null),[_,q]=(0,n.useState)(localStorage.getItem("theme")||"light"),[K,Z]=(0,n.useState)(""),[Q,X]=(0,n.useState)(!1),[$,ee]=(0,n.useState)(""),[re,te]=(0,n.useState)(""),[oe,ne]=(0,n.useState)(!1);JSON.parse(localStorage.getItem("user")||"{}"),(0,n.useEffect)(()=>{ie()},[]);const ie=async()=>{m(!0),Z("");try{const e=await(0,a.n)("/teachers"),r=await e.json();r.success?t(r.data||[]):Z(r.message||"Failed to load teachers")}catch(e){Z("Failed to load teachers. Please refresh the page."),console.error("Failed to fetch teachers",e)}finally{m(!1)}},ae=async()=>{if(!(T.length<2)){B(!0),I("");try{var e;const r=await(0,a.n)("/teachers/search-global?q=".concat(encodeURIComponent(T))),t=await r.json();R(t.success?t.data:[]),0===(null===(e=t.data)||void 0===e?void 0:e.length)&&I("No teachers found in other schools.")}catch(r){I("Search failed.")}finally{B(!1)}}},se=r.filter(e=>{var r,t,o;const n=e.user.firstName.toLowerCase().includes(f.toLowerCase())||e.user.lastName.toLowerCase().includes(f.toLowerCase())||e.user.email.toLowerCase().includes(f.toLowerCase())||(null===(r=e.specialization)||void 0===r?void 0:r.length)>0&&(Array.isArray(e.specialization)?e.specialization.join(" "):String(e.specialization)).toLowerCase().includes(f.toLowerCase()),i=null!==(t=null===(o=e.user)||void 0===o?void 0:o.isActive)&&void 0!==t&&t;return n&&("all"===b||(i?"ACTIVE":"INACTIVE")===b)}),le="light"===_;return(0,s.jsxs)("div",{style:{minHeight:"100vh",background:le?"linear-gradient(135deg, #f8fffe 0%, #ecfdf5 100%)":"linear-gradient(135deg, #020617 0%, #0f172a 100%)",padding:"clamp(0.75rem, 3vw, 2rem)",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'},children:[(0,s.jsxs)("div",{style:{marginBottom:"2rem",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{style:{fontSize:"2rem",fontWeight:"700",color:le?"#1f2937":"#f1f5f9",marginBottom:"0.5rem"},children:"\ud83d\udc68\u200d\ud83c\udfeb Teachers Management"}),(0,s.jsx)("p",{style:{color:le?"#6b7280":"#94a3b8",fontSize:"1rem"},children:"Manage all teachers and their assignments"})]}),(0,s.jsxs)("div",{style:{display:"flex",gap:"1rem",alignItems:"center"},children:[(0,s.jsx)("button",{onClick:()=>e("/dashboard"),style:{padding:"0.75rem 1.25rem",background:le?"white":"rgba(255, 255, 255, 0.08)",color:le?"#6b7280":"#94a3b8",border:"2px solid ".concat(le?"#e5e7eb":"rgba(255, 255, 255, 0.12)"),borderRadius:"10px",cursor:"pointer",fontWeight:"600",fontSize:"0.875rem",transition:"all 0.3s"},children:"\u2190 Back"}),(0,s.jsx)("button",{onClick:()=>{z(!0),A(""),R([]),I("")},style:{padding:"0.75rem 1.25rem",background:le?"white":"rgba(255,255,255,0.08)",color:le?"#6366f1":"#818cf8",border:"2px solid ".concat(le?"#e0e7ff":"rgba(99,102,241,0.3)"),borderRadius:"10px",cursor:"pointer",fontWeight:"600",fontSize:"0.875rem"},children:"\ud83d\udd17 Link from Another School"}),(0,s.jsx)("button",{onClick:()=>v(!0),style:{padding:"0.75rem 1.5rem",background:le?"linear-gradient(135deg, #10b981, #34d399)":"linear-gradient(135deg, #667eea, #764ba2)",color:"white",border:"none",borderRadius:"10px",cursor:"pointer",fontWeight:"600",fontSize:"0.875rem",boxShadow:"0 4px 12px rgba(16, 185, 129, 0.3)",transition:"all 0.3s"},onMouseEnter:e=>{e.currentTarget.style.transform="translateY(-2px)",e.currentTarget.style.boxShadow="0 6px 16px rgba(16, 185, 129, 0.4)"},onMouseLeave:e=>{e.currentTarget.style.transform="translateY(0)",e.currentTarget.style.boxShadow="0 4px 12px rgba(16, 185, 129, 0.3)"},children:"\u2795 Add Teacher"}),(0,s.jsx)("button",{onClick:()=>X(!0),style:{padding:"0.75rem 1.5rem",background:"#f59e0b",color:"white",border:"none",borderRadius:"12px",cursor:"pointer",fontWeight:"600",fontSize:"0.875rem"},children:"\ud83d\udd00 Merge Accounts"})]})]}),(0,s.jsx)("div",{style:{background:le?"white":"rgba(255, 255, 255, 0.08)",padding:"1.5rem",borderRadius:"16px",marginBottom:"2rem",border:"1px solid ".concat(le?"#e5e7eb":"rgba(255, 255, 255, 0.12)"),boxShadow:le?"0 2px 8px rgba(0, 0, 0, 0.04)":"0 4px 16px rgba(0, 0, 0, 0.2)"},children:(0,s.jsxs)("div",{style:{display:"flex",gap:"1rem",alignItems:"center",flexWrap:"wrap"},children:[(0,s.jsx)("input",{type:"text",placeholder:"\ud83d\udd0d Search teachers...",value:f,onChange:e=>h(e.target.value),style:{flex:1,minWidth:"250px",padding:"0.75rem 1rem",background:le?"#f9fafb":"rgba(255, 255, 255, 0.05)",border:"2px s
1olid ".concat(le?"#e5e7eb":"rgba(255, 255, 255, 0.08)"),borderRadius:"10px",color:le?"#1f2937":"#f1f5f9",fontSize:"0.875rem",outline:"none",transition:"all 0.3s"},onFocus:e=>{e.currentTarget.style.borderColor=le?"#10b981":"#818cf8"},onBlur:e=>{e.currentTarget.style.borderColor=le?"#e5e7eb":"rgba(255, 255, 255, 0.08)"}}),(0,s.jsx)("div",{style:{display:"flex",gap:"0.5rem"},children:["all","ACTIVE","INACTIVE"].map(e=>(0,s.jsx)("button",{onClick:()=>x(e),style:{padding:"0.75rem 1.25rem",background:b===e?le?"linear-gradient(135deg, #10b981, #34d399)":"linear-gradient(135deg, #667eea, #764ba2)":le?"#f9fafb":"rgba(255, 255, 255, 0.05)",color:b===e?"white":le?"#6b7280":"#94a3b8",border:"none",borderRadius:"10px",cursor:"pointer",fontWeight:"600",fontSize:"0.75rem",textTransform:"capitalize",transition:"all 0.3s"},children:e},e))}),(0,s.jsxs)("div",{style:{padding:"0.75rem 1.25rem",background:le?"#d1fae5":"rgba(16, 185, 129, 0.15)",color:le?"#10b981":"#34d399",borderRadius:"10px",fontWeight:"700",fontSize:"0.875rem"},children:[se.length," Teachers"]})]})}),c?(0,s.jsx)("div",{style:{textAlign:"center",padding:"4rem",color:le?"#6b7280":"#94a3b8"},children:"Loading teachers..."}):K?(0,s.jsxs)("div",{style:{textAlign:"center",padding:"4rem",background:le?"#fff5f5":"rgba(239, 68, 68, 0.08)",borderRadius:"16px",border:"1px solid ".concat(le?"#fecaca":"rgba(239, 68, 68, 0.3)")},children:[(0,s.jsx)("div",{style:{fontSize:"3rem",marginBottom:"1rem"},children:"\u26a0\ufe0f"}),(0,s.jsx)("div",{style:{fontSize:"1.1rem",fontWeight:"600",color:le?"#dc2626":"#f87171",marginBottom:"0.5rem"},children:"Failed to load teachers"}),(0,s.jsx)("div",{style:{color:le?"#6b7280":"#94a3b8",marginBottom:"1rem"},children:K}),(0,s.jsx)("button",{onClick:ie,style:{padding:"0.6rem 1.25rem",background:"#ef4444",color:"white",border:"none",borderRadius:"8px",cursor:"pointer",fontWeight:"600"},children:"Retry"})]}):0===se.length?(0,s.jsxs)("div",{style:{textAlign:"center",padding:"4rem",background:le?"white":"rgba(255, 255, 255, 0.08)",borderRadius:"16px",border:"1px solid ".concat(le?"#e5e7eb":"rgba(255, 255, 255, 0.12)")},children:[(0,s.jsx)("div",{style:{fontSize:"3rem",marginBottom:"1rem"},children:"\ud83d\udc68\u200d\ud83c\udfeb"}),(0,s.jsx)("div",{style:{fontSize:"1.25rem",fontWeight:"600",color:le?"#1f2937":"#f1f5f9",marginBottom:"0.5rem"},children:0===r.length?"No teachers yet":"No teachers found"}),(0,s.jsx)("div",{style:{color:le?"#6b7280":"#94a3b8"},children:0===r.length?'Click "Add Teacher" to add your first teacher.':"Try adjusting your search or filters."})]}):(0,s.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(min(300px, 100%), 1fr))",gap:"1.25rem"},children:se.map(r=>(0,s.jsx)(l,{teacher:r,theme:_,onCardClick:()=>e("/teachers/".concat(r.id),{state:{teacher:r}}),onEdit:()=>{C(r),S(!0)},onDelete:()=>(async e=>{if(window.confirm("Are you sure you want to delete this teacher?"))try{(await(0,a.n)("/teachers/".concat(e),{method:"DELETE"})).ok&&ie()}catch(r){console.error("Failed to delete teacher")}})(r.id),onToggleAssistant:()=>(async e=>{const r=!e.isAssistant;try{const t=await(0,a.n)("/teachers/".concat(e.id),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isAssistant:r})});if(t.ok)ie();else{const e=await t.json();alert("Failed: "+(e.message||t.status))}}catch(t){alert("Error: "+t.message)}})(r),onUnlink:r.isGuestTeacher?()=>(async e=>{if(window.confirm("Unlink this teacher from your school?"))try{await(0,a.n)("/teachers/".concat(e,"/link-school"),{method:"DELETE"}),ie()}catch(r){}})(r.userId):null,onSetLogin:()=>{M(r),D(!0)},onSchedule:()=>{V(r),O(!0)},onAchievements:()=>{H(r),J(!0)}},r.id))}),w&&(0,s.jsx)("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},children:(0,s.jsxs)("div",{style:{backgroundColor:"white",borderRadius:"1rem",padding:"2rem",width:"90%",maxWidth:"520px",boxShadow:"0 20px 60px rgba(0,0,0,0.2)"},children:[(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"1.25rem"},children:[(0,s.jsx)("h2",{style:{fontSize:"1.2rem",fontWeight:"700"},children:"\ud83d\udd17 Link Teacher from Another School"}),(0,s.jsx)("button",{onClick:()=>z(!1),style:{background:"none",border:"none",fontSize:"1.5rem",cursor:"pointer",color:"#6b7280"},children:"\u2716"})]}),(0,s.jsx)("p",{style:{fontSize:"0.85rem",color:"#6b7280",marginBottom:"1rem"},children:"Search for a teacher registered at another school. Once linked, they'll appear in your teacher list and can be assigned to your groups."}),(0,s.jsxs)("div",{style:{display:"flex",gap:"0.5rem",marginBottom:"1rem"},children:[(0,s.jsx)("input",{type:"text",placeholder:"Search by name or email...",value:T,onChange:e=>A(e.target.value),onKeyDown:e=>"Enter"===e.key&&ae(),style:{flex:1,padding:"0.7rem 1rem",border:"1px solid #d1d5db",borderRadius:"0.5rem",fontSize:"0.875rem"}}),(0,s.jsx)("button",{onClick:ae,disabled:N,style:{padding:"0.7rem 1.25rem",backgroundColor:"#6366f1",color:"white",border:"none",borderRadius:"0.5rem",cursor:"pointer",fontWeight:"600",fontSize:"0.875rem"},children:N?"...":"Search"})]}),E&&(0,s.jsx)("p",{style:{fontSize:"0.8rem",color:"#6b7280",marginBottom:"0.75rem"},children:E}),(0,s.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem",maxHeight:"300px",overflowY:"auto"},children:W.map(e=>(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.75rem 1rem",backgroundColor:"#f9fafb",borderRadius:"0.5rem",border:"1px solid #e5e7eb"},children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{style:{fontWeight:"600",fontSize:"0.9rem"},children:[e.firstName," ",e.lastName]}),(0,s.jsx)("div",{style:{fontSize:"0.75rem",color:"#6b7280"},children:e.email}),(0,s.jsxs)("div",{style:{fontSize:"0.72rem",color:"#9ca3af"},children:["\ud83c\udfeb ",e.primarySchool]})]}),e.alreadyLinked?(0,s.jsx)("span",{style:{fontSize:"0.75rem",color:"#059669",fontWeight:"600"},children:"\u2713 Linked"}):(0,s.jsx)("button",{onClick:()=>(async e=>{try{const r=await(0,a.n)("/teachers/".concat(e,"/link-school"),{method:"POST"}),t=await r.json();r.ok?(R(r=>r.map(r=>r.userId===e?(0,o.A)((0,o.A)({},r),{},{alreadyLinked:!0}):r)),ie()):I(t.message||"Failed to link teacher")}catch(r){I("Error linking teacher")}})(e.userId),style:{padding:"0.4rem 0.9rem",backgroundColor:"#6366f1",color:"white",border:"none",borderRadius:"0.375rem",cursor:"pointer",fontSize:"0.8rem",fontWeight:"600"},children:"Link"})]}
1,e.userId))})]})}),y&&(0,s.jsx)(d,{theme:_,onClose:()=>v(!1),onSubmit:async e=>{try{const r=await(0,a.n)("/teachers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),t=await r.json();r.ok?(ie(),v(!1)):alert("Failed to add teacher: "+(t.message||r.status))}catch(r){alert("Failed to add teacher: "+r.message)}}}),j&&k&&(0,s.jsx)(d,{theme:_,teacher:k,onClose:()=>{S(!1),C(null)},onSubmit:e=>(async(e,r)=>{try{const t=await(0,a.n)("/teachers/".concat(e),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}),o=await t.json();t.ok?(ie(),S(!1)):alert("Failed to update teacher: "+(o.message||t.status))}catch(t){alert("Failed to update teacher: "+t.message)}})(k.id,e)}),F&&U&&(0,s.jsx)(g,{theme:_,teacher:U,onClose:()=>{O(!1),V(null)}}),G&&Y&&(0,s.jsx)(p,{theme:_,teacher:Y,onClose:()=>{J(!1),H(null)}}),L&&P&&(0,s.jsx)(u,{theme:_,teacher:P,onClose:()=>{D(!1),M(null)},onSubmit:(e,r)=>(async(e,r,t)=>{try{const o=await(0,a.n)("/teachers/".concat(e,"/credentials"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:r,password:t})}),n=await o.json();o.ok?(ie(),D(!1),M(null),alert("Login credentials updated successfully!")):alert("Failed: "+(n.message||o.status))}catch(o){alert("Error: "+o.message)}})(P.user.id,e,r)}),Q&&(0,s.jsx)("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:50,padding:"1rem"},children:(0,s.jsxs)("div",{style:{background:"white",borderRadius:"12px",width:"100%",maxWidth:"440px",padding:"1.5rem",boxShadow:"0 20px 60px rgba(0,0,0,0.2)"},children:[(0,s.jsx)("h3",{style:{margin:"0 0 0.5rem",fontWeight:"800",color:"#002147",fontSize:"1.1rem"},children:"\ud83d\udd00 Merge Teacher Accounts"}),(0,s.jsxs)("p",{style:{margin:"0 0 1.25rem",fontSize:"0.82rem",color:"#6b7280"},children:["All groups from the ",(0,s.jsx)("b",{children:"deleted"})," account move to the ",(0,s.jsx)("b",{children:"kept"})," account. The deleted account is permanently removed."]}),(0,s.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{style:{fontSize:"0.82rem",fontWeight:"700",display:"block",marginBottom:"0.3rem",color:"#16a34a"},children:"\u2705 KEEP this account"}),(0,s.jsxs)("select",{value:$,onChange:e=>ee(e.target.value),style:{width:"100%",border:"2px solid #16a34a",borderRadius:"8px",padding:"0.5rem 0.75rem",fontSize:"0.85rem"},children:[(0,s.jsx)("option",{value:"",children:"\u2014 Select teacher to keep \u2014"}),r.map(e=>{var r,t,o;return(0,s.jsxs)("option",{value:e.id,children:[null===(r=e.user)||void 0===r?void 0:r.firstName," ",null===(t=e.user)||void 0===t?void 0:t.lastName," \xb7 ",null===(o=e.user)||void 0===o?void 0:o.email]},e.id)})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{style:{fontSize:"0.82rem",fontWeight:"700",display:"block",marginBottom:"0.3rem",color:"#dc2626"},children:"\ud83d\uddd1\ufe0f DELETE this account"}),(0,s.jsxs)("select",{value:re,onChange:e=>te(e.target.value),style:{width:"100%",border:"2px solid #dc2626",borderRadius:"8px",padding:"0.5rem 0.75rem",fontSize:"0.85rem"},children:[(0,s.jsx)("option",{value:"",children:"\u2014 Select account to remove \u2014"}),r.filter(e=>e.id!==$).map(e=>{var r,t,o;return(0,s.jsxs)("option",{value:e.id,children:[null===(r=e.user)||void 0===r?void 0:r.firstName," ",null===(t=e.user)||void 0===t?void 0:t.lastName," \xb7 ",null===(o=e.user)||void 0===o?void 0:o.email]},e.id)})]})]})]}),(0,s.jsxs)("div",{style:{display:"flex",gap:"0.5rem",marginTop:"1.25rem"},children:[(0,s.jsx)("button",{onClick:()=>{X(!1),ee(""),te("")},style:{flex:1,padding:"0.6rem",background:"#f3f4f6",border:"none",borderRadius:"8px",fontSize:"0.85rem",fontWeight:"600",cursor:"pointer"},children:"Cancel"}),(0,s.jsx)("button",{onClick:async()=>{var e,t,o,n,i,s;if(!$||!re)return;const l=r.find(e=>e.id===$),d=r.find(e=>e.id===re);if(window.confirm("Merge accounts?\n\nKEEP: ".concat(null===l||void 0===l||null===(e=l.user)||void 0===e?void 0:e.firstName," ").concat(null===l||void 0===l||null===(t=l.user)||void 0===t?void 0:t.lastName," 
1(").concat(null===l||void 0===l||null===(o=l.user)||void 0===o?void 0:o.email,")\nDELETE: ").concat(null===d||void 0===d||null===(n=d.user)||void 0===n?void 0:n.firstName," ").concat(null===d||void 0===d||null===(i=d.user)||void 0===i?void 0:i.lastName," (").concat(null===d||void 0===d||null===(s=d.user)||void 0===s?void 0:s.email,")\n\nAll groups move to the KEEP account. DELETE account is permanently removed."))){ne(!0);try{const e=await(0,a.n)("/teachers/merge",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({keepId:$,deleteId:re})}),r=await e.json();r.success?(X(!1),ee(""),te(""),ie()):alert("\u274c "+(r.message||"Merge failed"))}catch(c){alert("\u274c Network error")}finally{ne(!1)}}},disabled:oe||!$||!re,style:{flex:2,padding:"0.6rem",background:$&&re?"#f59e0b":"#d1d5db",color:"white",border:"none",borderRadius:"8px",fontSize:"0.85rem",fontWeight:"700",cursor:"pointer"},children:oe?"Merging\u2026":"\ud83d\udd00 Merge & Delete Duplicate"})]})]})})]})}}}]);
2//# sourceMappingURL=5728.d8aed291.chunk.js.map

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.