Actions Modal not displayed on Custom Page
I am trying to use Actions on a Custom Page, but the modal does not open. When I use the identical action on a resource page, it operates as expected.
'''php
class ImportCentre extends Page
{
protected static ?string $navigationIcon = 'fas-folder-open';
protected static ?string $navigationGroup = 'System Settings';
protected static string $view = 'filament.pages.import-centre';
public function importHolidayRequestsAction()
{
return ImportAction::make()
->importer(HolidayRequestImporter::class);
}
public function importOvertimeDataAction()
{
return Action::make('overtime_data')
->form([
Select::make('user')
->placeholder('Select a user')
->options(fn () => User::all()->pluck('name', 'id')->toArray())
->required(),
Select::make('year')
->placeholder('Select a year')
->options(function () {
$years = [];
for ($i = 2020; $i <= now()->year; $i++) {
$years[$i] = $i;
}
return $years;
})
->required(),
FileUpload::make('overtime_log')
->label('Upload Overtime Log')
->acceptedFileTypes(['text/csv'])
->panelLayout('compact')
->required()
->disk('s3')
->visibility('private')
->moveFiles()
->directory('overtime_logs')
])->action(fn(array $data) => (new ImportOvertimeDataAction())->handle($data));
}
}
'''
'''html
<x-filament-panels::page>
<div class="flex">
{{$this->importOvertimeDataAction}}
</div>
</x-filament-panels::page>
'''
Any ideas?
Any ideas?
Solution:Jump to solution
It doesn't mention it in the documentation, and I had the same issue recently, but the Action name has to have a level of similarity to the method name for your action.
Try this:
```php...
5 Replies
Have you implemented the modal blade?
https://filamentphp.com/docs/3.x/support/blade-components/modal
Solution
It doesn't mention it in the documentation, and I had the same issue recently, but the Action name has to have a level of similarity to the method name for your action.
Try this:
If that doesnt work then it is something else.
He is using a Filament action. The blade component is for a custom modal implementation.
Thank you so much π