## Summary - Calibrate label print/calibrate CSS to the reference PDF (positions, ~7pt/6pt sizes, bottom-row pitch) - Print layout: partial last-box weight, pad short pages to 4 slips, whole-number weights - Rename to Lithium Label Manager; Vazirmatn for FA / Inter for EN; inverted lithium icon; seed weights=5; number step=1; hide empty toast ## Test plan - [ ] Print calibration sheet and overlay on a physical label — top and bottom rows align - [ ] Order 50/5/4 — box labels show 20, 20, 10 (padded page); weights without `.0` - [ ] Language toggle switches Inter ↔ Vazirmatn - [ ] Seed products use canister weight 5; form spinners step by 1 Reviewed-on: #3 Co-authored-by: Diaco Soltanpour <dyaco8464@yahoo.com> Co-committed-by: Diaco Soltanpour <dyaco8464@yahoo.com>
42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
from django.shortcuts import render, redirect, get_object_or_404
|
|
from .models import Product, Order
|
|
from .print_layout import build_print_pages
|
|
|
|
|
|
def index(request):
|
|
return redirect('entry')
|
|
|
|
|
|
def entry(request):
|
|
products = Product.objects.all()
|
|
orders = Order.objects.select_related('product').all()[:20]
|
|
return render(request, 'slips/entry.html', {
|
|
'products': products,
|
|
'orders': orders,
|
|
})
|
|
|
|
|
|
def print_queue(request):
|
|
pending = Order.objects.select_related('product').filter(status='pending')
|
|
history = Order.objects.select_related('product').filter(status='done').order_by('-printed_at')[:20]
|
|
return render(request, 'slips/print.html', {
|
|
'pending_orders': pending,
|
|
'history_orders': history,
|
|
})
|
|
|
|
|
|
def print_page(request, order_id):
|
|
order = get_object_or_404(Order.objects.select_related('product'), id=order_id)
|
|
pages = build_print_pages(order)
|
|
|
|
return render(request, 'slips/print_page.html', {
|
|
'order': order,
|
|
'pages': pages,
|
|
'date_formatted': order.production_date.strftime('%d/%m/%Y'),
|
|
'next_control_formatted': order.next_control_date.strftime('%d/%m/%Y'),
|
|
})
|
|
|
|
|
|
def calibrate(request):
|
|
return render(request, 'slips/calibrate.html')
|