Finally working Events - Leads for exhibitors
This commit is contained in:
@@ -36,6 +36,13 @@
|
||||
npm run build
|
||||
```
|
||||
|
||||
If this is just a quick build update then only the build directory needs to be copied (rsync).
|
||||
```bash
|
||||
rsync -vhrz --exclude 'node_modules' ~/OSIT_dev/ae_app_svelte_tailwind_skeleton/build/ ~/OSIT_dev/ae_env_node_app/npm_deploy/build/
|
||||
|
||||
rsync -vhrz --exclude 'node_modules' ~/OSIT_dev/ae_app_svelte_tailwind_skeleton/build/ scott@linode.oneskyit.com:/srv/env/prod_aether_sveltekit/npm_deploy/build/
|
||||
```
|
||||
|
||||
* Copy the new package.json file to ./npm_deploy/
|
||||
* Copy the root node_modules directory to ./npm_deploy/build/node_modules/
|
||||
```bash
|
||||
|
||||
332
src/lib/ae_events_functions.ts
Normal file
332
src/lib/ae_events_functions.ts
Normal file
@@ -0,0 +1,332 @@
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
import { api } from '$lib/api';
|
||||
|
||||
// import { liveQuery } from "dexie";
|
||||
import { db_events } from "$lib/db_events";
|
||||
|
||||
// let event_badge_li = liveQuery(
|
||||
// () => db_events.badges.toArray()
|
||||
// );
|
||||
|
||||
let ae_promises: key_val = {}; // Promise<any>;
|
||||
|
||||
async function handle_load_ae_obj_id__event({api_cfg, event_id, try_cache=false}) {
|
||||
console.log(`*** handle_load_ae_obj_id__event() *** event_id=${event_id}`);
|
||||
|
||||
let params = {};
|
||||
|
||||
// $events_sess.badges.status_load__event_obj = 'loading';
|
||||
ae_promises.load__event_obj = await api.get_ae_obj_id_crud({
|
||||
api_cfg: api_cfg,
|
||||
obj_type: 'event',
|
||||
obj_id: event_id, // NOTE: This is the FQDN, not normally the ID.
|
||||
use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
|
||||
use_alt_base: false, // NOTE: This will use the base_name_alt value instead of the base_name value in the API config.
|
||||
params: params,
|
||||
log_lvl: 0
|
||||
})
|
||||
.then(function (event_obj_get_result) {
|
||||
if (event_obj_get_result) {
|
||||
return event_obj_get_result;
|
||||
} else {
|
||||
console.log('No results returned.');
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
|
||||
return ae_promises.load__event_obj;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Updated 2024-03-06
|
||||
async function handle_load_ae_obj_li__badge({api_cfg, event_id, try_cache=true}) {
|
||||
console.log(`*** handle_load_ae_obj_li__badge() *** event_id=${event_id}`);
|
||||
|
||||
let fulltext_search_qry_str = ''; // $events_sess.badges.fulltext_search_qry_str;
|
||||
|
||||
let enabled = 'enabled'; // $events_loc.qry_enabled;
|
||||
let hidden = 'not_hidden'; // $events_loc.qry__hidden;
|
||||
let limit = 25; // $events_loc.qry__limit;
|
||||
let offset = 0; // $events_loc.qry__offset;
|
||||
|
||||
// if ($ae_loc.administrator_access) {
|
||||
// enabled = 'all';
|
||||
// hidden = 'all';
|
||||
// limit = 500;
|
||||
// } else if ($ae_loc.trusted_access) {
|
||||
// // enabled = 'all';
|
||||
// hidden = 'all';
|
||||
// limit = 50;
|
||||
// }
|
||||
|
||||
let params = {};
|
||||
|
||||
let params_json: key_val = {};
|
||||
if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) {
|
||||
params_json['ft_qry'] = {
|
||||
'default_qry_str': fulltext_search_qry_str,
|
||||
// 'location_address_json_ext': fulltext_search_qry_str, // JSON extracted text DB field
|
||||
// 'contact_li_json_ext': fulltext_search_qry_str, // JSON extracted text DB field
|
||||
};
|
||||
}
|
||||
|
||||
// console.log('params_json:', params_json);
|
||||
// console.log(params_json);
|
||||
|
||||
// $events_sess.badges.status_qry__search = 'loading';
|
||||
ae_promises.load__event_badge_obj_li = await api.get_ae_obj_li_for_obj_id_crud({
|
||||
api_cfg: api_cfg,
|
||||
obj_type: 'event_badge',
|
||||
for_obj_type: 'event',
|
||||
for_obj_id: event_id,
|
||||
use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
|
||||
use_alt_base: false, // NOTE: This will use the base_name_alt value instead of the base_name value in the API config.
|
||||
enabled: enabled,
|
||||
hidden: hidden,
|
||||
order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC'},
|
||||
// order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'created_on': 'DESC', 'updated_on': 'DESC'},
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
params_json: params_json,
|
||||
params: params,
|
||||
log_lvl: 2
|
||||
})
|
||||
|
||||
.then(function (badge_obj_li_get_result) {
|
||||
// console.log('Badge list:', badge_obj_li_get_result);
|
||||
if (badge_obj_li_get_result) {
|
||||
// $slct.badge_obj_li = badge_obj_li_get_result;
|
||||
handle_db_save_ae_obj_li__badge({obj_type: 'event_badge', obj_li: badge_obj_li_get_result});
|
||||
return badge_obj_li_get_result;
|
||||
} else {
|
||||
// $slct.badge_obj_li = [];
|
||||
return [];
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
})
|
||||
.finally(function () {
|
||||
// $events_sess.badges.status_qry__search = 'done';
|
||||
|
||||
// console.log('Badge list:', badge_obj_li_get_result);
|
||||
// return badge_obj_li_get_result;
|
||||
});
|
||||
|
||||
console.log('ae_promises.load__event_badge_obj_li:', ae_promises.load__event_badge_obj_li);
|
||||
return ae_promises.load__event_badge_obj_li;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Updated 2024-03-06
|
||||
async function handle_load_ae_obj_li__exhibitor({api_cfg, event_id, try_cache=true}) {
|
||||
console.log(`*** handle_load_ae_obj_li__exhibitor() *** event_id=${event_id}`);
|
||||
|
||||
let enabled = 'enabled'; // $events_loc.qry_enabled;
|
||||
let hidden = 'not_hidden'; // $events_loc.qry__hidden;
|
||||
let limit = 50; // $events_loc.qry__limit;
|
||||
let offset = 0; // $events_loc.qry__offset;
|
||||
|
||||
// if ($ae_loc.administrator_access) {
|
||||
// enabled = 'all';
|
||||
// hidden = 'all';
|
||||
// limit = 500;
|
||||
// } else if ($ae_loc.trusted_access) {
|
||||
// // enabled = 'all';
|
||||
// hidden = 'all';
|
||||
// limit = 50;
|
||||
// }
|
||||
|
||||
let params = {};
|
||||
|
||||
let params_json: key_val = {};
|
||||
// if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) {
|
||||
// params_json['ft_qry'] = {
|
||||
// 'default_qry_str': fulltext_search_qry_str,
|
||||
// // 'location_address_json_ext': fulltext_search_qry_str, // JSON extracted text DB field
|
||||
// // 'contact_li_json_ext': fulltext_search_qry_str, // JSON extracted text DB field
|
||||
// };
|
||||
// }
|
||||
|
||||
// console.log('params_json:', params_json);
|
||||
// console.log(params_json);
|
||||
|
||||
// $events_sess.exhibits.status_qry__search = 'loading';
|
||||
ae_promises.load__event_exhibit_obj_li = await api.get_ae_obj_li_for_obj_id_crud({
|
||||
api_cfg: api_cfg,
|
||||
obj_type: 'event_exhibit',
|
||||
for_obj_type: 'event',
|
||||
for_obj_id: event_id,
|
||||
use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
|
||||
use_alt_base: false, // NOTE: This will use the base_name_alt value instead of the base_name value in the API config.
|
||||
enabled: enabled,
|
||||
hidden: hidden,
|
||||
order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC'},
|
||||
// order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'created_on': 'DESC', 'updated_on': 'DESC'},
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
// params_json: params_json,
|
||||
params: params,
|
||||
log_lvl: 2
|
||||
})
|
||||
|
||||
.then(function (exhibit_obj_li_get_result) {
|
||||
// console.log('Badge list:', exhibit_obj_li_get_result);
|
||||
if (exhibit_obj_li_get_result) {
|
||||
// $slct.exhibit_obj_li = exhibit_obj_li_get_result;
|
||||
handle_db_save_ae_obj_li__exhibitor({obj_type: 'event_exhibit', obj_li: exhibit_obj_li_get_result});
|
||||
return exhibit_obj_li_get_result;
|
||||
} else {
|
||||
// $slct.exhibit_obj_li = [];
|
||||
return [];
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
})
|
||||
.finally(function () {
|
||||
// $events_sess.exhibits.status_qry__search = 'done';
|
||||
|
||||
// console.log('Badge list:', exhibit_obj_li_get_result);
|
||||
// return exhibit_obj_li_get_result;
|
||||
});
|
||||
|
||||
console.log('ae_promises.load__event_exhibit_obj_li:', ae_promises.load__event_exhibit_obj_li);
|
||||
return ae_promises.load__event_exhibit_obj_li;
|
||||
}
|
||||
|
||||
|
||||
// // This function will loop through the badge_obj_li and save each one to the DB.
|
||||
// function handle_db_save_ae_obj_li({obj_type, obj_li}) {
|
||||
// console.log(`*** handle_db_save_ae_obj_li() ***`);
|
||||
|
||||
// if (obj_li && obj_li.length) {
|
||||
// obj_li.forEach(async function (obj) {
|
||||
// // console.log(`ae_obj ${obj_type}:`, obj);
|
||||
|
||||
// try {
|
||||
// const id_random = await db_events.badges.put({
|
||||
// id_random: obj.event_badge_id_random,
|
||||
// full_name: obj.full_name,
|
||||
// full_name_override: obj.full_name_override,
|
||||
// email: obj.email,
|
||||
// email_override: obj.email_override,
|
||||
// affiliations: obj.affiliations,
|
||||
// affiliations_override: obj.affiliations_override,
|
||||
// badge_type: obj.badge_type,
|
||||
// badge_type_override: obj.badge_type_override,
|
||||
// badge_type_code: obj.badge_type_code,
|
||||
// badge_type_code_override: obj.badge_type_code_override,
|
||||
// external_event_id: obj.external_event_id,
|
||||
// external_id: obj.external_id,
|
||||
// external_person_id: obj.external_person_id,
|
||||
// created_on: obj.created_on,
|
||||
// updated_on: obj.updated_on,
|
||||
// });
|
||||
// console.log(`Put obj with ID: ${obj.event_badge_id_random} or ${id_random}`);
|
||||
// } catch (error) {
|
||||
// let status = `Failed to put ${obj.event_badge_id_random}: ${error}`;
|
||||
// console.log(status);
|
||||
// }
|
||||
|
||||
// // const id_random = await db_events.badges.put(obj);
|
||||
// // console.log(`Put obj with ID: ${obj.event_badge_id_random}`);
|
||||
// });
|
||||
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// This function will loop through the badge_obj_li and save each one to the DB.
|
||||
function handle_db_save_ae_obj_li__badge({obj_type, obj_li}) {
|
||||
console.log(`*** handle_db_save_ae_obj_li__badge() ***`);
|
||||
|
||||
if (obj_li && obj_li.length) {
|
||||
obj_li.forEach(async function (obj) {
|
||||
// console.log(`ae_obj ${obj_type}:`, obj);
|
||||
|
||||
try {
|
||||
const id_random = await db_events.badges.put({
|
||||
id_random: obj.event_badge_id_random,
|
||||
full_name: obj.full_name,
|
||||
full_name_override: obj.full_name_override,
|
||||
email: obj.email,
|
||||
email_override: obj.email_override,
|
||||
affiliations: obj.affiliations,
|
||||
affiliations_override: obj.affiliations_override,
|
||||
badge_type: obj.badge_type,
|
||||
badge_type_override: obj.badge_type_override,
|
||||
badge_type_code: obj.badge_type_code,
|
||||
badge_type_code_override: obj.badge_type_code_override,
|
||||
external_event_id: obj.external_event_id,
|
||||
external_id: obj.external_id,
|
||||
external_person_id: obj.external_person_id,
|
||||
created_on: obj.created_on,
|
||||
updated_on: obj.updated_on,
|
||||
});
|
||||
console.log(`Put obj with ID: ${obj.event_badge_id_random} or ${id_random}`);
|
||||
} catch (error) {
|
||||
let status = `Failed to put ${obj.event_badge_id_random}: ${error}`;
|
||||
console.log(status);
|
||||
}
|
||||
|
||||
// const id_random = await db_events.badges.put(obj);
|
||||
// console.log(`Put obj with ID: ${obj.event_badge_id_random}`);
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// This function will loop through the event_exhibit_obj_li and save each one to the DB.
|
||||
function handle_db_save_ae_obj_li__exhibitor({obj_type, obj_li}) {
|
||||
console.log(`*** handle_db_save_ae_obj_li__exhibitor() ***`);
|
||||
|
||||
if (obj_li && obj_li.length) {
|
||||
obj_li.forEach(async function (obj) {
|
||||
// console.log(`ae_obj ${obj_type}:`, obj);
|
||||
|
||||
try {
|
||||
const id_random = await db_events.exhibits.put({
|
||||
id_random: obj.event_exhibit_id_random,
|
||||
code: obj.code,
|
||||
name: obj.name,
|
||||
description: obj.description,
|
||||
staff_passcode: obj.staff_passcode,
|
||||
data_json: obj.data_json,
|
||||
license_max: obj.license_max,
|
||||
license_li_json: obj.license_li_json,
|
||||
cfg_json: obj.cfg_json,
|
||||
created_on: obj.created_on,
|
||||
updated_on: obj.updated_on,
|
||||
});
|
||||
console.log(`Put obj with ID: ${obj.event_exhibit_id_random} or ${id_random}`);
|
||||
} catch (error) {
|
||||
let status = `Failed to put ${obj.event_exhibit_id_random}: ${error}`;
|
||||
console.log(status);
|
||||
}
|
||||
|
||||
// const id_random = await db_events.exhibits.put(obj);
|
||||
// console.log(`Put obj with ID: ${obj.event_exhibit_id_random}`);
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
let export_obj = {
|
||||
handle_load_ae_obj_id__event: handle_load_ae_obj_id__event,
|
||||
handle_load_ae_obj_li__badge: handle_load_ae_obj_li__badge,
|
||||
handle_load_ae_obj_li__exhibitor: handle_load_ae_obj_li__exhibitor,
|
||||
};
|
||||
export let events_func = export_obj;
|
||||
@@ -8,7 +8,7 @@ import type { key_val } from '$lib/ae_stores';
|
||||
// Longer-term app data. This should be stored to *local* storage.
|
||||
// Updated 2024-03-06
|
||||
let events_local_data_struct: key_val = {
|
||||
'ver': '2024-03-06_17',
|
||||
'ver': '2024-03-12_19',
|
||||
// Shared
|
||||
'name': 'Aether - Events (SvelteKit 2.x Svelte 4.x)',
|
||||
'title': `OSIT's Æ Events`, // - Dev SvelteKit`, // Æ
|
||||
@@ -40,6 +40,9 @@ let events_local_data_struct: key_val = {
|
||||
},
|
||||
|
||||
// Lead Retrievals (Exhibit)
|
||||
'leads': {
|
||||
auto_view: true,
|
||||
},
|
||||
|
||||
// Presentation Management (Distributing)
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ export let temp_get_object_percent_completed = 0;
|
||||
export let get_object_percent_completed = temp_get_object_percent_completed;
|
||||
|
||||
// Updated 2022-10-28
|
||||
export let get_object = async function get_object({api_cfg=null, endpoint='', headers={}, params={}, data={}, timeout=600000, return_meta=false, return_blob=false, filename=null, auto_download=false, as_list=false, log_lvl=0}) {
|
||||
export let get_object = async function get_object({api_cfg, endpoint='', headers={}, params={}, data={}, timeout=600000, return_meta=false, return_blob=false, filename=null, auto_download=false, as_list=false, log_lvl=0}) {
|
||||
if (log_lvl) {
|
||||
console.log('*** get_object() ***');
|
||||
}
|
||||
@@ -81,6 +81,11 @@ export let get_object = async function get_object({api_cfg=null, endpoint='', he
|
||||
}
|
||||
}
|
||||
|
||||
if (!api_cfg) {
|
||||
console.log('No API Config was provided. Returning false.');
|
||||
return false;
|
||||
}
|
||||
|
||||
let axios_api = axios.create({
|
||||
baseURL: api_cfg['base_url'],
|
||||
timeout: timeout, // in milliseconds; 60000 = 60 seconds
|
||||
|
||||
@@ -16,20 +16,39 @@ export interface Badge {
|
||||
external_event_id: string;
|
||||
external_id: string;
|
||||
external_person_id: string;
|
||||
created_on: Date;
|
||||
updated_on: Date;
|
||||
}
|
||||
|
||||
export interface Exhibit {
|
||||
// id?: number;
|
||||
id_random: string;
|
||||
code: string;
|
||||
name: string;
|
||||
description: null|string;
|
||||
staff_passcode: null
|
||||
data_json: string;
|
||||
license_max: number;
|
||||
license_li_json: string;
|
||||
cfg_json: string;
|
||||
created_on: Date;
|
||||
updated_on: Date;
|
||||
}
|
||||
|
||||
export class MySubClassedDexie extends Dexie {
|
||||
// 'badges' is added by dexie when declaring the stores()
|
||||
// We just tell the typing system this is the case
|
||||
badges!: Table<Badge>;
|
||||
// 'badges' is added by dexie when declaring the stores()
|
||||
// We just tell the typing system this is the case
|
||||
badges!: Table<Badge>;
|
||||
exhibits!: Table<Exhibit>;
|
||||
|
||||
constructor() {
|
||||
super('ae_events_db');
|
||||
this.version(1).stores({
|
||||
// badges: '++id, full_name, email' // Primary key and indexed props
|
||||
badges: 'id_random, full_name, full_name_override, email, email_override, affiliations, affiliations_override, badge_type, badge_type_code, badge_type_code_override, badge_type_override, external_event_id, external_id, external_person_id' // Primary key and indexed props
|
||||
});
|
||||
}
|
||||
constructor() {
|
||||
super('ae_events_db');
|
||||
this.version(1).stores({
|
||||
// badges: '++id, full_name, email' // Primary key and indexed props
|
||||
badges: 'id_random, full_name, full_name_override, email, email_override, affiliations, affiliations_override, badge_type, badge_type_code, badge_type_code_override, badge_type_override, external_event_id, external_id, external_person_id, created_on, updated_on', // Primary key and indexed props
|
||||
exhibits: 'id_random, code, name, description, staff_passcode, data_json, license_max, license_li_json, cfg_json, created_on, updated_on',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export const db_events = new MySubClassedDexie();
|
||||
@@ -297,6 +297,16 @@ $: if ($slct_trigger == 'set_access_code_li' && !$ae_loc.ds['hub__page__access_c
|
||||
class="btn btn-sm variant-ghost-surface"
|
||||
class:active={$page.url.pathname==='/events_speakers'}
|
||||
href="/events_speakers">Speakers</a>
|
||||
|
||||
<a
|
||||
class="btn btn-sm variant-ghost-surface"
|
||||
class:active={$page.url.pathname==='/events_badges'}
|
||||
href="/events_badges">Badges</a>
|
||||
|
||||
<a
|
||||
class="btn btn-sm variant-ghost-surface"
|
||||
class:active={$page.url.pathname==='/events_leads'}
|
||||
href="/events_leads">Leads</a>
|
||||
{/if}
|
||||
</svelte:fragment>
|
||||
</AppBar>
|
||||
|
||||
@@ -24,7 +24,7 @@ onMount(() => {
|
||||
</script>
|
||||
|
||||
|
||||
<section class="ae_root md:container h-full mx-auto flex flex-col items-center p-5 space-y-16">
|
||||
<section class="ae_root md:container h-full mx-auto flex flex-col items-center p-4 space-y-12">
|
||||
|
||||
<Element_data_store
|
||||
ds_code="hub__site__root_page_header"
|
||||
@@ -43,24 +43,12 @@ onMount(() => {
|
||||
for_type={null}
|
||||
for_id={null}
|
||||
ds_name="Default: AE Hub - Site root page content HTML"
|
||||
class_li={$ae_sess.ds_loaded.hub__site__root_page_content === false ? 'hidden' : ''}
|
||||
class_li={$ae_sess.ds_loaded.hub__site__root_page_content === false ? 'hidden' : 'grow'}
|
||||
bind:ds_loaded={$ae_sess.ds_loaded.hub__site__root_page_content}
|
||||
/>
|
||||
<!-- page content DS: {$ae_sess.ds_loaded.hub__site__root_page_content} -->
|
||||
|
||||
<Element_data_store
|
||||
ds_code="hub__site__root_page_footer"
|
||||
ds_type="html"
|
||||
for_type={null}
|
||||
for_id={null}
|
||||
ds_name="Default: AE Hub - Site root page footer HTML"
|
||||
display="block"
|
||||
class_li={!$ae_loc.trusted_access && $ae_sess.ds_loaded.hub__site__root_page_footer === false ? 'hidden' : ''}
|
||||
bind:ds_loaded={$ae_sess.ds_loaded.hub__site__root_page_footer}
|
||||
/>
|
||||
<!-- page footer DS: {$ae_sess.ds_loaded.hub__site__root_page_footer} -->
|
||||
|
||||
|
||||
<section class="flex flex-col items-center p-4 space-y-6">
|
||||
|
||||
<div data-sveltekit-preload-data="false" class="">
|
||||
<button
|
||||
@@ -87,6 +75,20 @@ onMount(() => {
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<Element_data_store
|
||||
ds_code="hub__site__root_page_footer"
|
||||
ds_type="html"
|
||||
for_type={null}
|
||||
for_id={null}
|
||||
ds_name="Default: AE Hub - Site root page footer HTML"
|
||||
display="block"
|
||||
class_li={!$ae_loc.trusted_access && $ae_sess.ds_loaded.hub__site__root_page_footer === false ? 'hidden' : ''}
|
||||
bind:ds_loaded={$ae_sess.ds_loaded.hub__site__root_page_footer}
|
||||
/>
|
||||
<!-- page footer DS: {$ae_sess.ds_loaded.hub__site__root_page_footer} -->
|
||||
|
||||
</section>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ $: if ($events_trigger == 'load__event_obj' && $events_slct.event_id) {
|
||||
|
||||
// Updated 2024-03-06
|
||||
async function handle_load_ae_obj_id__event({event_id, try_cache=false}) {
|
||||
console.log(`*** handle_load_ae_obj_id__event() *** event_id=${event_id}`);
|
||||
console.log(`*** handle_load_ae_obj_id__event() *** event_id=${event_id} api_cfg=`, $ae_api);
|
||||
|
||||
let params = {};
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ export async function load({ params, parent, url }) { // route
|
||||
|
||||
// const { ae_init, root_layout_ts } = await parent();
|
||||
let data = await parent();
|
||||
// console.log(`ae_events_badges +layout.ts data:`, data);
|
||||
console.log(`ae_events_badges +layout.ts data:`, data);
|
||||
|
||||
if (data.ae_loc.account_id) {
|
||||
console.log(`ae_events_badges +layout.ts data = data.ae_loc:`, data.ae_loc);
|
||||
|
||||
@@ -50,7 +50,7 @@ onMount(() => {
|
||||
|
||||
<section class="ae_events_badges md:container h-full mx-auto">
|
||||
|
||||
<h1 class="h2">New Events - Badges</h1>
|
||||
<h1 class="h2">Events - Badges</h1>
|
||||
|
||||
<Element_data_store
|
||||
ds_code="events__badges__overview"
|
||||
|
||||
@@ -19,6 +19,7 @@ import { onMount } from 'svelte';
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
import { ae_util } from '$lib/ae_utils';
|
||||
import { api } from '$lib/api';
|
||||
import { events_func } from '$lib/ae_events_functions';
|
||||
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';
|
||||
@@ -232,7 +233,7 @@ async function handle_load_ae_obj_id__event_badge({event_badge_id, try_cache=fal
|
||||
|
||||
// Updated 2024-03-06 late
|
||||
$: if ($events_trigger == 'load__event_badge_obj_li' && $events_slct.event_id) {
|
||||
console.log(`$events_slct.event_id=${$events_slct.event_id}`);
|
||||
console.log(`handle_load_ae_obj_id__event() $events_slct.event_id=${$events_slct.event_id} api_cfg=`, $ae_api);
|
||||
|
||||
if ($events_sess.status_qry__search == 'loading') {
|
||||
console.log('*** $events_sess.status_qry__search == loading ***');
|
||||
@@ -241,7 +242,7 @@ $: if ($events_trigger == 'load__event_badge_obj_li' && $events_slct.event_id) {
|
||||
console.log("Delayed for X second.");
|
||||
$events_trigger = null;
|
||||
|
||||
load_obj_li_results = handle_load_ae_obj_li__badge({event_id: $events_slct.event_id, try_cache: false})
|
||||
load_obj_li_results = events_func.handle_load_ae_obj_li__badge({api_cfg: $ae_api, event_id: $events_slct.event_id, try_cache: false})
|
||||
.then(function (load_results) {
|
||||
if (load_results) {
|
||||
console.log(`load_results=`, load_results);
|
||||
@@ -258,7 +259,7 @@ $: if ($events_trigger == 'load__event_badge_obj_li' && $events_slct.event_id) {
|
||||
console.log('*** $events_sess.status_qry__search != loading ***');
|
||||
$events_trigger = null;
|
||||
|
||||
load_obj_li_results = handle_load_ae_obj_li__badge({event_id: $events_slct.event_id, try_cache: false})
|
||||
load_obj_li_results = events_func.handle_load_ae_obj_li__badge({api_cfg: $ae_api, event_id: $events_slct.event_id, try_cache: false})
|
||||
.then(function (load_results) {
|
||||
if (load_results) {
|
||||
console.log(`load_results=`, load_results);
|
||||
@@ -274,7 +275,7 @@ $: if ($events_trigger == 'load__event_badge_obj_li' && $events_slct.event_id) {
|
||||
}
|
||||
|
||||
// Updated 2024-03-06
|
||||
async function handle_load_ae_obj_li__badge({event_id, try_cache=true}) {
|
||||
async function handle_load_ae_obj_li__badge({api_cfg: ae_api, event_id, try_cache=true}) {
|
||||
console.log(`*** handle_load_ae_obj_li__badge() *** event_id=${event_id}`);
|
||||
|
||||
let fulltext_search_qry_str = $events_sess.badges.fulltext_search_qry_str;
|
||||
|
||||
37
src/routes/events_leads/+layout.svelte
Normal file
37
src/routes/events_leads/+layout.svelte
Normal file
@@ -0,0 +1,37 @@
|
||||
<script lang="ts">
|
||||
/** @type {import('./$types').LayoutData} */
|
||||
export let data;
|
||||
import { goto } from '$app/navigation';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
|
||||
import { events_loc, events_slct, events_trigger } from '$lib/ae_events_stores';
|
||||
import { ae_util } from '$lib/ae_utils';
|
||||
|
||||
onMount(() => {
|
||||
console.log('Events Leads: +layout.svelte');
|
||||
|
||||
// console.log('ae_ slct:', $slct);
|
||||
|
||||
console.log(window.location.href);
|
||||
let href_url = window.location.href;
|
||||
// $ae_loc.href_url = href_url;
|
||||
// console.log(`$ae_loc.href_url = `, $ae_loc.href_url);
|
||||
|
||||
// $slct_trigger = 'msg_parent';
|
||||
// ae_util.handle_url_and_message('event_id', $events_slct.event_id);
|
||||
// ae_util.handle_url_and_message('exhibit_id', $events_slct.exhibit_id);
|
||||
// if ($events_slct.exhibit_id) {
|
||||
// console.log(`Got an ID. Let's do something!?`);
|
||||
// modalStore.trigger(modal_view__exhibit_obj);
|
||||
// }
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<svelte:head>
|
||||
<title>Events Badges - {data.ae_loc.title}</title>
|
||||
</svelte:head>
|
||||
|
||||
|
||||
<slot></slot>
|
||||
228
src/routes/events_leads/+page.svelte
Normal file
228
src/routes/events_leads/+page.svelte
Normal file
@@ -0,0 +1,228 @@
|
||||
<script lang="ts">
|
||||
export let data;
|
||||
console.log(`ae_events_leads +page data:`, data);
|
||||
// console.log(`ae_events_leads Data Params:`, data.url.searchParams.get('event_id'));
|
||||
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
import { ae_util } from '$lib/ae_utils';
|
||||
import { api } from '$lib/api';
|
||||
import { liveQuery } from "dexie";
|
||||
import { db_events } from "$lib/db_events";
|
||||
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
|
||||
import { events_loc, events_slct, events_trigger } from '$lib/ae_events_stores';
|
||||
|
||||
import Element_data_store from '$lib/element_data_store.svelte';
|
||||
|
||||
|
||||
let event_exhibit_obj_li = liveQuery(
|
||||
// () => db_events.exhibits.toArray()
|
||||
() => db_events.exhibits
|
||||
// .where('passcode')
|
||||
// .equals('99999')
|
||||
.orderBy('name')
|
||||
// .offset(10).limit(5)
|
||||
.toArray()
|
||||
);
|
||||
|
||||
// if (data.url.searchParams.get('event_id')) {
|
||||
// $events_slct.event_id = data.url.searchParams.get('event_id');
|
||||
// } else if (data.ae_loc.site_cfg_json.slct__event_id) {
|
||||
// $events_slct.event_id = data.ae_loc.site_cfg_json.slct__event_id;
|
||||
// } else if ($events_loc.default__event_id) {
|
||||
// $events_slct.event_id = $events_loc.default__event_id;
|
||||
// } else if ($events_slct.event_id) {
|
||||
// console.log(`Event ID already set:`, $events_slct.event_id);
|
||||
// } else {
|
||||
// console.log(`No Event ID set.`);
|
||||
// }
|
||||
|
||||
export let event_exhibit_staff_passcode: string = '';
|
||||
let disable_open_lead_retrieval_btn: boolean = true;
|
||||
let disable_reset_passcode_btn: boolean = true;
|
||||
let reset_passcode: string = '';
|
||||
|
||||
onMount(() => {
|
||||
console.log('Events Leads: +page.svelte');
|
||||
|
||||
// console.log('ae_ slct:', $slct);
|
||||
|
||||
let href_url = window.location.href;
|
||||
$ae_loc.href_url = href_url;
|
||||
// console.log(`$ae_loc.href_url = `, $ae_loc.href_url);
|
||||
|
||||
// $slct_trigger = 'msg_parent';
|
||||
// ae_util.handle_url_and_message('event_id', $events_slct.event_id);
|
||||
// ae_util.handle_url_and_message('exhibit_id', $events_slct.exhibit_id);
|
||||
// if ($events_slct.exhibit_id) {
|
||||
// console.log(`Got an ID. Let's do something!?`);
|
||||
// modalStore.trigger(modal_view__exhibit_obj);
|
||||
// }
|
||||
});
|
||||
|
||||
|
||||
$: if (event_exhibit_staff_passcode.length >= 5) {
|
||||
// disable_open_lead_retrieval_btn = false;
|
||||
handle_check_event_exhibit_staff_passcode();
|
||||
} else {
|
||||
disable_open_lead_retrieval_btn = true;
|
||||
// handle_check_event_exhibit_staff_passcode();
|
||||
}
|
||||
|
||||
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_slct.exhibit_obj && event_exhibit_staff_passcode && event_exhibit_staff_passcode.length >= 4) {
|
||||
if ($events_slct.exhibit_obj.staff_passcode == event_exhibit_staff_passcode) {
|
||||
console.log('Passcode matched');
|
||||
disable_open_lead_retrieval_btn = false;
|
||||
} 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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function open_exhibit_tracking(event_exhibit_id_random, event_exhibit_staff_passcode) {
|
||||
console.log(`open_exhibit_tracking() event_exhibit_id_random=${event_exhibit_id_random} event_exhibit_staff_passcode=${event_exhibit_staff_passcode}`);
|
||||
|
||||
// let url = `/events_leads/exhibit/${event_exhibit_id_random}`;
|
||||
// window.open(url, '_blank');
|
||||
// window.focus();
|
||||
|
||||
let url = `/events_leads/exhibit/${event_exhibit_id_random}`;
|
||||
window.open(url);
|
||||
// window.open(url, '_blank');
|
||||
window.focus();
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<section class="ae_events_leads md:container h-full mx-auto">
|
||||
|
||||
<h1 class="h2">Events - Leads</h1>
|
||||
|
||||
<Element_data_store
|
||||
ds_code="events__leads__overview"
|
||||
ds_type="html"
|
||||
for_type="event"
|
||||
for_id={$events_slct.event_id}
|
||||
display="block"
|
||||
class_li="variant-ghost-surface p-2"
|
||||
/>
|
||||
|
||||
<a href="/{$events_slct.event_id}">Event ID {$events_slct.event_id}</a>
|
||||
|
||||
|
||||
{#if $event_exhibit_obj_li}
|
||||
<h2>Exhibits</h2>
|
||||
<!-- <ul>
|
||||
{#each $event_exhibit_obj_li as exhibit_obj}
|
||||
<li>
|
||||
<a href="/events_leads/exhibit/{exhibit_obj.id_random}">{exhibit_obj.name} ID {exhibit_obj.id_random}</a>
|
||||
</li>
|
||||
{/each}
|
||||
</ul> -->
|
||||
|
||||
|
||||
<div class="event_exhibit_tracking_select_exhibit space-y-6">
|
||||
<form on:submit|preventDefault={() => open_exhibit_tracking($events_slct.exhibit_obj, event_exhibit_staff_passcode)} class="form-floating">
|
||||
<h2>Exhibitor Lead Retrieval</h2>
|
||||
<div>Select your exhibit booth from the list and enter passcode you were given.</div>
|
||||
|
||||
<div class="form-floating mb-1 col-md-12 col-lg-12">
|
||||
<select bind:value={$events_slct.exhibit_obj} id="exhibit_list" class="select max-w-md">
|
||||
<option value="">-- Nothing Selected --</option>
|
||||
{#each $event_exhibit_obj_li as event_exhibit_obj, index}
|
||||
<!-- <option value="{event_exhibit_obj.event_exhibit_id_random}">{event_exhibit_obj.name} (Booth # {event_exhibit_obj.code})</option> -->
|
||||
<option value="{event_exhibit_obj}">{event_exhibit_obj.name} (Booth #{event_exhibit_obj.code})</option>
|
||||
{/each}
|
||||
</select>
|
||||
|
||||
<label for="exhibit_list" class="label">
|
||||
Exhibit List:
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="container_group">
|
||||
<!-- <input bind:value={event_exhibit_staff_passcode} type="text" id="exhibit_passcode" placeholder="Exhibit passcode" /> -->
|
||||
|
||||
<input
|
||||
bind:value={event_exhibit_staff_passcode}
|
||||
class="input max-w-40"
|
||||
placeholder="Exhibit passcode"
|
||||
/>
|
||||
|
||||
<!-- <button on:click={() => open_exhibit_tracking(exhibit_obj.event_exhibit_id_random, event_exhibit_staff_passcode)} id="open_lead_retrieval_btn" disabled={disable_open_lead_retrieval_btn} autofocus>Open Exhibitor Lead Retrieval</button> -->
|
||||
<button
|
||||
type="submit"
|
||||
disabled={disable_open_lead_retrieval_btn}
|
||||
class="btn variant-filled-primary open_lead_retrieval_btn"
|
||||
>
|
||||
<span class="fas fa-arrow-right"></span> Open Exhibitor Lead Retrieval
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{#if ($ae_loc.trusted_access)}
|
||||
<div class="">
|
||||
<!-- <input bind:value={reset_passcode} type="text" id="reset_exhibit_passcode" placeholder="Reset exhibit passcode" /> -->
|
||||
|
||||
<input bind:value={reset_passcode} placeholder="Reset passcode" title="Reset exhibit passcode" class="input max-w-40" />
|
||||
|
||||
<!-- <button on:click={() => open_exhibit_tracking(exhibit_obj.event_exhibit_id_random, event_exhibit_staff_passcode)} id="open_lead_retrieval_btn" disabled={disable_open_lead_retrieval_btn} autofocus>Open Exhibitor Lead Retrieval</button> -->
|
||||
<!-- <button type="button" id="reset_passcode_btn" disabled={disable_reset_passcode_btn} autofocus on:click={() => show_exhibit_tracking_add_modal=true}>Reset Passcode</button> -->
|
||||
|
||||
<button
|
||||
type="button"
|
||||
disabled={disable_reset_passcode_btn}
|
||||
on:click={() => {
|
||||
handle_update_event_exhibit_staff_passcode(exhibit_obj.event_exhibit_id_random, reset_passcode);
|
||||
}}
|
||||
class="btn variant-filled-secondary reset_passcode_btn"
|
||||
>
|
||||
<span class="fas fa-undo"></span> Reset Passcode
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{/if}
|
||||
|
||||
<!-- <Element_data_store
|
||||
ds_code="events__leads__example"
|
||||
ds_type="html"
|
||||
for_type="event"
|
||||
for_id={$events_slct.event_id}
|
||||
ds_name="Default: Events Leads Example"
|
||||
store="local"
|
||||
display="block"
|
||||
class_li="variant-ghost-surface p-2"
|
||||
try_cache={true}
|
||||
show_edit={false}
|
||||
/> -->
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
<style lang="postcss">
|
||||
</style>
|
||||
38
src/routes/events_leads/+page.ts
Normal file
38
src/routes/events_leads/+page.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
/** @type {import('./$types').PageLoad} */
|
||||
|
||||
import { events_func } from '$lib/ae_events_functions';
|
||||
|
||||
export async function load({ params, parent, url }) { // route
|
||||
// console.log(`ae_events_leads +page.ts data.params:`, params);
|
||||
// console.log(`ae_events_leads +page.ts data.route:`, route);
|
||||
// console.log(`ae_events_leads +page.ts data.url:`, url);
|
||||
|
||||
let data = await parent();
|
||||
console.log(`ae_events_leads +page.ts data:`, data);
|
||||
|
||||
// console.log(`ae_events_leads +page.ts data.ae_loc:`, data.ae_loc);
|
||||
if (data.ae_loc.account_id) {
|
||||
} else {
|
||||
console.log(`The account_id was not found in the data.ae_loc!!!`);
|
||||
return false;
|
||||
}
|
||||
|
||||
data.ae_events_leads_page_ts = true;
|
||||
|
||||
let submenu = {
|
||||
main: {name: 'Main', href: '/events_leads', access: false},
|
||||
manage: {name: 'Manage', href: '/events_leads/manage', access: 'administrator', disable: true, hide: true},
|
||||
review: {name: 'Exhibitor', href: '/events_leads/exhibitor', access: false, disable: false, hide: false},
|
||||
};
|
||||
data.submenu = submenu
|
||||
|
||||
// Do not wait on these:
|
||||
let event_id = url.searchParams.get('event_id');
|
||||
let load_event_obj = events_func.handle_load_ae_obj_id__event({api_cfg: data.ae_api, event_id: event_id, try_cache: false});
|
||||
console.log(`load_event_obj = `, load_event_obj);
|
||||
|
||||
let load_event_exhibit_obj_li = events_func.handle_load_ae_obj_li__exhibitor({api_cfg: data.ae_api, event_id: event_id, try_cache: false});
|
||||
console.log(`load_event_exhibit_obj_li = `, load_event_exhibit_obj_li);
|
||||
|
||||
return data;
|
||||
}
|
||||
Reference in New Issue
Block a user