Saving my work beforeI rename the notes module to journals module. Finally.

This commit is contained in:
Scott Idem
2025-03-15 23:21:06 -04:00
parent 183d431e1d
commit d8020b3d77
13 changed files with 471 additions and 230 deletions

View File

@@ -1,38 +0,0 @@
/** @type {import('./$types').PageLoad} */
import { error } from '@sveltejs/kit';
import { notes_func } from '$lib/ae_notes/ae_notes_functions';
export async function load({ parent }) {
let log_lvl: number = 0;
let data = await parent();
// let account_id = data.account_id;
// if (!account_id) {
// console.log(`ae_notes +page.ts: The account_id was not found in the data!!!`);
// error(500, {
// message: 'Not found'
// });
// }
// let ae_acct = data[account_id];
// Should we limit these to note.conference = true?
// let load_note_obj_li = await notes_func.handle_load_ae_obj_li__note({
// api_cfg: ae_acct.api,
// account_id: account_id,
// params: {enabled: 'enabled', qry__limit: 25},
// try_cache: false,
// log_lvl: 1
// });
// ae_acct.slct.note_obj_li = load_note_obj_li;
// data[account_id] = ae_acct;
return data;
// return {
// ae_notes_page_ts: true,
// };
}

View File

@@ -47,7 +47,7 @@ import { events_loc, events_slct } from '$lib/ae_events_stores';
import Element_access_type from '$lib/element_access_type.svelte'; import Element_access_type from '$lib/element_access_type.svelte';
import Element_app_cfg from '$lib/element_app_cfg.svelte'; import Element_app_cfg from '$lib/element_app_cfg.svelte';
import Element_data_store from '$lib/element_data_store_v2.svelte'; // import Element_data_store from '$lib/element_data_store_v2.svelte';
interface Props { interface Props {
data: any; data: any;
@@ -389,102 +389,8 @@ $effect(() => {
{#if {#if
$ae_loc?.allow_access} $ae_loc?.allow_access}
<Modal components={modalRegistry} <!-- The children will contain top level (directly under body tag) div tag(s) or similar. Modal and AppShell should also be set there. The AppShell gives access to a header, footer, AppBar (usually under header), -->
regionBackdrop='' {@render children?.()}
regionBody=''
regionHeader='modal-header card-header text-2xl font-bold'
regionFooter='modal-footer flex justify-between space-x-2'
/>
<!-- App Shell -->
<AppShell
regionPage={($ae_loc.iframe ? 'iframe' : '')}
slotHeader={($ae_loc.iframe ? 'iframe' : '')}
slotFooter={($ae_loc.iframe ? 'iframe' : '')}
>
{#snippet header()}
<!-- App Bar -->
<AppBar
gridColumns="grid-cols-3"
slotDefault="place-self-center"
slotTrail="place-content-end"
padding="px-4"
>
{#snippet lead()}
<Element_data_store
ds_code="hub__page__appshell_header_lead"
ds_type="html"
/>
{/snippet}
<!-- OSIT's Aether App -->
<!-- {@html (browser ? JSON.parse(localStorage.getItem('ae_ds__hub__site__appshell_header')).html : '-- not found --')} -->
<!-- {@html $ae_sess.site_appshell_header} -->
<Element_data_store
ds_code="hub__site__appshell_header"
ds_type="html"
/>
{#snippet trail()}
<Element_data_store
ds_code="hub__page__appshell_header_trail"
ds_type="html"
/>
{/snippet}
</AppBar>
{/snippet}
<!-- !($ae_loc.site_access_key && $ae_loc.site_domain_access_key)
|| ($ae_loc.site_access_key == access_key || $ae_loc.site_domain_access_key == access_key)} -->
<!-- {$ae_loc?.site_access_key ?? '-- site access key not set --'} -->
<!-- {$ae_loc?.site_domain_access_key ?? '-- site domain access key not set --'} -->
<!-- {access_key ?? '-- param key not set --'} -->
<!-- Page Route Content -->
{@render children?.()}
{#snippet footer()}
<div
class="flex text-sm sm:text-sm md:text-md lg:text-md xl:text-md 2xl:text-lg text-slate-400 hover:text-slate-800 transition px-1"
class:ae_debug={$ae_loc.debug}
>
<Element_data_store
ds_code="hub__site__appshell_footer"
ds_type="html"
class_li="grow flex flex-row justify-between"
/>
<button
type="button"
onclick={() => {
console.log('Debug ae_loc:', $ae_loc);
$ae_loc.debug = !$ae_loc?.debug;
}}
id="AE-Quick-Debug"
class="ae_quick_debug btn btn-sm variant-glass-surface transition-all"
title="Turn debug content and styles off and on"
>
&pi;
</button>
</div>
{/snippet}
</AppShell>
{:else if browser} {:else if browser}
@@ -532,6 +438,25 @@ $effect(() => {
</span> </span>
<div
class="flex text-sm sm:text-sm md:text-md lg:text-md xl:text-md 2xl:text-lg text-slate-400 hover:text-slate-800 transition px-1"
class:ae_debug={$ae_loc.debug}
>
<button
type="button"
onclick={() => {
console.log('Debug ae_loc:', $ae_loc);
$ae_loc.debug = !$ae_loc?.debug;
}}
id="AE-Quick-Debug"
class="ae_quick_debug btn btn-sm variant-glass-surface transition-all"
title="Turn debug content and styles off and on"
>
&pi;
</button>
</div>
<style lang="postcss"> <style lang="postcss">
/* BEGIN: AE's Svelte Quick Debug component */ /* BEGIN: AE's Svelte Quick Debug component */
#AE-Quick-Debug { #AE-Quick-Debug {
@@ -541,8 +466,8 @@ $effect(() => {
/* position: static; */ /* position: static; */
/* position: sticky; */ /* position: sticky; */
/* top: 1em; */ /* top: 1em; */
bottom: 0rem; bottom: 2rem;
right: 0rem; left: 1rem;
padding: .0rem; padding: .0rem;
@@ -563,7 +488,7 @@ $effect(() => {
font-size: .75rem; font-size: .75rem;
z-index: 5; z-index: 15;
/* NOTE: transition when no longer hovering */ /* NOTE: transition when no longer hovering */
transition-property: opacity, background-color; transition-property: opacity, background-color;

View File

@@ -1,14 +1,35 @@
<script lang="ts"> <script lang="ts">
/** @type {import('./$types').LayoutData} */
export let data: any;
// Imports // Imports
// *** Import Svelte specific
import { browser } from '$app/environment'; import { browser } from '$app/environment';
// *** Import other supporting libraries
import { AppShell, AppBar, initializeStores } from '@skeletonlabs/skeleton';
import { Modal } from '@skeletonlabs/skeleton';
import type {
ModalComponent
} from '@skeletonlabs/skeleton';
const modalRegistry: Record<string, ModalComponent> = {
// Set a unique modal ID, then pass the component reference
// modalComponentEditSponsorshipObj: { ref: ModalComponentEditSponsorshipObj },
// modalComponentTwo: { ref: ModalComponentTwo },
// ...
};
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 { ae_loc, ae_sess, ae_api, slct } from '$lib/ae_stores'; import { ae_loc, ae_sess, ae_api, slct } from '$lib/ae_stores';
import Element_data_store from '$lib/element_data_store_v2.svelte';
import { events_loc, events_sess, events_slct, events_trigger, events_trig_kv } from '$lib/ae_events_stores'; import { events_loc, events_sess, events_slct, events_trigger, events_trig_kv } from '$lib/ae_events_stores';
interface Props {
/** @type {import('./$types').LayoutData} */
data: any;
children?: import('svelte').Snippet;
}
let { data, children }: Props = $props();
// import { events_func } from '$lib/ae_events_functions'; // import { events_func } from '$lib/ae_events_functions';
// import Element_data_store from '$lib/element_data_store_v2.svelte'; // import Element_data_store from '$lib/element_data_store_v2.svelte';
@@ -101,4 +122,89 @@ if (browser) {
<title>Presentation Management - {$events_loc.title ?? 'Æ loading...'}</title> <title>Presentation Management - {$events_loc.title ?? 'Æ loading...'}</title>
</svelte:head> </svelte:head>
<slot></slot>
<Modal components={modalRegistry}
regionBackdrop=''
regionBody=''
regionHeader='modal-header card-header text-2xl font-bold'
regionFooter='modal-footer flex justify-between space-x-2'
/>
<!-- App Shell -->
<AppShell
regionPage={($ae_loc.iframe ? 'iframe' : '')}
slotHeader={($ae_loc.iframe ? 'iframe' : '')}
slotFooter={($ae_loc.iframe ? 'iframe' : '')}
>
{#snippet header()}
<!-- App Bar -->
<AppBar
gridColumns="grid-cols-3"
slotDefault="place-self-center"
slotTrail="place-content-end"
padding="px-4"
>
{#snippet lead()}
<Element_data_store
ds_code="hub__page__appshell_header_lead"
ds_type="html"
/>
{/snippet}
<!-- OSIT's Aether App -->
<!-- {@html (browser ? JSON.parse(localStorage.getItem('ae_ds__hub__site__appshell_header')).html : '-- not found --')} -->
<!-- {@html $ae_sess.site_appshell_header} -->
<Element_data_store
ds_code="hub__site__appshell_header"
ds_type="html"
/>
{#snippet trail()}
<Element_data_store
ds_code="hub__page__appshell_header_trail"
ds_type="html"
/>
{/snippet}
</AppBar>
{/snippet}
<!-- !($ae_loc.site_access_key && $ae_loc.site_domain_access_key)
|| ($ae_loc.site_access_key == access_key || $ae_loc.site_domain_access_key == access_key)} -->
<!-- {$ae_loc?.site_access_key ?? '-- site access key not set --'} -->
<!-- {$ae_loc?.site_domain_access_key ?? '-- site domain access key not set --'} -->
<!-- {access_key ?? '-- param key not set --'} -->
<!-- Page Route Content -->
{@render children?.()}
{#snippet footer()}
<div
class="flex text-sm sm:text-sm md:text-md lg:text-md xl:text-md 2xl:text-lg text-slate-400 hover:text-slate-800 transition px-1"
class:ae_debug={$ae_loc.debug}
>
<Element_data_store
ds_code="hub__site__appshell_footer"
ds_type="html"
class_li="grow flex flex-row justify-between"
/>
</div>
{/snippet}
</AppShell>

View File

@@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
export let data: any;
// console.log(`ae_events_pres_mgmt +page data:`, data); // console.log(`ae_events_pres_mgmt +page data:`, data);
// console.log(`ae_events_pres_mgmt Data Params:`, data.url.searchParams.get('event_id')); // console.log(`ae_events_pres_mgmt Data Params:`, data.url.searchParams.get('event_id'));
@@ -10,19 +9,24 @@ import { db_events } from "$lib/ae_events/db_events";
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores'; import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
import { events_loc, events_slct, events_trigger } from '$lib/ae_events_stores'; import { events_loc, events_slct, events_trigger } from '$lib/ae_events_stores';
import { ae_util } from '$lib/ae_utils/ae_utils'; import { ae_util } from '$lib/ae_utils/ae_utils';
interface Props {
data: any;
}
let { data }: Props = $props();
// import Element_data_store from '$lib/element_data_store_v2.svelte'; // import Element_data_store from '$lib/element_data_store_v2.svelte';
let ae_acct = data[$slct.account_id]; let ae_acct = data[$slct.account_id];
$: lq__event_obj_li = liveQuery(async () => { let lq__event_obj_li = $derived(liveQuery(async () => {
let results = await db_events.events let results = await db_events.events
.where('account_id') .where('account_id')
.equals(ae_acct.slct.account_id) .equals(ae_acct.slct.account_id)
.reverse() .reverse()
.sortBy('start_datetime') .sortBy('start_datetime')
return results; return results;
}); }));
onMount(() => { onMount(() => {
@@ -88,8 +92,7 @@ onMount(() => {
new Date(event_obj.start_datetime ?? '').getTime()) new Date(event_obj.start_datetime ?? '').getTime())
> >
(new Date().getTime() - (1000 * 60 * 60 * 24 * 30 * 8)) (new Date().getTime() - (1000 * 60 * 60 * 24 * 30 * 8))
|| $ae_loc.trusted_access || $ae_loc.trusted_access}
}
<!-- {#if $events_slct.event_id === event_obj.event_id_random} --> <!-- {#if $events_slct.event_id === event_obj.event_id_random} -->
<a <a

View File

@@ -1,9 +1,18 @@
<script lang="ts"> <script lang="ts">
/** @type {import('./$types').LayoutData} */ import { run } from 'svelte/legacy';
export let data: any;
import { browser } from '$app/environment'; import { browser } from '$app/environment';
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 } from '$lib/ae_idaa_stores'; import { idaa_loc, idaa_sess, idaa_slct } from '$lib/ae_idaa_stores';
interface Props {
/** @type {import('./$types').LayoutData} */
data: any;
children?: import('svelte').Snippet;
}
let { data, children }: Props = $props();
let log_lvl: number = 0; let log_lvl: number = 0;
@@ -106,39 +115,41 @@ if (browser && iframe == 'true') {
$: if ($ae_loc.iframe && $ae_loc.iframe_height && $ae_loc.iframe_height_modal_body) { run(() => {
if (log_lvl > 1) { if ($ae_loc.iframe && $ae_loc.iframe_height && $ae_loc.iframe_height_modal_body) {
console.log('Getting new dimensions for iframe with modal:', $ae_loc.iframe_height, $ae_loc.iframe_height_modal_body); if (log_lvl > 1) {
} console.log('Getting new dimensions for iframe with modal:', $ae_loc.iframe_height, $ae_loc.iframe_height_modal_body);
let iframe_height = 0;
if ($ae_loc.iframe_height > $ae_loc.iframe_height_modal_body) {
iframe_height = $ae_loc.iframe_height;
} else {
iframe_height = $ae_loc.iframe_height_modal_body;
// console.log($ae_loc.modal_dimensions);
if ($ae_loc.modal_dimensions && $ae_loc.modal_dimensions.header_height) {
iframe_height = iframe_height + $ae_loc.modal_dimensions.header_height;
} }
if ($ae_loc.modal_dimensions && $ae_loc.modal_dimensions.footer_height) {
iframe_height = iframe_height + $ae_loc.modal_dimensions.footer_height;
}
// iframe_height = iframe_height + 50; // Just in case
}
if (log_lvl > 1) { let iframe_height = 0;
console.log(`Suggested new iframe_height with modal: ${iframe_height}`);
if ($ae_loc.iframe_height > $ae_loc.iframe_height_modal_body) {
iframe_height = $ae_loc.iframe_height;
} else {
iframe_height = $ae_loc.iframe_height_modal_body;
// console.log($ae_loc.modal_dimensions);
if ($ae_loc.modal_dimensions && $ae_loc.modal_dimensions.header_height) {
iframe_height = iframe_height + $ae_loc.modal_dimensions.header_height;
}
if ($ae_loc.modal_dimensions && $ae_loc.modal_dimensions.footer_height) {
iframe_height = iframe_height + $ae_loc.modal_dimensions.footer_height;
}
// iframe_height = iframe_height + 50; // Just in case
}
if (log_lvl > 1) {
console.log(`Suggested new iframe_height with modal: ${iframe_height}`);
}
window.parent.postMessage({'iframe_height': iframe_height}, "*"); // This should be in pixels
} else if ($ae_loc.iframe && $ae_loc.iframe_height) {
if (log_lvl > 1) {
console.log('Suggested new iframe_height:', $ae_loc.iframe_height);
}
window.parent.postMessage({'iframe_height': $ae_loc.iframe_height}, "*"); // This should be in pixels
} }
window.parent.postMessage({'iframe_height': iframe_height}, "*"); // This should be in pixels });
} else if ($ae_loc.iframe && $ae_loc.iframe_height) {
if (log_lvl > 1) {
console.log('Suggested new iframe_height:', $ae_loc.iframe_height);
}
window.parent.postMessage({'iframe_height': $ae_loc.iframe_height}, "*"); // This should be in pixels
}
</script> </script>
@@ -158,7 +169,7 @@ $: if ($ae_loc.iframe && $ae_loc.iframe_height && $ae_loc.iframe_height_modal_bo
<div <div
bind:clientHeight={$ae_loc.iframe_height} bind:clientHeight={$ae_loc.iframe_height}
> >
<slot /> {@render children?.()}
</div> </div>
{#if $idaa_loc.novi_uuid} {#if $idaa_loc.novi_uuid}
<span class="text-sm text-gray-500"> <span class="text-sm text-gray-500">

View File

@@ -0,0 +1,119 @@
<script lang="ts">
/** @type {import('./$types').LayoutData} */
// Imports
// *** Import Svelte specific
import { browser } from '$app/environment';
// *** Import other supporting libraries
import { AppShell, AppBar, initializeStores } from '@skeletonlabs/skeleton';
import { Modal } from '@skeletonlabs/skeleton';
import type {
ModalComponent
} from '@skeletonlabs/skeleton';
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 } from '$lib/ae_idaa_stores';
import Element_data_store from '$lib/element_data_store_v2.svelte';
const modalRegistry: Record<string, ModalComponent> = {
// Set a unique modal ID, then pass the component reference
// modalComponentEditSponsorshipObj: { ref: ModalComponentEditSponsorshipObj },
// modalComponentTwo: { ref: ModalComponentTwo },
// ...
};
let { data, children }: Props = $props();
</script>
<svelte:head>
<title>IDAA - {$idaa_loc.title ?? 'Æ loading...'}</title>
</svelte:head>
<Modal components={modalRegistry}
regionBackdrop=''
regionBody=''
regionHeader='modal-header card-header text-2xl font-bold'
regionFooter='modal-footer flex justify-between space-x-2'
/>
<!-- App Shell -->
<AppShell
regionPage={($ae_loc.iframe ? 'iframe' : '')}
slotHeader={($ae_loc.iframe ? 'iframe' : '')}
slotFooter={($ae_loc.iframe ? 'iframe' : '')}
>
{#snippet header()}
<!-- App Bar -->
<AppBar
gridColumns="grid-cols-3"
slotDefault="place-self-center"
slotTrail="place-content-end"
padding="px-4"
>
{#snippet lead()}
<Element_data_store
ds_code="hub__page__appshell_header_lead"
ds_type="html"
/>
{/snippet}
<!-- OSIT's Aether App -->
<!-- {@html (browser ? JSON.parse(localStorage.getItem('ae_ds__hub__site__appshell_header')).html : '-- not found --')} -->
<!-- {@html $ae_sess.site_appshell_header} -->
<Element_data_store
ds_code="hub__site__appshell_header"
ds_type="html"
/>
{#snippet trail()}
<Element_data_store
ds_code="hub__page__appshell_header_trail"
ds_type="html"
/>
{/snippet}
</AppBar>
{/snippet}
<!-- !($ae_loc.site_access_key && $ae_loc.site_domain_access_key)
|| ($ae_loc.site_access_key == access_key || $ae_loc.site_domain_access_key == access_key)} -->
<!-- {$ae_loc?.site_access_key ?? '-- site access key not set --'} -->
<!-- {$ae_loc?.site_domain_access_key ?? '-- site domain access key not set --'} -->
<!-- {access_key ?? '-- param key not set --'} -->
<!-- Page Route Content -->
{@render children?.()}
{#snippet footer()}
<div
class="flex text-sm sm:text-sm md:text-md lg:text-md xl:text-md 2xl:text-lg text-slate-400 hover:text-slate-800 transition px-1"
class:ae_debug={$ae_loc.debug}
>
<Element_data_store
ds_code="hub__site__appshell_footer"
ds_type="html"
class_li="grow flex flex-row justify-between"
/>
</div>
{/snippet}
</AppShell>

View File

@@ -1,6 +0,0 @@
<script lang="ts">
/** @type {import('./$types').LayoutData} */
</script>
<slot />

View File

@@ -49,8 +49,48 @@ if (browser) {
</script> </script>
<svelte:head>
<title>Notes - {$notes_loc.title ?? 'Æ loading...'}</title>
</svelte:head>
<div class="ae_notes container m-auto outline-red-500">
<nav class="submenu flex flex-row items-centr justify-center gap-1">
<a href="/" class="btn btn-sm variant-ghost-success hover:variant-filled-success">Home</a>
<!-- <a href="/about" class="btn btn-sm">About</a> -->
<!-- <a href="/settings" class="btn btn-sm">Settings</a> -->
<button
onclick={() => {
// Clear the local and session storage. Clearing the localStorage will force it to be re-created.
localStorage.clear();
sessionStorage.clear();
// Clear Indexed DB as well
indexedDB.deleteDatabase('ae_core_db');
indexedDB.deleteDatabase('ae_notes_db');
// This does not seem to work fast enough or something?
goto('/', {invalidateAll: true});
// The page does usually seem to reload correctly?
window.location.reload(true); // true only works with Firefox
// alert('Local and Session Storage cleared and Indexed DBs deleted. You will probably want to refresh the page.');
}}
class="btn btn-sm variant-ghost-success hover:variant-filled-success"
title="Clear App Data &amp; Settings - Reload: Clear the browser storage for this site"
>
<!-- <span class="fas fa-eraser mx-1"></span> -->
<span class="fas fa-sync mx-1"></span>
Clear &amp; Reload
</button>
</nav>
{#if $ae_loc.administrator_access && 1==2} {#if $ae_loc.administrator_access && 1==2}
<section <nav
class="submenu flex flex-row justify-center" class="submenu flex flex-row justify-center"
class:hidden={$ae_loc.iframe} class:hidden={$ae_loc.iframe}
> >
@@ -89,10 +129,26 @@ if (browser) {
{/each} {/each}
</span> </span>
</section> </nav>
{/if} {/if}
<div class="container m-auto outline-red-500"> <section class="status flex flex-col justify-center items-center gap-1">
{@render children()} {#if $ae_loc.administrator_access}
<h3 class="h4">Administrator Access - Technical Support</h3>
<p>You are accessing the notes module with "administrator" level permissions.</p>
{:else if $ae_loc.trusted_access}
<h3 class="h4">Trusted Access - Staff</h3>
<p>You are accessing the notes module with "trusted" level permissions.</p>
{:else if !$ae_loc.trusted_access}
<h3 class="h4">Restricted Access</h3>
<p>You are accessing to the notes module is limited</p>
{/if}
</section>
<section class="main_content outline">
{@render children()}
</section>
</div> </div>

View File

@@ -9,45 +9,45 @@ import { notes_func } from '$lib/ae_notes/ae_notes_functions';
export async function load({ params, parent }) { export async function load({ params, parent }) {
let log_lvl: number = 0; let log_lvl: number = 0;
let data = await parent(); let parent_data = await parent();
// console.log(`ae_notes +layout.ts data:`, data); // console.log(`ae_notes +layout.ts parent_data:`, parent_data);
let account_id = data.account_id; let account_id = parent_data.account_id;
if (!account_id) { if (!account_id) {
console.log(`notes +layout.ts: The account_id was not found in the data!!!`); console.log(`notes +layout.ts: The account_id was not found in the parent_data!!!`);
return false; return false;
} }
let ae_acct = data[account_id]; let ae_acct = parent_data[account_id];
if (log_lvl) { if (log_lvl) {
console.log(`ae_acct = `, ae_acct); console.log(`ae_acct = `, ae_acct);
} }
let note_id = ae_acct.slct.note_id; // From root +layout.ts // let note_id = ae_acct.slct.note_id; // From root +layout.ts
if (!note_id) { // if (!note_id) {
console.log(`ERROR: notes +layout.ts: The note_id was not found in the data!!!`); // console.log(`ERROR: notes +layout.ts: The note_id was not found in the parent_data!!!`);
// return false; // // return false;
} // }
let ae_params = {}; // let ae_params = {};
if (browser) { // if (browser) {
if (note_id) { // if (note_id) {
let load_note_obj_li = notes_func.load_ae_obj_li__note({ // let load_note_obj_li = notes_func.load_ae_obj_li__note({
api_cfg: ae_acct.api, // api_cfg: ae_acct.api,
for_obj_type: 'account', // for_obj_type: 'account',
for_obj_id: account_id, // for_obj_id: account_id,
enabled: 'enabled', // enabled: 'enabled',
hidden: 'not_hidden', // hidden: 'not_hidden',
limit: 20, // limit: 20,
// order_by_li: {}, // // order_by_li: {},
params: ae_params, // params: ae_params,
try_cache: true, // try_cache: true,
log_lvl: log_lvl // log_lvl: log_lvl
}); // });
ae_acct.slct.note_obj_li = load_note_obj_li; // ae_acct.slct.note_obj_li = load_note_obj_li;
} // }
} // }
// let load_note_obj = notes_func.load_ae_obj_id__note({ // let load_note_obj = notes_func.load_ae_obj_id__note({
// api_cfg: ae_acct.api, // api_cfg: ae_acct.api,
@@ -70,12 +70,12 @@ export async function load({ params, parent }) {
// // manage: {name: 'Manage', href: '/notes/manage', access: 'administrator', disable: true, hide: true}, // // manage: {name: 'Manage', href: '/notes/manage', access: 'administrator', disable: true, hide: true},
// locations: {name: 'Locations', href: `/notes/${note_id}/locations`, access: false, disable: false, hide: false}, // locations: {name: 'Locations', href: `/notes/${note_id}/locations`, access: false, disable: false, hide: false},
// }; // };
// data.submenu = submenu // parent_data.submenu = submenu
// WARNING: Precaution against shared data between sites and sessions. // WARNING: Precaution against shared parent_data between sites and sessions.
data[account_id] = ae_acct; parent_data[account_id] = ae_acct;
return data; return parent_data;
} }
// export const prerender = false; // export const prerender = false;

View File

@@ -24,8 +24,8 @@ let ae_acct = data[$slct.account_id];
// $notes_slct.note_obj_li = ae_acct.slct.note_obj_li; // $notes_slct.note_obj_li = ae_acct.slct.note_obj_li;
let lq__note_obj_li = liveQuery( let lq__note_obj_li = $derived(liveQuery(async () => {
() => db_notes.notes let results = await db_notes.note
.orderBy('start_datetime') .orderBy('start_datetime')
.reverse() .reverse()
.toArray() .toArray()
@@ -40,17 +40,21 @@ let lq__note_obj_li = liveQuery(
// // .orderBy('name') // // .orderBy('name')
// // .offset(10).limit(5) // // .offset(10).limit(5)
// // .toArray() // // .toArray()
);
return results;
}));
// console.log(`lq__note_obj_li:`, $lq__note_obj_li); // console.log(`lq__note_obj_li:`, $lq__note_obj_li);
let lq__note_obj = liveQuery( let lq__note_obj = $derived(liveQuery(async () => {
async () => db_notes.notes let results = await db_notes.notes
.where('id') .where('id')
.equals(ae_acct.slct.note_id) .equals(ae_acct.slct.note_id)
.toArray() .toArray()
// .first() // .first()
// .get($notes_slct.note_id) // .get($notes_slct.note_id)
);
return results;
}));
onMount(() => { onMount(() => {
console.log('Events - Presentation Management: +page.svelte'); console.log('Events - Presentation Management: +page.svelte');

61
src/routes/notes/+page.ts Normal file
View File

@@ -0,0 +1,61 @@
/** @type {import('./$types').PageLoad} */
import { error } from '@sveltejs/kit';
import { browser } from '$app/environment';
import { notes_func } from '$lib/ae_notes/ae_notes_functions';
export async function load({ parent }) {
let log_lvl: number = 0;
let parent_data = await parent();
let account_id = parent_data.account_id;
let ae_acct = parent_data[account_id];
let note_id = ae_acct.slct.note_id; // From root +layout.ts
if (!note_id) {
console.log(`ERROR: notes +layout.ts: The note_id was not found in the parent_data!!!`);
// return false;
}
if (browser) {
if (note_id) {
// let ae_params = {};
let load_note_obj_li = notes_func.load_ae_obj_id__note({
api_cfg: ae_acct.api,
note_id: note_id,
// params: ae_params,
try_cache: true,
log_lvl: log_lvl
});
ae_acct.slct.note_obj_li = load_note_obj_li;
}
// Should we limit these to note.conference = true?
let load_note_obj_li = await notes_func.load_ae_obj_li__note({
api_cfg: ae_acct.api,
for_obj_type: 'account',
for_obj_id: account_id,
hidden: 'not_hidden',
enabled: 'enabled',
order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'},
limit: 25,
// params: ae_params,
try_cache: false,
log_lvl: log_lvl
});
ae_acct.slct.note_obj_li = load_note_obj_li;
}
parent_data[account_id] = ae_acct;
return parent_data;
// return {
// ae_notes_page_ts: true,
// };
}

View File

@@ -48,13 +48,13 @@ import { notes_loc, notes_slct, notes_trigger } from '$lib/ae_notes/ae_notes_sto
<section class="status flex flex-col justify-center items-center gap-1"> <section class="status flex flex-col justify-center items-center gap-1">
{#if $ae_loc.administrator_access} {#if $ae_loc.administrator_access}
<h3 class="h4">Administrator Access - Technical Support</h3> <h3 class="h4">Administrator Access - Technical Support</h3>
<p>You are accessing the notes system with "administrator" level permissions.</p> <p>You are accessing the notes module with "administrator" level permissions.</p>
{:else if $ae_loc.trusted_access} {:else if $ae_loc.trusted_access}
<h3 class="h4">Trusted Access - Staff</h3> <h3 class="h4">Trusted Access - Staff</h3>
<p>You are accessing the notes system with "trusted" level permissions.</p> <p>You are accessing the notes module with "trusted" level permissions.</p>
{:else if !$ae_loc.trusted_access} {:else if !$ae_loc.trusted_access}
<h3 class="h4">Restricted Access</h3> <h3 class="h4">Restricted Access</h3>
<p>You are accessing to the notes system is limited</p> <p>You are accessing to the notes module is limited</p>
{/if} {/if}
</section> </section>