@@ -2,8 +2,6 @@
|
||||
import HelpLabel from "#components/labels/HelpLabel.svelte";
|
||||
import Inputlabel from "#components/labels/InputLabel.svelte";
|
||||
|
||||
//import Label from "#components/Label.svelte";
|
||||
|
||||
import { auditHeizungGebaeudeBaujahr } from "../Verbrauchsausweis/audits/HeizungGebaeudeBaujahr.js";
|
||||
import { addNotification, deleteNotification } from "#components/Notifications/shared.js";
|
||||
import TagInput from "../TagInput.svelte";
|
||||
@@ -48,7 +46,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
required
|
||||
data-cy="ausstellgrund"
|
||||
>
|
||||
<option disabled selected value>Bitte auswählen</option>
|
||||
<option disabled selected value={null}>Bitte auswählen</option>
|
||||
{#each Object.entries(Enums.Ausstellgrund) as [name, ausstellgrund]}
|
||||
<option value={ausstellgrund}>{name}</option>
|
||||
{/each}
|
||||
@@ -224,7 +222,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
required
|
||||
bind:value={aufnahme.saniert}
|
||||
>
|
||||
<option disabled selected value>Bitte auswählen</option>
|
||||
<option disabled selected value={null}>Bitte auswählen</option>
|
||||
<option value={true}>saniert</option>
|
||||
<option value={false}>unsaniert</option>
|
||||
</select>
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
|
||||
async function spaeterWeitermachen() {
|
||||
loginAction = spaeterWeitermachen;
|
||||
if (!await validateAccessTokenClient()) {
|
||||
if (!(await validateAccessTokenClient())) {
|
||||
loginOverlayHidden = false;
|
||||
return
|
||||
}
|
||||
@@ -120,18 +120,16 @@ sm:grid-cols-[1fr_min-content_min-content_min-content] sm:justify-self-end">
|
||||
|
||||
|
||||
{#if showWeiter}
|
||||
<div>
|
||||
<Overlay bind:hidden={loginOverlayHidden}>
|
||||
<div class="bg-white w-full max-w-screen-sm py-8">
|
||||
<EmbeddedAuthFlowModule onLogin={loginAction} email={""}></EmbeddedAuthFlowModule>
|
||||
</div>
|
||||
</Overlay>
|
||||
|
||||
<button on:click={ausweisAbschicken} type="button" class="button" data-cy="weiter">Weiter</button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<Overlay bind:hidden={loginOverlayHidden}>
|
||||
<div class="bg-white w-full max-w-screen-sm py-8">
|
||||
<EmbeddedAuthFlowModule onLogin={loginAction} email={""}></EmbeddedAuthFlowModule>
|
||||
</div>
|
||||
</Overlay>
|
||||
|
||||
{#if showHelp}
|
||||
<div class="w-full col-start-1 row-start-2 sm:row-start-2 col-span-4 mt-4">
|
||||
<div
|
||||
|
||||
@@ -121,7 +121,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
bind:value={aufnahme.dachgeschoss}
|
||||
required
|
||||
>
|
||||
<option disabled selected value>Bitte auswählen</option>
|
||||
<option disabled selected value={null}>Bitte auswählen</option>
|
||||
<option value={Enums.Heizungsstatus.NICHT_VORHANDEN}
|
||||
>nicht vorhanden</option
|
||||
>
|
||||
@@ -150,7 +150,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
required
|
||||
bind:value={aufnahme.keller}
|
||||
>
|
||||
<option disabled selected value>Bitte auswählen</option>
|
||||
<option disabled selected value={null}>Bitte auswählen</option>
|
||||
<option value={Enums.Heizungsstatus.NICHT_VORHANDEN}
|
||||
>nicht vorhanden</option
|
||||
>
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
import HelpLabel from "#components/labels/HelpLabel.svelte";
|
||||
import Inputlabel from "#components/labels/InputLabel.svelte";
|
||||
import { Enums } from "#lib/client/prisma.js";
|
||||
|
||||
import { Enums } from "@ibcornelsen/database/client";
|
||||
|
||||
export let ausweis;
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
required
|
||||
bind:value={aufnahme.lueftung}
|
||||
>
|
||||
<option disabled selected value>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"
|
||||
|
||||
@@ -653,9 +653,8 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
|
||||
|
||||
<input
|
||||
name="stromverbrauch_enthaelt_sonstige"
|
||||
type="number"
|
||||
type="text"
|
||||
bind:value={ausweis.stromverbrauch_enthaelt_sonstige}
|
||||
required
|
||||
/>
|
||||
|
||||
<div class="help-label">
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<script lang="ts">
|
||||
import HelpLabel from "#components/labels/HelpLabel.svelte";
|
||||
import Inputlabel from "#components/labels/InputLabel.svelte";
|
||||
import { VerbrauchsausweisGewerbeClient, VerbrauchsausweisWohnenClient } from "./types.js";
|
||||
|
||||
export let ausweis;
|
||||
export let ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient;
|
||||
|
||||
$: {
|
||||
if (!ausweis.warmwasser_enthalten) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { AufnahmeKomplettClient, getAusweisartFromUUID, ObjektKomplettClient, VerbrauchsausweisWohnenClient } from "#components/Ausweis/types.js";
|
||||
import { AufnahmeKomplettClient, BedarfsausweisWohnenClient, getAusweisartFromUUID, ObjektKomplettClient, VerbrauchsausweisGewerbeClient, VerbrauchsausweisWohnenClient } from "#components/Ausweis/types.js";
|
||||
import moment from "moment";
|
||||
import { dialogs } from "svelte-dialogs";
|
||||
import {
|
||||
@@ -13,12 +13,13 @@
|
||||
import { api } from "astro-typesafe-api/client";
|
||||
import Cookies from "js-cookie";
|
||||
import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants.js";
|
||||
import { Enums, Objekt } from "#lib/client/prisma";
|
||||
import { Enums, Objekt } from "#lib/client/prisma.js";
|
||||
import { endEnergieVerbrauchVerbrauchsausweisGewerbe_2016 } from "#lib/Berechnungen/VerbrauchsausweisGewerbe/VerbrauchsausweisGewerbe_2016.js";
|
||||
|
||||
export let ausweis: VerbrauchsausweisWohnenClient;
|
||||
export let ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient | BedarfsausweisWohnenClient;
|
||||
export let aufnahme: AufnahmeKomplettClient;
|
||||
export let objekt: Objekt;
|
||||
export let progress: number;
|
||||
const progress = ausweis.ausgestellt ? 100 : ausweis.bestellt ? 66 : 33;
|
||||
|
||||
const ausweisart = getAusweisartFromUUID(ausweis.uid);
|
||||
|
||||
@@ -38,14 +39,25 @@
|
||||
});
|
||||
|
||||
if (result === true) {
|
||||
await api["verbrauchsausweis-wohnen"]._uid.DELETE.fetch(undefined, {
|
||||
params: {
|
||||
uid: ausweis.uid,
|
||||
},
|
||||
headers: {
|
||||
Authorization: `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`,
|
||||
},
|
||||
});
|
||||
if (ausweisart === Enums.Ausweisart.VerbrauchsausweisWohnen) {
|
||||
await api["verbrauchsausweis-wohnen"]._uid.DELETE.fetch(undefined, {
|
||||
params: {
|
||||
uid: ausweis.uid,
|
||||
},
|
||||
headers: {
|
||||
Authorization: `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`,
|
||||
},
|
||||
});
|
||||
} else if (ausweisart === Enums.Ausweisart.VerbrauchsausweisGewerbe) {
|
||||
await api["verbrauchsausweis-gewerbe"]._uid.DELETE.fetch(undefined, {
|
||||
params: {
|
||||
uid: ausweis.uid,
|
||||
},
|
||||
headers: {
|
||||
Authorization: `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
ausweis.storniert
|
||||
ausweis = ausweis;
|
||||
@@ -65,9 +77,18 @@
|
||||
}
|
||||
|
||||
let hilfeModal: HTMLDialogElement;
|
||||
|
||||
let calculations = null;
|
||||
|
||||
if (ausweisart === Enums.Ausweisart.VerbrauchsausweisWohnen) {
|
||||
calculations = endEnergieVerbrauchVerbrauchsausweis_2016(ausweis as VerbrauchsausweisWohnenClient, aufnahme, objekt);
|
||||
} else if (ausweisart === Enums.Ausweisart.VerbrauchsausweisGewerbe) {
|
||||
calculations = endEnergieVerbrauchVerbrauchsausweisGewerbe_2016(ausweis as VerbrauchsausweisGewerbeClient, aufnahme, objekt);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div class="card lg:card-side relative bg-base-200 card-bordered border-base-300">
|
||||
<div class="relative bg-base-200 border border-base-300 rounded-lg p-4">
|
||||
{#if ausweis.storniert}
|
||||
<div
|
||||
class="absolute top-0 left-0 w-full h-full bg-[rgba(0,0,0,0.7)] z-[5] rounded-lg select-none"
|
||||
@@ -79,14 +100,6 @@
|
||||
</h1>
|
||||
</div>
|
||||
{/if}
|
||||
<!-- <figure class="lg:w-1/2">
|
||||
<img
|
||||
src={(bilder.length > 0 && `/bilder/${bilder[0].uid}.webp`) ||
|
||||
"/images/placeholder.jpg"}
|
||||
class="object-cover w-full h-full"
|
||||
alt="Gebäudebild"
|
||||
/>
|
||||
</figure> -->
|
||||
<div class="card-body">
|
||||
<div
|
||||
class="flex justify-end mb-2 dropdown dropdown-bottom absolute top-4 right-4"
|
||||
@@ -113,35 +126,38 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="flex flex-row flex-wrap gap-2">
|
||||
<div class="flex flex-row flex-wrap items-center gap-2">
|
||||
{#if ausweisart == Enums.Ausweisart.VerbrauchsausweisWohnen}
|
||||
<div class="badge badge-accent font-semibold text-secondary text-lg">
|
||||
<div class="text-lg font-semibold">
|
||||
Verbrauchsausweis Wohnen
|
||||
</div>
|
||||
{:else if ausweisart == Enums.Ausweisart.BedarfsausweisWohnen}
|
||||
<div class="badge badge-accent font-semibold">
|
||||
<div class="text-lg font-semibold">
|
||||
Bedarfsausweis Wohnen
|
||||
</div>
|
||||
{:else if ausweisart == Enums.Ausweisart.VerbrauchsausweisGewerbe}
|
||||
<div class="badge badge-accent font-semibold">
|
||||
<div class="text-lg font-semibold">
|
||||
Verbrauchsausweis Gewerbe
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if ausweis.ausgestellt}
|
||||
<div class="badge badge-success font-semibold">Ausgestellt</div>
|
||||
<span class="bg-green-600 px-2 py-0.5 text-sm font-semibold rounded-lg text-white">Ausgestellt</span>
|
||||
{:else if ausweis.bestellt}
|
||||
<span class="bg-yellow-600 px-2 py-0.5 text-sm font-semibold rounded-lg text-white">Bestellt</span>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="badge badge-accent font-semibold text-black text-m">{objekt.adresse}</div>
|
||||
<div class="mb-4 flex flex-row items-center gap-4">
|
||||
<progress class="progress w-full" value={progress} max="100"
|
||||
></progress>
|
||||
<div class="w-full border rounded-lg my-2">
|
||||
<div class="bg-green-600 h-4 rounded-lg" class:bg-red-600={progress == 33} class:bg-primary={progress == 66} style="width: {progress}%;"></div>
|
||||
</div>
|
||||
<!-- TODO: Metrics für den Fortschritt festlegen -->
|
||||
<span class="text-sm font-semibold text-base-content"
|
||||
>{progress}%</span
|
||||
>
|
||||
</div>
|
||||
{#await endEnergieVerbrauchVerbrauchsausweis_2016(ausweis, aufnahme, objekt) then calculations}
|
||||
{#await calculations then calculations}
|
||||
<div class="flex flex-col gap-2">
|
||||
<div class="flex flex-row justify-between">
|
||||
<span>Energieverbrauch</span>
|
||||
@@ -183,22 +199,35 @@
|
||||
<div class="flex flex-row justify-between">
|
||||
<span>ID</span>
|
||||
<span class="font-bold text-base-content"
|
||||
>{ausweis.uid.split("-")[0]}</span
|
||||
>{ausweis.uid}</span
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
{/await}
|
||||
|
||||
<div class="flex flex-row justify-end gap-4 mt-4">
|
||||
<a
|
||||
{#if !ausweis.storniert && !ausweis.ausgestellt}
|
||||
<a
|
||||
class="button text-sm"
|
||||
href="/energieausweis-erstellen/verbrauchsausweis-wohngebaeude?uid={ausweis.uid}"
|
||||
>Stornieren</a>
|
||||
{/if}
|
||||
|
||||
|
||||
<a
|
||||
class="button text-sm"
|
||||
href="/energieausweis-erstellen/verbrauchsausweis-wohngebaeude?uid={ausweis.uid}"
|
||||
>Freigeben</a>
|
||||
{#if !ausweis.ausgestellt && !ausweis.bestellt}
|
||||
<!-- TODO -->
|
||||
{#if ausweisart === Enums.Ausweisart.VerbrauchsausweisWohnen}
|
||||
<a
|
||||
class="button text-sm"
|
||||
href="/energieausweis-erstellen/verbrauchsausweis-wohngebaeude?uid={ausweis.uid}"
|
||||
>Bearbeiten</a>
|
||||
{:else if ausweisart === Enums.Ausweisart.VerbrauchsausweisGewerbe}
|
||||
<a
|
||||
class="button text-sm"
|
||||
href="/energieausweis-erstellen/verbrauchsausweis-gewerbe?uid={ausweis.uid}"
|
||||
>Bearbeiten</a>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
<a
|
||||
class="p-2 rounded-lg hover:bg-gray-200"
|
||||
|
||||
111
src/components/Dashboard/DashboardNachweis.svelte
Normal file
111
src/components/Dashboard/DashboardNachweis.svelte
Normal file
@@ -0,0 +1,111 @@
|
||||
<script lang="ts">
|
||||
import { AufnahmeKomplettClient, GEGNachweisWohnenClient, getAusweisartFromUUID } from "#components/Ausweis/types.js";
|
||||
import {
|
||||
CrossCircled,
|
||||
DotsVertical,
|
||||
Pencil2,
|
||||
QuestionMarkCircled,
|
||||
} from "radix-svelte-icons";
|
||||
import { Enums, Objekt } from "#lib/client/prisma.js";
|
||||
|
||||
export let nachweis: GEGNachweisWohnenClient;
|
||||
export let aufnahme: AufnahmeKomplettClient;
|
||||
export let objekt: Objekt;
|
||||
|
||||
const ausweisart = getAusweisartFromUUID(nachweis.uid);
|
||||
|
||||
let hilfeModal: HTMLDialogElement;
|
||||
</script>
|
||||
|
||||
<div class="relative bg-base-200 border border-base-300 rounded-lg p-4">
|
||||
{#if nachweis.storniert}
|
||||
<div
|
||||
class="absolute top-0 left-0 w-full h-full bg-[rgba(0,0,0,0.7)] z-[5] rounded-lg select-none"
|
||||
>
|
||||
<h1
|
||||
class="absolute -rotate-[25deg] text-5xl md:text-7xl tracking-wide uppercase text-red-500 border-4 border-red-500 rounded-lg top-[50%] translate-y-[-50%] left-[50%] translate-x-[-50%]"
|
||||
>
|
||||
Storniert
|
||||
</h1>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="card-body">
|
||||
<div
|
||||
class="flex justify-end mb-2 dropdown dropdown-bottom absolute top-4 right-4"
|
||||
>
|
||||
<button class="rounded-full p-2.5 hover:bg-base-100">
|
||||
<DotsVertical size={15} />
|
||||
</button>
|
||||
<ul
|
||||
tabindex="-1"
|
||||
class="dropdown-content z-[1] menu p-2 shadow bg-base-100 rounded-box w-64 gap-2"
|
||||
>
|
||||
<li>
|
||||
<button><Pencil2 size={15} /> Als Vorlage benutzen</button>
|
||||
</li>
|
||||
<li>
|
||||
<button on:click={() => hilfeModal.showModal()}
|
||||
><QuestionMarkCircled size={15} /> Hilfe Erhalten</button
|
||||
>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="flex flex-row flex-wrap items-center gap-2">
|
||||
{#if ausweisart == Enums.Ausweisart.GEGNachweisWohnen}
|
||||
<div class="text-lg font-semibold">
|
||||
GEG Nachweis Wohnen
|
||||
</div>
|
||||
{:else if ausweisart == Enums.Ausweisart.GEGNachweisGewerbe}
|
||||
<div class="text-lg font-semibold">
|
||||
GEG Nachweis Gewerbe
|
||||
</div>
|
||||
{:else if ausweisart == Enums.Ausweisart.GEGNachweisBedarfsausweis}
|
||||
<div class="text-lg font-semibold">
|
||||
Bedarfsausweis Gewerbe
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="badge badge-accent font-semibold text-black text-m">{objekt.adresse}</div>
|
||||
|
||||
<div class="flex flex-row justify-end gap-4 mt-4">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<dialog bind:this={hilfeModal} class="modal">
|
||||
<div class="modal-box">
|
||||
<h3 class="font-bold text-xl mb-4">Hilfe Anfordern</h3>
|
||||
<p>
|
||||
Brauchen sie Hilfe bei der Erstellung oder Bearbeitung ihres
|
||||
Ausweises?
|
||||
</p>
|
||||
<p>
|
||||
In unserem <a href="/helpdesk">Helpdesk</a> finden sie antworten auf
|
||||
häufig gestellte Fragen.
|
||||
</p>
|
||||
<p>
|
||||
Falls sie dort nicht finden wonach sie suchen, rufen sie uns doch
|
||||
unter <a href="tel:040-209-339-850">040 209 339 850</a> an oder
|
||||
<a href="mailto:info@online-energieausweis.com">schreiben sie uns eine email</a
|
||||
>.
|
||||
</p>
|
||||
<p>
|
||||
Wenn wir telefonisch nicht erreichbar sind, können sie uns auch
|
||||
direkt hier eine Nachricht hinterlassen.
|
||||
</p>
|
||||
<form class="my-4">
|
||||
<textarea
|
||||
class="textarea textarea-bordered"
|
||||
placeholder="Ihre Nachricht..."
|
||||
cols="10"
|
||||
rows="5"
|
||||
></textarea>
|
||||
<button class="btn btn-primary">Nachricht Abschicken</button>
|
||||
</form>
|
||||
<div class="modal-action">
|
||||
<form method="dialog">
|
||||
<button class="btn">Schließen</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</dialog>
|
||||
@@ -13,6 +13,8 @@
|
||||
|
||||
{#if bild}
|
||||
<img src="/bilder/{bild.uid}.jpg" class="w-full max-h-72 object-cover rounded-t-lg" alt="Gebäude">
|
||||
{:else}
|
||||
<img src="/placeholder.png" class="w-full max-h-72 object-cover rounded-t-lg" alt="Gebäude">
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
@@ -30,10 +32,10 @@
|
||||
<a href="/dashboard/aufnahme/{aufnahme.uid}" class="rounded-lg p-2 hover:bg-gray-100 transition-all"><OpenInNewWindow size={20}></OpenInNewWindow></a>
|
||||
</div>
|
||||
<div class="flex flex-row gap-2">
|
||||
{#if aufnahme.verbrauchsausweise_wohnen}
|
||||
{#if aufnahme.verbrauchsausweise_wohnen.length > 0}
|
||||
<a href="/dashboard/aufnahme/{aufnahme.uid}" class="rounded-lg p-2 hover:bg-gray-100 transition-all"><File size={20}></File></a>
|
||||
{/if}
|
||||
{#if aufnahme.verbrauchsausweis_gewerbe}
|
||||
{#if aufnahme.verbrauchsausweise_gewerbe.length > 0}
|
||||
<a href="/dashboard/aufnahme/{aufnahme.uid}" class="rounded-lg p-2 hover:bg-gray-100 transition-all"><File size={20}></File></a>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -6,10 +6,11 @@
|
||||
import DashboardNotification from "./DashboardNotification.svelte";
|
||||
import { notifications } from "#components/NotificationProvider/shared.js";
|
||||
import ThemeController from "#components/ThemeController.svelte";
|
||||
import { BenutzerClient } from "#components/Ausweis/types.js";
|
||||
import { BenutzerClient, ObjektClient } from "#components/Ausweis/types.js";
|
||||
|
||||
export let lightTheme: boolean;
|
||||
export let benutzer: BenutzerClient;
|
||||
export let objekte: ObjektClient[];
|
||||
|
||||
const rippleOptions: RippleOptions = {
|
||||
center: false,
|
||||
@@ -41,15 +42,10 @@
|
||||
<Reader width={22} height={22} />
|
||||
Gebäude
|
||||
</a>
|
||||
<div class="flex ml-12">Katendeich 5AAA<br>44145 Dortmund</div>
|
||||
<hr class="border-gray-600">
|
||||
<div class="flex ml-12">Birkenalee<br>33175 Bad Lippspringe</div>
|
||||
<hr class="border-gray-600">
|
||||
<div class="flex ml-12">Birkenalee<br>33175 Bad Lippspringe</div>
|
||||
<hr class="border-gray-600">
|
||||
<div class="flex ml-12">Katendeich 5AAA<br>44145 Dortmund</div>
|
||||
<hr class="border-gray-600">
|
||||
<div class="flex ml-12">Katendeich 5AAA<br>44145 Dortmund</div>
|
||||
{#each objekte as objekt}
|
||||
<a class="flex ml-12" href="/dashboard/aufnahme/{objekt.aufnahmen[0].uid}">{objekt.adresse}<br>{objekt.plz} {objekt.ort}</a>
|
||||
<hr class="border-gray-600">
|
||||
{/each}
|
||||
<!-- <button use:ripple={rippleOptions} class="button-tab">
|
||||
<EnvelopeClosed width={22} height={22} />
|
||||
Kontakt
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
<script lang="ts">
|
||||
import UploadImages from "./UploadImages.svelte";
|
||||
import type { Enums } from "#lib/client/prisma";
|
||||
import { BedarfsausweisWohnenClient, BildClient, ObjektClient, UploadedGebaeudeBild, VerbrauchsausweisGewerbeClient, VerbrauchsausweisWohnenClient } from "./Ausweis/types.js";
|
||||
import type { Enums } from "#lib/client/prisma.js";
|
||||
import { BedarfsausweisWohnenClient, BildClient, ObjektClient, VerbrauchsausweisGewerbeClient, VerbrauchsausweisWohnenClient } from "./Ausweis/types.js";
|
||||
import { RotateCounterClockwise, Trash, Upload } from "radix-svelte-icons";
|
||||
import { api } from "astro-typesafe-api/client";
|
||||
import Cookies from "js-cookie";
|
||||
import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants.js";
|
||||
|
||||
export let images: BildClient[] = [];
|
||||
export let max: number = Infinity;
|
||||
@@ -12,24 +15,16 @@
|
||||
export let objekt: ObjektClient;
|
||||
export let kategorie: Enums.BilderKategorie
|
||||
|
||||
async function rotateImage(image: UploadedGebaeudeBild): Promise<UploadedGebaeudeBild> {
|
||||
return new Promise((resolve, reject) => {
|
||||
let img = new Image();
|
||||
img.src = image.data ? image.data : `/bilder/${image.uid}.jpg`;
|
||||
img.onload = () => {
|
||||
let canvas = document.createElement("canvas");
|
||||
let ctx = canvas.getContext("2d");
|
||||
canvas.width = img.height;
|
||||
canvas.height = img.width;
|
||||
ctx?.translate(img.height / 2, img.width / 2);
|
||||
ctx?.rotate((-90 * Math.PI) / 180);
|
||||
ctx?.drawImage(img, -img.width / 2, -img.height / 2);
|
||||
const clone = Object.assign({}, image)
|
||||
clone.data = canvas.toDataURL("image/jpeg");
|
||||
clone.update = true;
|
||||
resolve(clone)
|
||||
};
|
||||
async function deleteImage(image: BildClient) {
|
||||
await api.bild.DELETE.fetch({
|
||||
uid: image.uid
|
||||
}, {
|
||||
headers: {
|
||||
"Authorization": `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
||||
}
|
||||
})
|
||||
|
||||
images = images.filter((x) => x.uid !== image.uid);
|
||||
}
|
||||
|
||||
let upload: () => void;
|
||||
@@ -51,13 +46,12 @@
|
||||
type="button"
|
||||
class="rounded-full w-[30px] h-[30px] flex items-center justify-center p-0 bg-[rgba(0,0,0,0.4)]"
|
||||
on:click={() => {
|
||||
delete images[i];
|
||||
images = images.filter((x) => x);
|
||||
deleteImage(images[i])
|
||||
}}
|
||||
>
|
||||
<Trash size={20} color="#fff"></Trash>
|
||||
</button>
|
||||
<button
|
||||
<!-- <button
|
||||
type="button"
|
||||
class="rounded-full w-[30px] h-[30px] flex items-center justify-center p-0 bg-[rgba(0,0,0,0.4)]"
|
||||
on:click={async () => {
|
||||
@@ -67,7 +61,7 @@
|
||||
}}
|
||||
>
|
||||
<RotateCounterClockwise size={20} color="#fff"></RotateCounterClockwise>
|
||||
</button>
|
||||
</button> -->
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { AufnahmeClient, VerbrauchsausweisWohnenClient } from "#components/Ausweis/types.js";
|
||||
import { AufnahmeClient, VerbrauchsausweisGewerbeClient, VerbrauchsausweisWohnenClient } from "#components/Ausweis/types.js";
|
||||
|
||||
export function auditBedarfsausweisBenoetigt(ausweis: VerbrauchsausweisWohnenClient, gebaeude: AufnahmeClient): boolean {
|
||||
export function auditBedarfsausweisBenoetigt(ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient, gebaeude: AufnahmeClient): boolean {
|
||||
if (ausweis.ausstellgrund == "Neubau" || ausweis.ausstellgrund == "Modernisierung") {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { ObjektClient, VerbrauchsausweisWohnenClient, AufnahmeClient } from "#components/Ausweis/types.js";
|
||||
import { ObjektClient, VerbrauchsausweisWohnenClient, AufnahmeClient, VerbrauchsausweisGewerbeClient } from "#components/Ausweis/types.js";
|
||||
import { AuditType, hidden } from "./hidden.js";
|
||||
import { endEnergieVerbrauchVerbrauchsausweis_2016 } from "#lib/Berechnungen/VerbrauchsausweisWohnen/VerbrauchsausweisWohnen_2016.js";
|
||||
import { getKlimafaktoren } from "#lib/Klimafaktoren.js";
|
||||
|
||||
export async function auditEndEnergie(ausweis: VerbrauchsausweisWohnenClient, objekt: ObjektClient, aufnahme: AufnahmeClient): Promise<boolean> {
|
||||
export async function auditEndEnergie(ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient, objekt: ObjektClient, aufnahme: AufnahmeClient): Promise<boolean> {
|
||||
if (hidden.has(AuditType.END_ENERGIE)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import {
|
||||
ObjektClient,
|
||||
VerbrauchsausweisGewerbeClient,
|
||||
VerbrauchsausweisWohnenClient,
|
||||
} from "#components/Ausweis/types.js";
|
||||
import { AuditType, hidden } from "./hidden.js";
|
||||
import { getKlimafaktoren } from "#lib/Klimafaktoren.js";
|
||||
|
||||
export async function auditKlimaFaktoren(
|
||||
ausweis: VerbrauchsausweisWohnenClient,
|
||||
ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient,
|
||||
gebaeude: ObjektClient
|
||||
): Promise<boolean> {
|
||||
if (hidden.has(AuditType.KLIMA_FAKTOREN)) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { VerbrauchsausweisWohnenClient } from "#components/Ausweis/types.js";
|
||||
import { VerbrauchsausweisGewerbeClient, VerbrauchsausweisWohnenClient } from "#components/Ausweis/types.js";
|
||||
import { AuditType, hidden } from "./hidden.js";
|
||||
|
||||
export function auditWarmWasser(ausweis: VerbrauchsausweisWohnenClient): boolean {
|
||||
export function auditWarmWasser(ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient): boolean {
|
||||
|
||||
if (ausweis.warmwasser_anteil_bekannt && ausweis.warmwasser_enthalten && ausweis.anteil_warmwasser_1) {
|
||||
if (!hidden.has(AuditType.WARM_WASSER)){
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ObjektClient, VerbrauchsausweisWohnenClient } from "#components/Ausweis/types.js";
|
||||
import { ObjektClient, VerbrauchsausweisGewerbeClient, VerbrauchsausweisWohnenClient } from "#components/Ausweis/types.js";
|
||||
import { AuditType, hidden } from "./hidden.js";
|
||||
|
||||
export function auditZeitraumAktuell(ausweis: VerbrauchsausweisWohnenClient, gebaeude: ObjektClient): boolean {
|
||||
export function auditZeitraumAktuell(ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient, gebaeude: ObjektClient): boolean {
|
||||
if (hidden.has(AuditType.ZEITRAUM_AKTUELL)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
---
|
||||
import { BenutzerClient } from "#components/Ausweis/types";
|
||||
import HeaderLogin from "#components/design/header/HeaderLogin.svelte";
|
||||
|
||||
|
||||
export type Props = {
|
||||
user: BenutzerClient | null
|
||||
}
|
||||
|
||||
const { user } = Astro.props;
|
||||
|
||||
---
|
||||
|
||||
<header id="header" class="">
|
||||
@@ -62,7 +71,7 @@ lg:px-0 lg:gap-x-4">
|
||||
|
||||
|
||||
<div class="w-full justify-self-center">
|
||||
<HeaderLogin client:load />
|
||||
<HeaderLogin {user} client:load />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user