Akte, Reiter Organisation: Stellenverlauf
Some checks failed
CI / Migrationen auf leerer Datenbank (push) Has been cancelled
CI / Ausrollen (push) Has been cancelled
CI / Lint, Typen, Tests, Build (push) Has been cancelled

Eine Tabelle aller Besetzungen der Person, juengste zuerst: Von, Bis
(letzter Tag auf der Stelle), Planstelle mit Taetigkeit, Organisations-
einheit, Kostenstelle zum letzten Tag und der Vorgang, mit dem der
Abschnitt beginnt (Eintritt, Wiedereintritt, Versetzung, Befoerderung am
selben Tag in der Historie). Die laufende Besetzung steht fett.

Gelesen aus den Besetzungen selbst, nicht aus den Texten der Historie; die
Daten laedt die Akte bereits, es kommt keine Abfrage hinzu.

Geprueft: lint, tsc, npm test (1041, neu: stellenverlauf), Waechter.
This commit is contained in:
2026-11-03 14:12:45 +01:00
parent fbe542767b
commit a6a360f770
6 changed files with 190 additions and 3 deletions

View File

@@ -7,6 +7,7 @@ import { Avatar } from "@/components/ui/Avatar";
import { Button } from "@/components/ui/Button";
import { StatusChip } from "@/components/ui/StatusChip";
import { abwesenheitsplan } from "@/lib/abwesenheitsplan";
import type { StellenAbschnitt } from "@/lib/stellenverlauf";
import { rueckkehrNachListe, type Checkliste } from "@/lib/checklist";
import { fmtFullName, tenure } from "@/lib/format";
import { fortschritt as fortschrittOffboarding, gehoertOffboarding } from "@/lib/offboarding";
@@ -45,6 +46,8 @@ type EmployeeDetailProps = {
breadcrumb: string;
/** Die Kostenstelle der laufenden Planstellenbesetzung. */
kostenstelle: { code: string; name: string } | null;
/** Alle Besetzungen der Person, jüngste zuerst (lib/stellenverlauf.ts). */
stellenverlauf: StellenAbschnitt[];
/** Die Onboarding-Checklisten, jüngste zuerst; leer heisst: es gibt keine. */
onboarding: Checkliste[];
/** Die Offboarding-Checklisten, jüngste zuerst; leer heisst: es gibt keine. */
@@ -71,7 +74,7 @@ const ALLE_TABS = ["Stammdaten", "Vertrag", "Organisation", "Onboarding", "Offbo
type Tab = (typeof ALLE_TABS)[number];
export function EmployeeDetail(props: EmployeeDetailProps) {
const { employee, placement, breadcrumb, kostenstelle, onboarding, offboarding, manager, formalManager, directReports, history, dependents, notes, locations, openPositions, today } = props;
const { employee, placement, breadcrumb, kostenstelle, stellenverlauf, onboarding, offboarding, manager, formalManager, directReports, history, dependents, notes, locations, openPositions, today } = props;
// Wer aus „Anstehend" kommt, will den Vorgang sehen und nicht die
// Stammdaten — die Übersicht verlinkt deshalb mit ?tab=. Unbekanntes führt
// auf die Stammdaten.
@@ -247,6 +250,7 @@ export function EmployeeDetail(props: EmployeeDetailProps) {
directReports={directReports}
breadcrumb={breadcrumb}
kostenstelle={kostenstelle}
stellenverlauf={stellenverlauf}
/>
)}
{tab === "Onboarding" && (

View File

@@ -2,7 +2,8 @@ import { Network } from "lucide-react";
import Link from "next/link";
import { Avatar } from "@/components/ui/Avatar";
import { LINK_BUTTON_CLASS } from "@/components/ui/Button";
import { fmtName } from "@/lib/format";
import { fmtDate, fmtName } from "@/lib/format";
import type { StellenAbschnitt } from "@/lib/stellenverlauf";
type MiniEmployee = { id: string; first_name: string; last_name: string; job_title: string; status?: string };
@@ -19,6 +20,8 @@ type OrganisationTabProps = {
* hat die Person keine laufende Besetzung (geplanter Eintritt, Austritt).
*/
kostenstelle: { code: string; name: string } | null;
/** Alle Besetzungen, jüngste zuerst. */
stellenverlauf: StellenAbschnitt[];
};
// Die Niederlassung steht fachlich bewusst nicht hier neben Einheit und
@@ -31,6 +34,7 @@ export function OrganisationTab({
directReports,
breadcrumb,
kostenstelle,
stellenverlauf,
}: OrganisationTabProps) {
return (
<div className="flex flex-col gap-6">
@@ -104,6 +108,49 @@ export function OrganisationTab({
<p className="text-sm text-ink-muted">Keine direkten Berichte.</p>
)}
</div>
<div>
<h3 className="mb-2 text-xs font-semibold uppercase tracking-wide text-ink-muted">Stellenverlauf</h3>
{stellenverlauf.length > 0 ? (
<div className="overflow-x-auto">
<table className="w-full text-sm">
<thead>
<tr className="border-b border-border text-left text-[11px] font-bold uppercase tracking-wider text-ink-muted">
<th className="py-2 pr-4">Von</th>
<th className="py-2 pr-4">Bis</th>
<th className="py-2 pr-4">Planstelle</th>
<th className="py-2 pr-4">Organisationseinheit</th>
<th className="py-2 pr-4">Kostenstelle</th>
<th className="py-2">Anlass</th>
</tr>
</thead>
<tbody>
{stellenverlauf.map((s) => (
<tr key={`${s.von}-${s.planstelle}`} className={`border-b border-border-subtle align-top ${s.laufend ? "font-semibold text-ink" : "text-ink-body"}`}>
<td className="whitespace-nowrap py-2 pr-4 tabular-nums">{fmtDate(s.von)}</td>
<td className="whitespace-nowrap py-2 pr-4 tabular-nums">{s.bis ? fmtDate(s.bis) : "–"}</td>
<td className="py-2 pr-4">
<span className="tabular-nums">{s.planstelle}</span>
<span className="font-normal text-ink-muted"> · {s.taetigkeit}</span>
{s.leitung && <span className="font-normal text-ink-muted"> (Leitung)</span>}
</td>
<td className="py-2 pr-4">{s.einheit ?? "–"}</td>
<td className="py-2 pr-4 tabular-nums" title={s.kostenstelle?.name}>
{s.kostenstelle ? s.kostenstelle.code : "–"}
</td>
<td className="py-2 font-normal">{s.anlass ?? "–"}</td>
</tr>
))}
</tbody>
</table>
{/* Bis ist der letzte Tag auf der Stelle; der nächste Abschnitt
beginnt am Tag danach. Fett steht die Besetzung zum Stichtag
der Akte. */}
</div>
) : (
<p className="text-sm text-ink-muted">Keine Planstellenbesetzung erfasst.</p>
)}
</div>
</div>
);
}