Scan/OCR improvements: Scan New Asset button, fix barcode scanner, serial number OCR search #63

Closed
opened 2026-06-02 22:05:31 +00:00 by shawn · 0 comments
Owner

Changes

1. Scan New Asset button

  • Added Scan New button after scanning/OCR'ing an existing asset in both barcode and OCR modes
  • Barcode scans now show result in-place (no longer navigate away to Assets tab)
  • Added resetBarcodeScanner() and resetOcrScanner() functions that cleanly reset to scan-ready state
  • Also added Scan New button to the showNewAssetForm (asset not found case)

2. Barcode scanner fix

  • Removed TRY_HARDER decode hint (was too slow on mobile — caused frame-rate decode thrashing)
  • Reduced from 13 barcode formats to 7 focused 1D formats (CODE_128, CODE_39, EAN_13, EAN_8, UPC_A, UPC_E, ITF)
  • Added checkZxingLoaded() to detect CDN load failures early
  • Extended camera fail timeout from 5s to 10s for slower mobile browsers
  • Added showFallbackCameraError() for clear messaging when camera is unavailable

3. OCR serial number search

  • Server already returns matched_assets from DB cross-referencing (serial_number, connect_id, etc.)
  • Previously client displayOcrResult() ignored matched_assets when machine_id was null
  • Now shows ✅ Asset found via serial/ID match with matched asset details and View Details buttons
  • Also shows serial/ID matches as supplementary info when machine_id IS found

Files modified

  • static/index.html — frontend SPA

Verification

  • Server restarted and serving on :8901
  • All 4 new functions exist in browser runtime
  • OCR with matched_assets renders correctly (serial number search)
  • Barcode result shows both View Details and Scan New buttons
  • commit dd4744d pushed to gitea
## Changes ### 1. Scan New Asset button - Added `Scan New` button after scanning/OCR'ing an existing asset in both barcode and OCR modes - Barcode scans now show result in-place (no longer navigate away to Assets tab) - Added `resetBarcodeScanner()` and `resetOcrScanner()` functions that cleanly reset to scan-ready state - Also added `Scan New` button to the `showNewAssetForm` (asset not found case) ### 2. Barcode scanner fix - Removed `TRY_HARDER` decode hint (was too slow on mobile — caused frame-rate decode thrashing) - Reduced from 13 barcode formats to 7 focused 1D formats (CODE_128, CODE_39, EAN_13, EAN_8, UPC_A, UPC_E, ITF) - Added `checkZxingLoaded()` to detect CDN load failures early - Extended camera fail timeout from 5s to 10s for slower mobile browsers - Added `showFallbackCameraError()` for clear messaging when camera is unavailable ### 3. OCR serial number search - Server already returns `matched_assets` from DB cross-referencing (serial_number, connect_id, etc.) - Previously client `displayOcrResult()` ignored `matched_assets` when machine_id was null - Now shows `✅ Asset found via serial/ID match` with matched asset details and View Details buttons - Also shows serial/ID matches as supplementary info when machine_id IS found ## Files modified - `static/index.html` — frontend SPA ## Verification - [x] Server restarted and serving on :8901 - [x] All 4 new functions exist in browser runtime - [x] OCR with matched_assets renders correctly (serial number search) - [x] Barcode result shows both View Details and Scan New buttons - [x] commit dd4744d pushed to gitea
shawn closed this issue 2026-06-02 22:06:01 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shawn/canteen-asset-tracker#63