feat: implement discount and transport features in the quote system

- Added maximum discount settings configurable by the administrator.
- Implemented discount calculations in the quote confirmation process.
- Introduced transport options with associated costs, including handling for exceeding maximum piece limits.
- Updated frontend to display discounts and transport information in the quote summary.
- Created new database migrations for storing discount and transport settings.
- Developed a new Filament page for managing global discount settings.
- Enhanced email templates to include discount and transport details.
- Added tests to ensure proper functionality of discounts and transport calculations.
This commit is contained in:
2026-10-20 17:45:50 +02:00
parent 06617a985a
commit 8bef57b64b
27 changed files with 875 additions and 26 deletions
@@ -5,6 +5,7 @@ namespace App\Filament\Resources\PreventivoResource\Pages;
use App\Filament\Resources\PreventivoResource;
use App\Support\PreventivoPdf;
use Filament\Actions;
use Filament\Notifications\Notification;
use Filament\Resources\Pages\ViewRecord;
use Illuminate\Support\Facades\Storage;
@@ -38,6 +39,21 @@ class ViewPreventivo extends ViewRecord
'preventivo-'.$this->record->numero.'.pdf'
);
}),
// Il PDF è salvato alla conferma e poi riservito così com'è: dopo modifiche al
// template o ai dati va rigenerato.
Actions\Action::make('rigeneraPdf')
->label('Rigenera PDF')
->icon('heroicon-o-arrow-path')
->color('gray')
->visible(fn () => $this->record->stato !== 'bozza')
->requiresConfirmation()
->modalDescription('Il PDF verrà ricreato con il modello e i dati attuali, sostituendo quello salvato.')
->action(function () {
$this->record->pdf_path = PreventivoPdf::genera($this->record);
$this->record->save();
Notification::make()->title('PDF rigenerato')->success()->send();
}),
Actions\EditAction::make(),
];
}