Antoine
Antoine
FFilament
Created by Antoine on 5/6/2024 in #❓┊help
Modal Bug on Livewire Component Form
Hello everyone, I have a FullCalendar Widget that I use on my dashboard that works great. I use this same Widget in a tab of my user edit form as follows:
Tab::make('Planning')
->schema([

Livewire::make(App\Filament\Widgets\Dashboard\CalendarWidget::class),

])
,
Tab::make('Planning')
->schema([

Livewire::make(App\Filament\Widgets\Dashboard\CalendarWidget::class),

])
,
I'm having a focus issue in all modals inside this widget only on my form (see attached video). No issues on the dashboard. My problem doesn't seem to come from the plugin but rather from my livewire component in my form right? I imagine there is a conflict somewhere. Does anyone know where I should look to resolve this issue?
3 replies
FFilament
Created by Antoine on 1/12/2024 in #❓┊help
ColumnSpan : Array to string conversion
Hello everyone, Is it only me who has this problem when I try to make my columns dynamic on any of my fields, I get the following error if I try to return an array from a closure: Array to string conversion Here is my code:
->columnSpan(function($get) {
return $get('show_time') ? [
'default' => 12,
'sm' => 12,
'md' => 3,
'lg' => 3,
'xl' => 3,
'2xl' => 3,
]:[
'default' => 12,
'sm' => 12,
'md' => 9,
'lg' => 9,
'xl' => 9,
'2xl' => 9,
];
})
->columnSpan(function($get) {
return $get('show_time') ? [
'default' => 12,
'sm' => 12,
'md' => 3,
'lg' => 3,
'xl' => 3,
'2xl' => 3,
]:[
'default' => 12,
'sm' => 12,
'md' => 9,
'lg' => 9,
'xl' => 9,
'2xl' => 9,
];
})
Whereas if I pass it an array directly without closure, I have no error. Is this a bug? Or am I the only one getting this problem?
7 replies
FFilament
Created by Antoine on 12/30/2023 in #❓┊help
Is it possible to add a mask to an email?
Is it possible to add a mask to an email? I need to force the user's hand to not be able to write values ​​not present in an email address like '&' or 'é'... I have a regex that works very well:
->regex('/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/ ');
->regex('/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/ ');
Is it possible to have a mask with RawJs in the same way? Like this :
->mask(RawJs::make('/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/'));
->mask(RawJs::make('/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/'));
In v2, we had the opportunity :
->mask(fn (Mask $mask) => $mask->pattern('00/00'))
->mask(fn (Mask $mask) => $mask->pattern('00/00'))
Thanks
5 replies
FFilament
Created by Antoine on 12/3/2023 in #❓┊help
Access any field from form with anonymous action
Hello everybody, I have an anonymous function right in the middle of a form, I want to access my "quantity" field from the action() method of my anonymous function.
TextInput::make('quantity')
->label(__('fields.quantity'))
->numeric()
->step(0.1),

Actions::make([
Action::make('test')
->action(function(Get $get, Set $set, Livewire $livewire) {

// Need to get the value of the step of Quantity field
// Something like this : $livewire->component('quantity')->getStep();
// But doesnt work

// Some code...

}),
])
TextInput::make('quantity')
->label(__('fields.quantity'))
->numeric()
->step(0.1),

Actions::make([
Action::make('test')
->action(function(Get $get, Set $set, Livewire $livewire) {

// Need to get the value of the step of Quantity field
// Something like this : $livewire->component('quantity')->getStep();
// But doesnt work

// Some code...

}),
])
How to do ? I didn't find much choice in the documentation or on the internet... Thank's
7 replies
FFilament
Created by Antoine on 10/5/2023 in #❓┊help
Actions in renderHooks
Hello everyone, I'm trying to return an array of actions in a view that I return through a renderHooks.
public function getViews()
{
return[
Action::make('table')
->action(function() {
dd();
}),
Action::make('list')
->action(function() {
dd();
}),
];
}
public function getViews()
{
return[
Action::make('table')
->action(function() {
dd();
}),
Action::make('list')
->action(function() {
dd();
}),
];
}
@props([
'views' => $this->getViews(),
])

