fix: unite all price details modals to one and align on ui
This commit is contained in:
committed by
Michael Zetterberg
parent
8152aea649
commit
1f94c581ae
@@ -11,6 +11,7 @@ import {
|
||||
type RoomPackageCodes,
|
||||
} from "@/types/components/hotelReservation/selectRate/roomFilter"
|
||||
import type { Child } from "@/types/components/hotelReservation/selectRate/selectRate"
|
||||
import type { Packages } from "@/types/requests/packages"
|
||||
|
||||
interface IconForFeatureCodeProps {
|
||||
featureCode: RoomPackageCodes
|
||||
@@ -53,3 +54,41 @@ export function generateChildrenString(children: Child[]): string {
|
||||
})
|
||||
.join(",")}]`
|
||||
}
|
||||
|
||||
export function sumPackages(packages: Packages | null) {
|
||||
if (!packages || !packages.length) {
|
||||
return {
|
||||
currency: undefined,
|
||||
price: 0,
|
||||
}
|
||||
}
|
||||
return packages.reduce(
|
||||
(total, pkg) => {
|
||||
total.price = total.price + pkg.localPrice.totalPrice
|
||||
return total
|
||||
},
|
||||
{
|
||||
currency: packages[0].localPrice.currency,
|
||||
price: 0,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
export function sumPackagesRequestedPrice(packages: Packages | null) {
|
||||
if (!packages || !packages.length) {
|
||||
return {
|
||||
currency: undefined,
|
||||
price: 0,
|
||||
}
|
||||
}
|
||||
return packages.reduce(
|
||||
(total, pkg) => {
|
||||
total.price = total.price + pkg.requestedPrice.totalPrice
|
||||
return total
|
||||
},
|
||||
{
|
||||
currency: packages[0].requestedPrice.currency,
|
||||
price: 0,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user