287 lines
9.3 KiB
HTML
287 lines
9.3 KiB
HTML
{% load static %}
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Calibration — Lithium | Print Label</title>
|
|
<link rel="stylesheet" href="{% static 'slips/css/label_print.css' %}">
|
|
<style id="calibration-vars">
|
|
{{ calibration_css|safe }}
|
|
</style>
|
|
<style>
|
|
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
body {
|
|
font-family: system-ui, sans-serif;
|
|
background: #0f172a;
|
|
color: #e2e8f0;
|
|
min-height: 100vh;
|
|
}
|
|
|
|
.layout {
|
|
display: grid;
|
|
grid-template-columns: minmax(300px, 360px) 1fr;
|
|
min-height: 100vh;
|
|
}
|
|
|
|
.panel {
|
|
background: #1e293b;
|
|
border-right: 1px solid #334155;
|
|
padding: 1rem;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.75rem;
|
|
max-height: 100vh;
|
|
overflow: auto;
|
|
}
|
|
|
|
.panel h1 { font-size: 1.1rem; font-weight: 700; }
|
|
.panel .hint { font-size: 0.8rem; color: #94a3b8; line-height: 1.4; }
|
|
|
|
.toolbar {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 0.4rem;
|
|
}
|
|
.toolbar button, .nudge button {
|
|
background: #334155;
|
|
color: #f1f5f9;
|
|
border: 1px solid #475569;
|
|
border-radius: 6px;
|
|
padding: 0.45rem 0.7rem;
|
|
font-size: 0.85rem;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
}
|
|
.toolbar button.primary { background: #2563eb; border-color: #2563eb; }
|
|
.toolbar button.danger { background: #7f1d1d; border-color: #991b1b; }
|
|
.toolbar button:hover, .nudge button:hover { filter: brightness(1.1); }
|
|
.toolbar button:disabled { opacity: 0.5; cursor: default; }
|
|
|
|
.status {
|
|
font-size: 0.8rem;
|
|
min-height: 1.2em;
|
|
color: #94a3b8;
|
|
}
|
|
.status.dirty { color: #fbbf24; }
|
|
.status.ok { color: #34d399; }
|
|
.status.err { color: #f87171; }
|
|
|
|
.step-row {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
font-size: 0.85rem;
|
|
}
|
|
.step-row input[type="number"] {
|
|
width: 4.5rem;
|
|
background: #0f172a;
|
|
border: 1px solid #475569;
|
|
color: #f1f5f9;
|
|
border-radius: 4px;
|
|
padding: 0.3rem 0.4rem;
|
|
}
|
|
|
|
.section {
|
|
border: 1px solid #334155;
|
|
border-radius: 8px;
|
|
padding: 0.65rem;
|
|
background: #0f172a66;
|
|
}
|
|
.section h2 {
|
|
font-size: 0.75rem;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.04em;
|
|
color: #94a3b8;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.field-block {
|
|
border-radius: 6px;
|
|
padding: 0.4rem;
|
|
margin-bottom: 0.35rem;
|
|
border: 1px solid transparent;
|
|
}
|
|
.field-block.active {
|
|
border-color: #3b82f6;
|
|
background: rgba(59, 130, 246, 0.12);
|
|
}
|
|
.field-block h3 {
|
|
font-size: 0.85rem;
|
|
margin-bottom: 0.35rem;
|
|
color: #f8fafc;
|
|
}
|
|
|
|
.nudge {
|
|
display: grid;
|
|
grid-template-columns: 4.5rem 1fr auto auto auto;
|
|
gap: 0.3rem;
|
|
align-items: center;
|
|
margin-bottom: 0.25rem;
|
|
font-size: 0.8rem;
|
|
}
|
|
.nudge label { color: #94a3b8; }
|
|
.nudge input[type="number"] {
|
|
width: 100%;
|
|
background: #0f172a;
|
|
border: 1px solid #475569;
|
|
color: #f1f5f9;
|
|
border-radius: 4px;
|
|
padding: 0.25rem 0.35rem;
|
|
font-variant-numeric: tabular-nums;
|
|
}
|
|
.nudge button { padding: 0.2rem 0.55rem; min-width: 2rem; }
|
|
|
|
.preview-wrap {
|
|
padding: 1.25rem;
|
|
overflow: auto;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: flex-start;
|
|
}
|
|
|
|
.a4-page {
|
|
width: 210mm;
|
|
height: 297mm;
|
|
background: white;
|
|
position: relative;
|
|
box-shadow: 0 10px 25px rgba(0,0,0,0.35);
|
|
overflow: hidden;
|
|
background-image:
|
|
linear-gradient(to right, #e2e8f0 1px, transparent 1px),
|
|
linear-gradient(to bottom, #e2e8f0 1px, transparent 1px);
|
|
background-size: 10mm 10mm;
|
|
flex-shrink: 0;
|
|
transform-origin: top center;
|
|
}
|
|
|
|
.slip-grid {
|
|
display: grid;
|
|
grid-template-columns: 1fr 1fr;
|
|
grid-template-rows: 1fr 1fr;
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
.slip-quadrant {
|
|
position: relative;
|
|
width: 105mm;
|
|
height: 148.5mm;
|
|
border: 1px dashed #cbd5e1;
|
|
}
|
|
|
|
.var-field {
|
|
color: #dc2626;
|
|
cursor: pointer;
|
|
outline: 1px solid transparent;
|
|
padding: 0 1px;
|
|
}
|
|
.var-field:hover { outline-color: #3b82f6; }
|
|
.var-field.selected {
|
|
outline: 2px solid #2563eb;
|
|
background: rgba(37, 99, 235, 0.12);
|
|
}
|
|
.var-field::before {
|
|
content: "┼";
|
|
position: absolute;
|
|
left: -10px;
|
|
top: -5px;
|
|
color: #2563eb;
|
|
font-size: 20px;
|
|
pointer-events: none;
|
|
}
|
|
|
|
.q-tag {
|
|
position: absolute;
|
|
top: 4px;
|
|
left: 6px;
|
|
font-size: 10px;
|
|
color: #64748b;
|
|
font-family: sans-serif;
|
|
pointer-events: none;
|
|
}
|
|
|
|
@media print {
|
|
@page { size: A4 portrait; margin: 0; }
|
|
body { background: none; margin: 0; color: #000; }
|
|
.panel { display: none !important; }
|
|
.layout { display: block; }
|
|
.preview-wrap { margin: 0; padding: 0; display: block; overflow: visible; }
|
|
.a4-page {
|
|
box-shadow: none;
|
|
width: 100%;
|
|
height: 100vh;
|
|
background-image: none;
|
|
transform: none !important;
|
|
}
|
|
.slip-quadrant { border: none; }
|
|
.q-tag { display: none; }
|
|
.var-field { color: #000; outline: none !important; background: none !important; }
|
|
.var-field::before { display: none; }
|
|
}
|
|
|
|
@media (max-width: 900px) {
|
|
.layout { grid-template-columns: 1fr; }
|
|
.panel { max-height: none; border-right: none; border-bottom: 1px solid #334155; }
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="layout">
|
|
<aside class="panel">
|
|
<h1>Label calibration</h1>
|
|
<p class="hint">
|
|
Nudge fields in mm, print on blank A4, overlay on a pre-printed sheet against light.
|
|
Save writes <code>data/calibration.json</code> (used by real prints too).
|
|
</p>
|
|
|
|
<div class="toolbar">
|
|
<button type="button" class="primary" id="btn-save">Save</button>
|
|
<button type="button" id="btn-print">Print</button>
|
|
<button type="button" id="btn-backup">Backup</button>
|
|
<button type="button" id="btn-restore">Restore</button>
|
|
<input type="file" id="restore-file" accept="application/json,.json" hidden>
|
|
<button type="button" class="danger" id="btn-reset">Reset defaults</button>
|
|
<a href="{% url 'entry' %}" style="align-self:center;color:#93c5fd;font-size:0.85rem;margin-left:0.25rem;">← Back</a>
|
|
</div>
|
|
<div class="status" id="status">Loaded from server</div>
|
|
|
|
<div class="step-row">
|
|
<label for="step">Step</label>
|
|
<input type="number" id="step" value="0.5" min="0.1" max="5" step="0.1">
|
|
<span>mm</span>
|
|
</div>
|
|
|
|
<div class="section" id="sec-top">
|
|
<h2>Top row (TL / TR base)</h2>
|
|
</div>
|
|
<div class="section" id="sec-bottom">
|
|
<h2>Bottom row overrides</h2>
|
|
</div>
|
|
<div class="section" id="sec-right">
|
|
<h2>Right column overrides</h2>
|
|
</div>
|
|
</aside>
|
|
|
|
<div class="preview-wrap">
|
|
<div class="a4-page" id="a4-page">
|
|
<div class="slip-grid">
|
|
{% for label in quadrants %}
|
|
<div class="slip-quadrant" data-q="{{ label }}">
|
|
<span class="q-tag">{{ label }}</span>
|
|
<div class="var-field val-batch" data-field="batch" data-scope="{{ label }}">[Batch#]</div>
|
|
<div class="var-field val-date" data-field="date" data-scope="{{ label }}">[Date]</div>
|
|
<div class="var-field val-next" data-field="next" data-scope="{{ label }}">[Next]</div>
|
|
<div class="var-field val-weight" data-field="weight" data-scope="{{ label }}">[Weight]</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{{ calibration_json|json_script:"calibration-data" }}
|
|
<script src="{% static 'slips/js/calibrate.js' %}"></script>
|
|
</body>
|
|
</html>
|