# Old App FG Scan Box Assignment Workflow Reference ## Overview The old app (`/srv/quality_app/py_app/app/templates/fg_scan.html`) implements a sophisticated **two-stage scanning and box assignment workflow** that provides users with options to either create new boxes or assign scans to existing boxes. ## Workflow Trigger **When does the modal appear?** - User fills in all scan fields (Operator Code, CP Code, OC1, OC2, Defect Code) - User scans defect code (3 digits) - The checkbox **"Enable Scan to Boxes"** must be ENABLED - Defect code must be **'000'** (good quality only) **Code Reference (Lines 730-750):** ```javascript if (scanToBoxesEnabled && this.value === '000') { console.log('Auto-submit: Scan-to-boxes enabled, calling submitScanWithBoxAssignment'); submitScanWithBoxAssignment(); // <-- Triggers modal instead of normal form submit } else { console.log('Auto-submit: Normal form submission'); form.submit(); // <-- Normal database insert, page reloads } ``` ## Step-by-Step Workflow ### Step 1: Scan Entry & Validation **File: fg_scan.html, Lines 1-400** User interface with scan input form: ```html