Fix attendees on a booking with seats and payments, navigate to the payment page. (#5788)
* Payment booking logic to seats * Pass email to success page from payment page * Fix type error Co-authored-by: Alan <[email protected]>
This commit is contained in:
1 parent
78aa4aecef
commit
19d00e691c
3 files changed
+31
-18
No files matched your search
@@ -881,22 +881,25 @@ const handleSeatsEventTypeOnBooking = (
|
||||
seatsShowAttendees: boolean | null;
|
||||
[x: string | number | symbol]: unknown;
|
||||
},
|
||||
booking: Partial<
|
||||
bookingInfo: Partial<
|
||||
Prisma.BookingGetPayload<{ include: { attendees: { select: { name: true; email: true } } } }>
|
||||
>,
|
||||
email: string
|
||||
) => {
|
||||
if (eventType?.seatsPerTimeSlot !== null) {
|
||||
// @TODO: right now bookings with seats doesn't save every description that its entered by every user
|
||||
delete booking.description;
|
||||
delete bookingInfo.description;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
if (!eventType.seatsShowAttendees) {
|
||||
const attendee = booking?.attendees?.find((a) => a.email === email);
|
||||
booking["attendees"] = attendee ? [attendee] : [];
|
||||
const attendee = bookingInfo?.attendees?.find((a) => {
|
||||
return a.email === email;
|
||||
});
|
||||
|
||||
bookingInfo["attendees"] = attendee ? [attendee] : [];
|
||||
}
|
||||
return;
|
||||
return bookingInfo;
|
||||
};
|
||||
|
||||
export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
@@ -1007,7 +1010,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
slug: eventType.team?.slug || eventType.users[0]?.username || null,
|
||||
};
|
||||
|
||||
if (bookingInfo !== null && email) {
|
||||
if (bookingInfo !== null && email && eventType.seatsPerTimeSlot) {
|
||||
handleSeatsEventTypeOnBooking(eventType, bookingInfo, email);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user