feat: Fix event list and add module links

This commit fixes the event list on the /events page by correcting the data fetching logic. It also adds links to the 'Pres Mgmt', 'Badges', 'Leads', and 'Launcher' modules for each event, and updates the main event link to use the random string ID.
This commit is contained in:
Scott Idem
2025-11-18 18:18:25 -05:00
parent c8c19a35a6
commit 9ea6b17617
2 changed files with 42 additions and 7 deletions

View File

@@ -10,6 +10,8 @@
import { events_loc, events_slct, events_trigger } from '$lib/stores/ae_events_stores';
import { ae_util } from '$lib/ae_utils/ae_utils';
import { page } from '$app/stores';
interface Props {
data: any;
}
@@ -18,13 +20,13 @@
// import Element_data_store from '$lib/element_data_store_v2.svelte';
let ae_acct = data[$slct.account_id];
let lq__event_obj_li = $derived(
liveQuery(async () => {
const account_id = $page.data.account_id;
if (!account_id) return [];
let results = await db_events.event
.where('account_id')
.equals(ae_acct.slct.account_id)
.equals(account_id)
.reverse()
.sortBy('start_datetime');
return results;
@@ -113,9 +115,8 @@
<li class:dim={event_obj?.hide}>
<!-- 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.event_id_random} -->
<a
href="/events/{event_obj.event_id}"
href="/events/{event_obj.event_id_random}"
class="btn btn-md preset-tonal-primary border border-primary-500 hover:preset-filled-primary-500"
>
{ae_util.iso_datetime_formatter(event_obj.start_datetime, 'date_long')}
@@ -133,10 +134,28 @@
{#if $ae_loc.trusted_access}
<a
data-sveltekit-reload
href="/event/{event_obj.event_id}"
href="/events/{event_obj.event_id_random}"
class="btn btn-sm preset-tonal-warning border border-warning-500 hover:preset-filled-warning-500"
>
Manage
Pres Mgmt
</a>
<a
href="/events/{event_obj.event_id_random}/badges"
class="btn btn-sm preset-tonal-secondary border border-secondary-500 hover:preset-filled-secondary-500"
>
Badges
</a>
<a
href="/events/{event_obj.event_id_random}/leads"
class="btn btn-sm preset-tonal-secondary border border-secondary-500 hover:preset-filled-secondary-500"
>
Leads
</a>
<a
href="/events/{event_obj.event_id_random}/launcher"
class="btn btn-sm preset-tonal-secondary border border-secondary-500 hover:preset-filled-secondary-500"
>
Launcher
</a>
{/if}
</li>