feat: add support for bought children breakfast package

This commit is contained in:
Simon Emanuelsson
2025-05-13 11:30:49 +02:00
committed by Simon.Emanuelsson
parent aceb88cb1a
commit b7c78a53b5
9 changed files with 229 additions and 68 deletions

View File

@@ -10,10 +10,13 @@ import Row from "./Row"
export default function Breakfast() {
const intl = useIntl()
const { breakfast, rateDefinition } = useMyStayStore((state) => ({
breakfast: state.bookedRoom.breakfast,
rateDefinition: state.bookedRoom.rateDefinition,
}))
const { breakfast, breakfastChildren, rateDefinition } = useMyStayStore(
(state) => ({
breakfast: state.bookedRoom.breakfast,
breakfastChildren: state.bookedRoom.breakfastChildren,
rateDefinition: state.bookedRoom.rateDefinition,
})
)
let breakfastPrice = intl.formatMessage({
defaultMessage: "No breakfast",
@@ -23,9 +26,10 @@ export default function Breakfast() {
defaultMessage: "Included",
})
} else if (breakfast) {
const childPrice = breakfastChildren?.localPrice.totalPrice || 0
breakfastPrice = formatPrice(
intl,
breakfast.localPrice.totalPrice,
breakfast.localPrice.totalPrice + childPrice,
breakfast.localPrice.currency
)
}