Fakultas Ilmu Komputer UI

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

Revert "Merge branch 'PBI-6-Ray' into 'master'"

This reverts commit 0a5a7921, reversing
changes made to 980c3fbe.
parent dd558d18
This diff is collapsed.
...@@ -41,6 +41,7 @@ const TableComponent = ({ ...@@ -41,6 +41,7 @@ const TableComponent = ({
link, link,
argument, argument,
filter, filter,
sort,
}) => { }) => {
const [ const [
results, results,
...@@ -59,7 +60,26 @@ const TableComponent = ({ ...@@ -59,7 +60,26 @@ const TableComponent = ({
handleSubmit: handleSubmitFilter, handleSubmit: handleSubmitFilter,
reset: resetFilter, reset: resetFilter,
} = useForm(); } = 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); const [filterTab, setFilterTab] = useState(false);
if (sort !== "" && sort !== null){
sortResults(sort);
}
return ( return (
<div <div
css={css` css={css`
......
...@@ -25,10 +25,11 @@ const ListPengguna = () => { ...@@ -25,10 +25,11 @@ const ListPengguna = () => {
["full_name", "Nama Lengkap"], ["full_name", "Nama Lengkap"],
["username", "Username"], ["username", "Username"],
["total_transactions", "Jumlah Transaksi"], ["total_transactions", "Jumlah Transaksi"],
["total_program_donations", "Jumlah Donasi"], ["total_program_donations_goods", "Jumlah Donasi Barang"],
["total_program_donations_cash", "Jumlah Donasi Uang"],
], ],
link: "", link: "",
sort: sortBy sort: sortBy,
}; };
const handleClickOpen = () => { 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