@oneclick.dev/cms-core-modules 0.0.59 → 0.0.60

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 (147) hide show
  1. package/dist/{Components-D9yIIosM.mjs → Components-C83O-xlF.mjs} +1 -1
  2. package/dist/{ContentEditor-DCmt_y_R.js → ContentEditor-BAepN3Yd.js} +51 -34
  3. package/dist/{ContentEditor-CtGeIzC4.mjs → ContentEditor-BPjWW3d1.mjs} +12341 -10099
  4. package/dist/Create-Bh4g6QW4.js +1 -0
  5. package/dist/{Create-Bwf1RXdG.mjs → Create-Cf7pvh5G.mjs} +38 -39
  6. package/dist/DateFormatter-BPPBZp1j.js +1 -0
  7. package/dist/{CalendarDate-CRT2Viyt.mjs → DateFormatter-DsmlAuYV.mjs} +353 -256
  8. package/dist/{Detail-CpfOQChd.mjs → Detail-B4b_FLDa.mjs} +2 -2
  9. package/dist/{Detail-B-PnkcXD.mjs → Detail-BGD75ul4.mjs} +2 -2
  10. package/dist/{Detail-Dd_OkpcN.js → Detail-BayNaAg9.js} +1 -1
  11. package/dist/{Detail-C4E1T87K.mjs → Detail-Byk781b4.mjs} +3 -3
  12. package/dist/{Detail-Cd5CBVN0.js → Detail-CnK-qbhE.js} +1 -1
  13. package/dist/Detail-CtbWzq-R.js +1 -0
  14. package/dist/{Detail-CNfTDUE5.js → Detail-Cxd2VMOl.js} +1 -1
  15. package/dist/{Detail-BVlGSjOq.mjs → Detail-D10shmpK.mjs} +6 -7
  16. package/dist/{Detail-CwagT6gQ.mjs → Detail-U0mgLKt6.mjs} +2 -2
  17. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-CcysXzmW.mjs +75 -0
  18. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-Czu6Dcde.js +1 -0
  19. package/dist/{Entries-zyhycw1M.mjs → Entries-C6Di46My.mjs} +1 -1
  20. package/dist/{Find-BPR0uU-Z.mjs → Find-B4sAEx0B.mjs} +2 -2
  21. package/dist/{Find-BidEQJxT.js → Find-Ds6OvuH6.js} +1 -1
  22. package/dist/{GlobalStyling-BLQ_1W2y.mjs → GlobalStyling-C9VthHWK.mjs} +1 -1
  23. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BJitmbPE.mjs +396 -0
  24. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-D50uTpZY.js +1 -0
  25. package/dist/Overview-B-8TLLjh.js +1 -0
  26. package/dist/{Overview-CDN88OSM.mjs → Overview-BCpJNiEB.mjs} +1 -1
  27. package/dist/Overview-B_99j5eA.js +1 -0
  28. package/dist/{Overview-BLsZMHNW.mjs → Overview-CIa1E-HH.mjs} +1 -1
  29. package/dist/{Overview-D1nJLBe1.mjs → Overview-CgViRnNc.mjs} +1 -1
  30. package/dist/Overview-DtWvKB3W.mjs +327 -0
  31. package/dist/Overview-HvlDEgqi.mjs +862 -0
  32. package/dist/{Overview-BH3NwvNX.mjs → Overview-Su8ZUbMs.mjs} +3 -3
  33. package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-CI8YgHdU.js +345 -0
  34. package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-P-MWwcVh.mjs +2093 -0
  35. package/dist/{TableView-CS13LLxk.mjs → TableView-B8iLWWcP.mjs} +48394 -36321
  36. package/dist/TableView-BxK6R8v3.js +312 -0
  37. package/dist/{TemplateList.vue_vue_type_script_setup_true_lang-BiLAkhIA.mjs → TemplateList.vue_vue_type_script_setup_true_lang-Cmovy7kk.mjs} +5 -5
  38. package/dist/{View-C7axVP9t.mjs → View-DDXN0tKD.mjs} +7 -7
  39. package/dist/View-DfzaVOzS.js +1 -0
  40. package/dist/agenda-D81m29_4.mjs +1135 -0
  41. package/dist/agenda-uzPPxgsW.js +1 -0
  42. package/dist/availability-B-tRp8hB.mjs +629 -0
  43. package/dist/availability-BiBbzEIM.js +1 -0
  44. package/dist/{exceptions-D3b18TiY.mjs → exceptions-BFchkR06.mjs} +70 -71
  45. package/dist/exceptions-C-DPRNQa.js +1 -0
  46. package/dist/index-4tjmIans.js +1 -0
  47. package/dist/index-AmUV8LZQ.mjs +176 -0
  48. package/dist/index-BDaVYdkD.mjs +7763 -0
  49. package/dist/{index-DT1wWnUk.mjs → index-BWDwEd8D.mjs} +1 -1
  50. package/dist/{index-CImCyE3L.mjs → index-BfBBm9uY.mjs} +1 -1
  51. package/dist/{index-DMoyoaks.mjs → index-Bkq58CeQ.mjs} +2 -2
  52. package/dist/{index-DI6mydpm.mjs → index-CABh6Qn6.mjs} +2 -2
  53. package/dist/{index-CQiY-oTN.mjs → index-CQkOH2_3.mjs} +1 -1
  54. package/dist/{index-Bwi1mtkq.mjs → index-CU-tbS5W.mjs} +1 -1
  55. package/dist/{index-BzuHN-r8.mjs → index-Cpnn_Pxd.mjs} +1 -1
  56. package/dist/index-CxETuRsG.js +1 -0
  57. package/dist/{index-DyCHxFp3.mjs → index-DRqJOqUR.mjs} +502 -449
  58. package/dist/index-DTago6vW-Bhr8E1Y6.js +88 -0
  59. package/dist/index-DTago6vW-CnomHQ_S.mjs +4123 -0
  60. package/dist/index-DfV8-6ON.js +245 -0
  61. package/dist/index-Dnn2SCSl.js +1 -0
  62. package/dist/{index-BEGU8Kme.mjs → index-Dpl9sU6a.mjs} +2 -2
  63. package/dist/index-Uf7TwBuW.mjs +110 -0
  64. package/dist/index-YMaY4uuk-BgpTtr73.js +1 -0
  65. package/dist/{index-CKPshlZ8-BQiiP6r_.mjs → index-YMaY4uuk-C_xV5K9Z.mjs} +399 -363
  66. package/dist/{index--jjEzba7.mjs → index-cOnxXTbF.mjs} +1 -1
  67. package/dist/index-hlylYYgy.mjs +24 -0
  68. package/dist/index.cjs.js +1 -1
  69. package/dist/index.mjs +98 -81
  70. package/dist/orders-Bh8w0ueq.mjs +346 -0
  71. package/dist/orders-Dt0zMz97.js +1 -0
  72. package/dist/payment-BQaAqQ5q.js +1 -0
  73. package/dist/payment-BbWByERf.mjs +1080 -0
  74. package/dist/regular-1LXNPviB.js +1 -0
  75. package/dist/regular-_05oq5Tx.mjs +1101 -0
  76. package/dist/regular-slots-Bs3WJB3U.js +1 -0
  77. package/dist/regular-slots-C2NYxLPn.mjs +222 -0
  78. package/dist/resources-DgPnEv76.mjs +811 -0
  79. package/dist/resources-eb0pivDL.js +1 -0
  80. package/dist/src/appointments/components/edit/EditLayout.vue.d.ts +2 -2
  81. package/dist/src/appointments/components/edit/EventDialog/BookingsList.vue.d.ts +92 -0
  82. package/dist/src/appointments/components/edit/EventDialog/CancelReservationDialog.vue.d.ts +8 -0
  83. package/dist/src/appointments/components/edit/EventDialog/EventDialog.vue.d.ts +10 -0
  84. package/dist/src/appointments/components/edit/{EventDialog.vue.d.ts → EventDialog/ResendConfirmationDialog.vue.d.ts} +1 -1
  85. package/dist/src/appointments/components/edit/EventDialog/ReservationDetailDialog.vue.d.ts +51 -0
  86. package/dist/src/appointments/components/edit/EventDialog/TimelineChart.vue.d.ts +24 -0
  87. package/dist/src/appointments/components/edit/EventDialog/TransferReservationDialog.vue.d.ts +4 -0
  88. package/dist/src/appointments/components/edit/EventTimeline.vue.d.ts +15 -7
  89. package/dist/src/appointments/components/edit/NewReservationDialog/NewReservationDialog.vue.d.ts +2 -0
  90. package/dist/src/appointments/components/edit/dashboard/BookingsList.vue.d.ts +68 -0
  91. package/dist/src/appointments/components/edit/dashboard/Timeline.vue.d.ts +15 -0
  92. package/dist/src/appointments/components/edit/dashboard/timeline/ResourceSelector.vue.d.ts +50 -0
  93. package/dist/src/appointments/config.d.ts +30 -0
  94. package/dist/src/appointments/index.d.ts +32 -5
  95. package/dist/src/appointments/pages/edit/agenda.vue.d.ts +1 -1
  96. package/dist/src/appointments/pages/edit/availability.vue.d.ts +1 -1
  97. package/dist/src/appointments/pages/edit/index.vue.d.ts +1 -1
  98. package/dist/src/appointments/pages/edit/orders.vue.d.ts +64 -0
  99. package/dist/src/appointments/pages/edit/payment.vue.d.ts +1 -1
  100. package/dist/src/appointments/pages/edit/regular-slots.vue.d.ts +1 -1
  101. package/dist/src/appointments/pages/edit/resources.vue.d.ts +1 -1
  102. package/dist/src/appointments/routes.d.ts +2 -5
  103. package/dist/src/appointments/types.d.ts +16 -0
  104. package/dist/src/appointments/utils/printReservation.d.ts +45 -0
  105. package/dist/src/content-manager/components/content-editor/ContentStructuredContentSections.vue.d.ts +4 -0
  106. package/dist/src/content-manager/components/content-editor/PageSettings.vue.d.ts +2 -0
  107. package/dist/src/content-manager/components/content-editor/SidebarSectionWrapper.vue.d.ts +11 -1
  108. package/dist/src/content-manager/types.d.ts +5 -0
  109. package/dist/{vee-validate-zod-BPQyEfpF.js → vee-validate-zod-ByykgYKJ.js} +1 -1
  110. package/dist/{vee-validate-zod-IXkfh-6Q.mjs → vee-validate-zod-CcOwoF6y.mjs} +4 -4
  111. package/package.json +4 -2
  112. package/dist/CalendarDate-CWtpXgpD.js +0 -1
  113. package/dist/Create-BP8TX6rj.js +0 -1
  114. package/dist/DateFormatter-BbcSwTs4.js +0 -1
  115. package/dist/DateFormatter-CbO0PVUK.mjs +0 -99
  116. package/dist/Detail-DUo6qKqO.js +0 -1
  117. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-BWuKVkvV.js +0 -1
  118. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-D0-EcU0_.mjs +0 -55
  119. package/dist/Overview-BNMZ9MUK.js +0 -1
  120. package/dist/Overview-CEPodGCn.mjs +0 -311
  121. package/dist/Overview-CvquDPhB.js +0 -1
  122. package/dist/Overview-D67UjG6n.mjs +0 -947
  123. package/dist/RegularSlotEditor.vue_vue_type_script_setup_true_lang-0xZSq0rx.js +0 -1
  124. package/dist/RegularSlotEditor.vue_vue_type_script_setup_true_lang-Bj_PVLLV.mjs +0 -392
  125. package/dist/TableView-Dv4YXBD1.js +0 -111
  126. package/dist/View-7qb_ohVo.js +0 -1
  127. package/dist/agenda-B49oKGeh.mjs +0 -706
  128. package/dist/agenda-DipQ5IWP.js +0 -1
  129. package/dist/availability-C7q9tq6l.js +0 -1
  130. package/dist/availability-DeCkqiu8.mjs +0 -613
  131. package/dist/exceptions-DJ9zWX3k.js +0 -1
  132. package/dist/index-CKPshlZ8-CIz1tDwX.js +0 -1
  133. package/dist/index-DUeFrD-B.js +0 -1
  134. package/dist/index-DsnoK4ia.mjs +0 -579
  135. package/dist/index-WL1P6d3j.js +0 -1
  136. package/dist/index-_mG-aU3Z.mjs +0 -87
  137. package/dist/index-_sQDF1pH.js +0 -1
  138. package/dist/index-klI238nT.mjs +0 -24
  139. package/dist/payment-kTjsV0Jj.js +0 -1
  140. package/dist/payment-zpCM0LD-.mjs +0 -981
  141. package/dist/regular-C4_3YXqx.mjs +0 -602
  142. package/dist/regular-DFwPEbZO.js +0 -1
  143. package/dist/regular-slots-4ooEpICB.mjs +0 -67
  144. package/dist/regular-slots-BAVGbomI.js +0 -1
  145. package/dist/resources-MpQkSstv.mjs +0 -563
  146. package/dist/resources-iM28T3dD.js +0 -1
  147. package/dist/src/appointments/components/edit/RegularSlotEditor.vue.d.ts +0 -16
