label('Visualizza PDF') ->icon('heroicon-o-eye') ->color('gray') ->visible(fn () => $this->record->stato !== 'bozza') ->url(fn () => route('preventivi.pdf.show', $this->record)) ->openUrlInNewTab(), Actions\Action::make('scaricaPdf') ->label('Scarica PDF') ->icon('heroicon-o-arrow-down-tray') ->color('gray') ->visible(fn () => $this->record->stato !== 'bozza') ->action(function () { if (! $this->record->pdf_path || ! Storage::disk('local')->exists($this->record->pdf_path)) { $this->record->pdf_path = PreventivoPdf::genera($this->record); $this->record->save(); } return Storage::disk('local')->download( $this->record->pdf_path, 'preventivo-'.$this->record->numero.'.pdf' ); }), Actions\EditAction::make(), ]; } }