fix(supply): unit edits now persist + regroup editor + expected price as pre-market KI view

- MockupUnitProvider.update: immutable update (new unit/units/property refs) so React Query detects the change and re-renders — fixes "parking/price edit doesn't take effect"
- UnitFieldsEditor: group Ausbaustandard + Wer-baut-aus + MAB into one "Ausbau" section; conditions (price/availability/parking) on top; removed the plain expected-price field
- PreMarketUnitGrid: expected price is now a KI recommendation view (indexed suggestion + rationale) shown only for released units, with an adjustable override + "Vorschlag übernehmen"

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Benjamin SutterandClaude Opus 4.8 committed 2026-06-21 00:14:27 +02:00
1 parent 74f9660581
commit 3e1e945661
3 files changed
+104 -56

No files matched your search

+8 -3
View File
@@ -17,11 +17,16 @@ export const MockupUnitProvider: IUnitProvider = {
return getAllUnits().find(u => u.id === unitId) ?? null
},
async update(unitId: string, data: Partial<PropertyUnit>) {
for (const prop of propertyStore) {
for (let i = 0; i < propertyStore.length; i++) {
const prop = propertyStore[i]
const idx = (prop.units ?? []).findIndex(u => u.id === unitId)
if (idx === -1) continue
prop.units![idx] = { ...prop.units![idx], ...data }
return prop.units![idx]
// Immutable update: neue Referenzen (Unit, units-Array, Property), damit React Query
// die Änderung via Structural-Sharing erkennt und neu rendert.
const nextUnits = [...prop.units!]
nextUnits[idx] = { ...nextUnits[idx], ...data }
propertyStore[i] = { ...prop, units: nextUnits }
return nextUnits[idx]
}
throw new Error(`Unit ${unitId} not found`)
},