@@ -170,9 +178,7 @@ export default function SelectHotelContent({
filters={filterList}
setShowSkeleton={setShowSkeleton}
/>
- {bookingCode &&
- isBookingCodeRateAvailable &&
- isRegularRateAvailable ? (
+ {showBookingCodeFilter ? (
diff --git a/apps/scandic-web/components/HotelReservation/SelectHotel/index.tsx b/apps/scandic-web/components/HotelReservation/SelectHotel/index.tsx
index 4ccc9a484..40d084c62 100644
--- a/apps/scandic-web/components/HotelReservation/SelectHotel/index.tsx
+++ b/apps/scandic-web/components/HotelReservation/SelectHotel/index.tsx
@@ -101,16 +101,16 @@ export default async function SelectHotel({
const isFullPriceHotelAvailable = bookingCode
? hotels?.some(
(hotel) =>
- !hotel.availability.productType?.public?.bookingCode &&
- !hotel.availability.productType?.member?.bookingCode
+ !hotel.availability.bookingCode &&
+ hotel.availability.status === "Available"
)
: false
const isBookingCodeRateAvailable = bookingCode
? hotels?.some(
(hotel) =>
- hotel.availability.productType?.public?.bookingCode ||
- hotel.availability.productType?.member?.bookingCode
+ hotel.availability.bookingCode &&
+ hotel.availability.status === "Available"
)
: false
diff --git a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Code.tsx b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Code.tsx
index 993e06a7d..fecbc285f 100644
--- a/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Code.tsx
+++ b/apps/scandic-web/components/HotelReservation/SelectRate/RoomsContainer/Rooms/RoomsList/RoomListItem/Rates/Code.tsx
@@ -76,7 +76,7 @@ export default function Code({
const pkgsSumRequested = sumPackagesRequestedPrice(selectedPackages)
if ("corporateCheque" in product) {
- const { localPrice, rateCode } = product.corporateCheque
+ const { localPrice, rateCode, requestedPrice } = product.corporateCheque
let price = `${localPrice.numberOfCheques} CC`
if (localPrice.additionalPricePerStay) {
price = `${price} + ${localPrice.additionalPricePerStay + pkgsSum.price}`
@@ -90,11 +90,28 @@ export default function Code({
roomTypeCode
)
- const currency = localPrice.currency ?? pkgsSum.currency?.toString() ?? ""
+ const currency =
+ localPrice.additionalPricePerStay > 0 || pkgsSum.price > 0
+ ? (localPrice.currency ?? pkgsSum.currency ?? "")
+ : ""
+
+ const approximateRate =
+ requestedPrice?.additionalPricePerStay && requestedPrice?.currency
+ ? {
+ label: intl.formatMessage({
+ defaultMessage: "Approx.",
+ }),
+ price:
+ `${requestedPrice.numberOfCheques} CC + ` +
+ requestedPrice.additionalPricePerStay,
+ unit: requestedPrice.currency,
+ }
+ : undefined
return (
handleSelectRate(product)}
isSelected={isSelected}
diff --git a/apps/scandic-web/components/Maps/InteractiveMap/HotelListingMapContent/HotelPin/index.tsx b/apps/scandic-web/components/Maps/InteractiveMap/HotelListingMapContent/HotelPin/index.tsx
index d790ea4ba..476327582 100644
--- a/apps/scandic-web/components/Maps/InteractiveMap/HotelListingMapContent/HotelPin/index.tsx
+++ b/apps/scandic-web/components/Maps/InteractiveMap/HotelListingMapContent/HotelPin/index.tsx
@@ -12,12 +12,16 @@ interface HotelPinProps {
isActive: boolean
hotelPrice: number | null
currency: string
+ hotelAdditionalPrice?: number
+ hotelAdditionalCurrency?: string
}
export default function HotelPin({
isActive,
hotelPrice,
currency,
+ hotelAdditionalPrice,
+ hotelAdditionalCurrency,
}: HotelPinProps) {
const intl = useIntl()
const isNotAvailable = !hotelPrice
@@ -39,8 +43,18 @@ export default function HotelPin({
)}
- {/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */}
- {isNotAvailable ? "—" : formatPrice(intl, hotelPrice, currency)}
+
+ {isNotAvailable
+ ? // eslint-disable-next-line formatjs/no-literal-string-in-jsx
+ "—"
+ : formatPrice(
+ intl,
+ hotelPrice,
+ currency,
+ hotelAdditionalPrice,
+ hotelAdditionalCurrency
+ )}
+
)
diff --git a/apps/scandic-web/components/Maps/InteractiveMap/HotelListingMapContent/index.tsx b/apps/scandic-web/components/Maps/InteractiveMap/HotelListingMapContent/index.tsx
index 4932419c5..0dc6808c9 100644
--- a/apps/scandic-web/components/Maps/InteractiveMap/HotelListingMapContent/index.tsx
+++ b/apps/scandic-web/components/Maps/InteractiveMap/HotelListingMapContent/index.tsx
@@ -36,7 +36,19 @@ function HotelListingMapContent({ hotelPins }: HotelListingMapContentProps) {
const isActiveOrHovered =
activeHotel === pin.name || hoveredHotel === pin.name
const hotelPrice =
- pin.memberPrice ?? pin.publicPrice ?? pin.redemptionPrice
+ pin.memberPrice ??
+ pin.publicPrice ??
+ pin.redemptionPrice ??
+ pin.voucherPrice ??
+ pin.chequePrice?.numberOfCheques ??
+ null
+
+ const hotelAdditionalPrice = pin.chequePrice
+ ? pin.chequePrice.additionalPricePerStay
+ : undefined
+ const hotelAdditionalCurrency = pin.chequePrice
+ ? pin.chequePrice.currency?.toString()
+ : undefined
return (
)
diff --git a/apps/scandic-web/server/routers/hotels/output.ts b/apps/scandic-web/server/routers/hotels/output.ts
index 6b424d5c1..be35493de 100644
--- a/apps/scandic-web/server/routers/hotels/output.ts
+++ b/apps/scandic-web/server/routers/hotels/output.ts
@@ -95,25 +95,15 @@ export const hotelSchema = z
export const hotelsAvailabilitySchema = z.object({
data: z.array(
z.object({
- attributes: z
- .object({
- bookingCode: z.string().nullish(),
- checkInDate: z.string(),
- checkOutDate: z.string(),
- hotelId: z.number(),
- occupancy: occupancySchema,
- productType: productTypeSchema,
- status: z.string(),
- })
- .transform((data) => {
- if (data.bookingCode && data.productType?.public) {
- data.productType.public.bookingCode = data.bookingCode
- }
- if (data.bookingCode && data.productType?.member) {
- data.productType.member.bookingCode = data.bookingCode
- }
- return data
- }),
+ attributes: z.object({
+ bookingCode: z.string().nullish(),
+ checkInDate: z.string(),
+ checkOutDate: z.string(),
+ hotelId: z.number(),
+ occupancy: occupancySchema,
+ productType: productTypeSchema,
+ status: z.string(),
+ }),
relationships: relationshipsSchema.optional(),
type: z.string().optional(),
})
diff --git a/apps/scandic-web/server/routers/hotels/schemas/productTypePrice.ts b/apps/scandic-web/server/routers/hotels/schemas/productTypePrice.ts
index 74c5c3065..98e3de49f 100644
--- a/apps/scandic-web/server/routers/hotels/schemas/productTypePrice.ts
+++ b/apps/scandic-web/server/routers/hotels/schemas/productTypePrice.ts
@@ -46,7 +46,6 @@ const partialPriceSchema = z.object({
}
return RateTypeEnum.Regular
}),
- bookingCode: z.string().nullish(),
})
export const productTypeCorporateChequeSchema = z
diff --git a/apps/scandic-web/types/components/hotelReservation/selectHotel/map.ts b/apps/scandic-web/types/components/hotelReservation/selectHotel/map.ts
index fe3d45677..fece879da 100644
--- a/apps/scandic-web/types/components/hotelReservation/selectHotel/map.ts
+++ b/apps/scandic-web/types/components/hotelReservation/selectHotel/map.ts
@@ -2,6 +2,7 @@ import type { z } from "zod"
import type { Coordinates } from "@/types/components/maps/coordinates"
import type { Amenities } from "@/types/hotel"
+import type { ProductTypeCheque } from "@/types/trpc/routers/hotel/availability"
import type { HotelResponse } from "@/components/HotelReservation/SelectHotel/helpers"
import type { imageSchema } from "@/server/routers/hotels/schemas/image"
import type { CategorizedFilters } from "./hotelFilters"
@@ -32,9 +33,11 @@ export type HotelPin = {
bookingCode?: string | null
name: string
coordinates: Coordinates
+ chequePrice: ProductTypeCheque["localPrice"] | null
publicPrice: number | null
memberPrice: number | null
redemptionPrice: number | null
+ voucherPrice: number | null
rateType: string | null
currency: string
images: {