F
Filament11mo ago
DivDax

Action inside Resource ViewAction blade view

Hey! I have a ViewAction on my ClientResource Table. Inside the show-client view, I load the client-info Livewire component with an action. When I click the button for the first time, nothing happens, but a Livewire update request is fired. On the second click, the modal opens. Do you have any ideas on how to fix that?
ViewAction::make()
->slideOver()
->modalWidth('w-full sm:max-w-7xl')
->modalHeading(fn($record) => __('Client') . ': ' . $record->full_name)
->extraModalFooterActions([
(new ClientEditAction())->editAction(),
])
->form([])
->modalContent(fn($record) => view('show-client', ['client' => $record])),
ViewAction::make()
->slideOver()
->modalWidth('w-full sm:max-w-7xl')
->modalHeading(fn($record) => __('Client') . ': ' . $record->full_name)
->extraModalFooterActions([
(new ClientEditAction())->editAction(),
])
->form([])
->modalContent(fn($record) => view('show-client', ['client' => $record])),
show-client.blade.php
<div>
<livewire:client-info :$client />
</div>
<div>
<livewire:client-info :$client />
</div>
client-info.blade.php
<div>
{{ $this->createAppointmentAction() }}

<x-filament-actions::modals />
</div>
<div>
{{ $this->createAppointmentAction() }}

<x-filament-actions::modals />
</div>
ClientInfo.php
class ClientInfo extends Component implements HasActions, HasForms, HasTable, HasInfolists
{
use InteractsWithActions;
use InteractsWithInfolists;
use InteractsWithForms;
use InteractsWithTable;

public Client $client;

public function createAppointmentAction(): CreateAction
{
return CreateAction::make('createAppointment')
->form([
AppointmentForm::make(),
]);
}
}
class ClientInfo extends Component implements HasActions, HasForms, HasTable, HasInfolists
{
use InteractsWithActions;
use InteractsWithInfolists;
use InteractsWithForms;
use InteractsWithTable;

public Client $client;

public function createAppointmentAction(): CreateAction
{
return CreateAction::make('createAppointment')
->form([
AppointmentForm::make(),
]);
}
}
1 Reply
DivDax
DivDaxOP11mo ago
I added a table builder to my client-info. The action buttons inside the table work on the first click. Anyone has an idea?
Want results from more Discord servers?
Add your server