@@ -0,0 +1,1135 @@
1
+ import { defineComponent as K, resolveComponent as N, openBlock as l, createElementBlock as m, createElementVNode as e, Fragment as Y, renderList as q, toDisplayString as v, normalizeStyle as J, normalizeClass as R, createVNode as d, withCtx as C, unref as b, createTextVNode as ne, createCommentVNode as z, ref as T, createBlock as H, provide as ee, computed as j, onMounted as fe, onUnmounted as pe, inject as ie, nextTick as xe, onBeforeUnmount as ze, watch as re } from "vue";
2
+ import { o as ue, g as de } from "./DateFormatter-DsmlAuYV.mjs";
3
+ import { X as ke, 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-CcysXzmW.mjs";
5
+ import { useModule as $e, useModuleRoute as Te, useFirebaseIntegration as Se, useModulePermissions as Ue } from "@oneclick.dev/cms-kit";
6
+ import { _ as Oe, F as je } from "./ReservationDetailDialog.vue_vue_type_script_setup_true_lang-P-MWwcVh.mjs";
7
+ import { _ as Pe } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
8
+ import { _ as be } from "./NewReservationDialog.vue_vue_type_script_setup_true_lang-BJitmbPE.mjs";
9
+ const Ne = { class: "mb-6" }, Re = { 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 w = k, S = (n) => {
26
+ w("select", n);
27
+ }, I = () => {
28
+ w("clear");
29
+ };
30
+ return (n, u) => {
31
+ const r = N("Button");
32
+ return l(), m("div", Ne, [
33
+ u[2] || (u[2] = e("h3", { class: "font-semibold text-sm mb-2" }, "Timeline", -1)),
34
+ e("div", Re, [
35
+ (l(!0), m(Y, null, q(f.timeSlots, (s) => (l(), m("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: ($) => S(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: J({
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") ? (l(), m("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)) : (l(), m("span", Qe, " "))
59
+ ], 8, Fe))), 128))
60
+ ]),
61
+ f.selectedTimeSlot ? (l(), m("div", Xe, [
62
+ d(r, {
63
+ variant: "ghost",
64
+ size: "icon",
65
+ class: "h-6 w-6 p-0",
66
+ onClick: I
67
+ }, {
68
+ default: C(() => [
69
+ d(b(ke), { size: 14 })
70
+ ]),
71
+ _: 1
72
+ }),
73
+ e("span", null, [
74
+ u[0] || (u[0] = ne(" Showing ", -1)),
75
+ e("span", Ye, v(f.slotStats[f.selectedTimeSlot]?.bookings || 0), 1),
76
+ u[1] || (u[1] = ne(" bookings at ", -1)),
77
+ e("span", qe, v(f.selectedTimeSlot), 1)
78
+ ])
79
+ ])) : z("", !0)
80
+ ]);
81
+ };
82
+ }
83
+ }), Ge = { class: "flex items-center justify-between mb-3" }, Ke = { 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" }, lt = { class: "flex-1" }, rt = { 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" }, ft = {
96
+ key: 0,
97
+ class: "text-sm font-medium mt-1"
98
+ }, pt = /* @__PURE__ */ K({
99
+ __name: "BookingsList",
100
+ props: {
101
+ orders: {},
102
+ filteredOrders: {},
103
+ isLoading: { type: Boolean },
104
+ selectedTimeSlot: {},
105
+ searchQuery: {}
106
+ },
107
+ emits: ["update:searchQuery", "refresh"],
108
+ setup(f, { emit: k }) {
109
+ const w = k, S = T(null), I = (r) => {
110
+ w("update:searchQuery", r);
111
+ }, n = () => {
112
+ w("update:searchQuery", "");
113
+ }, u = () => {
114
+ w("refresh");
115
+ };
116
+ return (r, s) => {
117
+ const $ = N("Input"), y = N("Button");
118
+ return l(), m("div", null, [
119
+ e("div", Ge, [
120
+ e("h3", Ke, [
121
+ s[0] || (s[0] = ne(" Bookings ", -1)),
122
+ f.selectedTimeSlot || f.searchQuery ? (l(), m("span", Ze, " (" + v(f.filteredOrders.length) + " of " + v(f.orders.length) + ") ", 1)) : z("", !0)
123
+ ])
124
+ ]),
125
+ e("div", et, [
126
+ d(b(Ee), {
127
+ size: 16,
128
+ class: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"
129
+ }),
130
+ d($, {
131
+ "model-value": f.searchQuery,
132
+ placeholder: "Search by name, email, or phone...",
133
+ class: "pl-9 pr-9",
134
+ "onUpdate:modelValue": I
135
+ }, null, 8, ["model-value"]),
136
+ f.searchQuery ? (l(), H(y, {
137
+ key: 0,
138
+ variant: "ghost",
139
+ size: "icon",
140
+ class: "absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7",
141
+ onClick: n
142
+ }, {
143
+ default: C(() => [
144
+ d(b(ke), { size: 14 })
145
+ ]),
146
+ _: 1
147
+ })) : z("", !0)
148
+ ]),
149
+ f.isLoading ? (l(), m("div", tt, [...s[1] || (s[1] = [
150
+ e("div", { class: "animate-spin rounded-full h-8 w-8 border-b-2 border-primary" }, null, -1)
151
+ ])])) : f.filteredOrders.length === 0 ? (l(), m("div", st, v(f.selectedTimeSlot ? "No bookings for this time slot" : "No bookings for this event"), 1)) : (l(), m("div", ot, [
152
+ (l(!0), m(Y, null, q(f.filteredOrders, (p) => (l(), m("div", {
153
+ key: p.res_id || p.id,
154
+ class: "p-3 border rounded-lg hover:bg-muted/50 transition-colors",
155
+ onClick: (B) => b(S).openDialog(p)
156
+ }, [
157
+ e("div", at, [
158
+ e("div", lt, [
159
+ e("div", rt, v(p.customerInfo.firstName + " " + p.customerInfo.lastName || "Unknown Customer"), 1),
160
+ e("div", it, v(p.customerInfo.email), 1),
161
+ e("div", ut, v(p.customerInfo.phone), 1),
162
+ e("div", dt, [
163
+ e("div", ct, [
164
+ d(b(ge), { size: 12 }),
165
+ e("span", null, v(p.startTime) + " - " + v(p.endTime), 1)
166
+ ]),
167
+ e("div", mt, [
168
+ d(b(he), { size: 12 }),
169
+ e("span", null, v(p.spots), 1)
170
+ ])
171
+ ])
172
+ ]),
173
+ e("div", vt, [
174
+ e("div", {
175
+ class: R(["inline-block px-2 py-1 text-xs rounded-full", {
176
+ "bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400": p.status === "completed" || p.status === "confirmed",
177
+ "bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400": p.status === "pending",
178
+ "bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400": p.status === "cancelled"
179
+ }])
180
+ }, v(p.status || "pending"), 3),
181
+ p.reservationPrice || p.reservationPrice === 0 ? (l(), m("div", ft, " €" + v(p.reservationPrice.toFixed(2)), 1)) : z("", !0)
182
+ ])
183
+ ])
184
+ ], 8, nt))), 128))
185
+ ])),
186
+ d(Oe, {
187
+ ref_key: "reservationDetailDialog",
188
+ ref: S,
189
+ onCancelled: u
190
+ }, null, 512)
191
+ ]);
192
+ };
193
+ }
194
+ }), gt = { class: "flex items-center gap-4 mt-2 text-sm" }, ht = { class: "flex items-center gap-1" }, xt = {
195
+ key: 0,
196
+ class: "flex items-center gap-1"
197
+ }, bt = { class: "flex items-center gap-1" }, yt = { class: "py-4" }, _t = /* @__PURE__ */ K({
198
+ __name: "EventDialog",
199
+ props: {
200
+ resources: { default: () => [] }
201
+ },
202
+ setup(f, { expose: k }) {
203
+ const w = f, { config: S } = $e(), { params: I } = Te(), n = Se(S.project), u = T(!1), r = T(null), s = T([]), $ = T(!1), y = T(null), p = T("");
204
+ ee("event", r);
205
+ const B = j(() => {
206
+ if (!r.value) return [];
207
+ const h = r.value.resource?.interval || 60, _ = [], [c, g] = r.value.startTime.split(":").map(Number), [E, V] = r.value.endTime.split(":").map(Number), O = c * 60 + g, F = E * 60 + V;
208
+ for (let t = O; t < F; t += h) {
209
+ const o = Math.floor(t / 60), x = t % 60, i = Math.min(t + h, F), M = Math.floor(i / 60), P = i % 60, a = `${o.toString().padStart(2, "0")}:${x.toString().padStart(2, "0")}`, W = `${M.toString().padStart(2, "0")}:${P.toString().padStart(2, "0")}`;
210
+ _.push({
211
+ startTime: a,
212
+ endTime: W,
213
+ label: a
214
+ });
215
+ }
216
+ return _;
217
+ }), D = j(() => {
218
+ const h = {};
219
+ return B.value.forEach((_) => {
220
+ h[_.startTime] = { bookings: 0, spots: 0, orders: [] };
221
+ }), s.value.forEach((_) => {
222
+ B.value.forEach((c) => {
223
+ _.startTime < c.endTime && _.endTime > c.startTime && (h[c.startTime].bookings++, h[c.startTime].spots += _.spots || 0, h[c.startTime].orders.push(_));
224
+ });
225
+ }), h;
226
+ }), Q = j(() => Math.max(1, ...Object.values(D.value).map((h) => h.spots))), L = j(() => {
227
+ let h = s.value;
228
+ return y.value && (h = D.value[y.value]?.orders || []), p.value.trim() && (h = new je(h, {
229
+ keys: [
230
+ "customerInfo.firstName",
231
+ "customerInfo.lastName",
232
+ "customerInfo.email",
233
+ "customerInfo.phone"
234
+ ],
235
+ threshold: 0.3,
236
+ ignoreLocation: !0
237
+ }).search(p.value).map((c) => c.item)), h;
238
+ }), U = j(() => ({
239
+ spots: s.value.reduce((h, _) => h + (_.spots || 0), 0),
240
+ bookings: s.value.length
241
+ })), A = (h) => {
242
+ y.value === h ? y.value = null : y.value = h;
243
+ }, te = () => {
244
+ y.value = null;
245
+ }, G = async (h) => {
246
+ u.value = !0, r.value = h, y.value = null, p.value = "", await Z();
247
+ }, Z = async () => {
248
+ if (r.value) {
249
+ $.value = !0, s.value = [];
250
+ try {
251
+ const h = I.value.id, _ = `${h}_${r.value.date}`;
252
+ let c = await n.get(S.reservedSpotsCollection, _), g = [];
253
+ if (!c) return;
254
+ for (const O of w.resources) {
255
+ const F = c?.[O.id] || {};
256
+ Object.entries(F).forEach(([t, o]) => {
257
+ const [x, i] = t.split("-");
258
+ g.push({
259
+ resourceId: O.id,
260
+ startTime: x,
261
+ endTime: i,
262
+ reserved: o
263
+ });
264
+ });
265
+ }
266
+ const E = g.filter(
267
+ (O) => O.resourceId === r.value.resourceId && O.startTime >= r.value.startTime && O.endTime <= r.value.endTime
268
+ );
269
+ if (E.length === 0) return;
270
+ let V = [];
271
+ E.forEach(async (O) => {
272
+ const F = `${O.resourceId}_${r.value.date}_${O.startTime.replace(":", "")}`, t = await n.find(S.reservationsCollection, {
273
+ filters: [
274
+ { field: "agendaId", operator: "==", value: h },
275
+ { field: "flattenedReservations", operator: "array-contains", value: F },
276
+ { field: "status", operator: "==", value: "confirmed" }
277
+ ]
278
+ });
279
+ console.log("All orders fetched for event:", t), t.forEach((o) => {
280
+ let x = o.reservations.filter((i) => {
281
+ if (i.resourceId !== r.value.resourceId || i.date !== r.value.date) return !1;
282
+ const M = i.timeslot?.startTime;
283
+ return M ? M >= r.value.startTime && M < r.value.endTime : !1;
284
+ })?.map((i) => ({
285
+ customerInfo: o.customerInfo,
286
+ amountDue: o.amountDue,
287
+ amountPaid: o.amountPaid,
288
+ status: o.status,
289
+ subtotal: o.subtotal,
290
+ total: o.total,
291
+ discount: o.discount,
292
+ id: o.id,
293
+ res_id: i.id,
294
+ spots: i.spots,
295
+ date: r.value.date,
296
+ startTime: i.timeslot?.startTime,
297
+ endTime: i.timeslot?.endTime,
298
+ reservationPrice: i.totalPrice,
299
+ reservationBasePrice: i.basePrice,
300
+ reservationAddOnsPrice: i.addOnsPrice,
301
+ pricingOptionId: i.pricingOptionId,
302
+ pricingOption: i.pricingOption
303
+ })) || [];
304
+ V = V.concat(x);
305
+ }), s.value = V?.sort((o, x) => o.startTime.localeCompare(x.startTime));
306
+ });
307
+ } catch (h) {
308
+ console.error("Error loading orders:", h), s.value = [];
309
+ } finally {
310
+ $.value = !1;
311
+ }
312
+ }
313
+ }, se = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], ae = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
314
+ return k({
315
+ openDialog: G
316
+ }), (h, _) => {
317
+ const c = N("DialogTitle"), g = N("DialogDescription"), E = N("DialogHeader"), V = N("Button"), O = N("DialogFooter"), F = N("DialogScrollContent"), t = N("Dialog");
318
+ return l(), H(t, {
319
+ open: u.value,
320
+ "onUpdate:open": _[2] || (_[2] = (o) => u.value = o)
321
+ }, {
322
+ default: C(() => [
323
+ d(F, { class: "sm:max-w-3xl" }, {
324
+ default: C(() => [
325
+ d(E, null, {
326
+ default: C(() => [
327
+ r.value?.date ? (l(), H(c, { key: 0 }, {
328
+ default: C(() => [
329
+ ne(v(se[new Date(r.value.date).getUTCDay()]) + " " + v(ae[new Date(r.value.date).getUTCMonth()]) + " " + v(new Date(r.value.date).getUTCDate()) + ", " + v(new Date(r.value.date).getUTCFullYear()), 1)
330
+ ]),
331
+ _: 1
332
+ })) : z("", !0),
333
+ d(g, null, {
334
+ default: C(() => [
335
+ e("div", gt, [
336
+ e("div", ht, [
337
+ d(b(ge), { size: 14 }),
338
+ e("span", null, v(r.value?.startTime) + " – " + v(r.value?.endTime), 1)
339
+ ]),
340
+ r.value?.resource ? (l(), m("div", xt, [
341
+ e("div", {
342
+ class: "w-4 h-4 rounded-full",
343
+ style: J({ backgroundColor: r.value.resource.color || "#6b7280" })
344
+ }, null, 4),
345
+ e("span", null, v(r.value.resource.name), 1)
346
+ ])) : z("", !0),
347
+ e("div", bt, [
348
+ d(b(he), { size: 14 }),
349
+ e("span", null, v(U.value.spots) + " spots in " + v(U.value.bookings) + " reservations", 1)
350
+ ])
351
+ ])
352
+ ]),
353
+ _: 1
354
+ })
355
+ ]),
356
+ _: 1
357
+ }),
358
+ e("div", yt, [
359
+ B.value.length > 1 ? (l(), H(Je, {
360
+ key: 0,
361
+ "time-slots": B.value,
362
+ "slot-stats": D.value,
363
+ "selected-time-slot": y.value,
364
+ "max-spots": Q.value,
365
+ onSelect: A,
366
+ onClear: te
367
+ }, null, 8, ["time-slots", "slot-stats", "selected-time-slot", "max-spots"])) : z("", !0),
368
+ d(pt, {
369
+ orders: s.value,
370
+ "filtered-orders": L.value,
371
+ "is-loading": $.value,
372
+ "selected-time-slot": y.value,
373
+ "search-query": p.value,
374
+ "onUpdate:searchQuery": _[0] || (_[0] = (o) => p.value = o),
375
+ onRefresh: Z
376
+ }, null, 8, ["orders", "filtered-orders", "is-loading", "selected-time-slot", "search-query"])
377
+ ]),
378
+ d(O, null, {
379
+ default: C(() => [
380
+ d(V, {
381
+ variant: "outline",
382
+ onClick: _[1] || (_[1] = (o) => u.value = !1)
383
+ }, {
384
+ default: C(() => [..._[3] || (_[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
+ }), wt = { class: "flex-1 border-r shadow-sm overflow-hidden min-h-[1536px]" }, kt = { class: "relative h-full min-h-[1536px]" }, $t = { class: "divide-y divide-input/80 h-full flex flex-col min-h-[1536px] border-y border-input/80" }, Tt = { class: "absolute inset-0 pointer-events-none" }, St = { class: "relative mr-3 h-full ml-2" }, Dt = ["onClick"], Ct = {
401
+ key: 0,
402
+ class: "absolute bottom-0 left-0 right-0 h-1 bg-black/20"
403
+ }, Mt = { class: "flex items-start justify-between gap-2 mb-1" }, zt = { class: "font-semibold text-sm leading-tight line-clamp-1 flex-1" }, Et = { class: "flex items-center gap-1 shrink-0" }, It = ["title"], Bt = { 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, w = T(null), S = (u) => {
413
+ const [r, s] = u.split(":").map(Number);
414
+ return r * 60 + s;
415
+ };
416
+ j(() => !k.events || !k.resources ? [] : k.resources.map((u) => {
417
+ const s = k.events.filter(($) => $.resourceId === u.id).map(($) => {
418
+ const y = S($.startTime), B = S($.endTime) - y, D = y / 1440 * 100, Q = B / 1440 * 100, L = ($.bookings ?? 0) > 0, U = $.maxBookings ? ($.bookings ?? 0) / $.maxBookings * 100 : 0;
419
+ return {
420
+ ...$,
421
+ top: `${D}%`,
422
+ height: `${Q}%`,
423
+ color: $.resource?.color || "#3b82f6",
424
+ hasBookings: L,
425
+ fillPercentage: U,
426
+ isSmall: B < 60
427
+ };
428
+ });
429
+ return {
430
+ resource: u,
431
+ events: s
432
+ };
433
+ }));
434
+ const I = j(() => k.events ? k.events.map((u) => {
435
+ const r = S(u.startTime), $ = S(u.endTime) - r, y = r / 1440 * 100, p = $ / 1440 * 100, B = (u.bookings ?? 0) > 0, D = u.maxBookings ? (u.bookings ?? 0) / u.maxBookings * 100 : 0;
436
+ return {
437
+ ...u,
438
+ top: `${y}%`,
439
+ height: `${p}%`,
440
+ color: u.resource?.color || "#3b82f6",
441
+ hasBookings: B,
442
+ fillPercentage: D,
443
+ isSmall: $ < 60
444
+ };
445
+ }) : []), n = Array.from({ length: 24 }, (u, r) => ({
446
+ hour: r,
447
+ label: `${r.toString().padStart(2, "0")}:00`
448
+ }));
449
+ return (u, r) => (l(), m(Y, null, [
450
+ e("div", wt, [
451
+ e("div", kt, [
452
+ e("div", $t, [
453
+ (l(!0), m(Y, null, q(b(n), (s) => (l(), m("div", {
454
+ key: s.hour,
455
+ class: "flex-1 flex transition-all duration-200"
456
+ }, [...r[0] || (r[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", Tt, [
463
+ e("div", St, [
464
+ (l(!0), m(Y, null, q(I.value, (s) => (l(), m("div", {
465
+ key: s.id,
466
+ style: J({
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.value?.openDialog(s)
473
+ }, [
474
+ e("div", {
475
+ style: J({ backgroundColor: s.color }),
476
+ class: "absolute inset-0 shadow-lg"
477
+ }, [
478
+ s.maxBookings ? (l(), m("div", Ct, [
479
+ e("div", {
480
+ class: "h-full bg-white/40 transition-all duration-300",
481
+ style: J({ width: `${s.fillPercentage}%` })
482
+ }, null, 4)
483
+ ])) : z("", !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", Mt, [
489
+ e("h3", zt, v(s.title), 1),
490
+ e("div", Et, [
491
+ s.resource ? (l(), m("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, It)) : z("", !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", Bt, v(s.startTime) + " – " + v(s.endTime), 1)
515
+ ], 2)
516
+ ], 2)
517
+ ], 2),
518
+ r[1] || (r[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, Dt))), 128))
520
+ ])
521
+ ])
522
+ ])
523
+ ]),
524
+ d(_t, {
525
+ resources: f.resources,
526
+ ref_key: "eventDialog",
527
+ ref: w
528
+ }, null, 8, ["resources"])
529
+ ], 64));
530
+ }
531
+ }), Lt = { class: "sticky left-0 mt-auto z-10 divide-y divide-border/50 h-full flex flex-col min-h-[1536px] bg-input" }, Ut = { class: "flex-shrink-0 text-xs font-medium text-muted-foreground px-3 pb-3 border-r border-border/50 w-14" }, Ot = { class: "flex items-center gap-1.5" }, _e = /* @__PURE__ */ K({
532
+ __name: "Event24hSidebar",
533
+ setup(f) {
534
+ const k = Array.from({ length: 24 }, (w, S) => ({
535
+ hour: S,
536
+ label: `${S.toString().padStart(2, "0")}:00`
537
+ }));
538
+ return (w, S) => (l(), m("div", Lt, [
539
+ (l(!0), m(Y, null, q(b(k), (I) => (l(), m("div", {
540
+ key: I.hour,
541
+ class: "flex-1 flex transition-all duration-200"
542
+ }, [
543
+ e("div", Ut, [
544
+ e("div", Ot, [
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
+ }), jt = { class: "absolute top-0 w-full pointer-events-none" }, Pt = {
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
+ }, we = /* @__PURE__ */ K({
557
+ __name: "EventTimeIndicator",
558
+ props: {
559
+ currentDate: {
560
+ type: Object,
561
+ required: !1
562
+ }
563
+ },
564
+ setup(f) {
565
+ const k = T(Date.now());
566
+ let w;
567
+ fe(() => {
568
+ w = window.setInterval(() => {
569
+ k.value = Date.now();
570
+ }, 1e3);
571
+ }), pe(() => {
572
+ w && clearInterval(w);
573
+ });
574
+ const S = j(() => {
575
+ const n = new Date(k.value);
576
+ return `${(n.getHours() * 60 + n.getMinutes() + n.getSeconds() / 60) / 1440 * 100}%`;
577
+ }), I = j(() => 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 (n, u) => (l(), m("div", jt, [
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: J({ top: S.value })
582
+ }, [
583
+ 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)),
584
+ f.currentDate && f.currentDate == I.value ? (l(), m("div", Pt, " Now ")) : z("", !0)
585
+ ], 4)
586
+ ]));
587
+ }
588
+ }), Nt = {
589
+ key: 0,
590
+ class: "relative flex flex-1 min-w-0"
591
+ }, Rt = {
592
+ key: 1,
593
+ class: "flex-1 min-w-0 relative"
594
+ }, Ft = {
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
+ }, At = { class: "flex pb-4 min-w-[200px]" }, Vt = ["onClick"], Wt = {
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
+ }, Ht = { class: "text-xs text-muted-foreground font-medium group-hover:text-foreground/70 transition-colors" }, Qt = {
601
+ key: 0,
602
+ class: "absolute bottom-0 left-0 w-full h-1 bg-orange-500"
603
+ }, Xt = /* @__PURE__ */ K({
604
+ __name: "EventView",
605
+ setup(f) {
606
+ const k = ie("activeDate", T(ue(de()))), w = ie("viewMode", T(1)), S = ie("events", T([])), I = ie("resources", T([])), n = T(null), u = T(!1), r = T(!1);
607
+ j(() => I.value.length > 1);
608
+ const s = j(() => {
609
+ const c = [], g = k.value;
610
+ for (let E = 0; E < w.value; E++)
611
+ c.push(g.add({ days: E }));
612
+ return c;
613
+ }), $ = (c, g) => {
614
+ const E = `${c.year}-${String(c.month).padStart(2, "0")}-${String(c.day).padStart(2, "0")}`;
615
+ return S.value?.filter((V) => V.date === E) || [];
616
+ }, y = (c) => {
617
+ const g = ue(de());
618
+ return c.year === g.year && c.month === g.month && c.day === g.day;
619
+ }, p = (c) => {
620
+ k.value = c, w.value = 1;
621
+ };
622
+ let B = null, D = null;
623
+ const Q = () => {
624
+ n.value && (U(), n.value.scrollBy({ left: -300, behavior: "smooth" }), D = window.setTimeout(() => {
625
+ B = window.setInterval(() => {
626
+ n.value && n.value.scrollBy({ left: -20, behavior: "auto" });
627
+ }, 50);
628
+ }, 300));
629
+ }, L = () => {
630
+ n.value && (U(), n.value.scrollBy({ left: 300, behavior: "smooth" }), D = window.setTimeout(() => {
631
+ B = window.setInterval(() => {
632
+ n.value && n.value.scrollBy({ left: 20, behavior: "auto" });
633
+ }, 50);
634
+ }, 300));
635
+ }, U = () => {
636
+ D && (clearTimeout(D), D = null), B && (clearInterval(B), B = null);
637
+ }, A = () => {
638
+ if (!n.value) return;
639
+ const { scrollLeft: c, scrollWidth: g, clientWidth: E } = n.value;
640
+ u.value = c > 10, r.value = c < g - E - 10;
641
+ }, te = (c) => {
642
+ n.value && Math.abs(c.deltaY) > Math.abs(c.deltaX) && (c.preventDefault(), n.value.scrollBy({ left: c.deltaY, behavior: "auto" }));
643
+ }, G = T(!1), Z = T(0), se = T(0), ae = (c) => {
644
+ !n.value || w.value === 1 || c.target.closest(".event-card") || (G.value = !0, Z.value = c.pageX, se.value = n.value.scrollLeft, n.value.style.userSelect = "none", c.preventDefault());
645
+ }, h = (c) => {
646
+ if (!G.value || !n.value) return;
647
+ const g = c.pageX, E = (Z.value - g) * 1.2;
648
+ n.value.scrollLeft = se.value + E;
649
+ }, _ = () => {
650
+ n.value && (G.value = !1, n.value.style.userSelect = "");
651
+ };
652
+ return fe(() => {
653
+ n.value && (n.value.addEventListener("scroll", A), n.value.addEventListener("wheel", te, { passive: !1 }), xe(() => {
654
+ A(), setTimeout(A, 50), setTimeout(A, 150), setTimeout(A, 300), setTimeout(A, 500);
655
+ })), document.addEventListener("mousemove", h), document.addEventListener("mouseup", _);
656
+ }), ze(() => {
657
+ document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", _);
658
+ }), re(w, () => {
659
+ w.value > 1 ? xe(() => {
660
+ setTimeout(() => {
661
+ if (!n.value) return;
662
+ const { scrollWidth: c, clientWidth: g } = n.value;
663
+ c > g && (r.value = !0, u.value = !1);
664
+ }, 100);
665
+ }) : n.value && (n.value.style.cursor = "");
666
+ }), pe(() => {
667
+ U(), n.value && (n.value.removeEventListener("scroll", A), n.value.removeEventListener("wheel", te));
668
+ }), (c, g) => {
669
+ const E = N("Button"), V = N("TooltipTrigger"), O = N("TooltipContent"), F = N("Tooltip");
670
+ return b(w) === 1 ? (l(), m("div", Nt, [
671
+ d(_e),
672
+ d(we, {
673
+ class: "h-full",
674
+ "current-date": b(k)
675
+ }, null, 8, ["current-date"]),
676
+ d(ye, {
677
+ date: b(k),
678
+ events: $(b(k)),
679
+ resources: b(I)
680
+ }, null, 8, ["date", "events", "resources"])
681
+ ])) : (l(), m("div", Rt, [
682
+ b(w) === 7 ? (l(), m("div", Ft, [
683
+ d(b(ve), { size: 12 }),
684
+ g[0] || (g[0] = e("span", null, "Scroll to view all days", -1)),
685
+ d(b(ce), { size: 12 })
686
+ ])) : z("", !0),
687
+ u.value ? (l(), H(E, {
688
+ key: 1,
689
+ variant: "outline",
690
+ size: "icon",
691
+ onMousedown: Q,
692
+ onMouseup: U,
693
+ onMouseleave: U,
694
+ onTouchstart: Q,
695
+ onTouchend: U,
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: C(() => [
699
+ d(b(ve), { size: 20 })
700
+ ]),
701
+ _: 1
702
+ })) : z("", !0),
703
+ r.value ? (l(), H(E, {
704
+ key: 2,
705
+ variant: "outline",
706
+ size: "icon",
707
+ onMousedown: L,
708
+ onMouseup: U,
709
+ onMouseleave: U,
710
+ onTouchstart: L,
711
+ onTouchend: U,
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: C(() => [
715
+ d(b(ce), { size: 20 })
716
+ ]),
717
+ _: 1
718
+ })) : z("", !0),
719
+ d(we, { 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", r.value ? "opacity-100" : "opacity-0"])
722
+ }, null, 2),
723
+ e("div", {
724
+ ref_key: "scrollContainer",
725
+ ref: n,
726
+ class: "absolute inset-0 overflow-x-auto overflow-y-visible",
727
+ onScroll: A,
728
+ onMousedown: ae
729
+ }, [
730
+ e("div", At, [
731
+ d(_e),
732
+ g[5] || (g[5] = e("div", { class: "absolute w-14 h-[125px] bg-input" }, null, -1)),
733
+ (l(!0), m(Y, null, q(s.value, (t, o) => (l(), m("div", {
734
+ key: t.toString(),
735
+ class: R(["flex-shrink-0", { "min-w-[200px] w-[33.33%]": b(w) === 3, "min-w-[280px]": b(w) === 7 }])
736
+ }, [
737
+ e("div", {
738
+ onClick: (x) => p(t),
739
+ class: R([
740
+ "relative p-3 border cursor-pointer transition-all duration-200 group relative",
741
+ y(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
+ y(t) ? (l(), m("div", Wt, [...g[1] || (g[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
+ ])])) : z("", !0),
748
+ e("div", {
749
+ class: R([
750
+ "text-xs font-semibold uppercase tracking-wider transition-colors",
751
+ y(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
+ y(t) ? "text-foreground" : "text-foreground group-hover:text-primary"
758
+ ])
759
+ }, v(t.day), 3),
760
+ e("div", Ht, v(new Date(t.year, t.month - 1, t.day).toLocaleDateString("en-US", { month: "long", year: "numeric" })), 1),
761
+ g[4] || (g[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(F, null, {
765
+ default: C(() => [
766
+ d(V, { "as-child": "" }, {
767
+ default: C(() => [
768
+ $(t).filter((x) => x.isException).length > 0 ? (l(), H(b(Ie), {
769
+ key: 0,
770
+ class: "absolute top-3 right-3 size-4 text-orange-500"
771
+ })) : z("", !0)
772
+ ]),
773
+ _: 2
774
+ }, 1024),
775
+ d(O, null, {
776
+ default: C(() => [...g[2] || (g[2] = [
777
+ e("p", null, " This day has exceptions applied to it. ", -1)
778
+ ])]),
779
+ _: 1
780
+ })
781
+ ]),
782
+ _: 2
783
+ }, 1024),
784
+ d(F, null, {
785
+ default: C(() => [
786
+ d(V, { "as-child": "" }, {
787
+ default: C(() => [
788
+ $(t).filter((x) => x.isException).length > 0 ? (l(), m("div", Qt)) : z("", !0)
789
+ ]),
790
+ _: 2
791
+ }, 1024),
792
+ d(O, null, {
793
+ default: C(() => [...g[3] || (g[3] = [
794
+ e("p", null, " This day has exceptions applied to it. ", -1)
795
+ ])]),
796
+ _: 1
797
+ })
798
+ ]),
799
+ _: 2
800
+ }, 1024)
801
+ ], 10, Vt),
802
+ d(ye, {
803
+ date: t,
804
+ events: $(t),
805
+ resources: b(I)
806
+ }, null, 8, ["date", "events", "resources"])
807
+ ], 2))), 128))
808
+ ])
809
+ ], 544)
810
+ ]));
811
+ };
812
+ }
813
+ }), Yt = /* @__PURE__ */ Pe(Xt, [["__scopeId", "data-v-99339cf2"]]), qt = { class: "flex flex-col gap-2 md:gap-4 w-full h-full" }, Jt = { class: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3 px-1" }, Gt = { class: "flex items-center justify-between sm:justify-start gap-4" }, Kt = { class: "flex flex-col" }, Zt = { class: "flex items-center gap-2" }, es = { class: "text-lg sm:text-2xl font-bold tracking-tight truncate" }, ts = { class: "text-xs sm:text-sm text-muted-foreground ml-7 truncate" }, ss = { class: "flex items-center justify-between sm:justify-end gap-2" }, os = { class: "flex items-center gap-1 sm:mr-2" }, ns = {
814
+ key: 0,
815
+ class: "flex items-center gap-2 px-1 overflow-x-auto pb-2 -mx-1 scrollbar-hide"
816
+ }, as = ["onClick"], ls = { class: "flex gap-4 flex-1 min-h-0 md:min-h-[1700px]" }, rs = { class: "hidden md:flex flex-shrink-0 flex-col gap-4" }, is = {
817
+ key: 0,
818
+ class: "rounded-md border p-3"
819
+ }, us = { class: "space-y-1" }, ds = ["onClick"], cs = { class: "min-w-0 flex-1" }, ms = { class: "text-sm font-medium truncate" }, vs = {
820
+ key: 0,
821
+ class: "pt-2 mt-2 border-t"
822
+ }, fs = {
823
+ key: 0,
824
+ class: "mt-1 space-y-1"
825
+ }, ps = { class: "min-w-0 flex-1" }, gs = { class: "text-sm font-medium truncate text-muted-foreground" }, Ts = /* @__PURE__ */ K({
826
+ __name: "agenda",
827
+ setup(f) {
828
+ const { hasPermission: k } = Ue(), { params: w } = Te(), { config: S } = $e(), I = Se(S.project), n = T(ue(de())), u = T(1), r = T(typeof window < "u" ? window.innerWidth : 1024), s = j(() => r.value < 768), $ = () => {
829
+ r.value = window.innerWidth;
830
+ };
831
+ fe(() => {
832
+ window.addEventListener("resize", $);
833
+ }), pe(() => {
834
+ window.removeEventListener("resize", $);
835
+ }), re(s, (t) => {
836
+ t && u.value !== 1 && (u.value = 1);
837
+ }, { immediate: !0 });
838
+ const y = T(null), p = T(/* @__PURE__ */ new Map()), B = j(() => y.value?.resources || []), D = j(() => B.value.filter((t) => t.isActive)), Q = j(() => B.value.filter((t) => !t.isActive)), L = T(null), U = T(!1);
839
+ re(D, (t) => {
840
+ t.length > 0 && !L.value && (L.value = t[0].id);
841
+ }, { immediate: !0 });
842
+ const A = j(() => {
843
+ if (!L.value)
844
+ return D.value.length > 0 ? [D.value[0]] : [];
845
+ const t = D.value.find((o) => o.id === L.value);
846
+ return t ? [t] : D.value.length > 0 ? [D.value[0]] : [];
847
+ }), te = j(() => y.value?.pricingOptions?.find((o) => o.isDefault)?.duration || 30), G = (t) => {
848
+ L.value = t;
849
+ };
850
+ re(n, () => {
851
+ F();
852
+ });
853
+ const Z = j(() => {
854
+ const t = n.value, o = new Date(t.year, t.month - 1, t.day), x = o.toLocaleDateString("en-US", { weekday: "long" }).toUpperCase(), i = t.day, M = o.toLocaleDateString("en-US", { month: "short" }).toUpperCase();
855
+ return {
856
+ dayName: x,
857
+ day: i,
858
+ monthName: M,
859
+ full: `${x} ${i} ${M}`
860
+ };
861
+ }), se = () => {
862
+ n.value = n.value.subtract({ days: u.value });
863
+ }, ae = () => {
864
+ n.value = n.value.add({ days: u.value });
865
+ }, h = () => {
866
+ n.value = ue(de());
867
+ }, _ = (t) => {
868
+ const [o, x] = t.split(":").map(Number);
869
+ return o * 60 + x;
870
+ }, c = (t, o) => (y.value?.exceptions || []).find((i) => o >= i.startDate && o <= i.endDate ? i.resourceIds === null ? !0 : i.resourceIds?.includes(t) : !1) || null, g = (t, o, x) => {
871
+ const i = c(t.id, x);
872
+ if (i)
873
+ return i.isClosed ? [] : i.timeslots.map((a) => ({
874
+ startTime: a.startTime,
875
+ endTime: a.endTime,
876
+ isException: !0
877
+ }));
878
+ const M = o.getDay(), P = t.openingHours?.[M] || [];
879
+ return P.length === 0 ? [] : P.map((a) => ({
880
+ startTime: a.start,
881
+ endTime: a.end,
882
+ isException: !1
883
+ }));
884
+ }, E = (t, o, x, i) => {
885
+ if (!y.value) return 0;
886
+ const M = p.value.get(o);
887
+ if (!M) return 0;
888
+ const P = M.filter((a) => a.resourceId === t).reduce((a, W) => {
889
+ const X = _(W.startTime), oe = _(W.endTime), le = _(x), me = _(i);
890
+ return X < me && oe > le ? a + (W.reserved || 0) : a;
891
+ }, 0);
892
+ return P > 0 && console.log(`Found ${P} total bookings for ${t} on ${o} ${x}-${i}`), P;
893
+ }, V = j(() => {
894
+ if (!y.value) return [];
895
+ p.value.size;
896
+ let t = [], o = [];
897
+ for (let i = 0; i < u.value; i++) {
898
+ const M = n.value.add({ days: i });
899
+ o.push(M);
900
+ }
901
+ const x = A.value.length > 0 ? A.value : [];
902
+ return x.length === 0 ? [] : (o.forEach((i) => {
903
+ let M = new Date(i.year, i.month - 1, i.day);
904
+ const P = `${i.year}-${String(i.month).padStart(2, "0")}-${String(i.day).padStart(2, "0")}`;
905
+ x.forEach((a) => {
906
+ const W = g(a, M, P);
907
+ t = t.concat(W.map((X, oe) => {
908
+ const le = E(a.id, P, X.startTime, X.endTime);
909
+ return {
910
+ id: `block-${P}-${a.id}-${oe}`,
911
+ title: y.value.serviceName,
912
+ date: P,
913
+ startTime: X.startTime,
914
+ endTime: X.endTime,
915
+ theme: a.color || "#3b82f6",
916
+ bookings: le,
917
+ maxBookings: a.capacity,
918
+ isException: X.isException || !1,
919
+ resourceId: a.id,
920
+ resource: a,
921
+ // Store interval and duration for booking slot calculation
922
+ interval: a.interval || 30,
923
+ serviceDuration: te.value
924
+ };
925
+ }));
926
+ });
927
+ }), t);
928
+ }), O = async () => {
929
+ y.value = await I.get(S.agendaCollection, w.value.id);
930
+ }, F = async () => {
931
+ const t = w.value.id, o = n.value;
932
+ p.value.clear();
933
+ const x = [];
934
+ for (let i = 0; i < u.value; i++) {
935
+ const M = o.add({ days: i }), P = `${M.year}-${String(M.month).padStart(2, "0")}-${String(M.day).padStart(2, "0")}`, a = `${t}_${P}`;
936
+ x.push(
937
+ I.get(S.reservedSpotsCollection, a).then((W) => {
938
+ if (W) {
939
+ let X = [];
940
+ for (const oe of D.value) {
941
+ const le = W?.[oe.id] || {};
942
+ Object.entries(le).forEach(([me, De]) => {
943
+ const [Ce, Me] = me.split("-");
944
+ X.push({
945
+ resourceId: oe.id,
946
+ startTime: Ce,
947
+ endTime: Me,
948
+ reserved: De
949
+ });
950
+ });
951
+ }
952
+ p.value.set(P, X);
953
+ }
954
+ }).catch(() => {
955
+ })
956
+ );
957
+ }
958
+ await Promise.all(x), console.log("Loaded reserved spots:", p.value);
959
+ };
960
+ return O(), F(), re(u, () => {
961
+ F();
962
+ }), ee("agendaData", y), ee("activeDate", n), ee("viewMode", u), ee("events", V), ee("resources", A), ee("allResources", D), (t, o) => {
963
+ const x = N("Button"), i = N("SegmentedControlButton"), M = N("SegmentedControl"), P = N("Calendar");
964
+ return l(), H(Le, null, {
965
+ default: C(() => [
966
+ e("div", qt, [
967
+ e("div", Jt, [
968
+ e("div", Gt, [
969
+ e("div", Kt, [
970
+ e("div", Zt, [
971
+ d(b(Be), {
972
+ size: 20,
973
+ class: "text-primary flex-shrink-0"
974
+ }),
975
+ e("h2", es, v(Z.value.full), 1)
976
+ ]),
977
+ e("p", ts, v(y.value?.serviceName), 1)
978
+ ]),
979
+ s.value && b(k)("manage-reservations") ? (l(), H(be, { key: 0 })) : z("", !0)
980
+ ]),
981
+ e("div", ss, [
982
+ e("div", os, [
983
+ d(x, {
984
+ variant: "outline",
985
+ size: "icon",
986
+ class: "size-8 sm:size-9",
987
+ onClick: se
988
+ }, {
989
+ default: C(() => [
990
+ d(b(ve), { size: 16 })
991
+ ]),
992
+ _: 1
993
+ }),
994
+ d(x, {
995
+ variant: "outline",
996
+ size: "sm",
997
+ class: "h-8 sm:h-9 px-2 sm:px-3 text-xs sm:text-sm",
998
+ onClick: h
999
+ }, {
1000
+ default: C(() => [...o[3] || (o[3] = [
1001
+ ne(" Today ", -1)
1002
+ ])]),
1003
+ _: 1
1004
+ }),
1005
+ d(x, {
1006
+ variant: "outline",
1007
+ size: "icon",
1008
+ class: "size-8 sm:size-9",
1009
+ onClick: ae
1010
+ }, {
1011
+ default: C(() => [
1012
+ d(b(ce), { size: 16 })
1013
+ ]),
1014
+ _: 1
1015
+ })
1016
+ ]),
1017
+ s.value ? z("", !0) : (l(), H(M, {
1018
+ key: 0,
1019
+ modelValue: u.value,
1020
+ "onUpdate:modelValue": o[0] || (o[0] = (a) => u.value = a)
1021
+ }, {
1022
+ default: C(() => [
1023
+ d(i, { value: 1 }, {
1024
+ default: C(() => [...o[4] || (o[4] = [
1025
+ e("span", { class: "whitespace-nowrap" }, "1 Day", -1)
1026
+ ])]),
1027
+ _: 1
1028
+ }),
1029
+ d(i, { value: 3 }, {
1030
+ default: C(() => [...o[5] || (o[5] = [
1031
+ e("span", { class: "whitespace-nowrap" }, "3 Days", -1)
1032
+ ])]),
1033
+ _: 1
1034
+ }),
1035
+ d(i, { value: 7 }, {
1036
+ default: C(() => [...o[6] || (o[6] = [
1037
+ e("span", { class: "whitespace-nowrap" }, "7 Days", -1)
1038
+ ])]),
1039
+ _: 1
1040
+ })
1041
+ ]),
1042
+ _: 1
1043
+ }, 8, ["modelValue"])),
1044
+ !s.value && b(k)("manage-reservations") ? (l(), H(be, { key: 1 })) : z("", !0)
1045
+ ])
1046
+ ]),
1047
+ s.value && D.value.length > 0 ? (l(), m("div", ns, [
1048
+ (l(!0), m(Y, null, q(D.value, (a) => (l(), m("button", {
1049
+ key: a.id,
1050
+ class: R(["flex items-center gap-2 px-3 py-1.5 rounded-full border text-sm whitespace-nowrap transition-colors flex-shrink-0", {
1051
+ "bg-primary text-primary-foreground border-primary": L.value === a.id,
1052
+ "bg-background hover:bg-muted": L.value !== a.id
1053
+ }]),
1054
+ onClick: (W) => G(a.id)
1055
+ }, [
1056
+ e("div", {
1057
+ class: "size-5 rounded-full flex items-center justify-center text-white text-[10px] font-medium",
1058
+ style: J({ backgroundColor: L.value === a.id ? "rgba(255,255,255,0.3)" : a.color || "#6b7280" })
1059
+ }, v(a.avatarLabel || a.name.charAt(0).toUpperCase()), 5),
1060
+ e("span", null, v(a.name), 1)
1061
+ ], 10, as))), 128))
1062
+ ])) : z("", !0),
1063
+ e("div", ls, [
1064
+ e("div", rs, [
1065
+ d(P, {
1066
+ modelValue: n.value,
1067
+ "onUpdate:modelValue": o[1] || (o[1] = (a) => n.value = a),
1068
+ "weekday-format": "short",
1069
+ class: "rounded-md border"
1070
+ }, null, 8, ["modelValue"]),
1071
+ B.value.length > 0 ? (l(), m("div", is, [
1072
+ o[7] || (o[7] = e("div", { class: "flex items-center justify-between mb-3" }, [
1073
+ e("span", { class: "text-sm font-medium" }, "Resources")
1074
+ ], -1)),
1075
+ e("div", us, [
1076
+ (l(!0), m(Y, null, q(D.value, (a) => (l(), m("div", {
1077
+ key: a.id,
1078
+ class: R(["flex items-center gap-2 p-2 rounded-md hover:bg-muted cursor-pointer transition-colors", {
1079
+ "bg-muted ring-2 ring-primary/20": L.value === a.id,
1080
+ "opacity-50": L.value && L.value !== a.id
1081
+ }]),
1082
+ onClick: (W) => G(a.id)
1083
+ }, [
1084
+ e("div", {
1085
+ class: "size-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",
1086
+ style: J({ backgroundColor: a.color || "#6b7280" })
1087
+ }, v(a.avatarLabel || a.name.charAt(0).toUpperCase()), 5),
1088
+ e("div", cs, [
1089
+ e("div", ms, v(a.name), 1)
1090
+ ]),
1091
+ e("div", {
1092
+ class: R(["size-2 rounded-full flex-shrink-0", L.value === a.id ? "bg-primary" : "bg-muted-foreground/30"])
1093
+ }, null, 2)
1094
+ ], 10, ds))), 128)),
1095
+ Q.value.length > 0 ? (l(), m("div", vs, [
1096
+ e("button", {
1097
+ class: "flex items-center gap-2 text-xs text-muted-foreground hover:text-foreground w-full py-1 transition-colors",
1098
+ onClick: o[2] || (o[2] = (a) => U.value = !U.value)
1099
+ }, [
1100
+ d(b(ce), {
1101
+ size: 14,
1102
+ class: R(["transition-transform", { "rotate-90": U.value }])
1103
+ }, null, 8, ["class"]),
1104
+ e("span", null, "Inactive (" + v(Q.value.length) + ")", 1)
1105
+ ]),
1106
+ U.value ? (l(), m("div", fs, [
1107
+ (l(!0), m(Y, null, q(Q.value, (a) => (l(), m("div", {
1108
+ key: a.id,
1109
+ class: "flex items-center gap-2 p-2 rounded-md opacity-50"
1110
+ }, [
1111
+ e("div", {
1112
+ class: "size-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0 grayscale",
1113
+ style: J({ backgroundColor: a.color || "#6b7280" })
1114
+ }, v(a.avatarLabel || a.name.charAt(0).toUpperCase()), 5),
1115
+ e("div", ps, [
1116
+ e("div", gs, v(a.name), 1)
1117
+ ])
1118
+ ]))), 128))
1119
+ ])) : z("", !0)
1120
+ ])) : z("", !0)
1121
+ ])
1122
+ ])) : z("", !0)
1123
+ ]),
1124
+ d(Yt)
1125
+ ])
1126
+ ])
1127
+ ]),
1128
+ _: 1
1129
+ });
1130
+ };
1131
+ }
1132
+ });
1133
+ export {
1134
+ Ts as default
1135
+ };