Last minute work for going live on Novi. Modified how the recurring text is generated.

This commit is contained in:
Scott Idem
2024-12-05 15:09:01 -05:00
parent 90c5b9414f
commit af743f6e73
4 changed files with 68 additions and 29 deletions

View File

@@ -180,7 +180,7 @@ async function handle_submit_form(event) {
return false;
}
$idaa_slct.archive_id = archive_obj_create_result.obj_id_random;
$idaa_slct.archive_id = archive_obj_create_result.archive_id_random;
$idaa_slct.archive_obj = archive_obj_create_result;
return update_archive_obj_promise

View File

@@ -105,7 +105,7 @@ async function handle_submit_form(event: any) {
return false;
}
$idaa_slct.post_comment_id = post_comment_obj_create_result.obj_id_random;
$idaa_slct.post_comment_id = post_comment_obj_create_result.post_comment_id_random;
$idaa_slct.post_comment_obj = post_comment_obj_create_result;
return post_comment_obj_create_result;

View File

@@ -101,7 +101,7 @@ if ($ae_loc.lu_time_zone_list && $ae_loc.lu_time_zone_list.length > 0) {
let lu_time_zone_li_get_promise = core_func.load_ae_obj_li__time_zone({
api_cfg: $ae_api,
log_lvl: 2
log_lvl: 1
})
.then(function (lu_time_zone_li_get_result) {
if (lu_time_zone_li_get_result) {
@@ -235,6 +235,8 @@ $: if ($idaa_slct.event_obj) {
async function handle_submit_form(event: any) {
console.log('*** handle_submit_form() ***');
log_lvl = 1;
disable_submit_btn = true;
let form_data = new FormData(event.target);
@@ -336,9 +338,14 @@ async function handle_submit_form(event: any) {
// Check if the recurring_text_new_html exists and is a string
if (typeof $idaa_slct.event_obj.recurring_text_new_html === 'string') {
if (log_lvl) {
console.log(`New recurring text is a string: ${$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.');
if (log_lvl) {
console.log('New recurring text is not a string. Do nothing.');
}
}
console.log(event_do['recurring_text']);
@@ -367,12 +374,16 @@ async function handle_submit_form(event: any) {
}
let current_date_iso = ae_util.iso_datetime_formatter(new Date(), 'YYYY-MM-DD');
if (log_lvl) {
console.log(`Current date: ${current_date_iso}`);
}
// 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_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_12_short_no_leading')} to ${ae_util.iso_datetime_formatter(`${current_date_iso} ${event_do['recurring_end_time']}`, 'time_12_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_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_12_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_do['recurring_text'] =
`*gen* ${event_do['recurring_pattern'] ?? ''}: ${days_of_week.join(', ')} at ${ae_util.iso_datetime_formatter(`${current_date_iso} ${event_do['recurring_start_time']}`, 'time_12_short_no_leading')} ${event_do['timezone'] ?? ''}`;
}
event_do['external_person_id'] = event_meeting_fd.external_person_id; // NOTE: Defaults to the Novi user that created/owns this event
@@ -430,7 +441,9 @@ async function handle_submit_form(event: any) {
console.log('New notes is not a string. Do nothing.');
}
console.log(event_do);
if (log_lvl) {
console.log('Event object data:', event_do);
}
if (!$idaa_slct.event_id) {
prom_api__event_obj = events_func.create_ae_obj__event({
@@ -448,7 +461,7 @@ async function handle_submit_form(event: any) {
if (log_lvl) {
console.log('event_obj_create_result:', event_obj_create_result);
}
$idaa_slct.event_id = event_obj_create_result.obj_id_random;
$idaa_slct.event_id = event_obj_create_result.event_id_random;
$idaa_slct.event_obj = event_obj_create_result;
return event_obj_create_result;
@@ -464,6 +477,8 @@ async function handle_submit_form(event: any) {
$idaa_sess.recovery_meetings.show__modal_view = true;
});
log_lvl = 0;
return prom_api__event_obj;
} else {
@@ -480,6 +495,8 @@ async function handle_submit_form(event: any) {
return false;
}
$idaa_slct.event_obj = event_obj_update_result;
return event_obj_update_result;
})
.catch(function (error) {
@@ -489,8 +506,12 @@ async function handle_submit_form(event: any) {
})
.finally(() => {
disable_submit_btn = false;
$idaa_sess.recovery_meetings.show__modal_edit = false;
$idaa_sess.recovery_meetings.show__modal_view = true;
});
log_lvl = 0;
return prom_api__event_obj;
}
@@ -541,7 +562,7 @@ async function handle_delete_event_obj(
bind:clientHeight={$ae_loc.iframe_height_modal_body}
>
<form on:submit|preventDefault={handle_submit_form} class="space-y-1">
<form on:submit|preventDefault={handle_submit_form} class="relative space-y-1">
{#await prom_api__event_obj}
<div class="awaiting alert_msg_pulse" out:fade={{ duration: 2000 }}>Saving...</div>
@@ -950,7 +971,13 @@ async function handle_delete_event_obj(
<Tiptap_editor
default_minimal={true}
bind:html_text={$idaa_slct.event_obj.recurring_text}
show_button_kv={{'heading__h1': false, 'heading__h2': false, 'heading__h3': false}}
show_button_kv={{
// text: true,
// bullet_list: true,
// ordered_list: true,
// link: true,
// unset_link: true
}}
bind:new_html={$idaa_slct.event_obj.recurring_text_new_html}
/>
@@ -975,11 +1002,12 @@ async function handle_delete_event_obj(
type="button"
class="ae_btn ae_smaller btn btn-info btn-sm ae_width_md variant-ghost-warning hover:variant-filled-warning transition"
style=""
on:click|preventDefault={() => {
on:click={() => {
if (confirm('Are you sure you want to remove the text for the additional details?')) {
// $idaa_slct.event_obj.recurring_text = '';
$idaa_slct.event_obj.recurring_text_new_html = '';
$idaa_slct.event_obj.recurring_text = '<p>test</p>';
// $idaa_slct.event_obj.recurring_text_new_html = '';
$idaa_slct.event_obj.show_recurring_text = false;
console.log($idaa_slct.event_obj.recurring_text);
} else {
return false;
}
@@ -1054,7 +1082,8 @@ async function handle_delete_event_obj(
<span class="ae_group">
{#if !($ae_loc.administrator_access || ($idaa_slct.event_obj?.contact_li_json?.length && $idaa_slct.event_obj?.contact_li_json[0]?.unlock))}
<button type="button" class="ae_btn ae_smaller ae_btn_info"
<button
type="button"
on:click|preventDefault={() => {
if (confirm('Are you sure you want to lock these fields? The primary contact name and email address are required.')) {
if (!$idaa_slct.event_obj.contact_li_json[0]) {
@@ -1066,14 +1095,17 @@ async function handle_delete_event_obj(
return false;
}
}}
class="ae_btn ae_smaller ae_btn_info"
>
<span class="fas fa-lock" title="Field is locked"></span> Name and email locked
</button>
{:else}
<button type="button" class="ae_btn ae_smaller ae_btn_info"
<button
type="button"
on:click|preventDefault={() => {
$idaa_slct.event_obj.contact_li_json[0].unlock = false;
}}
class="ae_btn ae_smaller ae_btn_info"
>
<span class="fas fa-unlock" title="Field is unlocked"></span>
Unlocked
@@ -1160,10 +1192,10 @@ async function handle_delete_event_obj(
{#if $ae_loc.trusted_access}
<button
type="button"
class="btn btn-sm variant-soft-warning float-right"
on:click={() => {
$idaa_loc.recovery_meetings.show__admin_options = !$idaa_loc.recovery_meetings.show__admin_options;
}}
class="btn btn-sm variant-soft-warning float-right"
>
<span class="fas fa-eye m-1"></span>
{$idaa_loc.recovery_meetings.show__admin_options ? 'Hide' : 'Show'} Admin

View File

@@ -53,9 +53,12 @@ onDestroy(() => {
<section class="svelte_component ae_section ae_view event_obj view__event_obj space-y-2">
<div class="p-2 bg-white shadow-md rounded-lg">
<div class="meeting_description description mb-4">
<div
class="meeting_description description mb-4"
class:hidden={!$lq__event_obj?.description}
>
<div class="ae_label event__description mb-2">Description:</div>
<pre class="ae_value event__description text-wrap font-normal whitespace-pre-wrap">{@html $lq__event_obj?.description}</pre>
<pre class="ae_value_semi event__description text-wrap font-normal whitespace-pre-wrap">{@html $lq__event_obj?.description}</pre>
</div>
<div class:hidden={!$lq__event_obj?.type} class="meeting_type mb-4">
@@ -142,12 +145,15 @@ onDestroy(() => {
class="text-blue-800 hover:underline"
>{$lq__event_obj?.attend_url}</a>
</span>
<span class="ae_label">
<span class="fas fa-lock"></span>
Passcode:
</span>
<span class="ae_value">
{$lq__event_obj?.attend_url_passcode}
<span class:hidden={!$lq__event_obj?.attend_url_passcode}
>
<span class="ae_label">
<span class="fas fa-lock"></span>
Passcode:
</span>
<span class="ae_value">
{$lq__event_obj?.attend_url_passcode}
</span>
</span>
</div>
<div class="meeting_attend_phone"
@@ -229,7 +235,7 @@ onDestroy(() => {
<span
class:hidden={!$lq__event_obj?.recurring_end_time}
>
- <span class="meeting_recurring_end_time">
<span class="meeting_recurring_end_time">
<span class="ae_label">End time:</span>
<span class="ae_value">{ae_util.iso_datetime_formatter(`2024-01-01 ${$lq__event_obj?.recurring_end_time}`, 'time_12_short')}
</span>
@@ -238,18 +244,19 @@ onDestroy(() => {
<span
class:hidden={!$lq__event_obj?.timezone}
>
- <span class="meeting_timezone">
<span class="meeting_timezone">
<span class="ae_label">Timezone:</span>
<span class="ae_value">{$lq__event_obj?.timezone}</span>
</span>
</span>
{#if $lq__event_obj?.timezone}
{#if $lq__event_obj?.timezone && $ae_loc.current_timezone}
<span class="event__user_timezone">
(
<span class="ae_label">Your TZ:</span>
<span class="ae_value">
<!-- {dayjs.tz(`${$ae_loc.current_date_str} ${$lq__event_obj?.recurring_start_time}`, $lq__event_obj?.timezone).tz($ae_loc.current_timezone).format('hh:mm A')} {$ae_loc.current_timezone} -->
DAYJS DISABLED
<!-- DAYJS DISABLED -->
{$ae_loc.current_timezone}
</span>
)
</span>