feat(donoroverview): Added datatable formatters

This commit is contained in:
2023-04-19 16:39:30 +02:00
parent 5014bf5bc5
commit d98fb0d5b2
5 changed files with 1058 additions and 1002 deletions

View File

@@ -20,6 +20,8 @@
import InputElement from "../shared/InputElement.svelte";
import TableHeader from "../shared/TableHeader.svelte";
import TableActions from "../shared/TableActions.svelte";
import DonorAddress from "./DonorAddress.svelte";
import DonorDonations from "./DonorDonations.svelte";
$: searchvalue = "";
$: active_deletes = [];
$: current_donations = [];
@@ -39,16 +41,18 @@
{
accessorKey: "id",
header: () => "id",
cell: (info) => {
return "TODO:";
},
filterFn: `equalsString`,
},
{
accessorKey: "name",
header: () => $_("name"),
cell: (info) => {
return "TODO:";
const d = info.row.original;
if (d.middlename) {
return `${d.firstname} ${d.middlename} ${d.lastname}`;
} else {
return `${d.firstname} ${d.lastname}`;
}
},
filterFn: `includesString`,
},
@@ -56,7 +60,7 @@
accessorKey: "address",
header: () => $_("contact-information"),
cell: (info) => {
return "TODO:";
return renderComponent(DonorAddress, { address: info.getValue() });
},
filterFn: `includesString`,
},
@@ -64,23 +68,30 @@
accessorKey: "sponsorings",
header: () => $_("sponsorings"),
cell: (info) => {
return "TODO:";
const donations = current_donations.filter(
(d) => d?.donor?.id == info.row.original.id
);
return renderComponent(DonorDonations, { donations });
},
filterFn: `includesString`,
},
{
accessorKey: "sponsorings",
accessorKey: "donationAmount",
header: () => $_("total-donation-amount"),
cell: (info) => {
return "TODO:";
return `${(info.getValue() / 100)
.toFixed(2)
.toLocaleString("de-DE", { valute: "EUR" })}€`;
},
filterFn: `group`,
},
{
accessorKey: "sponsorings",
accessorKey: "paidDonationAmount",
header: () => $_("total-paid-amount"),
cell: (info) => {
return "TODO:";
return `${(info.getValue() / 100)
.toFixed(2)
.toLocaleString("de-DE", { valute: "EUR" })}€`;
},
enableColumnFilter: false,
},