@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,651 @@
1
+ import { defineComponent as ne, ref as I, reactive as ce, computed as te, resolveComponent as u, openBlock as l, createBlock as y, withCtx as r, createVNode as n, createTextVNode as c, toDisplayString as w, createElementVNode as s, unref as p, createElementBlock as a, Fragment as h, normalizeClass as k, createCommentVNode as g, renderList as B, normalizeStyle as re } from "vue";
2
+ import { _ as me } from "./EditLayout.vue_vue_type_script_setup_true_lang-pDO9b4Pv.mjs";
3
+ import { e as ae, a as R, $ as C, d as N } from "./DateFormatter-qbhRYxI_.mjs";
4
+ import { Calendar as se, Users as le, BanIcon as de, Trash2 as ie, Plus as ue, CalendarPlus as pe } from "lucide-vue-next";
5
+ import { useModuleRoute as fe, useModulePermissions as ve, useModule as ge, useFirebaseIntegration as xe } from "@oneclick.dev/cms-kit";
6
+ const ye = { class: "space-y-6 py-4" }, _e = { key: 0 }, be = { class: "space-y-2" }, Ce = { class: "flex items-center justify-center w-8 h-8 rounded-full bg-muted" }, ke = {
7
+ key: 0,
8
+ class: "w-full h-full rounded-full bg-white scale-50"
9
+ }, he = { class: "flex items-center justify-center w-8 h-8 rounded-full bg-muted" }, De = {
10
+ key: 0,
11
+ class: "w-full h-full rounded-full bg-white scale-50"
12
+ }, we = {
13
+ key: 0,
14
+ class: "pl-4 pt-2 space-y-1"
15
+ }, Ee = ["onClick"], $e = { class: "min-w-0 flex-1" }, Ie = { class: "text-sm font-medium truncate" }, Se = {
16
+ key: 0,
17
+ class: "w-3 h-3 text-white",
18
+ fill: "none",
19
+ viewBox: "0 0 24 24",
20
+ stroke: "currentColor"
21
+ }, Te = {
22
+ key: 0,
23
+ class: "text-xs text-amber-600 mt-2"
24
+ }, Ae = { class: "space-y-3" }, Re = { class: "flex items-center justify-center w-10 h-10 rounded-full bg-destructive/10" }, Ue = {
25
+ key: 0,
26
+ class: "w-full h-full rounded-full bg-white scale-50"
27
+ }, Ve = { class: "flex items-center justify-center w-10 h-10 rounded-full bg-primary/10" }, Pe = {
28
+ key: 0,
29
+ class: "w-full h-full rounded-full bg-white scale-50"
30
+ }, ze = { key: 1 }, je = {
31
+ key: 0,
32
+ class: "text-center py-6 text-muted-foreground text-sm"
33
+ }, Be = {
34
+ key: 1,
35
+ class: "space-y-2 mb-3"
36
+ }, Ne = { class: "w-full flex justify-between items-center" }, Fe = { class: "flex items-center gap-2 ml-auto" }, Le = /* @__PURE__ */ ne({
37
+ __name: "ExceptionDialog",
38
+ props: {
39
+ resources: {}
40
+ },
41
+ emits: ["add-exception", "update-exception", "remove-exception"],
42
+ setup(oe, { expose: U, emit: F }) {
43
+ const V = new ae("en-US", {
44
+ dateStyle: "medium"
45
+ }), S = oe, T = F, f = I(!1), E = I("add"), A = I(!1), m = I({
46
+ start: R(C()),
47
+ end: R(C())
48
+ }), t = ce({
49
+ id: "",
50
+ startDate: "",
51
+ endDate: "",
52
+ isClosed: !1,
53
+ timeslots: [],
54
+ resourceIds: null
55
+ // null = all resources
56
+ }), _ = te({
57
+ get: () => t.resourceIds === null,
58
+ set: (d) => {
59
+ d ? t.resourceIds = null : t.resourceIds = [];
60
+ }
61
+ }), Y = (d) => {
62
+ if (t.resourceIds === null)
63
+ t.resourceIds = [d];
64
+ else {
65
+ const e = t.resourceIds.indexOf(d);
66
+ e === -1 ? t.resourceIds.push(d) : t.resourceIds.splice(e, 1);
67
+ }
68
+ }, L = te(() => !(!m.value.start || t.resourceIds !== null && t.resourceIds.length === 0)), J = (d) => {
69
+ E.value = d ? "edit" : "add", d ? (t.id = d.id, t.startDate = d.startDate, t.endDate = d.endDate, t.isClosed = d.isClosed, t.timeslots = JSON.parse(JSON.stringify(d.timeslots)), t.resourceIds = d.resourceIds ? [...d.resourceIds] : null, m.value = {
70
+ start: N(d.startDate),
71
+ end: N(d.endDate)
72
+ }) : (t.id = "", t.startDate = "", t.endDate = "", t.isClosed = !1, t.timeslots = [], t.resourceIds = null, m.value = {
73
+ start: R(C()),
74
+ end: R(C())
75
+ }), f.value = !0;
76
+ }, q = () => {
77
+ f.value = !1;
78
+ }, M = () => {
79
+ t.timeslots.push({
80
+ id: Date.now(),
81
+ startTime: "",
82
+ endTime: ""
83
+ });
84
+ }, H = (d) => {
85
+ t.timeslots = t.timeslots.filter((e) => e.id !== d);
86
+ }, G = () => {
87
+ if (!m.value.start) return;
88
+ const d = m.value.start.toString(), e = m.value.end?.toString() || d, o = {
89
+ id: Date.now().toString(),
90
+ startDate: d,
91
+ endDate: e,
92
+ isClosed: t.isClosed,
93
+ timeslots: t.isClosed ? [] : [...t.timeslots],
94
+ resourceIds: t.resourceIds
95
+ };
96
+ T("add-exception", o), f.value = !1;
97
+ }, P = () => {
98
+ const d = m.value.start.toString(), e = m.value.end?.toString() || d, o = {
99
+ id: t.id,
100
+ startDate: d,
101
+ endDate: e,
102
+ isClosed: t.isClosed,
103
+ timeslots: t.isClosed ? [] : [...t.timeslots],
104
+ resourceIds: t.resourceIds
105
+ };
106
+ T("update-exception", o), f.value = !1;
107
+ }, z = () => {
108
+ T("remove-exception", t.id), f.value = !1;
109
+ };
110
+ return U({
111
+ openDialog: J
112
+ }), (d, e) => {
113
+ const o = u("DialogTitle"), x = u("DialogHeader"), D = u("Label"), $ = u("Button"), K = u("PopoverTrigger"), Q = u("RangeCalendar"), W = u("PopoverContent"), X = u("Popover"), O = u("Input"), Z = u("Card"), ee = u("DialogFooter"), v = u("DialogScrollContent"), b = u("Dialog");
114
+ return l(), y(b, {
115
+ open: f.value,
116
+ "onUpdate:open": e[6] || (e[6] = (i) => f.value = i)
117
+ }, {
118
+ default: r(() => [
119
+ n(v, { class: "sm:max-w-2xl" }, {
120
+ default: r(() => [
121
+ n(x, null, {
122
+ default: r(() => [
123
+ n(o, null, {
124
+ default: r(() => [
125
+ c(w(E.value === "add" ? "Add Exception" : "Edit Exception"), 1)
126
+ ]),
127
+ _: 1
128
+ })
129
+ ]),
130
+ _: 1
131
+ }),
132
+ s("div", ye, [
133
+ s("div", null, [
134
+ n(D, { class: "text-sm font-normal mb-1.5" }, {
135
+ default: r(() => [...e[7] || (e[7] = [
136
+ c("Select Date or Date Range", -1)
137
+ ])]),
138
+ _: 1
139
+ }),
140
+ n(X, {
141
+ open: A.value,
142
+ "onUpdate:open": e[1] || (e[1] = (i) => A.value = i)
143
+ }, {
144
+ default: r(() => [
145
+ n(K, { "as-child": "" }, {
146
+ default: r(() => [
147
+ n($, {
148
+ variant: "outline",
149
+ class: "w-full justify-start text-left font-normal"
150
+ }, {
151
+ default: r(() => [
152
+ n(p(se), { class: "mr-2 h-4 w-4" }),
153
+ m.value.start ? (l(), a(h, { key: 0 }, [
154
+ m.value.end && m.value.start.toString() !== m.value.end.toString() ? (l(), a(h, { key: 0 }, [
155
+ c(w(p(V).format(m.value.start.toDate(p(C)()))) + " - " + w(p(V).format(m.value.end.toDate(p(C)()))), 1)
156
+ ], 64)) : (l(), a(h, { key: 1 }, [
157
+ c(w(p(V).format(m.value.start.toDate(p(C)()))), 1)
158
+ ], 64))
159
+ ], 64)) : (l(), a(h, { key: 1 }, [
160
+ c(" Pick a date ")
161
+ ], 64))
162
+ ]),
163
+ _: 1
164
+ })
165
+ ]),
166
+ _: 1
167
+ }),
168
+ n(W, { class: "w-auto p-0" }, {
169
+ default: r(() => [
170
+ n(Q, {
171
+ modelValue: m.value,
172
+ "onUpdate:modelValue": e[0] || (e[0] = (i) => m.value = i),
173
+ "initial-focus": "",
174
+ "number-of-months": 2,
175
+ "min-value": p(R)(p(C)())
176
+ }, null, 8, ["modelValue", "min-value"])
177
+ ]),
178
+ _: 1
179
+ })
180
+ ]),
181
+ _: 1
182
+ }, 8, ["open"])
183
+ ]),
184
+ S.resources && S.resources.length > 0 ? (l(), a("div", _e, [
185
+ n(D, { class: "text-sm font-normal mb-1.5" }, {
186
+ default: r(() => [...e[8] || (e[8] = [
187
+ c("Apply To", -1)
188
+ ])]),
189
+ _: 1
190
+ }),
191
+ s("div", be, [
192
+ s("div", {
193
+ class: k(["flex items-center gap-3 p-3 border rounded-lg cursor-pointer hover:bg-accent transition-colors", _.value ? "bg-accent border-primary" : ""]),
194
+ onClick: e[2] || (e[2] = (i) => _.value = !0)
195
+ }, [
196
+ s("div", Ce, [
197
+ n(p(le), { class: "h-4 w-4 text-muted-foreground" })
198
+ ]),
199
+ e[9] || (e[9] = s("div", { class: "flex-1" }, [
200
+ s("div", { class: "font-medium text-sm" }, "All Resources"),
201
+ s("div", { class: "text-xs text-muted-foreground" }, "Exception applies to all resources")
202
+ ], -1)),
203
+ s("div", {
204
+ class: k(["w-4 h-4 rounded-full border-2", _.value ? "border-primary bg-primary" : "border-muted-foreground"])
205
+ }, [
206
+ _.value ? (l(), a("div", ke)) : g("", !0)
207
+ ], 2)
208
+ ], 2),
209
+ s("div", {
210
+ class: k(["flex items-center gap-3 p-3 border rounded-lg cursor-pointer hover:bg-accent transition-colors", _.value ? "" : "bg-accent border-primary"]),
211
+ onClick: e[3] || (e[3] = (i) => _.value = !1)
212
+ }, [
213
+ s("div", he, [
214
+ n(p(le), { class: "h-4 w-4 text-muted-foreground" })
215
+ ]),
216
+ e[10] || (e[10] = s("div", { class: "flex-1" }, [
217
+ s("div", { class: "font-medium text-sm" }, "Specific Resources"),
218
+ s("div", { class: "text-xs text-muted-foreground" }, "Select which resources this exception applies to")
219
+ ], -1)),
220
+ s("div", {
221
+ class: k(["w-4 h-4 rounded-full border-2", _.value ? "border-muted-foreground" : "border-primary bg-primary"])
222
+ }, [
223
+ _.value ? g("", !0) : (l(), a("div", De))
224
+ ], 2)
225
+ ], 2),
226
+ _.value ? g("", !0) : (l(), a("div", we, [
227
+ (l(!0), a(h, null, B(S.resources, (i) => (l(), a("div", {
228
+ key: i.id,
229
+ class: k(["flex items-center gap-2 p-2 rounded-md hover:bg-muted cursor-pointer transition-colors", {
230
+ "bg-muted": t.resourceIds?.includes(i.id),
231
+ "opacity-50": t.resourceIds && t.resourceIds.length > 0 && !t.resourceIds.includes(i.id)
232
+ }]),
233
+ onClick: (j) => Y(i.id)
234
+ }, [
235
+ s("div", {
236
+ class: "size-6 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",
237
+ style: re({ backgroundColor: i.color || "#6b7280" })
238
+ }, w(i.avatarLabel || i.name.charAt(0).toUpperCase()), 5),
239
+ s("div", $e, [
240
+ s("div", Ie, w(i.name), 1)
241
+ ]),
242
+ s("div", {
243
+ class: k(["size-4 rounded border-2 flex items-center justify-center flex-shrink-0", t.resourceIds?.includes(i.id) ? "border-primary bg-primary" : "border-muted-foreground"])
244
+ }, [
245
+ t.resourceIds?.includes(i.id) ? (l(), a("svg", Se, [...e[11] || (e[11] = [
246
+ s("path", {
247
+ "stroke-linecap": "round",
248
+ "stroke-linejoin": "round",
249
+ "stroke-width": "3",
250
+ d: "M5 13l4 4L19 7"
251
+ }, null, -1)
252
+ ])])) : g("", !0)
253
+ ], 2)
254
+ ], 10, Ee))), 128)),
255
+ t.resourceIds?.length === 0 ? (l(), a("p", Te, " ⚠️ Please select at least one resource ")) : g("", !0)
256
+ ]))
257
+ ])
258
+ ])) : g("", !0),
259
+ s("div", null, [
260
+ n(D, { class: "text-sm font-normal mb-1.5" }, {
261
+ default: r(() => [...e[12] || (e[12] = [
262
+ c("Exception Type", -1)
263
+ ])]),
264
+ _: 1
265
+ }),
266
+ s("div", Ae, [
267
+ s("div", {
268
+ class: k(["flex items-center gap-3 p-3 border rounded-lg cursor-pointer hover:bg-accent transition-colors", t.isClosed ? "bg-accent border-primary" : ""]),
269
+ onClick: e[4] || (e[4] = (i) => t.isClosed = !0)
270
+ }, [
271
+ s("div", Re, [
272
+ n(p(de), { class: "h-5 w-5 text-destructive" })
273
+ ]),
274
+ e[13] || (e[13] = s("div", { class: "flex-1" }, [
275
+ s("div", { class: "font-medium" }, "Closed"),
276
+ s("div", { class: "text-sm text-muted-foreground" }, "No appointments available during this period")
277
+ ], -1)),
278
+ s("div", {
279
+ class: k(["w-4 h-4 rounded-full border-2", t.isClosed ? "border-primary bg-primary" : "border-muted-foreground"])
280
+ }, [
281
+ t.isClosed ? (l(), a("div", Ue)) : g("", !0)
282
+ ], 2)
283
+ ], 2),
284
+ s("div", {
285
+ class: k(["flex items-center gap-3 p-3 border rounded-lg cursor-pointer hover:bg-accent transition-colors", t.isClosed ? "" : "bg-accent border-primary"]),
286
+ onClick: e[5] || (e[5] = (i) => t.isClosed = !1)
287
+ }, [
288
+ s("div", Ve, [
289
+ n(p(se), { class: "h-5 w-5 text-primary" })
290
+ ]),
291
+ e[14] || (e[14] = s("div", { class: "flex-1" }, [
292
+ s("div", { class: "font-medium" }, "Custom Hours"),
293
+ s("div", { class: "text-sm text-muted-foreground" }, "Set specific time slots for this period")
294
+ ], -1)),
295
+ s("div", {
296
+ class: k(["w-4 h-4 rounded-full border-2", t.isClosed ? "border-muted-foreground" : "border-primary bg-primary"])
297
+ }, [
298
+ t.isClosed ? g("", !0) : (l(), a("div", Pe))
299
+ ], 2)
300
+ ], 2)
301
+ ])
302
+ ]),
303
+ t.isClosed ? g("", !0) : (l(), a("div", ze, [
304
+ n(D, { class: "text-sm font-normal mb-1.5" }, {
305
+ default: r(() => [...e[15] || (e[15] = [
306
+ c("Time Slots", -1)
307
+ ])]),
308
+ _: 1
309
+ }),
310
+ n(Z, { class: "p-4" }, {
311
+ default: r(() => [
312
+ t.timeslots.length === 0 ? (l(), a("div", je, ' No time slots added. Click "Add Time Slot" to create one. ')) : (l(), a("div", Be, [
313
+ (l(!0), a(h, null, B(t.timeslots, (i) => (l(), a("div", {
314
+ key: i.id,
315
+ class: "flex items-center gap-2"
316
+ }, [
317
+ n(O, {
318
+ class: "w-32",
319
+ modelValue: i.startTime,
320
+ "onUpdate:modelValue": (j) => i.startTime = j,
321
+ type: "time"
322
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
323
+ e[16] || (e[16] = s("span", { class: "text-muted-foreground" }, "to", -1)),
324
+ n(O, {
325
+ class: "w-32",
326
+ modelValue: i.endTime,
327
+ "onUpdate:modelValue": (j) => i.endTime = j,
328
+ type: "time"
329
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
330
+ n($, {
331
+ variant: "ghost",
332
+ size: "icon",
333
+ onClick: (j) => H(i.id)
334
+ }, {
335
+ default: r(() => [
336
+ n(p(ie), { class: "size-4" })
337
+ ]),
338
+ _: 1
339
+ }, 8, ["onClick"])
340
+ ]))), 128))
341
+ ])),
342
+ n($, {
343
+ onClick: M,
344
+ variant: "outline",
345
+ size: "sm",
346
+ class: "w-full"
347
+ }, {
348
+ default: r(() => [
349
+ n(p(ue), { class: "size-4 mr-1" }),
350
+ e[17] || (e[17] = c(" Add Time Slot ", -1))
351
+ ]),
352
+ _: 1
353
+ })
354
+ ]),
355
+ _: 1
356
+ })
357
+ ]))
358
+ ]),
359
+ n(ee, { class: "gap-2" }, {
360
+ default: r(() => [
361
+ s("div", Ne, [
362
+ E.value === "edit" ? (l(), y($, {
363
+ key: 0,
364
+ variant: "destructive",
365
+ onClick: z
366
+ }, {
367
+ default: r(() => [...e[18] || (e[18] = [
368
+ c(" Remove Exception ", -1)
369
+ ])]),
370
+ _: 1
371
+ })) : g("", !0),
372
+ s("div", Fe, [
373
+ n($, {
374
+ variant: "outline",
375
+ onClick: q
376
+ }, {
377
+ default: r(() => [...e[19] || (e[19] = [
378
+ c(" Cancel ", -1)
379
+ ])]),
380
+ _: 1
381
+ }),
382
+ E.value === "add" ? (l(), y($, {
383
+ key: 0,
384
+ onClick: G,
385
+ disabled: !L.value
386
+ }, {
387
+ default: r(() => [...e[20] || (e[20] = [
388
+ c(" Add Exception ", -1)
389
+ ])]),
390
+ _: 1
391
+ }, 8, ["disabled"])) : (l(), y($, {
392
+ key: 1,
393
+ onClick: P,
394
+ disabled: !L.value
395
+ }, {
396
+ default: r(() => [...e[21] || (e[21] = [
397
+ c(" Update Exception ", -1)
398
+ ])]),
399
+ _: 1
400
+ }, 8, ["disabled"]))
401
+ ])
402
+ ])
403
+ ]),
404
+ _: 1
405
+ })
406
+ ]),
407
+ _: 1
408
+ })
409
+ ]),
410
+ _: 1
411
+ }, 8, ["open"]);
412
+ };
413
+ }
414
+ }), Me = { key: 0 }, He = { class: "max-w-4xl space-y-6" }, Oe = {
415
+ key: 0,
416
+ class: "flex"
417
+ }, Ye = { key: 1 }, Je = { class: "space-y-3" }, qe = { class: "flex items-start justify-between" }, Ge = { class: "flex-1" }, Ke = { class: "flex items-center gap-2 mb-1" }, Qe = { class: "font-medium" }, We = {
418
+ key: 0,
419
+ class: "flex items-center gap-1.5 ml-6 mb-2"
420
+ }, Xe = ["title"], Ze = { class: "text-sm text-muted-foreground ml-6" }, et = {
421
+ key: 0,
422
+ class: "text-amber-600"
423
+ }, tt = {
424
+ key: 1,
425
+ class: "space-y-1"
426
+ }, st = { class: "flex flex-wrap gap-2" }, ot = { class: "flex gap-1" }, lt = {
427
+ key: 4,
428
+ class: "flex justify-end pt-4 border-t"
429
+ }, nt = { key: 1 }, ct = /* @__PURE__ */ ne({
430
+ __name: "exceptions",
431
+ setup(oe) {
432
+ const U = new ae("en-US", {
433
+ dateStyle: "medium"
434
+ }), { params: F } = fe(), { hasPermission: V } = ve(), { config: S } = ge(), T = xe(S.project), f = I([]), E = I([]), A = I(!1), m = I(!0), t = I(), _ = (e) => !e.resourceIds || e.resourceIds.length === 0 ? null : E.value.filter((o) => e.resourceIds?.includes(o.id)), Y = async () => {
435
+ try {
436
+ m.value = !0;
437
+ const e = await T.get(S.agendaCollection, F.value.id);
438
+ f.value = e.exceptions || [], E.value = (e.resources || []).filter((o) => o.isActive);
439
+ } catch (e) {
440
+ console.error("Error loading exceptions:", e);
441
+ } finally {
442
+ m.value = !1;
443
+ }
444
+ }, L = (e, o) => {
445
+ const x = N(e), D = N(o);
446
+ return e === o ? U.format(x.toDate(C())) : `${U.format(x.toDate(C()))} - ${U.format(D.toDate(C()))}`;
447
+ }, J = (e) => {
448
+ f.value.push(e), P();
449
+ }, q = (e) => {
450
+ const o = f.value.findIndex((x) => x.id === e.id);
451
+ o !== -1 && (f.value[o] = e), P();
452
+ }, M = (e) => {
453
+ f.value = f.value.filter((o) => o.id !== e), P();
454
+ }, H = () => {
455
+ t.value?.openDialog();
456
+ }, G = (e) => {
457
+ t.value?.openDialog(e);
458
+ }, P = async () => {
459
+ A.value = !0, await T.update(S.agendaCollection, F.value.id, {
460
+ exceptions: f.value
461
+ }), A.value = !1;
462
+ }, z = te(() => [...f.value].sort((e, o) => e.startDate.localeCompare(o.startDate))), d = (e) => {
463
+ const o = N(e), x = R(C());
464
+ return o.compare(x) < 0;
465
+ };
466
+ return Y(), (e, o) => {
467
+ const x = u("Button"), D = u("Badge"), $ = u("Card"), K = u("Spinner"), Q = u("EmptyMedia"), W = u("EmptyTitle"), X = u("EmptyDescription"), O = u("EmptyHeader"), Z = u("EmptyContent"), ee = u("Empty");
468
+ return l(), y(me, null, {
469
+ default: r(() => [
470
+ p(V)("manage-overrides") ? (l(), a("div", Me, [
471
+ o[10] || (o[10] = s("h1", { class: "text-lg font-medium mb-2" }, "Exception Management", -1)),
472
+ o[11] || (o[11] = s("p", { class: "mb-6 text-muted-foreground text-sm" }, " Create exceptions to override your regular schedule. You can close specific dates or set custom hours for special occasions. ", -1)),
473
+ s("div", He, [
474
+ z.value.length > 0 ? (l(), a("div", Oe, [
475
+ n(x, { onClick: H }, {
476
+ default: r(() => [
477
+ n(p(ue), { class: "size-4 mr-1" }),
478
+ o[0] || (o[0] = c(" Add Exception ", -1))
479
+ ]),
480
+ _: 1
481
+ })
482
+ ])) : g("", !0),
483
+ z.value.length > 0 ? (l(), a("div", Ye, [
484
+ o[5] || (o[5] = s("h2", { class: "text-base font-medium mb-3" }, "Active Exceptions", -1)),
485
+ s("div", Je, [
486
+ (l(!0), a(h, null, B(z.value, (v) => (l(), y($, {
487
+ key: v.id,
488
+ class: k(["p-4", d(v.endDate) ? "opacity-60" : ""])
489
+ }, {
490
+ default: r(() => [
491
+ s("div", qe, [
492
+ s("div", Ge, [
493
+ s("div", Ke, [
494
+ v.isClosed ? (l(), y(p(de), {
495
+ key: 0,
496
+ class: "h-4 w-4 text-destructive"
497
+ })) : (l(), y(p(se), {
498
+ key: 1,
499
+ class: "h-4 w-4 text-primary"
500
+ })),
501
+ s("h3", Qe, w(L(v.startDate, v.endDate)), 1),
502
+ d(v.endDate) ? (l(), y(D, {
503
+ key: 2,
504
+ variant: "secondary",
505
+ class: "text-xs"
506
+ }, {
507
+ default: r(() => [...o[1] || (o[1] = [
508
+ c(" Past ", -1)
509
+ ])]),
510
+ _: 1
511
+ })) : g("", !0)
512
+ ]),
513
+ E.value.length > 0 ? (l(), a("div", We, [
514
+ _(v) ? (l(!0), a(h, { key: 0 }, B(_(v), (b) => (l(), a("div", {
515
+ key: b.id,
516
+ class: "size-5 rounded-full flex items-center justify-center text-white text-[10px] font-medium",
517
+ style: re({ backgroundColor: b.color || "#6b7280" }),
518
+ title: b.name
519
+ }, w(b.avatarLabel || b.name.charAt(0).toUpperCase()), 13, Xe))), 128)) : (l(), y(D, {
520
+ key: 1,
521
+ variant: "outline",
522
+ class: "text-xs"
523
+ }, {
524
+ default: r(() => [...o[2] || (o[2] = [
525
+ c(" All Resources ", -1)
526
+ ])]),
527
+ _: 1
528
+ }))
529
+ ])) : g("", !0),
530
+ s("div", Ze, [
531
+ v.isClosed ? (l(), a(h, { key: 0 }, [
532
+ c(" Closed - No appointments available ")
533
+ ], 64)) : (l(), a(h, { key: 1 }, [
534
+ v.timeslots.length === 0 ? (l(), a("div", et, " ⚠️ No time slots defined ")) : (l(), a("div", tt, [
535
+ o[3] || (o[3] = s("div", { class: "font-medium text-foreground" }, "Custom Hours:", -1)),
536
+ s("div", st, [
537
+ (l(!0), a(h, null, B(v.timeslots, (b, i) => (l(), y(D, {
538
+ key: i,
539
+ variant: "outline",
540
+ class: "font-mono text-xs"
541
+ }, {
542
+ default: r(() => [
543
+ c(w(b.startTime) + " - " + w(b.endTime), 1)
544
+ ]),
545
+ _: 2
546
+ }, 1024))), 128))
547
+ ])
548
+ ]))
549
+ ], 64))
550
+ ])
551
+ ]),
552
+ s("div", ot, [
553
+ n(x, {
554
+ variant: "ghost",
555
+ onClick: (b) => G(v)
556
+ }, {
557
+ default: r(() => [...o[4] || (o[4] = [
558
+ c(" Edit ", -1)
559
+ ])]),
560
+ _: 1
561
+ }, 8, ["onClick"]),
562
+ n(x, {
563
+ variant: "ghost",
564
+ size: "icon",
565
+ onClick: (b) => M(v.id)
566
+ }, {
567
+ default: r(() => [
568
+ n(p(ie), { class: "size-4 text-destructive" })
569
+ ]),
570
+ _: 1
571
+ }, 8, ["onClick"])
572
+ ])
573
+ ])
574
+ ]),
575
+ _: 2
576
+ }, 1032, ["class"]))), 128))
577
+ ])
578
+ ])) : m.value ? (l(), y(K, {
579
+ key: 2,
580
+ class: "my-8 size-8"
581
+ })) : (l(), y(ee, {
582
+ key: 3,
583
+ class: "border border-dashed"
584
+ }, {
585
+ default: r(() => [
586
+ n(O, null, {
587
+ default: r(() => [
588
+ n(Q, { variant: "icon" }, {
589
+ default: r(() => [
590
+ n(p(pe))
591
+ ]),
592
+ _: 1
593
+ }),
594
+ n(W, null, {
595
+ default: r(() => [...o[6] || (o[6] = [
596
+ c("No Exceptions Created", -1)
597
+ ])]),
598
+ _: 1
599
+ }),
600
+ n(X, null, {
601
+ default: r(() => [...o[7] || (o[7] = [
602
+ c(' Your agenda runs smoothly without any exceptions. Click "Add Exception" to create one. ', -1)
603
+ ])]),
604
+ _: 1
605
+ })
606
+ ]),
607
+ _: 1
608
+ }),
609
+ n(Z, null, {
610
+ default: r(() => [
611
+ n(x, {
612
+ variant: "outline",
613
+ size: "sm",
614
+ onClick: H
615
+ }, {
616
+ default: r(() => [...o[8] || (o[8] = [
617
+ c(" Add Exception ", -1)
618
+ ])]),
619
+ _: 1
620
+ })
621
+ ]),
622
+ _: 1
623
+ })
624
+ ]),
625
+ _: 1
626
+ })),
627
+ A.value ? (l(), a("div", lt, [...o[9] || (o[9] = [
628
+ s("span", null, "Saving...", -1)
629
+ ])])) : g("", !0)
630
+ ])
631
+ ])) : (l(), a("div", nt, [...o[12] || (o[12] = [
632
+ s("h1", { class: "text-lg font-medium mb-2" }, "Access Denied", -1),
633
+ s("p", { class: "text-sm text-muted-foreground" }, "You do not have permission to view or override slots.", -1)
634
+ ])])),
635
+ n(Le, {
636
+ ref_key: "exceptionDialogRef",
637
+ ref: t,
638
+ resources: E.value,
639
+ onAddException: J,
640
+ onUpdateException: q,
641
+ onRemoveException: M
642
+ }, null, 8, ["resources"])
643
+ ]),
644
+ _: 1
645
+ });
646
+ };
647
+ }
648
+ });
649
+ export {
650
+ ct as default
651
+ };