From 3c957692c3674c3f4bac2da286039afd08348c7f Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Wed, 16 Oct 2024 13:14:40 -0400 Subject: [PATCH] Making progress with the new locations page and devices related. --- src/lib/ae_events__event_device.ts | 539 ++++++++++++++++++ src/lib/ae_events__event_location.ts | 20 +- src/lib/db_events.ts | 75 ++- src/lib/element_manage_event_file_li.svelte | 8 +- ...element_manage_event_file_li_direct.svelte | 28 +- src/routes/events/[event_id]/+layout.svelte | 31 +- src/routes/events/[event_id]/+page.svelte | 6 +- .../ae_comp__event_device_obj_li.svelte | 264 +++++++++ ...e_comp__event_device_obj_li_wrapper.svelte | 57 ++ .../location/[event_location_id]/+page.svelte | 40 +- .../events/[event_id]/locations/+page.svelte | 143 +++++ .../ae_comp__event_location_obj_li.svelte | 298 ++++++++++ .../locations/locations_page_menu.svelte | 137 +++++ .../ae_comp__event_presenter_obj_li.svelte | 9 +- src/routes/events/event_page_menu.svelte | 54 +- .../ae_comp__event_session_obj_li.svelte | 14 +- ..._comp__event_session_obj_li_wrapper.svelte | 56 ++ 17 files changed, 1640 insertions(+), 139 deletions(-) create mode 100644 src/lib/ae_events__event_device.ts create mode 100644 src/routes/events/[event_id]/device/ae_comp__event_device_obj_li.svelte create mode 100644 src/routes/events/[event_id]/device/ae_comp__event_device_obj_li_wrapper.svelte create mode 100644 src/routes/events/[event_id]/locations/+page.svelte create mode 100644 src/routes/events/[event_id]/locations/ae_comp__event_location_obj_li.svelte create mode 100644 src/routes/events/[event_id]/locations/locations_page_menu.svelte create mode 100644 src/routes/events_pres_mgmt/ae_comp__event_session_obj_li_wrapper.svelte diff --git a/src/lib/ae_events__event_device.ts b/src/lib/ae_events__event_device.ts new file mode 100644 index 00000000..4d409e89 --- /dev/null +++ b/src/lib/ae_events__event_device.ts @@ -0,0 +1,539 @@ +import type { key_val } from '$lib/ae_stores'; +import { api } from '$lib/api'; + +import { db_events } from "$lib/db_events"; + +import { load_ae_obj_id__event_location } from './ae_events__event_location'; + +let ae_promises: key_val = {}; + + +// Updated 2024-06-10 +export async function load_ae_obj_id__event_device( + { + api_cfg, + event_device_id, + inc_location_id = false, + try_cache = true, + log_lvl = 0 + }: { + api_cfg: any, + event_device_id: string, + inc_location_id?: boolean, + try_cache?: boolean, + log_lvl?: number + } + ) { + if (log_lvl) { + console.log(`*** load_ae_obj_id__event_device() *** event_device_id=${event_device_id}`); + } + + let params = {}; + + ae_promises.load__event_device_obj = await api.get_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'event_device', + obj_id: event_device_id, // NOTE: This is the FQDN, not normally the ID. + use_alt_table: true, // 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: log_lvl + }) + .then(function (event_device_obj_get_result) { + if (event_device_obj_get_result) { + if (try_cache) { + // This is expecting a list + db_save_ae_obj_li__event_device({ + obj_type: 'event_device', + obj_li: [event_device_obj_get_result] + }); + } + return event_device_obj_get_result; + } else { + console.log('No results returned.'); + return null; + } + }) + .catch(function (error) { + console.log('No results returned or failed.', error); + }); + + if (log_lvl) { + console.log('ae_promises.load__event_device_obj:', ae_promises.load__event_device_obj); + } + + if (inc_location_id) { + // Load the location linked to this device + if (log_lvl) { + console.log(`Need to load the location id for the device now`); + } + let load_event_location_obj_id = load_ae_obj_id__event_location({ + api_cfg: api_cfg, + event_location_id: ae_promises.load__event_device_obj.event_location_id, + try_cache: try_cache, + log_lvl: log_lvl + }); + + if (log_lvl) { + console.log(`load_event_location_obj_id = `, load_event_location_obj_id); + } + ae_promises.load__event_device_obj.event_location_obj = load_event_location_obj_id; + } + + return ae_promises.load__event_device_obj; +} + + +// Updated 2024-09-24 +export async function load_ae_obj_li__event_device( + { + api_cfg, + for_obj_type, + for_obj_id, + inc_file_li = false, + inc_session_li = false, + order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'name': 'ASC', 'code': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'}, + params = {}, + try_cache = true, + log_lvl = 0 + }: { + api_cfg: any, + for_obj_type: string, + for_obj_id: string, + inc_file_li?: boolean, + inc_session_li?: boolean, + order_by_li?: key_val, + params?: key_val, + try_cache?: boolean, + log_lvl?: number + } + ) { + console.log(`*** load_ae_obj_li__event_device() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`); + + let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled + let hidden: string = (params.qry__hidden ?? 'all'); // all, hidden, not_hidden + let limit: number = (params.qry__limit ?? 99); // 99 + let offset: number = (params.qry__offset ?? 0); // 0 + + let params_json: key_val = {}; + + // console.log('params_json:', params_json); + + ae_promises.load__event_device_obj_li = await api.get_ae_obj_li_for_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'event_device', + for_obj_type: for_obj_type, + for_obj_id: for_obj_id, + use_alt_table: true, // 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 + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(function (event_device_obj_li_get_result) { + if (event_device_obj_li_get_result) { + if (try_cache) { + db_save_ae_obj_li__event_device({ + obj_type: 'event_device', + obj_li: event_device_obj_li_get_result + }); + } + return event_device_obj_li_get_result; + } else { + return []; + } + }) + .catch(function (error) { + console.log('No results returned or failed.', error); + }); + + if (log_lvl) { + console.log('ae_promises.load__event_device_obj_li:', ae_promises.load__event_device_obj_li); + } + + if (inc_file_li) { + // Load the files for the devices + if (log_lvl) { + console.log(`Need to load the file list for each device now`); + } + for (let i = 0; i < ae_promises.load__event_device_obj_li.length; i++) { + let event_device_obj = ae_promises.load__event_device_obj_li[i]; + let event_device_id = event_device_obj.event_device_id_random; + + let load_event_file_obj_li = load_ae_obj_li__event_file({ + api_cfg: api_cfg, + for_obj_type: 'event_device', + for_obj_id: event_device_id, + params: {qry__enabled: enabled, qry__limit: limit}, + try_cache: try_cache, + log_lvl: log_lvl + }) + .then((event_file_obj_li) => { + if (log_lvl) { + console.log(`event_file_obj_li = `, event_file_obj_li); + } + return event_file_obj_li; + }); + + if (log_lvl) { + console.log(`load_event_file_obj_li = `, load_event_file_obj_li); + } + } + } + + if (inc_session_li) { + // Load the sessions for the devices + if (log_lvl) { + console.log(`Need to load the session list for each device now`); + } + for (let i = 0; i < ae_promises.load__event_device_obj_li.length; i++) { + let event_device_obj = ae_promises.load__event_device_obj_li[i]; + let event_device_id = event_device_obj.event_device_id_random; + + let load_event_session_obj_li = load_ae_obj_li__event_session({ + api_cfg: api_cfg, + for_obj_type: 'event_device', + for_obj_id: event_device_id, + params: {qry__enabled: enabled, qry__limit: limit}, + try_cache: try_cache, + log_lvl: log_lvl + }) + .then((event_session_obj_li) => { + if (log_lvl) { + console.log(`event_session_obj_li = `, event_session_obj_li); + } + return event_session_obj_li; + }); + + if (log_lvl) { + console.log(`load_event_session_obj_li = `, load_event_session_obj_li); + } + } + } + + return ae_promises.load__event_device_obj_li; +} + + +// Updated 2024-06-25 +export async function create_ae_obj__event_device( + { + api_cfg, + event_id, + data_kv, + params={}, + log_lvl=0 + }: { + api_cfg: any, + event_id: string, + data_kv: key_val, + params?: key_val, + log_lvl?: number + } + ) { + console.log(`*** create_ae_obj__event_device() *** event_id=${event_id}`); + + ae_promises.create__event_device = await api.create_ae_obj_crud({ + api_cfg: api_cfg, + obj_type: 'event_device', + fields: { + event_id_random: event_id, + ...data_kv + }, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }) + .then(function (event_device_obj_create_result) { + if (event_device_obj_create_result) { + db_save_ae_obj_li__event_device( + { + obj_type: 'event_device', + obj_li: [event_device_obj_create_result] + }); + return event_device_obj_create_result; + } else { + return null; + } + }) + .catch(function (error) { + console.log('No results returned or failed.', error); + }) + .finally(function () { + }); + + if (log_lvl) { + console.log('ae_promises.create__event_device:', ae_promises.create__event_device); + } + return ae_promises.create__event_device; +} + + +// Updated 2024-09-25 +export async function update_ae_obj__event_device( + { + api_cfg, + event_device_id, + data_kv, + params = {}, + try_cache = true, + log_lvl = 0 + }: { + api_cfg: any, + event_device_id: string, + data_kv: key_val, + params?: key_val, + try_cache?: boolean, + log_lvl?: number + } + ) { + if (log_lvl) { + console.log(`*** update_ae_obj__event_device() *** event_device_id=${event_device_id}`, data_kv); + } + ae_promises.update__event_device_obj = await api.update_ae_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'event_device', + obj_id: event_device_id, + fields: data_kv, + key: api_cfg.api_crud_super_key, + params: params, + return_obj: true, + log_lvl: log_lvl + }) + .then(function (event_device_obj_update_result) { + if (event_device_obj_update_result) { + if (try_cache) { + db_save_ae_obj_li__event_device({ + obj_type: 'event_device', obj_li: [event_device_obj_update_result] + }); + } + return event_device_obj_update_result; + } else { + return null; + } + }) + .catch(function (error) { + console.log('No results returned or failed.', error); + }) + .finally(function () { + }); + + if (log_lvl) { + console.log('ae_promises.update__event_device_obj:', ae_promises.update__event_device_obj); + } + return ae_promises.update__event_device_obj; +} + + +export async function search__event_device( + { + api_cfg, + event_id, + fulltext_search_qry_str, + ft_presenter_search_qry_str, + like_search_qry_str = null, + like_presentation_search_qry_str = null, + like_presenter_search_qry_str = null, + params = {}, + try_cache = true, + log_lvl = 0 + }: { + api_cfg: any, + event_id: any, + fulltext_search_qry_str?: null|string, + ft_presenter_search_qry_str?: null|string, + like_search_qry_str?: null|string, + like_presentation_search_qry_str?: null|string, + like_presenter_search_qry_str?: null|string, + params?: any, + try_cache?: boolean, + log_lvl?: number + } + ) { + console.log(`*** search__event_device() *** event_id=${event_id}`); + + let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled + let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden + let limit: number = (params.qry__limit ?? 25); // 99 + let offset: number = (params.qry__offset ?? 0); // 0 + + let params_json: key_val = {}; + + if (!fulltext_search_qry_str && !like_search_qry_str) { + console.log('No search string provided!!!'); + return false; // Returning false instead of [] because no search was performed. + } + + if (fulltext_search_qry_str || ft_presenter_search_qry_str) { + params_json['ft_qry'] = {}; + if (fulltext_search_qry_str && fulltext_search_qry_str.length > 2) { + params_json['ft_qry']['default_qry_str'] = fulltext_search_qry_str; + } + + if (ft_presenter_search_qry_str && ft_presenter_search_qry_str.length > 2) { + params_json['ft_qry']['event_presenter_li_qry_str'] = ft_presenter_search_qry_str; + } + } + + // Use the AND (AND LIKE) query + // if (like_search_qry_str || like_presenter_search_qry_str) { + // params_json['and_like'] = {}; + // if (like_search_qry_str && like_search_qry_str.length > 2) { + // params_json['and_like']['default_qry_str'] = like_search_qry_str; + // } + // if (like_presenter_search_qry_str && like_presenter_search_qry_str.length > 2) { + // params_json['and_like']['event_presenter_li_qry_str'] = like_presenter_search_qry_str; + // } + // } + + // Use the AND (OR LIKE) query + if (like_search_qry_str || like_presentation_search_qry_str || like_presenter_search_qry_str) { + params_json['or_like'] = {}; + if (like_search_qry_str && like_search_qry_str.length > 2) { + params_json['or_like']['default_qry_str'] = like_search_qry_str; + } + if (like_presentation_search_qry_str && like_presentation_search_qry_str.length > 2) { + params_json['or_like']['event_presentation_li_qry_str'] = like_presentation_search_qry_str; + } + if (like_presenter_search_qry_str && like_presenter_search_qry_str.length > 2) { + params_json['or_like']['event_presenter_li_qry_str'] = like_presenter_search_qry_str; + } + } + + params_json['and_qry'] = {}; + + // if (device_type_code) { + // params_json['and_qry']['device_type_code'] = device_type_code; + // } + + let order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'start_datetime': 'ASC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'}; + + ae_promises.load__event_device_obj_li = await api.get_ae_obj_li_for_obj_id_crud({ + api_cfg: api_cfg, + obj_type: 'event_device', + for_obj_type: 'event', + for_obj_id: event_id, + use_alt_table: true, // NOTE: We want to use the alt table for device searching + use_alt_base: false, + enabled: enabled, + hidden: hidden, + order_by_li: order_by_li, + limit: limit, + offset: offset, + params_json: params_json, + params: params, + log_lvl: log_lvl + }) + .then(function (event_device_obj_li_get_result) { + if (event_device_obj_li_get_result) { + db_save_ae_obj_li__event_device({obj_type: 'event_device', obj_li: event_device_obj_li_get_result}); + return event_device_obj_li_get_result; + } else { + return []; + } + }) + .catch(function (error) { + console.log('No results returned or failed.', error); + }) + .finally(function () { + }); + + if (log_lvl) { + console.log('ae_promises.load__event_device_obj_li:', ae_promises.load__event_device_obj_li); + } + return ae_promises.load__event_device_obj_li; +} + + +// This function will loop through the event_device_obj_li and save each one to the DB. +// Updated 2024-06-25 +export function db_save_ae_obj_li__event_device( + { + obj_type, + obj_li, + log_lvl = 0 + }: { + obj_type: string, + obj_li: any, + log_lvl?: number + } + ) { + if (log_lvl) { + console.log(`*** db_save_ae_obj_li__event_device() ***`); + } + + if (obj_li && obj_li.length) { + obj_li.forEach(async function (obj: any) { + if (log_lvl) { + console.log(`ae_obj ${obj_type}:`, obj); + } + + try { + const id_random = await db_events.devices.put({ + id: obj.event_device_id_random, + event_device_id: obj.event_device_id_random, + event_device_id_random: obj.event_device_id_random, + + external_id: obj.external_id, + code: obj.code, + + type_code: obj.type_code, + + event_id: obj.event_id_random, + event_id_random: obj.event_id_random, + + name: obj.name, + description: obj.description, + + passcode: obj.passcode, + + hide_event_launcher: obj.hide_event_launcher, + + alert: obj.alert, + alert_msg: obj.alert_msg, + + data_json: obj.data_json, + + enable: obj.enable, + hide: obj.hide, + priority: obj.priority, + sort: obj.sort, + group: obj.group, + notes: obj.notes, + created_on: obj.created_on, + updated_on: obj.updated_on, + + // From SQL view + file_count: obj.file_count, + file_count_all: obj.file_count_all, + internal_use_count: obj.internal_use_count, + event_file_id_li_json: obj.event_file_id_li_json, + + // poc_person_given_name: obj.poc_person_given_name, + // poc_person_family_name: obj.poc_person_family_name, + // poc_person_full_name: obj.poc_person_full_name, + // poc_person_primary_email: obj.poc_person_primary_email, + // poc_person_passcode: obj.poc_person_passcode, + // poc_kv_json: obj.poc_kv_json, + + event_name: obj.event_name, + }); + // console.log(`Put obj with ID: ${obj.event_device_id_random} or ${id_random}`); + } catch (error) { + let status = `Failed to put ${obj.event_device_id_random}: ${error}`; + console.log(status); + } + + // const id_random = await db_events.devices.put(obj); + // console.log(`Put obj with ID: ${obj.event_device_id_random}`); + }); + + return true; + } +} diff --git a/src/lib/ae_events__event_location.ts b/src/lib/ae_events__event_location.ts index 603cf10e..ee636fd4 100644 --- a/src/lib/ae_events__event_location.ts +++ b/src/lib/ae_events__event_location.ts @@ -27,11 +27,12 @@ export async function load_ae_obj_id__event_location( log_lvl?: number } ) { - console.log(`*** load_ae_obj_id__event_location() *** event_location_id=${event_location_id}`); + if (log_lvl) { + console.log(`*** load_ae_obj_id__event_location() *** event_location_id=${event_location_id}`); + } let params = {}; - // $events_sess.badges.status_load__event_location_obj = 'loading'; ae_promises.load__event_location_obj = await api.get_ae_obj_id_crud({ api_cfg: api_cfg, obj_type: 'event_location', @@ -102,21 +103,6 @@ export async function load_ae_obj_id__event_location( params: {qry__enabled: 'all', qry__limit: 15}, try_cache: try_cache, log_lvl: log_lvl - }) - .then((event_session_obj_li) => { - if (log_lvl) { - console.log(`event_session_obj_li = `, event_session_obj_li); - } - // if (try_cache) { - // console.log(`ae_promises.load__event_session_obj = `, ae_promises.load__event_session_obj); - // ae_promises.load__event_session_obj.event_session_li = event_session_obj_li; - // // Re-save the session object with the new session list - // db_save_ae_obj_li__event_session({ - // obj_type: 'event_session', - // obj_li: [ae_promises.load__event_session_obj] - // }); - // } - return event_session_obj_li; }); if (log_lvl) { diff --git a/src/lib/db_events.ts b/src/lib/db_events.ts index 1d9cf9e0..1e124795 100644 --- a/src/lib/db_events.ts +++ b/src/lib/db_events.ts @@ -5,6 +5,7 @@ import type { key_val } from './ae_stores'; // li = list // kv = key value list +// Updated 2024-10-16 export interface Event { id: string; // id_random: string; @@ -68,11 +69,14 @@ export interface Event { export interface Badge { - // id?: number; + id?: number; id_random: string; + event_badge_id: string; event_badge_id_random: string; + event_id: string; event_id_random: string; + pronouns: null|string; informal_name: null|string; title_names: null|string; @@ -128,12 +132,48 @@ export interface Badge { } -export interface Exhibit { +// Updated 2024-10-16 +export interface Device { // id?: number; id_random: string; - event_exhibit_id_random: string; + event_device_id_random: string; event_id_random: string; + event_location_id_random: string; + + code: string; + name: string; + + for_type: null|string; + for_id: null|string; + for_id_random: null|string; + + alert: null|boolean; + + enable: null|boolean; + hide: null|boolean; + priority: null|boolean + sort: null|number; + group: null|string; + notes: null|string; + created_on: Date; + updated_on: null|Date; + + // Additional fields for convenience (database views) + event_location_code: string; + event_location_name: string; +} + + +export interface Exhibit { + id?: number; + id_random: string; + event_exhibit_id: string; + event_exhibit_id_random: string; + + event_id: string; + event_id_random: string; + code: string; name: string; // tagline: null|string; @@ -161,12 +201,16 @@ export interface Exhibit { export interface Exhibit_tracking { - // id?: number; + id?: number; id_random: string; + event_exhibit_tracking_id: string event_exhibit_tracking_id_random: string; + event_exhibit_id: string; event_exhibit_id_random: string; + event_badge_id: string; event_badge_id_random: string; + event_person_id: string; event_person_id_random: null|string; // Is this needed? external_person_id: null|string; // This is an email address @@ -555,19 +599,20 @@ export interface Session { } -// Updated 2024-06-10 +// Updated 2024-10-16 export class MySubClassedDexie extends Dexie { // 'badges' is added by dexie when declaring the stores() // We just tell the typing system this is the case events!: Table; badges!: Table; + devices!: Table; exhibits!: Table; exhibit_tracking!: Table; files!: Table; locations!: Table; - sessions!: Table; presentations!: Table; presenters!: Table; + sessions!: Table; constructor() { super('ae_events_db'); @@ -585,21 +630,33 @@ export class MySubClassedDexie extends Dexie { // badges: '++id, full_name, email' // Primary key and indexed props badges: ` - id_random, event_badge_id_random, event_id_random, + id, id_random, event_badge_id, event_badge_id_random, + event_id, event_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, enable, hide, priority, sort, group, notes, created_on, updated_on`, + devices: ` + id, id_random, event_device_id_random, event_device_id, + event_id, event_id_random, event_location_id, event_location_id_random, + code, name, + for_type, for_id, for_id_random, + alert, + enable, hide, priority, sort, group, notes, created_on, updated_on`, + exhibits: ` - id_random, event_exhibit_id_random, + id, id_random, event_exhibit_id, event_exhibit_id_random, + event_id, event_id_random, code, name, description, staff_passcode, data_json, license_max, license_li_json, cfg_json, enable, hide, priority, sort, group, notes, created_on, updated_on, [priority+name]`, exhibit_tracking: ` - id_random, event_exhibit_tracking_id_random, event_exhibit_id_random, event_badge_id_random, event_person_id_random, + id, id_random, event_exhibit_tracking_id, event_exhibit_tracking_id_random, + event_exhibit_id, event_exhibit_id_random, + event_badge_id, event_badge_id_random, event_person_id, event_person_id_random, exhibitor_notes, responses_json, data_json, event_badge_full_name, event_badge_email, enable, hide, priority, sort, group, notes, created_on, updated_on`, diff --git a/src/lib/element_manage_event_file_li.svelte b/src/lib/element_manage_event_file_li.svelte index f1564485..3d53474f 100644 --- a/src/lib/element_manage_event_file_li.svelte +++ b/src/lib/element_manage_event_file_li.svelte @@ -1,4 +1,5 @@ diff --git a/src/lib/element_manage_event_file_li_direct.svelte b/src/lib/element_manage_event_file_li_direct.svelte index 0a947225..a844cf89 100644 --- a/src/lib/element_manage_event_file_li_direct.svelte +++ b/src/lib/element_manage_event_file_li_direct.svelte @@ -1,6 +1,5 @@ @@ -63,6 +62,7 @@ let lq__event_file_obj_li = liveQuery( allow_moderator={allow_moderator} container_class_li={container_class_li} display_mode={display_mode} + log_lvl={log_lvl} /> {:catch error}

