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}
<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"
>{$_("fixed-donation")}:
{(d.amount / 100)
{(donation.amount / 100)
.toFixed(2)
.toLocaleString("de-DE", { valute: "EUR" })}€</a
>

View File

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