FG Scan form validation improvements with warehouse module updates
- Fixed 3 JavaScript syntax errors in fg_scan.html (lines 951, 840-950, 1175-1215) - Restored form field validation with proper null safety checks - Re-enabled auto-advance between form fields - Re-enabled CP code auto-complete with hyphen detection - Updated validation error messages with clear format specifications and examples - Added autocomplete='off' to all input fields - Removed auto-prefix correction feature - Updated warehouse routes and modules for box assignment workflow - Added/improved database initialization scripts - Updated requirements.txt dependencies Format specifications implemented: - Operator Code: OP + 2 digits (example: OP01, OP99) - CP Code: CP + 8 digits + hyphen + 4 digits (example: CP00000000-0001) - OC1/OC2 Codes: OC + 2 digits (example: OC01, OC99) - Defect Code: 3 digits only
This commit is contained in:
@@ -348,6 +348,11 @@
|
||||
<p class="mb-1"><strong>Name:</strong> <span id="truncate-table-name"></span></p>
|
||||
<p class="mb-0"><strong>Rows to Delete:</strong> <span id="truncate-row-count" class="badge bg-danger"></span></p>
|
||||
</div>
|
||||
|
||||
<div id="warehouse-locations-warning" style="display: none;" class="alert alert-warning mt-3 mb-0">
|
||||
<i class="fas fa-shield-alt"></i>
|
||||
<strong>Protected Data:</strong> The 2 default warehouse locations (<code>FG_INCOMING</code> and <code>TRUCK_LOADING</code>) will be automatically preserved and not deleted.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -564,6 +569,16 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
confirmTableName.textContent = table;
|
||||
}
|
||||
|
||||
// Show warehouse_locations protection warning
|
||||
const warehouseWarning = document.getElementById('warehouse-locations-warning');
|
||||
if (warehouseWarning) {
|
||||
if (table === 'warehouse_locations') {
|
||||
warehouseWarning.style.display = 'block';
|
||||
} else {
|
||||
warehouseWarning.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
// Enable the button
|
||||
truncateBtn.disabled = false;
|
||||
|
||||
@@ -577,6 +592,12 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
truncateInfo.style.display = 'none';
|
||||
}
|
||||
|
||||
// Hide warehouse warning
|
||||
const warehouseWarning = document.getElementById('warehouse-locations-warning');
|
||||
if (warehouseWarning) {
|
||||
warehouseWarning.style.display = 'none';
|
||||
}
|
||||
|
||||
truncateBtn.disabled = true;
|
||||
}
|
||||
});
|
||||
@@ -663,8 +684,15 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
const modal = bootstrap.Modal.getInstance(document.getElementById('confirmTruncateModal'));
|
||||
if (modal) modal.hide();
|
||||
|
||||
// Build success message
|
||||
let successMsg = 'Table cleared successfully!';
|
||||
if (data.preserved_count > 0) {
|
||||
successMsg += ` (${data.preserved_count} protected locations preserved)`;
|
||||
}
|
||||
successMsg += '\n\nRefreshing page...';
|
||||
|
||||
// Show success message
|
||||
alert('Table cleared successfully! Refreshing page...');
|
||||
alert(successMsg);
|
||||
|
||||
// Refresh the page after a short delay
|
||||
setTimeout(() => {
|
||||
|
||||
Reference in New Issue
Block a user