diff --git a/src/pretix/control/templates/pretixcontrol/subevents/bulk_edit.html b/src/pretix/control/templates/pretixcontrol/subevents/bulk_edit.html index 5025e95c0..e6c989895 100644 --- a/src/pretix/control/templates/pretixcontrol/subevents/bulk_edit.html +++ b/src/pretix/control/templates/pretixcontrol/subevents/bulk_edit.html @@ -5,6 +5,7 @@ {% load captureas %} {% load static %} {% load eventsignal %} +{% load dialog %} {% block title %}{% trans "Change multiple dates" context "subevent" %}{% endblock %} {% block content %}

@@ -182,21 +183,22 @@
{% trans "Quotas" %} - {% if sampled_quotas|default_if_none:"NONE" == "NONE" %} -
- {% blocktrans trimmed %} - You selected a set of dates that currently have different quota setups. You can therefore - not change their quotas in bulk. If you want, you can set up a new set of quotas to - replace the quota setup of all selected dates. - {% endblocktrans %} -
- {% endif %} -
+
+ {% if sampled_quotas|default_if_none:"NONE" == "NONE" %} +
+ {% trans "You selected a set of dates that currently have different quota setups." %} + {% trans "Using this option will delete all current quotas from all selected dates." %} +
+ {% endif %} +
{{ formset.management_form }} {% bootstrap_formset_errors formset %} @@ -271,7 +273,7 @@
{% trans "Check-in lists" %} {% if sampled_lists|default_if_none:"NONE" == "NONE" %} -
+
{% blocktrans trimmed %} You selected a set of dates that currently have different check-in list setups. You can therefore not change their check-in lists in bulk. @@ -367,4 +369,17 @@
+ {% trans "Delete existing quotas" as dialog_title %} + {% trans "Using this option will delete all current quotas from all selected dates." as dialog_text %} + {% trans "This cannot be reverted. Are you sure to proceed?" as dialog_text2 %} + {% dialog "confirm-override-quotas" dialog_title dialog_text|add:" "|add:dialog_text2 icon="trash" %} + + {% enddialog %} {% endblock %} diff --git a/src/pretix/static/pretixcontrol/js/ui/main.js b/src/pretix/static/pretixcontrol/js/ui/main.js index 8156b3433..3b476ab22 100644 --- a/src/pretix/static/pretixcontrol/js/ui/main.js +++ b/src/pretix/static/pretixcontrol/js/ui/main.js @@ -648,18 +648,47 @@ var form_handlers = function (el) { var $checkbox = $(this).find("input[type=checkbox][name=_bulk]"); var $content = $(this).find(".field-content"); var $fields = $content.find("input, select, textarea, button"); + var $dialog = $(this).attr("data-confirm-dialog") ? $($(this).attr("data-confirm-dialog")) : null; + var warningShown = false; + + if ($dialog) { + $dialog.on("close", function () { + if ($dialog.get(0).returnValue === "yes") { + $checkbox.prop("checked", true); + } else { + $checkbox.prop("checked", false); + warningShown = false; + } + update(); + }); + } var update = function () { var isChecked = $checkbox.prop("checked"); + $content.toggleClass("enabled", isChecked); $fields.attr("tabIndex", isChecked ? 0 : -1); } $content.on("focusin change click", function () { if ($checkbox.prop("checked")) return; - $checkbox.prop("checked", true); - update(); + if ($dialog && !warningShown) { + warningShown = true; + $dialog.get(0).showModal(); + } else { + $checkbox.prop("checked", true); + update(); + } }); - $checkbox.on('change', update) + $checkbox.on('change', function () { + var isChecked = $checkbox.prop("checked"); + if (isChecked && $dialog && !warningShown) { + warningShown = true; + $dialog.get(0).showModal(); + } else if (!isChecked) { + warningShown = false; + } + update(); + }) update(); });