diff --git a/apps/scandic-web/components/HotelReservation/MyStay/MultiRoom/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/MultiRoom/index.tsx index 85258b19a..5c14b136d 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/MultiRoom/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/MultiRoom/index.tsx @@ -18,6 +18,7 @@ import useLang from "@/hooks/useLang" import { IconForFeatureCode } from "../../utils" import Points from "../Points" import Price from "../Price" +import { hasModifiableRate } from "../utils" import { hasBreakfastPackageFromBookingFlow } from "../utils/hasBreakfastPackage" import { mapRoomDetails } from "../utils/mapRoomDetails" import MultiRoomSkeleton from "./MultiRoomSkeleton" @@ -265,17 +266,19 @@ export default function MultiRoom({

{rateDefinition.cancellationText}

-
- -

{intl.formatMessage({ id: "Modify By" })}

-
+ {hasModifiableRate(rateDefinition.cancellationRule) && ( +
+ +

{intl.formatMessage({ id: "Modify By" })}

+
- -

- 18:00, {fromDate.format("dddd D MMM")} -

-
-
+ +

+ 18:00, {fromDate.format("dddd D MMM")} +

+
+
+ )}

{intl.formatMessage({ id: "Breakfast" })}

diff --git a/apps/scandic-web/components/HotelReservation/MyStay/SingleRoom/index.tsx b/apps/scandic-web/components/HotelReservation/MyStay/SingleRoom/index.tsx index a8ad62106..afe5b943b 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/SingleRoom/index.tsx +++ b/apps/scandic-web/components/HotelReservation/MyStay/SingleRoom/index.tsx @@ -20,6 +20,7 @@ import GuestDetails from "../GuestDetails" import Points from "../Points" import Price from "../Price" import PriceDetails from "../PriceDetails" +import { hasModifiableRate } from "../utils" import ToggleSidePeek from "./ToggleSidePeek" import styles from "./room.module.css" @@ -240,28 +241,33 @@ export function SingleRoom({ bedType, image, hotel, user }: RoomProps) {
-
- - - -

{intl.formatMessage({ id: "Modify By" })}

-
-
-
- -

- {intl.formatMessage( - { id: "Until {time}, {date}" }, - { time: "18:00", date: fromDate.format("dddd D MMM") } - )} -

-
+ {hasModifiableRate(rateDefinition.cancellationRule) && ( +
+ + + +

{intl.formatMessage({ id: "Modify By" })}

+
+
+
+ +

+ {intl.formatMessage( + { id: "Until {time}, {date}" }, + { + time: "18:00", + date: fromDate.format("dddd D MMM"), + } + )} +

+
+
-
+ )} {breakfastText !== null && (
diff --git a/apps/scandic-web/components/HotelReservation/MyStay/utils.ts b/apps/scandic-web/components/HotelReservation/MyStay/utils.ts index 70002010b..b04380acd 100644 --- a/apps/scandic-web/components/HotelReservation/MyStay/utils.ts +++ b/apps/scandic-web/components/HotelReservation/MyStay/utils.ts @@ -1,4 +1,4 @@ -import { ChildBedTypeEnum } from "@/constants/booking" +import { CancellationRuleEnum, ChildBedTypeEnum } from "@/constants/booking" export function formatChildBedPreferences({ childrenAges, @@ -61,3 +61,10 @@ export function formatChildBedPreferences({ // Filter out any null values and join the results return `[${preferences.filter((pref) => typeof pref === "string").join(", ")}]` } + +export function hasModifiableRate(cancellationRule: string | null): boolean { + return ( + cancellationRule === CancellationRuleEnum.CancellableBefore6PM || + cancellationRule === CancellationRuleEnum.Changeable + ) +} diff --git a/apps/scandic-web/components/SidePeeks/BookedRoomSidePeek/index.tsx b/apps/scandic-web/components/SidePeeks/BookedRoomSidePeek/index.tsx index 20b14ea0f..3bc54c695 100644 --- a/apps/scandic-web/components/SidePeeks/BookedRoomSidePeek/index.tsx +++ b/apps/scandic-web/components/SidePeeks/BookedRoomSidePeek/index.tsx @@ -9,6 +9,7 @@ import { useMyStayRoomDetailsStore } from "@/stores/my-stay/myStayRoomDetailsSto import GuestDetails from "@/components/HotelReservation/MyStay/GuestDetails" import Price from "@/components/HotelReservation/MyStay/Price" +import { hasModifiableRate } from "@/components/HotelReservation/MyStay/utils" import { hasBreakfastPackageFromBookingFlow } from "@/components/HotelReservation/MyStay/utils/hasBreakfastPackage" import ImageGallery from "@/components/ImageGallery" import Accordion from "@/components/TempDesignSystem/Accordion" @@ -93,7 +94,6 @@ export default function BookedRoomSidePeek({ const adultsOnlyMsg = adultsMsg const adultsAndChildrenMsg = [adultsMsg, childrenMsg].join(", ") - return (
-
- - - -

{intl.formatMessage({ id: "Modify By" })}

-
-
-
- -

- {intl.formatMessage( - { id: "Until {time}, {date}" }, - { time: "18:00", date: fromDate.format("dddd D MMM") } - )} -

-
+ {hasModifiableRate( + matchingRoomBooking.rateDefinition.cancellationRule + ) && ( +
+ + + +

{intl.formatMessage({ id: "Modify By" })}

+
+
+
+ +

+ {intl.formatMessage( + { id: "Until {time}, {date}" }, + { time: "18:00", date: fromDate.format("dddd D MMM") } + )} +

+
+
-
+ )}
@@ -259,7 +263,6 @@ export default function BookedRoomSidePeek({
)} -