Wohnfläche größer Nutzfläche Fehler

This commit is contained in:
Moritz Utcke
2024-12-26 10:37:24 +07:00
parent 33c1fdb3e2
commit 8d383e87b5
2 changed files with 30 additions and 36 deletions

View File

@@ -4,6 +4,29 @@
import { fly } from "svelte/transition";
export let notification: Partial<Notification> & { uid: string };
function focusSelector() {
const element = document.querySelector(notification.selector as string) as HTMLElement | null;
if (!element) {
return
}
element.classList.add("bg-red-300")
element.scrollIntoView({
behavior: "smooth",
block: "center",
inline: "center"
})
element.focus()
deleteNotification(notification.uid)
setTimeout(() => {
element?.classList.remove("bg-red-300")
}, 3000)
}
</script>
<div
@@ -15,32 +38,7 @@
>
<div class="flex flex-col px-4 py-2">
<h2 class="text-xl font-semibold flex flex-row items-center gap-3">{@html notification.message} {#if notification.selector}
<button on:click={() => {
if (!notification.selector) {
return
}
const element = document.querySelector(notification.selector);
if (!element) {
return
}
element.classList.add("bg-red-300")
element.scrollIntoView({
behavior: "smooth",
block: "center",
inline: "center"
})
element.focus()
deleteNotification(notification.uid)
setTimeout(() => {
element?.classList.remove("bg-red-300")
}, 3000)
}} class="p-1.5 border rounded-lg" title="Anzeigen"><OpenInNewWindow size={18}></OpenInNewWindow></button>
<button on:click={focusSelector} class="p-1.5 border rounded-lg" title="Anzeigen"><OpenInNewWindow size={18}></OpenInNewWindow></button>
{/if}</h2>
<p class="text-gray-600 text-lg"><slot></slot></p>
</div>

View File

@@ -339,6 +339,7 @@ xs:grid-cols-2"
uid: "WOHNFLAECHE_GLEICH_GESAMTFLAECHE",
dismissable: true,
type: "warning",
selector: "input[name='nutzflaeche']"
}}
>
Die angegebene Gesamtfläche ist gleich der angegebenen Wohnfläche, in den meisten Fällen sollte die Gesamtfläche größer sein.
@@ -579,18 +580,13 @@ xs:grid-cols-2"
message: "Plausibilitätsprüfung",
timeout: 0,
uid: "WOHNFLAECHE_GROESSER_GESAMTFLAECHE",
dismissable: true,
onUserDismiss: () => {
hidden.add(AuditType.WOHNFLAECHE_GROESSER_GESAMTFLAECHE);
gebaeude = gebaeude;
},
type: "warning",
dismissable: false,
type: "error",
selector: "input[name='nutzflaeche']"
}}
>
Die Wohnfläche darf nicht größer als die Nutzfläche sein.
</RawNotification>
{/if}
</RawNotificationWrapper>
<style lang="scss">
</style>