Skip to content

Commit

Permalink
attendee data is sent
Browse files Browse the repository at this point in the history
  • Loading branch information
rafsuntaskin committed Jul 15, 2024
1 parent 13c3c71 commit 8d0656f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Tickets/Seating/Admin/Ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public function fetch_attendees_by_event(): void {
foreach ( $data['attendees'] as $attendee ) {
$id = (int) $attendee['attendee_id'];

$formatted[ $id ] = [
$formatted[] = [
'id' => $id,
'name' => $attendee['holder_name'],
'purchaser' => [
Expand Down
13 changes: 6 additions & 7 deletions src/Tickets/Seating/app/admin/seats-report/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
import {ajaxUrl, ajaxNonce} from "@tec/tickets/seating/service";

const { seatTypeMap, postId } = window?.tec?.tickets?.seating?.seatsReport?.data;
let seatTypeMapSent = false;

async function fetchAttendees() {
const url = new URL(ajaxUrl);
Expand Down Expand Up @@ -52,12 +51,12 @@ async function fetchAttendees() {
function registerActions(iframe) {
// When the service is ready for data, send the seat type map to the iframe.
registerAction(INBOUND_APP_READY_FOR_DATA, async () => {
if ( ! seatTypeMapSent ) {
sendPostMessage(iframe, OUTBOUND_SEAT_TYPE_TICKETS, seatTypeMap);
seatTypeMapSent = true;
}
const data = await fetchAttendees();
sendPostMessage(iframe, OUTBOUND_EVENT_ATTENDEES, data?.attendees || []);
removeAction(INBOUND_APP_READY_FOR_DATA);

sendPostMessage(iframe, OUTBOUND_SEAT_TYPE_TICKETS, seatTypeMap);

const attendeeData = await fetchAttendees();
sendPostMessage(iframe, OUTBOUND_EVENT_ATTENDEES, attendeeData?.attendees );
});
}

Expand Down
2 changes: 2 additions & 0 deletions src/Tickets/Seating/app/service/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
OUTBOUND_HOST_READY,
OUTBOUND_SEAT_TYPE_TICKETS,
OUTBOUND_REMOVE_RESERVATIONS,
OUTBOUND_EVENT_ATTENDEES,
} from './service-actions.js';

/**
Expand Down Expand Up @@ -250,6 +251,7 @@ window.tec.tickets.seating.service.api = {
OUTBOUND_HOST_READY,
OUTBOUND_SEAT_TYPE_TICKETS,
OUTBOUND_REMOVE_RESERVATIONS,
OUTBOUND_EVENT_ATTENDEES,
INBOUND_SEATS_SELECTED,
sendPostMessage,
startListeningForServiceMessages,
Expand Down

0 comments on commit 8d0656f

Please sign in to comment.