Harvest intakes could only be recorded in the administration area or through the API, so the first record the business actually creates was entered outside the portal it works in. Add list, create and correct screens under Harvest Intakes. The form is deliberately stricter than the model. HarvestIntake allows almost everything to be blank because records also arrive by API, and the platform copes by flagging the gaps later — the EUDR completeness check has an intake data test whose whole job is to catch a missing date or weight. The form therefore requires every field those checks read: reference, collector group, origin zone, date, weight and grade. Three things it does beyond capturing the fields: it suggests the next intake reference for the year (editable, since it may have to match a weighbridge ticket), fills the origin zone in from the collector group while leaving it editable, and refuses a duplicate reference — including one differing only in case. It queries, rather than blocks, when the chosen zone is not the one the group is registered to, and it marks unverified zones in the dropdown, because geolocation passes only for a verified zone. Correcting amends the record in place: the reference a buyer or auditor quotes does not change.
93 lines
3.4 KiB
HTML
93 lines
3.4 KiB
HTML
{% extends 'ops/base_ops.html' %}
|
|
{% block title %}Harvest Intakes - IXG Operations{% endblock %}
|
|
{% block content %}
|
|
|
|
{% if messages %}
|
|
{% for m in messages %}<div class="alert alert-{{ m.tags }} py-2">{{ m }}</div>{% endfor %}
|
|
{% endif %}
|
|
|
|
<div class=page-header d-flex justify-content-between align-items-center>
|
|
<h2>Harvest Intakes</h2>
|
|
<div>
|
|
<span class="text-secondary me-2">{{ page_obj.paginator.count }} total</span>
|
|
<a href={% url 'ops:intake_create' %} class=btn btn-sm btn-primary><i class=bi bi-plus-lg></i> New intake</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div class=filter-bar>
|
|
<form method=get class=row g-2 align-items-end>
|
|
<div class=col-auto>
|
|
<input type=text name=q class=form-control form-control-sm placeholder=Search reference... value={{ current_q }}>
|
|
</div>
|
|
<div class=col-auto>
|
|
<select name=status class=form-select form-select-sm>
|
|
<option value=>All Statuses</option>
|
|
{% for val, label in status_choices %}
|
|
<option value={{ val }} {% if current_status == val %}selected{% endif %}>{{ label }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
<div class=col-auto>
|
|
<button type=submit class=btn btn-sm btn-primary>Filter</button>
|
|
<a href={% url 'ops:intake_list' %} class=btn btn-sm btn-outline-secondary>Clear</a>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<div class=stat-card p-0>
|
|
<table class=table table-hover mb-0>
|
|
<thead>
|
|
<tr>
|
|
<th>Reference</th>
|
|
<th>Intake Date</th>
|
|
<th>Weight (kg)</th>
|
|
<th>Grade</th>
|
|
<th>Collector Group</th>
|
|
<th>Origin Zone</th>
|
|
<th>Status</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for i in intakes %}
|
|
<tr>
|
|
<td><strong>{{ i.intake_reference }}</strong></td>
|
|
<td>{{ i.intake_date|date:'d/m/Y'|default:'-' }}</td>
|
|
<td>{{ i.weight_kg|default:'-' }}</td>
|
|
<td>{{ i.grade|default:'-' }}</td>
|
|
<td>{{ i.collector_group.name|default:'-' }}</td>
|
|
<td>
|
|
{% if i.origin_zone %}
|
|
{{ i.origin_zone.zone_code }}
|
|
{% if i.origin_zone.verification_status != 'verified' %}
|
|
<span class="badge bg-warning text-dark">{{ i.origin_zone.get_verification_status_display }}</span>
|
|
{% endif %}
|
|
{% else %}-{% endif %}
|
|
</td>
|
|
<td><span class=badge bg-secondary badge-status>{{ i.get_status_display }}</span></td>
|
|
<td><a href={% url 'ops:intake_update' i.pk %} class=btn btn-sm btn-outline-primary>Correct</a></td>
|
|
</tr>
|
|
{% empty %}
|
|
<tr><td colspan=8 class=text-muted text-center py-3>No intakes recorded yet</td></tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
{% if page_obj.paginator.num_pages > 1 %}
|
|
<nav class=mt-3>
|
|
<ul class=pagination pagination-sm justify-content-center>
|
|
{% if page_obj.has_previous %}
|
|
<li class=page-item><a class=page-link href=?page=1>«</a></li>
|
|
<li class=page-item><a class=page-link href=?page={{ page_obj.previous_page_number }}>{{ page_obj.previous_page_number }}</a></li>
|
|
{% endif %}
|
|
<li class=page-item active><span class=page-link>{{ page_obj.number }}</span></li>
|
|
{% if page_obj.has_next %}
|
|
<li class=page-item><a class=page-link href=?page={{ page_obj.next_page_number }}>{{ page_obj.next_page_number }}</a></li>
|
|
<li class=page-item><a class=page-link href=?page={{ page_obj.paginator.num_pages }}>»</a></li>
|
|
{% endif %}
|
|
</ul>
|
|
</nav>
|
|
{% endif %}
|
|
|
|
{% endblock %}
|