@oneclick.dev/cms-core-modules 0.0.119 → 0.0.121

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 (65) hide show
  1. package/dist/{ContentEditor-BnOVpmsQ.js → ContentEditor-Dl41qaCh.js} +42 -41
  2. package/dist/{ContentEditor-Cm28u_14.mjs → ContentEditor-u3k-uTny.mjs} +4785 -4492
  3. package/dist/{Detail-C8wQiDcv.js → Detail-BCUUNWvp.js} +1 -1
  4. package/dist/{Detail-CtItxMX4.mjs → Detail-B_scnidb.mjs} +1 -1
  5. package/dist/Detail-Cn9Bk0u0.mjs +852 -0
  6. package/dist/Detail-DGg_xXZc.js +1 -0
  7. package/dist/Detail-Dk8E6_uF.mjs +3731 -0
  8. package/dist/Detail-Sc2qZdxj.js +1 -0
  9. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-4_t0PPqM.mjs +78 -0
  10. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-D1b9_iiN.js +1 -0
  11. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BdZbcubW.js +1 -0
  12. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-bZidw6RT.mjs +1500 -0
  13. package/dist/Overview-CVgViW3c.mjs +852 -0
  14. package/dist/Overview-DEF-z7Yb.js +1 -0
  15. package/dist/Overview-Tf_ApkWh.js +1 -0
  16. package/dist/{Overview-CVQ1pkuD.mjs → Overview-usm5gPD1.mjs} +131 -131
  17. package/dist/{agenda-BtmnpFmi.js → agenda-B54F8cEr.js} +1 -1
  18. package/dist/{agenda-D0QBOJUy.mjs → agenda-BCKDYOeF.mjs} +7 -7
  19. package/dist/{availability-ClBGVgE9.js → availability-C4v46rha.js} +1 -1
  20. package/dist/{availability-D8JdA4rP.mjs → availability-DVT1Mdxq.mjs} +1 -1
  21. package/dist/{booking-data-aMS1p_3g.js → booking-data-A5JrLY4j.js} +1 -1
  22. package/dist/{booking-data-Px7XCIfU.mjs → booking-data-lZvSYna2.mjs} +1 -1
  23. package/dist/cms-core-modules.css +1 -1
  24. package/dist/{exceptions-Dgj54ULn.mjs → exceptions-DJHfvADv.mjs} +1 -1
  25. package/dist/{exceptions-DXqc0Nza.js → exceptions-DKc8fO1S.js} +1 -1
  26. package/dist/index-Bk3yLv_G.js +35 -0
  27. package/dist/{index-Dnn2SCSl.js → index-CZau1wR8.js} +1 -1
  28. package/dist/{index-DRqJOqUR.mjs → index-DE8rdSjd.mjs} +0 -22
  29. package/dist/index-DU3Ib10Z.mjs +1256 -0
  30. package/dist/index.cjs.js +1 -1
  31. package/dist/index.mjs +35 -33
  32. package/dist/orders-BMosTk6r.js +1 -0
  33. package/dist/{orders-C5NT99Fy.mjs → orders-CElKNc1v.mjs} +229 -234
  34. package/dist/{payment-D5j-68Ig.mjs → payment-DSQ_2FIT.mjs} +1 -1
  35. package/dist/{payment-BJHgpaeT.js → payment-DlgYuea2.js} +1 -1
  36. package/dist/{refunds-oVB2Opib.js → refunds-Cvw9N--u.js} +1 -1
  37. package/dist/{refunds-D9nTeD2d.mjs → refunds-xR936Ted.mjs} +1 -1
  38. package/dist/reports-BQT_GZzU.js +158 -0
  39. package/dist/reports-DksZCTOw.mjs +837 -0
  40. package/dist/{resources-CK0oWssj.mjs → resources-C-5BU9Ux.mjs} +1 -1
  41. package/dist/{resources-8WouFvJe.js → resources-D04yKKVN.js} +1 -1
  42. package/dist/src/appointments/components/edit/NewReservationDialog/QuickReservationAdder.vue.d.ts +2 -0
  43. package/dist/src/appointments/components/edit/NewReservationDialog/ReservationLines.vue.d.ts +1 -0
  44. package/dist/src/productCollections/components/detail/Subcollections.vue.d.ts +2 -0
  45. package/dist/src/productCollections/types.d.ts +1 -4
  46. package/dist/src/products/components/detail/variants/VariantList.vue.d.ts +48 -6
  47. package/dist/src/products/components/detail/variants/dialogs/VariantDialog.vue.d.ts +4 -0
  48. package/dist/{vee-validate-zod-CcOwoF6y.mjs → vee-validate-zod-SjDT8X35.mjs} +92 -90
  49. package/dist/{vee-validate-zod-ByykgYKJ.js → vee-validate-zod-VCmLnrtQ.js} +1 -1
  50. package/package.json +2 -2
  51. package/dist/Detail-C1Blq61w.mjs +0 -585
  52. package/dist/Detail-CPqug27l.js +0 -1
  53. package/dist/Detail-CjuhjPby.js +0 -1
  54. package/dist/Detail-Dnpnmy4-.mjs +0 -3477
  55. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-gozJKXvM.js +0 -1
  56. package/dist/EditLayout.vue_vue_type_script_setup_true_lang-pDO9b4Pv.mjs +0 -77
  57. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-CcMEKZzd.mjs +0 -1476
  58. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-CkFsdcvP.js +0 -1
  59. package/dist/Overview-BWLxUksJ.mjs +0 -860
  60. package/dist/Overview-CBahJviK.js +0 -1
  61. package/dist/Overview-DAxCu9XC.js +0 -1
  62. package/dist/index-BnFWz40Q.mjs +0 -1261
  63. package/dist/index-DcGPR_vt.js +0 -35
  64. package/dist/orders-lO3dZ5un.js +0 -1
  65. /package/dist/src/{productCollections/components/detail/SEO.vue.d.ts → appointments/pages/edit/reports.vue.d.ts} +0 -0
