Mark donations as payed feature/133-donation_payments #135

Merged
niggl merged 22 commits from feature/133-donation_payments into dev 2021-04-15 16:29:41 +00:00
3 changed files with 36 additions and 6 deletions
Showing only changes of commit 3d3a10aafb - Show all commits

View File

@ -9,6 +9,7 @@
} from "@odit/lfk-client-js";
import Select from "svelte-select";
import Toastify from "toastify-js";
import { is_promise } from "svelte/internal";
export let modal_open;
export let current_donations;
const getDonorLabel = (option) =>
@ -24,6 +25,7 @@
$: donors = [];
$: runners = [];
$: is_fixed = false;
$: is_paid = false;
DonorService.donorControllerGetAll().then((val) => {
donors = val.map((r) => {
return { label: getDonorLabel(r), value: r };
@ -64,7 +66,11 @@
let postdata = {
donor,
amount: amount_cent,
paidAmount: 0
};
if(is_paid){
postdata.paidAmount = amount_cent;
}
DonationService.donationControllerPostFixed(postdata)
.then((result) => {
donor = donors[0].id || 0;
@ -123,7 +129,7 @@
</script>
<style>
input:before {
.toggle:before {
content: "";
position: absolute;
width: 1.25rem;
@ -137,12 +143,12 @@
transition: 0.2s ease-in-out;
}
input:checked {
.toggle:checked {
/* @apply: bg-indigo-400; */
background-color: #7f9cf5;
}
input:checked:before {
.toggle:checked:before {
left: 1.25rem;
}
</style>
@ -195,7 +201,7 @@
class="ml-2 text-base"
class:text-gray-300={is_fixed}>{$_('distance-donation')}</span>
<input
class="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"
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
@ -267,6 +273,26 @@
</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" >
{#if is_paid}
{$_('paid')}
{:else}
{$_('open')}
{/if}
</p>
</div>
{/if}
</div>
</div>
</div>

View File

@ -436,5 +436,7 @@
"total-paid-amount": "Gezahlter Gesamtbetrag",
"paid-amount": "Gezahlter Betrag",
"paid": "BEZAHLT",
"open": "OFFEN"
"open": "OFFEN",
"already-paid": "Bereits bezahlt",
"unpaid": "Offen"
}

View File

@ -436,5 +436,7 @@
"total-paid-amount": "Total paid amount",
"paid-amount": "Paid amount",
"paid": "PAID",
"open": "OPEN"
"open": "OPEN",
"already-paid": "Already paid",
"unpaid": "Unpaid"
}