diff --git a/components/DataGrid/index.tsx b/components/DataGrid/index.tsx index 72e436df..31d1d05d 100644 --- a/components/DataGrid/index.tsx +++ b/components/DataGrid/index.tsx @@ -60,8 +60,23 @@ interface paramsType { getRowId?: (row: any) => string; loading?: boolean; heighted?: boolean; + isVisibleToRole102?: boolean; } +/** + * DataGrid component for rendering a data grid with customizable rows, columns, and various options. + * + * @param {Object} props - The properties object. + * @param {Array} props.rows - The data rows to be displayed in the grid. + * @param {Array} props.columns - The column definitions for the grid. + * @param {Function} props.onCellClick - Callback function to handle cell click events. + * @param {Function} props.getRowId - Function to get the unique identifier for each row. + * @param {boolean} [props.loading=false] - Flag to indicate if the grid is in a loading state. + * @param {boolean} [props.heighted=false] - Flag to control the auto height behavior of the grid. + * @param {boolean} [props.isVisibleToRole102=false] - Flag to control visibility of certain toolbar options for role 102. + * + * @returns {JSX.Element} The rendered data grid component. + */ function Index({ rows, columns, @@ -69,6 +84,7 @@ function Index({ getRowId, loading = false, heighted = false, + isVisibleToRole102 = false, }: paramsType) { const [pageSize, setPageSize] = useState(25); @@ -91,8 +107,14 @@ function Index({ toolbar: { showQuickFilter: true, quickFilterProps: { debounceMs: 500 }, - printOptions: { disableToolbarButton: role === 102 || role === 1 }, - csvOptions: { disableToolbarButton: role === 102 || role === 1 }, + printOptions: { + disableToolbarButton: + (role === 102 && !isVisibleToRole102) || role === 1, + }, + csvOptions: { + disableToolbarButton: + (role === 102 && !isVisibleToRole102) || role === 1, + }, }, }} disableDensitySelector diff --git a/pages/admin/rc/[rcid]/event/[eventId]/index.tsx b/pages/admin/rc/[rcid]/event/[eventId]/index.tsx index 0823d13f..efd0fa26 100644 --- a/pages/admin/rc/[rcid]/event/[eventId]/index.tsx +++ b/pages/admin/rc/[rcid]/event/[eventId]/index.tsx @@ -374,7 +374,12 @@ function Event() { /> - row.ID} rows={students} /> + row.ID} + rows={students} + isVisibleToRole102 + /> - +