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

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 (162) hide show
  1. package/dist/{ContentEditor-CoJjsV-m.js → ContentEditor-BcIUumah.js} +63 -59
  2. package/dist/{ContentEditor-DIwqplfB.mjs → ContentEditor-DX1bTQKs.mjs} +27894 -26319
  3. package/dist/{Detail-Dk8E6_uF.mjs → Detail-B7pe808q.mjs} +15 -14
  4. package/dist/Detail-BESGmY7z.js +1 -0
  5. package/dist/{Detail-Cn9Bk0u0.mjs → Detail-B_Q7Qkuz.mjs} +26 -25
  6. package/dist/Detail-CNiLIEh9.js +1 -0
  7. package/dist/{Detail-B_scnidb.mjs → Detail-DNxAzeCs.mjs} +35 -34
  8. package/dist/Detail-t3tOcy3X.js +1 -0
  9. package/dist/Editor-D4evcdhv.mjs +768 -0
  10. package/dist/Editor-gLLtuJbY.js +1 -0
  11. package/dist/FormStatusBadge.vue_vue_type_script_setup_true_lang-BjKpsqT9.js +1 -0
  12. package/dist/FormStatusBadge.vue_vue_type_script_setup_true_lang-D5v5AhLe.mjs +76 -0
  13. package/dist/Knowledge-B66vxz--.js +1 -0
  14. package/dist/Knowledge-BnMTTuJ7.mjs +742 -0
  15. 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
  16. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BVE_uURZ.js +1 -0
  17. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-BdFa-xNf.mjs +3566 -0
  18. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-DzPOadcU.js +925 -0
  19. package/dist/Overview-BE4uYPx0.mjs +745 -0
  20. package/dist/Overview-CQRpFhbJ.mjs +286 -0
  21. package/dist/Overview-CTs7sX4d.js +1 -0
  22. package/dist/Overview-Cj89XXKN.js +1 -0
  23. package/dist/Overview-D_c18mbR.mjs +248 -0
  24. package/dist/Overview-g4Rcj245.js +1 -0
  25. package/dist/TableCalculationWidget-CkQPrVUd.js +59 -0
  26. package/dist/TableCalculationWidget-CrqcLGfU.mjs +254 -0
  27. package/dist/TableDataWidget-7qvC3Egd.js +1 -0
  28. package/dist/TableDataWidget-DMTSoGRO.mjs +121 -0
  29. package/dist/TableOverviewCard-AFq-puJs.js +1 -0
  30. package/dist/TableOverviewCard-Ci0d4o4w.mjs +391 -0
  31. package/dist/TableResultView.vue_vue_type_script_setup_true_lang-CBn-Oxl9.mjs +534 -0
  32. package/dist/TableResultView.vue_vue_type_script_setup_true_lang-C_Lv-SmJ.js +1 -0
  33. package/dist/TableRowActionCard-BhdnnPaq.mjs +266 -0
  34. package/dist/TableRowActionCard-IzB6tNN-.js +1 -0
  35. package/dist/TableView-6mdrL3zx.js +4 -0
  36. package/dist/TableView-Du5nOE6R.mjs +8228 -0
  37. package/dist/Test-CzmOmi53.mjs +447 -0
  38. package/dist/Test-USDtNFY1.js +1 -0
  39. package/dist/UserDetail-DpUL3mhk.mjs +1483 -0
  40. package/dist/UserDetail-KRIfxaYd.js +1 -0
  41. package/dist/{agenda-BCKDYOeF.mjs → agenda-DWdbWUbb.mjs} +10 -9
  42. package/dist/agenda-r9Gl85GL.js +1 -0
  43. package/dist/cms-core-modules.css +1 -1
  44. package/dist/dateRangePresets-B-l5b_wR.mjs +48 -0
  45. package/dist/dateRangePresets-CPWqst_x.js +1 -0
  46. package/dist/fuse-Deb-Iq39.mjs +1473 -0
  47. package/dist/fuse-_CGUd5Zq.js +1 -0
  48. package/dist/{index-DU3Ib10Z.mjs → index-B_qaX29C.mjs} +7 -6
  49. package/dist/index-CQuN5rKx.js +1 -0
  50. package/dist/index-CnDGeInm.js +1 -0
  51. package/dist/index-CqDTc5Ig.mjs +20 -0
  52. package/dist/index-CyvvAdt4.js +1 -0
  53. package/dist/index-DIRD7t5_.mjs +20 -0
  54. package/dist/index-OJuBYR60.mjs +57 -0
  55. package/dist/{index-Bk3yLv_G.js → index-yHLT6gaZ.js} +3 -3
  56. package/dist/index.cjs.js +1 -1
  57. package/dist/index.mjs +671 -118
  58. package/dist/{orders-CElKNc1v.mjs → orders-BfTLIm7U.mjs} +10 -9
  59. package/dist/orders-DUa2PVoa.js +1 -0
  60. package/dist/reports-ChCsd1Gk.mjs +1107 -0
  61. package/dist/reports-DmJPm8uP.js +158 -0
  62. package/dist/row-item-C1dUyimV.mjs +204 -0
  63. package/dist/row-item-Cyo3m3MZ.js +1 -0
  64. package/dist/server-handlers.cjs.js +1 -1
  65. package/dist/server-handlers.mjs +1764 -605
  66. package/dist/src/appointments/components/edit/EventDialog/BookingsList.vue.d.ts +9 -3
  67. package/dist/src/appointments/components/edit/EventDialog/OrderDetailDialog.vue.d.ts +2 -0
  68. package/dist/src/appointments/components/edit/EventDialog/ReservationDetailDialog.vue.d.ts +4 -2
  69. package/dist/src/appointments/components/edit/dashboard/BookingsList.vue.d.ts +9 -3
  70. package/dist/src/appointments/pages/edit/orders.vue.d.ts +9 -3
  71. package/dist/src/appointments/pages/edit/reports.vue.d.ts +229 -1
  72. package/dist/src/contentManager/components/content-editor/tiptap-extensions/Container.d.ts +1 -1
  73. package/dist/src/contentManager/components/content-editor/tiptap-extensions/Row.d.ts +7 -0
  74. package/dist/src/contentManager/components/content-editor/tiptap-extensions/Stack.d.ts +7 -0
  75. package/dist/src/contentManager/components/content-editor/tiptap-extensions/helpers/resizeHistory.d.ts +9 -0
  76. package/dist/src/contentManager/components/content-editor/tiptap-menus/ElementEditorMenu.vue.d.ts +3 -1
  77. package/dist/src/firebaseAuthManager/components/DeleteUserDialog.vue.d.ts +25 -0
  78. package/dist/src/firebaseAuthManager/components/ReasonActionDialog.vue.d.ts +23 -0
  79. package/dist/src/firebaseAuthManager/components/UserStatusBadge.vue.d.ts +5 -0
  80. package/dist/src/firebaseAuthManager/config.d.ts +151 -0
  81. package/dist/src/firebaseAuthManager/index.d.ts +163 -0
  82. package/dist/src/firebaseAuthManager/index.vue.d.ts +14 -0
  83. package/dist/src/firebaseAuthManager/metadata.d.ts +2 -0
  84. package/dist/src/firebaseAuthManager/pages/Overview.vue.d.ts +2 -0
  85. package/dist/src/firebaseAuthManager/pages/UserDetail.vue.d.ts +2 -0
  86. package/dist/src/firebaseAuthManager/permissions.d.ts +5 -0
  87. package/dist/src/firebaseAuthManager/routes.d.ts +5 -0
  88. package/dist/src/firebaseAuthManager/server.d.ts +162 -0
  89. package/dist/src/firebaseAuthManager/types.d.ts +84 -0
  90. package/dist/src/formBuilder/components/FormPreviewDialog.vue.d.ts +12 -0
  91. package/dist/src/formBuilder/components/FormStatusBadge.vue.d.ts +9 -0
  92. package/dist/src/formBuilder/config.d.ts +31 -0
  93. package/dist/src/formBuilder/index.d.ts +44 -0
  94. package/dist/src/formBuilder/index.vue.d.ts +14 -0
  95. package/dist/src/formBuilder/lib/forms.d.ts +11 -0
  96. package/dist/src/formBuilder/metadata.d.ts +2 -0
  97. package/dist/src/formBuilder/pages/Editor.vue.d.ts +2 -0
  98. package/dist/src/formBuilder/pages/Overview.vue.d.ts +2 -0
  99. package/dist/src/formBuilder/permissions.d.ts +5 -0
  100. package/dist/src/formBuilder/routes.d.ts +5 -0
  101. package/dist/src/formBuilder/server.d.ts +87 -0
  102. package/dist/src/formBuilder/tools.d.ts +1 -0
  103. package/dist/src/formBuilder/types.d.ts +46 -0
  104. package/dist/src/helpbot/composables/useHelpbotApi.d.ts +18 -0
  105. package/dist/src/helpbot/config.d.ts +17 -0
  106. package/dist/src/helpbot/index.d.ts +29 -0
  107. package/dist/src/helpbot/index.vue.d.ts +2 -0
  108. package/dist/src/helpbot/metadata.d.ts +2 -0
  109. package/dist/src/helpbot/pages/Knowledge.vue.d.ts +4 -0
  110. package/dist/src/helpbot/pages/Overview.vue.d.ts +2 -0
  111. package/dist/src/helpbot/pages/Test.vue.d.ts +4 -0
  112. package/dist/src/helpbot/permissions.d.ts +5 -0
  113. package/dist/src/helpbot/routes.d.ts +5 -0
  114. package/dist/src/helpbot/types.d.ts +42 -0
  115. package/dist/src/index.d.ts +3 -0
  116. package/dist/src/server-handlers.d.ts +2 -0
  117. package/dist/src/table/chat-components/TableCalculationWidget.vue.d.ts +15 -0
  118. package/dist/src/table/chat-components/TableDataWidget.vue.d.ts +15 -0
  119. package/dist/src/table/chat-components/TableOverviewCard.vue.d.ts +61 -0
  120. package/dist/src/table/chat-components/TableResultView.vue.d.ts +48 -0
  121. package/dist/src/table/chat-components/TableRowActionCard.vue.d.ts +15 -0
  122. package/dist/src/table/components/filters/DialogTableFilterOptionItem.vue.d.ts +16 -0
  123. package/dist/src/table/components/filters/NumberComparisonFilter.vue.d.ts +12 -0
  124. package/dist/src/table/components/filters/NumberComparisonFilterSettings.vue.d.ts +12 -0
  125. package/dist/src/table/components/filters/NumberRangeFilter.vue.d.ts +12 -0
  126. package/dist/src/table/components/filters/NumberRangeFilterSettings.vue.d.ts +12 -0
  127. package/dist/src/table/components/filters/filter-utils.d.ts +14 -0
  128. package/dist/src/table/composables/useTableAgentTools.d.ts +33 -0
  129. package/dist/src/table/index.d.ts +339 -0
  130. package/dist/src/table/tool-sandbox.d.ts +13 -0
  131. package/dist/src/table/tool-utils.d.ts +11 -0
  132. package/dist/src/table/tools.d.ts +333 -1
  133. package/dist/src/table/types.d.ts +79 -0
  134. package/dist/tool-sandbox-DdkMLkDK.mjs +182 -0
  135. package/dist/tool-sandbox-DoF1PsyS.js +115 -0
  136. package/dist/types-9N-DKxNj.mjs +250 -0
  137. package/dist/types-BMraG1kN.js +1 -0
  138. package/dist/types-Cem0vPo_.js +1 -0
  139. package/dist/types-ibC3-e1N.mjs +2630 -0
  140. package/dist/useHelpbotApi-BIIungOh.js +1 -0
  141. package/dist/useHelpbotApi-HC9JSiSn.mjs +229 -0
  142. package/dist/useTableAgentTools-D5mzGf3A.js +1 -0
  143. package/dist/useTableAgentTools-DcN3kYRL.mjs +131 -0
  144. package/dist/vee-validate-zod-BQElPD0m.js +1 -0
  145. package/dist/vee-validate-zod-CN16K2x9.mjs +1780 -0
  146. package/package.json +17 -17
  147. package/src/formBuilder/tools.ts +1 -0
  148. package/src/table/tools.ts +304 -1
  149. package/dist/Detail-BCUUNWvp.js +0 -1
  150. package/dist/Detail-DGg_xXZc.js +0 -1
  151. package/dist/Detail-Sc2qZdxj.js +0 -1
  152. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BdZbcubW.js +0 -1
  153. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-BYSeUW_V.js +0 -925
  154. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-DwAUYR8p.mjs +0 -5021
  155. package/dist/TableView-Ctnep-Qu.mjs +0 -6247
  156. package/dist/TableView-DJqyJL9L.js +0 -4
  157. package/dist/agenda-B54F8cEr.js +0 -1
  158. package/dist/orders-BMosTk6r.js +0 -1
  159. package/dist/reports-BQT_GZzU.js +0 -158
  160. package/dist/reports-DksZCTOw.mjs +0 -837
  161. package/dist/vee-validate-zod-SjDT8X35.mjs +0 -4404
  162. package/dist/vee-validate-zod-VCmLnrtQ.js +0 -1
