19a7afac27
- barryvdh/laravel-dompdf instalat - WorkOrderPdfService: încarcă WO cu toate relațiile (works/parts/payments), embed-ează logo ca data URI, foloseste theme_color din settings - Blade template /resources/views/pdf/work-order.blade.php: - Header cu logo + date companie + nr fișă + data - Box-uri client + auto (kilometraj/VIN/plate) - Plângere + diagnostic - Tabel manopere (h, preț/h, total) cu maistru pe fiecare rând - Tabel piese (cod, brand, qty, preț, total) - Box total cu discount + plăți efectuate + rest de achitat - Block recomandări cu fundal galben (warning) - Linii semnătură client + maistru - Footer cu timestamp generare - Action 'PDF' (icon descărcare) pe rând în lista de WO - Action 'Descarcă PDF' în header-ul paginii Edit WO
36 lines
1.1 KiB
PHP
36 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Tenant\Resources\WorkOrderResource\Pages;
|
|
|
|
use App\Filament\Tenant\Resources\WorkOrderResource;
|
|
use App\Models\Tenant\WorkOrder;
|
|
use App\Services\WorkOrderPdfService;
|
|
use Filament\Actions;
|
|
use Filament\Resources\Pages\EditRecord;
|
|
|
|
class EditWorkOrder extends EditRecord
|
|
{
|
|
protected static string $resource = WorkOrderResource::class;
|
|
|
|
protected function getHeaderActions(): array
|
|
{
|
|
return [
|
|
Actions\Action::make('pdf')
|
|
->label('Descarcă PDF')
|
|
->icon('heroicon-m-document-arrow-down')
|
|
->color('gray')
|
|
->action(function () {
|
|
/** @var WorkOrder $wo */
|
|
$wo = $this->record;
|
|
$svc = app(WorkOrderPdfService::class);
|
|
$pdf = $svc->generate($wo);
|
|
return response()->streamDownload(
|
|
fn () => print($pdf->output()),
|
|
$svc->filename($wo)
|
|
);
|
|
}),
|
|
Actions\DeleteAction::make(),
|
|
];
|
|
}
|
|
}
|