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"), ]))); } }