<script lang="ts">
export let data;
console.log(`ae_events_badges +page data:`, data);
console.log(`ae_events_badges Data Params:`, data.url.searchParams.get('event_id'));

import { onMount } from 'svelte';

import { api } from '$lib/api';
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 { ae_util } from '$lib/ae_utils';

import Element_data_store from '$lib/element_data_store.svelte';


// if (data.url.searchParams.get('event_id')) {
//     $events_slct.event_id = data.url.searchParams.get('event_id');
// } else if (data.ae_loc.site_cfg_json.slct__event_id) {
//     $events_slct.event_id = data.ae_loc.site_cfg_json.slct__event_id;
// } else if ($events_loc.default__event_id) {
//     $events_slct.event_id = $events_loc.default__event_id;
// } else if ($events_slct.event_id) {
//     console.log(`Event ID already set:`, $events_slct.event_id);
// } else {
//     console.log(`No Event ID set.`);
// }


onMount(() => {
    console.log('Events Badges: +page.svelte');

    console.log('ae_ slct:', $slct);

    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', $events_slct.event_id);
    ae_util.handle_url_and_message('badge_id', $events_slct.badge_id);
    // if ($events_slct.badge_id) {
    //     console.log(`Got an ID. Let's show the modal!`);
    //     modalStore.trigger(modal_edit__badge_obj);
    // }
});
</script>


<section class="ae_events_badges md:container h-full mx-auto">

<h2 class="h3">Badges for ISHLT 2024 ({$events_slct.event_id})</h2>

<h3 class="h4">Restricted Access</h3>
<p>Accessing the badge printing for ISHLT 2024 is currently restricted</p>


<Element_data_store
    ds_code="events__badges__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__badges__example"
    ds_type="html"
    for_type="event"
    for_id={$events_slct.event_id}
    ds_name="Default: Events Badges Example"
    store="local"
    display="block"
    class_li="variant-ghost-surface p-2"
    try_cache={true}
    show_edit={false}
    /> -->

</section>


<style lang="postcss">
</style>
