Just saving my work so far.
This commit is contained in:
@@ -21,7 +21,7 @@ import { idaa_loc, idaa_sess, idaa_slct, idaa_trig, idaa_prom } from '$lib/ae_id
|
||||
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_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)
|
||||
@@ -30,6 +30,7 @@ if (log_lvl) {
|
||||
console.log(`ae_acct = `, ae_acct);
|
||||
}
|
||||
|
||||
$idaa_sess.recovery_meetings.edit__event_id = null;
|
||||
$idaa_slct.event_id = ae_acct.slct.event_id;
|
||||
// $idaa_slct.event_obj = ae_acct.slct.event_obj;
|
||||
|
||||
@@ -38,7 +39,7 @@ 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
|
||||
let results = await db_events.events
|
||||
.get($idaa_slct?.event_id ?? ''); // null or undefined does not reset things like '' does
|
||||
|
||||
return results;
|
||||
@@ -61,16 +62,69 @@ if (browser) {
|
||||
</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>
|
||||
<h2 class="ae_title event__title text-2xl font-bold">
|
||||
<!-- <span class="ae_icon fas fa-calendar-alt"></span> -->
|
||||
<span class="ae_icon fas fa-calendar-day"></span>
|
||||
{$lq__event_obj?.name ? $lq__event_obj?.name : 'Recovery Meeting'}
|
||||
</h2>
|
||||
|
||||
<div
|
||||
class="flex flex-row gap-2 items-center justify-between mb-4"
|
||||
>
|
||||
|
||||
<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 Meeting List
|
||||
<!-- <span class="fas fa-times m-1"></span> View Other Meetings -->
|
||||
</a>
|
||||
|
||||
<!-- View (default)/Edit event_id toggle -->
|
||||
{#if $idaa_sess.recovery_meetings.edit__event_id}
|
||||
<button
|
||||
type="button"
|
||||
class="novi_btn btn btn-warning btn-sm preset-tonal-tertiary border border-tertiary-500
|
||||
hover:preset-filled-tertiary-500 transition"
|
||||
onclick={() => {
|
||||
$idaa_sess.recovery_meetings.edit__event_id = false;
|
||||
if (log_lvl) {
|
||||
console.log(`Toggle edit__event_id: ${$idaa_sess.recovery_meetings.edit__event_id}`);
|
||||
}
|
||||
}}
|
||||
title="View this recovery meeting"
|
||||
>
|
||||
View Meeting?
|
||||
</button>
|
||||
{:else}
|
||||
<!-- This checks if the currently logged in Novi user has a matching UUID or email address. -->
|
||||
{#if ($ae_loc.trusted_access && $ae_loc.edit_mode) || idaa_event_obj?.external_person_id === $idaa_loc.novi_uuid || idaa_event_obj?.contact_li_json[0].email === $idaa_loc.novi_email}
|
||||
<button
|
||||
type="button"
|
||||
class="novi_btn btn btn-warning btn-sm preset-tonal-warning border border-warning-500
|
||||
hover:preset-filled-warning-500 transition"
|
||||
onclick={() => {
|
||||
$idaa_sess.recovery_meetings.edit__event_id = $idaa_slct.event_id;
|
||||
if (log_lvl) {
|
||||
console.log(`Toggle edit__event_id: ${$idaa_sess.recovery_meetings.edit__event_id}`);
|
||||
}
|
||||
}}
|
||||
title="Edit this recovery meeting"
|
||||
>
|
||||
<span class="fas fa-edit m-1"></span>
|
||||
Edit Meeting?
|
||||
</button>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if $idaa_sess.recovery_meetings.edit__event_id}
|
||||
<Event_obj_id_edit
|
||||
lq__event_obj={lq__event_obj}
|
||||
/>
|
||||
{:else}
|
||||
<Event_obj_id_view
|
||||
lq__event_obj={lq__event_obj}
|
||||
/>
|
||||
/>
|
||||
{/if}
|
||||
|
||||
@@ -21,9 +21,9 @@ let prom_api__event_obj: any;
|
||||
|
||||
let disable_submit_btn = true;
|
||||
|
||||
$: if (browser) {
|
||||
document.body.scrollIntoView();
|
||||
}
|
||||
// $: if (browser) {
|
||||
// document.body.scrollIntoView();
|
||||
// }
|
||||
|
||||
if ($idaa_slct.event_id) {
|
||||
// console.log(`Event ID selected: ${$idaa_slct.event_id}`);
|
||||
|
||||
@@ -17,21 +17,21 @@ if ($idaa_slct.event_id) {
|
||||
$slct_trigger = 'load__event_obj';
|
||||
}
|
||||
|
||||
$: if (browser && $lq__event_obj?.event_id) {
|
||||
document.body.scrollIntoView();
|
||||
// $: if (browser && $lq__event_obj?.event_id) {
|
||||
// document.body.scrollIntoView();
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.set('event_id', $lq__event_obj?.event_id);
|
||||
history.pushState({}, '', url);
|
||||
}
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.set('event_id', $lq__event_obj?.event_id);
|
||||
// history.pushState({}, '', url);
|
||||
// }
|
||||
|
||||
onDestroy(() => {
|
||||
console.log('** Component Destroyed: ** View - Event Obj');
|
||||
// onDestroy(() => {
|
||||
// console.log('** Component Destroyed: ** View - Event Obj');
|
||||
|
||||
const url = new URL(location);
|
||||
url.searchParams.delete('event_id');
|
||||
history.pushState({}, '', url);
|
||||
});
|
||||
// const url = new URL(location);
|
||||
// url.searchParams.delete('event_id');
|
||||
// history.pushState({}, '', url);
|
||||
// });
|
||||
|
||||
|
||||
// dayjs.extend(window.dayjs_plugin_utc)
|
||||
@@ -53,6 +53,12 @@ onDestroy(() => {
|
||||
|
||||
<section class="svelte_component ae_section ae_view event_obj view__event_obj space-y-2">
|
||||
|
||||
<h2 class="ae_title event__title text-2xl font-bold">
|
||||
<!-- <span class="ae_icon fas fa-calendar-alt"></span> -->
|
||||
<span class="ae_icon fas fa-calendar-day"></span>
|
||||
{$lq__event_obj?.name ? $lq__event_obj?.name : 'Recovery Meeting'}
|
||||
</h2>
|
||||
|
||||
<div class="p-2 bg-white shadow-md rounded-lg">
|
||||
<div
|
||||
class="meeting_description description mb-4"
|
||||
|
||||
@@ -330,7 +330,9 @@ $effect(() => {
|
||||
</nav>
|
||||
|
||||
<section
|
||||
class="module_main_content main_content grow px-1 md:px-2 pb-28"
|
||||
class="
|
||||
module_main_content main_content grow px-1 md:px-2 pb-28
|
||||
"
|
||||
>
|
||||
|
||||
{@render children?.()}
|
||||
|
||||
Reference in New Issue
Block a user