Merge pull request #427 from IBCornelsen/main

get main
This commit is contained in:
Jens Cornelsen
2025-03-07 15:38:42 +01:00
committed by GitHub
8 changed files with 93 additions and 14 deletions

View File

@@ -18,6 +18,7 @@
export let aufnahme: AufnahmeClient;
export let ausweisart: Enums.Ausweisart
export let form: HTMLFormElement;
export let skala: HTMLDivElement;
export let showWeiter: boolean = true;
@@ -25,9 +26,26 @@
async function ausweisAbschicken() {
if (!form.checkValidity()) {
form.reportValidity()
return
}
// Entferne die Klasse "2xl:mt-[370px]" falls vorhanden
document.getElementById("formInput-1")?.classList.remove("2xl:mt-[370px]");
// Verhindere das Scrollen (falls erforderlich)
skala.classList.add("no-scroll");
// Zeige die Validierungsmeldungen
form.reportValidity();
// Finde das erste ungültige Feld und scrolle sanft darauf
let firstInvalidField = form.querySelector(":invalid");
if (firstInvalidField) {
let offset = 150; // Abstand für bessere Sichtbarkeit
let fieldPosition = firstInvalidField.getBoundingClientRect().top + window.scrollY;
window.scrollTo({ top: fieldPosition - offset, behavior: "smooth" });
}
return;
}
openWindowWithPost("/kundendaten", {
ausweis,

View File

@@ -31,6 +31,7 @@
<div class="text-base-content font-semibold text-left flex"
>{benutzer.vorname} {benutzer.name}</div>
<div class="text-base-content text-sm flex">{benutzer.email}</div>
<a href="/auth/logout" class="text-xs">Logout</a>
</div>
</div>

View File

@@ -22,6 +22,20 @@ const { title } = Astro.props;
const skala = document.getElementById("skala");
if (skala?.classList.contains("no-scroll")) {
if (skala) {
skala.classList.remove(
"2xl:fixed",
"2xl:py-4",
"2xl:top-0",
"2xl:z-20"
);
skala.classList.add("w-full");
skala.style.borderBottom = "none";
}
document
.getElementById("formInput-1")
?.classList.remove("2xl:mt-[370px]");
return;
}

View File

@@ -5,15 +5,21 @@ import {
Enums,
Rechnung,
VerbrauchsausweisWohnen,
} from "#lib/client/prisma";
import { prisma } from "#lib/server/prisma";
} from "#lib/client/prisma.js";
import { prisma } from "#lib/server/prisma.js";
import { getAnsichtsausweis } from "../ausweis.js";
import Sqids from "sqids";
export async function sendPaymentSuccessMail(
ausweis: VerbrauchsausweisWohnen,
rechnung: Rechnung,
user: Benutzer
) {
const sqids = new Sqids({
alphabet: "0123456789abcdefghijklmnopqrstuvw",
minLength: 8
})
const aufnahme = await prisma.aufnahme.findUnique({
where: {
id: ausweis.aufnahme_id,
@@ -64,7 +70,7 @@ export async function sendPaymentSuccessMail(
attachments,
from: `"IBCornelsen" <info@online-energieausweis.org>`,
to: user.email,
subject: `Bestellbestätigung vom IBCornelsen (ID: ${ausweis.uid})`,
subject: `Bestellbestätigung vom IBCornelsen (ID: ${sqids.encode([ausweis.id])})`,
cc: {
address: rechnung.email || "",
name: rechnung.empfaenger || "",

View File

@@ -147,6 +147,7 @@ const ausweisart = Enums.Ausweisart.VerbrauchsausweisWohnen
const anliegen = "Energieausweis erstellen";
let form: HTMLFormElement;
let skala: HTMLDivElement;
</script>
@@ -166,7 +167,7 @@ let form: HTMLFormElement;
<div id="skala" class="bg-white grid grid-cols-1 px-0 sm:p-4 lg:grid-cols-2 lg:gap-x-6">
<div id="skala" bind:this={skala} class="bg-white grid grid-cols-1 px-0 sm:p-4 lg:grid-cols-2 lg:gap-x-6">
<PerformanceScore
bind:ausweis
@@ -193,6 +194,7 @@ let form: HTMLFormElement;
ausweisart={Enums.Ausweisart.VerbrauchsausweisWohnen}
showWeiter={false}
{form}
{skala}
>
</ButtonWeiterHilfe>
@@ -298,9 +300,10 @@ let form: HTMLFormElement;
bind:user
bind:objekt
bind:aufnahme
bind:form
{form}
ausweisart={Enums.Ausweisart.VerbrauchsausweisWohnen}
{ausweistyp}
{skala}
>
</ButtonWeiterHilfe>
@@ -585,4 +588,10 @@ let form: HTMLFormElement;
Die Wohnfläche darf nicht größer als die Nutzfläche sein.
</RawNotification>
{/if}
</RawNotificationWrapper>
</RawNotificationWrapper>
<style>
:global(input:invalid, select:invalid) {
@apply border-red-600 border-2;
}
</style>

View File

@@ -1,9 +1,36 @@
---
import { API_ACCESS_TOKEN_COOKIE_NAME, API_REFRESH_TOKEN_COOKIE_NAME, API_UID_COOKIE_NAME } from "#lib/constants";
Astro.cookies.delete(API_ACCESS_TOKEN_COOKIE_NAME);
Astro.cookies.delete(API_REFRESH_TOKEN_COOKIE_NAME);
Astro.cookies.delete(API_UID_COOKIE_NAME);
return Astro.redirect("/auth/login");
---
Astro.cookies.delete(API_ACCESS_TOKEN_COOKIE_NAME, {
domain: `.${Astro.url.hostname}`,
path: "/",
});
Astro.cookies.delete(API_REFRESH_TOKEN_COOKIE_NAME, {
domain: `.${Astro.url.hostname}`,
path: "/",
});
Astro.cookies.delete(API_UID_COOKIE_NAME, {
domain: `.${Astro.url.hostname}`,
path: "/",
});
---
<script>
localStorage.clear()
window.location.href = "/"
</script>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
</head>
<body>
</body>
</html>