@props(['service', 'currentRoute']) @php $serviceRouteParameters = [ 'project_uuid' => $service->environment->project->uuid, 'environment_uuid' => $service->environment->uuid, 'service_uuid' => $service->uuid, ]; $configurationItems = collect([ ['label' => 'General', 'route' => 'project.service.configuration', 'icon' => 'settings'], ['label' => 'Domains', 'route' => 'project.service.domains', 'icon' => 'globe'], ['label' => 'Environment Variables', 'route' => 'project.service.environment-variables', 'icon' => 'variables', 'hasWarning' => ! $service->isDeployable], ['label' => 'Persistent Storage', 'route' => 'project.service.storages', 'icon' => 'storages'], ['label' => 'Backups', 'route' => 'project.service.volume-backups.index', 'icon' => 'database'], ['label' => 'Runtime', 'route' => 'project.service.logs', 'icon' => 'unordered-list', 'navigate' => false], ['label' => 'Terminal', 'route' => 'project.service.command', 'icon' => 'browser-terminal', 'navigate' => false, 'visible' => auth()->user()?->can('canAccessTerminal')], ['label' => 'Scheduled Tasks', 'route' => 'project.service.scheduled-tasks.show', 'icon' => 'calendar'], ['label' => 'Webhooks', 'route' => 'project.service.webhooks', 'icon' => 'notifications'], ['label' => 'Resource Operations', 'route' => 'project.service.resource-operations', 'icon' => 'server-update'], ['label' => 'Tags', 'route' => 'project.service.tags', 'icon' => 'tags'], ['label' => 'Danger Zone', 'route' => 'project.service.danger', 'icon' => 'shield-alert'], ])->filter(fn (array $item): bool => $item['visible'] ?? true) ->map(fn (array $item): array => [ ...$item, 'active' => $currentRoute === $item['route'] || ($item['route'] === 'project.service.scheduled-tasks.show' && str($currentRoute)->startsWith('project.service.scheduled-tasks')) || ($item['route'] === 'project.service.volume-backups.index' && str($currentRoute)->startsWith('project.service.volume-backups')), ]); $menuGroups = [ 'Settings' => ['General', 'Domains', 'Environment Variables', 'Persistent Storage', 'Backups'], 'Automation' => ['Scheduled Tasks', 'Webhooks'], 'Logs' => ['Runtime'], 'Operations' => ['Terminal', 'Resource Operations', 'Tags', 'Danger Zone'], ]; $groupedItems = collect($menuGroups) ->map(fn (array $labels) => $configurationItems->whereIn('label', $labels)->values()) ->filter(fn ($items) => $items->isNotEmpty()); @endphp