filter dokter only yang bisa merespkan

This commit is contained in:
2024-05-02 15:08:49 +07:00
parent 8cb30ddedd
commit a7bce13ec3
2 changed files with 16 additions and 2 deletions

View File

@@ -19,6 +19,8 @@ export const accessGroup = {
admin: ["/report/logs"]
}
const navConfig = [
// GENERAL
// ----------------------------------------------------------------------
@@ -124,7 +126,7 @@ const navConfig = [
path: '/linking',
},
{
title: 'E - PRESCRIPTION',
title: 'E-PRESCRIPTION',
path: '/e-prescription/live-chat',
},
],

View File

@@ -19,6 +19,7 @@ import navConfig from './NavConfig';
import NavbarDocs from './NavbarDocs';
import NavbarAccount from './NavbarAccount';
import CollapseButton from './CollapseButton';
import useAuth from '@/hooks/useAuth';
// ----------------------------------------------------------------------
@@ -42,6 +43,7 @@ export default function NavbarVertical({ isOpenSidebar, onCloseSidebar }: Props)
const theme = useTheme();
const { pathname } = useLocation();
const {user} = useAuth()
const isDesktop = useResponsive('up', 'lg');
@@ -55,6 +57,16 @@ export default function NavbarVertical({ isOpenSidebar, onCloseSidebar }: Props)
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [pathname]);
const filteredItems = navConfig.filter(section => {
return section.items.some(item => {
return item.title === 'E-PRESCRIPTION';
});
});
const filteredData = filteredItems.map(section => ({
items: section.items.filter(item => item.title === "E-PRESCRIPTION")
}));
const renderContent = (
<Scrollbar
sx={{
@@ -89,7 +101,7 @@ export default function NavbarVertical({ isOpenSidebar, onCloseSidebar }: Props)
<NavbarAccount isCollapse={isCollapse} />
</Stack>
<NavSectionVertical navConfig={navConfig} isCollapse={isCollapse} />
<NavSectionVertical navConfig={user.role_id == 5 ? filteredData : navConfig} isCollapse={isCollapse} />
<Box sx={{ flexGrow: 1 }} />