Started barcode scanning basics
This commit is contained in:
parent
26fb8073ed
commit
d25bd44d15
2 changed files with 11 additions and 2 deletions
|
|
@ -10,5 +10,6 @@
|
||||||
|
|
||||||
<body onload="loadProducts()">
|
<body onload="loadProducts()">
|
||||||
</body>
|
</body>
|
||||||
|
<input id="barcode_input" type="text">
|
||||||
|
<button onclick="scan_product()">Scan barcode</button>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -16,3 +16,11 @@ async function loadProducts() {
|
||||||
console.log("Loaded products:", all_products)
|
console.log("Loaded products:", all_products)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function scan_product() {
|
||||||
|
const barcode = document.getElementById('barcode_input').value
|
||||||
|
for (index = 0; index < all_products.length; index++) {
|
||||||
|
if (all_products[index].barcode == barcode) {
|
||||||
|
console.log(all_products[index])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue