Files
carmine.savino 06617a985a 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.
2026-10-19 19:49:44 +02:00

55 lines
2.3 KiB
PHP

<?php
namespace App\Filament\Support;
use App\Models\Sistema;
use Filament\Forms;
/** Campi condivisi dalle risorse del catalogo del configuratore. */
class CampiConfiguratore
{
public static function sistema(): Forms\Components\Select
{
return Forms\Components\Select::make('sistema_id')
->label('Sistema')
->relationship('sistema', 'nome')
->default(fn () => Sistema::orderBy('ordine')->value('id'))
->required()
->preload()
->live();
}
public static function immagine(string $campo, string $etichetta, string $cartella): Forms\Components\FileUpload
{
return Forms\Components\FileUpload::make($campo)
->label($etichetta)
->image()
->disk('public')
->directory("configuratore/{$cartella}")
->maxSize(10240);
}
/** Proprietà del materiale Three.js applicate alle mesh della categoria. */
public static function aspetto3d(string $cartella, bool $opacita = false): Forms\Components\Section
{
return Forms\Components\Section::make('Aspetto 3D')
->description('Proprietà del materiale applicate al modello 3D. I campi vuoti lasciano il valore del modello.')
->columns(3)
->collapsible()
->schema(array_values(array_filter([
Forms\Components\ColorPicker::make('colore')->label('Colore'),
$cartella === 'finiture'
? Forms\Components\ColorPicker::make('colore_corpo_base')->label('Colore corpo base')
: null,
Forms\Components\TextInput::make('roughness')->label('Roughness')->numeric()->minValue(0)->maxValue(1)->step(0.01),
Forms\Components\TextInput::make('metalness')->label('Metalness')->numeric()->minValue(0)->maxValue(1)->step(0.01),
$opacita
? Forms\Components\TextInput::make('opacita')->label('Opacità')->numeric()->minValue(0)->maxValue(1)->step(0.01)
: null,
Forms\Components\TextInput::make('bump_scala')->label('Intensità rilievo (bump)')->numeric()->step(0.1),
self::immagine('texture', 'Texture', "{$cartella}/texture"),
self::immagine('texture_bump', 'Texture rilievo (bump)', "{$cartella}/texture"),
])));
}
}