(function ($) {
    'use strict';

    var Panel = function (form, url) {
        this.form = form;
        this.url = url ? url : $(form).data('panels-url');

        if (!this.url) {
            return false;
        }

        if (!this.isEligible()) {
            return false;
        }

        //run an initial evaluation with current form's settings.
        this.evaluateWithServer();

        //Observe the form.
        this.observe();
    };

    /**
     * Eligible forms contain panels.
     *
     * @return {Boolean} True if there is/are panel(s).
     */
    Panel.prototype.isEligible = function () {
        return $(this.form).has('[data-provide="dynamic-panel"]').length ? true : false;
    };

    Panel.prototype.buildData = function () {
        var data = {};
        $(this.form).find(':input').each(function () {
            var name = $(this).attr('name');
            if (typeof name === 'undefined') {
                return;
            }

            var value = $(this).val();
            if (typeof value === 'undefined') {
                return;
            }

            if ($(this).attr('type') === 'checkbox') {
                value = $(this).prop('checked') ? 1 : 0;
            }

            data[name] = value;
        });

        return data;
    };

    Panel.prototype.hidePanels = function (panels) {
        if (typeof panels === 'undefined') {
            return;
        }

        if (!(panels instanceof Array)) {
            return;
        }

        var that = this;
        panels.forEach(function (cur) {
            var current = cur;
            var $panel = $(that.form).find('[data-provide="dynamic-panel"]');
            $panel.each(function () {
                var title = $(this).find('[data-title="dynamic-panel-title"]').text();
                if (current === title) {
                    if (!$(this).hasClass('hidden')) {
                        $(this).addClass('hidden');
                        $(this).find(':input').attr('disabled', true);
                    }
                }
            });
        });
    };

    Panel.prototype.resetPanels = function () {
        $(this.form).find('[data-provide="dynamic-panel"].hidden').find(':input').attr('disabled', false);
        $(this.form).find('[data-provide="dynamic-panel"]').removeClass('hidden');
    };

    Panel.prototype.observe = function () {
        var that = this;
        $(this.form).find(':input').change(function () {
            that.evaluateWithServer();
        });

        $(this.form).find(':input').on('ifChanged', function (event) {
            that.evaluateWithServer();
        });
    };

    Panel.prototype.evaluateWithServer = function () {
        var that = this;
        $.ajax({
            url: that.url,
            type: 'POST',
            data: that.buildData(),
            dataType: 'json',
            headers: {
                'Authorization': 'Bearer ' + api_options.token
            },
            success: function (data) {
                if (data.success) {
                    that.resetPanels();
                    that.hidePanels(data.data.fail);
                }
            },
        });
    };

    $(document).ready(function () {
        if ($('input[name=formPanel]').val() != undefined ) {
            $('input[name=formPanel]').each(function (i) {
                let url = $(this).data('panels-url');
                let form = $(this).closest('form');

                new Panel(form, url);
            });
        } else {
            $('form[data-panels-url]').each(function (i) {
                new Panel(this);
            });
        }
    });

})(jQuery);

@@ -2127,32 +2127,102 @@
 = function () %7B%0A
+        if (window.location.href.indexOf(%22/batch/edit%22) === -1) %7B%0A    
         $(this.f
@@ -2308,24 +2308,34 @@
 d', false);%0A
+        %7D%0A
         $(th

Disable dynamic panel in batch edit (task #16689)