Badges: persist template controls_cfg; fix onchange syntax in template form
This commit is contained in:
@@ -121,18 +121,27 @@ interface ControlsCfg {
|
||||
shown?: string[];
|
||||
auth_editable?: string[];
|
||||
}
|
||||
let template_controls_cfg = $derived(
|
||||
(() => {
|
||||
try {
|
||||
const parsed = JSON.parse(
|
||||
$lq__event_badge_template_obj?.other_json ?? '{}'
|
||||
);
|
||||
return (parsed?.controls_cfg ?? null) as ControlsCfg | null;
|
||||
} catch {
|
||||
return null;
|
||||
let template_controls_cfg = $derived.by((): ControlsCfg | null => {
|
||||
try {
|
||||
const raw = $lq__event_badge_template_obj?.cfg_json ?? null;
|
||||
if (raw) {
|
||||
const parsed = typeof raw === 'string' ? JSON.parse(raw) : raw;
|
||||
if (parsed?.controls_cfg) return parsed.controls_cfg as ControlsCfg;
|
||||
}
|
||||
})()
|
||||
);
|
||||
} catch {
|
||||
// fall through to other_json fallback
|
||||
}
|
||||
try {
|
||||
const raw2 = $lq__event_badge_template_obj?.other_json ?? null;
|
||||
if (raw2) {
|
||||
const parsed2 = typeof raw2 === 'string' ? JSON.parse(raw2) : raw2;
|
||||
return (parsed2?.controls_cfg ?? null) as ControlsCfg | null;
|
||||
}
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
// Default auth-editable fields when the template has no explicit config.
|
||||
// Covers the fields an attendee most commonly needs to fix at the badge table.
|
||||
|
||||
Reference in New Issue
Block a user