A lot of code clean up. Also making things look better.
This commit is contained in:
@@ -34,6 +34,14 @@ export type 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.
|
||||
export let ae_app_local_data_struct: key_val = {
|
||||
'ver': '2024-06-26_13',
|
||||
|
||||
13
src/lib/ae_string_snippets.ts
Normal file
13
src/lib/ae_string_snippets.ts
Normal 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,
|
||||
};
|
||||
@@ -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 = {
|
||||
[key: string]: string;
|
||||
@@ -8,135 +11,6 @@ type key_val = {
|
||||
[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(
|
||||
bytes: number,
|
||||
decimals: number = 2
|
||||
@@ -282,11 +156,16 @@ export let extract_prefixed_form_data = function extract_prefixed_form_data({pre
|
||||
* em: Email Address
|
||||
*/
|
||||
// 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(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(':')
|
||||
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).
|
||||
// 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 = {
|
||||
process_permission_checks: process_permission_checks,
|
||||
iso_datetime_formatter: iso_datetime_formatter,
|
||||
format_bytes: format_bytes,
|
||||
number_w_commas: number_w_commas,
|
||||
extract_prefixed_form_data: extract_prefixed_form_data,
|
||||
process_data_string: process_data_string,
|
||||
process_permission_checks: process_permission_checks,
|
||||
handle_url_and_message: handle_url_and_message,
|
||||
create_a_element: create_a_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,
|
||||
return_obj_type_path: return_obj_type_path,
|
||||
};
|
||||
// export default ae_util;
|
||||
129
src/lib/ae_utils__datetime_format.ts
Normal file
129
src/lib/ae_utils__datetime_format.ts
Normal 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;
|
||||
}
|
||||
169
src/lib/ae_utils__perm_checks.ts
Normal file
169
src/lib/ae_utils__perm_checks.ts
Normal 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;
|
||||
}
|
||||
@@ -24,6 +24,7 @@ export let field_type: string = 'text'; // button, text, textarea, template (old
|
||||
export let field_value: any;
|
||||
export let allow_null: boolean = false;
|
||||
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 display_inline: 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;
|
||||
|
||||
// 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: 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 = {}
|
||||
|
||||
@@ -72,8 +72,17 @@ onMount(() => {
|
||||
Refresh Files
|
||||
</button>
|
||||
|
||||
<h3 class="h4">
|
||||
Manage Files: {$lq__event_file_obj_li ? `${$lq__event_file_obj_li.length}x` : '-- none --'}
|
||||
<h3
|
||||
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>
|
||||
|
||||
{#if $lq__event_file_obj_li && $lq__event_file_obj_li.length}
|
||||
@@ -250,7 +259,7 @@ onMount(() => {
|
||||
|
||||
// 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="outline" selected={event_file_obj.file_purpose === 'outline'}>1. Outline</option>
|
||||
|
||||
@@ -17,7 +17,7 @@ import Element_data_store from '$lib/element_data_store.svelte';
|
||||
import { liveQuery } from "dexie";
|
||||
import { core_func } from '$lib/ae_core_functions';
|
||||
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_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')}
|
||||
</span>
|
||||
{:else}
|
||||
-- not set --
|
||||
{@html ae_html.not_set}
|
||||
{/if}
|
||||
</td>
|
||||
<td>{session_obj.event_location_name ?? '-- not set --'}</td>
|
||||
@@ -452,7 +452,7 @@ function handle_search__event_session(search_str: string) {
|
||||
</span>
|
||||
{/if}
|
||||
{:else}
|
||||
-- not set --
|
||||
{@html ae_html.not_set}
|
||||
{/if}
|
||||
|
||||
{#if $ae_loc.trusted_access}
|
||||
|
||||
@@ -20,7 +20,7 @@ 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_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_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 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.
|
||||
$slct.account_id = data.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)
|
||||
);
|
||||
|
||||
|
||||
|
||||
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(
|
||||
@@ -114,8 +131,20 @@ let lq__event_presentation_obj = liveQuery(
|
||||
let lq__event_presenter_obj = liveQuery(
|
||||
() => 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(
|
||||
() => 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(() => {
|
||||
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);
|
||||
|
||||
// if (!$events_slct.event_id) {
|
||||
@@ -340,6 +371,8 @@ function send_init_confirm_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';
|
||||
|
||||
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_cfg: $ae_api,
|
||||
from_email: 'noreply+agree@oneskyit.com',
|
||||
from_email: 'noreply+presmgmt@oneskyit.com',
|
||||
from_name: 'LCI 2024 Pres Mgmt Hub',
|
||||
to_email: to_email,
|
||||
subject: subject,
|
||||
@@ -413,7 +446,7 @@ function send_sign_in_poc_email(
|
||||
</div>`;
|
||||
api.send_email({
|
||||
api_cfg: $ae_api,
|
||||
from_email: 'noreply+agree@oneskyit.com',
|
||||
from_email: 'noreply+presmgmt@oneskyit.com',
|
||||
from_name: 'LCI 2024 Pres Mgmt Hub',
|
||||
to_email: to_email,
|
||||
subject: subject,
|
||||
@@ -421,6 +454,8 @@ function send_sign_in_poc_email(
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@@ -486,7 +521,9 @@ function send_sign_in_poc_email(
|
||||
|
||||
{#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 -->
|
||||
<section>
|
||||
@@ -603,7 +640,7 @@ function send_sign_in_poc_email(
|
||||
</Element_ae_crud>
|
||||
</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}
|
||||
<Element_ae_crud
|
||||
@@ -615,6 +652,7 @@ function send_sign_in_poc_email(
|
||||
field_type={'select'}
|
||||
field_value={ae_tmp.event_location_id}
|
||||
select_option_li={$slct.event_location_obj_kv}
|
||||
val_empty_is_null={true}
|
||||
allow_null={$ae_loc.administrator_access}
|
||||
hide_edit_btn={true}
|
||||
outline_element={false}
|
||||
@@ -712,7 +750,7 @@ function send_sign_in_poc_email(
|
||||
<li>
|
||||
<strong class="text-sm">Moderator/Champion:</strong>
|
||||
<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>
|
||||
|
||||
{#if $ae_loc.trusted_access}
|
||||
@@ -872,10 +910,10 @@ function send_sign_in_poc_email(
|
||||
send_sign_in_poc_email(
|
||||
{
|
||||
to_email: $lq__event_session_obj.poc_person_primary_email,
|
||||
to_name: $lq__event_session_obj.poc_person_full_name,
|
||||
person_id: $lq__event_session_obj.poc_person_id_random,
|
||||
person_passcode: $lq__event_session_obj.poc_person_passcode,
|
||||
session_id: $lq__event_session_obj.event_session_id_random,
|
||||
to_name: $lq__event_session_obj?.poc_person_full_name?? '-- not set --',
|
||||
person_id: $lq__event_session_obj?.poc_person_id_random?? '-- not set --',
|
||||
person_passcode: $lq__event_session_obj?.poc_person_passcode?? '-- not set --',
|
||||
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}
|
||||
<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>
|
||||
{/if}
|
||||
|
||||
@@ -938,6 +976,7 @@ function send_sign_in_poc_email(
|
||||
Session description:
|
||||
</strong>
|
||||
|
||||
{#if $lq__event_session_obj.description}
|
||||
<button
|
||||
type="button"
|
||||
on:click={() => {
|
||||
@@ -959,6 +998,10 @@ function send_sign_in_poc_email(
|
||||
class="whitespace-pre-wrap p-2 bg-gray-100 rounded-md"
|
||||
class:hidden={!$events_loc.pres_mgmt.show_content__session_description}
|
||||
>{$lq__event_session_obj.description}</pre>
|
||||
|
||||
{:else}
|
||||
{@html ae_html.not_set}
|
||||
{/if}
|
||||
</Element_ae_crud>
|
||||
</div>
|
||||
</li>
|
||||
@@ -1146,11 +1189,14 @@ function send_sign_in_poc_email(
|
||||
type="button"
|
||||
on:click={() => {
|
||||
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 = {
|
||||
event_id_random: $events_slct.event_id,
|
||||
event_session_id_random: $events_slct.event_session_id,
|
||||
name: 'New Presentation',
|
||||
name: 'TEMP Presentation Name',
|
||||
code: 'new_presentation',
|
||||
enable: true,
|
||||
}
|
||||
@@ -1171,15 +1217,22 @@ function send_sign_in_poc_email(
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<h3 class="h3">Presentations:</h3>
|
||||
{#await $events_slct.event_presentation_obj_li}
|
||||
<p>Loading...</p>
|
||||
{:then event_presentation_obj_li}
|
||||
{#if event_presentation_obj_li && event_presentation_obj_li.length > 0}
|
||||
<h3 class="h5">Presentations:
|
||||
<span class="font-bold bg-success-100 px-4 border rounded-lg border-success-200"
|
||||
class:hidden={$lq__event_presentation_obj_li?.length <= 1}
|
||||
title="Presentations for session: {$lq__event_presentation_obj_li?.length ?? 'None'}"
|
||||
>
|
||||
<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
|
||||
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
|
||||
class="space-y-2 border border-gray-200 p-2 rounded-md"
|
||||
>
|
||||
@@ -1190,6 +1243,9 @@ function send_sign_in_poc_email(
|
||||
type="button"
|
||||
on:click={() => {
|
||||
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 = {
|
||||
event_id_random: $events_slct.event_id,
|
||||
@@ -1218,110 +1274,40 @@ function send_sign_in_poc_email(
|
||||
</button>
|
||||
{/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}
|
||||
<button
|
||||
type="button"
|
||||
on:click={() => {
|
||||
console.log('Cancel edit presentation');
|
||||
ae_tmp[$events_slct.event_presentation_id].show__edit_presentation_name = false;
|
||||
</div>
|
||||
|
||||
// Careful with the trigger_patch. It will keep firing if not reset.
|
||||
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 -->
|
||||
<h4 class="h5 rounded-md p-2 bg-gray-200">
|
||||
<Element_ae_crud
|
||||
trigger_patch={ae_triggers.update_event_presentation_name}
|
||||
api_cfg={$ae_api}
|
||||
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_type={'input'}
|
||||
field_value={$events_slct.event_presentation_obj.name}
|
||||
field_type={'text'}
|
||||
field_value={event_presentation_obj.name}
|
||||
allow_null={false}
|
||||
hide_edit_btn={true}
|
||||
hide_edit_btn={!$ae_loc.trusted_access}
|
||||
outline_element={false}
|
||||
show_crud={false}
|
||||
display_inline={true}
|
||||
class_li={'m-1'}
|
||||
display_block_edit={true}
|
||||
class_li={''}
|
||||
on:ae_crud_updated={e => {
|
||||
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) {
|
||||
// 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 () {
|
||||
ae_tmp[$events_slct.event_presentation_id].show__edit_presentation_name = false;
|
||||
|
||||
// Careful with the trigger_patch. It will keep firing if not reset.
|
||||
ae_triggers.update_event_presentation_name = false;
|
||||
.then(function (load_results) {
|
||||
// $events_trigger = 'load__event_presentation_obj_id';
|
||||
// $events_trig_kv['event_presentation_id'] = event_presentation_obj.event_presentation_id_random;
|
||||
});
|
||||
}}
|
||||
>
|
||||
<input
|
||||
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">
|
||||
<!-- <strong class="text-sm">Name/Title:</strong> -->
|
||||
"{event_presentation_obj.name}"
|
||||
</Element_ae_crud>
|
||||
<!-- "{event_presentation_obj.name}" -->
|
||||
{#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"
|
||||
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});
|
||||
}}
|
||||
>
|
||||
{#if event_presentation_obj.description}
|
||||
<strong class="text-sm">
|
||||
Description:
|
||||
</strong>
|
||||
|
||||
{#if event_presentation_obj.description}
|
||||
<button
|
||||
type="button"
|
||||
on:click={() => {
|
||||
console.log('Show/Hide Description');
|
||||
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;
|
||||
|
||||
// Was testing with LiveQuery
|
||||
$events_slct.event_presentation_id = null;
|
||||
} else {
|
||||
$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"
|
||||
@@ -1384,28 +1376,34 @@ function send_sign_in_poc_email(
|
||||
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}
|
||||
>{event_presentation_obj.description}</pre>
|
||||
|
||||
{: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"
|
||||
class:hidden={!$ae_loc.administrator_access}
|
||||
>
|
||||
<span class="fas fa-exclamation-triangle mx-1"></span>
|
||||
No description provided.
|
||||
</div>
|
||||
{/if}
|
||||
{/if} -->
|
||||
</Element_ae_crud>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Show presenters for this presentation -->
|
||||
{#await event_presentation_obj.event_presenter_li}
|
||||
<p>Loading...</p>
|
||||
{:then event_presenter_li}
|
||||
{#if event_presenter_li && event_presenter_li.length > 0}
|
||||
<strong class="text-sm">Presenters:</strong>
|
||||
<!-- This needs to be moved to a separate component. -->
|
||||
{#if $lq__event_presenter_obj_li?.length > 0}
|
||||
<strong class="text-sm">Presenters:
|
||||
<!-- ({$lq__event_presenter_obj_li?.length}) -->
|
||||
</strong>
|
||||
<ul
|
||||
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>
|
||||
<button
|
||||
type="button"
|
||||
@@ -1453,22 +1451,14 @@ function send_sign_in_poc_email(
|
||||
send_init_confirm_email(
|
||||
{
|
||||
to_email: event_presenter_obj.email,
|
||||
to_name: event_presenter_obj.full_name,
|
||||
person_id: event_presenter_obj.person_id_random,
|
||||
person_passcode: event_presenter_obj.person_passcode,
|
||||
to_name: event_presenter_obj?.full_name?? '-- not set --',
|
||||
person_id: event_presenter_obj?.person_id_random?? '-- not set --',
|
||||
person_passcode: event_presenter_obj.person_passcode?? '-- not set --',
|
||||
presentation_id: event_presentation_obj.event_presentation_id_random,
|
||||
presenter_id: event_presenter_obj.event_presenter_id_random,
|
||||
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"
|
||||
title="Email the access link to the presenter"
|
||||
@@ -1618,12 +1608,16 @@ function send_sign_in_poc_email(
|
||||
</div>
|
||||
|
||||
</li>
|
||||
{/if}
|
||||
{/each}
|
||||
</ul>
|
||||
{:else}
|
||||
<p>No presenters found...!</p>
|
||||
{$events_slct.event_presentation_id}
|
||||
{$lq__event_presentation_obj}
|
||||
{$lq__event_presenter_obj_li?.length}
|
||||
{/if}
|
||||
{:catch error}
|
||||
<p>Error: {error.message}</p>
|
||||
{/await}
|
||||
|
||||
|
||||
|
||||
<Element_manage_event_file_li
|
||||
@@ -1634,39 +1628,15 @@ function send_sign_in_poc_email(
|
||||
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>
|
||||
{/each}
|
||||
</ul>
|
||||
{:else}
|
||||
Nothing to show yet...
|
||||
Nothing to show yet...!
|
||||
{/if}
|
||||
{:catch error}
|
||||
<p>Error: {error.message}</p>
|
||||
{/await}
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ async function handle_update__event_presenter({
|
||||
|
||||
// api.send_email({
|
||||
// api_cfg: $ae_api,
|
||||
// from_email: 'noreply+agree@oneskyit.com',
|
||||
// from_email: 'noreply+presmgmt@oneskyit.com',
|
||||
// from_name: 'LCI 2024 Pres Mgmt Hub',
|
||||
// to_email: 'test+agree@oneskyit.com',
|
||||
// subject: subject,
|
||||
|
||||
Reference in New Issue
Block a user