feat: Implement price list management and import functionality

- Added ListinoRelationManager for managing price lists associated with models.
- Introduced ImportaListiniAction for importing price lists from Excel files.
- Created ListinoPrezzo model to represent price entries in the database.
- Developed ListinoExcelParser for parsing Excel files containing price lists.
- Implemented ListinoImporter to handle the import logic and associations.
- Added migration for creating listino_prezzi table and converting measures to mm.
- Updated frontend logic to handle new price list features and validations.
- Enhanced tests for price list import and conversion functionalities.
This commit is contained in:
2026-10-19 16:51:24 +02:00
parent a8aa6d9927
commit 1e352eb2ef
46 changed files with 1575 additions and 327 deletions
+35
View File
@@ -0,0 +1,35 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class ListinoPrezzo extends Model
{
protected $table = 'listino_prezzi';
protected $fillable = [
'modello_id', 'larghezza', 'altezza', 'prezzo',
];
protected $casts = [
'larghezza' => 'integer',
'altezza' => 'integer',
'prezzo' => 'float',
];
public function modello(): BelongsTo
{
return $this->belongsTo(Modello::class);
}
protected static function booted(): void
{
// Le modifiche manuali dal pannello aggiornano la data del listino del modello.
$tocca = fn (ListinoPrezzo $prezzo) => $prezzo->modello?->update(['listino_aggiornato_at' => now()]);
static::saved($tocca);
static::deleted($tocca);
}
}