@@ -0,0 +1,852 @@
1
+ import { defineComponent as H, inject as se, watch as ge, resolveComponent as u, openBlock as i, createBlock as w, withCtx as l, createVNode as e, createElementVNode as n, createTextVNode as C, isRef as X, unref as o, createElementBlock as x, toDisplayString as A, createCommentVNode as h, withModifiers as ne, ref as ae, computed as ie, Fragment as xe, renderList as ve, provide as ee, onMounted as be } from "vue";
2
+ import { u as Y, a as q, o as te, g as ye, h as he, s as P, b as le, t as Ce, f as Se } from "./vee-validate-zod-SjDT8X35.mjs";
3
+ import { X as ce, ImagePlus as W, Plus as we, ArrowUp as ke, ArrowDown as $e, Copy as ze, Trash as re, ChevronUp as Ve, ChevronDown as Ie, Tag as Te, ChevronRight as Ue, Loader2 as oe } from "lucide-vue-next";
4
+ import { useModulePermissions as De, useModuleRoute as Me, useConfirmation as Ae, useFirebaseIntegration as Pe, useModuleBreadcrumbs as Fe } from "@oneclick.dev/cms-kit";
5
+ import { t as L } from "./index-RLz1QPrf.mjs";
6
+ const Ne = { class: "flex flex-col gap-4" }, Be = { class: "flex flex-col gap-2" }, je = {
7
+ key: 0,
8
+ class: "text-red-500 text-sm mt-1"
9
+ }, Le = { class: "flex flex-col gap-4" }, Ee = { class: "flex flex-col gap-2" }, Oe = {
10
+ key: 0,
11
+ class: "text-red-500 text-sm mt-1"
12
+ }, qe = { class: "flex flex-col gap-4" }, Ge = { class: "flex flex-col gap-2" }, Je = {
13
+ key: 0,
14
+ class: "text-red-500 text-sm mt-1"
15
+ }, Re = { class: "flex flex-col gap-4" }, Xe = { class: "flex flex-col gap-2" }, He = { class: "flex items-center gap-2 mb-2" }, Ke = { class: "flex items-center gap-2" }, Qe = ["src"], We = {
16
+ key: 0,
17
+ class: "text-red-500 text-sm mt-1"
18
+ }, Ye = /* @__PURE__ */ H({
19
+ __name: "Main",
20
+ setup(J) {
21
+ const z = se("sources"), { errors: b } = Y(), { value: $ } = q("title"), { value: p } = q("description"), { value: y } = q("thumbnail"), { value: V } = q("slug"), I = (f) => {
22
+ y.value = Array.isArray(f) ? f[0] || "" : f;
23
+ };
24
+ function T(f) {
25
+ return f ? f.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^\w\s-]/g, "").trim().replace(/[-\s]+/g, "-") : "";
26
+ }
27
+ return ge($, (f, m) => {
28
+ (!V.value || T(m) === V.value) && (V.value = T(f));
29
+ }), (f, m) => {
30
+ const U = u("Label"), F = u("Input"), B = u("Textarea"), j = u("Button"), D = u("MediaPickerDialog"), G = u("CardContent"), E = u("Card");
31
+ return i(), w(E, null, {
32
+ default: l(() => [
33
+ e(G, { class: "flex flex-col gap-4" }, {
34
+ default: l(() => [
35
+ n("div", Ne, [
36
+ n("div", Be, [
37
+ e(U, {
38
+ for: "title",
39
+ class: "text-sm mb-2"
40
+ }, {
41
+ default: l(() => [...m[6] || (m[6] = [
42
+ C("Title", -1)
43
+ ])]),
44
+ _: 1
45
+ }),
46
+ e(F, {
47
+ type: "text",
48
+ id: "title",
49
+ placeholder: "Summer collection",
50
+ modelValue: o($),
51
+ "onUpdate:modelValue": m[0] || (m[0] = (S) => X($) ? $.value = S : null)
52
+ }, null, 8, ["modelValue"]),
53
+ o(b).title ? (i(), x("p", je, A(o(b).title), 1)) : h("", !0)
54
+ ])
55
+ ]),
56
+ n("div", Le, [
57
+ n("div", Ee, [
58
+ e(U, {
59
+ for: "slug",
60
+ class: "text-sm mb-2"
61
+ }, {
62
+ default: l(() => [...m[7] || (m[7] = [
63
+ C("Slug", -1)
64
+ ])]),
65
+ _: 1
66
+ }),
67
+ e(F, {
68
+ id: "slug",
69
+ placeholder: "summer-collection",
70
+ modelValue: o(V),
71
+ "onUpdate:modelValue": m[1] || (m[1] = (S) => X(V) ? V.value = S : null)
72
+ }, null, 8, ["modelValue"]),
73
+ o(b).slug ? (i(), x("p", Oe, A(o(b).slug), 1)) : h("", !0)
74
+ ])
75
+ ]),
76
+ n("div", qe, [
77
+ n("div", Ge, [
78
+ e(U, {
79
+ for: "description",
80
+ class: "text-sm mb-2"
81
+ }, {
82
+ default: l(() => [...m[8] || (m[8] = [
83
+ C("Description", -1)
84
+ ])]),
85
+ _: 1
86
+ }),
87
+ e(B, {
88
+ id: "description",
89
+ placeholder: "Fresh, vibrant, and bold. The perfect collection for the summer season.",
90
+ modelValue: o(p),
91
+ "onUpdate:modelValue": m[2] || (m[2] = (S) => X(p) ? p.value = S : null)
92
+ }, null, 8, ["modelValue"]),
93
+ o(b).description ? (i(), x("p", Je, A(o(b).description), 1)) : h("", !0)
94
+ ])
95
+ ]),
96
+ n("div", Re, [
97
+ n("div", Xe, [
98
+ n("div", He, [
99
+ e(U, {
100
+ for: "media",
101
+ class: "text-sm"
102
+ }, {
103
+ default: l(() => [...m[9] || (m[9] = [
104
+ C("Thumbnail", -1)
105
+ ])]),
106
+ _: 1
107
+ }),
108
+ o(y) ? (i(), w(j, {
109
+ key: 0,
110
+ variant: "ghost",
111
+ size: "icon",
112
+ onClick: m[3] || (m[3] = (S) => y.value = "")
113
+ }, {
114
+ default: l(() => [
115
+ e(o(ce), { class: "size-4" })
116
+ ]),
117
+ _: 1
118
+ })) : h("", !0)
119
+ ]),
120
+ n("div", Ke, [
121
+ e(D, {
122
+ sources: o(z),
123
+ maxFiles: 1,
124
+ "initial-value": o(y) ? [o(y)] : [],
125
+ onSubmit: m[5] || (m[5] = (S) => I(S))
126
+ }, {
127
+ default: l(() => [
128
+ n("button", {
129
+ onClick: m[4] || (m[4] = ne(() => {
130
+ }, ["stop"])),
131
+ tabindex: "-1",
132
+ class: "cursor-pointer block"
133
+ }, [
134
+ o(y) ? (i(), x("img", {
135
+ key: 1,
136
+ src: o(y),
137
+ class: "size-42 rounded-md object-cover",
138
+ draggable: "false"
139
+ }, null, 8, Qe)) : (i(), w(j, {
140
+ key: 0,
141
+ variant: "outline",
142
+ class: "size-42 border-dashed cursor-pointer"
143
+ }, {
144
+ default: l(() => [
145
+ e(o(W))
146
+ ]),
147
+ _: 1
148
+ }))
149
+ ])
150
+ ]),
151
+ _: 1
152
+ }, 8, ["sources", "initial-value"]),
153
+ o(b).thumbnail ? (i(), x("p", We, A(o(b).thumbnail), 1)) : h("", !0)
154
+ ])
155
+ ])
156
+ ])
157
+ ]),
158
+ _: 1
159
+ })
160
+ ]),
161
+ _: 1
162
+ });
163
+ };
164
+ }
165
+ }), Ze = { class: "flex items-center gap-2" }, et = {
166
+ key: 0,
167
+ class: "size-3 rounded-full bg-green-500"
168
+ }, tt = {
169
+ key: 1,
170
+ class: "size-3 rounded-full bg-blue-500"
171
+ }, lt = /* @__PURE__ */ H({
172
+ __name: "Status",
173
+ setup(J) {
174
+ const { errors: z } = Y(), { value: b } = q("status");
175
+ return ($, p) => {
176
+ const y = u("SelectValue"), V = u("SelectTrigger"), I = u("SelectItem"), T = u("SelectGroup"), f = u("SelectContent"), m = u("Select"), U = u("CardContent"), F = u("Card");
177
+ return i(), w(F, null, {
178
+ default: l(() => [
179
+ e(U, null, {
180
+ default: l(() => [
181
+ p[3] || (p[3] = n("p", { class: "text-md font-semibold mb-2" }, "Status", -1)),
182
+ e(m, {
183
+ modelValue: o(b),
184
+ "onUpdate:modelValue": p[0] || (p[0] = (B) => X(b) ? b.value = B : null),
185
+ class: "w-full"
186
+ }, {
187
+ default: l(() => [
188
+ e(V, { class: "w-full" }, {
189
+ default: l(() => [
190
+ n("div", Ze, [
191
+ o(b) === "published" ? (i(), x("span", et)) : o(b) === "draft" ? (i(), x("span", tt)) : h("", !0),
192
+ e(y, { placeholder: "Status" })
193
+ ])
194
+ ]),
195
+ _: 1
196
+ }),
197
+ e(f, null, {
198
+ default: l(() => [
199
+ e(T, null, {
200
+ default: l(() => [
201
+ e(I, { value: "published" }, {
202
+ default: l(() => [...p[1] || (p[1] = [
203
+ n("span", { class: "size-3 rounded-full bg-green-500" }, null, -1),
204
+ C(" Published ", -1)
205
+ ])]),
206
+ _: 1
207
+ }),
208
+ e(I, { value: "draft" }, {
209
+ default: l(() => [...p[2] || (p[2] = [
210
+ n("span", { class: "size-3 rounded-full bg-blue-500" }, null, -1),
211
+ C(" Draft ", -1)
212
+ ])]),
213
+ _: 1
214
+ })
215
+ ]),
216
+ _: 1
217
+ })
218
+ ]),
219
+ _: 1
220
+ })
221
+ ]),
222
+ _: 1
223
+ }, 8, ["modelValue"])
224
+ ]),
225
+ _: 1
226
+ })
227
+ ]),
228
+ _: 1
229
+ });
230
+ };
231
+ }
232
+ }), ot = { class: "flex items-center justify-between gap-4" }, st = { class: "text-sm text-muted-foreground" }, nt = {
233
+ key: 0,
234
+ class: "border border-dashed rounded-lg p-6 text-center text-sm text-muted-foreground"
235
+ }, at = {
236
+ key: 1,
237
+ class: "flex flex-col gap-3"
238
+ }, it = { class: "flex items-center gap-3 p-3" }, ct = ["onClick"], rt = {
239
+ key: 1,
240
+ class: "size-10 rounded-md border border-dashed flex items-center justify-center text-muted-foreground"
241
+ }, ut = { class: "min-w-0" }, dt = { class: "flex items-center gap-2" }, mt = { class: "font-medium truncate" }, pt = {
242
+ key: 0,
243
+ class: "bg-green-500 text-green-950 px-2 py-1 rounded-lg text-xs"
244
+ }, ft = {
245
+ key: 1,
246
+ class: "bg-blue-500 text-blue-950 px-2 py-1 rounded-lg text-xs"
247
+ }, _t = { class: "flex items-center gap-1" }, gt = {
248
+ key: 0,
249
+ class: "border-t p-4 flex flex-col gap-4"
250
+ }, xt = { class: "grid grid-cols-1 @md:grid-cols-2 gap-4" }, vt = { class: "flex flex-col gap-2" }, bt = {
251
+ key: 0,
252
+ class: "text-red-500 text-sm mt-1"
253
+ }, yt = { class: "flex flex-col gap-2" }, ht = {
254
+ key: 0,
255
+ class: "text-red-500 text-sm mt-1"
256
+ }, Ct = { class: "flex flex-col gap-2" }, St = { class: "flex items-center gap-2" }, wt = {
257
+ key: 0,
258
+ class: "size-3 rounded-full bg-green-500"
259
+ }, kt = {
260
+ key: 1,
261
+ class: "size-3 rounded-full bg-blue-500"
262
+ }, $t = { class: "flex flex-col gap-2" }, zt = { class: "flex flex-col gap-2" }, Vt = { class: "flex items-center gap-2" }, It = ["src"], Tt = /* @__PURE__ */ H({
263
+ __name: "Subcollections",
264
+ setup(J) {
265
+ const z = se("sources"), { errors: b } = Y(), { value: $ } = q("subcollections"), p = ae([]), y = ie(() => (Array.isArray($.value) || ($.value = []), $.value.map(I)));
266
+ function V(a) {
267
+ return a ? a.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/[^\w\s-]/g, "").trim().replace(/[-\s]+/g, "-") : "";
268
+ }
269
+ function I(a) {
270
+ const t = a;
271
+ return t.id || (t.id = crypto.randomUUID()), t.type = "manual", t.status || (t.status = "draft"), t.slug || (t.slug = V(t.title)), delete t.seo, t;
272
+ }
273
+ function T() {
274
+ return {
275
+ id: crypto.randomUUID(),
276
+ title: "",
277
+ type: "manual",
278
+ description: "",
279
+ thumbnail: "",
280
+ slug: "",
281
+ status: "draft"
282
+ };
283
+ }
284
+ function f() {
285
+ return Array.isArray($.value) ? $.value.map(I) : [];
286
+ }
287
+ function m(a) {
288
+ $.value = a;
289
+ }
290
+ function U() {
291
+ const a = T();
292
+ m([...f(), a]), p.value = [a.id];
293
+ }
294
+ function F(a) {
295
+ const t = f(), g = t.findIndex((c) => c.id === a.id), s = JSON.parse(JSON.stringify(a));
296
+ s.id = crypto.randomUUID(), s.type = "manual", s.title = `${s.title || "Untitled subcollection"} (copy)`, s.slug = S(s.slug ? `${s.slug}-copy` : s.title, s.id), delete s.seo;
297
+ const d = [...t];
298
+ d.splice(g + 1, 0, s), m(d), p.value = [s.id];
299
+ }
300
+ function B(a) {
301
+ m(f().filter((t) => t.id !== a)), p.value = p.value.filter((t) => t !== a);
302
+ }
303
+ function j(a, t) {
304
+ const g = f(), s = g.findIndex((v) => v.id === a), d = t === "up" ? s - 1 : s + 1;
305
+ if (s < 0 || d < 0 || d >= g.length) return;
306
+ const c = [...g], [_] = c.splice(s, 1);
307
+ c.splice(d, 0, _), m(c);
308
+ }
309
+ function D(a) {
310
+ p.value = p.value.includes(a) ? p.value.filter((t) => t !== a) : [...p.value, a];
311
+ }
312
+ function G(a, t) {
313
+ const g = a.title;
314
+ a.title = t, (!a.slug || V(g) === a.slug) && (a.slug = S(t, a.id));
315
+ }
316
+ function E(a, t) {
317
+ a.thumbnail = Array.isArray(t) ? t[0] || "" : t;
318
+ }
319
+ function S(a, t) {
320
+ const g = V(a) || "subcollection", s = new Set(
321
+ f().filter((_) => _.id !== t).map((_) => _.slug).filter(Boolean)
322
+ );
323
+ if (!s.has(g)) return g;
324
+ let d = 2, c = `${g}-${d}`;
325
+ for (; s.has(c); )
326
+ d++, c = `${g}-${d}`;
327
+ return c;
328
+ }
329
+ function K(a) {
330
+ a.slug = S(a.slug || a.title, a.id);
331
+ }
332
+ function N(a) {
333
+ return b.value?.[a];
334
+ }
335
+ return (a, t) => {
336
+ const g = u("Button"), s = u("AvatarImage"), d = u("AvatarFallback"), c = u("Avatar"), _ = u("Label"), v = u("Input"), M = u("SelectValue"), Q = u("SelectTrigger"), R = u("SelectItem"), Z = u("SelectGroup"), ue = u("SelectContent"), de = u("Select"), me = u("Textarea"), pe = u("MediaPickerDialog"), fe = u("CardContent"), _e = u("Card");
337
+ return i(), w(_e, null, {
338
+ default: l(() => [
339
+ e(fe, { class: "flex flex-col gap-4" }, {
340
+ default: l(() => [
341
+ n("div", ot, [
342
+ n("div", null, [
343
+ t[1] || (t[1] = n("h3", { class: "text-lg font-semibold" }, "Subcollections", -1)),
344
+ n("p", st, A(y.value.length) + " subcollections", 1)
345
+ ]),
346
+ e(g, {
347
+ variant: "outline",
348
+ onClick: U
349
+ }, {
350
+ default: l(() => [
351
+ e(o(we), { class: "size-4" }),
352
+ t[2] || (t[2] = C(" Add ", -1))
353
+ ]),
354
+ _: 1
355
+ })
356
+ ]),
357
+ y.value.length === 0 ? (i(), x("div", nt, " No subcollections yet. ")) : (i(), x("div", at, [
358
+ (i(!0), x(xe, null, ve(y.value, (r, O) => (i(), x("div", {
359
+ key: r.id,
360
+ class: "border rounded-lg overflow-hidden"
361
+ }, [
362
+ n("div", it, [
363
+ n("button", {
364
+ class: "flex items-center gap-3 min-w-0 flex-1 text-left cursor-pointer",
365
+ onClick: (k) => D(r.id)
366
+ }, [
367
+ r.thumbnail ? (i(), w(c, {
368
+ key: 0,
369
+ class: "size-10 rounded-md"
370
+ }, {
371
+ default: l(() => [
372
+ e(s, {
373
+ src: r.thumbnail,
374
+ class: "object-cover"
375
+ }, null, 8, ["src"]),
376
+ e(d, { class: "rounded-md" })
377
+ ]),
378
+ _: 2
379
+ }, 1024)) : (i(), x("div", rt, [
380
+ e(o(W), { class: "size-4" })
381
+ ])),
382
+ n("div", ut, [
383
+ n("div", dt, [
384
+ n("p", mt, A(r.title || "Untitled subcollection"), 1),
385
+ r.status === "published" ? (i(), x("span", pt, "Published")) : (i(), x("span", ft, "Draft"))
386
+ ])
387
+ ])
388
+ ], 8, ct),
389
+ n("div", _t, [
390
+ e(g, {
391
+ size: "icon",
392
+ variant: "ghost",
393
+ onClick: (k) => j(r.id, "up"),
394
+ disabled: O === 0
395
+ }, {
396
+ default: l(() => [
397
+ e(o(ke), { class: "size-4" })
398
+ ]),
399
+ _: 1
400
+ }, 8, ["onClick", "disabled"]),
401
+ e(g, {
402
+ size: "icon",
403
+ variant: "ghost",
404
+ onClick: (k) => j(r.id, "down"),
405
+ disabled: O === y.value.length - 1
406
+ }, {
407
+ default: l(() => [
408
+ e(o($e), { class: "size-4" })
409
+ ]),
410
+ _: 1
411
+ }, 8, ["onClick", "disabled"]),
412
+ e(g, {
413
+ size: "icon",
414
+ variant: "ghost",
415
+ onClick: (k) => F(r)
416
+ }, {
417
+ default: l(() => [
418
+ e(o(ze), { class: "size-4" })
419
+ ]),
420
+ _: 1
421
+ }, 8, ["onClick"]),
422
+ e(g, {
423
+ size: "icon",
424
+ variant: "ghost",
425
+ onClick: (k) => B(r.id)
426
+ }, {
427
+ default: l(() => [
428
+ e(o(re), { class: "size-4" })
429
+ ]),
430
+ _: 1
431
+ }, 8, ["onClick"]),
432
+ e(g, {
433
+ size: "icon",
434
+ variant: "ghost",
435
+ onClick: (k) => D(r.id)
436
+ }, {
437
+ default: l(() => [
438
+ p.value.includes(r.id) ? (i(), w(o(Ve), {
439
+ key: 0,
440
+ class: "size-4"
441
+ })) : (i(), w(o(Ie), {
442
+ key: 1,
443
+ class: "size-4"
444
+ }))
445
+ ]),
446
+ _: 2
447
+ }, 1032, ["onClick"])
448
+ ])
449
+ ]),
450
+ p.value.includes(r.id) ? (i(), x("div", gt, [
451
+ n("div", xt, [
452
+ n("div", vt, [
453
+ e(_, {
454
+ for: `subcollection-${r.id}-title`,
455
+ class: "text-sm"
456
+ }, {
457
+ default: l(() => [...t[3] || (t[3] = [
458
+ C("Title", -1)
459
+ ])]),
460
+ _: 1
461
+ }, 8, ["for"]),
462
+ e(v, {
463
+ type: "text",
464
+ id: `subcollection-${r.id}-title`,
465
+ placeholder: "Summer dresses",
466
+ "model-value": r.title,
467
+ "onUpdate:modelValue": (k) => G(r, String(k || ""))
468
+ }, null, 8, ["id", "model-value", "onUpdate:modelValue"]),
469
+ N(`subcollections[${O}].title`) ? (i(), x("p", bt, A(N(`subcollections[${O}].title`)), 1)) : h("", !0)
470
+ ]),
471
+ n("div", yt, [
472
+ e(_, {
473
+ for: `subcollection-${r.id}-slug`,
474
+ class: "text-sm"
475
+ }, {
476
+ default: l(() => [...t[4] || (t[4] = [
477
+ C("Slug", -1)
478
+ ])]),
479
+ _: 1
480
+ }, 8, ["for"]),
481
+ e(v, {
482
+ id: `subcollection-${r.id}-slug`,
483
+ placeholder: "summer-dresses",
484
+ modelValue: r.slug,
485
+ "onUpdate:modelValue": (k) => r.slug = k,
486
+ onBlur: (k) => K(r)
487
+ }, null, 8, ["id", "modelValue", "onUpdate:modelValue", "onBlur"]),
488
+ N(`subcollections[${O}].slug`) ? (i(), x("p", ht, A(N(`subcollections[${O}].slug`)), 1)) : h("", !0)
489
+ ])
490
+ ]),
491
+ n("div", Ct, [
492
+ e(_, {
493
+ for: `subcollection-${r.id}-status`,
494
+ class: "text-sm"
495
+ }, {
496
+ default: l(() => [...t[5] || (t[5] = [
497
+ C("Status", -1)
498
+ ])]),
499
+ _: 1
500
+ }, 8, ["for"]),
501
+ e(de, {
502
+ modelValue: r.status,
503
+ "onUpdate:modelValue": (k) => r.status = k
504
+ }, {
505
+ default: l(() => [
506
+ e(Q, {
507
+ id: `subcollection-${r.id}-status`,
508
+ class: "w-full"
509
+ }, {
510
+ default: l(() => [
511
+ n("div", St, [
512
+ r.status === "published" ? (i(), x("span", wt)) : (i(), x("span", kt)),
513
+ e(M, { placeholder: "Status" })
514
+ ])
515
+ ]),
516
+ _: 2
517
+ }, 1032, ["id"]),
518
+ e(ue, null, {
519
+ default: l(() => [
520
+ e(Z, null, {
521
+ default: l(() => [
522
+ e(R, { value: "published" }, {
523
+ default: l(() => [...t[6] || (t[6] = [
524
+ n("span", { class: "size-3 rounded-full bg-green-500" }, null, -1),
525
+ C(" Published ", -1)
526
+ ])]),
527
+ _: 1
528
+ }),
529
+ e(R, { value: "draft" }, {
530
+ default: l(() => [...t[7] || (t[7] = [
531
+ n("span", { class: "size-3 rounded-full bg-blue-500" }, null, -1),
532
+ C(" Draft ", -1)
533
+ ])]),
534
+ _: 1
535
+ })
536
+ ]),
537
+ _: 1
538
+ })
539
+ ]),
540
+ _: 1
541
+ })
542
+ ]),
543
+ _: 2
544
+ }, 1032, ["modelValue", "onUpdate:modelValue"])
545
+ ]),
546
+ n("div", $t, [
547
+ e(_, {
548
+ for: `subcollection-${r.id}-description`,
549
+ class: "text-sm"
550
+ }, {
551
+ default: l(() => [...t[8] || (t[8] = [
552
+ C("Description", -1)
553
+ ])]),
554
+ _: 1
555
+ }, 8, ["for"]),
556
+ e(me, {
557
+ id: `subcollection-${r.id}-description`,
558
+ placeholder: "Fresh, vibrant, and bold. The perfect collection for the summer season.",
559
+ modelValue: r.description,
560
+ "onUpdate:modelValue": (k) => r.description = k
561
+ }, null, 8, ["id", "modelValue", "onUpdate:modelValue"])
562
+ ]),
563
+ n("div", zt, [
564
+ n("div", Vt, [
565
+ e(_, {
566
+ for: `subcollection-${r.id}-media`,
567
+ class: "text-sm"
568
+ }, {
569
+ default: l(() => [...t[9] || (t[9] = [
570
+ C("Thumbnail", -1)
571
+ ])]),
572
+ _: 1
573
+ }, 8, ["for"]),
574
+ r.thumbnail ? (i(), w(g, {
575
+ key: 0,
576
+ variant: "ghost",
577
+ size: "icon",
578
+ onClick: (k) => r.thumbnail = ""
579
+ }, {
580
+ default: l(() => [
581
+ e(o(ce), { class: "size-4" })
582
+ ]),
583
+ _: 1
584
+ }, 8, ["onClick"])) : h("", !0)
585
+ ]),
586
+ e(pe, {
587
+ sources: o(z),
588
+ maxFiles: 1,
589
+ "initial-value": r.thumbnail ? [r.thumbnail] : [],
590
+ onSubmit: (k) => E(r, k)
591
+ }, {
592
+ default: l(() => [
593
+ n("button", {
594
+ onClick: t[0] || (t[0] = ne(() => {
595
+ }, ["stop"])),
596
+ tabindex: "-1",
597
+ class: "cursor-pointer block"
598
+ }, [
599
+ r.thumbnail ? (i(), x("img", {
600
+ key: 1,
601
+ src: r.thumbnail,
602
+ class: "size-32 rounded-md object-cover",
603
+ draggable: "false"
604
+ }, null, 8, It)) : (i(), w(g, {
605
+ key: 0,
606
+ variant: "outline",
607
+ class: "size-32 border-dashed cursor-pointer"
608
+ }, {
609
+ default: l(() => [
610
+ e(o(W))
611
+ ]),
612
+ _: 1
613
+ }))
614
+ ])
615
+ ]),
616
+ _: 2
617
+ }, 1032, ["sources", "initial-value", "onSubmit"])
618
+ ])
619
+ ])) : h("", !0)
620
+ ]))), 128))
621
+ ]))
622
+ ]),
623
+ _: 1
624
+ })
625
+ ]),
626
+ _: 1
627
+ });
628
+ };
629
+ }
630
+ }), Ut = { class: "relative @container" }, Dt = { class: "flex flex-row gap-4 justify-between max-w-5xl mx-auto mt-4 mb-6" }, Mt = { class: "flex items-center" }, At = { class: "text-lg font-semibold mx-2" }, Pt = {
631
+ key: 0,
632
+ class: "bg-green-500 text-green-950 px-2 py-1 rounded-lg text-xs"
633
+ }, Ft = {
634
+ key: 1,
635
+ class: "bg-blue-500 text-blue-950 px-2 py-1 rounded-lg text-xs"
636
+ }, Nt = { class: "flex flex-col @3xl:flex-row gap-4 max-w-5xl mx-auto pb-24" }, Bt = { class: "flex flex-col gap-4 w-full @3xl:w-2/3" }, jt = { class: "flex flex-col gap-4 w-full @3xl:w-1/3" }, Lt = {
637
+ key: 0,
638
+ class: "fixed bottom-4 left-0 md:left-12 right-0 min-w-xs max-w-5xl w-[calc(100%-2rem)] md:w-[calc(100%-5rem)] xl:w-[calc(100%-2rem)] h-16 border border-white/10 backdrop-blur-sm border-t border-border flex items-center justify-center px-4 mx-auto z-[9999] rounded-xl overflow-hidden shadow bg-[radial-gradient(#ffffff80,transparent)] dark:bg-[radial-gradient(#00000080,transparent)]"
639
+ }, Et = { class: "w-full max-w-5xl flex items-center justify-end mx-auto" }, Xt = /* @__PURE__ */ H({
640
+ __name: "Detail",
641
+ props: {
642
+ config: {
643
+ type: Object,
644
+ required: !0
645
+ }
646
+ },
647
+ setup(J) {
648
+ const z = J, { hasPermission: b, hasAnyPermission: $ } = De(), { params: p, navigateTo: y } = Me(), { confirm: V } = Ae(), I = Pe(z.config.project);
649
+ ee("sources", z.config.allowedMediaSources), ee("defaultSource", z.config.defaultUploadMediaSource);
650
+ const T = ie(() => !p.value.collectionId || p.value.collectionId === "new"), f = ae(!1), m = te({
651
+ field: P(),
652
+ operator: he(["==", "!=", "<", ">", "<=", ">=", "in", "not-in", "array-contains", "array-contains-any"]),
653
+ value: ye()
654
+ }), U = te({
655
+ title: P().min(1, "Title is required"),
656
+ type: P(),
657
+ description: P().optional(),
658
+ thumbnail: P().optional(),
659
+ slug: P(),
660
+ conditions: le(m).optional(),
661
+ status: P()
662
+ }), F = U.extend({
663
+ id: P().min(1, "ID is required")
664
+ }), B = Ce(U.extend({
665
+ id: P().optional(),
666
+ subcollections: le(F).optional()
667
+ })), { handleSubmit: j, values: D, setValues: G } = Se({
668
+ validationSchema: B,
669
+ initialValues: {
670
+ status: "draft",
671
+ type: "manual",
672
+ subcollections: []
673
+ }
674
+ });
675
+ Fe(() => [
676
+ { text: T.value ? "New Collection" : D.title || "Collection" }
677
+ ]);
678
+ const E = j(async (s) => {
679
+ f.value = !0;
680
+ let d = await S() || [];
681
+ if (T.value) {
682
+ let c = N(s);
683
+ if (c.id = crypto.randomUUID(), await g(c.slug)) {
684
+ L.error("Collection with this slug already exists"), f.value = !1;
685
+ return;
686
+ }
687
+ const _ = [...d, c], v = z.config.collectionsCollection.split(":");
688
+ await I.update(v[0], null, { [v[1]]: _ }), y("/"), L.success("Collection created");
689
+ } else {
690
+ let c = N(s);
691
+ const _ = d.map((M) => M.id === p.value.collectionId ? c : M), v = z.config.collectionsCollection.split(":");
692
+ await I.update(v[0], null, { [v[1]]: _ }), y("/"), L.success("Collection updated");
693
+ }
694
+ f.value = !1;
695
+ }), S = async () => {
696
+ if (!z.config.collectionsCollection) return [];
697
+ const s = z.config.collectionsCollection.split(":");
698
+ return s.length !== 2 ? [] : (await I.get(s[0]))?.[s[1]] || [];
699
+ }, K = async () => {
700
+ const d = (await S()).find((c) => c.id === p.value.collectionId);
701
+ G(d);
702
+ }, N = (s, d = !1) => {
703
+ const c = JSON.parse(JSON.stringify(s));
704
+ return c.type ||= "manual", c.status ||= "draft", delete c.seo, c.subcollections = (c.subcollections || []).map((_) => {
705
+ const v = {
706
+ ..._,
707
+ id: d || !_.id ? crypto.randomUUID() : _.id,
708
+ type: "manual",
709
+ status: _.status || "draft",
710
+ slug: _.slug || ""
711
+ };
712
+ return delete v.seo, delete v.subcollections, v;
713
+ }), c;
714
+ }, a = async () => {
715
+ try {
716
+ let s = N(D, !0), d = s.slug + "-copy", c = 2;
717
+ for (; await g(d); )
718
+ d = s.slug + "-copy-" + c, c++;
719
+ s.id = crypto.randomUUID(), s.slug = d, s.status = "draft", s.title = s.title + " (copy)";
720
+ const v = [...await S() || [], s], M = z.config.collectionsCollection.split(":");
721
+ await I.update(M[0], null, { [M[1]]: v }), y(s.id), L.success("Collection duplicated");
722
+ } catch {
723
+ L.error("Failed to duplicate collection");
724
+ }
725
+ }, t = async () => {
726
+ const s = Array.isArray(D.subcollections) && D.subcollections.length > 0;
727
+ if (await V(
728
+ s ? "Are you sure you want to delete this collection? All subcollections will also be deleted." : "Are you sure you want to delete this collection?"
729
+ ))
730
+ try {
731
+ const c = await S() || [];
732
+ if (c.length === 0 || !p.value.collectionId) throw new Error("Error loading values");
733
+ const _ = c.filter((M) => M.id !== p.value.collectionId), v = z.config.collectionsCollection.split(":");
734
+ await I.update(v[0], null, { [v[1]]: _ }), y(""), L.success("Collection deleted");
735
+ } catch {
736
+ L.error("Failed to delete collection");
737
+ }
738
+ }, g = async (s) => !!(await S() || []).find((c) => c.slug === s);
739
+ return be(() => {
740
+ T.value || K();
741
+ }), (s, d) => {
742
+ const c = u("Button"), _ = u("MenubarTrigger"), v = u("MenubarMenu"), M = u("MenubarItem"), Q = u("MenubarContent"), R = u("Menubar");
743
+ return i(), x("div", Ut, [
744
+ n("div", Dt, [
745
+ n("div", Mt, [
746
+ e(c, {
747
+ variant: "ghost",
748
+ onClick: d[0] || (d[0] = (Z) => o(y)(""))
749
+ }, {
750
+ default: l(() => [
751
+ e(o(Te), { class: "size-4" })
752
+ ]),
753
+ _: 1
754
+ }),
755
+ e(o(Ue), { class: "size-3" }),
756
+ n("h1", At, A(T.value ? "New Collection" : o(D).title), 1),
757
+ o(D).status === "published" ? (i(), x("span", Pt, "Published")) : o(D).status === "draft" ? (i(), x("span", Ft, "Draft")) : h("", !0)
758
+ ]),
759
+ T.value ? h("", !0) : (i(), w(R, {
760
+ key: 0,
761
+ class: "bg-sidebar"
762
+ }, {
763
+ default: l(() => [
764
+ o(b)("create-collection") ? (i(), w(v, { key: 0 }, {
765
+ default: l(() => [
766
+ e(_, { onClick: a }, {
767
+ default: l(() => [...d[1] || (d[1] = [
768
+ C("Duplicate", -1)
769
+ ])]),
770
+ _: 1
771
+ })
772
+ ]),
773
+ _: 1
774
+ })) : h("", !0),
775
+ o($)("edit-collection", "delete-collection") ? (i(), w(v, { key: 1 }, {
776
+ default: l(() => [
777
+ e(_, null, {
778
+ default: l(() => [...d[2] || (d[2] = [
779
+ C("More actions", -1)
780
+ ])]),
781
+ _: 1
782
+ }),
783
+ e(Q, null, {
784
+ default: l(() => [
785
+ o(b)("delete-collection") ? (i(), w(M, {
786
+ key: 0,
787
+ variant: "destructive",
788
+ onClick: t
789
+ }, {
790
+ default: l(() => [
791
+ e(o(re), { class: "size-4" }),
792
+ d[3] || (d[3] = C(" Delete collection ", -1))
793
+ ]),
794
+ _: 1
795
+ })) : h("", !0)
796
+ ]),
797
+ _: 1
798
+ })
799
+ ]),
800
+ _: 1
801
+ })) : h("", !0)
802
+ ]),
803
+ _: 1
804
+ }))
805
+ ]),
806
+ n("div", Nt, [
807
+ n("div", Bt, [
808
+ e(Ye),
809
+ e(Tt)
810
+ ]),
811
+ n("div", jt, [
812
+ e(lt)
813
+ ])
814
+ ]),
815
+ o($)("create-collection", "edit-collection") ? (i(), x("div", Lt, [
816
+ n("div", Et, [
817
+ T.value && o(b)("create-collection") ? (i(), w(c, {
818
+ key: 0,
819
+ onClick: o(E),
820
+ disabled: f.value
821
+ }, {
822
+ default: l(() => [
823
+ f.value ? (i(), w(o(oe), {
824
+ key: 0,
825
+ class: "size-4 animate-spin"
826
+ })) : h("", !0),
827
+ C(" " + A(f.value ? "Creating" : "Create") + " New Collection ", 1)
828
+ ]),
829
+ _: 1
830
+ }, 8, ["onClick", "disabled"])) : o(b)("edit-collection") ? (i(), w(c, {
831
+ key: 1,
832
+ onClick: o(E),
833
+ disabled: f.value
834
+ }, {
835
+ default: l(() => [
836
+ f.value ? (i(), w(o(oe), {
837
+ key: 0,
838
+ class: "size-4 animate-spin"
839
+ })) : h("", !0),
840
+ C(" " + A(f.value ? "Saving" : "Save") + " Changes ", 1)
841
+ ]),
842
+ _: 1
843
+ }, 8, ["onClick", "disabled"])) : h("", !0)
844
+ ])
845
+ ])) : h("", !0)
846
+ ]);
847
+ };
848
+ }
849
+ });
850
+ export {
851
+ Xt as default
852
+ };