formatting, full migration to svelte-french-toast

This commit is contained in:
2023-04-26 22:47:42 +02:00
parent 38a665024e
commit 46d076af9d
137 changed files with 11984 additions and 9212 deletions

View File

@@ -1,18 +1,14 @@
<script>
import { _ } from "svelte-i18n";
import { clickOutside } from "../base/outsideclick";
import { DonationService } from "@odit/lfk-client-js";
import Toastify from "toastify-js";
import { createEventDispatcher } from "svelte";
import toast from "svelte-french-toast";
export let payment_modal_open = false;
export let original_data = {};
export let paid_amount_input = 0;
const dispatch = createEventDispatcher();
$: processed_last_submit = true;
function focus(el) {
el.focus();
}
$: createbtnenabled =
is_paid_amount_valid &&
!(paid_amount_input * 100 == original_data.paidAmount);
@@ -34,10 +30,7 @@
function submit() {
if (processed_last_submit === true) {
processed_last_submit = false;
const toast = Toastify({
text: $_("updating-donation"),
duration: -1,
}).showToast();
toast.loading($_("updating-donation"));
const editable = Object.assign({}, original_data);
editable.donor = editable.donor.id;
editable.paidAmount = paid_amount_input * 100;
@@ -50,11 +43,9 @@
.then((result) => {
payment_modal_open = false;
//
Toastify({
text: $_("donation-updated"),
duration: 500,
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
}).showToast();
toast.dismiss();
toast.success($_("donation-updated"));
dispatch("created", { donation: response });
})
.catch((err) => {
@@ -62,19 +53,14 @@
})
.finally(() => {
processed_last_submit = true;
//
toast.hideToast();
});
} else {
DonationService.donationControllerPutFixed(original_data.id, editable)
.then((result) => {
payment_modal_open = false;
//
Toastify({
text: $_("donation-updated"),
duration: 500,
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
}).showToast();
toast.dismiss();
toast.success($_("donation-updated"));
dispatch("created", { donation: response });
})
.catch((err) => {
@@ -82,8 +68,6 @@
})
.finally(() => {
processed_last_submit = true;
//
toast.hideToast();
});
}
}