Merge branch 'main' into UMBE

This commit is contained in:
UMBENOMENA
2025-02-22 18:48:50 +01:00
committed by GitHub
227 changed files with 2153661 additions and 982 deletions

View File

@@ -26,7 +26,7 @@
import BilderZusatzsysteme from "../../components/Ausweis/BilderZusatzsysteme.svelte";
import moment from "moment";
import { BitChecker } from "src/lib/BitChecker.js";
import { Enums } from "@ibcornelsen/database/client";
import { Enums } from "#lib/client/prisma";
import {
BedarfsausweisWohnenClient,
BenutzerClient,

View File

@@ -2,7 +2,7 @@
import { AufnahmeKomplettClient, BenutzerClient } from "#components/Ausweis/types.js";
import Carousel from "#components/Carousel.svelte";
import DashboardAusweis from "#components/Dashboard/DashboardAusweis.svelte";
import { Objekt } from "@ibcornelsen/database/client";
import { Objekt } from "#lib/client/prisma";
import { ChevronLeft, ChevronRight, Plus } from "radix-svelte-icons";
export let user: BenutzerClient;
@@ -10,13 +10,13 @@
export let objekt: Objekt;
</script>
<h1 class="text-4xl font-medium mb-8">{objekt.adresse}, {objekt.plz} {objekt.ort}</h1>
<h1>{objekt.adresse}, {objekt.plz} {objekt.ort}</h1>
<div class="bg-white rounded-lg">
{#if aufnahme.bilder.length > 0}
<Carousel perPage={1}>
{#each aufnahme.bilder as bild, i (i)}
<img src="/bilder/{bild.uid}.webp" alt={bild.kategorie} class="max-h-[60vh] h-full w-full object-contain">
<img src="/bilder/{bild.uid}.jpg" alt={bild.kategorie} class="max-h-[30vh] h-full w-full object-contain">
{/each}
<span slot="left-control" class="p-2.5 bg-opacity-50 bg-white block rounded-full"><ChevronLeft size={24}></ChevronLeft></span>
<span slot="right-control" class="p-2.5 bg-opacity-50 bg-white block rounded-full"><ChevronRight size={24}></ChevronRight></span>

View File

@@ -4,7 +4,7 @@
import { endEnergieVerbrauchVerbrauchsausweis_2016 } from "#lib/Berechnungen/VerbrauchsausweisWohnen/VerbrauchsausweisWohnen_2016.js";
import AusweisPruefenNotification from "#components/AusweisPruefenNotification.svelte";
import DashboardAusweisSkeleton from "#components/Dashboard/DashboardAusweisSkeleton.svelte"
import { Event } from "@ibcornelsen/database/client";
import { Event } from "#lib/client/prisma";
import Pagination from "#components/Pagination.svelte";
import { api } from "astro-typesafe-api/client";
import Cookies from "js-cookie"

View File

@@ -1,112 +0,0 @@
<script lang="ts">
import { Designer } from "@pdfme/ui";
import { image, text } from "@pdfme/schemas";
import { variable } from "../../lib/pdf/plugins/variables/index"
import { onMount } from "svelte";
import { Template, BLANK_PDF } from "@pdfme/common";
let template: Template = {
basePdf: BLANK_PDF,
schemas: [
{
},
],
};
let plugins = { Bild: image, Text: text, Variablen: variable }
let container: HTMLDivElement;
let designer: Designer;
onMount(() => {
designer = new Designer({ domContainer: container, template, plugins });
});
function loadBasePDF() {
if (!loadTemplateInput.files) return;
const file = loadTemplateInput.files[0];
const reader = new FileReader();
reader.onload = function (e) {
if (!e.target) return;
const basePdf = e.target.result as string;
const newTemplate = { ...template, basePdf };
designer = new Designer({ domContainer: container, template: newTemplate, plugins });
};
reader.readAsDataURL(file);
}
function addNewField() {
template = designer.getTemplate();
const page = designer.getPageCursor();
template.schemas[page]["new-field"] = {
type: "text",
position: { x: 0, y: 0 },
width: 10,
height: 10
};
designer.updateTemplate(template);
}
function exportTemplate() {
const template = designer.getTemplate();
const blob = new Blob([JSON.stringify(template)], { type: "application/json" });
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = "template.json";
a.click();
}
function loadTemplate() {
const input = document.createElement("input");
input.type = "file";
input.accept = ".json";
input.onchange = function (e) {
if (!input.files) return;
const file = input.files[0];
const reader = new FileReader();
reader.onload = function (e) {
if (!e.target) return;
const template = JSON.parse(e.target.result as string) as Template;
designer = new Designer({ domContainer: container, template, plugins });
};
reader.readAsText(file);
};
input.click()
}
function onKeydown(e: KeyboardEvent) {
if (e.ctrlKey && e.key === "s") {
e.preventDefault();
exportTemplate();
}
}
let loadTemplateInput: HTMLInputElement;
</script>
<svelte:window on:keydown={onKeydown}></svelte:window>
<header class="mb-4">
<button class="btn btn-secondary" on:click={() => loadTemplateInput.click()}>Change base PDF</button>
<button class="btn btn-secondary" on:click={addNewField}>Add new Field</button>
<button class="btn btn-secondary" on:click={exportTemplate}>Export</button>
<button class="btn btn-secondary" on:click={loadTemplate}>Load Template</button>
<a class="btn btn-secondary" href="/dashboard/admin/pdf-viewer">Test in Viewer</a>
<input type="file" hidden bind:this={loadTemplateInput} on:change={loadBasePDF}>
</header>
<div bind:this={container} class="h-[80vh]"></div>

View File

@@ -1,99 +0,0 @@
<script lang="ts">
import { variable } from "#lib/pdf/plugins/variables";
import { Benutzer, GebaeudeStammdaten, Rechnungen, VerbrauchsausweisWohnen } from "@ibcornelsen/database/client";
import { Template } from "@pdfme/common";
import { Viewer } from "@pdfme/ui";
import { Check } from "radix-svelte-icons";
import { image, text } from "@pdfme/schemas";
import { VerbrauchsausweisWohnenClient } from "#components/Ausweis/types";
import { convertAusweisData } from "#lib/AusweisData";
export let ausweise: VerbrauchsausweisWohnenClient[];
let pdfInputs: VerbrauchsausweisWohnenClient;
let template: Template;
let viewer: Viewer
function loadTemplate() {
const input = document.createElement("input");
input.type = "file";
input.accept = ".json";
input.onchange = function (e) {
if (!input.files) return;
const file = input.files[0];
const reader = new FileReader();
reader.onload = async function (e) {
if (!e.target) return;
template = JSON.parse(e.target.result as string) as Template;
if (!pdfInputs) {
alert("Bitte wählen Sie einen Ausweis aus, um diesen als Basis zu verwenden.")
return
};
const convertedInputs = convertAusweisData(pdfInputs);
viewer = new Viewer({
domContainer: pdfViewerContainer,
template,
inputs: [convertedInputs],
plugins: { text, image, variable: { ...variable, pdf: variable.pdf.bind(convertedInputs), ui: variable.ui.bind(convertedInputs) } }
})
};
reader.readAsText(file);
};
input.click();
}
function changeInputs(inputs: VerbrauchsausweisWohnenClient) {
pdfInputs = inputs;
if (!template) {
alert("Bitte laden Sie zuerst ein Template.")
return
}
if (viewer) viewer.destroy();
const convertedInputs = convertAusweisData(pdfInputs);
viewer = new Viewer({
domContainer: pdfViewerContainer,
template,
inputs: [convertedInputs],
plugins: { text, image, variable: { ...variable, pdf: variable.pdf.bind(convertedInputs), ui: variable.ui.bind(convertedInputs) } }
})
}
let pdfViewerContainer: HTMLDivElement;
</script>
<header>
<div>
<button class="btn btn-secondary mb-4" on:click={loadTemplate}>Load Template</button>
</div>
</header>
<main class="grid grid-cols-[1fr_4fr] gap-4">
<div>
<div class="flex flex-col gap-4">
{#each ausweise as ausweis}
<div class="rounded-lg border p-2 flex flex-row items-center justify-between">
<h2 class="text-black">{ausweis.aufnahme.objekt.adresse}</h2>
<button class="btn btn-square btn-ghost p-1.5" on:click={() => {
changeInputs(ausweis)
}}><Check size={20}/></button>
</div>
{/each}
</div>
</div>
<div bind:this={pdfViewerContainer}></div>
</main>

View File

@@ -3,8 +3,8 @@
import Label from "../components/Label.svelte";
import type {
Bezahlmethoden,
} from "@ibcornelsen/database/client";
import { Enums } from "@ibcornelsen/database/client";
} from "#lib/client/prisma";
import { Enums } from "#lib/client/prisma";
import PaymentOption from "#components/PaymentOption.svelte";
import CheckoutItem from "#components/CheckoutItem.svelte";
import { BenutzerClient, VerbrauchsausweisWohnenClient } from "#components/Ausweis/types.js";

View File

@@ -4,8 +4,8 @@
import Bereich from "#components/labels/Bereich.svelte";
import Ansprechpartner from "#components/Ausweis/Ansprechpartner.svelte";
import Rechnungsadresse from "#components/Ausweis/Rechnungsadresse.svelte";
import type { Bezahlmethoden } from "@ibcornelsen/database/client";
import { Enums } from "@ibcornelsen/database/client";
import type { Bezahlmethoden } from "#lib/client/prisma";
import { Enums } from "#lib/client/prisma";
import { dialogs } from "svelte-dialogs";
import LoginDialog from "#components/LoginDialog.svelte";
import {

View File

@@ -1,6 +1,6 @@
<script lang="ts">
import { RechnungClient } from "#components/Ausweis/types.js";
import { Enums } from "@ibcornelsen/database/client";
import { Enums } from "#lib/client/prisma";
export let rechnung: RechnungClient;
</script>

View File

@@ -19,7 +19,7 @@
import { AufnahmeClient, ObjektClient, UploadedGebaeudeBild, VerbrauchsausweisGewerbeClient } from "#components/Ausweis/types.js";
import { BenutzerClient } from "#components/Ausweis/types.js";
import GebaeudeDaten from "#components/Ausweis/GebaeudeDaten.svelte";
import { Enums } from "@ibcornelsen/database/client";
import { Enums } from "#lib/client/prisma";
import moment from "moment";
import {
AuditType,

View File

@@ -5,7 +5,6 @@
import Bereich from "#components/labels/Bereich.svelte";
import ButtonSpaeterHilfe from "#components/Ausweis/ButtonSpaeterHilfe.svelte";
import ButtonWeiterHilfe from "#components/Ausweis/ButtonWeiterHilfe.svelte";
import Ausweisart from "#components/Ausweis/Ausweisart.svelte";
import GebaeudeDaten from "#components/Ausweis/GebaeudeDaten.svelte";
@@ -50,7 +49,7 @@
ObjektClient,
AufnahmeClient,
} from "#components/Ausweis/types.js";
import { Enums } from "@ibcornelsen/database/client";
import { Enums } from "#lib/client/prisma.js";
// TODO: Vom Server sollte ein volles Objekt kommen, dass alle Subobjekte enthält, weil es sonst zu Problemen führen kann
// wenn aufnahme oder objekt nicht existiert...
@@ -59,6 +58,7 @@
export let aufnahme: AufnahmeClient
export let user: BenutzerClient = {} as BenutzerClient;
export let bilder: UploadedGebaeudeBild[] = []
export let ausweistyp: Enums.AusweisTyp;
if (Object.keys(ausweis).length === 0) {
const localStorageAusweis = localStorage.getItem("ausweis");
@@ -303,6 +303,7 @@ const ausweisart = Enums.Ausweisart.VerbrauchsausweisWohnen
bind:objekt
bind:aufnahme
ausweisart={Enums.Ausweisart.VerbrauchsausweisWohnen}
{ausweistyp}
>
</ButtonWeiterHilfe>

View File

@@ -10,7 +10,7 @@
GEGNachweisWohnenClient,
} from "#components/Ausweis/types.js";
import Bereich from "#components/labels/Bereich.svelte";
import { Enums } from "@ibcornelsen/database/client";
import { Enums } from "#lib/client/prisma";
import InputLabel from "#components/labels/InputLabel.svelte";
import HelpLabel from "#components/labels/HelpLabel.svelte";
import Progressbar from "#components/Ausweis/Progressbar.svelte";

View File

@@ -10,7 +10,7 @@
GEGNachweisWohnenClient,
} from "#components/Ausweis/types.js";
import Bereich from "#components/labels/Bereich.svelte";
import { Enums } from "@ibcornelsen/database/client";
import { Enums } from "#lib/client/prisma";
import InputLabel from "#components/labels/InputLabel.svelte";
import HelpLabel from "#components/labels/HelpLabel.svelte";
import Progressbar from "#components/Ausweis/Progressbar.svelte";