Offer supply suggestions, drop the circuit column, center cells

The Versorgung field suggests ELT and MSR (plus values already used in
the balance) through a datalist and still accepts free text. The circuit
number column is not needed in early design phases; it is removed from
the data model, the regenerated migration 0010, the editor and the
print. All cells are centered except "Verbraucher / Flächen", group
titles and total labels.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Grovy311 2026-09-26 17:56:53 +02:00
parent e06c7d91e2
commit 72189d23a5
12 changed files with 60 additions and 42 deletions

View file

@ -18,7 +18,6 @@ export const estimateTextLimits = {
groupTitle: 200,
groupEditor: 100,
supply: 50,
circuitRef: 50,
rowName: 200,
remark: 500,
} as const;
@ -34,7 +33,6 @@ export function createEstimateRow(
id: createId(),
sortOrder,
supply: null,
circuitRef: null,
name: "",
quantity: 1,
unit: "piece",
@ -257,7 +255,6 @@ export function toSaveableEstimateBalance(
id: row.id,
sortOrder: row.sortOrder,
supply: optionalText(row.supply),
circuitRef: optionalText(row.circuitRef),
name: requiredText(row.name),
quantity: row.quantity,
unit: row.unit,

View file

@ -50,8 +50,12 @@ interface EstimateBalanceSheetProps {
}
// Leading columns up to cos φ; the power columns follow.
const LEADING_COLUMN_COUNT = 10;
const COLUMN_COUNT = 17;
const LEADING_COLUMN_COUNT = 9;
const COLUMN_COUNT = 16;
/** Suggested supply values; free text stays possible. */
const SUPPLY_SUGGESTIONS = ["ELT", "MSR"];
const SUPPLY_LIST_ID = "estimate-supply-options";
function NumberInput({
ariaLabel,
@ -85,9 +89,17 @@ function NumberInput({
);
}
function supplyOptions(balance: EstimateBalanceSnapshot): string[] {
const used = balance.groups.flatMap((group) =>
group.rows.map((row) => row.supply?.trim() ?? "")
);
return [...new Set([...SUPPLY_SUGGESTIONS, ...used.filter(Boolean)])];
}
function TextInput({
ariaLabel,
disabled,
list,
maxLength,
onChange,
placeholder,
@ -95,6 +107,7 @@ function TextInput({
}: {
ariaLabel: string;
disabled: boolean;
list?: string;
maxLength: number;
onChange: (value: string) => void;
placeholder?: string;
@ -106,6 +119,7 @@ function TextInput({
aria-label={ariaLabel}
className="estimate-cell-input"
disabled={disabled}
list={list}
maxLength={maxLength}
onChange={(event) => onChange(event.target.value)}
placeholder={placeholder}
@ -189,22 +203,14 @@ function EstimateRowLine({
<TextInput
ariaLabel={`Versorgung (${rowLabel})`}
disabled={disabled}
list={SUPPLY_LIST_ID}
maxLength={estimateTextLimits.supply}
onChange={(supply) => patch({ supply })}
placeholder="ELT"
value={row.supply}
/>
</td>
<td>
<TextInput
ariaLabel={`Stromkreis-Nr. (${rowLabel})`}
disabled={disabled}
maxLength={estimateTextLimits.circuitRef}
onChange={(circuitRef) => patch({ circuitRef })}
value={row.circuitRef}
/>
</td>
<td>
<td className="estimate-name-cell">
<TextInput
ariaLabel={`Verbraucher / Fläche (${rowLabel})`}
disabled={disabled}
@ -384,11 +390,15 @@ export function EstimateBalanceSheet({
return (
<div className="estimate-sheet-wrap">
<datalist id={SUPPLY_LIST_ID}>
{supplyOptions(balance).map((supply) => (
<option key={supply} value={supply} />
))}
</datalist>
<table className="estimate-sheet">
<colgroup>
<col className="estimate-col-kg" />
<col className="estimate-col-supply" />
<col className="estimate-col-circuit" />
<col className="estimate-col-name" />
<col className="estimate-col-quantity" />
<col className="estimate-col-unit" />
@ -409,9 +419,8 @@ export function EstimateBalanceSheet({
<th rowSpan={2}>KG</th>
<th rowSpan={2}>
Versorgung
<span className="estimate-th-hint">ELT/ISP …</span>
<span className="estimate-th-hint">ELT/MSR …</span>
</th>
<th rowSpan={2}>Stromkreis-Nr.</th>
<th rowSpan={2}>Verbraucher / Flächen</th>
<th colSpan={2}>
Anzahl / Fläche