Bestellen auf Rechnung
This commit is contained in:
2
build.sh
2
build.sh
@@ -39,7 +39,7 @@ bun link @ibcornelsen/database
|
||||
PERSISTENT_DIR="${HOME}/persistent/${APP_NAME}";
|
||||
mkdir -p $PERSISTENT_DIR;
|
||||
|
||||
# TODO: Wir legen hier die .env Datei an, die die SSL Zertifikate enthält.
|
||||
# Wir legen hier die .env Datei an, die die SSL Zertifikate enthält.
|
||||
rm -f ~/$APP_NAME/.env;
|
||||
touch ~/$APP_NAME/.env;
|
||||
echo "PRIVATE_KEY=$(cat /etc/letsencrypt/live/ibcornelsen.de/privkey.pem | base64 | tr -d '\n')" >> ~/$APP_NAME/.env;
|
||||
|
||||
@@ -5,10 +5,10 @@ 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"),
|
||||
"bilder/[uid]": await import("../src/pages/api/bilder/[uid].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/[uid]": await import("../src/pages/api/bedarfsausweis-wohnen/[uid].ts"),
|
||||
"bedarfsausweis-wohnen": await import("../src/pages/api/bedarfsausweis-wohnen/index.ts"),
|
||||
"objekt": await import("../src/pages/api/objekt/index.ts"),
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
ObjektClient,
|
||||
VerbrauchsausweisWohnenClient,
|
||||
} from "./types.js";
|
||||
import { addNotification } from "#components/Notifications/shared.js";
|
||||
|
||||
export let objekt: ObjektClient;
|
||||
export let aufnahme: AufnahmeClient;
|
||||
@@ -20,6 +19,7 @@
|
||||
// Wir dürfen bis zu 4.5 Jahre alte Klimafaktoren benutzen, also nehmen wir alle Monate seitdem und generieren daraus die Auswahl.
|
||||
// Allerdings müssen wir auch berücksichtigen, dass wir drei folgende Jahre brauchen, also
|
||||
// kann der Nutzer nur 36 + 18 Monate zurückgehen.
|
||||
|
||||
let availableDates: {
|
||||
year: number;
|
||||
month: number;
|
||||
@@ -62,8 +62,8 @@
|
||||
fuelMap[fuel[0]].push(fuel[1]);
|
||||
}
|
||||
|
||||
let month = ausweis.startdatum?.getMonth();
|
||||
let year = ausweis.startdatum?.getFullYear();
|
||||
let month = moment(ausweis.startdatum).month();
|
||||
let year = moment(ausweis.startdatum).year();
|
||||
|
||||
$: {
|
||||
if (typeof month === "number" && typeof year === "number") {
|
||||
|
||||
@@ -2,27 +2,31 @@
|
||||
import { endEnergieVerbrauchVerbrauchsausweis_2016 } from "#lib/Berechnungen/VerbrauchsausweisWohnen/VerbrauchsausweisWohnen_2016.js";
|
||||
import moment from "moment";
|
||||
import {
|
||||
AufnahmeClient,
|
||||
getAusweisartFromUUID,
|
||||
ObjektClient,
|
||||
UploadedGebaeudeBild,
|
||||
VerbrauchsausweisWohnenClient,
|
||||
} from "./Ausweis/types.js";
|
||||
import AusweisPruefenTooltip from "./AusweisPruefenTooltip.svelte";
|
||||
import { addNotification } from "./NotificationProvider/shared.js";
|
||||
import { CheckCircled, CrossCircled, Image } from "radix-svelte-icons";
|
||||
import ChevronDown from "radix-svelte-icons/src/lib/icons/ChevronDown.svelte";
|
||||
import { Event } from "@ibcornelsen/database/client";
|
||||
|
||||
|
||||
export let ausweis: VerbrauchsausweisWohnenClient;
|
||||
export let aufnahme: AufnahmeClient;
|
||||
export let objekt: ObjektClient;
|
||||
export let bilder: UploadedGebaeudeBild[]
|
||||
export let events: Event[]
|
||||
export let calculations: Awaited<
|
||||
ReturnType<typeof endEnergieVerbrauchVerbrauchsausweis_2016>
|
||||
>;
|
||||
|
||||
console.log(ausweis);
|
||||
|
||||
const aufnahme = ausweis.aufnahme
|
||||
|
||||
|
||||
const ausweisArt = "VA"; // TODO: Das ist ein Platzhalter, hier muss die Ausweisart aus dem Ausweisobjekt kommen
|
||||
|
||||
const images = ausweis.aufnahme.objekt.gebaeude_bilder;
|
||||
const ausweisArt = getAusweisartFromUUID(ausweis.uid) // TODO: Das ist ein Platzhalter, hier muss die Ausweisart aus dem Ausweisobjekt kommen
|
||||
|
||||
let verbrauchWWGesamt_1 = "";
|
||||
let verbrauchWWGesamt_2 = "";
|
||||
@@ -145,13 +149,13 @@
|
||||
) {
|
||||
if (aufnahme.solarsystem_warmwasser) {
|
||||
// Wenn Warmwasser enthalten und Anteil bekannt und Solarsystem
|
||||
verbrauchWWGesamt_1 = `${calculations?.energieVerbrauchGesamt_1} kWh x ${ausweis.anteil_warmwasser_1 / 100} x 0.6`;
|
||||
verbrauchWWGesamt_2 = `${calculations?.energieVerbrauchGesamt_2} kWh x ${ausweis.anteil_warmwasser_2 / 100} x 0.6`;
|
||||
verbrauchWWGesamt_1 = `${calculations?.energieVerbrauchGesamt_1} kWh x ${(ausweis.anteil_warmwasser_1 || 0) / 100} x 0.6`;
|
||||
verbrauchWWGesamt_2 = `${calculations?.energieVerbrauchGesamt_2} kWh x ${(ausweis.anteil_warmwasser_2 || 0) / 100} x 0.6`;
|
||||
solarsystemWarmwasser = "Solarsystem Warmwasser";
|
||||
} else {
|
||||
// Wenn Warmwasser enthalten und Anteil bekannt und **kein** Solarsystem
|
||||
verbrauchWWGesamt_1 = `${calculations?.energieVerbrauchGesamt_1} kWh x ${ausweis.anteil_warmwasser_1 / 100} x 0.6`
|
||||
verbrauchWWGesamt_2 = `${calculations?.energieVerbrauchGesamt_2} kWh x ${ausweis.anteil_warmwasser_2 / 100} x 0.6`
|
||||
verbrauchWWGesamt_1 = `${calculations?.energieVerbrauchGesamt_1} kWh x ${(ausweis.anteil_warmwasser_1 || 0) / 100} x 0.6`
|
||||
verbrauchWWGesamt_2 = `${calculations?.energieVerbrauchGesamt_2} kWh x ${(ausweis.anteil_warmwasser_2 || 0) / 100} x 0.6`
|
||||
solarsystemWarmwasser = "kein Solarsystem Warmwasser";
|
||||
}
|
||||
} else {
|
||||
@@ -674,13 +678,13 @@
|
||||
<button class="btn btn-square" on:click={() => bilderModal.showModal()}><Image size={22}></Image></button>
|
||||
<dialog bind:this={bilderModal} class="modal">
|
||||
<div class="modal-box flex flex-row gap-4 items-center justify-center">
|
||||
{#if images.length === 0}
|
||||
{#if bilder.length === 0}
|
||||
<div class="flex flex-col gap-4 items-center justify-center">
|
||||
<p>Für diesen Ausweis sind noch keine Bilder vorhanden.</p>
|
||||
<button class="btn btn-primary" tabindex="0">Erinnerung Verschicken</button>
|
||||
</div>
|
||||
{:else}
|
||||
{#each images as image}
|
||||
{#each bilder as image}
|
||||
<div>
|
||||
<h2 class="text-lg mb-4 font-bold">{image.kategorie}</h2>
|
||||
<img src="/bilder/{image.uid}.webp">
|
||||
@@ -837,7 +841,7 @@
|
||||
</div>
|
||||
<hr/>
|
||||
</li>
|
||||
{#each ausweis.aufnahme.events as event, i}
|
||||
{#each events as event, i}
|
||||
<li>
|
||||
<hr />
|
||||
<div class="timeline-middle">
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
<script lang="ts">
|
||||
|
||||
</script>
|
||||
|
||||
<div class="dropdown dropdown-hover dropdown-bottom">
|
||||
<div role="button" tabindex="0">
|
||||
<slot></slot>
|
||||
|
||||
@@ -15,20 +15,12 @@ if (!valid) {
|
||||
Astro.redirect("/auth/login", 302)
|
||||
}
|
||||
|
||||
|
||||
const caller = createCaller(Astro)
|
||||
|
||||
const benutzer = (await caller.user.self.GET.fetch(undefined, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}`
|
||||
}
|
||||
})) || {} as BenutzerClient;
|
||||
|
||||
export interface Props {
|
||||
title: string;
|
||||
user: BenutzerClient
|
||||
}
|
||||
|
||||
const { title } = Astro.props;
|
||||
const { title, user } = Astro.props;
|
||||
|
||||
const schema = JSON.stringify({
|
||||
"@context": "http://schema.org",
|
||||
@@ -107,7 +99,7 @@ let lightTheme = Astro.cookies.get("theme")?.value === "light";
|
||||
</head>
|
||||
|
||||
<body class="min-h-screen grid md:grid-cols-[300px_1fr]">
|
||||
<DashboardSidebar lightTheme={lightTheme} {benutzer} client:load></DashboardSidebar>
|
||||
<DashboardSidebar lightTheme={lightTheme} benutzer={user} client:load></DashboardSidebar>
|
||||
<main class="p-4 md:p-8 overflow-auto h-screen bg-base-100 pt-20 md:!pt-24">
|
||||
<slot />
|
||||
</main>
|
||||
|
||||
@@ -1,18 +1,31 @@
|
||||
<script lang="ts">
|
||||
import {
|
||||
AufnahmeClient,
|
||||
ObjektClient,
|
||||
UploadedGebaeudeBild,
|
||||
VerbrauchsausweisWohnenClient,
|
||||
} from "#components/Ausweis/types";
|
||||
} from "#components/Ausweis/types.js";
|
||||
import AusweisPruefenBox from "#components/AusweisPruefenBox.svelte";
|
||||
import NotificationProvider from "#components/NotificationProvider/NotificationProvider.svelte";
|
||||
import { endEnergieVerbrauchVerbrauchsausweis_2016 } from "#lib/Berechnungen/VerbrauchsausweisWohnen/VerbrauchsausweisWohnen_2016";
|
||||
import { endEnergieVerbrauchVerbrauchsausweis_2016 } from "#lib/Berechnungen/VerbrauchsausweisWohnen/VerbrauchsausweisWohnen_2016.js";
|
||||
import AusweisPruefenNotification from "#components/AusweisPruefenNotification.svelte";
|
||||
import { Event } from "@ibcornelsen/database/client";
|
||||
|
||||
export let ausweise: VerbrauchsausweisWohnenClient[];
|
||||
export let ausweise: {
|
||||
ausweis: VerbrauchsausweisWohnenClient,
|
||||
aufnahme: AufnahmeClient,
|
||||
objekt: ObjektClient,
|
||||
bilder: UploadedGebaeudeBild[],
|
||||
events: Event[]
|
||||
}[];
|
||||
|
||||
console.log(ausweise);
|
||||
|
||||
</script>
|
||||
|
||||
<div class="gap-4 flex flex-col">
|
||||
{#each ausweise as ausweis}
|
||||
{#await endEnergieVerbrauchVerbrauchsausweis_2016(ausweis)}
|
||||
{#each ausweise as { ausweis, objekt, aufnahme, bilder, events }}
|
||||
{#await endEnergieVerbrauchVerbrauchsausweis_2016(ausweis, aufnahme, objekt)}
|
||||
<div class="rounded-lg border w-full h-20 p-2.5 gap-4 flex flex-row items-center">
|
||||
<div class="w-1/12 h-full flex flex-col gap-2">
|
||||
<div class="skeleton w-8 h-8 rounded-full"></div>
|
||||
@@ -85,7 +98,7 @@
|
||||
<div class="skeleton w-4 h-4"></div>
|
||||
</div>
|
||||
{:then calculations}
|
||||
<AusweisPruefenBox {ausweis} {calculations}></AusweisPruefenBox>
|
||||
<AusweisPruefenBox {ausweis} {aufnahme} {objekt} {bilder} {events} {calculations}></AusweisPruefenBox>
|
||||
{/await}
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
import { BenutzerClient, VerbrauchsausweisWohnenClient } from "#components/Ausweis/types.js";
|
||||
import { PRICES } from "#lib/constants.js";
|
||||
import { RechnungClient } from "#components/Ausweis/types.js";
|
||||
import { api } from "astro-typesafe-api/client";
|
||||
|
||||
export let user: BenutzerClient;
|
||||
export let ausweis:
|
||||
@@ -62,17 +63,21 @@
|
||||
e.preventDefault();
|
||||
|
||||
// TODO
|
||||
const response = await client.v1.rechnungen.erstellen.mutate({
|
||||
const response = await api.rechnung.PUT.fetch({
|
||||
...rechnung,
|
||||
ausweisart: Enums.Ausweisart.VerbrauchsausweisWohnen,
|
||||
uid: ausweis.uid,
|
||||
ausweis_uid: ausweis.uid,
|
||||
bezahlmethode: selectedPaymentType,
|
||||
services: services
|
||||
.filter((service) => service.selected)
|
||||
.map((service) => service.id),
|
||||
});
|
||||
|
||||
window.location.href = response.checkout_url;
|
||||
if (selectedPaymentType === Enums.Bezahlmethoden.rechnung) {
|
||||
window.location.href = `/payment/success?uid=${response.uid}`
|
||||
} else {
|
||||
window.location.href = response.checkout_url as string;
|
||||
}
|
||||
}
|
||||
|
||||
const priceTotal = services.reduce((acc, service) => {
|
||||
|
||||
@@ -5,9 +5,6 @@
|
||||
import Ansprechpartner from "#components/Ausweis/Ansprechpartner.svelte";
|
||||
import Rechnungsadresse from "#components/Ausweis/Rechnungsadresse.svelte";
|
||||
import Bezahlung from "#components/Ausweis/Bezahlung.svelte";
|
||||
|
||||
import Pruefung from "#components/Ausweis/Pruefung.svelte";
|
||||
|
||||
import type { Bezahlmethoden } from "@ibcornelsen/database/client";
|
||||
import { Enums } from "@ibcornelsen/database/client";
|
||||
import { dialogs } from "svelte-dialogs";
|
||||
@@ -24,8 +21,7 @@
|
||||
} from "#components/Ausweis/types.js";
|
||||
import { validateAccessTokenClient } from "src/client/lib/validateAccessToken.js";
|
||||
import { api } from "astro-typesafe-api/client";
|
||||
import A10WaermequellenAnlagentechnikTrinkwarmwasser from "#components/Tabellen/A10WaermequellenAnlagentechnikTrinkwarmwasser.svelte";
|
||||
|
||||
|
||||
export let user: BenutzerClient;
|
||||
export let ausweis: VerbrauchsausweisWohnenClient;
|
||||
export let aufnahme: AufnahmeClient;
|
||||
@@ -143,11 +139,13 @@
|
||||
Authorization: `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
||||
}
|
||||
})
|
||||
|
||||
window.location.href = checkout_url;
|
||||
} catch(e) {
|
||||
console.log(e);
|
||||
|
||||
if (bezahlmethode === Enums.Bezahlmethoden.rechnung) {
|
||||
window.location.href = `/payment/success?uid=${uid}`
|
||||
} else {
|
||||
window.location.href = checkout_url as string;
|
||||
}
|
||||
} catch(e) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,7 +285,7 @@
|
||||
|
||||
<button class="button">Speichern</button>
|
||||
|
||||
<button class="button" data-cy="bestellen" on:click={bestellen} disabled={bestellenNichtMoeglich}>Kostenpflichtig bestellen</button>
|
||||
<button class="button cursor-pointer" data-cy="bestellen" on:click={bestellen} >Kostenpflichtig bestellen</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
13
src/modules/PaymentSuccessModule.svelte
Normal file
13
src/modules/PaymentSuccessModule.svelte
Normal file
@@ -0,0 +1,13 @@
|
||||
<script lang="ts">
|
||||
import { RechnungClient } from "#components/Ausweis/types.js";
|
||||
import { Enums } from "@ibcornelsen/database/client";
|
||||
|
||||
export let rechnung: RechnungClient;
|
||||
</script>
|
||||
|
||||
<h1>Bestellbestätigung</h1>
|
||||
|
||||
{#if rechnung.bezahlmethode === Enums.Bezahlmethoden.rechnung}
|
||||
<p>Vielen Dank für Ihre Bestellung. Wir haben Ihnen soeben eine E-Mail zugeschickt. Eine Rechnung bekommen Sie nach Abschluss der Dienstleistung zugeschickt.</p>
|
||||
<p>Sie haben Rechnungszahlung ausgewählt. Wir haben Ihnen in der E-Mail unsere Bankverbindung zur Überweisung des Betrages aufgeführt. Bitte denken Sie daran die Belegnummer wie aufgeführt anzugeben. Alle anderen Zahloptionen stehen Ihnen auch zur Verfügung.</p>
|
||||
{/if}
|
||||
@@ -37,7 +37,7 @@ export const PUT = defineApiRoute({
|
||||
})
|
||||
),
|
||||
output: z.object({
|
||||
checkout_url: z.string(),
|
||||
checkout_url: z.string().optional(),
|
||||
uid: UUidWithPrefix,
|
||||
}),
|
||||
headers: authorizationHeaders,
|
||||
@@ -113,6 +113,10 @@ export const PUT = defineApiRoute({
|
||||
});
|
||||
}
|
||||
|
||||
if (bezahlmethode === Enums.Bezahlmethoden.rechnung) {
|
||||
return { uid: rechnung.uid }
|
||||
}
|
||||
|
||||
// Wir erstellen eine Mollie Payment Referenz.
|
||||
const payment = await mollieClient.payments.create({
|
||||
amount: {
|
||||
|
||||
@@ -1,31 +1,54 @@
|
||||
import { createCaller } from "#lib/caller";
|
||||
import { APIRoute } from "astro";
|
||||
import { validate } from "uuid";
|
||||
|
||||
export const get: APIRoute = async ({params, cookies}) => {
|
||||
const { uid } = params;
|
||||
import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants.js";
|
||||
import { validateAccessTokenServer } from "#server/lib/validateAccessToken.js";
|
||||
import { prisma } from "@ibcornelsen/database/server";
|
||||
import { APIError, defineApiRoute } from "astro-typesafe-api/server";
|
||||
import { fileURLToPath } from "bun";
|
||||
import * as fs from "fs";
|
||||
|
||||
if (!uid) {
|
||||
return new Response("No uid provided", { status: 400 });
|
||||
}
|
||||
export const GET = defineApiRoute({
|
||||
async fetch(input, context, transfer) {
|
||||
const { uid } = context.params
|
||||
const token = context.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value;
|
||||
|
||||
if (!validate(uid)) {
|
||||
return new Response("Invalid uid", { status: 400 });
|
||||
}
|
||||
if (!token) {
|
||||
throw new APIError({
|
||||
code: "BAD_REQUEST",
|
||||
message: "Invalid access token"
|
||||
})
|
||||
}
|
||||
|
||||
const caller = createCaller({ cookies })
|
||||
const valid = validateAccessTokenServer(context);
|
||||
|
||||
const image = await caller.v1.bilder.getBase64({ uid })
|
||||
if (!valid) {
|
||||
throw new APIError({
|
||||
code: "BAD_REQUEST",
|
||||
message: "Invalid access token"
|
||||
})
|
||||
}
|
||||
|
||||
if (!image) {
|
||||
return new Response("No image found", { status: 404 });
|
||||
}
|
||||
const image = await prisma.gebaeudeBilder.findUnique({
|
||||
where: {
|
||||
uid
|
||||
}
|
||||
})
|
||||
|
||||
const buffer = Buffer.from(image.base64, "base64");
|
||||
if (!image) {
|
||||
throw new APIError({
|
||||
code: "NOT_FOUND",
|
||||
message: "Image could not be found."
|
||||
})
|
||||
}
|
||||
|
||||
return new Response(buffer, {
|
||||
headers: {
|
||||
"Content-Type": "image/webp"
|
||||
}
|
||||
});
|
||||
}
|
||||
const path = fileURLToPath(new URL(`../../../../../persistent/images/${image.uid}.webp`, import.meta.url))
|
||||
const base64 = fs.readFileSync(path, "base64")
|
||||
|
||||
const buffer = Buffer.from(base64, "base64");
|
||||
|
||||
return new Response(buffer, {
|
||||
headers: {
|
||||
"Content-Type": "image/webp"
|
||||
}
|
||||
});
|
||||
},
|
||||
})
|
||||
59
src/pages/dashboard/ausweise-pruefen.astro
Normal file
59
src/pages/dashboard/ausweise-pruefen.astro
Normal file
@@ -0,0 +1,59 @@
|
||||
---
|
||||
import { AufnahmeClient, BenutzerClient, ObjektClient, UploadedGebaeudeBild, VerbrauchsausweisWohnenClient } from "#components/Ausweis/types";
|
||||
import UserLayout from "#layouts/UserLayout.astro";
|
||||
import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants";
|
||||
import DashboardAusweisePruefenModule from "#modules/Dashboard/DashboardAusweisePruefenModule.svelte";
|
||||
import { prisma } from "@ibcornelsen/database/server";
|
||||
import { createCaller } from "src/astro-typesafe-api-caller";
|
||||
|
||||
const caller = createCaller(Astro)
|
||||
|
||||
|
||||
let user: BenutzerClient;
|
||||
try {
|
||||
user = (await caller.user.self.GET.fetch(undefined, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}`
|
||||
}
|
||||
})) || {} as BenutzerClient;
|
||||
} catch(e) {
|
||||
return Astro.redirect("/auth/login")
|
||||
}
|
||||
|
||||
const ausweise = await prisma.verbrauchsausweisWohnen.findMany({
|
||||
where: {
|
||||
benutzer: {
|
||||
uid: user.uid
|
||||
}
|
||||
},
|
||||
include: {
|
||||
aufnahme: {
|
||||
include: {
|
||||
objekt: {
|
||||
include: {
|
||||
gebaeude_bilder: true,
|
||||
}
|
||||
},
|
||||
events: true
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
function omit(key: string, obj: Record<string, any>) {
|
||||
const { [key]: omitted, ...rest } = obj;
|
||||
return rest;
|
||||
}
|
||||
|
||||
const reformedAusweise = ausweise.map(ausweis => ({
|
||||
ausweis: omit("aufnahme", ausweis) as VerbrauchsausweisWohnenClient,
|
||||
aufnahme: omit("objekt", omit("events", ausweis.aufnahme)) as AufnahmeClient,
|
||||
objekt: omit("gebaeude_bilder", ausweis.aufnahme.objekt) as ObjektClient,
|
||||
bilder: ausweis.aufnahme.objekt.gebaeude_bilder as unknown as UploadedGebaeudeBild[],
|
||||
events: ausweis.aufnahme.events
|
||||
}))
|
||||
---
|
||||
|
||||
<UserLayout title="Ausweise Prüfen" {user}>
|
||||
<DashboardAusweisePruefenModule ausweise={reformedAusweise} client:load></DashboardAusweisePruefenModule>
|
||||
</UserLayout>
|
||||
@@ -25,6 +25,6 @@ const gebaeudeArray = await caller.objekt.GET.fetch({ limit: 5 }, {
|
||||
});
|
||||
---
|
||||
|
||||
<UserLayout title="Dashboard">
|
||||
<UserLayout title="Dashboard" {user}>
|
||||
<DashboardModule user={user} gebaeudeArray={gebaeudeArray} />
|
||||
</UserLayout>
|
||||
@@ -88,6 +88,6 @@ if (!ausweis || !user) {
|
||||
---
|
||||
|
||||
<AusweisLayout title="Kundendaten Aufnehmen - IBCornelsen">
|
||||
<KundendatenModule {user} {ausweis} {objekt} {aufnahme} {ausweisart} selectedPaymentType={Enums.Bezahlmethoden.paypal} client:load></KundendatenModule>
|
||||
<KundendatenModule {user} {ausweis} {objekt} {aufnahme} {ausweisart} bezahlmethode={Enums.Bezahlmethoden.paypal} client:load></KundendatenModule>
|
||||
</AusweisLayout>
|
||||
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
---
|
||||
|
||||
import { prisma } from "@ibcornelsen/database/server";
|
||||
import { Enums, prisma } from "@ibcornelsen/database/server";
|
||||
import Layout from "../../layouts/Layout.astro";
|
||||
import { createCaller } from "../../astro-typesafe-api-caller.js";
|
||||
import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants";
|
||||
import PaymentSuccessModule from "#modules/PaymentSuccessModule.svelte";
|
||||
|
||||
const uid = Astro.url.searchParams.get("uid");
|
||||
|
||||
const { uid } = Astro.params;
|
||||
|
||||
const caller = createCaller(Astro)
|
||||
|
||||
|
||||
const user = await caller.user.self.GET.fetch(undefined, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}`
|
||||
@@ -23,7 +24,9 @@ if (!uid || !user) {
|
||||
const rechnung = await prisma.rechnung.findUnique({
|
||||
where: {
|
||||
uid: uid,
|
||||
benutzer_id: user.id
|
||||
benutzer: {
|
||||
uid: user.uid
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -33,7 +36,7 @@ if (!rechnung) {
|
||||
|
||||
---
|
||||
|
||||
|
||||
<Layout title="Zahlung Erfolgreich - IBCornelsen">
|
||||
Supa! Hat geklappt ne!
|
||||
{rechnung.uid}
|
||||
<PaymentSuccessModule {rechnung}></PaymentSuccessModule>
|
||||
</Layout>
|
||||
Reference in New Issue
Block a user