feat(pdf): preview in Filament modal (iframe) instead of new tab

All "Vizualizare PDF" actions now open a wide (7xl) Filament modal
containing an iframe pointing at the inline PDF endpoint, with a
top-right "Descarcă" and "Deschide în tab nou" fallback.

- WorkOrder edit action + WO table row action
- InjectorProtocol edit action + protocols table row action
- Dashboard Docs tab preview button (Alpine.js overlay since it's
  a plain Blade view, not a Filament action)

The underlying /pdf routes stay unchanged (Content-Disposition: inline,
?download=1 for attachment) — the iframe just loads the same URL.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-06 05:47:07 +00:00
parent e289fbc068
commit c9d400fd6e
8 changed files with 68 additions and 11 deletions
@@ -87,8 +87,14 @@ class EditWorkOrder extends EditRecord
->label(__('Vizualizare PDF'))
->icon('heroicon-m-document-magnifying-glass')
->color('gray')
->url(fn () => url('/app/work-orders/' . $this->record->id . '/pdf'))
->openUrlInNewTab(),
->modalHeading(fn () => __('Factură') . ' — WO #' . $this->record->number)
->modalSubmitAction(false)
->modalCancelActionLabel(__('Închide'))
->modalWidth('7xl')
->modalContent(fn () => view('filament.tenant.pdf-preview', [
'pdfUrl' => url('/app/work-orders/' . $this->record->id . '/pdf'),
'downloadUrl' => url('/app/work-orders/' . $this->record->id . '/pdf?download=1'),
])),
Actions\DeleteAction::make(),
];
}