@oneclick.dev/cms-core-modules 0.0.60 → 0.0.62
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-BAepN3Yd.js → ContentEditor-DKFCmfOs.js} +1 -1
- package/dist/{ContentEditor-BPjWW3d1.mjs → ContentEditor-owdOIage.mjs} +1 -1
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-DRVxQswt.js +1 -0
- package/dist/{NewReservationDialog.vue_vue_type_script_setup_true_lang-BJitmbPE.mjs → NewReservationDialog.vue_vue_type_script_setup_true_lang-DkgDWC2i.mjs} +130 -125
- package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-B7ks5mbf.mjs +2332 -0
- package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-Vxubki_v.js +349 -0
- package/dist/{TableView-BxK6R8v3.js → TableView-BqhL_P45.js} +100 -100
- package/dist/{TableView-B8iLWWcP.mjs → TableView-Dbl8qcUy.mjs} +14990 -14727
- package/dist/agenda-DFNJ8C1N.mjs +1136 -0
- package/dist/agenda-MjkwV63A.js +1 -0
- package/dist/floating-ui.dom-CBBY0Ism.js +1 -0
- package/dist/floating-ui.dom-xfqXu4GA.mjs +1138 -0
- package/dist/{index-DTago6vW-Bhr8E1Y6.js → index-CgfL8UKf-DAN7RkzR.js} +10 -10
- package/dist/{index-DTago6vW-CnomHQ_S.mjs → index-CgfL8UKf-DUUg9HDA.mjs} +904 -875
- package/dist/index-DBDq-h4j.js +245 -0
- package/dist/{index-BDaVYdkD.mjs → index-X0L4AHBR.mjs} +2406 -2394
- package/dist/index.cjs.js +1 -1
- package/dist/index.mjs +5 -5
- package/dist/orders-Bqa3Z3tH.mjs +356 -0
- package/dist/orders-D5GJOZXN.js +1 -0
- package/dist/src/appointments/components/edit/EventDialog/ApproveReservationDialog.vue.d.ts +8 -0
- package/dist/src/appointments/components/edit/EventDialog/BookingsList.vue.d.ts +39 -9
- package/dist/src/appointments/components/edit/EventDialog/CancelReservationDialog.vue.d.ts +2 -2
- package/dist/src/appointments/components/edit/EventDialog/RejectReservationDialog.vue.d.ts +8 -0
- package/dist/src/appointments/components/edit/EventDialog/ReservationDetailDialog.vue.d.ts +36 -8
- package/dist/src/appointments/components/edit/dashboard/BookingsList.vue.d.ts +46 -9
- package/dist/src/appointments/components/edit/dashboard/Timeline.vue.d.ts +19 -0
- package/dist/src/appointments/pages/edit/orders.vue.d.ts +39 -9
- package/package.json +2 -2
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-D50uTpZY.js +0 -1
- package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-CI8YgHdU.js +0 -345
- package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-P-MWwcVh.mjs +0 -2093
- package/dist/agenda-D81m29_4.mjs +0 -1135
- package/dist/agenda-uzPPxgsW.js +0 -1
- package/dist/floating-ui.dom-C82nbomj.js +0 -1
- package/dist/floating-ui.dom-ouSgPqty.mjs +0 -1133
- package/dist/index-DfV8-6ON.js +0 -245
- package/dist/orders-Bh8w0ueq.mjs +0 -346
- package/dist/orders-Dt0zMz97.js +0 -1
- package/dist/src/appointments/components/edit/EventDialog/ResendConfirmationDialog.vue.d.ts +0 -4
package/dist/orders-Bh8w0ueq.mjs
DELETED
|
@@ -1,346 +0,0 @@
|
|
|
1
|
-
import { defineComponent as W, ref as y, computed as w, provide as Z, watch as ee, resolveComponent as _, openBlock as d, createBlock as A, withCtx as u, createElementVNode as t, createVNode as a, unref as o, createTextVNode as k, toDisplayString as r, createCommentVNode as C, normalizeClass as E, isRef as te, createElementBlock as g, Fragment as se, renderList as oe, normalizeStyle as ne } from "vue";
|
|
2
|
-
import { useModuleRoute as ae, useModule as re, useFirebaseIntegration as le } from "@oneclick.dev/cms-kit";
|
|
3
|
-
import { ShoppingBag as L, Users as U, ChevronLeft as ie, ChevronRight as ce, RefreshCw as de, Search as ue, X as me, Calendar as ge, Clock as fe } from "lucide-vue-next";
|
|
4
|
-
import { F as pe, _ as ve } from "./ReservationDetailDialog.vue_vue_type_script_setup_true_lang-P-MWwcVh.mjs";
|
|
5
|
-
import { _ as _e } from "./EditLayout.vue_vue_type_script_setup_true_lang-CcysXzmW.mjs";
|
|
6
|
-
const he = { class: "space-y-6" }, xe = { class: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4" }, ye = { class: "text-2xl font-semibold tracking-tight flex items-center gap-2" }, De = { class: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4" }, we = { class: "flex items-center gap-1" }, ke = { class: "flex items-center gap-1" }, Ce = { class: "flex items-center gap-2" }, be = { class: "flex items-center gap-1" }, Se = { class: "text-sm text-muted-foreground mt-2" }, Ie = { class: "relative mb-4" }, ze = {
|
|
7
|
-
key: 0,
|
|
8
|
-
class: "mb-3 text-sm text-muted-foreground"
|
|
9
|
-
}, Ne = {
|
|
10
|
-
key: 1,
|
|
11
|
-
class: "flex items-center justify-center py-8"
|
|
12
|
-
}, Oe = {
|
|
13
|
-
key: 2,
|
|
14
|
-
class: "text-center py-8 text-muted-foreground"
|
|
15
|
-
}, Te = {
|
|
16
|
-
key: 3,
|
|
17
|
-
class: "text-center py-8 text-muted-foreground"
|
|
18
|
-
}, Pe = {
|
|
19
|
-
key: 4,
|
|
20
|
-
class: "space-y-2"
|
|
21
|
-
}, Ae = ["onClick"], Be = { class: "flex items-start justify-between" }, Fe = { class: "flex-1" }, Re = { class: "font-medium" }, Ve = { class: "text-sm text-muted-foreground" }, Ee = { class: "text-sm text-muted-foreground" }, Le = { class: "flex items-center gap-4 flex-wrap mt-1" }, Ue = { class: "flex items-center gap-2 text-xs text-muted-foreground" }, $e = { class: "flex items-center gap-2 text-xs text-muted-foreground" }, je = {
|
|
22
|
-
key: 0,
|
|
23
|
-
class: "flex items-center gap-1 text-xs text-muted-foreground"
|
|
24
|
-
}, He = { class: "flex items-center gap-2 mt-1 text-xs text-muted-foreground" }, Me = { class: "text-right" }, Ye = {
|
|
25
|
-
key: 0,
|
|
26
|
-
class: "text-sm font-medium mt-1"
|
|
27
|
-
}, et = /* @__PURE__ */ W({
|
|
28
|
-
__name: "orders",
|
|
29
|
-
setup(Qe) {
|
|
30
|
-
const { params: B } = ae(), { config: O } = re(), F = le(O.project), m = y([]), T = y([]), D = y(!0), f = y(""), R = y(null), h = /* @__PURE__ */ new Date(), l = y(/* @__PURE__ */ new Date()), $ = w(() => ({
|
|
31
|
-
date: V(l.value),
|
|
32
|
-
resource: null
|
|
33
|
-
}));
|
|
34
|
-
Z("event", $);
|
|
35
|
-
const j = w(() => {
|
|
36
|
-
const e = new Date(h);
|
|
37
|
-
e.setDate(h.getDate() - 1);
|
|
38
|
-
const s = new Date(h);
|
|
39
|
-
return s.setDate(h.getDate() + 1), l.value.toDateString() === h.toDateString() ? "Today" : l.value.toDateString() === e.toDateString() ? "Yesterday" : l.value.toDateString() === s.toDateString() ? "Tomorrow" : l.value.toLocaleDateString("en-US", {
|
|
40
|
-
weekday: "long",
|
|
41
|
-
month: "long",
|
|
42
|
-
day: "numeric",
|
|
43
|
-
year: "numeric"
|
|
44
|
-
});
|
|
45
|
-
}), H = () => {
|
|
46
|
-
const e = new Date(l.value);
|
|
47
|
-
e.setDate(e.getDate() - 1), l.value = e;
|
|
48
|
-
}, M = () => {
|
|
49
|
-
const e = new Date(l.value);
|
|
50
|
-
e.setDate(e.getDate() + 1), e <= h && (l.value = e);
|
|
51
|
-
}, Y = w(() => {
|
|
52
|
-
const e = new Date(l.value);
|
|
53
|
-
return e.setDate(e.getDate() + 1), e <= h;
|
|
54
|
-
}), Q = () => {
|
|
55
|
-
l.value = /* @__PURE__ */ new Date();
|
|
56
|
-
}, V = (e) => {
|
|
57
|
-
const s = e.getFullYear(), p = String(e.getMonth() + 1).padStart(2, "0"), x = String(e.getDate()).padStart(2, "0");
|
|
58
|
-
return `${s}-${p}-${x}`;
|
|
59
|
-
}, X = (e) => e ? new Date(e).toLocaleTimeString("en-US", {
|
|
60
|
-
hour: "2-digit",
|
|
61
|
-
minute: "2-digit",
|
|
62
|
-
hour12: !1
|
|
63
|
-
}) : "", q = (e) => e ? new Date(e).toLocaleDateString("en-US", {
|
|
64
|
-
weekday: "short",
|
|
65
|
-
month: "short",
|
|
66
|
-
day: "numeric"
|
|
67
|
-
}) : "", P = w(() => f.value.trim() ? new pe(m.value, {
|
|
68
|
-
keys: [
|
|
69
|
-
"customerInfo.firstName",
|
|
70
|
-
"customerInfo.lastName",
|
|
71
|
-
"customerInfo.email",
|
|
72
|
-
"customerInfo.phone",
|
|
73
|
-
"resourceName"
|
|
74
|
-
],
|
|
75
|
-
threshold: 0.3,
|
|
76
|
-
ignoreLocation: !0
|
|
77
|
-
}).search(f.value).map((s) => s.item) : m.value), b = w(() => ({
|
|
78
|
-
spots: m.value.reduce((e, s) => e + (s.spots || 0), 0),
|
|
79
|
-
bookings: m.value.length,
|
|
80
|
-
revenue: m.value.reduce((e, s) => e + (s.reservationPrice || 0), 0)
|
|
81
|
-
})), G = () => {
|
|
82
|
-
f.value = "";
|
|
83
|
-
}, J = async () => {
|
|
84
|
-
try {
|
|
85
|
-
const e = B.value.id, s = await F.get(O.agendaCollection, e);
|
|
86
|
-
T.value = s?.resources?.filter((p) => p.isActive) || [];
|
|
87
|
-
} catch (e) {
|
|
88
|
-
console.error("Error loading resources:", e), T.value = [];
|
|
89
|
-
}
|
|
90
|
-
}, S = async () => {
|
|
91
|
-
D.value = !0, m.value = [];
|
|
92
|
-
try {
|
|
93
|
-
const e = B.value.id, s = V(l.value), p = new Date(l.value);
|
|
94
|
-
p.setHours(0, 0, 0, 0);
|
|
95
|
-
const x = new Date(l.value);
|
|
96
|
-
x.setHours(23, 59, 59, 999);
|
|
97
|
-
const I = await F.find(O.reservationsCollection, {
|
|
98
|
-
filters: [
|
|
99
|
-
{ field: "agendaId", operator: "==", value: e },
|
|
100
|
-
{ field: "createdAt", operator: ">=", value: p.toISOString() },
|
|
101
|
-
{ field: "createdAt", operator: "<=", value: x.toISOString() }
|
|
102
|
-
]
|
|
103
|
-
});
|
|
104
|
-
console.log("allOrders", I);
|
|
105
|
-
let v = [];
|
|
106
|
-
I.forEach((i) => {
|
|
107
|
-
(i.reservations || []).forEach((c) => {
|
|
108
|
-
const N = T.value.find((n) => n.id === c.resourceId);
|
|
109
|
-
v.push({
|
|
110
|
-
customerInfo: i.customerInfo,
|
|
111
|
-
amountDue: i.amountDue,
|
|
112
|
-
amountPaid: i.amountPaid,
|
|
113
|
-
status: i.status,
|
|
114
|
-
subtotal: i.subtotal,
|
|
115
|
-
total: i.total,
|
|
116
|
-
discount: i.discount,
|
|
117
|
-
id: i.id,
|
|
118
|
-
res_id: c.id,
|
|
119
|
-
resourceId: c.resourceId,
|
|
120
|
-
spots: c.spots,
|
|
121
|
-
date: c.date,
|
|
122
|
-
createdAt: i.createdAt,
|
|
123
|
-
startTime: c.timeslot?.startTime,
|
|
124
|
-
endTime: c.timeslot?.endTime,
|
|
125
|
-
reservationPrice: c.totalPrice,
|
|
126
|
-
reservationBasePrice: c.basePrice,
|
|
127
|
-
reservationAddOnsPrice: c.addOnsPrice,
|
|
128
|
-
pricingOptionId: c.pricingOptionId,
|
|
129
|
-
pricingOption: c.pricingOption,
|
|
130
|
-
resourceName: N?.name || "Unknown",
|
|
131
|
-
resourceColor: N?.color
|
|
132
|
-
});
|
|
133
|
-
});
|
|
134
|
-
}), m.value = v.sort((i, z) => (z.createdAt || "").localeCompare(i.createdAt || ""));
|
|
135
|
-
} catch (e) {
|
|
136
|
-
console.error("Error loading orders:", e), m.value = [];
|
|
137
|
-
} finally {
|
|
138
|
-
D.value = !1;
|
|
139
|
-
}
|
|
140
|
-
}, K = () => {
|
|
141
|
-
S();
|
|
142
|
-
};
|
|
143
|
-
return (async () => (await J(), await S()))(), ee(l, () => {
|
|
144
|
-
S();
|
|
145
|
-
}), (e, s) => {
|
|
146
|
-
const p = _("Badge"), x = _("CardTitle"), I = _("CardDescription"), v = _("Button"), i = _("CardHeader"), z = _("Input"), c = _("CardContent"), N = _("Card");
|
|
147
|
-
return d(), A(_e, null, {
|
|
148
|
-
default: u(() => [
|
|
149
|
-
t("div", he, [
|
|
150
|
-
t("div", xe, [
|
|
151
|
-
t("div", null, [
|
|
152
|
-
t("h1", ye, [
|
|
153
|
-
a(o(L), { class: "size-6" }),
|
|
154
|
-
s[1] || (s[1] = k(" Orders ", -1))
|
|
155
|
-
]),
|
|
156
|
-
s[2] || (s[2] = t("p", { class: "text-muted-foreground text-sm mt-1" }, " View orders by when they were placed ", -1))
|
|
157
|
-
])
|
|
158
|
-
]),
|
|
159
|
-
a(N, null, {
|
|
160
|
-
default: u(() => [
|
|
161
|
-
a(i, null, {
|
|
162
|
-
default: u(() => [
|
|
163
|
-
t("div", De, [
|
|
164
|
-
t("div", null, [
|
|
165
|
-
a(x, { class: "flex items-center gap-2" }, {
|
|
166
|
-
default: u(() => [
|
|
167
|
-
s[3] || (s[3] = k(" Orders received ", -1)),
|
|
168
|
-
o(b).bookings > 0 ? (d(), A(p, {
|
|
169
|
-
key: 0,
|
|
170
|
-
variant: "secondary"
|
|
171
|
-
}, {
|
|
172
|
-
default: u(() => [
|
|
173
|
-
k(r(o(b).bookings), 1)
|
|
174
|
-
]),
|
|
175
|
-
_: 1
|
|
176
|
-
})) : C("", !0)
|
|
177
|
-
]),
|
|
178
|
-
_: 1
|
|
179
|
-
}),
|
|
180
|
-
a(I, { class: "flex items-center gap-4 mt-1" }, {
|
|
181
|
-
default: u(() => [
|
|
182
|
-
t("span", we, [
|
|
183
|
-
a(o(U), { size: 14 }),
|
|
184
|
-
k(" " + r(o(b).spots) + " spots ", 1)
|
|
185
|
-
]),
|
|
186
|
-
t("span", ke, " €" + r(o(b).revenue.toFixed(2)) + " revenue ", 1)
|
|
187
|
-
]),
|
|
188
|
-
_: 1
|
|
189
|
-
})
|
|
190
|
-
]),
|
|
191
|
-
t("div", Ce, [
|
|
192
|
-
t("div", be, [
|
|
193
|
-
a(v, {
|
|
194
|
-
variant: "ghost",
|
|
195
|
-
size: "icon",
|
|
196
|
-
class: "size-8",
|
|
197
|
-
onClick: H
|
|
198
|
-
}, {
|
|
199
|
-
default: u(() => [
|
|
200
|
-
a(o(ie), { size: 16 })
|
|
201
|
-
]),
|
|
202
|
-
_: 1
|
|
203
|
-
}),
|
|
204
|
-
a(v, {
|
|
205
|
-
variant: "ghost",
|
|
206
|
-
size: "sm",
|
|
207
|
-
class: "h-8 px-3 text-xs",
|
|
208
|
-
onClick: Q
|
|
209
|
-
}, {
|
|
210
|
-
default: u(() => [...s[4] || (s[4] = [
|
|
211
|
-
k(" Today ", -1)
|
|
212
|
-
])]),
|
|
213
|
-
_: 1
|
|
214
|
-
}),
|
|
215
|
-
a(v, {
|
|
216
|
-
variant: "ghost",
|
|
217
|
-
size: "icon",
|
|
218
|
-
class: "size-8",
|
|
219
|
-
onClick: M,
|
|
220
|
-
disabled: !o(Y)
|
|
221
|
-
}, {
|
|
222
|
-
default: u(() => [
|
|
223
|
-
a(o(ce), { size: 16 })
|
|
224
|
-
]),
|
|
225
|
-
_: 1
|
|
226
|
-
}, 8, ["disabled"])
|
|
227
|
-
]),
|
|
228
|
-
a(v, {
|
|
229
|
-
variant: "ghost",
|
|
230
|
-
size: "icon",
|
|
231
|
-
onClick: S,
|
|
232
|
-
disabled: o(D)
|
|
233
|
-
}, {
|
|
234
|
-
default: u(() => [
|
|
235
|
-
a(o(de), {
|
|
236
|
-
size: 16,
|
|
237
|
-
class: E({ "animate-spin": o(D) })
|
|
238
|
-
}, null, 8, ["class"])
|
|
239
|
-
]),
|
|
240
|
-
_: 1
|
|
241
|
-
}, 8, ["disabled"])
|
|
242
|
-
])
|
|
243
|
-
]),
|
|
244
|
-
t("div", Se, r(o(j)), 1)
|
|
245
|
-
]),
|
|
246
|
-
_: 1
|
|
247
|
-
}),
|
|
248
|
-
a(c, null, {
|
|
249
|
-
default: u(() => [
|
|
250
|
-
t("div", Ie, [
|
|
251
|
-
a(o(ue), {
|
|
252
|
-
size: 16,
|
|
253
|
-
class: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"
|
|
254
|
-
}),
|
|
255
|
-
a(z, {
|
|
256
|
-
modelValue: o(f),
|
|
257
|
-
"onUpdate:modelValue": s[0] || (s[0] = (n) => te(f) ? f.value = n : null),
|
|
258
|
-
placeholder: "Search by name, email, phone, or resource...",
|
|
259
|
-
class: "pl-9 pr-9"
|
|
260
|
-
}, null, 8, ["modelValue"]),
|
|
261
|
-
o(f) ? (d(), A(v, {
|
|
262
|
-
key: 0,
|
|
263
|
-
variant: "ghost",
|
|
264
|
-
size: "icon",
|
|
265
|
-
class: "absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7",
|
|
266
|
-
onClick: G
|
|
267
|
-
}, {
|
|
268
|
-
default: u(() => [
|
|
269
|
-
a(o(me), { size: 14 })
|
|
270
|
-
]),
|
|
271
|
-
_: 1
|
|
272
|
-
})) : C("", !0)
|
|
273
|
-
]),
|
|
274
|
-
o(f) ? (d(), g("div", ze, " Showing " + r(o(P).length) + " of " + r(o(m).length) + " orders ", 1)) : C("", !0),
|
|
275
|
-
o(D) ? (d(), g("div", Ne, [...s[5] || (s[5] = [
|
|
276
|
-
t("div", { class: "animate-spin rounded-full h-8 w-8 border-b-2 border-primary" }, null, -1)
|
|
277
|
-
])])) : o(m).length === 0 ? (d(), g("div", Oe, [
|
|
278
|
-
a(o(L), { class: "size-12 mx-auto mb-3 opacity-50" }),
|
|
279
|
-
s[6] || (s[6] = t("p", null, "No orders received on this day", -1))
|
|
280
|
-
])) : o(P).length === 0 ? (d(), g("div", Te, " No orders match your search ")) : (d(), g("div", Pe, [
|
|
281
|
-
(d(!0), g(se, null, oe(o(P), (n) => (d(), g("div", {
|
|
282
|
-
key: n.res_id || n.id,
|
|
283
|
-
class: "p-3 border rounded-lg hover:bg-muted/50 transition-colors cursor-pointer",
|
|
284
|
-
onClick: (qe) => o(R)?.openDialog(n)
|
|
285
|
-
}, [
|
|
286
|
-
t("div", Be, [
|
|
287
|
-
t("div", Fe, [
|
|
288
|
-
t("div", Re, r(n.customerInfo?.firstName) + " " + r(n.customerInfo?.lastName || "Unknown Customer"), 1),
|
|
289
|
-
t("div", Ve, r(n.customerInfo?.email), 1),
|
|
290
|
-
t("div", Ee, r(n.customerInfo?.phone), 1),
|
|
291
|
-
t("div", Le, [
|
|
292
|
-
t("div", Ue, [
|
|
293
|
-
a(o(ge), { size: 12 }),
|
|
294
|
-
t("span", null, r(q(n.date)) + " · " + r(n.startTime) + " - " + r(n.endTime), 1)
|
|
295
|
-
]),
|
|
296
|
-
t("div", $e, [
|
|
297
|
-
a(o(U), { size: 12 }),
|
|
298
|
-
t("span", null, r(n.spots) + " spots", 1)
|
|
299
|
-
]),
|
|
300
|
-
n.resourceName ? (d(), g("div", je, [
|
|
301
|
-
t("div", {
|
|
302
|
-
class: "w-3 h-3 rounded-full",
|
|
303
|
-
style: ne({ backgroundColor: n.resourceColor || "#6b7280" })
|
|
304
|
-
}, null, 4),
|
|
305
|
-
t("span", null, r(n.resourceName), 1)
|
|
306
|
-
])) : C("", !0)
|
|
307
|
-
]),
|
|
308
|
-
t("div", He, [
|
|
309
|
-
a(o(fe), { size: 12 }),
|
|
310
|
-
t("span", null, "Ordered at " + r(X(n.createdAt)), 1)
|
|
311
|
-
])
|
|
312
|
-
]),
|
|
313
|
-
t("div", Me, [
|
|
314
|
-
t("div", {
|
|
315
|
-
class: E(["inline-block px-2 py-1 text-xs rounded-full", {
|
|
316
|
-
"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400": n.status === "completed" || n.status === "confirmed",
|
|
317
|
-
"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400": n.status === "pending",
|
|
318
|
-
"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400": n.status === "cancelled"
|
|
319
|
-
}])
|
|
320
|
-
}, r(n.status || "pending"), 3),
|
|
321
|
-
n.reservationPrice || n.reservationPrice === 0 ? (d(), g("div", Ye, " €" + r(n.reservationPrice.toFixed(2)), 1)) : C("", !0)
|
|
322
|
-
])
|
|
323
|
-
])
|
|
324
|
-
], 8, Ae))), 128))
|
|
325
|
-
]))
|
|
326
|
-
]),
|
|
327
|
-
_: 1
|
|
328
|
-
}),
|
|
329
|
-
a(ve, {
|
|
330
|
-
ref_key: "reservationDetailDialog",
|
|
331
|
-
ref: R,
|
|
332
|
-
onCancelled: K
|
|
333
|
-
}, null, 512)
|
|
334
|
-
]),
|
|
335
|
-
_: 1
|
|
336
|
-
})
|
|
337
|
-
])
|
|
338
|
-
]),
|
|
339
|
-
_: 1
|
|
340
|
-
});
|
|
341
|
-
};
|
|
342
|
-
}
|
|
343
|
-
});
|
|
344
|
-
export {
|
|
345
|
-
et as default
|
|
346
|
-
};
|
package/dist/orders-Dt0zMz97.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),V=require("@oneclick.dev/cms-kit"),l=require("lucide-vue-next"),E=require("./ReservationDetailDialog.vue_vue_type_script_setup_true_lang-CI8YgHdU.js"),U=require("./EditLayout.vue_vue_type_script_setup_true_lang-Czu6Dcde.js"),j={class:"space-y-6"},q={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4"},H={class:"text-2xl font-semibold tracking-tight flex items-center gap-2"},M={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4"},$={class:"flex items-center gap-1"},Y={class:"flex items-center gap-1"},K={class:"flex items-center gap-2"},Q={class:"flex items-center gap-1"},X={class:"text-sm text-muted-foreground mt-2"},G={class:"relative mb-4"},J={key:0,class:"mb-3 text-sm text-muted-foreground"},W={key:1,class:"flex items-center justify-center py-8"},Z={key:2,class:"text-center py-8 text-muted-foreground"},ee={key:3,class:"text-center py-8 text-muted-foreground"},te={key:4,class:"space-y-2"},oe=["onClick"],ne={class:"flex items-start justify-between"},se={class:"flex-1"},ae={class:"font-medium"},re={class:"text-sm text-muted-foreground"},le={class:"text-sm text-muted-foreground"},ce={class:"flex items-center gap-4 flex-wrap mt-1"},ie={class:"flex items-center gap-2 text-xs text-muted-foreground"},de={class:"flex items-center gap-2 text-xs text-muted-foreground"},ue={key:0,class:"flex items-center gap-1 text-xs text-muted-foreground"},me={class:"flex items-center gap-2 mt-1 text-xs text-muted-foreground"},pe={class:"text-right"},fe={key:0,class:"text-sm font-medium mt-1"},ge=e.defineComponent({__name:"orders",setup(ve){const{params:k}=V.useModuleRoute(),{config:y}=V.useModule(),C=V.useFirebaseIntegration(y.project),c=e.ref([]),N=e.ref([]),f=e.ref(!0),i=e.ref(""),w=e.ref(null),m=new Date,s=e.ref(new Date),b=e.computed(()=>({date:S(s.value),resource:null}));e.provide("event",b);const B=e.computed(()=>{const t=new Date(m);t.setDate(m.getDate()-1);const o=new Date(m);return o.setDate(m.getDate()+1),s.value.toDateString()===m.toDateString()?"Today":s.value.toDateString()===t.toDateString()?"Yesterday":s.value.toDateString()===o.toDateString()?"Tomorrow":s.value.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})}),I=()=>{const t=new Date(s.value);t.setDate(t.getDate()-1),s.value=t},z=()=>{const t=new Date(s.value);t.setDate(t.getDate()+1),t<=m&&(s.value=t)},T=e.computed(()=>{const t=new Date(s.value);return t.setDate(t.getDate()+1),t<=m}),O=()=>{s.value=new Date},S=t=>{const o=t.getFullYear(),d=String(t.getMonth()+1).padStart(2,"0"),p=String(t.getDate()).padStart(2,"0");return`${o}-${d}-${p}`},P=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"}):"",D=e.computed(()=>i.value.trim()?new E.Fuse(c.value,{keys:["customerInfo.firstName","customerInfo.lastName","customerInfo.email","customerInfo.phone","resourceName"],threshold:.3,ignoreLocation:!0}).search(i.value).map(o=>o.item):c.value),g=e.computed(()=>({spots:c.value.reduce((t,o)=>t+(o.spots||0),0),bookings:c.value.length,revenue:c.value.reduce((t,o)=>t+(o.reservationPrice||0),0)})),A=()=>{i.value=""},F=async()=>{try{const t=k.value.id,o=await C.get(y.agendaCollection,t);N.value=o?.resources?.filter(d=>d.isActive)||[]}catch(t){console.error("Error loading resources:",t),N.value=[]}},v=async()=>{f.value=!0,c.value=[];try{const t=k.value.id,o=S(s.value),d=new Date(s.value);d.setHours(0,0,0,0);const p=new Date(s.value);p.setHours(23,59,59,999);const _=await C.find(y.reservationsCollection,{filters:[{field:"agendaId",operator:"==",value:t},{field:"createdAt",operator:">=",value:d.toISOString()},{field:"createdAt",operator:"<=",value:p.toISOString()}]});console.log("allOrders",_);let u=[];_.forEach(a=>{(a.reservations||[]).forEach(r=>{const h=N.value.find(n=>n.id===r.resourceId);u.push({customerInfo:a.customerInfo,amountDue:a.amountDue,amountPaid:a.amountPaid,status:a.status,subtotal:a.subtotal,total:a.total,discount:a.discount,id:a.id,res_id:r.id,resourceId:r.resourceId,spots:r.spots,date:r.date,createdAt:a.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:h?.name||"Unknown",resourceColor:h?.color})})}),c.value=u.sort((a,x)=>(x.createdAt||"").localeCompare(a.createdAt||""))}catch(t){console.error("Error loading orders:",t),c.value=[]}finally{f.value=!1}},L=()=>{v()};return(async()=>(await F(),await v()))(),e.watch(s,()=>{v()}),(t,o)=>{const d=e.resolveComponent("Badge"),p=e.resolveComponent("CardTitle"),_=e.resolveComponent("CardDescription"),u=e.resolveComponent("Button"),a=e.resolveComponent("CardHeader"),x=e.resolveComponent("Input"),r=e.resolveComponent("CardContent"),h=e.resolveComponent("Card");return e.openBlock(),e.createBlock(U._sfc_main,null,{default:e.withCtx(()=>[e.createElementVNode("div",j,[e.createElementVNode("div",q,[e.createElementVNode("div",null,[e.createElementVNode("h1",H,[e.createVNode(e.unref(l.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(h,null,{default:e.withCtx(()=>[e.createVNode(a,null,{default:e.withCtx(()=>[e.createElementVNode("div",M,[e.createElementVNode("div",null,[e.createVNode(p,{class:"flex items-center gap-2"},{default:e.withCtx(()=>[o[3]||(o[3]=e.createTextVNode(" Orders received ",-1)),e.unref(g).bookings>0?(e.openBlock(),e.createBlock(d,{key:0,variant:"secondary"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(g).bookings),1)]),_:1})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(_,{class:"flex items-center gap-4 mt-1"},{default:e.withCtx(()=>[e.createElementVNode("span",$,[e.createVNode(e.unref(l.Users),{size:14}),e.createTextVNode(" "+e.toDisplayString(e.unref(g).spots)+" spots ",1)]),e.createElementVNode("span",Y," €"+e.toDisplayString(e.unref(g).revenue.toFixed(2))+" revenue ",1)]),_:1})]),e.createElementVNode("div",K,[e.createElementVNode("div",Q,[e.createVNode(u,{variant:"ghost",size:"icon",class:"size-8",onClick:I},{default:e.withCtx(()=>[e.createVNode(e.unref(l.ChevronLeft),{size:16})]),_:1}),e.createVNode(u,{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(u,{variant:"ghost",size:"icon",class:"size-8",onClick:z,disabled:!e.unref(T)},{default:e.withCtx(()=>[e.createVNode(e.unref(l.ChevronRight),{size:16})]),_:1},8,["disabled"])]),e.createVNode(u,{variant:"ghost",size:"icon",onClick:v,disabled:e.unref(f)},{default:e.withCtx(()=>[e.createVNode(e.unref(l.RefreshCw),{size:16,class:e.normalizeClass({"animate-spin":e.unref(f)})},null,8,["class"])]),_:1},8,["disabled"])])]),e.createElementVNode("div",X,e.toDisplayString(e.unref(B)),1)]),_:1}),e.createVNode(r,null,{default:e.withCtx(()=>[e.createElementVNode("div",G,[e.createVNode(e.unref(l.Search),{size:16,class:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),e.createVNode(x,{modelValue:e.unref(i),"onUpdate:modelValue":o[0]||(o[0]=n=>e.isRef(i)?i.value=n:null),placeholder:"Search by name, email, phone, or resource...",class:"pl-9 pr-9"},null,8,["modelValue"]),e.unref(i)?(e.openBlock(),e.createBlock(u,{key:0,variant:"ghost",size:"icon",class:"absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7",onClick:A},{default:e.withCtx(()=>[e.createVNode(e.unref(l.X),{size:14})]),_:1})):e.createCommentVNode("",!0)]),e.unref(i)?(e.openBlock(),e.createElementBlock("div",J," Showing "+e.toDisplayString(e.unref(D).length)+" of "+e.toDisplayString(e.unref(c).length)+" orders ",1)):e.createCommentVNode("",!0),e.unref(f)?(e.openBlock(),e.createElementBlock("div",W,[...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(c).length===0?(e.openBlock(),e.createElementBlock("div",Z,[e.createVNode(e.unref(l.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(D).length===0?(e.openBlock(),e.createElementBlock("div",ee," No orders match your search ")):(e.openBlock(),e.createElementBlock("div",te,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(D),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:xe=>e.unref(w)?.openDialog(n)},[e.createElementVNode("div",ne,[e.createElementVNode("div",se,[e.createElementVNode("div",ae,e.toDisplayString(n.customerInfo?.firstName)+" "+e.toDisplayString(n.customerInfo?.lastName||"Unknown Customer"),1),e.createElementVNode("div",re,e.toDisplayString(n.customerInfo?.email),1),e.createElementVNode("div",le,e.toDisplayString(n.customerInfo?.phone),1),e.createElementVNode("div",ce,[e.createElementVNode("div",ie,[e.createVNode(e.unref(l.Calendar),{size:12}),e.createElementVNode("span",null,e.toDisplayString(R(n.date))+" · "+e.toDisplayString(n.startTime)+" - "+e.toDisplayString(n.endTime),1)]),e.createElementVNode("div",de,[e.createVNode(e.unref(l.Users),{size:12}),e.createElementVNode("span",null,e.toDisplayString(n.spots)+" spots",1)]),n.resourceName?(e.openBlock(),e.createElementBlock("div",ue,[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",me,[e.createVNode(e.unref(l.Clock),{size:12}),e.createElementVNode("span",null,"Ordered at "+e.toDisplayString(P(n.createdAt)),1)])]),e.createElementVNode("div",pe,[e.createElementVNode("div",{class:e.normalizeClass(["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":n.status==="completed"||n.status==="confirmed","bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400":n.status==="pending","bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400":n.status==="cancelled"}])},e.toDisplayString(n.status||"pending"),3),n.reservationPrice||n.reservationPrice===0?(e.openBlock(),e.createElementBlock("div",fe," €"+e.toDisplayString(n.reservationPrice.toFixed(2)),1)):e.createCommentVNode("",!0)])])],8,oe))),128))]))]),_:1}),e.createVNode(E._sfc_main,{ref_key:"reservationDetailDialog",ref:w,onCancelled:L},null,512)]),_:1})])]),_:1})}}});exports.default=ge;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
declare const _default: import('vue').DefineComponent<{}, {
|
|
2
|
-
openDialog: (input: any) => void;
|
|
3
|
-
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
4
|
-
export default _default;
|