Laravel confirmation modal / Livewire

Asked

Viewed 20 times

0

Hello, good afternoon.

I have a list of items being listed in Lade with Livewire, but it turns out one of the actions that can be done is to mark the situation as resolved. But this process needs to request a confirmation from the user.

This way I created the modal, but when I click the modal button to confirm the action, it fails to perform the function to update the status

In my index.blade.php, the list items contain this link that calls the modal

<a href="#" wire:click.prevent="actionConfirmation({{ $action->id }})" data-tt="tooltip" data-placement="top" title="Marcar como resolvido"><i class="fa fa-check"></i></a>

in which I pass the action id to be changed when confirmation is done in modal.

Livewire’s Inde.php looks like this:

public function actionConfirmation($idAction){
    $this->idActionConfirmation = $idAction;
    $this-> dispatchBrowserEvent('confirm-action');
}

so far so good, it runs the modal and everything else, now the modal code that is in index.blade.php

<div class="modal fade" id="confirm-action">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title">Atenção</h4>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <form role="form">
                <div class="modal-body">
                    <p>Tem certeza que deseja marcar a ação como resolvida? {{ $idActionConfirmation }}</p>
                </div>
                <div class="modal-footer justify-content-between">
                    <a href="#" class="btn btn-default" data-dismiss="modal" aria-label="Close"><i class="fa fa-times mr-1"></i>  Não</a>
                    <button wire:click="checked()" type="button" class="btn btn-primary"><i class="fa fa-check mr-1"></i> Sim</button>
                </div>
            </form>
        </div>
    </div>
</div>

When the modal opens, I cannot perform the action when I click the Yes button. and neither is the modal getting any value in case I try to call some public variable within it.

can give me a light?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.