@oneclick.dev/cms-core-modules 0.0.82 → 0.0.84

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 (68) hide show
  1. package/dist/{ContentEditor-Dk-iDEjl.mjs → ContentEditor-DPhhOkx3.mjs} +7085 -5936
  2. package/dist/{ContentEditor-4e80zFyn.js → ContentEditor-DrxtH_Hq.js} +42 -42
  3. package/dist/{Create-DtFzwxn_.mjs → Create-6uT9HWar.mjs} +35 -35
  4. package/dist/{Create-CRn2sMHp.js → Create-DuZ5nZrX.js} +1 -1
  5. package/dist/{DateFormatter-DfIwyrnF.mjs → DateFormatter-2B0R-DY4.mjs} +213 -406
  6. package/dist/DateFormatter-DbtOLV0L.js +1 -0
  7. package/dist/{Detail-Bxi7lG9x.js → Detail-BZ-iE9vf.js} +1 -1
  8. package/dist/{Detail-B4b_FLDa.mjs → Detail-C1Blq61w.mjs} +90 -90
  9. package/dist/{Detail-BayNaAg9.js → Detail-C8wQiDcv.js} +1 -1
  10. package/dist/{Detail-BwDnY42G.mjs → Detail-CJVMJDP7.mjs} +17 -17
  11. package/dist/{Detail-CnK-qbhE.js → Detail-CPqug27l.js} +1 -1
  12. package/dist/Detail-CjuhjPby.js +1 -0
  13. package/dist/{Detail-U0mgLKt6.mjs → Detail-CtItxMX4.mjs} +62 -63
  14. package/dist/{Detail-CVgWHbMC.mjs → Detail-Dnpnmy4-.mjs} +158 -158
  15. package/dist/{Entries-D7MHylQE.mjs → Entries-BkOPae4R.mjs} +49 -49
  16. package/dist/Entries-CcEW98F5.js +1 -0
  17. package/dist/{NewReservationDialog.vue_vue_type_script_setup_true_lang-Ds7z0qeH.mjs → NewReservationDialog.vue_vue_type_script_setup_true_lang-Bc946oSc.mjs} +1 -1
  18. package/dist/{NewReservationDialog.vue_vue_type_script_setup_true_lang-C5YczjNb.js → NewReservationDialog.vue_vue_type_script_setup_true_lang-CqERfyYb.js} +1 -1
  19. package/dist/{Overview-CwCAeBnX.js → Overview-CA8wh_BI.js} +1 -1
  20. package/dist/{Overview-CgViRnNc.mjs → Overview-D4MFwRI_.mjs} +67 -68
  21. package/dist/{Overview-pCO_47Zt.js → Overview-Da0XexiT.js} +1 -1
  22. package/dist/Overview-DeQQ0FY3.js +1 -0
  23. package/dist/{Overview--XpvBbqz.mjs → Overview-DoOASlNz.mjs} +1 -3
  24. package/dist/{Overview-CuCQgqVp.mjs → Overview-gJSvftdE.mjs} +34 -34
  25. package/dist/{ReservationDetailDialog.vue_vue_type_script_setup_true_lang-B7ks5mbf.mjs → ReservationDetailDialog.vue_vue_type_script_setup_true_lang-Cohhnd5x.mjs} +0 -1
  26. package/dist/{ReservationDetailDialog.vue_vue_type_script_setup_true_lang-Vxubki_v.js → ReservationDetailDialog.vue_vue_type_script_setup_true_lang-VWVIxIr6.js} +1 -1
  27. package/dist/{SeoHealth-CC0rW1AG.mjs → SeoHealth-Bc5chnaa.mjs} +14 -14
  28. package/dist/{SeoHealth-EZzDmPDM.js → SeoHealth-BkpJ1F2Y.js} +1 -1
  29. package/dist/TableView-BPWAx--G.mjs +5743 -0
  30. package/dist/TableView-D63QrVlK.js +4 -0
  31. package/dist/View-BL70u98U.js +1 -0
  32. package/dist/{View-DDXN0tKD.mjs → View-BO5N911y.mjs} +5 -5
  33. package/dist/{agenda-XqvbrU72.mjs → agenda-C5grvzSa.mjs} +166 -169
  34. package/dist/agenda-DXMwVWpN.js +1 -0
  35. package/dist/{availability-B-tRp8hB.mjs → availability-C1NqOFsQ.mjs} +81 -81
  36. package/dist/{availability-BiBbzEIM.js → availability-D_wnfLsH.js} +1 -1
  37. package/dist/cms-core-modules.css +1 -1
  38. package/dist/{exceptions-CLgeeUSy.mjs → exceptions-BIwMhYa4.mjs} +1 -1
  39. package/dist/{exceptions-wEQEVzIs.js → exceptions-Cn7zooEu.js} +1 -1
  40. package/dist/{index-DTzdHh6g.js → index-C9pSS15N.js} +2 -2
  41. package/dist/{index-N0NoDEsI.mjs → index-MwjeLHPP.mjs} +3 -3
  42. package/dist/index.cjs.js +1 -1
  43. package/dist/index.mjs +50 -36
  44. package/dist/orders-CG1QUCN8.js +1 -0
  45. package/dist/orders-CeixEBcU.mjs +396 -0
  46. package/dist/server-handlers.cjs.js +1 -1
  47. package/dist/server-handlers.mjs +292 -256
  48. package/dist/src/contentManager/config.d.ts +28 -0
  49. package/dist/src/contentManager/index.d.ts +28 -0
  50. package/dist/src/contentManager/server.d.ts +7 -0
  51. package/dist/src/server-handlers.d.ts +1 -0
  52. package/package.json +2 -2
  53. package/dist/DateFormatter-C9qfmQnP.js +0 -1
  54. package/dist/Detail-BcboL7NF.js +0 -1
  55. package/dist/Entries-BPkZ7Jg5.js +0 -1
  56. package/dist/Overview-B-8TLLjh.js +0 -1
  57. package/dist/TableView-Ce8H65pL.js +0 -586
  58. package/dist/TableView-DRQvOW85.mjs +0 -89190
  59. package/dist/View-DfzaVOzS.js +0 -1
  60. package/dist/agenda-wNFDKn0G.js +0 -1
  61. package/dist/floating-ui.dom-BO2Hr6mz.mjs +0 -1292
  62. package/dist/floating-ui.dom-CAr9LGoC.js +0 -1
  63. package/dist/index-DYpruS-A-CA2jEOA3.js +0 -88
  64. package/dist/index-DYpruS-A-D38FBcI3.mjs +0 -4211
  65. package/dist/index-YMaY4uuk-BgpTtr73.js +0 -1
  66. package/dist/index-YMaY4uuk-C_xV5K9Z.mjs +0 -1300
  67. package/dist/orders-Bqa3Z3tH.mjs +0 -356
  68. package/dist/orders-D5GJOZXN.js +0 -1
@@ -1,356 +0,0 @@
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
- };
@@ -1 +0,0 @@
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;