Fix/remove old select rate * remove old select-rate * Fix imports * renamed SelectRate2 -> SelectRate
55 lines
1.5 KiB
TypeScript
55 lines
1.5 KiB
TypeScript
import { cookies } from "next/headers"
|
|
|
|
import { FamilyAndFriendsCodes } from "@/constants/booking"
|
|
|
|
import { HotelInfoCard } from "@/components/HotelReservation/SelectRate/HotelInfoCard"
|
|
import { RoomsContainer } from "@/components/HotelReservation/SelectRate/RoomsContainer"
|
|
|
|
import FnFNotAllowedAlert from "../FnFNotAllowedAlert/FnFNotAllowedAlert"
|
|
import AvailabilityError from "./AvailabilityError"
|
|
import Tracking from "./Tracking"
|
|
|
|
import type { RouterOutput } from "@scandic-hotels/trpc/client"
|
|
|
|
import type { SelectRateBooking } from "@/types/components/hotelReservation/selectRate/selectRate"
|
|
|
|
export default async function SelectRatePage({
|
|
booking,
|
|
hotelData,
|
|
}: {
|
|
hotelData: NonNullable<RouterOutput["hotel"]["get"]>
|
|
booking: SelectRateBooking
|
|
}) {
|
|
const bookingCode = booking.bookingCode
|
|
|
|
let isInValidFNF = false
|
|
if (bookingCode && FamilyAndFriendsCodes.includes(bookingCode)) {
|
|
const cookieStore = await cookies()
|
|
isInValidFNF = cookieStore.get("sc")?.value !== "1"
|
|
}
|
|
return (
|
|
<>
|
|
<HotelInfoCard hotel={hotelData.hotel} booking={booking} />
|
|
|
|
{isInValidFNF ? (
|
|
<FnFNotAllowedAlert />
|
|
) : (
|
|
<RoomsContainer
|
|
hotelType={hotelData.hotel.hotelType}
|
|
roomCategories={hotelData.roomCategories}
|
|
vat={hotelData.hotel.vat}
|
|
/>
|
|
)}
|
|
|
|
<Tracking
|
|
hotelId={hotelData.hotel.id}
|
|
hotelName={hotelData.hotel.name}
|
|
country={hotelData.hotel.address.country}
|
|
city={hotelData.hotel.address.city}
|
|
/>
|
|
|
|
<AvailabilityError />
|
|
</>
|
|
)
|
|
}
|