fix: display modify dates for already guaranteed changeable rates
This commit is contained in:
committed by
Michael Zetterberg
parent
b8a976db22
commit
2abd4c5c12
@@ -1,17 +1,11 @@
|
||||
import type { PriceType } from "@/types/components/hotelReservation/myStay/myStay"
|
||||
import type { BookingConfirmation } from "@/types/trpc/routers/booking/confirmation"
|
||||
|
||||
type PriceTypeParams = Pick<
|
||||
BookingConfirmation["booking"],
|
||||
"rateDefinition" | "vouchers" | "cheques"
|
||||
>
|
||||
|
||||
export function getPriceType({
|
||||
rateDefinition,
|
||||
vouchers,
|
||||
cheques,
|
||||
}: PriceTypeParams): PriceType {
|
||||
if (rateDefinition.title === "Reward Night") return "points"
|
||||
export function getPriceType(
|
||||
cheques: number,
|
||||
points: number,
|
||||
vouchers: number
|
||||
): PriceType {
|
||||
if (points > 0) return "points"
|
||||
if (vouchers > 0) return "voucher"
|
||||
if (cheques > 0) return "cheque"
|
||||
return "money"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BookingStatusEnum, CancellationRuleEnum } from "@/constants/booking"
|
||||
import { BookingStatusEnum } from "@/constants/booking"
|
||||
import { dt } from "@/lib/dt"
|
||||
|
||||
import { formatChildBedPreferences } from "../utils"
|
||||
@@ -81,16 +81,11 @@ export function mapRoomDetails({
|
||||
booking.childBedPreferences
|
||||
)
|
||||
|
||||
const isPrePaid =
|
||||
!!booking.guaranteeInfo?.paymentMethodDescription ||
|
||||
booking.rateDefinition.cancellationRule !==
|
||||
CancellationRuleEnum.CancellableBefore6PM
|
||||
|
||||
const priceType = getPriceType({
|
||||
rateDefinition: booking.rateDefinition,
|
||||
vouchers: booking.vouchers,
|
||||
cheques: booking.cheques,
|
||||
})
|
||||
const priceType = getPriceType(
|
||||
booking.cheques,
|
||||
booking.roomPoints,
|
||||
booking.vouchers
|
||||
)
|
||||
|
||||
return {
|
||||
hotelId: booking.hotelId,
|
||||
@@ -159,7 +154,6 @@ export function mapRoomDetails({
|
||||
},
|
||||
},
|
||||
breakfast,
|
||||
isPrePaid,
|
||||
priceType,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user