Merged in fix/BOOK-599-filter-alert-booking-flow (pull request #3314)
fix(BOOK-599): filter displayInBookingFlow alert * fix(BOOK-599): filter displayInBookingFlow alert * fix(BOOK-599): filter displayinbookingflow on confirmation page Approved-by: Linus Flood
This commit is contained in:
committed by
Linus Flood
parent
276027045e
commit
8682e66047
@@ -2,13 +2,13 @@ import { notFound } from "next/navigation"
|
||||
|
||||
import { AlertTypeEnum } from "@scandic-hotels/common/constants/alert"
|
||||
import { dt } from "@scandic-hotels/common/dt"
|
||||
import { hasOverlappingDates } from "@scandic-hotels/common/dt/utils/hasOverlappingDates"
|
||||
import { Alert } from "@scandic-hotels/design-system/Alert"
|
||||
import { Divider } from "@scandic-hotels/design-system/Divider"
|
||||
import { HotelTypeEnum } from "@scandic-hotels/trpc/enums/hotelType"
|
||||
|
||||
import { BookingConfirmationProvider } from "../../providers/BookingConfirmationProvider"
|
||||
import { getBookingConfirmation } from "../../trpc/memoizedRequests/getBookingConfirmation"
|
||||
import { filterOverlappingDates } from "../../utils/SelectRate"
|
||||
import { SidePanel } from "../SidePanel"
|
||||
import { Confirmation } from "./Confirmation"
|
||||
import { HotelDetails } from "./HotelDetails"
|
||||
@@ -46,7 +46,14 @@ export async function BookingConfirmation({
|
||||
if (!room) {
|
||||
return notFound()
|
||||
}
|
||||
|
||||
const validAlerts = hotel.specialAlerts.filter(
|
||||
(alert) =>
|
||||
hasOverlappingDates(
|
||||
alert,
|
||||
dt(booking.checkInDate),
|
||||
dt(booking.checkOutDate)
|
||||
) && alert.displayInBookingFlow
|
||||
)
|
||||
return (
|
||||
<BookingConfirmationProvider
|
||||
bookingCode={booking.bookingCode}
|
||||
@@ -87,11 +94,7 @@ export async function BookingConfirmation({
|
||||
<PaymentDetails />
|
||||
<Divider color="Border/Divider/Subtle" />
|
||||
<HotelDetails hotel={hotel} />
|
||||
{filterOverlappingDates(
|
||||
hotel.specialAlerts,
|
||||
dt(booking.checkInDate),
|
||||
dt(booking.checkOutDate)
|
||||
).map((alert) => (
|
||||
{validAlerts.map((alert) => (
|
||||
<div key={alert.id}>
|
||||
<Alert
|
||||
type={alert.type}
|
||||
|
||||
@@ -33,8 +33,10 @@ export async function SelectRate({
|
||||
isInValidFNF = cookieStore.get("sc")?.value !== "1"
|
||||
}
|
||||
|
||||
const validAlerts = hotelData.hotel.specialAlerts.filter((alert) =>
|
||||
hasOverlappingDates(alert, dt(booking.fromDate), dt(booking.toDate))
|
||||
const validAlerts = hotelData.hotel.specialAlerts.filter(
|
||||
(alert) =>
|
||||
hasOverlappingDates(alert, dt(booking.fromDate), dt(booking.toDate)) &&
|
||||
alert.displayInBookingFlow
|
||||
)
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user