This commit is contained in:
Philipp Dormann 2025-04-28 10:35:45 +02:00
parent a21f61f3f3
commit 09b59175ee
Signed by: philipp
GPG Key ID: 3BB9ADD52DCA4314

View File

@ -22,7 +22,6 @@
$: donors = []; $: donors = [];
$: runners = []; $: runners = [];
$: type = "distance"; $: type = "distance";
$: is_fixed = false;
$: is_paid = false; $: is_paid = false;
$: amount_input = 0; $: amount_input = 0;
$: processed_last_submit = true; $: processed_last_submit = true;
@ -47,7 +46,7 @@
let amount_cent = Math.floor(amount_input * 100); let amount_cent = Math.floor(amount_input * 100);
processed_last_submit = false; processed_last_submit = false;
toast.loading($_("adding-donation")); toast.loading($_("adding-donation"));
if (is_fixed) { if (type === "fixed") {
let postdata = { let postdata = {
donor, donor,
amount: amount_cent, amount: amount_cent,
@ -73,7 +72,8 @@
.finally(() => { .finally(() => {
processed_last_submit = true; processed_last_submit = true;
}); });
} else { } else if (type === "anonymous") {
} else if (type === "distance") {
let postdata = { let postdata = {
donor, donor,
runner, runner,
@ -258,7 +258,7 @@
on:clear={() => (donors = null)} on:clear={() => (donors = null)}
/> />
</div> </div>
{#if !is_fixed} {#if type === "distance"}
<div class="col-span-6"> <div class="col-span-6">
<label <label
for="donor" for="donor"
@ -284,9 +284,9 @@
for="donation_amount_eur" for="donation_amount_eur"
class="block text-sm font-medium text-neutral-900" class="block text-sm font-medium text-neutral-900"
> >
{#if !is_fixed} {#if type === "fixed"}
{$_("amount-per-kilometer")} {$_("donation-amount")}
{:else}{$_("donation-amount")}{/if}</label {:else}{$_("amount-per-kilometer")}{/if}</label
> >
<div class="mt-1 flex rounded-md shadow-sm"> <div class="mt-1 flex rounded-md shadow-sm">
<input <input
@ -314,29 +314,19 @@
</span> </span>
{/if} {/if}
</div> </div>
{#if is_fixed} {#if type === "fixed"}
<div class="col-span-6"> <div class="flex">
<input
bind:checked={is_paid}
type="checkbox"
class="shrink-0 mt-0.5 border-neutral-200 rounded-sm text-blue-600 focus:ring-blue-500 checked:border-blue-500 disabled:opacity-50 disabled:pointer-events-none"
id="hs-default-checkbox"
/>
<label <label
for="paid" for="hs-default-checkbox"
class="block text-sm font-medium text-neutral-900" class="text-sm text-neutral-900 ms-2 font-medium"
>{$_("already-paid")}</label >{$_("already-paid")}</label
> >
<p class="text-neutral-500">
<input
id="paid"
bind:checked={is_paid}
name="paid"
type="checkbox"
class="focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-neutral-300 rounded"
/>
<span class="align-text-bottom">
{#if is_paid}
{$_("paid")}
{:else}
{$_("open")}
{/if}
</span>
</p>
</div> </div>
{/if} {/if}
{/if} {/if}