Skip to content

Commit

Permalink
Add isVisibleToRole102 prop to DataGrid component
Browse files Browse the repository at this point in the history
  • Loading branch information
AkshatGupta15 committed Oct 11, 2024
1 parent e401537 commit 6eb06d4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion components/DataGrid/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ interface paramsType {
getRowId?: (row: any) => string;
loading?: boolean;
heighted?: boolean;
isVisibleToRole102?: boolean;
}

function Index({
Expand All @@ -69,6 +70,7 @@ function Index({
getRowId,
loading = false,
heighted = false,
isVisibleToRole102 = false,
}: paramsType) {
const [pageSize, setPageSize] = useState<number>(25);

Expand All @@ -91,7 +93,10 @@ function Index({
toolbar: {
showQuickFilter: true,
quickFilterProps: { debounceMs: 500 },
printOptions: { disableToolbarButton: role === 102 || role === 1 },
printOptions: {
disableToolbarButton:
(role === 102 && !isVisibleToRole102) || role === 1,
},
csvOptions: { disableToolbarButton: role === 102 || role === 1 },
},
}}
Expand Down
7 changes: 6 additions & 1 deletion pages/admin/rc/[rcid]/company/[companyId]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,12 @@ function Index() {
</Stack>
</Stack>

<DataGrid rows={rows} columns={columns} getRowId={(rows) => rows.ID} />
<DataGrid
rows={rows}
columns={columns}
getRowId={(rows) => rows.ID}
isVisibleToRole102
/>
</Stack>
</div>
);
Expand Down

0 comments on commit 6eb06d4

Please sign in to comment.