Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
e75be49be4 | |||
505fb8cb08 | |||
e5c9265588 | |||
02003ec80e | |||
133470b6f2 | |||
4a6230c439 | |||
4289034436 | |||
8f8858f100 |
12
CHANGELOG.md
12
CHANGELOG.md
@ -2,9 +2,21 @@
|
|||||||
|
|
||||||
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.3.0](https://git.odit.services/lfk/frontend/compare/1.2.0...1.3.0)
|
||||||
|
|
||||||
|
- feat(donations): Implemented donation deletion via confirm modal [`505fb8c`](https://git.odit.services/lfk/frontend/commit/505fb8cb08b81a7dcb08561bdda0f6464f140d3e)
|
||||||
|
- feat(donationsoverview): Switched donations overview to datatable [`133470b`](https://git.odit.services/lfk/frontend/commit/133470b6f2a63ec087f27c98ef260648a8672e5f)
|
||||||
|
- feat(donations): Implemented add donation payment via datatable refresh [`e5c9265`](https://git.odit.services/lfk/frontend/commit/e5c92655886ad9a6fcd7565fadd7955c477c3595)
|
||||||
|
- feat(donations): Donations reactive create and load into datatable [`02003ec`](https://git.odit.services/lfk/frontend/commit/02003ec80efc16aabd126710a6eeac18df43f841)
|
||||||
|
- feat(DonationsOverview): i18n loading text [`8f8858f`](https://git.odit.services/lfk/frontend/commit/8f8858f10071ddf9988d0ec0e3c4a891db24a102)
|
||||||
|
- new license file version [CI SKIP] [`4289034`](https://git.odit.services/lfk/frontend/commit/4289034436869750205a946247e7ab5f9892fe98)
|
||||||
|
|
||||||
#### [1.2.0](https://git.odit.services/lfk/frontend/compare/1.1.0...1.2.0)
|
#### [1.2.0](https://git.odit.services/lfk/frontend/compare/1.1.0...1.2.0)
|
||||||
|
|
||||||
|
> 19 April 2023
|
||||||
|
|
||||||
- feat(donoroverview): Added datatable formatters [`d98fb0d`](https://git.odit.services/lfk/frontend/commit/d98fb0d5b288c987a45ccbf2bb026ccaab539a71)
|
- feat(donoroverview): Added datatable formatters [`d98fb0d`](https://git.odit.services/lfk/frontend/commit/d98fb0d5b288c987a45ccbf2bb026ccaab539a71)
|
||||||
|
- 🚀RELEASE v1.2.0 [`fdc7d80`](https://git.odit.services/lfk/frontend/commit/fdc7d80bbf9bd698128e9ec4f91fa813499777a9)
|
||||||
- feat(donors): Load donors paginated [`5014bf5`](https://git.odit.services/lfk/frontend/commit/5014bf5bc5873cfe4ae04d71b4aff12b257dd2e3)
|
- feat(donors): Load donors paginated [`5014bf5`](https://git.odit.services/lfk/frontend/commit/5014bf5bc5873cfe4ae04d71b4aff12b257dd2e3)
|
||||||
- feat(donorsoverview): Dynamicly add newly generated donors [`352551e`](https://git.odit.services/lfk/frontend/commit/352551e168b5dced5e7353e82655908d82d28af0)
|
- feat(donorsoverview): Dynamicly add newly generated donors [`352551e`](https://git.odit.services/lfk/frontend/commit/352551e168b5dced5e7353e82655908d82d28af0)
|
||||||
- feat(donorsoverview): Implemented delete confirmation with datatable [`7aec050`](https://git.odit.services/lfk/frontend/commit/7aec050419f6f1bf853c3e1bc655b01725ed3b65)
|
- feat(donorsoverview): Implemented delete confirmation with datatable [`7aec050`](https://git.odit.services/lfk/frontend/commit/7aec050419f6f1bf853c3e1bc655b01725ed3b65)
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<span style="display: none;visibility: hidden;" id="buildinfo">RELEASE_INFO-1.2.0-RELEASE_INFO</span>
|
<span style="display: none;visibility: hidden;" id="buildinfo">RELEASE_INFO-1.3.0-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>
|
||||||
<script type="module" src="/src/main.js"></script>
|
<script type="module" src="/src/main.js"></script>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@odit/lfk-frontend",
|
"name": "@odit/lfk-frontend",
|
||||||
"version": "1.2.0",
|
"version": "1.3.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"i18n-order": "node order.js",
|
"i18n-order": "node order.js",
|
||||||
|
File diff suppressed because one or more lines are too long
@ -10,8 +10,9 @@
|
|||||||
import Select from "svelte-select";
|
import Select from "svelte-select";
|
||||||
import Toastify from "toastify-js";
|
import Toastify from "toastify-js";
|
||||||
import { is_promise } from "svelte/internal";
|
import { is_promise } from "svelte/internal";
|
||||||
|
import { createEventDispatcher } from "svelte";
|
||||||
export let modal_open;
|
export let modal_open;
|
||||||
export let current_donations;
|
const dispatch = createEventDispatcher();
|
||||||
const getDonorLabel = (option) =>
|
const getDonorLabel = (option) =>
|
||||||
option.firstname + " " + (option.middlename || "") + " " + option.lastname;
|
option.firstname + " " + (option.middlename || "") + " " + option.lastname;
|
||||||
const filterDonors = (label, filterText, option) =>
|
const filterDonors = (label, filterText, option) =>
|
||||||
@ -59,14 +60,14 @@ import { is_promise } from "svelte/internal";
|
|||||||
let amount_cent = Math.floor(amount_input * 100);
|
let amount_cent = Math.floor(amount_input * 100);
|
||||||
processed_last_submit = false;
|
processed_last_submit = false;
|
||||||
const toast = Toastify({
|
const toast = Toastify({
|
||||||
text: $_('adding-donation'),
|
text: $_("adding-donation"),
|
||||||
duration: -1,
|
duration: -1,
|
||||||
}).showToast();
|
}).showToast();
|
||||||
if (is_fixed) {
|
if (is_fixed) {
|
||||||
let postdata = {
|
let postdata = {
|
||||||
donor,
|
donor,
|
||||||
amount: amount_cent,
|
amount: amount_cent,
|
||||||
paidAmount: 0
|
paidAmount: 0,
|
||||||
};
|
};
|
||||||
if (is_paid) {
|
if (is_paid) {
|
||||||
postdata.paidAmount = amount_cent;
|
postdata.paidAmount = amount_cent;
|
||||||
@ -79,12 +80,11 @@ import { is_promise } from "svelte/internal";
|
|||||||
modal_open = false;
|
modal_open = false;
|
||||||
//
|
//
|
||||||
Toastify({
|
Toastify({
|
||||||
text: $_('donation_added'),
|
text: $_("donation_added"),
|
||||||
duration: 500,
|
duration: 500,
|
||||||
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
|
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
|
||||||
}).showToast();
|
}).showToast();
|
||||||
current_donations.push(result);
|
dispatch("created", { donations: [result] });
|
||||||
current_donations = current_donations;
|
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
//
|
//
|
||||||
@ -108,12 +108,11 @@ import { is_promise } from "svelte/internal";
|
|||||||
modal_open = false;
|
modal_open = false;
|
||||||
//
|
//
|
||||||
Toastify({
|
Toastify({
|
||||||
text: $_('donation_added'),
|
text: $_("donation_added"),
|
||||||
duration: 500,
|
duration: 500,
|
||||||
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
|
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
|
||||||
}).showToast();
|
}).showToast();
|
||||||
current_donations.push(result);
|
dispatch("created", { donations: [result] });
|
||||||
current_donations = current_donations;
|
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
//
|
//
|
||||||
@ -128,6 +127,207 @@ import { is_promise } from "svelte/internal";
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
{#if modal_open}
|
||||||
|
<div
|
||||||
|
class="fixed z-10 inset-0 overflow-y-auto"
|
||||||
|
use:clickOutside
|
||||||
|
on:click_outside={() => {
|
||||||
|
modal_open = false;
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0"
|
||||||
|
>
|
||||||
|
<div class="fixed inset-0 transition-opacity" aria-hidden="true">
|
||||||
|
<div
|
||||||
|
class="absolute inset-0 bg-gray-500 opacity-75"
|
||||||
|
data-id="modal_backdrop"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<span
|
||||||
|
class="hidden sm:inline-block sm:align-middle sm:h-screen"
|
||||||
|
aria-hidden="true">​</span
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="inline-block align-bottom bg-white rounded-lg text-left shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full"
|
||||||
|
role="dialog"
|
||||||
|
aria-modal="true"
|
||||||
|
aria-labelledby="modal-headline"
|
||||||
|
>
|
||||||
|
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
|
||||||
|
<div class="sm:flex sm:items-start">
|
||||||
|
<div
|
||||||
|
class="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-blue-100 sm:mx-0 sm:h-10 sm:w-10"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
class="h-6 w-6 text-blue-600"
|
||||||
|
fill="currentColor"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
width="24"
|
||||||
|
height="24"
|
||||||
|
><path fill="none" d="M0 0h24v24H0z" />
|
||||||
|
<path
|
||||||
|
d="M14 2a8 8 0 013.3 15.3A8 8 0 116.7 6.7 8 8 0 0114 2zm-3 7H9v1a2.5 2.5 0 00-.16 5h2.25a.5.5 0 010 1H7v2h2v1h2v-1a2.5 2.5 0 00.16-5H8.91a.5.5 0 010-1H13v-2h-2V9zm3-5a5.99 5.99 0 00-4.48 2.01 8 8 0 018.47 8.47A6 6 0 0014 4z"
|
||||||
|
/></svg
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left">
|
||||||
|
<h3 class="text-lg leading-6 font-medium text-gray-900">
|
||||||
|
{#if is_fixed}
|
||||||
|
{$_("create-a-new-fixed-donation")}
|
||||||
|
{:else}{$_("create-a-new-distance-donation")}{/if}
|
||||||
|
</h3>
|
||||||
|
<label class="content-center align-middle object-center">
|
||||||
|
<span class="ml-2 text-base" class:text-gray-300={is_fixed}
|
||||||
|
>{$_("distance-donation")}</span
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
class="toggle relative w-10 h-5 transition-all duration-200 ease-in-out bg-gray-400 rounded-full shadow-inner outline-none appearance-none align-middle"
|
||||||
|
type="checkbox"
|
||||||
|
bind:checked={is_fixed}
|
||||||
|
/>
|
||||||
|
<span class="ml-2 text-base" class:text-gray-300={!is_fixed}
|
||||||
|
>{$_("fixed-donation")}</span
|
||||||
|
>
|
||||||
|
</label>
|
||||||
|
<div class="mt-2 mb-6">
|
||||||
|
<p class="text-sm text-gray-500">
|
||||||
|
{$_(
|
||||||
|
"please-provide-the-nessecary-information-to-create-a-new-donation"
|
||||||
|
)}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="grid grid-cols-6 gap-6">
|
||||||
|
<div class="col-span-6">
|
||||||
|
<label
|
||||||
|
for="donor"
|
||||||
|
class="block text-sm font-medium text-gray-700"
|
||||||
|
>{$_("donor")}</label
|
||||||
|
>
|
||||||
|
<Select
|
||||||
|
containerClasses="rounded-l-md 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-gray-500 rounded-md p-2"
|
||||||
|
itemFilter={(label, filterText, option) =>
|
||||||
|
filterDonors(label, filterText, option)}
|
||||||
|
items={donors}
|
||||||
|
showChevron={true}
|
||||||
|
placeholder={$_("search-for-donor-name-or-id")}
|
||||||
|
noOptionsMessage={$_("no-donors-found")}
|
||||||
|
on:select={(selectedValue) =>
|
||||||
|
(donor = selectedValue.detail.value.id)}
|
||||||
|
on:clear={() => (donors = null)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{#if !is_fixed}
|
||||||
|
<div class="col-span-6">
|
||||||
|
<label
|
||||||
|
for="donor"
|
||||||
|
class="block text-sm font-medium text-gray-700"
|
||||||
|
>{$_("runner")}</label
|
||||||
|
>
|
||||||
|
<Select
|
||||||
|
containerClasses="rounded-l-md 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-gray-500 rounded-md p-2"
|
||||||
|
itemFilter={(label, filterText, option) =>
|
||||||
|
filterDonors(label, filterText, option)}
|
||||||
|
items={runners}
|
||||||
|
showChevron={true}
|
||||||
|
placeholder={$_("search-for-runner-by-name-or-id")}
|
||||||
|
noOptionsMessage={$_("no-runners-found")}
|
||||||
|
on:select={(selectedValue) =>
|
||||||
|
(runner = selectedValue.detail.value.id)}
|
||||||
|
on:clear={() => (runner = null)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
<div class="col-span-6">
|
||||||
|
<label
|
||||||
|
for="donation_amount_eur"
|
||||||
|
class="block text-sm font-medium text-gray-700"
|
||||||
|
>
|
||||||
|
{#if !is_fixed}
|
||||||
|
{$_("amount-per-kilometer")}
|
||||||
|
{:else}{$_("donation-amount")}{/if}</label
|
||||||
|
>
|
||||||
|
<div class="mt-1 flex rounded-md shadow-sm">
|
||||||
|
<input
|
||||||
|
autocomplete="off"
|
||||||
|
class:border-red-500={!is_amount_valid}
|
||||||
|
class:focus:border-red-500={!is_amount_valid}
|
||||||
|
class:focus:ring-red-500={!is_amount_valid}
|
||||||
|
bind:value={amount_input}
|
||||||
|
type="number"
|
||||||
|
step="0.01"
|
||||||
|
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-gray-300 border bg-gray-50 text-gray-500 p-2"
|
||||||
|
placeholder="2.00"
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
class="inline-flex items-center px-3 rounded-r-md border border-gray-300 bg-gray-50 text-gray-500 text-sm"
|
||||||
|
>€</span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
{#if !is_amount_valid}
|
||||||
|
<span
|
||||||
|
class="flex items-center font-medium tracking-wide text-red-500 text-xs mt-1 ml-1"
|
||||||
|
>
|
||||||
|
{$_("donation-amount-must-be-greater-that-0-00eur")}
|
||||||
|
</span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
{#if is_fixed}
|
||||||
|
<div class="col-span-6">
|
||||||
|
<label
|
||||||
|
for="paid"
|
||||||
|
class="block text-sm font-medium text-gray-700"
|
||||||
|
>{$_("already-paid")}</label
|
||||||
|
>
|
||||||
|
<p class="text-gray-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-gray-300 rounded"
|
||||||
|
/>
|
||||||
|
<span class="align-text-bottom">
|
||||||
|
{#if is_paid}
|
||||||
|
{$_("paid")}
|
||||||
|
{:else}
|
||||||
|
{$_("open")}
|
||||||
|
{/if}
|
||||||
|
</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
|
||||||
|
<button
|
||||||
|
disabled={!createbtnenabled}
|
||||||
|
class:opacity-50={!createbtnenabled}
|
||||||
|
on:click={submit}
|
||||||
|
type="button"
|
||||||
|
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm"
|
||||||
|
>
|
||||||
|
{$_("create")}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
on:click={() => {
|
||||||
|
modal_open = false;
|
||||||
|
}}
|
||||||
|
type="button"
|
||||||
|
class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm"
|
||||||
|
>
|
||||||
|
{$_("cancel")}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.toggle:before {
|
.toggle:before {
|
||||||
content: "";
|
content: "";
|
||||||
@ -152,173 +352,3 @@ import { is_promise } from "svelte/internal";
|
|||||||
left: 1.25rem;
|
left: 1.25rem;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
{#if modal_open}
|
|
||||||
<div
|
|
||||||
class="fixed z-10 inset-0 overflow-y-auto"
|
|
||||||
|
|
||||||
use:clickOutside
|
|
||||||
on:click_outside={() => {
|
|
||||||
modal_open = false;
|
|
||||||
}}>
|
|
||||||
<div
|
|
||||||
class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
|
|
||||||
<div class="fixed inset-0 transition-opacity" aria-hidden="true">
|
|
||||||
<div
|
|
||||||
class="absolute inset-0 bg-gray-500 opacity-75"
|
|
||||||
data-id="modal_backdrop" />
|
|
||||||
</div>
|
|
||||||
<span
|
|
||||||
class="hidden sm:inline-block sm:align-middle sm:h-screen"
|
|
||||||
aria-hidden="true">​</span>
|
|
||||||
<div
|
|
||||||
class="inline-block align-bottom bg-white rounded-lg text-left shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full"
|
|
||||||
role="dialog"
|
|
||||||
aria-modal="true"
|
|
||||||
aria-labelledby="modal-headline">
|
|
||||||
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
|
|
||||||
<div class="sm:flex sm:items-start">
|
|
||||||
<div
|
|
||||||
class="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-blue-100 sm:mx-0 sm:h-10 sm:w-10">
|
|
||||||
<svg
|
|
||||||
class="h-6 w-6 text-blue-600"
|
|
||||||
fill="currentColor"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
width="24"
|
|
||||||
height="24"><path fill="none" d="M0 0h24v24H0z" />
|
|
||||||
<path
|
|
||||||
d="M14 2a8 8 0 013.3 15.3A8 8 0 116.7 6.7 8 8 0 0114 2zm-3 7H9v1a2.5 2.5 0 00-.16 5h2.25a.5.5 0 010 1H7v2h2v1h2v-1a2.5 2.5 0 00.16-5H8.91a.5.5 0 010-1H13v-2h-2V9zm3-5a5.99 5.99 0 00-4.48 2.01 8 8 0 018.47 8.47A6 6 0 0014 4z" /></svg>
|
|
||||||
</div>
|
|
||||||
<div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left">
|
|
||||||
<h3 class="text-lg leading-6 font-medium text-gray-900">
|
|
||||||
{#if is_fixed}
|
|
||||||
{$_('create-a-new-fixed-donation')}
|
|
||||||
{:else}{$_('create-a-new-distance-donation')}{/if}
|
|
||||||
</h3>
|
|
||||||
<label class="content-center align-middle object-center">
|
|
||||||
<span
|
|
||||||
class="ml-2 text-base"
|
|
||||||
class:text-gray-300={is_fixed}>{$_('distance-donation')}</span>
|
|
||||||
<input
|
|
||||||
class="toggle relative w-10 h-5 transition-all duration-200 ease-in-out bg-gray-400 rounded-full shadow-inner outline-none appearance-none align-middle"
|
|
||||||
type="checkbox"
|
|
||||||
bind:checked={is_fixed} />
|
|
||||||
<span
|
|
||||||
class="ml-2 text-base "
|
|
||||||
class:text-gray-300={!is_fixed}>{$_('fixed-donation')}</span>
|
|
||||||
</label>
|
|
||||||
<div class="mt-2 mb-6">
|
|
||||||
<p class="text-sm text-gray-500">
|
|
||||||
{$_('please-provide-the-nessecary-information-to-create-a-new-donation')}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div class="grid grid-cols-6 gap-6">
|
|
||||||
<div class="col-span-6">
|
|
||||||
<label
|
|
||||||
for="donor"
|
|
||||||
class="block text-sm font-medium text-gray-700">{$_('donor')}</label>
|
|
||||||
<Select
|
|
||||||
containerClasses="rounded-l-md 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-gray-500 rounded-md p-2"
|
|
||||||
itemFilter={(label, filterText, option) => filterDonors(label, filterText, option)}
|
|
||||||
items={donors}
|
|
||||||
showChevron={true}
|
|
||||||
placeholder={$_('search-for-donor-name-or-id')}
|
|
||||||
noOptionsMessage={$_('no-donors-found')}
|
|
||||||
on:select={(selectedValue) => (donor = selectedValue.detail.value.id)}
|
|
||||||
on:clear={() => (donors = null)} />
|
|
||||||
</div>
|
|
||||||
{#if !is_fixed}
|
|
||||||
<div class="col-span-6">
|
|
||||||
<label
|
|
||||||
for="donor"
|
|
||||||
class="block text-sm font-medium text-gray-700">{$_('runner')}</label>
|
|
||||||
<Select
|
|
||||||
containerClasses="rounded-l-md 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-gray-500 rounded-md p-2"
|
|
||||||
itemFilter={(label, filterText, option) => filterDonors(label, filterText, option)}
|
|
||||||
items={runners}
|
|
||||||
showChevron={true}
|
|
||||||
placeholder={$_('search-for-runner-by-name-or-id')}
|
|
||||||
noOptionsMessage={$_('no-runners-found')}
|
|
||||||
on:select={(selectedValue) => (runner = selectedValue.detail.value.id)}
|
|
||||||
on:clear={() => (runner = null)} />
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
<div class="col-span-6">
|
|
||||||
<label
|
|
||||||
for="donation_amount_eur"
|
|
||||||
class="block text-sm font-medium text-gray-700">
|
|
||||||
{#if !is_fixed}
|
|
||||||
{$_('amount-per-kilometer')}
|
|
||||||
{:else}{$_('donation-amount')}{/if}</label>
|
|
||||||
<div class="mt-1 flex rounded-md shadow-sm">
|
|
||||||
<input
|
|
||||||
autocomplete="off"
|
|
||||||
class:border-red-500={!is_amount_valid}
|
|
||||||
class:focus:border-red-500={!is_amount_valid}
|
|
||||||
class:focus:ring-red-500={!is_amount_valid}
|
|
||||||
bind:value={amount_input}
|
|
||||||
type="number"
|
|
||||||
step="0.01"
|
|
||||||
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-gray-300 border bg-gray-50 text-gray-500 p-2"
|
|
||||||
placeholder="2.00" />
|
|
||||||
<span
|
|
||||||
class="inline-flex items-center px-3 rounded-r-md border border-gray-300 bg-gray-50 text-gray-500 text-sm">€</span>
|
|
||||||
</div>
|
|
||||||
{#if !is_amount_valid}
|
|
||||||
<span
|
|
||||||
class="flex items-center font-medium tracking-wide text-red-500 text-xs mt-1 ml-1">
|
|
||||||
{$_('donation-amount-must-be-greater-that-0-00eur')}
|
|
||||||
</span>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
{#if is_fixed}
|
|
||||||
<div class="col-span-6">
|
|
||||||
<label
|
|
||||||
for="paid"
|
|
||||||
class="block text-sm font-medium text-gray-700">{$_('already-paid')}</label>
|
|
||||||
<p class="text-gray-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-gray-300 rounded" >
|
|
||||||
<span class="align-text-bottom">
|
|
||||||
|
|
||||||
{#if is_paid}
|
|
||||||
{$_('paid')}
|
|
||||||
{:else}
|
|
||||||
{$_('open')}
|
|
||||||
{/if}
|
|
||||||
</span>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
|
|
||||||
<button
|
|
||||||
disabled={!createbtnenabled}
|
|
||||||
class:opacity-50={!createbtnenabled}
|
|
||||||
on:click={submit}
|
|
||||||
type="button"
|
|
||||||
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm">
|
|
||||||
{$_('create')}
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
on:click={() => {
|
|
||||||
modal_open = false;
|
|
||||||
}}
|
|
||||||
type="button"
|
|
||||||
class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm">
|
|
||||||
{$_('cancel')}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
|
@ -4,16 +4,18 @@
|
|||||||
|
|
||||||
import { DonationService } from "@odit/lfk-client-js";
|
import { DonationService } from "@odit/lfk-client-js";
|
||||||
import Toastify from "toastify-js";
|
import Toastify from "toastify-js";
|
||||||
|
import { createEventDispatcher } from "svelte";
|
||||||
export let payment_modal_open = false;
|
export let payment_modal_open = false;
|
||||||
export let current_donations = [];
|
|
||||||
export let editable = {};
|
|
||||||
export let original_data = {};
|
export let original_data = {};
|
||||||
export let paid_amount_input = 0;
|
export let paid_amount_input = 0;
|
||||||
|
const dispatch = createEventDispatcher();
|
||||||
$: processed_last_submit = true;
|
$: processed_last_submit = true;
|
||||||
function focus(el) {
|
function focus(el) {
|
||||||
el.focus();
|
el.focus();
|
||||||
}
|
}
|
||||||
$: createbtnenabled = is_paid_amount_valid && !(paid_amount_input*100 == original_data.paidAmount)
|
$: createbtnenabled =
|
||||||
|
is_paid_amount_valid &&
|
||||||
|
!(paid_amount_input * 100 == original_data.paidAmount);
|
||||||
$: is_paid_amount_valid = paid_amount_input > 0;
|
$: is_paid_amount_valid = paid_amount_input > 0;
|
||||||
(() => {
|
(() => {
|
||||||
document.onkeydown = (e) => {
|
document.onkeydown = (e) => {
|
||||||
@ -33,27 +35,27 @@
|
|||||||
if (processed_last_submit === true) {
|
if (processed_last_submit === true) {
|
||||||
processed_last_submit = false;
|
processed_last_submit = false;
|
||||||
const toast = Toastify({
|
const toast = Toastify({
|
||||||
text: $_('updating-donation'),
|
text: $_("updating-donation"),
|
||||||
duration: -1,
|
duration: -1,
|
||||||
}).showToast();
|
}).showToast();
|
||||||
|
const editable = Object.assign({}, original_data);
|
||||||
editable.donor = editable.donor.id;
|
editable.donor = editable.donor.id;
|
||||||
editable.paidAmount = paid_amount_input * 100;
|
editable.paidAmount = paid_amount_input * 100;
|
||||||
if (editable.responseType == "DISTANCEDONATION" || editable.runner) {
|
if (editable.responseType == "DISTANCEDONATION" || editable.runner) {
|
||||||
editable.runner = editable.runner.id;
|
editable.runner = editable.runner.id;
|
||||||
DonationService.donationControllerPutDistance(original_data.id, editable)
|
DonationService.donationControllerPutDistance(
|
||||||
|
original_data.id,
|
||||||
|
editable
|
||||||
|
)
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
let id = original_data.id;
|
|
||||||
editable = {};
|
|
||||||
original_data = {};
|
|
||||||
payment_modal_open = false;
|
payment_modal_open = false;
|
||||||
//
|
//
|
||||||
Toastify({
|
Toastify({
|
||||||
text: $_('donation-updated'),
|
text: $_("donation-updated"),
|
||||||
duration: 500,
|
duration: 500,
|
||||||
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
|
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
|
||||||
}).showToast();
|
}).showToast();
|
||||||
current_donations[current_donations.findIndex((c) => c.id === id)] = result;
|
dispatch("created", { donation: response });
|
||||||
current_donations = current_donations;
|
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
//
|
//
|
||||||
@ -63,22 +65,17 @@
|
|||||||
//
|
//
|
||||||
toast.hideToast();
|
toast.hideToast();
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
DonationService.donationControllerPutFixed(original_data.id, editable)
|
DonationService.donationControllerPutFixed(original_data.id, editable)
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
let id = original_data.id;
|
|
||||||
editable = {};
|
|
||||||
original_data = {};
|
|
||||||
payment_modal_open = false;
|
payment_modal_open = false;
|
||||||
//
|
//
|
||||||
Toastify({
|
Toastify({
|
||||||
text: $_('donation-updated'),
|
text: $_("donation-updated"),
|
||||||
duration: 500,
|
duration: 500,
|
||||||
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
|
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
|
||||||
}).showToast();
|
}).showToast();
|
||||||
current_donations[current_donations.findIndex((c) => c.id === id)] = result;
|
dispatch("created", { donation: response });
|
||||||
current_donations = current_donations;
|
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
//
|
//
|
||||||
@ -96,56 +93,70 @@
|
|||||||
{#if payment_modal_open}
|
{#if payment_modal_open}
|
||||||
<div
|
<div
|
||||||
class="fixed z-10 inset-0 overflow-y-auto"
|
class="fixed z-10 inset-0 overflow-y-auto"
|
||||||
|
|
||||||
use:clickOutside
|
use:clickOutside
|
||||||
on:click_outside={() => {
|
on:click_outside={() => {
|
||||||
payment_modal_open = false;
|
payment_modal_open = false;
|
||||||
}}>
|
}}
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
|
class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0"
|
||||||
|
>
|
||||||
<div class="fixed inset-0 transition-opacity" aria-hidden="true">
|
<div class="fixed inset-0 transition-opacity" aria-hidden="true">
|
||||||
<div
|
<div
|
||||||
class="absolute inset-0 bg-gray-500 opacity-75"
|
class="absolute inset-0 bg-gray-500 opacity-75"
|
||||||
data-id="modal_backdrop" />
|
data-id="modal_backdrop"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<span
|
<span
|
||||||
class="hidden sm:inline-block sm:align-middle sm:h-screen"
|
class="hidden sm:inline-block sm:align-middle sm:h-screen"
|
||||||
aria-hidden="true">​</span>
|
aria-hidden="true">​</span
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
class="inline-block align-bottom bg-white rounded-lg text-left shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full"
|
class="inline-block align-bottom bg-white rounded-lg text-left shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full"
|
||||||
role="dialog"
|
role="dialog"
|
||||||
aria-modal="true"
|
aria-modal="true"
|
||||||
aria-labelledby="modal-headline">
|
aria-labelledby="modal-headline"
|
||||||
|
>
|
||||||
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
|
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
|
||||||
<div class="sm:flex sm:items-start">
|
<div class="sm:flex sm:items-start">
|
||||||
<div
|
<div
|
||||||
class="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-blue-100 sm:mx-0 sm:h-10 sm:w-10">
|
class="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-blue-100 sm:mx-0 sm:h-10 sm:w-10"
|
||||||
|
>
|
||||||
<svg
|
<svg
|
||||||
class="h-6 w-6 text-blue-600"
|
class="h-6 w-6 text-blue-600"
|
||||||
fill="currentColor"
|
fill="currentColor"
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
viewBox="0 0 24 24"
|
viewBox="0 0 24 24"
|
||||||
width="24"
|
width="24"
|
||||||
height="24"><path fill="none" d="M0 0h24v24H0z" />
|
height="24"
|
||||||
|
><path fill="none" d="M0 0h24v24H0z" />
|
||||||
<path
|
<path
|
||||||
fill="currentColor"
|
fill="currentColor"
|
||||||
d="M22 10v10a1 1 0 01-1 1H3a1 1 0 01-1-1V10h20zm0-2H2V4a1 1 0 011-1h18a1 1 0 011 1v4zm-7 8v2h4v-2h-4z" /></svg>
|
d="M22 10v10a1 1 0 01-1 1H3a1 1 0 01-1-1V10h20zm0-2H2V4a1 1 0 011-1h18a1 1 0 011 1v4zm-7 8v2h4v-2h-4z"
|
||||||
|
/></svg
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left">
|
<div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left">
|
||||||
<h3 class="text-lg leading-6 font-medium text-gray-900">
|
<h3 class="text-lg leading-6 font-medium text-gray-900">
|
||||||
{$_('enter-payment')}
|
{$_("enter-payment")}
|
||||||
</h3>
|
</h3>
|
||||||
<div class="mt-2 mb-6">
|
<div class="mt-2 mb-6">
|
||||||
<p class="text-sm text-gray-500">
|
<p class="text-sm text-gray-500">
|
||||||
{$_('you-can-enter-the-donations-paid-amount-manually-or-use-the-max-button-to-use-the-donations-exact-amount')}
|
{$_(
|
||||||
|
"you-can-enter-the-donations-paid-amount-manually-or-use-the-max-button-to-use-the-donations-exact-amount"
|
||||||
|
)}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid grid-cols gap-6">
|
<div class="grid grid-cols gap-6">
|
||||||
<div class="w-full">
|
<div class="w-full">
|
||||||
<label
|
<label
|
||||||
for="token"
|
for="token"
|
||||||
class="block text-sm font-medium text-gray-700">{$_('paid-amount')}</label>
|
class="block text-sm font-medium text-gray-700"
|
||||||
<div class="inline-flex border-gray-300 border rounded-l-md rounded-r-md bg-gray-50 text-gray-500 w-full">
|
>{$_("paid-amount")}</label
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="inline-flex border-gray-300 border rounded-l-md rounded-r-md bg-gray-50 text-gray-500 w-full"
|
||||||
|
>
|
||||||
<input
|
<input
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
class:border-red-500={!is_paid_amount_valid}
|
class:border-red-500={!is_paid_amount_valid}
|
||||||
@ -156,21 +167,27 @@
|
|||||||
step="0.01"
|
step="0.01"
|
||||||
name="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 p-2"
|
class="focus:ring-indigo-500 focus:border-indigo-500 flex-1 block w-full rounded-none rounded-l-md sm:text-sm p-2"
|
||||||
placeholder="2.00" />
|
placeholder="2.00"
|
||||||
|
/>
|
||||||
<button
|
<button
|
||||||
on:click={
|
on:click={() => {
|
||||||
()=>{
|
paid_amount_input = paid_amount_input = (
|
||||||
paid_amount_input=paid_amount_input = (original_data.amount/100).toFixed(2);
|
original_data.amount / 100
|
||||||
}
|
).toFixed(2);
|
||||||
}
|
}}
|
||||||
class="inline-flex items-center p-r-2 text-indigo-300 hover:text-indigo-700 text-sm">MAX</button>
|
class="inline-flex items-center p-r-2 text-indigo-300 hover:text-indigo-700 text-sm"
|
||||||
|
>MAX</button
|
||||||
|
>
|
||||||
<span
|
<span
|
||||||
class="inline-flex items-center px-3 rounded-r-md border border-gray-300 bg-gray-50 text-gray-500 text-sm">€</span>
|
class="inline-flex items-center px-3 rounded-r-md border border-gray-300 bg-gray-50 text-gray-500 text-sm"
|
||||||
|
>€</span
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
{#if !is_paid_amount_valid}
|
{#if !is_paid_amount_valid}
|
||||||
<span
|
<span
|
||||||
class="flex items-center font-medium tracking-wide text-red-500 text-xs mt-1 ml-1">
|
class="flex items-center font-medium tracking-wide text-red-500 text-xs mt-1 ml-1"
|
||||||
{$_('payment-amount-must-be-greater-than-0-00eur')}
|
>
|
||||||
|
{$_("payment-amount-must-be-greater-than-0-00eur")}
|
||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
@ -184,16 +201,18 @@
|
|||||||
class:opacity-50={!createbtnenabled}
|
class:opacity-50={!createbtnenabled}
|
||||||
on:click={submit}
|
on:click={submit}
|
||||||
type="button"
|
type="button"
|
||||||
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm">
|
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm"
|
||||||
{$_('save-changes')}
|
>
|
||||||
|
{$_("save-changes")}
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
payment_modal_open = false;
|
payment_modal_open = false;
|
||||||
}}
|
}}
|
||||||
type="button"
|
type="button"
|
||||||
class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm">
|
class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm"
|
||||||
{$_('cancel')}
|
>
|
||||||
|
{$_("cancel")}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
122
src/components/donations/DeleteDonationModal.svelte
Normal file
122
src/components/donations/DeleteDonationModal.svelte
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
<script>
|
||||||
|
import { _ } from "svelte-i18n";
|
||||||
|
import { clickOutside } from "../base/outsideclick";
|
||||||
|
import { createEventDispatcher, onMount } from "svelte";
|
||||||
|
export let modal_open;
|
||||||
|
export let delete_donation = {
|
||||||
|
id: 0,
|
||||||
|
runner: {
|
||||||
|
firstname: "",
|
||||||
|
lastname: "",
|
||||||
|
},
|
||||||
|
donor: {
|
||||||
|
firstname: "",
|
||||||
|
lastname: "",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const dispatch = createEventDispatcher();
|
||||||
|
onMount(() => {
|
||||||
|
document.onkeydown = (e) => {
|
||||||
|
e = e || window.event;
|
||||||
|
if (e.key === "Escape") {
|
||||||
|
modal_open = false;
|
||||||
|
}
|
||||||
|
if (e.keyCode === 13) {
|
||||||
|
if (createbtnenabled === true) {
|
||||||
|
createbtnenabled = false;
|
||||||
|
submit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
async function submit() {
|
||||||
|
dispatch("delete", { id: delete_donation.id });
|
||||||
|
modal_open = false;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if modal_open}
|
||||||
|
<div
|
||||||
|
class="fixed z-10 inset-0 overflow-y-auto"
|
||||||
|
use:clickOutside
|
||||||
|
on:click_outside={() => {
|
||||||
|
modal_open = false;
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0"
|
||||||
|
>
|
||||||
|
<div class="fixed inset-0 transition-opacity" aria-hidden="true">
|
||||||
|
<div
|
||||||
|
class="absolute inset-0 bg-gray-500 opacity-75"
|
||||||
|
data-id="modal_backdrop"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<span
|
||||||
|
class="hidden sm:inline-block sm:align-middle sm:h-screen"
|
||||||
|
aria-hidden="true">​</span
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="inline-block align-bottom bg-white rounded-lg text-left shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full"
|
||||||
|
role="dialog"
|
||||||
|
aria-modal="true"
|
||||||
|
aria-labelledby="modal-headline"
|
||||||
|
>
|
||||||
|
<div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
|
||||||
|
<div class="sm:flex sm:items-start">
|
||||||
|
<div
|
||||||
|
class="mx-auto flex-shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-blue-100 sm:mx-0 sm:h-10 sm:w-10"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
class="h-6 w-6 text-blue-600"
|
||||||
|
fill="currentColor"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
width="24"
|
||||||
|
height="24"
|
||||||
|
><path fill="none" d="M0 0h24v24H0z" />
|
||||||
|
<path
|
||||||
|
d="M14 2a8 8 0 013.3 15.3A8 8 0 116.7 6.7 8 8 0 0114 2zm-3 7H9v1a2.5 2.5 0 00-.16 5h2.25a.5.5 0 010 1H7v2h2v1h2v-1a2.5 2.5 0 00.16-5H8.91a.5.5 0 010-1H13v-2h-2V9zm3-5a5.99 5.99 0 00-4.48 2.01 8 8 0 018.47 8.47A6 6 0 0014 4z"
|
||||||
|
/></svg
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div class="mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left">
|
||||||
|
<h3 class="text-lg leading-6 font-medium text-gray-900">
|
||||||
|
{$_("confirm-delete")}
|
||||||
|
</h3>
|
||||||
|
<div class="mt-2 mb-6">
|
||||||
|
<p class="text-sm text-gray-500">
|
||||||
|
{$_("please-confirm-the-deletion-of-donation")}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="w-full">
|
||||||
|
<span class="inline-block"
|
||||||
|
><b>{$_("donor")}</b>: {delete_donation.donor.firstname}
|
||||||
|
{delete_donation.donor.lastname}</span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
|
||||||
|
<button
|
||||||
|
on:click={submit}
|
||||||
|
type="button"
|
||||||
|
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm"
|
||||||
|
>
|
||||||
|
{$_("delete")}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
on:click={() => {
|
||||||
|
modal_open = false;
|
||||||
|
}}
|
||||||
|
type="button"
|
||||||
|
class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm"
|
||||||
|
>
|
||||||
|
{$_("cancel")}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
18
src/components/donations/DonationDonor.svelte
Normal file
18
src/components/donations/DonationDonor.svelte
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<script>
|
||||||
|
import { _ } from "svelte-i18n";
|
||||||
|
export let donor;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if !donor || donor.firstname == 0}
|
||||||
|
{$_("donor-has-no-associated-donations")}
|
||||||
|
{:else}
|
||||||
|
<div class="flex items-center">
|
||||||
|
<a
|
||||||
|
href="../donors/{donor.id}"
|
||||||
|
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-gray-100 text-gray-800"
|
||||||
|
>{donor.firstname}
|
||||||
|
{#if donor.middlename}{donor.middlename}{/if}
|
||||||
|
{donor.lastname}</a
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
{/if}
|
18
src/components/donations/DonationRunner.svelte
Normal file
18
src/components/donations/DonationRunner.svelte
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<script>
|
||||||
|
import { _ } from "svelte-i18n";
|
||||||
|
export let runner;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if !runner || runner.firstname == 0}
|
||||||
|
{$_("fixed-donation")}
|
||||||
|
{:else}
|
||||||
|
<div class="text-sm font-medium text-gray-900">
|
||||||
|
<a
|
||||||
|
href="../runners/{runner.id}"
|
||||||
|
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-gray-100 text-gray-800"
|
||||||
|
>{runner.firstname}
|
||||||
|
{#if runner.middlename}{runner.middlename}{/if}
|
||||||
|
{runner.lastname}</a
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
{/if}
|
16
src/components/donations/DonationStatus.svelte
Normal file
16
src/components/donations/DonationStatus.svelte
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<script>
|
||||||
|
import { _ } from "svelte-i18n";
|
||||||
|
export let status;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{#if status == "PAID"}
|
||||||
|
<span
|
||||||
|
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800"
|
||||||
|
>{$_("paid")}</span
|
||||||
|
>
|
||||||
|
{:else}
|
||||||
|
<span
|
||||||
|
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-red-100 text-red-800"
|
||||||
|
>{$_("open")}</span
|
||||||
|
>
|
||||||
|
{/if}
|
21
src/components/donations/DonationTableAction.svelte
Normal file
21
src/components/donations/DonationTableAction.svelte
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<script>
|
||||||
|
import { _ } from "svelte-i18n";
|
||||||
|
import TableActions from "../shared/TableActions.svelte";
|
||||||
|
|
||||||
|
export let detailsLink;
|
||||||
|
export let detailsAction;
|
||||||
|
export let deleteEnabled;
|
||||||
|
export let deleteAction;
|
||||||
|
export let paymentAction;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button
|
||||||
|
on:click={paymentAction}
|
||||||
|
class="text-[#025a21] hover:text-green-900 mr-4">{$_("enter-payment")}</button
|
||||||
|
>
|
||||||
|
<TableActions
|
||||||
|
bind:detailsAction
|
||||||
|
bind:detailsLink
|
||||||
|
bind:deleteAction
|
||||||
|
bind:deleteEnabled
|
||||||
|
/>
|
@ -5,25 +5,33 @@
|
|||||||
import DonationsOverview from "./DonationsOverview.svelte";
|
import DonationsOverview from "./DonationsOverview.svelte";
|
||||||
$: current_donations = [];
|
$: current_donations = [];
|
||||||
export let modal_open = false;
|
export let modal_open = false;
|
||||||
|
let addDonations;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<section class="container p-5">
|
<section class="container p-5">
|
||||||
<span class="mb-1 text-3xl font-extrabold leading-tight">
|
<span class="mb-1 text-3xl font-extrabold leading-tight">
|
||||||
{$_('donations')}
|
{$_("donations")}
|
||||||
{#if store.state.jwtinfo.userdetails.permissions.includes('DONATION:CREATE')}
|
{#if store.state.jwtinfo.userdetails.permissions.includes("DONATION:CREATE")}
|
||||||
<button
|
<button
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
modal_open = true;
|
modal_open = true;
|
||||||
}}
|
}}
|
||||||
type="button"
|
type="button"
|
||||||
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm">
|
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm"
|
||||||
{$_('add-donation')}
|
>
|
||||||
|
{$_("add-donation")}
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
</span>
|
</span>
|
||||||
<DonationsOverview bind:current_donations />
|
<DonationsOverview bind:current_donations bind:addDonations />
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{#if store.state.jwtinfo.userdetails.permissions.includes('DONATION:CREATE')}
|
{#if store.state.jwtinfo.userdetails.permissions.includes("DONATION:CREATE")}
|
||||||
<AddDonationModal bind:current_donations bind:modal_open />
|
<AddDonationModal
|
||||||
|
on:created={(event) => {
|
||||||
|
console.log(event)
|
||||||
|
addDonations(event.detail.donations);
|
||||||
|
}}
|
||||||
|
bind:modal_open
|
||||||
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -1,31 +1,166 @@
|
|||||||
<script>
|
<script>
|
||||||
import { getLocaleFromNavigator, _ } from "svelte-i18n";
|
import { _ } from "svelte-i18n";
|
||||||
import { DonationService, DonorService } from "@odit/lfk-client-js";
|
import { DonationService } from "@odit/lfk-client-js";
|
||||||
import store from "../../store";
|
import store from "../../store";
|
||||||
import Toastify from "toastify-js";
|
|
||||||
import DonationsEmptyState from "./DonationsEmptyState.svelte";
|
import DonationsEmptyState from "./DonationsEmptyState.svelte";
|
||||||
import AddDonationPaymentModal from "./AddDonationPaymentModal.svelte";
|
import AddDonationPaymentModal from "./AddDonationPaymentModal.svelte";
|
||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
|
import {
|
||||||
|
createSvelteTable,
|
||||||
|
flexRender,
|
||||||
|
getCoreRowModel,
|
||||||
|
getFilteredRowModel,
|
||||||
|
getPaginationRowModel,
|
||||||
|
getSortedRowModel,
|
||||||
|
renderComponent,
|
||||||
|
} from "@tanstack/svelte-table";
|
||||||
|
import { writable } from "svelte/store";
|
||||||
|
import TableBottom from "../shared/TableBottom.svelte";
|
||||||
|
import InputElement from "../shared/InputElement.svelte";
|
||||||
|
import TableHeader from "../shared/TableHeader.svelte";
|
||||||
|
import DonationDonor from "./DonationDonor.svelte";
|
||||||
|
import DonationRunner from "./DonationRunner.svelte";
|
||||||
|
import DonationStatus from "./DonationStatus.svelte";
|
||||||
|
import DonationTableAction from "./DonationTableAction.svelte";
|
||||||
|
import DeleteDonationModal from "./DeleteDonationModal.svelte";
|
||||||
$: searchvalue = "";
|
$: searchvalue = "";
|
||||||
$: active_deletes = [];
|
$: active_deletes = [];
|
||||||
|
$: active_edits = [];
|
||||||
|
$: selectedDonations =
|
||||||
|
$table?.getSelectedRowModel().rows.map((row) => row.original) || [];
|
||||||
|
$: selected =
|
||||||
|
$table?.getSelectedRowModel().rows.map((row) => row.index) || [];
|
||||||
$: dataLoaded = false;
|
$: dataLoaded = false;
|
||||||
export let current_donations = [];
|
|
||||||
export let payment_modal_open = false;
|
|
||||||
export let editable = {};
|
|
||||||
export let original_data = {};
|
|
||||||
export let paid_amount_input = 0;
|
|
||||||
|
|
||||||
function should_display_based_on_id(id) {
|
export let current_donations = [];
|
||||||
if (searchvalue.toString().slice(-1) === "*") {
|
export const addDonations = (donations) => {
|
||||||
return id.toString().startsWith(searchvalue.replace("*", ""));
|
current_donations = current_donations.concat(...donations);
|
||||||
|
options.update((options) => ({
|
||||||
|
...options,
|
||||||
|
data: current_donations,
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
//Section table
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
accessorKey: "id",
|
||||||
|
header: () => "id",
|
||||||
|
filterFn: `equalsString`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "donor",
|
||||||
|
header: () => $_("donor"),
|
||||||
|
cell: (info) => {
|
||||||
|
return renderComponent(DonationDonor, { donor: info.getValue() });
|
||||||
|
},
|
||||||
|
filterFn: `includesString`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "runner",
|
||||||
|
header: () => $_("runner"),
|
||||||
|
cell: (info) => {
|
||||||
|
return renderComponent(DonationRunner, { runner: info.getValue() });
|
||||||
|
},
|
||||||
|
filterFn: `includesString`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "amountPerDistance",
|
||||||
|
header: () => $_("amount-per-kilometer"),
|
||||||
|
cell: (info) => {
|
||||||
|
if (!info.getValue()) {
|
||||||
|
return $_("fixed-donation");
|
||||||
}
|
}
|
||||||
return id.toString() === searchvalue;
|
return `${(info.getValue() / 100)
|
||||||
}
|
.toFixed(2)
|
||||||
function open_payment_modal(donation) {
|
.toLocaleString("de-DE", { valute: "EUR" })} €`;
|
||||||
editable = Object.assign({}, donation);
|
},
|
||||||
original_data = Object.assign({}, donation);
|
enableColumnFilter: false,
|
||||||
paid_amount_input = (donation.paidAmount / 100).toFixed(2);
|
},
|
||||||
payment_modal_open = true;
|
{
|
||||||
|
accessorKey: "amount",
|
||||||
|
header: () => $_("donation-amount"),
|
||||||
|
cell: (info) => {
|
||||||
|
return `${(info.getValue() / 100)
|
||||||
|
.toFixed(2)
|
||||||
|
.toLocaleString("de-DE", { valute: "EUR" })} €`;
|
||||||
|
},
|
||||||
|
enableColumnFilter: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "paidAmount",
|
||||||
|
header: () => $_("total-paid-amount"),
|
||||||
|
cell: (info) => {
|
||||||
|
return `${(info.getValue() / 100)
|
||||||
|
.toFixed(2)
|
||||||
|
.toLocaleString("de-DE", { valute: "EUR" })} €`;
|
||||||
|
},
|
||||||
|
enableColumnFilter: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "status",
|
||||||
|
header: () => $_("status"),
|
||||||
|
cell: (info) => {
|
||||||
|
return renderComponent(DonationStatus, { status: info.getValue() });
|
||||||
|
},
|
||||||
|
enableColumnFilter: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: "actions",
|
||||||
|
header: () => $_("action"),
|
||||||
|
cell: (info) => {
|
||||||
|
return renderComponent(DonationTableAction, {
|
||||||
|
detailsLink: `./${info.row.original.id}`,
|
||||||
|
deleteAction: () => {
|
||||||
|
active_deletes = current_donations.filter(
|
||||||
|
(r) => r.id == info.row.original.id
|
||||||
|
);
|
||||||
|
},
|
||||||
|
paymentAction: () => {
|
||||||
|
active_edits = current_donations.filter(
|
||||||
|
(r) => r.id == info.row.original.id
|
||||||
|
);
|
||||||
|
},
|
||||||
|
deleteEnabled:
|
||||||
|
store.state.jwtinfo.userdetails.permissions.includes(
|
||||||
|
"DONATION:DELETE"
|
||||||
|
),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
enableColumnFilter: false,
|
||||||
|
enableSorting: false,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
const options = writable({
|
||||||
|
data: [],
|
||||||
|
columns: columns,
|
||||||
|
initialState: {
|
||||||
|
pagination: {
|
||||||
|
pageSize: 50,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
enableRowSelection: true,
|
||||||
|
getCoreRowModel: getCoreRowModel(),
|
||||||
|
getFilteredRowModel: getFilteredRowModel(),
|
||||||
|
getPaginationRowModel: getPaginationRowModel(),
|
||||||
|
getSortedRowModel: getSortedRowModel(),
|
||||||
|
});
|
||||||
|
const table = createSvelteTable(options);
|
||||||
|
|
||||||
|
async function deleteDonation(delete_donation_id) {
|
||||||
|
await DonationService.donationControllerRemove(delete_donation_id, true);
|
||||||
|
current_donations = current_donations.filter(
|
||||||
|
(r) => r.id !== delete_donation_id
|
||||||
|
);
|
||||||
|
options.update((options) => ({
|
||||||
|
...options,
|
||||||
|
data: current_donations,
|
||||||
|
}));
|
||||||
|
Toastify({
|
||||||
|
text: $_("donation-deleted"),
|
||||||
|
duration: 3500,
|
||||||
|
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
|
||||||
|
}).showToast();
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
@ -40,6 +175,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
current_donations = current_donations.concat(...donations);
|
current_donations = current_donations.concat(...donations);
|
||||||
|
options.update((options) => ({
|
||||||
|
...options,
|
||||||
|
data: current_donations,
|
||||||
|
}));
|
||||||
|
|
||||||
dataLoaded = true;
|
dataLoaded = true;
|
||||||
page++;
|
page++;
|
||||||
@ -49,11 +188,25 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<AddDonationPaymentModal
|
<AddDonationPaymentModal
|
||||||
bind:current_donations
|
original_data={active_edits[0]}
|
||||||
bind:original_data
|
payment_modal_open={active_edits.length > 0}
|
||||||
bind:editable
|
paid_amount_input={(active_edits[0]?.paidAmount || 0) / 100}
|
||||||
bind:paid_amount_input
|
on:created={(event) => {
|
||||||
bind:payment_modal_open
|
current_donations[
|
||||||
|
current_donations.findIndex((d) => d.id === event.detail.donation.id)
|
||||||
|
].paidAmount = event.detail.donation.paidAmount;
|
||||||
|
options.update((options) => ({
|
||||||
|
...options,
|
||||||
|
data: current_donations,
|
||||||
|
}));
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<DeleteDonationModal
|
||||||
|
delete_donation={active_deletes[0]}
|
||||||
|
modal_open={active_deletes.length > 0}
|
||||||
|
on:delete={(event) => {
|
||||||
|
deleteDonation(event.detail.id);
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
{#if store.state.jwtinfo.userdetails.permissions.includes("DONATION:GET")}
|
{#if store.state.jwtinfo.userdetails.permissions.includes("DONATION:GET")}
|
||||||
{#if !dataLoaded}
|
{#if !dataLoaded}
|
||||||
@ -61,7 +214,7 @@
|
|||||||
class="bg-teal-lightest border-t-4 border-teal rounded-b text-teal-darkest px-4 py-3 shadow-md my-2"
|
class="bg-teal-lightest border-t-4 border-teal rounded-b text-teal-darkest px-4 py-3 shadow-md my-2"
|
||||||
role="alert"
|
role="alert"
|
||||||
>
|
>
|
||||||
<p class="font-bold">donations are being loaded</p>
|
<p class="font-bold">{$_("donations-are-being-loaded")}</p>
|
||||||
<p class="text-sm">{$_("this-might-take-a-moment")}</p>
|
<p class="text-sm">{$_("this-might-take-a-moment")}</p>
|
||||||
</div>
|
</div>
|
||||||
{:else if current_donations.length === 0}
|
{:else if current_donations.length === 0}
|
||||||
@ -77,197 +230,50 @@
|
|||||||
<div
|
<div
|
||||||
class="shadow border-b border-gray-200 sm:rounded-lg overflow-x-scroll"
|
class="shadow border-b border-gray-200 sm:rounded-lg overflow-x-scroll"
|
||||||
>
|
>
|
||||||
<table class="divide-y divide-gray-200 w-full">
|
<table class="w-full">
|
||||||
<thead class="bg-gray-50">
|
<thead>
|
||||||
<tr>
|
{#each $table.getHeaderGroups() as headerGroup}
|
||||||
<th
|
<tr class="select-none">
|
||||||
scope="col"
|
<th class="inset-y-0 left-0 px-4 py-2 text-left w-px">
|
||||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"
|
<InputElement
|
||||||
>
|
type="checkbox"
|
||||||
{$_("donor")}
|
checked={$table.getIsAllRowsSelected()}
|
||||||
</th>
|
indeterminate={$table.getIsSomeRowsSelected()}
|
||||||
<th
|
on:change={() => $table.toggleAllRowsSelected()}
|
||||||
scope="col"
|
/>
|
||||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"
|
|
||||||
>
|
|
||||||
{$_("runner")}
|
|
||||||
</th>
|
|
||||||
<th
|
|
||||||
scope="col"
|
|
||||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"
|
|
||||||
>
|
|
||||||
{$_("amount-per-kilometer")}
|
|
||||||
</th>
|
|
||||||
<th
|
|
||||||
scope="col"
|
|
||||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"
|
|
||||||
>
|
|
||||||
{$_("donation-amount")}
|
|
||||||
</th>
|
|
||||||
<th
|
|
||||||
scope="col"
|
|
||||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"
|
|
||||||
>
|
|
||||||
{$_("paid-amount")}
|
|
||||||
</th>
|
|
||||||
<th
|
|
||||||
scope="col"
|
|
||||||
class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider"
|
|
||||||
>
|
|
||||||
{$_("status")}
|
|
||||||
</th>
|
|
||||||
<th scope="col" class="relative px-6 py-3">
|
|
||||||
<span class="sr-only">{$_("action")}</span>
|
|
||||||
</th>
|
</th>
|
||||||
|
{#each headerGroup.headers as header}
|
||||||
|
<TableHeader {header} />
|
||||||
|
{/each}
|
||||||
</tr>
|
</tr>
|
||||||
|
{/each}
|
||||||
</thead>
|
</thead>
|
||||||
<tbody class="divide-y divide-gray-200">
|
<tbody>
|
||||||
{#each current_donations as donation}
|
{#each $table.getRowModel().rows as row}
|
||||||
{#if donation.donor.firstname
|
<tr>
|
||||||
.toLowerCase()
|
<td class="inset-y-0 left-0 px-4 py-2 text-center w-px">
|
||||||
.includes(searchvalue.toLowerCase()) || donation.donor.lastname
|
<InputElement
|
||||||
.toLowerCase()
|
type="checkbox"
|
||||||
.includes(searchvalue.toLowerCase()) || donation.runner?.firstname
|
checked={row.getIsSelected()}
|
||||||
.toLowerCase()
|
on:change={() => row.toggleSelected()}
|
||||||
.includes(searchvalue.toLowerCase()) || donation.runner?.lastname
|
/>
|
||||||
.toLowerCase()
|
|
||||||
.includes(searchvalue.toLowerCase()) || should_display_based_on_id(donation.id)}
|
|
||||||
<tr data-rowid="donation_{donation.id}">
|
|
||||||
<td class="px-6 py-4 whitespace-nowrap">
|
|
||||||
<div class="flex items-center">
|
|
||||||
<a
|
|
||||||
href="../donors/{donation.donor.id}"
|
|
||||||
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-gray-100 text-gray-800"
|
|
||||||
>{donation.donor.firstname}
|
|
||||||
{donation.donor.middlename || ""}
|
|
||||||
{donation.donor.lastname}</a
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4 whitespace-nowrap">
|
{#each row.getVisibleCells() as cell}
|
||||||
{#if donation.runner}
|
<td>
|
||||||
<div class="text-sm font-medium text-gray-900">
|
<svelte:component
|
||||||
<a
|
this={flexRender(
|
||||||
href="../runners/{donation.runner.id}"
|
cell.column.columnDef.cell,
|
||||||
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-gray-100 text-gray-800"
|
cell.getContext()
|
||||||
>{donation.runner.firstname}
|
)}
|
||||||
{donation.runner.middlename || ""}
|
/>
|
||||||
{donation.runner.lastname}</a
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
{:else}
|
|
||||||
<div class="text-sm font-medium text-gray-900">
|
|
||||||
{$_("fixed-donation")}
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4 whitespace-nowrap">
|
{/each}
|
||||||
{#if donation.amountPerDistance}
|
|
||||||
<div class="text-sm font-medium text-gray-900">
|
|
||||||
{(donation.amountPerDistance / 100)
|
|
||||||
.toFixed(2)
|
|
||||||
.toLocaleString("de-DE", { valute: "EUR" })}€
|
|
||||||
</div>
|
|
||||||
{:else}
|
|
||||||
<div class="text-sm font-medium text-gray-900">
|
|
||||||
{$_("fixed-donation")}
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</td>
|
|
||||||
<td class="px-6 py-4 whitespace-nowrap">
|
|
||||||
<div class="text-sm font-medium text-gray-900">
|
|
||||||
{(donation.amount / 100)
|
|
||||||
.toFixed(2)
|
|
||||||
.toLocaleString("de-DE", { valute: "EUR" })}€
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td class="px-6 py-4 whitespace-nowrap">
|
|
||||||
<div class="text-sm font-medium text-gray-900">
|
|
||||||
{(donation.paidAmount / 100)
|
|
||||||
.toFixed(2)
|
|
||||||
.toLocaleString("de-DE", { valute: "EUR" })}€
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
<td class="px-6 py-4 whitespace-nowrap">
|
|
||||||
{#if donation.status == "PAID"}
|
|
||||||
<span
|
|
||||||
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800"
|
|
||||||
>{$_("paid")}</span
|
|
||||||
>
|
|
||||||
{:else}
|
|
||||||
<span
|
|
||||||
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-red-100 text-red-800"
|
|
||||||
>{$_("open")}</span
|
|
||||||
>
|
|
||||||
{/if}
|
|
||||||
</td>
|
|
||||||
{#if active_deletes[donation.id] === true}
|
|
||||||
<td
|
|
||||||
class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium"
|
|
||||||
>
|
|
||||||
<button
|
|
||||||
on:click={() => {
|
|
||||||
active_deletes[donation.id] = false;
|
|
||||||
}}
|
|
||||||
tabindex="0"
|
|
||||||
class="ml-4 text-indigo-600 hover:text-indigo-900 cursor-pointer"
|
|
||||||
>{$_("cancel-delete")}</button
|
|
||||||
>
|
|
||||||
<button
|
|
||||||
on:click={() => {
|
|
||||||
DonationService.donationControllerRemove(
|
|
||||||
donation.id,
|
|
||||||
false
|
|
||||||
).then((resp) => {
|
|
||||||
current_donations = current_donations.filter(
|
|
||||||
(obj) => obj.id !== donation.id
|
|
||||||
);
|
|
||||||
Toastify({
|
|
||||||
text: $_("donation-deleted"),
|
|
||||||
duration: 500,
|
|
||||||
backgroundColor:
|
|
||||||
"linear-gradient(to right, #00b09b, #96c93d)",
|
|
||||||
}).showToast();
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
tabindex="0"
|
|
||||||
class="ml-4 text-red-600 hover:text-red-900 cursor-pointer"
|
|
||||||
>{$_("confirm-delete")}</button
|
|
||||||
>
|
|
||||||
</td>
|
|
||||||
{:else}
|
|
||||||
<td
|
|
||||||
class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium"
|
|
||||||
>
|
|
||||||
<button
|
|
||||||
on:click={() => {
|
|
||||||
open_payment_modal(donation);
|
|
||||||
}}
|
|
||||||
class="text-[#025a21] hover:text-green-900 mr-4"
|
|
||||||
>{$_("enter-payment")}</button
|
|
||||||
>
|
|
||||||
<a
|
|
||||||
href="./{donation.id}"
|
|
||||||
class="text-indigo-600 hover:text-indigo-900"
|
|
||||||
>{$_("details")}</a
|
|
||||||
>
|
|
||||||
{#if store.state.jwtinfo.userdetails.permissions.includes("DONATION:DELETE")}
|
|
||||||
<button
|
|
||||||
on:click={() => {
|
|
||||||
active_deletes[donation.id] = true;
|
|
||||||
}}
|
|
||||||
tabindex="0"
|
|
||||||
class="ml-4 text-red-600 hover:text-red-900 cursor-pointer"
|
|
||||||
>{$_("delete")}</button
|
|
||||||
>
|
|
||||||
{/if}
|
|
||||||
</td>
|
|
||||||
{/if}
|
|
||||||
</tr>
|
</tr>
|
||||||
{/if}
|
|
||||||
{/each}
|
{/each}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="h-2" />
|
||||||
|
<TableBottom {table} {selected} />
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -183,6 +183,7 @@
|
|||||||
"donation-updated": "Sponsoring wurde aktualisiert",
|
"donation-updated": "Sponsoring wurde aktualisiert",
|
||||||
"donation_added": "Sponsoring hinzugefügt",
|
"donation_added": "Sponsoring hinzugefügt",
|
||||||
"donations": "Sponsorings",
|
"donations": "Sponsorings",
|
||||||
|
"donations-are-being-loaded": "Sponsorings werden geladen...",
|
||||||
"donor": "Sponsor:in",
|
"donor": "Sponsor:in",
|
||||||
"donor-added": "Sponsor:in hinzugefügt",
|
"donor-added": "Sponsor:in hinzugefügt",
|
||||||
"donor-deleted": "Sponsor:in gelöscht",
|
"donor-deleted": "Sponsor:in gelöscht",
|
||||||
@ -327,6 +328,7 @@
|
|||||||
"permissions-updated": "Berechtigungen aktualisiert!",
|
"permissions-updated": "Berechtigungen aktualisiert!",
|
||||||
"phone": "Telefon",
|
"phone": "Telefon",
|
||||||
"please-confirm-the-deletion-of-card": "Bitte bestätige die Löschung der Karte",
|
"please-confirm-the-deletion-of-card": "Bitte bestätige die Löschung der Karte",
|
||||||
|
"please-confirm-the-deletion-of-donation": "Bitte bestätige die Löschung des Sponsorings",
|
||||||
"please-confirm-the-deletion-of-runner": "Bitte bestätige die Löschung der Läufer:in",
|
"please-confirm-the-deletion-of-runner": "Bitte bestätige die Löschung der Läufer:in",
|
||||||
"please-confirm-the-deletion-of-scan": "Bitte bestätige die Löschung des Scans",
|
"please-confirm-the-deletion-of-scan": "Bitte bestätige die Löschung des Scans",
|
||||||
"please-copy-the-token-and-store-it-somewhere-save": "Bitte kopiere dir den Token und bewahre ihn gut auf.",
|
"please-copy-the-token-and-store-it-somewhere-save": "Bitte kopiere dir den Token und bewahre ihn gut auf.",
|
||||||
|
@ -183,6 +183,7 @@
|
|||||||
"donation-updated": "Donation updated",
|
"donation-updated": "Donation updated",
|
||||||
"donation_added": "Donation_added",
|
"donation_added": "Donation_added",
|
||||||
"donations": "Donations",
|
"donations": "Donations",
|
||||||
|
"donations-are-being-loaded": "donations are being loaded",
|
||||||
"donor": "Donor",
|
"donor": "Donor",
|
||||||
"donor-added": "Donor added",
|
"donor-added": "Donor added",
|
||||||
"donor-deleted": "donor deleted",
|
"donor-deleted": "donor deleted",
|
||||||
@ -327,6 +328,7 @@
|
|||||||
"permissions-updated": "Permissions updated!",
|
"permissions-updated": "Permissions updated!",
|
||||||
"phone": "Phone",
|
"phone": "Phone",
|
||||||
"please-confirm-the-deletion-of-card": "Please confirm the deletion of this card",
|
"please-confirm-the-deletion-of-card": "Please confirm the deletion of this card",
|
||||||
|
"please-confirm-the-deletion-of-donation": "Please confirm the deletion of this donation",
|
||||||
"please-confirm-the-deletion-of-runner": "Please confirm the deletion of this runner",
|
"please-confirm-the-deletion-of-runner": "Please confirm the deletion of this runner",
|
||||||
"please-confirm-the-deletion-of-scan": "Please confirm the deletion of scan",
|
"please-confirm-the-deletion-of-scan": "Please confirm the deletion of scan",
|
||||||
"please-copy-the-token-and-store-it-somewhere-save": "Please copy the token and store it somewhere safe.",
|
"please-copy-the-token-and-store-it-somewhere-save": "Please copy the token and store it somewhere safe.",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user