feat(SW-717) Multiple requests if adult differ between rooms

This commit is contained in:
Pontus Dreij
2025-01-24 09:31:28 +01:00
parent c0f5c0278b
commit d5bc2b3c57
9 changed files with 93 additions and 48 deletions

View File

@@ -61,7 +61,7 @@ export default async function SelectRatePage({
searchTerm: selectHotelParams.city ?? hotel?.name,
arrivalDate: format(arrivalDate, "yyyy-MM-dd"),
departureDate: format(departureDate, "yyyy-MM-dd"),
noOfAdults: adultsInRoom,
noOfAdults: adultsInRoom[0], // TODO: Handle multiple rooms
noOfChildren: childrenInRoom?.length,
ageOfChildren: childrenInRoom?.map((c) => c.age).join(","),
childBedPreference: childrenInRoom
@@ -86,7 +86,7 @@ export default async function SelectRatePage({
lang={params.lang}
fromDate={fromDate.toDate()}
toDate={toDate.toDate()}
adultCount={adultsInRoom}
adultArray={adultsInRoom}
childArray={childrenInRoom}
/>
@@ -99,7 +99,7 @@ export default async function SelectRatePage({
lang={params.lang}
fromDate={fromDate.toDate()}
toDate={toDate.toDate()}
adultCount={adultsInRoom}
adultArray={adultsInRoom}
childArray={childrenInRoom}
/>
</Suspense>

View File

@@ -23,7 +23,7 @@ interface HotelSearchDetails<T> {
city: Location | null
hotel: HotelLocation | null
selectHotelParams: SelectHotelParams<T> & { city: string | undefined }
adultsInRoom: number
adultsInRoom: number[]
childrenInRoomString?: string
childrenInRoom?: Child[]
}
@@ -79,7 +79,7 @@ export async function getHotelSearchDetails<
if (!city && !hotel) return notFound()
if (isAlternativeHotels && (!city || !hotel)) return notFound()
let adultsInRoom = 1
let adultsInRoom: number[] = []
let childrenInRoomString: HotelSearchDetails<T>["childrenInRoomString"] =
undefined
let childrenInRoom: HotelSearchDetails<T>["childrenInRoom"] = undefined
@@ -87,7 +87,7 @@ export async function getHotelSearchDetails<
const { rooms } = selectHotelParams
if (rooms && rooms.length > 0) {
adultsInRoom = rooms[0].adults // TODO: Handle multiple rooms
adultsInRoom = rooms.map((room) => room.adults?.[0] ?? 0)
childrenInRoomString = rooms[0].childrenInRoom
? generateChildrenString(rooms[0].childrenInRoom)
: undefined // TODO: Handle multiple rooms