feat: SW-2079 Show points in confirmation page * feat: SW-2079 Show points in confirmation page * feat: SW-2079 Optimized code * feat: SW-2079 Updated Body to Typography * feat: SW-2079 Multi-room total cost display * feat: SW-2079 Add reward nights condition rate title * feat: SW-2079 Removed extra checks * feat: SW-2079 Optimmized formatPrice function * feat: SW-2079 Typo fix Approved-by: Christian Andolf
88 lines
3.1 KiB
TypeScript
88 lines
3.1 KiB
TypeScript
import { notFound } from "next/navigation"
|
|
|
|
import { getBookingConfirmation } from "@/lib/trpc/memoizedRequests"
|
|
import { encrypt } from "@/server/routers/utils/encryption"
|
|
|
|
import HotelDetails from "@/components/HotelReservation/BookingConfirmation/HotelDetails"
|
|
import PaymentDetails from "@/components/HotelReservation/BookingConfirmation/PaymentDetails"
|
|
import Promos from "@/components/HotelReservation/BookingConfirmation/Promos"
|
|
import Receipt from "@/components/HotelReservation/BookingConfirmation/Receipt"
|
|
import Rooms from "@/components/HotelReservation/BookingConfirmation/Rooms"
|
|
import SidePanel from "@/components/HotelReservation/SidePanel"
|
|
import Divider from "@/components/TempDesignSystem/Divider"
|
|
import { getIntl } from "@/i18n"
|
|
import BookingConfirmationProvider from "@/providers/BookingConfirmationProvider"
|
|
|
|
import Alerts from "./Alerts"
|
|
import Confirmation from "./Confirmation"
|
|
import Tracking from "./Tracking"
|
|
import { mapRoomState } from "./utils"
|
|
|
|
import styles from "./bookingConfirmation.module.css"
|
|
|
|
import type { BookingConfirmationProps } from "@/types/components/hotelReservation/bookingConfirmation/bookingConfirmation"
|
|
|
|
export default async function BookingConfirmation({
|
|
confirmationNumber,
|
|
}: BookingConfirmationProps) {
|
|
const bookingConfirmation = await getBookingConfirmation(confirmationNumber)
|
|
|
|
if (!bookingConfirmation) {
|
|
return notFound()
|
|
}
|
|
const { booking, hotel, room } = bookingConfirmation
|
|
if (!room) {
|
|
return notFound()
|
|
}
|
|
|
|
const refId = encrypt(
|
|
`${booking.confirmationNumber},${booking.guest.lastName}`
|
|
)
|
|
|
|
const intl = await getIntl()
|
|
return (
|
|
<BookingConfirmationProvider
|
|
bookingCode={booking.bookingCode}
|
|
currencyCode={booking.currencyCode}
|
|
fromDate={booking.checkInDate}
|
|
toDate={booking.checkOutDate}
|
|
rooms={[
|
|
mapRoomState(booking, room, intl),
|
|
// null represents "known but not yet fetched rooms" and is used to render placeholders correctly
|
|
...Array(booking.linkedReservations.length).fill(null),
|
|
]}
|
|
vat={booking.vatPercentage}
|
|
>
|
|
<Confirmation booking={booking} hotel={hotel} room={room} refId={refId}>
|
|
<div className={styles.booking}>
|
|
<Alerts booking={booking} />
|
|
<Rooms
|
|
booking={booking}
|
|
checkInTime={hotel.hotelFacts.checkin.checkInTime}
|
|
checkOutTime={hotel.hotelFacts.checkin.checkOutTime}
|
|
mainRoom={room}
|
|
linkedReservations={booking.linkedReservations}
|
|
/>
|
|
<PaymentDetails />
|
|
<Divider color="primaryLightSubtle" />
|
|
<HotelDetails hotel={hotel} />
|
|
<Promos
|
|
confirmationNumber={booking.confirmationNumber}
|
|
hotelId={hotel.operaId}
|
|
lastName={booking.guest.lastName}
|
|
/>
|
|
<div className={styles.mobileReceipt}>
|
|
<Receipt />
|
|
</div>
|
|
</div>
|
|
<aside className={styles.aside}>
|
|
<SidePanel variant="receipt">
|
|
<Receipt />
|
|
</SidePanel>
|
|
</aside>
|
|
</Confirmation>
|
|
<Tracking bookingConfirmation={bookingConfirmation} />
|
|
</BookingConfirmationProvider>
|
|
)
|
|
}
|