From 098b8e520480ca71ab005e29ecaab2883c5adc74 Mon Sep 17 00:00:00 2001 From: Vasyka Date: Wed, 5 Aug 2026 20:08:40 +0000 Subject: [PATCH] fix(edit-wo): use Filament's Page::getUrl() for dashboard button Filament's static ::getUrl(['record' => id]) is the canonical way to build a page URL with parameters, and it uses the actual route resolver (handling tenant panel prefix, etc). This is cleaner than hand-building the path and avoids any \$this-binding ambiguity. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../WorkOrderResource/Pages/EditWorkOrder.php | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/app/Filament/Tenant/Resources/WorkOrderResource/Pages/EditWorkOrder.php b/app/Filament/Tenant/Resources/WorkOrderResource/Pages/EditWorkOrder.php index fd77e49..400dd56 100644 --- a/app/Filament/Tenant/Resources/WorkOrderResource/Pages/EditWorkOrder.php +++ b/app/Filament/Tenant/Resources/WorkOrderResource/Pages/EditWorkOrder.php @@ -31,25 +31,12 @@ class EditWorkOrder extends EditRecord protected function getHeaderActions(): array { - // Compute WO id defensively — under some Livewire lifecycles $this->record - // may not yet be hydrated when getHeaderActions() runs. Fall back to URL - // segment which is always present because we're on /app/work-orders/{id}/edit. - $woId = $this->record?->id - ?? (int) (request()->route('record') ?? request()->segment(3)); - \Log::info('EditWorkOrder.getHeaderActions', [ - 'record_id_from_prop' => $this->record?->id, - 'record_id_resolved' => $woId, - 'route_record' => request()->route('record'), - 'segment3' => request()->segment(3), - ]); - $dashboardUrl = url('/app/work-orders/' . $woId . '/dashboard'); - return [ Actions\Action::make('dashboard') ->label(__('Vizualizare dashboard')) ->icon('heroicon-m-squares-2x2') ->color('info') - ->url($dashboardUrl), + ->url(fn () => \App\Filament\Tenant\Pages\WorkOrderDashboard::getUrl(['record' => $this->record->id])), Actions\Action::make('apply_template') ->label(__('Aplică șablon')) ->icon('heroicon-m-clipboard-document-list')