edcdba9d53
- HasMedia (Spatie) on WorkOrder with `photos` collection
- eta_at + tracking_token columns; token auto-generated on create
- Public /t/{token} page — tenant-scoped via subdomain, white-label themed
- QR code SVG via chillerlan/php-qrcode (inline modal + download)
- Filament: SpatieMediaLibraryFileUpload + ETA picker + tracking section
- EditWorkOrder header action "Link client (QR)" modal
- Fix: Auditable::dontSubmitEmptyLogs() → dontLogEmptyChanges() (removed in activitylog)
- Tests: TrackingPageTest (4 pass) covering token gen + cross-tenant isolation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
46 lines
1.6 KiB
PHP
46 lines
1.6 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('tracking')
|
|
->label('Link client (QR)')
|
|
->icon('heroicon-m-qr-code')
|
|
->color('primary')
|
|
->modalHeading(fn () => 'Tracking client — WO #' . $this->record->number)
|
|
->modalSubmitAction(false)
|
|
->modalCancelActionLabel('Închide')
|
|
->modalContent(fn () => view('filament.tenant.tracking-qr', [
|
|
'wo' => $this->record,
|
|
])),
|
|
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(),
|
|
];
|
|
}
|
|
}
|