actions AND header widget in EditPage not working in v3

Hi, I have a quite normal Resource witch Edit page has some stand Action that opens a modal form. Everything works ok. Now, I want to add up a header widget that shows revellant info in the same Resource Edit page. When I activate the widget, the action buttons stop working. They gray out the page (to open the modal page) but then nothing is shown in the form. I tried with standard Table Widget and with my own and did not work. I guess: a) Form actions are routed to widget livewire instead of the form livewire? or b) The wigdet rendering (which renders AFTER form action buttons) is not playing nice with what filament form expects. In this sense... I tried to avoid a) by showing the data, not as a widget, but as a hook in 'panels::page.header-widgets.before'. So no widget livewire messing up. Yet in this way action buttons do not work neither.
2 Replies
epertinez
epertinezOP12mo ago
When I try to conditionally add the info through hooks in the admin panel... action buttons stop working correctly and the form becomes empty.
class AdminPanelProvider extends PanelProvider
{
public function boot(): void
{
// I don't know how to get the model in PanelProvider.
// So I forge it from the URL.
$invoice_id=substr(strstr(URL::current(),'/admin/invoices/'),16);
$invoice_id=strstr($invoice_id,'/',true);
if ($invoice_id) {
FilamentView::registerRenderHook(
'panels::page.start',
fn (): View => view('livewire.open-tickets',['tickets' => Ticket::where('active',true)->where('client_id',Invoice::find($invoice_id)->customer->id)->get()->toArray()]),
scopes: [
\App\Filament\Resources\InvoiceResource\Pages\CreateInvoice::class,
\App\Filament\Resources\InvoiceResource\Pages\EditInvoice::class,
],
);
}

}
class AdminPanelProvider extends PanelProvider
{
public function boot(): void
{
// I don't know how to get the model in PanelProvider.
// So I forge it from the URL.
$invoice_id=substr(strstr(URL::current(),'/admin/invoices/'),16);
$invoice_id=strstr($invoice_id,'/',true);
if ($invoice_id) {
FilamentView::registerRenderHook(
'panels::page.start',
fn (): View => view('livewire.open-tickets',['tickets' => Ticket::where('active',true)->where('client_id',Invoice::find($invoice_id)->customer->id)->get()->toArray()]),
scopes: [
\App\Filament\Resources\InvoiceResource\Pages\CreateInvoice::class,
\App\Filament\Resources\InvoiceResource\Pages\EditInvoice::class,
],
);
}

}
I know this is a nasty and unappropiated hack...
toeknee
toeknee12mo ago
please read #✅┊rules on code formatting
Want results from more Discord servers?
Add your server