diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/Steps/SelectQuantityStep/selectQuantityStep.module.css b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/Steps/SelectQuantityStep/selectQuantityStep.module.css index 3a2738f1e..ea091a1db 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/Steps/SelectQuantityStep/selectQuantityStep.module.css +++ b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddAncillaryFlow/AddAncillaryFlowModal/Steps/SelectQuantityStep/selectQuantityStep.module.css @@ -44,7 +44,7 @@ .breakfastPriceBox { display: flex; - padding: var(--Space-15); + padding: var(--Space-x15); flex: 1 0 0; border-radius: var(--Corner-radius-md); border: 1px solid var(--Base-Border-Subtle); diff --git a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddedAncillaries/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddedAncillaries/index.tsx index 647625dbf..83b287db1 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddedAncillaries/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/Ancillaries/AddedAncillaries/index.tsx @@ -1,4 +1,5 @@ import { useRouter } from "next/navigation" +import { useMemo } from "react" import { useIntl } from "react-intl" import { MaterialIcon } from "@scandic-hotels/design-system/Icons" @@ -9,11 +10,14 @@ import Divider from "@/components/TempDesignSystem/Divider" import Body from "@/components/TempDesignSystem/Text/Body" import Subtitle from "@/components/TempDesignSystem/Text/Subtitle" +import { getBreakfastPackagesFromAncillaryFlow } from "../../utils/hasBreakfastPackage" import RemoveButton from "./RemoveButton" import styles from "./addedAncillaries.module.css" import type { AddedAncillariesProps } from "@/types/components/myPages/myStay/ancillaries" +import { BreakfastPackageEnum } from "@/types/enums/breakfast" +import type { PackageSchema } from "@/types/trpc/routers/booking/confirmation" export function AddedAncillaries({ ancillaries, @@ -22,6 +26,43 @@ export function AddedAncillaries({ const intl = useIntl() const router = useRouter() + /** + * All ancillaries that are added to the booking + * + * Adding a special ancillary for breakfast, calculated from + * all breakfast packages that has been added as ancillaries, + * not in the booking flow. + */ + const addedAncillaries = useMemo(() => { + const addedBreakfastPackages = getBreakfastPackagesFromAncillaryFlow( + booking.packages + ) + if (!addedBreakfastPackages?.length) { + return booking.ancillaries + } + + const combinedBreakfastPackageAsAncillary: PackageSchema = { + code: BreakfastPackageEnum.ANCILLARY_REGULAR_BREAKFAST, + unitPrice: 0, + points: 0, + currency: addedBreakfastPackages[0].currency, + type: addedBreakfastPackages[0].type, + description: addedBreakfastPackages[0].description, + comment: addedBreakfastPackages[0].comment, + totalPrice: addedBreakfastPackages.reduce( + (acc, curr) => acc + curr.totalPrice, + 0 + ), + unit: addedBreakfastPackages.reduce((acc, curr) => acc + curr.unit, 0), + totalUnit: addedBreakfastPackages.reduce( + (acc, curr) => acc + curr.totalUnit, + 0 + ), + } + + return [combinedBreakfastPackageAsAncillary, ...booking.ancillaries] + }, [booking.ancillaries, booking.packages]) + return (
- {hasBreakfastPackage(
+ {hasBreakfastPackageFromBookingFlow(
packages?.map((pkg) => ({
code: pkg.code,
})) ?? []
diff --git a/apps/scandic-web/components/HotelReservation/MyStay/PriceDetails/PriceDetailsTable/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/PriceDetails/PriceDetailsTable/index.tsx
index d6a5825df..572d4d8b3 100644
--- a/apps/scandic-web/components/HotelReservation/MyStay/PriceDetails/PriceDetailsTable/index.tsx
+++ b/apps/scandic-web/components/HotelReservation/MyStay/PriceDetails/PriceDetailsTable/index.tsx
@@ -199,34 +199,20 @@ export default function PriceDetailsTable({
{intl.formatMessage({ id: "Breakfast" })}
-- {hasBreakfastPackage( - packages?.map((pkg) => ({ - code: pkg.code, - })) ?? [] - ) - ? intl.formatMessage({ id: "Included" }) - : intl.formatMessage({ id: "Not included" })} -
-{intl.formatMessage({ id: "Breakfast" })}
+{breakfastText}
+
{packages &&
- hasBreakfastPackage(
+ hasBreakfastPackageFromBookingFlow(
packages.map((pkg) => ({
code: pkg.code,
}))
diff --git a/apps/scandic-web/i18n/dictionaries/da.json b/apps/scandic-web/i18n/dictionaries/da.json
index c298678df..078efed2d 100644
--- a/apps/scandic-web/i18n/dictionaries/da.json
+++ b/apps/scandic-web/i18n/dictionaries/da.json
@@ -126,6 +126,7 @@
"Booking summary": "Opsummering",
"Breakfast": "Morgenmad",
"Breakfast ({totalAdults, plural, one {# adult} other {# adults}}) x {totalBreakfasts}": "Morgenmad ({totalAdults, plural, one {# voksen} other {# voksne}}) x {totalBreakfasts}",
+ "Breakfast ({totalAdults, plural, one {# adult} other {# adults}}{totalChildren, plural, =0 {} one {, # child} other {, # children}}) x {totalBreakfasts}": "Morgenmad ({totalAdults, plural, one {# voksen} other {# voksne}}{totalChildren, plural, =0 {} one {, # barn} other {, # børn}}) x {totalBreakfasts}",
"Breakfast ({totalChildren, plural, one {# child} other {# children}}) x {totalBreakfasts}": "Morgenmad ({totalChildren, plural, one {# barn} other {# børn}}) x {totalBreakfasts}",
"Breakfast Restaurant": "Breakfast Restaurant",
"Breakfast buffet": "Morgenbuffet",
diff --git a/apps/scandic-web/i18n/dictionaries/de.json b/apps/scandic-web/i18n/dictionaries/de.json
index 1c6e53e2a..72ba62e0d 100644
--- a/apps/scandic-web/i18n/dictionaries/de.json
+++ b/apps/scandic-web/i18n/dictionaries/de.json
@@ -127,6 +127,7 @@
"Booking summary": "Zusammenfassung",
"Breakfast": "Frühstück",
"Breakfast ({totalAdults, plural, one {# adult} other {# adults}}) x {totalBreakfasts}": "Frühstück ({totalAdults, plural, one {# erwachsene} other {# erwachsene}}) x {totalBreakfasts}",
+ "Breakfast ({totalAdults, plural, one {# adult} other {# adults}}{totalChildren, plural, =0 {} one {, # child} other {, # children}}) x {totalBreakfasts}": "Frühstück ({totalAdults, plural, one {# erwachsene} other {# erwachsene}}{totalChildren, plural, =0 {} one {, # kind} other {, # kinder}}) x {totalBreakfasts}",
"Breakfast ({totalChildren, plural, one {# child} other {# children}}) x {totalBreakfasts}": "Frühstück ({totalChildren, plural, one {# kind} other {# kinder}}) x {totalBreakfasts}",
"Breakfast Restaurant": "Breakfast Restaurant",
"Breakfast buffet": "Frühstücksbuffet",
diff --git a/apps/scandic-web/i18n/dictionaries/en.json b/apps/scandic-web/i18n/dictionaries/en.json
index d56ff0888..23830ea7c 100644
--- a/apps/scandic-web/i18n/dictionaries/en.json
+++ b/apps/scandic-web/i18n/dictionaries/en.json
@@ -125,10 +125,11 @@
"Booking summary": "Booking summary",
"Breakfast": "Breakfast",
"Breakfast ({totalAdults, plural, one {# adult} other {# adults}}) x {totalBreakfasts}": "Breakfast ({totalAdults, plural, one {# adult} other {# adults}}) x {totalBreakfasts}",
+ "Breakfast ({totalAdults, plural, one {# adult} other {# adults}}{totalChildren, plural, =0 {} one {, # child} other {, # children}}) x {totalBreakfasts}": "Breakfast ({totalAdults, plural, one {# adult} other {# adults}}{totalChildren, plural, =0 {} one {, # child} other {, # children}}) x {totalBreakfasts}",
"Breakfast ({totalChildren, plural, one {# child} other {# children}}) x {totalBreakfasts}": "Breakfast ({totalChildren, plural, one {# child} other {# children}}) x {totalBreakfasts}",
"Breakfast Restaurant": "Breakfast Restaurant",
"Breakfast buffet": "Breakfast buffet",
- "Breakfast can only be added for the entire duration of the stay
and for all guests.": "Breakfast can only be added for the entire duration of the stay
and for all guests.",
+ "Breakfast can only be added for the entire duration of the stay and for all guests.": "Breakfast can only be added for the entire duration of the stay and for all guests.",
"Breakfast charge": "Breakfast charge",
"Breakfast deal can be purchased at the hotel.": "Breakfast deal can be purchased at the hotel.",
"Breakfast excluded": "Breakfast excluded",
diff --git a/apps/scandic-web/i18n/dictionaries/fi.json b/apps/scandic-web/i18n/dictionaries/fi.json
index 70b290fcc..d2a341b03 100644
--- a/apps/scandic-web/i18n/dictionaries/fi.json
+++ b/apps/scandic-web/i18n/dictionaries/fi.json
@@ -125,6 +125,7 @@
"Booking summary": "Yhteenveto",
"Breakfast": "Aamiainen",
"Breakfast ({totalAdults, plural, one {# adult} other {# adults}}) x {totalBreakfasts}": "Aamiainen ({totalAdults, plural, one {# aikuinen} other {# aikuiset}}) x {totalBreakfasts}",
+ "Breakfast ({totalAdults, plural, one {# adult} other {# adults}}{totalChildren, plural, =0 {} one {, # child} other {, # children}}) x {totalBreakfasts}": "Aamiainen ({totalAdults, plural, one {# aikuinen} other {# aikuista}}{totalChildren, plural, =0 {} one {, # lapsi} other {, # lapset}}) x {totalBreakfasts}",
"Breakfast ({totalChildren, plural, one {# child} other {# children}}) x {totalBreakfasts}": "Aamiainen ({totalChildren, plural, one {# lapsi} other {# lasta}}) x {totalBreakfasts}",
"Breakfast Restaurant": "Breakfast Restaurant",
"Breakfast buffet": "Aamiaisbuffet",
diff --git a/apps/scandic-web/i18n/dictionaries/no.json b/apps/scandic-web/i18n/dictionaries/no.json
index fe1bee262..97b5a8548 100644
--- a/apps/scandic-web/i18n/dictionaries/no.json
+++ b/apps/scandic-web/i18n/dictionaries/no.json
@@ -125,6 +125,7 @@
"Booking summary": "Sammendrag",
"Breakfast": "Frokost",
"Breakfast ({totalAdults, plural, one {# adult} other {# adults}}) x {totalBreakfasts}": "Frokost ({totalAdults, plural, one {# voksen} other {# voksne}}) x {totalBreakfasts}",
+ "Breakfast ({totalAdults, plural, one {# adult} other {# adults}}{totalChildren, plural, =0 {} one {, # child} other {, # children}}) x {totalBreakfasts}": "Frokost ({totalAdults, plural, one {# voksen} other {# voksne}}{totalChildren, plural, =0 {} one {, # barn} other {, # barn}}) x {totalBreakfasts}",
"Breakfast ({totalChildren, plural, one {# child} other {# children}}) x {totalBreakfasts}": "Frokost ({totalChildren, plural, one {# barn} other {# barn}}) x {totalBreakfasts}",
"Breakfast Restaurant": "Breakfast Restaurant",
"Breakfast buffet": "Breakfast buffet",
diff --git a/apps/scandic-web/i18n/dictionaries/sv.json b/apps/scandic-web/i18n/dictionaries/sv.json
index 02b1c4013..909aa13a8 100644
--- a/apps/scandic-web/i18n/dictionaries/sv.json
+++ b/apps/scandic-web/i18n/dictionaries/sv.json
@@ -125,6 +125,7 @@
"Booking summary": "Sammanfattning",
"Breakfast": "Frukost",
"Breakfast ({totalAdults, plural, one {# adult} other {# adults}}) x {totalBreakfasts}": "Frukost ({totalAdults, plural, one {# vuxen} other {# vuxna}}) x {totalBreakfasts}",
+ "Breakfast ({totalAdults, plural, one {# adult} other {# adults}}{totalChildren, plural, =0 {} one {, # child} other {, # children}}) x {totalBreakfasts}": "Frukost ({totalAdults, plural, one {# vuxen} other {# vuxna}}{totalChildren, plural, =0 {} one {, # barn} other {, # barn}}) x {totalBreakfasts}",
"Breakfast ({totalChildren, plural, one {# child} other {# children}}) x {totalBreakfasts}": "Frukost ({totalChildren, plural, one {# barn} other {# barn}}) x {totalBreakfasts}",
"Breakfast Restaurant": "Breakfast Restaurant",
"Breakfast buffet": "Frukostbuffé",
diff --git a/apps/scandic-web/stores/my-stay/myStayRoomDetailsStore.ts b/apps/scandic-web/stores/my-stay/myStayRoomDetailsStore.ts
index 7a0fcdacb..f81eba050 100644
--- a/apps/scandic-web/stores/my-stay/myStayRoomDetailsStore.ts
+++ b/apps/scandic-web/stores/my-stay/myStayRoomDetailsStore.ts
@@ -42,7 +42,7 @@ export type Room = Pick<
packages: Packages | null
bedType: BedTypeSchema
roomPrice: RoomPrice
- breakfast: BreakfastPackage | false
+ breakfast: BreakfastPackage | null
mainRoom: boolean
isPrePaid: boolean
priceType: PriceType
@@ -133,7 +133,7 @@ export const useMyStayRoomDetailsStore = create