Funktionalität anfänglich überprüft.

This commit is contained in:
Moritz Utcke
2024-12-20 09:17:23 +07:00
parent 019d1996a5
commit 9b384c4d4d
15 changed files with 955 additions and 511 deletions

View File

@@ -1,11 +1,16 @@
<script lang="ts">
import ProgressBar from "#components/Ausweis/Progressbar.svelte";
import type {
Bezahlmethoden,
} from "@ibcornelsen/database/client";
import type { Bezahlmethoden } from "@ibcornelsen/database/client";
import { Enums } from "@ibcornelsen/database/client";
import { dialogs } from "svelte-dialogs";
import LoginDialog from "#components/LoginDialog.svelte";
import LoginDialog from "#components/LoginDialog.svelte";
import { PRICES } from "#lib/constants.js";
import {
BenutzerClient,
VerbrauchsausweisWohnenClient,
} from "#components/Ausweis/types.js";
import { validateAccessTokenClient } from "src/client/lib/validateAccessToken.js";
import { client } from "src/trpc.js";
export let user: BenutzerClient;
export let ausweis: VerbrauchsausweisWohnenClient;
@@ -40,16 +45,11 @@ import LoginDialog from "#components/LoginDialog.svelte";
export let selectedPaymentType: Bezahlmethoden =
Enums.Bezahlmethoden.paypal;
import { PRICES } from "#lib/constants";
import { BenutzerClient, VerbrauchsausweisWohnenClient } from "#components/Ausweis/types";
import { validateAccessTokenClient } from "src/client/lib/validateAccessToken";
import { client } from "src/trpc";
let prices: number[] = [];
let prices: number[] = []
if (ausweis.gebaeude_aufnahme_allgemein.ausweisart) {
prices = PRICES[ausweis.gebaeude_aufnahme_allgemein.ausweisart]
}
if (ausweis.gebaeude_aufnahme_allgemein.ausweisart) {
prices = PRICES[ausweis.gebaeude_aufnahme_allgemein.ausweisart];
}
let basePrice: number = prices[0];
@@ -61,7 +61,7 @@ import LoginDialog from "#components/LoginDialog.svelte";
);
async function speichern(e: SubmitEvent) {
e.preventDefault()
e.preventDefault();
// Um einen Ausweis zu speichern müssen wir eingeloggt sein, andernfalls wird die API den call ablehnen.
// Wir prüfen also ob wir eingeloggt sind und leiten den Nutzer ggf. auf die Login Seite weiter.
@@ -76,13 +76,11 @@ import LoginDialog from "#components/LoginDialog.svelte";
// Falls der Ausweis noch keine benutzer_id hat müssen wir ihn claimen, damit er dem jetzigen Nutzer zugewiesen wird...
await client.v1.verbrauchsausweisWohnen.claim.mutate({
uid: ausweis.uid
})
uid: ausweis.uid,
});
window.location.href = `/kaufabschluss?uid=${ausweis.uid}`;
}
</script>
<div class="w-full px-8">
@@ -95,7 +93,9 @@ import LoginDialog from "#components/LoginDialog.svelte";
<form on:submit={speichern}>
<div class="grid grid-cols-[1.5fr_2fr] gap-4">
<div class="rounded-lg border p-4 border-base-300 bg-base-100 flex flex-col gap-4">
<div
class="rounded-lg border p-4 border-base-300 bg-base-100 flex flex-col gap-4"
>
<div class="flex flex-col gap-2 test-box">
<strong>A - Prüfung der Ausweisart</strong>
<div>
@@ -160,15 +160,13 @@ import LoginDialog from "#components/LoginDialog.svelte";
</div>
</div>
<div>
<div class="rounded-lg border p-4 border-base-300 bg-base-100 flex flex-col">
<div
class="rounded-lg border p-4 border-base-300 bg-base-100 flex flex-col"
>
<table>
<tr>
<td><strong>Produkt:</strong></td>
<td
><div class="py-2">
Verbrauchsausweis
</div></td
>
<td><div class="py-2">Verbrauchsausweis</div></td>
</tr>
<tr>
<td><strong>Beschreibung:</strong></td>
@@ -196,7 +194,7 @@ import LoginDialog from "#components/LoginDialog.svelte";
</div></td
>
</tr>
<hr>
<hr />
<tr>
<td>Preis inkl. MwSt.</td>
<td
@@ -207,13 +205,17 @@ import LoginDialog from "#components/LoginDialog.svelte";
</tr>
</table>
</div>
<h3 class="font-semibold mt-8">Hiermit bestelle ich folgende Version des Energieausweises:</h3>
<div class="rounded-lg border p-4 border-base-300 bg-base-100 flex flex-col">
<h3 class="font-semibold mt-8">
Hiermit bestelle ich folgende Version des Energieausweises:
</h3>
<div
class="rounded-lg border p-4 border-base-300 bg-base-100 flex flex-col"
>
<table>
<tr>
<td
>Verbrauchsausweis online für {prices[0]} € inkl. MwSt.
als PDF per E-Mail</td
>Verbrauchsausweis online für {prices[0]} € inkl.
MwSt. als PDF per E-Mail</td
>
<td
><input
@@ -242,8 +244,8 @@ import LoginDialog from "#components/LoginDialog.svelte";
</td>
</tr><tr>
<td
>Verbrauchsausweis offline für {prices[2]} € inkl. MwSt.
als PDF per E-Mail (Sie schicken uns 3 Verbrauchsabrechnungen)</td
>Verbrauchsausweis offline für {prices[2]} € inkl.
MwSt. als PDF per E-Mail (Sie schicken uns 3 Verbrauchsabrechnungen)</td
>
<td
><input
@@ -257,9 +259,11 @@ import LoginDialog from "#components/LoginDialog.svelte";
</tr>
</table>
</div>
<h3 class="font-semibold mt-8">Zusatzleistungen</h3>
<div class="rounded-lg border p-4 border-base-300 bg-base-100 flex flex-col">
<div
class="rounded-lg border p-4 border-base-300 bg-base-100 flex flex-col"
>
<table>
{#each services as service}
<tr>
@@ -276,7 +280,6 @@ import LoginDialog from "#components/LoginDialog.svelte";
</table>
</div>
</div>
</div>
<div class="flex flex-row justify-between">
<!-- TODO: Zurück implementieren -->
@@ -284,7 +287,8 @@ import LoginDialog from "#components/LoginDialog.svelte";
<div class="flex flex-row gap-4">
<!-- TODO: Speichern implementieren -->
<button class="btn btn-secondary mt-4">Speichern</button>
<button class="btn btn-secondary mt-4">Zum Kaufabschluss</button>
<button class="btn btn-secondary mt-4">Zum Kaufabschluss</button
>
</div>
</div>
</form>