@oneclick.dev/cms-core-modules 0.0.59 → 0.0.60
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/{Components-D9yIIosM.mjs → Components-C83O-xlF.mjs} +1 -1
- package/dist/{ContentEditor-DCmt_y_R.js → ContentEditor-BAepN3Yd.js} +51 -34
- package/dist/{ContentEditor-CtGeIzC4.mjs → ContentEditor-BPjWW3d1.mjs} +12341 -10099
- package/dist/Create-Bh4g6QW4.js +1 -0
- package/dist/{Create-Bwf1RXdG.mjs → Create-Cf7pvh5G.mjs} +38 -39
- package/dist/DateFormatter-BPPBZp1j.js +1 -0
- package/dist/{CalendarDate-CRT2Viyt.mjs → DateFormatter-DsmlAuYV.mjs} +353 -256
- package/dist/{Detail-CpfOQChd.mjs → Detail-B4b_FLDa.mjs} +2 -2
- package/dist/{Detail-B-PnkcXD.mjs → Detail-BGD75ul4.mjs} +2 -2
- package/dist/{Detail-Dd_OkpcN.js → Detail-BayNaAg9.js} +1 -1
- package/dist/{Detail-C4E1T87K.mjs → Detail-Byk781b4.mjs} +3 -3
- package/dist/{Detail-Cd5CBVN0.js → Detail-CnK-qbhE.js} +1 -1
- package/dist/Detail-CtbWzq-R.js +1 -0
- package/dist/{Detail-CNfTDUE5.js → Detail-Cxd2VMOl.js} +1 -1
- package/dist/{Detail-BVlGSjOq.mjs → Detail-D10shmpK.mjs} +6 -7
- package/dist/{Detail-CwagT6gQ.mjs → Detail-U0mgLKt6.mjs} +2 -2
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-CcysXzmW.mjs +75 -0
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-Czu6Dcde.js +1 -0
- package/dist/{Entries-zyhycw1M.mjs → Entries-C6Di46My.mjs} +1 -1
- package/dist/{Find-BPR0uU-Z.mjs → Find-B4sAEx0B.mjs} +2 -2
- package/dist/{Find-BidEQJxT.js → Find-Ds6OvuH6.js} +1 -1
- package/dist/{GlobalStyling-BLQ_1W2y.mjs → GlobalStyling-C9VthHWK.mjs} +1 -1
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BJitmbPE.mjs +396 -0
- package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-D50uTpZY.js +1 -0
- package/dist/Overview-B-8TLLjh.js +1 -0
- package/dist/{Overview-CDN88OSM.mjs → Overview-BCpJNiEB.mjs} +1 -1
- package/dist/Overview-B_99j5eA.js +1 -0
- package/dist/{Overview-BLsZMHNW.mjs → Overview-CIa1E-HH.mjs} +1 -1
- package/dist/{Overview-D1nJLBe1.mjs → Overview-CgViRnNc.mjs} +1 -1
- package/dist/Overview-DtWvKB3W.mjs +327 -0
- package/dist/Overview-HvlDEgqi.mjs +862 -0
- package/dist/{Overview-BH3NwvNX.mjs → Overview-Su8ZUbMs.mjs} +3 -3
- package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-CI8YgHdU.js +345 -0
- package/dist/ReservationDetailDialog.vue_vue_type_script_setup_true_lang-P-MWwcVh.mjs +2093 -0
- package/dist/{TableView-CS13LLxk.mjs → TableView-B8iLWWcP.mjs} +48394 -36321
- package/dist/TableView-BxK6R8v3.js +312 -0
- package/dist/{TemplateList.vue_vue_type_script_setup_true_lang-BiLAkhIA.mjs → TemplateList.vue_vue_type_script_setup_true_lang-Cmovy7kk.mjs} +5 -5
- package/dist/{View-C7axVP9t.mjs → View-DDXN0tKD.mjs} +7 -7
- package/dist/View-DfzaVOzS.js +1 -0
- package/dist/agenda-D81m29_4.mjs +1135 -0
- package/dist/agenda-uzPPxgsW.js +1 -0
- package/dist/availability-B-tRp8hB.mjs +629 -0
- package/dist/availability-BiBbzEIM.js +1 -0
- package/dist/{exceptions-D3b18TiY.mjs → exceptions-BFchkR06.mjs} +70 -71
- package/dist/exceptions-C-DPRNQa.js +1 -0
- package/dist/index-4tjmIans.js +1 -0
- package/dist/index-AmUV8LZQ.mjs +176 -0
- package/dist/index-BDaVYdkD.mjs +7763 -0
- package/dist/{index-DT1wWnUk.mjs → index-BWDwEd8D.mjs} +1 -1
- package/dist/{index-CImCyE3L.mjs → index-BfBBm9uY.mjs} +1 -1
- package/dist/{index-DMoyoaks.mjs → index-Bkq58CeQ.mjs} +2 -2
- package/dist/{index-DI6mydpm.mjs → index-CABh6Qn6.mjs} +2 -2
- package/dist/{index-CQiY-oTN.mjs → index-CQkOH2_3.mjs} +1 -1
- package/dist/{index-Bwi1mtkq.mjs → index-CU-tbS5W.mjs} +1 -1
- package/dist/{index-BzuHN-r8.mjs → index-Cpnn_Pxd.mjs} +1 -1
- package/dist/index-CxETuRsG.js +1 -0
- package/dist/{index-DyCHxFp3.mjs → index-DRqJOqUR.mjs} +502 -449
- package/dist/index-DTago6vW-Bhr8E1Y6.js +88 -0
- package/dist/index-DTago6vW-CnomHQ_S.mjs +4123 -0
- package/dist/index-DfV8-6ON.js +245 -0
- package/dist/index-Dnn2SCSl.js +1 -0
- package/dist/{index-BEGU8Kme.mjs → index-Dpl9sU6a.mjs} +2 -2
- package/dist/index-Uf7TwBuW.mjs +110 -0
- package/dist/index-YMaY4uuk-BgpTtr73.js +1 -0
- package/dist/{index-CKPshlZ8-BQiiP6r_.mjs → index-YMaY4uuk-C_xV5K9Z.mjs} +399 -363
- package/dist/{index--jjEzba7.mjs → index-cOnxXTbF.mjs} +1 -1
- package/dist/index-hlylYYgy.mjs +24 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.mjs +98 -81
- package/dist/orders-Bh8w0ueq.mjs +346 -0
- package/dist/orders-Dt0zMz97.js +1 -0
- package/dist/payment-BQaAqQ5q.js +1 -0
- package/dist/payment-BbWByERf.mjs +1080 -0
- package/dist/regular-1LXNPviB.js +1 -0
- package/dist/regular-_05oq5Tx.mjs +1101 -0
- package/dist/regular-slots-Bs3WJB3U.js +1 -0
- package/dist/regular-slots-C2NYxLPn.mjs +222 -0
- package/dist/resources-DgPnEv76.mjs +811 -0
- package/dist/resources-eb0pivDL.js +1 -0
- package/dist/src/appointments/components/edit/EditLayout.vue.d.ts +2 -2
- package/dist/src/appointments/components/edit/EventDialog/BookingsList.vue.d.ts +92 -0
- package/dist/src/appointments/components/edit/EventDialog/CancelReservationDialog.vue.d.ts +8 -0
- package/dist/src/appointments/components/edit/EventDialog/EventDialog.vue.d.ts +10 -0
- package/dist/src/appointments/components/edit/{EventDialog.vue.d.ts → EventDialog/ResendConfirmationDialog.vue.d.ts} +1 -1
- package/dist/src/appointments/components/edit/EventDialog/ReservationDetailDialog.vue.d.ts +51 -0
- package/dist/src/appointments/components/edit/EventDialog/TimelineChart.vue.d.ts +24 -0
- package/dist/src/appointments/components/edit/EventDialog/TransferReservationDialog.vue.d.ts +4 -0
- package/dist/src/appointments/components/edit/EventTimeline.vue.d.ts +15 -7
- package/dist/src/appointments/components/edit/NewReservationDialog/NewReservationDialog.vue.d.ts +2 -0
- package/dist/src/appointments/components/edit/dashboard/BookingsList.vue.d.ts +68 -0
- package/dist/src/appointments/components/edit/dashboard/Timeline.vue.d.ts +15 -0
- package/dist/src/appointments/components/edit/dashboard/timeline/ResourceSelector.vue.d.ts +50 -0
- package/dist/src/appointments/config.d.ts +30 -0
- package/dist/src/appointments/index.d.ts +32 -5
- package/dist/src/appointments/pages/edit/agenda.vue.d.ts +1 -1
- package/dist/src/appointments/pages/edit/availability.vue.d.ts +1 -1
- package/dist/src/appointments/pages/edit/index.vue.d.ts +1 -1
- package/dist/src/appointments/pages/edit/orders.vue.d.ts +64 -0
- package/dist/src/appointments/pages/edit/payment.vue.d.ts +1 -1
- package/dist/src/appointments/pages/edit/regular-slots.vue.d.ts +1 -1
- package/dist/src/appointments/pages/edit/resources.vue.d.ts +1 -1
- package/dist/src/appointments/routes.d.ts +2 -5
- package/dist/src/appointments/types.d.ts +16 -0
- package/dist/src/appointments/utils/printReservation.d.ts +45 -0
- package/dist/src/content-manager/components/content-editor/ContentStructuredContentSections.vue.d.ts +4 -0
- package/dist/src/content-manager/components/content-editor/PageSettings.vue.d.ts +2 -0
- package/dist/src/content-manager/components/content-editor/SidebarSectionWrapper.vue.d.ts +11 -1
- package/dist/src/content-manager/types.d.ts +5 -0
- package/dist/{vee-validate-zod-BPQyEfpF.js → vee-validate-zod-ByykgYKJ.js} +1 -1
- package/dist/{vee-validate-zod-IXkfh-6Q.mjs → vee-validate-zod-CcOwoF6y.mjs} +4 -4
- package/package.json +4 -2
- package/dist/CalendarDate-CWtpXgpD.js +0 -1
- package/dist/Create-BP8TX6rj.js +0 -1
- package/dist/DateFormatter-BbcSwTs4.js +0 -1
- package/dist/DateFormatter-CbO0PVUK.mjs +0 -99
- package/dist/Detail-DUo6qKqO.js +0 -1
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-BWuKVkvV.js +0 -1
- package/dist/EditLayout.vue_vue_type_script_setup_true_lang-D0-EcU0_.mjs +0 -55
- package/dist/Overview-BNMZ9MUK.js +0 -1
- package/dist/Overview-CEPodGCn.mjs +0 -311
- package/dist/Overview-CvquDPhB.js +0 -1
- package/dist/Overview-D67UjG6n.mjs +0 -947
- package/dist/RegularSlotEditor.vue_vue_type_script_setup_true_lang-0xZSq0rx.js +0 -1
- package/dist/RegularSlotEditor.vue_vue_type_script_setup_true_lang-Bj_PVLLV.mjs +0 -392
- package/dist/TableView-Dv4YXBD1.js +0 -111
- package/dist/View-7qb_ohVo.js +0 -1
- package/dist/agenda-B49oKGeh.mjs +0 -706
- package/dist/agenda-DipQ5IWP.js +0 -1
- package/dist/availability-C7q9tq6l.js +0 -1
- package/dist/availability-DeCkqiu8.mjs +0 -613
- package/dist/exceptions-DJ9zWX3k.js +0 -1
- package/dist/index-CKPshlZ8-CIz1tDwX.js +0 -1
- package/dist/index-DUeFrD-B.js +0 -1
- package/dist/index-DsnoK4ia.mjs +0 -579
- package/dist/index-WL1P6d3j.js +0 -1
- package/dist/index-_mG-aU3Z.mjs +0 -87
- package/dist/index-_sQDF1pH.js +0 -1
- package/dist/index-klI238nT.mjs +0 -24
- package/dist/payment-kTjsV0Jj.js +0 -1
- package/dist/payment-zpCM0LD-.mjs +0 -981
- package/dist/regular-C4_3YXqx.mjs +0 -602
- package/dist/regular-DFwPEbZO.js +0 -1
- package/dist/regular-slots-4ooEpICB.mjs +0 -67
- package/dist/regular-slots-BAVGbomI.js +0 -1
- package/dist/resources-MpQkSstv.mjs +0 -563
- package/dist/resources-iM28T3dD.js +0 -1
- package/dist/src/appointments/components/edit/RegularSlotEditor.vue.d.ts +0 -16
|
@@ -0,0 +1,862 @@
|
|
|
1
|
+
import { defineComponent as Q, inject as K, openBlock as r, createElementBlock as g, createElementVNode as i, Fragment as I, renderList as q, withModifiers as ue, normalizeClass as ee, unref as o, createCommentVNode as T, toDisplayString as P, createTextVNode as m, resolveComponent as s, createBlock as $, withCtx as l, createVNode as t, computed as X, renderSlot as _e, ref as j, useTemplateRef as be, withAsyncContext as xe, watch as Ce, onMounted as ye, onUnmounted as we, provide as O, withKeys as ke } from "vue";
|
|
2
|
+
import { Filter as he, ChevronsUpDown as Pe, Check as se, RotateCcw as $e, ExternalLink as Se, Search as Me, Plus as Ve, LayoutGrid as Te, List as Ae } from "lucide-vue-next";
|
|
3
|
+
import { useModuleRoute as J, useModulePermissions as Y, useFirebaseIntegration as te, useConfirmation as ze, useModuleBreadcrumbs as Ie } from "@oneclick.dev/cms-kit";
|
|
4
|
+
import { u as Le } from "./index-AmUV8LZQ.mjs";
|
|
5
|
+
import { c as ae } from "./utils-BVKy9S2J.mjs";
|
|
6
|
+
import { t as D } from "./index-RLz1QPrf.mjs";
|
|
7
|
+
const Ee = { class: "grid @md:grid-cols-2 @2xl:grid-cols-3 @3xl:grid-cols-4 @4xl:grid-cols-5 @5xl:grid-cols-6 gap-6" }, De = ["onClick", "onContextmenu"], Fe = ["src"], Be = { class: "font-semibold" }, Ue = { class: "text-sm text-muted-foreground flex items-center gap-2" }, Re = { class: "flex items-center gap-2" }, je = { key: 0 }, Ke = /* @__PURE__ */ Q({
|
|
8
|
+
__name: "GridView",
|
|
9
|
+
props: {
|
|
10
|
+
products: {
|
|
11
|
+
type: Array,
|
|
12
|
+
required: !0
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
setup(U) {
|
|
16
|
+
const n = K("selection"), { navigateTo: y } = J(), { hasPermission: S } = Y(), w = (f, u) => {
|
|
17
|
+
const b = u.ctrlKey || u.metaKey;
|
|
18
|
+
if (u.shiftKey)
|
|
19
|
+
console.log("range");
|
|
20
|
+
else if (b || n.value.length > 0) {
|
|
21
|
+
const h = n.value.indexOf(f.id);
|
|
22
|
+
h > -1 ? n.value.splice(h, 1) : n.value.push(f.id);
|
|
23
|
+
} else
|
|
24
|
+
n.value = [], y(f.id);
|
|
25
|
+
}, a = (f) => {
|
|
26
|
+
f.target.closest(".GRID_ITEM") || (n.value = []);
|
|
27
|
+
}, _ = (f, u) => {
|
|
28
|
+
u.ctrlKey || u.metaKey ? n.value.includes(f.id) ? n.value.splice(n.value.indexOf(f.id), 1) : n.value.push(f.id) : n.value.includes(f.id) || (n.value = [f.id]);
|
|
29
|
+
};
|
|
30
|
+
return (f, u) => (r(), g("div", {
|
|
31
|
+
class: "@container mb-4 flex-1 select-none",
|
|
32
|
+
onClick: u[0] || (u[0] = (b) => n.value = []),
|
|
33
|
+
onContextmenu: a
|
|
34
|
+
}, [
|
|
35
|
+
i("div", Ee, [
|
|
36
|
+
(r(!0), g(I, null, q(U.products, (b) => (r(), g("div", {
|
|
37
|
+
key: b.id,
|
|
38
|
+
onClick: ue((A) => w(b, A), ["stop"]),
|
|
39
|
+
onContextmenu: (A) => _(b, A),
|
|
40
|
+
class: "GRID_ITEM cursor-pointer"
|
|
41
|
+
}, [
|
|
42
|
+
i("div", {
|
|
43
|
+
class: ee(["aspect-square bg-muted rounded-xl overflow-hidden mb-2 transition-all duration-200", { "outline outline-4 outline-primary/50": o(n).includes(b.id) }])
|
|
44
|
+
}, [
|
|
45
|
+
b.featuredMedia ? (r(), g("img", {
|
|
46
|
+
key: 0,
|
|
47
|
+
src: b.featuredMedia,
|
|
48
|
+
class: "w-full h-full object-cover pointer-events-none",
|
|
49
|
+
draggable: "false"
|
|
50
|
+
}, null, 8, Fe)) : T("", !0)
|
|
51
|
+
], 2),
|
|
52
|
+
i("div", null, [
|
|
53
|
+
i("p", Be, P(b.title), 1),
|
|
54
|
+
i("p", Ue, [
|
|
55
|
+
i("span", Re, [
|
|
56
|
+
b.status === "published" ? (r(), g(I, { key: 0 }, [
|
|
57
|
+
u[1] || (u[1] = i("span", { class: "block shrink-0 size-3 rounded-full bg-green-500" }, null, -1)),
|
|
58
|
+
u[2] || (u[2] = m(" Published ", -1))
|
|
59
|
+
], 64)) : b.status === "draft" ? (r(), g(I, { key: 1 }, [
|
|
60
|
+
u[3] || (u[3] = i("span", { class: "block shrink-0 size-3 rounded-full bg-blue-500" }, null, -1)),
|
|
61
|
+
u[4] || (u[4] = m(" Draft ", -1))
|
|
62
|
+
], 64)) : (r(), g(I, { key: 2 }, [
|
|
63
|
+
u[5] || (u[5] = i("span", { class: "block shrink-0 size-3 rounded-full bg-gray-300" }, null, -1)),
|
|
64
|
+
u[6] || (u[6] = m(" Archived ", -1))
|
|
65
|
+
], 64))
|
|
66
|
+
]),
|
|
67
|
+
b.variantsTotal > 1 ? (r(), g("span", je, "| " + P(b.variantsTotal) + " variants", 1)) : T("", !0)
|
|
68
|
+
])
|
|
69
|
+
])
|
|
70
|
+
], 40, De))), 128))
|
|
71
|
+
])
|
|
72
|
+
], 32));
|
|
73
|
+
}
|
|
74
|
+
}), Ne = { class: "flex items-center gap-2" }, Ge = {
|
|
75
|
+
key: 0,
|
|
76
|
+
class: "bg-green-500 text-green-950 px-2 py-1 rounded-lg text-xs"
|
|
77
|
+
}, He = {
|
|
78
|
+
key: 1,
|
|
79
|
+
class: "bg-blue-500 text-blue-950 px-2 py-1 rounded-lg text-xs"
|
|
80
|
+
}, Oe = {
|
|
81
|
+
key: 2,
|
|
82
|
+
class: "bg-gray-500 text-gray-950 px-2 py-1 rounded-lg text-xs"
|
|
83
|
+
}, qe = /* @__PURE__ */ Q({
|
|
84
|
+
__name: "ListView",
|
|
85
|
+
props: {
|
|
86
|
+
products: {
|
|
87
|
+
type: Array,
|
|
88
|
+
required: !0
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
setup(U) {
|
|
92
|
+
const n = K("selection"), { navigateTo: y } = J(), { hasPermission: S } = Y(), w = (a, _) => {
|
|
93
|
+
a ? n.value.push(_) : n.value = n.value.filter((f) => f !== _);
|
|
94
|
+
};
|
|
95
|
+
return (a, _) => {
|
|
96
|
+
const f = s("TableHead"), u = s("TableRow"), b = s("TableHeader"), A = s("Checkbox"), h = s("TableCell"), x = s("AvatarImage"), e = s("AvatarFallback"), C = s("Avatar"), k = s("TableBody"), M = s("Table"), V = s("Card");
|
|
97
|
+
return r(), $(V, { class: "w-full py-4 px-4" }, {
|
|
98
|
+
default: l(() => [
|
|
99
|
+
t(M, { class: "rounded overflow-hidden" }, {
|
|
100
|
+
default: l(() => [
|
|
101
|
+
t(b, null, {
|
|
102
|
+
default: l(() => [
|
|
103
|
+
t(u, null, {
|
|
104
|
+
default: l(() => [
|
|
105
|
+
o(n)?.length > 0 ? (r(), $(f, { key: 0 })) : T("", !0),
|
|
106
|
+
t(f, null, {
|
|
107
|
+
default: l(() => [..._[1] || (_[1] = [
|
|
108
|
+
m("Title", -1)
|
|
109
|
+
])]),
|
|
110
|
+
_: 1
|
|
111
|
+
}),
|
|
112
|
+
t(f, null, {
|
|
113
|
+
default: l(() => [..._[2] || (_[2] = [
|
|
114
|
+
m("Status", -1)
|
|
115
|
+
])]),
|
|
116
|
+
_: 1
|
|
117
|
+
}),
|
|
118
|
+
t(f, null, {
|
|
119
|
+
default: l(() => [..._[3] || (_[3] = [
|
|
120
|
+
m(" Variants", -1)
|
|
121
|
+
])]),
|
|
122
|
+
_: 1
|
|
123
|
+
}),
|
|
124
|
+
t(f, null, {
|
|
125
|
+
default: l(() => [..._[4] || (_[4] = [
|
|
126
|
+
m("Price", -1)
|
|
127
|
+
])]),
|
|
128
|
+
_: 1
|
|
129
|
+
})
|
|
130
|
+
]),
|
|
131
|
+
_: 1
|
|
132
|
+
})
|
|
133
|
+
]),
|
|
134
|
+
_: 1
|
|
135
|
+
}),
|
|
136
|
+
t(k, null, {
|
|
137
|
+
default: l(() => [
|
|
138
|
+
(r(!0), g(I, null, q(U.products, (v) => (r(), $(u, {
|
|
139
|
+
key: v.id,
|
|
140
|
+
onClick: (L) => o(y)(v.id),
|
|
141
|
+
class: "cursor-pointer"
|
|
142
|
+
}, {
|
|
143
|
+
default: l(() => [
|
|
144
|
+
o(n)?.length > 0 ? (r(), $(h, { key: 0 }, {
|
|
145
|
+
default: l(() => [
|
|
146
|
+
t(A, {
|
|
147
|
+
"model-value": o(n)?.includes(v.id),
|
|
148
|
+
"onUpdate:modelValue": (L) => w(L, v.id),
|
|
149
|
+
onClick: _[0] || (_[0] = ue(() => {
|
|
150
|
+
}, ["prevent", "stop"]))
|
|
151
|
+
}, null, 8, ["model-value", "onUpdate:modelValue"])
|
|
152
|
+
]),
|
|
153
|
+
_: 2
|
|
154
|
+
}, 1024)) : T("", !0),
|
|
155
|
+
t(h, { class: "font-medium" }, {
|
|
156
|
+
default: l(() => [
|
|
157
|
+
i("div", Ne, [
|
|
158
|
+
t(C, { class: "size-12 rounded-xl" }, {
|
|
159
|
+
default: l(() => [
|
|
160
|
+
t(x, {
|
|
161
|
+
src: v.media?.[0],
|
|
162
|
+
class: "object-cover"
|
|
163
|
+
}, null, 8, ["src"]),
|
|
164
|
+
t(e, { class: "rounded-xl" })
|
|
165
|
+
]),
|
|
166
|
+
_: 2
|
|
167
|
+
}, 1024),
|
|
168
|
+
i("span", null, P(v.title), 1)
|
|
169
|
+
])
|
|
170
|
+
]),
|
|
171
|
+
_: 2
|
|
172
|
+
}, 1024),
|
|
173
|
+
t(h, null, {
|
|
174
|
+
default: l(() => [
|
|
175
|
+
v.status === "published" ? (r(), g("span", Ge, "Published")) : v.status === "draft" ? (r(), g("span", He, "Draft")) : v.status === "archived" ? (r(), g("span", Oe, "Archived")) : T("", !0)
|
|
176
|
+
]),
|
|
177
|
+
_: 2
|
|
178
|
+
}, 1024),
|
|
179
|
+
t(h, null, {
|
|
180
|
+
default: l(() => [
|
|
181
|
+
m(P(v.variantsTotal), 1)
|
|
182
|
+
]),
|
|
183
|
+
_: 2
|
|
184
|
+
}, 1024),
|
|
185
|
+
t(h, { class: "text-right" }, {
|
|
186
|
+
default: l(() => [
|
|
187
|
+
m(" € " + P(v.price || 0), 1)
|
|
188
|
+
]),
|
|
189
|
+
_: 2
|
|
190
|
+
}, 1024)
|
|
191
|
+
]),
|
|
192
|
+
_: 2
|
|
193
|
+
}, 1032, ["onClick"]))), 128))
|
|
194
|
+
]),
|
|
195
|
+
_: 1
|
|
196
|
+
})
|
|
197
|
+
]),
|
|
198
|
+
_: 1
|
|
199
|
+
})
|
|
200
|
+
]),
|
|
201
|
+
_: 1
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
}), Qe = { class: "truncate" }, We = { key: 0 }, Xe = { key: 1 }, Je = { key: 2 }, Ye = { key: 3 }, Ze = { class: "relative w-full max-w-sm items-center" }, et = { class: "truncate" }, tt = { class: "truncate" }, lt = { class: "flex items-center space-x-2 mb-4" }, ot = { class: "flex items-center space-x-2 mb-4" }, nt = { class: "flex items-center space-x-2 mb-4" }, st = /* @__PURE__ */ Q({
|
|
206
|
+
__name: "FilterPopover",
|
|
207
|
+
setup(U) {
|
|
208
|
+
const n = K("filter"), y = K("collections"), S = () => {
|
|
209
|
+
n.value = {
|
|
210
|
+
collections: [],
|
|
211
|
+
published: !0,
|
|
212
|
+
draft: !0,
|
|
213
|
+
archived: !1
|
|
214
|
+
};
|
|
215
|
+
};
|
|
216
|
+
return (w, a) => {
|
|
217
|
+
const _ = s("Button"), f = s("PopoverTrigger"), u = s("ComboboxTrigger"), b = s("ComboboxAnchor"), A = s("ComboboxInput"), h = s("ComboboxEmpty"), x = s("ComboboxItemIndicator"), e = s("ComboboxItem"), C = s("ScrollArea"), k = s("ComboboxGroup"), M = s("ComboboxList"), V = s("Combobox"), v = s("Checkbox"), L = s("PopoverContent"), E = s("Popover");
|
|
218
|
+
return r(), $(E, null, {
|
|
219
|
+
default: l(() => [
|
|
220
|
+
t(f, { asChild: "" }, {
|
|
221
|
+
default: l(() => [
|
|
222
|
+
t(_, { variant: "outline" }, {
|
|
223
|
+
default: l(() => [
|
|
224
|
+
t(o(he), { class: "size-4" }),
|
|
225
|
+
a[4] || (a[4] = m(" Filter ", -1))
|
|
226
|
+
]),
|
|
227
|
+
_: 1
|
|
228
|
+
})
|
|
229
|
+
]),
|
|
230
|
+
_: 1
|
|
231
|
+
}),
|
|
232
|
+
t(L, { class: "w-64" }, {
|
|
233
|
+
default: l(() => [
|
|
234
|
+
a[14] || (a[14] = i("p", { class: "text-sm font-medium text-muted-foreground mb-4" }, " Filter by Collection ", -1)),
|
|
235
|
+
t(V, {
|
|
236
|
+
modelValue: o(n).collections,
|
|
237
|
+
"onUpdate:modelValue": a[0] || (a[0] = (c) => o(n).collections = c),
|
|
238
|
+
by: "id",
|
|
239
|
+
multiple: !0,
|
|
240
|
+
class: "mb-6"
|
|
241
|
+
}, {
|
|
242
|
+
default: l(() => [
|
|
243
|
+
t(b, { "as-child": "" }, {
|
|
244
|
+
default: l(() => [
|
|
245
|
+
t(u, { "as-child": "" }, {
|
|
246
|
+
default: l(() => [
|
|
247
|
+
t(_, {
|
|
248
|
+
variant: "outline",
|
|
249
|
+
class: "justify-between w-full"
|
|
250
|
+
}, {
|
|
251
|
+
default: l(() => [
|
|
252
|
+
i("span", Qe, [
|
|
253
|
+
o(n).collections.length === 1 ? (r(), g("span", We, P(o(y).find((c) => c.id === o(n).collections[0])?.title), 1)) : o(n).collections.length === 2 ? (r(), g("span", Xe, P(o(y).find((c) => c.id === o(n).collections[0])?.title) + ", " + P(o(y).find((c) => c.id === o(n).collections[1])?.title), 1)) : o(n).collections.length > 2 ? (r(), g("span", Je, P(o(y).find((c) => c.id === o(n).collections[0])?.title) + ", " + P(o(y).find((c) => c.id === o(n).collections[1])?.title) + " + " + P(o(n).collections.length - 2), 1)) : (r(), g("span", Ye, "Select collection"))
|
|
254
|
+
]),
|
|
255
|
+
t(o(Pe), { class: "ml-2 size-4 shrink-0 opacity-50" })
|
|
256
|
+
]),
|
|
257
|
+
_: 1
|
|
258
|
+
})
|
|
259
|
+
]),
|
|
260
|
+
_: 1
|
|
261
|
+
})
|
|
262
|
+
]),
|
|
263
|
+
_: 1
|
|
264
|
+
}),
|
|
265
|
+
t(M, null, {
|
|
266
|
+
default: l(() => [
|
|
267
|
+
i("div", Ze, [
|
|
268
|
+
t(A, { placeholder: "Select category..." })
|
|
269
|
+
]),
|
|
270
|
+
t(h, null, {
|
|
271
|
+
default: l(() => [...a[5] || (a[5] = [
|
|
272
|
+
m(" No category found. ", -1)
|
|
273
|
+
])]),
|
|
274
|
+
_: 1
|
|
275
|
+
}),
|
|
276
|
+
o(y)?.filter((c) => c.status === "published")?.length > 0 ? (r(), g(I, { key: 0 }, [
|
|
277
|
+
a[7] || (a[7] = i("p", { class: "px-2 py-1.5 text-sm font-medium mt-2" }, "Published", -1)),
|
|
278
|
+
t(k, null, {
|
|
279
|
+
default: l(() => [
|
|
280
|
+
t(C, { class: "max-h-[200px] overflow-y-auto" }, {
|
|
281
|
+
default: l(() => [
|
|
282
|
+
(r(!0), g(I, null, q(o(y).filter((c) => c.status === "published"), (c) => (r(), $(e, {
|
|
283
|
+
key: c.id,
|
|
284
|
+
value: c.id
|
|
285
|
+
}, {
|
|
286
|
+
default: l(() => [
|
|
287
|
+
a[6] || (a[6] = i("span", { class: "size-2 rounded-full bg-green-500" }, null, -1)),
|
|
288
|
+
i("span", et, P(c.title), 1),
|
|
289
|
+
t(x, null, {
|
|
290
|
+
default: l(() => [
|
|
291
|
+
t(o(se), {
|
|
292
|
+
class: ee(o(ae)("ml-auto size-4"))
|
|
293
|
+
}, null, 8, ["class"])
|
|
294
|
+
]),
|
|
295
|
+
_: 1
|
|
296
|
+
})
|
|
297
|
+
]),
|
|
298
|
+
_: 2
|
|
299
|
+
}, 1032, ["value"]))), 128))
|
|
300
|
+
]),
|
|
301
|
+
_: 1
|
|
302
|
+
})
|
|
303
|
+
]),
|
|
304
|
+
_: 1
|
|
305
|
+
})
|
|
306
|
+
], 64)) : T("", !0),
|
|
307
|
+
o(y)?.filter((c) => c.status === "draft")?.length > 0 ? (r(), g(I, { key: 1 }, [
|
|
308
|
+
a[9] || (a[9] = i("p", { class: "px-2 py-1.5 text-sm font-medium" }, "Drafts", -1)),
|
|
309
|
+
t(k, null, {
|
|
310
|
+
default: l(() => [
|
|
311
|
+
t(C, { class: "max-h-[200px] overflow-y-auto" }, {
|
|
312
|
+
default: l(() => [
|
|
313
|
+
(r(!0), g(I, null, q(o(y).filter((c) => c.status === "draft"), (c) => (r(), $(e, {
|
|
314
|
+
key: c.id,
|
|
315
|
+
value: c.id
|
|
316
|
+
}, {
|
|
317
|
+
default: l(() => [
|
|
318
|
+
a[8] || (a[8] = i("span", { class: "size-2 rounded-full bg-blue-500" }, null, -1)),
|
|
319
|
+
i("span", tt, P(c.title), 1),
|
|
320
|
+
t(x, null, {
|
|
321
|
+
default: l(() => [
|
|
322
|
+
t(o(se), {
|
|
323
|
+
class: ee(o(ae)("ml-auto size-4"))
|
|
324
|
+
}, null, 8, ["class"])
|
|
325
|
+
]),
|
|
326
|
+
_: 1
|
|
327
|
+
})
|
|
328
|
+
]),
|
|
329
|
+
_: 2
|
|
330
|
+
}, 1032, ["value"]))), 128))
|
|
331
|
+
]),
|
|
332
|
+
_: 1
|
|
333
|
+
})
|
|
334
|
+
]),
|
|
335
|
+
_: 1
|
|
336
|
+
})
|
|
337
|
+
], 64)) : T("", !0)
|
|
338
|
+
]),
|
|
339
|
+
_: 1
|
|
340
|
+
})
|
|
341
|
+
]),
|
|
342
|
+
_: 1
|
|
343
|
+
}, 8, ["modelValue"]),
|
|
344
|
+
a[15] || (a[15] = i("p", { class: "text-sm font-medium text-muted-foreground mb-4" }, " Filter by Status ", -1)),
|
|
345
|
+
i("div", lt, [
|
|
346
|
+
t(v, {
|
|
347
|
+
id: "chk_published_products",
|
|
348
|
+
modelValue: o(n).published,
|
|
349
|
+
"onUpdate:modelValue": a[1] || (a[1] = (c) => o(n).published = c)
|
|
350
|
+
}, null, 8, ["modelValue"]),
|
|
351
|
+
a[10] || (a[10] = i("label", {
|
|
352
|
+
for: "chk_published_products",
|
|
353
|
+
class: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
354
|
+
}, " Show published products ", -1))
|
|
355
|
+
]),
|
|
356
|
+
i("div", ot, [
|
|
357
|
+
t(v, {
|
|
358
|
+
id: "chk_draft_products",
|
|
359
|
+
modelValue: o(n).draft,
|
|
360
|
+
"onUpdate:modelValue": a[2] || (a[2] = (c) => o(n).draft = c)
|
|
361
|
+
}, null, 8, ["modelValue"]),
|
|
362
|
+
a[11] || (a[11] = i("label", {
|
|
363
|
+
for: "chk_draft_products",
|
|
364
|
+
class: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
365
|
+
}, " Show draft products ", -1))
|
|
366
|
+
]),
|
|
367
|
+
i("div", nt, [
|
|
368
|
+
t(v, {
|
|
369
|
+
id: "chk_archived_products",
|
|
370
|
+
modelValue: o(n).archived,
|
|
371
|
+
"onUpdate:modelValue": a[3] || (a[3] = (c) => o(n).archived = c)
|
|
372
|
+
}, null, 8, ["modelValue"]),
|
|
373
|
+
a[12] || (a[12] = i("label", {
|
|
374
|
+
for: "chk_archived_products",
|
|
375
|
+
class: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
376
|
+
}, " Show archived products ", -1))
|
|
377
|
+
]),
|
|
378
|
+
o(n).collections.length > 0 || !o(n).published || !o(n).draft || o(n).archived ? (r(), $(_, {
|
|
379
|
+
key: 0,
|
|
380
|
+
variant: "secondary",
|
|
381
|
+
class: "ml-auto my-2",
|
|
382
|
+
size: "sm",
|
|
383
|
+
onClick: S
|
|
384
|
+
}, {
|
|
385
|
+
default: l(() => [
|
|
386
|
+
t(o($e), { class: "size-3" }),
|
|
387
|
+
a[13] || (a[13] = i("span", { class: "ml-0.5 text-xs" }, "Reset filters", -1))
|
|
388
|
+
]),
|
|
389
|
+
_: 1
|
|
390
|
+
})) : T("", !0)
|
|
391
|
+
]),
|
|
392
|
+
_: 1
|
|
393
|
+
})
|
|
394
|
+
]),
|
|
395
|
+
_: 1
|
|
396
|
+
});
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
}), at = /* @__PURE__ */ Q({
|
|
400
|
+
__name: "ProductContextMenu",
|
|
401
|
+
emits: ["selectAll", "duplicateProduct", "deleteProduct", "deleteSelection"],
|
|
402
|
+
setup(U, { emit: n }) {
|
|
403
|
+
const y = n, S = K("products"), w = K("selection"), a = K("config"), { hasPermission: _ } = Y(), { navigateTo: f } = J(), u = X(() => w.value?.length !== 1 ? null : S.value?.find((x) => x.id === w.value[0])), b = (x) => {
|
|
404
|
+
let e = a.previewUrl;
|
|
405
|
+
e = e.replace("{{ id", "{{id"), e = e.replace("id }}", "id}}"), e = e.replace("{{id}}", x.id), e = e.replace("{{ slug", "{{slug"), e = e.replace("slug }}", "slug}}"), e = e.replace("{{slug}}", x.slug), window.open(e, "_blank");
|
|
406
|
+
}, A = async (x, e) => {
|
|
407
|
+
try {
|
|
408
|
+
if (!["draft", "published", "archived"].includes(e)) return;
|
|
409
|
+
await te(a.project).update(a.productCollection, x.id, { status: e }), x.status = e, D.success("Product status changed");
|
|
410
|
+
} catch {
|
|
411
|
+
D.error("Failed to change product status");
|
|
412
|
+
}
|
|
413
|
+
}, h = async (x) => {
|
|
414
|
+
try {
|
|
415
|
+
if (!["draft", "published", "archived"].includes(x)) return;
|
|
416
|
+
const e = te(a.project), C = [];
|
|
417
|
+
w.value.forEach(async (k) => {
|
|
418
|
+
C.push(e.update(a.productCollection, k, { status: x }));
|
|
419
|
+
}), D.promise(Promise.all(C), {
|
|
420
|
+
loading: `Changing status of ${w.value.length} products...`,
|
|
421
|
+
success: () => {
|
|
422
|
+
const k = w.value.length;
|
|
423
|
+
return w.value.forEach((M) => {
|
|
424
|
+
S.value.find((V) => V.id == M).status = x;
|
|
425
|
+
}), w.value = [], `Product status changed for ${k} products`;
|
|
426
|
+
},
|
|
427
|
+
error: (k) => "Failed to change product status"
|
|
428
|
+
});
|
|
429
|
+
} catch {
|
|
430
|
+
D.error("Failed to change product status");
|
|
431
|
+
}
|
|
432
|
+
};
|
|
433
|
+
return (x, e) => {
|
|
434
|
+
const C = s("ContextMenuTrigger"), k = s("ContextMenuShortcut"), M = s("ContextMenuItem"), V = s("ContextMenuContent"), v = s("ContextMenuSeparator"), L = s("ContextMenuSubTrigger"), E = s("ContextMenuCheckboxItem"), c = s("ContextMenuSubContent"), G = s("ContextMenuSub"), Z = s("ContextMenu");
|
|
435
|
+
return r(), $(Z, null, {
|
|
436
|
+
default: l(() => [
|
|
437
|
+
t(C, { class: "flex flex-1" }, {
|
|
438
|
+
default: l(() => [
|
|
439
|
+
_e(x.$slots, "default")
|
|
440
|
+
]),
|
|
441
|
+
_: 3
|
|
442
|
+
}),
|
|
443
|
+
o(w).length === 0 ? (r(), $(V, {
|
|
444
|
+
key: 0,
|
|
445
|
+
class: "w-64"
|
|
446
|
+
}, {
|
|
447
|
+
default: l(() => [
|
|
448
|
+
t(M, {
|
|
449
|
+
inset: "",
|
|
450
|
+
onClick: e[0] || (e[0] = (z) => y("selectAll"))
|
|
451
|
+
}, {
|
|
452
|
+
default: l(() => [
|
|
453
|
+
e[13] || (e[13] = m(" Select all ", -1)),
|
|
454
|
+
t(k, null, {
|
|
455
|
+
default: l(() => [...e[12] || (e[12] = [
|
|
456
|
+
m("⌘ + A", -1)
|
|
457
|
+
])]),
|
|
458
|
+
_: 1
|
|
459
|
+
})
|
|
460
|
+
]),
|
|
461
|
+
_: 1
|
|
462
|
+
})
|
|
463
|
+
]),
|
|
464
|
+
_: 1
|
|
465
|
+
})) : T("", !0),
|
|
466
|
+
o(w).length === 1 && u.value ? (r(), $(V, {
|
|
467
|
+
key: 1,
|
|
468
|
+
class: "w-64"
|
|
469
|
+
}, {
|
|
470
|
+
default: l(() => [
|
|
471
|
+
t(M, {
|
|
472
|
+
inset: "",
|
|
473
|
+
onClick: e[1] || (e[1] = (z) => o(f)(u.value.id))
|
|
474
|
+
}, {
|
|
475
|
+
default: l(() => [...e[14] || (e[14] = [
|
|
476
|
+
m(" Edit product ", -1)
|
|
477
|
+
])]),
|
|
478
|
+
_: 1
|
|
479
|
+
}),
|
|
480
|
+
t(v),
|
|
481
|
+
o(a).previewUrl ? (r(), g(I, { key: 0 }, [
|
|
482
|
+
t(M, {
|
|
483
|
+
inset: "",
|
|
484
|
+
onClick: e[2] || (e[2] = (z) => b(u.value))
|
|
485
|
+
}, {
|
|
486
|
+
default: l(() => [
|
|
487
|
+
e[15] || (e[15] = m(" Preview product ", -1)),
|
|
488
|
+
t(k, null, {
|
|
489
|
+
default: l(() => [
|
|
490
|
+
t(o(Se), { class: "size-4" })
|
|
491
|
+
]),
|
|
492
|
+
_: 1
|
|
493
|
+
})
|
|
494
|
+
]),
|
|
495
|
+
_: 1
|
|
496
|
+
}),
|
|
497
|
+
t(v)
|
|
498
|
+
], 64)) : T("", !0),
|
|
499
|
+
t(M, {
|
|
500
|
+
inset: "",
|
|
501
|
+
onClick: e[3] || (e[3] = (z) => y("duplicateProduct", u.value))
|
|
502
|
+
}, {
|
|
503
|
+
default: l(() => [...e[16] || (e[16] = [
|
|
504
|
+
m(" Duplicate product ", -1)
|
|
505
|
+
])]),
|
|
506
|
+
_: 1
|
|
507
|
+
}),
|
|
508
|
+
t(G, null, {
|
|
509
|
+
default: l(() => [
|
|
510
|
+
t(L, { inset: "" }, {
|
|
511
|
+
default: l(() => [...e[17] || (e[17] = [
|
|
512
|
+
m(" Change status ", -1)
|
|
513
|
+
])]),
|
|
514
|
+
_: 1
|
|
515
|
+
}),
|
|
516
|
+
t(c, { class: "w-48" }, {
|
|
517
|
+
default: l(() => [
|
|
518
|
+
t(E, {
|
|
519
|
+
onClick: e[4] || (e[4] = (z) => A(u.value, "draft")),
|
|
520
|
+
modelValue: u.value.status === "draft"
|
|
521
|
+
}, {
|
|
522
|
+
default: l(() => [...e[18] || (e[18] = [
|
|
523
|
+
i("span", { class: "size-2 rounded-full bg-blue-500" }, null, -1),
|
|
524
|
+
m(" Draft ", -1)
|
|
525
|
+
])]),
|
|
526
|
+
_: 1
|
|
527
|
+
}, 8, ["modelValue"]),
|
|
528
|
+
t(E, {
|
|
529
|
+
onClick: e[5] || (e[5] = (z) => A(u.value, "published")),
|
|
530
|
+
modelValue: u.value.status === "published"
|
|
531
|
+
}, {
|
|
532
|
+
default: l(() => [...e[19] || (e[19] = [
|
|
533
|
+
i("span", { class: "size-2 rounded-full bg-green-500" }, null, -1),
|
|
534
|
+
m(" Published ", -1)
|
|
535
|
+
])]),
|
|
536
|
+
_: 1
|
|
537
|
+
}, 8, ["modelValue"]),
|
|
538
|
+
t(E, {
|
|
539
|
+
onClick: e[6] || (e[6] = (z) => A(u.value, "archived")),
|
|
540
|
+
modelValue: u.value.status === "archived"
|
|
541
|
+
}, {
|
|
542
|
+
default: l(() => [...e[20] || (e[20] = [
|
|
543
|
+
i("span", { class: "size-2 rounded-full bg-gray-300" }, null, -1),
|
|
544
|
+
m(" Archived ", -1)
|
|
545
|
+
])]),
|
|
546
|
+
_: 1
|
|
547
|
+
}, 8, ["modelValue"])
|
|
548
|
+
]),
|
|
549
|
+
_: 1
|
|
550
|
+
})
|
|
551
|
+
]),
|
|
552
|
+
_: 1
|
|
553
|
+
}),
|
|
554
|
+
t(M, {
|
|
555
|
+
inset: "",
|
|
556
|
+
variant: "destructive",
|
|
557
|
+
onClick: e[7] || (e[7] = (z) => y("deleteProduct", u.value))
|
|
558
|
+
}, {
|
|
559
|
+
default: l(() => [...e[21] || (e[21] = [
|
|
560
|
+
m(" Delete product ", -1)
|
|
561
|
+
])]),
|
|
562
|
+
_: 1
|
|
563
|
+
})
|
|
564
|
+
]),
|
|
565
|
+
_: 1
|
|
566
|
+
})) : T("", !0),
|
|
567
|
+
o(w).length > 1 ? (r(), $(V, {
|
|
568
|
+
key: 2,
|
|
569
|
+
class: "w-64"
|
|
570
|
+
}, {
|
|
571
|
+
default: l(() => [
|
|
572
|
+
t(G, null, {
|
|
573
|
+
default: l(() => [
|
|
574
|
+
t(L, { inset: "" }, {
|
|
575
|
+
default: l(() => [
|
|
576
|
+
m(" Change status (" + P(o(w).length) + ") ", 1)
|
|
577
|
+
]),
|
|
578
|
+
_: 1
|
|
579
|
+
}),
|
|
580
|
+
t(c, { class: "w-48" }, {
|
|
581
|
+
default: l(() => [
|
|
582
|
+
t(E, {
|
|
583
|
+
onClick: e[8] || (e[8] = (z) => h("draft"))
|
|
584
|
+
}, {
|
|
585
|
+
default: l(() => [...e[22] || (e[22] = [
|
|
586
|
+
i("span", { class: "size-2 rounded-full bg-blue-500" }, null, -1),
|
|
587
|
+
m(" Draft ", -1)
|
|
588
|
+
])]),
|
|
589
|
+
_: 1
|
|
590
|
+
}),
|
|
591
|
+
t(E, {
|
|
592
|
+
onClick: e[9] || (e[9] = (z) => h("published"))
|
|
593
|
+
}, {
|
|
594
|
+
default: l(() => [...e[23] || (e[23] = [
|
|
595
|
+
i("span", { class: "size-2 rounded-full bg-green-500" }, null, -1),
|
|
596
|
+
m(" Published ", -1)
|
|
597
|
+
])]),
|
|
598
|
+
_: 1
|
|
599
|
+
}),
|
|
600
|
+
t(E, {
|
|
601
|
+
onClick: e[10] || (e[10] = (z) => h("archived"))
|
|
602
|
+
}, {
|
|
603
|
+
default: l(() => [...e[24] || (e[24] = [
|
|
604
|
+
i("span", { class: "size-2 rounded-full bg-gray-300" }, null, -1),
|
|
605
|
+
m(" Archived ", -1)
|
|
606
|
+
])]),
|
|
607
|
+
_: 1
|
|
608
|
+
})
|
|
609
|
+
]),
|
|
610
|
+
_: 1
|
|
611
|
+
})
|
|
612
|
+
]),
|
|
613
|
+
_: 1
|
|
614
|
+
}),
|
|
615
|
+
t(M, {
|
|
616
|
+
inset: "",
|
|
617
|
+
variant: "destructive",
|
|
618
|
+
onClick: e[11] || (e[11] = (z) => y("deleteSelection"))
|
|
619
|
+
}, {
|
|
620
|
+
default: l(() => [
|
|
621
|
+
m(" Delete products (" + P(o(w).length) + ") ", 1)
|
|
622
|
+
]),
|
|
623
|
+
_: 1
|
|
624
|
+
})
|
|
625
|
+
]),
|
|
626
|
+
_: 1
|
|
627
|
+
})) : T("", !0)
|
|
628
|
+
]),
|
|
629
|
+
_: 3
|
|
630
|
+
});
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
}), ut = { class: "relative flex flex-col flex-1" }, it = {
|
|
634
|
+
ref: "container",
|
|
635
|
+
class: "flex items-center justify-between gap-4 w-full mt-12 mb-8"
|
|
636
|
+
}, rt = { class: "flex items-center gap-4" }, dt = { class: "text-lg whitespace-nowrap" }, ct = { class: "relative w-full max-w-sm items-center" }, pt = { class: "absolute start-0 inset-y-0 flex items-center justify-center px-2" }, ft = { class: "flex items-center gap-4" }, mt = { class: "flex flex-1" }, yt = /* @__PURE__ */ Q({
|
|
637
|
+
__name: "Overview",
|
|
638
|
+
props: {
|
|
639
|
+
config: {
|
|
640
|
+
type: Object,
|
|
641
|
+
required: !0
|
|
642
|
+
}
|
|
643
|
+
},
|
|
644
|
+
async setup(U) {
|
|
645
|
+
let n, y;
|
|
646
|
+
const S = U, { hasPermission: w } = Y(), { navigateTo: a } = J(), { confirm: _ } = ze();
|
|
647
|
+
Ie(() => []);
|
|
648
|
+
const f = te(S.config.project), u = j([]), b = async () => {
|
|
649
|
+
const p = await f.find(S.config.productCollection);
|
|
650
|
+
u.value = p || [];
|
|
651
|
+
}, A = be("container"), { width: h } = Le(A), x = j("grid"), e = j(1), C = j([]), k = j(""), M = j([]);
|
|
652
|
+
M.value = ([n, y] = xe(() => E()), n = await n, y(), n);
|
|
653
|
+
const V = X(() => x.value === "grid" ? h.value < 768 ? 6 : h.value < 896 ? 8 : h.value < 1024 ? 10 : 12 : 10), v = X(() => u.value.filter((p) => !(R.value.collections.length > 0 && !p.collections?.some((d) => R.value.collections.includes(d)) || !R.value.published && p.status === "published" || !R.value.draft && p.status === "draft" || !R.value.archived && p.status === "archived")).filter((p) => p.title.toLowerCase().includes(k.value.toLowerCase()) || p.slug.toLowerCase().includes(k.value.toLowerCase()) || p.id.toLowerCase().includes(k.value.toLowerCase()))), L = X(() => {
|
|
654
|
+
if (v.value.length <= V.value)
|
|
655
|
+
return v.value;
|
|
656
|
+
const p = (e.value - 1) * V.value, d = p + V.value;
|
|
657
|
+
return v.value.slice(p, d);
|
|
658
|
+
});
|
|
659
|
+
async function E() {
|
|
660
|
+
if (!S.config.collectionsCollection) return [];
|
|
661
|
+
const p = S.config.collectionsCollection.split(":");
|
|
662
|
+
return p.length !== 2 ? [] : (await f.get(p[0]))?.[p[1]] || [];
|
|
663
|
+
}
|
|
664
|
+
async function c(p) {
|
|
665
|
+
return (await f.find(S.config.productCollection, {
|
|
666
|
+
filters: [
|
|
667
|
+
{
|
|
668
|
+
field: "slug",
|
|
669
|
+
operator: "==",
|
|
670
|
+
value: p
|
|
671
|
+
}
|
|
672
|
+
]
|
|
673
|
+
})).length > 0;
|
|
674
|
+
}
|
|
675
|
+
const G = () => {
|
|
676
|
+
C.value = L.value.map((p) => p.id);
|
|
677
|
+
}, Z = async (p) => {
|
|
678
|
+
try {
|
|
679
|
+
let d = { ...p }, B = d.slug + "-copy", N = 2;
|
|
680
|
+
for (; await c(B); )
|
|
681
|
+
B = d.slug + "-copy-" + N, N++;
|
|
682
|
+
d.id = void 0, d.createdAt = /* @__PURE__ */ new Date(), d.updatedAt = /* @__PURE__ */ new Date(), d.slug = B, d.status = "draft", d.title = d.title + " (copy)";
|
|
683
|
+
const W = await f.add(S.config.productCollection, d);
|
|
684
|
+
a(W.id), D.success("Product duplicated");
|
|
685
|
+
} catch {
|
|
686
|
+
D.error("Failed to duplicate product");
|
|
687
|
+
}
|
|
688
|
+
}, z = async (p) => {
|
|
689
|
+
if (await _(`Are you sure you want to delete "${p.title}"?`))
|
|
690
|
+
try {
|
|
691
|
+
await f.remove(S.config.productCollection, p.id), u.value = u.value.filter((B) => B.id !== p.id), C.value = [], D.success("Product deleted");
|
|
692
|
+
} catch {
|
|
693
|
+
D.error("Failed to delete product");
|
|
694
|
+
}
|
|
695
|
+
}, le = async () => {
|
|
696
|
+
if (await _(`Are you sure you want to delete all selected products (${C.value.length})?`))
|
|
697
|
+
try {
|
|
698
|
+
C.value.forEach(async (d) => {
|
|
699
|
+
await f.remove(S.config.productCollection, d);
|
|
700
|
+
}), u.value = u.value.filter((d) => !C.value.includes(d.id)), C.value = [], D.success("Products deleted");
|
|
701
|
+
} catch {
|
|
702
|
+
D.error("Failed to delete products");
|
|
703
|
+
}
|
|
704
|
+
}, R = j({
|
|
705
|
+
collections: [],
|
|
706
|
+
published: !0,
|
|
707
|
+
draft: !0,
|
|
708
|
+
archived: !1
|
|
709
|
+
});
|
|
710
|
+
Ce(R, () => {
|
|
711
|
+
e.value = 1;
|
|
712
|
+
});
|
|
713
|
+
const oe = (p) => {
|
|
714
|
+
p.target?.matches("input, textarea") || p.target?.isContentEditable || (p.key === "Escape" && (C.value = []), (p.metaKey || p.ctrlKey) && p.key.toLowerCase() === "a" && (p.preventDefault(), G()));
|
|
715
|
+
};
|
|
716
|
+
return ye(() => {
|
|
717
|
+
b(), window.addEventListener("keydown", oe);
|
|
718
|
+
}), we(() => {
|
|
719
|
+
window.removeEventListener("keydown", oe);
|
|
720
|
+
}), O("config", S.config), O("filter", R), O("products", u), O("collections", M), O("selection", C), (p, d) => {
|
|
721
|
+
const B = s("Input"), N = s("Button"), W = s("SegmentedControlButton"), ie = s("SegmentedControl"), re = s("PaginationFirst"), de = s("PaginationPrev"), ce = s("PaginationListItem"), pe = s("PaginationEllipsis"), fe = s("PaginationNext"), me = s("PaginationLast"), ve = s("PaginationList"), ge = s("Pagination");
|
|
722
|
+
return r(), g("div", ut, [
|
|
723
|
+
i("div", it, [
|
|
724
|
+
i("div", rt, [
|
|
725
|
+
i("p", dt, P(v.value?.length) + " products", 1),
|
|
726
|
+
i("div", ct, [
|
|
727
|
+
t(B, {
|
|
728
|
+
id: "search",
|
|
729
|
+
type: "text",
|
|
730
|
+
placeholder: "Search...",
|
|
731
|
+
class: "pl-8",
|
|
732
|
+
onKeydown: d[0] || (d[0] = ke((F) => k.value = "", ["escape"])),
|
|
733
|
+
modelValue: k.value,
|
|
734
|
+
"onUpdate:modelValue": d[1] || (d[1] = (F) => k.value = F)
|
|
735
|
+
}, null, 8, ["modelValue"]),
|
|
736
|
+
i("span", pt, [
|
|
737
|
+
t(o(Me), { class: "size-4 text-muted-foreground" })
|
|
738
|
+
])
|
|
739
|
+
])
|
|
740
|
+
]),
|
|
741
|
+
i("div", ft, [
|
|
742
|
+
C.value.length > 0 ? (r(), $(N, {
|
|
743
|
+
key: 0,
|
|
744
|
+
variant: "destructive",
|
|
745
|
+
onClick: le
|
|
746
|
+
}, {
|
|
747
|
+
default: l(() => [
|
|
748
|
+
m(" Delete Selection (" + P(C.value.length) + ") ", 1)
|
|
749
|
+
]),
|
|
750
|
+
_: 1
|
|
751
|
+
})) : T("", !0),
|
|
752
|
+
o(w)("create-product") ? (r(), g(I, { key: 1 }, [
|
|
753
|
+
t(N, {
|
|
754
|
+
variant: "outline",
|
|
755
|
+
onClick: d[2] || (d[2] = (F) => o(a)("new"))
|
|
756
|
+
}, {
|
|
757
|
+
default: l(() => [
|
|
758
|
+
t(o(Ve), { class: "size-4" }),
|
|
759
|
+
d[5] || (d[5] = m(" New Product ", -1))
|
|
760
|
+
]),
|
|
761
|
+
_: 1
|
|
762
|
+
}),
|
|
763
|
+
d[6] || (d[6] = i("div", { class: "w-[1px] h-8 bg-border" }, null, -1))
|
|
764
|
+
], 64)) : T("", !0),
|
|
765
|
+
t(st),
|
|
766
|
+
d[7] || (d[7] = i("div", { class: "w-[1px] h-8 bg-border" }, null, -1)),
|
|
767
|
+
i("div", null, [
|
|
768
|
+
t(ie, {
|
|
769
|
+
modelValue: x.value,
|
|
770
|
+
"onUpdate:modelValue": d[3] || (d[3] = (F) => x.value = F),
|
|
771
|
+
"aria-label": "View mode"
|
|
772
|
+
}, {
|
|
773
|
+
default: l(() => [
|
|
774
|
+
t(W, { value: "grid" }, {
|
|
775
|
+
default: l(() => [
|
|
776
|
+
t(o(Te), { class: "size-4" })
|
|
777
|
+
]),
|
|
778
|
+
_: 1
|
|
779
|
+
}),
|
|
780
|
+
t(W, { value: "list" }, {
|
|
781
|
+
default: l(() => [
|
|
782
|
+
t(o(Ae), { class: "size-4" })
|
|
783
|
+
]),
|
|
784
|
+
_: 1
|
|
785
|
+
})
|
|
786
|
+
]),
|
|
787
|
+
_: 1
|
|
788
|
+
}, 8, ["modelValue"])
|
|
789
|
+
])
|
|
790
|
+
])
|
|
791
|
+
], 512),
|
|
792
|
+
i("div", mt, [
|
|
793
|
+
t(at, {
|
|
794
|
+
onSelectAll: G,
|
|
795
|
+
onDuplicateProduct: Z,
|
|
796
|
+
onDeleteProduct: z,
|
|
797
|
+
onDeleteSelection: le
|
|
798
|
+
}, {
|
|
799
|
+
default: l(() => [
|
|
800
|
+
x.value === "grid" ? (r(), $(Ke, {
|
|
801
|
+
key: 0,
|
|
802
|
+
products: L.value
|
|
803
|
+
}, null, 8, ["products"])) : (r(), $(qe, {
|
|
804
|
+
key: 1,
|
|
805
|
+
products: L.value
|
|
806
|
+
}, null, 8, ["products"]))
|
|
807
|
+
]),
|
|
808
|
+
_: 1
|
|
809
|
+
})
|
|
810
|
+
]),
|
|
811
|
+
v.value?.length > V.value ? (r(), $(ge, {
|
|
812
|
+
key: 0,
|
|
813
|
+
page: e.value,
|
|
814
|
+
"onUpdate:page": d[4] || (d[4] = (F) => e.value = F),
|
|
815
|
+
"items-per-page": V.value,
|
|
816
|
+
total: v.value?.length,
|
|
817
|
+
"sibling-count": 1,
|
|
818
|
+
"show-edges": ""
|
|
819
|
+
}, {
|
|
820
|
+
default: l(() => [
|
|
821
|
+
t(ve, { class: "flex items-center gap-1" }, {
|
|
822
|
+
default: l(({ items: F }) => [
|
|
823
|
+
t(re),
|
|
824
|
+
t(de),
|
|
825
|
+
(r(!0), g(I, null, q(F, (H, ne) => (r(), g(I, null, [
|
|
826
|
+
H.type === "page" ? (r(), $(ce, {
|
|
827
|
+
key: ne,
|
|
828
|
+
value: H.value,
|
|
829
|
+
"as-child": ""
|
|
830
|
+
}, {
|
|
831
|
+
default: l(() => [
|
|
832
|
+
t(N, {
|
|
833
|
+
class: "size-10 p-0",
|
|
834
|
+
variant: H.value === e.value ? "default" : "outline"
|
|
835
|
+
}, {
|
|
836
|
+
default: l(() => [
|
|
837
|
+
m(P(H.value), 1)
|
|
838
|
+
]),
|
|
839
|
+
_: 2
|
|
840
|
+
}, 1032, ["variant"])
|
|
841
|
+
]),
|
|
842
|
+
_: 2
|
|
843
|
+
}, 1032, ["value"])) : (r(), $(pe, {
|
|
844
|
+
key: H.type,
|
|
845
|
+
index: ne
|
|
846
|
+
}, null, 8, ["index"]))
|
|
847
|
+
], 64))), 256)),
|
|
848
|
+
t(fe),
|
|
849
|
+
t(me)
|
|
850
|
+
]),
|
|
851
|
+
_: 1
|
|
852
|
+
})
|
|
853
|
+
]),
|
|
854
|
+
_: 1
|
|
855
|
+
}, 8, ["page", "items-per-page", "total"])) : T("", !0)
|
|
856
|
+
]);
|
|
857
|
+
};
|
|
858
|
+
}
|
|
859
|
+
});
|
|
860
|
+
export {
|
|
861
|
+
yt as default
|
|
862
|
+
};
|