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,6 +35,26 @@ class CatalogoController extends Controller
return response()->json($this->sistema($sistema));
}
/**
* GET /api/sistemi/{codice}/modelli/{modello}/listino
* Griglia prezzi del modello (misure in mm), ordinata per altezza e larghezza.
*/
public function listino(string $codice, string $modello): JsonResponse
{
$modello = Modello::attivi()
->where('codice', $modello)
->whereHas('sistema', fn ($q) => $q->where('codice', $codice)->where('attivo', true))
->firstOrFail();
$prezzi = $modello->listino()
->orderBy('altezza')
->orderBy('larghezza')
->get(['altezza', 'larghezza', 'prezzo'])
->map(fn ($p) => ['altezza' => $p->altezza, 'larghezza' => $p->larghezza, 'prezzo' => $p->prezzo]);
return response()->json($prezzi);
}
private function sistema(Sistema $sistema): array
{
return [