Bug fix for QR scan. Clean up for the day!
This commit is contained in:
@@ -39,7 +39,7 @@ let disable_submit_badge_id_btn: boolean = true;
|
|||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
|
|
||||||
let html5_qr_code: null|string = null;
|
let html5_qr_code: any|null|string = null;
|
||||||
// let html5_qr_code = new Html5Qrcode(
|
// let html5_qr_code = new Html5Qrcode(
|
||||||
// 'qr_scanner_viewfinder', { formatsToSupport: [ Html5QrcodeSupportedFormats.QR_CODE ] }
|
// 'qr_scanner_viewfinder', { formatsToSupport: [ Html5QrcodeSupportedFormats.QR_CODE ] }
|
||||||
// );
|
// );
|
||||||
@@ -66,18 +66,21 @@ onMount(() => {
|
|||||||
onDestroy(() => {
|
onDestroy(() => {
|
||||||
console.log('** Element Destroyed: ** QR Scanner');
|
console.log('** Element Destroyed: ** QR Scanner');
|
||||||
|
|
||||||
|
qr_scan_result = null;
|
||||||
|
qr_found_text = null;
|
||||||
|
|
||||||
handle_stop_qr_scanning();
|
handle_stop_qr_scanning();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
var successCallback = function(error) {
|
var successCallback = function(error: any) {
|
||||||
console.log('Camera access allowed');
|
console.log('Camera access allowed');
|
||||||
|
|
||||||
dispatch('qr_camera', {
|
dispatch('qr_camera', {
|
||||||
status: 'allowed',
|
status: 'allowed',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
var errorCallback = function(error) {
|
var errorCallback = function(error: any) {
|
||||||
if (error.name == 'NotAllowedError') {
|
if (error.name == 'NotAllowedError') {
|
||||||
console.log('Camera access not allowed!');
|
console.log('Camera access not allowed!');
|
||||||
|
|
||||||
@@ -125,7 +128,7 @@ function handle_start_qr_scanning() {
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
html5_qr_code.start({ facingMode: qr_facing_mode }, qr_scan_cfg, handle_qr_scan_success, handle_qr_scan_error).then((ignore) => {
|
html5_qr_code.start({ facingMode: qr_facing_mode }, qr_scan_cfg, handle_qr_scan_success, handle_qr_scan_error).then((ignore: any) => {
|
||||||
console.log('Scanning has started');
|
console.log('Scanning has started');
|
||||||
scanning_status = 'scanning';
|
scanning_status = 'scanning';
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ import Element_qr_scanner from '$lib/element_qr_scanner.svelte';
|
|||||||
|
|
||||||
|
|
||||||
// TEMPORARY: For testing and development
|
// TEMPORARY: For testing and development
|
||||||
$events_sess.leads.show_form__search = true;
|
// $events_sess.leads.show_form__search = true;
|
||||||
|
// $events_sess.leads.show_form__scan = true;
|
||||||
// TEMPORARY: For testing and development
|
// TEMPORARY: For testing and development
|
||||||
|
|
||||||
|
|
||||||
@@ -357,7 +358,7 @@ function handle_qr_camera(event) {
|
|||||||
|
|
||||||
$events_sess.leads.show_confirm__add_lead[index] = true;
|
$events_sess.leads.show_confirm__add_lead[index] = true;
|
||||||
}}
|
}}
|
||||||
disabled={!$ae_loc.trusted_access}
|
disabled={!$ae_loc.trusted_access && 2==4}
|
||||||
title="Add {event_badge_obj_v2.full_name} to the leads list?"
|
title="Add {event_badge_obj_v2.full_name} to the leads list?"
|
||||||
class="btn btn-md variant-soft-primary mx-1"
|
class="btn btn-md variant-soft-primary mx-1"
|
||||||
>
|
>
|
||||||
@@ -418,9 +419,16 @@ function handle_qr_camera(event) {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="btn variant-soft-primary"
|
class="btn variant-soft-primary"
|
||||||
|
disabled={!$ae_loc.trusted_access}
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
console.log(`Add ${event_badge_obj_v2.full_name} ${event_badge_obj_v2.email} to the leads list`);
|
console.log(`Add ${event_badge_obj_v2.full_name} ${event_badge_obj_v2.email} to the leads list`);
|
||||||
|
|
||||||
|
// TEMPORARY: For testing and development
|
||||||
|
if (!$ae_loc.trusted_access) {
|
||||||
|
console.log('You do not have permission to add this person to the leads list.');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// TEMPORARY: For testing and development
|
||||||
|
|
||||||
events_func.handle_create_ae_obj__exhibit_tracking({api_cfg: $ae_api, exhibit_id: $events_slct.exhibit_id, event_badge_id: event_badge_obj_v2.event_badge_id_random, external_person_id: $events_loc.leads.auth_exhibit_kv[$events_slct.exhibit_id].key, })
|
events_func.handle_create_ae_obj__exhibit_tracking({api_cfg: $ae_api, exhibit_id: $events_slct.exhibit_id, event_badge_id: event_badge_obj_v2.event_badge_id_random, external_person_id: $events_loc.leads.auth_exhibit_kv[$events_slct.exhibit_id].key, })
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
@@ -688,10 +696,10 @@ 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_confirm__add_lead[$events_slct.badge_id] = false;
|
||||||
|
|
||||||
$events_slct.badge_id = null;
|
$events_slct.badge_id = null;
|
||||||
$events_slct.badge_obj = null;
|
$events_slct.badge_obj = null;
|
||||||
|
|
||||||
$events_sess.leads.show_confirm__add_lead[$events_slct.badge_id] = false;
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<span class="fas fa-times mx-1"></span>
|
<span class="fas fa-times mx-1"></span>
|
||||||
@@ -710,10 +718,13 @@ function handle_qr_camera(event) {
|
|||||||
on:click={() => {
|
on:click={() => {
|
||||||
console.log(`Do not add ${$event_badge_obj.full_name} ${$event_badge_obj.email} to the leads list`);
|
console.log(`Do not add ${$event_badge_obj.full_name} ${$event_badge_obj.email} to the leads list`);
|
||||||
|
|
||||||
|
$events_sess.leads.show_confirm__add_lead[$events_slct.badge_id] = false;
|
||||||
|
|
||||||
$events_slct.badge_id = null;
|
$events_slct.badge_id = null;
|
||||||
$events_slct.badge_obj = null;
|
$events_slct.badge_obj = null;
|
||||||
|
|
||||||
$events_sess.leads.show_confirm__add_lead[$events_sess.leads.qr_scan_result] = false;
|
// $events_slct = $events_slct;
|
||||||
|
// $events_sess = $events_sess;
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<span class="fas fa-times mx-1"></span>
|
<span class="fas fa-times mx-1"></span>
|
||||||
@@ -723,9 +734,16 @@ function handle_qr_camera(event) {
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="btn variant-soft-primary"
|
class="btn variant-soft-primary"
|
||||||
|
disabled={!$ae_loc.trusted_access}
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
console.log(`Add ${event_badge_obj.full_name} ${event_badge_obj.email} to the leads list`);
|
console.log(`Add ${event_badge_obj.full_name} ${event_badge_obj.email} to the leads list`);
|
||||||
|
|
||||||
|
// TEMPORARY: For testing and development
|
||||||
|
if (!$ae_loc.trusted_access) {
|
||||||
|
console.log('You do not have permission to add this person to the leads list.');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// TEMPORARY: For testing and development
|
||||||
|
|
||||||
events_func.handle_create_ae_obj__exhibit_tracking({api_cfg: $ae_api, exhibit_id: $events_slct.exhibit_id, event_badge_id: $events_slct.badge_id, external_person_id: $events_loc.leads.auth_exhibit_kv[$events_slct.exhibit_id].key, })
|
events_func.handle_create_ae_obj__exhibit_tracking({api_cfg: $ae_api, exhibit_id: $events_slct.exhibit_id, event_badge_id: $events_slct.badge_id, external_person_id: $events_loc.leads.auth_exhibit_kv[$events_slct.exhibit_id].key, })
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
@@ -738,15 +756,16 @@ function handle_qr_camera(event) {
|
|||||||
|
|
||||||
$events_slct.exhibit_tracking_id = exhibit_tracking_id;
|
$events_slct.exhibit_tracking_id = exhibit_tracking_id;
|
||||||
$events_slct.exhibit_tracking_obj = exhibit_tracking_obj;
|
$events_slct.exhibit_tracking_obj = exhibit_tracking_obj;
|
||||||
|
|
||||||
$events_sess.leads.show_confirm__add_lead[$events_slct.badge_id] = false;
|
|
||||||
} else {
|
} else {
|
||||||
console.log('This badge ID has probably already been added to the lead list for this exhibit.');
|
console.log('This badge ID has probably already been added to the lead list for this exhibit.');
|
||||||
|
|
||||||
// Need to look the old record up and set it to not hidden.
|
// Need to look the old record up and set it to not hidden.
|
||||||
|
|
||||||
$events_sess.leads.show_confirm__add_lead[$events_slct.badge_id] = false;
|
|
||||||
}
|
}
|
||||||
|
$events_sess.leads.show_confirm__add_lead[$events_slct.badge_id] = false;
|
||||||
|
|
||||||
|
// $events_sess.leads.show_confirm__add_lead[$events_slct.badge_id] = false;
|
||||||
|
$events_slct.badge_id = null;
|
||||||
|
$events_slct.badge_obj = null;
|
||||||
|
|
||||||
if ($events_loc.leads.auto_view) {
|
if ($events_loc.leads.auto_view) {
|
||||||
$events_sess.leads.show_form__search = false;
|
$events_sess.leads.show_form__search = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user