Funktionalität anfänglich überprüft.
This commit is contained in:
@@ -2,10 +2,11 @@
|
||||
import type { BedarfsausweisWohnen, Enums, VerbrauchsausweisGewerbe } from "@ibcornelsen/database/client";
|
||||
|
||||
export let max: number = 2;
|
||||
export let min: number = 1;
|
||||
export let name: string = ""
|
||||
|
||||
// Array of base64 encoded images read into the input.
|
||||
import { GebaeudeClient, UploadedGebaeudeBild, VerbrauchsausweisWohnenClient } from "./Ausweis/types";
|
||||
import { GebaeudeClient, UploadedGebaeudeBild, VerbrauchsausweisWohnenClient } from "./Ausweis/types.js";
|
||||
|
||||
export let images: UploadedGebaeudeBild[] = [];
|
||||
export let ausweis: VerbrauchsausweisWohnenClient | VerbrauchsausweisGewerbe | BedarfsausweisWohnen;
|
||||
@@ -77,10 +78,19 @@
|
||||
reader.readAsArrayBuffer(file);
|
||||
}
|
||||
}
|
||||
|
||||
let fileUpload: HTMLInputElement;
|
||||
|
||||
export const upload = () => {
|
||||
fileUpload.click()
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if max > 1}
|
||||
<input type="file" class="file-input file-input-ghost" {name} multiple on:change={getAllImages} />
|
||||
<!-- Falls die maximale Anzahl Bilder erreicht wurde grauen wir den input aus und zeigen einen Hilfstext -->
|
||||
{#if images.filter((image) => image.kategorie === kategorie).length === max}
|
||||
<span class="bg-base-200 border px-4 py-2">Maximale Anzahl Bilder wurde erreicht.</span>
|
||||
{:else if max > 1}
|
||||
<input type="file" class="file-input file-input-ghost" bind:this={fileUpload} {name} multiple on:change={getAllImages} />
|
||||
{:else}
|
||||
<input type="file" class="file-input file-input-ghost" {name} on:change={getAllImages} />
|
||||
<input type="file" class="file-input file-input-ghost" bind:this={fileUpload} {name} on:change={getAllImages} />
|
||||
{/if}
|
||||
Reference in New Issue
Block a user