Files
Vasyka c9d400fd6e 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>
2026-08-06 05:47:07 +00:00

33 lines
1.2 KiB
PHP

<?php
namespace App\Filament\Tenant\Resources\InjectorProtocolResource\Pages;
use App\Filament\Tenant\Resources\InjectorProtocolResource;
use App\Models\Tenant\InjectorProtocol;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
class EditInjectorProtocol extends EditRecord
{
protected static string $resource = InjectorProtocolResource::class;
protected function getHeaderActions(): array
{
return [
Actions\Action::make('pdf')
->label(__('Vizualizare PDF'))
->icon('heroicon-m-document-magnifying-glass')
->color('gray')
->modalHeading(fn (InjectorProtocol $record) => __('Protocol') . ' ' . $record->protocol_number)
->modalSubmitAction(false)
->modalCancelActionLabel(__('Închide'))
->modalWidth('7xl')
->modalContent(fn (InjectorProtocol $record) => view('filament.tenant.pdf-preview', [
'pdfUrl' => route('tenant.injector-protocols.pdf', ['record' => $record->id]),
'downloadUrl' => route('tenant.injector-protocols.pdf', ['record' => $record->id, 'download' => 1]),
])),
Actions\DeleteAction::make(),
];
}
}