Merged in feat(SW-2084)-disable-options-modify-my-stay (pull request #1662)

feat(SW-2084) logic to disable Manage stay options

* feat(SW-2084) logic to disable Manage stay options

* feat(SW-2084) cleanup logic for checks

* feat(SW-2084) check if date has passed

* feat(SW-2084) change to datetimeIsInThePast


Approved-by: Niclas Edenvin
This commit is contained in:
Pontus Dreij
2025-03-31 07:44:46 +00:00
parent e8148fdf21
commit a8358de04a
12 changed files with 239 additions and 73 deletions

View File

@@ -5,7 +5,6 @@ import { useIntl } from "react-intl"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons"
import { Typography } from "@scandic-hotels/design-system/Typography"
import { CancellationRuleEnum } from "@/constants/booking"
import { dt } from "@/lib/dt"
import { useMyStayRoomDetailsStore } from "@/stores/my-stay/myStayRoomDetailsStore"
@@ -31,22 +30,15 @@ export default function BookingSummary({ hotel }: BookingSummaryProps) {
const bookedRoom = useMyStayRoomDetailsStore((state) => state.bookedRoom)
const {
isCancelled,
createDateTime,
rateDefinition,
guaranteeInfo,
checkInDate,
} = bookedRoom
const { isCancelled, createDateTime, guaranteeInfo, checkInDate, isPrePaid } =
bookedRoom
const directionsUrl = `https://www.google.com/maps/dir/?api=1&destination=${hotel.location.latitude},${hotel.location.longitude}`
const bookingDate = dt(createDateTime).locale(lang).format("D MMMM YYYY")
const isPaid =
rateDefinition.cancellationRule !==
CancellationRuleEnum.CancellableBefore6PM ||
dt(checkInDate).startOf("day").isBefore(dt().startOf("day"))
isPrePaid || dt(checkInDate).startOf("day").isBefore(dt().startOf("day"))
const paymentMethod = guaranteeInfo?.paymentMethodDescription
?.toLocaleLowerCase()