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:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user