feat(badges): hide toggle, print count editor, show hidden filter
- Hide/Unhide toggle button (Trusted + Edit Mode) on each badge row in the list; badge disappears immediately when hidden unless Show Hidden is active - Print count inline editor in debug row (Admin + Edit Mode); updates count only, no timestamp changes - "Show Hidden" checkbox in search filters (Trusted + Edit Mode); wires through IDB fast-path, API hidden param, and visible_badge_obj_li filter - show_hidden requires edit_mode to be active — reverts to hiding hidden badges when edit mode is off Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -168,6 +168,7 @@ let search_params = $derived({
|
||||
printed: badges_loc.current.qry_printed_status,
|
||||
aff: (badges_loc.current.qry_affiliations ?? '').toLowerCase().trim(),
|
||||
sort: badges_loc.current.qry_sort_order,
|
||||
show_hidden: badges_loc.current.show_hidden,
|
||||
event_id: $events_slct?.event_id,
|
||||
remote_first: badges_loc.current.qry__remote_first,
|
||||
result_limit: effective_search_limits.result_limit,
|
||||
@@ -217,11 +218,13 @@ async function handle_search_refresh(params: any) {
|
||||
const result_limit = params.result_limit;
|
||||
const min_chars = params.min_chars;
|
||||
|
||||
const show_hidden = params.show_hidden;
|
||||
|
||||
// Defense-in-depth: enforce min_chars even if the search component lets one through.
|
||||
// Exception: if the user has set a non-default filter or sort, that is explicit intent —
|
||||
// run the search even without a text query.
|
||||
const has_active_filters =
|
||||
printed_status !== 'all' || !!type_code || !!aff_str || !!params.sort;
|
||||
printed_status !== 'all' || !!type_code || !!aff_str || !!params.sort || show_hidden;
|
||||
if (qry_str.length < min_chars && !has_active_filters) {
|
||||
untrack(() => {
|
||||
event_badge_id_li = [];
|
||||
@@ -239,6 +242,9 @@ async function handle_search_refresh(params: any) {
|
||||
.where('event_id')
|
||||
.equals(event_id)
|
||||
.filter((badge) => {
|
||||
// Exclude hidden badges unless show_hidden is active
|
||||
if (!show_hidden && badge.hide) return false;
|
||||
|
||||
if (type_code && badge.badge_type_code !== type_code)
|
||||
return false;
|
||||
|
||||
@@ -416,6 +422,7 @@ async function handle_search_refresh(params: any) {
|
||||
type_code: type_code || null,
|
||||
printed_status: printed_status,
|
||||
affiliations_qry_str: aff_str || null,
|
||||
hidden: show_hidden ? 'all' : 'not_hidden',
|
||||
order_by_li: order_by_li,
|
||||
limit: result_limit,
|
||||
log_lvl: 0
|
||||
|
||||
Reference in New Issue
Block a user