diff --git a/.gitignore b/.gitignore index e0ef1d2..a6e1ff5 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,3 @@ dist/ data/*.db data/backups/*.db .codex/*.log -dynamo/output/ diff --git a/AGENTS.md b/AGENTS.md index c00fd78..4298762 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -284,8 +284,16 @@ not change the project revision or undo/redo stacks. Restoring a server-stored snapshot verifies its checksum and the current-state hash, replaces supported project data atomically and records a new `restore` revision with a complete inverse command. Restore can therefore be undone and redone after a restart. -Current snapshot schema version 5 additionally stores the manual quantity share -of every CircuitDeviceRow. Version 4 snapshots are upgraded with +Current snapshot schema version 7 additionally stores the project buildings +and `floors[].buildingId` (see `docs/building-structure.md`); versions 1 to 6 +are upgraded with no buildings and `buildingId = null`. Version 6 stores the +distribution-board info fields `boardNumber`, `location`, `fedFrom` and +`remark` and the project cover fields `siteAddress`, `workStage`, +`projectLead` and `projectEditor`; all older supported versions are upgraded +with `null` for these fields. +Stored named and automatic snapshots of every supported version (1 to 7) +remain restorable; they are upgraded while parsing. Version 5 stores +the manual quantity share of every CircuitDeviceRow. Version 4 snapshots are upgraded with `manualQuantity = quantity`; they already contain the complete confirmed external-model source, import batches, room mappings and objects. Version 3 snapshots are upgraded with an empty external-model state; version 2 snapshots @@ -299,7 +307,7 @@ project graph. Project-wide Revit CSV configuration uses `external-csv-configuration.update`. Its complete expected/target snapshot is persisted through the shared project-command transaction, so create, update, -delete, Undo and Redo are revision-safe. Snapshot schema 5, restore and portable +delete, Undo and Redo are revision-safe. Snapshot schema 5-7, restore and portable project duplication preserve the configuration; duplication remaps its internal id and project link. The project page exposes the Revit CSV modal. It edits the complete @@ -313,7 +321,7 @@ immutable import batches with original bytes plus the classified cell matrix, normalized source-room mappings and external objects unique by `(sourceId, ifcGuid)`. Source values, planning values and overrides are separate. The general external-model repository is read-only; runtime writes belong only -to typed command adapters. Snapshot/restore and portable project transfer schema version 5 +to typed command adapters. Snapshot/restore and portable project transfer schema version 5/6 capture the complete external state and remap every internal UUID and link while preserving IFCGUIDs, source values, original bytes and the classified matrix. Import batches additionally store the monotonic project CSV configuration @@ -402,6 +410,10 @@ Project settings use the persistent `project.update-settings` command. Project metadata, the public-building classification, both voltage defaults and the enabled distribution-board supply types change in one revision and Undo/Redo restores them together; the project PUT route requires `expectedRevision`. +Schema version 3 additionally carries the print cover fields `siteAddress`, +`workStage`, `projectLead` and `projectEditor` (migration `0008`); version 2 +(without them) and baseline version 1 stay executable and keep the current +cover values. The PUT route accepts the cover fields optionally. The public-building flag is the future sizing input for requiring halogen-free cables and lines. The system catalog is `AV`, `SV`, `EV`, `USV`, `MSR`, `SiBe`; at least one must be enabled and a type used by a board @@ -456,6 +468,18 @@ the only supported circuit-protection source; no flat compatibility fields remai Distribution-board floor assignment and a project-enabled supply type use `distribution-board.update`; both values are snapshot/export fields and one persistent undo step. +The same command (still schema version 1, additively extended) carries the +board info-card fields `boardNumber`, `location`, `fedFrom` and `remark` +(migration `0007`). They are nullable, trimmed planner values; the PUT route +only includes submitted info fields in the command and its inverse. An empty +board with info values is no longer an unchanged setup, so history deletion of +it is rejected like a changed simultaneity factor. Populated-subtree commands +stored before these fields existed are normalized to `null` values +(`normalizeDistributionBoardSubtreeSnapshot`). `fedFrom` is deliberately free +text: the logical link to the feeding board/circuit is an open design decision. +These fields are intended to be prefillable from Revit parameters later, but +only through the Phase 14 rules (preview, explicit confirmation, no silent +overwrite). Floor and room setup uses persistent insert, update and delete commands with complete stable snapshots. Their inverses remove or restore only unchanged records and reject floors with assigned rooms/distribution boards or rooms referenced by @@ -477,8 +501,49 @@ Required operations: - synchronization changes +## Print View (Seitenansicht) + +- Route `src/app/projects/[projectId]/print/page.tsx`, opened from the project + page button "Seitenansicht". Read-only: it only uses existing GET endpoints. +- Pure read model `src/frontend/print/print-document-model.ts` (tested in + `tests/print-document-model.test.ts`); React sheets in + `src/frontend/print/print-document.tsx`; styles scoped to `.print-view` in + `src/frontend/print/print-document.css`. +- Pages: cover (A4 portrait, tabular), board overview with structure and + power sums, one plan per board (A4/A3 landscape) whose title block sits in + `` so it repeats on printed pages. PDF export uses the browser print + dialog; page size, margins and "Seite x von y" come from injected named + `@page` rules (`lb-portrait`, `lb-landscape`). +- The board hierarchy and "Σ inkl. unterlagert" in the overview are + PRELIMINARY (text match of `fedFrom` against board number/name, plain sum, + no upstream simultaneity factor). Replace this once the feed link is modeled. +- Colors/fonts follow the kbp corporate design (`--pd-*` variables in + `print-document.css`). Empty cover values are shown as + "[ergänzen]"; the Planstände editor column shows the project's current + `projectEditor` because snapshots do not record an editor. +- The document logo and the office profile (office name/address on the + cover) are global office branding: tables `document_branding_assets` + (migration `0007`) and `document_branding_settings` (migration `0008`), + endpoints `GET|PUT|DELETE /api/document-branding/logo`, + `PUT /api/document-branding/office` and `GET /api/document-branding`. + It is intentionally outside project revisions, snapshots and transfer. + Uploads are PNG/JPEG/SVG up to 2 MB with a content signature check; the logo + is served with `nosniff` and a restrictive CSP. + ## Revit / CSV External Model Work +Status: further Revit work (editor assignment UI, follow-up import, return +export) is deferred and will be tackled later. When it resumes, the exchange +stays CSV-based and uses the CSV export/import of the Linear plugin in Revit. +The internal Revit/CAD steering committee prefers this over manipulating the +model directly through Dynamo. Do not start Dynamo, Revit API or JSON +transport work. The Linear CSV layout is not yet known: check a sample export +against the existing project CSV configuration before changing the parser. +Earlier Dynamo considerations are archived in +`docs/archive/revit-dynamo-leistungsbilanz-integration-konzept.md`; the +removed diagnostic scripts remain reachable through the git tag +`archive/dynamo-vorueberlegungen`. + When explicitly working on Phase 14, use `docs/spec/revit-csv-integration-requirements.md` as the detailed source of truth together with the current architecture documents. @@ -567,11 +632,15 @@ Users must be able to override sizing suggestions. ## Current Deferred Work -- Revit/CSV/IFCGUID round-trip, except when Phase 14 is explicitly requested and +- Revit/CSV/IFCGUID round-trip (deferred; later via Linear plugin CSV, never + Dynamo), except when Phase 14 is explicitly requested and `docs/spec/revit-csv-integration-requirements.md` is being followed - full electrical sizing - multi-user/PostgreSQL operation - supported production deployment +- logical feed link between distribution boards (`fedFrom` stays free text + until the project owner decides whether it references a board, a feeding + circuit or both) and the resulting hierarchical power summation Do not implement these while working on an unrelated phase. diff --git a/README.md b/README.md index 55c4f65..b3c026e 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,9 @@ Docker-Server-Stack mit gebautem Anwendungscode und ein separater Entwicklungsstack bereit. Ein vollständig unterstütztes Produktionsdeployment und Mehrbenutzerbetrieb fehlen weiterhin. Revit-CSV-Konfiguration, Vorschau und bestätigter Erstimport sind implementiert; die Editoroberfläche zur -Objektzuordnung, Folgeimporte und Rückexport stehen noch aus. +Objektzuordnung, Folgeimporte und Rückexport stehen noch aus. Die weitere +Revit-Arbeit ist zurückgestellt und erfolgt später über den CSV-Export/-Import +des Linear-Plugins in Revit. ## Unterstützter Arbeitsablauf @@ -27,6 +29,8 @@ Objektzuordnung, Folgeimporte und Rückexport stehen noch aus. - Änderungen projektweit und auch nach einem Reload rückgängig machen und wiederholen - benannte Sicherungspunkte anlegen, wiederherstellen und Revisionen einsehen - automatische Sicherungspunkte mit begrenzter Aufbewahrung nutzen +- Seitenansicht mit Deckblatt, Verteilerübersicht und Verteilerplänen öffnen + und über den Browser als PDF drucken; Büroangaben und Logo zentral pflegen - Revit-CSV-Dateien konfigurieren, prüfen und nach expliziter Zuordnung von Räumen, Verteilungen und Projektgeräten erstmals importieren; dabei entstehen noch keine Stromkreise oder Gerätezeilen @@ -147,6 +151,7 @@ vor der Baseline werden nicht unterstützt. - [Aktuelle Architektur](docs/current-architecture.md) - [Editor-Interaktionen](docs/circuit-list-editor-interactions.md) - [API des Stromkreislisten-Editors](docs/circuit-list-editor-api.md) +- [Seitenansicht und PDF-Export](docs/print-view.md) - [Entwicklungs- und Contributor-Workflow](docs/development-workflow.md) - [Bekannte Einschränkungen](docs/circuit-list-editor-known-limitations.md) - [Roadmap](docs/spec/07-implementation-phases-todo.md) diff --git a/docs/README.md b/docs/README.md index 69a2115..4f84717 100644 --- a/docs/README.md +++ b/docs/README.md @@ -12,6 +12,10 @@ ausdrücklich getrennt und dürfen nicht als bereits implementiert verstanden we fachliches Modell und Grid-Aufteilung - [Editor-Interaktionen](circuit-list-editor-interactions.md) – Tastatur, Drag-and-drop, Sortierung, Filterung und Undo/Redo +- [Seitenansicht und PDF-Export](print-view.md) – Deckblatt, + Verteilerübersicht, Verteilerpläne, Büro-Logo +- [Gebäudestruktur](building-structure.md) – Gebäude → Etagen → Räume, + Befehle, Snapshot-Schema 7, eigene Seite - [Editor-API](circuit-list-editor-api.md) – unterstützte Circuit-First-Endpunkte - [Bekannte Einschränkungen](circuit-list-editor-known-limitations.md) – bewusst noch nicht implementierte oder begrenzte Funktionen @@ -25,7 +29,8 @@ ausdrücklich getrennt und dürfen nicht als bereits implementiert verstanden we - [Projektversionen und externer Modellaustausch](project-history-and-external-model-architecture.md) - [LLM-Kontext für die Revit-Anforderungsplanung](revit-requirements-llm-context.md) -- [Revit-CSV-Anforderungen](spec/revit-csv-integration-requirements.md) +- [Revit-CSV-Anforderungen](spec/revit-csv-integration-requirements.md) – + zurückgestellt; später über den CSV-Export/-Import des Linear-Plugins - [Phase-14-Audit und Implementierungsplan](spec/revit-csv-phase-14-audit-and-plan.md) - [Zukünftige Dimensionierung](spec/06-future-sizing-and-calculations.md) - [Roadmap und Phasen](spec/07-implementation-phases-todo.md) @@ -48,3 +53,6 @@ Limitierungen und Roadmap. - [Frühe Codex-Promptvorlagen](archive/initial-codex-prompts.md) – historischer Arbeitsstand, keine aktuelle Implementierungsanweisung +- [Revit-/Dynamo-Anbindung](archive/revit-dynamo-leistungsbilanz-integration-konzept.md) – + nicht weiterverfolgte Vorüberlegung zur direkten Dynamo-/API-Anbindung; + Diagnoseskripte über den Git-Tag `archive/dynamo-vorueberlegungen` diff --git a/docs/archive/revit-dynamo-leistungsbilanz-integration-konzept.md b/docs/archive/revit-dynamo-leistungsbilanz-integration-konzept.md new file mode 100644 index 0000000..aa0ae97 --- /dev/null +++ b/docs/archive/revit-dynamo-leistungsbilanz-integration-konzept.md @@ -0,0 +1,1152 @@ +# Revit-/Dynamo-Anbindung an die Leistungsbilanz + +> **Archiviert (September 2026), keine aktuelle Implementierungsanweisung.** +> Die direkte Revit-Anbindung über Dynamo/Python, Revit-API und JSON wird nicht +> weiterverfolgt. Die weitere Revit-Arbeit ist zurückgestellt und erfolgt, wenn +> sie wieder aufgenommen wird, über den CSV-Export/-Import des Linear-Plugins +> in Revit. Siehe +> [Revit-CSV-Anforderungen](../spec/revit-csv-integration-requirements.md). +> Die zugehörigen Dynamo-Diagnoseskripte sind über den Git-Tag +> `archive/dynamo-vorueberlegungen` erreichbar. + +## Zweck dieses Dokuments + +Dieses Dokument beschreibt den aktuellen Stand und die gewünschte Zielrichtung für die Anbindung von Revit an die Leistungsbilanz-App. + +Es soll als Arbeitsgrundlage für Codex dienen. Codex soll **zuerst die bestehende Architektur des Repositories analysieren** und danach konkrete Vorschläge für: + +1. die API-Struktur der Leistungsbilanz, +2. das Austauschformat zwischen Revit und Leistungsbilanz, +3. die benötigten Dynamo-/Python-Skripte, +4. die Synchronisationslogik Revit → Leistungsbilanz, +5. die spätere Rückrichtung Leistungsbilanz → Revit + +erarbeiten. + +Die nachfolgend genannten Klassennamen, Endpoints und DTOs sind **Vorschläge und keine zwingenden Vorgaben**. Sie sollen an die tatsächlich vorhandene Architektur angepasst werden. + +--- + +# 1. Ausgangssituation + +Die Leistungsbilanz-App soll Daten aus Revit übernehmen können. + +Ursprünglich war dafür ein CSV-basierter Import vorgesehen, weil Revit-Bauteillisten nativ als CSV exportiert werden können. + +Inzwischen ist klar, dass Dynamo mit Python genutzt werden kann und damit ein direkter Zugriff auf die Revit API möglich ist. + +Dadurch ist eine wesentlich sauberere direkte Integration möglich. + +Die CSV-Schnittstelle soll deshalb **nicht zwingend entfallen**, aber künftig eher als: + +- manueller Importweg, +- Fallback, +- allgemeine Austauschmöglichkeit, +- Debug-/Testformat + +verstanden werden. + +Die primäre Revit-Integration soll perspektivisch über eine **versionierte API mit JSON als Austauschformat** erfolgen. + +--- + +# 2. Aktueller Dynamo-Stand + +Ein erster Dynamo-Python-Test funktioniert bereits. + +Aktuell werden über die Revit API alle Exemplare der Kategorie: + +```text +BuiltInCategory.OST_ElectricalFixtures +``` + +also Revit **Elektroinstallationen / Electrical Fixtures** gesammelt. + +Für den aktuellen Entwicklungsstand soll bewusst zunächst **nur diese Kategorie** betrachtet werden. + +Andere Kategorien können später ergänzt werden. + +--- + +# 3. Bereits erfolgreich aus Revit gelesene Daten + +Der aktuelle Python-Ansatz kann bereits folgende Daten ausgeben: + +```text +ElementId +UniqueId +Familie +Typ +MEP_Raumnummer +MEP_Raumname +IFC_GUID +``` + +Die Zuordnung zum MEP-Raum erfolgt über den zum FamilyInstance gehörenden MEP Space. + +Der aktuelle Test zeigt, dass das grundsätzliche Auslesen über Dynamo/Python funktioniert. + +--- + +# 4. Relevante Identitäten + +Für die Kopplung zwischen Revit und Leistungsbilanz sollen mehrere Identifikatoren berücksichtigt werden. + +## 4.1 Revit UniqueId + +Die `UniqueId` soll die primäre Revit-seitige Elementidentität darstellen. + +Sie sollte für die dauerhafte Zuordnung eines Revit-Elements verwendet werden. + +Beispiel: + +```text +revitUniqueId = "0a52cc55-..." +``` + +--- + +## 4.2 ElementId + +Die Revit `ElementId` soll ebenfalls übertragen werden. + +Sie ist nützlich für: + +- Debugging, +- Fehlersuche, +- Anzeige für den Anwender, +- direkte Suche eines Elements in Revit. + +Sie soll aber **nicht als alleiniger persistenter Schlüssel** zwischen den Systemen verwendet werden. + +--- + +## 4.3 IFC GUID + +Die IFC GUID soll ebenfalls mitgeführt werden, sofern sie im Revit-Modell vorhanden ist. + +Damit entsteht perspektivisch eine Verbindung: + +```text +Revit + ↕ UniqueId +Leistungsbilanz + ↕ IFC GUID +IFC +``` + +Die IFC GUID ist damit insbesondere für spätere IFC-basierte Integrationen relevant. + +--- + +# 5. Zusätzlich benötigte Modellidentität + +Die `UniqueId` identifiziert ein Element innerhalb eines Revit-Modells. + +Deshalb benötigt die Leistungsbilanz zusätzlich eine stabile Identität des Revit-Modells. + +Vorgeschlagener Schlüssel: + +```text +revitModelId +``` + +Beispiel: + +```text +550e8400-e29b-41d4-a716-446655440000 +``` + +Diese ID darf nicht ausschließlich aus folgenden Informationen erzeugt werden: + +```text +Dateiname +Dateipfad +lokaler Speicherort +``` + +da sich diese ändern können. + +Mögliche Speicherorte in Revit: + +### Variante A – Projektparameter + +Zum Beispiel: + +```text +LB_ProjectId +LB_ModelId +``` + +Vorteile: + +- einfach umzusetzen, +- sichtbar, +- leicht zu debuggen, +- direkt über Dynamo lesbar. + +### Variante B – Revit Extensible Storage + +Langfristig eleganter, weil integrationsspezifische Metadaten unsichtbar im Modell gespeichert werden können. + +Beispielsweise: + +```text +LeistungsbilanzConnector +{ + modelId + projectId + lastSync +} +``` + +Für einen ersten Prototyp ist ein Projektparameter wahrscheinlich ausreichend. + +--- + +# 6. Grundprinzip der Zielarchitektur + +Die Revit-Schnittstelle soll nicht direkt an interne Datenbanktabellen gekoppelt werden. + +Empfohlen wird: + +```text +┌──────────────────────────── REVIT ────────────────────────────┐ +│ │ +│ Revit API │ +│ ↓ │ +│ Dynamo + Python │ +│ ↓ │ +│ Revit-Adapter │ +│ ↓ │ +│ definiertes Austauschmodell │ +│ ↓ │ +│ JSON │ +│ │ +└───────────────────────┬───────────────────────────────────────┘ + │ + │ HTTP / REST + ▼ +┌──────────────────── LEISTUNGSBILANZ ──────────────────────────┐ +│ │ +│ Revit Integration API │ +│ ↓ │ +│ Import-/Sync-Service │ +│ ↓ │ +│ persistierte Revit-Referenz │ +│ ↓ │ +│ Zuordnung zu DeviceRow / Circuit / bestehendem Datenmodell │ +│ │ +└───────────────────────────────────────────────────────────────┘ +``` + +Wichtig: + +> JSON ist das Austauschformat. HTTP ist nur der Transportweg. + +Dasselbe Datenmodell soll deshalb bei Bedarf auch als JSON-Datei gespeichert und eingelesen werden können. + +--- + +# 7. Austauschmodell / DTO + +Es soll ein klar definiertes und versioniertes Austauschformat geben. + +Beispiel: + +```json +{ + "schemaVersion": 1, + "source": "revit", + "model": { + "id": "550e8400-e29b-41d4-a716-446655440000", + "name": "26009_F60_ELT" + }, + "elements": [ + { + "uniqueId": "f4d3c...", + "elementId": 471123, + "ifcGuid": "2X9...", + "category": "Electrical Fixtures", + "family": "Steckdose JUNG LS990", + "type": "Schuko 1-fach", + "space": { + "number": "1.03", + "name": "Schlafen" + }, + "parameters": { + "power": 250, + "cosPhi": 0.95 + } + } + ] +} +``` + +Das tatsächliche Schema soll durch Codex anhand des bestehenden Datenmodells der Leistungsbilanz konkretisiert werden. + +--- + +# 8. Trennung zwischen Revit-Objekt und Leistungsbilanz-Objekt + +Ein Revit-Element soll **nicht direkt mit einer DeviceRow gleichgesetzt werden**. + +Das ist wichtig, weil: + +- Revit den geplanten Modellstand enthält, +- Nutzer Werte in der Leistungsbilanz überschreiben können, +- ein importiertes Revit-Element erst vom Nutzer einem bestehenden oder neuen Stromkreis bzw. einer DeviceRow zugeordnet werden kann, +- ein erneuter Sync keine bewussten Benutzeränderungen überschreiben darf. + +Konzeptionell sollte deshalb eine separate Revit-Referenz existieren. + +Beispiel: + +```text +RevitElement + │ + │ verknüpft mit + ▼ +LinkedDevice / Zuordnung + │ + ▼ +DeviceRow + │ + ▼ +Circuit +``` + +Die tatsächliche Umsetzung muss Codex mit der vorhandenen Architektur abgleichen. + +Mögliche Eigenschaften einer persistierten Revit-Referenz: + +```text +id +revitModelId +revitUniqueId +revitElementId +ifcGuid + +category +family +type + +spaceNumber +spaceName + +rawData +lastSeenAt +lastSyncAt +``` + +Die Bezeichnung `RevitElement` ist nur ein Vorschlag. + +Wenn es im aktuellen Datenmodell bereits eine passende Entität gibt, soll diese verwendet oder erweitert werden. + +--- + +# 9. Revit → Leistungsbilanz + +Der erste zu implementierende Sync soll in diese Richtung erfolgen. + +```text +Revit + ↓ +Dynamo + ↓ +Python / Revit API + ↓ +JSON Payload + ↓ +HTTP POST + ↓ +Leistungsbilanz API + ↓ +Sync-Service +``` + +## Vorgeschlagenes Verhalten + +Der Benutzer startet in Dynamo bewusst einen Export bzw. Sync. + +Das Python-Skript: + +1. liest alle relevanten `OST_ElectricalFixtures`, +2. liest die definierten Revit-Daten, +3. erzeugt das versionierte JSON, +4. sendet es an die Leistungsbilanz, +5. wertet die HTTP-Antwort aus, +6. zeigt dem Benutzer das Ergebnis in Dynamo an. + +--- + +# 10. Snapshot-Sync statt Delta-Sync + +Für den ersten Stand soll **kein komplexer Delta-Sync** gebaut werden. + +Stattdessen soll Revit bei jedem Sync einen vollständigen Snapshot aller aktuell relevanten Elektroinstallationen liefern. + +Beispiel: + +```text +vorher aktueller Snapshot +------------------------------------------------ +Element A vorhanden Element A vorhanden +Element B vorhanden Element B vorhanden +Element C vorhanden Element C fehlt + Element D neu +``` + +Die Leistungsbilanz kann daraus ableiten: + +```text +A → unchanged oder updated +B → unchanged oder updated +C → missing / deleted / not seen +D → created +``` + +Das ist für zunächst einige hundert oder tausend Elemente ausreichend und deutlich robuster. + +--- + +# 11. Upsert-Verhalten + +Auf Leistungsbilanzseite soll ein Revit-Element anhand eines stabilen Schlüssels identifiziert werden. + +Vorgeschlagen: + +```text +(revitModelId, revitUniqueId) +``` + +Beim Empfang eines Snapshots: + +```text +Element bereits vorhanden? + │ + ├─ Nein + │ ↓ + │ Create + │ + └─ Ja + ↓ + Update +``` + +Die Revit-Referenz soll dabei aktualisiert werden. + +Benutzerseitig überschriebene Werte einer DeviceRow dürfen dadurch jedoch nicht ungeprüft überschrieben werden. + +--- + +# 12. Mögliche API-Struktur + +Nicht zwingend exakt so umsetzen. + +Codex soll prüfen, wie die aktuelle API strukturiert ist. + +Mögliche Endpoints: + +```http +POST /api/integrations/revit/v1/models/{modelId}/sync +``` + +Alternativ logisch getrennt: + +```http +POST /api/integrations/revit/v1/models/{modelId}/elements +GET /api/integrations/revit/v1/models/{modelId}/writeback +``` + +Beispielantwort auf einen Revit-Sync: + +```json +{ + "syncId": "sync-9384", + "received": 483, + "created": 17, + "updated": 45, + "unchanged": 421, + "missing": 3 +} +``` + +Die konkrete Antwortstruktur soll so gewählt werden, dass Dynamo dem Nutzer eine verständliche Zusammenfassung anzeigen kann. + +--- + +# 13. Leistungsbilanz → Revit + +Die Rückrichtung soll später ebenfalls unterstützt werden. + +Sie soll jedoch zunächst **logisch vom Revit-Import getrennt** werden. + +Also: + +```text +PUSH + +Revit + ↓ +Leistungsbilanz +``` + +und: + +```text +PULL / WRITEBACK + +Leistungsbilanz + ↓ +Revit +``` + +Der Benutzer soll bewusst entscheiden können, wann Daten nach Revit zurückgeschrieben werden. + +Zum Beispiel: + +```text +[ Revit-Daten importieren ] + +[ Änderungen nach Revit schreiben ] +``` + +--- + +# 14. Writeback nicht generisch ausführen + +Die Leistungsbilanz soll nicht beliebige Parameter-Namen an Revit schicken, die Dynamo anschließend blind beschreibt. + +Stattdessen soll es ein definiertes Writeback-Schema geben. + +Beispiel: + +```json +{ + "updates": [ + { + "uniqueId": "abcdef...", + "values": { + "circuitNumber": "UV01-2F17", + "panel": "UV01", + "connectedLoad": 250 + } + } + ] +} +``` + +Der Revit-Adapter besitzt anschließend eine feste Allowlist bzw. ein Mapping: + +```text +circuitNumber + ↓ +LB_Stromkreisnummer + +panel + ↓ +LB_Verteiler + +connectedLoad + ↓ +LB_Anschlussleistung +``` + +Damit ist kontrolliert, welche Revit-Parameter durch die Leistungsbilanz beschrieben werden dürfen. + +--- + +# 15. Field Ownership / Datenhoheit + +Für bidirektionale Synchronisation muss definiert sein, welches System für welches Feld führend ist. + +Beispiel: + +| Information | Führendes System | +|---|---| +| Revit UniqueId | Revit | +| Revit ElementId | Revit | +| IFC GUID | Revit | +| Familie | Revit | +| Typ | Revit | +| MEP Raum | Revit | +| MEP Raumnummer | Revit | +| Zuordnung zu DeviceRow | Leistungsbilanz | +| Zuordnung zu Circuit | Leistungsbilanz | +| manuell überschriebene Leistung | Leistungsbilanz | +| Sicherung | Leistungsbilanz | +| Leitung | Leistungsbilanz | +| Stromkreisnummer | Leistungsbilanz, ggf. Writeback | +| Verteilerzuordnung | Leistungsbilanz, ggf. Writeback | + +Diese Tabelle muss anhand des bestehenden Datenmodells vervollständigt werden. + +Ziel ist, Konflikte wie diesen zu vermeiden: + +```text +Revit: +Leistung = 500 W + +Leistungsbilanz: +Nutzer überschreibt auf 750 W + +nächster Revit-Sync: +Revit liefert wieder 500 W +``` + +Der bewusste Benutzerwert darf nicht kommentarlos verloren gehen. + +--- + +# 16. Rohdaten und normalisierte Daten + +Es sollte geprüft werden, ob zusätzlich zu den normalisierten Daten ein Teil des ursprünglichen Revit-Payloads gespeichert werden sollte. + +Beispiel: + +```text +rawData / rawPayload +``` + +Vorteile: + +- Debugging, +- spätere Erweiterung ohne sofortigen Revit-Neuexport, +- Nachvollziehbarkeit, +- Erkennung neuer Parameter. + +Dabei soll aber vermieden werden, die eigentliche Business-Logik auf unstrukturiertem JSON aufzubauen. + +--- + +# 17. CSV und JSON-Datei weiterhin unterstützen + +Auch bei einer direkten API-Anbindung sollen Datei-basierte Wege sinnvoll bleiben. + +Mögliche Architektur: + +```text + ┌─────────────────────┐ + │ Leistungsbilanz │ + │ RevitSyncService │ + └─────────┬───────────┘ + │ + ┌─────────────┴─────────────┐ + │ │ + REST Datei + │ │ + ▼ ▼ + Dynamo Python JSON / CSV + │ + ▼ + Revit +``` + +Der gleiche interne Import-Service sollte möglichst sowohl: + +```text +HTTP JSON +``` + +als auch: + +```text +JSON-Datei +``` + +verarbeiten können. + +CSV kann als separates allgemeines Importformat bestehen bleiben. + +--- + +# 18. Kein direkter Datenbankzugriff aus Dynamo + +Dynamo soll nicht direkt auf SQLite, PostgreSQL oder andere Datenbanken der Leistungsbilanz zugreifen. + +Nicht empfohlen: + +```text +Dynamo + ↓ +direkte SQL-Verbindung + ↓ +DB +``` + +Empfohlen: + +```text +Dynamo + ↓ +API + ↓ +Business Logic + ↓ +ORM + ↓ +DB +``` + +Dadurch bleibt der Revit-Connector unabhängig von: + +- Tabellenstruktur, +- ORM, +- Migrationen, +- internen Relationen, +- späteren Änderungen des Backends. + +--- + +# 19. Zunächst kein WebSocket / Echtzeit-Sync + +Für den aktuellen Anwendungsfall ist kein permanenter Echtzeitkanal erforderlich. + +Nicht notwendig: + +```text +Leistungsbilanz wird geändert + ↓ +sofort automatische Änderung in Revit +``` + +Stattdessen soll zunächst mit expliziten Sync-Aktionen gearbeitet werden. + +Das ist auch im Hinblick auf Revit sinnvoll, da Änderungen über die Revit API kontrolliert und innerhalb gültiger Revit-Transactions vorgenommen werden müssen. + +--- + +# 20. Fehlerbehandlung + +Die Integration muss mit Teilfehlern umgehen können. + +Beispiele: + +- ein Element besitzt keinen MEP Space, +- IFC GUID fehlt, +- ein erwarteter Parameter fehlt, +- ein Revit-Parameter ist schreibgeschützt, +- HTTP-Verbindung schlägt fehl, +- API antwortet mit Validierungsfehler, +- Element wurde zwischen Abfrage und Writeback gelöscht, +- Revit-Modell ist noch nicht mit einem Leistungsbilanz-Projekt verknüpft. + +Das Dynamo-Skript soll möglichst nicht beim ersten fehlerhaften Element komplett abbrechen. + +Stattdessen sollte die Antwort z. B. unterscheiden: + +```text +success +warnings +errors +``` + +und am Ende eine Zusammenfassung ausgeben. + +--- + +# 21. Authentifizierung + +Codex soll prüfen, welche Authentifizierung die aktuelle Leistungsbilanz-App bereits verwendet. + +Der Dynamo-Connector soll keine unnötige zweite Authentifizierungsarchitektur einführen. + +Mögliche Varianten: + +- API Token, +- projektbezogenes Integration Token, +- bestehender Login-Mechanismus, +- kurzfristige Connector-Tokens. + +Secrets sollen nicht fest im Dynamo-Python-Code hinterlegt werden. + +--- + +# 22. Versionierung + +Das JSON-Schema und die API sollen versioniert sein. + +Beispielsweise: + +```text +schemaVersion = 1 +``` + +und/oder: + +```text +/api/integrations/revit/v1/ +``` + +Dadurch kann ein älteres Dynamo-Skript später noch mit einer neueren App-Version umgehen oder zumindest kontrolliert abgelehnt werden. + +--- + +# 23. Langfristige Perspektive: Revit Add-in + +Dynamo + Python ist für die erste Implementierung ideal, weil schnell getestet und angepasst werden kann. + +Langfristig könnte daraus ein echtes Revit-Add-in in C#/.NET werden. + +Beispiel: + +```text +Revit Ribbon + +┌──────── Leistungsbilanz ─────────┐ +│ │ +│ ↑ Daten übertragen │ +│ ↓ Daten aus Leistungsbilanz │ +│ │ +│ Projekt verbinden │ +│ Sync-Status │ +│ │ +└──────────────────────────────────┘ +``` + +Wichtig ist deshalb, dass die API nicht speziell auf Dynamo zugeschnitten wird. + +Ziel: + +```text +heute: +Dynamo + Python + ↓ +gleiche REST API + +später: +Revit Add-in C# + ↓ +gleiche REST API +``` + +--- + +# 24. Aktuell gewünschter Dynamo-Umfang + +Für den ersten produktiven Revit-Export soll Codex ein Dynamo-Python-Skript vorschlagen, das mindestens folgende Daten aus `OST_ElectricalFixtures` ermittelt: + +```text +revitModelId +ElementId +UniqueId +IFC GUID +Kategorie +Familie +Typ +MEP Raumnummer +MEP Raumname +``` + +Zusätzlich soll Codex anhand der aktuellen Leistungsbilanz-Datenstruktur prüfen, welche weiteren Felder bereits jetzt sinnvoll mitgegeben werden sollten. + +Dazu könnten später gehören: + +```text +Ebene +BMK +Leistung +cosPhi +Spannung +Anzahl +Kommentar +Stromkreis +Verteiler +weitere Shared Parameters +``` + +Diese zusätzlichen Felder sollen aber nicht willkürlich eingebaut werden, sondern aus der bestehenden Architektur und den fachlichen Anforderungen der Leistungsbilanz abgeleitet werden. + +--- + +# 25. Anforderungen an das Dynamo-Python-Skript + +Das Skript soll möglichst: + +- ohne externe Dynamo-Packages funktionieren, +- nur Revit API / Dynamo-eigene Python-Möglichkeiten verwenden, +- mit der im Projekt eingesetzten Revit-/Dynamo-Version kompatibel sein, +- alle Elektroinstallationen im gesamten aktuellen Revit-Dokument lesen, +- nicht nur die aktive Ansicht betrachten, +- fehlende optionale Parameter tolerieren, +- verständliche Fehlermeldungen liefern, +- eine gut lesbare Statusausgabe an `OUT` zurückgeben, +- JSON mit UTF-8 erzeugen, +- HTTP-Requests ohne unnötige externe Python-Abhängigkeiten ausführen, +- Timeouts behandeln, +- API-Fehler auswerten, +- keinen Datenverlust verursachen. + +Für spätere Writebacks muss das Skript Revit-Änderungen ausschließlich innerhalb gültiger Revit-Transactions durchführen. + +--- + +# 26. Gewünschter Arbeitsauftrag an Codex + +## Schritt 1 – Repository analysieren + +Vor Änderungen zuerst: + +1. `AGENTS.md` lesen. +2. Bestehende Architektur-Dokumentation lesen. +3. Datenmodell der Leistungsbilanz nachvollziehen. +4. Aktuelle Import-/CSV-Architektur untersuchen. +5. Vorhandene API-Routen analysieren. +6. Prüfen, ob bereits Entitäten oder Konzepte für: + - externe Modelle, + - Revit-Elemente, + - Linked Devices, + - Sync, + - Imports, + - Projekt-Historie + existieren. +7. Authentifizierung und Berechtigungssystem prüfen. +8. Bestehende Tests und Testkonventionen prüfen. + +Noch keine größere Implementierung beginnen, bevor diese Analyse abgeschlossen ist. + +--- + +## Schritt 2 – Bestehende Architektur gegen dieses Konzept abgleichen + +Codex soll beantworten: + +1. Welche vorhandenen Entitäten können wiederverwendet werden? +2. Brauchen wir überhaupt eine neue `RevitElement`-Entität? +3. Wie passt die Revit-Referenz in das bestehende `LinkedDevice`-/DeviceRow-Konzept? +4. Wo sollte das Sync-Verhalten im Backend liegen? +5. Wie soll die Modellidentität gespeichert werden? +6. Welche Felder sind Revit-Master? +7. Welche Felder sind Leistungsbilanz-Master? +8. Wie werden manuell überschriebene Werte geschützt? +9. Wie werden nicht mehr vorhandene Revit-Elemente behandelt? +10. Wie lässt sich das bestehende CSV-System sinnvoll weiterverwenden? + +--- + +## Schritt 3 – Konkreten Zielentwurf erstellen + +Codex soll danach einen konkreten Entwurf liefern für: + +### Datenmodell + +Mit tatsächlichen Namen passend zum Repository. + +### API + +Mit: + +```text +HTTP Method +Route +Request DTO +Response DTO +Validierung +Fehlercodes +Authentifizierung +``` + +### Sync-Service + +Mit klarer Verantwortung für: + +```text +Create +Update +Unchanged +Missing +Deleted +Linking +Conflict handling +``` + +### Dynamo-Schnittstelle + +Mit dem exakten JSON, das Dynamo senden bzw. empfangen soll. + +--- + +## Schritt 4 – Dynamo-Skripte vorschlagen + +Erst nachdem die Zielarchitektur feststeht, soll Codex konkrete Dynamo-Python-Skripte erstellen. + +Mindestens: + +### Script A – Revit → Leistungsbilanz + +Funktionen: + +```text +Revit-Modell-ID ermitteln +Electrical Fixtures sammeln +Daten auslesen +Payload erzeugen +JSON serialisieren +API aufrufen +Antwort auswerten +Status in Dynamo ausgeben +``` + +### Script B – Leistungsbilanz → Revit + +Noch nicht zwingend sofort implementieren, aber vollständig konzipieren. + +Funktionen: + +```text +Writeback-Daten von API abrufen +Element über UniqueId finden +Allowlist-Mapping anwenden +Werte prüfen +Revit Transaction starten +Parameter schreiben +Ergebnis an API melden +Status ausgeben +``` + +### Optional Script C – Debug-/Offline-Export + +Export des exakt gleichen Payloads als lokale JSON-Datei. + +Damit kann die Schnittstelle auch ohne erreichbare API getestet werden. + +--- + +# 27. Erwartete Ausgabe von Codex + +Codex soll nach der Analyse **nicht sofort große Änderungen durchführen**, sondern zuerst eine strukturierte Empfehlung liefern. + +Gewünschte Reihenfolge: + +```text +1. Analyse des Ist-Zustands +2. Abweichungen / bereits vorhandene passende Architektur +3. Empfohlenes Zieldesign +4. Datenmodelländerungen +5. API-Design +6. Sync-Logik +7. Exaktes JSON-Schema +8. Vorschlag Dynamo Script A +9. Vorschlag Dynamo Script B +10. Migrations-/Implementierungsreihenfolge +11. Tests +12. Offene Entscheidungen +``` + +Bei Architekturentscheidungen soll Codex die einfachste robuste Lösung bevorzugen und unnötige neue Abstraktionen vermeiden. + +--- + +# 28. Bevorzugte Implementierungsreihenfolge + +Voraussichtlich sinnvoll: + +```text +Phase 1 +──────────────────────────── +Austauschformat / DTO festlegen + +Phase 2 +──────────────────────────── +Backend API für Revit-Snapshot + +Phase 3 +──────────────────────────── +Persistierung und Upsert-Logik + +Phase 4 +──────────────────────────── +Dynamo Revit → API + +Phase 5 +──────────────────────────── +UI für importierte / nicht zugeordnete Revit-Elemente + +Phase 6 +──────────────────────────── +Zuordnungs- und Override-Verhalten + +Phase 7 +──────────────────────────── +Writeback API + +Phase 8 +──────────────────────────── +Dynamo API → Revit + +Phase 9 +──────────────────────────── +ggf. später Revit C# Add-in +``` + +--- + +# 29. Zentrale Architekturentscheidung + +Die wichtigste Vorgabe lautet: + +> Dynamo soll als Revit-Adapter dienen. Die eigentliche Fachlogik der Leistungsbilanz bleibt in der Leistungsbilanz-App. + +Dynamo soll deshalb nicht entscheiden: + +```text +welche Sicherung gewählt wird +welche Leitung verwendet wird +wie Stromkreise aufgebaut werden +wie Geräte gruppiert werden +welche Leistungswerte fachlich gültig sind +``` + +Dynamo liefert primär Revit-Daten und schreibt später explizit freigegebene Ergebnisse zurück. + +Die fachliche Entscheidung bleibt in der Webapp. + +--- + +# 30. Zielbild + +```text + REVIT + │ + Revit API + │ + Dynamo / Python + │ + JSON DTO + │ + REST / HTTP + │ + ▼ + Leistungsbilanz API + │ + Sync Service + │ + ┌───────────┴───────────┐ + │ │ + Revit-Referenz Business Logic + │ │ + └───────────┬───────────┘ + │ + DeviceRow + │ + Circuit + │ + Distributor +``` + +Später: + +```text +Leistungsbilanz + │ + Writeback + │ + ▼ +Dynamo / Python + │ + ▼ + Revit +``` + +Das Ziel ist keine möglichst komplexe Echtzeitkopplung, sondern eine robuste, nachvollziehbare und versionierbare Integration, die zunächst über Dynamo/Python funktioniert und später bei Bedarf durch ein natives Revit-Add-in ersetzt werden kann. diff --git a/docs/building-structure.md b/docs/building-structure.md new file mode 100644 index 0000000..c48e895 --- /dev/null +++ b/docs/building-structure.md @@ -0,0 +1,81 @@ +# Gebäudestruktur (Gebäude → Etagen → Räume) + +Projekte mit mehreren Gebäuden werden über eine eigene Ebene **Gebäude** +gegliedert. Etagen können einem Gebäude zugeordnet sein, Räume und Verteilungen +hängen wie bisher an der Etage. Das Gebäude eines Raums oder einer Verteilung +ergibt sich also aus der Etage; eine zweite, konkurrierende Zuordnung gibt es +nicht. Abstimmung mit Julian: Issue #6. + +## Datenmodell + +| Tabelle | Feld | Bedeutung | +|---|---|---| +| `buildings` | `id`, `project_id` (FK, cascade), `name`, `sort_order` | Gebäude eines Projekts | +| `floors` | `building_id` (nullable FK → `buildings`, `ON DELETE set null`) | optionales übergeordnetes Gebäude | + +Migration `0009_buildings`. Bestehende Etagen behalten `building_id = null` und +erscheinen in der Oberfläche als „Ohne Gebäude“. Es gibt keine Zwangsmigration +und kein automatisch angelegtes Standardgebäude. Vor dem Anwenden der Migration +auf eine bestehende Datenbank ist wie bei jeder Schemamigration eine separate +Datenbanksicherung anzulegen. + +## Befehle, Undo/Redo + +Alle Änderungen laufen über die bestehende Orts-Struktur +(`ProjectLocationStructureProjectCommandRepository`) mit Revision, Inverse und +persistentem Undo/Redo: + +- `project-building.insert` / `project-building.delete` mit vollständigem + Gebäude-Snapshot (Schema-Version 1) +- `project-building.update`: ändert nur den Namen +- Löschen eines Gebäudes wird abgelehnt, solange Etagen zugeordnet sind + („Das Gebäude kann nicht gelöscht werden, solange Etagen zugeordnet sind.“) +- Etagenbefehle `project-floor.insert/.update/.delete` haben seit + Schema-Version **2** das Feld `buildingId`. `project-floor.update` darf Name + und/oder Gebäude ändern, nicht aber `sortOrder`. Ein referenziertes Gebäude + muss zum Projekt gehören. +- Version-1-Etagenbefehle aus bestehender Historie bleiben ausführbar. Sie + stammen aus der Zeit vor den Gebäuden und werden vor der Ausführung mit + `buildingId = null` auf Version 2 gehoben; auch die daraus neu gespeicherten + Vorwärts- und Inversbefehle sind Version 2. Das ist bei linearer Historie + exakt: Wird ein Gebäude später zugeordnet, liegt dieser neuere Befehl im + Undo-Stapel vor dem alten Befehl und wird zuerst zurückgenommen. +- Raumbefehle bleiben unverändert (Version 1). + +## Snapshots und Transfer + +Projekt-Snapshot-Schema **7** enthält `buildings` und `floors[].buildingId`. +Alle älteren unterstützten Versionen (1–6) werden beim Einlesen mit leerer +Gebäudeliste und `buildingId = null` hochgestuft; gespeicherte Sicherungspunkte +bleiben wiederherstellbar. Die Relationen werden geprüft (Gebäude gehört zum +Projekt, `buildingId` verweist auf ein Gebäude des Snapshots). Restore löscht +und schreibt Gebäude zusammen mit den Etagen; der Projekt-Transfer vergibt neue +Gebäude-IDs und stellt die Etagenverweise um. + +## API + +- `GET /api/projects/:projectId/buildings` – Gebäude sortiert nach + `sortOrder`, Name +- `POST /api/projects/:projectId/buildings` – `{ "name": "Haus A", "expectedRevision": 3 }` +- `PUT /api/projects/:projectId/buildings/:buildingId` – `{ "name": "Haus B", "expectedRevision": 4 }` +- `DELETE /api/projects/:projectId/buildings/:buildingId` – `{ "expectedRevision": 5 }` +- `POST/PUT /api/projects/:projectId/floors[/:floorId]` akzeptieren zusätzlich + optional `buildingId` (`string | null`). Fehlt das Feld, bleibt beim Bearbeiten + das bisherige Gebäude erhalten; ältere Clients funktionieren unverändert. + +## Oberfläche + +Gebäude, Etagen und Räume werden auf der eigenen Seite +`/projects/:projectId/struktur` („Gebäudestruktur“) gepflegt, erreichbar über +die Seitenleiste und die Kennzahlen der Projektübersicht. Drei Spalten +Gebäude → Etagen → Räume filtern sich gegenseitig: Klick auf ein Gebäude zeigt +nur dessen Etagen, Klick auf eine Etage nur deren Räume, „Alle“ hebt den Filter +auf. Hinzufügen, Bearbeiten und Löschen laufen über Icon-Buttons wie in der +Stromkreisliste. + +## Offen + +- Revit: Das Gebäude kann später aus einem Revit-Parameter kommen und über die + bestehende CSV-Zuordnung gemappt werden (Frage an Julian in Issue #6). +- Sortierung von Gebäuden per Drag-and-drop ist noch nicht umgesetzt; neue + Gebäude werden hinten angehängt. diff --git a/docs/circuit-list-editor-api.md b/docs/circuit-list-editor-api.md index 9ed9e0a..156be62 100644 --- a/docs/circuit-list-editor-api.md +++ b/docs/circuit-list-editor-api.md @@ -74,8 +74,9 @@ Protected-board structure uses persisted inverse of a delete. The dispatcher also supports the documented project-device, project settings, distribution-board and project-location commands. The generic editor commands listed here use schema version `1`. -`project.update-settings` uses version `2` and still accepts supported baseline -version `1` commands without changing the newer building classification. +`project.update-settings` uses version `3` (including the print cover fields) +and still accepts version `2` and supported baseline version `1` commands +without changing the newer cover fields or building classification. Pre-baseline formats remain unsupported. Unsupported types or schema versions are rejected. Insert commands contain the complete entity or circuit block with stable ids; delete commands include the expected parent identity. Circuit @@ -173,6 +174,9 @@ synchronizes linked circuit rows implicitly. - `PUT /projects/:projectId` - request: `{ "expectedRevision": 12, "isPublicBuilding": true, "singlePhaseVoltageV": 230, "threePhaseVoltageV": 400, "enabledDistributionBoardSupplyTypes": ["AV", "MSR", "SiBe"], ...projectMetadata }` + - optional print cover fields `siteAddress` (max. 500), `workStage` (max. + 100), `projectLead` and `projectEditor` (max. 200 each); omitted fields keep + their value, empty strings are stored as `null` - executes `project.update-settings` as one atomic revision - response: `{ "project": { ... }, "revision": { ... }, "history": { ... } }` @@ -230,9 +234,13 @@ returns HTTP `409` with `PROJECT_HISTORY_OPERATION_UNAVAILABLE`. - stale revisions return `409 PROJECT_REVISION_CONFLICT` - `PUT /projects/:projectId/distribution-boards/:distributionBoardId` - body: - `{ "floorId": null, "supplyType": "AV", "expectedRevision": 13 }` - - executes `distribution-board.update`; floor and supply type are restored - together by persistent Undo/Redo + `{ "floorId": null, "supplyType": "AV", "simultaneityFactor": 1, "expectedRevision": 13 }` + - optional info-card fields: `boardNumber` (max. 50), `location`, + `fedFrom` (max. 200 each) and `remark` (max. 2000); strings are trimmed + and an empty string is stored as `null` + - executes `distribution-board.update`; all submitted values, including the + submitted info fields, are restored together by persistent Undo/Redo + - `fedFrom` is free text until the logical feed link is modeled - `POST /projects/:projectId/distribution-boards/:distributionBoardId/copy` - body: `{ "name": "UV-02 Kopie", "expectedRevision": 14 }` - duplicates the complete distribution-board subtree with new owning UUIDs @@ -249,15 +257,27 @@ returns HTTP `409` with `PROJECT_HISTORY_OPERATION_UNAVAILABLE`. `distribution-board.delete-subtree`. Persistent Undo/Redo restores or removes the same complete subtree, including protection devices. -### Project Floors and Rooms +### Project Buildings, Floors and Rooms +- `GET /projects/:projectId/buildings` +- `POST /projects/:projectId/buildings` + - body: `{ "name": "Haus A", "expectedRevision": 12 }` + - executes `project-building.insert` with a stable building id + - response: `{ "building": { ... }, "revision": { ... }, "history": { ... } }` +- `PUT /projects/:projectId/buildings/:buildingId` + - body: `{ "name": "Haus B", "expectedRevision": 13 }` (name only) +- `DELETE /projects/:projectId/buildings/:buildingId` + - body: `{ "expectedRevision": 14 }` + - rejects buildings with assigned floors - `POST /projects/:projectId/floors` - - body: `{ "name": "EG", "expectedRevision": 13 }` - - executes `project-floor.insert` with a stable floor id + - body: `{ "name": "EG", "buildingId": "building_1", "expectedRevision": 13 }` + (`buildingId` optional, `null` = no building) + - executes `project-floor.insert` (command version 2) with a stable floor id - response: `{ "floor": { ... }, "revision": { ... }, "history": { ... } }` - `PUT /projects/:projectId/floors/:floorId` - - body: `{ "name": "1. OG", "expectedRevision": 14 }` - - executes an exact persistent floor update + - body: `{ "name": "1. OG", "buildingId": null, "expectedRevision": 14 }` + - executes an exact persistent floor update of name and/or building; a + missing `buildingId` keeps the current building - `DELETE /projects/:projectId/floors/:floorId` - body: `{ "expectedRevision": 15 }` - rejects floors with assigned rooms or distribution boards @@ -425,3 +445,27 @@ project device never triggers synchronization implicitly. Parser errors expose stable codes such as `header-not-found`, `ambiguous-header`, `invalid-ifc-guid` and `duplicate-ifc-guid`. The confirmed import uploads and parses the file again and verifies its hash. + +## Document Branding (print view) + +Office-wide branding for the print view. These endpoints are mounted at +`/api/document-branding`, outside `/api/projects`, because the data is global +and intentionally not part of project revisions, snapshots or transfer. + +- `GET /document-branding` + - returns `{ "logo": { "mimeType", "fileName", "sizeBytes", "updatedAtIso" } | null, "office": { "officeName", "officeAddress" } }` +- `GET /document-branding/logo` + - returns the stored image bytes with its media type, or `404` without logo + - responses carry `X-Content-Type-Options: nosniff` and a restrictive + Content-Security-Policy so an SVG logo cannot execute scripts +- `PUT /document-branding/logo` + - request: `{ "fileName": "logo.png", "mimeType": "image/png", "contentBase64": "..." }` + - accepted types: `image/png`, `image/jpeg`, `image/svg+xml`; at most 2 MB + after decoding; the content signature must match the declared type + - replaces an existing logo; returns the logo metadata +- `DELETE /document-branding/logo` + - removes the logo; returns `204` +- `PUT /document-branding/office` + - request: `{ "officeName": "…" | null, "officeAddress": "…" | null }` + (at most 200 / 500 characters; empty text is stored as not set) + - returns `{ "office": { "officeName", "officeAddress" } }` diff --git a/docs/circuit-list-editor-known-limitations.md b/docs/circuit-list-editor-known-limitations.md index 4f7f660..a3840df 100644 --- a/docs/circuit-list-editor-known-limitations.md +++ b/docs/circuit-list-editor-known-limitations.md @@ -9,6 +9,8 @@ - Named and automatic logical project snapshots can be listed and restored through the project page with persistent Undo/Redo. Automatic snapshots are created every 25 revisions and only their newest 12 entries are retained. +- Further Revit work is deferred; it will later use the CSV export/import of + the Linear plugin in Revit, not Dynamo. - The Revit/CSV foundation and confirmed initial import are implemented. Existing-row assignment, move and detach plus creation of an external-only row in an existing or newly created circuit have atomic persistent commands. @@ -27,3 +29,12 @@ - Protection and cable values are planner-owned manual selections. The later sizing/warning engine does not yet validate them against load, length or voltage-drop rules. +- Distribution-board `fedFrom` is free text. The print overview derives its + supply structure and "Σ inkl. unterlagert" only from exact text matches with + board numbers/names and adds values without an upstream simultaneity factor + (see `docs/print-view.md`). +- The print view uses a kbp corporate design derived from logo and + presentation material. Snapshots do not record an editor, so the cover's + Planstände list shows the project's current editor for every entry. On screen, long + board plans are not split into pages; pagination happens in the browser print + dialog. diff --git a/docs/current-architecture.md b/docs/current-architecture.md index ab223bd..6eeb6e1 100644 --- a/docs/current-architecture.md +++ b/docs/current-architecture.md @@ -241,8 +241,9 @@ und Historienstapel teilen dieselbe Transaktion. Create, Import aus der globalen Gerätebibliothek und Delete laufen über dieselbe Command-Grenze; ihre Antworten liefern Gerät und aktualisierten Historienstand an die Projektseite zurück. `project.update-settings` versioniert Projektname, interne und externe -Projektnummer, Bauherr, Beschreibung, die Kennzeichnung als öffentliches -Gebäude, beide Standardspannungen sowie die im Projekt freigeschalteten +Projektnummer, Bauherr, Beschreibung, die Deckblattangaben (Anschrift, +Leistungsphase, Projektleitung, Bearbeitung; Schema-Version 3, Migration +`0008`), die Kennzeichnung als öffentliches Gebäude, beide Standardspannungen sowie die im Projekt freigeschalteten Verteiler-Netzarten als eine atomare Änderung. Die Gebäudekennzeichnung ist der spätere Eingang für die Auswahl halogenfreier Kabel und Leitungen. Der Systemkatalog besteht aus `AV`, `SV`, `EV`, `USV`, `MSR` und `SiBe`; mindestens @@ -254,9 +255,11 @@ Werte, Revision und Historienstapel gemeinsam. `PUT /api/projects/:projectId` verlangt deshalb `expectedRevision`, liefert Projekt plus aktualisierten Historienstand und besitzt keinen separaten direkten Settings-Schreibweg mehr. Kommando- und Snapshot-Payloads müssen dem aktuellen Baseline-Schema entsprechen. -Die Projektseite zeigt Verteilungen, Etagen und Räume als kompakte -Bestandsübersichten; ihre versionierten Erstellwege öffnen beschriftete Modals -statt dauerhafter Eingabezeilen. Projektgeräte werden als durchsuchbare, +Die Projektseite zeigt Verteilungen als kompakte Bestandsübersicht; ihre +versionierten Erstellwege öffnen beschriftete Modals statt dauerhafter +Eingabezeilen. Gebäude, Etagen und Räume werden auf der eigenen Seite +„Gebäudestruktur“ (`/projects/:projectId/struktur`) gepflegt; Etagen können +einem Gebäude zugeordnet sein (`docs/building-structure.md`). Projektgeräte werden als durchsuchbare, fünfspaltige Übersicht dargestellt. Manuelle Anlage, Übernahme aus der globalen Bibliothek und vollständige Bearbeitung erfolgen in einem gemeinsamen Modal. Die anschließende Vorschau verknüpfter Stromkreiszeilen bleibt davon getrennt, @@ -271,7 +274,8 @@ Die allgemeinen Anwendungskarten verwenden in `src/app/globals.css` einen gleichmäßigen Rahmen, 16-px-Rundungen und einen Schatten mit eigener Dark-Mode-Abstimmung. Bootstrap-Karten mit `shadow-sm` nutzen denselben Schatten; der Stromkreis-Grid bleibt eine eigenständige Komponente. -Die Verteilersuche berücksichtigt aktuell Name und Etagenname; die Gerätesuche +Die Verteilersuche berücksichtigt Name, Verteilernummer, Örtlichkeit und +Etagenname; die Gerätesuche Name, Anzeigename, Kategorie einschließlich deutscher Bezeichnung, Anschlussart und Kostengruppe. Der Gerätefilter „Anschluss“ wählt zwischen 1- und 3-phasig. Mehrere Werte innerhalb eines Filters gelten alternativ, verschiedene Filter @@ -450,7 +454,16 @@ wieder her. verteilerweiten Gleichzeitigkeitsfaktor gemeinsam und stellt alle Werte über dauerhaftes Undo/Redo wieder her. Der Faktor liegt zwischen `0` und `1` und ist für bestehende sowie neu angelegte Verteilungen standardmäßig `1`. -Snapshot-Schema 5 enthält zusätzlich den manuellen Mengenanteil jeder +Derselbe Befehl versioniert die Felder der Verteiler-Infokarte +(`boardNumber`, `location`, `fedFrom`, `remark`, Migration `0007`). Die +Infokarte liegt im Bearbeiten-Dialog der Verteilung; die Werte sind lokale +Planungswerte und sollen später über den Revit-Abgleich nur nach Vorschau und +ausdrücklicher Bestätigung vorbelegt werden. `fedFrom` ist vorerst Freitext. +Snapshot-Schema 7 enthält zusätzlich die Gebäude und die Gebäudezuordnung +der Etagen; ältere Versionen werden ohne Gebäude hochgestuft. +Snapshot-Schema 6 enthält diese Felder und die Deckblattangaben des +Projekts; ältere Versionen werden mit `null` +hochgestuft. Snapshot-Schema 5 enthält zusätzlich den manuellen Mengenanteil jeder Gerätezeile. Version 4 wird mit `manualQuantity = quantity` hochgestuft und enthält bereits den vollständigen externen Modellzustand aus Quelle, Batches, Raum-Mappings und Objekten. Es enthält außerdem die @@ -520,7 +533,7 @@ Kopieren in ein Projekt erzeugt ein eigenständiges Projektgerät. `toLowerCase()` gegen das vollständige Register der Stromkreisliste und wird von jedem Anlage-/Umbenennungspfad für Stromkreise und Verteilerkomponenten aufgerufen, auch dort, wo zuvor kein Vorab-Check existierte. Snapshot- und - Transfer-Integration verwenden aktuell Snapshot-Schema 5. Persistente + Transfer-Integration verwenden aktuell Snapshot-Schema 6. Persistente Insert/Delete/Update-Commands für veränderliche Verteilerkomponenten, Gruppen einschließlich befüllter Unterbäume sowie vollständige Gruppensortierung sind integriert. Der Editor zeigt die geschützte Struktur @@ -539,6 +552,10 @@ bei einem späteren Wechsel trotzdem einen eigenen PostgreSQL-Adapter. ## Revit-CSV-Grundlage +**Zurückgestellt:** Die weitere Revit-Arbeit wird später angegangen, dann +über den CSV-Export/-Import des Linear-Plugins in Revit statt über Dynamo. +Details: [Revit-CSV-Anforderungen, Abschnitt 1](spec/revit-csv-integration-requirements.md). + Der reine Adapter unter `src/external-model/csv` validiert die projektweite Transport- und Mappingkonfiguration und parst UTF-8-CSV verlustarm in eine klassifizierte Zellmatrix. Er erkennt Metadaten, Header, Passthrough-, Objekt- @@ -548,7 +565,7 @@ einschließlich BOM, CRLF und Quotierung bytegleich zurück. Der lokale Befehl `external_csv_configurations` enthält höchstens eine versionierte Konfiguration je Projekt. `external-csv-configuration.update` schreibt Anlage, Änderung oder -Entfernung zusammen mit Revision und persistentem Undo/Redo. Snapshot-Schema 5, +Entfernung zusammen mit Revision und persistentem Undo/Redo. Snapshot-Schema 6, Restore und portabler Projekttransfer enthalten diesen Zustand; beim Duplizieren werden Konfigurations-UUID und Projektlink remapped. diff --git a/docs/print-view.md b/docs/print-view.md new file mode 100644 index 0000000..eba91ed --- /dev/null +++ b/docs/print-view.md @@ -0,0 +1,127 @@ +# Seitenansicht und PDF-Export + +Die Seitenansicht ist rein lesend und verändert keine Projektdaten. +Die Aktionen für Büroangaben und Logo speichern dagegen globale Einstellungen. +Projekt- und Verteilerangaben werden in den jeweiligen Bearbeitungsdialogen +über Projektbefehle mit Undo/Redo gepflegt. + +Beim Laden werden die Projektrevisionen aller Stromkreislisten und ein +abschließend erneut gelesener Projektstand verglichen. Ändert sich das Projekt +währenddessen, wird statt eines gemischten Datenstands eine Aufforderung zum +Neuladen angezeigt. Eine bereits geladene Seitenansicht aktualisiert sich nicht +automatisch bei späteren Änderungen in einem anderen Tab. + +## Aufruf + +- Projektseite → Button **Seitenansicht** öffnet + `/projects/:projectId/print` in einem neuen Tab. +- **Als PDF speichern / Drucken** nutzt den Druckdialog des Browsers + (Ziel „Als PDF speichern“). Der Dokumenttitel `Leistungsbilanz – ` + wird als Dateiname vorgeschlagen. +- **Planformat** schaltet die Verteilerpläne zwischen A4 quer und A3 quer um. + Deckblatt bleibt A4 hoch. +- **Büroangaben** pflegt Büroname und Büroanschrift (Planverfasser, für alle + Projekte). +- **Logo hinterlegen / ersetzen / entfernen** verwaltet das Büro-Logo. + +## Seiten + +1. **Deckblatt (A4 hoch)** – tabellarisch: Projekt, Planverfasser, Dokument, + Planstände (aus benannten Sicherungspunkten) und Inhalt. Leere Angaben + erscheinen als orangefarbenes „[ergänzen]“. +2. **Verteilerübersicht (quer)** – Versorgungsstruktur und Tabelle je + Verteiler mit Stromkreisanzahl, Pinst (Anzahl × Leistung je + Stück), PGeräte (mit Geräte-GZF), Verteiler-GZF, + Pgl, IB und „Σ inkl. unterlagert“. +3. **Verteilerpläne (quer, je Verteiler)** – Titelleiste mit + Verteilernummer, Bezeichnung, Örtlichkeit, Netzart, „Gespeist von“ und + Pgl; darunter Kopfkomponenten, Gruppen, Stromkreise + (mehrzeilige mit Sammelzeile und eingerückten Gerätezeilen), + Gruppensummen und Verteilersumme. Fehlende Kabelangaben sind als „offen“ + markiert. Die Titelleiste steht im Tabellenkopf und wiederholt sich beim + Drucken auf Folgeseiten. + +Seitenformat, Ränder und „Seite x von y“ kommen beim Drucken aus benannten +`@page`-Regeln (`lb-portrait`, `lb-landscape`), die die Seite zur Laufzeit +einfügt. Die Bildschirmansicht zeigt Blätter in Papiergröße; die exakte +Seitenaufteilung langer Verteilerpläne entsteht erst beim Drucken. + +## Vorläufige Punkte + +- **Einspeisung / Hierarchie:** `fedFrom` ist Freitext. Die Übersicht ordnet + einen Verteiler nur dann unter, wenn der Text eindeutig der Nummer oder + Bezeichnung eines anderen Verteilers entspricht (ohne Beachtung von + Groß-/Kleinschreibung und äußeren Leerzeichen). Mehrdeutige Treffer bleiben + ohne Zuordnung; „Σ inkl. unterlagert“ ist + eine einfache Summe ohne übergeordneten GZF. Die fachliche Verknüpfung + (Verteiler und/oder speisender Stromkreis) und die Summierungslogik sind + offen. +- **IB** ist ein symmetrischer Drehstromwert + S / (√3 · U3~) mit S aus P / cos φ je Gerätezeile + (fehlendes cos φ = 1) und Verteiler-GZF. +- **Corporate Design:** Farben (`--pd-*` in + `src/frontend/print/print-document.css`) und Schrift (Arial) sind aus Logo + und kbp-Präsentationsmaterial abgeleitet und werden durch die offizielle + CD-Vorgabe ersetzt, falls diese abweicht. +- **Planstände:** Die Spalte „Bearbeitung“ zeigt für jeden Planstand die + aktuelle Bearbeitung aus den Projekteinstellungen, weil Sicherungspunkte + (noch) keinen Bearbeiter speichern. + +## Datenquellen des Deckblatts + +| Feld | Quelle | +|---|---| +| Bauvorhaben, Bauherr, Projektnummern, Beschreibung | Projekteinstellungen | +| Anschrift Bauvorhaben, Leistungsphase, Projektleitung, Bearbeitung | Projekteinstellungen → Abschnitt „Deckblatt“ (`siteAddress`, `workStage`, `projectLead`, `projectEditor`) | +| Büro, Anschrift Büro | Seitenansicht → „Büroangaben“ (global) | +| Stand, Datenstand, Anzahl Verteiler, Inhalt | automatisch | +| Planstände | benannte Sicherungspunkte | + +Die vier Projektfelder laufen über `project.update-settings` (Schema-Version +3, Migration `0008`) und sind Teil von Snapshot-Schema 6 und Projektexport. +Im `PUT /api/projects/:projectId` sind sie optional; fehlende Felder behalten +ihren Wert. + +## Büroangaben + +- Tabelle `document_branding_settings` (Schlüssel/Wert, Migration `0008`), + global wie das Logo. +- `GET /api/document-branding` liefert zusätzlich + `office: { officeName, officeAddress }`. +- `PUT /api/document-branding/office` mit `{ "officeName", "officeAddress" }` + (max. 200 / 500 Zeichen, leerer Text = nicht gesetzt). + +## Logo + +- Globale Büro-Einstellung, nicht Teil von Projekten, Revisionen, Snapshots + oder Projektexport. +- Tabelle `document_branding_assets` (Migration `0007`). +- `GET /api/document-branding` → `{ logo: { mimeType, fileName, sizeBytes, updatedAtIso } | null }` +- `GET /api/document-branding/logo` → Bilddaten (`404` ohne Logo), mit + `X-Content-Type-Options: nosniff` und restriktiver CSP. +- `PUT /api/document-branding/logo` mit + `{ "fileName", "mimeType": "image/png" | "image/jpeg" | "image/svg+xml", "contentBase64" }`, + maximal 2 MB; der Dateiinhalt wird gegen das Format geprüft. +- `DELETE /api/document-branding/logo` → `204`. + +## Code + +- `src/app/projects/[projectId]/print/page.tsx` – Datenladen, Werkzeugleiste, + `@page`-Regeln +- `src/frontend/print/print-document-model.ts` – reine Berechnungen und + Formatierung (Tests: `tests/print-document-model.test.ts`) +- `src/frontend/print/print-document.tsx` – Blätter und Tabellen +- `src/frontend/print/print-document.css` – Layout, auf `.print-view` + begrenzt +- `src/frontend/components/distribution-board-info-card.tsx` – Infokarte im + Bearbeiten-Dialog der Verteilung + +## Bestehende Datenbanken + +Vor dem Anwenden der additiven Migrationen `0007` und `0008` eine verifizierte +Datenbanksicherung mit `npm run db:backup` erstellen. Die neuen Projekt- und +Verteilerfelder bleiben bei bestehenden Datensätzen zunächst leer (`null`). +Snapshot-Schema 6 enthält beide Feldgruppen; die unterstützten Versionen 1–5 +werden beim Lesen hochgestuft. Restore und Projektkopie erhalten die neuen +Angaben. Globale Büroangaben und Logo gehören zur Datenbanksicherung, nicht +zum logischen Projektsnapshot oder Projekttransfer. diff --git a/docs/project-history-and-external-model-architecture.md b/docs/project-history-and-external-model-architecture.md index 4c0a8ea..f8ed263 100644 --- a/docs/project-history-and-external-model-architecture.md +++ b/docs/project-history-and-external-model-architecture.md @@ -113,6 +113,10 @@ Implemented automatic-snapshot policy: ## Revit / CSV / IFCGUID Round-Trip Direction +**Deferred:** further Revit work will be tackled later, then through the +CSV export/import of the Linear plugin in Revit instead of Dynamo. Details: +[Revit-CSV requirements, section 1](spec/revit-csv-integration-requirements.md). + External model exchange should use explicit staging and link entities instead of writing imported rows directly into circuits. Conceptual entities: @@ -275,6 +279,10 @@ Completed foundation: - `project-floor.insert` and `project-room.insert` persist complete location records with stable ids; their inverses reject changed or referenced records so Undo never clears room assignments or device-row links implicitly +- `project-building.insert/.update/.delete` persist complete building records; + deleting a building with assigned floors is rejected. Floor commands carry + `buildingId` since command version 2; version 1 floor commands from older + history are upgraded with `buildingId = null` before execution - the floor and room POST routes require the current expected revision and the project page tracks the returned history state diff --git a/docs/revit-requirements-llm-context.md b/docs/revit-requirements-llm-context.md index 314820b..cf10324 100644 --- a/docs/revit-requirements-llm-context.md +++ b/docs/revit-requirements-llm-context.md @@ -1,5 +1,9 @@ # Kontext für die Revit-Anforderungsplanung +**Zurückgestellt:** Die weitere Revit-Arbeit wird später angegangen, dann +über den CSV-Export/-Import des Linear-Plugins in Revit statt über Dynamo. +Details: [Revit-CSV-Anforderungen, Abschnitt 1](spec/revit-csv-integration-requirements.md). + ## Zweck dieser Datei Diese Datei ist eine kompakte Übergabe an ein anderes LLM. Sie soll dabei diff --git a/docs/spec/07-implementation-phases-todo.md b/docs/spec/07-implementation-phases-todo.md index b665e85..f36d60d 100644 --- a/docs/spec/07-implementation-phases-todo.md +++ b/docs/spec/07-implementation-phases-todo.md @@ -532,6 +532,10 @@ Acceptance criteria: ## Phase 14: External Model Round-Trip +**Zurückgestellt:** Die weitere Revit-Arbeit wird später angegangen, dann +über den CSV-Export/-Import des Linear-Plugins in Revit statt über Dynamo. +Details: [Revit-CSV-Anforderungen, Abschnitt 1](revit-csv-integration-requirements.md). + Status: Phase 14.2 (persistente externe Objekte und bestätigter Erstimport) ist implementiert. Editor-Zuordnung, Rückexport und Folgeimport folgen. Siehe [Phase-14-Audit und Implementierungsplan](revit-csv-phase-14-audit-and-plan.md) @@ -540,7 +544,7 @@ und die verbindlichen Goal: -Exchange model objects and planning parameters with Revit or comparable tools through CSV or another agreed format. +Exchange model objects and planning parameters with Revit through CSV (Linear plugin export/import). Tasks: diff --git a/docs/spec/08-current-product-backlog.md b/docs/spec/08-current-product-backlog.md index c90dd24..a9e902d 100644 --- a/docs/spec/08-current-product-backlog.md +++ b/docs/spec/08-current-product-backlog.md @@ -141,4 +141,5 @@ The pre-release cleanup established the following compatibility boundary: The Revit/CSV/IFCGUID round-trip follows the distribution-board component foundation as a separate jointly planned phase and must not be inferred from -these tasks. +these tasks. It is currently deferred and will later use the CSV +export/import of the Linear plugin in Revit, not Dynamo. diff --git a/docs/spec/revit-csv-integration-requirements.md b/docs/spec/revit-csv-integration-requirements.md index 973c1a6..4ce65ee 100644 --- a/docs/spec/revit-csv-integration-requirements.md +++ b/docs/spec/revit-csv-integration-requirements.md @@ -2,6 +2,19 @@ ## 1. Status und Verbindlichkeit +> **Zurückgestellt (September 2026).** Die weitere Revit-Arbeit +> (Editor-Oberfläche zur Objektzuordnung, Folgeimport, Rückexport) wird später +> angegangen. Wenn sie wieder aufgenommen wird, bleibt der Austausch +> CSV-basiert: Export und Import laufen über das Linear-Plugin in Revit. Das +> entspricht der Vorgabe des internen Revit/CAD-Lenkungskreises, weil dabei +> nicht direkt per Dynamo im Modell gearbeitet wird. Eine Dynamo- oder +> API-Anbindung ist nicht vorgesehen; die früheren Vorüberlegungen liegen unter +> [docs/archive](../archive/revit-dynamo-leistungsbilanz-integration-konzept.md). +> Der Aufbau der Linear-CSV ist noch offen. Vor der Wiederaufnahme wird ein +> Musterexport gegen die bestehende projektweite CSV-Konfiguration und den +> Parser geprüft; erst danach wird entschieden, was anzupassen ist. Die bereits +> umgesetzten Schritte bleiben unverändert nutzbar. + Dieses Dokument ist die verbindliche fachliche und technische Arbeitsgrundlage für **Phase 14: External Model Round-Trip**. Es unterscheidet ausdrücklich zwischen: @@ -1338,7 +1351,7 @@ Diese Punkte blockieren die Erstellung dieser Spezifikation nicht. - automatische raumbezogene Stromkreisvorschläge; - projektübergreifend wiederverwendbare Mappingprofile; - Teilmodelle und mehrere externe Quellen; -- Dynamo/API/JSON-Transportadapter; +- Dynamo/API/JSON-Transportadapter (nicht vorgesehen, siehe Abschnitt 1); - Rollen und Berechtigungen; - Hintergrundjobs; - PostgreSQL. diff --git a/docs/spec/revit-csv-phase-14-audit-and-plan.md b/docs/spec/revit-csv-phase-14-audit-and-plan.md index be50eb1..a4c21e4 100644 --- a/docs/spec/revit-csv-phase-14-audit-and-plan.md +++ b/docs/spec/revit-csv-phase-14-audit-and-plan.md @@ -2,6 +2,10 @@ ## Status +**Zurückgestellt:** Die weitere Revit-Arbeit wird später angegangen, dann +über den CSV-Export/-Import des Linear-Plugins in Revit statt über Dynamo. +Details: [Revit-CSV-Anforderungen, Abschnitt 1](revit-csv-integration-requirements.md). + Phase 14.0 ist abgeschlossen und freigegeben. Dieses Dokument beschreibt den gegen den aktuellen Code geprüften Zielzuschnitt. Phase 14.1 ist abgeschlossen. Phase 14.2 hat mit den externen Domänenverträgen, Identitätsregeln und dem diff --git a/dynamo/01_check_model_identity.py b/dynamo/01_check_model_identity.py deleted file mode 100644 index a3fe009..0000000 --- a/dynamo/01_check_model_identity.py +++ /dev/null @@ -1,385 +0,0 @@ -"""Read-only Revit 2026 model-identity diagnostics for a Dynamo Python node. - -Optional Dynamo input: - IN[0]: output directory or complete .json file path - -The script intentionally performs no Revit transaction and changes no model -data. OUT contains a compact summary plus the complete report. -""" - -import datetime -import json -import os -import platform -import sys -import tempfile -import traceback - -import clr - -clr.AddReference("RevitAPI") -clr.AddReference("RevitServices") - -from Autodesk.Revit.DB import ModelPathUtils, StorageType # noqa: E402 -from RevitServices.Persistence import DocumentManager # noqa: E402 - - -CHECKED_PARAMETER_NAMES = ("LB_ModelId", "LB_ProjectId") - - -def safe_text(value): - if value is None: - return None - try: - return str(value) - except Exception: - return None - - -def element_id_text(element_id): - if element_id is None: - return None - try: - return str(element_id.Value) - except Exception: - try: - return str(element_id.IntegerValue) - except Exception: - return safe_text(element_id) - - -def forge_type_id_text(value): - if value is None: - return None - try: - return value.TypeId - except Exception: - return safe_text(value) - - -def parameter_value(parameter): - result = { - "hasValue": False, - "raw": None, - "display": None, - } - try: - result["hasValue"] = bool(parameter.HasValue) - except Exception: - pass - - try: - storage_type = parameter.StorageType - if storage_type == StorageType.String: - result["raw"] = parameter.AsString() - elif storage_type == StorageType.Integer: - result["raw"] = int(parameter.AsInteger()) - elif storage_type == StorageType.Double: - result["raw"] = float(parameter.AsDouble()) - elif storage_type == StorageType.ElementId: - result["raw"] = element_id_text(parameter.AsElementId()) - except Exception as error: - result["readError"] = safe_text(error) - - try: - result["display"] = parameter.AsValueString() - except Exception: - pass - return result - - -def describe_parameter(parameter): - definition = None - try: - definition = parameter.Definition - except Exception: - pass - - name = None - if definition is not None: - try: - name = definition.Name - except Exception: - pass - - is_shared = False - try: - is_shared = bool(parameter.IsShared) - except Exception: - pass - - shared_guid = None - if is_shared: - try: - shared_guid = str(parameter.GUID) - except Exception: - pass - - data_type = None - group_type = None - if definition is not None: - try: - data_type = forge_type_id_text(definition.GetDataType()) - except Exception: - pass - try: - group_type = forge_type_id_text(definition.GetGroupTypeId()) - except Exception: - pass - - unit_type = None - try: - unit_type = forge_type_id_text(parameter.GetUnitTypeId()) - except Exception: - pass - - try: - storage_type = str(parameter.StorageType) - except Exception: - storage_type = None - - try: - is_read_only = bool(parameter.IsReadOnly) - except Exception: - is_read_only = None - - try: - user_modifiable = bool(parameter.UserModifiable) - except Exception: - user_modifiable = None - - return { - "name": name, - "parameterId": element_id_text(getattr(parameter, "Id", None)), - "isShared": is_shared, - "sharedGuid": shared_guid, - "storageType": storage_type, - "dataTypeId": data_type, - "groupTypeId": group_type, - "unitTypeId": unit_type, - "isReadOnly": is_read_only, - "userModifiable": user_modifiable, - "value": parameter_value(parameter), - } - - -def sorted_parameters(element): - parameters = [] - try: - parameters = [describe_parameter(parameter) for parameter in element.Parameters] - except Exception: - return [] - return sorted( - parameters, - key=lambda parameter: ( - (parameter.get("name") or "").casefold(), - parameter.get("parameterId") or "", - ), - ) - - -def named_parameter_occurrences(element, parameter_name): - result = [] - try: - parameters = element.GetParameters(parameter_name) - if parameters is not None: - result = [describe_parameter(parameter) for parameter in parameters] - except Exception: - parameter = None - try: - parameter = element.LookupParameter(parameter_name) - except Exception: - pass - if parameter is not None: - result = [describe_parameter(parameter)] - return result - - -def loaded_assembly_versions(): - result = {} - try: - from System import AppDomain - - for assembly in AppDomain.CurrentDomain.GetAssemblies(): - try: - name = assembly.GetName() - simple_name = str(name.Name) - if simple_name in ( - "DynamoCore", - "DynamoCoreWpf", - "DynamoRevitDS", - "RevitAPI", - "RevitServices", - ): - result[simple_name] = str(name.Version) - except Exception: - continue - except Exception: - pass - return dict(sorted(result.items())) - - -def get_cloud_identity(document): - result = {"isModelInCloud": False} - try: - result["isModelInCloud"] = bool(document.IsModelInCloud) - except Exception: - return result - if not result["isModelInCloud"]: - return result - - try: - model_path = document.GetCloudModelPath() - result["userVisiblePath"] = ModelPathUtils.ConvertModelPathToUserVisiblePath( - model_path - ) - for property_name, output_name in ( - ("GetProjectGUID", "projectGuid"), - ("GetModelGUID", "modelGuid"), - ): - try: - result[output_name] = str(getattr(model_path, property_name)()) - except Exception: - pass - except Exception as error: - result["readError"] = safe_text(error) - return result - - -def get_worksharing_identity(document): - result = {"isWorkshared": False} - try: - result["isWorkshared"] = bool(document.IsWorkshared) - except Exception: - return result - if not result["isWorkshared"]: - return result - - try: - model_path = document.GetWorksharingCentralModelPath() - result["centralModelPath"] = ModelPathUtils.ConvertModelPathToUserVisiblePath( - model_path - ) - except Exception as error: - result["readError"] = safe_text(error) - return result - - -def resolve_output_path(configured_path, report_name): - timestamp = datetime.datetime.now().strftime("%Y%m%d-%H%M%S") - default_directory = os.path.join(tempfile.gettempdir(), "leistungsbilanz-dynamo") - raw_path = safe_text(configured_path) - if raw_path is None or not raw_path.strip(): - directory = default_directory - file_path = os.path.join(directory, report_name + "-" + timestamp + ".json") - else: - expanded = os.path.abspath(os.path.expandvars(os.path.expanduser(raw_path.strip()))) - if expanded.lower().endswith(".json"): - file_path = expanded - directory = os.path.dirname(file_path) - else: - directory = expanded - file_path = os.path.join(directory, report_name + "-" + timestamp + ".json") - if not directory: - directory = os.getcwd() - if not os.path.isdir(directory): - os.makedirs(directory) - return file_path - - -def write_json(file_path, payload): - temporary_path = file_path + ".tmp" - with open(temporary_path, "w", encoding="utf-8", newline="\n") as output: - json.dump(payload, output, ensure_ascii=False, indent=2, sort_keys=True) - output.write("\n") - os.replace(temporary_path, file_path) - - -def get_input(index, default=None): - values = globals().get("IN", []) - try: - value = values[index] - return default if value is None else value - except Exception: - return default - - -def build_report(): - document = DocumentManager.Instance.CurrentDBDocument - if document is None: - raise RuntimeError("No active Revit document is available.") - - project_information = document.ProjectInformation - if project_information is None: - raise RuntimeError("The active document has no Project Information element.") - - application = document.Application - checked_parameters = { - name: named_parameter_occurrences(project_information, name) - for name in CHECKED_PARAMETER_NAMES - } - warnings = [] - for name in CHECKED_PARAMETER_NAMES: - occurrences = checked_parameters[name] - populated = [ - parameter - for parameter in occurrences - if parameter.get("value", {}).get("raw") not in (None, "") - ] - if not occurrences: - warnings.append(name + " is not bound to Project Information.") - elif not populated: - warnings.append(name + " exists but has no value on Project Information.") - elif len(occurrences) > 1: - warnings.append(name + " occurs more than once; use a shared-parameter GUID later.") - - return { - "reportSchemaVersion": 1, - "generatedAt": datetime.datetime.now(datetime.timezone.utc).isoformat(), - "readOnly": True, - "environment": { - "revitVersionNumber": safe_text(getattr(application, "VersionNumber", None)), - "revitVersionName": safe_text(getattr(application, "VersionName", None)), - "revitSubVersionNumber": safe_text( - getattr(application, "SubVersionNumber", None) - ), - "pythonImplementation": safe_text(getattr(sys.implementation, "name", None)), - "pythonVersion": platform.python_version(), - "assemblies": loaded_assembly_versions(), - }, - "document": { - "title": safe_text(document.Title), - "pathName": safe_text(document.PathName), - "isFamilyDocument": bool(document.IsFamilyDocument), - "cloud": get_cloud_identity(document), - "worksharing": get_worksharing_identity(document), - }, - "modelIdentityCandidates": { - "projectInformationUniqueId": safe_text(project_information.UniqueId), - "projectInformationElementId": element_id_text(project_information.Id), - "checkedProjectParameters": checked_parameters, - }, - "projectInformationParameters": sorted_parameters(project_information), - "warnings": warnings, - } - - -try: - report = build_report() - output_path = resolve_output_path(get_input(0), "model-identity") - write_json(output_path, report) - OUT = { - "ok": True, - "filePath": output_path, - "projectInformationUniqueId": report["modelIdentityCandidates"][ - "projectInformationUniqueId" - ], - "warnings": report["warnings"], - "report": report, - } -except Exception as error: - OUT = { - "ok": False, - "error": safe_text(error), - "traceback": traceback.format_exc(), - } diff --git a/dynamo/02_export_electrical_fixture_parameter_inventory.py b/dynamo/02_export_electrical_fixture_parameter_inventory.py deleted file mode 100644 index 440a222..0000000 --- a/dynamo/02_export_electrical_fixture_parameter_inventory.py +++ /dev/null @@ -1,517 +0,0 @@ -"""Export all Electrical Fixtures instance/type parameters from Revit 2026. - -Optional Dynamo inputs: - IN[0]: output directory or complete .json file path - IN[1]: include empty parameters (default True) - IN[2]: maximum aggregated sample values (default 5) - -The script is read-only and performs no Revit transaction. -""" - -import datetime -import json -import os -import platform -import sys -import tempfile -import traceback - -import clr - -clr.AddReference("RevitAPI") -clr.AddReference("RevitServices") - -from Autodesk.Revit.DB import ( # noqa: E402 - BuiltInCategory, - FilteredElementCollector, - ModelPathUtils, - StorageType, -) -from RevitServices.Persistence import DocumentManager # noqa: E402 - - -def safe_text(value): - if value is None: - return None - try: - return str(value) - except Exception: - return None - - -def element_id_text(element_id): - if element_id is None: - return None - try: - return str(element_id.Value) - except Exception: - try: - return str(element_id.IntegerValue) - except Exception: - return safe_text(element_id) - - -def forge_type_id_text(value): - if value is None: - return None - try: - return value.TypeId - except Exception: - return safe_text(value) - - -def parameter_value(parameter): - result = {"hasValue": False, "raw": None, "display": None} - try: - result["hasValue"] = bool(parameter.HasValue) - except Exception: - pass - - try: - storage_type = parameter.StorageType - if storage_type == StorageType.String: - result["raw"] = parameter.AsString() - elif storage_type == StorageType.Integer: - result["raw"] = int(parameter.AsInteger()) - elif storage_type == StorageType.Double: - result["raw"] = float(parameter.AsDouble()) - elif storage_type == StorageType.ElementId: - result["raw"] = element_id_text(parameter.AsElementId()) - except Exception as error: - result["readError"] = safe_text(error) - - try: - result["display"] = parameter.AsValueString() - except Exception: - pass - return result - - -def describe_parameter(parameter, scope): - definition = None - try: - definition = parameter.Definition - except Exception: - pass - - name = None - data_type = None - group_type = None - if definition is not None: - try: - name = definition.Name - except Exception: - pass - try: - data_type = forge_type_id_text(definition.GetDataType()) - except Exception: - pass - try: - group_type = forge_type_id_text(definition.GetGroupTypeId()) - except Exception: - pass - - is_shared = False - try: - is_shared = bool(parameter.IsShared) - except Exception: - pass - - shared_guid = None - if is_shared: - try: - shared_guid = str(parameter.GUID) - except Exception: - pass - - unit_type = None - try: - unit_type = forge_type_id_text(parameter.GetUnitTypeId()) - except Exception: - pass - - try: - storage_type = str(parameter.StorageType) - except Exception: - storage_type = None - - try: - is_read_only = bool(parameter.IsReadOnly) - except Exception: - is_read_only = None - - try: - user_modifiable = bool(parameter.UserModifiable) - except Exception: - user_modifiable = None - - return { - "scope": scope, - "name": name, - "parameterId": element_id_text(getattr(parameter, "Id", None)), - "isShared": is_shared, - "sharedGuid": shared_guid, - "storageType": storage_type, - "dataTypeId": data_type, - "groupTypeId": group_type, - "unitTypeId": unit_type, - "isReadOnly": is_read_only, - "userModifiable": user_modifiable, - "value": parameter_value(parameter), - } - - -def has_meaningful_value(parameter_description): - value = parameter_description.get("value", {}) - return bool(value.get("hasValue")) or value.get("raw") not in (None, "") or value.get( - "display" - ) not in (None, "") - - -def read_parameters(element, scope, include_empty): - result = [] - try: - for parameter in element.Parameters: - description = describe_parameter(parameter, scope) - if include_empty or has_meaningful_value(description): - result.append(description) - except Exception as error: - return [], [safe_text(error)] - result.sort( - key=lambda parameter: ( - (parameter.get("name") or "").casefold(), - parameter.get("parameterId") or "", - ) - ) - return result, [] - - -def read_space(element, document): - try: - space = element.Space - except Exception as error: - return None, safe_text(error) - if space is None: - return None, None - - level_name = None - try: - level = document.GetElement(space.LevelId) - level_name = None if level is None else safe_text(level.Name) - except Exception: - pass - - return { - "uniqueId": safe_text(space.UniqueId), - "elementId": element_id_text(space.Id), - "number": safe_text(getattr(space, "Number", None)), - "name": safe_text(getattr(space, "Name", None)), - "levelName": level_name, - }, None - - -def read_family_identity(element, document): - symbol = None - try: - symbol = element.Symbol - except Exception: - try: - symbol = document.GetElement(element.GetTypeId()) - except Exception: - pass - - family_name = None - type_name = None - type_unique_id = None - type_element_id = None - if symbol is not None: - try: - family_name = safe_text(symbol.Family.Name) - except Exception: - family_name = safe_text(getattr(symbol, "FamilyName", None)) - type_name = safe_text(getattr(symbol, "Name", None)) - type_unique_id = safe_text(getattr(symbol, "UniqueId", None)) - type_element_id = element_id_text(getattr(symbol, "Id", None)) - - return { - "familyName": family_name, - "typeName": type_name, - "typeUniqueId": type_unique_id, - "typeElementId": type_element_id, - }, symbol - - -def parameter_inventory_key(parameter): - stable_id = parameter.get("sharedGuid") or parameter.get("parameterId") or "" - return "|".join( - ( - parameter.get("scope") or "", - stable_id, - parameter.get("name") or "", - parameter.get("dataTypeId") or "", - ) - ) - - -def sample_value_key(value): - return json.dumps(value, ensure_ascii=False, sort_keys=True, separators=(",", ":")) - - -def add_to_inventory(inventory, parameter, max_samples): - key = parameter_inventory_key(parameter) - entry = inventory.get(key) - if entry is None: - entry = { - "scope": parameter.get("scope"), - "name": parameter.get("name"), - "parameterId": parameter.get("parameterId"), - "isShared": parameter.get("isShared"), - "sharedGuid": parameter.get("sharedGuid"), - "storageType": parameter.get("storageType"), - "dataTypeId": parameter.get("dataTypeId"), - "groupTypeId": parameter.get("groupTypeId"), - "unitTypeId": parameter.get("unitTypeId"), - "occurrenceCount": 0, - "populatedCount": 0, - "sampleValues": [], - "_sampleKeys": set(), - } - inventory[key] = entry - entry["occurrenceCount"] += 1 - if has_meaningful_value(parameter): - entry["populatedCount"] += 1 - value = parameter.get("value") - value_key = sample_value_key(value) - if len(entry["sampleValues"]) < max_samples and value_key not in entry["_sampleKeys"]: - entry["_sampleKeys"].add(value_key) - entry["sampleValues"].append(value) - - -def finalize_inventory(inventory): - result = [] - for entry in inventory.values(): - clean_entry = dict(entry) - clean_entry.pop("_sampleKeys", None) - result.append(clean_entry) - return sorted( - result, - key=lambda entry: ( - entry.get("scope") or "", - (entry.get("name") or "").casefold(), - entry.get("sharedGuid") or entry.get("parameterId") or "", - ), - ) - - -def loaded_assembly_versions(): - result = {} - try: - from System import AppDomain - - for assembly in AppDomain.CurrentDomain.GetAssemblies(): - try: - name = assembly.GetName() - simple_name = str(name.Name) - if simple_name in ( - "DynamoCore", - "DynamoCoreWpf", - "DynamoRevitDS", - "RevitAPI", - "RevitServices", - ): - result[simple_name] = str(name.Version) - except Exception: - continue - except Exception: - pass - return dict(sorted(result.items())) - - -def resolve_output_path(configured_path): - timestamp = datetime.datetime.now().strftime("%Y%m%d-%H%M%S") - default_directory = os.path.join(tempfile.gettempdir(), "leistungsbilanz-dynamo") - raw_path = safe_text(configured_path) - if raw_path is None or not raw_path.strip(): - directory = default_directory - file_path = os.path.join( - directory, "electrical-fixture-parameters-" + timestamp + ".json" - ) - else: - expanded = os.path.abspath(os.path.expandvars(os.path.expanduser(raw_path.strip()))) - if expanded.lower().endswith(".json"): - file_path = expanded - directory = os.path.dirname(file_path) - else: - directory = expanded - file_path = os.path.join( - directory, "electrical-fixture-parameters-" + timestamp + ".json" - ) - if not directory: - directory = os.getcwd() - if not os.path.isdir(directory): - os.makedirs(directory) - return file_path - - -def write_json(file_path, payload): - temporary_path = file_path + ".tmp" - with open(temporary_path, "w", encoding="utf-8", newline="\n") as output: - json.dump(payload, output, ensure_ascii=False, indent=2, sort_keys=True) - output.write("\n") - os.replace(temporary_path, file_path) - - -def get_input(index, default=None): - values = globals().get("IN", []) - try: - value = values[index] - return default if value is None else value - except Exception: - return default - - -def build_report(include_empty, max_samples): - document = DocumentManager.Instance.CurrentDBDocument - if document is None: - raise RuntimeError("No active Revit document is available.") - if document.IsFamilyDocument: - raise RuntimeError("Open a Revit project document, not a family document.") - - application = document.Application - collector = ( - FilteredElementCollector(document) - .OfCategory(BuiltInCategory.OST_ElectricalFixtures) - .WhereElementIsNotElementType() - ) - source_elements = list(collector) - source_elements.sort(key=lambda element: safe_text(element.UniqueId) or "") - - elements = [] - types_by_unique_id = {} - inventory = {} - errors = [] - elements_without_space = 0 - - for element in source_elements: - element_errors = [] - try: - family_identity, symbol = read_family_identity(element, document) - instance_parameters, parameter_errors = read_parameters( - element, "instance", include_empty - ) - element_errors.extend(parameter_errors) - for parameter in instance_parameters: - add_to_inventory(inventory, parameter, max_samples) - - type_unique_id = family_identity.get("typeUniqueId") - if symbol is not None and type_unique_id and type_unique_id not in types_by_unique_id: - type_parameters, type_errors = read_parameters(symbol, "type", include_empty) - element_errors.extend(type_errors) - for parameter in type_parameters: - add_to_inventory(inventory, parameter, max_samples) - types_by_unique_id[type_unique_id] = { - **family_identity, - "parameters": type_parameters, - } - - space, space_error = read_space(element, document) - if space_error: - element_errors.append("MEP Space: " + space_error) - if space is None: - elements_without_space += 1 - - elements.append( - { - "uniqueId": safe_text(element.UniqueId), - "elementId": element_id_text(element.Id), - "categoryName": safe_text( - None if element.Category is None else element.Category.Name - ), - "family": family_identity, - "space": space, - "instanceParameters": instance_parameters, - "warnings": element_errors, - } - ) - except Exception as error: - errors.append( - { - "uniqueId": safe_text(getattr(element, "UniqueId", None)), - "elementId": element_id_text(getattr(element, "Id", None)), - "error": safe_text(error), - } - ) - - return { - "reportSchemaVersion": 1, - "generatedAt": datetime.datetime.now(datetime.timezone.utc).isoformat(), - "readOnly": True, - "complete": len(errors) == 0, - "scope": { - "builtInCategory": "OST_ElectricalFixtures", - "wholeDocument": True, - "elementTypesExcluded": True, - "includeEmptyParameters": include_empty, - }, - "environment": { - "revitVersionNumber": safe_text(getattr(application, "VersionNumber", None)), - "revitVersionName": safe_text(getattr(application, "VersionName", None)), - "revitSubVersionNumber": safe_text( - getattr(application, "SubVersionNumber", None) - ), - "pythonImplementation": safe_text(getattr(sys.implementation, "name", None)), - "pythonVersion": platform.python_version(), - "assemblies": loaded_assembly_versions(), - }, - "document": { - "title": safe_text(document.Title), - "pathName": safe_text(document.PathName), - "projectInformationUniqueId": safe_text(document.ProjectInformation.UniqueId), - }, - "summary": { - "elementCount": len(source_elements), - "exportedElementCount": len(elements), - "typeCount": len(types_by_unique_id), - "parameterDefinitionCount": len(inventory), - "elementsWithoutMepSpace": elements_without_space, - "elementErrorCount": len(errors), - }, - "parameterInventory": finalize_inventory(inventory), - "types": sorted( - types_by_unique_id.values(), - key=lambda entry: ( - (entry.get("familyName") or "").casefold(), - (entry.get("typeName") or "").casefold(), - entry.get("typeUniqueId") or "", - ), - ), - "elements": elements, - "errors": errors, - } - - -try: - include_empty_input = get_input(1, True) - include_empty = bool(include_empty_input) - try: - max_samples = int(get_input(2, 5)) - except Exception: - max_samples = 5 - max_samples = max(0, min(max_samples, 50)) - - report = build_report(include_empty, max_samples) - output_path = resolve_output_path(get_input(0)) - write_json(output_path, report) - OUT = { - "ok": True, - "filePath": output_path, - "complete": report["complete"], - "summary": report["summary"], - "errors": report["errors"], - } -except Exception as error: - OUT = { - "ok": False, - "error": safe_text(error), - "traceback": traceback.format_exc(), - } diff --git a/dynamo/README.md b/dynamo/README.md deleted file mode 100644 index 800eded..0000000 --- a/dynamo/README.md +++ /dev/null @@ -1,69 +0,0 @@ -# Revit 2026 / Dynamo diagnostics - -This directory contains self-contained Python scripts for a Dynamo **Python -Script** node. They use only Dynamo's built-in Revit integration, the Revit API -and the Python standard library. No Dynamo package is required. - -The scripts are read-only. They do not start a Revit transaction and do not -change the open model. - -## Python engine - -Use the built-in `CPython3` engine in Revit 2026. Autodesk ships Dynamo with -Revit; optional PythonNet3 packages are not required by these diagnostics. - -## 01 - Check model identity - -File: `01_check_model_identity.py` - -The script reports: - -- Revit, Dynamo and Python versions; -- `ProjectInformation.UniqueId` as a native model-identity candidate; -- all occurrences and values of `LB_ModelId` and `LB_ProjectId` on Project - Information; -- all Project Information parameters; -- optional cloud/worksharing identity information when the API exposes it. - -Input `IN[0]` is optional. It may be either an output directory or a complete -`.json` file path. With no input, the report is written below the current -Windows temporary directory in `leistungsbilanz-dynamo`. - -## 02 - Inventory Electrical Fixtures parameters - -File: `02_export_electrical_fixture_parameter_inventory.py` - -The script reads every instance of -`BuiltInCategory.OST_ElectricalFixtures` in the complete current document. It -exports: - -- element, family, type and MEP Space identities; -- every instance parameter and value; -- every unique family-type parameter and value; -- an aggregated parameter inventory with occurrence counts and sample values; -- per-element warnings instead of aborting at the first unreadable element. - -Inputs: - -- `IN[0]` (optional): output directory or complete `.json` path; -- `IN[1]` (optional): include empty parameters, default `true`; -- `IN[2]` (optional): maximum sample values per aggregated parameter, default - `5`. - -The default output location is again the Windows temporary directory. The -generated report can contain model paths and project-specific parameter values; -review it before sharing or committing it. - -## Running a script - -1. Open the target model in Revit 2026. -2. Open Dynamo from **Manage > Visual Programming > Dynamo**. -3. Create a graph and add a **Python Script** node. -4. Select the `CPython3` engine for the node. -5. Copy the complete content of the desired `.py` file into the node. -6. Optionally connect a String node containing the output path to `IN[0]`. -7. Run the graph and inspect `OUT` for status, counts and the generated path. - -For the first test, run `01_check_model_identity.py` in the Revit main model. -Then run the parameter inventory. Keep both generated JSON files so their -structure can be checked before the production snapshot DTO is finalized. diff --git a/scripts/db-verify-circuit-schema.js b/scripts/db-verify-circuit-schema.js index 8680f59..947767a 100644 --- a/scripts/db-verify-circuit-schema.js +++ b/scripts/db-verify-circuit-schema.js @@ -5,6 +5,7 @@ const dbPath = path.resolve("data", "leistungsbilanz.db"); const db = new Database(dbPath, { readonly: true }); const requiredTables = [ + "buildings", "circuit_sections", "circuits", "circuit_device_rows", @@ -12,6 +13,8 @@ const requiredTables = [ "circuit_protection_devices", "distribution_board_components", "distribution_board_component_protection_devices", + "document_branding_assets", + "document_branding_settings", ]; const tablePlaceholders = requiredTables.map(() => "?").join(", "); @@ -87,6 +90,10 @@ const requiredProjectColumns = [ "description", "is_public_building", "enabled_distribution_board_supply_types", + "site_address", + "work_stage", + "project_lead", + "project_editor", ]; const projectColumns = new Set( db.prepare("PRAGMA table_info(projects)").all().map((column) => column.name) @@ -94,10 +101,21 @@ const projectColumns = new Set( const missingProjectColumns = requiredProjectColumns.filter( (name) => !projectColumns.has(name) ); +const requiredFloorColumns = ["building_id"]; +const floorColumns = new Set( + db.prepare("PRAGMA table_info(floors)").all().map((column) => column.name) +); +const missingFloorColumns = requiredFloorColumns.filter( + (name) => !floorColumns.has(name) +); const requiredDistributionBoardColumns = [ "floor_id", "supply_type", "simultaneity_factor", + "board_number", + "location", + "fed_from", + "remark", ]; const distributionBoardColumns = new Set( db @@ -145,6 +163,7 @@ console.log( requiredCircuitSectionColumns.join(", ") ); console.log("Required project columns:", requiredProjectColumns.join(", ")); +console.log("Required floor columns:", requiredFloorColumns.join(", ")); console.log( "Required distribution-board columns:", requiredDistributionBoardColumns.join(", ") @@ -161,6 +180,11 @@ if (missing.length > 0) { process.exit(1); } +if (missingFloorColumns.length > 0) { + console.error("Missing floor columns:", missingFloorColumns.join(", ")); + process.exit(1); +} + if (missingProjectDeviceColumns.length > 0) { console.error("Missing project-device columns:", missingProjectDeviceColumns.join(", ")); process.exit(1); diff --git a/src/app/globals.css b/src/app/globals.css index a8a382d..d5f9f4a 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -220,7 +220,7 @@ a { --bs-alert-border-color: #205a38; } -/* ── App-Shell / Seitenleiste (nur auf der Projektseite) ────────────────── */ +/* ── App-Shell / Seitenleiste (alle Seiten außer der Seitenansicht) ──── */ .app-shell { display: grid; @@ -1861,3 +1861,144 @@ a.kpi:hover { .sidebar-collapsed .sidebar-label { display: none; } + +/* ── Gebäudestruktur (Gebäude → Etagen → Räume) ─────────────────────── */ + +.structure-columns { + display: grid; + grid-template-columns: minmax(0, 1fr); + gap: var(--space-md); + align-items: start; +} + +@media (min-width: 992px) { + .structure-columns { + grid-template-columns: repeat(3, minmax(0, 1fr)); + } +} + +.structure-column-title { + font-size: 1rem; + font-weight: 700; + margin: 0; + display: flex; + align-items: center; +} + +.structure-icon-button { + display: inline-flex; + align-items: center; + justify-content: center; + padding: 0.25rem 0.4rem; + line-height: 1; +} + +.structure-back-link { + display: inline-flex; + align-items: center; + justify-content: center; + padding: 0.35rem 0.45rem; + margin-top: 0.1rem; +} + +.structure-list { + max-height: 70vh; + overflow-y: auto; +} + +.structure-entry { + display: flex; + align-items: center; + gap: var(--space-sm); + padding: 0; +} + +.structure-entry-main { + flex: 1 1 auto; + min-width: 0; + display: flex; + align-items: center; + justify-content: space-between; + gap: var(--space-sm); + padding: 0.55rem 0.75rem; + border: 0; + background: transparent; + color: inherit; + text-align: left; + font: inherit; +} + +button.structure-entry-main { + cursor: pointer; +} + +button.structure-entry-main:hover { + background: var(--surface-hover); +} + +button.structure-entry-main:focus-visible { + outline: 2px solid var(--accent-blue); + outline-offset: -2px; +} + +.structure-entry.is-selected { + background: var(--surface-selected); + box-shadow: inset 3px 0 0 var(--color-signal); +} + +.structure-entry.is-selected .structure-entry-label { + font-weight: 600; +} + +.structure-entry.is-selected button.structure-entry-main:hover { + background: transparent; +} + +.structure-entry-text { + min-width: 0; + display: flex; + flex-direction: column; +} + +.structure-entry-label { + overflow-wrap: anywhere; +} + +.structure-entry-hint { + font-size: 0.78rem; + color: var(--color-ink-soft); +} + +.structure-entry-meta { + flex: 0 0 auto; + font-size: 0.78rem; + color: var(--color-ink-soft); + white-space: nowrap; +} + +.structure-entry-actions { + flex: 0 0 auto; + display: inline-flex; + gap: 4px; + padding-right: 0.75rem; +} + +.structure-room-number { + font-weight: 600; + font-variant-numeric: tabular-nums; +} + +.structure-group-label { + font-size: 0.66rem; + letter-spacing: 0.08em; + text-transform: uppercase; + font-weight: 600; + color: var(--color-accent); + background: var(--panel-bg-subtle); + padding: 0.35rem 0.75rem; +} + +.structure-empty { + color: var(--color-ink-soft); + font-size: 0.9rem; +} diff --git a/src/app/projects/[projectId]/page.tsx b/src/app/projects/[projectId]/page.tsx index c08b72e..ed03cd9 100644 --- a/src/app/projects/[projectId]/page.tsx +++ b/src/app/projects/[projectId]/page.tsx @@ -49,17 +49,15 @@ import { copyDistributionBoard, copyProjectDeviceToGlobal, createDistributionBoard, - createFloor, createProjectDevice, createRoom, - deleteFloor, deleteProjectDevice, - deleteRoom, deleteDistributionBoard, disconnectProjectDeviceRows, exportProjectTransfer, getProject, getProjectDeviceSyncPreview, + listBuildings, listCircuitLists, listDistributionBoards, listFloors, @@ -69,12 +67,11 @@ import { importProjectTransfer, synchronizeProjectDeviceRows, updateDistributionBoard, - updateFloor, updateProjectDevice, updateProjectSettings, - updateRoom, } from "../../../frontend/utils/api"; import type { + BuildingDto, CircuitListDto, CreateRoomInput, CreateProjectDeviceInput, @@ -95,6 +92,13 @@ import { type DistributionBoardSupplyType, } from "../../../shared/constants/distribution-board"; import { ProjectVersionHistory } from "../../../frontend/components/project-version-history"; +import { + DistributionBoardInfoCard, + fromDistributionBoardInfoDraft, + toDistributionBoardInfoDraft, + type DistributionBoardInfoDraft, +} from "../../../frontend/components/distribution-board-info-card"; +import { Printer } from "lucide-react"; import { ProjectSettingsModal, type ProjectSettingsInput, @@ -102,7 +106,7 @@ import { import { FormModal } from "../../../frontend/components/form-modal"; import { ProjectDeviceModal } from "../../../frontend/components/project-device-modal"; import { RevitCsvModal } from "../../../frontend/components/revit-csv-modal"; -import { RoomModal } from "../../../frontend/components/room-modal"; +import { FloorSelectOptions } from "../../../frontend/components/floor-select-options"; const projectDeviceSyncFieldLabels: Record = { name: "Technischer Name", @@ -147,6 +151,7 @@ export default function ProjectDetailPage() { const [project, setProject] = useState(null); const [boards, setBoards] = useState([]); const [circuitLists, setCircuitLists] = useState([]); + const [buildings, setBuildings] = useState([]); const [floors, setFloors] = useState([]); const [rooms, setRooms] = useState([]); const [projectDevices, setProjectDevices] = useState([]); @@ -165,14 +170,18 @@ export default function ProjectDetailPage() { setEditingBoardSimultaneityFactor, ] = useState("1"); const [editingBoardCopyName, setEditingBoardCopyName] = useState(""); - const [floorName, setFloorName] = useState(""); - const [editingFloor, setEditingFloor] = useState(null); - const [editingRoom, setEditingRoom] = useState(null); + const [editingBoardInfo, setEditingBoardInfo] = + useState( + toDistributionBoardInfoDraft({ + boardNumber: null, + location: null, + fedFrom: null, + remark: null, + }) + ); const [isProjectSettingsOpen, setIsProjectSettingsOpen] = useState(false); const [isRevitCsvOpen, setIsRevitCsvOpen] = useState(false); - const [structureModal, setStructureModal] = useState< - "board" | "floor" | "room" | null - >(null); + const [structureModal, setStructureModal] = useState<"board" | null>(null); const [isProjectDeviceModalOpen, setIsProjectDeviceModalOpen] = useState(false); const [editingProjectDevice, setEditingProjectDevice] = @@ -200,6 +209,7 @@ export default function ProjectDetailPage() { getProject(projectId), listDistributionBoards(projectId), listCircuitLists(projectId), + listBuildings(projectId), listFloors(projectId), listRooms(projectId), listProjectDevices(projectId), @@ -209,6 +219,7 @@ export default function ProjectDetailPage() { currentProject, distributionBoards, loadedCircuitLists, + loadedBuildings, loadedFloors, loadedRooms, loadedProjectDevices, @@ -217,6 +228,7 @@ export default function ProjectDetailPage() { setProject(currentProject); setBoards(distributionBoards); setCircuitLists(loadedCircuitLists); + setBuildings(loadedBuildings); setFloors(loadedFloors); setRooms(loadedRooms); setProjectDevices(loadedProjectDevices); @@ -229,6 +241,7 @@ export default function ProjectDetailPage() { }, [projectId]); const boardCount = useMemo(() => boards.length, [boards.length]); + const buildingCount = useMemo(() => buildings.length, [buildings.length]); const floorCount = useMemo(() => floors.length, [floors.length]); const roomCount = useMemo(() => rooms.length, [rooms.length]); const projectDeviceCount = useMemo(() => projectDevices.length, [projectDevices.length]); @@ -358,74 +371,6 @@ export default function ProjectDetailPage() { } } - async function handleSaveFloor(event: FormEvent) { - event.preventDefault(); - if (!projectId || !project || !floorName.trim()) { - return; - } - setIsSaving(true); - setError(null); - try { - const result = editingFloor - ? await updateFloor( - projectId, - editingFloor.id, - { name: floorName.trim() }, - project.currentRevision - ) - : await createFloor( - projectId, - { name: floorName.trim() }, - project.currentRevision - ); - setFloors((current) => - editingFloor - ? current.map((floor) => - floor.id === result.floor.id ? result.floor : floor - ) - : [...current, result.floor] - ); - applyProjectRevision(result.history.currentRevision); - setFloorName(""); - setEditingFloor(null); - setStructureModal(null); - } catch (err) { - setError(err instanceof Error ? err.message : "Etage konnte nicht gespeichert werden."); - } finally { - setIsSaving(false); - } - } - - async function handleSaveRoom(input: CreateRoomInput) { - if (!projectId || !project) return; - setIsSaving(true); - setError(null); - try { - const result = editingRoom - ? await updateRoom( - projectId, - editingRoom.id, - input, - project.currentRevision - ) - : await createRoom(projectId, input, project.currentRevision); - setRooms((current) => - editingRoom - ? current.map((room) => - room.id === result.room.id ? result.room : room - ) - : [...current, result.room] - ); - applyProjectRevision(result.history.currentRevision); - setEditingRoom(null); - setStructureModal(null); - } catch (err) { - setError(err instanceof Error ? err.message : "Raum konnte nicht gespeichert werden."); - } finally { - setIsSaving(false); - } - } - async function handleSaveProjectSettings(input: ProjectSettingsInput) { if (!projectId || !project) { return; @@ -542,6 +487,7 @@ export default function ProjectDetailPage() { String(board.simultaneityFactor) ); setEditingBoardCopyName(`${board.name} Kopie`); + setEditingBoardInfo(toDistributionBoardInfoDraft(board)); } function openBoardCreator() { @@ -577,6 +523,7 @@ export default function ProjectDetailPage() { floorId: editingBoardFloorId || null, supplyType: editingBoardSupplyType, simultaneityFactor, + ...fromDistributionBoardInfoDraft(editingBoardInfo), }, project.currentRevision ); @@ -616,65 +563,6 @@ export default function ProjectDetailPage() { return result; } - function openCreateFloor() { - setEditingFloor(null); - setFloorName(""); - setStructureModal("floor"); - } - - function openEditFloor(floor: FloorDto) { - setEditingFloor(floor); - setFloorName(floor.name); - setStructureModal("floor"); - } - - function openCreateRoom() { - setEditingRoom(null); - setStructureModal("room"); - } - - function openEditRoom(room: RoomDto) { - setEditingRoom(room); - setStructureModal("room"); - } - - async function handleDeleteFloor() { - if (!projectId || !project || !editingFloor) return; - if (!window.confirm(`Etage „${editingFloor.name}“ wirklich löschen?`)) return; - setIsSaving(true); - setError(null); - try { - const result = await deleteFloor(projectId, editingFloor.id, project.currentRevision); - setFloors((current) => current.filter((floor) => floor.id !== editingFloor.id)); - applyProjectRevision(result.history.currentRevision); - setEditingFloor(null); - setFloorName(""); - setStructureModal(null); - } catch (err) { - setError(err instanceof Error ? err.message : "Etage konnte nicht gelöscht werden."); - } finally { - setIsSaving(false); - } - } - - async function handleDeleteRoom() { - if (!projectId || !project || !editingRoom) return; - if (!window.confirm(`Raum „${editingRoom.roomNumber} ${editingRoom.roomName}“ wirklich löschen?`)) return; - setIsSaving(true); - setError(null); - try { - const result = await deleteRoom(projectId, editingRoom.id, project.currentRevision); - setRooms((current) => current.filter((room) => room.id !== editingRoom.id)); - applyProjectRevision(result.history.currentRevision); - setEditingRoom(null); - setStructureModal(null); - } catch (err) { - setError(err instanceof Error ? err.message : "Raum konnte nicht gelöscht werden."); - } finally { - setIsSaving(false); - } - } - async function handleCopyBoard() { if ( !projectId || @@ -967,6 +855,14 @@ export default function ProjectDetailPage() {

+ +
{boardCount}
- + +
Gebäude
+
{buildingCount}
+ +
Etagen
{floorCount}
-
- + +
Räume
{roomCount}
-
+
Projektgeräte
{projectDeviceCount}
@@ -1084,7 +984,9 @@ export default function ProjectDetailPage() { + + @@ -1096,7 +998,11 @@ export default function ProjectDetailPage() { const circuitList = circuitListByBoardId.get(board.id); return ( + + - @@ -1161,88 +1067,6 @@ export default function ProjectDetailPage() { - -
-
-
-
- Etagen - {floorCount} -
- -
-
    - {floors.map((floor) => ( -
  • - {floor.name} - -
  • - ))} - {!floors.length ? ( -
  • Noch keine Etagen vorhanden.
  • - ) : null} -
-
-
- -
-
-
-
- Räume - {roomCount} -
- -
-
-
Nr. VerteilungÖrtlichkeit Etage Netzart GZF
+ {board.boardNumber ?? "–"} + {board.name}{board.location ?? "–"} {board.floorId ? floorById.get(board.floorId)?.name ?? "Unbekannt" @@ -1146,7 +1052,7 @@ export default function ProjectDetailPage() { })} {!boards.length ? (
+ Noch keine Verteilungen vorhanden.
- - - - - - - - - - {rooms.map((room) => ( - - - - - - - ))} - {!rooms.length ? ( - - - - ) : null} - -
RaumnummerRaumnameEtageAktionen
{room.roomNumber}{room.roomName}{room.floorId ? floorById.get(room.floorId)?.name ?? "-" : "-"} - -
- Noch keine Räume vorhanden. -
- - -
@@ -1535,11 +1359,7 @@ export default function ProjectDetailPage() { value={boardFloorId} > - {floors.map((floor) => ( - - ))} +
@@ -1605,11 +1425,7 @@ export default function ProjectDetailPage() { value={editingBoardFloorId} > - {floors.map((floor) => ( - - ))} +
@@ -1663,6 +1479,12 @@ export default function ProjectDetailPage() {
+
+ +

) : null} - {structureModal === "floor" ? ( - { - setStructureModal(null); - setEditingFloor(null); - }} - onSubmit={handleSaveFloor} - submitDisabled={!floorName.trim()} - submitLabel={editingFloor ? "Änderungen speichern" : "Etage hinzufügen"} - title={editingFloor ? "Etage bearbeiten" : "Etage hinzufügen"} - > - - setFloorName(event.target.value)} - placeholder="z. B. EG" - required - value={floorName} - /> - {editingFloor ? ( -
-

- Etagen mit zugeordneten Räumen oder Verteilungen können nicht gelöscht werden. -

- -
- ) : null} -
- ) : null} - - {structureModal === "room" ? ( - { - setStructureModal(null); - setEditingRoom(null); - }} - onDelete={editingRoom ? () => void handleDeleteRoom() : undefined} - onSave={handleSaveRoom} - /> - ) : null} - {isProjectDeviceModalOpen ? ( \r\n]/g, " ")); +} + +function pageRules(project: ProjectDto, stand: string, format: PlanFormat) { + const marginBoxes = ` + @bottom-left { content: ${cssString(`${project.name} · Leistungsbilanz`)}; font: 7.5pt Arial, sans-serif; color: #6b7280; } + @bottom-center { content: ${cssString(`Stand ${stand} · Datenstand Rev. ${project.currentRevision}`)}; font: 7.5pt Arial, sans-serif; color: #6b7280; } + @bottom-right { content: "Seite " counter(page) " von " counter(pages); font: 7.5pt Arial, sans-serif; color: #6b7280; }`; + return ` + @page lb-portrait { size: A4 portrait; margin: 14mm 16mm 16mm; ${marginBoxes} } + @page lb-landscape { size: ${format === "a3" ? "A3" : "A4"} landscape; margin: 10mm 10mm 13mm; ${marginBoxes} }`; +} + +export default function ProjectPrintPage() { + const params = useParams<{ projectId: string }>(); + const projectId = params.projectId; + const [data, setData] = useState(null); + const [logo, setLogo] = useState(null); + const [office, setOffice] = useState({ + officeName: null, + officeAddress: null, + }); + const [officeDraft, setOfficeDraft] = useState<{ + officeName: string; + officeAddress: string; + } | null>(null); + const [format, setFormat] = useState("a4"); + const [error, setError] = useState(null); + const [message, setMessage] = useState(null); + const [isBusy, setIsBusy] = useState(false); + const [printedAt] = useState(() => new Date()); + + useEffect(() => { + if (!projectId) { + return; + } + let cancelled = false; + async function load() { + const [project, boards, circuitLists, floors, snapshots, branding] = + await Promise.all([ + getProject(projectId), + listDistributionBoards(projectId), + listCircuitLists(projectId), + listFloors(projectId), + listProjectSnapshots(projectId), + getDocumentBranding(), + ]); + const floorNameById = new Map(floors.map((floor) => [floor.id, floor.name])); + const summaries = await Promise.all( + [...boards] + .sort( + (left, right) => + boardSortCollator.compare(left.boardNumber ?? "", right.boardNumber ?? "") || + boardSortCollator.compare(left.name, right.name) + ) + .flatMap((board) => { + const circuitList = circuitLists.find( + (list) => list.distributionBoardId === board.id + ); + return circuitList ? [{ board, circuitList }] : []; + }) + .map(async ({ board, circuitList }) => + summarizePrintBoard({ + board, + circuitListId: circuitList.id, + tree: await getCircuitTree(projectId, circuitList.id), + floorName: board.floorId ? floorNameById.get(board.floorId) ?? null : null, + }) + ) + ); + const finalProject = await getProject(projectId); + assertPrintRevisionConsistency(project.currentRevision, summaries, finalProject.currentRevision); + if (cancelled) { + return; + } + setData({ + project, + summaries, + namedSnapshots: snapshots + .filter((snapshot) => snapshot.kind === "named") + .sort((left, right) => left.createdAtIso.localeCompare(right.createdAtIso)), + }); + setLogo(branding.logo); + setOffice(branding.office); + document.title = `Leistungsbilanz – ${project.name}`; + } + load().catch((err: unknown) => { + if (!cancelled) { + setError(err instanceof Error ? err.message : "Die Seitenansicht konnte nicht geladen werden."); + } + }); + return () => { + cancelled = true; + }; + }, [projectId]); + + const entries = useMemo( + () => (data ? buildPreliminaryBoardHierarchy(data.summaries) : []), + [data] + ); + const stand = useMemo( + () => + new Intl.DateTimeFormat("de-DE", { + day: "2-digit", + month: "2-digit", + year: "numeric", + }).format(printedAt), + [printedAt] + ); + const logoSrc = logo + ? `${documentLogoUrl}?v=${encodeURIComponent(logo.updatedAtIso)}` + : null; + + async function handleLogoUpload(event: ChangeEvent) { + const file = event.target.files?.[0]; + event.target.value = ""; + if (!file) { + return; + } + if (!(documentLogoMimeTypes as readonly string[]).includes(file.type)) { + setError("Bitte ein PNG-, JPG- oder SVG-Bild wählen."); + return; + } + if (file.size > maxDocumentLogoBytes) { + setError("Das Logo darf höchstens 2 MB groß sein."); + return; + } + setIsBusy(true); + setError(null); + try { + const result = await uploadDocumentLogo(file); + setLogo(result.logo); + setMessage("Logo hinterlegt. Es gilt für alle Projekte."); + } catch (err) { + setError(err instanceof Error ? err.message : "Das Logo konnte nicht gespeichert werden."); + } finally { + setIsBusy(false); + } + } + + async function handleOfficeSave(event: FormEvent) { + event.preventDefault(); + if (!officeDraft) { + return; + } + setIsBusy(true); + setError(null); + try { + const result = await updateOfficeProfile({ + officeName: officeDraft.officeName.trim() || null, + officeAddress: officeDraft.officeAddress.trim() || null, + }); + setOffice(result.office); + setOfficeDraft(null); + setMessage("Büroangaben gespeichert. Sie gelten für alle Projekte."); + } catch (err) { + setError(err instanceof Error ? err.message : "Die Büroangaben konnten nicht gespeichert werden."); + } finally { + setIsBusy(false); + } + } + + async function handleLogoDelete() { + if (!window.confirm("Hinterlegtes Logo für alle Projekte entfernen?")) { + return; + } + setIsBusy(true); + setError(null); + try { + await deleteDocumentLogo(); + setLogo(null); + setMessage("Logo entfernt."); + } catch (err) { + setError(err instanceof Error ? err.message : "Das Logo konnte nicht entfernt werden."); + } finally { + setIsBusy(false); + } + } + + return ( + // Paper output: always light, independent of the app's dark mode. +
+ {data ? : null} +
+ + Seitenansicht{data ? ` · ${data.project.name}` : ""} + + {message ? {message} : null} + {error ? {error} : null} + + + + {logo ? ( + + ) : null} + + + Zum Projekt + +
+ {officeDraft ? ( + setOfficeDraft(null)} + onSubmit={handleOfficeSave} + submitLabel="Büroangaben speichern" + title="Büroangaben" + > +
+
+ + + setOfficeDraft({ ...officeDraft, officeName: event.target.value }) + } + value={officeDraft.officeName} + /> +
+
+ +