Files
product-slip/slips/templates/slips/entry.html
diaco a3a99411c6 Show New Order dates as dd/mm/yyyy (#13)
Co-authored-by: Cursor <cursoragent@cursor.com>
Reviewed-on: #13
Co-authored-by: diaco <dyaco8464@yahoo.com>
Co-committed-by: diaco <dyaco8464@yahoo.com>
2026-10-04 10:58:56 +00:00

146 lines
6.7 KiB
HTML

{% extends 'slips/base.html' %}
{% load static %}
{% block title %}Data Entry — Lithium | Print Label{% endblock %}
{% block nav_entry_active %}active{% endblock %}
{% block content %}
<div class="page-grid">
<!-- New Order Form -->
<section class="card glass-card">
<div class="card-header">
<h2 class="card-title" data-i18n="new_order">New Order</h2>
<span class="card-badge badge-accent">📋</span>
</div>
<form id="order-form" class="form-stack">
<div class="form-group">
<label for="product" data-i18n="product">Product</label>
<select id="product" required>
<option value="">— Select —</option>
{% for p in products %}
<option value="{{ p.id }}" data-weight="{{ p.default_net_weight }}">
{{ p.code }} — {{ p.description }}
</option>
{% endfor %}
</select>
<button type="button" class="btn btn-sm btn-ghost" onclick="showAddProduct()" data-i18n="add_product">+ Add New Product</button>
</div>
<!-- Add Product Inline (hidden) -->
<div id="add-product-panel" class="sub-panel" style="display:none;">
<div class="form-row">
<div class="form-group">
<label for="new-code" data-i18n="product_code">Product Code</label>
<input type="text" id="new-code" placeholder="ICJ/000">
</div>
<div class="form-group">
<label for="new-desc" data-i18n="description">Description</label>
<input type="text" id="new-desc" placeholder="DIGITAL INK ...">
</div>
<div class="form-group">
<label for="new-weight" data-i18n="default_weight">Default Weight</label>
<input type="number" id="new-weight" value="5" step="1" min="1">
</div>
</div>
<div class="form-actions-inline">
<button type="button" class="btn btn-accent btn-sm" onclick="addProduct()" data-i18n="save">Save</button>
<button type="button" class="btn btn-ghost btn-sm" onclick="hideAddProduct()" data-i18n="cancel">Cancel</button>
</div>
</div>
<div class="form-group">
<label for="batch" data-i18n="batch_number">Batch #</label>
<input type="text" id="batch" required placeholder="1028/26">
</div>
<div class="form-row">
<div class="form-group">
<label for="prod-date" data-i18n="date">Date</label>
<input type="text" id="prod-date" required placeholder="dd/mm/yyyy" pattern="\d{2}/\d{2}/\d{4}" inputmode="numeric" autocomplete="off">
</div>
<div class="form-group">
<label for="next-control" data-i18n="next_control">Next Control Date</label>
<input type="text" id="next-control" required placeholder="dd/mm/yyyy" pattern="\d{2}/\d{2}/\d{4}" inputmode="numeric" autocomplete="off">
</div>
</div>
<div class="form-row">
<div class="form-group">
<label for="total-weight" data-i18n="total_weight">Total Weight (kg)</label>
<input type="number" id="total-weight" required step="1" min="1" value="100">
</div>
<div class="form-group">
<label for="canister-weight" data-i18n="canister_weight">Canister Weight (kg)</label>
<input type="number" id="canister-weight" required step="1" min="1" value="5">
</div>
<div class="form-group">
<label for="canisters-per-box" data-i18n="canisters_per_box">Canisters per Box</label>
<input type="number" id="canisters-per-box" required step="1" min="1" value="4">
</div>
</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">
Canisters: - ( - pages ) | Boxes: - ( - pages )
</div>
</div>
<button type="submit" class="btn btn-accent btn-lg btn-glow">
<span data-i18n="add_to_queue">Add to Print Queue</span>
<span class="btn-icon">✨</span>
</button>
</form>
</section>
<!-- Recent Orders -->
<section class="card glass-card">
<div class="card-header">
<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">
<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="status">Status</th>
<th></th>
</tr>
</thead>
<tbody id="orders-body">
{% for o in orders %}
<tr>
<td class="mono">{{ o.id }}</td>
<td>{{ o.product.code }}</td>
<td class="mono">{{ o.batch_number }}</td>
<td>{{ o.canister_count }}</td>
<td>{{ o.box_count }}</td>
<td><span class="badge badge-{{ o.status }}">{{ o.get_status_display }}</span></td>
<td>
{% if o.status == 'pending' %}
<button class="btn btn-ghost btn-sm btn-danger" onclick="deleteOrder({{ o.id }})" data-i18n="cancel">Cancel</button>
{% endif %}
</td>
</tr>
{% empty %}
<tr><td colspan="7" class="empty-state" data-i18n="no_orders">No orders yet</td></tr>
{% endfor %}
</tbody>
</table>
</div>
</section>
</div>
<!-- Toast notification -->
<div id="toast" class="toast"></div>
{% endblock %}
{% block extra_scripts %}
<script src="{% static 'slips/js/entry.js' %}"></script>
{% endblock %}