It has been a long two or three weeks...

This commit is contained in:
Scott Idem
2024-03-15 17:48:14 -04:00
parent 68b0efb6c9
commit 0400aa429b
13 changed files with 725 additions and 222 deletions

View File

@@ -178,6 +178,13 @@ async function handle_load_ae_obj_li__exhibit({api_cfg, event_id, try_cache=true
let params = {};
let params_json: key_val = {};
// params_json['and_qry'] = {};
// params_json['and_qry']['license_max'] = 10;
params_json['and_in_li'] = {
license_max : [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
};
// if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) {
// params_json['ft_qry'] = {
// 'default_qry_str': fulltext_search_qry_str,
@@ -203,7 +210,7 @@ async function handle_load_ae_obj_li__exhibit({api_cfg, event_id, try_cache=true
// order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'created_on': 'DESC', 'updated_on': 'DESC'},
limit: limit,
offset: offset,
// params_json: params_json,
params_json: params_json,
params: params,
log_lvl: 2
})

View File

@@ -59,6 +59,10 @@ let events_local_data_struct: key_val = {
// // 'LNDF-67-89-92': { 'key': 'example@oneskyit.com', 'updated_on': '2024-03-13T08:05:29Z'}
// },
edit_license_li: false,
// The "tab" is a key value list of exhibit ID and tab name. This is intentionally using local storage to store the current tab for each exhibit.
// example: {'LNDF-67-89-92': 'start', 'OFLN-32-38-14': 'add_scan'}
tab: {},
},
// Presentation Management (Distributing)
@@ -119,7 +123,9 @@ let events_session_data_struct: key_val = {
'passcode': '',
'session_count': 0,
'updated_on': new Date().toISOString()
}
},
qr_scan_result: null,
},
// Presentation Management (Distributing)
@@ -132,7 +138,10 @@ console.log(`AE Stores - App Events Session Storage Data:`, events_session_data_
export let events_sess = writable(events_session_data_struct);
/* *** BEGIN *** Initialize ae_events_slct */
/* *** BEGIN *** Initialize events_slct and events_trigger */
/* The slct and slct_trigger variable should not be stored in local storage. Only use session storage because browser tabs can be open to different events, badges, exhibits, etc. */
// Intended for temporary session storage.
// Updated 2024-03-06
let events_slct_obj_template: key_val = {
// Top level
@@ -144,15 +153,19 @@ let events_slct_obj_template: key_val = {
'abstract_id': null,
'abstract_obj': {},
'abstract_obj_li': [],
'badge_id': null,
'badge_obj': {},
'badge_obj_li': [],
'badge_template_id': null,
'badge_template_obj': {},
'badge_template_obj_li': [],
'device_id': null,
'device_obj': {},
'device_obj_li': [],
'exhibit_id': null,
'exhibit_obj': {},
'exhibit_obj_li': [],
@@ -165,32 +178,38 @@ let events_slct_obj_template: key_val = {
'file_id': null,
'file_obj': {},
'file_obj_li': [],
'location_id': null,
'location_obj': {},
'location_obj_li': [],
'person_id': null,
'person_obj': {},
'person_obj_li': [],
'presentation_id': null,
'presentation_obj': {},
'presentation_obj_li': [],
'presenter_id': null,
'presenter_obj': {},
'presenter_obj_li': [],
'session_id': null,
'session_obj': {},
'session_obj_li': [],
};
// console.log(`AE Stores - Selected Events Objects:`, events_slct_obj_template);
// This works, but does not uses local storage:
// export let slct = writable(events_slct_obj_template);
// This works, and uses *session* (not local) storage:
export let events_slct = writable(events_slct_obj_template);
// This works and uses *local* storage:
export let events_slct: Writable<key_val> = localStorageStore('ae_events_slct', events_slct_obj_template);
// export let events_slct: Writable<key_val> = localStorageStore('ae_events_slct', events_slct_obj_template);
/* *** BEGIN *** Initialize ae_events_trigger */
/* *** BEGIN *** Initialize events_trigger */
// Intended for temporary session storage.
// Updated 2024-03-06
export let events_trigger: any = writable(null);
// console.log(`AE Stores - Selected Trigger:`, ae_events_trigger);
// console.log(`AE Events Stores - Events Trigger:`, events_trigger);

View File

@@ -213,20 +213,21 @@ export let ae_api = writable(ae_api_data_struct);
let ae_trig_template: key_val = {};
export let ae_trig = writable(ae_trig_template);
/* *** BEGIN *** Initialize slct_trigger and slct variables. The slct variable can be stored with local storage. */
// Updated 2024-02-27
export let slct_trigger: any = writable(null);
// console.log(`AE Stores - Selected Trigger:`, slct_trigger);
/* *** BEGIN *** Initialize slct and slct_trigger */
/* The slct and slct_trigger variable should not be stored in local storage. Only use session storage because browser tabs can be open to different accounts, events, sponsorships, etc. */
// Intended for temporary session storage.
// Updated 2024-03-15
let slct_obj_template: key_val = {
'account_id': ae_account_id,
'account_obj': {},
'event_id': null,
'event_obj': {},
'event_obj_li': [],
'event_exhibit_id': null,
'event_exhibit_obj': {},
'event_exhibit_obj_li': [],
// 'event_exhibit_id': null,
// 'event_exhibit_obj': {},
// 'event_exhibit_obj_li': [],
'event_presentation_id': null,
'event_presentation_obj': {},
'event_presentation_obj_li': [],
@@ -251,8 +252,15 @@ let slct_obj_template: key_val = {
};
// console.log(`AE Stores - Selected Objects:`, slct_obj_template);
// This works, but does not uses local storage:
// export let slct = writable(slct_obj_template);
// This works, and uses *session* (not local) storage:
export let slct = writable(slct_obj_template);
// This works and uses local storage:
export let slct: Writable<key_val> = localStorageStore('ae_slct', slct_obj_template);
// This works and uses *local* storage:
// export let slct: Writable<key_val> = localStorageStore('ae_slct', slct_obj_template);
/* *** BEGIN *** Initialize slct_trigger */
// Intended for temporary session storage.
// Updated 2024-02-27
export let slct_trigger: any = writable(null);
// console.log(`AE Stores - Selected Trigger:`, slct_trigger);

View File

@@ -243,6 +243,94 @@ export let extract_prefixed_form_data = function extract_prefixed_form_data({pre
}
/* This utility function processes specific data string.
* MECARD
* OBJ = OBJ:ot:example,oi:asdf1234
* ot = Aether object type; oi = Aether object ID random
* KV = KV:"key":"value"
* JS = {"id":123,"name":"example name"}
* http or https?
* Common short keys used:
* bdg: Badge ID Random
* reg: Registration ID Random
* exid: External ID
* gn: Given First Name
* fn: Family Last Name
* em: Email Address
*/
// Updated 2022-02-11
export let process_data_string = function process_data_string(data_string) {
console.log('*** process_data_string() ***');
// console.log(data_string);
let obj = {};
let colon_index = data_string.indexOf(':')
if (colon_index) {
let data_string_type = data_string.slice(0, colon_index);
console.log(data_string_type);
obj['qr_type'] = data_string_type;
if (data_string_type == 'MECARD') {
let mecard_str = data_string.slice(colon_index+1);
console.log(mecard_str);
obj['str'] = mecard_str;
} else if (data_string_type == 'OBJ') {
let key_value_str = data_string.slice(colon_index+1);
console.log(key_value_str);
let key_value_array = key_value_str.split(',');
// console.log(key_value_array);
let ot_colon_index = key_value_array[0].indexOf(':')
let obj_type = key_value_array[0].slice(ot_colon_index+1);
// console.log(obj_type);
let oi_colon_index = key_value_array[1].indexOf(':')
let obj_id = key_value_array[1].slice(oi_colon_index+1);
// console.log(obj_id);
obj['type'] = obj_type;
obj['id'] = obj_id;
} else if (data_string_type == 'JSON') {
let partial_json_str = data_string.slice(colon_index+1);
console.log(partial_json_str);
let json_str = `{${partial_json_str}}`;
console.log(json_str);
obj['json'] = JSON.parse(json_str);
} else if (data_string_type == 'STR') {
let str = data_string.slice(colon_index+1);
console.log(str);
obj['str'] = str;
} else if (data_string_type == 'http' || data_string_type == 'https') {
console.log(`http or https: ${data_string}`);
obj['type'] = 'url';
obj['url'] = data_string;
} else {
console.log('The unknown data string type was found. Returning the string part.')
let unknown_str = data_string.slice(colon_index+1);
console.log(unknown_str);
obj['str'] = unknown_str;
}
} else {
console.log('The data string type was not found. Returning the entire string.')
console.log(data_string);
obj['qr_type'] = 'UNKNOWN';
obj['str'] = data_string;
// return false;
}
console.log(obj);
return obj; // Returns an object
}
// NOTE: I know there is a better more efficient way to do this, but I don't have time for that right now.
export let process_permission_checks = function process_permission_checks(access_type: string) {
// let access_checks = { 'access_type': null, 'super_check': null };
@@ -523,6 +611,7 @@ export let ae_util = {
iso_datetime_formatter: iso_datetime_formatter,
number_w_commas: number_w_commas,
extract_prefixed_form_data: extract_prefixed_form_data,
process_data_string: process_data_string,
process_permission_checks: process_permission_checks,
handle_url_and_message: handle_url_and_message,
create_a_element: create_a_element,

View File

@@ -784,7 +784,7 @@ export let get_ae_obj_li_for_obj_id_crud = async function get_ae_obj_li_for_obj_
if (params_json) {
// NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the search endpoint.
// Max charcters for a GET request is 2083. This is a limitation of the browser (Microsoft IE and Edge).
// Max characters for a GET request is 2083. This is a limitation of the browser (Microsoft IE and Edge).
console.log('JSON Object:', params_json);
// NOTE: "jp" stands for "JSON Params"
params['jp'] = encodeURIComponent(JSON.stringify(params_json));
@@ -796,7 +796,7 @@ export let get_ae_obj_li_for_obj_id_crud = async function get_ae_obj_li_for_obj_
// if (json_obj) {
// // NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the search endpoint.
// // Max charcters for a GET request is 2083. This is a limitation of the browser (Microsoft IE and Edge).
// // Max characters for a GET request is 2083. This is a limitation of the browser (Microsoft IE and Edge).
// console.log('JSON Object:', json_obj);
// params['json_str'] = encodeURIComponent(JSON.stringify(json_obj));
// if (params['json_str'].length > 2083) {

View File

@@ -3,6 +3,8 @@ import Dexie, { type Table } from 'dexie';
export interface Badge {
// id?: number;
id_random: string;
event_badge_id_random: string;
event_id_random: string;
full_name: string;
full_name_override: null|string;
email: string;
@@ -23,14 +25,26 @@ export interface Badge {
export interface Exhibit {
// id?: number;
id_random: string;
event_exhibit_id_random: string;
event_id_random: string;
code: string;
name: string;
tagline: null|string;
description: null|string;
staff_passcode: null
data_json: string;
data_json: null|string;
leads_api_access: null|boolean;
leads_custom_questions_json: null|string;
leads_device_sm_qty: null|number;
leads_device_lg_qty: null|number;
license_max: number;
license_li_json: string;
license_li_json: null|string;
cfg_json: string;
enable: boolean;
hide: boolean;
priority: boolean
sort: number;
group: string;
created_on: Date;
updated_on: Date;
}

View File

@@ -278,7 +278,7 @@ function handle_qr_manual_entry() {
<section
class="ae_element qr_scanner border border-2 border-primary p-2 space-y-2 flex flex-col gap-1 justify-center items-center"
class="ae_element qr_scanner border border-2 border-primary space-y-2 flex flex-col gap-1 justify-center items-center min-w-full max-w-full"
class:not_started={scanning_status == 'not_started'}
class:paused={scanning_status == 'paused'}
class:scanning={scanning_status == 'scanning'}
@@ -292,7 +292,7 @@ function handle_qr_manual_entry() {
<!-- <legend class="d_none">QR Scanner:</legend> -->
<div
class="ae_container qr_scanning_container flex flex-col gap-1 justify-center"
class="ae_container qr_scanning_container"
>
<div
class="ae_options"
@@ -300,10 +300,10 @@ function handle_qr_manual_entry() {
{#if scanning_status == 'not_started' }
<button on:click={handle_start_qr_scanning} class="btn btn-lg variant-soft-primary btn_start"><span class="fas fa-qrcode"></span> Start Scanning</button>
{:else if scanning_status == 'paused' && show_pause_btn}
<button on:click={handle_resume_qr_scanning} class="btn btn-lg variant-soft-primary btn_resume"><span class="fas fa-play"></span> Resume</button>
<button on:click={handle_resume_qr_scanning} class="btn btn-md variant-soft-primary btn_resume"><span class="fas fa-play"></span> Resume</button>
<span>Scanning paused</span>
{:else if scanning_status == 'scanning'}
<button on:click={handle_stop_qr_scanning} class="btn btn-lg variant-soft-secondary btn_stop"><span class="fas fa-stop-circle"></span> Stop</button>
<button on:click={handle_stop_qr_scanning} class="btn btn-md variant-soft-secondary btn_stop"><span class="fas fa-stop-circle m-1"></span> Stop</button>
{#if show_pause_btn}
<button on:click={handle_pause_qr_scanning} class="btn btn-lg variant-soft-secondary btn_pause"><span class="fas fa-pause-circle"></span> Pause</button>
{/if}
@@ -392,4 +392,55 @@ function handle_qr_manual_entry() {
background-color: hsla(120, 100%, 75%, 0.3);
border-color: hsla(120, 100%, 75%, 0.6);
}
.qr_scanner {
/* outline: solid thin pink; */
max-width: 100vw;
/* overflow-x: scroll; */
display: flex;
flex-direction: column;
/* flex-wrap: wrap; */
justify-content: flex-start;
align-items: center; /* center */
align-content: stretch;
}
.ae_element.qr_scanner div.qr_scanner_viewfinder {
/* max-width: 100vw; */
/* contain: content; */
/* contain: contain; */
}
.qr_scanner .qr_scanner_viewfinder {
/* outline: dashed medium blue; */
min-width: 400px;
width: 100%;
/* max-width: 100%; */
max-width: 500px;
/* max-width: 100vw; */
/* outline: solid thin red; */
contain: contain;
overflow-x: scroll;
}
@media (max-width: 767px) {
.qr_scanner .qr_scanner_viewfinder {
/* outline: dashed medium red; */
min-width: 80vw;
/* width: 100%; */
/* max-width: 100%; */
/* max-width: 450px; */
max-width: 100vw;
margin: 0;
padding: 0;
}
}
</style>