From 8d430a9c31e30e16584bc5d9b22e6957e6b5b74f Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Mon, 13 Apr 2026 19:24:24 -0400 Subject: [PATCH] fix(badges): drive printed badge visibility from status filter not edit_mode Previously edit_mode was a blunt override: trusted+edit showed all badges regardless of the filter setting. This meant the Printed Status dropdown had no effect on what was visible in the list. Now trusted+edit mode respects qry_printed_status as the single source of truth: 'all' shows everything, 'printed' shows only printed, and 'not_printed' shows only unprinted. The filter dropdown is only accessible to trusted+edit users so it is safe to use as the control. Kiosk/attendee behavior (trusted no edit, public, anonymous) unchanged: only unprinted badges are shown regardless of filter state. Co-Authored-By: Claude Sonnet 4.6 --- .../(badges)/badges/ae_comp__badge_obj_li.svelte | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/routes/events/[event_id]/(badges)/badges/ae_comp__badge_obj_li.svelte b/src/routes/events/[event_id]/(badges)/badges/ae_comp__badge_obj_li.svelte index 8aa939dd..5b185f96 100644 --- a/src/routes/events/[event_id]/(badges)/badges/ae_comp__badge_obj_li.svelte +++ b/src/routes/events/[event_id]/(badges)/badges/ae_comp__badge_obj_li.svelte @@ -21,6 +21,7 @@ let { import { ae_loc } from '$lib/stores/ae_stores'; import { events_loc } from '$lib/stores/ae_events_stores'; +import { badges_loc } from '$lib/stores/ae_events_stores__badges.svelte'; import { ae_util } from '$lib/ae_utils/ae_utils'; import { Check, @@ -98,11 +99,17 @@ let visible_badge_obj_li = $derived( const filtered = list.filter((item: any) => { if (!item) return false; if (is_trusted && is_edit_mode) { - // Edit Mode: show all non-hidden, including already-printed - return !item.hide; + // Trusted + edit mode: the Printed Status filter dropdown controls visibility. + // This is the only context where the filter is accessible, so it is the + // authoritative control — no separate edit_mode override needed. + const ps = badges_loc.current.qry_printed_status; + if (ps === 'printed') return (item.print_count ?? 0) >= 1 && !item.hide; + if (ps === 'not_printed') return (item.print_count ?? 0) < 1 && !item.hide; + return !item.hide; // 'all' — show everything non-hidden } - // Everyone else (non-trusted or trusted not in edit mode): - // Only show badges that have not been printed yet + // Kiosk / attendee / below-trusted: only unprinted badges. + // The filter dropdown is not visible at these access levels, so + // qry_printed_status is not a reliable signal here. return (item.print_count ?? 0) < 1 && !item.hide; });