fix: hamburger menu vertical stack, lock paid orders, order cancellation with balance refund, deduplicate admin drawer

This commit is contained in:
2026-09-22 11:27:46 +02:00
parent 896f1d7d08
commit 970f294c9b
6 changed files with 247 additions and 66 deletions
+66 -11
View File
@@ -3,6 +3,18 @@
{% block content %}
<div class="container">
{% if success %}
<div class="alert-success" style="margin-bottom: 20px;">
✓ {{ success }}
</div>
{% endif %}
{% if error %}
<div class="alert-error" style="margin-bottom: 20px;">
⚠️ {{ error }}
</div>
{% endif %}
<!-- Multi-Event Picker (wenn mehrere anstehende Runden offen sind) -->
{% if open_events|length > 1 %}
<div class="multi-event-banner">
@@ -53,6 +65,8 @@
</div>
{% endif %}
{% set is_locked = is_closed or (existing_order and existing_order.is_paid) %}
<!-- Order Form -->
<form action="/order" method="POST" class="order-form" id="orderForm">
<input type="hidden" name="event_id" value="{{ event.id }}">
@@ -65,7 +79,7 @@
<div class="product-list">
{% for product in products %}
{% set current_qty = user_items.get(product.id, 0) %}
<div class="product-card {% if is_closed %}disabled{% endif %}" data-price="{{ product.price }}" data-id="{{ product.id }}">
<div class="product-card {% if is_locked %}disabled{% endif %}" data-price="{{ product.price }}" data-id="{{ product.id }}">
<div class="product-info">
<h3>{{ product.name }}</h3>
<p class="product-desc">{{ product.description }}</p>
@@ -79,9 +93,9 @@
</div>
</div>
<div class="quantity-control">
<button type="button" class="qty-btn" onclick="changeQty({{ product.id }}, -1)" {% if is_closed %}disabled{% endif %}>-</button>
<input type="number" id="qty_{{ product.id }}" name="qty_{{ product.id }}" value="{{ current_qty }}" min="0" max="50" class="qty-input" onchange="updateTotal()" {% if is_closed %}disabled{% endif %}>
<button type="button" class="qty-btn" onclick="changeQty({{ product.id }}, 1)" {% if is_closed %}disabled{% endif %}>+</button>
<button type="button" class="qty-btn" onclick="changeQty({{ product.id }}, -1)" {% if is_locked %}disabled{% endif %}>-</button>
<input type="number" id="qty_{{ product.id }}" name="qty_{{ product.id }}" value="{{ current_qty }}" min="0" max="50" class="qty-input" onchange="updateTotal()" {% if is_locked %}disabled{% endif %}>
<button type="button" class="qty-btn" onclick="changeQty({{ product.id }}, 1)" {% if is_locked %}disabled{% endif %}>+</button>
</div>
</div>
{% endfor %}
@@ -125,11 +139,22 @@
</div>
{% endif %}
{% set is_locked = is_closed or (existing_order and existing_order.is_paid) %}
{% if existing_order %}
<div class="notice-box">
ℹ️ Du hast bereits für diese Runde bestellt ({% if existing_order.is_paid %}<strong>Bereits bezahlt ✓</strong>{% else %}Noch offen{% endif %}).
{% if not is_closed %}Du kannst deine Mengen anpassen und aktualisieren.{% endif %}
</div>
{% if existing_order.is_paid %}
<div class="alert-success" style="margin-bottom: 16px; border-left: 4px solid var(--success); font-size: 0.88rem; line-height: 1.4;">
🔒 <strong>Bestellung bereits bezahlt ({{ "%.2f"|format(existing_order.total_price) }} €)</strong><br>
Deine Bestellung wurde vom Organisator bereits als bezahlt verbucht
({% if existing_order.payment_method == 'balance' %}Guthaben abgebucht{% else %}Barzahlung vermerkt{% endif %}).
Änderungen sind gesperrt. Wende dich an deinen Organisator für Anpassungen.
</div>
{% else %}
<div class="notice-box" style="margin-bottom: 14px;">
ℹ️ Du hast bereits für diese Runde bestellt (Status: <strong>Noch offen</strong>).
{% if not is_closed %}Du kannst deine Mengen bis zum Fristende anpassen oder die Bestellung stornieren.{% endif %}
</div>
{% endif %}
{% endif %}
<hr class="divider">
@@ -145,8 +170,10 @@
</div>
{% endif %}
<button type="submit" class="btn-submit" id="submitBtn" {% if is_closed %}disabled{% endif %}>
{% if is_closed %}
<button type="submit" class="btn-submit" id="submitBtn" {% if is_locked %}disabled{% endif %}>
{% if existing_order and existing_order.is_paid %}
🔒 Bestellung bereits bezahlt & gesperrt
{% elif is_closed %}
🔒 Bestellschluss vorüber
{% elif existing_order %}
🥨 Bestellung aktualisieren
@@ -155,8 +182,18 @@
{% endif %}
</button>
{% if not is_closed %}
{% if existing_order and not existing_order.is_paid and not is_closed %}
<div style="margin-top: 10px;">
<button type="button" onclick="cancelMyOrder()" class="btn-secondary" style="width: 100%; border-color: var(--danger); color: var(--danger); font-size: 0.85rem; padding: 8px 12px; cursor: pointer;">
✕ Bestellung komplett stornieren
</button>
</div>
{% endif %}
{% if not is_closed and not (existing_order and existing_order.is_paid) %}
<small class="form-hint">Du kannst deine Bestellung bis zum Bestellschluss jederzeit hier anpassen.</small>
{% elif existing_order and existing_order.is_paid %}
<small class="form-hint">Bereits abgerechnet – Änderungen nur über den Organisator.</small>
{% else %}
<small class="form-hint text-warning">Die Frist ist abgelaufen.</small>
{% endif %}
@@ -261,6 +298,24 @@
if (timerEl) timerEl.innerText = "Frist beendet";
{% endif %}
function cancelMyOrder() {
if (!confirm('Möchtest du deine Bestellung für diese Runde wirklich komplett stornieren?')) {
return;
}
const form = document.createElement('form');
form.method = 'POST';
form.action = '/order/cancel';
const evInput = document.createElement('input');
evInput.type = 'hidden';
evInput.name = 'event_id';
evInput.value = '{{ event.id if event else "" }}';
form.appendChild(evInput);
document.body.appendChild(form);
form.submit();
}
document.addEventListener('DOMContentLoaded', updateTotal);
</script>
{% endblock %}