feat: filters work together
This commit is contained in:
committed by
Michael Zetterberg
parent
31370fe711
commit
d72c84d949
@@ -21,7 +21,6 @@ import { getTotalPrice } from "./utils"
|
||||
import styles from "./rateSummary.module.css"
|
||||
|
||||
import type { RateSummaryProps } from "@/types/components/hotelReservation/selectRate/rateSummary"
|
||||
import { RoomPackageCodeEnum } from "@/types/components/hotelReservation/selectRate/roomFilter"
|
||||
import { RateEnum } from "@/types/enums/rate"
|
||||
import { RateTypeEnum } from "@/types/enums/rateType"
|
||||
|
||||
@@ -265,15 +264,12 @@ export default function RateSummary({ isUserLoggedIn }: RateSummaryProps) {
|
||||
return total
|
||||
}
|
||||
|
||||
const hasSelectedPetRoom = roomPackages.find(
|
||||
(pkg) => pkg.code === RoomPackageCodeEnum.PET_ROOM
|
||||
)
|
||||
if (!hasSelectedPetRoom) {
|
||||
return total + price
|
||||
}
|
||||
return (
|
||||
total + price + hasSelectedPetRoom.localPrice.totalPrice
|
||||
const selectedPackagesPrice = roomPackages.reduce(
|
||||
(acc, pkg) => acc + pkg.localPrice.totalPrice,
|
||||
0
|
||||
)
|
||||
|
||||
return total + price + selectedPackagesPrice
|
||||
}, 0),
|
||||
currency: mainRoomCurrency,
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user