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) <noreply@anthropic.com>
This commit is contained in:
2026-08-05 20:08:40 +00:00
parent 6aa9bfb769
commit 098b8e5204
@@ -31,25 +31,12 @@ class EditWorkOrder extends EditRecord
protected function getHeaderActions(): array 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 [ return [
Actions\Action::make('dashboard') Actions\Action::make('dashboard')
->label(__('Vizualizare dashboard')) ->label(__('Vizualizare dashboard'))
->icon('heroicon-m-squares-2x2') ->icon('heroicon-m-squares-2x2')
->color('info') ->color('info')
->url($dashboardUrl), ->url(fn () => \App\Filament\Tenant\Pages\WorkOrderDashboard::getUrl(['record' => $this->record->id])),
Actions\Action::make('apply_template') Actions\Action::make('apply_template')
->label(__('Aplică șablon')) ->label(__('Aplică șablon'))
->icon('heroicon-m-clipboard-document-list') ->icon('heroicon-m-clipboard-document-list')