feat: SW-1588 Implemented booking code select-rate
This commit is contained in:
@@ -2,6 +2,7 @@ import { trpc } from "@/lib/trpc/client"
|
||||
|
||||
import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter"
|
||||
import type { Child } from "@/types/components/hotelReservation/selectRate/selectRate"
|
||||
import { RateTypeEnum } from "@/types/enums/rateType"
|
||||
import type { RoomsAvailability } from "@/types/trpc/routers/hotel/roomAvailability"
|
||||
import type { Lang } from "@/constants/languages"
|
||||
|
||||
@@ -38,14 +39,17 @@ export function getRates(
|
||||
) {
|
||||
return {
|
||||
change: rateDefinitions.filter(
|
||||
(rate) => rate.cancellationRule === "Changeable"
|
||||
(rate) => rate.cancellationRule === "Changeable" && rate.rateType === RateTypeEnum.Regular
|
||||
),
|
||||
flex: rateDefinitions.filter(
|
||||
(rate) => rate.cancellationRule === "CancellableBefore6PM"
|
||||
(rate) => rate.cancellationRule === "CancellableBefore6PM" && rate.rateType === RateTypeEnum.Regular
|
||||
),
|
||||
save: rateDefinitions.filter(
|
||||
(rate) => rate.cancellationRule === "NotCancellable"
|
||||
(rate) => rate.cancellationRule === "NotCancellable" && rate.rateType === RateTypeEnum.Regular
|
||||
),
|
||||
special: rateDefinitions.filter(
|
||||
(rate) => rate.rateType !== RateTypeEnum.Regular
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +59,8 @@ export function useRoomsAvailability(
|
||||
fromDateString: string,
|
||||
toDateString: string,
|
||||
lang: Lang,
|
||||
childArray?: Child[]
|
||||
childArray?: Child[],
|
||||
bookingCode?: string,
|
||||
) {
|
||||
const returnValue =
|
||||
trpc.hotel.availability.roomsCombinedAvailability.useQuery({
|
||||
@@ -65,6 +70,7 @@ export function useRoomsAvailability(
|
||||
uniqueAdultsCount,
|
||||
childArray,
|
||||
lang,
|
||||
bookingCode,
|
||||
})
|
||||
|
||||
const combinedAvailability = returnValue.data?.length
|
||||
|
||||
Reference in New Issue
Block a user