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"; import { fly } from "svelte/transition";
export let notification: Partial<Notification> & { uid: string }; 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> </script>
<div <div
@@ -15,32 +38,7 @@
> >
<div class="flex flex-col px-4 py-2"> <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} <h2 class="text-xl font-semibold flex flex-row items-center gap-3">{@html notification.message} {#if notification.selector}
<button on:click={() => { <button on:click={focusSelector} class="p-1.5 border rounded-lg" title="Anzeigen"><OpenInNewWindow size={18}></OpenInNewWindow></button>
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>
{/if}</h2> {/if}</h2>
<p class="text-gray-600 text-lg"><slot></slot></p> <p class="text-gray-600 text-lg"><slot></slot></p>
</div> </div>

View File

@@ -339,6 +339,7 @@ xs:grid-cols-2"
uid: "WOHNFLAECHE_GLEICH_GESAMTFLAECHE", uid: "WOHNFLAECHE_GLEICH_GESAMTFLAECHE",
dismissable: true, dismissable: true,
type: "warning", 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. 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", message: "Plausibilitätsprüfung",
timeout: 0, timeout: 0,
uid: "WOHNFLAECHE_GROESSER_GESAMTFLAECHE", uid: "WOHNFLAECHE_GROESSER_GESAMTFLAECHE",
dismissable: true, dismissable: false,
onUserDismiss: () => { type: "error",
hidden.add(AuditType.WOHNFLAECHE_GROESSER_GESAMTFLAECHE); selector: "input[name='nutzflaeche']"
gebaeude = gebaeude;
},
type: "warning",
}} }}
> >
Die Wohnfläche darf nicht größer als die Nutzfläche sein. Die Wohnfläche darf nicht größer als die Nutzfläche sein.
</RawNotification> </RawNotification>
{/if} {/if}
</RawNotificationWrapper> </RawNotificationWrapper>
<style lang="scss">
</style>