From 23eaa772eaa19cc546f3fd54152226a84017fe94 Mon Sep 17 00:00:00 2001 From: Hrishikesh Vaipurkar Date: Wed, 5 Mar 2025 19:08:54 +0100 Subject: [PATCH] feat: SW-1583 City search Map view redemption --- .../FormContent/BookingCode/index.tsx | 7 +++++++ .../HotelCard/HotelPointsCard/index.tsx | 7 +++++-- .../ListingHotelCardDialog/index.tsx | 21 ++++++++++++++----- .../StandaloneHotelCardDialog/index.tsx | 19 +++++++++++++---- .../HotelCardDialogListing/index.tsx | 8 ++++++- .../HotelCardDialogListing/utils.ts | 8 ++++++- .../HotelCardListing/utils.ts | 1 + .../SelectHotelMapContainer.tsx | 10 ++++++++- .../HotelListingMapContent/index.tsx | 3 ++- .../hotelReservation/selectHotel/map.ts | 1 + .../selectHotel/priceCardProps.ts | 3 ++- 11 files changed, 72 insertions(+), 16 deletions(-) diff --git a/apps/scandic-web/components/Forms/BookingWidget/FormContent/BookingCode/index.tsx b/apps/scandic-web/components/Forms/BookingWidget/FormContent/BookingCode/index.tsx index 7d2099ab5..31d303851 100644 --- a/apps/scandic-web/components/Forms/BookingWidget/FormContent/BookingCode/index.tsx +++ b/apps/scandic-web/components/Forms/BookingWidget/FormContent/BookingCode/index.tsx @@ -37,6 +37,7 @@ export default function BookingCode() { setValue, formState: { errors }, getValues, + trigger, } = useFormContext() const bookingCode: BookingCodeSchema = getValues("bookingCode") @@ -52,6 +53,12 @@ export default function BookingCode() { function updateBookingCodeFormValue(value: string) { setValue("bookingCode.value", value, { shouldValidate: true }) + if (getValues("redemption")) { + setValue("redemption", false) + setTimeout(function () { + trigger("bookingCode.value") + }, 5000) + } } const closeIfOutside = useCallback( diff --git a/apps/scandic-web/components/HotelReservation/HotelCard/HotelPointsCard/index.tsx b/apps/scandic-web/components/HotelReservation/HotelCard/HotelPointsCard/index.tsx index a8ba871d5..55ab4d4a1 100644 --- a/apps/scandic-web/components/HotelReservation/HotelCard/HotelPointsCard/index.tsx +++ b/apps/scandic-web/components/HotelReservation/HotelCard/HotelPointsCard/index.tsx @@ -9,18 +9,21 @@ import type { PointsCardProps } from "@/types/components/hotelReservation/select export default function HotelPointsCard({ productTypePoints, + redemptionPrice, }: PointsCardProps) { const intl = useIntl() + const pointsPerStay = + productTypePoints?.localPrice.pricePerStay ?? redemptionPrice return (
- {productTypePoints.localPrice.pointsPerStay} + {pointsPerStay} {intl.formatMessage({ id: "Points" })} - {productTypePoints.localPrice.pricePerStay ? ( + {productTypePoints?.localPrice.pricePerStay ? ( <> + diff --git a/apps/scandic-web/components/HotelReservation/HotelCardDialog/ListingHotelCardDialog/index.tsx b/apps/scandic-web/components/HotelReservation/HotelCardDialog/ListingHotelCardDialog/index.tsx index 8054f8066..f2be198d7 100644 --- a/apps/scandic-web/components/HotelReservation/HotelCardDialog/ListingHotelCardDialog/index.tsx +++ b/apps/scandic-web/components/HotelReservation/HotelCardDialog/ListingHotelCardDialog/index.tsx @@ -11,6 +11,7 @@ import Caption from "@/components/TempDesignSystem/Text/Caption" import Subtitle from "@/components/TempDesignSystem/Text/Subtitle" import { isValidClientSession } from "@/utils/clientSession" +import HotelPointsCard from "../../HotelCard/HotelPointsCard" import NoPriceAvailableCard from "../../HotelCard/NoPriceAvailableCard" import HotelCardDialogImage from "../HotelCardDialogImage" @@ -44,6 +45,7 @@ export default function ListingHotelCardDialog({ images, ratings, operaId, + redemptionPrice, } = data const firstImage = images[0]?.imageSizes?.small @@ -82,14 +84,20 @@ export default function ListingHotelCardDialog({
- {publicPrice || memberPrice ? ( + {publicPrice || memberPrice || redemptionPrice ? (
- - {intl.formatMessage({ id: "Per night from" })} - + {redemptionPrice ? ( + + {intl.formatMessage({ id: "Available rates" })} + + ) : ( + + {intl.formatMessage({ id: "Per night from" })} + + )}
- {publicPrice && !isUserLoggedIn && ( + {publicPrice && !isUserLoggedIn && memberPrice && ( <> {publicPrice} {currency} @@ -108,6 +116,9 @@ export default function ListingHotelCardDialog({ )} )} + {redemptionPrice && ( + + )}
- {publicPrice || memberPrice ? ( + {publicPrice || memberPrice || redemptionPrice ? ( <>
- - {intl.formatMessage({ id: "From" })} - + {redemptionPrice ? ( + + {intl.formatMessage({ id: "Available rates" })} + + ) : ( + + {intl.formatMessage({ id: "From" })} + + )} {publicPrice && !isUserLoggedIn && ( {intl.formatMessage( @@ -123,6 +131,9 @@ export default function StandaloneHotelCardDialog({ )} + {redemptionPrice && ( + + )}