@webx-ui/module-events 0.1.0
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/LICENSE +21 -0
- package/README.md +53 -0
- package/dist/EventCreateDialog.d.ts +4 -0
- package/dist/EventEditorPage.d.ts +24 -0
- package/dist/EventHistory.d.ts +2 -0
- package/dist/EventsPage.d.ts +24 -0
- package/dist/api.d.ts +38 -0
- package/dist/days.d.ts +19 -0
- package/dist/editor.d.ts +19 -0
- package/dist/i18n.d.ts +2 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +1253 -0
- package/dist/index.js.map +1 -0
- package/dist/messages.d.ts +7 -0
- package/dist/module.d.ts +19 -0
- package/dist/style.css +1 -0
- package/dist/types.d.ts +105 -0
- package/package.json +65 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1253 @@
|
|
|
1
|
+
import { useAdmin as ie, useDates as De, useTranslate as le, useErrorText as Te, provideRelationOwner as Ue, provideRecordAddress as Fe, WxScreenHead as He, WxScreen as Ke, WxSaveState as je, WxDate as Me, rowMenuWidth as Ge, WxListScreen as Je, WxRowMenu as Se, WxFilterChips as Ye, categoryRoutes as Qe } from "@webx-ui/module-admin";
|
|
2
|
+
import { provide as Xe, inject as Ze, defineComponent as de, computed as f, ref as E, watch as ce, onMounted as Ve, onBeforeUnmount as et, openBlock as h, createElementBlock as I, Fragment as ae, createVNode as v, unref as e, withCtx as i, createTextVNode as b, toDisplayString as g, createBlock as T, createCommentVNode as R, createElementVNode as O, renderList as Ae, normalizeClass as xe, useTemplateRef as Re, nextTick as tt, isRef as at, withKeys as nt } from "vue";
|
|
3
|
+
import { useRoute as Be, useRouter as Ie, onBeforeRouteLeave as st } from "vue-router";
|
|
4
|
+
import { useLocales as lt, localizedValue as it, confirm as te, WxSkeleton as ke, WxCard as rt, WxBadge as F, WxBreadcrumb as ot, WxBreadcrumbItem as Ee, WxAlert as ut, WxButton as H, WxActionBar as ct, WxIcon as $e, toast as z, WxEmpty as dt, WxText as Pe, useModal as vt, WxDialog as pt, WxFormItem as ue, WxInput as ht, WxSpace as ft, useElementWidth as gt, createModal as yt, WxTable as mt, WxEntityCard as bt, WxTooltip as Ce, WxSelect as _e } from "@webx-ui/core";
|
|
5
|
+
const wt = "events";
|
|
6
|
+
function ve(o) {
|
|
7
|
+
const d = `${o.apiPath}/${wt}`, y = (s) => s.data;
|
|
8
|
+
return {
|
|
9
|
+
list: (s = {}) => {
|
|
10
|
+
const r = new URLSearchParams();
|
|
11
|
+
return r.set("when", s.when ?? "upcoming"), s.q && r.set("q", s.q), s.category != null && r.set("category", String(s.category)), s.service != null && r.set("service", String(s.service)), s.status && r.set("status", s.status), s.trashed && r.set("trashed", "1"), s.page && s.page > 1 && r.set("page", String(s.page)), s.per_page && r.set("per_page", String(s.per_page)), o.http.get(`${d}?${r}`).then((W) => ({ ...W.meta, data: W.data, filters: W.filters }));
|
|
12
|
+
},
|
|
13
|
+
get: (s) => o.http.get(`${d}/${s}`).then(y),
|
|
14
|
+
create: (s) => o.http.post(d, s).then(y),
|
|
15
|
+
save: (s, r) => o.http.put(`${d}/${s}`, r).then(y),
|
|
16
|
+
discard: (s) => o.http.post(`${d}/${s}/discard`, {}).then(y),
|
|
17
|
+
duplicate: (s) => o.http.post(`${d}/${s}/duplicate`, {}).then(y),
|
|
18
|
+
publish: (s) => o.http.post(`${d}/${s}/publish`, {}).then(y),
|
|
19
|
+
unpublish: (s) => o.http.post(`${d}/${s}/unpublish`, {}).then(y),
|
|
20
|
+
remove: (s) => o.http.delete(`${d}/${s}`).then(() => {
|
|
21
|
+
}),
|
|
22
|
+
restore: (s) => o.http.post(`${d}/${s}/restore`, {}).then(y),
|
|
23
|
+
versions: (s) => o.http.get(`${d}/${s}/versions`).then(y),
|
|
24
|
+
restoreVersion: (s, r) => o.http.post(`${d}/${s}/versions/${r}/restore`, {}).then(y)
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const _t = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})/, K = (o, d = 2) => String(o).padStart(d, "0");
|
|
28
|
+
function ze(o) {
|
|
29
|
+
if (typeof o != "string") return o;
|
|
30
|
+
const d = _t.exec(o);
|
|
31
|
+
if (d === null) return o;
|
|
32
|
+
const [y, s, r, W, x, n] = d.slice(1).map(Number), a = new Date(y, s - 1, r, W, x, n), k = a.getTimezoneOffset(), N = `${k > 0 ? "-" : "+"}${K(Math.floor(Math.abs(k) / 60))}:${K(Math.abs(k) % 60)}`;
|
|
33
|
+
return `${K(a.getFullYear(), 4)}-${K(a.getMonth() + 1)}-${K(a.getDate())}T${K(a.getHours())}:${K(a.getMinutes())}:${K(a.getSeconds())}${N}`;
|
|
34
|
+
}
|
|
35
|
+
function xt(o) {
|
|
36
|
+
return o.all_day !== !0 ? o : {
|
|
37
|
+
...o,
|
|
38
|
+
starts_at: ze(o.starts_at),
|
|
39
|
+
ends_at: ze(o.ends_at)
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const Oe = /* @__PURE__ */ Symbol("wx-event-editor");
|
|
43
|
+
function kt(o) {
|
|
44
|
+
Xe(Oe, o);
|
|
45
|
+
}
|
|
46
|
+
function $t() {
|
|
47
|
+
return Ze(Oe, null);
|
|
48
|
+
}
|
|
49
|
+
const Tt = {
|
|
50
|
+
module: {
|
|
51
|
+
group: "Events",
|
|
52
|
+
events: "Events",
|
|
53
|
+
categories: "Categories"
|
|
54
|
+
},
|
|
55
|
+
panel: {
|
|
56
|
+
new: "New event",
|
|
57
|
+
"new-title": "New event",
|
|
58
|
+
"field-title": "Title",
|
|
59
|
+
create: "Create",
|
|
60
|
+
cancel: "Cancel",
|
|
61
|
+
search: "Search by title or address",
|
|
62
|
+
empty: "No events yet.",
|
|
63
|
+
"empty-upcoming": "Nothing ahead. The past events are on the next tab.",
|
|
64
|
+
"empty-past": "No event is over yet.",
|
|
65
|
+
"empty-search": "Nothing matches that.",
|
|
66
|
+
"empty-bin": "The bin is empty.",
|
|
67
|
+
"status-draft": "Draft",
|
|
68
|
+
"status-published": "Live",
|
|
69
|
+
"status-modified": "Live",
|
|
70
|
+
"status-unpublished": "Off the site",
|
|
71
|
+
edits: "edits",
|
|
72
|
+
past: "Over",
|
|
73
|
+
"no-address": "No address in this language",
|
|
74
|
+
"no-date": "No date",
|
|
75
|
+
"main-category": "The main category: it goes in the breadcrumbs",
|
|
76
|
+
"view-upcoming": "Upcoming",
|
|
77
|
+
"view-past": "Past",
|
|
78
|
+
"view-all": "All",
|
|
79
|
+
bin: "Bin",
|
|
80
|
+
"column-title": "Event",
|
|
81
|
+
"column-when": "When",
|
|
82
|
+
"column-deleted": "Deleted",
|
|
83
|
+
"column-categories": "Categories",
|
|
84
|
+
"column-status": "State",
|
|
85
|
+
"filter-status": "State",
|
|
86
|
+
"any-status": "Any state",
|
|
87
|
+
"filter-category": "Category",
|
|
88
|
+
"any-category": "Any category",
|
|
89
|
+
"filter-service": "Service",
|
|
90
|
+
"any-service": "Any service",
|
|
91
|
+
open: "Open",
|
|
92
|
+
"open-on-site": "Open on the site",
|
|
93
|
+
duplicate: "Duplicate",
|
|
94
|
+
publish: "Publish",
|
|
95
|
+
unpublish: "Take off the site",
|
|
96
|
+
delete: "Delete",
|
|
97
|
+
restore: "Restore",
|
|
98
|
+
"delete-title": "Delete “:title”?",
|
|
99
|
+
"delete-text": "It goes to the bin and comes off the site, and its address is free again.",
|
|
100
|
+
deleted: "The event is in the bin.",
|
|
101
|
+
restored: "The event is back.",
|
|
102
|
+
published: "The event is on the site.",
|
|
103
|
+
"unpublished-done": "The event is off the site."
|
|
104
|
+
},
|
|
105
|
+
event: {
|
|
106
|
+
trail: "Where this event sits",
|
|
107
|
+
untitled: "Untitled",
|
|
108
|
+
save: "Save",
|
|
109
|
+
"save-failed": "The event was not saved.",
|
|
110
|
+
duplicated: "This is the copy: a draft. Set its date and publish it.",
|
|
111
|
+
"publish-title": "Put “:title” on the site?",
|
|
112
|
+
"publish-text": "It answers at :address from the moment you do, for everyone — with its categories and services as they are chosen now.",
|
|
113
|
+
"publish-nowhere": "It has no address in this language yet, so nothing will answer.",
|
|
114
|
+
preview: "Preview",
|
|
115
|
+
discard: "Discard changes",
|
|
116
|
+
"discard-title": "Discard what is waiting?",
|
|
117
|
+
"discard-text": "The event goes back to what the site is showing. What was written since is not listed anywhere.",
|
|
118
|
+
discarded: "The event is back to what is published.",
|
|
119
|
+
"conflict-title": "The event changed while you were editing",
|
|
120
|
+
"conflict-mine": "Keep mine",
|
|
121
|
+
"conflict-theirs": "Take the newer version",
|
|
122
|
+
"conflict-theirs-title": "Give up what you wrote?",
|
|
123
|
+
"conflict-theirs-text": "The event is read again as it now is, and what you have typed since goes.",
|
|
124
|
+
leave: "Leave",
|
|
125
|
+
"leave-title": "Leave without saving?",
|
|
126
|
+
"leave-text": "The event could not be saved, and what you wrote is not on the server.",
|
|
127
|
+
"live-since": "On the site since :date",
|
|
128
|
+
"address-moving": "The address is changing. The old one keeps working and leads to the new one.",
|
|
129
|
+
"history-empty": "This event has never been published.",
|
|
130
|
+
version: "#:number",
|
|
131
|
+
"version-live": "On the site",
|
|
132
|
+
"source-panel": "From the panel",
|
|
133
|
+
"source-mcp": "By an agent",
|
|
134
|
+
"source-import": "Imported",
|
|
135
|
+
"restore-title": "Restore version :number?",
|
|
136
|
+
"restore-text": "It becomes the draft. The site keeps showing what is published until you publish this.",
|
|
137
|
+
"restore-version": "Restore",
|
|
138
|
+
"restored-version": "Version :number is now the draft."
|
|
139
|
+
},
|
|
140
|
+
category: {
|
|
141
|
+
new: "New category",
|
|
142
|
+
empty: "No categories yet.",
|
|
143
|
+
"empty-help": "A category is a kind of event — breakfast meetings, cooking classes — with a page of its own listing what is ahead.",
|
|
144
|
+
order: "Drag to change the order of the categories on the site.",
|
|
145
|
+
hidden: "Hidden from the site",
|
|
146
|
+
"no-address": "No address in this language",
|
|
147
|
+
events: "Events: :count",
|
|
148
|
+
"show-events": "Show its events",
|
|
149
|
+
"delete-blocked": "This category still holds events. Move them first.",
|
|
150
|
+
"delete-text": "It goes to the bin and its page comes off the site. Its events stay.",
|
|
151
|
+
deleted: "The category is in the bin.",
|
|
152
|
+
saved: "The category is saved.",
|
|
153
|
+
"field-title": "Title",
|
|
154
|
+
"field-slug": "Address",
|
|
155
|
+
"address-moving": "The address is changing. The old one keeps working and leads to the new one."
|
|
156
|
+
}
|
|
157
|
+
}, Ne = /* @__PURE__ */ new WeakSet();
|
|
158
|
+
function pe() {
|
|
159
|
+
try {
|
|
160
|
+
const { i18n: o } = ie();
|
|
161
|
+
Ne.has(o) || (o.defaults("webx-events", Tt), Ne.add(o));
|
|
162
|
+
} catch {
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
const Wt = { class: "wx-event-editor__word" }, St = 1200, Et = /* @__PURE__ */ de({
|
|
166
|
+
__name: "EventEditorPage",
|
|
167
|
+
props: {
|
|
168
|
+
base: { default: "/events" }
|
|
169
|
+
},
|
|
170
|
+
setup(o) {
|
|
171
|
+
const d = o, y = ie(), s = ve(y), r = Be(), W = Ie(), x = lt(), n = De();
|
|
172
|
+
pe();
|
|
173
|
+
const a = le("webx-events"), k = Te(), D = f(() => Number(r.params.id)), N = f(() => d.base), p = E(null), m = E({}), C = E(""), $ = E(null), L = E(null), M = E(!0), S = E(!1), P = E(!1), w = E({}), q = E(null), Q = E(""), V = f(() => y.can("events.manage")), he = f(() => !V.value || P.value), X = f(() => JSON.stringify(m.value)), A = f(() => Q.value !== "" && X.value !== Q.value), fe = f(() => S.value ? "saving" : A.value ? "unsaved" : "saved"), j = f(() => {
|
|
174
|
+
const u = m.value.title;
|
|
175
|
+
return it(u, x.active.value, p.value?.title ?? "");
|
|
176
|
+
}), ge = f(() => {
|
|
177
|
+
const u = p.value;
|
|
178
|
+
if (!u) return "";
|
|
179
|
+
const _ = [u.when];
|
|
180
|
+
return (u.status === "published" || u.status === "modified") && _.push(a("event.live-since", { date: n.short(u.published_at) })), _.filter((t) => t !== "").join(" · ");
|
|
181
|
+
});
|
|
182
|
+
Ue({ type: "event", id: f(() => p.value?.id ?? null) }), Fe({
|
|
183
|
+
values: m,
|
|
184
|
+
prefix: $,
|
|
185
|
+
path: f(() => p.value?.path),
|
|
186
|
+
moving: () => a("event.address-moving")
|
|
187
|
+
}), kt({ event: p, canManage: V.value, reload: () => J(!0) });
|
|
188
|
+
function G(u) {
|
|
189
|
+
const _ = xt(u.values);
|
|
190
|
+
p.value = u.event, m.value = _, C.value = u.revision, $.value = u.prefix, L.value = u.preview_url, Q.value = JSON.stringify(_), q.value = null;
|
|
191
|
+
}
|
|
192
|
+
async function J(u = !1) {
|
|
193
|
+
u || (M.value = !0);
|
|
194
|
+
try {
|
|
195
|
+
G(await s.get(D.value));
|
|
196
|
+
} catch (_) {
|
|
197
|
+
z.danger(k(_)), W.push(N.value);
|
|
198
|
+
} finally {
|
|
199
|
+
M.value = !1;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
let B;
|
|
203
|
+
function Z() {
|
|
204
|
+
!V.value || q.value || !A.value || (clearTimeout(B), B = setTimeout(() => {
|
|
205
|
+
U();
|
|
206
|
+
}, St));
|
|
207
|
+
}
|
|
208
|
+
function ye() {
|
|
209
|
+
!V.value || q.value || !A.value || S.value || (clearTimeout(B), U());
|
|
210
|
+
}
|
|
211
|
+
async function U() {
|
|
212
|
+
if (!p.value || S.value || !V.value) return;
|
|
213
|
+
clearTimeout(B);
|
|
214
|
+
const u = X.value, _ = m.value;
|
|
215
|
+
S.value = !0, w.value = {};
|
|
216
|
+
try {
|
|
217
|
+
const t = await s.save(p.value.id, { values: _, revision: C.value });
|
|
218
|
+
p.value = t.event, C.value = t.revision, $.value = t.prefix, L.value = t.preview_url, q.value = null, X.value === u && (Q.value = u);
|
|
219
|
+
} catch (t) {
|
|
220
|
+
const c = t;
|
|
221
|
+
c.status === 409 && c.body?.data ? q.value = c.body : c.body?.errors ? (w.value = c.body.errors, z.danger(a("event.save-failed"))) : z.danger(k(t));
|
|
222
|
+
} finally {
|
|
223
|
+
S.value = !1;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
async function me() {
|
|
227
|
+
await te({
|
|
228
|
+
title: a("event.conflict-theirs-title"),
|
|
229
|
+
message: a("event.conflict-theirs-text"),
|
|
230
|
+
confirmText: a("event.conflict-theirs"),
|
|
231
|
+
cancelText: a("panel.cancel"),
|
|
232
|
+
tone: "danger"
|
|
233
|
+
}) && await J(!0);
|
|
234
|
+
}
|
|
235
|
+
async function be() {
|
|
236
|
+
const u = q.value;
|
|
237
|
+
u && (C.value = u.data.revision, q.value = null, await U());
|
|
238
|
+
}
|
|
239
|
+
async function we() {
|
|
240
|
+
if (!(!p.value || !await te({
|
|
241
|
+
title: a("event.discard-title"),
|
|
242
|
+
message: a("event.discard-text"),
|
|
243
|
+
confirmText: a("event.discard"),
|
|
244
|
+
cancelText: a("panel.cancel"),
|
|
245
|
+
tone: "danger"
|
|
246
|
+
}))) {
|
|
247
|
+
P.value = !0;
|
|
248
|
+
try {
|
|
249
|
+
G(await s.discard(p.value.id)), z.success(a("event.discarded"));
|
|
250
|
+
} catch (_) {
|
|
251
|
+
z.danger(k(_));
|
|
252
|
+
} finally {
|
|
253
|
+
P.value = !1;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
async function ee() {
|
|
258
|
+
const u = p.value;
|
|
259
|
+
if (!(!u || !await te({
|
|
260
|
+
title: a("event.publish-title", { title: j.value || u.title }),
|
|
261
|
+
message: u.path === null ? a("event.publish-nowhere") : a("event.publish-text", { address: `/${u.path}` }),
|
|
262
|
+
confirmText: a("panel.publish"),
|
|
263
|
+
cancelText: a("panel.cancel")
|
|
264
|
+
})) && (A.value && await U(), !q.value)) {
|
|
265
|
+
P.value = !0;
|
|
266
|
+
try {
|
|
267
|
+
await s.publish(u.id), await J(!0), z.success(a("panel.published"));
|
|
268
|
+
} catch (t) {
|
|
269
|
+
z.danger(k(t));
|
|
270
|
+
} finally {
|
|
271
|
+
P.value = !1;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
async function re() {
|
|
276
|
+
const u = p.value;
|
|
277
|
+
if (u && (A.value && await U(), !(q.value || A.value))) {
|
|
278
|
+
P.value = !0;
|
|
279
|
+
try {
|
|
280
|
+
const _ = await s.duplicate(u.id);
|
|
281
|
+
z.success(a("event.duplicated")), await W.push({ path: `${N.value}/${_.event.id}`, query: { ...r.query } });
|
|
282
|
+
} catch (_) {
|
|
283
|
+
z.danger(k(_));
|
|
284
|
+
} finally {
|
|
285
|
+
P.value = !1;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
function oe() {
|
|
290
|
+
const u = p.value?.status;
|
|
291
|
+
return u === "published" || u === "modified" ? "success" : "default";
|
|
292
|
+
}
|
|
293
|
+
function ne(u) {
|
|
294
|
+
A.value && u.preventDefault();
|
|
295
|
+
}
|
|
296
|
+
ce(X, Z), ce(D, () => {
|
|
297
|
+
J();
|
|
298
|
+
}), Ve(() => {
|
|
299
|
+
J(), window.addEventListener("beforeunload", ne);
|
|
300
|
+
}), et(() => {
|
|
301
|
+
clearTimeout(B), window.removeEventListener("beforeunload", ne);
|
|
302
|
+
}), st(async () => !A.value || !V.value || (await U(), !A.value) ? !0 : await te({
|
|
303
|
+
title: a("event.leave-title"),
|
|
304
|
+
message: a("event.leave-text"),
|
|
305
|
+
confirmText: a("event.leave"),
|
|
306
|
+
cancelText: a("panel.cancel"),
|
|
307
|
+
tone: "danger"
|
|
308
|
+
}));
|
|
309
|
+
const se = f(() => {
|
|
310
|
+
const u = [];
|
|
311
|
+
return L.value && u.push({ key: "preview", label: a("event.preview"), icon: "eye", href: L.value }), p.value?.url && p.value.status !== "draft" && u.push({
|
|
312
|
+
key: "site",
|
|
313
|
+
label: a("panel.open-on-site"),
|
|
314
|
+
icon: "link",
|
|
315
|
+
href: p.value.url
|
|
316
|
+
}), p.value?.status === "modified" && u.push({
|
|
317
|
+
key: "discard",
|
|
318
|
+
label: a("event.discard"),
|
|
319
|
+
icon: "refresh",
|
|
320
|
+
danger: !0,
|
|
321
|
+
menu: !0,
|
|
322
|
+
run: () => {
|
|
323
|
+
we();
|
|
324
|
+
}
|
|
325
|
+
}), u;
|
|
326
|
+
});
|
|
327
|
+
return (u, _) => (h(), I("div", {
|
|
328
|
+
class: "wx-event-editor",
|
|
329
|
+
onFocusout: ye
|
|
330
|
+
}, [
|
|
331
|
+
M.value || !p.value ? (h(), I(ae, { key: 0 }, [
|
|
332
|
+
v(e(ke), {
|
|
333
|
+
class: "wx-event-editor__ghost",
|
|
334
|
+
title: "",
|
|
335
|
+
rows: 1
|
|
336
|
+
}),
|
|
337
|
+
v(e(rt), null, {
|
|
338
|
+
default: i(() => [
|
|
339
|
+
v(e(ke), { rows: 8 })
|
|
340
|
+
]),
|
|
341
|
+
_: 1
|
|
342
|
+
})
|
|
343
|
+
], 64)) : (h(), I(ae, { key: 1 }, [
|
|
344
|
+
v(e(He), {
|
|
345
|
+
divider: "",
|
|
346
|
+
back: N.value,
|
|
347
|
+
"back-label": e(a)("module.events"),
|
|
348
|
+
title: j.value || e(a)("event.untitled"),
|
|
349
|
+
subtitle: ge.value,
|
|
350
|
+
actions: se.value
|
|
351
|
+
}, {
|
|
352
|
+
trail: i(() => [
|
|
353
|
+
v(e(ot), {
|
|
354
|
+
size: "sm",
|
|
355
|
+
label: e(a)("event.trail")
|
|
356
|
+
}, {
|
|
357
|
+
default: i(() => [
|
|
358
|
+
v(e(Ee), {
|
|
359
|
+
as: "router-link",
|
|
360
|
+
to: N.value
|
|
361
|
+
}, {
|
|
362
|
+
default: i(() => [
|
|
363
|
+
b(g(e(a)("module.events")), 1)
|
|
364
|
+
]),
|
|
365
|
+
_: 1
|
|
366
|
+
}, 8, ["to"]),
|
|
367
|
+
v(e(Ee), { current: "" }, {
|
|
368
|
+
default: i(() => [
|
|
369
|
+
b(g(j.value || e(a)("event.untitled")), 1)
|
|
370
|
+
]),
|
|
371
|
+
_: 1
|
|
372
|
+
})
|
|
373
|
+
]),
|
|
374
|
+
_: 1
|
|
375
|
+
}, 8, ["label"])
|
|
376
|
+
]),
|
|
377
|
+
"title-after": i(() => [
|
|
378
|
+
v(e(F), {
|
|
379
|
+
type: oe(),
|
|
380
|
+
dot: ""
|
|
381
|
+
}, {
|
|
382
|
+
default: i(() => [
|
|
383
|
+
b(g(e(a)(`panel.status-${p.value.status}`)), 1)
|
|
384
|
+
]),
|
|
385
|
+
_: 1
|
|
386
|
+
}, 8, ["type"]),
|
|
387
|
+
p.value.status === "modified" ? (h(), T(e(F), {
|
|
388
|
+
key: 0,
|
|
389
|
+
type: "primary",
|
|
390
|
+
round: ""
|
|
391
|
+
}, {
|
|
392
|
+
default: i(() => [
|
|
393
|
+
b(g(e(a)("panel.edits")), 1)
|
|
394
|
+
]),
|
|
395
|
+
_: 1
|
|
396
|
+
})) : R("", !0),
|
|
397
|
+
p.value.past ? (h(), T(e(F), {
|
|
398
|
+
key: 1,
|
|
399
|
+
round: ""
|
|
400
|
+
}, {
|
|
401
|
+
default: i(() => [
|
|
402
|
+
b(g(e(a)("panel.past")), 1)
|
|
403
|
+
]),
|
|
404
|
+
_: 1
|
|
405
|
+
})) : R("", !0)
|
|
406
|
+
]),
|
|
407
|
+
_: 1
|
|
408
|
+
}, 8, ["back", "back-label", "title", "subtitle", "actions"]),
|
|
409
|
+
q.value ? (h(), T(e(ut), {
|
|
410
|
+
key: 0,
|
|
411
|
+
type: "warning",
|
|
412
|
+
title: e(a)("event.conflict-title"),
|
|
413
|
+
description: q.value.message
|
|
414
|
+
}, {
|
|
415
|
+
actions: i(() => [
|
|
416
|
+
v(e(H), {
|
|
417
|
+
size: "sm",
|
|
418
|
+
variant: "outline",
|
|
419
|
+
onClick: me
|
|
420
|
+
}, {
|
|
421
|
+
default: i(() => [
|
|
422
|
+
b(g(e(a)("event.conflict-theirs")), 1)
|
|
423
|
+
]),
|
|
424
|
+
_: 1
|
|
425
|
+
}),
|
|
426
|
+
v(e(H), {
|
|
427
|
+
size: "sm",
|
|
428
|
+
type: "primary",
|
|
429
|
+
onClick: be
|
|
430
|
+
}, {
|
|
431
|
+
default: i(() => [
|
|
432
|
+
b(g(e(a)("event.conflict-mine")), 1)
|
|
433
|
+
]),
|
|
434
|
+
_: 1
|
|
435
|
+
})
|
|
436
|
+
]),
|
|
437
|
+
_: 1
|
|
438
|
+
}, 8, ["title", "description"])) : R("", !0),
|
|
439
|
+
v(e(Ke), {
|
|
440
|
+
modelValue: m.value,
|
|
441
|
+
"onUpdate:modelValue": _[0] || (_[0] = (t) => m.value = t),
|
|
442
|
+
name: "events.form",
|
|
443
|
+
errors: w.value,
|
|
444
|
+
disabled: he.value
|
|
445
|
+
}, null, 8, ["modelValue", "errors", "disabled"]),
|
|
446
|
+
V.value ? (h(), T(e(ct), { key: 1 }, {
|
|
447
|
+
state: i(() => [
|
|
448
|
+
v(e(je), { state: fe.value }, null, 8, ["state"])
|
|
449
|
+
]),
|
|
450
|
+
default: i(() => [
|
|
451
|
+
v(e(H), {
|
|
452
|
+
variant: "text",
|
|
453
|
+
disabled: P.value,
|
|
454
|
+
"aria-label": e(a)("panel.duplicate"),
|
|
455
|
+
onClick: re
|
|
456
|
+
}, {
|
|
457
|
+
icon: i(() => [
|
|
458
|
+
v(e($e), { name: "copy" })
|
|
459
|
+
]),
|
|
460
|
+
default: i(() => [
|
|
461
|
+
O("span", Wt, g(e(a)("panel.duplicate")), 1)
|
|
462
|
+
]),
|
|
463
|
+
_: 1
|
|
464
|
+
}, 8, ["disabled", "aria-label"]),
|
|
465
|
+
v(e(H), {
|
|
466
|
+
variant: "outline",
|
|
467
|
+
loading: S.value,
|
|
468
|
+
disabled: !A.value,
|
|
469
|
+
onClick: U
|
|
470
|
+
}, {
|
|
471
|
+
default: i(() => [
|
|
472
|
+
b(g(e(a)("event.save")), 1)
|
|
473
|
+
]),
|
|
474
|
+
_: 1
|
|
475
|
+
}, 8, ["loading", "disabled"]),
|
|
476
|
+
v(e(H), {
|
|
477
|
+
type: "primary",
|
|
478
|
+
loading: P.value,
|
|
479
|
+
disabled: p.value.status === "published" && !A.value,
|
|
480
|
+
onClick: ee
|
|
481
|
+
}, {
|
|
482
|
+
default: i(() => [
|
|
483
|
+
b(g(e(a)("panel.publish")), 1)
|
|
484
|
+
]),
|
|
485
|
+
_: 1
|
|
486
|
+
}, 8, ["loading", "disabled"])
|
|
487
|
+
]),
|
|
488
|
+
_: 1
|
|
489
|
+
})) : R("", !0)
|
|
490
|
+
], 64))
|
|
491
|
+
], 32));
|
|
492
|
+
}
|
|
493
|
+
}), We = (o, d) => {
|
|
494
|
+
const y = o.__vccOpts || o;
|
|
495
|
+
for (const [s, r] of d)
|
|
496
|
+
y[s] = r;
|
|
497
|
+
return y;
|
|
498
|
+
}, Ct = /* @__PURE__ */ We(Et, [["__scopeId", "data-v-4df973ae"]]), zt = { class: "wx-event-history" }, Nt = { class: "wx-event-history__number" }, qt = { class: "wx-event-history__who" }, Dt = /* @__PURE__ */ de({
|
|
499
|
+
name: "WxEventHistory",
|
|
500
|
+
__name: "EventHistory",
|
|
501
|
+
setup(o) {
|
|
502
|
+
const d = ie(), y = ve(d), s = $t();
|
|
503
|
+
pe();
|
|
504
|
+
const r = le("webx-events"), W = Te(), x = E(null), n = E(!1), a = f(() => s?.event.value ?? null), k = f(() => s?.canManage ?? !1), D = f(
|
|
505
|
+
() => a.value?.status === "published" || a.value?.status === "modified" ? x.value?.[0]?.number ?? null : null
|
|
506
|
+
);
|
|
507
|
+
async function N() {
|
|
508
|
+
const m = a.value;
|
|
509
|
+
if (m)
|
|
510
|
+
try {
|
|
511
|
+
x.value = await y.versions(m.id);
|
|
512
|
+
} catch (C) {
|
|
513
|
+
x.value = [], z.danger(W(C));
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
async function p(m) {
|
|
517
|
+
const C = a.value;
|
|
518
|
+
if (!(!C || !await te({
|
|
519
|
+
title: r("event.restore-title", { number: m.number }),
|
|
520
|
+
message: r("event.restore-text"),
|
|
521
|
+
confirmText: r("event.restore-version"),
|
|
522
|
+
cancelText: r("panel.cancel")
|
|
523
|
+
}))) {
|
|
524
|
+
n.value = !0;
|
|
525
|
+
try {
|
|
526
|
+
await y.restoreVersion(C.id, m.number), await s?.reload(), z.success(r("event.restored-version", { number: m.number }));
|
|
527
|
+
} catch (L) {
|
|
528
|
+
z.danger(W(L));
|
|
529
|
+
} finally {
|
|
530
|
+
n.value = !1;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
return ce(
|
|
535
|
+
() => [a.value?.id, a.value?.published_at, a.value?.updated_at],
|
|
536
|
+
() => {
|
|
537
|
+
N();
|
|
538
|
+
},
|
|
539
|
+
{ immediate: !0 }
|
|
540
|
+
), (m, C) => (h(), I("div", zt, [
|
|
541
|
+
x.value === null ? (h(), T(e(ke), {
|
|
542
|
+
key: 0,
|
|
543
|
+
class: "wx-event-history__ghost",
|
|
544
|
+
rows: 3
|
|
545
|
+
})) : x.value.length === 0 ? (h(), T(e(dt), {
|
|
546
|
+
key: 1,
|
|
547
|
+
description: e(r)("event.history-empty")
|
|
548
|
+
}, null, 8, ["description"])) : (h(!0), I(ae, { key: 2 }, Ae(x.value, ($) => (h(), I("div", {
|
|
549
|
+
key: $.number,
|
|
550
|
+
class: xe(["wx-event-history__row", { "is-live": $.number === D.value }])
|
|
551
|
+
}, [
|
|
552
|
+
O("code", Nt, g(e(r)("event.version", { number: $.number })), 1),
|
|
553
|
+
O("div", qt, [
|
|
554
|
+
$.created_at ? (h(), T(e(Me), {
|
|
555
|
+
key: 0,
|
|
556
|
+
value: $.created_at,
|
|
557
|
+
size: "md",
|
|
558
|
+
tone: "default"
|
|
559
|
+
}, null, 8, ["value"])) : R("", !0),
|
|
560
|
+
v(e(Pe), {
|
|
561
|
+
size: "sm",
|
|
562
|
+
tone: "muted"
|
|
563
|
+
}, {
|
|
564
|
+
default: i(() => [
|
|
565
|
+
b(g($.author ?? e(r)(`event.source-${$.source}`)) + " ", 1),
|
|
566
|
+
$.comment ? (h(), I(ae, { key: 0 }, [
|
|
567
|
+
b(" · " + g($.comment), 1)
|
|
568
|
+
], 64)) : R("", !0)
|
|
569
|
+
]),
|
|
570
|
+
_: 2
|
|
571
|
+
}, 1024)
|
|
572
|
+
]),
|
|
573
|
+
$.number === D.value ? (h(), T(e(F), {
|
|
574
|
+
key: 0,
|
|
575
|
+
type: "success",
|
|
576
|
+
dot: ""
|
|
577
|
+
}, {
|
|
578
|
+
default: i(() => [
|
|
579
|
+
b(g(e(r)("event.version-live")), 1)
|
|
580
|
+
]),
|
|
581
|
+
_: 1
|
|
582
|
+
})) : R("", !0),
|
|
583
|
+
k.value && $.number !== D.value ? (h(), T(e(H), {
|
|
584
|
+
key: 1,
|
|
585
|
+
size: "sm",
|
|
586
|
+
variant: "outline",
|
|
587
|
+
loading: n.value,
|
|
588
|
+
onClick: (L) => p($)
|
|
589
|
+
}, {
|
|
590
|
+
default: i(() => [
|
|
591
|
+
b(g(e(r)("event.restore-version")), 1)
|
|
592
|
+
]),
|
|
593
|
+
_: 1
|
|
594
|
+
}, 8, ["loading", "onClick"])) : R("", !0)
|
|
595
|
+
], 2))), 128))
|
|
596
|
+
]));
|
|
597
|
+
}
|
|
598
|
+
}), Mt = /* @__PURE__ */ We(Dt, [["__scopeId", "data-v-222cbd42"]]), Vt = /* @__PURE__ */ de({
|
|
599
|
+
__name: "EventCreateDialog",
|
|
600
|
+
setup(o) {
|
|
601
|
+
const { open: d, resolve: y, dismiss: s } = vt(), r = ie(), W = ve(r);
|
|
602
|
+
pe();
|
|
603
|
+
const x = le("webx-events"), n = E(""), a = E(!1), k = E({}), D = Re("field");
|
|
604
|
+
Ve(async () => {
|
|
605
|
+
await tt(), D.value?.querySelector("input")?.focus();
|
|
606
|
+
});
|
|
607
|
+
async function N() {
|
|
608
|
+
if (!(n.value.trim() === "" || a.value)) {
|
|
609
|
+
a.value = !0, k.value = {};
|
|
610
|
+
try {
|
|
611
|
+
y((await W.create({ title: n.value.trim() })).event);
|
|
612
|
+
} catch (p) {
|
|
613
|
+
k.value = p.body?.errors ?? {};
|
|
614
|
+
} finally {
|
|
615
|
+
a.value = !1;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
return (p, m) => (h(), T(e(pt), {
|
|
620
|
+
open: e(d),
|
|
621
|
+
"onUpdate:open": m[2] || (m[2] = (C) => at(d) ? d.value = C : null),
|
|
622
|
+
title: e(x)("panel.new-title"),
|
|
623
|
+
width: 440
|
|
624
|
+
}, {
|
|
625
|
+
footer: i(() => [
|
|
626
|
+
v(e(ft), { size: "sm" }, {
|
|
627
|
+
default: i(() => [
|
|
628
|
+
v(e(H), {
|
|
629
|
+
variant: "outline",
|
|
630
|
+
onClick: m[1] || (m[1] = (C) => e(s)())
|
|
631
|
+
}, {
|
|
632
|
+
default: i(() => [
|
|
633
|
+
b(g(e(x)("panel.cancel")), 1)
|
|
634
|
+
]),
|
|
635
|
+
_: 1
|
|
636
|
+
}),
|
|
637
|
+
v(e(H), {
|
|
638
|
+
type: "primary",
|
|
639
|
+
loading: a.value,
|
|
640
|
+
disabled: n.value.trim() === "",
|
|
641
|
+
onClick: N
|
|
642
|
+
}, {
|
|
643
|
+
default: i(() => [
|
|
644
|
+
b(g(e(x)("panel.create")), 1)
|
|
645
|
+
]),
|
|
646
|
+
_: 1
|
|
647
|
+
}, 8, ["loading", "disabled"])
|
|
648
|
+
]),
|
|
649
|
+
_: 1
|
|
650
|
+
})
|
|
651
|
+
]),
|
|
652
|
+
default: i(() => [
|
|
653
|
+
v(e(ue), {
|
|
654
|
+
label: e(x)("panel.field-title"),
|
|
655
|
+
error: k.value.title?.[0] ?? k.value.slug?.[0],
|
|
656
|
+
required: ""
|
|
657
|
+
}, {
|
|
658
|
+
default: i(() => [
|
|
659
|
+
O("div", {
|
|
660
|
+
ref_key: "field",
|
|
661
|
+
ref: D
|
|
662
|
+
}, [
|
|
663
|
+
v(e(ht), {
|
|
664
|
+
modelValue: n.value,
|
|
665
|
+
"onUpdate:modelValue": m[0] || (m[0] = (C) => n.value = C),
|
|
666
|
+
"aria-label": e(x)("panel.field-title"),
|
|
667
|
+
onKeyup: nt(N, ["enter"])
|
|
668
|
+
}, null, 8, ["modelValue", "aria-label"])
|
|
669
|
+
], 512)
|
|
670
|
+
]),
|
|
671
|
+
_: 1
|
|
672
|
+
}, 8, ["label", "error"])
|
|
673
|
+
]),
|
|
674
|
+
_: 1
|
|
675
|
+
}, 8, ["open", "title"]));
|
|
676
|
+
}
|
|
677
|
+
}), At = ["src"], Rt = { class: "wx-events__name" }, Bt = { class: "wx-events__title" }, It = { class: "wx-events__address" }, Pt = { class: "wx-events__when" }, Ot = { class: "wx-events__chips" }, Lt = { class: "wx-events__state" }, qe = 640, Ut = /* @__PURE__ */ de({
|
|
678
|
+
__name: "EventsPage",
|
|
679
|
+
props: {
|
|
680
|
+
base: { default: "/events" }
|
|
681
|
+
},
|
|
682
|
+
setup(o) {
|
|
683
|
+
const d = o, y = ie(), s = ve(y), r = Be(), W = Ie(), x = De();
|
|
684
|
+
pe();
|
|
685
|
+
const n = le("webx-events"), a = le("webx-admin"), k = Te(), D = Re("root"), N = gt(D), p = E(null), m = E(!0), C = yt(Vt), $ = f(() => y.can("events.manage")), L = f(
|
|
686
|
+
() => y.state.manifest?.modules.find((t) => t.id === "events")?.title ?? n("module.events")
|
|
687
|
+
), M = f({
|
|
688
|
+
get: () => typeof r.query.view == "string" ? r.query.view : "",
|
|
689
|
+
set: (t) => {
|
|
690
|
+
W.replace({
|
|
691
|
+
query: { ...r.query, view: t === "" ? void 0 : String(t), page: void 0 }
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
}), S = f(() => M.value === "trashed"), P = f(() => S.value || M.value === "all" ? "all" : M.value === "past" ? "past" : "upcoming"), w = f(() => ({
|
|
695
|
+
q: typeof r.query.q == "string" ? r.query.q : "",
|
|
696
|
+
category: q(r.query.category),
|
|
697
|
+
service: q(r.query.service),
|
|
698
|
+
status: typeof r.query.status == "string" ? r.query.status : "",
|
|
699
|
+
page: Number(r.query.page ?? 1) || 1
|
|
700
|
+
}));
|
|
701
|
+
function q(t) {
|
|
702
|
+
return typeof t == "string" && t !== "" && Number(t) || null;
|
|
703
|
+
}
|
|
704
|
+
const Q = f(() => [
|
|
705
|
+
{ value: "", label: n("panel.view-upcoming") },
|
|
706
|
+
{ value: "past", label: n("panel.view-past") },
|
|
707
|
+
{ value: "all", label: n("panel.view-all") },
|
|
708
|
+
{ value: "trashed", label: n("panel.bin"), icon: "trash" }
|
|
709
|
+
]), V = f(() => p.value?.filters ?? { categories: [], services: null }), he = f(
|
|
710
|
+
() => ["published", "draft", "unpublished"].map((t) => ({
|
|
711
|
+
value: t,
|
|
712
|
+
label: n(`panel.status-${t}`)
|
|
713
|
+
}))
|
|
714
|
+
), X = f(() => N.value > 0 && N.value < qe), A = f(() => X.value ? [{ key: "card", label: "" }] : [
|
|
715
|
+
{ key: "cover", label: "", width: 68 },
|
|
716
|
+
/* The one that takes what the others leave, and the only one without a width. */
|
|
717
|
+
{ key: "title", label: n("panel.column-title"), minWidth: 220 },
|
|
718
|
+
{
|
|
719
|
+
key: "when",
|
|
720
|
+
label: S.value ? n("panel.column-deleted") : n("panel.column-when"),
|
|
721
|
+
width: 210,
|
|
722
|
+
hideBelow: 760
|
|
723
|
+
},
|
|
724
|
+
{ key: "categories", label: n("panel.column-categories"), width: 190, hideBelow: 1080 },
|
|
725
|
+
{ key: "status", label: n("panel.column-status"), width: 150 },
|
|
726
|
+
{ key: "actions", label: "", width: Ge, align: "right" }
|
|
727
|
+
]), fe = f(() => w.value.q !== "" ? n("panel.empty-search") : S.value ? n("panel.empty-bin") : M.value === "past" ? n("panel.empty-past") : M.value === "all" ? n("panel.empty") : n("panel.empty-upcoming")), j = f(() => {
|
|
728
|
+
const t = [];
|
|
729
|
+
w.value.status !== "" && t.push({
|
|
730
|
+
key: "status",
|
|
731
|
+
label: `${n("panel.filter-status")}: ${n(`panel.status-${w.value.status}`)}`,
|
|
732
|
+
clear: () => B("status", void 0)
|
|
733
|
+
});
|
|
734
|
+
const c = V.value.categories.find((Y) => Y.id === w.value.category);
|
|
735
|
+
c && t.push({
|
|
736
|
+
key: "category",
|
|
737
|
+
label: `${n("panel.filter-category")}: ${c.title}`,
|
|
738
|
+
clear: () => B("category", void 0)
|
|
739
|
+
});
|
|
740
|
+
const l = V.value.services?.find((Y) => Y.id === w.value.service);
|
|
741
|
+
return l && t.push({
|
|
742
|
+
key: "service",
|
|
743
|
+
label: `${n("panel.filter-service")}: ${l.title}`,
|
|
744
|
+
clear: () => B("service", void 0)
|
|
745
|
+
}), t;
|
|
746
|
+
});
|
|
747
|
+
function ge() {
|
|
748
|
+
W.replace({
|
|
749
|
+
query: {
|
|
750
|
+
...r.query,
|
|
751
|
+
status: void 0,
|
|
752
|
+
category: void 0,
|
|
753
|
+
service: void 0,
|
|
754
|
+
page: void 0
|
|
755
|
+
}
|
|
756
|
+
});
|
|
757
|
+
}
|
|
758
|
+
async function G(t) {
|
|
759
|
+
m.value = !0;
|
|
760
|
+
try {
|
|
761
|
+
p.value = await s.list({
|
|
762
|
+
when: P.value,
|
|
763
|
+
q: t?.search ?? w.value.q,
|
|
764
|
+
status: S.value ? "" : w.value.status,
|
|
765
|
+
trashed: S.value,
|
|
766
|
+
category: w.value.category,
|
|
767
|
+
service: w.value.service,
|
|
768
|
+
page: t?.page ?? w.value.page,
|
|
769
|
+
per_page: t?.perPage
|
|
770
|
+
});
|
|
771
|
+
} catch (c) {
|
|
772
|
+
z.danger(k(c));
|
|
773
|
+
} finally {
|
|
774
|
+
m.value = !1;
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
function J(t) {
|
|
778
|
+
const c = {
|
|
779
|
+
...r.query,
|
|
780
|
+
q: t.search === "" ? void 0 : t.search,
|
|
781
|
+
page: t.page === 1 ? void 0 : String(t.page)
|
|
782
|
+
};
|
|
783
|
+
W.replace({ query: c }), G(t);
|
|
784
|
+
}
|
|
785
|
+
function B(t, c) {
|
|
786
|
+
W.replace({
|
|
787
|
+
query: {
|
|
788
|
+
...r.query,
|
|
789
|
+
[t]: typeof c == "number" || typeof c == "string" && c !== "" ? String(c) : void 0,
|
|
790
|
+
page: void 0
|
|
791
|
+
}
|
|
792
|
+
});
|
|
793
|
+
}
|
|
794
|
+
ce(
|
|
795
|
+
[M, () => w.value.status, () => w.value.category, () => w.value.service],
|
|
796
|
+
() => {
|
|
797
|
+
G();
|
|
798
|
+
}
|
|
799
|
+
), G();
|
|
800
|
+
function Z(t) {
|
|
801
|
+
W.push({ path: `${d.base}/${t.id}`, query: { ...r.query } });
|
|
802
|
+
}
|
|
803
|
+
async function ye() {
|
|
804
|
+
const t = await C({});
|
|
805
|
+
t && Z(t);
|
|
806
|
+
}
|
|
807
|
+
function U(t) {
|
|
808
|
+
if (!$.value) return [];
|
|
809
|
+
if (S.value)
|
|
810
|
+
return [
|
|
811
|
+
{
|
|
812
|
+
key: "restore",
|
|
813
|
+
icon: "refresh",
|
|
814
|
+
label: n("panel.restore"),
|
|
815
|
+
run: () => {
|
|
816
|
+
we(t);
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
];
|
|
820
|
+
const c = [
|
|
821
|
+
{ key: "open", icon: "edit", label: n("panel.open"), run: () => Z(t) },
|
|
822
|
+
{
|
|
823
|
+
key: "duplicate",
|
|
824
|
+
icon: "copy",
|
|
825
|
+
label: n("panel.duplicate"),
|
|
826
|
+
run: () => {
|
|
827
|
+
me(t);
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
];
|
|
831
|
+
return t.url && t.status !== "draft" && c.push({
|
|
832
|
+
key: "site",
|
|
833
|
+
icon: "external-link",
|
|
834
|
+
label: n("panel.open-on-site"),
|
|
835
|
+
href: t.url
|
|
836
|
+
}), c.push(
|
|
837
|
+
t.status === "published" || t.status === "modified" ? {
|
|
838
|
+
key: "unpublish",
|
|
839
|
+
icon: "eye-off",
|
|
840
|
+
label: n("panel.unpublish"),
|
|
841
|
+
run: () => {
|
|
842
|
+
ee(() => s.unpublish(t.id), n("panel.unpublished-done"));
|
|
843
|
+
}
|
|
844
|
+
} : {
|
|
845
|
+
key: "publish",
|
|
846
|
+
icon: "upload",
|
|
847
|
+
label: n("panel.publish"),
|
|
848
|
+
run: () => {
|
|
849
|
+
ee(() => s.publish(t.id), n("panel.published"));
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
), c.push({
|
|
853
|
+
key: "delete",
|
|
854
|
+
icon: "trash",
|
|
855
|
+
label: n("panel.delete"),
|
|
856
|
+
danger: !0,
|
|
857
|
+
run: () => {
|
|
858
|
+
be(t);
|
|
859
|
+
}
|
|
860
|
+
}), c;
|
|
861
|
+
}
|
|
862
|
+
async function me(t) {
|
|
863
|
+
try {
|
|
864
|
+
const c = await s.duplicate(t.id);
|
|
865
|
+
z.success(n("event.duplicated")), Z(c.event);
|
|
866
|
+
} catch (c) {
|
|
867
|
+
z.danger(k(c));
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
async function be(t) {
|
|
871
|
+
await te({
|
|
872
|
+
title: n("panel.delete-title", { title: t.title }),
|
|
873
|
+
message: n("panel.delete-text"),
|
|
874
|
+
confirmText: n("panel.delete"),
|
|
875
|
+
cancelText: n("panel.cancel"),
|
|
876
|
+
tone: "danger"
|
|
877
|
+
}) && await ee(() => s.remove(t.id), n("panel.deleted"));
|
|
878
|
+
}
|
|
879
|
+
async function we(t) {
|
|
880
|
+
await ee(() => s.restore(t.id), n("panel.restored"));
|
|
881
|
+
}
|
|
882
|
+
async function ee(t, c) {
|
|
883
|
+
try {
|
|
884
|
+
await t(), z.success(c);
|
|
885
|
+
} catch (l) {
|
|
886
|
+
z.danger(k(l));
|
|
887
|
+
} finally {
|
|
888
|
+
await G();
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
function re(t) {
|
|
892
|
+
return t === "published" || t === "modified" ? "success" : "default";
|
|
893
|
+
}
|
|
894
|
+
function oe(t) {
|
|
895
|
+
return S.value ? "—" : t.path === null ? n("panel.no-address") : `/${t.path}`;
|
|
896
|
+
}
|
|
897
|
+
function ne(t) {
|
|
898
|
+
if (t.starts_at === null || t.all_day) return "";
|
|
899
|
+
const c = x.exact(t.starts_at);
|
|
900
|
+
return t.ends_at === null ? c : `${c} – ${x.exact(t.ends_at)}`;
|
|
901
|
+
}
|
|
902
|
+
function se(t) {
|
|
903
|
+
return t.when !== "" ? t.when : n("panel.no-date");
|
|
904
|
+
}
|
|
905
|
+
function u(t) {
|
|
906
|
+
return t.past && M.value === "all" ? "is-past" : void 0;
|
|
907
|
+
}
|
|
908
|
+
const _ = f(
|
|
909
|
+
() => $.value ? [{ key: "new", label: n("panel.new"), icon: "plus", primary: !0, run: () => {
|
|
910
|
+
ye();
|
|
911
|
+
} }] : []
|
|
912
|
+
);
|
|
913
|
+
return (t, c) => (h(), I("div", {
|
|
914
|
+
ref_key: "root",
|
|
915
|
+
ref: D,
|
|
916
|
+
class: "wx-events"
|
|
917
|
+
}, [
|
|
918
|
+
v(e(Je), {
|
|
919
|
+
view: M.value,
|
|
920
|
+
"onUpdate:view": c[3] || (c[3] = (l) => M.value = l),
|
|
921
|
+
title: L.value,
|
|
922
|
+
views: Q.value,
|
|
923
|
+
actions: _.value
|
|
924
|
+
}, {
|
|
925
|
+
default: i(() => [
|
|
926
|
+
v(e(mt), {
|
|
927
|
+
data: p.value,
|
|
928
|
+
columns: A.value,
|
|
929
|
+
"row-key": "id",
|
|
930
|
+
searchable: "",
|
|
931
|
+
clickable: !S.value,
|
|
932
|
+
hover: !S.value,
|
|
933
|
+
flush: "",
|
|
934
|
+
loading: m.value,
|
|
935
|
+
layout: "fixed",
|
|
936
|
+
"cards-below": qe,
|
|
937
|
+
"row-class": u,
|
|
938
|
+
"filters-count": j.value.length,
|
|
939
|
+
"filters-label": e(a)("filters.title"),
|
|
940
|
+
"search-placeholder": e(n)("panel.search"),
|
|
941
|
+
"empty-text": fe.value,
|
|
942
|
+
"aria-label": L.value,
|
|
943
|
+
onRowClick: Z,
|
|
944
|
+
onStateChange: J
|
|
945
|
+
}, {
|
|
946
|
+
filters: i(() => [
|
|
947
|
+
S.value ? R("", !0) : (h(), T(e(ue), {
|
|
948
|
+
key: 0,
|
|
949
|
+
label: e(n)("panel.filter-status")
|
|
950
|
+
}, {
|
|
951
|
+
default: i(() => [
|
|
952
|
+
v(e(_e), {
|
|
953
|
+
"model-value": w.value.status === "" ? null : w.value.status,
|
|
954
|
+
options: he.value,
|
|
955
|
+
placeholder: e(n)("panel.any-status"),
|
|
956
|
+
clearable: "",
|
|
957
|
+
size: "sm",
|
|
958
|
+
"onUpdate:modelValue": c[0] || (c[0] = (l) => B("status", l))
|
|
959
|
+
}, null, 8, ["model-value", "options", "placeholder"])
|
|
960
|
+
]),
|
|
961
|
+
_: 1
|
|
962
|
+
}, 8, ["label"])),
|
|
963
|
+
v(e(ue), {
|
|
964
|
+
label: e(n)("panel.filter-category")
|
|
965
|
+
}, {
|
|
966
|
+
default: i(() => [
|
|
967
|
+
v(e(_e), {
|
|
968
|
+
"model-value": w.value.category,
|
|
969
|
+
options: V.value.categories.map((l) => ({ value: l.id, label: l.title })),
|
|
970
|
+
placeholder: e(n)("panel.any-category"),
|
|
971
|
+
clearable: "",
|
|
972
|
+
size: "sm",
|
|
973
|
+
"onUpdate:modelValue": c[1] || (c[1] = (l) => B("category", l))
|
|
974
|
+
}, null, 8, ["model-value", "options", "placeholder"])
|
|
975
|
+
]),
|
|
976
|
+
_: 1
|
|
977
|
+
}, 8, ["label"]),
|
|
978
|
+
V.value.services !== null ? (h(), T(e(ue), {
|
|
979
|
+
key: 1,
|
|
980
|
+
label: e(n)("panel.filter-service")
|
|
981
|
+
}, {
|
|
982
|
+
default: i(() => [
|
|
983
|
+
v(e(_e), {
|
|
984
|
+
"model-value": w.value.service,
|
|
985
|
+
options: V.value.services.map((l) => ({ value: l.id, label: l.title })),
|
|
986
|
+
placeholder: e(n)("panel.any-service"),
|
|
987
|
+
clearable: "",
|
|
988
|
+
filterable: "",
|
|
989
|
+
size: "sm",
|
|
990
|
+
"onUpdate:modelValue": c[2] || (c[2] = (l) => B("service", l))
|
|
991
|
+
}, null, 8, ["model-value", "options", "placeholder"])
|
|
992
|
+
]),
|
|
993
|
+
_: 1
|
|
994
|
+
}, 8, ["label"])) : R("", !0),
|
|
995
|
+
j.value.length > 0 ? (h(), T(e(H), {
|
|
996
|
+
key: 2,
|
|
997
|
+
variant: "text",
|
|
998
|
+
size: "sm",
|
|
999
|
+
block: "",
|
|
1000
|
+
onClick: ge
|
|
1001
|
+
}, {
|
|
1002
|
+
icon: i(() => [
|
|
1003
|
+
v(e($e), { name: "close" })
|
|
1004
|
+
]),
|
|
1005
|
+
default: i(() => [
|
|
1006
|
+
b(" " + g(e(a)("filters.reset")), 1)
|
|
1007
|
+
]),
|
|
1008
|
+
_: 1
|
|
1009
|
+
})) : R("", !0)
|
|
1010
|
+
]),
|
|
1011
|
+
applied: i(() => [
|
|
1012
|
+
v(e(Ye), { filters: j.value }, null, 8, ["filters"])
|
|
1013
|
+
]),
|
|
1014
|
+
"cell-cover": i(({ row: l }) => [
|
|
1015
|
+
O("span", {
|
|
1016
|
+
class: xe(["wx-events__cover", { "is-empty": !l.cover?.thumb }])
|
|
1017
|
+
}, [
|
|
1018
|
+
l.cover?.thumb ? (h(), I("img", {
|
|
1019
|
+
key: 0,
|
|
1020
|
+
src: l.cover.thumb,
|
|
1021
|
+
alt: "",
|
|
1022
|
+
loading: "lazy"
|
|
1023
|
+
}, null, 8, At)) : (h(), T(e($e), {
|
|
1024
|
+
key: 1,
|
|
1025
|
+
name: "calendar",
|
|
1026
|
+
size: "sm"
|
|
1027
|
+
}))
|
|
1028
|
+
], 2)
|
|
1029
|
+
]),
|
|
1030
|
+
"cell-title": i(({ row: l }) => [
|
|
1031
|
+
O("div", Rt, [
|
|
1032
|
+
O("span", Bt, g(l.title), 1),
|
|
1033
|
+
O("span", It, g(oe(l)), 1)
|
|
1034
|
+
])
|
|
1035
|
+
]),
|
|
1036
|
+
"cell-when": i(({ row: l }) => [
|
|
1037
|
+
S.value ? (h(), T(e(Me), {
|
|
1038
|
+
key: 0,
|
|
1039
|
+
value: l.deleted_at,
|
|
1040
|
+
compact: ""
|
|
1041
|
+
}, null, 8, ["value"])) : ne(l) ? (h(), T(e(Ce), {
|
|
1042
|
+
key: 1,
|
|
1043
|
+
content: ne(l)
|
|
1044
|
+
}, {
|
|
1045
|
+
default: i(() => [
|
|
1046
|
+
O("span", Pt, g(se(l)), 1)
|
|
1047
|
+
]),
|
|
1048
|
+
_: 2
|
|
1049
|
+
}, 1032, ["content"])) : (h(), I("span", {
|
|
1050
|
+
key: 2,
|
|
1051
|
+
class: xe(["wx-events__when", { "is-none": l.when === "" }])
|
|
1052
|
+
}, g(se(l)), 3))
|
|
1053
|
+
]),
|
|
1054
|
+
"cell-categories": i(({ row: l }) => [
|
|
1055
|
+
O("span", Ot, [
|
|
1056
|
+
(h(!0), I(ae, null, Ae(l.categories, (Y, Le) => (h(), I(ae, {
|
|
1057
|
+
key: Y.id
|
|
1058
|
+
}, [
|
|
1059
|
+
Le === 0 ? (h(), T(e(Ce), {
|
|
1060
|
+
key: 0,
|
|
1061
|
+
content: e(n)("panel.main-category")
|
|
1062
|
+
}, {
|
|
1063
|
+
default: i(() => [
|
|
1064
|
+
v(e(F), {
|
|
1065
|
+
size: "sm",
|
|
1066
|
+
round: "",
|
|
1067
|
+
type: "primary"
|
|
1068
|
+
}, {
|
|
1069
|
+
default: i(() => [
|
|
1070
|
+
b(g(Y.title), 1)
|
|
1071
|
+
]),
|
|
1072
|
+
_: 2
|
|
1073
|
+
}, 1024)
|
|
1074
|
+
]),
|
|
1075
|
+
_: 2
|
|
1076
|
+
}, 1032, ["content"])) : (h(), T(e(F), {
|
|
1077
|
+
key: 1,
|
|
1078
|
+
size: "sm",
|
|
1079
|
+
round: ""
|
|
1080
|
+
}, {
|
|
1081
|
+
default: i(() => [
|
|
1082
|
+
b(g(Y.title), 1)
|
|
1083
|
+
]),
|
|
1084
|
+
_: 2
|
|
1085
|
+
}, 1024))
|
|
1086
|
+
], 64))), 128))
|
|
1087
|
+
])
|
|
1088
|
+
]),
|
|
1089
|
+
"cell-status": i(({ row: l }) => [
|
|
1090
|
+
O("span", Lt, [
|
|
1091
|
+
v(e(F), {
|
|
1092
|
+
type: re(l.status),
|
|
1093
|
+
dot: "",
|
|
1094
|
+
size: "sm"
|
|
1095
|
+
}, {
|
|
1096
|
+
default: i(() => [
|
|
1097
|
+
b(g(e(n)(`panel.status-${l.status}`)), 1)
|
|
1098
|
+
]),
|
|
1099
|
+
_: 2
|
|
1100
|
+
}, 1032, ["type"]),
|
|
1101
|
+
l.status === "modified" ? (h(), T(e(F), {
|
|
1102
|
+
key: 0,
|
|
1103
|
+
type: "primary",
|
|
1104
|
+
size: "sm",
|
|
1105
|
+
round: ""
|
|
1106
|
+
}, {
|
|
1107
|
+
default: i(() => [
|
|
1108
|
+
b(g(e(n)("panel.edits")), 1)
|
|
1109
|
+
]),
|
|
1110
|
+
_: 1
|
|
1111
|
+
})) : R("", !0)
|
|
1112
|
+
])
|
|
1113
|
+
]),
|
|
1114
|
+
"cell-card": i(({ row: l }) => [
|
|
1115
|
+
v(e(bt), {
|
|
1116
|
+
class: "wx-events__entity",
|
|
1117
|
+
variant: "plain",
|
|
1118
|
+
title: l.title,
|
|
1119
|
+
image: l.cover?.thumb ?? void 0,
|
|
1120
|
+
"image-size": "56px",
|
|
1121
|
+
"title-lines": 2,
|
|
1122
|
+
subtitle: oe(l)
|
|
1123
|
+
}, {
|
|
1124
|
+
meta: i(() => [
|
|
1125
|
+
v(e(Pe), {
|
|
1126
|
+
size: "sm",
|
|
1127
|
+
tone: l.past ? "muted" : "default"
|
|
1128
|
+
}, {
|
|
1129
|
+
default: i(() => [
|
|
1130
|
+
b(g(S.value ? e(x).short(l.deleted_at) : se(l)), 1)
|
|
1131
|
+
]),
|
|
1132
|
+
_: 2
|
|
1133
|
+
}, 1032, ["tone"]),
|
|
1134
|
+
v(e(F), {
|
|
1135
|
+
type: re(l.status),
|
|
1136
|
+
dot: "",
|
|
1137
|
+
size: "sm"
|
|
1138
|
+
}, {
|
|
1139
|
+
default: i(() => [
|
|
1140
|
+
b(g(e(n)(`panel.status-${l.status}`)), 1)
|
|
1141
|
+
]),
|
|
1142
|
+
_: 2
|
|
1143
|
+
}, 1032, ["type"]),
|
|
1144
|
+
l.categories[0] ? (h(), T(e(F), {
|
|
1145
|
+
key: 0,
|
|
1146
|
+
size: "sm",
|
|
1147
|
+
round: ""
|
|
1148
|
+
}, {
|
|
1149
|
+
default: i(() => [
|
|
1150
|
+
b(g(l.categories[0].title), 1)
|
|
1151
|
+
]),
|
|
1152
|
+
_: 2
|
|
1153
|
+
}, 1024)) : R("", !0)
|
|
1154
|
+
]),
|
|
1155
|
+
_: 2
|
|
1156
|
+
}, 1032, ["title", "image", "subtitle"])
|
|
1157
|
+
]),
|
|
1158
|
+
"card-actions": i(({ row: l }) => [
|
|
1159
|
+
v(e(Se), {
|
|
1160
|
+
actions: U(l),
|
|
1161
|
+
label: l.title
|
|
1162
|
+
}, null, 8, ["actions", "label"])
|
|
1163
|
+
]),
|
|
1164
|
+
"cell-actions": i(({ row: l }) => [
|
|
1165
|
+
v(e(Se), {
|
|
1166
|
+
actions: U(l),
|
|
1167
|
+
label: l.title
|
|
1168
|
+
}, null, 8, ["actions", "label"])
|
|
1169
|
+
]),
|
|
1170
|
+
_: 1
|
|
1171
|
+
}, 8, ["data", "columns", "clickable", "hover", "loading", "filters-count", "filters-label", "search-placeholder", "empty-text", "aria-label"])
|
|
1172
|
+
]),
|
|
1173
|
+
_: 1
|
|
1174
|
+
}, 8, ["view", "title", "views", "actions"])
|
|
1175
|
+
], 512));
|
|
1176
|
+
}
|
|
1177
|
+
}), Ft = /* @__PURE__ */ We(Ut, [["__scopeId", "data-v-1a916120"]]);
|
|
1178
|
+
function Ht(o = "/events") {
|
|
1179
|
+
return {
|
|
1180
|
+
api: "events/categories",
|
|
1181
|
+
path: `${o}/categories`,
|
|
1182
|
+
name: "webx.events.categories",
|
|
1183
|
+
module: "event-categories",
|
|
1184
|
+
screen: "events.category-form",
|
|
1185
|
+
manage: "events.categories.manage",
|
|
1186
|
+
count: "events_count",
|
|
1187
|
+
// Every event of the category, past ones included: "what is filed here" is the question.
|
|
1188
|
+
items: (d) => ({ path: o, query: { category: String(d), view: "all" } }),
|
|
1189
|
+
words: {
|
|
1190
|
+
new: "webx-events::category.new",
|
|
1191
|
+
empty: "webx-events::category.empty",
|
|
1192
|
+
"empty-help": "webx-events::category.empty-help",
|
|
1193
|
+
order: "webx-events::category.order",
|
|
1194
|
+
hidden: "webx-events::category.hidden",
|
|
1195
|
+
"no-address": "webx-events::category.no-address",
|
|
1196
|
+
count: "webx-events::category.events",
|
|
1197
|
+
"show-items": "webx-events::category.show-events",
|
|
1198
|
+
"delete-blocked": "webx-events::category.delete-blocked",
|
|
1199
|
+
"delete-text": "webx-events::category.delete-text",
|
|
1200
|
+
deleted: "webx-events::category.deleted",
|
|
1201
|
+
saved: "webx-events::category.saved",
|
|
1202
|
+
"field-title": "webx-events::category.field-title",
|
|
1203
|
+
"field-slug": "webx-events::category.field-slug",
|
|
1204
|
+
"address-moving": "webx-events::category.address-moving"
|
|
1205
|
+
}
|
|
1206
|
+
};
|
|
1207
|
+
}
|
|
1208
|
+
function Yt(o = {}) {
|
|
1209
|
+
const d = o.path ?? "/events";
|
|
1210
|
+
return [
|
|
1211
|
+
{
|
|
1212
|
+
id: "events",
|
|
1213
|
+
path: d,
|
|
1214
|
+
routes: [
|
|
1215
|
+
{ path: d, name: "webx.events", component: Ft, props: { base: d } },
|
|
1216
|
+
{
|
|
1217
|
+
path: `${d}/:id(\\d+)`,
|
|
1218
|
+
name: "webx.events.edit",
|
|
1219
|
+
component: Ct,
|
|
1220
|
+
props: { base: d }
|
|
1221
|
+
}
|
|
1222
|
+
],
|
|
1223
|
+
/*
|
|
1224
|
+
* The one part of `events.form` only this module can draw. Everything else on it is the
|
|
1225
|
+
* panel's (`wx-slug`, `wx-categories`, `wx-relations`, `wx-gallery`, `wx-rich-text`,
|
|
1226
|
+
* `wx-repeater`, `wx-date-picker`).
|
|
1227
|
+
*/
|
|
1228
|
+
types: {
|
|
1229
|
+
"wx-event-history": { component: Mt, kind: "display" }
|
|
1230
|
+
}
|
|
1231
|
+
},
|
|
1232
|
+
{
|
|
1233
|
+
id: "event-categories",
|
|
1234
|
+
path: `${d}/categories`,
|
|
1235
|
+
routes: Qe(Ht(d))
|
|
1236
|
+
}
|
|
1237
|
+
];
|
|
1238
|
+
}
|
|
1239
|
+
export {
|
|
1240
|
+
wt as EVENTS_API,
|
|
1241
|
+
Vt as WxEventCreateDialog,
|
|
1242
|
+
Ct as WxEventEditorPage,
|
|
1243
|
+
Mt as WxEventHistory,
|
|
1244
|
+
Ft as WxEventsPage,
|
|
1245
|
+
ve as createEventsApi,
|
|
1246
|
+
Ht as eventCategoriesOptions,
|
|
1247
|
+
Oe as eventEditorKey,
|
|
1248
|
+
Yt as events,
|
|
1249
|
+
Tt as eventsMessages,
|
|
1250
|
+
kt as provideEventEditor,
|
|
1251
|
+
$t as useEventEditor
|
|
1252
|
+
};
|
|
1253
|
+
//# sourceMappingURL=index.js.map
|