/* Powermieter — building / WE pre-fill seed data. In production this comes from Powerhouse 360's project database (one record per finished Wohneinheit). Everything here is what we ALREADY know about the building — so the tenant only confirms + signs. Replace with a real fetch per ?b=. */ const TARIFF = { name: 'Powermieter Mieterstrom Basis', arbeitspreis: '28,9 ct/kWh', grundpreis: '8,90 €/Monat', vergleich: '41,5 ct/kWh', // local Grundversorger reference ersparnisProzent: 30, laufzeit: '12 Monate, danach monatlich kündbar', widerrufstage: 14, }; const BUILDINGS = { 'BLN-PRENZL-12': { id: 'BLN-PRENZL-12', name: 'Prenzlauer Allee 12', strasse: 'Prenzlauer Allee', hausnr: '12', plz: '10405', ort: 'Berlin', anlage: 'Dach-PV 78 kWp · Inbetriebnahme 04/2026', lieferbeginn: '01.08.2026', units: [ { we: 'W01', etage: 'EG links', klingel: 'Schneider', zaehler: '1 ESY 1100 2201', verbrauch: 2100, signed: false }, { we: 'W02', etage: 'EG rechts', klingel: 'Yılmaz', zaehler: '1 ESY 1100 2202', verbrauch: 3200, signed: true }, { we: 'W03', etage: '1. OG links', klingel: 'Becker', zaehler: '1 ESY 1100 2203', verbrauch: 2500, signed: false }, { we: 'W04', etage: '1. OG rechts', klingel: 'Nowak', zaehler: '1 ESY 1100 2204', verbrauch: 1800, signed: false }, { we: 'W05', etage: '2. OG links', klingel: 'Fischer',zaehler: '1 ESY 1100 2205', verbrauch: 2900, signed: false }, { we: 'W06', etage: '2. OG rechts', klingel: 'Rossi', zaehler: '1 ESY 1100 2206', verbrauch: 2400, signed: false }, ], }, }; /* Pull the building from ?b=, else the demo default. */ function getBuilding(id) { return BUILDINGS[id] || BUILDINGS['BLN-PRENZL-12']; } function getUnit(building, we) { return building.units.find((u) => u.we === we) || null; } /* Estimated yearly saving for a given consumption (kWh). */ function estSaving(verbrauch) { const cur = 0.415, neu = 0.289; const v = Number(verbrauch) || 2500; return Math.round(v * (cur - neu)); } window.TARIFF = TARIFF; window.getBuilding = getBuilding; window.getUnit = getUnit; window.estSaving = estSaving;