mirror of
https://github.com/pretix/pretix.git
synced 2025-12-06 21:42:49 +00:00
add free-price change increment count input if 0
This commit is contained in:
@@ -192,6 +192,9 @@
|
||||
{% else %}
|
||||
<input type="number" class="form-control input-item-count" placeholder="0" min="0"
|
||||
{% if not ev.presale_is_running %}disabled{% endif %}
|
||||
{% if item.free_price %}
|
||||
data-checked-onchange="price-variation-{{ item.pk }}-{{ var.pk }}"
|
||||
{% endif %}
|
||||
max="{{ var.order_max }}"
|
||||
id="variation_{{ item.id }}_{{ var.id }}"
|
||||
name="variation_{{ item.id }}_{{ var.id }}"
|
||||
@@ -321,6 +324,9 @@
|
||||
<input type="number" class="form-control input-item-count" placeholder="0" min="0"
|
||||
{% if not ev.presale_is_running %}disabled{% endif %}
|
||||
{% if itemnum == 1 %}value="1"{% endif %}
|
||||
{% if item.free_price %}
|
||||
data-checked-onchange="price-item-{{ item.pk }}"
|
||||
{% endif %}
|
||||
max="{{ item.order_max }}"
|
||||
name="item_{{ item.id }}"
|
||||
id="item_{{ item.id }}"
|
||||
|
||||
@@ -650,11 +650,12 @@ $(function () {
|
||||
// Lightbox
|
||||
lightbox.init();
|
||||
|
||||
// free-range price input auto-check checkbox
|
||||
// free-range price input auto-check checkbox/set count-input to 1 if 0
|
||||
$("[data-checked-onchange]").each(function() {
|
||||
var countInput = this;
|
||||
$("#" + this.getAttribute("data-checked-onchange")).on("change", function() {
|
||||
if (countInput.type === "checkbox") countInput.checked = true;
|
||||
else if (countInput.value === 0) countInput.value = 1;
|
||||
$(countInput).trigger("change")
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user