"use client"; import { roundEstimateValue, type EstimateComparison, } from "../../shared/estimate-balance/estimate-balance"; import { formatDeltaPercent, formatKw, formatSignedKw } from "./estimate-balance-format"; function deltaClass(deltaKw: number) { if (roundEstimateValue(deltaKw, 2) === 0) { return "estimate-number"; } return deltaKw > 0 ? "estimate-number is-over" : "estimate-number is-under"; } /** Estimated AV power per cost group vs. the detailed circuit-list rows. */ export function EstimateComparisonTable({ comparison }: { comparison: EstimateComparison }) { return (
{comparison.groups.map((group) => ( ))}
KG Titel geschätzt AV kW detailliert kW Δ kW Δ %
{group.costGroup} {group.title} {group.detailedRowCount ? ( {group.detailedRowCount === 1 ? "1 Gerätezeile" : `${group.detailedRowCount} Gerätezeilen`} ) : null} {formatKw(group.estimatedAv.kw)} {formatKw(group.detailed.kw)} {formatSignedKw(group.deltaKw)} {formatDeltaPercent(group.deltaPercent)}
ohne Kostengruppe / nicht zugeordnet {comparison.unassigned.rowCount ? ( {comparison.unassigned.rowCount === 1 ? "1 Gerätezeile" : `${comparison.unassigned.rowCount} Gerätezeilen`} ) : null} – {formatKw(comparison.unassigned.kw)} – –
Summe {formatKw(comparison.total.estimatedAv.kw)} {formatKw(comparison.total.detailed.kw)} {formatSignedKw(comparison.total.deltaKw)} {formatDeltaPercent(comparison.total.deltaPercent)}
); }