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:
@@ -35,6 +35,18 @@ class WorkOrderDashboard extends Page
|
||||
public function mount(int|string $record): void
|
||||
{
|
||||
$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([
|
||||
'client', 'vehicle', 'master',
|
||||
'works.labor', 'works.master',
|
||||
@@ -44,14 +56,13 @@ class WorkOrderDashboard extends Page
|
||||
])->find($id);
|
||||
|
||||
if (! $wo) {
|
||||
// Diagnose: does it exist in another tenant?
|
||||
$existsGlobally = WorkOrder::withoutGlobalScopes()
|
||||
->where('id', $id)->exists();
|
||||
$tenant = app(\App\Tenancy\TenantManager::class)->current();
|
||||
$tenantSlug = $tenant?->slug ?? '—';
|
||||
$msg = $existsGlobally
|
||||
? 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()
|
||||
->title(__('Fișă indisponibilă'))
|
||||
->body($msg)
|
||||
|
||||
Reference in New Issue
Block a user