@oneclick.dev/cms-core-modules 0.0.115 → 0.0.116

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 (87) hide show
  1. package/dist/{ContentEditor-MctMvN7D.js → ContentEditor-CsbOFg3a.js} +52 -52
  2. package/dist/{ContentEditor-C5yNNLeV.mjs → ContentEditor-Df5uWpVC.mjs} +10337 -8677
  3. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-gozJKXvM.js +1 -0
  4. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-pDO9b4Pv.mjs +77 -0
  5. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BHeMJ6nr.mjs +1476 -0
  6. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-C2zwt5UF.js +1 -0
  7. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-BYSeUW_V.js +925 -0
  8. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-DwAUYR8p.mjs +5021 -0
  9. package/dist/Overview-CBahJviK.js +1 -0
  10. package/dist/Overview-CVQ1pkuD.mjs +527 -0
  11. package/dist/TableView-Csv5Lycy.mjs +6234 -0
  12. package/dist/TableView-Cwal0BPW.js +4 -0
  13. package/dist/agenda-BSdlrfxv.mjs +1253 -0
  14. package/dist/agenda-Bev1mO7E.js +1 -0
  15. package/dist/availability-ClBGVgE9.js +1 -0
  16. package/dist/availability-D8JdA4rP.mjs +274 -0
  17. package/dist/booking-data-Px7XCIfU.mjs +1024 -0
  18. package/dist/booking-data-aMS1p_3g.js +1 -0
  19. package/dist/cms-core-modules.css +1 -1
  20. package/dist/exceptions-CqityDo9.mjs +651 -0
  21. package/dist/exceptions-DXqc0Nza.js +1 -0
  22. package/dist/index-CM4eaK5T.mjs +1245 -0
  23. package/dist/index-DliTZzwI.js +35 -0
  24. package/dist/index.cjs.js +1 -1
  25. package/dist/index.mjs +12 -11
  26. package/dist/orders-1swJVKw2.js +1 -0
  27. package/dist/orders-D41GbzIa.mjs +624 -0
  28. package/dist/payment-BJHgpaeT.js +1 -0
  29. package/dist/payment-D5j-68Ig.mjs +1278 -0
  30. package/dist/refunds-D9nTeD2d.mjs +436 -0
  31. package/dist/refunds-oVB2Opib.js +1 -0
  32. package/dist/resources-8WouFvJe.js +1 -0
  33. package/dist/resources-B-D5MUhV.mjs +975 -0
  34. package/dist/server-handlers.cjs.js +1 -1
  35. package/dist/server-handlers.mjs +626 -515
  36. package/dist/src/appointments/components/edit/EventDialog/BookingsList.vue.d.ts +146 -5
  37. package/dist/src/appointments/components/edit/EventDialog/CancelRefundReservationDialog.vue.d.ts +33 -0
  38. package/dist/src/appointments/components/edit/EventDialog/OrderDetailDialog.vue.d.ts +26 -8
  39. package/dist/src/appointments/components/edit/EventDialog/RefundDetailsDisplay.vue.d.ts +8 -0
  40. package/dist/src/appointments/components/edit/EventDialog/ReservationDetailDialog.vue.d.ts +91 -5
  41. package/dist/src/appointments/components/edit/EventDialog/TransferReservationDialog.vue.d.ts +20 -3
  42. package/dist/src/appointments/components/edit/NewReservationDialog/ReservationLines.vue.d.ts +5 -0
  43. package/dist/src/appointments/components/edit/OrderMetadataDisplay.vue.d.ts +20 -2
  44. package/dist/src/appointments/components/edit/dashboard/BookingsList.vue.d.ts +240 -0
  45. package/dist/src/appointments/composables/useAgendaMetadataSchema.d.ts +37 -0
  46. package/dist/src/appointments/pages/edit/orders.vue.d.ts +225 -0
  47. package/dist/src/appointments/pages/edit/refunds.vue.d.ts +2 -0
  48. package/dist/src/appointments/server.d.ts +2 -0
  49. package/dist/src/appointments/types.d.ts +6 -0
  50. package/dist/src/appointments/utils/printReservation.d.ts +65 -3
  51. package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/Table.d.ts +36 -0
  52. package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/Table.vue.d.ts +95 -0
  53. package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/TableCell.d.ts +13 -0
  54. package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/TableHeader.d.ts +6 -0
  55. package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/TableRow.d.ts +6 -0
  56. package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/index.d.ts +4 -0
  57. package/dist/src/contentManager/components/content-editor/tiptap-menus/element-editor-views/TableMenu.vue.d.ts +13 -0
  58. package/dist/src/contentManager/components/content-editor/tiptap-menus/element-editor-views/index.d.ts +14 -0
  59. package/package.json +2 -2
  60. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-DWMqQvHl.mjs +0 -76
  61. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-kpjbVSXg.js +0 -1
  62. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-Baqy-rTT.js +0 -1
  63. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-Dx4Bpa2m.mjs +0 -1263
  64. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-COrK1j0S.js +0 -1
  65. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-Vb3q8EVv.mjs +0 -330
  66. package/dist/Overview-98nkJUWN.mjs +0 -481
  67. package/dist/Overview-Dl8cMlsr.js +0 -1
  68. package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-CuwREvXD.js +0 -349
  69. package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-GYNZ_yhD.mjs +0 -3077
  70. package/dist/TableView-CVfkyj1k.js +0 -4
  71. package/dist/TableView-zDx0IegJ.mjs +0 -6096
  72. package/dist/agenda-BaJu3-1c.js +0 -1
  73. package/dist/agenda-BwVY_8oM.mjs +0 -1165
  74. package/dist/availability-CMrRa5y2.mjs +0 -269
  75. package/dist/availability-Cf2YfMwM.js +0 -1
  76. package/dist/booking-data-DgJd0BcM.mjs +0 -889
  77. package/dist/booking-data-Di5GmH_8.js +0 -1
  78. package/dist/exceptions-B6P9UiCj.js +0 -1
  79. package/dist/exceptions-De9-FvdP.mjs +0 -646
  80. package/dist/index-DL6orwdK.js +0 -35
  81. package/dist/index-hH3e-IYz.mjs +0 -1187
  82. package/dist/orders-C65SlpJy.mjs +0 -618
  83. package/dist/orders-XVzWAgG1.js +0 -1
  84. package/dist/payment-C3ohkehF.mjs +0 -1080
  85. package/dist/payment-Dfr-Ro-a.js +0 -1
  86. package/dist/resources-CxeFd57z.js +0 -1
  87. package/dist/resources-DwYxn2Vi.mjs +0 -811
