@oneclick.dev/cms-core-modules 0.0.114 → 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
@@ -1,811 +0,0 @@
1
- import { defineComponent as ce, ref as S, reactive as xe, computed as O, resolveComponent as a, openBlock as m, createBlock as C, withCtx as n, createVNode as t, createTextVNode as r, toDisplayString as v, createElementVNode as o, createElementBlock as f, Fragment as E, renderList as Y, normalizeStyle as ie, normalizeClass as me, unref as g, createCommentVNode as w } from "vue";
2
- import { _ as be } from "./EditLayout.vue_vue_type_script_setup_true_lang-DWMqQvHl.mjs";
3
- import { Clock as _e, MoreHorizontal as we, Trash2 as pe, Plus as de, Pencil as ye, Copy as ke, Users as ue, CircleAlert as Ce } from "lucide-vue-next";
4
- import { useModuleRoute as De, useConfirmation as Ve, useModule as he, useFirebaseIntegration as Se } from "@oneclick.dev/cms-kit";
5
- import { a as Re } from "./index-CFzn2Lus.mjs";
6
- const Ae = { class: "space-y-5 py-4" }, Me = { class: "flex flex-wrap gap-2 mt-2" }, ze = ["onClick"], Le = { class: "space-y-2" }, $e = { class: "flex items-center justify-between mb-2" }, Ee = { class: "text-sm font-medium" }, Ie = { class: "flex items-center gap-1" }, Ue = { class: "space-y-2" }, Ne = {
7
- key: 0,
8
- class: "text-sm text-muted-foreground italic py-1"
9
- }, Te = { class: "flex items-center justify-between rounded-lg border p-4" }, He = { class: "space-y-0.5" }, Fe = { class: "text-xs text-muted-foreground" }, Be = { class: "w-full flex justify-between items-center gap-4 flex-col @sm/dialog-footer:flex-row" }, je = { class: "flex items-center gap-2 ml-auto w-full @sm/dialog-footer:w-auto flex-col-reverse @sm/dialog-footer:flex-row" }, Oe = /* @__PURE__ */ ce({
10
- __name: "ResourceEditorDialog",
11
- emits: ["add-resource", "update-resource", "remove-resource"],
12
- setup(fe, { expose: J, emit: I }) {
13
- const M = I, x = S(!1), y = S("add"), p = ["#ef4444", "#f97316", "#f59e0b", "#eab308", "#84cc16", "#22c55e", "#10b981", "#14b8a6", "#06b6d4", "#0ea5e9", "#3b82f6", "#6366f1", "#8b5cf6", "#a855f7", "#d946ef", "#ec4899", "#f43f5e"], R = [
14
- { value: 1, label: "Monday" },
15
- { value: 2, label: "Tuesday" },
16
- { value: 3, label: "Wednesday" },
17
- { value: 4, label: "Thursday" },
18
- { value: 5, label: "Friday" },
19
- { value: 6, label: "Saturday" },
20
- { value: 0, label: "Sunday" }
21
- ], s = xe({
22
- id: "",
23
- name: "",
24
- publicLabel: "",
25
- avatarLabel: "",
26
- description: "",
27
- capacity: 1,
28
- interval: 30,
29
- openingHours: {
30
- 0: [],
31
- // Sunday
32
- 1: [{ start: "09:00", end: "17:00" }],
33
- // Monday
34
- 2: [{ start: "09:00", end: "17:00" }],
35
- // Tuesday
36
- 3: [{ start: "09:00", end: "17:00" }],
37
- // Wednesday
38
- 4: [{ start: "09:00", end: "17:00" }],
39
- // Thursday
40
- 5: [{ start: "09:00", end: "17:00" }],
41
- // Friday
42
- 6: []
43
- // Saturday
44
- },
45
- color: "blue",
46
- isActive: !0
47
- }), z = (c) => {
48
- y.value = c ? "edit" : "add", s.id = c?.id || "", s.name = c?.name || "", s.publicLabel = c?.publicLabel || "", s.avatarLabel = c?.avatarLabel || "", s.description = c?.description || "", s.capacity = c?.capacity || 1, s.interval = c?.interval || 30, s.openingHours = c?.openingHours || {
49
- 0: [],
50
- 1: [{ start: "09:00", end: "17:00" }],
51
- 2: [{ start: "09:00", end: "17:00" }],
52
- 3: [{ start: "09:00", end: "17:00" }],
53
- 4: [{ start: "09:00", end: "17:00" }],
54
- 5: [{ start: "09:00", end: "17:00" }],
55
- 6: []
56
- }, s.color = c?.color || "blue", s.isActive = c?.isActive !== void 0 ? c.isActive : !0, x.value = !0;
57
- }, A = () => {
58
- x.value = !1;
59
- }, U = () => {
60
- M("add-resource", { ...s }), x.value = !1;
61
- }, q = () => {
62
- M("update-resource", { ...s }), x.value = !1;
63
- }, D = () => {
64
- M("remove-resource", s.id), x.value = !1;
65
- }, N = O(() => s.name.trim().length > 0), P = (c) => {
66
- s.openingHours[c] || (s.openingHours[c] = []), s.openingHours[c].push({ start: "09:00", end: "17:00" });
67
- }, T = (c, e) => {
68
- s.openingHours[c].splice(e, 1);
69
- }, W = (c) => {
70
- const e = s.openingHours[c];
71
- R.forEach((V) => {
72
- s.openingHours[V.value] = JSON.parse(JSON.stringify(e));
73
- });
74
- }, Q = (c) => {
75
- s.openingHours[c] = [];
76
- };
77
- return J({
78
- openDialog: z
79
- }), (c, e) => {
80
- const V = a("DialogTitle"), G = a("DialogDescription"), H = a("DialogHeader"), i = a("Label"), l = a("Input"), b = a("NumberFieldDecrement"), K = a("NumberFieldInput"), X = a("NumberFieldIncrement"), L = a("NumberFieldContent"), Z = a("NumberField"), ee = a("SelectValue"), te = a("SelectTrigger"), h = a("SelectItem"), oe = a("SelectContent"), F = a("Select"), _ = a("Button"), ne = a("DropdownMenuTrigger"), B = a("DropdownMenuItem"), le = a("DropdownMenuContent"), se = a("DropdownMenu"), ae = a("Textarea"), u = a("Switch"), $ = a("DialogFooter"), ve = a("DialogScrollContent"), ge = a("Dialog");
81
- return m(), C(ge, {
82
- open: x.value,
83
- "onUpdate:open": e[7] || (e[7] = (d) => x.value = d)
84
- }, {
85
- default: n(() => [
86
- t(ve, { class: "sm:max-w-xl lg:max-w-2xl" }, {
87
- default: n(() => [
88
- t(H, null, {
89
- default: n(() => [
90
- t(V, null, {
91
- default: n(() => [
92
- r(v(y.value === "add" ? "Add New Resource" : "Edit Resource"), 1)
93
- ]),
94
- _: 1
95
- }),
96
- t(G, null, {
97
- default: n(() => [
98
- r(v(y.value === "add" ? "Define a new bookable resource such as staff member, room, or equipment." : "Update the details of this resource."), 1)
99
- ]),
100
- _: 1
101
- })
102
- ]),
103
- _: 1
104
- }),
105
- o("div", Ae, [
106
- o("div", null, [
107
- t(i, {
108
- class: "text-sm font-normal mb-1.5",
109
- for: "resource-name"
110
- }, {
111
- default: n(() => [...e[8] || (e[8] = [
112
- r(" Resource Name ", -1),
113
- o("span", { class: "text-destructive" }, "*", -1)
114
- ])]),
115
- _: 1
116
- }),
117
- t(l, {
118
- modelValue: s.name,
119
- "onUpdate:modelValue": e[0] || (e[0] = (d) => s.name = d),
120
- id: "resource-name",
121
- placeholder: "e.g., James, Box 1, Meeting Room A"
122
- }, null, 8, ["modelValue"]),
123
- e[9] || (e[9] = o("p", { class: "text-xs text-muted-foreground mt-1" }, " Internal name visible to your team. ", -1))
124
- ]),
125
- o("div", null, [
126
- t(i, {
127
- class: "text-sm font-normal mb-1.5",
128
- for: "resource-public-label"
129
- }, {
130
- default: n(() => [...e[10] || (e[10] = [
131
- r(" Public Label ", -1)
132
- ])]),
133
- _: 1
134
- }),
135
- t(l, {
136
- modelValue: s.publicLabel,
137
- "onUpdate:modelValue": e[1] || (e[1] = (d) => s.publicLabel = d),
138
- id: "resource-public-label",
139
- placeholder: "Name shown to customers"
140
- }, null, 8, ["modelValue"]),
141
- e[11] || (e[11] = o("p", { class: "text-xs text-muted-foreground mt-1" }, " If empty, the internal name will be displayed to customers. ", -1))
142
- ]),
143
- o("div", null, [
144
- t(i, {
145
- class: "text-sm font-normal mb-1.5",
146
- for: "resource-avatar-label"
147
- }, {
148
- default: n(() => [...e[12] || (e[12] = [
149
- r(" Avatar Label ", -1)
150
- ])]),
151
- _: 1
152
- }),
153
- t(l, {
154
- modelValue: s.avatarLabel,
155
- "onUpdate:modelValue": e[2] || (e[2] = (d) => s.avatarLabel = d),
156
- id: "resource-avatar-label",
157
- placeholder: "e.g., B1, 1, JD",
158
- maxlength: "3"
159
- }, null, 8, ["modelValue"]),
160
- e[13] || (e[13] = o("p", { class: "text-xs text-muted-foreground mt-1" }, " Short text shown in the colored circle (max 3 characters). If empty, first letter of name is used. ", -1))
161
- ]),
162
- o("div", null, [
163
- t(i, { class: "text-sm font-normal mb-1.5" }, {
164
- default: n(() => [...e[14] || (e[14] = [
165
- r("Color", -1)
166
- ])]),
167
- _: 1
168
- }),
169
- o("div", Me, [
170
- (m(), f(E, null, Y(p, (d) => o("button", {
171
- key: d,
172
- type: "button",
173
- class: me(["size-7 rounded-full transition-all ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", [
174
- s.color === d ? "ring-2 ring-ring ring-offset-2" : "hover:scale-110"
175
- ]]),
176
- style: ie({ background: d }),
177
- onClick: (k) => s.color = d
178
- }, null, 14, ze)), 64))
179
- ]),
180
- e[15] || (e[15] = o("p", { class: "text-xs text-muted-foreground mt-2" }, " Used for visual identification in the calendar. ", -1))
181
- ]),
182
- o("div", null, [
183
- t(i, {
184
- class: "text-sm font-normal mb-1.5",
185
- for: "resource-capacity"
186
- }, {
187
- default: n(() => [...e[16] || (e[16] = [
188
- r(" Capacity ", -1)
189
- ])]),
190
- _: 1
191
- }),
192
- t(Z, {
193
- id: "resource-capacity",
194
- modelValue: s.capacity,
195
- "onUpdate:modelValue": e[3] || (e[3] = (d) => s.capacity = d),
196
- min: 1,
197
- max: 999
198
- }, {
199
- default: n(() => [
200
- t(L, null, {
201
- default: n(() => [
202
- t(b),
203
- t(K),
204
- t(X)
205
- ]),
206
- _: 1
207
- })
208
- ]),
209
- _: 1
210
- }, 8, ["modelValue"]),
211
- e[17] || (e[17] = o("p", { class: "text-xs text-muted-foreground mt-1" }, " Maximum simultaneous bookings allowed for this resource. ", -1))
212
- ]),
213
- o("div", null, [
214
- t(i, {
215
- class: "text-sm font-normal mb-1.5",
216
- for: "resource-interval"
217
- }, {
218
- default: n(() => [...e[18] || (e[18] = [
219
- r(" Booking Interval ", -1)
220
- ])]),
221
- _: 1
222
- }),
223
- t(F, {
224
- modelValue: s.interval,
225
- "onUpdate:modelValue": e[4] || (e[4] = (d) => s.interval = d),
226
- modelModifiers: { number: !0 }
227
- }, {
228
- default: n(() => [
229
- t(te, { id: "resource-interval" }, {
230
- default: n(() => [
231
- t(ee, { placeholder: "Select interval" })
232
- ]),
233
- _: 1
234
- }),
235
- t(oe, null, {
236
- default: n(() => [
237
- t(h, { value: 5 }, {
238
- default: n(() => [...e[19] || (e[19] = [
239
- r("5 minutes", -1)
240
- ])]),
241
- _: 1
242
- }),
243
- t(h, { value: 10 }, {
244
- default: n(() => [...e[20] || (e[20] = [
245
- r("10 minutes", -1)
246
- ])]),
247
- _: 1
248
- }),
249
- t(h, { value: 15 }, {
250
- default: n(() => [...e[21] || (e[21] = [
251
- r("15 minutes", -1)
252
- ])]),
253
- _: 1
254
- }),
255
- t(h, { value: 30 }, {
256
- default: n(() => [...e[22] || (e[22] = [
257
- r("30 minutes", -1)
258
- ])]),
259
- _: 1
260
- }),
261
- t(h, { value: 60 }, {
262
- default: n(() => [...e[23] || (e[23] = [
263
- r("1 hour", -1)
264
- ])]),
265
- _: 1
266
- })
267
- ]),
268
- _: 1
269
- })
270
- ]),
271
- _: 1
272
- }, 8, ["modelValue"]),
273
- e[24] || (e[24] = o("p", { class: "text-xs text-muted-foreground mt-1" }, " Time slots will be generated at this interval within operating hours. ", -1))
274
- ]),
275
- o("div", null, [
276
- t(i, { class: "text-sm font-normal mb-2 flex items-center gap-2" }, {
277
- default: n(() => [
278
- t(g(_e), { class: "w-4 h-4" }),
279
- e[25] || (e[25] = r(" Operating Hours ", -1))
280
- ]),
281
- _: 1
282
- }),
283
- o("div", Le, [
284
- (m(), f(E, null, Y(R, (d) => o("div", {
285
- key: d.value,
286
- class: "rounded-md bg-muted/30 p-2 sm:p-3"
287
- }, [
288
- o("div", $e, [
289
- o("span", Ee, v(d.label), 1),
290
- o("div", Ie, [
291
- t(_, {
292
- variant: "outline",
293
- size: "sm",
294
- class: "h-7 px-2 text-xs",
295
- onClick: (k) => P(d.value)
296
- }, {
297
- default: n(() => [...e[26] || (e[26] = [
298
- r(" Add ", -1)
299
- ])]),
300
- _: 1
301
- }, 8, ["onClick"]),
302
- t(se, null, {
303
- default: n(() => [
304
- t(ne, { "as-child": "" }, {
305
- default: n(() => [
306
- t(_, {
307
- variant: "ghost",
308
- size: "icon",
309
- class: "size-7"
310
- }, {
311
- default: n(() => [
312
- t(g(we), { class: "w-4 h-4" })
313
- ]),
314
- _: 1
315
- })
316
- ]),
317
- _: 1
318
- }),
319
- t(le, { align: "end" }, {
320
- default: n(() => [
321
- t(B, {
322
- onClick: (k) => W(d.value)
323
- }, {
324
- default: n(() => [...e[27] || (e[27] = [
325
- r(" Copy to all days ", -1)
326
- ])]),
327
- _: 1
328
- }, 8, ["onClick"]),
329
- t(B, {
330
- onClick: (k) => Q(d.value),
331
- variant: "destructive"
332
- }, {
333
- default: n(() => [...e[28] || (e[28] = [
334
- r(" Set as closed ", -1)
335
- ])]),
336
- _: 1
337
- }, 8, ["onClick"])
338
- ]),
339
- _: 2
340
- }, 1024)
341
- ]),
342
- _: 2
343
- }, 1024)
344
- ])
345
- ]),
346
- o("div", Ue, [
347
- s.openingHours[d.value]?.length === 0 ? (m(), f("div", Ne, " Closed ")) : w("", !0),
348
- (m(!0), f(E, null, Y(s.openingHours[d.value], (k, re) => (m(), f("div", {
349
- key: re,
350
- class: "flex items-center gap-1.5 sm:gap-2"
351
- }, [
352
- t(l, {
353
- modelValue: k.start,
354
- "onUpdate:modelValue": (j) => k.start = j,
355
- type: "time",
356
- class: "flex-1 min-w-0 h-8 text-sm"
357
- }, null, 8, ["modelValue", "onUpdate:modelValue"]),
358
- e[29] || (e[29] = o("span", { class: "text-muted-foreground text-xs sm:text-sm shrink-0" }, "to", -1)),
359
- t(l, {
360
- modelValue: k.end,
361
- "onUpdate:modelValue": (j) => k.end = j,
362
- type: "time",
363
- class: "flex-1 min-w-0 h-8 text-sm"
364
- }, null, 8, ["modelValue", "onUpdate:modelValue"]),
365
- t(_, {
366
- variant: "ghost",
367
- size: "icon",
368
- class: "size-7 shrink-0",
369
- onClick: (j) => T(d.value, re)
370
- }, {
371
- default: n(() => [
372
- t(g(pe), { class: "w-3.5 h-3.5 text-destructive" })
373
- ]),
374
- _: 1
375
- }, 8, ["onClick"])
376
- ]))), 128))
377
- ])
378
- ])), 64))
379
- ]),
380
- e[30] || (e[30] = o("p", { class: "text-xs text-muted-foreground mt-2" }, " Define when this resource is available. You can add multiple time ranges per day for split shifts. ", -1))
381
- ]),
382
- o("div", null, [
383
- t(i, {
384
- class: "text-sm font-normal mb-1.5",
385
- for: "resource-description"
386
- }, {
387
- default: n(() => [...e[31] || (e[31] = [
388
- r(" Description ", -1)
389
- ])]),
390
- _: 1
391
- }),
392
- t(ae, {
393
- modelValue: s.description,
394
- "onUpdate:modelValue": e[5] || (e[5] = (d) => s.description = d),
395
- id: "resource-description",
396
- placeholder: "Internal notes about this resource...",
397
- rows: "3"
398
- }, null, 8, ["modelValue"]),
399
- e[32] || (e[32] = o("p", { class: "text-xs text-muted-foreground mt-1" }, " Admin-only notes. Not shown to customers. ", -1))
400
- ]),
401
- o("div", Te, [
402
- o("div", He, [
403
- t(i, { class: "text-sm font-medium" }, {
404
- default: n(() => [...e[33] || (e[33] = [
405
- r("Active", -1)
406
- ])]),
407
- _: 1
408
- }),
409
- o("p", Fe, v(s.isActive ? "Resource can be used for new slots and bookings." : "Existing bookings stay, but no new ones can be created."), 1)
410
- ]),
411
- t(u, {
412
- modelValue: s.isActive,
413
- "onUpdate:modelValue": e[6] || (e[6] = (d) => s.isActive = d)
414
- }, null, 8, ["modelValue"])
415
- ])
416
- ]),
417
- t($, { class: "@container/dialog-footer gap-2" }, {
418
- default: n(() => [
419
- o("div", Be, [
420
- y.value === "edit" ? (m(), C(_, {
421
- key: 0,
422
- variant: "destructive",
423
- onClick: D,
424
- class: "w-full @sm/dialog-footer:w-auto"
425
- }, {
426
- default: n(() => [...e[34] || (e[34] = [
427
- r(" Delete Resource ", -1)
428
- ])]),
429
- _: 1
430
- })) : w("", !0),
431
- o("div", je, [
432
- t(_, {
433
- variant: "outline",
434
- onClick: A,
435
- class: "w-full @sm/dialog-footer:w-auto"
436
- }, {
437
- default: n(() => [...e[35] || (e[35] = [
438
- r(" Cancel ", -1)
439
- ])]),
440
- _: 1
441
- }),
442
- y.value === "add" ? (m(), C(_, {
443
- key: 0,
444
- onClick: U,
445
- disabled: !N.value,
446
- class: "w-full @sm/dialog-footer:w-auto"
447
- }, {
448
- default: n(() => [...e[36] || (e[36] = [
449
- r(" Add Resource ", -1)
450
- ])]),
451
- _: 1
452
- }, 8, ["disabled"])) : (m(), C(_, {
453
- key: 1,
454
- onClick: q,
455
- disabled: !N.value,
456
- class: "w-full @sm/dialog-footer:w-auto"
457
- }, {
458
- default: n(() => [...e[37] || (e[37] = [
459
- r(" Save Changes ", -1)
460
- ])]),
461
- _: 1
462
- }, 8, ["disabled"]))
463
- ])
464
- ])
465
- ]),
466
- _: 1
467
- })
468
- ]),
469
- _: 1
470
- })
471
- ]),
472
- _: 1
473
- }, 8, ["open"]);
474
- };
475
- }
476
- }), Ye = { class: "@container/resources" }, Je = { class: "flex flex-col @lg/resources:flex-row @lg/resources:items-center @lg/resources:justify-between gap-4 mb-6" }, qe = { class: "space-y-6" }, Pe = {
477
- key: 0,
478
- class: "flex flex-col @md/resources:flex-row gap-4 items-start @md/resources:items-center justify-between"
479
- }, We = { class: "relative w-full @md/resources:w-64" }, Qe = { class: "text-sm text-muted-foreground" }, Ge = {
480
- key: 1,
481
- class: "grid grid-cols-1 @2xl/resources:grid-cols-2 @4xl/resources:grid-cols-3 gap-4"
482
- }, Ke = { class: "p-4 pl-5" }, Xe = { class: "flex items-start gap-3" }, Ze = { class: "flex-1 min-w-0" }, et = { class: "flex items-center gap-2" }, tt = { class: "font-semibold truncate text-base" }, ot = { key: 0 }, nt = {
483
- key: 0,
484
- class: "text-sm text-muted-foreground truncate"
485
- }, lt = {
486
- key: 0,
487
- class: "text-sm text-muted-foreground mt-3 line-clamp-2"
488
- }, st = { class: "flex items-center flex-wrap gap-3 mt-4 pt-3 border-t" }, at = { class: "flex items-center gap-1.5 text-xs text-muted-foreground" }, it = { class: "flex items-center gap-1.5 text-xs text-muted-foreground" }, rt = { class: "flex items-center gap-2" }, dt = { class: "text-xs text-muted-foreground" }, ut = {
489
- key: 1,
490
- class: "flex items-center gap-1.5 text-xs text-orange-500"
491
- }, ct = {
492
- key: 2,
493
- class: "text-center py-8 text-muted-foreground"
494
- }, mt = {
495
- key: 3,
496
- class: "flex justify-center py-12"
497
- }, pt = {
498
- key: 5,
499
- class: "fixed bottom-4 right-4 bg-background border rounded-lg px-4 py-2 shadow-lg flex items-center gap-2"
500
- }, _t = /* @__PURE__ */ ce({
501
- __name: "resources",
502
- setup(fe) {
503
- const { width: J } = Re(), { params: I } = De(), { confirm: M } = Ve(), { config: x } = he(), y = Se(x.project), p = S([]), R = S(!1), s = S(!0), z = S(), A = S(""), U = () => Date.now().toString(36) + Math.random().toString(36).substr(2), q = async () => {
504
- try {
505
- s.value = !0;
506
- const i = await y.get(x.agendaCollection, I.value.id);
507
- p.value = i.resources || [];
508
- } catch (i) {
509
- console.error("Error loading resources:", i);
510
- } finally {
511
- s.value = !1;
512
- }
513
- }, D = async () => {
514
- R.value = !0;
515
- try {
516
- await y.update(x.agendaCollection, I.value.id, {
517
- resources: p.value
518
- });
519
- } catch (i) {
520
- console.error("Error saving resources:", i);
521
- } finally {
522
- R.value = !1;
523
- }
524
- }, N = (i) => {
525
- const l = {
526
- ...i,
527
- id: U()
528
- };
529
- p.value.push(l), D();
530
- }, P = (i) => {
531
- const l = p.value.findIndex((b) => b.id === i.id);
532
- l !== -1 && (p.value[l] = i), D();
533
- }, T = async (i) => {
534
- await M("Are you sure you want to delete this resource? This action cannot be undone.", "Delete Resource", "Delete") && (p.value = p.value.filter((b) => b.id !== i), D());
535
- }, W = async (i) => {
536
- const l = p.value.findIndex((b) => b.id === i.id);
537
- l !== -1 && (p.value[l].isActive = !p.value[l].isActive, await D());
538
- }, Q = (i) => {
539
- const l = {
540
- ...i,
541
- id: U(),
542
- name: `${i.name} (Copy)`,
543
- publicLabel: i.publicLabel ? `${i.publicLabel} (Copy)` : ""
544
- };
545
- p.value.push(l), D();
546
- }, c = () => {
547
- z.value?.openDialog();
548
- }, e = (i) => {
549
- z.value?.openDialog(i);
550
- }, V = O(() => {
551
- if (!A.value.trim())
552
- return p.value;
553
- const i = A.value.toLowerCase();
554
- return p.value.filter(
555
- (l) => l.name.toLowerCase().includes(i) || l.publicLabel?.toLowerCase().includes(i)
556
- );
557
- }), G = O(() => p.value.filter((i) => i.isActive).length), H = O(() => p.value.length);
558
- return q(), (i, l) => {
559
- const b = a("Button"), K = a("Input"), X = a("DropdownMenuTrigger"), L = a("DropdownMenuItem"), Z = a("DropdownMenuSeparator"), ee = a("DropdownMenuContent"), te = a("DropdownMenu"), h = a("Switch"), oe = a("Card"), F = a("Spinner"), _ = a("EmptyMedia"), ne = a("EmptyTitle"), B = a("EmptyDescription"), le = a("EmptyHeader"), se = a("EmptyContent"), ae = a("Empty");
560
- return m(), C(be, null, {
561
- default: n(() => [
562
- o("div", Ye, [
563
- o("div", Je, [
564
- l[2] || (l[2] = o("div", null, [
565
- o("h1", { class: "text-lg font-medium" }, "Resource Management"),
566
- o("p", { class: "text-muted-foreground text-sm mt-1" }, " Define the rooms, boxes, or staff that can be booked in this agenda. ")
567
- ], -1)),
568
- p.value.length > 0 ? (m(), C(b, {
569
- key: 0,
570
- onClick: c
571
- }, {
572
- default: n(() => [
573
- t(g(de), { class: "size-4 mr-1.5" }),
574
- l[1] || (l[1] = r(" Add Resource ", -1))
575
- ]),
576
- _: 1
577
- })) : w("", !0)
578
- ]),
579
- o("div", qe, [
580
- p.value.length > 0 ? (m(), f("div", Pe, [
581
- o("div", We, [
582
- t(K, {
583
- modelValue: A.value,
584
- "onUpdate:modelValue": l[0] || (l[0] = (u) => A.value = u),
585
- placeholder: "Search resources...",
586
- class: "pl-9"
587
- }, null, 8, ["modelValue"]),
588
- l[3] || (l[3] = o("svg", {
589
- class: "absolute left-3 top-1/2 -translate-y-1/2 size-4 text-muted-foreground",
590
- xmlns: "http://www.w3.org/2000/svg",
591
- fill: "none",
592
- viewBox: "0 0 24 24",
593
- stroke: "currentColor"
594
- }, [
595
- o("path", {
596
- "stroke-linecap": "round",
597
- "stroke-linejoin": "round",
598
- "stroke-width": "2",
599
- d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
600
- })
601
- ], -1))
602
- ]),
603
- o("div", Qe, v(G.value) + " active of " + v(H.value) + " resource" + v(H.value !== 1 ? "s" : ""), 1)
604
- ])) : w("", !0),
605
- V.value.length > 0 ? (m(), f("div", Ge, [
606
- (m(!0), f(E, null, Y(V.value, (u) => (m(), C(oe, {
607
- key: u.id,
608
- class: me(["group relative overflow-hidden transition-all duration-200 hover:shadow-md", u.isActive ? "" : "opacity-60 grayscale-[30%]"])
609
- }, {
610
- default: n(() => [
611
- o("div", {
612
- class: "absolute inset-y-0 left-0 w-1 transition-all duration-200 group-hover:w-1.5",
613
- style: ie({ background: u.color })
614
- }, null, 4),
615
- o("div", Ke, [
616
- o("div", Xe, [
617
- o("div", {
618
- class: "size-11 rounded-xl flex-shrink-0 flex items-center justify-center text-white font-semibold text-sm shadow-sm",
619
- style: ie({ background: u.color })
620
- }, v(u.avatarLabel || u.name.charAt(0).toUpperCase()), 5),
621
- o("div", Ze, [
622
- o("div", et, [
623
- o("h3", tt, [
624
- r(v(u.name) + " ", 1),
625
- u.isActive ? w("", !0) : (m(), f("span", ot, "(Inactive)"))
626
- ])
627
- ]),
628
- u.publicLabel && u.publicLabel !== u.name ? (m(), f("p", nt, v(u.publicLabel), 1)) : w("", !0)
629
- ]),
630
- t(te, null, {
631
- default: n(() => [
632
- t(X, { "as-child": "" }, {
633
- default: n(() => [
634
- t(b, {
635
- variant: "ghost",
636
- size: "icon",
637
- class: "size-8"
638
- }, {
639
- default: n(() => [...l[4] || (l[4] = [
640
- o("svg", {
641
- class: "size-4",
642
- xmlns: "http://www.w3.org/2000/svg",
643
- fill: "none",
644
- viewBox: "0 0 24 24",
645
- stroke: "currentColor"
646
- }, [
647
- o("path", {
648
- "stroke-linecap": "round",
649
- "stroke-linejoin": "round",
650
- "stroke-width": "2",
651
- d: "M12 5v.01M12 12v.01M12 19v.01M12 6a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2z"
652
- })
653
- ], -1)
654
- ])]),
655
- _: 1
656
- })
657
- ]),
658
- _: 1
659
- }),
660
- t(ee, { align: "end" }, {
661
- default: n(() => [
662
- t(L, {
663
- onClick: ($) => e(u)
664
- }, {
665
- default: n(() => [
666
- t(g(ye), { class: "size-4 mr-2" }),
667
- l[5] || (l[5] = r(" Edit ", -1))
668
- ]),
669
- _: 1
670
- }, 8, ["onClick"]),
671
- t(L, {
672
- onClick: ($) => Q(u)
673
- }, {
674
- default: n(() => [
675
- t(g(ke), { class: "size-4 mr-2" }),
676
- l[6] || (l[6] = r(" Duplicate ", -1))
677
- ]),
678
- _: 1
679
- }, 8, ["onClick"]),
680
- t(Z),
681
- t(L, {
682
- variant: "destructive",
683
- onClick: ($) => T(u.id)
684
- }, {
685
- default: n(() => [
686
- t(g(pe), { class: "size-4 mr-2" }),
687
- l[7] || (l[7] = r(" Delete ", -1))
688
- ]),
689
- _: 1
690
- }, 8, ["onClick"])
691
- ]),
692
- _: 2
693
- }, 1024)
694
- ]),
695
- _: 2
696
- }, 1024)
697
- ]),
698
- u.description ? (m(), f("p", lt, v(u.description), 1)) : w("", !0),
699
- o("div", st, [
700
- o("div", at, [
701
- t(g(ue), { class: "size-3.5" }),
702
- o("span", null, v(u.capacity) + " " + v(u.capacity === 1 ? "slot" : "slots"), 1)
703
- ]),
704
- o("div", it, [
705
- l[8] || (l[8] = o("svg", {
706
- class: "size-3.5",
707
- xmlns: "http://www.w3.org/2000/svg",
708
- fill: "none",
709
- viewBox: "0 0 24 24",
710
- stroke: "currentColor"
711
- }, [
712
- o("path", {
713
- "stroke-linecap": "round",
714
- "stroke-linejoin": "round",
715
- "stroke-width": "2",
716
- d: "M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"
717
- })
718
- ], -1)),
719
- o("span", null, v(u.interval) + " min", 1)
720
- ]),
721
- g(J) >= 640 ? (m(), f(E, { key: 0 }, [
722
- l[9] || (l[9] = o("div", { class: "flex-1" }, null, -1)),
723
- o("div", rt, [
724
- o("span", dt, v(u.isActive ? "Active" : "Inactive"), 1),
725
- t(h, {
726
- defaultValue: u.isActive,
727
- "onUpdate:modelValue": ($) => W(u),
728
- class: "scale-90"
729
- }, null, 8, ["defaultValue", "onUpdate:modelValue"])
730
- ])
731
- ], 64)) : u.isActive ? w("", !0) : (m(), f("div", ut, [
732
- t(g(Ce), { class: "size-3.5" }),
733
- l[10] || (l[10] = o("span", null, "Inactive", -1))
734
- ]))
735
- ])
736
- ])
737
- ]),
738
- _: 2
739
- }, 1032, ["class"]))), 128))
740
- ])) : p.value.length > 0 && V.value.length === 0 ? (m(), f("div", ct, [...l[11] || (l[11] = [
741
- o("p", null, "No resources match your search.", -1)
742
- ])])) : s.value ? (m(), f("div", mt, [
743
- t(F, { class: "size-8" })
744
- ])) : (m(), C(ae, {
745
- key: 4,
746
- class: "border border-dashed"
747
- }, {
748
- default: n(() => [
749
- t(le, null, {
750
- default: n(() => [
751
- t(_, { variant: "icon" }, {
752
- default: n(() => [
753
- t(g(ue), { class: "size-6" })
754
- ]),
755
- _: 1
756
- }),
757
- t(ne, null, {
758
- default: n(() => [...l[12] || (l[12] = [
759
- r("No Resources Yet", -1)
760
- ])]),
761
- _: 1
762
- }),
763
- t(B, null, {
764
- default: n(() => [...l[13] || (l[13] = [
765
- r(" You haven't added any bookable resources yet. Define your staff, rooms, or equipment to start configuring availability. ", -1)
766
- ])]),
767
- _: 1
768
- })
769
- ]),
770
- _: 1
771
- }),
772
- t(se, null, {
773
- default: n(() => [
774
- t(b, {
775
- variant: "outline",
776
- onClick: c
777
- }, {
778
- default: n(() => [
779
- t(g(de), { class: "size-4 mr-1.5" }),
780
- l[14] || (l[14] = r(" Add Your First Resource ", -1))
781
- ]),
782
- _: 1
783
- })
784
- ]),
785
- _: 1
786
- })
787
- ]),
788
- _: 1
789
- })),
790
- R.value ? (m(), f("div", pt, [
791
- t(F, { class: "size-4" }),
792
- l[15] || (l[15] = o("span", { class: "text-sm" }, "Saving...", -1))
793
- ])) : w("", !0)
794
- ])
795
- ]),
796
- t(Oe, {
797
- ref_key: "resourceDialogRef",
798
- ref: z,
799
- onAddResource: N,
800
- onUpdateResource: P,
801
- onRemoveResource: T
802
- }, null, 512)
803
- ]),
804
- _: 1
805
- });
806
- };
807
- }
808
- });
809
- export {
810
- _t as default
811
- };