Compare commits

...

12 Commits

Author SHA1 Message Date
Richard Schreiber
2c5e59b557 fix previousValue calc 2023-06-03 06:52:15 +02:00
Richard Schreiber
73997529c1 Remove from variants 2023-06-03 06:51:59 +02:00
Richard Schreiber
647190368c improve naming 2023-06-02 09:22:24 +02:00
Richard Schreiber
e1e9c94576 remove from add_on step as too complex there 2023-06-02 09:19:53 +02:00
Richard Schreiber
73d2077d67 respect existing items in cart for order_min 2023-06-02 09:14:03 +02:00
Richard Schreiber
956ee2785f refine onchange handling 2023-06-02 09:12:34 +02:00
Richard Schreiber
1b4be10b33 force item-order-min on blur if quantity not 0 2023-06-01 16:19:12 +02:00
Richard Schreiber
883b5e3c1c Presale: respect order-min-quantity 2023-06-01 16:15:14 +02:00
Richard Schreiber
eb3eca45b5 Checkout/Addon: fix spinner button class name 2023-06-01 16:12:54 +02:00
Martin Gross
f7816924b0 Add Chinese (Traditional) (zh_Hant) to list of available languages. 2023-05-31 13:06:31 +02:00
Raphael Michel
12c3fef390 Docs: Add missing navigation node 2023-05-31 12:58:54 +02:00
Raphael Michel
8e39aaa292 Bump version to 4.21.0.dev0 2023-05-31 12:45:24 +02:00
8 changed files with 25 additions and 4 deletions

View File

@@ -18,6 +18,7 @@ at :ref:`plugin-docs`.
item_variations
item_bundles
item_add-ons
item_meta_properties
questions
question_options
quotas

View File

@@ -19,4 +19,4 @@
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see
# <https://www.gnu.org/licenses/>.
#
__version__ = "4.20.0"
__version__ = "4.21.0.dev0"

View File

@@ -80,6 +80,7 @@ ALL_LANGUAGES = [
('de-informal', _('German (informal)')),
('ar', _('Arabic')),
('zh-hans', _('Chinese (simplified)')),
('zh-hant', _('Chinese (traditional)')),
('cs', _('Czech')),
('da', _('Danish')),
('nl', _('Dutch')),

View File

@@ -335,7 +335,7 @@
id="cp_{{ form.pos.pk }}_item_{{ item.id }}"
aria-label="{% blocktrans with item=item.name %}Quantity of {{ item }} to order{% endblocktrans %}"
{% if item.description %} aria-describedby="cp-{{ form.pos.pk }}-item-{{ item.id }}-description"{% endif %}>
<button type="button" data-step="1" data-controls="cp_{{ form.pos.pk }}_item_{{ item.id }}" class="btn btn-default input-item-count-dec" aria-label="{% trans "Increase quantity" %}">+</button>
<button type="button" data-step="1" data-controls="cp_{{ form.pos.pk }}_item_{{ item.id }}" class="btn btn-default input-item-count-inc" aria-label="{% trans "Increase quantity" %}">+</button>
</div>
{% endif %}
</div>

View File

@@ -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 %}

View File

@@ -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 %}

View File

@@ -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 }}"

View File

@@ -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>");