Files
leistungsbilanz-ts/docs/spec/07-implementation-phases-todo.md
2026-05-03 19:15:46 +02:00

242 lines
6.1 KiB
Markdown

# Implementation Phases and Todo List
## Important Strategy
There is already an existing codebase.
Do not blindly continue with the current implementation if it conflicts with this specification.
Do not blindly delete the current codebase either.
First audit the existing code against this specification, then refactor or replace the parts that conflict with the target model.
The most important architectural correction is:
A circuit is not the same thing as one device row.
A circuit contains zero, one or multiple device rows.
## Phase 0: Audit Existing Codebase
Goal:
Determine which parts of the current codebase can be kept.
Tasks:
- identify current data model
- identify whether rows are modeled as circuits, devices or mixed entities
- identify hardcoded section logic
- identify current drag-and-drop implementation
- identify current table/editing implementation
- identify current project device concept
- identify persistence layer and migrations
- list conflicts with the new specification
- propose refactor plan before changing code
Deliverable:
- short audit report
- keep/refactor/delete recommendation per major module
## Phase 1: Core Data Model and Basic Table
Goal:
Implement the stable foundation.
Tasks:
- define sections
- define circuits
- define circuit device rows
- define project devices
- allow manual rows
- allow empty/reserve circuits
- calculate row total power
- calculate circuit total power
- display sections as separator rows
- display single-device circuits as compact rows
- display multi-device circuits with summary row and indented device rows
- implement manual equipment identifier editing
- implement next identifier generation as highest number + 1
- prevent automatic renumbering
Acceptance criteria:
- a section can contain multiple circuits
- a circuit can contain zero, one or multiple device rows
- deleting a device does not automatically delete the circuit unless the user chooses so
- circuit total power is calculated from all device rows
- equipment identifiers are stable unless manually changed or explicitly renumbered
## Phase 2: Spreadsheet-Like Editing
Goal:
Make the table efficient to edit.
Tasks:
- static text cells by default
- inline editing on double click / Enter / typing / F2
- Enter, Tab, Shift+Tab, Escape behavior
- keyboard navigation
- Ctrl + Plus row insertion
- Ctrl + Shift + Plus support
- Delete behavior
- validation warnings for duplicate identifiers
Acceptance criteria:
- common values can be edited without opening full forms
- keyboard workflow is usable for repetitive entry
- accidental edits can be cancelled
## Phase 3: Project Device Sidebar
Goal:
Allow dragging project devices into the circuit list.
Tasks:
- implement project device list
- search project devices
- filter project devices
- show basic technical values
- drag project device into valid section
- drop onto free placeholder to create a circuit
- drop onto existing circuit to add device
- create linked device rows
- prefill display name but keep it local after insertion
Acceptance criteria:
- project devices can create new circuits
- project devices can be added to existing circuits
- invalid sections reject drops or require confirmation
- linked rows keep the source relationship
## Phase 4: Drag-and-Drop Restructuring
Goal:
Allow restructuring circuits and device assignments.
Tasks:
- drag from circuit handle moves whole circuit
- drag from device area moves device row
- move device between circuits
- move device to free placeholder to create new circuit
- move circuit inside section
- visual drop indicator
- valid/invalid drop zone feedback
- multi-row selection with Ctrl + click and Shift + click
- multi-row drag preserving internal order
Acceptance criteria:
- circuits can be reordered without renumbering
- devices can be reassigned to other circuits
- circuit totals recalculate after moves
- multi-row movement does not break circuit/device grouping
## Phase 5: Filtering, Sorting and Columns
Goal:
Add Excel-like table management.
Tasks:
- filter menu per column header
- sort ascending/descending per column
- sorting circuits as complete blocks
- preserve device grouping when sorting
- column visibility configuration
- column reorder by drag and drop
- reset default column layout
Acceptance criteria:
- user can filter by room, cost group, category, phase type, etc.
- user can sort within sections
- sorting does not split circuits
- sorting does not renumber
- user can renumber explicitly after sorting
## Phase 6: Undo / Redo
Goal:
Make structural editing safe.
Tasks:
- implement undo/redo stack
- support insert circuit
- support insert device
- support delete circuit
- support delete device
- support move circuit
- support move device
- support multi-row move
- support renumber section
- support cell edits
- support sync operations
- support disconnect linked project device
Acceptance criteria:
- destructive changes can be reverted
- renumbering can be undone
- drag-and-drop restructuring can be undone
Note:
Undo/redo should be considered from the beginning. Implement technically as early as possible if the architecture allows it.
## Phase 7: Linked Device Synchronization
Goal:
Control updates from project devices to circuit list rows.
Tasks:
- track linked project devices
- track overridden fields
- show affected rows when a project device changes
- implement sync dialog
- allow field-level selection
- apply to one / selected / all linked rows
- allow disconnecting selected rows
Acceptance criteria:
- displayName is not synchronized by default
- user sees affected distribution boards and circuits
- user controls which fields are overwritten
- local values are not silently lost
## Phase 8: Future Sizing Preparation
Goal:
Prepare for future electrical sizing logic.
Tasks:
- keep circuit-level protection and cable fields
- keep voltage and cosPhi
- support future control requirement
- structure sizing rules separately from UI
- add warning/status concept
Acceptance criteria:
- the codebase can later add rule-based sizing without redesigning circuits/devices
- users can manually override calculated suggestions