diff --git a/app/(app)/page.tsx b/app/(app)/page.tsx index f4f3def..a4f66d3 100644 --- a/app/(app)/page.tsx +++ b/app/(app)/page.tsx @@ -19,7 +19,7 @@ import { loadDashboardData } from "@/lib/dashboard-data"; import { KPI_ERKLAERUNGEN } from "@/lib/kpi-erklaerungen"; import { addDaysIso, fmtName, todayIso } from "@/lib/format"; import { anzeige } from "@/lib/anzeige"; -import { divisionOf } from "@/lib/org"; +import { bestehtAm, divisionOf } from "@/lib/org"; import { deriveStatusAsOf } from "@/lib/reports"; import { currentUserId } from "@/lib/auth/session"; import { withUser } from "@/lib/db"; @@ -154,7 +154,7 @@ export default async function DashboardPage({ ); } const divisionBars = orgMaps.unitList - .filter((u) => u.unit_type === "Bereich") + .filter((u) => u.unit_type === "Bereich" && bestehtAm(u, today)) .map((d) => ({ name: d.name, count: headcountByDivision.get(d.id) ?? 0 })) .sort((a, b) => b.count - a.count); const maxDivisionCount = Math.max(1, ...divisionBars.map((d) => d.count)); diff --git a/app/(app)/positions/page.tsx b/app/(app)/positions/page.tsx index 6505f4d..98f0ee6 100644 --- a/app/(app)/positions/page.tsx +++ b/app/(app)/positions/page.tsx @@ -5,7 +5,7 @@ import { kostenstellenAbfrage } from "@/lib/cost-centers"; import { withUser } from "@/lib/db"; import { jsonArrayFrom } from "@/lib/db/json"; import { daysBetweenIso, todayIso } from "@/lib/format"; -import { buildOrgMaps, orgMapsAbfragen } from "@/lib/org"; +import { buildOrgMaps, nimmtNeuesAuf, orgMapsAbfragen } from "@/lib/org"; import { offeneStellenAbfrage, resolveOpenPositions, type OffeneStelle } from "@/lib/positions"; export default async function PositionsPage() { @@ -43,6 +43,7 @@ export default async function PositionsPage() { unit_type: u.unit_type, depth: orgMaps.depthOf.get(u.id) ?? 0, hasChief: withChief.has(u.id), + endet: !nimmtNeuesAuf(u), })); const openPositionsWithDays = openPositions.map((p) => ({ ...p, daysOpen: daysBetweenIso(p.vacantSince) })); diff --git a/components/orgchart/OrgUnitPanel.tsx b/components/orgchart/OrgUnitPanel.tsx index 1b5faff..b8185ed 100644 --- a/components/orgchart/OrgUnitPanel.tsx +++ b/components/orgchart/OrgUnitPanel.tsx @@ -286,10 +286,14 @@ export function OrgUnitPanel({
- + {/* Unter einer Einheit mit Ende entsteht nichts Unbefristetes mehr; + die Datenbank wiese es ab. */} + {!unit.valid_to && ( + + )} {entfernbar && (