Add custom labels printed before box and canister slips

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-21 14:01:48 +03:30
parent cb21289876
commit 4d0dad33e6
10 changed files with 322 additions and 18 deletions

View File

@@ -56,6 +56,12 @@
</div>
</div>
<div class="form-group">
<label data-i18n="custom_labels">Custom Labels</label>
<div id="custom-lines" class="custom-lines"></div>
<button type="button" class="btn btn-ghost btn-sm" id="add-custom-line" data-i18n="add_custom_label">+ Add custom label</button>
</div>
<div class="form-group">
<label data-i18n="labels_preview">Labels Generated</label>
<div class="computed-value" style="font-size: 0.9em" id="preview-display">
@@ -85,6 +91,7 @@
<th data-i18n="batch_number">Batch</th>
<th data-i18n="canisters">Canisters</th>
<th data-i18n="boxes">Boxes</th>
<th data-i18n="custom">Custom</th>
<th data-i18n="total_pages">Pages</th>
<th data-i18n="status">Status</th>
<th></th>
@@ -118,6 +125,28 @@
{{ o.box_count }}
{% endif %}
</td>
<td id="custom-{{ o.id }}">
{% if o.custom_labels %}
<div class="custom-label-list">
{% if o.status == 'pending' %}
{% for line in o.custom_labels %}
<div class="count-stepper" data-weight="{{ line.weight }}">
<span class="stepper-label">{{ line.weight }} kg</span>
<button type="button" class="stepper-btn" onclick="adjustCustomCount({{ o.id }}, {{ forloop.counter0 }}, -1)" aria-label="-">−</button>
<span class="cl-count">{{ line.count }}</span>
<button type="button" class="stepper-btn" onclick="adjustCustomCount({{ o.id }}, {{ forloop.counter0 }}, 1)" aria-label="+">+</button>
</div>
{% endfor %}
{% else %}
{% for line in o.custom_labels %}
<div class="mono">{{ line.weight }} kg × {{ line.count }}</div>
{% endfor %}
{% endif %}
</div>
{% else %}
—
{% endif %}
</td>
<td class="mono" id="pages-{{ o.id }}">{{ o.canister_pages|add:o.box_pages }}</td>
<td><span class="badge badge-{{ o.status }}">{{ o.get_status_display }}</span></td>
<td>
@@ -127,7 +156,7 @@
</td>
</tr>
{% empty %}
<tr><td colspan="8" class="empty-state" data-i18n="no_orders">No orders yet</td></tr>
<tr><td colspan="9" class="empty-state" data-i18n="no_orders">No orders yet</td></tr>
{% endfor %}
</tbody>
</table>

View File

@@ -176,6 +176,7 @@
<div class="preview-controls">
<p style="margin-bottom: 10px; font-family: sans-serif;">
Order #{{ order.id }} — {{ order.product.code }} <br>
{% if order.custom_count %}{{ order.custom_count }} Custom |{% endif %}
{{ order.canister_count }} Canisters |
{{ order.box_count }} Boxes |
{{ order.canister_pages|add:order.box_pages }} Pages