import React from 'react'; import { router } from '@inertiajs/react'; import { Sidebar } from 'flowbite-react'; import { HiLogout } from 'react-icons/hi'; import { filterOpenMenu } from './helpers'; import routes from './routes'; import { formatDate } from '@/utils'; export default function SidebarNav({ user }) { const menus = routes.filter(item => { item.open = false if (!item.show) { return null } if (+user.is_superadmin === 1) { return filterOpenMenu(user, item) } if(user.role.permissions.find(p => p.name === item.permission)) { return item } return filterOpenMenu(user, item) }) return ( {menus.map(item => (
{item.items === undefined ? ( router.visit(item.route)} icon={item.icon} active={route().current(item.active)} > {item.name} ) : ( {item.items.map(item => ( router.visit(item.route)} icon={item.icon} active={route().current(item.active)} > {item.name} ))} )}
))} router.post(route('logout'))} icon={HiLogout} > Logout

App Name © {(new Date()).getFullYear()}

) }