Tighten Recent Orders table layout and labels UI

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-24 13:36:26 +03:30
parent def96d1f0a
commit b5e91f3dde
4 changed files with 158 additions and 52 deletions

View File

@@ -82,19 +82,16 @@
<h2 class="card-title" data-i18n="recent_orders">Recent Orders</h2>
<span class="card-badge badge-muted" id="order-count">{{ orders|length }}</span>
</div>
<div class="table-wrap">
<div class="table-wrap table-wrap-capped">
<table class="data-table" id="orders-table">
<thead>
<tr>
<th>#</th>
<th data-i18n="product">Product</th>
<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="labels">Labels</th>
<th data-i18n="total_pages">Pages</th>
<th data-i18n="status">Status</th>
<th></th>
</tr>
</thead>
<tbody id="orders-body">
@@ -103,60 +100,63 @@
<td class="mono">{{ o.id }}</td>
<td>{{ o.product.code }}</td>
<td class="mono">{{ o.batch_number }}</td>
<td>
{% if o.status == 'pending' %}
<div class="count-stepper">
<button type="button" class="stepper-btn" onclick="adjustCount({{ o.id }}, 'canister_count', -1)" aria-label="-">−</button>
<span id="cc-{{ o.id }}">{{ o.canister_count }}</span>
<button type="button" class="stepper-btn" onclick="adjustCount({{ o.id }}, 'canister_count', 1)" aria-label="+">+</button>
</div>
{% else %}
{{ o.canister_count }}
{% endif %}
</td>
<td>
{% if o.status == 'pending' %}
<div class="count-stepper">
<button type="button" class="stepper-btn" onclick="adjustCount({{ o.id }}, 'box_count', -1)" aria-label="-">−</button>
<span id="bc-{{ o.id }}">{{ o.box_count }}</span>
<button type="button" class="stepper-btn" onclick="adjustCount({{ o.id }}, 'box_count', 1)" aria-label="+">+</button>
</div>
{% else %}
{{ o.box_count }}
{% endif %}
</td>
<td id="custom-{{ o.id }}">
{% if o.custom_labels %}
<div class="custom-label-list">
<td class="labels-cell">
<div class="label-counts">
{% 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 class="count-stepper">
<span class="stepper-label">{{ o.canister_weight|floatformat:-2 }} kg</span>
<button type="button" class="stepper-btn" onclick="adjustCount({{ o.id }}, 'canister_count', -1)" aria-label="-">−</button>
<span id="cc-{{ o.id }}">{{ o.canister_count }}</span>
<button type="button" class="stepper-btn" onclick="adjustCount({{ o.id }}, 'canister_count', 1)" aria-label="+">+</button>
</div>
<div class="count-stepper">
<span class="stepper-label">{{ o.box_weight|floatformat:-2 }} kg</span>
<button type="button" class="stepper-btn" onclick="adjustCount({{ o.id }}, 'box_count', -1)" aria-label="-">−</button>
<span id="bc-{{ o.id }}">{{ o.box_count }}</span>
<button type="button" class="stepper-btn" onclick="adjustCount({{ o.id }}, 'box_count', 1)" aria-label="+">+</button>
</div>
{% endfor %}
{% else %}
{% for line in o.custom_labels %}
<div class="mono">{{ line.weight }} kg × {{ line.count }}</div>
{% endfor %}
<div class="mono">{{ o.canister_weight|floatformat:-2 }} kg × <span id="cc-{{ o.id }}">{{ o.canister_count }}</span></div>
<div class="mono">{{ o.box_weight|floatformat:-2 }} kg × <span id="bc-{{ o.id }}">{{ o.box_count }}</span></div>
{% endif %}
<div 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|floatformat:-2 }} 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|floatformat:-2 }} kg × {{ line.count }}</div>
{% endfor %}
{% endif %}
</div>
{% endif %}
</div>
</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>
<td class="status-cell">
{% if o.status == 'pending' %}
<button class="btn btn-ghost btn-sm btn-danger" onclick="deleteOrder({{ o.id }})" data-i18n="remove">Remove</button>
<span class="badge badge-pending">⏳ <span data-i18n="status_pending">Pending</span></span>
<button type="button" class="badge badge-pending" onclick="deleteOrder({{ o.id }})" title="حذف" aria-label="حذف" data-i18n-title="remove" data-i18n-aria="remove">×</button>
{% elif o.status == 'done' %}
<span class="badge badge-done">✓ <span data-i18n="status_done">Done</span></span>
{% elif o.status == 'printing' %}
<span class="badge badge-accent">🖨 <span data-i18n="status_printing">Printing</span></span>
{% else %}
<span class="badge badge-cancelled">✕ <span data-i18n="status_cancelled">Cancelled</span></span>
{% endif %}
</td>
</tr>
{% empty %}
<tr><td colspan="9" class="empty-state" data-i18n="no_orders">No orders yet</td></tr>
<tr><td colspan="6" class="empty-state" data-i18n="no_orders">No orders yet</td></tr>
{% endfor %}
</tbody>
</table>