From be2da9c6e45c675a70fc152931fd1acf05bfbec4 Mon Sep 17 00:00:00 2001 From: ixgadmin Date: Thu, 17 Sep 2026 14:48:23 +0000 Subject: [PATCH] Show the intake lineage and edit controls on the batch detail page --- templates/ops/batch_detail.html | 73 ++++++++++++++++++++++++++++++++- 1 file changed, 72 insertions(+), 1 deletion(-) diff --git a/templates/ops/batch_detail.html b/templates/ops/batch_detail.html index de123e8..40c3529 100644 --- a/templates/ops/batch_detail.html +++ b/templates/ops/batch_detail.html @@ -4,7 +4,11 @@
@@ -29,6 +33,73 @@
+
+
+
+
+
Intake Lineage ({{ lineage|length }})
+ Edit lineage +
+ {% if lineage %} + + + + + + + + + + + + + {% for row in lineage %} + + + + + + + + + {% endfor %} + + + + + + +
IntakeDateReceived (kg)Allocated (kg)Origin ZoneCollector Group
{{ row.harvest_intake.intake_reference }}{{ row.harvest_intake.intake_date|date:'d/m/Y'|default:'-' }}{{ row.harvest_intake.weight_kg|default:'-' }}{{ row.weight_allocated_kg|default:'-' }} + {% if row.harvest_intake.origin_zone %} + {{ row.harvest_intake.origin_zone.zone_code }} + {% if row.harvest_intake.origin_zone.verification_status != 'verified' %} + {{ row.harvest_intake.origin_zone.get_verification_status_display }} + {% endif %} + {% else %}-{% endif %} + {{ row.harvest_intake.collector_group.name|default:'-' }}
Total allocated{{ lineage_allocated }}batch weight {{ batch.weight_kg|default:'-' }} kg
+ {% if lineage_difference > 0 %} +

+ {{ lineage_difference }} kg of this batch is not traced back to a harvest intake. + The platform shows the two figures side by side; it does not reconcile them. +

+ {% elif lineage_difference < 0 %} +

+ The allocated weights are above the batch weight — the usual direction, + since processing loses weight. The platform shows the two figures side by + side; it does not reconcile them. +

+ {% endif %} + {% else %} +

+ No harvest intakes are linked to this batch. Until at least one is, this + batch cannot be traced back to a collector group and an origin zone, and + the due-diligence case for it will fail its lineage check. +

+ {% endif %} +
+
+
+