Fakultas Ilmu Komputer UI

Commit 1f91af42 authored by Wan Muhammad Rayhan Arwindra's avatar Wan Muhammad Rayhan Arwindra 🤸🏽
Browse files

Merge branch 'pbi-9' into 'staging'

Pbi 9

See merge request ppl-fasilkom-ui/itproject-2020/group-b/pilar-web!99
parents dd558d18 cc03fa0c
Pipeline #61194 failed with stages
in 12 minutes and 48 seconds
This diff is collapsed.
......@@ -41,6 +41,7 @@ const TableComponent = ({
link,
argument,
filter,
sort,
}) => {
const [
results,
......@@ -59,7 +60,26 @@ const TableComponent = ({
handleSubmit: handleSubmitFilter,
reset: resetFilter,
} = useForm();
const getCategory = (c) => {
switch (c){
case "transaksi":
return "total_transactions"
case "donasi-barang":
return "total_program_donations_goods"
case "donasi-uang":
return "total_program_donations_cash"
}
}
const sortResults = (s) => {
const category = getCategory(s);
results.sort((a, b) => b[category] - a[category]);
}
const [filterTab, setFilterTab] = useState(false);
if (sort !== "" && sort !== null){
sortResults(sort);
}
return (
<div
css={css`
......
......@@ -25,10 +25,11 @@ const ListPengguna = () => {
["full_name", "Nama Lengkap"],
["username", "Username"],
["total_transactions", "Jumlah Transaksi"],
["total_program_donations", "Jumlah Donasi"],
["total_program_donations_goods", "Jumlah Donasi Barang"],
["total_program_donations_cash", "Jumlah Donasi Uang"],
],
link: "",
sort: sortBy
sort: sortBy,
};
const handleClickOpen = () => {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment