More permissions
This commit is contained in:
@@ -68,7 +68,6 @@ const EXAM_MANAGEMENT: PermissionLayout[] = [
|
|||||||
{ label: "Generate Level", key: "generate_level" },
|
{ label: "Generate Level", key: "generate_level" },
|
||||||
{ label: "Delete Level", key: "delete_level" },
|
{ label: "Delete Level", key: "delete_level" },
|
||||||
{ label: "View Statistics", key: "view_statistics" },
|
{ label: "View Statistics", key: "view_statistics" },
|
||||||
{ label: "Download Statistics Report", key: "download_statistics_report" }
|
|
||||||
]
|
]
|
||||||
|
|
||||||
const CLASSROOM_MANAGEMENT: PermissionLayout[] = [
|
const CLASSROOM_MANAGEMENT: PermissionLayout[] = [
|
||||||
@@ -93,6 +92,7 @@ const ENTITY_MANAGEMENT: PermissionLayout[] = [
|
|||||||
{ label: "Edit Role Permissions", key: "edit_role_permissions" },
|
{ label: "Edit Role Permissions", key: "edit_role_permissions" },
|
||||||
{ label: "Assign Role to User", key: "assign_to_role" },
|
{ label: "Assign Role to User", key: "assign_to_role" },
|
||||||
{ label: "Delete Entity Role", key: "delete_entity_role" },
|
{ label: "Delete Entity Role", key: "delete_entity_role" },
|
||||||
|
{ label: "Download Statistics Report", key: "download_statistics_report" }
|
||||||
]
|
]
|
||||||
|
|
||||||
const ASSIGNMENT_MANAGEMENT: PermissionLayout[] = [
|
const ASSIGNMENT_MANAGEMENT: PermissionLayout[] = [
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import Layout from "@/components/High/Layout";
|
|||||||
import Table from "@/components/High/Table";
|
import Table from "@/components/High/Table";
|
||||||
import Checkbox from "@/components/Low/Checkbox";
|
import Checkbox from "@/components/Low/Checkbox";
|
||||||
import Separator from "@/components/Low/Separator";
|
import Separator from "@/components/Low/Separator";
|
||||||
|
import { useAllowedEntities } from "@/hooks/useEntityPermissions";
|
||||||
import { Session } from "@/hooks/useSessions";
|
import { Session } from "@/hooks/useSessions";
|
||||||
import { Entity, EntityWithRoles } from "@/interfaces/entity";
|
import { Entity, EntityWithRoles } from "@/interfaces/entity";
|
||||||
import { Exam } from "@/interfaces/exam";
|
import { Exam } from "@/interfaces/exam";
|
||||||
@@ -84,6 +85,8 @@ export default function Statistical({ user, students, entities, assignments, ses
|
|||||||
const [selectedEntities, setSelectedEntities] = useState<string[]>([])
|
const [selectedEntities, setSelectedEntities] = useState<string[]>([])
|
||||||
const [isDownloading, setIsDownloading] = useState(false)
|
const [isDownloading, setIsDownloading] = useState(false)
|
||||||
|
|
||||||
|
const entitiesAllowDownload = useAllowedEntities(user, entities, 'download_statistics_report')
|
||||||
|
|
||||||
const resetDateRange = () => {
|
const resetDateRange = () => {
|
||||||
const orderedAssignments = orderBy(assignments, ['startDate'], ['asc'])
|
const orderedAssignments = orderBy(assignments, ['startDate'], ['asc'])
|
||||||
setStartDate(moment(orderedAssignments.shift()?.startDate || "2024-01-01T00:00:01.986Z").toDate())
|
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}
|
data={sortedData}
|
||||||
searchFields={[["student", "name"], ["student", "email"], ["student", "studentID"], ["exams", "id"], ["assignment", "name"]]}
|
searchFields={[["student", "name"], ["student", "email"], ["student", "studentID"], ["exams", "id"], ["assignment", "name"]]}
|
||||||
searchPlaceholder="Search by student, assignment or exam..."
|
searchPlaceholder="Search by student, assignment or exam..."
|
||||||
onDownload={downloadExcel}
|
onDownload={entitiesAllowDownload.length > 0 ? downloadExcel : undefined}
|
||||||
isDownloadLoading={isDownloading}
|
isDownloadLoading={isDownloading}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user