@vicacha-devs/strapi-plugin-bookings 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +23 -2
- package/dist/admin/App-BrB9n7EO.mjs +371 -0
- package/dist/admin/App-ZlqOsILc.js +371 -0
- package/dist/admin/SettingsPage-LR6F2vyx.js +410 -0
- package/dist/admin/SettingsPage-Xas3gvn4.mjs +410 -0
- package/dist/admin/ar-9_2mxMp2.js +339 -0
- package/dist/admin/ar-CrM4yxqb.mjs +339 -0
- package/dist/admin/de-D3NbAP6M.mjs +339 -0
- package/dist/admin/de-DBaO-D7Z.js +339 -0
- package/dist/admin/en-Cu-rn_xM.mjs +339 -0
- package/dist/admin/en-DAoI7qkk.js +339 -0
- package/dist/admin/es-DUqsu82s.js +339 -0
- package/dist/admin/es-Y0zfya4P.mjs +339 -0
- package/dist/admin/fr-BkLta_o8.js +339 -0
- package/dist/admin/fr-BrzKRqet.mjs +339 -0
- package/dist/admin/getTranslation-CZAJyMSt.mjs +5 -0
- package/dist/admin/getTranslation-Cd0_4UtW.js +4 -0
- package/dist/admin/id-BZz53ViW.mjs +339 -0
- package/dist/admin/id-ByxSagzq.js +339 -0
- package/dist/admin/index.js +1497 -0
- package/dist/admin/index.mjs +1492 -0
- package/dist/admin/pt-BSCDUkdd.js +339 -0
- package/dist/admin/pt-DUfISuZf.mjs +339 -0
- package/dist/admin/src/components/Initializer.d.ts +6 -0
- package/dist/admin/src/components/PluginIcon.d.ts +3 -0
- package/dist/admin/src/components/RRuleInput.d.ts +3 -0
- package/dist/admin/src/components/bookings/BookingSidePanel.d.ts +10 -0
- package/dist/admin/src/components/bookings/BookingsGridCanvas.d.ts +20 -0
- package/dist/admin/src/components/bookings/QuickCreateBookingModal.d.ts +11 -0
- package/dist/admin/src/index.d.ts +24 -0
- package/dist/admin/src/pages/App.d.ts +3 -0
- package/dist/admin/src/pages/CalendarPage.d.ts +3 -0
- package/dist/admin/src/pages/SettingsPage.d.ts +3 -0
- package/dist/admin/src/permissions.d.ts +29 -0
- package/dist/admin/src/pluginId.d.ts +1 -0
- package/dist/admin/src/translations/cmLabels.d.ts +1 -0
- package/dist/admin/src/translations/cmPlaceholders.d.ts +1 -0
- package/dist/admin/src/utils/getTranslation.d.ts +2 -0
- package/dist/admin/tr-_nhc9hk6.mjs +339 -0
- package/dist/admin/tr-r17l5F2K.js +339 -0
- package/dist/admin/ur-8edBd0Qo.mjs +339 -0
- package/dist/admin/ur-Dw_TAOZ3.js +339 -0
- package/dist/admin/zh-CeR0swEm.mjs +339 -0
- package/dist/admin/zh-D0z5sxxN.js +339 -0
- package/dist/server/index.js +3547 -0
- package/dist/server/index.mjs +3545 -0
- package/dist/server/src/bootstrap.d.ts +6 -0
- package/dist/server/src/config/index.d.ts +6 -0
- package/dist/server/src/content-types/booking/schema.json.d.ts +117 -0
- package/dist/server/src/content-types/index.d.ts +265 -0
- package/dist/server/src/content-types/resource/schema.json.d.ts +147 -0
- package/dist/server/src/controllers/admin.d.ts +30 -0
- package/dist/server/src/controllers/content-api.d.ts +32 -0
- package/dist/server/src/controllers/index.d.ts +28 -0
- package/dist/server/src/destroy.d.ts +5 -0
- package/dist/server/src/errors.d.ts +18 -0
- package/dist/server/src/index.d.ts +347 -0
- package/dist/server/src/register.d.ts +5 -0
- package/dist/server/src/routes/admin.d.ts +14 -0
- package/dist/server/src/routes/content-api.d.ts +9 -0
- package/dist/server/src/routes/index.d.ts +30 -0
- package/dist/server/src/services/availability.d.ts +8 -0
- package/dist/server/src/services/index.d.ts +12 -0
- package/dist/server/src/services/reservation.d.ts +6 -0
- package/dist/server/src/services/reservationHelpers.d.ts +41 -0
- package/dist/server/src/services/reservationHostCapacity.d.ts +16 -0
- package/dist/server/src/services/reservationMutations.d.ts +32 -0
- package/dist/server/src/services/reservationSources.d.ts +4 -0
- package/dist/server/src/services/reservationValidators.d.ts +27 -0
- package/dist/server/src/services/settings.d.ts +8 -0
- package/dist/server/src/types.d.ts +99 -0
- package/dist/shared/calendarSystems.d.ts +3 -0
- package/dist/shared/icalAndCsv.d.ts +16 -0
- package/dist/shared/index.d.ts +6 -0
- package/dist/shared/index.js +752 -0
- package/dist/shared/index.mjs +729 -0
- package/dist/shared/pluginId.d.ts +2 -0
- package/dist/shared/slotEngine.d.ts +19 -0
- package/dist/shared/slotTimezone.d.ts +45 -0
- package/dist/shared/types.d.ts +245 -0
- package/package.json +111 -3
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Vicacha Devs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@vicacha-devs/strapi-plugin-bookings`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Generic **Bookings, Appointments, Resource Scheduling & Time-Slot Availability Engine** for **Strapi v5**, powered by [`@vicacha-devs/strapi-plugin-calendar`](../strapi-plugin-calendar) as a required dependency.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Key Features
|
|
8
|
+
|
|
9
|
+
- **Bookable Resources & Operating Schedules (`plugin::bookings.resource`)**:
|
|
10
|
+
- Model any bookable resource: services, consultations, appointments, rooms, staff members, or equipment.
|
|
11
|
+
- Supports both **interval slicing** (`slotDurationMinutes` + `bufferBeforeMinutes` + `bufferAfterMinutes`) and **named time windows** (`mode: 'window'`, e.g. `morning` `09:00-12:00`, `afternoon` `14:00-17:00`).
|
|
12
|
+
- Per-slot capacity (`capacityPerSlot`), maximum party size (`maxPartySize`), minimum lead-time hours (`minLeadTimeHours`), maximum advance horizon (`maxAdvanceDays`), seasonal schedule overrides (`seasonalSchedules`), holiday rules (`holidayRules`), and blackout periods (`blackoutDates`).
|
|
13
|
+
- **Reservations & Self-Service Token Workflows (`plugin::bookings.booking`)**:
|
|
14
|
+
- Atomic capacity and double-booking validation across overlapping slots and buffer windows.
|
|
15
|
+
- Automatic staff/host assignment matching `preferredLanguage` and real-time slot availability.
|
|
16
|
+
- Cryptographically generated self-service reschedule & cancel tokens (`SHA-256` hashed at rest, verified with `crypto.timingSafeEqual`).
|
|
17
|
+
- **Dedicated Reservations Approval & Resource Workspace (`/admin/plugins/bookings`) + Unified Calendar Integration**:
|
|
18
|
+
- **Required Dependency on `@vicacha-devs/strapi-plugin-calendar`**: Automatically registers `plugin::bookings.booking` into the central `/admin/plugins/calendar` registry on server bootstrap so all schedule grid views are unified in one place (with a 1-click **Open in Calendar** shortcut to `/admin/plugins/calendar?source=bookings`).
|
|
19
|
+
- **Reservations Approval, Resource Filter & Ledger Workspace**: KPI summary cards, bookable resource / status / search filters, the reservations ledger, `BookingSidePanel` for Approve / Reject / Cancel / Complete & staff host assignment, and `+ New Booking` creation modal.
|
|
20
|
+
- **100% Generic & Extensible**:
|
|
21
|
+
- Extend `resource` and `booking` schemas via `schemaExtensions` in `config/plugins.ts` without forking the plugin.
|
|
22
|
+
- Map existing Strapi collections into the Bookings Ledger via `sources`.
|
|
23
|
+
- **13-Locale Admin UI**:
|
|
24
|
+
- Ships with full translations for `en`, `es`, `ar`, `tr`, `fr`, `de`, `pt`, `it`, `nl`, `pl`, `id`, `ur`, and `zh`.
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useNavigate, Routes, Route } from "react-router-dom";
|
|
3
|
+
import { Flex, Button, Box, Typography, Badge, Field, SingleSelect, SingleSelectOption, TextInput } from "@strapi/design-system";
|
|
4
|
+
import { useFetchClient, useNotification, Layouts } from "@strapi/strapi/admin";
|
|
5
|
+
import { useRef, useEffect, useCallback, useState } from "react";
|
|
6
|
+
import { useIntl } from "react-intl";
|
|
7
|
+
import { PLUGIN_ID, BookingsGridCanvas, BookingSidePanel, QuickCreateBookingModal } from "./index.mjs";
|
|
8
|
+
import { g as getTranslation } from "./getTranslation-CZAJyMSt.mjs";
|
|
9
|
+
const EMPTY_STATS = {
|
|
10
|
+
totalBookings: 0,
|
|
11
|
+
confirmedBookings: 0,
|
|
12
|
+
pendingBookings: 0,
|
|
13
|
+
cancelledBookings: 0,
|
|
14
|
+
completedBookings: 0,
|
|
15
|
+
totalGuests: 0,
|
|
16
|
+
activeResources: 0
|
|
17
|
+
};
|
|
18
|
+
const CalendarPage = () => {
|
|
19
|
+
const { formatMessage } = useIntl();
|
|
20
|
+
const navigate = useNavigate();
|
|
21
|
+
const { get, post, put } = useFetchClient();
|
|
22
|
+
const { toggleNotification } = useNotification();
|
|
23
|
+
const isMountedRef = useRef(true);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
isMountedRef.current = true;
|
|
26
|
+
return () => {
|
|
27
|
+
isMountedRef.current = false;
|
|
28
|
+
};
|
|
29
|
+
}, []);
|
|
30
|
+
const t = useCallback(
|
|
31
|
+
(id, defaultMessage) => formatMessage({ id: getTranslation(id), defaultMessage }),
|
|
32
|
+
[formatMessage]
|
|
33
|
+
);
|
|
34
|
+
const [bookings, setBookings] = useState([]);
|
|
35
|
+
const [resources, setResources] = useState([]);
|
|
36
|
+
const [stats, setStats] = useState(EMPTY_STATS);
|
|
37
|
+
const [selectedResourceId, setSelectedResourceId] = useState("");
|
|
38
|
+
const [selectedStatus, setSelectedStatus] = useState("");
|
|
39
|
+
const [search, setSearch] = useState("");
|
|
40
|
+
const [debouncedSearch, setDebouncedSearch] = useState("");
|
|
41
|
+
const [selectedBooking, setSelectedBooking] = useState(
|
|
42
|
+
null
|
|
43
|
+
);
|
|
44
|
+
const [quickCreateStartIso, setQuickCreateStartIso] = useState(
|
|
45
|
+
null
|
|
46
|
+
);
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
const timer = setTimeout(() => {
|
|
49
|
+
if (isMountedRef.current) {
|
|
50
|
+
setDebouncedSearch(search);
|
|
51
|
+
}
|
|
52
|
+
}, 250);
|
|
53
|
+
return () => clearTimeout(timer);
|
|
54
|
+
}, [search]);
|
|
55
|
+
const fetchBookingsData = useCallback(async () => {
|
|
56
|
+
try {
|
|
57
|
+
const params = new URLSearchParams();
|
|
58
|
+
if (selectedResourceId) {
|
|
59
|
+
params.set("resourceDocumentId", selectedResourceId);
|
|
60
|
+
}
|
|
61
|
+
if (selectedStatus) {
|
|
62
|
+
params.set("status", selectedStatus);
|
|
63
|
+
}
|
|
64
|
+
if (debouncedSearch.trim()) {
|
|
65
|
+
params.set("search", debouncedSearch.trim());
|
|
66
|
+
}
|
|
67
|
+
const res = await get(`/${PLUGIN_ID}/calendar?${params.toString()}`);
|
|
68
|
+
if (!isMountedRef.current) return;
|
|
69
|
+
const payload = res.data?.data;
|
|
70
|
+
if (payload) {
|
|
71
|
+
const nextBookings = payload.bookings ?? [];
|
|
72
|
+
setBookings(nextBookings);
|
|
73
|
+
setResources(payload.resources ?? []);
|
|
74
|
+
setStats(payload.stats ?? EMPTY_STATS);
|
|
75
|
+
setSelectedBooking((prev) => {
|
|
76
|
+
if (!prev) return null;
|
|
77
|
+
return nextBookings.find((b) => b.documentId === prev.documentId) ?? null;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
} catch {
|
|
81
|
+
if (!isMountedRef.current) return;
|
|
82
|
+
toggleNotification({
|
|
83
|
+
type: "danger",
|
|
84
|
+
message: t("notifications.loadError", "Failed to load bookings")
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}, [
|
|
88
|
+
get,
|
|
89
|
+
selectedResourceId,
|
|
90
|
+
selectedStatus,
|
|
91
|
+
debouncedSearch,
|
|
92
|
+
toggleNotification,
|
|
93
|
+
t
|
|
94
|
+
]);
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
void fetchBookingsData();
|
|
97
|
+
}, [fetchBookingsData]);
|
|
98
|
+
const handleUpdateStatus = async (documentId, status, assignedHost, internalNotes) => {
|
|
99
|
+
try {
|
|
100
|
+
const res = await put(
|
|
101
|
+
`/${PLUGIN_ID}/bookings/${documentId}/status`,
|
|
102
|
+
{
|
|
103
|
+
status,
|
|
104
|
+
assignedHost,
|
|
105
|
+
internalNotes
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
if (isMountedRef.current && res.data?.data) {
|
|
109
|
+
setSelectedBooking(res.data.data);
|
|
110
|
+
}
|
|
111
|
+
toggleNotification({
|
|
112
|
+
type: "success",
|
|
113
|
+
message: t("notifications.updated", "Booking updated")
|
|
114
|
+
});
|
|
115
|
+
await fetchBookingsData();
|
|
116
|
+
} catch {
|
|
117
|
+
toggleNotification({
|
|
118
|
+
type: "danger",
|
|
119
|
+
message: t("notifications.updateError", "Failed to update booking")
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
const handleCreateBooking = async (payload) => {
|
|
124
|
+
try {
|
|
125
|
+
await post(`/${PLUGIN_ID}/bookings`, payload);
|
|
126
|
+
toggleNotification({
|
|
127
|
+
type: "success",
|
|
128
|
+
message: t("notifications.created", "Booking created")
|
|
129
|
+
});
|
|
130
|
+
await fetchBookingsData();
|
|
131
|
+
} catch (err) {
|
|
132
|
+
toggleNotification({
|
|
133
|
+
type: "danger",
|
|
134
|
+
message: t("notifications.createError", "Failed to create booking")
|
|
135
|
+
});
|
|
136
|
+
throw err;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
const handleExportCsv = async () => {
|
|
140
|
+
try {
|
|
141
|
+
const params = new URLSearchParams();
|
|
142
|
+
if (selectedResourceId) {
|
|
143
|
+
params.set("resourceDocumentId", selectedResourceId);
|
|
144
|
+
}
|
|
145
|
+
if (selectedStatus) {
|
|
146
|
+
params.set("status", selectedStatus);
|
|
147
|
+
}
|
|
148
|
+
if (debouncedSearch.trim()) {
|
|
149
|
+
params.set("search", debouncedSearch.trim());
|
|
150
|
+
}
|
|
151
|
+
const qs = params.toString();
|
|
152
|
+
const url = qs ? `/${PLUGIN_ID}/export.csv?${qs}` : `/${PLUGIN_ID}/export.csv`;
|
|
153
|
+
const res = await get(url);
|
|
154
|
+
const csvText = typeof res.data === "string" ? res.data : String(res.data ?? "");
|
|
155
|
+
const blob = new Blob([csvText], { type: "text/csv;charset=utf-8;" });
|
|
156
|
+
const objectUrl = URL.createObjectURL(blob);
|
|
157
|
+
try {
|
|
158
|
+
const link = document.createElement("a");
|
|
159
|
+
link.href = objectUrl;
|
|
160
|
+
link.setAttribute("download", "bookings.csv");
|
|
161
|
+
document.body.appendChild(link);
|
|
162
|
+
link.click();
|
|
163
|
+
document.body.removeChild(link);
|
|
164
|
+
} finally {
|
|
165
|
+
URL.revokeObjectURL(objectUrl);
|
|
166
|
+
}
|
|
167
|
+
} catch {
|
|
168
|
+
toggleNotification({
|
|
169
|
+
type: "danger",
|
|
170
|
+
message: t("notifications.exportError", "Failed to export CSV")
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
const handleOpenInContentManager = (booking) => {
|
|
175
|
+
const uid = booking.sourceCollection || "plugin::bookings.booking";
|
|
176
|
+
navigate(`/content-manager/collection-types/${uid}/${booking.documentId}`);
|
|
177
|
+
};
|
|
178
|
+
return /* @__PURE__ */ jsxs(Layouts.Root, { children: [
|
|
179
|
+
/* @__PURE__ */ jsx(
|
|
180
|
+
Layouts.Header,
|
|
181
|
+
{
|
|
182
|
+
title: t("plugin.title", "Bookings & Slot Availability"),
|
|
183
|
+
subtitle: t(
|
|
184
|
+
"plugin.subtitle",
|
|
185
|
+
"Manage bookable resources, time-slot availability, staff assignment, and reservation approvals. Schedule views are unified in Calendar."
|
|
186
|
+
),
|
|
187
|
+
primaryAction: /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
188
|
+
/* @__PURE__ */ jsx(
|
|
189
|
+
Button,
|
|
190
|
+
{
|
|
191
|
+
variant: "secondary",
|
|
192
|
+
onClick: () => navigate("/plugins/calendar?source=bookings"),
|
|
193
|
+
children: t("actions.openUnifiedCalendar", "Open in Calendar")
|
|
194
|
+
}
|
|
195
|
+
),
|
|
196
|
+
/* @__PURE__ */ jsx(
|
|
197
|
+
Button,
|
|
198
|
+
{
|
|
199
|
+
variant: "tertiary",
|
|
200
|
+
onClick: () => navigate(`/settings/${PLUGIN_ID}`),
|
|
201
|
+
children: t("actions.settings", "Settings")
|
|
202
|
+
}
|
|
203
|
+
),
|
|
204
|
+
/* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: () => void handleExportCsv(), children: t("actions.exportCsv", "Export CSV") }),
|
|
205
|
+
/* @__PURE__ */ jsx(
|
|
206
|
+
Button,
|
|
207
|
+
{
|
|
208
|
+
variant: "default",
|
|
209
|
+
onClick: () => setQuickCreateStartIso((/* @__PURE__ */ new Date()).toISOString().slice(0, 10)),
|
|
210
|
+
children: t("actions.newBooking", "New Booking")
|
|
211
|
+
}
|
|
212
|
+
)
|
|
213
|
+
] })
|
|
214
|
+
}
|
|
215
|
+
),
|
|
216
|
+
/* @__PURE__ */ jsxs(Layouts.Content, { children: [
|
|
217
|
+
/* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 5, children: [
|
|
218
|
+
/* @__PURE__ */ jsx(Flex, { gap: 4, wrap: "wrap", children: [
|
|
219
|
+
{
|
|
220
|
+
label: t("stats.total", "Total Bookings"),
|
|
221
|
+
value: stats.totalBookings,
|
|
222
|
+
badge: "neutral100"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
label: t("stats.confirmed", "Confirmed"),
|
|
226
|
+
value: stats.confirmedBookings,
|
|
227
|
+
badge: "success100"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
label: t("stats.pending", "Pending Approval"),
|
|
231
|
+
value: stats.pendingBookings,
|
|
232
|
+
badge: "warning100"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
label: t("stats.guests", "Total Guests / Seats"),
|
|
236
|
+
value: stats.totalGuests,
|
|
237
|
+
badge: "primary100"
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
label: t("stats.resources", "Active Resources"),
|
|
241
|
+
value: stats.activeResources,
|
|
242
|
+
badge: "secondary100"
|
|
243
|
+
}
|
|
244
|
+
].map((card) => /* @__PURE__ */ jsx(
|
|
245
|
+
Box,
|
|
246
|
+
{
|
|
247
|
+
background: "neutral0",
|
|
248
|
+
hasRadius: true,
|
|
249
|
+
shadow: "tableShadow",
|
|
250
|
+
padding: 4,
|
|
251
|
+
style: { flex: "1 1 180px" },
|
|
252
|
+
children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", gap: 1, children: [
|
|
253
|
+
/* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", children: card.label }),
|
|
254
|
+
/* @__PURE__ */ jsx(Badge, { backgroundColor: card.badge, children: card.value })
|
|
255
|
+
] })
|
|
256
|
+
},
|
|
257
|
+
card.label
|
|
258
|
+
)) }),
|
|
259
|
+
/* @__PURE__ */ jsx(Box, { background: "neutral0", hasRadius: true, shadow: "tableShadow", padding: 4, children: /* @__PURE__ */ jsxs(
|
|
260
|
+
"div",
|
|
261
|
+
{
|
|
262
|
+
style: {
|
|
263
|
+
display: "grid",
|
|
264
|
+
gridTemplateColumns: "repeat(3, minmax(0, 1fr))",
|
|
265
|
+
gap: 12
|
|
266
|
+
},
|
|
267
|
+
children: [
|
|
268
|
+
/* @__PURE__ */ jsxs(Field.Root, { children: [
|
|
269
|
+
/* @__PURE__ */ jsx(Field.Label, { children: t("filters.resource", "Bookable Resource") }),
|
|
270
|
+
/* @__PURE__ */ jsxs(
|
|
271
|
+
SingleSelect,
|
|
272
|
+
{
|
|
273
|
+
placeholder: t("placeholder.all_resources", "All Resources"),
|
|
274
|
+
value: selectedResourceId || "all",
|
|
275
|
+
onChange: (val) => setSelectedResourceId(
|
|
276
|
+
String(val) === "all" ? "" : String(val)
|
|
277
|
+
),
|
|
278
|
+
children: [
|
|
279
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "all", children: t("filters.allResources", "All Resources") }),
|
|
280
|
+
resources.map((res) => /* @__PURE__ */ jsx(
|
|
281
|
+
SingleSelectOption,
|
|
282
|
+
{
|
|
283
|
+
value: res.documentId,
|
|
284
|
+
children: res.name
|
|
285
|
+
},
|
|
286
|
+
res.documentId
|
|
287
|
+
))
|
|
288
|
+
]
|
|
289
|
+
}
|
|
290
|
+
)
|
|
291
|
+
] }),
|
|
292
|
+
/* @__PURE__ */ jsxs(Field.Root, { children: [
|
|
293
|
+
/* @__PURE__ */ jsx(Field.Label, { children: t("filters.status", "Booking Status") }),
|
|
294
|
+
/* @__PURE__ */ jsxs(
|
|
295
|
+
SingleSelect,
|
|
296
|
+
{
|
|
297
|
+
placeholder: t("placeholder.all_statuses", "All Statuses"),
|
|
298
|
+
value: selectedStatus || "all",
|
|
299
|
+
onChange: (val) => setSelectedStatus(String(val) === "all" ? "" : String(val)),
|
|
300
|
+
children: [
|
|
301
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "all", children: t("filters.allStatuses", "All Statuses") }),
|
|
302
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "pending", children: t("page.ui.pending", "PENDING") }),
|
|
303
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "confirmed", children: t("page.ui.confirmed", "CONFIRMED") }),
|
|
304
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "completed", children: t("page.ui.completed", "COMPLETED") }),
|
|
305
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "cancelled", children: t("page.ui.cancelled", "CANCELLED") }),
|
|
306
|
+
/* @__PURE__ */ jsx(SingleSelectOption, { value: "no_show", children: t("page.ui.no_show", "NO SHOW") })
|
|
307
|
+
]
|
|
308
|
+
}
|
|
309
|
+
)
|
|
310
|
+
] }),
|
|
311
|
+
/* @__PURE__ */ jsxs(Field.Root, { children: [
|
|
312
|
+
/* @__PURE__ */ jsx(Field.Label, { children: t("filters.search", "Search Reservations") }),
|
|
313
|
+
/* @__PURE__ */ jsx(
|
|
314
|
+
TextInput,
|
|
315
|
+
{
|
|
316
|
+
placeholder: t(
|
|
317
|
+
"filters.searchPlaceholder",
|
|
318
|
+
"Code, customer, host, org..."
|
|
319
|
+
),
|
|
320
|
+
value: search,
|
|
321
|
+
onChange: (e) => setSearch(e.target.value)
|
|
322
|
+
}
|
|
323
|
+
)
|
|
324
|
+
] })
|
|
325
|
+
]
|
|
326
|
+
}
|
|
327
|
+
) }),
|
|
328
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 4, alignItems: "flex-start", children: [
|
|
329
|
+
/* @__PURE__ */ jsx(Box, { style: { flex: 1, minWidth: 0 }, children: /* @__PURE__ */ jsx(
|
|
330
|
+
BookingsGridCanvas,
|
|
331
|
+
{
|
|
332
|
+
t,
|
|
333
|
+
bookings,
|
|
334
|
+
onSelectBooking: (b) => setSelectedBooking(b)
|
|
335
|
+
}
|
|
336
|
+
) }),
|
|
337
|
+
selectedBooking && /* @__PURE__ */ jsx(
|
|
338
|
+
BookingSidePanel,
|
|
339
|
+
{
|
|
340
|
+
t,
|
|
341
|
+
booking: selectedBooking,
|
|
342
|
+
onClose: () => setSelectedBooking(null),
|
|
343
|
+
onUpdateStatus: handleUpdateStatus,
|
|
344
|
+
onOpenInContentManager: handleOpenInContentManager
|
|
345
|
+
}
|
|
346
|
+
)
|
|
347
|
+
] })
|
|
348
|
+
] }),
|
|
349
|
+
/* @__PURE__ */ jsx(
|
|
350
|
+
QuickCreateBookingModal,
|
|
351
|
+
{
|
|
352
|
+
t,
|
|
353
|
+
isOpen: Boolean(quickCreateStartIso),
|
|
354
|
+
initialStartIso: quickCreateStartIso || (/* @__PURE__ */ new Date()).toISOString().slice(0, 10),
|
|
355
|
+
resources,
|
|
356
|
+
onClose: () => setQuickCreateStartIso(null),
|
|
357
|
+
onSubmit: handleCreateBooking
|
|
358
|
+
}
|
|
359
|
+
)
|
|
360
|
+
] })
|
|
361
|
+
] });
|
|
362
|
+
};
|
|
363
|
+
const App = () => {
|
|
364
|
+
return /* @__PURE__ */ jsxs(Routes, { children: [
|
|
365
|
+
/* @__PURE__ */ jsx(Route, { index: true, element: /* @__PURE__ */ jsx(CalendarPage, {}) }),
|
|
366
|
+
/* @__PURE__ */ jsx(Route, { path: "*", element: /* @__PURE__ */ jsx(CalendarPage, {}) })
|
|
367
|
+
] });
|
|
368
|
+
};
|
|
369
|
+
export {
|
|
370
|
+
App
|
|
371
|
+
};
|