Rechnungsdaten Updaten
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 }
|
||||
}
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -58,4 +58,16 @@ 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>
|
||||
Reference in New Issue
Block a user