Align print/calibrate fields to the reference PDF (including bottom-row offset), fix partial box weights and page padding, and rename branding to Lithium Label Manager with Vazirmatn for Persian. Co-authored-by: Cursor <cursoragent@cursor.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')
|