"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[26203],{26203:(e,s,t)=>{t.r(s),t.d(s,{default:()=>m});var a=t(95155),l=t(12115),r=t(73321),n=t(55368),i=t(30313),d=t(98672),c=t(88541),o=t(2581);function m(){let e=(0,r.useParams)(),s="string"==typeof e?.studentUserId?e.studentUserId:"",[t,m]=(0,l.useState)(null),[x,u]=(0,l.useState)(""),[h,p]=(0,l.useState)(null),[j,b]=(0,l.useState)(!0),[f,N]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{if(!s)return;let e=!1;return(0,c.xw)(s).then(s=>{!e&&(m(s),s.exams[0]?.id&&u(s.exams[0].id))}).catch(s=>{e||(0,o.Qg)(s instanceof Error?s.message:"Failed to load exams")}).finally(()=>{e||b(!1)}),()=>{e=!0}},[s]),(0,l.useEffect)(()=>{if(!s||!x)return void p(null);let e=!1;return N(!0),(0,c.n9)(s,x).then(s=>{e||p(s)}).catch(s=>{e||((0,o.Qg)(s instanceof Error?s.message:"Failed to load exam result"),p(null))}).finally(()=>{e||N(!1)}),()=>{e=!0}},[s,x]),(0,a.jsx)(n.R,{title:"Exam results",description:"View your child's progress card for each exam.",children:j?(0,a.jsx)("div",{className:"h-40 animate-pulse rounded-lg bg-slate-100"}):t?.exams.length?(0,a.jsx)(d.S,{exams:t.exams,examId:x,onExamChange:u,meta:t,report:h,loadingResult:f}):(0,a.jsx)(i.i0,{title:"No exams yet",description:"When the school publishes exams for your child's class, results will appear here."})})}},27665:(e,s,t)=>{t.d(s,{B:()=>l,J:()=>r});var a=t(95155);function l({disabled:e}){return(0,a.jsx)("button",{type:"button",disabled:e,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 r({letterhead:e,title:s,subtitle:t,meta:r,children:n,actions:i}){return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-end gap-2 print:hidden",children:[i,(0,a.jsx)(l,{})]}),(0,a.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,a.jsxs)("div",{className:"border-b border-slate-200 bg-slate-50 px-5 py-5 text-center sm:px-8",children:[(0,a.jsx)("p",{className:"text-xl font-bold tracking-tight text-slate-900 sm:text-2xl",children:e?.academyName||"School"}),e?.tagline?(0,a.jsx)("p",{className:"mt-1 text-sm text-slate-500",children:e.tagline}):null,(0,a.jsx)("p",{className:"mt-3 text-base font-semibold uppercase tracking-wide text-slate-800",children:s}),t?(0,a.jsx)("p",{className:"mt-1 text-sm text-slate-600",children:t}):null,r?(0,a.jsx)("p",{className:"mt-1 text-xs text-slate-500",children:r}):null]}),(0,a.jsx)("div",{className:"px-4 py-5 sm:px-8 sm:py-6",children:n}),(0,a.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,a.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;
          }
        }
      `})]})}},88541:(e,s,t)=>{t.d(s,{BT:()=>i,CP:()=>h,OI:()=>o,W6:()=>r,WR:()=>m,hi:()=>c,kN:()=>n,mk:()=>d,n9:()=>u,xw:()=>x});var a=t(76541);function l(e){if(!e.data.success||void 0===e.data.data)throw Error(e.data.message||"Request failed");return e.data.data}async function r(){return l(await a.uE.get("/school/parent/home"))}async function n(e){return l(await a.uE.get(`/school/parent/children/${e}/overview`))}async function i(e){return l(await a.uE.get(`/school/parent/children/${e}/details`))}async function d(e){return l(await a.uE.get(`/school/parent/children/${e}/notices`))}async function c(e){return l(await a.uE.get(`/school/parent/children/${e}/homework`))}async function o(e,s){return l(await a.uE.get(`/school/parent/children/${e}/attendance`,{params:s}))}async function m(e){return l(await a.uE.get(`/school/parent/children/${e}/fees`))}async function x(e){return l(await a.uE.get(`/school/parent/children/${e}/exams`))}async function u(e,s){return l(await a.uE.get(`/school/parent/children/${e}/exam-result`,{params:{examId:s}}))}async function h(){return l(await a.uE.get("/school/parent/holidays"))}},98672:(e,s,t)=>{t.d(s,{S:()=>n});var a=t(95155),l=t(30313),r=t(27665);function n({exams:e,examId:s,onExamChange:t,meta:l,report:r,loadingResult:n,emptyResultTitle:d="No result available",emptyResultDescription:c="Marks may not have been entered for this exam yet."}){return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"rounded-lg border border-slate-100 bg-white p-4 shadow-sm",children:[(0,a.jsxs)("label",{className:"block text-sm",children:[(0,a.jsx)("span",{className:"mb-1 block text-slate-500",children:"Exam"}),(0,a.jsx)("select",{value:s,onChange:e=>t(e.target.value),className:"block w-full min-h-[44px] rounded-md border border-slate-200 px-3 py-2 text-sm",children:e.map(e=>(0,a.jsx)("option",{value:e.id,children:e.name},e.id))})]}),l?.schoolClass?(0,a.jsxs)("p",{className:"mt-2 text-xs text-slate-500",children:[l.schoolClass.displayName,l.academicYear?` \xb7 ${l.academicYear.name}`:""]}):null]}),n?(0,a.jsx)("div",{className:"h-48 animate-pulse rounded-lg bg-slate-100"}):r?(0,a.jsx)(i,{report:r}):(0,a.jsxs)("div",{className:"rounded-lg border border-dashed border-slate-200 bg-slate-50 px-4 py-10 text-center",children:[(0,a.jsx)("p",{className:"text-sm font-medium text-slate-800",children:d}),(0,a.jsx)("p",{className:"mt-1 text-sm text-slate-500",children:c})]})]})}function i({report:e}){return(0,a.jsxs)(r.J,{letterhead:e.letterhead,title:"Progress card / Report card",subtitle:`${e.exam.name} \xb7 ${e.schoolClass.displayName}`,meta:`Generated ${new Date(e.generatedAt).toLocaleString()}`,children:[(0,a.jsxs)("div",{className:"mb-5 grid grid-cols-1 gap-2 text-sm sm:grid-cols-2",children:[(0,a.jsxs)("p",{children:[(0,a.jsx)("span",{className:"text-slate-500",children:"Student:"})," ",(0,a.jsx)("strong",{children:e.student.fullName})]}),(0,a.jsxs)("p",{children:[(0,a.jsx)("span",{className:"text-slate-500",children:"Roll:"})," ",e.student.rollNumber||"—"]}),(0,a.jsxs)("p",{children:[(0,a.jsx)("span",{className:"text-slate-500",children:"Student code:"})," ",e.student.studentCode||"—"]}),(0,a.jsxs)("p",{children:[(0,a.jsx)("span",{className:"text-slate-500",children:"Admission no:"})," ",e.student.admissionNumber||"—"]})]}),(0,a.jsx)(l.iZ,{children:(0,a.jsxs)(l.cR,{minWidth:"36rem",children:[(0,a.jsx)(l.K_,{children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:`${l.aB} font-medium`,children:"Subject"}),(0,a.jsx)("th",{className:`${l.aB} font-medium text-center`,children:"Full"}),(0,a.jsx)("th",{className:`${l.aB} font-medium text-center`,children:"Obtained"}),(0,a.jsx)("th",{className:`${l.aB} font-medium text-center`,children:"%"}),(0,a.jsx)("th",{className:`${l.aB} font-medium text-center`,children:"Grade"}),(0,a.jsx)("th",{className:`${l.aB} font-medium text-center`,children:"Status"})]})}),(0,a.jsx)("tbody",{children:e.subjects.length?e.subjects.map(e=>(0,a.jsxs)("tr",{className:"border-t border-slate-100",children:[(0,a.jsx)("td",{className:`${l.Cl} font-medium text-slate-900`,children:e.subjectName}),(0,a.jsx)("td",{className:`${l.Cl} text-center tabular-nums`,children:e.fullMarks}),(0,a.jsx)("td",{className:`${l.Cl} text-center tabular-nums`,children:e.marksObtained??"—"}),(0,a.jsx)("td",{className:`${l.Cl} text-center tabular-nums`,children:e.percent??"—"}),(0,a.jsx)("td",{className:`${l.Cl} text-center`,children:e.gradeLabel||"—"}),(0,a.jsx)("td",{className:`${l.Cl} text-center text-xs font-semibold`,children:null==e.passed?"—":e.passed?"PASS":"FAIL"})]},e.subjectId)):(0,a.jsx)(l.tU,{colSpan:6,children:"No subjects scheduled"})})]})}),(0,a.jsxs)("div",{className:"mt-5 grid grid-cols-2 gap-3 rounded-lg border border-slate-100 bg-slate-50 p-4 text-sm sm:grid-cols-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs uppercase text-slate-500",children:"Total"}),(0,a.jsxs)("p",{className:"font-semibold tabular-nums",children:[e.totals.obtained,"/",e.totals.fullMarks]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs uppercase text-slate-500",children:"Percentage"}),(0,a.jsxs)("p",{className:"font-semibold tabular-nums",children:[e.totals.percent??"—","%"]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs uppercase text-slate-500",children:"Grade / Rank"}),(0,a.jsxs)("p",{className:"font-semibold",children:[e.totals.overallGrade||"—",null!=e.rank?` \xb7 #${e.rank}`:"",e.classSize?` of ${e.classSize}`:""]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-xs uppercase text-slate-500",children:"Result"}),(0,a.jsx)("p",{className:"font-semibold",children:e.totals.result})]})]})]})}}}]);