feat: add previous configuration handling for user selections in quotes

- Implemented session storage management for the last configuration choices made by the user.
- Added functionality to prompt users when changing models to retain their previous selections.
- Introduced methods to apply previous choices to the newly loaded model, including finishes, handles, glass types, and options.
- Enhanced user experience by ensuring selections are automatically applied where applicable.
This commit is contained in:
2026-10-19 19:49:44 +02:00
parent 863e6ca920
commit 06617a985a
197 changed files with 4892 additions and 400 deletions
+13 -2
View File
@@ -2,6 +2,7 @@
namespace Tests\Feature;
use App\Models\ListinoPrezzo;
use App\Models\Modello;
use App\Models\Sistema;
use Database\Seeders\CatalogoSeeder;
@@ -46,9 +47,11 @@ class CatalogoApiTest extends TestCase
$this->assertSame(30, Modello::count());
}
public function test_api_sistemi_espone_solo_modelli_attivi_in_ordine(): void
public function test_api_sistemi_espone_solo_modelli_attivi_e_con_listino_in_ordine(): void
{
$this->seed(CatalogoSeeder::class);
// Senza listino il bilico non compare nel configuratore.
Modello::where('codice', '!=', 'bilico')->each(fn (Modello $m) => ListinoPrezzo::create(['modello_id' => $m->id, 'larghezza' => 1000, 'altezza' => 1000, 'prezzo' => 100]));
Sistema::create(['codice' => 'legno', 'nome' => 'Legno', 'attivo' => false]);
$response = $this->getJson('/api/sistemi')->assertOk();
@@ -57,13 +60,21 @@ class CatalogoApiTest extends TestCase
$response->assertJsonPath('0.codice', 'pvc');
$modelli = collect($response->json('0.modelli'));
$this->assertSame(26, $modelli->count());
$this->assertSame(25, $modelli->count());
$this->assertNotContains('bilico', $modelli->pluck('id'));
$this->assertSame('finestra_1_anta', $modelli->first()['id']);
$this->assertNotContains('scorrevole_sf_3_ante', $modelli->pluck('id'));
$this->assertStringEndsWith('/storage/modelli/icone/pvc/finestra_1_anta.jpg', $modelli->first()['icona']);
$this->assertSame('finestra_1_anta.glb', $modelli->first()['modello']);
}
public function test_configurazione_di_un_modello_senza_listino_restituisce_404(): void
{
$this->seed(CatalogoSeeder::class);
$this->getJson('/api/sistemi/pvc/modelli/bilico/configurazione')->assertNotFound();
}
public function test_api_sistema_inesistente_restituisce_404(): void
{
$this->getJson('/api/sistemi/inesistente')->assertNotFound();