Compare commits
2 Commits
dev-jens-m
...
Jens
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
87c09e1cf0 | ||
|
|
4978743b32 |
@@ -5,7 +5,6 @@ export const createCaller = createCallerFactory({
|
|||||||
"klimafaktoren": await import("../src/pages/api/klimafaktoren.ts"),
|
"klimafaktoren": await import("../src/pages/api/klimafaktoren.ts"),
|
||||||
"postleitzahlen": await import("../src/pages/api/postleitzahlen.ts"),
|
"postleitzahlen": await import("../src/pages/api/postleitzahlen.ts"),
|
||||||
"unterlage": await import("../src/pages/api/unterlage.ts"),
|
"unterlage": await import("../src/pages/api/unterlage.ts"),
|
||||||
"aufnahme": await import("../src/pages/api/aufnahme/index.ts"),
|
|
||||||
"admin/ausstellen": await import("../src/pages/api/admin/ausstellen.ts"),
|
"admin/ausstellen": await import("../src/pages/api/admin/ausstellen.ts"),
|
||||||
"admin/bestellbestaetigung": await import("../src/pages/api/admin/bestellbestaetigung.ts"),
|
"admin/bestellbestaetigung": await import("../src/pages/api/admin/bestellbestaetigung.ts"),
|
||||||
"admin/erinnern": await import("../src/pages/api/admin/erinnern.ts"),
|
"admin/erinnern": await import("../src/pages/api/admin/erinnern.ts"),
|
||||||
@@ -13,12 +12,13 @@ export const createCaller = createCallerFactory({
|
|||||||
"admin/post-ausstellen": await import("../src/pages/api/admin/post-ausstellen.ts"),
|
"admin/post-ausstellen": await import("../src/pages/api/admin/post-ausstellen.ts"),
|
||||||
"admin/registriernummer": await import("../src/pages/api/admin/registriernummer.ts"),
|
"admin/registriernummer": await import("../src/pages/api/admin/registriernummer.ts"),
|
||||||
"admin/stornieren": await import("../src/pages/api/admin/stornieren.ts"),
|
"admin/stornieren": await import("../src/pages/api/admin/stornieren.ts"),
|
||||||
"bedarfsausweis-gewerbe/[id]": await import("../src/pages/api/bedarfsausweis-gewerbe/[id].ts"),
|
"aufnahme": await import("../src/pages/api/aufnahme/index.ts"),
|
||||||
"bedarfsausweis-gewerbe": await import("../src/pages/api/bedarfsausweis-gewerbe/index.ts"),
|
|
||||||
"ausweise": await import("../src/pages/api/ausweise/index.ts"),
|
"ausweise": await import("../src/pages/api/ausweise/index.ts"),
|
||||||
"auth/access-token": await import("../src/pages/api/auth/access-token.ts"),
|
"auth/access-token": await import("../src/pages/api/auth/access-token.ts"),
|
||||||
"auth/passwort-vergessen": await import("../src/pages/api/auth/passwort-vergessen.ts"),
|
"auth/passwort-vergessen": await import("../src/pages/api/auth/passwort-vergessen.ts"),
|
||||||
"auth/refresh-token": await import("../src/pages/api/auth/refresh-token.ts"),
|
"auth/refresh-token": await import("../src/pages/api/auth/refresh-token.ts"),
|
||||||
|
"bedarfsausweis-gewerbe/[id]": await import("../src/pages/api/bedarfsausweis-gewerbe/[id].ts"),
|
||||||
|
"bedarfsausweis-gewerbe": await import("../src/pages/api/bedarfsausweis-gewerbe/index.ts"),
|
||||||
"bedarfsausweis-wohnen/[id]": await import("../src/pages/api/bedarfsausweis-wohnen/[id].ts"),
|
"bedarfsausweis-wohnen/[id]": await import("../src/pages/api/bedarfsausweis-wohnen/[id].ts"),
|
||||||
"bedarfsausweis-wohnen": await import("../src/pages/api/bedarfsausweis-wohnen/index.ts"),
|
"bedarfsausweis-wohnen": await import("../src/pages/api/bedarfsausweis-wohnen/index.ts"),
|
||||||
"bilder/[id]": await import("../src/pages/api/bilder/[id].ts"),
|
"bilder/[id]": await import("../src/pages/api/bilder/[id].ts"),
|
||||||
@@ -27,17 +27,17 @@ export const createCaller = createCallerFactory({
|
|||||||
"geg-nachweis-wohnen/[id]": await import("../src/pages/api/geg-nachweis-wohnen/[id].ts"),
|
"geg-nachweis-wohnen/[id]": await import("../src/pages/api/geg-nachweis-wohnen/[id].ts"),
|
||||||
"geg-nachweis-wohnen": await import("../src/pages/api/geg-nachweis-wohnen/index.ts"),
|
"geg-nachweis-wohnen": await import("../src/pages/api/geg-nachweis-wohnen/index.ts"),
|
||||||
"objekt": await import("../src/pages/api/objekt/index.ts"),
|
"objekt": await import("../src/pages/api/objekt/index.ts"),
|
||||||
"user": await import("../src/pages/api/user/index.ts"),
|
|
||||||
"user/self": await import("../src/pages/api/user/self.ts"),
|
|
||||||
"rechnung/[id]": await import("../src/pages/api/rechnung/[id].ts"),
|
"rechnung/[id]": await import("../src/pages/api/rechnung/[id].ts"),
|
||||||
"rechnung/anfordern": await import("../src/pages/api/rechnung/anfordern.ts"),
|
"rechnung/anfordern": await import("../src/pages/api/rechnung/anfordern.ts"),
|
||||||
"rechnung": await import("../src/pages/api/rechnung/index.ts"),
|
"rechnung": await import("../src/pages/api/rechnung/index.ts"),
|
||||||
"ticket": await import("../src/pages/api/ticket/index.ts"),
|
"ticket": await import("../src/pages/api/ticket/index.ts"),
|
||||||
"verbrauchsausweis-wohnen/[id]": await import("../src/pages/api/verbrauchsausweis-wohnen/[id].ts"),
|
"user": await import("../src/pages/api/user/index.ts"),
|
||||||
"verbrauchsausweis-wohnen": await import("../src/pages/api/verbrauchsausweis-wohnen/index.ts"),
|
"user/self": await import("../src/pages/api/user/self.ts"),
|
||||||
"verbrauchsausweis-gewerbe/[id]": await import("../src/pages/api/verbrauchsausweis-gewerbe/[id].ts"),
|
"verbrauchsausweis-gewerbe/[id]": await import("../src/pages/api/verbrauchsausweis-gewerbe/[id].ts"),
|
||||||
"verbrauchsausweis-gewerbe": await import("../src/pages/api/verbrauchsausweis-gewerbe/index.ts"),
|
"verbrauchsausweis-gewerbe": await import("../src/pages/api/verbrauchsausweis-gewerbe/index.ts"),
|
||||||
"webhooks/mollie": await import("../src/pages/api/webhooks/mollie.ts"),
|
"webhooks/mollie": await import("../src/pages/api/webhooks/mollie.ts"),
|
||||||
|
"verbrauchsausweis-wohnen/[id]": await import("../src/pages/api/verbrauchsausweis-wohnen/[id].ts"),
|
||||||
|
"verbrauchsausweis-wohnen": await import("../src/pages/api/verbrauchsausweis-wohnen/index.ts"),
|
||||||
"aufnahme/[id]/bilder": await import("../src/pages/api/aufnahme/[id]/bilder.ts"),
|
"aufnahme/[id]/bilder": await import("../src/pages/api/aufnahme/[id]/bilder.ts"),
|
||||||
"aufnahme/[id]": await import("../src/pages/api/aufnahme/[id]/index.ts"),
|
"aufnahme/[id]": await import("../src/pages/api/aufnahme/[id]/index.ts"),
|
||||||
"aufnahme/[id]/unterlagen": await import("../src/pages/api/aufnahme/[id]/unterlagen.ts"),
|
"aufnahme/[id]/unterlagen": await import("../src/pages/api/aufnahme/[id]/unterlagen.ts"),
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
import { Enums, Objekt } from "#lib/client/prisma.js";
|
import { Enums, Objekt } from "#lib/client/prisma.js";
|
||||||
import { endEnergieVerbrauchVerbrauchsausweisGewerbe_2016 } from "#lib/Berechnungen/VerbrauchsausweisGewerbe/VerbrauchsausweisGewerbe_2016.js";
|
import { endEnergieVerbrauchVerbrauchsausweisGewerbe_2016 } from "#lib/Berechnungen/VerbrauchsausweisGewerbe/VerbrauchsausweisGewerbe_2016.js";
|
||||||
import { addNotification } from "#components/Notifications/shared.js";
|
import { addNotification } from "#components/Notifications/shared.js";
|
||||||
import moment from "moment";
|
|
||||||
|
|
||||||
export let ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient | BedarfsausweisWohnenClient;
|
export let ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbeClient | BedarfsausweisWohnenClient;
|
||||||
export let aufnahme: AufnahmeKomplettClient;
|
export let aufnahme: AufnahmeKomplettClient;
|
||||||
@@ -162,7 +161,8 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="mx-auto py-6 px-4 box bg-white">
|
<div class="relative bg-base-200 border border-base-300 rounded-lg p-4">
|
||||||
|
<div class="max-w-screen-xl mx-auto py-6 px-4 bg-white shadow">
|
||||||
|
|
||||||
<!-- Obere Zeile: Titel -->
|
<!-- Obere Zeile: Titel -->
|
||||||
<div class="border-b flex flex-row pb-2">
|
<div class="border-b flex flex-row pb-2">
|
||||||
@@ -188,7 +188,7 @@
|
|||||||
<!-- Erster Block: Drei Spalten -->
|
<!-- Erster Block: Drei Spalten -->
|
||||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-4">
|
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-4">
|
||||||
<!-- Linke Spalte: Bild + ID -->
|
<!-- Linke Spalte: Bild + ID -->
|
||||||
<div class="flex-shrink-0 bg-gray-100 flex flex-col items-center border text-2xl rounded-b-lg pb-2">
|
<div class="flex-shrink-0 bg-gray-100 flex flex-col items-center border text-2xl rounded-b-lg pb-2 max-w-[220px]">
|
||||||
<img
|
<img
|
||||||
src="../../images/placeholder.png"
|
src="../../images/placeholder.png"
|
||||||
alt="Gebäudevorschau"
|
alt="Gebäudevorschau"
|
||||||
@@ -196,22 +196,22 @@
|
|||||||
/>
|
/>
|
||||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-2 bg-white">
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-2 bg-white">
|
||||||
<!-- PDF-Icon / Ausweis -->
|
<!-- PDF-Icon / Ausweis -->
|
||||||
<div class="m-4">
|
<div class="m-1">
|
||||||
<img
|
<img
|
||||||
src="../../images/dashboard/AusweisKreuz.svg"
|
src="../../images/dashboard/AusweisKreuz.svg"
|
||||||
alt="PDF Symbol für Verbrauchsausweis"
|
alt="PDF Symbol für Verbrauchsausweis"
|
||||||
class="h-auto w-auto p-2 border border-black rounded-lg"
|
class="h-auto w-auto p-2 border border-black rounded-lg"
|
||||||
/>
|
/>
|
||||||
<span class="text-sm font-medium ml-4">Verbrauchsausweis</span>
|
<span class="text-xs font-medium ml-2">Verbrauchsausweis</span>
|
||||||
</div>
|
</div>
|
||||||
<!-- PDF-Icon / Datenblatt -->
|
<!-- PDF-Icon / Datenblatt -->
|
||||||
<div class="m-4">
|
<div class="m-1">
|
||||||
<img
|
<img
|
||||||
src="../../images/dashboard/DatenblattKreuz.svg"
|
src="../../images/dashboard/DatenblattKreuz.svg"
|
||||||
alt="PDF Symbol für Datenblatt"
|
alt="PDF Symbol für Datenblatt"
|
||||||
class="h-auto w-auto p-2 border border-black rounded-lg"
|
class="h-auto w-auto p-2 border border-black rounded-lg"
|
||||||
/>
|
/>
|
||||||
<span class="text-sm font-medium ml-4">Datenblatt</span>
|
<span class="text-xs font-medium ml-2">Datenblatt</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="p-4">Ausweis ID: <b>BWWICR32</b></div>
|
<div class="p-4">Ausweis ID: <b>BWWICR32</b></div>
|
||||||
@@ -476,57 +476,19 @@
|
|||||||
|
|
||||||
<div class="flex-shrink-0 bg-gray-100 flex flex-col border text-xl rounded-lg p-4">
|
<div class="flex-shrink-0 bg-gray-100 flex flex-col border text-xl rounded-lg p-4">
|
||||||
|
|
||||||
<h3 class="font-bold">Ausweisdaten</h3>
|
<p><b>Ausweisdaten</b><br>Anlass: Vermietung/Verkauf<br>
|
||||||
<table>
|
Gebäudetyp: Mehrfamilienhaus<br>
|
||||||
<tr>
|
Anzahl Wohneinheiten: 3<br>
|
||||||
<td>Anlass</td>
|
Keller beheizt / DG beheizt<br>
|
||||||
<td>{ausweis.ausstellgrund}</td>
|
Gebäudeteil: gesamt<br>
|
||||||
</tr>
|
<br>
|
||||||
<tr>
|
<b>Heizverbräuche (kWh, kg)</b><br>vom 03.2022 - 03.2025<br>
|
||||||
<td>Gebäudetyp</td>
|
Erdgas 13600, 14600, 15000<br>Brennholz 400, 500, 600<br>
|
||||||
<td>{aufnahme.gebaeudetyp}</td>
|
Warmwasser enthalten, 20%<br>
|
||||||
</tr>
|
Alternative Energieversorgung: Warmwasser, Heizung, Lüftung, Kühlung<br>
|
||||||
<tr>
|
Leerstand 20%, Fensterlüftung, Kühlung<br><br>
|
||||||
<td>Anzahl Wohneinheiten</td>
|
<b>Sanierungszustand:</b><br>Zentralheizung, Warmwasserrohre gedämmt, Brennwertkessel, Photovoltaik, Dreifachverglasung, alle Fenster dicht, Dachgeschoß gedämmt, Außenwand gedämmt</p>
|
||||||
<td>{aufnahme.einheiten}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td></td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Gebäudeteil</td>
|
|
||||||
<td>{aufnahme.gebaeudeteil}</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<h3 class="font-bold">Heizverbräuche ({ausweis.einheit_1}, {ausweis.einheit_2})</h3>
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<td>{ausweis.brennstoff_1}<br>{ausweis.brennstoff_2}</td>
|
|
||||||
<td>{ausweis.verbrauch_1}, {ausweis.verbrauch_2}, {ausweis.verbrauch_3}<br>{ausweis.verbrauch_4}, {ausweis.verbrauch_5}, {ausweis.verbrauch_6}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>{ausweis.warmwasser_enthalten ? "Warmwasser enthalten" : "Warmwasser nicht enthalten"}</td>
|
|
||||||
<td>{ausweis.anteil_warmwasser}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Alternative Energieversorgung</td>
|
|
||||||
<td>{aufnahme.alternative_heizung ? "Heizung" : ""}, {aufnahme.alternative_warmwasser ? "Warmwasser" : ""} {aufnahme.alternative_lueftung ? "Lüftung" : ""} {aufnahme.alternative_kuehlung ? "Kühlung" : ""}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Leerstand</td>
|
|
||||||
<td>{aufnahme.leerstand}</td>
|
|
||||||
</tr>
|
|
||||||
<!-- <tr>
|
|
||||||
<td>{aufnahme.lueftung}</td>
|
|
||||||
<td>{aufnahme.kuehlung}</td>
|
|
||||||
</tr> -->
|
|
||||||
<!-- <tr>
|
|
||||||
<td>Sanierungszustand: Zentralheizung</td>
|
|
||||||
</tr> -->
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -535,16 +497,16 @@
|
|||||||
<div class="flex flex-row md:flex-row gap-4 mb-4">
|
<div class="flex flex-row md:flex-row gap-4 mb-4">
|
||||||
|
|
||||||
<p class="text-lg text-gray-700 mb-1">
|
<p class="text-lg text-gray-700 mb-1">
|
||||||
<strong>Besteller:</strong> {benutzer.vorname} {benutzer.name}
|
<strong>Besteller:</strong> Norma Müller
|
||||||
</p>
|
</p>
|
||||||
<p class="text-lg text-gray-700">
|
<p class="text-lg text-gray-700">
|
||||||
<strong>Telefon:</strong> {benutzer.telefon}
|
<strong>Telefon:</strong> 0700 / 123456
|
||||||
</p>
|
</p>
|
||||||
<p class="text-lg text-gray-700">
|
<p class="text-lg text-gray-700">
|
||||||
<strong>E-Mail:</strong> {benutzer.email}
|
<strong>E-Mail:</strong> norma.mueller@web.de
|
||||||
</p>
|
</p>
|
||||||
<p class="text-lg text-gray-700">
|
<p class="text-lg text-gray-700">
|
||||||
<strong>Erstelldatum:</strong> {moment(ausweis.created_at).format("DD.MM.YYYY")}
|
<strong>Erstelldatum:</strong> 22.03.2025
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -561,6 +523,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<dialog bind:this={hilfeModal} class="modal">
|
<dialog bind:this={hilfeModal} class="modal">
|
||||||
<div class="modal-box">
|
<div class="modal-box">
|
||||||
|
|||||||
@@ -126,7 +126,10 @@ let lightTheme = Astro.cookies.get("theme")?.value === "light";
|
|||||||
<DashboardSidebar lightTheme={lightTheme} benutzer={user} client:load>
|
<DashboardSidebar lightTheme={lightTheme} benutzer={user} client:load>
|
||||||
</DashboardSidebar>
|
</DashboardSidebar>
|
||||||
|
|
||||||
|
<article class="box rounded-tl-none
|
||||||
|
xl:px-10 py-8">
|
||||||
<slot />
|
<slot />
|
||||||
|
</article>
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ export async function endEnergieVerbrauchVerbrauchsausweis_2016(
|
|||||||
energieVerbrauchHeizung_2 * durchschnittsKlimafaktor;
|
energieVerbrauchHeizung_2 * durchschnittsKlimafaktor;
|
||||||
|
|
||||||
let kuehlungsZuschlag = 0;
|
let kuehlungsZuschlag = 0;
|
||||||
if (aufnahme.kuehlung) {
|
if (aufnahme.kuehlung === "1") {
|
||||||
kuehlungsZuschlag = 6 * 3 * energetischeNutzflaeche;
|
kuehlungsZuschlag = 6 * 3 * energetischeNutzflaeche;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -499,7 +499,7 @@ export async function pdfVerbrauchsausweisWohnen(ausweis: VerbrauchsausweisWohne
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aufnahme.kuehlung) {
|
if (aufnahme.kuehlung === "1") {
|
||||||
/**
|
/**
|
||||||
* Kühlungszuschlag - Pauschale Erhöhung um 6kWh/m²
|
* Kühlungszuschlag - Pauschale Erhöhung um 6kWh/m²
|
||||||
* Primärenergiefaktor Strom
|
* Primärenergiefaktor Strom
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import AusweisPruefenNotification from "#components/AusweisPruefenNotification.svelte";
|
import AusweisPruefenNotification from "#components/AusweisPruefenNotification.svelte";
|
||||||
import Carousel from "#components/Carousel.svelte";
|
import Carousel from "#components/Carousel.svelte";
|
||||||
import DashboardAusweis from "#components/Dashboard/DashboardAusweis.svelte";
|
import DashboardAusweis from "#components/Dashboard/DashboardAusweis.svelte";
|
||||||
|
import DashboardNachweis from "#components/Dashboard/DashboardNachweis.svelte";
|
||||||
import NotificationProvider from "#components/NotificationProvider/NotificationProvider.svelte";
|
import NotificationProvider from "#components/NotificationProvider/NotificationProvider.svelte";
|
||||||
import { Objekt } from "#lib/client/prisma.js";
|
import { Objekt } from "#lib/client/prisma.js";
|
||||||
import mime from "mime"
|
import mime from "mime"
|
||||||
|
|||||||
@@ -2,28 +2,140 @@
|
|||||||
import "../../style/formular.css";
|
import "../../style/formular.css";
|
||||||
import {
|
import {
|
||||||
BenutzerClient,
|
BenutzerClient,
|
||||||
|
ObjektClient,
|
||||||
ObjektKomplettClient,
|
ObjektKomplettClient,
|
||||||
} from "#components/Ausweis/types.js";
|
} from "#components/Ausweis/types.js";
|
||||||
|
import DashboardObjekt from "#components/Dashboard/DashboardObjekt.svelte";
|
||||||
|
import Overlay from "#components/Overlay.svelte";
|
||||||
|
import PlzSuche from "#components/PlzSuche.svelte";
|
||||||
|
import { api } from "astro-typesafe-api/client";
|
||||||
import NotificationWrapper from "#components/Notifications/NotificationWrapper.svelte";
|
import NotificationWrapper from "#components/Notifications/NotificationWrapper.svelte";
|
||||||
|
import { addNotification } from "#components/Notifications/shared.js";
|
||||||
|
import Cookies from "js-cookie";
|
||||||
|
import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants.js";
|
||||||
|
import Pagination from "#components/Pagination.svelte";
|
||||||
|
import AusweisePruefenFilter from "#components/Dashboard/AusweisePruefenFilter.svelte";
|
||||||
|
import { filterAusweise } from "#lib/filters.js";
|
||||||
|
import { z, ZodTypeAny } from "zod";
|
||||||
import { Enums } from "#lib/client/prisma.js";
|
import { Enums } from "#lib/client/prisma.js";
|
||||||
import DashboardAusweis from "#components/Dashboard/DashboardAusweis.svelte";
|
|
||||||
|
|
||||||
export let user: BenutzerClient;
|
export let user: BenutzerClient;
|
||||||
export let objekt: ObjektKomplettClient;
|
export let objekte: ObjektKomplettClient[];
|
||||||
export let page: number;
|
export let page: number;
|
||||||
export let totalPages: number;
|
export let totalPages: number;
|
||||||
|
|
||||||
|
let objektOverlayHidden = true;
|
||||||
|
|
||||||
|
let objekt: Omit<ObjektClient, "uid"> = {
|
||||||
|
adresse: "",
|
||||||
|
erstellungsdatum: new Date(),
|
||||||
|
latitude: 0,
|
||||||
|
longitude: 0,
|
||||||
|
ort: "",
|
||||||
|
plz: ""
|
||||||
|
};
|
||||||
|
|
||||||
|
async function objektErstellen() {
|
||||||
|
if (!objekt.adresse || !objekt.ort || !objekt.plz) {
|
||||||
|
addNotification({
|
||||||
|
message: "Daten unvollständig.",
|
||||||
|
subtext: "Ihre eingegebenen Daten sind unvollständig, bitte vervollständigen sie diese und versuchen sie es erneut..",
|
||||||
|
timeout: 3000,
|
||||||
|
dismissable: true,
|
||||||
|
type: "error"
|
||||||
|
})
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = await api.objekt.PUT.fetch({
|
||||||
|
adresse: objekt.adresse,
|
||||||
|
latitude: 0,
|
||||||
|
longitude: 0,
|
||||||
|
ort: objekt.ort,
|
||||||
|
plz: objekt.plz
|
||||||
|
}, {
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!result) {
|
||||||
|
addNotification({
|
||||||
|
message: "Etwas ist schiefgelaufen.",
|
||||||
|
subtext: "Das Objekt konnte nicht erstellt werden.",
|
||||||
|
timeout: 3000,
|
||||||
|
dismissable: true,
|
||||||
|
type: "error"
|
||||||
|
})
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
objektOverlayHidden = true;
|
||||||
|
|
||||||
|
objekte.push({
|
||||||
|
...objekt,
|
||||||
|
aufnahmen: [],
|
||||||
|
id: result.id
|
||||||
|
})
|
||||||
|
|
||||||
|
objekt = {
|
||||||
|
adresse: "",
|
||||||
|
erstellungsdatum: new Date(),
|
||||||
|
latitude: 0,
|
||||||
|
longitude: 0,
|
||||||
|
ort: "",
|
||||||
|
plz: ""
|
||||||
|
}
|
||||||
|
|
||||||
|
objekte = objekte
|
||||||
|
}
|
||||||
|
let filters: { name: keyof z.infer<typeof filterAusweise>, type: ZodTypeAny, value: any }[] = []
|
||||||
|
|
||||||
export let id: string = "";
|
export let id: string = "";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<h1>Ihre aktuellen Vorgänge</h1>
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
{#if user.rolle === Enums.BenutzerRolle.ADMIN}
|
{#if user.rolle === Enums.BenutzerRolle.ADMIN}
|
||||||
|
<!-- <div class="flex flex-col mb-4">
|
||||||
|
<AusweisePruefenFilter bind:filters={filters}></AusweisePruefenFilter>
|
||||||
|
</div> -->
|
||||||
<form action="" class="flex flex-row gap-2 my-2">
|
<form action="" class="flex flex-row gap-2 my-2">
|
||||||
<input type="text" bind:value={id} name="id" placeholder="ID">
|
<input type="text" bind:value={id} name="id" placeholder="ID">
|
||||||
<button class="button text-sm">Suchen</button>
|
<button class="button text-sm">Suchen</button>
|
||||||
</form>
|
</form>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
<!-- <div class="relative mb-6">
|
||||||
|
<button class="button" on:click={() => {
|
||||||
|
objektOverlayHidden = false
|
||||||
|
}}> Gebäude anlegen + </button>
|
||||||
|
</div> -->
|
||||||
|
|
||||||
<DashboardAusweis objekt={objekt} ausweis={objekt.aufnahmen[0].verbrauchsausweise_wohnen[0]} aufnahme={objekt.aufnahmen[0]} rechnung={objekt.aufnahmen[0].verbrauchsausweise_wohnen[0].rechnung} benutzer={user}></DashboardAusweis>
|
<div class="grid grid-cols-1 md:grid-cols-1 lg:grid-cols-1 gap-4">
|
||||||
|
{#each objekte as objekt}
|
||||||
|
<DashboardObjekt {objekt}></DashboardObjekt>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Pagination pages={totalPages} current={page} prev="/dashboard/objekte/{page - 1}" next="/dashboard/objekte/{page + 1}"></Pagination>
|
||||||
|
|
||||||
|
|
||||||
|
<Overlay bind:hidden={objektOverlayHidden}>
|
||||||
|
<div class="bg-white w-full max-w-screen-sm px-4 py-6 flex flex-col gap-4">
|
||||||
|
<h2 class="p-0 m-0">Gebäude erstellen</h2>
|
||||||
|
|
||||||
|
<input type="text" placeholder="Adresse" bind:value={objekt.adresse}>
|
||||||
|
<div class="flex flex-row gap-4 justify-between">
|
||||||
|
<PlzSuche bind:city={objekt.ort} bind:zip={objekt.plz} name="" placeholder="PLZ"></PlzSuche>
|
||||||
|
<input type="text" bind:value={objekt.ort} placeholder="Ort">
|
||||||
|
</div>
|
||||||
|
<button class="button mt-4" on:click={objektErstellen}>Gebäude Erstellen</button>
|
||||||
|
</div>
|
||||||
|
</Overlay>
|
||||||
|
|
||||||
<NotificationWrapper></NotificationWrapper>
|
<NotificationWrapper></NotificationWrapper>
|
||||||
@@ -2,7 +2,7 @@ import { z } from "zod";
|
|||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import { prisma } from "#lib/server/prisma.js";
|
import { prisma } from "#lib/server/prisma.js";
|
||||||
import { encodeToken } from "../../../lib/auth/token.js";
|
import { encodeToken } from "../../../lib/auth/token.js";
|
||||||
import { hashPassword, validatePassword } from "../../../lib/password.js";
|
import { validatePassword } from "../../../lib/password.js";
|
||||||
import { APIError, defineApiRoute } from "astro-typesafe-api/server";
|
import { APIError, defineApiRoute } from "astro-typesafe-api/server";
|
||||||
import { TokenType } from "#lib/auth/types.js";
|
import { TokenType } from "#lib/auth/types.js";
|
||||||
import { UUidWithPrefix } from "#components/Ausweis/types.js";
|
import { UUidWithPrefix } from "#components/Ausweis/types.js";
|
||||||
|
|||||||
@@ -1,42 +1,5 @@
|
|||||||
---
|
---
|
||||||
import { Enums, prisma } from "#lib/server/prisma";
|
return Astro.redirect("/dashboard/objekte/1", 301);
|
||||||
import { getCurrentUser } from "#lib/server/user";
|
|
||||||
|
|
||||||
const user = await getCurrentUser(Astro)
|
|
||||||
|
|
||||||
if (!user) {
|
|
||||||
return Astro.redirect("/auth/login")
|
|
||||||
}
|
|
||||||
|
|
||||||
const options: any = {
|
|
||||||
where: user.rolle === Enums.BenutzerRolle.ADMIN ? {} : {
|
|
||||||
benutzer: {
|
|
||||||
id: user.id
|
|
||||||
}
|
|
||||||
},
|
|
||||||
orderBy: {
|
|
||||||
created_at: "desc"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const lastVerbrauchsausweisWohnen = await prisma.verbrauchsausweisWohnen.findFirst(options)
|
|
||||||
|
|
||||||
if (lastVerbrauchsausweisWohnen) {
|
|
||||||
return Astro.redirect(`/dashboard/objekte/${lastVerbrauchsausweisWohnen.id}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
const lastVerbrauchsausweisGewerbe = await prisma.verbrauchsausweisGewerbe.findFirst(options)
|
|
||||||
|
|
||||||
if (lastVerbrauchsausweisGewerbe) {
|
|
||||||
return Astro.redirect(`/dashboard/objekte/${lastVerbrauchsausweisGewerbe.id}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
const lastBedarfsausweisWohnen = await prisma.bedarfsausweisWohnen.findFirst(options)
|
|
||||||
|
|
||||||
if (lastBedarfsausweisWohnen) {
|
|
||||||
return Astro.redirect(`/dashboard/objekte/${lastBedarfsausweisWohnen.id}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<script></script>
|
<script></script>
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
---
|
|
||||||
import UserLayout from "#layouts/DashboardLayout.astro";
|
|
||||||
import { Enums, prisma } from "#lib/server/prisma";
|
|
||||||
import DashboardModule from "#modules/Dashboard/DashboardModule.svelte";
|
|
||||||
import { getCurrentUser } from "#lib/server/user";
|
|
||||||
import { getPrismaAusweisAdapter } from "#lib/server/ausweis";
|
|
||||||
|
|
||||||
const id = Astro.params.id as string;
|
|
||||||
|
|
||||||
const user = await getCurrentUser(Astro);
|
|
||||||
|
|
||||||
if (!user) {
|
|
||||||
return Astro.redirect("/auth/login");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const adapter = getPrismaAusweisAdapter(id);
|
|
||||||
|
|
||||||
if (!adapter) {
|
|
||||||
return Astro.redirect("/dashboard");
|
|
||||||
}
|
|
||||||
|
|
||||||
const objekt = await prisma.objekt.findFirst({
|
|
||||||
where: {
|
|
||||||
OR: [
|
|
||||||
{
|
|
||||||
aufnahmen: {
|
|
||||||
every: {
|
|
||||||
verbrauchsausweise_gewerbe: {
|
|
||||||
some: {
|
|
||||||
id,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
aufnahmen: {
|
|
||||||
every: {
|
|
||||||
verbrauchsausweise_wohnen: {
|
|
||||||
some: {
|
|
||||||
id,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
aufnahmen: {
|
|
||||||
every: {
|
|
||||||
bedarfsausweise_wohnen: {
|
|
||||||
some: {
|
|
||||||
id,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
include: {
|
|
||||||
aufnahmen: {
|
|
||||||
include: {
|
|
||||||
bilder: true,
|
|
||||||
unterlagen: true,
|
|
||||||
bedarfsausweise_wohnen: true,
|
|
||||||
verbrauchsausweise_gewerbe: true,
|
|
||||||
verbrauchsausweise_wohnen: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
---
|
|
||||||
|
|
||||||
<UserLayout title="Objekte" {user}>
|
|
||||||
<DashboardModule
|
|
||||||
{user}
|
|
||||||
{objekt}
|
|
||||||
client:load
|
|
||||||
/>
|
|
||||||
</UserLayout>
|
|
||||||
96
src/pages/dashboard/objekte/[page].astro
Normal file
96
src/pages/dashboard/objekte/[page].astro
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
---
|
||||||
|
import UserLayout from "#layouts/DashboardLayout.astro";
|
||||||
|
import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants";
|
||||||
|
import { Enums, prisma } from "#lib/server/prisma";
|
||||||
|
import { createCaller } from "src/astro-typesafe-api-caller";
|
||||||
|
import DashboardModule from "#modules/Dashboard/DashboardModule.svelte";
|
||||||
|
|
||||||
|
const caller = createCaller(Astro)
|
||||||
|
|
||||||
|
const params = Astro.params;
|
||||||
|
const page = Number(params.page)
|
||||||
|
|
||||||
|
const id = Astro.url.searchParams.get("id") || undefined;
|
||||||
|
|
||||||
|
|
||||||
|
const user = await caller.user.self.GET.fetch(undefined, {
|
||||||
|
headers: {
|
||||||
|
"Authorization": `Bearer ${Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value}`
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!user) {
|
||||||
|
return Astro.redirect("/auth/login")
|
||||||
|
}
|
||||||
|
|
||||||
|
const totalPages = await prisma.objekt.count({
|
||||||
|
where: user.rolle === Enums.BenutzerRolle.USER ? {
|
||||||
|
benutzer: {
|
||||||
|
id: user.id
|
||||||
|
}
|
||||||
|
} : {}
|
||||||
|
})
|
||||||
|
|
||||||
|
const objekte = await prisma.objekt.findMany({
|
||||||
|
where: user.rolle === Enums.BenutzerRolle.USER ? {
|
||||||
|
benutzer: {
|
||||||
|
id: user.id
|
||||||
|
},
|
||||||
|
} : {
|
||||||
|
...(id ? {OR: [
|
||||||
|
{
|
||||||
|
aufnahmen: {
|
||||||
|
every: {
|
||||||
|
verbrauchsausweise_gewerbe: {
|
||||||
|
some: {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
aufnahmen: {
|
||||||
|
every: {
|
||||||
|
verbrauchsausweise_wohnen: {
|
||||||
|
some: {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
aufnahmen: {
|
||||||
|
every: {
|
||||||
|
bedarfsausweise_wohnen: {
|
||||||
|
some: {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},]} : {})
|
||||||
|
},
|
||||||
|
orderBy: {
|
||||||
|
erstellungsdatum: "desc"
|
||||||
|
},
|
||||||
|
include: {
|
||||||
|
aufnahmen: {
|
||||||
|
include: {
|
||||||
|
bilder: true,
|
||||||
|
unterlagen: true,
|
||||||
|
bedarfsausweise_wohnen: true,
|
||||||
|
verbrauchsausweise_gewerbe: true,
|
||||||
|
verbrauchsausweise_wohnen: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
take: 25,
|
||||||
|
skip: (page - 1) * 25
|
||||||
|
})
|
||||||
|
---
|
||||||
|
|
||||||
|
<UserLayout title="Objekte" {user}>
|
||||||
|
<DashboardModule {user} {objekte} totalPages={Math.ceil(totalPages / 25)} page={page} {id} client:load />
|
||||||
|
</UserLayout>
|
||||||
Reference in New Issue
Block a user