Add per-product flag to skip Date and Next Control

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-14 12:06:12 +03:30
parent 6bbb8568c6
commit f9c6f3bc14
14 changed files with 145 additions and 27 deletions

View File

@@ -18,7 +18,7 @@
<select id="product" required>
<option value="">— Select —</option>
{% for p in products %}
<option value="{{ p.id }}" data-weight="{{ p.default_net_weight }}">
<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 %}
@@ -30,14 +30,14 @@
<input type="text" id="batch" required placeholder="1028/26">
</div>
<div class="form-row">
<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" required placeholder="dd/mm/yyyy" pattern="\d{2}/\d{2}/\d{4}" inputmode="numeric" autocomplete="off">
<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" required placeholder="dd/mm/yyyy" pattern="\d{2}/\d{2}/\d{4}" inputmode="numeric" autocomplete="off">
<input type="text" id="next-control" placeholder="dd/mm/yyyy" pattern="\d{2}/\d{2}/\d{4}" inputmode="numeric" autocomplete="off">
</div>
</div>

View File

@@ -30,6 +30,7 @@
<span class="label" data-i18n="batch_number">Batch:</span>
<span class="value mono">{{ o.batch_number }}</span>
</div>
{% if o.product.requires_dates %}
<div class="detail-col">
<span class="label" data-i18n="date">Date:</span>
<span class="value">{{ o.production_date|date:"d/m/Y" }}</span>
@@ -38,6 +39,7 @@
<span class="label" data-i18n="next_control">Next:</span>
<span class="value">{{ o.next_control_date|date:"d/m/Y" }}</span>
</div>
{% endif %}
</div>
<div class="print-meta">
<span class="badge badge-accent">{{ o.canister_pages|add:o.box_pages }} <span data-i18n="pages_unit">Page(s)</span></span>

View File

@@ -199,8 +199,10 @@
{% for weight in page.slips %}
<div class="slip-quadrant">
<div class="var-field val-batch">{{ order.batch_number }}</div>
{% if show_dates %}
<div class="var-field val-date">{{ date_formatted }}</div>
<div class="var-field val-next">{{ next_control_formatted }}</div>
{% endif %}
<div class="var-field val-weight">{{ weight }}</div>
</div>
{% endfor %}

View File

@@ -26,6 +26,12 @@
<label for="prod-weight" data-i18n="default_weight">Default Weight</label>
<input type="number" id="prod-weight" value="5" step="1" min="1" required>
</div>
<div class="form-group">
<label class="checkbox-label">
<input type="checkbox" id="prod-requires-dates" checked>
<span data-i18n="requires_dates">Requires Date / Next Control</span>
</label>
</div>
<div class="form-actions-inline">
<button type="submit" class="btn btn-accent" id="product-save-btn" data-i18n="save">Save</button>
<button type="button" class="btn btn-ghost" id="product-cancel-btn" style="display:none;" onclick="cancelEdit()" data-i18n="cancel">Cancel</button>
@@ -51,6 +57,7 @@
<th data-i18n="product_code">Code</th>
<th data-i18n="description">Description</th>
<th data-i18n="default_weight">Weight</th>
<th data-i18n="requires_dates_short">Dates</th>
<th></th>
</tr>
</thead>
@@ -60,12 +67,14 @@
<td class="mono">{{ p.code }}</td>
<td>{{ p.description }}</td>
<td class="mono">{{ p.default_net_weight }}</td>
<td>{{ p.requires_dates|yesno:"✓,—" }}</td>
<td>
<button type="button" class="btn btn-ghost btn-sm"
data-id="{{ p.id }}"
data-code="{{ p.code }}"
data-desc="{{ p.description }}"
data-weight="{{ p.default_net_weight }}"
data-requires-dates="{{ p.requires_dates|yesno:'true,false' }}"
onclick="editProduct(this)"
data-i18n="edit">Edit</button>
<button type="button" class="btn btn-ghost btn-sm btn-danger"
@@ -74,7 +83,7 @@
</td>
</tr>
{% empty %}
<tr><td colspan="4" class="empty-state" data-i18n="no_products">No products yet</td></tr>
<tr><td colspan="5" class="empty-state" data-i18n="no_products">No products yet</td></tr>
{% endfor %}
</tbody>
</table>