jQuery(function ($) {
    $('#nbtwccs_is_multiple_allowed').change(function () {
        var nbtwccs_is_multiple_allowed = parseInt($(this).val(), 10);
        var nbtwccs_is_fixed_enabled = parseInt($('#nbtwccs_is_fixed_enabled').val(), 10);
        
        if (nbtwccs_is_multiple_allowed) {
            $('#nbtwccs_is_fixed_enabled').parents('tr').show(200);
            $('#nbtwccs_is_fixed_coupon').parents('tr').show(200);
            $('#nbtwccs_is_fixed_shipping').parents('tr').show(200);
            if (nbtwccs_is_fixed_enabled) {
                $('#nbtwccs_force_pay_bygeoip_rules').parents('tr').show(200);
            }
        } else {
            $('#nbtwccs_is_fixed_enabled').parents('tr').hide(200);
            $('#nbtwccs_is_fixed_coupon').parents('tr').hide(200);
            $('#nbtwccs_is_fixed_shipping').parents('tr').hide(200);
            $('#nbtwccs_force_pay_bygeoip_rules').parents('tr').hide(200);
        }
    });


    $('#nbtwccs_is_fixed_enabled').change(function () {
        var val = parseInt($(this).val(), 10);

        if (val) {
            if (!confirm("Native woocommerce price filter doesn't see data generated by this feature (for the time being) - its does not see fixed prices. Do you agree use this feature anyway?")) {
                val = 0;
                $(this).val(val);
            }
        }

        if (val) {
            $('#nbtwccs_force_pay_bygeoip_rules').parents('tr').show(200);
        } else {
            $('#nbtwccs_force_pay_bygeoip_rules').parents('tr').hide(200);
        }
    });


    $('#nbtwccs_is_geoip_manipulation').change(function () {
        var val = parseInt($(this).val(), 10);

        if (val) {
            if (!confirm("Native woocommerce price filter doesn't see data generated by this feature (for the time being) - its does not see prices defined by individual geo ip rules. Do you agree use this feature anyway?")) {
                val = 0;
                $(this).val(val);
            }
        }

    });


});

