feat: Major system improvements and production deployment
✨ New Features: - Added view_orders route with proper table display - Implemented CSV upload with preview workflow and date parsing - Added production WSGI server configuration with Gunicorn - Created comprehensive production management scripts 🔧 Bug Fixes: - Fixed upload_data route column mapping for actual CSV structure - Resolved print module database queries and template rendering - Fixed view orders navigation routing (was pointing to JSON API) - Corrected barcode display width constraints in print module - Added proper date format parsing for MySQL compatibility 🎨 UI/UX Improvements: - Updated view_orders template with theme-compliant styling - Hidden barcode text in print module preview for cleaner display - Enhanced CSV upload with two-step preview-then-save workflow - Improved error handling and debugging throughout upload process 🚀 Production Infrastructure: - Added Gunicorn WSGI server with proper configuration - Created systemd service for production deployment - Implemented production management scripts (start/stop/status) - Added comprehensive logging setup - Updated requirements.txt with production dependencies 📊 Database & Data: - Enhanced order_for_labels table compatibility - Fixed column mappings for real CSV data structure - Added proper date parsing and validation - Improved error handling with detailed debugging 🔧 Technical Debt: - Reorganized database setup documentation - Added proper error handling throughout upload workflow - Enhanced debugging capabilities for troubleshooting - Improved code organization and documentation
This commit is contained in:
@@ -22,6 +22,74 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
const defectCodeInput = document.getElementById('defect_code');
|
||||
const form = document.querySelector('.form-centered');
|
||||
|
||||
// Load saved operator codes from localStorage (only Quality Operator Code)
|
||||
function loadSavedCodes() {
|
||||
const savedOperatorCode = localStorage.getItem('scan_operator_code');
|
||||
|
||||
if (savedOperatorCode) {
|
||||
operatorCodeInput.value = savedOperatorCode;
|
||||
}
|
||||
}
|
||||
|
||||
// Save operator codes to localStorage (only Quality Operator Code)
|
||||
function saveCodes() {
|
||||
if (operatorCodeInput.value.startsWith('OP')) {
|
||||
localStorage.setItem('scan_operator_code', operatorCodeInput.value);
|
||||
}
|
||||
}
|
||||
|
||||
// Clear saved codes from localStorage (only Quality Operator Code)
|
||||
function clearSavedCodes() {
|
||||
localStorage.removeItem('scan_operator_code');
|
||||
operatorCodeInput.value = '';
|
||||
showSuccessMessage('Quality Operator code cleared!');
|
||||
operatorCodeInput.focus();
|
||||
}
|
||||
|
||||
// Show success message
|
||||
function showSuccessMessage(message) {
|
||||
const successDiv = document.createElement('div');
|
||||
successDiv.className = 'success-message';
|
||||
successDiv.textContent = message;
|
||||
successDiv.style.cssText = `
|
||||
position: fixed;
|
||||
top: 20px;
|
||||
right: 20px;
|
||||
background: #4CAF50;
|
||||
color: white;
|
||||
padding: 15px 20px;
|
||||
border-radius: 4px;
|
||||
z-index: 1000;
|
||||
font-weight: bold;
|
||||
box-shadow: 0 2px 5px rgba(0,0,0,0.2);
|
||||
`;
|
||||
document.body.appendChild(successDiv);
|
||||
|
||||
setTimeout(() => {
|
||||
if (document.body.contains(successDiv)) {
|
||||
document.body.removeChild(successDiv);
|
||||
}
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
// Load saved codes on page load
|
||||
loadSavedCodes();
|
||||
|
||||
// Focus on the first empty field
|
||||
setTimeout(() => {
|
||||
if (!operatorCodeInput.value) {
|
||||
operatorCodeInput.focus();
|
||||
} else if (!cpCodeInput.value) {
|
||||
cpCodeInput.focus();
|
||||
} else if (!oc1CodeInput.value) {
|
||||
oc1CodeInput.focus();
|
||||
} else if (!oc2CodeInput.value) {
|
||||
oc2CodeInput.focus();
|
||||
} else {
|
||||
defectCodeInput.focus();
|
||||
}
|
||||
}, 100);
|
||||
|
||||
// Create error message element for operator code
|
||||
const operatorErrorMessage = document.createElement('div');
|
||||
operatorErrorMessage.className = 'error-message';
|
||||
@@ -333,8 +401,21 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
const seconds = String(now.getSeconds()).padStart(2, '0');
|
||||
timeInput.value = `${hours}:${minutes}:${seconds}`;
|
||||
|
||||
// Save operator codes before submitting
|
||||
saveCodes();
|
||||
|
||||
// Submit the form
|
||||
form.submit();
|
||||
|
||||
// Clear CP, OC1, OC2, and defect code fields after successful submission
|
||||
setTimeout(() => {
|
||||
cpCodeInput.value = '';
|
||||
oc1CodeInput.value = '';
|
||||
oc2CodeInput.value = '';
|
||||
defectCodeInput.value = '';
|
||||
showSuccessMessage('Scan submitted successfully!');
|
||||
cpCodeInput.focus();
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -425,6 +506,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
<input type="text" id="time" name="time" value="{{ now().strftime('%H:%M:%S') }}" readonly>
|
||||
|
||||
<button type="submit" class="btn">Submit</button>
|
||||
<button type="button" class="btn btn-secondary" onclick="clearSavedCodes()" style="margin-top: 10px; background-color: #6c757d;">Clear Quality Operator</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user