Updates related to IDAA API functions and related. Some style updates.
This commit is contained in:
@@ -282,7 +282,6 @@ function add_activity_log(
|
||||
<!-- Modal: Post (Bulletin Board) view ID -->
|
||||
<!-- title="{$lq__post_obj?.title ?? 'New Post'} - {$lq__post_obj?.id ?? 'Not Saved Yet'}" -->
|
||||
<Modal
|
||||
|
||||
bind:open={$idaa_sess.bb.show__modal_view__post_id}
|
||||
autoclose={false}
|
||||
outsideclose={true}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
/** @type {import('./$types').PageData} */
|
||||
export let data: any;
|
||||
let log_lvl: number = 0;
|
||||
import { run } from 'svelte/legacy';
|
||||
|
||||
let log_lvl: number = $state(0);
|
||||
// console.log(`ae_events_pres_mgmt event [event_id] +page.svelte data:`, data);
|
||||
|
||||
import { browser } from '$app/environment';
|
||||
@@ -25,20 +25,26 @@ import Comp__event_obj_qry from './ae_idaa_comp__event_obj_qry.svelte';
|
||||
import Comp__event_obj_li from './ae_idaa_comp__event_obj_li.svelte';
|
||||
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';
|
||||
interface Props {
|
||||
/** @type {import('./$types').PageData} */
|
||||
data: any;
|
||||
}
|
||||
|
||||
let event_id_random_li: Array<string>;
|
||||
let { data }: Props = $props();
|
||||
|
||||
let event_id_random_li: Array<string> = $state();
|
||||
|
||||
|
||||
// Functions and Logic
|
||||
$: lq__event_obj = liveQuery(async () => {
|
||||
let lq__event_obj = $derived(liveQuery(async () => {
|
||||
let results = await db_events.events
|
||||
.get($idaa_slct.event_id);
|
||||
.get($idaa_slct.event_id ?? '');
|
||||
|
||||
return results;
|
||||
});
|
||||
}));
|
||||
|
||||
|
||||
$: lq_new__event_obj_li = liveQuery(async () => {
|
||||
let lq_new__event_obj_li = $derived(liveQuery(async () => {
|
||||
let link_to_type: string = 'account';
|
||||
let link_to_id: string = $slct.account_id;
|
||||
if (log_lvl > 1) {
|
||||
@@ -90,43 +96,46 @@ $: lq_new__event_obj_li = liveQuery(async () => {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
|
||||
// This (event_li trigger for IDAA) is not currently being used.
|
||||
// Updated 2024-11-19
|
||||
$: if ($idaa_trig.event_li) {
|
||||
$idaa_trig.event_li = false;
|
||||
run(() => {
|
||||
if ($idaa_trig.event_li) {
|
||||
$idaa_trig.event_li = false;
|
||||
|
||||
if (log_lvl) {
|
||||
console.log(`Triggered: $idaa_trig.event_li`);
|
||||
if (log_lvl) {
|
||||
console.log(`Triggered: $idaa_trig.event_li`);
|
||||
}
|
||||
|
||||
if ($idaa_loc.recovery_meetings.qry__enabled !== 'all' || $idaa_loc.recovery_meetings.qry__hidden !== 'all') {
|
||||
console.log(`Deleting disabled or hidden event.`);
|
||||
let results = db_events.events
|
||||
.clear();
|
||||
console.log(`Deleted ${results} disabled event.`);
|
||||
|
||||
}
|
||||
|
||||
$idaa_prom.load__event_obj_li = events_func.load_ae_obj_li__event({
|
||||
api_cfg: $ae_api,
|
||||
for_obj_type: 'account',
|
||||
for_obj_id: $idaa_slct.account_id,
|
||||
qry_conference: false,
|
||||
enabled: $idaa_loc.recovery_meetings.qry__enabled,
|
||||
hidden: $idaa_loc.recovery_meetings.qry__hidden,
|
||||
limit: $idaa_loc.recovery_meetings.qry__limit,
|
||||
order_by_li: $idaa_loc.recovery_meetings.qry__order_by_li,
|
||||
try_cache: true,
|
||||
log_lvl: log_lvl,
|
||||
});
|
||||
}
|
||||
|
||||
if ($idaa_loc.recovery_meetings.qry__enabled !== 'all' || $idaa_loc.recovery_meetings.qry__hidden !== 'all') {
|
||||
console.log(`Deleting disabled or hidden event.`);
|
||||
let results = db_events.events
|
||||
.clear();
|
||||
console.log(`Deleted ${results} disabled event.`);
|
||||
|
||||
}
|
||||
|
||||
$idaa_prom.load__event_obj_li = events_func.load_ae_obj_li__event({
|
||||
api_cfg: $ae_api,
|
||||
for_obj_type: 'account',
|
||||
for_obj_id: $idaa_slct.account_id,
|
||||
qry_conference: false,
|
||||
enabled: $idaa_loc.recovery_meetings.qry__enabled,
|
||||
hidden: $idaa_loc.recovery_meetings.qry__hidden,
|
||||
limit: $idaa_loc.recovery_meetings.qry__limit,
|
||||
order_by_li: $idaa_loc.recovery_meetings.qry__order_by_li,
|
||||
try_cache: true,
|
||||
log_lvl: log_lvl,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Updated 2024-11-19
|
||||
$: if ($idaa_trig.event_li_qry) {
|
||||
run(() => {
|
||||
if ($idaa_trig.event_li_qry) {
|
||||
$idaa_trig.event_li_qry = false;
|
||||
|
||||
if (log_lvl) {
|
||||
@@ -258,8 +267,8 @@ $: if ($idaa_trig.event_li_qry) {
|
||||
clearInterval(request_loop);
|
||||
}
|
||||
}, search_delay);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (browser) {
|
||||
@@ -373,7 +382,7 @@ function add_activity_log(
|
||||
/>
|
||||
|
||||
|
||||
{#if $lq_new__event_obj_li && $lq_new__event_obj_li?.length }
|
||||
{#if $lq_new__event_obj_li && $lq_new__event_obj_li?.length}
|
||||
<Comp__event_obj_li
|
||||
lq__event_obj_li={lq_new__event_obj_li}
|
||||
/>
|
||||
@@ -386,8 +395,8 @@ function add_activity_log(
|
||||
|
||||
|
||||
<!-- Modal: Event (Recovery Meeting) edit ID -->
|
||||
<!-- title="{$lq__event_obj?.name} - {$lq__event_obj?.id}" -->
|
||||
<Modal
|
||||
title="{$lq__event_obj?.name} - {$lq__event_obj?.id}"
|
||||
bind:open={$idaa_sess.recovery_meetings.show__modal_edit}
|
||||
autoclose={false}
|
||||
placement="top-center"
|
||||
@@ -395,27 +404,27 @@ function add_activity_log(
|
||||
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">
|
||||
{#snippet 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 === $idaa_loc.novi_uuid || $lq__event_obj?.contact_li_json[0]?.email === $idaa_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);
|
||||
onclick={() => {
|
||||
// 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_edit = false;
|
||||
$idaa_sess.recovery_meetings.show__modal_view = true;
|
||||
$idaa_sess.recovery_meetings.show__modal_edit = false;
|
||||
$idaa_sess.recovery_meetings.show__modal_view = true;
|
||||
|
||||
add_activity_log(
|
||||
{
|
||||
action: 'idaa_meetings_page',
|
||||
action_with: 'cancel_edit',
|
||||
}
|
||||
);
|
||||
}}
|
||||
add_activity_log(
|
||||
{
|
||||
action: 'idaa_meetings_page',
|
||||
action_with: 'cancel_edit',
|
||||
}
|
||||
);
|
||||
}}
|
||||
class="novi_btn btn btn-sm preset-tonal-warning border border-warning-500 hover:preset-filled-warning-500 transition"
|
||||
title={`View meeting: ${$lq__event_obj?.name}`}
|
||||
>
|
||||
@@ -428,72 +437,69 @@ function add_activity_log(
|
||||
{$lq__event_obj?.name ?? 'New Recovery Meeting'}
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
</svelte:fragment>
|
||||
{/snippet}
|
||||
|
||||
<Comp__event_obj_id_edit
|
||||
lq__event_obj={lq__event_obj}
|
||||
/>
|
||||
|
||||
|
||||
<svelte:fragment slot="footer">
|
||||
{#snippet footer()}
|
||||
<div class="text-center w-full">
|
||||
<button
|
||||
type="button"
|
||||
on:click={() => {
|
||||
console.log('Close modal');
|
||||
$idaa_sess.recovery_meetings.show__modal_edit = false;
|
||||
onclick={() => {
|
||||
console.log('Close modal');
|
||||
$idaa_sess.recovery_meetings.show__modal_edit = false;
|
||||
|
||||
add_activity_log(
|
||||
{
|
||||
action: 'idaa_meetings_page',
|
||||
action_with: 'close_modal',
|
||||
}
|
||||
);
|
||||
}}
|
||||
add_activity_log(
|
||||
{
|
||||
action: 'idaa_meetings_page',
|
||||
action_with: 'close_modal',
|
||||
}
|
||||
);
|
||||
}}
|
||||
class="novi_btn btn btn-sm preset-tonal-warning hover:preset-tonal-warning border border-warning-500"
|
||||
>
|
||||
<span class="fas fa-times mx-1"></span>
|
||||
Close
|
||||
</button>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
{/snippet}
|
||||
|
||||
</Modal>
|
||||
|
||||
|
||||
<!-- Modal: Event (Recovery Meeting) view ID -->
|
||||
<!-- title="{$lq__event_obj?.name} - {$lq__event_obj?.id}" -->
|
||||
<Modal
|
||||
title="{$lq__event_obj?.name} - {$lq__event_obj?.id}"
|
||||
bind:open={$idaa_sess.recovery_meetings.show__modal_view}
|
||||
autoclose={false}
|
||||
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"
|
||||
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">
|
||||
|
||||
{#snippet header()}
|
||||
<div class="flex flex-row items-center justify-between w-full">
|
||||
<h3 class="text-lg font-semibold text-center">
|
||||
{#if $ae_loc.trusted_access || $lq__event_obj?.external_person_id === $idaa_loc.novi_uuid || $lq__event_obj?.contact_li_json[0].email === $idaa_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);
|
||||
onclick={() => {
|
||||
// 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;
|
||||
$idaa_sess.recovery_meetings.show__modal_view = false;
|
||||
$idaa_sess.recovery_meetings.show__modal_edit = true;
|
||||
|
||||
add_activity_log(
|
||||
{
|
||||
action: 'idaa_meetings_page',
|
||||
action_with: 'edit',
|
||||
}
|
||||
);
|
||||
}}
|
||||
add_activity_log(
|
||||
{
|
||||
action: 'idaa_meetings_page',
|
||||
action_with: 'edit',
|
||||
}
|
||||
);
|
||||
}}
|
||||
class="novi_btn btn btn-sm preset-tonal-warning border border-warning-500 hover:preset-filled-warning-500 transition"
|
||||
title={`Edit meeting: ${$lq__event_obj?.name}`}
|
||||
>
|
||||
@@ -501,7 +507,7 @@ function add_activity_log(
|
||||
</button>
|
||||
{/if}
|
||||
<span class="fas fa-calendar-day m-1"></span>
|
||||
{$lq__event_obj?.name ?? '-- not set'}
|
||||
{$lq__event_obj?.name ?? '-- not set --'}
|
||||
</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.">
|
||||
@@ -512,7 +518,19 @@ function add_activity_log(
|
||||
</span>
|
||||
{/if}
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="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_edit = false;
|
||||
}}
|
||||
>
|
||||
<span class="fas fa-times"></span>
|
||||
Close
|
||||
</button>
|
||||
{/snippet}
|
||||
|
||||
<Comp__event_obj_id_view
|
||||
lq__event_obj={lq__event_obj}
|
||||
|
||||
Reference in New Issue
Block a user