Now with the ability to actually create a badge. We still need to make this look nicer. Buttons should look more like button and consistent with the other areas of AE Events Badges. Also take a look at the trigger updated fields.

This commit is contained in:
Scott Idem
2026-03-27 11:51:42 -04:00
parent bc67ff5798
commit 9d44b9341c
2 changed files with 8 additions and 8 deletions

View File

@@ -259,7 +259,7 @@ export async function create_ae_obj__event_badge({
const result = await api.create_nested_obj({
api_cfg,
parent_type: 'event',
parent_type: 'event_person',
parent_id: event_id,
child_type: 'event_badge',
fields: data_kv,

View File

@@ -83,9 +83,9 @@ async function handle_submit(event: Event) {
error_msg = '';
// Step 1: Create event_person — the identity record for this attendee.
// The V3 create endpoint returns { obj_id, obj_id_random } — both are the id_random
// of the new record. We pass event_person_id_random to the badge so the backend resolves the FK.
let new_person: { obj_id?: string; obj_id_random?: string } | null = null;
// The V3 create endpoint returns { event_person_id }.
// We pass event_person_id to the badge so the backend resolves the FK.
let new_person: { event_person_id?: string; obj_id?: string; } | null = null;
try {
const person_data: key_val = { given_name, family_name, email };
new_person = await events_func.create_ae_obj__event_person({
@@ -100,7 +100,7 @@ async function handle_submit(event: Event) {
return;
}
const event_person_id = new_person?.obj_id || new_person?.obj_id_random;
const event_person_id = new_person?.event_person_id || new_person?.obj_id;
if (!event_person_id) {
submit_status = 'error';
error_msg = 'Attendee record created but returned no ID.';
@@ -129,12 +129,12 @@ async function handle_submit(event: Event) {
};
const new_badge = await api.create_nested_obj({
api_cfg: $ae_api,
parent_type: 'event',
parent_id: event_id,
parent_type: 'event_person',
parent_id: event_person_id,
child_type: 'event_badge',
fields: badge_data
});
if (new_badge?.obj_id) {
if (new_badge?.event_badge_id) {
submit_status = 'success';
if (onsuccess) onsuccess(new_badge);
} else {