Trying to wrap up for the day.

This commit is contained in:
Scott Idem
2024-06-12 18:58:06 -04:00
parent b368abc91a
commit 84f6f1eda8
6 changed files with 122 additions and 27 deletions

View File

@@ -26,7 +26,7 @@ export let get_object = async function get_object(
as_list=false,
// The task_id value should be a random string that is unique to the task. This is used to identify the task in the message event.
task_id=crypto.randomUUID(),
log_lvl=1
log_lvl=0
} : {
api_cfg: any,
endpoint: string,

View File

@@ -296,6 +296,7 @@ export interface Presenter {
export class MySubClassedDexie extends Dexie {
// 'badges' is added by dexie when declaring the stores()
// We just tell the typing system this is the case
events!: Table<Event>;
badges!: Table<Badge>;
exhibits!: Table<Exhibit>;
exhibit_tracking!: Table<Exhibit_tracking>;
@@ -304,7 +305,8 @@ export class MySubClassedDexie extends Dexie {
super('ae_events_db');
this.version(1).stores({
events: `
id_random, code, account_id_random,
id_random, event_id_random,
code, account_id_random,
conference, type,
name, summary, description,
start_datetime, end_datetime,

View File

@@ -28,19 +28,22 @@ console.log(`ae_acct = `, ae_acct);
$events_slct.event_id = ae_acct.slct.event_id;
$events_slct.event_obj = ae_acct.slct.event_obj;
$events_slct.event_obj_li = ae_acct.slct.event_obj_li;
let ae_promises: key_val = {};
onMount(() => {
console.log('Events - Presentation Management: +layout.svelte');
console.log($events_slct.event_obj_li);
});
</script>
<svelte:head>
<title>Events - Presentation Management - {$events_loc.title ?? 'Æ loading...'}</title>
<title>Presentation Management - {$events_loc.title ?? 'Æ loading...'}</title>
</svelte:head>

View File

@@ -19,20 +19,20 @@ export async function load({ parent }) {
return false;
}
// Should we limit these to event.conference = true?
let load_event_obj_li = events_func.handle_load_ae_obj_li__event({
api_cfg: ae_acct.api,
account_id: account_id,
params: {enabled: 'enabled', qry__limit: 25},
try_cache: false,
log_lvl: 1
});
ae_acct.slct.event_obj_li = load_event_obj_li;
// // Should we limit these to event.conference = true?
// let load_event_obj_li = events_func.handle_load_ae_obj_li__event({
// api_cfg: ae_acct.api,
// account_id: account_id,
// params: {enabled: 'enabled', qry__limit: 25},
// try_cache: false,
// log_lvl: 1
// });
// ae_acct.slct.event_obj_li = load_event_obj_li;
let event_id = ae_acct.slct.event_id;
if (!event_id) {
console.log(`events_pres_mgmt +layout.ts: The event_id was not found in the data!!!`);
console.log(`ERROR: events_pres_mgmt +layout.ts: The event_id was not found in the data!!!`);
return false;
}

View File

@@ -15,7 +15,12 @@ import { ae_util } from '$lib/ae_utils';
import Element_data_store from '$lib/element_data_store.svelte';
let event_obj_li = liveQuery(
let ae_acct = data[$slct.account_id];
$events_slct.event_obj = ae_acct.slct.event_obj;
$events_slct.event_obj_li = ae_acct.slct.event_obj_li;
let lq__event_obj_li = liveQuery(
() => db_events.events
.orderBy('start_datetime')
.reverse()
@@ -32,6 +37,16 @@ let event_obj_li = liveQuery(
// // .offset(10).limit(5)
// // .toArray()
);
// console.log(`lq__event_obj_li:`, $lq__event_obj_li);
let lq__event_obj = liveQuery(
async () => db_events.events
.where('id')
.equals(await ae_acct.slct.event_id)
.toArray()
// .first()
// .get($events_slct.event_id)
);
onMount(() => {
console.log('Events - Presentation Management: +page.svelte');
@@ -43,26 +58,39 @@ onMount(() => {
$ae_loc.href_url = href_url;
// console.log(`$ae_loc.href_url = `, $ae_loc.href_url);
console.log(`lq__event_obj = `, $lq__event_obj);
// $events_slct.event_obj = db_events.events.get($events_slct.event_id);
console.log(`$events_slct.event_obj = `, $events_slct.event_obj.name);
});
</script>
<section class="ae_events_pres_mgmt md:container h-full mx-auto">
<h2 class="h3">Presentation Management for {$events_slct.name} ({$events_slct.event_id})</h2>
<h2 class="h3">Presentation Management for {$ae_loc.account_name ?? 'Æ loading...'}</h2>
<h3 class="h4">Restricted Access</h3>
<p>Accessing the presentation management system is currently restricted</p>
<!-- {$events_slct.event_obj.name ?? '--'} -->
<!-- ({$events_slct.event_id}) -->
{#if $ae_loc.administrator_access}
<h3 class="h4">Administrator Access - Technical Support</h3>
<p>Your accessing the presentation management system with "administrator" level permissions.</p>
{:else if $ae_loc.trusted_access}
<h3 class="h4">Trusted Access - Staff</h3>
<p>Your accessing the presentation management system with "trusted" level permissions.</p>
{:else if !$ae_loc.trusted_access}
<h3 class="h4">Restricted Access</h3>
<p>Your accessing to the presentation management system is limited</p>
{/if}
<Element_data_store
<!-- <Element_data_store
ds_code="events__pres_mgmt__overview"
ds_type="html"
for_type="event"
for_id={$events_slct.event_id}
display="block"
class_li="p-2"
/>
/> -->
<!-- <Element_data_store
ds_code="events__pres_mgmt__example"
@@ -78,15 +106,54 @@ onMount(() => {
/> -->
{#if $event_obj_li}
<ul>
{#each $event_obj_li as event_obj}
{#if $lq__event_obj_li}
<ul
class="space-y-2"
>
{#each $lq__event_obj_li as event_obj}
<li>
<a href="/events_pres_mgmt/event/{event_obj.id_random}" class="hover:underline">
<!-- We do not want to show events more than 8 months old. -->
{#if (
new Date(event_obj.start_datetime).getTime())
>
(new Date().getTime() - (1000 * 60 * 60 * 24 * 30 * 8))
|| $ae_loc.trusted_access
}
<!-- {#if $events_slct.event_id === event_obj.id_random} -->
<a
href="/events_pres_mgmt/event/{event_obj.id_random}"
class="btn btn-md variant-ghost-primary hover:variant-filled-primary hover:underline"
on:pointerover={() => {
// When the cursor is hovering we want to set the event_id and event_obj
// $events_slct.event_id = event_obj.id_random;
// $events_slct.event_obj = event_obj;
}}
>
{ae_util.iso_datetime_formatter(event_obj.start_datetime, 'date_long')}
-
{event_obj.name}
</a>
{:else}
<button
disabled
class="btn btn-md variant-ghost-surface"
>
{ae_util.iso_datetime_formatter(event_obj.start_datetime, 'date_long')}
-
{event_obj.name}
</button>
{/if}
{#if $ae_loc.trusted_access}
<a
data-sveltekit-reload
href="/event/{event_obj.id_random}"
class="btn btn-sm variant-ghost-warning hover:variant-filled-warning hover:underline"
>
Manage
</a>
{/if}
</li>
{/each}
</ul>

View File

@@ -1,6 +1,29 @@
/** @type {import('./$types').PageLoad} */
export function load() {
return {
ae_events_pres_mgmt_page_ts: true,
};
import { events_func } from '$lib/ae_events_functions';
export async function load({ parent }) {
let data = await parent();
let account_id = data.account_id;
let ae_acct = data[account_id];
// Should we limit these to event.conference = true?
let load_event_obj_li = await events_func.handle_load_ae_obj_li__event({
api_cfg: ae_acct.api,
account_id: account_id,
params: {enabled: 'enabled', qry__limit: 25},
try_cache: false,
log_lvl: 1
});
ae_acct.slct.event_obj_li = load_event_obj_li;
data[account_id] = ae_acct;
return data;
// return {
// ae_events_pres_mgmt_page_ts: true,
// };
}