mirror of
https://github.com/pretix/pretix.git
synced 2025-12-05 21:32:28 +00:00
Compare commits
8 Commits
sort-sales
...
add-order-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c5e59b557 | ||
|
|
73997529c1 | ||
|
|
647190368c | ||
|
|
e1e9c94576 | ||
|
|
73d2077d67 | ||
|
|
956ee2785f | ||
|
|
1b4be10b33 | ||
|
|
883b5e3c1c |
@@ -21,7 +21,7 @@
|
||||
</div>
|
||||
<div role="rowgroup" class="firstchild-in-panel">
|
||||
{% for line in cart.positions %}
|
||||
<div role="row" class="row cart-row {% if hide_prices %}hide-prices{% endif %} {% if download %}has-downloads{% endif %}{% if editable %}editable{% endif %}">
|
||||
<div role="row" class="row cart-row {% if hide_prices %}hide-prices{% endif %} {% if download %}has-downloads{% endif %}{% if editable %}editable{% endif %}" data-item="{{ line.item.id }}" data-count="{{ line.count }}">
|
||||
<div role="cell" class="product">
|
||||
<p>
|
||||
{% if line.addon_to %}
|
||||
|
||||
@@ -344,6 +344,7 @@
|
||||
<button type="button" data-step="-1" data-controls="item_{{ item.id }}" class="btn btn-default input-item-count-dec" aria-label="{% trans "Decrease quantity" %}"
|
||||
{% if not ev.presale_is_running %}disabled{% endif %}>-</button>
|
||||
<input type="number" class="form-control input-item-count" placeholder="0" min="0"
|
||||
{% if item.min_per_order and item.min_per_order > 1 %}data-min="{{ item.min_per_order }}"{% endif %}
|
||||
{% if not ev.presale_is_running %}disabled{% endif %}
|
||||
{% if itemnum == 1 %}value="1"{% endif %}
|
||||
{% if item.free_price %}
|
||||
|
||||
@@ -257,6 +257,7 @@
|
||||
<div class="input-item-count-group">
|
||||
<button type="button" data-step="-1" data-controls="variation_{{ item.id }}_{{ var.id }}" class="btn btn-default input-item-count-dec" aria-label="{% trans "Decrease quantity" %}">-</button>
|
||||
<input type="number" class="form-control input-item-count" placeholder="0" min="0"
|
||||
{% if item.min_per_order and item.min_per_order > 1 %}data-min="{{ item.min_per_order }}"{% endif %}
|
||||
max="{{ var.order_max }}"
|
||||
id="variation_{{ item.id }}_{{ var.id }}"
|
||||
name="variation_{{ item.id }}_{{ var.id }}"
|
||||
@@ -400,6 +401,7 @@
|
||||
<button type="button" data-step="-1" data-controls="item_{{ item.id }}" class="btn btn-default input-item-count-dec" aria-label="{% trans "Decrease quantity" %}">-</button>
|
||||
<input type="number" class="form-control input-item-count"
|
||||
placeholder="0" min="0"
|
||||
{% if item.min_per_order and item.min_per_order > 1 %}data-min="{{ item.min_per_order }}"{% endif %}
|
||||
max="{{ item.order_max }}"
|
||||
id="item_{{ item.id }}"
|
||||
name="item_{{ item.id }}"
|
||||
|
||||
@@ -121,10 +121,26 @@ var form_handlers = function (el) {
|
||||
e.preventDefault();
|
||||
var step = parseFloat(this.getAttribute("data-step"));
|
||||
var controls = document.getElementById(this.getAttribute("data-controls"));
|
||||
var currentValue = parseFloat(controls.value);
|
||||
var currentValue = parseFloat(controls.value) || 0;
|
||||
controls.value = Math.max(controls.min, Math.min(controls.max || Number.MAX_SAFE_INTEGER, (currentValue || 0) + step));
|
||||
controls.dispatchEvent(new Event("change"));
|
||||
});
|
||||
el.find("input[data-min]").each(function(i) {
|
||||
this.previousValue = parseFloat(this.value) || 0;
|
||||
}).on("change", function(e) {
|
||||
var currentValue = parseFloat(this.value) || 0;
|
||||
var itemOrderMin = parseFloat(this.getAttribute("data-min")) || 0;
|
||||
if (itemOrderMin) {
|
||||
document.querySelectorAll(".cart-row[data-item='"+this.id.substring(5)+"']").forEach(function(row) {
|
||||
itemOrderMin -= (parseFloat(row.getAttribute("data-count")) || 1)
|
||||
});
|
||||
if (itemOrderMin < 0) itemOrderMin = 0;
|
||||
}
|
||||
if (currentValue && currentValue < itemOrderMin) {
|
||||
this.value = this.previousValue > currentValue ? 0 : itemOrderMin;
|
||||
}
|
||||
this.previousValue = this.value;
|
||||
});
|
||||
|
||||
el.find("script[data-replace-with-qr]").each(function () {
|
||||
var $div = $("<div>");
|
||||
|
||||
Reference in New Issue
Block a user