From 3d3a10aafb16d371be9471eb5172f9251fb2583f Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Thu, 15 Apr 2021 14:31:24 +0200 Subject: [PATCH] You can now mark fixed donations as already paid on creation ref #133 --- .../donations/AddDonationModal.svelte | 34 ++++++++++++++++--- src/locales/de.json | 4 ++- src/locales/en.json | 4 ++- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/src/components/donations/AddDonationModal.svelte b/src/components/donations/AddDonationModal.svelte index 63e781e3..0ffc7814 100644 --- a/src/components/donations/AddDonationModal.svelte +++ b/src/components/donations/AddDonationModal.svelte @@ -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 @@ @@ -195,7 +201,7 @@ class="ml-2 text-base" class:text-gray-300={is_fixed}>{$_('distance-donation')} {/if} + {#if is_fixed} +
+ +

+ + {#if is_paid} + {$_('paid')} + {:else} + {$_('open')} + {/if} +

+
+ {/if} diff --git a/src/locales/de.json b/src/locales/de.json index 0a5a517a..0f8448f9 100644 --- a/src/locales/de.json +++ b/src/locales/de.json @@ -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" } diff --git a/src/locales/en.json b/src/locales/en.json index 02d36ae5..15262fb9 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -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" }