From fbb0bcb7e19a247a542fe7119a1681f7c39f8892 Mon Sep 17 00:00:00 2001 From: Vasyka Date: Wed, 5 Aug 2026 20:19:19 +0000 Subject: [PATCH] fix(edit-wo): pass panel='tenant' to Page::getUrl() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without an explicit panel, WorkOrderDashboard::getUrl() resolves the route name against Filament's current-or-default panel, which in some Livewire lifecycles or from ambiguous contexts is 'central' — where the page isn't registered. Symptom: the produced URL ended up empty or malformed, and clicking the button hit our friendly redirect claiming WO #0 doesn't exist. Also removes the temporary /__wo-diag/{id} route added for diagnosis. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../WorkOrderResource/Pages/EditWorkOrder.php | 5 ++++- routes/web.php | 20 ------------------- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/app/Filament/Tenant/Resources/WorkOrderResource/Pages/EditWorkOrder.php b/app/Filament/Tenant/Resources/WorkOrderResource/Pages/EditWorkOrder.php index 400dd56..c2b7f4e 100644 --- a/app/Filament/Tenant/Resources/WorkOrderResource/Pages/EditWorkOrder.php +++ b/app/Filament/Tenant/Resources/WorkOrderResource/Pages/EditWorkOrder.php @@ -36,7 +36,10 @@ class EditWorkOrder extends EditRecord ->label(__('Vizualizare dashboard')) ->icon('heroicon-m-squares-2x2') ->color('info') - ->url(fn () => \App\Filament\Tenant\Pages\WorkOrderDashboard::getUrl(['record' => $this->record->id])), + ->url(fn () => \App\Filament\Tenant\Pages\WorkOrderDashboard::getUrl( + parameters: ['record' => $this->record->id], + panel: 'tenant', + )), Actions\Action::make('apply_template') ->label(__('Aplică șablon')) ->icon('heroicon-m-clipboard-document-list') diff --git a/routes/web.php b/routes/web.php index c629106..4e5f283 100644 --- a/routes/web.php +++ b/routes/web.php @@ -4,26 +4,6 @@ use App\Tenancy\TenantManager; use Illuminate\Http\Request; use Illuminate\Support\Facades\Route; -Route::get('/__wo-diag/{id}', function ($id) { - $wo = \App\Models\Tenant\WorkOrder::withoutGlobalScopes()->find((int) $id); - $tenant = app(TenantManager::class)->current(); - $scopedWo = \App\Models\Tenant\WorkOrder::find((int) $id); - $btnUrl = \App\Filament\Tenant\Pages\WorkOrderDashboard::getUrl(['record' => (int) $id]); - $file = base_path('app/Filament/Tenant/Resources/WorkOrderResource/Pages/EditWorkOrder.php'); - $codeSnip = str_contains(file_get_contents($file), 'WorkOrderDashboard::getUrl') ? 'NEW code deployed' : 'OLD code — deploy not applied'; - return response()->json([ - 'requested_id' => (int) $id, - 'tenant_slug' => $tenant?->slug, - 'tenant_id' => $tenant?->id, - 'wo_exists_globally' => $wo !== null, - 'wo_belongs_to_tenant' => $wo && $tenant && $wo->company_id === $tenant->id, - 'wo_visible_via_scope' => $scopedWo !== null, - 'wo_actual_company_id' => $wo?->company_id, - 'dashboard_button_url' => $btnUrl, - 'edit_file_status' => $codeSnip, - ], 200, ['Content-Type' => 'application/json']); -}); - Route::get('/', function () { // On a tenant subdomain → public landing page. $tenant = app(TenantManager::class)->current();