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 = [];
$: runners = [];
$: type = "distance";
$: is_fixed = false;
$: is_paid = false;
$: amount_input = 0;
$: processed_last_submit = true;
@ -47,7 +46,7 @@
let amount_cent = Math.floor(amount_input * 100);
processed_last_submit = false;
toast.loading($_("adding-donation"));
if (is_fixed) {
if (type === "fixed") {
let postdata = {
donor,
amount: amount_cent,
@ -73,7 +72,8 @@
.finally(() => {
processed_last_submit = true;
});
} else {
} else if (type === "anonymous") {
} else if (type === "distance") {
let postdata = {
donor,
runner,
@ -258,7 +258,7 @@
on:clear={() => (donors = null)}
/>
</div>
{#if !is_fixed}
{#if type === "distance"}
<div class="col-span-6">
<label
for="donor"
@ -284,9 +284,9 @@
for="donation_amount_eur"
class="block text-sm font-medium text-neutral-900"
>
{#if !is_fixed}
{$_("amount-per-kilometer")}
{:else}{$_("donation-amount")}{/if}</label
{#if type === "fixed"}
{$_("donation-amount")}
{:else}{$_("amount-per-kilometer")}{/if}</label
>
<div class="mt-1 flex rounded-md shadow-sm">
<input
@ -314,29 +314,19 @@
</span>
{/if}
</div>
{#if is_fixed}
<div class="col-span-6">
{#if type === "fixed"}
<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
for="paid"
class="block text-sm font-medium text-neutral-900"
for="hs-default-checkbox"
class="text-sm text-neutral-900 ms-2 font-medium"
>{$_("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>
{/if}
{/if}