@oneclick.dev/cms-core-modules 0.0.122 → 0.0.123

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 (72) hide show
  1. package/dist/{ContentEditor-CoJjsV-m.js → ContentEditor-C-Wm48ai.js} +63 -59
  2. package/dist/{ContentEditor-DIwqplfB.mjs → ContentEditor-MDGolnIP.mjs} +27596 -26138
  3. package/dist/{NewReservationDialog.vue_vue_type_script_setup_true_lang-bZidw6RT.mjs → NewReservationDialog.vue_vue_type_script_setup_true_lang-8I_Z9cD_.mjs} +530 -530
  4. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BVE_uURZ.js +1 -0
  5. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-BdFa-xNf.mjs +3566 -0
  6. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-DzPOadcU.js +925 -0
  7. package/dist/TableCalculationWidget-CkQPrVUd.js +59 -0
  8. package/dist/TableCalculationWidget-CrqcLGfU.mjs +254 -0
  9. package/dist/TableDataWidget-7qvC3Egd.js +1 -0
  10. package/dist/TableDataWidget-DMTSoGRO.mjs +121 -0
  11. package/dist/TableOverviewCard-AFq-puJs.js +1 -0
  12. package/dist/TableOverviewCard-Ci0d4o4w.mjs +391 -0
  13. package/dist/TableResultView.vue_vue_type_script_setup_true_lang-CBn-Oxl9.mjs +534 -0
  14. package/dist/TableResultView.vue_vue_type_script_setup_true_lang-C_Lv-SmJ.js +1 -0
  15. package/dist/TableRowActionCard-BhdnnPaq.mjs +266 -0
  16. package/dist/TableRowActionCard-IzB6tNN-.js +1 -0
  17. package/dist/TableView-BkwoKREo.js +4 -0
  18. package/dist/TableView-C4Zyp8d7.mjs +8228 -0
  19. package/dist/{agenda-BCKDYOeF.mjs → agenda-DWdbWUbb.mjs} +10 -9
  20. package/dist/agenda-r9Gl85GL.js +1 -0
  21. package/dist/dateRangePresets-B-l5b_wR.mjs +48 -0
  22. package/dist/dateRangePresets-CPWqst_x.js +1 -0
  23. package/dist/fuse-Deb-Iq39.mjs +1473 -0
  24. package/dist/fuse-_CGUd5Zq.js +1 -0
  25. package/dist/{index-DU3Ib10Z.mjs → index-B_qaX29C.mjs} +7 -6
  26. package/dist/{index-Bk3yLv_G.js → index-yHLT6gaZ.js} +3 -3
  27. package/dist/index.cjs.js +1 -1
  28. package/dist/index.mjs +419 -109
  29. package/dist/{orders-CElKNc1v.mjs → orders-BfTLIm7U.mjs} +10 -9
  30. package/dist/orders-DUa2PVoa.js +1 -0
  31. package/dist/reports-ChCsd1Gk.mjs +1107 -0
  32. package/dist/reports-DmJPm8uP.js +158 -0
  33. package/dist/row-item-C1dUyimV.mjs +204 -0
  34. package/dist/row-item-Cyo3m3MZ.js +1 -0
  35. package/dist/src/appointments/components/edit/EventDialog/BookingsList.vue.d.ts +9 -3
  36. package/dist/src/appointments/components/edit/EventDialog/OrderDetailDialog.vue.d.ts +2 -0
  37. package/dist/src/appointments/components/edit/EventDialog/ReservationDetailDialog.vue.d.ts +4 -2
  38. package/dist/src/appointments/components/edit/dashboard/BookingsList.vue.d.ts +9 -3
  39. package/dist/src/appointments/pages/edit/orders.vue.d.ts +9 -3
  40. package/dist/src/appointments/pages/edit/reports.vue.d.ts +229 -1
  41. package/dist/src/table/chat-components/TableCalculationWidget.vue.d.ts +15 -0
  42. package/dist/src/table/chat-components/TableDataWidget.vue.d.ts +15 -0
  43. package/dist/src/table/chat-components/TableOverviewCard.vue.d.ts +61 -0
  44. package/dist/src/table/chat-components/TableResultView.vue.d.ts +48 -0
  45. package/dist/src/table/chat-components/TableRowActionCard.vue.d.ts +15 -0
  46. package/dist/src/table/components/filters/DialogTableFilterOptionItem.vue.d.ts +16 -0
  47. package/dist/src/table/components/filters/NumberComparisonFilter.vue.d.ts +12 -0
  48. package/dist/src/table/components/filters/NumberComparisonFilterSettings.vue.d.ts +12 -0
  49. package/dist/src/table/components/filters/NumberRangeFilter.vue.d.ts +12 -0
  50. package/dist/src/table/components/filters/NumberRangeFilterSettings.vue.d.ts +12 -0
  51. package/dist/src/table/components/filters/filter-utils.d.ts +14 -0
  52. package/dist/src/table/composables/useTableAgentTools.d.ts +33 -0
  53. package/dist/src/table/index.d.ts +339 -0
  54. package/dist/src/table/tool-sandbox.d.ts +13 -0
  55. package/dist/src/table/tool-utils.d.ts +11 -0
  56. package/dist/src/table/tools.d.ts +333 -1
  57. package/dist/src/table/types.d.ts +79 -0
  58. package/dist/tool-sandbox-DdkMLkDK.mjs +182 -0
  59. package/dist/tool-sandbox-DoF1PsyS.js +115 -0
  60. package/dist/useTableAgentTools-D5mzGf3A.js +1 -0
  61. package/dist/useTableAgentTools-DcN3kYRL.mjs +131 -0
  62. package/package.json +17 -17
  63. package/src/table/tools.ts +304 -1
  64. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BdZbcubW.js +0 -1
  65. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-BYSeUW_V.js +0 -925
  66. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-DwAUYR8p.mjs +0 -5021
  67. package/dist/TableView-Ctnep-Qu.mjs +0 -6247
  68. package/dist/TableView-DJqyJL9L.js +0 -4
  69. package/dist/agenda-B54F8cEr.js +0 -1
  70. package/dist/orders-BMosTk6r.js +0 -1
  71. package/dist/reports-BQT_GZzU.js +0 -158
  72. package/dist/reports-DksZCTOw.mjs +0 -837
