(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[15752,80941],{29156:(e,t,a)=>{"use strict";function s(e){if(!e)return!1;let t=e.split("?")[0]||e;return"/dashboard"===t||t.startsWith("/dashboard/")}function n(e){if(!e)return!1;let t=e.split("?")[0]||e;return"/admin"===t||t.startsWith("/admin/")}a.d(t,{M:()=>s,P:()=>n})},44947:(e,t,a)=>{Promise.resolve().then(a.bind(a,80941))},73321:(e,t,a)=>{"use strict";var s=a(74645);a.o(s,"useParams")&&a.d(t,{useParams:function(){return s.useParams}}),a.o(s,"usePathname")&&a.d(t,{usePathname:function(){return s.usePathname}}),a.o(s,"useRouter")&&a.d(t,{useRouter:function(){return s.useRouter}}),a.o(s,"useSearchParams")&&a.d(t,{useSearchParams:function(){return s.useSearchParams}})},80941:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>u});var s=a(95155),n=a(12115),r=a(30571),l=a(30313),d=a(75560),i=a(2581);let o={PRESENT:"bg-emerald-50 text-emerald-800",ABSENT:"bg-rose-50 text-rose-800",LATE:"bg-amber-50 text-amber-800"};function u(){let[e,t]=(0,n.useState)(null),[a,u]=(0,n.useState)(!0),[c,m]=(0,n.useState)(()=>{let e=new Date;return e.setUTCDate(e.getUTCDate()-60),e.toISOString().slice(0,10)}),[h,x]=(0,n.useState)(()=>new Date().toISOString().slice(0,10)),p=(0,n.useMemo)(()=>async()=>{u(!0);try{t(await (0,d.Hj)({from:c,to:h}))}catch(e){(0,i.Qg)(e instanceof Error?e.message:"Failed to load attendance"),t(null)}finally{u(!1)}},[c,h]);(0,n.useEffect)(()=>{p()},[p]);let b=e?.summary;return(0,s.jsxs)(r.o,{title:"Attendance",description:e?.profile.schoolClass?.displayName?`Present, absent, and late days for ${e.profile.schoolClass.displayName}.`:"Your present, absent, and late days.",children:[(0,s.jsx)("div",{className:"rounded-lg border border-slate-100 bg-white p-4 shadow-sm",children:(0,s.jsxs)("div",{className:"flex flex-wrap items-end gap-3",children:[(0,s.jsxs)("label",{className:"text-sm",children:[(0,s.jsx)("span",{className:"mb-1 block text-slate-500",children:"From"}),(0,s.jsx)("input",{type:"date",value:c,onChange:e=>m(e.target.value),className:"rounded-md border border-slate-200 bg-white px-3 py-2 text-sm text-slate-900"})]}),(0,s.jsxs)("label",{className:"text-sm",children:[(0,s.jsx)("span",{className:"mb-1 block text-slate-500",children:"To"}),(0,s.jsx)("input",{type:"date",value:h,onChange:e=>x(e.target.value),className:"rounded-md border border-slate-200 bg-white px-3 py-2 text-sm text-slate-900"})]})]})}),a?(0,s.jsx)("div",{className:"h-40 animate-pulse rounded-lg bg-slate-100"}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.jQ,{items:[{label:"Present",value:b?.present??0},{label:"Absent",value:b?.absent??0},{label:"Late",value:b?.late??0},{label:"Present rate",value:`${b?.presentRate??0}%`}]}),(0,s.jsx)("div",{className:"overflow-hidden rounded-lg border border-slate-100 bg-white shadow-sm",children:e?.days.length?(0,s.jsx)("ul",{className:"divide-y divide-slate-100",children:e.days.map(e=>(0,s.jsxs)("li",{className:"flex items-center justify-between gap-3 px-4 py-3 text-sm sm:px-5",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-medium text-slate-900",children:new Date(`${e.date}T12:00:00`).toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric",year:"numeric"})}),e.notes?(0,s.jsx)("p",{className:"text-xs text-slate-500",children:e.notes}):null]}),(0,s.jsx)("span",{className:`rounded-md px-2 py-0.5 text-xs font-semibold ${o[e.status]||"bg-slate-100 text-slate-700"}`,children:e.status})]},e.date))}):(0,s.jsx)("div",{className:"p-6",children:(0,s.jsx)(l.i0,{title:"No attendance in this range",description:"Try a different date range or check back after your teacher marks attendance."})})})]})]})}},99462:(e,t,a)=>{"use strict";a.d(t,{Fb:()=>h,b:()=>l,sK:()=>x});var s=a(73321),n=a(12115);let r="academy-route-change";function l(){window.dispatchEvent(new Event(r))}let d=new Set,i=!1;function o(){i||(i=!0,setTimeout(()=>{i=!1,d.forEach(e=>{try{e()}catch{}})},0))}function u(e){d.add(e);let t=()=>o();return window.addEventListener("popstate",t),window.addEventListener(r,t),()=>{d.delete(e),window.removeEventListener("popstate",t),window.removeEventListener(r,t)}}function c(){return window.location.pathname||"/"}function m(){return window.location.search||""}function h(){return(0,n.useSyncExternalStore)(u,m,()=>"")}function x(){let e=(0,s.usePathname)()||"/",t=(0,n.useSyncExternalStore)(u,c,()=>e);return((0,n.useEffect)(()=>{o()},[]),t&&t!==e)?t:e}}},e=>{e.O(0,[35760,92619,59185,98500,62007,76541,30313,16645,28441,93794,77358],()=>e(e.s=44947)),_N_E=e.O()}]);