diff --git a/src/components/PlanView.tsx b/src/components/PlanView.tsx index a574e46..bb6e3f9 100644 --- a/src/components/PlanView.tsx +++ b/src/components/PlanView.tsx @@ -308,6 +308,7 @@ export function PlanView({ setSelected({ type: "phase", phaseId: col.phase.id })} active={selected?.type === "phase" && selected.phaseId === col.phase.id} /> @@ -596,9 +597,21 @@ function phaseCellContent(ce: ReturnType | un return ce.summary || "โ€“"; } -function PhaseHeader({ phase, onClick, active }: { phase: PhaseComputed; onClick: () => void; active: boolean }) { +function PhaseHeader({ + phase, + personLabel, + onClick, + active, +}: { + phase: PhaseComputed; + personLabel: (role: string) => string; + onClick: () => void; + active: boolean; +}) { const quotaLabel = phase.isConsumption ? "Verzehr" : "Sparquote"; - const quotaRemaining = Math.max(0, phase.quotaRemaining); + const quotaTarget = Math.abs(phase.quota); + const quotaPct = quotaTarget > 0 ? Math.round((phase.quotaAllocated / quotaTarget) * 100) : 100; + const distributedWord = phase.isConsumption ? "gedeckt" : "verteilt"; return ( {phase.durationYears} J. - Alter {phase.persons.map((p) => p.startAge).join("/")}
+ {phase.persons.map((p) => ( +
+ {personLabel(p.role)} {p.startAge} โ†’ {p.endAge} +
+ ))}
Einkommen {formatChf(phase.incomeTotal)}
Ausgaben {formatChf(phase.expenseTotal)}
- {quotaLabel} {formatChf(Math.abs(phase.quota))} - {!phase.quotaComplete && ยท offen {formatChf(quotaRemaining)}} + {quotaLabel} {formatChf(quotaTarget)} ({quotaPct}% {distributedWord}) +
+
+ Vermoegen {formatChf(phase.startWealthNominal)} โ†’ {formatChf(phase.endWealthNominal)}
Kapital {phase.availableCapital === null ? "n.a." : formatChf(phase.availableCapital)}