Fehler gefixt die beim Testen aufgefallen sind.

This commit is contained in:
Moritz Utcke
2025-02-17 11:24:07 +07:00
parent 74f05d404c
commit 5f8d30a5a3
17 changed files with 116 additions and 103 deletions

View File

@@ -48,13 +48,15 @@
<span class="font-semibold">Falls sie ein Konto bei uns haben wurde eine Email an sie verschickt.</span>
</div>
{/if}
<button type="submit" class="btn btn-primary"
<button type="submit" class="button"
>Email zum Zurücksetzen des Passworts senden.</button
>
{#if showEmailSuccess}
<div class="flex-row justify-between" style="margin-top: 10px">
<a class="link link-hover"
href="/auth/login{redirect ? `?redirect=${redirect}` : ""}">Einloggen</a
>
</div>
{/if}
</form>
</div>

View File

@@ -70,14 +70,9 @@
required
/>
</div>
<button type="submit" class="btn btn-primary"
<button type="submit" class="button"
>Passwort zurückzusetzen</button
>
<div class="flex-row justify-between" style="margin-top: 10px">
<a class="link link-hover"
href="/auth/login">Einloggen</a
>
</div>
</form>
</div>

View File

@@ -3,9 +3,6 @@
export let user: BenutzerClient;
export let objekte: ObjektClient[];
console.log(objekte);
</script>
<h1 class="text-4xl font-medium my-8">Willkommen zurück, {user.vorname}!</h1>

View File

@@ -1,8 +1,10 @@
<script lang="ts">
import { addNotification } from "@ibcornelsen/ui";
import { addNotification } from "#components/Notifications/shared.js";
import { CrossCircled } from "radix-svelte-icons";
import { fade } from "svelte/transition";
import { api } from "astro-typesafe-api/client";
import NotificationProvider from "#components/NotificationProvider/NotificationProvider.svelte";
import NotificationWrapper from "#components/Notifications/NotificationWrapper.svelte";
let passwort: string;
let email: string;
@@ -13,6 +15,16 @@
async function login(e: SubmitEvent) {
e.preventDefault()
if (passwort.length < 8) {
addNotification({
message: "Passwort muss mindestens 6 Zeichen enthalten.",
dismissable: true,
timeout: 3000,
type: "error"
})
return;
}
try {
const { uid } = await api.user.PUT.fetch({
email,
@@ -92,7 +104,7 @@
<span class="font-semibold">Da ist wohl etwas schiefgelaufen. Diese Email Adresse ist bereits in Benutzung, haben sie vielleicht bereits ein Konto bei uns?</span>
</div>
{/if}
<button type="submit" class="btn btn-primary"
<button type="submit" class="button"
>Registrieren</button
>
<div class="flex-row justify-between" style="margin-top: 10px">
@@ -102,4 +114,5 @@
<a class="link link-hover" href="/auth/passwort-vergessen{redirect ? `?redirect=${redirect}` : ""}">Passwort Vergessen?</a>
</div>
</form>
<NotificationWrapper></NotificationWrapper>
</div>

View File

@@ -51,6 +51,7 @@
AufnahmeClient,
} from "#components/Ausweis/types.js";
import { Enums } from "@ibcornelsen/database/client";
import { onMount } from "svelte";
// TODO: Vom Server sollte ein volles Objekt kommen, dass alle Subobjekte enthält, weil es sonst zu Problemen führen kann
// wenn aufnahme oder objekt nicht existiert...
@@ -60,6 +61,27 @@
export let user: BenutzerClient = {} as BenutzerClient;
export let bilder: UploadedGebaeudeBild[] = []
if (Object.keys(ausweis).length === 0) {
const localStorageAusweis = localStorage.getItem("ausweis");
if (localStorageAusweis) {
ausweis = JSON.parse(localStorageAusweis)
}
}
if (Object.keys(aufnahme).length === 0) {
const localStorageAufnahme = localStorage.getItem("aufnahme");
if (localStorageAufnahme) {
aufnahme = JSON.parse(localStorageAufnahme)
}
}
if (Object.keys(objekt).length === 0) {
const localStorageObjekt = localStorage.getItem("objekt");
if (localStorageObjekt) {
objekt = JSON.parse(localStorageObjekt)
}
}
async function spaeterWeitermachen() {
// TODO FIX
// const result = await ausweisSpeichern(
@@ -144,6 +166,18 @@
let waitOverlayHidden = true;
let speichernOverlayHidden = true;
$: {
if (ausweis.uid && objekt.uid && aufnahme.uid) {
localStorage.setItem(ausweis.uid, JSON.stringify(ausweis))
localStorage.setItem(objekt.uid, JSON.stringify(objekt))
localStorage.setItem(aufnahme.uid, JSON.stringify(aufnahme))
} else {
localStorage.setItem("ausweis", JSON.stringify(ausweis))
localStorage.setItem("aufnahme", JSON.stringify(aufnahme))
localStorage.setItem("objekt", JSON.stringify(objekt))
}
}
$: {
if (
aufnahme.saniert &&
@@ -302,7 +336,7 @@ lg:grid-cols-2 lg:gap-x-6
>
</div>
<ButtonWeiterHilfe {spaeterWeitermachen}
<ButtonWeiterHilfe
bind:ausweis
bind:bilder
bind:user
@@ -317,7 +351,7 @@ lg:grid-cols-2 lg:gap-x-6
</form>
<RawNotificationWrapper>
<RawNotificationWrapper class="fixed left-8 bottom-8 max-w-[400px] flex flex-col gap-4 z-50">
{#each Object.entries($notifications) as [uid, notification] (uid)}
<RawNotification notification={{ ...notification, uid }}>
{@html notification.subtext}
@@ -416,7 +450,8 @@ lg:grid-cols-2 lg:gap-x-6
dismissable: true,
onUserDismiss: () => {
hidden.add(AuditType.HEIZUNG_JUENGER_DREI_JAHRE);
objekt = objekt;
aufnahme = aufnahme;
},
type: "warning",
}}
@@ -440,6 +475,7 @@ lg:grid-cols-2 lg:gap-x-6
onUserDismiss: () => {
hidden.add(AuditType.ZEITRAUM_AKTUELL);
objekt = objekt;
ausweis = ausweis
},
type: "warning",
}}
@@ -463,6 +499,7 @@ lg:grid-cols-2 lg:gap-x-6
onUserDismiss: () => {
hidden.add(AuditType.KLIMA_FAKTOREN);
objekt = objekt;
ausweis = ausweis;
},
type: "warning",
}}
@@ -486,7 +523,7 @@ lg:grid-cols-2 lg:gap-x-6
dismissable: true,
onUserDismiss: () => {
hidden.add(AuditType.WOHN_FLAECHE);
objekt = objekt;
aufnahme = aufnahme;
},
type: "warning",
}}
@@ -506,7 +543,7 @@ lg:grid-cols-2 lg:gap-x-6
dismissable: true,
onUserDismiss: () => {
hidden.add(AuditType.WARM_WASSER);
objekt = objekt;
ausweis = ausweis;
},
type: "warning",
}}
@@ -522,11 +559,7 @@ lg:grid-cols-2 lg:gap-x-6
message: "Plausibilitätsprüfung",
timeout: 0,
uid: "LEER_STAND",
dismissable: true,
onUserDismiss: () => {
hidden.add(AuditType.LEER_STAND);
objekt = objekt;
},
dismissable: false,
type: "warning",
}}
>
@@ -536,7 +569,8 @@ lg:grid-cols-2 lg:gap-x-6
</RawNotification>
{/if}
{#if auditVerbrauchAbweichung(ausweis, aufnahme).length > 0}
{@const abweichung = auditVerbrauchAbweichung(ausweis, aufnahme)}
{#if abweichung.length > 0}
<RawNotification
notification={{
message: "Plausibilitätsprüfung",
@@ -546,17 +580,12 @@ lg:grid-cols-2 lg:gap-x-6
onUserDismiss: () => {
hidden.add(AuditType.VERBRAUCH_ABWEICHUNG);
objekt = objekt;
ausweis = ausweis;
},
type: "warning",
}}
>
Die Abweichung der Verbräuche zwischen Zeitraum {auditVerbrauchAbweichung(
ausweis,
aufnahme
)[0]} und {auditVerbrauchAbweichung(
ausweis,
aufnahme
)[1]} beträgt mehr als 30% und sie haben keinen Leerstand angegeben.
Die Abweichung der Verbräuche zwischen Zeitraum {abweichung[0]} und {abweichung[1]} beträgt mehr als 30% und sie haben keinen Leerstand angegeben.
Sind sie sich sicher, dass das stimmt?
</RawNotification>
{/if}