"use strict";exports.id=9750,exports.ids=[9750],exports.modules={87369:(a,b,c)=>{c.r(b),c.d(b,{default:()=>l});var d=c(48249),e=c(67484),f=c(19099),g=c(59478),h=c(82697),i=c(93529),j=c(91115);let k={PRESENT:"bg-emerald-50 text-emerald-800",ABSENT:"bg-rose-50 text-rose-800",LATE:"bg-amber-50 text-amber-800"};function l(){let a=(0,f.useParams)(),b="string"==typeof a?.studentUserId?a.studentUserId:"",[c,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(!0),[o,p]=(0,e.useState)(()=>{let a=new Date;return a.setUTCDate(a.getUTCDate()-60),a.toISOString().slice(0,10)}),[q,r]=(0,e.useState)(()=>new Date().toISOString().slice(0,10));(0,e.useMemo)(()=>async()=>{if(b){n(!0);try{l(await (0,i.OI)(b,{from:o,to:q}))}catch(a){(0,j.Qg)(a instanceof Error?a.message:"Failed to load attendance"),l(null)}finally{n(!1)}}},[b,o,q]);let s=c?.summary;return(0,d.jsxs)(g.R,{title:"Attendance",description:c?.profile.schoolClass?.displayName?`Present, absent, and late days for ${c.profile.schoolClass.displayName}.`:"Attendance records for your child.",children:[(0,d.jsx)("div",{className:"rounded-lg border border-slate-100 bg-white p-4 shadow-sm",children:(0,d.jsxs)("div",{className:"flex flex-wrap items-end gap-3",children:[(0,d.jsxs)("label",{className:"text-sm",children:[(0,d.jsx)("span",{className:"mb-1 block text-slate-500",children:"From"}),(0,d.jsx)("input",{type:"date",value:o,onChange:a=>p(a.target.value),className:"rounded-md border border-slate-200 bg-white px-3 py-2 text-sm text-slate-900"})]}),(0,d.jsxs)("label",{className:"text-sm",children:[(0,d.jsx)("span",{className:"mb-1 block text-slate-500",children:"To"}),(0,d.jsx)("input",{type:"date",value:q,onChange:a=>r(a.target.value),className:"rounded-md border border-slate-200 bg-white px-3 py-2 text-sm text-slate-900"})]})]})}),m?(0,d.jsx)("div",{className:"h-40 animate-pulse rounded-lg bg-slate-100"}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.jQ,{items:[{label:"Present",value:s?.present??0},{label:"Absent",value:s?.absent??0},{label:"Late",value:s?.late??0},{label:"Present rate",value:`${s?.presentRate??0}%`}]}),(0,d.jsx)("div",{className:"overflow-hidden rounded-lg border border-slate-100 bg-white shadow-sm",children:c?.days.length?(0,d.jsx)("ul",{className:"divide-y divide-slate-100",children:c.days.map(a=>(0,d.jsxs)("li",{className:"flex items-center justify-between gap-3 px-4 py-3 text-sm sm:px-5",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"font-medium text-slate-900",children:new Date(`${a.date}T12:00:00`).toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric",year:"numeric"})}),a.notes?(0,d.jsx)("p",{className:"text-xs text-slate-500",children:a.notes}):null]}),(0,d.jsx)("span",{className:`rounded-md px-2 py-0.5 text-xs font-semibold ${k[a.status]||"bg-slate-100 text-slate-700"}`,children:a.status})]},a.date))}):(0,d.jsx)("div",{className:"p-6",children:(0,d.jsx)(h.i0,{title:"No attendance in this range",description:"Try a different date range or check back after attendance is marked."})})})]})]})}},93529:(a,b,c)=>{c.d(b,{BT:()=>h,CP:()=>o,OI:()=>k,W6:()=>f,WR:()=>l,hi:()=>j,kN:()=>g,mk:()=>i,n9:()=>n,xw:()=>m});var d=c(23971);function e(a){if(!a.data.success||void 0===a.data.data)throw Error(a.data.message||"Request failed");return a.data.data}async function f(){return e(await d.uE.get("/school/parent/home"))}async function g(a){return e(await d.uE.get(`/school/parent/children/${a}/overview`))}async function h(a){return e(await d.uE.get(`/school/parent/children/${a}/details`))}async function i(a){return e(await d.uE.get(`/school/parent/children/${a}/notices`))}async function j(a){return e(await d.uE.get(`/school/parent/children/${a}/homework`))}async function k(a,b){return e(await d.uE.get(`/school/parent/children/${a}/attendance`,{params:b}))}async function l(a){return e(await d.uE.get(`/school/parent/children/${a}/fees`))}async function m(a){return e(await d.uE.get(`/school/parent/children/${a}/exams`))}async function n(a,b){return e(await d.uE.get(`/school/parent/children/${a}/exam-result`,{params:{examId:b}}))}async function o(){return e(await d.uE.get("/school/parent/holidays"))}}};