Merged in feat/sw-1681-add-breakfast (pull request #1635)
Feat/sw-1681 add breakfast This implements the add breakfast flow Approved-by: Pontus Dreij
This commit is contained in:
@@ -10,6 +10,7 @@ import type {
|
||||
Ancillary,
|
||||
SelectedAncillary,
|
||||
} from "@/types/components/myPages/myStay/ancillaries"
|
||||
import { BreakfastPackageEnum } from "@/types/enums/breakfast"
|
||||
import type { BookingConfirmation } from "@/types/trpc/routers/booking/confirmation"
|
||||
|
||||
export enum AncillaryStepEnum {
|
||||
@@ -29,6 +30,15 @@ type Steps = {
|
||||
[AncillaryStepEnum.confirmation]: Step
|
||||
}
|
||||
|
||||
export type BreakfastData = {
|
||||
nrOfAdults: number
|
||||
nrOfPayingChildren: number
|
||||
nrOfFreeChildren: number
|
||||
priceAdult: number
|
||||
priceChild: number
|
||||
currency: string
|
||||
}
|
||||
|
||||
export interface AddAncillaryState {
|
||||
currentStep: number
|
||||
steps: Steps
|
||||
@@ -41,6 +51,9 @@ export interface AddAncillaryState {
|
||||
openModal: VoidFunction
|
||||
closeModal: VoidFunction
|
||||
prevStep: VoidFunction
|
||||
breakfastData: BreakfastData | null
|
||||
setBreakfastData: (breakfastData: BreakfastData | null) => void
|
||||
isBreakfast: boolean
|
||||
isOpen: boolean
|
||||
selectedAncillary: SelectedAncillary | null
|
||||
selectAncillary: (ancillary: SelectedAncillary) => void
|
||||
@@ -95,6 +108,8 @@ export const createAddAncillaryStore = (
|
||||
ancillariesBySelectedCategory,
|
||||
currentStep: AncillaryStepEnum.selectAncillary,
|
||||
selectedAncillary: null,
|
||||
breakfastData: null,
|
||||
isBreakfast: false,
|
||||
isOpen: false,
|
||||
steps,
|
||||
openModal: () =>
|
||||
@@ -189,6 +204,14 @@ export const createAddAncillaryStore = (
|
||||
}
|
||||
state.selectedAncillary = ancillary
|
||||
state.currentStep = AncillaryStepEnum.selectQuantity
|
||||
state.isBreakfast =
|
||||
ancillary.id === BreakfastPackageEnum.ANCILLARY_REGULAR_BREAKFAST
|
||||
})
|
||||
),
|
||||
setBreakfastData: (breakfastData) =>
|
||||
set(
|
||||
produce((state: AddAncillaryState) => {
|
||||
state.breakfastData = breakfastData
|
||||
})
|
||||
),
|
||||
}))
|
||||
|
||||
Reference in New Issue
Block a user