2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-05-01 04:56:45 +00:00

Fix JS styling

This commit is contained in:
Kálmán Rózsahegyi 2022-04-30 12:14:13 +02:00
parent 8b279edee0
commit b37bb3eb3e

View File

@ -54,14 +54,12 @@ function makeBarcodeInput(placeholderText='', hintText='') {
qrScanner = null; qrScanner = null;
function startQrScanner() function startQrScanner() {
{
$('#barcode_scan_video_container').show(); $('#barcode_scan_video_container').show();
qrScanner.start(); qrScanner.start();
} }
function stopQrScanner() function stopQrScanner() {
{
if (qrScanner != null) qrScanner.stop(); if (qrScanner != null) qrScanner.stop();
$('#barcode_scan_video_container').hide(); $('#barcode_scan_video_container').hide();
} }
@ -74,7 +72,7 @@ function onCameraAvailable(hasCamera, options) {
if ( hasCamera == true ) { if ( hasCamera == true ) {
// Camera is only acccessible if page is served over secure connection // Camera is only acccessible if page is served over secure connection
if ( window.isSecureContext == true ) { if ( window.isSecureContext == true ) {
qrScanner = new QrScanner(document.getElementById('barcode_scan_video'), result => onBarcodeScanCompleted(result, options), { qrScanner = new QrScanner(document.getElementById('barcode_scan_video'), (result => onBarcodeScanCompleted(result, options)), {
highlightScanRegion: true, highlightScanRegion: true,
highlightCodeOutline: true, highlightCodeOutline: true,
}); });
@ -83,8 +81,7 @@ function onCameraAvailable(hasCamera, options) {
} }
} }
function onBarcodeScanCompleted(result, options) function onBarcodeScanCompleted(result, options) {
{
if (result.data == '') return; if (result.data == '') return;
console.log('decoded qr code:', result.data); console.log('decoded qr code:', result.data);
stopQrScanner(); stopQrScanner();
@ -230,7 +227,7 @@ function barcodeDialog(title, options={}) {
$(modal + ' .modal-form-content').scrollTop(0); $(modal + ' .modal-form-content').scrollTop(0);
// Check for qr-scanner camera // Check for qr-scanner camera
QrScanner.hasCamera().then( hasCamera => onCameraAvailable(hasCamera, options) ); QrScanner.hasCamera().then( (hasCamera => onCameraAvailable(hasCamera, options)) );
var barcode = $(modal + ' #barcode'); var barcode = $(modal + ' #barcode');