@oneclick.dev/cms-core-modules 0.0.115 → 0.0.117

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 (107) hide show
  1. package/dist/{Acquisition-FV3QpaUX.mjs → Acquisition-X5-eksDw.mjs} +2 -2
  2. package/dist/{Audience-ka0b7YPE.mjs → Audience-CXryJ8tc.mjs} +2 -2
  3. package/dist/{ContentEditor-C5yNNLeV.mjs → ContentEditor-CUe6-NwF.mjs} +17650 -14456
  4. package/dist/{ContentEditor-MctMvN7D.js → ContentEditor-DWoXc0T_.js} +52 -52
  5. package/dist/{Create-BXNLRQag.mjs → Create-BPA2ywrd.mjs} +1 -1
  6. package/dist/{DateFormatter-qbhRYxI_.mjs → DateFormatter-BkKoSf_l.mjs} +5 -5
  7. package/dist/{Detail-BCOcP2ql.mjs → Detail-C1Blq61w.mjs} +1 -1
  8. package/dist/{Detail-ChD5XurA.mjs → Detail-CfsPwl4s.mjs} +17 -17
  9. package/dist/{Detail-DnX7tsqN.mjs → Detail-CtItxMX4.mjs} +1 -1
  10. package/dist/{Detail-Btzwo0Y3.mjs → Detail-Dnpnmy4-.mjs} +1 -1
  11. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-gozJKXvM.js +1 -0
  12. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-pDO9b4Pv.mjs +77 -0
  13. package/dist/{Find-zN_dKz4p.mjs → Find-BAvaNf90.mjs} +1 -1
  14. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BXTkYCm_.mjs +1476 -0
  15. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-C2zwt5UF.js +1 -0
  16. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-BYSeUW_V.js +925 -0
  17. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-DwAUYR8p.mjs +5021 -0
  18. package/dist/{Overview-BR_y8x3W.mjs → Overview-BWLxUksJ.mjs} +1 -1
  19. package/dist/{Overview-MpgkLB6m.mjs → Overview-Bjvu9Lfc.mjs} +3 -3
  20. package/dist/Overview-CBahJviK.js +1 -0
  21. package/dist/Overview-CVQ1pkuD.mjs +527 -0
  22. package/dist/{SeoHealth-bVQj_Xgm.mjs → SeoHealth-I2mqiuLm.mjs} +3 -3
  23. package/dist/TableView-BQI3CWll.mjs +6234 -0
  24. package/dist/TableView-Cwal0BPW.js +4 -0
  25. package/dist/agenda-B3nj388v.mjs +1253 -0
  26. package/dist/agenda-Bev1mO7E.js +1 -0
  27. package/dist/availability-ClBGVgE9.js +1 -0
  28. package/dist/availability-D8JdA4rP.mjs +274 -0
  29. package/dist/booking-data-Px7XCIfU.mjs +1024 -0
  30. package/dist/booking-data-aMS1p_3g.js +1 -0
  31. package/dist/cms-core-modules.css +1 -1
  32. package/dist/exceptions-DXqc0Nza.js +1 -0
  33. package/dist/exceptions-Dgj54ULn.mjs +651 -0
  34. package/dist/{index-DZV720u-.mjs → index-52nwosIs.mjs} +45 -45
  35. package/dist/{index-CkVwMqpn.mjs → index-Bnn9LahC.mjs} +52 -52
  36. package/dist/{index-B8GvmAwh.mjs → index-DiTIA8Sh.mjs} +27 -27
  37. package/dist/index-Djp4EBb0.mjs +1245 -0
  38. package/dist/index-DliTZzwI.js +35 -0
  39. package/dist/{index-L54VBzwJ.mjs → index-ar4tbR3i.mjs} +8 -8
  40. package/dist/{index-BIF2RB7k.mjs → index-cC_2cw31.mjs} +4 -4
  41. package/dist/{index-CFzn2Lus.mjs → index-hMp4p5qA.mjs} +3 -3
  42. package/dist/index.cjs.js +1 -1
  43. package/dist/index.mjs +26 -25
  44. package/dist/{math-BJ-oX_IM.mjs → math-Bkw6u412.mjs} +11 -11
  45. package/dist/orders-1swJVKw2.js +1 -0
  46. package/dist/orders-D41GbzIa.mjs +624 -0
  47. package/dist/payment-BJHgpaeT.js +1 -0
  48. package/dist/payment-D5j-68Ig.mjs +1278 -0
  49. package/dist/refunds-D9nTeD2d.mjs +436 -0
  50. package/dist/refunds-oVB2Opib.js +1 -0
  51. package/dist/resources-8WouFvJe.js +1 -0
  52. package/dist/resources-CK0oWssj.mjs +975 -0
  53. package/dist/server-handlers.cjs.js +1 -1
  54. package/dist/server-handlers.mjs +626 -515
  55. package/dist/src/appointments/components/edit/EventDialog/BookingsList.vue.d.ts +146 -5
  56. package/dist/src/appointments/components/edit/EventDialog/CancelRefundReservationDialog.vue.d.ts +33 -0
  57. package/dist/src/appointments/components/edit/EventDialog/OrderDetailDialog.vue.d.ts +26 -8
  58. package/dist/src/appointments/components/edit/EventDialog/RefundDetailsDisplay.vue.d.ts +8 -0
  59. package/dist/src/appointments/components/edit/EventDialog/ReservationDetailDialog.vue.d.ts +91 -5
  60. package/dist/src/appointments/components/edit/EventDialog/TransferReservationDialog.vue.d.ts +20 -3
  61. package/dist/src/appointments/components/edit/NewReservationDialog/ReservationLines.vue.d.ts +5 -0
  62. package/dist/src/appointments/components/edit/OrderMetadataDisplay.vue.d.ts +20 -2
  63. package/dist/src/appointments/components/edit/dashboard/BookingsList.vue.d.ts +240 -0
  64. package/dist/src/appointments/composables/useAgendaMetadataSchema.d.ts +37 -0
  65. package/dist/src/appointments/pages/edit/orders.vue.d.ts +225 -0
  66. package/dist/src/appointments/pages/edit/refunds.vue.d.ts +2 -0
  67. package/dist/src/appointments/server.d.ts +2 -0
  68. package/dist/src/appointments/types.d.ts +6 -0
  69. package/dist/src/appointments/utils/printReservation.d.ts +65 -3
  70. package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/Table.d.ts +36 -0
  71. package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/Table.vue.d.ts +95 -0
  72. package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/TableCell.d.ts +13 -0
  73. package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/TableHeader.d.ts +6 -0
  74. package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/TableRow.d.ts +6 -0
  75. package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/index.d.ts +4 -0
  76. package/dist/src/contentManager/components/content-editor/tiptap-menus/element-editor-views/TableMenu.vue.d.ts +13 -0
  77. package/dist/src/contentManager/components/content-editor/tiptap-menus/element-editor-views/index.d.ts +14 -0
  78. package/dist/{vee-validate-zod-DNjTLCgh.mjs → vee-validate-zod-CcOwoF6y.mjs} +6 -6
  79. package/package.json +2 -2
  80. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-DWMqQvHl.mjs +0 -76
  81. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-kpjbVSXg.js +0 -1
  82. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-Baqy-rTT.js +0 -1
  83. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-Dx4Bpa2m.mjs +0 -1263
  84. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-COrK1j0S.js +0 -1
  85. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-Vb3q8EVv.mjs +0 -330
  86. package/dist/Overview-98nkJUWN.mjs +0 -481
  87. package/dist/Overview-Dl8cMlsr.js +0 -1
  88. package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-CuwREvXD.js +0 -349
  89. package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-GYNZ_yhD.mjs +0 -3077
  90. package/dist/TableView-CVfkyj1k.js +0 -4
  91. package/dist/TableView-zDx0IegJ.mjs +0 -6096
  92. package/dist/agenda-BaJu3-1c.js +0 -1
  93. package/dist/agenda-BwVY_8oM.mjs +0 -1165
  94. package/dist/availability-CMrRa5y2.mjs +0 -269
  95. package/dist/availability-Cf2YfMwM.js +0 -1
  96. package/dist/booking-data-DgJd0BcM.mjs +0 -889
  97. package/dist/booking-data-Di5GmH_8.js +0 -1
  98. package/dist/exceptions-B6P9UiCj.js +0 -1
  99. package/dist/exceptions-De9-FvdP.mjs +0 -646
  100. package/dist/index-DL6orwdK.js +0 -35
  101. package/dist/index-hH3e-IYz.mjs +0 -1187
  102. package/dist/orders-C65SlpJy.mjs +0 -618
  103. package/dist/orders-XVzWAgG1.js +0 -1
  104. package/dist/payment-C3ohkehF.mjs +0 -1080
  105. package/dist/payment-Dfr-Ro-a.js +0 -1
  106. package/dist/resources-CxeFd57z.js +0 -1
  107. package/dist/resources-DwYxn2Vi.mjs +0 -811
