feat(supply): per-unit fit-out/cost-bearer/MAB/parking with object fallback (resolveUnitFacts)
- unit: add fitOutByLandlord, mieterausbaubeitragPerSqm, parkingSpots (parking = allocation from object pool) - lib/unitFacts.resolveUnitFacts: single resolver (unit value ?? object value) used by scorer + card adapter - matchSyncService: pre-market unit scored via resolved facts (fit-out, MAB, cost-bearer, parking allocation) - matchCardAdapter: fit-out label/viability/investment via resolveUnitFacts - UnitStructurePanel: consolidate ALL per-unit overrides into the one expandable row editor (price, availability, Ausbaustandard, Wer-baut-aus, MAB, parking allocation); show parking on row - PreMarketUnitGrid/Panel: drop the duplicate per-unit fit-out select (now in the unit editor) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import type { Property, PropertyUnit } from '../domain/property'
|
||||
|
||||
export interface ResolvedUnitFacts {
|
||||
fitOut?: 'SHELL' | 'BASIC' | 'FULL' | 'PREMIUM'
|
||||
mabPerSqm: number
|
||||
fitOutByLandlord?: boolean
|
||||
parkingSpots?: number
|
||||
rentPricePerSqm: number
|
||||
}
|
||||
|
||||
/**
|
||||
* Effektive Ausbau-/Preis-/Parkplatz-Werte für eine Einheit: Einheit-Wert ?? Objekt-Wert.
|
||||
* Parkplätze: Einheit-Zuteilung; bei Einzel-Einheit-Objekten der ganze Objekt-Pool als Fallback.
|
||||
*/
|
||||
export function resolveUnitFacts(property: Property, unit?: PropertyUnit | null): ResolvedUnitFacts {
|
||||
const hf = property.hardFacts
|
||||
const singleUnit = (property.units?.length ?? 0) <= 1
|
||||
return {
|
||||
fitOut: unit?.fitOut ?? hf?.fitOut,
|
||||
mabPerSqm: unit?.mieterausbaubeitragPerSqm ?? hf?.mieterausbaubeitragPerSqm ?? 0,
|
||||
fitOutByLandlord: unit?.fitOutByLandlord ?? hf?.fitOutByLandlord,
|
||||
parkingSpots: unit?.parkingSpots ?? (singleUnit ? hf?.parking : undefined),
|
||||
rentPricePerSqm: unit?.rentPricePerSqm ?? property.rentPricePerSqm,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user