@oneclick.dev/cms-core-modules 0.0.61 → 0.0.63

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