Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d98a5065ef | ||
|
|
54d8fb5d1b | ||
|
|
feef273c8c | ||
|
|
e48cd6acde | ||
|
|
8791516498 | ||
|
|
19136d475d | ||
|
|
3983aabcb2 | ||
|
|
4d6b8283ff | ||
|
|
5f5e3f4bed | ||
|
|
85591431eb | ||
|
|
4d9bae412c | ||
|
|
9fa8ee2251 | ||
|
|
5d0ef29272 | ||
|
|
36bcacd8a2 | ||
|
|
d6fc6be6d0 | ||
|
|
5869b282c4 | ||
|
|
e2f230e240 | ||
|
|
b8bb16b0ba | ||
|
|
42b2767c70 | ||
|
|
7e047125a7 | ||
|
|
058a84025c | ||
|
|
d76b8b4e14 | ||
|
|
58a8136479 | ||
|
|
c7f18dd7ae | ||
|
|
235969ccda | ||
|
|
fe06c09336 | ||
|
|
01d3824514 | ||
|
|
39e91dae7b | ||
|
|
8d7d59bb4e |
@@ -61,16 +61,4 @@ jobs:
|
|||||||
curl -H "Content-Type: application/json" \
|
curl -H "Content-Type: application/json" \
|
||||||
-X POST \
|
-X POST \
|
||||||
-d "{\"content\": \"🚨 Auto-Merge fehlgeschlagen! Bitte manuell prüfen: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}" \
|
-d "{\"content\": \"🚨 Auto-Merge fehlgeschlagen! Bitte manuell prüfen: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}" \
|
||||||
${{ secrets.DISCORD_WEBHOOK_URL }}
|
|
||||||
|
|
||||||
notify_success:
|
|
||||||
needs: merge
|
|
||||||
if: success()
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Send Discord notification on success
|
|
||||||
run: |
|
|
||||||
curl -H "Content-Type: application/json" \
|
|
||||||
-X POST \
|
|
||||||
-d "{\"content\": \"✅ Auto-Merge ausgeführt! Ergebnis jetzt auf [GitHub](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) und [online-energieausweis.org](https://online-energieausweis.org) einsehen.\"}" \
|
|
||||||
${{ secrets.DISCORD_WEBHOOK_URL }}
|
${{ secrets.DISCORD_WEBHOOK_URL }}
|
||||||
4
.github/workflows/prevent-wrong-pr.yml
vendored
4
.github/workflows/prevent-wrong-pr.yml
vendored
@@ -13,6 +13,8 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Prevent dev merges
|
- name: Prevent dev merges
|
||||||
run: |
|
run: |
|
||||||
|
echo "${{ github.head_ref }}";
|
||||||
|
echo "${{ github.base_ref }}";
|
||||||
if [[ "${{ github.head_ref }}" == "dev" ]]; then
|
if [[ "${{ github.head_ref }}" == "dev" ]]; then
|
||||||
echo "ERROR: Merging 'dev' into '${{ github.base_ref }}' is forbidden!"
|
echo "ERROR: Merging 'dev' into '${{ github.base_ref }}' is forbidden!"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -21,6 +23,8 @@ jobs:
|
|||||||
- name: Allow only staging into main
|
- name: Allow only staging into main
|
||||||
if: github.base_ref == 'main'
|
if: github.base_ref == 'main'
|
||||||
run: |
|
run: |
|
||||||
|
echo "${{ github.head_ref }}";
|
||||||
|
echo "${{ github.base_ref }}";
|
||||||
if [[ "${{ github.head_ref }}" != "staging" ]]; then
|
if [[ "${{ github.head_ref }}" != "staging" ]]; then
|
||||||
echo "ERROR: Only 'staging' branch is allowed to merge into 'main'. Current: '${{ github.head_ref }}'"
|
echo "ERROR: Only 'staging' branch is allowed to merge into 'main'. Current: '${{ github.head_ref }}'"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
5
Makefile
5
Makefile
@@ -10,7 +10,7 @@ PERSISTENT_DIR := $(HOME)/persistent/$(APP_NAME)
|
|||||||
BACKUP_FILENAME := $(HOME)/backups/$(shell date +"%Y-%m-%d_%H-%M-%S").sql.gz
|
BACKUP_FILENAME := $(HOME)/backups/$(shell date +"%Y-%m-%d_%H-%M-%S").sql.gz
|
||||||
|
|
||||||
online-energieausweis:
|
online-energieausweis:
|
||||||
bun run dev --host
|
NODE_ENV="development" bun run dev --host
|
||||||
|
|
||||||
dev: database online-energieausweis
|
dev: database online-energieausweis
|
||||||
|
|
||||||
@@ -30,6 +30,7 @@ run-database: stop-database
|
|||||||
docker volume create $(DB_VOLUME)
|
docker volume create $(DB_VOLUME)
|
||||||
docker build -t $(DB_CONTAINER_NAME) .
|
docker build -t $(DB_CONTAINER_NAME) .
|
||||||
docker run -d --name $(DB_CONTAINER_NAME) \
|
docker run -d --name $(DB_CONTAINER_NAME) \
|
||||||
|
--restart=always \
|
||||||
-e POSTGRES_USER=$(DB_USER) \
|
-e POSTGRES_USER=$(DB_USER) \
|
||||||
-e POSTGRES_PASSWORD=$(DB_PASSWORD) \
|
-e POSTGRES_PASSWORD=$(DB_PASSWORD) \
|
||||||
-p $(DB_PORT):5432 \
|
-p $(DB_PORT):5432 \
|
||||||
@@ -71,4 +72,4 @@ prod: install-dependencies prisma-studio backup-database-cronjob update-dwd-klim
|
|||||||
|
|
||||||
backup-database-cronjob:
|
backup-database-cronjob:
|
||||||
- pm2 delete daily-db-backup
|
- pm2 delete daily-db-backup
|
||||||
pm2 start bash --name "daily-db-backup" --cron "0 0 * * *" -- backup-database.bash
|
pm2 start bash --name "daily-db-backup" --no-autorestart --cron "0 0 * * *" -- backup-database.bash
|
||||||
@@ -2,6 +2,7 @@ version: '3'
|
|||||||
services:
|
services:
|
||||||
database:
|
database:
|
||||||
build: ./
|
build: ./
|
||||||
|
restart: always
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
ports:
|
ports:
|
||||||
|
|||||||
@@ -22,17 +22,17 @@ export const createCaller = createCallerFactory({
|
|||||||
"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"),
|
||||||
"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-gewerbe/[id]": await import("../src/pages/api/geg-nachweis-gewerbe/[id].ts"),
|
"geg-nachweis-gewerbe/[id]": await import("../src/pages/api/geg-nachweis-gewerbe/[id].ts"),
|
||||||
"geg-nachweis-gewerbe": await import("../src/pages/api/geg-nachweis-gewerbe/index.ts"),
|
"geg-nachweis-gewerbe": await import("../src/pages/api/geg-nachweis-gewerbe/index.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"),
|
||||||
"objekt": await import("../src/pages/api/objekt/index.ts"),
|
"objekt": await import("../src/pages/api/objekt/index.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"),
|
||||||
"user": await import("../src/pages/api/user/index.ts"),
|
"user": await import("../src/pages/api/user/index.ts"),
|
||||||
"user/self": await import("../src/pages/api/user/self.ts"),
|
"user/self": await import("../src/pages/api/user/self.ts"),
|
||||||
"ticket": await import("../src/pages/api/ticket/index.ts"),
|
|
||||||
"verbrauchsausweis-wohnen/[id]": await import("../src/pages/api/verbrauchsausweis-wohnen/[id].ts"),
|
"verbrauchsausweis-wohnen/[id]": await import("../src/pages/api/verbrauchsausweis-wohnen/[id].ts"),
|
||||||
"verbrauchsausweis-wohnen": await import("../src/pages/api/verbrauchsausweis-wohnen/index.ts"),
|
"verbrauchsausweis-wohnen": await import("../src/pages/api/verbrauchsausweis-wohnen/index.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"),
|
||||||
|
|||||||
15
src/client/lib/lesen.ts
Normal file
15
src/client/lib/lesen.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants.js";
|
||||||
|
import { Benutzer } from "#lib/client/prisma.js";
|
||||||
|
import { api } from "astro-typesafe-api/client";
|
||||||
|
import Cookies from "js-cookie";
|
||||||
|
|
||||||
|
export async function benutzerLesen(benutzerId: string): Promise<Benutzer> {
|
||||||
|
const benutzer = await api.user.GET.fetch({ id: benutzerId }
|
||||||
|
, {
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return benutzer[0];
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants.js";
|
import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants.js";
|
||||||
import { Aufnahme, Objekt } from "#lib/client/prisma.js";
|
import { Aufnahme, Benutzer, Objekt } from "#lib/client/prisma.js";
|
||||||
import { api } from "astro-typesafe-api/client";
|
import { api } from "astro-typesafe-api/client";
|
||||||
import Cookies from "js-cookie";
|
import Cookies from "js-cookie";
|
||||||
|
|
||||||
@@ -161,4 +161,32 @@ export async function objektSpeichern(objekt: Objekt & { id?: string }): Promise
|
|||||||
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function benutzerSpeichern(benutzer: Partial<Benutzer>): Promise<string> {
|
||||||
|
const completeBenutzer: Benutzer = {
|
||||||
|
id: benutzer.id,
|
||||||
|
name: benutzer.name ?? null,
|
||||||
|
email: benutzer.email,
|
||||||
|
passwort: "",
|
||||||
|
adresse: benutzer.adresse ?? null,
|
||||||
|
anrede: benutzer.anrede ?? null,
|
||||||
|
firma: benutzer.firma ?? null,
|
||||||
|
vorname: benutzer.vorname ?? null,
|
||||||
|
ort: benutzer.ort ?? null,
|
||||||
|
plz: benutzer.plz ?? null,
|
||||||
|
profilbild: benutzer.profilbild ?? null,
|
||||||
|
telefon: benutzer.telefon ?? null,
|
||||||
|
updated_at: new Date(),
|
||||||
|
verified: benutzer.verified ?? false,
|
||||||
|
};
|
||||||
|
|
||||||
|
await api.user.POST.fetch(completeBenutzer
|
||||||
|
, {
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${Cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)}`
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return benutzer.id;
|
||||||
}
|
}
|
||||||
109
src/components/Abrechnung/AbrechungTable.svelte
Normal file
109
src/components/Abrechnung/AbrechungTable.svelte
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { BedarfsausweisWohnen, Enums, Rechnung, VerbrauchsausweisGewerbe, VerbrauchsausweisWohnen } from "#lib/server/prisma.js";
|
||||||
|
import moment from "moment";
|
||||||
|
import { format } from "sharp";
|
||||||
|
|
||||||
|
export let bestellungen: (Rechnung & {
|
||||||
|
verbrauchsausweis_wohnen: VerbrauchsausweisWohnen | null,
|
||||||
|
verbrauchsausweis_gewerbe: VerbrauchsausweisGewerbe | null,
|
||||||
|
bedarfsausweis_wohnen: BedarfsausweisWohnen | null,
|
||||||
|
})[];
|
||||||
|
export let provisionen: Record<Enums.Ausweisart, number>;
|
||||||
|
export let partnerCodeErstesMal: Date;
|
||||||
|
|
||||||
|
const bestellungenNachMonat: Record<string, (typeof bestellungen)> = {};
|
||||||
|
for (const bestellung of bestellungen) {
|
||||||
|
const monat = moment(bestellung.created_at).format("Y-m");
|
||||||
|
if (monat in bestellungenNachMonat) {
|
||||||
|
bestellungenNachMonat[monat].push(bestellung)
|
||||||
|
} else {
|
||||||
|
bestellungenNachMonat[monat] = [bestellung]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wir brauchen alle Monate zwischen dem ersten Mal, dass der partner_code benutzt wurde bis zum heutigen Zeitpunkt.
|
||||||
|
const months: Record<string, string> = {
|
||||||
|
"01": "Januar", "02": "Februar", "03": "März", "04": "April",
|
||||||
|
"05": "Mai", "06": "Juni", "07": "Juli", "08": "August",
|
||||||
|
"09": "September", "10": "Oktober", "11": "November", "12": "Dezember"
|
||||||
|
};
|
||||||
|
|
||||||
|
function getMonthlyPeriods(minTime?: Date): moment.Moment[] {
|
||||||
|
const min = minTime ? moment(minTime) : moment();
|
||||||
|
const start = min.clone().startOf('month');
|
||||||
|
|
||||||
|
const end = moment().add(1, 'month').startOf('month');
|
||||||
|
|
||||||
|
const monthsArray: moment.Moment[] = [];
|
||||||
|
const current = start.clone();
|
||||||
|
|
||||||
|
while (current.isBefore(end)) {
|
||||||
|
monthsArray.push(current.clone());
|
||||||
|
current.add(1, 'month');
|
||||||
|
}
|
||||||
|
|
||||||
|
return monthsArray.reverse(); // Most recent month first
|
||||||
|
}
|
||||||
|
|
||||||
|
const periods = getMonthlyPeriods(partnerCodeErstesMal)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#each periods as dt}
|
||||||
|
{@const jahrMonat = dt.format("Y-m")}
|
||||||
|
{#if jahrMonat in bestellungenNachMonat && bestellungenNachMonat[jahrMonat].length > 0}
|
||||||
|
<!-- Echo dropdown foreach month. -->
|
||||||
|
{@const provisionMonat = bestellungenNachMonat[jahrMonat].reduce((acc, bestellung) => {
|
||||||
|
if (bestellung.verbrauchsausweis_wohnen) {
|
||||||
|
return acc + provisionen[Enums.Ausweisart.VerbrauchsausweisWohnen];
|
||||||
|
}
|
||||||
|
if (bestellung.bedarfsausweis_wohnen) {
|
||||||
|
return acc + provisionen[Enums.Ausweisart.BedarfsausweisWohnen];
|
||||||
|
}
|
||||||
|
if (bestellung.verbrauchsausweis_gewerbe) {
|
||||||
|
return acc + provisionen[Enums.Ausweisart.VerbrauchsausweisGewerbe];
|
||||||
|
}
|
||||||
|
|
||||||
|
return acc;
|
||||||
|
}) * 1.19}
|
||||||
|
|
||||||
|
<div onclick="$(this).nextUntil('.dropdown_month').filter('table').toggle(); $('#betrag_gesamt').html('Abrechnungsbetrag $month_name: <b>$provision_month €</b>')" class='dropdown_month'>
|
||||||
|
<p>$month_name $year_name - Klicke, um Tabelle anzuzeigen</p>
|
||||||
|
<a target='_blank' rel='noreferrer noopener' href='/user/abrechnung/pdf.php?month={dt.format("m")}&year={dt.format("Y")}'>PDF Ansehen</a>
|
||||||
|
</div>
|
||||||
|
<table id='QTT' style='margin-top: 0 !important; display:none;'>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td style='text-align:center;'>ID</td>
|
||||||
|
<td style='text-align:center;'>DATUM</td>
|
||||||
|
<td style='width:11em;text-align:center;'>GEBÄUDEADRESSE </td>
|
||||||
|
<td style='width:11em;text-align:center;'>PLZ </td>
|
||||||
|
<td style='width:11em;text-align:center;'>ORT </td>
|
||||||
|
<td style='text-align:center;'>AUSWEIS</td>
|
||||||
|
<td style='width:5em;text-align:center;'>BETRAG NETTO</td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{#each bestellungenNachMonat[jahrMonat] as bestellung}
|
||||||
|
{@const provisionBestellung = bestellung.verbrauchsausweis_wohnen ? provisionen[Enums.Ausweisart.VerbrauchsausweisWohnen] : bestellung.verbrauchsausweis_gewerbe ? provisionen[Enums.Ausweisart.VerbrauchsausweisGewerbe] : provisionen[Enums.Ausweisart.BedarfsausweisWohnen]}
|
||||||
|
<tr>
|
||||||
|
<td style='width:1em;text-align:center;'>{bestellung.id}</td>
|
||||||
|
<td style='width:9em;text-align:center;font-weight:bold;'>{moment(bestellung.created_at).format("Y/m/d")}</td>
|
||||||
|
<td style='width:8em;text-align:left;'>{bestellung["objekt_strasse"]}</td>
|
||||||
|
<td style='width:5em;text-align:center;'>{bestellung["objekt_plz"]}</td>
|
||||||
|
<td style='width:6em;text-align:left;'>{bestellung["objekt_ort"]}</td>
|
||||||
|
<td style='width:3em;text-align:center;'>{bestellung['ausweisart']}</td>
|
||||||
|
<td style='width:8em;text-align:right;'>{provisionBestellung} €</td>
|
||||||
|
</tr>
|
||||||
|
{/each}
|
||||||
|
</table>
|
||||||
|
{/if}
|
||||||
|
{/each}
|
||||||
|
<!-- foreach ($period as $dt) {
|
||||||
|
$year_month = $dt->format("Y-m");
|
||||||
|
$month_name = $months[$dt->format("m")];
|
||||||
|
if ((new DateTime(date("m/d/Y", strtotime($EEtimestamp))))->format("d") - (new DateTime(date("m/d/Y", strtotime($SStimestamp))))->format("d") == 1) {
|
||||||
|
$Pall = $dt->format("d/m/Y") . ' bis ' . (new DateTime($today))->format("d/m/Y");
|
||||||
|
} -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- } -->
|
||||||
@@ -341,9 +341,6 @@
|
|||||||
<div class="w-full border rounded-lg my-2">
|
<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 class="bg-green-600 h-4 rounded-lg" class:bg-red-600={progress == 33} class:bg-primary={progress == 66} style="width: {progress}%;"></div>
|
||||||
</div>
|
</div>
|
||||||
<span class="text-sm font-semibold text-base-content"
|
|
||||||
>{progress}%</span
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
{#await calculations then calculations}
|
{#await calculations then calculations}
|
||||||
<div class="flex flex-col mb-4">
|
<div class="flex flex-col mb-4">
|
||||||
|
|||||||
@@ -70,6 +70,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
<a href="/dashboard/abrechnung" class="button ">Conversions</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr class="border-gray-600" />
|
<hr class="border-gray-600" />
|
||||||
|
|||||||
@@ -102,6 +102,13 @@ const { title } = Astro.props;
|
|||||||
|
|
||||||
<html lang="de">
|
<html lang="de">
|
||||||
<head>
|
<head>
|
||||||
|
<!-- Google Tag Manager -->
|
||||||
|
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
||||||
|
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
||||||
|
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||||
|
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
||||||
|
})(window,document,'script','dataLayer','GTM-59QKHH8');</script>
|
||||||
|
<!-- End Google Tag Manager -->
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/favicon.jpg" />
|
<link rel="icon" type="image/svg+xml" href="/favicon.jpg" />
|
||||||
@@ -147,6 +154,11 @@ const { title } = Astro.props;
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
<!-- Google Tag Manager (noscript) -->
|
||||||
|
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-59QKHH8"
|
||||||
|
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
||||||
|
<!-- End Google Tag Manager (noscript) -->
|
||||||
|
|
||||||
<Header {user} />
|
<Header {user} />
|
||||||
|
|
||||||
<main
|
<main
|
||||||
|
|||||||
@@ -1,157 +0,0 @@
|
|||||||
---
|
|
||||||
import "../style/global.css";
|
|
||||||
import "../style/formular.css";
|
|
||||||
import "../../svelte-dialogs.config";
|
|
||||||
import Header from "#components/design/header/AusweisHeaderImmowelt.astro";
|
|
||||||
import Footer from "#components/design/footer/Footer.astro";
|
|
||||||
import { NotificationWrapper } from "@ibcornelsen/ui";
|
|
||||||
|
|
||||||
export interface Props {
|
|
||||||
title: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { title } = Astro.props;
|
|
||||||
---
|
|
||||||
|
|
||||||
<script>
|
|
||||||
window.addEventListener("scroll", (event) => {
|
|
||||||
let scroll = window.scrollY;
|
|
||||||
|
|
||||||
console.log(scroll);
|
|
||||||
if (scroll >= 400) {
|
|
||||||
document
|
|
||||||
.getElementById("skala")
|
|
||||||
?.classList.add(
|
|
||||||
"2xl:fixed",
|
|
||||||
"2xl:py-4",
|
|
||||||
"2xl:top-0",
|
|
||||||
"2xl:z-20"
|
|
||||||
);
|
|
||||||
document.getElementById("skala")?.classList.remove("w-full");
|
|
||||||
|
|
||||||
document.getElementById("skala").style.borderBottom =
|
|
||||||
"3px solid #e6e6e6";
|
|
||||||
|
|
||||||
document.getElementById("performance-box").style.maxWidth =
|
|
||||||
"688.5px";
|
|
||||||
document.getElementById("progress-box").style.maxWidth = "688.5px";
|
|
||||||
|
|
||||||
document
|
|
||||||
.getElementById("formInput-1")
|
|
||||||
?.classList.add("2xl:mt-[370px]");
|
|
||||||
} else {
|
|
||||||
document
|
|
||||||
.getElementById("skala")
|
|
||||||
?.classList.remove(
|
|
||||||
"2xl:fixed",
|
|
||||||
"2xl:py-4",
|
|
||||||
"2xl:top-0",
|
|
||||||
"2xl:z-20"
|
|
||||||
);
|
|
||||||
document.getElementById("skala")?.classList.add("w-full");
|
|
||||||
|
|
||||||
document.getElementById("skala").style.borderBottom = "none";
|
|
||||||
|
|
||||||
document
|
|
||||||
.getElementById("formInput-1")
|
|
||||||
?.classList.remove("2xl:mt-[370px]");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<html lang="de">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<meta name="viewport" content="width=device-width" />
|
|
||||||
<link rel="icon" type="image/svg+xml" href="/favicon.jpg" />
|
|
||||||
|
|
||||||
<meta
|
|
||||||
name="description"
|
|
||||||
content="✅ Jetzt Ihren Energieausweis online erstellen. Erhalten Sie Ihren online Energieausweis rechtssicher und nach aktueller GEG (vormals EnEV) vom Diplom Ingenieur geprüft."
|
|
||||||
/>
|
|
||||||
<link rel="canonical" href="https://online-energieausweis.org/" />
|
|
||||||
|
|
||||||
<meta property="og:locale" content="de_DE" />
|
|
||||||
<meta property="og:type" content="website" />
|
|
||||||
<meta
|
|
||||||
property="og:title"
|
|
||||||
content="Energieausweis online erstellen - Online Energieausweis"
|
|
||||||
/>
|
|
||||||
<meta
|
|
||||||
property="og:description"
|
|
||||||
content="✅ Jetzt Ihren Energieausweis online erstellen. Erhalten Sie Ihren online Energieausweis rechtssicher und nach aktueller GEG (vormals EnEV) vom Diplom Ingenieur geprüft."
|
|
||||||
/>
|
|
||||||
<meta property="og:url" content="https://online-energieausweis.org/" />
|
|
||||||
<meta
|
|
||||||
property="og:site_name"
|
|
||||||
content="Energieausweis online erstellen"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<meta name="twitter:card" content="summary_large_image" />
|
|
||||||
<meta
|
|
||||||
name="twitter:description"
|
|
||||||
content="✅ Jetzt Ihren Energieausweis online erstellen. Erhalten Sie Ihren online Energieausweis rechtssicher und nach aktueller GEG (vormals EnEV) vom Diplom Ingenieur geprüft."
|
|
||||||
/>
|
|
||||||
<meta
|
|
||||||
name="twitter:title"
|
|
||||||
content="Energieausweis online erstellen - Online Energieausweis"
|
|
||||||
/>
|
|
||||||
<meta
|
|
||||||
name="twitter:image"
|
|
||||||
content="https://online-energieausweis.org/images/energieausweis-online-erstellen.jpg"
|
|
||||||
/>
|
|
||||||
<title>
|
|
||||||
{title || "Energieausweis online erstellen - Online Energieausweis"}
|
|
||||||
</title>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<Header />
|
|
||||||
|
|
||||||
<main
|
|
||||||
class="w-full p-0 grid
|
|
||||||
xs:grid-cols-[minmax(1fr)] xs:gap-1 xs:p-0
|
|
||||||
sm:grid-cols-[minmax(1fr)] sm:gap-1 sm:p-0
|
|
||||||
md:grid-cols-[minmax(1fr)] md:gap-2 md:p-0
|
|
||||||
lg:grid-cols-[minmax(1fr)] lg:gap-3 lg:p-4
|
|
||||||
xl:grid-cols-[minmax(1fr)] xl:gap-4 xl:p-6
|
|
||||||
2xl:grid-cols-[minmax(1fr)] 2xl:gap-5 2xl:p-6"
|
|
||||||
>
|
|
||||||
<article class="box rounded-tl-none p-2 lg:p-12">
|
|
||||||
<slot />
|
|
||||||
</article>
|
|
||||||
</main>
|
|
||||||
|
|
||||||
<Footer />
|
|
||||||
<NotificationWrapper client:load />
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
||||||
<style is:global lang="postcss">
|
|
||||||
body {
|
|
||||||
min-height: 100vh;
|
|
||||||
width:100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
article {
|
|
||||||
p, h1, h2, h3, h4, h5, h6 {
|
|
||||||
@apply text-base-content;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.headline {
|
|
||||||
@apply text-lg;
|
|
||||||
}
|
|
||||||
|
|
||||||
.radio-inline {
|
|
||||||
@apply flex flex-row gap-2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.checkbox-inline {
|
|
||||||
@apply flex flex-row gap-2;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -1,156 +0,0 @@
|
|||||||
---
|
|
||||||
import "../style/global.css";
|
|
||||||
import "../style/formular.css";
|
|
||||||
import "../../svelte-dialogs.config"
|
|
||||||
import Header from "#components/design/header/AusweisHeaderImmowelt2.astro";
|
|
||||||
import Footer from "#components/design/footer/Footer.astro";
|
|
||||||
import { NotificationWrapper } from "@ibcornelsen/ui";
|
|
||||||
|
|
||||||
export interface Props {
|
|
||||||
title: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { title } = Astro.props;
|
|
||||||
---
|
|
||||||
<script>
|
|
||||||
window.addEventListener("scroll", (event) => {
|
|
||||||
let scroll = window.scrollY;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
console.log(scroll);
|
|
||||||
if(scroll>=400){
|
|
||||||
|
|
||||||
document.getElementById('skala')?.classList.add('2xl:fixed','2xl:py-4','2xl:top-0','2xl:z-20');
|
|
||||||
document.getElementById('skala')?.classList.remove('w-full');
|
|
||||||
|
|
||||||
|
|
||||||
document.getElementById('skala').style.borderBottom = "3px solid #e6e6e6";
|
|
||||||
|
|
||||||
|
|
||||||
document.getElementById('performance-box').style.maxWidth = "688.5px";
|
|
||||||
document.getElementById('progress-box').style.maxWidth = "688.5px";
|
|
||||||
|
|
||||||
document.getElementById('formInput-1')?.classList.add('2xl:mt-[370px]');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}else{
|
|
||||||
|
|
||||||
document.getElementById('skala')?.classList.remove('2xl:fixed','2xl:py-4','2xl:top-0','2xl:z-20');
|
|
||||||
document.getElementById('skala')?.classList.add('w-full');
|
|
||||||
|
|
||||||
document.getElementById('skala').style.borderBottom = "none";
|
|
||||||
|
|
||||||
document.getElementById('formInput-1')?.classList.remove('2xl:mt-[370px]');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="de">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<meta name="viewport" content="width=device-width" />
|
|
||||||
<link rel="icon" type="image/svg+xml" href="/favicon.jpg" />
|
|
||||||
|
|
||||||
<meta
|
|
||||||
name="description"
|
|
||||||
content="✅ Jetzt Ihren Energieausweis online erstellen. Erhalten Sie Ihren online Energieausweis rechtssicher und nach aktueller GEG (vormals EnEV) vom Diplom Ingenieur geprüft."
|
|
||||||
/>
|
|
||||||
<link rel="canonical" href="https://online-energieausweis.org/" />
|
|
||||||
|
|
||||||
<meta property="og:locale" content="de_DE" />
|
|
||||||
<meta property="og:type" content="website" />
|
|
||||||
<meta
|
|
||||||
property="og:title"
|
|
||||||
content="Energieausweis online erstellen - Online Energieausweis"
|
|
||||||
/>
|
|
||||||
<meta
|
|
||||||
property="og:description"
|
|
||||||
content="✅ Jetzt Ihren Energieausweis online erstellen. Erhalten Sie Ihren online Energieausweis rechtssicher und nach aktueller GEG (vormals EnEV) vom Diplom Ingenieur geprüft."
|
|
||||||
/>
|
|
||||||
<meta property="og:url" content="https://online-energieausweis.org/" />
|
|
||||||
<meta property="og:site_name" content="Energieausweis online erstellen" />
|
|
||||||
|
|
||||||
<meta name="twitter:card" content="summary_large_image" />
|
|
||||||
<meta
|
|
||||||
name="twitter:description"
|
|
||||||
content="✅ Jetzt Ihren Energieausweis online erstellen. Erhalten Sie Ihren online Energieausweis rechtssicher und nach aktueller GEG (vormals EnEV) vom Diplom Ingenieur geprüft."
|
|
||||||
/>
|
|
||||||
<meta
|
|
||||||
name="twitter:title"
|
|
||||||
content="Energieausweis online erstellen - Online Energieausweis"
|
|
||||||
/>
|
|
||||||
<meta
|
|
||||||
name="twitter:image"
|
|
||||||
content="https://online-energieausweis.org/images/energieausweis-online-erstellen.jpg"
|
|
||||||
/>
|
|
||||||
<title>
|
|
||||||
{title || 'Energieausweis online erstellen - Online Energieausweis'}
|
|
||||||
</title>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<Header />
|
|
||||||
|
|
||||||
<main
|
|
||||||
class="w-full p-0 grid
|
|
||||||
xs:grid-cols-[minmax(1fr)] xs:gap-1 xs:p-0
|
|
||||||
sm:grid-cols-[minmax(1fr)] sm:gap-1 sm:p-0
|
|
||||||
md:grid-cols-[minmax(1fr)] md:gap-2 md:p-0
|
|
||||||
lg:grid-cols-[minmax(1fr)] lg:gap-3 lg:p-4
|
|
||||||
xl:grid-cols-[minmax(1fr)] xl:gap-4 xl:p-6
|
|
||||||
2xl:grid-cols-[minmax(1fr)] 2xl:gap-5 2xl:p-6
|
|
||||||
">
|
|
||||||
|
|
||||||
|
|
||||||
<article class="box rounded-tl-none p-2 lg:p-12">
|
|
||||||
<slot />
|
|
||||||
</article>
|
|
||||||
|
|
||||||
</main>
|
|
||||||
|
|
||||||
<Footer />
|
|
||||||
<NotificationWrapper client:load />
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
||||||
<style is:global lang="postcss">
|
|
||||||
body {
|
|
||||||
min-height: 100vh;
|
|
||||||
width:100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
article {
|
|
||||||
p, h1, h2, h3, h4, h5, h6 {
|
|
||||||
@apply text-base-content;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.headline {
|
|
||||||
@apply text-lg;
|
|
||||||
}
|
|
||||||
|
|
||||||
.radio-inline {
|
|
||||||
@apply flex flex-row gap-2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.checkbox-inline {
|
|
||||||
@apply flex flex-row gap-2;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
@@ -85,6 +85,14 @@ window.addEventListener("scroll", () => {
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="de">
|
<html lang="de">
|
||||||
<head>
|
<head>
|
||||||
|
<!-- Google Tag Manager -->
|
||||||
|
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
||||||
|
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
||||||
|
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||||
|
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
||||||
|
})(window,document,'script','dataLayer','GTM-59QKHH8');</script>
|
||||||
|
<!-- End Google Tag Manager -->
|
||||||
|
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/favicon.jpg" />
|
<link rel="icon" type="image/svg+xml" href="/favicon.jpg" />
|
||||||
@@ -127,7 +135,11 @@ window.addEventListener("scroll", () => {
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
<!-- Google Tag Manager (noscript) -->
|
||||||
|
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-59QKHH8"
|
||||||
|
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
||||||
|
<!-- End Google Tag Manager (noscript) -->
|
||||||
|
|
||||||
<AusweisHeaderPartner {tab}/>
|
<AusweisHeaderPartner {tab}/>
|
||||||
|
|
||||||
<main class="w-full p-0 grid grid-cols-1 rounded-none">
|
<main class="w-full p-0 grid grid-cols-1 rounded-none">
|
||||||
@@ -136,7 +148,6 @@ window.addEventListener("scroll", () => {
|
|||||||
|
|
||||||
<article class="p-0 lg:px-20 lg:py-12">
|
<article class="p-0 lg:px-20 lg:py-12">
|
||||||
<slot />
|
<slot />
|
||||||
<div style="height: 450px;"></div>
|
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
@@ -37,6 +37,14 @@ const { title } = Astro.props;
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="de">
|
<html lang="de">
|
||||||
<head>
|
<head>
|
||||||
|
<!-- Google Tag Manager -->
|
||||||
|
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
||||||
|
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
||||||
|
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||||
|
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
||||||
|
})(window,document,'script','dataLayer','GTM-59QKHH8');</script>
|
||||||
|
<!-- End Google Tag Manager -->
|
||||||
|
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/favicon.jpg" />
|
<link rel="icon" type="image/svg+xml" href="/favicon.jpg" />
|
||||||
@@ -79,6 +87,10 @@ const { title } = Astro.props;
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
<!-- Google Tag Manager (noscript) -->
|
||||||
|
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-59QKHH8"
|
||||||
|
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
||||||
|
<!-- End Google Tag Manager (noscript) -->
|
||||||
|
|
||||||
<Header {user} />
|
<Header {user} />
|
||||||
|
|
||||||
|
|||||||
@@ -98,6 +98,15 @@ window.addEventListener("scroll", (event) => {
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="de">
|
<html lang="de">
|
||||||
<head>
|
<head>
|
||||||
|
<!-- Google Tag Manager -->
|
||||||
|
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
||||||
|
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
||||||
|
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||||
|
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
||||||
|
})(window,document,'script','dataLayer','GTM-59QKHH8');</script>
|
||||||
|
<!-- End Google Tag Manager -->
|
||||||
|
|
||||||
|
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/favicon.jpg" />
|
<link rel="icon" type="image/svg+xml" href="/favicon.jpg" />
|
||||||
@@ -111,6 +120,10 @@ window.addEventListener("scroll", (event) => {
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
<!-- Google Tag Manager (noscript) -->
|
||||||
|
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-59QKHH8"
|
||||||
|
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
||||||
|
<!-- End Google Tag Manager (noscript) -->
|
||||||
|
|
||||||
<Header {user} />
|
<Header {user} />
|
||||||
|
|
||||||
|
|||||||
@@ -369,25 +369,25 @@ export async function pdfVerbrauchsausweisGewerbe(ausweis: VerbrauchsausweisGewe
|
|||||||
|
|
||||||
if (endenergieverbrauchTranslationPercentage > 0.5) {
|
if (endenergieverbrauchTranslationPercentage > 0.5) {
|
||||||
page.drawText("Endenergieverbrauch Wärme", {
|
page.drawText("Endenergieverbrauch Wärme", {
|
||||||
x: endenergieverbrauchTranslationX - margin - font.widthOfTextAtSize("Endenergieverbrauch Wärme", 10),
|
x: endenergieverbrauchTranslationX - margin - font.widthOfTextAtSize("Endenergieverbrauch Wärme", 10) - (pfeilWidth / 2),
|
||||||
y: height - 191,
|
y: height - 191,
|
||||||
size: 10
|
size: 10
|
||||||
})
|
})
|
||||||
|
|
||||||
page.drawText(endEnergieVerbrauchGesamtText, {
|
page.drawText(endEnergieVerbrauchGesamtText, {
|
||||||
x: endenergieverbrauchTranslationX - margin - bold.widthOfTextAtSize(endEnergieVerbrauchGesamtText, 10),
|
x: endenergieverbrauchTranslationX - margin - bold.widthOfTextAtSize(endEnergieVerbrauchGesamtText, 10) - (pfeilWidth / 2),
|
||||||
y: height - 205,
|
y: height - 205,
|
||||||
size: 10,
|
size: 10,
|
||||||
font: bold
|
font: bold
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
page.drawText("Endenergieverbrauch Wärme", {
|
page.drawText("Endenergieverbrauch Wärme", {
|
||||||
x: endenergieverbrauchTranslationX + pfeilWidth + margin,
|
x: endenergieverbrauchTranslationX + pfeilWidth + margin + (pfeilWidth / 2),
|
||||||
y: height - 191,
|
y: height - 191,
|
||||||
size: 10
|
size: 10
|
||||||
})
|
})
|
||||||
page.drawText(endEnergieVerbrauchGesamtText, {
|
page.drawText(endEnergieVerbrauchGesamtText, {
|
||||||
x: endenergieverbrauchTranslationX + pfeilWidth + margin,
|
x: endenergieverbrauchTranslationX + pfeilWidth + margin + (pfeilWidth / 2),
|
||||||
y: height - 205,
|
y: height - 205,
|
||||||
size: 10,
|
size: 10,
|
||||||
font: bold
|
font: bold
|
||||||
@@ -398,13 +398,13 @@ export async function pdfVerbrauchsausweisGewerbe(ausweis: VerbrauchsausweisGewe
|
|||||||
|
|
||||||
if (vergleichsWertWaermeTranslationPercentage > 0.5) {
|
if (vergleichsWertWaermeTranslationPercentage > 0.5) {
|
||||||
page.drawText("Vergleichswert Wärme", {
|
page.drawText("Vergleichswert Wärme", {
|
||||||
x: vergleichsWertWaermeTranslationX - margin - font.widthOfTextAtSize("Vergleichswert Wärme", 10),
|
x: vergleichsWertWaermeTranslationX - margin - font.widthOfTextAtSize("Vergleichswert Wärme", 10) - (pfeilWidth / 2),
|
||||||
y: height - 275,
|
y: height - 275,
|
||||||
size: 10
|
size: 10
|
||||||
})
|
})
|
||||||
|
|
||||||
page.drawText(vergleichswertWaermeText, {
|
page.drawText(vergleichswertWaermeText, {
|
||||||
x: vergleichsWertWaermeTranslationX - margin - bold.widthOfTextAtSize(vergleichswertWaermeText, 10),
|
x: vergleichsWertWaermeTranslationX - margin - bold.widthOfTextAtSize(vergleichswertWaermeText, 10) - (pfeilWidth / 2),
|
||||||
y: height - 289,
|
y: height - 289,
|
||||||
size: 10,
|
size: 10,
|
||||||
font: bold
|
font: bold
|
||||||
@@ -431,7 +431,7 @@ export async function pdfVerbrauchsausweisGewerbe(ausweis: VerbrauchsausweisGewe
|
|||||||
})
|
})
|
||||||
|
|
||||||
page.drawImage(pfeilNachOben, {
|
page.drawImage(pfeilNachOben, {
|
||||||
x: vergleichsWertStromTranslationX,
|
x: vergleichsWertStromTranslationX,
|
||||||
y: height - 437,
|
y: height - 437,
|
||||||
width: pfeilWidth,
|
width: pfeilWidth,
|
||||||
height: 30
|
height: 30
|
||||||
@@ -441,25 +441,25 @@ export async function pdfVerbrauchsausweisGewerbe(ausweis: VerbrauchsausweisGewe
|
|||||||
|
|
||||||
if (stromVerbrauchTranslationPercentage > 0.5) {
|
if (stromVerbrauchTranslationPercentage > 0.5) {
|
||||||
page.drawText("Endenergieverbrauch Strom", {
|
page.drawText("Endenergieverbrauch Strom", {
|
||||||
x: stromVerbrauchTranslationX - margin - font.widthOfTextAtSize("Endenergieverbrauch Strom", 10),
|
x: stromVerbrauchTranslationX - margin - font.widthOfTextAtSize("Endenergieverbrauch Strom", 10) - (pfeilWidth / 2),
|
||||||
y: height - 335,
|
y: height - 335,
|
||||||
size: 10
|
size: 10
|
||||||
})
|
})
|
||||||
|
|
||||||
page.drawText(stromVerbrauchGesamtText, {
|
page.drawText(stromVerbrauchGesamtText, {
|
||||||
x: stromVerbrauchTranslationX - margin - bold.widthOfTextAtSize(stromVerbrauchGesamtText, 10),
|
x: stromVerbrauchTranslationX - margin - bold.widthOfTextAtSize(stromVerbrauchGesamtText, 10) - (pfeilWidth / 2),
|
||||||
y: height - 349,
|
y: height - 349,
|
||||||
size: 10,
|
size: 10,
|
||||||
font: bold
|
font: bold
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
page.drawText("Endenergieverbrauch Strom", {
|
page.drawText("Endenergieverbrauch Strom", {
|
||||||
x: stromVerbrauchTranslationX + pfeilWidth + margin,
|
x: stromVerbrauchTranslationX + pfeilWidth + margin + (pfeilWidth / 2),
|
||||||
y: height - 335,
|
y: height - 335,
|
||||||
size: 10
|
size: 10
|
||||||
})
|
})
|
||||||
page.drawText(stromVerbrauchGesamtText, {
|
page.drawText(stromVerbrauchGesamtText, {
|
||||||
x: stromVerbrauchTranslationX + pfeilWidth + margin,
|
x: stromVerbrauchTranslationX + pfeilWidth + margin + (pfeilWidth / 2),
|
||||||
y: height - 349,
|
y: height - 349,
|
||||||
size: 10,
|
size: 10,
|
||||||
font: bold
|
font: bold
|
||||||
@@ -484,12 +484,12 @@ export async function pdfVerbrauchsausweisGewerbe(ausweis: VerbrauchsausweisGewe
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
page.drawText("Vergleichswert Strom", {
|
page.drawText("Vergleichswert Strom", {
|
||||||
x: vergleichsWertStromTranslationX + pfeilWidth + margin,
|
x: vergleichsWertStromTranslationX + pfeilWidth + margin + (pfeilWidth / 2),
|
||||||
y: height - 420,
|
y: height - 420,
|
||||||
size: 10
|
size: 10
|
||||||
})
|
})
|
||||||
page.drawText(vergleichswertStromText, {
|
page.drawText(vergleichswertStromText, {
|
||||||
x: vergleichsWertStromTranslationX + pfeilWidth + margin,
|
x: vergleichsWertStromTranslationX + pfeilWidth + margin + (pfeilWidth / 2),
|
||||||
y: height - 434,
|
y: height - 434,
|
||||||
size: 10,
|
size: 10,
|
||||||
font: bold
|
font: bold
|
||||||
|
|||||||
@@ -343,7 +343,7 @@ export async function pdfVerbrauchsausweisWohnen(ausweis: VerbrauchsausweisWohne
|
|||||||
}
|
}
|
||||||
|
|
||||||
page.drawImage(pfeilNachUnten, {
|
page.drawImage(pfeilNachUnten, {
|
||||||
x: endenergieverbrauchTranslationX,
|
x: endenergieverbrauchTranslationX - (pfeilWidth / 2),
|
||||||
y: height - 212,
|
y: height - 212,
|
||||||
width: pfeilWidth,
|
width: pfeilWidth,
|
||||||
height: 30
|
height: 30
|
||||||
@@ -380,7 +380,7 @@ export async function pdfVerbrauchsausweisWohnen(ausweis: VerbrauchsausweisWohne
|
|||||||
}
|
}
|
||||||
|
|
||||||
page.drawImage(pfeilNachOben, {
|
page.drawImage(pfeilNachOben, {
|
||||||
x: primaerenergieverbrauchTranslationX,
|
x: primaerenergieverbrauchTranslationX - (pfeilWidth / 2),
|
||||||
y: height - 297,
|
y: height - 297,
|
||||||
width: pfeilWidth,
|
width: pfeilWidth,
|
||||||
height: 30
|
height: 30
|
||||||
@@ -505,7 +505,7 @@ export async function pdfVerbrauchsausweisWohnen(ausweis: VerbrauchsausweisWohne
|
|||||||
|
|
||||||
const addVerbrauch = addVerbrauchGenerator();
|
const addVerbrauch = addVerbrauchGenerator();
|
||||||
|
|
||||||
if (!ausweis.warmwasser_enthalten) {
|
if (ausweis.warmwasser_enthalten !== true) {
|
||||||
// Mit Warmwasserzuschlag
|
// Mit Warmwasserzuschlag
|
||||||
addVerbrauch(
|
addVerbrauch(
|
||||||
moment(ausweis.startdatum).format("MM.YYYY"),
|
moment(ausweis.startdatum).format("MM.YYYY"),
|
||||||
@@ -555,7 +555,7 @@ export async function pdfVerbrauchsausweisWohnen(ausweis: VerbrauchsausweisWohne
|
|||||||
"Warmwasserzuschlag",
|
"Warmwasserzuschlag",
|
||||||
berechnungen?.primaerfaktorww.toString(),
|
berechnungen?.primaerfaktorww.toString(),
|
||||||
Math.round(berechnungen?.energieVerbrauchWarmwasser_1 || 0).toString(),
|
Math.round(berechnungen?.energieVerbrauchWarmwasser_1 || 0).toString(),
|
||||||
Math.round(berechnungen?.energieVerbrauchWarmwasser_1 || 0).toString(),
|
Math.round(berechnungen?.energieVerbrauchWarmwasser_1 || 0).toString(),
|
||||||
"0",
|
"0",
|
||||||
"0"
|
"0"
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,9 +1,27 @@
|
|||||||
import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants.js";
|
import { API_ACCESS_TOKEN_COOKIE_NAME } from "#lib/constants.js";
|
||||||
import { checkAuthorizationHeader, checkAuthorizationHeaderNoThrow } from "#lib/middleware/authorization.js";
|
import { checkAuthorizationHeader, checkAuthorizationHeaderNoThrow } from "#lib/middleware/authorization.js";
|
||||||
import { AstroGlobal } from "astro";
|
import { AstroGlobal } from "astro";
|
||||||
|
import { Enums } from "#lib/client/prisma.js";
|
||||||
|
import { prisma } from "#lib/server/prisma.js";
|
||||||
|
|
||||||
export function getCurrentUser(Astro: AstroGlobal) {
|
export function getCurrentUser(Astro: AstroGlobal) {
|
||||||
const accessToken = Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value;
|
const accessToken = Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value;
|
||||||
|
|
||||||
return checkAuthorizationHeaderNoThrow(`Bearer ${accessToken}`)
|
return checkAuthorizationHeaderNoThrow(`Bearer ${accessToken}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getOtherUser(Astro: AstroGlobal, userId : string) {
|
||||||
|
const accessToken = Astro.cookies.get(API_ACCESS_TOKEN_COOKIE_NAME)?.value;
|
||||||
|
|
||||||
|
let currentUser = await checkAuthorizationHeaderNoThrow(`Bearer ${accessToken}`)
|
||||||
|
|
||||||
|
if (currentUser?.rolle == Enums.BenutzerRolle.ADMIN) {
|
||||||
|
const user = await prisma.benutzer.findUnique({
|
||||||
|
where: {
|
||||||
|
id: userId
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
@@ -32,8 +32,12 @@
|
|||||||
import { getMaximumDevitationInPercent } from "#client/lib/helpers.js";
|
import { getMaximumDevitationInPercent } from "#client/lib/helpers.js";
|
||||||
import { endEnergieVerbrauchVerbrauchsausweis_2016_Client } from "#lib/Berechnungen/VerbrauchsausweisWohnen/VerbrauchsausweisWohnen_2016_Client.js";
|
import { endEnergieVerbrauchVerbrauchsausweis_2016_Client } from "#lib/Berechnungen/VerbrauchsausweisWohnen/VerbrauchsausweisWohnen_2016_Client.js";
|
||||||
import { endEnergieVerbrauchVerbrauchsausweisGewerbe_2016_Client } from "#lib/Berechnungen/VerbrauchsausweisGewerbe/VerbrauchsausweisGewerbe_2016_Client.js";
|
import { endEnergieVerbrauchVerbrauchsausweisGewerbe_2016_Client } from "#lib/Berechnungen/VerbrauchsausweisGewerbe/VerbrauchsausweisGewerbe_2016_Client.js";
|
||||||
|
import { benutzerSpeichern } from "#client/lib/speichern.js";
|
||||||
|
import { benutzerLesen } from "#client/lib/lesen.js";
|
||||||
|
import { exclude } from "#lib/exclude.js";
|
||||||
|
|
||||||
export let user: Partial<BenutzerClient>;
|
export let user: Partial<BenutzerClient>;
|
||||||
|
export let impersonatedUser: Partial<BenutzerClient> | null = null;
|
||||||
export let ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbe | BedarfsausweisWohnen;
|
export let ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbe | BedarfsausweisWohnen;
|
||||||
export let aufnahme: AufnahmeClient;
|
export let aufnahme: AufnahmeClient;
|
||||||
export let objekt: ObjektClient;
|
export let objekt: ObjektClient;
|
||||||
@@ -59,6 +63,10 @@
|
|||||||
ort = rechnung?.ort || localStorage.getItem("kundendaten.ort") || user.ort || "";
|
ort = rechnung?.ort || localStorage.getItem("kundendaten.ort") || user.ort || "";
|
||||||
zusatzzeile = rechnung?.zusatzzeile || localStorage.getItem("kundendaten.zusatzzeile") || ""
|
zusatzzeile = rechnung?.zusatzzeile || localStorage.getItem("kundendaten.zusatzzeile") || ""
|
||||||
telefon = rechnung?.telefon || localStorage.getItem("kundendaten.telefon") || user.telefon || "";
|
telefon = rechnung?.telefon || localStorage.getItem("kundendaten.telefon") || user.telefon || "";
|
||||||
|
} else if (impersonatedUser) {
|
||||||
|
vorname = impersonatedUser.vorname || "";
|
||||||
|
name = impersonatedUser.name || "";
|
||||||
|
telefon = impersonatedUser.telefon || "";
|
||||||
}
|
}
|
||||||
|
|
||||||
let abweichende_versand_adresse = JSON.parse(localStorage.getItem("kundendaten.abweichende_versand_adresse") || "false")
|
let abweichende_versand_adresse = JSON.parse(localStorage.getItem("kundendaten.abweichende_versand_adresse") || "false")
|
||||||
@@ -233,7 +241,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function speichern() {
|
async function speichern(authuser = null) {
|
||||||
loginAction = speichern;
|
loginAction = speichern;
|
||||||
if (!await validateAccessTokenClient()) {
|
if (!await validateAccessTokenClient()) {
|
||||||
loginOverlayHidden = false;
|
loginOverlayHidden = false;
|
||||||
@@ -249,6 +257,23 @@
|
|||||||
} else {
|
} else {
|
||||||
result = await ausweisSpeichern(ausweis, objekt, aufnahme, bilder, unterlagen, ausweisart)
|
result = await ausweisSpeichern(ausweis, objekt, aufnahme, bilder, unterlagen, ausweisart)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (authuser) {
|
||||||
|
user = await benutzerLesen(authuser.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
let resultUser: Awaited<ReturnType<typeof benutzerSpeichern>> | Awaited<ReturnType<typeof benutzerSpeichern>> | null = null;
|
||||||
|
const { passwort, ...baseUser } = impersonatedUser ?? user;
|
||||||
|
|
||||||
|
const benutzerObjekt = {
|
||||||
|
...baseUser,
|
||||||
|
name,
|
||||||
|
vorname,
|
||||||
|
telefon
|
||||||
|
};
|
||||||
|
|
||||||
|
resultUser = await benutzerSpeichern(benutzerObjekt);
|
||||||
|
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
addNotification({
|
addNotification({
|
||||||
dismissable: true,
|
dismissable: true,
|
||||||
@@ -269,7 +294,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function bestellen() {
|
async function bestellen(authuser = null) {
|
||||||
if (!form.checkValidity()) {
|
if (!form.checkValidity()) {
|
||||||
addNotification({
|
addNotification({
|
||||||
dismissable: true,
|
dismissable: true,
|
||||||
@@ -312,6 +337,22 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (authuser) {
|
||||||
|
user = await benutzerLesen(authuser.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
let resultUser: Awaited<ReturnType<typeof benutzerSpeichern>> | Awaited<ReturnType<typeof benutzerSpeichern>> | null = null;
|
||||||
|
const { passwort, ...baseUser } = impersonatedUser ?? user;
|
||||||
|
|
||||||
|
const benutzerObjekt = {
|
||||||
|
...baseUser,
|
||||||
|
name,
|
||||||
|
vorname,
|
||||||
|
telefon
|
||||||
|
};
|
||||||
|
|
||||||
|
resultUser = await benutzerSpeichern(benutzerObjekt);
|
||||||
|
|
||||||
if (rechnung && rechnung.status === "paid") {
|
if (rechnung && rechnung.status === "paid") {
|
||||||
window.location.href = "/dashboard"
|
window.location.href = "/dashboard"
|
||||||
return;
|
return;
|
||||||
@@ -1072,7 +1113,7 @@ sm:grid-cols-[min-content_min-content_min-content] sm:justify-self-end sm:mt-8"
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<button class="order-2 button" type="button" on:click={speichern}>Speichern</button>
|
<button class="order-2 button" type="button" on:click={() => speichern()}>Speichern</button>
|
||||||
|
|
||||||
{#if rechnung && rechnung.status === "paid"}
|
{#if rechnung && rechnung.status === "paid"}
|
||||||
<!-- Von einer GEG Anfrage sollte man sowieso nicht noch mal auf die Kundendaten Seite gelangen, also brauchen wir das hier nicht. -->
|
<!-- Von einer GEG Anfrage sollte man sowieso nicht noch mal auf die Kundendaten Seite gelangen, also brauchen wir das hier nicht. -->
|
||||||
@@ -1080,7 +1121,7 @@ sm:grid-cols-[min-content_min-content_min-content] sm:justify-self-end sm:mt-8"
|
|||||||
class="order-1 sm:order-2 button cursor-pointer"
|
class="order-1 sm:order-2 button cursor-pointer"
|
||||||
data-cy="bestellen"
|
data-cy="bestellen"
|
||||||
type="button"
|
type="button"
|
||||||
on:click={bestellen}>Absenden</button
|
on:click={() => bestellen()}>Absenden</button
|
||||||
>
|
>
|
||||||
{:else}
|
{:else}
|
||||||
{#if gegAnfrage}
|
{#if gegAnfrage}
|
||||||
@@ -1095,7 +1136,7 @@ sm:grid-cols-[min-content_min-content_min-content] sm:justify-self-end sm:mt-8"
|
|||||||
class="order-1 sm:order-2 button cursor-pointer"
|
class="order-1 sm:order-2 button cursor-pointer"
|
||||||
data-cy="bestellen"
|
data-cy="bestellen"
|
||||||
type="button"
|
type="button"
|
||||||
on:click={bestellen}>Kostenpflichtig bestellen</button
|
on:click={() => bestellen()}>Kostenpflichtig bestellen</button
|
||||||
>
|
>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import { APIError, defineApiRoute } from "astro-typesafe-api/server";
|
|||||||
import { z } from "astro:content";
|
import { z } from "astro:content";
|
||||||
import { transport } from "#lib/mail.js";
|
import { transport } from "#lib/mail.js";
|
||||||
import {Attachment} from "nodemailer/lib/mailer/index.js";
|
import {Attachment} from "nodemailer/lib/mailer/index.js";
|
||||||
import { BASE_URI } from "#lib/constants.js";
|
|
||||||
import { getAnsichtsausweis, getDatenblatt, getAushang } from "#lib/server/ausweis.js";
|
import { getAnsichtsausweis, getDatenblatt, getAushang } from "#lib/server/ausweis.js";
|
||||||
import { PutObjectCommand } from "@aws-sdk/client-s3";
|
import { PutObjectCommand } from "@aws-sdk/client-s3";
|
||||||
import { s3Client } from "#lib/s3.js";
|
import { s3Client } from "#lib/s3.js";
|
||||||
@@ -34,7 +33,6 @@ import {
|
|||||||
getVerbrauchsausweisWohnenKomplett,
|
getVerbrauchsausweisWohnenKomplett,
|
||||||
} from "#lib/server/db.js";
|
} from "#lib/server/db.js";
|
||||||
import { PDFDocument } from "pdf-lib";
|
import { PDFDocument } from "pdf-lib";
|
||||||
import * as fs from 'fs';
|
|
||||||
|
|
||||||
export const GET = defineApiRoute({
|
export const GET = defineApiRoute({
|
||||||
input: z.object({
|
input: z.object({
|
||||||
@@ -329,14 +327,14 @@ export const GET = defineApiRoute({
|
|||||||
|
|
||||||
<p>im Anhang finden Sie Ihren geprüften Energieusweis inkl. Rechnung als PDF-Datei. ${
|
<p>im Anhang finden Sie Ihren geprüften Energieusweis inkl. Rechnung als PDF-Datei. ${
|
||||||
post ? "Zusätzlich haben wir Ihren Ausweis per Post verschickt" : ""
|
post ? "Zusätzlich haben wir Ihren Ausweis per Post verschickt" : ""
|
||||||
} Nachfolgend finden Sie unsere Bankverbindung. Bitte geben Sie als Verwendungszweck die Rechnungsnummer an (siehe unten). Vielen Dank.</p>
|
} <b>Bitte beachten Sie unsere neue Bankverbindung.</b> Bitte geben Sie als Verwendungszweck die Rechnungsnummer an (siehe unten). Vielen Dank.</p>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>Kreditinstitut</td><td>:</td><td>\t Commerzbank AG</td>
|
<tr><td>Kreditinstitut</td><td>:</td><td>\t Volksbank eG</td>
|
||||||
<tr><td>Empfänger</td><td>:</td><td>\t IB Cornelsen</td>
|
<tr><td>Empfänger</td><td>:</td><td>\t IB Cornelsen</td>
|
||||||
<tr><td>IBAN</td><td>:<td>\t DE81 2004 0000 0348 6008 00</td>
|
<tr><td>IBAN</td><td>:<td>\t DE13 2519 3331 7209 0731 00</td>
|
||||||
<tr><td>BIC</td><td>:</td><td>\t COBADEFFXXX</td>
|
<tr><td>BIC</td><td>:</td><td>\t GENODEF1PAT</td>
|
||||||
<tr><td>Betrag</td><td>:</td><td>\t <b>${rechnung.betrag}€</b></td>
|
<tr><td>Betrag</td><td>:</td><td>\t <b>${rechnung.betrag}€</b></td>
|
||||||
<tr><td>Verwendungszweck</td><td>:</td><td>\t <b>${voucherNumber}</b></td>
|
<tr><td>Verwendungszweck</td><td>:</td><td>\t <b>${voucherNumber}</b></td>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ export const POST = defineApiRoute({
|
|||||||
let filename: string;
|
let filename: string;
|
||||||
|
|
||||||
if (type === "Ausweis") {
|
if (type === "Ausweis") {
|
||||||
filename = `ID_${ausweis.id}_Ausweis.pdf`
|
filename = `ID_${ausweis.id}_Energieausweis.pdf`
|
||||||
} else {
|
} else {
|
||||||
filename = `ID_${ausweis.id}_${name}`;
|
filename = `ID_${ausweis.id}_${name}`;
|
||||||
}
|
}
|
||||||
@@ -212,7 +212,7 @@ export const POST = defineApiRoute({
|
|||||||
|
|
||||||
const command = new PutObjectCommand({
|
const command = new PutObjectCommand({
|
||||||
Bucket: "ibc-pdfs",
|
Bucket: "ibc-pdfs",
|
||||||
Key: name,
|
Key: filename,
|
||||||
Body: buffer,
|
Body: buffer,
|
||||||
ACL: "private",
|
ACL: "private",
|
||||||
});
|
});
|
||||||
@@ -336,14 +336,14 @@ export const POST = defineApiRoute({
|
|||||||
|
|
||||||
<p>im Anhang finden Sie Ihren geprüften Energieusweis inkl. Rechnung als PDF-Datei. ${
|
<p>im Anhang finden Sie Ihren geprüften Energieusweis inkl. Rechnung als PDF-Datei. ${
|
||||||
post ? "Zusätzlich haben wir Ihren Ausweis per Post verschickt" : ""
|
post ? "Zusätzlich haben wir Ihren Ausweis per Post verschickt" : ""
|
||||||
} Nachfolgend finden Sie unsere Bankverbindung. Bitte geben Sie als Verwendungszweck die Rechnungsnummer an (siehe unten). Vielen Dank.</p>
|
} <b>Bitte beachten Sie unsere neue Bankverbindung.</b> Bitte geben Sie als Verwendungszweck die Rechnungsnummer an (siehe unten). Vielen Dank.</p>
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<table>
|
<table>
|
||||||
<tr><td>Kreditinstitut</td><td>:</td><td>\t Commerzbank AG</td>
|
<tr><td>Kreditinstitut</td><td>:</td><td>\t Volksbank eG</td>
|
||||||
<tr><td>Empfänger</td><td>:</td><td>\t IB Cornelsen</td>
|
<tr><td>Empfänger</td><td>:</td><td>\t IB Cornelsen</td>
|
||||||
<tr><td>IBAN</td><td>:<td>\t DE81 2004 0000 0348 6008 00</td>
|
<tr><td>IBAN</td><td>:<td>\t DE13 2519 3331 7209 0731 00</td>
|
||||||
<tr><td>BIC</td><td>:</td><td>\t COBADEFFXXX</td>
|
<tr><td>BIC</td><td>:</td><td>\t GENODEF1PAT</td>
|
||||||
<tr><td>Betrag</td><td>:</td><td>\t <b>${rechnung.betrag}€</b></td>
|
<tr><td>Betrag</td><td>:</td><td>\t <b>${rechnung.betrag}€</b></td>
|
||||||
<tr><td>Verwendungszweck</td><td>:</td><td>\t <b>${voucherNumber}</b></td>
|
<tr><td>Verwendungszweck</td><td>:</td><td>\t <b>${voucherNumber}</b></td>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -5,18 +5,17 @@ import { adminMiddleware, authorizationMiddleware } from "#lib/middleware/author
|
|||||||
import { hashPassword } from "#lib/password.js";
|
import { hashPassword } from "#lib/password.js";
|
||||||
import { createLexOfficeCustomer } from "#lib/server/lexoffice.js";
|
import { createLexOfficeCustomer } from "#lib/server/lexoffice.js";
|
||||||
import { sendRegisterMail } from "#lib/server/mail/registrierung.js";
|
import { sendRegisterMail } from "#lib/server/mail/registrierung.js";
|
||||||
import { prisma } from "#lib/server/prisma.js";
|
import { Benutzer, prisma } from "#lib/server/prisma.js";
|
||||||
import { APIError, defineApiRoute } from "astro-typesafe-api/server";
|
import { APIError, defineApiRoute } from "astro-typesafe-api/server";
|
||||||
import { BenutzerSchema } from "src/generated/zod/benutzer.js";
|
import { BenutzerSchema } from "src/generated/zod/benutzer.js";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
import { Enums } from "#lib/client/prisma.js";
|
||||||
|
|
||||||
export const POST = defineApiRoute({
|
export const POST = defineApiRoute({
|
||||||
input: BenutzerSchema.omit({
|
input: BenutzerSchema.omit({
|
||||||
id: true,
|
|
||||||
lex_office_id: true,
|
lex_office_id: true,
|
||||||
rolle: true,
|
rolle: true,
|
||||||
created_at: true,
|
created_at: true
|
||||||
updated_at: true
|
|
||||||
}),
|
}),
|
||||||
middleware: authorizationMiddleware,
|
middleware: authorizationMiddleware,
|
||||||
async fetch(input, context, user) {
|
async fetch(input, context, user) {
|
||||||
@@ -24,24 +23,36 @@ export const POST = defineApiRoute({
|
|||||||
// TODO: Email wurde geändert, neue Bestätigunsmail schicken.
|
// TODO: Email wurde geändert, neue Bestätigunsmail schicken.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const updateData: any = {};
|
||||||
|
updateData.id = user.id;
|
||||||
|
if (input.adresse) updateData.adresse = input.adresse;
|
||||||
|
if (input.anrede) updateData.anrede = input.anrede;
|
||||||
|
if (input.email) updateData.email = input.email;
|
||||||
|
if (input.firma) updateData.firma = input.firma;
|
||||||
|
if (input.name) updateData.name = input.name;
|
||||||
|
if (input.vorname) updateData.vorname = input.vorname;
|
||||||
|
if (input.ort) updateData.ort = input.ort;
|
||||||
|
if (input.passwort.length != 0) updateData.passwort = hashPassword(input.passwort);
|
||||||
|
if (input.plz) updateData.plz = input.plz;
|
||||||
|
if (input.profilbild) updateData.profilbild = input.profilbild;
|
||||||
|
if (input.telefon) updateData.telefon = input.telefon;
|
||||||
|
if (input.verified) updateData.telefon = input.verified;
|
||||||
|
|
||||||
|
//Only Admin can update other users
|
||||||
|
if (user.rolle == Enums.BenutzerRolle.ADMIN && input.id != user.id) {
|
||||||
|
updateData.id = input.id;
|
||||||
|
} else if(user.rolle != Enums.BenutzerRolle.ADMIN && input.id != user.id){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await prisma.benutzer.update({
|
await prisma.benutzer.update({
|
||||||
where: {
|
where: {
|
||||||
id: user.id
|
id: updateData.id
|
||||||
},
|
},
|
||||||
data: {
|
data: updateData
|
||||||
adresse: input.adresse,
|
});
|
||||||
anrede: input.anrede,
|
|
||||||
email: input.email,
|
|
||||||
firma: input.firma,
|
|
||||||
name: input.name,
|
|
||||||
vorname: input.vorname,
|
|
||||||
ort: input.ort,
|
|
||||||
passwort: hashPassword(input.passwort),
|
|
||||||
plz: input.plz,
|
|
||||||
profilbild: input.profilbild,
|
|
||||||
telefon: input.telefon,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -53,9 +64,14 @@ export const GET = defineApiRoute({
|
|||||||
email: z.string()
|
email: z.string()
|
||||||
})),
|
})),
|
||||||
output: z.array(BenutzerSchema),
|
output: z.array(BenutzerSchema),
|
||||||
middleware: adminMiddleware,
|
middleware: authorizationMiddleware,
|
||||||
async fetch(input, context, admin) {
|
async fetch(input, context, admin) {
|
||||||
if ("id" in input) {
|
if ("id" in input) {
|
||||||
|
//Only Admin can read other users
|
||||||
|
if (admin.rolle != Enums.BenutzerRolle.ADMIN && input.id != admin.id) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const user = await prisma.benutzer.findUnique({
|
const user = await prisma.benutzer.findUnique({
|
||||||
where: {
|
where: {
|
||||||
id: input.id
|
id: input.id
|
||||||
@@ -68,6 +84,11 @@ export const GET = defineApiRoute({
|
|||||||
|
|
||||||
return [user];
|
return [user];
|
||||||
} else {
|
} else {
|
||||||
|
//Only admin can read many users
|
||||||
|
if (admin.rolle != Enums.BenutzerRolle.ADMIN ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const users = await prisma.benutzer.findMany({
|
const users = await prisma.benutzer.findMany({
|
||||||
where: {
|
where: {
|
||||||
email: {
|
email: {
|
||||||
|
|||||||
334
src/pages/dashboard/abrechnung/index.astro
Normal file
334
src/pages/dashboard/abrechnung/index.astro
Normal file
@@ -0,0 +1,334 @@
|
|||||||
|
---
|
||||||
|
import AbrechungTable from "#components/Abrechnung/AbrechungTable.svelte";
|
||||||
|
import { Enums, prisma } from "#lib/server/prisma";
|
||||||
|
import { getCurrentUser } from "#lib/server/user";
|
||||||
|
import moment from "moment";
|
||||||
|
|
||||||
|
|
||||||
|
const start = moment(Astro.url.searchParams.get("start"))
|
||||||
|
const end = moment(Astro.url.searchParams.get("end"))
|
||||||
|
|
||||||
|
let startdatum = start.toDate();
|
||||||
|
let enddatum = end.toDate();
|
||||||
|
|
||||||
|
const benutzer = await getCurrentUser(Astro)
|
||||||
|
|
||||||
|
if (!benutzer) {
|
||||||
|
return Astro.redirect("/404")
|
||||||
|
}
|
||||||
|
|
||||||
|
const provisionen={
|
||||||
|
[Enums.Ausweisart.VerbrauchsausweisWohnen]: 10,
|
||||||
|
[Enums.Ausweisart.BedarfsausweisWohnen]: 10,
|
||||||
|
[Enums.Ausweisart.VerbrauchsausweisGewerbe]: 10,
|
||||||
|
}
|
||||||
|
|
||||||
|
// $kommission = db()->one("SELECT abr_va, abr_ba, abr_vanw FROM users WHERE resellercode = :resellercode", ["resellercode" => $resellercode]);
|
||||||
|
// Select every entry from database where user was involved.
|
||||||
|
let bestellungen;
|
||||||
|
if (start.isValid() && end.isValid()) {
|
||||||
|
bestellungen = await prisma.rechnung.findMany({
|
||||||
|
where: {
|
||||||
|
partner_code: "immowelt",
|
||||||
|
OR: [{
|
||||||
|
verbrauchsausweis_gewerbe: {
|
||||||
|
ausgestellt: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
bedarfsausweis_wohnen: {
|
||||||
|
ausgestellt: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
verbrauchsausweis_wohnen: {
|
||||||
|
ausgestellt: true
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
AND: [{
|
||||||
|
created_at: {
|
||||||
|
gte: startdatum
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
created_at: {
|
||||||
|
lte: enddatum
|
||||||
|
},
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
orderBy: {
|
||||||
|
created_at: "desc"
|
||||||
|
},
|
||||||
|
include: {
|
||||||
|
bedarfsausweis_wohnen: true,
|
||||||
|
verbrauchsausweis_gewerbe: true,
|
||||||
|
verbrauchsausweis_wohnen: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
bestellungen = await prisma.rechnung.findMany({
|
||||||
|
where: {
|
||||||
|
partner_code: "immowelt",
|
||||||
|
OR: [{
|
||||||
|
verbrauchsausweis_gewerbe: {
|
||||||
|
ausgestellt: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
bedarfsausweis_wohnen: {
|
||||||
|
ausgestellt: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
verbrauchsausweis_wohnen: {
|
||||||
|
ausgestellt: true
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
orderBy: {
|
||||||
|
created_at: "desc"
|
||||||
|
},
|
||||||
|
include: {
|
||||||
|
bedarfsausweis_wohnen: true,
|
||||||
|
verbrauchsausweis_gewerbe: true,
|
||||||
|
verbrauchsausweis_wohnen: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wann wurde der partner_code zum ersten mal benutzt?
|
||||||
|
const partnerCodeErstesMal = (await prisma.rechnung.findFirst({
|
||||||
|
select: {
|
||||||
|
created_at: true
|
||||||
|
},
|
||||||
|
where: {
|
||||||
|
partner_code: "immowelt",
|
||||||
|
OR: [{
|
||||||
|
verbrauchsausweis_gewerbe: {
|
||||||
|
ausgestellt: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
bedarfsausweis_wohnen: {
|
||||||
|
ausgestellt: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
verbrauchsausweis_wohnen: {
|
||||||
|
ausgestellt: true
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
created_at: {
|
||||||
|
gte: moment().set("year", 2020).set("dayOfYear", 1).toDate()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
orderBy: {
|
||||||
|
created_at: "asc"
|
||||||
|
}
|
||||||
|
}))?.created_at
|
||||||
|
|
||||||
|
let provision = 0;
|
||||||
|
const ausweisarten: string[] = [];
|
||||||
|
for (const bestellung of bestellungen) {
|
||||||
|
if (bestellung.verbrauchsausweis_wohnen) {
|
||||||
|
ausweisarten.push(Enums.Ausweisart.VerbrauchsausweisWohnen)
|
||||||
|
provision += provisionen[Enums.Ausweisart.VerbrauchsausweisWohnen]
|
||||||
|
}
|
||||||
|
if (bestellung.bedarfsausweis_wohnen) {
|
||||||
|
ausweisarten.push(Enums.Ausweisart.BedarfsausweisWohnen)
|
||||||
|
provision += provisionen[Enums.Ausweisart.BedarfsausweisWohnen]
|
||||||
|
}
|
||||||
|
if (bestellung.verbrauchsausweis_gewerbe) {
|
||||||
|
ausweisarten.push(Enums.Ausweisart.VerbrauchsausweisGewerbe)
|
||||||
|
provision += provisionen[Enums.Ausweisart.VerbrauchsausweisGewerbe]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="de">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Reporting | online-energieausweis.org</title>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
|
||||||
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/jquery/latest/jquery.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
|
||||||
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
|
||||||
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" />
|
||||||
|
<link rel="stylesheet" href="./main.css">
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
|
||||||
|
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: arial;
|
||||||
|
}
|
||||||
|
|
||||||
|
#inputwrap {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 10%;
|
||||||
|
width: 70%;
|
||||||
|
padding-top: 10px;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
#cal {
|
||||||
|
margin-right: 10px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
#demo {
|
||||||
|
width: 76%;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
table tr,
|
||||||
|
td {
|
||||||
|
border: 0.1em solid #000;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#QTT {
|
||||||
|
border-collapse: collapse;
|
||||||
|
width: 70%;
|
||||||
|
margin-top: 8em;
|
||||||
|
margin-left: 10%;
|
||||||
|
table-layout: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
#QTT thead td {
|
||||||
|
background: #ff7d26;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
#QTT tr:nth-child(even) {
|
||||||
|
background-color: #f2f2f2;
|
||||||
|
}
|
||||||
|
|
||||||
|
#QTT td {
|
||||||
|
padding: 0.4em 0.4em 0.4em 0.4em;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
#logo1 {
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 1em;
|
||||||
|
margin-top: -3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#logo2 {
|
||||||
|
width: 18%;
|
||||||
|
margin-bottom: 0.5em;
|
||||||
|
float: right;
|
||||||
|
padding-top: -1px;
|
||||||
|
margin-right: -5px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div id='inputwrap' class='form-group' >
|
||||||
|
<div style='display:flex; justify-content: space-between; align-items:center;'>
|
||||||
|
<img id='logo1' src='https://widget.ib-cornelsen.de/OEA_WIDGETS/img/IBC-logo.png' alt='IBCornelsen' />
|
||||||
|
<h5 style='margin-top: 10px;'><b>Erziehlte Conversions von {benutzer.email}</b></h5>
|
||||||
|
</div>
|
||||||
|
<input type='text' id='demo' class='form-control' name='demo' value='' placeholder='Bitte Zeitraum auswählen' />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<AbrechungTable bestellungen={bestellungen} {provisionen} {partnerCodeErstesMal}></AbrechungTable>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="total" class="footer">
|
||||||
|
<div class="inner">
|
||||||
|
<div>
|
||||||
|
<p id="betrag_gesamt">Abrechnungsbetrag gesamt: <b>{provision} €</b></p>
|
||||||
|
</div>
|
||||||
|
<a target='_blank' rel='noreferrer noopener' href=`/user/abrechnung/pdf.php?month=${moment().subtract(1, "month").get("month")}&year=${moment().subtract(1, "month").get("year")}`>PDF für letzten Monat generieren.</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$('#demo').daterangepicker({
|
||||||
|
"showDropdowns": true,
|
||||||
|
"minYear": 2019,
|
||||||
|
ranges: {
|
||||||
|
'Heute': [moment(), moment()],
|
||||||
|
'Gestern': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||||
|
'letzte 7 Tage': [moment().subtract(6, 'days'), moment()],
|
||||||
|
'letzte 30 Tage': [moment().subtract(29, 'days'), moment()],
|
||||||
|
'dieser Monat': [moment().startOf('month'), moment().endOf('month')],
|
||||||
|
'letzter Monat': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
||||||
|
},
|
||||||
|
"locale": {
|
||||||
|
"format": "DD/MM/YYYY",
|
||||||
|
"separator": " - ",
|
||||||
|
"applyLabel": "Übernehmen",
|
||||||
|
"cancelLabel": "Abrechen",
|
||||||
|
"fromLabel": "Von",
|
||||||
|
"toLabel": "Bis",
|
||||||
|
"customRangeLabel": "Benutzerdefiniert",
|
||||||
|
"weekLabel": "W",
|
||||||
|
"daysOfWeek": [
|
||||||
|
"So",
|
||||||
|
"Mo",
|
||||||
|
"Di",
|
||||||
|
"Mi",
|
||||||
|
"Do",
|
||||||
|
"Fr",
|
||||||
|
"Sa"
|
||||||
|
],
|
||||||
|
"monthNames": [
|
||||||
|
"Januar",
|
||||||
|
"Februar",
|
||||||
|
"März",
|
||||||
|
"April",
|
||||||
|
"Mai",
|
||||||
|
"Juni",
|
||||||
|
"Juli",
|
||||||
|
"August",
|
||||||
|
"September",
|
||||||
|
"Oktober",
|
||||||
|
"November",
|
||||||
|
"Dezember"
|
||||||
|
],
|
||||||
|
"firstDay": 1
|
||||||
|
},
|
||||||
|
"autoUpdateInput": false,
|
||||||
|
"alwaysShowCalendars": true,
|
||||||
|
"startDate": "<?php echo $day_start_display; ?>",
|
||||||
|
"endDate": "<?php echo $day_end_display; ?>",
|
||||||
|
"minDate": "01/10/2019"
|
||||||
|
}, function(start, end, label) {
|
||||||
|
var Pstart = start.format('MM/DD/YYYY');
|
||||||
|
var Pend = end.format('MM/DD/YYYY');
|
||||||
|
|
||||||
|
$("#start").val(Pstart);
|
||||||
|
$("#end").val(Pend);
|
||||||
|
|
||||||
|
$('#FO').submit();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// $("#demo").val(`Conversions im Zeitraum: <?php echo $Pall; ?>`);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<form id='FO' method='GET' action='index.php'>
|
||||||
|
<input type="hidden" id="start" name="start" value='' />
|
||||||
|
<input type="hidden" id="end" name="end" value='' />
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -50,9 +50,9 @@ if (user.rolle === Enums.BenutzerRolle.USER) {
|
|||||||
// SELECT id, updated_at FROM "GEGNachweisGewerbe" WHERE created_at >= ${date} AND bestellt = ${true}
|
// SELECT id, updated_at FROM "GEGNachweisGewerbe" WHERE created_at >= ${date} AND bestellt = ${true}
|
||||||
|
|
||||||
result =
|
result =
|
||||||
await prisma.$queryRaw`SELECT id, updated_at FROM "VerbrauchsausweisWohnen" UNION ALL
|
await prisma.$queryRaw`SELECT id, updated_at FROM "VerbrauchsausweisWohnen" WHERE ausgestellt = ${false} AND bestellt = ${true} UNION ALL
|
||||||
SELECT id, updated_at FROM "VerbrauchsausweisGewerbe" UNION ALL
|
SELECT id, updated_at FROM "VerbrauchsausweisGewerbe" WHERE ausgestellt = ${false} AND bestellt = ${true} UNION ALL
|
||||||
SELECT id, updated_at FROM "BedarfsausweisWohnen" UNION ALL
|
SELECT id, updated_at FROM "BedarfsausweisWohnen" WHERE ausgestellt = ${false} AND bestellt = ${true} UNION ALL
|
||||||
SELECT id, updated_at FROM "BedarfsausweisGewerbe" UNION ALL
|
SELECT id, updated_at FROM "BedarfsausweisGewerbe" UNION ALL
|
||||||
SELECT id, updated_at FROM "GEGNachweisWohnen" UNION ALL
|
SELECT id, updated_at FROM "GEGNachweisWohnen" UNION ALL
|
||||||
SELECT id, updated_at FROM "GEGNachweisGewerbe"
|
SELECT id, updated_at FROM "GEGNachweisGewerbe"
|
||||||
|
|||||||
@@ -3,10 +3,11 @@ import { getAusweisartFromId } from "#components/Ausweis/types";
|
|||||||
import AusweisLayoutPruefung from "#layouts/AusweisLayoutPruefung.astro";
|
import AusweisLayoutPruefung from "#layouts/AusweisLayoutPruefung.astro";
|
||||||
import { getPrismaAusweisAdapter } from "#lib/server/ausweis";
|
import { getPrismaAusweisAdapter } from "#lib/server/ausweis";
|
||||||
import { Enums } from "#lib/server/prisma";
|
import { Enums } from "#lib/server/prisma";
|
||||||
import { getCurrentUser } from "#lib/server/user";
|
import { getCurrentUser, getOtherUser } from "#lib/server/user";
|
||||||
import KundendatenModule from "#modules/KundendatenModule.svelte";
|
import KundendatenModule from "#modules/KundendatenModule.svelte";
|
||||||
import { PaymentStatus } from "@mollie/api-client";
|
import { PaymentStatus } from "@mollie/api-client";
|
||||||
import { AusweisTyp } from "src/generated/enums";
|
import { AusweisTyp } from "src/generated/enums";
|
||||||
|
import { BenutzerClient } from "#components/Ausweis/types.js";
|
||||||
|
|
||||||
const uid = Astro.url.searchParams.get("uid")
|
const uid = Astro.url.searchParams.get("uid")
|
||||||
|
|
||||||
@@ -45,8 +46,16 @@ if (!ausweis) {
|
|||||||
if (ausweis.rechnung.status === PaymentStatus.paid) {
|
if (ausweis.rechnung.status === PaymentStatus.paid) {
|
||||||
return Astro.redirect("/dashboard")
|
return Astro.redirect("/dashboard")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let impersonatedUser: Partial<BenutzerClient> | null = null;
|
||||||
|
|
||||||
|
if (user){
|
||||||
|
if (user.id !== ausweis.benutzer_id && ausweis.benutzer_id !== undefined){
|
||||||
|
impersonatedUser = await getOtherUser(Astro, ausweis.benutzer_id) || {}
|
||||||
|
}
|
||||||
|
}
|
||||||
---
|
---
|
||||||
|
|
||||||
<AusweisLayoutPruefung title="Energieausweis Bezahlung">
|
<AusweisLayoutPruefung title="Energieausweis Bezahlung">
|
||||||
<KundendatenModule {user} {ausweis} objekt={ausweis.aufnahme.objekt} rechnung={ausweis.rechnung} aufnahme={ausweis.aufnahme} bilder={ausweis.aufnahme.bilder} {ausweisart} ausweistyp={AusweisTyp.Standard} aktiveBezahlmethode={Enums.Bezahlmethoden.paypal} client:only></KundendatenModule>
|
<KundendatenModule {user} {impersonatedUser} {ausweis} objekt={ausweis.aufnahme.objekt} rechnung={ausweis.rechnung} aufnahme={ausweis.aufnahme} bilder={ausweis.aufnahme.bilder} {ausweisart} ausweistyp={AusweisTyp.Standard} aktiveBezahlmethode={Enums.Bezahlmethoden.paypal} client:only></KundendatenModule>
|
||||||
</AusweisLayoutPruefung>
|
</AusweisLayoutPruefung>
|
||||||
|
|||||||
19
src/pages/heap-snapshot.astro
Normal file
19
src/pages/heap-snapshot.astro
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
---
|
||||||
|
import { getHeapSnapshot } from "v8";
|
||||||
|
import * as fs from "fs";
|
||||||
|
|
||||||
|
// Create a named heap snapshot
|
||||||
|
const snapshotStream = getHeapSnapshot();
|
||||||
|
const fileName = `heap-${Date.now()}.heapsnapshot`;
|
||||||
|
const fileStream = fs.createWriteStream(fileName);
|
||||||
|
|
||||||
|
snapshotStream.pipe(fileStream);
|
||||||
|
|
||||||
|
fileStream.on("finish", () => {
|
||||||
|
console.log(`Heap snapshot saved to ${fileName}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
fileStream.on("error", (err) => {
|
||||||
|
console.error("Error writing heap snapshot:", err);
|
||||||
|
});
|
||||||
|
---
|
||||||
@@ -3,9 +3,10 @@
|
|||||||
import KundendatenModule from "#modules/KundendatenModule.svelte";
|
import KundendatenModule from "#modules/KundendatenModule.svelte";
|
||||||
import AusweisLayout from "#layouts/AusweisLayoutPruefung.astro";
|
import AusweisLayout from "#layouts/AusweisLayoutPruefung.astro";
|
||||||
import { Enums } from "#lib/client/prisma";
|
import { Enums } from "#lib/client/prisma";
|
||||||
import { getCurrentUser } from "#lib/server/user";
|
import { getCurrentUser, getOtherUser } from "#lib/server/user";
|
||||||
import { getAusweisartFromId } from "#components/Ausweis/types";
|
import { getAusweisartFromId } from "#components/Ausweis/types";
|
||||||
import { getAufnahme, getBedarfsausweisWohnen, getBilder, getObjekt, getRechnung, getUnterlagen, getVerbrauchsausweisGewerbe, getVerbrauchsausweisWohnen } from "#lib/server/db";
|
import { getAufnahme, getBedarfsausweisWohnen, getBilder, getObjekt, getRechnung, getUnterlagen, getVerbrauchsausweisGewerbe, getVerbrauchsausweisWohnen } from "#lib/server/db";
|
||||||
|
import { BenutzerClient } from "#components/Ausweis/types.js";
|
||||||
|
|
||||||
// Man sollte nur auf diese Seite kommen, wenn ein Ausweis bereits vorliegt und in der Datenbank abgespeichert wurde.
|
// Man sollte nur auf diese Seite kommen, wenn ein Ausweis bereits vorliegt und in der Datenbank abgespeichert wurde.
|
||||||
|
|
||||||
@@ -70,9 +71,16 @@ if (!params.has("ausweis") || !params.has("aufnahme") || !params.has("objekt") |
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let impersonatedUser: Partial<BenutzerClient> | null = null;
|
||||||
|
|
||||||
|
if (user){
|
||||||
|
if (user.id !== ausweis.benutzer_id && ausweis.benutzer_id !== undefined){
|
||||||
|
impersonatedUser = await getOtherUser(Astro, ausweis.benutzer_id) || {}
|
||||||
|
}
|
||||||
|
}
|
||||||
---
|
---
|
||||||
|
|
||||||
<AusweisLayout title="Kundendaten Aufnehmen - IBCornelsen">
|
<AusweisLayout title="Kundendaten Aufnehmen - IBCornelsen">
|
||||||
<KundendatenModule {user} {ausweis} {objekt} {aufnahme} {bilder} {rechnung} {ausweisart} {unterlagen} {partner_code} aktiveBezahlmethode={Enums.Bezahlmethoden.paypal} client:only ></KundendatenModule>
|
<KundendatenModule {user} {impersonatedUser} {ausweis} {objekt} {aufnahme} {bilder} {rechnung} {ausweisart} {unterlagen} {partner_code} aktiveBezahlmethode={Enums.Bezahlmethoden.paypal} client:only ></KundendatenModule>
|
||||||
</AusweisLayout>
|
</AusweisLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -45,14 +45,23 @@ export const GET: APIRoute = async (Astro) => {
|
|||||||
user = await getCurrentUser(Astro)
|
user = await getCurrentUser(Astro)
|
||||||
|
|
||||||
let pdf: Uint8Array<ArrayBufferLike> | null = null;
|
let pdf: Uint8Array<ArrayBufferLike> | null = null;
|
||||||
if (/[A-Z]{2}[0-9]{8}/.test(ausweis.id)) {
|
|
||||||
const id = ausweis.id.match(/[A-Z]{2}([0-9]{8})/) as RegExpMatchArray
|
if (ausweis.ausgestellt) {
|
||||||
// Dieser Ausweis wurde mit der alten Version erstellt, das PDF sollte bereits existieren.
|
if (/[A-Z]{2}[0-9]{8}/.test(ausweis.id)) {
|
||||||
pdf = await getS3File("ibc-pdfs", `ID_${id[1]}_Energieausweis.pdf`)
|
const id = ausweis.id.match(/[A-Z]{2}([0-9]{8})/) as RegExpMatchArray
|
||||||
} else if (ausweisart === Enums.Ausweisart.VerbrauchsausweisWohnen) {
|
// Dieser Ausweis wurde mit der alten Version erstellt, das PDF sollte bereits existieren.
|
||||||
pdf = await pdfVerbrauchsausweisWohnen(ausweis as VerbrauchsausweisWohnenClient, aufnahme, objekt, bilder, user, !ausweis.ausgestellt);
|
pdf = await getS3File("ibc-pdfs", `ID_${id[1]}_Energieausweis.pdf`)
|
||||||
} else if (ausweisart === Enums.Ausweisart.VerbrauchsausweisGewerbe) {
|
} else {
|
||||||
pdf = await pdfVerbrauchsausweisGewerbe(ausweis as VerbrauchsausweisGewerbeClient, aufnahme, objekt, bilder, user, !ausweis.ausgestellt);
|
pdf = await getS3File("ibc-pdfs", `ID_${ausweis.id}_Energieausweis.pdf`)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (ausweisart === Enums.Ausweisart.VerbrauchsausweisWohnen) {
|
||||||
|
pdf = await pdfVerbrauchsausweisWohnen(ausweis as VerbrauchsausweisWohnenClient, aufnahme, objekt, bilder, user, !ausweis.ausgestellt);
|
||||||
|
} else if (ausweisart === Enums.Ausweisart.VerbrauchsausweisGewerbe) {
|
||||||
|
pdf = await pdfVerbrauchsausweisGewerbe(ausweis as VerbrauchsausweisGewerbeClient, aufnahme, objekt, bilder, user, !ausweis.ausgestellt);
|
||||||
|
} else if (ausweisart === Enums.Ausweisart.BedarfsausweisWohnen) {
|
||||||
|
//todo
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Response(pdf, {
|
return new Response(pdf, {
|
||||||
|
|||||||
Reference in New Issue
Block a user