@oneclick.dev/cms-core-modules 0.0.104 → 0.0.106
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Acquisition-CPlZzUBo.mjs → Acquisition-B2pM5vSp.mjs} +2 -2
- package/dist/{Acquisition-Br1Pfny3.js → Acquisition-Dt2rREU8.js} +1 -1
- package/dist/{Audience-BfkrmBuQ.js → Audience-Bs7b0TNm.js} +1 -1
- package/dist/{Audience-DTblSAiL.mjs → Audience-VLnUsQvW.mjs} +2 -2
- package/dist/{ContentEditor-B1nfKG_5.mjs → ContentEditor-BNLEv-qJ.mjs} +3119 -3098
- package/dist/{ContentEditor-DdFU8piH.js → ContentEditor-BUvvqfG1.js} +36 -36
- package/dist/{Create-qPeQxkdl.js → Create-89z41K73.js} +1 -1
- package/dist/{Create-BRBh0xjM.mjs → Create-Cn_Eufga.mjs} +5 -1
- package/dist/{Entries-C8UJkrVC.mjs → Entries-BdhUyJR5.mjs} +1 -1
- package/dist/{Entries-BaS6H6ak.js → Entries-CEXM_SkO.js} +1 -1
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-Ceoje52V.js +1 -0
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-DMGcRmm-.mjs +1255 -0
- package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-COrK1j0S.js +1 -0
- package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-Vb3q8EVv.mjs +330 -0
- package/dist/{Overview-CpHhuiaV.js → Overview-Bn1Xx3_j.js} +1 -1
- package/dist/{Overview-BrCwozey.js → Overview-DC9io1bk.js} +1 -1
- package/dist/Overview-Di84CsR5.mjs +476 -0
- package/dist/Overview-UoZHUMUz.js +1 -0
- package/dist/{Overview-kaMhsIUq.mjs → Overview-ejh4vUMT.mjs} +3 -3
- package/dist/{Overview-D_T3K6aq.mjs → Overview-lWAyyenp.mjs} +1 -1
- package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-CuwREvXD.js +349 -0
- package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-GYNZ_yhD.mjs +3077 -0
- package/dist/{SeoHealth-BzcWd_w7.mjs → SeoHealth-DsbVdd2l.mjs} +3 -3
- package/dist/SeoHealth-az1YuNF2.js +1 -0
- package/dist/{TableView-DXmEF6pY.mjs → TableView-Bm6HaRHm.mjs} +1 -1
- package/dist/{TableView-CPAw3h8g.js → TableView-DQW0A1oG.js} +1 -1
- package/dist/agenda-IOqtALWf.js +1 -0
- package/dist/agenda-neyeLWv-.mjs +1165 -0
- package/dist/cms-core-modules.css +1 -1
- package/dist/{index-C4YUVWzJ.js → index-A2kp8Isi.js} +6 -6
- package/dist/{index-BuzLn4Km.js → index-B5aBwdxY.js} +2 -2
- package/dist/{index-p5Uqu8c2.mjs → index-BRdCrvcz.mjs} +52 -47
- package/dist/{index-D3L8WAJI.js → index-BiT55eU0.js} +2 -2
- package/dist/{index-CMk3uhUt.mjs → index-Bvxc5xv_.mjs} +153 -147
- package/dist/{index-DQYBP8Js.js → index-G7cIlnGN.js} +4 -4
- package/dist/{index-DjDCYQ_6.mjs → index-X6LV64jK.mjs} +102 -101
- package/dist/{index-_2lRVt_k.mjs → index-uOkqO74I.mjs} +105 -107
- package/dist/index-unsDfNYv.mjs +1187 -0
- package/dist/index-vHmvbEwa.js +35 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.mjs +14 -14
- package/dist/interpolation-CHn59tIC.js +1 -0
- package/dist/interpolation-w7IRDJwK.mjs +180 -0
- package/dist/orders-C65SlpJy.mjs +618 -0
- package/dist/orders-XVzWAgG1.js +1 -0
- package/dist/src/appointments/components/edit/EventDialog/BookingsList.vue.d.ts +11 -2
- package/dist/src/appointments/components/edit/EventDialog/OrderDetailDialog.vue.d.ts +55 -0
- package/dist/src/appointments/components/edit/EventDialog/ReservationDetailDialog.vue.d.ts +6 -1
- package/dist/src/appointments/components/edit/NewReservationDialog/CustomerInformation.vue.d.ts +10 -0
- package/dist/src/appointments/components/edit/NewReservationDialog/NewReservationDialog.vue.d.ts +25 -1
- package/dist/src/appointments/components/edit/NewReservationDialog/QuickReservationAdder.vue.d.ts +26 -0
- package/dist/src/appointments/components/edit/NewReservationDialog/ReservationLines.vue.d.ts +31 -0
- package/dist/src/appointments/components/edit/dashboard/Timeline.vue.d.ts +3 -1
- package/dist/src/appointments/composables/useHorizontalScroll.d.ts +20 -0
- package/dist/src/lib/interpolation.d.ts +6 -0
- package/package.json +2 -2
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-9Q7TMm4u.mjs +0 -401
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-DiNzGl-q.js +0 -1
- package/dist/Overview-BYMrsZjM.mjs +0 -332
- package/dist/Overview-t0pG5xjA.js +0 -1
- package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-Cz_22Oce.mjs +0 -2927
- package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-DPPNc-Z5.js +0 -349
- package/dist/SeoHealth-09sEOu3G.js +0 -1
- package/dist/agenda-BNG05SAq.js +0 -1
- package/dist/agenda-D1RxMxBS.mjs +0 -1152
- package/dist/index-BtujSJeg.js +0 -35
- package/dist/index-dOdMm1pV.mjs +0 -1105
- package/dist/interpolation-DEDSLETn.mjs +0 -128
- package/dist/interpolation-DERg6Lwt.js +0 -1
- package/dist/orders-CzzcFQha.mjs +0 -559
- package/dist/orders-ETtbA4aQ.js +0 -1
- package/dist/src/appointments/components/edit/dashboard/BookingsList.vue.d.ts +0 -110
- package/dist/src/appointments/pages/edit/orders.vue.d.ts +0 -98
|
@@ -0,0 +1,1187 @@
|
|
|
1
|
+
import { defineComponent as de, inject as Fe, computed as N, ref as z, onMounted as We, nextTick as Oe, onUnmounted as Le, watch as K, openBlock as v, createElementBlock as T, resolveComponent as V, withModifiers as Ge, createElementVNode as l, Fragment as ie, createVNode as c, unref as e, normalizeStyle as ve, toDisplayString as j, createCommentVNode as Q, createBlock as W, 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 { h as xe, t as Je, s as Ke, M as le, a3 as ye, a4 as Qe, J as we, _ as Ce, y as ce, P as $e, a5 as Ze, a6 as et, a7 as tt, q as at, j as st, Y as ot, R as nt, U as rt } from "./index-Bvxc5xv_.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 ct, CalendarIcon as dt, Users as Ve, RefreshCw as ut, Search as mt, X as pt, Clock as ft } from "lucide-vue-next";
|
|
7
|
+
import { u as vt } from "./index-MYWjg0zi.mjs";
|
|
8
|
+
import { X as gt, O as je, a as ht, b as xt, r as yt, D as pe, S as Ie, C as fe, z as Te, A as Ae } from "./index-uOkqO74I.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-DMGcRmm-.mjs";
|
|
13
|
+
function Ct({ x: g, y: h, w: a, h: x, tl: y = !1, tr: b = !1, bl: _ = !1, br: d = !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 = d ? n : 0, u = d ? 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: je.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 = () => Ke(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, A) => le(S, this.config.x, A)), b = ye(y), _ = Qe(y), d = this.dataScale(b), n = this.dataScale(_), i = this.dataScale.invert(d + (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 === je.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], d = xt().domain(yt(b.length)).range(_).paddingInner(a.barPadding).paddingOuter(a.barPadding), n = this.g.selectAll(`.${ke}`).data(this._barData, (P, O) => {
|
|
87
|
+
var M;
|
|
88
|
+
return `${(M = Ce(P, a.id, O)) !== null && M !== void 0 ? M : O}`;
|
|
89
|
+
}), i = (P, O) => {
|
|
90
|
+
const M = this.dataScale(le(P, a.x, O)), 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
|
+
ce(u, x).attr("transform", i).style("opacity", 1);
|
|
94
|
+
const I = n.exit().attr("class", Ne);
|
|
95
|
+
ce(I, x).style("opacity", 0).remove(), ce(I.selectAll(`.${ge}`), x).attr("transform", (P, O, M) => this.isVertical() ? `translate(0,${this.yScale(0)}) scale(1,0)` : `translate(${this.xScale(0)},0) scale(0,1)`);
|
|
96
|
+
const S = d.bandwidth(), A = u.selectAll(`.${ge}`).data((P) => b.map(() => P)), $ = this._getValueAxisDirection(), ne = A.enter().append("path").attr("class", ge).attr("d", (P, O) => {
|
|
97
|
+
const M = d(O), U = this.valueScale(0), L = S;
|
|
98
|
+
return this._getBarPath(M, U, L, 0, !1, $);
|
|
99
|
+
}).style("fill", (P, O) => $e(P, a.color, O)).merge(A);
|
|
100
|
+
ce(ne, x).attr("d", (P, O) => {
|
|
101
|
+
const M = d(O), U = S, L = le(P, b[O]), 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, O) => $e(P, a.color, O)).style("cursor", (P, O) => Ce(P, a.cursor, O)), ce(A.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: d } = this, n = d.roundedCorners ? we(d.roundedCorners) ? +d.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, A = !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 || A,
|
|
129
|
+
bl: I || S,
|
|
130
|
+
br: I || A,
|
|
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": "" }, Ee = /* @__PURE__ */ de({
|
|
166
|
+
__name: "index",
|
|
167
|
+
props: {
|
|
168
|
+
color: { type: [Function, String, Array, null] },
|
|
169
|
+
groupWidth: {},
|
|
170
|
+
groupMaxWidth: {},
|
|
171
|
+
dataStep: {},
|
|
172
|
+
groupPadding: {},
|
|
173
|
+
barPadding: {},
|
|
174
|
+
roundedCorners: { type: [Number, Boolean] },
|
|
175
|
+
barMinHeight: {},
|
|
176
|
+
cursor: { type: [Function, String, null] },
|
|
177
|
+
orientation: {},
|
|
178
|
+
x: { type: [Function, Number, null] },
|
|
179
|
+
y: { type: [Function, Number, null, Array] },
|
|
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 = Fe(ot), x = g, y = N(() => a.data.value ?? x.data), b = nt(x), _ = z();
|
|
191
|
+
return We(() => {
|
|
192
|
+
Oe(() => {
|
|
193
|
+
var d;
|
|
194
|
+
_.value = new Be(b.value), (d = _.value) == null || d.setData(y.value), a.update(_.value);
|
|
195
|
+
});
|
|
196
|
+
}), Le(() => {
|
|
197
|
+
var d;
|
|
198
|
+
(d = _.value) == null || d.destroy(), a.destroy();
|
|
199
|
+
}), K(b, (d, n) => {
|
|
200
|
+
var i;
|
|
201
|
+
rt(d, n) || (i = _.value) == null || i.setConfig(b.value);
|
|
202
|
+
}), K(y, () => {
|
|
203
|
+
var d;
|
|
204
|
+
(d = _.value) == null || d.setData(y.value);
|
|
205
|
+
}), h({
|
|
206
|
+
component: _
|
|
207
|
+
}), (d, n) => (v(), T("div", Vt));
|
|
208
|
+
}
|
|
209
|
+
}), It = { class: "flex flex-col sm:flex-row" }, Tt = ["data-active"], At = { class: "flex items-center gap-2" }, Et = { 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" }, Ot = { class: "mx-auto w-full max-w-sm mt-2 mb-8" }, jt = { class: "text-muted-foreground" }, zt = { class: "text-muted-foreground" }, Nt = { class: "grid" }, Bt = { class: "flex gap-1 overflow-hidden max-w-80" }, Ft = { class: "truncate" }, Wt = /* @__PURE__ */ de({
|
|
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(), d = N(() => _.value < 640), n = z(!1);
|
|
242
|
+
return (i, s) => {
|
|
243
|
+
const u = V("DrawerTitle"), I = V("DrawerDescription"), S = V("DrawerHeader"), A = V("Button"), $ = V("DrawerFooter"), Y = V("DrawerContent"), ne = V("Drawer"), P = V("DropdownMenuTrigger"), O = 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", At, [
|
|
253
|
+
g.viewMode === "stacked" ? (v(), T(ie, { key: 0 }, [
|
|
254
|
+
c(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", Et, j(g.resources.find((f) => f.id === g.activeChart)?.name || "Select Resource"), 1)
|
|
262
|
+
], 64)),
|
|
263
|
+
c(e(it), { class: "ml-auto size-4" })
|
|
264
|
+
]),
|
|
265
|
+
l("span", Pt, j(g.viewMode === "stacked" ? Object.values(g.totals).reduce((f, q) => f + q, 0).toLocaleString() : (g.totals[g.activeChart] || 0).toLocaleString()), 1)
|
|
266
|
+
], 40, Tt)) : Q("", !0),
|
|
267
|
+
e(d) ? (v(), W(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
|
+
c(Y, null, {
|
|
274
|
+
default: k(() => [
|
|
275
|
+
l("div", Ot, [
|
|
276
|
+
c(S, null, {
|
|
277
|
+
default: k(() => [
|
|
278
|
+
c(u, null, {
|
|
279
|
+
default: k(() => [...s[7] || (s[7] = [
|
|
280
|
+
Z("Resources", -1)
|
|
281
|
+
])]),
|
|
282
|
+
_: 1
|
|
283
|
+
}),
|
|
284
|
+
c(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
|
+
c($, null, {
|
|
294
|
+
default: k(() => [
|
|
295
|
+
c(A, {
|
|
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
|
+
c(e(be), { class: "size-3 text-muted-foreground" }),
|
|
303
|
+
l("span", jt, " All Resources (" + j(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(), W(A, {
|
|
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, j(f.name) + " (" + j((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(), W(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
|
+
c(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
|
+
c(U, { align: "end" }, {
|
|
348
|
+
default: k(() => [
|
|
349
|
+
c(O, null, {
|
|
350
|
+
default: k(() => [...s[10] || (s[10] = [
|
|
351
|
+
Z("Resources", -1)
|
|
352
|
+
])]),
|
|
353
|
+
_: 1
|
|
354
|
+
}),
|
|
355
|
+
l("div", Nt, [
|
|
356
|
+
c(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
|
+
c(e(be), { class: "size-3 text-muted-foreground" }),
|
|
364
|
+
l("span", null, " All Resources (" + j(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(), W(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", Ft, j(f.name), 1),
|
|
382
|
+
l("span", null, "(" + j((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__ */ de({
|
|
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), d = z([]), n = z([]), i = z(!0), s = z(a.viewMode || "stacked"), u = z(a.selectedResource || "");
|
|
418
|
+
K(s, (t) => {
|
|
419
|
+
x("update:viewMode", t);
|
|
420
|
+
}, { immediate: !0 }), K(u, (t) => {
|
|
421
|
+
x("update:selectedResource", s.value === "single" ? t : null);
|
|
422
|
+
}), K(s, (t) => {
|
|
423
|
+
x("update:selectedResource", t === "single" ? u.value : null);
|
|
424
|
+
}), K(() => 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()), A = z(null);
|
|
428
|
+
K(() => a.modelValue, (t) => {
|
|
429
|
+
t && t.getTime() !== S.value.getTime() && (S.value = t);
|
|
430
|
+
}), K(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 = A.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
|
+
}, O = () => {
|
|
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
|
+
K(() => 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, d.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, E = 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 F = o(ae.id, t);
|
|
510
|
+
if (F) {
|
|
511
|
+
if (F.isClosed)
|
|
512
|
+
return;
|
|
513
|
+
F.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 } = E.value;
|
|
528
|
+
for (let m = C; m < R; m += p) {
|
|
529
|
+
const te = Math.floor(m / 60), ae = m % 60, F = `${String(te).padStart(2, "0")}:${String(ae).padStart(2, "0")}`, J = {
|
|
530
|
+
time: F,
|
|
531
|
+
label: F
|
|
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 F of a.resources || []) {
|
|
544
|
+
const J = R?.[F.id] || {};
|
|
545
|
+
Object.entries(J).forEach(([D, w]) => {
|
|
546
|
+
const [ee, me] = D.split("-");
|
|
547
|
+
n.value.push({
|
|
548
|
+
resourceId: F.id,
|
|
549
|
+
startTime: ee,
|
|
550
|
+
endTime: me,
|
|
551
|
+
reserved: w
|
|
552
|
+
});
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
const m = G(), te = L.value, { startMinutes: ae } = E.value;
|
|
556
|
+
n.value.forEach((F) => {
|
|
557
|
+
const J = r(F.startTime), D = r(F.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][F.resourceId];
|
|
562
|
+
typeof me == "number" && (m[ee][F.resourceId] = me + (F.reserved || 0));
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
}), d.value = m;
|
|
566
|
+
} catch (t) {
|
|
567
|
+
console.error("Error loading reservation data:", t), d.value = G(), n.value = [];
|
|
568
|
+
} finally {
|
|
569
|
+
i.value = !1;
|
|
570
|
+
}
|
|
571
|
+
};
|
|
572
|
+
return (async () => await H())(), K(S, () => {
|
|
573
|
+
H();
|
|
574
|
+
}), K(() => 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"), F = V("CardContent"), J = V("Card");
|
|
578
|
+
return v(), W(J, { class: "py-4 sm:py-0" }, {
|
|
579
|
+
default: k(() => [
|
|
580
|
+
c(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
|
+
c(C, null, {
|
|
585
|
+
default: k(() => [...p[3] || (p[3] = [
|
|
586
|
+
Z("Reservations", -1)
|
|
587
|
+
])]),
|
|
588
|
+
_: 1
|
|
589
|
+
}),
|
|
590
|
+
l("div", Ht, [
|
|
591
|
+
c(R, {
|
|
592
|
+
variant: "outline",
|
|
593
|
+
size: "icon",
|
|
594
|
+
class: "size-8",
|
|
595
|
+
onClick: P
|
|
596
|
+
}, {
|
|
597
|
+
default: k(() => [
|
|
598
|
+
c(e(lt), { size: 16 })
|
|
599
|
+
]),
|
|
600
|
+
_: 1
|
|
601
|
+
}),
|
|
602
|
+
c(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
|
+
c(R, {
|
|
614
|
+
variant: "outline",
|
|
615
|
+
size: "icon",
|
|
616
|
+
class: "size-8",
|
|
617
|
+
onClick: O
|
|
618
|
+
}, {
|
|
619
|
+
default: k(() => [
|
|
620
|
+
c(e(ct), { size: 16 })
|
|
621
|
+
]),
|
|
622
|
+
_: 1
|
|
623
|
+
})
|
|
624
|
+
])
|
|
625
|
+
]),
|
|
626
|
+
c(m, null, {
|
|
627
|
+
default: k(() => [
|
|
628
|
+
l("div", Ut, [
|
|
629
|
+
c(R, {
|
|
630
|
+
type: "button",
|
|
631
|
+
variant: "outline",
|
|
632
|
+
onClick: Y
|
|
633
|
+
}, {
|
|
634
|
+
default: k(() => [
|
|
635
|
+
c(e(dt), { class: "size-4" }),
|
|
636
|
+
Z(" " + j(e(ne)), 1)
|
|
637
|
+
]),
|
|
638
|
+
_: 1
|
|
639
|
+
}),
|
|
640
|
+
He(l("input", {
|
|
641
|
+
ref_key: "dateInputRef",
|
|
642
|
+
ref: A,
|
|
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(), W(Wt, {
|
|
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
|
+
c(F, { 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(), W(ae, {
|
|
674
|
+
key: 2,
|
|
675
|
+
config: e(f),
|
|
676
|
+
class: "aspect-auto h-[250px] w-full",
|
|
677
|
+
cursor: ""
|
|
678
|
+
}, {
|
|
679
|
+
default: k(() => [
|
|
680
|
+
c(e(Ie), {
|
|
681
|
+
data: e(d),
|
|
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(), W(e(Ee), {
|
|
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
|
+
c(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(d)[D]?.time || ""
|
|
702
|
+
}, null, 8, ["x", "tick-values", "tick-format"]),
|
|
703
|
+
c(e(fe), {
|
|
704
|
+
type: "y",
|
|
705
|
+
"num-ticks": 3,
|
|
706
|
+
"tick-line": !1,
|
|
707
|
+
"domain-line": !1
|
|
708
|
+
}),
|
|
709
|
+
c(e(Te)),
|
|
710
|
+
c(e(Ae), {
|
|
711
|
+
template: e(Me)(e(f), e(Re), {
|
|
712
|
+
labelFormatter(D) {
|
|
713
|
+
const w = Math.round(D);
|
|
714
|
+
return w >= 0 && w < e(d).length && e(d)[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(), W(ae, {
|
|
725
|
+
key: e(u),
|
|
726
|
+
config: e(f),
|
|
727
|
+
class: "aspect-auto h-[250px] w-full",
|
|
728
|
+
cursor: ""
|
|
729
|
+
}, {
|
|
730
|
+
default: k(() => [
|
|
731
|
+
c(e(Ie), {
|
|
732
|
+
data: e(d),
|
|
733
|
+
margin: { left: -24 },
|
|
734
|
+
"y-domain": [0, e(U)]
|
|
735
|
+
}, {
|
|
736
|
+
default: k(() => [
|
|
737
|
+
c(e(Ee), {
|
|
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
|
+
c(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(d)[D]?.time || ""
|
|
752
|
+
}, null, 8, ["x", "tick-values", "tick-format"]),
|
|
753
|
+
c(e(fe), {
|
|
754
|
+
type: "y",
|
|
755
|
+
"num-ticks": 3,
|
|
756
|
+
"tick-line": !1,
|
|
757
|
+
"domain-line": !1
|
|
758
|
+
}),
|
|
759
|
+
c(e(Te)),
|
|
760
|
+
c(e(Ae), {
|
|
761
|
+
template: e(Me)(e(f), e(Re), {
|
|
762
|
+
labelFormatter(D) {
|
|
763
|
+
const w = Math.round(D);
|
|
764
|
+
return w >= 0 && w < e(d).length && e(d)[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
|
+
}), Kt = /* @__PURE__ */ bt(Jt, [["__scopeId", "data-v-62490f67"]]), Qt = { 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" }, ca = { class: "font-medium" }, da = { 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__ */ de({
|
|
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), d = z([]), n = z(!0), i = z(""), s = z(null), u = z(null), I = N(() => a.agendaData?.metadataSchema || []), S = N(() => ({
|
|
830
|
+
date: A(a.activeDate),
|
|
831
|
+
resource: null
|
|
832
|
+
}));
|
|
833
|
+
qe("event", S);
|
|
834
|
+
const A = (r) => {
|
|
835
|
+
const o = r.getFullYear(), E = String(r.getMonth() + 1).padStart(2, "0"), G = String(r.getDate()).padStart(2, "0");
|
|
836
|
+
return `${o}-${E}-${G}`;
|
|
837
|
+
}, $ = N(() => {
|
|
838
|
+
let r = d.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((E) => E.item)), r;
|
|
850
|
+
}), Y = N(() => $.value.filter((r) => M.value.includes(r.reservationStatus))), ne = N(() => {
|
|
851
|
+
let r = JSON.parse(JSON.stringify(d.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: d.value.reduce((r, o) => r + (o.spots || 0), 0),
|
|
855
|
+
bookings: d.value.length
|
|
856
|
+
})), O = () => {
|
|
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, E = 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: E,
|
|
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 Oe(), 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 E = { ...o, id: o.id || r }, G = (E.reservations || []).map((H) => L(E, H));
|
|
903
|
+
G.length && (await f(), u.value?.openDialog({
|
|
904
|
+
id: E.id,
|
|
905
|
+
customerInfo: E.customerInfo,
|
|
906
|
+
status: E.status,
|
|
907
|
+
createdAt: E.createdAt,
|
|
908
|
+
metadata: E.metadata || {},
|
|
909
|
+
reservations: G,
|
|
910
|
+
adjustments: E.adjustments || [],
|
|
911
|
+
totalPrice: typeof E.total == "number" ? E.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, d.value = [];
|
|
918
|
+
try {
|
|
919
|
+
const r = y.value.id, o = A(a.activeDate), E = /* @__PURE__ */ new Set();
|
|
920
|
+
a.resources?.forEach((B) => {
|
|
921
|
+
const t = `${B.id}_${o}`;
|
|
922
|
+
E.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(E) }
|
|
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
|
+
}), d.value = H.sort((B, t) => B.startTime?.localeCompare(t.startTime || "") || 0);
|
|
937
|
+
} catch (r) {
|
|
938
|
+
console.error("Error loading orders:", r), d.value = [];
|
|
939
|
+
} finally {
|
|
940
|
+
n.value = !1;
|
|
941
|
+
}
|
|
942
|
+
};
|
|
943
|
+
return (async () => await X())(), K(() => a.activeDate, () => {
|
|
944
|
+
X();
|
|
945
|
+
}), (r, o) => {
|
|
946
|
+
const E = 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(), W(R, null, {
|
|
948
|
+
default: k(() => [
|
|
949
|
+
c(t, null, {
|
|
950
|
+
default: k(() => [
|
|
951
|
+
l("div", Qt, [
|
|
952
|
+
l("div", null, [
|
|
953
|
+
c(G, { class: "flex items-center gap-2" }, {
|
|
954
|
+
default: k(() => [
|
|
955
|
+
o[9] || (o[9] = Z(" Bookings ", -1)),
|
|
956
|
+
e(P).bookings > 0 ? (v(), W(E, {
|
|
957
|
+
key: 0,
|
|
958
|
+
variant: "secondary"
|
|
959
|
+
}, {
|
|
960
|
+
default: k(() => [
|
|
961
|
+
Z(j(e(P).bookings), 1)
|
|
962
|
+
]),
|
|
963
|
+
_: 1
|
|
964
|
+
})) : Q("", !0)
|
|
965
|
+
]),
|
|
966
|
+
_: 1
|
|
967
|
+
}),
|
|
968
|
+
c(H, { class: "flex items-center gap-2 mt-1" }, {
|
|
969
|
+
default: k(() => [
|
|
970
|
+
c(e(Ve), { size: 14 }),
|
|
971
|
+
l("span", null, j(e(P).spots) + " total spots", 1)
|
|
972
|
+
]),
|
|
973
|
+
_: 1
|
|
974
|
+
})
|
|
975
|
+
]),
|
|
976
|
+
c(B, {
|
|
977
|
+
variant: "ghost",
|
|
978
|
+
size: "icon",
|
|
979
|
+
onClick: X,
|
|
980
|
+
disabled: e(n)
|
|
981
|
+
}, {
|
|
982
|
+
default: k(() => [
|
|
983
|
+
c(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
|
+
c(C, null, {
|
|
995
|
+
default: k(() => [
|
|
996
|
+
l("div", Zt, [
|
|
997
|
+
c(e(mt), {
|
|
998
|
+
size: 16,
|
|
999
|
+
class: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"
|
|
1000
|
+
}),
|
|
1001
|
+
c(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(), W(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: O
|
|
1013
|
+
}, {
|
|
1014
|
+
default: k(() => [
|
|
1015
|
+
c(e(pt), { size: 14 })
|
|
1016
|
+
]),
|
|
1017
|
+
_: 1
|
|
1018
|
+
})) : Q("", !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)) : Q("", !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 " + j(e($).length) + " of " + j(e(d).length) + " bookings ", 1)) : Q("", !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(), W(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
|
+
})) : Q("", !0),
|
|
1053
|
+
g.selectedResource !== null ? (v(), W(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
|
+
})) : Q("", !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", ca, j(m.customerInfo.firstName + " " + m.customerInfo.lastName || "Unknown Customer"), 1),
|
|
1071
|
+
l("div", da, j(m.customerInfo?.email), 1),
|
|
1072
|
+
l("div", ua, j(m.customerInfo?.phone), 1),
|
|
1073
|
+
l("div", ma, [
|
|
1074
|
+
l("div", pa, [
|
|
1075
|
+
c(e(ft), { size: 12 }),
|
|
1076
|
+
l("span", null, j(m.startTime) + " - " + j(m.endTime), 1)
|
|
1077
|
+
]),
|
|
1078
|
+
l("div", fa, [
|
|
1079
|
+
c(e(Ve), { size: 12 }),
|
|
1080
|
+
l("span", null, j(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, j(m.resourceName), 1)
|
|
1088
|
+
])) : Q("", !0)
|
|
1089
|
+
]),
|
|
1090
|
+
c(_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, " €" + j(m.reservationPrice.toFixed(2)), 1)) : Q("", !0)
|
|
1101
|
+
])
|
|
1102
|
+
])
|
|
1103
|
+
], 8, ra))), 128))
|
|
1104
|
+
]))
|
|
1105
|
+
]),
|
|
1106
|
+
_: 1
|
|
1107
|
+
}),
|
|
1108
|
+
c(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
|
+
c(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" }, Wa = /* @__PURE__ */ de({
|
|
1130
|
+
__name: "index",
|
|
1131
|
+
setup(g) {
|
|
1132
|
+
const { hasPermission: h } = Ye(), { params: a, resolvePath: x } = _e(), { config: y } = De(), b = Se(y.project), _ = z(""), d = 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 A = await b.get(y.agendaCollection, a.value.id);
|
|
1136
|
+
_.value = A?.serviceName || "", u.value = A, I.value = A?.resources?.filter(($) => $.isActive) || [];
|
|
1137
|
+
} catch (A) {
|
|
1138
|
+
console.error("Error loading data:", A);
|
|
1139
|
+
} finally {
|
|
1140
|
+
d.value = !1;
|
|
1141
|
+
}
|
|
1142
|
+
})(), (A, $) => (v(), W(Xe, null, {
|
|
1143
|
+
default: k(() => [
|
|
1144
|
+
l("div", Sa, [
|
|
1145
|
+
l("div", wa, [
|
|
1146
|
+
l("div", null, [
|
|
1147
|
+
l("h1", Ca, j(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(), W(wt, {
|
|
1152
|
+
key: 0,
|
|
1153
|
+
"agenda-data": e(u)
|
|
1154
|
+
}, null, 8, ["agenda-data"])) : Q("", !0)
|
|
1155
|
+
])
|
|
1156
|
+
]),
|
|
1157
|
+
c(Kt, {
|
|
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(), W(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"])) : Q("", !0)
|
|
1177
|
+
])
|
|
1178
|
+
])
|
|
1179
|
+
])
|
|
1180
|
+
]),
|
|
1181
|
+
_: 1
|
|
1182
|
+
}));
|
|
1183
|
+
}
|
|
1184
|
+
});
|
|
1185
|
+
export {
|
|
1186
|
+
Wa as default
|
|
1187
|
+
};
|