feat: move room charge to top in price details modal
This commit is contained in:
committed by
Michael Zetterberg
parent
194a401a56
commit
a99e434d84
@@ -53,13 +53,62 @@ export default function PriceDetails() {
|
||||
total.local.price = total.local.price + room.totalPrice
|
||||
}
|
||||
|
||||
if (
|
||||
(room.cheques || room.roomPoints || room.vouchers) &&
|
||||
room.roomPrice
|
||||
) {
|
||||
// Corporate Cheque
|
||||
if (room.cheques) {
|
||||
if (room.roomPrice) {
|
||||
total.local.additionalPrice =
|
||||
(total.local.additionalPrice || 0) + room.totalPrice
|
||||
total.local.additionalPriceCurrency = currency
|
||||
} else {
|
||||
const pkgsSum = room.packages.reduce(
|
||||
(total, pkg) => total + pkg.totalPrice,
|
||||
0
|
||||
)
|
||||
total.local.additionalPrice =
|
||||
(total.local.additionalPrice || 0) + pkgsSum
|
||||
const pkgsCurrency = room.packages.find(
|
||||
(pkg) => pkg.currency
|
||||
)?.currency
|
||||
if (!total.local.additionalPriceCurrency) {
|
||||
total.local.additionalPriceCurrency = pkgsCurrency ?? currency
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Redemption
|
||||
if (room.roomPoints) {
|
||||
if (room.roomPrice) {
|
||||
total.local.additionalPrice =
|
||||
(total.local.additionalPrice || 0) + room.totalPrice
|
||||
total.local.additionalPriceCurrency = currency
|
||||
} else {
|
||||
const pkgsSum = room.packages.reduce(
|
||||
(total, pkg) => total + pkg.totalPrice,
|
||||
0
|
||||
)
|
||||
total.local.additionalPrice =
|
||||
(total.local.additionalPrice || 0) + pkgsSum
|
||||
const pkgsCurrency = room.packages.find(
|
||||
(pkg) => pkg.currency
|
||||
)?.currency
|
||||
if (!total.local.additionalPriceCurrency) {
|
||||
total.local.additionalPriceCurrency = pkgsCurrency ?? currency
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Voucher
|
||||
if (room.vouchers && room.packages) {
|
||||
const pkgsSum = room.packages.reduce(
|
||||
(total, pkg) => total + pkg.totalPrice,
|
||||
0
|
||||
)
|
||||
total.local.additionalPrice =
|
||||
(total.local.additionalPrice || 0) + room.totalPrice
|
||||
total.local.additionalPriceCurrency = currency
|
||||
(total.local.additionalPrice || 0) + pkgsSum
|
||||
const pkgsCurrency = room.packages.find((pkg) => pkg.currency)?.currency
|
||||
if (!total.local.additionalPriceCurrency) {
|
||||
total.local.additionalPriceCurrency = pkgsCurrency ?? currency
|
||||
}
|
||||
}
|
||||
|
||||
return total
|
||||
|
||||
Reference in New Issue
Block a user