Bugfixes
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { OmitKeys, TicketClient } from "#components/Ausweis/types.js";
|
||||
import { api } from "astro-typesafe-api/client";
|
||||
|
||||
export async function createTicket(info: OmitKeys<TicketClient, "created_at" | "deleted_at" | "prioritaet" | "updated_at" | "status" | "uid">) {
|
||||
export async function createTicket(info: OmitKeys<TicketClient, "created_at" | "deleted_at" | "prioritaet" | "updated_at" | "status">) {
|
||||
return await api.ticket.PUT.fetch(info)
|
||||
}
|
||||
@@ -49,7 +49,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
required
|
||||
data-cy="ausstellgrund"
|
||||
>
|
||||
<option disabled selected >Bitte auswählen</option>
|
||||
<option disabled selected value={null}>Bitte auswählen</option>
|
||||
{#each ausstellgrund as name}
|
||||
<option value={name}>{name}</option>
|
||||
{/each}
|
||||
@@ -73,7 +73,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
required
|
||||
bind:value={aufnahme.gebaeudetyp}
|
||||
>
|
||||
<option disabled selected value>Bitte auswählen</option>
|
||||
<option disabled selected value={null}>Bitte auswählen</option>
|
||||
|
||||
{#if ausweisart==Enums.Ausweisart.VerbrauchsausweisWohnen || ausweisart === Enums.Ausweisart.GEGNachweisWohnen || ausweisart === Enums.Ausweisart.BedarfsausweisWohnen}
|
||||
<option value="Einfamilienhaus">Einfamilienhaus</option>
|
||||
@@ -225,7 +225,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
required
|
||||
bind:value={aufnahme.saniert}
|
||||
>
|
||||
<option disabled selected>Bitte auswählen</option>
|
||||
<option disabled selected value={null}>Bitte auswählen</option>
|
||||
<option value={true}>saniert</option>
|
||||
<option value={false}>unsaniert</option>
|
||||
</select>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import Overlay from "#components/Overlay.svelte";
|
||||
import EmbeddedAuthFlowModule from "#modules/EmbeddedAuthFlowModule.svelte";
|
||||
|
||||
import { AusweisTyp, BedarfsausweisGewerbe, Enums, GEGNachweisGewerbe, GEGNachweisWohnen, Unterlage } from "#lib/client/prisma.js";
|
||||
import { AusweisTyp, BedarfsausweisGewerbe, Enums, GEGNachweisGewerbe, GEGNachweisWohnen, Unterlage, VerbrauchsausweisWohnen } from "#lib/client/prisma.js";
|
||||
import { openWindowWithPost } from "#lib/helpers/window.js";
|
||||
import { PRICES } from "#lib/constants.js";
|
||||
import { nachweisSpeichern } from "#client/lib/nachweisSpeichern.js";
|
||||
@@ -19,6 +19,7 @@
|
||||
export let ausweisart: Enums.Ausweisart
|
||||
export let form: HTMLFormElement;
|
||||
export let skala: HTMLDivElement;
|
||||
export let blockLocalStorageSync: boolean = false;
|
||||
|
||||
export let showWeiter: boolean = true;
|
||||
export let showHelpButton: boolean = true;
|
||||
@@ -95,10 +96,10 @@
|
||||
|
||||
let result: Awaited<ReturnType<typeof ausweisSpeichern>> | Awaited<ReturnType<typeof nachweisSpeichern>> | null = null;
|
||||
if (ausweisart === Enums.Ausweisart.GEGNachweisWohnen || ausweisart === Enums.Ausweisart.GEGNachweisGewerbe || ausweisart === Enums.Ausweisart.BedarfsausweisGewerbe) {
|
||||
result = await nachweisSpeichern({ ...ausweis, nachweistyp: ausweistyp }, objekt, aufnahme, bilder, unterlagen, ausweisart)
|
||||
result = await nachweisSpeichern({ ...ausweis as GEGNachweisWohnen, nachweistyp: ausweistyp }, objekt, aufnahme, bilder, unterlagen, ausweisart)
|
||||
ausweis.id = result.nachweis_id;
|
||||
} else {
|
||||
result = await ausweisSpeichern({ ...ausweis, ausweistyp }, objekt, aufnahme, bilder, ausweisart)
|
||||
result = await ausweisSpeichern({ ...ausweis as VerbrauchsausweisWohnen, ausweistyp }, objekt, aufnahme, bilder, ausweisart)
|
||||
ausweis.id = result.ausweis_id;
|
||||
}
|
||||
|
||||
@@ -108,7 +109,7 @@
|
||||
"",
|
||||
`${location.pathname}?id=${ausweis.id}`
|
||||
);
|
||||
|
||||
blockLocalStorageSync = true;
|
||||
localStorage.clear()
|
||||
window.location.href = `/speichern-erfolgreich?id=${ausweis.id}`
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
bind:value={aufnahme.gebaeudeteil}
|
||||
required
|
||||
>
|
||||
<option disabled selected value>Bitte auswählen</option>
|
||||
<option disabled selected value={null}>Bitte auswählen</option>
|
||||
<option value="Gesamtgebäude">Gesamtgebäude</option>
|
||||
<option value="Wohnen">Wohnen</option>
|
||||
</select>
|
||||
@@ -214,7 +214,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
bind:value={aufnahme.dachgeschoss}
|
||||
required
|
||||
>
|
||||
<option disabled selected >Bitte auswählen</option>
|
||||
<option disabled selected value={null}>Bitte auswählen</option>
|
||||
<option value={Enums.Heizungsstatus.NICHT_VORHANDEN}
|
||||
>nicht vorhanden</option
|
||||
>
|
||||
@@ -243,7 +243,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
required
|
||||
bind:value={aufnahme.keller}
|
||||
>
|
||||
<option disabled selected >Bitte auswählen</option>
|
||||
<option disabled selected value={null}>Bitte auswählen</option>
|
||||
<option value={Enums.Heizungsstatus.NICHT_VORHANDEN}
|
||||
>nicht vorhanden</option
|
||||
>
|
||||
|
||||
@@ -1,68 +1,85 @@
|
||||
<script lang="ts">
|
||||
import HelpLabel from "#components/labels/HelpLabel.svelte";
|
||||
import Inputlabel from "#components/labels/InputLabel.svelte";
|
||||
export let ausweis;
|
||||
import HelpLabel from "#components/labels/HelpLabel.svelte";
|
||||
import Inputlabel from "#components/labels/InputLabel.svelte";
|
||||
export let ausweis;
|
||||
|
||||
const arrayRange = (start: number, stop: number, step: number) =>
|
||||
const arrayRange = (start: number, stop: number, step: number) =>
|
||||
Array.from(
|
||||
{ length: (stop - start) / step + 1 },
|
||||
(value, index) => start + index * step
|
||||
);
|
||||
</script>
|
||||
|
||||
|
||||
<div
|
||||
id="superBereich2"
|
||||
class="grid w-full items-start
|
||||
id="superBereich2"
|
||||
class="grid w-full items-start
|
||||
grid-cols-1 gap-x-4 gap-y-4
|
||||
sm:grid-cols-2 sm:gap-x-6 sm:gap-y-8
|
||||
xl:grid-cols-2 xl:gap-x-8 xl:gap-y-8
|
||||
">
|
||||
|
||||
<div class="bereich-box col-span-2">
|
||||
<div class="w-full grid grid-cols-2 sm:grid-cols-4 gap-4 justify-between justify-items-center items-center">
|
||||
<div class="ring-1 ring-black/15 bg-white rounded-md"><img src="/images/form-r.svg" alt="rechteck"/></div>
|
||||
<div class="ring-1 ring-black/15 bg-white rounded-md"><img src="/images/form-l.svg" alt="l-form" /></div>
|
||||
<div class="ring-1 ring-black/15 bg-white rounded-md"><img src="/images/form-t.svg" alt="t-form" /></div>
|
||||
<div class="ring-1 ring-black/15 bg-white rounded-md"><img src="/images/form-u.svg" alt="u-form" /></div>
|
||||
"
|
||||
>
|
||||
<div class="bereich-box col-span-2">
|
||||
<div
|
||||
class="w-full grid grid-cols-2 sm:grid-cols-4 gap-4 justify-between justify-items-center items-center"
|
||||
>
|
||||
<div class="ring-1 ring-black/15 bg-white rounded-md">
|
||||
<img src="/images/form-r.svg" alt="rechteck" />
|
||||
</div>
|
||||
<div class="ring-1 ring-black/15 bg-white rounded-md">
|
||||
<img src="/images/form-l.svg" alt="l-form" />
|
||||
</div>
|
||||
<div class="ring-1 ring-black/15 bg-white rounded-md">
|
||||
<img src="/images/form-t.svg" alt="t-form" />
|
||||
</div>
|
||||
<div class="ring-1 ring-black/15 bg-white rounded-md">
|
||||
<img src="/images/form-u.svg" alt="u-form" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-span-2 xl:col-span-1">
|
||||
|
||||
<div
|
||||
<div class="col-span-2 xl:col-span-1">
|
||||
<div
|
||||
id="Berechnungshilfe2"
|
||||
class="bereich-box grid w-full
|
||||
grid-cols-2 gap-x-4 gap-y-8
|
||||
sm:grid-cols-3 sm:gap-x-6 sm:gap-y-8
|
||||
xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
"
|
||||
>
|
||||
|
||||
<div class="input-standard col-span-2 sm:col-span-3">
|
||||
<h4 class="m-0 font-bold p-1 pt-2 min-h-[38px] ring-1 bg-white ring-black/15 rounded-sm;">Berechnungshilfe - Eingabe der Grundfläche, Gechossanzahl und -höhe</h4>
|
||||
>
|
||||
<div class="input-standard col-span-2 sm:col-span-3">
|
||||
<h4
|
||||
class="m-0 font-bold p-1 pt-2 min-h-[38px] ring-1 bg-white ring-black/15 rounded-sm;"
|
||||
>
|
||||
Berechnungshilfe - Eingabe der Grundfläche, Gechossanzahl
|
||||
und -höhe
|
||||
</h4>
|
||||
<div class="help-label">
|
||||
<HelpLabel>Hier wählen Sie Ihren passenden Grundriss aus, und tragen die entsprechenden Maße unten ein.
|
||||
Bitte berücksichtigen Sie nur den Grundriss der zum beheizten Gebäude gehört.
|
||||
Garagen oder Schuppen die an das Haus herangebaut sind aber keine Verbindung zum Wohnhaus haben bitte weglassen.</HelpLabel>
|
||||
<HelpLabel
|
||||
>Hier wählen Sie Ihren passenden Grundriss aus, und
|
||||
tragen die entsprechenden Maße unten ein. Bitte
|
||||
berücksichtigen Sie nur den Grundriss der zum beheizten
|
||||
Gebäude gehört. Garagen oder Schuppen die an das Haus
|
||||
herangebaut sind aber keine Verbindung zum Wohnhaus
|
||||
haben bitte weglassen.</HelpLabel
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-standard order-1 md:order-1 xl:order-1">
|
||||
<div class="input-standard order-1 md:order-1 xl:order-1">
|
||||
<Inputlabel title="A"></Inputlabel>
|
||||
|
||||
<input
|
||||
name="masse_a"
|
||||
type="number"
|
||||
bind:value={ausweis.masse_a}
|
||||
/>
|
||||
/>
|
||||
|
||||
<div class="help-label">
|
||||
<div class="help-label">
|
||||
<HelpLabel></HelpLabel>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-standard order-2 md:order-2 xl:order-2">
|
||||
<div class="input-standard order-2 md:order-2 xl:order-2">
|
||||
<Inputlabel title="B"></Inputlabel>
|
||||
|
||||
<input
|
||||
@@ -71,12 +88,12 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
bind:value={ausweis.masse_b}
|
||||
/>
|
||||
|
||||
<div class="help-label">
|
||||
<div class="help-label">
|
||||
<HelpLabel></HelpLabel>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-standard order-3 md:order-3 xl:order-3">
|
||||
<div class="input-standard order-3 md:order-3 xl:order-3">
|
||||
<Inputlabel title="C"></Inputlabel>
|
||||
|
||||
<input
|
||||
@@ -85,12 +102,12 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
bind:value={ausweis.masse_c}
|
||||
/>
|
||||
|
||||
<div class="help-label">
|
||||
<div class="help-label">
|
||||
<HelpLabel></HelpLabel>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-standard order-4 md:order-4 xl:order-4">
|
||||
<div class="input-standard order-4 md:order-4 xl:order-4">
|
||||
<Inputlabel title="D"></Inputlabel>
|
||||
|
||||
<input
|
||||
@@ -99,13 +116,12 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
bind:value={ausweis.masse_d}
|
||||
/>
|
||||
|
||||
<div class="help-label">
|
||||
<div class="help-label">
|
||||
<HelpLabel></HelpLabel>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="input-standard order-5 md:order-5 xl:order-5">
|
||||
<div class="input-standard order-5 md:order-5 xl:order-5">
|
||||
<Inputlabel title="E"></Inputlabel>
|
||||
|
||||
<input
|
||||
@@ -114,14 +130,12 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
bind:value={ausweis.masse_e}
|
||||
/>
|
||||
|
||||
<div class="help-label">
|
||||
<div class="help-label">
|
||||
<HelpLabel></HelpLabel>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="input-standard order-6 md:order-6 xl:order-6">
|
||||
<div class="input-standard order-6 md:order-6 xl:order-6">
|
||||
<Inputlabel title="F"></Inputlabel>
|
||||
|
||||
<input
|
||||
@@ -130,24 +144,21 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
bind:value={ausweis.masse_f}
|
||||
/>
|
||||
|
||||
<div class="help-label">
|
||||
<div class="help-label">
|
||||
<HelpLabel></HelpLabel>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div
|
||||
<div
|
||||
id="Berechnungshilfe1"
|
||||
class="bereich-box grid w-full mt-6
|
||||
grid-cols-1 gap-x-4 gap-y-8
|
||||
sm:grid-cols-2 sm:gap-x-6 sm:gap-y-8
|
||||
xl:grid-cols-2 xl:gap-x-8 xl:gap-y-8
|
||||
"
|
||||
>
|
||||
|
||||
<div class="input-standard order-1 md:order-1 xl:order-1">
|
||||
>
|
||||
<div class="input-standard order-1 md:order-1 xl:order-1">
|
||||
<Inputlabel title="Anzahl Vollgeschosse *"></Inputlabel>
|
||||
|
||||
<input
|
||||
@@ -157,14 +168,15 @@ xl:grid-cols-2 xl:gap-x-8 xl:gap-y-8
|
||||
required
|
||||
/>
|
||||
|
||||
<div class="help-label">
|
||||
<HelpLabel>Bitte geben Sie hier die Anzahl der Vollgeschosse
|
||||
an. Keller und Dachgeschoss mit Schrägen zählen
|
||||
nicht dazu.</HelpLabel>
|
||||
</div>
|
||||
</div>
|
||||
<div class="help-label">
|
||||
<HelpLabel
|
||||
>Bitte geben Sie hier die Anzahl der Vollgeschosse an.
|
||||
Keller und Dachgeschoss mit Schrägen zählen nicht dazu.</HelpLabel
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-standard order-2 md:order-2 xl:order-2">
|
||||
<div class="input-standard order-2 md:order-2 xl:order-2">
|
||||
<Inputlabel title="Geschosshöhe *"></Inputlabel>
|
||||
|
||||
<select
|
||||
@@ -174,103 +186,110 @@ xl:grid-cols-2 xl:gap-x-8 xl:gap-y-8
|
||||
>
|
||||
<option>Bitte auswählen</option>
|
||||
{#each arrayRange(2.1, 4.5, 0.1) as step}
|
||||
<option value={step}>{step.toFixed(2)} m</option
|
||||
>
|
||||
<option value={step}>{step.toFixed(2)} m</option>
|
||||
{/each}
|
||||
</select>
|
||||
|
||||
<div class="help-label">
|
||||
<HelpLabel>Bitte geben Sie hier die Geschosshöhe (lichte
|
||||
Raumhöhe + Deckenstärke) des Gebäudes ein. Bei
|
||||
unterschiedlichen Geschosshöhen bilden Sie einen
|
||||
Mittelwert.</HelpLabel>
|
||||
</div>
|
||||
</div>
|
||||
<div class="help-label">
|
||||
<HelpLabel
|
||||
>Bitte geben Sie hier die Geschosshöhe (lichte Raumhöhe
|
||||
+ Deckenstärke) des Gebäudes ein. Bei unterschiedlichen
|
||||
Geschosshöhen bilden Sie einen Mittelwert.</HelpLabel
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-standard order-3 md:order-3 xl:order-3">
|
||||
<div class="input-standard order-3 md:order-3 xl:order-3">
|
||||
<Inputlabel title="Gaubenanzahl"></Inputlabel>
|
||||
|
||||
<input
|
||||
name="anzahl_gauben"
|
||||
bind:value={ausweis.anzahl_gauben}
|
||||
type="number"
|
||||
/>
|
||||
/>
|
||||
|
||||
<div class="help-label">
|
||||
<HelpLabel>Wenn Ihr Gebäude Dachgauben besitzt geben Sie hier
|
||||
die Anzahl ein.</HelpLabel>
|
||||
</div>
|
||||
</div>
|
||||
<div class="help-label">
|
||||
<HelpLabel
|
||||
>Wenn Ihr Gebäude Dachgauben besitzt geben Sie hier die
|
||||
Anzahl ein.</HelpLabel
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-standard order-4 md:order-4 xl:order-4">
|
||||
<div class="input-standard order-4 md:order-4 xl:order-4">
|
||||
<Inputlabel title="Breite aller Gauben in m"></Inputlabel>
|
||||
|
||||
<select
|
||||
name="breite_gauben"
|
||||
bind:value={ausweis.breite_gauben}
|
||||
>
|
||||
<select name="breite_gauben" bind:value={ausweis.breite_gauben}>
|
||||
<option>Bitte auswählen</option>
|
||||
{#each arrayRange(0.5, 10, 0.1) as step}
|
||||
<option value={step}>{step.toFixed(2)} m</option
|
||||
>
|
||||
<option value={step}>{step.toFixed(2)} m</option>
|
||||
{/each}
|
||||
</select>
|
||||
|
||||
<div class="help-label">
|
||||
<HelpLabel>Bitte geben Sie hier die Gesamtbreite aller Gauben
|
||||
in m ein.</HelpLabel>
|
||||
</div>
|
||||
<div class="help-label">
|
||||
<HelpLabel
|
||||
>Bitte geben Sie hier die Gesamtbreite aller Gauben in m
|
||||
ein.</HelpLabel
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="bereich-box col-span-2 xl:col-span-1">
|
||||
<div
|
||||
<div class="bereich-box col-span-2 xl:col-span-1">
|
||||
<div
|
||||
id="Berechnungstabelle"
|
||||
class="grid w-full
|
||||
grid-cols-2 gap-x-4 gap-y-8
|
||||
sm:grid-cols-2 sm:gap-x-6 sm:gap-y-8
|
||||
xl:grid-cols-2 xl:gap-x-8 xl:gap-y-8 xl:col-span-1
|
||||
"
|
||||
>
|
||||
<div class="input-standard col-span-2">
|
||||
<h4 class="m-0 font-bold p-1 pt-2 min-h-[38px] ring-1 bg-white ring-black/15 rounded-sm ">Außenflächen, U-Werte und Volumen</h4>
|
||||
>
|
||||
<div class="input-standard col-span-2">
|
||||
<h4
|
||||
class="m-0 font-bold p-1 pt-2 min-h-[38px] ring-1 bg-white ring-black/15 rounded-sm"
|
||||
>
|
||||
Außenflächen, U-Werte und Volumen
|
||||
</h4>
|
||||
<div class="help-label">
|
||||
<HelpLabel>Die wärmeübertragende Umfassungsflächen sind die Hüllflächen des beheizten Gebäudes die an die Außenluft bzw. an unbeheizte Vorbauten grenzen.
|
||||
Wenn Ihnen die Außenwand-,Dach-,Decken- und Bodenflächen vorliegen können Sie die Eingabe direkt vornehmen.
|
||||
Hier können Sie auch das von den Umfassungsflächen eingeschlossene Volumen des Gebäudes eingeben.
|
||||
Die ermittelten Werte der Berechnungshilfe können hier präzisiert werden.</HelpLabel>
|
||||
</div>
|
||||
</div>
|
||||
<HelpLabel
|
||||
>Die wärmeübertragende Umfassungsflächen sind die
|
||||
Hüllflächen des beheizten Gebäudes die an die Außenluft
|
||||
bzw. an unbeheizte Vorbauten grenzen. Wenn Ihnen die
|
||||
Außenwand-,Dach-,Decken- und Bodenflächen vorliegen
|
||||
können Sie die Eingabe direkt vornehmen. Hier können Sie
|
||||
auch das von den Umfassungsflächen eingeschlossene
|
||||
Volumen des Gebäudes eingeben. Die ermittelten Werte der
|
||||
Berechnungshilfe können hier präzisiert werden.</HelpLabel
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-standard col-span-2">
|
||||
<div class="input-standard col-span-2">
|
||||
<Inputlabel title="Tabellenwerte"></Inputlabel>
|
||||
|
||||
<div class="input-checkboxen">
|
||||
<div
|
||||
class="grid grid-cols-[25px_max-content] items-center justify-items-start"
|
||||
>
|
||||
|
||||
<input
|
||||
id="tabellenwerte_aendern"
|
||||
type="checkbox"
|
||||
bind:checked={ausweis.tabellenwerte_aendern}
|
||||
name="tabellenwerte_aendern"
|
||||
/>
|
||||
<label for="tabellenwerte_aendern">Tabellenwerte manuell ändern</label>
|
||||
<label for="tabellenwerte_aendern"
|
||||
>Tabellenwerte manuell ändern</label
|
||||
>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="help-label">
|
||||
<HelpLabel></HelpLabel>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-standard order-1 md:order-1 xl:order-1">
|
||||
<div class="input-standard order-1 md:order-1 xl:order-1">
|
||||
<Inputlabel title="Dachfläche in m²"></Inputlabel>
|
||||
|
||||
<input
|
||||
@@ -278,14 +297,14 @@ xl:grid-cols-2 xl:gap-x-8 xl:gap-y-8 xl:col-span-1
|
||||
bind:value={ausweis.dachflaeche}
|
||||
readonly={!ausweis.tabellenwerte_aendern}
|
||||
type="number"
|
||||
/>
|
||||
/>
|
||||
|
||||
<div class="help-label">
|
||||
<HelpLabel></HelpLabel>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-standard order-2 md:order-2 xl:order-2">
|
||||
<div class="input-standard order-2 md:order-2 xl:order-2">
|
||||
<Inputlabel title="U-Wert in W/m²K"></Inputlabel>
|
||||
|
||||
<input
|
||||
@@ -298,9 +317,9 @@ xl:grid-cols-2 xl:gap-x-8 xl:gap-y-8 xl:col-span-1
|
||||
<div class="help-label">
|
||||
<HelpLabel></HelpLabel>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-standard order-3 md:order-3 xl:order-3">
|
||||
<div class="input-standard order-3 md:order-3 xl:order-3">
|
||||
<Inputlabel title="Geschoßdecke in m²"></Inputlabel>
|
||||
|
||||
<input
|
||||
@@ -313,9 +332,9 @@ xl:grid-cols-2 xl:gap-x-8 xl:gap-y-8 xl:col-span-1
|
||||
<div class="help-label">
|
||||
<HelpLabel></HelpLabel>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-standard order-4 md:order-4 xl:order-4">
|
||||
<div class="input-standard order-4 md:order-4 xl:order-4">
|
||||
<Inputlabel title="U-Wert in W/m²K"></Inputlabel>
|
||||
|
||||
<input
|
||||
@@ -323,14 +342,14 @@ xl:grid-cols-2 xl:gap-x-8 xl:gap-y-8 xl:col-span-1
|
||||
bind:value={ausweis.decke_u_wert}
|
||||
readonly={!ausweis.tabellenwerte_aendern}
|
||||
type="number"
|
||||
/>
|
||||
/>
|
||||
|
||||
<div class="help-label">
|
||||
<HelpLabel></HelpLabel>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-standard order-5 md:order-5 xl:order-5">
|
||||
<div class="input-standard order-5 md:order-5 xl:order-5">
|
||||
<Inputlabel title="Außenwand in m²"></Inputlabel>
|
||||
|
||||
<input
|
||||
@@ -343,9 +362,9 @@ xl:grid-cols-2 xl:gap-x-8 xl:gap-y-8 xl:col-span-1
|
||||
<div class="help-label">
|
||||
<HelpLabel></HelpLabel>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-standard order-6 md:order-6 xl:order-6">
|
||||
<div class="input-standard order-6 md:order-6 xl:order-6">
|
||||
<Inputlabel title="U-Wert in W/m²K"></Inputlabel>
|
||||
|
||||
<input
|
||||
@@ -353,14 +372,14 @@ xl:grid-cols-2 xl:gap-x-8 xl:gap-y-8 xl:col-span-1
|
||||
bind:value={ausweis.aussenwand_u_wert}
|
||||
readonly={!ausweis.tabellenwerte_aendern}
|
||||
type="number"
|
||||
/>
|
||||
/>
|
||||
|
||||
<div class="help-label">
|
||||
<HelpLabel></HelpLabel>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-standard order-7 md:order-7 xl:order-7">
|
||||
<div class="input-standard order-7 md:order-7 xl:order-7">
|
||||
<Inputlabel title="Fußboden in m²"></Inputlabel>
|
||||
|
||||
<input
|
||||
@@ -373,9 +392,9 @@ xl:grid-cols-2 xl:gap-x-8 xl:gap-y-8 xl:col-span-1
|
||||
<div class="help-label">
|
||||
<HelpLabel></HelpLabel>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-standard order-8 md:order-8 xl:order-8">
|
||||
<div class="input-standard order-8 md:order-8 xl:order-8">
|
||||
<Inputlabel title="U-Wert in W/m²K"></Inputlabel>
|
||||
|
||||
<input
|
||||
@@ -383,15 +402,18 @@ xl:grid-cols-2 xl:gap-x-8 xl:gap-y-8 xl:col-span-1
|
||||
bind:value={ausweis.fussboden_u_wert}
|
||||
readonly={!ausweis.tabellenwerte_aendern}
|
||||
type="number"
|
||||
/>
|
||||
/>
|
||||
|
||||
<div class="help-label">
|
||||
<HelpLabel></HelpLabel>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-standard order-9 md:order-9 xl:order-9 col-span-2">
|
||||
<Inputlabel title="eingeschlossenes Gebäudevolumen in m³"></Inputlabel>
|
||||
<div
|
||||
class="input-standard order-9 md:order-9 xl:order-9 col-span-2"
|
||||
>
|
||||
<Inputlabel title="eingeschlossenes Gebäudevolumen in m³"
|
||||
></Inputlabel>
|
||||
|
||||
<input
|
||||
name="volumen"
|
||||
@@ -403,28 +425,33 @@ xl:grid-cols-2 xl:gap-x-8 xl:gap-y-8 xl:col-span-1
|
||||
<div class="help-label">
|
||||
<HelpLabel></HelpLabel>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="input-standard order-10 md:order-10 xl:order-10 col-span-2">
|
||||
<Inputlabel title="Blower-Door-Test erfolgreich durchgeführt:"></Inputlabel>
|
||||
<div
|
||||
class="input-standard order-10 md:order-10 xl:order-10 col-span-2"
|
||||
>
|
||||
<Inputlabel title="Blower-Door-Test erfolgreich durchgeführt:"
|
||||
></Inputlabel>
|
||||
|
||||
|
||||
<div class="grid grid-cols-[max-content_max-content] bg-white gap-x-12 p-1 min-h-[38px] ring-1 ring-black/15 rounded-sm">
|
||||
|
||||
<div class="grid grid-cols-[25px_1fr] items-center justify-items-start">
|
||||
<div
|
||||
class="grid grid-cols-[max-content_max-content] bg-white gap-x-12 p-1 min-h-[38px] ring-1 ring-black/15 rounded-sm"
|
||||
>
|
||||
<div
|
||||
class="grid grid-cols-[25px_1fr] items-center justify-items-start"
|
||||
>
|
||||
<input
|
||||
id="bow-yes"
|
||||
type="radio"
|
||||
value={true}
|
||||
bind:group={ausweis.dicht}
|
||||
name="dichtheit"
|
||||
/>
|
||||
/>
|
||||
<label for="bow-yes" class="radio-inline">Ja</label>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-[25px_1fr] items-center justify-items-start">
|
||||
<div
|
||||
class="grid grid-cols-[25px_1fr] items-center justify-items-start"
|
||||
>
|
||||
<input
|
||||
id="bow-no"
|
||||
type="radio"
|
||||
@@ -432,24 +459,18 @@ xl:grid-cols-2 xl:gap-x-8 xl:gap-y-8 xl:col-span-1
|
||||
bind:group={ausweis.dicht}
|
||||
name="dichtheit"
|
||||
/>
|
||||
<label for="bow-no" class="radio-inline">Nein</label>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<label for="bow-no" class="radio-inline">Nein</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="help-label">
|
||||
<HelpLabel></HelpLabel>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!--<div class="grid grid-cols-[3fr_2fr] gap-4">
|
||||
<div class="GRB3 gap-4">
|
||||
<HelpLabel
|
||||
|
||||
@@ -50,7 +50,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
required
|
||||
bind:value={aufnahme.lueftung}
|
||||
>
|
||||
<option disabled selected >Bitte auswählen</option>
|
||||
<option disabled selected value={null}>Bitte auswählen</option>
|
||||
<option value="Fensterlueftung">Fensterlüftung</option>
|
||||
<option value="Schachtlueftung">Schachtlüftung</option>
|
||||
<option value="LueftungsanlageOhneWaermerueckgewinnung"
|
||||
@@ -83,7 +83,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
required
|
||||
bind:value={aufnahme.kuehlung}
|
||||
>
|
||||
<option disabled selected value>Bitte auswählen</option>
|
||||
<option disabled selected value={null}>Bitte auswählen</option>
|
||||
<option value="1">vorhanden</option>
|
||||
<option value="0">nicht vorhanden</option>
|
||||
</select>
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
<script lang="ts">
|
||||
import HelpLabel from "#components/labels/HelpLabel.svelte";
|
||||
import Inputlabel from "#components/labels/InputLabel.svelte";
|
||||
|
||||
import FensterImage from "./FensterImage.svelte";
|
||||
|
||||
@@ -13,12 +11,12 @@
|
||||
VerbrauchsausweisGewerbeClient,
|
||||
VerbrauchsausweisWohnenClient,
|
||||
} from "./types.js";
|
||||
import { boolean } from "astro:schema";
|
||||
import SanierungsOption from "#components/Ausweis/SanierungsOption.svelte";
|
||||
import { BedarfsausweisWohnen } from "#lib/client/prisma.js";
|
||||
|
||||
export let objekt: ObjektClient;
|
||||
export let aufnahme: AufnahmeClient;
|
||||
export let ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient;
|
||||
export let ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient | BedarfsausweisWohnen;
|
||||
export let images: BildClient[];
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { Enums } from "#lib/client/prisma.js";
|
||||
import { BedarfsausweisWohnen, Enums } from "#lib/client/prisma.js";
|
||||
import HeizungImage from "./HeizungImage.svelte";
|
||||
|
||||
import {
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
export let objekt: ObjektClient;
|
||||
export let aufnahme: AufnahmeClient;
|
||||
export let ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient;
|
||||
export let ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient | BedarfsausweisWohnen;
|
||||
export let images: BildClient[];
|
||||
|
||||
export let ausweisart: Enums.Ausweisart;
|
||||
|
||||
@@ -265,7 +265,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
disabled={!ausweis.brennstoff_1}
|
||||
required
|
||||
>
|
||||
<option disabled selected >Bitte auswählen</option>
|
||||
<option disabled selected value={null}>Bitte auswählen</option>
|
||||
{#each fuelMap.hasOwnProperty(ausweis.brennstoff_1) ? fuelMap[ausweis.brennstoff_1] : [] as unit}
|
||||
<option value={unit}>{unit}</option>
|
||||
{/each}
|
||||
@@ -423,7 +423,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
bind:value={ausweis.brennstoff_2}
|
||||
required
|
||||
>
|
||||
<option disabled selected
|
||||
<option disabled selected value={null}
|
||||
>Bitte auswählen</option
|
||||
>
|
||||
{#each Object.keys(fuelMap) as fuel}
|
||||
@@ -458,7 +458,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
disabled={!ausweis.brennstoff_2}
|
||||
required
|
||||
>
|
||||
<option disabled selected
|
||||
<option disabled selected value={null}
|
||||
>Bitte auswählen</option
|
||||
>
|
||||
{#each fuelMap.hasOwnProperty(ausweis.brennstoff_2) ? fuelMap[ausweis.brennstoff_2] : [] as unit}
|
||||
|
||||
@@ -236,7 +236,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
bind:value={ausweis.brennstoff_1}
|
||||
required
|
||||
>
|
||||
<option disabled selected value>Bitte auswählen</option>
|
||||
<option disabled selected value={null}>Bitte auswählen</option>
|
||||
{#each Object.keys(fuelMap) as fuel}
|
||||
<option value={fuel}>{fuel}</option>
|
||||
{/each}
|
||||
@@ -276,7 +276,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
disabled={!ausweis.brennstoff_1}
|
||||
required
|
||||
>
|
||||
<option disabled selected value>Bitte auswählen</option>
|
||||
<option disabled selected value={null}>Bitte auswählen</option>
|
||||
{#each fuelMap.hasOwnProperty(ausweis.brennstoff_1) ? fuelMap[ausweis.brennstoff_1] : [] as unit}
|
||||
<option value={unit}>{unit}</option>
|
||||
{/each}
|
||||
@@ -440,7 +440,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
required
|
||||
data-cy="brennstoff_2"
|
||||
>
|
||||
<option disabled selected
|
||||
<option disabled selected value={null}
|
||||
>Bitte auswählen</option
|
||||
>
|
||||
{#each Object.keys(fuelMap) as fuel}
|
||||
@@ -483,7 +483,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
disabled={!ausweis.brennstoff_2}
|
||||
required
|
||||
>
|
||||
<option disabled selected
|
||||
<option disabled selected value={null}
|
||||
>Bitte auswählen</option
|
||||
>
|
||||
{#each fuelMap.hasOwnProperty(ausweis.brennstoff_2) ? fuelMap[ausweis.brennstoff_2] : [] as unit}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
export let objekt: ObjektKomplettClient;
|
||||
</script>
|
||||
|
||||
<div class=" bg-white grid grid-cols-3 md:grid-cols-3 lg:grid-cols-3 gap-4">
|
||||
<div class=" bg-white grid grid-cols-1 md:grid-cols-3 lg:grid-cols-3 gap-4">
|
||||
{#if objekt.aufnahmen.length > 0}
|
||||
{@const bild = objekt.aufnahmen[0].bilder.find(bild => bild.kategorie === Enums.BilderKategorie.Gebaeude)}
|
||||
<div>
|
||||
@@ -21,18 +21,14 @@
|
||||
{/if}
|
||||
|
||||
<div class="flex gap-4">
|
||||
<div>
|
||||
{#if objekt.aufnahmen.at(-1)?.verbrauchsausweise_wohnen.length}
|
||||
<a href="/pdf/ansichtsausweis?id={objekt.aufnahmen.at(-1)?.verbrauchsausweise_wohnen.at(-1).id}" target="_blank">
|
||||
<div class="inline-block border rounded-lg bg-white">
|
||||
<img src="/public/images/dashboard/ausweishaken.jpg" class="h-auto w-auto max-h-[150px] max-w-full object-contain p-1" alt="Energieausweis ausgestellt">
|
||||
<img src="/images/dashboard/ausweishaken.jpg" class="h-auto w-auto max-h-[150px] max-w-full object-contain p-1" alt="Energieausweis ausgestellt">
|
||||
</div>
|
||||
<div class="text-sm text-center">Energieausweis</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="inline-block border rounded-lg bg-white">
|
||||
<img src="/public/images/dashboard/ausweishaken.jpg" class="h-auto w-auto max-h-[150px] max-w-full object-contain p-1" alt="Energieausweis ausgestellt">
|
||||
</div>
|
||||
<div class="text-sm text-center">Energieausweis</div>
|
||||
</div>
|
||||
</a>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="flex flex-col gap-4">
|
||||
{#each objekt.aufnahmen as aufnahme}
|
||||
@@ -42,12 +38,6 @@
|
||||
<a href="/dashboard/aufnahme/{aufnahme.id}" class="rounded-lg p-2 hover:bg-gray-100"><OpenInNewWindow size={30}></OpenInNewWindow></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="inline-block border rounded-lg px-4 py-2 w-full">
|
||||
<div class="flex justify-between items-center w-full">
|
||||
<span class="text-sm">Detailübersicht<br>Stand vom {moment(aufnahme.erstellungsdatum).format("DD.MM.YYYY")}</span>
|
||||
<a href="/dashboard/aufnahme/{aufnahme.id}" class="rounded-lg p-2 hover:bg-gray-100"><OpenInNewWindow size={30}></OpenInNewWindow></a>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
AufnahmeClient
|
||||
} from "#components/Ausweis/types.js";
|
||||
|
||||
import ButtonSpaeterHilfe from "#components/Ausweis/ButtonSpaeterHilfe.svelte";
|
||||
|
||||
export let ausweis: BedarfsausweisWohnenClient;
|
||||
export let objekt: ObjektClient
|
||||
@@ -36,9 +35,9 @@
|
||||
export let user: BenutzerClient = {} as BenutzerClient;
|
||||
export let ausweistyp: Enums.AusweisTyp
|
||||
export let bilder: BildClient[] = []
|
||||
export let uid: string;
|
||||
export let id: string;
|
||||
|
||||
if (!uid && (!ausweis.updated_at || moment(localStorage.getItem("bedarfsausweis-wohnen.updated_at") || new Date()).isAfter(ausweis.updated_at))) {
|
||||
if (((user && user.rolle !== Enums.BenutzerRolle.ADMIN) || !user) && !id && (!ausweis.updated_at || moment(localStorage.getItem("bedarfsausweis-wohnen.updated_at") || new Date()).isAfter(ausweis.updated_at))) {
|
||||
const localStorageAusweis = localStorage.getItem("bedarfsausweis-wohnen.ausweis");
|
||||
if (localStorageAusweis) {
|
||||
ausweis = JSON.parse(localStorageAusweis)
|
||||
@@ -61,68 +60,21 @@
|
||||
}
|
||||
|
||||
$: {
|
||||
if (!blockLocalStorageSync) {
|
||||
localStorage.setItem("bedarfsausweis-wohnen.ausweis", JSON.stringify(ausweis))
|
||||
localStorage.setItem("bedarfsausweis-wohnen.aufnahme", JSON.stringify(aufnahme))
|
||||
localStorage.setItem("bedarfsausweis-wohnen.objekt", JSON.stringify(objekt))
|
||||
localStorage.setItem("bedarfsausweis-wohnen.bilder", JSON.stringify(bilder))
|
||||
localStorage.setItem("bedarfsausweis-wohnen.updated_at", moment().toString())
|
||||
}
|
||||
|
||||
let daemmungsBreiten = [0, 0.02, 0.05, 0.08, 0.12, 0.16, 0.2, 0.3, 0.4];
|
||||
|
||||
let fensterArten = {
|
||||
Einfachverglasung: 5,
|
||||
"Holzfenster Doppelverglasung": 2.7,
|
||||
"Kunststofffenster Doppelverglasung": 3,
|
||||
"Alu- oder Stahlfenster Doppelverglasung": 4.3,
|
||||
"Fenster Doppelverglasung (ab 1995)": 1.8,
|
||||
"Fenster Doppelverglasung (U-Wert 1,1)": 1.1,
|
||||
"Dreifach-Wärmeschutzverglasung(U-Wert 0,9)": 0.9,
|
||||
"Dreifach-Wärmeschutzverglasung(U-Wert 0,85)": 0.85,
|
||||
"Passivhausfenster(U-Wert 0,7)": 0.7,
|
||||
"Passivhausfenster(U-Wert 0,6)": 0.6,
|
||||
"Fenster mit U-Wert 2,3": 2.3,
|
||||
"Fenster mit U-Wert 1,6": 1.6,
|
||||
"Fenster mit U-Wert 1,7": 1.7,
|
||||
"Fenster mit U-Wert 1,3": 1.3,
|
||||
"Fenster mit U-Wert 1": 1,
|
||||
};
|
||||
|
||||
async function spaeterWeitermachen() {
|
||||
// const result = await verbrauchsausweisWohnenSpeichern(
|
||||
// ausweis,
|
||||
// gebaeude,
|
||||
// aufnahme,
|
||||
// images,
|
||||
// user
|
||||
// );
|
||||
// if (result !== null) {
|
||||
// // Falls der Nutzer zurück navigiert, sollte er wieder auf seinen Vorgang kommen.
|
||||
// // Sonst müsste er alles neu eingeben...
|
||||
// ausweis.uid = result.uid;
|
||||
// gebaeude.uid = result.gebaeude_uid;
|
||||
// aufnahme.uid = result.gebaeude_aufnahme_uid;
|
||||
// window.history.pushState(
|
||||
// {},
|
||||
// "",
|
||||
// `${location.pathname}?uid=${result.uid}`
|
||||
// );
|
||||
// speichernOverlayHidden = false;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
const arrayRange = (start: number, stop: number, step: number) =>
|
||||
Array.from(
|
||||
{ length: (stop - start) / step + 1 },
|
||||
(value, index) => start + index * step
|
||||
);
|
||||
|
||||
const ausweisart = Enums.Ausweisart.BedarfsausweisWohnen
|
||||
const anliegen = "Energieausweis erstellen";
|
||||
|
||||
let form: HTMLFormElement;
|
||||
let skala: HTMLDivElement;
|
||||
let blockLocalStorageSync: boolean = false;
|
||||
</script>
|
||||
|
||||
|
||||
@@ -143,7 +95,19 @@
|
||||
<div id="formular-box" class="formular-boxen ring-0">
|
||||
|
||||
|
||||
<ButtonSpaeterHilfe {spaeterWeitermachen} />
|
||||
<ButtonWeiterHilfe
|
||||
bind:ausweis
|
||||
bind:bilder
|
||||
bind:user
|
||||
bind:objekt
|
||||
bind:aufnahme
|
||||
bind:blockLocalStorageSync
|
||||
{ausweisart}
|
||||
showWeiter={false}
|
||||
{form}
|
||||
{skala}
|
||||
>
|
||||
</ButtonWeiterHilfe>
|
||||
|
||||
<!-- A Prüfung der Ausweisart -->
|
||||
|
||||
@@ -240,16 +204,19 @@ title="Angabe zu Lüftung und Kühlung"
|
||||
|
||||
</div>
|
||||
|
||||
<ButtonWeiterHilfe {spaeterWeitermachen}
|
||||
<ButtonWeiterHilfe
|
||||
bind:ausweis
|
||||
bind:bilder
|
||||
bind:user
|
||||
bind:objekt
|
||||
bind:aufnahme
|
||||
ausweisart={Enums.Ausweisart.BedarfsausweisWohnen}
|
||||
bind:blockLocalStorageSync
|
||||
{ausweisart}
|
||||
showWeiter={true}
|
||||
{form}
|
||||
{skala}
|
||||
/>
|
||||
>
|
||||
</ButtonWeiterHilfe>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
@@ -42,16 +42,17 @@
|
||||
} from "#components/Notifications/index.js";
|
||||
|
||||
export let ausweis: VerbrauchsausweisGewerbeClient;
|
||||
export let user: BenutzerClient;
|
||||
export let user: BenutzerClient | null;
|
||||
export let objekt: ObjektClient;
|
||||
export let ausweistyp: Enums.AusweisTyp;
|
||||
export let aufnahme: AufnahmeClient;
|
||||
export let bilder: BildClient[];
|
||||
export let id: string | null;
|
||||
|
||||
const ausweisart = Enums.Ausweisart.VerbrauchsausweisGewerbe
|
||||
const anliegen = "Energieausweis erstellen";
|
||||
|
||||
if (!ausweis.updated_at || moment(localStorage.getItem("verbrauchsausweis-gewerbe.updated_at") || new Date()).isAfter(ausweis.updated_at)) {
|
||||
if (((user && user.rolle !== Enums.BenutzerRolle.ADMIN) || !user) && !id && (!ausweis.updated_at || moment(localStorage.getItem("verbrauchsausweis-gewerbe.updated_at") || new Date()).isAfter(ausweis.updated_at))) {
|
||||
const localStorageAusweis = localStorage.getItem("verbrauchsausweis-gewerbe.ausweis");
|
||||
if (localStorageAusweis) {
|
||||
ausweis = JSON.parse(localStorageAusweis)
|
||||
@@ -74,13 +75,16 @@
|
||||
}
|
||||
|
||||
$: {
|
||||
if (!blockLocalStorageSync) {
|
||||
localStorage.setItem("verbrauchsausweis-gewerbe.ausweis", JSON.stringify(ausweis))
|
||||
localStorage.setItem("verbrauchsausweis-gewerbe.aufnahme", JSON.stringify(aufnahme))
|
||||
localStorage.setItem("verbrauchsausweis-gewerbe.objekt", JSON.stringify(objekt))
|
||||
localStorage.setItem("verbrauchsausweis-gewerbe.bilder", JSON.stringify(bilder))
|
||||
localStorage.setItem("verbrauchsausweis-gewerbe.updated_at", moment().toString())
|
||||
}
|
||||
}
|
||||
|
||||
let blockLocalStorageSync: boolean = false;
|
||||
let form: HTMLFormElement;
|
||||
let skala: HTMLDivElement;
|
||||
</script>
|
||||
@@ -114,6 +118,7 @@
|
||||
bind:user
|
||||
bind:objekt
|
||||
bind:aufnahme
|
||||
bind:blockLocalStorageSync
|
||||
ausweisart={Enums.Ausweisart.VerbrauchsausweisGewerbe}
|
||||
showWeiter={false}
|
||||
{form}
|
||||
@@ -229,6 +234,7 @@
|
||||
bind:user
|
||||
bind:objekt
|
||||
bind:aufnahme
|
||||
bind:blockLocalStorageSync
|
||||
ausweisart={Enums.Ausweisart.VerbrauchsausweisGewerbe}
|
||||
showWeiter={true}
|
||||
{form}
|
||||
|
||||
@@ -3,6 +3,8 @@ import { prisma } from "#lib/server/prisma.js";
|
||||
import { defineApiRoute } from "astro-typesafe-api/server";
|
||||
import { UUidWithPrefix } from "#components/Ausweis/types.js";
|
||||
import { TicketsSchema } from "src/generated/zod/tickets.js";
|
||||
import { generatePrefixedId } from "#lib/db.js";
|
||||
import { VALID_UUID_PREFIXES } from "#lib/constants.js";
|
||||
|
||||
export const PUT = defineApiRoute({
|
||||
meta: {
|
||||
@@ -20,23 +22,22 @@ export const PUT = defineApiRoute({
|
||||
id: true,
|
||||
prioritaet: true,
|
||||
status: true,
|
||||
uid: true,
|
||||
updated_at: true,
|
||||
}),
|
||||
output: z.object({
|
||||
uid: UUidWithPrefix,
|
||||
id: UUidWithPrefix,
|
||||
}),
|
||||
async fetch(input, ctx) {
|
||||
const id = generatePrefixedId(6, VALID_UUID_PREFIXES.Ticket)
|
||||
|
||||
const ticket = await prisma.tickets.create({
|
||||
data: {
|
||||
id,
|
||||
beschreibung: input.beschreibung,
|
||||
email: input.email,
|
||||
titel: input.titel,
|
||||
metadata: input.metadata,
|
||||
},
|
||||
select: {
|
||||
uid: true,
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
// Das sind die Label IDs von Trello
|
||||
@@ -71,7 +72,7 @@ export const PUT = defineApiRoute({
|
||||
|
||||
|
||||
return {
|
||||
uid: ticket.uid,
|
||||
id: ticket.id,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,112 +1,85 @@
|
||||
---
|
||||
import AusweisLayout from "#layouts/AusweisLayoutDaten.astro";
|
||||
import { AufnahmeClient, ObjektClient, BildClient, VerbrauchsausweisGewerbeClient } from "#components/Ausweis/types";
|
||||
import { createCaller } from "src/astro-typesafe-api-caller";
|
||||
import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants";
|
||||
import { validateAccessTokenServer } from "#server/lib/validateAccessToken";
|
||||
import VerbrauchsausweisGewerbeModule from "#modules/VerbrauchsausweisGewerbe/VerbrauchsausweisGewerbeModule.svelte";
|
||||
import { Enums } from "#lib/server/prisma";
|
||||
import { Aufnahme, Enums, Objekt, VerbrauchsausweisGewerbe } from "#lib/server/prisma";
|
||||
import { getAufnahme, getObjekt, getBilder, getVerbrauchsausweisGewerbe } from "#lib/server/db";
|
||||
import { getCurrentUser } from "#lib/server/user";
|
||||
|
||||
const id = Astro.url.searchParams.get("uid");
|
||||
const id = Astro.url.searchParams.get("id");
|
||||
const aufnahme_id = Astro.url.searchParams.get("aufnahme")
|
||||
const ausweistyp = Astro.url.searchParams.get("ausweistyp") || Enums.AusweisTyp.Standard;
|
||||
let ausweistyp = Astro.url.searchParams.get("ausweistyp") as Enums.AusweisTyp || Enums.AusweisTyp.Standard;
|
||||
|
||||
let ausweis: VerbrauchsausweisGewerbeClient = {} as VerbrauchsausweisGewerbeClient;
|
||||
let aufnahme: AufnahmeClient = {} as AufnahmeClient;
|
||||
let objekt: ObjektClient = {} as ObjektClient;
|
||||
let bilder: BildClient[] = []
|
||||
|
||||
const valid = validateAccessTokenServer(Astro);
|
||||
|
||||
const caller = createCaller(Astro);
|
||||
const user = await getCurrentUser(Astro)
|
||||
|
||||
if (id) {
|
||||
if (!valid) {
|
||||
if (!user) {
|
||||
return Astro.redirect(
|
||||
`/auth/login?redirect=${Astro.url.toString()}`
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
let { aufnahme_id, objekt_id, benutzer_id, ...result } = await caller["verbrauchsausweis-gewerbe"]._id.GET.fetch(null, {
|
||||
headers: {
|
||||
authorization: `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}`
|
||||
},
|
||||
params: {
|
||||
id
|
||||
}
|
||||
});
|
||||
ausweis = await getVerbrauchsausweisGewerbe(id) as VerbrauchsausweisGewerbe
|
||||
|
||||
ausweis = result
|
||||
|
||||
aufnahme = await caller.aufnahme._id.GET.fetch(null, {
|
||||
headers: {
|
||||
authorization: `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}`
|
||||
},
|
||||
params: {
|
||||
id: aufnahme_id
|
||||
}
|
||||
})
|
||||
|
||||
objekt = await caller.objekt._id.GET.fetch(null, {
|
||||
headers: {
|
||||
authorization: `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}`
|
||||
},
|
||||
params: {
|
||||
id: objekt_id
|
||||
}
|
||||
})
|
||||
|
||||
bilder = await caller.aufnahme._id.bilder.GET.fetch(null, {
|
||||
headers: {
|
||||
authorization: `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}`
|
||||
},
|
||||
params: {
|
||||
id: aufnahme_id
|
||||
}
|
||||
})
|
||||
|
||||
if (!ausweis) {
|
||||
if (!ausweis || ausweis.benutzer_id !== user.id) {
|
||||
// Der Ausweis scheint nicht zu existieren.
|
||||
// Wir leiten auf die generische Ausweisseite ohne UID weiter.
|
||||
// Wir leiten auf die generische Ausweisseite ohne ID weiter.
|
||||
return Astro.redirect(
|
||||
"/energieausweis-erstellen/verbrauchsausweis-gewerbe"
|
||||
"/energieausweis-erstellen/verbrauchsausweis-wohngebaeude"
|
||||
);
|
||||
}
|
||||
} catch(e) {
|
||||
|
||||
aufnahme = await getAufnahme(ausweis.aufnahme_id) as Aufnahme
|
||||
|
||||
if (!aufnahme) {
|
||||
// Die Aufnahme existiert nicht, das sollte eigentlich nicht passieren aber so können wir nicht fortfahren.
|
||||
return Astro.redirect(
|
||||
"/energieausweis-erstellen/verbrauchsausweis-gewerbe"
|
||||
"/energieausweis-erstellen/verbrauchsausweis-wohngebaeude"
|
||||
);
|
||||
}
|
||||
|
||||
objekt = await getObjekt(aufnahme.objekt_id) as Objekt
|
||||
|
||||
if (!objekt) {
|
||||
// Das Objekt existiert nicht, das sollte eigentlich nicht passieren aber so können wir nicht fortfahren.
|
||||
return Astro.redirect(
|
||||
"/energieausweis-erstellen/verbrauchsausweis-wohngebaeude"
|
||||
);
|
||||
}
|
||||
|
||||
bilder = await getBilder(aufnahme.id);
|
||||
} else if (aufnahme_id) {
|
||||
if (!valid) {
|
||||
if (!user) {
|
||||
return Astro.redirect(
|
||||
`/auth/login?redirect=${Astro.url.toString()}`
|
||||
);
|
||||
}
|
||||
|
||||
let { objekt_id, ...result} = await caller.aufnahme._id.GET.fetch(null, {
|
||||
headers: {
|
||||
authorization: `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}`
|
||||
},
|
||||
params: {
|
||||
id: aufnahme_id
|
||||
}
|
||||
})
|
||||
aufnahme = await getAufnahme(ausweis.aufnahme_id) as Aufnahme
|
||||
|
||||
aufnahme = result;
|
||||
|
||||
objekt = await caller.objekt._id.GET.fetch(null, {
|
||||
headers: {
|
||||
authorization: `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}`
|
||||
},
|
||||
params: {
|
||||
id: objekt_id
|
||||
if (!aufnahme) {
|
||||
// Die Aufnahme existiert wohl nicht.
|
||||
return Astro.redirect(
|
||||
"/energieausweis-erstellen/verbrauchsausweis-wohngebaeude"
|
||||
);
|
||||
}
|
||||
|
||||
objekt = await getObjekt(aufnahme.objekt_id) as Objekt
|
||||
|
||||
if (!objekt) {
|
||||
// Das Objekt existiert nicht.
|
||||
return Astro.redirect(
|
||||
"/energieausweis-erstellen/verbrauchsausweis-wohngebaeude"
|
||||
);
|
||||
}
|
||||
})
|
||||
}
|
||||
---
|
||||
|
||||
<AusweisLayout title="Verbrauchsausweis Gewerbe erstellen | IBCornelsen">
|
||||
<VerbrauchsausweisGewerbeModule client:only {ausweis} {objekt} {aufnahme} {bilder} {ausweistyp} />
|
||||
<VerbrauchsausweisGewerbeModule client:only {ausweis} {objekt} {aufnahme} {bilder} {ausweistyp} {user} {id} />
|
||||
</AusweisLayout>
|
||||
Reference in New Issue
Block a user