Merged in fix/SW-2236-remove-modify-for-save (pull request #1771)
fix(SW-2236): show modify by only if changable * fix(SW-2236): show modify by only if changable Approved-by: Niclas Edenvin
This commit is contained in:
@@ -18,6 +18,7 @@ import useLang from "@/hooks/useLang"
|
|||||||
import { IconForFeatureCode } from "../../utils"
|
import { IconForFeatureCode } from "../../utils"
|
||||||
import Points from "../Points"
|
import Points from "../Points"
|
||||||
import Price from "../Price"
|
import Price from "../Price"
|
||||||
|
import { hasModifiableRate } from "../utils"
|
||||||
import { hasBreakfastPackageFromBookingFlow } from "../utils/hasBreakfastPackage"
|
import { hasBreakfastPackageFromBookingFlow } from "../utils/hasBreakfastPackage"
|
||||||
import { mapRoomDetails } from "../utils/mapRoomDetails"
|
import { mapRoomDetails } from "../utils/mapRoomDetails"
|
||||||
import MultiRoomSkeleton from "./MultiRoomSkeleton"
|
import MultiRoomSkeleton from "./MultiRoomSkeleton"
|
||||||
@@ -265,6 +266,7 @@ export default function MultiRoom({
|
|||||||
<p>{rateDefinition.cancellationText}</p>
|
<p>{rateDefinition.cancellationText}</p>
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
|
{hasModifiableRate(rateDefinition.cancellationRule) && (
|
||||||
<div className={styles.row}>
|
<div className={styles.row}>
|
||||||
<Typography variant="Body/Paragraph/mdBold">
|
<Typography variant="Body/Paragraph/mdBold">
|
||||||
<p>{intl.formatMessage({ id: "Modify By" })}</p>
|
<p>{intl.formatMessage({ id: "Modify By" })}</p>
|
||||||
@@ -276,6 +278,7 @@ export default function MultiRoom({
|
|||||||
</p>
|
</p>
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
<div className={styles.row}>
|
<div className={styles.row}>
|
||||||
<Typography variant="Body/Paragraph/mdBold">
|
<Typography variant="Body/Paragraph/mdBold">
|
||||||
<p>{intl.formatMessage({ id: "Breakfast" })}</p>
|
<p>{intl.formatMessage({ id: "Breakfast" })}</p>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import GuestDetails from "../GuestDetails"
|
|||||||
import Points from "../Points"
|
import Points from "../Points"
|
||||||
import Price from "../Price"
|
import Price from "../Price"
|
||||||
import PriceDetails from "../PriceDetails"
|
import PriceDetails from "../PriceDetails"
|
||||||
|
import { hasModifiableRate } from "../utils"
|
||||||
import ToggleSidePeek from "./ToggleSidePeek"
|
import ToggleSidePeek from "./ToggleSidePeek"
|
||||||
|
|
||||||
import styles from "./room.module.css"
|
import styles from "./room.module.css"
|
||||||
@@ -240,6 +241,7 @@ export function SingleRoom({ bedType, image, hotel, user }: RoomProps) {
|
|||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{hasModifiableRate(rateDefinition.cancellationRule) && (
|
||||||
<div className={styles.row}>
|
<div className={styles.row}>
|
||||||
<span className={styles.rowTitle}>
|
<span className={styles.rowTitle}>
|
||||||
<MaterialIcon
|
<MaterialIcon
|
||||||
@@ -256,12 +258,16 @@ export function SingleRoom({ bedType, image, hotel, user }: RoomProps) {
|
|||||||
<p color="uiTextHighContrast">
|
<p color="uiTextHighContrast">
|
||||||
{intl.formatMessage(
|
{intl.formatMessage(
|
||||||
{ id: "Until {time}, {date}" },
|
{ id: "Until {time}, {date}" },
|
||||||
{ time: "18:00", date: fromDate.format("dddd D MMM") }
|
{
|
||||||
|
time: "18:00",
|
||||||
|
date: fromDate.format("dddd D MMM"),
|
||||||
|
}
|
||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
{breakfastText !== null && (
|
{breakfastText !== null && (
|
||||||
<div className={styles.row}>
|
<div className={styles.row}>
|
||||||
<span className={styles.rowTitle}>
|
<span className={styles.rowTitle}>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ChildBedTypeEnum } from "@/constants/booking"
|
import { CancellationRuleEnum, ChildBedTypeEnum } from "@/constants/booking"
|
||||||
|
|
||||||
export function formatChildBedPreferences({
|
export function formatChildBedPreferences({
|
||||||
childrenAges,
|
childrenAges,
|
||||||
@@ -61,3 +61,10 @@ export function formatChildBedPreferences({
|
|||||||
// Filter out any null values and join the results
|
// Filter out any null values and join the results
|
||||||
return `[${preferences.filter((pref) => typeof pref === "string").join(", ")}]`
|
return `[${preferences.filter((pref) => typeof pref === "string").join(", ")}]`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function hasModifiableRate(cancellationRule: string | null): boolean {
|
||||||
|
return (
|
||||||
|
cancellationRule === CancellationRuleEnum.CancellableBefore6PM ||
|
||||||
|
cancellationRule === CancellationRuleEnum.Changeable
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { useMyStayRoomDetailsStore } from "@/stores/my-stay/myStayRoomDetailsSto
|
|||||||
|
|
||||||
import GuestDetails from "@/components/HotelReservation/MyStay/GuestDetails"
|
import GuestDetails from "@/components/HotelReservation/MyStay/GuestDetails"
|
||||||
import Price from "@/components/HotelReservation/MyStay/Price"
|
import Price from "@/components/HotelReservation/MyStay/Price"
|
||||||
|
import { hasModifiableRate } from "@/components/HotelReservation/MyStay/utils"
|
||||||
import { hasBreakfastPackageFromBookingFlow } from "@/components/HotelReservation/MyStay/utils/hasBreakfastPackage"
|
import { hasBreakfastPackageFromBookingFlow } from "@/components/HotelReservation/MyStay/utils/hasBreakfastPackage"
|
||||||
import ImageGallery from "@/components/ImageGallery"
|
import ImageGallery from "@/components/ImageGallery"
|
||||||
import Accordion from "@/components/TempDesignSystem/Accordion"
|
import Accordion from "@/components/TempDesignSystem/Accordion"
|
||||||
@@ -93,7 +94,6 @@ export default function BookedRoomSidePeek({
|
|||||||
|
|
||||||
const adultsOnlyMsg = adultsMsg
|
const adultsOnlyMsg = adultsMsg
|
||||||
const adultsAndChildrenMsg = [adultsMsg, childrenMsg].join(", ")
|
const adultsAndChildrenMsg = [adultsMsg, childrenMsg].join(", ")
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SidePeek
|
<SidePeek
|
||||||
title={room.name}
|
title={room.name}
|
||||||
@@ -187,6 +187,9 @@ export default function BookedRoomSidePeek({
|
|||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{hasModifiableRate(
|
||||||
|
matchingRoomBooking.rateDefinition.cancellationRule
|
||||||
|
) && (
|
||||||
<div className={styles.row}>
|
<div className={styles.row}>
|
||||||
<span className={styles.rowTitle}>
|
<span className={styles.rowTitle}>
|
||||||
<MaterialIcon icon="refresh" color="Icon/Default" size={20} />
|
<MaterialIcon icon="refresh" color="Icon/Default" size={20} />
|
||||||
@@ -205,6 +208,7 @@ export default function BookedRoomSidePeek({
|
|||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
<div className={styles.row}>
|
<div className={styles.row}>
|
||||||
<span className={styles.rowTitle}>
|
<span className={styles.rowTitle}>
|
||||||
<MaterialIcon icon="coffee" color="Icon/Default" size={20} />
|
<MaterialIcon icon="coffee" color="Icon/Default" size={20} />
|
||||||
@@ -259,7 +263,6 @@ export default function BookedRoomSidePeek({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className={styles.row}>
|
<div className={styles.row}>
|
||||||
<span className={styles.rowTitle}>
|
<span className={styles.rowTitle}>
|
||||||
<MaterialIcon icon="bed" color="Icon/Default" size={20} />
|
<MaterialIcon icon="bed" color="Icon/Default" size={20} />
|
||||||
|
|||||||
Reference in New Issue
Block a user