Merge pull request #260 from IBCornelsen/dev-moritz
Plausibilitätsprüfungen
This commit is contained in:
@@ -126,11 +126,10 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
|
||||
<select
|
||||
name="saniert"
|
||||
class=""
|
||||
required
|
||||
bind:value={gebaeude_aufnahme_allgemein.saniert}
|
||||
>
|
||||
<option disabled selected value={false}>Bitte auswählen</option>
|
||||
<option disabled selected>Bitte auswählen</option>
|
||||
<option value={true}>saniert</option>
|
||||
<option value={false}>unsaniert</option>
|
||||
</select>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { OpenInNewWindow } from "radix-svelte-icons";
|
||||
import { Notification, deleteNotification } from "./shared.js";
|
||||
import { fly } from "svelte/transition";
|
||||
|
||||
@@ -13,7 +14,34 @@
|
||||
class:border-l-yellow-400={notification.type == "warning"}
|
||||
>
|
||||
<div class="flex flex-col px-4 py-2">
|
||||
<h2 class="text-xl font-semibold">{@html notification.message}</h2>
|
||||
<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>
|
||||
{/if}</h2>
|
||||
<p class="text-gray-600 text-lg"><slot></slot></p>
|
||||
</div>
|
||||
{#if notification.dismissable}
|
||||
|
||||
@@ -312,26 +312,6 @@ xs:grid-cols-2"
|
||||
{#each Object.entries($notifications) as [uid, notification] (uid)}
|
||||
<RawNotification notification={{ ...notification, uid }}>
|
||||
{@html notification.subtext}
|
||||
{#if notification.selector}
|
||||
<button on:click={() => {
|
||||
const element = document.querySelector(notification.selector);
|
||||
|
||||
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="px-4 py-2 border rounded-lg mt-2 flex flex-row text-base gap-2 font-bold" title="Anzeigen"><OpenInNewWindow size={22}></OpenInNewWindow> Anzeigen</button>
|
||||
{/if}
|
||||
</RawNotification>
|
||||
{/each}
|
||||
|
||||
@@ -351,6 +331,35 @@ xs:grid-cols-2"
|
||||
</RawNotification>
|
||||
{/if}
|
||||
|
||||
{#if gebaeude_aufnahme_allgemein.nutzflaeche && gebaeude_aufnahme_allgemein.flaeche && gebaeude_aufnahme_allgemein.flaeche === gebaeude_aufnahme_allgemein.nutzflaeche}
|
||||
<RawNotification
|
||||
notification={{
|
||||
message: "Plausibilitätsprüfung",
|
||||
timeout: 0,
|
||||
uid: "WOHNFLAECHE_GLEICH_GESAMTFLAECHE",
|
||||
dismissable: true,
|
||||
type: "warning",
|
||||
}}
|
||||
>
|
||||
Die angegebene Gesamtfläche ist gleich der angegebenen Wohnfläche, in den meisten Fällen sollte die Gesamtfläche größer sein.
|
||||
</RawNotification>
|
||||
{/if}
|
||||
|
||||
{#if typeof gebaeude_aufnahme_allgemein.einheiten === "number" && gebaeude_aufnahme_allgemein.einheiten < 1}
|
||||
<RawNotification
|
||||
notification={{
|
||||
message: "Plausibilitätsprüfung",
|
||||
timeout: 0,
|
||||
uid: "ANZAHL_EINHEITEN",
|
||||
dismissable: false,
|
||||
type: "warning",
|
||||
selector: "input[name='einheiten']"
|
||||
}}
|
||||
>
|
||||
Die Anzahl der Wohneinheiten muss mindestens 1 betragen.
|
||||
</RawNotification>
|
||||
{/if}
|
||||
|
||||
{#await auditPlzNichtErkannt(gebaeude_aufnahme_allgemein) then result}
|
||||
{#if result}
|
||||
<RawNotification
|
||||
|
||||
Reference in New Issue
Block a user