Add 2D barcode scanning + connect_id search
- Add QR_CODE, DATA_MATRIX, PDF_417, AZTEC to barcode scanner hints so serial number stickers with 2D barcodes can be scanned - Update /api/assets/search to also match connect_id so full Connect IDs (e.g. VM-05912-0000068454) work when scanned - Bump SW cache v5→v6, footer v3.2→v3.3
This commit is contained in:
@@ -1129,7 +1129,8 @@ def list_assets(
|
|||||||
def search_by_machine_id(machine_id: str = Query(...)):
|
def search_by_machine_id(machine_id: str = Query(...)):
|
||||||
conn = get_db()
|
conn = get_db()
|
||||||
row = conn.execute(
|
row = conn.execute(
|
||||||
"SELECT * FROM assets WHERE machine_id = ?", (machine_id,)
|
"SELECT * FROM assets WHERE machine_id = ? OR connect_id = ?",
|
||||||
|
(machine_id, machine_id),
|
||||||
).fetchone()
|
).fetchone()
|
||||||
conn.close()
|
conn.close()
|
||||||
if row is None:
|
if row is None:
|
||||||
|
|||||||
+7
-3
@@ -1091,7 +1091,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</nav>
|
</nav>
|
||||||
<div class="drawer-footer">
|
<div class="drawer-footer">
|
||||||
<div style="margin-bottom:6px;">Canteen Asset Tracker v3.2</div>
|
<div style="margin-bottom:6px;">Canteen Asset Tracker v3.3</div>
|
||||||
<div style="font-size:11px;line-height:1.5;margin-bottom:6px;">
|
<div style="font-size:11px;line-height:1.5;margin-bottom:6px;">
|
||||||
<kbd>Esc</kbd> to close · <kbd>Ctrl</kbd>+<kbd>/</kbd> to search · ❓ for help
|
<kbd>Esc</kbd> to close · <kbd>Ctrl</kbd>+<kbd>/</kbd> to search · ❓ for help
|
||||||
</div>
|
</div>
|
||||||
@@ -2363,8 +2363,8 @@
|
|||||||
// BARCODE MODE
|
// BARCODE MODE
|
||||||
// ═══════════════════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════════════════
|
||||||
function _barcodeHints() {
|
function _barcodeHints() {
|
||||||
// Restrict to 1D barcode formats only — much faster and more accurate
|
// All formats — 1D (Code 128, EAN, UPC, etc.) + 2D (QR, DataMatrix,
|
||||||
// than scanning all formats (QR, DataMatrix, PDF417, Aztec, etc.)
|
// PDF417, Aztec) for serial number stickers with 2D barcodes.
|
||||||
const hints = new Map();
|
const hints = new Map();
|
||||||
const fmts = [
|
const fmts = [
|
||||||
ZXing.BarcodeFormat.CODE_128,
|
ZXing.BarcodeFormat.CODE_128,
|
||||||
@@ -2376,6 +2376,10 @@
|
|||||||
ZXing.BarcodeFormat.CODE_93,
|
ZXing.BarcodeFormat.CODE_93,
|
||||||
ZXing.BarcodeFormat.ITF,
|
ZXing.BarcodeFormat.ITF,
|
||||||
ZXing.BarcodeFormat.CODABAR,
|
ZXing.BarcodeFormat.CODABAR,
|
||||||
|
ZXing.BarcodeFormat.QR_CODE,
|
||||||
|
ZXing.BarcodeFormat.DATA_MATRIX,
|
||||||
|
ZXing.BarcodeFormat.PDF_417,
|
||||||
|
ZXing.BarcodeFormat.AZTEC,
|
||||||
];
|
];
|
||||||
hints.set(ZXing.DecodeHintType.POSSIBLE_FORMATS, fmts);
|
hints.set(ZXing.DecodeHintType.POSSIBLE_FORMATS, fmts);
|
||||||
hints.set(ZXing.DecodeHintType.TRY_HARDER, true);
|
hints.set(ZXing.DecodeHintType.TRY_HARDER, true);
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
// Caches app shell + CDN deps. Network-first for API, cache fallback for static.
|
// Caches app shell + CDN deps. Network-first for API, cache fallback for static.
|
||||||
// ═══════════════════════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
const CACHE_NAME = 'canteen-v5';
|
const CACHE_NAME = 'canteen-v6';
|
||||||
|
|
||||||
// App shell — core resources needed to boot the PWA
|
// App shell — core resources needed to boot the PWA
|
||||||
const APP_SHELL = [
|
const APP_SHELL = [
|
||||||
|
|||||||
Reference in New Issue
Block a user