diff --git a/app/(protected)/hse/capa/page.tsx b/app/(protected)/hse/capa/page.tsx index 29686ce..550255c 100644 --- a/app/(protected)/hse/capa/page.tsx +++ b/app/(protected)/hse/capa/page.tsx @@ -33,6 +33,7 @@ export default async function CapaListPage() { .orderBy(asc(capaActions.dueDate)) ) + const today = new Date().toISOString().slice(0, 10) const capas = rows.map(r => ({ id: r.id, incident_id: r.incidentId, @@ -40,7 +41,9 @@ export default async function CapaListPage() { department: r.department, due_date: r.dueDate, priority: r.priority, - status: r.status, + status: (r.status === 'open' || r.status === 'in_progress') && r.dueDate && r.dueDate < today + ? 'overdue' as const + : r.status, incidents: { reference_no: r.incidentRefNo ?? null }, owner: r.ownerName ? { name: r.ownerName } : null, }))