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