Making progress with the new locations page and devices related.
This commit is contained in:
539
src/lib/ae_events__event_device.ts
Normal file
539
src/lib/ae_events__event_device.ts
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -27,11 +27,12 @@ export async function load_ae_obj_id__event_location(
|
|||||||
log_lvl?: number
|
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 = {};
|
let params = {};
|
||||||
|
|
||||||
// $events_sess.badges.status_load__event_location_obj = 'loading';
|
|
||||||
ae_promises.load__event_location_obj = await api.get_ae_obj_id_crud({
|
ae_promises.load__event_location_obj = await api.get_ae_obj_id_crud({
|
||||||
api_cfg: api_cfg,
|
api_cfg: api_cfg,
|
||||||
obj_type: 'event_location',
|
obj_type: 'event_location',
|
||||||
@@ -102,21 +103,6 @@ export async function load_ae_obj_id__event_location(
|
|||||||
params: {qry__enabled: 'all', qry__limit: 15},
|
params: {qry__enabled: 'all', qry__limit: 15},
|
||||||
try_cache: try_cache,
|
try_cache: try_cache,
|
||||||
log_lvl: log_lvl
|
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) {
|
if (log_lvl) {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import type { key_val } from './ae_stores';
|
|||||||
// li = list
|
// li = list
|
||||||
// kv = key value list
|
// kv = key value list
|
||||||
|
|
||||||
|
// Updated 2024-10-16
|
||||||
export interface Event {
|
export interface Event {
|
||||||
id: string;
|
id: string;
|
||||||
// id_random: string;
|
// id_random: string;
|
||||||
@@ -68,11 +69,14 @@ export interface Event {
|
|||||||
|
|
||||||
|
|
||||||
export interface Badge {
|
export interface Badge {
|
||||||
// id?: number;
|
id?: number;
|
||||||
id_random: string;
|
id_random: string;
|
||||||
|
event_badge_id: string;
|
||||||
event_badge_id_random: string;
|
event_badge_id_random: string;
|
||||||
|
|
||||||
|
event_id: string;
|
||||||
event_id_random: string;
|
event_id_random: string;
|
||||||
|
|
||||||
pronouns: null|string;
|
pronouns: null|string;
|
||||||
informal_name: null|string;
|
informal_name: null|string;
|
||||||
title_names: 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?: number;
|
||||||
id_random: string;
|
id_random: string;
|
||||||
event_exhibit_id_random: string;
|
event_device_id_random: string;
|
||||||
|
|
||||||
event_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;
|
code: string;
|
||||||
name: string;
|
name: string;
|
||||||
// tagline: null|string;
|
// tagline: null|string;
|
||||||
@@ -161,12 +201,16 @@ export interface Exhibit {
|
|||||||
|
|
||||||
|
|
||||||
export interface Exhibit_tracking {
|
export interface Exhibit_tracking {
|
||||||
// id?: number;
|
id?: number;
|
||||||
id_random: string;
|
id_random: string;
|
||||||
|
event_exhibit_tracking_id: string
|
||||||
event_exhibit_tracking_id_random: string;
|
event_exhibit_tracking_id_random: string;
|
||||||
|
|
||||||
|
event_exhibit_id: string;
|
||||||
event_exhibit_id_random: string;
|
event_exhibit_id_random: string;
|
||||||
|
event_badge_id: string;
|
||||||
event_badge_id_random: string;
|
event_badge_id_random: string;
|
||||||
|
event_person_id: string;
|
||||||
event_person_id_random: null|string; // Is this needed?
|
event_person_id_random: null|string; // Is this needed?
|
||||||
|
|
||||||
external_person_id: null|string; // This is an email address
|
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 {
|
export class MySubClassedDexie extends Dexie {
|
||||||
// 'badges' is added by dexie when declaring the stores()
|
// 'badges' is added by dexie when declaring the stores()
|
||||||
// We just tell the typing system this is the case
|
// We just tell the typing system this is the case
|
||||||
events!: Table<Event>;
|
events!: Table<Event>;
|
||||||
badges!: Table<Badge>;
|
badges!: Table<Badge>;
|
||||||
|
devices!: Table<Device>;
|
||||||
exhibits!: Table<Exhibit>;
|
exhibits!: Table<Exhibit>;
|
||||||
exhibit_tracking!: Table<Exhibit_tracking>;
|
exhibit_tracking!: Table<Exhibit_tracking>;
|
||||||
files!: Table<File>;
|
files!: Table<File>;
|
||||||
locations!: Table<Location>;
|
locations!: Table<Location>;
|
||||||
sessions!: Table<Session>;
|
|
||||||
presentations!: Table<Presentation>;
|
presentations!: Table<Presentation>;
|
||||||
presenters!: Table<Presenter>;
|
presenters!: Table<Presenter>;
|
||||||
|
sessions!: Table<Session>;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super('ae_events_db');
|
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, full_name, email' // Primary key and indexed props
|
||||||
badges: `
|
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,
|
full_name, full_name_override, email, email_override,
|
||||||
affiliations, affiliations_override,
|
affiliations, affiliations_override,
|
||||||
badge_type, badge_type_code, badge_type_code_override, badge_type_override,
|
badge_type, badge_type_code, badge_type_code_override, badge_type_override,
|
||||||
external_event_id, external_id, external_person_id,
|
external_event_id, external_id, external_person_id,
|
||||||
enable, hide, priority, sort, group, notes, created_on, updated_on`,
|
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: `
|
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,
|
code, name, description, staff_passcode,
|
||||||
data_json, license_max, license_li_json, cfg_json,
|
data_json, license_max, license_li_json, cfg_json,
|
||||||
enable, hide, priority, sort, group, notes, created_on, updated_on, [priority+name]`,
|
enable, hide, priority, sort, group, notes, created_on, updated_on, [priority+name]`,
|
||||||
|
|
||||||
exhibit_tracking: `
|
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,
|
exhibitor_notes, responses_json, data_json,
|
||||||
event_badge_full_name, event_badge_email,
|
event_badge_full_name, event_badge_email,
|
||||||
enable, hide, priority, sort, group, notes, created_on, updated_on`,
|
enable, hide, priority, sort, group, notes, created_on, updated_on`,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
export let log_lvl = 0;
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { clipboard } from '@skeletonlabs/skeleton';
|
import { clipboard } from '@skeletonlabs/skeleton';
|
||||||
// import { liveQuery } from "dexie";
|
// import { liveQuery } from "dexie";
|
||||||
@@ -33,9 +34,10 @@ ae_tmp.show__direct_download = false;
|
|||||||
// let ae_triggers: key_val = {};
|
// let ae_triggers: key_val = {};
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
// console.log('Element - Manage Event File List');
|
if (log_lvl) {
|
||||||
console.log(`link_to_type: ${link_to_type}; link_to_id: ${link_to_id}`);
|
console.log(`Element - Manage Event File List: link_to_type: ${link_to_type}; link_to_id: ${link_to_id}`);
|
||||||
console.log(`allow_basic: ${allow_basic}; allow_moderator: ${allow_moderator}`);
|
console.log(`allow_basic: ${allow_basic}; allow_moderator: ${allow_moderator}`);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
// import { onMount } from 'svelte';
|
export let log_lvl = 0;
|
||||||
// import { clipboard } from '@skeletonlabs/skeleton';
|
|
||||||
import { liveQuery } from "dexie";
|
import { liveQuery } from "dexie";
|
||||||
|
|
||||||
import type { key_val } from '$lib/ae_stores';
|
import type { key_val } from '$lib/ae_stores';
|
||||||
@@ -11,7 +10,7 @@ import type { key_val } from '$lib/ae_stores';
|
|||||||
import Element_manage_event_file_li from '$lib/element_manage_event_file_li.svelte';
|
import Element_manage_event_file_li from '$lib/element_manage_event_file_li.svelte';
|
||||||
|
|
||||||
// import { core_func } from '$lib/ae_core_functions';
|
// import { core_func } from '$lib/ae_core_functions';
|
||||||
import { ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
// import { ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
||||||
import { db_events } from "$lib/db_events";
|
import { db_events } from "$lib/db_events";
|
||||||
// import { events_loc, events_sess, 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';
|
// import { events_func } from '$lib/ae_events_functions';
|
||||||
@@ -22,10 +21,8 @@ export let link_to_id: string;
|
|||||||
export let allow_basic: boolean = false;
|
export let allow_basic: boolean = false;
|
||||||
export let allow_moderator: boolean = false;
|
export let allow_moderator: boolean = false;
|
||||||
export let display_mode: string = 'default'; // 'default', 'compact', 'minimal', 'launcher'
|
export let display_mode: string = 'default'; // 'default', 'compact', 'minimal', 'launcher'
|
||||||
|
|
||||||
// export let show_convert_btn: null|boolean = null;
|
// export let show_convert_btn: null|boolean = null;
|
||||||
|
|
||||||
// let ae_placeholder_li: key_val = {};
|
|
||||||
// let ae_promises: key_val = {};
|
// let ae_promises: key_val = {};
|
||||||
let ae_tmp: key_val = {};
|
let ae_tmp: key_val = {};
|
||||||
ae_tmp.show__file_li = true;
|
ae_tmp.show__file_li = true;
|
||||||
@@ -38,15 +35,17 @@ let dq__where_for_id_eq_val: string = link_to_id;
|
|||||||
|
|
||||||
// This should only include files that are directly linked to an object (event, location, session, presenter, etc.).
|
// This should only include files that are directly linked to an object (event, location, session, presenter, etc.).
|
||||||
// I am not sure why, but doing reverse() and then sortBy() seems to sort in descending order.
|
// I am not sure why, but doing reverse() and then sortBy() seems to sort in descending order.
|
||||||
let lq__event_file_obj_li = liveQuery(
|
$: lq__event_file_obj_li = liveQuery(async () => {
|
||||||
async () => await db_events.files
|
let results = await db_events.files
|
||||||
.where(dq__where_val)
|
.where(dq__where_val)
|
||||||
.equals(dq__where_eq_val)
|
.equals(dq__where_eq_val)
|
||||||
.and(file => file.for_id_random == dq__where_for_id_eq_val)
|
.and(file => file.for_id_random == dq__where_for_id_eq_val)
|
||||||
.reverse()
|
.reverse()
|
||||||
.sortBy('created_on')
|
.sortBy('created_on')
|
||||||
// .toArray()
|
// .toArray()
|
||||||
);
|
;
|
||||||
|
return results;
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
@@ -63,6 +62,7 @@ let lq__event_file_obj_li = liveQuery(
|
|||||||
allow_moderator={allow_moderator}
|
allow_moderator={allow_moderator}
|
||||||
container_class_li={container_class_li}
|
container_class_li={container_class_li}
|
||||||
display_mode={display_mode}
|
display_mode={display_mode}
|
||||||
|
log_lvl={log_lvl}
|
||||||
/>
|
/>
|
||||||
{:catch error}
|
{:catch error}
|
||||||
<p style="color: red;">{error.message}</p>
|
<p style="color: red;">{error.message}</p>
|
||||||
|
|||||||
@@ -1,37 +1,40 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
/** @type {import('./$types').LayoutData} */
|
/** @type {import('./$types').LayoutData} */
|
||||||
export let data: any;
|
export let data: any;
|
||||||
let log_lvl = 2;
|
let log_lvl = 0;
|
||||||
// console.log(`ae_events_pres_mgmt event [event_id] +page.svelte data:`, data);
|
// console.log(`ae_events_pres_mgmt event [event_id] +page.svelte data:`, data);
|
||||||
|
|
||||||
import { browser } from '$app/environment';
|
// import { browser } from '$app/environment';
|
||||||
// import { goto, invalidate, pushState, replaceState } from '$app/navigation';
|
// import { goto, invalidate, pushState, replaceState } from '$app/navigation';
|
||||||
|
|
||||||
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 { ae_util } from '$lib/ae_utils/ae_utils';
|
||||||
// import Element_data_store from '$lib/element_data_store_v2.svelte';
|
// import Element_data_store from '$lib/element_data_store_v2.svelte';
|
||||||
// import Comp_event_session_obj_li from '../../events_pres_mgmt/ae_comp__event_session_obj_li.svelte';
|
|
||||||
|
|
||||||
import { liveQuery } from "dexie";
|
// 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 { 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 { 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 } 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';
|
// import { events_func } from '$lib/ae_events_functions';
|
||||||
|
|
||||||
|
|
||||||
import Event_page_menu from '../event_page_menu.svelte';
|
// import Event_page_menu from '../event_page_menu.svelte';
|
||||||
|
|
||||||
|
|
||||||
// Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other.
|
// Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other.
|
||||||
$slct.account_id = data.account_id;
|
$slct.account_id = data.account_id;
|
||||||
// console.log(`$slct.account_id = `, $slct.account_id);
|
// console.log(`$slct.account_id = `, $slct.account_id);
|
||||||
let ae_acct = data[$slct.account_id];
|
let ae_acct = data[$slct.account_id];
|
||||||
console.log(`ae_acct = `, ae_acct);
|
if (log_lvl) {
|
||||||
|
console.log(`ae_acct = `, ae_acct);
|
||||||
|
}
|
||||||
|
|
||||||
console.log(`event_id layout A: ${data.params.event_id}`);
|
if (log_lvl > 1) {
|
||||||
console.log(`event_id layout B: ${ae_acct.slct.event_id}`);
|
console.log(`event_id layout A: ${data.params.event_id}`);
|
||||||
console.log(`event_id layout C: ${$events_slct.event_id}`);
|
console.log(`event_id layout B: ${ae_acct.slct.event_id}`);
|
||||||
|
console.log(`event_id layout C: ${$events_slct.event_id}`);
|
||||||
|
}
|
||||||
|
|
||||||
// $: event_id = data.params.event_id;
|
// $: event_id = data.params.event_id;
|
||||||
// console.log(`event_id layout D: ${event_id}`);
|
// console.log(`event_id layout D: ${event_id}`);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import { ae_util } from '$lib/ae_utils/ae_utils';
|
|||||||
import Comp_event_session_obj_li from '../../events_pres_mgmt/ae_comp__event_session_obj_li.svelte';
|
import Comp_event_session_obj_li from '../../events_pres_mgmt/ae_comp__event_session_obj_li.svelte';
|
||||||
|
|
||||||
import { liveQuery } from "dexie";
|
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 { 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 { 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 } from '$lib/ae_events_stores';
|
import { events_loc, events_sess, events_slct, events_trigger } from '$lib/ae_events_stores';
|
||||||
@@ -80,7 +80,7 @@ $: lq__event_location_obj_li = liveQuery(async () => {
|
|||||||
.where('event_id_random')
|
.where('event_id_random')
|
||||||
.equals($events_slct.event_id)
|
.equals($events_slct.event_id)
|
||||||
.sortBy('name')
|
.sortBy('name')
|
||||||
|
;
|
||||||
return results;
|
return results;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -481,6 +481,7 @@ max-w-max -->
|
|||||||
<!-- Clear text -->
|
<!-- Clear text -->
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
<!-- svelte-ignore a11y-autofocus -->
|
||||||
<input
|
<input
|
||||||
type="search"
|
type="search"
|
||||||
placeholder="Search for a session"
|
placeholder="Search for a session"
|
||||||
@@ -493,7 +494,6 @@ max-w-max -->
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
autofocus
|
autofocus
|
||||||
suggest="off"
|
|
||||||
data-ignore="true"
|
data-ignore="true"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,264 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
// Imports
|
||||||
|
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 Element_ae_crud from '$lib/element_ae_crud.svelte';
|
||||||
|
|
||||||
|
// Exports
|
||||||
|
export let log_lvl: number = 0;
|
||||||
|
export let container_class_li: string|Array<string> = [];
|
||||||
|
// 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_device_obj_li: any;
|
||||||
|
|
||||||
|
if (log_lvl) {
|
||||||
|
console.log(`link_to_type: ${link_to_type}; link_to_id: ${link_to_id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Variables
|
||||||
|
// let ae_promises: key_val = {};
|
||||||
|
// let ae_tmp: key_val = {};
|
||||||
|
// let ae_triggers: key_val = {};
|
||||||
|
|
||||||
|
// Functions and Logic
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="float-right flex flex-row items-center"
|
||||||
|
>
|
||||||
|
{#if $ae_loc.trusted_access && $ae_loc.edit_mode}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
on:click={() => {
|
||||||
|
console.log('Add Device');
|
||||||
|
if (!confirm('Add a new device to the event? You will be able to edit the details after the device is created.')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let device_data = {
|
||||||
|
event_id_random: $events_slct.event_id,
|
||||||
|
name: 'TEMP Device Name',
|
||||||
|
enable: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
events_func.create_ae_obj__event_device({
|
||||||
|
api_cfg: $ae_api,
|
||||||
|
event_id: $events_slct.event_id,
|
||||||
|
data_kv: device_data,
|
||||||
|
log_lvl: log_lvl,
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
class="btn btn-sm variant-soft-warning hover:variant-filled-warning"
|
||||||
|
>
|
||||||
|
<span class="fas fa-plus mx-1"></span>
|
||||||
|
Add Device
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<section class="ae_comp event_device_obj_li {container_class_li}">
|
||||||
|
|
||||||
|
|
||||||
|
<h3 class="h5">
|
||||||
|
Devices:
|
||||||
|
<span class="font-bold bg-success-100 px-4 border rounded-lg border-success-200"
|
||||||
|
class:hidden={!$lq__event_device_obj_li?.length}
|
||||||
|
title="Devices: {$lq__event_device_obj_li?.length ?? 'None'}"
|
||||||
|
>
|
||||||
|
<span class="fas fa-chalkboard-teacher m-1"></span>
|
||||||
|
{@html ($lq__event_device_obj_li?.length ? `${$lq__event_device_obj_li?.length}×` : '')}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
{#if !$lq__event_device_obj_li?.length}
|
||||||
|
<span class="text-sm text-gray-500 bg-gray-100 p-1 rounded-md border border-gray-200"
|
||||||
|
>
|
||||||
|
<span class="fas fa-exclamation-triangle mx-1"></span>
|
||||||
|
No devices available.
|
||||||
|
</span>
|
||||||
|
{/if}
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<!-- Show devices for this LiveQuery -->
|
||||||
|
{#if $lq__event_device_obj_li?.length}
|
||||||
|
<ul
|
||||||
|
class="space-y-4 p-4 m-2 bg-gray-100 rounded-md"
|
||||||
|
>
|
||||||
|
{#each $lq__event_device_obj_li as event_device_obj}
|
||||||
|
<li
|
||||||
|
class="space-y-2 border border-gray-200 p-2 rounded-md"
|
||||||
|
>
|
||||||
|
|
||||||
|
<div class="float-right space-2 flex flex-row items-center">
|
||||||
|
{#if $ae_loc.trusted_access && $ae_loc.edit_mode}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
on:click={() => {
|
||||||
|
console.log('Add Session');
|
||||||
|
if (!confirm('Add a new session to the device? You will be able to edit their details after the session record is created.')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let session_data = {
|
||||||
|
event_id_random: $events_slct.event_id,
|
||||||
|
event_device_id_random: event_device_obj?.event_device_id_random,
|
||||||
|
name: 'TEMP Session Name',
|
||||||
|
enable: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
events_func.create_ae_obj__event_session({
|
||||||
|
api_cfg: $ae_api,
|
||||||
|
event_id: $events_slct.event_id,
|
||||||
|
data_kv: session_data,
|
||||||
|
log_lvl: log_lvl,
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
class="btn btn-sm variant-soft-warning hover:variant-filled-warning"
|
||||||
|
>
|
||||||
|
<span class="fas fa-plus mx-1"></span>
|
||||||
|
Add Session
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h4 class="h5 rounded-md p-2 bg-gray-200">
|
||||||
|
<Element_ae_crud
|
||||||
|
api_cfg={$ae_api}
|
||||||
|
object_type={'event_device'}
|
||||||
|
object_id={event_device_obj?.event_device_id_random}
|
||||||
|
field_name={'name'}
|
||||||
|
field_type={'text'}
|
||||||
|
field_value={event_device_obj?.name}
|
||||||
|
allow_null={false}
|
||||||
|
hide_edit_btn={!$ae_loc.trusted_access || !$ae_loc.edit_mode}
|
||||||
|
outline_element={false}
|
||||||
|
show_crud={false}
|
||||||
|
display_inline={true}
|
||||||
|
display_block_edit={true}
|
||||||
|
class_li={''}
|
||||||
|
on:ae_crud_updated={e => {
|
||||||
|
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;
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<!-- <strong class="text-sm">Name/Title:</strong> -->
|
||||||
|
"{event_device_obj?.name}"
|
||||||
|
</Element_ae_crud>
|
||||||
|
<!-- "{event_device_obj.name}" -->
|
||||||
|
{#if event_device_obj?.code}
|
||||||
|
<span class="text-sm text-gray-500 bg-yellow-100 p-1 rounded-md border border-yellow-200"
|
||||||
|
title="Device code {event_device_obj?.code}"
|
||||||
|
>
|
||||||
|
<span class="fas fa-barcode"></span>
|
||||||
|
{event_device_obj?.code ?? ''}
|
||||||
|
</span>
|
||||||
|
{/if}
|
||||||
|
</h4>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class:hidden={!$events_loc.pres_mgmt.show_content__device_description}
|
||||||
|
>
|
||||||
|
<Element_ae_crud
|
||||||
|
api_cfg={$ae_api}
|
||||||
|
object_type={'event_device'}
|
||||||
|
object_id={event_device_obj?.event_device_id_random}
|
||||||
|
field_name={'description'}
|
||||||
|
field_type={'textarea'}
|
||||||
|
field_value={event_device_obj?.description}
|
||||||
|
allow_null={false}
|
||||||
|
hide_edit_btn={!$ae_loc.trusted_access || !$ae_loc.edit_mode}
|
||||||
|
outline_element={false}
|
||||||
|
show_crud={false}
|
||||||
|
display_inline={true}
|
||||||
|
display_block_edit={true}
|
||||||
|
textarea_rows={15}
|
||||||
|
class_li={''}
|
||||||
|
on:ae_crud_updated={e => {
|
||||||
|
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});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<strong class="text-sm">
|
||||||
|
Description:
|
||||||
|
</strong>
|
||||||
|
|
||||||
|
{#if event_device_obj?.description}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
on:click={() => {
|
||||||
|
console.log('Show/Hide Description');
|
||||||
|
if ($events_sess.pres_mgmt.show_content__device_description == event_device_obj.event_device_id_random) {
|
||||||
|
$events_sess.pres_mgmt.show_content__device_description = null;
|
||||||
|
|
||||||
|
// Was testing with LiveQuery
|
||||||
|
$events_slct.event_device_id = null;
|
||||||
|
} else {
|
||||||
|
$events_sess.pres_mgmt.show_content__device_description = event_device_obj.event_device_id_random;
|
||||||
|
|
||||||
|
// Was testing with LiveQuery
|
||||||
|
$events_slct.event_device_id = event_device_obj.event_device_id_random;
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
class="btn btn-sm variant-soft-surface hover:variant-filled-surface text-xs"
|
||||||
|
>
|
||||||
|
{#if $events_sess.pres_mgmt.show_content__device_description == event_device_obj.event_device_id_random}
|
||||||
|
<span class="fas fa-eye-slash mx-1"></span>
|
||||||
|
<span>Hide Description</span>
|
||||||
|
{:else}
|
||||||
|
<span class="fas fa-eye mx-1"></span>
|
||||||
|
<span>Show</span>
|
||||||
|
{/if}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<pre
|
||||||
|
class="whitespace-pre-wrap p-2 bg-gray-100 rounded-md"
|
||||||
|
class:hidden={$events_sess.pres_mgmt.show_content__device_description !== event_device_obj.event_device_id_random}
|
||||||
|
>{event_device_obj.description}</pre>
|
||||||
|
|
||||||
|
{:else}
|
||||||
|
{@html ae_snip.html__not_set}
|
||||||
|
{/if}
|
||||||
|
<!-- {:else}
|
||||||
|
<div class="text-sm text-gray-500 bg-gray-100 p-1 rounded-md border border-gray-200"
|
||||||
|
class:hidden={!$ae_loc.administrator_access}
|
||||||
|
>
|
||||||
|
<span class="fas fa-exclamation-triangle mx-1"></span>
|
||||||
|
No description provided.
|
||||||
|
</div>
|
||||||
|
{/if} -->
|
||||||
|
</Element_ae_crud>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
{/each}
|
||||||
|
</ul>
|
||||||
|
{:else}
|
||||||
|
<!-- <p class:hidden={display_mode != 'default'}>
|
||||||
|
No devices available to show at this time
|
||||||
|
</p> -->
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
// Imports
|
||||||
|
import Comp_event_device_obj_li from '././ae_comp__event_device_obj_li.svelte';
|
||||||
|
|
||||||
|
import { liveQuery } from "dexie";
|
||||||
|
import { db_events } from "$lib/db_events";
|
||||||
|
|
||||||
|
// Exports
|
||||||
|
export let log_lvl: number = 2;
|
||||||
|
export let container_class_li: string|Array<string> = [];
|
||||||
|
// export let display_mode: string = 'default'; // 'default', 'compact', 'minimal', 'launcher'
|
||||||
|
|
||||||
|
export let event_device_id_random_li: Array<string> = [];
|
||||||
|
export let link_to_type: string;
|
||||||
|
export let link_to_id: string;
|
||||||
|
|
||||||
|
if (log_lvl) {
|
||||||
|
console.log(`link_to_type: ${link_to_type}; link_to_id: ${link_to_id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Variables
|
||||||
|
// let ae_promises: key_val = {};
|
||||||
|
// let ae_tmp: key_val = {};
|
||||||
|
// let ae_triggers: key_val = {};
|
||||||
|
|
||||||
|
let dq__where_type_id_val: string = `${link_to_type}_id_random`;
|
||||||
|
let dq__where_eq_id_val: string = link_to_id;
|
||||||
|
|
||||||
|
// Functions and Logic
|
||||||
|
$: lq__event_device_obj_li = liveQuery(async () => {
|
||||||
|
if (link_to_type && link_to_id) {
|
||||||
|
let results = await db_events.devices
|
||||||
|
.where(dq__where_type_id_val)
|
||||||
|
.equals(dq__where_eq_id_val)
|
||||||
|
.sortBy('name')
|
||||||
|
|
||||||
|
return results;
|
||||||
|
} else if (event_device_id_random_li.length > 0) {
|
||||||
|
let results = await db_events.devices
|
||||||
|
.bulkGet(event_device_id_random_li);
|
||||||
|
|
||||||
|
return results;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<Comp_event_device_obj_li
|
||||||
|
container_class_li={container_class_li}
|
||||||
|
link_to_type={link_to_type}
|
||||||
|
link_to_id={link_to_id}
|
||||||
|
lq__event_device_obj_li={lq__event_device_obj_li}
|
||||||
|
log_lvl={log_lvl}
|
||||||
|
>
|
||||||
|
</Comp_event_device_obj_li>
|
||||||
@@ -7,20 +7,20 @@ let log_lvl = 0;
|
|||||||
// Imports
|
// Imports
|
||||||
import { onMount } from 'svelte';
|
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 { ae_util } from '$lib/ae_utils/ae_utils';
|
||||||
// import Element_data_store from '$lib/element_data_store_v2.svelte';
|
// import Element_data_store from '$lib/element_data_store_v2.svelte';
|
||||||
|
|
||||||
let ae_promises: key_val = {};
|
// let ae_promises: key_val = {};
|
||||||
let ae_tmp: key_val = {};
|
// let ae_tmp: key_val = {};
|
||||||
let ae_triggers: key_val = {};
|
// let ae_triggers: key_val = {};
|
||||||
|
|
||||||
import { liveQuery } from "dexie";
|
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 { 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 { 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_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_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';
|
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__agree_text = false;
|
||||||
// $events_sess.pres_mgmt.show_content__presenter_start = false;
|
// $events_sess.pres_mgmt.show_content__presenter_start = false;
|
||||||
|
|
||||||
let lq__event_obj = liveQuery(
|
$: lq__event_obj = liveQuery(async () => {
|
||||||
() => db_events.events.get($events_slct.event_id)
|
let results = await db_events.events
|
||||||
);
|
.get($events_slct.event_id);
|
||||||
|
return results;
|
||||||
|
});
|
||||||
|
|
||||||
let lq__event_location_obj = liveQuery(
|
$: lq__event_location_obj = liveQuery(async () => {
|
||||||
() => db_events.locations.get(ae_acct.slct.event_location_id)
|
let results = await db_events.locations
|
||||||
);
|
.get(ae_acct.slct.event_location_id);
|
||||||
|
return results;
|
||||||
|
});
|
||||||
|
|
||||||
let lq__event_session_obj_li = liveQuery(
|
$: lq__event_session_obj_li = liveQuery(async () => {
|
||||||
() => db_events.sessions
|
let results = await db_events.sessions
|
||||||
.where('event_location_id')
|
.where('event_location_id')
|
||||||
.equals(ae_acct.slct.event_location_id)
|
.equals(ae_acct.slct.event_location_id)
|
||||||
.sortBy('start_datetime')
|
.sortBy('start_datetime')
|
||||||
);
|
;
|
||||||
|
return results;
|
||||||
// let lq__auth__event_presenter_obj = liveQuery(
|
});
|
||||||
// () => db_events.presenters.get($events_loc.auth__person.presenter_id ?? null)
|
|
||||||
// );
|
|
||||||
|
|
||||||
$slct.person_obj_kv = {}; // This is intended for the POC lookup list when generated.
|
$slct.person_obj_kv = {}; // This is intended for the POC lookup list when generated.
|
||||||
|
|
||||||
|
|||||||
143
src/routes/events/[event_id]/locations/+page.svelte
Normal file
143
src/routes/events/[event_id]/locations/+page.svelte
Normal file
@@ -0,0 +1,143 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
/** @type {import('./$types').PageData} */
|
||||||
|
export let data: any;
|
||||||
|
let log_lvl = 0;
|
||||||
|
// console.log(`ae_events_pres_mgmt event [slug] +page.svelte data:`, data);
|
||||||
|
|
||||||
|
// Imports
|
||||||
|
import { Modal } from 'flowbite-svelte';
|
||||||
|
import { onMount } from 'svelte';
|
||||||
|
|
||||||
|
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 = {};
|
||||||
|
|
||||||
|
import { liveQuery } from "dexie";
|
||||||
|
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 Comp_event_location_obj_li from './ae_comp__event_location_obj_li.svelte';
|
||||||
|
import Locations_page_menu from './locations_page_menu.svelte';
|
||||||
|
// import Sign_in_out from './../../sign_in_out.svelte';
|
||||||
|
|
||||||
|
import { browser } from '$app/environment';
|
||||||
|
|
||||||
|
// Variables
|
||||||
|
if (browser) {
|
||||||
|
console.log('Browser environment detected.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other.
|
||||||
|
$slct.account_id = data.account_id;
|
||||||
|
// console.log(`$slct.account_id = `, $slct.account_id);
|
||||||
|
let ae_acct = data[$slct.account_id];
|
||||||
|
// console.log(`ae_acct = `, ae_acct);
|
||||||
|
|
||||||
|
$ae_loc.url_origin = data.url.origin;
|
||||||
|
|
||||||
|
$events_slct.event_id = ae_acct.slct.event_id;
|
||||||
|
|
||||||
|
$: lq__event_obj = liveQuery(async () => {
|
||||||
|
let results = await db_events.events.get($events_slct.event_id);
|
||||||
|
return results;
|
||||||
|
});
|
||||||
|
|
||||||
|
$: lq__event_location_obj_li = liveQuery(async () => {
|
||||||
|
let results = await db_events.locations
|
||||||
|
.where('event_id')
|
||||||
|
.equals(ae_acct.slct.event_id)
|
||||||
|
.sortBy('name')
|
||||||
|
;
|
||||||
|
return results;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Functions and Logic
|
||||||
|
onMount(() => {
|
||||||
|
console.log('Events Location [slug]: +page.svelte');
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<svelte:head>
|
||||||
|
<title>
|
||||||
|
Locations: {ae_util.shorten_string({string: $lq__event_obj?.name ?? 'Loading...', max_length: 12})} ({$lq__event_obj?.event_id ?? ''}) - Pres Mgmt - {$events_loc?.title}
|
||||||
|
</title>
|
||||||
|
</svelte:head>
|
||||||
|
|
||||||
|
|
||||||
|
<section
|
||||||
|
class="
|
||||||
|
ae_events_pres_mgmt_event_location
|
||||||
|
md:container
|
||||||
|
flex flex-col gap-1
|
||||||
|
items-center
|
||||||
|
justify-start
|
||||||
|
mx-auto
|
||||||
|
py-1 px-2 pb-16
|
||||||
|
h-full
|
||||||
|
min-w-full
|
||||||
|
max-w-max
|
||||||
|
"
|
||||||
|
>
|
||||||
|
|
||||||
|
<Locations_page_menu
|
||||||
|
lq__event_obj={lq__event_obj}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{#if !$lq__event_location_obj_li}
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<span class="fas fa-spinner fa-spin m-1"></span>
|
||||||
|
<span>Loading locations...</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{:else}
|
||||||
|
|
||||||
|
<h2 class="h2 text-center rounded-md p-1 px-2 bg-gray-300 flex flex-row gap-0.25 items-center justify-between w-full">
|
||||||
|
<span
|
||||||
|
class="flex flex-row gap-1 items-center"
|
||||||
|
>
|
||||||
|
<!-- <span class="fas fa-calendar-day m-1"></span> -->
|
||||||
|
<span class="fas fa-map-marked m-1"></span>
|
||||||
|
Locations/Rooms
|
||||||
|
<!-- Button to toggle between the regular location view and managing locations??? -->
|
||||||
|
</span>
|
||||||
|
<!-- Locations for: -->
|
||||||
|
{#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}
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<Element_data_store
|
||||||
|
ds_code="events__pres_mgmt__locations_msg"
|
||||||
|
ds_name="Default: Events - Pres Mgmt Locations Message"
|
||||||
|
ds_type="html"
|
||||||
|
for_type="event"
|
||||||
|
for_id={$lq__event_obj?.event_id}
|
||||||
|
class_li="w-full max-w-screen-lg text-lg text-blue-500 font-bold text-center p-1 m-auto border border-blue-200 rounded-md bg-blue-100 space-y-2"
|
||||||
|
hide={!$ae_loc.manager_access || $events_loc.pres_mgmt.hide__locations_msg}
|
||||||
|
show_edit={false}
|
||||||
|
show_edit_btn={true}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
|
||||||
|
<Comp_event_location_obj_li
|
||||||
|
lq__event_location_obj_li={lq__event_location_obj_li}
|
||||||
|
/>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
<style lang="postcss">
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,298 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
// Imports
|
||||||
|
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 Comp_event_session_obj_li from '../../../events_pres_mgmt/ae_comp__event_session_obj_li_wrapper.svelte';
|
||||||
|
import Element_ae_crud from '$lib/element_ae_crud.svelte';
|
||||||
|
import Element_manage_event_file_li_wrap from '$lib/element_manage_event_file_li_all.svelte';
|
||||||
|
import Comp_event_device_obj_li from './../device/ae_comp__event_device_obj_li_wrapper.svelte';
|
||||||
|
|
||||||
|
// Exports
|
||||||
|
export let log_lvl: number = 0;
|
||||||
|
export let container_class_li: string|Array<string> = [];
|
||||||
|
// 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_location_obj_li: any;
|
||||||
|
|
||||||
|
if (log_lvl) {
|
||||||
|
console.log(`link_to_type: ${link_to_type}; link_to_id: ${link_to_id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Variables
|
||||||
|
// let ae_promises: key_val = {};
|
||||||
|
// let ae_tmp: key_val = {};
|
||||||
|
// let ae_triggers: key_val = {};
|
||||||
|
|
||||||
|
// Functions and Logic
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="float-right flex flex-row items-center"
|
||||||
|
>
|
||||||
|
{#if $ae_loc.trusted_access && $ae_loc.edit_mode}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
on:click={() => {
|
||||||
|
console.log('Add Location');
|
||||||
|
if (!confirm('Add a new location to the event? You will be able to edit the details after the location is created.')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let location_data = {
|
||||||
|
event_id_random: $events_slct.event_id,
|
||||||
|
name: 'TEMP Location Name',
|
||||||
|
enable: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
events_func.create_ae_obj__event_location({
|
||||||
|
api_cfg: $ae_api,
|
||||||
|
event_id: $events_slct.event_id,
|
||||||
|
data_kv: location_data,
|
||||||
|
log_lvl: log_lvl,
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
class="btn btn-sm variant-soft-warning hover:variant-filled-warning"
|
||||||
|
>
|
||||||
|
<span class="fas fa-plus mx-1"></span>
|
||||||
|
Add Location
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<section class="ae_comp event_location_obj_li {container_class_li}">
|
||||||
|
|
||||||
|
|
||||||
|
<h3 class="h5">
|
||||||
|
Locations:
|
||||||
|
<span class="font-bold bg-success-100 px-4 border rounded-lg border-success-200"
|
||||||
|
class:hidden={!$lq__event_location_obj_li?.length}
|
||||||
|
title="Locations: {$lq__event_location_obj_li?.length ?? 'None'}"
|
||||||
|
>
|
||||||
|
<span class="fas fa-chalkboard-teacher m-1"></span>
|
||||||
|
{@html ($lq__event_location_obj_li?.length ? `${$lq__event_location_obj_li?.length}×` : '')}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
{#if !$lq__event_location_obj_li?.length}
|
||||||
|
<span class="text-sm text-gray-500 bg-gray-100 p-1 rounded-md border border-gray-200"
|
||||||
|
>
|
||||||
|
<span class="fas fa-exclamation-triangle mx-1"></span>
|
||||||
|
No locations available.
|
||||||
|
</span>
|
||||||
|
{/if}
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<!-- Show locations for this LiveQuery -->
|
||||||
|
{#if $lq__event_location_obj_li?.length}
|
||||||
|
<ul
|
||||||
|
class="space-y-4 p-4 m-2 bg-gray-100 rounded-md"
|
||||||
|
>
|
||||||
|
{#each $lq__event_location_obj_li as event_location_obj}
|
||||||
|
<li
|
||||||
|
class="space-y-2 border border-gray-200 p-2 rounded-md"
|
||||||
|
>
|
||||||
|
|
||||||
|
<div class="float-right space-2 flex flex-row items-center">
|
||||||
|
{#if $ae_loc.trusted_access && $ae_loc.edit_mode}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
on:click={() => {
|
||||||
|
console.log('Add Session');
|
||||||
|
if (!confirm('Add a new session to the location? You will be able to edit their details after the session record is created.')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let session_data = {
|
||||||
|
event_id_random: $events_slct.event_id,
|
||||||
|
event_location_id_random: event_location_obj?.event_location_id_random,
|
||||||
|
name: 'TEMP Session Name',
|
||||||
|
enable: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
events_func.create_ae_obj__event_session({
|
||||||
|
api_cfg: $ae_api,
|
||||||
|
event_id: $events_slct.event_id,
|
||||||
|
data_kv: session_data,
|
||||||
|
log_lvl: log_lvl,
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
class="btn btn-sm variant-soft-warning hover:variant-filled-warning"
|
||||||
|
>
|
||||||
|
<span class="fas fa-plus mx-1"></span>
|
||||||
|
Add Session
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h4 class="h5 rounded-md p-2 bg-gray-200">
|
||||||
|
<Element_ae_crud
|
||||||
|
api_cfg={$ae_api}
|
||||||
|
object_type={'event_location'}
|
||||||
|
object_id={event_location_obj?.event_location_id_random}
|
||||||
|
field_name={'name'}
|
||||||
|
field_type={'text'}
|
||||||
|
field_value={event_location_obj?.name}
|
||||||
|
allow_null={false}
|
||||||
|
hide_edit_btn={!$ae_loc.trusted_access || !$ae_loc.edit_mode}
|
||||||
|
outline_element={false}
|
||||||
|
show_crud={false}
|
||||||
|
display_inline={true}
|
||||||
|
display_block_edit={true}
|
||||||
|
class_li={''}
|
||||||
|
on:ae_crud_updated={e => {
|
||||||
|
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;
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<!-- <strong class="text-sm">Name/Title:</strong> -->
|
||||||
|
"{event_location_obj?.name}"
|
||||||
|
</Element_ae_crud>
|
||||||
|
<!-- "{event_location_obj.name}" -->
|
||||||
|
{#if event_location_obj?.code}
|
||||||
|
<span class="text-sm text-gray-500 bg-yellow-100 p-1 rounded-md border border-yellow-200"
|
||||||
|
title="Location code {event_location_obj?.code}"
|
||||||
|
>
|
||||||
|
<span class="fas fa-barcode"></span>
|
||||||
|
{event_location_obj?.code ?? ''}
|
||||||
|
</span>
|
||||||
|
{/if}
|
||||||
|
</h4>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class:hidden={!$events_loc.pres_mgmt.show_content__location_description}
|
||||||
|
>
|
||||||
|
<Element_ae_crud
|
||||||
|
api_cfg={$ae_api}
|
||||||
|
object_type={'event_location'}
|
||||||
|
object_id={event_location_obj?.event_location_id_random}
|
||||||
|
field_name={'description'}
|
||||||
|
field_type={'textarea'}
|
||||||
|
field_value={event_location_obj?.description}
|
||||||
|
allow_null={false}
|
||||||
|
hide_edit_btn={!$ae_loc.trusted_access || !$ae_loc.edit_mode}
|
||||||
|
outline_element={false}
|
||||||
|
show_crud={false}
|
||||||
|
display_inline={true}
|
||||||
|
display_block_edit={true}
|
||||||
|
textarea_rows={15}
|
||||||
|
class_li={''}
|
||||||
|
on:ae_crud_updated={e => {
|
||||||
|
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});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<strong class="text-sm">
|
||||||
|
Description:
|
||||||
|
</strong>
|
||||||
|
|
||||||
|
{#if event_location_obj?.description}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
on:click={() => {
|
||||||
|
console.log('Show/Hide Description');
|
||||||
|
if ($events_sess.pres_mgmt.show_content__location_description == event_location_obj.event_location_id_random) {
|
||||||
|
$events_sess.pres_mgmt.show_content__location_description = null;
|
||||||
|
|
||||||
|
// Was testing with LiveQuery
|
||||||
|
$events_slct.event_location_id = null;
|
||||||
|
} else {
|
||||||
|
$events_sess.pres_mgmt.show_content__location_description = event_location_obj.event_location_id_random;
|
||||||
|
|
||||||
|
// Was testing with LiveQuery
|
||||||
|
$events_slct.event_location_id = event_location_obj.event_location_id_random;
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
class="btn btn-sm variant-soft-surface hover:variant-filled-surface text-xs"
|
||||||
|
>
|
||||||
|
{#if $events_sess.pres_mgmt.show_content__location_description == event_location_obj.event_location_id_random}
|
||||||
|
<span class="fas fa-eye-slash mx-1"></span>
|
||||||
|
<span>Hide Description</span>
|
||||||
|
{:else}
|
||||||
|
<span class="fas fa-eye mx-1"></span>
|
||||||
|
<span>Show</span>
|
||||||
|
{/if}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<pre
|
||||||
|
class="whitespace-pre-wrap p-2 bg-gray-100 rounded-md"
|
||||||
|
class:hidden={$events_sess.pres_mgmt.show_content__location_description !== event_location_obj.event_location_id_random}
|
||||||
|
>{event_location_obj.description}</pre>
|
||||||
|
|
||||||
|
{:else}
|
||||||
|
{@html ae_snip.html__not_set}
|
||||||
|
{/if}
|
||||||
|
<!-- {:else}
|
||||||
|
<div class="text-sm text-gray-500 bg-gray-100 p-1 rounded-md border border-gray-200"
|
||||||
|
class:hidden={!$ae_loc.administrator_access}
|
||||||
|
>
|
||||||
|
<span class="fas fa-exclamation-triangle mx-1"></span>
|
||||||
|
No description provided.
|
||||||
|
</div>
|
||||||
|
{/if} -->
|
||||||
|
</Element_ae_crud>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Show devices for this location -->
|
||||||
|
{#if event_location_obj?.event_location_id_random}
|
||||||
|
<Comp_event_device_obj_li
|
||||||
|
link_to_type={'event_location'}
|
||||||
|
link_to_id={event_location_obj?.event_location_id_random}
|
||||||
|
event_device_id_random_li={[]}
|
||||||
|
log_lvl={log_lvl}
|
||||||
|
>
|
||||||
|
</Comp_event_device_obj_li>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<!-- Show sessions for this location -->
|
||||||
|
<!-- {#if event_location_obj?.event_location_id_random}
|
||||||
|
<Comp_event_session_obj_li
|
||||||
|
link_to_type={'event_location'}
|
||||||
|
link_to_id={event_location_obj?.event_location_id_random}
|
||||||
|
event_session_id_random_li={[]}
|
||||||
|
log_lvl={log_lvl}
|
||||||
|
>
|
||||||
|
</Comp_event_session_obj_li>
|
||||||
|
{/if} -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Show files for this location -->
|
||||||
|
<!-- <Element_manage_event_file_li_wrap
|
||||||
|
link_to_type={'event_location'}
|
||||||
|
link_to_id={event_location_obj?.event_location_id_random}
|
||||||
|
allow_basic={$events_loc.trusted_access}
|
||||||
|
allow_moderator={$events_loc.trusted_access}
|
||||||
|
container_class_li={''}
|
||||||
|
/> -->
|
||||||
|
</li>
|
||||||
|
{/each}
|
||||||
|
</ul>
|
||||||
|
{:else}
|
||||||
|
<!-- <p class:hidden={display_mode != 'default'}>
|
||||||
|
No locations available to show at this time
|
||||||
|
</p> -->
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,137 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
// export let data: any;
|
||||||
|
export let log_lvl = 0;
|
||||||
|
|
||||||
|
import type { key_val } from '$lib/ae_stores';
|
||||||
|
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 Element_ae_crud from '$lib/element_ae_crud.svelte';
|
||||||
|
import Element_data_store from '$lib/element_data_store_v2.svelte';
|
||||||
|
|
||||||
|
// export let event_location_id: string;
|
||||||
|
export let lq__event_obj: any;
|
||||||
|
// export let lq__auth__event_presenter_obj: any;
|
||||||
|
|
||||||
|
let ae_tmp: key_val = {};
|
||||||
|
let ae_triggers: key_val = {};
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- New standard page specific menu 2024-08-01 -->
|
||||||
|
<div
|
||||||
|
class="pres_mgmt__location_menu {ae_snip.classes__events_pres_mgmt_menu}"
|
||||||
|
class:border-gray-100={!$events_loc.pres_mgmt.show_menu__location}
|
||||||
|
>
|
||||||
|
|
||||||
|
<!-- BEGIN: The menu button options -->
|
||||||
|
<div
|
||||||
|
class="flex flex-row flex-wrap gap-1 items-center justify-around w-full">
|
||||||
|
|
||||||
|
<span
|
||||||
|
class="ae_menu__navigation_options flex flex-row items-center justify-around"
|
||||||
|
>
|
||||||
|
<a href="/events/{$lq__event_obj?.event_id}" class="{ae_snip.classes__events_pres_mgmt_menu__button}">
|
||||||
|
<span class="fas fa-arrow-left m-1"></span>
|
||||||
|
Back to Session Search
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span
|
||||||
|
class="ae_menu__object_options flex flex-row items-center justify-around"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
on:click={() => {
|
||||||
|
if ($events_loc.pres_mgmt.show_menu__location == 'options') {
|
||||||
|
$events_loc.pres_mgmt.show_menu__location = null;
|
||||||
|
} else {
|
||||||
|
$events_loc.pres_mgmt.show_menu__location = 'options';
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
class="{ae_snip.classes__events_pres_mgmt_menu__button}"
|
||||||
|
class:variant-filled-secondary={$events_loc.pres_mgmt.show_menu__location == 'options'}
|
||||||
|
class:variant-glass-secondary={$events_loc.pres_mgmt.show_menu__location != 'options'}
|
||||||
|
class:hidden={!$ae_loc.trusted_access}
|
||||||
|
title="Options for the location"
|
||||||
|
>
|
||||||
|
<span class="fas fa-cog m-1"></span>
|
||||||
|
{#if $events_loc.pres_mgmt.show_menu__location == 'options'}
|
||||||
|
Hide
|
||||||
|
{:else}
|
||||||
|
Show
|
||||||
|
{/if}
|
||||||
|
Options?
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
on:click={() => {
|
||||||
|
if ($events_loc.pres_mgmt.show_menu__location == 'help') {
|
||||||
|
$events_loc.pres_mgmt.show_menu__location = null;
|
||||||
|
} else {
|
||||||
|
$events_loc.pres_mgmt.show_menu__location = 'help';
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
class="{ae_snip.classes__events_pres_mgmt_menu__button}"
|
||||||
|
class:variant-filled-secondary={$events_loc.pres_mgmt.show_menu__location == 'help'}
|
||||||
|
class:variant-glass-secondary={$events_loc.pres_mgmt.show_menu__location != 'help'}
|
||||||
|
title="Help and information about the location"
|
||||||
|
>
|
||||||
|
<span class="fas fa-question-circle m-1"></span>
|
||||||
|
{#if $events_loc.pres_mgmt.show_menu__location == 'help'}
|
||||||
|
Hide Help?
|
||||||
|
{:else}
|
||||||
|
Help?
|
||||||
|
{/if}
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</div> <!-- END: The menu button options -->
|
||||||
|
|
||||||
|
<!-- BEGIN: The expanded menu area for information and options -->
|
||||||
|
<div
|
||||||
|
class="flex flex-row items-center justify-around w-full bg-blue-100 hover:bg-blue-200 border border-blue-200 hover:border-blue-400 p-2 rounded-md"
|
||||||
|
class:hidden={$events_loc.pres_mgmt.show_menu__location != 'options'}
|
||||||
|
>
|
||||||
|
|
||||||
|
Not much here yet...
|
||||||
|
|
||||||
|
</div> <!-- END: The expanded menu area for information and options -->
|
||||||
|
|
||||||
|
|
||||||
|
<Element_data_store
|
||||||
|
ds_code="events__pres_mgmt__location_help"
|
||||||
|
ds_name="Default: Events - Pres Mgmt Session Help"
|
||||||
|
ds_type="html"
|
||||||
|
for_type="event"
|
||||||
|
for_id={$lq__event_obj?.event_id}
|
||||||
|
class_li="bg-yellow-100 border border-yellow-400 p-2 rounded-md max-w-xl"
|
||||||
|
show_edit={false}
|
||||||
|
show_edit_btn={true}
|
||||||
|
hide={$events_loc.pres_mgmt.show_menu__location != 'help'}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
on:click={() => {
|
||||||
|
$events_loc.pres_mgmt.show_menu__location = !$events_loc.pres_mgmt.show_menu__location;
|
||||||
|
}}
|
||||||
|
class="btn btn-sm mx-1 variant-ghost-error hover:variant-filled-error"
|
||||||
|
class:hidden={!$events_loc.pres_mgmt.show_menu__location}
|
||||||
|
title="Collapse the expanded menu"
|
||||||
|
>
|
||||||
|
<span class="fas fa-chevron-up m-1"></span>
|
||||||
|
{#if $events_loc.pres_mgmt.show_menu__location}
|
||||||
|
Hide
|
||||||
|
<!-- Collapse -->
|
||||||
|
{:else}
|
||||||
|
Show
|
||||||
|
{/if}
|
||||||
|
<!-- Menu? -->
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div> <!-- End of the new standard page specific menu -->
|
||||||
@@ -15,16 +15,17 @@ import { events_func } from '$lib/ae_events_functions';
|
|||||||
import { ae_util } from '$lib/ae_utils/ae_utils';
|
import { ae_util } from '$lib/ae_utils/ae_utils';
|
||||||
|
|
||||||
// Exports
|
// Exports
|
||||||
|
export let log_lvl: number = 0;
|
||||||
export let container_class_li: string|Array<string> = [];
|
export let container_class_li: string|Array<string> = [];
|
||||||
export let display_mode: string = 'default'; // 'default', 'compact', 'minimal', 'launcher'
|
export let display_mode: string = 'default'; // 'default', 'compact', 'minimal', 'launcher'
|
||||||
|
|
||||||
export let link_to_type: string;
|
export let link_to_type: string;
|
||||||
export let link_to_id: string;
|
export let link_to_id: string;
|
||||||
export let lq__event_presenter_obj_li: any;
|
export let lq__event_presenter_obj_li: any;
|
||||||
export let log_lvl: number = 0;
|
|
||||||
|
|
||||||
// if (log_lvl) {
|
if (log_lvl) {
|
||||||
// console.log(`link_to_type: ${link_to_type}; link_to_id: ${link_to_id}`);
|
console.log(`link_to_type: ${link_to_type}; link_to_id: ${link_to_id}`);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
// let ae_promises: key_val = {};
|
// let ae_promises: key_val = {};
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export let data: any;
|
// export let data: any;
|
||||||
|
|
||||||
import type { key_val } from '$lib/ae_stores';
|
import type { key_val } from '$lib/ae_stores';
|
||||||
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
||||||
@@ -12,8 +12,8 @@ import Comp__pres_mgmt_menu_nav from './ae_comp__events_menu_nav.svelte';
|
|||||||
|
|
||||||
export let lq__event_obj: any;
|
export let lq__event_obj: any;
|
||||||
|
|
||||||
let ae_tmp: key_val = {};
|
// let ae_tmp: key_val = {};
|
||||||
let ae_triggers: key_val = {};
|
// let ae_triggers: key_val = {};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -180,22 +180,6 @@ let ae_triggers: key_val = {};
|
|||||||
<select
|
<select
|
||||||
id="qry_limit__presenters"
|
id="qry_limit__presenters"
|
||||||
bind:value={$events_loc.pres_mgmt.qry_limit__presenters}
|
bind:value={$events_loc.pres_mgmt.qry_limit__presenters}
|
||||||
on:change={() => {
|
|
||||||
// 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__presenters,},
|
|
||||||
// try_cache: false,
|
|
||||||
// log_lvl: log_lvl,
|
|
||||||
// });
|
|
||||||
}}
|
|
||||||
class="select w-20 text-sm"
|
class="select w-20 text-sm"
|
||||||
>
|
>
|
||||||
<option value={25}>25</option>
|
<option value={25}>25</option>
|
||||||
@@ -219,22 +203,6 @@ let ae_triggers: key_val = {};
|
|||||||
<select
|
<select
|
||||||
id="qry_limit__sessions"
|
id="qry_limit__sessions"
|
||||||
bind:value={$events_loc.pres_mgmt.qry_limit__sessions}
|
bind:value={$events_loc.pres_mgmt.qry_limit__sessions}
|
||||||
on:change={() => {
|
|
||||||
// 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"
|
class="select w-20 text-sm"
|
||||||
>
|
>
|
||||||
<option value={25}>25</option>
|
<option value={25}>25</option>
|
||||||
@@ -258,22 +226,6 @@ let ae_triggers: key_val = {};
|
|||||||
<select
|
<select
|
||||||
id="qry_limit__files"
|
id="qry_limit__files"
|
||||||
bind:value={$events_loc.pres_mgmt.qry_limit__files}
|
bind:value={$events_loc.pres_mgmt.qry_limit__files}
|
||||||
on:change={() => {
|
|
||||||
// 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__files,},
|
|
||||||
// try_cache: false,
|
|
||||||
// log_lvl: log_lvl,
|
|
||||||
// });
|
|
||||||
}}
|
|
||||||
class="select w-20 text-sm"
|
class="select w-20 text-sm"
|
||||||
>
|
>
|
||||||
<option value={25}>25</option>
|
<option value={25}>25</option>
|
||||||
|
|||||||
@@ -15,11 +15,13 @@ import { events_loc, events_sess, events_slct, events_trigger, events_trig_kv }
|
|||||||
import { events_func } from '$lib/ae_events_functions';
|
import { events_func } from '$lib/ae_events_functions';
|
||||||
|
|
||||||
// Exports
|
// Exports
|
||||||
export let container_class_li: string|Array<string> = [];
|
|
||||||
// export let link_to_type: string;
|
|
||||||
// export let link_to_id: string;
|
|
||||||
export let lq__event_session_obj_li: any;
|
|
||||||
export let log_lvl: number = 0;
|
export let log_lvl: number = 0;
|
||||||
|
export let container_class_li: string|Array<string> = [];
|
||||||
|
// export let display_mode: string = 'default'; // 'default', 'compact', 'minimal', 'launcher'
|
||||||
|
|
||||||
|
export let link_to_type: null|string;
|
||||||
|
export let link_to_id: null|string;
|
||||||
|
export let lq__event_session_obj_li: any;
|
||||||
|
|
||||||
export let hide__session_location: boolean = false;
|
export let hide__session_location: boolean = false;
|
||||||
export let hide__session_poc: boolean = false;
|
export let hide__session_poc: boolean = false;
|
||||||
@@ -31,7 +33,9 @@ export let show__session_presentations: boolean = false;
|
|||||||
// export let allow_basic: boolean = false;
|
// export let allow_basic: boolean = false;
|
||||||
// export let allow_moderator: boolean = false;
|
// export let allow_moderator: boolean = false;
|
||||||
|
|
||||||
// export let display_mode: string = 'default'; // 'default', 'compact', 'minimal', 'launcher'
|
if (log_lvl) {
|
||||||
|
console.log(`link_to_type: ${link_to_type}; link_to_id: ${link_to_id}`);
|
||||||
|
}
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
// let ae_promises: key_val = {};
|
// let ae_promises: key_val = {};
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
// Imports
|
||||||
|
import Comp_event_session_obj_li from './ae_comp__event_session_obj_li.svelte';
|
||||||
|
|
||||||
|
import { liveQuery } from "dexie";
|
||||||
|
import { db_events } from "$lib/db_events";
|
||||||
|
|
||||||
|
// Exports
|
||||||
|
export let container_class_li: string|Array<string> = [];
|
||||||
|
// export let display_mode: string = 'default'; // 'default', 'compact', 'minimal', 'launcher'
|
||||||
|
export let event_session_id_random_li: Array<string> = [];
|
||||||
|
export let link_to_type: string;
|
||||||
|
export let link_to_id: string;
|
||||||
|
export let log_lvl: number = 0;
|
||||||
|
|
||||||
|
if (log_lvl) {
|
||||||
|
console.log(`link_to_type: ${link_to_type}; link_to_id: ${link_to_id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Variables
|
||||||
|
// let ae_promises: key_val = {};
|
||||||
|
// let ae_tmp: key_val = {};
|
||||||
|
// let ae_triggers: key_val = {};
|
||||||
|
|
||||||
|
let dq__where_type_id_val: string = `${link_to_type}_id_random`;
|
||||||
|
let dq__where_eq_id_val: string = link_to_id;
|
||||||
|
|
||||||
|
// Functions and Logic
|
||||||
|
$: lq__event_session_obj_li = liveQuery(async () => {
|
||||||
|
if (link_to_type && link_to_id) {
|
||||||
|
let results = await db_events.sessions
|
||||||
|
.where(dq__where_type_id_val)
|
||||||
|
.equals(dq__where_eq_id_val)
|
||||||
|
.sortBy('name')
|
||||||
|
|
||||||
|
return results;
|
||||||
|
} else if (event_session_id_random_li.length > 0) {
|
||||||
|
let results = await db_events.sessions
|
||||||
|
.bulkGet(event_session_id_random_li);
|
||||||
|
|
||||||
|
return results;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<Comp_event_session_obj_li
|
||||||
|
container_class_li={container_class_li}
|
||||||
|
link_to_type={link_to_type}
|
||||||
|
link_to_id={link_to_id}
|
||||||
|
lq__event_session_obj_li={lq__event_session_obj_li}
|
||||||
|
log_lvl={log_lvl}
|
||||||
|
>
|
||||||
|
</Comp_event_session_obj_li>
|
||||||
Reference in New Issue
Block a user