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>
153 lines
4.3 KiB
HTML
153 lines
4.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>Print Order #{{ order.id }}</title>
|
|
<link rel="stylesheet" href="{% static 'slips/css/label_print.css' %}">
|
|
<style>
|
|
/* Base reset and print-specific settings */
|
|
* {
|
|
box-sizing: border-box;
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
background-color: #f0f0f0;
|
|
color: #000;
|
|
}
|
|
|
|
/* Screen-only styling for the preview container */
|
|
.preview-controls {
|
|
background: #1e293b;
|
|
color: #fff;
|
|
padding: 1rem;
|
|
text-align: center;
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
z-index: 100;
|
|
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
|
|
}
|
|
|
|
.preview-controls button {
|
|
background: #3b82f6;
|
|
color: white;
|
|
border: none;
|
|
padding: 10px 20px;
|
|
font-size: 16px;
|
|
border-radius: 6px;
|
|
cursor: pointer;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.preview-controls button:hover {
|
|
background: #2563eb;
|
|
}
|
|
|
|
.page-wrapper {
|
|
margin-top: 80px; /* Space for controls */
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
gap: 20px;
|
|
padding-bottom: 40px;
|
|
}
|
|
|
|
/* The physical A4 page representation */
|
|
.a4-page {
|
|
width: 210mm;
|
|
height: 297mm;
|
|
background: white;
|
|
position: relative;
|
|
box-shadow: 0 10px 25px rgba(0,0,0,0.15);
|
|
/* Important: Keep overflow visible for printing */
|
|
overflow: hidden;
|
|
page-break-after: always;
|
|
}
|
|
|
|
/* CSS Grid for the 4 slips */
|
|
.slip-grid {
|
|
display: grid;
|
|
grid-template-columns: 1fr 1fr;
|
|
grid-template-rows: 1fr 1fr;
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
.slip-quadrant {
|
|
position: relative;
|
|
width: 105mm; /* Half width */
|
|
height: 148.5mm; /* Half height */
|
|
}
|
|
|
|
/* Print Media Query */
|
|
@media print {
|
|
@page {
|
|
size: A4 portrait;
|
|
margin: 0; /* Zero margin to allow absolute positioning from edges */
|
|
}
|
|
|
|
body {
|
|
background: none;
|
|
margin: 0;
|
|
}
|
|
|
|
.preview-controls {
|
|
display: none;
|
|
}
|
|
|
|
.page-wrapper {
|
|
margin: 0;
|
|
padding: 0;
|
|
gap: 0;
|
|
display: block;
|
|
}
|
|
|
|
.a4-page {
|
|
box-shadow: none;
|
|
width: 100%;
|
|
height: 100vh; /* Fill printed page */
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="preview-controls">
|
|
<p style="margin-bottom: 10px; font-family: sans-serif;">
|
|
Order #{{ order.id }} — {{ order.product.code }} <br>
|
|
{{ order.canister_count }} Canisters ({{ order.canister_pages }} Pages) |
|
|
{{ order.box_count }} Boxes ({{ order.box_pages }} Pages)
|
|
</p>
|
|
<button onclick="window.print()">🖨️ Print Now</button>
|
|
<button onclick="window.close()" style="background:#64748b; margin-left: 10px;">Close</button>
|
|
</div>
|
|
|
|
<div class="page-wrapper">
|
|
{% for page in pages %}
|
|
<div class="a4-page">
|
|
<div class="slip-grid">
|
|
{% for weight in page.slips %}
|
|
<div class="slip-quadrant">
|
|
<div class="var-field val-batch">{{ order.batch_number }}</div>
|
|
<div class="var-field val-date">{{ date_formatted }}</div>
|
|
<div class="var-field val-next">{{ next_control_formatted }}</div>
|
|
<div class="var-field val-weight">{{ weight }}</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
|
|
<script>
|
|
// Optional: auto-trigger print dialog when opened
|
|
// window.onload = function() { window.print(); }
|
|
</script>
|
|
</body>
|
|
</html>
|