diff --git a/app/(app)/page.tsx b/app/(app)/page.tsx index 74aee6c..e4014b5 100644 --- a/app/(app)/page.tsx +++ b/app/(app)/page.tsx @@ -38,7 +38,12 @@ const DOT_STYLES: Record = { Gehaltsanpassung: "bg-warning-text", }; -const KIND_LABEL = { hire: "Eintritt", exit: "Austritt", return: "Rückkehr aus Abwesenheit" } as const; +const KIND_LABEL = { + hire: "Eintritt", + exit: "Austritt", + return: "Rückkehr aus Abwesenheit", + note: "Wiedervorlage", +} as const; export default async function DashboardPage({ searchParams, @@ -83,6 +88,7 @@ export default async function DashboardPage({ upcomingHires, upcomingExits, upcomingReturns, + upcomingNotes, history, } = await withUser(userId, (tx) => loadDashboardData(tx, { userId, today, yearStart, yearEnd, bisIso, arten })); // "Aktiv" means status Aktiv — somebody on Karenz is employed but not @@ -115,26 +121,46 @@ export default async function DashboardPage({ .sort((a, b) => b.count - a.count); const maxDivisionCount = Math.max(1, ...divisionBars.map((d) => d.count)); - type UpcomingItem = { id: string; label: string; date: string; kind: keyof typeof KIND_LABEL }; + type UpcomingItem = { + id: string; + /** Ziel des Klicks — bei einer Wiedervorlage die Akte, nicht die Notiz. */ + employeeId: string; + label: string; + /** Zweite Zeile: bei einer Wiedervorlage der Notiztext statt der Art. */ + hinweis?: string; + date: string; + kind: keyof typeof KIND_LABEL; + }; const upcomingAlle: UpcomingItem[] = [ ...(upcomingHires).map((e) => ({ id: e.id, + employeeId: e.id, label: fmtName(e.first_name, e.last_name), date: e.entry_date, kind: "hire" as const, })), ...(upcomingExits).map((e) => ({ id: e.id, + employeeId: e.id, label: fmtName(e.first_name, e.last_name), date: e.exit_date!, kind: "exit" as const, })), ...(upcomingReturns).map((e) => ({ id: e.id, + employeeId: e.id, label: fmtName(e.first_name, e.last_name), date: e.karenz_return_date!, kind: "return" as const, })), + ...(upcomingNotes).map((n) => ({ + id: n.id, + employeeId: n.employee_id!, + label: fmtName(n.first_name, n.last_name), + hinweis: n.note_text, + date: n.due_date!, + kind: "note" as const, + })), ].sort((a, b) => a.date.localeCompare(b.date)); // Die Karte bleibt eine Übersicht, keine Liste: acht Zeilen, und darunter @@ -233,20 +259,35 @@ export default async function DashboardPage({