95 lines
6.3 KiB
HTML
95 lines
6.3 KiB
HTML
{% extends "base.html" %}
|
||
{% block title %}Sammelbestellung · Fil-A-Management{% endblock %}
|
||
{% block content %}
|
||
<div class="page-heading">
|
||
<div><h1>Sammelbestellung</h1><p class="muted">Bestellwünsche und Lieferstatus pro Person.</p></div>
|
||
<a class="button" href="{% url 'order_add' %}">+ Bestellwunsch hinzufügen</a>
|
||
</div>
|
||
{% if has_bambu_cart %}
|
||
<section class="panel form-panel" aria-label="Bambu-Lab-Warenkorb">
|
||
<form method="post" action="{% url 'bambu_order_cart' %}">
|
||
{% csrf_token %}
|
||
<div class="order-cart-actions">
|
||
<button class="button" type="submit">Bambu-Lab-Warenkorb öffnen</button>
|
||
<button class="button secondary" type="submit" name="action" value="prices">Nur Shoppreise aktualisieren</button>
|
||
</div>
|
||
<p class="hint">Für offene Bambu-Lab-Wünsche aller Personen. Beim Öffnen wird ein vorhandener Warenkorb im Shopify-Shop ersetzt.</p>
|
||
</form>
|
||
</section>
|
||
{% endif %}
|
||
<div class="stats">
|
||
<section class="stat"><span>Rollen insgesamt</span><strong>{{ total }}</strong></section>
|
||
<section class="stat"><span>Verschiedene Varianten</span><strong>{{ variant_count }}</strong></section>
|
||
<section class="stat"><span>Personen mit Bestellwünschen</span><strong>{{ groups|length }}</strong></section>
|
||
</div>
|
||
{% if has_bambu_prices %}<p class="hint">Shoppreise stammen aus dem Warenkorb zum angegebenen Zeitpunkt. Der Rollenpreis ist der gerundete Durchschnitt je Position. Versand und Preisänderungen beim Bezahlen können den Endbetrag verändern.</p>{% endif %}
|
||
{% for group in groups %}
|
||
{% with username=group.username entries=group.entries %}
|
||
<section class="panel">
|
||
<div class="panel-heading"><h2 id="order-person-{{ forloop.counter }}">Bestellwunsch · {{ username }}</h2></div>
|
||
<div class="table-wrap">
|
||
<table class="order-table" aria-labelledby="order-person-{{ forloop.counter }}">
|
||
<thead>
|
||
<tr><th>Stück</th><th>Produktart</th><th>Farbe</th><th title="Hersteller-Farbcode">Artikelnr.</th><th>Spulenausführung</th>{% if has_bambu_prices %}<th>Pro Rolle</th><th>Position gesamt</th>{% endif %}<th>Status</th>{% if entries.0.owner_id == user.pk %}<th><span class="sr-only">Aktionen</span></th>{% endif %}</tr>
|
||
</thead>
|
||
<tbody>
|
||
{% for entry in entries %}
|
||
<tr class="order-row order-row--{{ entry.status }}">
|
||
<td class="quantity">{{ entry.quantity }}</td>
|
||
<td>{{ entry.variant.product_type.name }}<small>{{ entry.variant.manufacturer }}</small></td>
|
||
<td><div class="variant-preview">{% include "filament/variant_thumbnail.html" with variant=entry.variant only %}<strong>{{ entry.variant.color_label }}</strong></div></td>
|
||
<td class="article-number">{{ entry.variant.manufacturer_color_code|default:"–" }}</td>
|
||
<td><span class="badge">{{ entry.variant.get_spool_type_display }}</span>{% if not entry.variant.is_active %}<small class="warning">Deaktiviert · Katalogvariante</small>{% endif %}</td>
|
||
{% if has_bambu_prices %}
|
||
<td>{% if entry.bambu_unit_price is not None %}{{ entry.bambu_unit_price|floatformat:2 }} €{% else %}–{% endif %}</td>
|
||
<td>{% if entry.bambu_line_total is not None %}<strong>{{ entry.bambu_line_total|floatformat:2 }} €</strong><small>{{ entry.bambu_quoted_at|date:"d.m.Y H:i" }}</small>{% if entry.bambu_quote_stale %}<small class="warning">Bestellliste geändert</small>{% endif %}{% else %}–{% endif %}</td>
|
||
{% endif %}
|
||
<td>
|
||
<form class="order-status-form" method="post" action="{% url 'order_status' entry.pk %}">
|
||
{% csrf_token %}
|
||
<input type="hidden" name="expected_status" value="{{ entry.status }}">
|
||
<input type="hidden" name="expected_quantity" value="{{ entry.quantity }}">
|
||
<label class="sr-only" for="order-status-{{ entry.pk }}">Status für {{ username }} · {{ entry.variant }}</label>
|
||
<select id="order-status-{{ entry.pk }}" name="status">
|
||
{% for value, label in status_choices %}
|
||
<option value="{{ value }}"{% if value == entry.status %} selected{% endif %}>{% if value == "handed_over" %}Übergeben und einbuchen{% else %}{{ label }}{% endif %}</option>
|
||
{% endfor %}
|
||
</select>
|
||
<button class="button secondary" type="submit">Speichern</button>
|
||
</form>
|
||
</td>
|
||
{% if entry.owner_id == user.pk %}
|
||
<td class="actions">
|
||
{% if entry.is_pending %}
|
||
<a href="{% url 'order_edit' entry.pk %}">Ändern</a>
|
||
<a class="danger-link" href="{% url 'order_delete' entry.pk %}">Entfernen</a>
|
||
{% endif %}
|
||
</td>
|
||
{% endif %}
|
||
</tr>
|
||
{% endfor %}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<div class="order-person-total">
|
||
{% if group.amount is not None %}
|
||
<div><span>{% if group.missing_prices %}Zwischensumme{% else %}Gesamtbetrag{% endif %}</span> <strong>{{ group.amount|floatformat:2 }} €</strong></div>
|
||
{% elif group.payable_count %}
|
||
<strong>Gesamtbetrag offen</strong>
|
||
{% else %}
|
||
<span>Keine verfügbaren Positionen</span>
|
||
{% endif %}
|
||
{% if group.missing_prices or group.stale_prices %}
|
||
<div class="muted">
|
||
{% if group.missing_prices == 1 %}Für 1 Position fehlt der Preis.{% elif group.missing_prices %}Für {{ group.missing_prices }} Positionen fehlen die Preise.{% endif %}
|
||
{% if group.stale_prices %}Preise vor der letzten Listenänderung.{% endif %}
|
||
</div>
|
||
{% endif %}
|
||
</div>
|
||
</section>
|
||
{% endwith %}
|
||
{% empty %}
|
||
<section class="panel"><div class="empty"><h2>Keine laufenden Bestellwünsche</h2><p>Neue Wünsche erscheinen hier nach Person sortiert.</p><a class="button" href="{% url 'order_add' %}">Bestellwunsch hinzufügen</a></div></section>
|
||
{% endfor %}
|
||
{% endblock %}
|