Work on expanding the routes

This commit is contained in:
Scott Idem
2024-03-04 20:55:48 -05:00
parent 6c60ee3086
commit 19a6ff6dbe
22 changed files with 846 additions and 118 deletions

View File

@@ -0,0 +1,66 @@
<script lang="ts">
/** @type {import('./$types').LayoutData} */
export let data;
import { goto } from '$app/navigation';
</script>
<svelte:head>
<title>Events Badges - {data.ae_loc.title}</title>
</svelte:head>
<!-- <h1>Events Badges Layout?</h1> -->
<div class="submenu flex flex-row justify-center">
<span class="btn-group variant-soft-secondary px-4 py-2">
{#each Object.entries(data.submenu) as [key, item]}
<!-- <a href="/settings/{item.slug}">{item.title}</a> -->
<!-- class:hidden={!$ae_loc.trusted_access && item.access} -->
{#if item.disable}
<button
title={item.title}
class="hover:variant-ghost-secondary"
class:hidden={(!data.ae_loc.trusted_access && item.access === 'trusted') || (!data.ae_loc.administrator_access && item.access === 'administrator' || item.hide)}
disabled={item.disable}
on:click={() => {
// window.location(item.href);
// href={item.href}
// invalidateAll
goto(item.href, { });
}}
>
{item.name}
</button>
{:else}
<a
href={item.href}
title={item.title}
class="hover:variant-ghost-secondary"
class:hidden={(!data.ae_loc.trusted_access && item.access === 'trusted') || (!data.ae_loc.administrator_access && item.access === 'administrator' || item.hide)}
class:disabled={item.disable}
>
{item.name}
</a>
{/if}
<!-- <button
title={item.title}
class="hover:variant-ghost-secondary"
class:hidden={(!data.ae_loc.trusted_access && item.access === 'trusted') || (!data.ae_loc.administrator_access && item.access === 'administrator' || item.hide)}
disabled={item.disable}
on:click={() => {
// window.location(item.href);
// href={item.href}
// invalidateAll
goto(item.href, { });
}}
>
{item.name}
</button> -->
{/each}
</span>
</div>
<slot></slot>

View File

@@ -0,0 +1,33 @@
/** @type {import('./$types').LayoutLoad} */
import { get } from 'svelte/store';
import { api } from '$lib/api';
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
import type { key_val } from '$lib/ae_stores';
export async function load({ params, parent, url }) { // route
// console.log(`Svelte Events Badges layout.ts data = params:`, params);
// console.log(`Svelte Events Badges layout.ts data = route:`, route);
// console.log(`Svelte Events Badges layout.ts data = url:`, url);
// const { ae_init, root_layout_ts } = await parent();
let data = await parent();
console.log(`Svelte Events Badges layout.ts data = data:`, data);
data.ae_events_badges_layout_ts = true;
let submenu = {
main: {name: 'Main', href: '/events_badges', access: false},
manage: {name: 'Manage', href: '/events_badges/manage', access: 'administrator', disable: true},
review: {name: 'Review', href: '/events_badges/review', access: false},
print: {name: 'Print', href: '/events_badges/print', access: 'trusted', disable: true},
view: {name: 'View', href: '/events_badges/view', access: 'trusted', hide: true}, // event_badge_id
// new: {name: 'New', href: '/events_badges/new'},
test: {name: 'Test', href: '/sponsorships'},
};
data.submenu = submenu
return data;
}

View File

@@ -0,0 +1,40 @@
<script lang="ts">
export let data;
// console.log(`ae_ Svelte Events Badges +page data:`, data);
import { onMount } from 'svelte';
import { api } from '$lib/api';
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/ae_stores';
import { ae_util } from '$lib/ae_utils';
import type { key_val } from '$lib/ae_stores';
onMount(() => {
console.log('Events Badges: +page.svelte');
let href_url = window.location.href;
// console.log(href_url);
$ae_loc.href_url = href_url;
// console.log(`$ae_loc.href_url = `, $ae_loc.href_url);
// $slct_trigger = 'msg_parent';
ae_util.handle_url_and_message('event_id', $slct.event_id);
ae_util.handle_url_and_message('event_badge_id', $slct.event_badge_id);
if ($slct.event_badge_id) {
console.log(`Got an ID. Let's show the modal!`);
modalStore.trigger(modal_edit__event_badge_obj);
}
});
</script>
<section class="ae_events_badges md:container h-full mx-auto">
</section>
<style lang="postcss">
</style>

View File

@@ -0,0 +1,6 @@
/** @type {import('./$types').PageLoad} */
export function load() {
return {
ae_events_badges_page_ts: true,
};
}