feat: add multiroom tracking to booking flow
This commit is contained in:
@@ -211,12 +211,20 @@ export function calcTotalPrice(
|
||||
? parseInt(room.breakfast.localPrice?.price ?? 0)
|
||||
: 0
|
||||
|
||||
const roomFeaturesTotal = room.roomFeatures?.reduce((total, pkg) => {
|
||||
if (pkg.requestedPrice.totalPrice) {
|
||||
total = add(total, pkg.requestedPrice.totalPrice)
|
||||
}
|
||||
return total
|
||||
}, 0)
|
||||
const roomFeaturesTotal = room.roomFeatures?.reduce(
|
||||
(total, pkg) => {
|
||||
if (pkg.requestedPrice.totalPrice) {
|
||||
total.requestedPrice = add(
|
||||
total.requestedPrice,
|
||||
pkg.requestedPrice.totalPrice
|
||||
)
|
||||
}
|
||||
total.local = add(total.local, pkg.localPrice.totalPrice)
|
||||
|
||||
return total
|
||||
},
|
||||
{ local: 0, requestedPrice: 0 }
|
||||
)
|
||||
|
||||
const result: Price = {
|
||||
requested: roomPrice.perStay.requested
|
||||
@@ -235,13 +243,13 @@ export function calcTotalPrice(
|
||||
acc.local.price,
|
||||
roomPrice.perStay.local.price,
|
||||
breakfastLocalPrice * room.adults * nights,
|
||||
roomFeaturesTotal
|
||||
roomFeaturesTotal?.local ?? 0
|
||||
),
|
||||
regularPrice: add(
|
||||
acc.local.regularPrice,
|
||||
roomPrice.perStay.local.regularPrice,
|
||||
breakfastLocalPrice * room.adults * nights,
|
||||
roomFeaturesTotal
|
||||
roomFeaturesTotal?.requestedPrice ?? 0
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user