@@ -0,0 +1,1107 @@
1
+ import { defineComponent as st, computed as $, ref as S, provide as ot, resolveComponent as b, openBlock as _, createElementBlock as w, Fragment as H, createVNode as n, withCtx as o, createElementVNode as s, unref as a, createTextVNode as i, normalizeClass as de, toDisplayString as u, isRef as Ae, createCommentVNode as Se, renderList as ee, createBlock as te, nextTick as at } from "vue";
2
+ import { useModuleRoute as rt, useModule as lt, useFirebaseIntegration as dt } from "@oneclick.dev/cms-kit";
3
+ import { BarChart3 as $e, Download as ut, RefreshCw as it, CalendarIcon as ct, BadgeEuro as ft, ShoppingBag as mt, Users as Oe, Undo2 as pt, Receipt as gt, ChevronRight as Te, Clock as vt, LoaderCircle as xt } from "lucide-vue-next";
4
+ import { t as ue } from "./index-RLz1QPrf.mjs";
5
+ import { _ as bt } from "./EditLayout.vue_vue_type_script_setup_true_lang-4_t0PPqM.mjs";
6
+ import { a as _t, b as yt } from "./OrderDetailDialog.vue_vue_type_script_setup_true_lang-BdFa-xNf.mjs";
7
+ const ht = { class: "space-y-6" }, wt = { class: "flex flex-col gap-4 @3xl:flex-row @3xl:items-start @3xl:justify-between" }, Rt = { class: "text-2xl font-semibold tracking-tight flex items-center gap-2" }, Dt = { class: "flex flex-col gap-2 sm:flex-row sm:items-center" }, kt = { class: "grid grid-cols-1 gap-3 @xl:grid-cols-3 md:items-end" }, Ct = { class: "grid gap-1.5" }, At = { class: "grid gap-1.5" }, St = {
8
+ key: 0,
9
+ class: "text-sm text-destructive"
10
+ }, $t = { class: "flex flex-wrap gap-2" }, Ot = {
11
+ key: 0,
12
+ class: "flex items-center justify-center py-12"
13
+ }, Tt = {
14
+ key: 1,
15
+ class: "text-center py-12 text-muted-foreground"
16
+ }, jt = { class: "grid grid-cols-1 gap-4 @3xl:grid-cols-2 @7xl:grid-cols-4" }, Mt = { class: "text-2xl font-semibold" }, It = { class: "text-xs text-muted-foreground mt-1" }, zt = { class: "text-2xl font-semibold" }, Nt = { class: "text-xs text-muted-foreground mt-1" }, Pt = { class: "text-2xl font-semibold" }, Bt = { class: "text-xs text-muted-foreground mt-1" }, Ut = { class: "text-2xl font-semibold" }, Ft = { class: "text-xs text-muted-foreground mt-1" }, Et = { class: "grid grid-cols-1 gap-4 @5xl:grid-cols-2" }, Lt = { class: "flex items-center justify-between gap-4" }, Vt = { class: "font-medium" }, Ht = { class: "flex items-center justify-between gap-4" }, qt = { class: "font-medium text-destructive" }, Yt = { class: "flex items-center justify-between gap-4" }, Gt = { class: "font-semibold" }, Qt = { class: "flex items-center justify-between gap-4" }, Kt = { class: "font-medium" }, Jt = { class: "flex items-center justify-between gap-4" }, Wt = { class: "font-medium" }, Xt = { class: "flex items-center justify-between gap-4" }, Zt = { class: "font-medium" }, en = { class: "flex items-center justify-between gap-4" }, tn = { class: "font-medium" }, nn = { class: "flex items-center justify-between gap-4" }, sn = { class: "font-medium" }, on = { class: "flex items-center justify-between gap-4" }, an = { class: "font-medium" }, rn = { class: "flex items-center gap-2 text-sm font-medium mb-3" }, ln = { class: "space-y-2 text-sm" }, dn = { class: "text-muted-foreground" }, un = { class: "font-medium" }, cn = { class: "flex items-center gap-2 text-sm font-medium mb-3" }, fn = { class: "space-y-2 text-sm" }, mn = { class: "text-muted-foreground" }, pn = { class: "font-medium" }, gn = { class: "overflow-x-auto" }, vn = ["aria-label", "onClick"], xn = { key: 1 }, bn = { class: "space-y-2 py-4" }, _n = ["disabled", "aria-disabled", "aria-busy", "onClick"], yn = { class: "min-w-0 flex-1 space-y-1.5" }, hn = { class: "flex flex-wrap items-center gap-2" }, wn = { class: "truncate font-medium" }, Rn = { class: "flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground" }, Dn = { class: "inline-flex items-center gap-1" }, kn = { class: "flex shrink-0 items-center justify-between gap-2 sm:justify-end" }, Cn = { class: "font-medium" }, An = {
17
+ key: 0,
18
+ class: "text-xs font-normal text-muted-foreground"
19
+ }, Nn = /* @__PURE__ */ st({
20
+ __name: "reports",
21
+ setup(Sn) {
22
+ const { params: ie } = rt(), { config: J } = lt(), ne = dt(J.project), ce = $(() => ie.value?.id ?? ie.id ?? ""), N = S(!1), R = S([]), W = S(null), q = S([]), P = S(!1), T = S(null), I = S(null), Y = S(!1), fe = S(null), me = S(null), pe = S(null);
23
+ let G = 0;
24
+ const j = (t) => {
25
+ const e = t.getFullYear(), r = String(t.getMonth() + 1).padStart(2, "0"), l = String(t.getDate()).padStart(2, "0");
26
+ return `${e}-${r}-${l}`;
27
+ }, se = (t) => {
28
+ const e = Math.floor(t.getMonth() / 3) * 3;
29
+ return new Date(t.getFullYear(), e, 1);
30
+ }, je = (t) => {
31
+ const e = Math.floor(t.getMonth() / 3) * 3;
32
+ return new Date(t.getFullYear(), e + 3, 0);
33
+ }, ge = /* @__PURE__ */ new Date(), D = S(j(se(ge))), k = S(j(ge)), B = $(() => !D.value || !k.value ? "Select a start and end date." : D.value > k.value ? "Start date must be before end date." : ""), Me = () => {
34
+ const t = /* @__PURE__ */ new Date(`${D.value}T00:00:00`), e = /* @__PURE__ */ new Date(`${k.value}T23:59:59.999`);
35
+ return { start: t, end: e };
36
+ }, ve = $(() => {
37
+ if (!D.value || !k.value) return "";
38
+ const t = /* @__PURE__ */ new Date(`${D.value}T00:00:00`), e = /* @__PURE__ */ new Date(`${k.value}T00:00:00`);
39
+ return `${t.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" })} - ${e.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" })}`;
40
+ }), Ie = () => {
41
+ const t = /* @__PURE__ */ new Date();
42
+ D.value = j(se(t)), k.value = j(t);
43
+ }, ze = () => {
44
+ const t = /* @__PURE__ */ new Date(), e = new Date(t.getFullYear(), Math.floor(t.getMonth() / 3) * 3 - 1, 1);
45
+ D.value = j(se(e)), k.value = j(je(e));
46
+ }, Ne = () => {
47
+ const t = /* @__PURE__ */ new Date();
48
+ D.value = j(new Date(t.getFullYear(), 0, 1)), k.value = j(t);
49
+ }, M = (t) => {
50
+ const e = Number(t);
51
+ return Number.isFinite(e) ? e : 0;
52
+ }, U = (t) => {
53
+ if (!t) return null;
54
+ if (t instanceof Date) return t;
55
+ if (typeof t == "string" || typeof t == "number") {
56
+ const e = new Date(t);
57
+ return Number.isNaN(e.getTime()) ? null : e;
58
+ }
59
+ return typeof t.toDate == "function" ? t.toDate() : null;
60
+ }, xe = (t) => {
61
+ const e = U(t.createdAt);
62
+ return e ? j(e) : "Unknown date";
63
+ }, z = (t) => typeof t.total == "number" ? t.total : (t.reservations || []).reduce((e, r) => e + M(r.totalPrice), 0), Pe = (t) => typeof t.amountPaid == "number" ? t.amountPaid : z(t), be = (t) => t.status === "confirmed", F = $(() => R.value.flatMap((t) => {
64
+ const e = t.id, r = t.status || "unknown", l = z(t);
65
+ return (t.reservations || []).map((p) => ({
66
+ ...p,
67
+ orderId: e,
68
+ orderStatus: r,
69
+ orderCreatedAt: t.createdAt,
70
+ orderTotal: l,
71
+ orderAmountPaid: t.amountPaid
72
+ }));
73
+ })), _e = (t) => Array.isArray(t.refunds) ? t.refunds : [], ye = (t) => {
74
+ const e = _e(t);
75
+ return e.length > 0 ? e.reduce((r, l) => r + M(l.amount), 0) : M(t.refundedAmount);
76
+ }, Be = (t) => {
77
+ const e = _e(t);
78
+ return e.length > 0 ? e.length : !!(t.refundStatus || t.refundedAt || M(t.refundedAmount) > 0) ? 1 : 0;
79
+ }, E = $(() => R.value.filter(be)), c = $(() => {
80
+ const t = E.value.reduce((g, y) => g + z(y), 0), e = E.value.reduce((g, y) => g + Pe(y), 0), r = F.value.filter((g) => g.orderStatus === "confirmed").length, l = R.value.filter((g) => g.status === "pending").reduce((g, y) => g + z(y), 0), p = R.value.filter((g) => g.status === "cancelled").reduce((g, y) => g + z(y), 0), v = F.value.reduce((g, y) => g + ye(y), 0), m = F.value.reduce((g, y) => g + Be(y), 0), A = F.value.reduce((g, y) => g + M(y.spots), 0), h = E.value.reduce((g, y) => g + M(y.amountDue), 0);
81
+ return {
82
+ grossRevenue: t,
83
+ moneyCollected: e,
84
+ pendingRevenue: l,
85
+ cancelledRevenue: p,
86
+ netRevenue: t - v,
87
+ refundAmount: v,
88
+ refundCount: m,
89
+ orders: R.value.length,
90
+ confirmedOrders: E.value.length,
91
+ reservations: F.value.length,
92
+ spots: A,
93
+ amountDue: h,
94
+ averageOrder: E.value.length ? t / E.value.length : 0,
95
+ averageReservation: r ? t / r : 0
96
+ };
97
+ }), he = $(() => {
98
+ const t = /* @__PURE__ */ new Map();
99
+ return R.value.forEach((e) => {
100
+ const r = e.status || "unknown", l = t.get(r) || { status: r, count: 0, revenue: 0 };
101
+ l.count += 1, l.revenue += z(e), t.set(r, l);
102
+ }), Array.from(t.values()).sort((e, r) => r.count - e.count);
103
+ }), we = $(() => {
104
+ const t = /* @__PURE__ */ new Map();
105
+ return F.value.forEach((e) => {
106
+ const r = e.status || "unknown", l = t.get(r) || { status: r, count: 0, spots: 0, revenue: 0 };
107
+ l.count += 1, l.spots += M(e.spots), l.revenue += M(e.totalPrice), t.set(r, l);
108
+ }), Array.from(t.values()).sort((e, r) => r.count - e.count);
109
+ }), oe = $(() => {
110
+ const t = /* @__PURE__ */ new Map();
111
+ return R.value.forEach((e) => {
112
+ const r = xe(e), l = t.get(r) || {
113
+ date: r,
114
+ orders: 0,
115
+ reservations: 0,
116
+ grossRevenue: 0,
117
+ refunds: 0,
118
+ netRevenue: 0
119
+ }, p = e.reservations || [], v = p.reduce((A, h) => A + ye(h), 0), m = be(e) ? z(e) : 0;
120
+ l.orders += 1, l.reservations += p.length, l.grossRevenue += m, l.refunds += v, l.netRevenue = l.grossRevenue - l.refunds, t.set(r, l);
121
+ }), Array.from(t.values()).sort((e, r) => r.date.localeCompare(e.date));
122
+ }), X = $(() => oe.value.find((t) => t.date === T.value) || null), ae = $(() => T.value ? R.value.filter((t) => xe(t) === T.value) : []);
123
+ ot("event", fe);
124
+ const Ue = (t) => {
125
+ t.date !== "Unknown date" && (T.value = t.date, P.value = !0);
126
+ }, re = () => {
127
+ P.value = !1, I.value = null, G += 1;
128
+ }, Fe = (t) => {
129
+ if (t) {
130
+ P.value = !0;
131
+ return;
132
+ }
133
+ re();
134
+ }, f = (t) => new Intl.NumberFormat("nl-BE", {
135
+ style: "currency",
136
+ currency: "EUR"
137
+ }).format(t), x = (t) => new Intl.NumberFormat("nl-BE").format(t), Z = (t, e, r = `${e}s`) => `${x(t)} ${t === 1 ? e : r}`, Q = (t) => t.split("_").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" "), Re = (t) => {
138
+ if (t === "Unknown date") return t;
139
+ const e = /* @__PURE__ */ new Date(`${t}T00:00:00`);
140
+ return Number.isNaN(e.getTime()) ? t : e.toLocaleDateString("en-US", {
141
+ weekday: "long",
142
+ month: "long",
143
+ day: "numeric",
144
+ year: "numeric"
145
+ });
146
+ }, Ee = (t) => {
147
+ const e = U(t);
148
+ return e ? e.toLocaleTimeString("en-US", {
149
+ hour: "2-digit",
150
+ minute: "2-digit",
151
+ hour12: !1
152
+ }) : "Time unavailable";
153
+ }, Le = (t) => [t.customerInfo?.firstName, t.customerInfo?.lastName].filter(Boolean).join(" ").trim() || t.customerInfo?.email || "Unknown customer", Ve = (t) => (t.reservations || []).reduce((e, r) => e + M(r.spots), 0), De = (t) => {
154
+ switch (t) {
155
+ case "pending":
156
+ return { label: "Pending", class: "bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400" };
157
+ case "cancelled":
158
+ return { label: "Cancelled", class: "bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400" };
159
+ case "needs_approval":
160
+ return { label: "Needs Approval", class: "bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400" };
161
+ case "rejected":
162
+ return { label: "Rejected", class: "bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400" };
163
+ case "approved":
164
+ return { label: "Approved", class: "bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400" };
165
+ case "confirmed":
166
+ return { label: "Confirmed", class: "bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400" };
167
+ default:
168
+ return { label: Q(t || "unknown"), class: "bg-muted text-muted-foreground" };
169
+ }
170
+ }, He = (t, e) => {
171
+ const r = e.resourceId || e.resource?.id, l = q.value.find((v) => String(v.id) === String(r)), p = U(t.createdAt)?.toISOString() || (typeof t.createdAt == "string" ? t.createdAt : "");
172
+ return {
173
+ id: t.id,
174
+ res_id: e.id,
175
+ customerInfo: t.customerInfo,
176
+ amountDue: t.amountDue,
177
+ amountPaid: t.amountPaid,
178
+ status: t.status,
179
+ reservationStatus: e.status,
180
+ subtotal: t.subtotal,
181
+ total: t.total,
182
+ discount: t.discount,
183
+ resourceId: r,
184
+ resource: e.resource,
185
+ spots: e.spots,
186
+ date: e.date,
187
+ createdAt: p,
188
+ startTime: e.timeslot?.startTime,
189
+ endTime: e.timeslot?.endTime,
190
+ reservationPrice: e.totalPrice,
191
+ reservationBasePrice: e.basePrice,
192
+ reservationAddOnsPrice: e.addOnsPrice,
193
+ pricingOptionId: e.pricingOptionId,
194
+ pricingOption: e.pricingOption,
195
+ resourceName: l?.name || e.resource?.name,
196
+ resourceColor: l?.color || e.resource?.color,
197
+ metadata: t.metadata || {},
198
+ reservationMetadata: e.metadata || {},
199
+ refundStatus: e.refundStatus,
200
+ refundedAt: e.refundedAt,
201
+ refundedAmount: e.refundedAmount,
202
+ refunds: Array.isArray(e.refunds) ? e.refunds : [],
203
+ adjustments: t.adjustments || [],
204
+ reservationAdjustments: e.adjustments || []
205
+ };
206
+ }, le = async () => {
207
+ await at(), await new Promise((t) => {
208
+ if (typeof requestAnimationFrame == "function") {
209
+ requestAnimationFrame(() => t());
210
+ return;
211
+ }
212
+ t();
213
+ });
214
+ }, ke = async (t, e = !1) => {
215
+ if (!t || I.value) return;
216
+ const r = ++G;
217
+ I.value = t;
218
+ try {
219
+ const l = await ne.get(J.reservationsCollection, t);
220
+ if (r !== G) return;
221
+ if (!l) {
222
+ ue.error("Order details could not be found."), await K();
223
+ return;
224
+ }
225
+ const p = {
226
+ ...l,
227
+ id: l.id || t
228
+ }, v = (p.reservations || []).map((m) => He(p, m));
229
+ if (!v.length) {
230
+ ue.error("This order has no reservation details."), await K();
231
+ return;
232
+ }
233
+ e && (Y.value = !0), P.value = !1, await le(), me.value?.openDialog({
234
+ id: p.id,
235
+ customerInfo: p.customerInfo,
236
+ status: p.status,
237
+ createdAt: U(p.createdAt)?.toISOString() || (typeof p.createdAt == "string" ? p.createdAt : ""),
238
+ metadata: p.metadata || {},
239
+ reservations: v,
240
+ adjustments: p.adjustments || [],
241
+ totalPrice: typeof p.total == "number" ? p.total : v.reduce((m, A) => m + (A.reservationPrice || 0), 0),
242
+ totalSpots: v.reduce((m, A) => m + (A.spots || 0), 0)
243
+ });
244
+ } catch (l) {
245
+ if (r !== G) return;
246
+ console.error("Error loading order details:", l), ue.error("Unable to load order details."), await K();
247
+ } finally {
248
+ r === G && (I.value = null);
249
+ }
250
+ }, qe = async (t) => {
251
+ fe.value = {
252
+ date: t.date,
253
+ resourceId: t.resourceId || t.resource?.id,
254
+ resource: t.resource
255
+ }, await le(), pe.value?.openDialog(t);
256
+ };
257
+ async function K() {
258
+ if (!Y.value || !T.value || !ae.value.length) {
259
+ Y.value = !1;
260
+ return;
261
+ }
262
+ await le(), !(!T.value || !ae.value.length) && (P.value = !0, Y.value = !1);
263
+ }
264
+ const C = (t) => String(t ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;"), Ye = () => {
265
+ if (!R.value.length) return;
266
+ const t = [
267
+ ["Money made", f(c.value.netRevenue), `${f(c.value.grossRevenue)} gross - ${f(c.value.refundAmount)} refunds`],
268
+ ["Orders", x(c.value.orders), `${x(c.value.confirmedOrders)} confirmed`],
269
+ ["Reservations", x(c.value.reservations), `${x(c.value.spots)} spots booked`],
270
+ ["Refunds", x(c.value.refundCount), `${f(c.value.refundAmount)} refunded`]
271
+ ], e = [
272
+ ["Gross revenue", f(c.value.grossRevenue)],
273
+ ["Refunds", f(c.value.refundAmount)],
274
+ ["Net revenue", f(c.value.netRevenue)],
275
+ ["Money collected", f(c.value.moneyCollected)],
276
+ ["Amount due", f(c.value.amountDue)],
277
+ ["Pending order value", f(c.value.pendingRevenue)],
278
+ ["Cancelled order value", f(c.value.cancelledRevenue)],
279
+ ["Average confirmed order", f(c.value.averageOrder)],
280
+ ["Average reservation", f(c.value.averageReservation)]
281
+ ], r = (m) => m.map((A) => `<tr>${A.map((h) => `<td>${C(h)}</td>`).join("")}</tr>`).join(""), l = `<!DOCTYPE html>
282
+ <html lang="en">
283
+ <head>
284
+ <meta charset="UTF-8">
285
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
286
+ <title>Appointments Report ${C(D.value)} - ${C(k.value)}</title>
287
+ <style>
288
+ * { box-sizing: border-box; }
289
+ body {
290
+ margin: 0;
291
+ padding: 40px;
292
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
293
+ color: #111827;
294
+ background: #f8fafc;
295
+ }
296
+ .report {
297
+ max-width: 1040px;
298
+ margin: 0 auto;
299
+ background: #ffffff;
300
+ border: 1px solid #e5e7eb;
301
+ border-radius: 8px;
302
+ padding: 32px;
303
+ }
304
+ h1, h2 { margin: 0; }
305
+ h1 { font-size: 28px; letter-spacing: 0; }
306
+ h2 { font-size: 16px; margin-bottom: 12px; }
307
+ .muted { color: #6b7280; }
308
+ .header {
309
+ display: flex;
310
+ justify-content: space-between;
311
+ gap: 24px;
312
+ border-bottom: 1px solid #e5e7eb;
313
+ padding-bottom: 24px;
314
+ margin-bottom: 24px;
315
+ }
316
+ .cards {
317
+ display: grid;
318
+ grid-template-columns: repeat(4, minmax(0, 1fr));
319
+ gap: 12px;
320
+ margin-bottom: 24px;
321
+ }
322
+ .card {
323
+ border: 1px solid #e5e7eb;
324
+ border-radius: 8px;
325
+ padding: 16px;
326
+ background: #ffffff;
327
+ }
328
+ .card-label { font-size: 12px; color: #6b7280; margin-bottom: 8px; }
329
+ .card-value { font-size: 22px; font-weight: 700; }
330
+ .card-note { font-size: 12px; color: #6b7280; margin-top: 6px; }
331
+ .grid {
332
+ display: grid;
333
+ grid-template-columns: repeat(2, minmax(0, 1fr));
334
+ gap: 24px;
335
+ margin-bottom: 24px;
336
+ }
337
+ table {
338
+ width: 100%;
339
+ border-collapse: collapse;
340
+ font-size: 13px;
341
+ }
342
+ th, td {
343
+ border-bottom: 1px solid #e5e7eb;
344
+ padding: 10px 8px;
345
+ text-align: left;
346
+ }
347
+ th {
348
+ color: #6b7280;
349
+ font-weight: 600;
350
+ background: #f9fafb;
351
+ }
352
+ td:last-child, th:last-child { text-align: right; }
353
+ @media print {
354
+ body { background: #ffffff; padding: 0; }
355
+ .report { border: 0; }
356
+ }
357
+ </style>
358
+ </head>
359
+ <body>
360
+ <main class="report">
361
+ <section class="header">
362
+ <div>
363
+ <h1>Appointments Report</h1>
364
+ <p class="muted">${C(ve.value)}</p>
365
+ </div>
366
+ <div class="muted">Generated ${C((/* @__PURE__ */ new Date()).toLocaleString("en-US"))}</div>
367
+ </section>
368
+
369
+ <section class="cards">
370
+ ${t.map(([m, A, h]) => `
371
+ <div class="card">
372
+ <div class="card-label">${C(m)}</div>
373
+ <div class="card-value">${C(A)}</div>
374
+ <div class="card-note">${C(h)}</div>
375
+ </div>
376
+ `).join("")}
377
+ </section>
378
+
379
+ <section class="grid">
380
+ <div>
381
+ <h2>Finance</h2>
382
+ <table><tbody>${r(e)}</tbody></table>
383
+ </div>
384
+ <div>
385
+ <h2>Order Status</h2>
386
+ <table>
387
+ <tbody>
388
+ ${r(he.value.map((m) => [
389
+ Q(m.status),
390
+ `${x(m.count)} - ${f(m.revenue)}`
391
+ ]))}
392
+ </tbody>
393
+ </table>
394
+ </div>
395
+ </section>
396
+
397
+ <section class="grid">
398
+ <div>
399
+ <h2>Reservation Status</h2>
400
+ <table>
401
+ <tbody>
402
+ ${r(we.value.map((m) => [
403
+ Q(m.status),
404
+ `${x(m.count)} - ${x(m.spots)} spots - ${f(m.revenue)}`
405
+ ]))}
406
+ </tbody>
407
+ </table>
408
+ </div>
409
+ <div>
410
+ <h2>Period Totals</h2>
411
+ <table><tbody>${r([
412
+ ["Start date", D.value],
413
+ ["End date", k.value],
414
+ ["Orders", x(c.value.orders)],
415
+ ["Reservations", x(c.value.reservations)]
416
+ ])}</tbody></table>
417
+ </div>
418
+ </section>
419
+
420
+ <section>
421
+ <h2>Daily Breakdown</h2>
422
+ <table>
423
+ <thead>
424
+ <tr>
425
+ <th>Date</th>
426
+ <th>Orders</th>
427
+ <th>Reservations</th>
428
+ <th>Gross</th>
429
+ <th>Refunds</th>
430
+ <th>Net</th>
431
+ </tr>
432
+ </thead>
433
+ <tbody>
434
+ ${oe.value.map((m) => `
435
+ <tr>
436
+ <td>${C(m.date)}</td>
437
+ <td>${C(x(m.orders))}</td>
438
+ <td>${C(x(m.reservations))}</td>
439
+ <td>${C(f(m.grossRevenue))}</td>
440
+ <td>${C(f(m.refunds))}</td>
441
+ <td>${C(f(m.netRevenue))}</td>
442
+ </tr>
443
+ `).join("")}
444
+ </tbody>
445
+ </table>
446
+ </section>
447
+ </main>
448
+ </body>
449
+ </html>`, p = new Blob([l], { type: "text/html;charset=utf-8" }), v = document.createElement("a");
450
+ v.href = URL.createObjectURL(p), v.setAttribute("download", `appointments-report-${D.value}-to-${k.value}.html`), document.body.appendChild(v), v.click(), URL.revokeObjectURL(v.href), v.remove();
451
+ }, O = async () => {
452
+ if (!B.value) {
453
+ N.value = !0, re(), T.value = null, Y.value = !1, R.value = [];
454
+ try {
455
+ const { start: t, end: e } = Me(), r = await ne.find(J.reservationsCollection, {
456
+ filters: [
457
+ { field: "agendaId", operator: "==", value: ce.value },
458
+ { field: "createdAt", operator: ">=", value: t.toISOString() },
459
+ { field: "createdAt", operator: "<=", value: e.toISOString() }
460
+ ]
461
+ });
462
+ R.value = r.map((l) => ({
463
+ ...l,
464
+ id: l.id || l.orderId || ""
465
+ })).sort((l, p) => (U(p.createdAt)?.getTime() || 0) - (U(l.createdAt)?.getTime() || 0));
466
+ } catch (t) {
467
+ console.error("Error loading report:", t), R.value = [];
468
+ } finally {
469
+ N.value = !1;
470
+ }
471
+ }
472
+ };
473
+ return (async () => {
474
+ try {
475
+ const t = await ne.get(J.agendaCollection, ce.value);
476
+ W.value = t, q.value = t?.resources?.filter((e) => e.isActive) || [];
477
+ } catch (t) {
478
+ console.error("Error loading agenda context:", t), W.value = null, q.value = [];
479
+ }
480
+ })(), O(), (t, e) => {
481
+ const r = b("Button"), l = b("CardTitle"), p = b("CardDescription"), v = b("CardHeader"), m = b("Label"), A = b("Input"), h = b("CardContent"), g = b("Card"), y = b("Separator"), L = b("TableHead"), Ce = b("TableRow"), Ge = b("TableHeader"), V = b("TableCell"), Qe = b("TableBody"), Ke = b("Table"), Je = b("ResponsiveModalTitle"), We = b("ResponsiveModalDescription"), Xe = b("ResponsiveModalHeader"), Ze = b("ResponsiveModalFooter"), et = b("ResponsiveModalScrollContent"), tt = b("ResponsiveModal");
482
+ return _(), w(H, null, [
483
+ n(bt, null, {
484
+ default: o(() => [
485
+ s("div", ht, [
486
+ s("div", wt, [
487
+ s("div", null, [
488
+ s("h1", Rt, [
489
+ n(a($e), { class: "size-6" }),
490
+ e[7] || (e[7] = i(" Reports ", -1))
491
+ ]),
492
+ e[8] || (e[8] = s("p", { class: "text-muted-foreground text-sm mt-1" }, " Financial statistics for orders placed in a selected period. ", -1))
493
+ ]),
494
+ s("div", Dt, [
495
+ n(r, {
496
+ variant: "outline",
497
+ onClick: Ye,
498
+ disabled: a(N) || !!a(B) || a(R).length === 0
499
+ }, {
500
+ default: o(() => [
501
+ n(a(ut), { class: "size-4" }),
502
+ e[9] || (e[9] = i(" Download Report ", -1))
503
+ ]),
504
+ _: 1
505
+ }, 8, ["disabled"]),
506
+ n(r, {
507
+ variant: "outline",
508
+ onClick: O,
509
+ disabled: a(N) || !!a(B)
510
+ }, {
511
+ default: o(() => [
512
+ n(a(it), {
513
+ class: de(["size-4", { "animate-spin": a(N) }])
514
+ }, null, 8, ["class"]),
515
+ e[10] || (e[10] = i(" Refresh ", -1))
516
+ ]),
517
+ _: 1
518
+ }, 8, ["disabled"])
519
+ ])
520
+ ]),
521
+ n(g, { class: "-mx-6 rounded-none border-x-0 @5xl:mx-0 @5xl:rounded-xl @5xl:border-x-[1px]" }, {
522
+ default: o(() => [
523
+ n(v, null, {
524
+ default: o(() => [
525
+ n(l, { class: "flex items-center gap-2" }, {
526
+ default: o(() => [
527
+ n(a(ct), { class: "size-5" }),
528
+ e[11] || (e[11] = i(" Period ", -1))
529
+ ]),
530
+ _: 1
531
+ }),
532
+ n(p, null, {
533
+ default: o(() => [
534
+ i(u(a(ve)), 1)
535
+ ]),
536
+ _: 1
537
+ })
538
+ ]),
539
+ _: 1
540
+ }),
541
+ n(h, { class: "space-y-4" }, {
542
+ default: o(() => [
543
+ s("div", kt, [
544
+ s("div", Ct, [
545
+ n(m, { for: "report-start-date" }, {
546
+ default: o(() => [...e[12] || (e[12] = [
547
+ i("Start date", -1)
548
+ ])]),
549
+ _: 1
550
+ }),
551
+ n(A, {
552
+ id: "report-start-date",
553
+ modelValue: a(D),
554
+ "onUpdate:modelValue": e[0] || (e[0] = (d) => Ae(D) ? D.value = d : null),
555
+ type: "date"
556
+ }, null, 8, ["modelValue"])
557
+ ]),
558
+ s("div", At, [
559
+ n(m, { for: "report-end-date" }, {
560
+ default: o(() => [...e[13] || (e[13] = [
561
+ i("End date", -1)
562
+ ])]),
563
+ _: 1
564
+ }),
565
+ n(A, {
566
+ id: "report-end-date",
567
+ modelValue: a(k),
568
+ "onUpdate:modelValue": e[1] || (e[1] = (d) => Ae(k) ? k.value = d : null),
569
+ type: "date"
570
+ }, null, 8, ["modelValue"])
571
+ ]),
572
+ n(r, {
573
+ class: "md:whitespace-nowrap",
574
+ onClick: O,
575
+ disabled: a(N) || !!a(B)
576
+ }, {
577
+ default: o(() => [...e[14] || (e[14] = [
578
+ i(" Generate Report ", -1)
579
+ ])]),
580
+ _: 1
581
+ }, 8, ["disabled"])
582
+ ]),
583
+ a(B) ? (_(), w("p", St, u(a(B)), 1)) : Se("", !0),
584
+ s("div", $t, [
585
+ n(r, {
586
+ variant: "outline",
587
+ size: "sm",
588
+ onClick: e[2] || (e[2] = (d) => {
589
+ Ie(), O();
590
+ })
591
+ }, {
592
+ default: o(() => [...e[15] || (e[15] = [
593
+ i(" This quarter ", -1)
594
+ ])]),
595
+ _: 1
596
+ }),
597
+ n(r, {
598
+ variant: "outline",
599
+ size: "sm",
600
+ onClick: e[3] || (e[3] = (d) => {
601
+ ze(), O();
602
+ })
603
+ }, {
604
+ default: o(() => [...e[16] || (e[16] = [
605
+ i(" Previous quarter ", -1)
606
+ ])]),
607
+ _: 1
608
+ }),
609
+ n(r, {
610
+ variant: "outline",
611
+ size: "sm",
612
+ onClick: e[4] || (e[4] = (d) => {
613
+ Ne(), O();
614
+ })
615
+ }, {
616
+ default: o(() => [...e[17] || (e[17] = [
617
+ i(" Year to date ", -1)
618
+ ])]),
619
+ _: 1
620
+ })
621
+ ])
622
+ ]),
623
+ _: 1
624
+ })
625
+ ]),
626
+ _: 1
627
+ }),
628
+ a(N) ? (_(), w("div", Ot, [...e[18] || (e[18] = [
629
+ s("div", { class: "animate-spin rounded-full h-8 w-8 border-b-2 border-primary" }, null, -1)
630
+ ])])) : a(R).length === 0 ? (_(), w("div", Tt, [
631
+ n(a($e), { class: "size-12 mx-auto mb-3 opacity-50" }),
632
+ e[19] || (e[19] = s("p", null, "No orders found for this period", -1))
633
+ ])) : (_(), w(H, { key: 2 }, [
634
+ s("div", jt, [
635
+ n(g, null, {
636
+ default: o(() => [
637
+ n(v, { class: "pb-2" }, {
638
+ default: o(() => [
639
+ n(l, { class: "text-sm font-medium text-muted-foreground flex items-center gap-2" }, {
640
+ default: o(() => [
641
+ n(a(ft), { class: "size-4" }),
642
+ e[20] || (e[20] = i(" Money made ", -1))
643
+ ]),
644
+ _: 1
645
+ })
646
+ ]),
647
+ _: 1
648
+ }),
649
+ n(h, null, {
650
+ default: o(() => [
651
+ s("div", Mt, u(f(a(c).netRevenue)), 1),
652
+ s("p", It, u(f(a(c).grossRevenue)) + " gross - " + u(f(a(c).refundAmount)) + " refunds ", 1)
653
+ ]),
654
+ _: 1
655
+ })
656
+ ]),
657
+ _: 1
658
+ }),
659
+ n(g, null, {
660
+ default: o(() => [
661
+ n(v, { class: "pb-2" }, {
662
+ default: o(() => [
663
+ n(l, { class: "text-sm font-medium text-muted-foreground flex items-center gap-2" }, {
664
+ default: o(() => [
665
+ n(a(mt), { class: "size-4" }),
666
+ e[21] || (e[21] = i(" Orders ", -1))
667
+ ]),
668
+ _: 1
669
+ })
670
+ ]),
671
+ _: 1
672
+ }),
673
+ n(h, null, {
674
+ default: o(() => [
675
+ s("div", zt, u(x(a(c).orders)), 1),
676
+ s("p", Nt, u(x(a(c).confirmedOrders)) + " confirmed ", 1)
677
+ ]),
678
+ _: 1
679
+ })
680
+ ]),
681
+ _: 1
682
+ }),
683
+ n(g, null, {
684
+ default: o(() => [
685
+ n(v, { class: "pb-2" }, {
686
+ default: o(() => [
687
+ n(l, { class: "text-sm font-medium text-muted-foreground flex items-center gap-2" }, {
688
+ default: o(() => [
689
+ n(a(Oe), { class: "size-4" }),
690
+ e[22] || (e[22] = i(" Reservations ", -1))
691
+ ]),
692
+ _: 1
693
+ })
694
+ ]),
695
+ _: 1
696
+ }),
697
+ n(h, null, {
698
+ default: o(() => [
699
+ s("div", Pt, u(x(a(c).reservations)), 1),
700
+ s("p", Bt, u(x(a(c).spots)) + " spots booked ", 1)
701
+ ]),
702
+ _: 1
703
+ })
704
+ ]),
705
+ _: 1
706
+ }),
707
+ n(g, null, {
708
+ default: o(() => [
709
+ n(v, { class: "pb-2" }, {
710
+ default: o(() => [
711
+ n(l, { class: "text-sm font-medium text-muted-foreground flex items-center gap-2" }, {
712
+ default: o(() => [
713
+ n(a(pt), { class: "size-4" }),
714
+ e[23] || (e[23] = i(" Refunds ", -1))
715
+ ]),
716
+ _: 1
717
+ })
718
+ ]),
719
+ _: 1
720
+ }),
721
+ n(h, null, {
722
+ default: o(() => [
723
+ s("div", Ut, u(x(a(c).refundCount)), 1),
724
+ s("p", Ft, u(f(a(c).refundAmount)) + " refunded ", 1)
725
+ ]),
726
+ _: 1
727
+ })
728
+ ]),
729
+ _: 1
730
+ })
731
+ ]),
732
+ s("div", Et, [
733
+ n(g, null, {
734
+ default: o(() => [
735
+ n(v, null, {
736
+ default: o(() => [
737
+ n(l, null, {
738
+ default: o(() => [...e[24] || (e[24] = [
739
+ i("Finance", -1)
740
+ ])]),
741
+ _: 1
742
+ }),
743
+ n(p, null, {
744
+ default: o(() => [...e[25] || (e[25] = [
745
+ i("Confirmed orders are counted as revenue.", -1)
746
+ ])]),
747
+ _: 1
748
+ })
749
+ ]),
750
+ _: 1
751
+ }),
752
+ n(h, { class: "space-y-3 text-sm" }, {
753
+ default: o(() => [
754
+ s("div", Lt, [
755
+ e[26] || (e[26] = s("span", { class: "text-muted-foreground" }, "Gross revenue", -1)),
756
+ s("span", Vt, u(f(a(c).grossRevenue)), 1)
757
+ ]),
758
+ s("div", Ht, [
759
+ e[27] || (e[27] = s("span", { class: "text-muted-foreground" }, "Refunds", -1)),
760
+ s("span", qt, u(f(a(c).refundAmount)), 1)
761
+ ]),
762
+ n(y),
763
+ s("div", Yt, [
764
+ e[28] || (e[28] = s("span", { class: "text-muted-foreground" }, "Net revenue", -1)),
765
+ s("span", Gt, u(f(a(c).netRevenue)), 1)
766
+ ]),
767
+ s("div", Qt, [
768
+ e[29] || (e[29] = s("span", { class: "text-muted-foreground" }, "Money collected", -1)),
769
+ s("span", Kt, u(f(a(c).moneyCollected)), 1)
770
+ ]),
771
+ s("div", Jt, [
772
+ e[30] || (e[30] = s("span", { class: "text-muted-foreground" }, "Amount due", -1)),
773
+ s("span", Wt, u(f(a(c).amountDue)), 1)
774
+ ]),
775
+ s("div", Xt, [
776
+ e[31] || (e[31] = s("span", { class: "text-muted-foreground" }, "Pending order value", -1)),
777
+ s("span", Zt, u(f(a(c).pendingRevenue)), 1)
778
+ ]),
779
+ s("div", en, [
780
+ e[32] || (e[32] = s("span", { class: "text-muted-foreground" }, "Cancelled order value", -1)),
781
+ s("span", tn, u(f(a(c).cancelledRevenue)), 1)
782
+ ]),
783
+ s("div", nn, [
784
+ e[33] || (e[33] = s("span", { class: "text-muted-foreground" }, "Average confirmed order", -1)),
785
+ s("span", sn, u(f(a(c).averageOrder)), 1)
786
+ ]),
787
+ s("div", on, [
788
+ e[34] || (e[34] = s("span", { class: "text-muted-foreground" }, "Average reservation", -1)),
789
+ s("span", an, u(f(a(c).averageReservation)), 1)
790
+ ])
791
+ ]),
792
+ _: 1
793
+ })
794
+ ]),
795
+ _: 1
796
+ }),
797
+ n(g, null, {
798
+ default: o(() => [
799
+ n(v, null, {
800
+ default: o(() => [
801
+ n(l, null, {
802
+ default: o(() => [...e[35] || (e[35] = [
803
+ i("Status Breakdown", -1)
804
+ ])]),
805
+ _: 1
806
+ }),
807
+ n(p, null, {
808
+ default: o(() => [...e[36] || (e[36] = [
809
+ i("Orders and reservation lines in this period.", -1)
810
+ ])]),
811
+ _: 1
812
+ })
813
+ ]),
814
+ _: 1
815
+ }),
816
+ n(h, { class: "space-y-5" }, {
817
+ default: o(() => [
818
+ s("div", null, [
819
+ s("div", rn, [
820
+ n(a(gt), { class: "size-4" }),
821
+ e[37] || (e[37] = i(" Orders ", -1))
822
+ ]),
823
+ s("div", ln, [
824
+ (_(!0), w(H, null, ee(a(he), (d) => (_(), w("div", {
825
+ key: d.status,
826
+ class: "flex items-center justify-between gap-4"
827
+ }, [
828
+ s("span", dn, u(Q(d.status)), 1),
829
+ s("span", un, u(x(d.count)) + " · " + u(f(d.revenue)), 1)
830
+ ]))), 128))
831
+ ])
832
+ ]),
833
+ n(y),
834
+ s("div", null, [
835
+ s("div", cn, [
836
+ n(a(Oe), { class: "size-4" }),
837
+ e[38] || (e[38] = i(" Reservations ", -1))
838
+ ]),
839
+ s("div", fn, [
840
+ (_(!0), w(H, null, ee(a(we), (d) => (_(), w("div", {
841
+ key: d.status,
842
+ class: "flex items-center justify-between gap-4"
843
+ }, [
844
+ s("span", mn, u(Q(d.status)), 1),
845
+ s("span", pn, u(x(d.count)) + " · " + u(x(d.spots)) + " spots · " + u(f(d.revenue)), 1)
846
+ ]))), 128))
847
+ ])
848
+ ])
849
+ ]),
850
+ _: 1
851
+ })
852
+ ]),
853
+ _: 1
854
+ })
855
+ ]),
856
+ n(g, { class: "-mx-6 rounded-none border-x-0 @5xl:mx-0 @5xl:rounded-xl @5xl:border-x-[1px]" }, {
857
+ default: o(() => [
858
+ n(v, null, {
859
+ default: o(() => [
860
+ n(l, null, {
861
+ default: o(() => [...e[39] || (e[39] = [
862
+ i("Daily Breakdown", -1)
863
+ ])]),
864
+ _: 1
865
+ }),
866
+ n(p, null, {
867
+ default: o(() => [...e[40] || (e[40] = [
868
+ i("Select a date to review the orders placed that day.", -1)
869
+ ])]),
870
+ _: 1
871
+ })
872
+ ]),
873
+ _: 1
874
+ }),
875
+ n(h, null, {
876
+ default: o(() => [
877
+ s("div", gn, [
878
+ n(Ke, null, {
879
+ default: o(() => [
880
+ n(Ge, null, {
881
+ default: o(() => [
882
+ n(Ce, null, {
883
+ default: o(() => [
884
+ n(L, null, {
885
+ default: o(() => [...e[41] || (e[41] = [
886
+ i("Date", -1)
887
+ ])]),
888
+ _: 1
889
+ }),
890
+ n(L, { class: "text-right" }, {
891
+ default: o(() => [...e[42] || (e[42] = [
892
+ i("Orders", -1)
893
+ ])]),
894
+ _: 1
895
+ }),
896
+ n(L, { class: "text-right" }, {
897
+ default: o(() => [...e[43] || (e[43] = [
898
+ i("Reservations", -1)
899
+ ])]),
900
+ _: 1
901
+ }),
902
+ n(L, { class: "text-right" }, {
903
+ default: o(() => [...e[44] || (e[44] = [
904
+ i("Gross", -1)
905
+ ])]),
906
+ _: 1
907
+ }),
908
+ n(L, { class: "text-right" }, {
909
+ default: o(() => [...e[45] || (e[45] = [
910
+ i("Refunds", -1)
911
+ ])]),
912
+ _: 1
913
+ }),
914
+ n(L, { class: "text-right" }, {
915
+ default: o(() => [...e[46] || (e[46] = [
916
+ i("Net", -1)
917
+ ])]),
918
+ _: 1
919
+ })
920
+ ]),
921
+ _: 1
922
+ })
923
+ ]),
924
+ _: 1
925
+ }),
926
+ n(Qe, null, {
927
+ default: o(() => [
928
+ (_(!0), w(H, null, ee(a(oe), (d) => (_(), te(Ce, {
929
+ key: d.date
930
+ }, {
931
+ default: o(() => [
932
+ n(V, { class: "font-medium" }, {
933
+ default: o(() => [
934
+ d.date !== "Unknown date" ? (_(), w("button", {
935
+ key: 0,
936
+ type: "button",
937
+ class: "inline-flex items-center gap-1 rounded-sm text-left hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
938
+ "aria-label": `View orders placed on ${Re(d.date)}`,
939
+ onClick: (nt) => Ue(d)
940
+ }, [
941
+ i(u(d.date) + " ", 1),
942
+ n(a(Te), { class: "size-3.5 text-muted-foreground" })
943
+ ], 8, vn)) : (_(), w("span", xn, u(d.date), 1))
944
+ ]),
945
+ _: 2
946
+ }, 1024),
947
+ n(V, { class: "text-right" }, {
948
+ default: o(() => [
949
+ i(u(x(d.orders)), 1)
950
+ ]),
951
+ _: 2
952
+ }, 1024),
953
+ n(V, { class: "text-right" }, {
954
+ default: o(() => [
955
+ i(u(x(d.reservations)), 1)
956
+ ]),
957
+ _: 2
958
+ }, 1024),
959
+ n(V, { class: "text-right" }, {
960
+ default: o(() => [
961
+ i(u(f(d.grossRevenue)), 1)
962
+ ]),
963
+ _: 2
964
+ }, 1024),
965
+ n(V, { class: "text-right" }, {
966
+ default: o(() => [
967
+ i(u(f(d.refunds)), 1)
968
+ ]),
969
+ _: 2
970
+ }, 1024),
971
+ n(V, { class: "text-right font-medium" }, {
972
+ default: o(() => [
973
+ i(u(f(d.netRevenue)), 1)
974
+ ]),
975
+ _: 2
976
+ }, 1024)
977
+ ]),
978
+ _: 2
979
+ }, 1024))), 128))
980
+ ]),
981
+ _: 1
982
+ })
983
+ ]),
984
+ _: 1
985
+ })
986
+ ])
987
+ ]),
988
+ _: 1
989
+ })
990
+ ]),
991
+ _: 1
992
+ })
993
+ ], 64))
994
+ ])
995
+ ]),
996
+ _: 1
997
+ }),
998
+ n(tt, {
999
+ open: a(P),
1000
+ "onUpdate:open": Fe
1001
+ }, {
1002
+ default: o(() => [
1003
+ n(et, { class: "sm:max-w-2xl" }, {
1004
+ default: o(() => [
1005
+ n(Xe, null, {
1006
+ default: o(() => [
1007
+ n(Je, null, {
1008
+ default: o(() => [
1009
+ i(u(a(T) ? Re(a(T)) : "Daily orders"), 1)
1010
+ ]),
1011
+ _: 1
1012
+ }),
1013
+ a(X) ? (_(), te(We, { key: 0 }, {
1014
+ default: o(() => [
1015
+ i(u(Z(a(X).orders, "order")) + " placed · " + u(Z(a(X).reservations, "reservation")) + " · " + u(f(a(X).netRevenue)) + " net revenue ", 1)
1016
+ ]),
1017
+ _: 1
1018
+ })) : Se("", !0)
1019
+ ]),
1020
+ _: 1
1021
+ }),
1022
+ s("div", bn, [
1023
+ (_(!0), w(H, null, ee(a(ae), (d) => (_(), w("button", {
1024
+ key: d.id,
1025
+ type: "button",
1026
+ class: de(["flex w-full flex-col items-stretch gap-3 rounded-lg border bg-background p-4 text-left transition-colors hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 sm:flex-row sm:items-center", { "cursor-wait opacity-70": a(I) !== null }]),
1027
+ disabled: !d.id || !d.reservations?.length,
1028
+ "aria-disabled": a(I) !== null,
1029
+ "aria-busy": a(I) === d.id,
1030
+ onClick: (nt) => ke(d.id, !0)
1031
+ }, [
1032
+ s("div", yn, [
1033
+ s("div", hn, [
1034
+ s("span", wn, u(Le(d)), 1),
1035
+ s("span", {
1036
+ class: de(["shrink-0 rounded-full px-2 py-0.5 text-xs font-medium", De(d.status).class])
1037
+ }, u(De(d.status).label), 3)
1038
+ ]),
1039
+ s("div", Rn, [
1040
+ s("span", null, "Order #" + u(d.id.slice(0, 8)), 1),
1041
+ s("span", Dn, [
1042
+ n(a(vt), { class: "size-3.5" }),
1043
+ i(" " + u(Ee(d.createdAt)), 1)
1044
+ ]),
1045
+ s("span", null, u(Z(d.reservations?.length || 0, "reservation")) + " · " + u(Z(Ve(d), "spot")), 1)
1046
+ ])
1047
+ ]),
1048
+ s("div", kn, [
1049
+ s("span", Cn, u(f(z(d))), 1),
1050
+ d.reservations?.length ? a(I) === d.id ? (_(), te(a(xt), {
1051
+ key: 1,
1052
+ class: "size-4 animate-spin text-muted-foreground"
1053
+ })) : (_(), te(a(Te), {
1054
+ key: 2,
1055
+ class: "size-4 text-muted-foreground"
1056
+ })) : (_(), w("span", An, "No details"))
1057
+ ])
1058
+ ], 10, _n))), 128))
1059
+ ]),
1060
+ n(Ze, null, {
1061
+ default: o(() => [
1062
+ n(r, {
1063
+ variant: "outline",
1064
+ onClick: re
1065
+ }, {
1066
+ default: o(() => [...e[47] || (e[47] = [
1067
+ i("Close", -1)
1068
+ ])]),
1069
+ _: 1
1070
+ })
1071
+ ]),
1072
+ _: 1
1073
+ })
1074
+ ]),
1075
+ _: 1
1076
+ })
1077
+ ]),
1078
+ _: 1
1079
+ }, 8, ["open"]),
1080
+ n(_t, {
1081
+ ref_key: "reservationDetailDialog",
1082
+ ref: pe,
1083
+ "agenda-data": a(W),
1084
+ resources: a(q),
1085
+ "show-order-link": "",
1086
+ onCancelled: O,
1087
+ onConfirmed: O,
1088
+ onRejected: O,
1089
+ onTransferred: O,
1090
+ onOpenOrder: e[5] || (e[5] = (d) => ke(d)),
1091
+ onClosed: K
1092
+ }, null, 8, ["agenda-data", "resources"]),
1093
+ n(yt, {
1094
+ ref_key: "orderDetailDialog",
1095
+ ref: me,
1096
+ "agenda-data": a(W),
1097
+ resources: a(q),
1098
+ onOpenReservation: e[6] || (e[6] = (d) => qe(d)),
1099
+ onClosed: K
1100
+ }, null, 8, ["agenda-data", "resources"])
1101
+ ], 64);
1102
+ };
1103
+ }
1104
+ });
1105
+ export {
1106
+ Nn as default
1107
+ };