feat: add multiroom signup

This commit is contained in:
Simon Emanuelsson
2025-02-17 15:10:48 +01:00
parent 95917e5e4f
commit 92c5566c59
78 changed files with 2035 additions and 1545 deletions

View File

@@ -55,7 +55,6 @@ function isPaymentMethodEnum(value: string): value is PaymentMethodEnum {
}
export default function PaymentClient({
user,
otherPaymentOptions,
savedCreditCards,
mustBeGuaranteed,
@@ -65,17 +64,13 @@ export default function PaymentClient({
const intl = useIntl()
const searchParams = useSearchParams()
const { totalPrice, booking, rooms, bookingProgress } = useEnterDetailsStore(
(state) => {
return {
totalPrice: state.totalPrice,
booking: state.booking,
rooms: state.rooms,
bookingProgress: state.bookingProgress,
}
}
)
const canProceedToPayment = bookingProgress.canProceedToPayment
const { booking, canProceedToPayment, rooms, totalPrice } =
useEnterDetailsStore((state) => ({
booking: state.booking,
canProceedToPayment: state.canProceedToPayment,
rooms: state.rooms,
totalPrice: state.totalPrice,
}))
const setIsSubmittingDisabled = useEnterDetailsStore(
(state) => state.actions.setIsSubmittingDisabled
@@ -120,7 +115,7 @@ export default function PaymentClient({
if (priceChange) {
setPriceChangeData({
oldPrice: rooms[0].roomPrice.perStay.local.price,
oldPrice: rooms[0].room.roomPrice.perStay.local.price,
newPrice: priceChange.totalPrice,
})
} else {
@@ -232,27 +227,27 @@ export default function PaymentClient({
hotelId,
checkInDate: fromDate,
checkOutDate: toDate,
rooms: rooms.map((room, idx) => ({
rooms: rooms.map(({ room }, idx) => ({
adults: room.adults,
childrenAges: room.childrenInRoom?.map((child) => ({
age: child.age,
bedType: bedTypeMap[parseInt(child.bed.toString())],
})),
rateCode:
(user || room.guest.join || room.guest.membershipNo) &&
(room.guest.join || room.guest.membershipNo) &&
booking.rooms[idx].counterRateCode
? booking.rooms[idx].counterRateCode
: booking.rooms[idx].rateCode,
roomTypeCode: room.bedType!.roomTypeCode, // A selection has been made in order to get to this step.
guest: {
becomeMember: room.guest.join,
countryCode: room.guest.countryCode,
dateOfBirth: room.guest.dateOfBirth,
email: room.guest.email,
firstName: room.guest.firstName,
lastName: room.guest.lastName,
email: room.guest.email,
phoneNumber: room.guest.phoneNumber,
countryCode: room.guest.countryCode,
membershipNumber: room.guest.membershipNo,
becomeMember: room.guest.join,
dateOfBirth: room.guest.dateOfBirth,
phoneNumber: room.guest.phoneNumber,
postalCode: room.guest.zipCode,
},
packages: {
@@ -301,7 +296,6 @@ export default function PaymentClient({
fromDate,
toDate,
rooms,
user,
booking,
]
)

View File

@@ -5,7 +5,6 @@ import PaymentClient from "./PaymentClient"
import type { PaymentProps } from "@/types/components/hotelReservation/enterDetails/payment"
export default async function Payment({
user,
otherPaymentOptions,
mustBeGuaranteed,
supportedCards,
@@ -16,7 +15,6 @@ export default async function Payment({
return (
<PaymentClient
user={user}
otherPaymentOptions={otherPaymentOptions}
savedCreditCards={savedCreditCards}
mustBeGuaranteed={mustBeGuaranteed}