ifnex/04_Laravel/app/Filament/Resources/ShipmentResource/Pages/ViewShipment.php
Kazem Alghasi 5874568c63 feat(shipment): implement PDF generation for AWB, invoice, and labels
Introduce PDF generation capabilities for shipments using laravel-dompdf.
This includes a new service layer, dedicated controller, and routes
to handle the generation of Air Waybills (AWB), Invoices, and Shipping
Labels.

- Add `PdfService` to encapsulate PDF generation logic.
- Add `ShipmentPdfController` to handle PDF download requests.
- Integrate `barryvdh/laravel-dompdf` dependency.
- Add Filament header actions to view shipment pages for quick PDF access.
- Update order success view to provide direct download links for documents.
- Add label methods to `ShipmentDirection` and `ShipmentType` enums.
- Update project status documentation to reflect initial PDF implementation.
2026-08-04 09:20:23 +03:30

37 lines
1.2 KiB
PHP

<?php
namespace App\Filament\Resources\ShipmentResource\Pages;
use App\Filament\Resources\ShipmentResource;
use Filament\Actions;
use Filament\Resources\Pages\ViewRecord;
class ViewShipment extends ViewRecord
{
protected static string $resource = ShipmentResource::class;
protected function getHeaderActions(): array
{
return [
Actions\Action::make('print_label')
->label('چاپ لیبل')
->icon('heroicon-o-printer')
->color('success')
->url(fn ($record) => route('shipments.pdf.label', $record))
->openUrlInNewTab(),
Actions\Action::make('download_awb')
->label('دانلود AWB')
->icon('heroicon-o-document-text')
->color('warning')
->url(fn ($record) => route('shipments.pdf.awb', $record)),
Actions\Action::make('download_invoice')
->label('دانلود INVOICE')
->icon('heroicon-o-currency-dollar')
->color('info')
->url(fn ($record) => route('shipments.pdf.invoice', $record)),
];
}
}