@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,3566 @@
1
+ import { ref as F, watch as We, defineComponent as De, resolveComponent as c, openBlock as i, createBlock as J, withCtx as r, createVNode as a, createTextVNode as $, createElementVNode as e, unref as P, normalizeClass as Z, computed as U, createElementBlock as _, createCommentVNode as T, Fragment as re, renderList as me, toDisplayString as f, normalizeStyle as Ce, resolveDynamicComponent as ke, inject as kt, useTemplateRef as He } from "vue";
2
+ import { AlertTriangle as $t, Receipt as ot, icons as Dt, User as st, Mail as rt, Phone as lt, Clock as Ze, Users as Qe, Tag as it, CreditCard as dt, Ban as Rt, ClockCheck as Ct, MoreHorizontal as ut, ExternalLink as St, Download as ct, MailCheck as At, CalendarClock as jt, XCircle as It, Gift as Mt, ShoppingBag as Nt, Calendar as Tt, ChevronRight as Ft } from "lucide-vue-next";
3
+ import { useModuleApi as pt, useModule as Oe, useMailer as Ke, useModuleRoute as nt, useFirebaseIntegration as vt, useModulePermissions as Vt, useFlowBuilder as mt } from "@oneclick.dev/cms-kit";
4
+ import { t as ce } from "./index-RLz1QPrf.mjs";
5
+ const de = (o) => o == null ? "—" : `€${o.toFixed(2)}`, ft = (o) => {
6
+ if (!o) return "—";
7
+ if (o < 60) return `${o} min`;
8
+ const x = Math.floor(o / 60), L = o % 60;
9
+ return L > 0 ? `${x}h ${L}min` : `${x}h`;
10
+ }, et = (o) => {
11
+ const x = Number(o.value);
12
+ return Number.isFinite(x) ? o.type === "percent" ? `${x}%` : `${x < 0 ? "-" : "+"}${de(Math.abs(x))}` : "—";
13
+ }, tt = (o) => {
14
+ switch (o) {
15
+ case "confirmed":
16
+ return "Confirmed";
17
+ case "pending":
18
+ return "Pending";
19
+ case "cancelled":
20
+ return "Cancelled";
21
+ case "needs_approval":
22
+ return "Needs Approval";
23
+ case "approved":
24
+ return "Approved";
25
+ case "rejected":
26
+ return "Rejected";
27
+ default:
28
+ return o || "Unknown";
29
+ }
30
+ }, Ve = (o) => {
31
+ switch (o) {
32
+ case "confirmed":
33
+ case "approved":
34
+ return "#16a34a";
35
+ // green-600
36
+ case "pending":
37
+ case "needs_approval":
38
+ return "#ca8a04";
39
+ // yellow-600
40
+ case "cancelled":
41
+ case "rejected":
42
+ return "#dc2626";
43
+ // red-600
44
+ default:
45
+ return "#6b7280";
46
+ }
47
+ }, Ot = (o) => {
48
+ if (!o) return "—";
49
+ const x = new Date(o);
50
+ return Number.isNaN(x.getTime()) ? o : x.toLocaleDateString("en-US", {
51
+ weekday: "short",
52
+ month: "short",
53
+ day: "numeric",
54
+ year: "numeric"
55
+ });
56
+ }, Pt = (o) => {
57
+ if (!o) return "—";
58
+ const x = new Date(o);
59
+ return Number.isNaN(x.getTime()) ? o : x.toLocaleString("en-US", {
60
+ weekday: "short",
61
+ month: "short",
62
+ day: "numeric",
63
+ year: "numeric",
64
+ hour: "2-digit",
65
+ minute: "2-digit"
66
+ });
67
+ }, zt = (o) => o.status === "confirmed" && ["needs_approval", "rejected", "approved", "cancelled"].includes(o.reservationStatus || "") ? o.reservationStatus || o.status : o.status || o.reservationStatus || "", gt = (o) => String(o ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), se = (o, x = "—") => o == null || o === "" ? x : gt(o), Ut = (o) => o == null || o === "" || o === !1 ? !1 : Array.isArray(o) ? o.length > 0 : typeof o == "object" ? Object.keys(o).length > 0 : !0, Bt = (o) => {
68
+ if (o === !0) return "Yes";
69
+ if (Array.isArray(o))
70
+ return o.map((x) => typeof x == "object" ? JSON.stringify(x) : String(x)).join(", ");
71
+ if (typeof o == "object")
72
+ try {
73
+ return JSON.stringify(o);
74
+ } catch {
75
+ return String(o);
76
+ }
77
+ return String(o);
78
+ }, Je = (o, x, L) => !o || !x?.length ? [] : x.filter((h) => h.scope !== L || h.includeInPdf !== !0 ? !1 : Ut(o[h.key])).sort((h, z) => (h.order || 0) - (z.order || 0)).map((h) => ({
79
+ id: h.id,
80
+ key: h.key,
81
+ label: h.label || h.key,
82
+ value: o[h.key]
83
+ })), bt = (o, x = !1) => o.map((L) => `
84
+ <div class="metadata-row${x ? " compact" : ""}">
85
+ <span class="metadata-label">${se(L.label)}</span>
86
+ <span class="metadata-value">${se(Bt(L.value))}</span>
87
+ </div>
88
+ `).join(""), at = (o, x) => x.length ? `
89
+ <div class="section">
90
+ <div class="section-title">${se(o)}</div>
91
+ <div class="section-content">
92
+ <div class="metadata-list">
93
+ ${bt(x)}
94
+ </div>
95
+ </div>
96
+ </div>
97
+ ` : "", Et = (o, x = {}) => {
98
+ const L = `${o.customerInfo?.firstName || ""} ${o.customerInfo?.lastName || ""}`.trim() || "Unknown Customer", h = o.id?.slice(0, 8) || "—", z = (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", {
99
+ year: "numeric",
100
+ month: "long",
101
+ day: "numeric"
102
+ }), E = Je(o.metadata, x.metadataSchema, "order"), d = Je(o.reservationMetadata, x.metadataSchema, "reservation"), R = `
103
+ <!DOCTYPE html>
104
+ <html lang="en">
105
+ <head>
106
+ <meta charset="UTF-8">
107
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
108
+ <title>Reservation ${h}</title>
109
+ <style>
110
+ * {
111
+ margin: 0;
112
+ padding: 0;
113
+ box-sizing: border-box;
114
+ }
115
+
116
+ body {
117
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
118
+ line-height: 1.6;
119
+ color: #1f2937;
120
+ background: #fff;
121
+ padding: 40px;
122
+ max-width: 800px;
123
+ margin: 0 auto;
124
+ }
125
+
126
+ .header {
127
+ display: flex;
128
+ justify-content: space-between;
129
+ align-items: flex-start;
130
+ margin-bottom: 40px;
131
+ padding-bottom: 20px;
132
+ border-bottom: 2px solid #e5e7eb;
133
+ }
134
+
135
+ .company-info {
136
+ display: flex;
137
+ align-items: center;
138
+ gap: 16px;
139
+ }
140
+
141
+ .company-logo {
142
+ max-height: 50px;
143
+ max-width: 150px;
144
+ object-fit: contain;
145
+ }
146
+
147
+ .company-name {
148
+ font-size: 24px;
149
+ font-weight: 700;
150
+ color: #111827;
151
+ }
152
+
153
+ .document-info {
154
+ text-align: right;
155
+ }
156
+
157
+ .document-title {
158
+ font-size: 28px;
159
+ font-weight: 700;
160
+ color: #111827;
161
+ margin-bottom: 8px;
162
+ }
163
+
164
+ .booking-id {
165
+ font-size: 14px;
166
+ color: #6b7280;
167
+ }
168
+
169
+ .status-badge {
170
+ display: inline-block;
171
+ padding: 4px 12px;
172
+ border-radius: 9999px;
173
+ font-size: 12px;
174
+ font-weight: 600;
175
+ text-transform: uppercase;
176
+ margin-top: 8px;
177
+ }
178
+
179
+ .section {
180
+ margin-bottom: 32px;
181
+ }
182
+
183
+ .section-title {
184
+ font-size: 12px;
185
+ font-weight: 600;
186
+ text-transform: uppercase;
187
+ letter-spacing: 0.05em;
188
+ color: #6b7280;
189
+ margin-bottom: 12px;
190
+ }
191
+
192
+ .section-content {
193
+ background: #f9fafb;
194
+ border-radius: 8px;
195
+ padding: 20px;
196
+ }
197
+
198
+ .customer-name {
199
+ font-size: 18px;
200
+ font-weight: 600;
201
+ margin-bottom: 8px;
202
+ }
203
+
204
+ .contact-info {
205
+ font-size: 14px;
206
+ color: #4b5563;
207
+ }
208
+
209
+ .contact-info a {
210
+ color: #4b5563;
211
+ text-decoration: none;
212
+ }
213
+
214
+ .grid {
215
+ display: grid;
216
+ grid-template-columns: 1fr 1fr;
217
+ gap: 16px;
218
+ }
219
+
220
+ .info-card {
221
+ background: #f9fafb;
222
+ border-radius: 8px;
223
+ padding: 16px;
224
+ }
225
+
226
+ .info-label {
227
+ font-size: 12px;
228
+ color: #6b7280;
229
+ margin-bottom: 4px;
230
+ }
231
+
232
+ .info-value {
233
+ font-size: 16px;
234
+ font-weight: 600;
235
+ }
236
+
237
+ .metadata-list {
238
+ display: grid;
239
+ gap: 8px;
240
+ }
241
+
242
+ .metadata-row {
243
+ display: flex;
244
+ justify-content: space-between;
245
+ gap: 16px;
246
+ padding: 8px 0;
247
+ border-bottom: 1px solid #e5e7eb;
248
+ font-size: 14px;
249
+ }
250
+
251
+ .metadata-row:last-child {
252
+ border-bottom: none;
253
+ }
254
+
255
+ .metadata-label {
256
+ color: #6b7280;
257
+ }
258
+
259
+ .metadata-value {
260
+ max-width: 60%;
261
+ font-weight: 600;
262
+ text-align: right;
263
+ overflow-wrap: anywhere;
264
+ }
265
+
266
+ .package-row {
267
+ display: flex;
268
+ justify-content: space-between;
269
+ align-items: flex-start;
270
+ }
271
+
272
+ .package-name {
273
+ font-size: 16px;
274
+ font-weight: 600;
275
+ }
276
+
277
+ .package-duration {
278
+ font-size: 14px;
279
+ color: #6b7280;
280
+ }
281
+
282
+ .package-price {
283
+ font-size: 16px;
284
+ font-weight: 600;
285
+ }
286
+
287
+ .payment-row {
288
+ display: flex;
289
+ justify-content: space-between;
290
+ padding: 8px 0;
291
+ font-size: 14px;
292
+ }
293
+
294
+ .payment-label {
295
+ color: #6b7280;
296
+ }
297
+
298
+ .payment-value {
299
+ font-weight: 500;
300
+ }
301
+
302
+ .payment-value.green {
303
+ color: #16a34a;
304
+ }
305
+
306
+ .payment-value.orange {
307
+ color: #ea580c;
308
+ }
309
+
310
+ .payment-divider {
311
+ border-top: 1px solid #e5e7eb;
312
+ margin: 12px 0;
313
+ }
314
+
315
+ .payment-total {
316
+ font-size: 16px;
317
+ font-weight: 600;
318
+ }
319
+
320
+ .footer {
321
+ margin-top: 60px;
322
+ padding-top: 20px;
323
+ border-top: 1px solid #e5e7eb;
324
+ text-align: center;
325
+ font-size: 12px;
326
+ color: #9ca3af;
327
+ }
328
+
329
+ @media print {
330
+ body {
331
+ padding: 20px;
332
+ }
333
+
334
+ .no-print {
335
+ display: none;
336
+ }
337
+ }
338
+ </style>
339
+ </head>
340
+ <body>
341
+ <div class="header">
342
+ <div class="company-info">
343
+ ${x.companyLogo ? `<img src="${x.companyLogo}" alt="Logo" class="company-logo" />` : ""}
344
+ ${x.companyName ? `<span class="company-name">${x.companyName}</span>` : ""}
345
+ </div>
346
+ <div class="document-info">
347
+ <div class="document-title">Reservation</div>
348
+ <div class="booking-id">Booking #${h}</div>
349
+ <div
350
+ class="status-badge"
351
+ style="background-color: ${Ve(o.status)}20; color: ${Ve(o.status)};"
352
+ >
353
+ ${tt(o.status)}
354
+ </div>
355
+ </div>
356
+ </div>
357
+
358
+ <div class="section">
359
+ <div class="section-title">Customer</div>
360
+ <div class="section-content">
361
+ <div class="customer-name">${L}</div>
362
+ <div class="contact-info">
363
+ ${o.customerInfo?.email ? `<div>Email: <a href="mailto:${o.customerInfo.email}">${o.customerInfo.email}</a></div>` : ""}
364
+ ${o.customerInfo?.phone ? `<div>Phone: <a href="tel:${o.customerInfo.phone}">${o.customerInfo.phone}</a></div>` : ""}
365
+ </div>
366
+ </div>
367
+ </div>
368
+
369
+ ${at("Order Metadata", E)}
370
+
371
+ <div class="section">
372
+ <div class="section-title">Reservation Details</div>
373
+ <div class="grid">
374
+ <div class="info-card">
375
+ <div class="info-label">Date</div>
376
+ <div class="info-value">${x.date || "—"}</div>
377
+ </div>
378
+ <div class="info-card">
379
+ <div class="info-label">Time</div>
380
+ <div class="info-value">${o.startTime} - ${o.endTime}</div>
381
+ </div>
382
+ <div class="info-card">
383
+ <div class="info-label">Spots</div>
384
+ <div class="info-value">${o.spots || 1} ${(o.spots || 1) === 1 ? "person" : "people"}</div>
385
+ </div>
386
+ ${x.resourceName ? `
387
+ <div class="info-card">
388
+ <div class="info-label">Resource</div>
389
+ <div class="info-value">${x.resourceName}</div>
390
+ </div>
391
+ ` : ""}
392
+ ${x.agendaName ? `
393
+ <div class="info-card">
394
+ <div class="info-label">Service</div>
395
+ <div class="info-value">${x.agendaName}</div>
396
+ </div>
397
+ ` : ""}
398
+ </div>
399
+ </div>
400
+
401
+ ${at("Reservation Metadata", d)}
402
+
403
+ ${o.pricingOption ? `
404
+ <div class="section">
405
+ <div class="section-title">Package</div>
406
+ <div class="section-content">
407
+ <div class="package-row">
408
+ <div>
409
+ <div class="package-name">${o.pricingOption.name}</div>
410
+ <div class="package-duration">${ft(o.pricingOption.duration)}</div>
411
+ </div>
412
+ <div class="package-price">${de(o.pricingOption.price)}</div>
413
+ </div>
414
+ </div>
415
+ </div>
416
+ ` : ""}
417
+
418
+ <div class="section">
419
+ <div class="section-title">Payment Summary</div>
420
+ <div class="section-content">
421
+ <div class="payment-row">
422
+ <span class="payment-label">Base price</span>
423
+ <span class="payment-value">${de(o.reservationBasePrice)}</span>
424
+ </div>
425
+ ${o.reservationAddOnsPrice ? `
426
+ <div class="payment-row">
427
+ <span class="payment-label">Add-ons</span>
428
+ <span class="payment-value">${de(o.reservationAddOnsPrice)}</span>
429
+ </div>
430
+ ` : ""}
431
+ ${o.reservationAdjustments?.length ? o.reservationAdjustments.map((b) => `
432
+ <div class="payment-row">
433
+ <span class="payment-label">${b.label || "Adjustment"}</span>
434
+ <span class="payment-value">${et(b)}</span>
435
+ </div>
436
+ `).join("") : ""}
437
+ ${o.discount ? `
438
+ <div class="payment-row">
439
+ <span class="payment-label">Discount</span>
440
+ <span class="payment-value green">-${de(o.discount)}</span>
441
+ </div>
442
+ ` : ""}
443
+
444
+ <div class="payment-divider"></div>
445
+
446
+ <div class="payment-row payment-total">
447
+ <span>Reservation Total</span>
448
+ <span>${de(o.reservationPrice)}</span>
449
+ </div>
450
+
451
+ ${o.amountPaid !== void 0 || o.amountDue !== void 0 ? `
452
+ <div class="payment-divider"></div>
453
+
454
+ ${o.amountPaid !== void 0 ? `
455
+ <div class="payment-row">
456
+ <span class="payment-label">Amount paid</span>
457
+ <span class="payment-value green">${de(o.amountPaid)}</span>
458
+ </div>
459
+ ` : ""}
460
+
461
+ ${o.amountDue !== void 0 && o.amountDue > 0 ? `
462
+ <div class="payment-row">
463
+ <span class="payment-label">Amount due</span>
464
+ <span class="payment-value orange">${de(o.amountDue)}</span>
465
+ </div>
466
+ ` : ""}
467
+ ` : ""}
468
+ </div>
469
+ </div>
470
+
471
+ <div class="footer">
472
+ <p>Generated on ${z}</p>
473
+ ${x.companyName ? `<p>${x.companyName}</p>` : ""}
474
+ </div>
475
+ </body>
476
+ </html>
477
+ `, N = window.open("", "_blank");
478
+ N && (N.document.write(R), N.document.close(), N.onload = () => {
479
+ N.print();
480
+ });
481
+ }, Lt = (o, x = {}) => {
482
+ const L = `${o.customerInfo?.firstName || ""} ${o.customerInfo?.lastName || ""}`.trim() || "Unknown Customer", h = o.id?.slice(0, 8) || "—", z = (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", {
483
+ year: "numeric",
484
+ month: "long",
485
+ day: "numeric"
486
+ }), E = o.reservations.reduce((C, p) => C + (p.reservationPrice || 0), 0), d = o.reservations[0], R = o.status || "", N = Je(o.metadata, x.metadataSchema, "order"), b = o.reservations.map((C, p) => {
487
+ const l = zt(C), t = [C.startTime, C.endTime].filter(Boolean).join(" - ") || "—", D = C.spots || 1, O = Je(C.reservationMetadata, x.metadataSchema, "reservation"), n = [
488
+ C.reservationBasePrice !== void 0 ? `
489
+ <div class="price-breakdown-row">
490
+ <span>Base price</span>
491
+ <span>${de(C.reservationBasePrice)}</span>
492
+ </div>
493
+ ` : "",
494
+ C.reservationAddOnsPrice ? `
495
+ <div class="price-breakdown-row">
496
+ <span>Add-ons</span>
497
+ <span>${de(C.reservationAddOnsPrice)}</span>
498
+ </div>
499
+ ` : "",
500
+ C.reservationAdjustments?.length ? C.reservationAdjustments.map((S) => `
501
+ <div class="price-breakdown-row">
502
+ <span>${se(S.label || "Adjustment")}</span>
503
+ <span>${et(S)}</span>
504
+ </div>
505
+ `).join("") : ""
506
+ ].join("");
507
+ return `
508
+ <div class="reservation-card">
509
+ <div class="reservation-header">
510
+ <div>
511
+ <div class="reservation-title">Reservation ${p + 1}</div>
512
+ ${C.resourceName ? `<div class="reservation-resource">${se(C.resourceName)}</div>` : ""}
513
+ </div>
514
+ <div
515
+ class="status-badge small"
516
+ style="background-color: ${Ve(l)}20; color: ${Ve(l)};"
517
+ >
518
+ ${se(tt(l))}
519
+ </div>
520
+ </div>
521
+ <div class="reservation-grid">
522
+ <div>
523
+ <div class="info-label">Date</div>
524
+ <div class="info-value compact">${se(Ot(C.date))}</div>
525
+ </div>
526
+ <div>
527
+ <div class="info-label">Time</div>
528
+ <div class="info-value compact">${se(t)}</div>
529
+ </div>
530
+ <div>
531
+ <div class="info-label">Spots</div>
532
+ <div class="info-value compact">${D} ${D === 1 ? "person" : "people"}</div>
533
+ </div>
534
+ <div>
535
+ <div class="info-label">Price</div>
536
+ <div class="info-value compact">${de(C.reservationPrice)}</div>
537
+ </div>
538
+ </div>
539
+ ${C.pricingOption?.name ? `
540
+ <div class="package-note">
541
+ <span>${se(C.pricingOption.name)}</span>
542
+ ${C.pricingOption.duration ? `<span>${ft(C.pricingOption.duration)}</span>` : ""}
543
+ </div>
544
+ ` : ""}
545
+ ${O.length ? `
546
+ <div class="reservation-metadata">
547
+ <div class="metadata-title">Reservation Metadata</div>
548
+ <div class="metadata-list compact">
549
+ ${bt(O, !0)}
550
+ </div>
551
+ </div>
552
+ ` : ""}
553
+ ${n ? `
554
+ <div class="reservation-price-breakdown">
555
+ <div class="price-breakdown-title">Price breakdown</div>
556
+ ${n}
557
+ <div class="price-breakdown-row total">
558
+ <span>Reservation Total</span>
559
+ <span>${de(C.reservationPrice)}</span>
560
+ </div>
561
+ </div>
562
+ ` : ""}
563
+ </div>
564
+ `;
565
+ }).join(""), k = `
566
+ <!DOCTYPE html>
567
+ <html lang="en">
568
+ <head>
569
+ <meta charset="UTF-8">
570
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
571
+ <title>Order ${h}</title>
572
+ <style>
573
+ * {
574
+ margin: 0;
575
+ padding: 0;
576
+ box-sizing: border-box;
577
+ }
578
+
579
+ body {
580
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
581
+ line-height: 1.6;
582
+ color: #1f2937;
583
+ background: #fff;
584
+ padding: 40px;
585
+ max-width: 800px;
586
+ margin: 0 auto;
587
+ }
588
+
589
+ .header {
590
+ display: flex;
591
+ justify-content: space-between;
592
+ align-items: flex-start;
593
+ gap: 24px;
594
+ margin-bottom: 40px;
595
+ padding-bottom: 20px;
596
+ border-bottom: 2px solid #e5e7eb;
597
+ }
598
+
599
+ .company-info {
600
+ display: flex;
601
+ align-items: center;
602
+ gap: 16px;
603
+ }
604
+
605
+ .company-logo {
606
+ max-height: 50px;
607
+ max-width: 150px;
608
+ object-fit: contain;
609
+ }
610
+
611
+ .company-name {
612
+ font-size: 24px;
613
+ font-weight: 700;
614
+ color: #111827;
615
+ }
616
+
617
+ .document-info {
618
+ text-align: right;
619
+ }
620
+
621
+ .document-title {
622
+ font-size: 28px;
623
+ font-weight: 700;
624
+ color: #111827;
625
+ margin-bottom: 8px;
626
+ }
627
+
628
+ .booking-id {
629
+ font-size: 14px;
630
+ color: #6b7280;
631
+ }
632
+
633
+ .status-badge {
634
+ display: inline-block;
635
+ padding: 4px 12px;
636
+ border-radius: 9999px;
637
+ font-size: 12px;
638
+ font-weight: 600;
639
+ text-transform: uppercase;
640
+ margin-top: 8px;
641
+ }
642
+
643
+ .status-badge.small {
644
+ margin-top: 0;
645
+ white-space: nowrap;
646
+ }
647
+
648
+ .section {
649
+ margin-bottom: 32px;
650
+ }
651
+
652
+ .section-title {
653
+ font-size: 12px;
654
+ font-weight: 600;
655
+ text-transform: uppercase;
656
+ letter-spacing: 0.05em;
657
+ color: #6b7280;
658
+ margin-bottom: 12px;
659
+ }
660
+
661
+ .section-content {
662
+ background: #f9fafb;
663
+ border-radius: 8px;
664
+ padding: 20px;
665
+ }
666
+
667
+ .customer-name {
668
+ font-size: 18px;
669
+ font-weight: 600;
670
+ margin-bottom: 8px;
671
+ }
672
+
673
+ .contact-info {
674
+ font-size: 14px;
675
+ color: #4b5563;
676
+ }
677
+
678
+ .grid {
679
+ display: grid;
680
+ grid-template-columns: 1fr 1fr;
681
+ gap: 16px;
682
+ }
683
+
684
+ .info-card {
685
+ background: #f9fafb;
686
+ border-radius: 8px;
687
+ padding: 16px;
688
+ }
689
+
690
+ .info-label {
691
+ font-size: 12px;
692
+ color: #6b7280;
693
+ margin-bottom: 4px;
694
+ }
695
+
696
+ .info-value {
697
+ font-size: 16px;
698
+ font-weight: 600;
699
+ }
700
+
701
+ .info-value.compact {
702
+ font-size: 14px;
703
+ }
704
+
705
+ .metadata-list {
706
+ display: grid;
707
+ gap: 8px;
708
+ }
709
+
710
+ .metadata-list.compact {
711
+ gap: 4px;
712
+ }
713
+
714
+ .metadata-row {
715
+ display: flex;
716
+ justify-content: space-between;
717
+ gap: 16px;
718
+ padding: 8px 0;
719
+ border-bottom: 1px solid #e5e7eb;
720
+ font-size: 14px;
721
+ }
722
+
723
+ .metadata-row.compact {
724
+ padding: 4px 0;
725
+ font-size: 13px;
726
+ }
727
+
728
+ .metadata-row:last-child {
729
+ border-bottom: none;
730
+ }
731
+
732
+ .metadata-label {
733
+ color: #6b7280;
734
+ }
735
+
736
+ .metadata-value {
737
+ max-width: 60%;
738
+ font-weight: 600;
739
+ text-align: right;
740
+ overflow-wrap: anywhere;
741
+ }
742
+
743
+ .reservation-metadata {
744
+ margin-top: 12px;
745
+ padding-top: 12px;
746
+ border-top: 1px solid #e5e7eb;
747
+ }
748
+
749
+ .metadata-title {
750
+ font-size: 12px;
751
+ font-weight: 600;
752
+ color: #6b7280;
753
+ margin-bottom: 6px;
754
+ }
755
+
756
+ .reservation-list {
757
+ display: grid;
758
+ gap: 12px;
759
+ }
760
+
761
+ .reservation-card {
762
+ background: #f9fafb;
763
+ border-radius: 8px;
764
+ padding: 16px;
765
+ break-inside: avoid;
766
+ }
767
+
768
+ .reservation-header {
769
+ display: flex;
770
+ justify-content: space-between;
771
+ align-items: flex-start;
772
+ gap: 16px;
773
+ margin-bottom: 14px;
774
+ }
775
+
776
+ .reservation-title {
777
+ font-size: 16px;
778
+ font-weight: 600;
779
+ }
780
+
781
+ .reservation-resource {
782
+ font-size: 13px;
783
+ color: #6b7280;
784
+ }
785
+
786
+ .reservation-grid {
787
+ display: grid;
788
+ grid-template-columns: repeat(4, 1fr);
789
+ gap: 12px;
790
+ }
791
+
792
+ .package-note {
793
+ display: flex;
794
+ gap: 12px;
795
+ margin-top: 12px;
796
+ padding-top: 12px;
797
+ border-top: 1px solid #e5e7eb;
798
+ font-size: 13px;
799
+ color: #4b5563;
800
+ }
801
+
802
+ .reservation-price-breakdown {
803
+ margin-top: 12px;
804
+ padding-top: 12px;
805
+ border-top: 1px solid #e5e7eb;
806
+ }
807
+
808
+ .price-breakdown-title {
809
+ font-size: 12px;
810
+ font-weight: 600;
811
+ color: #6b7280;
812
+ margin-bottom: 6px;
813
+ }
814
+
815
+ .price-breakdown-row {
816
+ display: flex;
817
+ justify-content: space-between;
818
+ gap: 20px;
819
+ padding: 3px 0;
820
+ font-size: 13px;
821
+ color: #4b5563;
822
+ }
823
+
824
+ .price-breakdown-row span:last-child {
825
+ font-weight: 500;
826
+ color: #1f2937;
827
+ text-align: right;
828
+ }
829
+
830
+ .price-breakdown-row.total {
831
+ margin-top: 6px;
832
+ padding-top: 8px;
833
+ border-top: 1px solid #e5e7eb;
834
+ font-weight: 600;
835
+ color: #111827;
836
+ }
837
+
838
+ .payment-row {
839
+ display: flex;
840
+ justify-content: space-between;
841
+ gap: 24px;
842
+ padding: 8px 0;
843
+ font-size: 14px;
844
+ }
845
+
846
+ .payment-label {
847
+ color: #6b7280;
848
+ }
849
+
850
+ .payment-value {
851
+ font-weight: 500;
852
+ text-align: right;
853
+ }
854
+
855
+ .payment-value.green {
856
+ color: #16a34a;
857
+ }
858
+
859
+ .payment-value.orange {
860
+ color: #ea580c;
861
+ }
862
+
863
+ .payment-divider {
864
+ border-top: 1px solid #e5e7eb;
865
+ margin: 12px 0;
866
+ }
867
+
868
+ .payment-total {
869
+ font-size: 16px;
870
+ font-weight: 600;
871
+ }
872
+
873
+ .footer {
874
+ margin-top: 60px;
875
+ padding-top: 20px;
876
+ border-top: 1px solid #e5e7eb;
877
+ text-align: center;
878
+ font-size: 12px;
879
+ color: #9ca3af;
880
+ }
881
+
882
+ @media print {
883
+ body {
884
+ padding: 20px;
885
+ }
886
+ }
887
+ </style>
888
+ </head>
889
+ <body>
890
+ <div class="header">
891
+ <div class="company-info">
892
+ ${x.companyLogo ? `<img src="${gt(x.companyLogo)}" alt="Logo" class="company-logo" />` : ""}
893
+ ${x.companyName ? `<span class="company-name">${se(x.companyName)}</span>` : ""}
894
+ </div>
895
+ <div class="document-info">
896
+ <div class="document-title">Order</div>
897
+ <div class="booking-id">Order #${se(h)}</div>
898
+ <div
899
+ class="status-badge"
900
+ style="background-color: ${Ve(R)}20; color: ${Ve(R)};"
901
+ >
902
+ ${se(tt(R))}
903
+ </div>
904
+ </div>
905
+ </div>
906
+
907
+ <div class="section">
908
+ <div class="section-title">Customer</div>
909
+ <div class="section-content">
910
+ <div class="customer-name">${se(L)}</div>
911
+ <div class="contact-info">
912
+ ${o.customerInfo?.email ? `<div>Email: ${se(o.customerInfo.email)}</div>` : ""}
913
+ ${o.customerInfo?.phone ? `<div>Phone: ${se(o.customerInfo.phone)}</div>` : ""}
914
+ </div>
915
+ </div>
916
+ </div>
917
+
918
+ ${at("Order Metadata", N)}
919
+
920
+ <div class="section">
921
+ <div class="section-title">Order Summary</div>
922
+ <div class="grid">
923
+ <div class="info-card">
924
+ <div class="info-label">Reservations</div>
925
+ <div class="info-value">${o.reservations.length}</div>
926
+ </div>
927
+ <div class="info-card">
928
+ <div class="info-label">Spots</div>
929
+ <div class="info-value">${o.totalSpots}</div>
930
+ </div>
931
+ <div class="info-card">
932
+ <div class="info-label">Ordered at</div>
933
+ <div class="info-value">${se(Pt(o.createdAt))}</div>
934
+ </div>
935
+ ${x.agendaName ? `
936
+ <div class="info-card">
937
+ <div class="info-label">Service</div>
938
+ <div class="info-value">${se(x.agendaName)}</div>
939
+ </div>
940
+ ` : ""}
941
+ </div>
942
+ </div>
943
+
944
+ <div class="section">
945
+ <div class="section-title">Reservations</div>
946
+ <div class="reservation-list">
947
+ ${b}
948
+ </div>
949
+ </div>
950
+
951
+ <div class="section">
952
+ <div class="section-title">Payment Summary</div>
953
+ <div class="section-content">
954
+ <div class="payment-row">
955
+ <span class="payment-label">Reservations</span>
956
+ <span class="payment-value">${de(E)}</span>
957
+ </div>
958
+ ${d?.subtotal !== void 0 && d.subtotal !== o.totalPrice ? `
959
+ <div class="payment-row">
960
+ <span class="payment-label">Subtotal</span>
961
+ <span class="payment-value">${de(d.subtotal)}</span>
962
+ </div>
963
+ ` : ""}
964
+ ${o.adjustments?.length ? o.adjustments.map((C) => `
965
+ <div class="payment-row">
966
+ <span class="payment-label">${se(C.label || "Adjustment")}</span>
967
+ <span class="payment-value">${et(C)}</span>
968
+ </div>
969
+ `).join("") : ""}
970
+ ${d?.discount ? `
971
+ <div class="payment-row">
972
+ <span class="payment-label">Discount</span>
973
+ <span class="payment-value green">-${de(d.discount)}</span>
974
+ </div>
975
+ ` : ""}
976
+
977
+ <div class="payment-divider"></div>
978
+
979
+ <div class="payment-row payment-total">
980
+ <span>Order Total</span>
981
+ <span>${de(o.totalPrice)}</span>
982
+ </div>
983
+
984
+ ${d?.amountPaid !== void 0 || d?.amountDue !== void 0 ? `
985
+ <div class="payment-divider"></div>
986
+
987
+ ${d?.amountPaid !== void 0 ? `
988
+ <div class="payment-row">
989
+ <span class="payment-label">Amount paid</span>
990
+ <span class="payment-value green">${de(d.amountPaid)}</span>
991
+ </div>
992
+ ` : ""}
993
+
994
+ ${d?.amountDue !== void 0 && d.amountDue > 0 ? `
995
+ <div class="payment-row">
996
+ <span class="payment-label">Amount due</span>
997
+ <span class="payment-value orange">${de(d.amountDue)}</span>
998
+ </div>
999
+ ` : ""}
1000
+ ` : ""}
1001
+ </div>
1002
+ </div>
1003
+
1004
+ <div class="footer">
1005
+ <p>Generated on ${z}</p>
1006
+ ${x.companyName ? `<p>${se(x.companyName)}</p>` : ""}
1007
+ </div>
1008
+ </body>
1009
+ </html>
1010
+ `, w = window.open("", "_blank");
1011
+ w && (w.document.write(k), w.document.close(), w.onload = () => {
1012
+ w.print();
1013
+ });
1014
+ };
1015
+ function yt(o) {
1016
+ const x = pt(), L = F([]), h = F(!1), z = async () => {
1017
+ if (!o.value) {
1018
+ L.value = [];
1019
+ return;
1020
+ }
1021
+ h.value = !0;
1022
+ try {
1023
+ const E = await x.get(`/agendas/${o.value}/metadata-schema`);
1024
+ L.value = Array.isArray(E?.metadataSchema) ? E.metadataSchema : [];
1025
+ } catch (E) {
1026
+ console.error("Error loading metadata schema:", E), L.value = [];
1027
+ } finally {
1028
+ h.value = !1;
1029
+ }
1030
+ };
1031
+ return We(o, z, { immediate: !0 }), {
1032
+ metadataSchema: L,
1033
+ isMetadataSchemaLoading: h,
1034
+ loadMetadataSchema: z
1035
+ };
1036
+ }
1037
+ const Ht = { class: "flex items-center bg-muted/70 dark:bg-muted/20 px-4 rounded-md" }, qt = { class: "grid gap-2" }, Wt = { class: "grid gap-2" }, Gt = { class: "grid gap-2" }, Jt = /* @__PURE__ */ De({
1038
+ __name: "CancelReservationDialog",
1039
+ emits: ["confirm"],
1040
+ setup(o, { expose: x, emit: L }) {
1041
+ const { config: h } = Oe(), { sendMail: z } = Ke(h.mailAccount), E = L, d = F(!1), R = F(!1), N = F(""), b = F(""), k = F(""), w = (p) => {
1042
+ R.value = !h.mailAccount, d.value = !0, p && (N.value = p.customerInfo?.email, b.value = "Cancellation of your reservation - " + new Date(p.date)?.toDateString(), k.value = `Dear ${p.customerInfo?.firstName ?? ""} ${p.customerInfo?.lastName ?? ""},
1043
+
1044
+ We are writing to inform you that your reservation scheduled for ${new Date(p.date)?.toDateString()} at ${p.startTime} has been cancelled.
1045
+
1046
+ Please accept our sincere apologies for any inconvenience this may cause. We would be happy to help you find an alternative time that works for you.`);
1047
+ }, C = () => {
1048
+ if (!R.value) {
1049
+ if (!N.value || !b.value || !k.value) return alert("Please fill in all the fields.");
1050
+ z({
1051
+ to: N.value,
1052
+ subject: b.value,
1053
+ body: k.value
1054
+ });
1055
+ }
1056
+ d.value = !1;
1057
+ const { $confetti: p } = useNuxtApp();
1058
+ p(), E("confirm");
1059
+ };
1060
+ return x({
1061
+ openDialog: w
1062
+ }), (p, l) => {
1063
+ const t = c("DialogTitle"), D = c("DialogDescription"), O = c("DialogHeader"), n = c("Checkbox"), S = c("Label"), W = c("Input"), te = c("Textarea"), le = c("Button"), ae = c("DialogFooter"), M = c("DialogScrollContent"), j = c("Dialog");
1064
+ return i(), J(j, {
1065
+ open: d.value,
1066
+ "onUpdate:open": l[5] || (l[5] = (V) => d.value = V)
1067
+ }, {
1068
+ default: r(() => [
1069
+ a(M, { class: "sm:max-w-3xl" }, {
1070
+ default: r(() => [
1071
+ a(O, null, {
1072
+ default: r(() => [
1073
+ a(t, null, {
1074
+ default: r(() => [...l[6] || (l[6] = [
1075
+ $(" Cancel Reservation ", -1)
1076
+ ])]),
1077
+ _: 1
1078
+ }),
1079
+ a(D)
1080
+ ]),
1081
+ _: 1
1082
+ }),
1083
+ e("div", Ht, [
1084
+ a(n, {
1085
+ modelValue: R.value,
1086
+ "onUpdate:modelValue": l[0] || (l[0] = (V) => R.value = V),
1087
+ id: "cancel-dialog-skip-mail",
1088
+ class: "border-black/80 dark:border-gray-200",
1089
+ disabled: !P(h).mailAccount
1090
+ }, null, 8, ["modelValue", "disabled"]),
1091
+ a(S, {
1092
+ for: "cancel-dialog-skip-mail",
1093
+ class: "py-4 pl-2 pr-4"
1094
+ }, {
1095
+ default: r(() => [...l[7] || (l[7] = [
1096
+ $("Do not send email to customer", -1)
1097
+ ])]),
1098
+ _: 1
1099
+ })
1100
+ ]),
1101
+ e("div", {
1102
+ class: Z(["grid gap-4 py-4", { "opacity-50": R.value }])
1103
+ }, [
1104
+ e("div", qt, [
1105
+ a(S, { for: "cancel-dialog-email" }, {
1106
+ default: r(() => [...l[8] || (l[8] = [
1107
+ $("To:", -1)
1108
+ ])]),
1109
+ _: 1
1110
+ }),
1111
+ a(W, {
1112
+ modelValue: N.value,
1113
+ "onUpdate:modelValue": l[1] || (l[1] = (V) => N.value = V),
1114
+ disabled: R.value,
1115
+ id: "cancel-dialog-email"
1116
+ }, null, 8, ["modelValue", "disabled"])
1117
+ ]),
1118
+ e("div", Wt, [
1119
+ a(S, { for: "cancel-dialog-subject" }, {
1120
+ default: r(() => [...l[9] || (l[9] = [
1121
+ $("Subject:", -1)
1122
+ ])]),
1123
+ _: 1
1124
+ }),
1125
+ a(W, {
1126
+ modelValue: b.value,
1127
+ "onUpdate:modelValue": l[2] || (l[2] = (V) => b.value = V),
1128
+ disabled: R.value,
1129
+ id: "cancel-dialog-subject"
1130
+ }, null, 8, ["modelValue", "disabled"])
1131
+ ]),
1132
+ e("div", Gt, [
1133
+ a(S, { for: "cancel-dialog-body" }, {
1134
+ default: r(() => [...l[10] || (l[10] = [
1135
+ $("Body:", -1)
1136
+ ])]),
1137
+ _: 1
1138
+ }),
1139
+ a(te, {
1140
+ modelValue: k.value,
1141
+ "onUpdate:modelValue": l[3] || (l[3] = (V) => k.value = V),
1142
+ disabled: R.value,
1143
+ id: "cancel-dialog-body"
1144
+ }, null, 8, ["modelValue", "disabled"])
1145
+ ])
1146
+ ], 2),
1147
+ a(ae, null, {
1148
+ default: r(() => [
1149
+ a(le, {
1150
+ variant: "outline",
1151
+ onClick: l[4] || (l[4] = (V) => d.value = !1)
1152
+ }, {
1153
+ default: r(() => [...l[11] || (l[11] = [
1154
+ $("Close", -1)
1155
+ ])]),
1156
+ _: 1
1157
+ }),
1158
+ a(le, {
1159
+ variant: "destructive",
1160
+ onClick: C
1161
+ }, {
1162
+ default: r(() => [...l[12] || (l[12] = [
1163
+ $("Cancel reservation", -1)
1164
+ ])]),
1165
+ _: 1
1166
+ })
1167
+ ]),
1168
+ _: 1
1169
+ })
1170
+ ]),
1171
+ _: 1
1172
+ })
1173
+ ]),
1174
+ _: 1
1175
+ }, 8, ["open"]);
1176
+ };
1177
+ }
1178
+ }), Yt = {
1179
+ key: 0,
1180
+ class: "flex items-start gap-3 rounded-md border border-orange-200 bg-orange-50 p-4 text-sm text-orange-900 dark:border-orange-900/50 dark:bg-orange-950/30 dark:text-orange-200"
1181
+ }, Kt = { class: "grid gap-4 py-4" }, Xt = {
1182
+ key: 0,
1183
+ class: "grid gap-2"
1184
+ }, Zt = { class: "relative" }, Qt = { class: "grid gap-2" }, ea = {
1185
+ key: 0,
1186
+ class: "flex items-center gap-2 rounded-md border px-3 py-2"
1187
+ }, ta = {
1188
+ key: 0,
1189
+ class: "text-destructive"
1190
+ }, aa = {
1191
+ key: 0,
1192
+ class: "text-destructive"
1193
+ }, oa = { class: "flex items-center bg-muted/70 dark:bg-muted/20 px-4 rounded-md" }, na = { class: "grid gap-2" }, sa = { class: "grid gap-2" }, ra = { class: "grid gap-2" }, la = /* @__PURE__ */ De({
1194
+ __name: "CancelRefundReservationDialog",
1195
+ props: {
1196
+ isProcessing: { type: Boolean },
1197
+ hasRefundFlow: { type: Boolean },
1198
+ showRefundAmount: { type: Boolean },
1199
+ customFields: {}
1200
+ },
1201
+ emits: ["confirm"],
1202
+ setup(o, { expose: x, emit: L }) {
1203
+ const h = o, z = L, { config: E } = Oe(), d = F(!1), R = F(!1), N = F(""), b = F(""), k = F(""), w = F(0), C = F("Reservation cancelled"), p = F(""), l = F({}), t = U(() => `€${(Number(w.value) || 0).toFixed(2)}`), D = U(() => h.showRefundAmount !== !1), O = U(() => h.customFields || []);
1204
+ We(w, () => {
1205
+ if (!D.value) return;
1206
+ const M = t.value;
1207
+ p.value && k.value.includes(p.value) && (k.value = k.value.replace(p.value, M)), p.value = M;
1208
+ });
1209
+ const n = (M) => {
1210
+ const j = Number(M?.reservationPrice ?? M?.pricingOption?.price ?? 0), V = Number(M?.amountPaid ?? 0), Y = Number(M?.total ?? 0);
1211
+ return V > 0 && j > 0 ? Math.min(V, j) : V > 0 ? V : j > 0 ? j : Y > 0 ? Y : 0;
1212
+ }, S = (M) => M.defaultValue !== void 0 ? M.defaultValue : M.type === "number" ? 0 : M.type === "checkbox" ? !1 : "", W = () => {
1213
+ l.value = Object.fromEntries(
1214
+ O.value.filter((M) => M.key).map((M) => [M.key, S(M)])
1215
+ );
1216
+ }, te = (M) => {
1217
+ R.value = !E.mailAccount, w.value = n(M), p.value = t.value, C.value = "Reservation cancelled", W(), d.value = !0, M && (N.value = M.customerInfo?.email || "", b.value = `Cancellation and refund of your reservation - ${new Date(M.date)?.toDateString()}`, k.value = `Dear ${M.customerInfo?.firstName ?? ""} ${M.customerInfo?.lastName ?? ""},
1218
+
1219
+ We are writing to inform you that your reservation scheduled for ${new Date(M.date)?.toDateString()} at ${M.startTime} has been cancelled.
1220
+
1221
+ ${D.value ? `A refund of ${t.value} will be processed according to our refund policy.` : "We will process this cancellation according to our policy."}
1222
+
1223
+ Please accept our sincere apologies for any inconvenience this may cause.`);
1224
+ }, le = () => {
1225
+ d.value = !1;
1226
+ }, ae = () => {
1227
+ if (!h.hasRefundFlow) return;
1228
+ if (D.value && (!w.value || w.value <= 0))
1229
+ return alert("Please enter a refund amount.");
1230
+ if (!C.value)
1231
+ return alert("Please enter a refund reason.");
1232
+ if (!R.value && (!N.value || !b.value || !k.value))
1233
+ return alert("Please fill in all the email fields.");
1234
+ const M = O.value.find((j) => {
1235
+ if (!j.required || !j.key) return !1;
1236
+ const V = l.value[j.key];
1237
+ return j.type === "checkbox" ? V !== !0 : V == null || V === "";
1238
+ });
1239
+ if (M)
1240
+ return alert(`Please fill in ${M.label}.`);
1241
+ z("confirm", {
1242
+ amount: D.value ? Number(w.value) : void 0,
1243
+ reason: C.value,
1244
+ fields: { ...l.value },
1245
+ fieldDefinitions: O.value,
1246
+ skipMail: R.value,
1247
+ email: N.value,
1248
+ subject: b.value,
1249
+ body: k.value
1250
+ });
1251
+ };
1252
+ return x({
1253
+ openDialog: te,
1254
+ closeDialog: le
1255
+ }), (M, j) => {
1256
+ const V = c("DialogTitle"), Y = c("DialogDescription"), be = c("DialogHeader"), ne = c("Label"), K = c("Input"), ye = c("Checkbox"), $e = c("Textarea"), Re = c("Button"), m = c("DialogFooter"), g = c("DialogScrollContent"), X = c("Dialog");
1257
+ return i(), J(X, {
1258
+ open: d.value,
1259
+ "onUpdate:open": j[7] || (j[7] = (A) => d.value = A)
1260
+ }, {
1261
+ default: r(() => [
1262
+ a(g, { class: "sm:max-w-3xl" }, {
1263
+ default: r(() => [
1264
+ a(be, null, {
1265
+ default: r(() => [
1266
+ a(V, null, {
1267
+ default: r(() => [...j[8] || (j[8] = [
1268
+ $(" Cancel & Refund Reservation ", -1)
1269
+ ])]),
1270
+ _: 1
1271
+ }),
1272
+ a(Y, null, {
1273
+ default: r(() => [...j[9] || (j[9] = [
1274
+ $(" Run the configured refund flow and cancel this reservation. ", -1)
1275
+ ])]),
1276
+ _: 1
1277
+ })
1278
+ ]),
1279
+ _: 1
1280
+ }),
1281
+ o.hasRefundFlow ? T("", !0) : (i(), _("div", Yt, [
1282
+ a(P($t), { class: "mt-0.5 size-4 shrink-0" }),
1283
+ j[10] || (j[10] = e("div", null, [
1284
+ e("p", { class: "font-medium" }, "No refund flow configured"),
1285
+ e("p", { class: "mt-1 text-orange-800 dark:text-orange-300" }, " Add one in this agenda's Refunds settings before processing refunds. ")
1286
+ ], -1))
1287
+ ])),
1288
+ e("div", Kt, [
1289
+ D.value ? (i(), _("div", Xt, [
1290
+ a(ne, { for: "refund-dialog-amount" }, {
1291
+ default: r(() => [...j[11] || (j[11] = [
1292
+ $("Refund amount", -1)
1293
+ ])]),
1294
+ _: 1
1295
+ }),
1296
+ e("div", Zt, [
1297
+ a(P(ot), { class: "absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" }),
1298
+ a(K, {
1299
+ id: "refund-dialog-amount",
1300
+ modelValue: w.value,
1301
+ "onUpdate:modelValue": j[0] || (j[0] = (A) => w.value = A),
1302
+ modelModifiers: { number: !0 },
1303
+ type: "number",
1304
+ min: "0",
1305
+ step: "0.01",
1306
+ class: "pl-9 no-spinner",
1307
+ disabled: o.isProcessing
1308
+ }, null, 8, ["modelValue", "disabled"])
1309
+ ])
1310
+ ])) : T("", !0),
1311
+ e("div", Qt, [
1312
+ a(ne, { for: "refund-dialog-reason" }, {
1313
+ default: r(() => [...j[12] || (j[12] = [
1314
+ $("Reason", -1)
1315
+ ])]),
1316
+ _: 1
1317
+ }),
1318
+ a(K, {
1319
+ id: "refund-dialog-reason",
1320
+ modelValue: C.value,
1321
+ "onUpdate:modelValue": j[1] || (j[1] = (A) => C.value = A),
1322
+ disabled: o.isProcessing
1323
+ }, null, 8, ["modelValue", "disabled"])
1324
+ ]),
1325
+ (i(!0), _(re, null, me(O.value, (A) => (i(), _("div", {
1326
+ key: A.id,
1327
+ class: "grid gap-2"
1328
+ }, [
1329
+ A.type === "checkbox" ? (i(), _("div", ea, [
1330
+ a(ye, {
1331
+ id: `refund-dialog-field-${A.id}`,
1332
+ modelValue: l.value[A.key],
1333
+ "onUpdate:modelValue": (oe) => l.value[A.key] = oe,
1334
+ disabled: o.isProcessing
1335
+ }, null, 8, ["id", "modelValue", "onUpdate:modelValue", "disabled"]),
1336
+ a(ne, {
1337
+ for: `refund-dialog-field-${A.id}`,
1338
+ class: "text-sm"
1339
+ }, {
1340
+ default: r(() => [
1341
+ $(f(A.label), 1),
1342
+ A.required ? (i(), _("span", ta, " *")) : T("", !0)
1343
+ ]),
1344
+ _: 2
1345
+ }, 1032, ["for"])
1346
+ ])) : (i(), _(re, { key: 1 }, [
1347
+ a(ne, {
1348
+ for: `refund-dialog-field-${A.id}`
1349
+ }, {
1350
+ default: r(() => [
1351
+ $(f(A.label), 1),
1352
+ A.required ? (i(), _("span", aa, " *")) : T("", !0)
1353
+ ]),
1354
+ _: 2
1355
+ }, 1032, ["for"]),
1356
+ A.type === "textarea" ? (i(), J($e, {
1357
+ key: 0,
1358
+ id: `refund-dialog-field-${A.id}`,
1359
+ modelValue: l.value[A.key],
1360
+ "onUpdate:modelValue": (oe) => l.value[A.key] = oe,
1361
+ placeholder: A.placeholder,
1362
+ disabled: o.isProcessing
1363
+ }, null, 8, ["id", "modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : A.type === "number" ? (i(), J(K, {
1364
+ key: 1,
1365
+ id: `refund-dialog-field-${A.id}`,
1366
+ modelValue: l.value[A.key],
1367
+ "onUpdate:modelValue": (oe) => l.value[A.key] = oe,
1368
+ modelModifiers: { number: !0 },
1369
+ type: "number",
1370
+ placeholder: A.placeholder,
1371
+ disabled: o.isProcessing,
1372
+ class: "no-spinner"
1373
+ }, null, 8, ["id", "modelValue", "onUpdate:modelValue", "placeholder", "disabled"])) : (i(), J(K, {
1374
+ key: 2,
1375
+ id: `refund-dialog-field-${A.id}`,
1376
+ modelValue: l.value[A.key],
1377
+ "onUpdate:modelValue": (oe) => l.value[A.key] = oe,
1378
+ type: "text",
1379
+ placeholder: A.placeholder,
1380
+ disabled: o.isProcessing
1381
+ }, null, 8, ["id", "modelValue", "onUpdate:modelValue", "placeholder", "disabled"]))
1382
+ ], 64))
1383
+ ]))), 128))
1384
+ ]),
1385
+ e("div", oa, [
1386
+ a(ye, {
1387
+ modelValue: R.value,
1388
+ "onUpdate:modelValue": j[2] || (j[2] = (A) => R.value = A),
1389
+ id: "refund-dialog-skip-mail",
1390
+ class: "border-black/80 dark:border-gray-200",
1391
+ disabled: !P(E).mailAccount || o.isProcessing
1392
+ }, null, 8, ["modelValue", "disabled"]),
1393
+ a(ne, {
1394
+ for: "refund-dialog-skip-mail",
1395
+ class: "py-4 pl-2 pr-4"
1396
+ }, {
1397
+ default: r(() => [...j[13] || (j[13] = [
1398
+ $("Do not send email to customer", -1)
1399
+ ])]),
1400
+ _: 1
1401
+ })
1402
+ ]),
1403
+ e("div", {
1404
+ class: Z(["grid gap-4 py-4", { "opacity-50": R.value }])
1405
+ }, [
1406
+ e("div", na, [
1407
+ a(ne, { for: "refund-dialog-email" }, {
1408
+ default: r(() => [...j[14] || (j[14] = [
1409
+ $("To:", -1)
1410
+ ])]),
1411
+ _: 1
1412
+ }),
1413
+ a(K, {
1414
+ modelValue: N.value,
1415
+ "onUpdate:modelValue": j[3] || (j[3] = (A) => N.value = A),
1416
+ disabled: R.value || o.isProcessing,
1417
+ id: "refund-dialog-email"
1418
+ }, null, 8, ["modelValue", "disabled"])
1419
+ ]),
1420
+ e("div", sa, [
1421
+ a(ne, { for: "refund-dialog-subject" }, {
1422
+ default: r(() => [...j[15] || (j[15] = [
1423
+ $("Subject:", -1)
1424
+ ])]),
1425
+ _: 1
1426
+ }),
1427
+ a(K, {
1428
+ modelValue: b.value,
1429
+ "onUpdate:modelValue": j[4] || (j[4] = (A) => b.value = A),
1430
+ disabled: R.value || o.isProcessing,
1431
+ id: "refund-dialog-subject"
1432
+ }, null, 8, ["modelValue", "disabled"])
1433
+ ]),
1434
+ e("div", ra, [
1435
+ a(ne, { for: "refund-dialog-body" }, {
1436
+ default: r(() => [...j[16] || (j[16] = [
1437
+ $("Body:", -1)
1438
+ ])]),
1439
+ _: 1
1440
+ }),
1441
+ a($e, {
1442
+ modelValue: k.value,
1443
+ "onUpdate:modelValue": j[5] || (j[5] = (A) => k.value = A),
1444
+ disabled: R.value || o.isProcessing,
1445
+ id: "refund-dialog-body"
1446
+ }, null, 8, ["modelValue", "disabled"])
1447
+ ])
1448
+ ], 2),
1449
+ a(m, null, {
1450
+ default: r(() => [
1451
+ a(Re, {
1452
+ variant: "outline",
1453
+ onClick: j[6] || (j[6] = (A) => d.value = !1),
1454
+ disabled: o.isProcessing
1455
+ }, {
1456
+ default: r(() => [...j[17] || (j[17] = [
1457
+ $("Close", -1)
1458
+ ])]),
1459
+ _: 1
1460
+ }, 8, ["disabled"]),
1461
+ a(Re, {
1462
+ variant: "destructive",
1463
+ onClick: ae,
1464
+ disabled: o.isProcessing || !o.hasRefundFlow
1465
+ }, {
1466
+ default: r(() => [
1467
+ $(f(o.isProcessing ? "Processing..." : "Cancel & Refund"), 1)
1468
+ ]),
1469
+ _: 1
1470
+ }, 8, ["disabled"])
1471
+ ]),
1472
+ _: 1
1473
+ })
1474
+ ]),
1475
+ _: 1
1476
+ })
1477
+ ]),
1478
+ _: 1
1479
+ }, 8, ["open"]);
1480
+ };
1481
+ }
1482
+ }), ia = { class: "pb-4" }, da = { class: "mt-6 grid gap-4 md:grid-cols-3" }, ua = { class: "space-y-2" }, ca = { class: "space-y-2" }, pa = { class: "space-y-2" }, va = {
1483
+ key: 0,
1484
+ class: "text-xs text-muted-foreground"
1485
+ }, ma = { class: "mt-4 rounded-lg border bg-muted/30 p-4" }, fa = { class: "mt-2 text-sm text-foreground" }, ga = { key: 0 }, ba = {
1486
+ key: 1,
1487
+ class: "mt-4 text-sm text-red-500"
1488
+ }, ya = /* @__PURE__ */ De({
1489
+ __name: "TransferReservationDialog",
1490
+ props: {
1491
+ agendaData: {}
1492
+ },
1493
+ emits: ["transferred"],
1494
+ setup(o, { expose: x, emit: L }) {
1495
+ const h = o, z = L, { config: E } = Oe(), { params: d } = nt(), R = vt(E.project), N = F(!1), b = F(null), k = F(""), w = F(""), C = F(""), p = F(!1), l = F(!1), t = F(""), D = F(""), O = F(null), n = F(null);
1496
+ let S = 0;
1497
+ const W = /^([01]\d|2[0-3]):[0-5]\d$/, te = U(() => h.agendaData?.resources || []), le = U(() => b.value?.resourceId || ""), ae = U(() => te.value.filter((v) => v.isActive !== !1 || v.id === le.value)), M = U(() => te.value.find((v) => v.id === C.value)), j = U(
1498
+ () => M.value?.name ?? "No resource selected"
1499
+ ), V = U(() => b.value?.agendaId || h.agendaData?.id || d.value?.id || d.id || ""), Y = U(() => {
1500
+ const v = Number(b.value?.spots);
1501
+ return Number.isFinite(v) && v > 0 ? v : 1;
1502
+ }), be = U(() => {
1503
+ const v = Number(M.value?.capacity);
1504
+ return Number.isFinite(v) && v > 0 ? v : 1;
1505
+ }), ne = U(() => {
1506
+ const v = Number(b.value?.pricingOption?.duration);
1507
+ if (Number.isFinite(v) && v > 0) return v;
1508
+ const y = K(b.value?.startTime), q = K(b.value?.endTime);
1509
+ return y === null || q === null || q <= y ? 0 : q - y;
1510
+ }), K = (v) => {
1511
+ if (!v || !W.test(v)) return null;
1512
+ const [y, q] = v.split(":").map(Number);
1513
+ return y * 60 + q;
1514
+ }, ye = (v) => {
1515
+ const y = (v % 1440 + 1440) % 1440, q = Math.floor(y / 60), G = y % 60;
1516
+ return `${q.toString().padStart(2, "0")}:${G.toString().padStart(2, "0")}`;
1517
+ }, $e = (v) => {
1518
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(v)) return null;
1519
+ const [y, q, G] = v.split("-").map(Number), I = new Date(y, q - 1, G);
1520
+ return Number.isNaN(I.getTime()) || I.getFullYear() !== y || I.getMonth() !== q - 1 || I.getDate() !== G ? null : I;
1521
+ }, Re = (v, y) => (h.agendaData?.exceptions || []).find((G) => y >= G.startDate && y <= G.endDate ? !G.resourceIds || G.resourceIds.length === 0 ? !0 : G.resourceIds.includes(v) : !1) || null, m = () => {
1522
+ const v = M.value, y = $e(k.value);
1523
+ if (!v || !y) return [];
1524
+ const q = Re(v.id, k.value);
1525
+ if (q)
1526
+ return q.isClosed ? [] : (q.timeslots || []).map((I) => ({
1527
+ start: I.startTime,
1528
+ end: I.endTime
1529
+ }));
1530
+ const G = y.getDay();
1531
+ return v.openingHours?.[G] || [];
1532
+ }, g = U(() => {
1533
+ const v = M.value;
1534
+ if (!v) return [];
1535
+ const y = Number(v.interval) > 0 ? Number(v.interval) : 60, q = ne.value, G = /* @__PURE__ */ new Set();
1536
+ for (const I of m()) {
1537
+ const Q = K(I.start), ie = K(I.end);
1538
+ if (Q === null || ie === null || ie <= Q) continue;
1539
+ const ge = q > 0 ? ie - q : ie - y;
1540
+ for (let pe = Q; pe <= ge; pe += y)
1541
+ G.add(ye(pe));
1542
+ }
1543
+ return Array.from(G).sort((I, Q) => (K(I) ?? 0) - (K(Q) ?? 0));
1544
+ }), X = U(() => {
1545
+ if (ne.value <= 0) return "";
1546
+ const v = K(w.value);
1547
+ return v === null ? "" : ye(v + ne.value);
1548
+ }), A = U(() => !!(b.value?.id && b.value?.res_id && k.value && C.value && w.value && X.value && W.test(w.value) && g.value.includes(w.value))), oe = U(() => n.value !== null && n.value >= Y.value), xe = U(() => {
1549
+ if (!A.value) return "";
1550
+ if (l.value) return "Checking availability...";
1551
+ if (D.value) return D.value;
1552
+ if (n.value === null || O.value === null) return "";
1553
+ if (!oe.value) {
1554
+ const y = Math.max(n.value, 0);
1555
+ return `${y} ${y === 1 ? "spot is" : "spots are"} available. This reservation needs ${Y.value}.`;
1556
+ }
1557
+ const v = n.value - Y.value;
1558
+ return `${n.value} of ${be.value} ${be.value === 1 ? "spot is" : "spots are"} available. ${v} ${v === 1 ? "spot" : "spots"} will remain.`;
1559
+ }), _e = U(() => !!(A.value && oe.value && !l.value && !p.value)), Se = () => {
1560
+ D.value = "", O.value = null, n.value = null;
1561
+ }, Ae = (v) => ["approved", "needs_approval"].includes(v?.status), fe = (v, y, q, G) => v < G && y > q, Me = async () => {
1562
+ if (!A.value) return null;
1563
+ const v = K(w.value), y = K(X.value);
1564
+ if (v === null || y === null || y <= v) return null;
1565
+ const q = `${C.value}_${k.value}`, G = [
1566
+ { field: "status", operator: "==", value: "confirmed" },
1567
+ { field: "flattenedReservationDates", operator: "array-contains-any", value: [q] }
1568
+ ];
1569
+ V.value && G.unshift({ field: "agendaId", operator: "==", value: V.value });
1570
+ const I = await R.find(E.reservationsCollection, { filters: G }), Q = b.value?.id || b.value?.orderId, ie = b.value?.res_id;
1571
+ let ge = 0;
1572
+ for (const we of I || []) {
1573
+ const he = we?.id || we?.orderId, u = we?.reservations || [];
1574
+ for (const s of u) {
1575
+ if (s?.id === ie && (!he || he === Q) || !Ae(s) || s?.date !== k.value || s?.resourceId !== C.value) continue;
1576
+ const H = K(s?.timeslot?.startTime), ee = K(s?.timeslot?.endTime);
1577
+ if (H === null || ee === null || ee <= H || !fe(v, y, H, ee)) continue;
1578
+ const ue = Number(s?.spots);
1579
+ ge += Number.isFinite(ue) && ue > 0 ? ue : 1;
1580
+ }
1581
+ }
1582
+ const pe = be.value;
1583
+ return {
1584
+ reserved: ge,
1585
+ available: pe - ge
1586
+ };
1587
+ }, je = async () => {
1588
+ const v = ++S;
1589
+ if (Se(), !A.value)
1590
+ return l.value = !1, null;
1591
+ try {
1592
+ l.value = !0;
1593
+ const y = await Me();
1594
+ return v !== S ? null : y ? (O.value = y.reserved, n.value = y.available, y) : (D.value = "Could not check availability for this selection.", null);
1595
+ } catch (y) {
1596
+ return v !== S || (console.error("Error checking transfer availability:", y), D.value = "Could not check availability for this selection."), null;
1597
+ } finally {
1598
+ v === S && (l.value = !1);
1599
+ }
1600
+ }, Pe = (v) => !v?.resourceId || !v?.date ? "" : `${v.resourceId}_${v.date}`, ze = (v) => {
1601
+ const y = v?.timeslot?.startTime;
1602
+ return !v?.resourceId || !v?.date || !y ? "" : `${v.resourceId}_${v.date}_${String(y).replace(":", "")}`;
1603
+ }, Ue = (v) => {
1604
+ const y = v?.id || v?.orderId;
1605
+ !v || !y || (b.value = { ...v, id: y }, k.value = v.date || "", w.value = v.startTime || "", C.value = v.resourceId || ae.value[0]?.id || "", p.value = !1, t.value = "", Se(), N.value = !0, Ne(), je());
1606
+ }, Ne = () => {
1607
+ g.value.includes(w.value) || (w.value = g.value[0] || "");
1608
+ }, Be = async () => {
1609
+ if (!_e.value) {
1610
+ t.value = A.value ? "Not enough spots are available for this transfer." : "Select a resource, date, and time before transferring.";
1611
+ return;
1612
+ }
1613
+ try {
1614
+ p.value = !0, t.value = "";
1615
+ const v = await je();
1616
+ if (!v || v.available < Y.value) {
1617
+ t.value = "Not enough spots are available for this transfer.";
1618
+ return;
1619
+ }
1620
+ const y = b.value.id, q = b.value.res_id, G = await R.get(E.reservationsCollection, y), I = G?.reservations || [], Q = I.find((s) => s.id === q);
1621
+ if (!Q)
1622
+ throw new Error("Reservation not found");
1623
+ const ie = M.value, ge = {
1624
+ ...Q,
1625
+ date: k.value,
1626
+ resource: ie ? {
1627
+ ...Q.resource,
1628
+ avatarLabel: ie.avatarLabel || "",
1629
+ color: ie.color || "",
1630
+ description: ie.description || "",
1631
+ id: ie.id,
1632
+ name: ie.name || ""
1633
+ } : Q.resource,
1634
+ resourceId: C.value,
1635
+ timeslot: {
1636
+ ...Q.timeslot,
1637
+ startTime: w.value,
1638
+ endTime: X.value || w.value
1639
+ }
1640
+ }, pe = I.map((s) => s.id === q ? ge : s), we = Array.from(new Set(pe.map(Pe).filter(Boolean))), he = pe.map(ze).filter(Boolean), u = {
1641
+ reservations: pe,
1642
+ flattenedReservationDates: we,
1643
+ flattenedReservations: he,
1644
+ updatedAt: /* @__PURE__ */ new Date()
1645
+ };
1646
+ await R.update(E.reservationsCollection, y, u), ce.success("Reservation transferred successfully"), z("transferred", {
1647
+ orderId: y,
1648
+ reservationId: q,
1649
+ reservation: ge,
1650
+ order: {
1651
+ ...G,
1652
+ ...u,
1653
+ id: y
1654
+ }
1655
+ }), N.value = !1;
1656
+ } catch (v) {
1657
+ console.error("Error transferring reservation:", v), t.value = "Failed to transfer reservation.", ce.error("Failed to transfer reservation");
1658
+ } finally {
1659
+ p.value = !1;
1660
+ }
1661
+ };
1662
+ return We([C, k], () => {
1663
+ N.value && Ne();
1664
+ }), We([C, k, w, X], () => {
1665
+ N.value && je();
1666
+ }), x({
1667
+ openDialog: Ue
1668
+ }), (v, y) => {
1669
+ const q = c("DialogTitle"), G = c("DialogDescription"), I = c("DialogHeader"), Q = c("Label"), ie = c("SelectValue"), ge = c("SelectTrigger"), pe = c("SelectItem"), we = c("SelectContent"), he = c("Select"), u = c("Input"), s = c("Button"), H = c("DialogFooter"), ee = c("DialogScrollContent"), ue = c("Dialog");
1670
+ return i(), J(ue, {
1671
+ open: N.value,
1672
+ "onUpdate:open": y[4] || (y[4] = (B) => N.value = B)
1673
+ }, {
1674
+ default: r(() => [
1675
+ a(ee, { class: "sm:max-w-3xl" }, {
1676
+ default: r(() => [
1677
+ a(I, null, {
1678
+ default: r(() => [
1679
+ a(q, null, {
1680
+ default: r(() => [...y[5] || (y[5] = [
1681
+ $(" Transfer Reservation ", -1)
1682
+ ])]),
1683
+ _: 1
1684
+ }),
1685
+ a(G)
1686
+ ]),
1687
+ _: 1
1688
+ }),
1689
+ e("div", ia, [
1690
+ y[10] || (y[10] = e("p", { class: "text-sm text-muted-foreground" }, " This will transfer the reservation to another date, time or resource. ", -1)),
1691
+ e("div", da, [
1692
+ e("div", ua, [
1693
+ a(Q, { for: "transfer-reservation-resource" }, {
1694
+ default: r(() => [...y[6] || (y[6] = [
1695
+ $("Resource", -1)
1696
+ ])]),
1697
+ _: 1
1698
+ }),
1699
+ a(he, {
1700
+ modelValue: C.value,
1701
+ "onUpdate:modelValue": y[0] || (y[0] = (B) => C.value = B)
1702
+ }, {
1703
+ default: r(() => [
1704
+ a(ge, {
1705
+ id: "transfer-reservation-resource",
1706
+ class: "w-full"
1707
+ }, {
1708
+ default: r(() => [
1709
+ a(ie, { placeholder: "Select a resource" })
1710
+ ]),
1711
+ _: 1
1712
+ }),
1713
+ a(we, null, {
1714
+ default: r(() => [
1715
+ (i(!0), _(re, null, me(ae.value, (B) => (i(), J(pe, {
1716
+ key: B.id,
1717
+ value: B.id
1718
+ }, {
1719
+ default: r(() => [
1720
+ $(f(B.name), 1)
1721
+ ]),
1722
+ _: 2
1723
+ }, 1032, ["value"]))), 128))
1724
+ ]),
1725
+ _: 1
1726
+ })
1727
+ ]),
1728
+ _: 1
1729
+ }, 8, ["modelValue"])
1730
+ ]),
1731
+ e("div", ca, [
1732
+ a(Q, { for: "transfer-reservation-date" }, {
1733
+ default: r(() => [...y[7] || (y[7] = [
1734
+ $("Date", -1)
1735
+ ])]),
1736
+ _: 1
1737
+ }),
1738
+ a(u, {
1739
+ id: "transfer-reservation-date",
1740
+ modelValue: k.value,
1741
+ "onUpdate:modelValue": y[1] || (y[1] = (B) => k.value = B),
1742
+ type: "date"
1743
+ }, null, 8, ["modelValue"])
1744
+ ]),
1745
+ e("div", pa, [
1746
+ a(Q, { for: "transfer-reservation-hour" }, {
1747
+ default: r(() => [...y[8] || (y[8] = [
1748
+ $("Hour", -1)
1749
+ ])]),
1750
+ _: 1
1751
+ }),
1752
+ a(he, {
1753
+ modelValue: w.value,
1754
+ "onUpdate:modelValue": y[2] || (y[2] = (B) => w.value = B)
1755
+ }, {
1756
+ default: r(() => [
1757
+ a(ge, {
1758
+ id: "transfer-reservation-hour",
1759
+ class: "w-full"
1760
+ }, {
1761
+ default: r(() => [
1762
+ a(ie, { placeholder: "Select an hour" })
1763
+ ]),
1764
+ _: 1
1765
+ }),
1766
+ a(we, null, {
1767
+ default: r(() => [
1768
+ (i(!0), _(re, null, me(g.value, (B) => (i(), J(pe, {
1769
+ key: B,
1770
+ value: B
1771
+ }, {
1772
+ default: r(() => [
1773
+ $(f(B), 1)
1774
+ ]),
1775
+ _: 2
1776
+ }, 1032, ["value"]))), 128))
1777
+ ]),
1778
+ _: 1
1779
+ })
1780
+ ]),
1781
+ _: 1
1782
+ }, 8, ["modelValue"]),
1783
+ C.value && k.value && g.value.length === 0 ? (i(), _("p", va, " No times are available for this resource on the selected date. ")) : T("", !0)
1784
+ ])
1785
+ ]),
1786
+ e("div", ma, [
1787
+ y[9] || (y[9] = e("p", { class: "text-xs font-medium uppercase tracking-[0.2em] text-muted-foreground" }, " Preview ", -1)),
1788
+ e("p", fa, [
1789
+ $(" Reservation will be moved to " + f(k.value || "no date selected") + " at " + f(w.value || "no hour selected"), 1),
1790
+ X.value ? (i(), _("span", ga, " - " + f(X.value), 1)) : T("", !0),
1791
+ $(" in " + f(j.value) + ". ", 1)
1792
+ ])
1793
+ ]),
1794
+ A.value ? (i(), _("div", {
1795
+ key: 0,
1796
+ class: Z(["mt-4 rounded-lg border p-4 text-sm", {
1797
+ "bg-muted/30 text-muted-foreground": l.value,
1798
+ "border-red-200 bg-red-50 text-red-700 dark:border-red-900/50 dark:bg-red-950/30 dark:text-red-300": !l.value && (D.value || !oe.value),
1799
+ "border-green-200 bg-green-50 text-green-700 dark:border-green-900/50 dark:bg-green-950/10 dark:text-green-300": !l.value && !D.value && oe.value
1800
+ }])
1801
+ }, f(xe.value), 3)) : T("", !0),
1802
+ t.value ? (i(), _("p", ba, f(t.value), 1)) : T("", !0)
1803
+ ]),
1804
+ a(H, null, {
1805
+ default: r(() => [
1806
+ a(s, {
1807
+ variant: "outline",
1808
+ disabled: p.value,
1809
+ onClick: y[3] || (y[3] = (B) => N.value = !1)
1810
+ }, {
1811
+ default: r(() => [...y[11] || (y[11] = [
1812
+ $("Close", -1)
1813
+ ])]),
1814
+ _: 1
1815
+ }, 8, ["disabled"]),
1816
+ a(s, {
1817
+ disabled: !_e.value,
1818
+ onClick: Be
1819
+ }, {
1820
+ default: r(() => [
1821
+ $(f(p.value ? "Transferring..." : "Transfer reservation"), 1)
1822
+ ]),
1823
+ _: 1
1824
+ }, 8, ["disabled"])
1825
+ ]),
1826
+ _: 1
1827
+ })
1828
+ ]),
1829
+ _: 1
1830
+ })
1831
+ ]),
1832
+ _: 1
1833
+ }, 8, ["open"]);
1834
+ };
1835
+ }
1836
+ }), xa = { class: "flex items-center bg-muted/70 dark:bg-muted/20 px-4 rounded-md" }, _a = { class: "grid gap-2" }, wa = { class: "grid gap-2" }, ha = { class: "grid gap-2" }, ka = /* @__PURE__ */ De({
1837
+ __name: "ApproveReservationDialog",
1838
+ emits: ["confirm"],
1839
+ setup(o, { expose: x, emit: L }) {
1840
+ const { config: h } = Oe(), { sendMail: z } = Ke(h.mailAccount), E = L, d = F(!1), R = F("approve"), N = F(!1), b = F(""), k = F(""), w = F(""), C = (l, t) => {
1841
+ N.value = !h.mailAccount, d.value = !0, l && (t || (t = "approve"), R.value = t, b.value = l.customerInfo?.email, k.value = "Confirmation: Your reservation for " + new Date(l.date)?.toDateString(), w.value = `Dear ${l.customerInfo?.firstName ?? ""} ${l.customerInfo?.lastName ?? ""},
1842
+
1843
+ This email confirms your reservation for ${new Date(l.date)?.toDateString()} at ${l.startTime}.
1844
+
1845
+ We've got everything ready for you and look forward to your visit! If you need to make any changes or have special requests, please let us know.`);
1846
+ }, p = () => {
1847
+ if (!N.value) {
1848
+ if (!b.value || !k.value || !w.value) return alert("Please fill in all the fields.");
1849
+ z({
1850
+ to: b.value,
1851
+ subject: k.value,
1852
+ body: w.value
1853
+ });
1854
+ }
1855
+ d.value = !1;
1856
+ const { $confetti: l } = useNuxtApp();
1857
+ l(), E("confirm");
1858
+ };
1859
+ return x({
1860
+ openDialog: C
1861
+ }), (l, t) => {
1862
+ const D = c("DialogTitle"), O = c("DialogDescription"), n = c("DialogHeader"), S = c("Checkbox"), W = c("Label"), te = c("Input"), le = c("Textarea"), ae = c("Button"), M = c("DialogFooter"), j = c("DialogScrollContent"), V = c("Dialog");
1863
+ return i(), J(V, {
1864
+ open: d.value,
1865
+ "onUpdate:open": t[5] || (t[5] = (Y) => d.value = Y)
1866
+ }, {
1867
+ default: r(() => [
1868
+ a(j, { class: "sm:max-w-3xl" }, {
1869
+ default: r(() => [
1870
+ a(n, null, {
1871
+ default: r(() => [
1872
+ a(D, null, {
1873
+ default: r(() => [
1874
+ $(f(R.value === "approve" ? "Approve Reservation" : "Resend Confirmation Email"), 1)
1875
+ ]),
1876
+ _: 1
1877
+ }),
1878
+ a(O)
1879
+ ]),
1880
+ _: 1
1881
+ }),
1882
+ e("div", xa, [
1883
+ a(S, {
1884
+ modelValue: N.value,
1885
+ "onUpdate:modelValue": t[0] || (t[0] = (Y) => N.value = Y),
1886
+ id: "reject-dialog-skip-mail",
1887
+ class: "border-black/80 dark:border-gray-200",
1888
+ disabled: !P(h).mailAccount
1889
+ }, null, 8, ["modelValue", "disabled"]),
1890
+ a(W, {
1891
+ for: "reject-dialog-skip-mail",
1892
+ class: "py-4 pl-2 pr-4"
1893
+ }, {
1894
+ default: r(() => [...t[6] || (t[6] = [
1895
+ $("Do not send email to customer", -1)
1896
+ ])]),
1897
+ _: 1
1898
+ })
1899
+ ]),
1900
+ e("div", {
1901
+ class: Z(["grid gap-4 py-4", { "opacity-50": N.value }])
1902
+ }, [
1903
+ e("div", _a, [
1904
+ a(W, { for: "approve-dialog-email" }, {
1905
+ default: r(() => [...t[7] || (t[7] = [
1906
+ $("To:", -1)
1907
+ ])]),
1908
+ _: 1
1909
+ }),
1910
+ a(te, {
1911
+ modelValue: b.value,
1912
+ "onUpdate:modelValue": t[1] || (t[1] = (Y) => b.value = Y),
1913
+ disabled: N.value,
1914
+ id: "approve-dialog-email"
1915
+ }, null, 8, ["modelValue", "disabled"])
1916
+ ]),
1917
+ e("div", wa, [
1918
+ a(W, { for: "approve-dialog-subject" }, {
1919
+ default: r(() => [...t[8] || (t[8] = [
1920
+ $("Subject:", -1)
1921
+ ])]),
1922
+ _: 1
1923
+ }),
1924
+ a(te, {
1925
+ modelValue: k.value,
1926
+ "onUpdate:modelValue": t[2] || (t[2] = (Y) => k.value = Y),
1927
+ disabled: N.value,
1928
+ id: "approve-dialog-subject"
1929
+ }, null, 8, ["modelValue", "disabled"])
1930
+ ]),
1931
+ e("div", ha, [
1932
+ a(W, { for: "approve-dialog-body" }, {
1933
+ default: r(() => [...t[9] || (t[9] = [
1934
+ $("Body:", -1)
1935
+ ])]),
1936
+ _: 1
1937
+ }),
1938
+ a(le, {
1939
+ modelValue: w.value,
1940
+ "onUpdate:modelValue": t[3] || (t[3] = (Y) => w.value = Y),
1941
+ disabled: N.value,
1942
+ id: "approve-dialog-body"
1943
+ }, null, 8, ["modelValue", "disabled"])
1944
+ ])
1945
+ ], 2),
1946
+ a(M, null, {
1947
+ default: r(() => [
1948
+ a(ae, {
1949
+ variant: "outline",
1950
+ onClick: t[4] || (t[4] = (Y) => d.value = !1)
1951
+ }, {
1952
+ default: r(() => [...t[10] || (t[10] = [
1953
+ $("Close", -1)
1954
+ ])]),
1955
+ _: 1
1956
+ }),
1957
+ a(ae, { onClick: p }, {
1958
+ default: r(() => [...t[11] || (t[11] = [
1959
+ $("Approve reservation", -1)
1960
+ ])]),
1961
+ _: 1
1962
+ })
1963
+ ]),
1964
+ _: 1
1965
+ })
1966
+ ]),
1967
+ _: 1
1968
+ })
1969
+ ]),
1970
+ _: 1
1971
+ }, 8, ["open"]);
1972
+ };
1973
+ }
1974
+ }), $a = { class: "flex items-center bg-muted/70 dark:bg-muted/20 px-4 rounded-md" }, Da = { class: "grid gap-2" }, Ra = { class: "grid gap-2" }, Ca = { class: "grid gap-2" }, Sa = /* @__PURE__ */ De({
1975
+ __name: "RejectReservationDialog",
1976
+ emits: ["confirm"],
1977
+ setup(o, { expose: x, emit: L }) {
1978
+ const { config: h } = Oe(), { sendMail: z } = Ke(h.mailAccount), E = L, d = F(!1), R = F(!1), N = F(""), b = F(""), k = F(""), w = (p) => {
1979
+ R.value = !h.mailAccount, d.value = !0, p && (N.value = p.customerInfo?.email, b.value = "Regarding your reservation request for " + new Date(p.date)?.toDateString(), k.value = `Dear ${p.customerInfo?.firstName ?? ""} ${p.customerInfo?.lastName ?? ""},
1980
+
1981
+ Thank you for your interest in booking with us. Unfortunately, we are unable to confirm your request for ${new Date(p.date)?.toDateString()} at ${p.startTime}.
1982
+
1983
+ We would love to see you another time!`);
1984
+ }, C = () => {
1985
+ if (!R.value) {
1986
+ if (!N.value || !b.value || !k.value) return alert("Please fill in all the fields.");
1987
+ z({
1988
+ to: N.value,
1989
+ subject: b.value,
1990
+ body: k.value
1991
+ });
1992
+ }
1993
+ d.value = !1;
1994
+ const { $confetti: p } = useNuxtApp();
1995
+ p(), E("confirm");
1996
+ };
1997
+ return x({
1998
+ openDialog: w
1999
+ }), (p, l) => {
2000
+ const t = c("DialogTitle"), D = c("DialogDescription"), O = c("DialogHeader"), n = c("Checkbox"), S = c("Label"), W = c("Input"), te = c("Textarea"), le = c("Button"), ae = c("DialogFooter"), M = c("DialogScrollContent"), j = c("Dialog");
2001
+ return i(), J(j, {
2002
+ open: d.value,
2003
+ "onUpdate:open": l[5] || (l[5] = (V) => d.value = V)
2004
+ }, {
2005
+ default: r(() => [
2006
+ a(M, { class: "sm:max-w-3xl" }, {
2007
+ default: r(() => [
2008
+ a(O, null, {
2009
+ default: r(() => [
2010
+ a(t, null, {
2011
+ default: r(() => [...l[6] || (l[6] = [
2012
+ $(" Reject Reservation Request ", -1)
2013
+ ])]),
2014
+ _: 1
2015
+ }),
2016
+ a(D)
2017
+ ]),
2018
+ _: 1
2019
+ }),
2020
+ e("div", $a, [
2021
+ a(n, {
2022
+ modelValue: R.value,
2023
+ "onUpdate:modelValue": l[0] || (l[0] = (V) => R.value = V),
2024
+ id: "reject-dialog-skip-mail",
2025
+ class: "border-black/80 dark:border-gray-200",
2026
+ disabled: !P(h).mailAccount
2027
+ }, null, 8, ["modelValue", "disabled"]),
2028
+ a(S, {
2029
+ for: "reject-dialog-skip-mail",
2030
+ class: "py-4 pl-2 pr-4"
2031
+ }, {
2032
+ default: r(() => [...l[7] || (l[7] = [
2033
+ $("Do not send email to customer", -1)
2034
+ ])]),
2035
+ _: 1
2036
+ })
2037
+ ]),
2038
+ e("div", {
2039
+ class: Z(["grid gap-4 py-4", { "opacity-50": R.value }])
2040
+ }, [
2041
+ e("div", Da, [
2042
+ a(S, { for: "reject-dialog-email" }, {
2043
+ default: r(() => [...l[8] || (l[8] = [
2044
+ $("To:", -1)
2045
+ ])]),
2046
+ _: 1
2047
+ }),
2048
+ a(W, {
2049
+ modelValue: N.value,
2050
+ "onUpdate:modelValue": l[1] || (l[1] = (V) => N.value = V),
2051
+ disabled: R.value,
2052
+ id: "reject-dialog-email"
2053
+ }, null, 8, ["modelValue", "disabled"])
2054
+ ]),
2055
+ e("div", Ra, [
2056
+ a(S, { for: "reject-dialog-subject" }, {
2057
+ default: r(() => [...l[9] || (l[9] = [
2058
+ $("Subject:", -1)
2059
+ ])]),
2060
+ _: 1
2061
+ }),
2062
+ a(W, {
2063
+ modelValue: b.value,
2064
+ "onUpdate:modelValue": l[2] || (l[2] = (V) => b.value = V),
2065
+ disabled: R.value,
2066
+ id: "reject-dialog-subject"
2067
+ }, null, 8, ["modelValue", "disabled"])
2068
+ ]),
2069
+ e("div", Ca, [
2070
+ a(S, { for: "reject-dialog-body" }, {
2071
+ default: r(() => [...l[10] || (l[10] = [
2072
+ $("Body:", -1)
2073
+ ])]),
2074
+ _: 1
2075
+ }),
2076
+ a(te, {
2077
+ modelValue: k.value,
2078
+ "onUpdate:modelValue": l[3] || (l[3] = (V) => k.value = V),
2079
+ disabled: R.value,
2080
+ id: "reject-dialog-body"
2081
+ }, null, 8, ["modelValue", "disabled"])
2082
+ ])
2083
+ ], 2),
2084
+ a(ae, null, {
2085
+ default: r(() => [
2086
+ a(le, {
2087
+ variant: "outline",
2088
+ onClick: l[4] || (l[4] = (V) => d.value = !1)
2089
+ }, {
2090
+ default: r(() => [...l[11] || (l[11] = [
2091
+ $("Close", -1)
2092
+ ])]),
2093
+ _: 1
2094
+ }),
2095
+ a(le, {
2096
+ variant: "destructive",
2097
+ onClick: C
2098
+ }, {
2099
+ default: r(() => [...l[12] || (l[12] = [
2100
+ $("Reject reservation", -1)
2101
+ ])]),
2102
+ _: 1
2103
+ })
2104
+ ]),
2105
+ _: 1
2106
+ })
2107
+ ]),
2108
+ _: 1
2109
+ })
2110
+ ]),
2111
+ _: 1
2112
+ }, 8, ["open"]);
2113
+ };
2114
+ }
2115
+ }), Aa = { class: "flex items-start justify-between gap-3" }, ja = { class: "min-w-0" }, Ia = { class: "text-xs text-muted-foreground" }, Ma = {
2116
+ key: 0,
2117
+ class: "shrink-0 rounded-md bg-green-100 px-2 py-1 text-xs font-medium text-green-700 dark:bg-green-900/30 dark:text-green-300"
2118
+ }, Na = { class: "grid grid-cols-[110px_1fr] gap-3" }, Ta = { class: "min-w-0 whitespace-pre-wrap break-words text-right" }, Fa = { class: "text-muted-foreground" }, Va = { class: "min-w-0 break-words text-right" }, Oa = {
2119
+ key: 0,
2120
+ class: "grid grid-cols-[110px_1fr] gap-3"
2121
+ }, Pa = { class: "min-w-0 break-words text-right" }, xt = /* @__PURE__ */ De({
2122
+ __name: "RefundDetailsDisplay",
2123
+ props: {
2124
+ refunds: {},
2125
+ compact: { type: Boolean, default: !1 }
2126
+ },
2127
+ setup(o) {
2128
+ const x = o, L = U(() => (Array.isArray(x.refunds) ? x.refunds : []).filter(Boolean).slice().reverse()), h = (b) => {
2129
+ const k = Number(b);
2130
+ return Number.isNaN(k) ? "-" : `€${k.toFixed(2)}`;
2131
+ }, z = (b) => {
2132
+ if (!b) return "-";
2133
+ const k = new Date(b);
2134
+ return Number.isNaN(k.getTime()) ? b : k.toLocaleString("en-US", {
2135
+ month: "short",
2136
+ day: "numeric",
2137
+ year: "numeric",
2138
+ hour: "2-digit",
2139
+ minute: "2-digit"
2140
+ });
2141
+ }, E = (b) => b === !0 ? "Yes" : b === !1 ? "No" : b == null || b === "" ? "-" : typeof b == "object" ? JSON.stringify(b) : String(b), d = (b) => {
2142
+ const k = b?.fields || {}, w = Array.isArray(b?.fieldDefinitions) ? b.fieldDefinitions : [], C = /* @__PURE__ */ new Set(), p = w.filter((t) => t?.key && Object.prototype.hasOwnProperty.call(k, t.key)).map((t) => (C.add(t.key), {
2143
+ key: t.key,
2144
+ label: t.label || t.key,
2145
+ value: k[t.key]
2146
+ })), l = Object.entries(k).filter(([t]) => !C.has(t)).map(([t, D]) => ({
2147
+ key: t,
2148
+ label: t,
2149
+ value: D
2150
+ }));
2151
+ return [...p, ...l];
2152
+ }, R = (b) => b?.processedAt || b?.requestedAt, N = (b) => b?.reason || b?.note || "-";
2153
+ return (b, k) => L.value.length ? (i(), _("div", {
2154
+ key: 0,
2155
+ class: Z(o.compact ? "space-y-2" : "space-y-3")
2156
+ }, [
2157
+ (i(!0), _(re, null, me(L.value, (w, C) => (i(), _("div", {
2158
+ key: w.processedAt || w.requestedAt || C,
2159
+ class: Z(["rounded-lg border bg-background/70", o.compact ? "p-3 space-y-2" : "p-4 space-y-3"])
2160
+ }, [
2161
+ e("div", Aa, [
2162
+ e("div", ja, [
2163
+ e("p", {
2164
+ class: Z(o.compact ? "text-xs font-medium" : "text-sm font-medium")
2165
+ }, f(w.hasAmount === !1 ? "Refund flow processed" : "Refund processed"), 3),
2166
+ e("p", Ia, f(z(R(w))), 1)
2167
+ ]),
2168
+ w.hasAmount !== !1 ? (i(), _("div", Ma, f(h(w.amount)), 1)) : T("", !0)
2169
+ ]),
2170
+ e("div", {
2171
+ class: Z(o.compact ? "grid gap-1.5 text-xs" : "grid gap-2 text-sm")
2172
+ }, [
2173
+ e("div", Na, [
2174
+ k[0] || (k[0] = e("span", { class: "text-muted-foreground" }, "Reason", -1)),
2175
+ e("span", Ta, f(N(w)), 1)
2176
+ ]),
2177
+ (i(!0), _(re, null, me(d(w), (p) => (i(), _("div", {
2178
+ key: p.key,
2179
+ class: "grid grid-cols-[110px_1fr] gap-3"
2180
+ }, [
2181
+ e("span", Fa, f(p.label), 1),
2182
+ e("span", Va, f(E(p.value)), 1)
2183
+ ]))), 128)),
2184
+ w.notification ? (i(), _("div", Oa, [
2185
+ k[1] || (k[1] = e("span", { class: "text-muted-foreground" }, "Email", -1)),
2186
+ e("span", Pa, f(w.notification.skipped ? "Skipped" : w.notification.to || "Sent"), 1)
2187
+ ])) : T("", !0)
2188
+ ], 2)
2189
+ ], 2))), 128))
2190
+ ], 2)) : T("", !0);
2191
+ }
2192
+ }), za = { key: 0 }, Ua = {
2193
+ key: 0,
2194
+ class: "flex items-center gap-1.5 flex-wrap"
2195
+ }, Ba = {
2196
+ key: 0,
2197
+ class: "space-y-2 mb-4"
2198
+ }, Ea = { class: "text-xs font-medium text-muted-foreground uppercase tracking-wide" }, La = {
2199
+ key: 1,
2200
+ class: "flex flex-wrap gap-2 mb-4"
2201
+ }, Ha = {
2202
+ key: 1,
2203
+ class: "text-xs text-muted-foreground mr-0.5"
2204
+ }, qa = {
2205
+ key: 2,
2206
+ class: "space-y-3"
2207
+ }, Wa = { class: "bg-muted/30 rounded-lg p-4 space-y-2" }, Ga = { class: "text-muted-foreground flex items-center gap-1.5" }, qe = "appearance-none border-0 bg-transparent hover:bg-transparent h-4 p-0 text-inherit underline decoration-dotted underline-offset-2 decoration-current/40 transition-colors hover:decoration-current focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring rounded-sm disabled:cursor-not-allowed disabled:opacity-60", Ye = /* @__PURE__ */ De({
2208
+ __name: "OrderMetadataDisplay",
2209
+ props: {
2210
+ metadata: { default: () => ({}) },
2211
+ schema: { default: () => [] },
2212
+ displayFilter: { default: void 0 },
2213
+ scope: { default: void 0 },
2214
+ compact: { type: Boolean, default: !1 },
2215
+ enableActions: { type: Boolean, default: !1 },
2216
+ actionsDisabled: { type: Boolean, default: !1 }
2217
+ },
2218
+ emits: ["run-action"],
2219
+ setup(o, { expose: x, emit: L }) {
2220
+ const h = Dt, z = o, E = L, d = (D) => D && h[D] || null, R = U(() => {
2221
+ if (!z.metadata) return [];
2222
+ const D = new Set(z.schema?.map((S) => S.key) || []), O = (z.schema || []).filter((S) => !(z.scope && S.scope !== z.scope || z.displayFilter && !z.displayFilter.includes(S.display) || z.metadata[S.key] === void 0 || z.metadata[S.key] === null || S.display === "hidden" || z.metadata[S.key] === !1)).sort((S, W) => (S.order || 0) - (W.order || 0)).map((S) => ({
2223
+ ...S,
2224
+ value: z.metadata[S.key]
2225
+ }));
2226
+ if (z.displayFilter && !z.displayFilter.includes("field")) return O;
2227
+ const n = Object.entries(z.metadata).filter(([S, W]) => !D.has(S) && W !== void 0 && W !== null && W !== !1).map(([S, W]) => ({
2228
+ id: `_fallback_${S}`,
2229
+ key: S,
2230
+ label: S.replace(/([A-Z])/g, " $1").replace(/[_-]/g, " ").replace(/^\w/, (te) => te.toUpperCase()).trim(),
2231
+ display: "field",
2232
+ scope: "order",
2233
+ value: typeof W == "object" ? JSON.stringify(W) : String(W)
2234
+ }));
2235
+ return [...O, ...n];
2236
+ }), N = U(() => R.value.filter((D) => D.display === "highlight")), b = U(() => R.value.filter((D) => D.display === "badge")), k = U(() => R.value.filter((D) => D.display === "field")), w = U(() => R.value.length > 0), C = (D) => Object.keys(D.action?.flow || {}).length > 0, p = (D) => z.enableActions && C(D), l = (D) => {
2237
+ !p(D) || z.actionsDisabled || E("run-action", {
2238
+ field: D,
2239
+ value: D.value
2240
+ });
2241
+ }, t = (D, O) => {
2242
+ p(D) && (O.stopPropagation(), l(D));
2243
+ };
2244
+ return x({ hasContent: w }), (D, O) => w.value ? (i(), _("div", za, [
2245
+ o.compact ? (i(), _("div", Ua, [
2246
+ (i(!0), _(re, null, me(N.value, (n) => (i(), _("span", {
2247
+ key: n.id,
2248
+ class: Z(["inline-flex items-center gap-1 px-2 py-0.5 text-xs font-bold rounded-md appearance-none border-0", n.color ? "" : "bg-primary/10 text-primary"]),
2249
+ style: Ce(n.color ? { backgroundColor: n.color + "20", color: n.color } : {})
2250
+ }, [
2251
+ d(n.icon) ? (i(), J(ke(d(n.icon)), {
2252
+ key: 0,
2253
+ size: 12
2254
+ })) : T("", !0),
2255
+ (i(), J(ke(p(n) ? "button" : "span"), {
2256
+ type: p(n) ? "button" : void 0,
2257
+ disabled: p(n) ? o.actionsDisabled : void 0,
2258
+ class: Z(p(n) ? qe : ""),
2259
+ "aria-label": p(n) ? `Run ${n.label} action` : void 0,
2260
+ onClick: (S) => t(n, S)
2261
+ }, {
2262
+ default: r(() => [
2263
+ $(f(n.value === !0 ? n.label : n.value), 1)
2264
+ ]),
2265
+ _: 2
2266
+ }, 1032, ["type", "disabled", "class", "aria-label", "onClick"]))
2267
+ ], 6))), 128)),
2268
+ (i(!0), _(re, null, me(b.value, (n) => (i(), _("span", {
2269
+ key: n.id,
2270
+ class: Z(["inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full appearance-none border-0", n.color ? "" : "bg-muted text-muted-foreground"]),
2271
+ style: Ce(n.color ? { backgroundColor: n.color + "20", color: n.color } : {})
2272
+ }, [
2273
+ d(n.icon) ? (i(), J(ke(d(n.icon)), {
2274
+ key: 0,
2275
+ size: 10
2276
+ })) : T("", !0),
2277
+ (i(), J(ke(p(n) ? "button" : "span"), {
2278
+ type: p(n) ? "button" : void 0,
2279
+ disabled: p(n) ? o.actionsDisabled : void 0,
2280
+ class: Z(p(n) ? qe : ""),
2281
+ "aria-label": p(n) ? `Run ${n.label} action` : void 0,
2282
+ onClick: (S) => t(n, S)
2283
+ }, {
2284
+ default: r(() => [
2285
+ $(f(n.value === !0 ? n.label : n.value), 1)
2286
+ ]),
2287
+ _: 2
2288
+ }, 1032, ["type", "disabled", "class", "aria-label", "onClick"]))
2289
+ ], 6))), 128))
2290
+ ])) : (i(), _(re, { key: 1 }, [
2291
+ N.value.length ? (i(), _("div", Ba, [
2292
+ (i(!0), _(re, null, me(N.value, (n) => (i(), _("div", {
2293
+ key: n.id,
2294
+ class: Z(["rounded-lg border-2 p-4 flex items-center gap-4 appearance-none", n.color ? "" : "border-primary/20 bg-primary/5"]),
2295
+ style: Ce(n.color ? { borderColor: n.color + "40", backgroundColor: n.color + "08" } : {})
2296
+ }, [
2297
+ e("div", {
2298
+ class: Z(["h-12 w-12 rounded-xl flex items-center justify-center shrink-0", n.color ? "" : "bg-primary/10"]),
2299
+ style: Ce(n.color ? { backgroundColor: n.color + "20" } : {})
2300
+ }, [
2301
+ d(n.icon) ? (i(), J(ke(d(n.icon)), {
2302
+ key: 0,
2303
+ size: 24,
2304
+ style: Ce(n.color ? { color: n.color } : {}),
2305
+ class: Z(n.color ? "" : "text-primary")
2306
+ }, null, 8, ["style", "class"])) : T("", !0)
2307
+ ], 6),
2308
+ e("div", null, [
2309
+ e("p", Ea, f(n.label), 1),
2310
+ n.value !== !0 || p(n) ? (i(), J(ke(p(n) ? "button" : "p"), {
2311
+ key: 0,
2312
+ type: p(n) ? "button" : void 0,
2313
+ disabled: p(n) ? o.actionsDisabled : void 0,
2314
+ class: Z(["text-2xl font-bold tracking-wider", p(n) ? qe : ""]),
2315
+ "aria-label": p(n) ? `Run ${n.label} action` : void 0,
2316
+ onClick: (S) => t(n, S)
2317
+ }, {
2318
+ default: r(() => [
2319
+ $(f(n.value === !0 ? "✓" : n.value), 1)
2320
+ ]),
2321
+ _: 2
2322
+ }, 1032, ["type", "disabled", "class", "aria-label", "onClick"])) : T("", !0)
2323
+ ])
2324
+ ], 6))), 128))
2325
+ ])) : T("", !0),
2326
+ b.value.length ? (i(), _("div", La, [
2327
+ (i(!0), _(re, null, me(b.value, (n) => (i(), _("span", {
2328
+ key: n.id,
2329
+ class: Z(["inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-full appearance-none border-0", n.color ? "" : "bg-muted text-muted-foreground"]),
2330
+ style: Ce(n.color ? { backgroundColor: n.color + "20", color: n.color } : {})
2331
+ }, [
2332
+ d(n.icon) ? (i(), J(ke(d(n.icon)), {
2333
+ key: 0,
2334
+ size: 14
2335
+ })) : T("", !0),
2336
+ n.label && n.value !== !0 ? (i(), _("span", Ha, f(n.label) + ":", 1)) : T("", !0),
2337
+ (i(), J(ke(p(n) ? "button" : "span"), {
2338
+ type: p(n) ? "button" : void 0,
2339
+ disabled: p(n) ? o.actionsDisabled : void 0,
2340
+ class: Z(p(n) ? qe : ""),
2341
+ "aria-label": p(n) ? `Run ${n.label} action` : void 0,
2342
+ onClick: (S) => t(n, S)
2343
+ }, {
2344
+ default: r(() => [
2345
+ $(f(n.value === !0 ? n.label : n.value), 1)
2346
+ ]),
2347
+ _: 2
2348
+ }, 1032, ["type", "disabled", "class", "aria-label", "onClick"]))
2349
+ ], 6))), 128))
2350
+ ])) : T("", !0),
2351
+ k.value.length ? (i(), _("div", qa, [
2352
+ O[0] || (O[0] = e("h3", { class: "text-sm font-semibold text-muted-foreground uppercase tracking-wide" }, "Additional Info", -1)),
2353
+ e("div", Wa, [
2354
+ (i(!0), _(re, null, me(k.value, (n) => (i(), _("div", {
2355
+ key: n.id,
2356
+ class: "flex justify-between gap-4 text-sm appearance-none"
2357
+ }, [
2358
+ e("span", Ga, [
2359
+ d(n.icon) ? (i(), J(ke(d(n.icon)), {
2360
+ key: 0,
2361
+ size: 14
2362
+ })) : T("", !0),
2363
+ $(" " + f(n.label), 1)
2364
+ ]),
2365
+ (i(), J(ke(p(n) ? "button" : "span"), {
2366
+ type: p(n) ? "button" : void 0,
2367
+ disabled: p(n) ? o.actionsDisabled : void 0,
2368
+ class: Z(["font-medium text-right break-words", p(n) ? qe : ""]),
2369
+ "aria-label": p(n) ? `Run ${n.label} action` : void 0,
2370
+ onClick: (S) => t(n, S)
2371
+ }, {
2372
+ default: r(() => [
2373
+ $(f(n.value === !0 ? "✓" : n.value), 1)
2374
+ ]),
2375
+ _: 2
2376
+ }, 1032, ["type", "disabled", "class", "aria-label", "onClick"]))
2377
+ ]))), 128))
2378
+ ])
2379
+ ])) : T("", !0)
2380
+ ], 64))
2381
+ ])) : T("", !0);
2382
+ }
2383
+ }), Ja = {
2384
+ key: 0,
2385
+ class: "space-y-6 py-4"
2386
+ }, Ya = { class: "space-y-3" }, Ka = { class: "bg-muted/30 rounded-lg p-4 space-y-3" }, Xa = { class: "flex items-center gap-3" }, Za = { class: "h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center" }, Qa = { class: "font-medium" }, eo = { class: "grid gap-2 text-sm" }, to = {
2387
+ key: 0,
2388
+ class: "flex items-center gap-2 text-muted-foreground"
2389
+ }, ao = ["href"], oo = {
2390
+ key: 1,
2391
+ class: "flex items-center gap-2 text-muted-foreground"
2392
+ }, no = ["href"], so = { class: "space-y-3" }, ro = { class: "grid grid-cols-2 gap-3" }, lo = { class: "bg-muted/30 rounded-lg p-3" }, io = { class: "flex items-center gap-2 text-muted-foreground mb-1" }, uo = { class: "text-xs" }, co = { class: "font-medium" }, po = { class: "bg-muted/30 rounded-lg p-3" }, vo = { class: "flex items-center gap-2 text-muted-foreground mb-1" }, mo = { class: "font-medium" }, fo = {
2393
+ key: 0,
2394
+ class: "bg-muted/30 rounded-lg p-3 col-span-2"
2395
+ }, go = { class: "flex items-center gap-2 text-muted-foreground mb-1" }, bo = { class: "font-medium truncate" }, yo = {
2396
+ key: 0,
2397
+ class: "space-y-3"
2398
+ }, xo = { class: "bg-muted/30 rounded-lg p-4" }, _o = { class: "flex items-start justify-between" }, wo = { class: "flex items-start gap-3" }, ho = { class: "h-9 w-9 rounded-lg bg-primary/10 flex items-center justify-center mt-0.5" }, ko = { class: "font-medium" }, $o = { class: "text-sm text-muted-foreground" }, Do = { class: "font-semibold" }, Ro = { class: "space-y-3" }, Co = { class: "bg-muted/30 rounded-lg p-4 space-y-3" }, So = { class: "space-y-2 text-sm" }, Ao = { class: "flex justify-between" }, jo = {
2399
+ key: 0,
2400
+ class: "flex justify-between"
2401
+ }, Io = {
2402
+ key: 1,
2403
+ class: "grid"
2404
+ }, Mo = { class: "text-muted-foreground" }, No = { key: 0 }, To = { key: 1 }, Fo = { class: "flex justify-between font-semibold" }, Vo = { class: "flex justify-between font-semibold" }, Oo = { class: "flex items-center gap-2" }, Po = {
2405
+ key: 1,
2406
+ class: "space-y-2 text-sm"
2407
+ }, zo = {
2408
+ key: 0,
2409
+ class: "flex justify-between"
2410
+ }, Uo = { class: "text-muted-foreground flex items-center gap-1.5" }, Bo = { class: "text-green-600 dark:text-green-400" }, Eo = {
2411
+ key: 1,
2412
+ class: "flex justify-between"
2413
+ }, Lo = { class: "text-muted-foreground flex items-center gap-1.5" }, Ho = { class: "text-orange-600 dark:text-orange-400 font-medium" }, qo = {
2414
+ key: 1,
2415
+ class: "space-y-3"
2416
+ }, Yn = /* @__PURE__ */ De({
2417
+ __name: "ReservationDetailDialog",
2418
+ props: {
2419
+ agendaData: {},
2420
+ showOrderLink: { type: Boolean, default: !1 },
2421
+ resources: { default: () => [] }
2422
+ },
2423
+ emits: ["cancelled", "confirmed", "rejected", "transferred", "openOrder", "closed"],
2424
+ setup(o, { expose: x, emit: L }) {
2425
+ const h = o, { hasPermission: z } = Vt(), { params: E } = nt(), { config: d } = Oe(), R = vt(d.project), N = pt(), { runFlow: b } = mt(), { sendMail: k } = Ke(d.mailAccount), w = kt("event", F(null)), C = U(() => {
2426
+ const u = Array.isArray(h.resources) ? h.resources : [], s = Array.isArray(h.agendaData?.resources) ? h.agendaData.resources : [], H = [...u, ...s], ee = /* @__PURE__ */ new Set();
2427
+ return H.filter((ue) => {
2428
+ const B = ue?.id;
2429
+ return !B || ee.has(String(B)) ? !1 : (ee.add(String(B)), !0);
2430
+ });
2431
+ }), p = L, l = F(!1), t = F(null), D = F(!1), O = F(!1), n = F({}), S = F(null), W = F(!1), te = U(() => E.value?.id ?? E.id ?? ""), { metadataSchema: le } = yt(te), ae = U(() => t.value?.id || t.value?.orderId || ""), M = U(() => Object.keys(n.value || {}).length > 0), j = U(() => (S.value?.refundFlowEnabled ?? h.agendaData?.refundFlowEnabled) !== !1), V = U(() => M.value && j.value), Y = U(() => {
2432
+ const u = S.value?.refundDialog ?? h.agendaData?.refundDialog;
2433
+ return {
2434
+ showAmount: u?.showAmount !== !1,
2435
+ fields: Array.isArray(u?.fields) ? u.fields : []
2436
+ };
2437
+ }), be = He("cancelReservationDialog"), ne = He("cancelRefundReservationDialog"), K = He("approveReservationDialog"), ye = He("rejectReservationDialog"), $e = He("transferReservationDialog"), Re = (u) => {
2438
+ const s = u?.id || u?.orderId;
2439
+ !u || !s || (t.value = { ...u, id: s }, l.value = !0);
2440
+ }, m = () => {
2441
+ l.value && (l.value = !1, p("closed"));
2442
+ }, g = (u) => {
2443
+ if (u) {
2444
+ l.value = !0;
2445
+ return;
2446
+ }
2447
+ m();
2448
+ }, X = async () => {
2449
+ if (te.value) {
2450
+ S.value = null, n.value = {}, W.value = !0;
2451
+ try {
2452
+ const u = await N.get(`/agendas/${te.value}/refund-flow`);
2453
+ S.value = u || null, n.value = u?.refundFlow || h.agendaData?.refundFlow || {};
2454
+ } catch (u) {
2455
+ console.error("Error loading refund flow:", u), n.value = h.agendaData?.refundFlow || {};
2456
+ } finally {
2457
+ W.value = !1;
2458
+ }
2459
+ }
2460
+ };
2461
+ We(te, X, { immediate: !0 });
2462
+ const A = U(() => t.value?.customerInfo && `${t.value.customerInfo.firstName} ${t.value.customerInfo.lastName}`.trim() || "Unknown Customer"), oe = (u) => {
2463
+ if (typeof u != "string") return !1;
2464
+ const s = u.trim().toLowerCase();
2465
+ return s.length > 0 && s !== "unknown" && s !== "unknown resource";
2466
+ }, xe = (u) => u && C.value.find((s) => String(s.id) === String(u)) || null, _e = U(() => {
2467
+ const u = t.value?.resourceId || t.value?.resource?.id || w.value?.resourceId || w.value?.resource?.id, s = xe(u), H = w.value?.resourceId || w.value?.resource?.id, ee = !u || String(H) === String(u) ? w.value?.resource : null, ue = t.value?.resource?.name, B = ee?.name;
2468
+ return {
2469
+ name: s?.name || (oe(ue) ? ue : "") || (oe(B) ? B : "") || (oe(t.value?.resourceName) ? t.value.resourceName : ""),
2470
+ color: s?.color || t.value?.resource?.color || ee?.color || t.value?.resourceColor || "#6b7280"
2471
+ };
2472
+ }), Se = U(() => {
2473
+ let u = t.value?.status;
2474
+ const s = t.value?.reservationStatus;
2475
+ switch (u === "confirmed" && ["needs_approval", "rejected", "approved", "cancelled"].includes(s) && (u = s), u) {
2476
+ case "pending":
2477
+ return { label: "Pending", class: "bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400" };
2478
+ case "cancelled":
2479
+ return { label: "Cancelled", class: "bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400" };
2480
+ case "needs_approval":
2481
+ return { label: "Needs Approval", class: "bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400" };
2482
+ case "rejected":
2483
+ return { label: "Rejected", class: "bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400" };
2484
+ case "approved":
2485
+ return { label: "Approved", class: "bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400" };
2486
+ case "confirmed":
2487
+ return { label: "Confirmed", class: "bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400" };
2488
+ default:
2489
+ return { label: u || "Unknown", class: "bg-muted text-muted-foreground" };
2490
+ }
2491
+ }), Ae = U(() => t.value?.status === "cancelled" || t.value?.reservationStatus === "cancelled"), fe = (u) => u == null || typeof u != "number" ? "—" : `€${u?.toFixed(2)}`, Me = (u) => {
2492
+ if (!u) return "—";
2493
+ if (u < 60) return `${u} min`;
2494
+ const s = Math.floor(u / 60), H = u % 60;
2495
+ return H > 0 ? `${s}h ${H}min` : `${s}h`;
2496
+ }, je = () => {
2497
+ if (!t.value) return;
2498
+ let u = "";
2499
+ const s = w?.value?.date;
2500
+ if (s)
2501
+ try {
2502
+ u = new Date(s).toLocaleDateString("en-US", {
2503
+ weekday: "long",
2504
+ year: "numeric",
2505
+ month: "long",
2506
+ day: "numeric"
2507
+ });
2508
+ } catch {
2509
+ u = s;
2510
+ }
2511
+ const H = {
2512
+ date: u,
2513
+ resourceName: _e.value.name,
2514
+ metadataSchema: le.value
2515
+ };
2516
+ Et(t.value, H);
2517
+ }, Pe = () => {
2518
+ K.value?.openDialog(t.value);
2519
+ }, ze = () => {
2520
+ ye.value?.openDialog(t.value);
2521
+ }, Ue = () => {
2522
+ K.value?.openDialog(t.value);
2523
+ }, Ne = () => {
2524
+ be.value?.openDialog(t.value);
2525
+ }, Be = () => {
2526
+ !M.value && !W.value && X(), ne.value?.openDialog(t.value);
2527
+ }, v = async () => {
2528
+ try {
2529
+ if (D.value || !t.value?.id) throw new Error("Invalid state");
2530
+ D.value = !0;
2531
+ let s = (await R.get(d.reservationsCollection, t.value.id))?.reservations || [];
2532
+ if (!s.find((H) => H.id === t.value.res_id))
2533
+ throw new Error("Reservation not found");
2534
+ s.find((H) => H.id === t.value.res_id).status = "cancelled", await R.update(d.reservationsCollection, t.value.id, {
2535
+ reservations: s
2536
+ }), t.value.status = "cancelled", t.value.reservationStatus = "cancelled", ce.success("Reservation cancelled successfully"), p("cancelled"), l.value = !1;
2537
+ } catch (u) {
2538
+ console.error("Error cancelling reservation:", u), ce.error("Failed to cancel reservation");
2539
+ } finally {
2540
+ D.value = !1;
2541
+ }
2542
+ }, y = (u) => {
2543
+ try {
2544
+ return JSON.parse(JSON.stringify(u ?? null));
2545
+ } catch {
2546
+ return null;
2547
+ }
2548
+ }, q = (u) => u === null || Array.isArray(u) ? "object" : typeof u, G = (u) => u?.scope === "reservation" ? t.value?.reservationMetadata || {} : t.value?.metadata || {}, I = async ({ field: u, value: s }) => {
2549
+ const H = u?.action?.flow || {};
2550
+ if (!(!Object.keys(H).length || O.value)) {
2551
+ O.value = !0;
2552
+ try {
2553
+ await b(H, [
2554
+ { id: "value", name: "value", type: q(s), value: s },
2555
+ {
2556
+ id: "field",
2557
+ name: "field",
2558
+ type: "object",
2559
+ value: {
2560
+ id: u.id,
2561
+ key: u.key,
2562
+ label: u.label,
2563
+ display: u.display,
2564
+ scope: u.scope
2565
+ }
2566
+ },
2567
+ { id: "metadata", name: "metadata", type: "object", value: G(u) },
2568
+ { id: "order", name: "order", type: "object", value: t.value || {} },
2569
+ { id: "reservation", name: "reservation", type: "object", value: t.value || {} },
2570
+ { id: "booking", name: "booking", type: "object", value: t.value || {} },
2571
+ { id: "agenda", name: "agenda", type: "object", value: h.agendaData || {} },
2572
+ { id: "customer", name: "customer", type: "object", value: t.value?.customerInfo || {} },
2573
+ { id: "orderId", name: "orderId", type: "string", value: ae.value || "" },
2574
+ { id: "reservationId", name: "reservationId", type: "string", value: t.value?.res_id || t.value?.reservationId || "" }
2575
+ ]), ce.success("Metadata action completed");
2576
+ } catch (ee) {
2577
+ console.error("Error running metadata action:", ee), ce.error("Failed to run metadata action");
2578
+ } finally {
2579
+ O.value = !1;
2580
+ }
2581
+ }
2582
+ }, Q = async (u) => {
2583
+ try {
2584
+ if (D.value || !t.value?.id || !t.value?.res_id) throw new Error("Invalid state");
2585
+ if (!V.value) throw new Error("No active refund flow configured");
2586
+ D.value = !0;
2587
+ const s = t.value.id, H = t.value.res_id, ee = await R.get(d.reservationsCollection, s), ue = ee?.reservations || [], B = ue.find((Le) => Le.id === H);
2588
+ if (!B)
2589
+ throw new Error("Reservation not found");
2590
+ const Ee = (/* @__PURE__ */ new Date()).toISOString(), Ge = Y.value.showAmount, ve = {
2591
+ amount: Ge ? Number(u.amount) || 0 : null,
2592
+ hasAmount: Ge,
2593
+ reason: u.reason,
2594
+ fields: u.fields || {},
2595
+ fieldDefinitions: u.fieldDefinitions || [],
2596
+ requestedAt: Ee,
2597
+ notification: {
2598
+ skipped: u.skipMail,
2599
+ to: u.email,
2600
+ subject: u.subject,
2601
+ body: u.body
2602
+ }
2603
+ }, Xe = await b(n.value, [
2604
+ { id: "agenda", name: "agenda", type: "object", value: h.agendaData || {} },
2605
+ { id: "order", name: "order", type: "object", value: { ...ee, id: s } },
2606
+ { id: "reservation", name: "reservation", type: "object", value: B },
2607
+ { id: "booking", name: "booking", type: "object", value: t.value },
2608
+ { id: "customer", name: "customer", type: "object", value: ee?.customerInfo || t.value.customerInfo || {} },
2609
+ { id: "refund", name: "refund", type: "object", value: ve },
2610
+ { id: "refundFields", name: "refundFields", type: "object", value: ve.fields },
2611
+ { id: "refundHasAmount", name: "refundHasAmount", type: "boolean", value: ve.hasAmount },
2612
+ { id: "orderId", name: "orderId", type: "string", value: s },
2613
+ { id: "reservationId", name: "reservationId", type: "string", value: H },
2614
+ { id: "refundAmount", name: "refundAmount", type: "number", value: ve.amount || 0 }
2615
+ ]), Te = {
2616
+ ...ve,
2617
+ processedAt: (/* @__PURE__ */ new Date()).toISOString(),
2618
+ flowResult: y(Xe)
2619
+ };
2620
+ if (B.status = "cancelled", B.refundStatus = ve.hasAmount ? "refunded" : "processed", B.refundedAt = Te.processedAt, ve.hasAmount && (B.refundedAmount = (Number(B.refundedAmount) || 0) + (ve.amount || 0)), B.refunds = [
2621
+ ...Array.isArray(B.refunds) ? B.refunds : [],
2622
+ Te
2623
+ ], await R.update(d.reservationsCollection, s, {
2624
+ reservations: ue
2625
+ }), !u.skipMail)
2626
+ try {
2627
+ await k({
2628
+ to: u.email,
2629
+ subject: u.subject,
2630
+ body: u.body
2631
+ });
2632
+ } catch (Le) {
2633
+ console.error("Error sending refund email:", Le), ce.warning("Refund processed, but the email could not be sent");
2634
+ }
2635
+ t.value.status = "cancelled", t.value.reservationStatus = "cancelled", t.value.refundStatus = ve.hasAmount ? "refunded" : "processed", t.value.refundedAt = Te.processedAt, t.value.refunds = [
2636
+ ...Array.isArray(t.value.refunds) ? t.value.refunds : [],
2637
+ Te
2638
+ ], ve.hasAmount && (t.value.refundedAmount = (Number(t.value.refundedAmount) || 0) + (ve.amount || 0)), ce.success("Reservation cancelled and refund flow completed"), p("cancelled"), ne.value?.closeDialog(), l.value = !1;
2639
+ } catch (s) {
2640
+ console.error("Error cancelling reservation with refund:", s), ce.error(
2641
+ s instanceof Error && s.message === "No active refund flow configured" ? "No active refund flow configured" : "Failed to cancel and refund reservation"
2642
+ );
2643
+ } finally {
2644
+ D.value = !1;
2645
+ }
2646
+ }, ie = async () => {
2647
+ try {
2648
+ if (D.value || !t.value?.id) throw new Error("Invalid state");
2649
+ D.value = !0;
2650
+ let s = (await R.get(d.reservationsCollection, t.value.id))?.reservations || [];
2651
+ if (!s.find((H) => H.id === t.value.res_id))
2652
+ throw new Error("Reservation not found");
2653
+ s.find((H) => H.id === t.value.res_id).status = "approved", await R.update(d.reservationsCollection, t.value.id, {
2654
+ reservations: s
2655
+ }), t.value.status = "approved", ce.success("Reservation approved successfully"), p("confirmed"), l.value = !1;
2656
+ } catch (u) {
2657
+ console.error("Error approving reservation:", u), ce.error("Failed to approve reservation");
2658
+ } finally {
2659
+ D.value = !1;
2660
+ }
2661
+ }, ge = async () => {
2662
+ try {
2663
+ if (D.value || !t.value?.id) throw new Error("Invalid state");
2664
+ D.value = !0;
2665
+ let s = (await R.get(d.reservationsCollection, t.value.id))?.reservations || [];
2666
+ if (!s.find((H) => H.id === t.value.res_id))
2667
+ throw new Error("Reservation not found");
2668
+ s.find((H) => H.id === t.value.res_id).status = "rejected", await R.update(d.reservationsCollection, t.value.id, {
2669
+ reservations: s
2670
+ }), t.value.status = "rejected", ce.success("Reservation rejected successfully"), p("rejected"), l.value = !1;
2671
+ } catch (u) {
2672
+ console.error("Error rejecting reservation:", u), ce.error("Failed to reject reservation");
2673
+ } finally {
2674
+ D.value = !1;
2675
+ }
2676
+ }, pe = () => {
2677
+ $e.value?.openDialog(t.value);
2678
+ }, we = (u) => {
2679
+ const s = u?.reservation;
2680
+ t.value && s && (t.value = {
2681
+ ...t.value,
2682
+ date: s.date,
2683
+ endTime: s.timeslot?.endTime,
2684
+ resourceColor: s.resource?.color,
2685
+ resourceId: s.resourceId,
2686
+ resourceName: s.resource?.name,
2687
+ startTime: s.timeslot?.startTime
2688
+ }), p("transferred"), l.value = !1;
2689
+ }, he = () => {
2690
+ ae.value && (l.value = !1, p("openOrder", ae.value));
2691
+ };
2692
+ return x({
2693
+ openDialog: Re
2694
+ }), (u, s) => {
2695
+ const H = c("ResponsiveModalTitle"), ee = c("ResponsiveModalDescription"), ue = c("ResponsiveModalHeader"), B = c("Separator"), Ee = c("Button"), Ge = c("DropdownMenuTrigger"), Ie = c("DropdownMenuItem"), ve = c("DropdownMenuGroup"), Xe = c("DropdownMenuSeparator"), Te = c("DropdownMenuContent"), Le = c("DropdownMenu"), _t = c("ResponsiveModalFooter"), wt = c("ResponsiveModalScrollContent"), ht = c("ResponsiveModal");
2696
+ return i(), _(re, null, [
2697
+ a(ht, {
2698
+ open: l.value,
2699
+ "onUpdate:open": g
2700
+ }, {
2701
+ default: r(() => [
2702
+ a(wt, { class: "sm:max-w-xl" }, {
2703
+ default: r(() => [
2704
+ a(ue, null, {
2705
+ default: r(() => [
2706
+ a(H, { class: "flex items-center gap-3" }, {
2707
+ default: r(() => [
2708
+ s[0] || (s[0] = e("span", null, "Reservation Details", -1)),
2709
+ e("span", {
2710
+ class: Z(["px-2.5 py-1 text-xs font-medium rounded-full", Se.value.class])
2711
+ }, f(Se.value.label), 3)
2712
+ ]),
2713
+ _: 1
2714
+ }),
2715
+ a(ee, null, {
2716
+ default: r(() => [
2717
+ $(" Booking #" + f(ae.value.slice(0, 8) || "—"), 1)
2718
+ ]),
2719
+ _: 1
2720
+ })
2721
+ ]),
2722
+ _: 1
2723
+ }),
2724
+ t.value ? (i(), _("div", Ja, [
2725
+ a(Ye, {
2726
+ metadata: t.value.metadata,
2727
+ schema: P(le),
2728
+ scope: "order",
2729
+ "enable-actions": "",
2730
+ "actions-disabled": O.value,
2731
+ onRunAction: I
2732
+ }, null, 8, ["metadata", "schema", "actions-disabled"]),
2733
+ a(Ye, {
2734
+ metadata: t.value.reservationMetadata,
2735
+ schema: P(le),
2736
+ scope: "reservation",
2737
+ "enable-actions": "",
2738
+ "actions-disabled": O.value,
2739
+ onRunAction: I
2740
+ }, null, 8, ["metadata", "schema", "actions-disabled"]),
2741
+ e("div", Ya, [
2742
+ s[1] || (s[1] = e("h3", { class: "text-sm font-semibold text-muted-foreground uppercase tracking-wide" }, "Customer", -1)),
2743
+ e("div", Ka, [
2744
+ e("div", Xa, [
2745
+ e("div", Za, [
2746
+ a(P(st), {
2747
+ size: 20,
2748
+ class: "text-primary"
2749
+ })
2750
+ ]),
2751
+ e("div", null, [
2752
+ e("p", Qa, f(A.value), 1)
2753
+ ])
2754
+ ]),
2755
+ e("div", eo, [
2756
+ t.value.customerInfo?.email ? (i(), _("div", to, [
2757
+ a(P(rt), { size: 14 }),
2758
+ e("a", {
2759
+ href: `mailto:${t.value.customerInfo.email}`,
2760
+ class: "hover:text-foreground transition-colors"
2761
+ }, f(t.value.customerInfo.email), 9, ao)
2762
+ ])) : T("", !0),
2763
+ t.value.customerInfo?.phone ? (i(), _("div", oo, [
2764
+ a(P(lt), { size: 14 }),
2765
+ e("a", {
2766
+ href: `tel:${t.value.customerInfo.phone}`,
2767
+ class: "hover:text-foreground transition-colors"
2768
+ }, f(t.value.customerInfo.phone), 9, no)
2769
+ ])) : T("", !0)
2770
+ ])
2771
+ ])
2772
+ ]),
2773
+ e("div", so, [
2774
+ s[4] || (s[4] = e("h3", { class: "text-sm font-semibold text-muted-foreground uppercase tracking-wide" }, "Reservation", -1)),
2775
+ e("div", ro, [
2776
+ e("div", lo, [
2777
+ e("div", io, [
2778
+ a(P(Ze), { size: 14 }),
2779
+ e("span", uo, f(t.value.startTime) + " - " + f(t.value.endTime), 1)
2780
+ ]),
2781
+ e("p", co, f(new Date(t.value.date).toLocaleDateString("en-US", { weekday: "long", month: "long", day: "numeric", year: "numeric" })), 1)
2782
+ ]),
2783
+ e("div", po, [
2784
+ e("div", vo, [
2785
+ a(P(Qe), { size: 14 }),
2786
+ s[2] || (s[2] = e("span", { class: "text-xs" }, "Spots", -1))
2787
+ ]),
2788
+ e("p", mo, f(t.value.spots || 1) + " " + f(t.value.spots === 1 ? "person" : "people"), 1)
2789
+ ]),
2790
+ _e.value.name ? (i(), _("div", fo, [
2791
+ e("div", go, [
2792
+ e("span", {
2793
+ class: "w-3 h-3 rounded-full shrink-0",
2794
+ style: Ce({ backgroundColor: _e.value.color })
2795
+ }, null, 4),
2796
+ s[3] || (s[3] = e("span", { class: "text-xs" }, "Resource", -1))
2797
+ ]),
2798
+ e("p", bo, f(_e.value.name), 1)
2799
+ ])) : T("", !0)
2800
+ ])
2801
+ ]),
2802
+ t.value.pricingOption ? (i(), _("div", yo, [
2803
+ s[5] || (s[5] = e("h3", { class: "text-sm font-semibold text-muted-foreground uppercase tracking-wide" }, "Package", -1)),
2804
+ e("div", xo, [
2805
+ e("div", _o, [
2806
+ e("div", wo, [
2807
+ e("div", ho, [
2808
+ a(P(it), {
2809
+ size: 18,
2810
+ class: "text-primary"
2811
+ })
2812
+ ]),
2813
+ e("div", null, [
2814
+ e("p", ko, f(t.value.pricingOption.name), 1),
2815
+ e("p", $o, f(Me(t.value.pricingOption.duration)), 1)
2816
+ ])
2817
+ ]),
2818
+ e("p", Do, f(fe(t.value.pricingOption.price)), 1)
2819
+ ])
2820
+ ])
2821
+ ])) : T("", !0),
2822
+ e("div", Ro, [
2823
+ s[12] || (s[12] = e("h3", { class: "text-sm font-semibold text-muted-foreground uppercase tracking-wide" }, "Payment", -1)),
2824
+ e("div", Co, [
2825
+ e("div", So, [
2826
+ e("div", Ao, [
2827
+ s[6] || (s[6] = e("span", { class: "text-muted-foreground" }, "Base price", -1)),
2828
+ e("span", null, f(fe(t.value.reservationBasePrice)), 1)
2829
+ ]),
2830
+ t.value.reservationAddOnsPrice ? (i(), _("div", jo, [
2831
+ s[7] || (s[7] = e("span", { class: "text-muted-foreground" }, "Add-ons", -1)),
2832
+ e("span", null, f(fe(t.value.reservationAddOnsPrice)), 1)
2833
+ ])) : T("", !0),
2834
+ t.value.reservationAdjustments && t.value.reservationAdjustments.length ? (i(), _("div", Io, [
2835
+ (i(!0), _(re, null, me(t.value.reservationAdjustments, (Fe) => (i(), _("div", {
2836
+ key: Fe,
2837
+ class: "flex justify-between"
2838
+ }, [
2839
+ e("span", Mo, f(Fe.label), 1),
2840
+ Fe.type == "percent" ? (i(), _("span", No, f(Fe.value) + "% ", 1)) : (i(), _("span", To, f(Fe.value < 0 ? "-" : "+") + f(fe(Math.abs(Fe.value))), 1))
2841
+ ]))), 128))
2842
+ ])) : T("", !0)
2843
+ ]),
2844
+ a(B),
2845
+ e("div", Fo, [
2846
+ s[8] || (s[8] = e("span", null, "Reservation Total", -1)),
2847
+ e("span", null, f(fe(t.value.reservationPrice)), 1)
2848
+ ]),
2849
+ a(B),
2850
+ e("div", Vo, [
2851
+ e("div", Oo, [
2852
+ s[9] || (s[9] = e("span", null, "Order Total", -1)),
2853
+ o.showOrderLink ? (i(), _("button", {
2854
+ key: 0,
2855
+ type: "button",
2856
+ class: "text-[10px] uppercase bg-muted hover:bg-muted/50 px-2 py-1 rounded cursor-pointer",
2857
+ onClick: he
2858
+ }, " view order ")) : T("", !0)
2859
+ ]),
2860
+ e("span", null, f(fe(t.value.total)), 1)
2861
+ ]),
2862
+ t.value.amountPaid !== void 0 || t.value.amountDue !== void 0 ? (i(), J(B, { key: 0 })) : T("", !0),
2863
+ t.value.amountPaid !== void 0 || t.value.amountDue !== void 0 ? (i(), _("div", Po, [
2864
+ t.value.amountPaid !== void 0 ? (i(), _("div", zo, [
2865
+ e("span", Uo, [
2866
+ a(P(dt), { size: 14 }),
2867
+ s[10] || (s[10] = $(" Amount paid ", -1))
2868
+ ]),
2869
+ e("span", Bo, f(fe(t.value.amountPaid)), 1)
2870
+ ])) : T("", !0),
2871
+ t.value.amountDue !== void 0 && t.value.amountDue > 0 ? (i(), _("div", Eo, [
2872
+ e("span", Lo, [
2873
+ a(P(ot), { size: 14 }),
2874
+ s[11] || (s[11] = $(" Amount due ", -1))
2875
+ ]),
2876
+ e("span", Ho, f(fe(t.value.amountDue)), 1)
2877
+ ])) : T("", !0)
2878
+ ])) : T("", !0)
2879
+ ])
2880
+ ]),
2881
+ t.value.refunds?.length ? (i(), _("div", qo, [
2882
+ s[13] || (s[13] = e("h3", { class: "text-sm font-semibold text-muted-foreground uppercase tracking-wide" }, "Refunds", -1)),
2883
+ a(xt, {
2884
+ refunds: t.value.refunds
2885
+ }, null, 8, ["refunds"])
2886
+ ])) : T("", !0)
2887
+ ])) : T("", !0),
2888
+ a(_t, { class: "gap-2 sm:justify-between" }, {
2889
+ default: r(() => [
2890
+ t.value?.status === "confirmed" && t.value?.reservationStatus === "needs_approval" ? (i(), _(re, { key: 0 }, [
2891
+ a(Ee, {
2892
+ variant: "destructive",
2893
+ onClick: ze
2894
+ }, {
2895
+ default: r(() => [
2896
+ a(P(Rt), { size: 16 }),
2897
+ s[14] || (s[14] = $(" Reject Reservation ", -1))
2898
+ ]),
2899
+ _: 1
2900
+ }),
2901
+ a(Ee, { onClick: Pe }, {
2902
+ default: r(() => [
2903
+ a(P(Ct), { size: 16 }),
2904
+ s[15] || (s[15] = $(" Approve Reservation ", -1))
2905
+ ]),
2906
+ _: 1
2907
+ })
2908
+ ], 64)) : t.value?.status === "confirmed" && t.value?.reservationStatus === "approved" ? (i(), J(Le, { key: 1 }, {
2909
+ default: r(() => [
2910
+ a(Ge, { "as-child": "" }, {
2911
+ default: r(() => [
2912
+ a(Ee, {
2913
+ variant: "outline",
2914
+ class: "gap-2"
2915
+ }, {
2916
+ default: r(() => [
2917
+ a(P(ut), { size: 16 }),
2918
+ s[16] || (s[16] = $(" Actions ", -1))
2919
+ ]),
2920
+ _: 1
2921
+ })
2922
+ ]),
2923
+ _: 1
2924
+ }),
2925
+ a(Te, {
2926
+ class: "w-60",
2927
+ align: "start"
2928
+ }, {
2929
+ default: r(() => [
2930
+ a(ve, null, {
2931
+ default: r(() => [
2932
+ a(Ie, {
2933
+ onClick: he,
2934
+ class: "gap-2 cursor-pointer"
2935
+ }, {
2936
+ default: r(() => [
2937
+ a(P(St), {
2938
+ size: 16,
2939
+ class: "text-muted-foreground"
2940
+ }),
2941
+ s[17] || (s[17] = e("span", null, "View whole order", -1))
2942
+ ]),
2943
+ _: 1
2944
+ }),
2945
+ a(Ie, {
2946
+ onClick: je,
2947
+ class: "gap-2 cursor-pointer"
2948
+ }, {
2949
+ default: r(() => [
2950
+ a(P(ct), {
2951
+ size: 16,
2952
+ class: "text-muted-foreground"
2953
+ }),
2954
+ s[18] || (s[18] = e("span", null, "Download PDF", -1))
2955
+ ]),
2956
+ _: 1
2957
+ }),
2958
+ a(Ie, {
2959
+ onClick: Ue,
2960
+ class: "gap-2 cursor-pointer"
2961
+ }, {
2962
+ default: r(() => [
2963
+ a(P(At), {
2964
+ size: 16,
2965
+ class: "text-muted-foreground"
2966
+ }),
2967
+ s[19] || (s[19] = e("span", null, "(Re)send Confirmation Mail", -1))
2968
+ ]),
2969
+ _: 1
2970
+ }),
2971
+ P(z)("manage-reservations") ? (i(), J(Ie, {
2972
+ key: 0,
2973
+ onClick: pe,
2974
+ class: "gap-2 cursor-pointer",
2975
+ disabled: Ae.value
2976
+ }, {
2977
+ default: r(() => [
2978
+ a(P(jt), {
2979
+ size: 16,
2980
+ class: "text-muted-foreground"
2981
+ }),
2982
+ s[20] || (s[20] = e("span", null, "Transfer Date & Time", -1))
2983
+ ]),
2984
+ _: 1
2985
+ }, 8, ["disabled"])) : T("", !0)
2986
+ ]),
2987
+ _: 1
2988
+ }),
2989
+ a(Xe),
2990
+ P(z)("manage-reservations") ? (i(), J(ve, { key: 0 }, {
2991
+ default: r(() => [
2992
+ a(Ie, {
2993
+ onClick: Ne,
2994
+ class: "gap-2 cursor-pointer",
2995
+ variant: "destructive",
2996
+ disabled: Ae.value
2997
+ }, {
2998
+ default: r(() => [
2999
+ a(P(It), { size: 16 }),
3000
+ s[21] || (s[21] = e("span", null, "Cancel Reservation", -1))
3001
+ ]),
3002
+ _: 1
3003
+ }, 8, ["disabled"]),
3004
+ V.value && t.value?.total && t.value.total > 0 ? (i(), J(Ie, {
3005
+ key: 0,
3006
+ onClick: Be,
3007
+ class: "gap-2 cursor-pointer text-orange-600 dark:text-orange-400 focus:text-orange-600 dark:focus:text-orange-400",
3008
+ disabled: Ae.value
3009
+ }, {
3010
+ default: r(() => [
3011
+ a(P(Mt), {
3012
+ class: "text-inherit",
3013
+ size: 16
3014
+ }),
3015
+ s[22] || (s[22] = e("span", null, "Cancel & Refund", -1))
3016
+ ]),
3017
+ _: 1
3018
+ }, 8, ["disabled"])) : T("", !0)
3019
+ ]),
3020
+ _: 1
3021
+ })) : T("", !0)
3022
+ ]),
3023
+ _: 1
3024
+ })
3025
+ ]),
3026
+ _: 1
3027
+ })) : T("", !0)
3028
+ ]),
3029
+ _: 1
3030
+ })
3031
+ ]),
3032
+ _: 1
3033
+ })
3034
+ ]),
3035
+ _: 1
3036
+ }, 8, ["open"]),
3037
+ a(Jt, {
3038
+ ref_key: "cancelReservationDialog",
3039
+ ref: be,
3040
+ onConfirm: v
3041
+ }, null, 512),
3042
+ a(la, {
3043
+ ref_key: "cancelRefundReservationDialog",
3044
+ ref: ne,
3045
+ "is-processing": D.value,
3046
+ "has-refund-flow": V.value,
3047
+ "show-refund-amount": Y.value.showAmount,
3048
+ "custom-fields": Y.value.fields,
3049
+ onConfirm: Q
3050
+ }, null, 8, ["is-processing", "has-refund-flow", "show-refund-amount", "custom-fields"]),
3051
+ a(ka, {
3052
+ ref_key: "approveReservationDialog",
3053
+ ref: K,
3054
+ onConfirm: ie
3055
+ }, null, 512),
3056
+ a(Sa, {
3057
+ ref_key: "rejectReservationDialog",
3058
+ ref: ye,
3059
+ onConfirm: ge
3060
+ }, null, 512),
3061
+ a(ya, {
3062
+ ref_key: "transferReservationDialog",
3063
+ ref: $e,
3064
+ "agenda-data": o.agendaData,
3065
+ onTransferred: we
3066
+ }, null, 8, ["agenda-data"])
3067
+ ], 64);
3068
+ };
3069
+ }
3070
+ }), Wo = {
3071
+ key: 0,
3072
+ class: "space-y-6 py-4"
3073
+ }, Go = { class: "space-y-3" }, Jo = { class: "bg-muted/30 rounded-lg p-4 space-y-3" }, Yo = { class: "flex items-center gap-3" }, Ko = { class: "h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center" }, Xo = { class: "font-medium" }, Zo = { class: "grid gap-2 text-sm" }, Qo = {
3074
+ key: 0,
3075
+ class: "flex items-center gap-2 text-muted-foreground"
3076
+ }, en = ["href"], tn = {
3077
+ key: 1,
3078
+ class: "flex items-center gap-2 text-muted-foreground"
3079
+ }, an = ["href"], on = { class: "space-y-3" }, nn = { class: "grid grid-cols-2 gap-3" }, sn = { class: "bg-muted/30 rounded-lg p-3" }, rn = { class: "flex items-center gap-2 text-muted-foreground mb-1" }, ln = { class: "font-medium" }, dn = { class: "bg-muted/30 rounded-lg p-3" }, un = { class: "flex items-center gap-2 text-muted-foreground mb-1" }, cn = { class: "font-medium" }, pn = { class: "bg-muted/30 rounded-lg p-3 col-span-2" }, vn = { class: "flex items-center gap-2 text-muted-foreground mb-1" }, mn = { class: "font-medium" }, fn = { class: "space-y-3" }, gn = { class: "space-y-2" }, bn = ["onClick"], yn = { class: "flex items-start justify-between gap-3" }, xn = { class: "min-w-0 flex-1 space-y-2" }, _n = { class: "flex items-center gap-2 flex-wrap" }, wn = {
3080
+ key: 0,
3081
+ class: "inline-flex items-center gap-1 text-xs text-muted-foreground"
3082
+ }, hn = { class: "grid gap-1 text-sm" }, kn = { class: "flex items-center gap-2 text-muted-foreground" }, $n = { class: "flex items-center gap-2 text-muted-foreground" }, Dn = { class: "flex items-center gap-2 text-muted-foreground" }, Rn = {
3083
+ key: 0,
3084
+ class: "flex items-center gap-2 text-muted-foreground"
3085
+ }, Cn = { class: "shrink-0 text-right flex items-center gap-2" }, Sn = { class: "text-sm font-semibold" }, An = { class: "space-y-3" }, jn = { class: "bg-muted/30 rounded-lg p-4 space-y-3" }, In = { class: "space-y-2 text-sm" }, Mn = { class: "flex justify-between" }, Nn = {
3086
+ key: 0,
3087
+ class: "flex justify-between"
3088
+ }, Tn = {
3089
+ key: 1,
3090
+ class: "grid gap-2"
3091
+ }, Fn = { class: "text-muted-foreground" }, Vn = {
3092
+ key: 2,
3093
+ class: "flex justify-between text-green-600 dark:text-green-400"
3094
+ }, On = { class: "flex justify-between font-semibold" }, Pn = { class: "space-y-2 text-sm" }, zn = {
3095
+ key: 0,
3096
+ class: "flex justify-between"
3097
+ }, Un = { class: "text-muted-foreground flex items-center gap-1.5" }, Bn = { class: "text-green-600 dark:text-green-400" }, En = {
3098
+ key: 1,
3099
+ class: "flex justify-between"
3100
+ }, Ln = { class: "text-muted-foreground flex items-center gap-1.5" }, Hn = { class: "text-orange-600 dark:text-orange-400 font-medium" }, Kn = /* @__PURE__ */ De({
3101
+ __name: "OrderDetailDialog",
3102
+ props: {
3103
+ agendaData: {},
3104
+ resources: { default: () => [] }
3105
+ },
3106
+ emits: ["openReservation", "closed"],
3107
+ setup(o, { expose: x, emit: L }) {
3108
+ const h = o, z = L, E = F(!1), d = F(null), R = F(!1), { params: N } = nt(), { runFlow: b } = mt(), k = U(() => N.value?.id ?? N.id ?? h.agendaData?.id ?? ""), { metadataSchema: w } = yt(k), C = U(() => {
3109
+ const m = Array.isArray(h.resources) ? h.resources : [], g = Array.isArray(h.agendaData?.resources) ? h.agendaData.resources : [], X = [...m, ...g], A = /* @__PURE__ */ new Set();
3110
+ return X.filter((oe) => {
3111
+ const xe = oe?.id;
3112
+ return !xe || A.has(String(xe)) ? !1 : (A.add(String(xe)), !0);
3113
+ });
3114
+ }), p = (m) => {
3115
+ !m?.id || !m.reservations?.length || (d.value = m, E.value = !0);
3116
+ }, l = () => {
3117
+ E.value && (E.value = !1, z("closed"));
3118
+ }, t = (m) => {
3119
+ if (m) {
3120
+ E.value = !0;
3121
+ return;
3122
+ }
3123
+ l();
3124
+ }, D = U(() => {
3125
+ const m = d.value?.customerInfo;
3126
+ return m && [m.firstName, m.lastName].filter(Boolean).join(" ") || "Unknown Customer";
3127
+ }), O = U(() => {
3128
+ const m = d.value?.reservations?.[0];
3129
+ return {
3130
+ subtotal: m?.subtotal,
3131
+ discount: m?.discount,
3132
+ amountPaid: m?.amountPaid,
3133
+ amountDue: m?.amountDue
3134
+ };
3135
+ }), n = U(() => d.value?.reservations.reduce((m, g) => m + (g.reservationPrice || 0), 0) || 0), S = (m) => {
3136
+ if (typeof m != "string") return !1;
3137
+ const g = m.trim().toLowerCase();
3138
+ return g.length > 0 && g !== "unknown" && g !== "unknown resource";
3139
+ }, W = (m) => m && C.value.find((g) => String(g.id) === String(m)) || null, te = (m) => {
3140
+ const g = m.resourceId || m.resource?.id, X = W(g), A = m.resource?.name;
3141
+ return {
3142
+ name: X?.name || (S(A) ? A : "") || (S(m.resourceName) ? m.resourceName : ""),
3143
+ color: X?.color || m.resource?.color || m.resourceColor || "#6b7280"
3144
+ };
3145
+ }, le = U(() => d.value?.reservations.map((m) => {
3146
+ const g = te(m);
3147
+ return {
3148
+ ...m,
3149
+ resourceName: g.name,
3150
+ resourceColor: g.color
3151
+ };
3152
+ }) || []), ae = U(() => d.value ? {
3153
+ ...d.value,
3154
+ reservations: le.value
3155
+ } : null), M = (m) => m == null || typeof m != "number" ? "-" : `€${m.toFixed(2)}`, j = (m) => m.type === "percent" ? `${m.value}%` : `${m.value < 0 ? "-" : "+"}${M(Math.abs(m.value))}`, V = (m) => {
3156
+ if (!m) return "-";
3157
+ const g = new Date(m);
3158
+ return Number.isNaN(g.getTime()) ? m : g.toLocaleDateString("en-US", {
3159
+ weekday: "short",
3160
+ month: "short",
3161
+ day: "numeric",
3162
+ year: "numeric"
3163
+ });
3164
+ }, Y = (m) => {
3165
+ if (!m) return "-";
3166
+ const g = new Date(m);
3167
+ return Number.isNaN(g.getTime()) ? m : g.toLocaleTimeString("en-US", {
3168
+ hour: "2-digit",
3169
+ minute: "2-digit",
3170
+ hour12: !1
3171
+ });
3172
+ }, be = (m) => {
3173
+ switch (m) {
3174
+ case "pending":
3175
+ return { label: "Pending", class: "bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400" };
3176
+ case "cancelled":
3177
+ return { label: "Cancelled", class: "bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400" };
3178
+ case "needs_approval":
3179
+ return { label: "Needs Approval", class: "bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400" };
3180
+ case "rejected":
3181
+ return { label: "Rejected", class: "bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400" };
3182
+ case "approved":
3183
+ return { label: "Approved", class: "bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400" };
3184
+ case "confirmed":
3185
+ return { label: "Confirmed", class: "bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400" };
3186
+ default:
3187
+ return { label: m || "Unknown", class: "bg-muted text-muted-foreground" };
3188
+ }
3189
+ }, ne = (m) => {
3190
+ let g = m.status;
3191
+ const X = m.reservationStatus;
3192
+ return g === "confirmed" && ["needs_approval", "rejected", "approved", "cancelled"].includes(X || "") && (g = X), be(g);
3193
+ }, K = (m) => {
3194
+ const g = m.id || d.value?.id;
3195
+ g && (E.value = !1, z("openReservation", { ...m, id: g }));
3196
+ }, ye = () => {
3197
+ ae.value && Lt(ae.value, {
3198
+ agendaName: h.agendaData?.name,
3199
+ metadataSchema: w.value
3200
+ });
3201
+ }, $e = (m) => m === null || Array.isArray(m) ? "object" : typeof m, Re = async ({ field: m, value: g }) => {
3202
+ const X = m?.action?.flow || {};
3203
+ if (!(!Object.keys(X).length || R.value)) {
3204
+ R.value = !0;
3205
+ try {
3206
+ await b(X, [
3207
+ { id: "value", name: "value", type: $e(g), value: g },
3208
+ {
3209
+ id: "field",
3210
+ name: "field",
3211
+ type: "object",
3212
+ value: {
3213
+ id: m.id,
3214
+ key: m.key,
3215
+ label: m.label,
3216
+ display: m.display,
3217
+ scope: m.scope
3218
+ }
3219
+ },
3220
+ { id: "metadata", name: "metadata", type: "object", value: d.value?.metadata || {} },
3221
+ { id: "order", name: "order", type: "object", value: ae.value || d.value || {} },
3222
+ { id: "agenda", name: "agenda", type: "object", value: h.agendaData || {} },
3223
+ { id: "customer", name: "customer", type: "object", value: d.value?.customerInfo || {} },
3224
+ { id: "orderId", name: "orderId", type: "string", value: d.value?.id || "" }
3225
+ ]), ce.success("Metadata action completed");
3226
+ } catch (A) {
3227
+ console.error("Error running metadata action:", A), ce.error("Failed to run metadata action");
3228
+ } finally {
3229
+ R.value = !1;
3230
+ }
3231
+ }
3232
+ };
3233
+ return x({
3234
+ openDialog: p
3235
+ }), (m, g) => {
3236
+ const X = c("ResponsiveModalTitle"), A = c("ResponsiveModalDescription"), oe = c("ResponsiveModalHeader"), xe = c("Separator"), _e = c("Button"), Se = c("DropdownMenuTrigger"), Ae = c("DropdownMenuLabel"), fe = c("DropdownMenuItem"), Me = c("DropdownMenuGroup"), je = c("DropdownMenuSeparator"), Pe = c("DropdownMenuSubTrigger"), ze = c("DropdownMenuSubContent"), Ue = c("DropdownMenuPortal"), Ne = c("DropdownMenuSub"), Be = c("DropdownMenuContent"), v = c("DropdownMenu"), y = c("ResponsiveModalFooter"), q = c("ResponsiveModalScrollContent"), G = c("ResponsiveModal");
3237
+ return i(), J(G, {
3238
+ open: E.value,
3239
+ "onUpdate:open": t
3240
+ }, {
3241
+ default: r(() => [
3242
+ a(q, { class: "sm:max-w-2xl" }, {
3243
+ default: r(() => [
3244
+ a(oe, null, {
3245
+ default: r(() => [
3246
+ a(X, { class: "flex items-center gap-3" }, {
3247
+ default: r(() => [
3248
+ g[0] || (g[0] = e("span", null, "Order Details", -1)),
3249
+ e("span", {
3250
+ class: Z(["px-2.5 py-1 text-xs font-medium rounded-full", be(d.value?.status).class])
3251
+ }, f(be(d.value?.status).label), 3)
3252
+ ]),
3253
+ _: 1
3254
+ }),
3255
+ a(A, null, {
3256
+ default: r(() => [
3257
+ $(" Order #" + f(d.value?.id?.slice(0, 8) || "-"), 1)
3258
+ ]),
3259
+ _: 1
3260
+ })
3261
+ ]),
3262
+ _: 1
3263
+ }),
3264
+ d.value ? (i(), _("div", Wo, [
3265
+ a(Ye, {
3266
+ metadata: d.value.metadata,
3267
+ schema: P(w),
3268
+ scope: "order",
3269
+ "enable-actions": "",
3270
+ "actions-disabled": R.value,
3271
+ onRunAction: Re
3272
+ }, null, 8, ["metadata", "schema", "actions-disabled"]),
3273
+ e("div", Go, [
3274
+ g[1] || (g[1] = e("h3", { class: "text-sm font-semibold text-muted-foreground uppercase tracking-wide" }, "Customer", -1)),
3275
+ e("div", Jo, [
3276
+ e("div", Yo, [
3277
+ e("div", Ko, [
3278
+ a(P(st), {
3279
+ size: 20,
3280
+ class: "text-primary"
3281
+ })
3282
+ ]),
3283
+ e("div", null, [
3284
+ e("p", Xo, f(D.value), 1)
3285
+ ])
3286
+ ]),
3287
+ e("div", Zo, [
3288
+ d.value.customerInfo?.email ? (i(), _("div", Qo, [
3289
+ a(P(rt), { size: 14 }),
3290
+ e("a", {
3291
+ href: `mailto:${d.value.customerInfo.email}`,
3292
+ class: "hover:text-foreground transition-colors"
3293
+ }, f(d.value.customerInfo.email), 9, en)
3294
+ ])) : T("", !0),
3295
+ d.value.customerInfo?.phone ? (i(), _("div", tn, [
3296
+ a(P(lt), { size: 14 }),
3297
+ e("a", {
3298
+ href: `tel:${d.value.customerInfo.phone}`,
3299
+ class: "hover:text-foreground transition-colors"
3300
+ }, f(d.value.customerInfo.phone), 9, an)
3301
+ ])) : T("", !0)
3302
+ ])
3303
+ ])
3304
+ ]),
3305
+ e("div", on, [
3306
+ g[5] || (g[5] = e("h3", { class: "text-sm font-semibold text-muted-foreground uppercase tracking-wide" }, "Order Summary", -1)),
3307
+ e("div", nn, [
3308
+ e("div", sn, [
3309
+ e("div", rn, [
3310
+ a(P(Nt), { size: 14 }),
3311
+ g[2] || (g[2] = e("span", { class: "text-xs" }, "Reservations", -1))
3312
+ ]),
3313
+ e("p", ln, f(d.value.reservations.length), 1)
3314
+ ]),
3315
+ e("div", dn, [
3316
+ e("div", un, [
3317
+ a(P(Qe), { size: 14 }),
3318
+ g[3] || (g[3] = e("span", { class: "text-xs" }, "Spots", -1))
3319
+ ]),
3320
+ e("p", cn, f(d.value.totalSpots), 1)
3321
+ ]),
3322
+ e("div", pn, [
3323
+ e("div", vn, [
3324
+ a(P(Ze), { size: 14 }),
3325
+ g[4] || (g[4] = e("span", { class: "text-xs" }, "Ordered at", -1))
3326
+ ]),
3327
+ e("p", mn, f(V(d.value.createdAt)) + " · " + f(Y(d.value.createdAt)), 1)
3328
+ ])
3329
+ ])
3330
+ ]),
3331
+ e("div", fn, [
3332
+ g[6] || (g[6] = e("h3", { class: "text-sm font-semibold text-muted-foreground uppercase tracking-wide" }, "Reservations", -1)),
3333
+ e("div", gn, [
3334
+ (i(!0), _(re, null, me(le.value, (I) => (i(), _("button", {
3335
+ key: I.res_id || I.id,
3336
+ type: "button",
3337
+ class: "w-full text-left bg-muted/30 rounded-lg p-4 transition-colors hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3338
+ onClick: (Q) => K(I)
3339
+ }, [
3340
+ e("div", yn, [
3341
+ e("div", xn, [
3342
+ e("div", _n, [
3343
+ e("span", {
3344
+ class: Z(["px-2 py-1 text-xs font-medium rounded-full", ne(I).class])
3345
+ }, f(ne(I).label), 3),
3346
+ I.resourceName ? (i(), _("span", wn, [
3347
+ e("span", {
3348
+ class: "w-3 h-3 rounded-full",
3349
+ style: Ce({ backgroundColor: I.resourceColor || "#6b7280" })
3350
+ }, null, 4),
3351
+ $(" " + f(I.resourceName), 1)
3352
+ ])) : T("", !0)
3353
+ ]),
3354
+ e("div", hn, [
3355
+ e("div", kn, [
3356
+ a(P(Tt), { size: 14 }),
3357
+ e("span", null, f(V(I.date)), 1)
3358
+ ]),
3359
+ e("div", $n, [
3360
+ a(P(Ze), { size: 14 }),
3361
+ e("span", null, f(I.startTime || "-") + " - " + f(I.endTime || "-"), 1)
3362
+ ]),
3363
+ e("div", Dn, [
3364
+ a(P(Qe), { size: 14 }),
3365
+ e("span", null, f(I.spots || 1) + " " + f(I.spots === 1 ? "person" : "people"), 1)
3366
+ ]),
3367
+ I.pricingOption ? (i(), _("div", Rn, [
3368
+ a(P(it), { size: 14 }),
3369
+ e("span", null, f(I.pricingOption.name), 1)
3370
+ ])) : T("", !0)
3371
+ ]),
3372
+ a(Ye, {
3373
+ metadata: I.reservationMetadata,
3374
+ schema: P(w),
3375
+ "display-filter": ["highlight", "badge"],
3376
+ compact: ""
3377
+ }, null, 8, ["metadata", "schema"]),
3378
+ I.refunds?.length ? (i(), J(xt, {
3379
+ key: 0,
3380
+ refunds: I.refunds,
3381
+ compact: ""
3382
+ }, null, 8, ["refunds"])) : T("", !0)
3383
+ ]),
3384
+ e("div", Cn, [
3385
+ e("div", null, [
3386
+ e("p", Sn, f(M(I.reservationPrice)), 1)
3387
+ ]),
3388
+ a(P(Ft), {
3389
+ size: 16,
3390
+ class: "text-muted-foreground"
3391
+ })
3392
+ ])
3393
+ ])
3394
+ ], 8, bn))), 128))
3395
+ ])
3396
+ ]),
3397
+ e("div", An, [
3398
+ g[13] || (g[13] = e("h3", { class: "text-sm font-semibold text-muted-foreground uppercase tracking-wide" }, "Payment", -1)),
3399
+ e("div", jn, [
3400
+ e("div", In, [
3401
+ e("div", Mn, [
3402
+ g[7] || (g[7] = e("span", { class: "text-muted-foreground" }, "Reservations", -1)),
3403
+ e("span", null, f(M(n.value)), 1)
3404
+ ]),
3405
+ O.value.subtotal !== void 0 && O.value.subtotal !== d.value.totalPrice ? (i(), _("div", Nn, [
3406
+ g[8] || (g[8] = e("span", { class: "text-muted-foreground" }, "Subtotal", -1)),
3407
+ e("span", null, f(M(O.value.subtotal)), 1)
3408
+ ])) : T("", !0),
3409
+ d.value.adjustments && d.value.adjustments.length ? (i(), _("div", Tn, [
3410
+ (i(!0), _(re, null, me(d.value.adjustments, (I) => (i(), _("div", {
3411
+ key: `${I.label}-${I.type}-${I.value}`,
3412
+ class: "flex justify-between"
3413
+ }, [
3414
+ e("span", Fn, f(I.label), 1),
3415
+ e("span", null, f(j(I)), 1)
3416
+ ]))), 128))
3417
+ ])) : T("", !0),
3418
+ O.value.discount ? (i(), _("div", Vn, [
3419
+ g[9] || (g[9] = e("span", null, "Discount", -1)),
3420
+ e("span", null, "-" + f(M(O.value.discount)), 1)
3421
+ ])) : T("", !0)
3422
+ ]),
3423
+ a(xe),
3424
+ e("div", On, [
3425
+ g[10] || (g[10] = e("span", null, "Order Total", -1)),
3426
+ e("span", null, f(M(d.value.totalPrice)), 1)
3427
+ ]),
3428
+ O.value.amountPaid !== void 0 || O.value.amountDue !== void 0 ? (i(), _(re, { key: 0 }, [
3429
+ a(xe),
3430
+ e("div", Pn, [
3431
+ O.value.amountPaid !== void 0 ? (i(), _("div", zn, [
3432
+ e("span", Un, [
3433
+ a(P(dt), { size: 14 }),
3434
+ g[11] || (g[11] = $(" Amount paid ", -1))
3435
+ ]),
3436
+ e("span", Bn, f(M(O.value.amountPaid)), 1)
3437
+ ])) : T("", !0),
3438
+ O.value.amountDue !== void 0 && O.value.amountDue > 0 ? (i(), _("div", En, [
3439
+ e("span", Ln, [
3440
+ a(P(ot), { size: 14 }),
3441
+ g[12] || (g[12] = $(" Amount due ", -1))
3442
+ ]),
3443
+ e("span", Hn, f(M(O.value.amountDue)), 1)
3444
+ ])) : T("", !0)
3445
+ ])
3446
+ ], 64)) : T("", !0)
3447
+ ])
3448
+ ])
3449
+ ])) : T("", !0),
3450
+ a(y, { class: "gap-2 sm:justify-between" }, {
3451
+ default: r(() => [
3452
+ d.value ? (i(), J(v, { key: 0 }, {
3453
+ default: r(() => [
3454
+ a(Se, { "as-child": "" }, {
3455
+ default: r(() => [
3456
+ a(_e, {
3457
+ variant: "outline",
3458
+ class: "gap-2"
3459
+ }, {
3460
+ default: r(() => [
3461
+ a(P(ut), { size: 16 }),
3462
+ g[14] || (g[14] = $(" Actions ", -1))
3463
+ ]),
3464
+ _: 1
3465
+ })
3466
+ ]),
3467
+ _: 1
3468
+ }),
3469
+ a(Be, {
3470
+ class: "w-60",
3471
+ align: "start"
3472
+ }, {
3473
+ default: r(() => [
3474
+ a(Ae, { class: "text-xs text-muted-foreground font-normal" }, {
3475
+ default: r(() => [...g[15] || (g[15] = [
3476
+ $(" Reservation Actions ", -1)
3477
+ ])]),
3478
+ _: 1
3479
+ }),
3480
+ a(Me, null, {
3481
+ default: r(() => [
3482
+ a(fe, {
3483
+ onClick: ye,
3484
+ class: "gap-2 cursor-pointer"
3485
+ }, {
3486
+ default: r(() => [
3487
+ a(P(ct), {
3488
+ size: 16,
3489
+ class: "text-muted-foreground"
3490
+ }),
3491
+ g[16] || (g[16] = e("span", null, "Download PDF", -1))
3492
+ ]),
3493
+ _: 1
3494
+ })
3495
+ ]),
3496
+ _: 1
3497
+ }),
3498
+ a(je),
3499
+ a(Me, null, {
3500
+ default: r(() => [
3501
+ a(Ne, null, {
3502
+ default: r(() => [
3503
+ a(Pe, null, {
3504
+ default: r(() => [...g[17] || (g[17] = [
3505
+ $("Reservations", -1)
3506
+ ])]),
3507
+ _: 1
3508
+ }),
3509
+ a(Ue, null, {
3510
+ default: r(() => [
3511
+ a(ze, null, {
3512
+ default: r(() => [
3513
+ (i(!0), _(re, null, me(d.value.reservations, (I) => (i(), J(fe, {
3514
+ key: I.res_id || I.id,
3515
+ onClick: (Q) => K(I)
3516
+ }, {
3517
+ default: r(() => [
3518
+ $(f(V(I.date)) + " " + f(I.startTime || "-"), 1)
3519
+ ]),
3520
+ _: 2
3521
+ }, 1032, ["onClick"]))), 128))
3522
+ ]),
3523
+ _: 1
3524
+ })
3525
+ ]),
3526
+ _: 1
3527
+ })
3528
+ ]),
3529
+ _: 1
3530
+ })
3531
+ ]),
3532
+ _: 1
3533
+ })
3534
+ ]),
3535
+ _: 1
3536
+ })
3537
+ ]),
3538
+ _: 1
3539
+ })) : T("", !0),
3540
+ a(_e, {
3541
+ variant: "outline",
3542
+ onClick: l
3543
+ }, {
3544
+ default: r(() => [...g[18] || (g[18] = [
3545
+ $("Close", -1)
3546
+ ])]),
3547
+ _: 1
3548
+ })
3549
+ ]),
3550
+ _: 1
3551
+ })
3552
+ ]),
3553
+ _: 1
3554
+ })
3555
+ ]),
3556
+ _: 1
3557
+ }, 8, ["open"]);
3558
+ };
3559
+ }
3560
+ });
3561
+ export {
3562
+ Ye as _,
3563
+ Yn as a,
3564
+ Kn as b,
3565
+ yt as u
3566
+ };