<script>
    $(document).on('click' , '.visible-row', function (e) {
        e.preventDefault()
        Swal.fire({
            title: '<%= i18n.__("common.continueMessage") %>',
            text: '<%= i18n.__("common.confirmationMessage") %>',
            type: 'warning',
            showCancelButton: true,
            confirmButtonColor: '#3085d6',
            cancelButtonColor: '#d33',
            confirmButtonText: '<%= i18n.__("common.confirm") %>',
            confirmButtonClass: 'btn btn-primary',
            cancelButtonText: '<%= i18n.__("common.cancel") %>',
            cancelButtonClass: 'btn btn-danger ml-1',
            buttonsStyling: false,
        }).then( (result) => {
            if (result.value) {
                // var id = $(this)[0].attributes['id'].nodeValue;
                $.ajax({
                    type: "patch",
                    url: $(this).data('url'),
                    data: {},
                    success:function( res ) {
                        console.log("res",res.key)
                        window.location.reload()
                        if (res === 'success' || res.key == 'success') {
                            Swal.fire(
                                {
                                    position: 'top-center',
                                    icon: 'success',
                                    type: 'success',
                                    title: '<%= i18n.__("common.successMessage") %>',
                                    showConfirmButton: false,
                                    timer: 1500,
                                    confirmButtonClass: 'btn btn-primary',
                                    buttonsStyling: false,
                                })
                        }
                    },error:function (err){
                        console.log("err", err)
                    Swal.fire({
                        a: console.log(err),
                        icon: 'error',
                        title: `${err?.responseJSON?.message || err.responseJSON || err.message}`,
                        showConfirmButton: false,
                        timer: 1500
                     })
                    }
                });
            }
        })
    });
</script>