Lots of work related to the IDAA Recovery Meetings. Better pulling in off lookup list data.
This commit is contained in:
@@ -29,6 +29,7 @@ export async function load_ae_obj_li__country(
|
||||
let limit: number = (params.qry__limit ?? 300); // Actual is 249 in 2024
|
||||
let offset: number = (params.qry__offset ?? 0); // 0
|
||||
|
||||
let order_by_li = {'sort': 'DESC', 'english_short_name': 'ASC', 'alpha_2_code': 'ASC'};
|
||||
|
||||
let params_json: key_val = {};
|
||||
|
||||
@@ -43,7 +44,7 @@ export async function load_ae_obj_li__country(
|
||||
use_alt_base: false, // NOTE: This will use the base_name_alt value instead of the base_name value
|
||||
enabled: enabled,
|
||||
hidden: hidden,
|
||||
order_by_li: {'english_short_name': 'ASC'},
|
||||
order_by_li: order_by_li,
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
params_json: params_json,
|
||||
|
||||
@@ -8,27 +8,30 @@ let ae_promises: key_val = {};
|
||||
|
||||
// Updated 2024-10-14
|
||||
export async function load_ae_obj_li__country_subdivision(
|
||||
{
|
||||
api_cfg,
|
||||
// account_id,
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any,
|
||||
// account_id: string,
|
||||
params?: key_val,
|
||||
try_cache?: boolean,
|
||||
log_lvl?: number
|
||||
}
|
||||
) {
|
||||
console.log(`*** load_ae_obj_li__country_subdivision() ***`);
|
||||
{
|
||||
api_cfg,
|
||||
// account_id,
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any,
|
||||
// account_id: string,
|
||||
params?: key_val,
|
||||
try_cache?: boolean,
|
||||
log_lvl?: number
|
||||
}
|
||||
) {
|
||||
if (log_lvl) {
|
||||
console.log(`*** load_ae_obj_li__country_subdivision() ***`);
|
||||
}
|
||||
|
||||
let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled
|
||||
let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden
|
||||
let limit: number = (params.qry__limit ?? 300); // Actual is 249 in 2024
|
||||
let offset: number = (params.qry__offset ?? 0); // 0
|
||||
|
||||
let order_by_li = {'sort': 'DESC', 'name': 'ASC', 'code': 'ASC'};
|
||||
|
||||
let params_json: key_val = {};
|
||||
|
||||
@@ -43,7 +46,7 @@ export async function load_ae_obj_li__country_subdivision(
|
||||
use_alt_base: false, // NOTE: This will use the base_name_alt value instead of the base_name value
|
||||
enabled: enabled,
|
||||
hidden: hidden,
|
||||
order_by_li: {'name': 'ASC', 'code': 'ASC'},
|
||||
order_by_li: order_by_li,
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
params_json: params_json,
|
||||
|
||||
@@ -510,13 +510,19 @@ export function db_save_ae_obj_li__event(
|
||||
created_on: obj.created_on,
|
||||
updated_on: obj.updated_on,
|
||||
|
||||
// IDAA Recovery Meetings
|
||||
// IDAA Recovery Meetings:
|
||||
// Currently only really used for IDAA
|
||||
contact_li_json: obj.contact_li_json,
|
||||
external_person_id: obj.external_person_id,
|
||||
|
||||
physical: obj.physical,
|
||||
virtual: obj.virtual,
|
||||
|
||||
recurring: obj.recurring,
|
||||
recurring_start_time: obj.recurring_start_time,
|
||||
recurring_end_time: obj.recurring_end_time,
|
||||
recurring_text: obj.recurring_text,
|
||||
|
||||
weekday_sunday: obj.weekday_sunday,
|
||||
weekday_monday: obj.weekday_monday,
|
||||
weekday_tuesday: obj.weekday_tuesday,
|
||||
@@ -525,7 +531,11 @@ export function db_save_ae_obj_li__event(
|
||||
weekday_friday: obj.weekday_friday,
|
||||
weekday_saturday: obj.weekday_saturday,
|
||||
|
||||
recurring_start_time: obj.recurring_start_time,
|
||||
attend_url: obj.attend_url,
|
||||
attend_url_text: obj.attend_url_text,
|
||||
attend_url_passcode: obj.attend_url_passcode,
|
||||
attend_phone: obj.attend_phone,
|
||||
attend_phone_passcode: obj.attend_phone_passcode,
|
||||
|
||||
// From SQL view
|
||||
file_count: obj.file_count,
|
||||
|
||||
@@ -47,13 +47,20 @@ export interface Event {
|
||||
created_on: Date;
|
||||
updated_on?: null|Date;
|
||||
|
||||
// IDAA Recovery Meetings
|
||||
// IDAA Recovery Meetings:
|
||||
// Currently only really used for IDAA
|
||||
contact_li_json?: null|string[]; // full_name, email, phone_mobile, phone_home, phone_office, other_text
|
||||
// contact_li_json_ext?: null|string;
|
||||
external_person_id?: null|string;
|
||||
|
||||
physical?: null|boolean;
|
||||
virtual?: null|boolean;
|
||||
|
||||
recurring?: null|boolean;
|
||||
recurring_start_time?: null|string;
|
||||
recurring_end_time?: null|string;
|
||||
recurring_text?: null|string;
|
||||
|
||||
weekday_sunday?: null|boolean;
|
||||
weekday_monday?: null|boolean;
|
||||
weekday_tuesday?: null|boolean;
|
||||
@@ -62,7 +69,11 @@ export interface Event {
|
||||
weekday_friday?: null|boolean;
|
||||
weekday_saturday?: null|boolean;
|
||||
|
||||
recurring_start_time?: null|string;
|
||||
attend_url?: null|string;
|
||||
attend_url_text?: null|string;
|
||||
attend_url_passcode?: null|string;
|
||||
attend_phone?: null|string;
|
||||
attend_phone_passcode?: null|string;
|
||||
|
||||
// Additional fields for convenience (database views)
|
||||
file_count?: null|number;
|
||||
|
||||
@@ -19,6 +19,7 @@ import "./element_tiptap_editor.scss";
|
||||
export let html_text: string = '';
|
||||
export let default_minimal: boolean = false;
|
||||
export let show_menu: boolean = true;
|
||||
export let placeholder: string = 'Type your text here...';
|
||||
|
||||
if (default_minimal) {
|
||||
show_menu = false;
|
||||
@@ -415,7 +416,13 @@ function getContent() {
|
||||
<div
|
||||
bind:this={element}
|
||||
class="tiptap bg-slate-100 px-1 py-2"
|
||||
/>
|
||||
>
|
||||
<span
|
||||
class="placeholder text-sm text-gray-400 italic"
|
||||
contenteditable="false"
|
||||
hidden={editor?.getHTML() !== '<p></p>'}
|
||||
>{placeholder}</span>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
@@ -28,15 +28,8 @@ import Comp__event_obj_id_view from './ae_idaa_comp__event_obj_id_view.svelte';
|
||||
|
||||
let event_id_random_li: Array<string>;
|
||||
|
||||
// $: lq__event_obj_li = liveQuery(async () => {
|
||||
// let results = await db_events.events
|
||||
// .where('account_id')
|
||||
// .equals($slct.account_id)
|
||||
// .sortBy('name');
|
||||
|
||||
// return results;
|
||||
// });
|
||||
|
||||
// Functions and Logic
|
||||
$: lq__event_obj = liveQuery(async () => {
|
||||
let results = await db_events.events
|
||||
.get($idaa_slct.event_id);
|
||||
@@ -45,12 +38,7 @@ $: lq__event_obj = liveQuery(async () => {
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
// Functions and Logic
|
||||
$: lq_new__event_obj_li = liveQuery(async () => {
|
||||
console.log('Trying... HERE!!! BEGIN');
|
||||
|
||||
let link_to_type: string = 'account';
|
||||
let link_to_id: string = $slct.account_id;
|
||||
console.log(`link_to_type: ${link_to_type}; link_to_id: ${link_to_id}`);
|
||||
@@ -74,25 +62,8 @@ $: lq_new__event_obj_li = liveQuery(async () => {
|
||||
console.log('Trying... Nothing to load');
|
||||
return null;
|
||||
}
|
||||
console.log('Trying... HERE!!! END');
|
||||
});
|
||||
|
||||
// $: lq_bulk__event_obj_li = liveQuery(async () => {
|
||||
// console.log('Trying... HERE!!! BULK BEGIN');
|
||||
|
||||
// if (event_id_random_li.length) {
|
||||
// console.log(`Trying bulkGet:`, event_id_random_li);
|
||||
// let results = await db_events.events
|
||||
// .bulkGet(event_id_random_li);
|
||||
|
||||
// return results;
|
||||
// } else {
|
||||
// console.log('Trying... Nothing to load');
|
||||
// return null;
|
||||
// }
|
||||
// console.log('Trying... HERE!!! BULK END');
|
||||
// });
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@@ -134,10 +105,38 @@ $: lq_new__event_obj_li = liveQuery(async () => {
|
||||
title="{$lq__event_obj?.name} - {$lq__event_obj?.id}"
|
||||
bind:open={$idaa_sess.recovery_meetings.show__modal_edit}
|
||||
autoclose={false}
|
||||
placement="top-center"
|
||||
size="xl"
|
||||
class="bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-200 rounded-lg border-gray-200 dark:border-gray-700 divide-gray-200 dark:divide-gray-700 shadow-md relative flex flex-col mx-auto w-full divide-y"
|
||||
class="top-center bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-200 rounded-lg border-gray-200 dark:border-gray-700 divide-gray-200 dark:divide-gray-700 shadow-md relative flex flex-col mx-auto w-full divide-y"
|
||||
>
|
||||
|
||||
<svelte:fragment slot="header">
|
||||
<div class="flex flex-row items-center justify-between w-full">
|
||||
<h3 class="text-lg font-semibold">
|
||||
{#if $ae_loc.trusted_access || $lq__event_obj?.external_person_id === $ae_loc.novi_uuid || $lq__event_obj?.contact_li_json[0]?.email === $ae_loc.novi_email}
|
||||
<!-- <div class="ae_options"> -->
|
||||
<button
|
||||
on:click={() => {
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.set('event_id', $lq__event_obj?.event_id_random);
|
||||
// history.pushState({}, '', url);
|
||||
|
||||
$idaa_sess.recovery_meetings.show__modal_view = true;
|
||||
$idaa_sess.recovery_meetings.show__modal_edit = false;
|
||||
}}
|
||||
class="btn btn-sm variant-ghost-warning hover:variant-filled-warning transition"
|
||||
title={`Edit meeting: ${$lq__event_obj?.name}`}
|
||||
>
|
||||
<span class="fas fa-eye m-1"></span> View
|
||||
</button>
|
||||
<!-- </div> -->
|
||||
{/if}
|
||||
|
||||
Edit Meeting: {$lq__event_obj?.name}</h3>
|
||||
</div>
|
||||
|
||||
</svelte:fragment>
|
||||
|
||||
<Comp__event_obj_id_edit
|
||||
lq__event_obj={lq__event_obj}
|
||||
/>
|
||||
@@ -161,15 +160,42 @@ $: lq_new__event_obj_li = liveQuery(async () => {
|
||||
|
||||
</Modal>
|
||||
|
||||
<!-- Main modal -->
|
||||
<!-- Modal: Event (Recovery Meeting) view ID -->
|
||||
<Modal
|
||||
title="{$lq__event_obj?.name} - {$lq__event_obj?.id}"
|
||||
bind:open={$idaa_sess.recovery_meetings.show__modal_view}
|
||||
autoclose={false}
|
||||
size="xl"
|
||||
outsideclose={true}
|
||||
placement="top-center"
|
||||
size="lg"
|
||||
class="bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-200 rounded-lg border-gray-200 dark:border-gray-700 divide-gray-200 dark:divide-gray-700 shadow-md relative flex flex-col mx-auto w-full divide-y"
|
||||
>
|
||||
|
||||
<svelte:fragment slot="header">
|
||||
|
||||
<div class="flex flex-row items-center justify-between w-full">
|
||||
<h3 class="text-lg font-semibold">
|
||||
{#if $ae_loc.trusted_access || $lq__event_obj?.external_person_id === $ae_loc.novi_uuid || $lq__event_obj?.contact_li_json[0].email === $ae_loc.novi_email}
|
||||
<button
|
||||
on:click={() => {
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.set('event_id', $lq__event_obj?.event_id_random);
|
||||
// history.pushState({}, '', url);
|
||||
|
||||
$idaa_sess.recovery_meetings.show__modal_view = false;
|
||||
$idaa_sess.recovery_meetings.show__modal_edit = true;
|
||||
}}
|
||||
class="btn btn-sm variant-ghost-warning hover:variant-filled-warning transition"
|
||||
title={`View meeting: ${$lq__event_obj?.name}`}
|
||||
>
|
||||
<span class="fas fa-edit m-1"></span> Edit
|
||||
</button>
|
||||
{/if}
|
||||
{$lq__event_obj?.name}
|
||||
</h3>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
|
||||
<Comp__event_obj_id_view
|
||||
lq__event_obj={lq__event_obj}
|
||||
/>
|
||||
|
||||
@@ -21,9 +21,7 @@ type key_val = {
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
let create_event_obj_promise: any;
|
||||
let delete_event_obj_promise: any;
|
||||
let update_event_obj_promise: any;
|
||||
let prom_api__event_obj: any;
|
||||
|
||||
let disable_submit_btn = true;
|
||||
|
||||
@@ -148,9 +146,11 @@ if ($ae_loc.lu_time_zone_list && $ae_loc.lu_time_zone_list.length > 0) {
|
||||
// });
|
||||
}
|
||||
|
||||
// $ae_loc.lu_country_list = [];
|
||||
if ($ae_loc.lu_country_list && $ae_loc.lu_country_list.length > 150) {
|
||||
// console.log('Already have country list!', $ae_loc.lu_country_list);
|
||||
let lu_country_list = localStorage.getItem('lu_country_list') ? JSON.parse(localStorage.getItem('lu_country_list')) : [];
|
||||
$ae_loc.lu_country_list = [];
|
||||
// Refresh the list at least 20% of the time.
|
||||
if (lu_country_list && lu_country_list.length > 50 && Math.random() > 0.8) {
|
||||
console.log(`Already have country list! ${lu_country_list.length}`, lu_country_list);
|
||||
} else {
|
||||
console.log('No country list');
|
||||
|
||||
@@ -160,64 +160,44 @@ if ($ae_loc.lu_country_list && $ae_loc.lu_country_list.length > 150) {
|
||||
})
|
||||
.then(function (lu_country_li_get_result) {
|
||||
if (lu_country_li_get_result) {
|
||||
$ae_loc.lu_country_list = lu_country_li_get_result;
|
||||
console.log(`Country list:`, $ae_loc.lu_country_list);
|
||||
console.log($ae_loc.lu_country_list[0]);
|
||||
console.log($ae_loc.lu_country_list[10]);
|
||||
lu_country_list = lu_country_li_get_result;
|
||||
localStorage.setItem('lu_country_list', JSON.stringify(lu_country_li_get_result));
|
||||
if (log_lvl) {
|
||||
console.log(`Country list:`, lu_country_list);
|
||||
}
|
||||
} else {
|
||||
console.log(`No countries returned!`);
|
||||
$ae_loc.lu_country_list = [];
|
||||
// $ae_loc.lu_country_list = [];
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
|
||||
// let lu_country_li_get_promise = api.get_ae_obj_li_for_obj_id_crud({
|
||||
// api_cfg: $ae_api,
|
||||
// obj_type: 'lu', // "lu" = a lookup table
|
||||
// for_obj_type: 'country',
|
||||
// enabled: null,
|
||||
// hidden: null,
|
||||
// // order_by_li: {'sort': 'DESC', 'english_short_name': 'ASC'},
|
||||
// log_lvl: 1
|
||||
// })
|
||||
|
||||
// .then(function (lu_country_li_get_result) {
|
||||
// if (lu_country_li_get_result) {
|
||||
// $ae_loc.lu_country_list = lu_country_li_get_result;
|
||||
// console.log(`Country list:`, $ae_loc.lu_country_list);
|
||||
// console.log($ae_loc.lu_country_list[0]);
|
||||
// console.log($ae_loc.lu_country_list[10]);
|
||||
// } else {
|
||||
// console.log(`No countries returned!`);
|
||||
// $ae_loc.lu_country_list = [];
|
||||
// }
|
||||
// })
|
||||
// .catch(function (error) {
|
||||
// console.log('No results returned or failed.', error);
|
||||
// });
|
||||
}
|
||||
|
||||
let lu_country_subdivision_list = localStorage.getItem('lu_country_subdivision_list') ? JSON.parse(localStorage.getItem('lu_country_subdivision_list')) : [];
|
||||
$ae_loc.lu_country_subdivision_list = [];
|
||||
if ($ae_loc.lu_country_subdivision_list && $ae_loc.lu_country_subdivision_list.length > 0) {
|
||||
// console.log('Already have country subdivision list!', $ae_loc.lu_country_subdivision_list);
|
||||
// Refresh the list at least 20% of the time.
|
||||
if (lu_country_subdivision_list && lu_country_subdivision_list.length > 50 && Math.random() > 0.8) {
|
||||
console.log(`Already have country subdivision list! ${lu_country_subdivision_list.length}`, lu_country_subdivision_list);
|
||||
} else {
|
||||
console.log('No country subdivision list');
|
||||
console.log('No country subdivision list. Requesting new list.');
|
||||
|
||||
let lu_country_subdivision_li_get_promise = core_func.load_ae_obj_li__country_subdivision({
|
||||
api_cfg: $ae_api,
|
||||
log_lvl: 2
|
||||
log_lvl: 1
|
||||
})
|
||||
.then(function (lu_country_subdivision_li_get_result) {
|
||||
/* We need to save the country subdivision list to localStore */
|
||||
if (lu_country_subdivision_li_get_result) {
|
||||
$ae_loc.lu_country_subdivision_list = lu_country_subdivision_li_get_result;
|
||||
console.log(`Country subdivision list:`, $ae_loc.lu_country_subdivision_list);
|
||||
console.log($ae_loc.lu_country_subdivision_list[0]);
|
||||
console.log($ae_loc.lu_country_subdivision_list[10]);
|
||||
lu_country_subdivision_list = lu_country_subdivision_li_get_result;
|
||||
localStorage.setItem('lu_country_subdivision_list', JSON.stringify(lu_country_subdivision_li_get_result));
|
||||
if (log_lvl) {
|
||||
console.log(`Country subdivision list:`, lu_country_subdivision_list);
|
||||
}
|
||||
} else {
|
||||
console.log(`No country subdivisions returned!`);
|
||||
$ae_loc.lu_country_subdivision_list = [];
|
||||
// $ae_loc.lu_country_subdivision_list = [];
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
@@ -242,8 +222,9 @@ if ($ae_loc.lu_country_subdivision_list && $ae_loc.lu_country_subdivision_list.l
|
||||
|
||||
|
||||
$: if ($idaa_slct.event_obj) {
|
||||
console.log('Selected Event object changed?');
|
||||
console.log($idaa_slct.event_obj);
|
||||
if (log_lvl) {
|
||||
console.log('Selected Event object changed?', $idaa_slct.event_obj);
|
||||
}
|
||||
|
||||
if ($idaa_slct.event_obj == null) {
|
||||
// $idaa_slct.event_obj = {code: null, name: null, description: null, start_datetime: null, end_datetime: null, notes: null};
|
||||
@@ -261,201 +242,194 @@ async function handle_submit_form(event: any) {
|
||||
let form_data = new FormData(event.target);
|
||||
console.log(form_data);
|
||||
|
||||
let event_meeting_data = ae_util.extract_prefixed_form_data({prefix: null, form_data: form_data, trim_values: true, bool_tf_str: true, log_lvl: 0});
|
||||
console.log(event_meeting_data);
|
||||
let event_meeting_fd = ae_util.extract_prefixed_form_data({prefix: null, form_data: form_data, trim_values: true, bool_tf_str: true, log_lvl: 0});
|
||||
console.log(event_meeting_fd);
|
||||
|
||||
let event_data: key_val = {};
|
||||
let event_do: key_val = {}; // Data out for API object
|
||||
|
||||
event_data['account_id_random'] = $ae_loc.account_id;
|
||||
event_do['account_id_random'] = $ae_loc.account_id;
|
||||
|
||||
event_data['name'] = event_meeting_data.name;
|
||||
event_do['name'] = event_meeting_fd.name;
|
||||
|
||||
// Check if the description_new_html exists and is a string
|
||||
if (typeof $idaa_slct.event_obj.description_new_html === 'string') {
|
||||
console.log('New description is a string');
|
||||
event_data['description'] = $idaa_slct.event_obj.description_new_html;
|
||||
event_do['description'] = $idaa_slct.event_obj.description_new_html;
|
||||
} else {
|
||||
console.log('New description is not a string. Do nothing.');
|
||||
// event_data['description'] = event_meeting_data.description;
|
||||
// event_do['description'] = event_meeting_fd.description;
|
||||
}
|
||||
|
||||
event_data['type'] = event_meeting_data.type;
|
||||
event_data['physical'] = !!event_meeting_data.physical;
|
||||
event_data['virtual'] = !!event_meeting_data.virtual;
|
||||
event_do['type'] = event_meeting_fd.type;
|
||||
event_do['physical'] = !!event_meeting_fd.physical;
|
||||
event_do['virtual'] = !!event_meeting_fd.virtual;
|
||||
|
||||
let address: key_val = {};
|
||||
address['name'] = event_meeting_data.address_name;
|
||||
address['line_1'] = event_meeting_data.address_line_1;
|
||||
address['line_2'] = event_meeting_data.address_line_2;
|
||||
address['line_3'] = event_meeting_data.address_line_3;
|
||||
address['city'] = event_meeting_data.address_city;
|
||||
address['country_subdivision_code'] = event_meeting_data.address_country_subdivision_code;
|
||||
if (event_meeting_data.address_country_subdivision_code) {
|
||||
address['country_subdivision_code'] = event_meeting_data.address_country_subdivision_code;
|
||||
address['name'] = event_meeting_fd.address_name;
|
||||
address['line_1'] = event_meeting_fd.address_line_1;
|
||||
address['line_2'] = event_meeting_fd.address_line_2;
|
||||
address['line_3'] = event_meeting_fd.address_line_3;
|
||||
address['city'] = event_meeting_fd.address_city;
|
||||
address['country_subdivision_code'] = event_meeting_fd.address_country_subdivision_code;
|
||||
if (event_meeting_fd.address_country_subdivision_code) {
|
||||
address['country_subdivision_code'] = event_meeting_fd.address_country_subdivision_code;
|
||||
|
||||
let country_subdivision_data = ae_util.get_obj_li_w_match_prop({'obj_li': $ae_loc.lu_country_subdivision_list, 'property': 'code', 'value': event_meeting_data.address_country_subdivision_code});
|
||||
let country_subdivision_data = ae_util.get_obj_li_w_match_prop({'obj_li': lu_country_subdivision_list, 'property': 'code', 'value': event_meeting_fd.address_country_subdivision_code});
|
||||
address['state_province'] = country_subdivision_data[0].name; // Assume there is only one match
|
||||
// address['country_subdivision_name'] = country_subdivision_data[0].name;
|
||||
}
|
||||
address['postal_code'] = event_meeting_data.address_postal_code;
|
||||
if (event_meeting_data.address_country_alpha_2_code) {
|
||||
address['country_alpha_2_code'] = event_meeting_data.address_country_alpha_2_code;
|
||||
address['postal_code'] = event_meeting_fd.address_postal_code;
|
||||
if (event_meeting_fd.address_country_alpha_2_code) {
|
||||
address['country_alpha_2_code'] = event_meeting_fd.address_country_alpha_2_code;
|
||||
|
||||
let country_data = ae_util.get_obj_li_w_match_prop({'obj_li': $ae_loc.lu_country_list, 'property': 'alpha_2_code', 'value': event_meeting_data.address_country_alpha_2_code});
|
||||
let country_data = ae_util.get_obj_li_w_match_prop({'obj_li': lu_country_list, 'property': 'alpha_2_code', 'value': event_meeting_fd.address_country_alpha_2_code});
|
||||
console.log(country_data);
|
||||
address['country'] = country_data[0].english_short_name; // Assume there is only one match
|
||||
// address['country_name'] = country_data[0].english_short_name;
|
||||
}
|
||||
// event_data['location_address_json'] = address;
|
||||
event_do['location_address_json'] = address;
|
||||
|
||||
// Check if the location_text_new_html exists and is a string
|
||||
if (typeof $idaa_slct.event_obj.location_text_new_html === 'string') {
|
||||
event_data['location_text'] = $idaa_slct.event_obj.location_text_new_html;
|
||||
event_do['location_text'] = $idaa_slct.event_obj.location_text_new_html;
|
||||
} else {
|
||||
console.log('New location text is not a string. Do nothing.');
|
||||
}
|
||||
|
||||
event_data['attend_url'] = event_meeting_data.attend_url;
|
||||
event_data['attend_url_passcode'] = event_meeting_data.attend_url_passcode;
|
||||
event_data['attend_phone'] = event_meeting_data.attend_phone;
|
||||
event_data['attend_phone_passcode'] = event_meeting_data.attend_phone_passcode;
|
||||
event_do['attend_url'] = event_meeting_fd.attend_url;
|
||||
event_do['attend_url_passcode'] = event_meeting_fd.attend_url_passcode;
|
||||
event_do['attend_phone'] = event_meeting_fd.attend_phone;
|
||||
event_do['attend_phone_passcode'] = event_meeting_fd.attend_phone_passcode;
|
||||
|
||||
// Check if the attend_text_new_html exists and is a string
|
||||
if (typeof $idaa_slct.event_obj.attend_text_new_html === 'string') {
|
||||
event_data['attend_text'] = $idaa_slct.event_obj.attend_text_new_html;
|
||||
event_do['attend_text'] = $idaa_slct.event_obj.attend_text_new_html;
|
||||
} else {
|
||||
console.log('New attend text is not a string. Do nothing.');
|
||||
}
|
||||
|
||||
event_data['timezone'] = event_meeting_data.timezone;
|
||||
event_do['timezone'] = event_meeting_fd.timezone;
|
||||
|
||||
event_data['recurring'] = !!event_meeting_data.recurring;
|
||||
event_data['recurring_pattern'] = event_meeting_data.recurring_pattern;
|
||||
event_do['recurring'] = !!event_meeting_fd.recurring;
|
||||
event_do['recurring_pattern'] = event_meeting_fd.recurring_pattern;
|
||||
|
||||
// NOTE: !! converts to boolean based on truthiness
|
||||
event_data['weekday_sunday'] = !!event_meeting_data.weekday_sunday;
|
||||
event_data['weekday_monday'] = !!event_meeting_data.weekday_monday;
|
||||
event_data['weekday_tuesday'] = !!event_meeting_data.weekday_tuesday;
|
||||
event_data['weekday_wednesday'] = !!event_meeting_data.weekday_wednesday;
|
||||
event_data['weekday_thursday'] = !!event_meeting_data.weekday_thursday;
|
||||
event_data['weekday_friday'] = !!event_meeting_data.weekday_friday;
|
||||
event_data['weekday_saturday'] = !!event_meeting_data.weekday_saturday;
|
||||
// event_data['weekday_sunday'] = event_meeting_data.weekday_sunday;
|
||||
// event_data['weekday_monday'] = event_meeting_data.weekday_monday;
|
||||
// event_data['weekday_tuesday'] = event_meeting_data.weekday_tuesday;
|
||||
// event_data['weekday_wednesday'] = event_meeting_data.weekday_wednesday;
|
||||
// event_data['weekday_thursday'] = event_meeting_data.weekday_thursday;
|
||||
// event_data['weekday_friday'] = event_meeting_data.weekday_friday;
|
||||
// event_data['weekday_saturday'] = event_meeting_data.weekday_saturday;
|
||||
event_do['weekday_sunday'] = !!event_meeting_fd.weekday_sunday;
|
||||
event_do['weekday_monday'] = !!event_meeting_fd.weekday_monday;
|
||||
event_do['weekday_tuesday'] = !!event_meeting_fd.weekday_tuesday;
|
||||
event_do['weekday_wednesday'] = !!event_meeting_fd.weekday_wednesday;
|
||||
event_do['weekday_thursday'] = !!event_meeting_fd.weekday_thursday;
|
||||
event_do['weekday_friday'] = !!event_meeting_fd.weekday_friday;
|
||||
event_do['weekday_saturday'] = !!event_meeting_fd.weekday_saturday;
|
||||
|
||||
if (event_meeting_data['recurring_start_time'] ) {
|
||||
event_data['recurring_start_time'] = event_meeting_data.recurring_start_time;
|
||||
if (event_meeting_fd['recurring_start_time'] ) {
|
||||
event_do['recurring_start_time'] = event_meeting_fd.recurring_start_time;
|
||||
}
|
||||
if (event_meeting_data['recurring_end_time']) {
|
||||
event_data['recurring_end_time'] = event_meeting_data.recurring_end_time;
|
||||
if (event_meeting_fd['recurring_end_time']) {
|
||||
event_do['recurring_end_time'] = event_meeting_fd.recurring_end_time;
|
||||
}
|
||||
|
||||
// Check if the recurring_text_new_html exists and is a string
|
||||
if (typeof $idaa_slct.event_obj.recurring_text_new_html === 'string') {
|
||||
event_data['recurring_text'] = $idaa_slct.event_obj.recurring_text_new_html;
|
||||
event_do['recurring_text'] = $idaa_slct.event_obj.recurring_text_new_html;
|
||||
} else {
|
||||
console.log('New recurring text is not a string. Do nothing.');
|
||||
}
|
||||
|
||||
console.log(event_data['recurring_text']);
|
||||
if (!event_data['recurring_text'] || event_data['recurring_text'].includes('*gen*')) {
|
||||
console.log(event_do['recurring_text']);
|
||||
if (!event_do['recurring_text'] || event_do['recurring_text'].includes('*gen*')) {
|
||||
let days_of_week = [];
|
||||
if (event_data['weekday_sunday']) {
|
||||
if (event_do['weekday_sunday']) {
|
||||
days_of_week.push('Sunday');
|
||||
}
|
||||
if (event_data['weekday_monday']) {
|
||||
if (event_do['weekday_monday']) {
|
||||
days_of_week.push('Monday');
|
||||
}
|
||||
if (event_data['weekday_tuesday']) {
|
||||
if (event_do['weekday_tuesday']) {
|
||||
days_of_week.push('Tuesday');
|
||||
}
|
||||
if (event_data['weekday_wednesday']) {
|
||||
if (event_do['weekday_wednesday']) {
|
||||
days_of_week.push('Wednesday');
|
||||
}
|
||||
if (event_data['weekday_thursday']) {
|
||||
if (event_do['weekday_thursday']) {
|
||||
days_of_week.push('Thursday');
|
||||
}
|
||||
if (event_data['weekday_friday']) {
|
||||
if (event_do['weekday_friday']) {
|
||||
days_of_week.push('Friday');
|
||||
}
|
||||
if (event_data['weekday_saturday']) {
|
||||
if (event_do['weekday_saturday']) {
|
||||
days_of_week.push('Saturday');
|
||||
}
|
||||
|
||||
let current_date_iso = ae_util.iso_datetime_formatter(new Date(), 'YYYY-MM-DD');
|
||||
|
||||
// event_data['recurring_text'] = `This meeting occurs every ${days_of_week.join(', ')} at ${ae_util.iso_datetime_formatter(`${current_date_iso} ${event_data['recurring_start_time']}`, 'time_short_no_leading')} to ${ae_util.iso_datetime_formatter(`${current_date_iso} ${event_data['recurring_end_time']}`, 'time_short_no_leading')}.`;
|
||||
// event_do['recurring_text'] = `This meeting occurs every ${days_of_week.join(', ')} at ${ae_util.iso_datetime_formatter(`${current_date_iso} ${event_do['recurring_start_time']}`, 'time_short_no_leading')} to ${ae_util.iso_datetime_formatter(`${current_date_iso} ${event_do['recurring_end_time']}`, 'time_short_no_leading')}.`;
|
||||
|
||||
// event_data['recurring_text'] = `This meeting occurs every ${days_of_week.join(', ')} at ${ae_util.iso_datetime_formatter(`${current_date_iso} ${event_data['recurring_start_time']}`, 'time_short_no_leading')}.`;
|
||||
// event_do['recurring_text'] = `This meeting occurs every ${days_of_week.join(', ')} at ${ae_util.iso_datetime_formatter(`${current_date_iso} ${event_do['recurring_start_time']}`, 'time_short_no_leading')}.`;
|
||||
|
||||
event_data['recurring_text'] = `*gen* ${days_of_week.join(', ')} at ${ae_util.iso_datetime_formatter(`${current_date_iso} ${event_data['recurring_start_time']}`, 'time_short_no_leading')}`;
|
||||
event_do['recurring_text'] = `*gen* ${days_of_week.join(', ')} at ${ae_util.iso_datetime_formatter(`${current_date_iso} ${event_do['recurring_start_time']}`, 'time_short_no_leading')}`;
|
||||
}
|
||||
|
||||
event_data['external_person_id'] = event_meeting_data.external_person_id; // NOTE: Defaults to the Novi user that created/owns this event
|
||||
event_do['external_person_id'] = event_meeting_fd.external_person_id; // NOTE: Defaults to the Novi user that created/owns this event
|
||||
|
||||
event_data['contact_li_json'] = [];
|
||||
event_do['contact_li_json'] = [];
|
||||
let contact_1: key_val = {};
|
||||
// contact_1['external_person_id'] = event_meeting_data.external_person_id; // NOTE: From the Novi user that created/owns this event
|
||||
contact_1['full_name'] = event_meeting_data.contact_1_full_name; // NOTE: From the Novi user that created/owns this event
|
||||
contact_1['email'] = event_meeting_data.contact_1_email; // NOTE: From the Novi user that created/owns this event
|
||||
if (event_meeting_data.contact_1_phone_mobile) {
|
||||
contact_1['phone_mobile'] = event_meeting_data.contact_1_phone_mobile; // NOTE: From the Novi user that created/owns this event, but allow them to change or hide it
|
||||
// contact_1['external_person_id'] = event_meeting_fd.external_person_id; // NOTE: From the Novi user that created/owns this event
|
||||
contact_1['full_name'] = event_meeting_fd.contact_1_full_name; // NOTE: From the Novi user that created/owns this event
|
||||
contact_1['email'] = event_meeting_fd.contact_1_email; // NOTE: From the Novi user that created/owns this event
|
||||
if (event_meeting_fd.contact_1_phone_mobile) {
|
||||
contact_1['phone_mobile'] = event_meeting_fd.contact_1_phone_mobile; // NOTE: From the Novi user that created/owns this event, but allow them to change or hide it
|
||||
}
|
||||
if (event_meeting_data.contact_1_phone_home) {
|
||||
contact_1['phone_home'] = event_meeting_data.contact_1_phone_home;
|
||||
if (event_meeting_fd.contact_1_phone_home) {
|
||||
contact_1['phone_home'] = event_meeting_fd.contact_1_phone_home;
|
||||
}
|
||||
if (event_meeting_data.contact_1_phone_office) {
|
||||
contact_1['phone_office'] = event_meeting_data.contact_1_phone_office;
|
||||
if (event_meeting_fd.contact_1_phone_office) {
|
||||
contact_1['phone_office'] = event_meeting_fd.contact_1_phone_office;
|
||||
}
|
||||
// event_data['contact_li_json'].push(contact_1);
|
||||
event_do['contact_li_json'].push(contact_1);
|
||||
|
||||
let contact_2: key_val = {};
|
||||
contact_2['full_name'] = event_meeting_data.contact_2_full_name;
|
||||
contact_2['email'] = event_meeting_data.contact_2_email;
|
||||
if (event_meeting_data.contact_2_phone_mobile) {
|
||||
contact_2['phone_mobile'] = event_meeting_data.contact_2_phone_mobile;
|
||||
contact_2['full_name'] = event_meeting_fd.contact_2_full_name;
|
||||
contact_2['email'] = event_meeting_fd.contact_2_email;
|
||||
if (event_meeting_fd.contact_2_phone_mobile) {
|
||||
contact_2['phone_mobile'] = event_meeting_fd.contact_2_phone_mobile;
|
||||
}
|
||||
if (event_meeting_data.contact_2_phone_home) {
|
||||
contact_2['phone_home'] = event_meeting_data.contact_2_phone_home;
|
||||
if (event_meeting_fd.contact_2_phone_home) {
|
||||
contact_2['phone_home'] = event_meeting_fd.contact_2_phone_home;
|
||||
}
|
||||
if (event_meeting_data.contact_2_phone_office) {
|
||||
contact_2['phone_office'] = event_meeting_data.contact_2_phone_office;
|
||||
if (event_meeting_fd.contact_2_phone_office) {
|
||||
contact_2['phone_office'] = event_meeting_fd.contact_2_phone_office;
|
||||
}
|
||||
// event_data['contact_li_json'].push(contact_2);
|
||||
event_do['contact_li_json'].push(contact_2);
|
||||
|
||||
event_data['hide'] = !!event_meeting_data.hide;
|
||||
event_data['priority'] = !!event_meeting_data.priority;
|
||||
if (event_meeting_data['sort']) {
|
||||
event_data['sort'] = Number(event_meeting_data.sort);
|
||||
event_do['hide'] = !!event_meeting_fd.hide;
|
||||
event_do['priority'] = !!event_meeting_fd.priority;
|
||||
if (event_meeting_fd['sort']) {
|
||||
event_do['sort'] = Number(event_meeting_fd.sort);
|
||||
}
|
||||
if (event_data['group']) {
|
||||
event_data['group'] = event_meeting_data.group;
|
||||
if (event_meeting_fd['group']) {
|
||||
event_do['group'] = event_meeting_fd.group;
|
||||
} else {
|
||||
event_data['group'] = null;
|
||||
event_do['group'] = null;
|
||||
}
|
||||
if (event_meeting_data['enable']) {
|
||||
event_data['enable'] = !!event_meeting_data.enable;
|
||||
if (event_meeting_fd['enable']) {
|
||||
event_do['enable'] = !!event_meeting_fd.enable;
|
||||
}
|
||||
|
||||
// Check if the notes_new_html exists and is a string
|
||||
if (typeof $idaa_slct.event_obj.notes_new_html === 'string') {
|
||||
event_data['notes'] = $idaa_slct.event_obj.notes_new_html;
|
||||
event_do['notes'] = $idaa_slct.event_obj.notes_new_html;
|
||||
} else {
|
||||
console.log('New notes is not a string. Do nothing.');
|
||||
}
|
||||
|
||||
console.log(event_data);
|
||||
console.log(event_do);
|
||||
|
||||
if (!$idaa_slct.event_id) {
|
||||
create_event_obj_promise = api.create_ae_obj_crud({
|
||||
prom_api__event_obj = api.create_ae_obj_crud({
|
||||
api_cfg: $ae_api,
|
||||
obj_type: 'event',
|
||||
fields: event_data,
|
||||
fields: event_do,
|
||||
key: $ae_api.api_crud_super_key,
|
||||
log_lvl: 2
|
||||
})
|
||||
@@ -483,30 +457,19 @@ async function handle_submit_form(event: any) {
|
||||
return false;
|
||||
});
|
||||
|
||||
return create_event_obj_promise;
|
||||
return prom_api__event_obj;
|
||||
|
||||
} else {
|
||||
events_func.update_ae_obj__event({
|
||||
prom_api__event_obj = events_func.update_ae_obj__event({
|
||||
api_cfg: $ae_api,
|
||||
event_id: $idaa_slct.event_id,
|
||||
data_kv: event_data,
|
||||
data_kv: event_do,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
|
||||
|
||||
|
||||
// update_event_obj_promise = api.update_ae_obj_id_crud({
|
||||
// api_cfg: $ae_api,
|
||||
// obj_type: 'event',
|
||||
// obj_id: $idaa_slct.event_id,
|
||||
// fields: event_data,
|
||||
// key: $ae_api.api_crud_super_key,
|
||||
// return_obj: true,
|
||||
// log_lvl: 2
|
||||
// })
|
||||
.then(function (event_obj_update_result) {
|
||||
if (!event_obj_update_result) {
|
||||
console.log('The result was null or false.');
|
||||
disable_submit_btn = false; // Enable the submit button even if something didn't go right
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -527,40 +490,9 @@ async function handle_submit_form(event: any) {
|
||||
return false;
|
||||
});
|
||||
|
||||
return update_event_obj_promise;
|
||||
return prom_api__event_obj;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// if (!$idaa_slct.event_id) {
|
||||
// event_meeting_data['event_id_random'] = $idaa_slct.event_id;
|
||||
// event_meeting_data['enable'] = true;
|
||||
|
||||
// create_event_obj_promise = await create_event_obj({event_id: $idaa_slct.event_id, data: event_meeting_data})
|
||||
// console.log(create_event_obj_promise);
|
||||
// $idaa_slct.event_id = create_event_obj_promise;
|
||||
|
||||
// dispatch(
|
||||
// 'created__event_obj',
|
||||
// {
|
||||
// event_id: $idaa_slct.event_id,
|
||||
// }
|
||||
// );
|
||||
// } else {
|
||||
// update_event_obj_promise = await update_event_obj({event_id: $idaa_slct.event_id, data: event_meeting_data, log_lvl: 0})
|
||||
// console.log(update_event_obj_promise);
|
||||
|
||||
// dispatch(
|
||||
// 'updated__event_obj',
|
||||
// {
|
||||
// event_id: $idaa_slct.event_id,
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
|
||||
// post_promise = null;
|
||||
// update_event_obj_promise = null;
|
||||
|
||||
disable_submit_btn = false;
|
||||
|
||||
return true;
|
||||
@@ -569,7 +501,7 @@ async function handle_submit_form(event: any) {
|
||||
async function handle_delete_event_obj({event_id, method='disable'}) {
|
||||
console.log('*** handle_delete_event_obj() ***');
|
||||
|
||||
delete_event_obj_promise = api.delete_ae_obj_id_crud({
|
||||
prom_api__event_obj = api.delete_ae_obj_id_crud({
|
||||
api_cfg: $ae_api,
|
||||
obj_type: 'event',
|
||||
obj_id: event_id,
|
||||
@@ -594,7 +526,7 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
||||
console.log('The result was null or false when trying to delete.', error);
|
||||
});
|
||||
|
||||
return delete_event_obj_promise;
|
||||
return prom_api__event_obj;
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -607,11 +539,11 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
||||
|
||||
<form on:submit|preventDefault={handle_submit_form} class="space-y-1">
|
||||
|
||||
{#await update_event_obj_promise}
|
||||
{#await prom_api__event_obj}
|
||||
<div class="awaiting alert_msg_pulse" out:fade={{ duration: 2000 }}>Saving...</div>
|
||||
{:then}
|
||||
{#if update_event_obj_promise}
|
||||
<div class="awaiting" out:fade={{ duration: 2000 }}>Finished saving</div>
|
||||
{#if prom_api__event_obj}
|
||||
<!-- <div class="awaiting" out:fade={{ duration: 2000 }}>Finished saving</div> -->
|
||||
{:else}
|
||||
<!-- <div class="awaiting" out:fade={{ duration: 2000 }}>Nothing here yet</div> -->
|
||||
{/if}
|
||||
@@ -622,9 +554,13 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
||||
<button
|
||||
type="submit"
|
||||
disabled={(disable_submit_btn)}
|
||||
class="ae_btn btn_primary btn btn-primary variant-ghost-primary hover:variant-filled-primary transition"
|
||||
class="ae_btn btn_primary btn btn-primary variant-ghost-primary hover:variant-filled-primary transition absolute top-0.5 right-0.5"
|
||||
>
|
||||
<span class="fas fa-check m-1"></span> Save?
|
||||
{#await prom_api__event_obj}
|
||||
<span class="fas fa-spinner fa-spin m-1"></span> Saving
|
||||
{:then}
|
||||
<span class="fas fa-save m-1"></span> Save
|
||||
{/await}
|
||||
</button>
|
||||
{/if}
|
||||
</section> <!-- END: section event__options -->
|
||||
@@ -640,13 +576,14 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
||||
</label>
|
||||
|
||||
<label for="description" class="ae_label event__description">Short description
|
||||
<!-- <textarea name="description" id="description" class="ae_value event__description tinymce_editor editor_basic textarea" rows="5" cols="70" bind:value={$idaa_slct.event_obj.description} placeholder="A short description or overview of this recovery meeting"></textarea> -->
|
||||
<!-- <textarea name="description" id="description" class="ae_value event__description tinymce_editor editor_basic textarea" rows="5" cols="70" bind:value={$idaa_slct.event_obj.description} ></textarea> -->
|
||||
|
||||
<Tiptap_editor
|
||||
default_minimal={true}
|
||||
bind:html_text={$idaa_slct.event_obj.description}
|
||||
show_button_kv={{'heading__h1': false, 'heading__h2': false, 'heading__h3': false}}
|
||||
bind:new_html={$idaa_slct.event_obj.description_new_html}
|
||||
placeholder="A short description or overview of this recovery meeting"
|
||||
/>
|
||||
|
||||
<!-- {@html $idaa_slct.event_obj?.description_new_html ?? 'not sure?'} -->
|
||||
@@ -760,12 +697,17 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
||||
<input type="text" class="input w-40" id="address_city" name="address_city" placeholder="Name of the city" value="{($lq__event_obj?.location_address_json && $lq__event_obj?.location_address_json.city ? $lq__event_obj?.location_address_json.city : $lq__event_obj?.address_city ?? '')}" autocomplete="address-level2">
|
||||
</label>
|
||||
|
||||
{#if $ae_loc.lu_country_subdivision_list}
|
||||
{#if lu_country_subdivision_list}
|
||||
<label for="address_country_subdivision_code" class="">State or province
|
||||
<select class="select w-56" id="address_country_subdivision_code" name="address_country_subdivision_code" title="Select the state or province for the meeting">
|
||||
<select
|
||||
id="address_country_subdivision_code"
|
||||
name="address_country_subdivision_code"
|
||||
value="{($lq__event_obj?.location_address_json && $lq__event_obj?.location_address_json.country_subdivision_code ? $lq__event_obj?.location_address_json.country_subdivision_code : $lq__event_obj?.address_country_subdivision_code ?? '')}"
|
||||
class="select w-56"
|
||||
title="Select the state or province for the meeting">
|
||||
<option value="">-- None --</option>
|
||||
{#each $ae_loc.lu_country_subdivision_list as lu_country_subdivision}
|
||||
<option value="{lu_country_subdivision.code}" selected={(($lq__event_obj?.location_address_json && lu_country_subdivision.code == $lq__event_obj?.location_address_json.country_subdivision_code) || ( lu_country_subdivision.code == $lq__event_obj?.address_country_subdivision_code) ? 'selected' : '')}>{lu_country_subdivision.country_alpha_2_code} - {lu_country_subdivision.name}</option>
|
||||
{#each lu_country_subdivision_list as lu_country_subdivision}
|
||||
<option value="{lu_country_subdivision.code}">{lu_country_subdivision.country_alpha_2_code} - {lu_country_subdivision.name}</option>
|
||||
{/each}
|
||||
</select>
|
||||
</label>
|
||||
@@ -779,12 +721,17 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
||||
<input type="text" class="input w-32" id="address_postal_code" name="address_postal_code" placeholder="Postal code or zip code" value="{($lq__event_obj?.location_address_json && $lq__event_obj?.location_address_json.postal_code ? $lq__event_obj?.location_address_json.postal_code : $lq__event_obj?.address_postal_code ?? '')}" autocomplete="postal-code">
|
||||
</label>
|
||||
|
||||
{#if $ae_loc.lu_country_list}
|
||||
{#if lu_country_list}
|
||||
<label for="address_country_alpha_2_code" class="">Country
|
||||
<select class="select w-56" id="address_country_alpha_2_code" name="address_country_alpha_2_code" title="Select the country for the meeting">
|
||||
<select
|
||||
id="address_country_alpha_2_code"
|
||||
name="address_country_alpha_2_code"
|
||||
value="{($lq__event_obj?.location_address_json && $lq__event_obj?.location_address_json.country_alpha_2_code ? $lq__event_obj?.location_address_json.country_alpha_2_code : $lq__event_obj?.address_country_alpha_2_code ?? '')}"
|
||||
class="select w-64"
|
||||
title="Select the country for the meeting">
|
||||
<option value="">-- None --</option>
|
||||
{#each $ae_loc.lu_country_list as lu_country}
|
||||
<option value="{lu_country.alpha_2_code}" selected={(($lq__event_obj?.location_address_json && lu_country.alpha_2_code == $lq__event_obj?.location_address_json.country_alpha_2_code) || (lu_country.alpha_2_code == $lq__event_obj?.address_country_alpha_2_code) ? 'selected' : '')}>{lu_country.english_short_name}</option>
|
||||
{#each lu_country_list as lu_country}
|
||||
<option value="{lu_country.alpha_2_code}">{lu_country.english_short_name}</option>
|
||||
{/each}
|
||||
</select>
|
||||
</label>
|
||||
@@ -824,7 +771,9 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
||||
<fieldset
|
||||
id="virtual"
|
||||
class="virtual space-y-1"
|
||||
class:ae_d_none={!$idaa_slct.event_obj.virtual}>
|
||||
class:ae_d_none={!$idaa_slct.event_obj.virtual}
|
||||
class:hidden={!$idaa_slct.event_obj.virtual}
|
||||
>
|
||||
<legend>Virtual/Online</legend>
|
||||
|
||||
<label for="attend_url">URL to access the virtual meeting
|
||||
@@ -921,14 +870,34 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="event__days_of_week">
|
||||
<label><input type="checkbox" name="weekday_sunday" value={$lq__event_obj?.weekday_sunday} bind:checked={($idaa_slct.event_obj.weekday_sunday)} class="checkbox">
|
||||
Sunday</label>
|
||||
<label><input type="checkbox" name="weekday_monday" value={$lq__event_obj?.weekday_monday} bind:checked={($idaa_slct.event_obj.weekday_monday)} class="checkbox"> Monday</label>
|
||||
<label><input type="checkbox" name="weekday_tuesday" value={$lq__event_obj?.weekday_tuesday} bind:checked={($idaa_slct.event_obj.weekday_tuesday)} class="checkbox"> Tuesday</label>
|
||||
<label><input type="checkbox" name="weekday_wednesday" value={$lq__event_obj?.weekday_wednesday} bind:checked={($idaa_slct.event_obj.weekday_wednesday)} class="checkbox"> Wednesday</label>
|
||||
<label><input type="checkbox" name="weekday_thursday" value={$lq__event_obj?.weekday_thursday} bind:checked={($idaa_slct.event_obj.weekday_thursday)} class="checkbox"> Thursday</label>
|
||||
<label><input type="checkbox" name="weekday_friday" value={$lq__event_obj?.weekday_friday} bind:checked={($idaa_slct.event_obj.weekday_friday)} class="checkbox"> Friday</label>
|
||||
<label><input type="checkbox" name="weekday_saturday" value={$lq__event_obj?.weekday_saturday} bind:checked={($idaa_slct.event_obj.weekday_saturday)} class="checkbox"> Saturday</label>
|
||||
<label>
|
||||
<input type="checkbox" name="weekday_sunday" value="Sunday" bind:checked={($idaa_slct.event_obj.weekday_sunday)} class="checkbox">
|
||||
Sunday
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" name="weekday_monday" value="Monday" bind:checked={($idaa_slct.event_obj.weekday_monday)} class="checkbox">
|
||||
Monday
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" name="weekday_tuesday" value="Tuesday" bind:checked={($idaa_slct.event_obj.weekday_tuesday)} class="checkbox">
|
||||
Tuesday
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" name="weekday_wednesday" value="Wednesday" bind:checked={($idaa_slct.event_obj.weekday_wednesday)} class="checkbox">
|
||||
Wednesday
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" name="weekday_thursday" value="Thursday" bind:checked={($idaa_slct.event_obj.weekday_thursday)} class="checkbox">
|
||||
Thursday
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" name="weekday_friday" value="Friday" bind:checked={($idaa_slct.event_obj.weekday_friday)} class="checkbox">
|
||||
Friday
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" name="weekday_saturday" value="Saturday" bind:checked={($idaa_slct.event_obj.weekday_saturday)} class="checkbox">
|
||||
Saturday
|
||||
</label>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="flex_row flex_gap_md flex_justify_around">
|
||||
@@ -1058,13 +1027,16 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
||||
|
||||
<span class="ae_group">
|
||||
|
||||
{#if !($ae_loc.trusted_access || $lq__event_obj?.contact_li_json[0].unlock)}
|
||||
{#if !($ae_loc.administrator_access || $idaa_slct.event_obj?.contact_li_json[0]?.unlock)}
|
||||
<button type="button" class="ae_btn ae_smaller ae_btn_info"
|
||||
on:click|preventDefault={() => {
|
||||
if (confirm('Are you sure you want to lock these fields? The primary contact name and email address are required.')) {
|
||||
$lq__event_obj.contact_li_json[0].unlock = true;
|
||||
if (!$idaa_slct.event_obj.contact_li_json[0]) {
|
||||
$idaa_slct.event_obj.contact_li_json[0] = {};
|
||||
}
|
||||
$idaa_slct.event_obj.contact_li_json[0].unlock = true;
|
||||
} else {
|
||||
$lq__event_obj.contact_li_json[0].unlock = false;
|
||||
$idaa_slct.event_obj.contact_li_json[0].unlock = false;
|
||||
return false;
|
||||
}
|
||||
}}
|
||||
@@ -1074,7 +1046,7 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
||||
{:else}
|
||||
<button type="button" class="ae_btn ae_smaller ae_btn_info"
|
||||
on:click|preventDefault={() => {
|
||||
$lq__event_obj.contact_li_json[0].unlock = false;
|
||||
$idaa_slct.event_obj.contact_li_json[0].unlock = false;
|
||||
}}
|
||||
>
|
||||
<span class="fas fa-unlock" title="Field is unlocked"></span>
|
||||
@@ -1083,7 +1055,7 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
||||
{/if}
|
||||
|
||||
<label for="contact_1_full_name">Full name
|
||||
{#if !($ae_loc.trusted_access || $lq__event_obj?.contact_li_json[0].unlock)}
|
||||
{#if !($ae_loc.administrator_access || $idaa_slct.event_obj?.contact_li_json[0]?.unlock)}
|
||||
<span class="fas fa-lock" title="Field is locked"></span>
|
||||
{:else}
|
||||
<span class="fas fa-unlock" title="Field is unlocked"></span>
|
||||
@@ -1095,12 +1067,12 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
||||
placeholder="Full name"
|
||||
value={($lq__event_obj?.contact_li_json && $lq__event_obj?.contact_li_json[0] && $lq__event_obj?.contact_li_json[0].full_name ? $lq__event_obj?.contact_li_json[0].full_name : '')}
|
||||
autocomplete="name"
|
||||
readonly={!($ae_loc.trusted_access || $lq__event_obj?.contact_li_json[0].unlock)}
|
||||
readonly={!($ae_loc.trusted_access || $idaa_slct.event_obj?.contact_li_json[0]?.unlock)}
|
||||
required={!$ae_loc.trusted_access}
|
||||
>
|
||||
</label>
|
||||
<label for="contact_1_email">Email
|
||||
{#if !($ae_loc.trusted_access || $lq__event_obj?.contact_li_json[0].unlock)}
|
||||
{#if !($ae_loc.administrator_access || $idaa_slct.event_obj?.contact_li_json[0]?.unlock)}
|
||||
<span class="fas fa-lock" title="Field is locked"></span>
|
||||
{:else}
|
||||
<span class="fas fa-unlock" title="Field is unlocked"></span>
|
||||
@@ -1113,7 +1085,7 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
||||
placeholder="Email"
|
||||
value={($lq__event_obj?.contact_li_json && $lq__event_obj?.contact_li_json[0] && $lq__event_obj?.contact_li_json[0].email ? $lq__event_obj?.contact_li_json[0].email : '')}
|
||||
autocomplete="email"
|
||||
readonly={!($ae_loc.trusted_access || $lq__event_obj?.contact_li_json[0].unlock)}
|
||||
readonly={!($ae_loc.trusted_access || $idaa_slct.event_obj?.contact_li_json[0].unlock)}
|
||||
required={!$ae_loc.trusted_access}
|
||||
>
|
||||
</label>
|
||||
@@ -1173,12 +1145,12 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
||||
}}
|
||||
>
|
||||
<span class="fas fa-eye m-1"></span>
|
||||
Show/Hide Admin
|
||||
{$idaa_loc.show__admin_options ? 'Hide' : 'Show'} Admin?
|
||||
</button>
|
||||
</h3>
|
||||
|
||||
<span
|
||||
class:hidden={!$ae_loc.trusted_access && !$idaa_loc.show__admin_options}
|
||||
class:hidden={!$ae_loc.trusted_access || !$idaa_loc.show__admin_options}
|
||||
>
|
||||
|
||||
<span
|
||||
@@ -1264,7 +1236,11 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
||||
disabled={(disable_submit_btn)}
|
||||
class="ae_btn btn_primary btn btn-primary variant-ghost-primary hover:variant-filled-primary transition"
|
||||
>
|
||||
<span class="fas fa-check m-1"></span> Save
|
||||
{#await prom_api__event_obj}
|
||||
<span class="fas fa-spinner fa-spin m-1"></span> Saving
|
||||
{:then}
|
||||
<span class="fas fa-save m-1"></span> Save
|
||||
{/await}
|
||||
</button>
|
||||
{:else}
|
||||
<button
|
||||
@@ -1276,7 +1252,11 @@ async function handle_delete_event_obj({event_id, method='disable'}) {
|
||||
}}
|
||||
class="ae_btn btn_primary btn btn-primary variant-ghost-primary hover:variant-filled-primary transition"
|
||||
>
|
||||
<span class="fas fa-plus m-1"></span> Save New Event
|
||||
{#await prom_api__event_obj}
|
||||
<span class="fas fa-spinner fa-spin m-1"></span> Saving
|
||||
{:then}
|
||||
<span class="fas fa-plus m-1"></span> Save New Event
|
||||
{/await}
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
|
||||
@@ -40,30 +40,22 @@ onMount(() => {
|
||||
</script>
|
||||
|
||||
|
||||
<section class="svelte_component ae_section ae_view event_obj view__event_obj {container_class_li.join(' ')}">
|
||||
<section class={`svelte_component ae_section ae_view event_obj view__event_obj ${container_class_li.join(' ')}`}>
|
||||
|
||||
<!-- <div class="event__header">
|
||||
<h2 class="event__name">{@html $lq__event_obj?.name}</h2>
|
||||
</div> -->
|
||||
<div class="p-2 bg-white shadow-md rounded-lg">
|
||||
<div class="meeting_description description mb-4">
|
||||
<div class="ae_label event__description font-semibold text-lg mb-2">Description:</div>
|
||||
<pre class="ae_value event__description text-wrap font-normal whitespace-pre-wrap">{@html $lq__event_obj?.description}</pre>
|
||||
</div>
|
||||
|
||||
<div class="event__content">
|
||||
<div
|
||||
class="meeting_description description"
|
||||
>
|
||||
<div class="ae_label event__description">Description:</div>
|
||||
<pre class="ae_value event__description">{@html $lq__event_obj?.description}</pre>
|
||||
<div class:ae_d_none={!$lq__event_obj?.type} class="meeting_type mb-4">
|
||||
<span class="ae_label font-semibold text-lg">Type of Recovery Meeting:</span>
|
||||
<span class="ae_value ml-2">{$lq__event_obj?.type}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class:ae_d_none={!$lq__event_obj?.type}
|
||||
class="meeting_type"
|
||||
>
|
||||
<span class="ae_label">Type of Recovery Meeting:</span>
|
||||
<span class="ae_value">{$lq__event_obj?.type}</span>
|
||||
</div>
|
||||
|
||||
<div class="meeting_physical_virtual how_to_attended">
|
||||
|
||||
<div class="p-2 bg-white shadow-md rounded-lg meeting_physical_virtual how_to_attended">
|
||||
<div class="col-6 meeting_physical"
|
||||
class:ae_d_none={(!$lq__event_obj?.address_city && !$lq__event_obj?.location_address_json) || ($lq__event_obj?.location_address_json && !$lq__event_obj?.location_address_json.city && !$lq__event_obj?.location_address_json.country_subdivision_code && !$lq__event_obj?.location_address_json.postal_code)}
|
||||
>
|
||||
@@ -167,7 +159,8 @@ onMount(() => {
|
||||
|
||||
</div>
|
||||
|
||||
<div class="meeting_when">
|
||||
|
||||
<div class="p-2 bg-white shadow-md rounded-lg meeting_when">
|
||||
|
||||
<div class="meeting_recurring"
|
||||
class:ae_d_none={!$lq__event_obj?.recurring}
|
||||
@@ -253,7 +246,7 @@ onMount(() => {
|
||||
</div>
|
||||
|
||||
|
||||
<div class="ae_list event__contacts">
|
||||
<div class="p-2 bg-white shadow-md rounded-lg ae_list event__contacts">
|
||||
|
||||
{#if $lq__event_obj?.contact_li_json && $lq__event_obj?.contact_li_json.length && $lq__event_obj?.contact_li_json[0].full_name}
|
||||
<div class="event__contact"
|
||||
@@ -311,53 +304,27 @@ onMount(() => {
|
||||
|
||||
</div>
|
||||
|
||||
<section class="ae_section ae_meta event__meta">
|
||||
<div class="ae_group">
|
||||
<span
|
||||
class="event__id"
|
||||
class:ae_d_none={!$ae_loc.administrator_access}>
|
||||
ID:
|
||||
{$lq__event_obj?.event_id_random}
|
||||
</span>
|
||||
<span
|
||||
class="event__created_on"
|
||||
>
|
||||
Created on: {ae_util.iso_datetime_formatter($lq__event_obj?.created_on, 'datetime_short')}
|
||||
</span>
|
||||
<span
|
||||
class="event__updated_on"
|
||||
class:ae_d_none={!$lq__event_obj?.updated_on}
|
||||
>
|
||||
Updated on: {ae_util.iso_datetime_formatter($lq__event_obj?.updated_on, 'datetime_short')}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{#if $ae_loc.trusted_access || $lq__event_obj?.external_person_id === $ae_loc.novi_uuid || $lq__event_obj?.contact_li_json[0].email === $ae_loc.novi_email}
|
||||
<div class="ae_options">
|
||||
<button
|
||||
on:click={() => {
|
||||
// $idaa_slct.event_id = $lq__event_obj?.event_id_random;
|
||||
// $lq__event_obj = $lq__event_obj;
|
||||
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.set('event_id', $lq__event_obj?.event_id_random);
|
||||
// history.pushState({}, '', url);
|
||||
|
||||
// $idaa_loc.recovery_meetings.show_main__options = true;
|
||||
// $idaa_loc.recovery_meetings.show_list__event_obj_li = true;
|
||||
$idaa_loc.recovery_meetings.show_view__event_obj = false;
|
||||
$idaa_loc.recovery_meetings.show_edit__event_obj = true;
|
||||
}}
|
||||
class="btn btn-sm variant-ghost-warning hover:variant-filled-warning transition"
|
||||
title={`Edit meeting: ${$lq__event_obj?.name}`}
|
||||
>
|
||||
<span class="fas fa-edit"></span> Edit
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
<section class="ae_section ae_meta event__meta text-sm text-gray-500 mt-4 flex flex-row gap-2 items-center justify-center">
|
||||
<span
|
||||
class="event__id"
|
||||
class:ae_d_none={!$ae_loc.administrator_access}>
|
||||
ID:
|
||||
{$lq__event_obj?.event_id_random}
|
||||
</span>
|
||||
<span
|
||||
class="event__created_on"
|
||||
>
|
||||
Created on: {ae_util.iso_datetime_formatter($lq__event_obj?.created_on, 'datetime_short')}
|
||||
</span>
|
||||
<span
|
||||
class="event__updated_on"
|
||||
class:ae_d_none={!$lq__event_obj?.updated_on}
|
||||
>
|
||||
Updated on: {ae_util.iso_datetime_formatter($lq__event_obj?.updated_on, 'datetime_short')}
|
||||
</span>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
|
||||
</section>
|
||||
|
||||
@@ -365,6 +332,7 @@ onMount(() => {
|
||||
<style>
|
||||
.ae_label {
|
||||
font-size: smaller;
|
||||
color: #777;
|
||||
}
|
||||
.ae_value {
|
||||
font-weight: bold;
|
||||
@@ -376,7 +344,7 @@ onMount(() => {
|
||||
}
|
||||
|
||||
.event_obj .ae_meta {
|
||||
flex-direction: column;
|
||||
/* flex-direction: column; */
|
||||
/* justify-content: space-between; */
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,10 @@ onMount(() => {
|
||||
console.log('** AE IDAA Mounted: ** Query - Recovery Meeting (Event) Obj');
|
||||
});
|
||||
|
||||
if ($idaa_loc.recovery_meetings.qry__fulltext_str && $idaa_loc.recovery_meetings.qry__fulltext_str.length) {
|
||||
ae_trigger = 'load__event_obj_li';
|
||||
}
|
||||
|
||||
|
||||
// Updated 2024-10-01
|
||||
$: if (ae_trigger == 'load__event_obj_li') {
|
||||
|
||||
Reference in New Issue
Block a user