From 75ade8ebaade0d9d74d5b33d9b8dc519a01be972 Mon Sep 17 00:00:00 2001 From: Moritz Utcke Date: Tue, 25 Mar 2025 19:15:16 -0300 Subject: [PATCH] Verbesserungen im Prozess --- src/astro-typesafe-api-caller.ts | 8 +- src/client/lib/ausweisSpeichern.ts | 2 +- src/client/lib/bilderHochladen.ts | 95 ------------- src/client/lib/nachweisSpeichern.ts | 52 +++---- src/components/AnsichtsausweisButton.svelte | 7 +- src/components/Ausweis/AnlagenTechnik.svelte | 4 +- .../Ausweis/AusweisPreviewContainer.svelte | 6 +- .../Ausweis/BilderZusatzsysteme.svelte | 4 +- .../Ausweis/ButtonWeiterHilfe.svelte | 16 ++- src/components/Ausweis/DaemmungImage.svelte | 4 +- src/components/Ausweis/FensterImage.svelte | 6 +- src/components/Ausweis/HeizungImage.svelte | 6 +- .../SanierungszustandFensterTueren.svelte | 4 +- .../SanierungszustandHeizungsanlage.svelte | 9 +- .../SanierungszustandWaermedammung.svelte | 4 +- src/components/Ausweis/types.ts | 18 +-- src/components/AusweisPruefenBox.svelte | 18 +-- .../Dashboard/DashboardAusweis.svelte | 12 +- .../Dashboard/DashboardObjekt.svelte | 8 +- src/components/DatenblattButton.svelte | 6 +- src/components/ImageGrid.svelte | 8 +- src/components/UploadImages.svelte | 5 +- src/layouts/DashboardLayout.astro | 2 +- .../pdfDatenblattVerbrauchsausweisGewerbe.ts | 7 +- src/lib/pdf/pdfVerbrauchsausweisGewerbe.ts | 4 +- src/lib/server/db.ts | 33 +++++ src/lib/tryCatch.ts | 18 +++ .../BedarfsausweisWohnenModule.svelte | 4 +- src/modules/Dashboard/DashboardModule.svelte | 3 +- src/modules/KundendatenModule.svelte | 2 +- .../VerbrauchsausweisGewerbeModule.svelte | 4 +- .../VerbrauchsausweisWohnenModule.svelte | 24 ++-- .../GEGNachweisGewerbeModule.svelte | 4 +- .../geg-nachweis-gewerbe-anfragen/index.astro | 4 +- src/pages/api/ausweise/index.ts | 6 +- .../admin/ausweise-pruefen/[page].astro | 8 +- .../aufnahme/{[uid].astro => [id].astro} | 8 +- src/pages/dashboard/objekte/[page].astro | 4 +- .../bedarfsausweis-wohngebaeude/index.astro | 28 ++-- .../verbrauchsausweis-gewerbe/index.astro | 36 ++--- .../index.astro | 131 +++++++----------- src/pages/pdf/ansichtsausweis.ts | 22 +-- src/pages/pdf/datenblatt.ts | 20 +-- src/pages/speichern-erfolgreich.astro | 13 +- user-flow-verbrauchsausweis-wohnen.tefcha | 85 ++++++++++++ 45 files changed, 380 insertions(+), 392 deletions(-) delete mode 100644 src/client/lib/bilderHochladen.ts create mode 100644 src/lib/server/db.ts create mode 100644 src/lib/tryCatch.ts rename src/pages/dashboard/aufnahme/{[uid].astro => [id].astro} (96%) create mode 100644 user-flow-verbrauchsausweis-wohnen.tefcha diff --git a/src/astro-typesafe-api-caller.ts b/src/astro-typesafe-api-caller.ts index fd3dc1a0..ec71ff20 100644 --- a/src/astro-typesafe-api-caller.ts +++ b/src/astro-typesafe-api-caller.ts @@ -5,6 +5,7 @@ export const createCaller = createCallerFactory({ "klimafaktoren": await import("../src/pages/api/klimafaktoren.ts"), "postleitzahlen": await import("../src/pages/api/postleitzahlen.ts"), "unterlage": await import("../src/pages/api/unterlage.ts"), + "aufnahme": await import("../src/pages/api/aufnahme/index.ts"), "admin/ausstellen": await import("../src/pages/api/admin/ausstellen.ts"), "admin/bestellbestaetigung": await import("../src/pages/api/admin/bestellbestaetigung.ts"), "admin/erinnern": await import("../src/pages/api/admin/erinnern.ts"), @@ -12,13 +13,12 @@ export const createCaller = createCallerFactory({ "admin/post-ausstellen": await import("../src/pages/api/admin/post-ausstellen.ts"), "admin/registriernummer": await import("../src/pages/api/admin/registriernummer.ts"), "admin/stornieren": await import("../src/pages/api/admin/stornieren.ts"), - "bedarfsausweis-gewerbe/[uid]": await import("../src/pages/api/bedarfsausweis-gewerbe/[uid].ts"), - "bedarfsausweis-gewerbe": await import("../src/pages/api/bedarfsausweis-gewerbe/index.ts"), + "ausweise": await import("../src/pages/api/ausweise/index.ts"), "auth/access-token": await import("../src/pages/api/auth/access-token.ts"), "auth/passwort-vergessen": await import("../src/pages/api/auth/passwort-vergessen.ts"), "auth/refresh-token": await import("../src/pages/api/auth/refresh-token.ts"), - "ausweise": await import("../src/pages/api/ausweise/index.ts"), - "aufnahme": await import("../src/pages/api/aufnahme/index.ts"), + "bedarfsausweis-gewerbe/[uid]": await import("../src/pages/api/bedarfsausweis-gewerbe/[uid].ts"), + "bedarfsausweis-gewerbe": await import("../src/pages/api/bedarfsausweis-gewerbe/index.ts"), "bedarfsausweis-wohnen/[id]": await import("../src/pages/api/bedarfsausweis-wohnen/[id].ts"), "bedarfsausweis-wohnen": await import("../src/pages/api/bedarfsausweis-wohnen/index.ts"), "bilder/[id]": await import("../src/pages/api/bilder/[id].ts"), diff --git a/src/client/lib/ausweisSpeichern.ts b/src/client/lib/ausweisSpeichern.ts index db460ed6..741381ee 100644 --- a/src/client/lib/ausweisSpeichern.ts +++ b/src/client/lib/ausweisSpeichern.ts @@ -3,7 +3,7 @@ import { api } from "astro-typesafe-api/client" import { exclude } from "#lib/exclude.js"; import Cookies from "js-cookie"; import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants.js"; -import { AufnahmeClient, BedarfsausweisWohnenClient, BildClient, ObjektClient, UploadedGebaeudeBild, VerbrauchsausweisGewerbeClient, VerbrauchsausweisWohnenClient, } from "#components/Ausweis/types.js"; +import { AufnahmeClient, BedarfsausweisWohnenClient, BildClient, ObjektClient, VerbrauchsausweisGewerbeClient, VerbrauchsausweisWohnenClient, } from "#components/Ausweis/types.js"; import { Enums } from "#lib/client/prisma.js"; export async function ausweisSpeichern( diff --git a/src/client/lib/bilderHochladen.ts b/src/client/lib/bilderHochladen.ts deleted file mode 100644 index 11aa2176..00000000 --- a/src/client/lib/bilderHochladen.ts +++ /dev/null @@ -1,95 +0,0 @@ -import { - ObjektClient, - UploadedGebaeudeBild, - VerbrauchsausweisWohnenClient, -} from "#components/Ausweis/types.js"; -import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants.js"; -import { Enums } from "#lib/client/prisma"; -import { addNotification, updateNotification } from "@ibcornelsen/ui"; -import { api } from "astro-typesafe-api/client"; -import Cookies from "js-cookie"; - -export async function bilderHochladen( - images: (UploadedGebaeudeBild & { base64?: string, update?: boolean })[], - aufnahme_uid: string -) { - if (images.length == 0) { - return images; - } - - // Wenn Bilder hochgeladen werden konvertieren wir sie zu base64, das heißt, dass die base64 Eigenschaft bei diesen Bildern - // existiert. Das müssen wir TypeScript nur wissen lassen, damit es uns in Ruhe lässt. - const imagesToUpload = images.filter( - (image) => !image.uid || image.update - ) as unknown as { - data: string; - kategorie: string; - uid?: string; - update: boolean; - }[]; - - if (imagesToUpload.length == 0) { - return images; - } - - // Alle Bilder hochladen - const notification = addNotification({ - dismissable: false, - message: "Bilder hochladen.", - subtext: `${imagesToUpload.length} Bilder werden hochgeladen, bitte haben sie Geduld.`, - timeout: 0, - type: "info", - }); - for (let i = 0; i < imagesToUpload.length; i++) { - const image = imagesToUpload[i]; - - try { - if (image.update) { - await api.bilder._uid.PATCH.fetch({ - data: image.data, - kategorie: image.kategorie as Enums.BilderKategorie, - }, { - params: { - uid: image.uid as string, - }, - headers: { - "Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}` - } - }); - } else { - const response = await api.aufnahme._uid.bilder.PUT.fetch({ - data: image.data, - kategorie: image.kategorie as Enums.BilderKategorie - }, { - params: { - uid: aufnahme_uid - }, - headers: { - "Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}` - } - }); - - image.uid = response.uid; - } - - updateNotification(notification, { - dismissable: true, - message: "Bild hochgeladen.", - subtext: `${i + 1}/${ - imagesToUpload.length - } Bildern wurden erfolgreich hochgeladen.`, - timeout: 3000, - }); - } catch (e) { - updateNotification(notification, { - dismissable: true, - message: "Bild konnte nicht hochgeladen werden.", - subtext: `Eines ihrer Bilder konnte nicht hochgeladen werden. Wir haben bereits ein Ticket erstellt und melden uns so schnell wie möglich bei ihnen.`, - timeout: 15000, - type: "error", - }); - } - } - - return images; -} diff --git a/src/client/lib/nachweisSpeichern.ts b/src/client/lib/nachweisSpeichern.ts index d0ec3ca0..2bd84c6d 100644 --- a/src/client/lib/nachweisSpeichern.ts +++ b/src/client/lib/nachweisSpeichern.ts @@ -3,7 +3,7 @@ import { api } from "astro-typesafe-api/client" import { exclude } from "#lib/exclude.js"; import Cookies from "js-cookie"; import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants.js"; -import { AufnahmeClient, BedarfsausweisWohnenClient, BildClient, ObjektClient, UnterlageClient, UploadedGebaeudeBild, VerbrauchsausweisGewerbeClient, VerbrauchsausweisWohnenClient, } from "#components/Ausweis/types.js"; +import { AufnahmeClient, BedarfsausweisWohnenClient, BildClient, ObjektClient, UnterlageClient, VerbrauchsausweisGewerbeClient, VerbrauchsausweisWohnenClient, } from "#components/Ausweis/types.js"; import { Enums } from "#lib/client/prisma.js"; export async function nachweisSpeichern( @@ -14,8 +14,8 @@ export async function nachweisSpeichern( unterlagen: UnterlageClient[], ausweisart: Enums.Ausweisart ) { - if (objekt.uid) { - await api.objekt._uid.PATCH.fetch({ + if (objekt.id) { + await api.objekt._id.PATCH.fetch({ adresse: objekt.adresse, latitude: 0, longitude: 0, @@ -23,14 +23,14 @@ export async function nachweisSpeichern( plz: objekt.plz }, { params: { - uid: objekt.uid + id: objekt.id }, headers: { "Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}` } }) } else { - const { uid } = await api.objekt.PUT.fetch({ + const { id } = await api.objekt.PUT.fetch({ adresse: objekt.adresse, latitude: 0, longitude: 0, @@ -42,13 +42,13 @@ export async function nachweisSpeichern( } }) - objekt.uid = uid; + objekt.id = id; } - if (aufnahme.uid) { - await api.aufnahme._uid.PATCH.fetch({ + if (aufnahme.id) { + await api.aufnahme._id.PATCH.fetch({ baujahr_gebaeude: aufnahme.baujahr_gebaeude || [], baujahr_heizung: aufnahme.baujahr_heizung || [], baujahr_klima: aufnahme.baujahr_klima || [], @@ -103,14 +103,14 @@ export async function nachweisSpeichern( zirkulation: aufnahme.zirkulation }, { params: { - uid: aufnahme.uid + id: aufnahme.id }, headers: { "Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}` } }) } else { - const { uid } = await api.aufnahme.PUT.fetch({ + const { id } = await api.aufnahme.PUT.fetch({ aufnahme: { baujahr_gebaeude: aufnahme.baujahr_gebaeude, baujahr_heizung: aufnahme.baujahr_heizung, @@ -166,56 +166,56 @@ export async function nachweisSpeichern( zentralheizung: aufnahme.zentralheizung, zirkulation: aufnahme.zirkulation }, - uid_objekt: objekt.uid + objekt_id: objekt.id }, { headers: { "Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}` } }) - aufnahme.uid = uid + aufnahme.id = id } let patchRoute: any; let putRoute: any; if (ausweisart == Enums.Ausweisart.GEGNachweisWohnen) { - patchRoute = api["geg-nachweis-wohnen"]._uid.PATCH + patchRoute = api["geg-nachweis-wohnen"]._id.PATCH putRoute = api["geg-nachweis-wohnen"].PUT } else if (ausweisart === Enums.Ausweisart.GEGNachweisGewerbe) { - patchRoute = api["geg-nachweis-gewerbe"]._uid.PATCH + patchRoute = api["geg-nachweis-gewerbe"]._id.PATCH putRoute = api["geg-nachweis-gewerbe"].PUT } else if (ausweisart === Enums.Ausweisart.BedarfsausweisGewerbe) { - patchRoute = api["bedarfsausweis-gewerbe"]._uid.PATCH + patchRoute = api["bedarfsausweis-gewerbe"]._id.PATCH putRoute = api["bedarfsausweis-gewerbe"].PUT } - if (nachweis.uid) { + if (nachweis.id) { await patchRoute.fetch({ - ...exclude(nachweis, ["uid"]) + ...exclude(nachweis, ["id"]) }, { params: { - uid: nachweis.uid + id: nachweis.id }, headers: { "Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}` } }) } else { - const { uid } = await putRoute.fetch({ + const { id } = await putRoute.fetch({ nachweis, - uid_aufnahme: aufnahme.uid + uid_aufnahme: aufnahme.id }, { headers: { "Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}` } }) - nachweis.uid = uid; + nachweis.id = id; } - await api.aufnahme._uid.bilder.PUT.fetch(bilder.map(bild => bild.uid), { + await api.aufnahme._id.bilder.PUT.fetch(bilder.map(bild => bild.id), { params: { - uid: aufnahme.uid + id: aufnahme.id }, headers: { "Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}` @@ -223,8 +223,8 @@ export async function nachweisSpeichern( }) return { - uid_nachweis: nachweis.uid, - uid_aufnahme: aufnahme.uid, - uid_objekt: objekt.uid + nachweis_id: nachweis.id, + aufnahme_id: aufnahme.id, + objekt_id: objekt.id } } diff --git a/src/components/AnsichtsausweisButton.svelte b/src/components/AnsichtsausweisButton.svelte index 10167b6b..3990611b 100644 --- a/src/components/AnsichtsausweisButton.svelte +++ b/src/components/AnsichtsausweisButton.svelte @@ -1,13 +1,12 @@ diff --git a/src/components/Ausweis/AnlagenTechnik.svelte b/src/components/Ausweis/AnlagenTechnik.svelte index 757f9cc2..a3077d1b 100644 --- a/src/components/Ausweis/AnlagenTechnik.svelte +++ b/src/components/Ausweis/AnlagenTechnik.svelte @@ -2,7 +2,7 @@ import { AufnahmeClient, ObjektClient, - UploadedGebaeudeBild, + BildClient, } from "./types.js"; import SanierungsOption from "#components/Ausweis/SanierungsOption.svelte"; import AnlagenTechnikImage from "./AnlagenTechnikImage.svelte"; @@ -11,7 +11,7 @@ export let objekt: ObjektClient; export let aufnahme: AufnahmeClient; export let ausweis: BedarfsausweisGewerbe; - export let images: UploadedGebaeudeBild[]; + export let images: BildClient[];
diff --git a/src/components/Ausweis/BilderZusatzsysteme.svelte b/src/components/Ausweis/BilderZusatzsysteme.svelte index 4711ee33..869fac8c 100644 --- a/src/components/Ausweis/BilderZusatzsysteme.svelte +++ b/src/components/Ausweis/BilderZusatzsysteme.svelte @@ -12,7 +12,7 @@ import { AufnahmeClient, ObjektClient, - UploadedGebaeudeBild, + BildClient, VerbrauchsausweisWohnenClient, } from "./types.js"; import { boolean } from "astro:schema"; @@ -21,7 +21,7 @@ export let gebaeude: ObjektClient; export let aufnahme: AufnahmeClient; export let ausweis: VerbrauchsausweisWohnenClient; - export let images: UploadedGebaeudeBild[]; + export let images: BildClient[];
import { ausweisSpeichern } from "#client/lib/ausweisSpeichern.js"; import { validateAccessTokenClient } from "#client/lib/validateAccessToken.js"; - import { AufnahmeClient, BedarfsausweisWohnenClient, BenutzerClient, GEGNachweisWohnenClient, ObjektClient, UnterlageClient, UploadedGebaeudeBild, VerbrauchsausweisGewerbeClient, VerbrauchsausweisWohnenClient } from "#components/Ausweis/types.js"; + import { AufnahmeClient, BedarfsausweisWohnenClient, BenutzerClient, GEGNachweisWohnenClient, ObjektClient, UnterlageClient, BildClient, VerbrauchsausweisGewerbeClient, VerbrauchsausweisWohnenClient } from "#components/Ausweis/types.js"; import Overlay from "#components/Overlay.svelte"; import EmbeddedAuthFlowModule from "#modules/EmbeddedAuthFlowModule.svelte"; @@ -11,9 +11,9 @@ import { nachweisSpeichern } from "#client/lib/nachweisSpeichern.js"; export let ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient | BedarfsausweisWohnenClient | GEGNachweisWohnenClient; - export let bilder: UploadedGebaeudeBild[]; + export let bilder: BildClient[]; export let unterlagen: UnterlageClient[] = []; - export let user: BenutzerClient; + export let user: BenutzerClient | null; export let objekt: ObjektClient; export let aufnahme: AufnahmeClient; export let ausweisart: Enums.Ausweisart @@ -71,20 +71,22 @@ let result: Awaited> | Awaited> | null = null; if (ausweisart === Enums.Ausweisart.GEGNachweisWohnen || ausweisart === Enums.Ausweisart.GEGNachweisGewerbe || ausweisart === Enums.Ausweisart.BedarfsausweisGewerbe) { - result = await nachweisSpeichern(ausweis, objekt, aufnahme, bilder, unterlagen, ausweisart) + result = await nachweisSpeichern({ ...ausweis, ausweistyp }, objekt, aufnahme, bilder, unterlagen, ausweisart) + ausweis.id = result.nachweis_id; } else { - result = await ausweisSpeichern(ausweis, objekt, aufnahme, bilder, ausweisart) + result = await ausweisSpeichern({ ...ausweis, ausweistyp }, objekt, aufnahme, bilder, ausweisart) + ausweis.id = result.ausweis_id; } if (result !== null) { window.history.pushState( {}, "", - `${location.pathname}?uid=${ausweis.id}` + `${location.pathname}?id=${ausweis.id}` ); localStorage.clear() - window.location.href = `/speichern-erfolgreich?uid=${ausweis.id}` + window.location.href = `/speichern-erfolgreich?id=${ausweis.id}` } } diff --git a/src/components/Ausweis/DaemmungImage.svelte b/src/components/Ausweis/DaemmungImage.svelte index 76c74a04..ad0456c8 100644 --- a/src/components/Ausweis/DaemmungImage.svelte +++ b/src/components/Ausweis/DaemmungImage.svelte @@ -1,9 +1,9 @@ diff --git a/src/components/Ausweis/FensterImage.svelte b/src/components/Ausweis/FensterImage.svelte index a3cf0281..c3b6450b 100644 --- a/src/components/Ausweis/FensterImage.svelte +++ b/src/components/Ausweis/FensterImage.svelte @@ -1,9 +1,9 @@ diff --git a/src/components/Ausweis/HeizungImage.svelte b/src/components/Ausweis/HeizungImage.svelte index 38678ef2..d891f14d 100644 --- a/src/components/Ausweis/HeizungImage.svelte +++ b/src/components/Ausweis/HeizungImage.svelte @@ -1,9 +1,9 @@ diff --git a/src/components/Ausweis/SanierungszustandFensterTueren.svelte b/src/components/Ausweis/SanierungszustandFensterTueren.svelte index 8ccc2906..13ee27db 100644 --- a/src/components/Ausweis/SanierungszustandFensterTueren.svelte +++ b/src/components/Ausweis/SanierungszustandFensterTueren.svelte @@ -9,7 +9,7 @@ import { AufnahmeClient, ObjektClient, - UploadedGebaeudeBild, + BildClient, VerbrauchsausweisGewerbeClient, VerbrauchsausweisWohnenClient, } from "./types.js"; @@ -19,7 +19,7 @@ export let objekt: ObjektClient; export let aufnahme: AufnahmeClient; export let ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient; - export let images: UploadedGebaeudeBild[]; + export let images: BildClient[];
- import HelpLabel from "#components/labels/HelpLabel.svelte"; - import Inputlabel from "#components/labels/InputLabel.svelte"; - + import { Enums } from "#lib/client/prisma.js"; import HeizungImage from "./HeizungImage.svelte"; import { AufnahmeClient, ObjektClient, - UploadedGebaeudeBild, + BildClient, VerbrauchsausweisGewerbeClient, VerbrauchsausweisWohnenClient, } from "./types.js"; - import { boolean } from "astro:schema"; import SanierungsOption from "#components/Ausweis/SanierungsOption.svelte"; import AngabenZurHeizunganlage from "#components/Ausweis/AngabenZurHeizunganlage.svelte"; export let objekt: ObjektClient; export let aufnahme: AufnahmeClient; export let ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient; - export let images: UploadedGebaeudeBild[]; + export let images: BildClient[]; export let ausweisart: Enums.Ausweisart; diff --git a/src/components/Ausweis/SanierungszustandWaermedammung.svelte b/src/components/Ausweis/SanierungszustandWaermedammung.svelte index 8ea58bb9..282422b1 100644 --- a/src/components/Ausweis/SanierungszustandWaermedammung.svelte +++ b/src/components/Ausweis/SanierungszustandWaermedammung.svelte @@ -6,7 +6,7 @@ AufnahmeClient, BedarfsausweisWohnenClient, ObjektClient, - UploadedGebaeudeBild, + BildClient, VerbrauchsausweisGewerbeClient, VerbrauchsausweisWohnenClient, } from "./types.js"; @@ -18,7 +18,7 @@ | VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient | BedarfsausweisWohnenClient; - export let images: UploadedGebaeudeBild[]; + export let images: BildClient[];
& { * @export * @typedef {VerbrauchsausweisWohnenClient} */ -export type VerbrauchsausweisWohnenClient = VerbrauchsausweisWohnen & { - objekt_id: string -}; +export type VerbrauchsausweisWohnenClient = VerbrauchsausweisWohnen /** * Das ist der Typescript Type für den Verbrauchsausweis Gewerbe mit allen Feldern die @@ -45,9 +43,7 @@ export type VerbrauchsausweisWohnenClient = VerbrauchsausweisWohnen & { * @export * @typedef {VerbrauchsausweisWohnenClient} */ -export type VerbrauchsausweisGewerbeClient = VerbrauchsausweisGewerbe & { - objekt_id: string -}; +export type VerbrauchsausweisGewerbeClient = VerbrauchsausweisGewerbe /** * Das ist der Typescript Type für den Verbrauchsausweis Gewerbe mit allen Feldern die @@ -59,9 +55,7 @@ export type VerbrauchsausweisGewerbeClient = VerbrauchsausweisGewerbe & { * @export * @typedef {VerbrauchsausweisWohnenClient} */ -export type BedarfsausweisWohnenClient = BedarfsausweisWohnen & { - objekt_id: string -}; +export type BedarfsausweisWohnenClient = BedarfsausweisWohnen /** * Das ist der Typescript Type für die Gebäude Stammdaten mit allen Feldern die @@ -152,8 +146,4 @@ export type AufnahmeKomplettClient = AufnahmeClient & { geg_nachweise_wohnen: (GEGNachweisWohnenClient & { rechnung: RechnungClient })[] } -export type GEGNachweisWohnenClient = Omit & { - uid_objekt: string, - uid_aufnahme: string, - uid_benutzer?: string -} \ No newline at end of file +export type GEGNachweisWohnenClient = GEGNachweisWohnen \ No newline at end of file diff --git a/src/components/AusweisPruefenBox.svelte b/src/components/AusweisPruefenBox.svelte index c1f72128..cde3277b 100644 --- a/src/components/AusweisPruefenBox.svelte +++ b/src/components/AusweisPruefenBox.svelte @@ -5,7 +5,7 @@ AufnahmeClient, getAusweisartFromUUID, ObjektClient, - UploadedGebaeudeBild, + BildClient, VerbrauchsausweisWohnenClient, } from "./Ausweis/types.js"; import AusweisPruefenTooltip from "./AusweisPruefenTooltip.svelte"; @@ -22,7 +22,7 @@ export let ausweis: VerbrauchsausweisWohnenClient; export let aufnahme: AufnahmeClient; export let objekt: ObjektClient; - export let bilder: UploadedGebaeudeBild[] + export let bilder: BildClient[] export let events: Event[] export let calculations: Awaited< ReturnType @@ -49,7 +49,7 @@ - const ausweisArt = getAusweisartFromUUID(ausweis.uid) + const ausweisArt = getAusweisartFromUUID(ausweis.id) let verbrauchWWGesamt_1 = ""; let verbrauchWWGesamt_2 = ""; @@ -458,7 +458,7 @@ async function stornieren(ausweis: VerbrauchsausweisWohnenClient) { try { const response = await api.admin.stornieren.PUT.fetch({ - uid_ausweis: ausweis.uid + uid_ausweis: ausweis.id }, { headers: { "Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}` @@ -748,7 +748,7 @@ {#each bilder as image}

{image.kategorie}

- +
{/each} {/if} @@ -774,7 +774,7 @@ {/if} @@ -884,7 +884,7 @@ UID -
{ausweis.uid}
+
{ausweis.id}
diff --git a/src/components/Dashboard/DashboardAusweis.svelte b/src/components/Dashboard/DashboardAusweis.svelte index 4419b3a0..49a6cad9 100644 --- a/src/components/Dashboard/DashboardAusweis.svelte +++ b/src/components/Dashboard/DashboardAusweis.svelte @@ -311,12 +311,12 @@ {#if ausweisart === Enums.Ausweisart.VerbrauchsausweisWohnen}
Bearbeiten {:else if ausweisart === Enums.Ausweisart.VerbrauchsausweisGewerbe} Bearbeiten {/if} {/if} @@ -326,12 +326,12 @@ {#if ausweisart === Enums.Ausweisart.VerbrauchsausweisWohnen} Formular {:else if ausweisart === Enums.Ausweisart.VerbrauchsausweisGewerbe} Formular {/if} {/if} @@ -346,7 +346,7 @@ class="p-2 rounded-lg hover:bg-gray-200" title="PDF Herunterladen" target="_blank" - href="/pdf/ansichtsausweis?uid={ausweis.id}" + href="/pdf/ansichtsausweis?id={ausweis.id}" > Energieausweis @@ -354,7 +354,7 @@ class="p-2 rounded-lg hover:bg-gray-200" title="PDF Herunterladen" target="_blank" - href="/pdf/datenblatt?uid={ausweis.id}" + href="/pdf/datenblatt?id={ausweis.id}" > Datenblatt diff --git a/src/components/Dashboard/DashboardObjekt.svelte b/src/components/Dashboard/DashboardObjekt.svelte index 1ac75812..573652b5 100644 --- a/src/components/Dashboard/DashboardObjekt.svelte +++ b/src/components/Dashboard/DashboardObjekt.svelte @@ -12,7 +12,7 @@ {@const bild = objekt.aufnahmen[0].bilder.find(bild => bild.kategorie === Enums.BilderKategorie.Gebaeude)} {#if bild} - Gebäude + Gebäude {:else} Gebäude {/if} @@ -29,14 +29,14 @@
Stand vom {moment(aufnahme.erstellungsdatum).format("DD.MM.YYYY")} - +
{#if aufnahme.verbrauchsausweise_wohnen.length > 0} - + {/if} {#if aufnahme.verbrauchsausweise_gewerbe.length > 0} - + {/if}
diff --git a/src/components/DatenblattButton.svelte b/src/components/DatenblattButton.svelte index b2164453..4fc22fe4 100644 --- a/src/components/DatenblattButton.svelte +++ b/src/components/DatenblattButton.svelte @@ -1,13 +1,13 @@