feat(donations): Resolve donations via donor

This commit is contained in:
Nicolai Ort 2023-04-19 18:15:15 +02:00
parent 5d48060834
commit 6f337aeee1
Signed by: niggl
GPG Key ID: 13AFA55AF62F269F
2 changed files with 5 additions and 14 deletions

View File

@ -17,10 +17,10 @@
> >
{:else} {:else}
<a <a
href="../donations/{d.id}" href="../donations/{donation.id}"
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-700 text-white mr-1" class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-700 text-white mr-1"
>{$_("fixed-donation")}: >{$_("fixed-donation")}:
{(d.amount / 100) {(donation.amount / 100)
.toFixed(2) .toFixed(2)
.toLocaleString("de-DE", { valute: "EUR" })}€</a .toLocaleString("de-DE", { valute: "EUR" })}€</a
> >

View File

@ -25,7 +25,6 @@
import { filterAddress, filterName } from "../shared/tablefilters"; import { filterAddress, filterName } from "../shared/tablefilters";
$: searchvalue = ""; $: searchvalue = "";
$: active_deletes = []; $: active_deletes = [];
$: current_donations = [];
$: selectedDonors = $: selectedDonors =
$table?.getSelectedRowModel().rows.map((row) => row.original) || []; $table?.getSelectedRowModel().rows.map((row) => row.original) || [];
$: selected = $: selected =
@ -71,13 +70,10 @@
filterFn: `address`, filterFn: `address`,
}, },
{ {
accessorKey: "sponsorings", accessorKey: "donations",
header: () => $_("sponsorings"), header: () => $_("sponsorings"),
cell: (info) => { cell: (info) => {
const donations = current_donations.filter( return renderComponent(DonorDonations, { donations: info.getValue() });
(d) => d?.donor?.id == info.row.original.id
);
return renderComponent(DonorDonations, { donations });
}, },
enableColumnFilter: false, enableColumnFilter: false,
}, },
@ -153,16 +149,11 @@
let page = 0; let page = 0;
while (page >= 0) { while (page >= 0) {
const donors = await DonorService.donorControllerGetAll(page, 500); const donors = await DonorService.donorControllerGetAll(page, 500);
const donations = await DonationService.donationControllerGetAll( if (donors.length == 0) {
page,
500
);
if (donors.length == 0 && donations.length == 0) {
page = -2; page = -2;
} }
current_donors = current_donors.concat(...donors); current_donors = current_donors.concat(...donors);
current_donations = current_donations.concat(...donors);
options.update((options) => ({ options.update((options) => ({
...options, ...options,
data: current_donors, data: current_donors,