GEG Einpreisung
This commit is contained in:
BIN
persistent/unterlagen/pln-7628272a-1a70-44fb-8c00-a6b5125153c4
Normal file
BIN
persistent/unterlagen/pln-7628272a-1a70-44fb-8c00-a6b5125153c4
Normal file
Binary file not shown.
BIN
persistent/unterlagen/pln-9412f6f9-16b2-4c96-a612-d0b788b73df7
Normal file
BIN
persistent/unterlagen/pln-9412f6f9-16b2-4c96-a612-d0b788b73df7
Normal file
Binary file not shown.
BIN
persistent/unterlagen/pln-bc44e0e7-14e5-4112-b113-59f172c387a6
Normal file
BIN
persistent/unterlagen/pln-bc44e0e7-14e5-4112-b113-59f172c387a6
Normal file
Binary file not shown.
BIN
persistent/unterlagen/pln-be301689-303e-4f78-b0f2-08cda642e8cf
Normal file
BIN
persistent/unterlagen/pln-be301689-303e-4f78-b0f2-08cda642e8cf
Normal file
Binary file not shown.
BIN
persistent/unterlagen/pln-c86f7c42-55cd-4448-9830-4c41ce7b3815
Normal file
BIN
persistent/unterlagen/pln-c86f7c42-55cd-4448-9830-4c41ce7b3815
Normal file
Binary file not shown.
@@ -4,9 +4,7 @@ export const createCaller = createCallerFactory({
|
||||
"bild": await import("../src/pages/api/bild.ts"),
|
||||
"klimafaktoren": await import("../src/pages/api/klimafaktoren.ts"),
|
||||
"postleitzahlen": await import("../src/pages/api/postleitzahlen.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"),
|
||||
"unterlage": await import("../src/pages/api/unterlage.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"),
|
||||
@@ -14,6 +12,9 @@ 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"),
|
||||
"aufnahme": await import("../src/pages/api/aufnahme/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"),
|
||||
"bedarfsausweis-wohnen/[uid]": await import("../src/pages/api/bedarfsausweis-wohnen/[uid].ts"),
|
||||
"bedarfsausweis-wohnen": await import("../src/pages/api/bedarfsausweis-wohnen/index.ts"),
|
||||
"bilder/[uid]": await import("../src/pages/api/bilder/[uid].ts"),
|
||||
@@ -27,11 +28,10 @@ export const createCaller = createCallerFactory({
|
||||
"user/self": await import("../src/pages/api/user/self.ts"),
|
||||
"verbrauchsausweis-gewerbe/[uid]": await import("../src/pages/api/verbrauchsausweis-gewerbe/[uid].ts"),
|
||||
"verbrauchsausweis-gewerbe": await import("../src/pages/api/verbrauchsausweis-gewerbe/index.ts"),
|
||||
"webhooks/mollie": await import("../src/pages/api/webhooks/mollie.ts"),
|
||||
"verbrauchsausweis-wohnen/[uid]": await import("../src/pages/api/verbrauchsausweis-wohnen/[uid].ts"),
|
||||
"verbrauchsausweis-wohnen": await import("../src/pages/api/verbrauchsausweis-wohnen/index.ts"),
|
||||
"webhooks/mollie": await import("../src/pages/api/webhooks/mollie.ts"),
|
||||
"aufnahme/[uid]/bilder": await import("../src/pages/api/aufnahme/[uid]/bilder.ts"),
|
||||
"aufnahme/[uid]": await import("../src/pages/api/aufnahme/[uid]/index.ts"),
|
||||
"objekt/[uid]": await import("../src/pages/api/objekt/[uid]/index.ts"),
|
||||
"objekt/[uid]/unterlagen": await import("../src/pages/api/objekt/[uid]/unterlagen.ts"),
|
||||
})
|
||||
18
src/client/lib/helpers.ts
Normal file
18
src/client/lib/helpers.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { writable, Writable } from "svelte/store";
|
||||
|
||||
export function localStorageSync<T>(initial: T, name: string, modifier: (stored: any) => T = (stored) => JSON.parse(stored), reverseModifier: (value: T) => string = (value) => JSON.stringify(value)): Writable<T> {
|
||||
const stored = localStorage.getItem(name) as T
|
||||
let value = initial;
|
||||
if (stored) {
|
||||
value = modifier(stored)
|
||||
}
|
||||
|
||||
const writableStore = writable(value)
|
||||
|
||||
writableStore.subscribe((value) => {
|
||||
const reversed = reverseModifier(value);
|
||||
localStorage.setItem(name, reversed)
|
||||
})
|
||||
|
||||
return writableStore
|
||||
}
|
||||
135
src/client/lib/nachweisSpeichern.ts
Normal file
135
src/client/lib/nachweisSpeichern.ts
Normal file
@@ -0,0 +1,135 @@
|
||||
|
||||
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 { Enums } from "@ibcornelsen/database/client";
|
||||
|
||||
export async function nachweisSpeichern(
|
||||
nachweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient | BedarfsausweisWohnenClient,
|
||||
objekt: ObjektClient,
|
||||
aufnahme: AufnahmeClient,
|
||||
bilder: BildClient[],
|
||||
unterlagen: UnterlageClient[],
|
||||
ausweisart: Enums.Ausweisart
|
||||
) {
|
||||
if (objekt.uid) {
|
||||
await api.objekt._uid.PATCH.fetch({
|
||||
...exclude(objekt, ["uid"])
|
||||
}, {
|
||||
params: {
|
||||
uid: objekt.uid
|
||||
},
|
||||
headers: {
|
||||
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
||||
}
|
||||
})
|
||||
} else {
|
||||
const { uid } = await api.objekt.PUT.fetch({
|
||||
...exclude(objekt, ["uid"])
|
||||
}, {
|
||||
headers: {
|
||||
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
||||
}
|
||||
})
|
||||
|
||||
objekt.uid = uid;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (aufnahme.uid) {
|
||||
await api.aufnahme._uid.PATCH.fetch({
|
||||
...exclude(aufnahme, ["uid"]),
|
||||
baujahr_gebaeude: aufnahme.baujahr_gebaeude || [],
|
||||
baujahr_klima: aufnahme.baujahr_klima || [],
|
||||
baujahr_heizung: aufnahme.baujahr_heizung || [],
|
||||
}, {
|
||||
params: {
|
||||
uid: aufnahme.uid
|
||||
},
|
||||
headers: {
|
||||
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
||||
}
|
||||
})
|
||||
} else {
|
||||
const { uid } = await api.aufnahme.PUT.fetch({
|
||||
aufnahme,
|
||||
uid_objekt: objekt.uid
|
||||
}, {
|
||||
headers: {
|
||||
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
||||
}
|
||||
})
|
||||
|
||||
aufnahme.uid = uid
|
||||
}
|
||||
|
||||
let patchRoute: any;
|
||||
let putRoute: any;
|
||||
if (ausweisart == Enums.Ausweisart.GEGNachweisWohnen) {
|
||||
patchRoute = api["geg-nachweis-wohnen"]._uid.PATCH
|
||||
putRoute = api["geg-nachweis-wohnen"].PUT
|
||||
}
|
||||
|
||||
if (nachweis.uid) {
|
||||
await patchRoute.fetch({
|
||||
...exclude(nachweis, ["uid"])
|
||||
}, {
|
||||
params: {
|
||||
uid: nachweis.uid
|
||||
},
|
||||
headers: {
|
||||
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
||||
}
|
||||
})
|
||||
} else {
|
||||
const { uid } = await putRoute.fetch({
|
||||
nachweis,
|
||||
uid_aufnahme: aufnahme.uid
|
||||
}, {
|
||||
headers: {
|
||||
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
||||
}
|
||||
})
|
||||
|
||||
nachweis.uid = uid;
|
||||
}
|
||||
|
||||
await api.aufnahme._uid.bilder.PUT.fetch(bilder.map(bild => bild.uid), {
|
||||
params: {
|
||||
uid: aufnahme.uid
|
||||
},
|
||||
headers: {
|
||||
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
||||
}
|
||||
})
|
||||
|
||||
return {
|
||||
uid_nachweis: nachweis.uid,
|
||||
uid_aufnahme: aufnahme.uid,
|
||||
uid_objekt: objekt.uid
|
||||
}
|
||||
|
||||
|
||||
// await client.v1.tickets.erstellen.mutate({
|
||||
// titel: "Ausweis konnte nicht gespeichert werden",
|
||||
// beschreibung: e.stack,
|
||||
// email: user.email ?? "",
|
||||
// metadata: JSON.stringify({
|
||||
// ausweis,
|
||||
// }),
|
||||
// });
|
||||
|
||||
// addNotification({
|
||||
// dismissable: false,
|
||||
// message:
|
||||
// "Ausweis konnte nicht gespeichert werden, bitte versuchen sie es erneut.",
|
||||
// subtext:
|
||||
// "Sollte das Problem weiterhin bestehen, kontaktieren sie bitte den Support.",
|
||||
// timeout: 6000,
|
||||
// type: "error",
|
||||
// });
|
||||
return null;
|
||||
}
|
||||
@@ -48,7 +48,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
required
|
||||
data-cy="ausstellgrund"
|
||||
>
|
||||
<option disabled selected value={false}>Bitte auswählen</option>
|
||||
<option disabled selected>Bitte auswählen</option>
|
||||
{#each Object.entries(Enums.Ausstellgrund) as [name, ausstellgrund]}
|
||||
<option value={ausstellgrund}>{name}</option>
|
||||
{/each}
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
<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 { AufnahmeClient, BedarfsausweisWohnenClient, BenutzerClient, GEGNachweisWohnenClient, ObjektClient, UnterlageClient, UploadedGebaeudeBild, VerbrauchsausweisGewerbeClient, VerbrauchsausweisWohnenClient } from "#components/Ausweis/types.js";
|
||||
import Overlay from "#components/Overlay.svelte";
|
||||
import EmbeddedAuthFlowModule from "#modules/EmbeddedAuthFlowModule.svelte";
|
||||
|
||||
import { AusweisTyp, Enums } from "@ibcornelsen/database/client";
|
||||
import { openWindowWithPost } from "#lib/helpers/window.js";
|
||||
import { PRICES } from "#lib/constants.js";
|
||||
import { nachweisSpeichern } from "#client/lib/nachweisSpeichern.js";
|
||||
|
||||
export let ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient | BedarfsausweisWohnenClient;
|
||||
export let ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient | BedarfsausweisWohnenClient | GEGNachweisWohnenClient;
|
||||
export let bilder: UploadedGebaeudeBild[];
|
||||
export let unterlagen: UnterlageClient[];
|
||||
export let user: BenutzerClient;
|
||||
export let objekt: ObjektClient;
|
||||
export let aufnahme: AufnahmeClient;
|
||||
@@ -26,6 +28,7 @@
|
||||
objekt,
|
||||
aufnahme,
|
||||
bilder,
|
||||
unterlagen,
|
||||
ausweisart,
|
||||
ausweistyp
|
||||
}, "")
|
||||
@@ -42,7 +45,12 @@
|
||||
|
||||
loginOverlayHidden = true
|
||||
|
||||
const result = await ausweisSpeichern(ausweis, objekt, aufnahme, bilder, ausweisart);
|
||||
let result: Awaited<ReturnType<typeof ausweisSpeichern>> | null = null;
|
||||
if (ausweisart === Enums.Ausweisart.GEGNachweisWohnen) {
|
||||
result = await nachweisSpeichern(ausweis, objekt, aufnahme, bilder, unterlagen, ausweisart)
|
||||
} else {
|
||||
result = await ausweisSpeichern(ausweis, objekt, aufnahme, bilder, ausweisart)
|
||||
}
|
||||
|
||||
if (result !== null) {
|
||||
window.history.pushState(
|
||||
|
||||
@@ -121,7 +121,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
bind:value={aufnahme.dachgeschoss}
|
||||
required
|
||||
>
|
||||
<option disabled selected value={false}>Bitte auswählen</option>
|
||||
<option disabled selected>Bitte auswählen</option>
|
||||
<option value={Enums.Heizungsstatus.NICHT_VORHANDEN}>nicht vorhanden</option>
|
||||
<option value={Enums.Heizungsstatus.UNBEHEIZT}>unbeheizt</option>
|
||||
<option value={Enums.Heizungsstatus.BEHEIZT}>beheizt</option>
|
||||
|
||||
@@ -29,7 +29,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
bind:value={aufnahme.gebaeudeteil}
|
||||
required
|
||||
>
|
||||
<option disabled selected value={false}>Bitte auswählen</option>
|
||||
<option disabled selected>Bitte auswählen</option>
|
||||
<option value="Gesamtgebäude">Gesamtgebäude</option>
|
||||
<option value="Wohnen">Wohnen</option>
|
||||
</select>
|
||||
@@ -79,7 +79,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
required
|
||||
bind:value={aufnahme.lueftung}
|
||||
>
|
||||
<option disabled selected value={false}>Bitte auswählen</option>
|
||||
<option disabled selected>Bitte auswählen</option>
|
||||
<option value="Fensterlueftung">Fensterlüftung</option>
|
||||
<option value="Schachtlueftung">Schachtlüftung</option>
|
||||
<option value="LueftungsanlageOhneWaermerueckgewinnung"
|
||||
@@ -112,7 +112,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
required
|
||||
bind:value={aufnahme.kuehlung}
|
||||
>
|
||||
<option disabled selected value={false}>Bitte auswählen</option>
|
||||
<option disabled selected>Bitte auswählen</option>
|
||||
<option value="1">vorhanden</option>
|
||||
<option value="0">nicht vorhanden</option>
|
||||
</select>
|
||||
|
||||
@@ -223,7 +223,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
bind:value={aufnahme.brennstoff_1}
|
||||
required
|
||||
>
|
||||
<option disabled selected value={false}>Bitte auswählen</option>
|
||||
<option disabled selected>Bitte auswählen</option>
|
||||
{#each Object.keys(fuelMap) as fuel}
|
||||
<option value={fuel}>{fuel}</option>
|
||||
{/each}
|
||||
@@ -256,7 +256,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
disabled={!aufnahme.brennstoff_1}
|
||||
required
|
||||
>
|
||||
<option disabled selected value={false}>Bitte auswählen</option>
|
||||
<option disabled selected >Bitte auswählen</option>
|
||||
{#each fuelMap.hasOwnProperty(aufnahme.brennstoff_1) ? fuelMap[aufnahme.brennstoff_1] : [] as unit}
|
||||
<option value={unit}>{unit}</option>
|
||||
{/each}
|
||||
@@ -405,7 +405,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
bind:value={aufnahme.brennstoff_2}
|
||||
required
|
||||
>
|
||||
<option disabled selected value={false}
|
||||
<option disabled selected
|
||||
>Bitte auswählen</option
|
||||
>
|
||||
{#each Object.keys(fuelMap) as fuel}
|
||||
@@ -440,7 +440,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
disabled={!aufnahme.brennstoff_2}
|
||||
required
|
||||
>
|
||||
<option disabled selected value={false}
|
||||
<option disabled selected
|
||||
>Bitte auswählen</option
|
||||
>
|
||||
{#each fuelMap.hasOwnProperty(aufnahme.brennstoff_2) ? fuelMap[aufnahme.brennstoff_2] : [] as unit}
|
||||
|
||||
@@ -236,7 +236,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
bind:value={aufnahme.brennstoff_1}
|
||||
required
|
||||
>
|
||||
<option disabled selected value={false}>Bitte auswählen</option>
|
||||
<option disabled selected >Bitte auswählen</option>
|
||||
{#each Object.keys(fuelMap) as fuel}
|
||||
<option value={fuel}>{fuel}</option>
|
||||
{/each}
|
||||
@@ -276,7 +276,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
disabled={!aufnahme.brennstoff_1}
|
||||
required
|
||||
>
|
||||
<option disabled selected value={false}>Bitte auswählen</option>
|
||||
<option disabled selected >Bitte auswählen</option>
|
||||
{#each fuelMap.hasOwnProperty(aufnahme.brennstoff_1) ? fuelMap[aufnahme.brennstoff_1] : [] as unit}
|
||||
<option value={unit}>{unit}</option>
|
||||
{/each}
|
||||
@@ -431,7 +431,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
required
|
||||
data-cy="brennstoff_2"
|
||||
>
|
||||
<option disabled selected value={false}
|
||||
<option disabled selected
|
||||
>Bitte auswählen</option
|
||||
>
|
||||
{#each Object.keys(fuelMap) as fuel}
|
||||
@@ -474,7 +474,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
disabled={!aufnahme.brennstoff_2}
|
||||
required
|
||||
>
|
||||
<option disabled selected value={false}
|
||||
<option disabled selected
|
||||
>Bitte auswählen</option
|
||||
>
|
||||
{#each fuelMap.hasOwnProperty(aufnahme.brennstoff_2) ? fuelMap[aufnahme.brennstoff_2] : [] as unit}
|
||||
|
||||
@@ -17,7 +17,7 @@ import { z, ZodSchema } from "zod";
|
||||
|
||||
export type OmitKeys<T, K extends keyof T> = Omit<T, K>;
|
||||
|
||||
export type UploadedGebaeudeBild = OmitKeys<Bild, "id" | "objekt_id"> & {
|
||||
export type UploadedGebaeudeBild = OmitKeys<Bild, "id" | "aufnahme_id"> & {
|
||||
data: string
|
||||
}
|
||||
|
||||
@@ -148,6 +148,8 @@ export function getAusweisartFromUUID(uid: string): Enums.Ausweisart | null {
|
||||
return Enums.Ausweisart.BedarfsausweisGewerbe
|
||||
} else if (uid.startsWith("gnw")) {
|
||||
return Enums.Ausweisart.GEGNachweisWohnen
|
||||
} else if (uid.startsWith("gng")) {
|
||||
return Enums.Ausweisart.GEGNachweisGewerbe
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -4,13 +4,14 @@
|
||||
import HelpLabel from "#components/labels/HelpLabel.svelte";
|
||||
|
||||
export let kategorie: string = "";
|
||||
export let files: (UnterlageClient & { data: string | ArrayBuffer })[] = [];
|
||||
export let files: UnterlageClient[] = [];
|
||||
export let max: number = Infinity;
|
||||
export let min: number = 1;
|
||||
export let name: string = "";
|
||||
export let ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient | BedarfsausweisWohnenClient | GEGNachweisWohnenClient;
|
||||
export let objekt: ObjektClient;
|
||||
import mime from "mime-types";
|
||||
import { api } from "astro-typesafe-api/client";
|
||||
|
||||
|
||||
function getAllFiles(this: HTMLInputElement) {
|
||||
@@ -30,7 +31,7 @@
|
||||
|
||||
const reader = new FileReader();
|
||||
|
||||
reader.onload = () => {
|
||||
reader.onload = async () => {
|
||||
if (reader.readyState != reader.DONE) {
|
||||
return;
|
||||
}
|
||||
@@ -40,8 +41,15 @@
|
||||
}
|
||||
|
||||
const mimeType = mime.types[file.name.split(".").pop() as string]
|
||||
|
||||
const { uid } = await api.unterlage.PUT.fetch({
|
||||
data: reader.result as string,
|
||||
kategorie,
|
||||
mime: mimeType,
|
||||
name: file.name
|
||||
})
|
||||
|
||||
files.push({ data: reader.result, kategorie, name: file.name, mime: mimeType });
|
||||
files.push({ uid, kategorie, name: file.name, mime: mimeType });
|
||||
files = files;
|
||||
|
||||
|
||||
@@ -50,7 +58,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
reader.readAsArrayBuffer(file);
|
||||
reader.readAsDataURL(file);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
|
||||
<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}
|
||||
<button class="hover:bg-gray-100 cursor-pointer px-2 py-1 text-nowrap" tabindex="-1" on:click={() => {
|
||||
<button class="hover:bg-gray-100 cursor-pointer px-2 py-1 text-nowrap" type="button" tabindex="-1" on:click={() => {
|
||||
zip = zipCode.plz;
|
||||
city = zipCode.stadt;
|
||||
hideZipDropdown = true;
|
||||
|
||||
@@ -18,7 +18,9 @@ export enum VALID_UUID_PREFIXES {
|
||||
"inv" = "Rechnung",
|
||||
"tkt" = "Ticket",
|
||||
"pln" = "Gebäude Plan",
|
||||
"gnw" = "GEG Nachweis Wohnen"
|
||||
"gnw" = "GEG Nachweis Wohnen",
|
||||
"gng" = "GEG Nachweis Gewerbe",
|
||||
"gge" = "GEG Einpreisung",
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -510,23 +510,23 @@ export async function pdfVerbrauchsausweisGewerbe(ausweis: VerbrauchsausweisGewe
|
||||
// }
|
||||
// }
|
||||
|
||||
if (aufnahme.kuehlung) {
|
||||
/**
|
||||
* Kühlungszuschlag - Pauschale Erhöhung um 6kWh/m²
|
||||
* Primärenergiefaktor Strom
|
||||
* @link https://www.bundesanzeiger.de/pub/publication/MRYM4nI84Sdlr0EIvvW?2
|
||||
*/
|
||||
addVerbrauch(
|
||||
moment(ausweis.startdatum).format("MM.YYYY"),
|
||||
moment(ausweis.startdatum).add(3, "years").format("MM.YYYY"),
|
||||
"Kühlungszuschlag",
|
||||
berechnungen?.primaerfaktorww.toString(),
|
||||
Math.round(berechnungen?.kuehlungsZuschlag || 0).toString(),
|
||||
"0",
|
||||
"0",
|
||||
""
|
||||
);
|
||||
}
|
||||
// if (aufnahme.kuehlung) {
|
||||
// /**
|
||||
// * Kühlungszuschlag - Pauschale Erhöhung um 6kWh/m²
|
||||
// * Primärenergiefaktor Strom
|
||||
// * @link https://www.bundesanzeiger.de/pub/publication/MRYM4nI84Sdlr0EIvvW?2
|
||||
// */
|
||||
// addVerbrauch(
|
||||
// moment(ausweis.startdatum).format("MM.YYYY"),
|
||||
// moment(ausweis.startdatum).add(3, "years").format("MM.YYYY"),
|
||||
// "Kühlungszuschlag",
|
||||
// berechnungen?.primaerfaktorww.toString(),
|
||||
// Math.round(berechnungen?.kuehlungsZuschlag || 0).toString(),
|
||||
// "0",
|
||||
// "0",
|
||||
// ""
|
||||
// );
|
||||
// }
|
||||
|
||||
/* -------------------------------- Seite 4 -------------------------------- */
|
||||
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
AufnahmeClient,
|
||||
BenutzerClient,
|
||||
BildClient,
|
||||
getAusweisartFromUUID,
|
||||
ObjektClient,
|
||||
RechnungClient,
|
||||
UnterlageClient,
|
||||
VerbrauchsausweisWohnenClient,
|
||||
} from "#components/Ausweis/types.js";
|
||||
import { validateAccessTokenClient } from "src/client/lib/validateAccessToken.js";
|
||||
@@ -30,12 +30,14 @@
|
||||
import { ausweisSpeichern } from "#client/lib/ausweisSpeichern.js";
|
||||
import { addNotification } from "#components/Notifications/shared.js";
|
||||
import NotificationWrapper from "#components/Notifications/NotificationWrapper.svelte";
|
||||
import { nachweisSpeichern } from "#client/lib/nachweisSpeichern.js";
|
||||
|
||||
export let user: Partial<BenutzerClient>;
|
||||
export let ausweis: VerbrauchsausweisWohnenClient;
|
||||
export let aufnahme: AufnahmeClient;
|
||||
export let objekt: ObjektClient;
|
||||
export let bilder: BildClient[];
|
||||
export let unterlagen: UnterlageClient[];
|
||||
export let ausweisart: Enums.Ausweisart;
|
||||
export let aktiveBezahlmethode: Bezahlmethoden = Enums.Bezahlmethoden.paypal;
|
||||
export let ausweistyp: Enums.AusweisTyp = Enums.AusweisTyp.Standard;
|
||||
@@ -137,7 +139,68 @@
|
||||
}
|
||||
|
||||
async function anfordern() {
|
||||
// TODO Angebot anfordern
|
||||
if (!form.checkValidity()) {
|
||||
addNotification({
|
||||
dismissable: true,
|
||||
message: "Fehlende Daten.",
|
||||
subtext: "Nicht alle notwendigen Felder sind ausgefüllt, bitte füllen sie diese aus bevor sie es erneut versuchen.."
|
||||
})
|
||||
|
||||
form.reportValidity();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!await validateAccessTokenClient()) {
|
||||
loginAction = bestellen
|
||||
rechnung = rechnung
|
||||
loginOverlayHidden = false;
|
||||
return
|
||||
}
|
||||
|
||||
loginOverlayHidden = true
|
||||
|
||||
let result: Awaited<ReturnType<typeof ausweisSpeichern>> | null = null;
|
||||
if (ausweisart === Enums.Ausweisart.GEGNachweisWohnen) {
|
||||
result = await nachweisSpeichern(ausweis, objekt, aufnahme, bilder, unterlagen, ausweisart)
|
||||
} else {
|
||||
result = await ausweisSpeichern(ausweis, objekt, aufnahme, bilder, ausweisart)
|
||||
}
|
||||
|
||||
if (result === null) {
|
||||
addNotification({
|
||||
dismissable: true,
|
||||
message: "Ups... Das hat nicht geklappt.",
|
||||
subtext: "Der Nachweis konnte nicht gespeichert werden, bitte versuchen sie es erneut oder kontaktieren sie unseren Support."
|
||||
})
|
||||
}
|
||||
|
||||
try {
|
||||
const { uid } = await api.rechnung.anfordern.PUT.fetch(
|
||||
{
|
||||
email: rechnung.email,
|
||||
empfaenger: rechnung.empfaenger,
|
||||
strasse: rechnung.strasse,
|
||||
plz: rechnung.plz,
|
||||
ort: rechnung.ort,
|
||||
versand_empfaenger: rechnung.versand_empfaenger,
|
||||
versand_strasse: rechnung.versand_strasse,
|
||||
versand_plz: rechnung.versand_plz,
|
||||
versand_ort: rechnung.versand_ort,
|
||||
telefon: rechnung.telefon,
|
||||
nachweis_uid: ausweis.uid,
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
// Alle alten Ausweisdateien im localStorage löschen.
|
||||
localStorage.clear();
|
||||
|
||||
window.location.href = `/einpreisung/success?e=${uid}&a=${ausweis.uid}`;
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
async function bestellen() {
|
||||
@@ -161,7 +224,12 @@
|
||||
|
||||
loginOverlayHidden = true
|
||||
|
||||
const result = await ausweisSpeichern(ausweis, objekt, aufnahme, bilder, ausweisart)
|
||||
let result: Awaited<ReturnType<typeof ausweisSpeichern>> | null = null;
|
||||
if (ausweisart === Enums.Ausweisart.GEGNachweisWohnen) {
|
||||
result = await nachweisSpeichern(ausweis, objekt, aufnahme, bilder, unterlagen, ausweisart)
|
||||
} else {
|
||||
result = await ausweisSpeichern(ausweis, objekt, aufnahme, bilder, ausweisart)
|
||||
}
|
||||
|
||||
if (result === null) {
|
||||
addNotification({
|
||||
@@ -363,8 +431,14 @@ grid-cols-5 justify-around justify-items-center items-center"
|
||||
|
||||
<div class="ProduktKostenTabelle">
|
||||
<div class="zeile betrag">
|
||||
<div>Netto-Preis Energieausweis</div>
|
||||
<div>:</div>
|
||||
{#if ausweistyp === Enums.AusweisTyp.Standard}
|
||||
<span>Netto-Preis Energieausweis</span>
|
||||
{:else if ausweistyp === Enums.AusweisTyp.Beratung}
|
||||
<span>Energieausweis inkl. Beratung</span>
|
||||
{:else if ausweistyp === Enums.AusweisTyp.Offline}
|
||||
<span>Energieausweis Offline</span>
|
||||
{/if}
|
||||
<span>:</span>
|
||||
<div class="text-right">
|
||||
<b>{(price * 0.81).toFixed(2) + " €"}</b>
|
||||
</div>
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
import Ausweisart from "#components/Ausweis/Ausweisart.svelte";
|
||||
import GebaeudeDaten from "#components/Ausweis/GebaeudeDaten.svelte";
|
||||
import {
|
||||
VerbrauchsausweisWohnenClient,
|
||||
ObjektClient,
|
||||
AufnahmeClient,
|
||||
BenutzerClient,
|
||||
@@ -16,167 +15,17 @@
|
||||
import HelpLabel from "#components/labels/HelpLabel.svelte";
|
||||
import Progressbar from "#components/Ausweis/Progressbar.svelte";
|
||||
import FileGrid from "#components/FileGrid.svelte";
|
||||
import Hilfe from "#components/Ausweis/Hilfe.svelte";
|
||||
import Overlay from "#components/Overlay.svelte";
|
||||
import EmbeddedAuthFlowModule from "#modules/EmbeddedAuthFlowModule.svelte";
|
||||
import { validateAccessTokenClient } from "#client/lib/validateAccessToken.js";
|
||||
import { api } from "astro-typesafe-api/client";
|
||||
import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants.js";
|
||||
import { exclude } from "#lib/exclude.js";
|
||||
import Cookies from "js-cookie";
|
||||
import ButtonWeiterHilfe from "#components/Ausweis/ButtonWeiterHilfe.svelte";
|
||||
|
||||
export async function nachweisSpeichern(
|
||||
nachweis: GEGNachweisWohnenClient,
|
||||
objekt: ObjektClient,
|
||||
aufnahme: AufnahmeClient,
|
||||
unterlagen: (UnterlageClient & { data?: string })[]
|
||||
) {
|
||||
if (objekt.uid) {
|
||||
await api.objekt._uid.PATCH.fetch({
|
||||
...exclude(objekt, ["uid"])
|
||||
}, {
|
||||
params: {
|
||||
uid: objekt.uid
|
||||
},
|
||||
headers: {
|
||||
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
||||
}
|
||||
})
|
||||
} else {
|
||||
const { uid } = await api.objekt.PUT.fetch({
|
||||
...exclude(objekt, ["uid"])
|
||||
}, {
|
||||
headers: {
|
||||
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
||||
}
|
||||
})
|
||||
|
||||
objekt.uid = uid;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (aufnahme.uid) {
|
||||
await api.aufnahme._uid.PATCH.fetch({
|
||||
...exclude({...aufnahme, baujahr_klima: []}, ["uid"])
|
||||
}, {
|
||||
params: {
|
||||
uid: aufnahme.uid
|
||||
},
|
||||
headers: {
|
||||
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
||||
}
|
||||
})
|
||||
} else {
|
||||
const { uid } = await api.aufnahme.PUT.fetch({
|
||||
aufnahme: {...aufnahme, baujahr_klima: []},
|
||||
uid_objekt: objekt.uid
|
||||
}, {
|
||||
headers: {
|
||||
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
||||
}
|
||||
})
|
||||
|
||||
aufnahme.uid = uid
|
||||
}
|
||||
|
||||
if (nachweis.uid) {
|
||||
await api["geg-nachweis-wohnen"]._uid.PATCH.fetch({
|
||||
|
||||
...exclude(nachweis, ["uid"])
|
||||
}, {
|
||||
params: {
|
||||
uid: nachweis.uid
|
||||
},
|
||||
headers: {
|
||||
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
||||
}
|
||||
})
|
||||
} else {
|
||||
const { uid } = await api["geg-nachweis-wohnen"].PUT.fetch({
|
||||
nachweis: nachweis,
|
||||
uid_aufnahme: aufnahme.uid
|
||||
}, {
|
||||
headers: {
|
||||
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
||||
}
|
||||
})
|
||||
|
||||
nachweis.uid = uid;
|
||||
}
|
||||
|
||||
for (const unterlage of unterlagen) {
|
||||
if (unterlage.uid || !unterlage.data) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const response = await api.objekt._uid.unterlagen.PUT.fetch({
|
||||
data: unterlage.data,
|
||||
kategorie: unterlage.kategorie,
|
||||
mime: unterlage.mime,
|
||||
name: unterlage.name
|
||||
}, {
|
||||
params: {
|
||||
uid: objekt.uid
|
||||
},
|
||||
headers: {
|
||||
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
||||
}
|
||||
})
|
||||
|
||||
unterlage.uid = response.uid
|
||||
}
|
||||
|
||||
return {
|
||||
uid_ausweis: nachweis.uid,
|
||||
uid_aufnahme: aufnahme.uid,
|
||||
uid_objekt: objekt.uid
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
async function nachweisAbschicken() {
|
||||
if (!(await validateAccessTokenClient())) {
|
||||
loginOverlayHidden = false;
|
||||
return;
|
||||
}
|
||||
|
||||
const result = await nachweisSpeichern(nachweis, objekt, aufnahme, unterlagen)
|
||||
|
||||
if (result !== null) {
|
||||
window.history.pushState(
|
||||
{},
|
||||
"",
|
||||
`${location.pathname}?uid=${result.uid_ausweis}`
|
||||
);
|
||||
window.location.href = `/kundendaten?uid=${result.uid_ausweis}`;
|
||||
}
|
||||
|
||||
loginOverlayHidden = true;
|
||||
}
|
||||
|
||||
async function spaeterWeitermachen() {
|
||||
if (!(await validateAccessTokenClient())) {
|
||||
loginOverlayHidden = false;
|
||||
return;
|
||||
}
|
||||
|
||||
loginOverlayHidden = true;
|
||||
}
|
||||
|
||||
let loginOverlayHidden = true;
|
||||
|
||||
export let nachweis: GEGNachweisWohnenClient;
|
||||
export let objekt: ObjektClient;
|
||||
export let aufnahme: AufnahmeClient;
|
||||
export let user: BenutzerClient = {} as BenutzerClient;
|
||||
export let bilder: UploadedGebaeudeBild[] = [];
|
||||
export let plaene: (UnterlageClient & { data: string })[] =
|
||||
export let plaene: UnterlageClient[] =
|
||||
[];
|
||||
export let unterlagen: (UnterlageClient & {
|
||||
data: string;
|
||||
})[] = [];
|
||||
|
||||
export let unterlagen: UnterlageClient[] = [];
|
||||
|
||||
if (Object.keys(nachweis).length === 0) {
|
||||
const localStorageAusweis = localStorage.getItem("ausweis");
|
||||
@@ -199,17 +48,27 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (Object.keys(bilder).length === 0) {
|
||||
const localStorageBilder = localStorage.getItem("bilder");
|
||||
if (localStorageBilder) {
|
||||
bilder = JSON.parse(localStorageBilder)
|
||||
}
|
||||
}
|
||||
|
||||
if (Object.keys(unterlagen).length === 0) {
|
||||
const localStorageUnterlagen = localStorage.getItem("unterlagen");
|
||||
if (localStorageUnterlagen) {
|
||||
unterlagen = JSON.parse(localStorageUnterlagen)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$: {
|
||||
if (nachweis.uid && objekt.uid && aufnahme.uid) {
|
||||
localStorage.setItem(nachweis.uid, JSON.stringify(nachweis))
|
||||
localStorage.setItem(objekt.uid, JSON.stringify(objekt))
|
||||
localStorage.setItem(aufnahme.uid, JSON.stringify(aufnahme))
|
||||
} else {
|
||||
localStorage.setItem("ausweis", JSON.stringify(nachweis))
|
||||
localStorage.setItem("aufnahme", JSON.stringify(aufnahme))
|
||||
localStorage.setItem("objekt", JSON.stringify(objekt))
|
||||
}
|
||||
localStorage.setItem("ausweis", JSON.stringify(nachweis))
|
||||
localStorage.setItem("aufnahme", JSON.stringify(aufnahme))
|
||||
localStorage.setItem("objekt", JSON.stringify(objekt))
|
||||
localStorage.setItem("bilder", JSON.stringify(bilder))
|
||||
localStorage.setItem("unterlagen", JSON.stringify(unterlagen))
|
||||
}
|
||||
|
||||
const ausweisart = Enums.Ausweisart.GEGNachweisWohnen;
|
||||
@@ -234,7 +93,6 @@
|
||||
|
||||
<form
|
||||
id="formInput-1"
|
||||
on:submit={nachweisAbschicken}
|
||||
name="ausweis"
|
||||
data-test="ausweis"
|
||||
>
|
||||
@@ -332,31 +190,15 @@
|
||||
</Bereich>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="grid grid-cols-[1fr_min-content_min-content_min-content] grid-rows-[min_content_1fr] gap-x-2 self-start justify-self-end mt-8"
|
||||
<ButtonWeiterHilfe
|
||||
bind:ausweis={nachweis}
|
||||
bind:bilder
|
||||
bind:unterlagen
|
||||
bind:user
|
||||
bind:objekt
|
||||
bind:aufnahme
|
||||
ausweisart={Enums.Ausweisart.GEGNachweisWohnen}
|
||||
>
|
||||
<div></div>
|
||||
</ButtonWeiterHilfe>
|
||||
|
||||
<Hilfe />
|
||||
|
||||
<button class="button" type="button" on:click={spaeterWeitermachen}
|
||||
>Später Weitermachen
|
||||
</button>
|
||||
|
||||
<div>
|
||||
<Overlay bind:hidden={loginOverlayHidden}>
|
||||
<div class="bg-white w-full max-w-screen-sm py-8">
|
||||
<EmbeddedAuthFlowModule onLogin={nachweisAbschicken}
|
||||
></EmbeddedAuthFlowModule>
|
||||
</div>
|
||||
</Overlay>
|
||||
|
||||
<button
|
||||
on:click={nachweisAbschicken}
|
||||
type="button"
|
||||
class="button"
|
||||
data-cy="weiter">Weiter</button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -1,9 +1,67 @@
|
||||
import { defineApiRoute } from "astro-typesafe-api/server";
|
||||
|
||||
// TODO
|
||||
import { getAusweisartFromUUID, UUidWithPrefix } from "#components/Ausweis/types.js";
|
||||
import { omit } from "#lib/helpers.js";
|
||||
import { authorizationHeaders, authorizationMiddleware } from "#lib/middleware/authorization.js";
|
||||
import { Enums, GEGEinpreisungSchema, prisma } from "@ibcornelsen/database/server";
|
||||
import { APIError, defineApiRoute } from "astro-typesafe-api/server";
|
||||
import { z } from "zod";
|
||||
|
||||
export const PUT = defineApiRoute({
|
||||
async fetch(input, context, transfer) {
|
||||
|
||||
input: GEGEinpreisungSchema.omit({
|
||||
benutzer_id: true,
|
||||
id: true,
|
||||
uid: true,
|
||||
status: true,
|
||||
}).merge(z.object({
|
||||
nachweis_uid: UUidWithPrefix
|
||||
})),
|
||||
headers: authorizationHeaders,
|
||||
middleware: authorizationMiddleware,
|
||||
async fetch(input, context, user) {
|
||||
const ausweisart = getAusweisartFromUUID(input.nachweis_uid);
|
||||
|
||||
let einpreisung;
|
||||
if (ausweisart === Enums.Ausweisart.GEGNachweisWohnen) {
|
||||
const nachweis = await prisma.gEGNachweisWohnen.findUnique({
|
||||
where: {
|
||||
uid: input.nachweis_uid
|
||||
}
|
||||
})
|
||||
|
||||
if (!nachweis || nachweis.benutzer_id !== user.id) {
|
||||
throw new APIError({
|
||||
code: "BAD_REQUEST",
|
||||
message: "Ausweis existiert nicht oder gehört einem anderen Benutzer."
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
einpreisung = await prisma.gEGEinpreisung.create({
|
||||
data: {
|
||||
...omit(input, ["nachweis_uid"]),
|
||||
status: Enums.Einpreisungsstatus.open,
|
||||
benutzer: {
|
||||
connect: {
|
||||
id: user.id
|
||||
}
|
||||
},
|
||||
geg_nachweis_wohnen: {
|
||||
connect: {
|
||||
uid: input.nachweis_uid
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
throw new APIError({
|
||||
"code": "BAD_REQUEST",
|
||||
"message": `Ausweisart wird nicht unterstützt: ${ausweisart}`
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
return {
|
||||
uid: einpreisung.uid
|
||||
}
|
||||
},
|
||||
})
|
||||
@@ -16,7 +16,6 @@ export const PUT = defineApiRoute({
|
||||
output: z.object({
|
||||
uid: z.string({ description: "Die UID der Unterlage." })
|
||||
}),
|
||||
middleware: authorizationMiddleware,
|
||||
async fetch({ data, name, kategorie, mime }, ctx, user) {
|
||||
if (mime !== "application/pdf" && mime !== "image/png" && mime !== "image/jpeg") {
|
||||
throw new APIError({
|
||||
@@ -25,37 +24,20 @@ export const PUT = defineApiRoute({
|
||||
})
|
||||
}
|
||||
|
||||
let aufnahme = await prisma.aufnahme.findUnique({
|
||||
where: {
|
||||
uid: ctx.params.uid,
|
||||
benutzer_id: user.id
|
||||
},
|
||||
});
|
||||
|
||||
if (!aufnahme) {
|
||||
throw new APIError({
|
||||
code: "NOT_FOUND",
|
||||
message: "Objekt nicht gefunden oder gehört einem anderen Benutzer.",
|
||||
});
|
||||
}
|
||||
|
||||
const buffer = Buffer.from(data, "base64");
|
||||
|
||||
const unterlage = await prisma.unterlage.create({
|
||||
data: {
|
||||
kategorie: kategorie,
|
||||
aufnahme: {
|
||||
connect: {
|
||||
id: aufnahme.id,
|
||||
},
|
||||
},
|
||||
mime,
|
||||
name
|
||||
},
|
||||
select: {
|
||||
uid: true,
|
||||
},
|
||||
});
|
||||
|
||||
const filePath = fileURLToPath(new URL(`../../../../../persistent/unterlagen/${unterlage.uid}`, import.meta.url));
|
||||
const filePath = fileURLToPath(new URL(`../../../persistent/unterlagen/${unterlage.uid}`, import.meta.url));
|
||||
|
||||
try {
|
||||
writeFileSync(filePath, buffer)
|
||||
@@ -68,7 +50,7 @@ export const PUT = defineApiRoute({
|
||||
})
|
||||
// Und geben einen Fehler zurück
|
||||
throw new APIError({
|
||||
code: "INTERNAL_SERVER_ERROR",
|
||||
code: "UNPROCESSABLE_CONTENT",
|
||||
message: "Unterlage konnte nicht gespeichert werden.",
|
||||
});
|
||||
}
|
||||
31
src/pages/einpreisung/success.astro
Normal file
31
src/pages/einpreisung/success.astro
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
import Layout from "#layouts/Layout.astro";
|
||||
import { getPrismaAusweisAdapter } from "#lib/server/ausweis";
|
||||
import { getCurrentUser } from "#lib/server/user";
|
||||
import { prisma } from "@ibcornelsen/database/server";
|
||||
|
||||
const uidEinpreisung = Astro.url.searchParams.get("e");
|
||||
const uidAusweis = Astro.url.searchParams.get("a");
|
||||
const user = await getCurrentUser(Astro)
|
||||
|
||||
if (!uidEinpreisung || !uidAusweis || !user) {
|
||||
return Astro.redirect("/")
|
||||
}
|
||||
|
||||
const einpreisung = await prisma.gEGEinpreisung.findUnique({
|
||||
where: {
|
||||
uid: uidEinpreisung,
|
||||
benutzer: {
|
||||
uid: user.uid
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
if (!einpreisung) {
|
||||
return Astro.redirect("/")
|
||||
}
|
||||
---
|
||||
|
||||
<Layout title="GEG Anforderung erfolgreich">
|
||||
<h1>GEG Anforderung erfolgreich</h1>
|
||||
</Layout>
|
||||
Reference in New Issue
Block a user