mirror of
https://github.com/pretix/pretix.git
synced 2025-12-05 21:32:28 +00:00
Compare commits
4 Commits
v2023.10.2
...
fix-free-p
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a04610be8 | ||
|
|
5c7210e753 | ||
|
|
9ee9e31e11 | ||
|
|
86167aa967 |
@@ -131,6 +131,7 @@
|
|||||||
<div class="input-group input-group-price">
|
<div class="input-group input-group-price">
|
||||||
<span class="input-group-addon">{{ event.currency }}</span>
|
<span class="input-group-addon">{{ event.currency }}</span>
|
||||||
<input type="number" class="form-control input-item-price"
|
<input type="number" class="form-control input-item-price"
|
||||||
|
id="price-variation-{{form.pos.pk}}-{{ item.pk }}-{{ var.pk }}"
|
||||||
placeholder="0"
|
placeholder="0"
|
||||||
min="{% if event.settings.display_net_prices %}{{ var.display_price.net|money_numberfield:event.currency }}{% else %}{{ var.display_price.gross|money_numberfield:event.currency }}{% endif %}"
|
min="{% if event.settings.display_net_prices %}{{ var.display_price.net|money_numberfield:event.currency }}{% else %}{{ var.display_price.gross|money_numberfield:event.currency }}{% endif %}"
|
||||||
name="cp_{{ form.pos.pk }}_variation_{{ item.id }}_{{ var.id }}_price"
|
name="cp_{{ form.pos.pk }}_variation_{{ item.id }}_{{ var.id }}_price"
|
||||||
@@ -173,6 +174,9 @@
|
|||||||
<label class="item-checkbox-label">
|
<label class="item-checkbox-label">
|
||||||
<input type="checkbox" value="1"
|
<input type="checkbox" value="1"
|
||||||
{% if var.initial %}checked="checked"{% endif %}
|
{% if var.initial %}checked="checked"{% endif %}
|
||||||
|
{% if item.free_price %}
|
||||||
|
data-checked-onchange="price-variation-{{form.pos.pk}}-{{ item.pk }}-{{ var.pk }}"
|
||||||
|
{% endif %}
|
||||||
id="cp_{{ form.pos.pk }}_variation_{{ item.id }}_{{ var.id }}"
|
id="cp_{{ form.pos.pk }}_variation_{{ item.id }}_{{ var.id }}"
|
||||||
name="cp_{{ form.pos.pk }}_variation_{{ item.id }}_{{ var.id }}"
|
name="cp_{{ form.pos.pk }}_variation_{{ item.id }}_{{ var.id }}"
|
||||||
data-exclusive-prefix="cp_{{ form.pos.pk }}_variation_{{ item.id }}_"
|
data-exclusive-prefix="cp_{{ form.pos.pk }}_variation_{{ item.id }}_"
|
||||||
@@ -181,6 +185,9 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
<input type="number" class="form-control input-item-count" placeholder="0" min="0"
|
<input type="number" class="form-control input-item-count" placeholder="0" min="0"
|
||||||
{% if var.initial %}value="{{ var.initial }}"{% endif %}
|
{% if var.initial %}value="{{ var.initial }}"{% endif %}
|
||||||
|
{% if item.free_price %}
|
||||||
|
data-checked-onchange="price-variation-{{form.pos.pk}}-{{ item.pk }}-{{ var.pk }}"
|
||||||
|
{% endif %}
|
||||||
max="{{ c.max_count }}"
|
max="{{ c.max_count }}"
|
||||||
id="cp_{{ form.pos.pk }}_variation_{{ item.id }}_{{ var.id }}"
|
id="cp_{{ form.pos.pk }}_variation_{{ item.id }}_{{ var.id }}"
|
||||||
name="cp_{{ form.pos.pk }}_variation_{{ item.id }}_{{ var.id }}"
|
name="cp_{{ form.pos.pk }}_variation_{{ item.id }}_{{ var.id }}"
|
||||||
@@ -245,6 +252,7 @@
|
|||||||
<div class="input-group input-group-price">
|
<div class="input-group input-group-price">
|
||||||
<span class="input-group-addon">{{ event.currency }}</span>
|
<span class="input-group-addon">{{ event.currency }}</span>
|
||||||
<input type="number" class="form-control input-item-price" placeholder="0"
|
<input type="number" class="form-control input-item-price" placeholder="0"
|
||||||
|
id="price-item-{{ form.pos.pk }}-{{ item.pk }}"
|
||||||
min="{% if event.settings.display_net_prices %}{{ item.display_price.net|money_numberfield:event.currency }}{% else %}{{ item.display_price.gross|money_numberfield:event.currency }}{% endif %}"
|
min="{% if event.settings.display_net_prices %}{{ item.display_price.net|money_numberfield:event.currency }}{% else %}{{ item.display_price.gross|money_numberfield:event.currency }}{% endif %}"
|
||||||
name="cp_{{ form.pos.pk }}_item_{{ item.id }}_price"
|
name="cp_{{ form.pos.pk }}_item_{{ item.id }}_price"
|
||||||
title="{% blocktrans trimmed with item=item.name %}Modify price for {{ item }}{% endblocktrans %}"
|
title="{% blocktrans trimmed with item=item.name %}Modify price for {{ item }}{% endblocktrans %}"
|
||||||
@@ -285,6 +293,9 @@
|
|||||||
{% if c.max_count == 1 or not c.multi_allowed %}
|
{% if c.max_count == 1 or not c.multi_allowed %}
|
||||||
<label class="item-checkbox-label">
|
<label class="item-checkbox-label">
|
||||||
<input type="checkbox" value="1"
|
<input type="checkbox" value="1"
|
||||||
|
{% if item.free_price %}
|
||||||
|
data-checked-onchange="price-item-{{ form.pos.pk }}-{{ item.pk }}"
|
||||||
|
{% endif %}
|
||||||
{% if c.max_count == 1 and c.min_count == 1 and c.items|length == 1 %}
|
{% if c.max_count == 1 and c.min_count == 1 and c.items|length == 1 %}
|
||||||
checked="checked"
|
checked="checked"
|
||||||
required="required"
|
required="required"
|
||||||
@@ -298,6 +309,9 @@
|
|||||||
</label>
|
</label>
|
||||||
{% else %}
|
{% else %}
|
||||||
<input type="number" class="form-control input-item-count" placeholder="0" min="0"
|
<input type="number" class="form-control input-item-count" placeholder="0" min="0"
|
||||||
|
{% if item.free_price %}
|
||||||
|
data-checked-onchange="price-item-{{ form.pos.pk }}-{{ item.pk }}"
|
||||||
|
{% endif %}
|
||||||
max="{{ c.max_count }}"
|
max="{{ c.max_count }}"
|
||||||
{% if item.initial %}value="{{ item.initial }}"{% endif %}
|
{% if item.initial %}value="{{ item.initial }}"{% endif %}
|
||||||
name="cp_{{ form.pos.pk }}_item_{{ item.id }}"
|
name="cp_{{ form.pos.pk }}_item_{{ item.id }}"
|
||||||
|
|||||||
@@ -192,6 +192,9 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
<input type="number" class="form-control input-item-count" placeholder="0" min="0"
|
<input type="number" class="form-control input-item-count" placeholder="0" min="0"
|
||||||
{% if not ev.presale_is_running %}disabled{% endif %}
|
{% 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 }}"
|
max="{{ var.order_max }}"
|
||||||
id="variation_{{ item.id }}_{{ var.id }}"
|
id="variation_{{ item.id }}_{{ var.id }}"
|
||||||
name="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"
|
<input type="number" class="form-control input-item-count" placeholder="0" min="0"
|
||||||
{% if not ev.presale_is_running %}disabled{% endif %}
|
{% if not ev.presale_is_running %}disabled{% endif %}
|
||||||
{% if itemnum == 1 %}value="1"{% endif %}
|
{% if itemnum == 1 %}value="1"{% endif %}
|
||||||
|
{% if item.free_price %}
|
||||||
|
data-checked-onchange="price-item-{{ item.pk }}"
|
||||||
|
{% endif %}
|
||||||
max="{{ item.order_max }}"
|
max="{{ item.order_max }}"
|
||||||
name="item_{{ item.id }}"
|
name="item_{{ item.id }}"
|
||||||
id="item_{{ item.id }}"
|
id="item_{{ item.id }}"
|
||||||
|
|||||||
@@ -650,11 +650,22 @@ $(function () {
|
|||||||
// Lightbox
|
// Lightbox
|
||||||
lightbox.init();
|
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() {
|
$("[data-checked-onchange]").each(function() {
|
||||||
var checkbox = this;
|
var countInput = this;
|
||||||
$("#" + this.getAttribute("data-checked-onchange")).on("change", function() {
|
$("#" + this.getAttribute("data-checked-onchange")).on("change", function() {
|
||||||
checkbox.checked = true;
|
if (countInput.type === "checkbox") {
|
||||||
|
if (countInput.checked) return;
|
||||||
|
countInput.checked = true;
|
||||||
|
}
|
||||||
|
else if (countInput.type === "number" && !countInput.valueAsNumber) {
|
||||||
|
countInput.value = "1";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// in case of a change, trigger event
|
||||||
|
$(countInput).trigger("change");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user