"use strict";exports.id=46429,exports.ids=[46429],exports.modules={14647:(a,b,c)=>{c.d(b,{B:()=>e,J:()=>f});var d=c(48249);function e({disabled:a}){return(0,d.jsx)("button",{type:"button",disabled:a,onClick:()=>window.print(),className:"inline-flex min-h-[40px] items-center justify-center rounded-md bg-primary-700 px-4 py-2 text-sm font-medium text-white hover:bg-primary-800 disabled:opacity-50 print:hidden",children:"Print / Save PDF"})}function f({letterhead:a,title:b,subtitle:c,meta:f,children:g,actions:h}){return(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-end gap-2 print:hidden",children:[h,(0,d.jsx)(e,{})]}),(0,d.jsxs)("div",{id:"sms-print-report",className:"overflow-hidden rounded-lg border border-slate-200 bg-white shadow-sm print:border-0 print:shadow-none",children:[(0,d.jsxs)("div",{className:"border-b border-slate-200 bg-slate-50 px-5 py-5 text-center sm:px-8",children:[(0,d.jsx)("p",{className:"text-xl font-bold tracking-tight text-slate-900 sm:text-2xl",children:a?.academyName||"School"}),a?.tagline?(0,d.jsx)("p",{className:"mt-1 text-sm text-slate-500",children:a.tagline}):null,(0,d.jsx)("p",{className:"mt-3 text-base font-semibold uppercase tracking-wide text-slate-800",children:b}),c?(0,d.jsx)("p",{className:"mt-1 text-sm text-slate-600",children:c}):null,f?(0,d.jsx)("p",{className:"mt-1 text-xs text-slate-500",children:f}):null]}),(0,d.jsx)("div",{className:"px-4 py-5 sm:px-8 sm:py-6",children:g}),(0,d.jsx)("div",{className:"border-t border-slate-100 px-5 py-4 text-xs text-slate-400 sm:px-8",children:"Generated for school records \xb7 Use Print / Save PDF for a paper copy"})]}),(0,d.jsx)("style",{children:`
        @media print {
          body * { visibility: hidden !important; }
          #sms-print-report, #sms-print-report * { visibility: visible !important; }
          #sms-print-report {
            position: absolute;
            left: 0;
            top: 0;
            width: 100%;
            border: none !important;
            box-shadow: none !important;
          }
        }
      `})]})}},46429:(a,b,c)=>{c.r(b),c.d(b,{default:()=>m});var d=c(48249),e=c(67484),f=c(84466),g=c(82697),h=c(91415),i=c(14647),j=c(81152),k=c(91115);function l(a){return Number(a||0).toLocaleString(void 0,{maximumFractionDigits:2})}function m(){let[a,b]=(0,e.useState)([]),[c,m]=(0,e.useState)([]),[n,o]=(0,e.useState)(""),[p,q]=(0,e.useState)(""),[r,s]=(0,e.useState)(null),[t,u]=(0,e.useState)(!1),[v,w]=(0,e.useState)(!0),x=(0,e.useCallback)(async()=>{if(n){u(!0);try{s(await (0,j.N4)({schoolClassId:n,examId:p||void 0}))}catch(a){(0,k.Qg)(a instanceof Error?a.message:"Failed to load class summary"),s(null)}finally{u(!1)}}},[n,p]);return(0,d.jsxs)("div",{className:"space-y-4 sm:space-y-6",children:[(0,d.jsx)(f.wc,{title:"Class summary",description:"Class-level attendance, fees dues, and optional exam snapshot."}),(0,d.jsx)(h.f,{}),v?(0,d.jsx)(g.nI,{rows:2}):(0,d.jsxs)(g.r7,{children:[(0,d.jsx)(g.yB,{label:"Class",className:"min-w-0 flex-1 sm:min-w-[12rem]",children:(0,d.jsxs)(g.Kd,{value:n,onChange:a=>o(a.target.value),children:[(0,d.jsx)("option",{value:"",children:"Select class"}),a.map(a=>(0,d.jsx)("option",{value:a.id,children:a.displayName},a.id))]})}),(0,d.jsx)(g.yB,{label:"Exam (optional)",className:"min-w-0 flex-1 sm:min-w-[12rem]",children:(0,d.jsxs)(g.Kd,{value:p,onChange:a=>q(a.target.value),children:[(0,d.jsx)("option",{value:"",children:"None"}),c.map(a=>(0,d.jsx)("option",{value:a.id,children:a.name},a.id))]})}),(0,d.jsx)(g.bE,{children:(0,d.jsx)(g.kL,{type:"button",onClick:()=>void x(),disabled:!n||t,children:t?"Generating…":"Generate"})})]}),t?(0,d.jsx)(g.nI,{rows:4}):r?(0,d.jsxs)(i.J,{letterhead:r.letterhead,title:"Class summary report",subtitle:r.schoolClass.displayName,meta:`${r.schoolClass.academicYear?.name||""}${r.schoolClass.classTeacher?` \xb7 Class teacher: ${r.schoolClass.classTeacher.fullName}`:""} \xb7 ${new Date(r.generatedAt).toLocaleString()}`,children:[(0,d.jsxs)("div",{className:"mb-5 grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,d.jsxs)("div",{className:"rounded-lg border border-slate-100 bg-slate-50 p-3",children:[(0,d.jsx)("p",{className:"text-xs uppercase text-slate-500",children:"Students"}),(0,d.jsx)("p",{className:"text-xl font-semibold tabular-nums",children:r.stats.studentCount})]}),(0,d.jsxs)("div",{className:"rounded-lg border border-slate-100 bg-slate-50 p-3",children:[(0,d.jsx)("p",{className:"text-xs uppercase text-slate-500",children:"Avg attendance"}),(0,d.jsxs)("p",{className:"text-xl font-semibold tabular-nums",children:[r.stats.attendanceAveragePercent??"—","%"]})]}),(0,d.jsxs)("div",{className:"rounded-lg border border-slate-100 bg-slate-50 p-3",children:[(0,d.jsx)("p",{className:"text-xs uppercase text-slate-500",children:"Fees due"}),(0,d.jsx)("p",{className:"text-xl font-semibold tabular-nums",children:l(r.stats.fees.totalDue)})]}),(0,d.jsxs)("div",{className:"rounded-lg border border-slate-100 bg-slate-50 p-3",children:[(0,d.jsx)("p",{className:"text-xs uppercase text-slate-500",children:"Fees collected"}),(0,d.jsx)("p",{className:"text-xl font-semibold tabular-nums",children:l(r.stats.fees.totalPaid)})]})]}),r.examSummary?(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsxs)("h3",{className:"text-sm font-semibold text-slate-900",children:["Exam: ",r.examSummary.exam.name]}),(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-3 text-sm sm:grid-cols-4",children:[(0,d.jsxs)("p",{children:["Marked: ",(0,d.jsx)("strong",{children:r.examSummary.studentsWithMarks})]}),(0,d.jsxs)("p",{children:["Pass: ",(0,d.jsx)("strong",{children:r.examSummary.passCount})]}),(0,d.jsxs)("p",{children:["Fail: ",(0,d.jsx)("strong",{children:r.examSummary.failCount})]}),(0,d.jsxs)("p",{children:["Class avg:"," ",(0,d.jsxs)("strong",{children:[r.examSummary.averagePercent??"—","%"]})]})]}),r.examSummary.topStudents.length?(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"mb-2 text-xs font-semibold uppercase text-slate-500",children:"Top students"}),(0,d.jsx)("ul",{className:"divide-y divide-slate-100 rounded-lg border border-slate-100",children:r.examSummary.topStudents.map(a=>(0,d.jsxs)("li",{className:"flex items-center justify-between gap-3 px-3 py-2 text-sm",children:[(0,d.jsxs)("span",{children:["#",a.rank," ",a.fullName,a.rollNumber?` \xb7 Roll ${a.rollNumber}`:""]}),(0,d.jsxs)("span",{className:"tabular-nums text-slate-600",children:[a.percent??"—","% ",a.overallGrade?`\xb7 ${a.overallGrade}`:""]})]},`${a.rank}-${a.fullName}`))})]}):null]}):(0,d.jsx)("p",{className:"text-sm text-slate-500",children:"Select an exam above to include pass/fail and top students."})]}):n?(0,d.jsx)(g.i0,{title:"No report yet",description:"Click Generate to build the class summary.",action:(0,d.jsx)(g.kL,{type:"button",onClick:()=>void x(),children:"Generate report"})}):(0,d.jsx)(g.i0,{title:"Select a class",description:"Choose a class and optionally an exam, then generate the summary."})]})}},91415:(a,b,c)=>{c.d(b,{f:()=>j});var d=c(48249),e=c(60932),f=c(40433),g=c(14113),h=c(17060);let i=[{href:f.bw.SMS_ADMIN.REPORTS_ATTENDANCE,label:"Attendance",match:a=>a===f.bw.SMS_ADMIN.REPORTS||a===f.bw.SMS_ADMIN.REPORTS_ATTENDANCE},{href:f.bw.SMS_ADMIN.REPORTS_PROGRESS_CARD,label:"Progress card",match:a=>a.startsWith(f.bw.SMS_ADMIN.REPORTS_PROGRESS_CARD)},{href:f.bw.SMS_ADMIN.REPORTS_MARK_SHEET,label:"Mark sheet",match:a=>a.startsWith(f.bw.SMS_ADMIN.REPORTS_MARK_SHEET)},{href:f.bw.SMS_ADMIN.REPORTS_MERIT_LIST,label:"Merit list",match:a=>a.startsWith(f.bw.SMS_ADMIN.REPORTS_MERIT_LIST)},{href:f.bw.SMS_ADMIN.REPORTS_STUDENT,label:"Student",match:a=>a.startsWith(f.bw.SMS_ADMIN.REPORTS_STUDENT)},{href:f.bw.SMS_ADMIN.REPORTS_CLASS,label:"Class",match:a=>a.startsWith(f.bw.SMS_ADMIN.REPORTS_CLASS)},{href:f.bw.SMS_ADMIN.REPORTS_FEES,label:"Fees statement",match:a=>a.startsWith(f.bw.SMS_ADMIN.FEES_STATEMENT)}];function j(){let a=(0,h.sK)()??"";return(0,d.jsx)("nav",{className:"flex gap-1 overflow-x-auto rounded-lg border border-slate-200 bg-slate-50/80 p-1 scrollbar-none print:hidden","aria-label":"School reports sections",children:i.map(b=>{let c=b.match(a);return(0,d.jsx)(e.u,{href:b.href,className:(0,g.xW)("inline-flex shrink-0 items-center gap-1.5 rounded-md px-3 py-2 text-sm font-medium transition-all duration-200 ease-out motion-reduce:transition-none",c?"bg-white text-primary-800 shadow-sm ring-1 ring-slate-200/80":"text-slate-600 hover:bg-white hover:text-slate-900 hover:shadow-sm"),"aria-current":c?"page":void 0,children:b.label},b.href)})})}}};