Add interactive label calibration UI

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-05 11:48:59 +03:30
parent 000e427d3f
commit bce920e279
8 changed files with 757 additions and 68 deletions

View File

@@ -1,4 +1,5 @@
from django.shortcuts import render, redirect, get_object_or_404
from .calibration import css_vars, load_calibration
from .models import Product, Order
from .print_layout import build_print_pages
@@ -29,13 +30,21 @@ def print_page(request, order_id):
order = get_object_or_404(Order.objects.select_related('product'), id=order_id)
pages = build_print_pages(order)
cal = load_calibration()
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'),
'calibration_css': css_vars(cal),
})
def calibrate(request):
return render(request, 'slips/calibrate.html')
cal = load_calibration()
return render(request, 'slips/calibrate.html', {
'calibration': cal,
'calibration_css': css_vars(cal),
'calibration_json': cal,
'quadrants': ['TL', 'TR', 'BL', 'BR'],
})