Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Propose] - Quick button with confirmation modal #5763

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

susanu
Copy link
Contributor

@susanu susanu commented Jan 30, 2025

I have some ajax buttons that require extra attention when pressed. For this i would like to implement a confirmation modal, similar to delete buttons.

If this is accepted, i will integrate it into the default quick button with proper translations.

Button configuration example:

CRUD::button('cancel')->stack('line')->view('crud::buttons.quick-confirm')->meta([
    'access' => 'cancel',
    'icon' => 'las la-ban',
    'wrapper' => [
        'href' => fn($entry, $crud) => route('cancel', ['id' => $entry->id]),
    ],
    'ajax' => [
        'method' => 'POST',
        'confirm' => true
    ]
]);

@karandatwani92
Copy link
Contributor

Hey @susanu

Thanks for the feature proposal and the PR🙏
It seems helpful. Someone may need to pass a message(replacing "Are you sure?"):
Screenshot 2025-01-31 at 3 18 15 PM

@pxpm what do you think about this?

@pxpm
Copy link
Contributor

pxpm commented Jan 31, 2025

@susanu green light on this. If you can integrate it with the quick button code that would be super!

[
'ajax' => true,
'confirm' => true //default translations used (by default confirm is false)
'confirm' => [ //if some key like "title" is missing, use the default title.
     'title' => 'some title' // if false, no title
     'icon' => 'some-icon', // if false, no icon
     'body' => 'some body text' // if false no body text
    ]
]

Let me know what you think 👍

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

3 participants