@if ($multipleViews)
<x-filament-tables::actions
:actions="$views"
/>
@endif
@props([
'views' => $this->getViews(),
])

@if ($multipleViews)
<x-filament-tables::actions
:actions="$views"
/>
@endif
My buttons display correctly but do not trigger the action() methods. Anyone know why?
6 replies
FFilament
Created by Antoine on 10/1/2023 in #❓┊help
createOptionUsing() doesn't select new value
Hello everyone, I'm pretty confused because I don't understand where is my error. I have this Select in a Form :
Select::make('filter')
->options(Filter::where('user_id', auth()->user()->id)
->pluck('name', 'id'))
->createOptionForm([
TextInput::make('name')
->required(),
])
->createOptionUsing(function($data) {
$name = $data['name'];
$filter = Filter::create([
'user_id' => auth()->user()->id,
'name' => $name,
]);
return $filter->id;
})
->afterStateUpdated(...)
->live()
Select::make('filter')
->options(Filter::where('user_id', auth()->user()->id)
->pluck('name', 'id'))
->createOptionForm([
TextInput::make('name')
->required(),
])
->createOptionUsing(function($data) {
$name = $data['name'];
$filter = Filter::create([
'user_id' => auth()->user()->id,
'name' => $name,
]);
return $filter->id;
})
->afterStateUpdated(...)
->live()
When I submit my modal, I return the id of my model that I have just created. I debugged $filter->id with dd() before returning it and it exists as well as my row in the database. But it returns null in my component after submit. However, if I return a value manually from an already existing line like: return 1; It selects it well. I tried on another form and I still have the same problem when I create a model row. Did I do something wrong? Or is it another problem? I think I am returning the model before it is created in the Select options, is there a method for resolve this?
4 replies
FFilament
Created by Antoine on 9/28/2023 in #❓┊help
How to add requiresConfirmation() into modalSubmitAction() in Action
Hello, I have an action in my ListRecords page who open a modal and I need to have a modal of confirmation when the user click on the Button Submit.
Action::make('settings')
->form(...)
->action(...)
->modalSubmitAction(fn($action) => $action
->label('Enregistrer')
->requiresConfirmation() // this way doesn't work...
)
->modalCancelAction(fn($action) => $action->label('Fermer'));
Action::make('settings')
->form(...)
->action(...)
->modalSubmitAction(fn($action) => $action
->label('Enregistrer')
->requiresConfirmation() // this way doesn't work...
)
->modalCancelAction(fn($action) => $action->label('Fermer'));
It doesn't work because it's a StaticAction in modalSubmitAction(). How can I do that? Thanks
9 replies
FFilament
Created by Antoine on 9/23/2023 in #❓┊help
Doesn't change on livewire property in getHeaderWidget()
Hello everybody, I have a Livewire property that changes its state based on user interaction on a button in a ListRecords page.
public bool $activeWidget = true;

protected function getHeaderWidgets(): array
{
return $this->activeWidget === true ? $this->getWidgets(): [];
}
public bool $activeWidget = true;

protected function getHeaderWidgets(): array
{
return $this->activeWidget === true ? $this->getWidgets(): [];
}
When the state of $activeWidget changes thanks to user interaction, the widgets disappear but conversely when they need to be displayed nothing happens. When I refresh the page, the widgets display fine. I think there is a problem with updating. If I refresh my component with a method like this $this->dispatch('refresh') only the values ​​of my table are refreshed and not my widgets. Has someone already had this problem?
2 replies
FFilament
Created by Antoine on 8/10/2023 in #❓┊help
Reset in columns toggleable?
13 replies