Ausweis Prüfen und Email

This commit is contained in:
Moritz Utcke
2024-02-29 11:09:23 +07:00
parent 0341ea4526
commit 022fe20524
9 changed files with 501 additions and 343 deletions

View File

@@ -56,12 +56,14 @@
"sass": "^1.62.1", "sass": "^1.62.1",
"svelte": "^3.59.1", "svelte": "^3.59.1",
"svelte-dialogs": "^1.2.2", "svelte-dialogs": "^1.2.2",
"svelte-katex": "^0.1.2",
"svelte-preprocess": "^5.0.3", "svelte-preprocess": "^5.0.3",
"svelte-ripple-action": "^1.0.5", "svelte-ripple-action": "^1.0.5",
"svelte-tabs": "^1.1.0", "svelte-tabs": "^1.1.0",
"tailwindcss": "^3.3.2", "tailwindcss": "^3.3.2",
"trpc-openapi": "^1.2.0", "trpc-openapi": "^1.2.0",
"uuid": "^9.0.0", "uuid": "^9.0.0",
"uuid-validate": "^0.0.3",
"vite-tsconfig-paths": "^4.2.0", "vite-tsconfig-paths": "^4.2.0",
"zod": "^3.22.4" "zod": "^3.22.4"
}, },

View File

@@ -6,23 +6,23 @@
} from "./Ausweis/types.js"; } from "./Ausweis/types.js";
import AusweisPruefenTooltip from "./AusweisPruefenTooltip.svelte"; import AusweisPruefenTooltip from "./AusweisPruefenTooltip.svelte";
import { addNotification } from "./NotificationProvider/shared"; import { addNotification } from "./NotificationProvider/shared";
import { CheckCircled, CrossCircled, Image } from "radix-svelte-icons";
import ChevronDown from "radix-svelte-icons/src/lib/icons/ChevronDown.svelte";
export let ausweis: VerbrauchsausweisWohnenClient; export let ausweis: VerbrauchsausweisWohnenClient;
export let calculations: Awaited< export let calculations: Awaited<
ReturnType<typeof endEnergieVerbrauchVerbrauchsausweis_2016> ReturnType<typeof endEnergieVerbrauchVerbrauchsausweis_2016>
>; >;
console.log(ausweis);
const gebaeude_aufnahme_allgemein = ausweis.gebaeude_aufnahme_allgemein const gebaeude_aufnahme_allgemein = ausweis.gebaeude_aufnahme_allgemein
const ausweisArt = "VA"; // TODO: Das ist ein Platzhalter, hier muss die Ausweisart aus dem Ausweisobjekt kommen const ausweisArt = "VA"; // TODO: Das ist ein Platzhalter, hier muss die Ausweisart aus dem Ausweisobjekt kommen
const images = ausweis.gebaeude_aufnahme_allgemein.gebaeude_stammdaten.gebaeude_bilder;
try {
// TODO: In Zukunft sollen die Bilder von unserer API kommen, das ist allerdings noch nicht ganz fertig.
// images = JSON.parse(ausweis.images)
} catch (e) {}
let verbrauchWWGesamt_1 = ""; let verbrauchWWGesamt_1 = "";
let verbrauchWWGesamt_2 = ""; let verbrauchWWGesamt_2 = "";
@@ -448,328 +448,429 @@
ausweis = ausweis; ausweis = ausweis;
} }
let bilderModal: HTMLDialogElement;
let infoVisible = false;
</script> </script>
<table class="table table-row border"> <div class="border rounded-box">
<tbody> <table class="table table-row">
<tr> <tbody>
<td width="30px" <tr>
><img <td><button on:click={() => infoVisible = !infoVisible}><ChevronDown size={22} class="transition-all {infoVisible ? "" : "rotate-180"}"></ChevronDown></button></td>
src="{StatusIcon}" <td class="w-6 px-2"
alt="Status"
class="w-8 h-8 max-w-8 max-h-8"
/>{zurueckGestellt}</td
>
<td width="150px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>{gebaeude_aufnahme_allgemein.adresse} {gebaeude_aufnahme_allgemein.plz} {gebaeude_aufnahme_allgemein.ort}</span>
<br>
<span>{gebaeude_aufnahme_allgemein.gebaeudetyp}, Einheiten: {gebaeude_aufnahme_allgemein.einheiten}</span>
</div>
<span>{ausweisArt} - {ausweis.uid.split("-")[0]}</span>
<span>{moment(gebaeude_aufnahme_allgemein.erstellungsdatum).format("DD.MM.YYYY")}</span>
</AusweisPruefenTooltip></td
>
<td width="35px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>Baujahr Gebäude / Baujahr Heizung</span>
</div>
<span>{gebaeude_aufnahme_allgemein.baujahr_gebaeude.join(", ")}</span>
<span>{gebaeude_aufnahme_allgemein.baujahr_heizung.join(", ")}</span>
</AusweisPruefenTooltip>
<div class="tooltip" data-tip="">
</div></td
>
<td width="45px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>Wohnfläche in m²</span>
<br>
<span>{gebaeude_aufnahme_allgemein.faktorKeller} x {gebaeude_aufnahme_allgemein.flaeche}m² Energetische Nutzfläche (Keller {gebaeude_aufnahme_allgemein.keller}) in m²</span>
</div>
<span>{gebaeude_aufnahme_allgemein.flaeche}</span>
<span><strong>{calculations?.energetische_nutzfläche}</strong></span>
</AusweisPruefenTooltip>
</td
>
<td width="90px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>{tooltip4Z1}</span>
<br>
<span>{tooltip4Z2}</span>
</div>
<span>{table4Z1}</span>
<span>{table4Z2}</span>
</AusweisPruefenTooltip></td
>
<td width="70px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>{tooltip5Z1}</span>
<br>
<span>{tooltip5Z2}</span>
<br>
<span>{tooltip5Z3}</span>
</div>
<span>{table5Z1}</span>
<span>{table5Z2}</span>
</AusweisPruefenTooltip>
</td
>
<td width="50px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>{tooltip6Z1}</span>
<br>
<span>{tooltip6Z2}</span>
</div>
<span><strong>{table6Z1}</strong></span>
<span><strong>{table6Z2}</strong></span>
</AusweisPruefenTooltip></td
>
<td width="90px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>{tooltip7Z1}</span>
<br>
<span>{tooltip7Z2}</span>
</div>
<span>{table7Z1}</span>
<span>{table7Z2}</span>
</AusweisPruefenTooltip></td
>
<td width="60px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>{tooltip8Z1}</span>
<br>
<span>{tooltip8Z2}</span>
</div>
<span>{table8Z1}</span>
<span>{table8Z2}</span>
</AusweisPruefenTooltip></td
>
<td width="50px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>{tooltip9Z1}</span>
<br>
<span>{tooltip9Z2}</span>
</div>
<span>{table9Z1}</span>
<span><strong>{table9Z2}</strong></span>
</AusweisPruefenTooltip></td
>
<td width="100px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>{tooltip10Z1}</span>
<br>
<span>{tooltip10Z2}</span>
</div>
<span>{table10Z1}</span>
<span>{table10Z2}</span>
</AusweisPruefenTooltip></td
>
<td width="110px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>{tooltip11Z1}</span>
<br>
<span>{tooltip11Z2}</span>
</div>
<span>{table11Z1}</span>
<span>{table11Z2}</span>
</AusweisPruefenTooltip></td
>
<td width="50px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>{tooltip12Z1}</span>
<br>
<span>{tooltip12Z2}</span>
</div>
<span>{table12Z1}</span>
<span>{table12Z2}</span>
</AusweisPruefenTooltip>
</td
>
<td width="60px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>{tooltip13Z1}</span>
<br>
<span>{tooltip13Z2}</span>
</div>
<span>{table13Z1}</span>
<span>{table13Z2}</span>
</AusweisPruefenTooltip>
</td
>
<td width="45px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>{tooltip14Z1}</span>
<br>
<span>{tooltip14Z2}</span>
</div>
<span>{table14Z1}</span>
<span>{table14Z2}</span>
</AusweisPruefenTooltip>
</td
>
<td width="45px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>{tooltip15Z1}</span>
<br>
<span>{tooltip15Z2}</span>
</div>
<span><strong>{table15Z1}</strong></span>
<span><strong>{table15Z2}</strong></span>
</AusweisPruefenTooltip>
</td
>
<td width="50px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>{tooltip16Z1}</span>
<br>
<span>{tooltip16Z2}</span>
</div>
<span><strong>{table16Z1}</strong></span>
<span><strong>{table16Z2}</strong></span>
</AusweisPruefenTooltip>
</td
>
<td title="Gebäudebilder anzeigen" width="35px"
><div
class="imagePreview"
data-imagePreview="{imagePreview}"
>
<img
src="/images/dashboard/SymbolBilder.svg"
alt="Gebäudebilder"
width="35"
height="35"
/>
</div></td
>
<td width="30px"
><div class="checkTextPreviewButton">
<img src="{symbolPruefung}" alt="Boxpruefung" />
<div
class="checkTextPreview"
style="display:none; position: absolute; background-color: black; color: white; padding: 10px; border-radius: 5px; max-width: 450px; z-index:9999;"
> >
{gebaeude_aufnahme_allgemein.prueftext} {#if gebaeude_aufnahme_allgemein.erledigt}
<div class="tooltip" data-tip="Ausweis wurde ausgestellt">
<div class="rounded-full w-6 h-6 bg-success"></div>
</div>
{:else if gebaeude_aufnahme_allgemein.bestellt}
<div class="tooltip" data-tip="Ausweis wurde bestellt">
<div class="rounded-full w-6 h-6 bg-warning"></div>
</div>
{:else}
<div class="tooltip" data-tip="Ausweis ist in Bearbeitung">
<div class="rounded-full w-6 h-6 bg-error"></div>
</div>
{/if}
</td
>
<td width="150px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>{gebaeude_aufnahme_allgemein.adresse} {gebaeude_aufnahme_allgemein.plz} {gebaeude_aufnahme_allgemein.ort}</span>
<br>
<span>{gebaeude_aufnahme_allgemein.gebaeudetyp}, Einheiten: {gebaeude_aufnahme_allgemein.einheiten}</span>
</div>
<span>{ausweisArt} - {ausweis.uid.split("-")[0]}</span>
<span>{moment(gebaeude_aufnahme_allgemein.erstellungsdatum).format("DD.MM.YYYY")}</span>
</AusweisPruefenTooltip></td
>
<td width="35px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>Baujahr Gebäude / Baujahr Heizung</span>
</div>
<span>{gebaeude_aufnahme_allgemein.baujahr_gebaeude.join(", ")}</span>
<span>{gebaeude_aufnahme_allgemein.baujahr_heizung.join(", ")}</span>
</AusweisPruefenTooltip>
<div class="tooltip" data-tip="">
</div></td
>
<td width="45px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>Wohnfläche in m²</span>
<br>
<span>{gebaeude_aufnahme_allgemein.faktorKeller} x {gebaeude_aufnahme_allgemein.flaeche}m² Energetische Nutzfläche (Keller {gebaeude_aufnahme_allgemein.keller}) in m²</span>
</div>
<span>{gebaeude_aufnahme_allgemein.flaeche}</span>
<span><strong>{calculations?.energetische_nutzfläche}</strong></span>
</AusweisPruefenTooltip>
</td
>
<td width="90px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>{tooltip4Z1}</span>
<br>
<span>{tooltip4Z2}</span>
</div>
<span>{table4Z1}</span>
<span>{table4Z2}</span>
</AusweisPruefenTooltip></td
>
<td width="70px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>{tooltip5Z1}</span>
<br>
<span>{tooltip5Z2}</span>
<br>
<span>{tooltip5Z3}</span>
</div>
<span>{table5Z1}</span>
<span>{table5Z2}</span>
</AusweisPruefenTooltip>
</td
>
<td width="50px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>{tooltip6Z1}</span>
<br>
<span>{tooltip6Z2}</span>
</div>
<span><strong>{table6Z1}</strong></span>
<span><strong>{table6Z2}</strong></span>
</AusweisPruefenTooltip></td
>
<td width="90px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>{tooltip7Z1}</span>
<br>
<span>{tooltip7Z2}</span>
</div>
<span>{table7Z1}</span>
<span>{table7Z2}</span>
</AusweisPruefenTooltip></td
>
<td width="60px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>{tooltip8Z1}</span>
<br>
<span>{tooltip8Z2}</span>
</div>
<span>{table8Z1}</span>
<span>{table8Z2}</span>
</AusweisPruefenTooltip></td
>
<td width="50px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>{tooltip9Z1}</span>
<br>
<span>{tooltip9Z2}</span>
</div>
<span>{table9Z1}</span>
<span><strong>{table9Z2}</strong></span>
</AusweisPruefenTooltip></td
>
<td width="100px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>{tooltip10Z1}</span>
<br>
<span>{tooltip10Z2}</span>
</div>
<span>{table10Z1}</span>
<span>{table10Z2}</span>
</AusweisPruefenTooltip></td
>
<td width="110px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>{tooltip11Z1}</span>
<br>
<span>{tooltip11Z2}</span>
</div>
<span>{table11Z1}</span>
<span>{table11Z2}</span>
</AusweisPruefenTooltip></td
>
<td width="50px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>{tooltip12Z1}</span>
<br>
<span>{tooltip12Z2}</span>
</div>
<span>{table12Z1}</span>
<span>{table12Z2}</span>
</AusweisPruefenTooltip>
</td
>
<td width="60px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>{tooltip13Z1}</span>
<br>
<span>{tooltip13Z2}</span>
</div>
<span>{table13Z1}</span>
<span>{table13Z2}</span>
</AusweisPruefenTooltip>
</td
>
<td width="45px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>{tooltip14Z1}</span>
<br>
<span>{tooltip14Z2}</span>
</div>
<span>{table14Z1}</span>
<span>{table14Z2}</span>
</AusweisPruefenTooltip>
</td
>
<td width="45px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>{tooltip15Z1}</span>
<br>
<span>{tooltip15Z2}</span>
</div>
<span><strong>{table15Z1}</strong></span>
<span><strong>{table15Z2}</strong></span>
</AusweisPruefenTooltip>
</td
>
<td width="50px"
>
<AusweisPruefenTooltip>
<div slot="tooltip">
<span>{tooltip16Z1}</span>
<br>
<span>{tooltip16Z2}</span>
</div>
<span><strong>{table16Z1}</strong></span>
<span><strong>{table16Z2}</strong></span>
</AusweisPruefenTooltip>
</td
>
<td title="Gebäudebilder anzeigen"
><!-- Open the modal using ID.showModal() method -->
<button class="btn btn-square" on:click={() => bilderModal.showModal()}><Image size={22}></Image></button>
<dialog bind:this={bilderModal} class="modal">
<div class="modal-box flex flex-row gap-4 items-center justify-center">
{#if images.length === 0}
<div class="flex flex-col gap-4 items-center justify-center">
<p>Für diesen Ausweis sind noch keine Bilder vorhanden.</p>
<button class="btn btn-primary" tabindex="0">Erinnerung Verschicken</button>
</div>
{:else}
{#each images as image}
<div>
<h2 class="text-lg mb-4 font-bold">{image.kategorie}</h2>
<img src="/bilder/{image.uid}.webp">
</div> </div>
</div></td {/each}
> {/if}
<td title="Ausweis anzeigen" width="50px" </div>
><a <form method="dialog" class="modal-backdrop">
class="energieausweis-img" <button>close</button>
href="/pdf/ansichtsausweis?uid={ausweis.uid}" </form>
target="_blank" </dialog></td
><img >
src="/images/dashboard/ausweis.jpg" <td class="w-[30px]"
alt="Energieausweis" >
/></a <AusweisPruefenTooltip>
></td <div slot="tooltip">
> <span>{gebaeude_aufnahme_allgemein.prueftext}</span>
<td title="Datenblatt anzeigen" width="50px" </div>
><a {#if gebaeude_aufnahme_allgemein.boxpruefung}
class="energieausweis-img" <CheckCircled size={22}></CheckCircled>
href="/pdf/datenblatt?uid={ausweis.uid}" {:else}
target="_blank" <CrossCircled size={22}></CrossCircled>
><img {/if}
src="/images/dashboard/datenblatt.jpg" </AusweisPruefenTooltip></td
alt="Datenblatt" >
/></a <td title="Ausweis anzeigen" class="w-[50px]"
></td ><a
> class="energieausweis-img"
<td href="/pdf/ansichtsausweis?uid={ausweis.uid}"
title="Ausweis stornieren und Zahlung wenn erforderlich automatisch zurückbuchen" target="_blank"
class="w-4 p-1" ><img
><button src="/images/dashboard/ausweis.jpg"
class="btn btn-xs btn-ghost" alt="Energieausweis"
on:click={() => stornieren(ausweis)}>S</button class="w-full h-8"
></td /></a
> ></td
<td title="Ausweis ausstellen" class="w-4 p-1" >
><button <td title="Datenblatt anzeigen" width="50px"
class="btn btn-xs btn-ghost" ><a
on:click={() => ausweisAusstellen('{gebaeude_aufnahme_allgemein.uid}')}>A</button class="energieausweis-img"
></td href="/pdf/datenblatt?uid={ausweis.uid}"
> target="_blank"
<td ><img
title="Ausweis ausstellen und per Post verschicken" src="/images/dashboard/datenblatt.jpg"
class="w-4 p-1" alt="Datenblatt"
><button /></a
class="btn btn-xs btn-ghost" ></td
on:click={() => ausweisAusstellenPost('{gebaeude_aufnahme_allgemein.uid}')}>P</button >
></td <td
> title="Ausweis stornieren und Zahlung wenn erforderlich automatisch zurückbuchen"
<td class="w-4 p-1"
title="E-Mail an Kunden schicken mit Erläuterungen warum der Ausweis noch nicht ausgestellt werden kann." ><button
class="w-4 p-1" class="btn btn-xs btn-ghost"
><button on:click={() => stornieren(ausweis)}>S</button
class="btn btn-xs btn-ghost" ></td
on:click={() => ausweisnichtAusstellen('{gebaeude_aufnahme_allgemein.uid}')}>N</button >
></td <td title="Ausweis ausstellen" class="w-4 p-1"
> ><button
<td class="btn btn-xs btn-ghost"
title="Bestellbestätigung nochmal schicken (Zahlung nicht erfolgreich)" on:click={() => ausweisAusstellen('{gebaeude_aufnahme_allgemein.uid}')}>A</button
class="w-4 p-1" ></td
><button >
class="btn btn-xs btn-ghost" <td
on:click={() => bestellBestaetigung('{gebaeude_aufnahme_allgemein.uid}')}>B</button title="Ausweis ausstellen und per Post verschicken"
></td class="w-4 p-1"
> ><button
<td class="btn btn-xs btn-ghost"
title="E-Mail an Kunden schicken mit Erinnerung die Bestellung abzuschließen." on:click={() => ausweisAusstellenPost('{gebaeude_aufnahme_allgemein.uid}')}>P</button
class="w-4 p-1" ></td
><button >
class="btn btn-xs btn-ghost" <td
on:click={() => erinnern('{gebaeude_aufnahme_allgemein.uid}')} title="E-Mail an Kunden schicken mit Erläuterungen warum der Ausweis noch nicht ausgestellt werden kann."
>E</button class="w-4 p-1"
></td ><button
> class="btn btn-xs btn-ghost"
<td on:click={() => ausweisnichtAusstellen('{gebaeude_aufnahme_allgemein.uid}')}>N</button
title="Zum Formular mit allen Eingabedaten." ></td
class="w-4 p-1" >
><a <td
class="btn btn-xs btn-ghost" title="Bestellbestätigung nochmal schicken (Zahlung nicht erfolgreich)"
target="_blank" class="w-4 p-1"
href="/energieausweis-erstellen/gespeichert?id={gebaeude_aufnahme_allgemein.uid}">F</a ><button
></td class="btn btn-xs btn-ghost"
> on:click={() => bestellBestaetigung('{gebaeude_aufnahme_allgemein.uid}')}>B</button
{@html gebaeude_aufnahme_allgemein.kontrolldatei ></td
? `<td title="XML-Datei an das DiBT verschicken." class="w-4 p-1"><button class="btn btn-xs btn-ghost" on:click="xmlAbschicken('{gebaeude_aufnahme_allgemein.uid}')">X</button></td>` >
: ""} <td
{@html !gebaeude_aufnahme_allgemein.registriernummer title="E-Mail an Kunden schicken mit Erinnerung die Bestellung abzuschließen."
? `<td title="Registriernummer vom DiBT anfordern." class="w-4 p-1"><button class="btn btn-xs btn-ghost" on:click="registriernummerAnfordern('{gebaeude_aufnahme_allgemein.uid}')">R</button></td>` class="w-4 p-1"
: ""} ><button
</tr> class="btn btn-xs btn-ghost"
</tbody> on:click={() => erinnern('{gebaeude_aufnahme_allgemein.uid}')}
</table> >E</button
></td
>
<td
title="Zum Formular mit allen Eingabedaten."
class="w-4 p-1"
><a
class="btn btn-xs btn-ghost"
target="_blank"
href="/energieausweis-erstellen/gespeichert?id={gebaeude_aufnahme_allgemein.uid}">F</a
></td
>
{@html gebaeude_aufnahme_allgemein.kontrolldatei
? `<td title="XML-Datei an das DiBT verschicken." class="w-4 p-1"><button class="btn btn-xs btn-ghost" on:click="xmlAbschicken('{gebaeude_aufnahme_allgemein.uid}')">X</button></td>`
: ""}
{@html !gebaeude_aufnahme_allgemein.registriernummer
? `<td title="Registriernummer vom DiBT anfordern." class="w-4 p-1"><button class="btn btn-xs btn-ghost" on:click="registriernummerAnfordern('{gebaeude_aufnahme_allgemein.uid}')">R</button></td>`
: ""}
</tr>
</tbody>
</table>
<div class:hidden={!infoVisible} class:block={infoVisible} class="py-4 border-t">
<div class="grid grid-cols-[2fr_1fr] prose max-w-full">
<div class="border-r px-8">
<h3 class="mt-0">Wichtige Daten</h3>
<table>
<tbody>
<tr>
<td>Angewendete Berechnungsformel</td>
<td><strong>EnEV 2016</strong></td>
</tr>
<tr>
<td>Berechnungsergebnis</td>
<td>{calculations?.endEnergieVerbrauchGesamt}kWh/m2/A - Energieeffizienzklasse <strong>{calculations?.energieEffizienzKlasse}</strong></td>
</tr>
<tr>
<td>Informationen des Nutzers</td>
<td>{gebaeude_aufnahme_allgemein.boxpruefung}</td>
</tr>
<tr>
<td>UID</td>
<td><strong><pre>{ausweis.uid}</pre></strong></td>
</tr>
</tbody>
</table>
</div>
<div class="px-8">
<h3 class="mt-0">Ereignisse</h3>
<ul class="timeline timeline-snap-icon max-md:timeline-compact timeline-vertical">
<li>
<div class="timeline-middle">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="h-5 w-5"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd" /></svg>
</div>
<div class="timeline-start md:text-end mb-10">
<time class="font-mono italic">{moment(ausweis.erstellungsdatum).format("DD.MM.YYYY - HH:mm")} Uhr</time>
<div class="text-lg font-black">Ausweis erstellt</div>
</div>
<hr/>
</li>
{#each ausweis.gebaeude_aufnahme_allgemein.gebaeude_stammdaten.events as event, i}
<li>
<hr />
<div class="timeline-middle">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="h-5 w-5"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd" /></svg>
</div>
<div class="mb-10" class:timeline-end={i % 2 == 0} class:timeline-start={i % 2 == 1}>
<time class="font-mono italic">{moment(event.date).format("DD.MM.YYYY - HH:mm")} Uhr</time>
<div class="text-lg font-black">{event.title}</div>
{event.description || ""}
</div>
<hr />
</li>
{/each}
{#if ausweis.erledigt}
<li>
<hr />
<div class="timeline-middle">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="h-5 w-5"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd" /></svg>
</div>
<div class="mb-10 timeline-end">
<time class="font-mono italic">{moment(ausweis.ausstellungsdatum).format("DD.MM.YYYY - HH:mm")} Uhr</time>
<div class="text-lg font-black">Ausweis ausgestellt</div>
{ausweis.registriernummer ? `Registriernummer: ${ausweis.registriernummer}` : ""}
</div>
<hr />
</li>
{/if}
</ul>
</div>
</div>
</div>
</div>

View File

@@ -13,9 +13,7 @@
} from "radix-svelte-icons"; } from "radix-svelte-icons";
import { endEnergieVerbrauchVerbrauchsausweis_2016 } from "#lib/Berechnungen/VerbrauchsausweisWohnen/VerbrauchsausweisWohnen_2016"; import { endEnergieVerbrauchVerbrauchsausweis_2016 } from "#lib/Berechnungen/VerbrauchsausweisWohnen/VerbrauchsausweisWohnen_2016";
import { client } from "src/trpc"; import { client } from "src/trpc";
import { verbrauchsausweisWohnenCalculateFormProgress } from "#lib/VerbrauchsausweisWohnen/calculateFormProgress";
import { number } from "zod";
export let ausweis: VerbrauchsausweisWohnenClient; export let ausweis: VerbrauchsausweisWohnenClient;
export let progress: number; export let progress: number;

View File

@@ -8,7 +8,6 @@ import Header from "../components/Header.astro";
import SidebarLeft from "../components/SidebarLeft.astro"; import SidebarLeft from "../components/SidebarLeft.astro";
import SidebarRight from "../components/SidebarRight.astro"; import SidebarRight from "../components/SidebarRight.astro";
import { NotificationWrapper } from "@ibcornelsen/ui"; import { NotificationWrapper } from "@ibcornelsen/ui";
import HeaderAlternative from "#components/HeaderAlternative.svelte";
export interface Props { export interface Props {
title: string; title: string;

View File

@@ -232,6 +232,29 @@ export async function endEnergieVerbrauchVerbrauchsausweis_2016(
co2EmissionenLeerstandsZuschlag + co2EmissionenLeerstandsZuschlag +
co2EmissionenKuehlungsZuschlag; co2EmissionenKuehlungsZuschlag;
// Energieeffizienzklasse
let energieEffizienzKlasse = "";
if (endEnergieVerbrauchGesamt < 30) {
energieEffizienzKlasse = 'A+';
}else if (endEnergieVerbrauchGesamt < 50) {
energieEffizienzKlasse = 'A';
}else if (endEnergieVerbrauchGesamt < 75) {
energieEffizienzKlasse = 'B';
}else if (endEnergieVerbrauchGesamt < 100) {
energieEffizienzKlasse = 'C';
}else if (endEnergieVerbrauchGesamt < 130) {
energieEffizienzKlasse = 'D';
}else if (endEnergieVerbrauchGesamt < 160) {
energieEffizienzKlasse = 'E';
}else if (endEnergieVerbrauchGesamt < 200) {
energieEffizienzKlasse = 'F';
}else if (endEnergieVerbrauchGesamt < 250) {
energieEffizienzKlasse = 'G';
}else if (endEnergieVerbrauchGesamt >= 250) {
energieEffizienzKlasse = 'H';
}
return { return {
brennstoff_1: brennstoff_1, brennstoff_1: brennstoff_1,
brennstoff_2: brennstoff_2, brennstoff_2: brennstoff_2,
@@ -320,5 +343,6 @@ export async function endEnergieVerbrauchVerbrauchsausweis_2016(
primaerEnergieVerbrauchGesamt: Math.round( primaerEnergieVerbrauchGesamt: Math.round(
primaerEnergieVerbrauchGesamt primaerEnergieVerbrauchGesamt
), ),
energieEffizienzKlasse
}; };
} }

View File

@@ -17,6 +17,9 @@
limit: 10 limit: 10
}); });
console.log(ausweise);
if (!ausweise) return; if (!ausweise) return;
ausweisUeberpruefung = ausweise.map(ausweis => verbrauchsausweisWohnenCalculateFormProgress(ausweis)); ausweisUeberpruefung = ausweise.map(ausweis => verbrauchsausweisWohnenCalculateFormProgress(ausweis));

View File

@@ -1,5 +1,6 @@
import { createCaller } from "#lib/caller"; import { createCaller } from "#lib/caller";
import { APIRoute } from "astro"; import { APIRoute } from "astro";
import { validate } from "uuid";
export const get: APIRoute = async ({params, cookies}) => { export const get: APIRoute = async ({params, cookies}) => {
const { uid } = params; const { uid } = params;
@@ -8,6 +9,10 @@ export const get: APIRoute = async ({params, cookies}) => {
return new Response("No uid provided", { status: 400 }); return new Response("No uid provided", { status: 400 });
} }
if (!validate(uid)) {
return new Response("Invalid uid", { status: 400 });
}
const caller = createCaller({ cookies }) const caller = createCaller({ cookies })
const image = await caller.v1.bilder.getBase64({ uid }) const image = await caller.v1.bilder.getBase64({ uid })

View File

@@ -1,24 +1,19 @@
--- ---
import UserLayout from "../../../layouts/UserLayout.astro"; import UserLayout from "../../../layouts/UserLayout.astro";
import { API_UID_COOKIE_NAME } from "../../../lib/constants";
import DashboardAusweiseModule from "#modules/Dashboard/DashboardAusweiseModule.svelte"; import DashboardAusweiseModule from "#modules/Dashboard/DashboardAusweiseModule.svelte";
import { prisma } from "@ibcornelsen/database/server";
const uid = Astro.cookies.get(API_UID_COOKIE_NAME).value import { validateAccessTokenServer } from "src/server/lib/validateAccessToken";
import { createCaller } from "#lib/caller";
if (!uid) { const accessTokenValid = await validateAccessTokenServer(Astro);
if (!accessTokenValid) {
return Astro.redirect("/auth/login") return Astro.redirect("/auth/login")
} }
const user = await prisma.benutzer.findUnique({ const caller = createCaller(Astro);
where: {
uid
}
})
if (!user) { const user = await caller.v1.benutzer.self();
return Astro.redirect("/auth/login")
}
--- ---
<UserLayout title="Dashboard"> <UserLayout title="Dashboard">

31
src/pages/email.astro Normal file
View File

@@ -0,0 +1,31 @@
---
import ThemeController from "../components/ThemeController.svelte";
import moment from "moment"
const lightTheme = Astro.cookies.get("theme").value === "light";
---
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>email</title>
</head>
<body class="p-8">
<main class="prose border rounded-box flex flex-col items-center border-base-300">
<div class="bg-base-200 h-auto w-full flex flex-col items-center gap-4 justify-start py-4 border-b border-base-300 rounded-t-box">
<img src="/images/header/logo-big.svg" class="h-12 my-0">
</div>
<div class="bg-base-100 h-auto w-full flex flex-col items-center gap-4 justify-start py-16 px-8">
<h2 class="my-0">Erinnerung vom IBCornelsen</h2>
<p class="text-center">Bitte denken sie daran, die restlichen Bilder für ihr Gebäude hochzuladen. Die aktuelle Gesetzgebung erfordert dies, bevor ihr Ausweis ausgestellt werden kann.</p>
<a class="btn btn-primary text-primary-content no-underline">Bilder Hochladen</a>
</div>
<div class="bg-base-200 h-auto w-full flex flex-col items-center gap-4 justify-start py-4 border-t border-base-300 rounded-b-box">
<a class="text-base-content font-medium text-sm" href="https://online-energieausweis.org">© {moment().format("YYYY")} IB Cornelsen Hamburg</a>
</div>
</main>
<ThemeController lightTheme={lightTheme}></ThemeController>
</body>
</html>