diff --git a/src/components/tools/DonationCreate.svelte b/src/components/tools/DonationCreate.svelte index c156430e..db6fa32f 100644 --- a/src/components/tools/DonationCreate.svelte +++ b/src/components/tools/DonationCreate.svelte @@ -1,390 +1,417 @@
-

{$_("fast_donation_create")}

- -
-
- {#if last_created} -
-

- {$_("last-created-donation")}: #{last_created.id}: {last_created.amountPerDistance / - 100} € für {getRunnerLabel(last_created.runner)} von {getRunnerLabel( - last_created.donor - )} -

-
- {/if} +

{$_("fast_donation_create")}

+ +
+
+ {#if last_created} +
+

+ {$_("last-created-donation")}: #{last_created.id}: {last_created.amountPerDistance / + 100} € für {getRunnerLabel(last_created.runner)} von {getRunnerLabel( + last_created.donor + )} +

+
+ {/if} - -
-

{$_("runner")}

- 0} - class:focus:border-red-500={!amount > 0} - class:focus:ring-red-500={!amount > 0} - bind:value={amount} - on:keydown={(e)=> - { - if(e.key==="Enter"){ - e.preventDefault(); - document.querySelector("#button_existing_donor").focus(); - } - }} - type="number" - step="0.01" - id="donation_amount_eur" - name="donation_amount_eur" - class="focus:ring-indigo-500 focus:border-indigo-500 flex-1 block w-full rounded-none rounded-l-md sm:text-sm border-neutral-300 border bg-neutral-50 text-neutral-800 p-2" - placeholder="z.B. 1,50" - /> - -
-
+ +
+

{$_("runner")}

+ 0} + class:focus:border-red-500={!amount > 0} + class:focus:ring-red-500={!amount > 0} + bind:value={amount} + on:keydown={(e) => { + if (e.key === "Enter") { + e.preventDefault(); + document.querySelector("#button_existing_donor").focus(); + } + }} + type="number" + step="0.01" + id="donation_amount_eur" + name="donation_amount_eur" + class="focus:ring-indigo-500 focus:border-indigo-500 flex-1 block w-full rounded-none rounded-l-md sm:text-sm border-neutral-300 border bg-neutral-50 text-neutral-800 p-2" + placeholder="z.B. 1,50" + /> + +
+
- -
-
- - -
-
+ +
+

{$_("donor")}

- {#if !donor_create_new} - -
+ +
+
+ + +
+
- -
- - -
+ {#if !donor_create_new} + +
- -
-
- -
-
- -
-
+ +
+ + +
- {#if address_checked} - -
-
- - -
+ +
+
+ +
+
+ +
+
-
- - -
+ {#if address_checked} + +
+
+ + +
-
-
- - -
+
+ + +
-
- - -
-
-
- {/if} -
- {/if} -
- -
- -
-
- +
+ + +
+ + + {/if} + + {/if} + + +
+ +
+ + diff --git a/src/components/tools/VirtualSelect.svelte b/src/components/tools/VirtualSelect.svelte new file mode 100644 index 00000000..e8992e5c --- /dev/null +++ b/src/components/tools/VirtualSelect.svelte @@ -0,0 +1,235 @@ + + + + +
+ +
+ { + if (e.key === "Enter" && !isOpen) { + toggleDropdown(); + } else { + handleKeydown(e, focusedIndex); + } + }} + aria-label="Search and select an option" + /> + e.key === "Enter" && toggleDropdown()} + aria-label="Toggle dropdown" + > + + +
+ + + {#if isOpen} +
+ {#if filteredOptions.length > 0} + +
+
+ {#each visibleItems as item, i (item + "-" + (startIndex + i))} +
selectOption(item)} + on:keydown={(e) => handleKeydown(e, startIndex + i)} + role="option" + tabindex="0" + aria-selected={selected === item} + > + {item} +
+ {/each} +
+
+ {:else} +
No options found
+ {/if} +
+ {/if} +
+ +