feat(pdf): inline preview by default with ?download=1 override + vehicle photo fallback

- WorkOrder and InjectorProtocol PDF routes now respond with
  Content-Disposition: inline (opens in browser tab so the user can
  read/print/save from the built-in PDF viewer). ?download=1 forces
  the classic attachment download.
- CalendarBoard exportPdf() switched to the same inline default.
- WO edit action + WO table row action + injector protocol actions
  now use ->url(...)->openUrlInNewTab() instead of streaming the PDF
  inline into the current tab.
- Dashboard Docs tab has both a preview link and a "Descarcă" link.
- Vehicle card photo falls back to WO's first uploaded photo when
  Vehicle model has no MediaLibrary integration of its own.

Test CalendarEnhancementsTest updated to assert the new inline
response headers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-05 20:56:24 +00:00
parent e0b61fb3cb
commit 5a5f43f2de
10 changed files with 55 additions and 44 deletions
+7 -5
View File
@@ -437,11 +437,13 @@ class CalendarBoard extends Page
'generatedAt' => now()->format('d.m.Y H:i'),
])->setPaper('a4', 'portrait');
return response()->streamDownload(
fn () => print $pdf->output(),
'programari_' . $firstDate . '_' . $lastDate . '.pdf',
['Content-Type' => 'application/pdf']
);
$filename = 'programari_' . $firstDate . '_' . $lastDate . '.pdf';
$disposition = request()->boolean('download') ? 'attachment' : 'inline';
return response($pdf->output(), 200, [
'Content-Type' => 'application/pdf',
'Content-Disposition' => $disposition . '; filename="' . $filename . '"',
'Cache-Control' => 'private, no-store',
]);
}
/** Flat list of appointments for the visible period — used by list view. */