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