More permissions
This commit is contained in:
@@ -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}
|
||||
/>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user