A lot of code clean up. Also making things look better.

This commit is contained in:
Scott Idem
2024-06-28 17:56:39 -04:00
parent 9f7a19c4b9
commit acaff7634d
10 changed files with 800 additions and 785 deletions

View File

@@ -34,6 +34,14 @@ export type key_val = {
}; };
// export type key_val = key_val; // export type key_val = key_val;
import { html__not_set } from './ae_string_snippets';
export let ae_html =
{
'not_set': html__not_set,
};
// *** BEGIN *** Longer-term app data. This should be stored to local storage. // *** BEGIN *** Longer-term app data. This should be stored to local storage.
export let ae_app_local_data_struct: key_val = { export let ae_app_local_data_struct: key_val = {
'ver': '2024-06-26_13', 'ver': '2024-06-26_13',

View File

@@ -0,0 +1,13 @@
// These are shared snippets of text, This is mostly HTML and CSS.
let html__not_set = `
<span
class="text-sm text-gray-500 bg-gray-100 p-1 rounded-md border border-gray-200"
>-- not set --
</span>
`;
export {
html__not_set,
};

View File

@@ -1,4 +1,7 @@
import dayjs from 'dayjs'; // Import external files first. Eventually this will be broken up in to smaller files.
import { process_permission_checks } from './ae_utils__perm_checks';
import { iso_datetime_formatter } from './ae_utils__datetime_format';
type key_str = { type key_str = {
[key: string]: string; [key: string]: string;
@@ -8,135 +11,6 @@ type key_val = {
[key: string]: any; [key: string]: any;
}; };
export let iso_datetime_formatter = function iso_datetime_formatter(
raw_datetime: null|string|Date = null,
named_format: string = 'datetime_iso_no_seconds', // date_iso, datetime_iso_no_seconds
) {
// console.log('*** iso_datetime_formatter() ***');
// https://en.wikipedia.org/wiki/ISO_8601
// https://day.js.org/docs/en/display/format
// ISO 8601-1:2019 includes the T before the time portion
// ISO 8601-1:2019 midnight may only be referred to as "00:00", corresponding to the beginning of a calendar day
// and "24:00" is no longer allowed corresponding to the end of a day
// 60 is only used to denote an added leap second
// ISO 8601 UTC: 2021-03-04T19:04:44+00:00
// ISO 8601 UTC: 2021-03-04T19:04:44Z
// ISO 8601 UTC: 20210304T190444Z
//datetime_iso 'YYYY-MM-DD HH:mm:ss'
//datetime_iso_12 'YYYY-MM-DD hh:mm:ss A'
//datetime_iso_12_short 'YY-MM-DD hh:mm A'
//datetime_iso_tz 'YYYY-MM-DD HH:mm:ss'
//datetime_long 'dddd, MMMM D, YYYY hh:mm:ss A'
//datetime_medium 'ddd, MMM D, YYYY hh:mm:ss A'
//datetime_short 'MMM D, YY hh:mm A'
//date_iso 'YYYY-MM-DD'
//date_long 'dddd, MMMM D, YYYY'
//date_medium 'ddd, MMM D, YYYY'
//date_short 'MMM D, YY'
//time_iso 'HH:mm:ss'
//time_iso_12 'hh:mm:ss A'
//time_long 'hh:mm:ss A'
//time_medium 'h:m:s A'
//time_short 'hh:mm A'
//dayjs(raw_datetime).format('dddd, MMMM D, YYYY hh:mm:ss A');
if (!raw_datetime) {
raw_datetime = new Date(); // Get the current datetime if one was not passed.
}
let datetime_string = null;
switch (named_format) {
case 'datetime_iso':
datetime_string = dayjs(raw_datetime).format('YYYY-MM-DD HH:mm:ss');
break;
case 'datetime_iso_no_seconds':
datetime_string = dayjs(raw_datetime).format('YYYY-MM-DD HH:mm');
break;
case 'datetime_iso_12_short':
datetime_string = dayjs(raw_datetime).format('YY-MM-DD hh:mm A');
break;
case 'datetime_iso_12_short_month':
datetime_string = dayjs(raw_datetime).format('MM-DD hh:mm A');
break;
case 'datetime_short':
datetime_string = dayjs(raw_datetime).format('MMM D, YY hh:mm A');
break;
case 'datetime_medium':
datetime_string = dayjs(raw_datetime).format('MMM D, YYYY h:mm A');
break;
case 'datetime_long':
datetime_string = dayjs(raw_datetime).format('MMMM D, YYYY hh:mm A');
break;
case 'datetime_short_month':
datetime_string = dayjs(raw_datetime).format('MMM D hh:mm A');
break;
case 'datetime_long_month':
datetime_string = dayjs(raw_datetime).format('MMMM D hh:mm A');
break;
case 'datetime_short_day':
datetime_string = dayjs(raw_datetime).format('D hh:mm A');
break;
case 'date_iso':
datetime_string = dayjs(raw_datetime).format('YYYY-MM-DD');
break;
case 'date_long_month_day':
datetime_string = dayjs(raw_datetime).format('MMMM D');
break;
case 'date_short':
datetime_string = dayjs(raw_datetime).format('MMM D, YY');
break;
case 'date_short_no_year':
datetime_string = dayjs(raw_datetime).format('MMM D');
break;
case 'date_long':
datetime_string = dayjs(raw_datetime).format('MMMM D, YYYY');
break;
case 'date_full':
datetime_string = dayjs(raw_datetime).format('dddd, MMMM D, YYYY');
break;
case 'date_full_no_year':
datetime_string = dayjs(raw_datetime).format('dddd, MMMM D');
break;
case 'time_iso':
datetime_string = dayjs(raw_datetime).format('HH:mm:ss');
break;
case 'time_long':
datetime_string = dayjs(raw_datetime).format('hh:mm:ss A');
break;
case 'time_short':
datetime_string = dayjs(raw_datetime).format('hh:mm A');
break;
case 'time_short_no_leading':
datetime_string = dayjs(raw_datetime).format('h:mm A');
break;
case 'week_long':
datetime_string = dayjs(raw_datetime).format('dddd');
break;
case 'week_medium':
datetime_string = dayjs(raw_datetime).format('ddd');
break;
case 'week_short':
datetime_string = dayjs(raw_datetime).format('dd');
break;
default:
console.log(`The named format passed (${named_format}) did not match a common name. Trying to format with the named format value.`);
datetime_string = dayjs(raw_datetime).format(named_format);
// datetime_string = dayjs(raw_datetime).format('YYYY-MM-DD HH:mm:ss');
}
return datetime_string;
}
function format_bytes( function format_bytes(
bytes: number, bytes: number,
decimals: number = 2 decimals: number = 2
@@ -282,11 +156,16 @@ export let extract_prefixed_form_data = function extract_prefixed_form_data({pre
* em: Email Address * em: Email Address
*/ */
// Updated 2022-02-11 // Updated 2022-02-11
export let process_data_string = function process_data_string(data_string) { export let process_data_string = function process_data_string(data_string: string) {
console.log('*** process_data_string() ***'); console.log('*** process_data_string() ***');
// console.log(data_string); // console.log(data_string);
let obj = {}; if (!data_string || data_string.length < 1) {
console.log('No data string found.');
return false;
}
let obj: key_val = {};
let colon_index = data_string.indexOf(':') let colon_index = data_string.indexOf(':')
if (colon_index) { if (colon_index) {
@@ -354,172 +233,6 @@ export let process_data_string = function process_data_string(data_string) {
} }
// NOTE: I know there is a better more efficient way to do this, but I don't have time for that right now.
export let process_permission_checks = function process_permission_checks(access_type: string) {
// let access_checks = { 'access_type': null, 'super_check': null };
let access_checks: key_val = {};
if (access_type == 'super') {
access_checks.access_type = 'super';
access_checks.super_check = true;
access_checks.manager_check = false;
access_checks.administrator_check = false;
access_checks.support_check = false;
access_checks.assistant_check = false;
access_checks.trusted_check = false;
access_checks.verified_check = false;
access_checks.provisional_check = false;
access_checks.public_check = false;
access_checks.authenticated_check = true;
access_checks.anonymous_check = false;
access_checks.super_access = true;
access_checks.manager_access = true;
access_checks.administrator_access = true;
access_checks.support_access = true;
access_checks.assistant_access = true;
access_checks.trusted_access = true;
access_checks.verified_access = true;
access_checks.provisional_access = true;
access_checks.public_access = true;
access_checks.authenticated_access = true;
access_checks.anonymous_access = true;
} else if (access_type == 'manager') {
access_checks.access_type = 'manager';
access_checks.super_check = false;
access_checks.manager_check = true;
access_checks.administrator_check = false;
access_checks.support_check = false;
access_checks.assistant_check = false;
access_checks.trusted_check = false;
access_checks.verified_check = false;
access_checks.provisional_check = false;
access_checks.public_check = false;
access_checks.authenticated_check = true;
access_checks.anonymous_check = false;
access_checks.super_access = false;
access_checks.manager_access = true;
access_checks.administrator_access = true;
access_checks.support_access = true;
access_checks.assistant_access = true;
access_checks.trusted_access = true;
access_checks.verified_access = true;
access_checks.provisional_access = true;
access_checks.public_access = true;
access_checks.authenticated_access = true;
access_checks.anonymous_access = true;
} else if (access_type == 'administrator') {
access_checks.access_type = 'administrator';
access_checks.super_check = false;
access_checks.manager_check = false;
access_checks.administrator_check = true;
access_checks.support_check = false;
access_checks.assistant_check = false;
access_checks.trusted_check = false;
access_checks.verified_check = false;
access_checks.provisional_check = false;
access_checks.public_check = false;
access_checks.authenticated_check = false;
access_checks.anonymous_check = false;
access_checks.super_access = false;
access_checks.manager_access = false;
access_checks.administrator_access = true;
access_checks.support_access = true;
access_checks.assistant_access = true;
access_checks.trusted_access = true;
access_checks.verified_access = true;
access_checks.provisional_access = true;
access_checks.public_access = true;
access_checks.authenticated_access = true;
access_checks.anonymous_access = true;
} else if (access_type == 'trusted') {
access_checks.access_type = 'trusted';
access_checks.super_check = false;
access_checks.manager_check = false;
access_checks.administrator_check = false;
access_checks.support_check = false;
access_checks.assistant_check = false;
access_checks.trusted_check = true;
access_checks.verified_check = false;
access_checks.provisional_check = false;
access_checks.public_check = false;
access_checks.authenticated_check = true;
access_checks.anonymous_check = false;
access_checks.super_access = false;
access_checks.manager_access = false;
access_checks.administrator_access = false;
access_checks.support_access = false;
access_checks.assistant_access = false;
access_checks.trusted_access = true;
access_checks.verified_access = true;
access_checks.provisional_access = true;
access_checks.public_access = true;
access_checks.authenticated_access = true;
access_checks.anonymous_access = true;
} else if (access_type == 'authenticated') {
access_checks.access_type = 'authenticated';
access_checks.super_check = false;
access_checks.manager_check = false;
access_checks.administrator_check = false;
access_checks.support_check = false;
access_checks.assistant_check = false;
access_checks.trusted_check = false;
access_checks.verified_check = false;
access_checks.provisional_check = false;
access_checks.public_check = false;
access_checks.authenticated_check = true;
access_checks.anonymous_check = false;
access_checks.super_access = false;
access_checks.manager_access = false;
access_checks.administrator_access = false;
access_checks.support_access = false;
access_checks.assistant_access = false;
access_checks.trusted_access = false;
access_checks.verified_access = false;
access_checks.provisional_access = false;
access_checks.public_access = false;
access_checks.authenticated_access = true;
access_checks.anonymous_access = true;
} else {
access_checks.access_type = 'anonymous';
access_checks.super_check = false;
access_checks.manager_check = false;
access_checks.administrator_check = false;
access_checks.support_check = false;
access_checks.assistant_check = false;
access_checks.trusted_check = false;
access_checks.verified_check = false;
access_checks.provisional_check = false;
access_checks.public_check = false;
access_checks.authenticated_check = false;
access_checks.anonymous_check = true;
access_checks.super_access = false;
access_checks.manager_access = false;
access_checks.administrator_access = false;
access_checks.support_access = false;
access_checks.assistant_access = false;
access_checks.trusted_access = false;
access_checks.verified_access = false;
access_checks.provisional_access = false;
access_checks.public_access = false;
access_checks.authenticated_access = false;
access_checks.anonymous_access = true;
}
return access_checks;
}
// This function will update the URL and send a message to the parent window (iframe). // This function will update the URL and send a message to the parent window (iframe).
// The name should be something like "example_id". // The name should be something like "example_id".
@@ -1006,14 +719,13 @@ function return_obj_type_path({obj_type=null, obj_type_prop_name=null}) {
export let ae_util = { export let ae_util = {
process_permission_checks: process_permission_checks,
iso_datetime_formatter: iso_datetime_formatter, iso_datetime_formatter: iso_datetime_formatter,
format_bytes: format_bytes, format_bytes: format_bytes,
number_w_commas: number_w_commas, number_w_commas: number_w_commas,
extract_prefixed_form_data: extract_prefixed_form_data, extract_prefixed_form_data: extract_prefixed_form_data,
process_data_string: process_data_string, process_data_string: process_data_string,
process_permission_checks: process_permission_checks,
handle_url_and_message: handle_url_and_message, handle_url_and_message: handle_url_and_message,
create_a_element: create_a_element, create_a_element: create_a_element,
create_img_element: create_img_element, create_img_element: create_img_element,
@@ -1026,4 +738,3 @@ export let ae_util = {
set_obj_prop_display_name: set_obj_prop_display_name, set_obj_prop_display_name: set_obj_prop_display_name,
return_obj_type_path: return_obj_type_path, return_obj_type_path: return_obj_type_path,
}; };
// export default ae_util;

View File

@@ -0,0 +1,129 @@
import dayjs from 'dayjs';
export let iso_datetime_formatter = function iso_datetime_formatter(
raw_datetime: null|string|Date = null,
named_format: string = 'datetime_iso_no_seconds', // date_iso, datetime_iso_no_seconds
) {
// console.log('*** iso_datetime_formatter() ***');
// https://en.wikipedia.org/wiki/ISO_8601
// https://day.js.org/docs/en/display/format
// ISO 8601-1:2019 includes the T before the time portion
// ISO 8601-1:2019 midnight may only be referred to as "00:00", corresponding to the beginning of a calendar day
// and "24:00" is no longer allowed corresponding to the end of a day
// 60 is only used to denote an added leap second
// ISO 8601 UTC: 2021-03-04T19:04:44+00:00
// ISO 8601 UTC: 2021-03-04T19:04:44Z
// ISO 8601 UTC: 20210304T190444Z
//datetime_iso 'YYYY-MM-DD HH:mm:ss'
//datetime_iso_12 'YYYY-MM-DD hh:mm:ss A'
//datetime_iso_12_short 'YY-MM-DD hh:mm A'
//datetime_iso_tz 'YYYY-MM-DD HH:mm:ss'
//datetime_long 'dddd, MMMM D, YYYY hh:mm:ss A'
//datetime_medium 'ddd, MMM D, YYYY hh:mm:ss A'
//datetime_short 'MMM D, YY hh:mm A'
//date_iso 'YYYY-MM-DD'
//date_long 'dddd, MMMM D, YYYY'
//date_medium 'ddd, MMM D, YYYY'
//date_short 'MMM D, YY'
//time_iso 'HH:mm:ss'
//time_iso_12 'hh:mm:ss A'
//time_long 'hh:mm:ss A'
//time_medium 'h:m:s A'
//time_short 'hh:mm A'
//dayjs(raw_datetime).format('dddd, MMMM D, YYYY hh:mm:ss A');
if (!raw_datetime) {
raw_datetime = new Date(); // Get the current datetime if one was not passed.
}
let datetime_string = null;
switch (named_format) {
case 'datetime_iso':
datetime_string = dayjs(raw_datetime).format('YYYY-MM-DD HH:mm:ss');
break;
case 'datetime_iso_no_seconds':
datetime_string = dayjs(raw_datetime).format('YYYY-MM-DD HH:mm');
break;
case 'datetime_iso_12_short':
datetime_string = dayjs(raw_datetime).format('YY-MM-DD hh:mm A');
break;
case 'datetime_iso_12_short_month':
datetime_string = dayjs(raw_datetime).format('MM-DD hh:mm A');
break;
case 'datetime_short':
datetime_string = dayjs(raw_datetime).format('MMM D, YY hh:mm A');
break;
case 'datetime_medium':
datetime_string = dayjs(raw_datetime).format('MMM D, YYYY h:mm A');
break;
case 'datetime_long':
datetime_string = dayjs(raw_datetime).format('MMMM D, YYYY hh:mm A');
break;
case 'datetime_short_month':
datetime_string = dayjs(raw_datetime).format('MMM D hh:mm A');
break;
case 'datetime_long_month':
datetime_string = dayjs(raw_datetime).format('MMMM D hh:mm A');
break;
case 'datetime_short_day':
datetime_string = dayjs(raw_datetime).format('D hh:mm A');
break;
case 'date_iso':
datetime_string = dayjs(raw_datetime).format('YYYY-MM-DD');
break;
case 'date_long_month_day':
datetime_string = dayjs(raw_datetime).format('MMMM D');
break;
case 'date_short':
datetime_string = dayjs(raw_datetime).format('MMM D, YY');
break;
case 'date_short_no_year':
datetime_string = dayjs(raw_datetime).format('MMM D');
break;
case 'date_long':
datetime_string = dayjs(raw_datetime).format('MMMM D, YYYY');
break;
case 'date_full':
datetime_string = dayjs(raw_datetime).format('dddd, MMMM D, YYYY');
break;
case 'date_full_no_year':
datetime_string = dayjs(raw_datetime).format('dddd, MMMM D');
break;
case 'time_iso':
datetime_string = dayjs(raw_datetime).format('HH:mm:ss');
break;
case 'time_long':
datetime_string = dayjs(raw_datetime).format('hh:mm:ss A');
break;
case 'time_short':
datetime_string = dayjs(raw_datetime).format('hh:mm A');
break;
case 'time_short_no_leading':
datetime_string = dayjs(raw_datetime).format('h:mm A');
break;
case 'week_long':
datetime_string = dayjs(raw_datetime).format('dddd');
break;
case 'week_medium':
datetime_string = dayjs(raw_datetime).format('ddd');
break;
case 'week_short':
datetime_string = dayjs(raw_datetime).format('dd');
break;
default:
console.log(`The named format passed (${named_format}) did not match a common name. Trying to format with the named format value.`);
datetime_string = dayjs(raw_datetime).format(named_format);
// datetime_string = dayjs(raw_datetime).format('YYYY-MM-DD HH:mm:ss');
}
return datetime_string;
}

View File

@@ -0,0 +1,169 @@
type key_val = {
[key: string]: any;
};
// NOTE: I know there is a better more efficient way to do this, but I don't have time for that right now.
export let process_permission_checks = function process_permission_checks(access_type: string) {
// let access_checks = { 'access_type': null, 'super_check': null };
let access_checks: key_val = {};
if (access_type == 'super') {
access_checks.access_type = 'super';
access_checks.super_check = true;
access_checks.manager_check = false;
access_checks.administrator_check = false;
access_checks.support_check = false;
access_checks.assistant_check = false;
access_checks.trusted_check = false;
access_checks.verified_check = false;
access_checks.provisional_check = false;
access_checks.public_check = false;
access_checks.authenticated_check = true;
access_checks.anonymous_check = false;
access_checks.super_access = true;
access_checks.manager_access = true;
access_checks.administrator_access = true;
access_checks.support_access = true;
access_checks.assistant_access = true;
access_checks.trusted_access = true;
access_checks.verified_access = true;
access_checks.provisional_access = true;
access_checks.public_access = true;
access_checks.authenticated_access = true;
access_checks.anonymous_access = true;
} else if (access_type == 'manager') {
access_checks.access_type = 'manager';
access_checks.super_check = false;
access_checks.manager_check = true;
access_checks.administrator_check = false;
access_checks.support_check = false;
access_checks.assistant_check = false;
access_checks.trusted_check = false;
access_checks.verified_check = false;
access_checks.provisional_check = false;
access_checks.public_check = false;
access_checks.authenticated_check = true;
access_checks.anonymous_check = false;
access_checks.super_access = false;
access_checks.manager_access = true;
access_checks.administrator_access = true;
access_checks.support_access = true;
access_checks.assistant_access = true;
access_checks.trusted_access = true;
access_checks.verified_access = true;
access_checks.provisional_access = true;
access_checks.public_access = true;
access_checks.authenticated_access = true;
access_checks.anonymous_access = true;
} else if (access_type == 'administrator') {
access_checks.access_type = 'administrator';
access_checks.super_check = false;
access_checks.manager_check = false;
access_checks.administrator_check = true;
access_checks.support_check = false;
access_checks.assistant_check = false;
access_checks.trusted_check = false;
access_checks.verified_check = false;
access_checks.provisional_check = false;
access_checks.public_check = false;
access_checks.authenticated_check = false;
access_checks.anonymous_check = false;
access_checks.super_access = false;
access_checks.manager_access = false;
access_checks.administrator_access = true;
access_checks.support_access = true;
access_checks.assistant_access = true;
access_checks.trusted_access = true;
access_checks.verified_access = true;
access_checks.provisional_access = true;
access_checks.public_access = true;
access_checks.authenticated_access = true;
access_checks.anonymous_access = true;
} else if (access_type == 'trusted') {
access_checks.access_type = 'trusted';
access_checks.super_check = false;
access_checks.manager_check = false;
access_checks.administrator_check = false;
access_checks.support_check = false;
access_checks.assistant_check = false;
access_checks.trusted_check = true;
access_checks.verified_check = false;
access_checks.provisional_check = false;
access_checks.public_check = false;
access_checks.authenticated_check = true;
access_checks.anonymous_check = false;
access_checks.super_access = false;
access_checks.manager_access = false;
access_checks.administrator_access = false;
access_checks.support_access = false;
access_checks.assistant_access = false;
access_checks.trusted_access = true;
access_checks.verified_access = true;
access_checks.provisional_access = true;
access_checks.public_access = true;
access_checks.authenticated_access = true;
access_checks.anonymous_access = true;
} else if (access_type == 'authenticated') {
access_checks.access_type = 'authenticated';
access_checks.super_check = false;
access_checks.manager_check = false;
access_checks.administrator_check = false;
access_checks.support_check = false;
access_checks.assistant_check = false;
access_checks.trusted_check = false;
access_checks.verified_check = false;
access_checks.provisional_check = false;
access_checks.public_check = false;
access_checks.authenticated_check = true;
access_checks.anonymous_check = false;
access_checks.super_access = false;
access_checks.manager_access = false;
access_checks.administrator_access = false;
access_checks.support_access = false;
access_checks.assistant_access = false;
access_checks.trusted_access = false;
access_checks.verified_access = false;
access_checks.provisional_access = false;
access_checks.public_access = false;
access_checks.authenticated_access = true;
access_checks.anonymous_access = true;
} else {
access_checks.access_type = 'anonymous';
access_checks.super_check = false;
access_checks.manager_check = false;
access_checks.administrator_check = false;
access_checks.support_check = false;
access_checks.assistant_check = false;
access_checks.trusted_check = false;
access_checks.verified_check = false;
access_checks.provisional_check = false;
access_checks.public_check = false;
access_checks.authenticated_check = false;
access_checks.anonymous_check = true;
access_checks.super_access = false;
access_checks.manager_access = false;
access_checks.administrator_access = false;
access_checks.support_access = false;
access_checks.assistant_access = false;
access_checks.trusted_access = false;
access_checks.verified_access = false;
access_checks.provisional_access = false;
access_checks.public_access = false;
access_checks.authenticated_access = false;
access_checks.anonymous_access = true;
}
return access_checks;
}

View File

@@ -24,6 +24,7 @@ export let field_type: string = 'text'; // button, text, textarea, template (old
export let field_value: any; export let field_value: any;
export let allow_null: boolean = false; export let allow_null: boolean = false;
export let select_option_li: key_val = {}; export let select_option_li: key_val = {};
export let val_empty_is_null: boolean = false; // This was added to help with a select option list. If the value is empty (''), it will be set to null.
export let edit_label: string = 'Edit'; export let edit_label: string = 'Edit';
export let display_inline: boolean = false; export let display_inline: boolean = false;
export let display_block_edit: boolean = false; export let display_block_edit: boolean = false;
@@ -78,6 +79,11 @@ async function handle_obj_field_patch(new_field_value: any) {
patch_result = null; patch_result = null;
// This was added to help with a select option list. If the value is empty (''), it will be set to null.
if (val_empty_is_null && new_field_value == '') {
new_field_value = null;
}
// NOTE: Is this needed? The field_name, field_value, and fields parameters for update_ae_obj_id_crud() already take care of the data portion. They are added to data_list object as part of the JSON request. // NOTE: Is this needed? The field_name, field_value, and fields parameters for update_ae_obj_id_crud() already take care of the data portion. They are added to data_list object as part of the JSON request.
// NOTE: Currently this only handles one field and value at a time. This may need to be changed in the future to use the "fields" parameter as well. // NOTE: Currently this only handles one field and value at a time. This may need to be changed in the future to use the "fields" parameter as well.
// let patch_data = {} // let patch_data = {}

View File

@@ -72,8 +72,17 @@ onMount(() => {
Refresh Files Refresh Files
</button> </button>
<h3 class="h4"> <h3
Manage Files: {$lq__event_file_obj_li ? `${$lq__event_file_obj_li.length}x` : '-- none --'} class="h6"
class:hidden={!$lq__event_file_obj_li?.length}
>
Manage Files:
<span class="font-bold bg-success-100 px-4 border rounded-lg border-success-200"
title="Files for {link_to_type ?? '-- not set --'} {link_to_id ?? '-- not set --'}: {$events_slct.session_obj_li.length ?? 'None'}"
>
<span class="fas fa-folder-open mx-1"></span>
{$lq__event_file_obj_li ? `${$lq__event_file_obj_li.length}x` : '-- none --'}
</span>
</h3> </h3>
{#if $lq__event_file_obj_li && $lq__event_file_obj_li.length} {#if $lq__event_file_obj_li && $lq__event_file_obj_li.length}
@@ -250,7 +259,7 @@ onMount(() => {
// ae_triggers.update_event_file_purpose = true; // ae_triggers.update_event_file_purpose = true;
}} }}
class="select min-w-fit max-w-fit text-sm mx-1" class="select min-w-fit max-w-fit text-sm mx-1 border border-gray-300 rounded-md p-1 hover:border-gray-400"
> >
<option value={null} selected={!event_file_obj.file_purpose} class="text-xs">-- purpose not set --</option> <option value={null} selected={!event_file_obj.file_purpose} class="text-xs">-- purpose not set --</option>
<option value="outline" selected={event_file_obj.file_purpose === 'outline'}>1. Outline</option> <option value="outline" selected={event_file_obj.file_purpose === 'outline'}>1. Outline</option>

View File

@@ -17,7 +17,7 @@ import Element_data_store from '$lib/element_data_store.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_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores'; import { ae_html, 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';
@@ -432,7 +432,7 @@ function handle_search__event_session(search_str: string) {
{ae_util.iso_datetime_formatter(session_obj.end_datetime,'time_short')} {ae_util.iso_datetime_formatter(session_obj.end_datetime,'time_short')}
</span> </span>
{:else} {:else}
-- not set -- {@html ae_html.not_set}
{/if} {/if}
</td> </td>
<td>{session_obj.event_location_name ?? '-- not set --'}</td> <td>{session_obj.event_location_name ?? '-- not set --'}</td>
@@ -452,7 +452,7 @@ function handle_search__event_session(search_str: string) {
</span> </span>
{/if} {/if}
{:else} {:else}
-- not set -- {@html ae_html.not_set}
{/if} {/if}
{#if $ae_loc.trusted_access} {#if $ae_loc.trusted_access}

View File

@@ -20,7 +20,7 @@ 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_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores'; import { ae_html, 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';
@@ -28,6 +28,11 @@ import Form_agree from './form_agree.svelte';
import Presenter_view from './presenter_view.svelte'; import Presenter_view from './presenter_view.svelte';
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 { browser } from '$app/environment';
if (browser) {
console.log('Browser environment detected.');
}
// 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);
@@ -103,8 +108,20 @@ let lq__event_session_obj = liveQuery(
() => db_events.sessions.get($events_slct.event_session_id) () => db_events.sessions.get($events_slct.event_session_id)
); );
let lq__event_presentation_obj_li = liveQuery( let lq__event_presentation_obj_li = liveQuery(
() => db_events.presentations.where('event_session_id_random').equals($events_slct.event_session_id_random).toArray() () => db_events.presentations
// .where({event_session_id_random: $events_slct.event_session_id})
.where('event_session_id_random')
.equals($events_slct.event_session_id)
.sortBy('name')
// This works, but does it need to be async?
// async () => await db_events.presentations
// .where('event_session_id_random')
// .equals($events_slct.event_session_id)
// .sortBy('name')
); );
let lq__event_presentation_obj = liveQuery( let lq__event_presentation_obj = liveQuery(
@@ -114,8 +131,20 @@ let lq__event_presentation_obj = liveQuery(
let lq__event_presenter_obj = liveQuery( let lq__event_presenter_obj = liveQuery(
() => db_events.presenters.get($events_slct.event_presenter_id) () => db_events.presenters.get($events_slct.event_presenter_id)
); );
// $events_slct.event_presenter_obj = $lq__event_presenter_obj;
$events_slct.event_presenter_obj = $lq__event_presenter_obj; // We will filter out the presenters based on the presentation ID when they are rendered below.
let lq__event_presenter_obj_li = liveQuery(
() => db_events.presenters
.where('event_session_id_random')
.equals($events_slct.event_session_id)
// Why does the slct presentation ID not seem to work?
// .where('event_presentation_id_random')
// .equals($events_slct.event_presentation_id)
// .equals($events_slct.event_presentation_id?? '')
.sortBy('full_name')
);
let lq__event_file_obj_li = liveQuery( let lq__event_file_obj_li = liveQuery(
() => db_events.files.where('event_session_id_random').equals($events_slct.event_session_id).toArray() () => db_events.files.where('event_session_id_random').equals($events_slct.event_session_id).toArray()
@@ -158,6 +187,8 @@ $slct.person_obj_kv = {}; // This is intended for the POC lookup list when gener
onMount(() => { onMount(() => {
console.log('Events Session [slug]: +page.svelte'); console.log('Events Session [slug]: +page.svelte');
console.log(`onMount - lq__event_presentation_obj:`, $lq__event_presentation_obj_li);
// console.log(`ae_events_pres_mgmt presenter [slug] +page.svelte data:`, data); // console.log(`ae_events_pres_mgmt presenter [slug] +page.svelte data:`, data);
// if (!$events_slct.event_id) { // if (!$events_slct.event_id) {
@@ -340,6 +371,8 @@ function send_init_confirm_email(
) { ) {
console.log(`*** send_init_confirm_email() *** to ${to_email}.`); console.log(`*** send_init_confirm_email() *** to ${to_email}.`);
// let new_passcode = Math.floor(Math.random() * 900000) + 100000
// to_email = 'test+agree@oneskyit.com'; // to_email = 'test+agree@oneskyit.com';
let sign_in_url = encodeURI(`${data.url.origin}/events_pres_mgmt/session/${$events_slct.event_session_id}?person_id=${person_id}&person_pass=${person_passcode}&presentation_id=${presentation_id}&presenter_id=${presenter_id}`) let sign_in_url = encodeURI(`${data.url.origin}/events_pres_mgmt/session/${$events_slct.event_session_id}?person_id=${person_id}&person_pass=${person_passcode}&presentation_id=${presentation_id}&presenter_id=${presenter_id}`)
@@ -365,7 +398,7 @@ function send_init_confirm_email(
api.send_email({ api.send_email({
api_cfg: $ae_api, api_cfg: $ae_api,
from_email: 'noreply+agree@oneskyit.com', from_email: 'noreply+presmgmt@oneskyit.com',
from_name: 'LCI 2024 Pres Mgmt Hub', from_name: 'LCI 2024 Pres Mgmt Hub',
to_email: to_email, to_email: to_email,
subject: subject, subject: subject,
@@ -413,7 +446,7 @@ function send_sign_in_poc_email(
</div>`; </div>`;
api.send_email({ api.send_email({
api_cfg: $ae_api, api_cfg: $ae_api,
from_email: 'noreply+agree@oneskyit.com', from_email: 'noreply+presmgmt@oneskyit.com',
from_name: 'LCI 2024 Pres Mgmt Hub', from_name: 'LCI 2024 Pres Mgmt Hub',
to_email: to_email, to_email: to_email,
subject: subject, subject: subject,
@@ -421,6 +454,8 @@ function send_sign_in_poc_email(
}); });
} }
</script> </script>
@@ -486,7 +521,9 @@ function send_sign_in_poc_email(
{#if $events_slct.event_session_id && $lq__event_session_obj} {#if $events_slct.event_session_id && $lq__event_session_obj}
<h2 class="h2 text-center">{$lq__event_session_obj?.name ?? '-- not set --'}</h2> <h2 class="h2 text-center rounded-md p-2 bg-gray-300">
{@html $lq__event_session_obj?.name ?? ae_html.not_set}
</h2>
<!-- Information about the session --> <!-- Information about the session -->
<section> <section>
@@ -603,7 +640,7 @@ function send_sign_in_poc_email(
</Element_ae_crud> </Element_ae_crud>
</li> </li>
<li> <li>
<strong class="text-sm">Location/Room:</strong> {$lq__event_session_obj.event_location_name ? $lq__event_session_obj.event_location_name : '-- not set --'} <strong class="text-sm">Location/Room:</strong> {@html $lq__event_session_obj.event_location_name ? $lq__event_session_obj.event_location_name : ae_html.not_set}
{#if $ae_loc.trusted_access} {#if $ae_loc.trusted_access}
<Element_ae_crud <Element_ae_crud
@@ -615,6 +652,7 @@ function send_sign_in_poc_email(
field_type={'select'} field_type={'select'}
field_value={ae_tmp.event_location_id} field_value={ae_tmp.event_location_id}
select_option_li={$slct.event_location_obj_kv} select_option_li={$slct.event_location_obj_kv}
val_empty_is_null={true}
allow_null={$ae_loc.administrator_access} allow_null={$ae_loc.administrator_access}
hide_edit_btn={true} hide_edit_btn={true}
outline_element={false} outline_element={false}
@@ -712,7 +750,7 @@ function send_sign_in_poc_email(
<li> <li>
<strong class="text-sm">Moderator/Champion:</strong> <strong class="text-sm">Moderator/Champion:</strong>
<span title={$lq__event_session_obj?.poc_person_id_random}> <span title={$lq__event_session_obj?.poc_person_id_random}>
{$lq__event_session_obj.poc_person_full_name ? $lq__event_session_obj.poc_person_full_name : '-- not set --'} {@html $lq__event_session_obj.poc_person_full_name ? $lq__event_session_obj.poc_person_full_name : ae_html.not_set}
</span> </span>
{#if $ae_loc.trusted_access} {#if $ae_loc.trusted_access}
@@ -872,10 +910,10 @@ function send_sign_in_poc_email(
send_sign_in_poc_email( send_sign_in_poc_email(
{ {
to_email: $lq__event_session_obj.poc_person_primary_email, to_email: $lq__event_session_obj.poc_person_primary_email,
to_name: $lq__event_session_obj.poc_person_full_name, to_name: $lq__event_session_obj?.poc_person_full_name?? '-- not set --',
person_id: $lq__event_session_obj.poc_person_id_random, person_id: $lq__event_session_obj?.poc_person_id_random?? '-- not set --',
person_passcode: $lq__event_session_obj.poc_person_passcode, person_passcode: $lq__event_session_obj?.poc_person_passcode?? '-- not set --',
session_id: $lq__event_session_obj.event_session_id_random, session_id: $lq__event_session_obj?.event_session_id_random?? '-- not set --',
} }
); );
}} }}
@@ -907,7 +945,7 @@ function send_sign_in_poc_email(
{#if $ae_loc.administrator_access} {#if $ae_loc.administrator_access}
<li> <li>
<strong class="text-sm">Session passcode:</strong> {$lq__event_session_obj.passcode ? $lq__event_session_obj.passcode : '-- not set --'} <strong class="text-sm">Session passcode:</strong> {@html $lq__event_session_obj.passcode ? $lq__event_session_obj.passcode : ae_html.not_set}
</li> </li>
{/if} {/if}
@@ -938,6 +976,7 @@ function send_sign_in_poc_email(
Session description: Session description:
</strong> </strong>
{#if $lq__event_session_obj.description}
<button <button
type="button" type="button"
on:click={() => { on:click={() => {
@@ -959,6 +998,10 @@ function send_sign_in_poc_email(
class="whitespace-pre-wrap p-2 bg-gray-100 rounded-md" class="whitespace-pre-wrap p-2 bg-gray-100 rounded-md"
class:hidden={!$events_loc.pres_mgmt.show_content__session_description} class:hidden={!$events_loc.pres_mgmt.show_content__session_description}
>{$lq__event_session_obj.description}</pre> >{$lq__event_session_obj.description}</pre>
{:else}
{@html ae_html.not_set}
{/if}
</Element_ae_crud> </Element_ae_crud>
</div> </div>
</li> </li>
@@ -1146,11 +1189,14 @@ function send_sign_in_poc_email(
type="button" type="button"
on:click={() => { on:click={() => {
console.log('Add Presentation'); console.log('Add Presentation');
if (!confirm('Add a new presentation to the session? You will be able to edit the details after the presentation is created.')) {
return;
}
let presentation_data = { let presentation_data = {
event_id_random: $events_slct.event_id, event_id_random: $events_slct.event_id,
event_session_id_random: $events_slct.event_session_id, event_session_id_random: $events_slct.event_session_id,
name: 'New Presentation', name: 'TEMP Presentation Name',
code: 'new_presentation', code: 'new_presentation',
enable: true, enable: true,
} }
@@ -1171,15 +1217,22 @@ function send_sign_in_poc_email(
{/if} {/if}
</div> </div>
<h3 class="h3">Presentations:</h3> <h3 class="h5">Presentations:
{#await $events_slct.event_presentation_obj_li} <span class="font-bold bg-success-100 px-4 border rounded-lg border-success-200"
<p>Loading...</p> class:hidden={$lq__event_presentation_obj_li?.length <= 1}
{:then event_presentation_obj_li} title="Presentations for session: {$lq__event_presentation_obj_li?.length ?? 'None'}"
{#if event_presentation_obj_li && event_presentation_obj_li.length > 0} >
<span class="fas fa-chalkboard-teacher mx-1"></span>
{($lq__event_presentation_obj_li?.length > 1 ? `${$lq__event_presentation_obj_li?.length}x` : '')}
</span>
</h3>
{#if $lq__event_presentation_obj_li && $lq__event_presentation_obj_li?.length > 0}
<ul <ul
class="space-y-4 p-4 m-2 bg-gray-100 rounded-md" class="space-y-4 p-4 m-2 bg-gray-100 rounded-md"
> >
{#each event_presentation_obj_li as event_presentation_obj} {#each $lq__event_presentation_obj_li as event_presentation_obj}
<li <li
class="space-y-2 border border-gray-200 p-2 rounded-md" class="space-y-2 border border-gray-200 p-2 rounded-md"
> >
@@ -1190,6 +1243,9 @@ function send_sign_in_poc_email(
type="button" type="button"
on:click={() => { on:click={() => {
console.log('Add Presenter'); console.log('Add Presenter');
if (!confirm('Add a new presenter to the presentation? You will be able to edit their details after the presenter record is created.')) {
return;
}
let presenter_data = { let presenter_data = {
event_id_random: $events_slct.event_id, event_id_random: $events_slct.event_id,
@@ -1218,110 +1274,40 @@ function send_sign_in_poc_email(
</button> </button>
{/if} {/if}
<!-- Make sure to show the edit button only if the user has the correct permissions. Need to set the presentation ID in the store. -->
<!-- {#if event_presentation_obj && ($ae_loc.trusted_access || $events_loc.auth__kv.presentation[event_presentation_obj.event_presentation_id_random])} -->
{#if event_presentation_obj && $ae_loc.trusted_access}
{#if $events_slct.event_presentation_id == event_presentation_obj.event_presentation_id_random && ae_tmp[$events_slct.event_presentation_id]?.show__edit_presentation_name} </div>
<button
type="button"
on:click={() => {
console.log('Cancel edit presentation');
ae_tmp[$events_slct.event_presentation_id].show__edit_presentation_name = false;
// Careful with the trigger_patch. It will keep firing if not reset. <h4 class="h5 rounded-md p-2 bg-gray-200">
ae_triggers.update_event_presentation_name = false;
}}
class="btn btn-sm variant-soft-warning"
>
<span class="fas fa-times mx-1">
</span>
Cancel
</button>
{:else}
<button
type="button"
on:click={() => {
console.log('Edit presentation title and description');
$events_slct.event_presentation_id = event_presentation_obj.event_presentation_id_random;
$events_slct.event_presentation_obj = event_presentation_obj;
ae_tmp[$events_slct.event_presentation_id] = {
show__edit_presentation_name: true,
}
}}
title="Edit presentation title and description"
class="btn btn-sm variant-soft-warning">
<span class="fas fa-edit mx-1">
</span>
Edit Presentation Name
</button>
{/if}
{#if $events_slct.event_presentation_id == event_presentation_obj.event_presentation_id_random && ae_tmp[$events_slct.event_presentation_id]?.show__edit_presentation_name && $events_slct.event_presentation_obj}
<!-- Edit the presentation title -->
<Element_ae_crud <Element_ae_crud
trigger_patch={ae_triggers.update_event_presentation_name}
api_cfg={$ae_api} api_cfg={$ae_api}
object_type={'event_presentation'} object_type={'event_presentation'}
object_id={$events_slct.event_presentation_obj.event_presentation_id_random} object_id={event_presentation_obj.event_presentation_id_random}
field_name={'name'} field_name={'name'}
field_type={'input'} field_type={'text'}
field_value={$events_slct.event_presentation_obj.name} field_value={event_presentation_obj.name}
allow_null={false} allow_null={false}
hide_edit_btn={true} hide_edit_btn={!$ae_loc.trusted_access}
outline_element={false} outline_element={false}
show_crud={false} show_crud={false}
display_inline={true} display_inline={true}
class_li={'m-1'} display_block_edit={true}
class_li={''}
on:ae_crud_updated={e => { on:ae_crud_updated={e => {
console.log(`ae_crud_updated:`, e.detail); console.log(`ae_crud_updated:`, e.detail);
events_func.handle_load_ae_obj_id__event_presentation({api_cfg: $ae_api, event_presentation_id: $events_slct.event_presentation_obj.event_presentation_id_random, log_lvl: 1}) events_func.handle_load_ae_obj_id__event_presentation({api_cfg: $ae_api, event_presentation_id: event_presentation_obj.event_presentation_id_random, log_lvl: 1})
.then(function (load_results) { .then(function (load_results) {
// We need to force reload the Indexed DB - Dexie.js?
// Sometimes the changes are not seen. The file disappears when the Save button is pressed.
// Maybe reload page?
// window.location.reload();
}) })
.finally(function () { .then(function (load_results) {
ae_tmp[$events_slct.event_presentation_id].show__edit_presentation_name = false; // $events_trigger = 'load__event_presentation_obj_id';
// $events_trig_kv['event_presentation_id'] = event_presentation_obj.event_presentation_id_random;
// Careful with the trigger_patch. It will keep firing if not reset.
ae_triggers.update_event_presentation_name = false;
}); });
}} }}
> >
<input <!-- <strong class="text-sm">Name/Title:</strong> -->
bind:value={$events_slct.event_presentation_obj.name}
class="input min-w-96 max-w-96 text-sm"
/>
<!-- disabled={$events_slct.event_presentation_obj.name == event_presentation_obj.name} -->
<button
type="button"
on:click={() => {
console.log('*** Save button clicked ***');
// if (!confirm('Are you sure you want to save this event_presenter?')) {return false;}
console.log(`Selected event_presentation_id: ${$events_slct.event_presentation_obj.event_presentation_id_random}`);
ae_triggers.update_event_presentation_name = true;
// ae_triggers.update_event_presentation_name = $events_slct.event_presentation_obj.event_presentation_id_random;
}}
class="btn btn-sm variant-soft-success hover:variant-ghost-success mx-1"
>
<span class="fas fa-save mx-1"></span>
Save
</button>
</Element_ae_crud>
{/if}
{/if}
</div>
<h4 class="h5">
"{event_presentation_obj.name}" "{event_presentation_obj.name}"
</Element_ae_crud>
<!-- "{event_presentation_obj.name}" -->
{#if event_presentation_obj.code || event_presentation_obj.abstract_code} {#if event_presentation_obj.code || event_presentation_obj.abstract_code}
<span class="text-sm text-gray-500 bg-yellow-100 p-1 rounded-md border border-yellow-200" <span class="text-sm text-gray-500 bg-yellow-100 p-1 rounded-md border border-yellow-200"
title="Presentation code {event_presentation_obj.code} and abstract code {event_presentation_obj.abstract_code}" title="Presentation code {event_presentation_obj.code} and abstract code {event_presentation_obj.abstract_code}"
@@ -1354,19 +1340,25 @@ function send_sign_in_poc_email(
events_func.handle_load_ae_obj_id__event_presentation({api_cfg: $ae_api, event_presentation_id: event_presentation_obj.event_presentation_id_random, log_lvl: 1}); events_func.handle_load_ae_obj_id__event_presentation({api_cfg: $ae_api, event_presentation_id: event_presentation_obj.event_presentation_id_random, log_lvl: 1});
}} }}
> >
{#if event_presentation_obj.description}
<strong class="text-sm"> <strong class="text-sm">
Description: Description:
</strong> </strong>
{#if event_presentation_obj.description}
<button <button
type="button" type="button"
on:click={() => { on:click={() => {
console.log('Show/Hide Description'); console.log('Show/Hide Description');
if ($events_loc.pres_mgmt.show_content__presentation_description == event_presentation_obj.event_presentation_id_random) { if ($events_loc.pres_mgmt.show_content__presentation_description == event_presentation_obj.event_presentation_id_random) {
$events_loc.pres_mgmt.show_content__presentation_description = null; $events_loc.pres_mgmt.show_content__presentation_description = null;
// Was testing with LiveQuery
$events_slct.event_presentation_id = null;
} else { } else {
$events_loc.pres_mgmt.show_content__presentation_description = event_presentation_obj.event_presentation_id_random; $events_loc.pres_mgmt.show_content__presentation_description = event_presentation_obj.event_presentation_id_random;
// Was testing with LiveQuery
$events_slct.event_presentation_id = event_presentation_obj.event_presentation_id_random;
} }
}} }}
class="btn btn-sm variant-soft-surface hover:variant-filled-surface text-xs" class="btn btn-sm variant-soft-surface hover:variant-filled-surface text-xs"
@@ -1384,28 +1376,34 @@ function send_sign_in_poc_email(
class="whitespace-pre-wrap p-2 bg-gray-100 rounded-md" class="whitespace-pre-wrap p-2 bg-gray-100 rounded-md"
class:hidden={$events_loc.pres_mgmt.show_content__presentation_description !== event_presentation_obj.event_presentation_id_random} class:hidden={$events_loc.pres_mgmt.show_content__presentation_description !== event_presentation_obj.event_presentation_id_random}
>{event_presentation_obj.description}</pre> >{event_presentation_obj.description}</pre>
{:else} {:else}
{@html ae_html.not_set}
{/if}
<!-- {:else}
<div class="text-sm text-gray-500 bg-gray-100 p-1 rounded-md border border-gray-200" <div class="text-sm text-gray-500 bg-gray-100 p-1 rounded-md border border-gray-200"
class:hidden={!$ae_loc.administrator_access} class:hidden={!$ae_loc.administrator_access}
> >
<span class="fas fa-exclamation-triangle mx-1"></span> <span class="fas fa-exclamation-triangle mx-1"></span>
No description provided. No description provided.
</div> </div>
{/if} {/if} -->
</Element_ae_crud> </Element_ae_crud>
</div> </div>
<!-- Show presenters for this presentation --> <!-- Show presenters for this presentation -->
{#await event_presentation_obj.event_presenter_li} <!-- This needs to be moved to a separate component. -->
<p>Loading...</p> {#if $lq__event_presenter_obj_li?.length > 0}
{:then event_presenter_li} <strong class="text-sm">Presenters:
{#if event_presenter_li && event_presenter_li.length > 0} <!-- ({$lq__event_presenter_obj_li?.length}) -->
<strong class="text-sm">Presenters:</strong> </strong>
<ul <ul
class="space-y-2 px-4" class="space-y-2 px-4"
> >
{#each event_presenter_li as event_presenter_obj} {#each $lq__event_presenter_obj_li as event_presenter_obj}
<!-- This is a hack. I can not get the LiveQuery to work with specific presentation IDs. It only works with the session ID. I need to figure out how to get the presenters for the specific presentation. -->
{#if event_presenter_obj.event_presentation_id_random == event_presentation_obj.event_presentation_id_random}
<li> <li>
<button <button
type="button" type="button"
@@ -1453,22 +1451,14 @@ function send_sign_in_poc_email(
send_init_confirm_email( send_init_confirm_email(
{ {
to_email: event_presenter_obj.email, to_email: event_presenter_obj.email,
to_name: event_presenter_obj.full_name, to_name: event_presenter_obj?.full_name?? '-- not set --',
person_id: event_presenter_obj.person_id_random, person_id: event_presenter_obj?.person_id_random?? '-- not set --',
person_passcode: event_presenter_obj.person_passcode, person_passcode: event_presenter_obj.person_passcode?? '-- not set --',
presentation_id: event_presentation_obj.event_presentation_id_random, presentation_id: event_presentation_obj.event_presentation_id_random,
presenter_id: event_presenter_obj.event_presenter_id_random, presenter_id: event_presenter_obj.event_presenter_id_random,
presentation_name: event_presentation_obj.name, presentation_name: event_presentation_obj.name,
} }
); );
// send_init_confirm_email();
// send_email({
// to: event_presenter_obj.email,
// subject: `Access link for ${$lq__event_session_obj.name}`,
// body: `Hello ${event_presenter_obj.full_name},\n\nHere is the access link for the session: ${data.url.origin}/events_pres_mgmt/session/{$events_slct.event_session_id}?person_id=${event_presenter_obj.person_id_random}&person_pass=${event_presenter_obj.person_passcode}\n\nThank you,\n\nThe LCI Team`,
// });
}} }}
class="btn btn-md variant-ghost-primary hover:variant-filled-primary" class="btn btn-md variant-ghost-primary hover:variant-filled-primary"
title="Email the access link to the presenter" title="Email the access link to the presenter"
@@ -1618,12 +1608,16 @@ function send_sign_in_poc_email(
</div> </div>
</li> </li>
{/if}
{/each} {/each}
</ul> </ul>
{:else}
<p>No presenters found...!</p>
{$events_slct.event_presentation_id}
{$lq__event_presentation_obj}
{$lq__event_presenter_obj_li?.length}
{/if} {/if}
{:catch error}
<p>Error: {error.message}</p>
{/await}
<Element_manage_event_file_li <Element_manage_event_file_li
@@ -1634,39 +1628,15 @@ function send_sign_in_poc_email(
container_class_li={'ae_modal_scrollfix'} container_class_li={'ae_modal_scrollfix'}
/> />
<!-- Show files list for this presentation -->
<!-- {#await event_presentation_obj.event_file_li}
<p>Loading...</p>
{:then event_file_li}
{#if event_file_li}
<strong class="text-sm">Files:</strong>
<ul
class="space-y-2 px-4"
>
{#each event_file_li as file_obj}
<li>
<span class="fas fa-file"></span>
<a
href={file_obj.url}
class="text-blue-500"
>{file_obj.name}</a>
</li>
{/each}
</ul>
{/if}
{:catch error}
<p>Error: {error.message}</p>
{/await} -->
</li> </li>
{/each} {/each}
</ul> </ul>
{:else} {:else}
Nothing to show yet... Nothing to show yet...!
{/if} {/if}
{:catch error}
<p>Error: {error.message}</p>
{/await}
</section> </section>

View File

@@ -148,7 +148,7 @@ async function handle_update__event_presenter({
// api.send_email({ // api.send_email({
// api_cfg: $ae_api, // api_cfg: $ae_api,
// from_email: 'noreply+agree@oneskyit.com', // from_email: 'noreply+presmgmt@oneskyit.com',
// from_name: 'LCI 2024 Pres Mgmt Hub', // from_name: 'LCI 2024 Pres Mgmt Hub',
// to_email: 'test+agree@oneskyit.com', // to_email: 'test+agree@oneskyit.com',
// subject: subject, // subject: subject,