F
Filament13mo ago
NoxyArg

Group of items inside a group

Hello, is it possible to make a group of items inside another group? as the image shows for example
No description
4 Replies
awcodes
awcodes13mo ago
You can nest any form components as deep as you want. But it needs to make sense with the data.
NoxyArg
NoxyArgOP13mo ago
thanks for the reply 😄 Now I need to insert an item from a repeater, from the outside I can add it fine, but from inside the repeater I don't know how to do it, any ideas? this is my code example:
Select::make('kit_id')
->live()
->options(function () {
return Kit::all()->pluck('code', 'id');
})
->afterStateUpdated(
function ($set) {
$actionEJ = [
['category_id' => 2,'article_id' => 3,'article_quantity' => 12],
['category_id' => 3,'article_id' => 5,'article_quantity' => 22],
];
$set('test', $actionEJ ?? null);
}
),
Forms\Components\Repeater::make('test')
->schema([
Forms\Components\TextInput::make('category_id'),
Forms\Components\TextInput::make('article_id'),
Forms\Components\TextInput::make('article_quantity'),
]),
Select::make('kit_id')
->live()
->options(function () {
return Kit::all()->pluck('code', 'id');
})
->afterStateUpdated(
function ($set) {
$actionEJ = [
['category_id' => 2,'article_id' => 3,'article_quantity' => 12],
['category_id' => 3,'article_id' => 5,'article_quantity' => 22],
];
$set('test', $actionEJ ?? null);
}
),
Forms\Components\Repeater::make('test')
->schema([
Forms\Components\TextInput::make('category_id'),
Forms\Components\TextInput::make('article_id'),
Forms\Components\TextInput::make('article_quantity'),
]),
NoxyArg
NoxyArgOP13mo ago
No description
NoxyArg
NoxyArgOP13mo ago
but if move the select inside the repeater here is the problem

Forms\Components\Repeater::make('test')
->schema([


Select::make('kit_id')
->live()
->options(function () {
return Kit::all()->pluck('code', 'id');
})
->afterStateUpdated(
function ($set) {
$actionEJ = [
['category_id' => 2,'article_id' => 3,'article_quantity' => 12],
['category_id' => 3,'article_id' => 5,'article_quantity' => 22],
];
$set('test', $actionEJ ?? null);
}
),


Forms\Components\TextInput::make('category_id'),
Forms\Components\TextInput::make('article_id'),
Forms\Components\TextInput::make('article_quantity'),
]),

Forms\Components\Repeater::make('test')
->schema([


Select::make('kit_id')
->live()
->options(function () {
return Kit::all()->pluck('code', 'id');
})
->afterStateUpdated(
function ($set) {
$actionEJ = [
['category_id' => 2,'article_id' => 3,'article_quantity' => 12],
['category_id' => 3,'article_id' => 5,'article_quantity' => 22],
];
$set('test', $actionEJ ?? null);
}
),


Forms\Components\TextInput::make('category_id'),
Forms\Components\TextInput::make('article_id'),
Forms\Components\TextInput::make('article_quantity'),
]),
Obviously this doesn't do anything, any ideas? ⬆️
Want results from more Discord servers?
Add your server