From 97f0bcaca7bd946a2aa9259b8bf6e20005670903 Mon Sep 17 00:00:00 2001 From: Morten Madsen Lyngstad Date: Mon, 7 Jul 2025 10:39:18 +0200 Subject: [PATCH] Add button to link from extraction order to related analysis order --- .../staff/extractionorder_detail.html | 48 +++++++++++-------- src/staff/views.py | 6 +++ 2 files changed, 35 insertions(+), 19 deletions(-) diff --git a/src/staff/templates/staff/extractionorder_detail.html b/src/staff/templates/staff/extractionorder_detail.html index ac5f472f..0101dcce 100644 --- a/src/staff/templates/staff/extractionorder_detail.html +++ b/src/staff/templates/staff/extractionorder_detail.html @@ -3,30 +3,22 @@ {% block content %} - {% fragment as table_header %} - {% #table-cell header=True %}GUID{% /table-cell %} - {% #table-cell header=True %}Type{% /table-cell %} - {% #table-cell header=True %}Species{% /table-cell %} - {% #table-cell header=True %}Markers{% /table-cell %} - {% #table-cell header=True %}Location{% /table-cell %} - {% #table-cell header=True %}Date{% /table-cell %} - {% #table-cell header=True %}Volume{% /table-cell %} - {% endfragment %}

Order {{ object }}

-
-
- - {% object-detail object=object %} - - -
Delivered Samples
-
-

{{ object.samples.count }} samples were delivered

-
+
back Samples + {% if analysis_orders|length > 1 %} + + {% elif analysis_orders|length == 1 %} + Go to {{ analysis_orders.first}} + {% endif %} Assign staff
@@ -46,5 +38,23 @@
Delivered Samples
{% action-button action=to_next_status_url class="bg-secondary text-white" submit_text=btn_name csrf_token=csrf_token %} {% endwith %} {% endif %} + +
+ + {% fragment as table_header %} + {% #table-cell header=True %}GUID{% /table-cell %} + {% #table-cell header=True %}Type{% /table-cell %} + {% #table-cell header=True %}Species{% /table-cell %} + {% #table-cell header=True %}Markers{% /table-cell %} + {% #table-cell header=True %}Location{% /table-cell %} + {% #table-cell header=True %}Date{% /table-cell %} + {% #table-cell header=True %}Volume{% /table-cell %} + {% endfragment %} + + {% object-detail object=object %} + +
Delivered Samples
+
+

{{ object.samples.count }} samples were delivered

{% endblock %} diff --git a/src/staff/views.py b/src/staff/views.py index 7e6a64ec..23573f0e 100644 --- a/src/staff/views.py +++ b/src/staff/views.py @@ -172,6 +172,12 @@ class EquipmentOrderDetailView(StaffMixin, DetailView): class ExtractionOrderDetailView(StaffMixin, DetailView): model = ExtractionOrder + def get_context_data(self, **kwargs: Any) -> dict[str, Any]: + context = super().get_context_data(**kwargs) + extraction_order = self.object + context["analysis_orders"] = extraction_order.analysis_orders.all() + return context + class OrderExtractionSamplesListView(StaffMixin, SingleTableMixin, FilterView): table_pagination = False