ImShehryar
ImShehryar
FFilament
Created by ImShehryar on 5/19/2024 in #❓┊help
Open another modal with a form when action is confirmed
Actions\Action::make('updateStatus')
->requiresConfirmation()
->action(function (Component $livewire, Action $action) {
// when the action is confirmed
// open another model containing a form
})
Actions\Action::make('updateStatus')
->requiresConfirmation()
->action(function (Component $livewire, Action $action) {
// when the action is confirmed
// open another model containing a form
})
3 replies
FFilament
Created by ImShehryar on 9/17/2023 in #❓┊help
Make default select option other than the disabled option
how to make a default option other than the disabled option.
Select::make('status')
->options($this-options)
->default(array_key_first($this->options))
->disableOptionWhen(fn (string $value): bool => $value === 'option1')

$options = [
'option1' => 'Option 1', // suppose this is disabled option
'option2' => 'Option 2',
'option3' => 'Option 3',
'option4' => 'Option 4',
'option5' => 'Option 5',
];
Select::make('status')
->options($this-options)
->default(array_key_first($this->options))
->disableOptionWhen(fn (string $value): bool => $value === 'option1')

$options = [
'option1' => 'Option 1', // suppose this is disabled option
'option2' => 'Option 2',
'option3' => 'Option 3',
'option4' => 'Option 4',
'option5' => 'Option 5',
];
8 replies
FFilament
Created by ImShehryar on 8/25/2023 in #❓┊help
DatePicker issue:
Before Upgrading to filamentphp version: v3.0.34, it was working perfectly, now picking a date console gives the following error: Uncaught TypeError: currentNode is null in livewire.js
get children() {
let children = [];
let currentNode = this.startComment.nextSibling;
while (currentNode !== void 0 && currentNode !== this.endComment) {
children.push(currentNode);
currentNode = currentNode.nextSibling;
}
return children;
}
get children() {
let children = [];
let currentNode = this.startComment.nextSibling;
while (currentNode !== void 0 && currentNode !== this.endComment) {
children.push(currentNode);
currentNode = currentNode.nextSibling;
}
return children;
}
Forms\Components\DatePicker::make('meeting_date')
->placeholder('e.g. ' . now()->format('M d, Y'))
->maxDate(now())
->before(now())
->closeOnDateSelection()
->native(false)
->suffixAction(NowAction::make('current_date'))
->required()
->reactive()
->rules([
function (Get $get) {
return function (string $attribute, $value, Closure $fail) use ($get) {
$board = Board::query()
->where('id', $get('board_id'))
->where('entity_id', auth()->user()->entity_id)
->first();

$withInRange = Carbon::parse($value)->between(Carbon::parse($board->start_date)->toDateString(), Carbon::parse($board->end_date)->toDateString());

if (!$withInRange) {
$fail("The meeting date should be within range of board's tenure.");
}
};
},
]);
Forms\Components\DatePicker::make('meeting_date')
->placeholder('e.g. ' . now()->format('M d, Y'))
->maxDate(now())
->before(now())
->closeOnDateSelection()
->native(false)
->suffixAction(NowAction::make('current_date'))
->required()
->reactive()
->rules([
function (Get $get) {
return function (string $attribute, $value, Closure $fail) use ($get) {
$board = Board::query()
->where('id', $get('board_id'))
->where('entity_id', auth()->user()->entity_id)
->first();

$withInRange = Carbon::parse($value)->between(Carbon::parse($board->start_date)->toDateString(), Carbon::parse($board->end_date)->toDateString());

if (!$withInRange) {
$fail("The meeting date should be within range of board's tenure.");
}
};
},
]);
3 replies
FFilament
Created by ImShehryar on 8/22/2023 in #❓┊help
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()
11 replies
FFilament
Created by ImShehryar on 8/21/2023 in #❓┊help
CheckboxList Relationship Options Descriptions
How to get relationship options descriptions ? and the description should be some other column like e.g. designation: Like this: John Doe Programmer Forms\Components\CheckboxList::make('officials') ->label(false) ->relationship('officials', 'first_name', function (Builder $query, Get $get) { return $query ->orderBy('first_name') ->orderBy('last_name') ->where('board_id', $get('board_id')) ->where('member_of_board', true); }) ->getOptionLabelFromRecordUsing(fn (Model $record) => "{$record->first_name} {$record->last_name}") ->hidden(function (Get $get) { return $get('board_id') == false; }) ->columns(['sm' => 2, 'md' => 3, 'lg' => 4]) ->bulkToggleable() ->required() ->gridDirection('row')
7 replies
FFilament
Created by ImShehryar on 5/28/2023 in #❓┊help
CSV file Validation
5 replies
FFilament
Created by ImShehryar on 5/24/2023 in #❓┊help
How to emit event from create action to update the widget stats
6 replies
FFilament
Created by ImShehryar on 5/20/2023 in #❓┊help
How to Update widget on Table Filters "Reset Filters", and Active Filters both X icons
How to Update widget on Table Filters "Reset Filters", and Active Filters both X icons
9 replies
FFilament
Created by ImShehryar on 5/17/2023 in #❓┊help
Show an alert above the table conditionally
How to show an alert or a message above the table if a table column data contains a null value for example...and this message or alert toggles conditionally based on a filter.. Showing a widget above the table does the trick.. but i dont want to run the query in the widget again... Is it possible...
6 replies
FFilament
Created by ImShehryar on 5/12/2023 in #❓┊help
How to update stats wiget data when Reset Filters is called.
7 replies