@oneclick.dev/cms-core-modules 0.0.118 → 0.0.120
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-Cm28u_14.mjs → ContentEditor-W4YrQyBW.mjs} +3962 -3700
- package/dist/{ContentEditor-BnOVpmsQ.js → ContentEditor-YFnqVZrX.js} +42 -41
- package/dist/{EditLayout.vue_vue_type_script_setup_true_lang-pDO9b4Pv.mjs → EditLayout.vue_vue_type_script_setup_true_lang-BXVf9gZW.mjs} +20 -20
- package/dist/{EditLayout.vue_vue_type_script_setup_true_lang-gozJKXvM.js → EditLayout.vue_vue_type_script_setup_true_lang-CFFZ6r8i.js} +1 -1
- 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-Tf_ApkWh.js +1 -0
- package/dist/{Overview-CVQ1pkuD.mjs → Overview-usm5gPD1.mjs} +131 -131
- package/dist/{TableView-BQI3CWll.mjs → TableView-Ctnep-Qu.mjs} +1174 -1161
- package/dist/TableView-DJqyJL9L.js +4 -0
- package/dist/{agenda-Dcsc3QHj.js → agenda-BusN9-XG.js} +1 -1
- package/dist/{agenda-DyTpFZfY.mjs → agenda-CJXKaIo0.mjs} +7 -7
- package/dist/{availability-D8JdA4rP.mjs → availability-BP6GACqo.mjs} +1 -1
- package/dist/{availability-ClBGVgE9.js → availability-UUKdgidr.js} +1 -1
- package/dist/{booking-data-aMS1p_3g.js → booking-data-BHfLyOlu.js} +1 -1
- package/dist/{booking-data-Px7XCIfU.mjs → booking-data-WCBcpOOo.mjs} +1 -1
- package/dist/cms-core-modules.css +1 -1
- package/dist/{exceptions-Dgj54ULn.mjs → exceptions-B8r2psu2.mjs} +1 -1
- package/dist/{exceptions-DXqc0Nza.js → exceptions-BazAiy2s.js} +1 -1
- package/dist/index-BiKWKrEs.js +35 -0
- package/dist/index-DJxex3Dt.mjs +1256 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.mjs +12 -12
- package/dist/{orders-C5NT99Fy.mjs → orders-B8C6u4iF.mjs} +229 -234
- package/dist/orders-CAAuDhkQ.js +1 -0
- package/dist/{payment-D5j-68Ig.mjs → payment-BOOJ1O6M.mjs} +1 -1
- package/dist/{payment-BJHgpaeT.js → payment-IxA9qiCV.js} +1 -1
- package/dist/{refunds-D9nTeD2d.mjs → refunds-CI0qpJC0.mjs} +1 -1
- package/dist/{refunds-oVB2Opib.js → refunds-CqGKm1NG.js} +1 -1
- package/dist/{resources-8WouFvJe.js → resources-B75nXreU.js} +1 -1
- package/dist/{resources-CK0oWssj.mjs → resources-dIZDh4Sz.mjs} +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/shims-vue.d.ts +6 -0
- package/dist/src/table/components/DataTableAction.vue.d.ts +1 -0
- package/dist/src/table/flow-builder-extensions/row-item.d.ts +5 -5
- package/package.json +2 -2
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BXTkYCm_.mjs +0 -1476
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-C2zwt5UF.js +0 -1
- package/dist/Overview-CBahJviK.js +0 -1
- package/dist/TableView-Cwal0BPW.js +0 -4
- package/dist/index-g1jAGZGc.mjs +0 -1261
- package/dist/index-yrUH3zmq.js +0 -35
- package/dist/orders-lO3dZ5un.js +0 -1
|
@@ -0,0 +1,1500 @@
|
|
|
1
|
+
import { defineComponent as De, ref as U, reactive as Ue, computed as re, watch as Re, resolveComponent as h, openBlock as i, createElementBlock as p, createElementVNode as f, Fragment as te, renderList as pe, normalizeClass as he, createVNode as r, withCtx as c, createTextVNode as w, toDisplayString as k, createCommentVNode as W, createBlock as be, onMounted as Ee, onBeforeUnmount as ze, nextTick as Le, unref as g, isRef as we, markRaw as Be, inject as qe } from "vue";
|
|
2
|
+
import { CalendarIcon as je, ChevronLeft as He, Check as Qe, ChevronRight as Ye, X as We, Zap as Ge, Plus as Pe, Pencil as Xe, Users as Ze, Tag as Je, Trash2 as Me } from "lucide-vue-next";
|
|
3
|
+
import { useModuleRoute as Ke, useModule as et, useLogs as tt, useFirebaseIntegration as nt } from "@oneclick.dev/cms-kit";
|
|
4
|
+
import { c as Oe } from "./utils-CanmrIWO.mjs";
|
|
5
|
+
import { $ as st, a as Ae, b as Ve } from "./DateFormatter-BkKoSf_l.mjs";
|
|
6
|
+
import { _ as at } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
7
|
+
const ot = { class: "space-y-3" }, rt = { class: "grid gap-4 @md/modal:grid-cols-2 @2xl/modal:grid-cols-3 @4xl/modal:grid-cols-4 overflow-hidden p-1" }, it = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "flex items-center gap-3 min-h-9"
|
|
10
|
+
}, lt = {
|
|
11
|
+
key: 0,
|
|
12
|
+
class: "italic text-xs opacity-50"
|
|
13
|
+
}, ut = {
|
|
14
|
+
key: 0,
|
|
15
|
+
class: "italic text-xs opacity-50"
|
|
16
|
+
}, dt = {
|
|
17
|
+
key: 0,
|
|
18
|
+
class: "italic text-xs opacity-50"
|
|
19
|
+
}, ct = {
|
|
20
|
+
key: 0,
|
|
21
|
+
class: "italic text-xs opacity-50"
|
|
22
|
+
}, pt = {
|
|
23
|
+
key: 0,
|
|
24
|
+
class: "text-red-400"
|
|
25
|
+
}, mt = { class: "list-disc pl-4" }, ft = /* @__PURE__ */ De({
|
|
26
|
+
__name: "CustomerInformation",
|
|
27
|
+
props: {
|
|
28
|
+
agendaData: {}
|
|
29
|
+
},
|
|
30
|
+
setup(z, { expose: X }) {
|
|
31
|
+
const A = [
|
|
32
|
+
{
|
|
33
|
+
id: "firstName",
|
|
34
|
+
fieldName: "First Name",
|
|
35
|
+
fieldType: "text",
|
|
36
|
+
required: !0,
|
|
37
|
+
visible: !0
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: "lastName",
|
|
41
|
+
fieldName: "Last Name",
|
|
42
|
+
fieldType: "text",
|
|
43
|
+
required: !0,
|
|
44
|
+
visible: !0
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
id: "phone",
|
|
48
|
+
fieldName: "Phone No",
|
|
49
|
+
fieldType: "tel",
|
|
50
|
+
required: !0,
|
|
51
|
+
visible: !0
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: "email",
|
|
55
|
+
fieldName: "Email",
|
|
56
|
+
fieldType: "email",
|
|
57
|
+
required: !0,
|
|
58
|
+
visible: !0
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: "birthDate",
|
|
62
|
+
fieldName: "Birth date",
|
|
63
|
+
fieldType: "date",
|
|
64
|
+
required: !0,
|
|
65
|
+
visible: !0
|
|
66
|
+
}
|
|
67
|
+
], Q = /* @__PURE__ */ new Set(["firstName", "email"]), ue = z, B = U([]), O = Ue({}), F = re(() => {
|
|
68
|
+
const v = ue.agendaData?.customerInformationFields, x = (Array.isArray(v) && v.length > 0 ? v : A).filter((C) => C?.id && (C.visible !== !1 || Q.has(C.id))).map((C) => ({
|
|
69
|
+
...C,
|
|
70
|
+
required: Q.has(C.id),
|
|
71
|
+
visible: !0
|
|
72
|
+
})), D = A.filter((C) => Q.has(C.id) && !x.some((le) => le.id === C.id)).map((C) => ({
|
|
73
|
+
...C,
|
|
74
|
+
required: !0,
|
|
75
|
+
visible: !0
|
|
76
|
+
}));
|
|
77
|
+
return [...x, ...D];
|
|
78
|
+
}), E = (v) => v.fieldName || v.id, q = (v) => v.replace(/[^A-Za-z0-9_-]/g, "-"), $ = (v, N) => ["new-res-customer-info", v.id, N].filter(Boolean).map((D) => q(D)).join("-"), M = (v) => v.fieldType === "email" || v.fieldType === "tel" || v.fieldType === "date" ? v.fieldType : "text", Y = (v) => Array.isArray(v.options) ? v.options.filter(Boolean) : [], H = (v) => v.fieldType === "checkbox" ? !1 : "", L = (v = !1) => {
|
|
79
|
+
const N = new Set(F.value.map((x) => x.id));
|
|
80
|
+
Object.keys(O).forEach((x) => {
|
|
81
|
+
N.has(x) || delete O[x];
|
|
82
|
+
}), F.value.forEach((x) => {
|
|
83
|
+
const D = H(x);
|
|
84
|
+
(v || O[x.id] === void 0 || typeof O[x.id] != typeof D) && (O[x.id] = D);
|
|
85
|
+
});
|
|
86
|
+
}, K = () => {
|
|
87
|
+
const v = F.value.reduce((N, x) => {
|
|
88
|
+
const D = O[x.id];
|
|
89
|
+
return N[x.id] = typeof D == "string" ? D.trim() : !!D, N;
|
|
90
|
+
}, {});
|
|
91
|
+
return Object.entries(v).forEach(([N, x]) => {
|
|
92
|
+
O[N] = x;
|
|
93
|
+
}), v;
|
|
94
|
+
}, T = (v, N) => v.fieldType === "checkbox" ? N === !0 : typeof N == "string" ? N.trim().length > 0 : N != null, ie = () => {
|
|
95
|
+
B.value = [], L(!0);
|
|
96
|
+
}, Z = () => {
|
|
97
|
+
const v = [], N = K();
|
|
98
|
+
return F.value.forEach((x) => {
|
|
99
|
+
const D = N[x.id], C = E(x);
|
|
100
|
+
x.required && !T(x, D) && v.push(`Please fill in ${C}.`), x.fieldType === "email" && T(x, D) && typeof D == "string" && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(D) === !1 && v.push(`Please fill in a correct ${C}.`);
|
|
101
|
+
}), B.value = v, v.length === 0;
|
|
102
|
+
};
|
|
103
|
+
return Re(F, () => {
|
|
104
|
+
L();
|
|
105
|
+
}, { immediate: !0 }), X({
|
|
106
|
+
getCustomerInfo: K,
|
|
107
|
+
reset: ie,
|
|
108
|
+
validateForm: Z
|
|
109
|
+
}), (v, N) => {
|
|
110
|
+
const x = h("Checkbox"), D = h("Label"), C = h("SelectValue"), le = h("SelectTrigger"), ve = h("SelectItem"), ye = h("SelectGroup"), me = h("SelectContent"), de = h("Select"), fe = h("RadioGroupItem"), ae = h("RadioGroup"), ge = h("Input");
|
|
111
|
+
return i(), p("div", ot, [
|
|
112
|
+
N[0] || (N[0] = f("h2", { class: "text-sm font-medium" }, "Customer Information", -1)),
|
|
113
|
+
f("div", rt, [
|
|
114
|
+
(i(!0), p(te, null, pe(F.value, (_) => (i(), p("div", {
|
|
115
|
+
key: _.id,
|
|
116
|
+
class: he(["grid gap-2", _.fieldType === "checkbox" ? "@md/modal:col-span-2" : ""])
|
|
117
|
+
}, [
|
|
118
|
+
_.fieldType === "checkbox" ? (i(), p("div", it, [
|
|
119
|
+
r(x, {
|
|
120
|
+
id: $(_),
|
|
121
|
+
modelValue: O[_.id],
|
|
122
|
+
"onUpdate:modelValue": (P) => O[_.id] = P
|
|
123
|
+
}, null, 8, ["id", "modelValue", "onUpdate:modelValue"]),
|
|
124
|
+
r(D, {
|
|
125
|
+
for: $(_),
|
|
126
|
+
class: "font-normal cursor-pointer"
|
|
127
|
+
}, {
|
|
128
|
+
default: c(() => [
|
|
129
|
+
w(k(E(_)) + " ", 1),
|
|
130
|
+
_.required ? W("", !0) : (i(), p("span", lt, "optional"))
|
|
131
|
+
]),
|
|
132
|
+
_: 2
|
|
133
|
+
}, 1032, ["for"])
|
|
134
|
+
])) : _.fieldType === "select" ? (i(), p(te, { key: 1 }, [
|
|
135
|
+
r(D, {
|
|
136
|
+
for: $(_)
|
|
137
|
+
}, {
|
|
138
|
+
default: c(() => [
|
|
139
|
+
w(k(E(_)) + " ", 1),
|
|
140
|
+
_.required ? W("", !0) : (i(), p("span", ut, "optional"))
|
|
141
|
+
]),
|
|
142
|
+
_: 2
|
|
143
|
+
}, 1032, ["for"]),
|
|
144
|
+
r(de, {
|
|
145
|
+
modelValue: O[_.id],
|
|
146
|
+
"onUpdate:modelValue": (P) => O[_.id] = P
|
|
147
|
+
}, {
|
|
148
|
+
default: c(() => [
|
|
149
|
+
r(le, {
|
|
150
|
+
id: $(_),
|
|
151
|
+
class: "w-full"
|
|
152
|
+
}, {
|
|
153
|
+
default: c(() => [
|
|
154
|
+
r(C, {
|
|
155
|
+
placeholder: `Select ${E(_)}`
|
|
156
|
+
}, null, 8, ["placeholder"])
|
|
157
|
+
]),
|
|
158
|
+
_: 2
|
|
159
|
+
}, 1032, ["id"]),
|
|
160
|
+
r(me, null, {
|
|
161
|
+
default: c(() => [
|
|
162
|
+
r(ye, null, {
|
|
163
|
+
default: c(() => [
|
|
164
|
+
(i(!0), p(te, null, pe(Y(_), (P) => (i(), be(ve, {
|
|
165
|
+
key: P,
|
|
166
|
+
value: P
|
|
167
|
+
}, {
|
|
168
|
+
default: c(() => [
|
|
169
|
+
w(k(P), 1)
|
|
170
|
+
]),
|
|
171
|
+
_: 2
|
|
172
|
+
}, 1032, ["value"]))), 128))
|
|
173
|
+
]),
|
|
174
|
+
_: 2
|
|
175
|
+
}, 1024)
|
|
176
|
+
]),
|
|
177
|
+
_: 2
|
|
178
|
+
}, 1024)
|
|
179
|
+
]),
|
|
180
|
+
_: 2
|
|
181
|
+
}, 1032, ["modelValue", "onUpdate:modelValue"])
|
|
182
|
+
], 64)) : _.fieldType === "radio" ? (i(), p(te, { key: 2 }, [
|
|
183
|
+
r(D, null, {
|
|
184
|
+
default: c(() => [
|
|
185
|
+
w(k(E(_)) + " ", 1),
|
|
186
|
+
_.required ? W("", !0) : (i(), p("span", dt, "optional"))
|
|
187
|
+
]),
|
|
188
|
+
_: 2
|
|
189
|
+
}, 1024),
|
|
190
|
+
r(ae, {
|
|
191
|
+
modelValue: O[_.id],
|
|
192
|
+
"onUpdate:modelValue": (P) => O[_.id] = P,
|
|
193
|
+
class: "grid gap-2"
|
|
194
|
+
}, {
|
|
195
|
+
default: c(() => [
|
|
196
|
+
(i(!0), p(te, null, pe(Y(_), (P) => (i(), p("div", {
|
|
197
|
+
key: P,
|
|
198
|
+
class: "flex items-center gap-2"
|
|
199
|
+
}, [
|
|
200
|
+
r(fe, {
|
|
201
|
+
id: $(_, P),
|
|
202
|
+
value: P
|
|
203
|
+
}, null, 8, ["id", "value"]),
|
|
204
|
+
r(D, {
|
|
205
|
+
for: $(_, P),
|
|
206
|
+
class: "font-normal cursor-pointer"
|
|
207
|
+
}, {
|
|
208
|
+
default: c(() => [
|
|
209
|
+
w(k(P), 1)
|
|
210
|
+
]),
|
|
211
|
+
_: 2
|
|
212
|
+
}, 1032, ["for"])
|
|
213
|
+
]))), 128))
|
|
214
|
+
]),
|
|
215
|
+
_: 2
|
|
216
|
+
}, 1032, ["modelValue", "onUpdate:modelValue"])
|
|
217
|
+
], 64)) : (i(), p(te, { key: 3 }, [
|
|
218
|
+
r(D, {
|
|
219
|
+
for: $(_)
|
|
220
|
+
}, {
|
|
221
|
+
default: c(() => [
|
|
222
|
+
w(k(E(_)) + " ", 1),
|
|
223
|
+
_.required ? W("", !0) : (i(), p("span", ct, "optional"))
|
|
224
|
+
]),
|
|
225
|
+
_: 2
|
|
226
|
+
}, 1032, ["for"]),
|
|
227
|
+
r(ge, {
|
|
228
|
+
modelValue: O[_.id],
|
|
229
|
+
"onUpdate:modelValue": (P) => O[_.id] = P,
|
|
230
|
+
id: $(_),
|
|
231
|
+
type: M(_),
|
|
232
|
+
autocomplete: "off"
|
|
233
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "id", "type"])
|
|
234
|
+
], 64))
|
|
235
|
+
], 2))), 128))
|
|
236
|
+
]),
|
|
237
|
+
B.value.length > 0 ? (i(), p("div", pt, [
|
|
238
|
+
f("ul", mt, [
|
|
239
|
+
(i(!0), p(te, null, pe(B.value, (_) => (i(), p("li", { key: _ }, k(_), 1))), 128))
|
|
240
|
+
])
|
|
241
|
+
])) : W("", !0)
|
|
242
|
+
]);
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
function gt(z = {}) {
|
|
247
|
+
const X = U(null), A = U(!1), Q = U(!1), ue = U(!1), B = U(!1), O = z.dragSpeed ?? 1.1, F = z.dragThreshold ?? 10, E = z.edgeThreshold ?? 10, q = z.ignoreDragSelector ?? 'input, select, textarea, [contenteditable="true"], [data-horizontal-scroll-ignore-drag]';
|
|
248
|
+
let $ = null, M = 0, Y = 0, H = !1, L = null, K = null, T = null;
|
|
249
|
+
const ie = () => {
|
|
250
|
+
L === null || typeof window > "u" || (window.clearTimeout(L), L = null);
|
|
251
|
+
}, Z = () => {
|
|
252
|
+
const a = X.value;
|
|
253
|
+
if (!a) {
|
|
254
|
+
Q.value = !1, ue.value = !1, B.value = !1;
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
const l = Math.max(a.scrollWidth - a.clientWidth, 0);
|
|
258
|
+
Q.value = l > E, ue.value = Q.value && a.scrollLeft > E, B.value = Q.value && a.scrollLeft < l - E;
|
|
259
|
+
}, v = () => {
|
|
260
|
+
Le(() => {
|
|
261
|
+
if (typeof window > "u") {
|
|
262
|
+
Z();
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
window.requestAnimationFrame(() => Z());
|
|
266
|
+
});
|
|
267
|
+
}, N = () => {
|
|
268
|
+
if (typeof z.scrollStep == "number") return z.scrollStep;
|
|
269
|
+
const a = X.value;
|
|
270
|
+
return a ? Math.max(Math.floor(a.clientWidth * 0.72), 180) : 240;
|
|
271
|
+
}, x = (a, l = "smooth") => {
|
|
272
|
+
const I = X.value;
|
|
273
|
+
if (I) {
|
|
274
|
+
if (I.scrollBy({ left: a, behavior: l }), l === "auto") {
|
|
275
|
+
Z();
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
v();
|
|
279
|
+
}
|
|
280
|
+
}, D = () => {
|
|
281
|
+
x(-N());
|
|
282
|
+
}, C = () => {
|
|
283
|
+
x(N());
|
|
284
|
+
}, le = () => {
|
|
285
|
+
const a = X.value;
|
|
286
|
+
$ !== null && a?.hasPointerCapture?.($) && a.releasePointerCapture($), A.value && (H = !0, ie(), typeof window < "u" && (L = window.setTimeout(() => {
|
|
287
|
+
H = !1, L = null;
|
|
288
|
+
}, 0))), $ = null, A.value = !1, a && (a.style.userSelect = "", a.style.cursor = ""), Z();
|
|
289
|
+
}, ve = () => {
|
|
290
|
+
Z();
|
|
291
|
+
}, ye = (a) => {
|
|
292
|
+
const l = X.value;
|
|
293
|
+
if (!l || !Q.value || Math.abs(a.deltaY) <= Math.abs(a.deltaX)) return;
|
|
294
|
+
const I = a.deltaY < 0, oe = a.deltaY > 0;
|
|
295
|
+
I && !ue.value || oe && !B.value || (a.preventDefault(), l.scrollLeft += a.deltaY, Z());
|
|
296
|
+
}, me = (a) => a instanceof Element ? !!a.closest(q) : !1, de = (a) => {
|
|
297
|
+
const l = X.value;
|
|
298
|
+
!l || !Q.value || a.pointerType !== "touch" && a.button === 0 && (me(a.target) || ($ = a.pointerId, M = a.clientX, Y = l.scrollLeft, H = !1));
|
|
299
|
+
}, fe = (a) => {
|
|
300
|
+
const l = X.value;
|
|
301
|
+
if (!l || $ !== a.pointerId) return;
|
|
302
|
+
const I = a.clientX - M;
|
|
303
|
+
!A.value && Math.abs(I) < F || (A.value || (A.value = !0, l.style.userSelect = "none", l.style.cursor = "grabbing", l.setPointerCapture?.(a.pointerId)), a.preventDefault(), l.scrollLeft = Y - I * O, Z());
|
|
304
|
+
}, ae = (a) => {
|
|
305
|
+
$ === a.pointerId && le();
|
|
306
|
+
}, ge = () => {
|
|
307
|
+
$ !== null && le();
|
|
308
|
+
}, _ = (a) => {
|
|
309
|
+
H && (a.preventDefault(), a.stopPropagation(), H = !1);
|
|
310
|
+
}, P = (a) => {
|
|
311
|
+
typeof ResizeObserver < "u" && (K = new ResizeObserver(() => Z()), K.observe(a)), z.observeMutations !== !1 && typeof MutationObserver < "u" && (T = new MutationObserver(() => v()), T.observe(a, {
|
|
312
|
+
childList: !0,
|
|
313
|
+
subtree: !0,
|
|
314
|
+
characterData: !0
|
|
315
|
+
}));
|
|
316
|
+
}, J = () => {
|
|
317
|
+
K?.disconnect(), T?.disconnect(), K = null, T = null;
|
|
318
|
+
}, ke = (a) => {
|
|
319
|
+
a.addEventListener("scroll", ve), a.addEventListener("wheel", ye, { passive: !1 }), a.addEventListener("pointerdown", de), a.addEventListener("pointermove", fe), a.addEventListener("pointerup", ae), a.addEventListener("pointercancel", ge), a.addEventListener("lostpointercapture", ge), a.addEventListener("click", _, !0), P(a), v();
|
|
320
|
+
}, xe = (a) => {
|
|
321
|
+
a.removeEventListener("scroll", ve), a.removeEventListener("wheel", ye), a.removeEventListener("pointerdown", de), a.removeEventListener("pointermove", fe), a.removeEventListener("pointerup", ae), a.removeEventListener("pointercancel", ge), a.removeEventListener("lostpointercapture", ge), a.removeEventListener("click", _, !0), J();
|
|
322
|
+
};
|
|
323
|
+
return Re(X, (a, l) => {
|
|
324
|
+
l && xe(l), a ? ke(a) : Z();
|
|
325
|
+
}), Ee(() => {
|
|
326
|
+
v();
|
|
327
|
+
}), ze(() => {
|
|
328
|
+
ie(), X.value && xe(X.value), H = !1, le();
|
|
329
|
+
}), {
|
|
330
|
+
canScrollLeft: re(() => ue.value),
|
|
331
|
+
canScrollRight: re(() => B.value),
|
|
332
|
+
containerRef: X,
|
|
333
|
+
isDragging: A,
|
|
334
|
+
isScrollable: Q,
|
|
335
|
+
refresh: v,
|
|
336
|
+
scrollNext: C,
|
|
337
|
+
scrollPrev: D,
|
|
338
|
+
showLeftShadow: ue,
|
|
339
|
+
showRightShadow: B
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "text-sm font-medium" }, ht = {
|
|
343
|
+
key: 0,
|
|
344
|
+
class: "mt-1 text-xs text-muted-foreground"
|
|
345
|
+
}, bt = { class: "grid gap-4 @md/quick-adder:grid-cols-2 @2xl/quick-adder:grid-cols-3 @4xl/quick-adder:grid-cols-4" }, yt = { class: "grid gap-2" }, xt = {
|
|
346
|
+
key: 0,
|
|
347
|
+
class: "grid gap-2"
|
|
348
|
+
}, St = {
|
|
349
|
+
key: 1,
|
|
350
|
+
class: "grid gap-2"
|
|
351
|
+
}, kt = {
|
|
352
|
+
key: 2,
|
|
353
|
+
class: "grid gap-2"
|
|
354
|
+
}, $t = { class: "grid gap-2" }, Tt = { class: "grid gap-2" }, It = {
|
|
355
|
+
key: 0,
|
|
356
|
+
class: "rounded-md border border-dashed bg-muted/20 px-4 py-4 text-sm text-muted-foreground"
|
|
357
|
+
}, Rt = {
|
|
358
|
+
key: 1,
|
|
359
|
+
class: "relative flex items-center gap-2 overflow-hidden"
|
|
360
|
+
}, wt = { class: "relative min-w-0 flex-1 overflow-hidden" }, Dt = {
|
|
361
|
+
key: 0,
|
|
362
|
+
class: "pointer-events-none absolute inset-y-0 left-0 z-10 w-10 md:w-20 bg-gradient-to-r from-background via-background/95 to-transparent"
|
|
363
|
+
}, Ct = {
|
|
364
|
+
key: 1,
|
|
365
|
+
class: "pointer-events-none absolute inset-y-0 right-0 z-10 w-10 md:w-20 bg-gradient-to-l from-background via-background/95 to-transparent"
|
|
366
|
+
}, Nt = {
|
|
367
|
+
key: 0,
|
|
368
|
+
class: "absolute -top-1 -right-1 flex items-center justify-center bg-primary rounded-full text-background size-4"
|
|
369
|
+
}, Ot = { class: "flex flex-wrap gap-2" }, Vt = ["onClick"], Mt = { key: 0 }, At = { key: 1 }, Ft = { key: 2 }, Et = /* @__PURE__ */ De({
|
|
370
|
+
__name: "QuickReservationAdder",
|
|
371
|
+
props: {
|
|
372
|
+
agendaData: {},
|
|
373
|
+
surface: { default: "card" }
|
|
374
|
+
},
|
|
375
|
+
emits: ["add"],
|
|
376
|
+
setup(z, { emit: X }) {
|
|
377
|
+
const A = z, Q = X, ue = new st("en-US", {
|
|
378
|
+
dateStyle: "long"
|
|
379
|
+
}), B = Ae(Ve()), O = re(() => A.surface === "popover"), F = U(""), E = U(void 0), q = U(""), $ = U(""), M = U([]), Y = U(1), H = U(0), L = re(() => A.agendaData?.resources?.find((a) => a.id === q.value)), K = (a) => {
|
|
380
|
+
const [l, I] = a.split(":").map(Number);
|
|
381
|
+
return l * 60 + I;
|
|
382
|
+
}, T = (a) => {
|
|
383
|
+
const l = Math.floor(a / 60), I = a % 60;
|
|
384
|
+
return `${l.toString().padStart(2, "0")}:${I.toString().padStart(2, "0")}`;
|
|
385
|
+
}, ie = () => {
|
|
386
|
+
if (!L.value) return [];
|
|
387
|
+
const a = L.value.interval || 60;
|
|
388
|
+
let l = null, I = null;
|
|
389
|
+
for (const s of Object.values(L.value.openingHours || {}))
|
|
390
|
+
for (const n of s) {
|
|
391
|
+
const m = K(n.start), S = K(n.end);
|
|
392
|
+
(l === null || m < l) && (l = m), (I === null || S > I) && (I = S);
|
|
393
|
+
}
|
|
394
|
+
if (l === null || I === null) return [];
|
|
395
|
+
const oe = [];
|
|
396
|
+
for (let s = l; s < I; s += a)
|
|
397
|
+
oe.push(T(s));
|
|
398
|
+
return oe;
|
|
399
|
+
}, Z = re(() => {
|
|
400
|
+
const a = Number(H.value);
|
|
401
|
+
return E.value && q.value && $.value && M.value.length > 0 && Number.isFinite(a) && a >= 0;
|
|
402
|
+
}), v = re(() => ie()), {
|
|
403
|
+
canScrollLeft: N,
|
|
404
|
+
canScrollRight: x,
|
|
405
|
+
containerRef: D,
|
|
406
|
+
isDragging: C,
|
|
407
|
+
isScrollable: le,
|
|
408
|
+
scrollNext: ve,
|
|
409
|
+
scrollPrev: ye,
|
|
410
|
+
showLeftShadow: me,
|
|
411
|
+
showRightShadow: de
|
|
412
|
+
} = gt(), fe = (a) => M.value.includes(a), ae = (a) => {
|
|
413
|
+
if (fe(a)) {
|
|
414
|
+
M.value = M.value.filter((l) => l !== a);
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
M.value = [...M.value, a].sort((l, I) => K(l) - K(I));
|
|
418
|
+
}, ge = (a, l) => {
|
|
419
|
+
E.value = a ? Be(a) : void 0, F.value = a ? `${a}` : "", l();
|
|
420
|
+
}, _ = U(""), P = U(""), J = U([]), ke = () => {
|
|
421
|
+
Q("add", {
|
|
422
|
+
date: E.value,
|
|
423
|
+
resourceId: q.value,
|
|
424
|
+
pricingOptionId: $.value,
|
|
425
|
+
startTimes: M.value,
|
|
426
|
+
spots: Y.value,
|
|
427
|
+
paid: Number(H.value) || 0
|
|
428
|
+
}), M.value = [], J.value = [], P.value = "", _.value = "";
|
|
429
|
+
}, xe = () => {
|
|
430
|
+
F.value = B.toString(), E.value = B, q.value = A.agendaData?.resources?.[0]?.id || "", $.value = A.agendaData?.pricingOptions?.find((a) => a.isDefault)?.id || A.agendaData?.pricingOptions?.[0]?.id || "", M.value = [], Y.value = 1, H.value = 0, _.value = "";
|
|
431
|
+
};
|
|
432
|
+
return Ee(() => {
|
|
433
|
+
xe();
|
|
434
|
+
}), (a, l) => {
|
|
435
|
+
const I = h("Label"), oe = h("Button"), s = h("PopoverTrigger"), n = h("Calendar"), m = h("PopoverContent"), S = h("Popover"), V = h("DynamicSelectOption"), ne = h("DynamicSelect"), ee = h("Input");
|
|
436
|
+
return i(), p("div", {
|
|
437
|
+
class: he(g(Oe)(
|
|
438
|
+
"@container/quick-adder grid gap-4 overflow-hidden bg-background",
|
|
439
|
+
g(O) ? "p-5 sm:p-6" : "rounded-md border p-4"
|
|
440
|
+
))
|
|
441
|
+
}, [
|
|
442
|
+
f("div", vt, [
|
|
443
|
+
f("div", null, [
|
|
444
|
+
f("h3", _t, k(g(O) ? "Quick add reservations" : "Add reservations"), 1),
|
|
445
|
+
g(O) ? (i(), p("p", ht, " Choose one date and add multiple timeslots in one pass. ")) : W("", !0)
|
|
446
|
+
])
|
|
447
|
+
]),
|
|
448
|
+
f("div", bt, [
|
|
449
|
+
f("div", yt, [
|
|
450
|
+
r(I, null, {
|
|
451
|
+
default: c(() => [...l[4] || (l[4] = [
|
|
452
|
+
w("Date", -1)
|
|
453
|
+
])]),
|
|
454
|
+
_: 1
|
|
455
|
+
}),
|
|
456
|
+
r(S, null, {
|
|
457
|
+
default: c(({ close: b }) => [
|
|
458
|
+
r(s, { "as-child": "" }, {
|
|
459
|
+
default: c(() => [
|
|
460
|
+
r(oe, {
|
|
461
|
+
type: "button",
|
|
462
|
+
variant: "outline",
|
|
463
|
+
class: he(g(Oe)("w-full justify-start text-left font-normal", !g(E) && "text-muted-foreground"))
|
|
464
|
+
}, {
|
|
465
|
+
default: c(() => [
|
|
466
|
+
r(g(je)),
|
|
467
|
+
w(" " + k(g(E) ? g(ue).format(g(E).toDate(g(Ve)())) : "Pick a date"), 1)
|
|
468
|
+
]),
|
|
469
|
+
_: 1
|
|
470
|
+
}, 8, ["class"])
|
|
471
|
+
]),
|
|
472
|
+
_: 1
|
|
473
|
+
}),
|
|
474
|
+
r(m, {
|
|
475
|
+
class: "w-auto p-0",
|
|
476
|
+
align: "start"
|
|
477
|
+
}, {
|
|
478
|
+
default: c(() => [
|
|
479
|
+
r(n, {
|
|
480
|
+
"model-value": g(E),
|
|
481
|
+
"default-placeholder": g(B),
|
|
482
|
+
layout: "month-and-year",
|
|
483
|
+
"initial-focus": "",
|
|
484
|
+
"onUpdate:modelValue": (_e) => ge(_e, b),
|
|
485
|
+
minValue: g(Ae)(g(Ve)())
|
|
486
|
+
}, null, 8, ["model-value", "default-placeholder", "onUpdate:modelValue", "minValue"])
|
|
487
|
+
]),
|
|
488
|
+
_: 2
|
|
489
|
+
}, 1024)
|
|
490
|
+
]),
|
|
491
|
+
_: 1
|
|
492
|
+
})
|
|
493
|
+
]),
|
|
494
|
+
z.agendaData.resources?.length > 1 ? (i(), p("div", xt, [
|
|
495
|
+
r(I, null, {
|
|
496
|
+
default: c(() => [...l[5] || (l[5] = [
|
|
497
|
+
w("Resource", -1)
|
|
498
|
+
])]),
|
|
499
|
+
_: 1
|
|
500
|
+
}),
|
|
501
|
+
r(ne, {
|
|
502
|
+
modelValue: g(q),
|
|
503
|
+
"onUpdate:modelValue": l[0] || (l[0] = (b) => we(q) ? q.value = b : null),
|
|
504
|
+
"wrapper-class": "w-full",
|
|
505
|
+
class: "w-full",
|
|
506
|
+
placeholder: "Select resource"
|
|
507
|
+
}, {
|
|
508
|
+
default: c(() => [
|
|
509
|
+
(i(!0), p(te, null, pe(z.agendaData.resources || [], (b) => (i(), be(V, {
|
|
510
|
+
key: b.id,
|
|
511
|
+
value: b.id
|
|
512
|
+
}, {
|
|
513
|
+
default: c(() => [
|
|
514
|
+
w(k(b.name), 1)
|
|
515
|
+
]),
|
|
516
|
+
_: 2
|
|
517
|
+
}, 1032, ["value"]))), 128))
|
|
518
|
+
]),
|
|
519
|
+
_: 1
|
|
520
|
+
}, 8, ["modelValue"])
|
|
521
|
+
])) : W("", !0),
|
|
522
|
+
z.agendaData.pricingOptions?.length > 1 ? (i(), p("div", St, [
|
|
523
|
+
r(I, null, {
|
|
524
|
+
default: c(() => [...l[6] || (l[6] = [
|
|
525
|
+
w("Type", -1)
|
|
526
|
+
])]),
|
|
527
|
+
_: 1
|
|
528
|
+
}),
|
|
529
|
+
r(ne, {
|
|
530
|
+
modelValue: g($),
|
|
531
|
+
"onUpdate:modelValue": l[1] || (l[1] = (b) => we($) ? $.value = b : null),
|
|
532
|
+
"wrapper-class": "w-full",
|
|
533
|
+
class: "w-full",
|
|
534
|
+
placeholder: "Select type"
|
|
535
|
+
}, {
|
|
536
|
+
default: c(() => [
|
|
537
|
+
(i(!0), p(te, null, pe(z.agendaData.pricingOptions || [], (b) => (i(), be(V, {
|
|
538
|
+
key: b.id,
|
|
539
|
+
value: b.id
|
|
540
|
+
}, {
|
|
541
|
+
default: c(() => [
|
|
542
|
+
w(k(b.name) + " (" + k(b.duration) + "min) ", 1)
|
|
543
|
+
]),
|
|
544
|
+
_: 2
|
|
545
|
+
}, 1032, ["value"]))), 128))
|
|
546
|
+
]),
|
|
547
|
+
_: 1
|
|
548
|
+
}, 8, ["modelValue"])
|
|
549
|
+
])) : W("", !0),
|
|
550
|
+
z.agendaData?.maxTicketsPerReservation > 1 ? (i(), p("div", kt, [
|
|
551
|
+
r(I, null, {
|
|
552
|
+
default: c(() => [...l[7] || (l[7] = [
|
|
553
|
+
w("Spots/tickets", -1)
|
|
554
|
+
])]),
|
|
555
|
+
_: 1
|
|
556
|
+
}),
|
|
557
|
+
r(ee, {
|
|
558
|
+
modelValue: g(Y),
|
|
559
|
+
"onUpdate:modelValue": l[2] || (l[2] = (b) => we(Y) ? Y.value = b : null),
|
|
560
|
+
modelModifiers: { number: !0 },
|
|
561
|
+
type: "number",
|
|
562
|
+
min: "1",
|
|
563
|
+
class: "no-spinner",
|
|
564
|
+
autocomplete: "off"
|
|
565
|
+
}, null, 8, ["modelValue"])
|
|
566
|
+
])) : W("", !0),
|
|
567
|
+
f("div", $t, [
|
|
568
|
+
r(I, null, {
|
|
569
|
+
default: c(() => [...l[8] || (l[8] = [
|
|
570
|
+
w("Paid (per reservation)", -1)
|
|
571
|
+
])]),
|
|
572
|
+
_: 1
|
|
573
|
+
}),
|
|
574
|
+
r(ee, {
|
|
575
|
+
modelValue: g(H),
|
|
576
|
+
"onUpdate:modelValue": l[3] || (l[3] = (b) => we(H) ? H.value = b : null),
|
|
577
|
+
modelModifiers: { number: !0 },
|
|
578
|
+
type: "number",
|
|
579
|
+
min: "0",
|
|
580
|
+
step: "1",
|
|
581
|
+
class: "no-spinner",
|
|
582
|
+
autocomplete: "off"
|
|
583
|
+
}, null, 8, ["modelValue"]),
|
|
584
|
+
l[9] || (l[9] = f("p", { class: "text-xs text-muted-foreground" }, " This amount is copied to every reservation you add. ", -1))
|
|
585
|
+
])
|
|
586
|
+
]),
|
|
587
|
+
f("div", Tt, [
|
|
588
|
+
r(I, null, {
|
|
589
|
+
default: c(() => [...l[10] || (l[10] = [
|
|
590
|
+
w("Available hours", -1)
|
|
591
|
+
])]),
|
|
592
|
+
_: 1
|
|
593
|
+
}),
|
|
594
|
+
g(v).length === 0 ? (i(), p("div", It, " No preset hours are available for this resource. You can still add a custom time below. ")) : (i(), p("div", Rt, [
|
|
595
|
+
g(N) ? (i(), be(oe, {
|
|
596
|
+
key: 0,
|
|
597
|
+
type: "button",
|
|
598
|
+
size: "icon",
|
|
599
|
+
variant: "outline",
|
|
600
|
+
class: "hidden absolute size-8 shrink-0 rounded-full shadow-sm md:inline-flex z-[11] left-0.5",
|
|
601
|
+
onClick: g(ye)
|
|
602
|
+
}, {
|
|
603
|
+
default: c(() => [
|
|
604
|
+
r(g(He), { class: "size-4" })
|
|
605
|
+
]),
|
|
606
|
+
_: 1
|
|
607
|
+
}, 8, ["onClick"])) : W("", !0),
|
|
608
|
+
f("div", wt, [
|
|
609
|
+
g(me) ? (i(), p("div", Dt)) : W("", !0),
|
|
610
|
+
g(de) ? (i(), p("div", Ct)) : W("", !0),
|
|
611
|
+
f("div", {
|
|
612
|
+
ref_key: "hourScrollContainer",
|
|
613
|
+
ref: D,
|
|
614
|
+
class: he(g(Oe)(
|
|
615
|
+
"hour-scroll-track flex w-full min-w-0 gap-2 overflow-x-auto overscroll-contain py-2",
|
|
616
|
+
g(le) && !g(C) && "cursor-grab",
|
|
617
|
+
g(C) && "cursor-grabbing select-none"
|
|
618
|
+
))
|
|
619
|
+
}, [
|
|
620
|
+
(i(!0), p(te, null, pe(g(v), (b) => (i(), be(oe, {
|
|
621
|
+
key: b,
|
|
622
|
+
type: "button",
|
|
623
|
+
variant: "outline",
|
|
624
|
+
class: he(["relative h-12 shrink-0", fe(b) ? "border-primary!" : ""]),
|
|
625
|
+
onClick: (_e) => ae(b)
|
|
626
|
+
}, {
|
|
627
|
+
default: c(() => [
|
|
628
|
+
w(k(b) + " ", 1),
|
|
629
|
+
fe(b) ? (i(), p("div", Nt, [
|
|
630
|
+
r(g(Qe), { class: "size-3" })
|
|
631
|
+
])) : W("", !0)
|
|
632
|
+
]),
|
|
633
|
+
_: 2
|
|
634
|
+
}, 1032, ["class", "onClick"]))), 128))
|
|
635
|
+
], 2)
|
|
636
|
+
]),
|
|
637
|
+
g(x) ? (i(), be(oe, {
|
|
638
|
+
key: 1,
|
|
639
|
+
type: "button",
|
|
640
|
+
size: "icon",
|
|
641
|
+
variant: "outline",
|
|
642
|
+
class: "hidden absolute size-8 shrink-0 rounded-full shadow-sm md:inline-flex z-[11] right-0.5",
|
|
643
|
+
onClick: g(ve)
|
|
644
|
+
}, {
|
|
645
|
+
default: c(() => [
|
|
646
|
+
r(g(Ye), { class: "size-4" })
|
|
647
|
+
]),
|
|
648
|
+
_: 1
|
|
649
|
+
}, 8, ["onClick"])) : W("", !0)
|
|
650
|
+
])),
|
|
651
|
+
f("div", Ot, [
|
|
652
|
+
(i(!0), p(te, null, pe(g(J), (b) => (i(), p("div", {
|
|
653
|
+
key: b,
|
|
654
|
+
class: "relative"
|
|
655
|
+
}, [
|
|
656
|
+
r(oe, {
|
|
657
|
+
type: "button",
|
|
658
|
+
variant: "outline",
|
|
659
|
+
class: "h-12 px-4 py-2"
|
|
660
|
+
}, {
|
|
661
|
+
default: c(() => [
|
|
662
|
+
w(k(b), 1)
|
|
663
|
+
]),
|
|
664
|
+
_: 2
|
|
665
|
+
}, 1024),
|
|
666
|
+
f("div", {
|
|
667
|
+
class: "absolute -top-1 -right-1 flex items-center justify-center bg-red-500 rounded-full text-white size-4 cursor-pointer",
|
|
668
|
+
onClick: (_e) => {
|
|
669
|
+
J.value = g(J).filter((ce) => ce !== b), M.value = g(M).filter((ce) => ce !== b);
|
|
670
|
+
}
|
|
671
|
+
}, [
|
|
672
|
+
r(g(We), { class: "size-3" })
|
|
673
|
+
], 8, Vt)
|
|
674
|
+
]))), 128))
|
|
675
|
+
])
|
|
676
|
+
]),
|
|
677
|
+
f("div", null, [
|
|
678
|
+
r(oe, {
|
|
679
|
+
disabled: !g(Z),
|
|
680
|
+
onClick: ke
|
|
681
|
+
}, {
|
|
682
|
+
default: c(() => [
|
|
683
|
+
g(M).length === 0 ? (i(), p("span", Mt, "Select at least one timeslot")) : g(M).length === 1 ? (i(), p("span", At, "Add 1 reservation")) : (i(), p("span", Ft, "Add " + k(g(M).length) + " reservations", 1))
|
|
684
|
+
]),
|
|
685
|
+
_: 1
|
|
686
|
+
}, 8, ["disabled"])
|
|
687
|
+
])
|
|
688
|
+
], 2);
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
}), Lt = /* @__PURE__ */ at(Et, [["__scopeId", "data-v-30be47b0"]]), Pt = { class: "space-y-3" }, Ut = { class: "flex flex-wrap items-center justify-between gap-3" }, zt = { class: "text-xs text-muted-foreground" }, Bt = { class: "flex flex-wrap items-center gap-2" }, qt = {
|
|
692
|
+
key: 0,
|
|
693
|
+
class: "rounded-md border border-dashed bg-muted/20 px-4 py-6 text-sm text-muted-foreground"
|
|
694
|
+
}, jt = {
|
|
695
|
+
key: 1,
|
|
696
|
+
class: "space-y-3"
|
|
697
|
+
}, Ht = { class: "flex items-start gap-2 p-3 md:hidden" }, Qt = ["aria-expanded", "onClick"], Yt = { class: "mt-0.5 flex size-10 shrink-0 items-center justify-center rounded-full bg-muted text-sm font-semibold text-muted-foreground" }, Wt = { class: "min-w-0 flex-1" }, Gt = { class: "flex items-start justify-between gap-3" }, Xt = { class: "min-w-0" }, Zt = { class: "block truncate text-base font-semibold" }, Jt = { class: "mt-1 block truncate text-xs text-muted-foreground" }, Kt = { class: "mt-1 block truncate text-xs text-muted-foreground" }, en = { class: "flex size-10 shrink-0 items-center justify-center rounded-xl border border-border/70 text-muted-foreground" }, tn = { class: "mt-3 flex flex-wrap items-center gap-x-4 gap-y-1 text-sm text-muted-foreground" }, nn = { class: "inline-flex items-center gap-1.5" }, sn = { class: "inline-flex items-center gap-1.5" }, an = { class: "hidden items-start justify-between gap-3 p-4 pb-0 md:flex" }, on = { class: "text-sm font-medium" }, rn = { class: "text-xs text-muted-foreground" }, ln = { class: "grid gap-4 border-t pt-3 md:grid-cols-2 md:border-0 md:pt-4 xl:grid-cols-5" }, un = { class: "grid gap-2" }, dn = { class: "grid gap-2" }, cn = {
|
|
698
|
+
key: 0,
|
|
699
|
+
class: "text-xs text-orange-500"
|
|
700
|
+
}, pn = { class: "grid gap-2" }, mn = {
|
|
701
|
+
key: 0,
|
|
702
|
+
class: "text-xs text-muted-foreground"
|
|
703
|
+
}, fn = {
|
|
704
|
+
key: 1,
|
|
705
|
+
class: "flex items-center h-[36px] text-sm"
|
|
706
|
+
}, gn = { key: 0 }, vn = { key: 1 }, _n = { key: 2 }, hn = {
|
|
707
|
+
key: 0,
|
|
708
|
+
class: "grid gap-2"
|
|
709
|
+
}, bn = /* @__PURE__ */ De({
|
|
710
|
+
__name: "ReservationLines",
|
|
711
|
+
props: {
|
|
712
|
+
modelValue: {},
|
|
713
|
+
agendaData: {},
|
|
714
|
+
availabilityByReservation: {}
|
|
715
|
+
},
|
|
716
|
+
emits: ["add", "quick-add", "update:modelValue"],
|
|
717
|
+
setup(z, { emit: X }) {
|
|
718
|
+
const A = z, Q = X, ue = /^([01]\d|2[0-3]):[0-5]\d$/, B = re(() => A.modelValue ?? []), O = re(() => Number(A.agendaData?.maxTicketsPerReservation) > 1), F = U(null), E = U(!1), q = re(() => String(A.agendaData?.currency || "EUR").toUpperCase()), $ = re(() => {
|
|
719
|
+
try {
|
|
720
|
+
return new Intl.NumberFormat("en-US", {
|
|
721
|
+
style: "currency",
|
|
722
|
+
currency: q.value,
|
|
723
|
+
minimumFractionDigits: 2,
|
|
724
|
+
maximumFractionDigits: 2
|
|
725
|
+
});
|
|
726
|
+
} catch {
|
|
727
|
+
return new Intl.NumberFormat("en-US", {
|
|
728
|
+
minimumFractionDigits: 2,
|
|
729
|
+
maximumFractionDigits: 2
|
|
730
|
+
});
|
|
731
|
+
}
|
|
732
|
+
}), M = (s) => {
|
|
733
|
+
Q("update:modelValue", s);
|
|
734
|
+
}, Y = (s) => ["date", "resourceId", "pricingOption"].includes(s), H = (s) => {
|
|
735
|
+
if (!s.date || !s.resourceId || !s.pricingOption) return s;
|
|
736
|
+
const n = ae(s);
|
|
737
|
+
return n.length === 0 ? {
|
|
738
|
+
...s,
|
|
739
|
+
startTime: ""
|
|
740
|
+
} : n.includes(s.startTime) ? s : {
|
|
741
|
+
...s,
|
|
742
|
+
startTime: n[0]
|
|
743
|
+
};
|
|
744
|
+
}, L = (s, n, m) => {
|
|
745
|
+
M(B.value.map((S) => {
|
|
746
|
+
if (S.id !== s) return S;
|
|
747
|
+
if (n === "date") {
|
|
748
|
+
const ne = {
|
|
749
|
+
...S,
|
|
750
|
+
date: String(m ?? ""),
|
|
751
|
+
dateValue: m || void 0
|
|
752
|
+
};
|
|
753
|
+
return H(ne);
|
|
754
|
+
}
|
|
755
|
+
const V = {
|
|
756
|
+
...S,
|
|
757
|
+
[n]: m
|
|
758
|
+
};
|
|
759
|
+
return Y(n) ? H(V) : V;
|
|
760
|
+
}));
|
|
761
|
+
}, K = (s, n) => {
|
|
762
|
+
const m = Number(n);
|
|
763
|
+
L(s, "paid", Number.isFinite(m) ? m : 0);
|
|
764
|
+
}, T = (s, n) => {
|
|
765
|
+
const m = Number(n);
|
|
766
|
+
L(s, "spots", Number.isFinite(m) && m > 0 ? m : 1);
|
|
767
|
+
}, ie = (s) => {
|
|
768
|
+
M(B.value.filter((n) => n.id !== s));
|
|
769
|
+
}, Z = (s) => {
|
|
770
|
+
Q("quick-add", s), E.value = !1;
|
|
771
|
+
}, v = (s) => A.agendaData?.pricingOptions?.find((n) => n.id === s.pricingOption), N = (s) => {
|
|
772
|
+
const n = v(s);
|
|
773
|
+
return n ? n.duration ? `${n.name} (${n.duration}min)` : n.name : "Reservation";
|
|
774
|
+
}, x = (s) => A.agendaData?.resources?.find((n) => n.id === s.resourceId), D = (s) => x(s)?.name || "Unknown resource", C = (s) => {
|
|
775
|
+
if (!s || !ue.test(s)) return null;
|
|
776
|
+
const [n, m] = s.split(":").map(Number);
|
|
777
|
+
return n * 60 + m;
|
|
778
|
+
}, le = (s) => {
|
|
779
|
+
const n = (s % 1440 + 1440) % 1440, m = Math.floor(n / 60), S = n % 60;
|
|
780
|
+
return `${m.toString().padStart(2, "0")}:${S.toString().padStart(2, "0")}`;
|
|
781
|
+
}, ve = (s) => {
|
|
782
|
+
const n = Number(v(s)?.duration);
|
|
783
|
+
return Number.isFinite(n) && n > 0 ? n : 0;
|
|
784
|
+
}, ye = (s) => {
|
|
785
|
+
if (!s.startTime) return "";
|
|
786
|
+
const n = ve(s);
|
|
787
|
+
if (n <= 0) return "";
|
|
788
|
+
const m = C(s.startTime);
|
|
789
|
+
return m === null ? "" : le(m + n);
|
|
790
|
+
}, me = (s) => {
|
|
791
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(s)) return null;
|
|
792
|
+
const [n, m, S] = s.split("-").map(Number), V = new Date(n, m - 1, S);
|
|
793
|
+
return Number.isNaN(V.getTime()) || V.getFullYear() !== n || V.getMonth() !== m - 1 || V.getDate() !== S ? null : V;
|
|
794
|
+
}, de = (s, n) => (A.agendaData?.exceptions || []).find((S) => n >= S.startDate && n <= S.endDate ? !S.resourceIds || S.resourceIds.length === 0 ? !0 : S.resourceIds.includes(s) : !1) || null, fe = (s) => {
|
|
795
|
+
const n = x(s), m = me(s.date);
|
|
796
|
+
if (!n || !m) return [];
|
|
797
|
+
const S = de(n.id, s.date);
|
|
798
|
+
if (S)
|
|
799
|
+
return S.isClosed ? [] : (S.timeslots || []).map((ne) => ({
|
|
800
|
+
start: ne.startTime,
|
|
801
|
+
end: ne.endTime
|
|
802
|
+
}));
|
|
803
|
+
const V = m.getDay();
|
|
804
|
+
return n.openingHours?.[V] || [];
|
|
805
|
+
}, ae = (s) => {
|
|
806
|
+
const n = x(s);
|
|
807
|
+
if (!n) return [];
|
|
808
|
+
const m = Number(n.interval) > 0 ? Number(n.interval) : 60, S = ve(s), V = /* @__PURE__ */ new Set();
|
|
809
|
+
for (const ne of fe(s)) {
|
|
810
|
+
const ee = C(ne.start), b = C(ne.end);
|
|
811
|
+
if (ee === null || b === null || b <= ee) continue;
|
|
812
|
+
const _e = S > 0 ? b - S : b - m;
|
|
813
|
+
for (let ce = ee; ce <= _e; ce += m)
|
|
814
|
+
V.add(le(ce));
|
|
815
|
+
}
|
|
816
|
+
return Array.from(V).sort((ne, ee) => (C(ne) ?? 0) - (C(ee) ?? 0));
|
|
817
|
+
}, ge = (s) => {
|
|
818
|
+
if (!s.startTime) return "Select time";
|
|
819
|
+
const n = ye(s);
|
|
820
|
+
return n ? `${s.startTime} - ${n}` : s.startTime;
|
|
821
|
+
}, _ = (s) => {
|
|
822
|
+
const n = Number(s);
|
|
823
|
+
if (!Number.isFinite(n)) return q.value === "EUR" ? "€0.00" : "0.00";
|
|
824
|
+
try {
|
|
825
|
+
return $.value.format(n);
|
|
826
|
+
} catch {
|
|
827
|
+
return `${n.toFixed(2)}`;
|
|
828
|
+
}
|
|
829
|
+
}, P = (s) => {
|
|
830
|
+
const n = Number(s.spots), m = Number.isFinite(n) && n > 0 ? n : 1;
|
|
831
|
+
return m === 1 ? "1 spot" : `${m} spots`;
|
|
832
|
+
}, J = (s) => A.availabilityByReservation?.[s.id] ?? null, ke = (s) => {
|
|
833
|
+
const n = J(s);
|
|
834
|
+
return !n || n.status === "checking" ? "text-muted-foreground" : n.status === "available" ? "text-green-600 dark:text-green-400" : "text-red-600 dark:text-red-400";
|
|
835
|
+
}, xe = (s) => {
|
|
836
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(s)) return null;
|
|
837
|
+
const [n, m, S] = s.split("-").map(Number), V = new Date(n, m - 1, S);
|
|
838
|
+
return Number.isNaN(V.getTime()) || V.getFullYear() !== n || V.getMonth() !== m - 1 || V.getDate() !== S ? null : (V.setHours(0, 0, 0, 0), V);
|
|
839
|
+
}, a = (s) => {
|
|
840
|
+
const n = xe(String(s.date || "").trim());
|
|
841
|
+
if (!n) return "";
|
|
842
|
+
const m = /* @__PURE__ */ new Date();
|
|
843
|
+
if (m.setHours(0, 0, 0, 0), n < m)
|
|
844
|
+
return "This date is in the past. Double-check it before saving.";
|
|
845
|
+
const S = new Date(m);
|
|
846
|
+
return S.setFullYear(S.getFullYear() + 1), n > S ? "This date is more than a year ahead. Double-check it before saving." : "";
|
|
847
|
+
}, l = (s) => !s.date || !s.startTime || !s.resourceId || !s.pricingOption, I = (s) => F.value === s, oe = (s) => {
|
|
848
|
+
F.value = F.value === s ? null : s;
|
|
849
|
+
};
|
|
850
|
+
return Re(B, (s) => {
|
|
851
|
+
const n = new Set(s.map((m) => m.id));
|
|
852
|
+
if (F.value && !n.has(F.value) && (F.value = null), !F.value) {
|
|
853
|
+
const m = s.find(l);
|
|
854
|
+
m && (F.value = m.id);
|
|
855
|
+
}
|
|
856
|
+
}, { immediate: !0 }), (s, n) => {
|
|
857
|
+
const m = h("Button"), S = h("PopoverTrigger"), V = h("PopoverContent"), ne = h("Popover"), ee = h("Label"), b = h("DynamicSelectOption"), _e = h("DynamicSelect"), ce = h("Input"), Ce = h("SelectValue"), Ne = h("SelectTrigger"), e = h("SelectItem"), o = h("SelectContent"), d = h("Select");
|
|
858
|
+
return i(), p("div", Pt, [
|
|
859
|
+
f("div", Ut, [
|
|
860
|
+
f("p", zt, k(B.value.length === 1 ? "1 reservation line" : `${B.value.length} reservation lines`), 1),
|
|
861
|
+
f("div", Bt, [
|
|
862
|
+
r(ne, {
|
|
863
|
+
open: E.value,
|
|
864
|
+
"onUpdate:open": n[0] || (n[0] = (t) => E.value = t)
|
|
865
|
+
}, {
|
|
866
|
+
default: c(() => [
|
|
867
|
+
r(S, { "as-child": "" }, {
|
|
868
|
+
default: c(() => [
|
|
869
|
+
r(m, {
|
|
870
|
+
type: "button",
|
|
871
|
+
variant: "outline",
|
|
872
|
+
size: "sm",
|
|
873
|
+
class: "gap-2"
|
|
874
|
+
}, {
|
|
875
|
+
default: c(() => [
|
|
876
|
+
r(g(Ge), { class: "size-4 text-primary" }),
|
|
877
|
+
n[2] || (n[2] = w(" Quick add ", -1))
|
|
878
|
+
]),
|
|
879
|
+
_: 1
|
|
880
|
+
})
|
|
881
|
+
]),
|
|
882
|
+
_: 1
|
|
883
|
+
}),
|
|
884
|
+
r(V, {
|
|
885
|
+
align: "end",
|
|
886
|
+
class: "max-h-[80vh] w-[min(34rem,calc(100vw-2rem))] overflow-y-auto p-0"
|
|
887
|
+
}, {
|
|
888
|
+
default: c(() => [
|
|
889
|
+
E.value ? (i(), be(Lt, {
|
|
890
|
+
key: 0,
|
|
891
|
+
surface: "popover",
|
|
892
|
+
agendaData: z.agendaData,
|
|
893
|
+
onAdd: Z
|
|
894
|
+
}, null, 8, ["agendaData"])) : W("", !0)
|
|
895
|
+
]),
|
|
896
|
+
_: 1
|
|
897
|
+
})
|
|
898
|
+
]),
|
|
899
|
+
_: 1
|
|
900
|
+
}, 8, ["open"]),
|
|
901
|
+
r(m, {
|
|
902
|
+
type: "button",
|
|
903
|
+
variant: "outline",
|
|
904
|
+
size: "sm",
|
|
905
|
+
onClick: n[1] || (n[1] = (t) => Q("add"))
|
|
906
|
+
}, {
|
|
907
|
+
default: c(() => [
|
|
908
|
+
r(g(Pe), { class: "size-4" }),
|
|
909
|
+
n[3] || (n[3] = w(" Add line ", -1))
|
|
910
|
+
]),
|
|
911
|
+
_: 1
|
|
912
|
+
})
|
|
913
|
+
])
|
|
914
|
+
]),
|
|
915
|
+
B.value.length === 0 ? (i(), p("div", qt, " Use Quick add to create filled reservation lines, or add an empty line manually. ")) : (i(), p("div", jt, [
|
|
916
|
+
(i(!0), p(te, null, pe(B.value, (t, y) => (i(), p("div", {
|
|
917
|
+
key: t.id,
|
|
918
|
+
class: "rounded-xl border bg-background"
|
|
919
|
+
}, [
|
|
920
|
+
f("div", Ht, [
|
|
921
|
+
f("button", {
|
|
922
|
+
type: "button",
|
|
923
|
+
class: "flex min-w-0 flex-1 items-start gap-3 rounded-lg px-1 py-1 text-left outline-none transition-colors hover:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring/50",
|
|
924
|
+
"aria-expanded": I(t.id),
|
|
925
|
+
onClick: (u) => oe(t.id)
|
|
926
|
+
}, [
|
|
927
|
+
f("span", Yt, k(y + 1), 1),
|
|
928
|
+
f("span", Wt, [
|
|
929
|
+
f("span", Gt, [
|
|
930
|
+
f("span", Xt, [
|
|
931
|
+
f("span", Zt, k(ge(t)), 1),
|
|
932
|
+
f("span", Jt, k(t.date || "No date selected"), 1),
|
|
933
|
+
f("span", Kt, k(D(t)) + " · " + k(N(t)), 1),
|
|
934
|
+
J(t)?.message ? (i(), p("span", {
|
|
935
|
+
key: 0,
|
|
936
|
+
class: he(["mt-1 block text-xs font-medium", ke(t)])
|
|
937
|
+
}, k(J(t)?.message), 3)) : W("", !0)
|
|
938
|
+
]),
|
|
939
|
+
f("span", en, [
|
|
940
|
+
r(g(Xe), { class: "size-4" })
|
|
941
|
+
])
|
|
942
|
+
]),
|
|
943
|
+
f("span", tn, [
|
|
944
|
+
f("span", nn, [
|
|
945
|
+
r(g(Ze), { class: "size-4" }),
|
|
946
|
+
w(" " + k(P(t)), 1)
|
|
947
|
+
]),
|
|
948
|
+
f("span", sn, [
|
|
949
|
+
r(g(Je), { class: "size-4" }),
|
|
950
|
+
w(" " + k(_(t.paid)), 1)
|
|
951
|
+
])
|
|
952
|
+
])
|
|
953
|
+
])
|
|
954
|
+
], 8, Qt),
|
|
955
|
+
r(m, {
|
|
956
|
+
type: "button",
|
|
957
|
+
variant: "ghost",
|
|
958
|
+
size: "icon",
|
|
959
|
+
class: "mt-1 shrink-0",
|
|
960
|
+
onClick: (u) => ie(t.id)
|
|
961
|
+
}, {
|
|
962
|
+
default: c(() => [
|
|
963
|
+
r(g(Me), { class: "size-4" })
|
|
964
|
+
]),
|
|
965
|
+
_: 1
|
|
966
|
+
}, 8, ["onClick"])
|
|
967
|
+
]),
|
|
968
|
+
f("div", an, [
|
|
969
|
+
f("div", null, [
|
|
970
|
+
f("p", on, "Reservation " + k(y + 1), 1),
|
|
971
|
+
f("p", rn, k(D(t)) + " · " + k(N(t)), 1),
|
|
972
|
+
J(t)?.message ? (i(), p("p", {
|
|
973
|
+
key: 0,
|
|
974
|
+
class: he(["mt-1 text-xs font-medium", ke(t)])
|
|
975
|
+
}, k(J(t)?.message), 3)) : W("", !0)
|
|
976
|
+
]),
|
|
977
|
+
r(m, {
|
|
978
|
+
type: "button",
|
|
979
|
+
variant: "ghost",
|
|
980
|
+
size: "icon",
|
|
981
|
+
class: "shrink-0",
|
|
982
|
+
onClick: (u) => ie(t.id)
|
|
983
|
+
}, {
|
|
984
|
+
default: c(() => [
|
|
985
|
+
r(g(Me), { class: "size-4" })
|
|
986
|
+
]),
|
|
987
|
+
_: 1
|
|
988
|
+
}, 8, ["onClick"])
|
|
989
|
+
]),
|
|
990
|
+
f("div", {
|
|
991
|
+
class: he(["px-3 pb-3 md:px-4 md:pb-4 overflow-hidden", I(t.id) ? "block" : "hidden md:block"])
|
|
992
|
+
}, [
|
|
993
|
+
f("div", ln, [
|
|
994
|
+
f("div", un, [
|
|
995
|
+
r(ee, null, {
|
|
996
|
+
default: c(() => [...n[4] || (n[4] = [
|
|
997
|
+
w("Resource", -1)
|
|
998
|
+
])]),
|
|
999
|
+
_: 1
|
|
1000
|
+
}),
|
|
1001
|
+
r(_e, {
|
|
1002
|
+
"model-value": t.resourceId,
|
|
1003
|
+
"wrapper-class": "w-full",
|
|
1004
|
+
class: "w-full",
|
|
1005
|
+
placeholder: "Select resource",
|
|
1006
|
+
"onUpdate:modelValue": (u) => L(t.id, "resourceId", String(u ?? ""))
|
|
1007
|
+
}, {
|
|
1008
|
+
default: c(() => [
|
|
1009
|
+
(i(!0), p(te, null, pe(z.agendaData?.resources || [], (u) => (i(), be(b, {
|
|
1010
|
+
key: u.id,
|
|
1011
|
+
value: u.id
|
|
1012
|
+
}, {
|
|
1013
|
+
default: c(() => [
|
|
1014
|
+
w(k(u.name), 1)
|
|
1015
|
+
]),
|
|
1016
|
+
_: 2
|
|
1017
|
+
}, 1032, ["value"]))), 128))
|
|
1018
|
+
]),
|
|
1019
|
+
_: 1
|
|
1020
|
+
}, 8, ["model-value", "onUpdate:modelValue"])
|
|
1021
|
+
]),
|
|
1022
|
+
f("div", dn, [
|
|
1023
|
+
r(ee, null, {
|
|
1024
|
+
default: c(() => [...n[5] || (n[5] = [
|
|
1025
|
+
w("Date", -1)
|
|
1026
|
+
])]),
|
|
1027
|
+
_: 1
|
|
1028
|
+
}),
|
|
1029
|
+
r(ce, {
|
|
1030
|
+
"model-value": t.date,
|
|
1031
|
+
type: "date",
|
|
1032
|
+
"onUpdate:modelValue": (u) => L(t.id, "date", String(u ?? ""))
|
|
1033
|
+
}, null, 8, ["model-value", "onUpdate:modelValue"]),
|
|
1034
|
+
a(t) ? (i(), p("p", cn, k(a(t)), 1)) : W("", !0)
|
|
1035
|
+
]),
|
|
1036
|
+
f("div", pn, [
|
|
1037
|
+
r(ee, {
|
|
1038
|
+
for: `new_reservation_res_line_${y}_time`
|
|
1039
|
+
}, {
|
|
1040
|
+
default: c(() => [...n[6] || (n[6] = [
|
|
1041
|
+
w("Time", -1)
|
|
1042
|
+
])]),
|
|
1043
|
+
_: 1
|
|
1044
|
+
}, 8, ["for"]),
|
|
1045
|
+
t.resourceId && t.date ? (i(), p(te, { key: 0 }, [
|
|
1046
|
+
r(d, {
|
|
1047
|
+
"model-value": t.startTime,
|
|
1048
|
+
"onUpdate:modelValue": (u) => L(t.id, "startTime", String(u ?? ""))
|
|
1049
|
+
}, {
|
|
1050
|
+
default: c(() => [
|
|
1051
|
+
r(Ne, {
|
|
1052
|
+
id: `new_reservation_res_line_${y}_time`,
|
|
1053
|
+
class: "w-full"
|
|
1054
|
+
}, {
|
|
1055
|
+
default: c(() => [
|
|
1056
|
+
r(Ce, { placeholder: "Select an hour" })
|
|
1057
|
+
]),
|
|
1058
|
+
_: 1
|
|
1059
|
+
}, 8, ["id"]),
|
|
1060
|
+
r(o, null, {
|
|
1061
|
+
default: c(() => [
|
|
1062
|
+
(i(!0), p(te, null, pe(ae(t), (u) => (i(), be(e, {
|
|
1063
|
+
key: u,
|
|
1064
|
+
value: u
|
|
1065
|
+
}, {
|
|
1066
|
+
default: c(() => [
|
|
1067
|
+
w(k(u), 1)
|
|
1068
|
+
]),
|
|
1069
|
+
_: 2
|
|
1070
|
+
}, 1032, ["value"]))), 128))
|
|
1071
|
+
]),
|
|
1072
|
+
_: 2
|
|
1073
|
+
}, 1024)
|
|
1074
|
+
]),
|
|
1075
|
+
_: 2
|
|
1076
|
+
}, 1032, ["model-value", "onUpdate:modelValue"]),
|
|
1077
|
+
t.resourceId && t.date && ae(t).length === 0 ? (i(), p("p", mn, " No times are available for this resource on the selected date. ")) : W("", !0)
|
|
1078
|
+
], 64)) : (i(), p("p", fn, [
|
|
1079
|
+
!t.resourceId && !t.date ? (i(), p("span", gn, "Please select a resource and date.")) : t.resourceId ? t.date ? W("", !0) : (i(), p("span", _n, "Please select a date.")) : (i(), p("span", vn, "Please select a resource."))
|
|
1080
|
+
]))
|
|
1081
|
+
]),
|
|
1082
|
+
f("div", {
|
|
1083
|
+
class: he(["grid gap-2", { hidden: z.agendaData?.pricingOptions?.length < 2 }])
|
|
1084
|
+
}, [
|
|
1085
|
+
r(ee, null, {
|
|
1086
|
+
default: c(() => [...n[7] || (n[7] = [
|
|
1087
|
+
w("Type", -1)
|
|
1088
|
+
])]),
|
|
1089
|
+
_: 1
|
|
1090
|
+
}),
|
|
1091
|
+
r(_e, {
|
|
1092
|
+
"model-value": t.pricingOption,
|
|
1093
|
+
"wrapper-class": "w-full",
|
|
1094
|
+
class: "w-full",
|
|
1095
|
+
placeholder: "Select type",
|
|
1096
|
+
"onUpdate:modelValue": (u) => L(t.id, "pricingOption", String(u ?? ""))
|
|
1097
|
+
}, {
|
|
1098
|
+
default: c(() => [
|
|
1099
|
+
(i(!0), p(te, null, pe(z.agendaData?.pricingOptions || [], (u) => (i(), be(b, {
|
|
1100
|
+
key: u.id,
|
|
1101
|
+
value: u.id
|
|
1102
|
+
}, {
|
|
1103
|
+
default: c(() => [
|
|
1104
|
+
w(k(u.name), 1)
|
|
1105
|
+
]),
|
|
1106
|
+
_: 2
|
|
1107
|
+
}, 1032, ["value"]))), 128))
|
|
1108
|
+
]),
|
|
1109
|
+
_: 1
|
|
1110
|
+
}, 8, ["model-value", "onUpdate:modelValue"])
|
|
1111
|
+
], 2),
|
|
1112
|
+
f("div", {
|
|
1113
|
+
class: he(["grid gap-4", O.value ? "md:grid-cols-2 xl:grid-cols-2 xl:col-span-1" : ""])
|
|
1114
|
+
}, [
|
|
1115
|
+
O.value ? (i(), p("div", hn, [
|
|
1116
|
+
r(ee, null, {
|
|
1117
|
+
default: c(() => [...n[8] || (n[8] = [
|
|
1118
|
+
w("Spots", -1)
|
|
1119
|
+
])]),
|
|
1120
|
+
_: 1
|
|
1121
|
+
}),
|
|
1122
|
+
r(ce, {
|
|
1123
|
+
"model-value": t.spots,
|
|
1124
|
+
type: "number",
|
|
1125
|
+
min: "1",
|
|
1126
|
+
class: "no-spinner",
|
|
1127
|
+
"onUpdate:modelValue": (u) => T(t.id, u)
|
|
1128
|
+
}, null, 8, ["model-value", "onUpdate:modelValue"])
|
|
1129
|
+
])) : W("", !0),
|
|
1130
|
+
f("div", {
|
|
1131
|
+
class: he(["grid gap-2", O.value ? "" : "md:col-span-2 xl:col-span-1"])
|
|
1132
|
+
}, [
|
|
1133
|
+
r(ee, null, {
|
|
1134
|
+
default: c(() => [...n[9] || (n[9] = [
|
|
1135
|
+
w("Paid", -1)
|
|
1136
|
+
])]),
|
|
1137
|
+
_: 1
|
|
1138
|
+
}),
|
|
1139
|
+
r(ce, {
|
|
1140
|
+
"model-value": t.paid,
|
|
1141
|
+
type: "number",
|
|
1142
|
+
min: "0",
|
|
1143
|
+
step: "1",
|
|
1144
|
+
class: "no-spinner",
|
|
1145
|
+
"onUpdate:modelValue": (u) => K(t.id, u)
|
|
1146
|
+
}, null, 8, ["model-value", "onUpdate:modelValue"])
|
|
1147
|
+
], 2)
|
|
1148
|
+
], 2)
|
|
1149
|
+
])
|
|
1150
|
+
], 2)
|
|
1151
|
+
]))), 128))
|
|
1152
|
+
]))
|
|
1153
|
+
]);
|
|
1154
|
+
};
|
|
1155
|
+
}
|
|
1156
|
+
}), yn = { class: "space-y-5 md:mt-5" }, xn = { class: "space-y-3" }, Sn = { class: "mt-4 text-red-400" }, kn = { class: "list-disc pl-4" }, $n = { key: 0 }, Tn = { key: 1 }, In = { key: 2 }, Fe = "", Vn = /* @__PURE__ */ De({
|
|
1157
|
+
__name: "NewReservationDialog",
|
|
1158
|
+
props: {
|
|
1159
|
+
agendaData: {}
|
|
1160
|
+
},
|
|
1161
|
+
setup(z) {
|
|
1162
|
+
const X = z, { params: A } = Ke(), { config: Q } = et(), { log: ue, logError: B } = tt(), O = nt(Q.project), F = re(() => A.value?.id ?? A.id ?? ""), E = qe("agendaData", U({})), q = re(() => X.agendaData ?? E.value ?? {}), $ = U(!1), M = U(!1), Y = U({});
|
|
1163
|
+
let H = 0;
|
|
1164
|
+
const L = U([]), K = /^([01]\d|2[0-3]):[0-5]\d$/, T = U([]), ie = U(null), Z = re(() => Object.values(Y.value).some((e) => e.status === "checking")), v = re(() => Object.values(Y.value).some((e) => e.status === "unavailable")), N = () => q.value?.resources?.[0]?.id ?? "", x = () => q.value?.pricingOptions?.find((e) => e.isDefault === !0)?.id ?? q.value?.pricingOptions?.[0]?.id ?? "", D = () => {
|
|
1165
|
+
const e = /* @__PURE__ */ new Date(), o = e.getFullYear(), d = `${e.getMonth() + 1}`.padStart(2, "0"), t = `${e.getDate()}`.padStart(2, "0");
|
|
1166
|
+
return `${o}-${d}-${t}`;
|
|
1167
|
+
}, C = (e) => {
|
|
1168
|
+
let o = e?.pricingOption ?? x(), d = q.value?.pricingOptions?.find((y) => y.id === o)?.price ?? 0;
|
|
1169
|
+
typeof d == "string" && (d = Number(d));
|
|
1170
|
+
let t = e?.paid ?? d;
|
|
1171
|
+
return typeof t == "string" && (t = Number(t)), {
|
|
1172
|
+
id: `reservation_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
|
|
1173
|
+
spots: Number(e?.spots) || 1,
|
|
1174
|
+
paid: Number.isFinite(t) ? t : 0,
|
|
1175
|
+
resourceId: e?.resourceId ?? N(),
|
|
1176
|
+
pricingOption: o,
|
|
1177
|
+
date: e?.date ?? D(),
|
|
1178
|
+
dateValue: e?.dateValue,
|
|
1179
|
+
startTime: e?.startTime ?? Fe
|
|
1180
|
+
};
|
|
1181
|
+
}, le = () => {
|
|
1182
|
+
T.value = [C()];
|
|
1183
|
+
}, ve = (e) => (!e.date || e.date === D()) && e.startTime === Fe, ye = () => {
|
|
1184
|
+
const e = T.value[T.value.length - 1];
|
|
1185
|
+
T.value = [...T.value, C(e ? { ...e } : void 0)];
|
|
1186
|
+
}, me = (e) => q.value?.pricingOptions?.find((o) => o.id === e.pricingOption), de = (e) => q.value?.resources?.find((o) => o.id === e.resourceId), fe = () => {
|
|
1187
|
+
const e = Number(q.value?.maxTicketsPerReservation);
|
|
1188
|
+
return Number.isFinite(e) && e > 0 ? e : null;
|
|
1189
|
+
}, ae = (e) => `Reservation ${e + 1}`, ge = (e) => {
|
|
1190
|
+
const o = String(e.date || "").trim(), d = String(e.startTime || "").trim(), t = String(e.resourceId || "").trim();
|
|
1191
|
+
return !o || !d || !t ? "" : `${t}_${o}_${d}`;
|
|
1192
|
+
}, _ = () => {
|
|
1193
|
+
const e = [], o = /* @__PURE__ */ new Map(), d = fe();
|
|
1194
|
+
return T.value.forEach((t, y) => {
|
|
1195
|
+
const u = ae(y), j = String(t.date || "").trim(), G = String(t.startTime || "").trim(), R = String(t.resourceId || "").trim(), se = String(t.pricingOption || "").trim(), Te = Number(t.spots), $e = Number(t.paid);
|
|
1196
|
+
j || e.push(`${u}: please select a date.`), G ? K.test(G) || e.push(`${u}: please enter a valid time.`) : e.push(`${u}: please select a time.`), R ? de(t) || e.push(`${u}: the selected resource is no longer available.`) : e.push(`${u}: please select a resource.`), se ? me(t) || e.push(`${u}: the selected type is no longer available.`) : e.push(`${u}: please select a type.`), !Number.isFinite(Te) || Te <= 0 ? e.push(`${u}: spots must be at least 1.`) : d !== null && Te > d && e.push(`${u}: spots cannot be more than ${d}.`), (!Number.isFinite($e) || $e < 0) && e.push(`${u}: paid amount must be 0 or higher.`);
|
|
1197
|
+
const Se = ge(t);
|
|
1198
|
+
if (Se) {
|
|
1199
|
+
const Ie = o.get(Se);
|
|
1200
|
+
Ie !== void 0 ? e.push(`${u}: duplicate of ${ae(Ie).toLowerCase()}.`) : o.set(Se, y);
|
|
1201
|
+
}
|
|
1202
|
+
}), e;
|
|
1203
|
+
}, P = (e) => {
|
|
1204
|
+
const o = e.startTimes.map((d) => C({
|
|
1205
|
+
date: e.date ? `${e.date}` : "",
|
|
1206
|
+
dateValue: e.date,
|
|
1207
|
+
pricingOption: e.pricingOptionId,
|
|
1208
|
+
resourceId: e.resourceId,
|
|
1209
|
+
spots: e.spots,
|
|
1210
|
+
paid: e.paid,
|
|
1211
|
+
startTime: d
|
|
1212
|
+
}));
|
|
1213
|
+
if (o.length !== 0) {
|
|
1214
|
+
if (T.value.length === 1 && ve(T.value[0])) {
|
|
1215
|
+
T.value = o;
|
|
1216
|
+
return;
|
|
1217
|
+
}
|
|
1218
|
+
T.value = [...T.value, ...o];
|
|
1219
|
+
}
|
|
1220
|
+
}, J = (e) => {
|
|
1221
|
+
if (!e || !K.test(e)) return null;
|
|
1222
|
+
const [o, d] = e.split(":").map(Number);
|
|
1223
|
+
return o * 60 + d;
|
|
1224
|
+
}, ke = (e) => {
|
|
1225
|
+
const o = (e % 1440 + 1440) % 1440, d = Math.floor(o / 60), t = o % 60;
|
|
1226
|
+
return `${d.toString().padStart(2, "0")}:${t.toString().padStart(2, "0")}`;
|
|
1227
|
+
}, xe = (e) => {
|
|
1228
|
+
if (!e.startTime || !e.pricingOption) return "";
|
|
1229
|
+
const o = me(e), d = Number(o?.duration);
|
|
1230
|
+
if (!Number.isFinite(d) || d <= 0) return e.startTime;
|
|
1231
|
+
const t = J(e.startTime);
|
|
1232
|
+
return t === null ? "" : ke(t + d);
|
|
1233
|
+
}, a = (e) => {
|
|
1234
|
+
const o = Number(e.spots);
|
|
1235
|
+
return Number.isFinite(o) && o > 0 ? o : 1;
|
|
1236
|
+
}, l = (e) => {
|
|
1237
|
+
const o = Number(de(e)?.capacity);
|
|
1238
|
+
return Number.isFinite(o) && o > 0 ? o : 1;
|
|
1239
|
+
}, I = (e) => {
|
|
1240
|
+
const o = String(e.date || "").trim(), d = String(e.resourceId || "").trim(), t = J(e.startTime), y = J(xe(e));
|
|
1241
|
+
return !o || !d || !de(e) || !me(e) || t === null || y === null || y <= t ? null : {
|
|
1242
|
+
reservation: e,
|
|
1243
|
+
date: o,
|
|
1244
|
+
resourceId: d,
|
|
1245
|
+
startMinutes: t,
|
|
1246
|
+
endMinutes: y,
|
|
1247
|
+
capacity: l(e),
|
|
1248
|
+
requestedSpots: a(e)
|
|
1249
|
+
};
|
|
1250
|
+
}, oe = (e) => ["approved", "needs_approval"].includes(e?.status), s = (e, o, d, t) => e < t && o > d, n = (e) => `${e} ${e === 1 ? "spot" : "spots"}`, m = (e, o, d) => e < d ? {
|
|
1251
|
+
status: "unavailable",
|
|
1252
|
+
message: `Not enough spots: ${n(Math.max(e, 0))} open, needs ${n(d)}.`
|
|
1253
|
+
} : {
|
|
1254
|
+
status: "available",
|
|
1255
|
+
message: `Available: ${e} of ${o} ${o === 1 ? "spot" : "spots"} open, ${n(e - d)} will remain.`
|
|
1256
|
+
}, S = (e) => e?.id || e?.orderId || "", V = (e, o) => {
|
|
1257
|
+
const d = [];
|
|
1258
|
+
for (let t = 0; t < e.length; t += o)
|
|
1259
|
+
d.push(e.slice(t, t + o));
|
|
1260
|
+
return d;
|
|
1261
|
+
}, ne = async (e) => {
|
|
1262
|
+
const o = /* @__PURE__ */ new Map(), d = [];
|
|
1263
|
+
for (const t of V(e, 10)) {
|
|
1264
|
+
const y = [
|
|
1265
|
+
{ field: "status", operator: "==", value: "confirmed" },
|
|
1266
|
+
{ field: "flattenedReservationDates", operator: "array-contains-any", value: t }
|
|
1267
|
+
];
|
|
1268
|
+
F.value && y.unshift({ field: "agendaId", operator: "==", value: F.value });
|
|
1269
|
+
const u = await O.find(Q.reservationsCollection, { filters: y });
|
|
1270
|
+
for (const j of u || []) {
|
|
1271
|
+
const G = S(j);
|
|
1272
|
+
G ? o.set(G, j) : d.push(j);
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
return [...o.values(), ...d];
|
|
1276
|
+
}, ee = (e, o) => {
|
|
1277
|
+
let d = 0;
|
|
1278
|
+
for (const t of e)
|
|
1279
|
+
for (const y of t?.reservations || []) {
|
|
1280
|
+
if (!oe(y) || y?.date !== o.date || y?.resourceId !== o.resourceId) continue;
|
|
1281
|
+
const u = J(y?.timeslot?.startTime), j = J(y?.timeslot?.endTime);
|
|
1282
|
+
if (u === null || j === null || j <= u || !s(o.startMinutes, o.endMinutes, u, j)) continue;
|
|
1283
|
+
const G = Number(y?.spots);
|
|
1284
|
+
d += Number.isFinite(G) && G > 0 ? G : 1;
|
|
1285
|
+
}
|
|
1286
|
+
return d;
|
|
1287
|
+
}, b = (e) => {
|
|
1288
|
+
let o = 0;
|
|
1289
|
+
for (const d of T.value) {
|
|
1290
|
+
if (d.id === e.reservation.id) continue;
|
|
1291
|
+
const t = I(d);
|
|
1292
|
+
t && t.date === e.date && t.resourceId === e.resourceId && s(e.startMinutes, e.endMinutes, t.startMinutes, t.endMinutes) && (o += t.requestedSpots);
|
|
1293
|
+
}
|
|
1294
|
+
return o;
|
|
1295
|
+
}, _e = async () => {
|
|
1296
|
+
const e = ++H, o = T.value.map(I).filter((t) => !!t), d = o.reduce((t, y) => (t[y.reservation.id] = {
|
|
1297
|
+
status: "checking",
|
|
1298
|
+
message: "Checking availability..."
|
|
1299
|
+
}, t), {});
|
|
1300
|
+
if (Y.value = d, !$.value || o.length === 0)
|
|
1301
|
+
return d;
|
|
1302
|
+
try {
|
|
1303
|
+
const t = Array.from(new Set(o.map((j) => `${j.resourceId}_${j.date}`))), y = await ne(t);
|
|
1304
|
+
if (e !== H) return null;
|
|
1305
|
+
const u = o.reduce((j, G) => {
|
|
1306
|
+
const R = ee(y, G) + b(G), se = G.capacity - R;
|
|
1307
|
+
return j[G.reservation.id] = m(
|
|
1308
|
+
se,
|
|
1309
|
+
G.capacity,
|
|
1310
|
+
G.requestedSpots
|
|
1311
|
+
), j;
|
|
1312
|
+
}, {});
|
|
1313
|
+
return Y.value = u, u;
|
|
1314
|
+
} catch (t) {
|
|
1315
|
+
if (e !== H) return null;
|
|
1316
|
+
console.error("Error checking new reservation availability:", t);
|
|
1317
|
+
const y = o.reduce((u, j) => (u[j.reservation.id] = {
|
|
1318
|
+
status: "error",
|
|
1319
|
+
message: "Could not check availability for this reservation."
|
|
1320
|
+
}, u), {});
|
|
1321
|
+
return Y.value = y, y;
|
|
1322
|
+
}
|
|
1323
|
+
}, ce = (e) => e ? T.value.flatMap((o, d) => {
|
|
1324
|
+
const t = e[o.id];
|
|
1325
|
+
return t ? t.status === "unavailable" ? [`${ae(d)}: ${t.message}`] : t.status === "error" ? [`${ae(d)}: availability could not be checked.`] : [] : [];
|
|
1326
|
+
}) : ["Could not check availability before creating the reservation."];
|
|
1327
|
+
Re($, async (e) => {
|
|
1328
|
+
e ? (L.value = [], le(), await Le(), ie.value?.reset()) : (H += 1, Y.value = {});
|
|
1329
|
+
}), Re(T, () => {
|
|
1330
|
+
$.value && _e();
|
|
1331
|
+
}, { deep: !0 });
|
|
1332
|
+
const Ce = () => {
|
|
1333
|
+
const e = [];
|
|
1334
|
+
L.value = [];
|
|
1335
|
+
const o = ie.value, d = o ? o.validateForm() : !1;
|
|
1336
|
+
return o || e.push("Customer information form is unavailable."), T.value.length === 0 && e.push("Please add at least one reservation."), e.push(..._()), L.value = e, e.length === 0 && d;
|
|
1337
|
+
}, Ne = async () => {
|
|
1338
|
+
const e = ie.value;
|
|
1339
|
+
if (!e || !Ce()) return;
|
|
1340
|
+
const o = await _e(), d = ce(o);
|
|
1341
|
+
if (d.length > 0) {
|
|
1342
|
+
L.value = d;
|
|
1343
|
+
return;
|
|
1344
|
+
}
|
|
1345
|
+
let t = !1;
|
|
1346
|
+
try {
|
|
1347
|
+
M.value = !0;
|
|
1348
|
+
const y = e.getCustomerInfo(), u = T.value.map((R) => {
|
|
1349
|
+
const se = Number(R.paid) || 0, Te = Number(R.spots) || 1, $e = me(R), Se = de(R), Ie = R.date;
|
|
1350
|
+
return {
|
|
1351
|
+
paidAmount: se,
|
|
1352
|
+
flattenedReservationDate: `${R.resourceId}_${Ie}`,
|
|
1353
|
+
flattenedReservation: `${R.resourceId}_${Ie}_${R.startTime.replace(":", "")}`,
|
|
1354
|
+
reservation: {
|
|
1355
|
+
status: "approved",
|
|
1356
|
+
totalPrice: Number(se.toFixed(2)),
|
|
1357
|
+
basePrice: Number((se / Te).toFixed(2)),
|
|
1358
|
+
addOnsPrice: 0,
|
|
1359
|
+
addOns: [],
|
|
1360
|
+
date: Ie,
|
|
1361
|
+
id: `res_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
|
|
1362
|
+
pricingOption: {
|
|
1363
|
+
duration: $e?.duration || "",
|
|
1364
|
+
id: $e?.id || "",
|
|
1365
|
+
name: $e?.name || "",
|
|
1366
|
+
price: $e?.price || ""
|
|
1367
|
+
},
|
|
1368
|
+
pricingOptionId: R.pricingOption,
|
|
1369
|
+
resource: {
|
|
1370
|
+
avatarLabel: Se?.avatarLabel || "",
|
|
1371
|
+
color: Se?.color || "",
|
|
1372
|
+
description: Se?.description || "",
|
|
1373
|
+
id: Se?.id || "",
|
|
1374
|
+
name: Se?.name || ""
|
|
1375
|
+
},
|
|
1376
|
+
resourceId: R.resourceId,
|
|
1377
|
+
spots: Te,
|
|
1378
|
+
timeslot: {
|
|
1379
|
+
startTime: R.startTime,
|
|
1380
|
+
endTime: xe(R)
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
};
|
|
1384
|
+
}), j = Number(u.reduce((R, se) => R + se.paidAmount, 0).toFixed(2)), G = {
|
|
1385
|
+
agendaId: F.value,
|
|
1386
|
+
customerInfo: y,
|
|
1387
|
+
metadata: {},
|
|
1388
|
+
amountPaid: j,
|
|
1389
|
+
amountDue: 0,
|
|
1390
|
+
subtotal: j,
|
|
1391
|
+
total: j,
|
|
1392
|
+
createdAt: /* @__PURE__ */ new Date(),
|
|
1393
|
+
updatedAt: /* @__PURE__ */ new Date(),
|
|
1394
|
+
discount: 0,
|
|
1395
|
+
flattenedReservationDates: Array.from(new Set(u.map((R) => R.flattenedReservationDate))),
|
|
1396
|
+
flattenedReservations: u.map((R) => R.flattenedReservation),
|
|
1397
|
+
paymentStatus: "paid",
|
|
1398
|
+
paymentType: "full",
|
|
1399
|
+
reservations: u.map((R) => R.reservation),
|
|
1400
|
+
status: "confirmed"
|
|
1401
|
+
};
|
|
1402
|
+
await O.add(Q.reservationsCollection, G), t = !0, ue(`${u.length} ${u.length > 1 ? "reservations" : "reservation"} created in Studio`, {
|
|
1403
|
+
agendaId: F.value,
|
|
1404
|
+
reservationIds: u.map((R) => R.reservation.id),
|
|
1405
|
+
amountPaid: j,
|
|
1406
|
+
reservations: u.map((R) => `${R.reservation.resource.name}: ${R.reservation.date} ${R.reservation.timeslot.startTime}`)
|
|
1407
|
+
});
|
|
1408
|
+
} catch (y) {
|
|
1409
|
+
B("Failed to create reservation in Studio", {
|
|
1410
|
+
error: y instanceof Error ? y.message : String(y),
|
|
1411
|
+
agendaId: F.value
|
|
1412
|
+
}), console.error("Error creating reservation:", y);
|
|
1413
|
+
} finally {
|
|
1414
|
+
M.value = !1, t && ($.value = !1);
|
|
1415
|
+
}
|
|
1416
|
+
};
|
|
1417
|
+
return (e, o) => {
|
|
1418
|
+
const d = h("Button"), t = h("ResponsiveModalTrigger"), y = h("ResponsiveModalTitle"), u = h("ResponsiveModalHeader"), j = h("ResponsiveModalFooter"), G = h("ResponsiveModalScrollContent"), R = h("ResponsiveModal");
|
|
1419
|
+
return i(), be(R, {
|
|
1420
|
+
open: $.value,
|
|
1421
|
+
"onUpdate:open": o[1] || (o[1] = (se) => $.value = se)
|
|
1422
|
+
}, {
|
|
1423
|
+
default: c(() => [
|
|
1424
|
+
r(t, { "as-child": "" }, {
|
|
1425
|
+
default: c(() => [
|
|
1426
|
+
r(d, null, {
|
|
1427
|
+
default: c(() => [
|
|
1428
|
+
r(g(Pe), { class: "size-4" }),
|
|
1429
|
+
o[2] || (o[2] = w(" Add Reservation ", -1))
|
|
1430
|
+
]),
|
|
1431
|
+
_: 1
|
|
1432
|
+
})
|
|
1433
|
+
]),
|
|
1434
|
+
_: 1
|
|
1435
|
+
}),
|
|
1436
|
+
r(G, { class: "@container/modal sm:max-w-7xl" }, {
|
|
1437
|
+
default: c(() => [
|
|
1438
|
+
r(u, null, {
|
|
1439
|
+
default: c(() => [
|
|
1440
|
+
r(y, null, {
|
|
1441
|
+
default: c(() => [...o[3] || (o[3] = [
|
|
1442
|
+
w("Create new reservation", -1)
|
|
1443
|
+
])]),
|
|
1444
|
+
_: 1
|
|
1445
|
+
})
|
|
1446
|
+
]),
|
|
1447
|
+
_: 1
|
|
1448
|
+
}),
|
|
1449
|
+
f("div", yn, [
|
|
1450
|
+
r(ft, {
|
|
1451
|
+
ref_key: "customerInformationRef",
|
|
1452
|
+
ref: ie,
|
|
1453
|
+
agendaData: q.value
|
|
1454
|
+
}, null, 8, ["agendaData"]),
|
|
1455
|
+
o[5] || (o[5] = f("div", { class: "w-full h-[1px] bg-border my-8" }, null, -1)),
|
|
1456
|
+
f("div", xn, [
|
|
1457
|
+
o[4] || (o[4] = f("div", { class: "flex items-center justify-between gap-3" }, [
|
|
1458
|
+
f("h2", { class: "text-sm font-medium" }, "Reservations")
|
|
1459
|
+
], -1)),
|
|
1460
|
+
r(bn, {
|
|
1461
|
+
modelValue: T.value,
|
|
1462
|
+
"onUpdate:modelValue": o[0] || (o[0] = (se) => T.value = se),
|
|
1463
|
+
agendaData: q.value,
|
|
1464
|
+
"availability-by-reservation": Y.value,
|
|
1465
|
+
onAdd: ye,
|
|
1466
|
+
onQuickAdd: P
|
|
1467
|
+
}, null, 8, ["modelValue", "agendaData", "availability-by-reservation"])
|
|
1468
|
+
]),
|
|
1469
|
+
f("div", Sn, [
|
|
1470
|
+
f("ul", kn, [
|
|
1471
|
+
(i(!0), p(te, null, pe(L.value, (se) => (i(), p("li", { key: se }, k(se), 1))), 128))
|
|
1472
|
+
])
|
|
1473
|
+
])
|
|
1474
|
+
]),
|
|
1475
|
+
r(j, { class: "gap-2" }, {
|
|
1476
|
+
default: c(() => [
|
|
1477
|
+
r(d, {
|
|
1478
|
+
onClick: Ne,
|
|
1479
|
+
disabled: M.value || Z.value || v.value
|
|
1480
|
+
}, {
|
|
1481
|
+
default: c(() => [
|
|
1482
|
+
M.value ? (i(), p("span", $n, "Creating...")) : Z.value ? (i(), p("span", Tn, "Checking availability...")) : (i(), p("span", In, k(T.value.length > 1 ? `Create ${T.value.length} reservations` : "Create reservation"), 1))
|
|
1483
|
+
]),
|
|
1484
|
+
_: 1
|
|
1485
|
+
}, 8, ["disabled"])
|
|
1486
|
+
]),
|
|
1487
|
+
_: 1
|
|
1488
|
+
})
|
|
1489
|
+
]),
|
|
1490
|
+
_: 1
|
|
1491
|
+
})
|
|
1492
|
+
]),
|
|
1493
|
+
_: 1
|
|
1494
|
+
}, 8, ["open"]);
|
|
1495
|
+
};
|
|
1496
|
+
}
|
|
1497
|
+
});
|
|
1498
|
+
export {
|
|
1499
|
+
Vn as _
|
|
1500
|
+
};
|