Your IP : 216.73.217.6


Current Path : /home/smartconb/www/armencom33/acv2026/member/
Upload File :
Current File : /home/smartconb/www/armencom33/acv2026/member/edit.js

$(document).ready(function () {

    $('#sc-user-cancel-btn').on('click', function (e) {
        e.preventDefault();
        window.location.href = './';
    });

    $('#memberFrm').on('submit', function (e) {
        e.preventDefault();
        $('#sc-user-save-btn').click();
    });

    $('#sc-user-save-btn').on('click', function (e) {
        e.preventDefault();

        var invalidElemets = $('#memberFrm *:invalid');
        if (invalidElemets.length > 0) {
            var tmpText = TX_ADMIN_WARNING_FIELD_VALUE_INVALID;
            if (invalidElemets.length > 1)
                tmpText = TX_ADMIN_WARNING_FIELDS_VALUES_INVALID;
            UIkit.notification(
                '<i class="uk-icon-warning"></i> ' + tmpText,
                {
                    status: 'danger',
                    timeout: 5000,
                    pos: 'top-center'
                }
            );

            UIkit.scroll(invalidElemets.first(), {
                duration: 800,
                offset: 80
            });
            invalidElemets.first().focus();
            invalidElemets.first().select();
            return false;
        }

        var postData = {};
        $('.sc-submit-field').each(function () {
            postData[$(this).attr('name')] = $(this).val();
        });

        $.ajax({
            url: 'action.php',
            type: "POST",
            dataType: "json",
            data: postData,
            //{bgclose:false, keyboard:false, modal:false, labels:UI.modal.labels}
            success: function (data, textStatus, jqXHR) {


                if (data.error == 0) {
                    swal({
                        type: 'success',
                        //title: 'Oops...',
                        allowOutsideClick: false,
                        allowEnterKey: false,
                        customClass: 'animated wobble',
                        text: data.message
                    }).then((result) => {
                        window.location.href = './';
                    })

                } else {
                    swal({
                        type: 'error',
                        title: 'Oops...',
                        allowOutsideClick: false,
                        allowEnterKey: false,
                        customClass: 'animated wobble',
                        text: data.message
                    });
                }
            }

        });
    });
});