@oneclick.dev/cms-core-modules 0.0.104 → 0.0.106

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.
Files changed (73) hide show
  1. package/dist/{Acquisition-CPlZzUBo.mjs → Acquisition-B2pM5vSp.mjs} +2 -2
  2. package/dist/{Acquisition-Br1Pfny3.js → Acquisition-Dt2rREU8.js} +1 -1
  3. package/dist/{Audience-BfkrmBuQ.js → Audience-Bs7b0TNm.js} +1 -1
  4. package/dist/{Audience-DTblSAiL.mjs → Audience-VLnUsQvW.mjs} +2 -2
  5. package/dist/{ContentEditor-B1nfKG_5.mjs → ContentEditor-BNLEv-qJ.mjs} +3119 -3098
  6. package/dist/{ContentEditor-DdFU8piH.js → ContentEditor-BUvvqfG1.js} +36 -36
  7. package/dist/{Create-qPeQxkdl.js → Create-89z41K73.js} +1 -1
  8. package/dist/{Create-BRBh0xjM.mjs → Create-Cn_Eufga.mjs} +5 -1
  9. package/dist/{Entries-C8UJkrVC.mjs → Entries-BdhUyJR5.mjs} +1 -1
  10. package/dist/{Entries-BaS6H6ak.js → Entries-CEXM_SkO.js} +1 -1
  11. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-Ceoje52V.js +1 -0
  12. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-DMGcRmm-.mjs +1255 -0
  13. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-COrK1j0S.js +1 -0
  14. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-Vb3q8EVv.mjs +330 -0
  15. package/dist/{Overview-CpHhuiaV.js → Overview-Bn1Xx3_j.js} +1 -1
  16. package/dist/{Overview-BrCwozey.js → Overview-DC9io1bk.js} +1 -1
  17. package/dist/Overview-Di84CsR5.mjs +476 -0
  18. package/dist/Overview-UoZHUMUz.js +1 -0
  19. package/dist/{Overview-kaMhsIUq.mjs → Overview-ejh4vUMT.mjs} +3 -3
  20. package/dist/{Overview-D_T3K6aq.mjs → Overview-lWAyyenp.mjs} +1 -1
  21. package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-CuwREvXD.js +349 -0
  22. package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-GYNZ_yhD.mjs +3077 -0
  23. package/dist/{SeoHealth-BzcWd_w7.mjs → SeoHealth-DsbVdd2l.mjs} +3 -3
  24. package/dist/SeoHealth-az1YuNF2.js +1 -0
  25. package/dist/{TableView-DXmEF6pY.mjs → TableView-Bm6HaRHm.mjs} +1 -1
  26. package/dist/{TableView-CPAw3h8g.js → TableView-DQW0A1oG.js} +1 -1
  27. package/dist/agenda-IOqtALWf.js +1 -0
  28. package/dist/agenda-neyeLWv-.mjs +1165 -0
  29. package/dist/cms-core-modules.css +1 -1
  30. package/dist/{index-C4YUVWzJ.js → index-A2kp8Isi.js} +6 -6
  31. package/dist/{index-BuzLn4Km.js → index-B5aBwdxY.js} +2 -2
  32. package/dist/{index-p5Uqu8c2.mjs → index-BRdCrvcz.mjs} +52 -47
  33. package/dist/{index-D3L8WAJI.js → index-BiT55eU0.js} +2 -2
  34. package/dist/{index-CMk3uhUt.mjs → index-Bvxc5xv_.mjs} +153 -147
  35. package/dist/{index-DQYBP8Js.js → index-G7cIlnGN.js} +4 -4
  36. package/dist/{index-DjDCYQ_6.mjs → index-X6LV64jK.mjs} +102 -101
  37. package/dist/{index-_2lRVt_k.mjs → index-uOkqO74I.mjs} +105 -107
  38. package/dist/index-unsDfNYv.mjs +1187 -0
  39. package/dist/index-vHmvbEwa.js +35 -0
  40. package/dist/index.cjs.js +1 -1
  41. package/dist/index.mjs +14 -14
  42. package/dist/interpolation-CHn59tIC.js +1 -0
  43. package/dist/interpolation-w7IRDJwK.mjs +180 -0
  44. package/dist/orders-C65SlpJy.mjs +618 -0
  45. package/dist/orders-XVzWAgG1.js +1 -0
  46. package/dist/src/appointments/components/edit/EventDialog/BookingsList.vue.d.ts +11 -2
  47. package/dist/src/appointments/components/edit/EventDialog/OrderDetailDialog.vue.d.ts +55 -0
  48. package/dist/src/appointments/components/edit/EventDialog/ReservationDetailDialog.vue.d.ts +6 -1
  49. package/dist/src/appointments/components/edit/NewReservationDialog/CustomerInformation.vue.d.ts +10 -0
  50. package/dist/src/appointments/components/edit/NewReservationDialog/NewReservationDialog.vue.d.ts +25 -1
  51. package/dist/src/appointments/components/edit/NewReservationDialog/QuickReservationAdder.vue.d.ts +26 -0
  52. package/dist/src/appointments/components/edit/NewReservationDialog/ReservationLines.vue.d.ts +31 -0
  53. package/dist/src/appointments/components/edit/dashboard/Timeline.vue.d.ts +3 -1
  54. package/dist/src/appointments/composables/useHorizontalScroll.d.ts +20 -0
  55. package/dist/src/lib/interpolation.d.ts +6 -0
  56. package/package.json +2 -2
  57. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-9Q7TMm4u.mjs +0 -401
  58. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-DiNzGl-q.js +0 -1
  59. package/dist/Overview-BYMrsZjM.mjs +0 -332
  60. package/dist/Overview-t0pG5xjA.js +0 -1
  61. package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-Cz_22Oce.mjs +0 -2927
  62. package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-DPPNc-Z5.js +0 -349
  63. package/dist/SeoHealth-09sEOu3G.js +0 -1
  64. package/dist/agenda-BNG05SAq.js +0 -1
  65. package/dist/agenda-D1RxMxBS.mjs +0 -1152
  66. package/dist/index-BtujSJeg.js +0 -35
  67. package/dist/index-dOdMm1pV.mjs +0 -1105
  68. package/dist/interpolation-DEDSLETn.mjs +0 -128
  69. package/dist/interpolation-DERg6Lwt.js +0 -1
  70. package/dist/orders-CzzcFQha.mjs +0 -559
  71. package/dist/orders-ETtbA4aQ.js +0 -1
  72. package/dist/src/appointments/components/edit/dashboard/BookingsList.vue.d.ts +0 -110
  73. package/dist/src/appointments/pages/edit/orders.vue.d.ts +0 -98
