Ansichtsausweis

This commit is contained in:
Moritz Utcke
2025-02-10 09:47:32 +07:00
parent 03d9b8a0a0
commit e9f7a2bb2f
7 changed files with 186 additions and 62 deletions

View File

@@ -7,13 +7,34 @@
export let aufnahme: AufnahmeClient;
export let bilder: UploadedGebaeudeBild[];
$: base64Ausweis = Buffer.from(JSON.stringify(ausweis), "utf-8").toString("base64")
$: base64Aufnahme = Buffer.from(JSON.stringify(aufnahme), "utf-8").toString("base64")
$: base64Objekt = Buffer.from(JSON.stringify(objekt), "utf-8").toString("base64")
$: base64Bilder = Buffer.from(JSON.stringify(bilder), "utf-8").toString("base64")
function openWindowWithPost(url: string, data: Record<string, any>) {
var form = document.createElement("form");
form.target = "_blank";
form.method = "POST";
form.action = url;
form.style.display = "none";
for (var key in data) {
var input = document.createElement("input");
input.type = "hidden";
input.name = key;
input.value = data[key];
form.appendChild(input);
}
document.body.appendChild(form);
form.submit();
document.body.removeChild(form);
}
</script>
<a class="border-2 rounded-lg w-[30%] bg-white text-center hover:shadow-md no-underline p-6 cursor-pointer" target="_blank" href="/pdf/ansichtsausweis?ausweis={base64Ausweis}&objekt=${base64Objekt}&aufnahme={base64Aufnahme}&bilder={base64Bilder}">
<button class="border-2 rounded-lg w-[30%] bg-white text-center hover:shadow-md no-underline p-6 cursor-pointer" on:click={() => {
openWindowWithPost("/pdf/ansichtsausweis", {
ausweis: JSON.stringify(ausweis),
aufnahme: JSON.stringify(aufnahme),
objekt: JSON.stringify(objekt),
bilder: JSON.stringify(bilder)
})
}}>
<img src="/images/ausweis.webp" alt="Ausweis" />
<span class="text-black font-medium text-lg">Ansichtsausweis</span>
</a>
</button>

View File

@@ -70,7 +70,7 @@ xl:grid-cols-3 xl:gap-x-8 xl:gap-y-8
required
bind:value={aufnahme.gebaeudetyp}
>
<option disabled selected value={false}>Bitte auswählen</option>
<option disabled selected>Bitte auswählen</option>
{#if ausweisart=="VerbrauchsausweisWohnen"}
<option value="Einfamilienhaus">Einfamilienhaus</option>