@happychef/reservation-sidebar 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +202 -0
- package/dist/index.d.mts +199 -0
- package/dist/index.d.ts +199 -0
- package/dist/index.js +5311 -0
- package/dist/index.mjs +5293 -0
- package/package.json +58 -0
package/README.md
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
# @happychef/reservation-sidebar
|
|
2
|
+
|
|
3
|
+
A compound React component for managing restaurant reservations with a sidebar interface.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @happychef/reservation-sidebar
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- Complete reservation management UI with sidebar
|
|
14
|
+
- Guest selection and date/time picking
|
|
15
|
+
- Menu and staff assignment
|
|
16
|
+
- Giftcard selection support
|
|
17
|
+
- Seat/table assignment (terras/restaurant)
|
|
18
|
+
- Auto-fill customer information
|
|
19
|
+
- Multi-language support (NL/EN)
|
|
20
|
+
- TypeScript support with full type definitions
|
|
21
|
+
- Both ESM and CJS module formats
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
### Important: Styling Setup
|
|
26
|
+
|
|
27
|
+
The component styles are scoped under `.new-reservation-page` class and require CSS variables. Make sure to:
|
|
28
|
+
|
|
29
|
+
1. **Wrap your app** (or at least the component) with the `.new-reservation-page` class
|
|
30
|
+
2. **Define required CSS variables** in your app's CSS:
|
|
31
|
+
|
|
32
|
+
```css
|
|
33
|
+
:root {
|
|
34
|
+
--color-blue: #4CAF50;
|
|
35
|
+
--color-blue-hover-accent: #45a049;
|
|
36
|
+
--color-white: #ffffff;
|
|
37
|
+
--border-radius: 4px;
|
|
38
|
+
--z-index-sidebar-reservation: 1000;
|
|
39
|
+
--z-index-modal: 999;
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Basic Usage
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
import { ReservationSidebar } from '@happychef/reservation-sidebar';
|
|
47
|
+
import type { FormData, FormErrors } from '@happychef/reservation-sidebar';
|
|
48
|
+
|
|
49
|
+
function App() {
|
|
50
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
51
|
+
const [formData, setFormData] = useState<FormData>({
|
|
52
|
+
guests: 2,
|
|
53
|
+
date: '',
|
|
54
|
+
time: '',
|
|
55
|
+
firstName: '',
|
|
56
|
+
lastName: '',
|
|
57
|
+
email: '',
|
|
58
|
+
phone: '',
|
|
59
|
+
extraInfo: '',
|
|
60
|
+
menu: '',
|
|
61
|
+
personeel: '',
|
|
62
|
+
giftcard: '',
|
|
63
|
+
zitplaats: '',
|
|
64
|
+
selectedTableNumbers: [],
|
|
65
|
+
selectedTableIds: [],
|
|
66
|
+
reservationMode: 'met_limieten',
|
|
67
|
+
});
|
|
68
|
+
const [errors, setErrors] = useState<FormErrors>({});
|
|
69
|
+
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
70
|
+
const [reservationSubmitted, setReservationSubmitted] = useState(false);
|
|
71
|
+
|
|
72
|
+
const handleChange = (e) => {
|
|
73
|
+
setFormData({ ...formData, [e.target.name]: e.target.value });
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const handleFinalSubmit = async () => {
|
|
77
|
+
setIsSubmitting(true);
|
|
78
|
+
// Submit logic here
|
|
79
|
+
setIsSubmitting(false);
|
|
80
|
+
setReservationSubmitted(true);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const handleNewReservation = () => {
|
|
84
|
+
setReservationSubmitted(false);
|
|
85
|
+
// Reset form
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<div className="new-reservation-page">
|
|
90
|
+
<button onClick={() => setIsOpen(true)}>Open Reservation</button>
|
|
91
|
+
<ReservationSidebar
|
|
92
|
+
isOpen={isOpen}
|
|
93
|
+
onClose={() => setIsOpen(false)}
|
|
94
|
+
formData={formData}
|
|
95
|
+
errors={errors}
|
|
96
|
+
handleChange={handleChange}
|
|
97
|
+
handleFinalSubmit={handleFinalSubmit}
|
|
98
|
+
setFormData={setFormData}
|
|
99
|
+
isSubmitting={isSubmitting}
|
|
100
|
+
reservationSubmitted={reservationSubmitted}
|
|
101
|
+
onNewReservation={handleNewReservation}
|
|
102
|
+
apiBaseDomain="https://happychef.cloud/"
|
|
103
|
+
/>
|
|
104
|
+
</div>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Sub-components
|
|
110
|
+
|
|
111
|
+
You can also use individual sub-components:
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
import {
|
|
115
|
+
FormField,
|
|
116
|
+
GiftcardSelection,
|
|
117
|
+
ZitplaatsSelection,
|
|
118
|
+
ReservationStepTwo,
|
|
119
|
+
ReservationSummary,
|
|
120
|
+
} from '@happychef/reservation-sidebar';
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## API Configuration
|
|
124
|
+
|
|
125
|
+
### Setting the API Base Domain
|
|
126
|
+
|
|
127
|
+
You can configure the API base domain in two ways:
|
|
128
|
+
|
|
129
|
+
**Method 1: Via Component Prop (Recommended)**
|
|
130
|
+
```tsx
|
|
131
|
+
<ReservationSidebar
|
|
132
|
+
apiBaseDomain="https://happychef.cloud/"
|
|
133
|
+
// ... other props
|
|
134
|
+
/>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**Method 2: Via window.baseDomain**
|
|
138
|
+
```tsx
|
|
139
|
+
// Set before rendering the component
|
|
140
|
+
(window as any).baseDomain = 'https://happychef.cloud/';
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### API Endpoints
|
|
144
|
+
|
|
145
|
+
The component expects the following API endpoints to be available:
|
|
146
|
+
|
|
147
|
+
- `GET {baseDomain}api/auth-restaurant/` - Restaurant configuration, timeblocks, menu
|
|
148
|
+
- `GET {baseDomain}api/personeel` - Staff/personnel data
|
|
149
|
+
- `POST {baseDomain}api/autofill` - Customer autofill by email/phone
|
|
150
|
+
- `GET {baseDomain}api/slots/{restaurantId}/{beginDate}/{endDate}` - Reservation slots (for table assignment)
|
|
151
|
+
|
|
152
|
+
## Important Notes
|
|
153
|
+
|
|
154
|
+
### ReservationStepOne Component
|
|
155
|
+
|
|
156
|
+
The `ReservationStepOne` component in this package is currently a **placeholder implementation**. The full implementation requires:
|
|
157
|
+
|
|
158
|
+
1. **@happychef/algorithm** package - for table availability calculations
|
|
159
|
+
2. **Multiple complex sub-components**:
|
|
160
|
+
- Calendar
|
|
161
|
+
- DateSelector
|
|
162
|
+
- TimeSelector
|
|
163
|
+
- TableSelector
|
|
164
|
+
- ValueSelector
|
|
165
|
+
|
|
166
|
+
To use the full date/time selection functionality, you'll need to:
|
|
167
|
+
- Install the `@happychef/algorithm` package
|
|
168
|
+
- Copy the complete StepOne implementation from the source repository
|
|
169
|
+
- Ensure all sub-components are properly integrated
|
|
170
|
+
|
|
171
|
+
The current placeholder provides basic input fields for guests, date, and time.
|
|
172
|
+
|
|
173
|
+
## TypeScript
|
|
174
|
+
|
|
175
|
+
Full TypeScript support is included with comprehensive type definitions.
|
|
176
|
+
|
|
177
|
+
```tsx
|
|
178
|
+
import type {
|
|
179
|
+
FormData,
|
|
180
|
+
FormErrors,
|
|
181
|
+
ReservationSidebarProps,
|
|
182
|
+
RestaurantData,
|
|
183
|
+
MenuData,
|
|
184
|
+
Timeblock,
|
|
185
|
+
} from '@happychef/reservation-sidebar';
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Dependencies
|
|
189
|
+
|
|
190
|
+
### Peer Dependencies
|
|
191
|
+
- react >=16.8.0
|
|
192
|
+
- react-dom >=16.8.0
|
|
193
|
+
|
|
194
|
+
### Required Dependencies
|
|
195
|
+
- axios
|
|
196
|
+
- lottie-react
|
|
197
|
+
- moment-timezone
|
|
198
|
+
- react-icons
|
|
199
|
+
|
|
200
|
+
## License
|
|
201
|
+
|
|
202
|
+
MIT
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import React$1 from 'react';
|
|
2
|
+
import { AxiosRequestConfig } from 'axios';
|
|
3
|
+
|
|
4
|
+
interface FormData {
|
|
5
|
+
guests: number;
|
|
6
|
+
date: string;
|
|
7
|
+
time: string;
|
|
8
|
+
firstName: string;
|
|
9
|
+
lastName: string;
|
|
10
|
+
email: string;
|
|
11
|
+
phone: string;
|
|
12
|
+
extraInfo: string;
|
|
13
|
+
menu: string;
|
|
14
|
+
personeel: string;
|
|
15
|
+
giftcard: string;
|
|
16
|
+
zitplaats: string;
|
|
17
|
+
selectedTableNumbers: number[];
|
|
18
|
+
selectedTableIds: string[];
|
|
19
|
+
reservationMode: string;
|
|
20
|
+
}
|
|
21
|
+
interface FormErrors {
|
|
22
|
+
guests?: string;
|
|
23
|
+
date?: string;
|
|
24
|
+
time?: string;
|
|
25
|
+
firstName?: string;
|
|
26
|
+
lastName?: string;
|
|
27
|
+
email?: string;
|
|
28
|
+
phone?: string;
|
|
29
|
+
menu?: string;
|
|
30
|
+
personeel?: string;
|
|
31
|
+
[key: string]: string | undefined;
|
|
32
|
+
}
|
|
33
|
+
interface ReservationSidebarProps {
|
|
34
|
+
isOpen: boolean;
|
|
35
|
+
onClose: () => void;
|
|
36
|
+
formData: FormData;
|
|
37
|
+
errors: FormErrors;
|
|
38
|
+
handleChange: (e: React.ChangeEvent<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>) => void;
|
|
39
|
+
handleFinalSubmit: () => void;
|
|
40
|
+
setFormData: React.Dispatch<React.SetStateAction<FormData>>;
|
|
41
|
+
isSubmitting: boolean;
|
|
42
|
+
reservationSubmitted: boolean;
|
|
43
|
+
onNewReservation: () => void;
|
|
44
|
+
apiBaseDomain?: string;
|
|
45
|
+
}
|
|
46
|
+
interface Timeblock {
|
|
47
|
+
id: string;
|
|
48
|
+
startTime: string;
|
|
49
|
+
endTime: string;
|
|
50
|
+
capacity: number;
|
|
51
|
+
[key: string]: any;
|
|
52
|
+
}
|
|
53
|
+
interface MenuData {
|
|
54
|
+
name: string;
|
|
55
|
+
startDate: string;
|
|
56
|
+
endDate: string;
|
|
57
|
+
startHour: string;
|
|
58
|
+
endHour: string;
|
|
59
|
+
daysOfWeek: string[];
|
|
60
|
+
[key: string]: any;
|
|
61
|
+
}
|
|
62
|
+
interface RestaurantData {
|
|
63
|
+
timeblocks?: Timeblock[];
|
|
64
|
+
menu?: MenuData[];
|
|
65
|
+
'general-settings'?: {
|
|
66
|
+
seatSelectionEnabled?: boolean;
|
|
67
|
+
[key: string]: any;
|
|
68
|
+
};
|
|
69
|
+
'table-settings'?: {
|
|
70
|
+
isInstalled?: boolean;
|
|
71
|
+
assignmentMode?: string;
|
|
72
|
+
[key: string]: any;
|
|
73
|
+
};
|
|
74
|
+
floors?: Floor[];
|
|
75
|
+
[key: string]: any;
|
|
76
|
+
}
|
|
77
|
+
interface Floor {
|
|
78
|
+
tables: Table[];
|
|
79
|
+
[key: string]: any;
|
|
80
|
+
}
|
|
81
|
+
interface Table {
|
|
82
|
+
zitplaats?: string;
|
|
83
|
+
number?: number;
|
|
84
|
+
id?: string;
|
|
85
|
+
[key: string]: any;
|
|
86
|
+
}
|
|
87
|
+
interface Personeel {
|
|
88
|
+
voornaam: string;
|
|
89
|
+
achternaam: string;
|
|
90
|
+
startDate: string;
|
|
91
|
+
endDate: string;
|
|
92
|
+
[key: string]: any;
|
|
93
|
+
}
|
|
94
|
+
interface SelectOption {
|
|
95
|
+
value: string;
|
|
96
|
+
label: string;
|
|
97
|
+
}
|
|
98
|
+
interface FormFieldProps {
|
|
99
|
+
label: string;
|
|
100
|
+
name: string;
|
|
101
|
+
type?: 'text' | 'email' | 'tel' | 'textarea' | 'select';
|
|
102
|
+
icon?: React.ComponentType<{
|
|
103
|
+
className?: string;
|
|
104
|
+
}>;
|
|
105
|
+
value: string;
|
|
106
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>) => void;
|
|
107
|
+
onBlur?: () => void;
|
|
108
|
+
error?: string;
|
|
109
|
+
placeholder?: string;
|
|
110
|
+
halfWidth?: boolean;
|
|
111
|
+
options?: SelectOption[];
|
|
112
|
+
selectPlaceholder?: string;
|
|
113
|
+
rightIcon?: React.ComponentType<{
|
|
114
|
+
className?: string;
|
|
115
|
+
style?: React.CSSProperties;
|
|
116
|
+
}>;
|
|
117
|
+
onRightIconClick?: () => void;
|
|
118
|
+
tooltipContent?: React.ReactNode;
|
|
119
|
+
}
|
|
120
|
+
interface GiftcardSelectionProps {
|
|
121
|
+
restaurantData: RestaurantData;
|
|
122
|
+
formData: FormData;
|
|
123
|
+
handleChange: (e: React.ChangeEvent<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>) => void;
|
|
124
|
+
resetFormDataFields: (fields: string[]) => void;
|
|
125
|
+
}
|
|
126
|
+
interface ZitplaatsSelectionProps {
|
|
127
|
+
restaurantData: RestaurantData;
|
|
128
|
+
formData: FormData;
|
|
129
|
+
handleChange: (e: React.ChangeEvent<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>) => void;
|
|
130
|
+
resetFormDataFields: (fields: string[]) => void;
|
|
131
|
+
}
|
|
132
|
+
interface ReservationStepOneProps {
|
|
133
|
+
formData: FormData;
|
|
134
|
+
errors: FormErrors;
|
|
135
|
+
handleChange: (e: React.ChangeEvent<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>) => void;
|
|
136
|
+
setFormData: React.Dispatch<React.SetStateAction<FormData>>;
|
|
137
|
+
timeblocks: Timeblock[];
|
|
138
|
+
loadingTimeblocks: boolean;
|
|
139
|
+
timeblocksError: Error | null;
|
|
140
|
+
restaurantData: RestaurantData;
|
|
141
|
+
}
|
|
142
|
+
interface ReservationStepTwoProps {
|
|
143
|
+
formData: FormData;
|
|
144
|
+
errors: FormErrors;
|
|
145
|
+
handleChange: (e: React.ChangeEvent<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>) => void;
|
|
146
|
+
setFormData: React.Dispatch<React.SetStateAction<FormData>>;
|
|
147
|
+
isSubmitting: boolean;
|
|
148
|
+
menuData: MenuData[];
|
|
149
|
+
}
|
|
150
|
+
interface ReservationSummaryProps {
|
|
151
|
+
formData: FormData;
|
|
152
|
+
onNewReservation: () => void;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
declare const ReservationSidebar: React$1.FC<ReservationSidebarProps>;
|
|
156
|
+
|
|
157
|
+
declare const FormField: React$1.FC<FormFieldProps>;
|
|
158
|
+
|
|
159
|
+
declare const GiftcardSelection: React$1.FC<GiftcardSelectionProps>;
|
|
160
|
+
|
|
161
|
+
declare const ZitplaatsSelection: React$1.FC<ZitplaatsSelectionProps>;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Placeholder for ReservationStepOne component
|
|
165
|
+
*
|
|
166
|
+
* This component has complex dependencies on:
|
|
167
|
+
* - @happychef/algorithm package for table availability
|
|
168
|
+
* - Multiple sub-components (Calendar, DateSelector, TimeSelector, TableSelector, ValueSelector)
|
|
169
|
+
* - Complex reservation logic
|
|
170
|
+
*
|
|
171
|
+
* To implement this component fully:
|
|
172
|
+
* 1. Install @happychef/algorithm package
|
|
173
|
+
* 2. Copy the sub-components from StepOne directory
|
|
174
|
+
* 3. Implement the full logic from the source repository
|
|
175
|
+
*
|
|
176
|
+
* For now, this is a placeholder that maintains the interface.
|
|
177
|
+
*/
|
|
178
|
+
declare const ReservationStepOne: React$1.FC<ReservationStepOneProps>;
|
|
179
|
+
|
|
180
|
+
declare const ReservationStepTwo: React$1.FC<ReservationStepTwoProps>;
|
|
181
|
+
|
|
182
|
+
declare const ReservationSummary: React$1.FC<ReservationSummaryProps>;
|
|
183
|
+
|
|
184
|
+
interface ApiConfig extends AxiosRequestConfig {
|
|
185
|
+
noCache?: boolean;
|
|
186
|
+
}
|
|
187
|
+
interface ApiMethods {
|
|
188
|
+
get: (endpoint: string, config?: ApiConfig) => Promise<any>;
|
|
189
|
+
post: (endpoint: string, data?: any, config?: AxiosRequestConfig) => Promise<any>;
|
|
190
|
+
put: (endpoint: string, data?: any, config?: AxiosRequestConfig) => Promise<any>;
|
|
191
|
+
patch: (endpoint: string, data?: any, config?: AxiosRequestConfig) => Promise<any>;
|
|
192
|
+
delete: (endpoint: string, config?: AxiosRequestConfig) => Promise<any>;
|
|
193
|
+
}
|
|
194
|
+
declare const useApi: () => ApiMethods;
|
|
195
|
+
|
|
196
|
+
declare const getPreferredLanguage: () => string;
|
|
197
|
+
declare const getSection: (translationsObj: Record<string, any>, sectionKey: string, fallbackLang?: string) => Record<string, any>;
|
|
198
|
+
|
|
199
|
+
export { type Floor, type FormData, type FormErrors, FormField, type FormFieldProps, GiftcardSelection, type GiftcardSelectionProps, type MenuData, type Personeel, ReservationSidebar, type ReservationSidebarProps, ReservationStepOne, type ReservationStepOneProps, ReservationStepTwo, type ReservationStepTwoProps, ReservationSummary, type ReservationSummaryProps, type RestaurantData, type SelectOption, type Table, type Timeblock, ZitplaatsSelection, type ZitplaatsSelectionProps, getPreferredLanguage, getSection, useApi };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import React$1 from 'react';
|
|
2
|
+
import { AxiosRequestConfig } from 'axios';
|
|
3
|
+
|
|
4
|
+
interface FormData {
|
|
5
|
+
guests: number;
|
|
6
|
+
date: string;
|
|
7
|
+
time: string;
|
|
8
|
+
firstName: string;
|
|
9
|
+
lastName: string;
|
|
10
|
+
email: string;
|
|
11
|
+
phone: string;
|
|
12
|
+
extraInfo: string;
|
|
13
|
+
menu: string;
|
|
14
|
+
personeel: string;
|
|
15
|
+
giftcard: string;
|
|
16
|
+
zitplaats: string;
|
|
17
|
+
selectedTableNumbers: number[];
|
|
18
|
+
selectedTableIds: string[];
|
|
19
|
+
reservationMode: string;
|
|
20
|
+
}
|
|
21
|
+
interface FormErrors {
|
|
22
|
+
guests?: string;
|
|
23
|
+
date?: string;
|
|
24
|
+
time?: string;
|
|
25
|
+
firstName?: string;
|
|
26
|
+
lastName?: string;
|
|
27
|
+
email?: string;
|
|
28
|
+
phone?: string;
|
|
29
|
+
menu?: string;
|
|
30
|
+
personeel?: string;
|
|
31
|
+
[key: string]: string | undefined;
|
|
32
|
+
}
|
|
33
|
+
interface ReservationSidebarProps {
|
|
34
|
+
isOpen: boolean;
|
|
35
|
+
onClose: () => void;
|
|
36
|
+
formData: FormData;
|
|
37
|
+
errors: FormErrors;
|
|
38
|
+
handleChange: (e: React.ChangeEvent<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>) => void;
|
|
39
|
+
handleFinalSubmit: () => void;
|
|
40
|
+
setFormData: React.Dispatch<React.SetStateAction<FormData>>;
|
|
41
|
+
isSubmitting: boolean;
|
|
42
|
+
reservationSubmitted: boolean;
|
|
43
|
+
onNewReservation: () => void;
|
|
44
|
+
apiBaseDomain?: string;
|
|
45
|
+
}
|
|
46
|
+
interface Timeblock {
|
|
47
|
+
id: string;
|
|
48
|
+
startTime: string;
|
|
49
|
+
endTime: string;
|
|
50
|
+
capacity: number;
|
|
51
|
+
[key: string]: any;
|
|
52
|
+
}
|
|
53
|
+
interface MenuData {
|
|
54
|
+
name: string;
|
|
55
|
+
startDate: string;
|
|
56
|
+
endDate: string;
|
|
57
|
+
startHour: string;
|
|
58
|
+
endHour: string;
|
|
59
|
+
daysOfWeek: string[];
|
|
60
|
+
[key: string]: any;
|
|
61
|
+
}
|
|
62
|
+
interface RestaurantData {
|
|
63
|
+
timeblocks?: Timeblock[];
|
|
64
|
+
menu?: MenuData[];
|
|
65
|
+
'general-settings'?: {
|
|
66
|
+
seatSelectionEnabled?: boolean;
|
|
67
|
+
[key: string]: any;
|
|
68
|
+
};
|
|
69
|
+
'table-settings'?: {
|
|
70
|
+
isInstalled?: boolean;
|
|
71
|
+
assignmentMode?: string;
|
|
72
|
+
[key: string]: any;
|
|
73
|
+
};
|
|
74
|
+
floors?: Floor[];
|
|
75
|
+
[key: string]: any;
|
|
76
|
+
}
|
|
77
|
+
interface Floor {
|
|
78
|
+
tables: Table[];
|
|
79
|
+
[key: string]: any;
|
|
80
|
+
}
|
|
81
|
+
interface Table {
|
|
82
|
+
zitplaats?: string;
|
|
83
|
+
number?: number;
|
|
84
|
+
id?: string;
|
|
85
|
+
[key: string]: any;
|
|
86
|
+
}
|
|
87
|
+
interface Personeel {
|
|
88
|
+
voornaam: string;
|
|
89
|
+
achternaam: string;
|
|
90
|
+
startDate: string;
|
|
91
|
+
endDate: string;
|
|
92
|
+
[key: string]: any;
|
|
93
|
+
}
|
|
94
|
+
interface SelectOption {
|
|
95
|
+
value: string;
|
|
96
|
+
label: string;
|
|
97
|
+
}
|
|
98
|
+
interface FormFieldProps {
|
|
99
|
+
label: string;
|
|
100
|
+
name: string;
|
|
101
|
+
type?: 'text' | 'email' | 'tel' | 'textarea' | 'select';
|
|
102
|
+
icon?: React.ComponentType<{
|
|
103
|
+
className?: string;
|
|
104
|
+
}>;
|
|
105
|
+
value: string;
|
|
106
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>) => void;
|
|
107
|
+
onBlur?: () => void;
|
|
108
|
+
error?: string;
|
|
109
|
+
placeholder?: string;
|
|
110
|
+
halfWidth?: boolean;
|
|
111
|
+
options?: SelectOption[];
|
|
112
|
+
selectPlaceholder?: string;
|
|
113
|
+
rightIcon?: React.ComponentType<{
|
|
114
|
+
className?: string;
|
|
115
|
+
style?: React.CSSProperties;
|
|
116
|
+
}>;
|
|
117
|
+
onRightIconClick?: () => void;
|
|
118
|
+
tooltipContent?: React.ReactNode;
|
|
119
|
+
}
|
|
120
|
+
interface GiftcardSelectionProps {
|
|
121
|
+
restaurantData: RestaurantData;
|
|
122
|
+
formData: FormData;
|
|
123
|
+
handleChange: (e: React.ChangeEvent<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>) => void;
|
|
124
|
+
resetFormDataFields: (fields: string[]) => void;
|
|
125
|
+
}
|
|
126
|
+
interface ZitplaatsSelectionProps {
|
|
127
|
+
restaurantData: RestaurantData;
|
|
128
|
+
formData: FormData;
|
|
129
|
+
handleChange: (e: React.ChangeEvent<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>) => void;
|
|
130
|
+
resetFormDataFields: (fields: string[]) => void;
|
|
131
|
+
}
|
|
132
|
+
interface ReservationStepOneProps {
|
|
133
|
+
formData: FormData;
|
|
134
|
+
errors: FormErrors;
|
|
135
|
+
handleChange: (e: React.ChangeEvent<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>) => void;
|
|
136
|
+
setFormData: React.Dispatch<React.SetStateAction<FormData>>;
|
|
137
|
+
timeblocks: Timeblock[];
|
|
138
|
+
loadingTimeblocks: boolean;
|
|
139
|
+
timeblocksError: Error | null;
|
|
140
|
+
restaurantData: RestaurantData;
|
|
141
|
+
}
|
|
142
|
+
interface ReservationStepTwoProps {
|
|
143
|
+
formData: FormData;
|
|
144
|
+
errors: FormErrors;
|
|
145
|
+
handleChange: (e: React.ChangeEvent<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>) => void;
|
|
146
|
+
setFormData: React.Dispatch<React.SetStateAction<FormData>>;
|
|
147
|
+
isSubmitting: boolean;
|
|
148
|
+
menuData: MenuData[];
|
|
149
|
+
}
|
|
150
|
+
interface ReservationSummaryProps {
|
|
151
|
+
formData: FormData;
|
|
152
|
+
onNewReservation: () => void;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
declare const ReservationSidebar: React$1.FC<ReservationSidebarProps>;
|
|
156
|
+
|
|
157
|
+
declare const FormField: React$1.FC<FormFieldProps>;
|
|
158
|
+
|
|
159
|
+
declare const GiftcardSelection: React$1.FC<GiftcardSelectionProps>;
|
|
160
|
+
|
|
161
|
+
declare const ZitplaatsSelection: React$1.FC<ZitplaatsSelectionProps>;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Placeholder for ReservationStepOne component
|
|
165
|
+
*
|
|
166
|
+
* This component has complex dependencies on:
|
|
167
|
+
* - @happychef/algorithm package for table availability
|
|
168
|
+
* - Multiple sub-components (Calendar, DateSelector, TimeSelector, TableSelector, ValueSelector)
|
|
169
|
+
* - Complex reservation logic
|
|
170
|
+
*
|
|
171
|
+
* To implement this component fully:
|
|
172
|
+
* 1. Install @happychef/algorithm package
|
|
173
|
+
* 2. Copy the sub-components from StepOne directory
|
|
174
|
+
* 3. Implement the full logic from the source repository
|
|
175
|
+
*
|
|
176
|
+
* For now, this is a placeholder that maintains the interface.
|
|
177
|
+
*/
|
|
178
|
+
declare const ReservationStepOne: React$1.FC<ReservationStepOneProps>;
|
|
179
|
+
|
|
180
|
+
declare const ReservationStepTwo: React$1.FC<ReservationStepTwoProps>;
|
|
181
|
+
|
|
182
|
+
declare const ReservationSummary: React$1.FC<ReservationSummaryProps>;
|
|
183
|
+
|
|
184
|
+
interface ApiConfig extends AxiosRequestConfig {
|
|
185
|
+
noCache?: boolean;
|
|
186
|
+
}
|
|
187
|
+
interface ApiMethods {
|
|
188
|
+
get: (endpoint: string, config?: ApiConfig) => Promise<any>;
|
|
189
|
+
post: (endpoint: string, data?: any, config?: AxiosRequestConfig) => Promise<any>;
|
|
190
|
+
put: (endpoint: string, data?: any, config?: AxiosRequestConfig) => Promise<any>;
|
|
191
|
+
patch: (endpoint: string, data?: any, config?: AxiosRequestConfig) => Promise<any>;
|
|
192
|
+
delete: (endpoint: string, config?: AxiosRequestConfig) => Promise<any>;
|
|
193
|
+
}
|
|
194
|
+
declare const useApi: () => ApiMethods;
|
|
195
|
+
|
|
196
|
+
declare const getPreferredLanguage: () => string;
|
|
197
|
+
declare const getSection: (translationsObj: Record<string, any>, sectionKey: string, fallbackLang?: string) => Record<string, any>;
|
|
198
|
+
|
|
199
|
+
export { type Floor, type FormData, type FormErrors, FormField, type FormFieldProps, GiftcardSelection, type GiftcardSelectionProps, type MenuData, type Personeel, ReservationSidebar, type ReservationSidebarProps, ReservationStepOne, type ReservationStepOneProps, ReservationStepTwo, type ReservationStepTwoProps, ReservationSummary, type ReservationSummaryProps, type RestaurantData, type SelectOption, type Table, type Timeblock, ZitplaatsSelection, type ZitplaatsSelectionProps, getPreferredLanguage, getSection, useApi };
|