@oneclick.dev/cms-core-modules 0.0.84 → 0.0.86
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-DPhhOkx3.mjs → ContentEditor-C5ydvk8b.mjs} +3998 -3959
- package/dist/{ContentEditor-DrxtH_Hq.js → ContentEditor-DiveHwSJ.js} +23 -23
- package/dist/{Find-XPcJxeRH.mjs → Find-Bd1uLqSa.mjs} +55 -55
- package/dist/Find-D4Qa45qC.js +1 -0
- package/dist/{TableView-BPWAx--G.mjs → TableView-Ei_w_-bn.mjs} +40 -38
- package/dist/{TableView-D63QrVlK.js → TableView-klOTPJKZ.js} +1 -1
- package/dist/View-BaFlMcM6.js +1 -0
- package/dist/View-C4MBWRlA.mjs +28 -0
- package/dist/cms-core-modules.css +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.mjs +5 -5
- package/dist/{orders-CeixEBcU.mjs → orders-DhQ2EFXS.mjs} +127 -126
- package/dist/orders-V1pch_ih.js +1 -0
- package/package.json +2 -2
- package/dist/Find-Ds6OvuH6.js +0 -1
- package/dist/View-BL70u98U.js +0 -1
- package/dist/View-BO5N911y.mjs +0 -25
- package/dist/orders-CG1QUCN8.js +0 -1
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useRoute as
|
|
3
|
-
import { ShoppingBag as
|
|
4
|
-
import { F as
|
|
5
|
-
import { _ as
|
|
6
|
-
const
|
|
1
|
+
import { defineComponent as te, ref as w, computed as b, provide as se, onMounted as oe, watch as ae, resolveComponent as x, openBlock as c, createElementBlock as m, Fragment as j, createVNode as r, withCtx as f, createElementVNode as s, unref as o, createTextVNode as C, createBlock as L, toDisplayString as d, createCommentVNode as I, normalizeClass as ne, isRef as re, renderList as ie, normalizeStyle as le, nextTick as ce } from "vue";
|
|
2
|
+
import { useRoute as de, useRouter as ue, useOverlayParams as me, useModuleRoute as pe, useModule as fe, useFirebaseIntegration as ge } from "@oneclick.dev/cms-kit";
|
|
3
|
+
import { ShoppingBag as V, Users as E, ChevronLeft as ve, ChevronRight as _e, RefreshCw as xe, Search as he, X as ye, Calendar as De, Clock as we } from "lucide-vue-next";
|
|
4
|
+
import { F as ke, _ as be } from "./ReservationDetailDialog.vue_vue_type_script_setup_true_lang-Cohhnd5x.mjs";
|
|
5
|
+
import { _ as Ce } from "./EditLayout.vue_vue_type_script_setup_true_lang-CcysXzmW.mjs";
|
|
6
|
+
const Ie = { class: "space-y-6" }, Se = { class: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4" }, Pe = { class: "text-2xl font-semibold tracking-tight flex items-center gap-2" }, Oe = { class: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4" }, Te = { class: "flex items-center gap-1" }, ze = { class: "flex items-center gap-1" }, Ne = { class: "flex items-center gap-2" }, Ae = { class: "flex items-center gap-1" }, Re = { class: "text-sm text-muted-foreground mt-2" }, Be = { class: "relative mb-4" }, Fe = {
|
|
7
7
|
key: 0,
|
|
8
8
|
class: "mb-3 text-sm text-muted-foreground"
|
|
9
|
-
},
|
|
9
|
+
}, Ue = {
|
|
10
10
|
key: 1,
|
|
11
11
|
class: "flex items-center justify-center py-8"
|
|
12
|
-
},
|
|
12
|
+
}, je = {
|
|
13
13
|
key: 2,
|
|
14
14
|
class: "text-center py-8 text-muted-foreground"
|
|
15
|
-
},
|
|
15
|
+
}, Le = {
|
|
16
16
|
key: 3,
|
|
17
17
|
class: "text-center py-8 text-muted-foreground"
|
|
18
|
-
},
|
|
18
|
+
}, Ve = {
|
|
19
19
|
key: 4,
|
|
20
20
|
class: "space-y-2"
|
|
21
|
-
},
|
|
21
|
+
}, Ee = ["onClick"], $e = { class: "flex items-start justify-between" }, He = { class: "flex-1" }, Me = { class: "font-medium" }, qe = { class: "text-sm text-muted-foreground" }, Ye = { class: "text-sm text-muted-foreground" }, Qe = { class: "flex items-center gap-4 flex-wrap mt-1" }, Xe = { class: "flex items-center gap-2 text-xs text-muted-foreground" }, Ge = { class: "flex items-center gap-2 text-xs text-muted-foreground" }, Je = {
|
|
22
22
|
key: 0,
|
|
23
23
|
class: "flex items-center gap-1 text-xs text-muted-foreground"
|
|
24
|
-
},
|
|
24
|
+
}, Ke = { class: "flex items-center gap-2 mt-1 text-xs text-muted-foreground" }, We = { class: "text-right" }, Ze = {
|
|
25
25
|
key: 0,
|
|
26
26
|
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"
|
|
27
|
-
},
|
|
27
|
+
}, et = {
|
|
28
28
|
key: 1,
|
|
29
29
|
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"
|
|
30
|
-
},
|
|
30
|
+
}, tt = {
|
|
31
31
|
key: 2,
|
|
32
32
|
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"
|
|
33
|
-
},
|
|
33
|
+
}, st = {
|
|
34
34
|
key: 3,
|
|
35
35
|
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"
|
|
36
|
-
},
|
|
36
|
+
}, ot = {
|
|
37
37
|
key: 4,
|
|
38
38
|
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"
|
|
39
|
-
},
|
|
39
|
+
}, at = {
|
|
40
40
|
key: 5,
|
|
41
41
|
class: "text-sm font-medium mt-1"
|
|
42
|
-
},
|
|
42
|
+
}, mt = /* @__PURE__ */ te({
|
|
43
43
|
__name: "orders",
|
|
44
|
-
setup(
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
const { params:
|
|
48
|
-
date:
|
|
44
|
+
setup(nt) {
|
|
45
|
+
const B = de();
|
|
46
|
+
ue();
|
|
47
|
+
const F = me(), { params: U } = pe(), { config: S } = fe(), z = ge(S.project), g = w([]), P = w([]), k = w(!0), _ = w(""), N = w(null), h = /* @__PURE__ */ new Date(), p = w(/* @__PURE__ */ new Date()), $ = b(() => ({
|
|
48
|
+
date: X(p.value),
|
|
49
49
|
resource: null
|
|
50
50
|
}));
|
|
51
|
-
|
|
52
|
-
const
|
|
51
|
+
se("event", $);
|
|
52
|
+
const H = b(() => {
|
|
53
53
|
const e = new Date(h);
|
|
54
54
|
e.setDate(h.getDate() - 1);
|
|
55
55
|
const t = new Date(h);
|
|
@@ -59,29 +59,29 @@ const be = { class: "space-y-6" }, Ce = { class: "flex flex-col sm:flex-row sm:i
|
|
|
59
59
|
day: "numeric",
|
|
60
60
|
year: "numeric"
|
|
61
61
|
});
|
|
62
|
-
}),
|
|
62
|
+
}), M = () => {
|
|
63
63
|
const e = new Date(p.value);
|
|
64
64
|
e.setDate(e.getDate() - 1), p.value = e;
|
|
65
|
-
},
|
|
65
|
+
}, q = () => {
|
|
66
66
|
const e = new Date(p.value);
|
|
67
67
|
e.setDate(e.getDate() + 1), e <= h && (p.value = e);
|
|
68
|
-
},
|
|
68
|
+
}, Y = b(() => {
|
|
69
69
|
const e = new Date(p.value);
|
|
70
70
|
return e.setDate(e.getDate() + 1), e <= h;
|
|
71
|
-
}),
|
|
71
|
+
}), Q = () => {
|
|
72
72
|
p.value = /* @__PURE__ */ new Date();
|
|
73
|
-
},
|
|
74
|
-
const t = e.getFullYear(),
|
|
75
|
-
return `${t}-${
|
|
76
|
-
},
|
|
73
|
+
}, X = (e) => {
|
|
74
|
+
const t = e.getFullYear(), n = String(e.getMonth() + 1).padStart(2, "0"), i = String(e.getDate()).padStart(2, "0");
|
|
75
|
+
return `${t}-${n}-${i}`;
|
|
76
|
+
}, G = (e) => e ? new Date(e).toLocaleTimeString("en-US", {
|
|
77
77
|
hour: "2-digit",
|
|
78
78
|
minute: "2-digit",
|
|
79
79
|
hour12: !1
|
|
80
|
-
}) : "",
|
|
80
|
+
}) : "", J = (e) => e ? new Date(e).toLocaleDateString("en-US", {
|
|
81
81
|
weekday: "short",
|
|
82
82
|
month: "short",
|
|
83
83
|
day: "numeric"
|
|
84
|
-
}) : "",
|
|
84
|
+
}) : "", A = b(() => _.value.trim() ? new ke(g.value, {
|
|
85
85
|
keys: [
|
|
86
86
|
"customerInfo.firstName",
|
|
87
87
|
"customerInfo.lastName",
|
|
@@ -95,33 +95,33 @@ const be = { class: "space-y-6" }, Ce = { class: "flex flex-col sm:flex-row sm:i
|
|
|
95
95
|
spots: g.value.reduce((e, t) => e + (t.spots || 0), 0),
|
|
96
96
|
bookings: g.value.length,
|
|
97
97
|
revenue: g.value.reduce((e, t) => e + (t.reservationPrice || 0), 0)
|
|
98
|
-
})),
|
|
98
|
+
})), K = () => {
|
|
99
99
|
_.value = "";
|
|
100
|
-
},
|
|
100
|
+
}, W = async () => {
|
|
101
101
|
try {
|
|
102
|
-
const e =
|
|
103
|
-
P.value = t?.resources?.filter((
|
|
102
|
+
const e = U.value.id, t = await z.get(S.agendaCollection, e);
|
|
103
|
+
P.value = t?.resources?.filter((n) => n.isActive) || [];
|
|
104
104
|
} catch (e) {
|
|
105
105
|
console.error("Error loading resources:", e), P.value = [];
|
|
106
106
|
}
|
|
107
107
|
}, y = async () => {
|
|
108
108
|
k.value = !0, g.value = [];
|
|
109
109
|
try {
|
|
110
|
-
const e =
|
|
110
|
+
const e = U.value.id, t = new Date(p.value);
|
|
111
111
|
t.setHours(0, 0, 0, 0);
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
const i = await
|
|
112
|
+
const n = new Date(p.value);
|
|
113
|
+
n.setHours(23, 59, 59, 999);
|
|
114
|
+
const i = await z.find(S.reservationsCollection, {
|
|
115
115
|
filters: [
|
|
116
116
|
{ field: "agendaId", operator: "==", value: e },
|
|
117
117
|
{ field: "createdAt", operator: ">=", value: t.toISOString() },
|
|
118
|
-
{ field: "createdAt", operator: "<=", value:
|
|
118
|
+
{ field: "createdAt", operator: "<=", value: n.toISOString() }
|
|
119
119
|
]
|
|
120
120
|
});
|
|
121
121
|
let v = [];
|
|
122
122
|
i.forEach((l) => {
|
|
123
123
|
(l.reservations || []).forEach((u) => {
|
|
124
|
-
const T = P.value.find((
|
|
124
|
+
const T = P.value.find((R) => R.id === u.resourceId);
|
|
125
125
|
v.push({
|
|
126
126
|
customerInfo: l.customerInfo,
|
|
127
127
|
amountDue: l.amountDue,
|
|
@@ -154,26 +154,26 @@ const be = { class: "space-y-6" }, Ce = { class: "flex flex-col sm:flex-row sm:i
|
|
|
154
154
|
} finally {
|
|
155
155
|
k.value = !1;
|
|
156
156
|
}
|
|
157
|
-
},
|
|
158
|
-
await
|
|
159
|
-
},
|
|
160
|
-
const
|
|
157
|
+
}, Z = async () => {
|
|
158
|
+
await W(), await y();
|
|
159
|
+
}, ee = async (e, t) => {
|
|
160
|
+
const n = await z.get(S.reservationsCollection, e), i = n?.reservations?.find((v) => v.id === t);
|
|
161
161
|
if (i) {
|
|
162
162
|
const v = P.value.find((D) => D.id === i.resourceId), l = {
|
|
163
|
-
customerInfo:
|
|
164
|
-
amountDue:
|
|
165
|
-
amountPaid:
|
|
166
|
-
status:
|
|
163
|
+
customerInfo: n.customerInfo,
|
|
164
|
+
amountDue: n.amountDue,
|
|
165
|
+
amountPaid: n.amountPaid,
|
|
166
|
+
status: n.status,
|
|
167
167
|
reservationStatus: i.status,
|
|
168
|
-
subtotal:
|
|
169
|
-
total:
|
|
170
|
-
discount:
|
|
171
|
-
id:
|
|
168
|
+
subtotal: n.subtotal,
|
|
169
|
+
total: n.total,
|
|
170
|
+
discount: n.discount,
|
|
171
|
+
id: n.id,
|
|
172
172
|
res_id: i.id,
|
|
173
173
|
resourceId: i.resourceId,
|
|
174
174
|
spots: i.spots,
|
|
175
175
|
date: i.date,
|
|
176
|
-
createdAt:
|
|
176
|
+
createdAt: n.createdAt,
|
|
177
177
|
startTime: i.timeslot?.startTime,
|
|
178
178
|
endTime: i.timeslot?.endTime,
|
|
179
179
|
reservationPrice: i.totalPrice,
|
|
@@ -184,41 +184,42 @@ const be = { class: "space-y-6" }, Ce = { class: "flex flex-col sm:flex-row sm:i
|
|
|
184
184
|
resourceName: v?.name || "Unknown",
|
|
185
185
|
resourceColor: v?.color
|
|
186
186
|
};
|
|
187
|
-
await
|
|
187
|
+
await ce(), N.value?.openDialog(l);
|
|
188
188
|
}
|
|
189
189
|
};
|
|
190
|
-
return
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
190
|
+
return Z(), oe(async () => {
|
|
191
|
+
const e = F.value.orderId || B.query.orderId, t = F.value.reservationId || B.query.reservationId;
|
|
192
|
+
if (e) {
|
|
193
|
+
const n = new URL(window.location.href);
|
|
194
|
+
n.searchParams.delete("orderId"), n.searchParams.delete("reservationId"), window.history.replaceState(window.history.state, "", n.toString()), await ee(e, t);
|
|
194
195
|
}
|
|
195
|
-
}),
|
|
196
|
+
}), ae(p, () => {
|
|
196
197
|
y();
|
|
197
198
|
}), (e, t) => {
|
|
198
|
-
const
|
|
199
|
-
return c(), m(
|
|
200
|
-
r(
|
|
199
|
+
const n = x("Badge"), i = x("CardTitle"), v = x("CardDescription"), l = x("Button"), D = x("CardHeader"), u = x("Input"), T = x("CardContent"), R = x("Card");
|
|
200
|
+
return c(), m(j, null, [
|
|
201
|
+
r(Ce, null, {
|
|
201
202
|
default: f(() => [
|
|
202
|
-
s("div",
|
|
203
|
-
s("div",
|
|
203
|
+
s("div", Ie, [
|
|
204
|
+
s("div", Se, [
|
|
204
205
|
s("div", null, [
|
|
205
|
-
s("h1",
|
|
206
|
-
r(o(
|
|
206
|
+
s("h1", Pe, [
|
|
207
|
+
r(o(V), { class: "size-6" }),
|
|
207
208
|
t[1] || (t[1] = C(" Orders ", -1))
|
|
208
209
|
]),
|
|
209
210
|
t[2] || (t[2] = s("p", { class: "text-muted-foreground text-sm mt-1" }, " View orders by when they were placed ", -1))
|
|
210
211
|
])
|
|
211
212
|
]),
|
|
212
|
-
r(
|
|
213
|
+
r(R, null, {
|
|
213
214
|
default: f(() => [
|
|
214
215
|
r(D, null, {
|
|
215
216
|
default: f(() => [
|
|
216
|
-
s("div",
|
|
217
|
+
s("div", Oe, [
|
|
217
218
|
s("div", null, [
|
|
218
219
|
r(i, { class: "flex items-center gap-2" }, {
|
|
219
220
|
default: f(() => [
|
|
220
221
|
t[3] || (t[3] = C(" Orders received ", -1)),
|
|
221
|
-
o(O).bookings > 0 ? (c(),
|
|
222
|
+
o(O).bookings > 0 ? (c(), L(n, {
|
|
222
223
|
key: 0,
|
|
223
224
|
variant: "secondary"
|
|
224
225
|
}, {
|
|
@@ -232,25 +233,25 @@ const be = { class: "space-y-6" }, Ce = { class: "flex flex-col sm:flex-row sm:i
|
|
|
232
233
|
}),
|
|
233
234
|
r(v, { class: "flex items-center gap-4 mt-1" }, {
|
|
234
235
|
default: f(() => [
|
|
235
|
-
s("span",
|
|
236
|
-
r(o(
|
|
236
|
+
s("span", Te, [
|
|
237
|
+
r(o(E), { size: 14 }),
|
|
237
238
|
C(" " + d(o(O).spots) + " spots ", 1)
|
|
238
239
|
]),
|
|
239
|
-
s("span",
|
|
240
|
+
s("span", ze, " €" + d(o(O).revenue.toFixed(2)) + " revenue ", 1)
|
|
240
241
|
]),
|
|
241
242
|
_: 1
|
|
242
243
|
})
|
|
243
244
|
]),
|
|
244
|
-
s("div",
|
|
245
|
-
s("div",
|
|
245
|
+
s("div", Ne, [
|
|
246
|
+
s("div", Ae, [
|
|
246
247
|
r(l, {
|
|
247
248
|
variant: "ghost",
|
|
248
249
|
size: "icon",
|
|
249
250
|
class: "size-8",
|
|
250
|
-
onClick:
|
|
251
|
+
onClick: M
|
|
251
252
|
}, {
|
|
252
253
|
default: f(() => [
|
|
253
|
-
r(o(
|
|
254
|
+
r(o(ve), { size: 16 })
|
|
254
255
|
]),
|
|
255
256
|
_: 1
|
|
256
257
|
}),
|
|
@@ -258,7 +259,7 @@ const be = { class: "space-y-6" }, Ce = { class: "flex flex-col sm:flex-row sm:i
|
|
|
258
259
|
variant: "ghost",
|
|
259
260
|
size: "sm",
|
|
260
261
|
class: "h-8 px-3 text-xs",
|
|
261
|
-
onClick:
|
|
262
|
+
onClick: Q
|
|
262
263
|
}, {
|
|
263
264
|
default: f(() => [...t[4] || (t[4] = [
|
|
264
265
|
C(" Today ", -1)
|
|
@@ -269,11 +270,11 @@ const be = { class: "space-y-6" }, Ce = { class: "flex flex-col sm:flex-row sm:i
|
|
|
269
270
|
variant: "ghost",
|
|
270
271
|
size: "icon",
|
|
271
272
|
class: "size-8",
|
|
272
|
-
onClick:
|
|
273
|
-
disabled: !o(
|
|
273
|
+
onClick: q,
|
|
274
|
+
disabled: !o(Y)
|
|
274
275
|
}, {
|
|
275
276
|
default: f(() => [
|
|
276
|
-
r(o(
|
|
277
|
+
r(o(_e), { size: 16 })
|
|
277
278
|
]),
|
|
278
279
|
_: 1
|
|
279
280
|
}, 8, ["disabled"])
|
|
@@ -285,7 +286,7 @@ const be = { class: "space-y-6" }, Ce = { class: "flex flex-col sm:flex-row sm:i
|
|
|
285
286
|
disabled: o(k)
|
|
286
287
|
}, {
|
|
287
288
|
default: f(() => [
|
|
288
|
-
r(o(
|
|
289
|
+
r(o(xe), {
|
|
289
290
|
size: 16,
|
|
290
291
|
class: ne({ "animate-spin": o(k) })
|
|
291
292
|
}, null, 8, ["class"])
|
|
@@ -294,81 +295,81 @@ const be = { class: "space-y-6" }, Ce = { class: "flex flex-col sm:flex-row sm:i
|
|
|
294
295
|
}, 8, ["disabled"])
|
|
295
296
|
])
|
|
296
297
|
]),
|
|
297
|
-
s("div",
|
|
298
|
+
s("div", Re, d(o(H)), 1)
|
|
298
299
|
]),
|
|
299
300
|
_: 1
|
|
300
301
|
}),
|
|
301
302
|
r(T, null, {
|
|
302
303
|
default: f(() => [
|
|
303
|
-
s("div",
|
|
304
|
-
r(o(
|
|
304
|
+
s("div", Be, [
|
|
305
|
+
r(o(he), {
|
|
305
306
|
size: 16,
|
|
306
307
|
class: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"
|
|
307
308
|
}),
|
|
308
309
|
r(u, {
|
|
309
310
|
modelValue: o(_),
|
|
310
|
-
"onUpdate:modelValue": t[0] || (t[0] = (
|
|
311
|
+
"onUpdate:modelValue": t[0] || (t[0] = (a) => re(_) ? _.value = a : null),
|
|
311
312
|
placeholder: "Search by name, email, or phone...",
|
|
312
313
|
class: "pl-9 pr-9"
|
|
313
314
|
}, null, 8, ["modelValue"]),
|
|
314
|
-
o(_) ? (c(),
|
|
315
|
+
o(_) ? (c(), L(l, {
|
|
315
316
|
key: 0,
|
|
316
317
|
variant: "ghost",
|
|
317
318
|
size: "icon",
|
|
318
319
|
class: "absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7",
|
|
319
|
-
onClick:
|
|
320
|
+
onClick: K
|
|
320
321
|
}, {
|
|
321
322
|
default: f(() => [
|
|
322
|
-
r(o(
|
|
323
|
+
r(o(ye), { size: 14 })
|
|
323
324
|
]),
|
|
324
325
|
_: 1
|
|
325
326
|
})) : I("", !0)
|
|
326
327
|
]),
|
|
327
|
-
o(_) ? (c(), m("div",
|
|
328
|
-
o(k) ? (c(), m("div",
|
|
328
|
+
o(_) ? (c(), m("div", Fe, " Showing " + d(o(A).length) + " of " + d(o(g).length) + " orders ", 1)) : I("", !0),
|
|
329
|
+
o(k) ? (c(), m("div", Ue, [...t[5] || (t[5] = [
|
|
329
330
|
s("div", { class: "animate-spin rounded-full h-8 w-8 border-b-2 border-primary" }, null, -1)
|
|
330
|
-
])])) : o(g).length === 0 ? (c(), m("div",
|
|
331
|
-
r(o(
|
|
331
|
+
])])) : o(g).length === 0 ? (c(), m("div", je, [
|
|
332
|
+
r(o(V), { class: "size-12 mx-auto mb-3 opacity-50" }),
|
|
332
333
|
t[6] || (t[6] = s("p", null, "No orders received on this day", -1))
|
|
333
|
-
])) : o(
|
|
334
|
-
(c(!0), m(
|
|
335
|
-
key:
|
|
334
|
+
])) : o(A).length === 0 ? (c(), m("div", Le, " No orders match your search ")) : (c(), m("div", Ve, [
|
|
335
|
+
(c(!0), m(j, null, ie(o(A), (a) => (c(), m("div", {
|
|
336
|
+
key: a.res_id || a.id,
|
|
336
337
|
class: "p-3 border rounded-lg hover:bg-muted/50 transition-colors cursor-pointer",
|
|
337
|
-
onClick: (
|
|
338
|
+
onClick: (rt) => o(N)?.openDialog(a)
|
|
338
339
|
}, [
|
|
339
|
-
s("div",
|
|
340
|
-
s("div",
|
|
341
|
-
s("div",
|
|
342
|
-
s("div",
|
|
343
|
-
s("div",
|
|
344
|
-
s("div",
|
|
345
|
-
s("div",
|
|
346
|
-
r(o(
|
|
347
|
-
s("span", null, d(
|
|
340
|
+
s("div", $e, [
|
|
341
|
+
s("div", He, [
|
|
342
|
+
s("div", Me, d(a.customerInfo?.firstName) + " " + d(a.customerInfo?.lastName || "Unknown Customer"), 1),
|
|
343
|
+
s("div", qe, d(a.customerInfo?.email), 1),
|
|
344
|
+
s("div", Ye, d(a.customerInfo?.phone), 1),
|
|
345
|
+
s("div", Qe, [
|
|
346
|
+
s("div", Xe, [
|
|
347
|
+
r(o(De), { size: 12 }),
|
|
348
|
+
s("span", null, d(J(a.date)) + " · " + d(a.startTime) + " - " + d(a.endTime), 1)
|
|
348
349
|
]),
|
|
349
|
-
s("div",
|
|
350
|
-
r(o(
|
|
351
|
-
s("span", null, d(
|
|
350
|
+
s("div", Ge, [
|
|
351
|
+
r(o(E), { size: 12 }),
|
|
352
|
+
s("span", null, d(a.spots) + " spots", 1)
|
|
352
353
|
]),
|
|
353
|
-
|
|
354
|
+
a.resourceName ? (c(), m("div", Je, [
|
|
354
355
|
s("div", {
|
|
355
356
|
class: "w-3 h-3 rounded-full",
|
|
356
|
-
style:
|
|
357
|
+
style: le({ backgroundColor: a.resourceColor || "#6b7280" })
|
|
357
358
|
}, null, 4),
|
|
358
|
-
s("span", null, d(
|
|
359
|
+
s("span", null, d(a.resourceName), 1)
|
|
359
360
|
])) : I("", !0)
|
|
360
361
|
]),
|
|
361
|
-
s("div",
|
|
362
|
-
r(o(
|
|
363
|
-
s("span", null, "Ordered at " + d(
|
|
362
|
+
s("div", Ke, [
|
|
363
|
+
r(o(we), { size: 12 }),
|
|
364
|
+
s("span", null, "Ordered at " + d(G(a.createdAt)), 1)
|
|
364
365
|
])
|
|
365
366
|
]),
|
|
366
|
-
s("div",
|
|
367
|
-
|
|
368
|
-
|
|
367
|
+
s("div", We, [
|
|
368
|
+
a.reservationStatus === "needs_approval" ? (c(), m("span", Ze, "Needs Approval")) : a.reservationStatus === "approved" ? (c(), m("span", et, "Approved")) : a.reservationStatus === "rejected" ? (c(), m("span", tt, "Rejected")) : a.reservationStatus === "cancelled" ? (c(), m("span", st, "Cancelled")) : (c(), m("span", ot, "Pending")),
|
|
369
|
+
a.reservationPrice || a.reservationPrice === 0 ? (c(), m("div", at, " €" + d(a.reservationPrice.toFixed(2)), 1)) : I("", !0)
|
|
369
370
|
])
|
|
370
371
|
])
|
|
371
|
-
], 8,
|
|
372
|
+
], 8, Ee))), 128))
|
|
372
373
|
]))
|
|
373
374
|
]),
|
|
374
375
|
_: 1
|
|
@@ -380,9 +381,9 @@ const be = { class: "space-y-6" }, Ce = { class: "flex flex-col sm:flex-row sm:i
|
|
|
380
381
|
]),
|
|
381
382
|
_: 1
|
|
382
383
|
}),
|
|
383
|
-
r(
|
|
384
|
+
r(be, {
|
|
384
385
|
ref_key: "reservationDetailDialog",
|
|
385
|
-
ref:
|
|
386
|
+
ref: N,
|
|
386
387
|
onCancelled: y,
|
|
387
388
|
onConfirmed: y,
|
|
388
389
|
onRejected: y
|
|
@@ -392,5 +393,5 @@ const be = { class: "space-y-6" }, Ce = { class: "flex flex-col sm:flex-row sm:i
|
|
|
392
393
|
}
|
|
393
394
|
});
|
|
394
395
|
export {
|
|
395
|
-
|
|
396
|
+
mt as default
|
|
396
397
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),v=require("@oneclick.dev/cms-kit"),i=require("lucide-vue-next"),E=require("./ReservationDetailDialog.vue_vue_type_script_setup_true_lang-VWVIxIr6.js"),M=require("./EditLayout.vue_vue_type_script_setup_true_lang-Czu6Dcde.js"),H={class:"space-y-6"},$={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4"},Y={class:"text-2xl font-semibold tracking-tight flex items-center gap-2"},K={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4"},Q={class:"flex items-center gap-1"},X={class:"flex items-center gap-1"},G={class:"flex items-center gap-2"},J={class:"flex items-center gap-1"},W={class:"text-sm text-muted-foreground mt-2"},Z={class:"relative mb-4"},ee={key:0,class:"mb-3 text-sm text-muted-foreground"},te={key:1,class:"flex items-center justify-center py-8"},oe={key:2,class:"text-center py-8 text-muted-foreground"},ne={key:3,class:"text-center py-8 text-muted-foreground"},se={key:4,class:"space-y-2"},re=["onClick"],ae={class:"flex items-start justify-between"},le={class:"flex-1"},ce={class:"font-medium"},ie={class:"text-sm text-muted-foreground"},de={class:"text-sm text-muted-foreground"},ue={class:"flex items-center gap-4 flex-wrap mt-1"},me={class:"flex items-center gap-2 text-xs text-muted-foreground"},pe={class:"flex items-center gap-2 text-xs text-muted-foreground"},fe={key:0,class:"flex items-center gap-1 text-xs text-muted-foreground"},ge={class:"flex items-center gap-2 mt-1 text-xs text-muted-foreground"},ve={class:"text-right"},_e={key:0,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"},xe={key:1,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"},ye={key:2,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"},he={key:3,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"},ke={key:4,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"},Ne={key:5,class:"text-sm font-medium mt-1"},De=e.defineComponent({__name:"orders",setup(we){const C=v.useRoute();v.useRouter();const S=v.useOverlayParams(),{params:b}=v.useModuleRoute(),{config:x}=v.useModule(),N=v.useFirebaseIntegration(x.project),d=e.ref([]),y=e.ref([]),_=e.ref(!0),m=e.ref(""),D=e.ref(null),p=new Date,c=e.ref(new Date),B=e.computed(()=>({date:A(c.value),resource:null}));e.provide("event",B);const I=e.computed(()=>{const t=new Date(p);t.setDate(p.getDate()-1);const o=new Date(p);return o.setDate(p.getDate()+1),c.value.toDateString()===p.toDateString()?"Today":c.value.toDateString()===t.toDateString()?"Yesterday":c.value.toDateString()===o.toDateString()?"Tomorrow":c.value.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})}),P=()=>{const t=new Date(c.value);t.setDate(t.getDate()-1),c.value=t},T=()=>{const t=new Date(c.value);t.setDate(t.getDate()+1),t<=p&&(c.value=t)},O=e.computed(()=>{const t=new Date(c.value);return t.setDate(t.getDate()+1),t<=p}),z=()=>{c.value=new Date},A=t=>{const o=t.getFullYear(),s=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return`${o}-${s}-${r}`},R=t=>t?new Date(t).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1}):"",U=t=>t?new Date(t).toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"}):"",w=e.computed(()=>m.value.trim()?new E.Fuse(d.value,{keys:["customerInfo.firstName","customerInfo.lastName","customerInfo.email","customerInfo.phone","resourceName"],threshold:.3,ignoreLocation:!0}).search(m.value).map(o=>o.item):d.value),h=e.computed(()=>({spots:d.value.reduce((t,o)=>t+(o.spots||0),0),bookings:d.value.length,revenue:d.value.reduce((t,o)=>t+(o.reservationPrice||0),0)})),j=()=>{m.value=""},F=async()=>{try{const t=b.value.id,o=await N.get(x.agendaCollection,t);y.value=o?.resources?.filter(s=>s.isActive)||[]}catch(t){console.error("Error loading resources:",t),y.value=[]}},f=async()=>{_.value=!0,d.value=[];try{const t=b.value.id,o=new Date(c.value);o.setHours(0,0,0,0);const s=new Date(c.value);s.setHours(23,59,59,999);const r=await N.find(x.reservationsCollection,{filters:[{field:"agendaId",operator:"==",value:t},{field:"createdAt",operator:">=",value:o.toISOString()},{field:"createdAt",operator:"<=",value:s.toISOString()}]});let u=[];r.forEach(a=>{(a.reservations||[]).forEach(l=>{const k=y.value.find(V=>V.id===l.resourceId);u.push({customerInfo:a.customerInfo,amountDue:a.amountDue,amountPaid:a.amountPaid,status:a.status,reservationStatus:l.status,subtotal:a.subtotal,total:a.total,discount:a.discount,id:a.id,res_id:l.id,resourceId:l.resourceId,spots:l.spots,date:l.date,createdAt:a.createdAt,startTime:l.timeslot?.startTime,endTime:l.timeslot?.endTime,reservationPrice:l.totalPrice,reservationBasePrice:l.basePrice,reservationAddOnsPrice:l.addOnsPrice,pricingOptionId:l.pricingOptionId,pricingOption:l.pricingOption,resourceName:k?.name||"Unknown",resourceColor:k?.color})})}),d.value=u.sort((a,g)=>(g.createdAt||"").localeCompare(a.createdAt||""))}catch(t){console.error("Error loading orders:",t),d.value=[]}finally{_.value=!1}},L=async()=>{await F(),await f()},q=async(t,o)=>{const s=await N.get(x.reservationsCollection,t),r=s?.reservations?.find(u=>u.id===o);if(r){const u=y.value.find(g=>g.id===r.resourceId),a={customerInfo:s.customerInfo,amountDue:s.amountDue,amountPaid:s.amountPaid,status:s.status,reservationStatus:r.status,subtotal:s.subtotal,total:s.total,discount:s.discount,id:s.id,res_id:r.id,resourceId:r.resourceId,spots:r.spots,date:r.date,createdAt:s.createdAt,startTime:r.timeslot?.startTime,endTime:r.timeslot?.endTime,reservationPrice:r.totalPrice,reservationBasePrice:r.basePrice,reservationAddOnsPrice:r.addOnsPrice,pricingOptionId:r.pricingOptionId,pricingOption:r.pricingOption,resourceName:u?.name||"Unknown",resourceColor:u?.color};await e.nextTick(),D.value?.openDialog(a)}};return L(),e.onMounted(async()=>{const t=S.value.orderId||C.query.orderId,o=S.value.reservationId||C.query.reservationId;if(t){const s=new URL(window.location.href);s.searchParams.delete("orderId"),s.searchParams.delete("reservationId"),window.history.replaceState(window.history.state,"",s.toString()),await q(t,o)}}),e.watch(c,()=>{f()}),(t,o)=>{const s=e.resolveComponent("Badge"),r=e.resolveComponent("CardTitle"),u=e.resolveComponent("CardDescription"),a=e.resolveComponent("Button"),g=e.resolveComponent("CardHeader"),l=e.resolveComponent("Input"),k=e.resolveComponent("CardContent"),V=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(M._sfc_main,null,{default:e.withCtx(()=>[e.createElementVNode("div",H,[e.createElementVNode("div",$,[e.createElementVNode("div",null,[e.createElementVNode("h1",Y,[e.createVNode(e.unref(i.ShoppingBag),{class:"size-6"}),o[1]||(o[1]=e.createTextVNode(" Orders ",-1))]),o[2]||(o[2]=e.createElementVNode("p",{class:"text-muted-foreground text-sm mt-1"}," View orders by when they were placed ",-1))])]),e.createVNode(V,null,{default:e.withCtx(()=>[e.createVNode(g,null,{default:e.withCtx(()=>[e.createElementVNode("div",K,[e.createElementVNode("div",null,[e.createVNode(r,{class:"flex items-center gap-2"},{default:e.withCtx(()=>[o[3]||(o[3]=e.createTextVNode(" Orders received ",-1)),e.unref(h).bookings>0?(e.openBlock(),e.createBlock(s,{key:0,variant:"secondary"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).bookings),1)]),_:1})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(u,{class:"flex items-center gap-4 mt-1"},{default:e.withCtx(()=>[e.createElementVNode("span",Q,[e.createVNode(e.unref(i.Users),{size:14}),e.createTextVNode(" "+e.toDisplayString(e.unref(h).spots)+" spots ",1)]),e.createElementVNode("span",X," €"+e.toDisplayString(e.unref(h).revenue.toFixed(2))+" revenue ",1)]),_:1})]),e.createElementVNode("div",G,[e.createElementVNode("div",J,[e.createVNode(a,{variant:"ghost",size:"icon",class:"size-8",onClick:P},{default:e.withCtx(()=>[e.createVNode(e.unref(i.ChevronLeft),{size:16})]),_:1}),e.createVNode(a,{variant:"ghost",size:"sm",class:"h-8 px-3 text-xs",onClick:z},{default:e.withCtx(()=>[...o[4]||(o[4]=[e.createTextVNode(" Today ",-1)])]),_:1}),e.createVNode(a,{variant:"ghost",size:"icon",class:"size-8",onClick:T,disabled:!e.unref(O)},{default:e.withCtx(()=>[e.createVNode(e.unref(i.ChevronRight),{size:16})]),_:1},8,["disabled"])]),e.createVNode(a,{variant:"ghost",size:"icon",onClick:f,disabled:e.unref(_)},{default:e.withCtx(()=>[e.createVNode(e.unref(i.RefreshCw),{size:16,class:e.normalizeClass({"animate-spin":e.unref(_)})},null,8,["class"])]),_:1},8,["disabled"])])]),e.createElementVNode("div",W,e.toDisplayString(e.unref(I)),1)]),_:1}),e.createVNode(k,null,{default:e.withCtx(()=>[e.createElementVNode("div",Z,[e.createVNode(e.unref(i.Search),{size:16,class:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),e.createVNode(l,{modelValue:e.unref(m),"onUpdate:modelValue":o[0]||(o[0]=n=>e.isRef(m)?m.value=n:null),placeholder:"Search by name, email, or phone...",class:"pl-9 pr-9"},null,8,["modelValue"]),e.unref(m)?(e.openBlock(),e.createBlock(a,{key:0,variant:"ghost",size:"icon",class:"absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7",onClick:j},{default:e.withCtx(()=>[e.createVNode(e.unref(i.X),{size:14})]),_:1})):e.createCommentVNode("",!0)]),e.unref(m)?(e.openBlock(),e.createElementBlock("div",ee," Showing "+e.toDisplayString(e.unref(w).length)+" of "+e.toDisplayString(e.unref(d).length)+" orders ",1)):e.createCommentVNode("",!0),e.unref(_)?(e.openBlock(),e.createElementBlock("div",te,[...o[5]||(o[5]=[e.createElementVNode("div",{class:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"},null,-1)])])):e.unref(d).length===0?(e.openBlock(),e.createElementBlock("div",oe,[e.createVNode(e.unref(i.ShoppingBag),{class:"size-12 mx-auto mb-3 opacity-50"}),o[6]||(o[6]=e.createElementVNode("p",null,"No orders received on this day",-1))])):e.unref(w).length===0?(e.openBlock(),e.createElementBlock("div",ne," No orders match your search ")):(e.openBlock(),e.createElementBlock("div",se,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(w),n=>(e.openBlock(),e.createElementBlock("div",{key:n.res_id||n.id,class:"p-3 border rounded-lg hover:bg-muted/50 transition-colors cursor-pointer",onClick:Ve=>e.unref(D)?.openDialog(n)},[e.createElementVNode("div",ae,[e.createElementVNode("div",le,[e.createElementVNode("div",ce,e.toDisplayString(n.customerInfo?.firstName)+" "+e.toDisplayString(n.customerInfo?.lastName||"Unknown Customer"),1),e.createElementVNode("div",ie,e.toDisplayString(n.customerInfo?.email),1),e.createElementVNode("div",de,e.toDisplayString(n.customerInfo?.phone),1),e.createElementVNode("div",ue,[e.createElementVNode("div",me,[e.createVNode(e.unref(i.Calendar),{size:12}),e.createElementVNode("span",null,e.toDisplayString(U(n.date))+" · "+e.toDisplayString(n.startTime)+" - "+e.toDisplayString(n.endTime),1)]),e.createElementVNode("div",pe,[e.createVNode(e.unref(i.Users),{size:12}),e.createElementVNode("span",null,e.toDisplayString(n.spots)+" spots",1)]),n.resourceName?(e.openBlock(),e.createElementBlock("div",fe,[e.createElementVNode("div",{class:"w-3 h-3 rounded-full",style:e.normalizeStyle({backgroundColor:n.resourceColor||"#6b7280"})},null,4),e.createElementVNode("span",null,e.toDisplayString(n.resourceName),1)])):e.createCommentVNode("",!0)]),e.createElementVNode("div",ge,[e.createVNode(e.unref(i.Clock),{size:12}),e.createElementVNode("span",null,"Ordered at "+e.toDisplayString(R(n.createdAt)),1)])]),e.createElementVNode("div",ve,[n.reservationStatus==="needs_approval"?(e.openBlock(),e.createElementBlock("span",_e,"Needs Approval")):n.reservationStatus==="approved"?(e.openBlock(),e.createElementBlock("span",xe,"Approved")):n.reservationStatus==="rejected"?(e.openBlock(),e.createElementBlock("span",ye,"Rejected")):n.reservationStatus==="cancelled"?(e.openBlock(),e.createElementBlock("span",he,"Cancelled")):(e.openBlock(),e.createElementBlock("span",ke,"Pending")),n.reservationPrice||n.reservationPrice===0?(e.openBlock(),e.createElementBlock("div",Ne," €"+e.toDisplayString(n.reservationPrice.toFixed(2)),1)):e.createCommentVNode("",!0)])])],8,re))),128))]))]),_:1})]),_:1})])]),_:1}),e.createVNode(E._sfc_main,{ref_key:"reservationDetailDialog",ref:D,onCancelled:f,onConfirmed:f,onRejected:f},null,512)],64)}}});exports.default=De;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oneclick.dev/cms-core-modules",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.86",
|
|
4
4
|
"main": "dist/index.cjs.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@formkit/drag-and-drop": "^0.5.3",
|
|
30
30
|
"@internationalized/date": "^3.8.0",
|
|
31
|
-
"@oneclick.dev/cms-kit": "0.0.
|
|
31
|
+
"@oneclick.dev/cms-kit": "0.0.96",
|
|
32
32
|
"@tanstack/vue-table": "^8.21.3",
|
|
33
33
|
"@vee-validate/zod": "^4.15.0",
|
|
34
34
|
"@vue-flow/core": "^1.48.1",
|
package/dist/Find-Ds6OvuH6.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),r=require("@oneclick.dev/cms-kit"),x=require("lucide-vue-next"),P=require("./index-4tjmIans.js"),A={class:"relative"},M={ref:"container",class:"w-full max-w-5xl mx-auto"},j={class:"flex justify-between items-center mb-4"},z={class:"relative w-full max-w-sm items-center"},F={class:"absolute start-0 inset-y-0 flex items-center justify-center px-2 pointer-events-none"},R={class:"absolute end-0 inset-y-0 flex items-center justify-center px-2 pointer-events-none"},H=e.defineComponent({__name:"Find",props:{config:{type:Object,required:!0}},async setup(T){let n,d;const f=T,{hasPermission:I}=r.useModulePermissions(),{navigateTo:N}=r.useModuleRoute(),{getModuleData:b}=r.useModuleStorage();r.useModuleBreadcrumbs(()=>[{text:"Promo codes list"}]);const m=e.ref([]);m.value=([n,d]=e.withAsyncContext(()=>b("promo-types")),n=await n,d(),n||[]);const c=e.ref([]),v=r.useFirebaseIntegration(f.config.project);c.value=([n,d]=e.withAsyncContext(()=>v.find(f.config.promoCodeCollection)),n=await n,d(),n);const V=r.useRoute(),k=r.useRouter(),l=e.ref(V.query.q||""),p=e.ref(""),C=e.ref(!1),y=P.useDebounceFn(async()=>{C.value=!0;let a=l.value.trim().toUpperCase();a.length===0?c.value=await v.find(f.config.promoCodeCollection):c.value=await v.find(f.config.promoCodeCollection,{filters:[{field:"code",operator:">=",value:a},{field:"code",operator:"<",value:a.slice(0,-1)+String.fromCharCode(a.slice(-1).charCodeAt(0)+1)}]}),p.value=l.value,C.value=!1},600);e.watch(l,async()=>{await y(),k.replace({query:{...V.query,q:l.value.trim()?l.value.trim():void 0}})});const h=a=>{const t=new Date;return a.expiresAt>t&&a.startsAt<t};return e.onMounted(async()=>{l.value.trim()&&await y()}),(a,t)=>{const w=e.resolveComponent("Button"),B=e.resolveComponent("Input"),_=e.resolveComponent("TableCaption"),s=e.resolveComponent("TableHead"),g=e.resolveComponent("TableRow"),S=e.resolveComponent("TableHeader"),i=e.resolveComponent("TableCell"),q=e.resolveComponent("TableBody"),D=e.resolveComponent("Table"),E=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock("div",A,[e.createElementVNode("div",M,[e.createElementVNode("div",j,[t[3]||(t[3]=e.createElementVNode("h1",{class:"text-2xl font-bold"},"Find Promo Codes",-1)),e.createVNode(w,{onClick:t[0]||(t[0]=o=>e.unref(N)("")),variant:"outline"},{default:e.withCtx(()=>[e.createVNode(e.unref(x.Plus),{class:"size-4"}),t[2]||(t[2]=e.createTextVNode(" Create New Promo Code ",-1))]),_:1})]),e.createVNode(E,{class:"p-4"},{default:e.withCtx(()=>[e.createElementVNode("div",z,[e.createVNode(B,{id:"search",type:"text",placeholder:"Search...",modelValue:l.value,"onUpdate:modelValue":t[1]||(t[1]=o=>l.value=o),class:"px-8"},null,8,["modelValue"]),e.createElementVNode("span",F,[e.createVNode(e.unref(x.Search),{class:"size-4 text-muted-foreground"})]),e.createElementVNode("span",R,[C.value?(e.openBlock(),e.createBlock(e.unref(x.Loader2),{key:0,class:"size-4 text-muted-foreground animate-spin"})):e.createCommentVNode("",!0)])]),e.createVNode(D,null,{default:e.withCtx(()=>[p.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(_,{key:0},{default:e.withCtx(()=>[...t[4]||(t[4]=[e.createTextVNode("A list of your most recent promo codes.",-1)])]),_:1})),p.value?(e.openBlock(),e.createBlock(_,{key:1},{default:e.withCtx(()=>[t[5]||(t[5]=e.createTextVNode("A list of your promo codes starting with ",-1)),e.createElementVNode("strong",null,'"'+e.toDisplayString(p.value)+'"',1),t[6]||(t[6]=e.createTextVNode(".",-1))]),_:1})):e.createCommentVNode("",!0),e.createVNode(S,null,{default:e.withCtx(()=>[e.createVNode(g,null,{default:e.withCtx(()=>[e.createVNode(s,null,{default:e.withCtx(()=>[...t[7]||(t[7]=[e.createTextVNode("Code",-1)])]),_:1}),e.createVNode(s,null,{default:e.withCtx(()=>[...t[8]||(t[8]=[e.createTextVNode("Type",-1)])]),_:1}),e.createVNode(s,null,{default:e.withCtx(()=>[...t[9]||(t[9]=[e.createTextVNode("Value",-1)])]),_:1}),e.createVNode(s,null,{default:e.withCtx(()=>[...t[10]||(t[10]=[e.createTextVNode("Used",-1)])]),_:1}),e.createVNode(s,null,{default:e.withCtx(()=>[...t[11]||(t[11]=[e.createTextVNode("Still eligible",-1)])]),_:1}),e.createVNode(s,null,{default:e.withCtx(()=>[...t[12]||(t[12]=[e.createTextVNode("Action",-1)])]),_:1})]),_:1})]),_:1}),c.value?.length>0?(e.openBlock(),e.createBlock(q,{key:2},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,o=>(e.openBlock(),e.createBlock(g,{key:o.id},{default:e.withCtx(()=>[e.createVNode(i,{class:"font-medium uppercase"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.code),1)]),_:2},1024),e.createVNode(i,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(m.value.find(u=>u.key===o.type)?.label),1)]),_:2},1024),e.createVNode(i,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(m.value.find(u=>u.key===o.type)?.valuePrefix)+" "+e.toDisplayString(o.value)+" "+e.toDisplayString(m.value.find(u=>u.key===o.type)?.valueSuffix),1)]),_:2},1024),e.createVNode(i,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.usageLimit===1?o.usageCount>0?"Yes":"No":o.usageCount===0?"No":o.usageCount===1?"1 time":o.usageCount+" times"),1)]),_:2},1024),e.createVNode(i,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(h(o)?"Yes":"No"),1)]),_:2},1024),e.createVNode(i,null,{default:e.withCtx(()=>[e.createVNode(w,{variant:"ghost",size:"icon",onClick:u=>e.unref(N)("/promo-codes/"+o.id)},{default:e.withCtx(()=>[e.createVNode(e.unref(x.Pencil),{class:"size-4"})]),_:1},8,["onClick"])]),_:2},1024)]),_:2},1024))),128))]),_:1})):e.createCommentVNode("",!0)]),_:1})]),_:1})],512)])}}});exports.default=H;
|
package/dist/View-BL70u98U.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),r=require("@oneclick.dev/cms-kit"),a={class:"flex-1 bg-[#fcfcfc] dark:bg-muted/20 rounded-lg border shadow overflow-hidden mt-4"},d=e.defineComponent({__name:"View",setup(i){const s=r.useRoute(),{config:u}=r.useModule(),c=t=>{document.documentElement.dataset.moduleOverlayMode==="true"&&window.parent.postMessage({type:"module-overlay:close"},"*")},l=e.computed(()=>Object.entries(s.query).reduce((t,[n,o])=>(t[n]=o,t),{}));return(t,n)=>{const o=e.resolveComponent("FormDisplayer");return e.openBlock(),e.createElementBlock("div",a,[e.createVNode(o,{settings:e.unref(u).formLayout,onFinish:c,variables:[],inputValues:l.value,style:{background:"transparent"}},null,8,["settings","inputValues"])])}}});exports.default=d;
|
package/dist/View-BO5N911y.mjs
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { defineComponent as a, computed as c, resolveComponent as l, openBlock as d, createElementBlock as m, createVNode as i, unref as p } from "vue";
|
|
2
|
-
import { useRoute as f, useModule as _ } from "@oneclick.dev/cms-kit";
|
|
3
|
-
const g = { class: "flex-1 bg-[#fcfcfc] dark:bg-muted/20 rounded-lg border shadow overflow-hidden mt-4" }, h = /* @__PURE__ */ a({
|
|
4
|
-
__name: "View",
|
|
5
|
-
setup(y) {
|
|
6
|
-
const n = f(), { config: r } = _(), s = (e) => {
|
|
7
|
-
document.documentElement.dataset.moduleOverlayMode === "true" && window.parent.postMessage({ type: "module-overlay:close" }, "*");
|
|
8
|
-
}, u = c(() => Object.entries(n.query).reduce((e, [o, t]) => (e[o] = t, e), {}));
|
|
9
|
-
return (e, o) => {
|
|
10
|
-
const t = l("FormDisplayer");
|
|
11
|
-
return d(), m("div", g, [
|
|
12
|
-
i(t, {
|
|
13
|
-
settings: p(r).formLayout,
|
|
14
|
-
onFinish: s,
|
|
15
|
-
variables: [],
|
|
16
|
-
inputValues: u.value,
|
|
17
|
-
style: { background: "transparent" }
|
|
18
|
-
}, null, 8, ["settings", "inputValues"])
|
|
19
|
-
]);
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
export {
|
|
24
|
-
h as default
|
|
25
|
-
};
|
package/dist/orders-CG1QUCN8.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),_=require("@oneclick.dev/cms-kit"),i=require("lucide-vue-next"),b=require("./ReservationDetailDialog.vue_vue_type_script_setup_true_lang-VWVIxIr6.js"),q=require("./EditLayout.vue_vue_type_script_setup_true_lang-Czu6Dcde.js"),M={class:"space-y-6"},H={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4"},$={class:"text-2xl font-semibold tracking-tight flex items-center gap-2"},Y={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4"},K={class:"flex items-center gap-1"},Q={class:"flex items-center gap-1"},X={class:"flex items-center gap-2"},G={class:"flex items-center gap-1"},J={class:"text-sm text-muted-foreground mt-2"},W={class:"relative mb-4"},Z={key:0,class:"mb-3 text-sm text-muted-foreground"},ee={key:1,class:"flex items-center justify-center py-8"},te={key:2,class:"text-center py-8 text-muted-foreground"},oe={key:3,class:"text-center py-8 text-muted-foreground"},ne={key:4,class:"space-y-2"},se=["onClick"],re={class:"flex items-start justify-between"},ae={class:"flex-1"},le={class:"font-medium"},ce={class:"text-sm text-muted-foreground"},ie={class:"text-sm text-muted-foreground"},de={class:"flex items-center gap-4 flex-wrap mt-1"},ue={class:"flex items-center gap-2 text-xs text-muted-foreground"},me={class:"flex items-center gap-2 text-xs text-muted-foreground"},pe={key:0,class:"flex items-center gap-1 text-xs text-muted-foreground"},fe={class:"flex items-center gap-2 mt-1 text-xs text-muted-foreground"},ge={class:"text-right"},ve={key:0,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"},_e={key:1,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"},xe={key:2,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"},ye={key:3,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"},he={key:4,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"},ke={key:5,class:"text-sm font-medium mt-1"},Ne=e.defineComponent({__name:"orders",setup(De){const N=_.useRoute();_.useRouter();const{params:S}=_.useModuleRoute(),{config:x}=_.useModule(),D=_.useFirebaseIntegration(x.project),d=e.ref([]),y=e.ref([]),v=e.ref(!0),m=e.ref(""),w=e.ref(null),p=new Date,c=e.ref(new Date),E=e.computed(()=>({date:z(c.value),resource:null}));e.provide("event",E);const B=e.computed(()=>{const t=new Date(p);t.setDate(p.getDate()-1);const o=new Date(p);return o.setDate(p.getDate()+1),c.value.toDateString()===p.toDateString()?"Today":c.value.toDateString()===t.toDateString()?"Yesterday":c.value.toDateString()===o.toDateString()?"Tomorrow":c.value.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})}),I=()=>{const t=new Date(c.value);t.setDate(t.getDate()-1),c.value=t},T=()=>{const t=new Date(c.value);t.setDate(t.getDate()+1),t<=p&&(c.value=t)},P=e.computed(()=>{const t=new Date(c.value);return t.setDate(t.getDate()+1),t<=p}),O=()=>{c.value=new Date},z=t=>{const o=t.getFullYear(),s=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return`${o}-${s}-${r}`},A=t=>t?new Date(t).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1}):"",R=t=>t?new Date(t).toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"}):"",V=e.computed(()=>m.value.trim()?new b.Fuse(d.value,{keys:["customerInfo.firstName","customerInfo.lastName","customerInfo.email","customerInfo.phone","resourceName"],threshold:.3,ignoreLocation:!0}).search(m.value).map(o=>o.item):d.value),h=e.computed(()=>({spots:d.value.reduce((t,o)=>t+(o.spots||0),0),bookings:d.value.length,revenue:d.value.reduce((t,o)=>t+(o.reservationPrice||0),0)})),U=()=>{m.value=""},j=async()=>{try{const t=S.value.id,o=await D.get(x.agendaCollection,t);y.value=o?.resources?.filter(s=>s.isActive)||[]}catch(t){console.error("Error loading resources:",t),y.value=[]}},f=async()=>{v.value=!0,d.value=[];try{const t=S.value.id,o=new Date(c.value);o.setHours(0,0,0,0);const s=new Date(c.value);s.setHours(23,59,59,999);const r=await D.find(x.reservationsCollection,{filters:[{field:"agendaId",operator:"==",value:t},{field:"createdAt",operator:">=",value:o.toISOString()},{field:"createdAt",operator:"<=",value:s.toISOString()}]});let u=[];r.forEach(a=>{(a.reservations||[]).forEach(l=>{const k=y.value.find(C=>C.id===l.resourceId);u.push({customerInfo:a.customerInfo,amountDue:a.amountDue,amountPaid:a.amountPaid,status:a.status,reservationStatus:l.status,subtotal:a.subtotal,total:a.total,discount:a.discount,id:a.id,res_id:l.id,resourceId:l.resourceId,spots:l.spots,date:l.date,createdAt:a.createdAt,startTime:l.timeslot?.startTime,endTime:l.timeslot?.endTime,reservationPrice:l.totalPrice,reservationBasePrice:l.basePrice,reservationAddOnsPrice:l.addOnsPrice,pricingOptionId:l.pricingOptionId,pricingOption:l.pricingOption,resourceName:k?.name||"Unknown",resourceColor:k?.color})})}),d.value=u.sort((a,g)=>(g.createdAt||"").localeCompare(a.createdAt||""))}catch(t){console.error("Error loading orders:",t),d.value=[]}finally{v.value=!1}},F=async()=>{await j(),await f()},L=async(t,o)=>{const s=await D.get(x.reservationsCollection,t),r=s?.reservations?.find(u=>u.id===o);if(r){const u=y.value.find(g=>g.id===r.resourceId),a={customerInfo:s.customerInfo,amountDue:s.amountDue,amountPaid:s.amountPaid,status:s.status,reservationStatus:r.status,subtotal:s.subtotal,total:s.total,discount:s.discount,id:s.id,res_id:r.id,resourceId:r.resourceId,spots:r.spots,date:r.date,createdAt:s.createdAt,startTime:r.timeslot?.startTime,endTime:r.timeslot?.endTime,reservationPrice:r.totalPrice,reservationBasePrice:r.basePrice,reservationAddOnsPrice:r.addOnsPrice,pricingOptionId:r.pricingOptionId,pricingOption:r.pricingOption,resourceName:u?.name||"Unknown",resourceColor:u?.color};await e.nextTick(),w.value?.openDialog(a)}};return F(),e.onMounted(async()=>{if(N.query.orderId){const t=N.query.orderId,o=N.query.reservationId,s=new URL(window.location.href);s.searchParams.delete("orderId"),s.searchParams.delete("reservationId"),window.history.replaceState(window.history.state,"",s.toString()),await L(t,o)}}),e.watch(c,()=>{f()}),(t,o)=>{const s=e.resolveComponent("Badge"),r=e.resolveComponent("CardTitle"),u=e.resolveComponent("CardDescription"),a=e.resolveComponent("Button"),g=e.resolveComponent("CardHeader"),l=e.resolveComponent("Input"),k=e.resolveComponent("CardContent"),C=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(q._sfc_main,null,{default:e.withCtx(()=>[e.createElementVNode("div",M,[e.createElementVNode("div",H,[e.createElementVNode("div",null,[e.createElementVNode("h1",$,[e.createVNode(e.unref(i.ShoppingBag),{class:"size-6"}),o[1]||(o[1]=e.createTextVNode(" Orders ",-1))]),o[2]||(o[2]=e.createElementVNode("p",{class:"text-muted-foreground text-sm mt-1"}," View orders by when they were placed ",-1))])]),e.createVNode(C,null,{default:e.withCtx(()=>[e.createVNode(g,null,{default:e.withCtx(()=>[e.createElementVNode("div",Y,[e.createElementVNode("div",null,[e.createVNode(r,{class:"flex items-center gap-2"},{default:e.withCtx(()=>[o[3]||(o[3]=e.createTextVNode(" Orders received ",-1)),e.unref(h).bookings>0?(e.openBlock(),e.createBlock(s,{key:0,variant:"secondary"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h).bookings),1)]),_:1})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(u,{class:"flex items-center gap-4 mt-1"},{default:e.withCtx(()=>[e.createElementVNode("span",K,[e.createVNode(e.unref(i.Users),{size:14}),e.createTextVNode(" "+e.toDisplayString(e.unref(h).spots)+" spots ",1)]),e.createElementVNode("span",Q," €"+e.toDisplayString(e.unref(h).revenue.toFixed(2))+" revenue ",1)]),_:1})]),e.createElementVNode("div",X,[e.createElementVNode("div",G,[e.createVNode(a,{variant:"ghost",size:"icon",class:"size-8",onClick:I},{default:e.withCtx(()=>[e.createVNode(e.unref(i.ChevronLeft),{size:16})]),_:1}),e.createVNode(a,{variant:"ghost",size:"sm",class:"h-8 px-3 text-xs",onClick:O},{default:e.withCtx(()=>[...o[4]||(o[4]=[e.createTextVNode(" Today ",-1)])]),_:1}),e.createVNode(a,{variant:"ghost",size:"icon",class:"size-8",onClick:T,disabled:!e.unref(P)},{default:e.withCtx(()=>[e.createVNode(e.unref(i.ChevronRight),{size:16})]),_:1},8,["disabled"])]),e.createVNode(a,{variant:"ghost",size:"icon",onClick:f,disabled:e.unref(v)},{default:e.withCtx(()=>[e.createVNode(e.unref(i.RefreshCw),{size:16,class:e.normalizeClass({"animate-spin":e.unref(v)})},null,8,["class"])]),_:1},8,["disabled"])])]),e.createElementVNode("div",J,e.toDisplayString(e.unref(B)),1)]),_:1}),e.createVNode(k,null,{default:e.withCtx(()=>[e.createElementVNode("div",W,[e.createVNode(e.unref(i.Search),{size:16,class:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),e.createVNode(l,{modelValue:e.unref(m),"onUpdate:modelValue":o[0]||(o[0]=n=>e.isRef(m)?m.value=n:null),placeholder:"Search by name, email, or phone...",class:"pl-9 pr-9"},null,8,["modelValue"]),e.unref(m)?(e.openBlock(),e.createBlock(a,{key:0,variant:"ghost",size:"icon",class:"absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7",onClick:U},{default:e.withCtx(()=>[e.createVNode(e.unref(i.X),{size:14})]),_:1})):e.createCommentVNode("",!0)]),e.unref(m)?(e.openBlock(),e.createElementBlock("div",Z," Showing "+e.toDisplayString(e.unref(V).length)+" of "+e.toDisplayString(e.unref(d).length)+" orders ",1)):e.createCommentVNode("",!0),e.unref(v)?(e.openBlock(),e.createElementBlock("div",ee,[...o[5]||(o[5]=[e.createElementVNode("div",{class:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"},null,-1)])])):e.unref(d).length===0?(e.openBlock(),e.createElementBlock("div",te,[e.createVNode(e.unref(i.ShoppingBag),{class:"size-12 mx-auto mb-3 opacity-50"}),o[6]||(o[6]=e.createElementVNode("p",null,"No orders received on this day",-1))])):e.unref(V).length===0?(e.openBlock(),e.createElementBlock("div",oe," No orders match your search ")):(e.openBlock(),e.createElementBlock("div",ne,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(V),n=>(e.openBlock(),e.createElementBlock("div",{key:n.res_id||n.id,class:"p-3 border rounded-lg hover:bg-muted/50 transition-colors cursor-pointer",onClick:we=>e.unref(w)?.openDialog(n)},[e.createElementVNode("div",re,[e.createElementVNode("div",ae,[e.createElementVNode("div",le,e.toDisplayString(n.customerInfo?.firstName)+" "+e.toDisplayString(n.customerInfo?.lastName||"Unknown Customer"),1),e.createElementVNode("div",ce,e.toDisplayString(n.customerInfo?.email),1),e.createElementVNode("div",ie,e.toDisplayString(n.customerInfo?.phone),1),e.createElementVNode("div",de,[e.createElementVNode("div",ue,[e.createVNode(e.unref(i.Calendar),{size:12}),e.createElementVNode("span",null,e.toDisplayString(R(n.date))+" · "+e.toDisplayString(n.startTime)+" - "+e.toDisplayString(n.endTime),1)]),e.createElementVNode("div",me,[e.createVNode(e.unref(i.Users),{size:12}),e.createElementVNode("span",null,e.toDisplayString(n.spots)+" spots",1)]),n.resourceName?(e.openBlock(),e.createElementBlock("div",pe,[e.createElementVNode("div",{class:"w-3 h-3 rounded-full",style:e.normalizeStyle({backgroundColor:n.resourceColor||"#6b7280"})},null,4),e.createElementVNode("span",null,e.toDisplayString(n.resourceName),1)])):e.createCommentVNode("",!0)]),e.createElementVNode("div",fe,[e.createVNode(e.unref(i.Clock),{size:12}),e.createElementVNode("span",null,"Ordered at "+e.toDisplayString(A(n.createdAt)),1)])]),e.createElementVNode("div",ge,[n.reservationStatus==="needs_approval"?(e.openBlock(),e.createElementBlock("span",ve,"Needs Approval")):n.reservationStatus==="approved"?(e.openBlock(),e.createElementBlock("span",_e,"Approved")):n.reservationStatus==="rejected"?(e.openBlock(),e.createElementBlock("span",xe,"Rejected")):n.reservationStatus==="cancelled"?(e.openBlock(),e.createElementBlock("span",ye,"Cancelled")):(e.openBlock(),e.createElementBlock("span",he,"Pending")),n.reservationPrice||n.reservationPrice===0?(e.openBlock(),e.createElementBlock("div",ke," €"+e.toDisplayString(n.reservationPrice.toFixed(2)),1)):e.createCommentVNode("",!0)])])],8,se))),128))]))]),_:1})]),_:1})])]),_:1}),e.createVNode(b._sfc_main,{ref_key:"reservationDetailDialog",ref:w,onCancelled:f,onConfirmed:f,onRejected:f},null,512)],64)}}});exports.default=Ne;
|