schema([ Forms\Components\TextInput::make('name') ->label('Name') ->required() ->maxLength(255) ->unique(ignoreRecord: true) ->live(onBlur: true), Forms\Components\Select::make('server_placement') ->label('Server Placement') ->options([ 'random' => 'Random Node', 'fill' => 'Fill Nodes (fill each node before moving to the next)', 'least_loaded_server' => 'Least Loaded Node (based on server count)', 'least_loaded_ram' => 'Least Loaded Node (based on RAM)', 'least_loaded_disk' => 'Least Loaded Node (based on disk)', 'least_loaded_cpu' => 'Least Loaded Node (based on CPU)', ]) ->default('least_loaded_server') ->helperText('The settings based on CPU, RAM, and disk must be configured in the node settings.') ->required() ->reactive(), Tabs::make('Tabs') ->persistTabInQueryString() ->columnSpanFull() ->tabs([ Tabs\Tab::make('OS') ->columns(2) ->schema([ Forms\Components\Repeater::make('os') ->relationship('os') ->hiddenLabel() ->disabled(fn (Get $get) => !$get('name')) ->addActionLabel('Add OS') ->schema([ Forms\Components\TextInput::make('name') ->label('Name') ->required() ->maxLength(255) ->placeholder('Enter the name of the OS'), Forms\Components\TextInput::make('vm_id') ->label('VM ID') ->required() ->numeric() ->unique(ignoreRecord: true, modifyRuleUsing: function (Unique $rule, Get $get, $record) { return $rule->where('location_id', $get('id')); }) ->placeholder('Enter the VM ID'), ]) ->cloneable() ->columns(2) ->columnSpanFull(), ]), ]), ]); } public static function table(Table $table): Table { return $table ->columns([ Tables\Columns\TextColumn::make('name')->sortable()->searchable(), Tables\Columns\TextColumn::make('nodes_count') ->label('Nodes') ->sortable() ->searchable() ->counts('nodes') ->formatStateUsing(fn ($state) => $state ?: '0'), ]) ->filters([ // ]) ->actions([ Tables\Actions\EditAction::make(), ]); } public static function getRelations(): array { return [ // ]; } public static function getPages(): array { return [ 'index' => Pages\ListLocations::route('/'), 'create' => Pages\CreateLocation::route('/create'), 'edit' => Pages\EditLocation::route('/{record}/edit'), ]; } }