@@ -1,6 +1,8 @@
|
||||
import { Link, usePage } from '@inertiajs/react';
|
||||
import {
|
||||
Building2,
|
||||
BookOpen,
|
||||
CreditCard,
|
||||
LayoutGrid,
|
||||
Network,
|
||||
Settings2,
|
||||
@@ -24,14 +26,19 @@ import type { NavItem } from '@/types';
|
||||
|
||||
export function AppSidebar() {
|
||||
const { auth } = usePage().props;
|
||||
|
||||
if (!auth.user) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const permissions = auth.permissions ?? [];
|
||||
const mainNavItems: NavItem[] = [
|
||||
{ title: 'Dashboard', href: dashboard(), icon: LayoutGrid },
|
||||
...(!auth.user.is_platform_admin &&
|
||||
auth.permissions.includes('device.view')
|
||||
...(!auth.user.is_platform_admin && permissions.includes('device.view')
|
||||
? [{ title: 'Perangkat', href: '/devices', icon: Network }]
|
||||
: []),
|
||||
...(!auth.user.is_platform_admin &&
|
||||
auth.permissions.includes('device.user.view')
|
||||
permissions.includes('device.user.view')
|
||||
? [
|
||||
{
|
||||
title: 'Users Perangkat',
|
||||
@@ -40,8 +47,22 @@ export function AppSidebar() {
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
title: 'Dokumentasi',
|
||||
href: '/documentation/deployment',
|
||||
icon: BookOpen,
|
||||
},
|
||||
...(!auth.user.is_platform_admin && permissions.includes('license.view')
|
||||
? [
|
||||
{
|
||||
title: 'Lisensi & Tagihan',
|
||||
href: '/billing',
|
||||
icon: CreditCard,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(!auth.user.is_platform_admin &&
|
||||
auth.permissions.includes('device.credential.create')
|
||||
permissions.includes('device.credential.create')
|
||||
? [
|
||||
{
|
||||
title: 'Pengaturan Perangkat',
|
||||
@@ -57,11 +78,16 @@ export function AppSidebar() {
|
||||
href: '/administration/tenants',
|
||||
icon: Building2,
|
||||
},
|
||||
{
|
||||
title: 'Order Lisensi',
|
||||
href: '/administration/billing-orders',
|
||||
icon: CreditCard,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
...(!auth.user.is_platform_admin &&
|
||||
auth.user.tenant_id &&
|
||||
auth.permissions.includes('user.view')
|
||||
permissions.includes('user.view')
|
||||
? [
|
||||
{
|
||||
title: 'Users',
|
||||
|
||||
Reference in New Issue
Block a user