protonemedia/laravel-splade

How to trigger a modal (or prompt) in Bulk Action

jadetulda1996 opened this issue · 2 comments

  • Laravel Version: ^10.10
  • PHP Version: ^8.1
  • Splade JS Version (npm): ^1.4.15
  • Splade PHP Version (composer): 1.4.16
  • Dev environment (OS, Sail/Valet/etc): Windows 11

Description:

I have a table that implements bulk action, but I do have a problem, I need to trigger some modal (or prompt) to input a data before processing the bulk action.

Is there any way to implement it on "before" parameter?

Code snippet:

->bulkAction(
     label: 'Payment',
     each: fn(MonthlyDue $monthlyDue) => Toast::info(json_encode($monthlyDue))->autoDismiss(3),
     before: function (array $selectedIds) {
          // TRIGGER MODAL OR PROMPT with input field here
     },
     after: fn() => Toast::info('nahuman nlng')->autoDismiss(5)
)

Thanks in advance for a help!

How?

I wasn't able to solve the problem using bulk actions.

I resolved my problem by implementing different ways outside the SpladeTable Class.