Merged in feat/SW-1589-implement-booking-code-enter (pull request #1368)

Feat/SW-1589 implement booking code enter

* feat: SW-1589 Booking code rate implementation

* feat: SW-1589 Optimized price display

* feat: SW-1589 Display standard price

* feat: SW-1589 Fixed rate title issue


Approved-by: Niclas Edenvin
This commit is contained in:
Hrishikesh Vaipurkar
2025-03-05 09:32:32 +00:00
parent 43d3713f59
commit 39b6774269
17 changed files with 139 additions and 11 deletions

View File

@@ -114,6 +114,7 @@ export function getRoomPrice(roomRate: RoomRate, isMember: boolean) {
local: {
currency: roomRate.publicRate.localPrice.currency,
price: roomRate.publicRate.localPrice.pricePerNight,
regularPrice: roomRate.publicRate.localPrice.regularPricePerNight,
},
},
perStay: {
@@ -124,6 +125,7 @@ export function getRoomPrice(roomRate: RoomRate, isMember: boolean) {
local: {
currency: roomRate.publicRate.localPrice.currency,
price: roomRate.publicRate.localPrice.pricePerStay,
regularPrice: roomRate.publicRate.localPrice.regularPricePerStay,
},
},
}
@@ -136,7 +138,7 @@ export function getRoomPrice(roomRate: RoomRate, isMember: boolean) {
type TotalPrice = {
requested: { currency: string; price: number } | undefined
local: { currency: string; price: number }
local: { currency: string; price: number; regularPrice?: number }
}
export function getTotalPrice(roomRates: RoomRate[], isMember: boolean) {
@@ -165,6 +167,9 @@ export function getTotalPrice(roomRates: RoomRate[], isMember: boolean) {
local: {
currency: rate.localPrice.currency,
price: add(total.local.price ?? 0, rate.localPrice.pricePerStay),
regularPrice: rate.localPrice.regularPricePerStay
? add(total.local.regularPrice, rate.localPrice.regularPricePerStay)
: total.local.regularPrice,
},
}
},
@@ -232,6 +237,12 @@ export function calcTotalPrice(
breakfastLocalPrice * room.adults * nights,
roomFeaturesTotal
),
regularPrice: add(
acc.local.regularPrice,
roomPrice.perStay.local.regularPrice,
breakfastLocalPrice * room.adults * nights,
roomFeaturesTotal
),
},
}

View File

@@ -258,6 +258,7 @@ export function createDetailsStore(
}
const stateTotalLocalPrice = state.totalPrice.local.price
const stateTotalLocalRegularPrice = state.totalPrice.local.regularPrice
const addToTotalPrice =
(currentRoom.room.breakfast === undefined ||
@@ -290,7 +291,10 @@ export function createDetailsStore(
local: {
currency: breakfast.localPrice.currency,
price: stateTotalLocalPrice + breakfastTotalPrice,
},
regularPrice: stateTotalLocalRegularPrice
? stateTotalLocalRegularPrice + breakfastTotalPrice
: undefined,
},
}
}
@@ -322,6 +326,9 @@ export function createDetailsStore(
if (localPrice < 0) {
localPrice = 0
}
let regularPrice = stateTotalLocalRegularPrice
? stateTotalLocalRegularPrice - currentBreakfastTotalPrice
: undefined
state.totalPrice = {
requested: state.totalPrice.requested && {
@@ -331,6 +338,7 @@ export function createDetailsStore(
local: {
currency,
price: localPrice,
regularPrice,
},
}
}