Hopefully this works... QR stop and start?
This commit is contained in:
@@ -161,9 +161,20 @@ function handle_start_qr_scanning() {
|
|||||||
.then((ignore: any) => {
|
.then((ignore: any) => {
|
||||||
console.log('Scanning has started');
|
console.log('Scanning has started');
|
||||||
scanning_status = 'scanning';
|
scanning_status = 'scanning';
|
||||||
|
|
||||||
|
// let subject = 'QR Scanning Started';
|
||||||
|
// let message = ignore;
|
||||||
|
// send_init_confirm_email(subject, message);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.log('There was an error while trying to start the QR scanner');
|
console.log('There was an error while trying to start the QR scanner');
|
||||||
|
scanning_status = 'start_error';
|
||||||
|
|
||||||
|
let subject = 'QR Scanning Start Error';
|
||||||
|
let message = err;
|
||||||
|
send_init_confirm_email(subject, message);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -192,27 +203,47 @@ function handle_resume_qr_scanning() {
|
|||||||
|
|
||||||
|
|
||||||
async function handle_stop_qr_scanning() {
|
async function handle_stop_qr_scanning() {
|
||||||
if (html5_qr_code && html5_qr_code.getState() == Html5QrcodeScannerState.NOT_STARTED) {
|
start_qr_scanner = false;
|
||||||
|
|
||||||
|
if (!html5_qr_code) {
|
||||||
|
console.log('html5_qr_code object found. Nothing to stop?');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let state = html5_qr_code.getState();
|
||||||
|
console.log('html5_qr_code state:', state);
|
||||||
|
|
||||||
|
if (state == Html5QrcodeScannerState.NOT_STARTED) {
|
||||||
console.log('Scanner is not started');
|
console.log('Scanner is not started');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (state == Html5QrcodeScannerState.PAUSED || state == Html5QrcodeScannerState.SCANNING) {
|
||||||
|
console.log('Scanner is not started');
|
||||||
|
await html5_qr_code.stop()
|
||||||
|
scanning_status = 'not_started';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await html5_qr_code.clear();
|
||||||
|
return true;
|
||||||
|
|
||||||
// html5_qr_code.pause();
|
// html5_qr_code.pause();
|
||||||
|
|
||||||
await html5_qr_code.stop().then((ignore) => {
|
// return html5_qr_code.stop()
|
||||||
console.log('Scanning has stopped');
|
// .then((ignore) => {
|
||||||
// document.getElementById('qr_scanner_viewfinder').classList.add('d_none');
|
// console.log('Scanning has stopped');
|
||||||
scanning_status = 'not_started';
|
// // document.getElementById('qr_scanner_viewfinder').classList.add('d_none');
|
||||||
}).then((ignore) => {
|
// scanning_status = 'not_started';
|
||||||
// html5_qr_code = null;
|
// }).then((ignore) => {
|
||||||
html5_qr_code.clear();
|
// // html5_qr_code = null;
|
||||||
}).catch((err) => {
|
// // html5_qr_code.clear();
|
||||||
console.log('There was an error while trying to stop the scanning');
|
// }).catch((err) => {
|
||||||
return false;
|
// console.log('There was an error while trying to stop the scanning');
|
||||||
});
|
// return false;
|
||||||
|
// });
|
||||||
|
|
||||||
// html5_qr_code = null;
|
// html5_qr_code = null;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ let lq__event_badge_li = liveQuery(
|
|||||||
let ae_promises: key_val = {};
|
let ae_promises: key_val = {};
|
||||||
let load_obj_li_results: Promise<any>|key_val;
|
let load_obj_li_results: Promise<any>|key_val;
|
||||||
let search_submit_results: Promise<any>|key_val;
|
let search_submit_results: Promise<any>|key_val;
|
||||||
let scan_submit_results: Promise<any>|key_val;
|
// let scan_submit_results: Promise<any>|key_val;
|
||||||
|
|
||||||
|
|
||||||
$ae_loc.hostname = data.url.hostname;
|
$ae_loc.hostname = data.url.hostname;
|
||||||
|
|||||||
@@ -216,7 +216,6 @@ function handle_qr_camera(event) {
|
|||||||
$events_sess.leads.show_form__scan = true;
|
$events_sess.leads.show_form__scan = true;
|
||||||
$events_sess.leads.qr_scan_start = true;
|
$events_sess.leads.qr_scan_start = true;
|
||||||
}}
|
}}
|
||||||
disabled={!$ae_loc.trusted_access && 2==4}
|
|
||||||
title="Scan a QR code to add a person to the leads list."
|
title="Scan a QR code to add a person to the leads list."
|
||||||
>
|
>
|
||||||
<span class="fas fa-qrcode mx-1"></span>
|
<span class="fas fa-qrcode mx-1"></span>
|
||||||
@@ -663,7 +662,13 @@ function handle_qr_camera(event) {
|
|||||||
|
|
||||||
|
|
||||||
<!-- <div class=""> -->
|
<!-- <div class=""> -->
|
||||||
<Element_qr_scanner start_qr_scanner={$events_sess.leads.qr_scan_start} show_qr_scan_result={true} show_qr_manual_badge_id_entry_option={true} on:qr_scan_result={handle_qr_scan_result} on:qr_camera={handle_qr_camera} />
|
<Element_qr_scanner
|
||||||
|
start_qr_scanner={$events_sess.leads.qr_scan_start}
|
||||||
|
show_qr_scan_result={true}
|
||||||
|
show_qr_manual_badge_id_entry_option={true}
|
||||||
|
on:qr_scan_result={handle_qr_scan_result}
|
||||||
|
on:qr_camera={handle_qr_camera}
|
||||||
|
/>
|
||||||
<!-- </div> -->
|
<!-- </div> -->
|
||||||
|
|
||||||
<div class="qr_quick_results variant-soft-secondary font-bold p-4">
|
<div class="qr_quick_results variant-soft-secondary font-bold p-4">
|
||||||
@@ -794,25 +799,26 @@ function handle_qr_camera(event) {
|
|||||||
</section> <!-- .popover__content -->
|
</section> <!-- .popover__content -->
|
||||||
|
|
||||||
<footer class="popover__footer flex gap-1 justify-between items-center p-1 border-t">
|
<footer class="popover__footer flex gap-1 justify-between items-center p-1 border-t">
|
||||||
<div class="popover__content__actions">
|
<!-- <div class="popover__content__actions">
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="button"
|
||||||
form="form__scan_text"
|
|
||||||
class="btn variant-soft-primary"
|
class="btn variant-soft-primary"
|
||||||
disabled={scan_submit_results instanceof Promise && !scan_submit_results}
|
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
// trigger = 'save__ds__code';
|
$events_sess.leads.qr_scan_start = !$events_sess.leads.qr_scan_start;
|
||||||
// $slct_trigger = 'save__ds__code';
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<span class="fas fa-search mx-1"></span>
|
<span class="fas fa-search mx-1"></span>
|
||||||
Scan
|
{#if $events_sess.leads.qr_scan_start}
|
||||||
|
Stop Scanning
|
||||||
|
{:else}
|
||||||
|
Scanning
|
||||||
|
{/if}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div> -->
|
||||||
|
|
||||||
<div class="popover__status">
|
<div class="popover__status">
|
||||||
<!-- Something text -->
|
<!-- Something text -->
|
||||||
{#await scan_submit_results}
|
<!-- {#await scan_submit_results}
|
||||||
<div class="modal-loading">
|
<div class="modal-loading">
|
||||||
<span class="fas fa-spinner fa-spin"></span>
|
<span class="fas fa-spinner fa-spin"></span>
|
||||||
<span class="loading-text">
|
<span class="loading-text">
|
||||||
@@ -829,7 +835,7 @@ function handle_qr_camera(event) {
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{/await}
|
{/await} -->
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="ae_debug"
|
class="ae_debug"
|
||||||
@@ -844,8 +850,8 @@ function handle_qr_camera(event) {
|
|||||||
type="button"
|
type="button"
|
||||||
class="btn variant-soft-primary"
|
class="btn variant-soft-primary"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
|
|
||||||
$events_sess.leads.show_form__scan = false;
|
$events_sess.leads.show_form__scan = false;
|
||||||
|
$events_sess.leads.qr_scan_start = false;
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<span class="fas fa-times mx-1"></span>
|
<span class="fas fa-times mx-1"></span>
|
||||||
|
|||||||
Reference in New Issue
Block a user