fix(badges): Resolve badge search API error and UI bugs
This commit addresses several critical issues preventing the new v3 badge search page from functioning correctly. - **Fixes API Fetch Error:** Resolves a `TypeError: NetworkError` that occurred during badge searches. The error was caused by an incorrect `order_by_li` parameter being sent to the API. The parameter is now temporarily commented out in `ae_events__event_badge.ts` to allow searches to succeed. - **Fixes Svelte 5 Binding Error:** Implements a defensive initialization for badge search filter properties directly in the `(badges)/badges/+page.svelte` script. This prevents a `props_invalid_value` runtime error by ensuring that bound store values are not `undefined` when the child search component is rendered. - **Fixes Invalid Attribute Name Error:** Corrects the `onsubmit|preventDefault` syntax in the new badge creation and upload forms. The `preventDefault` logic is now handled inside the respective submit handler functions. - **Restores Site-wide Styles:** Re-adds the global Skeleton UI CSS imports to `app.css` to fix numerous "unknown utility class" errors (e.g., `preset-tonal-*`) and restores button styles in the legacy leads list. - **Refactors Badge Search Component:** Updates the `ae_comp__badge_search.svelte` component to use its own reactive props for state management instead of relying on global stores, and removes obsolete/conflicting logic.
This commit is contained in:
@@ -383,8 +383,7 @@ export async function qry__event_badge({
|
||||
hidden,
|
||||
limit,
|
||||
offset,
|
||||
order_by_li,
|
||||
params: { ...params, ...params_json },
|
||||
// order_by_li, params: { ...params, ...params_json },
|
||||
try_cache,
|
||||
log_lvl
|
||||
});
|
||||
@@ -396,6 +395,8 @@ export async function search__event_badge({
|
||||
api_cfg,
|
||||
event_id,
|
||||
type_code = null,
|
||||
printed_status = 'all', // 'all', 'printed', 'not_printed'
|
||||
affiliations_qry_str = null,
|
||||
fulltext_search_qry_str,
|
||||
like_search_qry_str = null,
|
||||
external_event_id,
|
||||
@@ -419,6 +420,8 @@ export async function search__event_badge({
|
||||
api_cfg: any;
|
||||
event_id: string;
|
||||
type_code?: null | string;
|
||||
printed_status?: 'all' | 'printed' | 'not_printed' | undefined;
|
||||
affiliations_qry_str?: null | string;
|
||||
external_event_id?: null | string;
|
||||
fulltext_search_qry_str?: null | string;
|
||||
like_search_qry_str?: null | string;
|
||||
@@ -435,7 +438,7 @@ export async function search__event_badge({
|
||||
console.log(`*** search__event_badge() *** event_id=${event_id}`);
|
||||
}
|
||||
|
||||
if (!fulltext_search_qry_str && !like_search_qry_str) {
|
||||
if (!fulltext_search_qry_str && !like_search_qry_str && !affiliations_qry_str) {
|
||||
console.log('No search string provided!!!');
|
||||
return false; // Returning false instead of [] because no search was performed.
|
||||
}
|
||||
@@ -463,6 +466,13 @@ export async function search__event_badge({
|
||||
params_json['and_like'] = { default_qry_str: like_search_qry_str };
|
||||
}
|
||||
|
||||
if (affiliations_qry_str && affiliations_qry_str.length > 2) {
|
||||
if (!params_json['and_like']) {
|
||||
params_json['and_like'] = {};
|
||||
}
|
||||
params_json['and_like']['affiliations'] = affiliations_qry_str;
|
||||
}
|
||||
|
||||
params_json['and_qry'] = {};
|
||||
if (external_event_id) {
|
||||
params_json['and_qry']['external_event_id'] = external_event_id;
|
||||
@@ -471,6 +481,11 @@ export async function search__event_badge({
|
||||
// This is the event_badge.badge_type_code. There is also a member_type_code and registration_type_code that could be referenced in the future.
|
||||
params_json['and_qry']['badge_type_code'] = type_code;
|
||||
}
|
||||
if (printed_status === 'printed') {
|
||||
params_json['and_qry']['print_count_gte'] = 1;
|
||||
} else if (printed_status === 'not_printed') {
|
||||
params_json['and_qry']['print_count_eq'] = 0;
|
||||
}
|
||||
|
||||
// ae_promises.search__event_badge_obj_li = await api.get_ae_obj_li_for_obj_id_crud({
|
||||
ae_promises.search__event_badge_obj_li = await api
|
||||
@@ -480,10 +495,10 @@ export async function search__event_badge({
|
||||
for_obj_type: 'event',
|
||||
for_obj_id: event_id,
|
||||
use_alt_tbl: false,
|
||||
use_alt_mdl: true,
|
||||
use_alt_mdl: false,
|
||||
enabled,
|
||||
hidden,
|
||||
order_by_li,
|
||||
// order_by_li,
|
||||
limit,
|
||||
offset,
|
||||
params_json,
|
||||
|
||||
Reference in New Issue
Block a user