Fix print_lost_labels compact styling and production data import

- Added compact table styling to print_lost_labels page (smaller fonts, reduced padding)
- Fixed production data import missing fields (production_order_line, line_number)
- Added better error handling and logging for Excel file imports
- Skip empty rows in production data import
- Log all columns and columns with data for debugging
This commit is contained in:
ske087
2025-11-26 21:59:03 +02:00
parent d3a0123acc
commit d070db0052
13 changed files with 649 additions and 1042 deletions

View File

@@ -2,6 +2,50 @@
{% block head %}
<!-- Print Module CSS is now loaded via base.html for all printing pages -->
<style>
/* Compact table styling for print_lost_labels page */
.print-lost-labels-compact .scan-table.print-module-table {
font-size: 10px;
}
.print-lost-labels-compact .scan-table.print-module-table thead th {
font-size: 10px;
padding: 6px 8px;
line-height: 1.2;
}
.print-lost-labels-compact .scan-table.print-module-table tbody td {
font-size: 9px;
padding: 4px 6px;
line-height: 1.3;
}
/* Keep important data slightly larger and bold */
.print-lost-labels-compact .scan-table.print-module-table tbody td:nth-child(2) {
font-size: 10px;
font-weight: 600;
}
/* Make numbers more compact */
.print-lost-labels-compact .scan-table.print-module-table tbody td:nth-child(5),
.print-lost-labels-compact .scan-table.print-module-table tbody td:nth-child(9),
.print-lost-labels-compact .scan-table.print-module-table tbody td:nth-child(13) {
font-size: 9px;
}
/* Reduce row height */
.print-lost-labels-compact .scan-table.print-module-table tbody tr {
height: auto;
min-height: 24px;
}
/* Adjust header title */
.print-lost-labels-compact .card.scan-table-card h3 {
font-size: 16px;
padding: 8px 0;
margin-bottom: 8px;
}
</style>
{% endblock %}
{% block content %}
@@ -13,7 +57,7 @@
</div>
<!-- ROW 1: Search Card (full width) -->
<div class="scan-container lost-labels">
<div class="scan-container lost-labels print-lost-labels-compact">
<div class="card search-card">
<div style="display: flex; align-items: center; gap: 15px; flex-wrap: wrap;">
<label for="search-input" style="font-weight: bold; white-space: nowrap;">Search Order (CP...):</label>

View File

@@ -94,21 +94,25 @@ table.view-orders-table.scan-table tbody tr:hover td {
{% else %}
<!-- Show file upload -->
<input type="hidden" name="action" value="preview">
<label for="file">Choose CSV file:</label>
<input type="file" name="file" accept=".csv" required><br>
<label for="file">Choose CSV or Excel file:</label>
<input type="file" name="file" accept=".csv,.xlsx,.xls" required><br>
<button type="submit" class="btn">Upload & Preview</button>
<!-- CSV Format Information -->
<!-- File Format Information -->
<div style="margin-top: 20px; padding: 15px; background-color: var(--app-card-bg, #2a3441); border-radius: 5px; border-left: 4px solid var(--app-accent-color, #007bff); color: var(--app-text-color, #ffffff);">
<h5 style="margin-top: 0; color: var(--app-accent-color, #007bff);">Expected CSV Format</h5>
<p style="margin-bottom: 10px; color: var(--app-text-color, #ffffff);">Your CSV file should contain columns such as:</p>
<h5 style="margin-top: 0; color: var(--app-accent-color, #007bff);">Expected File Format</h5>
<p style="margin-bottom: 10px; color: var(--app-text-color, #ffffff);">Supported file types: <strong>CSV (.csv)</strong> and <strong>Excel (.xlsx, .xls)</strong></p>
<p style="margin-bottom: 10px; color: var(--app-text-color, #ffffff);">Your file should contain columns such as:</p>
<ul style="margin-bottom: 10px; color: var(--app-text-color, #ffffff);">
<li><strong>order_number</strong> - The order/production number</li>
<li><strong>quantity</strong> - Number of items</li>
<li><strong>warehouse_location</strong> - Storage location</li>
<li><strong>Comanda Productie</strong> - Production order number</li>
<li><strong>Cod Articol</strong> - Article code</li>
<li><strong>Descr. Com. Prod</strong> - Description</li>
<li><strong>Cantitate</strong> - Quantity</li>
<li><strong>Data Livrare</strong> - Delivery date</li>
<li><strong>Customer Name</strong> - Customer name</li>
</ul>
<p style="color: var(--app-secondary-text, #b8c5d1); font-size: 14px; margin-bottom: 0;">
Column names are case-insensitive and can have variations like "Order Number", "Quantity", "Location", etc.
Column names are case-insensitive and can have variations. For Excel files, the first sheet with data will be used.
</p>
</div>
{% endif %}