@@ -0,0 +1,624 @@
1
+ import { defineComponent as ke, computed as k, ref as _, provide as be, onMounted as we, watch as te, resolveComponent as b, openBlock as o, createElementBlock as l, Fragment as N, createVNode as r, withCtx as v, createElementVNode as a, unref as n, createTextVNode as w, renderList as L, toDisplayString as i, createBlock as se, createCommentVNode as D, normalizeClass as De, withDirectives as Ce, isRef as ae, vModelText as Ie, normalizeStyle as ne, nextTick as Se } from "vue";
2
+ import { useRoute as Pe, useRouter as Ae, useOverlayParams as Ne, useModuleRoute as ze, useModule as Oe, useFirebaseIntegration as Te } from "@oneclick.dev/cms-kit";
3
+ import { ShoppingBag as oe, Users as E, ChevronLeft as je, ChevronRight as Re, RefreshCw as Fe, CalendarIcon as H, Search as Be, X as $e, Clock as re } from "lucide-vue-next";
4
+ import { u as Me, F as Ve, _ as q, a as Ue, b as Le } from "./OrderDetailDialog.vue_vue_type_script_setup_true_lang-DwAUYR8p.mjs";
5
+ import { _ as Ee } from "./EditLayout.vue_vue_type_script_setup_true_lang-pDO9b4Pv.mjs";
6
+ import { _ as He } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
7
+ const qe = { class: "space-y-6" }, Ye = { class: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4" }, Qe = { class: "text-2xl font-semibold tracking-tight flex items-center gap-2" }, Xe = { class: "flex gap-1 border rounded-lg p-1 w-fit" }, Ge = { class: "flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4" }, Je = { class: "flex items-center gap-1" }, Ke = { class: "flex items-center gap-1" }, We = { class: "flex items-center gap-2" }, Ze = { class: "flex items-center gap-1" }, et = { class: "mt-2 text-sm text-muted-foreground" }, tt = { class: "orders-date-trigger" }, st = { class: "relative mb-4" }, at = {
8
+ key: 0,
9
+ class: "mb-3 text-sm text-muted-foreground"
10
+ }, nt = {
11
+ key: 1,
12
+ class: "flex items-center justify-center py-8"
13
+ }, ot = {
14
+ key: 2,
15
+ class: "text-center py-8 text-muted-foreground"
16
+ }, rt = {
17
+ key: 3,
18
+ class: "text-center py-8 text-muted-foreground"
19
+ }, lt = {
20
+ key: 4,
21
+ class: "space-y-2"
22
+ }, it = ["onClick"], dt = { class: "flex items-start justify-between" }, ct = { class: "flex-1" }, ut = { class: "font-medium" }, mt = { class: "text-sm text-muted-foreground" }, ft = { class: "text-sm text-muted-foreground" }, vt = { class: "flex items-center gap-4 flex-wrap mt-1" }, pt = { class: "flex items-center gap-2 text-xs text-muted-foreground" }, xt = { class: "flex items-center gap-2 text-xs text-muted-foreground" }, gt = {
23
+ key: 0,
24
+ class: "flex items-center gap-1 text-xs text-muted-foreground"
25
+ }, _t = { class: "flex items-center gap-2 mt-1 text-xs text-muted-foreground" }, yt = { class: "text-right" }, ht = {
26
+ key: 0,
27
+ 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"
28
+ }, kt = {
29
+ key: 1,
30
+ 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"
31
+ }, bt = {
32
+ key: 2,
33
+ 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"
34
+ }, wt = {
35
+ key: 3,
36
+ 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"
37
+ }, Dt = {
38
+ key: 4,
39
+ 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"
40
+ }, Ct = {
41
+ key: 5,
42
+ 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"
43
+ }, It = {
44
+ key: 6,
45
+ 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"
46
+ }, St = {
47
+ key: 7,
48
+ class: "text-sm font-medium mt-1"
49
+ }, Pt = ["onClick"], At = { class: "flex items-start justify-between" }, Nt = { class: "flex-1" }, zt = { class: "flex items-center gap-2" }, Ot = { class: "font-medium" }, Tt = { class: "text-sm text-muted-foreground" }, jt = { class: "text-sm text-muted-foreground" }, Rt = { class: "flex items-center gap-2 mt-1 text-xs text-muted-foreground" }, Ft = { class: "text-right" }, Bt = {
50
+ key: 0,
51
+ 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"
52
+ }, $t = {
53
+ key: 1,
54
+ 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"
55
+ }, Mt = {
56
+ key: 2,
57
+ 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"
58
+ }, Vt = { class: "text-sm font-medium mt-1" }, Ut = ["onClick"], Lt = { class: "flex items-center justify-between" }, Et = { class: "flex items-center gap-4 flex-wrap" }, Ht = { class: "flex items-center gap-2 text-xs text-muted-foreground" }, qt = { class: "flex items-center gap-2 text-xs text-muted-foreground" }, Yt = {
59
+ key: 0,
60
+ class: "flex items-center gap-1 text-xs text-muted-foreground"
61
+ }, Qt = {
62
+ key: 0,
63
+ class: "text-right flex items-center gap-2"
64
+ }, Xt = {
65
+ key: 0,
66
+ 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"
67
+ }, Gt = {
68
+ key: 1,
69
+ 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"
70
+ }, Jt = {
71
+ key: 2,
72
+ 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"
73
+ }, Kt = {
74
+ key: 3,
75
+ 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"
76
+ }, Wt = {
77
+ key: 4,
78
+ 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"
79
+ }, Zt = {
80
+ key: 5,
81
+ class: "text-sm font-medium"
82
+ }, es = /* @__PURE__ */ ke({
83
+ __name: "orders",
84
+ setup(ts) {
85
+ const Y = Pe();
86
+ Ae();
87
+ const Q = Ne(), { params: T } = ze(), { config: z } = Oe(), j = Te(z.project), X = k(() => T.value?.id ?? T.id ?? ""), { metadataSchema: R } = Me(X), x = _([]), S = _([]), P = _(!0), F = _(null), y = _(""), A = _(null), B = _(null), I = _("confirmed"), C = /* @__PURE__ */ new Date(), m = _(/* @__PURE__ */ new Date()), G = _(null), le = k(() => ({
88
+ date: J(m.value),
89
+ resource: null
90
+ }));
91
+ be("event", le);
92
+ const $ = k({
93
+ get: () => J(m.value),
94
+ set: (t) => {
95
+ if (!t) {
96
+ m.value = /* @__PURE__ */ new Date();
97
+ return;
98
+ }
99
+ m.value = /* @__PURE__ */ new Date(`${t}T00:00:00`);
100
+ }
101
+ }), ie = () => {
102
+ const t = G.value;
103
+ if (t) {
104
+ if (typeof t.showPicker == "function") {
105
+ t.showPicker();
106
+ return;
107
+ }
108
+ t.focus(), t.click();
109
+ }
110
+ }, de = k(() => {
111
+ const t = new Date(C);
112
+ t.setDate(C.getDate() - 1);
113
+ const e = new Date(C);
114
+ return e.setDate(C.getDate() + 1), m.value.toDateString() === C.toDateString() ? "Today" : m.value.toDateString() === t.toDateString() ? "Yesterday" : m.value.toDateString() === e.toDateString() ? "Tomorrow" : m.value.toLocaleDateString("en-US", {
115
+ weekday: "long",
116
+ month: "long",
117
+ day: "numeric",
118
+ year: "numeric"
119
+ });
120
+ }), ce = () => {
121
+ const t = new Date(m.value);
122
+ t.setDate(t.getDate() - 1), m.value = t;
123
+ }, ue = () => {
124
+ const t = new Date(m.value);
125
+ t.setDate(t.getDate() + 1), t <= C && (m.value = t);
126
+ }, me = k(() => {
127
+ const t = new Date(m.value);
128
+ return t.setDate(t.getDate() + 1), t <= C;
129
+ }), fe = () => {
130
+ m.value = /* @__PURE__ */ new Date();
131
+ }, J = (t) => {
132
+ const e = t.getFullYear(), d = String(t.getMonth() + 1).padStart(2, "0"), u = String(t.getDate()).padStart(2, "0");
133
+ return `${e}-${d}-${u}`;
134
+ }, K = (t) => t ? new Date(t).toLocaleTimeString("en-US", {
135
+ hour: "2-digit",
136
+ minute: "2-digit",
137
+ hour12: !1
138
+ }) : "", W = (t) => t ? new Date(t).toLocaleDateString("en-US", {
139
+ weekday: "short",
140
+ month: "short",
141
+ day: "numeric"
142
+ }) : "", Z = (t, e) => {
143
+ const d = S.value.find((p) => p.id === e.resourceId), u = t.id || t.orderId || e.orderId || "";
144
+ return {
145
+ customerInfo: t.customerInfo,
146
+ amountDue: t.amountDue,
147
+ amountPaid: t.amountPaid,
148
+ status: t.status,
149
+ reservationStatus: e.status,
150
+ subtotal: t.subtotal,
151
+ total: t.total,
152
+ discount: t.discount,
153
+ id: u,
154
+ res_id: e.id,
155
+ resourceId: e.resourceId,
156
+ spots: e.spots,
157
+ date: e.date,
158
+ createdAt: t.createdAt,
159
+ startTime: e.timeslot?.startTime,
160
+ endTime: e.timeslot?.endTime,
161
+ reservationPrice: e.totalPrice,
162
+ reservationBasePrice: e.basePrice,
163
+ reservationAddOnsPrice: e.addOnsPrice,
164
+ pricingOptionId: e.pricingOptionId,
165
+ pricingOption: e.pricingOption,
166
+ resourceName: d?.name,
167
+ resourceColor: d?.color,
168
+ metadata: t.metadata || {},
169
+ reservationMetadata: e.metadata || {},
170
+ refundStatus: e.refundStatus,
171
+ refundedAt: e.refundedAt,
172
+ refundedAmount: e.refundedAmount,
173
+ refunds: Array.isArray(e.refunds) ? e.refunds : [],
174
+ adjustments: t.adjustments || [],
175
+ reservationAdjustments: e.adjustments || []
176
+ };
177
+ }, M = async () => {
178
+ await Se(), await new Promise((t) => {
179
+ if (typeof requestAnimationFrame == "function") {
180
+ requestAnimationFrame(() => t());
181
+ return;
182
+ }
183
+ t();
184
+ });
185
+ }, V = k(() => y.value.trim() ? new Ve(x.value, {
186
+ keys: [
187
+ "customerInfo.firstName",
188
+ "customerInfo.lastName",
189
+ "customerInfo.email",
190
+ "customerInfo.phone",
191
+ "resourceName"
192
+ ],
193
+ threshold: 0.3,
194
+ ignoreLocation: !0
195
+ }).search(y.value).map((e) => e.item) : x.value), ve = k(() => {
196
+ const t = /* @__PURE__ */ new Map();
197
+ for (const e of V.value) {
198
+ t.has(e.id) || t.set(e.id, {
199
+ id: e.id,
200
+ customerInfo: e.customerInfo,
201
+ status: e.status,
202
+ createdAt: e.createdAt,
203
+ metadata: e.metadata || {},
204
+ reservations: [],
205
+ adjustments: e.adjustments || [],
206
+ totalPrice: 0,
207
+ totalSpots: 0
208
+ });
209
+ const d = t.get(e.id);
210
+ d.reservations.push(e), d.totalPrice = typeof e.total == "number" ? e.total : d.totalPrice + (e.reservationPrice || 0), d.totalSpots += e.spots || 0;
211
+ }
212
+ return Array.from(t.values());
213
+ }), O = k(() => ({
214
+ spots: x.value.reduce((t, e) => t + (e.spots || 0), 0),
215
+ bookings: x.value.length,
216
+ revenue: x.value.reduce((t, e) => t + (e.reservationPrice || 0), 0)
217
+ })), pe = () => {
218
+ y.value = "";
219
+ }, xe = async () => {
220
+ try {
221
+ const t = await j.get(z.agendaCollection, X.value);
222
+ F.value = t, S.value = t?.resources?.filter((e) => e.isActive) || [];
223
+ } catch (t) {
224
+ console.error("Error loading resources:", t), S.value = [];
225
+ }
226
+ }, h = async () => {
227
+ P.value = !0, x.value = [];
228
+ try {
229
+ const t = T.value.id, e = new Date(m.value);
230
+ e.setHours(0, 0, 0, 0);
231
+ const d = new Date(m.value);
232
+ d.setHours(23, 59, 59, 999);
233
+ const u = await j.find(z.reservationsCollection, {
234
+ filters: [
235
+ { field: "agendaId", operator: "==", value: t },
236
+ { field: "createdAt", operator: ">=", value: e.toISOString() },
237
+ { field: "createdAt", operator: "<=", value: d.toISOString() },
238
+ { field: "status", operator: "==", value: I.value }
239
+ ]
240
+ });
241
+ let p = [];
242
+ u.forEach((f) => {
243
+ (f.reservations || []).forEach((U) => {
244
+ p.push(Z(f, U));
245
+ });
246
+ }), x.value = p.sort((f, g) => (g.createdAt || "").localeCompare(f.createdAt || ""));
247
+ } catch (t) {
248
+ console.error("Error loading orders:", t), x.value = [];
249
+ } finally {
250
+ P.value = !1;
251
+ }
252
+ }, ge = async () => {
253
+ await xe(), await h();
254
+ }, ee = async (t, e) => {
255
+ const d = await j.get(z.reservationsCollection, t);
256
+ if (!d) return;
257
+ const u = { ...d, id: d.id || t }, p = (u.reservations || []).map((f) => Z(u, f));
258
+ if (e) {
259
+ const f = p.find((g) => g.res_id === e);
260
+ if (!f) return;
261
+ await M(), A.value?.openDialog(f);
262
+ return;
263
+ }
264
+ p.length && (await M(), B.value?.openDialog({
265
+ id: u.id,
266
+ customerInfo: u.customerInfo,
267
+ status: u.status,
268
+ createdAt: u.createdAt,
269
+ metadata: u.metadata || {},
270
+ reservations: p,
271
+ adjustments: u.adjustments || [],
272
+ totalPrice: typeof u.total == "number" ? u.total : p.reduce((f, g) => f + (g.reservationPrice || 0), 0),
273
+ totalSpots: p.reduce((f, g) => f + (g.spots || 0), 0)
274
+ }));
275
+ }, _e = async (t) => {
276
+ await M(), A.value?.openDialog(t);
277
+ };
278
+ return ge(), we(async () => {
279
+ const t = Q.value.orderId || Y.query.orderId, e = Q.value.reservationId || Y.query.reservationId;
280
+ if (t) {
281
+ const d = new URL(window.location.href);
282
+ d.searchParams.delete("orderId"), d.searchParams.delete("reservationId"), window.history.replaceState(window.history.state, "", d.toString()), await ee(t, e);
283
+ }
284
+ }), te(m, () => {
285
+ h();
286
+ }), te(I, () => {
287
+ h();
288
+ }), (t, e) => {
289
+ const d = b("Button"), u = b("Badge"), p = b("CardTitle"), f = b("CardDescription"), g = b("CardHeader"), U = b("Input"), ye = b("CardContent"), he = b("Card");
290
+ return o(), l(N, null, [
291
+ r(Ee, null, {
292
+ default: v(() => [
293
+ a("div", qe, [
294
+ a("div", Ye, [
295
+ a("div", null, [
296
+ a("h1", Qe, [
297
+ r(n(oe), { class: "size-6" }),
298
+ e[4] || (e[4] = w(" Orders ", -1))
299
+ ]),
300
+ e[5] || (e[5] = a("p", { class: "text-muted-foreground text-sm mt-1" }, " View orders by when they were placed ", -1))
301
+ ])
302
+ ]),
303
+ a("div", Xe, [
304
+ (o(), l(N, null, L(["confirmed", "pending", "cancelled"], (s) => r(d, {
305
+ key: s,
306
+ variant: n(I) === s ? "default" : "ghost",
307
+ size: "sm",
308
+ class: "capitalize",
309
+ onClick: (c) => I.value = s
310
+ }, {
311
+ default: v(() => [
312
+ w(i(s), 1)
313
+ ]),
314
+ _: 2
315
+ }, 1032, ["variant", "onClick"])), 64))
316
+ ]),
317
+ r(he, null, {
318
+ default: v(() => [
319
+ r(g, null, {
320
+ default: v(() => [
321
+ a("div", Ge, [
322
+ a("div", null, [
323
+ r(p, { class: "flex items-center gap-2" }, {
324
+ default: v(() => [
325
+ e[6] || (e[6] = w(" Orders received ", -1)),
326
+ n(O).bookings > 0 ? (o(), se(u, {
327
+ key: 0,
328
+ variant: "secondary"
329
+ }, {
330
+ default: v(() => [
331
+ w(i(n(O).bookings), 1)
332
+ ]),
333
+ _: 1
334
+ })) : D("", !0)
335
+ ]),
336
+ _: 1
337
+ }),
338
+ r(f, { class: "flex items-center gap-4 mt-1" }, {
339
+ default: v(() => [
340
+ a("span", Je, [
341
+ r(n(E), { size: 14 }),
342
+ w(" " + i(n(O).spots) + " spots ", 1)
343
+ ]),
344
+ a("span", Ke, " €" + i(n(O).revenue.toFixed(2)) + i(n(I) === "pending" ? " pending " : n(I) === "cancelled" ? " cancelled " : " ") + "revenue ", 1)
345
+ ]),
346
+ _: 1
347
+ })
348
+ ]),
349
+ a("div", We, [
350
+ a("div", Ze, [
351
+ r(d, {
352
+ variant: "outline",
353
+ size: "icon",
354
+ class: "size-8",
355
+ onClick: ce
356
+ }, {
357
+ default: v(() => [
358
+ r(n(je), { size: 16 })
359
+ ]),
360
+ _: 1
361
+ }),
362
+ r(d, {
363
+ variant: "outline",
364
+ size: "sm",
365
+ class: "h-8 px-3 text-xs",
366
+ onClick: fe
367
+ }, {
368
+ default: v(() => [...e[7] || (e[7] = [
369
+ w(" Today ", -1)
370
+ ])]),
371
+ _: 1
372
+ }),
373
+ r(d, {
374
+ variant: "outline",
375
+ size: "icon",
376
+ class: "size-8",
377
+ onClick: ue,
378
+ disabled: !n(me)
379
+ }, {
380
+ default: v(() => [
381
+ r(n(Re), { size: 16 })
382
+ ]),
383
+ _: 1
384
+ }, 8, ["disabled"])
385
+ ]),
386
+ r(d, {
387
+ variant: "outline",
388
+ size: "icon",
389
+ onClick: h,
390
+ disabled: n(P)
391
+ }, {
392
+ default: v(() => [
393
+ r(n(Fe), {
394
+ size: 16,
395
+ class: De({ "animate-spin": n(P) })
396
+ }, null, 8, ["class"])
397
+ ]),
398
+ _: 1
399
+ }, 8, ["disabled"])
400
+ ])
401
+ ]),
402
+ a("div", et, [
403
+ a("div", tt, [
404
+ r(d, {
405
+ type: "button",
406
+ variant: "outline",
407
+ onClick: ie
408
+ }, {
409
+ default: v(() => [
410
+ r(n(H), { class: "size-4" }),
411
+ w(" " + i(n(de)), 1)
412
+ ]),
413
+ _: 1
414
+ }),
415
+ Ce(a("input", {
416
+ ref_key: "dateInputRef",
417
+ ref: G,
418
+ "onUpdate:modelValue": e[0] || (e[0] = (s) => ae($) ? $.value = s : null),
419
+ type: "date",
420
+ class: "orders-date-picker",
421
+ "aria-label": "Select order date"
422
+ }, null, 512), [
423
+ [Ie, n($)]
424
+ ])
425
+ ])
426
+ ])
427
+ ]),
428
+ _: 1
429
+ }),
430
+ r(ye, null, {
431
+ default: v(() => [
432
+ a("div", st, [
433
+ r(n(Be), {
434
+ size: 16,
435
+ class: "absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"
436
+ }),
437
+ r(U, {
438
+ modelValue: n(y),
439
+ "onUpdate:modelValue": e[1] || (e[1] = (s) => ae(y) ? y.value = s : null),
440
+ placeholder: "Search by name, email, or phone...",
441
+ class: "pl-9 pr-9"
442
+ }, null, 8, ["modelValue"]),
443
+ n(y) ? (o(), se(d, {
444
+ key: 0,
445
+ variant: "ghost",
446
+ size: "icon",
447
+ class: "absolute right-1 top-1/2 -translate-y-1/2 h-7 w-7",
448
+ onClick: pe
449
+ }, {
450
+ default: v(() => [
451
+ r(n($e), { size: 14 })
452
+ ]),
453
+ _: 1
454
+ })) : D("", !0)
455
+ ]),
456
+ n(y) ? (o(), l("div", at, " Showing " + i(n(V).length) + " of " + i(n(x).length) + " orders ", 1)) : D("", !0),
457
+ n(P) ? (o(), l("div", nt, [...e[8] || (e[8] = [
458
+ a("div", { class: "animate-spin rounded-full h-8 w-8 border-b-2 border-primary" }, null, -1)
459
+ ])])) : n(x).length === 0 ? (o(), l("div", ot, [
460
+ r(n(oe), { class: "size-12 mx-auto mb-3 opacity-50" }),
461
+ e[9] || (e[9] = a("p", null, "No orders received on this day", -1))
462
+ ])) : n(V).length === 0 ? (o(), l("div", rt, " No orders match your search ")) : (o(), l("div", lt, [
463
+ (o(!0), l(N, null, L(n(ve), (s) => (o(), l("div", {
464
+ key: s.id,
465
+ class: "border rounded-lg overflow-hidden shadow-sm"
466
+ }, [
467
+ s.reservations.length === 1 ? (o(), l("div", {
468
+ key: 0,
469
+ class: "p-3 hover:bg-muted/50 transition-colors cursor-pointer",
470
+ onClick: (c) => n(A)?.openDialog(s.reservations[0])
471
+ }, [
472
+ a("div", dt, [
473
+ a("div", ct, [
474
+ a("div", ut, i(s.customerInfo?.firstName || s.customerInfo?.lastName ? [s.customerInfo?.firstName, s.customerInfo?.lastName].filter(Boolean).join(" ") : "Unknown Customer"), 1),
475
+ a("div", mt, i(s.customerInfo?.email), 1),
476
+ a("div", ft, i(s.customerInfo?.phone), 1),
477
+ a("div", vt, [
478
+ a("div", pt, [
479
+ r(n(H), { size: 12 }),
480
+ a("span", null, i(W(s.reservations[0].date)) + " · " + i(s.reservations[0].startTime) + " - " + i(s.reservations[0].endTime), 1)
481
+ ]),
482
+ a("div", xt, [
483
+ r(n(E), { size: 12 }),
484
+ a("span", null, i(s.reservations[0].spots) + " spots", 1)
485
+ ]),
486
+ s.reservations[0].resourceName ? (o(), l("div", gt, [
487
+ a("div", {
488
+ class: "w-3 h-3 rounded-full",
489
+ style: ne({ backgroundColor: s.reservations[0].resourceColor || "#6b7280" })
490
+ }, null, 4),
491
+ a("span", null, i(s.reservations[0].resourceName), 1)
492
+ ])) : D("", !0)
493
+ ]),
494
+ a("div", _t, [
495
+ r(n(re), { size: 12 }),
496
+ a("span", null, "Ordered at " + i(K(s.createdAt)), 1)
497
+ ]),
498
+ r(q, {
499
+ metadata: { ...s.reservations[0].metadata, ...s.reservations[0].reservationMetadata },
500
+ schema: n(R),
501
+ "display-filter": ["highlight", "badge"],
502
+ compact: "",
503
+ class: "mt-1"
504
+ }, null, 8, ["metadata", "schema"])
505
+ ]),
506
+ a("div", yt, [
507
+ s.reservations[0].status === "pending" ? (o(), l("span", ht, "Pending")) : s.reservations[0].status === "cancelled" ? (o(), l("span", kt, "Cancelled")) : s.reservations[0].reservationStatus === "needs_approval" ? (o(), l("span", bt, "Needs Approval")) : s.reservations[0].reservationStatus === "approved" ? (o(), l("span", wt, "Approved")) : s.reservations[0].reservationStatus === "cancelled" ? (o(), l("span", Dt, "Cancelled")) : s.reservations[0].reservationStatus === "rejected" ? (o(), l("span", Ct, "Rejected")) : (o(), l("span", It, "Pending")),
508
+ s.reservations[0].reservationPrice || s.reservations[0].reservationPrice === 0 ? (o(), l("div", St, " €" + i(s.reservations[0].reservationPrice.toFixed(2)), 1)) : D("", !0)
509
+ ])
510
+ ])
511
+ ], 8, it)) : (o(), l(N, { key: 1 }, [
512
+ a("div", {
513
+ class: "p-3 bg-muted/30 hover:bg-muted/50 transition-colors cursor-pointer",
514
+ onClick: (c) => n(B)?.openDialog(s)
515
+ }, [
516
+ a("div", At, [
517
+ a("div", Nt, [
518
+ a("div", zt, [
519
+ a("div", Ot, i(s.customerInfo?.firstName || s.customerInfo?.lastName ? [s.customerInfo?.firstName, s.customerInfo?.lastName].filter(Boolean).join(" ") : "Unknown Customer"), 1),
520
+ r(u, {
521
+ variant: "secondary",
522
+ class: "text-xs"
523
+ }, {
524
+ default: v(() => [
525
+ w(i(s.reservations.length) + " reservations ", 1)
526
+ ]),
527
+ _: 2
528
+ }, 1024)
529
+ ]),
530
+ a("div", Tt, i(s.customerInfo?.email), 1),
531
+ a("div", jt, i(s.customerInfo?.phone), 1),
532
+ a("div", Rt, [
533
+ r(n(re), { size: 12 }),
534
+ a("span", null, "Ordered at " + i(K(s.createdAt)), 1)
535
+ ]),
536
+ r(q, {
537
+ metadata: s.metadata,
538
+ schema: n(R),
539
+ "display-filter": ["highlight", "badge"],
540
+ compact: "",
541
+ class: "mt-1"
542
+ }, null, 8, ["metadata", "schema"])
543
+ ]),
544
+ a("div", Ft, [
545
+ s.status === "pending" ? (o(), l("span", Bt, "Pending")) : s.status === "cancelled" ? (o(), l("span", $t, "Cancelled")) : (o(), l("span", Mt, "Confirmed")),
546
+ a("div", Vt, " €" + i(s.totalPrice.toFixed(2)), 1)
547
+ ])
548
+ ])
549
+ ], 8, Pt),
550
+ (o(!0), l(N, null, L(s.reservations, (c) => (o(), l("div", {
551
+ key: c.res_id,
552
+ class: "p-3 border-t bg-muted/50 dark:bg-transparent dark:hover:bg-muted/50 transition-colors cursor-pointer",
553
+ onClick: (ss) => n(A)?.openDialog(c)
554
+ }, [
555
+ a("div", Lt, [
556
+ a("div", Et, [
557
+ a("div", Ht, [
558
+ r(n(H), { size: 12 }),
559
+ a("span", null, i(W(c.date)) + " · " + i(c.startTime) + " - " + i(c.endTime), 1)
560
+ ]),
561
+ a("div", qt, [
562
+ r(n(E), { size: 12 }),
563
+ a("span", null, i(c.spots) + " spots", 1)
564
+ ]),
565
+ c.resourceName ? (o(), l("div", Yt, [
566
+ a("div", {
567
+ class: "w-3 h-3 rounded-full",
568
+ style: ne({ backgroundColor: c.resourceColor || "#6b7280" })
569
+ }, null, 4),
570
+ a("span", null, i(c.resourceName), 1)
571
+ ])) : D("", !0)
572
+ ]),
573
+ c.status === "confirmed" ? (o(), l("div", Qt, [
574
+ c.reservationStatus === "needs_approval" ? (o(), l("span", Xt, "Needs Approval")) : c.reservationStatus === "approved" ? (o(), l("span", Gt, "Approved")) : c.reservationStatus === "cancelled" ? (o(), l("span", Jt, "Cancelled")) : c.reservationStatus === "rejected" ? (o(), l("span", Kt, "Rejected")) : (o(), l("span", Wt, "Pending")),
575
+ c.reservationPrice || c.reservationPrice === 0 ? (o(), l("div", Zt, " €" + i(c.reservationPrice.toFixed(2)), 1)) : D("", !0)
576
+ ])) : D("", !0)
577
+ ]),
578
+ r(q, {
579
+ metadata: c.reservationMetadata,
580
+ schema: n(R),
581
+ "display-filter": ["highlight", "badge"],
582
+ compact: "",
583
+ class: "mt-1"
584
+ }, null, 8, ["metadata", "schema"])
585
+ ], 8, Ut))), 128))
586
+ ], 64))
587
+ ]))), 128))
588
+ ]))
589
+ ]),
590
+ _: 1
591
+ })
592
+ ]),
593
+ _: 1
594
+ })
595
+ ])
596
+ ]),
597
+ _: 1
598
+ }),
599
+ r(Ue, {
600
+ ref_key: "reservationDetailDialog",
601
+ ref: A,
602
+ "agenda-data": n(F),
603
+ resources: n(S),
604
+ "show-order-link": "",
605
+ onCancelled: h,
606
+ onConfirmed: h,
607
+ onRejected: h,
608
+ onTransferred: h,
609
+ onOpenOrder: e[2] || (e[2] = (s) => ee(s))
610
+ }, null, 8, ["agenda-data", "resources"]),
611
+ r(Le, {
612
+ ref_key: "orderDetailDialog",
613
+ ref: B,
614
+ "agenda-data": n(F),
615
+ resources: n(S),
616
+ onOpenReservation: e[3] || (e[3] = (s) => _e(s))
617
+ }, null, 8, ["agenda-data", "resources"])
618
+ ], 64);
619
+ };
620
+ }
621
+ }), ds = /* @__PURE__ */ He(es, [["__scopeId", "data-v-11463131"]]);
622
+ export {
623
+ ds as default
624
+ };