Notification Update (Selector)

This commit is contained in:
Moritz Utcke
2024-12-23 16:36:58 +07:00
parent bbe54fca0f
commit 2710958b59
6 changed files with 177 additions and 110 deletions

View File

@@ -14,6 +14,7 @@
GebaeudeClient,
VerbrauchsausweisWohnenClient,
} from "./types.js";
import { addNotification } from "#components/Notifications/shared.js";
export let gebaeude: GebaeudeClient;
export let gebaeude_aufnahme_allgemein: GebaeudeAufnahmeClient;
@@ -81,6 +82,22 @@
}
}
$: {
console.log(month, year);
if ((availableDates.filter(date => date.month === month && date.year === year).length === 0) && typeof month === "number" && typeof year === "number") {
addNotification({
message: "Monat nicht verfügbar.",
subtext: "Der ausgewählte Monat ist in diesem Jahr nicht verfügbar, bitte wählen sie einen neuen Start Monat.",
dismissable: true,
type: "warning",
timeout: 0,
uid: "monat_nicht_verfuegbar",
selector: "select[name='energieverbrauch_zeitraum_monat']"
})
}
}
$: abweichung = auditVerbrauchAbweichung(ausweis, gebaeude);
</script>
@@ -147,7 +164,6 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
bind:value={month}
required
>
<option disabled>Monat</option>
{#if year !== null}
{#each availableDates.filter((date) => date.year == year) as date}
<option value={date.month}
@@ -182,7 +198,6 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
bind:value={year}
required
>
<option disabled>Jahr</option>
{#each Array.from(availableDates.reduce((a, c) => {
a.add(c.year);
return a;