diff --git a/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-rate/page.tsx b/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-rate/page.tsx index fd9db4d6c..f8632f938 100644 --- a/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-rate/page.tsx +++ b/app/[lang]/(live)/(public)/hotelreservation/(standard)/select-rate/page.tsx @@ -108,7 +108,7 @@ export default async function SelectRatePage({ roomsAvailability={roomsAvailability} roomCategories={roomCategories ?? []} user={user} - packages={packages ?? []} + availablePackages={packages ?? []} /> ) diff --git a/components/HotelReservation/SelectRate/RoomFilter/index.tsx b/components/HotelReservation/SelectRate/RoomFilter/index.tsx index a07e8353f..2620d3efe 100644 --- a/components/HotelReservation/SelectRate/RoomFilter/index.tsx +++ b/components/HotelReservation/SelectRate/RoomFilter/index.tsx @@ -26,6 +26,7 @@ export default function RoomFilter({ onFilter, filterOptions, }: RoomFilterProps) { + console.log(filterOptions) const initialFilterValues = useMemo( () => filterOptions.reduce( diff --git a/components/HotelReservation/SelectRate/RoomSelection/index.tsx b/components/HotelReservation/SelectRate/RoomSelection/index.tsx index b3624552f..75759459f 100644 --- a/components/HotelReservation/SelectRate/RoomSelection/index.tsx +++ b/components/HotelReservation/SelectRate/RoomSelection/index.tsx @@ -14,7 +14,7 @@ export default function RoomSelection({ roomsAvailability, roomCategories, user, - packages, + availablePackages, selectedPackages, setRateSummary, rateSummary, @@ -72,7 +72,7 @@ export default function RoomSelection({ roomCategories={roomCategories} handleSelectRate={setRateSummary} selectedPackages={selectedPackages} - packages={packages} + packages={availablePackages} /> ))} @@ -81,7 +81,7 @@ export default function RoomSelection({ )} diff --git a/components/HotelReservation/SelectRate/Rooms/index.tsx b/components/HotelReservation/SelectRate/Rooms/index.tsx index 626664988..06e0d954d 100644 --- a/components/HotelReservation/SelectRate/Rooms/index.tsx +++ b/components/HotelReservation/SelectRate/Rooms/index.tsx @@ -11,6 +11,7 @@ import { filterDuplicateRoomTypesByLowestPrice } from "./utils" import styles from "./rooms.module.css" import { + DefaultFilterOptions, RoomPackageCodeEnum, type RoomPackageCodes, } from "@/types/components/hotelReservation/selectRate/roomFilter" @@ -25,8 +26,9 @@ export default function Rooms({ roomsAvailability, roomCategories = [], user, - packages, + availablePackages, }: SelectRateProps) { + console.log(availablePackages) const visibleRooms: RoomConfiguration[] = filterDuplicateRoomTypesByLowestPrice(roomsAvailability.roomConfigurations) const [rateSummary, setRateSummary] = useState(null) @@ -47,6 +49,15 @@ export default function Rooms({ (state) => state.setRoomsAvailable ) + const defaultPackages: DefaultFilterOptions[] = [ + { code: RoomPackageCodeEnum.PET_ROOM, description: "Pet friendly" }, + { code: RoomPackageCodeEnum.ALLERGY_ROOM, description: "Allergy friendly" }, + { + code: RoomPackageCodeEnum.ACCESSIBILITY_ROOM, + description: "Accessibility", + }, + ] + const handleFilter = useCallback( (filter: Record) => { const filteredPackages = Object.keys(filter).filter( @@ -104,7 +115,9 @@ export default function Rooms({ const petRoomPackage = (filteredPackages.includes(RoomPackageCodeEnum.PET_ROOM) && - packages.find((pkg) => pkg.code === RoomPackageCodeEnum.PET_ROOM)) || + availablePackages.find( + (pkg) => pkg.code === RoomPackageCodeEnum.PET_ROOM + )) || undefined const features = filteredRooms.find((room) => @@ -124,7 +137,7 @@ export default function Rooms({ roomsAvailability, visibleRooms, rateSummary, - packages, + availablePackages, noRoomsAvailable, setNoRoomsAvailable, setRoomsAvailable, @@ -136,13 +149,13 @@ export default function Rooms({ ) => void - filterOptions: RoomPackageData + filterOptions: DefaultFilterOptions[] } export type RoomPackage = z.output diff --git a/types/components/hotelReservation/selectRate/roomSelection.ts b/types/components/hotelReservation/selectRate/roomSelection.ts index 163bfd6fa..cd1e48775 100644 --- a/types/components/hotelReservation/selectRate/roomSelection.ts +++ b/types/components/hotelReservation/selectRate/roomSelection.ts @@ -8,7 +8,7 @@ export interface RoomSelectionProps { roomsAvailability: RoomsAvailability roomCategories: RoomData[] user: SafeUser - packages: RoomPackageData | undefined + availablePackages: RoomPackageData | undefined selectedPackages: RoomPackageCodes[] setRateSummary: (rateSummary: Rate) => void rateSummary: Rate | null @@ -18,5 +18,5 @@ export interface SelectRateProps { roomsAvailability: RoomsAvailability roomCategories: RoomData[] user: SafeUser - packages: RoomPackageData + availablePackages: RoomPackageData }