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
Showing only changes of commit 1dbab03fe7 - Show all commits

View File

@ -10,6 +10,7 @@
export let editable = {}; export let editable = {};
export let original_data = {}; export let original_data = {};
export let amount_input = 0; export let amount_input = 0;
$:processed_last_submit=true;
function focus(el) { function focus(el) {
el.focus(); el.focus();
} }
@ -36,7 +37,9 @@
text: "Updating Donation", text: "Updating Donation",
duration: -1, duration: -1,
}).showToast(); }).showToast();
if(editable.responseType == "DISTANCEDONATION" ){ editable.donor = editable.donor.id;
editable.paidAmount = amount_input*100;
if(editable.responseType == "DISTANCEDONATION" || editable.runner){
DonationService.donationControllerPutDistance(original_data.id, editable) DonationService.donationControllerPutDistance(original_data.id, editable)
.then((result) => { .then((result) => {
let id = original_data.id; let id = original_data.id;
@ -60,7 +63,6 @@
// //
toast.hideToast(); toast.hideToast();
}); });
}
} }
else{ else{
DonationService.donationControllerPutFixed(original_data.id, editable) DonationService.donationControllerPutFixed(original_data.id, editable)
@ -88,6 +90,7 @@
}); });
} }
} }
}
</script> </script>
{#if payment_modal_open} {#if payment_modal_open}
@ -137,12 +140,12 @@
You can update the donation's paid amount manually or use the TODO button to use the donation's exact amount. You can update the donation's paid amount manually or use the TODO button to use the donation's exact amount.
</p> </p>
</div> </div>
<div class="grid grid-cols-6 gap-6"> <div class="grid grid-cols gap-6">
<div class="col-span-6"> <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">Paid amount</label>
<div class="inline-flex"> <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_amount_valid} class:border-red-500={!is_amount_valid}
@ -152,8 +155,15 @@
type="number" type="number"
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 border-gray-300 border bg-gray-50 text-gray-500 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
on:click={
()=>{
amount_input=amount_input = (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>
<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>
@ -163,18 +173,6 @@
Payment amount must be greater than 0.00€ Payment amount must be greater than 0.00€
</span> </span>
{/if} {/if}
<div
class="bg-gray-200 border-gray-300 border-t border-b border-r text-black rounded-r-md sm:text-sm p-2 mt-1 cursor-pointer">
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
width="24"
height="24"><path fill="none" d="M0 0h24v24H0z" />
<path
fill="currentColor"
d="M7 4V2h10v2h3l1 1v16a1 1 0 01-1 1H4a1 1 0 01-1-1V5l1-1h3zm0 2H5v14h14V6h-2v2H7V6zm2-2v2h6V4H9z" /></svg>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -200,4 +198,5 @@
</div> </div>
</div> </div>
</div> </div>
</div>
{/if} {/if}