{error.message}

diff --git a/src/routes/events/[event_id]/+layout.svelte b/src/routes/events/[event_id]/+layout.svelte index 2934c627..40fa53eb 100644 --- a/src/routes/events/[event_id]/+layout.svelte +++ b/src/routes/events/[event_id]/+layout.svelte @@ -1,37 +1,40 @@ + + +
+ {#if $ae_loc.trusted_access && $ae_loc.edit_mode} + + {/if} +
+ + +
+ + +

+ Devices: + + + {@html ($lq__event_device_obj_li?.length ? `${$lq__event_device_obj_li?.length}×` : '')} + + + {#if !$lq__event_device_obj_li?.length} + + + No devices available. + + {/if} +

+ + +{#if $lq__event_device_obj_li?.length} +
    + {#each $lq__event_device_obj_li as event_device_obj} +
  • + +
    + {#if $ae_loc.trusted_access && $ae_loc.edit_mode} + + {/if} + + +
    + +

    + { + console.log(`ae_crud_updated:`, e.detail); + + events_func.load_ae_obj_id__event_device({ + api_cfg: $ae_api, event_device_id: event_device_obj.event_device_id_random, log_lvl: 1 + }) + .then(function (load_results) { + }) + .then(function (load_results) { + // $events_trigger = 'load__event_device_obj_id'; + // $events_trig_kv['event_device_id'] = event_device_obj.event_device_id_random; + }); + }} + > + + "{event_device_obj?.name}" + + + {#if event_device_obj?.code} + + + {event_device_obj?.code ?? ''} + + {/if} +

    + +
    + { + console.log(`ae_crud_updated:`, e.detail); + + events_func.load_ae_obj_id__event_device({api_cfg: $ae_api, event_device_id: event_device_obj.event_device_id_random, log_lvl: 1}); + }} + > + + Description: + + + {#if event_device_obj?.description} + + +
    {event_device_obj.description}
    + + {:else} + {@html ae_snip.html__not_set} + {/if} + +
    +
    + +
  • + {/each} +
+{:else} + +{/if} + + +
+ + + diff --git a/src/routes/events/[event_id]/device/ae_comp__event_device_obj_li_wrapper.svelte b/src/routes/events/[event_id]/device/ae_comp__event_device_obj_li_wrapper.svelte new file mode 100644 index 00000000..71e22b44 --- /dev/null +++ b/src/routes/events/[event_id]/device/ae_comp__event_device_obj_li_wrapper.svelte @@ -0,0 +1,57 @@ + + + + + diff --git a/src/routes/events/[event_id]/location/[event_location_id]/+page.svelte b/src/routes/events/[event_id]/location/[event_location_id]/+page.svelte index 89fcb210..bfd4f869 100644 --- a/src/routes/events/[event_id]/location/[event_location_id]/+page.svelte +++ b/src/routes/events/[event_id]/location/[event_location_id]/+page.svelte @@ -7,20 +7,20 @@ let log_lvl = 0; // Imports import { onMount } from 'svelte'; -import type { key_val } from '$lib/ae_stores'; +// import type { key_val } from '$lib/ae_stores'; import { ae_util } from '$lib/ae_utils/ae_utils'; // import Element_data_store from '$lib/element_data_store_v2.svelte'; -let ae_promises: key_val = {}; -let ae_tmp: key_val = {}; -let ae_triggers: key_val = {}; +// let ae_promises: key_val = {}; +// let ae_tmp: key_val = {}; +// let ae_triggers: key_val = {}; import { liveQuery } from "dexie"; -import { core_func } from '$lib/ae_core_functions'; +// import { core_func } from '$lib/ae_core_functions'; import { db_events } from "$lib/db_events"; import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores'; import { events_loc, events_sess, events_slct, events_trigger, events_trig_kv } from '$lib/ae_events_stores'; -import { events_func } from '$lib/ae_events_functions'; +// import { events_func } from '$lib/ae_events_functions'; import Comp_event_files_upload from '../../../../events_pres_mgmt/ae_comp__event_files_upload.svelte'; import Comp_event_session_obj_li from '../../../../events_pres_mgmt/ae_comp__event_session_obj_li.svelte'; @@ -65,24 +65,26 @@ if (!$events_sess.pres_mgmt) { // $events_sess.pres_mgmt.show_content__agree_text = false; // $events_sess.pres_mgmt.show_content__presenter_start = false; -let lq__event_obj = liveQuery( - () => db_events.events.get($events_slct.event_id) -); +$: lq__event_obj = liveQuery(async () => { + let results = await db_events.events + .get($events_slct.event_id); + return results; +}); -let lq__event_location_obj = liveQuery( - () => db_events.locations.get(ae_acct.slct.event_location_id) -); +$: lq__event_location_obj = liveQuery(async () => { + let results = await db_events.locations + .get(ae_acct.slct.event_location_id); + return results; +}); -let lq__event_session_obj_li = liveQuery( - () => db_events.sessions +$: lq__event_session_obj_li = liveQuery(async () => { + let results = await db_events.sessions .where('event_location_id') .equals(ae_acct.slct.event_location_id) .sortBy('start_datetime') -); - -// let lq__auth__event_presenter_obj = liveQuery( -// () => db_events.presenters.get($events_loc.auth__person.presenter_id ?? null) -// ); + ; + return results; +}); $slct.person_obj_kv = {}; // This is intended for the POC lookup list when generated. diff --git a/src/routes/events/[event_id]/locations/+page.svelte b/src/routes/events/[event_id]/locations/+page.svelte new file mode 100644 index 00000000..d6a2eb79 --- /dev/null +++ b/src/routes/events/[event_id]/locations/+page.svelte @@ -0,0 +1,143 @@ + + + + + + Locations: {ae_util.shorten_string({string: $lq__event_obj?.name ?? 'Loading...', max_length: 12})} ({$lq__event_obj?.event_id ?? ''}) - Pres Mgmt - {$events_loc?.title} + + + + +
+ + + +{#if !$lq__event_location_obj_li} + +
+ + Loading locations... +
+ +{:else} + +

+ + + + Locations/Rooms + + + + {#if $lq__event_obj?.cfg_json?.short_name} + {@html $lq__event_obj?.cfg_json.short_name ?? ae_snip.html__not_set} + {:else} + {@html $lq__event_obj?.name ?? ae_snip.html__not_set} + {/if} +

+ + + +{/if} + + + + +
+ + + diff --git a/src/routes/events/[event_id]/locations/ae_comp__event_location_obj_li.svelte b/src/routes/events/[event_id]/locations/ae_comp__event_location_obj_li.svelte new file mode 100644 index 00000000..2175bfd4 --- /dev/null +++ b/src/routes/events/[event_id]/locations/ae_comp__event_location_obj_li.svelte @@ -0,0 +1,298 @@ + + + +
+ {#if $ae_loc.trusted_access && $ae_loc.edit_mode} + + {/if} +
+ + +
+ + +

+ Locations: + + + {@html ($lq__event_location_obj_li?.length ? `${$lq__event_location_obj_li?.length}×` : '')} + + + {#if !$lq__event_location_obj_li?.length} + + + No locations available. + + {/if} +

+ + +{#if $lq__event_location_obj_li?.length} +
    + {#each $lq__event_location_obj_li as event_location_obj} +
  • + +
    + {#if $ae_loc.trusted_access && $ae_loc.edit_mode} + + {/if} + + +
    + +

    + { + console.log(`ae_crud_updated:`, e.detail); + + events_func.load_ae_obj_id__event_location({ + api_cfg: $ae_api, event_location_id: event_location_obj.event_location_id_random, log_lvl: 1 + }) + .then(function (load_results) { + }) + .then(function (load_results) { + // $events_trigger = 'load__event_location_obj_id'; + // $events_trig_kv['event_location_id'] = event_location_obj.event_location_id_random; + }); + }} + > + + "{event_location_obj?.name}" + + + {#if event_location_obj?.code} + + + {event_location_obj?.code ?? ''} + + {/if} +

    + +
    + { + console.log(`ae_crud_updated:`, e.detail); + + events_func.load_ae_obj_id__event_location({api_cfg: $ae_api, event_location_id: event_location_obj.event_location_id_random, log_lvl: 1}); + }} + > + + Description: + + + {#if event_location_obj?.description} + + +
    {event_location_obj.description}
    + + {:else} + {@html ae_snip.html__not_set} + {/if} + +
    +
    + + + {#if event_location_obj?.event_location_id_random} + + + {/if} + + + + + + + +
  • + {/each} +
+{:else} + +{/if} + + +
+ + + diff --git a/src/routes/events/[event_id]/locations/locations_page_menu.svelte b/src/routes/events/[event_id]/locations/locations_page_menu.svelte new file mode 100644 index 00000000..bcf98348 --- /dev/null +++ b/src/routes/events/[event_id]/locations/locations_page_menu.svelte @@ -0,0 +1,137 @@ + + + + +
+ + +
+ + + + + Back to Session Search + + + + + + + + + +
+ + +
+ + Not much here yet... + +
+ + + + +
+ +
+
diff --git a/src/routes/events/[event_id]/presenter/ae_comp__event_presenter_obj_li.svelte b/src/routes/events/[event_id]/presenter/ae_comp__event_presenter_obj_li.svelte index 3398b9fd..208b79ca 100644 --- a/src/routes/events/[event_id]/presenter/ae_comp__event_presenter_obj_li.svelte +++ b/src/routes/events/[event_id]/presenter/ae_comp__event_presenter_obj_li.svelte @@ -15,16 +15,17 @@ import { events_func } from '$lib/ae_events_functions'; import { ae_util } from '$lib/ae_utils/ae_utils'; // Exports +export let log_lvl: number = 0; export let container_class_li: string|Array = []; export let display_mode: string = 'default'; // 'default', 'compact', 'minimal', 'launcher' + export let link_to_type: string; export let link_to_id: string; export let lq__event_presenter_obj_li: any; -export let log_lvl: number = 0; -// if (log_lvl) { -// console.log(`link_to_type: ${link_to_type}; link_to_id: ${link_to_id}`); -// } +if (log_lvl) { + console.log(`link_to_type: ${link_to_type}; link_to_id: ${link_to_id}`); +} // Variables // let ae_promises: key_val = {}; diff --git a/src/routes/events/event_page_menu.svelte b/src/routes/events/event_page_menu.svelte index 716434a3..1152fe14 100644 --- a/src/routes/events/event_page_menu.svelte +++ b/src/routes/events/event_page_menu.svelte @@ -1,5 +1,5 @@ @@ -180,22 +180,6 @@ let ae_triggers: key_val = {}; { - // search__event_presenter({ - // api_cfg: $ae_api, - // event_id: $events_slct.event_id, - // agree: true, - // biography: null, - // ft_search_str: '', - // lk_search_str: '', - // params: { - // 'qry__enabled': 'enabled', - // 'qry__hidden': 'not_hidden', - // 'qry__limit': $events_loc.pres_mgmt.qry_limit__sessions,}, - // try_cache: false, - // log_lvl: log_lvl, - // }); - }} class="select w-20 text-sm" > @@ -258,22 +226,6 @@ let ae_triggers: key_val = {};