feat(events): reorganize badge admin tools and enhance dependency tracking
- Migrated 'Add New Badge' and 'Upload Badge List' to centralized Event Settings hub. - Secured Admin Tools visibility with Administrator access and Edit Mode requirements. - Restored and modernized Badge Template management route with Svelte 5 runes. - Patched 'Archive' and 'Session' database interfaces to resolve compiler errors. - Added project-wide dependency comments to key interfaces (Archive, Badge, Session) to prevent cascading change regressions. - Fixed duplicate import errors in the Settings page.
This commit is contained in:
@@ -262,38 +262,6 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if show_create_badge_modal}
|
||||
<Modal bind:open={show_create_badge_modal}>
|
||||
<div class="card p-4">
|
||||
<h3 class="h3">Create New Badge</h3>
|
||||
<Comp_badge_create_form
|
||||
event_id={$events_slct?.event_id ?? ''}
|
||||
on:success={() => {
|
||||
show_create_badge_modal = false;
|
||||
$events_loc.badges.search_version++;
|
||||
}}
|
||||
on:cancel={() => (show_create_badge_modal = false)}
|
||||
/>
|
||||
</div>
|
||||
</Modal>
|
||||
{/if}
|
||||
|
||||
{#if show_upload_badge_modal}
|
||||
<Modal bind:open={show_upload_badge_modal}>
|
||||
<div class="card p-4">
|
||||
<h3 class="h3">Upload Badges (CSV)</h3>
|
||||
<Comp_badge_upload_form
|
||||
event_id={$events_slct?.event_id ?? ''}
|
||||
on:success={() => {
|
||||
show_upload_badge_modal = false;
|
||||
$events_loc.badges.search_version++;
|
||||
}}
|
||||
on:cancel={() => (show_upload_badge_modal = false)}
|
||||
/>
|
||||
</div>
|
||||
</Modal>
|
||||
{/if}
|
||||
|
||||
<svelte:head>
|
||||
<title>
|
||||
Badges -
|
||||
@@ -307,50 +275,6 @@
|
||||
log_lvl={1}
|
||||
></Comp_badge_search>
|
||||
|
||||
{#if $ae_loc.trusted_access}
|
||||
<div class="mt-4 text-center">
|
||||
<button type="button" class="btn btn-primary" onclick={() => (show_create_badge_modal = true)}>
|
||||
<span class="fas fa-plus mr-2"></span> Add New Badge
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary ml-2" onclick={() => (show_upload_badge_modal = true)}>
|
||||
<span class="fas fa-upload mr-2"></span> Upload Badge List
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="mt-4 text-center p-4 border rounded-md">
|
||||
<h4 class="h4">Mass Print Options</h4>
|
||||
<div class="flex flex-wrap justify-center gap-2">
|
||||
<a
|
||||
href={`/events/${$events_slct?.event_id ?? ''}/badges/print_list?printed_status=not_printed`}
|
||||
class="btn variant-filled-secondary"
|
||||
>
|
||||
<span class="fas fa-print mr-2"></span> Print All Unprinted
|
||||
</a>
|
||||
<a
|
||||
href={`/events/${$events_slct?.event_id ?? ''}/badges/print_list?badge_type_code=guest&printed_status=not_printed`}
|
||||
class="btn variant-filled-secondary"
|
||||
>
|
||||
<span class="fas fa-print mr-2"></span> Print Unprinted Guests
|
||||
</a>
|
||||
<a
|
||||
href={`/events/${$events_slct?.event_id ?? ''}/badges/print_list`}
|
||||
class="btn variant-filled-secondary"
|
||||
>
|
||||
<span class="fas fa-print mr-2"></span> Print All
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-4 text-center">
|
||||
<a
|
||||
href={`/events/${$events_slct?.event_id ?? ''}/badges/templates`}
|
||||
class="btn btn-tertiary"
|
||||
>
|
||||
<span class="fas fa-file-alt mr-2"></span> Manage Badge Templates
|
||||
</a>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if $events_sess?.badges?.search_status === 'loading' && event_badge_id_li.length === 0}
|
||||
<div class="flex flex-col items-center justify-center p-10 opacity-50 text-center">
|
||||
<LoaderCircle size="3em" class="animate-spin mb-4 mx-auto" />
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/** @type {import('./$types').PageLoad} */
|
||||
console.log(`Events - Badges [badge_id] +page.ts start`);
|
||||
|
||||
import { browser } from '$app/environment';
|
||||
import { events_func } from '$lib/ae_events_functions';
|
||||
|
||||
// This file needs to load the Event Badge ID. It should also include the associated Event Badge Template for the specific badge ID.
|
||||
export async function load({ params, parent, url }) {
|
||||
const log_lvl: number = 2;
|
||||
|
||||
const parent_data = await parent();
|
||||
|
||||
const account_id = parent_data.account_id;
|
||||
|
||||
const ae_acct = parent_data[account_id];
|
||||
|
||||
if (browser) {
|
||||
if (log_lvl) console.log(`ae_events +page.ts (Non-Blocking Refresh)`);
|
||||
|
||||
const event_id = params.event_id;
|
||||
const event_badge_id = params.badge_id;
|
||||
|
||||
if (event_badge_id) {
|
||||
// Refresh the specific selected Event Badge ID
|
||||
events_func.load_ae_obj_id__event_badge({
|
||||
api_cfg: ae_acct.api,
|
||||
event_badge_id: event_badge_id,
|
||||
event_id: event_id, // This event_id should not be needed here... 2026-02-04
|
||||
inc_template: true,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -292,7 +292,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
$effect(async () => {
|
||||
$effect(() => {
|
||||
if (browser && $lq__event_badge_obj?.event_badge_id) {
|
||||
console.log('Generating QR code...');
|
||||
qr_error_message = '';
|
||||
|
||||
@@ -85,13 +85,11 @@
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{#await lq__badge_templates}
|
||||
<p>Loading badge templates...</p>
|
||||
{:then templates}
|
||||
{#if templates.length > 0}
|
||||
{#if $lq__badge_templates}
|
||||
{#if $lq__badge_templates.length > 0}
|
||||
<div class="card p-4">
|
||||
<ul class="list-group">
|
||||
{#each templates as template (template.event_badge_template_id_random)}
|
||||
{#each $lq__badge_templates as template (template.event_badge_template_id_random)}
|
||||
<li class="list-group-item flex justify-between items-center">
|
||||
<span>{template.name}</span>
|
||||
<div>
|
||||
@@ -117,31 +115,31 @@
|
||||
{:else}
|
||||
<p>No badge templates found for this event. Click "Add New Template" to create one.</p>
|
||||
{/if}
|
||||
{:catch error}
|
||||
<p class="text-error-500">Error loading templates: {error.message}</p>
|
||||
{/await}
|
||||
{:else}
|
||||
<p>Loading badge templates...</p>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
{#if show_create_template_modal}
|
||||
<Modal bind:show={show_create_template_modal}>
|
||||
<Modal bind:open={show_create_template_modal}>
|
||||
<div class="card p-4">
|
||||
<Comp_badge_template_form
|
||||
{event_id}
|
||||
on:success={handle_create_success}
|
||||
on:cancel={handle_cancel}
|
||||
onsuccess={handle_create_success}
|
||||
oncancel={handle_cancel}
|
||||
/>
|
||||
</div>
|
||||
</Modal>
|
||||
{/if}
|
||||
|
||||
{#if show_edit_template_modal}
|
||||
<Modal bind:show={show_edit_template_modal}>
|
||||
<Modal bind:open={show_edit_template_modal}>
|
||||
<div class="card p-4">
|
||||
<Comp_badge_template_form
|
||||
{event_id}
|
||||
template_id={selected_template_id}
|
||||
on:success={handle_edit_success}
|
||||
on:cancel={handle_cancel}
|
||||
onsuccess={handle_edit_success}
|
||||
oncancel={handle_cancel}
|
||||
/>
|
||||
</div>
|
||||
</Modal>
|
||||
Reference in New Issue
Block a user