'', 'visible' => $hasOrganization, 'items' => [ [ 'label' => t('Tenants'), 'path' => 'admin/tenants', 'active' => navActive('admin/tenants', true), 'visible' => $canViewTenants, 'withTenant' => false, ], [ 'label' => t('Departments'), 'path' => 'admin/departments', 'active' => navActive('admin/departments', true), 'visible' => $canViewDepartments, 'withTenant' => true, ], [ 'label' => t('Users'), 'path' => 'admin/users', 'active' => navActive('admin/users', true), 'visible' => $canViewUsers, 'withTenant' => true, ], ], ], [ 'label' => t('Roles & permissions'), 'visible' => $hasUsersSection, 'items' => [ [ 'label' => t('Roles'), 'path' => 'admin/roles', 'active' => navActive('admin/roles', true), 'visible' => $canViewRoles, 'withTenant' => false, ], [ 'label' => t('Permissions'), 'path' => 'admin/permissions', 'active' => navActive('admin/permissions', true), 'visible' => $canViewPermissions, 'withTenant' => false, ], ], ], [ 'label' => t('System'), 'visible' => $hasSystemSection, 'items' => [ [ 'label' => t('Statistics'), 'path' => 'admin/stats', 'active' => navActive('admin/stats', true), 'visible' => $canViewStats, 'withTenant' => false, ], [ 'label' => t('Mail logs'), 'path' => 'admin/mail-log', 'active' => navActive('admin/mail-log', true), 'visible' => $canViewMailLog, 'withTenant' => false, ], [ 'label' => t('Settings'), 'path' => 'admin/settings', 'active' => navActive('admin/settings', true), 'visible' => $canViewSettings, 'withTenant' => false, ], ], ], ]; // Render helper for admin sections $renderNavSection = static function (array $section, string $tenantQueryParam): void { if (empty($section['visible'])) { return; } $items = $section['items'] ?? []; $items = array_values(array_filter($items, static fn ($item) => !empty($item['visible']))); if (!$items) { return; } ?> '', 'aria' => '']; ?>