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