The batch form refuses to type over a QC status or move a failed batch, and the lineage formset refuses an allocation the intake cannot support. The origin-facility help text and the QC status card now describe what the form actually does, and buyer POSTs to the create and edit screens are refused.
92 lines
3.8 KiB
HTML
92 lines
3.8 KiB
HTML
{% extends 'ops/base_ops.html' %}
|
|
{% block title %}{{ page_title }} - IXG Operations{% endblock %}
|
|
{% block content %}
|
|
|
|
<div class="page-header d-flex justify-content-between align-items-center">
|
|
<h2>{{ page_title }}</h2>
|
|
<a href="{% url 'ops:batch_list' %}" class="btn btn-sm btn-outline-secondary"><i class="bi bi-arrow-left"></i> Back</a>
|
|
</div>
|
|
|
|
<div class="row g-3">
|
|
<div class="col-md-7">
|
|
<div class="stat-card">
|
|
<form method="post" novalidate id="batch-form">
|
|
{% csrf_token %}
|
|
|
|
{% if form.non_field_errors %}
|
|
{% for e in form.non_field_errors %}<div class="alert alert-danger py-2">{{ e }}</div>{% endfor %}
|
|
{% endif %}
|
|
|
|
{% for field in form %}
|
|
<div class="mb-3">
|
|
<label class="form-label" for="{{ field.id_for_label }}">
|
|
{{ field.label }}{% if field.field.required and not field.field.disabled %} <span class="text-danger">*</span>{% endif %}
|
|
</label>
|
|
{{ field }}
|
|
{% if field.help_text %}<div class="form-text">{{ field.help_text }}</div>{% endif %}
|
|
{% for e in field.errors %}<div class="text-danger small">{{ e }}</div>{% endfor %}
|
|
</div>
|
|
{% endfor %}
|
|
|
|
<button type="submit" class="btn btn-primary">{{ submit_label }}</button>
|
|
<a href="{% url 'ops:batch_list' %}" class="btn btn-outline-secondary">Cancel</a>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-5">
|
|
<div class="stat-card mb-3">
|
|
<h6 class="mb-3"><i class="bi bi-diagram-3"></i> What a batch is</h6>
|
|
<p class="small mb-2">
|
|
The batch is the spine of the story: QC results, the certificate of
|
|
analysis, the due-diligence case, shipments and the buyer's view all hang
|
|
off it. If the reference is wrong, everything downstream is wrong with it.
|
|
</p>
|
|
<p class="small mb-0">
|
|
Creating a batch is only half of it. It also needs its <strong>harvest
|
|
intakes</strong> allocated to it, or it cannot be traced back to a
|
|
collector group and an origin zone.
|
|
</p>
|
|
</div>
|
|
|
|
<div class="stat-card mb-3">
|
|
<h6 class="mb-3"><i class="bi bi-shield-check"></i> Who sets the status</h6>
|
|
<ul class="small mb-2 ps-3">
|
|
<li><strong>Harvested, Processing, Ready to Ship, In Transit, At UK Port,
|
|
Customs, Delivered</strong> — moved here, by you.</li>
|
|
<li><strong>QC Fail</strong> — never offered here; set by the platform
|
|
when a QC result is recorded (step 5), because a quality failure must not
|
|
be something a person can type over.</li>
|
|
<li><strong>QC Pass</strong> — appears only as the current value when
|
|
editing a batch that has already passed, so saving alone leaves it alone
|
|
and it can be moved on to the journey statuses.</li>
|
|
</ul>
|
|
<p class="small mb-0">
|
|
A batch sitting on a failed result cannot be moved at all until a new
|
|
result — a retest — is recorded against it.
|
|
</p>
|
|
</div>
|
|
|
|
{% if not creating %}
|
|
<div class="stat-card">
|
|
<h6 class="mb-3"><i class="bi bi-basket"></i> Harvest intakes</h6>
|
|
<p class="small mb-2">
|
|
Which intakes went into this batch, and how much of each. Allocated from
|
|
the intakes screen for the batch.
|
|
</p>
|
|
<a href="{% url 'ops:batch_lineage' form.instance.pk %}" class="btn btn-sm btn-outline-primary">Edit intake lineage</a>
|
|
</div>
|
|
{% else %}
|
|
<div class="stat-card">
|
|
<h6 class="mb-3"><i class="bi bi-basket"></i> Harvest intakes</h6>
|
|
<p class="small mb-2">
|
|
Once the batch exists you will be taken straight to its harvest intakes,
|
|
so you can allocate what went into it. A batch with no intake linked to it
|
|
cannot be traced back to a collector group and an origin zone.
|
|
</p>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
{% endblock %}
|