Generic Commit; Most likely a fix or small feature
This commit is contained in:
@@ -615,18 +615,6 @@ body {
|
|||||||
Point the camera at the barcode or QR code
|
Point the camera at the barcode or QR code
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<form id="scanner-barcode-form" class="form">
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
name="barcode"
|
|
||||||
placeholder="Or enter barcode manually"
|
|
||||||
class="input"
|
|
||||||
/>
|
|
||||||
<button id="start-scan-btn" type="submit" class="btn btn-green">
|
|
||||||
Search
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<button id="stop-scanner-btn" class="btn btn-cancel">
|
<button id="stop-scanner-btn" class="btn btn-cancel">
|
||||||
<svg
|
<svg
|
||||||
class="icon-sm"
|
class="icon-sm"
|
||||||
@@ -657,8 +645,9 @@ body {
|
|||||||
<p class="error-title">❌ Error</p>
|
<p class="error-title">❌ Error</p>
|
||||||
<p id="error-message" class="error-message"></p>
|
<p id="error-message" class="error-message"></p>
|
||||||
<button id="error-back-btn" class="btn btn-danger">
|
<button id="error-back-btn" class="btn btn-danger">
|
||||||
Back
|
import type { ProductAnalysis } from "..import type { ProductAnalysis } from "../types";
|
||||||
</button>
|
import { analyzeProduct } from "../utils/productAnalysis";types";
|
||||||
|
import { analyzeProduct } from "../utils/productAnalysis";
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -907,29 +896,17 @@ import { analyzeProduct } from "../utils/productAnalysis";
|
|||||||
barcodeDisplay.textContent = "";
|
barcodeDisplay.textContent = "";
|
||||||
showView(scannerView);
|
showView(scannerView);
|
||||||
|
|
||||||
let selectedDeviceId : string;
|
|
||||||
codeReader = new window.ZXing.BrowserMultiFormatReader();
|
codeReader = new window.ZXing.BrowserMultiFormatReader();
|
||||||
|
|
||||||
codeReader.listVideoInputDevices().then((videoInputDevices: unknown) => {
|
document.getElementById('start-scanner-btn').addEventListener('click', () => {
|
||||||
selectedDeviceId = videoInputDevices[0].deviceId
|
codeReader.decodeFromVideoDevice(undefined, 'scanner-video', (result, err) => {
|
||||||
if (videoInputDevices.length >= 1) {
|
if (result) {
|
||||||
videoInputDevices.forEach((element) => {
|
const code = result.getText();
|
||||||
const sourceOption = document.createElement('option')
|
barcodeDisplay.textContent = code;
|
||||||
sourceOption.text = element.label
|
barcodeDisplay.style.display = "block";
|
||||||
sourceOption.value = element.deviceId
|
codeReader.reset();
|
||||||
})
|
searchProduct(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById('start-scan-btn').addEventListener('click', () => {
|
|
||||||
codeReader.decodeFromVideoDevice(undefined, 'scanner-video', (result, err) => {
|
|
||||||
if (result) {
|
|
||||||
const code = result.getText();
|
|
||||||
barcodeDisplay.textContent = code;
|
|
||||||
barcodeDisplay.style.display = "block";
|
|
||||||
codeReader.reset();
|
|
||||||
searchProduct(code);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user