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

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 (87) hide show
  1. package/dist/{ContentEditor-MctMvN7D.js → ContentEditor-CsbOFg3a.js} +52 -52
  2. package/dist/{ContentEditor-C5yNNLeV.mjs → ContentEditor-Df5uWpVC.mjs} +10337 -8677
  3. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-gozJKXvM.js +1 -0
  4. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-pDO9b4Pv.mjs +77 -0
  5. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BHeMJ6nr.mjs +1476 -0
  6. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-C2zwt5UF.js +1 -0
  7. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-BYSeUW_V.js +925 -0
  8. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-DwAUYR8p.mjs +5021 -0
  9. package/dist/Overview-CBahJviK.js +1 -0
  10. package/dist/Overview-CVQ1pkuD.mjs +527 -0
  11. package/dist/TableView-Csv5Lycy.mjs +6234 -0
  12. package/dist/TableView-Cwal0BPW.js +4 -0
  13. package/dist/agenda-BSdlrfxv.mjs +1253 -0
  14. package/dist/agenda-Bev1mO7E.js +1 -0
  15. package/dist/availability-ClBGVgE9.js +1 -0
  16. package/dist/availability-D8JdA4rP.mjs +274 -0
  17. package/dist/booking-data-Px7XCIfU.mjs +1024 -0
  18. package/dist/booking-data-aMS1p_3g.js +1 -0
  19. package/dist/cms-core-modules.css +1 -1
  20. package/dist/exceptions-CqityDo9.mjs +651 -0
  21. package/dist/exceptions-DXqc0Nza.js +1 -0
  22. package/dist/index-CM4eaK5T.mjs +1245 -0
  23. package/dist/index-DliTZzwI.js +35 -0
  24. package/dist/index.cjs.js +1 -1
  25. package/dist/index.mjs +12 -11
  26. package/dist/orders-1swJVKw2.js +1 -0
  27. package/dist/orders-D41GbzIa.mjs +624 -0
  28. package/dist/payment-BJHgpaeT.js +1 -0
  29. package/dist/payment-D5j-68Ig.mjs +1278 -0
  30. package/dist/refunds-D9nTeD2d.mjs +436 -0
  31. package/dist/refunds-oVB2Opib.js +1 -0
  32. package/dist/resources-8WouFvJe.js +1 -0
  33. package/dist/resources-B-D5MUhV.mjs +975 -0
  34. package/dist/server-handlers.cjs.js +1 -1
  35. package/dist/server-handlers.mjs +626 -515
  36. package/dist/src/appointments/components/edit/EventDialog/BookingsList.vue.d.ts +146 -5
  37. package/dist/src/appointments/components/edit/EventDialog/CancelRefundReservationDialog.vue.d.ts +33 -0
  38. package/dist/src/appointments/components/edit/EventDialog/OrderDetailDialog.vue.d.ts +26 -8
  39. package/dist/src/appointments/components/edit/EventDialog/RefundDetailsDisplay.vue.d.ts +8 -0
  40. package/dist/src/appointments/components/edit/EventDialog/ReservationDetailDialog.vue.d.ts +91 -5
  41. package/dist/src/appointments/components/edit/EventDialog/TransferReservationDialog.vue.d.ts +20 -3
  42. package/dist/src/appointments/components/edit/NewReservationDialog/ReservationLines.vue.d.ts +5 -0
  43. package/dist/src/appointments/components/edit/OrderMetadataDisplay.vue.d.ts +20 -2
  44. package/dist/src/appointments/components/edit/dashboard/BookingsList.vue.d.ts +240 -0
  45. package/dist/src/appointments/composables/useAgendaMetadataSchema.d.ts +37 -0
  46. package/dist/src/appointments/pages/edit/orders.vue.d.ts +225 -0
  47. package/dist/src/appointments/pages/edit/refunds.vue.d.ts +2 -0
  48. package/dist/src/appointments/server.d.ts +2 -0
  49. package/dist/src/appointments/types.d.ts +6 -0
  50. package/dist/src/appointments/utils/printReservation.d.ts +65 -3
  51. package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/Table.d.ts +36 -0
  52. package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/Table.vue.d.ts +95 -0
  53. package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/TableCell.d.ts +13 -0
  54. package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/TableHeader.d.ts +6 -0
  55. package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/TableRow.d.ts +6 -0
  56. package/dist/src/contentManager/components/content-editor/tiptap-extensions/table/index.d.ts +4 -0
  57. package/dist/src/contentManager/components/content-editor/tiptap-menus/element-editor-views/TableMenu.vue.d.ts +13 -0
  58. package/dist/src/contentManager/components/content-editor/tiptap-menus/element-editor-views/index.d.ts +14 -0
  59. package/package.json +2 -2
  60. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-DWMqQvHl.mjs +0 -76
  61. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-kpjbVSXg.js +0 -1
  62. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-Baqy-rTT.js +0 -1
  63. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-Dx4Bpa2m.mjs +0 -1263
  64. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-COrK1j0S.js +0 -1
  65. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-Vb3q8EVv.mjs +0 -330
  66. package/dist/Overview-98nkJUWN.mjs +0 -481
  67. package/dist/Overview-Dl8cMlsr.js +0 -1
  68. package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-CuwREvXD.js +0 -349
  69. package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-GYNZ_yhD.mjs +0 -3077
  70. package/dist/TableView-CVfkyj1k.js +0 -4
  71. package/dist/TableView-zDx0IegJ.mjs +0 -6096
  72. package/dist/agenda-BaJu3-1c.js +0 -1
  73. package/dist/agenda-BwVY_8oM.mjs +0 -1165
  74. package/dist/availability-CMrRa5y2.mjs +0 -269
  75. package/dist/availability-Cf2YfMwM.js +0 -1
  76. package/dist/booking-data-DgJd0BcM.mjs +0 -889
  77. package/dist/booking-data-Di5GmH_8.js +0 -1
  78. package/dist/exceptions-B6P9UiCj.js +0 -1
  79. package/dist/exceptions-De9-FvdP.mjs +0 -646
  80. package/dist/index-DL6orwdK.js +0 -35
  81. package/dist/index-hH3e-IYz.mjs +0 -1187
  82. package/dist/orders-C65SlpJy.mjs +0 -618
  83. package/dist/orders-XVzWAgG1.js +0 -1
  84. package/dist/payment-C3ohkehF.mjs +0 -1080
  85. package/dist/payment-Dfr-Ro-a.js +0 -1
  86. package/dist/resources-CxeFd57z.js +0 -1
  87. package/dist/resources-DwYxn2Vi.mjs +0 -811
