@happychef/reservation-sidebar 2.8.43 → 2.8.45
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 -202
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +56 -56
package/README.md
CHANGED
|
@@ -1,202 +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
|
|
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.js
CHANGED
|
@@ -9,7 +9,7 @@ Checking Time: ${v} -> Determined Meal: ${B}`),!B){N0(` Time ${v} has no associ
|
|
|
9
9
|
`);var AA=({setGuests:b,value:c,onChange:q})=>{let e=[1,2,3,"4+"],[W,n]=o0.useState(c||""),[a,s]=o0.useState(false),r=u=>{u==="4+"?(s(true),n(4),b(4),q({target:{name:"guests",value:4}})):(s(false),n(u),b(u),q({target:{name:"guests",value:u}}));},R=u=>{let B=u.target.value;n(B),b(B),q({target:{name:"guests",value:B}});},v=u=>{let B=u.target.value;n(B),b(B),q({target:{name:"guests",value:B}});};return o0__default.default.createElement("div",{className:"value-selector",translate:"no"},o0__default.default.createElement("div",{className:"predefined-values"},e.map(u=>o0__default.default.createElement("button",{key:u,type:"button",className:`predefined-value-button ${W==u||u==="4+"&&a?"active":""}`,onClick:()=>r(u)},u==="4+"?"4+":`${u} p`))),o0__default.default.createElement(framerMotion.AnimatePresence,null,a&&o0__default.default.createElement(framerMotion.motion.div,{className:"slider-container",initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0}},o0__default.default.createElement("input",{type:"range",min:"4",max:"15",step:"1",value:W,onChange:R,className:"slider non-absolute"}),o0__default.default.createElement("input",{type:"number",name:"guests",value:W,onChange:v,className:"value-input",min:"4",max:"100",step:"1"}))))},d2=AA;var u1=P0(c1());var Ez=P0(c1()),kz=b=>{let c=(0, Ez.default)().tz("Europe/Brussels").startOf("day");return b.clone().add(6,"days").endOf("day").isBefore(c)},wz=(b,c)=>b.isSame(c,"day");R0(`.new-reservation-page .calendar-container{position:relative;width:100%}.new-reservation-page .calendar-container .calendar-display{display:flex;align-items:center;justify-content:space-between;width:100%;padding:10px;background-color:#fff;border:#ccc 1px solid;cursor:pointer;user-select:none;text-align:left;border-radius:5px}.new-reservation-page .calendar-container .calendar-display span:first-child{flex-grow:1}.new-reservation-page .calendar-container .calendar{position:absolute;z-index:1000;width:100%;background-color:#fff;border:1px solid #ccc;margin-top:5px;padding:10px;border-radius:10px;animation:fadeInCalendar .3s ease-in-out;box-shadow:0 2px 10px #0000001a}@keyframes fadeInCalendar{0%{opacity:0}to{opacity:1}}.new-reservation-page .calendar-container .availability-hold-btn{font-size:10px}.new-reservation-page .calendar-container .calendar-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;gap:8px;flex-wrap:wrap}.new-reservation-page .calendar-container .calendar-header button{background-color:transparent;border:none;cursor:pointer;font-size:18px}.new-reservation-page .calendar-container .calendar-header span{font-size:15px;color:gray;font-weight:500}.new-reservation-page .calendar-container .calendar-weeks-wrapper{overflow:hidden;position:relative;width:100%}.new-reservation-page .calendar-container .calendar-table{width:100%;border-collapse:collapse}.new-reservation-page .calendar-container .calendar-table th,.new-reservation-page .calendar-container .calendar-table td{width:14.28%;text-align:center;padding:5px}.calendar-container .calendar-table th{color:#666;font-weight:400;padding-bottom:10px}.new-reservation-page .calendar-container .calendar-table td{vertical-align:middle;cursor:pointer;border:none;opacity:1;position:relative}.new-reservation-page .calendar-container .calendar-table td.empty-day{cursor:default}.new-reservation-page .calendar-container .calendar-table td:hover .day-square.available{transform:scale(1.05)}.new-reservation-page .calendar-container .day-square{position:relative;width:38px;height:38px;border-radius:4px;display:inline-flex;align-items:center;justify-content:center;flex-direction:column;transition:all .2s ease;font-size:16px;margin:0 auto}.new-reservation-page .calendar-container .day-number{line-height:1;z-index:2}.new-reservation-page .calendar-container .available .day-square{background-color:#cfc;color:#060}.new-reservation-page .calendar-container .available:hover .day-square{background-color:#b3ffb3}.new-reservation-page .calendar-container .available:active .day-square{background-color:#9f9}.new-reservation-page .calendar-container .unavailable .day-square{background-color:#8b000021;color:#8b0000}.new-reservation-page .calendar-container .gray-out .day-square{background-color:#e0e0e0;color:#999;cursor:not-allowed}.new-reservation-page .calendar-container .selected .day-square{background-color:#060;color:#cfc}.new-reservation-page .calendar-container .has-blocked-slots .day-square{background-color:#8b000021;color:#8b0000}.new-reservation-page .calendar-container .has-blocked-slots:hover .day-square{background-color:#8b000033}.new-reservation-page .calendar-container .has-blocked-slots.selected .day-square{background-color:#8b0000;color:#fff}.new-reservation-page .calendar-container .calendar-table td.unavailable,.new-reservation-page .calendar-container .calendar-table td.gray-out{cursor:not-allowed}.new-reservation-page .calendar-container .calendar-table td.unavailable:hover .day-square,.new-reservation-page .calendar-container .calendar-table td.gray-out:hover .day-square{transform:none}.new-reservation-page .calendar-container .calendar-table td{border:none}.new-reservation-page .calendar-container .arrow{margin-left:auto;color:gray;display:flex;align-items:center}.new-reservation-page .calendar-container .available .availability-badge{background:#38a169}.new-reservation-page .calendar-container .selected .availability-badge{background:#2d3748}@media screen and (max-width:900px){.calendar-container .day-square{width:35px!important;height:35px!important;font-size:15px!important}.calendar-container .calendar-header span{font-size:12px}.new-reservation-page .calendar-container .availability-toggle-btn{padding:5px 8px;font-size:11px}}
|
|
10
10
|
`);var d1=P0(Y1());var XM=class{constructor(c=6e4){this.cache=new Map,this.ttl=c;}generateKey(c,...q){return `${c}::${JSON.stringify(q)}`}get(c){let q=this.cache.get(c);return q?Date.now()-q.timestamp>this.ttl?(this.cache.delete(c),null):q.value:null}set(c,q){this.cache.set(c,{value:q,timestamp:Date.now()});}clear(){this.cache.clear();}cleanup(){let c=Date.now();for(let[q,e]of this.cache.entries())c-e.timestamp>this.ttl&&this.cache.delete(q);}},T2=new XM;setInterval(()=>T2.cleanup(),3e4);var F0=(b,c,...q)=>{let e=T2.generateKey(b,...q),W=T2.get(e);if(W!==null)return W;let n=c(...q);return T2.set(e,n),n};var a1={nl:{reservationStepOne:{errors:{openingHoursNotSet:"Openingstijden niet ingesteld.",clickHereToSet:"Klik hier om uw openingsuren in te stellen."},modes:{withLimits:"Met Limieten",unlimited:"Onbeperkt",openingHours:"Openingsuren",free:"Vrij"},fields:{time:"Tijd"},messages:{searchingTables:"Beschikbare tafels zoeken...",noTablesAvailable:"Geen specifieke tafels beschikbaar voor deze selectie."},warnings:{unlimitedMode:"Onbeperkt zal geen rekening houden met maximum limieten.",dateNotAvailableWithLimits:"Let op: deze datum is niet beschikbaar met limieten voor dit aantal gasten. De modus is automatisch overgezet naar onbeperkt vrij."}},calendar:{selectDatePlaceholder:"Selecteer een datum",today:"Vandaag",tomorrow:"Morgen",prevWeek:"Vorige week",nextWeek:"Volgende week",dayHeaders:["Ma","Di","Wo","Do","Vr","Za","Zo"],seatsQuestion:"Zitplaatsen?"},timeSelector:{shifts:{breakfast:"Ontbijt",lunch:"Lunch",dinner:"Diner"},selectMeal:"Selecteer een maaltijd",selectTime:"Selecteer een tijd",noDateSelected:"Selecteer eerst een datum.",noTimes:"Geen beschikbare tijden.",back:"Terug",reservations:"Reservaties",guests:"Gasten"},tableSelector:{label:"Selecteer beschikbare tafel(s):",table:"Tafel",max:"Max",noTables:"Geen specifieke tafels beschikbaar voor deze tijd/gasten combinatie.",manual:"Handmatig"}},en:{reservationStepOne:{errors:{openingHoursNotSet:"Opening hours not set.",clickHereToSet:"Click here to set your opening hours."},modes:{withLimits:"With Limits",unlimited:"Unlimited",openingHours:"Opening Hours",free:"Free"},fields:{time:"Time"},messages:{searchingTables:"Searching for available tables...",noTablesAvailable:"No specific tables available for this selection."},warnings:{unlimitedMode:"Unlimited will not take into account maximum limits.",dateNotAvailableWithLimits:"Note: this date is not available with limits for this number of guests. The mode has been automatically switched to unlimited free."}},calendar:{selectDatePlaceholder:"Select a date",today:"Today",tomorrow:"Tomorrow",prevWeek:"Previous week",nextWeek:"Next week",dayHeaders:["M","T","W","T","F","S","S"],seatsQuestion:"Seating?"},timeSelector:{shifts:{breakfast:"Breakfast",lunch:"Lunch",dinner:"Dinner"},selectMeal:"Select a meal",selectTime:"Select a time",noDateSelected:"Please select a date first.",noTimes:"No available times.",back:"Back",reservations:"Reservations",guests:"Guests"},tableSelector:{label:"Select available table(s):",table:"Table",max:"Max",noTables:"No specific tables available for this time/guest combination.",manual:"Manual"}},fr:{reservationStepOne:{errors:{openingHoursNotSet:"Horaires non d\xE9finies.",clickHereToSet:"Cliquez ici pour d\xE9finir vos horaires."},modes:{withLimits:"Avec Limites",unlimited:"Illimit\xE9",openingHours:"Horaires",free:"Libre"},fields:{time:"Heure"},messages:{searchingTables:"Recherche de tables disponibles...",noTablesAvailable:"Aucune table sp\xE9cifique disponible pour cette s\xE9lection."},warnings:{unlimitedMode:"Illimit\xE9 ne tiendra pas compte des limites maximales.",dateNotAvailableWithLimits:"Attention : cette date n'est pas disponible avec limites pour ce nombre de convives. Le mode a \xE9t\xE9 automatiquement bascul\xE9 vers illimit\xE9 libre."}},calendar:{selectDatePlaceholder:"S\xE9lectionnez une date",today:"Aujourd'hui",tomorrow:"Demain",prevWeek:"Semaine pr\xE9c\xE9dente",nextWeek:"Semaine suivante",dayHeaders:["Lu","Ma","Me","Je","Ve","Sa","Di"],seatsQuestion:"Places ?"},timeSelector:{shifts:{breakfast:"Petit-d\xE9jeuner",lunch:"D\xE9jeuner",dinner:"D\xEEner"},selectMeal:"S\xE9lectionnez un repas",selectTime:"S\xE9lectionnez une heure",noDateSelected:"Veuillez d'abord s\xE9lectionner une date.",noTimes:"Aucun horaire disponible.",back:"Retour",reservations:"R\xE9servations",guests:"Convives"},tableSelector:{label:"S\xE9lectionnez les table(s) disponibles :",table:"Table",max:"Max",noTables:"Aucune table sp\xE9cifique disponible pour cette combinaison temps/convives.",manual:"Manuel"}}};var Pb=o0.memo(({guests:b,selectedDate:c,onSelectDate:q,autoExpand:e,reservationMode:W,restaurantData:n,startDate:a,onWeekChange:s,reservations:r,giftcard:R,zitplaats:v,isAdmin:u=false})=>{let B=localStorage.getItem("preferredLanguage")||"nl",h=a1[B].calendar,[f,g]=o0.useState(e||false),[l,N]=o0.useState(false),C=o0.useRef(null),E=o0.useRef(null),y=(0, u1.default)().tz("Europe/Amsterdam").add(1,"year").endOf("day");o0.useEffect(()=>{e&&g(true);},[e]),o0.useEffect(()=>{let x=I=>{C.current&&!C.current.contains(I.target)&&(g(false),N(false));};return document.addEventListener("mousedown",x),()=>{document.removeEventListener("mousedown",x);}},[]),o0.useEffect(()=>()=>{E.current&&(clearTimeout(E.current),E.current=null);},[]);let S=()=>{E.current&&(clearTimeout(E.current),E.current=null),N(true);},m=(x=1e3)=>{E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{N(false),E.current=null;},x);},j=o0.useCallback((x,I,V=[])=>{if(x.isBefore(I,"day")||x.isAfter(y,"day"))return 0;let c0=x.format("YYYY-MM-DD");if(W==="vrije_keuze")return 21;if(W!=="met_limieten"&&!l)return (0, d1.isDateAvailable)(n,c0,r,-1e4,V,null,u)?21:0;let O0=n?.["table-settings"]||{},d0=O0.isInstalled===true&&O0.assignmentMode==="automatic"&&(l||W==="met_limieten"),P=J=>d0?F0("isDateAvailableWithTableCheck",d1.isDateAvailableWithTableCheck,n,c0,r,J,V,null,u,null,v||null):F0("isDateAvailable",d1.isDateAvailable,n,c0,r,J,V,null,u);if(!P(1))return 0;if(P(21))return 21;let X0=1,F=21,k=1;for(;X0<=F;){let J=Math.floor((X0+F)/2);P(J)?(k=J,X0=J+1):F=J-1;}return k},[n,r,R,u,W,l]),_=o0.useMemo(()=>{if(!f)return [];let x=[],I=(0, u1.default)().tz("Europe/Amsterdam").startOf("day"),V=a||I,c0=n?.["blocked-slots"]||[],O0=V.clone().startOf("month"),d0=V.clone().endOf("month"),P=n?.["table-settings"]||{},X0=P.isInstalled===true&&P.assignmentMode==="automatic"&&W==="met_limieten",F=O0.clone();for(;F.isSameOrBefore(d0,"day");){let k=F.format("YYYY-MM-DD"),J;if(W==="vrije_keuze")J=F.isBetween(I,y,null,"[]");else {let T0=W!=="met_limieten"?-1e4:b,f0=W==="met_limieten"?R:null;X0?J=F0("isDateAvailableWithTableCheck",d1.isDateAvailableWithTableCheck,n,k,r,T0,c0,f0,u,null,v||null):J=F0("isDateAvailable",d1.isDateAvailable,n,k,r,T0,c0,f0,u);}let z0=j(F,I,c0),u0=false;u&&J&&W!=="vrije_keuze"&&(u0=!F0("isDateAvailable",d1.isDateAvailable,n,k,r,W!=="met_limieten"?-1e4:b,c0,W==="met_limieten"?R:null,false)),x.push({date:F.clone(),isPast:F.isBefore(I,"day"),isFuture:F.isAfter(y,"day"),isAvailable:J,maxGuestsAvailable:z0,isClosedForCustomers:u0}),F.add(1,"day");}return x},[f,a,b,W,n,r,R,v,l,u]),H=x=>{x.isAvailable&&!x.isPast&&!x.isFuture&&(q(x.date.format("YYYY-MM-DD")),g(false),N(false));},A0=()=>{let x=a.clone().subtract(1,"month").startOf("month"),I=(0, u1.default)().tz("Europe/Amsterdam").startOf("day");if(x.clone().endOf("month").isBefore(I,"day")){console.log("Cannot go to previous month. It is in the past.");return}s(x);},p0=()=>{let x=a.clone().add(1,"month").startOf("month");s(x);},a0=()=>{if(!c)return h.selectDatePlaceholder;let x=(0, u1.default)(c,"YYYY-MM-DD").tz("Europe/Amsterdam").startOf("day"),I=(0, u1.default)().tz("Europe/Amsterdam").startOf("day"),V=I.clone().add(1,"day");return x.isSame(I,"day")?h.today:x.isSame(V,"day")?h.tomorrow:x.format("dddd D MMMM YYYY")},Y=a?(x=>{let V=a.clone().startOf("month").day(),c0=V===0?6:V-1,O0=[];for(let F=0;F<c0;F++)O0.push(null);O0.push(...x);let d0=O0.length,P=Math.ceil(d0/7);for(;O0.length<P*7;)O0.push(null);let X0=[];for(let F=0;F<P;F++){let k=O0.slice(F*7,F*7+7);X0.push(k);}return X0})(_):[],X=h.dayHeaders,U=x=>x>=21?"20+":String(x);return o0__default.default.createElement("div",{className:"calendar-container",ref:C},o0__default.default.createElement("div",{className:"calendar-display",onClick:()=>{let x=!f;g(x),x&&window.dispatchEvent(new CustomEvent("calendarExpanded"));}},o0__default.default.createElement("span",null,a0()),o0__default.default.createElement("span",{className:"arrow"},o0__default.default.createElement("svg",{width:"12",height:"12",viewBox:"0 0 24 24",style:{transform:f?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"}},o0__default.default.createElement("path",{d:"M7 10l5 5 5-5",fill:"none",stroke:"currentColor",strokeWidth:"2"})))),f&&a&&o0__default.default.createElement("div",{className:"calendar"},o0__default.default.createElement("div",{className:"calendar-header"},o0__default.default.createElement("button",{type:"button",onClick:A0,"aria-label":h.prevWeek},"<"),o0__default.default.createElement("span",null,a.format("MMMM YYYY")),o0__default.default.createElement("button",{type:"button",onClick:p0,"aria-label":h.nextWeek},">"),o0__default.default.createElement("button",{type:"button",className:`availability-hold-btn ${l?"active":""}`,"aria-pressed":l,"aria-label":"Houd ingedrukt om beschikbaarheden te tonen",onMouseDown:S,onMouseUp:()=>m(1e3),onMouseLeave:()=>m(1e3),onTouchStart:S,onTouchEnd:()=>m(1e3),onTouchCancel:()=>m(1e3),onKeyDown:x=>{(x.key===" "||x.key==="Enter")&&S();},onKeyUp:x=>{(x.key===" "||x.key==="Enter")&&m(1e3);},style:{fontSize:"15px",color:"gray",fontWeight:"450",textDecoration:"underline"}},h.seatsQuestion)),o0__default.default.createElement("div",{className:"calendar-weeks-wrapper"},o0__default.default.createElement("table",{className:"calendar-table"},o0__default.default.createElement("thead",null,o0__default.default.createElement("tr",{translate:"no"},X.map((x,I)=>o0__default.default.createElement("th",{key:I},x)))),o0__default.default.createElement("tbody",null,Y.map((x,I)=>o0__default.default.createElement("tr",{key:I,translate:"no"},x.map((V,c0)=>{if(!V)return o0__default.default.createElement("td",{key:c0,className:"empty-day"});let O0=c&&wz(V.date,(0, u1.default)(c,"YYYY-MM-DD").tz("Europe/Amsterdam")),d0=[];return V.isPast?d0.push("gray-out"):V.isClosedForCustomers?d0.push("has-blocked-slots"):V.isAvailable?d0.push("available"):d0.push("unavailable"),O0&&d0.push("selected"),o0__default.default.createElement("td",{key:c0,className:d0.join(" "),onClick:()=>H(V),style:{"--animation-order":c0+I*7}},o0__default.default.createElement("div",{className:`day-square ${l?"showing-availabilities":""}`},o0__default.default.createElement("span",{className:"day-number"},l?U(V.maxGuestsAvailable):V.date.date())))}))))))))});Pb.displayName="Calendar";var _b=Pb;var TM=P0(c1()),Ho=({guests:b,formData:c,handleChange:q,resetFormDataFields:e,restaurantData:W,reservations:n,startDate:a,onWeekChange:s,reservationMode:r,isAdmin:R=false})=>{let v=B=>{let h=(0, TM.default)(B).format("YYYY-MM-DD");console.log("Selected date:",h),q({target:{name:"date",value:h}}),e(["time"]);},u=a?a.clone().startOf("month"):(0, TM.default)().startOf("month");return o0__default.default.createElement("div",{className:"form-group date-selector-container"},o0__default.default.createElement(_b,{guests:b,selectedDate:c.date||null,onSelectDate:v,autoExpand:false,reservationMode:r,restaurantData:W,startDate:u,onWeekChange:s,reservations:n,giftcard:c.giftcard,zitplaats:c.zitplaats,isAdmin:R}))},Fb=Ho;R0(`.new-reservation-page .time-selector-container{position:relative}.new-reservation-page .time-display{display:flex;align-items:center;justify-content:space-between;width:100%;padding:10px;background-color:#fff;border:#ccc 1px solid;cursor:pointer;user-select:none;text-align:left;border-radius:5px}.new-reservation-page .time-display span:first-child{flex-grow:1}.new-reservation-page .time-selector{position:absolute;z-index:1000;width:100%;max-height:350px;overflow-y:auto;background-color:#fff;border:1px solid #ccc;padding:10px;border-radius:10px;animation:fadeInTimeSelector .3s ease-in-out;top:75px}.new-reservation-page .time-toggle-container{display:flex;gap:8px;padding-bottom:10px;margin-bottom:10px;border-bottom:1px solid #eee}.new-reservation-page .time-toggle-btn{display:inline-flex;align-items:center;gap:6px;padding:6px 14px;border-radius:20px;border:1px solid #ddd;background-color:#f5f5f5;color:#666;font-size:13px;cursor:pointer;transition:all .2s ease;font-family:inherit}.new-reservation-page .time-toggle-btn:hover{background-color:#e8e8e8;border-color:#ccc}.new-reservation-page .time-toggle-btn.active{background-color:var(--color-blue, #48aaaf);border-color:var(--color-blue, #48aaaf);color:#fff}.new-reservation-page .time-toggle-btn.active:hover{background-color:var(--color-blue, #48aaaf);filter:brightness(.95)}.new-reservation-page .time-toggle-btn svg{flex-shrink:0}.new-reservation-page .time-count{font-weight:400;opacity:.9}@keyframes fadeInTimeSelector{0%{opacity:0}to{opacity:1}}.new-reservation-page .time-period{margin-bottom:15px}.new-reservation-page .time-period-label{font-weight:700;margin-bottom:5px}.new-reservation-page .time-options{display:flex;flex-wrap:wrap;gap:5px}.new-reservation-page .time-option{padding:8px 12px;background-color:#cfc;color:#060;border-radius:5px;cursor:pointer;transition:background-color .2s ease}.new-reservation-page .time-option:hover{background-color:#b3ffb3}.new-reservation-page .time-option.selected{background-color:#060;color:#cfc}.new-reservation-page .time-option.blocked{background-color:#fff3e0;color:#e65100}.new-reservation-page .time-option.blocked:hover{background-color:#ffe0b2}.new-reservation-page .time-option.blocked.selected{background-color:#e65100;color:#fff3e0}.new-reservation-page .info-text{color:#666;font-style:italic}.new-reservation-page .arrow{margin-left:auto;color:gray;display:flex;align-items:center}@media screen and (max-width:480px){.new-reservation-page .time-option{padding:6px 10px;font-size:14px}.new-reservation-page .time-toggle-btn{padding:5px 10px;font-size:12px;gap:4px}.new-reservation-page .time-toggle-btn svg{width:12px;height:12px}}
|
|
11
11
|
`);var gM=P0(c1());var v2=P0(Y1()),Ub=o0.memo(({guests:b,formData:c,handleChange:q,field:e,selectedDate:W,expanded:n,setCurrentExpandedField:a,restaurantData:s,reservations:r,reservationMode:R,isAdmin:v=false,zitplaats:u=null})=>{let B=localStorage.getItem("preferredLanguage")||"nl",h=a1[B].timeSelector,[f,g]=o0.useState(n||false),[l,N]=o0.useState([]),[C,E]=o0.useState(null),[y,S]=o0.useState(null),m=o0.useRef(null),j=o0.useMemo(()=>{if(!v||!W||!s)return new Set;let X=s?.["blocked-slots"]||[],U=new Set;return X.forEach(x=>{x.date===W&&x.time&&U.add(x.time);}),U},[v,W,s]),_=o0.useMemo(()=>{if(!r||!W)return {};let X={};return r.forEach(U=>{if((U.date||U.datum)!==W)return;let I=U.time||U.tijd;if(!I)return;let V=U.guests||U.antal||U.gasten||1;X[I]||(X[I]={reservations:0,guests:0}),X[I].reservations+=1,X[I].guests+=V;}),X},[r,W]),H=X=>_[X]||{reservations:0,guests:0},A0=X=>{S(y===X?null:X);},p0={breakfast:{start:"07:00",end:"11:00",label:h.shifts.breakfast},lunch:{start:"11:00",end:"16:00",label:h.shifts.lunch},dinner:{start:"16:00",end:"23:00",label:h.shifts.dinner}};o0.useEffect(()=>{if(!W||!b){N([]);return}if(R==="vrije_keuze")if(C){let X=p0[C],U=gM.default.tz(`${W} ${X.start}`,"YYYY-MM-DD HH:mm","Europe/Brussels"),x=gM.default.tz(`${W} ${X.end}`,"YYYY-MM-DD HH:mm","Europe/Brussels"),I=[],V=U.clone();for(;V.isBefore(x);)I.push({value:V.format("HH:mm"),label:V.format("HH:mm")}),V.add(15,"minutes");N(I);}else N([]);else if(s&&r){let X=R!=="met_limieten"?-1e4:b,U=s?.["table-settings"]||{},x=R==="met_limieten"&&U.isInstalled===true&&U.assignmentMode==="automatic",I=R==="met_limieten"?c.giftcard:null,V=s?.["blocked-slots"]||[],c0=(0, v2.getAvailableTimeblocks)(s,W,r,X,V,I,v,c.duration),O0=x?(0, v2.getAvailableTimeblocksWithTableCheck)(s,W,c0,X,r,u,c.duration):c0,d0=Object.keys(O0).map(P=>({value:P,label:O0[P].name||P}));d0.sort((P,X0)=>{let[F,k]=P.value.split(":").map(Number),[J,z0]=X0.value.split(":").map(Number);return F*60+k-(J*60+z0)}),N(d0),c[e.id]&&!d0.some(P=>P.value===c[e.id])&&q({target:{name:e.id,value:""}});}else N([]);},[W,b,s,r,R,e.id,C,u,c[e.id],q]),o0.useEffect(()=>{R==="vrije_keuze"&&(E(null),c[e.id]&&q({target:{name:e.id,value:""}}));},[W,R]),o0.useEffect(()=>{g(false);},[W]),o0.useEffect(()=>{let X=()=>g(false);return window.addEventListener("calendarExpanded",X),()=>window.removeEventListener("calendarExpanded",X)},[]);let a0=X=>{q({target:{name:e.id,value:X}}),g(false),a?.(null);},q0=X=>{C!==X&&c[e.id]&&q({target:{name:e.id,value:""}}),E(X);},Y=()=>{if(R==="vrije_keuze")return C?c[e.id]?`${p0[C].label} \u2013 ${c[e.id]}`:`${p0[C].label} \u2013 ${h.selectTime}`:h.selectMeal;if(c[e.id]){let X=l.find(U=>U.value===c[e.id]);return X?X.label:h.selectTime}return h.selectTime};return e?o0__default.default.createElement("div",{className:"form-group time-selector-container",ref:m},W?o0__default.default.createElement(o0__default.default.Fragment,null,o0__default.default.createElement("div",{className:"time-display",onClick:()=>{g(!f),f||a?.(e.id);}},o0__default.default.createElement("span",null,Y()),o0__default.default.createElement("span",{className:"arrow"},o0__default.default.createElement("svg",{width:"12",height:"12",viewBox:"0 0 24 24",style:{transform:f?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"}},o0__default.default.createElement("path",{d:"M7 10l5 5 5-5",fill:"none",stroke:"currentColor",strokeWidth:"2"})))),f&&o0__default.default.createElement("div",{className:"time-selector"},o0__default.default.createElement("div",{className:"time-toggle-container"},o0__default.default.createElement("button",{className:`time-toggle-btn ${y==="reservations"?"active":""}`,onClick:()=>A0("reservations"),type:"button"},o0__default.default.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},o0__default.default.createElement("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),o0__default.default.createElement("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),o0__default.default.createElement("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),o0__default.default.createElement("line",{x1:"3",y1:"10",x2:"21",y2:"10"})),h.reservations),o0__default.default.createElement("button",{className:`time-toggle-btn ${y==="guests"?"active":""}`,onClick:()=>A0("guests"),type:"button"},o0__default.default.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},o0__default.default.createElement("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),o0__default.default.createElement("circle",{cx:"9",cy:"7",r:"4"}),o0__default.default.createElement("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),o0__default.default.createElement("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})),h.guests)),R==="vrije_keuze"?C?o0__default.default.createElement("div",{className:"time-period"},o0__default.default.createElement("div",{className:"time-period-label"},p0[C].label,o0__default.default.createElement("button",{onClick:()=>E(null),style:{marginLeft:"10px",background:"none",border:"none",cursor:"pointer",color:"#006600",fontSize:"0.9rem",padding:0}},"\u2190 ",h.back)),o0__default.default.createElement("div",{className:"time-options"},l.length===0?o0__default.default.createElement("div",{className:"no-times"},h.noTimes):l.map(X=>{let U=H(X.value),x=j.has(X.value);return o0__default.default.createElement("div",{key:X.value,className:`time-option${c[e.id]===X.value?" selected":""}${x?" blocked":""}`,onClick:()=>a0(X.value)},X.label,y==="reservations"&&U.reservations>0&&o0__default.default.createElement("span",{className:"time-count"}," - ",U.reservations),y==="guests"&&U.guests>0&&o0__default.default.createElement("span",{className:"time-count"}," - ",U.guests,"p"))}))):o0__default.default.createElement("div",{className:"time-options"},Object.keys(p0).map(X=>o0__default.default.createElement("div",{key:X,className:`time-option ${C===X?"selected":""}`,onClick:()=>q0(X)},p0[X].label))):o0__default.default.createElement("div",{className:"time-options"},l.length===0?o0__default.default.createElement("div",{className:"no-times"},h.noTimes):l.map(X=>{let U=H(X.value),x=j.has(X.value);return o0__default.default.createElement("div",{key:X.value,className:`time-option${c[e.id]===X.value?" selected":""}${x?" blocked":""}`,onClick:()=>a0(X.value)},X.label,y==="reservations"&&U.reservations>0&&o0__default.default.createElement("span",{className:"time-count"}," - ",U.reservations),y==="guests"&&U.guests>0&&o0__default.default.createElement("span",{className:"time-count"}," - ",U.guests,"p"))})))):o0__default.default.createElement("p",{className:"info-text"},h.noDateSelected)):null});Ub.displayName="TimeSelector";var jb=Ub;R0(`.new-reservation-page .table-selector-container{margin-top:15px;padding:10px;border:1px solid #eee;border-radius:4px;background-color:#f9f9f9}.new-reservation-page .table-selector-label{display:block;margin-bottom:10px;font-weight:700;color:#333;font-size:.95rem}.new-reservation-page .table-options{display:flex;flex-wrap:wrap;gap:10px}.new-reservation-page .table-option{display:inline-block;margin-right:15px;margin-bottom:5px;padding:5px 8px;border:1px solid #ccc;border-radius:4px;background-color:#fff;transition:background-color .2s ease}.new-reservation-page .table-option label{display:flex;align-items:center;cursor:pointer;font-size:.9rem;color:#555}.new-reservation-page .table-option input[type=checkbox]{margin-right:8px;cursor:pointer;accent-color:var(--primary-color, #006600)}.new-reservation-page .table-option:has(input[type=checkbox]:checked){background-color:#e0f2e0;border-color:#060}.new-reservation-page .table-option:hover{background-color:#f0f0f0}.new-reservation-page .info-text{margin-top:10px;font-size:.85rem;color:#666}.new-reservation-page .selected-tables-info{margin-top:10px;font-style:italic}.new-reservation-page .info-text.loading-tables{font-style:italic;color:#060}.new-reservation-page .table-option--manual{border-color:#ff9800;background-color:#fff8e1}.new-reservation-page .table-option--manual:hover{background-color:#ffecb3}.new-reservation-page .table-option--manual:has(input[type=checkbox]:checked){background-color:#ffe082;border-color:#ff9800}
|
|
12
|
-
`);var Go=({availableTables:b=[],isFetching:c=false,formData:q={},handleChange:e,setFormData:W})=>{let n=localStorage.getItem("preferredLanguage")||"nl",a=a1?.[n]?.tableSelector||{},s={label:a.label||"Tafels",noTables:a.noTables||"Geen tafels beschikbaar voor deze selectie.",table:a.table||"Tafel",max:a.max||"Max"},r=Array.isArray(q.selectedTableNumbers)?q.selectedTableNumbers:[],R=Array.isArray(q.selectedTableIds)?q.selectedTableIds:[],v=(B,h)=>{if(typeof e=="function"){e({target:{multiple:true,updates:{selectedTableNumbers:B,selectedTableIds:h}}});return}typeof W=="function"&&W(f=>({...f,selectedTableNumbers:B,selectedTableIds:h}));},u=B=>h=>{let f=h.target.checked,g=b.find(C=>C.tableNumber===B);if(!g)return;let l=[...r],N=[...R];f?(l.includes(B)||l.push(B),N.includes(g.tableId)||N.push(g.tableId)):(l=l.filter(C=>C!==B),N=N.filter(C=>C!==g.tableId)),l.sort((C,E)=>C-E),v(l,N);};return c?o0__default.default.createElement("div",{className:"form-group table-selector-container"},o0__default.default.createElement("label",{className:"table-selector-label"},s.label),o0__default.default.createElement("p",{className:"info-text"},"Laden\u2026")):!b||b.length===0?o0__default.default.createElement("div",{className:"form-group table-selector-container"},o0__default.default.createElement("label",{className:"table-selector-label"},s.label),o0__default.default.createElement("p",{className:"info-text"},s.noTables)):o0__default.default.createElement("div",{className:"form-group table-selector-container"},o0__default.default.createElement("label",{className:"table-selector-label"},s.label),o0__default.default.createElement("div",{className:"table-options"},b.map(B=>{let h=B.tableNumber,f=B.maxCapacity??B.capacity??B.seats??"-",g=r.includes(h),l=B.isManual===true;return o0__default.default.createElement("div",{key:`${B.tableId||h}`,className:`table-option${l?" table-option--manual":""}`},o0__default.default.createElement("label",null,o0__default.default.createElement("input",{type:"checkbox",value:h,checked:g,onChange:u(h)}),s.table," ",h," (",s.max,": ",f,")"))})))},y2=Go;R0(`.new-reservation-page .form-row .field-label{display:block;margin-bottom:6px;font-weight:600}.new-reservation-page .form-row .reservation-mode-buttons{margin-top:0}.new-reservation-page .reservation-modes-container{display:flex;flex-wrap:wrap;margin:0 -5px;width:100%}.new-reservation-page .reservation-mode-button{flex:0 0 calc(50% - 10px);margin:5px;padding:10px;box-sizing:border-box;text-align:center;border:1px solid #ccc;
|
|
12
|
+
`);var Go=({availableTables:b=[],isFetching:c=false,formData:q={},handleChange:e,setFormData:W})=>{let n=localStorage.getItem("preferredLanguage")||"nl",a=a1?.[n]?.tableSelector||{},s={label:a.label||"Tafels",noTables:a.noTables||"Geen tafels beschikbaar voor deze selectie.",table:a.table||"Tafel",max:a.max||"Max"},r=Array.isArray(q.selectedTableNumbers)?q.selectedTableNumbers:[],R=Array.isArray(q.selectedTableIds)?q.selectedTableIds:[],v=(B,h)=>{if(typeof e=="function"){e({target:{multiple:true,updates:{selectedTableNumbers:B,selectedTableIds:h}}});return}typeof W=="function"&&W(f=>({...f,selectedTableNumbers:B,selectedTableIds:h}));},u=B=>h=>{let f=h.target.checked,g=b.find(C=>C.tableNumber===B);if(!g)return;let l=[...r],N=[...R];f?(l.includes(B)||l.push(B),N.includes(g.tableId)||N.push(g.tableId)):(l=l.filter(C=>C!==B),N=N.filter(C=>C!==g.tableId)),l.sort((C,E)=>C-E),v(l,N);};return c?o0__default.default.createElement("div",{className:"form-group table-selector-container"},o0__default.default.createElement("label",{className:"table-selector-label"},s.label),o0__default.default.createElement("p",{className:"info-text"},"Laden\u2026")):!b||b.length===0?o0__default.default.createElement("div",{className:"form-group table-selector-container"},o0__default.default.createElement("label",{className:"table-selector-label"},s.label),o0__default.default.createElement("p",{className:"info-text"},s.noTables)):o0__default.default.createElement("div",{className:"form-group table-selector-container"},o0__default.default.createElement("label",{className:"table-selector-label"},s.label),o0__default.default.createElement("div",{className:"table-options"},b.map(B=>{let h=B.tableNumber,f=B.maxCapacity??B.capacity??B.seats??"-",g=r.includes(h),l=B.isManual===true;return o0__default.default.createElement("div",{key:`${B.tableId||h}`,className:`table-option${l?" table-option--manual":""}`},o0__default.default.createElement("label",null,o0__default.default.createElement("input",{type:"checkbox",value:h,checked:g,onChange:u(h)}),s.table," ",h," (",s.max,": ",f,")"))})))},y2=Go;R0(`.new-reservation-page .form-row .field-label{display:block;margin-bottom:6px;font-weight:600}.new-reservation-page .form-row .reservation-mode-buttons{margin-top:0}.new-reservation-page .reservation-mode-buttons{display:flex;gap:10px;margin-top:10px}.new-reservation-page .reservation-mode-button{flex:1;padding:10px;border:1px solid #ccc;border-radius:var(--border-radius);background-color:var(--color-white);cursor:pointer;font-size:1rem;transition:background-color .3s ease,color .3s ease}.new-reservation-page .reservation-mode-button:nth-child(3){flex:0 0 100%}.new-reservation-page .reservation-modes-container{display:flex;flex-wrap:wrap;margin:0 -5px;width:100%}.new-reservation-page .reservation-mode-button{flex:0 0 calc(50% - 10px);margin:5px;padding:10px;box-sizing:border-box;text-align:center;border:1px solid #ccc;background:#f7f7f7;cursor:pointer}.new-reservation-page .reservation-mode-button.active,.new-reservation-page .reservation-mode-button:hover{background-color:var(--color-blue);color:var(--color-white)}.new-reservation-page .unlimited-mode-warning{display:flex;align-items:flex-start;gap:10px;margin:15px 0;padding:12px 15px;background-color:#fff3cd;border:1px solid #ffeaa7;border-radius:var(--border-radius, 4px);border-left:4px solid #e67e22;font-size:.9rem;line-height:1.4}.new-reservation-page .unlimited-mode-warning .warning-icon{color:#e67e22;font-size:1.1rem;margin-top:2px;flex-shrink:0}.new-reservation-page .unlimited-mode-warning .warning-text{color:#856404;margin:0}@media screen and (max-width:480px){.new-reservation-page .unlimited-mode-warning{margin:10px 0;padding:10px 12px;font-size:.85rem}.new-reservation-page .unlimited-mode-warning .warning-icon{font-size:1rem}}.new-reservation-page .reservation-sidebar-component{position:fixed;top:0;right:-400px;width:400px;height:100%;background-color:#fff;box-shadow:-2px 0 5px #0000001a;z-index:var(--z-index-sidebar-reservation);display:flex;flex-direction:column;overflow-y:auto;transition:right .3s ease-in-out}.new-reservation-page .admin-title{text-align:center;margin-bottom:30px}.new-reservation-page .reservation-sidebar-component.open{right:0}.new-reservation-page .reservation-sidebar-content{padding:60px 20px 20px}.new-reservation-page .close-sidebar-button{position:absolute;top:10px;left:10px;background-color:transparent;border:none;cursor:pointer}.new-reservation-page .close-sidebar-button svg{color:#000}.new-reservation-page .sidebar-section-one,.new-reservation-page .sidebar-section-two{margin-bottom:20px}.new-reservation-page .reservation-footer{margin-top:auto}.new-reservation-page .store-reservation-button{width:100%;padding:12px;background-color:var(--color-blue);color:#fff;border:none;border-radius:5px;cursor:pointer;font-size:1.1rem}.new-reservation-page .open-sidebar-button{position:fixed;bottom:20px;right:20px;background-color:var(--color-blue);color:#fff;border:none;border-radius:50%;width:50px;height:50px;cursor:pointer;z-index:var(--z-index-modal)!important;transition:all .3s ease}.new-reservation-page .open-sidebar-button:hover{background-color:var(--color-blue-hover-accent)!important}.new-reservation-page .open-sidebar-button svg{position:relative;top:2px}@media screen and (max-width:480px){.new-reservation-page .reservation-sidebar-component{width:100%}}.new-reservation-page .sidebar-section-personeel{margin-bottom:10px}
|
|
13
13
|
`);var Vb=P0(c1());var Ko=()=>{let b=o0.useCallback(()=>localStorage.getItem("accessToken"),[]),c=o0.useCallback((W,n={})=>{let{params:a,...s}=n,r=b();return Gb__default.default.get(W,{...s,params:a,headers:{...s.headers,...r?{Authorization:`Bearer ${r}`}:{}}}).then(R=>R.data).catch(R=>{throw console.error("Error fetching data:",R),R})},[b]),q=o0.useCallback((W,n,a=null,s={})=>{let r=b();return Gb__default.default({method:W,url:n,data:a,...s,headers:{...s.headers,...r?{Authorization:`Bearer ${r}`}:{}}}).then(R=>R.data).catch(R=>{throw console.error(`Error with ${W} request:`,R),R})},[b]);return o0.useMemo(()=>({get:c,post:(W,n,a)=>q("POST",W,n,a),put:(W,n,a)=>q("PUT",W,n,a),patch:(W,n,a)=>q("PATCH",W,n,a),delete:(W,n)=>q("DELETE",W,null,n)}),[c,q])},o1=Ko;var U0=P0(Y1());var M4=({duration:b,setDuration:c,handleChange:q,min:e=30,max:W=120,interval:n=30})=>{let [a,s]=o0.useState(false),r=o0.useMemo(()=>{let N=[],C=parseInt(e)||30,E=parseInt(W)||120,y=parseInt(n)||30;for(let S=C;S<=E;S+=y){let m=[],j=Math.floor(S/60),_=S%60;j>0&&m.push(`${j} u`),_>0&&m.push(`${_} min`),N.push({value:S,label:m.join(" ")});}return N},[e,W,n]),R=r.slice(0,3),v=r.length>3;R.some(N=>N.value===parseInt(b));let B=N=>{s(false),c&&c(N),q&&q({target:{name:"duration",value:N}});};o0.useEffect(()=>{!b&&r.length>0&&B(r[0].value);},[]);let h=()=>{let N=R[R.length-1],C=parseInt(n)||30;if(N){let E=N.value+C,y=parseInt(W)||120,S=Math.min(E,y);c&&c(S),q&&q({target:{name:"duration",value:S}}),s(true);}else s(true);},f=N=>{let C=parseInt(b)||parseInt(e)||30,E=parseInt(n)||30,y=parseInt(e)||30,S=parseInt(W)||120,m=C+N*E;m<y&&(m=y),m>S&&(m=S),c&&c(m),q&&q({target:{name:"duration",value:m}});},g={wrapper:{marginBottom:"20px"},grid:{display:"flex",flexWrap:"wrap",gap:"8px"},optionBtn:{padding:"8px 12px",borderRadius:"6px",border:"1px solid #D0D5DD",backgroundColor:"#fff",cursor:"pointer",fontSize:"14px",fontWeight:"500",color:"#344054",textAlign:"center",transition:"all 0.2s",outline:"none",fontFamily:"'Inter', sans-serif', system-ui",flex:1,minWidth:"60px"},activeBtn:{backgroundColor:"#48AAAF",color:"#ffffff",borderColor:"#48AAAF"},stepperContainer:{display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:"10px",padding:"8px",backgroundColor:"#F9FAFB",border:"1px solid #EAECF0",borderRadius:"8px",width:"100%"},stepperBtn:{width:"32px",height:"32px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"6px",border:"1px solid #D0D5DD",backgroundColor:"#fff",cursor:"pointer",color:"#344054"},stepperValue:{fontSize:"14px",fontWeight:"600",color:"#101828"}},l=N=>{let C=Math.floor(N/60),E=N%60,y=[];return C>0&&y.push(`${C} u`),E>0&&y.push(`${E} min`),y.join(" ")||`${N} min`};return o0__default.default.createElement("div",{style:g.wrapper},o0__default.default.createElement("style",null,`
|
|
14
14
|
.duration-btn {
|
|
15
15
|
outline: none !important;
|
|
@@ -39,7 +39,7 @@ Checking Time: ${v} -> Determined Meal: ${B}`),!B){N0(` Time ${v} has no associ
|
|
|
39
39
|
border-color: #48AAAF !important;
|
|
40
40
|
}
|
|
41
41
|
`),o0__default.default.createElement("div",{style:g.grid},R.map(N=>o0__default.default.createElement("button",{key:N.value,type:"button",className:`duration-btn ${parseInt(b)===N.value?"active-duration":""}`,tabIndex:"-1",style:{...g.optionBtn,...!a&&parseInt(b)===N.value?g.activeBtn:{}},onClick:()=>B(N.value),onMouseDown:C=>C.preventDefault()},N.label)),v&&o0__default.default.createElement("button",{type:"button",className:`duration-btn ${a?"active-duration":""}`,tabIndex:"-1",style:{...g.optionBtn,...a?g.activeBtn:{},flex:"0 0 auto",width:"auto",minWidth:"40px"},onClick:h,onMouseDown:N=>N.preventDefault()},a?o0__default.default.createElement(fa.FaMinus,{size:12}):o0__default.default.createElement(fa.FaPlus,{size:12}))),o0__default.default.createElement(framerMotion.AnimatePresence,null,a&&o0__default.default.createElement(framerMotion.motion.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},style:{overflow:"hidden"}},o0__default.default.createElement("div",{style:g.stepperContainer},o0__default.default.createElement("button",{type:"button",style:g.stepperBtn,onClick:()=>f(-1)},o0__default.default.createElement(fa.FaMinus,{size:12})),o0__default.default.createElement("span",{style:g.stepperValue},l(parseInt(b)||0)),o0__default.default.createElement("button",{type:"button",style:g.stepperBtn,onClick:()=>f(1)},o0__default.default.createElement(fa.FaPlus,{size:12}))))))},S2=M4;var Qb=o0.memo(({formData:b,errors:c,handleChange:q,handleStepOneSubmit:e,setFormData:W,timeblocks:n,loadingTimeblocks:a,timeblocksError:s,restaurantData:r,isAdmin:R=false})=>{let v=localStorage.getItem("preferredLanguage")||"nl",u=a1[v].reservationStepOne,[B,h]=o0.useState(b.guests||2),[f,g]=o0.useState(null),[l,N]=o0.useState([]),C=o1(),[E,y]=o0.useState([]),[S,m]=o0.useState(false),[j,_]=o0.useState(false),H=o0.useRef(false),A0=o0.useRef(false),p0=o0.useRef(false),a0=o0.useCallback(F=>{W(k=>{let J={...k};return F.forEach(z0=>{J[z0]="";}),(F.includes("date")||F.includes("time")||F.includes("guests"))&&(J.selectedTableNumbers=[],J.selectedTableIds=[],y([])),J});},[W]);o0.useEffect(()=>{let k=(0, Vb.default)().tz("Europe/Amsterdam").startOf("day").clone().startOf("isoWeek");for(;kz(k);)k.add(1,"week");g(k);},[]),o0.useEffect(()=>{(async()=>{if(f&&(b.reservationMode==="met_limieten"||b.reservationMode==="zonder_regels"||b.reservationMode==="vrije_keuze")){let k=r?.["table-settings"]||{},J=k.isInstalled===true&&k.assignmentMode==="automatic";if(b.reservationMode==="met_limieten"||b.reservationMode==="vrije_keuze"||b.reservationMode==="zonder_regels"&&J){let z0=f.format("YYYY-MM-DD"),u0=f.clone().add(13,"days").format("YYYY-MM-DD"),T0=localStorage.getItem("username"),f0=`${window.baseDomain}api/slots/${T0}/${z0}/${u0}`;try{let A=await C.get(f0,{noCache:!0});N(A||[]);}catch(A){console.error("Error fetching reservations:",A),N([]);}}else N([]);}else N([]);})();},[f,C,b.reservationMode,r]),o0.useEffect(()=>{window.__reservationDashboardPreset&&b.date?(window.__reservationDashboardPreset=false,p0.current=true,A0.current=true):_(false);},[b.date]),o0.useEffect(()=>{if(p0.current&&r&&Object.keys(r).length>0&&b.date&&b.reservationMode==="met_limieten"){p0.current=false;let F=r?.["blocked-slots"]||[],k=b.guests||2,J=r?.["table-settings"]||{},z0=J.isInstalled===true&&J.assignmentMode==="automatic",u0;z0?u0=(0, U0.isDateAvailableWithTableCheck)(r,b.date,l,k,F,null,R,null,b.zitplaats||null):u0=(0, U0.isDateAvailable)(r,b.date,l,k,F,null,R),u0?(_(false),A0.current=false):(_(true),A0.current=true,W(T0=>({...T0,reservationMode:"vrije_keuze"})));}},[r,l,b.date,b.guests,b.reservationMode,R,W]);let q0=F=>{g(F),a0(["date","time","selectedTableNumbers","selectedTableIds"]);};o0.useEffect(()=>{if(!H.current){let F=false,k={};b.reservationMode||(k.reservationMode="met_limieten",F=true),(!b.guests||b.guests==="")&&(k.guests=B,F=true),Array.isArray(b.selectedTableNumbers)||(k.selectedTableNumbers=[],F=true),Array.isArray(b.selectedTableIds)||(k.selectedTableIds=[],F=true),F&&setTimeout(()=>{q({target:{multiple:true,updates:k}});},0),H.current=true;}},[b.reservationMode,b.guests,b.selectedTableNumbers,b.selectedTableIds,B,q]);let Y=o0.useMemo(()=>r?.["table-settings"]||{},[r]),X=o0.useMemo(()=>Y.isInstalled===true&&Y.assignmentMode==="automatic",[Y]),U=o0.useMemo(()=>["met_limieten","zonder_regels","vrije_keuze"].includes(b.reservationMode),[b.reservationMode]),x=o0.useMemo(()=>U&&b.date&&b.time&&b.guests>0&&X&&E.length>0,[U,b.date,b.time,b.guests,X,E.length]);o0.useEffect(()=>{if(!X||!b.date||!b.time||b.guests<=0||!r||!l){y([]),m(false);return}m(true);let F=setTimeout(()=>{(window.requestIdleCallback||(J=>setTimeout(J,1)))(()=>{try{let J=new Set;r?.manualFloors&&Array.isArray(r.manualFloors)&&r.manualFloors.forEach(A=>{(A.tables||[]).forEach(d=>{d.tableNumber!=null&&J.add(d.tableNumber);});});let z0=[...r?.floors||[],...r?.manualFloors||[]],u0={...r,floors:z0},f0=F0("getAvailableTablesForTime",U0.getAvailableTablesForTime,u0,b.date,b.time,b.guests,l,b.zitplaats||null).map(A=>({...A,isManual:J.has(A.tableNumber)}));y(f0);}catch(J){console.error("Error calculating available tables:",J),y([]);}finally{m(false);}});},500);return ()=>{clearTimeout(F),m(false);}},[X,b.date,b.time,b.guests,b.zitplaats,r,l]),o0.useEffect(()=>{if(E.length>0){let F=b.selectedTableNumbers||[],k=b.selectedTableIds||[],J=[],z0=[];F.forEach(u0=>{let T0=E.find(f0=>f0.tableNumber===u0);T0&&k.includes(T0.tableId)&&(J.push(u0),z0.push(T0.tableId));}),J.length!==F.length&&setTimeout(()=>{q({target:{multiple:true,updates:{selectedTableNumbers:J,selectedTableIds:z0}}});},0);}else (b.selectedTableNumbers?.length>0||b.selectedTableIds?.length>0)&&setTimeout(()=>{q({target:{multiple:true,updates:{selectedTableNumbers:[],selectedTableIds:[]}}});},0);},[E,b.selectedTableNumbers,b.selectedTableIds]);let I=F=>{let k=parseInt(F.target.value,10)||1;h(k),_(false),W(J=>{let z0={...J,guests:k};if(z0.selectedTableNumbers=[],z0.selectedTableIds=[],z0.reservationMode==="vrije_keuze")return z0;if(z0.date&&r&&Object.keys(r).length>0){let u0=r?.["blocked-slots"]||[],T0=z0.reservationMode!=="met_limieten"?-1e4:k,f0=r?.["table-settings"]||{},A=z0.reservationMode==="met_limieten"&&f0.isInstalled===true&&f0.assignmentMode==="automatic",d;if(A?d=F0("isDateAvailableWithTableCheck",U0.isDateAvailableWithTableCheck,r,z0.date,l,T0,u0,null,R,null,z0.zitplaats||null):d=F0("isDateAvailable",U0.isDateAvailable,r,z0.date,l,T0,u0,null,R),!d)z0.date="",z0.time="";else if(z0.time){let t=(0, U0.getAvailableTimeblocks)(r,z0.date,l,T0,u0,null,R,z0.duration||null);(A?(0, U0.getAvailableTimeblocksWithTableCheck)(r,z0.date,t,T0,l,z0.zitplaats||null,z0.duration||null):t)[z0.time]||(z0.time="");}}return z0});};o0.useEffect(()=>{if(A0.current){A0.current=false;return}a0(["date","time","selectedTableNumbers","selectedTableIds"]);},[b.reservationMode,a0]);let V=F=>{_(false),F==="met_limieten"?q({target:{name:"reservationMode",value:"met_limieten"}}):F==="onbeperkt_parent"&&(["zonder_regels","vrije_keuze"].includes(b.reservationMode)||q({target:{name:"reservationMode",value:"zonder_regels"}}));},c0=F=>{_(false),q({target:{name:"reservationMode",value:F}});},O0=b.reservationMode,d0=!!r?.["general-settings"]?.seatSelectionEnabled,P=Array.isArray(r?.["general-settings"]?.seatAreas)?r["general-settings"].seatAreas:["Terras","Restaurant"],X0=F=>{W(k=>({...k,zitplaats:F}));};return s?o0__default.default.createElement("div",null,u.errors.openingHoursNotSet," ",o0__default.default.createElement("a",{href:"https://happychef.cloud/#/openinghours/dinner",target:"_blank",rel:"noopener noreferrer",style:{color:"var(--color-blue)",textDecoration:"underline"}},u.errors.clickHereToSet)):o0__default.default.createElement("form",{className:"account-manage-form",noValidate:true},o0__default.default.createElement("div",{className:"form-group reservation-mode"},o0__default.default.createElement("div",{className:"reservation-modes-container"},o0__default.default.createElement("button",{type:"button",className:`reservation-mode-button ${O0==="met_limieten"?"active":""}`,onClick:()=>V("met_limieten"),"aria-pressed":O0==="met_limieten"},u.modes.withLimits),o0__default.default.createElement("button",{type:"button",className:`reservation-mode-button ${["onbeperkt_parent","zonder_regels","vrije_keuze"].includes(O0)?"active":""}`,onClick:()=>V("onbeperkt_parent"),"aria-pressed":["onbeperkt_parent","zonder_regels","vrije_keuze"].includes(O0)},u.modes.unlimited)),["onbeperkt_parent","zonder_regels","vrije_keuze"].includes(O0)&&o0__default.default.createElement("div",{className:"reservation-modes-container sub-modes"},o0__default.default.createElement("button",{type:"button",className:`reservation-mode-button ${O0==="zonder_regels"?"active":""}`,onClick:()=>c0("zonder_regels"),"aria-pressed":O0==="zonder_regels"},u.modes.openingHours),o0__default.default.createElement("button",{type:"button",className:`reservation-mode-button ${O0==="vrije_keuze"?"active":""}`,onClick:()=>c0("vrije_keuze"),"aria-pressed":O0==="vrije_keuze"},u.modes.free))),["onbeperkt_parent","zonder_regels","vrije_keuze"].includes(O0)&&o0__default.default.createElement("div",{className:"unlimited-mode-warning"},o0__default.default.createElement("div",{className:"warning-text"},j?u.warnings?.dateNotAvailableWithLimits||"Let op: deze datum is niet beschikbaar met limieten voor dit aantal gasten. De modus is automatisch overgezet naar onbeperkt vrij.":u.warnings?.unlimitedMode||(v==="nl"?"Let op: Bij onbeperkte boekingen wordt geen rekening gehouden met de maximale capaciteit van het restaurant. De maximale zitplaatslimiet kan worden overschreden.":"Warning: Unlimited bookings do not take into account the restaurant's maximum capacity. The maximum seating limit may be exceeded."))),o0__default.default.createElement(d2,{setGuests:h,value:b.guests||B,onChange:I,error:c.guests}),d0&&U&&b.guests>0&&o0__default.default.createElement("div",{className:"form-row",style:{marginTop:12}},o0__default.default.createElement("div",{className:"reservation-mode-buttons"},P.map(F=>o0__default.default.createElement("button",{key:F,type:"button",className:`reservation-mode-button ${b.zitplaats===F?"active":""}`,onClick:()=>X0(F),"aria-pressed":b.zitplaats===F},F))),c.zitplaats&&o0__default.default.createElement("small",{className:"error"},c.zitplaats)),r?.account_type==="bowling"&&o0__default.default.createElement(S2,{duration:b.duration,handleChange:F=>{q(F),a0(["date","time","selectedTableNumbers","selectedTableIds"]);},min:r["general-settings"]?.minDuration||30,max:r["general-settings"]?.maxDuration||120,interval:r["general-settings"]?.durationInterval||30}),U&&b.guests>0&&o0__default.default.createElement(Fb,{guests:b.guests,formData:b,handleChange:q,resetFormDataFields:a0,restaurantData:r,reservations:l,startDate:f,onWeekChange:q0,reservationMode:O0,isAdmin:R}),U&&b.date&&o0__default.default.createElement(jb,{guests:b.guests,formData:b,handleChange:q,field:{id:"time",label:u.fields.time},selectedDate:b.date,setCurrentExpandedField:()=>{},restaurantData:r,reservations:l,reservationMode:O0,zitplaats:b.zitplaats||null,isAdmin:R}),x&&o0__default.default.createElement(y2,{availableTables:E,isFetching:S,formData:b,setFormData:W,handleChange:q}),S&&b.date&&b.time&&b.guests>0&&o0__default.default.createElement("div",{style:{textAlign:"center",padding:"10px",color:"#666",fontSize:"14px"}},"Beschikbare tafels berekenen..."))});Qb.displayName="ReservationStepOne";var yM=Qb;var SM=()=>localStorage.getItem("preferredLanguage")||"nl",j0=(b,c,q="nl")=>{let e=SM();return (b[e]||b[q]||{})[c]||{}};var $b={nl:{formField:{selectPlaceholder:"Selecteer een optie",tooltip:{confirm:"Klik om te Bevestigen",source:"Gevonden met Happy Ai"}}},en:{formField:{selectPlaceholder:"Select an option",tooltip:{confirm:"Click to Confirm",source:"Found with Happy Ai"}}},fr:{formField:{selectPlaceholder:"S\xE9lectionnez une option",tooltip:{confirm:"Cliquez pour confirmer",source:"Trouv\xE9 avec Happy Ai"}}}};R0(`.new-reservation-page .form-group .magic-tooltip{transition:transform .2s ease;transform-origin:bottom right}.new-reservation-page .form-group .magic-tooltip:hover{transform:scale(1.05)}.form-field-label{display:block;font-size:.8rem;font-weight:600;margin-bottom:4px;color:#333}.required-asterisk{color:red;margin-left:2px}.name-match-item{padding:8px 0;cursor:pointer;transition:background-color .15s ease}.name-match-item:hover{background-color:#f5f0f7}.name-match-item:not(:last-child){border-bottom:1px solid #f0f0f0}
|
|
42
|
-
`);var A4=({label:b,name:c,type:q="text",icon:e,value:W,onChange:n,onBlur:a,error:s,placeholder:r,halfWidth:R,options:v=[],selectPlaceholder:u,rightIcon:B,onRightIconClick:h,tooltipContent:f,tooltipAlign:g,required:l})=>{let N=j0($b,"formField"),C=u||N.selectPlaceholder,[E,y]=o0.useState(false),S=o0.useRef(null),m=o0.useRef(null),j=B,_=e;o0.useEffect(()=>{let Y=X=>{S.current&&!S.current.contains(X.target)&&(m.current&&clearTimeout(m.current),y(false));};return E&&document.addEventListener("mousedown",Y),()=>document.removeEventListener("mousedown",Y)},[E]);let A0={name:c,value:W,onChange:n,onBlur:a,"aria-label":b,className:`form-control ${s?"input-error":""}`,style:e?{paddingLeft:"35px",boxSizing:"border-box"}:{}},p0=()=>q==="select"?o0__default.default.createElement("select",{...A0},o0__default.default.createElement("option",{value:""},C),v.map(Y=>o0__default.default.createElement("option",{key:Y.value,value:Y.value},Y.label))):q==="textarea"?o0__default.default.createElement("textarea",{...A0,placeholder:r}):o0__default.default.createElement("input",{type:q,...A0,placeholder:r}),a0=q==="textarea";return o0__default.default.createElement("div",{className:`form-group ${R?"half-width":""}`,style:{position:"relative"
|
|
42
|
+
`);var A4=({label:b,name:c,type:q="text",icon:e,value:W,onChange:n,onBlur:a,error:s,placeholder:r,halfWidth:R,options:v=[],selectPlaceholder:u,rightIcon:B,onRightIconClick:h,tooltipContent:f,tooltipAlign:g,required:l})=>{let N=j0($b,"formField"),C=u||N.selectPlaceholder,[E,y]=o0.useState(false),S=o0.useRef(null),m=o0.useRef(null),j=B,_=e;o0.useEffect(()=>{let Y=X=>{S.current&&!S.current.contains(X.target)&&(m.current&&clearTimeout(m.current),y(false));};return E&&document.addEventListener("mousedown",Y),()=>document.removeEventListener("mousedown",Y)},[E]);let A0={name:c,value:W,onChange:n,onBlur:a,"aria-label":b,className:`form-control ${s?"input-error":""}`,style:e?{paddingLeft:"35px",boxSizing:"border-box"}:{}},p0=()=>q==="select"?o0__default.default.createElement("select",{...A0},o0__default.default.createElement("option",{value:""},C),v.map(Y=>o0__default.default.createElement("option",{key:Y.value,value:Y.value},Y.label))):q==="textarea"?o0__default.default.createElement("textarea",{...A0,placeholder:r}):o0__default.default.createElement("input",{type:q,...A0,placeholder:r}),a0=q==="textarea";return o0__default.default.createElement("div",{className:`form-group ${R?"half-width":""}`,style:{position:"relative"}},l&&b&&o0__default.default.createElement("label",{className:"form-field-label"},b," ",o0__default.default.createElement("span",{className:"required-asterisk"},"*")),o0__default.default.createElement("div",{className:"input-container",style:{position:"relative"}},_&&o0__default.default.createElement(_,{className:"input-icon",style:{position:"absolute",left:"10px",top:a0?"12px":"50%",transform:a0?"none":"translateY(-50%)",color:"#6c757d",pointerEvents:"none",zIndex:1}}),p0(),j&&o0__default.default.createElement("div",{className:"magic-wand-container",onClick:h,onMouseEnter:()=>{m.current&&clearTimeout(m.current),y(true);},onMouseLeave:()=>{m.current=setTimeout(()=>y(false),1200);},style:{position:"absolute",top:"50%",right:"10px",transform:"translateY(-50%)",cursor:"pointer"}},o0__default.default.createElement(j,{className:"magic-wand-icon",style:{color:"#B567C2"}}),E&&f&&o0__default.default.createElement("div",{ref:S,className:"magic-tooltip",style:{position:"absolute",bottom:"100%",...g==="left"?{left:0}:{right:0},backgroundColor:"#fff",color:"#333",borderRadius:"8px",fontSize:"0.9rem",boxShadow:"0px 4px 10px rgba(0,0,0,0.15)",zIndex:1e3,marginBottom:"8px",minWidth:"220px",overflow:"hidden"}},o0__default.default.createElement("div",{style:{position:"relative",zIndex:2,padding:"12px 20px"}},o0__default.default.createElement("div",{style:{borderBottom:"1px solid #eee",marginBottom:"8px",paddingBottom:"4px"}},f),o0__default.default.createElement("div",{style:{fontWeight:"bold",fontSize:"13px",textAlign:"center",marginTop:"8px"}},N.tooltip?.confirm),o0__default.default.createElement("div",{style:{fontSize:"0.7rem",textAlign:"center",color:"#999",marginTop:"4px"}},N.tooltip?.source))))),s&&o0__default.default.createElement("p",{className:"form-error"},s))},_0=o0__default.default.memo(A4);var V0=P0(c1());P0(Mp());var zp={nl:{reservationStepTwoFiltering:{labels:{menu:"Menu",firstName:"Voornaam",lastName:"Achternaam",email:"E-mail",phone:"Mobiel nummer",extraInfo:"Extra info",seatPlace:"Zitplaats"},placeholders:{firstName:"Voornaam",lastName:"Achternaam",email:"E-mailadres",phone:"Mobiel nummer",extraInfo:"Extra informatie",seatPlace:"Selecteer zitplaats"},magic:{title:"Gast Gegevens"}},reservationSummary:{title:"Reservatie Gegevens",guests:"Aantal gasten",date:"Datum",time:"Tijd",firstName:"Voornaam",lastName:"Achternaam",email:"E-mail",phone:"Mobiel nummer",menu:"Menu",staff:"Aangemaakt door",giftcard:"Cadeaubon",extraInfo:"Extra informatie",seatPlace:"Zitplaats",newReservationButton:"Nieuwe Reservatie Maken"}},en:{reservationStepTwoFiltering:{labels:{menu:"Menu",firstName:"First Name",lastName:"Last Name",email:"Email",phone:"Mobile Number",extraInfo:"Extra Info",seatPlace:"Seating area"},placeholders:{firstName:"First Name",lastName:"Last Name",email:"Email Address",phone:"Mobile Number",extraInfo:"Extra Information",seatPlace:"Select seating area"},magic:{title:"Guest Details"}},reservationSummary:{title:"Reservation Details",guests:"Number of Guests",date:"Date",time:"Time",firstName:"First Name",lastName:"Last Name",email:"Email",phone:"Mobile Number",menu:"Menu",staff:"Created by",giftcard:"Gift Card",extraInfo:"Extra Information",seatPlace:"Seating area",newReservationButton:"New Reservation"}},fr:{reservationStepTwoFiltering:{labels:{menu:"Menu",firstName:"Pr\xE9nom",lastName:"Nom",email:"E-mail",phone:"Num\xE9ro de portable",extraInfo:"Informations suppl\xE9mentaires",seatPlace:"Zone d\u2019assise"},placeholders:{firstName:"Pr\xE9nom",lastName:"Nom",email:"Adresse e-mail",phone:"Num\xE9ro de portable",extraInfo:"Informations suppl\xE9mentaires",seatPlace:"S\xE9lectionner une zone d\u2019assise"},magic:{title:"D\xE9tails Invit\xE9"}},reservationSummary:{title:"D\xE9tails de la R\xE9servation",guests:"Nombre d'invit\xE9s",date:"Date",time:"Heure",firstName:"Pr\xE9nom",lastName:"Nom",email:"E-mail",phone:"Num\xE9ro de portable",menu:"Menu",staff:"Cr\xE9\xE9 par",giftcard:"Carte Cadeau",extraInfo:"Informations suppl\xE9mentaires",seatPlace:"Zone d\u2019assise",newReservationButton:"Nouvelle R\xE9servation"}}};R0(`.new-reservation-page .name-fields{display:flex;gap:20px}.input-container .form-control{display:flex;align-items:center;justify-content:space-between;width:100%;padding:10px 10px 10px 35px;background-color:#fff;border:#ccc 1px solid;cursor:pointer;-webkit-user-select:none;user-select:none;text-align:left;border-radius:5px;font-size:16px;box-sizing:border-box}
|
|
43
43
|
`);var cp=o0__default.default.memo(({formData:b,errors:c,handleChange:q,setFormData:e,menuData:W})=>{let n=SM(),a=j0(zp,"reservationStepTwoFiltering"),[s,r]=o0.useState([]),[R,v]=o0.useState(false),[u,B]=o0.useState(null),[h,f]=o0.useState([]),g=o1(),l=fa.FaMagic,N=()=>{u&&E();};o0.useEffect(()=>{if(V0.default.locale(n),!b.date||!b.time||!W.length)return r([]);let Y=(0, V0.default)(`${b.date} ${b.time}`,"YYYY-MM-DD HH:mm"),X=W.filter(U=>{let x=Y.isBetween((0, V0.default)(U.startDate,"YYYY-MM-DD"),(0, V0.default)(U.endDate,"YYYY-MM-DD"),"day","[]"),I=(0, V0.default)(b.time,"HH:mm").isBetween((0, V0.default)(U.startHour,"HH:mm"),(0, V0.default)(U.endHour,"HH:mm"),"minute","[]"),V=(0, V0.default)(Y).locale("nl").format("dddd").toLowerCase(),c0=(0, V0.default)(Y).locale("en").format("dddd").toLowerCase(),O0=(U.daysOfWeek||[]).map(P=>P.toLowerCase()),d0=!O0.length||O0.includes(V)||O0.includes(c0);return x&&I&&d0});r(X);},[b.date,b.time,W,n]);let C=async()=>{if(R||u)return;let Y=(b.email||"").trim().toLowerCase(),X=(b.phone||"").trim(),U=Y&&[".com",".net",".be",".nl"].some(V=>Y.endsWith(V)),x=!!X&&(X.startsWith("+32")?X.length>=12:X.length>=10);if(!U&&!x)return;let I=[];U&&I.push("email"),x&&I.push("phone");try{let V=await g.post(`${window.baseDomain}api/autofill`,{email:Y,phone:X});V?.firstName&&V?.lastName&&V?.email&&V?.phone&&B({...V,sources:I});}catch{console.error("Autofill error");}};o0.useEffect(()=>{C();},[b.email,b.phone]);let E=()=>{u&&(e(Y=>({...Y,firstName:u.firstName,lastName:u.lastName,email:u.email,phone:u.phone})),v(true),B(null));},y=async()=>{let Y=(b.firstName||"").trim(),X=(b.lastName||"").trim();if(Y.length<2&&X.length<2){f([]);return}try{let U=await g.post(`${window.baseDomain}api/autofill-name`,{firstName:Y||void 0,lastName:X||void 0});Array.isArray(U)&&U.length>0?f(U):f([]);}catch{f([]);}},S=Y=>{e(X=>({...X,firstName:Y.firstName,lastName:Y.lastName,email:Y.email,phone:Y.phone})),f([]),v(true);};o0.useEffect(()=>{if(R)return;let Y=(b.firstName||"").trim(),X=(b.lastName||"").trim();if(Y.length<2&&X.length<2){f([]);return}f([]);let U=setTimeout(()=>{y();},500);return ()=>clearTimeout(U)},[b.firstName,b.lastName]);let m=o0.useMemo(()=>{if(!u)return {email:{},phone:{}};let Y=u.sources.includes("email")&&(b.email||"").trim().toLowerCase()===u.email.trim().toLowerCase(),X=u.sources.includes("phone")&&(b.phone||"").trim()===u.phone.trim(),U={rightIcon:l,onRightIconClick:N};return {email:Y?{...U,tooltipContent:o0__default.default.createElement("div",null,o0__default.default.createElement("div",{style:{textAlign:"center",fontWeight:"bold"}},a.magic?.title),o0__default.default.createElement("div",null,u.firstName," ",u.lastName),o0__default.default.createElement("div",null,u.phone))}:{},phone:X?{...U,tooltipContent:o0__default.default.createElement("div",null,o0__default.default.createElement("div",{style:{textAlign:"center",fontWeight:"bold"}},a.magic?.title),o0__default.default.createElement("div",null,u.firstName," ",u.lastName),o0__default.default.createElement("div",null,u.email))}:{}}},[u,b.email,b.phone,a.magic?.title]),j=o0.useMemo(()=>{if(!h.length)return {firstName:{},lastName:{}};let X=(b.lastName||"").trim().length>0?"lastName":"firstName",U=o0__default.default.createElement("div",{style:{maxHeight:"200px",overflowY:"auto"}},h.map((I,V)=>o0__default.default.createElement("div",{key:V,className:"name-match-item",onClick:c0=>{c0.stopPropagation(),S(I);}},o0__default.default.createElement("div",{style:{fontWeight:"500"}},I.firstName," ",I.lastName),o0__default.default.createElement("div",{style:{fontSize:"0.8rem",color:"#666"}},I.email),I.phone&&o0__default.default.createElement("div",{style:{fontSize:"0.8rem",color:"#666"}},I.phone)))),x={rightIcon:fa.FaMagic,onRightIconClick:()=>{},tooltipContent:o0__default.default.createElement("div",null,o0__default.default.createElement("div",{style:{textAlign:"center",fontWeight:"bold"}},a.magic?.title),U)};return {firstName:X==="firstName"?{...x,tooltipAlign:"left"}:{},lastName:X==="lastName"?x:{}}},[h,b.lastName,a.magic?.title]),{reservationMode:_}=b,H=_==="check_in",A0=window.generalSettings?.obligatedFields||[],p0=Y=>A0.includes(Y),a0=Y=>!H&&p0(Y),q0=(Y,X)=>{let U=a.labels?.[Y]||X;return H?`${U} (Optioneel)`:p0(Y)?`${U} *`:U};return o0__default.default.createElement("div",{className:"reservation-step-two"},o0__default.default.createElement("div",{className:"account-manage-form"},s.length>0&&o0__default.default.createElement(_0,{label:`${a.labels?.menu||"Menu"}${H?" (Optioneel)":""}`,name:"menu",type:"select",options:s.map(Y=>({value:Y.name,label:Y.name})),value:b.menu,onChange:q,error:H?null:c.menu}),o0__default.default.createElement("div",{className:"name-fields"},o0__default.default.createElement(_0,{label:q0("firstName","Voornaam"),name:"firstName",placeholder:a.placeholders?.firstName||"",value:b.firstName,onChange:q,error:H?null:c.firstName,icon:fa.FaUser,required:a0("firstName"),...j.firstName}),o0__default.default.createElement(_0,{label:q0("lastName","Achternaam"),name:"lastName",placeholder:a.placeholders?.lastName||"",value:b.lastName,onChange:q,error:H?null:c.lastName,icon:fa.FaUser,required:a0("lastName"),...j.lastName})),o0__default.default.createElement(_0,{label:q0("email","Email"),name:"email",type:"email",placeholder:a.placeholders?.email||"",value:b.email,onChange:q,onBlur:C,error:c.email,icon:fa.FaEnvelope,required:a0("email"),...m.email}),o0__default.default.createElement(_0,{label:q0("phone","Telefoon"),name:"phone",type:"tel",placeholder:a.placeholders?.phone||"",value:b.phone,onChange:q,onBlur:C,error:c.phone,icon:fa.FaPhone,required:a0("phone"),...m.phone}),o0__default.default.createElement(_0,{label:a.labels?.extraInfo||"Extra info",name:"extraInfo",type:"textarea",placeholder:a.placeholders?.extraInfo||"",value:b.extraInfo,onChange:q,error:c.extraInfo,icon:fa.FaInfoCircle})))});cp.displayName="ReservationStepTwo";var k2=cp;var Ap={nl:{reservationStepTwoFiltering:{labels:{menu:"Menu",firstName:"Voornaam",lastName:"Achternaam",email:"E-mail",phone:"Mobiel nummer",extraInfo:"Extra info",seatPlace:"Zitplaats"},placeholders:{firstName:"Voornaam",lastName:"Achternaam",email:"E-mailadres",phone:"Mobiel nummer",extraInfo:"Extra informatie",seatPlace:"Selecteer zitplaats"},magic:{title:"Gast Gegevens"}},reservationSummary:{title:"Reservatie Gegevens",guests:"Aantal gasten",date:"Datum",time:"Tijd",firstName:"Voornaam",lastName:"Achternaam",email:"E-mail",phone:"Mobiel nummer",menu:"Menu",staff:"Aangemaakt door",giftcard:"Cadeaubon",extraInfo:"Extra informatie",seatPlace:"Zitplaats",newReservationButton:"Nieuwe Reservatie Maken"}},en:{reservationStepTwoFiltering:{labels:{menu:"Menu",firstName:"First Name",lastName:"Last Name",email:"Email",phone:"Mobile Number",extraInfo:"Extra Info",seatPlace:"Seating area"},placeholders:{firstName:"First Name",lastName:"Last Name",email:"Email Address",phone:"Mobile Number",extraInfo:"Extra Information",seatPlace:"Select seating area"},magic:{title:"Guest Details"}},reservationSummary:{title:"Reservation Details",guests:"Number of Guests",date:"Date",time:"Time",firstName:"First Name",lastName:"Last Name",email:"Email",phone:"Mobile Number",menu:"Menu",staff:"Created by",giftcard:"Gift Card",extraInfo:"Extra Information",seatPlace:"Seating area",newReservationButton:"New Reservation"}},fr:{reservationStepTwoFiltering:{labels:{menu:"Menu",firstName:"Pr\xE9nom",lastName:"Nom",email:"E-mail",phone:"Num\xE9ro de portable",extraInfo:"Informations suppl\xE9mentaires",seatPlace:"Zone d\u2019assise"},placeholders:{firstName:"Pr\xE9nom",lastName:"Nom",email:"Adresse e-mail",phone:"Num\xE9ro de portable",extraInfo:"Informations suppl\xE9mentaires",seatPlace:"S\xE9lectionner une zone d\u2019assise"},magic:{title:"D\xE9tails Invit\xE9"}},reservationSummary:{title:"D\xE9tails de la R\xE9servation",guests:"Nombre d'invit\xE9s",date:"Date",time:"Heure",firstName:"Pr\xE9nom",lastName:"Nom",email:"E-mail",phone:"Num\xE9ro de portable",menu:"Menu",staff:"Cr\xE9\xE9 par",giftcard:"Carte Cadeau",extraInfo:"Informations suppl\xE9mentaires",seatPlace:"Zone d\u2019assise",newReservationButton:"Nouvelle R\xE9servation"}}};R0(`.new-reservation-page .reservation-sidebar-component .reservation-summary .modal-title{margin-top:0;margin-bottom:20px}.new-reservation-page .reservation-sidebar-component .reservation-summary .reservation-details{list-style-type:none;padding:0;margin:0 0 20px;width:100%}.new-reservation-page .reservation-sidebar-component .reservation-summary .reservation-details li{margin-bottom:10px;font-size:15px;align-items:left;text-align:left}.new-reservation-page .reservation-sidebar-component .reservation-summary .reservation-details li strong{font-weight:700}.new-reservation-page .reservation-sidebar-component .reservation-summary{align-items:left}
|
|
44
44
|
`);var a4=({formData:b,onNewReservation:c})=>{let q=j0(Ap,"reservationSummary");return o0__default.default.createElement("div",{className:"reservation-summary"},o0__default.default.createElement("ul",{className:"reservation-details"},o0__default.default.createElement("li",null,o0__default.default.createElement("strong",null,q.title)),o0__default.default.createElement("li",null,o0__default.default.createElement("strong",null,q.guests,":")," ",b.guests),o0__default.default.createElement("li",null,o0__default.default.createElement("strong",null,q.date,":")," ",b.date),o0__default.default.createElement("li",null,o0__default.default.createElement("strong",null,q.time,":")," ",b.time),o0__default.default.createElement("li",null,o0__default.default.createElement("strong",null,q.firstName,":")," ",b.firstName),o0__default.default.createElement("li",null,o0__default.default.createElement("strong",null,q.lastName,":")," ",b.lastName),o0__default.default.createElement("li",null,o0__default.default.createElement("strong",null,q.email,":")," ",b.email),o0__default.default.createElement("li",null,o0__default.default.createElement("strong",null,q.phone,":")," ",b.phone),b.menu&&o0__default.default.createElement("li",null,o0__default.default.createElement("strong",null,q.menu,":")," ",b.menu),b.personeel&&o0__default.default.createElement("li",null,o0__default.default.createElement("strong",null,q.staff,":")," ",b.personeel),b.giftcard&&o0__default.default.createElement("li",null,o0__default.default.createElement("strong",null,q.giftcard,":")," ",b.giftcard),b.extraInfo&&o0__default.default.createElement("li",null,o0__default.default.createElement("strong",null,q.extraInfo,":")," ",b.extraInfo),b.zitplaats&&o0__default.default.createElement("li",null,o0__default.default.createElement("strong",null,q.seatPlace,":")," ",b.zitplaats)),o0__default.default.createElement("button",{className:"button-style-3",onClick:c},q.newReservationButton))},w2=a4;var op={nl:{zitplaatsSelection:{labels:{seating:"Zitplaats"},options:{noPreference:"Geen voorkeur"}},giftcardSelection:{labels:{giftcard:"Cadeaubon"},options:{noGiftcard:"Geen Cadeaubon"}}},en:{zitplaatsSelection:{labels:{seating:"Seating"},options:{noPreference:"No preference"}},giftcardSelection:{labels:{giftcard:"Gift Card"},options:{noGiftcard:"No Gift Card"}}},fr:{zitplaatsSelection:{labels:{seating:"Place Assise"},options:{noPreference:"Pas de pr\xE9f\xE9rence"}},giftcardSelection:{labels:{giftcard:"Cadeau"},options:{noGiftcard:"Pas de carte"}}}};R0(`.new-reservation-page .giftcard-selection{margin-bottom:20px}.new-reservation-page .giftcard-options{display:flex;gap:20px;margin:10px 0}.new-reservation-page .giftcard-option{display:flex;align-items:center;gap:8px;cursor:pointer}.new-reservation-page .form-label{font-weight:500;margin-bottom:8px;display:block}.new-reservation-page .giftcard-option input[type=radio]{margin:0;cursor:pointer}.new-reservation-page .giftcard-option label{cursor:pointer}
|
|
45
45
|
`);var r4=({restaurantData:b,formData:c,handleChange:q,resetFormDataFields:e})=>{let W=j0(op,"giftcardSelection"),[n,a]=o0.useState([]);if(o0.useEffect(()=>{if(!b)return;let R=["breakfast","lunch","dinner"],v=new Set;R.forEach(u=>{let B=b[`openinghours-${u}`]?.schemeSettings||{};Object.values(B).forEach(h=>{h?.giftcardsEnabled&&Array.isArray(h.giftcards)&&h.giftcards.forEach(f=>{let g=typeof f=="string"?f.trim():String(f||"").trim();g&&v.add(g);});});}),a([...v]);},[b]),!n.length)return null;let s=n.map(R=>({value:R,label:R})),r=R=>{q({target:{name:"giftcard",value:R.target.value}}),e(["date","time"]);};return o0__default.default.createElement("div",{className:"giftcard-selection"},o0__default.default.createElement(_0,{label:W.labels?.giftcard||"Giftcard",name:"giftcard",type:"select",options:s,value:c.giftcard||"",onChange:r,selectPlaceholder:W.options?.noGiftcard||"Geen giftcard"}))},x2=r4;var P2=P0(c1());var ep={nl:{reservationSidebar:{saveButton:"Opslaan",saveButtonLoading:"Opslaan..."}},en:{reservationSidebar:{saveButton:"Save",saveButtonLoading:"Saving..."}},fr:{reservationSidebar:{saveButton:"Enregistrer",saveButtonLoading:"Enregistrement..."}}};R0(`.reservation-sidebar-component{position:fixed;top:0;right:-400px;width:400px;height:100%;background-color:#fff;box-shadow:-2px 0 5px #0000001a;z-index:var(--z-index-sidebar-reservation);display:flex;flex-direction:column;overflow-y:auto;transition:right .3s ease-in-out}.admin-title{text-align:center;margin-bottom:30px}.reservation-sidebar-component.open{right:0}.reservation-sidebar-content{padding:60px 20px 20px}.close-sidebar-button{position:absolute;top:10px;left:10px;background-color:transparent;border:none;cursor:pointer}.close-sidebar-button svg{color:#000}.sidebar-section-one,.sidebar-section-two{margin-bottom:20px}.reservation-footer{margin-top:auto}.store-reservation-button{width:100%;padding:12px;background-color:var(--color-blue);color:#fff;border:none;border-radius:5px;cursor:pointer;font-size:1.1rem}.open-sidebar-button{position:fixed;bottom:20px;right:20px;background-color:var(--color-blue);color:#fff;border:none;border-radius:50%;width:50px;height:50px;cursor:pointer;z-index:var(--z-index-modal)!important;transition:all .3s ease}.open-sidebar-button:hover{background-color:var(--color-blue-hover-accent)!important}.open-sidebar-button svg{position:relative;top:2px}@media screen and (max-width:480px){.reservation-sidebar-component{width:100%}}.sidebar-section-personeel{margin-bottom:10px}.sidebar-tabs{display:flex;border-bottom:1px solid #ddd;margin-bottom:20px}.sidebar-tab-button{flex:1;padding:10px;border:none;background:transparent;border-bottom:none;font-weight:400;cursor:pointer;color:#666}.sidebar-tab-button.active{border-bottom:2px solid var(--color-blue);font-weight:700;color:var(--color-blue)}
|
package/dist/index.mjs
CHANGED
|
@@ -9,7 +9,7 @@ Checking Time: ${v} -> Determined Meal: ${B}`),!B){N0(` Time ${v} has no associ
|
|
|
9
9
|
`);var AA=({setGuests:b,value:c,onChange:q})=>{let e=[1,2,3,"4+"],[W,n]=useState(c||""),[a,s]=useState(false),r=u=>{u==="4+"?(s(true),n(4),b(4),q({target:{name:"guests",value:4}})):(s(false),n(u),b(u),q({target:{name:"guests",value:u}}));},R=u=>{let B=u.target.value;n(B),b(B),q({target:{name:"guests",value:B}});},v=u=>{let B=u.target.value;n(B),b(B),q({target:{name:"guests",value:B}});};return o0.createElement("div",{className:"value-selector",translate:"no"},o0.createElement("div",{className:"predefined-values"},e.map(u=>o0.createElement("button",{key:u,type:"button",className:`predefined-value-button ${W==u||u==="4+"&&a?"active":""}`,onClick:()=>r(u)},u==="4+"?"4+":`${u} p`))),o0.createElement(AnimatePresence,null,a&&o0.createElement(motion.div,{className:"slider-container",initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0}},o0.createElement("input",{type:"range",min:"4",max:"15",step:"1",value:W,onChange:R,className:"slider non-absolute"}),o0.createElement("input",{type:"number",name:"guests",value:W,onChange:v,className:"value-input",min:"4",max:"100",step:"1"}))))},d2=AA;var u1=P0(c1());var Ez=P0(c1()),kz=b=>{let c=(0, Ez.default)().tz("Europe/Brussels").startOf("day");return b.clone().add(6,"days").endOf("day").isBefore(c)},wz=(b,c)=>b.isSame(c,"day");R0(`.new-reservation-page .calendar-container{position:relative;width:100%}.new-reservation-page .calendar-container .calendar-display{display:flex;align-items:center;justify-content:space-between;width:100%;padding:10px;background-color:#fff;border:#ccc 1px solid;cursor:pointer;user-select:none;text-align:left;border-radius:5px}.new-reservation-page .calendar-container .calendar-display span:first-child{flex-grow:1}.new-reservation-page .calendar-container .calendar{position:absolute;z-index:1000;width:100%;background-color:#fff;border:1px solid #ccc;margin-top:5px;padding:10px;border-radius:10px;animation:fadeInCalendar .3s ease-in-out;box-shadow:0 2px 10px #0000001a}@keyframes fadeInCalendar{0%{opacity:0}to{opacity:1}}.new-reservation-page .calendar-container .availability-hold-btn{font-size:10px}.new-reservation-page .calendar-container .calendar-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;gap:8px;flex-wrap:wrap}.new-reservation-page .calendar-container .calendar-header button{background-color:transparent;border:none;cursor:pointer;font-size:18px}.new-reservation-page .calendar-container .calendar-header span{font-size:15px;color:gray;font-weight:500}.new-reservation-page .calendar-container .calendar-weeks-wrapper{overflow:hidden;position:relative;width:100%}.new-reservation-page .calendar-container .calendar-table{width:100%;border-collapse:collapse}.new-reservation-page .calendar-container .calendar-table th,.new-reservation-page .calendar-container .calendar-table td{width:14.28%;text-align:center;padding:5px}.calendar-container .calendar-table th{color:#666;font-weight:400;padding-bottom:10px}.new-reservation-page .calendar-container .calendar-table td{vertical-align:middle;cursor:pointer;border:none;opacity:1;position:relative}.new-reservation-page .calendar-container .calendar-table td.empty-day{cursor:default}.new-reservation-page .calendar-container .calendar-table td:hover .day-square.available{transform:scale(1.05)}.new-reservation-page .calendar-container .day-square{position:relative;width:38px;height:38px;border-radius:4px;display:inline-flex;align-items:center;justify-content:center;flex-direction:column;transition:all .2s ease;font-size:16px;margin:0 auto}.new-reservation-page .calendar-container .day-number{line-height:1;z-index:2}.new-reservation-page .calendar-container .available .day-square{background-color:#cfc;color:#060}.new-reservation-page .calendar-container .available:hover .day-square{background-color:#b3ffb3}.new-reservation-page .calendar-container .available:active .day-square{background-color:#9f9}.new-reservation-page .calendar-container .unavailable .day-square{background-color:#8b000021;color:#8b0000}.new-reservation-page .calendar-container .gray-out .day-square{background-color:#e0e0e0;color:#999;cursor:not-allowed}.new-reservation-page .calendar-container .selected .day-square{background-color:#060;color:#cfc}.new-reservation-page .calendar-container .has-blocked-slots .day-square{background-color:#8b000021;color:#8b0000}.new-reservation-page .calendar-container .has-blocked-slots:hover .day-square{background-color:#8b000033}.new-reservation-page .calendar-container .has-blocked-slots.selected .day-square{background-color:#8b0000;color:#fff}.new-reservation-page .calendar-container .calendar-table td.unavailable,.new-reservation-page .calendar-container .calendar-table td.gray-out{cursor:not-allowed}.new-reservation-page .calendar-container .calendar-table td.unavailable:hover .day-square,.new-reservation-page .calendar-container .calendar-table td.gray-out:hover .day-square{transform:none}.new-reservation-page .calendar-container .calendar-table td{border:none}.new-reservation-page .calendar-container .arrow{margin-left:auto;color:gray;display:flex;align-items:center}.new-reservation-page .calendar-container .available .availability-badge{background:#38a169}.new-reservation-page .calendar-container .selected .availability-badge{background:#2d3748}@media screen and (max-width:900px){.calendar-container .day-square{width:35px!important;height:35px!important;font-size:15px!important}.calendar-container .calendar-header span{font-size:12px}.new-reservation-page .calendar-container .availability-toggle-btn{padding:5px 8px;font-size:11px}}
|
|
10
10
|
`);var d1=P0(Y1());var XM=class{constructor(c=6e4){this.cache=new Map,this.ttl=c;}generateKey(c,...q){return `${c}::${JSON.stringify(q)}`}get(c){let q=this.cache.get(c);return q?Date.now()-q.timestamp>this.ttl?(this.cache.delete(c),null):q.value:null}set(c,q){this.cache.set(c,{value:q,timestamp:Date.now()});}clear(){this.cache.clear();}cleanup(){let c=Date.now();for(let[q,e]of this.cache.entries())c-e.timestamp>this.ttl&&this.cache.delete(q);}},T2=new XM;setInterval(()=>T2.cleanup(),3e4);var F0=(b,c,...q)=>{let e=T2.generateKey(b,...q),W=T2.get(e);if(W!==null)return W;let n=c(...q);return T2.set(e,n),n};var a1={nl:{reservationStepOne:{errors:{openingHoursNotSet:"Openingstijden niet ingesteld.",clickHereToSet:"Klik hier om uw openingsuren in te stellen."},modes:{withLimits:"Met Limieten",unlimited:"Onbeperkt",openingHours:"Openingsuren",free:"Vrij"},fields:{time:"Tijd"},messages:{searchingTables:"Beschikbare tafels zoeken...",noTablesAvailable:"Geen specifieke tafels beschikbaar voor deze selectie."},warnings:{unlimitedMode:"Onbeperkt zal geen rekening houden met maximum limieten.",dateNotAvailableWithLimits:"Let op: deze datum is niet beschikbaar met limieten voor dit aantal gasten. De modus is automatisch overgezet naar onbeperkt vrij."}},calendar:{selectDatePlaceholder:"Selecteer een datum",today:"Vandaag",tomorrow:"Morgen",prevWeek:"Vorige week",nextWeek:"Volgende week",dayHeaders:["Ma","Di","Wo","Do","Vr","Za","Zo"],seatsQuestion:"Zitplaatsen?"},timeSelector:{shifts:{breakfast:"Ontbijt",lunch:"Lunch",dinner:"Diner"},selectMeal:"Selecteer een maaltijd",selectTime:"Selecteer een tijd",noDateSelected:"Selecteer eerst een datum.",noTimes:"Geen beschikbare tijden.",back:"Terug",reservations:"Reservaties",guests:"Gasten"},tableSelector:{label:"Selecteer beschikbare tafel(s):",table:"Tafel",max:"Max",noTables:"Geen specifieke tafels beschikbaar voor deze tijd/gasten combinatie.",manual:"Handmatig"}},en:{reservationStepOne:{errors:{openingHoursNotSet:"Opening hours not set.",clickHereToSet:"Click here to set your opening hours."},modes:{withLimits:"With Limits",unlimited:"Unlimited",openingHours:"Opening Hours",free:"Free"},fields:{time:"Time"},messages:{searchingTables:"Searching for available tables...",noTablesAvailable:"No specific tables available for this selection."},warnings:{unlimitedMode:"Unlimited will not take into account maximum limits.",dateNotAvailableWithLimits:"Note: this date is not available with limits for this number of guests. The mode has been automatically switched to unlimited free."}},calendar:{selectDatePlaceholder:"Select a date",today:"Today",tomorrow:"Tomorrow",prevWeek:"Previous week",nextWeek:"Next week",dayHeaders:["M","T","W","T","F","S","S"],seatsQuestion:"Seating?"},timeSelector:{shifts:{breakfast:"Breakfast",lunch:"Lunch",dinner:"Dinner"},selectMeal:"Select a meal",selectTime:"Select a time",noDateSelected:"Please select a date first.",noTimes:"No available times.",back:"Back",reservations:"Reservations",guests:"Guests"},tableSelector:{label:"Select available table(s):",table:"Table",max:"Max",noTables:"No specific tables available for this time/guest combination.",manual:"Manual"}},fr:{reservationStepOne:{errors:{openingHoursNotSet:"Horaires non d\xE9finies.",clickHereToSet:"Cliquez ici pour d\xE9finir vos horaires."},modes:{withLimits:"Avec Limites",unlimited:"Illimit\xE9",openingHours:"Horaires",free:"Libre"},fields:{time:"Heure"},messages:{searchingTables:"Recherche de tables disponibles...",noTablesAvailable:"Aucune table sp\xE9cifique disponible pour cette s\xE9lection."},warnings:{unlimitedMode:"Illimit\xE9 ne tiendra pas compte des limites maximales.",dateNotAvailableWithLimits:"Attention : cette date n'est pas disponible avec limites pour ce nombre de convives. Le mode a \xE9t\xE9 automatiquement bascul\xE9 vers illimit\xE9 libre."}},calendar:{selectDatePlaceholder:"S\xE9lectionnez une date",today:"Aujourd'hui",tomorrow:"Demain",prevWeek:"Semaine pr\xE9c\xE9dente",nextWeek:"Semaine suivante",dayHeaders:["Lu","Ma","Me","Je","Ve","Sa","Di"],seatsQuestion:"Places ?"},timeSelector:{shifts:{breakfast:"Petit-d\xE9jeuner",lunch:"D\xE9jeuner",dinner:"D\xEEner"},selectMeal:"S\xE9lectionnez un repas",selectTime:"S\xE9lectionnez une heure",noDateSelected:"Veuillez d'abord s\xE9lectionner une date.",noTimes:"Aucun horaire disponible.",back:"Retour",reservations:"R\xE9servations",guests:"Convives"},tableSelector:{label:"S\xE9lectionnez les table(s) disponibles :",table:"Table",max:"Max",noTables:"Aucune table sp\xE9cifique disponible pour cette combinaison temps/convives.",manual:"Manuel"}}};var Pb=memo(({guests:b,selectedDate:c,onSelectDate:q,autoExpand:e,reservationMode:W,restaurantData:n,startDate:a,onWeekChange:s,reservations:r,giftcard:R,zitplaats:v,isAdmin:u=false})=>{let B=localStorage.getItem("preferredLanguage")||"nl",h=a1[B].calendar,[f,g]=useState(e||false),[l,N]=useState(false),C=useRef(null),E=useRef(null),y=(0, u1.default)().tz("Europe/Amsterdam").add(1,"year").endOf("day");useEffect(()=>{e&&g(true);},[e]),useEffect(()=>{let x=I=>{C.current&&!C.current.contains(I.target)&&(g(false),N(false));};return document.addEventListener("mousedown",x),()=>{document.removeEventListener("mousedown",x);}},[]),useEffect(()=>()=>{E.current&&(clearTimeout(E.current),E.current=null);},[]);let S=()=>{E.current&&(clearTimeout(E.current),E.current=null),N(true);},m=(x=1e3)=>{E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{N(false),E.current=null;},x);},j=useCallback((x,I,V=[])=>{if(x.isBefore(I,"day")||x.isAfter(y,"day"))return 0;let c0=x.format("YYYY-MM-DD");if(W==="vrije_keuze")return 21;if(W!=="met_limieten"&&!l)return (0, d1.isDateAvailable)(n,c0,r,-1e4,V,null,u)?21:0;let O0=n?.["table-settings"]||{},d0=O0.isInstalled===true&&O0.assignmentMode==="automatic"&&(l||W==="met_limieten"),P=J=>d0?F0("isDateAvailableWithTableCheck",d1.isDateAvailableWithTableCheck,n,c0,r,J,V,null,u,null,v||null):F0("isDateAvailable",d1.isDateAvailable,n,c0,r,J,V,null,u);if(!P(1))return 0;if(P(21))return 21;let X0=1,F=21,k=1;for(;X0<=F;){let J=Math.floor((X0+F)/2);P(J)?(k=J,X0=J+1):F=J-1;}return k},[n,r,R,u,W,l]),_=useMemo(()=>{if(!f)return [];let x=[],I=(0, u1.default)().tz("Europe/Amsterdam").startOf("day"),V=a||I,c0=n?.["blocked-slots"]||[],O0=V.clone().startOf("month"),d0=V.clone().endOf("month"),P=n?.["table-settings"]||{},X0=P.isInstalled===true&&P.assignmentMode==="automatic"&&W==="met_limieten",F=O0.clone();for(;F.isSameOrBefore(d0,"day");){let k=F.format("YYYY-MM-DD"),J;if(W==="vrije_keuze")J=F.isBetween(I,y,null,"[]");else {let T0=W!=="met_limieten"?-1e4:b,f0=W==="met_limieten"?R:null;X0?J=F0("isDateAvailableWithTableCheck",d1.isDateAvailableWithTableCheck,n,k,r,T0,c0,f0,u,null,v||null):J=F0("isDateAvailable",d1.isDateAvailable,n,k,r,T0,c0,f0,u);}let z0=j(F,I,c0),u0=false;u&&J&&W!=="vrije_keuze"&&(u0=!F0("isDateAvailable",d1.isDateAvailable,n,k,r,W!=="met_limieten"?-1e4:b,c0,W==="met_limieten"?R:null,false)),x.push({date:F.clone(),isPast:F.isBefore(I,"day"),isFuture:F.isAfter(y,"day"),isAvailable:J,maxGuestsAvailable:z0,isClosedForCustomers:u0}),F.add(1,"day");}return x},[f,a,b,W,n,r,R,v,l,u]),H=x=>{x.isAvailable&&!x.isPast&&!x.isFuture&&(q(x.date.format("YYYY-MM-DD")),g(false),N(false));},A0=()=>{let x=a.clone().subtract(1,"month").startOf("month"),I=(0, u1.default)().tz("Europe/Amsterdam").startOf("day");if(x.clone().endOf("month").isBefore(I,"day")){console.log("Cannot go to previous month. It is in the past.");return}s(x);},p0=()=>{let x=a.clone().add(1,"month").startOf("month");s(x);},a0=()=>{if(!c)return h.selectDatePlaceholder;let x=(0, u1.default)(c,"YYYY-MM-DD").tz("Europe/Amsterdam").startOf("day"),I=(0, u1.default)().tz("Europe/Amsterdam").startOf("day"),V=I.clone().add(1,"day");return x.isSame(I,"day")?h.today:x.isSame(V,"day")?h.tomorrow:x.format("dddd D MMMM YYYY")},Y=a?(x=>{let V=a.clone().startOf("month").day(),c0=V===0?6:V-1,O0=[];for(let F=0;F<c0;F++)O0.push(null);O0.push(...x);let d0=O0.length,P=Math.ceil(d0/7);for(;O0.length<P*7;)O0.push(null);let X0=[];for(let F=0;F<P;F++){let k=O0.slice(F*7,F*7+7);X0.push(k);}return X0})(_):[],X=h.dayHeaders,U=x=>x>=21?"20+":String(x);return o0.createElement("div",{className:"calendar-container",ref:C},o0.createElement("div",{className:"calendar-display",onClick:()=>{let x=!f;g(x),x&&window.dispatchEvent(new CustomEvent("calendarExpanded"));}},o0.createElement("span",null,a0()),o0.createElement("span",{className:"arrow"},o0.createElement("svg",{width:"12",height:"12",viewBox:"0 0 24 24",style:{transform:f?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"}},o0.createElement("path",{d:"M7 10l5 5 5-5",fill:"none",stroke:"currentColor",strokeWidth:"2"})))),f&&a&&o0.createElement("div",{className:"calendar"},o0.createElement("div",{className:"calendar-header"},o0.createElement("button",{type:"button",onClick:A0,"aria-label":h.prevWeek},"<"),o0.createElement("span",null,a.format("MMMM YYYY")),o0.createElement("button",{type:"button",onClick:p0,"aria-label":h.nextWeek},">"),o0.createElement("button",{type:"button",className:`availability-hold-btn ${l?"active":""}`,"aria-pressed":l,"aria-label":"Houd ingedrukt om beschikbaarheden te tonen",onMouseDown:S,onMouseUp:()=>m(1e3),onMouseLeave:()=>m(1e3),onTouchStart:S,onTouchEnd:()=>m(1e3),onTouchCancel:()=>m(1e3),onKeyDown:x=>{(x.key===" "||x.key==="Enter")&&S();},onKeyUp:x=>{(x.key===" "||x.key==="Enter")&&m(1e3);},style:{fontSize:"15px",color:"gray",fontWeight:"450",textDecoration:"underline"}},h.seatsQuestion)),o0.createElement("div",{className:"calendar-weeks-wrapper"},o0.createElement("table",{className:"calendar-table"},o0.createElement("thead",null,o0.createElement("tr",{translate:"no"},X.map((x,I)=>o0.createElement("th",{key:I},x)))),o0.createElement("tbody",null,Y.map((x,I)=>o0.createElement("tr",{key:I,translate:"no"},x.map((V,c0)=>{if(!V)return o0.createElement("td",{key:c0,className:"empty-day"});let O0=c&&wz(V.date,(0, u1.default)(c,"YYYY-MM-DD").tz("Europe/Amsterdam")),d0=[];return V.isPast?d0.push("gray-out"):V.isClosedForCustomers?d0.push("has-blocked-slots"):V.isAvailable?d0.push("available"):d0.push("unavailable"),O0&&d0.push("selected"),o0.createElement("td",{key:c0,className:d0.join(" "),onClick:()=>H(V),style:{"--animation-order":c0+I*7}},o0.createElement("div",{className:`day-square ${l?"showing-availabilities":""}`},o0.createElement("span",{className:"day-number"},l?U(V.maxGuestsAvailable):V.date.date())))}))))))))});Pb.displayName="Calendar";var _b=Pb;var TM=P0(c1()),Ho=({guests:b,formData:c,handleChange:q,resetFormDataFields:e,restaurantData:W,reservations:n,startDate:a,onWeekChange:s,reservationMode:r,isAdmin:R=false})=>{let v=B=>{let h=(0, TM.default)(B).format("YYYY-MM-DD");console.log("Selected date:",h),q({target:{name:"date",value:h}}),e(["time"]);},u=a?a.clone().startOf("month"):(0, TM.default)().startOf("month");return o0.createElement("div",{className:"form-group date-selector-container"},o0.createElement(_b,{guests:b,selectedDate:c.date||null,onSelectDate:v,autoExpand:false,reservationMode:r,restaurantData:W,startDate:u,onWeekChange:s,reservations:n,giftcard:c.giftcard,zitplaats:c.zitplaats,isAdmin:R}))},Fb=Ho;R0(`.new-reservation-page .time-selector-container{position:relative}.new-reservation-page .time-display{display:flex;align-items:center;justify-content:space-between;width:100%;padding:10px;background-color:#fff;border:#ccc 1px solid;cursor:pointer;user-select:none;text-align:left;border-radius:5px}.new-reservation-page .time-display span:first-child{flex-grow:1}.new-reservation-page .time-selector{position:absolute;z-index:1000;width:100%;max-height:350px;overflow-y:auto;background-color:#fff;border:1px solid #ccc;padding:10px;border-radius:10px;animation:fadeInTimeSelector .3s ease-in-out;top:75px}.new-reservation-page .time-toggle-container{display:flex;gap:8px;padding-bottom:10px;margin-bottom:10px;border-bottom:1px solid #eee}.new-reservation-page .time-toggle-btn{display:inline-flex;align-items:center;gap:6px;padding:6px 14px;border-radius:20px;border:1px solid #ddd;background-color:#f5f5f5;color:#666;font-size:13px;cursor:pointer;transition:all .2s ease;font-family:inherit}.new-reservation-page .time-toggle-btn:hover{background-color:#e8e8e8;border-color:#ccc}.new-reservation-page .time-toggle-btn.active{background-color:var(--color-blue, #48aaaf);border-color:var(--color-blue, #48aaaf);color:#fff}.new-reservation-page .time-toggle-btn.active:hover{background-color:var(--color-blue, #48aaaf);filter:brightness(.95)}.new-reservation-page .time-toggle-btn svg{flex-shrink:0}.new-reservation-page .time-count{font-weight:400;opacity:.9}@keyframes fadeInTimeSelector{0%{opacity:0}to{opacity:1}}.new-reservation-page .time-period{margin-bottom:15px}.new-reservation-page .time-period-label{font-weight:700;margin-bottom:5px}.new-reservation-page .time-options{display:flex;flex-wrap:wrap;gap:5px}.new-reservation-page .time-option{padding:8px 12px;background-color:#cfc;color:#060;border-radius:5px;cursor:pointer;transition:background-color .2s ease}.new-reservation-page .time-option:hover{background-color:#b3ffb3}.new-reservation-page .time-option.selected{background-color:#060;color:#cfc}.new-reservation-page .time-option.blocked{background-color:#fff3e0;color:#e65100}.new-reservation-page .time-option.blocked:hover{background-color:#ffe0b2}.new-reservation-page .time-option.blocked.selected{background-color:#e65100;color:#fff3e0}.new-reservation-page .info-text{color:#666;font-style:italic}.new-reservation-page .arrow{margin-left:auto;color:gray;display:flex;align-items:center}@media screen and (max-width:480px){.new-reservation-page .time-option{padding:6px 10px;font-size:14px}.new-reservation-page .time-toggle-btn{padding:5px 10px;font-size:12px;gap:4px}.new-reservation-page .time-toggle-btn svg{width:12px;height:12px}}
|
|
11
11
|
`);var gM=P0(c1());var v2=P0(Y1()),Ub=memo(({guests:b,formData:c,handleChange:q,field:e,selectedDate:W,expanded:n,setCurrentExpandedField:a,restaurantData:s,reservations:r,reservationMode:R,isAdmin:v=false,zitplaats:u=null})=>{let B=localStorage.getItem("preferredLanguage")||"nl",h=a1[B].timeSelector,[f,g]=useState(n||false),[l,N]=useState([]),[C,E]=useState(null),[y,S]=useState(null),m=useRef(null),j=useMemo(()=>{if(!v||!W||!s)return new Set;let X=s?.["blocked-slots"]||[],U=new Set;return X.forEach(x=>{x.date===W&&x.time&&U.add(x.time);}),U},[v,W,s]),_=useMemo(()=>{if(!r||!W)return {};let X={};return r.forEach(U=>{if((U.date||U.datum)!==W)return;let I=U.time||U.tijd;if(!I)return;let V=U.guests||U.antal||U.gasten||1;X[I]||(X[I]={reservations:0,guests:0}),X[I].reservations+=1,X[I].guests+=V;}),X},[r,W]),H=X=>_[X]||{reservations:0,guests:0},A0=X=>{S(y===X?null:X);},p0={breakfast:{start:"07:00",end:"11:00",label:h.shifts.breakfast},lunch:{start:"11:00",end:"16:00",label:h.shifts.lunch},dinner:{start:"16:00",end:"23:00",label:h.shifts.dinner}};useEffect(()=>{if(!W||!b){N([]);return}if(R==="vrije_keuze")if(C){let X=p0[C],U=gM.default.tz(`${W} ${X.start}`,"YYYY-MM-DD HH:mm","Europe/Brussels"),x=gM.default.tz(`${W} ${X.end}`,"YYYY-MM-DD HH:mm","Europe/Brussels"),I=[],V=U.clone();for(;V.isBefore(x);)I.push({value:V.format("HH:mm"),label:V.format("HH:mm")}),V.add(15,"minutes");N(I);}else N([]);else if(s&&r){let X=R!=="met_limieten"?-1e4:b,U=s?.["table-settings"]||{},x=R==="met_limieten"&&U.isInstalled===true&&U.assignmentMode==="automatic",I=R==="met_limieten"?c.giftcard:null,V=s?.["blocked-slots"]||[],c0=(0, v2.getAvailableTimeblocks)(s,W,r,X,V,I,v,c.duration),O0=x?(0, v2.getAvailableTimeblocksWithTableCheck)(s,W,c0,X,r,u,c.duration):c0,d0=Object.keys(O0).map(P=>({value:P,label:O0[P].name||P}));d0.sort((P,X0)=>{let[F,k]=P.value.split(":").map(Number),[J,z0]=X0.value.split(":").map(Number);return F*60+k-(J*60+z0)}),N(d0),c[e.id]&&!d0.some(P=>P.value===c[e.id])&&q({target:{name:e.id,value:""}});}else N([]);},[W,b,s,r,R,e.id,C,u,c[e.id],q]),useEffect(()=>{R==="vrije_keuze"&&(E(null),c[e.id]&&q({target:{name:e.id,value:""}}));},[W,R]),useEffect(()=>{g(false);},[W]),useEffect(()=>{let X=()=>g(false);return window.addEventListener("calendarExpanded",X),()=>window.removeEventListener("calendarExpanded",X)},[]);let a0=X=>{q({target:{name:e.id,value:X}}),g(false),a?.(null);},q0=X=>{C!==X&&c[e.id]&&q({target:{name:e.id,value:""}}),E(X);},Y=()=>{if(R==="vrije_keuze")return C?c[e.id]?`${p0[C].label} \u2013 ${c[e.id]}`:`${p0[C].label} \u2013 ${h.selectTime}`:h.selectMeal;if(c[e.id]){let X=l.find(U=>U.value===c[e.id]);return X?X.label:h.selectTime}return h.selectTime};return e?o0.createElement("div",{className:"form-group time-selector-container",ref:m},W?o0.createElement(o0.Fragment,null,o0.createElement("div",{className:"time-display",onClick:()=>{g(!f),f||a?.(e.id);}},o0.createElement("span",null,Y()),o0.createElement("span",{className:"arrow"},o0.createElement("svg",{width:"12",height:"12",viewBox:"0 0 24 24",style:{transform:f?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"}},o0.createElement("path",{d:"M7 10l5 5 5-5",fill:"none",stroke:"currentColor",strokeWidth:"2"})))),f&&o0.createElement("div",{className:"time-selector"},o0.createElement("div",{className:"time-toggle-container"},o0.createElement("button",{className:`time-toggle-btn ${y==="reservations"?"active":""}`,onClick:()=>A0("reservations"),type:"button"},o0.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},o0.createElement("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),o0.createElement("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),o0.createElement("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),o0.createElement("line",{x1:"3",y1:"10",x2:"21",y2:"10"})),h.reservations),o0.createElement("button",{className:`time-toggle-btn ${y==="guests"?"active":""}`,onClick:()=>A0("guests"),type:"button"},o0.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},o0.createElement("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),o0.createElement("circle",{cx:"9",cy:"7",r:"4"}),o0.createElement("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),o0.createElement("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})),h.guests)),R==="vrije_keuze"?C?o0.createElement("div",{className:"time-period"},o0.createElement("div",{className:"time-period-label"},p0[C].label,o0.createElement("button",{onClick:()=>E(null),style:{marginLeft:"10px",background:"none",border:"none",cursor:"pointer",color:"#006600",fontSize:"0.9rem",padding:0}},"\u2190 ",h.back)),o0.createElement("div",{className:"time-options"},l.length===0?o0.createElement("div",{className:"no-times"},h.noTimes):l.map(X=>{let U=H(X.value),x=j.has(X.value);return o0.createElement("div",{key:X.value,className:`time-option${c[e.id]===X.value?" selected":""}${x?" blocked":""}`,onClick:()=>a0(X.value)},X.label,y==="reservations"&&U.reservations>0&&o0.createElement("span",{className:"time-count"}," - ",U.reservations),y==="guests"&&U.guests>0&&o0.createElement("span",{className:"time-count"}," - ",U.guests,"p"))}))):o0.createElement("div",{className:"time-options"},Object.keys(p0).map(X=>o0.createElement("div",{key:X,className:`time-option ${C===X?"selected":""}`,onClick:()=>q0(X)},p0[X].label))):o0.createElement("div",{className:"time-options"},l.length===0?o0.createElement("div",{className:"no-times"},h.noTimes):l.map(X=>{let U=H(X.value),x=j.has(X.value);return o0.createElement("div",{key:X.value,className:`time-option${c[e.id]===X.value?" selected":""}${x?" blocked":""}`,onClick:()=>a0(X.value)},X.label,y==="reservations"&&U.reservations>0&&o0.createElement("span",{className:"time-count"}," - ",U.reservations),y==="guests"&&U.guests>0&&o0.createElement("span",{className:"time-count"}," - ",U.guests,"p"))})))):o0.createElement("p",{className:"info-text"},h.noDateSelected)):null});Ub.displayName="TimeSelector";var jb=Ub;R0(`.new-reservation-page .table-selector-container{margin-top:15px;padding:10px;border:1px solid #eee;border-radius:4px;background-color:#f9f9f9}.new-reservation-page .table-selector-label{display:block;margin-bottom:10px;font-weight:700;color:#333;font-size:.95rem}.new-reservation-page .table-options{display:flex;flex-wrap:wrap;gap:10px}.new-reservation-page .table-option{display:inline-block;margin-right:15px;margin-bottom:5px;padding:5px 8px;border:1px solid #ccc;border-radius:4px;background-color:#fff;transition:background-color .2s ease}.new-reservation-page .table-option label{display:flex;align-items:center;cursor:pointer;font-size:.9rem;color:#555}.new-reservation-page .table-option input[type=checkbox]{margin-right:8px;cursor:pointer;accent-color:var(--primary-color, #006600)}.new-reservation-page .table-option:has(input[type=checkbox]:checked){background-color:#e0f2e0;border-color:#060}.new-reservation-page .table-option:hover{background-color:#f0f0f0}.new-reservation-page .info-text{margin-top:10px;font-size:.85rem;color:#666}.new-reservation-page .selected-tables-info{margin-top:10px;font-style:italic}.new-reservation-page .info-text.loading-tables{font-style:italic;color:#060}.new-reservation-page .table-option--manual{border-color:#ff9800;background-color:#fff8e1}.new-reservation-page .table-option--manual:hover{background-color:#ffecb3}.new-reservation-page .table-option--manual:has(input[type=checkbox]:checked){background-color:#ffe082;border-color:#ff9800}
|
|
12
|
-
`);var Go=({availableTables:b=[],isFetching:c=false,formData:q={},handleChange:e,setFormData:W})=>{let n=localStorage.getItem("preferredLanguage")||"nl",a=a1?.[n]?.tableSelector||{},s={label:a.label||"Tafels",noTables:a.noTables||"Geen tafels beschikbaar voor deze selectie.",table:a.table||"Tafel",max:a.max||"Max"},r=Array.isArray(q.selectedTableNumbers)?q.selectedTableNumbers:[],R=Array.isArray(q.selectedTableIds)?q.selectedTableIds:[],v=(B,h)=>{if(typeof e=="function"){e({target:{multiple:true,updates:{selectedTableNumbers:B,selectedTableIds:h}}});return}typeof W=="function"&&W(f=>({...f,selectedTableNumbers:B,selectedTableIds:h}));},u=B=>h=>{let f=h.target.checked,g=b.find(C=>C.tableNumber===B);if(!g)return;let l=[...r],N=[...R];f?(l.includes(B)||l.push(B),N.includes(g.tableId)||N.push(g.tableId)):(l=l.filter(C=>C!==B),N=N.filter(C=>C!==g.tableId)),l.sort((C,E)=>C-E),v(l,N);};return c?o0.createElement("div",{className:"form-group table-selector-container"},o0.createElement("label",{className:"table-selector-label"},s.label),o0.createElement("p",{className:"info-text"},"Laden\u2026")):!b||b.length===0?o0.createElement("div",{className:"form-group table-selector-container"},o0.createElement("label",{className:"table-selector-label"},s.label),o0.createElement("p",{className:"info-text"},s.noTables)):o0.createElement("div",{className:"form-group table-selector-container"},o0.createElement("label",{className:"table-selector-label"},s.label),o0.createElement("div",{className:"table-options"},b.map(B=>{let h=B.tableNumber,f=B.maxCapacity??B.capacity??B.seats??"-",g=r.includes(h),l=B.isManual===true;return o0.createElement("div",{key:`${B.tableId||h}`,className:`table-option${l?" table-option--manual":""}`},o0.createElement("label",null,o0.createElement("input",{type:"checkbox",value:h,checked:g,onChange:u(h)}),s.table," ",h," (",s.max,": ",f,")"))})))},y2=Go;R0(`.new-reservation-page .form-row .field-label{display:block;margin-bottom:6px;font-weight:600}.new-reservation-page .form-row .reservation-mode-buttons{margin-top:0}.new-reservation-page .reservation-modes-container{display:flex;flex-wrap:wrap;margin:0 -5px;width:100%}.new-reservation-page .reservation-mode-button{flex:0 0 calc(50% - 10px);margin:5px;padding:10px;box-sizing:border-box;text-align:center;border:1px solid #ccc;
|
|
12
|
+
`);var Go=({availableTables:b=[],isFetching:c=false,formData:q={},handleChange:e,setFormData:W})=>{let n=localStorage.getItem("preferredLanguage")||"nl",a=a1?.[n]?.tableSelector||{},s={label:a.label||"Tafels",noTables:a.noTables||"Geen tafels beschikbaar voor deze selectie.",table:a.table||"Tafel",max:a.max||"Max"},r=Array.isArray(q.selectedTableNumbers)?q.selectedTableNumbers:[],R=Array.isArray(q.selectedTableIds)?q.selectedTableIds:[],v=(B,h)=>{if(typeof e=="function"){e({target:{multiple:true,updates:{selectedTableNumbers:B,selectedTableIds:h}}});return}typeof W=="function"&&W(f=>({...f,selectedTableNumbers:B,selectedTableIds:h}));},u=B=>h=>{let f=h.target.checked,g=b.find(C=>C.tableNumber===B);if(!g)return;let l=[...r],N=[...R];f?(l.includes(B)||l.push(B),N.includes(g.tableId)||N.push(g.tableId)):(l=l.filter(C=>C!==B),N=N.filter(C=>C!==g.tableId)),l.sort((C,E)=>C-E),v(l,N);};return c?o0.createElement("div",{className:"form-group table-selector-container"},o0.createElement("label",{className:"table-selector-label"},s.label),o0.createElement("p",{className:"info-text"},"Laden\u2026")):!b||b.length===0?o0.createElement("div",{className:"form-group table-selector-container"},o0.createElement("label",{className:"table-selector-label"},s.label),o0.createElement("p",{className:"info-text"},s.noTables)):o0.createElement("div",{className:"form-group table-selector-container"},o0.createElement("label",{className:"table-selector-label"},s.label),o0.createElement("div",{className:"table-options"},b.map(B=>{let h=B.tableNumber,f=B.maxCapacity??B.capacity??B.seats??"-",g=r.includes(h),l=B.isManual===true;return o0.createElement("div",{key:`${B.tableId||h}`,className:`table-option${l?" table-option--manual":""}`},o0.createElement("label",null,o0.createElement("input",{type:"checkbox",value:h,checked:g,onChange:u(h)}),s.table," ",h," (",s.max,": ",f,")"))})))},y2=Go;R0(`.new-reservation-page .form-row .field-label{display:block;margin-bottom:6px;font-weight:600}.new-reservation-page .form-row .reservation-mode-buttons{margin-top:0}.new-reservation-page .reservation-mode-buttons{display:flex;gap:10px;margin-top:10px}.new-reservation-page .reservation-mode-button{flex:1;padding:10px;border:1px solid #ccc;border-radius:var(--border-radius);background-color:var(--color-white);cursor:pointer;font-size:1rem;transition:background-color .3s ease,color .3s ease}.new-reservation-page .reservation-mode-button:nth-child(3){flex:0 0 100%}.new-reservation-page .reservation-modes-container{display:flex;flex-wrap:wrap;margin:0 -5px;width:100%}.new-reservation-page .reservation-mode-button{flex:0 0 calc(50% - 10px);margin:5px;padding:10px;box-sizing:border-box;text-align:center;border:1px solid #ccc;background:#f7f7f7;cursor:pointer}.new-reservation-page .reservation-mode-button.active,.new-reservation-page .reservation-mode-button:hover{background-color:var(--color-blue);color:var(--color-white)}.new-reservation-page .unlimited-mode-warning{display:flex;align-items:flex-start;gap:10px;margin:15px 0;padding:12px 15px;background-color:#fff3cd;border:1px solid #ffeaa7;border-radius:var(--border-radius, 4px);border-left:4px solid #e67e22;font-size:.9rem;line-height:1.4}.new-reservation-page .unlimited-mode-warning .warning-icon{color:#e67e22;font-size:1.1rem;margin-top:2px;flex-shrink:0}.new-reservation-page .unlimited-mode-warning .warning-text{color:#856404;margin:0}@media screen and (max-width:480px){.new-reservation-page .unlimited-mode-warning{margin:10px 0;padding:10px 12px;font-size:.85rem}.new-reservation-page .unlimited-mode-warning .warning-icon{font-size:1rem}}.new-reservation-page .reservation-sidebar-component{position:fixed;top:0;right:-400px;width:400px;height:100%;background-color:#fff;box-shadow:-2px 0 5px #0000001a;z-index:var(--z-index-sidebar-reservation);display:flex;flex-direction:column;overflow-y:auto;transition:right .3s ease-in-out}.new-reservation-page .admin-title{text-align:center;margin-bottom:30px}.new-reservation-page .reservation-sidebar-component.open{right:0}.new-reservation-page .reservation-sidebar-content{padding:60px 20px 20px}.new-reservation-page .close-sidebar-button{position:absolute;top:10px;left:10px;background-color:transparent;border:none;cursor:pointer}.new-reservation-page .close-sidebar-button svg{color:#000}.new-reservation-page .sidebar-section-one,.new-reservation-page .sidebar-section-two{margin-bottom:20px}.new-reservation-page .reservation-footer{margin-top:auto}.new-reservation-page .store-reservation-button{width:100%;padding:12px;background-color:var(--color-blue);color:#fff;border:none;border-radius:5px;cursor:pointer;font-size:1.1rem}.new-reservation-page .open-sidebar-button{position:fixed;bottom:20px;right:20px;background-color:var(--color-blue);color:#fff;border:none;border-radius:50%;width:50px;height:50px;cursor:pointer;z-index:var(--z-index-modal)!important;transition:all .3s ease}.new-reservation-page .open-sidebar-button:hover{background-color:var(--color-blue-hover-accent)!important}.new-reservation-page .open-sidebar-button svg{position:relative;top:2px}@media screen and (max-width:480px){.new-reservation-page .reservation-sidebar-component{width:100%}}.new-reservation-page .sidebar-section-personeel{margin-bottom:10px}
|
|
13
13
|
`);var Vb=P0(c1());var Ko=()=>{let b=useCallback(()=>localStorage.getItem("accessToken"),[]),c=useCallback((W,n={})=>{let{params:a,...s}=n,r=b();return Gb.get(W,{...s,params:a,headers:{...s.headers,...r?{Authorization:`Bearer ${r}`}:{}}}).then(R=>R.data).catch(R=>{throw console.error("Error fetching data:",R),R})},[b]),q=useCallback((W,n,a=null,s={})=>{let r=b();return Gb({method:W,url:n,data:a,...s,headers:{...s.headers,...r?{Authorization:`Bearer ${r}`}:{}}}).then(R=>R.data).catch(R=>{throw console.error(`Error with ${W} request:`,R),R})},[b]);return useMemo(()=>({get:c,post:(W,n,a)=>q("POST",W,n,a),put:(W,n,a)=>q("PUT",W,n,a),patch:(W,n,a)=>q("PATCH",W,n,a),delete:(W,n)=>q("DELETE",W,null,n)}),[c,q])},o1=Ko;var U0=P0(Y1());var M4=({duration:b,setDuration:c,handleChange:q,min:e=30,max:W=120,interval:n=30})=>{let [a,s]=useState(false),r=useMemo(()=>{let N=[],C=parseInt(e)||30,E=parseInt(W)||120,y=parseInt(n)||30;for(let S=C;S<=E;S+=y){let m=[],j=Math.floor(S/60),_=S%60;j>0&&m.push(`${j} u`),_>0&&m.push(`${_} min`),N.push({value:S,label:m.join(" ")});}return N},[e,W,n]),R=r.slice(0,3),v=r.length>3;R.some(N=>N.value===parseInt(b));let B=N=>{s(false),c&&c(N),q&&q({target:{name:"duration",value:N}});};useEffect(()=>{!b&&r.length>0&&B(r[0].value);},[]);let h=()=>{let N=R[R.length-1],C=parseInt(n)||30;if(N){let E=N.value+C,y=parseInt(W)||120,S=Math.min(E,y);c&&c(S),q&&q({target:{name:"duration",value:S}}),s(true);}else s(true);},f=N=>{let C=parseInt(b)||parseInt(e)||30,E=parseInt(n)||30,y=parseInt(e)||30,S=parseInt(W)||120,m=C+N*E;m<y&&(m=y),m>S&&(m=S),c&&c(m),q&&q({target:{name:"duration",value:m}});},g={wrapper:{marginBottom:"20px"},grid:{display:"flex",flexWrap:"wrap",gap:"8px"},optionBtn:{padding:"8px 12px",borderRadius:"6px",border:"1px solid #D0D5DD",backgroundColor:"#fff",cursor:"pointer",fontSize:"14px",fontWeight:"500",color:"#344054",textAlign:"center",transition:"all 0.2s",outline:"none",fontFamily:"'Inter', sans-serif', system-ui",flex:1,minWidth:"60px"},activeBtn:{backgroundColor:"#48AAAF",color:"#ffffff",borderColor:"#48AAAF"},stepperContainer:{display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:"10px",padding:"8px",backgroundColor:"#F9FAFB",border:"1px solid #EAECF0",borderRadius:"8px",width:"100%"},stepperBtn:{width:"32px",height:"32px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"6px",border:"1px solid #D0D5DD",backgroundColor:"#fff",cursor:"pointer",color:"#344054"},stepperValue:{fontSize:"14px",fontWeight:"600",color:"#101828"}},l=N=>{let C=Math.floor(N/60),E=N%60,y=[];return C>0&&y.push(`${C} u`),E>0&&y.push(`${E} min`),y.join(" ")||`${N} min`};return o0.createElement("div",{style:g.wrapper},o0.createElement("style",null,`
|
|
14
14
|
.duration-btn {
|
|
15
15
|
outline: none !important;
|
|
@@ -39,7 +39,7 @@ Checking Time: ${v} -> Determined Meal: ${B}`),!B){N0(` Time ${v} has no associ
|
|
|
39
39
|
border-color: #48AAAF !important;
|
|
40
40
|
}
|
|
41
41
|
`),o0.createElement("div",{style:g.grid},R.map(N=>o0.createElement("button",{key:N.value,type:"button",className:`duration-btn ${parseInt(b)===N.value?"active-duration":""}`,tabIndex:"-1",style:{...g.optionBtn,...!a&&parseInt(b)===N.value?g.activeBtn:{}},onClick:()=>B(N.value),onMouseDown:C=>C.preventDefault()},N.label)),v&&o0.createElement("button",{type:"button",className:`duration-btn ${a?"active-duration":""}`,tabIndex:"-1",style:{...g.optionBtn,...a?g.activeBtn:{},flex:"0 0 auto",width:"auto",minWidth:"40px"},onClick:h,onMouseDown:N=>N.preventDefault()},a?o0.createElement(FaMinus,{size:12}):o0.createElement(FaPlus,{size:12}))),o0.createElement(AnimatePresence,null,a&&o0.createElement(motion.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},style:{overflow:"hidden"}},o0.createElement("div",{style:g.stepperContainer},o0.createElement("button",{type:"button",style:g.stepperBtn,onClick:()=>f(-1)},o0.createElement(FaMinus,{size:12})),o0.createElement("span",{style:g.stepperValue},l(parseInt(b)||0)),o0.createElement("button",{type:"button",style:g.stepperBtn,onClick:()=>f(1)},o0.createElement(FaPlus,{size:12}))))))},S2=M4;var Qb=memo(({formData:b,errors:c,handleChange:q,handleStepOneSubmit:e,setFormData:W,timeblocks:n,loadingTimeblocks:a,timeblocksError:s,restaurantData:r,isAdmin:R=false})=>{let v=localStorage.getItem("preferredLanguage")||"nl",u=a1[v].reservationStepOne,[B,h]=useState(b.guests||2),[f,g]=useState(null),[l,N]=useState([]),C=o1(),[E,y]=useState([]),[S,m]=useState(false),[j,_]=useState(false),H=useRef(false),A0=useRef(false),p0=useRef(false),a0=useCallback(F=>{W(k=>{let J={...k};return F.forEach(z0=>{J[z0]="";}),(F.includes("date")||F.includes("time")||F.includes("guests"))&&(J.selectedTableNumbers=[],J.selectedTableIds=[],y([])),J});},[W]);useEffect(()=>{let k=(0, Vb.default)().tz("Europe/Amsterdam").startOf("day").clone().startOf("isoWeek");for(;kz(k);)k.add(1,"week");g(k);},[]),useEffect(()=>{(async()=>{if(f&&(b.reservationMode==="met_limieten"||b.reservationMode==="zonder_regels"||b.reservationMode==="vrije_keuze")){let k=r?.["table-settings"]||{},J=k.isInstalled===true&&k.assignmentMode==="automatic";if(b.reservationMode==="met_limieten"||b.reservationMode==="vrije_keuze"||b.reservationMode==="zonder_regels"&&J){let z0=f.format("YYYY-MM-DD"),u0=f.clone().add(13,"days").format("YYYY-MM-DD"),T0=localStorage.getItem("username"),f0=`${window.baseDomain}api/slots/${T0}/${z0}/${u0}`;try{let A=await C.get(f0,{noCache:!0});N(A||[]);}catch(A){console.error("Error fetching reservations:",A),N([]);}}else N([]);}else N([]);})();},[f,C,b.reservationMode,r]),useEffect(()=>{window.__reservationDashboardPreset&&b.date?(window.__reservationDashboardPreset=false,p0.current=true,A0.current=true):_(false);},[b.date]),useEffect(()=>{if(p0.current&&r&&Object.keys(r).length>0&&b.date&&b.reservationMode==="met_limieten"){p0.current=false;let F=r?.["blocked-slots"]||[],k=b.guests||2,J=r?.["table-settings"]||{},z0=J.isInstalled===true&&J.assignmentMode==="automatic",u0;z0?u0=(0, U0.isDateAvailableWithTableCheck)(r,b.date,l,k,F,null,R,null,b.zitplaats||null):u0=(0, U0.isDateAvailable)(r,b.date,l,k,F,null,R),u0?(_(false),A0.current=false):(_(true),A0.current=true,W(T0=>({...T0,reservationMode:"vrije_keuze"})));}},[r,l,b.date,b.guests,b.reservationMode,R,W]);let q0=F=>{g(F),a0(["date","time","selectedTableNumbers","selectedTableIds"]);};useEffect(()=>{if(!H.current){let F=false,k={};b.reservationMode||(k.reservationMode="met_limieten",F=true),(!b.guests||b.guests==="")&&(k.guests=B,F=true),Array.isArray(b.selectedTableNumbers)||(k.selectedTableNumbers=[],F=true),Array.isArray(b.selectedTableIds)||(k.selectedTableIds=[],F=true),F&&setTimeout(()=>{q({target:{multiple:true,updates:k}});},0),H.current=true;}},[b.reservationMode,b.guests,b.selectedTableNumbers,b.selectedTableIds,B,q]);let Y=useMemo(()=>r?.["table-settings"]||{},[r]),X=useMemo(()=>Y.isInstalled===true&&Y.assignmentMode==="automatic",[Y]),U=useMemo(()=>["met_limieten","zonder_regels","vrije_keuze"].includes(b.reservationMode),[b.reservationMode]),x=useMemo(()=>U&&b.date&&b.time&&b.guests>0&&X&&E.length>0,[U,b.date,b.time,b.guests,X,E.length]);useEffect(()=>{if(!X||!b.date||!b.time||b.guests<=0||!r||!l){y([]),m(false);return}m(true);let F=setTimeout(()=>{(window.requestIdleCallback||(J=>setTimeout(J,1)))(()=>{try{let J=new Set;r?.manualFloors&&Array.isArray(r.manualFloors)&&r.manualFloors.forEach(A=>{(A.tables||[]).forEach(d=>{d.tableNumber!=null&&J.add(d.tableNumber);});});let z0=[...r?.floors||[],...r?.manualFloors||[]],u0={...r,floors:z0},f0=F0("getAvailableTablesForTime",U0.getAvailableTablesForTime,u0,b.date,b.time,b.guests,l,b.zitplaats||null).map(A=>({...A,isManual:J.has(A.tableNumber)}));y(f0);}catch(J){console.error("Error calculating available tables:",J),y([]);}finally{m(false);}});},500);return ()=>{clearTimeout(F),m(false);}},[X,b.date,b.time,b.guests,b.zitplaats,r,l]),useEffect(()=>{if(E.length>0){let F=b.selectedTableNumbers||[],k=b.selectedTableIds||[],J=[],z0=[];F.forEach(u0=>{let T0=E.find(f0=>f0.tableNumber===u0);T0&&k.includes(T0.tableId)&&(J.push(u0),z0.push(T0.tableId));}),J.length!==F.length&&setTimeout(()=>{q({target:{multiple:true,updates:{selectedTableNumbers:J,selectedTableIds:z0}}});},0);}else (b.selectedTableNumbers?.length>0||b.selectedTableIds?.length>0)&&setTimeout(()=>{q({target:{multiple:true,updates:{selectedTableNumbers:[],selectedTableIds:[]}}});},0);},[E,b.selectedTableNumbers,b.selectedTableIds]);let I=F=>{let k=parseInt(F.target.value,10)||1;h(k),_(false),W(J=>{let z0={...J,guests:k};if(z0.selectedTableNumbers=[],z0.selectedTableIds=[],z0.reservationMode==="vrije_keuze")return z0;if(z0.date&&r&&Object.keys(r).length>0){let u0=r?.["blocked-slots"]||[],T0=z0.reservationMode!=="met_limieten"?-1e4:k,f0=r?.["table-settings"]||{},A=z0.reservationMode==="met_limieten"&&f0.isInstalled===true&&f0.assignmentMode==="automatic",d;if(A?d=F0("isDateAvailableWithTableCheck",U0.isDateAvailableWithTableCheck,r,z0.date,l,T0,u0,null,R,null,z0.zitplaats||null):d=F0("isDateAvailable",U0.isDateAvailable,r,z0.date,l,T0,u0,null,R),!d)z0.date="",z0.time="";else if(z0.time){let t=(0, U0.getAvailableTimeblocks)(r,z0.date,l,T0,u0,null,R,z0.duration||null);(A?(0, U0.getAvailableTimeblocksWithTableCheck)(r,z0.date,t,T0,l,z0.zitplaats||null,z0.duration||null):t)[z0.time]||(z0.time="");}}return z0});};useEffect(()=>{if(A0.current){A0.current=false;return}a0(["date","time","selectedTableNumbers","selectedTableIds"]);},[b.reservationMode,a0]);let V=F=>{_(false),F==="met_limieten"?q({target:{name:"reservationMode",value:"met_limieten"}}):F==="onbeperkt_parent"&&(["zonder_regels","vrije_keuze"].includes(b.reservationMode)||q({target:{name:"reservationMode",value:"zonder_regels"}}));},c0=F=>{_(false),q({target:{name:"reservationMode",value:F}});},O0=b.reservationMode,d0=!!r?.["general-settings"]?.seatSelectionEnabled,P=Array.isArray(r?.["general-settings"]?.seatAreas)?r["general-settings"].seatAreas:["Terras","Restaurant"],X0=F=>{W(k=>({...k,zitplaats:F}));};return s?o0.createElement("div",null,u.errors.openingHoursNotSet," ",o0.createElement("a",{href:"https://happychef.cloud/#/openinghours/dinner",target:"_blank",rel:"noopener noreferrer",style:{color:"var(--color-blue)",textDecoration:"underline"}},u.errors.clickHereToSet)):o0.createElement("form",{className:"account-manage-form",noValidate:true},o0.createElement("div",{className:"form-group reservation-mode"},o0.createElement("div",{className:"reservation-modes-container"},o0.createElement("button",{type:"button",className:`reservation-mode-button ${O0==="met_limieten"?"active":""}`,onClick:()=>V("met_limieten"),"aria-pressed":O0==="met_limieten"},u.modes.withLimits),o0.createElement("button",{type:"button",className:`reservation-mode-button ${["onbeperkt_parent","zonder_regels","vrije_keuze"].includes(O0)?"active":""}`,onClick:()=>V("onbeperkt_parent"),"aria-pressed":["onbeperkt_parent","zonder_regels","vrije_keuze"].includes(O0)},u.modes.unlimited)),["onbeperkt_parent","zonder_regels","vrije_keuze"].includes(O0)&&o0.createElement("div",{className:"reservation-modes-container sub-modes"},o0.createElement("button",{type:"button",className:`reservation-mode-button ${O0==="zonder_regels"?"active":""}`,onClick:()=>c0("zonder_regels"),"aria-pressed":O0==="zonder_regels"},u.modes.openingHours),o0.createElement("button",{type:"button",className:`reservation-mode-button ${O0==="vrije_keuze"?"active":""}`,onClick:()=>c0("vrije_keuze"),"aria-pressed":O0==="vrije_keuze"},u.modes.free))),["onbeperkt_parent","zonder_regels","vrije_keuze"].includes(O0)&&o0.createElement("div",{className:"unlimited-mode-warning"},o0.createElement("div",{className:"warning-text"},j?u.warnings?.dateNotAvailableWithLimits||"Let op: deze datum is niet beschikbaar met limieten voor dit aantal gasten. De modus is automatisch overgezet naar onbeperkt vrij.":u.warnings?.unlimitedMode||(v==="nl"?"Let op: Bij onbeperkte boekingen wordt geen rekening gehouden met de maximale capaciteit van het restaurant. De maximale zitplaatslimiet kan worden overschreden.":"Warning: Unlimited bookings do not take into account the restaurant's maximum capacity. The maximum seating limit may be exceeded."))),o0.createElement(d2,{setGuests:h,value:b.guests||B,onChange:I,error:c.guests}),d0&&U&&b.guests>0&&o0.createElement("div",{className:"form-row",style:{marginTop:12}},o0.createElement("div",{className:"reservation-mode-buttons"},P.map(F=>o0.createElement("button",{key:F,type:"button",className:`reservation-mode-button ${b.zitplaats===F?"active":""}`,onClick:()=>X0(F),"aria-pressed":b.zitplaats===F},F))),c.zitplaats&&o0.createElement("small",{className:"error"},c.zitplaats)),r?.account_type==="bowling"&&o0.createElement(S2,{duration:b.duration,handleChange:F=>{q(F),a0(["date","time","selectedTableNumbers","selectedTableIds"]);},min:r["general-settings"]?.minDuration||30,max:r["general-settings"]?.maxDuration||120,interval:r["general-settings"]?.durationInterval||30}),U&&b.guests>0&&o0.createElement(Fb,{guests:b.guests,formData:b,handleChange:q,resetFormDataFields:a0,restaurantData:r,reservations:l,startDate:f,onWeekChange:q0,reservationMode:O0,isAdmin:R}),U&&b.date&&o0.createElement(jb,{guests:b.guests,formData:b,handleChange:q,field:{id:"time",label:u.fields.time},selectedDate:b.date,setCurrentExpandedField:()=>{},restaurantData:r,reservations:l,reservationMode:O0,zitplaats:b.zitplaats||null,isAdmin:R}),x&&o0.createElement(y2,{availableTables:E,isFetching:S,formData:b,setFormData:W,handleChange:q}),S&&b.date&&b.time&&b.guests>0&&o0.createElement("div",{style:{textAlign:"center",padding:"10px",color:"#666",fontSize:"14px"}},"Beschikbare tafels berekenen..."))});Qb.displayName="ReservationStepOne";var yM=Qb;var SM=()=>localStorage.getItem("preferredLanguage")||"nl",j0=(b,c,q="nl")=>{let e=SM();return (b[e]||b[q]||{})[c]||{}};var $b={nl:{formField:{selectPlaceholder:"Selecteer een optie",tooltip:{confirm:"Klik om te Bevestigen",source:"Gevonden met Happy Ai"}}},en:{formField:{selectPlaceholder:"Select an option",tooltip:{confirm:"Click to Confirm",source:"Found with Happy Ai"}}},fr:{formField:{selectPlaceholder:"S\xE9lectionnez une option",tooltip:{confirm:"Cliquez pour confirmer",source:"Trouv\xE9 avec Happy Ai"}}}};R0(`.new-reservation-page .form-group .magic-tooltip{transition:transform .2s ease;transform-origin:bottom right}.new-reservation-page .form-group .magic-tooltip:hover{transform:scale(1.05)}.form-field-label{display:block;font-size:.8rem;font-weight:600;margin-bottom:4px;color:#333}.required-asterisk{color:red;margin-left:2px}.name-match-item{padding:8px 0;cursor:pointer;transition:background-color .15s ease}.name-match-item:hover{background-color:#f5f0f7}.name-match-item:not(:last-child){border-bottom:1px solid #f0f0f0}
|
|
42
|
-
`);var A4=({label:b,name:c,type:q="text",icon:e,value:W,onChange:n,onBlur:a,error:s,placeholder:r,halfWidth:R,options:v=[],selectPlaceholder:u,rightIcon:B,onRightIconClick:h,tooltipContent:f,tooltipAlign:g,required:l})=>{let N=j0($b,"formField"),C=u||N.selectPlaceholder,[E,y]=useState(false),S=useRef(null),m=useRef(null),j=B,_=e;useEffect(()=>{let Y=X=>{S.current&&!S.current.contains(X.target)&&(m.current&&clearTimeout(m.current),y(false));};return E&&document.addEventListener("mousedown",Y),()=>document.removeEventListener("mousedown",Y)},[E]);let A0={name:c,value:W,onChange:n,onBlur:a,"aria-label":b,className:`form-control ${s?"input-error":""}`,style:e?{paddingLeft:"35px",boxSizing:"border-box"}:{}},p0=()=>q==="select"?o0.createElement("select",{...A0},o0.createElement("option",{value:""},C),v.map(Y=>o0.createElement("option",{key:Y.value,value:Y.value},Y.label))):q==="textarea"?o0.createElement("textarea",{...A0,placeholder:r}):o0.createElement("input",{type:q,...A0,placeholder:r}),a0=q==="textarea";return o0.createElement("div",{className:`form-group ${R?"half-width":""}`,style:{position:"relative"
|
|
42
|
+
`);var A4=({label:b,name:c,type:q="text",icon:e,value:W,onChange:n,onBlur:a,error:s,placeholder:r,halfWidth:R,options:v=[],selectPlaceholder:u,rightIcon:B,onRightIconClick:h,tooltipContent:f,tooltipAlign:g,required:l})=>{let N=j0($b,"formField"),C=u||N.selectPlaceholder,[E,y]=useState(false),S=useRef(null),m=useRef(null),j=B,_=e;useEffect(()=>{let Y=X=>{S.current&&!S.current.contains(X.target)&&(m.current&&clearTimeout(m.current),y(false));};return E&&document.addEventListener("mousedown",Y),()=>document.removeEventListener("mousedown",Y)},[E]);let A0={name:c,value:W,onChange:n,onBlur:a,"aria-label":b,className:`form-control ${s?"input-error":""}`,style:e?{paddingLeft:"35px",boxSizing:"border-box"}:{}},p0=()=>q==="select"?o0.createElement("select",{...A0},o0.createElement("option",{value:""},C),v.map(Y=>o0.createElement("option",{key:Y.value,value:Y.value},Y.label))):q==="textarea"?o0.createElement("textarea",{...A0,placeholder:r}):o0.createElement("input",{type:q,...A0,placeholder:r}),a0=q==="textarea";return o0.createElement("div",{className:`form-group ${R?"half-width":""}`,style:{position:"relative"}},l&&b&&o0.createElement("label",{className:"form-field-label"},b," ",o0.createElement("span",{className:"required-asterisk"},"*")),o0.createElement("div",{className:"input-container",style:{position:"relative"}},_&&o0.createElement(_,{className:"input-icon",style:{position:"absolute",left:"10px",top:a0?"12px":"50%",transform:a0?"none":"translateY(-50%)",color:"#6c757d",pointerEvents:"none",zIndex:1}}),p0(),j&&o0.createElement("div",{className:"magic-wand-container",onClick:h,onMouseEnter:()=>{m.current&&clearTimeout(m.current),y(true);},onMouseLeave:()=>{m.current=setTimeout(()=>y(false),1200);},style:{position:"absolute",top:"50%",right:"10px",transform:"translateY(-50%)",cursor:"pointer"}},o0.createElement(j,{className:"magic-wand-icon",style:{color:"#B567C2"}}),E&&f&&o0.createElement("div",{ref:S,className:"magic-tooltip",style:{position:"absolute",bottom:"100%",...g==="left"?{left:0}:{right:0},backgroundColor:"#fff",color:"#333",borderRadius:"8px",fontSize:"0.9rem",boxShadow:"0px 4px 10px rgba(0,0,0,0.15)",zIndex:1e3,marginBottom:"8px",minWidth:"220px",overflow:"hidden"}},o0.createElement("div",{style:{position:"relative",zIndex:2,padding:"12px 20px"}},o0.createElement("div",{style:{borderBottom:"1px solid #eee",marginBottom:"8px",paddingBottom:"4px"}},f),o0.createElement("div",{style:{fontWeight:"bold",fontSize:"13px",textAlign:"center",marginTop:"8px"}},N.tooltip?.confirm),o0.createElement("div",{style:{fontSize:"0.7rem",textAlign:"center",color:"#999",marginTop:"4px"}},N.tooltip?.source))))),s&&o0.createElement("p",{className:"form-error"},s))},_0=o0.memo(A4);var V0=P0(c1());P0(Mp());var zp={nl:{reservationStepTwoFiltering:{labels:{menu:"Menu",firstName:"Voornaam",lastName:"Achternaam",email:"E-mail",phone:"Mobiel nummer",extraInfo:"Extra info",seatPlace:"Zitplaats"},placeholders:{firstName:"Voornaam",lastName:"Achternaam",email:"E-mailadres",phone:"Mobiel nummer",extraInfo:"Extra informatie",seatPlace:"Selecteer zitplaats"},magic:{title:"Gast Gegevens"}},reservationSummary:{title:"Reservatie Gegevens",guests:"Aantal gasten",date:"Datum",time:"Tijd",firstName:"Voornaam",lastName:"Achternaam",email:"E-mail",phone:"Mobiel nummer",menu:"Menu",staff:"Aangemaakt door",giftcard:"Cadeaubon",extraInfo:"Extra informatie",seatPlace:"Zitplaats",newReservationButton:"Nieuwe Reservatie Maken"}},en:{reservationStepTwoFiltering:{labels:{menu:"Menu",firstName:"First Name",lastName:"Last Name",email:"Email",phone:"Mobile Number",extraInfo:"Extra Info",seatPlace:"Seating area"},placeholders:{firstName:"First Name",lastName:"Last Name",email:"Email Address",phone:"Mobile Number",extraInfo:"Extra Information",seatPlace:"Select seating area"},magic:{title:"Guest Details"}},reservationSummary:{title:"Reservation Details",guests:"Number of Guests",date:"Date",time:"Time",firstName:"First Name",lastName:"Last Name",email:"Email",phone:"Mobile Number",menu:"Menu",staff:"Created by",giftcard:"Gift Card",extraInfo:"Extra Information",seatPlace:"Seating area",newReservationButton:"New Reservation"}},fr:{reservationStepTwoFiltering:{labels:{menu:"Menu",firstName:"Pr\xE9nom",lastName:"Nom",email:"E-mail",phone:"Num\xE9ro de portable",extraInfo:"Informations suppl\xE9mentaires",seatPlace:"Zone d\u2019assise"},placeholders:{firstName:"Pr\xE9nom",lastName:"Nom",email:"Adresse e-mail",phone:"Num\xE9ro de portable",extraInfo:"Informations suppl\xE9mentaires",seatPlace:"S\xE9lectionner une zone d\u2019assise"},magic:{title:"D\xE9tails Invit\xE9"}},reservationSummary:{title:"D\xE9tails de la R\xE9servation",guests:"Nombre d'invit\xE9s",date:"Date",time:"Heure",firstName:"Pr\xE9nom",lastName:"Nom",email:"E-mail",phone:"Num\xE9ro de portable",menu:"Menu",staff:"Cr\xE9\xE9 par",giftcard:"Carte Cadeau",extraInfo:"Informations suppl\xE9mentaires",seatPlace:"Zone d\u2019assise",newReservationButton:"Nouvelle R\xE9servation"}}};R0(`.new-reservation-page .name-fields{display:flex;gap:20px}.input-container .form-control{display:flex;align-items:center;justify-content:space-between;width:100%;padding:10px 10px 10px 35px;background-color:#fff;border:#ccc 1px solid;cursor:pointer;-webkit-user-select:none;user-select:none;text-align:left;border-radius:5px;font-size:16px;box-sizing:border-box}
|
|
43
43
|
`);var cp=o0.memo(({formData:b,errors:c,handleChange:q,setFormData:e,menuData:W})=>{let n=SM(),a=j0(zp,"reservationStepTwoFiltering"),[s,r]=useState([]),[R,v]=useState(false),[u,B]=useState(null),[h,f]=useState([]),g=o1(),l=FaMagic,N=()=>{u&&E();};useEffect(()=>{if(V0.default.locale(n),!b.date||!b.time||!W.length)return r([]);let Y=(0, V0.default)(`${b.date} ${b.time}`,"YYYY-MM-DD HH:mm"),X=W.filter(U=>{let x=Y.isBetween((0, V0.default)(U.startDate,"YYYY-MM-DD"),(0, V0.default)(U.endDate,"YYYY-MM-DD"),"day","[]"),I=(0, V0.default)(b.time,"HH:mm").isBetween((0, V0.default)(U.startHour,"HH:mm"),(0, V0.default)(U.endHour,"HH:mm"),"minute","[]"),V=(0, V0.default)(Y).locale("nl").format("dddd").toLowerCase(),c0=(0, V0.default)(Y).locale("en").format("dddd").toLowerCase(),O0=(U.daysOfWeek||[]).map(P=>P.toLowerCase()),d0=!O0.length||O0.includes(V)||O0.includes(c0);return x&&I&&d0});r(X);},[b.date,b.time,W,n]);let C=async()=>{if(R||u)return;let Y=(b.email||"").trim().toLowerCase(),X=(b.phone||"").trim(),U=Y&&[".com",".net",".be",".nl"].some(V=>Y.endsWith(V)),x=!!X&&(X.startsWith("+32")?X.length>=12:X.length>=10);if(!U&&!x)return;let I=[];U&&I.push("email"),x&&I.push("phone");try{let V=await g.post(`${window.baseDomain}api/autofill`,{email:Y,phone:X});V?.firstName&&V?.lastName&&V?.email&&V?.phone&&B({...V,sources:I});}catch{console.error("Autofill error");}};useEffect(()=>{C();},[b.email,b.phone]);let E=()=>{u&&(e(Y=>({...Y,firstName:u.firstName,lastName:u.lastName,email:u.email,phone:u.phone})),v(true),B(null));},y=async()=>{let Y=(b.firstName||"").trim(),X=(b.lastName||"").trim();if(Y.length<2&&X.length<2){f([]);return}try{let U=await g.post(`${window.baseDomain}api/autofill-name`,{firstName:Y||void 0,lastName:X||void 0});Array.isArray(U)&&U.length>0?f(U):f([]);}catch{f([]);}},S=Y=>{e(X=>({...X,firstName:Y.firstName,lastName:Y.lastName,email:Y.email,phone:Y.phone})),f([]),v(true);};useEffect(()=>{if(R)return;let Y=(b.firstName||"").trim(),X=(b.lastName||"").trim();if(Y.length<2&&X.length<2){f([]);return}f([]);let U=setTimeout(()=>{y();},500);return ()=>clearTimeout(U)},[b.firstName,b.lastName]);let m=useMemo(()=>{if(!u)return {email:{},phone:{}};let Y=u.sources.includes("email")&&(b.email||"").trim().toLowerCase()===u.email.trim().toLowerCase(),X=u.sources.includes("phone")&&(b.phone||"").trim()===u.phone.trim(),U={rightIcon:l,onRightIconClick:N};return {email:Y?{...U,tooltipContent:o0.createElement("div",null,o0.createElement("div",{style:{textAlign:"center",fontWeight:"bold"}},a.magic?.title),o0.createElement("div",null,u.firstName," ",u.lastName),o0.createElement("div",null,u.phone))}:{},phone:X?{...U,tooltipContent:o0.createElement("div",null,o0.createElement("div",{style:{textAlign:"center",fontWeight:"bold"}},a.magic?.title),o0.createElement("div",null,u.firstName," ",u.lastName),o0.createElement("div",null,u.email))}:{}}},[u,b.email,b.phone,a.magic?.title]),j=useMemo(()=>{if(!h.length)return {firstName:{},lastName:{}};let X=(b.lastName||"").trim().length>0?"lastName":"firstName",U=o0.createElement("div",{style:{maxHeight:"200px",overflowY:"auto"}},h.map((I,V)=>o0.createElement("div",{key:V,className:"name-match-item",onClick:c0=>{c0.stopPropagation(),S(I);}},o0.createElement("div",{style:{fontWeight:"500"}},I.firstName," ",I.lastName),o0.createElement("div",{style:{fontSize:"0.8rem",color:"#666"}},I.email),I.phone&&o0.createElement("div",{style:{fontSize:"0.8rem",color:"#666"}},I.phone)))),x={rightIcon:FaMagic,onRightIconClick:()=>{},tooltipContent:o0.createElement("div",null,o0.createElement("div",{style:{textAlign:"center",fontWeight:"bold"}},a.magic?.title),U)};return {firstName:X==="firstName"?{...x,tooltipAlign:"left"}:{},lastName:X==="lastName"?x:{}}},[h,b.lastName,a.magic?.title]),{reservationMode:_}=b,H=_==="check_in",A0=window.generalSettings?.obligatedFields||[],p0=Y=>A0.includes(Y),a0=Y=>!H&&p0(Y),q0=(Y,X)=>{let U=a.labels?.[Y]||X;return H?`${U} (Optioneel)`:p0(Y)?`${U} *`:U};return o0.createElement("div",{className:"reservation-step-two"},o0.createElement("div",{className:"account-manage-form"},s.length>0&&o0.createElement(_0,{label:`${a.labels?.menu||"Menu"}${H?" (Optioneel)":""}`,name:"menu",type:"select",options:s.map(Y=>({value:Y.name,label:Y.name})),value:b.menu,onChange:q,error:H?null:c.menu}),o0.createElement("div",{className:"name-fields"},o0.createElement(_0,{label:q0("firstName","Voornaam"),name:"firstName",placeholder:a.placeholders?.firstName||"",value:b.firstName,onChange:q,error:H?null:c.firstName,icon:FaUser,required:a0("firstName"),...j.firstName}),o0.createElement(_0,{label:q0("lastName","Achternaam"),name:"lastName",placeholder:a.placeholders?.lastName||"",value:b.lastName,onChange:q,error:H?null:c.lastName,icon:FaUser,required:a0("lastName"),...j.lastName})),o0.createElement(_0,{label:q0("email","Email"),name:"email",type:"email",placeholder:a.placeholders?.email||"",value:b.email,onChange:q,onBlur:C,error:c.email,icon:FaEnvelope,required:a0("email"),...m.email}),o0.createElement(_0,{label:q0("phone","Telefoon"),name:"phone",type:"tel",placeholder:a.placeholders?.phone||"",value:b.phone,onChange:q,onBlur:C,error:c.phone,icon:FaPhone,required:a0("phone"),...m.phone}),o0.createElement(_0,{label:a.labels?.extraInfo||"Extra info",name:"extraInfo",type:"textarea",placeholder:a.placeholders?.extraInfo||"",value:b.extraInfo,onChange:q,error:c.extraInfo,icon:FaInfoCircle})))});cp.displayName="ReservationStepTwo";var k2=cp;var Ap={nl:{reservationStepTwoFiltering:{labels:{menu:"Menu",firstName:"Voornaam",lastName:"Achternaam",email:"E-mail",phone:"Mobiel nummer",extraInfo:"Extra info",seatPlace:"Zitplaats"},placeholders:{firstName:"Voornaam",lastName:"Achternaam",email:"E-mailadres",phone:"Mobiel nummer",extraInfo:"Extra informatie",seatPlace:"Selecteer zitplaats"},magic:{title:"Gast Gegevens"}},reservationSummary:{title:"Reservatie Gegevens",guests:"Aantal gasten",date:"Datum",time:"Tijd",firstName:"Voornaam",lastName:"Achternaam",email:"E-mail",phone:"Mobiel nummer",menu:"Menu",staff:"Aangemaakt door",giftcard:"Cadeaubon",extraInfo:"Extra informatie",seatPlace:"Zitplaats",newReservationButton:"Nieuwe Reservatie Maken"}},en:{reservationStepTwoFiltering:{labels:{menu:"Menu",firstName:"First Name",lastName:"Last Name",email:"Email",phone:"Mobile Number",extraInfo:"Extra Info",seatPlace:"Seating area"},placeholders:{firstName:"First Name",lastName:"Last Name",email:"Email Address",phone:"Mobile Number",extraInfo:"Extra Information",seatPlace:"Select seating area"},magic:{title:"Guest Details"}},reservationSummary:{title:"Reservation Details",guests:"Number of Guests",date:"Date",time:"Time",firstName:"First Name",lastName:"Last Name",email:"Email",phone:"Mobile Number",menu:"Menu",staff:"Created by",giftcard:"Gift Card",extraInfo:"Extra Information",seatPlace:"Seating area",newReservationButton:"New Reservation"}},fr:{reservationStepTwoFiltering:{labels:{menu:"Menu",firstName:"Pr\xE9nom",lastName:"Nom",email:"E-mail",phone:"Num\xE9ro de portable",extraInfo:"Informations suppl\xE9mentaires",seatPlace:"Zone d\u2019assise"},placeholders:{firstName:"Pr\xE9nom",lastName:"Nom",email:"Adresse e-mail",phone:"Num\xE9ro de portable",extraInfo:"Informations suppl\xE9mentaires",seatPlace:"S\xE9lectionner une zone d\u2019assise"},magic:{title:"D\xE9tails Invit\xE9"}},reservationSummary:{title:"D\xE9tails de la R\xE9servation",guests:"Nombre d'invit\xE9s",date:"Date",time:"Heure",firstName:"Pr\xE9nom",lastName:"Nom",email:"E-mail",phone:"Num\xE9ro de portable",menu:"Menu",staff:"Cr\xE9\xE9 par",giftcard:"Carte Cadeau",extraInfo:"Informations suppl\xE9mentaires",seatPlace:"Zone d\u2019assise",newReservationButton:"Nouvelle R\xE9servation"}}};R0(`.new-reservation-page .reservation-sidebar-component .reservation-summary .modal-title{margin-top:0;margin-bottom:20px}.new-reservation-page .reservation-sidebar-component .reservation-summary .reservation-details{list-style-type:none;padding:0;margin:0 0 20px;width:100%}.new-reservation-page .reservation-sidebar-component .reservation-summary .reservation-details li{margin-bottom:10px;font-size:15px;align-items:left;text-align:left}.new-reservation-page .reservation-sidebar-component .reservation-summary .reservation-details li strong{font-weight:700}.new-reservation-page .reservation-sidebar-component .reservation-summary{align-items:left}
|
|
44
44
|
`);var a4=({formData:b,onNewReservation:c})=>{let q=j0(Ap,"reservationSummary");return o0.createElement("div",{className:"reservation-summary"},o0.createElement("ul",{className:"reservation-details"},o0.createElement("li",null,o0.createElement("strong",null,q.title)),o0.createElement("li",null,o0.createElement("strong",null,q.guests,":")," ",b.guests),o0.createElement("li",null,o0.createElement("strong",null,q.date,":")," ",b.date),o0.createElement("li",null,o0.createElement("strong",null,q.time,":")," ",b.time),o0.createElement("li",null,o0.createElement("strong",null,q.firstName,":")," ",b.firstName),o0.createElement("li",null,o0.createElement("strong",null,q.lastName,":")," ",b.lastName),o0.createElement("li",null,o0.createElement("strong",null,q.email,":")," ",b.email),o0.createElement("li",null,o0.createElement("strong",null,q.phone,":")," ",b.phone),b.menu&&o0.createElement("li",null,o0.createElement("strong",null,q.menu,":")," ",b.menu),b.personeel&&o0.createElement("li",null,o0.createElement("strong",null,q.staff,":")," ",b.personeel),b.giftcard&&o0.createElement("li",null,o0.createElement("strong",null,q.giftcard,":")," ",b.giftcard),b.extraInfo&&o0.createElement("li",null,o0.createElement("strong",null,q.extraInfo,":")," ",b.extraInfo),b.zitplaats&&o0.createElement("li",null,o0.createElement("strong",null,q.seatPlace,":")," ",b.zitplaats)),o0.createElement("button",{className:"button-style-3",onClick:c},q.newReservationButton))},w2=a4;var op={nl:{zitplaatsSelection:{labels:{seating:"Zitplaats"},options:{noPreference:"Geen voorkeur"}},giftcardSelection:{labels:{giftcard:"Cadeaubon"},options:{noGiftcard:"Geen Cadeaubon"}}},en:{zitplaatsSelection:{labels:{seating:"Seating"},options:{noPreference:"No preference"}},giftcardSelection:{labels:{giftcard:"Gift Card"},options:{noGiftcard:"No Gift Card"}}},fr:{zitplaatsSelection:{labels:{seating:"Place Assise"},options:{noPreference:"Pas de pr\xE9f\xE9rence"}},giftcardSelection:{labels:{giftcard:"Cadeau"},options:{noGiftcard:"Pas de carte"}}}};R0(`.new-reservation-page .giftcard-selection{margin-bottom:20px}.new-reservation-page .giftcard-options{display:flex;gap:20px;margin:10px 0}.new-reservation-page .giftcard-option{display:flex;align-items:center;gap:8px;cursor:pointer}.new-reservation-page .form-label{font-weight:500;margin-bottom:8px;display:block}.new-reservation-page .giftcard-option input[type=radio]{margin:0;cursor:pointer}.new-reservation-page .giftcard-option label{cursor:pointer}
|
|
45
45
|
`);var r4=({restaurantData:b,formData:c,handleChange:q,resetFormDataFields:e})=>{let W=j0(op,"giftcardSelection"),[n,a]=useState([]);if(useEffect(()=>{if(!b)return;let R=["breakfast","lunch","dinner"],v=new Set;R.forEach(u=>{let B=b[`openinghours-${u}`]?.schemeSettings||{};Object.values(B).forEach(h=>{h?.giftcardsEnabled&&Array.isArray(h.giftcards)&&h.giftcards.forEach(f=>{let g=typeof f=="string"?f.trim():String(f||"").trim();g&&v.add(g);});});}),a([...v]);},[b]),!n.length)return null;let s=n.map(R=>({value:R,label:R})),r=R=>{q({target:{name:"giftcard",value:R.target.value}}),e(["date","time"]);};return o0.createElement("div",{className:"giftcard-selection"},o0.createElement(_0,{label:W.labels?.giftcard||"Giftcard",name:"giftcard",type:"select",options:s,value:c.giftcard||"",onChange:r,selectPlaceholder:W.options?.noGiftcard||"Geen giftcard"}))},x2=r4;var P2=P0(c1());var ep={nl:{reservationSidebar:{saveButton:"Opslaan",saveButtonLoading:"Opslaan..."}},en:{reservationSidebar:{saveButton:"Save",saveButtonLoading:"Saving..."}},fr:{reservationSidebar:{saveButton:"Enregistrer",saveButtonLoading:"Enregistrement..."}}};R0(`.reservation-sidebar-component{position:fixed;top:0;right:-400px;width:400px;height:100%;background-color:#fff;box-shadow:-2px 0 5px #0000001a;z-index:var(--z-index-sidebar-reservation);display:flex;flex-direction:column;overflow-y:auto;transition:right .3s ease-in-out}.admin-title{text-align:center;margin-bottom:30px}.reservation-sidebar-component.open{right:0}.reservation-sidebar-content{padding:60px 20px 20px}.close-sidebar-button{position:absolute;top:10px;left:10px;background-color:transparent;border:none;cursor:pointer}.close-sidebar-button svg{color:#000}.sidebar-section-one,.sidebar-section-two{margin-bottom:20px}.reservation-footer{margin-top:auto}.store-reservation-button{width:100%;padding:12px;background-color:var(--color-blue);color:#fff;border:none;border-radius:5px;cursor:pointer;font-size:1.1rem}.open-sidebar-button{position:fixed;bottom:20px;right:20px;background-color:var(--color-blue);color:#fff;border:none;border-radius:50%;width:50px;height:50px;cursor:pointer;z-index:var(--z-index-modal)!important;transition:all .3s ease}.open-sidebar-button:hover{background-color:var(--color-blue-hover-accent)!important}.open-sidebar-button svg{position:relative;top:2px}@media screen and (max-width:480px){.reservation-sidebar-component{width:100%}}.sidebar-section-personeel{margin-bottom:10px}.sidebar-tabs{display:flex;border-bottom:1px solid #ddd;margin-bottom:20px}.sidebar-tab-button{flex:1;padding:10px;border:none;background:transparent;border-bottom:none;font-weight:400;cursor:pointer;color:#666}.sidebar-tab-button.active{border-bottom:2px solid var(--color-blue);font-weight:700;color:var(--color-blue)}
|
package/package.json
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@happychef/reservation-sidebar",
|
|
3
|
-
"version": "2.8.
|
|
4
|
-
"description": "A compound component for managing restaurant reservations - JavaScript version with independent styles",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"module": "dist/index.mjs",
|
|
7
|
-
"files": [
|
|
8
|
-
"dist",
|
|
9
|
-
"README.md"
|
|
10
|
-
],
|
|
11
|
-
"exports": {
|
|
12
|
-
".": {
|
|
13
|
-
"import": "./dist/index.mjs",
|
|
14
|
-
"require": "./dist/index.js"
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"scripts": {
|
|
18
|
-
"build": "tsup",
|
|
19
|
-
"dev": "tsup --watch",
|
|
20
|
-
"prepublishOnly": "npm run build"
|
|
21
|
-
},
|
|
22
|
-
"keywords": [
|
|
23
|
-
"react",
|
|
24
|
-
"reservation",
|
|
25
|
-
"sidebar",
|
|
26
|
-
"restaurant",
|
|
27
|
-
"happychef"
|
|
28
|
-
],
|
|
29
|
-
"author": "HappyChef",
|
|
30
|
-
"license": "MIT",
|
|
31
|
-
"peerDependencies": {
|
|
32
|
-
"axios": "^1.0.0",
|
|
33
|
-
"framer-motion": "^10.0.0 || ^11.0.0 || ^12.0.0",
|
|
34
|
-
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
35
|
-
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
36
|
-
"react-icons": "^4.0.0 || ^5.0.0"
|
|
37
|
-
},
|
|
38
|
-
"dependencies": {
|
|
39
|
-
"moment-timezone": "^0.5.48"
|
|
40
|
-
},
|
|
41
|
-
"devDependencies": {
|
|
42
|
-
"@happychef/algorithm": "^1.2.
|
|
43
|
-
"axios": "^1.7.9",
|
|
44
|
-
"framer-motion": "^12.23.24",
|
|
45
|
-
"moment-timezone": "^0.5.48",
|
|
46
|
-
"react": "^18.3.1",
|
|
47
|
-
"react-dom": "^18.3.1",
|
|
48
|
-
"react-icons": "^5.3.0",
|
|
49
|
-
"tsup": "^8.5.1",
|
|
50
|
-
"typescript": "^5.9.3"
|
|
51
|
-
},
|
|
52
|
-
"repository": {
|
|
53
|
-
"type": "git",
|
|
54
|
-
"url": "https://github.com/thibaultvandesompele2/16-happy-admin-reservation.git"
|
|
55
|
-
}
|
|
56
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@happychef/reservation-sidebar",
|
|
3
|
+
"version": "2.8.45",
|
|
4
|
+
"description": "A compound component for managing restaurant reservations - JavaScript version with independent styles",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/index.mjs",
|
|
14
|
+
"require": "./dist/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsup",
|
|
19
|
+
"dev": "tsup --watch",
|
|
20
|
+
"prepublishOnly": "npm run build"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"react",
|
|
24
|
+
"reservation",
|
|
25
|
+
"sidebar",
|
|
26
|
+
"restaurant",
|
|
27
|
+
"happychef"
|
|
28
|
+
],
|
|
29
|
+
"author": "HappyChef",
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"axios": "^1.0.0",
|
|
33
|
+
"framer-motion": "^10.0.0 || ^11.0.0 || ^12.0.0",
|
|
34
|
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
35
|
+
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
36
|
+
"react-icons": "^4.0.0 || ^5.0.0"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"moment-timezone": "^0.5.48"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@happychef/algorithm": "^1.2.30",
|
|
43
|
+
"axios": "^1.7.9",
|
|
44
|
+
"framer-motion": "^12.23.24",
|
|
45
|
+
"moment-timezone": "^0.5.48",
|
|
46
|
+
"react": "^18.3.1",
|
|
47
|
+
"react-dom": "^18.3.1",
|
|
48
|
+
"react-icons": "^5.3.0",
|
|
49
|
+
"tsup": "^8.5.1",
|
|
50
|
+
"typescript": "^5.9.3"
|
|
51
|
+
},
|
|
52
|
+
"repository": {
|
|
53
|
+
"type": "git",
|
|
54
|
+
"url": "https://github.com/thibaultvandesompele2/16-happy-admin-reservation.git"
|
|
55
|
+
}
|
|
56
|
+
}
|