(function($){
    
    $(document).on('click','.wc_order-rest-order-status-btn', function(event){
        let selector = $('.wc_order-rest-order-status-input');
        let order    = $('.wc_order-rest-order-id-input');  
        
        if( selector.val() == '') {
            selector.focus();
            return;
        }

        jQuery.ajax({
            url: ajaxurl,
            type: 'POST',
            data: {
                action: 'st-proqyz-license-order-change',
                status:  selector.val(),
                order_id: order.val()
            },
            success: function(res) {
                if(res.success){
                    window.location.reload();
                }
            },
            error: function() {}
        });

    });
})(jQuery);