diff --git a/src/astro-typesafe-api-caller.ts b/src/astro-typesafe-api-caller.ts index 81eb88cc..878fa996 100644 --- a/src/astro-typesafe-api-caller.ts +++ b/src/astro-typesafe-api-caller.ts @@ -5,11 +5,11 @@ 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"), + "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"), - "bedarfsausweis-wohnen": await import("../src/pages/api/bedarfsausweis-wohnen/index.ts"), "objekt": await import("../src/pages/api/objekt/index.ts"), "rechnung": await import("../src/pages/api/rechnung/index.ts"), "ticket": await import("../src/pages/api/ticket/index.ts"), diff --git a/src/components/Ausweis/ButtonWeiterHilfe.svelte b/src/components/Ausweis/ButtonWeiterHilfe.svelte index 357c5ccb..a25123aa 100644 --- a/src/components/Ausweis/ButtonWeiterHilfe.svelte +++ b/src/components/Ausweis/ButtonWeiterHilfe.svelte @@ -1,15 +1,11 @@
Später Weitermachen -
- +
+ +
+ +
+
+ +
diff --git a/src/components/PlzSuche.svelte b/src/components/PlzSuche.svelte index c719f579..440e9d1b 100644 --- a/src/components/PlzSuche.svelte +++ b/src/components/PlzSuche.svelte @@ -45,7 +45,7 @@ -
{ +
{ hideZipDropdown = true; }}> @@ -65,13 +65,19 @@ maxlength="5" /> - \ No newline at end of file +
+ + \ No newline at end of file diff --git a/src/layouts/UserLayout.astro b/src/layouts/UserLayout.astro index 6c5f8b1f..87e99162 100644 --- a/src/layouts/UserLayout.astro +++ b/src/layouts/UserLayout.astro @@ -6,6 +6,7 @@ import "svelte-ripple-action/ripple.css" import DashboardSidebar from "../components/Dashboard/DashboardSidebar.svelte" import { validateAccessTokenServer } from "#server/lib/validateAccessToken"; import { createCaller } from "src/astro-typesafe-api-caller"; +import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants"; const valid = validateAccessTokenServer(Astro) @@ -16,7 +17,11 @@ if (!valid) { const caller = createCaller(Astro) -const benutzer = await caller.v1.benutzer.self() +const benutzer = await caller.user.self.GET.fetch(null, { + headers: { + Authorization: `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}` + } +}) export interface Props { title: string; diff --git a/src/lib/pdf/pdfVerbrauchsausweisWohnen.ts b/src/lib/pdf/pdfVerbrauchsausweisWohnen.ts index 5b7d8240..ad416a88 100644 --- a/src/lib/pdf/pdfVerbrauchsausweisWohnen.ts +++ b/src/lib/pdf/pdfVerbrauchsausweisWohnen.ts @@ -4,7 +4,7 @@ import { getEmpfehlungen } from "#lib/XML/getEmpfehlungen.js"; import { Enums } from "@ibcornelsen/database/server"; import * as fs from "fs" import moment from "moment"; -import { PDFDocument, PDFFont, PDFName, PDFNumber, PDFPage, StandardFonts, TextAlignment } from "pdf-lib"; +import { PDFDocument, PDFFont, PDFName, PDFNumber, PDFPage, RotationTypes, StandardFonts, TextAlignment } from "pdf-lib"; /* -------------------------------- Pdf Tools ------------------------------- */ @@ -82,7 +82,6 @@ export async function pdfVerbrauchsausweisWohnen(ausweis: VerbrauchsausweisWohne /* -------------------------------- Seite 2 -------------------------------- */ - const co2Emissionen = fillFormField("co2emissionen", berechnungen?.co2EmissionenGesamt.toString(), 8, TextAlignment.Center) const addEnergieverbrauchSkalaPfeile = async (page: PDFPage) => { const pfeilNachUnten = await pdf.embedPng(fs.readFileSync(new URL("../../../public/images/pfeil-nach-unten.png", import.meta.url), "base64")) @@ -172,11 +171,7 @@ export async function pdfVerbrauchsausweisWohnen(ausweis: VerbrauchsausweisWohne } } - addEnergieverbrauchSkalaPfeile(pages[1]) - addEnergieverbrauchSkalaPfeile(pages[2]) - - const primaerenergiebedarfIst = fillFormField("primaerenergiebedarf_ist", berechnungen?.primaerEnergieVerbrauchGesamt.toString()) - + addEnergieverbrauchSkalaPfeile(pages[2]) /* -------------------------------- Seite 3 -------------------------------- */ @@ -369,6 +364,22 @@ export async function pdfVerbrauchsausweisWohnen(ausweis: VerbrauchsausweisWohne } + function addAnsichtsausweisLabel(page: PDFPage, font: PDFFont) { + page.drawText("Ansichtsausweis", { + x: page.getWidth() / 2 - font.heightAtSize(112) * 2.2, y: page.getHeight() - font.heightAtSize(112) / 2, + size: 112, + font, + rotate: { + type: RotationTypes.Degrees, + angle: -60 + }, + opacity: 0.3 + }) + } + + for (const page of pages) { + addAnsichtsausweisLabel(page, font) + } // pdf.getForm().flatten() diff --git a/src/modules/Dashboard/DashboardModule.svelte b/src/modules/Dashboard/DashboardModule.svelte index 4f929f45..33ee0fb1 100644 --- a/src/modules/Dashboard/DashboardModule.svelte +++ b/src/modules/Dashboard/DashboardModule.svelte @@ -3,6 +3,9 @@ export let user: BenutzerClient; export let objekte: ObjektClient[]; + + console.log(objekte); +

