feat(SW-1717): rewrite select-rate to show all variants of rate-cards

This commit is contained in:
Simon Emanuelsson
2025-03-25 11:25:44 +01:00
committed by Michael Zetterberg
parent adde77eaa9
commit ebaea78fb3
118 changed files with 4601 additions and 4374 deletions

View File

@@ -106,11 +106,25 @@ export default function useModifyStay({
return { success: false, noAvailability: true }
}
const roomPrice = isLoggedIn
? data.memberRate?.localPrice.pricePerStay
: data.publicRate?.localPrice.pricePerStay
let roomPrice = 0
if (isLoggedIn && "member" in data.product && data.product.member) {
roomPrice = data.product.member.localPrice.pricePerStay
} else if ("public" in data.product && data.product.public) {
roomPrice = data.product.public.localPrice.pricePerStay
} else if (
"corporateCheque" in data.product &&
data.product.corporateCheque.localPrice.additionalPricePerStay
) {
roomPrice =
data.product.corporateCheque.localPrice.additionalPricePerStay
} else if (
"redemption" in data.product &&
data.product.redemption.localPrice.additionalPricePerStay
) {
roomPrice = data.product.redemption.localPrice.additionalPricePerStay
}
totalNewPrice += roomPrice ?? 0
totalNewPrice += roomPrice
availabilityResults.push(data)
} catch (error) {
console.error("Error checking room availability:", error)