fix: display modify dates for already guaranteed changeable rates

This commit is contained in:
Simon Emanuelsson
2025-04-03 15:51:38 +02:00
committed by Michael Zetterberg
parent b8a976db22
commit 2abd4c5c12
17 changed files with 94 additions and 205 deletions

View File

@@ -1,6 +1,4 @@
"use client"
import { useMemo } from "react"
import { useIntl } from "react-intl"
import { MaterialIcon } from "@scandic-hotels/design-system/Icons"
@@ -58,38 +56,34 @@ export default function ActionPanel({ hotel }: ActionPanelProps) {
checkOutDate,
createDateTime,
canChangeDate,
isPrePaid,
priceType,
} = bookedRoom
const datetimeIsInThePast = useMemo(
() => isDatetimePast(checkInDate),
[checkInDate]
)
const datetimeIsInThePast = isDatetimePast(checkInDate)
const isDateModifyable = checkDateModifiable({
const isDateModifyable = checkDateModifiable(
canChangeDate,
datetimeIsInThePast,
isCancelled: bookedRoom.isCancelled,
isPrePaid,
isRewardNight: priceType === "points",
})
bookedRoom.isCancelled,
priceType === "points"
)
const isCancelable = checkCancelable({
bookedRoom,
linkedReservationRooms,
const isCancelable = checkCancelable(
bookedRoom.isCancelable,
datetimeIsInThePast,
})
linkedReservationRooms
)
const isGuaranteeable = checkGuaranteeable({
bookedRoom,
datetimeIsInThePast,
})
const isGuaranteeable = checkGuaranteeable(
!!bookedRoom.guaranteeInfo,
bookedRoom.isCancelled,
datetimeIsInThePast
)
const canDownloadInvoice = checkCanDownloadInvoice({
isCancelled: bookedRoom.isCancelled,
isPrePaid,
})
const canDownloadInvoice = checkCanDownloadInvoice(
bookedRoom.isCancelled,
!!bookedRoom.guaranteeInfo
)
const calendarEvent: EventAttributes = {
busyStatus: "FREE",