Fixed same string value for childBedPreference on confirmation page
This commit is contained in:
@@ -74,7 +74,6 @@ export default async function SelectRatePage({
|
||||
country: hotelData?.data?.attributes.address.country,
|
||||
hotelID: hotel?.id,
|
||||
region: hotelData?.data?.attributes.address.city,
|
||||
//availableResults: roomCategories?.length,
|
||||
//lowestRoomPrice:
|
||||
}
|
||||
|
||||
|
||||
@@ -183,7 +183,6 @@ export default async function StepPage({
|
||||
country: hotelAttributes?.address.country,
|
||||
hotelID: hotelAttributes?.operaId,
|
||||
region: hotelAttributes?.address.city,
|
||||
//lowestRoomPrice:
|
||||
}
|
||||
|
||||
const summary = {
|
||||
|
||||
@@ -6,6 +6,7 @@ import { getBookingConfirmation } from "@/lib/trpc/memoizedRequests"
|
||||
import TrackingSDK from "@/components/TrackingSDK"
|
||||
import { getLang } from "@/i18n/serverContext"
|
||||
|
||||
import { invertedBedTypeMap } from "../SelectRate/RoomSelection/utils"
|
||||
import Confirmation from "./Confirmation"
|
||||
|
||||
import type { BookingConfirmationProps } from "@/types/components/hotelReservation/bookingConfirmation/bookingConfirmation"
|
||||
@@ -43,7 +44,9 @@ export default async function BookingConfirmation({
|
||||
noOfAdults: booking.adults,
|
||||
noOfChildren: booking.childrenAges?.length,
|
||||
ageOfChildren: booking.childrenAges?.join(","),
|
||||
childBedPreference: booking?.extraBedTypes?.map((c) => c.bedType).join("|"),
|
||||
childBedPreference: booking?.extraBedTypes
|
||||
?.flatMap((c) => Array(c.quantity).fill(invertedBedTypeMap[c.bedType]))
|
||||
.join("|"),
|
||||
noOfRooms: 1, // // TODO: Handle multiple rooms
|
||||
duration: differenceInCalendarDays(departureDate, arrivalDate),
|
||||
leadTime: differenceInCalendarDays(arrivalDate, new Date()),
|
||||
|
||||
@@ -22,6 +22,14 @@ export const bedTypeMap: Record<number, ChildBedTypeEnum> = {
|
||||
[ChildBedMapEnum.IN_ADULTS_BED]: ChildBedTypeEnum.ParentsBed,
|
||||
[ChildBedMapEnum.IN_CRIB]: ChildBedTypeEnum.Crib,
|
||||
[ChildBedMapEnum.IN_EXTRA_BED]: ChildBedTypeEnum.ExtraBed,
|
||||
[ChildBedMapEnum.UNKNOWN]: ChildBedTypeEnum.Unknown,
|
||||
}
|
||||
|
||||
export const invertedBedTypeMap: Record<ChildBedTypeEnum, string> = {
|
||||
[ChildBedTypeEnum.ParentsBed]: ChildBedMapEnum[ChildBedMapEnum.IN_ADULTS_BED],
|
||||
[ChildBedTypeEnum.Crib]: ChildBedMapEnum[ChildBedMapEnum.IN_CRIB],
|
||||
[ChildBedTypeEnum.ExtraBed]: ChildBedMapEnum[ChildBedMapEnum.IN_EXTRA_BED],
|
||||
[ChildBedTypeEnum.Unknown]: ChildBedMapEnum[ChildBedMapEnum.UNKNOWN],
|
||||
}
|
||||
|
||||
export function generateChildrenString(children: Child[]): string {
|
||||
|
||||
@@ -2,4 +2,5 @@ export enum ChildBedMapEnum {
|
||||
IN_ADULTS_BED = 0,
|
||||
IN_CRIB = 1,
|
||||
IN_EXTRA_BED = 2,
|
||||
UNKNOWN = 3,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user