Bug fixes for loading the IDAA Rec Mtg when navigating. Other improvements.
This commit is contained in:
@@ -10,16 +10,15 @@ import { onDestroy } from "svelte";
|
|||||||
import { browser } from '$app/environment';
|
import { browser } from '$app/environment';
|
||||||
|
|
||||||
// *** Import other supporting libraries
|
// *** Import other supporting libraries
|
||||||
import { Modal } from 'flowbite-svelte';
|
// import { Modal } from 'flowbite-svelte';
|
||||||
import { liveQuery } from "dexie";
|
import { liveQuery } from "dexie";
|
||||||
|
|
||||||
// *** Import Aether specific variables and functions
|
// *** Import Aether specific variables and functions
|
||||||
import { ae_util } from '$lib/ae_utils/ae_utils';
|
import { ae_util } from '$lib/ae_utils/ae_utils';
|
||||||
import { db_posts } from "$lib/ae_posts/db_posts";
|
|
||||||
|
|
||||||
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
||||||
|
import { db_posts } from "$lib/ae_posts/db_posts";
|
||||||
|
// import { posts_func } from '$lib/ae_posts/ae_posts_functions';
|
||||||
import { idaa_loc, idaa_sess, idaa_slct, idaa_trig, idaa_prom } from '$lib/ae_idaa_stores';
|
import { idaa_loc, idaa_sess, idaa_slct, idaa_trig, idaa_prom } from '$lib/ae_idaa_stores';
|
||||||
import { posts_func } from '$lib/ae_posts/ae_posts_functions';
|
|
||||||
|
|
||||||
import Comp__post_obj_id_edit from '.././ae_idaa_comp__post_obj_id_edit.svelte';
|
import Comp__post_obj_id_edit from '.././ae_idaa_comp__post_obj_id_edit.svelte';
|
||||||
import Comp__post_obj_id_view from '.././ae_idaa_comp__post_obj_id_view.svelte';
|
import Comp__post_obj_id_view from '.././ae_idaa_comp__post_obj_id_view.svelte';
|
||||||
@@ -47,6 +46,9 @@ let lq__post_obj = $derived(liveQuery(async () => {
|
|||||||
if ($idaa_slct.post_obj && results) {
|
if ($idaa_slct.post_obj && results) {
|
||||||
if (JSON.stringify($idaa_slct.post_obj) !== JSON.stringify(results)) {
|
if (JSON.stringify($idaa_slct.post_obj) !== JSON.stringify(results)) {
|
||||||
$idaa_slct.post_obj = { ...results};
|
$idaa_slct.post_obj = { ...results};
|
||||||
|
if (log_lvl) {
|
||||||
|
console.log(`$idaa_slct.post_obj = `, $idaa_slct.post_obj);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (log_lvl) {
|
if (log_lvl) {
|
||||||
console.log(`Post object has not changed for post_id: ${$idaa_slct.post_id}`);
|
console.log(`Post object has not changed for post_id: ${$idaa_slct.post_id}`);
|
||||||
@@ -54,7 +56,6 @@ let lq__post_obj = $derived(liveQuery(async () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log(`$idaa_slct.post_obj = `, $idaa_slct.post_obj);
|
|
||||||
return results;
|
return results;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -107,9 +108,9 @@ onDestroy(() => {
|
|||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
<title>
|
<title>
|
||||||
IDAA Bulletin Board:
|
IDAA BB:
|
||||||
{$lq__post_obj?.name ? ae_util.shorten_string({ string: $lq__post_obj?.name, max_length: 20, begin_length: 10, end_length: 4 }) : ''}
|
{$lq__post_obj?.name ? ae_util.shorten_string({ string: $lq__post_obj?.name, max_length: 20, begin_length: 10, end_length: 4 }) : ''}
|
||||||
- Novi - {$ae_loc?.name}
|
- Novi - {$ae_loc?.title}
|
||||||
</title>
|
</title>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
@@ -162,11 +163,15 @@ onDestroy(() => {
|
|||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
|
||||||
<a href="/idaa/bb" class="novi_btn btn btn-secondary btn-sm
|
<a
|
||||||
preset-tonal-tertiary border border-tertiary-500
|
href="/idaa/bb"
|
||||||
hover:preset-filled-tertiary-500
|
class="
|
||||||
transition
|
novi_btn btn btn-secondary btn-sm
|
||||||
">
|
preset-tonal-tertiary border border-tertiary-500
|
||||||
|
hover:preset-filled-tertiary-500
|
||||||
|
transition
|
||||||
|
"
|
||||||
|
>
|
||||||
<span class="fas fa-arrow-left m-1"></span> Back to Posts List
|
<span class="fas fa-arrow-left m-1"></span> Back to Posts List
|
||||||
<!-- <span class="fas fa-times m-1"></span> View Other Meetings -->
|
<!-- <span class="fas fa-times m-1"></span> View Other Meetings -->
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -12,12 +12,14 @@ let {
|
|||||||
}: Props = $props();
|
}: Props = $props();
|
||||||
|
|
||||||
// *** Import Svelte specific
|
// *** Import Svelte specific
|
||||||
// import { createEventDispatcher, onDestroy, onMount } from 'svelte';
|
// import { onDestroy, onMount } from 'svelte';
|
||||||
import { fade } from 'svelte/transition';
|
import { fade } from 'svelte/transition';
|
||||||
import { browser } from '$app/environment';
|
import { browser } from '$app/environment';
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
|
|
||||||
// *** Import Aether core variables and functions
|
// *** Import other supporting libraries
|
||||||
|
|
||||||
|
// *** Import Aether specific variables and functions
|
||||||
import type { key_val } from '$lib/ae_stores';
|
import type { key_val } from '$lib/ae_stores';
|
||||||
import { ae_util } from '$lib/ae_utils/ae_utils';
|
import { ae_util } from '$lib/ae_utils/ae_utils';
|
||||||
import { core_func } from '$lib/ae_core/ae_core_functions';
|
import { core_func } from '$lib/ae_core/ae_core_functions';
|
||||||
@@ -34,6 +36,7 @@ import Comp_hosted_files_upload from '$lib/ae_core/ae_comp__hosted_files_upload.
|
|||||||
if (!$idaa_slct.post_obj) {
|
if (!$idaa_slct.post_obj) {
|
||||||
$idaa_slct.post_obj = {};
|
$idaa_slct.post_obj = {};
|
||||||
}
|
}
|
||||||
|
// Create a copy of the post object
|
||||||
let orig_post_obj: any = { ...$idaa_slct.post_obj };
|
let orig_post_obj: any = { ...$idaa_slct.post_obj };
|
||||||
if (browser) {
|
if (browser) {
|
||||||
// console.log(`$lq__post_obj = `, $lq__post_obj);
|
// console.log(`$lq__post_obj = `, $lq__post_obj);
|
||||||
|
|||||||
@@ -3,24 +3,22 @@ import type { PageData } from './$types';
|
|||||||
|
|
||||||
let { data }: { data: PageData } = $props();
|
let { data }: { data: PageData } = $props();
|
||||||
|
|
||||||
let log_lvl: number = 0;
|
let log_lvl: number = 1;
|
||||||
|
|
||||||
// *** Import Svelte specific
|
// *** Import Svelte specific
|
||||||
import { onDestroy } from "svelte";
|
import { onDestroy } from "svelte";
|
||||||
import { browser } from '$app/environment';
|
import { browser } from '$app/environment';
|
||||||
|
|
||||||
// *** Import other supporting libraries
|
// *** Import other supporting libraries
|
||||||
import { Modal } from 'flowbite-svelte';
|
// import { Modal } from 'flowbite-svelte';
|
||||||
import { liveQuery } from "dexie";
|
import { liveQuery } from "dexie";
|
||||||
|
|
||||||
// *** Import Aether specific variables and functions
|
// *** Import Aether specific variables and functions
|
||||||
import { ae_util } from '$lib/ae_utils/ae_utils';
|
import { ae_util } from '$lib/ae_utils/ae_utils';
|
||||||
|
|
||||||
|
|
||||||
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
||||||
import { idaa_loc, idaa_sess, idaa_slct, idaa_trig, idaa_prom } from '$lib/ae_idaa_stores';
|
|
||||||
import { db_events } from "$lib/ae_events/db_events";
|
import { db_events } from "$lib/ae_events/db_events";
|
||||||
import { events_func } from '$lib/ae_events_functions';
|
// import { events_func } from '$lib/ae_events_functions';
|
||||||
|
import { idaa_loc, idaa_sess, idaa_slct, idaa_trig, idaa_prom } from '$lib/ae_idaa_stores';
|
||||||
|
|
||||||
import Event_obj_id_edit from '.././ae_idaa_comp__event_obj_id_edit.svelte';
|
import Event_obj_id_edit from '.././ae_idaa_comp__event_obj_id_edit.svelte';
|
||||||
import Event_obj_id_view from '.././ae_idaa_comp__event_obj_id_view.svelte';
|
import Event_obj_id_view from '.././ae_idaa_comp__event_obj_id_view.svelte';
|
||||||
@@ -31,7 +29,7 @@ if (log_lvl) {
|
|||||||
console.log(`ae_acct = `, ae_acct);
|
console.log(`ae_acct = `, ae_acct);
|
||||||
}
|
}
|
||||||
|
|
||||||
$idaa_sess.recovery_meetings.edit__event_id = null;
|
$idaa_sess.recovery_meetings.edit__event_obj = null;
|
||||||
$idaa_slct.event_id = ae_acct.slct.event_id;
|
$idaa_slct.event_id = ae_acct.slct.event_id;
|
||||||
$idaa_trig.event_id = ae_acct.slct.event_id;
|
$idaa_trig.event_id = ae_acct.slct.event_id;
|
||||||
// $idaa_slct.event_obj = ae_acct.slct.event_obj;
|
// $idaa_slct.event_obj = ae_acct.slct.event_obj;
|
||||||
@@ -49,6 +47,9 @@ let lq__event_obj = $derived(liveQuery(async () => {
|
|||||||
if ($idaa_slct.event_obj && results) {
|
if ($idaa_slct.event_obj && results) {
|
||||||
if (JSON.stringify($idaa_slct.event_obj) !== JSON.stringify(results)) {
|
if (JSON.stringify($idaa_slct.event_obj) !== JSON.stringify(results)) {
|
||||||
$idaa_slct.event_obj = { ...results};
|
$idaa_slct.event_obj = { ...results};
|
||||||
|
if (log_lvl) {
|
||||||
|
console.log(`$idaa_slct.event_obj = `, $idaa_slct.event_obj);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (log_lvl) {
|
if (log_lvl) {
|
||||||
console.log(`Event object has not changed for event_id: ${$idaa_slct.event_id}`);
|
console.log(`Event object has not changed for event_id: ${$idaa_slct.event_id}`);
|
||||||
@@ -80,15 +81,15 @@ onDestroy(() => {
|
|||||||
let message = {'event_id': null};
|
let message = {'event_id': null};
|
||||||
window.parent.postMessage(message, "*");
|
window.parent.postMessage(message, "*");
|
||||||
|
|
||||||
$idaa_slct.event_id = null;
|
// $idaa_slct.event_id = null;
|
||||||
$idaa_slct.event_obj = null;
|
// $idaa_slct.event_obj = null;
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
<title>
|
<title>
|
||||||
IDAA Recovery Meetings:
|
IDAA Recovery Mtgs:
|
||||||
{$lq__event_obj?.name ? ae_util.shorten_string({ string: $lq__event_obj?.name, max_length: 20, begin_length: 10, end_length: 4 }) : ''}
|
{$lq__event_obj?.name ? ae_util.shorten_string({ string: $lq__event_obj?.name, max_length: 20, begin_length: 10, end_length: 4 }) : ''}
|
||||||
- Novi - {$ae_loc?.title}
|
- Novi - {$ae_loc?.title}
|
||||||
</title>
|
</title>
|
||||||
@@ -158,30 +159,40 @@ onDestroy(() => {
|
|||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
|
||||||
<a href="/idaa/recovery_meetings" class="novi_btn btn btn-secondary btn-sm
|
<a
|
||||||
preset-tonal-tertiary border border-tertiary-500
|
href="/idaa/recovery_meetings"
|
||||||
hover:preset-filled-tertiary-500
|
class="
|
||||||
transition
|
novi_btn btn btn-secondary btn-sm
|
||||||
">
|
preset-tonal-tertiary border border-tertiary-500
|
||||||
|
hover:preset-filled-tertiary-500
|
||||||
|
transition
|
||||||
|
"
|
||||||
|
>
|
||||||
<span class="fas fa-arrow-left m-1"></span> Back to Meeting List
|
<span class="fas fa-arrow-left m-1"></span> Back to Meeting List
|
||||||
<!-- <span class="fas fa-times m-1"></span> View Other Meetings -->
|
<!-- <span class="fas fa-times m-1"></span> View Other Meetings -->
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<!-- View (default)/Edit event_id toggle -->
|
<!-- View (default)/Edit event_id toggle -->
|
||||||
{#if $idaa_sess.recovery_meetings.edit__event_id}
|
{#if $idaa_sess.recovery_meetings.edit__event_obj}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="novi_btn btn btn-warning btn-sm preset-tonal-tertiary border border-tertiary-500
|
class="
|
||||||
hover:preset-filled-tertiary-500 transition"
|
novi_btn
|
||||||
|
btn btn-sm
|
||||||
|
preset-filled-warning-200-800 hover:preset-filled-success-200-800
|
||||||
|
transition
|
||||||
|
"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
$idaa_sess.recovery_meetings.edit__event_id = false;
|
$idaa_sess.recovery_meetings.edit__event_obj = false;
|
||||||
if (log_lvl) {
|
if (log_lvl) {
|
||||||
console.log(`Toggle edit__event_id: ${$idaa_sess.recovery_meetings.edit__event_id}`);
|
console.log(`Toggle edit__event_obj: ${$idaa_sess.recovery_meetings.edit__event_obj}`);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
title="View this recovery meeting"
|
title="View this Recovery Meeting"
|
||||||
>
|
>
|
||||||
View Meeting?
|
<!-- <span class="far fa-window-close m-1"></span> -->
|
||||||
|
<span class="fas fa-times m-1"></span>
|
||||||
|
Cancel Edit
|
||||||
</button>
|
</button>
|
||||||
{:else}
|
{:else}
|
||||||
<!-- This checks if the currently logged in Novi user has a matching UUID or email address. -->
|
<!-- This checks if the currently logged in Novi user has a matching UUID or email address. -->
|
||||||
@@ -191,21 +202,21 @@ onDestroy(() => {
|
|||||||
class="novi_btn btn btn-warning btn-sm preset-tonal-warning border border-warning-500
|
class="novi_btn btn btn-warning btn-sm preset-tonal-warning border border-warning-500
|
||||||
hover:preset-filled-warning-500 transition"
|
hover:preset-filled-warning-500 transition"
|
||||||
onclick={() => {
|
onclick={() => {
|
||||||
$idaa_sess.recovery_meetings.edit__event_id = $idaa_slct.event_id;
|
$idaa_sess.recovery_meetings.edit__event_obj = $idaa_slct.event_id;
|
||||||
if (log_lvl) {
|
if (log_lvl) {
|
||||||
console.log(`Toggle edit__event_id: ${$idaa_sess.recovery_meetings.edit__event_id}`);
|
console.log(`Toggle edit__event_obj: ${$idaa_sess.recovery_meetings.edit__event_obj}`);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
title="Edit this recovery meeting"
|
title="Edit this Recovery Meeting"
|
||||||
>
|
>
|
||||||
<span class="fas fa-edit m-1"></span>
|
<span class="fas fa-edit m-1"></span>
|
||||||
Edit Meeting?
|
Edit Meeting
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if $idaa_sess.recovery_meetings.edit__event_id}
|
{#if $idaa_sess.recovery_meetings.edit__event_obj}
|
||||||
<Event_obj_id_edit
|
<Event_obj_id_edit
|
||||||
lq__event_obj={lq__event_obj}
|
lq__event_obj={lq__event_obj}
|
||||||
bind:obj_changed={$idaa_sess.recovery_meetings.obj_changed}
|
bind:obj_changed={$idaa_sess.recovery_meetings.obj_changed}
|
||||||
|
|||||||
@@ -12,12 +12,15 @@ let {
|
|||||||
}: Props = $props();
|
}: Props = $props();
|
||||||
|
|
||||||
|
|
||||||
// *** Import Svelte core
|
// *** Import Svelte specific
|
||||||
import { run, preventDefault } from 'svelte/legacy';
|
// import { preventDefault } from 'svelte/legacy';
|
||||||
// import { onDestroy, onMount } from 'svelte';
|
// import { onDestroy, onMount } from 'svelte';
|
||||||
import { fade } from 'svelte/transition';
|
import { fade } from 'svelte/transition';
|
||||||
import { browser } from '$app/environment';
|
import { browser } from '$app/environment';
|
||||||
|
|
||||||
|
// *** Import other supporting libraries
|
||||||
|
|
||||||
|
// *** Import Aether specific variables and functions
|
||||||
import type { key_val } from '$lib/ae_stores';
|
import type { key_val } from '$lib/ae_stores';
|
||||||
import { ae_util } from '$lib/ae_utils/ae_utils';
|
import { ae_util } from '$lib/ae_utils/ae_utils';
|
||||||
import { core_func } from '$lib/ae_core/ae_core_functions';
|
import { core_func } from '$lib/ae_core/ae_core_functions';
|
||||||
@@ -29,8 +32,20 @@ import Tiptap_editor from '$lib/element_tiptap_editor.svelte';
|
|||||||
|
|
||||||
// export let container_class_li = [];
|
// export let container_class_li = [];
|
||||||
|
|
||||||
|
if (!$idaa_slct.event_obj) {
|
||||||
|
$idaa_slct.event_obj = {};
|
||||||
|
}
|
||||||
|
// Create a copy of the event object
|
||||||
|
let orig_event_obj: any = { ...$idaa_slct.event_obj };
|
||||||
|
|
||||||
|
if ($idaa_loc.recovery_meetings.edit__event_obj) {
|
||||||
|
$idaa_sess.recovery_meetings.edit__event_obj = $idaa_loc.recovery_meetings.edit__event_obj;
|
||||||
|
$idaa_loc.recovery_meetings.edit__event_obj = false;
|
||||||
|
}
|
||||||
|
|
||||||
let prom_api__event_obj: any = $state();
|
let prom_api__event_obj: any = $state();
|
||||||
|
|
||||||
|
|
||||||
let description_new_html = $state('');
|
let description_new_html = $state('');
|
||||||
let description_changed = $state(false);
|
let description_changed = $state(false);
|
||||||
let location_text_new_html = $state('');
|
let location_text_new_html = $state('');
|
||||||
@@ -622,6 +637,27 @@ function send_staff_notification_email() {
|
|||||||
</div>
|
</div>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
function preventDefault(fn) {
|
||||||
|
return function (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
fn.call(this, event);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
if (orig_event_obj === null || orig_event_obj === undefined || orig_event_obj === 'undefined') {
|
||||||
|
obj_changed = false;
|
||||||
|
} else if (!obj_changed && orig_event_obj?.id && (JSON.stringify($idaa_slct.event_obj) !== JSON.stringify(orig_event_obj) || description_changed || notes_changed)) {
|
||||||
|
// console.log('Post object has changed from original.', $inspect(orig_event_obj));
|
||||||
|
console.log('Post object has changed from original.', orig_event_obj);
|
||||||
|
console.log('Post object has changed.', $idaa_slct.event_obj);
|
||||||
|
obj_changed = true;
|
||||||
|
} else if (obj_changed && orig_event_obj?.id && (JSON.stringify($idaa_slct.event_obj) === JSON.stringify(orig_event_obj) && !description_changed && !notes_changed)) {
|
||||||
|
obj_changed = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user