@@ -1,837 +0,0 @@
1
- import { defineComponent as _e, computed as k, ref as P, resolveComponent as y, openBlock as $, createBlock as se, withCtx as n, createElementVNode as o, createVNode as s, unref as r, createTextVNode as i, normalizeClass as ye, toDisplayString as c, isRef as ne, createElementBlock as A, createCommentVNode as Re, Fragment as I, renderList as Y } from "vue";
2
- import { useModuleRoute as he, useModule as we, useFirebaseIntegration as Ce } from "@oneclick.dev/cms-kit";
3
- import { BarChart3 as oe, Download as $e, RefreshCw as De, CalendarIcon as Se, BadgeEuro as ke, ShoppingBag as Ae, Users as re, Undo2 as Te, Receipt as Oe } from "lucide-vue-next";
4
- import { _ as ze } from "./EditLayout.vue_vue_type_script_setup_true_lang-4_t0PPqM.mjs";
5
- const je = { class: "space-y-6" }, Be = { class: "flex flex-col gap-4 @3xl:flex-row @3xl:items-start @3xl:justify-between" }, Me = { class: "text-2xl font-semibold tracking-tight flex items-center gap-2" }, Ne = { class: "flex flex-col gap-2 sm:flex-row sm:items-center" }, Ee = { class: "grid grid-cols-1 gap-3 @xl:grid-cols-3 md:items-end" }, Ue = { class: "grid gap-1.5" }, Fe = { class: "grid gap-1.5" }, Pe = {
6
- key: 0,
7
- class: "text-sm text-destructive"
8
- }, Ie = { class: "flex flex-wrap gap-2" }, Le = {
9
- key: 0,
10
- class: "flex items-center justify-center py-12"
11
- }, Ve = {
12
- key: 1,
13
- class: "text-center py-12 text-muted-foreground"
14
- }, Ye = { class: "grid grid-cols-1 gap-4 @3xl:grid-cols-2 @7xl:grid-cols-4" }, He = { class: "text-2xl font-semibold" }, Ge = { class: "text-xs text-muted-foreground mt-1" }, qe = { class: "text-2xl font-semibold" }, Qe = { class: "text-xs text-muted-foreground mt-1" }, Je = { class: "text-2xl font-semibold" }, Ke = { class: "text-xs text-muted-foreground mt-1" }, We = { class: "text-2xl font-semibold" }, Xe = { class: "text-xs text-muted-foreground mt-1" }, Ze = { class: "grid grid-cols-1 gap-4 @5xl:grid-cols-2" }, et = { class: "flex items-center justify-between gap-4" }, tt = { class: "font-medium" }, st = { class: "flex items-center justify-between gap-4" }, nt = { class: "font-medium text-destructive" }, ot = { class: "flex items-center justify-between gap-4" }, rt = { class: "font-semibold" }, at = { class: "flex items-center justify-between gap-4" }, lt = { class: "font-medium" }, dt = { class: "flex items-center justify-between gap-4" }, ut = { class: "font-medium" }, it = { class: "flex items-center justify-between gap-4" }, ct = { class: "font-medium" }, ft = { class: "flex items-center justify-between gap-4" }, mt = { class: "font-medium" }, pt = { class: "flex items-center justify-between gap-4" }, vt = { class: "font-medium" }, gt = { class: "flex items-center justify-between gap-4" }, xt = { class: "font-medium" }, bt = { class: "flex items-center gap-2 text-sm font-medium mb-3" }, _t = { class: "space-y-2 text-sm" }, yt = { class: "text-muted-foreground" }, Rt = { class: "font-medium" }, ht = { class: "flex items-center gap-2 text-sm font-medium mb-3" }, wt = { class: "space-y-2 text-sm" }, Ct = { class: "text-muted-foreground" }, $t = { class: "font-medium" }, Dt = { class: "overflow-x-auto" }, zt = /* @__PURE__ */ _e({
15
- __name: "reports",
16
- setup(St) {
17
- const { params: H } = he(), { config: G } = we(), ae = Ce(G.project), le = k(() => H.value?.id ?? H.id ?? ""), O = P(!1), C = P([]), S = (t) => {
18
- const e = t.getFullYear(), a = String(t.getMonth() + 1).padStart(2, "0"), d = String(t.getDate()).padStart(2, "0");
19
- return `${e}-${a}-${d}`;
20
- }, L = (t) => {
21
- const e = Math.floor(t.getMonth() / 3) * 3;
22
- return new Date(t.getFullYear(), e, 1);
23
- }, de = (t) => {
24
- const e = Math.floor(t.getMonth() / 3) * 3;
25
- return new Date(t.getFullYear(), e + 3, 0);
26
- }, q = /* @__PURE__ */ new Date(), R = P(S(L(q))), h = P(S(q)), j = k(() => !R.value || !h.value ? "Select a start and end date." : R.value > h.value ? "Start date must be before end date." : ""), ue = () => {
27
- const t = /* @__PURE__ */ new Date(`${R.value}T00:00:00`), e = /* @__PURE__ */ new Date(`${h.value}T23:59:59.999`);
28
- return { start: t, end: e };
29
- }, Q = k(() => {
30
- if (!R.value || !h.value) return "";
31
- const t = /* @__PURE__ */ new Date(`${R.value}T00:00:00`), e = /* @__PURE__ */ new Date(`${h.value}T00:00:00`);
32
- return `${t.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" })} - ${e.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" })}`;
33
- }), ie = () => {
34
- const t = /* @__PURE__ */ new Date();
35
- R.value = S(L(t)), h.value = S(t);
36
- }, ce = () => {
37
- const t = /* @__PURE__ */ new Date(), e = new Date(t.getFullYear(), Math.floor(t.getMonth() / 3) * 3 - 1, 1);
38
- R.value = S(L(e)), h.value = S(de(e));
39
- }, fe = () => {
40
- const t = /* @__PURE__ */ new Date();
41
- R.value = S(new Date(t.getFullYear(), 0, 1)), h.value = S(t);
42
- }, T = (t) => {
43
- const e = Number(t);
44
- return Number.isFinite(e) ? e : 0;
45
- }, V = (t) => {
46
- if (!t) return null;
47
- if (t instanceof Date) return t;
48
- if (typeof t == "string" || typeof t == "number") {
49
- const e = new Date(t);
50
- return Number.isNaN(e.getTime()) ? null : e;
51
- }
52
- return typeof t.toDate == "function" ? t.toDate() : null;
53
- }, z = (t) => typeof t.total == "number" ? t.total : (t.reservations || []).reduce((e, a) => e + T(a.totalPrice), 0), me = (t) => typeof t.amountPaid == "number" ? t.amountPaid : z(t), J = (t) => t.status === "confirmed", B = k(() => C.value.flatMap((t) => {
54
- const e = t.id, a = t.status || "unknown", d = z(t);
55
- return (t.reservations || []).map((g) => ({
56
- ...g,
57
- orderId: e,
58
- orderStatus: a,
59
- orderCreatedAt: t.createdAt,
60
- orderTotal: d,
61
- orderAmountPaid: t.amountPaid
62
- }));
63
- })), K = (t) => Array.isArray(t.refunds) ? t.refunds : [], W = (t) => {
64
- const e = K(t);
65
- return e.length > 0 ? e.reduce((a, d) => a + T(d.amount), 0) : T(t.refundedAmount);
66
- }, pe = (t) => {
67
- const e = K(t);
68
- return e.length > 0 ? e.length : !!(t.refundStatus || t.refundedAt || T(t.refundedAmount) > 0) ? 1 : 0;
69
- }, M = k(() => C.value.filter(J)), l = k(() => {
70
- const t = M.value.reduce((f, b) => f + z(b), 0), e = M.value.reduce((f, b) => f + me(b), 0), a = B.value.filter((f) => f.orderStatus === "confirmed").length, d = C.value.filter((f) => f.status === "pending").reduce((f, b) => f + z(b), 0), g = C.value.filter((f) => f.status === "cancelled").reduce((f, b) => f + z(b), 0), x = B.value.reduce((f, b) => f + W(b), 0), m = B.value.reduce((f, b) => f + pe(b), 0), D = B.value.reduce((f, b) => f + T(b.spots), 0), _ = M.value.reduce((f, b) => f + T(b.amountDue), 0);
71
- return {
72
- grossRevenue: t,
73
- moneyCollected: e,
74
- pendingRevenue: d,
75
- cancelledRevenue: g,
76
- netRevenue: t - x,
77
- refundAmount: x,
78
- refundCount: m,
79
- orders: C.value.length,
80
- confirmedOrders: M.value.length,
81
- reservations: B.value.length,
82
- spots: D,
83
- amountDue: _,
84
- averageOrder: M.value.length ? t / M.value.length : 0,
85
- averageReservation: a ? t / a : 0
86
- };
87
- }), X = k(() => {
88
- const t = /* @__PURE__ */ new Map();
89
- return C.value.forEach((e) => {
90
- const a = e.status || "unknown", d = t.get(a) || { status: a, count: 0, revenue: 0 };
91
- d.count += 1, d.revenue += z(e), t.set(a, d);
92
- }), Array.from(t.values()).sort((e, a) => a.count - e.count);
93
- }), Z = k(() => {
94
- const t = /* @__PURE__ */ new Map();
95
- return B.value.forEach((e) => {
96
- const a = e.status || "unknown", d = t.get(a) || { status: a, count: 0, spots: 0, revenue: 0 };
97
- d.count += 1, d.spots += T(e.spots), d.revenue += T(e.totalPrice), t.set(a, d);
98
- }), Array.from(t.values()).sort((e, a) => a.count - e.count);
99
- }), ee = k(() => {
100
- const t = /* @__PURE__ */ new Map();
101
- return C.value.forEach((e) => {
102
- const a = V(e.createdAt), d = a ? S(a) : "Unknown date", g = t.get(d) || {
103
- date: d,
104
- orders: 0,
105
- reservations: 0,
106
- grossRevenue: 0,
107
- refunds: 0,
108
- netRevenue: 0
109
- }, x = e.reservations || [], m = x.reduce((_, f) => _ + W(f), 0), D = J(e) ? z(e) : 0;
110
- g.orders += 1, g.reservations += x.length, g.grossRevenue += D, g.refunds += m, g.netRevenue = g.grossRevenue - g.refunds, t.set(d, g);
111
- }), Array.from(t.values()).sort((e, a) => a.date.localeCompare(e.date));
112
- }), u = (t) => new Intl.NumberFormat("nl-BE", {
113
- style: "currency",
114
- currency: "EUR"
115
- }).format(t), v = (t) => new Intl.NumberFormat("nl-BE").format(t), F = (t) => t.split("_").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" "), w = (t) => String(t ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;"), ve = () => {
116
- if (!C.value.length) return;
117
- const t = [
118
- ["Money made", u(l.value.netRevenue), `${u(l.value.grossRevenue)} gross - ${u(l.value.refundAmount)} refunds`],
119
- ["Orders", v(l.value.orders), `${v(l.value.confirmedOrders)} confirmed`],
120
- ["Reservations", v(l.value.reservations), `${v(l.value.spots)} spots booked`],
121
- ["Refunds", v(l.value.refundCount), `${u(l.value.refundAmount)} refunded`]
122
- ], e = [
123
- ["Gross revenue", u(l.value.grossRevenue)],
124
- ["Refunds", u(l.value.refundAmount)],
125
- ["Net revenue", u(l.value.netRevenue)],
126
- ["Money collected", u(l.value.moneyCollected)],
127
- ["Amount due", u(l.value.amountDue)],
128
- ["Pending order value", u(l.value.pendingRevenue)],
129
- ["Cancelled order value", u(l.value.cancelledRevenue)],
130
- ["Average confirmed order", u(l.value.averageOrder)],
131
- ["Average reservation", u(l.value.averageReservation)]
132
- ], a = (m) => m.map((D) => `<tr>${D.map((_) => `<td>${w(_)}</td>`).join("")}</tr>`).join(""), d = `<!DOCTYPE html>
133
- <html lang="en">
134
- <head>
135
- <meta charset="UTF-8">
136
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
137
- <title>Appointments Report ${w(R.value)} - ${w(h.value)}</title>
138
- <style>
139
- * { box-sizing: border-box; }
140
- body {
141
- margin: 0;
142
- padding: 40px;
143
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
144
- color: #111827;
145
- background: #f8fafc;
146
- }
147
- .report {
148
- max-width: 1040px;
149
- margin: 0 auto;
150
- background: #ffffff;
151
- border: 1px solid #e5e7eb;
152
- border-radius: 8px;
153
- padding: 32px;
154
- }
155
- h1, h2 { margin: 0; }
156
- h1 { font-size: 28px; letter-spacing: 0; }
157
- h2 { font-size: 16px; margin-bottom: 12px; }
158
- .muted { color: #6b7280; }
159
- .header {
160
- display: flex;
161
- justify-content: space-between;
162
- gap: 24px;
163
- border-bottom: 1px solid #e5e7eb;
164
- padding-bottom: 24px;
165
- margin-bottom: 24px;
166
- }
167
- .cards {
168
- display: grid;
169
- grid-template-columns: repeat(4, minmax(0, 1fr));
170
- gap: 12px;
171
- margin-bottom: 24px;
172
- }
173
- .card {
174
- border: 1px solid #e5e7eb;
175
- border-radius: 8px;
176
- padding: 16px;
177
- background: #ffffff;
178
- }
179
- .card-label { font-size: 12px; color: #6b7280; margin-bottom: 8px; }
180
- .card-value { font-size: 22px; font-weight: 700; }
181
- .card-note { font-size: 12px; color: #6b7280; margin-top: 6px; }
182
- .grid {
183
- display: grid;
184
- grid-template-columns: repeat(2, minmax(0, 1fr));
185
- gap: 24px;
186
- margin-bottom: 24px;
187
- }
188
- table {
189
- width: 100%;
190
- border-collapse: collapse;
191
- font-size: 13px;
192
- }
193
- th, td {
194
- border-bottom: 1px solid #e5e7eb;
195
- padding: 10px 8px;
196
- text-align: left;
197
- }
198
- th {
199
- color: #6b7280;
200
- font-weight: 600;
201
- background: #f9fafb;
202
- }
203
- td:last-child, th:last-child { text-align: right; }
204
- @media print {
205
- body { background: #ffffff; padding: 0; }
206
- .report { border: 0; }
207
- }
208
- </style>
209
- </head>
210
- <body>
211
- <main class="report">
212
- <section class="header">
213
- <div>
214
- <h1>Appointments Report</h1>
215
- <p class="muted">${w(Q.value)}</p>
216
- </div>
217
- <div class="muted">Generated ${w((/* @__PURE__ */ new Date()).toLocaleString("en-US"))}</div>
218
- </section>
219
-
220
- <section class="cards">
221
- ${t.map(([m, D, _]) => `
222
- <div class="card">
223
- <div class="card-label">${w(m)}</div>
224
- <div class="card-value">${w(D)}</div>
225
- <div class="card-note">${w(_)}</div>
226
- </div>
227
- `).join("")}
228
- </section>
229
-
230
- <section class="grid">
231
- <div>
232
- <h2>Finance</h2>
233
- <table><tbody>${a(e)}</tbody></table>
234
- </div>
235
- <div>
236
- <h2>Order Status</h2>
237
- <table>
238
- <tbody>
239
- ${a(X.value.map((m) => [
240
- F(m.status),
241
- `${v(m.count)} - ${u(m.revenue)}`
242
- ]))}
243
- </tbody>
244
- </table>
245
- </div>
246
- </section>
247
-
248
- <section class="grid">
249
- <div>
250
- <h2>Reservation Status</h2>
251
- <table>
252
- <tbody>
253
- ${a(Z.value.map((m) => [
254
- F(m.status),
255
- `${v(m.count)} - ${v(m.spots)} spots - ${u(m.revenue)}`
256
- ]))}
257
- </tbody>
258
- </table>
259
- </div>
260
- <div>
261
- <h2>Period Totals</h2>
262
- <table><tbody>${a([
263
- ["Start date", R.value],
264
- ["End date", h.value],
265
- ["Orders", v(l.value.orders)],
266
- ["Reservations", v(l.value.reservations)]
267
- ])}</tbody></table>
268
- </div>
269
- </section>
270
-
271
- <section>
272
- <h2>Daily Breakdown</h2>
273
- <table>
274
- <thead>
275
- <tr>
276
- <th>Date</th>
277
- <th>Orders</th>
278
- <th>Reservations</th>
279
- <th>Gross</th>
280
- <th>Refunds</th>
281
- <th>Net</th>
282
- </tr>
283
- </thead>
284
- <tbody>
285
- ${ee.value.map((m) => `
286
- <tr>
287
- <td>${w(m.date)}</td>
288
- <td>${w(v(m.orders))}</td>
289
- <td>${w(v(m.reservations))}</td>
290
- <td>${w(u(m.grossRevenue))}</td>
291
- <td>${w(u(m.refunds))}</td>
292
- <td>${w(u(m.netRevenue))}</td>
293
- </tr>
294
- `).join("")}
295
- </tbody>
296
- </table>
297
- </section>
298
- </main>
299
- </body>
300
- </html>`, g = new Blob([d], { type: "text/html;charset=utf-8" }), x = document.createElement("a");
301
- x.href = URL.createObjectURL(g), x.setAttribute("download", `appointments-report-${R.value}-to-${h.value}.html`), document.body.appendChild(x), x.click(), URL.revokeObjectURL(x.href), x.remove();
302
- }, N = async () => {
303
- if (!j.value) {
304
- O.value = !0, C.value = [];
305
- try {
306
- const { start: t, end: e } = ue(), a = await ae.find(G.reservationsCollection, {
307
- filters: [
308
- { field: "agendaId", operator: "==", value: le.value },
309
- { field: "createdAt", operator: ">=", value: t.toISOString() },
310
- { field: "createdAt", operator: "<=", value: e.toISOString() }
311
- ]
312
- });
313
- C.value = a.map((d) => ({
314
- ...d,
315
- id: d.id || d.orderId || ""
316
- })).sort((d, g) => (V(g.createdAt)?.getTime() || 0) - (V(d.createdAt)?.getTime() || 0));
317
- } catch (t) {
318
- console.error("Error loading report:", t), C.value = [];
319
- } finally {
320
- O.value = !1;
321
- }
322
- }
323
- };
324
- return N(), (t, e) => {
325
- const a = y("Button"), d = y("CardTitle"), g = y("CardDescription"), x = y("CardHeader"), m = y("Label"), D = y("Input"), _ = y("CardContent"), f = y("Card"), b = y("Separator"), E = y("TableHead"), te = y("TableRow"), ge = y("TableHeader"), U = y("TableCell"), xe = y("TableBody"), be = y("Table");
326
- return $(), se(ze, null, {
327
- default: n(() => [
328
- o("div", je, [
329
- o("div", Be, [
330
- o("div", null, [
331
- o("h1", Me, [
332
- s(r(oe), { class: "size-6" }),
333
- e[5] || (e[5] = i(" Reports ", -1))
334
- ]),
335
- e[6] || (e[6] = o("p", { class: "text-muted-foreground text-sm mt-1" }, " Financial statistics for orders placed in a selected period. ", -1))
336
- ]),
337
- o("div", Ne, [
338
- s(a, {
339
- variant: "outline",
340
- onClick: ve,
341
- disabled: r(O) || !!r(j) || r(C).length === 0
342
- }, {
343
- default: n(() => [
344
- s(r($e), { class: "size-4" }),
345
- e[7] || (e[7] = i(" Download Report ", -1))
346
- ]),
347
- _: 1
348
- }, 8, ["disabled"]),
349
- s(a, {
350
- variant: "outline",
351
- onClick: N,
352
- disabled: r(O) || !!r(j)
353
- }, {
354
- default: n(() => [
355
- s(r(De), {
356
- class: ye(["size-4", { "animate-spin": r(O) }])
357
- }, null, 8, ["class"]),
358
- e[8] || (e[8] = i(" Refresh ", -1))
359
- ]),
360
- _: 1
361
- }, 8, ["disabled"])
362
- ])
363
- ]),
364
- s(f, { class: "-mx-6 rounded-none border-x-0 @5xl:mx-0 @5xl:rounded-xl @5xl:border-x-[1px]" }, {
365
- default: n(() => [
366
- s(x, null, {
367
- default: n(() => [
368
- s(d, { class: "flex items-center gap-2" }, {
369
- default: n(() => [
370
- s(r(Se), { class: "size-5" }),
371
- e[9] || (e[9] = i(" Period ", -1))
372
- ]),
373
- _: 1
374
- }),
375
- s(g, null, {
376
- default: n(() => [
377
- i(c(r(Q)), 1)
378
- ]),
379
- _: 1
380
- })
381
- ]),
382
- _: 1
383
- }),
384
- s(_, { class: "space-y-4" }, {
385
- default: n(() => [
386
- o("div", Ee, [
387
- o("div", Ue, [
388
- s(m, { for: "report-start-date" }, {
389
- default: n(() => [...e[10] || (e[10] = [
390
- i("Start date", -1)
391
- ])]),
392
- _: 1
393
- }),
394
- s(D, {
395
- id: "report-start-date",
396
- modelValue: r(R),
397
- "onUpdate:modelValue": e[0] || (e[0] = (p) => ne(R) ? R.value = p : null),
398
- type: "date"
399
- }, null, 8, ["modelValue"])
400
- ]),
401
- o("div", Fe, [
402
- s(m, { for: "report-end-date" }, {
403
- default: n(() => [...e[11] || (e[11] = [
404
- i("End date", -1)
405
- ])]),
406
- _: 1
407
- }),
408
- s(D, {
409
- id: "report-end-date",
410
- modelValue: r(h),
411
- "onUpdate:modelValue": e[1] || (e[1] = (p) => ne(h) ? h.value = p : null),
412
- type: "date"
413
- }, null, 8, ["modelValue"])
414
- ]),
415
- s(a, {
416
- class: "md:whitespace-nowrap",
417
- onClick: N,
418
- disabled: r(O) || !!r(j)
419
- }, {
420
- default: n(() => [...e[12] || (e[12] = [
421
- i(" Generate Report ", -1)
422
- ])]),
423
- _: 1
424
- }, 8, ["disabled"])
425
- ]),
426
- r(j) ? ($(), A("p", Pe, c(r(j)), 1)) : Re("", !0),
427
- o("div", Ie, [
428
- s(a, {
429
- variant: "outline",
430
- size: "sm",
431
- onClick: e[2] || (e[2] = (p) => {
432
- ie(), N();
433
- })
434
- }, {
435
- default: n(() => [...e[13] || (e[13] = [
436
- i(" This quarter ", -1)
437
- ])]),
438
- _: 1
439
- }),
440
- s(a, {
441
- variant: "outline",
442
- size: "sm",
443
- onClick: e[3] || (e[3] = (p) => {
444
- ce(), N();
445
- })
446
- }, {
447
- default: n(() => [...e[14] || (e[14] = [
448
- i(" Previous quarter ", -1)
449
- ])]),
450
- _: 1
451
- }),
452
- s(a, {
453
- variant: "outline",
454
- size: "sm",
455
- onClick: e[4] || (e[4] = (p) => {
456
- fe(), N();
457
- })
458
- }, {
459
- default: n(() => [...e[15] || (e[15] = [
460
- i(" Year to date ", -1)
461
- ])]),
462
- _: 1
463
- })
464
- ])
465
- ]),
466
- _: 1
467
- })
468
- ]),
469
- _: 1
470
- }),
471
- r(O) ? ($(), A("div", Le, [...e[16] || (e[16] = [
472
- o("div", { class: "animate-spin rounded-full h-8 w-8 border-b-2 border-primary" }, null, -1)
473
- ])])) : r(C).length === 0 ? ($(), A("div", Ve, [
474
- s(r(oe), { class: "size-12 mx-auto mb-3 opacity-50" }),
475
- e[17] || (e[17] = o("p", null, "No orders found for this period", -1))
476
- ])) : ($(), A(I, { key: 2 }, [
477
- o("div", Ye, [
478
- s(f, null, {
479
- default: n(() => [
480
- s(x, { class: "pb-2" }, {
481
- default: n(() => [
482
- s(d, { class: "text-sm font-medium text-muted-foreground flex items-center gap-2" }, {
483
- default: n(() => [
484
- s(r(ke), { class: "size-4" }),
485
- e[18] || (e[18] = i(" Money made ", -1))
486
- ]),
487
- _: 1
488
- })
489
- ]),
490
- _: 1
491
- }),
492
- s(_, null, {
493
- default: n(() => [
494
- o("div", He, c(u(r(l).netRevenue)), 1),
495
- o("p", Ge, c(u(r(l).grossRevenue)) + " gross - " + c(u(r(l).refundAmount)) + " refunds ", 1)
496
- ]),
497
- _: 1
498
- })
499
- ]),
500
- _: 1
501
- }),
502
- s(f, null, {
503
- default: n(() => [
504
- s(x, { class: "pb-2" }, {
505
- default: n(() => [
506
- s(d, { class: "text-sm font-medium text-muted-foreground flex items-center gap-2" }, {
507
- default: n(() => [
508
- s(r(Ae), { class: "size-4" }),
509
- e[19] || (e[19] = i(" Orders ", -1))
510
- ]),
511
- _: 1
512
- })
513
- ]),
514
- _: 1
515
- }),
516
- s(_, null, {
517
- default: n(() => [
518
- o("div", qe, c(v(r(l).orders)), 1),
519
- o("p", Qe, c(v(r(l).confirmedOrders)) + " confirmed ", 1)
520
- ]),
521
- _: 1
522
- })
523
- ]),
524
- _: 1
525
- }),
526
- s(f, null, {
527
- default: n(() => [
528
- s(x, { class: "pb-2" }, {
529
- default: n(() => [
530
- s(d, { class: "text-sm font-medium text-muted-foreground flex items-center gap-2" }, {
531
- default: n(() => [
532
- s(r(re), { class: "size-4" }),
533
- e[20] || (e[20] = i(" Reservations ", -1))
534
- ]),
535
- _: 1
536
- })
537
- ]),
538
- _: 1
539
- }),
540
- s(_, null, {
541
- default: n(() => [
542
- o("div", Je, c(v(r(l).reservations)), 1),
543
- o("p", Ke, c(v(r(l).spots)) + " spots booked ", 1)
544
- ]),
545
- _: 1
546
- })
547
- ]),
548
- _: 1
549
- }),
550
- s(f, null, {
551
- default: n(() => [
552
- s(x, { class: "pb-2" }, {
553
- default: n(() => [
554
- s(d, { class: "text-sm font-medium text-muted-foreground flex items-center gap-2" }, {
555
- default: n(() => [
556
- s(r(Te), { class: "size-4" }),
557
- e[21] || (e[21] = i(" Refunds ", -1))
558
- ]),
559
- _: 1
560
- })
561
- ]),
562
- _: 1
563
- }),
564
- s(_, null, {
565
- default: n(() => [
566
- o("div", We, c(v(r(l).refundCount)), 1),
567
- o("p", Xe, c(u(r(l).refundAmount)) + " refunded ", 1)
568
- ]),
569
- _: 1
570
- })
571
- ]),
572
- _: 1
573
- })
574
- ]),
575
- o("div", Ze, [
576
- s(f, null, {
577
- default: n(() => [
578
- s(x, null, {
579
- default: n(() => [
580
- s(d, null, {
581
- default: n(() => [...e[22] || (e[22] = [
582
- i("Finance", -1)
583
- ])]),
584
- _: 1
585
- }),
586
- s(g, null, {
587
- default: n(() => [...e[23] || (e[23] = [
588
- i("Confirmed orders are counted as revenue.", -1)
589
- ])]),
590
- _: 1
591
- })
592
- ]),
593
- _: 1
594
- }),
595
- s(_, { class: "space-y-3 text-sm" }, {
596
- default: n(() => [
597
- o("div", et, [
598
- e[24] || (e[24] = o("span", { class: "text-muted-foreground" }, "Gross revenue", -1)),
599
- o("span", tt, c(u(r(l).grossRevenue)), 1)
600
- ]),
601
- o("div", st, [
602
- e[25] || (e[25] = o("span", { class: "text-muted-foreground" }, "Refunds", -1)),
603
- o("span", nt, c(u(r(l).refundAmount)), 1)
604
- ]),
605
- s(b),
606
- o("div", ot, [
607
- e[26] || (e[26] = o("span", { class: "text-muted-foreground" }, "Net revenue", -1)),
608
- o("span", rt, c(u(r(l).netRevenue)), 1)
609
- ]),
610
- o("div", at, [
611
- e[27] || (e[27] = o("span", { class: "text-muted-foreground" }, "Money collected", -1)),
612
- o("span", lt, c(u(r(l).moneyCollected)), 1)
613
- ]),
614
- o("div", dt, [
615
- e[28] || (e[28] = o("span", { class: "text-muted-foreground" }, "Amount due", -1)),
616
- o("span", ut, c(u(r(l).amountDue)), 1)
617
- ]),
618
- o("div", it, [
619
- e[29] || (e[29] = o("span", { class: "text-muted-foreground" }, "Pending order value", -1)),
620
- o("span", ct, c(u(r(l).pendingRevenue)), 1)
621
- ]),
622
- o("div", ft, [
623
- e[30] || (e[30] = o("span", { class: "text-muted-foreground" }, "Cancelled order value", -1)),
624
- o("span", mt, c(u(r(l).cancelledRevenue)), 1)
625
- ]),
626
- o("div", pt, [
627
- e[31] || (e[31] = o("span", { class: "text-muted-foreground" }, "Average confirmed order", -1)),
628
- o("span", vt, c(u(r(l).averageOrder)), 1)
629
- ]),
630
- o("div", gt, [
631
- e[32] || (e[32] = o("span", { class: "text-muted-foreground" }, "Average reservation", -1)),
632
- o("span", xt, c(u(r(l).averageReservation)), 1)
633
- ])
634
- ]),
635
- _: 1
636
- })
637
- ]),
638
- _: 1
639
- }),
640
- s(f, null, {
641
- default: n(() => [
642
- s(x, null, {
643
- default: n(() => [
644
- s(d, null, {
645
- default: n(() => [...e[33] || (e[33] = [
646
- i("Status Breakdown", -1)
647
- ])]),
648
- _: 1
649
- }),
650
- s(g, null, {
651
- default: n(() => [...e[34] || (e[34] = [
652
- i("Orders and reservation lines in this period.", -1)
653
- ])]),
654
- _: 1
655
- })
656
- ]),
657
- _: 1
658
- }),
659
- s(_, { class: "space-y-5" }, {
660
- default: n(() => [
661
- o("div", null, [
662
- o("div", bt, [
663
- s(r(Oe), { class: "size-4" }),
664
- e[35] || (e[35] = i(" Orders ", -1))
665
- ]),
666
- o("div", _t, [
667
- ($(!0), A(I, null, Y(r(X), (p) => ($(), A("div", {
668
- key: p.status,
669
- class: "flex items-center justify-between gap-4"
670
- }, [
671
- o("span", yt, c(F(p.status)), 1),
672
- o("span", Rt, c(v(p.count)) + " · " + c(u(p.revenue)), 1)
673
- ]))), 128))
674
- ])
675
- ]),
676
- s(b),
677
- o("div", null, [
678
- o("div", ht, [
679
- s(r(re), { class: "size-4" }),
680
- e[36] || (e[36] = i(" Reservations ", -1))
681
- ]),
682
- o("div", wt, [
683
- ($(!0), A(I, null, Y(r(Z), (p) => ($(), A("div", {
684
- key: p.status,
685
- class: "flex items-center justify-between gap-4"
686
- }, [
687
- o("span", Ct, c(F(p.status)), 1),
688
- o("span", $t, c(v(p.count)) + " · " + c(v(p.spots)) + " spots · " + c(u(p.revenue)), 1)
689
- ]))), 128))
690
- ])
691
- ])
692
- ]),
693
- _: 1
694
- })
695
- ]),
696
- _: 1
697
- })
698
- ]),
699
- s(f, { class: "-mx-6 rounded-none border-x-0 @5xl:mx-0 @5xl:rounded-xl @5xl:border-x-[1px]" }, {
700
- default: n(() => [
701
- s(x, null, {
702
- default: n(() => [
703
- s(d, null, {
704
- default: n(() => [...e[37] || (e[37] = [
705
- i("Daily Breakdown", -1)
706
- ])]),
707
- _: 1
708
- }),
709
- s(g, null, {
710
- default: n(() => [...e[38] || (e[38] = [
711
- i("Revenue is based on orders placed on each day.", -1)
712
- ])]),
713
- _: 1
714
- })
715
- ]),
716
- _: 1
717
- }),
718
- s(_, null, {
719
- default: n(() => [
720
- o("div", Dt, [
721
- s(be, null, {
722
- default: n(() => [
723
- s(ge, null, {
724
- default: n(() => [
725
- s(te, null, {
726
- default: n(() => [
727
- s(E, null, {
728
- default: n(() => [...e[39] || (e[39] = [
729
- i("Date", -1)
730
- ])]),
731
- _: 1
732
- }),
733
- s(E, { class: "text-right" }, {
734
- default: n(() => [...e[40] || (e[40] = [
735
- i("Orders", -1)
736
- ])]),
737
- _: 1
738
- }),
739
- s(E, { class: "text-right" }, {
740
- default: n(() => [...e[41] || (e[41] = [
741
- i("Reservations", -1)
742
- ])]),
743
- _: 1
744
- }),
745
- s(E, { class: "text-right" }, {
746
- default: n(() => [...e[42] || (e[42] = [
747
- i("Gross", -1)
748
- ])]),
749
- _: 1
750
- }),
751
- s(E, { class: "text-right" }, {
752
- default: n(() => [...e[43] || (e[43] = [
753
- i("Refunds", -1)
754
- ])]),
755
- _: 1
756
- }),
757
- s(E, { class: "text-right" }, {
758
- default: n(() => [...e[44] || (e[44] = [
759
- i("Net", -1)
760
- ])]),
761
- _: 1
762
- })
763
- ]),
764
- _: 1
765
- })
766
- ]),
767
- _: 1
768
- }),
769
- s(xe, null, {
770
- default: n(() => [
771
- ($(!0), A(I, null, Y(r(ee), (p) => ($(), se(te, {
772
- key: p.date
773
- }, {
774
- default: n(() => [
775
- s(U, { class: "font-medium" }, {
776
- default: n(() => [
777
- i(c(p.date), 1)
778
- ]),
779
- _: 2
780
- }, 1024),
781
- s(U, { class: "text-right" }, {
782
- default: n(() => [
783
- i(c(v(p.orders)), 1)
784
- ]),
785
- _: 2
786
- }, 1024),
787
- s(U, { class: "text-right" }, {
788
- default: n(() => [
789
- i(c(v(p.reservations)), 1)
790
- ]),
791
- _: 2
792
- }, 1024),
793
- s(U, { class: "text-right" }, {
794
- default: n(() => [
795
- i(c(u(p.grossRevenue)), 1)
796
- ]),
797
- _: 2
798
- }, 1024),
799
- s(U, { class: "text-right" }, {
800
- default: n(() => [
801
- i(c(u(p.refunds)), 1)
802
- ]),
803
- _: 2
804
- }, 1024),
805
- s(U, { class: "text-right font-medium" }, {
806
- default: n(() => [
807
- i(c(u(p.netRevenue)), 1)
808
- ]),
809
- _: 2
810
- }, 1024)
811
- ]),
812
- _: 2
813
- }, 1024))), 128))
814
- ]),
815
- _: 1
816
- })
817
- ]),
818
- _: 1
819
- })
820
- ])
821
- ]),
822
- _: 1
823
- })
824
- ]),
825
- _: 1
826
- })
827
- ], 64))
828
- ])
829
- ]),
830
- _: 1
831
- });
832
- };
833
- }
834
- });
835
- export {
836
- zt as default
837
- };