@@ -1,1187 +0,0 @@
1
- import { defineComponent as ce, inject as We, computed as N, ref as z, onMounted as Fe, nextTick as je, onUnmounted as Le, watch as Q, openBlock as v, createElementBlock as T, resolveComponent as V, withModifiers as Ge, createElementVNode as l, Fragment as ie, createVNode as d, unref as e, normalizeStyle as ve, toDisplayString as A, createCommentVNode as K, createBlock as F, isRef as se, withCtx as k, createTextVNode as Z, renderList as he, normalizeClass as re, withDirectives as He, vModelText as Ue, provide as qe } from "vue";
2
- import { useModuleRoute as _e, useModule as De, useFirebaseIntegration as Se, useModulePermissions as Ye } from "@oneclick.dev/cms-kit";
3
- import { _ as Xe } from "./EditLayout.vue_vue_type_script_setup_true_lang-DWMqQvHl.mjs";
4
- import { l as xe, D as Je, I as Qe, v as le, Q as ye, O as Ke, M as we, z as Ce, Z as de, q as $e, J as Ze, t as et, s as tt, r as at, j as st, R as ot, N as nt, n as rt } from "./index-CkVwMqpn.mjs";
5
- import { componentToString as Me, ChartTooltipContent as Re } from "@oneclick.dev/cms-kit/charts";
6
- import { Layers as be, ChevronDown as it, ChevronLeft as lt, ChevronRight as dt, CalendarIcon as ct, Users as Ve, RefreshCw as ut, Search as mt, X as pt, Clock as ft } from "lucide-vue-next";
7
- import { a as vt } from "./index-CFzn2Lus.mjs";
8
- import { b as gt, a as Ae, X as ht, c as xt, r as yt, D as pe, $ as Ie, O as fe, z as Te, A as Ee } from "./index-BIF2RB7k.mjs";
9
- import { _ as bt } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
10
- import { F as kt, _ as _t, a as Dt } from "./ReservationDetailDialog.vue_vue_type_script_setup_true_lang-GYNZ_yhD.mjs";
11
- import { _ as St } from "./OrderDetailDialog.vue_vue_type_script_setup_true_lang-Vb3q8EVv.mjs";
12
- import { _ as wt } from "./NewReservationDialog.vue_vue_type_script_setup_true_lang-Dx4Bpa2m.mjs";
13
- function Ct({ x: g, y: h, w: a, h: x, tl: y = !1, tr: b = !1, bl: _ = !1, br: c = !1, r: n = 0 }) {
14
- let i;
15
- i = `M${g + n},${h}h${a - 2 * n}`;
16
- let s = b ? n : 0, u = b ? 0 : n;
17
- return i += `a${s},${s} 0 0 1 ${s},${s}`, i += `h${u}v${u}`, i += `v${x - 2 * n}`, s = c ? n : 0, u = c ? 0 : n, i += `a${s},${s} 0 0 1 ${-s},${s}`, i += `v${u}h${-u}`, i += `h${2 * n - a}`, s = _ ? n : 0, u = _ ? 0 : n, i += `a${s},${s} 0 0 1 ${-s},${-s}`, i += `h${-u}v${-u}`, i += `v${2 * n - x}`, s = y ? n : 0, u = y ? 0 : n, i += `a${s},${s} 0 0 1 ${s},${-s}`, i += `v${-u}h${u}`, i += "z", i;
18
- }
19
- const $t = Object.assign(Object.assign({}, gt), { color: void 0, groupMaxWidth: void 0, groupWidth: void 0, dataStep: void 0, groupPadding: 0.05, barPadding: 0, roundedCorners: 2, barMinHeight: 2, cursor: null, orientation: Ae.Vertical }), ze = xe`
20
- label: grouped-bar-component;
21
- `, Mt = Je`
22
- :root {
23
- --vis-grouped-bar-cursor: default;
24
- --vis-grouped-bar-fill-color: var(--vis-color-main);
25
- --vis-grouped-bar-stroke-color: none;
26
- --vis-grouped-bar-stroke-width: 0px;
27
- --vis-grouped-bar-hover-stroke-width: 1px;
28
- --vis-grouped-bar-hover-stroke-color: none;
29
-
30
-
31
- /* Dark Theme */
32
- --vis-dark-grouped-bar-stroke-color: none;
33
- }
34
-
35
- body.theme-dark ${`.${ze}`} {
36
- --vis-grouped-bar-stroke-color: var(--vis-dark-grouped-bar-stroke-color);
37
- }
38
- `, ge = xe`
39
- label: bar;
40
- fill: var(--vis-grouped-bar-fill-color);
41
- stroke: var(--vis-grouped-bar-stroke-color);
42
- stroke-width: var(--vis-grouped-bar-stroke-width);
43
- cursor: var(--vis-grouped-bar-cursor);
44
-
45
- &:hover {
46
- stroke-width: var(--vis-grouped-bar-hover-stroke-width);
47
- stroke: var(--vis-grouped-bar-hover-stroke-color);
48
- }
49
- `, ke = xe`
50
- label: barGroup;
51
- `, Ne = xe`
52
- label: barGroupExit;
53
- `, Rt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
54
- __proto__: null,
55
- bar: ge,
56
- barGroup: ke,
57
- barGroupExit: Ne,
58
- globalStyles: Mt,
59
- root: ze
60
- }, Symbol.toStringTag, { value: "Module" }));
61
- class Be extends ht {
62
- constructor(h) {
63
- super(), this._defaultConfig = $t, this.config = this._defaultConfig, this.getAccessors = () => Qe(this.config.y) ? this.config.y : [this.config.y], this.events = {}, this._barData = [], h && this.setConfig(h);
64
- }
65
- get bleed() {
66
- if (this._barData = this._getVisibleData(), this._barData.length === 0)
67
- return { top: 0, bottom: 0, left: 0, right: 0 };
68
- const h = !this.isVertical() && this.dataScale.range()[0] > this.dataScale.range()[1], a = this.dataScale.domain(), x = this._getGroupWidth() / 2, y = this._barData.map((S, E) => le(S, this.config.x, E)), b = ye(y), _ = Ke(y), c = this.dataScale(b), n = this.dataScale(_), i = this.dataScale.invert(c + (h ? x : -x)), s = this.dataScale.invert(n + (h ? -x : x)), u = i <= a[0] ? this.dataScale(a[0]) - this.dataScale(i) : 0, I = s > a[1] ? this.dataScale(s) - this.dataScale(a[1]) : 0;
69
- return {
70
- top: this.isVertical() ? 0 : h ? -I : u,
71
- bottom: this.isVertical() ? 0 : h ? -u : I,
72
- left: this.isVertical() ? u : 0,
73
- right: this.isVertical() ? I : 0
74
- };
75
- }
76
- get dataScale() {
77
- return this.isVertical() ? this.xScale : this.yScale;
78
- }
79
- get valueScale() {
80
- return this.isVertical() ? this.yScale : this.xScale;
81
- }
82
- isVertical() {
83
- return this.config.orientation === Ae.Vertical;
84
- }
85
- _render(h) {
86
- const { config: a } = this, x = we(h) ? h : a.duration, y = this._getGroupWidth(), b = this.getAccessors(), _ = [-y / 2, y / 2], c = xt().domain(yt(b.length)).range(_).paddingInner(a.barPadding).paddingOuter(a.barPadding), n = this.g.selectAll(`.${ke}`).data(this._barData, (P, j) => {
87
- var M;
88
- return `${(M = Ce(P, a.id, j)) !== null && M !== void 0 ? M : j}`;
89
- }), i = (P, j) => {
90
- const M = this.dataScale(le(P, a.x, j)), U = this.isVertical() ? M : 0, L = this.isVertical() ? 0 : M;
91
- return `translate(${U},${L})`;
92
- }, u = n.enter().append("g").attr("class", ke).attr("transform", i).style("opacity", 1).merge(n);
93
- de(u, x).attr("transform", i).style("opacity", 1);
94
- const I = n.exit().attr("class", Ne);
95
- de(I, x).style("opacity", 0).remove(), de(I.selectAll(`.${ge}`), x).attr("transform", (P, j, M) => this.isVertical() ? `translate(0,${this.yScale(0)}) scale(1,0)` : `translate(${this.xScale(0)},0) scale(0,1)`);
96
- const S = c.bandwidth(), E = u.selectAll(`.${ge}`).data((P) => b.map(() => P)), $ = this._getValueAxisDirection(), ne = E.enter().append("path").attr("class", ge).attr("d", (P, j) => {
97
- const M = c(j), U = this.valueScale(0), L = S;
98
- return this._getBarPath(M, U, L, 0, !1, $);
99
- }).style("fill", (P, j) => $e(P, a.color, j)).merge(E);
100
- de(ne, x).attr("d", (P, j) => {
101
- const M = c(j), U = S, L = le(P, b[j]), f = L < 0;
102
- let q = f ? this.valueScale(0) : this.valueScale(L || 0), oe = Math.abs(this.valueScale(0) - this.valueScale(L)) || 0;
103
- if (oe < a.barMinHeight) {
104
- const X = $ === pe.North ? -1 : 1;
105
- q = this.valueScale(0) + X * a.barMinHeight, oe = a.barMinHeight;
106
- }
107
- return this._getBarPath(M, q, U, oe, f, $);
108
- }).style("fill", (P, j) => $e(P, a.color, j)).style("cursor", (P, j) => Ce(P, a.cursor, j)), de(E.exit(), x).remove();
109
- }
110
- _getValueAxisDirection() {
111
- return this.valueScale.range()[0] > this.valueScale.range()[1] ? pe.North : pe.South;
112
- }
113
- _getVisibleData() {
114
- const { config: h, datamodel: { data: a } } = this, x = this._getGroupWidth(), y = a.length < 2 ? 0 : x / 2, b = this.dataScale, _ = Math.abs(b.invert(y) - b.invert(0));
115
- return a?.filter((n, i) => {
116
- const s = le(n, h.x, i), u = b.domain(), I = +u[0], S = +u[1];
117
- return s >= I - _ && s <= S + _;
118
- });
119
- }
120
- _getBarPath(h, a, x, y, b, _) {
121
- const { config: c } = this, n = c.roundedCorners ? we(c.roundedCorners) ? +c.roundedCorners : x / 2 : 0, i = st(n, 0, Math.min(y, x) / 2), s = _ === pe.North, u = this.isVertical() && b !== s, I = this.isVertical() && b === s, S = !this.isVertical() && b, E = !this.isVertical() && !b;
122
- return Ct({
123
- x: this.isVertical() ? h : a + (s ? 0 : -y),
124
- y: this.isVertical() ? a + (s ? 0 : -y) : h,
125
- w: this.isVertical() ? x : y,
126
- h: this.isVertical() ? y : x,
127
- tl: u || S,
128
- tr: u || E,
129
- bl: I || S,
130
- br: I || E,
131
- r: i
132
- });
133
- }
134
- _getGroupWidth() {
135
- const { config: h, datamodel: { data: a } } = this;
136
- if (Ze(a))
137
- return 0;
138
- if (h.groupWidth)
139
- return ye([h.groupWidth, h.groupMaxWidth]);
140
- const x = this.dataScale.bandwidth, y = this.dataScale.domain ? this.dataScale.domain() : [];
141
- let _ = 1 + (x ? y.length : y[1] - y[0]) / h.dataStep || !x && a.filter((i, s) => {
142
- const u = le(i, h.x, s);
143
- return u >= y[0] && u <= y[1];
144
- }).length || a.length;
145
- !x && _ >= 2 && (_ += 1);
146
- const n = (_ < 2 ? 1 : 1 - h.groupPadding) * (this.isVertical() ? this._width : this._height) / _;
147
- return ye([n, h.groupMaxWidth]);
148
- }
149
- getValueScaleExtent(h) {
150
- const { datamodel: a } = this, x = this.getAccessors(), y = h ? this._getVisibleData() : a.data, b = et(y, ...x), _ = tt(y, ...x);
151
- return [b > 0 ? 0 : b, _ < 0 ? 0 : _];
152
- }
153
- getDataScaleExtent() {
154
- const { config: h, datamodel: a } = this;
155
- return at(a.data, h.x);
156
- }
157
- getYDataExtent(h) {
158
- return this.isVertical() ? this.getValueScaleExtent(h) : this.getDataScaleExtent();
159
- }
160
- getXDataExtent() {
161
- return this.isVertical() ? this.getDataScaleExtent() : this.getValueScaleExtent(!1);
162
- }
163
- }
164
- Be.selectors = Rt;
165
- const Vt = { "data-vis-component": "" }, Oe = /* @__PURE__ */ ce({
166
- __name: "index",
167
- props: {
168
- color: {},
169
- groupWidth: {},
170
- groupMaxWidth: {},
171
- dataStep: {},
172
- groupPadding: {},
173
- barPadding: {},
174
- roundedCorners: { type: [Number, Boolean] },
175
- barMinHeight: {},
176
- cursor: {},
177
- orientation: {},
178
- x: {},
179
- y: {},
180
- id: { type: Function },
181
- xScale: { type: [Object, Function] },
182
- yScale: { type: [Object, Function] },
183
- excludeFromDomainCalculation: { type: Boolean },
184
- duration: {},
185
- events: {},
186
- attributes: {},
187
- data: {}
188
- },
189
- setup(g, { expose: h }) {
190
- const a = We(ot), x = g, y = N(() => a.data.value ?? x.data), b = nt(x), _ = z();
191
- return Fe(() => {
192
- je(() => {
193
- var c;
194
- _.value = new Be(b.value), (c = _.value) == null || c.setData(y.value), a.update(_.value);
195
- });
196
- }), Le(() => {
197
- var c;
198
- (c = _.value) == null || c.destroy(), a.destroy();
199
- }), Q(b, (c, n) => {
200
- var i;
201
- rt(c, n) || (i = _.value) == null || i.setConfig(b.value);
202
- }), Q(y, () => {
203
- var c;
204
- (c = _.value) == null || c.setData(y.value);
205
- }), h({
206
- component: _
207
- }), (c, n) => (v(), T("div", Vt));
208
- }
209
- }), It = { class: "flex flex-col sm:flex-row" }, Tt = ["data-active"], Et = { class: "flex items-center gap-2" }, Ot = { class: "block text-muted-foreground text-xs mr-2 max-w-[120px] truncate" }, Pt = { class: "block text-lg leading-none font-bold sm:text-3xl" }, jt = { class: "mx-auto w-full max-w-sm mt-2 mb-8" }, At = { class: "text-muted-foreground" }, zt = { class: "text-muted-foreground" }, Nt = { class: "grid" }, Bt = { class: "flex gap-1 overflow-hidden max-w-80" }, Wt = { class: "truncate" }, Ft = /* @__PURE__ */ ce({
210
- __name: "ResourceSelector",
211
- props: {
212
- resources: {
213
- type: Array,
214
- required: !0
215
- },
216
- totals: {
217
- type: Object,
218
- required: !0
219
- },
220
- viewMode: {
221
- type: String,
222
- required: !0
223
- },
224
- activeChart: {
225
- type: String,
226
- required: !1
227
- }
228
- },
229
- emits: ["update:viewMode", "update:activeChart"],
230
- setup(g, { emit: h }) {
231
- const a = g, x = h, y = N({
232
- get: () => a.viewMode,
233
- set: (i) => {
234
- x("update:viewMode", i);
235
- }
236
- }), b = N({
237
- get: () => a.activeChart,
238
- set: (i) => {
239
- x("update:activeChart", i);
240
- }
241
- }), { width: _ } = vt(), c = N(() => _.value < 640), n = z(!1);
242
- return (i, s) => {
243
- const u = V("DrawerTitle"), I = V("DrawerDescription"), S = V("DrawerHeader"), E = V("Button"), $ = V("DrawerFooter"), Y = V("DrawerContent"), ne = V("Drawer"), P = V("DropdownMenuTrigger"), j = V("DropdownMenuLabel"), M = V("DropdownMenuItem"), U = V("DropdownMenuContent"), L = V("DropdownMenu");
244
- return v(), T("div", It, [
245
- g.resources.length > 1 ? (v(), T("button", {
246
- key: 0,
247
- "data-active": g.viewMode === "stacked",
248
- class: "hover:bg-muted/50 flex flex-1 flex-col justify-center gap-2 border-t px-4 py-3 text-left sm:border-t-0 sm:border-l sm:px-6 sm:py-6 cursor-pointer",
249
- onClick: s[0] || (s[0] = (f) => n.value = !0),
250
- onContextmenu: s[1] || (s[1] = Ge((f) => n.value = !0, ["prevent"]))
251
- }, [
252
- l("div", Et, [
253
- g.viewMode === "stacked" ? (v(), T(ie, { key: 0 }, [
254
- d(e(be), { class: "size-3 text-muted-foreground" }),
255
- s[6] || (s[6] = l("span", { class: "block text-muted-foreground text-xs mr-2 max-w-[120px] truncate" }, "All Resources", -1))
256
- ], 64)) : (v(), T(ie, { key: 1 }, [
257
- l("div", {
258
- class: "size-3 rounded-full mr-2",
259
- style: ve({ backgroundColor: g.resources.find((f) => f.id === g.activeChart)?.color || "#6b7280" })
260
- }, null, 4),
261
- l("span", Ot, A(g.resources.find((f) => f.id === g.activeChart)?.name || "Select Resource"), 1)
262
- ], 64)),
263
- d(e(it), { class: "ml-auto size-4" })
264
- ]),
265
- l("span", Pt, A(g.viewMode === "stacked" ? Object.values(g.totals).reduce((f, q) => f + q, 0).toLocaleString() : (g.totals[g.activeChart] || 0).toLocaleString()), 1)
266
- ], 40, Tt)) : K("", !0),
267
- e(c) ? (v(), F(ne, {
268
- key: 1,
269
- open: e(n),
270
- "onUpdate:open": s[3] || (s[3] = (f) => se(n) ? n.value = f : null)
271
- }, {
272
- default: k(() => [
273
- d(Y, null, {
274
- default: k(() => [
275
- l("div", jt, [
276
- d(S, null, {
277
- default: k(() => [
278
- d(u, null, {
279
- default: k(() => [...s[7] || (s[7] = [
280
- Z("Resources", -1)
281
- ])]),
282
- _: 1
283
- }),
284
- d(I, null, {
285
- default: k(() => [...s[8] || (s[8] = [
286
- Z("Select the resources to display on the timeline.", -1)
287
- ])]),
288
- _: 1
289
- })
290
- ]),
291
- _: 1
292
- }),
293
- d($, null, {
294
- default: k(() => [
295
- d(E, {
296
- onClick: s[2] || (s[2] = (f) => {
297
- y.value = "stacked", b.value = "", n.value = !1;
298
- }),
299
- variant: g.viewMode === "stacked" ? "secondary" : "outline"
300
- }, {
301
- default: k(() => [
302
- d(e(be), { class: "size-3 text-muted-foreground" }),
303
- l("span", At, " All Resources (" + A(Object.values(g.totals).reduce((f, q) => f + q, 0).toLocaleString()) + ") ", 1)
304
- ]),
305
- _: 1
306
- }, 8, ["variant"]),
307
- (v(!0), T(ie, null, he(g.resources, (f) => (v(), F(E, {
308
- key: f.id,
309
- onClick: (q) => {
310
- y.value = "single", b.value = f.id, n.value = !1;
311
- },
312
- variant: g.viewMode === "single" && g.activeChart === f.id ? "secondary" : "outline"
313
- }, {
314
- default: k(() => [
315
- l("div", {
316
- class: "size-3 rounded-full",
317
- style: ve({ backgroundColor: f.color || "#6b7280" })
318
- }, null, 4),
319
- l("span", zt, A(f.name) + " (" + A((g.totals[f.id] || 0).toLocaleString()) + ") ", 1)
320
- ]),
321
- _: 2
322
- }, 1032, ["onClick", "variant"]))), 128))
323
- ]),
324
- _: 1
325
- })
326
- ])
327
- ]),
328
- _: 1
329
- })
330
- ]),
331
- _: 1
332
- }, 8, ["open"])) : (v(), F(L, {
333
- key: 2,
334
- open: e(n),
335
- "onUpdate:open": s[5] || (s[5] = (f) => se(n) ? n.value = f : null)
336
- }, {
337
- default: k(() => [
338
- d(P, { "as-child": "" }, {
339
- default: k(() => [...s[9] || (s[9] = [
340
- l("button", {
341
- tabindex: "-1",
342
- class: "size-0 opacity-0 self-end"
343
- }, null, -1)
344
- ])]),
345
- _: 1
346
- }),
347
- d(U, { align: "end" }, {
348
- default: k(() => [
349
- d(j, null, {
350
- default: k(() => [...s[10] || (s[10] = [
351
- Z("Resources", -1)
352
- ])]),
353
- _: 1
354
- }),
355
- l("div", Nt, [
356
- d(M, {
357
- onClick: s[4] || (s[4] = (f) => {
358
- y.value = "stacked", b.value = "", n.value = !1;
359
- }),
360
- class: re(g.viewMode === "stacked" ? "bg-input" : "")
361
- }, {
362
- default: k(() => [
363
- d(e(be), { class: "size-3 text-muted-foreground" }),
364
- l("span", null, " All Resources (" + A(Object.values(g.totals).reduce((f, q) => f + q, 0).toLocaleString()) + ") ", 1)
365
- ]),
366
- _: 1
367
- }, 8, ["class"]),
368
- (v(!0), T(ie, null, he(g.resources, (f) => (v(), F(M, {
369
- key: f.id,
370
- onClick: (q) => {
371
- y.value = "single", b.value = f.id, n.value = !1;
372
- },
373
- class: re(g.viewMode === "single" && g.activeChart === f.id ? "bg-input" : "")
374
- }, {
375
- default: k(() => [
376
- l("div", {
377
- class: "size-3 rounded-full",
378
- style: ve({ backgroundColor: f.color || "#6b7280" })
379
- }, null, 4),
380
- l("span", Bt, [
381
- l("span", Wt, A(f.name), 1),
382
- l("span", null, "(" + A((g.totals[f.id] || 0).toLocaleString()) + ")", 1)
383
- ])
384
- ]),
385
- _: 2
386
- }, 1032, ["onClick", "class"]))), 128))
387
- ])
388
- ]),
389
- _: 1
390
- })
391
- ]),
392
- _: 1
393
- }, 8, ["open"]))
394
- ]);
395
- };
396
- }
397
- }), Lt = { class: "flex flex-1 flex-col justify-center gap-1 px-6 py-5 sm:py-6" }, Gt = { class: "flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-3" }, Ht = { class: "flex items-center gap-1" }, Ut = { class: "timeline-date-trigger" }, qt = {
398
- key: 1,
399
- class: "flex items-center justify-center px-6 py-4 text-muted-foreground text-sm"
400
- }, Yt = {
401
- key: 0,
402
- class: "flex items-center justify-center h-[250px]"
403
- }, Xt = {
404
- key: 1,
405
- class: "flex items-center justify-center h-[250px]"
406
- }, Pe = "#61616180", Jt = /* @__PURE__ */ ce({
407
- __name: "Timeline",
408
- props: {
409
- modelValue: {},
410
- selectedResource: {},
411
- viewMode: {},
412
- agendaData: {},
413
- resources: {}
414
- },
415
- emits: ["update:modelValue", "update:selectedResource", "update:viewMode"],
416
- setup(g, { emit: h }) {
417
- const a = g, x = h, { params: y } = _e(), { config: b } = De(), _ = Se(b.project), c = z([]), n = z([]), i = z(!0), s = z(a.viewMode || "stacked"), u = z(a.selectedResource || "");
418
- Q(s, (t) => {
419
- x("update:viewMode", t);
420
- }, { immediate: !0 }), Q(u, (t) => {
421
- x("update:selectedResource", s.value === "single" ? t : null);
422
- }), Q(s, (t) => {
423
- x("update:selectedResource", t === "single" ? u.value : null);
424
- }), Q(() => a.selectedResource, (t) => {
425
- s.value === "single" && t !== u.value && (u.value = t || "");
426
- });
427
- const I = /* @__PURE__ */ new Date(), S = z(a.modelValue || /* @__PURE__ */ new Date()), E = z(null);
428
- Q(() => a.modelValue, (t) => {
429
- t && t.getTime() !== S.value.getTime() && (S.value = t);
430
- }), Q(S, (t) => {
431
- x("update:modelValue", t);
432
- }, { immediate: !0 });
433
- const $ = N({
434
- get: () => ue(S.value),
435
- set: (t) => {
436
- if (!t) {
437
- S.value = /* @__PURE__ */ new Date();
438
- return;
439
- }
440
- S.value = /* @__PURE__ */ new Date(`${t}T00:00:00`);
441
- }
442
- }), Y = () => {
443
- const t = E.value;
444
- if (t) {
445
- if (typeof t.showPicker == "function") {
446
- t.showPicker();
447
- return;
448
- }
449
- t.focus(), t.click();
450
- }
451
- }, ne = N(() => {
452
- const t = new Date(I);
453
- t.setDate(I.getDate() - 1);
454
- const p = new Date(I);
455
- return p.setDate(I.getDate() + 1), S.value.toDateString() === I.toDateString() ? "Today" : S.value.toDateString() === t.toDateString() ? "Yesterday" : S.value.toDateString() === p.toDateString() ? "Tomorrow" : S.value.toLocaleDateString("en-US", {
456
- weekday: "long",
457
- month: "long",
458
- day: "numeric",
459
- year: "numeric"
460
- });
461
- }), P = () => {
462
- const t = new Date(S.value);
463
- t.setDate(t.getDate() - 1), S.value = t;
464
- }, j = () => {
465
- const t = new Date(S.value);
466
- t.setDate(t.getDate() + 1), S.value = t;
467
- }, M = () => {
468
- S.value = /* @__PURE__ */ new Date();
469
- }, U = N(() => a.resources?.length === 0 ? 10 : Math.max(...(a.resources || []).map((t) => t.capacity || 10))), L = N(() => (a.resources?.length || 0) === 0 ? 60 : Math.min(...(a.resources || []).map((t) => t.interval || 60))), f = N(() => {
470
- const t = {
471
- total: {
472
- label: "Total Reservations",
473
- color: void 0
474
- }
475
- };
476
- return (a.resources || []).forEach((p, C) => {
477
- t[p.id] = {
478
- label: p.name,
479
- color: p.color || `var(--chart-${C % 5 + 1})`
480
- };
481
- }), t;
482
- });
483
- Q(() => a.resources, (t) => {
484
- (t?.length || 0) > 0 && !u.value && (u.value = t[0].id);
485
- }, { immediate: !0 });
486
- const q = N(() => [...a.resources || []].sort((t, p) => {
487
- const C = X.value[t.id] || 0;
488
- return (X.value[p.id] || 0) - C;
489
- })), oe = N(() => {
490
- const t = [];
491
- return L.value, c.value.forEach((p, C) => {
492
- p.time.endsWith(":00") && t.push(C);
493
- }), t;
494
- }), X = N(() => {
495
- const t = {};
496
- return a.resources?.forEach((p) => {
497
- t[p.id] = n.value.filter((C) => C.resourceId === p.id).reduce((C, R) => C + (R.reserved || 0), 0);
498
- }), t;
499
- }), ue = (t) => {
500
- const p = t.getFullYear(), C = String(t.getMonth() + 1).padStart(2, "0"), R = String(t.getDate()).padStart(2, "0");
501
- return `${p}-${C}-${R}`;
502
- }, r = (t) => {
503
- const [p, C] = t.split(":").map(Number);
504
- return p * 60 + C;
505
- }, o = (t, p) => (a.agendaData?.exceptions || []).find((R) => p >= R.startDate && p <= R.endDate ? R.resourceIds === null ? !0 : R.resourceIds?.includes(t) : !1) || null, O = N(() => {
506
- const t = ue(S.value), p = S.value.getDay();
507
- let C = 1440, R = 0;
508
- if ((a.resources || []).forEach((ae) => {
509
- const W = o(ae.id, t);
510
- if (W) {
511
- if (W.isClosed)
512
- return;
513
- W.timeslots.forEach((J) => {
514
- const D = r(J.startTime), w = r(J.endTime);
515
- C = Math.min(C, D), R = Math.max(R, w);
516
- });
517
- } else
518
- (ae.openingHours?.[p] || []).forEach((D) => {
519
- const w = r(D.start), ee = r(D.end);
520
- C = Math.min(C, w), R = Math.max(R, ee);
521
- });
522
- }), C >= R)
523
- return { startMinutes: 540, endMinutes: 1020 };
524
- const m = Math.floor(C / 60) * 60, te = Math.ceil(R / 60) * 60;
525
- return { startMinutes: m, endMinutes: te };
526
- }), G = () => {
527
- const t = [], p = L.value, { startMinutes: C, endMinutes: R } = O.value;
528
- for (let m = C; m < R; m += p) {
529
- const te = Math.floor(m / 60), ae = m % 60, W = `${String(te).padStart(2, "0")}:${String(ae).padStart(2, "0")}`, J = {
530
- time: W,
531
- label: W
532
- };
533
- a.resources?.forEach((D) => {
534
- J[D.id] = 0;
535
- }), t.push(J);
536
- }
537
- return t;
538
- }, H = async () => {
539
- i.value = !0;
540
- try {
541
- const t = y.value.id, p = ue(S.value), C = `${t}_${p}`, R = await _.get(b.reservedSpotsCollection, C);
542
- n.value = [];
543
- for (const W of a.resources || []) {
544
- const J = R?.[W.id] || {};
545
- Object.entries(J).forEach(([D, w]) => {
546
- const [ee, me] = D.split("-");
547
- n.value.push({
548
- resourceId: W.id,
549
- startTime: ee,
550
- endTime: me,
551
- reserved: w
552
- });
553
- });
554
- }
555
- const m = G(), te = L.value, { startMinutes: ae } = O.value;
556
- n.value.forEach((W) => {
557
- const J = r(W.startTime), D = r(W.endTime);
558
- for (let w = J; w < D; w += te) {
559
- const ee = Math.floor((w - ae) / te);
560
- if (ee >= 0 && ee < m.length) {
561
- const me = m[ee][W.resourceId];
562
- typeof me == "number" && (m[ee][W.resourceId] = me + (W.reserved || 0));
563
- }
564
- }
565
- }), c.value = m;
566
- } catch (t) {
567
- console.error("Error loading reservation data:", t), c.value = G(), n.value = [];
568
- } finally {
569
- i.value = !1;
570
- }
571
- };
572
- return (async () => await H())(), Q(S, () => {
573
- H();
574
- }), Q(() => a.resources, () => {
575
- (a.resources?.length || 0) > 0 && H();
576
- }), (t, p) => {
577
- const C = V("CardTitle"), R = V("Button"), m = V("CardDescription"), te = V("CardHeader"), ae = V("ChartContainer"), W = V("CardContent"), J = V("Card");
578
- return v(), F(J, { class: "py-4 sm:py-0" }, {
579
- default: k(() => [
580
- d(te, { class: "flex flex-col items-stretch border-b !p-0 sm:flex-row" }, {
581
- default: k(() => [
582
- l("div", Lt, [
583
- l("div", Gt, [
584
- d(C, null, {
585
- default: k(() => [...p[3] || (p[3] = [
586
- Z("Reservations", -1)
587
- ])]),
588
- _: 1
589
- }),
590
- l("div", Ht, [
591
- d(R, {
592
- variant: "outline",
593
- size: "icon",
594
- class: "size-8",
595
- onClick: P
596
- }, {
597
- default: k(() => [
598
- d(e(lt), { size: 16 })
599
- ]),
600
- _: 1
601
- }),
602
- d(R, {
603
- variant: "outline",
604
- size: "sm",
605
- class: "h-8 px-3 text-xs",
606
- onClick: M
607
- }, {
608
- default: k(() => [...p[4] || (p[4] = [
609
- Z(" Today ", -1)
610
- ])]),
611
- _: 1
612
- }),
613
- d(R, {
614
- variant: "outline",
615
- size: "icon",
616
- class: "size-8",
617
- onClick: j
618
- }, {
619
- default: k(() => [
620
- d(e(dt), { size: 16 })
621
- ]),
622
- _: 1
623
- })
624
- ])
625
- ]),
626
- d(m, null, {
627
- default: k(() => [
628
- l("div", Ut, [
629
- d(R, {
630
- type: "button",
631
- variant: "outline",
632
- onClick: Y
633
- }, {
634
- default: k(() => [
635
- d(e(ct), { class: "size-4" }),
636
- Z(" " + A(e(ne)), 1)
637
- ]),
638
- _: 1
639
- }),
640
- He(l("input", {
641
- ref_key: "dateInputRef",
642
- ref: E,
643
- "onUpdate:modelValue": p[0] || (p[0] = (D) => se($) ? $.value = D : null),
644
- type: "date",
645
- class: "timeline-date-picker",
646
- "aria-label": "Select reservation date"
647
- }, null, 512), [
648
- [Ue, e($)]
649
- ])
650
- ])
651
- ]),
652
- _: 1
653
- })
654
- ]),
655
- g.resources.length > 0 ? (v(), F(Ft, {
656
- key: 0,
657
- resources: g.resources,
658
- totals: e(X),
659
- viewMode: e(s),
660
- "onUpdate:viewMode": p[1] || (p[1] = (D) => se(s) ? s.value = D : null),
661
- activeChart: e(u),
662
- "onUpdate:activeChart": p[2] || (p[2] = (D) => se(u) ? u.value = D : null)
663
- }, null, 8, ["resources", "totals", "viewMode", "activeChart"])) : (v(), T("div", qt, " No resources configured "))
664
- ]),
665
- _: 1
666
- }),
667
- d(W, { class: "px-2 sm:p-6" }, {
668
- default: k(() => [
669
- e(i) ? (v(), T("div", Yt, [...p[5] || (p[5] = [
670
- l("div", { class: "text-muted-foreground" }, "Loading...", -1)
671
- ])])) : g.resources.length === 0 ? (v(), T("div", Xt, [...p[6] || (p[6] = [
672
- l("div", { class: "text-muted-foreground" }, "No resources to display", -1)
673
- ])])) : e(s) === "stacked" ? (v(), F(ae, {
674
- key: 2,
675
- config: e(f),
676
- class: "aspect-auto h-[250px] w-full",
677
- cursor: ""
678
- }, {
679
- default: k(() => [
680
- d(e(Ie), {
681
- data: e(c),
682
- margin: { left: -24 },
683
- "y-domain": [0, e(U)]
684
- }, {
685
- default: k(() => [
686
- (v(!0), T(ie, null, he(e(q), (D) => (v(), F(e(Oe), {
687
- key: D.id,
688
- x: (w, ee) => ee,
689
- y: (w) => w[D.id] || 0,
690
- color: (w) => w[D.id] > 0 ? e(f)[D.id]?.color : Pe,
691
- "bar-padding": 0.1,
692
- "rounded-corners": 2
693
- }, null, 8, ["x", "y", "color"]))), 128)),
694
- d(e(fe), {
695
- type: "x",
696
- x: (D, w) => w,
697
- "tick-line": !1,
698
- "domain-line": !1,
699
- "grid-line": !1,
700
- "tick-values": e(oe),
701
- "tick-format": (D) => e(c)[D]?.time || ""
702
- }, null, 8, ["x", "tick-values", "tick-format"]),
703
- d(e(fe), {
704
- type: "y",
705
- "num-ticks": 3,
706
- "tick-line": !1,
707
- "domain-line": !1
708
- }),
709
- d(e(Te)),
710
- d(e(Ee), {
711
- template: e(Me)(e(f), e(Re), {
712
- labelFormatter(D) {
713
- const w = Math.round(D);
714
- return w >= 0 && w < e(c).length && e(c)[w]?.time || "";
715
- }
716
- }),
717
- color: "#0000"
718
- }, null, 8, ["template"])
719
- ]),
720
- _: 1
721
- }, 8, ["data", "y-domain"])
722
- ]),
723
- _: 1
724
- }, 8, ["config"])) : (v(), F(ae, {
725
- key: e(u),
726
- config: e(f),
727
- class: "aspect-auto h-[250px] w-full",
728
- cursor: ""
729
- }, {
730
- default: k(() => [
731
- d(e(Ie), {
732
- data: e(c),
733
- margin: { left: -24 },
734
- "y-domain": [0, e(U)]
735
- }, {
736
- default: k(() => [
737
- d(e(Oe), {
738
- x: (D, w) => w,
739
- y: (D) => D[e(u)] || 0,
740
- color: (D) => D[e(u)] > 0 ? e(f)[e(u)]?.color : Pe,
741
- "bar-padding": 0.1,
742
- "rounded-corners": !1
743
- }, null, 8, ["x", "y", "color"]),
744
- d(e(fe), {
745
- type: "x",
746
- x: (D, w) => w,
747
- "tick-line": !1,
748
- "domain-line": !1,
749
- "grid-line": !1,
750
- "tick-values": e(oe),
751
- "tick-format": (D) => e(c)[D]?.time || ""
752
- }, null, 8, ["x", "tick-values", "tick-format"]),
753
- d(e(fe), {
754
- type: "y",
755
- "num-ticks": 3,
756
- "tick-line": !1,
757
- "domain-line": !1
758
- }),
759
- d(e(Te)),
760
- d(e(Ee), {
761
- template: e(Me)(e(f), e(Re), {
762
- labelFormatter(D) {
763
- const w = Math.round(D);
764
- return w >= 0 && w < e(c).length && e(c)[w]?.time || "";
765
- }
766
- }),
767
- color: "#0000"
768
- }, null, 8, ["template"])
769
- ]),
770
- _: 1
771
- }, 8, ["data", "y-domain"])
772
- ]),
773
- _: 1
774
- }, 8, ["config"]))
775
- ]),
776
- _: 1
777
- })
778
- ]),
779
- _: 1
780
- });
781
- };
782
- }
783
- }), Qt = /* @__PURE__ */ bt(Jt, [["__scopeId", "data-v-62490f67"]]), Kt = { class: "flex flex-row items-center justify-between gap-2" }, Zt = { class: "relative mb-4" }, ea = { class: "flex gap-1 mb-4 flex-wrap" }, ta = {
784
- key: 0,
785
- class: "mb-3 text-sm text-muted-foreground"
786
- }, aa = {
787
- key: 1,
788
- class: "flex items-center justify-center py-8"
789
- }, sa = {
790
- key: 2,
791
- class: "flex flex-col items-center gap-2 text-center py-8 text-muted-foreground"
792
- }, oa = {
793
- key: 3,
794
- class: "text-center py-8 text-muted-foreground"
795
- }, na = {
796
- key: 4,
797
- class: "space-y-2"
798
- }, ra = ["onClick"], ia = { class: "flex items-start justify-between" }, la = { class: "flex-1" }, da = { class: "font-medium" }, ca = { class: "text-sm text-muted-foreground" }, ua = { class: "text-sm text-muted-foreground" }, ma = { class: "flex items-center gap-4 flex-wrap" }, pa = { class: "flex items-center gap-2 mt-1 text-xs text-muted-foreground" }, fa = { class: "flex items-center gap-2 mt-1 text-xs text-muted-foreground" }, va = {
799
- key: 0,
800
- class: "flex items-center gap-1 mt-1 text-xs text-muted-foreground"
801
- }, ga = { class: "text-right" }, ha = {
802
- key: 0,
803
- 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"
804
- }, xa = {
805
- key: 1,
806
- 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"
807
- }, ya = {
808
- key: 2,
809
- 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"
810
- }, ba = {
811
- key: 3,
812
- 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"
813
- }, ka = {
814
- key: 4,
815
- 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"
816
- }, _a = {
817
- key: 5,
818
- class: "text-sm font-medium mt-1"
819
- }, Da = /* @__PURE__ */ ce({
820
- __name: "BookingsList",
821
- props: {
822
- agendaData: {},
823
- activeDate: {},
824
- selectedResource: {},
825
- resources: {}
826
- },
827
- emits: ["resetSelectedResource"],
828
- setup(g, { emit: h }) {
829
- const a = g, x = h, { params: y } = _e(), { config: b } = De(), _ = Se(b.project), c = z([]), n = z(!0), i = z(""), s = z(null), u = z(null), I = N(() => a.agendaData?.metadataSchema || []), S = N(() => ({
830
- date: E(a.activeDate),
831
- resource: null
832
- }));
833
- qe("event", S);
834
- const E = (r) => {
835
- const o = r.getFullYear(), O = String(r.getMonth() + 1).padStart(2, "0"), G = String(r.getDate()).padStart(2, "0");
836
- return `${o}-${O}-${G}`;
837
- }, $ = N(() => {
838
- let r = c.value;
839
- return a.selectedResource && (r = r.filter((o) => o.resourceId === a.selectedResource)), i.value.trim() && (r = new kt(r, {
840
- keys: [
841
- "customerInfo.firstName",
842
- "customerInfo.lastName",
843
- "customerInfo.email",
844
- "customerInfo.phone",
845
- "resourceName"
846
- ],
847
- threshold: 0.3,
848
- ignoreLocation: !0
849
- }).search(i.value).map((O) => O.item)), r;
850
- }), Y = N(() => $.value.filter((r) => M.value.includes(r.reservationStatus))), ne = N(() => {
851
- let r = JSON.parse(JSON.stringify(c.value));
852
- return a.selectedResource && (r = r.filter((o) => o.resourceId === a.selectedResource)), r.some((o) => o.reservationStatus === "approved" || o.reservationStatus === "needs_approval");
853
- }), P = N(() => ({
854
- spots: c.value.reduce((r, o) => r + (o.spots || 0), 0),
855
- bookings: c.value.length
856
- })), j = () => {
857
- i.value = "";
858
- }, M = z(["needs_approval", "approved"]), U = (r) => {
859
- M.value.includes(r) ? M.value = M.value.filter((o) => o !== r) : M.value.push(r);
860
- }, L = (r, o, O = o.date) => {
861
- const G = a.resources.find((B) => B.id === o.resourceId), H = r.id || r.orderId || o.orderId || "";
862
- return {
863
- customerInfo: r.customerInfo,
864
- amountDue: r.amountDue,
865
- amountPaid: r.amountPaid,
866
- status: r.status,
867
- reservationStatus: o.status,
868
- subtotal: r.subtotal,
869
- total: r.total,
870
- discount: r.discount,
871
- id: H,
872
- res_id: o.id,
873
- resourceId: o.resourceId,
874
- spots: o.spots,
875
- date: O,
876
- createdAt: r.createdAt,
877
- startTime: o.timeslot?.startTime,
878
- endTime: o.timeslot?.endTime,
879
- reservationPrice: o.totalPrice,
880
- reservationBasePrice: o.basePrice,
881
- reservationAddOnsPrice: o.addOnsPrice,
882
- pricingOptionId: o.pricingOptionId,
883
- pricingOption: o.pricingOption,
884
- resourceName: G?.name || "Unknown",
885
- resourceColor: G?.color,
886
- metadata: r.metadata || {},
887
- reservationMetadata: o.metadata || {},
888
- adjustments: r.adjustments || [],
889
- reservationAdjustments: o.adjustments || []
890
- };
891
- }, f = async () => {
892
- await je(), await new Promise((r) => {
893
- if (typeof requestAnimationFrame == "function") {
894
- requestAnimationFrame(() => r());
895
- return;
896
- }
897
- r();
898
- });
899
- }, q = async (r) => {
900
- const o = await _.get(b.reservationsCollection, r);
901
- if (!o) return;
902
- const O = { ...o, id: o.id || r }, G = (O.reservations || []).map((H) => L(O, H));
903
- G.length && (await f(), u.value?.openDialog({
904
- id: O.id,
905
- customerInfo: O.customerInfo,
906
- status: O.status,
907
- createdAt: O.createdAt,
908
- metadata: O.metadata || {},
909
- reservations: G,
910
- adjustments: O.adjustments || [],
911
- totalPrice: typeof O.total == "number" ? O.total : G.reduce((H, B) => H + (B.reservationPrice || 0), 0),
912
- totalSpots: G.reduce((H, B) => H + (B.spots || 0), 0)
913
- }));
914
- }, oe = async (r) => {
915
- await f(), s.value?.openDialog(r);
916
- }, X = async () => {
917
- n.value = !0, c.value = [];
918
- try {
919
- const r = y.value.id, o = E(a.activeDate), O = /* @__PURE__ */ new Set();
920
- a.resources?.forEach((B) => {
921
- const t = `${B.id}_${o}`;
922
- O.add(t);
923
- });
924
- const G = await _.find(b.reservationsCollection, {
925
- filters: [
926
- { field: "agendaId", operator: "==", value: r },
927
- { field: "status", operator: "==", value: "confirmed" },
928
- { field: "flattenedReservationDates", operator: "array-contains-any", value: Array.from(O) }
929
- ]
930
- });
931
- let H = [];
932
- G.forEach((B) => {
933
- (B.reservations?.filter((p) => p.date === o) || []).forEach((p) => {
934
- H.push(L(B, p, o));
935
- });
936
- }), c.value = H.sort((B, t) => B.startTime?.localeCompare(t.startTime || "") || 0);
937
- } catch (r) {
938
- console.error("Error loading orders:", r), c.value = [];
939
- } finally {
940
- n.value = !1;
941
- }
942
- };
943
- return (async () => await X())(), Q(() => a.activeDate, () => {
944
- X();
945
- }), (r, o) => {
946
- const O = V("Badge"), G = V("CardTitle"), H = V("CardDescription"), B = V("Button"), t = V("CardHeader"), p = V("Input"), C = V("CardContent"), R = V("Card");
947
- return v(), F(R, null, {
948
- default: k(() => [
949
- d(t, null, {
950
- default: k(() => [
951
- l("div", Kt, [
952
- l("div", null, [
953
- d(G, { class: "flex items-center gap-2" }, {
954
- default: k(() => [
955
- o[9] || (o[9] = Z(" Bookings ", -1)),
956
- e(P).bookings > 0 ? (v(), F(O, {
957
- key: 0,
958
- variant: "secondary"
959
- }, {
960
- default: k(() => [
961
- Z(A(e(P).bookings), 1)
962
- ]),
963
- _: 1
964
- })) : K("", !0)
965
- ]),
966
- _: 1
967
- }),
968
- d(H, { class: "flex items-center gap-2 mt-1" }, {
969
- default: k(() => [
970
- d(e(Ve), { size: 14 }),
971
- l("span", null, A(e(P).spots) + " total spots", 1)
972
- ]),
973
- _: 1
974
- })
975
- ]),
976
- d(B, {
977
- variant: "ghost",
978
- size: "icon",
979
- onClick: X,
980
- disabled: e(n)
981
- }, {
982
- default: k(() => [
983
- d(e(ut), {
984
- size: 16,
985
- class: re({ "animate-spin": e(n) })
986
- }, null, 8, ["class"])
987
- ]),
988
- _: 1
989
- }, 8, ["disabled"])
990
- ])
991
- ]),
992
- _: 1
993
- }),
994
- d(C, null, {
995
- default: k(() => [
996
- l("div", Zt, [
997
- d(e(mt), {
998
- size: 16,
999
- class: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"
1000
- }),
1001
- d(p, {
1002
- modelValue: e(i),
1003
- "onUpdate:modelValue": o[0] || (o[0] = (m) => se(i) ? i.value = m : null),
1004
- placeholder: "Search by name, email, or phone...",
1005
- class: "pl-9 pr-9"
1006
- }, null, 8, ["modelValue"]),
1007
- e(i) ? (v(), F(B, {
1008
- key: 0,
1009
- variant: "ghost",
1010
- size: "icon",
1011
- class: "absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7",
1012
- onClick: j
1013
- }, {
1014
- default: k(() => [
1015
- d(e(pt), { size: 14 })
1016
- ]),
1017
- _: 1
1018
- })) : K("", !0)
1019
- ]),
1020
- l("div", ea, [
1021
- g.agendaData.needsApproval ? (v(), T("button", {
1022
- key: 0,
1023
- onClick: o[1] || (o[1] = (m) => U("needs_approval")),
1024
- class: re(["px-3 py-1.5 rounded-full text-sm bg-muted", { "opacity-50 hover:opacity-75": !e(M).includes("needs_approval") }])
1025
- }, " Needs Approval ", 2)) : K("", !0),
1026
- l("button", {
1027
- onClick: o[2] || (o[2] = (m) => U("approved")),
1028
- class: re(["px-3 py-1.5 rounded-full text-sm bg-muted", { "opacity-50 hover:opacity-75": !e(M).includes("approved") }])
1029
- }, " Approved ", 2),
1030
- l("button", {
1031
- onClick: o[3] || (o[3] = (m) => U("rejected")),
1032
- class: re(["px-3 py-1.5 rounded-full text-sm bg-muted", { "opacity-50 hover:opacity-75": !e(M).includes("rejected") }])
1033
- }, " Rejected ", 2),
1034
- l("button", {
1035
- onClick: o[4] || (o[4] = (m) => U("cancelled")),
1036
- class: re(["px-3 py-1.5 rounded-full text-sm bg-muted", { "opacity-50 hover:opacity-75": !e(M).includes("cancelled") }])
1037
- }, " Cancelled ", 2)
1038
- ]),
1039
- e(i) ? (v(), T("div", ta, " Showing " + A(e($).length) + " of " + A(e(c).length) + " bookings ", 1)) : K("", !0),
1040
- e(n) ? (v(), T("div", aa, [...o[10] || (o[10] = [
1041
- l("div", { class: "animate-spin rounded-full h-8 w-8 border-b-2 border-primary" }, null, -1)
1042
- ])])) : e(Y).length === 0 ? (v(), T("div", sa, [
1043
- o[13] || (o[13] = Z(" No bookings for this day ", -1)),
1044
- e(ne) ? (v(), F(B, {
1045
- key: 0,
1046
- onClick: o[5] || (o[5] = (m) => M.value = ["needs_approval", "approved"])
1047
- }, {
1048
- default: k(() => [...o[11] || (o[11] = [
1049
- Z("Reset filters", -1)
1050
- ])]),
1051
- _: 1
1052
- })) : K("", !0),
1053
- g.selectedResource !== null ? (v(), F(B, {
1054
- key: 1,
1055
- onClick: o[6] || (o[6] = (m) => x("resetSelectedResource"))
1056
- }, {
1057
- default: k(() => [...o[12] || (o[12] = [
1058
- Z("Reset resource filter", -1)
1059
- ])]),
1060
- _: 1
1061
- })) : K("", !0)
1062
- ])) : e($).length === 0 ? (v(), T("div", oa, " No bookings match your search ")) : (v(), T("div", na, [
1063
- (v(!0), T(ie, null, he(e($), (m) => (v(), T("div", {
1064
- key: m.res_id || m.id,
1065
- class: "p-3 border rounded-lg hover:bg-muted/50 transition-colors cursor-pointer",
1066
- onClick: (te) => e(s)?.openDialog(m)
1067
- }, [
1068
- l("div", ia, [
1069
- l("div", la, [
1070
- l("div", da, A(m.customerInfo.firstName + " " + m.customerInfo.lastName || "Unknown Customer"), 1),
1071
- l("div", ca, A(m.customerInfo?.email), 1),
1072
- l("div", ua, A(m.customerInfo?.phone), 1),
1073
- l("div", ma, [
1074
- l("div", pa, [
1075
- d(e(ft), { size: 12 }),
1076
- l("span", null, A(m.startTime) + " - " + A(m.endTime), 1)
1077
- ]),
1078
- l("div", fa, [
1079
- d(e(Ve), { size: 12 }),
1080
- l("span", null, A(m.spots) + " spots", 1)
1081
- ]),
1082
- m.resourceName ? (v(), T("div", va, [
1083
- l("div", {
1084
- class: "w-3 h-3 rounded-full",
1085
- style: ve({ backgroundColor: m.resourceColor || "#6b7280" })
1086
- }, null, 4),
1087
- l("span", null, A(m.resourceName), 1)
1088
- ])) : K("", !0)
1089
- ]),
1090
- d(_t, {
1091
- metadata: { ...m.metadata, ...m.reservationMetadata },
1092
- schema: e(I),
1093
- "display-filter": ["highlight", "badge"],
1094
- compact: "",
1095
- class: "mt-1"
1096
- }, null, 8, ["metadata", "schema"])
1097
- ]),
1098
- l("div", ga, [
1099
- m.reservationStatus === "needs_approval" ? (v(), T("span", ha, "Needs Approval")) : m.reservationStatus === "approved" ? (v(), T("span", xa, "Approved")) : m.reservationStatus === "rejected" ? (v(), T("span", ya, "Rejected")) : m.reservationStatus === "cancelled" ? (v(), T("span", ba, "Cancelled")) : (v(), T("span", ka, "Pending")),
1100
- m.reservationPrice || m.reservationPrice === 0 ? (v(), T("div", _a, " €" + A(m.reservationPrice.toFixed(2)), 1)) : K("", !0)
1101
- ])
1102
- ])
1103
- ], 8, ra))), 128))
1104
- ]))
1105
- ]),
1106
- _: 1
1107
- }),
1108
- d(Dt, {
1109
- ref_key: "reservationDetailDialog",
1110
- ref: s,
1111
- agendaData: g.agendaData,
1112
- "show-order-link": "",
1113
- onCancelled: X,
1114
- onConfirmed: X,
1115
- onRejected: X,
1116
- onOpenOrder: o[7] || (o[7] = (m) => q(m))
1117
- }, null, 8, ["agendaData"]),
1118
- d(St, {
1119
- ref_key: "orderDetailDialog",
1120
- ref: u,
1121
- agendaData: g.agendaData,
1122
- onOpenReservation: o[8] || (o[8] = (m) => oe(m))
1123
- }, null, 8, ["agendaData"])
1124
- ]),
1125
- _: 1
1126
- });
1127
- };
1128
- }
1129
- }), Sa = { class: "space-y-6" }, wa = { class: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4" }, Ca = { class: "text-2xl font-semibold tracking-tight" }, $a = { class: "flex flex-col md:flex-row gap-2" }, Ma = { class: "grid gap-6 md:grid-cols-2 lg:grid-cols-3" }, Ra = { class: "md:col-span-2 lg:col-span-3" }, Fa = /* @__PURE__ */ ce({
1130
- __name: "index",
1131
- setup(g) {
1132
- const { hasPermission: h } = Ye(), { params: a, resolvePath: x } = _e(), { config: y } = De(), b = Se(y.project), _ = z(""), c = z(!0), n = z(/* @__PURE__ */ new Date()), i = z(null), s = z("stacked"), u = z(null), I = z([]);
1133
- return (async () => {
1134
- try {
1135
- const E = await b.get(y.agendaCollection, a.value.id);
1136
- _.value = E?.serviceName || "", u.value = E, I.value = E?.resources?.filter(($) => $.isActive) || [];
1137
- } catch (E) {
1138
- console.error("Error loading data:", E);
1139
- } finally {
1140
- c.value = !1;
1141
- }
1142
- })(), (E, $) => (v(), F(Xe, null, {
1143
- default: k(() => [
1144
- l("div", Sa, [
1145
- l("div", wa, [
1146
- l("div", null, [
1147
- l("h1", Ca, A(e(_) || "Dashboard"), 1),
1148
- $[4] || ($[4] = l("p", { class: "text-muted-foreground text-sm mt-1" }, " Overview and analytics for your booking service ", -1))
1149
- ]),
1150
- l("div", $a, [
1151
- e(h)("manage-reservations") ? (v(), F(wt, {
1152
- key: 0,
1153
- "agenda-data": e(u)
1154
- }, null, 8, ["agenda-data"])) : K("", !0)
1155
- ])
1156
- ]),
1157
- d(Qt, {
1158
- modelValue: e(n),
1159
- "onUpdate:modelValue": $[0] || ($[0] = (Y) => se(n) ? n.value = Y : null),
1160
- "view-mode": e(s),
1161
- "onUpdate:viewMode": $[1] || ($[1] = (Y) => se(s) ? s.value = Y : null),
1162
- "selected-resource": e(i),
1163
- "onUpdate:selectedResource": $[2] || ($[2] = (Y) => se(i) ? i.value = Y : null),
1164
- "agenda-data": e(u),
1165
- resources: e(I)
1166
- }, null, 8, ["modelValue", "view-mode", "selected-resource", "agenda-data", "resources"]),
1167
- l("div", Ma, [
1168
- l("div", Ra, [
1169
- e(I).length > 0 ? (v(), F(Da, {
1170
- key: 0,
1171
- "agenda-data": e(u),
1172
- "active-date": e(n),
1173
- "selected-resource": e(i),
1174
- resources: e(I),
1175
- onResetSelectedResource: $[3] || ($[3] = (Y) => i.value = null)
1176
- }, null, 8, ["agenda-data", "active-date", "selected-resource", "resources"])) : K("", !0)
1177
- ])
1178
- ])
1179
- ])
1180
- ]),
1181
- _: 1
1182
- }));
1183
- }
1184
- });
1185
- export {
1186
- Fa as default
1187
- };