From a97e5666a7240adc68ee6bedd778aaf6aae3765a Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Thu, 14 Mar 2024 18:11:09 -0400 Subject: [PATCH] Just working on things. Slow progress... --- package-lock.json | 6 +- src/app.postcss | 14 + src/lib/ae_events_stores.ts | 38 + src/lib/ae_stores.ts | 2 + src/routes/+layout.svelte | 79 +- .../events_leads/exhibit/[slug]/+page.svelte | 699 +++++++++++++++--- .../10_view_modal__sponsorship_obj.svelte | 4 - 7 files changed, 717 insertions(+), 125 deletions(-) diff --git a/package-lock.json b/package-lock.json index 94d1f1a7..0916beae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2224,9 +2224,9 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.4.703", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.703.tgz", - "integrity": "sha512-094ZZC4nHXPKl/OwPinSMtLN9+hoFkdfQGKnvXbY+3WEAYtVDpz9UhJIViiY6Zb8agvqxiaJzNG9M+pRZWvSZw==", + "version": "1.4.704", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.704.tgz", + "integrity": "sha512-OK01+86Qvby1V6cTiowVbhp25aX4DLZnwar+NocAOXdzKAByd+jq5156bmo4kHwevWMknznW18Y/Svfk2dU91A==", "dev": true }, "node_modules/emoji-regex": { diff --git a/src/app.postcss b/src/app.postcss index 95d42ec9..f193a108 100644 --- a/src/app.postcss +++ b/src/app.postcss @@ -70,6 +70,20 @@ body { } +.ae_debug { + /* A darker pink outline */ + outline: thin dashed; + outline-color: hsla(0, 100%, 50%, 0.15); + /* A light pink background color */ + background-color: hsla(0, 100%, 50%, 0.15); +} +.ae_debug:hover { + /* A darker pink outline */ + outline-color: hsla(0, 100%, 50%, 0.50); + /* A light pink background color */ + background-color: hsla(0, 100%, 50%, 0.40); +} + /* Deal with being in an iframe */ #appShell #shell-header.iframe { diff --git a/src/lib/ae_events_stores.ts b/src/lib/ae_events_stores.ts index f3e73446..72c84305 100644 --- a/src/lib/ae_events_stores.ts +++ b/src/lib/ae_events_stores.ts @@ -28,6 +28,9 @@ let events_local_data_struct: key_val = { 'qry__limit': 20, 'qry__offset': 0, + // The show details is intended for things like meta data and additional details that are not always needed. + show_details: false, + // Badge Printing 'badges': { 'show_element__cfg': true, @@ -42,6 +45,20 @@ let events_local_data_struct: key_val = { // Lead Retrievals (Exhibit) 'leads': { auto_view: true, + + // The entered_passcode is the exhibit booths shared passcode for staff. This is used to initially access the lead retrieval service. + entered_passcode: null, + + // The auth_exhibit_kv (key value pairs) is used to store the exhibit IDs that the browser client can access. This is a key value list of exhibit ID and created datetime stamp. These should not be more than X days old. The entered_passcode for events_sess.leads is what they are entering to log in. + auth_exhibit_kv: { + // {'LNDF-67-89-92': {key: 'example@oneskyit.com', updated_on: '2024-03-13T08:05:29Z}} + }, + + // The auth_exhibit_license_li is used to store the exhibit license(s) being used on the browser client. There can be multiple exhibit IDs, but only one license per exhibit ID for the browser client. This is used to determine who can actually access and use the lead retrieval service. This is a key value list of key (email address) and created datetime stamp. These should not be more than X days old. + // auth_exhibit_license_li: { + // // 'LNDF-67-89-92': { 'key': 'example@oneskyit.com', 'updated_on': '2024-03-13T08:05:29Z'} + // }, + edit_license_li: false, }, // Presentation Management (Distributing) @@ -83,6 +100,27 @@ let events_session_data_struct: key_val = { }, // Lead Retrievals (Exhibit) + 'leads': { + example: true, + + show_form__license: false, + + submit_status__license: null, // 'saving', 'created', 'updated' + // create_status__license: null, // 'creating', 'created', 'updated' + // update_status__license: null, // 'updating', 'created', 'updated' + + // The entered_passcode is the exhibit booths shared passcode for staff. This is used to initially access the lead retrieval service. + entered_passcode: null, + + tmp_license: { + // 'agree' : false, // The user must agree to the license agreement. + 'email': '', + 'full_name': '', + 'passcode': '', + 'session_count': 0, + 'updated_on': new Date().toISOString() + } + }, // Presentation Management (Distributing) diff --git a/src/lib/ae_stores.ts b/src/lib/ae_stores.ts index 80dbb7af..1c1941b5 100644 --- a/src/lib/ae_stores.ts +++ b/src/lib/ae_stores.ts @@ -42,6 +42,8 @@ export let ae_app_local_data_struct: key_val = { 'iframe': false, 'title': `OSIT's Æ`, // - Dev SvelteKit`, // Æ + 'debug': false, // A simple flag to know if we should show debug information. + 'account_id': ae_account_id, // OSIT Demo _XY7DXtc9MY 'site_domain': null, // https://example.com, https://dev.example.com, etc. 'site_cfg_json': {}, diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 55bda45c..31a134bc 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -351,8 +351,23 @@ $: if ($slct_trigger == 'set_access_code_li' && !$ae_loc.ds['hub__page__access_c -
+
{@html $ae_loc.ds['hub__site__appshell_footer']} + +
@@ -375,4 +390,66 @@ $: if ($slct_trigger == 'set_access_code_li' && !$ae_loc.ds['hub__page__access_c diff --git a/src/routes/events_leads/exhibit/[slug]/+page.svelte b/src/routes/events_leads/exhibit/[slug]/+page.svelte index bf0f90c7..f585386a 100644 --- a/src/routes/events_leads/exhibit/[slug]/+page.svelte +++ b/src/routes/events_leads/exhibit/[slug]/+page.svelte @@ -10,7 +10,7 @@ import { api } from '$lib/api'; import { liveQuery } from "dexie"; import { db_events } from "$lib/db_events"; import { ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores'; -import { events_loc, events_slct, events_trigger } from '$lib/ae_events_stores'; +import { events_loc, events_sess, events_slct, events_trigger } from '$lib/ae_events_stores'; import { events_func } from '$lib/ae_events_functions'; @@ -22,8 +22,8 @@ import type { Writable } from 'svelte/store'; import Element_data_store from '$lib/element_data_store.svelte'; -// const store_current_tab: Writable = localStorageStore('ae_sponsorships_current_tab', 'start'); -// console.log(`store_current_tab:`, $store_current_tab); +const store_current_tab: Writable = localStorageStore('ae_events_leads_current_tab', 'start'); +console.log(`ae_events_leads exhibit +page.svelte [slug] store_current_tab:`, $store_current_tab); let param_slug_event_exhibit_id = data.params.slug; @@ -45,6 +45,10 @@ $events_slct.exhibit_id = param_slug_event_exhibit_id; console.log('Selected Event Exhibit ID:', $events_slct.exhibit_id); $events_trigger = 'load__event_exhibit_obj'; +$store_current_tab = 'start'; + +let license_submit_results: Promise|key_val; + onMount(() => { console.log('Events Leads Exhibit [slug]: +page.svelte'); @@ -60,6 +64,49 @@ onMount(() => { }); // console.log(`$ae_loc = `, $ae_loc); +$: if ($slct.event_exhibit_obj && $events_sess.leads.entered_passcode) { + console.log('Check the passcode?'); + if ($events_sess.leads.entered_passcode.length > 4) { + console.log('Check the passcode'); + handle_check_event_exhibit_staff_passcode(); + } +} else { + // console.log('Nothing at this time'); +} + + +function handle_check_event_exhibit_staff_passcode() { + // console.log(`*** handle_check_event_exhibit_staff_passcode() *** $slct_event_exhibit_obj=`, $events_slct.exhibit_obj); + + if (!$events_loc.leads.auth_exhibit_li) { + $events_loc.leads.auth_exhibit_li = {}; + } + + if ($slct.event_exhibit_obj && $events_sess.leads.entered_passcode && $events_sess.leads.entered_passcode.length >= 4) { + if ($events_slct.exhibit_obj.staff_passcode == $events_sess.leads.entered_passcode) { + console.log('Passcode matched'); + // disable_open_lead_retrieval_btn = false; + $events_sess.leads.entered_passcode = null; + $events_loc.leads.auth_exhibit_li[$events_slct.exhibit_id] = new Date().toISOString(); + } else { + // console.log('Passcode does not match'); + // disable_open_lead_retrieval_btn = true; + return false; + } + } else { + console.log('Missing selected event exhibit and or staff passcode.'); + // disable_open_lead_retrieval_btn = true; + return null; + } + + if ($events_loc.leads.auto_view) { + // open_exhibit_tracking($events_slct.exhibit_obj.event_exhibit_id_random, event_exhibit_staff_passcode) + } else { + // console.log(document.getElementById('open_lead_retrieval_btn')); + // document.getElementById('open_lead_retrieval_btn').focus(); + } +} + $: if ($events_trigger == 'load__event_exhibit_obj' && $events_slct.exhibit_id) { console.log('Selected Event Exhibit ID:', $events_slct.exhibit_id); @@ -134,6 +181,21 @@ async function handle_load_ae_obj_id__event_exhibit({event_exhibit_id, try_cache return ae_event_exhibit_get_promise; } +async function handle_submit_form_other(event) { + let tmp_obj = $event_exhibit_obj; + + tmp_obj.license_li_json.push($events_sess.leads.tmp_license); + console.log('Add License:', tmp_obj); + + await db_events.exhibits.put(tmp_obj); + + + $events_sess.leads.show_form__license = false; + $events_loc.leads.edit_license_li = false; + + // This still needs to be saved to the database. +} + let exhibit_submit_results: Promise|key_val; async function handle_submit_form(event) { @@ -299,72 +361,205 @@ function send_init_confirm_email({to_email}) { > - + /> --> + + + +{#if $events_slct.exhibit_id && $event_exhibit_obj} +
-
-{#if $events_slct.exhibit_id} + + + + + + + + + Main + + + + + + + + Manage + + + + + + + Add/Scan + + + + +{#if $store_current_tab === 'start'}
-{#if $event_exhibit_obj} -

Welcome - - {$event_exhibit_obj?.name} -

-{:else} -

Welcome to the Exhibit Hub!

-{/if} +

+ + {$event_exhibit_obj?.name ?? 'Welcome to Leads for Exhibits!'} + {$event_exhibit_obj?.code ?? ''} +

+{#if $events_loc?.leads.auth_exhibit_li && $events_loc.leads.auth_exhibit_li[$events_slct.exhibit_id]} + +

To use the lead retrieval service, please select a license from the list below.

+{:else} +

To access this exhibit you must enter the shared staff passcode that you were given. You will then be able to select a license and use the lead retrieval service from your device.

+ +{/if} - + +{#if $events_loc?.leads.auth_exhibit_li && $events_loc.leads.auth_exhibit_li[$events_slct.exhibit_id]} + + + +{#if $event_exhibit_obj?.license_max } +

License List (max {$event_exhibit_obj?.license_max})

+
{#if $event_exhibit_obj?.license_li_json.length < $event_exhibit_obj?.license_max} {:else} -No more! -{/if} - -{#if $event_exhibit_obj?.license_max } -

License List (max {$event_exhibit_obj?.license_max})

-
+ +{/if} + +
Use one of the options below to log in using one of the licenses.
+
{ console.log('Save License List'); handle_submit_form(event); }} - class="flex flex-row items-center space-x-2 border border-ae-3 p-2 m-2" + id="form__license_table" + class="flex flex-row items-center space-x-2 border border-ae-3 p-0 m-0" > - +
- - - + + + + - {#if $ae_loc.trusted_access} + {#if $events_loc.show_details} - - + - {#if $ae_loc.trusted_access} - +
+ Created On: + {license.created_on} +
+
+ Expires On: + {license.expires_on} +
+ + {/if} + {/each}
Use LicenseEmailFull NamePasscodeInfo Save { @@ -381,25 +576,42 @@ No more! -{#each $event_exhibit_obj?.license_li_json as license, key} +{#each $event_exhibit_obj?.license_li_json as license, index}
- {#if key < $event_exhibit_obj?.license_max} + {#if index < $event_exhibit_obj?.license_max}
+
{/if}
- - - +
+ + +
+ {#if $events_loc.leads.edit_license_li} -
+ {:else} + {license.full_name} + {/if} + + + + {#if $events_loc.leads.edit_license_li} + {:else} + {license.email} + {/if} + + + + + {#if $events_loc.leads.edit_license_li} + = $event_exhibit_obj?.license_max} + disabled={index >= $event_exhibit_obj?.license_max} required class="input text-sm max-w-20 font-mono" minlength="5" /> + {:else} + {license.passcode} + {/if} + + - + {:else} + + {/if} + -
-
- Updated On: - {license.updated_on} -
-
- Created On: - {license.created_on} -
-
- Expires On: - {license.expires_on} -
+ + {#if $events_loc.show_details} +
+ +
+
+ Updated On: + {license.updated_on}
-
-
+
+{/if} {/if} - +

To use the lead retrieval service, please select a license from the list on the Main tab.

+ {/if} + + {:else} +
Manage: Not logged in? Nothing here yet.
+ {/if} + +{:else if $store_current_tab == 'add_scan'} + + {#if $events_loc?.leads.auth_exhibit_li && $events_loc.leads.auth_exhibit_li[$events_slct.exhibit_id]} +
Add/Scan: Logged in. Nothing here yet
+ {:else} +
Add/Scan: Not logged in? Nothing here yet.
+ {/if} + +{/if} - // $events_loc.leads.show_edit__event_exhibit_obj = true; - // $events_trigger = 'load__event_exhibit_obj'; - // $events_trigger = 'show_edit__event_exhibit'; - // modalStore.trigger(modal_edit__event_exhibit); - // $ae_trig.m_events__show_modal_edit = true; - }} + + + + + + + + +{/if} + + +
+ + + +{#if $events_sess.leads.show_form__license} +
+
- - Edit Exhibit ({$events_slct.exhibit_id}) - -{:else} - +
+ - $events_trigger = 'show_edit__event_exhibit'; - $events_loc.leads.show_edit__event_exhibit_obj = true; +
+
- // modalStore.trigger(modal_edit__event_exhibit); - }} - > - - Start Exhibit Submission Form - -{/if} -
+ + -{#if $ae_loc.ds.hub__page__events_leads__create_info} -{@html $ae_loc.ds.hub__page__events_leads__create_info} -{:else} -
-
- More information can go here or this can be hidden. -
-
+ + + + + + {#if $ae_loc.trusted_access} + + {/if} + + + + +
+
+ + + +
+ +
+ Something text + {#await license_submit_results} + + {:then license_submit_results} + {#if license_submit_results} +
+ + + Saved + +
+ {/if} + {/await} + +
+ submit: {$events_sess?.leads.submit_status__license} + + +
+
+ +
+ +
+ +
+ + +
{/if} - + diff --git a/src/routes/sponsorships/10_view_modal__sponsorship_obj.svelte b/src/routes/sponsorships/10_view_modal__sponsorship_obj.svelte index f698fce6..a9d32252 100644 --- a/src/routes/sponsorships/10_view_modal__sponsorship_obj.svelte +++ b/src/routes/sponsorships/10_view_modal__sponsorship_obj.svelte @@ -14,10 +14,6 @@ import Element_data_store from '$lib/element_data_store.svelte'; const store_current_tab: Writable = localStorageStore('ae_sponsorships_current_tab', 'start'); console.log(`store_current_tab:`, $store_current_tab); -// This works and uses local storage: -// store_current_tab must be prefixed with $ to be reactive. -import { clipboard, FileDropzone, getModalStore, localStorageStore, ProgressRadial, RadioGroup, RadioItem, TabGroup, Tab, TabAnchor } from '@skeletonlabs/skeleton'; -import type { Writable } from 'svelte/store'; import { ae_util } from '$lib/ae_utils'; import { api } from '$lib/api';