Added level export to excel

This commit is contained in:
Joao Ramos
2024-09-05 23:30:03 +01:00
parent a61ad2cc7e
commit e433a150a9
4 changed files with 104 additions and 43 deletions

View File

@@ -18,6 +18,7 @@ import Checkbox from "@/components/Low/Checkbox";
import { useListSearch } from "@/hooks/useListSearch";
import axios from "axios";
import { toast } from "react-toastify";
import Button from "@/components/Low/Button";
interface Props {
corporateUsers: User[];
users: User[];
@@ -207,10 +208,11 @@ const MasterStatistical = (props: Props) => {
}),
];
const { rows: filteredRows, renderSearch, text: searchText } = useListSearch(
searchFilters,
tableResults
);
const {
rows: filteredRows,
renderSearch,
text: searchText,
} = useListSearch(searchFilters, tableResults);
const table = useReactTable({
data: filteredRows,
@@ -240,7 +242,6 @@ const MasterStatistical = (props: Props) => {
);
};
const triggerDownload = async () => {
try {
setDownloading(true);
@@ -267,28 +268,9 @@ const MasterStatistical = (props: Props) => {
}
};
const renderIcon = () => {
if (downloading) {
return (
<span className={`text-mti-gray-dim loading loading-infinity w-6`} />
);
}
return (
<BsFileExcel
className={`text-mti-gray-dim text-2xl cursor-pointer`}
onClick={(e) => {
e.stopPropagation();
triggerDownload();
}}
/>
);
};
const consolidateResults = getStudentsConsolidateScore();
return (
<>
{renderIcon()}
<div className="flex flex-wrap gap-2 items-center text-center">
<IconCard
Icon={BsBank}
@@ -353,6 +335,15 @@ const MasterStatistical = (props: Props) => {
/>
</div>
{renderSearch()}
<div className="flex flex-col gap-3 justify-end">
<Button
className="max-w-[200px] h-[70px]"
variant="outline"
onClick={triggerDownload}
>
Download
</Button>
</div>
</div>
<div>