update role client porta

This commit is contained in:
2024-10-15 15:01:16 +07:00
parent fb70bc4206
commit de644e5db8
2 changed files with 13 additions and 3 deletions

View File

@@ -94,6 +94,7 @@ class PermissionTableSeeder extends Seeder
'file-diagnosis-client-portal', 'file-diagnosis-client-portal',
'file-pendukung-medis-client-portal', 'file-pendukung-medis-client-portal',
'export-alarm-center-client-portal', 'export-alarm-center-client-portal',
'filter-alarm-center-client-portal',
'benefit-client-portal', 'benefit-client-portal',
] ]
], ],

View File

@@ -19,12 +19,21 @@ import { enqueueSnackbar } from 'notistack';
import Label from '../../components/Label'; import Label from '../../components/Label';
import { Stack } from '@mui/material'; import { Stack } from '@mui/material';
import { Download } from '@mui/icons-material'; import { Download } from '@mui/icons-material';
import useAuth from '../../hooks/useAuth';
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
export default function List() { export default function List() {
const {user} = useAuth();
const checkIfNameExists = (name) => {
return user.user.permissions.some(item => item.name === name);
};
const exportLog = 'export-alarm-center-client-portal';
const filterLog = 'filter-alarm-center-client-portal';
const navigate = useNavigate(); const navigate = useNavigate();
const viewExportCheck = checkIfNameExists(exportLog);
const viewFilterCheck = checkIfNameExists(filterLog);
const { corporateValue } = useContext(UserCurrentCorporateContext); const { corporateValue } = useContext(UserCurrentCorporateContext);
const [data, setData] = useState([]); const [data, setData] = useState([]);
@@ -168,7 +177,7 @@ export default function List() {
}; };
const filterStartDate = { const filterStartDate = {
useFilter: true, useFilter: viewFilterCheck ? true : false,
startDate: startDateValue, startDate: startDateValue,
setStartDate: setStartDateValue, setStartDate: setStartDateValue,
handleStartDateChange: handleStartDateChanges, handleStartDateChange: handleStartDateChanges,
@@ -190,7 +199,7 @@ export default function List() {
}; };
const filterEndDate = { const filterEndDate = {
useFilter: true, useFilter: viewFilterCheck ? true : false,
endDate: endDateValue, endDate: endDateValue,
setEndDate: setEndDateValue, setEndDate: setEndDateValue,
handleEndDateChange: handleEndDateChanges, handleEndDateChange: handleEndDateChanges,
@@ -225,7 +234,7 @@ export default function List() {
); );
}; };
const exportReport = { const exportReport = {
useExport: true, useExport: viewExportCheck ? true : false,
startDate: startDateValue, startDate: startDateValue,
endDate: endDateValue, endDate: endDateValue,
status: statusValue, status: statusValue,