#Add modal actions in panel header

12 messages · Page 1 of 1 (latest)

spare willow
#

I wanna add a dropdown to the panel header next to the user menu and then use the regular filament Actions (inside an ActionGroup). I know, that this is something similar to awcodes/filament-quick-create, but I need way more customization options.

I could get the dropdown/ActionGroup already working:

// Service provider register():
FilamentView::registerRenderHook(
    PanelsRenderHook::USER_MENU_BEFORE,
    fn (): string => Blade::render("@livewire('admin.quick-create-menu')"),
);
<!-- admin/quick-create-menu.blade.php -->
<div class="flex items-center gap-2">
    {{ $quickCreateMenu }}
</div>
// QuickCreateMenu.php
class QuickCreateMenu extends Component implements HasActions
{
    use InteractsWithActions;

    public function render()
    {
        return view('livewire.admin.quick-create-menu', [
            'quickCreateMenu' => ActionGroup::make([
                Action::make("my-resource")
                  ->label("Create my resource")
                  ->url(route(...))
            ])
              ...
        ]);
    }
}

This is already working. I can click on the ActionGroup-icon in the header, which opens the dropdown and then click on the "Create my resource" link which opens the Create-Page. So far, so good.

The problem comes with actions with modals. None of these actions are doing anything:

Action::make("xxx")
      ->requiresConfirmation()
      ->action(fn() => dd(1)),
Action::make("zzz")
    ->schema([
        TextInput::make("test")
    ])
    ->action(fn($data) => dd($data))

Any ideas how to fix this?

coarse pecan
spare willow
#

Thanks for responding!

I tried this alredy:

<div class="flex items-center gap-2">
    {{ $quickCreateMenu }}
    <x-filament-actions::modals />
</div>
#

Not working

patent isle
#

Make sure you are on ^4.0.2 and run artisan filament:assets.

spare willow
#

Am on 4.0.3 and command was used

patent isle
#

If the actions aren’t defined on the liverwire component they don’t get auto registered in the action cache

spare willow
#

I have this already tried I guess

<div class="flex items-center gap-2">
    {{ $this->quickCreateMenuAction }}
    <x-filament-actions::modals />
</div>
public function quickCreateMenuAction(): ActionGroup
{
    return ActionGroup::make(...)
            ->icon('heroicon-o-plus')
            ->iconButton();
}
#

Property [$quickCreateMenuAction] not found on component: [admin.quick-create-menu]

#

Ok

public function quickCreateMenuAction(): Action
{
    return Action::make("quickCreateMenu")
        ->requiresConfirmation();
}

Is working. So i guess it doesn't work with ActionGroups

patent isle
#

Hmm, sounds like it might be a bug. I would expect groups to work too. 🤔