THE LABS GADGET CRM — AUTO QC WORKFLOW PATCH
=============================================
For CRM after Phase 16 + Compact Workspace + Premium Repair Details + Owner Delete Repair.
UI stays English; no database migration; no activation file.

WHAT CHANGES
1. Register Device: after the database transaction commits successfully, the user
   is redirected to qc-job.php?id=<new-job-id>#before (Intake Inspection).
   The repair remains Pending; no QC is auto-approved.
2. Repair Details: after staff successfully use Complete Repair, the timer
   stops and status changes to Completed, THEN the browser redirects to
   qc-job.php?id=<repair-id>#after (Final Quality Check).
3. Complete Inspection (No Repair) also redirects to Final QC after
   successful completion. All other workflow actions retain their redirects.
4. QC Save, QC Approval, stock, payments, customer, warranty, Owner Delete
   Repair and Finance are unchanged. The Final QC does not automatically
   mark a phone Collected. Staff return to Repair Details to confirm collection.

FILES TO INSTALL (ONLY TWO EXISTING FILES)
  repair-new.php
  repair-view.php
Do NOT replace qc-job.php, crm3.php, dashboard.php, or any other file.

SAFE INSTALL
1. Backup entire CRM and export SQL database via phpMyAdmin.
2. Independently download your CURRENT repair-new.php and repair-view.php
   from the live server before replacing them.
3. IMPORTANT: Compare files before overwriting. This patch was based on
   the previously delivered premium Repair Details + Owner Delete Repair
   page. Any manual or newer changes to either live PHP file must be
   merged into the live versions instead of overwriting with this patch.
4. Extract only the two PHP files into your CRM document root.
5. No Activate step and no database SQL are required.
6. Refresh your browser; register ONE TEST device and check that it opens
   Intake QC, and complete ONE TEST repair and check that it opens Final QC.

EXPECTED BEHAVIOUR
- Registration save errors stay on Register Device with form errors;
  there is no redirect if the record was not saved.
- Complete Repair errors stay on Repair Details with an error; there is
  no redirect if the database transaction was rolled back.
- Final QC may be edited only when repair status is Completed;
  Intake QC while Pending/Checking (existing rules).
- Existing QC role permissions stay enforced by qc-job.php itself.
- The QC section jumps use HTML fragments #before and #after.
- Staff must still complete and approve each checklist manually.
- QC is NOT yet a mandatory server-side gate for collection: this patch
  changes NAVIGATION only and does not prevent collection without QC.

ROLLBACK
Restore your previously downloaded current repair-new.php and repair-view.php.
There are no tables to roll back.

VALIDATION
Both PHP files pass php -l in the build environment; static checks confirm
branch-specific redirects and preservation of workflow transaction handling.
Live cPanel / MariaDB functional tests have not been performed.
