@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,925 @@
1
+ "use strict";const e=require("vue"),T=require("lucide-vue-next"),W=require("@oneclick.dev/cms-kit"),Q=require("./index-ijdf0d9-.js"),X=o=>o==null?"—":`€${o.toFixed(2)}`,je=o=>{if(!o)return"—";if(o<60)return`${o} min`;const v=Math.floor(o/60),R=o%60;return R>0?`${v}h ${R}min`:`${v}h`},Re=o=>{const v=Number(o.value);return Number.isFinite(v)?o.type==="percent"?`${v}%`:`${v<0?"-":"+"}${X(Math.abs(v))}`:"—"},Te=o=>{switch(o){case"confirmed":return"Confirmed";case"pending":return"Pending";case"cancelled":return"Cancelled";case"needs_approval":return"Needs Approval";case"approved":return"Approved";case"rejected":return"Rejected";default:return o||"Unknown"}},Ne=o=>{switch(o){case"confirmed":case"approved":return"#16a34a";case"pending":case"needs_approval":return"#ca8a04";case"cancelled":case"rejected":return"#dc2626";default:return"#6b7280"}},Le=o=>{if(!o)return"—";const v=new Date(o);return Number.isNaN(v.getTime())?o:v.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric",year:"numeric"})},He=o=>{if(!o)return"—";const v=new Date(o);return Number.isNaN(v.getTime())?o:v.toLocaleString("en-US",{weekday:"short",month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})},qe=o=>o.status==="confirmed"&&["needs_approval","rejected","approved","cancelled"].includes(o.reservationStatus||"")?o.reservationStatus||o.status:o.status||o.reservationStatus||"",Ie=o=>String(o??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"),J=(o,v="—")=>o==null||o===""?v:Ie(o),We=o=>o==null||o===""||o===!1?!1:Array.isArray(o)?o.length>0:typeof o=="object"?Object.keys(o).length>0:!0,Ge=o=>{if(o===!0)return"Yes";if(Array.isArray(o))return o.map(v=>typeof v=="object"?JSON.stringify(v):String(v)).join(", ");if(typeof o=="object")try{return JSON.stringify(o)}catch{return String(o)}return String(o)},Se=(o,v,R)=>!o||!v?.length?[]:v.filter(g=>g.scope!==R||g.includeInPdf!==!0?!1:We(o[g.key])).sort((g,E)=>(g.order||0)-(E.order||0)).map(g=>({id:g.id,key:g.key,label:g.label||g.key,value:o[g.key]})),Fe=(o,v=!1)=>o.map(R=>`
2
+ <div class="metadata-row${v?" compact":""}">
3
+ <span class="metadata-label">${J(R.label)}</span>
4
+ <span class="metadata-value">${J(Ge(R.value))}</span>
5
+ </div>
6
+ `).join(""),Ae=(o,v)=>v.length?`
7
+ <div class="section">
8
+ <div class="section-title">${J(o)}</div>
9
+ <div class="section-content">
10
+ <div class="metadata-list">
11
+ ${Fe(v)}
12
+ </div>
13
+ </div>
14
+ </div>
15
+ `:"",Je=(o,v={})=>{const R=`${o.customerInfo?.firstName||""} ${o.customerInfo?.lastName||""}`.trim()||"Unknown Customer",g=o.id?.slice(0,8)||"—",E=new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}),B=Se(o.metadata,v.metadataSchema,"order"),s=Se(o.reservationMetadata,v.metadataSchema,"reservation"),x=`
16
+ <!DOCTYPE html>
17
+ <html lang="en">
18
+ <head>
19
+ <meta charset="UTF-8">
20
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
21
+ <title>Reservation ${g}</title>
22
+ <style>
23
+ * {
24
+ margin: 0;
25
+ padding: 0;
26
+ box-sizing: border-box;
27
+ }
28
+
29
+ body {
30
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
31
+ line-height: 1.6;
32
+ color: #1f2937;
33
+ background: #fff;
34
+ padding: 40px;
35
+ max-width: 800px;
36
+ margin: 0 auto;
37
+ }
38
+
39
+ .header {
40
+ display: flex;
41
+ justify-content: space-between;
42
+ align-items: flex-start;
43
+ margin-bottom: 40px;
44
+ padding-bottom: 20px;
45
+ border-bottom: 2px solid #e5e7eb;
46
+ }
47
+
48
+ .company-info {
49
+ display: flex;
50
+ align-items: center;
51
+ gap: 16px;
52
+ }
53
+
54
+ .company-logo {
55
+ max-height: 50px;
56
+ max-width: 150px;
57
+ object-fit: contain;
58
+ }
59
+
60
+ .company-name {
61
+ font-size: 24px;
62
+ font-weight: 700;
63
+ color: #111827;
64
+ }
65
+
66
+ .document-info {
67
+ text-align: right;
68
+ }
69
+
70
+ .document-title {
71
+ font-size: 28px;
72
+ font-weight: 700;
73
+ color: #111827;
74
+ margin-bottom: 8px;
75
+ }
76
+
77
+ .booking-id {
78
+ font-size: 14px;
79
+ color: #6b7280;
80
+ }
81
+
82
+ .status-badge {
83
+ display: inline-block;
84
+ padding: 4px 12px;
85
+ border-radius: 9999px;
86
+ font-size: 12px;
87
+ font-weight: 600;
88
+ text-transform: uppercase;
89
+ margin-top: 8px;
90
+ }
91
+
92
+ .section {
93
+ margin-bottom: 32px;
94
+ }
95
+
96
+ .section-title {
97
+ font-size: 12px;
98
+ font-weight: 600;
99
+ text-transform: uppercase;
100
+ letter-spacing: 0.05em;
101
+ color: #6b7280;
102
+ margin-bottom: 12px;
103
+ }
104
+
105
+ .section-content {
106
+ background: #f9fafb;
107
+ border-radius: 8px;
108
+ padding: 20px;
109
+ }
110
+
111
+ .customer-name {
112
+ font-size: 18px;
113
+ font-weight: 600;
114
+ margin-bottom: 8px;
115
+ }
116
+
117
+ .contact-info {
118
+ font-size: 14px;
119
+ color: #4b5563;
120
+ }
121
+
122
+ .contact-info a {
123
+ color: #4b5563;
124
+ text-decoration: none;
125
+ }
126
+
127
+ .grid {
128
+ display: grid;
129
+ grid-template-columns: 1fr 1fr;
130
+ gap: 16px;
131
+ }
132
+
133
+ .info-card {
134
+ background: #f9fafb;
135
+ border-radius: 8px;
136
+ padding: 16px;
137
+ }
138
+
139
+ .info-label {
140
+ font-size: 12px;
141
+ color: #6b7280;
142
+ margin-bottom: 4px;
143
+ }
144
+
145
+ .info-value {
146
+ font-size: 16px;
147
+ font-weight: 600;
148
+ }
149
+
150
+ .metadata-list {
151
+ display: grid;
152
+ gap: 8px;
153
+ }
154
+
155
+ .metadata-row {
156
+ display: flex;
157
+ justify-content: space-between;
158
+ gap: 16px;
159
+ padding: 8px 0;
160
+ border-bottom: 1px solid #e5e7eb;
161
+ font-size: 14px;
162
+ }
163
+
164
+ .metadata-row:last-child {
165
+ border-bottom: none;
166
+ }
167
+
168
+ .metadata-label {
169
+ color: #6b7280;
170
+ }
171
+
172
+ .metadata-value {
173
+ max-width: 60%;
174
+ font-weight: 600;
175
+ text-align: right;
176
+ overflow-wrap: anywhere;
177
+ }
178
+
179
+ .package-row {
180
+ display: flex;
181
+ justify-content: space-between;
182
+ align-items: flex-start;
183
+ }
184
+
185
+ .package-name {
186
+ font-size: 16px;
187
+ font-weight: 600;
188
+ }
189
+
190
+ .package-duration {
191
+ font-size: 14px;
192
+ color: #6b7280;
193
+ }
194
+
195
+ .package-price {
196
+ font-size: 16px;
197
+ font-weight: 600;
198
+ }
199
+
200
+ .payment-row {
201
+ display: flex;
202
+ justify-content: space-between;
203
+ padding: 8px 0;
204
+ font-size: 14px;
205
+ }
206
+
207
+ .payment-label {
208
+ color: #6b7280;
209
+ }
210
+
211
+ .payment-value {
212
+ font-weight: 500;
213
+ }
214
+
215
+ .payment-value.green {
216
+ color: #16a34a;
217
+ }
218
+
219
+ .payment-value.orange {
220
+ color: #ea580c;
221
+ }
222
+
223
+ .payment-divider {
224
+ border-top: 1px solid #e5e7eb;
225
+ margin: 12px 0;
226
+ }
227
+
228
+ .payment-total {
229
+ font-size: 16px;
230
+ font-weight: 600;
231
+ }
232
+
233
+ .footer {
234
+ margin-top: 60px;
235
+ padding-top: 20px;
236
+ border-top: 1px solid #e5e7eb;
237
+ text-align: center;
238
+ font-size: 12px;
239
+ color: #9ca3af;
240
+ }
241
+
242
+ @media print {
243
+ body {
244
+ padding: 20px;
245
+ }
246
+
247
+ .no-print {
248
+ display: none;
249
+ }
250
+ }
251
+ </style>
252
+ </head>
253
+ <body>
254
+ <div class="header">
255
+ <div class="company-info">
256
+ ${v.companyLogo?`<img src="${v.companyLogo}" alt="Logo" class="company-logo" />`:""}
257
+ ${v.companyName?`<span class="company-name">${v.companyName}</span>`:""}
258
+ </div>
259
+ <div class="document-info">
260
+ <div class="document-title">Reservation</div>
261
+ <div class="booking-id">Booking #${g}</div>
262
+ <div
263
+ class="status-badge"
264
+ style="background-color: ${Ne(o.status)}20; color: ${Ne(o.status)};"
265
+ >
266
+ ${Te(o.status)}
267
+ </div>
268
+ </div>
269
+ </div>
270
+
271
+ <div class="section">
272
+ <div class="section-title">Customer</div>
273
+ <div class="section-content">
274
+ <div class="customer-name">${R}</div>
275
+ <div class="contact-info">
276
+ ${o.customerInfo?.email?`<div>Email: <a href="mailto:${o.customerInfo.email}">${o.customerInfo.email}</a></div>`:""}
277
+ ${o.customerInfo?.phone?`<div>Phone: <a href="tel:${o.customerInfo.phone}">${o.customerInfo.phone}</a></div>`:""}
278
+ </div>
279
+ </div>
280
+ </div>
281
+
282
+ ${Ae("Order Metadata",B)}
283
+
284
+ <div class="section">
285
+ <div class="section-title">Reservation Details</div>
286
+ <div class="grid">
287
+ <div class="info-card">
288
+ <div class="info-label">Date</div>
289
+ <div class="info-value">${v.date||"—"}</div>
290
+ </div>
291
+ <div class="info-card">
292
+ <div class="info-label">Time</div>
293
+ <div class="info-value">${o.startTime} - ${o.endTime}</div>
294
+ </div>
295
+ <div class="info-card">
296
+ <div class="info-label">Spots</div>
297
+ <div class="info-value">${o.spots||1} ${(o.spots||1)===1?"person":"people"}</div>
298
+ </div>
299
+ ${v.resourceName?`
300
+ <div class="info-card">
301
+ <div class="info-label">Resource</div>
302
+ <div class="info-value">${v.resourceName}</div>
303
+ </div>
304
+ `:""}
305
+ ${v.agendaName?`
306
+ <div class="info-card">
307
+ <div class="info-label">Service</div>
308
+ <div class="info-value">${v.agendaName}</div>
309
+ </div>
310
+ `:""}
311
+ </div>
312
+ </div>
313
+
314
+ ${Ae("Reservation Metadata",s)}
315
+
316
+ ${o.pricingOption?`
317
+ <div class="section">
318
+ <div class="section-title">Package</div>
319
+ <div class="section-content">
320
+ <div class="package-row">
321
+ <div>
322
+ <div class="package-name">${o.pricingOption.name}</div>
323
+ <div class="package-duration">${je(o.pricingOption.duration)}</div>
324
+ </div>
325
+ <div class="package-price">${X(o.pricingOption.price)}</div>
326
+ </div>
327
+ </div>
328
+ </div>
329
+ `:""}
330
+
331
+ <div class="section">
332
+ <div class="section-title">Payment Summary</div>
333
+ <div class="section-content">
334
+ <div class="payment-row">
335
+ <span class="payment-label">Base price</span>
336
+ <span class="payment-value">${X(o.reservationBasePrice)}</span>
337
+ </div>
338
+ ${o.reservationAddOnsPrice?`
339
+ <div class="payment-row">
340
+ <span class="payment-label">Add-ons</span>
341
+ <span class="payment-value">${X(o.reservationAddOnsPrice)}</span>
342
+ </div>
343
+ `:""}
344
+ ${o.reservationAdjustments?.length?o.reservationAdjustments.map(m=>`
345
+ <div class="payment-row">
346
+ <span class="payment-label">${m.label||"Adjustment"}</span>
347
+ <span class="payment-value">${Re(m)}</span>
348
+ </div>
349
+ `).join(""):""}
350
+ ${o.discount?`
351
+ <div class="payment-row">
352
+ <span class="payment-label">Discount</span>
353
+ <span class="payment-value green">-${X(o.discount)}</span>
354
+ </div>
355
+ `:""}
356
+
357
+ <div class="payment-divider"></div>
358
+
359
+ <div class="payment-row payment-total">
360
+ <span>Reservation Total</span>
361
+ <span>${X(o.reservationPrice)}</span>
362
+ </div>
363
+
364
+ ${o.amountPaid!==void 0||o.amountDue!==void 0?`
365
+ <div class="payment-divider"></div>
366
+
367
+ ${o.amountPaid!==void 0?`
368
+ <div class="payment-row">
369
+ <span class="payment-label">Amount paid</span>
370
+ <span class="payment-value green">${X(o.amountPaid)}</span>
371
+ </div>
372
+ `:""}
373
+
374
+ ${o.amountDue!==void 0&&o.amountDue>0?`
375
+ <div class="payment-row">
376
+ <span class="payment-label">Amount due</span>
377
+ <span class="payment-value orange">${X(o.amountDue)}</span>
378
+ </div>
379
+ `:""}
380
+ `:""}
381
+ </div>
382
+ </div>
383
+
384
+ <div class="footer">
385
+ <p>Generated on ${E}</p>
386
+ ${v.companyName?`<p>${v.companyName}</p>`:""}
387
+ </div>
388
+ </body>
389
+ </html>
390
+ `,_=window.open("","_blank");_&&(_.document.write(x),_.document.close(),_.onload=()=>{_.print()})},Ye=(o,v={})=>{const R=`${o.customerInfo?.firstName||""} ${o.customerInfo?.lastName||""}`.trim()||"Unknown Customer",g=o.id?.slice(0,8)||"—",E=new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}),B=o.reservations.reduce((N,i)=>N+(i.reservationPrice||0),0),s=o.reservations[0],x=o.status||"",_=Se(o.metadata,v.metadataSchema,"order"),m=o.reservations.map((N,i)=>{const r=qe(N),t=[N.startTime,N.endTime].filter(Boolean).join(" - ")||"—",y=N.spots||1,$=Se(N.reservationMetadata,v.metadataSchema,"reservation"),a=[N.reservationBasePrice!==void 0?`
391
+ <div class="price-breakdown-row">
392
+ <span>Base price</span>
393
+ <span>${X(N.reservationBasePrice)}</span>
394
+ </div>
395
+ `:"",N.reservationAddOnsPrice?`
396
+ <div class="price-breakdown-row">
397
+ <span>Add-ons</span>
398
+ <span>${X(N.reservationAddOnsPrice)}</span>
399
+ </div>
400
+ `:"",N.reservationAdjustments?.length?N.reservationAdjustments.map(k=>`
401
+ <div class="price-breakdown-row">
402
+ <span>${J(k.label||"Adjustment")}</span>
403
+ <span>${Re(k)}</span>
404
+ </div>
405
+ `).join(""):""].join("");return`
406
+ <div class="reservation-card">
407
+ <div class="reservation-header">
408
+ <div>
409
+ <div class="reservation-title">Reservation ${i+1}</div>
410
+ ${N.resourceName?`<div class="reservation-resource">${J(N.resourceName)}</div>`:""}
411
+ </div>
412
+ <div
413
+ class="status-badge small"
414
+ style="background-color: ${Ne(r)}20; color: ${Ne(r)};"
415
+ >
416
+ ${J(Te(r))}
417
+ </div>
418
+ </div>
419
+ <div class="reservation-grid">
420
+ <div>
421
+ <div class="info-label">Date</div>
422
+ <div class="info-value compact">${J(Le(N.date))}</div>
423
+ </div>
424
+ <div>
425
+ <div class="info-label">Time</div>
426
+ <div class="info-value compact">${J(t)}</div>
427
+ </div>
428
+ <div>
429
+ <div class="info-label">Spots</div>
430
+ <div class="info-value compact">${y} ${y===1?"person":"people"}</div>
431
+ </div>
432
+ <div>
433
+ <div class="info-label">Price</div>
434
+ <div class="info-value compact">${X(N.reservationPrice)}</div>
435
+ </div>
436
+ </div>
437
+ ${N.pricingOption?.name?`
438
+ <div class="package-note">
439
+ <span>${J(N.pricingOption.name)}</span>
440
+ ${N.pricingOption.duration?`<span>${je(N.pricingOption.duration)}</span>`:""}
441
+ </div>
442
+ `:""}
443
+ ${$.length?`
444
+ <div class="reservation-metadata">
445
+ <div class="metadata-title">Reservation Metadata</div>
446
+ <div class="metadata-list compact">
447
+ ${Fe($,!0)}
448
+ </div>
449
+ </div>
450
+ `:""}
451
+ ${a?`
452
+ <div class="reservation-price-breakdown">
453
+ <div class="price-breakdown-title">Price breakdown</div>
454
+ ${a}
455
+ <div class="price-breakdown-row total">
456
+ <span>Reservation Total</span>
457
+ <span>${X(N.reservationPrice)}</span>
458
+ </div>
459
+ </div>
460
+ `:""}
461
+ </div>
462
+ `}).join(""),b=`
463
+ <!DOCTYPE html>
464
+ <html lang="en">
465
+ <head>
466
+ <meta charset="UTF-8">
467
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
468
+ <title>Order ${g}</title>
469
+ <style>
470
+ * {
471
+ margin: 0;
472
+ padding: 0;
473
+ box-sizing: border-box;
474
+ }
475
+
476
+ body {
477
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
478
+ line-height: 1.6;
479
+ color: #1f2937;
480
+ background: #fff;
481
+ padding: 40px;
482
+ max-width: 800px;
483
+ margin: 0 auto;
484
+ }
485
+
486
+ .header {
487
+ display: flex;
488
+ justify-content: space-between;
489
+ align-items: flex-start;
490
+ gap: 24px;
491
+ margin-bottom: 40px;
492
+ padding-bottom: 20px;
493
+ border-bottom: 2px solid #e5e7eb;
494
+ }
495
+
496
+ .company-info {
497
+ display: flex;
498
+ align-items: center;
499
+ gap: 16px;
500
+ }
501
+
502
+ .company-logo {
503
+ max-height: 50px;
504
+ max-width: 150px;
505
+ object-fit: contain;
506
+ }
507
+
508
+ .company-name {
509
+ font-size: 24px;
510
+ font-weight: 700;
511
+ color: #111827;
512
+ }
513
+
514
+ .document-info {
515
+ text-align: right;
516
+ }
517
+
518
+ .document-title {
519
+ font-size: 28px;
520
+ font-weight: 700;
521
+ color: #111827;
522
+ margin-bottom: 8px;
523
+ }
524
+
525
+ .booking-id {
526
+ font-size: 14px;
527
+ color: #6b7280;
528
+ }
529
+
530
+ .status-badge {
531
+ display: inline-block;
532
+ padding: 4px 12px;
533
+ border-radius: 9999px;
534
+ font-size: 12px;
535
+ font-weight: 600;
536
+ text-transform: uppercase;
537
+ margin-top: 8px;
538
+ }
539
+
540
+ .status-badge.small {
541
+ margin-top: 0;
542
+ white-space: nowrap;
543
+ }
544
+
545
+ .section {
546
+ margin-bottom: 32px;
547
+ }
548
+
549
+ .section-title {
550
+ font-size: 12px;
551
+ font-weight: 600;
552
+ text-transform: uppercase;
553
+ letter-spacing: 0.05em;
554
+ color: #6b7280;
555
+ margin-bottom: 12px;
556
+ }
557
+
558
+ .section-content {
559
+ background: #f9fafb;
560
+ border-radius: 8px;
561
+ padding: 20px;
562
+ }
563
+
564
+ .customer-name {
565
+ font-size: 18px;
566
+ font-weight: 600;
567
+ margin-bottom: 8px;
568
+ }
569
+
570
+ .contact-info {
571
+ font-size: 14px;
572
+ color: #4b5563;
573
+ }
574
+
575
+ .grid {
576
+ display: grid;
577
+ grid-template-columns: 1fr 1fr;
578
+ gap: 16px;
579
+ }
580
+
581
+ .info-card {
582
+ background: #f9fafb;
583
+ border-radius: 8px;
584
+ padding: 16px;
585
+ }
586
+
587
+ .info-label {
588
+ font-size: 12px;
589
+ color: #6b7280;
590
+ margin-bottom: 4px;
591
+ }
592
+
593
+ .info-value {
594
+ font-size: 16px;
595
+ font-weight: 600;
596
+ }
597
+
598
+ .info-value.compact {
599
+ font-size: 14px;
600
+ }
601
+
602
+ .metadata-list {
603
+ display: grid;
604
+ gap: 8px;
605
+ }
606
+
607
+ .metadata-list.compact {
608
+ gap: 4px;
609
+ }
610
+
611
+ .metadata-row {
612
+ display: flex;
613
+ justify-content: space-between;
614
+ gap: 16px;
615
+ padding: 8px 0;
616
+ border-bottom: 1px solid #e5e7eb;
617
+ font-size: 14px;
618
+ }
619
+
620
+ .metadata-row.compact {
621
+ padding: 4px 0;
622
+ font-size: 13px;
623
+ }
624
+
625
+ .metadata-row:last-child {
626
+ border-bottom: none;
627
+ }
628
+
629
+ .metadata-label {
630
+ color: #6b7280;
631
+ }
632
+
633
+ .metadata-value {
634
+ max-width: 60%;
635
+ font-weight: 600;
636
+ text-align: right;
637
+ overflow-wrap: anywhere;
638
+ }
639
+
640
+ .reservation-metadata {
641
+ margin-top: 12px;
642
+ padding-top: 12px;
643
+ border-top: 1px solid #e5e7eb;
644
+ }
645
+
646
+ .metadata-title {
647
+ font-size: 12px;
648
+ font-weight: 600;
649
+ color: #6b7280;
650
+ margin-bottom: 6px;
651
+ }
652
+
653
+ .reservation-list {
654
+ display: grid;
655
+ gap: 12px;
656
+ }
657
+
658
+ .reservation-card {
659
+ background: #f9fafb;
660
+ border-radius: 8px;
661
+ padding: 16px;
662
+ break-inside: avoid;
663
+ }
664
+
665
+ .reservation-header {
666
+ display: flex;
667
+ justify-content: space-between;
668
+ align-items: flex-start;
669
+ gap: 16px;
670
+ margin-bottom: 14px;
671
+ }
672
+
673
+ .reservation-title {
674
+ font-size: 16px;
675
+ font-weight: 600;
676
+ }
677
+
678
+ .reservation-resource {
679
+ font-size: 13px;
680
+ color: #6b7280;
681
+ }
682
+
683
+ .reservation-grid {
684
+ display: grid;
685
+ grid-template-columns: repeat(4, 1fr);
686
+ gap: 12px;
687
+ }
688
+
689
+ .package-note {
690
+ display: flex;
691
+ gap: 12px;
692
+ margin-top: 12px;
693
+ padding-top: 12px;
694
+ border-top: 1px solid #e5e7eb;
695
+ font-size: 13px;
696
+ color: #4b5563;
697
+ }
698
+
699
+ .reservation-price-breakdown {
700
+ margin-top: 12px;
701
+ padding-top: 12px;
702
+ border-top: 1px solid #e5e7eb;
703
+ }
704
+
705
+ .price-breakdown-title {
706
+ font-size: 12px;
707
+ font-weight: 600;
708
+ color: #6b7280;
709
+ margin-bottom: 6px;
710
+ }
711
+
712
+ .price-breakdown-row {
713
+ display: flex;
714
+ justify-content: space-between;
715
+ gap: 20px;
716
+ padding: 3px 0;
717
+ font-size: 13px;
718
+ color: #4b5563;
719
+ }
720
+
721
+ .price-breakdown-row span:last-child {
722
+ font-weight: 500;
723
+ color: #1f2937;
724
+ text-align: right;
725
+ }
726
+
727
+ .price-breakdown-row.total {
728
+ margin-top: 6px;
729
+ padding-top: 8px;
730
+ border-top: 1px solid #e5e7eb;
731
+ font-weight: 600;
732
+ color: #111827;
733
+ }
734
+
735
+ .payment-row {
736
+ display: flex;
737
+ justify-content: space-between;
738
+ gap: 24px;
739
+ padding: 8px 0;
740
+ font-size: 14px;
741
+ }
742
+
743
+ .payment-label {
744
+ color: #6b7280;
745
+ }
746
+
747
+ .payment-value {
748
+ font-weight: 500;
749
+ text-align: right;
750
+ }
751
+
752
+ .payment-value.green {
753
+ color: #16a34a;
754
+ }
755
+
756
+ .payment-value.orange {
757
+ color: #ea580c;
758
+ }
759
+
760
+ .payment-divider {
761
+ border-top: 1px solid #e5e7eb;
762
+ margin: 12px 0;
763
+ }
764
+
765
+ .payment-total {
766
+ font-size: 16px;
767
+ font-weight: 600;
768
+ }
769
+
770
+ .footer {
771
+ margin-top: 60px;
772
+ padding-top: 20px;
773
+ border-top: 1px solid #e5e7eb;
774
+ text-align: center;
775
+ font-size: 12px;
776
+ color: #9ca3af;
777
+ }
778
+
779
+ @media print {
780
+ body {
781
+ padding: 20px;
782
+ }
783
+ }
784
+ </style>
785
+ </head>
786
+ <body>
787
+ <div class="header">
788
+ <div class="company-info">
789
+ ${v.companyLogo?`<img src="${Ie(v.companyLogo)}" alt="Logo" class="company-logo" />`:""}
790
+ ${v.companyName?`<span class="company-name">${J(v.companyName)}</span>`:""}
791
+ </div>
792
+ <div class="document-info">
793
+ <div class="document-title">Order</div>
794
+ <div class="booking-id">Order #${J(g)}</div>
795
+ <div
796
+ class="status-badge"
797
+ style="background-color: ${Ne(x)}20; color: ${Ne(x)};"
798
+ >
799
+ ${J(Te(x))}
800
+ </div>
801
+ </div>
802
+ </div>
803
+
804
+ <div class="section">
805
+ <div class="section-title">Customer</div>
806
+ <div class="section-content">
807
+ <div class="customer-name">${J(R)}</div>
808
+ <div class="contact-info">
809
+ ${o.customerInfo?.email?`<div>Email: ${J(o.customerInfo.email)}</div>`:""}
810
+ ${o.customerInfo?.phone?`<div>Phone: ${J(o.customerInfo.phone)}</div>`:""}
811
+ </div>
812
+ </div>
813
+ </div>
814
+
815
+ ${Ae("Order Metadata",_)}
816
+
817
+ <div class="section">
818
+ <div class="section-title">Order Summary</div>
819
+ <div class="grid">
820
+ <div class="info-card">
821
+ <div class="info-label">Reservations</div>
822
+ <div class="info-value">${o.reservations.length}</div>
823
+ </div>
824
+ <div class="info-card">
825
+ <div class="info-label">Spots</div>
826
+ <div class="info-value">${o.totalSpots}</div>
827
+ </div>
828
+ <div class="info-card">
829
+ <div class="info-label">Ordered at</div>
830
+ <div class="info-value">${J(He(o.createdAt))}</div>
831
+ </div>
832
+ ${v.agendaName?`
833
+ <div class="info-card">
834
+ <div class="info-label">Service</div>
835
+ <div class="info-value">${J(v.agendaName)}</div>
836
+ </div>
837
+ `:""}
838
+ </div>
839
+ </div>
840
+
841
+ <div class="section">
842
+ <div class="section-title">Reservations</div>
843
+ <div class="reservation-list">
844
+ ${m}
845
+ </div>
846
+ </div>
847
+
848
+ <div class="section">
849
+ <div class="section-title">Payment Summary</div>
850
+ <div class="section-content">
851
+ <div class="payment-row">
852
+ <span class="payment-label">Reservations</span>
853
+ <span class="payment-value">${X(B)}</span>
854
+ </div>
855
+ ${s?.subtotal!==void 0&&s.subtotal!==o.totalPrice?`
856
+ <div class="payment-row">
857
+ <span class="payment-label">Subtotal</span>
858
+ <span class="payment-value">${X(s.subtotal)}</span>
859
+ </div>
860
+ `:""}
861
+ ${o.adjustments?.length?o.adjustments.map(N=>`
862
+ <div class="payment-row">
863
+ <span class="payment-label">${J(N.label||"Adjustment")}</span>
864
+ <span class="payment-value">${Re(N)}</span>
865
+ </div>
866
+ `).join(""):""}
867
+ ${s?.discount?`
868
+ <div class="payment-row">
869
+ <span class="payment-label">Discount</span>
870
+ <span class="payment-value green">-${X(s.discount)}</span>
871
+ </div>
872
+ `:""}
873
+
874
+ <div class="payment-divider"></div>
875
+
876
+ <div class="payment-row payment-total">
877
+ <span>Order Total</span>
878
+ <span>${X(o.totalPrice)}</span>
879
+ </div>
880
+
881
+ ${s?.amountPaid!==void 0||s?.amountDue!==void 0?`
882
+ <div class="payment-divider"></div>
883
+
884
+ ${s?.amountPaid!==void 0?`
885
+ <div class="payment-row">
886
+ <span class="payment-label">Amount paid</span>
887
+ <span class="payment-value green">${X(s.amountPaid)}</span>
888
+ </div>
889
+ `:""}
890
+
891
+ ${s?.amountDue!==void 0&&s.amountDue>0?`
892
+ <div class="payment-row">
893
+ <span class="payment-label">Amount due</span>
894
+ <span class="payment-value orange">${X(s.amountDue)}</span>
895
+ </div>
896
+ `:""}
897
+ `:""}
898
+ </div>
899
+ </div>
900
+
901
+ <div class="footer">
902
+ <p>Generated on ${E}</p>
903
+ ${v.companyName?`<p>${J(v.companyName)}</p>`:""}
904
+ </div>
905
+ </body>
906
+ </html>
907
+ `,f=window.open("","_blank");f&&(f.document.write(b),f.document.close(),f.onload=()=>{f.print()})};function Me(o){const v=W.useModuleApi(),R=e.ref([]),g=e.ref(!1),E=async()=>{if(!o.value){R.value=[];return}g.value=!0;try{const B=await v.get(`/agendas/${o.value}/metadata-schema`);R.value=Array.isArray(B?.metadataSchema)?B.metadataSchema:[]}catch(B){console.error("Error loading metadata schema:",B),R.value=[]}finally{g.value=!1}};return e.watch(o,E,{immediate:!0}),{metadataSchema:R,isMetadataSchemaLoading:g,loadMetadataSchema:E}}const Ke={class:"flex items-center bg-muted/70 dark:bg-muted/20 px-4 rounded-md"},Xe={class:"grid gap-2"},Ze={class:"grid gap-2"},Qe={class:"grid gap-2"},et=e.defineComponent({__name:"CancelReservationDialog",emits:["confirm"],setup(o,{expose:v,emit:R}){const{config:g}=W.useModule(),{sendMail:E}=W.useMailer(g.mailAccount),B=R,s=e.ref(!1),x=e.ref(!1),_=e.ref(""),m=e.ref(""),b=e.ref(""),f=i=>{x.value=!g.mailAccount,s.value=!0,i&&(_.value=i.customerInfo?.email,m.value="Cancellation of your reservation - "+new Date(i.date)?.toDateString(),b.value=`Dear ${i.customerInfo?.firstName??""} ${i.customerInfo?.lastName??""},
908
+
909
+ We are writing to inform you that your reservation scheduled for ${new Date(i.date)?.toDateString()} at ${i.startTime} has been cancelled.
910
+
911
+ 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.`)},N=()=>{if(!x.value){if(!_.value||!m.value||!b.value)return alert("Please fill in all the fields.");E({to:_.value,subject:m.value,body:b.value})}s.value=!1;const{$confetti:i}=useNuxtApp();i(),B("confirm")};return v({openDialog:f}),(i,r)=>{const t=e.resolveComponent("DialogTitle"),y=e.resolveComponent("DialogDescription"),$=e.resolveComponent("DialogHeader"),a=e.resolveComponent("Checkbox"),k=e.resolveComponent("Label"),j=e.resolveComponent("Input"),L=e.resolveComponent("Textarea"),Y=e.resolveComponent("Button"),H=e.resolveComponent("DialogFooter"),C=e.resolveComponent("DialogScrollContent"),w=e.resolveComponent("Dialog");return e.openBlock(),e.createBlock(w,{open:s.value,"onUpdate:open":r[5]||(r[5]=D=>s.value=D)},{default:e.withCtx(()=>[e.createVNode(C,{class:"sm:max-w-3xl"},{default:e.withCtx(()=>[e.createVNode($,null,{default:e.withCtx(()=>[e.createVNode(t,null,{default:e.withCtx(()=>[...r[6]||(r[6]=[e.createTextVNode(" Cancel Reservation ",-1)])]),_:1}),e.createVNode(y)]),_:1}),e.createElementVNode("div",Ke,[e.createVNode(a,{modelValue:x.value,"onUpdate:modelValue":r[0]||(r[0]=D=>x.value=D),id:"cancel-dialog-skip-mail",class:"border-black/80 dark:border-gray-200",disabled:!e.unref(g).mailAccount},null,8,["modelValue","disabled"]),e.createVNode(k,{for:"cancel-dialog-skip-mail",class:"py-4 pl-2 pr-4"},{default:e.withCtx(()=>[...r[7]||(r[7]=[e.createTextVNode("Do not send email to customer",-1)])]),_:1})]),e.createElementVNode("div",{class:e.normalizeClass(["grid gap-4 py-4",{"opacity-50":x.value}])},[e.createElementVNode("div",Xe,[e.createVNode(k,{for:"cancel-dialog-email"},{default:e.withCtx(()=>[...r[8]||(r[8]=[e.createTextVNode("To:",-1)])]),_:1}),e.createVNode(j,{modelValue:_.value,"onUpdate:modelValue":r[1]||(r[1]=D=>_.value=D),disabled:x.value,id:"cancel-dialog-email"},null,8,["modelValue","disabled"])]),e.createElementVNode("div",Ze,[e.createVNode(k,{for:"cancel-dialog-subject"},{default:e.withCtx(()=>[...r[9]||(r[9]=[e.createTextVNode("Subject:",-1)])]),_:1}),e.createVNode(j,{modelValue:m.value,"onUpdate:modelValue":r[2]||(r[2]=D=>m.value=D),disabled:x.value,id:"cancel-dialog-subject"},null,8,["modelValue","disabled"])]),e.createElementVNode("div",Qe,[e.createVNode(k,{for:"cancel-dialog-body"},{default:e.withCtx(()=>[...r[10]||(r[10]=[e.createTextVNode("Body:",-1)])]),_:1}),e.createVNode(L,{modelValue:b.value,"onUpdate:modelValue":r[3]||(r[3]=D=>b.value=D),disabled:x.value,id:"cancel-dialog-body"},null,8,["modelValue","disabled"])])],2),e.createVNode(H,null,{default:e.withCtx(()=>[e.createVNode(Y,{variant:"outline",onClick:r[4]||(r[4]=D=>s.value=!1)},{default:e.withCtx(()=>[...r[11]||(r[11]=[e.createTextVNode("Close",-1)])]),_:1}),e.createVNode(Y,{variant:"destructive",onClick:N},{default:e.withCtx(()=>[...r[12]||(r[12]=[e.createTextVNode("Cancel reservation",-1)])]),_:1})]),_:1})]),_:1})]),_:1},8,["open"])}}}),tt={key:0,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"},ot={class:"grid gap-4 py-4"},at={key:0,class:"grid gap-2"},nt={class:"relative"},rt={class:"grid gap-2"},st={key:0,class:"flex items-center gap-2 rounded-md border px-3 py-2"},lt={key:0,class:"text-destructive"},it={key:0,class:"text-destructive"},dt={class:"flex items-center bg-muted/70 dark:bg-muted/20 px-4 rounded-md"},ct={class:"grid gap-2"},ut={class:"grid gap-2"},mt={class:"grid gap-2"},pt=e.defineComponent({__name:"CancelRefundReservationDialog",props:{isProcessing:{type:Boolean},hasRefundFlow:{type:Boolean},showRefundAmount:{type:Boolean},customFields:{}},emits:["confirm"],setup(o,{expose:v,emit:R}){const g=o,E=R,{config:B}=W.useModule(),s=e.ref(!1),x=e.ref(!1),_=e.ref(""),m=e.ref(""),b=e.ref(""),f=e.ref(0),N=e.ref("Reservation cancelled"),i=e.ref(""),r=e.ref({}),t=e.computed(()=>`€${(Number(f.value)||0).toFixed(2)}`),y=e.computed(()=>g.showRefundAmount!==!1),$=e.computed(()=>g.customFields||[]);e.watch(f,()=>{if(!y.value)return;const C=t.value;i.value&&b.value.includes(i.value)&&(b.value=b.value.replace(i.value,C)),i.value=C});const a=C=>{const w=Number(C?.reservationPrice??C?.pricingOption?.price??0),D=Number(C?.amountPaid??0),F=Number(C?.total??0);return D>0&&w>0?Math.min(D,w):D>0?D:w>0?w:F>0?F:0},k=C=>C.defaultValue!==void 0?C.defaultValue:C.type==="number"?0:C.type==="checkbox"?!1:"",j=()=>{r.value=Object.fromEntries($.value.filter(C=>C.key).map(C=>[C.key,k(C)]))},L=C=>{x.value=!B.mailAccount,f.value=a(C),i.value=t.value,N.value="Reservation cancelled",j(),s.value=!0,C&&(_.value=C.customerInfo?.email||"",m.value=`Cancellation and refund of your reservation - ${new Date(C.date)?.toDateString()}`,b.value=`Dear ${C.customerInfo?.firstName??""} ${C.customerInfo?.lastName??""},
912
+
913
+ We are writing to inform you that your reservation scheduled for ${new Date(C.date)?.toDateString()} at ${C.startTime} has been cancelled.
914
+
915
+ ${y.value?`A refund of ${t.value} will be processed according to our refund policy.`:"We will process this cancellation according to our policy."}
916
+
917
+ Please accept our sincere apologies for any inconvenience this may cause.`)},Y=()=>{s.value=!1},H=()=>{if(!g.hasRefundFlow)return;if(y.value&&(!f.value||f.value<=0))return alert("Please enter a refund amount.");if(!N.value)return alert("Please enter a refund reason.");if(!x.value&&(!_.value||!m.value||!b.value))return alert("Please fill in all the email fields.");const C=$.value.find(w=>{if(!w.required||!w.key)return!1;const D=r.value[w.key];return w.type==="checkbox"?D!==!0:D==null||D===""});if(C)return alert(`Please fill in ${C.label}.`);E("confirm",{amount:y.value?Number(f.value):void 0,reason:N.value,fields:{...r.value},fieldDefinitions:$.value,skipMail:x.value,email:_.value,subject:m.value,body:b.value})};return v({openDialog:L,closeDialog:Y}),(C,w)=>{const D=e.resolveComponent("DialogTitle"),F=e.resolveComponent("DialogDescription"),ne=e.resolveComponent("DialogHeader"),G=e.resolveComponent("Label"),z=e.resolveComponent("Input"),re=e.resolveComponent("Checkbox"),ce=e.resolveComponent("Textarea"),ue=e.resolveComponent("Button"),c=e.resolveComponent("DialogFooter"),u=e.resolveComponent("DialogScrollContent"),P=e.resolveComponent("Dialog");return e.openBlock(),e.createBlock(P,{open:s.value,"onUpdate:open":w[7]||(w[7]=V=>s.value=V)},{default:e.withCtx(()=>[e.createVNode(u,{class:"sm:max-w-3xl"},{default:e.withCtx(()=>[e.createVNode(ne,null,{default:e.withCtx(()=>[e.createVNode(D,null,{default:e.withCtx(()=>[...w[8]||(w[8]=[e.createTextVNode(" Cancel & Refund Reservation ",-1)])]),_:1}),e.createVNode(F,null,{default:e.withCtx(()=>[...w[9]||(w[9]=[e.createTextVNode(" Run the configured refund flow and cancel this reservation. ",-1)])]),_:1})]),_:1}),o.hasRefundFlow?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",tt,[e.createVNode(e.unref(T.AlertTriangle),{class:"mt-0.5 size-4 shrink-0"}),w[10]||(w[10]=e.createElementVNode("div",null,[e.createElementVNode("p",{class:"font-medium"},"No refund flow configured"),e.createElementVNode("p",{class:"mt-1 text-orange-800 dark:text-orange-300"}," Add one in this agenda's Refunds settings before processing refunds. ")],-1))])),e.createElementVNode("div",ot,[y.value?(e.openBlock(),e.createElementBlock("div",at,[e.createVNode(G,{for:"refund-dialog-amount"},{default:e.withCtx(()=>[...w[11]||(w[11]=[e.createTextVNode("Refund amount",-1)])]),_:1}),e.createElementVNode("div",nt,[e.createVNode(e.unref(T.Receipt),{class:"absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),e.createVNode(z,{id:"refund-dialog-amount",modelValue:f.value,"onUpdate:modelValue":w[0]||(w[0]=V=>f.value=V),modelModifiers:{number:!0},type:"number",min:"0",step:"0.01",class:"pl-9 no-spinner",disabled:o.isProcessing},null,8,["modelValue","disabled"])])])):e.createCommentVNode("",!0),e.createElementVNode("div",rt,[e.createVNode(G,{for:"refund-dialog-reason"},{default:e.withCtx(()=>[...w[12]||(w[12]=[e.createTextVNode("Reason",-1)])]),_:1}),e.createVNode(z,{id:"refund-dialog-reason",modelValue:N.value,"onUpdate:modelValue":w[1]||(w[1]=V=>N.value=V),disabled:o.isProcessing},null,8,["modelValue","disabled"])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList($.value,V=>(e.openBlock(),e.createElementBlock("div",{key:V.id,class:"grid gap-2"},[V.type==="checkbox"?(e.openBlock(),e.createElementBlock("div",st,[e.createVNode(re,{id:`refund-dialog-field-${V.id}`,modelValue:r.value[V.key],"onUpdate:modelValue":q=>r.value[V.key]=q,disabled:o.isProcessing},null,8,["id","modelValue","onUpdate:modelValue","disabled"]),e.createVNode(G,{for:`refund-dialog-field-${V.id}`,class:"text-sm"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(V.label),1),V.required?(e.openBlock(),e.createElementBlock("span",lt," *")):e.createCommentVNode("",!0)]),_:2},1032,["for"])])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(G,{for:`refund-dialog-field-${V.id}`},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(V.label),1),V.required?(e.openBlock(),e.createElementBlock("span",it," *")):e.createCommentVNode("",!0)]),_:2},1032,["for"]),V.type==="textarea"?(e.openBlock(),e.createBlock(ce,{key:0,id:`refund-dialog-field-${V.id}`,modelValue:r.value[V.key],"onUpdate:modelValue":q=>r.value[V.key]=q,placeholder:V.placeholder,disabled:o.isProcessing},null,8,["id","modelValue","onUpdate:modelValue","placeholder","disabled"])):V.type==="number"?(e.openBlock(),e.createBlock(z,{key:1,id:`refund-dialog-field-${V.id}`,modelValue:r.value[V.key],"onUpdate:modelValue":q=>r.value[V.key]=q,modelModifiers:{number:!0},type:"number",placeholder:V.placeholder,disabled:o.isProcessing,class:"no-spinner"},null,8,["id","modelValue","onUpdate:modelValue","placeholder","disabled"])):(e.openBlock(),e.createBlock(z,{key:2,id:`refund-dialog-field-${V.id}`,modelValue:r.value[V.key],"onUpdate:modelValue":q=>r.value[V.key]=q,type:"text",placeholder:V.placeholder,disabled:o.isProcessing},null,8,["id","modelValue","onUpdate:modelValue","placeholder","disabled"]))],64))]))),128))]),e.createElementVNode("div",dt,[e.createVNode(re,{modelValue:x.value,"onUpdate:modelValue":w[2]||(w[2]=V=>x.value=V),id:"refund-dialog-skip-mail",class:"border-black/80 dark:border-gray-200",disabled:!e.unref(B).mailAccount||o.isProcessing},null,8,["modelValue","disabled"]),e.createVNode(G,{for:"refund-dialog-skip-mail",class:"py-4 pl-2 pr-4"},{default:e.withCtx(()=>[...w[13]||(w[13]=[e.createTextVNode("Do not send email to customer",-1)])]),_:1})]),e.createElementVNode("div",{class:e.normalizeClass(["grid gap-4 py-4",{"opacity-50":x.value}])},[e.createElementVNode("div",ct,[e.createVNode(G,{for:"refund-dialog-email"},{default:e.withCtx(()=>[...w[14]||(w[14]=[e.createTextVNode("To:",-1)])]),_:1}),e.createVNode(z,{modelValue:_.value,"onUpdate:modelValue":w[3]||(w[3]=V=>_.value=V),disabled:x.value||o.isProcessing,id:"refund-dialog-email"},null,8,["modelValue","disabled"])]),e.createElementVNode("div",ut,[e.createVNode(G,{for:"refund-dialog-subject"},{default:e.withCtx(()=>[...w[15]||(w[15]=[e.createTextVNode("Subject:",-1)])]),_:1}),e.createVNode(z,{modelValue:m.value,"onUpdate:modelValue":w[4]||(w[4]=V=>m.value=V),disabled:x.value||o.isProcessing,id:"refund-dialog-subject"},null,8,["modelValue","disabled"])]),e.createElementVNode("div",mt,[e.createVNode(G,{for:"refund-dialog-body"},{default:e.withCtx(()=>[...w[16]||(w[16]=[e.createTextVNode("Body:",-1)])]),_:1}),e.createVNode(ce,{modelValue:b.value,"onUpdate:modelValue":w[5]||(w[5]=V=>b.value=V),disabled:x.value||o.isProcessing,id:"refund-dialog-body"},null,8,["modelValue","disabled"])])],2),e.createVNode(c,null,{default:e.withCtx(()=>[e.createVNode(ue,{variant:"outline",onClick:w[6]||(w[6]=V=>s.value=!1),disabled:o.isProcessing},{default:e.withCtx(()=>[...w[17]||(w[17]=[e.createTextVNode("Close",-1)])]),_:1},8,["disabled"]),e.createVNode(ue,{variant:"destructive",onClick:H,disabled:o.isProcessing||!o.hasRefundFlow},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.isProcessing?"Processing...":"Cancel & Refund"),1)]),_:1},8,["disabled"])]),_:1})]),_:1})]),_:1},8,["open"])}}}),vt={class:"pb-4"},ft={class:"mt-6 grid gap-4 md:grid-cols-3"},gt={class:"space-y-2"},bt={class:"space-y-2"},yt={class:"space-y-2"},xt={key:0,class:"text-xs text-muted-foreground"},Nt={class:"mt-4 rounded-lg border bg-muted/30 p-4"},kt={class:"mt-2 text-sm text-foreground"},Vt={key:0},wt={key:1,class:"mt-4 text-sm text-red-500"},ht=e.defineComponent({__name:"TransferReservationDialog",props:{agendaData:{}},emits:["transferred"],setup(o,{expose:v,emit:R}){const g=o,E=R,{config:B}=W.useModule(),{params:s}=W.useModuleRoute(),x=W.useFirebaseIntegration(B.project),_=e.ref(!1),m=e.ref(null),b=e.ref(""),f=e.ref(""),N=e.ref(""),i=e.ref(!1),r=e.ref(!1),t=e.ref(""),y=e.ref(""),$=e.ref(null),a=e.ref(null);let k=0;const j=/^([01]\d|2[0-3]):[0-5]\d$/,L=e.computed(()=>g.agendaData?.resources||[]),Y=e.computed(()=>m.value?.resourceId||""),H=e.computed(()=>L.value.filter(d=>d.isActive!==!1||d.id===Y.value)),C=e.computed(()=>L.value.find(d=>d.id===N.value)),w=e.computed(()=>C.value?.name??"No resource selected"),D=e.computed(()=>m.value?.agendaId||g.agendaData?.id||s.value?.id||s.id||""),F=e.computed(()=>{const d=Number(m.value?.spots);return Number.isFinite(d)&&d>0?d:1}),ne=e.computed(()=>{const d=Number(C.value?.capacity);return Number.isFinite(d)&&d>0?d:1}),G=e.computed(()=>{const d=Number(m.value?.pricingOption?.duration);if(Number.isFinite(d)&&d>0)return d;const p=z(m.value?.startTime),M=z(m.value?.endTime);return p===null||M===null||M<=p?0:M-p}),z=d=>{if(!d||!j.test(d))return null;const[p,M]=d.split(":").map(Number);return p*60+M},re=d=>{const p=(d%1440+1440)%1440,M=Math.floor(p/60),I=p%60;return`${M.toString().padStart(2,"0")}:${I.toString().padStart(2,"0")}`},ce=d=>{if(!/^\d{4}-\d{2}-\d{2}$/.test(d))return null;const[p,M,I]=d.split("-").map(Number),h=new Date(p,M-1,I);return Number.isNaN(h.getTime())||h.getFullYear()!==p||h.getMonth()!==M-1||h.getDate()!==I?null:h},ue=(d,p)=>(g.agendaData?.exceptions||[]).find(I=>p>=I.startDate&&p<=I.endDate?!I.resourceIds||I.resourceIds.length===0?!0:I.resourceIds.includes(d):!1)||null,c=()=>{const d=C.value,p=ce(b.value);if(!d||!p)return[];const M=ue(d.id,b.value);if(M)return M.isClosed?[]:(M.timeslots||[]).map(h=>({start:h.startTime,end:h.endTime}));const I=p.getDay();return d.openingHours?.[I]||[]},u=e.computed(()=>{const d=C.value;if(!d)return[];const p=Number(d.interval)>0?Number(d.interval):60,M=G.value,I=new Set;for(const h of c()){const O=z(h.start),K=z(h.end);if(O===null||K===null||K<=O)continue;const ae=M>0?K-M:K-p;for(let ee=O;ee<=ae;ee+=p)I.add(re(ee))}return Array.from(I).sort((h,O)=>(z(h)??0)-(z(O)??0))}),P=e.computed(()=>{if(G.value<=0)return"";const d=z(f.value);return d===null?"":re(d+G.value)}),V=e.computed(()=>!!(m.value?.id&&m.value?.res_id&&b.value&&N.value&&f.value&&P.value&&j.test(f.value)&&u.value.includes(f.value))),q=e.computed(()=>a.value!==null&&a.value>=F.value),se=e.computed(()=>{if(!V.value)return"";if(r.value)return"Checking availability...";if(y.value)return y.value;if(a.value===null||$.value===null)return"";if(!q.value){const p=Math.max(a.value,0);return`${p} ${p===1?"spot is":"spots are"} available. This reservation needs ${F.value}.`}const d=a.value-F.value;return`${a.value} of ${ne.value} ${ne.value===1?"spot is":"spots are"} available. ${d} ${d===1?"spot":"spots"} will remain.`}),le=e.computed(()=>!!(V.value&&q.value&&!r.value&&!i.value)),me=()=>{y.value="",$.value=null,a.value=null},pe=d=>["approved","needs_approval"].includes(d?.status),oe=(d,p,M,I)=>d<I&&p>M,ge=async()=>{if(!V.value)return null;const d=z(f.value),p=z(P.value);if(d===null||p===null||p<=d)return null;const M=`${N.value}_${b.value}`,I=[{field:"status",operator:"==",value:"confirmed"},{field:"flattenedReservationDates",operator:"array-contains-any",value:[M]}];D.value&&I.unshift({field:"agendaId",operator:"==",value:D.value});const h=await x.find(B.reservationsCollection,{filters:I}),O=m.value?.id||m.value?.orderId,K=m.value?.res_id;let ae=0;for(const ie of h||[]){const de=ie?.id||ie?.orderId,l=ie?.reservations||[];for(const n of l){if(n?.id===K&&(!de||de===O)||!pe(n)||n?.date!==b.value||n?.resourceId!==N.value)continue;const A=z(n?.timeslot?.startTime),U=z(n?.timeslot?.endTime);if(A===null||U===null||U<=A||!oe(d,p,A,U))continue;const Z=Number(n?.spots);ae+=Number.isFinite(Z)&&Z>0?Z:1}}const ee=ne.value;return{reserved:ae,available:ee-ae}},ve=async()=>{const d=++k;if(me(),!V.value)return r.value=!1,null;try{r.value=!0;const p=await ge();return d!==k?null:p?($.value=p.reserved,a.value=p.available,p):(y.value="Could not check availability for this selection.",null)}catch(p){return d!==k||(console.error("Error checking transfer availability:",p),y.value="Could not check availability for this selection."),null}finally{d===k&&(r.value=!1)}},ke=d=>!d?.resourceId||!d?.date?"":`${d.resourceId}_${d.date}`,Ve=d=>{const p=d?.timeslot?.startTime;return!d?.resourceId||!d?.date||!p?"":`${d.resourceId}_${d.date}_${String(p).replace(":","")}`},we=d=>{const p=d?.id||d?.orderId;!d||!p||(m.value={...d,id:p},b.value=d.date||"",f.value=d.startTime||"",N.value=d.resourceId||H.value[0]?.id||"",i.value=!1,t.value="",me(),_.value=!0,be(),ve())},be=()=>{u.value.includes(f.value)||(f.value=u.value[0]||"")},he=async()=>{if(!le.value){t.value=V.value?"Not enough spots are available for this transfer.":"Select a resource, date, and time before transferring.";return}try{i.value=!0,t.value="";const d=await ve();if(!d||d.available<F.value){t.value="Not enough spots are available for this transfer.";return}const p=m.value.id,M=m.value.res_id,I=await x.get(B.reservationsCollection,p),h=I?.reservations||[],O=h.find(n=>n.id===M);if(!O)throw new Error("Reservation not found");const K=C.value,ae={...O,date:b.value,resource:K?{...O.resource,avatarLabel:K.avatarLabel||"",color:K.color||"",description:K.description||"",id:K.id,name:K.name||""}:O.resource,resourceId:N.value,timeslot:{...O.timeslot,startTime:f.value,endTime:P.value||f.value}},ee=h.map(n=>n.id===M?ae:n),ie=Array.from(new Set(ee.map(ke).filter(Boolean))),de=ee.map(Ve).filter(Boolean),l={reservations:ee,flattenedReservationDates:ie,flattenedReservations:de,updatedAt:new Date};await x.update(B.reservationsCollection,p,l),Q.toast.success("Reservation transferred successfully"),E("transferred",{orderId:p,reservationId:M,reservation:ae,order:{...I,...l,id:p}}),_.value=!1}catch(d){console.error("Error transferring reservation:",d),t.value="Failed to transfer reservation.",Q.toast.error("Failed to transfer reservation")}finally{i.value=!1}};return e.watch([N,b],()=>{_.value&&be()}),e.watch([N,b,f,P],()=>{_.value&&ve()}),v({openDialog:we}),(d,p)=>{const M=e.resolveComponent("DialogTitle"),I=e.resolveComponent("DialogDescription"),h=e.resolveComponent("DialogHeader"),O=e.resolveComponent("Label"),K=e.resolveComponent("SelectValue"),ae=e.resolveComponent("SelectTrigger"),ee=e.resolveComponent("SelectItem"),ie=e.resolveComponent("SelectContent"),de=e.resolveComponent("Select"),l=e.resolveComponent("Input"),n=e.resolveComponent("Button"),A=e.resolveComponent("DialogFooter"),U=e.resolveComponent("DialogScrollContent"),Z=e.resolveComponent("Dialog");return e.openBlock(),e.createBlock(Z,{open:_.value,"onUpdate:open":p[4]||(p[4]=S=>_.value=S)},{default:e.withCtx(()=>[e.createVNode(U,{class:"sm:max-w-3xl"},{default:e.withCtx(()=>[e.createVNode(h,null,{default:e.withCtx(()=>[e.createVNode(M,null,{default:e.withCtx(()=>[...p[5]||(p[5]=[e.createTextVNode(" Transfer Reservation ",-1)])]),_:1}),e.createVNode(I)]),_:1}),e.createElementVNode("div",vt,[p[10]||(p[10]=e.createElementVNode("p",{class:"text-sm text-muted-foreground"}," This will transfer the reservation to another date, time or resource. ",-1)),e.createElementVNode("div",ft,[e.createElementVNode("div",gt,[e.createVNode(O,{for:"transfer-reservation-resource"},{default:e.withCtx(()=>[...p[6]||(p[6]=[e.createTextVNode("Resource",-1)])]),_:1}),e.createVNode(de,{modelValue:N.value,"onUpdate:modelValue":p[0]||(p[0]=S=>N.value=S)},{default:e.withCtx(()=>[e.createVNode(ae,{id:"transfer-reservation-resource",class:"w-full"},{default:e.withCtx(()=>[e.createVNode(K,{placeholder:"Select a resource"})]),_:1}),e.createVNode(ie,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(H.value,S=>(e.openBlock(),e.createBlock(ee,{key:S.id,value:S.id},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(S.name),1)]),_:2},1032,["value"]))),128))]),_:1})]),_:1},8,["modelValue"])]),e.createElementVNode("div",bt,[e.createVNode(O,{for:"transfer-reservation-date"},{default:e.withCtx(()=>[...p[7]||(p[7]=[e.createTextVNode("Date",-1)])]),_:1}),e.createVNode(l,{id:"transfer-reservation-date",modelValue:b.value,"onUpdate:modelValue":p[1]||(p[1]=S=>b.value=S),type:"date"},null,8,["modelValue"])]),e.createElementVNode("div",yt,[e.createVNode(O,{for:"transfer-reservation-hour"},{default:e.withCtx(()=>[...p[8]||(p[8]=[e.createTextVNode("Hour",-1)])]),_:1}),e.createVNode(de,{modelValue:f.value,"onUpdate:modelValue":p[2]||(p[2]=S=>f.value=S)},{default:e.withCtx(()=>[e.createVNode(ae,{id:"transfer-reservation-hour",class:"w-full"},{default:e.withCtx(()=>[e.createVNode(K,{placeholder:"Select an hour"})]),_:1}),e.createVNode(ie,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,S=>(e.openBlock(),e.createBlock(ee,{key:S,value:S},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(S),1)]),_:2},1032,["value"]))),128))]),_:1})]),_:1},8,["modelValue"]),N.value&&b.value&&u.value.length===0?(e.openBlock(),e.createElementBlock("p",xt," No times are available for this resource on the selected date. ")):e.createCommentVNode("",!0)])]),e.createElementVNode("div",Nt,[p[9]||(p[9]=e.createElementVNode("p",{class:"text-xs font-medium uppercase tracking-[0.2em] text-muted-foreground"}," Preview ",-1)),e.createElementVNode("p",kt,[e.createTextVNode(" Reservation will be moved to "+e.toDisplayString(b.value||"no date selected")+" at "+e.toDisplayString(f.value||"no hour selected"),1),P.value?(e.openBlock(),e.createElementBlock("span",Vt," - "+e.toDisplayString(P.value),1)):e.createCommentVNode("",!0),e.createTextVNode(" in "+e.toDisplayString(w.value)+". ",1)])]),V.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["mt-4 rounded-lg border p-4 text-sm",{"bg-muted/30 text-muted-foreground":r.value,"border-red-200 bg-red-50 text-red-700 dark:border-red-900/50 dark:bg-red-950/30 dark:text-red-300":!r.value&&(y.value||!q.value),"border-green-200 bg-green-50 text-green-700 dark:border-green-900/50 dark:bg-green-950/10 dark:text-green-300":!r.value&&!y.value&&q.value}])},e.toDisplayString(se.value),3)):e.createCommentVNode("",!0),t.value?(e.openBlock(),e.createElementBlock("p",wt,e.toDisplayString(t.value),1)):e.createCommentVNode("",!0)]),e.createVNode(A,null,{default:e.withCtx(()=>[e.createVNode(n,{variant:"outline",disabled:i.value,onClick:p[3]||(p[3]=S=>_.value=!1)},{default:e.withCtx(()=>[...p[11]||(p[11]=[e.createTextVNode("Close",-1)])]),_:1},8,["disabled"]),e.createVNode(n,{disabled:!le.value,onClick:he},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.value?"Transferring...":"Transfer reservation"),1)]),_:1},8,["disabled"])]),_:1})]),_:1})]),_:1},8,["open"])}}}),Ct={class:"flex items-center bg-muted/70 dark:bg-muted/20 px-4 rounded-md"},_t={class:"grid gap-2"},Dt={class:"grid gap-2"},$t={class:"grid gap-2"},Et=e.defineComponent({__name:"ApproveReservationDialog",emits:["confirm"],setup(o,{expose:v,emit:R}){const{config:g}=W.useModule(),{sendMail:E}=W.useMailer(g.mailAccount),B=R,s=e.ref(!1),x=e.ref("approve"),_=e.ref(!1),m=e.ref(""),b=e.ref(""),f=e.ref(""),N=(r,t)=>{_.value=!g.mailAccount,s.value=!0,r&&(t||(t="approve"),x.value=t,m.value=r.customerInfo?.email,b.value="Confirmation: Your reservation for "+new Date(r.date)?.toDateString(),f.value=`Dear ${r.customerInfo?.firstName??""} ${r.customerInfo?.lastName??""},
918
+
919
+ This email confirms your reservation for ${new Date(r.date)?.toDateString()} at ${r.startTime}.
920
+
921
+ 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.`)},i=()=>{if(!_.value){if(!m.value||!b.value||!f.value)return alert("Please fill in all the fields.");E({to:m.value,subject:b.value,body:f.value})}s.value=!1;const{$confetti:r}=useNuxtApp();r(),B("confirm")};return v({openDialog:N}),(r,t)=>{const y=e.resolveComponent("DialogTitle"),$=e.resolveComponent("DialogDescription"),a=e.resolveComponent("DialogHeader"),k=e.resolveComponent("Checkbox"),j=e.resolveComponent("Label"),L=e.resolveComponent("Input"),Y=e.resolveComponent("Textarea"),H=e.resolveComponent("Button"),C=e.resolveComponent("DialogFooter"),w=e.resolveComponent("DialogScrollContent"),D=e.resolveComponent("Dialog");return e.openBlock(),e.createBlock(D,{open:s.value,"onUpdate:open":t[5]||(t[5]=F=>s.value=F)},{default:e.withCtx(()=>[e.createVNode(w,{class:"sm:max-w-3xl"},{default:e.withCtx(()=>[e.createVNode(a,null,{default:e.withCtx(()=>[e.createVNode(y,null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(x.value==="approve"?"Approve Reservation":"Resend Confirmation Email"),1)]),_:1}),e.createVNode($)]),_:1}),e.createElementVNode("div",Ct,[e.createVNode(k,{modelValue:_.value,"onUpdate:modelValue":t[0]||(t[0]=F=>_.value=F),id:"reject-dialog-skip-mail",class:"border-black/80 dark:border-gray-200",disabled:!e.unref(g).mailAccount},null,8,["modelValue","disabled"]),e.createVNode(j,{for:"reject-dialog-skip-mail",class:"py-4 pl-2 pr-4"},{default:e.withCtx(()=>[...t[6]||(t[6]=[e.createTextVNode("Do not send email to customer",-1)])]),_:1})]),e.createElementVNode("div",{class:e.normalizeClass(["grid gap-4 py-4",{"opacity-50":_.value}])},[e.createElementVNode("div",_t,[e.createVNode(j,{for:"approve-dialog-email"},{default:e.withCtx(()=>[...t[7]||(t[7]=[e.createTextVNode("To:",-1)])]),_:1}),e.createVNode(L,{modelValue:m.value,"onUpdate:modelValue":t[1]||(t[1]=F=>m.value=F),disabled:_.value,id:"approve-dialog-email"},null,8,["modelValue","disabled"])]),e.createElementVNode("div",Dt,[e.createVNode(j,{for:"approve-dialog-subject"},{default:e.withCtx(()=>[...t[8]||(t[8]=[e.createTextVNode("Subject:",-1)])]),_:1}),e.createVNode(L,{modelValue:b.value,"onUpdate:modelValue":t[2]||(t[2]=F=>b.value=F),disabled:_.value,id:"approve-dialog-subject"},null,8,["modelValue","disabled"])]),e.createElementVNode("div",$t,[e.createVNode(j,{for:"approve-dialog-body"},{default:e.withCtx(()=>[...t[9]||(t[9]=[e.createTextVNode("Body:",-1)])]),_:1}),e.createVNode(Y,{modelValue:f.value,"onUpdate:modelValue":t[3]||(t[3]=F=>f.value=F),disabled:_.value,id:"approve-dialog-body"},null,8,["modelValue","disabled"])])],2),e.createVNode(C,null,{default:e.withCtx(()=>[e.createVNode(H,{variant:"outline",onClick:t[4]||(t[4]=F=>s.value=!1)},{default:e.withCtx(()=>[...t[10]||(t[10]=[e.createTextVNode("Close",-1)])]),_:1}),e.createVNode(H,{onClick:i},{default:e.withCtx(()=>[...t[11]||(t[11]=[e.createTextVNode("Approve reservation",-1)])]),_:1})]),_:1})]),_:1})]),_:1},8,["open"])}}}),St={class:"flex items-center bg-muted/70 dark:bg-muted/20 px-4 rounded-md"},Bt={class:"grid gap-2"},Rt={class:"grid gap-2"},Tt={class:"grid gap-2"},At=e.defineComponent({__name:"RejectReservationDialog",emits:["confirm"],setup(o,{expose:v,emit:R}){const{config:g}=W.useModule(),{sendMail:E}=W.useMailer(g.mailAccount),B=R,s=e.ref(!1),x=e.ref(!1),_=e.ref(""),m=e.ref(""),b=e.ref(""),f=i=>{x.value=!g.mailAccount,s.value=!0,i&&(_.value=i.customerInfo?.email,m.value="Regarding your reservation request for "+new Date(i.date)?.toDateString(),b.value=`Dear ${i.customerInfo?.firstName??""} ${i.customerInfo?.lastName??""},
922
+
923
+ Thank you for your interest in booking with us. Unfortunately, we are unable to confirm your request for ${new Date(i.date)?.toDateString()} at ${i.startTime}.
924
+
925
+ We would love to see you another time!`)},N=()=>{if(!x.value){if(!_.value||!m.value||!b.value)return alert("Please fill in all the fields.");E({to:_.value,subject:m.value,body:b.value})}s.value=!1;const{$confetti:i}=useNuxtApp();i(),B("confirm")};return v({openDialog:f}),(i,r)=>{const t=e.resolveComponent("DialogTitle"),y=e.resolveComponent("DialogDescription"),$=e.resolveComponent("DialogHeader"),a=e.resolveComponent("Checkbox"),k=e.resolveComponent("Label"),j=e.resolveComponent("Input"),L=e.resolveComponent("Textarea"),Y=e.resolveComponent("Button"),H=e.resolveComponent("DialogFooter"),C=e.resolveComponent("DialogScrollContent"),w=e.resolveComponent("Dialog");return e.openBlock(),e.createBlock(w,{open:s.value,"onUpdate:open":r[5]||(r[5]=D=>s.value=D)},{default:e.withCtx(()=>[e.createVNode(C,{class:"sm:max-w-3xl"},{default:e.withCtx(()=>[e.createVNode($,null,{default:e.withCtx(()=>[e.createVNode(t,null,{default:e.withCtx(()=>[...r[6]||(r[6]=[e.createTextVNode(" Reject Reservation Request ",-1)])]),_:1}),e.createVNode(y)]),_:1}),e.createElementVNode("div",St,[e.createVNode(a,{modelValue:x.value,"onUpdate:modelValue":r[0]||(r[0]=D=>x.value=D),id:"reject-dialog-skip-mail",class:"border-black/80 dark:border-gray-200",disabled:!e.unref(g).mailAccount},null,8,["modelValue","disabled"]),e.createVNode(k,{for:"reject-dialog-skip-mail",class:"py-4 pl-2 pr-4"},{default:e.withCtx(()=>[...r[7]||(r[7]=[e.createTextVNode("Do not send email to customer",-1)])]),_:1})]),e.createElementVNode("div",{class:e.normalizeClass(["grid gap-4 py-4",{"opacity-50":x.value}])},[e.createElementVNode("div",Bt,[e.createVNode(k,{for:"reject-dialog-email"},{default:e.withCtx(()=>[...r[8]||(r[8]=[e.createTextVNode("To:",-1)])]),_:1}),e.createVNode(j,{modelValue:_.value,"onUpdate:modelValue":r[1]||(r[1]=D=>_.value=D),disabled:x.value,id:"reject-dialog-email"},null,8,["modelValue","disabled"])]),e.createElementVNode("div",Rt,[e.createVNode(k,{for:"reject-dialog-subject"},{default:e.withCtx(()=>[...r[9]||(r[9]=[e.createTextVNode("Subject:",-1)])]),_:1}),e.createVNode(j,{modelValue:m.value,"onUpdate:modelValue":r[2]||(r[2]=D=>m.value=D),disabled:x.value,id:"reject-dialog-subject"},null,8,["modelValue","disabled"])]),e.createElementVNode("div",Tt,[e.createVNode(k,{for:"reject-dialog-body"},{default:e.withCtx(()=>[...r[10]||(r[10]=[e.createTextVNode("Body:",-1)])]),_:1}),e.createVNode(L,{modelValue:b.value,"onUpdate:modelValue":r[3]||(r[3]=D=>b.value=D),disabled:x.value,id:"reject-dialog-body"},null,8,["modelValue","disabled"])])],2),e.createVNode(H,null,{default:e.withCtx(()=>[e.createVNode(Y,{variant:"outline",onClick:r[4]||(r[4]=D=>s.value=!1)},{default:e.withCtx(()=>[...r[11]||(r[11]=[e.createTextVNode("Close",-1)])]),_:1}),e.createVNode(Y,{variant:"destructive",onClick:N},{default:e.withCtx(()=>[...r[12]||(r[12]=[e.createTextVNode("Reject reservation",-1)])]),_:1})]),_:1})]),_:1})]),_:1},8,["open"])}}}),Mt={class:"flex items-start justify-between gap-3"},jt={class:"min-w-0"},It={class:"text-xs text-muted-foreground"},Ft={key:0,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"},zt={class:"grid grid-cols-[110px_1fr] gap-3"},Pt={class:"min-w-0 whitespace-pre-wrap break-words text-right"},Ot={class:"text-muted-foreground"},Ut={class:"min-w-0 break-words text-right"},Lt={key:0,class:"grid grid-cols-[110px_1fr] gap-3"},Ht={class:"min-w-0 break-words text-right"},ze=e.defineComponent({__name:"RefundDetailsDisplay",props:{refunds:{},compact:{type:Boolean,default:!1}},setup(o){const v=o,R=e.computed(()=>(Array.isArray(v.refunds)?v.refunds:[]).filter(Boolean).slice().reverse()),g=m=>{const b=Number(m);return Number.isNaN(b)?"-":`€${b.toFixed(2)}`},E=m=>{if(!m)return"-";const b=new Date(m);return Number.isNaN(b.getTime())?m:b.toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})},B=m=>m===!0?"Yes":m===!1?"No":m==null||m===""?"-":typeof m=="object"?JSON.stringify(m):String(m),s=m=>{const b=m?.fields||{},f=Array.isArray(m?.fieldDefinitions)?m.fieldDefinitions:[],N=new Set,i=f.filter(t=>t?.key&&Object.prototype.hasOwnProperty.call(b,t.key)).map(t=>(N.add(t.key),{key:t.key,label:t.label||t.key,value:b[t.key]})),r=Object.entries(b).filter(([t])=>!N.has(t)).map(([t,y])=>({key:t,label:t,value:y}));return[...i,...r]},x=m=>m?.processedAt||m?.requestedAt,_=m=>m?.reason||m?.note||"-";return(m,b)=>R.value.length?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(o.compact?"space-y-2":"space-y-3")},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(R.value,(f,N)=>(e.openBlock(),e.createElementBlock("div",{key:f.processedAt||f.requestedAt||N,class:e.normalizeClass(["rounded-lg border bg-background/70",o.compact?"p-3 space-y-2":"p-4 space-y-3"])},[e.createElementVNode("div",Mt,[e.createElementVNode("div",jt,[e.createElementVNode("p",{class:e.normalizeClass(o.compact?"text-xs font-medium":"text-sm font-medium")},e.toDisplayString(f.hasAmount===!1?"Refund flow processed":"Refund processed"),3),e.createElementVNode("p",It,e.toDisplayString(E(x(f))),1)]),f.hasAmount!==!1?(e.openBlock(),e.createElementBlock("div",Ft,e.toDisplayString(g(f.amount)),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:e.normalizeClass(o.compact?"grid gap-1.5 text-xs":"grid gap-2 text-sm")},[e.createElementVNode("div",zt,[b[0]||(b[0]=e.createElementVNode("span",{class:"text-muted-foreground"},"Reason",-1)),e.createElementVNode("span",Pt,e.toDisplayString(_(f)),1)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s(f),i=>(e.openBlock(),e.createElementBlock("div",{key:i.key,class:"grid grid-cols-[110px_1fr] gap-3"},[e.createElementVNode("span",Ot,e.toDisplayString(i.label),1),e.createElementVNode("span",Ut,e.toDisplayString(B(i.value)),1)]))),128)),f.notification?(e.openBlock(),e.createElementBlock("div",Lt,[b[1]||(b[1]=e.createElementVNode("span",{class:"text-muted-foreground"},"Email",-1)),e.createElementVNode("span",Ht,e.toDisplayString(f.notification.skipped?"Skipped":f.notification.to||"Sent"),1)])):e.createCommentVNode("",!0)],2)],2))),128))],2)):e.createCommentVNode("",!0)}}),qt={key:0},Wt={key:0,class:"flex items-center gap-1.5 flex-wrap"},Gt={key:0,class:"space-y-2 mb-4"},Jt={class:"text-xs font-medium text-muted-foreground uppercase tracking-wide"},Yt={key:1,class:"flex flex-wrap gap-2 mb-4"},Kt={key:1,class:"text-xs text-muted-foreground mr-0.5"},Xt={key:2,class:"space-y-3"},Zt={class:"bg-muted/30 rounded-lg p-4 space-y-2"},Qt={class:"text-muted-foreground flex items-center gap-1.5"},De="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",$e=e.defineComponent({__name:"OrderMetadataDisplay",props:{metadata:{default:()=>({})},schema:{default:()=>[]},displayFilter:{default:void 0},scope:{default:void 0},compact:{type:Boolean,default:!1},enableActions:{type:Boolean,default:!1},actionsDisabled:{type:Boolean,default:!1}},emits:["run-action"],setup(o,{expose:v,emit:R}){const g=T.icons,E=o,B=R,s=y=>y&&g[y]||null,x=e.computed(()=>{if(!E.metadata)return[];const y=new Set(E.schema?.map(k=>k.key)||[]),$=(E.schema||[]).filter(k=>!(E.scope&&k.scope!==E.scope||E.displayFilter&&!E.displayFilter.includes(k.display)||E.metadata[k.key]===void 0||E.metadata[k.key]===null||k.display==="hidden"||E.metadata[k.key]===!1)).sort((k,j)=>(k.order||0)-(j.order||0)).map(k=>({...k,value:E.metadata[k.key]}));if(E.displayFilter&&!E.displayFilter.includes("field"))return $;const a=Object.entries(E.metadata).filter(([k,j])=>!y.has(k)&&j!==void 0&&j!==null&&j!==!1).map(([k,j])=>({id:`_fallback_${k}`,key:k,label:k.replace(/([A-Z])/g," $1").replace(/[_-]/g," ").replace(/^\w/,L=>L.toUpperCase()).trim(),display:"field",scope:"order",value:typeof j=="object"?JSON.stringify(j):String(j)}));return[...$,...a]}),_=e.computed(()=>x.value.filter(y=>y.display==="highlight")),m=e.computed(()=>x.value.filter(y=>y.display==="badge")),b=e.computed(()=>x.value.filter(y=>y.display==="field")),f=e.computed(()=>x.value.length>0),N=y=>Object.keys(y.action?.flow||{}).length>0,i=y=>E.enableActions&&N(y),r=y=>{!i(y)||E.actionsDisabled||B("run-action",{field:y,value:y.value})},t=(y,$)=>{i(y)&&($.stopPropagation(),r(y))};return v({hasContent:f}),(y,$)=>f.value?(e.openBlock(),e.createElementBlock("div",qt,[o.compact?(e.openBlock(),e.createElementBlock("div",Wt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value,a=>(e.openBlock(),e.createElementBlock("span",{key:a.id,class:e.normalizeClass(["inline-flex items-center gap-1 px-2 py-0.5 text-xs font-bold rounded-md appearance-none border-0",a.color?"":"bg-primary/10 text-primary"]),style:e.normalizeStyle(a.color?{backgroundColor:a.color+"20",color:a.color}:{})},[s(a.icon)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s(a.icon)),{key:0,size:12})):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i(a)?"button":"span"),{type:i(a)?"button":void 0,disabled:i(a)?o.actionsDisabled:void 0,class:e.normalizeClass(i(a)?De:""),"aria-label":i(a)?`Run ${a.label} action`:void 0,onClick:k=>t(a,k)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value===!0?a.label:a.value),1)]),_:2},1032,["type","disabled","class","aria-label","onClick"]))],6))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,a=>(e.openBlock(),e.createElementBlock("span",{key:a.id,class:e.normalizeClass(["inline-flex items-center gap-1 px-2 py-0.5 text-xs font-medium rounded-full appearance-none border-0",a.color?"":"bg-muted text-muted-foreground"]),style:e.normalizeStyle(a.color?{backgroundColor:a.color+"20",color:a.color}:{})},[s(a.icon)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s(a.icon)),{key:0,size:10})):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i(a)?"button":"span"),{type:i(a)?"button":void 0,disabled:i(a)?o.actionsDisabled:void 0,class:e.normalizeClass(i(a)?De:""),"aria-label":i(a)?`Run ${a.label} action`:void 0,onClick:k=>t(a,k)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value===!0?a.label:a.value),1)]),_:2},1032,["type","disabled","class","aria-label","onClick"]))],6))),128))])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[_.value.length?(e.openBlock(),e.createElementBlock("div",Gt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.value,a=>(e.openBlock(),e.createElementBlock("div",{key:a.id,class:e.normalizeClass(["rounded-lg border-2 p-4 flex items-center gap-4 appearance-none",a.color?"":"border-primary/20 bg-primary/5"]),style:e.normalizeStyle(a.color?{borderColor:a.color+"40",backgroundColor:a.color+"08"}:{})},[e.createElementVNode("div",{class:e.normalizeClass(["h-12 w-12 rounded-xl flex items-center justify-center shrink-0",a.color?"":"bg-primary/10"]),style:e.normalizeStyle(a.color?{backgroundColor:a.color+"20"}:{})},[s(a.icon)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s(a.icon)),{key:0,size:24,style:e.normalizeStyle(a.color?{color:a.color}:{}),class:e.normalizeClass(a.color?"":"text-primary")},null,8,["style","class"])):e.createCommentVNode("",!0)],6),e.createElementVNode("div",null,[e.createElementVNode("p",Jt,e.toDisplayString(a.label),1),a.value!==!0||i(a)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i(a)?"button":"p"),{key:0,type:i(a)?"button":void 0,disabled:i(a)?o.actionsDisabled:void 0,class:e.normalizeClass(["text-2xl font-bold tracking-wider",i(a)?De:""]),"aria-label":i(a)?`Run ${a.label} action`:void 0,onClick:k=>t(a,k)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value===!0?"✓":a.value),1)]),_:2},1032,["type","disabled","class","aria-label","onClick"])):e.createCommentVNode("",!0)])],6))),128))])):e.createCommentVNode("",!0),m.value.length?(e.openBlock(),e.createElementBlock("div",Yt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,a=>(e.openBlock(),e.createElementBlock("span",{key:a.id,class:e.normalizeClass(["inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-full appearance-none border-0",a.color?"":"bg-muted text-muted-foreground"]),style:e.normalizeStyle(a.color?{backgroundColor:a.color+"20",color:a.color}:{})},[s(a.icon)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s(a.icon)),{key:0,size:14})):e.createCommentVNode("",!0),a.label&&a.value!==!0?(e.openBlock(),e.createElementBlock("span",Kt,e.toDisplayString(a.label)+":",1)):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i(a)?"button":"span"),{type:i(a)?"button":void 0,disabled:i(a)?o.actionsDisabled:void 0,class:e.normalizeClass(i(a)?De:""),"aria-label":i(a)?`Run ${a.label} action`:void 0,onClick:k=>t(a,k)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value===!0?a.label:a.value),1)]),_:2},1032,["type","disabled","class","aria-label","onClick"]))],6))),128))])):e.createCommentVNode("",!0),b.value.length?(e.openBlock(),e.createElementBlock("div",Xt,[$[0]||($[0]=e.createElementVNode("h3",{class:"text-sm font-semibold text-muted-foreground uppercase tracking-wide"},"Additional Info",-1)),e.createElementVNode("div",Zt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(b.value,a=>(e.openBlock(),e.createElementBlock("div",{key:a.id,class:"flex justify-between gap-4 text-sm appearance-none"},[e.createElementVNode("span",Qt,[s(a.icon)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s(a.icon)),{key:0,size:14})):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(a.label),1)]),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i(a)?"button":"span"),{type:i(a)?"button":void 0,disabled:i(a)?o.actionsDisabled:void 0,class:e.normalizeClass(["font-medium text-right break-words",i(a)?De:""]),"aria-label":i(a)?`Run ${a.label} action`:void 0,onClick:k=>t(a,k)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value===!0?"✓":a.value),1)]),_:2},1032,["type","disabled","class","aria-label","onClick"]))]))),128))])])):e.createCommentVNode("",!0)],64))])):e.createCommentVNode("",!0)}}),eo={key:0,class:"space-y-6 py-4"},to={class:"space-y-3"},oo={class:"bg-muted/30 rounded-lg p-4 space-y-3"},ao={class:"flex items-center gap-3"},no={class:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center"},ro={class:"font-medium"},so={class:"grid gap-2 text-sm"},lo={key:0,class:"flex items-center gap-2 text-muted-foreground"},io=["href"],co={key:1,class:"flex items-center gap-2 text-muted-foreground"},uo=["href"],mo={class:"space-y-3"},po={class:"grid grid-cols-2 gap-3"},vo={class:"bg-muted/30 rounded-lg p-3"},fo={class:"flex items-center gap-2 text-muted-foreground mb-1"},go={class:"text-xs"},bo={class:"font-medium"},yo={class:"bg-muted/30 rounded-lg p-3"},xo={class:"flex items-center gap-2 text-muted-foreground mb-1"},No={class:"font-medium"},ko={key:0,class:"bg-muted/30 rounded-lg p-3 col-span-2"},Vo={class:"flex items-center gap-2 text-muted-foreground mb-1"},wo={class:"font-medium truncate"},ho={key:0,class:"space-y-3"},Co={class:"bg-muted/30 rounded-lg p-4"},_o={class:"flex items-start justify-between"},Do={class:"flex items-start gap-3"},$o={class:"h-9 w-9 rounded-lg bg-primary/10 flex items-center justify-center mt-0.5"},Eo={class:"font-medium"},So={class:"text-sm text-muted-foreground"},Bo={class:"font-semibold"},Ro={class:"space-y-3"},To={class:"bg-muted/30 rounded-lg p-4 space-y-3"},Ao={class:"space-y-2 text-sm"},Mo={class:"flex justify-between"},jo={key:0,class:"flex justify-between"},Io={key:1,class:"grid"},Fo={class:"text-muted-foreground"},zo={key:0},Po={key:1},Oo={class:"flex justify-between font-semibold"},Uo={class:"flex justify-between font-semibold"},Lo={class:"flex items-center gap-2"},Ho={key:1,class:"space-y-2 text-sm"},qo={key:0,class:"flex justify-between"},Wo={class:"text-muted-foreground flex items-center gap-1.5"},Go={class:"text-green-600 dark:text-green-400"},Jo={key:1,class:"flex justify-between"},Yo={class:"text-muted-foreground flex items-center gap-1.5"},Ko={class:"text-orange-600 dark:text-orange-400 font-medium"},Xo={key:1,class:"space-y-3"},Zo=e.defineComponent({__name:"ReservationDetailDialog",props:{agendaData:{},showOrderLink:{type:Boolean,default:!1},resources:{default:()=>[]}},emits:["cancelled","confirmed","rejected","transferred","openOrder","closed"],setup(o,{expose:v,emit:R}){const g=o,{hasPermission:E}=W.useModulePermissions(),{params:B}=W.useModuleRoute(),{config:s}=W.useModule(),x=W.useFirebaseIntegration(s.project),_=W.useModuleApi(),{runFlow:m}=W.useFlowBuilder(),{sendMail:b}=W.useMailer(s.mailAccount),f=e.inject("event",e.ref(null)),N=e.computed(()=>{const l=Array.isArray(g.resources)?g.resources:[],n=Array.isArray(g.agendaData?.resources)?g.agendaData.resources:[],A=[...l,...n],U=new Set;return A.filter(Z=>{const S=Z?.id;return!S||U.has(String(S))?!1:(U.add(String(S)),!0)})}),i=R,r=e.ref(!1),t=e.ref(null),y=e.ref(!1),$=e.ref(!1),a=e.ref({}),k=e.ref(null),j=e.ref(!1),L=e.computed(()=>B.value?.id??B.id??""),{metadataSchema:Y}=Me(L),H=e.computed(()=>t.value?.id||t.value?.orderId||""),C=e.computed(()=>Object.keys(a.value||{}).length>0),w=e.computed(()=>(k.value?.refundFlowEnabled??g.agendaData?.refundFlowEnabled)!==!1),D=e.computed(()=>C.value&&w.value),F=e.computed(()=>{const l=k.value?.refundDialog??g.agendaData?.refundDialog;return{showAmount:l?.showAmount!==!1,fields:Array.isArray(l?.fields)?l.fields:[]}}),ne=e.useTemplateRef("cancelReservationDialog"),G=e.useTemplateRef("cancelRefundReservationDialog"),z=e.useTemplateRef("approveReservationDialog"),re=e.useTemplateRef("rejectReservationDialog"),ce=e.useTemplateRef("transferReservationDialog"),ue=l=>{const n=l?.id||l?.orderId;!l||!n||(t.value={...l,id:n},r.value=!0)},c=()=>{r.value&&(r.value=!1,i("closed"))},u=l=>{if(l){r.value=!0;return}c()},P=async()=>{if(L.value){k.value=null,a.value={},j.value=!0;try{const l=await _.get(`/agendas/${L.value}/refund-flow`);k.value=l||null,a.value=l?.refundFlow||g.agendaData?.refundFlow||{}}catch(l){console.error("Error loading refund flow:",l),a.value=g.agendaData?.refundFlow||{}}finally{j.value=!1}}};e.watch(L,P,{immediate:!0});const V=e.computed(()=>t.value?.customerInfo&&`${t.value.customerInfo.firstName} ${t.value.customerInfo.lastName}`.trim()||"Unknown Customer"),q=l=>{if(typeof l!="string")return!1;const n=l.trim().toLowerCase();return n.length>0&&n!=="unknown"&&n!=="unknown resource"},se=l=>l&&N.value.find(n=>String(n.id)===String(l))||null,le=e.computed(()=>{const l=t.value?.resourceId||t.value?.resource?.id||f.value?.resourceId||f.value?.resource?.id,n=se(l),A=f.value?.resourceId||f.value?.resource?.id,U=!l||String(A)===String(l)?f.value?.resource:null,Z=t.value?.resource?.name,S=U?.name;return{name:n?.name||(q(Z)?Z:"")||(q(S)?S:"")||(q(t.value?.resourceName)?t.value.resourceName:""),color:n?.color||t.value?.resource?.color||U?.color||t.value?.resourceColor||"#6b7280"}}),me=e.computed(()=>{let l=t.value?.status;const n=t.value?.reservationStatus;switch(l==="confirmed"&&["needs_approval","rejected","approved","cancelled"].includes(n)&&(l=n),l){case"pending":return{label:"Pending",class:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400"};case"cancelled":return{label:"Cancelled",class:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"};case"needs_approval":return{label:"Needs Approval",class:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400"};case"rejected":return{label:"Rejected",class:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"};case"approved":return{label:"Approved",class:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400"};case"confirmed":return{label:"Confirmed",class:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400"};default:return{label:l||"Unknown",class:"bg-muted text-muted-foreground"}}}),pe=e.computed(()=>t.value?.status==="cancelled"||t.value?.reservationStatus==="cancelled"),oe=l=>l==null||typeof l!="number"?"—":`€${l?.toFixed(2)}`,ge=l=>{if(!l)return"—";if(l<60)return`${l} min`;const n=Math.floor(l/60),A=l%60;return A>0?`${n}h ${A}min`:`${n}h`},ve=()=>{if(!t.value)return;let l="";const n=f?.value?.date;if(n)try{l=new Date(n).toLocaleDateString("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric"})}catch{l=n}const A={date:l,resourceName:le.value.name,metadataSchema:Y.value};Je(t.value,A)},ke=()=>{z.value?.openDialog(t.value)},Ve=()=>{re.value?.openDialog(t.value)},we=()=>{z.value?.openDialog(t.value)},be=()=>{ne.value?.openDialog(t.value)},he=()=>{!C.value&&!j.value&&P(),G.value?.openDialog(t.value)},d=async()=>{try{if(y.value||!t.value?.id)throw new Error("Invalid state");y.value=!0;let n=(await x.get(s.reservationsCollection,t.value.id))?.reservations||[];if(!n.find(A=>A.id===t.value.res_id))throw new Error("Reservation not found");n.find(A=>A.id===t.value.res_id).status="cancelled",await x.update(s.reservationsCollection,t.value.id,{reservations:n}),t.value.status="cancelled",t.value.reservationStatus="cancelled",Q.toast.success("Reservation cancelled successfully"),i("cancelled"),r.value=!1}catch(l){console.error("Error cancelling reservation:",l),Q.toast.error("Failed to cancel reservation")}finally{y.value=!1}},p=l=>{try{return JSON.parse(JSON.stringify(l??null))}catch{return null}},M=l=>l===null||Array.isArray(l)?"object":typeof l,I=l=>l?.scope==="reservation"?t.value?.reservationMetadata||{}:t.value?.metadata||{},h=async({field:l,value:n})=>{const A=l?.action?.flow||{};if(!(!Object.keys(A).length||$.value)){$.value=!0;try{await m(A,[{id:"value",name:"value",type:M(n),value:n},{id:"field",name:"field",type:"object",value:{id:l.id,key:l.key,label:l.label,display:l.display,scope:l.scope}},{id:"metadata",name:"metadata",type:"object",value:I(l)},{id:"order",name:"order",type:"object",value:t.value||{}},{id:"reservation",name:"reservation",type:"object",value:t.value||{}},{id:"booking",name:"booking",type:"object",value:t.value||{}},{id:"agenda",name:"agenda",type:"object",value:g.agendaData||{}},{id:"customer",name:"customer",type:"object",value:t.value?.customerInfo||{}},{id:"orderId",name:"orderId",type:"string",value:H.value||""},{id:"reservationId",name:"reservationId",type:"string",value:t.value?.res_id||t.value?.reservationId||""}]),Q.toast.success("Metadata action completed")}catch(U){console.error("Error running metadata action:",U),Q.toast.error("Failed to run metadata action")}finally{$.value=!1}}},O=async l=>{try{if(y.value||!t.value?.id||!t.value?.res_id)throw new Error("Invalid state");if(!D.value)throw new Error("No active refund flow configured");y.value=!0;const n=t.value.id,A=t.value.res_id,U=await x.get(s.reservationsCollection,n),Z=U?.reservations||[],S=Z.find(_e=>_e.id===A);if(!S)throw new Error("Reservation not found");const Ce=new Date().toISOString(),Ee=F.value.showAmount,te={amount:Ee?Number(l.amount)||0:null,hasAmount:Ee,reason:l.reason,fields:l.fields||{},fieldDefinitions:l.fieldDefinitions||[],requestedAt:Ce,notification:{skipped:l.skipMail,to:l.email,subject:l.subject,body:l.body}},Be=await m(a.value,[{id:"agenda",name:"agenda",type:"object",value:g.agendaData||{}},{id:"order",name:"order",type:"object",value:{...U,id:n}},{id:"reservation",name:"reservation",type:"object",value:S},{id:"booking",name:"booking",type:"object",value:t.value},{id:"customer",name:"customer",type:"object",value:U?.customerInfo||t.value.customerInfo||{}},{id:"refund",name:"refund",type:"object",value:te},{id:"refundFields",name:"refundFields",type:"object",value:te.fields},{id:"refundHasAmount",name:"refundHasAmount",type:"boolean",value:te.hasAmount},{id:"orderId",name:"orderId",type:"string",value:n},{id:"reservationId",name:"reservationId",type:"string",value:A},{id:"refundAmount",name:"refundAmount",type:"number",value:te.amount||0}]),ye={...te,processedAt:new Date().toISOString(),flowResult:p(Be)};if(S.status="cancelled",S.refundStatus=te.hasAmount?"refunded":"processed",S.refundedAt=ye.processedAt,te.hasAmount&&(S.refundedAmount=(Number(S.refundedAmount)||0)+(te.amount||0)),S.refunds=[...Array.isArray(S.refunds)?S.refunds:[],ye],await x.update(s.reservationsCollection,n,{reservations:Z}),!l.skipMail)try{await b({to:l.email,subject:l.subject,body:l.body})}catch(_e){console.error("Error sending refund email:",_e),Q.toast.warning("Refund processed, but the email could not be sent")}t.value.status="cancelled",t.value.reservationStatus="cancelled",t.value.refundStatus=te.hasAmount?"refunded":"processed",t.value.refundedAt=ye.processedAt,t.value.refunds=[...Array.isArray(t.value.refunds)?t.value.refunds:[],ye],te.hasAmount&&(t.value.refundedAmount=(Number(t.value.refundedAmount)||0)+(te.amount||0)),Q.toast.success("Reservation cancelled and refund flow completed"),i("cancelled"),G.value?.closeDialog(),r.value=!1}catch(n){console.error("Error cancelling reservation with refund:",n),Q.toast.error(n instanceof Error&&n.message==="No active refund flow configured"?"No active refund flow configured":"Failed to cancel and refund reservation")}finally{y.value=!1}},K=async()=>{try{if(y.value||!t.value?.id)throw new Error("Invalid state");y.value=!0;let n=(await x.get(s.reservationsCollection,t.value.id))?.reservations||[];if(!n.find(A=>A.id===t.value.res_id))throw new Error("Reservation not found");n.find(A=>A.id===t.value.res_id).status="approved",await x.update(s.reservationsCollection,t.value.id,{reservations:n}),t.value.status="approved",Q.toast.success("Reservation approved successfully"),i("confirmed"),r.value=!1}catch(l){console.error("Error approving reservation:",l),Q.toast.error("Failed to approve reservation")}finally{y.value=!1}},ae=async()=>{try{if(y.value||!t.value?.id)throw new Error("Invalid state");y.value=!0;let n=(await x.get(s.reservationsCollection,t.value.id))?.reservations||[];if(!n.find(A=>A.id===t.value.res_id))throw new Error("Reservation not found");n.find(A=>A.id===t.value.res_id).status="rejected",await x.update(s.reservationsCollection,t.value.id,{reservations:n}),t.value.status="rejected",Q.toast.success("Reservation rejected successfully"),i("rejected"),r.value=!1}catch(l){console.error("Error rejecting reservation:",l),Q.toast.error("Failed to reject reservation")}finally{y.value=!1}},ee=()=>{ce.value?.openDialog(t.value)},ie=l=>{const n=l?.reservation;t.value&&n&&(t.value={...t.value,date:n.date,endTime:n.timeslot?.endTime,resourceColor:n.resource?.color,resourceId:n.resourceId,resourceName:n.resource?.name,startTime:n.timeslot?.startTime}),i("transferred"),r.value=!1},de=()=>{H.value&&(r.value=!1,i("openOrder",H.value))};return v({openDialog:ue}),(l,n)=>{const A=e.resolveComponent("ResponsiveModalTitle"),U=e.resolveComponent("ResponsiveModalDescription"),Z=e.resolveComponent("ResponsiveModalHeader"),S=e.resolveComponent("Separator"),Ce=e.resolveComponent("Button"),Ee=e.resolveComponent("DropdownMenuTrigger"),fe=e.resolveComponent("DropdownMenuItem"),te=e.resolveComponent("DropdownMenuGroup"),Be=e.resolveComponent("DropdownMenuSeparator"),ye=e.resolveComponent("DropdownMenuContent"),_e=e.resolveComponent("DropdownMenu"),Pe=e.resolveComponent("ResponsiveModalFooter"),Oe=e.resolveComponent("ResponsiveModalScrollContent"),Ue=e.resolveComponent("ResponsiveModal");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(Ue,{open:r.value,"onUpdate:open":u},{default:e.withCtx(()=>[e.createVNode(Oe,{class:"sm:max-w-xl"},{default:e.withCtx(()=>[e.createVNode(Z,null,{default:e.withCtx(()=>[e.createVNode(A,{class:"flex items-center gap-3"},{default:e.withCtx(()=>[n[0]||(n[0]=e.createElementVNode("span",null,"Reservation Details",-1)),e.createElementVNode("span",{class:e.normalizeClass(["px-2.5 py-1 text-xs font-medium rounded-full",me.value.class])},e.toDisplayString(me.value.label),3)]),_:1}),e.createVNode(U,null,{default:e.withCtx(()=>[e.createTextVNode(" Booking #"+e.toDisplayString(H.value.slice(0,8)||"—"),1)]),_:1})]),_:1}),t.value?(e.openBlock(),e.createElementBlock("div",eo,[e.createVNode($e,{metadata:t.value.metadata,schema:e.unref(Y),scope:"order","enable-actions":"","actions-disabled":$.value,onRunAction:h},null,8,["metadata","schema","actions-disabled"]),e.createVNode($e,{metadata:t.value.reservationMetadata,schema:e.unref(Y),scope:"reservation","enable-actions":"","actions-disabled":$.value,onRunAction:h},null,8,["metadata","schema","actions-disabled"]),e.createElementVNode("div",to,[n[1]||(n[1]=e.createElementVNode("h3",{class:"text-sm font-semibold text-muted-foreground uppercase tracking-wide"},"Customer",-1)),e.createElementVNode("div",oo,[e.createElementVNode("div",ao,[e.createElementVNode("div",no,[e.createVNode(e.unref(T.User),{size:20,class:"text-primary"})]),e.createElementVNode("div",null,[e.createElementVNode("p",ro,e.toDisplayString(V.value),1)])]),e.createElementVNode("div",so,[t.value.customerInfo?.email?(e.openBlock(),e.createElementBlock("div",lo,[e.createVNode(e.unref(T.Mail),{size:14}),e.createElementVNode("a",{href:`mailto:${t.value.customerInfo.email}`,class:"hover:text-foreground transition-colors"},e.toDisplayString(t.value.customerInfo.email),9,io)])):e.createCommentVNode("",!0),t.value.customerInfo?.phone?(e.openBlock(),e.createElementBlock("div",co,[e.createVNode(e.unref(T.Phone),{size:14}),e.createElementVNode("a",{href:`tel:${t.value.customerInfo.phone}`,class:"hover:text-foreground transition-colors"},e.toDisplayString(t.value.customerInfo.phone),9,uo)])):e.createCommentVNode("",!0)])])]),e.createElementVNode("div",mo,[n[4]||(n[4]=e.createElementVNode("h3",{class:"text-sm font-semibold text-muted-foreground uppercase tracking-wide"},"Reservation",-1)),e.createElementVNode("div",po,[e.createElementVNode("div",vo,[e.createElementVNode("div",fo,[e.createVNode(e.unref(T.Clock),{size:14}),e.createElementVNode("span",go,e.toDisplayString(t.value.startTime)+" - "+e.toDisplayString(t.value.endTime),1)]),e.createElementVNode("p",bo,e.toDisplayString(new Date(t.value.date).toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"})),1)]),e.createElementVNode("div",yo,[e.createElementVNode("div",xo,[e.createVNode(e.unref(T.Users),{size:14}),n[2]||(n[2]=e.createElementVNode("span",{class:"text-xs"},"Spots",-1))]),e.createElementVNode("p",No,e.toDisplayString(t.value.spots||1)+" "+e.toDisplayString(t.value.spots===1?"person":"people"),1)]),le.value.name?(e.openBlock(),e.createElementBlock("div",ko,[e.createElementVNode("div",Vo,[e.createElementVNode("span",{class:"w-3 h-3 rounded-full shrink-0",style:e.normalizeStyle({backgroundColor:le.value.color})},null,4),n[3]||(n[3]=e.createElementVNode("span",{class:"text-xs"},"Resource",-1))]),e.createElementVNode("p",wo,e.toDisplayString(le.value.name),1)])):e.createCommentVNode("",!0)])]),t.value.pricingOption?(e.openBlock(),e.createElementBlock("div",ho,[n[5]||(n[5]=e.createElementVNode("h3",{class:"text-sm font-semibold text-muted-foreground uppercase tracking-wide"},"Package",-1)),e.createElementVNode("div",Co,[e.createElementVNode("div",_o,[e.createElementVNode("div",Do,[e.createElementVNode("div",$o,[e.createVNode(e.unref(T.Tag),{size:18,class:"text-primary"})]),e.createElementVNode("div",null,[e.createElementVNode("p",Eo,e.toDisplayString(t.value.pricingOption.name),1),e.createElementVNode("p",So,e.toDisplayString(ge(t.value.pricingOption.duration)),1)])]),e.createElementVNode("p",Bo,e.toDisplayString(oe(t.value.pricingOption.price)),1)])])])):e.createCommentVNode("",!0),e.createElementVNode("div",Ro,[n[12]||(n[12]=e.createElementVNode("h3",{class:"text-sm font-semibold text-muted-foreground uppercase tracking-wide"},"Payment",-1)),e.createElementVNode("div",To,[e.createElementVNode("div",Ao,[e.createElementVNode("div",Mo,[n[6]||(n[6]=e.createElementVNode("span",{class:"text-muted-foreground"},"Base price",-1)),e.createElementVNode("span",null,e.toDisplayString(oe(t.value.reservationBasePrice)),1)]),t.value.reservationAddOnsPrice?(e.openBlock(),e.createElementBlock("div",jo,[n[7]||(n[7]=e.createElementVNode("span",{class:"text-muted-foreground"},"Add-ons",-1)),e.createElementVNode("span",null,e.toDisplayString(oe(t.value.reservationAddOnsPrice)),1)])):e.createCommentVNode("",!0),t.value.reservationAdjustments&&t.value.reservationAdjustments.length?(e.openBlock(),e.createElementBlock("div",Io,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.value.reservationAdjustments,xe=>(e.openBlock(),e.createElementBlock("div",{key:xe,class:"flex justify-between"},[e.createElementVNode("span",Fo,e.toDisplayString(xe.label),1),xe.type=="percent"?(e.openBlock(),e.createElementBlock("span",zo,e.toDisplayString(xe.value)+"% ",1)):(e.openBlock(),e.createElementBlock("span",Po,e.toDisplayString(xe.value<0?"-":"+")+e.toDisplayString(oe(Math.abs(xe.value))),1))]))),128))])):e.createCommentVNode("",!0)]),e.createVNode(S),e.createElementVNode("div",Oo,[n[8]||(n[8]=e.createElementVNode("span",null,"Reservation Total",-1)),e.createElementVNode("span",null,e.toDisplayString(oe(t.value.reservationPrice)),1)]),e.createVNode(S),e.createElementVNode("div",Uo,[e.createElementVNode("div",Lo,[n[9]||(n[9]=e.createElementVNode("span",null,"Order Total",-1)),o.showOrderLink?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"text-[10px] uppercase bg-muted hover:bg-muted/50 px-2 py-1 rounded cursor-pointer",onClick:de}," view order ")):e.createCommentVNode("",!0)]),e.createElementVNode("span",null,e.toDisplayString(oe(t.value.total)),1)]),t.value.amountPaid!==void 0||t.value.amountDue!==void 0?(e.openBlock(),e.createBlock(S,{key:0})):e.createCommentVNode("",!0),t.value.amountPaid!==void 0||t.value.amountDue!==void 0?(e.openBlock(),e.createElementBlock("div",Ho,[t.value.amountPaid!==void 0?(e.openBlock(),e.createElementBlock("div",qo,[e.createElementVNode("span",Wo,[e.createVNode(e.unref(T.CreditCard),{size:14}),n[10]||(n[10]=e.createTextVNode(" Amount paid ",-1))]),e.createElementVNode("span",Go,e.toDisplayString(oe(t.value.amountPaid)),1)])):e.createCommentVNode("",!0),t.value.amountDue!==void 0&&t.value.amountDue>0?(e.openBlock(),e.createElementBlock("div",Jo,[e.createElementVNode("span",Yo,[e.createVNode(e.unref(T.Receipt),{size:14}),n[11]||(n[11]=e.createTextVNode(" Amount due ",-1))]),e.createElementVNode("span",Ko,e.toDisplayString(oe(t.value.amountDue)),1)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)])]),t.value.refunds?.length?(e.openBlock(),e.createElementBlock("div",Xo,[n[13]||(n[13]=e.createElementVNode("h3",{class:"text-sm font-semibold text-muted-foreground uppercase tracking-wide"},"Refunds",-1)),e.createVNode(ze,{refunds:t.value.refunds},null,8,["refunds"])])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createVNode(Pe,{class:"gap-2 sm:justify-between"},{default:e.withCtx(()=>[t.value?.status==="confirmed"&&t.value?.reservationStatus==="needs_approval"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(Ce,{variant:"destructive",onClick:Ve},{default:e.withCtx(()=>[e.createVNode(e.unref(T.Ban),{size:16}),n[14]||(n[14]=e.createTextVNode(" Reject Reservation ",-1))]),_:1}),e.createVNode(Ce,{onClick:ke},{default:e.withCtx(()=>[e.createVNode(e.unref(T.ClockCheck),{size:16}),n[15]||(n[15]=e.createTextVNode(" Approve Reservation ",-1))]),_:1})],64)):t.value?.status==="confirmed"&&t.value?.reservationStatus==="approved"?(e.openBlock(),e.createBlock(_e,{key:1},{default:e.withCtx(()=>[e.createVNode(Ee,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(Ce,{variant:"outline",class:"gap-2"},{default:e.withCtx(()=>[e.createVNode(e.unref(T.MoreHorizontal),{size:16}),n[16]||(n[16]=e.createTextVNode(" Actions ",-1))]),_:1})]),_:1}),e.createVNode(ye,{class:"w-60",align:"start"},{default:e.withCtx(()=>[e.createVNode(te,null,{default:e.withCtx(()=>[e.createVNode(fe,{onClick:de,class:"gap-2 cursor-pointer"},{default:e.withCtx(()=>[e.createVNode(e.unref(T.ExternalLink),{size:16,class:"text-muted-foreground"}),n[17]||(n[17]=e.createElementVNode("span",null,"View whole order",-1))]),_:1}),e.createVNode(fe,{onClick:ve,class:"gap-2 cursor-pointer"},{default:e.withCtx(()=>[e.createVNode(e.unref(T.Download),{size:16,class:"text-muted-foreground"}),n[18]||(n[18]=e.createElementVNode("span",null,"Download PDF",-1))]),_:1}),e.createVNode(fe,{onClick:we,class:"gap-2 cursor-pointer"},{default:e.withCtx(()=>[e.createVNode(e.unref(T.MailCheck),{size:16,class:"text-muted-foreground"}),n[19]||(n[19]=e.createElementVNode("span",null,"(Re)send Confirmation Mail",-1))]),_:1}),e.unref(E)("manage-reservations")?(e.openBlock(),e.createBlock(fe,{key:0,onClick:ee,class:"gap-2 cursor-pointer",disabled:pe.value},{default:e.withCtx(()=>[e.createVNode(e.unref(T.CalendarClock),{size:16,class:"text-muted-foreground"}),n[20]||(n[20]=e.createElementVNode("span",null,"Transfer Date & Time",-1))]),_:1},8,["disabled"])):e.createCommentVNode("",!0)]),_:1}),e.createVNode(Be),e.unref(E)("manage-reservations")?(e.openBlock(),e.createBlock(te,{key:0},{default:e.withCtx(()=>[e.createVNode(fe,{onClick:be,class:"gap-2 cursor-pointer",variant:"destructive",disabled:pe.value},{default:e.withCtx(()=>[e.createVNode(e.unref(T.XCircle),{size:16}),n[21]||(n[21]=e.createElementVNode("span",null,"Cancel Reservation",-1))]),_:1},8,["disabled"]),D.value&&t.value?.total&&t.value.total>0?(e.openBlock(),e.createBlock(fe,{key:0,onClick:he,class:"gap-2 cursor-pointer text-orange-600 dark:text-orange-400 focus:text-orange-600 dark:focus:text-orange-400",disabled:pe.value},{default:e.withCtx(()=>[e.createVNode(e.unref(T.Gift),{class:"text-inherit",size:16}),n[22]||(n[22]=e.createElementVNode("span",null,"Cancel & Refund",-1))]),_:1},8,["disabled"])):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0)]),_:1})]),_:1})):e.createCommentVNode("",!0)]),_:1})]),_:1})]),_:1},8,["open"]),e.createVNode(et,{ref_key:"cancelReservationDialog",ref:ne,onConfirm:d},null,512),e.createVNode(pt,{ref_key:"cancelRefundReservationDialog",ref:G,"is-processing":y.value,"has-refund-flow":D.value,"show-refund-amount":F.value.showAmount,"custom-fields":F.value.fields,onConfirm:O},null,8,["is-processing","has-refund-flow","show-refund-amount","custom-fields"]),e.createVNode(Et,{ref_key:"approveReservationDialog",ref:z,onConfirm:K},null,512),e.createVNode(At,{ref_key:"rejectReservationDialog",ref:re,onConfirm:ae},null,512),e.createVNode(ht,{ref_key:"transferReservationDialog",ref:ce,"agenda-data":o.agendaData,onTransferred:ie},null,8,["agenda-data"])],64)}}}),Qo={key:0,class:"space-y-6 py-4"},ea={class:"space-y-3"},ta={class:"bg-muted/30 rounded-lg p-4 space-y-3"},oa={class:"flex items-center gap-3"},aa={class:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center"},na={class:"font-medium"},ra={class:"grid gap-2 text-sm"},sa={key:0,class:"flex items-center gap-2 text-muted-foreground"},la=["href"],ia={key:1,class:"flex items-center gap-2 text-muted-foreground"},da=["href"],ca={class:"space-y-3"},ua={class:"grid grid-cols-2 gap-3"},ma={class:"bg-muted/30 rounded-lg p-3"},pa={class:"flex items-center gap-2 text-muted-foreground mb-1"},va={class:"font-medium"},fa={class:"bg-muted/30 rounded-lg p-3"},ga={class:"flex items-center gap-2 text-muted-foreground mb-1"},ba={class:"font-medium"},ya={class:"bg-muted/30 rounded-lg p-3 col-span-2"},xa={class:"flex items-center gap-2 text-muted-foreground mb-1"},Na={class:"font-medium"},ka={class:"space-y-3"},Va={class:"space-y-2"},wa=["onClick"],ha={class:"flex items-start justify-between gap-3"},Ca={class:"min-w-0 flex-1 space-y-2"},_a={class:"flex items-center gap-2 flex-wrap"},Da={key:0,class:"inline-flex items-center gap-1 text-xs text-muted-foreground"},$a={class:"grid gap-1 text-sm"},Ea={class:"flex items-center gap-2 text-muted-foreground"},Sa={class:"flex items-center gap-2 text-muted-foreground"},Ba={class:"flex items-center gap-2 text-muted-foreground"},Ra={key:0,class:"flex items-center gap-2 text-muted-foreground"},Ta={class:"shrink-0 text-right flex items-center gap-2"},Aa={class:"text-sm font-semibold"},Ma={class:"space-y-3"},ja={class:"bg-muted/30 rounded-lg p-4 space-y-3"},Ia={class:"space-y-2 text-sm"},Fa={class:"flex justify-between"},za={key:0,class:"flex justify-between"},Pa={key:1,class:"grid gap-2"},Oa={class:"text-muted-foreground"},Ua={key:2,class:"flex justify-between text-green-600 dark:text-green-400"},La={class:"flex justify-between font-semibold"},Ha={class:"space-y-2 text-sm"},qa={key:0,class:"flex justify-between"},Wa={class:"text-muted-foreground flex items-center gap-1.5"},Ga={class:"text-green-600 dark:text-green-400"},Ja={key:1,class:"flex justify-between"},Ya={class:"text-muted-foreground flex items-center gap-1.5"},Ka={class:"text-orange-600 dark:text-orange-400 font-medium"},Xa=e.defineComponent({__name:"OrderDetailDialog",props:{agendaData:{},resources:{default:()=>[]}},emits:["openReservation","closed"],setup(o,{expose:v,emit:R}){const g=o,E=R,B=e.ref(!1),s=e.ref(null),x=e.ref(!1),{params:_}=W.useModuleRoute(),{runFlow:m}=W.useFlowBuilder(),b=e.computed(()=>_.value?.id??_.id??g.agendaData?.id??""),{metadataSchema:f}=Me(b),N=e.computed(()=>{const c=Array.isArray(g.resources)?g.resources:[],u=Array.isArray(g.agendaData?.resources)?g.agendaData.resources:[],P=[...c,...u],V=new Set;return P.filter(q=>{const se=q?.id;return!se||V.has(String(se))?!1:(V.add(String(se)),!0)})}),i=c=>{!c?.id||!c.reservations?.length||(s.value=c,B.value=!0)},r=()=>{B.value&&(B.value=!1,E("closed"))},t=c=>{if(c){B.value=!0;return}r()},y=e.computed(()=>{const c=s.value?.customerInfo;return c&&[c.firstName,c.lastName].filter(Boolean).join(" ")||"Unknown Customer"}),$=e.computed(()=>{const c=s.value?.reservations?.[0];return{subtotal:c?.subtotal,discount:c?.discount,amountPaid:c?.amountPaid,amountDue:c?.amountDue}}),a=e.computed(()=>s.value?.reservations.reduce((c,u)=>c+(u.reservationPrice||0),0)||0),k=c=>{if(typeof c!="string")return!1;const u=c.trim().toLowerCase();return u.length>0&&u!=="unknown"&&u!=="unknown resource"},j=c=>c&&N.value.find(u=>String(u.id)===String(c))||null,L=c=>{const u=c.resourceId||c.resource?.id,P=j(u),V=c.resource?.name;return{name:P?.name||(k(V)?V:"")||(k(c.resourceName)?c.resourceName:""),color:P?.color||c.resource?.color||c.resourceColor||"#6b7280"}},Y=e.computed(()=>s.value?.reservations.map(c=>{const u=L(c);return{...c,resourceName:u.name,resourceColor:u.color}})||[]),H=e.computed(()=>s.value?{...s.value,reservations:Y.value}:null),C=c=>c==null||typeof c!="number"?"-":`€${c.toFixed(2)}`,w=c=>c.type==="percent"?`${c.value}%`:`${c.value<0?"-":"+"}${C(Math.abs(c.value))}`,D=c=>{if(!c)return"-";const u=new Date(c);return Number.isNaN(u.getTime())?c:u.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric",year:"numeric"})},F=c=>{if(!c)return"-";const u=new Date(c);return Number.isNaN(u.getTime())?c:u.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1})},ne=c=>{switch(c){case"pending":return{label:"Pending",class:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400"};case"cancelled":return{label:"Cancelled",class:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"};case"needs_approval":return{label:"Needs Approval",class:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400"};case"rejected":return{label:"Rejected",class:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"};case"approved":return{label:"Approved",class:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400"};case"confirmed":return{label:"Confirmed",class:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400"};default:return{label:c||"Unknown",class:"bg-muted text-muted-foreground"}}},G=c=>{let u=c.status;const P=c.reservationStatus;return u==="confirmed"&&["needs_approval","rejected","approved","cancelled"].includes(P||"")&&(u=P),ne(u)},z=c=>{const u=c.id||s.value?.id;u&&(B.value=!1,E("openReservation",{...c,id:u}))},re=()=>{H.value&&Ye(H.value,{agendaName:g.agendaData?.name,metadataSchema:f.value})},ce=c=>c===null||Array.isArray(c)?"object":typeof c,ue=async({field:c,value:u})=>{const P=c?.action?.flow||{};if(!(!Object.keys(P).length||x.value)){x.value=!0;try{await m(P,[{id:"value",name:"value",type:ce(u),value:u},{id:"field",name:"field",type:"object",value:{id:c.id,key:c.key,label:c.label,display:c.display,scope:c.scope}},{id:"metadata",name:"metadata",type:"object",value:s.value?.metadata||{}},{id:"order",name:"order",type:"object",value:H.value||s.value||{}},{id:"agenda",name:"agenda",type:"object",value:g.agendaData||{}},{id:"customer",name:"customer",type:"object",value:s.value?.customerInfo||{}},{id:"orderId",name:"orderId",type:"string",value:s.value?.id||""}]),Q.toast.success("Metadata action completed")}catch(V){console.error("Error running metadata action:",V),Q.toast.error("Failed to run metadata action")}finally{x.value=!1}}};return v({openDialog:i}),(c,u)=>{const P=e.resolveComponent("ResponsiveModalTitle"),V=e.resolveComponent("ResponsiveModalDescription"),q=e.resolveComponent("ResponsiveModalHeader"),se=e.resolveComponent("Separator"),le=e.resolveComponent("Button"),me=e.resolveComponent("DropdownMenuTrigger"),pe=e.resolveComponent("DropdownMenuLabel"),oe=e.resolveComponent("DropdownMenuItem"),ge=e.resolveComponent("DropdownMenuGroup"),ve=e.resolveComponent("DropdownMenuSeparator"),ke=e.resolveComponent("DropdownMenuSubTrigger"),Ve=e.resolveComponent("DropdownMenuSubContent"),we=e.resolveComponent("DropdownMenuPortal"),be=e.resolveComponent("DropdownMenuSub"),he=e.resolveComponent("DropdownMenuContent"),d=e.resolveComponent("DropdownMenu"),p=e.resolveComponent("ResponsiveModalFooter"),M=e.resolveComponent("ResponsiveModalScrollContent"),I=e.resolveComponent("ResponsiveModal");return e.openBlock(),e.createBlock(I,{open:B.value,"onUpdate:open":t},{default:e.withCtx(()=>[e.createVNode(M,{class:"sm:max-w-2xl"},{default:e.withCtx(()=>[e.createVNode(q,null,{default:e.withCtx(()=>[e.createVNode(P,{class:"flex items-center gap-3"},{default:e.withCtx(()=>[u[0]||(u[0]=e.createElementVNode("span",null,"Order Details",-1)),e.createElementVNode("span",{class:e.normalizeClass(["px-2.5 py-1 text-xs font-medium rounded-full",ne(s.value?.status).class])},e.toDisplayString(ne(s.value?.status).label),3)]),_:1}),e.createVNode(V,null,{default:e.withCtx(()=>[e.createTextVNode(" Order #"+e.toDisplayString(s.value?.id?.slice(0,8)||"-"),1)]),_:1})]),_:1}),s.value?(e.openBlock(),e.createElementBlock("div",Qo,[e.createVNode($e,{metadata:s.value.metadata,schema:e.unref(f),scope:"order","enable-actions":"","actions-disabled":x.value,onRunAction:ue},null,8,["metadata","schema","actions-disabled"]),e.createElementVNode("div",ea,[u[1]||(u[1]=e.createElementVNode("h3",{class:"text-sm font-semibold text-muted-foreground uppercase tracking-wide"},"Customer",-1)),e.createElementVNode("div",ta,[e.createElementVNode("div",oa,[e.createElementVNode("div",aa,[e.createVNode(e.unref(T.User),{size:20,class:"text-primary"})]),e.createElementVNode("div",null,[e.createElementVNode("p",na,e.toDisplayString(y.value),1)])]),e.createElementVNode("div",ra,[s.value.customerInfo?.email?(e.openBlock(),e.createElementBlock("div",sa,[e.createVNode(e.unref(T.Mail),{size:14}),e.createElementVNode("a",{href:`mailto:${s.value.customerInfo.email}`,class:"hover:text-foreground transition-colors"},e.toDisplayString(s.value.customerInfo.email),9,la)])):e.createCommentVNode("",!0),s.value.customerInfo?.phone?(e.openBlock(),e.createElementBlock("div",ia,[e.createVNode(e.unref(T.Phone),{size:14}),e.createElementVNode("a",{href:`tel:${s.value.customerInfo.phone}`,class:"hover:text-foreground transition-colors"},e.toDisplayString(s.value.customerInfo.phone),9,da)])):e.createCommentVNode("",!0)])])]),e.createElementVNode("div",ca,[u[5]||(u[5]=e.createElementVNode("h3",{class:"text-sm font-semibold text-muted-foreground uppercase tracking-wide"},"Order Summary",-1)),e.createElementVNode("div",ua,[e.createElementVNode("div",ma,[e.createElementVNode("div",pa,[e.createVNode(e.unref(T.ShoppingBag),{size:14}),u[2]||(u[2]=e.createElementVNode("span",{class:"text-xs"},"Reservations",-1))]),e.createElementVNode("p",va,e.toDisplayString(s.value.reservations.length),1)]),e.createElementVNode("div",fa,[e.createElementVNode("div",ga,[e.createVNode(e.unref(T.Users),{size:14}),u[3]||(u[3]=e.createElementVNode("span",{class:"text-xs"},"Spots",-1))]),e.createElementVNode("p",ba,e.toDisplayString(s.value.totalSpots),1)]),e.createElementVNode("div",ya,[e.createElementVNode("div",xa,[e.createVNode(e.unref(T.Clock),{size:14}),u[4]||(u[4]=e.createElementVNode("span",{class:"text-xs"},"Ordered at",-1))]),e.createElementVNode("p",Na,e.toDisplayString(D(s.value.createdAt))+" · "+e.toDisplayString(F(s.value.createdAt)),1)])])]),e.createElementVNode("div",ka,[u[6]||(u[6]=e.createElementVNode("h3",{class:"text-sm font-semibold text-muted-foreground uppercase tracking-wide"},"Reservations",-1)),e.createElementVNode("div",Va,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Y.value,h=>(e.openBlock(),e.createElementBlock("button",{key:h.res_id||h.id,type:"button",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",onClick:O=>z(h)},[e.createElementVNode("div",ha,[e.createElementVNode("div",Ca,[e.createElementVNode("div",_a,[e.createElementVNode("span",{class:e.normalizeClass(["px-2 py-1 text-xs font-medium rounded-full",G(h).class])},e.toDisplayString(G(h).label),3),h.resourceName?(e.openBlock(),e.createElementBlock("span",Da,[e.createElementVNode("span",{class:"w-3 h-3 rounded-full",style:e.normalizeStyle({backgroundColor:h.resourceColor||"#6b7280"})},null,4),e.createTextVNode(" "+e.toDisplayString(h.resourceName),1)])):e.createCommentVNode("",!0)]),e.createElementVNode("div",$a,[e.createElementVNode("div",Ea,[e.createVNode(e.unref(T.Calendar),{size:14}),e.createElementVNode("span",null,e.toDisplayString(D(h.date)),1)]),e.createElementVNode("div",Sa,[e.createVNode(e.unref(T.Clock),{size:14}),e.createElementVNode("span",null,e.toDisplayString(h.startTime||"-")+" - "+e.toDisplayString(h.endTime||"-"),1)]),e.createElementVNode("div",Ba,[e.createVNode(e.unref(T.Users),{size:14}),e.createElementVNode("span",null,e.toDisplayString(h.spots||1)+" "+e.toDisplayString(h.spots===1?"person":"people"),1)]),h.pricingOption?(e.openBlock(),e.createElementBlock("div",Ra,[e.createVNode(e.unref(T.Tag),{size:14}),e.createElementVNode("span",null,e.toDisplayString(h.pricingOption.name),1)])):e.createCommentVNode("",!0)]),e.createVNode($e,{metadata:h.reservationMetadata,schema:e.unref(f),"display-filter":["highlight","badge"],compact:""},null,8,["metadata","schema"]),h.refunds?.length?(e.openBlock(),e.createBlock(ze,{key:0,refunds:h.refunds,compact:""},null,8,["refunds"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",Ta,[e.createElementVNode("div",null,[e.createElementVNode("p",Aa,e.toDisplayString(C(h.reservationPrice)),1)]),e.createVNode(e.unref(T.ChevronRight),{size:16,class:"text-muted-foreground"})])])],8,wa))),128))])]),e.createElementVNode("div",Ma,[u[13]||(u[13]=e.createElementVNode("h3",{class:"text-sm font-semibold text-muted-foreground uppercase tracking-wide"},"Payment",-1)),e.createElementVNode("div",ja,[e.createElementVNode("div",Ia,[e.createElementVNode("div",Fa,[u[7]||(u[7]=e.createElementVNode("span",{class:"text-muted-foreground"},"Reservations",-1)),e.createElementVNode("span",null,e.toDisplayString(C(a.value)),1)]),$.value.subtotal!==void 0&&$.value.subtotal!==s.value.totalPrice?(e.openBlock(),e.createElementBlock("div",za,[u[8]||(u[8]=e.createElementVNode("span",{class:"text-muted-foreground"},"Subtotal",-1)),e.createElementVNode("span",null,e.toDisplayString(C($.value.subtotal)),1)])):e.createCommentVNode("",!0),s.value.adjustments&&s.value.adjustments.length?(e.openBlock(),e.createElementBlock("div",Pa,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value.adjustments,h=>(e.openBlock(),e.createElementBlock("div",{key:`${h.label}-${h.type}-${h.value}`,class:"flex justify-between"},[e.createElementVNode("span",Oa,e.toDisplayString(h.label),1),e.createElementVNode("span",null,e.toDisplayString(w(h)),1)]))),128))])):e.createCommentVNode("",!0),$.value.discount?(e.openBlock(),e.createElementBlock("div",Ua,[u[9]||(u[9]=e.createElementVNode("span",null,"Discount",-1)),e.createElementVNode("span",null,"-"+e.toDisplayString(C($.value.discount)),1)])):e.createCommentVNode("",!0)]),e.createVNode(se),e.createElementVNode("div",La,[u[10]||(u[10]=e.createElementVNode("span",null,"Order Total",-1)),e.createElementVNode("span",null,e.toDisplayString(C(s.value.totalPrice)),1)]),$.value.amountPaid!==void 0||$.value.amountDue!==void 0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(se),e.createElementVNode("div",Ha,[$.value.amountPaid!==void 0?(e.openBlock(),e.createElementBlock("div",qa,[e.createElementVNode("span",Wa,[e.createVNode(e.unref(T.CreditCard),{size:14}),u[11]||(u[11]=e.createTextVNode(" Amount paid ",-1))]),e.createElementVNode("span",Ga,e.toDisplayString(C($.value.amountPaid)),1)])):e.createCommentVNode("",!0),$.value.amountDue!==void 0&&$.value.amountDue>0?(e.openBlock(),e.createElementBlock("div",Ja,[e.createElementVNode("span",Ya,[e.createVNode(e.unref(T.Receipt),{size:14}),u[12]||(u[12]=e.createTextVNode(" Amount due ",-1))]),e.createElementVNode("span",Ka,e.toDisplayString(C($.value.amountDue)),1)])):e.createCommentVNode("",!0)])],64)):e.createCommentVNode("",!0)])])])):e.createCommentVNode("",!0),e.createVNode(p,{class:"gap-2 sm:justify-between"},{default:e.withCtx(()=>[s.value?(e.openBlock(),e.createBlock(d,{key:0},{default:e.withCtx(()=>[e.createVNode(me,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(le,{variant:"outline",class:"gap-2"},{default:e.withCtx(()=>[e.createVNode(e.unref(T.MoreHorizontal),{size:16}),u[14]||(u[14]=e.createTextVNode(" Actions ",-1))]),_:1})]),_:1}),e.createVNode(he,{class:"w-60",align:"start"},{default:e.withCtx(()=>[e.createVNode(pe,{class:"text-xs text-muted-foreground font-normal"},{default:e.withCtx(()=>[...u[15]||(u[15]=[e.createTextVNode(" Reservation Actions ",-1)])]),_:1}),e.createVNode(ge,null,{default:e.withCtx(()=>[e.createVNode(oe,{onClick:re,class:"gap-2 cursor-pointer"},{default:e.withCtx(()=>[e.createVNode(e.unref(T.Download),{size:16,class:"text-muted-foreground"}),u[16]||(u[16]=e.createElementVNode("span",null,"Download PDF",-1))]),_:1})]),_:1}),e.createVNode(ve),e.createVNode(ge,null,{default:e.withCtx(()=>[e.createVNode(be,null,{default:e.withCtx(()=>[e.createVNode(ke,null,{default:e.withCtx(()=>[...u[17]||(u[17]=[e.createTextVNode("Reservations",-1)])]),_:1}),e.createVNode(we,null,{default:e.withCtx(()=>[e.createVNode(Ve,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value.reservations,h=>(e.openBlock(),e.createBlock(oe,{key:h.res_id||h.id,onClick:O=>z(h)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(D(h.date))+" "+e.toDisplayString(h.startTime||"-"),1)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})):e.createCommentVNode("",!0),e.createVNode(le,{variant:"outline",onClick:r},{default:e.withCtx(()=>[...u[18]||(u[18]=[e.createTextVNode("Close",-1)])]),_:1})]),_:1})]),_:1})]),_:1},8,["open"])}}});exports._sfc_main=$e;exports._sfc_main$1=Zo;exports._sfc_main$2=Xa;exports.useAgendaMetadataSchema=Me;