/* Admin → Attendance Inbox: receives parent absence reports, approve/excuse. Consumes what parents submit from the parent-app Attendance screen. */ function AttendanceInboxScreen() { const REASONS = { sick: { label:'Illness', icon:'thermometer', tint:'var(--danger-100)', ic:'var(--danger-500)' }, appt: { label:'Appointment', icon:'stethoscope', tint:'var(--info-100)', ic:'var(--info-500)' }, family: { label:'Family', icon:'users', tint:'var(--gold-100)', ic:'var(--gold-600)' }, other: { label:'Other', icon:'circle-ellipsis', tint:'var(--gray-100)', ic:'var(--gray-500)' }, }; const [tab, setTab] = React.useState('pending'); const [rows, setRows] = React.useState([ { id:1, n:'EJ Hatten', grade:'Gr 6 · Rm 214', c:'green', when:'Today', reason:'sick', note:'Fever overnight, keeping him home to rest.', by:'Jermaine Hatten', flag:false, status:'pending' }, { id:2, n:'Liam Carter', grade:'Gr 6 · Rm 214', c:'blue', when:'Today', reason:'appt', note:'Orthodontist at 10 AM, back by lunch.', by:'Dana Carter', flag:false, status:'pending' }, { id:3, n:'Ava Mitchell', grade:'Gr 7 · Rm 118', c:'red', when:'Tomorrow', reason:'family', note:'Out of town for a family funeral.', by:'Rose Mitchell', flag:false, status:'pending' }, { id:4, n:'Noah Bennett', grade:'Gr 6 · Rm 214', c:'cyan', when:'Today', reason:'other', note:'', by:'K. Bennett', flag:true, status:'pending' }, { id:5, n:'Sophia Perez', grade:'Gr 7 · Rm 118', c:'gold', when:'Yesterday',reason:'sick', note:'Stomach bug.', by:'M. Perez', flag:false, status:'excused' }, ]); const act = (id, status) => { setRows(rs => rs.map(r => r.id===id ? { ...r, status } : r)); const r = rows.find(x=>x.id===id); jlToast(r.n + ' marked ' + status + ' · parent notified', { icon: status==='excused'?'check-check':'flag', color: status==='excused'?'#1F9D57':'#F0B540' }); }; const pending = rows.filter(r=>r.status==='pending'); const list = tab==='pending' ? pending : rows.filter(r=>r.status!=='pending'); const flagged = rows.filter(r=>r.flag && r.status==='pending').length; return (
{[['pending','Pending'],['reviewed','Reviewed']].map(([id,l]) => ( ))}
}> {list.length===0 ? (
Inbox zero — every report has been reviewed.
) : list.map((r,i) => { const rsn = REASONS[r.reason]; return (
0?'1px solid var(--gray-100)':'0' }}> w[0]).join('')} color={r.c} size={38} />
{r.n}{r.flag && }
{r.grade}
{rsn.label}
{r.when}
{r.note ? '“' + r.note + '”' : 'No note provided'}Reported by {r.by}
{r.status==='pending' ? (
) : ( {r.status==='excused'?'Excused':'Flagged'} )}
); })} ); } Object.assign(window, { AttendanceInboxScreen });