diff --git a/src/routes/events/[event_id]/(badges)/badges/ae_comp__badge_search.svelte b/src/routes/events/[event_id]/(badges)/badges/ae_comp__badge_search.svelte index f5477198..44f1b15c 100644 --- a/src/routes/events/[event_id]/(badges)/badges/ae_comp__badge_search.svelte +++ b/src/routes/events/[event_id]/(badges)/badges/ae_comp__badge_search.svelte @@ -15,7 +15,8 @@ import { QrCode, RemoveFormatting, Search, - StepForward + StepForward, + TriangleAlert } from '@lucide/svelte'; import { fade, slide } from 'svelte/transition'; import { ae_loc, ae_api } from '$lib/stores/ae_stores'; @@ -77,6 +78,28 @@ function handle_search_trigger() { badges_loc.current.search_version++; } +let show_remote_first_confirm = $state(false); + +function handle_remote_first_click(e: MouseEvent) { + // Always manage state manually so the checkbox never flickers mid-handler. + e.preventDefault(); + const checkbox = e.currentTarget as HTMLInputElement; + if (checkbox.checked) { + // User wants to enable — show confirmation first. + show_remote_first_confirm = true; + } else { + badges_loc.current.qry__remote_first = false; + show_remote_first_confirm = false; + handle_search_trigger(); + } +} + +function confirm_remote_first() { + badges_loc.current.qry__remote_first = true; + show_remote_first_confirm = false; + handle_search_trigger(); +} + function prevent_default(fn: (event: T) => void) { return function (event: T) { event.preventDefault(); @@ -346,17 +369,49 @@ function handle_qr_scan_result(event: { {#if $ae_loc.trusted_access} {/if} {/if} + + {#if show_remote_first_confirm} +
+
+ +

+ Remote First skips the local cache and queries the server on every keystroke. + Results will always reflect the latest data but searches may be slower. + Use this only if recent changes aren't showing up in search results. +

+
+
+ + +
+
+ {/if} {:else if $events_sess.badges.show_form__scan}