@@ -0,0 +1,1278 @@
1
+ import { defineComponent as q, inject as Z, resolveComponent as p, openBlock as u, createElementBlock as c, createElementVNode as o, createVNode as t, withCtx as s, createTextVNode as d, createCommentVNode as I, ref as F, Fragment as D, renderList as N, unref as V, toDisplayString as S, withModifiers as Ce, normalizeClass as U, useTemplateRef as we, nextTick as Oe, reactive as De, computed as Ie, provide as Te, createBlock as Q, normalizeStyle as he } from "vue";
2
+ import { _ as Ae } from "./EditLayout.vue_vue_type_script_setup_true_lang-pDO9b4Pv.mjs";
3
+ import { DollarSign as Pe, Pencil as Re, Trash2 as J, PlusCircle as X, AlertTriangle as de, Users as ie, ChevronDown as Ue } from "lucide-vue-next";
4
+ import { useConfirmation as $e, useModuleRoute as Me, useModulePermissions as Ne, useModule as ze, useFirebaseIntegration as Ee } from "@oneclick.dev/cms-kit";
5
+ import { t as Le } from "./index-RLz1QPrf.mjs";
6
+ const Be = { class: "flex gap-3 items-start p-4 border rounded-lg" }, je = { class: "flex-1 space-y-3" }, Fe = { class: "grid grid-cols-2 gap-3" }, qe = { class: "flex items-center space-x-2 my-4" }, Ge = { class: "grid grid-cols-2 gap-2" }, He = { key: 0 }, Ye = { key: 1 }, We = { key: 2 }, Ke = { key: 3 }, Qe = { key: 4 }, Je = { key: 0 }, Xe = /* @__PURE__ */ q({
7
+ __name: "Addon",
8
+ props: {
9
+ addOn: {
10
+ type: Object,
11
+ required: !0
12
+ }
13
+ },
14
+ setup(g) {
15
+ const T = Z("form"), w = (h) => {
16
+ T.addOns = T.addOns.filter((i) => i.id !== h);
17
+ };
18
+ return (h, i) => {
19
+ const y = p("Label"), C = p("Input"), O = p("Checkbox"), k = p("SelectTrigger"), b = p("SelectItem"), $ = p("SelectGroup"), G = p("SelectContent"), P = p("Select"), H = p("Trash2"), E = p("Button");
20
+ return u(), c("div", Be, [
21
+ o("div", je, [
22
+ o("div", Fe, [
23
+ o("div", null, [
24
+ t(y, { class: "text-xs mb-1 block" }, {
25
+ default: s(() => [...i[7] || (i[7] = [
26
+ d("Add-on Name", -1)
27
+ ])]),
28
+ _: 1
29
+ }),
30
+ t(C, {
31
+ modelValue: g.addOn.name,
32
+ "onUpdate:modelValue": i[0] || (i[0] = (_) => g.addOn.name = _),
33
+ placeholder: "e.g., Swimsuit Rental, Towel Service"
34
+ }, null, 8, ["modelValue"])
35
+ ]),
36
+ o("div", null, [
37
+ t(y, { class: "text-xs mb-1 block" }, {
38
+ default: s(() => [...i[8] || (i[8] = [
39
+ d("Price", -1)
40
+ ])]),
41
+ _: 1
42
+ }),
43
+ t(C, {
44
+ modelValue: g.addOn.price,
45
+ "onUpdate:modelValue": i[1] || (i[1] = (_) => g.addOn.price = _),
46
+ modelModifiers: { number: !0 },
47
+ type: "number",
48
+ min: "0",
49
+ step: "0.01",
50
+ placeholder: "0.00",
51
+ class: "no-spinner"
52
+ }, null, 8, ["modelValue"])
53
+ ])
54
+ ]),
55
+ o("div", null, [
56
+ t(y, { class: "text-xs mb-1 block" }, {
57
+ default: s(() => [...i[9] || (i[9] = [
58
+ d("Description (Optional)", -1)
59
+ ])]),
60
+ _: 1
61
+ }),
62
+ t(C, {
63
+ modelValue: g.addOn.description,
64
+ "onUpdate:modelValue": i[2] || (i[2] = (_) => g.addOn.description = _),
65
+ placeholder: "Brief description of this add-on"
66
+ }, null, 8, ["modelValue"])
67
+ ]),
68
+ o("div", qe, [
69
+ t(O, {
70
+ id: `required-${g.addOn.id}`,
71
+ modelValue: g.addOn.required,
72
+ "onUpdate:modelValue": i[3] || (i[3] = (_) => g.addOn.required = _)
73
+ }, null, 8, ["id", "modelValue"]),
74
+ t(y, {
75
+ for: `required-${g.addOn.id}`,
76
+ class: "text-xs font-normal cursor-pointer"
77
+ }, {
78
+ default: s(() => [...i[10] || (i[10] = [
79
+ d(" Required (customer must select this add-on) ", -1)
80
+ ])]),
81
+ _: 1
82
+ }, 8, ["for"])
83
+ ]),
84
+ o("div", Ge, [
85
+ o("div", null, [
86
+ t(y, { class: "text-xs mb-1 block" }, {
87
+ default: s(() => [...i[11] || (i[11] = [
88
+ d("Quantity limit", -1)
89
+ ])]),
90
+ _: 1
91
+ }),
92
+ t(P, {
93
+ modelValue: g.addOn.scope,
94
+ "onUpdate:modelValue": i[4] || (i[4] = (_) => g.addOn.scope = _)
95
+ }, {
96
+ default: s(() => [
97
+ t(k, { class: "w-full" }, {
98
+ default: s(() => [
99
+ g.addOn.scope === "RESERVATION" ? (u(), c("span", He, "Once per reservation")) : g.addOn.scope === "TICKET" ? (u(), c("span", Ye, "Once per ticket / person")) : g.addOn.scope === "UNLIMITED" ? (u(), c("span", We, "Unlimited")) : g.addOn.scope === "CUSTOM_LIMIT" ? (u(), c("span", Ke, "Custom limit...")) : (u(), c("span", Qe, "Select a limit…"))
100
+ ]),
101
+ _: 1
102
+ }),
103
+ t(G, null, {
104
+ default: s(() => [
105
+ t($, { class: "max-w-96" }, {
106
+ default: s(() => [
107
+ t(b, { value: "RESERVATION" }, {
108
+ default: s(() => [...i[12] || (i[12] = [
109
+ o("div", { class: "flex flex-col" }, [
110
+ o("p", { class: "text-sm font-bold mb-1" }, "Once per reservation"),
111
+ o("p", { class: "text-xs" }, "Max 1 per reservation line (charged per reservation).")
112
+ ], -1)
113
+ ])]),
114
+ _: 1
115
+ }),
116
+ t(b, { value: "TICKET" }, {
117
+ default: s(() => [...i[13] || (i[13] = [
118
+ o("div", { class: "flex flex-col" }, [
119
+ o("p", { class: "text-sm font-bold mb-1" }, "Once per ticket / person"),
120
+ o("p", { class: "text-xs" }, "Max 1 per ticket/person (charged per quantity).")
121
+ ], -1)
122
+ ])]),
123
+ _: 1
124
+ }),
125
+ t(b, { value: "UNLIMITED" }, {
126
+ default: s(() => [...i[14] || (i[14] = [
127
+ o("div", { class: "flex flex-col" }, [
128
+ o("p", { class: "text-sm font-bold mb-1" }, "Unlimited"),
129
+ o("p", { class: "text-xs" }, "No limit (can be added multiple times).")
130
+ ], -1)
131
+ ])]),
132
+ _: 1
133
+ }),
134
+ t(b, { value: "CUSTOM_LIMIT" }, {
135
+ default: s(() => [...i[15] || (i[15] = [
136
+ o("div", { class: "flex flex-col" }, [
137
+ o("p", { class: "text-sm font-bold mb-1" }, "Custom limit..."),
138
+ o("p", { class: "text-xs" }, "Set a fixed max amount (e.g. 2, 5, 10).")
139
+ ], -1)
140
+ ])]),
141
+ _: 1
142
+ })
143
+ ]),
144
+ _: 1
145
+ })
146
+ ]),
147
+ _: 1
148
+ })
149
+ ]),
150
+ _: 1
151
+ }, 8, ["modelValue"])
152
+ ]),
153
+ g.addOn.scope === "CUSTOM_LIMIT" ? (u(), c("div", Je, [
154
+ t(y, { class: "text-xs mb-1 block" }, {
155
+ default: s(() => [...i[16] || (i[16] = [
156
+ d("Fixed limit", -1)
157
+ ])]),
158
+ _: 1
159
+ }),
160
+ t(C, {
161
+ modelValue: g.addOn.limit,
162
+ "onUpdate:modelValue": i[5] || (i[5] = (_) => g.addOn.limit = _),
163
+ modelModifiers: { number: !0 },
164
+ type: "number",
165
+ min: "1",
166
+ step: "1",
167
+ placeholder: "1",
168
+ class: "no-spinner"
169
+ }, null, 8, ["modelValue"])
170
+ ])) : I("", !0)
171
+ ])
172
+ ]),
173
+ t(E, {
174
+ onClick: i[6] || (i[6] = (_) => w(g.addOn.id)),
175
+ variant: "ghost",
176
+ size: "icon",
177
+ class: "mt-6"
178
+ }, {
179
+ default: s(() => [
180
+ t(H, { class: "w-4 h-4 text-destructive" })
181
+ ]),
182
+ _: 1
183
+ })
184
+ ]);
185
+ };
186
+ }
187
+ }), Ze = { class: "grid gap-2" }, et = ["id"], tt = ["onClick"], nt = { class: "flex items-center gap-2" }, ot = { class: "flex items-center gap-1" }, st = { class: "overflow-hidden" }, lt = /* @__PURE__ */ q({
188
+ __name: "AddonList",
189
+ setup(g, { expose: T }) {
190
+ const { confirm: w } = $e(), h = Z("form"), i = F([]), y = async (C) => {
191
+ if (!await w("Are you sure you want to remove this add-on?")) return;
192
+ h.addOns = h.addOns.filter((b) => b.id !== C);
193
+ const k = i.value.indexOf(C);
194
+ k !== -1 && i.value.splice(k, 1), Le("Success!", {
195
+ description: "Add-on removed successfully."
196
+ });
197
+ };
198
+ return T({
199
+ openAddons: i
200
+ }), (C, O) => {
201
+ const k = p("Button");
202
+ return u(), c("div", Ze, [
203
+ (u(!0), c(D, null, N(V(h).addOns, (b) => (u(), c("div", {
204
+ key: b.id,
205
+ class: "border p-2 rounded",
206
+ id: `addon-${b.id}`
207
+ }, [
208
+ o("div", {
209
+ onClick: ($) => i.value.includes(b.id) ? i.value.splice(i.value.indexOf(b.id), 1) : i.value.push(b.id),
210
+ class: "cursor-pointer font-bold text-muted-foreground flex items-center justify-between gap-2 select-none"
211
+ }, [
212
+ o("span", nt, [
213
+ t(V(Pe), { class: "size-4" }),
214
+ d(" " + S(b.name || "Untitled Add-on"), 1)
215
+ ]),
216
+ o("div", ot, [
217
+ t(k, {
218
+ variant: "ghost",
219
+ size: "icon"
220
+ }, {
221
+ default: s(() => [
222
+ t(V(Re), { class: "size-4" })
223
+ ]),
224
+ _: 1
225
+ }),
226
+ t(k, {
227
+ variant: "ghost",
228
+ size: "icon",
229
+ onClick: Ce(($) => y(b.id), ["stop"])
230
+ }, {
231
+ default: s(() => [
232
+ t(V(J), { class: "size-4 text-red-500" })
233
+ ]),
234
+ _: 1
235
+ }, 8, ["onClick"])
236
+ ])
237
+ ], 8, tt),
238
+ o("div", {
239
+ class: U(["grid", `${i.value.includes(b.id) ? "grid-rows-[1fr]" : "grid-rows-[0fr]"} transition-all duration-300 ease-in-out overflow-hidden`])
240
+ }, [
241
+ o("div", st, [
242
+ t(Xe, { addOn: b }, null, 8, ["addOn"])
243
+ ])
244
+ ], 2)
245
+ ], 8, et))), 128))
246
+ ]);
247
+ };
248
+ }
249
+ }), at = { class: "flex items-center justify-between mb-4" }, dt = { class: "space-y-3" }, it = {
250
+ key: 0,
251
+ class: "text-center py-8 text-muted-foreground text-sm border rounded-lg"
252
+ }, rt = /* @__PURE__ */ q({
253
+ __name: "index",
254
+ setup(g) {
255
+ const T = Z("form"), w = we("addonList"), h = async () => {
256
+ const i = Math.random().toString(36).substr(2, 9);
257
+ T.addOns.push({
258
+ id: i,
259
+ name: "",
260
+ description: "",
261
+ price: 0,
262
+ required: !1
263
+ }), w.value?.openAddons.push(i), await Oe(), document.getElementById(`addon-${i}`)?.scrollIntoView({ behavior: "smooth", block: "start" });
264
+ };
265
+ return (i, y) => {
266
+ const C = p("Label"), O = p("Button");
267
+ return u(), c("div", null, [
268
+ o("div", at, [
269
+ o("div", null, [
270
+ t(C, { class: "text-base font-medium" }, {
271
+ default: s(() => [...y[0] || (y[0] = [
272
+ d(" Optional Add-ons & Upcharges ", -1)
273
+ ])]),
274
+ _: 1
275
+ }),
276
+ y[1] || (y[1] = o("p", { class: "text-sm text-muted-foreground mt-1" }, " Offer optional extras that customers can add to their booking (e.g., swimsuit rental). ", -1))
277
+ ]),
278
+ t(O, {
279
+ onClick: h,
280
+ variant: "outline",
281
+ size: "sm"
282
+ }, {
283
+ default: s(() => [
284
+ t(V(X), { class: "w-4 h-4 mr-2" }),
285
+ y[2] || (y[2] = d(" Add Add-on ", -1))
286
+ ]),
287
+ _: 1
288
+ })
289
+ ]),
290
+ o("div", dt, [
291
+ t(lt, {
292
+ ref_key: "addonList",
293
+ ref: w
294
+ }, null, 512),
295
+ V(T).addOns.length === 0 ? (u(), c("div", it, ' No add-ons configured. Click "Add Add-on" to create optional extras. ')) : I("", !0)
296
+ ])
297
+ ]);
298
+ };
299
+ }
300
+ }), ut = { key: 0 }, mt = {
301
+ key: 0,
302
+ class: "max-w-2xl space-y-12"
303
+ }, ct = { class: "flex gap-4 items-end" }, pt = { class: "w-32" }, ft = { class: "flex items-center justify-between mb-4 gap-4" }, gt = { class: "space-y-3" }, xt = { class: "flex-1 space-y-3" }, yt = { class: "flex gap-3" }, vt = { class: "flex-1" }, bt = { class: "flex-1" }, _t = { class: "flex items-end" }, Vt = { class: "flex items-center justify-between mb-4" }, kt = { class: "space-y-3" }, St = { class: "flex-1 space-y-3" }, Ct = { class: "grid grid-cols-1 sm:grid-cols-2 gap-3" }, wt = {
304
+ key: 0,
305
+ class: "grid grid-cols-1 sm:grid-cols-2 gap-2"
306
+ }, Ot = {
307
+ key: 1,
308
+ class: "space-y-2"
309
+ }, Dt = { class: "grid grid-cols-1 sm:grid-cols-2 gap-2" }, It = { class: "text-xs text-muted-foreground" }, Tt = {
310
+ key: 2,
311
+ class: "grid grid-cols-1 sm:grid-cols-2 gap-2"
312
+ }, ht = {
313
+ key: 0,
314
+ class: "sm:col-span-2 flex items-start gap-1.5 text-xs text-amber-600 dark:text-amber-400"
315
+ }, At = { class: "grid grid-cols-2 gap-3" }, Pt = { key: 0 }, Rt = { class: "flex items-center gap-2" }, Ut = { key: 0 }, $t = { key: 1 }, Mt = { key: 2 }, Nt = { class: "space-y-1" }, zt = ["onClick"], Et = { class: "size-5 rounded-full bg-muted flex items-center justify-center" }, Lt = {
316
+ key: 0,
317
+ class: "w-full h-full rounded-full bg-white scale-50"
318
+ }, Bt = ["onClick"], jt = { class: "text-sm flex-1 truncate" }, Ft = {
319
+ key: 0,
320
+ class: "w-3 h-3 text-white",
321
+ fill: "none",
322
+ viewBox: "0 0 24 24",
323
+ stroke: "currentColor"
324
+ }, qt = {
325
+ key: 0,
326
+ class: "text-center py-8 text-muted-foreground text-sm border rounded-lg"
327
+ }, Gt = {
328
+ key: 0,
329
+ class: "mt-6 p-4 border rounded-lg bg-muted/30"
330
+ }, Ht = { class: "space-y-4" }, Yt = { class: "flex items-center gap-3" }, Wt = { class: "flex-1" }, Kt = { class: "text-sm text-muted-foreground" }, Qt = { class: "text-xs text-muted-foreground" }, Jt = { class: "flex flex-col items-start gap-2 pt-4 border-t" }, Xt = {
331
+ key: 0,
332
+ class: "flex items-start gap-1.5 text-xs text-amber-600 dark:text-amber-400"
333
+ }, Zt = { key: 1 }, an = /* @__PURE__ */ q({
334
+ __name: "payment",
335
+ setup(g) {
336
+ const T = [
337
+ { value: "time_after", label: "Time After" },
338
+ { value: "time_before", label: "Time Before" },
339
+ { value: "time_between", label: "Time Between" },
340
+ { value: "day_of_week", label: "Day of Week" },
341
+ { value: "date_range", label: "Date Range" }
342
+ ], w = [
343
+ { value: 1, label: "Monday" },
344
+ { value: 2, label: "Tuesday" },
345
+ { value: 3, label: "Wednesday" },
346
+ { value: 4, label: "Thursday" },
347
+ { value: 5, label: "Friday" },
348
+ { value: 6, label: "Saturday" },
349
+ { value: 0, label: "Sunday" }
350
+ ], h = /^([01]\d|2[0-3]):[0-5]\d$/, i = /^\d{4}-\d{2}-\d{2}$/, y = (n) => typeof n == "object" && n !== null && !Array.isArray(n), C = (n) => typeof n == "string" && T.some((e) => e.value === n), O = (n, e) => {
351
+ const a = typeof n == "string" ? n : "";
352
+ return h.test(a) ? a : e;
353
+ }, k = (n) => {
354
+ const e = typeof n == "string" ? n : "";
355
+ return i.test(e) ? e : "";
356
+ }, b = (n) => {
357
+ const [e = "0", a = "0"] = n.split(":"), f = (Number(e) + 1) % 24;
358
+ return `${String(f).padStart(2, "0")}:${a.padStart(2, "0")}`;
359
+ }, $ = (n) => typeof n == "string" ? n.split(/\s+(?:to|-|–)\s+/) : [], G = (n) => {
360
+ const e = String(n).trim().toLowerCase();
361
+ if (typeof n == "string" && e === "") return;
362
+ const a = typeof n == "number" ? n : Number(n), f = w.find((x) => x.label.toLowerCase() === e)?.value;
363
+ return Number.isInteger(a) && a >= 0 && a <= 6 ? a : f;
364
+ }, P = (n) => {
365
+ const a = (Array.isArray(n) ? n : [n]).flatMap((x) => typeof x == "string" ? x.split(/\s*,\s*/) : [x]).map(G).filter((x) => x !== void 0), f = Array.from(new Set(a));
366
+ return f.length > 0 ? w.map((x) => x.value).filter((x) => f.includes(x)) : Array.isArray(n) ? [] : [1];
367
+ }, H = (n, e) => {
368
+ const a = n === "time_before" ? "09:00" : "17:00";
369
+ if (y(e)) {
370
+ const f = n === "time_before" ? e.end ?? e.endTime : e.start ?? e.startTime;
371
+ return O(f, a);
372
+ }
373
+ return O(e, a);
374
+ }, E = (n, e) => {
375
+ if (n === "time_between") {
376
+ if (y(e)) {
377
+ const x = O(e.start ?? e.startTime, "09:00");
378
+ return {
379
+ start: x,
380
+ end: O(e.end ?? e.endTime, b(x))
381
+ };
382
+ }
383
+ const a = $(e), f = O(a[0] || e, "09:00");
384
+ return {
385
+ start: f,
386
+ end: O(a[1], b(f))
387
+ };
388
+ }
389
+ if (n === "day_of_week")
390
+ return P(e);
391
+ if (n === "date_range") {
392
+ if (y(e)) {
393
+ const x = k(e.startDate ?? e.start);
394
+ return {
395
+ startDate: x,
396
+ endDate: k(e.endDate ?? e.end) || x
397
+ };
398
+ }
399
+ const a = $(e), f = k(a[0]);
400
+ return {
401
+ startDate: f,
402
+ endDate: k(a[1]) || f
403
+ };
404
+ }
405
+ return H(n, e);
406
+ }, _ = (n) => {
407
+ if (!y(n)) return !1;
408
+ const e = k(n.startDate ?? n.start), a = k(n.endDate ?? n.end);
409
+ return !!(e && a && a < e);
410
+ }, Y = (n) => {
411
+ const e = n?.condition, a = C(e) ? e : "time_after";
412
+ return {
413
+ ...n,
414
+ id: String(n?.id || Math.random().toString(36).substr(2, 9)),
415
+ name: n?.name || "",
416
+ condition: a,
417
+ conditionValue: E(a, n?.conditionValue),
418
+ modifier: n?.modifier === "percentage" ? "percentage" : "fixed",
419
+ amount: Number(n?.amount) || 0,
420
+ resourceIds: Array.isArray(n?.resourceIds) ? n.resourceIds : null
421
+ };
422
+ }, re = (n, e) => {
423
+ C(e) && (n.condition = e, n.conditionValue = E(e, n.conditionValue));
424
+ }, { params: ee } = Me(), { hasPermission: ue } = Ne(), { config: W } = ze(), te = Ee(W.project), m = De({
425
+ paymentType: "full",
426
+ currency: "USD",
427
+ partialPayment: {
428
+ type: "percentage",
429
+ amount: 50
430
+ },
431
+ pricingOptions: [
432
+ {
433
+ id: "1",
434
+ name: "Standard Service",
435
+ price: 0,
436
+ duration: 30,
437
+ // Duration in minutes
438
+ isDefault: !0
439
+ }
440
+ ],
441
+ pricingRules: [],
442
+ addOns: []
443
+ }), L = F(!1), ne = F(!0), B = F([]), K = Ie(() => m.pricingRules.some((n) => n.condition === "date_range" && _(n.conditionValue))), oe = (n, e) => P(n.conditionValue).includes(e), me = (n) => {
444
+ const e = P(n);
445
+ return e.length === 0 ? "No days selected" : e.length === w.length ? "Every day" : e.map((a) => w.find((f) => f.value === a)?.label).filter(Boolean).join(", ");
446
+ }, ce = (n, e, a) => {
447
+ const f = P(n.conditionValue);
448
+ if (a === !0) {
449
+ n.conditionValue = P([...f, e]);
450
+ return;
451
+ }
452
+ const v = f.filter((M) => M !== e);
453
+ n.conditionValue = v.length > 0 ? v : f;
454
+ }, pe = (n, e) => {
455
+ if (!n.resourceIds)
456
+ n.resourceIds = [e];
457
+ else {
458
+ const a = n.resourceIds.indexOf(e);
459
+ a === -1 ? n.resourceIds.push(e) : n.resourceIds.splice(a, 1);
460
+ }
461
+ }, se = (n, e) => {
462
+ n.resourceIds = e ? null : [];
463
+ }, fe = async () => {
464
+ if (!K.value) {
465
+ L.value = !0;
466
+ try {
467
+ const n = ee.value.id;
468
+ if (!n) throw new Error("Missing agenda ID");
469
+ await te.update(W.agendaCollection, n, {
470
+ paymentType: m.paymentType || "full",
471
+ currency: m.currency || "USD",
472
+ partialPayment: {
473
+ type: m.partialPayment.type || "percentage",
474
+ amount: Math.max(Number(m.partialPayment.amount) || 0, 0)
475
+ },
476
+ pricingOptions: m.pricingOptions ?? [],
477
+ pricingRules: (m.pricingRules ?? []).map(Y),
478
+ addOns: m.addOns ?? []
479
+ });
480
+ } catch (n) {
481
+ console.error("Error saving changes:", n);
482
+ } finally {
483
+ L.value = !1;
484
+ }
485
+ }
486
+ }, ge = () => {
487
+ const n = Math.random().toString(36).substr(2, 9);
488
+ m.pricingOptions.push({
489
+ id: n,
490
+ name: "",
491
+ price: 0,
492
+ duration: 30,
493
+ // Default 30 minutes
494
+ isDefault: !1
495
+ });
496
+ }, xe = (n) => {
497
+ m.pricingOptions = m.pricingOptions.filter((e) => e.id !== n);
498
+ }, ye = (n) => {
499
+ m.pricingOptions.forEach((e) => {
500
+ e.isDefault = e.id === n;
501
+ });
502
+ }, ve = () => {
503
+ const n = Math.random().toString(36).substr(2, 9);
504
+ m.pricingRules.push(Y({
505
+ id: n,
506
+ name: "",
507
+ condition: "time_after",
508
+ // time_after, time_before, day_of_week, etc.
509
+ conditionValue: "17:00",
510
+ modifier: "fixed",
511
+ // 'fixed' or 'percentage'
512
+ amount: 10,
513
+ resourceIds: null
514
+ // null = all resources
515
+ }));
516
+ }, be = (n) => {
517
+ m.pricingRules = m.pricingRules.filter((e) => e.id !== n);
518
+ };
519
+ return (async () => {
520
+ try {
521
+ const n = await te.get(W.agendaCollection, ee.value.id);
522
+ n && (m.paymentType = n.paymentType || "full", m.currency = n.currency || "USD", m.partialPayment = {
523
+ type: n.partialPayment?.type || "percentage",
524
+ amount: Number(n.partialPayment?.amount) && n.partialPayment.amount > 0 ? parseFloat(n.partialPayment.amount) : 50
525
+ }, m.pricingOptions = n.pricingOptions || [{
526
+ id: "1",
527
+ name: "Standard Service",
528
+ price: 0,
529
+ duration: 30,
530
+ isDefault: !0
531
+ }], m.pricingRules = (n.pricingRules || []).map(Y), m.addOns = n.addOns || [], B.value = (n.resources || []).filter((e) => e.isActive));
532
+ } catch (n) {
533
+ console.error("Error loading agenda data:", n);
534
+ } finally {
535
+ ne.value = !1;
536
+ }
537
+ })(), Te("form", m), (n, e) => {
538
+ const a = p("Label"), f = p("SelectValue"), x = p("SelectTrigger"), v = p("SelectItem"), M = p("SelectContent"), j = p("Select"), R = p("Button"), A = p("Input"), _e = p("Checkbox"), Ve = p("PopoverTrigger"), ke = p("PopoverContent"), Se = p("Popover"), z = p("RadioGroupItem"), le = p("RadioGroup");
539
+ return u(), Q(Ae, null, {
540
+ default: s(() => [
541
+ V(ue)("manage-payment") ? (u(), c("div", ut, [
542
+ e[53] || (e[53] = o("h1", { class: "text-lg font-medium mb-8" }, "Payment Settings", -1)),
543
+ ne.value ? I("", !0) : (u(), c("div", mt, [
544
+ o("div", null, [
545
+ o("div", ct, [
546
+ o("div", pt, [
547
+ t(a, { class: "text-base font-medium mb-2" }, {
548
+ default: s(() => [...e[4] || (e[4] = [
549
+ d(" Currency ", -1)
550
+ ])]),
551
+ _: 1
552
+ }),
553
+ t(j, {
554
+ modelValue: m.currency,
555
+ "onUpdate:modelValue": e[0] || (e[0] = (l) => m.currency = l)
556
+ }, {
557
+ default: s(() => [
558
+ t(x, { id: "currency" }, {
559
+ default: s(() => [
560
+ t(f, { placeholder: "Currency" })
561
+ ]),
562
+ _: 1
563
+ }),
564
+ t(M, null, {
565
+ default: s(() => [
566
+ t(v, { value: "USD" }, {
567
+ default: s(() => [...e[5] || (e[5] = [
568
+ d("USD ($)", -1)
569
+ ])]),
570
+ _: 1
571
+ }),
572
+ t(v, { value: "EUR" }, {
573
+ default: s(() => [...e[6] || (e[6] = [
574
+ d("EUR (€)", -1)
575
+ ])]),
576
+ _: 1
577
+ }),
578
+ t(v, { value: "GBP" }, {
579
+ default: s(() => [...e[7] || (e[7] = [
580
+ d("GBP (£)", -1)
581
+ ])]),
582
+ _: 1
583
+ }),
584
+ t(v, { value: "CAD" }, {
585
+ default: s(() => [...e[8] || (e[8] = [
586
+ d("CAD ($)", -1)
587
+ ])]),
588
+ _: 1
589
+ })
590
+ ]),
591
+ _: 1
592
+ })
593
+ ]),
594
+ _: 1
595
+ }, 8, ["modelValue"])
596
+ ])
597
+ ])
598
+ ]),
599
+ o("div", null, [
600
+ o("div", ft, [
601
+ o("div", null, [
602
+ t(a, { class: "text-base font-medium" }, {
603
+ default: s(() => [...e[9] || (e[9] = [
604
+ d(" Service Pricing Options ", -1)
605
+ ])]),
606
+ _: 1
607
+ }),
608
+ e[10] || (e[10] = o("p", { class: "text-sm text-muted-foreground mt-1" }, " Offer multiple service variations with different prices (e.g., haircut styles, massage types). ", -1))
609
+ ]),
610
+ t(R, {
611
+ onClick: ge,
612
+ variant: "outline",
613
+ size: "sm"
614
+ }, {
615
+ default: s(() => [
616
+ t(V(X), { class: "w-4 h-4 mr-2" }),
617
+ e[11] || (e[11] = d(" Add Option ", -1))
618
+ ]),
619
+ _: 1
620
+ })
621
+ ]),
622
+ o("div", gt, [
623
+ (u(!0), c(D, null, N(m.pricingOptions, (l) => (u(), c("div", {
624
+ key: l.id,
625
+ class: "flex gap-3 items-start p-4 border rounded-lg"
626
+ }, [
627
+ o("div", xt, [
628
+ o("div", null, [
629
+ t(a, { class: "text-xs mb-1 block" }, {
630
+ default: s(() => [...e[12] || (e[12] = [
631
+ d("Service Name", -1)
632
+ ])]),
633
+ _: 1
634
+ }),
635
+ t(A, {
636
+ modelValue: l.name,
637
+ "onUpdate:modelValue": (r) => l.name = r,
638
+ placeholder: "e.g., Men's Haircut, Women's Haircut"
639
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])
640
+ ]),
641
+ o("div", yt, [
642
+ o("div", vt, [
643
+ t(a, { class: "text-xs mb-1 block" }, {
644
+ default: s(() => [...e[13] || (e[13] = [
645
+ d("Price", -1)
646
+ ])]),
647
+ _: 1
648
+ }),
649
+ t(A, {
650
+ modelValue: l.price,
651
+ "onUpdate:modelValue": (r) => l.price = r,
652
+ modelModifiers: { number: !0 },
653
+ type: "number",
654
+ min: "0",
655
+ step: "0.01",
656
+ placeholder: "0.00",
657
+ class: "no-spinner"
658
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])
659
+ ]),
660
+ o("div", bt, [
661
+ t(a, { class: "text-xs mb-1 block" }, {
662
+ default: s(() => [...e[14] || (e[14] = [
663
+ d("Duration", -1)
664
+ ])]),
665
+ _: 1
666
+ }),
667
+ t(j, {
668
+ modelValue: l.duration,
669
+ "onUpdate:modelValue": (r) => l.duration = r,
670
+ modelModifiers: { number: !0 }
671
+ }, {
672
+ default: s(() => [
673
+ t(x, null, {
674
+ default: s(() => [
675
+ t(f, { placeholder: "Duration" })
676
+ ]),
677
+ _: 1
678
+ }),
679
+ t(M, null, {
680
+ default: s(() => [
681
+ t(v, { value: 15 }, {
682
+ default: s(() => [...e[15] || (e[15] = [
683
+ d("15 min", -1)
684
+ ])]),
685
+ _: 1
686
+ }),
687
+ t(v, { value: 30 }, {
688
+ default: s(() => [...e[16] || (e[16] = [
689
+ d("30 min", -1)
690
+ ])]),
691
+ _: 1
692
+ }),
693
+ t(v, { value: 45 }, {
694
+ default: s(() => [...e[17] || (e[17] = [
695
+ d("45 min", -1)
696
+ ])]),
697
+ _: 1
698
+ }),
699
+ t(v, { value: 60 }, {
700
+ default: s(() => [...e[18] || (e[18] = [
701
+ d("1 hour", -1)
702
+ ])]),
703
+ _: 1
704
+ }),
705
+ t(v, { value: 90 }, {
706
+ default: s(() => [...e[19] || (e[19] = [
707
+ d("1.5 hours", -1)
708
+ ])]),
709
+ _: 1
710
+ }),
711
+ t(v, { value: 120 }, {
712
+ default: s(() => [...e[20] || (e[20] = [
713
+ d("2 hours", -1)
714
+ ])]),
715
+ _: 1
716
+ }),
717
+ t(v, { value: 180 }, {
718
+ default: s(() => [...e[21] || (e[21] = [
719
+ d("3 hours", -1)
720
+ ])]),
721
+ _: 1
722
+ }),
723
+ t(v, { value: 240 }, {
724
+ default: s(() => [...e[22] || (e[22] = [
725
+ d("4 hours", -1)
726
+ ])]),
727
+ _: 1
728
+ }),
729
+ t(v, { value: 300 }, {
730
+ default: s(() => [...e[23] || (e[23] = [
731
+ d("5 hours", -1)
732
+ ])]),
733
+ _: 1
734
+ }),
735
+ t(v, { value: 360 }, {
736
+ default: s(() => [...e[24] || (e[24] = [
737
+ d("6 hours", -1)
738
+ ])]),
739
+ _: 1
740
+ }),
741
+ t(v, { value: 480 }, {
742
+ default: s(() => [...e[25] || (e[25] = [
743
+ d("8 hours", -1)
744
+ ])]),
745
+ _: 1
746
+ })
747
+ ]),
748
+ _: 1
749
+ })
750
+ ]),
751
+ _: 1
752
+ }, 8, ["modelValue", "onUpdate:modelValue"])
753
+ ]),
754
+ o("div", _t, [
755
+ t(R, {
756
+ onClick: (r) => ye(l.id),
757
+ variant: l.isDefault ? "default" : "outline",
758
+ size: "sm"
759
+ }, {
760
+ default: s(() => [
761
+ d(S(l.isDefault ? "Default" : "Set Default"), 1)
762
+ ]),
763
+ _: 2
764
+ }, 1032, ["onClick", "variant"])
765
+ ])
766
+ ])
767
+ ]),
768
+ m.pricingOptions.length > 1 ? (u(), Q(R, {
769
+ key: 0,
770
+ onClick: (r) => xe(l.id),
771
+ variant: "ghost",
772
+ size: "icon",
773
+ class: "mt-6"
774
+ }, {
775
+ default: s(() => [
776
+ t(V(J), { class: "w-4 h-4 text-destructive" })
777
+ ]),
778
+ _: 1
779
+ }, 8, ["onClick"])) : I("", !0)
780
+ ]))), 128))
781
+ ])
782
+ ]),
783
+ o("div", null, [
784
+ o("div", Vt, [
785
+ o("div", null, [
786
+ t(a, { class: "text-base font-medium" }, {
787
+ default: s(() => [...e[26] || (e[26] = [
788
+ d(" Conditional Pricing Rules ", -1)
789
+ ])]),
790
+ _: 1
791
+ }),
792
+ e[27] || (e[27] = o("p", { class: "text-sm text-muted-foreground mt-1" }, " Add extra fees based on time, day, or other conditions (e.g., +€10 after 5pm). ", -1))
793
+ ]),
794
+ t(R, {
795
+ onClick: ve,
796
+ variant: "outline",
797
+ size: "sm"
798
+ }, {
799
+ default: s(() => [
800
+ t(V(X), { class: "w-4 h-4 mr-2" }),
801
+ e[28] || (e[28] = d(" Add Rule ", -1))
802
+ ]),
803
+ _: 1
804
+ })
805
+ ]),
806
+ o("div", kt, [
807
+ (u(!0), c(D, null, N(m.pricingRules, (l) => (u(), c("div", {
808
+ key: l.id,
809
+ class: "flex gap-3 items-start p-4 border rounded-lg"
810
+ }, [
811
+ o("div", St, [
812
+ o("div", null, [
813
+ t(a, { class: "text-xs mb-1 block" }, {
814
+ default: s(() => [...e[29] || (e[29] = [
815
+ d("Rule Name", -1)
816
+ ])]),
817
+ _: 1
818
+ }),
819
+ t(A, {
820
+ modelValue: l.name,
821
+ "onUpdate:modelValue": (r) => l.name = r,
822
+ placeholder: "e.g., After Hours Fee, Weekend Surcharge"
823
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])
824
+ ]),
825
+ o("div", Ct, [
826
+ o("div", null, [
827
+ t(a, { class: "text-xs mb-1 block" }, {
828
+ default: s(() => [...e[30] || (e[30] = [
829
+ d("Condition", -1)
830
+ ])]),
831
+ _: 1
832
+ }),
833
+ t(j, {
834
+ "model-value": l.condition,
835
+ "onUpdate:modelValue": (r) => re(l, r)
836
+ }, {
837
+ default: s(() => [
838
+ t(x, null, {
839
+ default: s(() => [
840
+ t(f, { placeholder: "Select condition" })
841
+ ]),
842
+ _: 1
843
+ }),
844
+ t(M, null, {
845
+ default: s(() => [
846
+ (u(), c(D, null, N(T, (r) => t(v, {
847
+ key: r.value,
848
+ value: r.value
849
+ }, {
850
+ default: s(() => [
851
+ d(S(r.label), 1)
852
+ ]),
853
+ _: 2
854
+ }, 1032, ["value"])), 64))
855
+ ]),
856
+ _: 1
857
+ })
858
+ ]),
859
+ _: 1
860
+ }, 8, ["model-value", "onUpdate:modelValue"])
861
+ ]),
862
+ o("div", {
863
+ class: U({ "sm:col-span-2": l.condition === "time_between" || l.condition === "date_range" || l.condition === "day_of_week" })
864
+ }, [
865
+ t(a, { class: "text-xs mb-1 block" }, {
866
+ default: s(() => [
867
+ l.condition === "time_between" ? (u(), c(D, { key: 0 }, [
868
+ d("Hours")
869
+ ], 64)) : l.condition === "day_of_week" ? (u(), c(D, { key: 1 }, [
870
+ d("Days")
871
+ ], 64)) : l.condition === "date_range" ? (u(), c(D, { key: 2 }, [
872
+ d("Date Range")
873
+ ], 64)) : (u(), c(D, { key: 3 }, [
874
+ d("Hour")
875
+ ], 64))
876
+ ]),
877
+ _: 2
878
+ }, 1024),
879
+ l.condition === "time_between" ? (u(), c("div", wt, [
880
+ o("div", null, [
881
+ t(a, { class: "text-xs mb-1 block text-muted-foreground" }, {
882
+ default: s(() => [...e[31] || (e[31] = [
883
+ d("Start hour", -1)
884
+ ])]),
885
+ _: 1
886
+ }),
887
+ t(A, {
888
+ modelValue: l.conditionValue.start,
889
+ "onUpdate:modelValue": (r) => l.conditionValue.start = r,
890
+ type: "time"
891
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])
892
+ ]),
893
+ o("div", null, [
894
+ t(a, { class: "text-xs mb-1 block text-muted-foreground" }, {
895
+ default: s(() => [...e[32] || (e[32] = [
896
+ d("End hour", -1)
897
+ ])]),
898
+ _: 1
899
+ }),
900
+ t(A, {
901
+ modelValue: l.conditionValue.end,
902
+ "onUpdate:modelValue": (r) => l.conditionValue.end = r,
903
+ type: "time"
904
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])
905
+ ])
906
+ ])) : l.condition === "day_of_week" ? (u(), c("div", Ot, [
907
+ o("div", Dt, [
908
+ (u(), c(D, null, N(w, (r) => o("div", {
909
+ key: r.value,
910
+ class: U(["flex items-center gap-2 rounded-md border p-2 transition-colors", oe(l, r.value) ? "border-primary bg-primary/5" : "border-border"])
911
+ }, [
912
+ t(_e, {
913
+ id: `pricing-rule-${l.id}-day-${r.value}`,
914
+ "model-value": oe(l, r.value),
915
+ "onUpdate:modelValue": (ae) => ce(l, r.value, ae)
916
+ }, null, 8, ["id", "model-value", "onUpdate:modelValue"]),
917
+ t(a, {
918
+ for: `pricing-rule-${l.id}-day-${r.value}`,
919
+ class: "text-sm font-normal cursor-pointer flex-1"
920
+ }, {
921
+ default: s(() => [
922
+ d(S(r.label), 1)
923
+ ]),
924
+ _: 2
925
+ }, 1032, ["for"])
926
+ ], 2)), 64))
927
+ ]),
928
+ o("p", It, S(me(l.conditionValue)), 1)
929
+ ])) : l.condition === "date_range" ? (u(), c("div", Tt, [
930
+ o("div", null, [
931
+ t(a, { class: "text-xs mb-1 block text-muted-foreground" }, {
932
+ default: s(() => [...e[33] || (e[33] = [
933
+ d("Start date", -1)
934
+ ])]),
935
+ _: 1
936
+ }),
937
+ t(A, {
938
+ modelValue: l.conditionValue.startDate,
939
+ "onUpdate:modelValue": (r) => l.conditionValue.startDate = r,
940
+ type: "date"
941
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])
942
+ ]),
943
+ o("div", null, [
944
+ t(a, { class: "text-xs mb-1 block text-muted-foreground" }, {
945
+ default: s(() => [...e[34] || (e[34] = [
946
+ d("End date", -1)
947
+ ])]),
948
+ _: 1
949
+ }),
950
+ t(A, {
951
+ modelValue: l.conditionValue.endDate,
952
+ "onUpdate:modelValue": (r) => l.conditionValue.endDate = r,
953
+ type: "date",
954
+ min: l.conditionValue.startDate || void 0,
955
+ class: U({ "border-amber-500 focus-visible:ring-amber-500": _(l.conditionValue) })
956
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "min", "class"])
957
+ ]),
958
+ _(l.conditionValue) ? (u(), c("p", ht, [
959
+ t(V(de), { class: "size-3.5 shrink-0 mt-0.5" }),
960
+ e[35] || (e[35] = o("span", null, "End date must be on or after the start date.", -1))
961
+ ])) : I("", !0)
962
+ ])) : (u(), Q(A, {
963
+ key: 3,
964
+ modelValue: l.conditionValue,
965
+ "onUpdate:modelValue": (r) => l.conditionValue = r,
966
+ type: "time",
967
+ placeholder: "e.g., 17:00"
968
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]))
969
+ ], 2)
970
+ ]),
971
+ o("div", At, [
972
+ o("div", null, [
973
+ t(a, { class: "text-xs mb-1 block" }, {
974
+ default: s(() => [...e[36] || (e[36] = [
975
+ d("Fee Type", -1)
976
+ ])]),
977
+ _: 1
978
+ }),
979
+ t(j, {
980
+ modelValue: l.modifier,
981
+ "onUpdate:modelValue": (r) => l.modifier = r
982
+ }, {
983
+ default: s(() => [
984
+ t(x, null, {
985
+ default: s(() => [
986
+ t(f, { placeholder: "Select type" })
987
+ ]),
988
+ _: 1
989
+ }),
990
+ t(M, null, {
991
+ default: s(() => [
992
+ t(v, { value: "fixed" }, {
993
+ default: s(() => [...e[37] || (e[37] = [
994
+ d("Fixed Amount", -1)
995
+ ])]),
996
+ _: 1
997
+ }),
998
+ t(v, { value: "percentage" }, {
999
+ default: s(() => [...e[38] || (e[38] = [
1000
+ d("Percentage", -1)
1001
+ ])]),
1002
+ _: 1
1003
+ })
1004
+ ]),
1005
+ _: 1
1006
+ })
1007
+ ]),
1008
+ _: 1
1009
+ }, 8, ["modelValue", "onUpdate:modelValue"])
1010
+ ]),
1011
+ o("div", null, [
1012
+ t(a, { class: "text-xs mb-1 block" }, {
1013
+ default: s(() => [...e[39] || (e[39] = [
1014
+ d("Amount", -1)
1015
+ ])]),
1016
+ _: 1
1017
+ }),
1018
+ t(A, {
1019
+ modelValue: l.amount,
1020
+ "onUpdate:modelValue": (r) => l.amount = r,
1021
+ modelModifiers: { number: !0 },
1022
+ type: "number",
1023
+ min: "0",
1024
+ step: "0.01",
1025
+ class: "no-spinner",
1026
+ placeholder: l.modifier === "percentage" ? "10 (%)" : "10.00"
1027
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])
1028
+ ])
1029
+ ]),
1030
+ B.value.length > 0 ? (u(), c("div", Pt, [
1031
+ t(a, { class: "text-xs mb-1 block" }, {
1032
+ default: s(() => [...e[40] || (e[40] = [
1033
+ d("Apply To Resources", -1)
1034
+ ])]),
1035
+ _: 1
1036
+ }),
1037
+ t(Se, null, {
1038
+ default: s(() => [
1039
+ t(Ve, { "as-child": "" }, {
1040
+ default: s(() => [
1041
+ t(R, {
1042
+ variant: "outline",
1043
+ class: "w-full justify-between font-normal"
1044
+ }, {
1045
+ default: s(() => [
1046
+ o("div", Rt, [
1047
+ t(V(ie), { class: "w-4 h-4 text-muted-foreground" }),
1048
+ !l.resourceIds || l.resourceIds.length === 0 ? (u(), c("span", Ut, "All Resources")) : l.resourceIds.length === 1 ? (u(), c("span", $t, S(B.value.find((r) => r.id === l.resourceIds[0])?.name || "1 resource"), 1)) : (u(), c("span", Mt, S(l.resourceIds.length) + " resources", 1))
1049
+ ]),
1050
+ t(V(Ue), { class: "w-4 h-4 opacity-50" })
1051
+ ]),
1052
+ _: 2
1053
+ }, 1024)
1054
+ ]),
1055
+ _: 2
1056
+ }, 1024),
1057
+ t(ke, {
1058
+ class: "w-64 p-2",
1059
+ align: "start"
1060
+ }, {
1061
+ default: s(() => [
1062
+ o("div", Nt, [
1063
+ o("div", {
1064
+ class: U(["flex items-center gap-2 p-2 rounded-md hover:bg-muted cursor-pointer transition-colors", { "bg-muted": !l.resourceIds || l.resourceIds.length === 0 }]),
1065
+ onClick: (r) => se(l, !0)
1066
+ }, [
1067
+ o("div", Et, [
1068
+ t(V(ie), { class: "w-3 h-3 text-muted-foreground" })
1069
+ ]),
1070
+ e[41] || (e[41] = o("span", { class: "text-sm flex-1" }, "All Resources", -1)),
1071
+ o("div", {
1072
+ class: U(["size-4 rounded-full border-2", !l.resourceIds || l.resourceIds.length === 0 ? "border-primary bg-primary" : "border-muted-foreground"])
1073
+ }, [
1074
+ !l.resourceIds || l.resourceIds.length === 0 ? (u(), c("div", Lt)) : I("", !0)
1075
+ ], 2)
1076
+ ], 10, zt),
1077
+ e[43] || (e[43] = o("div", { class: "border-t my-2" }, null, -1)),
1078
+ (u(!0), c(D, null, N(B.value, (r) => (u(), c("div", {
1079
+ key: r.id,
1080
+ class: "flex items-center gap-2 p-2 rounded-md hover:bg-muted cursor-pointer transition-colors",
1081
+ onClick: (ae) => {
1082
+ se(l, !1), pe(l, r.id);
1083
+ }
1084
+ }, [
1085
+ o("div", {
1086
+ class: "size-5 rounded-full flex items-center justify-center text-white text-[10px] font-medium",
1087
+ style: he({ backgroundColor: r.color || "#6b7280" })
1088
+ }, S(r.avatarLabel || r.name.charAt(0).toUpperCase()), 5),
1089
+ o("span", jt, S(r.name), 1),
1090
+ o("div", {
1091
+ class: U(["size-4 rounded border-2 flex items-center justify-center", l.resourceIds?.includes(r.id) ? "border-primary bg-primary" : "border-muted-foreground"])
1092
+ }, [
1093
+ l.resourceIds?.includes(r.id) ? (u(), c("svg", Ft, [...e[42] || (e[42] = [
1094
+ o("path", {
1095
+ "stroke-linecap": "round",
1096
+ "stroke-linejoin": "round",
1097
+ "stroke-width": "3",
1098
+ d: "M5 13l4 4L19 7"
1099
+ }, null, -1)
1100
+ ])])) : I("", !0)
1101
+ ], 2)
1102
+ ], 8, Bt))), 128))
1103
+ ])
1104
+ ]),
1105
+ _: 2
1106
+ }, 1024)
1107
+ ]),
1108
+ _: 2
1109
+ }, 1024)
1110
+ ])) : I("", !0)
1111
+ ]),
1112
+ t(R, {
1113
+ onClick: (r) => be(l.id),
1114
+ variant: "ghost",
1115
+ size: "icon",
1116
+ class: "mt-6"
1117
+ }, {
1118
+ default: s(() => [
1119
+ t(V(J), { class: "w-4 h-4 text-destructive" })
1120
+ ]),
1121
+ _: 1
1122
+ }, 8, ["onClick"])
1123
+ ]))), 128)),
1124
+ m.pricingRules.length === 0 ? (u(), c("div", qt, ' No pricing rules configured. Click "Add Rule" to create conditional fees. ')) : I("", !0)
1125
+ ])
1126
+ ]),
1127
+ t(rt),
1128
+ o("div", null, [
1129
+ t(a, { class: "text-base font-medium" }, {
1130
+ default: s(() => [...e[44] || (e[44] = [
1131
+ d(" Payment Preferences ", -1)
1132
+ ])]),
1133
+ _: 1
1134
+ }),
1135
+ e[51] || (e[51] = o("p", { class: "text-sm text-muted-foreground mb-6" }, " Let customers pay full or in part when booking a slot, or pay later. ", -1)),
1136
+ t(le, {
1137
+ modelValue: m.paymentType,
1138
+ "onUpdate:modelValue": e[1] || (e[1] = (l) => m.paymentType = l),
1139
+ class: "flex flex-col gap-4"
1140
+ }, {
1141
+ default: s(() => [
1142
+ t(a, {
1143
+ for: "r1",
1144
+ class: "flex items-start space-x-2 cursor-pointer"
1145
+ }, {
1146
+ default: s(() => [
1147
+ t(z, {
1148
+ id: "r1",
1149
+ value: "full"
1150
+ }),
1151
+ e[45] || (e[45] = o("div", null, [
1152
+ o("p", null, "Pay Full Amount when Booking"),
1153
+ o("p", { class: "text-sm text-muted-foreground mt-1" }, " Your customers are required to complete the payment to confirm their booking. ")
1154
+ ], -1))
1155
+ ]),
1156
+ _: 1
1157
+ }),
1158
+ t(a, {
1159
+ for: "r2",
1160
+ class: "flex items-start space-x-2 cursor-pointer"
1161
+ }, {
1162
+ default: s(() => [
1163
+ t(z, {
1164
+ id: "r2",
1165
+ value: "partial"
1166
+ }),
1167
+ e[46] || (e[46] = o("div", null, [
1168
+ o("p", null, "Pay Part Amount when Booking"),
1169
+ o("p", { class: "text-sm text-muted-foreground mt-1" }, " Your customers are required to pay a deposit to confirm their booking. ")
1170
+ ], -1))
1171
+ ]),
1172
+ _: 1
1173
+ }),
1174
+ t(a, {
1175
+ for: "r3",
1176
+ class: "flex items-start space-x-2 cursor-pointer"
1177
+ }, {
1178
+ default: s(() => [
1179
+ t(z, {
1180
+ id: "r3",
1181
+ value: "later"
1182
+ }),
1183
+ e[47] || (e[47] = o("div", null, [
1184
+ o("p", null, "Pay Later at Appointment"),
1185
+ o("p", { class: "text-sm text-muted-foreground mt-1" }, " Your customers can book now and pay in person at the time of their appointment. ")
1186
+ ], -1))
1187
+ ]),
1188
+ _: 1
1189
+ })
1190
+ ]),
1191
+ _: 1
1192
+ }, 8, ["modelValue"]),
1193
+ m.paymentType === "partial" ? (u(), c("div", Gt, [
1194
+ t(a, { class: "text-sm font-medium mb-4 block" }, {
1195
+ default: s(() => [...e[48] || (e[48] = [
1196
+ d(" Deposit Amount Configuration ", -1)
1197
+ ])]),
1198
+ _: 1
1199
+ }),
1200
+ o("div", Ht, [
1201
+ t(le, {
1202
+ modelValue: m.partialPayment.type,
1203
+ "onUpdate:modelValue": e[2] || (e[2] = (l) => m.partialPayment.type = l),
1204
+ class: "flex gap-4"
1205
+ }, {
1206
+ default: s(() => [
1207
+ t(a, { class: "flex items-center space-x-2 cursor-pointer" }, {
1208
+ default: s(() => [
1209
+ t(z, { value: "percentage" }),
1210
+ e[49] || (e[49] = o("span", null, "Percentage", -1))
1211
+ ]),
1212
+ _: 1
1213
+ }),
1214
+ t(a, { class: "flex items-center space-x-2 cursor-pointer" }, {
1215
+ default: s(() => [
1216
+ t(z, { value: "fixed" }),
1217
+ e[50] || (e[50] = o("span", null, "Fixed Amount", -1))
1218
+ ]),
1219
+ _: 1
1220
+ })
1221
+ ]),
1222
+ _: 1
1223
+ }, 8, ["modelValue"]),
1224
+ o("div", Yt, [
1225
+ o("div", Wt, [
1226
+ t(A, {
1227
+ modelValue: m.partialPayment.amount,
1228
+ "onUpdate:modelValue": e[3] || (e[3] = (l) => m.partialPayment.amount = l),
1229
+ modelModifiers: { number: !0 },
1230
+ type: "number",
1231
+ min: "0",
1232
+ max: m.partialPayment.type === "percentage" ? 100 : void 0,
1233
+ step: "0.01",
1234
+ placeholder: m.partialPayment.type === "percentage" ? "50" : "10.00",
1235
+ class: "no-spinner"
1236
+ }, null, 8, ["modelValue", "max", "placeholder"])
1237
+ ]),
1238
+ o("span", Kt, S(m.partialPayment.type === "percentage" ? "%" : m.currency), 1)
1239
+ ]),
1240
+ o("p", Qt, [
1241
+ m.partialPayment.type === "percentage" ? (u(), c(D, { key: 0 }, [
1242
+ d(" Customers will pay " + S(m.partialPayment.amount) + "% of the total price upfront. ", 1)
1243
+ ], 64)) : (u(), c(D, { key: 1 }, [
1244
+ d(" Customers will pay " + S(m.currency) + " " + S(m.partialPayment.amount) + " upfront. ", 1)
1245
+ ], 64))
1246
+ ])
1247
+ ])
1248
+ ])) : I("", !0)
1249
+ ]),
1250
+ o("div", Jt, [
1251
+ K.value ? (u(), c("p", Xt, [
1252
+ t(V(de), { class: "size-3.5 shrink-0 mt-0.5" }),
1253
+ e[52] || (e[52] = o("span", null, "Fix invalid date ranges before saving.", -1))
1254
+ ])) : I("", !0),
1255
+ t(R, {
1256
+ onClick: fe,
1257
+ disabled: L.value || K.value
1258
+ }, {
1259
+ default: s(() => [
1260
+ d(S(L.value ? "Saving..." : "Save Changes"), 1)
1261
+ ]),
1262
+ _: 1
1263
+ }, 8, ["disabled"])
1264
+ ])
1265
+ ]))
1266
+ ])) : (u(), c("div", Zt, [...e[54] || (e[54] = [
1267
+ o("h1", { class: "text-lg font-medium mb-2" }, "Access Denied", -1),
1268
+ o("p", { class: "text-sm text-muted-foreground" }, "You do not have permission to view or edit payment settings.", -1)
1269
+ ])]))
1270
+ ]),
1271
+ _: 1
1272
+ });
1273
+ };
1274
+ }
1275
+ });
1276
+ export {
1277
+ an as default
1278
+ };