feat: Migrate label printing module from legacy app

- Created labels module with complete structure in app/modules/labels/
- Implemented print_module.py with database functions:
  * get_unprinted_orders_data() - Retrieve unprinted orders from database
  * get_printed_orders_data() - Retrieve printed orders from database
  * update_order_printed_status() - Mark orders as printed
  * search_orders_by_cp_code() - Search orders by production code
- Created routes.py with Flask Blueprint and API endpoints:
  * GET /labels/ - Module home page with feature launchers
  * GET /labels/print-module - Main label printing interface
  * GET /labels/print-lost-labels - Lost label reprinting interface
  * GET /labels/api/unprinted-orders - API for unprinted orders
  * GET /labels/api/printed-orders - API for printed orders
  * POST /labels/api/search-orders - Search orders API
  * POST /labels/api/update-printed-status/<id> - Update status API
- Migrated HTML templates from legacy app with theme support:
  * print_module.html - Thermal label printing with QZ Tray integration
  * print_lost_labels.html - Lost label search and reprint interface
  * Added comprehensive CSS variables for dark/light mode theming
  * Preserved all original JavaScript functionality for printing
- Created index.html module home page with feature launchers
- Registered labels blueprint in app/__init__.py with /labels prefix
- Added 'Label Printing' module card to dashboard with print icon

All functionality preserved from original implementation:
- QZ Tray thermal printer integration
- JsBarcode barcode generation (horizontal + vertical)
- PDF export fallback
- Session-based authentication for all routes
- Database integration with proper error handling
This commit is contained in:
Quality App Developer
2026-02-02 01:18:54 +02:00
parent f54e1bebc3
commit 2f6bb5d029
8 changed files with 3095 additions and 1 deletions

View File

@@ -0,0 +1,105 @@
{% extends "base.html" %}
{% block title %}Labels Module - Quality App v2{% endblock %}
{% block content %}
<div class="container-fluid py-5">
<div class="row mb-4">
<div class="col-12">
<h1 class="mb-2">
<i class="fas fa-print"></i> Labels Module
</h1>
<p class="text-muted">Manage and print labels for thermal printers</p>
</div>
</div>
<div class="row">
<!-- Print Module Card -->
<div class="col-md-6 col-lg-4 mb-4">
<div class="card shadow-sm h-100 module-launcher">
<div class="card-body text-center">
<div class="launcher-icon mb-3">
<i class="fas fa-print text-primary"></i>
</div>
<h5 class="card-title">Print Labels</h5>
<p class="card-text text-muted">Print labels directly to thermal printers with live preview.</p>
<a href="{{ url_for('labels.print_module') }}" class="btn btn-primary btn-sm">
<i class="fas fa-arrow-right"></i> Open Printing
</a>
</div>
</div>
</div>
<!-- Print Lost Labels Card -->
<div class="col-md-6 col-lg-4 mb-4">
<div class="card shadow-sm h-100 module-launcher">
<div class="card-body text-center">
<div class="launcher-icon mb-3">
<i class="fas fa-file-pdf text-danger"></i>
</div>
<h5 class="card-title">Print Lost Labels</h5>
<p class="card-text text-muted">Search and reprint labels for orders that need reprinting.</p>
<a href="{{ url_for('labels.print_lost_labels') }}" class="btn btn-danger btn-sm">
<i class="fas fa-arrow-right"></i> Reprint Labels
</a>
</div>
</div>
</div>
</div>
<!-- Module Overview Section -->
<div class="row mt-5">
<div class="col-12">
<div class="card shadow-sm">
<div class="card-header bg-light">
<h5 class="mb-0"><i class="fas fa-info-circle"></i> Module Overview</h5>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-6">
<h6><i class="fas fa-check-circle text-success"></i> Key Features:</h6>
<ul class="text-muted">
<li>Real-time label preview</li>
<li>Direct thermal printer integration</li>
<li>PDF export fallback</li>
<li>Batch label printing</li>
<li>QZ Tray support for Windows/Mac/Linux</li>
</ul>
</div>
<div class="col-md-6">
<h6><i class="fas fa-chart-pie text-primary"></i> Supported Printers:</h6>
<ul class="text-muted">
<li>Zebra thermal printers</li>
<li>Epson TM series</li>
<li>Brother thermal printers</li>
<li>Generic thermal printers via QZ Tray</li>
<li>PDF export for any printer</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<style>
.module-launcher {
transition: transform 0.2s, box-shadow 0.2s;
}
.module-launcher:hover {
transform: translateY(-5px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}
.launcher-icon {
font-size: 48px;
line-height: 1;
}
.launcher-icon i {
display: inline-block;
}
</style>
{% endblock %}