"use strict";exports.id=62415,exports.ids=[62415],exports.modules={62415:(a,b,c)=>{c.r(b),c.d(b,{default:()=>k});var d=c(48249),e=c(67484),f=c(42947),g=c(82697),h=c(92038),i=c(91115);let j={PRESENT:"bg-emerald-50 text-emerald-800",ABSENT:"bg-rose-50 text-rose-800",LATE:"bg-amber-50 text-amber-800"};function k(){let[a,b]=(0,e.useState)(null),[c,k]=(0,e.useState)(!0),[l,m]=(0,e.useState)(()=>{let a=new Date;return a.setUTCDate(a.getUTCDate()-60),a.toISOString().slice(0,10)}),[n,o]=(0,e.useState)(()=>new Date().toISOString().slice(0,10));(0,e.useMemo)(()=>async()=>{k(!0);try{b(await (0,h.Hj)({from:l,to:n}))}catch(a){(0,i.Qg)(a instanceof Error?a.message:"Failed to load attendance"),b(null)}finally{k(!1)}},[l,n]);let p=a?.summary;return(0,d.jsxs)(f.o,{title:"Attendance",description:a?.profile.schoolClass?.displayName?`Present, absent, and late days for ${a.profile.schoolClass.displayName}.`:"Your present, absent, and late days.",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:l,onChange:a=>m(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:n,onChange:a=>o(a.target.value),className:"rounded-md border border-slate-200 bg-white px-3 py-2 text-sm text-slate-900"})]})]})}),c?(0,d.jsx)("div",{className:"h-40 animate-pulse rounded-lg bg-slate-100"}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(g.jQ,{items:[{label:"Present",value:p?.present??0},{label:"Absent",value:p?.absent??0},{label:"Late",value:p?.late??0},{label:"Present rate",value:`${p?.presentRate??0}%`}]}),(0,d.jsx)("div",{className:"overflow-hidden rounded-lg border border-slate-100 bg-white shadow-sm",children:a?.days.length?(0,d.jsx)("ul",{className:"divide-y divide-slate-100",children:a.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 ${j[a.status]||"bg-slate-100 text-slate-700"}`,children:a.status})]},a.date))}):(0,d.jsx)("div",{className:"p-6",children:(0,d.jsx)(g.i0,{title:"No attendance in this range",description:"Try a different date range or check back after your teacher marks attendance."})})})]})]})}}};