|
|
|
|
@@ -1,6 +1,19 @@
|
|
|
|
|
<script lang="ts">
|
|
|
|
|
export let log_lvl: number = 0;
|
|
|
|
|
interface Props {
|
|
|
|
|
log_lvl?: number;
|
|
|
|
|
lq__event_obj: any;
|
|
|
|
|
obj_changed: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let {
|
|
|
|
|
log_lvl = $bindable(0),
|
|
|
|
|
lq__event_obj,
|
|
|
|
|
obj_changed = $bindable(false)
|
|
|
|
|
}: Props = $props();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// *** Import Svelte core
|
|
|
|
|
import { run, preventDefault } from 'svelte/legacy';
|
|
|
|
|
// import { onDestroy, onMount } from 'svelte';
|
|
|
|
|
import { fade } from 'svelte/transition';
|
|
|
|
|
import { browser } from '$app/environment';
|
|
|
|
|
@@ -14,12 +27,22 @@ import { idaa_loc, idaa_sess, idaa_slct } from '$lib/ae_idaa_stores';
|
|
|
|
|
import { events_func } from '$lib/ae_events_functions';
|
|
|
|
|
import Tiptap_editor from '$lib/element_tiptap_editor.svelte';
|
|
|
|
|
|
|
|
|
|
export let lq__event_obj: any;
|
|
|
|
|
// export let container_class_li = [];
|
|
|
|
|
|
|
|
|
|
let prom_api__event_obj: any;
|
|
|
|
|
let prom_api__event_obj: any = $state();
|
|
|
|
|
|
|
|
|
|
let disable_submit_btn = true;
|
|
|
|
|
let description_new_html = $state('');
|
|
|
|
|
let description_changed = $state(false);
|
|
|
|
|
let location_text_new_html = $state('');
|
|
|
|
|
let location_text_changed = $state(false);
|
|
|
|
|
let attend_text_new_html = $state('');
|
|
|
|
|
let attend_text_changed = $state(false);
|
|
|
|
|
let recurring_text_new_html = $state('');
|
|
|
|
|
let recurring_text_changed = $state(false);
|
|
|
|
|
let notes_new_html = $state('');
|
|
|
|
|
let notes_changed = $state(false);
|
|
|
|
|
|
|
|
|
|
let disable_submit_btn = $state(true);
|
|
|
|
|
|
|
|
|
|
// $: if (browser) {
|
|
|
|
|
// document.body.scrollIntoView();
|
|
|
|
|
@@ -146,7 +169,7 @@ if ($ae_loc.lu_time_zone_list && $ae_loc.lu_time_zone_list.length > 0 && Math.ra
|
|
|
|
|
// });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let lu_country_list = localStorage.getItem('lu_country_list') ? JSON.parse(localStorage.getItem('lu_country_list') ?? '') : [];
|
|
|
|
|
let lu_country_list = $state(localStorage.getItem('lu_country_list') ? JSON.parse(localStorage.getItem('lu_country_list') ?? '') : []);
|
|
|
|
|
// $ae_loc.lu_country_list = []; // Reset the list
|
|
|
|
|
// Refresh the list at least 20% of the time.
|
|
|
|
|
if (lu_country_list && lu_country_list.length > 50 && Math.random() < 0.8) {
|
|
|
|
|
@@ -175,7 +198,7 @@ if (lu_country_list && lu_country_list.length > 50 && Math.random() < 0.8) {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let lu_country_subdivision_list = localStorage.getItem('lu_country_subdivision_list') ? JSON.parse(localStorage.getItem('lu_country_subdivision_list') ?? '') : [];
|
|
|
|
|
let lu_country_subdivision_list = $state(localStorage.getItem('lu_country_subdivision_list') ? JSON.parse(localStorage.getItem('lu_country_subdivision_list') ?? '') : []);
|
|
|
|
|
// $ae_loc.lu_country_subdivision_list = []; // Reset the 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) {
|
|
|
|
|
@@ -206,17 +229,19 @@ if (lu_country_subdivision_list && lu_country_subdivision_list.length > 50 && Ma
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$: if ($idaa_slct.event_obj) {
|
|
|
|
|
if (log_lvl) {
|
|
|
|
|
console.log('Selected Event object changed?', $idaa_slct.event_obj);
|
|
|
|
|
}
|
|
|
|
|
$effect(() => {
|
|
|
|
|
if ($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 = {contact_li_json: []};
|
|
|
|
|
} else {
|
|
|
|
|
disable_submit_btn = false;
|
|
|
|
|
if ($idaa_slct.event_obj == null) {
|
|
|
|
|
$idaa_slct.event_obj = {contact_li_json: []};
|
|
|
|
|
} else {
|
|
|
|
|
disable_submit_btn = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function handle_submit_form(event: any) {
|
|
|
|
|
@@ -246,14 +271,16 @@ async function handle_submit_form(event: any) {
|
|
|
|
|
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') {
|
|
|
|
|
if (typeof description_new_html === 'string') {
|
|
|
|
|
console.log('New description is a string');
|
|
|
|
|
event_do['description'] = $idaa_slct.event_obj.description_new_html;
|
|
|
|
|
event_do['description'] = description_new_html;
|
|
|
|
|
} else {
|
|
|
|
|
console.log('New description is not a string. Do nothing.');
|
|
|
|
|
// event_do['description'] = event_meeting_fd.description;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
event_do['type'] = event_meeting_fd.type;
|
|
|
|
|
event_do['physical'] = !!event_meeting_fd.physical;
|
|
|
|
|
event_do['virtual'] = !!event_meeting_fd.virtual;
|
|
|
|
|
@@ -284,8 +311,8 @@ async function handle_submit_form(event: any) {
|
|
|
|
|
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_do['location_text'] = $idaa_slct.event_obj.location_text_new_html;
|
|
|
|
|
if (typeof location_text_new_html === 'string') {
|
|
|
|
|
event_do['location_text'] = location_text_new_html;
|
|
|
|
|
} else {
|
|
|
|
|
console.log('New location text is not a string. Do nothing.');
|
|
|
|
|
}
|
|
|
|
|
@@ -296,8 +323,8 @@ async function handle_submit_form(event: any) {
|
|
|
|
|
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_do['attend_text'] = $idaa_slct.event_obj.attend_text_new_html;
|
|
|
|
|
if (typeof attend_text_new_html === 'string') {
|
|
|
|
|
event_do['attend_text'] = attend_text_new_html;
|
|
|
|
|
} else {
|
|
|
|
|
console.log('New attend text is not a string. Do nothing.');
|
|
|
|
|
}
|
|
|
|
|
@@ -324,11 +351,11 @@ 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 (typeof recurring_text_new_html === 'string') {
|
|
|
|
|
if (log_lvl) {
|
|
|
|
|
console.log(`New recurring text is a string: ${$idaa_slct.event_obj.recurring_text_new_html}`);
|
|
|
|
|
console.log(`New recurring text is a string: ${recurring_text_new_html}`);
|
|
|
|
|
}
|
|
|
|
|
event_do['recurring_text'] = $idaa_slct.event_obj.recurring_text_new_html;
|
|
|
|
|
event_do['recurring_text'] = recurring_text_new_html;
|
|
|
|
|
} else {
|
|
|
|
|
if (log_lvl) {
|
|
|
|
|
console.log('New recurring text is not a string. Do nothing.');
|
|
|
|
|
@@ -424,8 +451,8 @@ async function handle_submit_form(event: any) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Check if the notes_new_html exists and is a string
|
|
|
|
|
if (typeof $idaa_slct.event_obj.notes_new_html === 'string') {
|
|
|
|
|
event_do['notes'] = $idaa_slct.event_obj.notes_new_html;
|
|
|
|
|
if (typeof notes_new_html === 'string') {
|
|
|
|
|
event_do['notes'] = notes_new_html;
|
|
|
|
|
} else {
|
|
|
|
|
console.log('New notes is not a string. Do nothing.');
|
|
|
|
|
}
|
|
|
|
|
@@ -608,7 +635,7 @@ function send_staff_notification_email() {
|
|
|
|
|
bind:clientHeight={$ae_loc.iframe_height_modal_body}
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
<form on:submit|preventDefault={handle_submit_form} class="relative space-y-1">
|
|
|
|
|
<form onsubmit={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>
|
|
|
|
|
@@ -670,9 +697,10 @@ function send_staff_notification_email() {
|
|
|
|
|
|
|
|
|
|
<Tiptap_editor
|
|
|
|
|
default_minimal={true}
|
|
|
|
|
bind:html_text={$idaa_slct.event_obj.description}
|
|
|
|
|
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}
|
|
|
|
|
bind:new_html={description_new_html}
|
|
|
|
|
bind:changed={description_changed}
|
|
|
|
|
classes="preset-tonal-surface hover:preset-filled-surface-100-900"
|
|
|
|
|
placeholder="A short description or overview of this recovery meeting"
|
|
|
|
|
/>
|
|
|
|
|
@@ -845,9 +873,10 @@ function send_staff_notification_email() {
|
|
|
|
|
<!-- <textarea class="ae_value event__location_text tinymce_editor editor_less_100 textarea" id="location_text" name="location_text" placeholder="Additional information about the meeting location" rows="2" cols="70" bind:value={$idaa_slct.event_obj.location_text}></textarea> -->
|
|
|
|
|
<Tiptap_editor
|
|
|
|
|
default_minimal={true}
|
|
|
|
|
bind:html_text={$idaa_slct.event_obj.location_text}
|
|
|
|
|
html_text={$idaa_slct.event_obj?.location_text}
|
|
|
|
|
show_button_kv={{'heading__h1': false, 'heading__h2': false, 'heading__h3': false}}
|
|
|
|
|
bind:new_html={$idaa_slct.event_obj.location_text_new_html}
|
|
|
|
|
bind:new_html={location_text_new_html}
|
|
|
|
|
bind:changed={location_text_changed}
|
|
|
|
|
classes="preset-tonal-surface hover:preset-filled-surface-100-900"
|
|
|
|
|
placeholder="Additional information about the meeting location"
|
|
|
|
|
/>
|
|
|
|
|
@@ -896,9 +925,10 @@ function send_staff_notification_email() {
|
|
|
|
|
<!-- <textarea class="ae_value event__attend_text tinymce_editor editor_less_100 textarea" id="attend_text" name="attend_text" placeholder="Additional information on how to attend or join the meeting" rows="2" cols="70" value={$lq__event_obj?.attend_text ?? ''}></textarea> -->
|
|
|
|
|
<Tiptap_editor
|
|
|
|
|
default_minimal={true}
|
|
|
|
|
bind:html_text={$idaa_slct.event_obj.attend_text}
|
|
|
|
|
html_text={$idaa_slct.event_obj?.attend_text}
|
|
|
|
|
show_button_kv={{'heading__h1': false, 'heading__h2': false, 'heading__h3': false}}
|
|
|
|
|
bind:new_html={$idaa_slct.event_obj.attend_text_new_html}
|
|
|
|
|
bind:new_html={attend_text_new_html}
|
|
|
|
|
bind:changed={attend_text_changed}
|
|
|
|
|
classes="preset-tonal-surface hover:preset-filled-surface-100-900"
|
|
|
|
|
placeholder="Additional information on how to attend or join the meeting"
|
|
|
|
|
/>
|
|
|
|
|
@@ -1072,7 +1102,7 @@ function send_staff_notification_email() {
|
|
|
|
|
<!-- <textarea class="ae_value event__recurring_text tinymce_editor editor_less_100 textarea" id="recurring_text" name="recurring_text" placeholder="Additional information on when and how often" value={$lq__event_obj?.recurring_text ?? ''}></textarea> -->
|
|
|
|
|
<Tiptap_editor
|
|
|
|
|
default_minimal={true}
|
|
|
|
|
bind:html_text={$idaa_slct.event_obj.recurring_text}
|
|
|
|
|
html_text={$idaa_slct.event_obj?.recurring_text}
|
|
|
|
|
show_button_kv={{
|
|
|
|
|
// text: true,
|
|
|
|
|
// bullet_list: true,
|
|
|
|
|
@@ -1080,7 +1110,8 @@ function send_staff_notification_email() {
|
|
|
|
|
// link: true,
|
|
|
|
|
// unset_link: true
|
|
|
|
|
}}
|
|
|
|
|
bind:new_html={$idaa_slct.event_obj.recurring_text_new_html}
|
|
|
|
|
bind:new_html={recurring_text_new_html}
|
|
|
|
|
bind:changed={recurring_text_changed}
|
|
|
|
|
classes="preset-tonal-surface hover:preset-filled-surface-100-900"
|
|
|
|
|
placeholder="Additional information on when and how often"
|
|
|
|
|
/>
|
|
|
|
|
@@ -1110,7 +1141,7 @@ function send_staff_notification_email() {
|
|
|
|
|
btn btn-sm
|
|
|
|
|
preset-filled-tertiary-200-800
|
|
|
|
|
"
|
|
|
|
|
on:click={() => {
|
|
|
|
|
onclick={() => {
|
|
|
|
|
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 = '';
|
|
|
|
|
@@ -1131,13 +1162,13 @@ function send_staff_notification_email() {
|
|
|
|
|
btn btn-sm
|
|
|
|
|
preset-filled-success-200-800
|
|
|
|
|
"
|
|
|
|
|
on:click|preventDefault={() => {
|
|
|
|
|
onclick={preventDefault(() => {
|
|
|
|
|
// Remove *gen* prefix from recurring_text
|
|
|
|
|
if ($lq__event_obj.recurring_text && $lq__event_obj.recurring_text.includes('*gen*')) {
|
|
|
|
|
$idaa_slct.event_obj.recurring_text = $lq__event_obj.recurring_text.replace('*gen* ', '');
|
|
|
|
|
}
|
|
|
|
|
$idaa_slct.event_obj.show_recurring_text = true;
|
|
|
|
|
}}
|
|
|
|
|
})}
|
|
|
|
|
>
|
|
|
|
|
<span class="fas fa-plus m-1"></span> Add More Details?
|
|
|
|
|
</button>
|
|
|
|
|
@@ -1207,7 +1238,7 @@ function send_staff_notification_email() {
|
|
|
|
|
{#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"
|
|
|
|
|
on:click|preventDefault={() => {
|
|
|
|
|
onclick={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]) {
|
|
|
|
|
$idaa_slct.event_obj.contact_li_json[0] = {};
|
|
|
|
|
@@ -1217,7 +1248,7 @@ function send_staff_notification_email() {
|
|
|
|
|
$idaa_slct.event_obj.contact_li_json[0].unlock = false;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}}
|
|
|
|
|
})}
|
|
|
|
|
class="
|
|
|
|
|
novi_btn novi_smaller ae_btn_info
|
|
|
|
|
btn btn-sm
|
|
|
|
|
@@ -1229,9 +1260,9 @@ function send_staff_notification_email() {
|
|
|
|
|
{:else}
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
on:click|preventDefault={() => {
|
|
|
|
|
onclick={preventDefault(() => {
|
|
|
|
|
$idaa_slct.event_obj.contact_li_json[0].unlock = false;
|
|
|
|
|
}}
|
|
|
|
|
})}
|
|
|
|
|
class="
|
|
|
|
|
novi_btn novi_smaller ae_btn_info
|
|
|
|
|
btn btn-sm
|
|
|
|
|
@@ -1324,7 +1355,7 @@ function send_staff_notification_email() {
|
|
|
|
|
{#if $ae_loc.trusted_access}
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
on:click={() => {
|
|
|
|
|
onclick={() => {
|
|
|
|
|
$idaa_loc.recovery_meetings.show__admin_options = !$idaa_loc.recovery_meetings.show__admin_options;
|
|
|
|
|
}}
|
|
|
|
|
class="
|
|
|
|
|
@@ -1497,9 +1528,10 @@ function send_staff_notification_email() {
|
|
|
|
|
Internal Staff Notes
|
|
|
|
|
<Tiptap_editor
|
|
|
|
|
default_minimal={true}
|
|
|
|
|
bind:html_text={$idaa_slct.event_obj.notes}
|
|
|
|
|
html_text={$idaa_slct.event_obj?.notes}
|
|
|
|
|
show_button_kv={{'heading__h1': false, 'heading__h2': false, 'heading__h3': false}}
|
|
|
|
|
bind:new_html={$idaa_slct.event_obj.notes_new_html}
|
|
|
|
|
bind:new_html={notes_new_html}
|
|
|
|
|
bind:changed={notes_changed}
|
|
|
|
|
classes="preset-tonal-surface hover:preset-filled-surface-100-900"
|
|
|
|
|
placeholder="Internal notes for staff only. Not shown to the public."
|
|
|
|
|
/>
|
|
|
|
|
@@ -1532,7 +1564,7 @@ function send_staff_notification_email() {
|
|
|
|
|
<button
|
|
|
|
|
type="submit"
|
|
|
|
|
disabled={(disable_submit_btn)}
|
|
|
|
|
on:click={() => {
|
|
|
|
|
onclick={() => {
|
|
|
|
|
if (!confirm('Are you sure you want to create this event?')) {return false;}
|
|
|
|
|
// handle_save_event_obj({event_id: $idaa_slct.event_id, method: 'create'});
|
|
|
|
|
}}
|
|
|
|
|
@@ -1555,7 +1587,7 @@ function send_staff_notification_email() {
|
|
|
|
|
{#if $ae_loc.administrator_access}
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
on:click={() => {
|
|
|
|
|
onclick={() => {
|
|
|
|
|
if (!confirm('Are you sure you want to delete this event?')) {return false;}
|
|
|
|
|
handle_delete_event_obj({event_id: $idaa_slct.event_id, method: 'delete'});
|
|
|
|
|
}}
|
|
|
|
|
@@ -1571,7 +1603,7 @@ function send_staff_notification_email() {
|
|
|
|
|
{:else if $ae_loc.trusted_access}
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
on:click={() => {
|
|
|
|
|
onclick={() => {
|
|
|
|
|
if (!confirm('Are you sure you want to disable this event?')) {return false;}
|
|
|
|
|
handle_delete_event_obj({event_id: $idaa_slct.event_id, method: 'disable'});
|
|
|
|
|
}}
|
|
|
|
|
@@ -1588,7 +1620,7 @@ function send_staff_notification_email() {
|
|
|
|
|
{:else}
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
on:click={() => {
|
|
|
|
|
onclick={() => {
|
|
|
|
|
if (!confirm('Are you sure you want to hide this event?')) {return false;}
|
|
|
|
|
handle_delete_event_obj({event_id: $idaa_slct.event_id, method: 'hide'});
|
|
|
|
|
}}
|
|
|
|
|
|