Build getestet + MDX Erstmal entfernt
This commit is contained in:
@@ -87,9 +87,18 @@
|
||||
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>
|
||||
@@ -99,4 +108,4 @@
|
||||
<input type="file" hidden bind:this={loadTemplateInput} on:change={loadBasePDF}>
|
||||
</header>
|
||||
|
||||
<div bind:this={container}></div>
|
||||
<div bind:this={container} class="h-[80vh]"></div>
|
||||
|
||||
@@ -5,13 +5,14 @@
|
||||
import { Viewer } from "@pdfme/ui";
|
||||
import { Check } from "radix-svelte-icons";
|
||||
import { image, text } from "@pdfme/schemas";
|
||||
import { AusweisData, convertAusweisData } from "#lib/AusweisData";
|
||||
import { VerbrauchsausweisWohnenClient } from "#components/Ausweis/types";
|
||||
import { convertAusweisData } from "#lib/AusweisData";
|
||||
|
||||
|
||||
|
||||
export let ausweise: AusweisData[];
|
||||
export let ausweise: VerbrauchsausweisWohnenClient[];
|
||||
|
||||
let pdfInputs: AusweisData;
|
||||
let pdfInputs: VerbrauchsausweisWohnenClient;
|
||||
let template: Template;
|
||||
let viewer: Viewer
|
||||
|
||||
@@ -37,11 +38,13 @@
|
||||
return
|
||||
};
|
||||
|
||||
const convertedInputs = convertAusweisData(pdfInputs);
|
||||
|
||||
viewer = new Viewer({
|
||||
domContainer: pdfViewerContainer,
|
||||
template,
|
||||
inputs: [convertAusweisData(pdfInputs)],
|
||||
plugins: { text, image, variable}
|
||||
inputs: [convertedInputs],
|
||||
plugins: { text, image, variable: { ...variable, pdf: variable.pdf.bind(convertedInputs), ui: variable.ui.bind(convertedInputs) } }
|
||||
})
|
||||
};
|
||||
|
||||
@@ -51,8 +54,9 @@
|
||||
input.click();
|
||||
}
|
||||
|
||||
function changeInputs(inputs: AusweisData) {
|
||||
function changeInputs(inputs: VerbrauchsausweisWohnenClient) {
|
||||
pdfInputs = inputs;
|
||||
|
||||
if (!template) {
|
||||
alert("Bitte laden Sie zuerst ein Template.")
|
||||
return
|
||||
@@ -60,11 +64,13 @@
|
||||
|
||||
if (viewer) viewer.destroy();
|
||||
|
||||
const convertedInputs = convertAusweisData(pdfInputs);
|
||||
|
||||
viewer = new Viewer({
|
||||
domContainer: pdfViewerContainer,
|
||||
template,
|
||||
inputs: [convertAusweisData(pdfInputs)],
|
||||
plugins: { text, image, variable}
|
||||
inputs: [convertedInputs],
|
||||
plugins: { text, image, variable: { ...variable, pdf: variable.pdf.bind(convertedInputs), ui: variable.ui.bind(convertedInputs) } }
|
||||
})
|
||||
}
|
||||
|
||||
@@ -81,7 +87,7 @@
|
||||
<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.gebaeude_stammdaten.adresse}</h2>
|
||||
<h2 class="text-black">{ausweis.gebaeude_aufnahme_allgemein.gebaeude_stammdaten.adresse}</h2>
|
||||
<button class="btn btn-square btn-ghost p-1.5" on:click={() => {
|
||||
changeInputs(ausweis)
|
||||
}}><Check size={20}/></button>
|
||||
|
||||
Reference in New Issue
Block a user