@oneclick.dev/cms-core-modules 0.0.53 → 0.0.54
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.
- package/dist/CalendarDate-CRT2Viyt.mjs +830 -0
- package/dist/CalendarDate-CWtpXgpD.js +1 -0
- package/dist/Components-D9yIIosM.mjs +623 -0
- package/dist/Components-DXbx0RLV.js +1 -0
- package/dist/ContentEditor-DRJFQKCv.mjs +34915 -0
- package/dist/ContentEditor-DzTi8fSZ.js +290 -0
- package/dist/Create-BP8TX6rj.js +1 -0
- package/dist/Create-Bwf1RXdG.mjs +1248 -0
- package/dist/DateFormatter-BbcSwTs4.js +1 -0
- package/dist/DateFormatter-CbO0PVUK.mjs +99 -0
- package/dist/Detail-B-PnkcXD.mjs +3473 -0
- package/dist/Detail-BVlGSjOq.mjs +380 -0
- package/dist/Detail-C4E1T87K.mjs +26 -0
- package/dist/Detail-CNfTDUE5.js +1 -0
- package/dist/Detail-Cd5CBVN0.js +1 -0
- package/dist/Detail-CpfOQChd.mjs +585 -0
- package/dist/Detail-CwagT6gQ.mjs +650 -0
- package/dist/Detail-DUo6qKqO.js +1 -0
- package/dist/Detail-Dd_OkpcN.js +1 -0
- package/dist/Detail-mvSGbnFU.js +1 -0
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-BWuKVkvV.js +1 -0
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-D0-EcU0_.mjs +55 -0
- package/dist/Entries-DcpPvlYj.js +1 -0
- package/dist/Entries-QLMtTYLX.mjs +713 -0
- package/dist/Find-BPR0uU-Z.mjs +229 -0
- package/dist/Find-BidEQJxT.js +1 -0
- package/dist/GlobalStyling-CMzPRd18.js +17 -0
- package/dist/GlobalStyling-DoLHUJeV.mjs +988 -0
- package/dist/Overview-BDlBCUI_.js +1 -0
- package/dist/Overview-BH3NwvNX.mjs +26 -0
- package/dist/Overview-BLsZMHNW.mjs +178 -0
- package/dist/Overview-BNMZ9MUK.js +1 -0
- package/dist/Overview-BbvfH1u-.js +1 -0
- package/dist/Overview-CDN88OSM.mjs +190 -0
- package/dist/Overview-CEPodGCn.mjs +311 -0
- package/dist/Overview-CvquDPhB.js +1 -0
- package/dist/Overview-D54pjmI6.mjs +633 -0
- package/dist/Overview-D67UjG6n.mjs +947 -0
- package/dist/Overview-KT2Mgfh5.js +1 -0
- package/dist/Overview-T-lsy3UZ.js +1 -0
- package/dist/RegularSlotEditor.vue_vue_type_script_setup_true_lang-0xZSq0rx.js +1 -0
- package/dist/RegularSlotEditor.vue_vue_type_script_setup_true_lang-Bj_PVLLV.mjs +392 -0
- package/dist/TableView-CpO53xcX.js +111 -0
- package/dist/TableView-D9J5rUls.mjs +72921 -0
- package/dist/TemplateList.vue_vue_type_script_setup_true_lang-B_AtWnHa.js +1 -0
- package/dist/TemplateList.vue_vue_type_script_setup_true_lang-BiLAkhIA.mjs +40 -0
- package/dist/View-DlHBZbFu.js +1 -0
- package/dist/View-Dv5QMrSn.mjs +25 -0
- package/dist/_plugin-vue_export-helper-BHFhmbuH.js +1 -0
- package/dist/_plugin-vue_export-helper-CHgC5LLL.mjs +9 -0
- package/dist/agenda-B49oKGeh.mjs +706 -0
- package/dist/agenda-DipQ5IWP.js +1 -0
- package/dist/availability-C7q9tq6l.js +1 -0
- package/dist/availability-DeCkqiu8.mjs +613 -0
- package/dist/cms-core-modules.css +1 -1
- package/dist/countries-BTPvmrsb.mjs +4 -0
- package/dist/countries-CgZ081No.js +1 -0
- package/dist/exceptions-D3b18TiY.mjs +647 -0
- package/dist/exceptions-DJ9zWX3k.js +1 -0
- package/dist/floating-ui.dom-C82nbomj.js +1 -0
- package/dist/floating-ui.dom-ouSgPqty.mjs +1133 -0
- package/dist/google-CvtuJwgk.mjs +4 -0
- package/dist/google-D4N3gb01.js +1 -0
- package/dist/index--jjEzba7.mjs +24 -0
- package/dist/index-9HVlmvK3.js +1 -0
- package/dist/index-BEGU8Kme.mjs +12 -0
- package/dist/index-Bwi1mtkq.mjs +24 -0
- package/dist/index-BzuHN-r8.mjs +24 -0
- package/dist/index-CImCyE3L.mjs +24 -0
- package/dist/index-CKPshlZ8-BQiiP6r_.mjs +1264 -0
- package/dist/index-CKPshlZ8-CIz1tDwX.js +1 -0
- package/dist/index-CQiY-oTN.mjs +24 -0
- package/dist/index-CSxYBeVA.js +1 -0
- package/dist/index-CkiNvRzs.js +1 -0
- package/dist/index-Co4ON2Di.js +1 -0
- package/dist/index-CwqrAU-H.js +1 -0
- package/dist/index-Cz-baGax.js +1 -0
- package/dist/index-D2a6wEPh.js +1 -0
- package/dist/index-DFQGVHTs.js +1 -0
- package/dist/index-DI6mydpm.mjs +138 -0
- package/dist/index-DMoyoaks.mjs +22 -0
- package/dist/index-DT1wWnUk.mjs +24 -0
- package/dist/index-DUeFrD-B.js +1 -0
- package/dist/index-DsnoK4ia.mjs +579 -0
- package/dist/index-R2oUDsjx.js +1 -0
- package/dist/index-RLz1QPrf.mjs +203 -0
- package/dist/index-UtjLbLw-.js +1 -0
- package/dist/index-_mG-aU3Z.mjs +87 -0
- package/dist/index-_sQDF1pH.js +1 -0
- package/dist/index-ijdf0d9-.js +1 -0
- package/dist/index-klI238nT.mjs +24 -0
- package/dist/index.cjs.js +1 -330
- package/dist/index.mjs +287 -69051
- package/dist/interpolation-BNUjI7LH.js +1 -0
- package/dist/interpolation-BpGXqOz8.mjs +59 -0
- package/dist/payment-kTjsV0Jj.js +1 -0
- package/dist/payment-zpCM0LD-.mjs +981 -0
- package/dist/regular-C4_3YXqx.mjs +602 -0
- package/dist/regular-DFwPEbZO.js +1 -0
- package/dist/regular-slots-4ooEpICB.mjs +67 -0
- package/dist/regular-slots-BAVGbomI.js +1 -0
- package/dist/resources-MpQkSstv.mjs +563 -0
- package/dist/resources-iM28T3dD.js +1 -0
- package/dist/src/appointments/index.d.ts +4 -28
- package/dist/src/appointments/routes.d.ts +3 -9
- package/dist/src/content-manager/index.d.ts +5 -147
- package/dist/src/content-manager/routes.d.ts +4 -128
- package/dist/src/custom/index.d.ts +2 -2
- package/dist/src/custom/routes.d.ts +1 -1
- package/dist/src/mail-templates/index.d.ts +2 -30
- package/dist/src/mail-templates/routes.d.ts +1 -11
- package/dist/src/product-collections/index.d.ts +2 -30
- package/dist/src/product-collections/routes.d.ts +1 -11
- package/dist/src/products/index.d.ts +2 -30
- package/dist/src/products/routes.d.ts +1 -11
- package/dist/src/promo-codes/index.d.ts +2 -30
- package/dist/src/promo-codes/routes.d.ts +1 -11
- package/dist/src/shipping-options/index.d.ts +2 -30
- package/dist/src/shipping-options/routes.d.ts +1 -11
- package/dist/src/table/index.d.ts +2 -70
- package/dist/src/table/routes.d.ts +1 -51
- package/dist/utils-BVKy9S2J.mjs +29 -0
- package/dist/utils-D6CaKJbp.js +2 -0
- package/dist/vee-validate-zod-BPQyEfpF.js +1 -0
- package/dist/vee-validate-zod-IXkfh-6Q.mjs +4402 -0
- package/package.json +3 -3
|
@@ -0,0 +1,650 @@
|
|
|
1
|
+
import { defineComponent as B, inject as Q, ref as R, resolveComponent as a, createBlock as O, openBlock as d, withCtx as s, createVNode as n, createElementVNode as o, createElementBlock as b, createCommentVNode as f, createTextVNode as v, unref as e, isRef as N, toDisplayString as _, watch as ee, Fragment as X, renderList as H, normalizeClass as te, computed as oe, onMounted as ne, provide as se } from "vue";
|
|
2
|
+
import { u as W, a as S, t as le, o as ie, p as J, s as F, b as ae, e as q, f as de } from "./vee-validate-zod-IXkfh-6Q.mjs";
|
|
3
|
+
import { r as j } from "./countries-BTPvmrsb.mjs";
|
|
4
|
+
import { ChevronsUpDown as re, Search as ce, Check as ue, X as pe, Tag as me, ChevronRight as fe, Trash as _e, Loader2 as K } from "lucide-vue-next";
|
|
5
|
+
import { useModulePermissions as xe, useModuleRoute as ve, useConfirmation as be, useFirebaseIntegration as ge, useModuleBreadcrumbs as he } from "@oneclick.dev/cms-kit";
|
|
6
|
+
import { t as E } from "./index-RLz1QPrf.mjs";
|
|
7
|
+
const Ce = { class: "flex flex-col gap-4" }, we = { class: "flex flex-col gap-2" }, ye = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "text-red-500 text-sm mt-1"
|
|
10
|
+
}, ke = { class: "flex flex-col gap-4" }, $e = { class: "flex flex-col gap-2" }, Oe = {
|
|
11
|
+
key: 0,
|
|
12
|
+
class: "text-red-500 text-sm mt-1"
|
|
13
|
+
}, Ve = { class: "flex flex-col gap-4" }, Ie = { class: "flex flex-col gap-2" }, Me = {
|
|
14
|
+
key: 0,
|
|
15
|
+
class: "text-red-500 text-sm mt-1"
|
|
16
|
+
}, Se = /* @__PURE__ */ B({
|
|
17
|
+
__name: "Main",
|
|
18
|
+
setup(P) {
|
|
19
|
+
const x = Q("isLoadingCompleted", R(!1)), { errors: l } = W(), { value: p } = S("title"), { value: i } = S("description"), { value: r } = S("price");
|
|
20
|
+
return (g, t) => {
|
|
21
|
+
const m = a("Label"), h = a("Input"), C = a("Textarea"), I = a("CardContent"), z = a("Card");
|
|
22
|
+
return d(), O(z, null, {
|
|
23
|
+
default: s(() => [
|
|
24
|
+
n(I, { class: "flex flex-col gap-4" }, {
|
|
25
|
+
default: s(() => [
|
|
26
|
+
o("div", Ce, [
|
|
27
|
+
o("div", we, [
|
|
28
|
+
n(m, {
|
|
29
|
+
for: "title",
|
|
30
|
+
class: "text-sm"
|
|
31
|
+
}, {
|
|
32
|
+
default: s(() => [...t[3] || (t[3] = [
|
|
33
|
+
v("Name", -1)
|
|
34
|
+
])]),
|
|
35
|
+
_: 1
|
|
36
|
+
}),
|
|
37
|
+
n(h, {
|
|
38
|
+
type: "text",
|
|
39
|
+
id: "title",
|
|
40
|
+
placeholder: e(x) ? "Fast shipping" : "",
|
|
41
|
+
modelValue: e(p),
|
|
42
|
+
"onUpdate:modelValue": t[0] || (t[0] = (M) => N(p) ? p.value = M : null)
|
|
43
|
+
}, null, 8, ["placeholder", "modelValue"]),
|
|
44
|
+
e(l).title ? (d(), b("p", ye, _(e(l).title), 1)) : f("", !0)
|
|
45
|
+
])
|
|
46
|
+
]),
|
|
47
|
+
o("div", ke, [
|
|
48
|
+
o("div", $e, [
|
|
49
|
+
n(m, {
|
|
50
|
+
for: "description",
|
|
51
|
+
class: "text-sm"
|
|
52
|
+
}, {
|
|
53
|
+
default: s(() => [...t[4] || (t[4] = [
|
|
54
|
+
v("Description (optional)", -1)
|
|
55
|
+
])]),
|
|
56
|
+
_: 1
|
|
57
|
+
}),
|
|
58
|
+
n(C, {
|
|
59
|
+
id: "description",
|
|
60
|
+
placeholder: e(x) ? "Ships next day" : "",
|
|
61
|
+
modelValue: e(i),
|
|
62
|
+
"onUpdate:modelValue": t[1] || (t[1] = (M) => N(i) ? i.value = M : null)
|
|
63
|
+
}, null, 8, ["placeholder", "modelValue"]),
|
|
64
|
+
e(l).description ? (d(), b("p", Oe, _(e(l).description), 1)) : f("", !0)
|
|
65
|
+
])
|
|
66
|
+
]),
|
|
67
|
+
o("div", Ve, [
|
|
68
|
+
o("div", Ie, [
|
|
69
|
+
n(m, {
|
|
70
|
+
for: "price",
|
|
71
|
+
class: "text-sm"
|
|
72
|
+
}, {
|
|
73
|
+
default: s(() => [...t[5] || (t[5] = [
|
|
74
|
+
v("Price", -1)
|
|
75
|
+
])]),
|
|
76
|
+
_: 1
|
|
77
|
+
}),
|
|
78
|
+
n(h, {
|
|
79
|
+
type: "number",
|
|
80
|
+
min: "0",
|
|
81
|
+
id: "price",
|
|
82
|
+
placeholder: e(x) ? "Free" : "",
|
|
83
|
+
modelValue: e(r),
|
|
84
|
+
"onUpdate:modelValue": t[2] || (t[2] = (M) => N(r) ? r.value = M : null),
|
|
85
|
+
class: "no-spinner"
|
|
86
|
+
}, null, 8, ["placeholder", "modelValue"]),
|
|
87
|
+
e(l).price ? (d(), b("p", Me, _(e(l).price), 1)) : f("", !0)
|
|
88
|
+
])
|
|
89
|
+
])
|
|
90
|
+
]),
|
|
91
|
+
_: 1
|
|
92
|
+
})
|
|
93
|
+
]),
|
|
94
|
+
_: 1
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
}), Ne = { class: "flex flex-col gap-4" }, Le = { class: "flex flex-col gap-2" }, Te = { class: "truncate" }, ze = { class: "relative w-full max-w-sm items-center" }, Ue = { class: "absolute start-0 inset-y-0 flex items-center justify-center px-3" }, Fe = { class: "truncate" }, je = {
|
|
99
|
+
key: 0,
|
|
100
|
+
class: "text-red-500 text-sm mt-1"
|
|
101
|
+
}, Ee = { key: 0 }, Pe = { class: "group flex items-center gap-2 bg-muted/50 rounded-md mb-1 p-2" }, Be = { class: "w-6" }, De = { class: "text-muted-foreground group-hover:text-black dark:group-hover:text-white" }, Re = /* @__PURE__ */ B({
|
|
102
|
+
__name: "Countries",
|
|
103
|
+
setup(P) {
|
|
104
|
+
const { errors: x } = W(), { value: l } = S("countries");
|
|
105
|
+
return ee(l, (p) => {
|
|
106
|
+
let i = p?.sort((g, t) => !g || !t ? 0 : j.find((m) => m.cca2 === g)?.name.common.localeCompare(j.find((m) => m.cca2 === t)?.name.common)), r = !0;
|
|
107
|
+
for (let g = 0; g < p.length; g++)
|
|
108
|
+
if (p[g] !== l.value[g]) {
|
|
109
|
+
r = !1;
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
r || (l.value = i);
|
|
113
|
+
}), (p, i) => {
|
|
114
|
+
const r = a("Label"), g = a("Button"), t = a("ComboboxTrigger"), m = a("ComboboxAnchor"), h = a("ComboboxInput"), C = a("ComboboxEmpty"), I = a("ComboboxItemIndicator"), z = a("ComboboxItem"), M = a("ComboboxGroup"), w = a("ComboboxList"), G = a("Combobox"), D = a("CardContent"), U = a("Card");
|
|
115
|
+
return d(), O(U, null, {
|
|
116
|
+
default: s(() => [
|
|
117
|
+
n(D, { class: "flex flex-col gap-4" }, {
|
|
118
|
+
default: s(() => [
|
|
119
|
+
i[3] || (i[3] = o("h3", { class: "text-lg font-semibold mb-4" }, "Countries", -1)),
|
|
120
|
+
o("div", Ne, [
|
|
121
|
+
o("div", Le, [
|
|
122
|
+
n(r, { class: "text-sm mb-2" }, {
|
|
123
|
+
default: s(() => [...i[1] || (i[1] = [
|
|
124
|
+
v("For which countries should this option be available?", -1)
|
|
125
|
+
])]),
|
|
126
|
+
_: 1
|
|
127
|
+
}),
|
|
128
|
+
n(G, {
|
|
129
|
+
modelValue: e(l),
|
|
130
|
+
"onUpdate:modelValue": i[0] || (i[0] = (y) => N(l) ? l.value = y : null),
|
|
131
|
+
multiple: !0
|
|
132
|
+
}, {
|
|
133
|
+
default: s(() => [
|
|
134
|
+
n(m, { "as-child": "" }, {
|
|
135
|
+
default: s(() => [
|
|
136
|
+
n(t, { "as-child": "" }, {
|
|
137
|
+
default: s(() => [
|
|
138
|
+
n(g, {
|
|
139
|
+
variant: "outline",
|
|
140
|
+
class: "justify-between"
|
|
141
|
+
}, {
|
|
142
|
+
default: s(() => [
|
|
143
|
+
o("span", Te, _(e(l)?.length > 0 ? e(l).slice(0, 4).map((y) => e(j).find((L) => L.cca2 === y)?.name.common).join(", ") : "Select countries"), 1),
|
|
144
|
+
n(e(re), { class: "ml-2 size-4 shrink-0 opacity-50" })
|
|
145
|
+
]),
|
|
146
|
+
_: 1
|
|
147
|
+
})
|
|
148
|
+
]),
|
|
149
|
+
_: 1
|
|
150
|
+
})
|
|
151
|
+
]),
|
|
152
|
+
_: 1
|
|
153
|
+
}),
|
|
154
|
+
n(w, null, {
|
|
155
|
+
default: s(() => [
|
|
156
|
+
o("div", ze, [
|
|
157
|
+
n(h, {
|
|
158
|
+
class: "pl-9 focus-visible:ring-0 border-0 border-b rounded-none h-10",
|
|
159
|
+
placeholder: "Find country..."
|
|
160
|
+
}),
|
|
161
|
+
o("span", Ue, [
|
|
162
|
+
n(e(ce), { class: "size-4 text-muted-foreground" })
|
|
163
|
+
])
|
|
164
|
+
]),
|
|
165
|
+
n(C, null, {
|
|
166
|
+
default: s(() => [...i[2] || (i[2] = [
|
|
167
|
+
v(" No countries found. ", -1)
|
|
168
|
+
])]),
|
|
169
|
+
_: 1
|
|
170
|
+
}),
|
|
171
|
+
n(M, { class: "max-h-72 overflow-y-scroll" }, {
|
|
172
|
+
default: s(() => [
|
|
173
|
+
(d(!0), b(X, null, H(e(j), (y) => (d(), O(z, {
|
|
174
|
+
key: y.cca2,
|
|
175
|
+
value: y.cca2
|
|
176
|
+
}, {
|
|
177
|
+
default: s(() => [
|
|
178
|
+
v(_(y.flag) + " ", 1),
|
|
179
|
+
o("span", Fe, _(y.name.common), 1),
|
|
180
|
+
n(I, null, {
|
|
181
|
+
default: s(() => [
|
|
182
|
+
n(e(ue), { class: "size-4" })
|
|
183
|
+
]),
|
|
184
|
+
_: 1
|
|
185
|
+
})
|
|
186
|
+
]),
|
|
187
|
+
_: 2
|
|
188
|
+
}, 1032, ["value"]))), 128))
|
|
189
|
+
]),
|
|
190
|
+
_: 1
|
|
191
|
+
})
|
|
192
|
+
]),
|
|
193
|
+
_: 1
|
|
194
|
+
})
|
|
195
|
+
]),
|
|
196
|
+
_: 1
|
|
197
|
+
}, 8, ["modelValue"]),
|
|
198
|
+
e(x).countries ? (d(), b("p", je, _(e(x).countries), 1)) : f("", !0)
|
|
199
|
+
])
|
|
200
|
+
]),
|
|
201
|
+
e(l)?.length > 0 ? (d(), b("div", Ee, [
|
|
202
|
+
(d(!0), b(X, null, H(e(l), (y) => (d(), b("div", Pe, [
|
|
203
|
+
o("div", Be, _(e(j).find((L) => L.cca2 === y)?.flag), 1),
|
|
204
|
+
o("p", De, _(e(j).find((L) => L.cca2 === y)?.name.common), 1),
|
|
205
|
+
n(g, {
|
|
206
|
+
variant: "ghost",
|
|
207
|
+
size: "icon",
|
|
208
|
+
onClick: (L) => l.value = e(l).filter((A) => A !== y),
|
|
209
|
+
class: "hidden group-hover:flex ml-auto size-6"
|
|
210
|
+
}, {
|
|
211
|
+
default: s(() => [
|
|
212
|
+
n(e(pe), { class: "size-3" })
|
|
213
|
+
]),
|
|
214
|
+
_: 1
|
|
215
|
+
}, 8, ["onClick"])
|
|
216
|
+
]))), 256))
|
|
217
|
+
])) : f("", !0)
|
|
218
|
+
]),
|
|
219
|
+
_: 1
|
|
220
|
+
})
|
|
221
|
+
]),
|
|
222
|
+
_: 1
|
|
223
|
+
});
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
}), Ge = { class: "flex items-center space-x-2" }, Ae = { class: "flex items-center space-x-2" }, Je = { class: "flex items-center space-x-2" }, qe = {
|
|
227
|
+
key: 0,
|
|
228
|
+
class: "flex gap-2 w-full mt-4"
|
|
229
|
+
}, We = { class: "flex flex-col gap-4 w-full" }, Xe = { class: "flex flex-col gap-2" }, He = { class: "relative" }, Ke = {
|
|
230
|
+
key: 0,
|
|
231
|
+
class: "text-red-500 text-sm mt-1"
|
|
232
|
+
}, Qe = { class: "flex flex-col gap-4 w-full" }, Ye = { class: "flex flex-col gap-2" }, Ze = { class: "relative" }, et = {
|
|
233
|
+
key: 0,
|
|
234
|
+
class: "text-red-500 text-sm mt-1"
|
|
235
|
+
}, tt = {
|
|
236
|
+
key: 1,
|
|
237
|
+
class: "flex gap-2 w-full mt-4"
|
|
238
|
+
}, ot = { class: "flex flex-col gap-4 w-full" }, nt = { class: "flex flex-col gap-2" }, st = { class: "relative" }, lt = {
|
|
239
|
+
key: 0,
|
|
240
|
+
class: "text-red-500 text-sm mt-1"
|
|
241
|
+
}, it = { class: "flex flex-col gap-4 w-full" }, at = { class: "flex flex-col gap-2" }, dt = { class: "relative" }, rt = {
|
|
242
|
+
key: 0,
|
|
243
|
+
class: "text-red-500 text-sm mt-1"
|
|
244
|
+
}, ct = /* @__PURE__ */ B({
|
|
245
|
+
__name: "Condition",
|
|
246
|
+
setup(P) {
|
|
247
|
+
const x = Q("isLoadingCompleted", R(!1)), { errors: l } = W(), { value: p } = S("condition"), { value: i } = S("condition_min"), { value: r } = S("condition_max");
|
|
248
|
+
return (g, t) => {
|
|
249
|
+
const m = a("RadioGroupItem"), h = a("Label"), C = a("RadioGroup"), I = a("Input"), z = a("CardContent"), M = a("Card");
|
|
250
|
+
return d(), O(M, null, {
|
|
251
|
+
default: s(() => [
|
|
252
|
+
n(z, { class: "flex flex-col gap-4" }, {
|
|
253
|
+
default: s(() => [
|
|
254
|
+
t[16] || (t[16] = o("h3", { class: "text-lg font-semibold mb-4" }, "Condition", -1)),
|
|
255
|
+
t[17] || (t[17] = o("p", null, " Specify when this option should be available ", -1)),
|
|
256
|
+
n(C, {
|
|
257
|
+
"default-value": "always",
|
|
258
|
+
modelValue: e(p),
|
|
259
|
+
"onUpdate:modelValue": t[0] || (t[0] = (w) => N(p) ? p.value = w : null),
|
|
260
|
+
class: te(["flex flex-col transition-all duration-300", { "opacity-0 pointer-events-none": !e(x) }])
|
|
261
|
+
}, {
|
|
262
|
+
default: s(() => [
|
|
263
|
+
o("div", Ge, [
|
|
264
|
+
n(m, {
|
|
265
|
+
id: "always",
|
|
266
|
+
value: "always"
|
|
267
|
+
}),
|
|
268
|
+
n(h, { for: "always" }, {
|
|
269
|
+
default: s(() => [...t[5] || (t[5] = [
|
|
270
|
+
v("Always", -1)
|
|
271
|
+
])]),
|
|
272
|
+
_: 1
|
|
273
|
+
})
|
|
274
|
+
]),
|
|
275
|
+
o("div", Ae, [
|
|
276
|
+
n(m, {
|
|
277
|
+
id: "weight_based",
|
|
278
|
+
value: "weight_based"
|
|
279
|
+
}),
|
|
280
|
+
n(h, { for: "weight_based" }, {
|
|
281
|
+
default: s(() => [...t[6] || (t[6] = [
|
|
282
|
+
v("Weight based", -1)
|
|
283
|
+
])]),
|
|
284
|
+
_: 1
|
|
285
|
+
})
|
|
286
|
+
]),
|
|
287
|
+
o("div", Je, [
|
|
288
|
+
n(m, {
|
|
289
|
+
id: "price_based",
|
|
290
|
+
value: "price_based"
|
|
291
|
+
}),
|
|
292
|
+
n(h, { for: "price_based" }, {
|
|
293
|
+
default: s(() => [...t[7] || (t[7] = [
|
|
294
|
+
v("Price based", -1)
|
|
295
|
+
])]),
|
|
296
|
+
_: 1
|
|
297
|
+
})
|
|
298
|
+
])
|
|
299
|
+
]),
|
|
300
|
+
_: 1
|
|
301
|
+
}, 8, ["modelValue", "class"]),
|
|
302
|
+
e(p) === "weight_based" ? (d(), b("div", qe, [
|
|
303
|
+
o("div", We, [
|
|
304
|
+
o("div", Xe, [
|
|
305
|
+
n(h, {
|
|
306
|
+
for: "condition_min",
|
|
307
|
+
class: "text-sm"
|
|
308
|
+
}, {
|
|
309
|
+
default: s(() => [...t[8] || (t[8] = [
|
|
310
|
+
v("Minimum weight", -1)
|
|
311
|
+
])]),
|
|
312
|
+
_: 1
|
|
313
|
+
}),
|
|
314
|
+
o("div", He, [
|
|
315
|
+
n(I, {
|
|
316
|
+
type: "number",
|
|
317
|
+
id: "condition_min",
|
|
318
|
+
min: "0",
|
|
319
|
+
placeholder: "0",
|
|
320
|
+
modelValue: e(i),
|
|
321
|
+
"onUpdate:modelValue": t[1] || (t[1] = (w) => N(i) ? i.value = w : null),
|
|
322
|
+
class: "no-spinner pr-10"
|
|
323
|
+
}, null, 8, ["modelValue"]),
|
|
324
|
+
t[9] || (t[9] = o("span", { class: "absolute pointer-events-none top-1/2 right-3 -translate-y-1/2 text-sm text-muted-foreground" }, "kg", -1))
|
|
325
|
+
]),
|
|
326
|
+
e(l).condition_min ? (d(), b("p", Ke, _(e(l).condition_min), 1)) : f("", !0)
|
|
327
|
+
])
|
|
328
|
+
]),
|
|
329
|
+
o("div", Qe, [
|
|
330
|
+
o("div", Ye, [
|
|
331
|
+
n(h, {
|
|
332
|
+
for: "condition_max",
|
|
333
|
+
class: "text-sm"
|
|
334
|
+
}, {
|
|
335
|
+
default: s(() => [...t[10] || (t[10] = [
|
|
336
|
+
v("Maximum weight", -1)
|
|
337
|
+
])]),
|
|
338
|
+
_: 1
|
|
339
|
+
}),
|
|
340
|
+
o("div", Ze, [
|
|
341
|
+
n(I, {
|
|
342
|
+
type: "number",
|
|
343
|
+
id: "condition_max",
|
|
344
|
+
min: "0",
|
|
345
|
+
placeholder: "No limit",
|
|
346
|
+
modelValue: e(r),
|
|
347
|
+
"onUpdate:modelValue": t[2] || (t[2] = (w) => N(r) ? r.value = w : null),
|
|
348
|
+
class: "no-spinner pr-10"
|
|
349
|
+
}, null, 8, ["modelValue"]),
|
|
350
|
+
t[11] || (t[11] = o("span", { class: "absolute pointer-events-none top-1/2 right-3 -translate-y-1/2 text-sm text-muted-foreground" }, "kg", -1))
|
|
351
|
+
]),
|
|
352
|
+
e(l).condition_max ? (d(), b("p", et, _(e(l).condition_max), 1)) : f("", !0)
|
|
353
|
+
])
|
|
354
|
+
])
|
|
355
|
+
])) : e(p) === "price_based" ? (d(), b("div", tt, [
|
|
356
|
+
o("div", ot, [
|
|
357
|
+
o("div", nt, [
|
|
358
|
+
n(h, {
|
|
359
|
+
for: "condition_min",
|
|
360
|
+
class: "text-sm"
|
|
361
|
+
}, {
|
|
362
|
+
default: s(() => [...t[12] || (t[12] = [
|
|
363
|
+
v("Minimum price", -1)
|
|
364
|
+
])]),
|
|
365
|
+
_: 1
|
|
366
|
+
}),
|
|
367
|
+
o("div", st, [
|
|
368
|
+
n(I, {
|
|
369
|
+
type: "number",
|
|
370
|
+
id: "condition_min",
|
|
371
|
+
min: "0",
|
|
372
|
+
placeholder: "0, 00",
|
|
373
|
+
modelValue: e(i),
|
|
374
|
+
"onUpdate:modelValue": t[3] || (t[3] = (w) => N(i) ? i.value = w : null),
|
|
375
|
+
class: "no-spinner pl-8"
|
|
376
|
+
}, null, 8, ["modelValue"]),
|
|
377
|
+
t[13] || (t[13] = o("span", { class: "absolute pointer-events-none top-1/2 left-3 -translate-y-1/2 text-sm text-muted-foreground" }, "€", -1))
|
|
378
|
+
]),
|
|
379
|
+
e(l).condition_min ? (d(), b("p", lt, _(e(l).condition_min), 1)) : f("", !0)
|
|
380
|
+
])
|
|
381
|
+
]),
|
|
382
|
+
o("div", it, [
|
|
383
|
+
o("div", at, [
|
|
384
|
+
n(h, {
|
|
385
|
+
for: "condition_max",
|
|
386
|
+
class: "text-sm"
|
|
387
|
+
}, {
|
|
388
|
+
default: s(() => [...t[14] || (t[14] = [
|
|
389
|
+
v("Maximum price", -1)
|
|
390
|
+
])]),
|
|
391
|
+
_: 1
|
|
392
|
+
}),
|
|
393
|
+
o("div", dt, [
|
|
394
|
+
n(I, {
|
|
395
|
+
type: "number",
|
|
396
|
+
id: "condition_max",
|
|
397
|
+
min: "0",
|
|
398
|
+
placeholder: "No limit",
|
|
399
|
+
modelValue: e(r),
|
|
400
|
+
"onUpdate:modelValue": t[4] || (t[4] = (w) => N(r) ? r.value = w : null),
|
|
401
|
+
class: "no-spinner pl-8"
|
|
402
|
+
}, null, 8, ["modelValue"]),
|
|
403
|
+
t[15] || (t[15] = o("span", { class: "absolute pointer-events-none top-1/2 left-3 -translate-y-1/2 text-sm text-muted-foreground" }, "€", -1))
|
|
404
|
+
]),
|
|
405
|
+
e(l).condition_max ? (d(), b("p", rt, _(e(l).condition_max), 1)) : f("", !0)
|
|
406
|
+
])
|
|
407
|
+
])
|
|
408
|
+
])) : f("", !0)
|
|
409
|
+
]),
|
|
410
|
+
_: 1
|
|
411
|
+
})
|
|
412
|
+
]),
|
|
413
|
+
_: 1
|
|
414
|
+
});
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
}), ut = { class: "flex gap-2 rounded-lg p-2 bg-white text-black overflow-hidden shadow border" }, pt = { class: "w-full overflow-hidden" }, mt = { class: "truncate" }, ft = {
|
|
418
|
+
key: 0,
|
|
419
|
+
class: "text-sm text-muted-foreground"
|
|
420
|
+
}, _t = { class: "ml-auto shrink-0" }, xt = { class: "font-bold" }, vt = /* @__PURE__ */ B({
|
|
421
|
+
__name: "Example",
|
|
422
|
+
setup(P) {
|
|
423
|
+
const { value: x } = S("title"), { value: l } = S("description"), { value: p } = S("price");
|
|
424
|
+
return (i, r) => {
|
|
425
|
+
const g = a("CardContent"), t = a("Card");
|
|
426
|
+
return d(), O(t, null, {
|
|
427
|
+
default: s(() => [
|
|
428
|
+
n(g, null, {
|
|
429
|
+
default: s(() => [
|
|
430
|
+
r[1] || (r[1] = o("p", { class: "text-md font-semibold mb-2" }, "Example", -1)),
|
|
431
|
+
o("div", ut, [
|
|
432
|
+
r[0] || (r[0] = o("div", { class: "pt-1 shrink-0" }, [
|
|
433
|
+
o("div", { class: "size-4 rounded-full bg-primary flex items-center justify-center" }, [
|
|
434
|
+
o("div", { class: "size-2 rounded-full bg-white" })
|
|
435
|
+
])
|
|
436
|
+
], -1)),
|
|
437
|
+
o("div", pt, [
|
|
438
|
+
o("p", mt, _(e(x) || "Option Name"), 1),
|
|
439
|
+
e(l) ? (d(), b("p", ft, _(e(l)), 1)) : f("", !0)
|
|
440
|
+
]),
|
|
441
|
+
o("div", _t, [
|
|
442
|
+
o("p", xt, _(e(p) ? "€" + e(p).toFixed(2) : "FREE"), 1)
|
|
443
|
+
])
|
|
444
|
+
])
|
|
445
|
+
]),
|
|
446
|
+
_: 1
|
|
447
|
+
})
|
|
448
|
+
]),
|
|
449
|
+
_: 1
|
|
450
|
+
});
|
|
451
|
+
};
|
|
452
|
+
}
|
|
453
|
+
}), bt = { class: "relative @container" }, gt = { class: "flex flex-row gap-4 justify-between max-w-5xl mx-auto mt-4 mb-6" }, ht = { class: "flex items-center" }, Ct = { class: "text-lg font-semibold mx-2" }, wt = { class: "flex flex-col @3xl:flex-row gap-4 max-w-5xl mx-auto pb-24" }, yt = { class: "flex flex-col gap-4 w-full @3xl:w-2/3" }, kt = { class: "flex flex-col gap-4 w-full @3xl:w-1/3" }, $t = {
|
|
454
|
+
key: 0,
|
|
455
|
+
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)]"
|
|
456
|
+
}, Ot = { class: "w-full max-w-5xl flex items-center justify-end mx-auto" }, zt = /* @__PURE__ */ B({
|
|
457
|
+
__name: "Detail",
|
|
458
|
+
props: {
|
|
459
|
+
config: {
|
|
460
|
+
type: Object,
|
|
461
|
+
required: !0
|
|
462
|
+
}
|
|
463
|
+
},
|
|
464
|
+
setup(P) {
|
|
465
|
+
const x = P, { hasPermission: l, hasAnyPermission: p } = xe(), { params: i, navigateTo: r } = ve(), { confirm: g } = be(), t = ge(x.config.project), m = oe(() => !i.value.optionId || i.value.optionId === "new"), h = R(!1), C = R(!1), I = le(ie({
|
|
466
|
+
id: F().optional(),
|
|
467
|
+
status: F().optional(),
|
|
468
|
+
title: F().min(1, "Title is required"),
|
|
469
|
+
description: F().optional(),
|
|
470
|
+
price: J(
|
|
471
|
+
(u) => u === "" ? void 0 : u,
|
|
472
|
+
q.number().positive("Must be positive").optional()
|
|
473
|
+
),
|
|
474
|
+
countries: ae(F()).optional(),
|
|
475
|
+
condition: F(),
|
|
476
|
+
condition_min: J(
|
|
477
|
+
(u) => u === "" ? void 0 : u,
|
|
478
|
+
q.number().positive("Must be positive").optional()
|
|
479
|
+
),
|
|
480
|
+
condition_max: J(
|
|
481
|
+
(u) => u === "" ? void 0 : u,
|
|
482
|
+
q.number().positive("Must be positive").optional()
|
|
483
|
+
)
|
|
484
|
+
})), { handleSubmit: z, errors: M, values: w, setValues: G } = de({
|
|
485
|
+
validationSchema: I,
|
|
486
|
+
initialValues: {
|
|
487
|
+
status: "published",
|
|
488
|
+
countries: [],
|
|
489
|
+
condition: "always"
|
|
490
|
+
}
|
|
491
|
+
});
|
|
492
|
+
he(() => [
|
|
493
|
+
{ text: w.title ?? "New Option" }
|
|
494
|
+
]);
|
|
495
|
+
const D = z(async (u) => {
|
|
496
|
+
C.value = !0;
|
|
497
|
+
let c = await U() || [];
|
|
498
|
+
if (m.value) {
|
|
499
|
+
let k = JSON.parse(JSON.stringify(u));
|
|
500
|
+
k.id = crypto.randomUUID();
|
|
501
|
+
const V = [...c, k], $ = x.config.shippingOptionsCollection.split(":");
|
|
502
|
+
await t.update($[0], null, { [$[1]]: V }), r(k.id), E.success("Shipping option created");
|
|
503
|
+
} else {
|
|
504
|
+
let k = JSON.parse(JSON.stringify(u));
|
|
505
|
+
const V = c.map((T) => T.id === i.value.optionId ? k : T), $ = x.config.shippingOptionsCollection.split(":");
|
|
506
|
+
await t.update($[0], null, { [$[1]]: V }), r(`${i.value.optionId}`), E.success("Shipping option updated");
|
|
507
|
+
}
|
|
508
|
+
C.value = !1;
|
|
509
|
+
}), U = async () => {
|
|
510
|
+
if (!x.config.shippingOptionsCollection) return [];
|
|
511
|
+
const u = x.config.shippingOptionsCollection.split(":");
|
|
512
|
+
return u.length !== 2 ? [] : (await t.get(u[0]))?.[u[1]] || [];
|
|
513
|
+
}, y = async () => {
|
|
514
|
+
const c = (await U()).find((k) => k.id === i.value.optionId);
|
|
515
|
+
G(c), h.value = !0;
|
|
516
|
+
}, L = async () => {
|
|
517
|
+
try {
|
|
518
|
+
const u = await U();
|
|
519
|
+
let c = { ...[...u || []].find((T) => T.id === i.value.optionId) };
|
|
520
|
+
console.log(u, i.value.optionId, u.find((T) => T.id === i.value.optionId)), c.id = crypto.randomUUID(), c.status = "published", c.title = c.title + " (copy)";
|
|
521
|
+
const V = [...await U() || [], c], $ = x.config.shippingOptionsCollection.split(":");
|
|
522
|
+
await t.update($[0], null, { [$[1]]: V }), r(c.id), E.success("Option duplicated");
|
|
523
|
+
} catch {
|
|
524
|
+
E.error("Failed to duplicate option");
|
|
525
|
+
}
|
|
526
|
+
}, A = async () => {
|
|
527
|
+
if (await g("Are you sure you want to delete this option?"))
|
|
528
|
+
try {
|
|
529
|
+
const c = await U() || [];
|
|
530
|
+
if (c.length === 0 || !i.value.optionId) throw new Error("Error loading values");
|
|
531
|
+
const k = c.filter(($) => $.id !== i.value.optionId), V = x.config.shippingOptionsCollection.split(":");
|
|
532
|
+
await t.update(V[0], null, { [V[1]]: k }), r(""), E.success("Option deleted");
|
|
533
|
+
} catch {
|
|
534
|
+
E.error("Failed to delete option");
|
|
535
|
+
}
|
|
536
|
+
};
|
|
537
|
+
return ne(() => {
|
|
538
|
+
m.value ? h.value = !0 : y();
|
|
539
|
+
}), se("isLoadingCompleted", h), (u, c) => {
|
|
540
|
+
const k = a("Button"), V = a("MenubarTrigger"), $ = a("MenubarMenu"), T = a("MenubarItem"), Y = a("MenubarContent"), Z = a("Menubar");
|
|
541
|
+
return d(), b("div", bt, [
|
|
542
|
+
o("div", gt, [
|
|
543
|
+
o("div", ht, [
|
|
544
|
+
n(k, {
|
|
545
|
+
variant: "ghost",
|
|
546
|
+
onClick: c[0] || (c[0] = (Vt) => e(r)(""))
|
|
547
|
+
}, {
|
|
548
|
+
default: s(() => [
|
|
549
|
+
n(e(me), { class: "size-4" })
|
|
550
|
+
]),
|
|
551
|
+
_: 1
|
|
552
|
+
}),
|
|
553
|
+
n(e(fe), { class: "size-3" }),
|
|
554
|
+
o("h1", Ct, _(m.value ? "New Option" : e(w).title), 1)
|
|
555
|
+
]),
|
|
556
|
+
m.value ? f("", !0) : (d(), O(Z, {
|
|
557
|
+
key: 0,
|
|
558
|
+
class: "bg-sidebar"
|
|
559
|
+
}, {
|
|
560
|
+
default: s(() => [
|
|
561
|
+
e(l)("create-collection") ? (d(), O($, { key: 0 }, {
|
|
562
|
+
default: s(() => [
|
|
563
|
+
n(V, { onClick: L }, {
|
|
564
|
+
default: s(() => [...c[1] || (c[1] = [
|
|
565
|
+
v("Duplicate", -1)
|
|
566
|
+
])]),
|
|
567
|
+
_: 1
|
|
568
|
+
})
|
|
569
|
+
]),
|
|
570
|
+
_: 1
|
|
571
|
+
})) : f("", !0),
|
|
572
|
+
e(p)("edit-collection", "delete-option") ? (d(), O($, { key: 1 }, {
|
|
573
|
+
default: s(() => [
|
|
574
|
+
n(V, null, {
|
|
575
|
+
default: s(() => [...c[2] || (c[2] = [
|
|
576
|
+
v("More actions", -1)
|
|
577
|
+
])]),
|
|
578
|
+
_: 1
|
|
579
|
+
}),
|
|
580
|
+
n(Y, null, {
|
|
581
|
+
default: s(() => [
|
|
582
|
+
e(l)("delete-option") ? (d(), O(T, {
|
|
583
|
+
key: 0,
|
|
584
|
+
variant: "destructive",
|
|
585
|
+
onClick: A
|
|
586
|
+
}, {
|
|
587
|
+
default: s(() => [
|
|
588
|
+
n(e(_e), { class: "size-4" }),
|
|
589
|
+
c[3] || (c[3] = v(" Delete option ", -1))
|
|
590
|
+
]),
|
|
591
|
+
_: 1
|
|
592
|
+
})) : f("", !0)
|
|
593
|
+
]),
|
|
594
|
+
_: 1
|
|
595
|
+
})
|
|
596
|
+
]),
|
|
597
|
+
_: 1
|
|
598
|
+
})) : f("", !0)
|
|
599
|
+
]),
|
|
600
|
+
_: 1
|
|
601
|
+
}))
|
|
602
|
+
]),
|
|
603
|
+
o("div", wt, [
|
|
604
|
+
o("div", yt, [
|
|
605
|
+
n(Se),
|
|
606
|
+
n(Re),
|
|
607
|
+
n(ct)
|
|
608
|
+
]),
|
|
609
|
+
o("div", kt, [
|
|
610
|
+
n(vt)
|
|
611
|
+
])
|
|
612
|
+
]),
|
|
613
|
+
e(p)("create-option", "edit-option") ? (d(), b("div", $t, [
|
|
614
|
+
o("div", Ot, [
|
|
615
|
+
m.value && e(l)("create-option") ? (d(), O(k, {
|
|
616
|
+
key: 0,
|
|
617
|
+
onClick: e(D),
|
|
618
|
+
disabled: C.value
|
|
619
|
+
}, {
|
|
620
|
+
default: s(() => [
|
|
621
|
+
C.value ? (d(), O(e(K), {
|
|
622
|
+
key: 0,
|
|
623
|
+
class: "size-4 animate-spin"
|
|
624
|
+
})) : f("", !0),
|
|
625
|
+
v(" " + _(C.value ? "Creating" : "Create") + " New Option ", 1)
|
|
626
|
+
]),
|
|
627
|
+
_: 1
|
|
628
|
+
}, 8, ["onClick", "disabled"])) : e(l)("edit-option") ? (d(), O(k, {
|
|
629
|
+
key: 1,
|
|
630
|
+
onClick: e(D),
|
|
631
|
+
disabled: C.value
|
|
632
|
+
}, {
|
|
633
|
+
default: s(() => [
|
|
634
|
+
C.value ? (d(), O(e(K), {
|
|
635
|
+
key: 0,
|
|
636
|
+
class: "size-4 animate-spin"
|
|
637
|
+
})) : f("", !0),
|
|
638
|
+
v(" " + _(C.value ? "Saving" : "Save") + " Changes ", 1)
|
|
639
|
+
]),
|
|
640
|
+
_: 1
|
|
641
|
+
}, 8, ["onClick", "disabled"])) : f("", !0)
|
|
642
|
+
])
|
|
643
|
+
])) : f("", !0)
|
|
644
|
+
]);
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
});
|
|
648
|
+
export {
|
|
649
|
+
zt as default
|
|
650
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),c=require("lucide-vue-next"),B=require("./utils-D6CaKJbp.js"),d=require("@oneclick.dev/cms-kit"),u=require("./CalendarDate-CWtpXgpD.js"),G=require("./DateFormatter-BbcSwTs4.js"),O={class:"relative @container"},R={key:0,class:"max-w-5xl mx-auto mt-4"},W={class:"flex flex-row gap-4 justify-between mb-6"},Z={class:"flex items-center"},K={class:"text-lg font-semibold mx-2 uppercase"},Y={key:0,class:"bg-green-500 text-green-950 px-2 py-1 rounded-lg text-xs"},H={key:1,class:"bg-gray-500 text-gray-950 px-2 py-1 rounded-lg text-xs"},J={class:"font-medium mb-2 uppercase"},Q={class:"mb-6"},X={key:0},ee={key:1},te={key:2},oe={class:"flex flex-wrap gap-12 mb-6"},le={key:0,class:"grid gap-2"},ae={class:"flex items-center gap-2"},ne={key:0,class:"text-lg"},se={key:1,class:"text-lg"},re={key:1,class:"grid gap-2"},de={class:"flex items-center space-x-2"},ue={class:"flex gap-4 mb-6"},ie={class:"flex flex-col"},ce={key:0,class:"-ml-2"},me={key:1,class:"text-xs text-muted-foreground mt-2"},pe={class:"flex flex-col"},ve={key:0,class:"-ml-2"},fe={key:1,class:"text-xs text-muted-foreground mt-2"},xe={class:"flex justify-end gap-2 mt-6"},Ve=e.defineComponent({__name:"Detail",props:{config:{type:Object,required:!0}},async setup(E){let i,x;const m=E,{log:Ce,logWarning:Ne,logError:ge}=d.useLogs(),{params:V,navigateTo:C}=d.useModuleRoute(),{getModuleData:S}=d.useModuleStorage(),{confirm:T}=useConfirmation(),p=e.ref([]);p.value=([i,x]=e.withAsyncContext(()=>S("promo-types")),i=await i,x(),i||[]);const N=d.useFirebaseIntegration(m.config.project),o=e.ref(null),v=e.ref(!1),a=e.computed(()=>(o.value?.usageCount??0)>0),s=e.computed(()=>p.value.find(f=>f.key===o.value?.type)||null);d.useModuleBreadcrumbs(()=>[{text:"Promo codes list",href:o.value?.code?"/promo-codes":""},{text:o.value?.code||""}]);const g=new G.$fb18d541ea1ad717$export$ad991b66133851cf("en-US",{dateStyle:"long"}),A=async()=>{o.value=await N.get(m.config.promoCodeCollection,V.value.promoCodeId),o.value.startsAt=u.$fae977aafc393c5c$export$588937bcd60ade55(o.value?.startsAt?.replace(/\.\d{3}Z$/,"")),o.value.expiresAt=u.$fae977aafc393c5c$export$588937bcd60ade55(o.value?.expiresAt?.replace(/\.\d{3}Z$/,""))},$=async()=>{await T(`Are you sure you want to delete the code "${o.value?.code}"?`)&&(await N.remove(m.config.promoCodeCollection,V.value.promoCodeId),C("/promo-codes"))};return A(),(f,t)=>{const r=e.resolveComponent("Button"),n=e.resolveComponent("Label"),k=e.resolveComponent("Input"),h=e.resolveComponent("SelectValue"),U=e.resolveComponent("SelectTrigger"),D=e.resolveComponent("SelectItem"),P=e.resolveComponent("SelectGroup"),I=e.resolveComponent("SelectContent"),L=e.resolveComponent("Select"),j=e.resolveComponent("Switch"),_=e.resolveComponent("PopoverTrigger"),b=e.resolveComponent("Calendar"),y=e.resolveComponent("PopoverContent"),w=e.resolveComponent("Popover"),q=e.resolveComponent("Textarea"),z=e.resolveComponent("Loader2"),M=e.resolveComponent("CardContent"),F=e.resolveComponent("Card");return e.openBlock(),e.createElementBlock("div",O,[o.value?(e.openBlock(),e.createElementBlock("div",R,[e.createElementVNode("div",W,[e.createElementVNode("div",Z,[e.createVNode(r,{variant:"ghost",onClick:t[0]||(t[0]=l=>e.unref(C)("/promo-codes"))},{default:e.withCtx(()=>[e.createVNode(e.unref(c.Tag),{class:"size-4"})]),_:1}),e.createVNode(e.unref(c.ChevronRight),{class:"size-3"}),e.createElementVNode("h1",K,e.toDisplayString(o.value.code),1),o.value.expiresAt>new Date?(e.openBlock(),e.createElementBlock("span",Y,"Active")):(e.openBlock(),e.createElementBlock("span",H,"Expired"))])]),e.createVNode(F,null,{default:e.withCtx(()=>[e.createVNode(M,null,{default:e.withCtx(()=>[e.createElementVNode("h3",J,e.toDisplayString(o.value.code),1),e.createElementVNode("p",Q,[t[14]||(t[14]=e.createTextVNode(" This promo code has been created on ",-1)),e.createElementVNode("strong",null,e.toDisplayString(new Date(o.value.createdAt).toLocaleString()),1),t[15]||(t[15]=e.createTextVNode(".",-1)),t[16]||(t[16]=e.createElementVNode("br",null,null,-1)),o.value.usageCount===1?(e.openBlock(),e.createElementBlock("span",X,[...t[11]||(t[11]=[e.createTextVNode("It has been used ",-1),e.createElementVNode("strong",null,"1 time",-1),e.createTextVNode(", so you can't edit it.",-1)])])):o.value.usageCount>1?(e.openBlock(),e.createElementBlock("span",ee,[t[12]||(t[12]=e.createTextVNode("It has been used ",-1)),e.createElementVNode("strong",null,e.toDisplayString(o.value.usageCount)+" times",1),t[13]||(t[13]=e.createTextVNode(", so you can't edit it.",-1))])):(e.openBlock(),e.createElementBlock("span",te,"It has not been used yet."))]),e.createVNode(n,{for:"code",class:"text-muted-foreground mb-2"},{default:e.withCtx(()=>[...t[17]||(t[17]=[e.createTextVNode("Promo Code",-1)])]),_:1}),e.createVNode(k,{id:"code",modelValue:o.value.code,"onUpdate:modelValue":t[1]||(t[1]=l=>o.value.code=l),disabled:a.value,class:"mb-6 uppercase"},null,8,["modelValue","disabled"]),e.createElementVNode("div",null,[t[27]||(t[27]=e.createElementVNode("h3",{class:"font-medium mb-2"},"Value",-1)),e.createVNode(L,{modelValue:o.value.type,"onUpdate:modelValue":t[2]||(t[2]=l=>o.value.type=l)},{default:e.withCtx(()=>[e.createVNode(U,{class:"w-[200px] mb-4",disabled:a.value},{default:e.withCtx(()=>[e.createVNode(h,{placeholder:"Select a promo type"})]),_:1},8,["disabled"]),e.createVNode(I,null,{default:e.withCtx(()=>[e.createVNode(P,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,l=>(e.openBlock(),e.createBlock(D,{key:l.key,value:l.key},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.label),1)]),_:2},1032,["value"]))),128))]),_:1})]),_:1})]),_:1},8,["modelValue"]),e.createElementVNode("div",oe,[s.value?.hasValueField?(e.openBlock(),e.createElementBlock("div",le,[e.createVNode(n,{for:"discountValue",class:"text-muted-foreground"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(s.value?.valueLabel||"Value"),1)]),_:1}),e.createElementVNode("div",ae,[s.value?.valuePrefix?(e.openBlock(),e.createElementBlock("span",ne,e.toDisplayString(s.value?.valuePrefix),1)):e.createCommentVNode("",!0),e.createVNode(k,{modelValue:o.value.value,"onUpdate:modelValue":t[3]||(t[3]=l=>o.value.value=l),id:"discountValue",disabled:a.value},null,8,["modelValue","disabled"]),s.value?.valueSuffix?(e.openBlock(),e.createElementBlock("span",se,e.toDisplayString(s.value?.valueSuffix),1)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),s.value?.allowUnlimitedUses?(e.openBlock(),e.createElementBlock("div",re,[e.createVNode(n,{for:"unlimitedUses",class:"text-muted-foreground"},{default:e.withCtx(()=>[...t[18]||(t[18]=[e.createTextVNode("Unlimited Uses",-1)])]),_:1}),e.createElementVNode("div",de,[e.createVNode(j,{id:"unlimitedUses",modelValue:o.value.unlimitedUses,"onUpdate:modelValue":t[4]||(t[4]=l=>o.value.unlimitedUses=l),disabled:a.value},null,8,["modelValue","disabled"]),e.createVNode(n,{for:"unlimitedUses"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.value.unlimitedUses?"Yes":"No"),1)]),_:1})])])):e.createCommentVNode("",!0)]),t[28]||(t[28]=e.createElementVNode("h3",{class:"font-medium"},"Availability",-1)),t[29]||(t[29]=e.createElementVNode("p",{class:"text-sm text-muted-foreground mb-4"},"When will this code be available?",-1)),e.createElementVNode("div",ue,[e.createElementVNode("div",ie,[e.createVNode(n,{class:"text-muted-foreground mb-2"},{default:e.withCtx(()=>[...t[19]||(t[19]=[e.createTextVNode("Available from",-1)])]),_:1}),e.createVNode(w,null,{default:e.withCtx(()=>[e.createVNode(_,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(r,{variant:"outline",class:e.normalizeClass(e.unref(B.classNames)("w-[280px] justify-start text-left font-normal",!o.value.startsAt&&"text-muted-foreground")),disabled:a.value},{default:e.withCtx(()=>[e.createVNode(e.unref(c.CalendarIcon),{class:"mr-2 h-4 w-4"}),e.createTextVNode(" "+e.toDisplayString(o.value.startsAt?e.unref(g).format(o.value.startsAt.toDate(e.unref(u.$14e0f24ef4ac5c92$export$aa8b41735afcabd2)())):"Pick a date"),1)]),_:1},8,["class","disabled"])]),_:1}),e.createVNode(y,{class:"w-auto p-0"},{default:e.withCtx(()=>[e.createVNode(b,{modelValue:o.value.startsAt,"onUpdate:modelValue":t[5]||(t[5]=l=>o.value.startsAt=l),"initial-focus":"",minValue:e.unref(u.$14e0f24ef4ac5c92$export$d0bdf45af03a6ea3)()},null,8,["modelValue","minValue"])]),_:1})]),_:1}),o.value.startsAt?(e.openBlock(),e.createElementBlock("div",ce,[a.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(r,{key:0,onClick:t[6]||(t[6]=l=>o.value.startsAt=void 0),variant:"link"},{default:e.withCtx(()=>[...t[20]||(t[20]=[e.createTextVNode("Clear",-1)])]),_:1}))])):(e.openBlock(),e.createElementBlock("p",me,"Not set - codes will be available immediately"))]),e.createElementVNode("div",pe,[e.createVNode(n,{class:"text-muted-foreground mb-2"},{default:e.withCtx(()=>[...t[21]||(t[21]=[e.createTextVNode("Until",-1)])]),_:1}),e.createVNode(w,null,{default:e.withCtx(()=>[e.createVNode(_,{"as-child":""},{default:e.withCtx(()=>[e.createVNode(r,{variant:"outline",class:e.normalizeClass(e.unref(B.classNames)("w-[280px] justify-start text-left font-normal",!o.value.expiresAt&&"text-muted-foreground")),disabled:a.value},{default:e.withCtx(()=>[e.createVNode(e.unref(c.CalendarIcon),{class:"mr-2 h-4 w-4"}),e.createTextVNode(" "+e.toDisplayString(o.value.expiresAt?e.unref(g).format(o.value.expiresAt.toDate(e.unref(u.$14e0f24ef4ac5c92$export$aa8b41735afcabd2)())):"Pick a date"),1)]),_:1},8,["class","disabled"])]),_:1}),e.createVNode(y,{class:"w-auto p-0"},{default:e.withCtx(()=>[e.createVNode(b,{modelValue:o.value.expiresAt,"onUpdate:modelValue":t[7]||(t[7]=l=>o.value.expiresAt=l),"initial-focus":"",minValue:o.value.startsAt},null,8,["modelValue","minValue"])]),_:1})]),_:1}),o.value.expiresAt?(e.openBlock(),e.createElementBlock("div",ve,[a.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(r,{key:0,onClick:t[8]||(t[8]=l=>o.value.expiresAt=void 0),variant:"link"},{default:e.withCtx(()=>[...t[22]||(t[22]=[e.createTextVNode("Clear",-1)])]),_:1}))])):(e.openBlock(),e.createElementBlock("p",fe,"Not set - codes will never expire"))])]),e.createVNode(n,{for:"note",class:"text-lg font-medium"},{default:e.withCtx(()=>[...t[23]||(t[23]=[e.createTextVNode("Note",-1)])]),_:1}),e.createVNode(n,{for:"note",class:"font-normal text-sm text-muted-foreground mb-2"},{default:e.withCtx(()=>[...t[24]||(t[24]=[e.createTextVNode("Internal note, you can always edit this later",-1)])]),_:1}),e.createVNode(q,{modelValue:o.value.note,"onUpdate:modelValue":t[9]||(t[9]=l=>o.value.note=l),id:"note"},null,8,["modelValue"]),e.createElementVNode("div",xe,[e.createVNode(r,{variant:"destructive",onClick:t[10]||(t[10]=l=>$()),disabled:v.value},{default:e.withCtx(()=>[...t[25]||(t[25]=[e.createTextVNode(" Delete Code ",-1)])]),_:1},8,["disabled"]),e.createVNode(r,{disabled:v.value},{default:e.withCtx(()=>[v.value?(e.openBlock(),e.createBlock(z,{key:0,class:"size-4 animate-spin"})):e.createCommentVNode("",!0),t[26]||(t[26]=e.createTextVNode(" Update Code ",-1))]),_:1},8,["disabled"])])])]),_:1})]),_:1}),e.createTextVNode(" "+e.toDisplayString(o.value),1)])):e.createCommentVNode("",!0)])}}});exports.default=Ve;
|