extraModalFooterActions issues when has form in bulkaction

hi guys i have extraModalFooterAction and inside it there is a form and it is working with normal action but with bulk action new modal form not appearing ??
12 Replies
Ahmed Ali
Ahmed AliOP10mo ago
Tables\Actions\BulkAction::make('pass') ->requiresConfirmation() ->label('النقل') ->modalHeading('نقل للمرحلة التالية') ->modalSubmitActionLabel('النقل') ->modalCancelAction(false) ->modalDescription('تستطيع النقل للمرحلة القادمة وإشعار المتقدم بذلك') ->icon('heroicon-s-check') ->modalIcon('heroicon-s-check') ->visible(fn ($livewire): bool => $livewire->activeTab !== 'accept') ->hidden(function (Application $record) { return $record->deleted_at; }) ->extraModalFooterActions( [ Tables\Actions\Action::make('message') ->modalHeading('اكتب ماتود ارسالة؟') ->label('نقل وارسال رسالة') ->color('gray') ->modalSubmitActionLabel('النقل وارسال الرسالة') ->form( [ RichEditor::make('messages')->required()->label('الرسالة') ] ) ->closeModalByClickingAway(false) ->action(function ($data, Collection $records) { $arr = []; $title = null; foreach ($records as $record) { $title = $title ?? $record->program->name; if (!$record->deleted_at) { $arr[] = $record->applicant->user->email; $record->status_id++; $record->save(); } } Mail::send(new \App\Mail\notification($arr, $title, $data)); }) ->cancelParentActions(), ] ) ->action(function (Collection $records) { foreach ($records as $record) { if (!$record->deleted_at) { $record->status_id++; $record->save(); } } }) ->deselectRecordsAfterCompletion(), any help welcome it is not working because i find Tables\Actions\Action::make('message') and now i replace it to Tables\Actions\BulkAction::make('message') and sadly it still not working but the one different it there is some overlay appearing and previous not happen any one faced problem like this please help ??
Lara Zeus
Lara Zeus10mo ago
what is the error msg or a screenshot of the issue
Ahmed Ali
Ahmed AliOP10mo ago
when click extraModalFooterAction button this overlay appear and nothing also
No description
Ahmed Ali
Ahmed AliOP10mo ago
but when deal with normal action every thing goes well
No description
Lara Zeus
Lara Zeus10mo ago
any console log errors?
Ahmed Ali
Ahmed AliOP10mo ago
no nothing
Lara Zeus
Lara Zeus10mo ago
can you please format your code use


and add php as mentioned here https://discord.com/channels/883083792112300104/883264995603935272 this will help me copy and past your code and make it easier to debug and help you
Ahmed Ali
Ahmed AliOP10mo ago
```
```
php Tables\Actions\BulkAction::make('pass') ->requiresConfirmation() ->label('النقل') ->modalHeading('نقل للمرحلة التالية') ->modalSubmitActionLabel('النقل') ->modalCancelAction(false) ->modalDescription('تستطيع النقل للمرحلة القادمة وإشعار المتقدم بذلك') ->icon('heroicon-s-check') ->modalIcon('heroicon-s-check') ->visible(fn ($livewire): bool => $livewire->activeTab !== 'accept') ->hidden(function (Application $record) { return $record->deleted_at; })

```php
->extraModalFooterActions(
[
Tables\Actions\BulkAction::make('message')
->modalHeading('اكتب ماتود ارسالة؟')
->label('نقل وارسال رسالة')
->color('gray')
->modalSubmitActionLabel('النقل وارسال الرسالة')
->form(
[
RichEditor::make('messages')->required()->label('الرسالة')
]
)
->closeModalByClickingAway(false)
->action(function ($data, Collection $records) {
$arr = [];
$title = null;
foreach ($records as $record) {
$title = $title ?? $record->program->name;
if (!$record->deleted_at) {
$arr[] = $record->applicant->user->email;
$record->status_id++;
$record->save();
}
}
Mail::send(new \App\Mail\notification($arr, $title, $data));
})
->cancelParentActions(),
]
)

```php
->extraModalFooterActions(
[
Tables\Actions\BulkAction::make('message')
->modalHeading('اكتب ماتود ارسالة؟')
->label('نقل وارسال رسالة')
->color('gray')
->modalSubmitActionLabel('النقل وارسال الرسالة')
->form(
[
RichEditor::make('messages')->required()->label('الرسالة')
]
)
->closeModalByClickingAway(false)
->action(function ($data, Collection $records) {
$arr = [];
$title = null;
foreach ($records as $record) {
$title = $title ?? $record->program->name;
if (!$record->deleted_at) {
$arr[] = $record->applicant->user->email;
$record->status_id++;
$record->save();
}
}
Mail::send(new \App\Mail\notification($arr, $title, $data));
})
->cancelParentActions(),
]
)

->action(function (Collection $records) {
foreach ($records as $record) {
if (!$record->deleted_at) {
$record->status_id++;
$record->save();
}
}
})
->deselectRecordsAfterCompletion(),
->action(function (Collection $records) {
foreach ($records as $record) {
if (!$record->deleted_at) {
$record->status_id++;
$record->save();
}
}
})
->deselectRecordsAfterCompletion(),
Lara Zeus
Lara Zeus10mo ago
I don't think nested modal works with bulk actions your code is working fine as an action you can change your approach, why you need the nested action? you can use multiple bulk actions
Ahmed Ali
Ahmed AliOP10mo ago
in my example you can take action for multi records and another option is required form to take action to multi records i guess it the problem from bulkaction but i think this it is bug
Lara Zeus
Lara Zeus10mo ago
if you think it's a bug I recommend to PR it or open a github issue
Ahmed Ali
Ahmed AliOP10mo ago
thanks @Lara Zeus
Want results from more Discord servers?
Add your server