From 7add66ab78adea8e69178d6bbba99b37febe3332 Mon Sep 17 00:00:00 2001 From: Moritz Utcke Date: Wed, 5 Feb 2025 11:18:42 +0700 Subject: [PATCH] Verbrauchsausweis Gewerbe --- src/astro-typesafe-api-caller.ts | 4 +- .../Ausweis/AusweisPreviewContainer.svelte | 8 +- .../Ausweis/ButtonWeiterHilfe.svelte | 4 +- src/components/Ausweis/DaemmungImage.svelte | 10 +- src/components/Ausweis/FensterImage.svelte | 10 +- src/components/Ausweis/HeizungImage.svelte | 8 +- .../Ausweis/PerformanceScore.svelte | 2 +- .../SanierungszustandFensterTueren.svelte | 144 ++++++++++++------ .../SanierungszustandHeizungsanlage.svelte | 7 +- .../SanierungszustandWaermedammung.svelte | 114 +++++++++----- src/components/Ausweis/StromVerbrauch.svelte | 22 +-- src/components/ImageGrid.svelte | 10 +- src/components/UploadImages.svelte | 10 +- .../audits/VerbrauchAbweichung.ts | 4 +- .../VerbrauchsausweisGewerbe/erstellen.cy.ts | 19 ++- .../VerbrauchsausweisGewerbeModule.svelte | 73 ++++----- .../AusweisWeiter.svelte | 4 +- .../VerbrauchsausweisWohnenModule.svelte | 8 +- .../api/verbrauchsausweis-gewerbe/index.ts | 6 +- .../verbrauchsausweis-gewerbe/index.astro | 82 ++++++++-- 20 files changed, 339 insertions(+), 210 deletions(-) diff --git a/src/astro-typesafe-api-caller.ts b/src/astro-typesafe-api-caller.ts index c12f37e9..72c5bd87 100644 --- a/src/astro-typesafe-api-caller.ts +++ b/src/astro-typesafe-api-caller.ts @@ -5,13 +5,13 @@ export const createCaller = createCallerFactory({ "postleitzahlen": await import("../src/pages/api/postleitzahlen.ts"), "aufnahme/[uid]": await import("../src/pages/api/aufnahme/[uid].ts"), "aufnahme": await import("../src/pages/api/aufnahme/index.ts"), + "bilder/[uid]": await import("../src/pages/api/bilder/[uid].ts"), "bedarfsausweis-wohnen": await import("../src/pages/api/bedarfsausweis-wohnen/index.ts"), "auth/access-token": await import("../src/pages/api/auth/access-token.ts"), "auth/forgot-password": await import("../src/pages/api/auth/forgot-password.ts"), "auth/refresh-token": await import("../src/pages/api/auth/refresh-token.ts"), - "bilder/[uid]": await import("../src/pages/api/bilder/[uid].ts"), - "objekt": await import("../src/pages/api/objekt/index.ts"), "rechnung": await import("../src/pages/api/rechnung/index.ts"), + "objekt": await import("../src/pages/api/objekt/index.ts"), "ticket": await import("../src/pages/api/ticket/index.ts"), "user": await import("../src/pages/api/user/index.ts"), "user/self": await import("../src/pages/api/user/self.ts"), diff --git a/src/components/Ausweis/AusweisPreviewContainer.svelte b/src/components/Ausweis/AusweisPreviewContainer.svelte index 95326009..b4d9dbd4 100644 --- a/src/components/Ausweis/AusweisPreviewContainer.svelte +++ b/src/components/Ausweis/AusweisPreviewContainer.svelte @@ -9,13 +9,15 @@ } from "@ibcornelsen/database/client"; import { + BedarfsausweisWohnenClient, ObjektClient, UploadedGebaeudeBild, + VerbrauchsausweisGewerbeClient, VerbrauchsausweisWohnenClient, } from "./types.js"; - export let ausweis: VerbrauchsausweisWohnenClient; - export let gebaeude: ObjektClient; + export let ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient | BedarfsausweisWohnenClient; + export let objekt: ObjektClient; export let images: UploadedGebaeudeBild[] = []; @@ -29,7 +31,7 @@ kategorie={Enums.BilderKategorie.Gebaeude} max={1} min={1} - bind:gebaeude + bind:objekt bind:images bind:ausweis > diff --git a/src/components/Ausweis/ButtonWeiterHilfe.svelte b/src/components/Ausweis/ButtonWeiterHilfe.svelte index d1172743..fcc14a64 100644 --- a/src/components/Ausweis/ButtonWeiterHilfe.svelte +++ b/src/components/Ausweis/ButtonWeiterHilfe.svelte @@ -3,13 +3,15 @@ import Hilfe from "#components/Ausweis/Hilfe.svelte"; import { AufnahmeClient, + BedarfsausweisWohnenClient, BenutzerClient, ObjektClient, UploadedGebaeudeBild, + VerbrauchsausweisGewerbeClient, VerbrauchsausweisWohnenClient, } from "./types.js"; - export let ausweis: VerbrauchsausweisWohnenClient; + export let ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient | BedarfsausweisWohnenClient; export let bilder: UploadedGebaeudeBild[]; export let user: BenutzerClient; export let objekt: ObjektClient; diff --git a/src/components/Ausweis/DaemmungImage.svelte b/src/components/Ausweis/DaemmungImage.svelte index b8d9319f..c648edd0 100644 --- a/src/components/Ausweis/DaemmungImage.svelte +++ b/src/components/Ausweis/DaemmungImage.svelte @@ -1,11 +1,11 @@
@@ -66,7 +66,7 @@ kategorie={Enums.BilderKategorie.Daemmung} bind:images bind:ausweis - bind:gebaeude + bind:objekt > TEXT FEHLT diff --git a/src/components/Ausweis/FensterImage.svelte b/src/components/Ausweis/FensterImage.svelte index 70ae2845..f22cfa99 100644 --- a/src/components/Ausweis/FensterImage.svelte +++ b/src/components/Ausweis/FensterImage.svelte @@ -1,11 +1,11 @@
@@ -62,7 +62,7 @@ kategorie={Enums.BilderKategorie.Fenster} bind:images bind:ausweis - bind:gebaeude + bind:objekt > TEXT FEHLT diff --git a/src/components/Ausweis/HeizungImage.svelte b/src/components/Ausweis/HeizungImage.svelte index a6d15b20..e2e48075 100644 --- a/src/components/Ausweis/HeizungImage.svelte +++ b/src/components/Ausweis/HeizungImage.svelte @@ -1,10 +1,10 @@ @@ -57,7 +57,7 @@ kategorie={Enums.BilderKategorie.Heizung} max={4} min={1} - bind:gebaeude + bind:objekt={gebaeude} bind:images bind:ausweis > diff --git a/src/components/Ausweis/PerformanceScore.svelte b/src/components/Ausweis/PerformanceScore.svelte index b4d4812c..d49a756d 100644 --- a/src/components/Ausweis/PerformanceScore.svelte +++ b/src/components/Ausweis/PerformanceScore.svelte @@ -10,7 +10,7 @@ } from "./types.js"; import ThickArrowUp from "radix-svelte-icons/src/lib/icons/ThickArrowUp.svelte"; - export let ausweis: VerbrauchsausweisWohnenClient; + export let ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient | BedarfsausweisWohnenClient; export let aufnahme: AufnahmeClient; export let objekt: ObjektClient; diff --git a/src/components/Ausweis/SanierungszustandFensterTueren.svelte b/src/components/Ausweis/SanierungszustandFensterTueren.svelte index 960f9798..f2b7e534 100644 --- a/src/components/Ausweis/SanierungszustandFensterTueren.svelte +++ b/src/components/Ausweis/SanierungszustandFensterTueren.svelte @@ -1,28 +1,30 @@ - -
+ +
- - - - - - - - - - - -
- - - - - + " +> + + + + + + + + + +
+ + + - - \ No newline at end of file + + diff --git a/src/components/Ausweis/SanierungszustandHeizungsanlage.svelte b/src/components/Ausweis/SanierungszustandHeizungsanlage.svelte index 3c5616d6..9726eef8 100644 --- a/src/components/Ausweis/SanierungszustandHeizungsanlage.svelte +++ b/src/components/Ausweis/SanierungszustandHeizungsanlage.svelte @@ -10,14 +10,15 @@ AufnahmeClient, ObjektClient, UploadedGebaeudeBild, + VerbrauchsausweisGewerbeClient, VerbrauchsausweisWohnenClient, } from "./types.js"; import { boolean } from "astro:schema"; import SanierungsOption from "#components/Ausweis/SanierungsOption.svelte"; - export let gebaeude: ObjektClient; + export let objekt: ObjektClient; export let aufnahme: AufnahmeClient; - export let ausweis: VerbrauchsausweisWohnenClient; + export let ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient; export let images: UploadedGebaeudeBild[]; @@ -119,7 +120,7 @@ >
- + - - \ No newline at end of file + + diff --git a/src/components/Ausweis/StromVerbrauch.svelte b/src/components/Ausweis/StromVerbrauch.svelte index 1b479496..e5b266a5 100644 --- a/src/components/Ausweis/StromVerbrauch.svelte +++ b/src/components/Ausweis/StromVerbrauch.svelte @@ -16,13 +16,13 @@ import { AufnahmeClient, ObjektClient, - VerbrauchsausweisWohnenClient, + VerbrauchsausweisGewerbeClient, } from "./types.js"; import { addNotification } from "#components/Notifications/shared.js"; - export let gebaeude: ObjektClient; + export let objekt: ObjektClient; export let aufnahme: AufnahmeClient; - export let ausweis: VerbrauchsausweisWohnenClient; + export let ausweis: VerbrauchsausweisGewerbeClient; // Wir dürfen bis zu 4.5 Jahre alte Klimafaktoren benutzen, also nehmen wir alle Monate seitdem und generieren daraus die Auswahl. // Allerdings müssen wir auch berücksichtigen, dass wir drei folgende Jahre brauchen, also @@ -48,12 +48,12 @@ ]; const startDate = moment( - ausweis.aufnahme.erstellungsdatum || Date.now() + aufnahme.erstellungsdatum || Date.now() ) .subtract(4, "years") .subtract(6, "months"); const endDate = moment( - ausweis.aufnahme.erstellungsdatum || Date.now() + aufnahme.erstellungsdatum || Date.now() ).subtract(3, "years"); for (let m = moment(startDate); m.isBefore(endDate); m.add(1, "month")) { @@ -102,7 +102,7 @@ } } - $: abweichung = auditVerbrauchAbweichung(ausweis, gebaeude); + $: abweichung = auditVerbrauchAbweichung(ausweis, aufnahme);
- - - - - + + + + +
diff --git a/src/components/ImageGrid.svelte b/src/components/ImageGrid.svelte index 40853055..5300e911 100644 --- a/src/components/ImageGrid.svelte +++ b/src/components/ImageGrid.svelte @@ -1,15 +1,15 @@
- +
{#each images as image, i} {#if image.kategorie == kategorie} diff --git a/src/components/UploadImages.svelte b/src/components/UploadImages.svelte index f7e34b33..a14c6af3 100644 --- a/src/components/UploadImages.svelte +++ b/src/components/UploadImages.svelte @@ -1,17 +1,17 @@