Lots of clean up. Going to go with backup plan for IDAA and dealing with the Novi iframes.
This commit is contained in:
@@ -2,15 +2,7 @@
|
||||
let log_lvl: number = 0;
|
||||
|
||||
// *** Import Aether specific variables and functions
|
||||
// import type { key_val } from '$lib/ae_stores';
|
||||
// import { ae_util } from '$lib/ae_utils/ae_utils';
|
||||
|
||||
// import { liveQuery } from "dexie";
|
||||
// import { core_func } from '$lib/ae_core_functions';
|
||||
// import { db_events } from "$lib/db_events";
|
||||
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
||||
// import { events_loc, events_sess, events_slct, events_trigger } from '$lib/ae_events_stores';
|
||||
// import { events_func } from '$lib/ae_events_functions';
|
||||
import { idaa_loc, idaa_sess, idaa_slct } from '$lib/ae_idaa_stores';
|
||||
|
||||
interface Props {
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
<script lang="ts">
|
||||
import { run } from 'svelte/legacy';
|
||||
import { page } from '$app/state';
|
||||
interface Props {
|
||||
/** @type {import('./$types').PageData} */
|
||||
data: any;
|
||||
}
|
||||
|
||||
let { data }: Props = $props();
|
||||
|
||||
let log_lvl: number = $state(0);
|
||||
// console.log(`ae_events_pres_mgmt event [event_id] +page.svelte data:`, data);
|
||||
|
||||
// *** Import Svelte specific
|
||||
import { page } from '$app/state';
|
||||
import { browser } from '$app/environment';
|
||||
// import { goto, invalidate, pushState, replaceState } from '$app/navigation';
|
||||
|
||||
// *** Import other supporting libraries
|
||||
import { Modal } from 'flowbite-svelte';
|
||||
import { liveQuery } from "dexie";
|
||||
|
||||
// *** Import Aether specific variables and functions
|
||||
// import type { key_val } from '$lib/ae_stores';
|
||||
import { ae_util } from '$lib/ae_utils/ae_utils';
|
||||
import { core_func } from '$lib/ae_core/ae_core_functions';
|
||||
import { idaa_loc, idaa_sess, idaa_slct, idaa_trig, idaa_prom } from '$lib/ae_idaa_stores';
|
||||
|
||||
import { add, liveQuery } from "dexie";
|
||||
import { db_events } from "$lib/ae_events/db_events";
|
||||
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
||||
import { events_func } from '$lib/ae_events_functions';
|
||||
@@ -34,8 +34,6 @@ import Comp__event_obj_id_edit from './ae_idaa_comp__event_obj_id_edit.svelte';
|
||||
import Comp__event_obj_id_view from './ae_idaa_comp__event_obj_id_view.svelte';
|
||||
|
||||
|
||||
let event_id_random_li: Array<string> = $state();
|
||||
|
||||
let event_id = page.url.searchParams.get('event_id') ?? null;
|
||||
if (!event_id) {
|
||||
$idaa_slct.event_id = null;
|
||||
@@ -45,6 +43,8 @@ if (!event_id) {
|
||||
$idaa_trig.event_id = event_id;
|
||||
}
|
||||
|
||||
let event_id_random_li: Array<string> = $state();
|
||||
|
||||
// Functions and Logic
|
||||
let lq_new__event_obj_li = $derived(liveQuery(async () => {
|
||||
let link_to_type: string = 'account';
|
||||
@@ -281,12 +281,12 @@ $effect(() => {
|
||||
|
||||
|
||||
$effect(() => {
|
||||
if ($idaa_trig.event_id) {
|
||||
// log_lvl = 1;
|
||||
if ($idaa_trig.event_id && $idaa_slct.event_id) {
|
||||
log_lvl = 1;
|
||||
$idaa_trig.event_id = false;
|
||||
|
||||
if (log_lvl) {
|
||||
console.log(`Triggered: $idaa_trig.event_id`);
|
||||
console.log(`Triggered: $idaa_slct.event_id = ${$idaa_slct.event_id}`);
|
||||
}
|
||||
|
||||
$idaa_prom.load__event_obj = events_func.load_ae_obj_id__event({
|
||||
@@ -331,9 +331,9 @@ $effect(() => {
|
||||
if (browser) {
|
||||
console.log('Browser environment detected.');
|
||||
|
||||
if (!$idaa_sess.recovery_meetings.show__modal_edit && !$idaa_sess.recovery_meetings.show__modal_view__event_id) {
|
||||
$idaa_slct.event_id = null;
|
||||
}
|
||||
// if (!$idaa_sess.recovery_meetings.show__modal_edit && !$idaa_sess.recovery_meetings.show__modal_view__event_id) {
|
||||
// $idaa_slct.event_id = null;
|
||||
// }
|
||||
|
||||
let message = {'event_id': $idaa_slct?.event_id ?? null};
|
||||
window.parent.postMessage(message, "*");
|
||||
@@ -511,7 +511,7 @@ function add_activity_log(
|
||||
}
|
||||
);
|
||||
}}
|
||||
class="novi_btn btn btn-sm preset-tonal-warning border border-warning-500 hover:preset-filled-warning-500 transition"
|
||||
class="novi_btn btn btn-sm btn-warning preset-tonal-warning border border-warning-500 hover:preset-filled-warning-500 transition"
|
||||
title={`View meeting: ${$lq__event_obj?.name}`}
|
||||
>
|
||||
<span class="fas fa-times m-1"></span> Cancel Edit
|
||||
@@ -544,7 +544,7 @@ function add_activity_log(
|
||||
}
|
||||
);
|
||||
}}
|
||||
class="novi_btn btn btn-sm preset-tonal-warning hover:preset-tonal-warning border border-warning-500"
|
||||
class="novi_btn btn btn-warning btn-sm preset-tonal-warning hover:preset-tonal-warning border border-warning-500"
|
||||
>
|
||||
<span class="fas fa-times mx-1"></span>
|
||||
Close
|
||||
@@ -588,14 +588,16 @@ function add_activity_log(
|
||||
}
|
||||
);
|
||||
}}
|
||||
class="novi_btn btn btn-sm preset-tonal-warning border border-warning-500 hover:preset-filled-warning-500 transition"
|
||||
class="novi_btn btn btn-warning btn-sm preset-tonal-warning border border-warning-500 hover:preset-filled-warning-500 transition"
|
||||
title={`Edit meeting: ${$lq__event_obj?.name}`}
|
||||
>
|
||||
<span class="fas fa-edit m-1"></span> Edit
|
||||
</button>
|
||||
{/if}
|
||||
<span class="fas fa-calendar-day m-1"></span>
|
||||
{$lq__event_obj?.name ?? '-- not set --'}
|
||||
<span class="">
|
||||
<span class="fas fa-calendar-day m-1"></span>
|
||||
{$lq__event_obj?.name ?? '-- not set --'}
|
||||
</span>
|
||||
</h3>
|
||||
{#if $lq__event_obj?.status == 'unknown'}
|
||||
<span class="badge badge-warning preset-tonal-error" title="This meeting has not been confirmed by IDAA Central Office. Please reach out to the chair for current meeting list info. Meeting attendees can reach out to info@idaa.org if they know this is information is accurate and this meeting is still taking place.">
|
||||
@@ -609,12 +611,17 @@ function add_activity_log(
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-sm btn-secondary absolute top-2 right-2"
|
||||
class="novi_btn btn btn-sm btn-secondary absolute top-2 right-2"
|
||||
onclick={() => {
|
||||
$idaa_sess.recovery_meetings.show__modal_view = false;
|
||||
$idaa_sess.recovery_meetings.show__modal_view__event_id = false;
|
||||
$idaa_sess.recovery_meetings.show__modal_edit = false;
|
||||
$idaa_sess.recovery_meetings.show__modal_edit__event_id = false;
|
||||
|
||||
$idaa_slct.event_id = null;
|
||||
$idaa_slct.event_obj = null;
|
||||
let message = {'event_id': $idaa_slct.event_id ?? null};
|
||||
window.parent.postMessage(message, "*");
|
||||
}}
|
||||
>
|
||||
<span class="fas fa-times"></span>
|
||||
@@ -635,6 +642,11 @@ function add_activity_log(
|
||||
$idaa_sess.recovery_meetings.show__modal_view__event_id = false;
|
||||
$idaa_sess.recovery_meetings.show__modal_edit = false;
|
||||
$idaa_sess.recovery_meetings.show__inline_edit__event_obj = false;
|
||||
|
||||
$idaa_slct.event_id = null;
|
||||
$idaa_slct.event_obj = null;
|
||||
let message = {'event_id': $idaa_slct.event_id ?? null};
|
||||
window.parent.postMessage(message, "*");
|
||||
}}
|
||||
>
|
||||
<span class="fas fa-times"></span>
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
<script lang="ts">
|
||||
import type { PageData } from './$types';
|
||||
|
||||
let { data }: { data: PageData } = $props();
|
||||
|
||||
let log_lvl: number = 0;
|
||||
|
||||
// *** Import Svelte specific
|
||||
import { browser } from '$app/environment';
|
||||
|
||||
// *** Import other supporting libraries
|
||||
import { Modal } from 'flowbite-svelte';
|
||||
import { liveQuery } from "dexie";
|
||||
|
||||
// *** Import Aether specific variables and functions
|
||||
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 { 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 { events_func } from '$lib/ae_events_functions';
|
||||
|
||||
// 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';
|
||||
|
||||
// *** Quickly pull out data from parent(s)
|
||||
let ae_acct = data[$slct.account_id];
|
||||
if (log_lvl) {
|
||||
console.log(`ae_acct = `, ae_acct);
|
||||
}
|
||||
|
||||
$idaa_slct.event_id = ae_acct.slct.event_id;
|
||||
// $idaa_slct.event_obj = ae_acct.slct.event_obj;
|
||||
|
||||
|
||||
let lq__event_obj = $derived(liveQuery(async () => {
|
||||
if (log_lvl) {
|
||||
console.log(`lq__event_obj: event_id = ${$idaa_slct?.event_id}`);
|
||||
}
|
||||
let results = await db_events.event
|
||||
.get($idaa_slct?.event_id ?? ''); // null or undefined does not reset things like '' does
|
||||
|
||||
return results;
|
||||
}));
|
||||
|
||||
if (browser) {
|
||||
console.log('Browser environment detected.');
|
||||
|
||||
let message = {'event_id': $idaa_slct?.event_id ?? null};
|
||||
window.parent.postMessage(message, "*");
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<svelte:head>
|
||||
<title>
|
||||
IDAA Recovery Meetings:
|
||||
{$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}
|
||||
</title>
|
||||
</svelte:head>
|
||||
|
||||
<a href="/idaa/recovery_meetings" class="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 Meetings -->
|
||||
<span class="fas fa-times m-1"></span> View Other Meetings
|
||||
</a>
|
||||
|
||||
|
||||
<Event_obj_id_view
|
||||
lq__event_obj={lq__event_obj}
|
||||
/>
|
||||
41
src/routes/idaa/(idaa)/recovery_meetings/[event_id]/+page.ts
Normal file
41
src/routes/idaa/(idaa)/recovery_meetings/[event_id]/+page.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
console.log(`ae_p_idaa_events [event_id] +page.ts start`);
|
||||
|
||||
import { browser } from '$app/environment';
|
||||
import { events_func } from '$lib/ae_events_functions';
|
||||
|
||||
export const load = (async ({ params, parent }) => { // route
|
||||
let log_lvl: number = 0;
|
||||
|
||||
let data = await parent();
|
||||
data.log_lvl = log_lvl;
|
||||
|
||||
let account_id = data.account_id;
|
||||
let ae_acct = data[account_id];
|
||||
|
||||
let event_id = params.event_id;
|
||||
|
||||
ae_acct.slct.event_id = event_id;
|
||||
|
||||
if (browser) {
|
||||
if (log_lvl) {
|
||||
console.log(`ae_idaa_events events [event_id] +page.ts: event_id = `, event_id);
|
||||
}
|
||||
// Load event event object
|
||||
let load_event_obj = await events_func.load_ae_obj_id__event({
|
||||
api_cfg: ae_acct.api,
|
||||
event_id: event_id,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log(`load_event_obj = `, load_event_obj);
|
||||
}
|
||||
ae_acct.slct.event_obj = load_event_obj;
|
||||
}
|
||||
|
||||
data[account_id] = ae_acct;
|
||||
|
||||
return data;
|
||||
// return {};
|
||||
}) satisfies PageLoad;
|
||||
@@ -158,6 +158,15 @@ function add_activity_log(
|
||||
</header>
|
||||
|
||||
<div class="ae_options flex flex-row gap-2 items-center justify-center">
|
||||
<a
|
||||
href="/idaa/recovery_meetings/{idaa_event_obj?.event_id}"
|
||||
class="novi_btn btn btn-secondary btn-md preset-tonal-primary border border-primary-500 hover:preset-filled-primary-500 transition"
|
||||
title={`Open to see details: ${idaa_event_obj?.name}`}
|
||||
>
|
||||
<span class="fas fa-envelope-open m-1"></span>
|
||||
<!-- <span class="fas fa-info-circle"></span> -->
|
||||
Info X
|
||||
</a>
|
||||
<button
|
||||
on:click={() => {
|
||||
$idaa_slct.event_id = idaa_event_obj?.event_id;
|
||||
|
||||
Reference in New Issue
Block a user