const isAdmin = (u) => ['hr_admin', 'super_admin'].includes(u.role); function todayRow(S, u) { const di = dayInfo(S, u.id, AKH.todayIso()); const map = { present: ['blue', 'Office'], wfh: ['grey', 'WFH'], leave: ['amber', 'On leave'], holiday: ['navy', 'Holiday'], weekend: ['grey', 'Weekend'], today: ['red', 'Not checked in'] }; return { di, badge: map[di.kind] || ['grey', di.label || '—'] }; } function ApproveModal({ u, onClose }) { const S = useStore(); const { me, toast } = useApp(); const nextId = () => 'AKS-' + String(Math.max(...S.users.filter((x) => x.empId).map((x) => Number(x.empId.slice(4)))) + 1).padStart(3, '0'); const managers = S.users.filter((x) => x.status === 'active' && x.role !== 'employee'); const [f, setF] = React.useState({ role: 'employee', managerId: '', empId: '' }); React.useEffect(() => { if (u) setF({ role: 'employee', managerId: (managers.find((x) => x.dept === u.dept) || managers[0] || {}).id || '', empId: nextId() }); }, [u]); if (!u) return null; return (
{u.designation} · {u.dept}{u.email} · +91 {u.phone}Requested {fmt.d(u.requestedAt)}
setF({ ...f, empId: e.target.value })} /> setF({ ...f, managerId: e.target.value })} options={managers.map((x) => [x.id, x.name + ' · ' + x.designation])} />

An "Account approved" email goes to {u.email} with sign-in instructions.

Cancel { AKStore.act.approveUser(u.id, me.id, f); onClose(); toast(u.name + ' approved · welcome email sent'); }}>Approve & email
); } function SuspendModal({ u, onClose }) { const { me, toast } = useApp(); const [reason, setReason] = React.useState(''); const [err, setErr] = React.useState(''); React.useEffect(() => { setReason(''); setErr(''); }, [u]); if (!u) return null; return (

{u.name.split(' ')[0]} will be signed out and won't be able to sign in until you reactivate the account. Their records are kept.