feat(SW-1717): rewrite select-rate to show all variants of rate-cards
This commit is contained in:
committed by
Michael Zetterberg
parent
adde77eaa9
commit
ebaea78fb3
@@ -51,9 +51,9 @@ export default function EnterDetailsProvider({
|
||||
bedType:
|
||||
room.bedTypes?.length === 1
|
||||
? {
|
||||
roomTypeCode: room.bedTypes[0].value,
|
||||
description: room.bedTypes[0].description,
|
||||
}
|
||||
roomTypeCode: room.bedTypes[0].value,
|
||||
description: room.bedTypes[0].description,
|
||||
}
|
||||
: undefined,
|
||||
mustBeGuaranteed: room.mustBeGuaranteed,
|
||||
isFlexRate: room.isFlexRate,
|
||||
@@ -161,9 +161,23 @@ export default function EnterDetailsProvider({
|
||||
)
|
||||
|
||||
const nights = dt(booking.toDate).diff(booking.fromDate, "days")
|
||||
const currency = (filteredOutMissingRooms[0].room.roomRate.publicRate
|
||||
?.localPrice.currency ||
|
||||
filteredOutMissingRooms[0].room.roomRate.memberRate?.localPrice.currency)!
|
||||
|
||||
// We only extract the first room for its currency,
|
||||
// the value is the same for the rest of the rooms
|
||||
const product = filteredOutMissingRooms[0].room.roomRate
|
||||
let currency = CurrencyEnum.Unknown
|
||||
if ("corporateCheque" in product) {
|
||||
currency = CurrencyEnum.CC
|
||||
} else if ("redemption" in product) {
|
||||
currency = CurrencyEnum.POINTS
|
||||
} else if ("voucher" in product) {
|
||||
currency = CurrencyEnum.Voucher
|
||||
} else if ("public" in product && product.public) {
|
||||
currency = product.public.localPrice.currency
|
||||
} else if ("member" in product && product.member) {
|
||||
currency = product.member.localPrice.currency
|
||||
}
|
||||
|
||||
const totalPrice = calcTotalPrice(
|
||||
filteredOutMissingRooms,
|
||||
currency,
|
||||
|
||||
Reference in New Issue
Block a user