Files
product-slip/slips/templates/slips/entry.html

174 lines
8.7 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{% extends 'slips/base.html' %}
{% load static %}
{% block title %}Data Entry — Label Printer{% 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 }}" data-requires-dates="{{ p.requires_dates|yesno:'true,false' }}">
{{ p.code }} — {{ p.description }}
</option>
{% endfor %}
</select>
</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" id="date-fields">
<div class="form-group">
<label for="prod-date" data-i18n="date">Date</label>
<input type="text" id="prod-date" 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" 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="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">
Canisters: - | 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="custom">Custom</th>
<th data-i18n="total_pages">Pages</th>
<th data-i18n="status">Status</th>
<th></th>
</tr>
</thead>
<tbody id="orders-body">
{% for o in orders %}
<tr id="order-row-{{ o.id }}">
<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">
{% 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>
{% if o.status == 'pending' %}
<button class="btn btn-ghost btn-sm btn-danger" onclick="deleteOrder({{ o.id }})" data-i18n="remove">Remove</button>
{% endif %}
</td>
</tr>
{% empty %}
<tr><td colspan="9" 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 %}