Submit success mit own windows
This commit is contained in:
@@ -25,11 +25,36 @@
|
||||
let success = false;
|
||||
let dienststellen: any[];
|
||||
|
||||
let fileInputKey = 0;
|
||||
let pdfDatein = [];
|
||||
|
||||
onMount(async () => {
|
||||
const res = await fetch('/api/dienststellen');
|
||||
dienststellen = await res.json();
|
||||
});
|
||||
|
||||
function resetForm() {
|
||||
anrede = '';
|
||||
vorname = '';
|
||||
nachname = '';
|
||||
geburtsdatum = '';
|
||||
strasse = '';
|
||||
hausnummer = '';
|
||||
ort = '';
|
||||
plz = '';
|
||||
telefon = '';
|
||||
email = '';
|
||||
schulart = '';
|
||||
zeitraum = '';
|
||||
wunsch1Id = '';
|
||||
wunsch2Id = '';
|
||||
wunsch3Id = '';
|
||||
motivation = '';
|
||||
pdfDateien = [];
|
||||
fileInputKey += 1;
|
||||
success = false;
|
||||
}
|
||||
|
||||
async function anmelden() {
|
||||
const data = new FormData();
|
||||
|
||||
@@ -103,21 +128,25 @@
|
||||
<div class="grid grid-cols-1 gap-4">
|
||||
<select bind:value={wunsch1Id} required>
|
||||
<option value="" disabled selected>1. Wunschdienststelle</option>
|
||||
{#each dienststellen as d}
|
||||
{#each (dienststellen ?? []).filter(d => d.plaetze > 0) as d}
|
||||
<option value={d.id}>{d.name}</option>
|
||||
{/each}
|
||||
</select>
|
||||
|
||||
<select bind:value={wunsch2Id} required>
|
||||
<option value="" disabled selected>2. Wunschdienststelle</option>
|
||||
{#each dienststellen as d}
|
||||
{#each (dienststellen ?? []).filter(d => d.plaetze > 0 && d.id !== wunsch1Id) as d}
|
||||
<option value={d.id}>{d.name}</option>
|
||||
{/each}
|
||||
</select>
|
||||
|
||||
<select bind:value={wunsch3Id} required>
|
||||
<option value="" disabled selected>3. Wunschdienststelle</option>
|
||||
{#each dienststellen as d}
|
||||
{#each (dienststellen ?? []).filter(d =>
|
||||
d.plaetze > 0 &&
|
||||
d.id !== wunsch1Id &&
|
||||
d.id !== wunsch2Id
|
||||
) as d}
|
||||
<option value={d.id}>{d.name}</option>
|
||||
{/each}
|
||||
</select>
|
||||
@@ -129,17 +158,19 @@
|
||||
</textarea>
|
||||
|
||||
<!-- Mehrere PDF Upload -->
|
||||
<div>
|
||||
<label for="pdf-upload" class="block text-gray-700 font-medium mb-1">PDFs hochladen (optional):</label>
|
||||
<input
|
||||
id="pdf-upload"
|
||||
type="file"
|
||||
accept="application/pdf"
|
||||
multiple
|
||||
on:change={(e) => pdfDateien = Array.from((e.target as HTMLInputElement).files || [])}
|
||||
class="input"
|
||||
/>
|
||||
</div>
|
||||
{#key fileInputKey}
|
||||
<div>
|
||||
<label for="pdf-upload" class="block text-gray-700 font-medium mb-1">PDFs hochladen (optional):</label>
|
||||
<input
|
||||
id="pdf-upload"
|
||||
type="file"
|
||||
accept="application/pdf"
|
||||
multiple
|
||||
on:change={(e) => pdfDateien = Array.from((e.target as HTMLInputElement).files || [])}
|
||||
class="input"
|
||||
/>
|
||||
</div>
|
||||
{/key}
|
||||
|
||||
<!-- Button -->
|
||||
<button type="submit"
|
||||
@@ -148,7 +179,17 @@
|
||||
</button>
|
||||
|
||||
{#if success}
|
||||
<p class="text-green-600 font-semibold text-center">Anmeldung erfolgreich gesendet!</p>
|
||||
<div class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
|
||||
<div class="bg-white p-6 rounded shadow-lg text-center space-y-4 max-w-sm w-full">
|
||||
<p class="text-green-600 font-semibold">Anmeldung erfolgreich gesendet!</p>
|
||||
<button
|
||||
class="bg-blue-600 text-white px-4 py-2 rounded hover:bg-blue-700"
|
||||
on:click={resetForm}
|
||||
>
|
||||
OK
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if fehler}
|
||||
|
||||
BIN
static/uploads/d1657cb9-4590-4263-a5e4-d5e0ed5c2325.pdf
Normal file
BIN
static/uploads/d1657cb9-4590-4263-a5e4-d5e0ed5c2325.pdf
Normal file
Binary file not shown.
BIN
static/uploads/ddbc0794-bdc6-4656-bf6e-59908edc0870.pdf
Normal file
BIN
static/uploads/ddbc0794-bdc6-4656-bf6e-59908edc0870.pdf
Normal file
Binary file not shown.
Reference in New Issue
Block a user