fix(DonorDetail): donor deletion
All checks were successful
Build Latest and dev images / build-container (push) Successful in 1m20s

This commit is contained in:
Philipp Dormann 2025-03-26 15:57:44 +01:00
parent bb2319a78d
commit 5147a20b3c
Signed by: philipp
GPG Key ID: 3BB9ADD52DCA4314

View File

@ -1,12 +1,10 @@
<script>
import { DonorService } from "@odit/lfk-client-js";
import { _ } from "svelte-i18n";
import store from "../../store";
import { DonorService, DonationService } from "@odit/lfk-client-js";
import PromiseError from "../base/PromiseError.svelte";
import isEmail from "validator/es/lib/isEmail";
import ConfirmDonorDeletion from "./ConfirmDonorDeletion.svelte";
import toast from "svelte-french-toast";
import isEmail from "validator/es/lib/isEmail";
import PromiseError from "../base/PromiseError.svelte";
let data_loaded = false;
export let params;
$: delete_triggered = false;
@ -53,8 +51,6 @@
$: isAddress1Valid = editable.address?.address1?.trim().length !== 0;
$: iszipcodevalid = editable.address?.postalcode?.trim().length !== 0;
$: iscityvalid = editable.address?.city?.trim().length !== 0;
let modal_open = false;
let delete_donor = {};
function submit() {
if (data_loaded === true && save_enabled) {
toast($_("donor-is-being-updated"));
@ -79,19 +75,17 @@
}
}
function deleteDonor() {
DonorService.donorControllerRemove(original_data.id, false)
DonorService.donorControllerRemove(original_data.id, true)
.then((resp) => {
toast($_("donor-deleted"));
location.replace("./");
})
.catch((err) => {
modal_open = true;
delete_donor = original_data;
console.log(err);
});
}
</script>
<ConfirmDonorDeletion bind:modal_open bind:delete_donor />
{#await promise}
{$_("loading-donor-details")}
{:then}
@ -101,7 +95,22 @@
<nav class="w-full flex">
<ol class="list-none flex flex-row items-center justify-start">
<li class="flex items-center">
<a class="mr-2" href="./"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="inline-block"><path d="m12 19-7-7 7-7"/><path d="M19 12H5"/></svg> {$_("donors")}</a>
<a class="mr-2" href="./"
><svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="inline-block"
><path d="m12 19-7-7 7-7" /><path d="M19 12H5" /></svg
>
{$_("donors")}</a
>
</li>
</ol>
</nav>
@ -161,7 +170,8 @@
.toLocaleString("de-DE", { valute: "EUR" })}€</span
>
|
<span class="font-semibold text-gray-700">{$_("total-paid-amount")}:</span>
<span class="font-semibold text-gray-700">{$_("total-paid-amount")}:</span
>
<span
>{(editable.paidDonationAmount / 100)
.toFixed(2)
@ -275,7 +285,9 @@
{/if}
</div>
<div class="mt-2 w-full">
<label for="phone" class="font-semibold text-gray-700">{$_("phone")}</label>
<label for="phone" class="font-semibold text-gray-700"
>{$_("phone")}</label
>
<input
autocomplete="off"
placeholder={$_("phone")}