Rechnungsdaten Updaten

This commit is contained in:
Moritz Utcke
2025-10-14 12:18:48 -04:00
parent 5f97e1f37e
commit 1ef0b5e15a
5 changed files with 44 additions and 3 deletions

View File

@@ -121,7 +121,7 @@
/>
</div>
<button class="button" type="submit">Registrieren</button>
<div class="flex-row justify-between" style="margin-top: 10px">
<div class="flex flex-row justify-between" style="margin-top: 10px">
<button on:click={() => navigate("login")}>Einloggen</button>
<a href="/auth/passwort-vergessen?r={window.location.href}">Passwort Vergessen?</a>
</div>

View File

@@ -34,7 +34,6 @@
import { endEnergieVerbrauchVerbrauchsausweisGewerbe_2016_Client } from "#lib/Berechnungen/VerbrauchsausweisGewerbe/VerbrauchsausweisGewerbe_2016_Client.js";
import { benutzerSpeichern } from "#client/lib/speichern.js";
import { benutzerLesen } from "#client/lib/lesen.js";
import { exclude } from "#lib/exclude.js";
export let user: Partial<BenutzerClient>;
export let impersonatedUser: Partial<BenutzerClient> | null = null;

View File

@@ -96,6 +96,21 @@ export const PATCH = defineApiRoute({
}
})
if (user.rolle !== Enums.BenutzerRolle.ADMIN) {
// Wir aktualisieren auch die Rechnungsdaten des Benutzers
await prisma.benutzer.update({
data: {
ort: input.ort,
plz: input.plz,
adresse: input.strasse,
telefon: input.telefon,
},
where: {
id: user.id
}
})
}
if (input.bezahlmethode === Enums.Bezahlmethoden.rechnung) {
return { id: rechnung.id }
}

View File

@@ -218,6 +218,21 @@ export const PUT = defineApiRoute({
return { id }
}
if (user.rolle !== Enums.BenutzerRolle.ADMIN) {
// Wir aktualisieren auch die Rechnungsdaten des Benutzers
await prisma.benutzer.update({
data: {
ort: input.ort,
plz: input.plz,
adresse: input.strasse,
telefon: input.telefon,
},
where: {
id: user.id
}
})
}
// Wir erstellen eine Mollie Payment Referenz.
const payment = await mollieClient.payments.create({
amount: {

View File

@@ -59,3 +59,15 @@ if (result.length > 0) {
---
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
</html>