fix(badges): move Reports link to trusted+edit toolbar, add reprint count

Reports link moved out of the enable_mass_print gate into the main
trusted+edit-mode toolbar, to the right of Templates — visible whenever
staff are in edit mode regardless of mass-print config.

Reports page header now shows reprint count in parentheses when > 0,
e.g. "142 badges · 98 printed (7 reprints)".

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Scott Idem
2026-06-08 19:38:25 -04:00
parent 8a41f02f0d
commit 5cad150b0a
2 changed files with 10 additions and 6 deletions

View File

@@ -492,6 +492,12 @@ async function handle_search_refresh(params: any) {
Templates
</a>
{/if}
<a
href={`/events/${$events_slct?.event_id}/badges/reports`}
class="btn btn-sm preset-tonal-surface border-surface-300-700 border">
<TrendingUp size="1em" />
Reports
</a>
{#if badges_loc.current.enable_add_badge_btn ?? true}
<button
@@ -545,11 +551,6 @@ async function handle_search_refresh(params: any) {
class="btn btn-tertiary">
<ChartColumnBig size="1em" /> Badge Printing Stats
</a>
<a
href={`/events/${$events_slct?.event_id}/badges/reports`}
class="btn btn-tertiary">
<TrendingUp size="1em" /> Badge Reports
</a>
</div>
{/if}
{/if}

View File

@@ -40,6 +40,9 @@ let lq__badge_li = $derived(
let is_trusted = $derived($ae_loc?.trusted_access === true);
let badge_count = $derived($lq__badge_li?.length ?? 0);
let printed_count = $derived($lq__badge_li?.filter((b) => (b.print_count ?? 0) >= 1).length ?? 0);
let reprint_count = $derived(
$lq__badge_li?.reduce((sum, b) => sum + Math.max(0, (b.print_count ?? 0) - 1), 0) ?? 0
);
</script>
<svelte:head>
@@ -72,7 +75,7 @@ let printed_count = $derived($lq__badge_li?.filter((b) => (b.print_count ?? 0) >
</div>
</div>
<div class="text-sm text-gray-500">
{badge_count} badges · {printed_count} printed
{badge_count} badges · {printed_count} printed{reprint_count > 0 ? ` (${reprint_count} reprint${reprint_count !== 1 ? 's' : ''})` : ''}
</div>
</header>