feat: SW-2028 Fixed review comments
This commit is contained in:
@@ -5,6 +5,7 @@ import type { BedTypeSchema } from "@/types/components/hotelReservation/enterDet
|
||||
import type { RoomPrice } from "@/types/components/hotelReservation/enterDetails/details"
|
||||
import type { PriceType } from "@/types/components/hotelReservation/myStay/myStay"
|
||||
import type { Child } from "@/types/components/hotelReservation/selectRate/selectRate"
|
||||
import { CurrencyEnum } from "@/types/enums/currency"
|
||||
import type { Packages } from "@/types/requests/packages"
|
||||
import type { BookingConfirmation } from "@/types/trpc/routers/booking/confirmation"
|
||||
|
||||
@@ -73,7 +74,7 @@ export const useMyStayRoomDetailsStore = create<MyStayRoomDetailsState>(
|
||||
bookingCode: null,
|
||||
cheques: 0,
|
||||
vouchers: 0,
|
||||
currencyCode: "",
|
||||
currencyCode: CurrencyEnum.Unknown,
|
||||
guest: {
|
||||
email: "",
|
||||
firstName: "",
|
||||
@@ -97,21 +98,21 @@ export const useMyStayRoomDetailsStore = create<MyStayRoomDetailsState>(
|
||||
perNight: {
|
||||
requested: {
|
||||
price: 0,
|
||||
currency: "",
|
||||
currency: CurrencyEnum.Unknown,
|
||||
},
|
||||
local: {
|
||||
price: 0,
|
||||
currency: "",
|
||||
currency: CurrencyEnum.Unknown,
|
||||
},
|
||||
},
|
||||
perStay: {
|
||||
requested: {
|
||||
price: 0,
|
||||
currency: "",
|
||||
currency: CurrencyEnum.Unknown,
|
||||
},
|
||||
local: {
|
||||
price: 0,
|
||||
currency: "",
|
||||
currency: CurrencyEnum.Unknown,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { create } from "zustand"
|
||||
|
||||
import { CurrencyEnum } from "@/types/enums/currency"
|
||||
|
||||
interface RoomPrice {
|
||||
id: string
|
||||
totalPrice: number
|
||||
currencyCode: string
|
||||
currencyCode: CurrencyEnum
|
||||
isMainBooking?: boolean
|
||||
roomPoints: number
|
||||
}
|
||||
@@ -11,7 +13,7 @@ interface RoomPrice {
|
||||
interface MyStayTotalPriceState {
|
||||
rooms: RoomPrice[]
|
||||
totalPrice: number | null
|
||||
currencyCode: string
|
||||
currencyCode: CurrencyEnum
|
||||
totalPoints: number
|
||||
actions: {
|
||||
// Add a single room price
|
||||
@@ -26,7 +28,7 @@ export const useMyStayTotalPriceStore = create<MyStayTotalPriceState>(
|
||||
totalPoints: 0,
|
||||
totalCheques: 0,
|
||||
totalVouchers: 0,
|
||||
currencyCode: "",
|
||||
currencyCode: CurrencyEnum.Unknown,
|
||||
actions: {
|
||||
addRoomPrice: (room) => {
|
||||
set((state) => {
|
||||
@@ -44,7 +46,7 @@ export const useMyStayTotalPriceStore = create<MyStayTotalPriceState>(
|
||||
|
||||
// Get currency from main booking or first room
|
||||
const mainRoom = newRooms.find((r) => r.isMainBooking) || newRooms[0]
|
||||
const currencyCode = mainRoom?.currencyCode || ""
|
||||
const currencyCode = mainRoom?.currencyCode ?? CurrencyEnum.Unknown
|
||||
|
||||
// Calculate total (only same currency for now)
|
||||
const total = newRooms.reduce((sum, r) => {
|
||||
|
||||
Reference in New Issue
Block a user