feat: Convert Selected-Room to Steplike design and fix select-rate link
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { getFormattedUrlQueryParams } from "@/utils/url"
|
||||
|
||||
import { BedTypeEnum } from "@/types/components/bookingWidget/enums"
|
||||
import { BookingData } from "@/types/components/hotelReservation/enterDetails/bookingData"
|
||||
import type {
|
||||
Child,
|
||||
SelectRateSearchParams,
|
||||
@@ -52,3 +53,26 @@ export function getQueryParamsForEnterDetails(searchParams: URLSearchParams) {
|
||||
rateCode: room[0].ratecode,
|
||||
}
|
||||
}
|
||||
|
||||
export function createSelectRateUrl(roomData: BookingData) {
|
||||
const { hotel, fromDate, toDate } = roomData
|
||||
const params = new URLSearchParams({ fromDate, toDate, hotel })
|
||||
|
||||
roomData.room.forEach((room, index) => {
|
||||
params.set(`room[${index}].adults`, room.adults.toString())
|
||||
|
||||
if (room.child) {
|
||||
room.child.forEach((child, childIndex) => {
|
||||
params.set(
|
||||
`room[${index}].child[${childIndex}].age`,
|
||||
child.age.toString()
|
||||
)
|
||||
params.set(
|
||||
`room[${index}].child[${childIndex}].bed`,
|
||||
child.bed.toString()
|
||||
)
|
||||
})
|
||||
}
|
||||
})
|
||||
return params
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user