Making custom changes just for Axonius badge printing next week
This commit is contained in:
@@ -29,8 +29,9 @@ import { events_func } from '$lib/ae_events/ae_events_functions';
|
||||
import Comp_badge_search from './ae_comp__badge_search.svelte';
|
||||
import Comp_badge_obj_li from './ae_comp__badge_obj_li.svelte';
|
||||
import Comp_badge_create_form from './ae_comp__badge_create_form.svelte';
|
||||
import Comp_badge_upload_form from './ae_comp__badge_upload_form.svelte';
|
||||
|
||||
import { LoaderCircle, UserPlus } from '@lucide/svelte';
|
||||
import { LoaderCircle, UserPlus, Printer, Upload, FileText, BarChart2 } from '@lucide/svelte';
|
||||
|
||||
// Load templates for this event so the create form can show the selector and
|
||||
// derive badge_type_code_li from whichever template the user picks.
|
||||
@@ -61,6 +62,7 @@ let lq__badge_template_li = $derived(
|
||||
let show_create_badge_modal: boolean = $state(false);
|
||||
let show_upload_badge_modal: boolean = $state(false);
|
||||
let create_badge_dialog: HTMLDialogElement | undefined = $state();
|
||||
let upload_badge_dialog: HTMLDialogElement | undefined = $state();
|
||||
|
||||
let event_badge_id_li: Array<string> = $state([]);
|
||||
let search_debounce_timer: any = null;
|
||||
@@ -400,6 +402,45 @@ async function handle_search_refresh(params: any) {
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if $ae_loc.trusted_access && (badges_loc.current.enable_upload_badge_li_btn ?? true)}
|
||||
<div class="flex justify-end px-4 mt-2">
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-sm ml-2"
|
||||
onclick={() => {
|
||||
show_upload_badge_modal = true;
|
||||
upload_badge_dialog?.showModal();
|
||||
}}>
|
||||
<Upload size="1em" /> Upload Badge List
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if $ae_loc.trusted_access && (badges_loc.current.enable_mass_print ?? true)}
|
||||
<div class="mt-2 flex gap-2 px-4">
|
||||
<a
|
||||
href={`/events/${$events_slct?.event_id}/badges/print_list?printed_status=not_printed`}
|
||||
class="btn preset-filled-secondary">
|
||||
<Printer size="1em" /> Print Unprinted
|
||||
</a>
|
||||
<a
|
||||
href={`/events/${$events_slct?.event_id}/badges/print_list`}
|
||||
class="btn preset-filled-secondary">
|
||||
<Printer size="1em" /> Print All
|
||||
</a>
|
||||
<a
|
||||
href={`/events/${$events_slct?.event_id}/templates`}
|
||||
class="btn btn-tertiary">
|
||||
<FileText size="1em" /> Manage Templates
|
||||
</a>
|
||||
<a
|
||||
href={`/events/${$events_slct?.event_id}/badges/stats`}
|
||||
class="btn btn-tertiary">
|
||||
<BarChart2 size="1em" /> Badge Printing Stats
|
||||
</a>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Create Badge modal — native <dialog> for focus trap + backdrop.
|
||||
Clicking the backdrop closes it. The form remounts each open so state is fresh. -->
|
||||
<dialog
|
||||
@@ -428,6 +469,38 @@ async function handle_search_refresh(params: any) {
|
||||
{/if}
|
||||
</dialog>
|
||||
|
||||
<!-- Upload Badge List modal -->
|
||||
<dialog
|
||||
bind:this={upload_badge_dialog}
|
||||
class="w-full max-w-lg rounded-xl border border-gray-200 bg-white p-0 shadow-2xl dark:border-gray-700 dark:bg-gray-900"
|
||||
onclick={(e) => {
|
||||
if (e.target === upload_badge_dialog) {
|
||||
upload_badge_dialog?.close();
|
||||
show_upload_badge_modal = false;
|
||||
}
|
||||
}}
|
||||
onclose={() => {
|
||||
show_upload_badge_modal = false;
|
||||
}}>
|
||||
<div class="border-surface-200-800 border-b px-5 py-3">
|
||||
<h2 class="text-surface-900-50 text-base font-semibold">Upload Badge List</h2>
|
||||
</div>
|
||||
{#if show_upload_badge_modal}
|
||||
<Comp_badge_upload_form
|
||||
event_id={$events_slct?.event_id ?? ''}
|
||||
onsuccess={() => {
|
||||
upload_badge_dialog?.close();
|
||||
show_upload_badge_modal = false;
|
||||
badges_loc.current.search_version = (badges_loc.current.search_version ?? 0) + 1;
|
||||
badges_loc.current.qry__remote_first = true;
|
||||
}}
|
||||
oncancel={() => {
|
||||
upload_badge_dialog?.close();
|
||||
show_upload_badge_modal = false;
|
||||
}} />
|
||||
{/if}
|
||||
</dialog>
|
||||
|
||||
{#if $events_sess?.badges?.search_status === 'loading' && event_badge_id_li.length === 0}
|
||||
<div
|
||||
class="flex flex-col items-center justify-center p-10 text-center opacity-50">
|
||||
|
||||
Reference in New Issue
Block a user