[158] Raumbuch: Nutzung und Oberflächen je Raum (Boden/Wand/Decke, Aufbau), Raum-Belag im Grundriss statt Deckenbelag, Nassraum aus Nutzung, Belagszeile im Stempel, Objekt-Info, Liste/Blatt-Tabelle/CSV, Mengen, IFC-Psets mit Rundreise

This commit is contained in:
Claude committed 2026-11-07 16:31:05 +00:00
1 parent 58fd92b6ce
commit ef9a651781
27 files changed
+1406 -26

No files matched your search

+74
View File
@@ -33,7 +33,9 @@ import type {
Dormer,
DormerKind,
DrawingLevel,
Project,
RoofShape,
Room,
SiaCategory,
SliceTermination,
StairShape,
@@ -46,6 +48,7 @@ import type {
WallReferenceLine,
} from "../model/types";
import { SIA_CATEGORIES, siaLabelFull, surfaceOpeningInfo } from "../core";
import { ROOM_USAGES, roomBook, usageLabel } from "../core";
import type { EdgeSpec, RoofEdge } from "../core";
import { Dropdown } from "../ui/Dropdown";
import type { DetailLevel } from "../model/viewTypes";
@@ -465,6 +468,9 @@ export function RoomSection({
<span className="objinfo-fval">{room.floorName}</span>
</div>
{/* [158] Raumbuch: Nutzung und Oberflächen. */}
<RoomFinishFields roomId={roomId} host={host} />
{/* Stempel bearbeiten (öffnet den Rich-Text-Editor). */}
<button
type="button"
@@ -477,6 +483,74 @@ export function RoomSection({
);
}
type RoomFinishField = "floorFinish" | "wallFinish" | "ceilingFinish" | "floorBuildUp";
/** [158] Nutzung (Nassraum abgeleitet) und Oberflächen Boden/Wand/Decke (Material aus dem Projekt oder
* Freitext; ein eingegebener Material-Name wird als Verweis gespeichert) und Bodenaufbau. */
function RoomFinishFields({ roomId, host }: { roomId: string; host: ReturnType<typeof usePanelHost> }) {
const applyChange = useStore((s) => s.applyChange);
const project = host.project;
const room = (project.rooms ?? []).find((r) => r.id === roomId);
if (!room) return null;
const comps = project.components;
const listId = `room-finish-materials-${roomId}`;
const shown = (v: string | undefined) => comps.find((c) => c.id === v)?.name ?? v ?? "";
const set = (field: RoomFinishField | "usage", value: string | undefined) =>
applyChange((p: Project) => patchItem(p, "rooms", roomId, { [field]: value } as Partial<Room>), `room:${roomId}:${field}`);
const setFinish = (field: RoomFinishField, text: string) => {
const v = text.trim();
if (!v) return set(field, undefined);
const comp = field === "floorBuildUp" ? undefined : comps.find((c) => c.name.trim() === v);
set(field, comp ? comp.id : text);
};
// Nassraum wie im Kern (Nutzung, sonst Name), für [156] „Nassräume" im Grundriss.
const wet = roomBook(project).rows.find((r) => r.id === roomId)?.wet ?? false;
const finishInput = (field: RoomFinishField, label: TranslationKey) => (
<div className="objinfo-field">
<span className="objinfo-flabel">{t(label)}</span>
<input
type="text"
className="objinfo-text"
list={field === "floorBuildUp" ? undefined : listId}
value={shown(room[field])}
placeholder={field === "floorBuildUp" ? undefined : t("objinfo.room.finishHint")}
onChange={(e) => setFinish(field, e.target.value)}
title={t(label)}
/>
</div>
);
return (
<>
<div className="objinfo-field">
<span className="objinfo-flabel">{t("objinfo.room.usage")}</span>
<Dropdown
value={room.usage ?? ""}
onChange={(v) => set("usage", v || undefined)}
options={[{ value: "", label: t("objinfo.room.usageNone") }, ...ROOM_USAGES.map((u) => ({ value: u, label: usageLabel(u) }))]}
title={t("objinfo.room.usage")}
width={170}
/>
</div>
{wet && (
<div className="objinfo-field">
<span className="objinfo-flabel">{t("objinfo.room.wet")}</span>
<span className="objinfo-fval">✓</span>
</div>
)}
<div className="objinfo-section-label">{t("objinfo.room.finishes")}</div>
<datalist id={listId}>
{comps.map((c) => (
<option key={c.id} value={c.name} />
))}
</datalist>
{finishInput("floorFinish", "objinfo.room.floorFinish")}
{finishInput("wallFinish", "objinfo.room.wallFinish")}
{finishInput("ceilingFinish", "objinfo.room.ceilingFinish")}
{finishInput("floorBuildUp", "objinfo.room.buildUp")}
</>
);
}
// ── Schnitt-/Ansichtslinien-Abschnitt (Object-Info; nur die gewählte Linie) ──
// Name (editierbar), Blickrichtung umkehren (directionSign-Flip), Endpunkt-
// Koordinaten (editierbar) + Schnitt-Tiefe; Löschen setzt linePoints zurück
+4
View File
@@ -16,6 +16,7 @@ import { KennzahlenSection } from "./KennzahlenSection";
import { AreaTableSection } from "./AreaTableSection";
import { OpeningScheduleSection } from "./OpeningScheduleSection";
import { ElementScheduleSection } from "./ElementScheduleSection";
import { RoomBookSection } from "./RoomBookSection";
import { downloadCsv } from "./downloadFile";
/** Löst je Raum die anrechenbare (Netto-)Fläche + Kategorie auf. */
@@ -87,6 +88,9 @@ export function RoomBalancePanel() {
{/* Bauteilliste mit U-Werten ([71]). */}
<ElementScheduleSection />
{/* Raumbuch: Oberflächen je Raum ([158]). */}
<RoomBookSection />
{/* Raumliste (je Raum: Name · Geschoss · SIA · Fläche). */}
<div className="balance-section-label">{t("balance.rooms")}</div>
<div className="balance-table">
+109
View File
@@ -0,0 +1,109 @@
// [158] Raumbuch im Flächenbilanz-Panel: eine Zeile je Raum mit Geschoss, Nummer, Name, Fläche, Nutzung und
// den Oberflächen (Boden, Wand, Decke), dazu die Mengen je Material. Die Zeilen rechnet der Kern
// (`roomBook`); bearbeitet werden die Angaben in der Objekt-Info des Raums. CSV und PDF kommen aus
// demselben Berichtsmodell wie die Fenster-/Türliste.
import { useMemo } from "react";
import { t } from "../i18n";
import { usePanelHost } from "./host";
import { areaReportToCsv, buildAreaReportPdf, buildRoomBookReport, roomBook, usageLabel } from "../core";
import { downloadCsv } from "./downloadFile";
import { useStore } from "../state/appStore";
const m2 = (v: number) => v.toFixed(2);
export function RoomBookSection() {
const project = usePanelHost().project;
const notify = useStore((s) => s.notify);
const book = useMemo(() => roomBook(project), [project]);
const stem = `${project.name || "projekt"}-raumbuch`;
const exportPdf = () => {
try {
buildAreaReportPdf(buildRoomBookReport(project)).save(`${stem}.pdf`);
} catch {
notify(t("roomBook.exportPdf.fail"));
}
};
return (
<div className="area-section opening-section">
<div className="balance-head">
<span className="balance-section-label">{t("roomBook.title")}</span>
{book.rows.length > 0 && (
<span className="area-actions">
<button type="button" className="balance-export" onClick={() => downloadCsv(`${stem}.csv`, areaReportToCsv(buildRoomBookReport(project)))}>
{t("roomBook.exportCsv")}
</button>
<button type="button" className="balance-export" onClick={exportPdf}>
{t("roomBook.exportPdf")}
</button>
</span>
)}
</div>
{book.rows.length === 0 ? (
<div className="balance-empty">{t("roomBook.empty")}</div>
) : (
<div className="area-scroll">
<table className="area-table opening-table">
<thead>
<tr>
<th>{t("openings.col.floor")}</th>
<th>{t("roomBook.col.number")}</th>
<th>{t("sheetTable.col.room")}</th>
<th className="num">{t("sheetTable.col.area")}</th>
<th>{t("roomBook.col.usage")}</th>
<th>{t("roomBook.col.floorFinish")}</th>
<th>{t("roomBook.col.wallFinish")}</th>
<th>{t("roomBook.col.ceilingFinish")}</th>
<th className="num">{t("roomBook.col.clearHeight")}</th>
<th className="num">{t("roomBook.col.wallArea")}</th>
</tr>
</thead>
<tbody>
{book.rows.map((r) => (
<tr key={r.id}>
<td>{r.floor}</td>
<td>{r.number}</td>
<td>{r.name}</td>
<td className="num">{m2(r.area)}</td>
<td>{usageLabel(r.usage)}</td>
<td>{r.floorFinish}</td>
<td>{r.wallFinish}</td>
<td>{r.ceilingFinish}</td>
<td className="num">{m2(r.clearHeight)}</td>
<td className="num">{m2(r.wallArea)}</td>
</tr>
))}
</tbody>
</table>
{book.quantities.length > 0 && (
<table className="area-table opening-table">
<thead>
<tr>
<th>{t("roomBook.col.surface")}</th>
<th>{t("roomBook.col.finish")}</th>
<th className="num">{t("roomBook.col.rooms")}</th>
<th className="num">{t("sheetTable.col.area")}</th>
</tr>
</thead>
<tbody>
{book.quantities.map((q) => (
<tr key={`${q.surface}:${q.finish}`}>
<td>{t(`roomBook.surface.${q.surface}`)}</td>
<td>{q.finish}</td>
<td className="num">{q.rooms}</td>
<td className="num">{m2(q.area)}</td>
</tr>
))}
</tbody>
</table>
)}
</div>
)}
<ul className="area-notes">
<li>{t("roomBook.foot")}</li>
</ul>
</div>
);
}
+7
View File
@@ -220,6 +220,13 @@ export function RoomStampEditor({ value, onApply, onCancel }: RoomStampEditorPro
/>
</div>
<div className="roomstamp-row">
<label className="roomstamp-check">
<input type="checkbox" checked={draft.showFinish === true} onChange={(e) => patch({ showFinish: e.target.checked ? true : undefined })} />
<span>{t("roomStamp.showFinish")}</span>
</label>
</div>
<label className="roomstamp-field">
<span className="roomstamp-label">{t("roomStamp.occupancy")}</span>
<input