PageSourceSearch

https://hintermoos.at/assets/HeatingCostDetail-6sd5O3CB.js

js hintermoos.at collected 2026-10-09 22:02:17 UTC 14,454 bytes, 6 lines download raw bytes

1import{c as X,E as ee,l as te,a as se,u as re,r as f,j as e,m as ae,B as z,w as V,x as E,T as B,s as F}from"./index-MoAbC8_9.js";import{L as k}from"./Layout-jB2m3rBw.js";import{T as ne,a as ie,b as H,c as j,d as me,e as d}from"./table-BNHSYido.js";import{B as ce}from"./badge-BHbYeRgi.js";import{A as le,b as de,a as oe}from"./alert-B1M6s1_G.js";import{p as I,g as xe}from"./meterTypeUtils-B8NQp94j.js";import{A as L}from"./arrow-left-CZKmX_Y-.js";import{F as he}from"./flame-wMx8KIS8.js";import{D as pe}from"./droplets-Cp2l0Gq2.js";import{T as ue}from"./trending-up-Cg9WFJWB.js";import{T as ge}from"./trending-down-EHPUNHPt.js";import{M as fe}from"./minus-Dry52jGc.js";import{C as je}from"./chart-column-Bo5i9GGE.js";import{I as Z}from"./info-CZr0REZX.js";import"./Header-CnJGZ8vQ.js";import"./mountain-BHfTfCFy.js";import"./user-Cvsz7Lm_.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Ne=X("ReceiptText",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M14 8H8",key:"1l3xfs"}],["path",{d:"M16 12H8",key:"1fr5h0"}],["path",{d:"M13 16H8",key:"wsln4y"}]]),Ee=()=>{var S,P,C,W;const{id:N}=ee(),[K]=te(),T=se(),{language:s}=re(),[t,O]=f.useState(null),[o,G]=f.useState(null),[R,U]=f.useState([]),[Y,$]=f.useState(!0),q=K.get("returnTo")||"/costs";f.useEffect(()=>{(async()=>{if(!N)return;const{data:x,error:v}=await F.from("apartment_heating_costs").select("*").eq("id",N).single();if(x&&!v){O(x);const{data:y}=await F.from("apartment_heating_costs").select("year, apartment_code, avg_price_per_sqm, area_sqm, consumption_units").order("year",{ascending:!0});if(y&&y.length>0){const c={};y.forEach(r=>{const l=Number(r.avg_price_per_sqm||0),h=Number(r.area_sqm||0),n=Number(r.consumption_units||0),u=h>0?n/h:0;l===0&&u===0||(c[r.year]||(c[r.year]={apartments:{}}),c[r.year].apartments[r.apartment_code]||(c[r.year].apartments[r.apartment_code]={totalPerSqm:0,totalHkvPerSqm:0,count:0}),c[r.year].apartments[r.apartment_code].totalPerSqm+=l,c[r.year].apartments[r.apartment_code].totalHkvPerSqm+=u,c[r.year].apartments[r.apartment_code].count+=1)});const A=[];Object.entries(c).forEach(([r,l])=>{const h=Number(r),n=l.apartments[x.apartment_code],u=n?n.totalPerSqm/n.count:0,M=n?n.totalHkvPerSqm/n.count:0,p=Object.values(l.apartments),J=p.length>0?p.reduce((w,g)=>w+g.totalPerSqm/g.count,0)/p.length:0,Q=p.length>0?p.reduce((w,g)=>w+g.totalHkvPerSqm/g.count,0)/p.length:0;(u>0||M>0)&&A.push({year:h,apartmentPerSqm:u,averagePerSqm:J,apartmentHkvPerSqm:M,averageHkvPerSqm:Q})}),U(A.sort((r,l)=>r.year-l.year));const _=c[x.year];if(_){const r=Object.values(_.apartments),l=r.length>0?r.reduce((h,n)=>h+n.totalPerSqm/n.count,0)/r.length:0;G({avgPerSqm:l,apartmentCount:Object.keys(_.apartments).length})}}}$(!1)})()},[N]);const i=a=>new Intl.NumberFormat(s==="de"?"de-DE":"en-GB",{style:"currency",currency:"EUR"}).format(a),D=a=>a?new Date(a).toLocaleDateString(s==="de"?"de-DE":"en-GB",{day:"2-digit",month:"2-digit",year:"numeric"}):"—",b=t!=null&&t.period_start&&(t!=null&&t.period_end)?Math.ceil((new Date(t.period_end).getTime()-new Date(t.period_start).getTime())/(1e3*60*60*24))+1:null,m=(()=>{if(!t||!o||!t.avg_price_per_sqm)return null;const a=Number(t.avg_price_per_sqm),x=a-o.avgPerSqm,v=o.avgPerSqm>0?x/o.avgPerSqm*100:0;return{diff:x,percentDiff:v,myPerSqm:a}})();return Y?e.jsx(k,{children:e.jsx("div",{className:"flex items-center justify-center py-24",children:e.jsx(ae,{className:"h-8 w-8 animate-spin text-primary"})})}):t?e.jsx(k,{children:e.jsxs("div",{className:"container py-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs(z,{variant:"ghost",size:"sm",onClick:()=>T(q),className:"text-muted-foreground hover:text-foreground",children:[e.jsx(L,{className:"h-4 w-4 mr-1"}),s==="de"?"Zurück":"Back"]}),e.jsxs("div",{className:"text-right",children:[e.jsx("p",{className:"text-2xl font-bold",children:t.apartment_code}),e.jsx("p",{className:"text-sm text-muted-foreground",children:t.year})]})]}),e.jsxs(V,{className:"animate-fade-in",children:[e.jsx("div",{className:"border-b bg-muted/30 px-6 py-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ne,{className:"h-5 w-5 text-primary"}),e.jsx("span",{className:"font-semibold",children:s==="de"?"Heizkostenabrechnung":"Heating Cost Statement"})]}),e.jsxs(ce,{variant:"outline",children:[b," ",s==="de"?"Tage":"days"]})]})}),e.jsxs(E,{className:"p-6",children:[e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-6 pb-6 border-b",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:s==="de"?"Eigentümer":"Owner"}),e.jsx("p",{className:"font-medium text-sm",children:t.owner_name||"—"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:s==="de"?"Zeitraum":"Period"}),e.jsxs("p",{className:"font-medium text-sm",children:[D(t.period_start)," – ",D(t.period_end)]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:s==="de"?"Fläche":"Area"}),e.jsxs("p",{className:"font-medium text-sm",children:[((S=t.area_sqm)==null?void 0:S.toFixed(1))||"—"," m²"]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:s==="de"?"Preis/m²":"Price/m²"}),e.jsxs("p",{className:"font-medium text-sm",children:[((P=t.avg_price_per_sqm)==null?void 0:P.toFixed(2))||"—"," €"]})]})]}),I(t.flags).type==="WMZ"&&e.jsxs(le,{className:"mb-6 border-purple-500 bg-purple-50 dark:bg-purple-950/20",children:[e.jsx(B,{className:"h-4 w-4 text-purple-600"}),e.jsx(de,{className:"text-purple-700 dark:text-purple-300",children:s==="de"?"Wärmemengenzähler (WMZ)":"Heat Meter (WMZ)"}
6),e.jsx(oe,{className:"text-sm text-purple-600 dark:text-purple-400",children:s==="de"?"Dieses Apartment verwendet einen Wärmemengenzähler der in kWh misst. Die Verbrauchseinheiten sind NICHT direkt mit HKV-Einheiten anderer Apartments vergleichbar.":"This apartment uses a heat meter measuring in kWh. Consumption units are NOT directly comparable with HKV units from other apartments."})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-6 pb-6 border-b",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1 flex items-center gap-1",children:s==="de"?"Verbrauch":"Consumption"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"font-medium text-sm",children:((C=t.consumption_units)==null?void 0:C.toLocaleString())||"—"}),(()=>{const a=I(t.flags);return e.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded-full font-medium border ${xe(a.type)}`,children:a.label})})()]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:s==="de"?"Preis/Einheit":"Price/Unit"}),e.jsxs("p",{className:"font-medium text-sm",children:[((W=t.price_per_unit)==null?void 0:W.toFixed(6))||"—"," €"]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:s==="de"?"Direktkosten":"Direct Costs"}),e.jsx("p",{className:"font-medium text-sm",children:i(t.direct_costs_net_eur)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:s==="de"?"Pro Tag":"Per Day"}),e.jsx("p",{className:"font-medium text-sm",children:b?i(t.total_gross_eur/b):"—"})]})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:s==="de"?"Kostenaufstellung":"Cost Breakdown"}),e.jsx("div",{className:"rounded-lg border overflow-hidden",children:e.jsxs(ne,{children:[e.jsx(ie,{children:e.jsxs(H,{className:"bg-muted/50",children:[e.jsx(j,{className:"text-xs font-medium py-2 h-auto"}),e.jsx(j,{className:"text-right text-xs font-medium py-2 h-auto",children:s==="de"?"Netto":"Net"}),e.jsx(j,{className:"text-right text-xs font-medium py-2 h-auto",children:s==="de"?"MwSt.":"VAT"}),e.jsx(j,{className:"text-right text-xs font-medium py-2 h-auto",children:s==="de"?"Brutto":"Gross"})]})}
6),e.jsxs(me,{children:[e.jsxs(H,{children:[e.jsx(d,{className:"py-2",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(he,{className:"h-3.5 w-3.5 text-orange-500"}),e.jsx("span",{className:"text-sm",children:s==="de"?"Heizung":"Heating"}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"(20%)"})]})}),e.jsx(d,{className:"text-right text-sm py-2",children:i(t.heating_net_eur)}),e.jsx(d,{className:"text-right text-sm text-muted-foreground py-2",children:i(t.vat_heating_eur)}),e.jsx(d,{className:"text-right text-sm font-medium py-2",children:i(Number(t.heating_net_eur)+Number(t.vat_heating_eur))})]}),e.jsxs(H,{children:[e.jsx(d,{className:"py-2",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(pe,{className:"h-3.5 w-3.5 text-blue-500"}),e.jsx("span",{className:"text-sm",children:s==="de"?"Warmwasser":"Warm Water"}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"(10%)"})]})}),e.jsx(d,{className:"text-right text-sm py-2",children:i(t.warmwater_net_eur)}),e.jsx(d,{className:"text-right text-sm text-muted-foreground py-2",children:i(t.vat_warmwater_eur)}),e.jsx(d,{className:"text-right text-sm font-medium py-2",children:i(Number(t.warmwater_net_eur)+Number(t.vat_warmwater_eur))})]})]})]})})]}),t.flags&&e.jsx("div",{className:"mb-6 p-3 bg-amber-50 dark:bg-amber-950/20 border border-amber-200 dark:border-amber-800 rounded-lg",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(B,{className:"h-4 w-4 text-amber-600 mt-0.5 shrink-0"}),e.jsx("p",{className:"text-sm text-amber-700 dark:text-amber-400",children:t.flags})]})}),e.jsxs("div",{className:"bg-primary/5 rounded-lg p-4 mb-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:s==="de"?"Gesamtbetrag":"Total Amount"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s==="de"?"inkl. MwSt.":"incl. VAT"," ",i(t.vat_total_eur)]})]}),e.jsx("p",{className:"text-3xl font-bold text-primary",children:i(t.total_gross_eur)})]}),o&&m&&e.jsx("div",{className:"pt-3 border-t border-primary/10",children:e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-muted-foreground",children:[s==="de"?"Ø €/m²":"Avg €/m²"," ",t.year," (",o.apartmentCount," ",s==="de"?"Apt.":"apt.","):"]}),e.jsxs("span",{className:"font-medium",children:[o.avgPerSqm.toFixed(2)," €/m²"]})]}),e.jsxs("div",{className:`flex items-center gap-1 font-medium ${m.percentDiff>5?"text-destructive":m.percentDiff<-5?"text-green-600":"text-muted-foreground"}`,children:[m.percentDiff>5&&e.jsx(ue,{className:"h-4 w-4"}),m.percentDiff<-5&&e.jsx(ge,{className:"h-4 w-4"}),Math.abs(m.percentDiff)<=5&&e.jsx(fe,{className:"h-4 w-4"}),e.jsxs("span",{children:[m.myPerSqm.toFixed(2)," €/m² (",m.percentDiff>=0?"+":"",m.percentDiff.toFixed(1),"%)"]})]})]})})]}),R.length>1&&e.jsx("div",{className:"mb-6 p-3 bg-muted/30 rounded-lg",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(je,{className:"h-4 w-4"}),e.jsx("span",{children:s==="de"?'Historische Vergleichsgrafiken finden Sie im Tab "Historie" auf der Kostenübersicht.':'Historical comparison charts are available in the "History" tab on the costs overview.'})]})}),e.jsxs("div",{className:"text-[11px] text-muted-foreground space-y-1.5 bg-muted/30 rounded-lg p-3",children:[e.jsxs("p",{className:"flex items-start gap-1.5",children:[e.jsx(Z,{className:"h-3 w-3 mt-0.5 shrink-0 text-blue-600"}),e.jsxs("span",{children:[e.jsx("strong",{className:"text-blue-600",children:"HKV"})," = ",e.jsx("em",{children:"Heizkostenverteiler"})," (Heat Cost Allocator) – ",s==="de"?"elektronische Messgeräte an Heizkörpern. Der Wert sind relative Verbrauchseinheiten (keine kWh), die den Wärmeverbrauch im Verhältnis zum Gesamtgebäude darstellen.":"electronic meters on radiators. The value represents relative consumption units (not kWh), expressing heat usage compared to the whole building."]})]}),e.jsxs("p",{className:"flex items-start gap-1.5",children:[e.jsx(Z,{className:"h-3 w-3 mt-0.5 shrink-0 text-purple-600"}),e.jsxs("span",{children:[e.jsx("strong",{className:"text-purple-600",children:"WMZ"})," = ",e.jsx("em",{children:"Wärmemengenzähler"})," (Heat Meter/Calorimeter) – ",s==="de"?"Kalorimeter, der die tatsächliche Wärmeenergie in kWh oder MWh misst. Wird hauptsächlich bei Fußbodenheizung verwendet. ⚠️ Einheiten NICHT vergleichbar mit HKV!":"Calorimeter measuring actual heat energy in kWh or MWh. Mainly used with underfloor heating. ⚠️ Units NOT comparable with HKV!"]})]}),e.jsx("p",{className:"flex items-start gap-1.5 pl-4",children:e.jsxs("span",{children:[e.jsx("strong",{children:"HZ"})," = ",e.jsx("em",{children:"Heizung"})," – ",s==="de"?"Heizkostenanteil basierend auf Zeitanteilen und Verbrauch.":"heating cost share based on time periods and consumption."]})}),e.jsx("p",{className:"flex items-start gap-1.5 pl-4",children:e.jsxs("span",{children:[e.jsx("strong",{children:"WW"})," = ",e.jsx("em",{children:"Warmwasser"})," – ",s==="de"?"Warmwasserzähler für die Erfassung des Warmwasserverbrauchs.":"warm water meter for measuring hot water consumption."]})}),e.jsx("p",{className:"flex items-start gap-1.5 pl-4",children:e.jsx("span",{children:s==="de"?"MwSt: Heizung 20%, Warmwasser 10% (Österreich). Pro Tag = Durchschnittskosten pro Abrechnungstag.":"VAT: Heating 20%, Warm Water 10% (Austria). Per Day = average daily cost over billing period."})})]})]})]})]})}):e.jsx(k,{children:e.jsxs("div",{className:"container mx-auto px-4 py-8",children:[e.jsxs(z,{variant:"ghost",onClick:()=>T(q),className:"mb-4",children:[e.jsx(L,{className:"h-4 w-4 mr-2"}),s==="de"?"Zurück":"Back"]}),e.jsx(V,{children:e.jsx(E,{className:"py-12 text-center text-muted-foreground",children:s==="de"?"Kostendaten nicht gefunden.":"Cost data not found."})})]})})};export{Ee as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.