@oneclick.dev/cms-core-modules 0.0.102 → 0.0.103

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