F
Filament12mo ago
Bryan

Page refresh when header action is clicked

Hi, is it possible to refresh a page when a header action is being clicked? I tried this so far:
protected $listeners = [
'refreshQuotationRequest' => '$refresh'
];

Actions\Action::make('create-concept-quotation')
->label('Maak concept offerte')
->icon('heroicon-o-document-arrow-up')
->color('info')
->form(
fn (Form $form) => $form->schema([
Select::make('product')
->required()
->label('Product')
->options(fn (WeFactService $weFactService) => $weFactService->allProducts()),
Checkbox::make('sent_mail_directly')
->label('Direct een mail versturen?'),
])
)
->action(function (array $data) {
$chain = [
new AddQuotationToWeFact(
quotationRequestId: $this->record->id,
payload: new ConceptQuotationPayload(strval($data['product']))
),
];

if ($data['sent_mail_directly']) {
$chain[] = new SendQuotationMailFromWeFact(
quotationRequestId: $this->record->id,
);
}

Bus::chain($chain)->dispatch();

Notification::make()
->title('Er wordt een concept offerte aangemaakt in WeFact, dit kan enkele minuten duren.')
->success()
->persistent()
->send();

$this->dispatch('refreshQuotationRequest');
})
->hidden(fn () => $this->record->status !== QuotationRequestStatus::PENDING),
protected $listeners = [
'refreshQuotationRequest' => '$refresh'
];

Actions\Action::make('create-concept-quotation')
->label('Maak concept offerte')
->icon('heroicon-o-document-arrow-up')
->color('info')
->form(
fn (Form $form) => $form->schema([
Select::make('product')
->required()
->label('Product')
->options(fn (WeFactService $weFactService) => $weFactService->allProducts()),
Checkbox::make('sent_mail_directly')
->label('Direct een mail versturen?'),
])
)
->action(function (array $data) {
$chain = [
new AddQuotationToWeFact(
quotationRequestId: $this->record->id,
payload: new ConceptQuotationPayload(strval($data['product']))
),
];

if ($data['sent_mail_directly']) {
$chain[] = new SendQuotationMailFromWeFact(
quotationRequestId: $this->record->id,
);
}

Bus::chain($chain)->dispatch();

Notification::make()
->title('Er wordt een concept offerte aangemaakt in WeFact, dit kan enkele minuten duren.')
->success()
->persistent()
->send();

$this->dispatch('refreshQuotationRequest');
})
->hidden(fn () => $this->record->status !== QuotationRequestStatus::PENDING),
Solution:
Yes this is solved.
Jump to solution
4 Replies
Sawal
Sawal9mo ago
is this solved?
Solution
Bryan
Bryan9mo ago
Yes this is solved.
Shavik
Shavik8mo ago
What was the solution?
Bryan
BryanOP8mo ago
For the situation that I had it was not possible unfortunately.

Did you find this page helpful?