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