import { notFound } from "next/navigation"; import { EmployeeDetail } from "@/components/employees/EmployeeDetail"; import { currentUserId } from "@/lib/auth/session"; import { withUser } from "@/lib/db"; import { todayIso } from "@/lib/format"; import { breadcrumbLabel } from "@/lib/org"; import { loadEmployeeDetail } from "@/lib/employee-detail-data"; type PageProps = { params: Promise<{ id: string }> }; export default async function EmployeeDetailPage({ params }: PageProps) { const { id } = await params; const today = todayIso(); // Was die Akte liest und in wie vielen Rundreisen, steht in // lib/employee-detail-data.ts. const data = await withUser(await currentUserId(), (tx) => loadEmployeeDetail(tx, id, today)); if (!data) notFound(); const { employee, line, reports, history, dependents, notes, orgMaps, placement, kostenstelle, onboarding, offboarding, openPositions, byId } = data; return ( { const e = byId.get(r.employee_id); return e ? [e] : []; })} history={history ?? []} dependents={dependents ?? []} notes={notes ?? []} locations={orgMaps.locationList} openPositions={openPositions} today={today} /> ); }