'admin-organization', 'label' => t('Organization'), '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, ], ], ], [ 'key' => 'admin-roles-permissions', '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, ], ], ], [ 'key' => 'admin-automation', 'label' => t('Automation & integrations'), 'visible' => $hasAutomationSection, 'items' => [ [ 'label' => t('Imports'), 'path' => 'admin/imports', 'active' => navActive('admin/imports', true), 'visible' => $canViewImports, 'withTenant' => false, ], [ 'label' => t('Scheduled jobs'), 'path' => 'admin/scheduled-jobs', 'active' => navActive('admin/scheduled-jobs', true), 'visible' => $canViewJobs, 'withTenant' => false, ], [ 'label' => t('API docs'), 'path' => 'admin/api-docs', 'active' => navActive('admin/api-docs', true), 'visible' => $canViewApiDocs, 'withTenant' => false, ], ], ], [ 'key' => 'admin-monitoring', 'label' => t('Monitoring'), 'visible' => $hasMonitoringSection, 'items' => [ [ 'label' => t('Statistics'), 'path' => 'admin/stats', 'active' => navActive('admin/stats', true), 'visible' => $canViewStats, 'withTenant' => false, ], ], ], [ 'key' => 'admin-logs', 'label' => t('Logs'), 'visible' => $hasLogsSection, 'items' => [ [ 'label' => t('Mail logs'), 'path' => 'admin/mail-log', 'active' => navActive('admin/mail-log', true), 'visible' => $canViewMailLog, 'withTenant' => false, ], [ 'label' => t('API audit'), 'path' => 'admin/api-audit', 'active' => navActive('admin/api-audit', true), 'visible' => $canViewApiAudit, 'withTenant' => false, ], [ 'label' => t('System audit logs'), 'path' => 'admin/system-audit', 'active' => navActive('admin/system-audit', true), 'visible' => $canViewSystemAudit, 'withTenant' => false, ], [ 'label' => t('Import logs'), 'path' => 'admin/import-audit', 'active' => navActive('admin/import-audit', true), 'visible' => $canViewImportsAudit, 'withTenant' => false, ], [ 'label' => t('User lifecycle logs'), 'path' => 'admin/user-lifecycle-audit', 'active' => navActive('admin/user-lifecycle-audit', true), 'visible' => $canViewUserLifecycleAudit, 'withTenant' => false, ], ], ], [ 'key' => 'admin-system', 'label' => t('System'), 'visible' => $hasSystemSection, 'items' => [ [ 'label' => t('Settings'), 'path' => 'admin/settings', 'active' => navActive('admin/settings', true), 'visible' => $canViewSettings, 'withTenant' => false, ], [ 'label' => t('Documentation'), 'path' => $docsDefaultPath, 'active' => navActive('admin/docs', true), 'visible' => $canViewDocs, 'withTenant' => false, ], ], ], ]; // Render helper for grouped admin aside navigation $renderAdminNavGroup = static function (array $group, string $tenantQueryParam): void { if (empty($group['visible'])) { return; } $groupKey = trim((string) ($group['key'] ?? '')); if ($groupKey === '') { return; } $items = $group['items'] ?? []; $items = array_values(array_filter($items, static fn ($item) => !empty($item['visible']))); if (!$items) { return; } $groupIsActive = false; foreach ($items as $item) { $activeState = $item['active'] ?? []; if (!empty($activeState['isActive'])) { $groupIsActive = true; break; } } ?>
  • open>