|
|
|
|
@@ -0,0 +1,320 @@
|
|
|
|
|
<script lang="ts">
|
|
|
|
|
/** @type {import('./$types').PageData} */
|
|
|
|
|
let log_lvl: number = 1;
|
|
|
|
|
|
|
|
|
|
// *** 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 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 { db_journals } from "$lib/ae_journals/db_journals";
|
|
|
|
|
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
|
|
|
|
import { journals_loc, journals_sess, journals_slct, journals_prom, journals_trig } from '$lib/ae_journals/ae_journals_stores';
|
|
|
|
|
import { journals_func } from '$lib/ae_journals/ae_journals_functions';
|
|
|
|
|
|
|
|
|
|
// import Journal_entry_obj_id_edit from './ae_journals_comp__journal_entry_obj_id_edit.svelte';
|
|
|
|
|
import Journal_entry_view from './../../../ae_comp__journal_entry_obj_id_view.svelte';
|
|
|
|
|
// import Journal_page_menu from './session_page_menu.svelte';
|
|
|
|
|
// import Element_data_store from '$lib/element_data_store_v2.svelte';
|
|
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
|
data: any;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let { data }: Props = $props();
|
|
|
|
|
|
|
|
|
|
// let ae_promises: key_val = {};
|
|
|
|
|
// let ae_tmp: key_val = {};
|
|
|
|
|
// let ae_triggers: key_val = {};
|
|
|
|
|
|
|
|
|
|
// Variables
|
|
|
|
|
// *** Quickly pull out data from parent(s)
|
|
|
|
|
let ae_acct = data[$slct.account_id];
|
|
|
|
|
if (log_lvl) {
|
|
|
|
|
console.log(`ae_acct = `, ae_acct);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// For some reason data.params.journal_entry_id (or whatever param) is not being passed to this page when loaded by a link from another page. This seems to be a bug with Svelte or SvelteKit. Hopefully fixed in a future version 5? 2024-11-06
|
|
|
|
|
$journals_slct.journal_entry_id = ae_acct.slct.journal_entry_id;
|
|
|
|
|
// $journals_slct.journal_entry_obj = ae_acct.slct.journal_entry_obj;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let lq__journal_entry_obj = $derived(liveQuery(async () => {
|
|
|
|
|
if (log_lvl) {
|
|
|
|
|
console.log(`lq__journal_entry_obj: journal_entry_id = ${$journals_slct?.journal_entry_id}`);
|
|
|
|
|
}
|
|
|
|
|
let results = await db_journals.journal_entry
|
|
|
|
|
.get($journals_slct.journal_entry_id ?? ''); // null or undefined does not reset things like '' does
|
|
|
|
|
console.log(`lq__journal_entry_obj: results = `, results);
|
|
|
|
|
|
|
|
|
|
return results;
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
// let lq__journal_entry_obj_li = $derived(liveQuery(async () => {
|
|
|
|
|
// if (log_lvl) {
|
|
|
|
|
// console.log(`$lq__journal_entry_obj.cfg_json = `, $lq__journal_entry_obj?.cfg_json);
|
|
|
|
|
// }
|
|
|
|
|
// if ($lq__journal_entry_obj?.cfg_json?.entry_group_sort === 'DESC') {
|
|
|
|
|
// let results = await db_journals.journal_entry
|
|
|
|
|
// // .orderBy('updated_on')
|
|
|
|
|
// .where('journal_entry_id')
|
|
|
|
|
// .equals($journals_slct?.journal_entry_id ?? '') // null or undefined does not reset things like '' does
|
|
|
|
|
// .reverse()
|
|
|
|
|
// // .sortBy('tmp_sort_2');
|
|
|
|
|
// .sortBy('updated_on');
|
|
|
|
|
// // .sortBy('title');
|
|
|
|
|
|
|
|
|
|
// return results;
|
|
|
|
|
// } else {
|
|
|
|
|
// console.log(`lq__journal_entry_obj_li - default query using journal_entry_id: ${$journals_slct?.journal_entry_id}`);
|
|
|
|
|
// let results = await db_journals.journal_entry
|
|
|
|
|
// .where('journal_entry_id')
|
|
|
|
|
// .equals($journals_slct?.journal_entry_id ?? '') // null or undefined does not reset things like '' does
|
|
|
|
|
// // .reverse()
|
|
|
|
|
// .sortBy('updated_on');
|
|
|
|
|
|
|
|
|
|
// return results;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// }));
|
|
|
|
|
|
|
|
|
|
// let lq__journal_entry_obj = $derived(liveQuery(async () => {
|
|
|
|
|
// if (log_lvl) {
|
|
|
|
|
// console.log(`lq__journal_entry_obj: journal_entry_id = ${$journals_slct?.journal_entry_id}`);
|
|
|
|
|
// }
|
|
|
|
|
// if ($journals_slct.journal_entry_id) {
|
|
|
|
|
// let results = await db_journals.journal_entry
|
|
|
|
|
// .get($journals_slct.journal_entry_id); // null or undefined does not reset things like '' does
|
|
|
|
|
|
|
|
|
|
// return results;
|
|
|
|
|
// }
|
|
|
|
|
// // const results = await db_journals.journal_entry
|
|
|
|
|
// // .get($journals_slct.journal_entry_id); // null or undefined does not reset things like '' does
|
|
|
|
|
|
|
|
|
|
// // return results;
|
|
|
|
|
// }));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$effect(() => {
|
|
|
|
|
// if ($journals_trig.journal_entry_li) {
|
|
|
|
|
// $journals_trig.journal_entry_li = false;
|
|
|
|
|
|
|
|
|
|
// if (log_lvl) {
|
|
|
|
|
// console.log(`Triggered: $journals_trig.journal_entry_li`);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// if ($journals_loc.qry__enabled !== 'all' || $journals_loc.qry__hidden !== 'all') {
|
|
|
|
|
// console.log(`Deleting disabled or hidden journal entry.`);
|
|
|
|
|
// // let results = db_journals.journal_entry
|
|
|
|
|
// // .where('enable')
|
|
|
|
|
// // .notEqual(true)
|
|
|
|
|
// // .delete();
|
|
|
|
|
// let results = db_journals.journal_entry
|
|
|
|
|
// .clear();
|
|
|
|
|
// console.log(`Deleted ${results} disabled journal entry.`);
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// if ($journals_loc.qry__hidden !== 'all') {
|
|
|
|
|
// console.log(`Deleting hidden journal entry.`);
|
|
|
|
|
// let results = db_journals.journal_entry
|
|
|
|
|
// .clear();
|
|
|
|
|
// console.log(`Deleted ${results} hidden journal entry.`);
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// let results = db_journals.journal_entry
|
|
|
|
|
// .where('enable')
|
|
|
|
|
// .equals('false')
|
|
|
|
|
// .delete();
|
|
|
|
|
// console.log(`Deleted ${results} disabled journal entry.`);
|
|
|
|
|
|
|
|
|
|
// $journals_prom.load__journal_entry_obj_li = journals_func.load_ae_obj_li__journal_entry({
|
|
|
|
|
// api_cfg: $ae_api,
|
|
|
|
|
// for_obj_type: 'journal',
|
|
|
|
|
// for_obj_id: $journals_slct.journal_entry_id,
|
|
|
|
|
// enabled: $journals_loc.qry__enabled,
|
|
|
|
|
// hidden: $journals_loc.qry__hidden,
|
|
|
|
|
// limit: $journals_loc.qry__limit,
|
|
|
|
|
// order_by_li: $journals_loc.qry__order_by_li,
|
|
|
|
|
// try_cache: true,
|
|
|
|
|
// log_lvl: log_lvl,
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (browser) {
|
|
|
|
|
// console.log('Browser environment detected.');
|
|
|
|
|
|
|
|
|
|
// let message = {'journal_entry_id': $journals_slct?.journal_entry_id ?? null};
|
|
|
|
|
// window.parent.postMessage(message, "*");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- <svelte:head>
|
|
|
|
|
<title>
|
|
|
|
|
Æ Journals:
|
|
|
|
|
{$lq__journal_entry_obj?.name ? ae_util.shorten_string({ string: $lq__journal_entry_obj?.name, max_length: 20, begin_length: 10, end_length: 4 }) : ''}
|
|
|
|
|
- {$ae_loc?.title}
|
|
|
|
|
</title>
|
|
|
|
|
</svelte:head> -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<section
|
|
|
|
|
class="
|
|
|
|
|
ae_journals__journal_entry
|
|
|
|
|
container h-full mx-auto
|
|
|
|
|
flex flex-col gap-1
|
|
|
|
|
py-1 px-2 pb-16
|
|
|
|
|
items-center
|
|
|
|
|
min-w-full
|
|
|
|
|
max-w-max
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
<!-- <h1>Journals {$lq__journal_entry_obj?.name} - {$lq__journal_entry_obj_li?.length}</h1> -->
|
|
|
|
|
|
|
|
|
|
<a href="/journals/{$lq__journal_entry_obj?.journal_id}" class="novi_btn btn btn-secondary btn-sm
|
|
|
|
|
variant-ghost-tertiary
|
|
|
|
|
hover:variant-filled-tertiary
|
|
|
|
|
transition
|
|
|
|
|
">
|
|
|
|
|
<!-- <span class="fas fa-arrow-left m-1"></span> Back to Journals -->
|
|
|
|
|
<span class="fas fa-arrow-left m-1"></span>
|
|
|
|
|
Back to Journal Entries
|
|
|
|
|
</a>
|
|
|
|
|
|
|
|
|
|
{#if $lq__journal_entry_obj}
|
|
|
|
|
<Journal_entry_view
|
|
|
|
|
lq__journal_entry_obj={lq__journal_entry_obj}
|
|
|
|
|
/>
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Modal: Journal edit ID -->
|
|
|
|
|
<Modal
|
|
|
|
|
title="{$lq__journal_entry_obj?.name} - {$lq__journal_entry_obj?.id}"
|
|
|
|
|
bind:open={$journals_sess.show__modal_edit__journal_entry_id}
|
|
|
|
|
autoclose={false}
|
|
|
|
|
placement="top-center"
|
|
|
|
|
size="xl"
|
|
|
|
|
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"
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
{#snippet header()}
|
|
|
|
|
|
|
|
|
|
<div class="flex flex-row items-center justify-between w-full">
|
|
|
|
|
<h3 class="text-lg font-semibold">
|
|
|
|
|
{#if $ae_loc.trusted_access}
|
|
|
|
|
<!-- <div class="ae_options"> -->
|
|
|
|
|
<button
|
|
|
|
|
onclick={() => {
|
|
|
|
|
// const url = new URL(location);
|
|
|
|
|
// url.searchParams.set('event_id', $lq__journal_entry_obj?.event_id_random);
|
|
|
|
|
// history.pushState({}, '', url);
|
|
|
|
|
|
|
|
|
|
$journals_sess.show__modal_view__journal_entry_id = $journals_slct.journal_entry_id;
|
|
|
|
|
$journals_sess.show__modal_edit__journal_entry_id = false;
|
|
|
|
|
}}
|
|
|
|
|
class="novi_btn btn btn-sm variant-ghost-warning hover:variant-filled-warning transition"
|
|
|
|
|
title={`View meeting: ${$lq__journal_entry_obj?.name}`}
|
|
|
|
|
>
|
|
|
|
|
<span class="fas fa-eye m-1"></span> View
|
|
|
|
|
</button>
|
|
|
|
|
<!-- </div> -->
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
<span class="text-sm text-gray-500">
|
|
|
|
|
Edit Journal:
|
|
|
|
|
</span>
|
|
|
|
|
{$lq__journal_entry_obj?.name}
|
|
|
|
|
</h3>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{/snippet}
|
|
|
|
|
|
|
|
|
|
<!-- <Journal_obj_id_edit
|
|
|
|
|
lq__journal_entry_obj={lq__journal_entry_obj}
|
|
|
|
|
/> -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- <svelte:fragment slot="footer">
|
|
|
|
|
<div class="text-center w-full">
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
on:click={() => {
|
|
|
|
|
console.log('Close modal');
|
|
|
|
|
$journals_sess.recovery_meetings.show__modal_edit__journal_entry_id = false;
|
|
|
|
|
}}
|
|
|
|
|
class="btn btn-sm variant-soft-warning hover:variant-ghost-warning"
|
|
|
|
|
>
|
|
|
|
|
<span class="fas fa-times mx-1"></span>
|
|
|
|
|
Close
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</svelte:fragment> -->
|
|
|
|
|
|
|
|
|
|
</Modal>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Modal: Journal Content edit ID -->
|
|
|
|
|
<!-- <Modal
|
|
|
|
|
bind:open={$journals_sess.show__modal_edit__journal_entry_id}
|
|
|
|
|
title="{$lq__journal_entry_obj?.name ?? 'New Journal Content'} - {$lq__journal_entry_obj?.id ?? 'Not Saved Yet'}"
|
|
|
|
|
autoclose={false}
|
|
|
|
|
placement="top-center"
|
|
|
|
|
size="xl"
|
|
|
|
|
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"
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
{#snippet header()}
|
|
|
|
|
|
|
|
|
|
<div class="flex flex-row items-center justify-between w-full">
|
|
|
|
|
<h3 class="text-lg font-semibold">
|
|
|
|
|
{#if $ae_loc.trusted_access}
|
|
|
|
|
|
|
|
|
|
<button
|
|
|
|
|
onclick={() => {
|
|
|
|
|
// const url = new URL(location);
|
|
|
|
|
// url.searchParams.set('event_id', $lq__journal_entry_obj?.event_id_random);
|
|
|
|
|
// history.pushState({}, '', url);
|
|
|
|
|
|
|
|
|
|
$journals_sess.show__modal_view__journal_entry_id = $journals_slct.journal_entry_id;
|
|
|
|
|
$journals_sess.show__modal_edit__journal_entry_id = false;
|
|
|
|
|
}}
|
|
|
|
|
class="novi_btn btn btn-sm variant-ghost-warning hover:variant-filled-warning transition"
|
|
|
|
|
title={`View meeting: ${$lq__journal_entry_obj?.name}`}
|
|
|
|
|
>
|
|
|
|
|
<span class="fas fa-eye m-1"></span> View
|
|
|
|
|
</button>
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
<span class="text-sm text-gray-500">
|
|
|
|
|
Edit Journal Content:
|
|
|
|
|
</span>
|
|
|
|
|
{$lq__journal_entry_obj?.name ?? 'New Journal Content'}
|
|
|
|
|
</h3>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{/snippet}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</Modal> -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Modal: Journal Content ID media player -->
|
|
|
|
|
<!-- {#if $journals_slct.journal_entry_id && $journals_sess.show__modal_view__journal_entry_id}
|
|
|
|
|
<Modal_media_player
|
|
|
|
|
lq__journal_entry_obj={lq__journal_entry_obj}
|
|
|
|
|
/>
|
|
|
|
|
{/if} -->
|