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 <noreply@anthropic.com>
This commit is contained in:
@@ -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;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user