ID auf Datenblatt

This commit is contained in:
Moritz Utcke
2025-03-23 19:07:57 -03:00
parent 3af32c0153
commit 302ae192ac
3 changed files with 9 additions and 2 deletions

View File

@@ -9,6 +9,7 @@ import { BilderKategorie, Enums, Heizungsstatus } from "#lib/server/prisma.js";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
import { copyPage } from "./utils/copyPage.js"; import { copyPage } from "./utils/copyPage.js";
import { PERSISTENT_DIR } from "#lib/server/constants.js"; import { PERSISTENT_DIR } from "#lib/server/constants.js";
import { shortenUID } from "#server/lib/hash.js";
/* -------------------------------- Pdf Tools ------------------------------- */ /* -------------------------------- Pdf Tools ------------------------------- */
@@ -52,13 +53,15 @@ export async function pdfDatenblattVerbrauchsausweisWohnen(ausweis: Verbrauchsau
const innerWidth = pages[0].getWidth() - marginX * 2; const innerWidth = pages[0].getWidth() - marginX * 2;
const id = shortenUID(ausweis.uid);
const layout = xml2pdf(`<layout height="${pages[0].getHeight()}" width="${pages[0].getWidth()}" marginTop="150" marginLeft="${marginX}" marginRight="${marginX}"> const layout = xml2pdf(`<layout height="${pages[0].getHeight()}" width="${pages[0].getWidth()}" marginTop="150" marginLeft="${marginX}" marginRight="${marginX}">
<text size="12" lineHeight="14">${benutzer.vorname} ${benutzer.name}</text> <text size="12" lineHeight="14">${benutzer.vorname} ${benutzer.name}</text>
<text size="12" lineHeight="14">${benutzer.adresse}</text> <text size="12" lineHeight="14">${benutzer.adresse}</text>
<text size="12" lineHeight="14">${benutzer.plz} ${benutzer.ort}</text> <text size="12" lineHeight="14">${benutzer.plz} ${benutzer.ort}</text>
<flex direction="row" justify="space-between" marginTop="55" width="${innerWidth}"> <flex direction="row" justify="space-between" marginTop="55" width="${innerWidth}">
<text size="12" font="bold">Datenblatt Energieausweis</text> <text size="12" font="bold">Datenblatt Energieausweis</text>
<text size="12">Ausweis ID: ${ausweis.uid}</text> <text size="12">Ausweis ID: ${id}</text>
</flex> </flex>
<text size="12" lineHeight="14" font="bold" marginTop="10">Gebäudedaten</text> <text size="12" lineHeight="14" font="bold" marginTop="10">Gebäudedaten</text>
<text size="12" lineHeight="14">Adresse: ${objekt.adresse}, ${objekt.plz} ${objekt.ort}</text> <text size="12" lineHeight="14">Adresse: ${objekt.adresse}, ${objekt.plz} ${objekt.ort}</text>

View File

@@ -34,6 +34,7 @@
export let objekt: ObjektClient export let objekt: ObjektClient
export let aufnahme: AufnahmeClient export let aufnahme: AufnahmeClient
export let user: BenutzerClient = {} as BenutzerClient; export let user: BenutzerClient = {} as BenutzerClient;
export let ausweistyp: Enums.AusweisTyp
export let bilder: UploadedGebaeudeBild[] = [] export let bilder: UploadedGebaeudeBild[] = []
export let uid: string; export let uid: string;

View File

@@ -6,8 +6,11 @@ import { AufnahmeClient, BedarfsausweisWohnenClient, ObjektClient, UploadedGebae
import { createCaller } from "src/astro-typesafe-api-caller"; import { createCaller } from "src/astro-typesafe-api-caller";
import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants"; import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants";
import { validateAccessTokenServer } from "#server/lib/validateAccessToken"; import { validateAccessTokenServer } from "#server/lib/validateAccessToken";
import { Enums } from "#lib/server/prisma";
const uid = Astro.url.searchParams.get("uid") || ""; const uid = Astro.url.searchParams.get("uid") || "";
const uid_aufnahme = Astro.url.searchParams.get("aufnahme")
const ausweistyp = Astro.url.searchParams.get("ausweistyp") || Enums.AusweisTyp.Standard;
let ausweis: VerbrauchsausweisWohnenClient = {} as VerbrauchsausweisWohnenClient; let ausweis: VerbrauchsausweisWohnenClient = {} as VerbrauchsausweisWohnenClient;
let aufnahme: AufnahmeClient = {} as AufnahmeClient; let aufnahme: AufnahmeClient = {} as AufnahmeClient;
let objekt: ObjektClient = {} as ObjektClient; let objekt: ObjektClient = {} as ObjektClient;
@@ -78,5 +81,5 @@ if (uid) {
--- ---
<AusweisLayout title="Bedarfsausweis erstellen | IBCornelsen"> <AusweisLayout title="Bedarfsausweis erstellen | IBCornelsen">
<BedarfsausweisWohnenModule client:only {ausweis} {objekt} {aufnahme} {bilder} {uid}></BedarfsausweisWohnenModule> <BedarfsausweisWohnenModule client:only {ausweis} {objekt} {aufnahme} {bilder} {ausweistyp} {uid}></BedarfsausweisWohnenModule>
</AusweisLayout> </AusweisLayout>