Files

134 lines
9.5 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{% extends "base.html" %}
{% load static %}
{% 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>
<div class="order-page-actions">
<a class="button secondary" href="{% url 'order_shopping_list' %}">Konsolidierte Bestellliste</a>
<a class="button" href="{% url 'order_add' %}">+ Bestellwunsch hinzufügen</a>
</div>
</div>
<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>
{% for username, entries, roll_count, snapshot, costs, missing_costs in groups %}
<section class="panel">
<div id="order-owner-{{ entries.0.owner_id }}" class="panel-heading order-person-heading" data-order-anchor>
<h2 id="order-person-{{ forloop.counter }}">Bestellwunsch · {{ username }} · ×{{ roll_count }}</h2>
<form class="order-status-form person-order-status-form" method="post" action="{% url 'person_order_status' entries.0.owner_id %}" data-order-scroll>
{% csrf_token %}
<input type="hidden" name="snapshot" value="{{ snapshot }}">
<label class="sr-only" for="person-order-status-{{ entries.0.owner_id }}">Status gesammelt ändern für {{ username }}</label>
<select id="person-order-status-{{ entries.0.owner_id }}" name="status" required>
<option value="">Status gesammelt ändern</option>
{% for status in bulk_statuses %}<option value="{{ status }}">{{ status.label }}</option>{% endfor %}
</select>
<button class="button secondary" type="submit">Positionen auswählen</button>
</form>
</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><th>Status</th><th>Gesamtpreis (€)</th><th><span class="sr-only">Aktionen</span></th></tr>
</thead>
<tbody>
{% for entry in entries %}
{% with catalog=entry.catalog_details purchase=entry.default_order_variant %}
<tr id="order-item-{{ entry.pk }}" class="order-row order-row--{{ entry.status }}" data-order-anchor>
<td class="quantity">{{ entry.quantity }}</td>
<td>{{ catalog.product }}<small>{{ catalog.manufacturer }}</small></td>
<td><div class="variant-preview">{% include "filament/variant_thumbnail.html" with variant=catalog only %}<strong>{{ catalog.color }}</strong></div></td>
<td class="article-number">
{% if entry.is_pending %}
{% include "filament/order_article_number.html" with article=purchase.manufacturer_color_code.strip icon_only=True only %}
{% else %}
{% include "filament/order_article_number.html" with article=catalog.article_number.strip icon_only=True only %}
{% endif %}
</td>
<td>
<span class="badge">{% if entry.is_pending %}{{ entry.requested_spool_label }}{% else %}{{ catalog.spool }}{% endif %}</span>
<small>{% if entry.allow_alternative_spool %}Alternative erlaubt{% else %}Verbindlich{% endif %}</small>
{% if entry.is_pending and not purchase %}
<small class="warning">Keine zulässige Ausführung im Katalog</small>
{% elif entry.is_pending and purchase.spool_type != entry.requested_spool_type %}
<small>Verfügbare Alternative: {{ purchase.get_spool_type_display }}</small>
{% elif not entry.is_pending and entry.variant.spool_type != entry.requested_spool_type %}
<small>Gewünscht: {{ entry.requested_spool_label }}</small>
{% endif %}
{% if not entry.variant.is_active and not purchase %}<small class="warning">Deaktiviert · Katalogvariante</small>{% endif %}
</td>
<td>
<form class="order-status-form" method="post" action="{% url 'order_status' entry.pk %}" data-order-scroll>
{% csrf_token %}
<input type="hidden" name="expected_status" value="{{ entry.status }}">
<input type="hidden" name="expected_quantity" value="{{ entry.quantity }}">
<input type="hidden" name="expected_revision" value="{{ entry.revision }}">
<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 entry.available_status_choices %}
<option value="{{ value }}"{% if value == entry.status %} selected{% endif %}>{% if value == "handed_over" %}Übergeben und einbuchen{% else %}{{ label }}{% endif %}</option>
{% endfor %}
</select>
{% if entry.status == "open" %}
{% include "filament/order_spool_choice.html" with entry=entry only %}
{% endif %}
<button class="button secondary" type="submit">Speichern</button>
</form>
</td>
<td>
<form class="order-status-form order-amount-form" method="post" action="{% url 'order_amount' entry.pk %}" data-order-scroll>
{% csrf_token %}
<input type="hidden" name="expected_revision" value="{{ entry.revision }}">
<label class="sr-only" for="order-amount-{{ entry.pk }}">Gesamtpreis in Euro für {{ entry.quantity }} × {{ entry.variant }} · {{ username }}</label>
<input id="order-amount-{{ entry.pk }}" name="amount" type="text" inputmode="decimal" maxlength="12" placeholder="0,00" value="{{ entry.total_cost|floatformat:2 }}">
<button class="button secondary" type="submit">Betrag speichern</button>
</form>
</td>
<td>
<div class="order-item-actions">
{% if entry.owner_id == user.pk or not entry.is_pending %}
<a class="button secondary order-icon-button" href="{% url 'order_edit' entry.pk %}" data-order-edit data-order-scroll aria-label="Bestellwunsch bearbeiten" title="Bestellwunsch bearbeiten"><span aria-hidden="true">✎</span></a>
{% elif entry.adjustments.all %}
<a class="button secondary order-icon-button" href="{% url 'order_adjustment' entry.pk %}" data-order-edit data-order-scroll aria-label="Bestellverlauf öffnen" title="Bestellverlauf öffnen"><span aria-hidden="true">✎</span></a>
{% endif %}
{% if entry.owner_id == user.pk and entry.status == "open" and not entry.adjustments.all %}
<a class="button secondary order-icon-button order-delete-icon" href="{% url 'order_delete' entry.pk %}" data-order-edit data-order-scroll aria-label="Bestellwunsch löschen" title="Bestellwunsch löschen"><span aria-hidden="true">×</span></a>
{% endif %}
</div>
</td>
</tr>
{% endwith %}
{% endfor %}
</tbody>
<tfoot>
<tr>
<th colspan="6" scope="row">Gesamtkosten
{% if missing_costs %}<small class="order-missing-costs">{% if missing_costs == 1 %}Ein Betrag fehlt{% else %}{{ missing_costs }} Beträge fehlen{% endif %}</small>{% endif %}
</th>
<td colspan="2" class="order-amount-total">{% if costs is not None %}{{ costs|floatformat:2 }} €{% else %}–{% endif %}</td>
</tr>
</tfoot>
</table>
</div>
</section>
{% 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 %}
{% if groups %}
<dialog class="consume-dialog inventory-dialog" aria-labelledby="order-edit-title" data-order-dialog>
<div class="inventory-dialog-heading">
<h2 id="order-edit-title">Bestellwunsch bearbeiten</h2>
<form method="dialog"><button class="button secondary" type="submit">Schließen</button></form>
</div>
<p data-order-dialog-status role="status"></p>
<div data-order-dialog-content></div>
</dialog>
<p class="sr-only" role="status" data-copy-status></p>
<script src="{% static 'filament/order_article_copy.js' %}" defer></script>
{% endif %}
<script src="{% static 'filament/order_scroll.js' %}" defer></script>
{% endblock %}