More permissions

This commit is contained in:
Tiago Ribeiro
2024-12-02 17:12:23 +00:00
parent 2e5545f181
commit b6f61c6be1
2 changed files with 5 additions and 2 deletions

View File

@@ -3,6 +3,7 @@ import Layout from "@/components/High/Layout";
import Table from "@/components/High/Table";
import Checkbox from "@/components/Low/Checkbox";
import Separator from "@/components/Low/Separator";
import { useAllowedEntities } from "@/hooks/useEntityPermissions";
import { Session } from "@/hooks/useSessions";
import { Entity, EntityWithRoles } from "@/interfaces/entity";
import { Exam } from "@/interfaces/exam";
@@ -84,6 +85,8 @@ export default function Statistical({ user, students, entities, assignments, ses
const [selectedEntities, setSelectedEntities] = useState<string[]>([])
const [isDownloading, setIsDownloading] = useState(false)
const entitiesAllowDownload = useAllowedEntities(user, entities, 'download_statistics_report')
const resetDateRange = () => {
const orderedAssignments = orderBy(assignments, ['startDate'], ['asc'])
setStartDate(moment(orderedAssignments.shift()?.startDate || "2024-01-01T00:00:01.986Z").toDate())
@@ -297,7 +300,7 @@ export default function Statistical({ user, students, entities, assignments, ses
data={sortedData}
searchFields={[["student", "name"], ["student", "email"], ["student", "studentID"], ["exams", "id"], ["assignment", "name"]]}
searchPlaceholder="Search by student, assignment or exam..."
onDownload={downloadExcel}
onDownload={entitiesAllowDownload.length > 0 ? downloadExcel : undefined}
isDownloadLoading={isDownloading}
/>
)}