Compare commits
4 Commits
6fad04c862
...
2139b197ba
Author | SHA1 | Date | |
---|---|---|---|
2139b197ba | |||
4e1a944a2d | |||
e3c6d5a5c0 | |||
8c3f0092d2 |
@ -2,8 +2,17 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
|
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
|
||||||
|
|
||||||
|
#### [1.13.3](https://git.odit.services/lfk/frontend/compare/1.13.2...1.13.3)
|
||||||
|
|
||||||
|
- Refactor code structure for improved readability and maintainability [`e3c6d5a`](https://git.odit.services/lfk/frontend/commit/e3c6d5a5c0eaac2c91432b0be37d6fa11e57f644)
|
||||||
|
- refactor(donation): Refactor donor selection and add new donor creation functionality [`8c3f009`](https://git.odit.services/lfk/frontend/commit/8c3f0092d2735b1c85976f4e6955780b1035f68a)
|
||||||
|
- fix(donation): Ensure all selections are cleared on reset [`4e1a944`](https://git.odit.services/lfk/frontend/commit/4e1a944a2d7d0d0666fb8d2181a9941d0f11957f)
|
||||||
|
|
||||||
#### [1.13.2](https://git.odit.services/lfk/frontend/compare/1.13.1...1.13.2)
|
#### [1.13.2](https://git.odit.services/lfk/frontend/compare/1.13.1...1.13.2)
|
||||||
|
|
||||||
|
> 16 May 2025
|
||||||
|
|
||||||
|
- chore(release): 1.13.2 [`6fad04c`](https://git.odit.services/lfk/frontend/commit/6fad04c86249613dacfe2bc75362cb32d109573d)
|
||||||
- feat(dashboard): Add permission checks for scan and donation creation links [`838dcbf`](https://git.odit.services/lfk/frontend/commit/838dcbfd7e0c09e8cf61a04952475934ad1e3b86)
|
- feat(dashboard): Add permission checks for scan and donation creation links [`838dcbf`](https://git.odit.services/lfk/frontend/commit/838dcbfd7e0c09e8cf61a04952475934ad1e3b86)
|
||||||
|
|
||||||
#### [1.13.1](https://git.odit.services/lfk/frontend/compare/1.13.0...1.13.1)
|
#### [1.13.1](https://git.odit.services/lfk/frontend/compare/1.13.0...1.13.1)
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
<span style="display: none; visibility: hidden" id="buildinfo"
|
<span style="display: none; visibility: hidden" id="buildinfo"
|
||||||
>RELEASE_INFO-1.13.2-RELEASE_INFO</span
|
>RELEASE_INFO-1.13.3-RELEASE_INFO</span
|
||||||
>
|
>
|
||||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||||
<script src="/env.js"></script>
|
<script src="/env.js"></script>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@odit/lfk-frontend",
|
"name": "@odit/lfk-frontend",
|
||||||
"version": "1.13.2",
|
"version": "1.13.3",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"i18n-order": "node order.js",
|
"i18n-order": "node order.js",
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
DonorService,
|
DonorService,
|
||||||
RunnerService,
|
RunnerService,
|
||||||
} from "@odit/lfk-client-js";
|
} from "@odit/lfk-client-js";
|
||||||
import Svelecte from "svelecte";
|
|
||||||
import Select from "svelte-select";
|
import Select from "svelte-select";
|
||||||
import toast from "svelte-french-toast";
|
import toast from "svelte-french-toast";
|
||||||
|
|
||||||
@ -21,8 +20,9 @@
|
|||||||
country: "Germany",
|
country: "Germany",
|
||||||
};
|
};
|
||||||
let amount = 0;
|
let amount = 0;
|
||||||
let lastname = "";
|
|
||||||
let address_checked = false;
|
let address_checked = false;
|
||||||
|
let donor_create_new = false;
|
||||||
|
let last_created = null;
|
||||||
|
|
||||||
RunnerService.runnerControllerGetAll()
|
RunnerService.runnerControllerGetAll()
|
||||||
.then((val) => {
|
.then((val) => {
|
||||||
@ -38,7 +38,7 @@
|
|||||||
DonorService.donorControllerGetAll()
|
DonorService.donorControllerGetAll()
|
||||||
.then((val) => {
|
.then((val) => {
|
||||||
donors = val.map((r) => {
|
donors = val.map((r) => {
|
||||||
return { label: getDonorlabel(r), value: r };
|
return { label: getRunnerLabel(r), value: r };
|
||||||
});
|
});
|
||||||
console.log("refreshed donors");
|
console.log("refreshed donors");
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -54,8 +54,6 @@
|
|||||||
const getRunnerLabel = (option) =>
|
const getRunnerLabel = (option) =>
|
||||||
option.firstname + " " + (option.middlename || "") + " " + option.lastname;
|
option.firstname + " " + (option.middlename || "") + " " + option.lastname;
|
||||||
|
|
||||||
const getDonorlabel = (option) => `${option.firstname} (${option.lastname})`;
|
|
||||||
|
|
||||||
const filterRunners = (label, filterText, option) => {
|
const filterRunners = (label, filterText, option) => {
|
||||||
if (filterText.startsWith("#")) {
|
if (filterText.startsWith("#")) {
|
||||||
return option.value.id == parseInt(filterText.replace("#", ""));
|
return option.value.id == parseInt(filterText.replace("#", ""));
|
||||||
@ -70,221 +68,284 @@
|
|||||||
runnerinfo = { id: 0, firstname: "", lastname: "" };
|
runnerinfo = { id: 0, firstname: "", lastname: "" };
|
||||||
donorinfo = { id: 0, firstname: "", lastname: "" };
|
donorinfo = { id: 0, firstname: "", lastname: "" };
|
||||||
amount = 0;
|
amount = 0;
|
||||||
|
address_checked = false;
|
||||||
|
donor_create_new = false;
|
||||||
|
const clears = document.getElementsByClassName("clearSelect");
|
||||||
|
for (let i = 0; i < clears.length; i++) {
|
||||||
|
clears[i].click();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="p-4">
|
<div class="p-4">
|
||||||
<h3 class="text-3xl font-bold">{$_("fast_donation_create")}</h3>
|
<h3 class="text-3xl font-bold">{$_("fast_donation_create")}</h3>
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<div class="grid grid-cols-6 gap-4">
|
<div>
|
||||||
<div class="col-span-2">
|
<div class="w-full max-w-md space-y-4 mb-6">
|
||||||
<h4 class="text-xl font-semibold">
|
{#if last_created}
|
||||||
{$_("runner")}
|
<div class="mt-4 p-3 bg-green-50 border border-green-200 rounded-md">
|
||||||
</h4>
|
<p class="text-black">
|
||||||
<Select
|
{$_("last-created-donation")}: #{last_created.id}: {last_created.amountPerDistance /
|
||||||
containerClasses="rounded-l-md mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 border bg-gray-50 text-neutral-800 rounded-md p-2"
|
100} € für {getRunnerLabel(last_created.runner)} von {getRunnerLabel(
|
||||||
itemFilter={(label, filterText, option) =>
|
last_created.donor
|
||||||
filterRunners(label, filterText, option)}
|
)}
|
||||||
items={runners}
|
</p>
|
||||||
showChevron={true}
|
|
||||||
placeholder={$_("search-for-runner-by-name-or-id")}
|
|
||||||
noOptionsMessage={$_("no-runners-found")}
|
|
||||||
on:select={(selectedValue) => {
|
|
||||||
runnerinfo = selectedValue.detail.value;
|
|
||||||
}}
|
|
||||||
on:clear={() => (runnerinfo.runner = null)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="col-span-2">
|
|
||||||
<h4 class="text-xl font-semibold">
|
|
||||||
{$_("donor")}
|
|
||||||
</h4>
|
|
||||||
<div class="mb-2">
|
|
||||||
<Svelecte
|
|
||||||
name="donor_fistname"
|
|
||||||
placeholder={$_("first-name")}
|
|
||||||
clearable={true}
|
|
||||||
options={donors}
|
|
||||||
keepCreated={false}
|
|
||||||
creatable={true}
|
|
||||||
labelField="label"
|
|
||||||
on:change={(e) => {
|
|
||||||
if (!e.detail?.value) {
|
|
||||||
donorinfo = { id: 0, firstname: "", lastname: "" };
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!e.detail?.$created) {
|
|
||||||
donorinfo = e.detail.value;
|
|
||||||
lastname = e.detail.value.lastname;
|
|
||||||
} else {
|
|
||||||
console.log("created option", e);
|
|
||||||
donorinfo.firstname = e.detail.value;
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
class="rounded-l-md mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 border bg-gray-50 text-neutral-800 rounded-md p-0.5"
|
|
||||||
/>
|
|
||||||
<input
|
|
||||||
autocomplete="off"
|
|
||||||
placeholder={$_("last-name")}
|
|
||||||
class:border-red-500={donorinfo.lastname?.length == 0}
|
|
||||||
class:focus:border-red-500={donorinfo.lastname?.length == 0}
|
|
||||||
class:focus:ring-red-500={donorinfo.lastname?.length == 0}
|
|
||||||
bind:value={lastname}
|
|
||||||
on:input={e => {
|
|
||||||
donorinfo.lastname = e.target.value;
|
|
||||||
}}
|
|
||||||
type="text"
|
|
||||||
name="lastname"
|
|
||||||
class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-neutral-800 rounded-md p-2"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="flex items-start">
|
|
||||||
<div class="flex items-center h-5">
|
|
||||||
{#if donorinfo.id == 0}
|
|
||||||
<input
|
|
||||||
bind:checked={address_checked}
|
|
||||||
id="comments"
|
|
||||||
name="comments"
|
|
||||||
type="checkbox"
|
|
||||||
class="focus:ring-indigo-500 size-4 text-indigo-600 border-gray-300 rounded"
|
|
||||||
/>
|
|
||||||
{:else}
|
|
||||||
<input
|
|
||||||
checked={true}
|
|
||||||
disabled
|
|
||||||
id="comments"
|
|
||||||
name="comments"
|
|
||||||
type="checkbox"
|
|
||||||
class="focus:ring-indigo-500 size-4 text-indigo-600 border-gray-300 rounded"
|
|
||||||
/>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
<div class="ml-3 text-sm">
|
|
||||||
<label for="comments" class="font-semibold text-gray-700"
|
|
||||||
>{$_("receipt-needed")}</label
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{#if address_checked}
|
|
||||||
<div class="col-span-6">
|
|
||||||
<label for="address1" class="block text-sm font-medium text-gray-700"
|
|
||||||
>{$_("address")}</label
|
|
||||||
>
|
|
||||||
<input
|
|
||||||
autocomplete="off"
|
|
||||||
placeholder="Address"
|
|
||||||
class:border-red-500={address.address1.length == 0}
|
|
||||||
class:focus:border-red-500={address.address1.length == 0}
|
|
||||||
class:focus:ring-red-500={address.address1.length == 0}
|
|
||||||
bind:value={address.address1}
|
|
||||||
type="text"
|
|
||||||
name="address1"
|
|
||||||
class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-neutral-800 rounded-md p-2"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="col-span-6">
|
|
||||||
<label for="address2" class="block text-sm font-medium text-gray-700"
|
|
||||||
>{$_("apartment-suite-etc")}</label
|
|
||||||
>
|
|
||||||
<input
|
|
||||||
autocomplete="off"
|
|
||||||
placeholder={$_("apartment-suite-etc")}
|
|
||||||
bind:value={address.address2}
|
|
||||||
type="text"
|
|
||||||
name="address2"
|
|
||||||
class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-neutral-800 rounded-md p-2"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="col-span-6">
|
|
||||||
<label for="zipcode" class="block text-sm font-medium text-gray-700"
|
|
||||||
>{$_("zip-postal-code")}</label
|
|
||||||
>
|
|
||||||
<input
|
|
||||||
autocomplete="off"
|
|
||||||
placeholder={$_("zip-postal-code")}
|
|
||||||
class:border-red-500={address.postalcode.length == 0}
|
|
||||||
class:focus:border-red-500={address.postalcode.length == 0}
|
|
||||||
class:focus:ring-red-500={address.postalcode.length == 0}
|
|
||||||
bind:value={address.postalcode}
|
|
||||||
type="text"
|
|
||||||
name="zipcode"
|
|
||||||
class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-neutral-800 rounded-md p-2"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="col-span-6">
|
|
||||||
<label for="city" class="block text-sm font-medium text-gray-700"
|
|
||||||
>City</label
|
|
||||||
>
|
|
||||||
<input
|
|
||||||
autocomplete="off"
|
|
||||||
placeholder="City"
|
|
||||||
class:border-red-500={address.city.length == 0}
|
|
||||||
class:focus:border-red-500={address.city.length == 0}
|
|
||||||
class:focus:ring-red-500={address.city.length == 0}
|
|
||||||
bind:value={address.city}
|
|
||||||
type="text"
|
|
||||||
name="city"
|
|
||||||
class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm rounded-l-md sm:text-sm border-gray-300 border bg-gray-50 text-neutral-800 rounded-md p-2"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
|
||||||
<div>
|
<!-- Runner Selection -->
|
||||||
<h4 class="text-xl font-semibold">
|
<div>
|
||||||
{$_("amount-per-kilometer")}
|
<h4 class="text-xl font-semibold">{$_("runner")}</h4>
|
||||||
</h4>
|
<Select
|
||||||
<div class="mt-1 flex rounded-md shadow-sm">
|
containerClasses="rounded-md mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 border bg-gray-50 text-neutral-800 rounded-md p-2"
|
||||||
<input
|
itemFilter={(label, filterText, option) =>
|
||||||
autocomplete="off"
|
filterRunners(label, filterText, option)}
|
||||||
class:border-red-500={!amount > 0}
|
items={runners}
|
||||||
class:focus:border-red-500={!amount > 0}
|
showChevron={true}
|
||||||
class:focus:ring-red-500={!amount > 0}
|
placeholder={$_("search-for-runner-by-name-or-id")}
|
||||||
bind:value={amount}
|
noOptionsMessage={$_("no-runners-found")}
|
||||||
type="number"
|
on:select={(selectedValue) => {
|
||||||
step="0.01"
|
runnerinfo = selectedValue.detail.value;
|
||||||
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"
|
on:clear={() => (runnerinfo = { id: 0, firstname: "", lastname: "" })}
|
||||||
placeholder="2.00"
|
|
||||||
/>
|
/>
|
||||||
<span
|
|
||||||
class="inline-flex items-center px-3 rounded-r-md border border-neutral-300 bg-neutral-50 text-neutral-500 text-sm"
|
|
||||||
>€</span
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div>
|
<!-- Amount Input -->
|
||||||
<h4 class="text-xl font-semibold">
|
<div>
|
||||||
{$_("confirm")}
|
<h4 class="text-xl font-semibold">{$_("amount-per-kilometer")}</h4>
|
||||||
</h4>
|
<div class="mt-1 flex rounded-md shadow-sm">
|
||||||
<button
|
<input
|
||||||
disabled={amount <= 0 ||
|
autocomplete="off"
|
||||||
runnerinfo.id == 0 ||
|
class:border-red-500={!amount > 0}
|
||||||
(donorinfo.firstname.length == 0 || donorinfo.lastname.length == 0)}
|
class:focus:border-red-500={!amount > 0}
|
||||||
class="py-2 px-4 text-center inline-flex items-center text-md font-medium rounded-lg border border-transparent bg-blue-100 text-blue-800 hover:bg-blue-200 focus:outline-hidden focus:bg-blue-200 disabled:opacity-50 disabled:pointer-events-none dark:text-blue-500 dark:bg-blue-800/30 dark:hover:bg-blue-800/20 dark:focus:bg-blue-800/20"
|
class:focus:ring-red-500={!amount > 0}
|
||||||
on:click={async () => {
|
bind:value={amount}
|
||||||
toast.loading($_("creating-donation"));
|
type="number"
|
||||||
if (donorinfo.id == 0) {
|
step="0.01"
|
||||||
if (!address_checked) {
|
name="donation_amount_eur"
|
||||||
address = null
|
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="2.00"
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
class="inline-flex items-center px-3 rounded-r-md border border-neutral-300 bg-neutral-50 text-neutral-500 text-sm"
|
||||||
|
>€</span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Donor Selection -->
|
||||||
|
<div>
|
||||||
|
<h4 class="text-xl font-semibold">{$_("donor")}</h4>
|
||||||
|
|
||||||
|
<!-- Donor Type Toggle -->
|
||||||
|
<div class="mb-2">
|
||||||
|
<div class="flex border rounded-md overflow-hidden shadow-sm">
|
||||||
|
<button
|
||||||
|
class:bg-indigo-600={!donor_create_new}
|
||||||
|
class:text-white={!donor_create_new}
|
||||||
|
class="py-2 px-4 w-1/2 transition-colors"
|
||||||
|
on:click={() => {
|
||||||
|
donor_create_new = false;
|
||||||
|
donorinfo = { id: 0, firstname: "", lastname: "" };
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{$_("existing-donor")}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class={`py-2 px-4 w-1/2 transition-colors ${donor_create_new ? "bg-indigo-600 text-white" : "bg-gray-100 text-gray-700"}`}
|
||||||
|
on:click={() => {
|
||||||
|
donor_create_new = true;
|
||||||
|
donorinfo = { id: 0, firstname: "", lastname: "" };
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{$_("new-donor")}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if !donor_create_new}
|
||||||
|
<Select
|
||||||
|
containerClasses="rounded-md mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 border bg-gray-50 text-neutral-800 rounded-md p-2"
|
||||||
|
itemFilter={(label, filterText, option) =>
|
||||||
|
filterRunners(label, filterText, option)}
|
||||||
|
items={donors}
|
||||||
|
showChevron={true}
|
||||||
|
placeholder={$_("search-for-donor")}
|
||||||
|
noOptionsMessage={$_("no-donors-found")}
|
||||||
|
on:select={(selectedValue) => {
|
||||||
|
donorinfo = selectedValue.detail.value;
|
||||||
|
}}
|
||||||
|
on:clear={() =>
|
||||||
|
(donorinfo = { id: 0, firstname: "", lastname: "" })}
|
||||||
|
/>
|
||||||
|
{:else}
|
||||||
|
<div class="space-y-3">
|
||||||
|
<!-- First Name -->
|
||||||
|
<div>
|
||||||
|
<label
|
||||||
|
for="firstname"
|
||||||
|
class="block text-sm font-medium text-gray-700"
|
||||||
|
>
|
||||||
|
{$_("first-name")}
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
id="firstname"
|
||||||
|
bind:value={donorinfo.firstname}
|
||||||
|
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={$_("first-name")}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Last Name -->
|
||||||
|
<div>
|
||||||
|
<label
|
||||||
|
for="lastname"
|
||||||
|
class="block text-sm font-medium text-gray-700"
|
||||||
|
>
|
||||||
|
{$_("last-name")}
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
id="lastname"
|
||||||
|
bind:value={donorinfo.lastname}
|
||||||
|
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={$_("last-name")}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Address Checkbox -->
|
||||||
|
<div class="flex items-start mt-4">
|
||||||
|
<div class="flex items-center h-5">
|
||||||
|
<input
|
||||||
|
id="address_check"
|
||||||
|
type="checkbox"
|
||||||
|
bind:checked={address_checked}
|
||||||
|
class="focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 rounded"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="ml-3 text-sm">
|
||||||
|
<label for="address_check" class="font-medium text-gray-700">
|
||||||
|
{$_("receipt-needed")}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{#if address_checked}
|
||||||
|
<!-- Address Fields -->
|
||||||
|
<div
|
||||||
|
class="space-y-3 mt-3 p-3 border border-gray-200 rounded-md bg-gray-50"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
<label
|
||||||
|
for="address1"
|
||||||
|
class="block text-sm font-medium text-gray-700"
|
||||||
|
>
|
||||||
|
{$_("address")}
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
id="address1"
|
||||||
|
bind:value={address.address1}
|
||||||
|
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"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label
|
||||||
|
for="address2"
|
||||||
|
class="block text-sm font-medium text-gray-700"
|
||||||
|
>
|
||||||
|
{$_("apartment-suite-etc")}
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
id="address2"
|
||||||
|
bind:value={address.address2}
|
||||||
|
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"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="grid grid-cols-2 gap-3">
|
||||||
|
<div>
|
||||||
|
<label
|
||||||
|
for="postalcode"
|
||||||
|
class="block text-sm font-medium text-gray-700"
|
||||||
|
>
|
||||||
|
{$_("zip-postal-code")}
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
id="postalcode"
|
||||||
|
bind:value={address.postalcode}
|
||||||
|
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"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label
|
||||||
|
for="city"
|
||||||
|
class="block text-sm font-medium text-gray-700"
|
||||||
|
>
|
||||||
|
{$_("city")}
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
id="city"
|
||||||
|
bind:value={address.city}
|
||||||
|
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"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
<!-- Submit Button -->
|
||||||
|
<div class="mt-6">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="w-full inline-flex justify-center py-2 px-4 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 disabled:bg-gray-400 disabled:cursor-not-allowed"
|
||||||
|
disabled={!amount > 0 ||
|
||||||
|
!runnerinfo.id ||
|
||||||
|
(!donorinfo.id && !donor_create_new) ||
|
||||||
|
(donor_create_new &&
|
||||||
|
(!donorinfo.firstname || !donorinfo.lastname)) ||
|
||||||
|
(donor_create_new &&
|
||||||
|
address_checked &&
|
||||||
|
(!address.address1 || !address.city || !address.postalcode))}
|
||||||
|
on:click={async () => {
|
||||||
|
if (donor_create_new) {
|
||||||
|
donorinfo = await DonorService.donorControllerPost({
|
||||||
|
firstname: donorinfo.firstname,
|
||||||
|
lastname: donorinfo.lastname,
|
||||||
|
receiptNeeded: address_checked,
|
||||||
|
...(address_checked ? { address: address } : {}),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
donorinfo = await DonorService.donorControllerPost({
|
|
||||||
firstname: donorinfo.firstname,
|
DonationService.donationControllerPostDistance({
|
||||||
lastname: lastname,
|
donor: donorinfo.id,
|
||||||
receiptNeeded: address_checked,
|
runner: runnerinfo.id,
|
||||||
address: address,
|
amountPerDistance: amount * 100,
|
||||||
});
|
})
|
||||||
loadDonors();
|
.then((data) => {
|
||||||
}
|
last_created = data;
|
||||||
await DonationService.donationControllerPostDistance({
|
toast.success($_("donation-created-successfully"));
|
||||||
amountPerDistance: amount*100,
|
resetAll();
|
||||||
runner: runnerinfo.id,
|
loadDonors();
|
||||||
donor: donorinfo.id,
|
})
|
||||||
});
|
.catch((err) => {
|
||||||
toast.dismiss();
|
console.error("Error creating donation:", err);
|
||||||
toast.success($_("donation-created"));
|
toast.error($_("error-creating-donation"));
|
||||||
resetAll();
|
});
|
||||||
}}>{$_("create")}</button
|
}}
|
||||||
>
|
>
|
||||||
|
{$_("create")}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -199,6 +199,7 @@
|
|||||||
"donation-amount": "Sponsoringbetrag",
|
"donation-amount": "Sponsoringbetrag",
|
||||||
"donation-amount-must-be-greater-that-0-00eur": "Der Sponsoringbetrag muss größer als 0.00€ sein.",
|
"donation-amount-must-be-greater-that-0-00eur": "Der Sponsoringbetrag muss größer als 0.00€ sein.",
|
||||||
"donation-created": "Sponsoring erstellt",
|
"donation-created": "Sponsoring erstellt",
|
||||||
|
"donation-created-successfully": "Sponsoring erstellt",
|
||||||
"donation-deleted": "Sponsoring gelöscht",
|
"donation-deleted": "Sponsoring gelöscht",
|
||||||
"donation-quick-add": "Sponsoringschnelleingabe",
|
"donation-quick-add": "Sponsoringschnelleingabe",
|
||||||
"donation-updated": "Sponsoring wurde aktualisiert",
|
"donation-updated": "Sponsoring wurde aktualisiert",
|
||||||
@ -226,10 +227,12 @@
|
|||||||
"enabled_large": "Aktiviert",
|
"enabled_large": "Aktiviert",
|
||||||
"english": "Englisch",
|
"english": "Englisch",
|
||||||
"enter-payment": "Zahlung eingeben",
|
"enter-payment": "Zahlung eingeben",
|
||||||
|
"error-creating-donation": "Fehler bei der Anlage",
|
||||||
"error-during-import": "Fehler beim Importieren",
|
"error-during-import": "Fehler beim Importieren",
|
||||||
"error-whyile-copying-to-clipboard": "Fehler beim Kopieren in die Zwischenablage",
|
"error-whyile-copying-to-clipboard": "Fehler beim Kopieren in die Zwischenablage",
|
||||||
"error_on_login": "😢Fehler beim Login",
|
"error_on_login": "😢Fehler beim Login",
|
||||||
"everything-concerning-your-profile": "Alles zu deinem Profil",
|
"everything-concerning-your-profile": "Alles zu deinem Profil",
|
||||||
|
"existing-donor": "Existierende Sponsor:in",
|
||||||
"faq": "FAQ",
|
"faq": "FAQ",
|
||||||
"fast_card_replacement": "Karten-Schnellzusweisung (Mit Mobilgeräteunterstützung)",
|
"fast_card_replacement": "Karten-Schnellzusweisung (Mit Mobilgeräteunterstützung)",
|
||||||
"fast_donation_create": "Sponsoring-Schnellanlage",
|
"fast_donation_create": "Sponsoring-Schnellanlage",
|
||||||
@ -279,6 +282,7 @@
|
|||||||
"key": "Schlüssel",
|
"key": "Schlüssel",
|
||||||
"laeufer-hinzufuegen": "Läufer hinzufügen",
|
"laeufer-hinzufuegen": "Läufer hinzufügen",
|
||||||
"laptime": "Rundenzeit",
|
"laptime": "Rundenzeit",
|
||||||
|
"last-created-donation": "Zuletzt erstellt",
|
||||||
"last-name": "Nachname",
|
"last-name": "Nachname",
|
||||||
"last-name-is-required": "Nachname muss angegeben werden",
|
"last-name-is-required": "Nachname muss angegeben werden",
|
||||||
"lfk-is-os": "Das \"Lauf für Kaya!\" Frontend ist (wie alle anderen Projekte für den \"LfK!\" auch) ein OpenSource Projekt.",
|
"lfk-is-os": "Das \"Lauf für Kaya!\" Frontend ist (wie alle anderen Projekte für den \"LfK!\" auch) ein OpenSource Projekt.",
|
||||||
@ -311,6 +315,7 @@
|
|||||||
"must-contain-a-uppercase-letter": "Passwort muss einen Kleinbuchstaben enthalten!",
|
"must-contain-a-uppercase-letter": "Passwort muss einen Kleinbuchstaben enthalten!",
|
||||||
"name": "Name",
|
"name": "Name",
|
||||||
"name-is-required": "Der Gruppenname muss angegeben werden",
|
"name-is-required": "Der Gruppenname muss angegeben werden",
|
||||||
|
"new-donor": "Neue Sponsor:in",
|
||||||
"new-password": "Neues Passwort",
|
"new-password": "Neues Passwort",
|
||||||
"next_runner": "Nächster Läufer",
|
"next_runner": "Nächster Läufer",
|
||||||
"no-address": "Keine Adresse hinterlegt",
|
"no-address": "Keine Adresse hinterlegt",
|
||||||
@ -420,6 +425,7 @@
|
|||||||
"scanstations-are-being-loaded": "Scannerstationen werden geladen...",
|
"scanstations-are-being-loaded": "Scannerstationen werden geladen...",
|
||||||
"search-for-an-organization-by-name-or-id": "Suche eine Organisation (via Name oder #ID)",
|
"search-for-an-organization-by-name-or-id": "Suche eine Organisation (via Name oder #ID)",
|
||||||
"search-for-an-organization-or-team-by-name-or-id": "Suche eine Organisation oder ein Team (via Name oder #ID)",
|
"search-for-an-organization-or-team-by-name-or-id": "Suche eine Organisation oder ein Team (via Name oder #ID)",
|
||||||
|
"search-for-donor": "Nach Sponsor:in suchen",
|
||||||
"search-for-donor-name-or-id": "Suche eine Sponsor (via Name oder #ID)",
|
"search-for-donor-name-or-id": "Suche eine Sponsor (via Name oder #ID)",
|
||||||
"search-for-permission": "Berechtigungen durchsuchen",
|
"search-for-permission": "Berechtigungen durchsuchen",
|
||||||
"search-for-runner-by-name-or-id": "Suche einen Läufer (via Name oder #ID)",
|
"search-for-runner-by-name-or-id": "Suche einen Läufer (via Name oder #ID)",
|
||||||
|
@ -199,6 +199,7 @@
|
|||||||
"donation-amount": "Donation amount",
|
"donation-amount": "Donation amount",
|
||||||
"donation-amount-must-be-greater-that-0-00eur": "Donation amount must be greater that 0.00€",
|
"donation-amount-must-be-greater-that-0-00eur": "Donation amount must be greater that 0.00€",
|
||||||
"donation-created": "Created sponsoring",
|
"donation-created": "Created sponsoring",
|
||||||
|
"donation-created-successfully": "Donation created",
|
||||||
"donation-deleted": "Donation deleted",
|
"donation-deleted": "Donation deleted",
|
||||||
"donation-quick-add": "Mass sponsoring creation",
|
"donation-quick-add": "Mass sponsoring creation",
|
||||||
"donation-updated": "Donation updated",
|
"donation-updated": "Donation updated",
|
||||||
@ -230,6 +231,7 @@
|
|||||||
"error-whyile-copying-to-clipboard": "Error while copying to clipboard",
|
"error-whyile-copying-to-clipboard": "Error while copying to clipboard",
|
||||||
"error_on_login": "Error on login",
|
"error_on_login": "Error on login",
|
||||||
"everything-concerning-your-profile": "Everything concerning your profile",
|
"everything-concerning-your-profile": "Everything concerning your profile",
|
||||||
|
"existing-donor": "Existing Donor",
|
||||||
"faq": "FAQ",
|
"faq": "FAQ",
|
||||||
"fast_card_replacement": "Fast card replacement (with mobile support)",
|
"fast_card_replacement": "Fast card replacement (with mobile support)",
|
||||||
"fast_donation_create": "Mass donation creator",
|
"fast_donation_create": "Mass donation creator",
|
||||||
@ -279,6 +281,7 @@
|
|||||||
"key": "Key",
|
"key": "Key",
|
||||||
"laeufer-hinzufuegen": "Add runner",
|
"laeufer-hinzufuegen": "Add runner",
|
||||||
"laptime": "Laptime",
|
"laptime": "Laptime",
|
||||||
|
"last-created-donation": "Last created",
|
||||||
"last-name": "Last name",
|
"last-name": "Last name",
|
||||||
"last-name-is-required": "Last Name is required",
|
"last-name-is-required": "Last Name is required",
|
||||||
"lfk-is-os": "The \"Lauf für Kaya!\" Frontend is (like all other projects for the \"LfK!\" Also) an open source project.",
|
"lfk-is-os": "The \"Lauf für Kaya!\" Frontend is (like all other projects for the \"LfK!\" Also) an open source project.",
|
||||||
@ -310,6 +313,7 @@
|
|||||||
"must-contain-a-uppercase-letter": "Must contain a uppercase letter!",
|
"must-contain-a-uppercase-letter": "Must contain a uppercase letter!",
|
||||||
"name": "Name",
|
"name": "Name",
|
||||||
"name-is-required": "Name is required",
|
"name-is-required": "Name is required",
|
||||||
|
"new-donor": "New donor",
|
||||||
"new-password": "New password",
|
"new-password": "New password",
|
||||||
"next_runner": "Next Runner",
|
"next_runner": "Next Runner",
|
||||||
"no-address": "no address",
|
"no-address": "no address",
|
||||||
@ -419,6 +423,7 @@
|
|||||||
"scanstations-are-being-loaded": "Loading scanstations...",
|
"scanstations-are-being-loaded": "Loading scanstations...",
|
||||||
"search-for-an-organization-by-name-or-id": "Search for an organization (by name or #ID)",
|
"search-for-an-organization-by-name-or-id": "Search for an organization (by name or #ID)",
|
||||||
"search-for-an-organization-or-team-by-name-or-id": "Search for an organization or team (by name or #ID)",
|
"search-for-an-organization-or-team-by-name-or-id": "Search for an organization or team (by name or #ID)",
|
||||||
|
"search-for-donor": "Search for donor",
|
||||||
"search-for-donor-name-or-id": "Search for donor (by name or #ID)",
|
"search-for-donor-name-or-id": "Search for donor (by name or #ID)",
|
||||||
"search-for-permission": "Search for permission",
|
"search-for-permission": "Search for permission",
|
||||||
"search-for-runner-by-name-or-id": "Search for runner (by name or #ID)",
|
"search-for-runner-by-name-or-id": "Search for runner (by name or #ID)",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user