Ben
Ben
FFilament
Created by Ben on 12/7/2023 in #❓┊help
Infolist section header actions x-on:click.stop="x-on:click.stop"
No description
3 replies
FFilament
Created by Ben on 9/14/2023 in #❓┊help
Action modal registered using render hook not trigger the modal
I have Livewire component that had an action modal in it. When I click the trigger button, its not trigger the modal. I checked the network tab, its actually dispatch the close-modal instead of open-modal. If I put the button somewhere else (page header action, table header action) it works. How can I achieve this? I just wanted to have button trigger of the modal on topbar. Here are the action snippet
public function addLinkAction(): Actions\Action
{
return Actions\CreateAction::make("add-link")
->label(__('Add Link'))
->icon('heroicon-o-plus')
->size('lg')
->outlined()
->modalWidth('xl')
->extraAttributes(['class' => 'w-full'])
->mutateFormDataUsing(function (array $data): array {
$data['user_id'] = Filament::auth()->id();

return $data;
})
->model(Link::class)
->after(function (self $livewire, Link $record) {
$livewire->redirect(route('filament.app.pages.link', ['link' => $record]));
})
->form([
... // forms
]);
}
public function addLinkAction(): Actions\Action
{
return Actions\CreateAction::make("add-link")
->label(__('Add Link'))
->icon('heroicon-o-plus')
->size('lg')
->outlined()
->modalWidth('xl')
->extraAttributes(['class' => 'w-full'])
->mutateFormDataUsing(function (array $data): array {
$data['user_id'] = Filament::auth()->id();

return $data;
})
->model(Link::class)
->after(function (self $livewire, Link $record) {
$livewire->redirect(route('filament.app.pages.link', ['link' => $record]));
})
->form([
... // forms
]);
}
11 replies
FFilament
Created by Ben on 6/11/2023 in #❓┊help
Reactive field and afterStateUpdated is not update in realtime on Forms\Components\TextInput\Mask
I'm currently create a dependent field using reactive() and afterStateUpdate to update the other field's value in money format. It's working normally on basic TextInput in realtime of course, but it become passive when I using the TextInput\Mask. Is there any way to make the mask update in realtime just like the TextInput? 1st video is TextInput, 2nd video is using TextInput\Mask. Here is the code snippet.
Forms\Components\TextInput::make('amount')
->required()
->reactive()
->default($this->total)
->label(__('Amount'))
->afterStateUpdated(fn (\Closure $set, $state) => $set('debt', $this->total - $state))
->mask(fn (Forms\Components\TextInput\Mask $mask) => $mask->money(prefix: 'Rp ', thousandsSeparator: '.', decimalPlaces: 0)),
Forms\Components\Select::make('product_id')
->options(fn () => $this->items->pluck('name', 'id')->toArray())
->label(__('Select in debt item'))
->required(fn (\Closure $get) => $get('amount') < $this->total)
->hidden(fn (\Closure $get) => $get('amount') >= $this->total),
Forms\Components\TextInput::make('debt')
->label(__('Debt'))
->hidden(fn (\Closure $get) => $get('amount') >= $this->total)
->mask(fn (Forms\Components\TextInput\Mask $mask) => $mask->money(prefix: 'Rp ', thousandsSeparator: '.', decimalPlaces: 0)),
Forms\Components\TextInput::make('amount')
->required()
->reactive()
->default($this->total)
->label(__('Amount'))
->afterStateUpdated(fn (\Closure $set, $state) => $set('debt', $this->total - $state))
->mask(fn (Forms\Components\TextInput\Mask $mask) => $mask->money(prefix: 'Rp ', thousandsSeparator: '.', decimalPlaces: 0)),
Forms\Components\Select::make('product_id')
->options(fn () => $this->items->pluck('name', 'id')->toArray())
->label(__('Select in debt item'))
->required(fn (\Closure $get) => $get('amount') < $this->total)
->hidden(fn (\Closure $get) => $get('amount') >= $this->total),
Forms\Components\TextInput::make('debt')
->label(__('Debt'))
->hidden(fn (\Closure $get) => $get('amount') >= $this->total)
->mask(fn (Forms\Components\TextInput\Mask $mask) => $mask->money(prefix: 'Rp ', thousandsSeparator: '.', decimalPlaces: 0)),
6 replies
FFilament
Created by Ben on 6/10/2023 in #❓┊help
Modal action unexpectedly reset some livewire props value on custom page
9 replies
FFilament
Created by Ben on 5/31/2023 in #❓┊help
Widgets above relations manager
3 replies