Fehler von Jens gefixt
This commit is contained in:
@@ -5,11 +5,11 @@ export const createCaller = createCallerFactory({
|
|||||||
"postleitzahlen": await import("../src/pages/api/postleitzahlen.ts"),
|
"postleitzahlen": await import("../src/pages/api/postleitzahlen.ts"),
|
||||||
"aufnahme/[uid]": await import("../src/pages/api/aufnahme/[uid].ts"),
|
"aufnahme/[uid]": await import("../src/pages/api/aufnahme/[uid].ts"),
|
||||||
"aufnahme": await import("../src/pages/api/aufnahme/index.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/access-token": await import("../src/pages/api/auth/access-token.ts"),
|
||||||
"auth/forgot-password": await import("../src/pages/api/auth/forgot-password.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"),
|
"auth/refresh-token": await import("../src/pages/api/auth/refresh-token.ts"),
|
||||||
"bilder/[uid]": await import("../src/pages/api/bilder/[uid].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"),
|
"objekt": await import("../src/pages/api/objekt/index.ts"),
|
||||||
"rechnung": await import("../src/pages/api/rechnung/index.ts"),
|
"rechnung": await import("../src/pages/api/rechnung/index.ts"),
|
||||||
"ticket": await import("../src/pages/api/ticket/index.ts"),
|
"ticket": await import("../src/pages/api/ticket/index.ts"),
|
||||||
|
|||||||
@@ -1,15 +1,11 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import AusweisWeiter from "#modules/VerbrauchsausweisWohnen/AusweisWeiter.svelte";
|
|
||||||
import Hilfe from "#components/Ausweis/Hilfe.svelte";
|
import Hilfe from "#components/Ausweis/Hilfe.svelte";
|
||||||
import {
|
import { ausweisSpeichern } from "#client/lib/ausweisSpeichern.js";
|
||||||
AufnahmeClient,
|
import { validateAccessTokenClient } from "#client/lib/validateAccessToken.js";
|
||||||
BedarfsausweisWohnenClient,
|
import { AufnahmeClient, BedarfsausweisWohnenClient, BenutzerClient, ObjektClient, UploadedGebaeudeBild, VerbrauchsausweisGewerbeClient, VerbrauchsausweisWohnenClient } from "#components/Ausweis/types.js";
|
||||||
BenutzerClient,
|
import Overlay from "#components/Overlay.svelte";
|
||||||
ObjektClient,
|
import EmbeddedAuthFlowModule from "#modules/EmbeddedAuthFlowModule.svelte";
|
||||||
UploadedGebaeudeBild,
|
|
||||||
VerbrauchsausweisGewerbeClient,
|
|
||||||
VerbrauchsausweisWohnenClient,
|
|
||||||
} from "./types.js";
|
|
||||||
import { Enums } from "@ibcornelsen/database/client";
|
import { Enums } from "@ibcornelsen/database/client";
|
||||||
|
|
||||||
export let ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient | BedarfsausweisWohnenClient;
|
export let ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient | BedarfsausweisWohnenClient;
|
||||||
@@ -19,7 +15,46 @@
|
|||||||
export let aufnahme: AufnahmeClient;
|
export let aufnahme: AufnahmeClient;
|
||||||
export let ausweisart: Enums.Ausweisart
|
export let ausweisart: Enums.Ausweisart
|
||||||
|
|
||||||
export let spaeterWeitermachen;
|
async function ausweisAbschicken() {
|
||||||
|
if (!await validateAccessTokenClient()) {
|
||||||
|
loginOverlayHidden = false;
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
loginOverlayHidden = true
|
||||||
|
|
||||||
|
const result = await ausweisSpeichern(ausweis, objekt, aufnahme, bilder, ausweisart);
|
||||||
|
|
||||||
|
if (result !== null) {
|
||||||
|
window.history.pushState(
|
||||||
|
{},
|
||||||
|
"",
|
||||||
|
`${location.pathname}?uid=${ausweis.uid}`
|
||||||
|
);
|
||||||
|
window.location.href = `/kundendaten?uid=${ausweis.uid}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function spaeterWeitermachen() {
|
||||||
|
if (!await validateAccessTokenClient()) {
|
||||||
|
loginOverlayHidden = false;
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
loginOverlayHidden = true
|
||||||
|
|
||||||
|
const result = await ausweisSpeichern(ausweis, objekt, aufnahme, bilder, ausweisart);
|
||||||
|
|
||||||
|
if (result !== null) {
|
||||||
|
window.history.pushState(
|
||||||
|
{},
|
||||||
|
"",
|
||||||
|
`${location.pathname}?uid=${ausweis.uid}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let loginOverlayHidden = true;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
@@ -33,14 +68,13 @@
|
|||||||
>Später Weitermachen
|
>Später Weitermachen
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div class="">
|
<div>
|
||||||
<AusweisWeiter
|
<Overlay bind:hidden={loginOverlayHidden}>
|
||||||
bind:ausweis
|
<div class="bg-white w-full max-w-screen-sm py-8">
|
||||||
bind:bilder
|
<EmbeddedAuthFlowModule onLogin={ausweisAbschicken}></EmbeddedAuthFlowModule>
|
||||||
bind:user
|
</div>
|
||||||
bind:objekt
|
</Overlay>
|
||||||
bind:aufnahme
|
|
||||||
{ausweisart}
|
<button on:click={ausweisAbschicken} type="button" class="button" data-cy="weiter">Weiter</button>
|
||||||
></AusweisWeiter>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="" use:clickOutside={() => {
|
<div use:clickOutside={() => {
|
||||||
hideZipDropdown = true;
|
hideZipDropdown = true;
|
||||||
}}>
|
}}>
|
||||||
|
|
||||||
@@ -65,13 +65,19 @@
|
|||||||
maxlength="5"
|
maxlength="5"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div data-test="plz-container" class="absolute top-[calc(100%+4px)] left-0 w-full bg-white py-2 shadow-md rounded-lg z-50" hidden={hideZipDropdown}>
|
<div data-test="plz-container" class="absolute top-[calc(100%+4px)] flex flex-col left-0 bg-white py-1 shadow-md rounded-lg z-10" class:hidden={hideZipDropdown}>
|
||||||
{#each zipCodes as zipCode}
|
{#each zipCodes as zipCode}
|
||||||
<div class="hover:bg-gray-100 cursor-pointer px-2 py-0.5 text-nowrap" tabindex="-1" on:click={() => {
|
<button class="hover:bg-gray-100 cursor-pointer px-2 py-1 text-nowrap" tabindex="-1" on:click={() => {
|
||||||
zip = zipCode.plz;
|
zip = zipCode.plz;
|
||||||
city = zipCode.stadt;
|
city = zipCode.stadt;
|
||||||
hideZipDropdown = true;
|
hideZipDropdown = true;
|
||||||
}}>{zipCode.plz}, {zipCode.stadt}</div>
|
}}>{zipCode.plz}, {zipCode.stadt}</button>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
button:not(:last-of-type) {
|
||||||
|
@apply border-b border-b-gray-200;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -6,6 +6,7 @@ import "svelte-ripple-action/ripple.css"
|
|||||||
import DashboardSidebar from "../components/Dashboard/DashboardSidebar.svelte"
|
import DashboardSidebar from "../components/Dashboard/DashboardSidebar.svelte"
|
||||||
import { validateAccessTokenServer } from "#server/lib/validateAccessToken";
|
import { validateAccessTokenServer } from "#server/lib/validateAccessToken";
|
||||||
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";
|
||||||
|
|
||||||
const valid = validateAccessTokenServer(Astro)
|
const valid = validateAccessTokenServer(Astro)
|
||||||
|
|
||||||
@@ -16,7 +17,11 @@ if (!valid) {
|
|||||||
|
|
||||||
const caller = createCaller(Astro)
|
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 {
|
export interface Props {
|
||||||
title: string;
|
title: string;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { getEmpfehlungen } from "#lib/XML/getEmpfehlungen.js";
|
|||||||
import { Enums } from "@ibcornelsen/database/server";
|
import { Enums } from "@ibcornelsen/database/server";
|
||||||
import * as fs from "fs"
|
import * as fs from "fs"
|
||||||
import moment from "moment";
|
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 ------------------------------- */
|
/* -------------------------------- Pdf Tools ------------------------------- */
|
||||||
|
|
||||||
@@ -82,7 +82,6 @@ export async function pdfVerbrauchsausweisWohnen(ausweis: VerbrauchsausweisWohne
|
|||||||
|
|
||||||
/* -------------------------------- Seite 2 -------------------------------- */
|
/* -------------------------------- Seite 2 -------------------------------- */
|
||||||
|
|
||||||
const co2Emissionen = fillFormField("co2emissionen", berechnungen?.co2EmissionenGesamt.toString(), 8, TextAlignment.Center)
|
|
||||||
|
|
||||||
const addEnergieverbrauchSkalaPfeile = async (page: PDFPage) => {
|
const addEnergieverbrauchSkalaPfeile = async (page: PDFPage) => {
|
||||||
const pfeilNachUnten = await pdf.embedPng(fs.readFileSync(new URL("../../../public/images/pfeil-nach-unten.png", import.meta.url), "base64"))
|
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])
|
||||||
addEnergieverbrauchSkalaPfeile(pages[2])
|
|
||||||
|
|
||||||
const primaerenergiebedarfIst = fillFormField("primaerenergiebedarf_ist", berechnungen?.primaerEnergieVerbrauchGesamt.toString())
|
|
||||||
|
|
||||||
|
|
||||||
/* -------------------------------- Seite 3 -------------------------------- */
|
/* -------------------------------- 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()
|
// pdf.getForm().flatten()
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,9 @@
|
|||||||
|
|
||||||
export let user: BenutzerClient;
|
export let user: BenutzerClient;
|
||||||
export let objekte: ObjektClient[];
|
export let objekte: ObjektClient[];
|
||||||
|
|
||||||
|
console.log(objekte);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h1 class="text-4xl font-medium my-8">Willkommen zurück, {user.vorname}!</h1>
|
<h1 class="text-4xl font-medium my-8">Willkommen zurück, {user.vorname}!</h1>
|
||||||
@@ -12,7 +15,7 @@
|
|||||||
|
|
||||||
<h1 class="text-4xl font-medium my-8">Gebäude</h1>
|
<h1 class="text-4xl font-medium my-8">Gebäude</h1>
|
||||||
<div class="grid grid-cols-1 gap-4 lg:grid-cols-2">
|
<div class="grid grid-cols-1 gap-4 lg:grid-cols-2">
|
||||||
{#each objekte as objekt}
|
<!-- {#each objekte as objekt}
|
||||||
<div class="card lg:card-side bg-base-200 card-bordered border-base-300">
|
<div class="card lg:card-side bg-base-200 card-bordered border-base-300">
|
||||||
<figure class="lg:w-1/2">
|
<figure class="lg:w-1/2">
|
||||||
<img
|
<img
|
||||||
@@ -25,5 +28,5 @@
|
|||||||
<h4 class="text-lg font-semibold">{objekt.adresse}, {objekt.plz} {objekt.ort}</h4>
|
<h4 class="text-lg font-semibold">{objekt.adresse}, {objekt.plz} {objekt.ort}</h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each} -->
|
||||||
</div>
|
</div>
|
||||||
@@ -30,6 +30,7 @@
|
|||||||
export let ausweis: VerbrauchsausweisWohnenClient;
|
export let ausweis: VerbrauchsausweisWohnenClient;
|
||||||
export let aufnahme: AufnahmeClient;
|
export let aufnahme: AufnahmeClient;
|
||||||
export let objekt: ObjektClient;
|
export let objekt: ObjektClient;
|
||||||
|
export let ausweisart: Enums.Ausweisart;
|
||||||
|
|
||||||
let rechnung: Partial<RechnungClient> = {
|
let rechnung: Partial<RechnungClient> = {
|
||||||
email: user.email,
|
email: user.email,
|
||||||
@@ -89,6 +90,13 @@
|
|||||||
0
|
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) {
|
async function speichern(e: SubmitEvent) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
@@ -254,7 +262,7 @@
|
|||||||
<div
|
<div
|
||||||
class="w-full grid grid-cols-[min-content_1fr_min-content_min-content] grid-rows-[min_content_1fr] gap-x-2 self-start justify-self-end mt-8"
|
class="w-full grid grid-cols-[min-content_1fr_min-content_min-content] grid-rows-[min_content_1fr] gap-x-2 self-start justify-self-end mt-8"
|
||||||
>
|
>
|
||||||
<button class="button justify-self-start">Zurück</button>
|
<a class="button justify-self-start" href={zurueck}>Zurück</a>
|
||||||
|
|
||||||
<div></div>
|
<div></div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { loginClient } from "#lib/login";
|
import { loginClient } from "#lib/login.js";
|
||||||
import CrossCircled from "radix-svelte-icons/src/lib/icons/CrossCircled.svelte";
|
import CrossCircled from "radix-svelte-icons/src/lib/icons/CrossCircled.svelte";
|
||||||
import { fade } from "svelte/transition";
|
import { fade } from "svelte/transition";
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
<span class="font-semibold">Das hat leider nicht geklappt, haben sie ihr Passwort und ihre Email Adresse richtig eingegeben?</span>
|
<span class="font-semibold">Das hat leider nicht geklappt, haben sie ihr Passwort und ihre Email Adresse richtig eingegeben?</span>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<button class="btn btn-primary" type="submit">Einloggen</button>
|
<button class="button" type="submit">Einloggen</button>
|
||||||
<div class="flex-row justify-between" style="margin-top: 10px">
|
<div class="flex-row justify-between" style="margin-top: 10px">
|
||||||
<a class="link link-hover" href="/auth/signup{redirect ? `?redirect=${redirect}` : ""}">Registrieren</a>
|
<a class="link link-hover" href="/auth/signup{redirect ? `?redirect=${redirect}` : ""}">Registrieren</a>
|
||||||
<a class="link link-hover" href="/auth/passwort-vergessen{redirect ? `?redirect=${redirect}` : ""}"
|
<a class="link link-hover" href="/auth/passwort-vergessen{redirect ? `?redirect=${redirect}` : ""}"
|
||||||
|
|||||||
@@ -1,46 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
import { ausweisSpeichern } from "#client/lib/ausweisSpeichern.js";
|
|
||||||
import { validateAccessTokenClient } from "#client/lib/validateAccessToken.js";
|
|
||||||
import { AufnahmeClient, BedarfsausweisWohnenClient, BenutzerClient, ObjektClient, UploadedGebaeudeBild, VerbrauchsausweisGewerbeClient, VerbrauchsausweisWohnenClient } from "#components/Ausweis/types.js";
|
|
||||||
import Overlay from "#components/Overlay.svelte";
|
|
||||||
import EmbeddedAuthFlowModule from "#modules/EmbeddedAuthFlowModule.svelte";
|
|
||||||
|
|
||||||
import { Enums } from "@ibcornelsen/database/client";
|
|
||||||
|
|
||||||
export let objekt: ObjektClient;
|
|
||||||
export let bilder: UploadedGebaeudeBild[];
|
|
||||||
export let ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient | BedarfsausweisWohnenClient;
|
|
||||||
export let user: BenutzerClient;
|
|
||||||
export let aufnahme: AufnahmeClient;
|
|
||||||
export let ausweisart: Enums.Ausweisart
|
|
||||||
|
|
||||||
async function ausweisAbschicken() {
|
|
||||||
if (!await validateAccessTokenClient()) {
|
|
||||||
loginOverlayHidden = false;
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
loginOverlayHidden = true
|
|
||||||
|
|
||||||
const result = await ausweisSpeichern(ausweis, objekt, aufnahme, bilder, ausweisart);
|
|
||||||
|
|
||||||
if (result !== null) {
|
|
||||||
window.history.pushState(
|
|
||||||
{},
|
|
||||||
"",
|
|
||||||
`${location.pathname}?uid=${ausweis.uid}`
|
|
||||||
);
|
|
||||||
window.location.href = `/kundendaten?uid=${ausweis.uid}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let loginOverlayHidden = true;
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<Overlay bind:hidden={loginOverlayHidden}>
|
|
||||||
<div class="bg-white w-full max-w-screen-sm py-8">
|
|
||||||
<EmbeddedAuthFlowModule onLogin={ausweisAbschicken}></EmbeddedAuthFlowModule>
|
|
||||||
</div>
|
|
||||||
</Overlay>
|
|
||||||
|
|
||||||
<button on:click={ausweisAbschicken} type="button" class="button" data-cy="weiter">Weiter</button>
|
|
||||||
@@ -88,6 +88,6 @@ if (!ausweis || !user) {
|
|||||||
---
|
---
|
||||||
|
|
||||||
<AusweisLayout title="Kundendaten Aufnehmen - IBCornelsen">
|
<AusweisLayout title="Kundendaten Aufnehmen - IBCornelsen">
|
||||||
<KundendatenModule {user} {ausweis} {objekt} {aufnahme} selectedPaymentType={Enums.Bezahlmethoden.paypal} client:load></KundendatenModule>
|
<KundendatenModule {user} {ausweis} {objekt} {aufnahme} {ausweisart} selectedPaymentType={Enums.Bezahlmethoden.paypal} client:load></KundendatenModule>
|
||||||
</AusweisLayout>
|
</AusweisLayout>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user