InfoList Tabs Query

For example Meetings hasMany resolutions and resolutions table consists of a boolean column 'resolution_passed' as true or false: How to filter as 'Passed' and 'Rejected' and show in separate tabs in infoList tabs: Section::make('Resolutions details') ->schema([ Tabs::make('Resolutions') ->tabs([ Tabs\Tab::make('Passed') ->schema([ // query resolutions where 'resultion_passed' = true ]), Tabs\Tab::make('Rejected') ->schema([ // query resolutions where 'resultion_passed' = false ]), ]) ]) ->compact() ->collapsible()
Solution:
thanks sir....its ->state() ```php Tabs::make('Resolutions Details') ->tabs([ Tabs\Tab::make('Passed')...
Jump to solution
6 Replies
Dennis Koch
Dennis Koch16mo ago
You want to show a table in a tab? You cannot nest tables in forms. You need a custom Livewire component for this. Also please check #✅┊rules on how to format code.
ImShehryar
ImShehryarOP16mo ago
Sure sir.. I am using InfoList Tabs inside my Resource and want to filter the query to show filtered results in separate tabs e.g. one tab showing "Passed" and other tab showing "Rejected" results based on where condition.
Dennis Koch
Dennis Koch16mo ago
You didn't add more information with this. You can try a Repeater if it's related records. But you cannot show a Filament table inside an info list
ImShehryar
ImShehryarOP16mo ago
Yes sir i m using RepeatableEntry inside each tab:
Section::make('Resolutions details')
->schema([
Tabs::make('Resolutions Details')
->tabs([
// how to query like this: $query->where('resolution_passed', true) and show filtered data in 'Passed' Tab
Tabs\Tab::make('Passed')
->schema([
RepeatableEntry::make('resolutions')
->hiddenLabel()
->schema([
TextEntry::make('resolution_no'),
]),
]),
// how to query like this: $query->where('resolution_passed', false) and show filtered in 'Rejected' Tab
Tabs\Tab::make('Rejected')
->schema([
RepeatableEntry::make('resolutions')
->hiddenLabel()
->schema([
TextEntry::make('resolution_no'),
]),
]),
])
])
->compact()
->collapsible()
Section::make('Resolutions details')
->schema([
Tabs::make('Resolutions Details')
->tabs([
// how to query like this: $query->where('resolution_passed', true) and show filtered data in 'Passed' Tab
Tabs\Tab::make('Passed')
->schema([
RepeatableEntry::make('resolutions')
->hiddenLabel()
->schema([
TextEntry::make('resolution_no'),
]),
]),
// how to query like this: $query->where('resolution_passed', false) and show filtered in 'Rejected' Tab
Tabs\Tab::make('Rejected')
->schema([
RepeatableEntry::make('resolutions')
->hiddenLabel()
->schema([
TextEntry::make('resolution_no'),
]),
]),
])
])
->compact()
->collapsible()
I am using the above code inside Resource page infoList:
public static function infolist(Infolist $infolist): Infolist
{
return return $infolist
->schema([
// .....
])
}
public static function infolist(Infolist $infolist): Infolist
{
return return $infolist
->schema([
// .....
])
}
Dennis Koch
Dennis Koch16mo ago
I think you could overwrite is somehow with ->getStateUsing()
Solution
ImShehryar
ImShehryar16mo ago
thanks sir....its ->state()
Tabs::make('Resolutions Details')
->tabs([
Tabs\Tab::make('Passed')
->schema([
RepeatableEntry::make('resolutions')
->hiddenLabel()
->schema([
TextEntry::make('resolution_no'),
])
->state(function (Model $record) {
return $record->resolutions->where('resolution_passed', true);
}),
]),
Tabs\Tab::make('Rejected')
->schema([
RepeatableEntry::make('resolutions')
->hiddenLabel()
->schema([
TextEntry::make('resolution_no'),
])
->state(function (Model $record) {
return $record->resolutions->where('resolution_passed', false);
}),
]),
])
Tabs::make('Resolutions Details')
->tabs([
Tabs\Tab::make('Passed')
->schema([
RepeatableEntry::make('resolutions')
->hiddenLabel()
->schema([
TextEntry::make('resolution_no'),
])
->state(function (Model $record) {
return $record->resolutions->where('resolution_passed', true);
}),
]),
Tabs\Tab::make('Rejected')
->schema([
RepeatableEntry::make('resolutions')
->hiddenLabel()
->schema([
TextEntry::make('resolution_no'),
])
->state(function (Model $record) {
return $record->resolutions->where('resolution_passed', false);
}),
]),
])
Want results from more Discord servers?
Add your server