Willkommen zurück, {user.vorname}!

@@ -12,7 +15,7 @@

Gebäude

- {#each objekte as objekt} +
\ No newline at end of file diff --git a/src/modules/KundendatenModule.svelte b/src/modules/KundendatenModule.svelte index 7c2f666a..d783b461 100644 --- a/src/modules/KundendatenModule.svelte +++ b/src/modules/KundendatenModule.svelte @@ -30,6 +30,7 @@ export let ausweis: VerbrauchsausweisWohnenClient; export let aufnahme: AufnahmeClient; export let objekt: ObjektClient; + export let ausweisart: Enums.Ausweisart; let rechnung: Partial = { email: user.email, @@ -89,6 +90,13 @@ 0 ); + const zurueck = { + [Enums.Ausweisart.VerbrauchsausweisWohnen]: `/energieausweis-erstellen/verbrauchsausweis-wohngebaeude?uid=${ausweis.uid}`, + [Enums.Ausweisart.VerbrauchsausweisGewerbe]: `/energieausweis-erstellen/verbrauchsausweis-gewerbe?uid=${ausweis.uid}`, + [Enums.Ausweisart.BedarfsausweisWohnen]: `/energieausweis-erstellen/bedarfsausweis-wohnen?uid=${ausweis.uid}`, + [Enums.Ausweisart.BedarfsausweisGewerbe]: `/energieausweis-erstellen/bedarfsausweis-gewerbe?uid=${ausweis.uid}`, + }[ausweisart] + async function speichern(e: SubmitEvent) { e.preventDefault(); @@ -254,7 +262,7 @@
- + Zurück
diff --git a/src/modules/LoginModule.svelte b/src/modules/LoginModule.svelte index 6f4db23b..c8e7196e 100644 --- a/src/modules/LoginModule.svelte +++ b/src/modules/LoginModule.svelte @@ -1,5 +1,5 @@ - - -
- -
-
- - \ No newline at end of file diff --git a/src/pages/kundendaten.astro b/src/pages/kundendaten.astro index f3e77353..220dadae 100644 --- a/src/pages/kundendaten.astro +++ b/src/pages/kundendaten.astro @@ -88,6 +88,6 @@ if (!ausweis || !user) { --- - +