= $this->renderSection('styles') ?>
getPath(); $segment = service('request')->getUri()->getSegment(1) ?: 'workspace'; $activeMain = match ($segment) { 'workspace', 'invite' => 'workspace', 'datasource' => 'datasource', 'query' => 'queries', 'chart' => 'charts', 'dashboard' => 'dashboards', 'alert' => 'alerts', 'settings', 'audit', 'profile' => 'settings', 'admin' => 'settings', default => 'workspace', }; $canWsAdmin = ! empty($canWorkspaceAdmin); $roleUser = (string) ($currentUser['role'] ?? ''); $workspaceSub = [ ['icon' => 'dashboard_customize', 'label' => 'Workspace Overview', 'url' => base_url('workspace')], ['icon' => 'add_circle', 'label' => 'Create Workspace', 'url' => base_url('workspace/create')], ['icon' => 'groups', 'label' => 'Members', 'url' => ($activeWorkspaceId ?? 0) ? base_url('workspace/members/' . $activeWorkspaceId) : base_url('workspace')], ['icon' => 'mail', 'label' => 'Invitations', 'url' => ($activeWorkspaceId ?? 0) ? base_url('workspace/invite/' . $activeWorkspaceId) : base_url('workspace')], ['icon' => 'settings', 'label' => 'Workspace Settings', 'url' => ($activeWorkspaceId ?? 0) ? base_url('workspace/settings/' . $activeWorkspaceId) : base_url('workspace')], ]; $settingsSub = array_values(array_filter([ ['icon' => 'tune', 'label' => 'Workspace preferences', 'url' => base_url('settings/workspace')], ['icon' => 'person', 'label' => 'Profile', 'url' => base_url('profile')], $canWsAdmin ? ['icon' => 'notifications', 'label' => 'Notifications', 'url' => base_url('settings/notifications')] : null, $canWsAdmin ? ['icon' => 'history', 'label' => 'Audit log', 'url' => base_url('audit')] : null, $roleUser === 'superadmin' ? ['icon' => 'shield_person', 'label' => 'App settings', 'url' => base_url('admin/settings')] : null, $roleUser === 'superadmin' ? ['icon' => 'group', 'label' => 'Manage users', 'url' => base_url('admin/users')] : null, ])); $itemPathActive = static function (string $itemUrl) use ($path): bool { $p = trim(parse_url($itemUrl, PHP_URL_PATH) ?? '', '/'); return $p !== '' && str_starts_with($path, $p); }; ?>