backoffice first commit

This commit is contained in:
2026-07-17 11:34:15 +02:00
parent 761db06329
commit 1c40ef6601
159 changed files with 25830 additions and 7875 deletions
@@ -0,0 +1,12 @@
<?php
namespace App\Filament\Resources\PreventivoResource\Pages;
use App\Filament\Resources\PreventivoResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
class CreatePreventivo extends CreateRecord
{
protected static string $resource = PreventivoResource::class;
}
@@ -0,0 +1,20 @@
<?php
namespace App\Filament\Resources\PreventivoResource\Pages;
use App\Filament\Resources\PreventivoResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
class EditPreventivo extends EditRecord
{
protected static string $resource = PreventivoResource::class;
protected function getHeaderActions(): array
{
return [
Actions\ViewAction::make(),
Actions\DeleteAction::make(),
];
}
}
@@ -0,0 +1,17 @@
<?php
namespace App\Filament\Resources\PreventivoResource\Pages;
use App\Filament\Resources\PreventivoResource;
use Filament\Resources\Pages\ListRecords;
class ListPreventivos extends ListRecords
{
protected static string $resource = PreventivoResource::class;
// Nessuna azione di creazione: i preventivi nascono dal configuratore.
protected function getHeaderActions(): array
{
return [];
}
}
@@ -0,0 +1,44 @@
<?php
namespace App\Filament\Resources\PreventivoResource\Pages;
use App\Filament\Resources\PreventivoResource;
use App\Support\PreventivoPdf;
use Filament\Actions;
use Filament\Resources\Pages\ViewRecord;
use Illuminate\Support\Facades\Storage;
class ViewPreventivo extends ViewRecord
{
protected static string $resource = PreventivoResource::class;
protected function getHeaderActions(): array
{
return [
Actions\Action::make('visualizzaPdf')
->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(),
];
}
}