diff --git a/config/urls.py b/config/urls.py index d1b2b2d..a87dc29 100644 --- a/config/urls.py +++ b/config/urls.py @@ -74,6 +74,11 @@ urlpatterns = [ path("bestand//anbieten/", views.marketplace_offer, name="marketplace_offer"), path("bestellung/", views.orders, name="orders"), path("bestellung/einkaufsliste/", views.order_shopping_list, name="order_shopping_list"), + path( + "bestellung/einkaufsliste/////status/", + views.shopping_order_status, + name="shopping_order_status", + ), path( "bestellung/person//status/", views.person_order_status, diff --git a/docs/DETAILS.md b/docs/DETAILS.md index 026ac9f..7c2fd52 100644 --- a/docs/DETAILS.md +++ b/docs/DETAILS.md @@ -22,6 +22,8 @@ Keine SPA, keine externen Schriften/Skripte, kein externer Datenbankserver. - Sammelbestellung mit separater Tabelle je Person. Angemeldete Mitglieder können den Status einzeln oder für ausgewählte Positionen in der Reihenfolge Offen → Bestellt → Eingetroffen → Übergeben ändern. Teilmengen lassen sich bei Lieferung und Übergabe erfassen. +- Die konsolidierte Bestellliste fasst dieselben laufenden Positionen nach Variante und Status + zusammen. Vor einer Statusänderung lassen sich die betroffenen Positionen je Person auswählen. - Bei Übergabe wird die Menge in den Bestand der Person gebucht. Spule und Refill bleiben getrennt. Bestellte und eingetroffene Positionen sind vor dem Entfernen geschützt. Korrekturen und Stornierungen werden mit Begründung im Bestellverlauf protokolliert. diff --git a/filament/forms.py b/filament/forms.py index 7cb5aa8..30d3f64 100644 --- a/filament/forms.py +++ b/filament/forms.py @@ -262,13 +262,15 @@ class OrderStatusForm(forms.Form): confirmation = forms.CharField(required=False, max_length=100) -class PersonOrderStatusForm(forms.Form): - status = forms.ChoiceField( - choices=[(status, status.label) for status in OrderItem.BULK_STATUS_SOURCES] - ) +class OrderGroupStatusForm(forms.Form): + status = forms.ChoiceField() snapshot = forms.CharField(max_length=64) confirmation = forms.CharField(required=False, max_length=128) + def __init__(self, *args, statuses, **kwargs): + super().__init__(*args, **kwargs) + self.fields["status"].choices = [(status, status.label) for status in statuses] + class OrderAdjustmentForm(forms.Form): status = forms.ChoiceField(label="Aktion") diff --git a/filament/models.py b/filament/models.py index 82ad041..b931fe0 100644 --- a/filament/models.py +++ b/filament/models.py @@ -415,11 +415,7 @@ class OrderItem(QuantityPosition): PENDING_STATUSES = (Status.OPEN, Status.UNAVAILABLE) HISTORY_STATUSES = (Status.HANDED_OVER, Status.CANCELLED) - BULK_STATUS_SOURCES = { - Status.ORDERED: (Status.OPEN,), - Status.ARRIVED: (Status.ORDERED,), - Status.HANDED_OVER: (Status.ARRIVED,), - } + BULK_STATUSES = (Status.ORDERED, Status.ARRIVED, Status.HANDED_OVER) STATUS_TRANSITIONS = { Status.OPEN: (Status.OPEN, Status.UNAVAILABLE, Status.ORDERED), Status.UNAVAILABLE: (Status.UNAVAILABLE, Status.OPEN), @@ -503,6 +499,15 @@ class OrderItem(QuantityPosition): def default_order_variant(self): return next(iter(self.order_variants), None) + @property + def shopping_variant(self): + return self.default_order_variant if self.is_pending else self.variant + + @property + def shopping_spool_type(self): + variant = self.shopping_variant + return variant.spool_type if variant else self.requested_spool_type + @property def available_status_choices(self): return [ diff --git a/filament/services.py b/filament/services.py index 794f656..ee89535 100644 --- a/filament/services.py +++ b/filament/services.py @@ -339,24 +339,30 @@ def person_order_items(owner_id): ) -def person_order_targets(entries, status): - sources = OrderItem.BULK_STATUS_SOURCES.get(status, ()) - return [entry for entry in entries if entry.status in sources] +def order_status_targets(entries, status): + return [ + entry + for entry in entries + if status != entry.status and status in OrderItem.STATUS_TRANSITIONS.get(entry.status, ()) + ] @transaction.atomic -def update_person_order_status(owner_id, status, expected_snapshot, selected_spools): +def update_order_group_status( + positions, status, expected_snapshot, selected_spools, *, spool_type=None +): entries = list( - person_order_items(owner_id) - .select_for_update() + positions.select_for_update() .select_related("variant__product_type__manufacturer", "variant__color") .order_by("pk") ) + if spool_type is not None: + entries = [entry for entry in entries if entry.shopping_spool_type == spool_type] if order_group_snapshot(entries) != expected_snapshot: raise ValidationError( "Die Bestellwünsche haben sich geändert. Bitte prüfe die aktuelle Liste." ) - targets = [item for item in person_order_targets(entries, status) if item.pk in selected_spools] + targets = [item for item in order_status_targets(entries, status) if item.pk in selected_spools] if not targets or len(targets) != len(selected_spools): raise ValidationError("Bitte wähle gültige Positionen für diesen Status aus.") for item in targets: diff --git a/filament/static/filament/order_scroll.js b/filament/static/filament/order_scroll.js new file mode 100644 index 0000000..789c343 --- /dev/null +++ b/filament/static/filament/order_scroll.js @@ -0,0 +1,55 @@ +(() => { + const search = new URL(location.href).searchParams.get("q")?.trim().slice(0, 200) || ""; + const key = `order-scroll:${location.pathname}:${search}`; + + function remember(control) { + const anchor = control.closest("[data-order-anchor]"); + if (!anchor) return; + const neighbor = [anchor.nextElementSibling, anchor.previousElementSibling].find( + (element) => element?.hasAttribute("data-order-anchor"), + ); + const state = { + top: window.scrollY, + anchors: [anchor, neighbor].filter(Boolean).map( + (element) => ({ id: element.id, offset: element.getBoundingClientRect().top }), + ), + }; + try { + sessionStorage.setItem(key, JSON.stringify(state)); + } catch { + // Session storage can be disabled by the browser. + } + } + + function restore() { + let state; + try { + state = JSON.parse(sessionStorage.getItem(key)); + sessionStorage.removeItem(key); + } catch { + return; + } + if (!state) return; + for (const { id, offset } of state.anchors) { + const anchor = document.getElementById(id); + if (anchor) { + window.scrollTo({ top: window.scrollY + anchor.getBoundingClientRect().top - offset }); + return; + } + } + window.scrollTo({ top: state.top }); + } + + document.addEventListener("submit", (event) => { + if (!event.defaultPrevented && event.target.matches("form[data-order-scroll]")) { + remember(event.target); + } + }); + document.addEventListener("click", (event) => { + if (event.defaultPrevented || event.button !== 0 || event.ctrlKey || event.metaKey + || event.shiftKey || event.altKey) return; + const link = event.target.closest("a[data-order-scroll]"); + if (link) remember(link); + }); + window.addEventListener("pageshow", restore); +})(); diff --git a/filament/tests/test_orders.py b/filament/tests/test_orders.py index 3d4f229..a74ea9f 100644 --- a/filament/tests/test_orders.py +++ b/filament/tests/test_orders.py @@ -192,16 +192,93 @@ class SharedOrderTests(CatalogTestCase): self.assertContains(orders, 'aria-label="Artikelnummer 10100 kopieren"', count=5) result = self.client.get(url, {"q": "10100"}) self.assertEqual( - {variant.pk: variant.order_quantity for variant in result.context["variants"]}, + { + group["variant"].pk: group["quantity"] + for group in result.context["groups"] + if group["status"] == OrderItem.Status.OPEN + }, {self.spool.pk: 3, self.refill.pk: 1}, ) - self.assertContains(result, 'aria-label="Artikelnummer 10100 kopieren"', count=2) + self.assertContains(result, 'aria-label="Artikelnummer 10100 kopieren"', count=4) self.assertEqual(result.context["total"], 4) self.assertNotContains(result, "Im Bambu-Shop suchen") self.assertNotContains(result, 'class="article-copy-icon"') self.assertEqual(self.client.get(url, {"q": "10100, 10101"}).context["total"], 5) self.assertEqual(self.client.post(url).status_code, 405) + def test_consolidated_status_updates_selected_recipients_and_preserves_filter(self): + first = OrderItem.objects.create(owner=self.alice, variant=self.spool, quantity=2) + second = OrderItem.objects.create(owner=self.bob, variant=self.spool, quantity=3) + refill = OrderItem.objects.create(owner=self.bob, variant=self.refill, quantity=1) + Variant.objects.filter(pk__in=[self.spool.pk, self.refill.pk]).update( + manufacturer_color_code="10100" + ) + self.client.force_login(self.alice) + listing = reverse("order_shopping_list", query={"q": "10100"}) + self.assertContains(self.client.get(listing), "order_scroll.js") + self.assertContains(self.client.get(reverse("orders")), "order_scroll.js") + source = OrderItem.Status.OPEN + for target in ( + OrderItem.Status.ORDERED, + OrderItem.Status.ARRIVED, + OrderItem.Status.HANDED_OVER, + ): + with self.subTest(target=target): + group = next( + row + for row in self.client.get(listing).context["groups"] + if row["variant"].pk == self.spool.pk and row["status"] == source + ) + url = group["url"] + data = {"status": target, "snapshot": group["snapshot"]} + preview = self.client.post(url, data) + self.assertContains(preview, self.bob.username) + self.assertEqual(preview.context["entries"], [first, second]) + self.assertEqual(preview.context["back_url"], listing) + self.assertFalse(InventoryItem.objects.exists()) + confirmation = self.person_confirmation(data, preview) + rejected = self.client.post( + url, confirmation | {"entry_ids": [first.pk, refill.pk]}, follow=True + ) + self.assertContains(rejected, "Bitte wähle gültige Positionen") + self.assertRedirects(self.client.post(url, confirmation), listing) + self.assertRedirects(self.client.post(url, confirmation), listing) + first.refresh_from_db() + second.refresh_from_db() + self.assertEqual((first.status, second.status), (target, target)) + source = target + quantities = dict( + InventoryItem.objects.filter(variant=self.spool).values_list("owner_id", "quantity") + ) + self.assertEqual(quantities, {self.alice.pk: 2, self.bob.pk: 3}) + self.assertEqual(self.client.get(listing).context["total"], 1) + orders = self.client.get(reverse("orders")) + self.assertContains(orders, f'id="order-item-{refill.pk}"') + self.assertNotContains(orders, f'id="order-item-{first.pk}"') + + def test_consolidated_unavailable_can_be_set_and_reopened_for_part_of_a_group(self): + first = OrderItem.objects.create(owner=self.alice, variant=self.spool, quantity=2) + second = OrderItem.objects.create(owner=self.bob, variant=self.spool, quantity=3) + self.client.force_login(self.alice) + listing = reverse("order_shopping_list") + source = OrderItem.Status.OPEN + for target in (OrderItem.Status.UNAVAILABLE, OrderItem.Status.OPEN): + group = next( + row for row in self.client.get(listing).context["groups"] if row["status"] == source + ) + data = {"status": target, "snapshot": group["snapshot"]} + preview = self.client.post(group["url"], data) + self.assertRedirects( + self.client.post(group["url"], self.person_confirmation(data, preview, [first])), + listing, + ) + self.assertContains(self.client.get(reverse("orders")), f"order-row--{target}") + first.refresh_from_db() + second.refresh_from_db() + self.assertEqual(first.status, target) + self.assertEqual(second.status, OrderItem.Status.OPEN) + source = target + def test_history_is_shared_and_records_order_and_handover_times(self): url = reverse("order_history") self.assertRedirects(self.client.get(url), f"/anmelden/?next={url}") @@ -467,7 +544,7 @@ class SharedOrderTests(CatalogTestCase): product_type=self.product, color=self.black, spool_type=Variant.SpoolType.REFILL ) shopping = self.client.get(reverse("order_shopping_list")) - self.assertEqual([item.pk for item in shopping.context["variants"]], [variant.pk]) + self.assertEqual([row["variant"].pk for row in shopping.context["groups"]], [variant.pk]) self.assertEqual((shopping.context["total"], shopping.context["unavailable"]), (2, 0)) def test_can_explicitly_order_an_allowed_alternative_when_both_types_exist(self): diff --git a/filament/views.py b/filament/views.py index 5163f74..eeb5b4c 100644 --- a/filament/views.py +++ b/filament/views.py @@ -28,10 +28,10 @@ from .forms import ( MountRefillForm, OrderAdjustmentForm, OrderArrivalForm, + OrderGroupStatusForm, OrderHandoverForm, OrderSelectionForm, OrderStatusForm, - PersonOrderStatusForm, PrinterAddonForm, PrinterForm, PrinterNozzleForm, @@ -68,15 +68,15 @@ from .services import ( create_marketplace_offer, mount_refill, order_group_snapshot, + order_status_targets, person_order_items, - person_order_targets, record_order_arrival, remove_inventory_position, take_marketplace_offer, undo_order_handover, update_inventory_position, + update_order_group_status, update_order_status, - update_person_order_status, withdraw_marketplace_offer, ) @@ -984,7 +984,7 @@ def orders(request): for entry in entries } ), - "bulk_statuses": OrderItem.BULK_STATUS_SOURCES, + "bulk_statuses": OrderItem.BULK_STATUSES, }, ) @@ -992,121 +992,209 @@ def orders(request): @login_required @require_http_methods(["GET", "HEAD"]) def order_shopping_list(request): - search = request.GET.get("q", "").strip()[:200] + search = _shopping_search(request) codes = {code.casefold() for code in re.split(r"[\s,;]+", search) if code} if search: codes.add(search.casefold()) grouped = {} + total = 0 unavailable = 0 - for entry in _orders_with_catalog(OrderItem.objects.filter(status=OrderItem.Status.OPEN)): - variant = entry.default_order_variant - if variant is None: - unavailable += entry.quantity + entries = _orders_with_catalog(OrderItem.objects.exclude(status__in=OrderItem.HISTORY_STATUSES)) + for entry in entries: + variant = entry.shopping_variant + article = variant.manufacturer_color_code.strip() if variant else "" + if codes and article.casefold() not in codes: continue - if codes and variant.manufacturer_color_code.strip().casefold() not in codes: - continue - if variant.pk not in grouped: - variant.order_quantity = 0 - variant.alternative_quantity = 0 - grouped[variant.pk] = variant - selected = grouped[variant.pk] - selected.order_quantity += entry.quantity - if variant.spool_type != entry.requested_spool_type: - selected.alternative_quantity += entry.quantity - variants = sorted( - grouped.values(), - key=lambda variant: ( - variant.manufacturer.name, - variant.product_type.name, - variant.color.name, - variant.spool_type, - variant.pk, - ), + spool_type = Variant.SpoolType(entry.shopping_spool_type) + source = OrderItem.Status(entry.status) + reference = variant or entry.variant + key = (source, reference.product_type_id, reference.color_id, spool_type) + if key not in grouped: + grouped[key] = { + "variant": reference, + "spool_type": spool_type, + "article": article, + "available": variant is not None, + "status": source, + "choices": _shopping_status_choices(source, variant is not None), + "quantity": 0, + "alternative_quantity": 0, + "entries": [], + } + group = grouped[key] + group["quantity"] += entry.quantity + group["entries"].append(entry) + if spool_type != entry.requested_spool_type: + group["alternative_quantity"] += entry.quantity + if source == OrderItem.Status.OPEN: + if variant is None: + unavailable += entry.quantity + else: + total += entry.quantity + + groups = [] + for key, group in grouped.items(): + group["anchor"] = "shopping-" + "-".join(str(part) for part in key) + group["url"] = reverse( + "shopping_order_status", args=key, query={"q": search} if search else None + ) + group["snapshot"] = order_group_snapshot(group.pop("entries")) + groups.append(group) + groups.sort( + key=lambda group: ( + group["variant"].manufacturer.name, + group["variant"].product_type.name, + group["variant"].color.name, + group["spool_type"], + OrderItem.Status.values.index(group["status"]), + ) ) return render( request, "filament/order_shopping_list.html", { - "variants": variants, - "total": sum(variant.order_quantity for variant in variants), + "groups": groups, + "total": total, "search": search, "unavailable": unavailable if not search else 0, }, ) +def _shopping_search(request): + return request.GET.get("q", "").strip()[:200] + + +def _shopping_status_choices(source, available=True): + return [ + status + for status in OrderItem.STATUS_TRANSITIONS.get(source, ()) + if status != source and (available or status != OrderItem.Status.ORDERED) + ] + + @login_required @require_http_methods(["POST"]) def person_order_status(request, owner_id): - form = PersonOrderStatusForm(request.POST) + return _order_group_status( + request, + person_order_items(owner_id), + OrderItem.BULK_STATUSES, + reverse("orders"), + by_person=True, + ) + + +@login_required +@require_http_methods(["POST"]) +def shopping_order_status(request, source, product_id, color_id, spool_type): + if source not in OrderItem.STATUS_TRANSITIONS or spool_type not in Variant.SpoolType.values: + raise Http404 + positions = OrderItem.objects.filter( + status=source, variant__product_type_id=product_id, variant__color_id=color_id + ) + search = _shopping_search(request) + return _order_group_status( + request, + positions, + _shopping_status_choices(source), + reverse("order_shopping_list", query={"q": search} if search else None), + spool_type=spool_type, + ) + + +def _order_group_status( + request, positions, statuses, back_url, *, by_person=False, spool_type=None +): + form = OrderGroupStatusForm(request.POST, statuses=statuses) if not form.is_valid(): messages.error(request, "Bitte wähle einen gültigen Status für die Sammeländerung.") - return redirect("orders") + return redirect(back_url) status = form.cleaned_data["status"] snapshot = form.cleaned_data["snapshot"] confirmation = form.cleaned_data["confirmation"] - signer = Signer(salt=f"filament.person_order_status.{request.user.pk}.{owner_id}") + signer = Signer(salt=f"filament.order_group_status.{request.user.pk}.{request.path}") signature_value = f"{status}:{snapshot}" if not confirmation: - return _confirm_person_order_status( - request, owner_id, status, snapshot, signer.sign(signature_value) + return _confirm_order_group_status( + request, + positions, + status, + snapshot, + signer.sign(signature_value), + back_url, + by_person=by_person, + spool_type=spool_type, ) try: if signer.unsign(confirmation) != signature_value: raise BadSignature except BadSignature: messages.error(request, "Bitte bestätige die Sammeländerung erneut.") - return redirect("orders") + return redirect(back_url) selected_spools = { selection_id(value): request.POST.get(f"spool_type_{value}") for value in request.POST.getlist("entry_ids") } try: - entries = update_person_order_status(owner_id, status, snapshot, selected_spools) + entries = update_order_group_status( + positions, status, snapshot, selected_spools, spool_type=spool_type + ) except ValidationError as error: messages.error(request, error.messages[0]) else: if status == OrderItem.Status.HANDED_OVER: total = sum(entry.quantity for entry in entries) + destination = ( + f"im Bestand von {entries[0].owner.username}" + if by_person + else "in die jeweiligen Bestände" + ) messages.success( request, - f"Übergabe gespeichert. {total} Stück im Bestand von " - f"{entries[0].owner.username} eingebucht.", + f"Übergabe gespeichert. {total} Stück {destination} eingebucht.", ) else: - messages.success(request, f"Bestellstatus für {len(entries)} Positionen gespeichert.") - return redirect("orders") + count = len(entries) + label = "Position" if count == 1 else "Positionen" + messages.success(request, f"Bestellstatus für {count} {label} gespeichert.") + return redirect(back_url) -def _confirm_person_order_status(request, owner_id, status, snapshot, confirmation): +def _confirm_order_group_status( + request, positions, status, snapshot, confirmation, back_url, *, by_person, spool_type +): entries = list( - _orders_with_catalog(person_order_items(owner_id)).order_by( - "variant__product_type__name", "variant__color__name", "pk" + _orders_with_catalog(positions).order_by( + "owner__username", "variant__product_type__name", "variant__color__name", "pk" ) ) + if spool_type is not None: + entries = [entry for entry in entries if entry.shopping_spool_type == spool_type] if order_group_snapshot(entries) != snapshot: messages.error( request, "Die Bestellwünsche haben sich geändert. Bitte prüfe die aktuelle Liste." ) - return redirect("orders") - targets = person_order_targets(entries, status) + return redirect(back_url) + targets = order_status_targets(entries, status) if status == OrderItem.Status.ORDERED: targets = [entry for entry in targets if entry.order_variants] if not targets: messages.info(request, "Für diesen Status gibt es keine passenden Bestellpositionen.") - return redirect("orders") + return redirect(back_url) return render( request, - "filament/order_person_status.html", + "filament/order_group_status.html", { - "owner": targets[0].owner, + "owner": targets[0].owner if by_person else None, "entries": targets, "total": sum(entry.quantity for entry in targets), "snapshot": snapshot, "confirmation": confirmation, "status": OrderItem.Status(status), + "back_url": back_url, }, ) diff --git a/templates/filament/order_person_status.html b/templates/filament/order_group_status.html similarity index 79% rename from templates/filament/order_person_status.html rename to templates/filament/order_group_status.html index 45fcb92..1c8b373 100644 --- a/templates/filament/order_person_status.html +++ b/templates/filament/order_group_status.html @@ -5,8 +5,8 @@

{% if status == "handed_over" %}Sammelübergabe bestätigen{% else %}Bestellstatus ändern{% endif %}

-

{{ owner.username }} · {{ status.label }} · {{ total }} Rolle{{ total|pluralize:"n" }} zur Auswahl

- {% if status == "handed_over" %}

Die ausgewählten Rollen werden in den Bestand von {{ owner.username }} eingebucht.

{% endif %} +

{% if owner %}{{ owner.username }} · {% endif %}{{ status.label }} · {{ total }} Rolle{{ total|pluralize:"n" }} zur Auswahl

+ {% if status == "handed_over" %}

Die ausgewählten Rollen werden {% if owner %}in den Bestand von {{ owner.username }}{% else %}in die jeweiligen Bestände{% endif %} eingebucht.

{% endif %}
{% csrf_token %} @@ -18,7 +18,7 @@ {% with catalog=entry.catalog_details %}
diff --git a/templates/filament/order_shopping_list.html b/templates/filament/order_shopping_list.html index e5870aa..4f33d69 100644 --- a/templates/filament/order_shopping_list.html +++ b/templates/filament/order_shopping_list.html @@ -4,33 +4,49 @@ {% block content %} ← Sammelbestellung nach Person
-

Konsolidierte Bestellliste

Offene Bestellwünsche aller Personen, zusammengezählt pro Variante.

+

Konsolidierte Bestellliste

Laufende Bestellpositionen aller Personen, zusammengezählt pro Variante und Status.

{% include "filament/list_search.html" with search_url="order_shopping_list" search_label="Nach einer oder mehreren Artikelnummern suchen" placeholder="Artikelnummern, z. B. 10100, 10604" %} {% if unavailable %}

Für {{ unavailable }} Rolle{{ unavailable|pluralize:"n" }} ist keine zulässige Spulenausführung im Katalog verfügbar.

{% endif %} -{% if variants %} -
+{% if groups %} +
-

{% if search %}Suchergebnis{% else %}Offene Bestellwünsche{% endif %}

- {{ total }} Rolle{{ total|pluralize:"n" }} · {{ variants|length }} Variante{{ variants|length|pluralize:"n" }} +

{% if search %}Suchergebnis{% else %}Bestellpositionen{% endif %}

+ {{ total }} Rolle{{ total|pluralize:"n" }} offen zur Bestellung
- + - {% for variant in variants %} - - + {% for group in groups %} + {% with variant=group.variant %} + + + + - + {% endwith %} {% endfor %}
StückProduktartFarbeSpulenausführungArtikelnr.
StückProduktartFarbeSpulenausführungArtikelnr.Status
{{ variant.order_quantity }}
{{ group.quantity }} {{ variant.product_type.name }}{{ variant.manufacturer }}
{% include "filament/variant_thumbnail.html" with variant=variant only %}{{ variant.color_label }}
- {{ variant.get_spool_type_display }} - {% if variant.alternative_quantity %}Davon {{ variant.alternative_quantity }} als erlaubte Alternative{% endif %} + {{ group.spool_type.label }} + {% if group.alternative_quantity %}Davon {{ group.alternative_quantity }} als erlaubte Alternative{% endif %} + {% if not group.available %}Keine zulässige Ausführung im Katalog{% else %} {% if variant.net_weight_g or variant.diameter_mm %}{% if variant.net_weight_g %}{{ variant.net_weight_g }} g{% endif %}{% if variant.net_weight_g and variant.diameter_mm %} · {% endif %}{% if variant.diameter_mm %}{{ variant.diameter_mm }} mm{% endif %}{% endif %} {% if not variant.is_active %}Katalogvariante deaktiviert{% endif %} + {% endif %} + {% include "filament/order_article_number.html" with article=group.article only %} +
+ {% csrf_token %} + + + + +
{% include "filament/order_article_number.html" with article=variant.manufacturer_color_code.strip only %}
@@ -39,6 +55,7 @@
{% else %} -

{% if search %}Keine offenen Wünsche zu diesen Artikelnummern{% else %}Keine offenen Bestellwünsche{% endif %}

+

{% if search %}Keine laufenden Positionen zu diesen Artikelnummern{% else %}Keine laufenden Bestellpositionen{% endif %}

{% endif %} + {% endblock %} diff --git a/templates/filament/orders.html b/templates/filament/orders.html index c1fa81c..3a48659 100644 --- a/templates/filament/orders.html +++ b/templates/filament/orders.html @@ -16,9 +16,9 @@ {% for username, entries, roll_count, snapshot in groups %}
-
+

Bestellwunsch · {{ username }} · ×{{ roll_count }}

-
+ {% csrf_token %} @@ -37,7 +37,7 @@ {% for entry in entries %} {% with catalog=entry.catalog_details purchase=entry.default_order_variant %} - + {{ entry.quantity }} {{ catalog.product }}{{ catalog.manufacturer }}
{% include "filament/variant_thumbnail.html" with variant=catalog only %}{{ catalog.color }}
@@ -61,7 +61,7 @@ {% if not entry.variant.is_active and not purchase %}Deaktiviert · Katalogvariante{% endif %} - + {% csrf_token %} @@ -80,18 +80,18 @@ {% if entry.owner_id == user.pk and entry.is_pending %} - Ändern + Ändern {% if not entry.adjustments.all %} - Entfernen + Entfernen {% endif %} {% endif %} {% if entry.adjustment_choices %} - {% if entry.is_pending %}Stornieren{% else %}Korrigieren oder stornieren{% endif %} + {% if entry.is_pending %}Stornieren{% else %}Korrigieren oder stornieren{% endif %} {% elif entry.adjustments.all %} - Verlauf + Verlauf {% endif %} {% if entry.status == "ordered" and entry.quantity > 1 %} - Teillieferung erfassen + Teillieferung erfassen {% endif %} @@ -108,4 +108,5 @@

{% endif %} + {% endblock %}