diag(work-order-dashboard): log every mount + include URL in error

Adds Log::warning() on every mount() so we can trace exactly what
record id and URL the button navigates to. Also includes the full URL
in the "not found" alert so the user can copy it back to us.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-05 20:23:28 +00:00
parent fbb0bcb7e1
commit bd8e42d3d1
@@ -35,6 +35,18 @@ class WorkOrderDashboard extends Page
public function mount(int|string $record): void public function mount(int|string $record): void
{ {
$id = (int) $record; $id = (int) $record;
// Log every single mount attempt so we can diagnose the exact request
\Log::warning('WorkOrderDashboard.mount', [
'record_raw' => $record,
'record_int' => $id,
'url' => request()->fullUrl(),
'referer' => request()->headers->get('referer'),
'method' => request()->method(),
'auth_id' => auth()->id(),
'tenant' => app(\App\Tenancy\TenantManager::class)->current()?->slug,
]);
$wo = WorkOrder::with([ $wo = WorkOrder::with([
'client', 'vehicle', 'master', 'client', 'vehicle', 'master',
'works.labor', 'works.master', 'works.labor', 'works.master',
@@ -44,14 +56,13 @@ class WorkOrderDashboard extends Page
])->find($id); ])->find($id);
if (! $wo) { if (! $wo) {
// Diagnose: does it exist in another tenant?
$existsGlobally = WorkOrder::withoutGlobalScopes() $existsGlobally = WorkOrder::withoutGlobalScopes()
->where('id', $id)->exists(); ->where('id', $id)->exists();
$tenant = app(\App\Tenancy\TenantManager::class)->current(); $tenant = app(\App\Tenancy\TenantManager::class)->current();
$tenantSlug = $tenant?->slug ?? '—'; $tenantSlug = $tenant?->slug ?? '—';
$msg = $existsGlobally $msg = $existsGlobally
? sprintf(__('Fișa #%d există, dar nu aparține tenantului „%s".'), $id, $tenantSlug) ? sprintf(__('Fișa #%d există, dar nu aparține tenantului „%s".'), $id, $tenantSlug)
: sprintf(__('Fișa #%d nu există. Verifică lista de fișe active.'), $id); : sprintf(__('Fișa #%d nu există. URL apelat: %s'), $id, request()->fullUrl());
\Filament\Notifications\Notification::make() \Filament\Notifications\Notification::make()
->title(__('Fișă indisponibilă')) ->title(__('Fișă indisponibilă'))
->body($msg) ->body($msg)