// [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 { exportProjectName, areaReportToCsv, buildAreaReportPdf, buildRoomBookReport, hasSlope, 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 = useStore((s) => s.project); const notify = useStore((s) => s.notify); const book = useMemo(() => roomBook(project), [project]); const sloped = book.rows.some(hasSlope); const stem = `${exportProjectName(project) || "projekt"}-raumbuch`; const exportPdf = () => { try { buildAreaReportPdf(buildRoomBookReport(project)).save(`${stem}.pdf`); } catch { notify(t("roomBook.exportPdf.fail")); } }; return (
{t("roomBook.title")} {book.rows.length > 0 && ( )}
{book.rows.length === 0 ? (
{t("roomBook.empty")}
) : (
{sloped && ( <> )} {book.rows.map((r) => ( {sloped && ( <> )} ))}
{t("openings.col.floor")} {t("roomBook.col.number")} {t("sheetTable.col.room")} {t("sheetTable.col.area")} {t("roomBook.col.usage")} {t("roomBook.col.floorFinish")} {t("roomBook.col.wallFinish")} {t("roomBook.col.ceilingFinish")} {t("roomBook.col.clearHeight")}{t("roomBook.col.heightMin")} {t("roomBook.col.heightMean")} {t("roomBook.col.areaUnder1")} {t("roomBook.col.area1To15")}{t("roomBook.col.wallArea")} {t("roomBook.col.reveals")} {t("roomBook.col.skirting")}
{r.floor} {r.number} {r.name} {m2(r.area)} {usageLabel(r.usage)} {r.floorFinish} {r.wallFinish} {r.ceilingFinish} {m2(r.clearHeight)}{m2(r.heightMin)} {m2(r.heightMean)} {m2(r.areaUnder1)} {m2(r.area1To15)}{m2(r.wallArea)} {m2(r.revealArea)} {m2(r.skirting)}
{book.quantities.length > 0 && ( {book.quantities.map((q) => ( ))}
{t("roomBook.col.surface")} {t("roomBook.col.finish")} {t("roomBook.col.rooms")} {t("sheetTable.col.area")}
{t(`roomBook.surface.${q.surface}`)} {q.finish} {q.rooms} {m2(q.area)}
)}
)}
); }