@@ -0,0 +1,1165 @@
1
+ import { defineComponent as Z, resolveComponent as R, openBlock as s, createElementBlock as r, createElementVNode as e, Fragment as Y, renderList as J, toDisplayString as v, normalizeStyle as K, normalizeClass as O, createVNode as u, withCtx as D, unref as y, createTextVNode as le, createCommentVNode as I, computed as U, ref as T, createBlock as q, provide as te, onMounted as ke, onUnmounted as we, inject as de, nextTick as xe, onBeforeUnmount as Ee, watch as ue, useTemplateRef as Ie } from "vue";
2
+ import { c as ce, b as me } from "./DateFormatter-Bw-87W31.mjs";
3
+ import { X as Se, Search as Be, Clock as ge, Users as he, ChevronLeft as fe, ChevronRight as ve, Asterisk as Le, CalendarDays as Ue } from "lucide-vue-next";
4
+ import { _ as je } from "./EditLayout.vue_vue_type_script_setup_true_lang-DWMqQvHl.mjs";
5
+ import { useModule as $e, useModuleRoute as Te, useFirebaseIntegration as De, useModulePermissions as Pe } from "@oneclick.dev/cms-kit";
6
+ import { _ as Re, a as Ne, F as Oe } from "./ReservationDetailDialog.vue_vue_type_script_setup_true_lang-GYNZ_yhD.mjs";
7
+ import { _ as Ae } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
8
+ import { _ as Fe } from "./NewReservationDialog.vue_vue_type_script_setup_true_lang-DMGcRmm-.mjs";
9
+ import { a as Ve } from "./index-MYWjg0zi.mjs";
10
+ const He = { class: "mb-6" }, Qe = { class: "flex items-end gap-px h-24 bg-muted/30 rounded-lg p-2 overflow-visible" }, We = ["onClick"], Xe = { class: "absolute -top-8 left-1/2 -translate-x-1/2 bg-popover border shadow-md rounded px-2 py-1 text-xs whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none z-10" }, Ye = { class: "font-medium" }, qe = { class: "text-muted-foreground" }, Je = { class: "w-full flex-1 flex items-end justify-center" }, Ke = {
11
+ key: 1,
12
+ class: "text-[10px] mt-1"
13
+ }, Ge = {
14
+ key: 0,
15
+ class: "mt-2 text-sm text-muted-foreground flex items-center gap-2"
16
+ }, Ze = { class: "font-medium text-foreground" }, et = { class: "font-medium text-foreground" }, tt = /* @__PURE__ */ Z({
17
+ __name: "TimelineChart",
18
+ props: {
19
+ timeSlots: {},
20
+ slotStats: {},
21
+ selectedTimeSlot: {},
22
+ maxSpots: {}
23
+ },
24
+ emits: ["select", "clear"],
25
+ setup(f, { emit: w }) {
26
+ const _ = w, M = (o) => {
27
+ _("select", o);
28
+ }, z = () => {
29
+ _("clear");
30
+ };
31
+ return (o, i) => {
32
+ const c = R("Button");
33
+ return s(), r("div", He, [
34
+ i[2] || (i[2] = e("h3", { class: "font-semibold text-sm mb-2" }, "Timeline", -1)),
35
+ e("div", Qe, [
36
+ (s(!0), r(Y, null, J(f.timeSlots, (a) => (s(), r("div", {
37
+ key: a.startTime,
38
+ class: "flex-1 min-w-0 flex flex-col items-center cursor-pointer group h-full relative",
39
+ onClick: (b) => M(a.startTime)
40
+ }, [
41
+ e("div", Xe, [
42
+ e("div", Ye, v(a.startTime), 1),
43
+ e("div", qe, v(f.slotStats[a.startTime]?.spots || 0) + " spots", 1)
44
+ ]),
45
+ e("div", Je, [
46
+ e("div", {
47
+ class: O(["w-full transition-all duration-200", [
48
+ f.selectedTimeSlot === a.startTime ? "bg-primary" : f.slotStats[a.startTime]?.spots > 0 ? "bg-primary/60 group-hover:bg-primary/80" : "bg-muted-foreground/20 group-hover:bg-muted-foreground/30"
49
+ ]]),
50
+ style: K({
51
+ height: f.slotStats[a.startTime]?.spots > 0 ? `${f.slotStats[a.startTime].spots / f.maxSpots * 100}%` : "2px",
52
+ minHeight: f.slotStats[a.startTime]?.spots > 0 ? "4px" : "2px"
53
+ })
54
+ }, null, 6)
55
+ ]),
56
+ a.startTime.endsWith(":00") ? (s(), r("span", {
57
+ key: 0,
58
+ class: O(["text-[10px] text-muted-foreground mt-1 transition-colors truncate", { "text-primary font-medium": f.selectedTimeSlot === a.startTime }])
59
+ }, v(a.label), 3)) : (s(), r("span", Ke, " "))
60
+ ], 8, We))), 128))
61
+ ]),
62
+ f.selectedTimeSlot ? (s(), r("div", Ge, [
63
+ u(c, {
64
+ variant: "ghost",
65
+ size: "icon",
66
+ class: "h-6 w-6 p-0",
67
+ onClick: z
68
+ }, {
69
+ default: D(() => [
70
+ u(y(Se), { size: 14 })
71
+ ]),
72
+ _: 1
73
+ }),
74
+ e("span", null, [
75
+ i[0] || (i[0] = le(" Showing ", -1)),
76
+ e("span", Ze, v(f.slotStats[f.selectedTimeSlot]?.bookings || 0), 1),
77
+ i[1] || (i[1] = le(" bookings at ", -1)),
78
+ e("span", et, v(f.selectedTimeSlot), 1)
79
+ ])
80
+ ])) : I("", !0)
81
+ ]);
82
+ };
83
+ }
84
+ }), st = { class: "flex items-center justify-between mb-3" }, ot = { class: "font-semibold" }, at = {
85
+ key: 0,
86
+ class: "text-muted-foreground font-normal"
87
+ }, nt = { class: "relative mb-3" }, lt = {
88
+ key: 0,
89
+ class: "flex items-center justify-center py-8"
90
+ }, rt = {
91
+ key: 1,
92
+ class: "text-center py-8 text-muted-foreground"
93
+ }, it = {
94
+ key: 2,
95
+ class: "space-y-2 max-h-80 overflow-y-auto"
96
+ }, ut = ["onClick"], dt = { class: "flex items-start justify-between" }, ct = { class: "flex-1" }, mt = { class: "font-medium" }, vt = { class: "text-sm text-muted-foreground" }, pt = { class: "text-sm text-muted-foreground" }, ft = { class: "flex items-center gap-4" }, gt = { class: "flex items-center gap-2 mt-1 text-xs text-muted-foreground" }, ht = { class: "flex items-center gap-2 mt-1 text-xs text-muted-foreground" }, xt = { class: "text-right" }, bt = {
97
+ key: 0,
98
+ class: "inline-block px-2 py-1 text-xs rounded-full bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400"
99
+ }, yt = {
100
+ key: 1,
101
+ class: "inline-block px-2 py-1 text-xs rounded-full bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400"
102
+ }, _t = {
103
+ key: 2,
104
+ class: "inline-block px-2 py-1 text-xs rounded-full bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"
105
+ }, kt = {
106
+ key: 3,
107
+ class: "inline-block px-2 py-1 text-xs rounded-full bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"
108
+ }, wt = {
109
+ key: 4,
110
+ class: "inline-block px-2 py-1 text-xs rounded-full bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400"
111
+ }, St = {
112
+ key: 5,
113
+ class: "text-sm font-medium mt-1"
114
+ }, $t = /* @__PURE__ */ Z({
115
+ __name: "BookingsList",
116
+ props: {
117
+ agendaData: {},
118
+ orders: {},
119
+ filteredOrders: {},
120
+ isLoading: { type: Boolean },
121
+ selectedTimeSlot: {},
122
+ searchQuery: {}
123
+ },
124
+ emits: ["update:searchQuery", "refresh"],
125
+ setup(f, { emit: w }) {
126
+ const _ = f, M = U(() => _.agendaData?.metadataSchema || []), z = w, o = T(null), i = (b) => {
127
+ z("update:searchQuery", b);
128
+ }, c = () => {
129
+ z("update:searchQuery", "");
130
+ }, a = () => {
131
+ z("refresh");
132
+ };
133
+ return (b, h) => {
134
+ const N = R("Input"), B = R("Button");
135
+ return s(), r("div", null, [
136
+ e("div", st, [
137
+ e("h3", ot, [
138
+ h[0] || (h[0] = le(" Bookings ", -1)),
139
+ f.selectedTimeSlot || f.searchQuery ? (s(), r("span", at, " (" + v(f.filteredOrders.length) + " of " + v(f.orders.length) + ") ", 1)) : I("", !0)
140
+ ])
141
+ ]),
142
+ e("div", nt, [
143
+ u(y(Be), {
144
+ size: 16,
145
+ class: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"
146
+ }),
147
+ u(N, {
148
+ "model-value": f.searchQuery,
149
+ placeholder: "Search by name, email, or phone...",
150
+ class: "pl-9 pr-9",
151
+ "onUpdate:modelValue": i
152
+ }, null, 8, ["model-value"]),
153
+ f.searchQuery ? (s(), q(B, {
154
+ key: 0,
155
+ variant: "ghost",
156
+ size: "icon",
157
+ class: "absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7",
158
+ onClick: c
159
+ }, {
160
+ default: D(() => [
161
+ u(y(Se), { size: 14 })
162
+ ]),
163
+ _: 1
164
+ })) : I("", !0)
165
+ ]),
166
+ f.isLoading ? (s(), r("div", lt, [...h[1] || (h[1] = [
167
+ e("div", { class: "animate-spin rounded-full h-8 w-8 border-b-2 border-primary" }, null, -1)
168
+ ])])) : f.filteredOrders.length === 0 ? (s(), r("div", rt, v(f.selectedTimeSlot ? "No bookings for this time slot" : "No bookings for this event"), 1)) : (s(), r("div", it, [
169
+ (s(!0), r(Y, null, J(f.filteredOrders, (m) => (s(), r("div", {
170
+ key: m.res_id || m.id,
171
+ class: "p-3 border rounded-lg hover:bg-muted/50 transition-colors",
172
+ onClick: (H) => y(o).openDialog(m)
173
+ }, [
174
+ e("div", dt, [
175
+ e("div", ct, [
176
+ e("div", mt, v(m.customerInfo.firstName + " " + m.customerInfo.lastName || "Unknown Customer"), 1),
177
+ e("div", vt, v(m.customerInfo.email), 1),
178
+ e("div", pt, v(m.customerInfo.phone), 1),
179
+ e("div", ft, [
180
+ e("div", gt, [
181
+ u(y(ge), { size: 12 }),
182
+ e("span", null, v(m.startTime) + " - " + v(m.endTime), 1)
183
+ ]),
184
+ e("div", ht, [
185
+ u(y(he), { size: 12 }),
186
+ e("span", null, v(m.spots), 1)
187
+ ])
188
+ ]),
189
+ u(Re, {
190
+ metadata: { ...m.metadata, ...m.reservationMetadata },
191
+ schema: y(M),
192
+ "display-filter": ["highlight", "badge"],
193
+ compact: "",
194
+ class: "mt-1"
195
+ }, null, 8, ["metadata", "schema"])
196
+ ]),
197
+ e("div", xt, [
198
+ m.reservationStatus === "needs_approval" ? (s(), r("span", bt, "Needs Approval")) : m.reservationStatus === "approved" ? (s(), r("span", yt, "Approved")) : m.reservationStatus === "rejected" ? (s(), r("span", _t, "Rejected")) : m.reservationStatus === "cancelled" ? (s(), r("span", kt, "Cancelled")) : (s(), r("span", wt, "Pending")),
199
+ m.reservationPrice || m.reservationPrice === 0 ? (s(), r("div", St, " €" + v(m.reservationPrice.toFixed(2)), 1)) : I("", !0)
200
+ ])
201
+ ])
202
+ ], 8, ut))), 128))
203
+ ])),
204
+ u(Ne, {
205
+ ref_key: "reservationDetailDialog",
206
+ ref: o,
207
+ "agenda-data": f.agendaData,
208
+ onCancelled: a,
209
+ onConfirmed: a,
210
+ onRejected: a
211
+ }, null, 8, ["agenda-data"])
212
+ ]);
213
+ };
214
+ }
215
+ }), Tt = { class: "flex items-center gap-4 mt-2 text-sm" }, Dt = { class: "flex items-center gap-1" }, Ct = {
216
+ key: 0,
217
+ class: "flex items-center gap-1"
218
+ }, Mt = { class: "flex items-center gap-1" }, zt = { class: "py-4" }, Et = /* @__PURE__ */ Z({
219
+ __name: "EventDialog",
220
+ props: {
221
+ agendaData: {},
222
+ resources: { default: () => [] }
223
+ },
224
+ setup(f, { expose: w }) {
225
+ const _ = f, { config: M } = $e(), { params: z } = Te(), o = De(M.project), i = T(!1), c = T(null), a = T([]), b = T(!1), h = T(null), N = T("");
226
+ te("event", c);
227
+ const B = U(() => {
228
+ if (!c.value) return [];
229
+ const g = c.value.resource?.interval || 60, t = [], [d, $] = c.value.startTime.split(":").map(Number), [Q, V] = c.value.endTime.split(":").map(Number), C = d * 60 + $, k = Q * 60 + V;
230
+ for (let S = C; S < k; S += g) {
231
+ const l = Math.floor(S / 60), p = S % 60, E = Math.min(S + g, k), x = Math.floor(E / 60), L = E % 60, A = `${l.toString().padStart(2, "0")}:${p.toString().padStart(2, "0")}`, n = `${x.toString().padStart(2, "0")}:${L.toString().padStart(2, "0")}`;
232
+ t.push({
233
+ startTime: A,
234
+ endTime: n,
235
+ label: A
236
+ });
237
+ }
238
+ return t;
239
+ }), m = (g) => {
240
+ const t = g.getFullYear(), d = String(g.getMonth() + 1).padStart(2, "0"), $ = String(g.getDate()).padStart(2, "0");
241
+ return `${t}-${d}-${$}`;
242
+ }, H = U(() => {
243
+ const g = {};
244
+ return B.value.forEach((t) => {
245
+ g[t.startTime] = { bookings: 0, spots: 0, orders: [] };
246
+ }), a.value.forEach((t) => {
247
+ B.value.forEach((d) => {
248
+ t.startTime < d.endTime && t.endTime > d.startTime && (g[d.startTime].bookings++, g[d.startTime].spots += t.spots || 0, g[d.startTime].orders.push(t));
249
+ });
250
+ }), g;
251
+ }), j = U(() => Math.max(1, ...Object.values(H.value).map((g) => g.spots))), P = U(() => {
252
+ let g = a.value;
253
+ return h.value && (g = H.value[h.value]?.orders || []), N.value.trim() && (g = new Oe(g, {
254
+ keys: [
255
+ "customerInfo.firstName",
256
+ "customerInfo.lastName",
257
+ "customerInfo.email",
258
+ "customerInfo.phone"
259
+ ],
260
+ threshold: 0.3,
261
+ ignoreLocation: !0
262
+ }).search(N.value).map((d) => d.item)), g;
263
+ }), F = U(() => ({
264
+ spots: a.value.reduce((g, t) => g + (t.spots || 0), 0),
265
+ bookings: a.value.length
266
+ })), se = (g) => {
267
+ h.value === g ? h.value = null : h.value = g;
268
+ }, G = () => {
269
+ h.value = null;
270
+ }, oe = async (g) => {
271
+ i.value = !0, c.value = g, h.value = null, N.value = "", await ee();
272
+ }, ee = async () => {
273
+ if (c.value) {
274
+ b.value = !0, a.value = [];
275
+ try {
276
+ const g = z.value.id, t = m(new Date(c.value.date)), d = c.value.resourceId || c.value.resource?.id, $ = /* @__PURE__ */ new Set();
277
+ if (d ? $.add(`${d}_${t}`) : _.resources?.forEach((C) => {
278
+ $.add(`${C.id}_${t}`);
279
+ }), $.size === 0) {
280
+ a.value = [];
281
+ return;
282
+ }
283
+ const Q = await o.find(M.reservationsCollection, {
284
+ filters: [
285
+ { field: "agendaId", operator: "==", value: g },
286
+ { field: "status", operator: "==", value: "confirmed" },
287
+ { field: "flattenedReservationDates", operator: "array-contains-any", value: Array.from($) }
288
+ ]
289
+ });
290
+ let V = [];
291
+ Q.forEach((C) => {
292
+ (C.reservations?.filter((S) => S.date !== t ? !1 : d ? S.resourceId === d : !0) || []).forEach((S) => {
293
+ const l = _.resources.find((p) => p.id === S.resourceId);
294
+ (S.status === "approved" || S.status === "needs_approval") && V.push({
295
+ customerInfo: C.customerInfo,
296
+ amountDue: C.amountDue,
297
+ amountPaid: C.amountPaid,
298
+ status: C.status,
299
+ reservationStatus: S.status,
300
+ subtotal: C.subtotal,
301
+ total: C.total,
302
+ discount: C.discount,
303
+ id: C.id,
304
+ res_id: S.id,
305
+ resourceId: S.resourceId,
306
+ spots: S.spots,
307
+ date: t,
308
+ startTime: S.timeslot?.startTime,
309
+ endTime: S.timeslot?.endTime,
310
+ reservationPrice: S.totalPrice,
311
+ reservationBasePrice: S.basePrice,
312
+ reservationAddOnsPrice: S.addOnsPrice,
313
+ pricingOptionId: S.pricingOptionId,
314
+ pricingOption: S.pricingOption,
315
+ resourceName: l?.name || "Unknown",
316
+ resourceColor: l?.color,
317
+ metadata: C.metadata || {},
318
+ reservationMetadata: S.metadata || {}
319
+ });
320
+ });
321
+ }), a.value = V.sort((C, k) => C.startTime?.localeCompare(k.startTime || "") || 0);
322
+ } catch (g) {
323
+ console.error("Error loading orders:", g), a.value = [];
324
+ } finally {
325
+ b.value = !1;
326
+ }
327
+ }
328
+ }, re = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], ae = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
329
+ return w({
330
+ openDialog: oe
331
+ }), (g, t) => {
332
+ const d = R("DialogTitle"), $ = R("DialogDescription"), Q = R("DialogHeader"), V = R("Button"), C = R("DialogFooter"), k = R("DialogScrollContent"), S = R("Dialog");
333
+ return s(), q(S, {
334
+ open: i.value,
335
+ "onUpdate:open": t[2] || (t[2] = (l) => i.value = l)
336
+ }, {
337
+ default: D(() => [
338
+ u(k, { class: "sm:max-w-3xl" }, {
339
+ default: D(() => [
340
+ u(Q, null, {
341
+ default: D(() => [
342
+ c.value?.date ? (s(), q(d, { key: 0 }, {
343
+ default: D(() => [
344
+ le(v(re[new Date(c.value.date).getUTCDay()]) + " " + v(ae[new Date(c.value.date).getUTCMonth()]) + " " + v(new Date(c.value.date).getUTCDate()) + ", " + v(new Date(c.value.date).getUTCFullYear()), 1)
345
+ ]),
346
+ _: 1
347
+ })) : I("", !0),
348
+ u($, null, {
349
+ default: D(() => [
350
+ e("div", Tt, [
351
+ e("div", Dt, [
352
+ u(y(ge), { size: 14 }),
353
+ e("span", null, v(c.value?.startTime) + " – " + v(c.value?.endTime), 1)
354
+ ]),
355
+ c.value?.resource ? (s(), r("div", Ct, [
356
+ e("div", {
357
+ class: "w-4 h-4 rounded-full",
358
+ style: K({ backgroundColor: c.value.resource.color || "#6b7280" })
359
+ }, null, 4),
360
+ e("span", null, v(c.value.resource.name), 1)
361
+ ])) : I("", !0),
362
+ e("div", Mt, [
363
+ u(y(he), { size: 14 }),
364
+ e("span", null, v(F.value.spots) + " spots in " + v(F.value.bookings) + " reservations", 1)
365
+ ])
366
+ ])
367
+ ]),
368
+ _: 1
369
+ })
370
+ ]),
371
+ _: 1
372
+ }),
373
+ e("div", zt, [
374
+ B.value.length > 1 ? (s(), q(tt, {
375
+ key: 0,
376
+ "time-slots": B.value,
377
+ "slot-stats": H.value,
378
+ "selected-time-slot": h.value,
379
+ "max-spots": j.value,
380
+ onSelect: se,
381
+ onClear: G,
382
+ tabindex: "0"
383
+ }, null, 8, ["time-slots", "slot-stats", "selected-time-slot", "max-spots"])) : I("", !0),
384
+ u($t, {
385
+ "agenda-data": f.agendaData,
386
+ orders: a.value,
387
+ "filtered-orders": P.value,
388
+ "is-loading": b.value,
389
+ "selected-time-slot": h.value,
390
+ "search-query": N.value,
391
+ "onUpdate:searchQuery": t[0] || (t[0] = (l) => N.value = l),
392
+ onRefresh: ee
393
+ }, null, 8, ["agenda-data", "orders", "filtered-orders", "is-loading", "selected-time-slot", "search-query"])
394
+ ]),
395
+ u(C, null, {
396
+ default: D(() => [
397
+ u(V, {
398
+ variant: "outline",
399
+ onClick: t[1] || (t[1] = (l) => i.value = !1)
400
+ }, {
401
+ default: D(() => [...t[3] || (t[3] = [
402
+ le("Close", -1)
403
+ ])]),
404
+ _: 1
405
+ })
406
+ ]),
407
+ _: 1
408
+ })
409
+ ]),
410
+ _: 1
411
+ })
412
+ ]),
413
+ _: 1
414
+ }, 8, ["open"]);
415
+ };
416
+ }
417
+ }), It = { class: "flex-1 border-r shadow-sm overflow-hidden min-h-[1536px]" }, Bt = { class: "relative h-full min-h-[1536px]" }, Lt = { class: "divide-y divide-input/80 h-full flex flex-col min-h-[1536px] border-y border-input/80" }, Ut = { class: "absolute inset-0 pointer-events-none" }, jt = { class: "relative mr-1 @md:mr-3 h-full ml-0.5 @md:ml-2" }, Pt = ["onClick"], Rt = {
418
+ key: 0,
419
+ class: "absolute bottom-0 left-0 right-0 h-1 bg-black/20"
420
+ }, Nt = { class: "flex items-start justify-between gap-2 mb-1" }, Ot = { class: "font-semibold text-xs @md:text-sm leading-tight line-clamp-1 flex-1" }, At = { class: "flex items-center gap-1 shrink-0" }, Ft = ["title"], Vt = { class: "font-medium" }, be = /* @__PURE__ */ Z({
421
+ __name: "EventTimeline",
422
+ props: {
423
+ agendaData: {},
424
+ date: {},
425
+ events: {},
426
+ firstDay: { type: Boolean, default: !1 },
427
+ resources: { default: () => [] }
428
+ },
429
+ setup(f) {
430
+ const w = f, _ = T(null), M = (i) => {
431
+ const [c, a] = i.split(":").map(Number);
432
+ return c * 60 + a;
433
+ };
434
+ U(() => !w.events || !w.resources ? [] : w.resources.map((i) => {
435
+ const a = w.events.filter((b) => b.resourceId === i.id).map((b) => {
436
+ const h = M(b.startTime), B = M(b.endTime) - h, m = h / 1440 * 100, H = B / 1440 * 100, j = (b.bookings ?? 0) > 0, P = b.maxBookings ? (b.bookings ?? 0) / b.maxBookings * 100 : 0;
437
+ return {
438
+ ...b,
439
+ top: `${m}%`,
440
+ height: `${H}%`,
441
+ color: b.resource?.color || "#3b82f6",
442
+ hasBookings: j,
443
+ fillPercentage: P,
444
+ isSmall: B < 60
445
+ };
446
+ });
447
+ return {
448
+ resource: i,
449
+ events: a
450
+ };
451
+ }));
452
+ const z = U(() => w.events ? w.events.map((i) => {
453
+ const c = M(i.startTime), b = M(i.endTime) - c, h = c / 1440 * 100, N = b / 1440 * 100, B = (i.bookings ?? 0) > 0, m = i.maxBookings ? (i.bookings ?? 0) / i.maxBookings * 100 : 0;
454
+ return {
455
+ ...i,
456
+ top: `${h}%`,
457
+ height: `${N}%`,
458
+ color: i.resource?.color || "#3b82f6",
459
+ hasBookings: B,
460
+ fillPercentage: m,
461
+ isSmall: b < 60
462
+ };
463
+ }) : []), o = Array.from({ length: 24 }, (i, c) => ({
464
+ hour: c,
465
+ label: `${c.toString().padStart(2, "0")}:00`
466
+ }));
467
+ return (i, c) => (s(), r(Y, null, [
468
+ e("div", It, [
469
+ e("div", Bt, [
470
+ e("div", Lt, [
471
+ (s(!0), r(Y, null, J(y(o), (a) => (s(), r("div", {
472
+ key: a.hour,
473
+ class: "flex-1 flex transition-all duration-200"
474
+ }, [...c[0] || (c[0] = [
475
+ e("div", { class: "flex-1 relative" }, [
476
+ e("div", { class: "absolute top-1/2 left-0 right-0 border-t border-dashed border-input/50" })
477
+ ], -1)
478
+ ])]))), 128))
479
+ ]),
480
+ e("div", Ut, [
481
+ e("div", jt, [
482
+ (s(!0), r(Y, null, J(z.value, (a) => (s(), r("div", {
483
+ key: a.id,
484
+ style: K({
485
+ top: a.top,
486
+ height: a.height,
487
+ opacity: a.hasBookings ? "1" : "0.5"
488
+ }),
489
+ class: "event-card absolute left-0.5 right-0.5 @md:left-2 @md:right-2 rounded-lg pointer-events-auto cursor-pointer group/event transition-all duration-200 hover:shadow-xl overflow-hidden",
490
+ onClick: (b) => _.value?.openDialog(a)
491
+ }, [
492
+ e("div", {
493
+ style: K({ backgroundColor: a.color }),
494
+ class: "absolute inset-0 shadow-lg"
495
+ }, [
496
+ a.maxBookings ? (s(), r("div", Rt, [
497
+ e("div", {
498
+ class: "h-full bg-white/40 transition-all duration-300",
499
+ style: K({ width: `${a.fillPercentage}%` })
500
+ }, null, 4)
501
+ ])) : I("", !0)
502
+ ], 4),
503
+ e("div", {
504
+ class: O(["relative h-full p-1.5 @md:p-3 flex flex-col", `${a.hasBookings ? "text-white" : "text-gray-600 dark:text-gray-100"}`])
505
+ }, [
506
+ e("div", Nt, [
507
+ e("h3", Ot, v(a.title), 1),
508
+ e("div", At, [
509
+ a.resource ? (s(), r("div", {
510
+ key: 0,
511
+ class: "w-5 h-5 @md:w-6 @md:h-6 rounded-full flex items-center justify-center text-[10px] @md:text-xs font-bold bg-white/30 backdrop-blur-sm text-white border border-white/40",
512
+ title: a.resource.name
513
+ }, v(a.resource.avatarLabel || a.resource.name.charAt(0).toUpperCase()), 9, Ft)) : I("", !0),
514
+ e("div", {
515
+ class: O([
516
+ "flex items-center gap-0.5 @md:gap-1 px-1.5 @md:px-2 py-0.5 rounded-full text-[10px] @md:text-xs font-medium",
517
+ a.hasBookings ? "bg-white text-black backdrop-blur-sm" : "bg-black/10 backdrop-blur-sm"
518
+ ])
519
+ }, [
520
+ u(y(he), { size: 12 }),
521
+ e("span", null, v(a.bookings), 1)
522
+ ], 2)
523
+ ])
524
+ ]),
525
+ e("div", {
526
+ class: O(["flex items-center gap-1 @md:gap-2 text-[10px] @md:text-xs opacity-90 mt-auto", { "-translate-x-1 -translate-y-2 scale-80 origin-[0_0]": a.isSmall }])
527
+ }, [
528
+ e("div", {
529
+ class: O(["flex items-center gap-1 px-1 @md:px-2 py-0.5 rounded backdrop-blur-sm", { "bg-black/10": !a.isSmall }])
530
+ }, [
531
+ u(y(ge), { size: 10 }),
532
+ e("span", Vt, v(a.startTime) + " – " + v(a.endTime), 1)
533
+ ], 2)
534
+ ], 2)
535
+ ], 2),
536
+ c[1] || (c[1] = e("div", { class: "absolute inset-0 border-2 border-white/0 group-hover/event:border-white/30 rounded-lg transition-colors duration-200 pointer-events-none" }, null, -1))
537
+ ], 12, Pt))), 128))
538
+ ])
539
+ ])
540
+ ])
541
+ ]),
542
+ u(Et, {
543
+ "agenda-data": f.agendaData,
544
+ resources: f.resources,
545
+ ref_key: "eventDialog",
546
+ ref: _
547
+ }, null, 8, ["agenda-data", "resources"])
548
+ ], 64));
549
+ }
550
+ }), Ht = { class: "sticky left-0 mt-auto z-10 divide-y divide-border/50 h-full flex flex-col min-h-[1536px] bg-input" }, Qt = { class: "flex-shrink-0 text-[10px] @md:text-xs font-medium text-muted-foreground px-1.5 @md:px-3 pb-3 border-r border-border/50 w-10 @md:w-14" }, Wt = { class: "flex items-center gap-1.5" }, ye = /* @__PURE__ */ Z({
551
+ __name: "Event24hSidebar",
552
+ setup(f) {
553
+ const w = Array.from({ length: 24 }, (_, M) => ({
554
+ hour: M,
555
+ label: `${M.toString().padStart(2, "0")}:00`
556
+ }));
557
+ return (_, M) => (s(), r("div", Ht, [
558
+ (s(!0), r(Y, null, J(y(w), (z) => (s(), r("div", {
559
+ key: z.hour,
560
+ class: "flex-1 flex transition-all duration-200"
561
+ }, [
562
+ e("div", Qt, [
563
+ e("div", Wt, [
564
+ e("span", {
565
+ class: O({ "-translate-y-1/2": z.hour !== 0 })
566
+ }, v(z.label), 3)
567
+ ])
568
+ ])
569
+ ]))), 128))
570
+ ]));
571
+ }
572
+ }), Xt = { class: "absolute top-0 w-full pointer-events-none" }, Yt = {
573
+ key: 0,
574
+ class: "absolute -right-2 -top-0.5 px-2 py-0.5 bg-red-500 text-white text-xs font-medium rounded shadow-lg"
575
+ }, _e = /* @__PURE__ */ Z({
576
+ __name: "EventTimeIndicator",
577
+ props: {
578
+ currentDate: {
579
+ type: Object,
580
+ required: !1
581
+ }
582
+ },
583
+ setup(f) {
584
+ const w = T(Date.now());
585
+ let _;
586
+ ke(() => {
587
+ _ = window.setInterval(() => {
588
+ w.value = Date.now();
589
+ }, 1e3);
590
+ }), we(() => {
591
+ _ && clearInterval(_);
592
+ });
593
+ const M = U(() => {
594
+ const o = new Date(w.value);
595
+ return `${(o.getHours() * 60 + o.getMinutes() + o.getSeconds() / 60) / 1440 * 100}%`;
596
+ }), z = U(() => new Date(w.value).getFullYear() + "-" + (new Date(w.value).getMonth() + 1).toString().padStart(2, "0") + "-" + new Date(w.value).getDate().toString().padStart(2, "0"));
597
+ return (o, i) => (s(), r("div", Xt, [
598
+ e("div", {
599
+ class: "absolute left-0 right-0 h-0.5 bg-red-500 z-30 pointer-events-none transition-[top] duration-300 ease-linear",
600
+ style: K({ top: M.value })
601
+ }, [
602
+ i[0] || (i[0] = e("div", { class: "absolute -left-2 -top-1.5 w-3 h-3 bg-red-500 rounded-full shadow-lg shadow-red-500/50" }, null, -1)),
603
+ f.currentDate && f.currentDate == z.value ? (s(), r("div", Yt, " Now ")) : I("", !0)
604
+ ], 4)
605
+ ]));
606
+ }
607
+ }), qt = {
608
+ key: 0,
609
+ class: "relative flex flex-1 min-w-0"
610
+ }, Jt = {
611
+ key: 1,
612
+ class: "flex-1 min-w-0 relative min-h-[1616px] @md:min-h-[1658px]"
613
+ }, Kt = {
614
+ key: 0,
615
+ class: "absolute top-0 right-0 z-10 px-3 py-1.5 bg-primary/90 text-primary-foreground text-xs font-medium rounded-bl-lg shadow-lg backdrop-blur-sm flex items-center gap-1.5 animate-pulse-subtle"
616
+ }, Gt = { class: "flex pb-4 min-w-[200px]" }, Zt = ["onClick"], es = {
617
+ key: 0,
618
+ class: "absolute top-2 right-2 flex items-center gap-1 px-2 py-0.5 bg-primary/20 backdrop-blur-sm rounded-full border border-primary/30"
619
+ }, ts = { class: "text-xs text-muted-foreground font-medium group-hover:text-foreground/70 transition-colors" }, ss = {
620
+ key: 0,
621
+ class: "absolute bottom-0 left-0 w-full h-1 bg-orange-500"
622
+ }, os = /* @__PURE__ */ Z({
623
+ __name: "EventView",
624
+ props: {
625
+ agendaData: { default: () => ({}) }
626
+ },
627
+ setup(f) {
628
+ const w = de("activeDate", T(ce(me()))), _ = de("viewMode", T(1)), M = de("events", T([])), z = de("resources", T([])), o = T(null), i = T(!1), c = T(!1);
629
+ U(() => z.value.length > 1);
630
+ const a = U(() => {
631
+ const t = [], d = w.value;
632
+ for (let $ = 0; $ < _.value; $++)
633
+ t.push(d.add({ days: $ }));
634
+ return t;
635
+ }), b = (t, d) => {
636
+ const $ = `${t.year}-${String(t.month).padStart(2, "0")}-${String(t.day).padStart(2, "0")}`;
637
+ return M.value?.filter((Q) => Q.date === $) || [];
638
+ }, h = (t) => {
639
+ const d = ce(me());
640
+ return t.year === d.year && t.month === d.month && t.day === d.day;
641
+ }, N = (t) => {
642
+ w.value = t, _.value = 1;
643
+ };
644
+ let B = null, m = null;
645
+ const H = () => {
646
+ o.value && (P(), o.value.scrollBy({ left: -300, behavior: "smooth" }), m = window.setTimeout(() => {
647
+ B = window.setInterval(() => {
648
+ o.value && o.value.scrollBy({ left: -20, behavior: "auto" });
649
+ }, 50);
650
+ }, 300));
651
+ }, j = () => {
652
+ o.value && (P(), o.value.scrollBy({ left: 300, behavior: "smooth" }), m = window.setTimeout(() => {
653
+ B = window.setInterval(() => {
654
+ o.value && o.value.scrollBy({ left: 20, behavior: "auto" });
655
+ }, 50);
656
+ }, 300));
657
+ }, P = () => {
658
+ m && (clearTimeout(m), m = null), B && (clearInterval(B), B = null);
659
+ }, F = () => {
660
+ if (!o.value) return;
661
+ const { scrollLeft: t, scrollWidth: d, clientWidth: $ } = o.value;
662
+ i.value = t > 10, c.value = t < d - $ - 10;
663
+ }, se = (t) => {
664
+ o.value && Math.abs(t.deltaY) > Math.abs(t.deltaX) && (t.preventDefault(), o.value.scrollBy({ left: t.deltaY, behavior: "auto" }));
665
+ }, G = T(!1), oe = T(0), ee = T(0), re = (t) => {
666
+ !o.value || _.value === 1 || t.target.closest(".event-card") || (G.value = !0, oe.value = t.pageX, ee.value = o.value.scrollLeft, o.value.style.userSelect = "none", t.preventDefault());
667
+ }, ae = (t) => {
668
+ if (!G.value || !o.value) return;
669
+ const d = t.pageX, $ = (oe.value - d) * 1.2;
670
+ o.value.scrollLeft = ee.value + $;
671
+ }, g = () => {
672
+ o.value && (G.value = !1, o.value.style.userSelect = "");
673
+ };
674
+ return ke(() => {
675
+ o.value && (o.value.addEventListener("scroll", F), o.value.addEventListener("wheel", se, { passive: !1 }), xe(() => {
676
+ F(), setTimeout(F, 50), setTimeout(F, 150), setTimeout(F, 300), setTimeout(F, 500);
677
+ })), document.addEventListener("mousemove", ae), document.addEventListener("mouseup", g);
678
+ }), Ee(() => {
679
+ document.removeEventListener("mousemove", ae), document.removeEventListener("mouseup", g);
680
+ }), ue(_, () => {
681
+ _.value > 1 ? xe(() => {
682
+ setTimeout(() => {
683
+ if (!o.value) return;
684
+ const { scrollWidth: t, clientWidth: d } = o.value;
685
+ t > d && (c.value = !0, i.value = !1);
686
+ }, 100);
687
+ }) : o.value && (o.value.style.cursor = "");
688
+ }), we(() => {
689
+ P(), o.value && (o.value.removeEventListener("scroll", F), o.value.removeEventListener("wheel", se));
690
+ }), (t, d) => {
691
+ const $ = R("Button"), Q = R("TooltipTrigger"), V = R("TooltipContent"), C = R("Tooltip");
692
+ return y(_) === 1 ? (s(), r("div", qt, [
693
+ u(ye),
694
+ u(_e, {
695
+ class: "h-full",
696
+ "current-date": y(w)
697
+ }, null, 8, ["current-date"]),
698
+ u(be, {
699
+ "agenda-data": f.agendaData,
700
+ date: y(w),
701
+ events: b(y(w)),
702
+ resources: y(z)
703
+ }, null, 8, ["agenda-data", "date", "events", "resources"])
704
+ ])) : (s(), r("div", Jt, [
705
+ y(_) === 7 ? (s(), r("div", Kt, [
706
+ u(y(fe), { size: 12 }),
707
+ d[0] || (d[0] = e("span", null, "Scroll to view all days", -1)),
708
+ u(y(ve), { size: 12 })
709
+ ])) : I("", !0),
710
+ i.value ? (s(), q($, {
711
+ key: 1,
712
+ variant: "outline",
713
+ size: "icon",
714
+ onMousedown: H,
715
+ onMouseup: P,
716
+ onMouseleave: P,
717
+ onTouchstart: H,
718
+ onTouchend: P,
719
+ class: "sticky top-1/2 left-2 -translate-y-1/2 z-40 h-10 w-10 rounded-full shadow-lg bg-background/95 backdrop-blur-sm hover:bg-background border-2"
720
+ }, {
721
+ default: D(() => [
722
+ u(y(fe), { size: 20 })
723
+ ]),
724
+ _: 1
725
+ })) : I("", !0),
726
+ c.value ? (s(), q($, {
727
+ key: 2,
728
+ variant: "outline",
729
+ size: "icon",
730
+ onMousedown: j,
731
+ onMouseup: P,
732
+ onMouseleave: P,
733
+ onTouchstart: j,
734
+ onTouchend: P,
735
+ class: "sticky top-1/2 right-2 -translate-y-1/2 z-40 h-10 w-10 rounded-full shadow-lg bg-background/95 backdrop-blur-sm hover:bg-background border-2 float-right"
736
+ }, {
737
+ default: D(() => [
738
+ u(y(ve), { size: 20 })
739
+ ]),
740
+ _: 1
741
+ })) : I("", !0),
742
+ u(_e, { class: "h-[calc(100%-122px)] mt-[80px] @md:h-[calc(100%-164px)] @md:mt-[122px]" }),
743
+ e("div", {
744
+ class: O(["absolute right-0 top-0 bottom-0 w-8 bg-gradient-to-l from-background to-transparent z-10 pointer-events-none transition-opacity duration-300", c.value ? "opacity-100" : "opacity-0"])
745
+ }, null, 2),
746
+ e("div", {
747
+ ref_key: "scrollContainer",
748
+ ref: o,
749
+ class: "absolute inset-0 overflow-x-auto overflow-y-hidden",
750
+ onScroll: F,
751
+ onMousedown: re
752
+ }, [
753
+ e("div", Gt, [
754
+ u(ye),
755
+ d[5] || (d[5] = e("div", { class: "absolute w-10 @md:w-14 h-[125px] bg-input" }, null, -1)),
756
+ (s(!0), r(Y, null, J(a.value, (k, S) => (s(), r("div", {
757
+ key: k.toString(),
758
+ class: O(["flex-shrink-0", { "min-w-[200px] w-[33.33%]": y(_) === 3, "min-w-[280px]": y(_) === 7 }])
759
+ }, [
760
+ e("div", {
761
+ onClick: (l) => N(k),
762
+ class: O([
763
+ "relative p-3 border cursor-pointer transition-all duration-200 group relative",
764
+ h(k) ? "bg-gradient-to-br from-primary/10 to-primary/5 border-primary/30 hover:from-primary/20 hover:to-primary/10 hover:border-primary/50 hover:shadow-md" : "bg-gradient-to-br from-muted/50 to-muted/30 border-border hover:from-accent/50 hover:to-accent/30 hover:border-accent-foreground/20 hover:shadow-md"
765
+ ])
766
+ }, [
767
+ h(k) ? (s(), r("div", es, [...d[1] || (d[1] = [
768
+ e("div", { class: "w-1.5 h-1.5 bg-primary rounded-full animate-pulse" }, null, -1),
769
+ e("span", { class: "text-[9px] font-bold text-primary uppercase tracking-wide" }, "Today", -1)
770
+ ])])) : I("", !0),
771
+ e("div", {
772
+ class: O([
773
+ "text-xs font-semibold uppercase tracking-wider transition-colors",
774
+ h(k) ? "text-primary group-hover:text-primary/80" : "text-muted-foreground group-hover:text-foreground"
775
+ ])
776
+ }, v(new Date(k.year, k.month - 1, k.day).toLocaleDateString("en-US", { weekday: "short" })), 3),
777
+ e("div", {
778
+ class: O([
779
+ "text-2xl font-bold transition-colors",
780
+ h(k) ? "text-foreground" : "text-foreground group-hover:text-primary"
781
+ ])
782
+ }, v(k.day), 3),
783
+ e("div", ts, v(new Date(k.year, k.month - 1, k.day).toLocaleDateString("en-US", { month: "long", year: "numeric" })), 1),
784
+ d[4] || (d[4] = e("div", { class: "mt-2 pt-2 border-t border-border/0 group-hover:border-border/50 transition-all" }, [
785
+ e("div", { class: "text-[10px] text-muted-foreground/0 group-hover:text-muted-foreground/100 uppercase tracking-wide transition-all" }, " Click to view ")
786
+ ], -1)),
787
+ u(C, null, {
788
+ default: D(() => [
789
+ u(Q, { "as-child": "" }, {
790
+ default: D(() => [
791
+ b(k).filter((l) => l.isException).length > 0 ? (s(), q(y(Le), {
792
+ key: 0,
793
+ class: "absolute top-3 right-3 size-4 text-orange-500"
794
+ })) : I("", !0)
795
+ ]),
796
+ _: 2
797
+ }, 1024),
798
+ u(V, null, {
799
+ default: D(() => [...d[2] || (d[2] = [
800
+ e("p", null, " This day has exceptions applied to it. ", -1)
801
+ ])]),
802
+ _: 1
803
+ })
804
+ ]),
805
+ _: 2
806
+ }, 1024),
807
+ u(C, null, {
808
+ default: D(() => [
809
+ u(Q, { "as-child": "" }, {
810
+ default: D(() => [
811
+ b(k).filter((l) => l.isException).length > 0 ? (s(), r("div", ss)) : I("", !0)
812
+ ]),
813
+ _: 2
814
+ }, 1024),
815
+ u(V, null, {
816
+ default: D(() => [...d[3] || (d[3] = [
817
+ e("p", null, " This day has exceptions applied to it. ", -1)
818
+ ])]),
819
+ _: 1
820
+ })
821
+ ]),
822
+ _: 2
823
+ }, 1024)
824
+ ], 10, Zt),
825
+ u(be, {
826
+ date: k,
827
+ events: b(k),
828
+ resources: y(z)
829
+ }, null, 8, ["date", "events", "resources"])
830
+ ], 2))), 128))
831
+ ])
832
+ ], 544)
833
+ ]));
834
+ };
835
+ }
836
+ }), as = /* @__PURE__ */ Ae(os, [["__scopeId", "data-v-9bd6eb36"]]), ns = { class: "flex items-center justify-between @sm:justify-start gap-4" }, ls = { class: "flex flex-col" }, rs = { class: "flex items-center gap-2" }, is = { class: "text-lg @sm:text-2xl font-bold tracking-tight truncate" }, us = { class: "text-xs @sm:text-sm text-muted-foreground ml-7 truncate" }, ds = { class: "flex @sm:items-center justify-between flex-col @sm:flex-row @5xl:justify-end gap-2" }, cs = { class: "flex items-center gap-1 @5xl:mr-2" }, ms = {
837
+ key: 0,
838
+ class: "flex items-center gap-2 px-1 overflow-x-auto pb-2 -mx-1 scrollbar-hide"
839
+ }, vs = ["onClick"], ps = { class: "flex gap-2 @md:gap-4" }, fs = { class: "hidden @md:flex flex-shrink-0 flex-col gap-4" }, gs = {
840
+ key: 0,
841
+ class: "rounded-md border p-3"
842
+ }, hs = { class: "space-y-1" }, xs = ["onClick"], bs = { class: "min-w-0 flex-1" }, ys = { class: "text-sm font-medium truncate" }, _s = {
843
+ key: 0,
844
+ class: "pt-2 mt-2 border-t"
845
+ }, ks = {
846
+ key: 0,
847
+ class: "mt-1 space-y-1"
848
+ }, ws = { class: "min-w-0 flex-1" }, Ss = { class: "text-sm font-medium truncate text-muted-foreground" }, Ls = /* @__PURE__ */ Z({
849
+ __name: "agenda",
850
+ setup(f) {
851
+ const { hasPermission: w } = Pe(), { params: _ } = Te(), { config: M } = $e(), z = De(M.project), o = T(ce(me())), i = T(1), c = Ie("container"), { width: a } = Ve(c), b = U(() => a.value < 640);
852
+ ue(b, (l) => {
853
+ l && i.value !== 1 && (i.value = 1);
854
+ }, { immediate: !0 });
855
+ const h = T(null), N = T(/* @__PURE__ */ new Map()), B = U(() => h.value?.resources || []), m = U(() => B.value.filter((l) => l.isActive)), H = U(() => B.value.filter((l) => !l.isActive)), j = T(null), P = T(!1);
856
+ ue(m, (l) => {
857
+ l.length > 0 && !j.value && (j.value = l[0].id);
858
+ }, { immediate: !0 });
859
+ const F = U(() => {
860
+ if (!j.value)
861
+ return m.value.length > 0 ? [m.value[0]] : [];
862
+ const l = m.value.find((p) => p.id === j.value);
863
+ return l ? [l] : m.value.length > 0 ? [m.value[0]] : [];
864
+ }), se = U(() => h.value?.pricingOptions?.find((p) => p.isDefault)?.duration || 30), G = (l) => {
865
+ j.value = l;
866
+ };
867
+ ue(o, () => {
868
+ k();
869
+ });
870
+ const oe = U(() => {
871
+ const l = o.value, p = new Date(l.year, l.month - 1, l.day), E = p.toLocaleDateString("en-US", { weekday: "long" }).toUpperCase(), x = l.day, L = p.toLocaleDateString("en-US", { month: "short" }).toUpperCase();
872
+ return {
873
+ dayName: E,
874
+ day: x,
875
+ monthName: L,
876
+ full: `${E} ${x} ${L}`
877
+ };
878
+ }), ee = () => {
879
+ o.value = o.value.subtract({ days: i.value });
880
+ }, re = () => {
881
+ o.value = o.value.add({ days: i.value });
882
+ }, ae = () => {
883
+ o.value = ce(me());
884
+ }, g = (l) => {
885
+ const [p, E] = l.split(":").map(Number);
886
+ return p * 60 + E;
887
+ }, t = (l, p) => (h.value?.exceptions || []).find((x) => p >= x.startDate && p <= x.endDate ? x.resourceIds === null ? !0 : x.resourceIds?.includes(l) : !1) || null, d = (l, p, E) => {
888
+ const x = t(l.id, E);
889
+ if (x)
890
+ return x.isClosed ? [] : x.timeslots.map((n) => ({
891
+ startTime: n.startTime,
892
+ endTime: n.endTime,
893
+ isException: !0
894
+ }));
895
+ const L = p.getDay(), A = l.openingHours?.[L] || [];
896
+ return A.length === 0 ? [] : A.map((n) => ({
897
+ startTime: n.start,
898
+ endTime: n.end,
899
+ isException: !1
900
+ }));
901
+ }, $ = (l, p, E, x) => {
902
+ if (!h.value) return 0;
903
+ const L = N.value.get(p);
904
+ return L ? L.filter((n) => n.resourceId === l).reduce((n, W) => {
905
+ const X = g(W.startTime), ne = g(W.endTime), ie = g(E), pe = g(x);
906
+ return X < pe && ne > ie ? n + (W.reserved || 0) : n;
907
+ }, 0) : 0;
908
+ }, Q = U(() => {
909
+ if (!h.value) return [];
910
+ N.value.size;
911
+ let l = [], p = [];
912
+ for (let x = 0; x < i.value; x++) {
913
+ const L = o.value.add({ days: x });
914
+ p.push(L);
915
+ }
916
+ const E = F.value.length > 0 ? F.value : [];
917
+ return E.length === 0 ? [] : (p.forEach((x) => {
918
+ let L = new Date(x.year, x.month - 1, x.day);
919
+ const A = `${x.year}-${String(x.month).padStart(2, "0")}-${String(x.day).padStart(2, "0")}`;
920
+ E.forEach((n) => {
921
+ const W = d(n, L, A);
922
+ l = l.concat(W.map((X, ne) => {
923
+ const ie = $(n.id, A, X.startTime, X.endTime);
924
+ return {
925
+ id: `block-${A}-${n.id}-${ne}`,
926
+ title: h.value.serviceName,
927
+ date: A,
928
+ startTime: X.startTime,
929
+ endTime: X.endTime,
930
+ theme: n.color || "#3b82f6",
931
+ bookings: ie,
932
+ maxBookings: n.capacity,
933
+ isException: X.isException || !1,
934
+ resourceId: n.id,
935
+ resource: n,
936
+ interval: n.interval || 30,
937
+ serviceDuration: se.value
938
+ };
939
+ }));
940
+ });
941
+ }), l);
942
+ });
943
+ let V = null;
944
+ const C = async () => {
945
+ V || (V = // @ts-ignore - params is actually a computed ref in the implementation
946
+ z.get(M.agendaCollection, _.value.id).then((l) => {
947
+ h.value = l;
948
+ }).finally(() => {
949
+ V = null;
950
+ })), await V;
951
+ }, k = async () => {
952
+ if (h.value || await C(), !h.value) return;
953
+ const l = _.value.id, p = o.value;
954
+ N.value.clear();
955
+ const E = [];
956
+ for (let x = 0; x < i.value; x++) {
957
+ const L = p.add({ days: x }), A = `${L.year}-${String(L.month).padStart(2, "0")}-${String(L.day).padStart(2, "0")}`, n = `${l}_${A}`;
958
+ E.push(
959
+ z.get(M.reservedSpotsCollection, n).then((W) => {
960
+ if (W) {
961
+ const X = [];
962
+ for (const ne of m.value) {
963
+ const ie = W?.[ne.id] || {};
964
+ Object.entries(ie).forEach(([pe, Ce]) => {
965
+ const [Me, ze] = pe.split("-");
966
+ X.push({
967
+ resourceId: ne.id,
968
+ startTime: Me,
969
+ endTime: ze,
970
+ reserved: Ce
971
+ });
972
+ });
973
+ }
974
+ N.value.set(A, X);
975
+ }
976
+ }).catch(() => {
977
+ })
978
+ );
979
+ }
980
+ await Promise.all(E);
981
+ };
982
+ return (async () => (await C(), await k()))(), ue(i, () => {
983
+ k();
984
+ }), te("agendaData", h), te("activeDate", o), te("viewMode", i), te("events", Q), te("resources", F), te("allResources", m), (l, p) => {
985
+ const E = R("Button"), x = R("SegmentedControlButton"), L = R("SegmentedControl"), A = R("Calendar");
986
+ return s(), q(je, null, {
987
+ default: D(() => [
988
+ e("div", {
989
+ ref_key: "container",
990
+ ref: c,
991
+ class: "flex flex-col gap-2 @md:gap-4 w-full"
992
+ }, [
993
+ e("div", {
994
+ class: O(["flex flex-col @5xl:flex-row @5xl:items-center @5xl:justify-between gap-3 px-1", (b.value, "")])
995
+ }, [
996
+ e("div", ns, [
997
+ e("div", ls, [
998
+ e("div", rs, [
999
+ u(y(Ue), {
1000
+ size: 20,
1001
+ class: "text-primary flex-shrink-0"
1002
+ }),
1003
+ e("h2", is, v(oe.value.full), 1)
1004
+ ]),
1005
+ e("p", us, v(h.value?.serviceName), 1)
1006
+ ])
1007
+ ]),
1008
+ e("div", ds, [
1009
+ e("div", cs, [
1010
+ u(E, {
1011
+ variant: "outline",
1012
+ size: "icon",
1013
+ class: "size-8 @sm:size-9",
1014
+ onClick: ee
1015
+ }, {
1016
+ default: D(() => [
1017
+ u(y(fe), { size: 16 })
1018
+ ]),
1019
+ _: 1
1020
+ }),
1021
+ u(E, {
1022
+ variant: "outline",
1023
+ size: "sm",
1024
+ class: "h-8 @sm:h-9 px-2 @sm:px-3 text-xs @sm:text-sm",
1025
+ onClick: ae
1026
+ }, {
1027
+ default: D(() => [...p[3] || (p[3] = [
1028
+ le(" Today ", -1)
1029
+ ])]),
1030
+ _: 1
1031
+ }),
1032
+ u(E, {
1033
+ variant: "outline",
1034
+ size: "icon",
1035
+ class: "size-8 @sm:size-9",
1036
+ onClick: re
1037
+ }, {
1038
+ default: D(() => [
1039
+ u(y(ve), { size: 16 })
1040
+ ]),
1041
+ _: 1
1042
+ })
1043
+ ]),
1044
+ b.value ? I("", !0) : (s(), q(L, {
1045
+ key: 0,
1046
+ modelValue: i.value,
1047
+ "onUpdate:modelValue": p[0] || (p[0] = (n) => i.value = n)
1048
+ }, {
1049
+ default: D(() => [
1050
+ u(x, { value: 1 }, {
1051
+ default: D(() => [...p[4] || (p[4] = [
1052
+ e("span", { class: "whitespace-nowrap" }, "1 Day", -1)
1053
+ ])]),
1054
+ _: 1
1055
+ }),
1056
+ u(x, { value: 3 }, {
1057
+ default: D(() => [...p[5] || (p[5] = [
1058
+ e("span", { class: "whitespace-nowrap" }, "3 Days", -1)
1059
+ ])]),
1060
+ _: 1
1061
+ }),
1062
+ u(x, { value: 7 }, {
1063
+ default: D(() => [...p[6] || (p[6] = [
1064
+ e("span", { class: "whitespace-nowrap" }, "7 Days", -1)
1065
+ ])]),
1066
+ _: 1
1067
+ })
1068
+ ]),
1069
+ _: 1
1070
+ }, 8, ["modelValue"])),
1071
+ y(w)("manage-reservations") ? (s(), q(Fe, {
1072
+ key: 1,
1073
+ "agenda-data": h.value
1074
+ }, null, 8, ["agenda-data"])) : I("", !0)
1075
+ ])
1076
+ ], 2),
1077
+ b.value && m.value.length > 0 ? (s(), r("div", ms, [
1078
+ (s(!0), r(Y, null, J(m.value, (n) => (s(), r("button", {
1079
+ key: n.id,
1080
+ class: O(["flex items-center gap-2 px-3 py-1.5 rounded-full border text-sm whitespace-nowrap transition-colors flex-shrink-0", {
1081
+ "bg-primary text-primary-foreground border-primary": j.value === n.id,
1082
+ "bg-background hover:bg-muted": j.value !== n.id
1083
+ }]),
1084
+ onClick: (W) => G(n.id)
1085
+ }, [
1086
+ e("div", {
1087
+ class: "size-5 rounded-full flex items-center justify-center text-white text-[10px] font-medium",
1088
+ style: K({ backgroundColor: j.value === n.id ? "rgba(255,255,255,0.3)" : n.color || "#6b7280" })
1089
+ }, v(n.avatarLabel || n.name.charAt(0).toUpperCase()), 5),
1090
+ e("span", null, v(n.name), 1)
1091
+ ], 10, vs))), 128))
1092
+ ])) : I("", !0),
1093
+ e("div", ps, [
1094
+ e("div", fs, [
1095
+ u(A, {
1096
+ modelValue: o.value,
1097
+ "onUpdate:modelValue": p[1] || (p[1] = (n) => o.value = n),
1098
+ "weekday-format": "short",
1099
+ class: "rounded-md border"
1100
+ }, null, 8, ["modelValue"]),
1101
+ B.value.length > 0 ? (s(), r("div", gs, [
1102
+ p[7] || (p[7] = e("div", { class: "flex items-center justify-between mb-3" }, [
1103
+ e("span", { class: "text-sm font-medium" }, "Resources")
1104
+ ], -1)),
1105
+ e("div", hs, [
1106
+ (s(!0), r(Y, null, J(m.value, (n) => (s(), r("div", {
1107
+ key: n.id,
1108
+ class: O(["flex items-center gap-2 p-2 rounded-md hover:bg-muted cursor-pointer transition-colors", {
1109
+ "bg-muted ring-2 ring-primary/20": j.value === n.id,
1110
+ "opacity-50": j.value && j.value !== n.id
1111
+ }]),
1112
+ onClick: (W) => G(n.id)
1113
+ }, [
1114
+ e("div", {
1115
+ class: "size-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",
1116
+ style: K({ backgroundColor: n.color || "#6b7280" })
1117
+ }, v(n.avatarLabel || n.name.charAt(0).toUpperCase()), 5),
1118
+ e("div", bs, [
1119
+ e("div", ys, v(n.name), 1)
1120
+ ]),
1121
+ e("div", {
1122
+ class: O(["size-2 rounded-full flex-shrink-0", j.value === n.id ? "bg-primary" : "bg-muted-foreground/30"])
1123
+ }, null, 2)
1124
+ ], 10, xs))), 128)),
1125
+ H.value.length > 0 ? (s(), r("div", _s, [
1126
+ e("button", {
1127
+ class: "flex items-center gap-2 text-xs text-muted-foreground hover:text-foreground w-full py-1 transition-colors",
1128
+ onClick: p[2] || (p[2] = (n) => P.value = !P.value)
1129
+ }, [
1130
+ u(y(ve), {
1131
+ size: 14,
1132
+ class: O(["transition-transform", { "rotate-90": P.value }])
1133
+ }, null, 8, ["class"]),
1134
+ e("span", null, "Inactive (" + v(H.value.length) + ")", 1)
1135
+ ]),
1136
+ P.value ? (s(), r("div", ks, [
1137
+ (s(!0), r(Y, null, J(H.value, (n) => (s(), r("div", {
1138
+ key: n.id,
1139
+ class: "flex items-center gap-2 p-2 rounded-md opacity-50"
1140
+ }, [
1141
+ e("div", {
1142
+ class: "size-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0 grayscale",
1143
+ style: K({ backgroundColor: n.color || "#6b7280" })
1144
+ }, v(n.avatarLabel || n.name.charAt(0).toUpperCase()), 5),
1145
+ e("div", ws, [
1146
+ e("div", Ss, v(n.name), 1)
1147
+ ])
1148
+ ]))), 128))
1149
+ ])) : I("", !0)
1150
+ ])) : I("", !0)
1151
+ ])
1152
+ ])) : I("", !0)
1153
+ ]),
1154
+ u(as, { "agenda-data": h.value }, null, 8, ["agenda-data"])
1155
+ ])
1156
+ ], 512)
1157
+ ]),
1158
+ _: 1
1159
+ });
1160
+ };
1161
+ }
1162
+ });
1163
+ export {
1164
+ Ls as default
1165
+ };