@webx-ui/module-inbox 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/README.md +54 -0
- package/dist/FieldDialog.d.ts +16 -0
- package/dist/FieldList.d.ts +21 -0
- package/dist/FormAntispam.d.ts +10 -0
- package/dist/FormCreateDialog.d.ts +2 -0
- package/dist/FormEditorPage.d.ts +14 -0
- package/dist/FormEmbed.d.ts +19 -0
- package/dist/FormGeneral.d.ts +36 -0
- package/dist/FormNotifications.d.ts +24 -0
- package/dist/InboxPage.d.ts +19 -0
- package/dist/LocalizedRichText.d.ts +17 -0
- package/dist/StatusDialog.d.ts +16 -0
- package/dist/StatusesPage.d.ts +17 -0
- package/dist/SubmissionCreateDialog.d.ts +14 -0
- package/dist/SubmissionList.d.ts +33 -0
- package/dist/SubmissionPage.d.ts +17 -0
- package/dist/api.d.ts +54 -0
- package/dist/i18n.d.ts +2 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +3163 -0
- package/dist/index.js.map +1 -0
- package/dist/messages.d.ts +14 -0
- package/dist/module.d.ts +22 -0
- package/dist/options.d.ts +15 -0
- package/dist/style.css +1 -0
- package/dist/types.d.ts +266 -0
- package/package.json +65 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,3163 @@
|
|
|
1
|
+
import { defineComponent as le, useModel as _e, computed as I, unref as e, openBlock as u, createBlock as h, withCtx as a, createVNode as t, mergeModels as We, ref as q, watch as ke, isRef as te, createElementVNode as P, createElementBlock as K, Fragment as X, createCommentVNode as O, createTextVNode as _, toDisplayString as b, renderList as ye, createSlots as Ke, onMounted as ll, reactive as tl, normalizeClass as al } from "vue";
|
|
2
|
+
import { useRoute as qe, useRouter as Ae } from "vue-router";
|
|
3
|
+
import { useAdmin as se, useTranslate as ae, useErrorText as ce, WxRowMenu as we, WxBackButton as Ee, WxDate as Pe, WxListScreen as Ze, WxNotes as nl } from "@webx-ui/module-admin";
|
|
4
|
+
import { useLocales as be, WxLocales as sl, WxRichText as He, useModal as Ne, WxDialog as Ie, WxFormItem as R, WxSelect as ve, WxInput as J, WxText as Z, WxAction as ge, WxButton as Y, WxInputNumber as he, WxDatePicker as Be, WxTagsInput as ol, WxCheckbox as me, WxSpace as Ce, toast as B, createModal as Me, WxCard as ee, WxEmpty as Se, WxSortableList as Re, WxBadge as xe, localizedValue as re, confirm as ze, WxSwitch as Qe, WxTable as Ye, WxAlert as Fe, WxSkeleton as De, WxTabs as Je, WxTab as Ue, WxActionBar as il, WxTextarea as ul, WxRadioGroup as dl, WxCheckboxGroup as rl, WxHeading as Xe, WxAvatar as cl, WxTooltip as pl, WxIcon as ml, WxListDetail as vl, WxDescriptions as Ge, WxDescriptionsItem as Te, WxFileCard as fl, WxTimeline as bl, WxTimelineItem as hl } from "@webx-ui/core";
|
|
5
|
+
const el = /* @__PURE__ */ le({
|
|
6
|
+
__name: "LocalizedRichText",
|
|
7
|
+
props: /* @__PURE__ */ We({
|
|
8
|
+
placeholder: { default: void 0 },
|
|
9
|
+
minHeight: { default: "160px" }
|
|
10
|
+
}, {
|
|
11
|
+
modelValue: { default: "" },
|
|
12
|
+
modelModifiers: {}
|
|
13
|
+
}),
|
|
14
|
+
emits: ["update:modelValue"],
|
|
15
|
+
setup(r) {
|
|
16
|
+
const i = _e(r, "modelValue"), o = r, m = be(), s = I(() => {
|
|
17
|
+
const c = m.active.value;
|
|
18
|
+
return m.list.value.some((S) => S.code === c) ? c : m.list.value[0]?.code ?? "";
|
|
19
|
+
}), p = I({
|
|
20
|
+
get: () => {
|
|
21
|
+
const c = i.value;
|
|
22
|
+
return typeof c == "string" ? s.value === "" || s.value === m.list.value[0]?.code ? c : "" : c[s.value] ?? "";
|
|
23
|
+
},
|
|
24
|
+
set: (c) => {
|
|
25
|
+
if (s.value === "") {
|
|
26
|
+
i.value = c;
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const l = typeof i.value == "string" ? { [s.value]: i.value } : i.value;
|
|
30
|
+
i.value = { ...l, [s.value]: c };
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
return (c, l) => e(m).list.value.length > 0 ? (u(), h(e(sl), { key: 0 }, {
|
|
34
|
+
default: a(() => [
|
|
35
|
+
t(e(He), {
|
|
36
|
+
modelValue: p.value,
|
|
37
|
+
"onUpdate:modelValue": l[0] || (l[0] = (S) => p.value = S),
|
|
38
|
+
placeholder: o.placeholder,
|
|
39
|
+
"min-height": o.minHeight
|
|
40
|
+
}, null, 8, ["modelValue", "placeholder", "min-height"])
|
|
41
|
+
]),
|
|
42
|
+
_: 1
|
|
43
|
+
})) : (u(), h(e(He), {
|
|
44
|
+
key: 1,
|
|
45
|
+
modelValue: p.value,
|
|
46
|
+
"onUpdate:modelValue": l[1] || (l[1] = (S) => p.value = S),
|
|
47
|
+
placeholder: o.placeholder,
|
|
48
|
+
"min-height": o.minHeight
|
|
49
|
+
}, null, 8, ["modelValue", "placeholder", "min-height"]));
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
function ie(r) {
|
|
53
|
+
const i = `${r.apiPath}/inbox`, o = (s) => s.data, m = () => {
|
|
54
|
+
};
|
|
55
|
+
return {
|
|
56
|
+
forms: () => r.http.get(`${i}/forms`).then(o),
|
|
57
|
+
form: (s) => r.http.get(`${i}/forms/${s}`).then(o),
|
|
58
|
+
createForm: (s) => r.http.post(`${i}/forms`, s).then(o),
|
|
59
|
+
saveForm: (s, p) => r.http.put(`${i}/forms/${s}`, p).then(o),
|
|
60
|
+
removeForm: (s) => r.http.delete(`${i}/forms/${s}`).then(m),
|
|
61
|
+
duplicateForm: (s) => r.http.post(`${i}/forms/${s}/duplicate`, {}).then(o),
|
|
62
|
+
sortForms: (s) => r.http.post(`${i}/forms/sorting`, { ids: s }).then(m),
|
|
63
|
+
fields: (s) => r.http.get(`${i}/forms/${s}/fields`).then(o),
|
|
64
|
+
createField: (s, p) => r.http.post(`${i}/forms/${s}/fields`, p).then(o),
|
|
65
|
+
saveField: (s, p) => r.http.put(`${i}/fields/${s}`, p).then(o),
|
|
66
|
+
removeField: (s) => r.http.delete(`${i}/fields/${s}`).then(m),
|
|
67
|
+
sortFields: (s, p) => r.http.post(`${i}/forms/${s}/fields/sorting`, { ids: p }).then(m),
|
|
68
|
+
statuses: () => r.http.get(`${i}/statuses`).then(o),
|
|
69
|
+
createStatus: (s) => r.http.post(`${i}/statuses`, s).then(o),
|
|
70
|
+
saveStatus: (s, p) => r.http.put(`${i}/statuses/${s}`, p).then(o),
|
|
71
|
+
removeStatus: (s) => r.http.delete(`${i}/statuses/${s}`).then(m),
|
|
72
|
+
sortStatuses: (s) => r.http.post(`${i}/statuses/sorting`, { ids: s }).then(m),
|
|
73
|
+
recipients: () => r.http.get(`${i}/recipients`).then(o),
|
|
74
|
+
submissions: (s, p = {}) => r.http.get(`${i}/forms/${s}/submissions`, { query: Oe(p) }).then((c) => ({
|
|
75
|
+
...c.meta,
|
|
76
|
+
data: c.data,
|
|
77
|
+
columns: c.columns,
|
|
78
|
+
counts: c.counts
|
|
79
|
+
})),
|
|
80
|
+
submission: (s, p = {}) => r.http.get(`${i}/submissions/${s}`, { query: Oe(p) }).then(o),
|
|
81
|
+
createSubmission: (s, p) => r.http.post(`${i}/forms/${s}/submissions`, { fields: p }).then(o),
|
|
82
|
+
saveSubmission: (s, p) => r.http.put(`${i}/submissions/${s}`, p).then(o),
|
|
83
|
+
removeSubmission: (s) => r.http.delete(`${i}/submissions/${s}`).then(m),
|
|
84
|
+
massSubmissions: (s) => r.http.post(`${i}/submissions/mass`, s).then(o),
|
|
85
|
+
exportUrl: (s, p = {}) => {
|
|
86
|
+
const c = new URLSearchParams();
|
|
87
|
+
for (const [S, n] of Object.entries(Oe(p)))
|
|
88
|
+
n != null && n !== "" && c.set(S, String(n));
|
|
89
|
+
const l = c.toString();
|
|
90
|
+
return `${i}/forms/${s}/submissions/export${l === "" ? "" : `?${l}`}`;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function Oe(r) {
|
|
95
|
+
return {
|
|
96
|
+
view: r.view === void 0 || r.view === "" ? void 0 : r.view,
|
|
97
|
+
search: r.search === void 0 || r.search === "" ? void 0 : r.search,
|
|
98
|
+
assignee: r.assignee ?? void 0,
|
|
99
|
+
sort: r.sort ?? void 0,
|
|
100
|
+
page: r.page,
|
|
101
|
+
per_page: r.per_page
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
const yl = {
|
|
105
|
+
module: {
|
|
106
|
+
title: "Inbox"
|
|
107
|
+
},
|
|
108
|
+
panel: {
|
|
109
|
+
forms: "Forms",
|
|
110
|
+
"new-form": "New form",
|
|
111
|
+
"no-forms": "No forms yet.",
|
|
112
|
+
"no-forms-help": "A form is a few questions and a list of who hears the answers.",
|
|
113
|
+
"choose-form": "Choose a form to see what has come in.",
|
|
114
|
+
unread: "Unread",
|
|
115
|
+
submissions: "Submissions in all",
|
|
116
|
+
off: "Off",
|
|
117
|
+
settings: "Settings",
|
|
118
|
+
duplicate: "Duplicate",
|
|
119
|
+
delete: "Delete",
|
|
120
|
+
"delete-form-title": "Delete “:form”?",
|
|
121
|
+
"delete-form-text": "The form and its questions go. This cannot be undone.",
|
|
122
|
+
cancel: "Cancel",
|
|
123
|
+
save: "Save",
|
|
124
|
+
saved: "Saved.",
|
|
125
|
+
deleted: "Deleted.",
|
|
126
|
+
duplicated: "A copy was made.",
|
|
127
|
+
failed: "Some values were not accepted. Check the highlighted fields.",
|
|
128
|
+
"reorder-failed": "The new order could not be saved.",
|
|
129
|
+
"new-form-title": "New form",
|
|
130
|
+
title: "Title",
|
|
131
|
+
slug: "Address",
|
|
132
|
+
"slug-help": "What the form is called on the site and where it posts.",
|
|
133
|
+
"is-enabled": "Active",
|
|
134
|
+
"is-enabled-help": "A form that is off is neither drawn nor accepted.",
|
|
135
|
+
"tab-general": "General",
|
|
136
|
+
"tab-fields": "Fields",
|
|
137
|
+
"tab-notifications": "Notifications",
|
|
138
|
+
"tab-antispam": "Antispam",
|
|
139
|
+
"tab-embed": "Embedding",
|
|
140
|
+
"after-sending": "After sending",
|
|
141
|
+
"thank-you-heading": "Heading",
|
|
142
|
+
"thank-you-text": "Text",
|
|
143
|
+
"submit-text": "Text on the button",
|
|
144
|
+
redirect: "Go to this address instead",
|
|
145
|
+
"redirect-help": "Left empty, the thank-you takes the form’s place on the page.",
|
|
146
|
+
recipients: "Who is written to",
|
|
147
|
+
"recipients-help": "Nobody here means nobody is told. The submission is kept either way.",
|
|
148
|
+
"no-recipients": "Nobody yet.",
|
|
149
|
+
"add-admin": "Add an administrator",
|
|
150
|
+
"add-email": "Add an address",
|
|
151
|
+
remove: "Remove",
|
|
152
|
+
"email-field": "The field holding the sender’s address",
|
|
153
|
+
"email-field-help": "A reply to the notification then goes to whoever wrote in.",
|
|
154
|
+
"no-email-field": "None",
|
|
155
|
+
honeypot: "Hidden field",
|
|
156
|
+
"honeypot-help": "A field nobody sees and a robot fills in.",
|
|
157
|
+
"min-seconds": "Fastest a person could send it, in seconds",
|
|
158
|
+
"min-seconds-help": "Zero switches the check off.",
|
|
159
|
+
throttle: "Sends a minute from one address",
|
|
160
|
+
"throttle-help": "Zero switches the limit off.",
|
|
161
|
+
captcha: "Captcha",
|
|
162
|
+
"captcha-help": "The keys belong to the site and are set in its settings, not here.",
|
|
163
|
+
"captcha-off": "Off",
|
|
164
|
+
"captcha-recaptcha": "reCAPTCHA",
|
|
165
|
+
"captcha-turnstile": "Turnstile",
|
|
166
|
+
"embed-blade": "On a page of the site",
|
|
167
|
+
"embed-blade-help": "Put the tag where the form belongs. The markup is published and rewritten by the site.",
|
|
168
|
+
"embed-block": "In the block builder",
|
|
169
|
+
"embed-block-help": "A block type prints the same tag, so an editor drops the form in without touching a template.",
|
|
170
|
+
"embed-names": "Names of the fields",
|
|
171
|
+
"embed-names-help": "A hidden field is filled in by the page: the address it was sent from, a product, a campaign.",
|
|
172
|
+
copy: "Copy",
|
|
173
|
+
copied: "Copied.",
|
|
174
|
+
statuses: "Statuses",
|
|
175
|
+
"new-status": "New status",
|
|
176
|
+
"status-key": "Key",
|
|
177
|
+
"status-color": "Colour",
|
|
178
|
+
"status-default": "Given to a new submission",
|
|
179
|
+
"status-spam": "Spam",
|
|
180
|
+
"status-closed": "Nothing further expected",
|
|
181
|
+
"in-use": "In use",
|
|
182
|
+
"delete-status-title": "Delete “:status”?",
|
|
183
|
+
"delete-status-text": "Only a status nothing is in can go.",
|
|
184
|
+
"no-statuses": "No statuses yet.",
|
|
185
|
+
"color-default": "Grey",
|
|
186
|
+
"color-primary": "Blue",
|
|
187
|
+
"color-success": "Green",
|
|
188
|
+
"color-warning": "Amber",
|
|
189
|
+
"color-info": "Cyan",
|
|
190
|
+
"color-danger": "Red",
|
|
191
|
+
// The submissions: the list on the right of the section, and one of them opened.
|
|
192
|
+
id: "ID",
|
|
193
|
+
received: "Received",
|
|
194
|
+
status: "Status",
|
|
195
|
+
assignee: "Assignee",
|
|
196
|
+
unassigned: "Nobody",
|
|
197
|
+
"submissions-empty": "Nothing has come in through this form yet.",
|
|
198
|
+
"search-submissions": "Search the answers",
|
|
199
|
+
"view-all": "All",
|
|
200
|
+
"view-unread": "Unread",
|
|
201
|
+
export: "Export",
|
|
202
|
+
"new-submission": "Add by hand",
|
|
203
|
+
"new-submission-title": "A submission by hand",
|
|
204
|
+
"new-submission-help": "For one that came by telephone or on paper. It is written the same way and lands in the same list.",
|
|
205
|
+
created: "Added.",
|
|
206
|
+
submission: "Submission :id",
|
|
207
|
+
previous: "Previous",
|
|
208
|
+
next: "Next",
|
|
209
|
+
"mark-read": "Mark as read",
|
|
210
|
+
"mark-unread": "Mark as unread",
|
|
211
|
+
"delete-submission-title": "Delete this submission?",
|
|
212
|
+
"delete-submission-text": "It goes with its attachments. This cannot be undone.",
|
|
213
|
+
selected: ":count selected",
|
|
214
|
+
"move-to": "Move to",
|
|
215
|
+
"delete-selected-title": "Delete :count submissions?",
|
|
216
|
+
answers: "Answers",
|
|
217
|
+
attachments: "Attachments",
|
|
218
|
+
details: "Details",
|
|
219
|
+
"meta-page": "Page",
|
|
220
|
+
"meta-referrer": "Came from",
|
|
221
|
+
"meta-ip": "Address",
|
|
222
|
+
"meta-agent": "Browser",
|
|
223
|
+
"meta-locale": "Language",
|
|
224
|
+
"meta-source": "How it arrived",
|
|
225
|
+
"source-web": "From the site",
|
|
226
|
+
"source-panel": "Typed in",
|
|
227
|
+
notified: "The notification went out",
|
|
228
|
+
"not-notified": "No notification was sent",
|
|
229
|
+
"notify-failed": "The notification could not be sent",
|
|
230
|
+
reply: "Reply by mail",
|
|
231
|
+
log: "What has happened",
|
|
232
|
+
"event-created": "Arrived",
|
|
233
|
+
"event-status": "Status: :to",
|
|
234
|
+
"event-assignee": "Given to :to",
|
|
235
|
+
"event-unassigned": "Left to nobody",
|
|
236
|
+
"event-note": "A note was added",
|
|
237
|
+
"event-notified": "The notification went out",
|
|
238
|
+
system: "System",
|
|
239
|
+
"no-answers": "Nothing was filled in.",
|
|
240
|
+
download: "Download",
|
|
241
|
+
"no-files-by-hand": "A file cannot be attached by hand: the files a submission carries are what was posted with it.",
|
|
242
|
+
"submissions-none": "Nothing here under this filter."
|
|
243
|
+
},
|
|
244
|
+
fields: {
|
|
245
|
+
field: "Field",
|
|
246
|
+
"new-field": "New field",
|
|
247
|
+
"edit-field": "Field",
|
|
248
|
+
"no-fields": "No questions yet.",
|
|
249
|
+
"no-fields-help": "A form with no fields draws nothing on the page.",
|
|
250
|
+
"save-first": "Save the form first, then write its questions.",
|
|
251
|
+
delete: "Delete",
|
|
252
|
+
"delete-title": "Delete “:field”?",
|
|
253
|
+
"delete-text": "It stops being asked. Answers already given keep it.",
|
|
254
|
+
cancel: "Cancel",
|
|
255
|
+
save: "Save",
|
|
256
|
+
name: "Name",
|
|
257
|
+
"name-help": "What the field is called in the HTML. Left empty, it answers to f17.",
|
|
258
|
+
type: "Type",
|
|
259
|
+
title: "Label",
|
|
260
|
+
placeholder: "Placeholder",
|
|
261
|
+
help: "Hint under the field",
|
|
262
|
+
"is-enabled": "Shown",
|
|
263
|
+
"is-required": "Required",
|
|
264
|
+
"is-fullsize": "Full width",
|
|
265
|
+
"in-table": "A column in the list",
|
|
266
|
+
choices: "Choices",
|
|
267
|
+
"choice-value": "Value",
|
|
268
|
+
"choice-label": "Label",
|
|
269
|
+
"add-choice": "Add a choice",
|
|
270
|
+
"no-choices": "No choices yet. A field with none accepts nothing.",
|
|
271
|
+
maxlength: "Longest answer, in characters",
|
|
272
|
+
rows: "Height, in lines",
|
|
273
|
+
pattern: "Pattern the answer has to match",
|
|
274
|
+
"pattern-help": "The browser’s own, written without delimiters: [0-9+ ()-]{6,}",
|
|
275
|
+
earliest: "Earliest date",
|
|
276
|
+
latest: "Latest date",
|
|
277
|
+
"min-choices": "Fewest ticks",
|
|
278
|
+
"max-choices": "Most ticks",
|
|
279
|
+
"consent-text": "The sentence beside the tick",
|
|
280
|
+
"consent-text-help": "A link is allowed here: it is printed as written.",
|
|
281
|
+
"max-size": "Largest file, in kilobytes",
|
|
282
|
+
extensions: "Extensions allowed",
|
|
283
|
+
"extensions-help": "Comma separated. Empty means the list the site allows.",
|
|
284
|
+
multiple: "Several files at once",
|
|
285
|
+
"type-text": "Text",
|
|
286
|
+
"type-email": "E-mail",
|
|
287
|
+
"type-tel": "Telephone",
|
|
288
|
+
"type-textarea": "Long text",
|
|
289
|
+
"type-select": "Drop-down",
|
|
290
|
+
"type-radio": "One of several",
|
|
291
|
+
"type-checkbox": "Several of several",
|
|
292
|
+
"type-consent": "Consent",
|
|
293
|
+
"type-date": "Date",
|
|
294
|
+
"type-file": "File",
|
|
295
|
+
"type-hidden": "Hidden"
|
|
296
|
+
}
|
|
297
|
+
}, je = /* @__PURE__ */ new WeakSet();
|
|
298
|
+
function ue() {
|
|
299
|
+
try {
|
|
300
|
+
const { i18n: r } = se();
|
|
301
|
+
je.has(r) || (r.defaults("webx-inbox", yl), je.add(r));
|
|
302
|
+
} catch {
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
const gl = [
|
|
306
|
+
"text",
|
|
307
|
+
"email",
|
|
308
|
+
"tel",
|
|
309
|
+
"textarea",
|
|
310
|
+
"select",
|
|
311
|
+
"radio",
|
|
312
|
+
"checkbox",
|
|
313
|
+
"consent",
|
|
314
|
+
"date",
|
|
315
|
+
"file",
|
|
316
|
+
"hidden"
|
|
317
|
+
], xl = ["default", "primary", "success", "warning", "info", "danger"], _l = { class: "wx-inbox-field-form" }, wl = { class: "wx-inbox-field-form__row" }, kl = {
|
|
318
|
+
key: 2,
|
|
319
|
+
class: "wx-inbox-choices"
|
|
320
|
+
}, Vl = { class: "wx-inbox-field-form__row" }, $l = { class: "wx-inbox-field-form__checks" }, Ul = /* @__PURE__ */ le({
|
|
321
|
+
__name: "FieldDialog",
|
|
322
|
+
props: {
|
|
323
|
+
field: {},
|
|
324
|
+
form: {}
|
|
325
|
+
},
|
|
326
|
+
setup(r) {
|
|
327
|
+
const i = r, { resolve: o, dismiss: m, open: s } = Ne(), p = se(), c = ie(p);
|
|
328
|
+
ue();
|
|
329
|
+
const l = ae("webx-inbox"), S = ce(), n = q(!1), f = q({}), M = q(""), C = q("text"), T = q({}), U = q({}), A = q({}), d = q({}), y = q(!0), w = q(!1), F = q(!0), W = q(!1);
|
|
330
|
+
ke(
|
|
331
|
+
() => i.field,
|
|
332
|
+
(G) => {
|
|
333
|
+
M.value = G?.name ?? "", C.value = G?.type ?? "text", T.value = { ...G?.title ?? {} }, U.value = { ...G?.placeholder ?? {} }, A.value = { ...G?.help ?? {} }, d.value = { ...G?.options ?? {} }, y.value = G?.is_enabled ?? !0, w.value = G?.is_required ?? !1, F.value = G?.is_fullsize ?? !0, W.value = G?.in_table ?? !1, f.value = {};
|
|
334
|
+
},
|
|
335
|
+
{ immediate: !0 }
|
|
336
|
+
);
|
|
337
|
+
const H = I(
|
|
338
|
+
() => gl.map((G) => ({ value: G, label: l(`fields.type-${G}`) }))
|
|
339
|
+
), D = I(() => ["select", "radio", "checkbox"].includes(C.value)), N = I(
|
|
340
|
+
() => Array.isArray(d.value.choices) ? d.value.choices : []
|
|
341
|
+
), L = I({
|
|
342
|
+
get: () => Array.isArray(d.value.extensions) ? d.value.extensions : [],
|
|
343
|
+
set: (G) => x(
|
|
344
|
+
"extensions",
|
|
345
|
+
G.map((k) => k.replace(/^\./, ""))
|
|
346
|
+
)
|
|
347
|
+
});
|
|
348
|
+
function x(G, k) {
|
|
349
|
+
d.value = { ...d.value, [G]: k };
|
|
350
|
+
}
|
|
351
|
+
function V() {
|
|
352
|
+
x("choices", [...N.value, { value: "", label: {} }]);
|
|
353
|
+
}
|
|
354
|
+
function Q(G) {
|
|
355
|
+
x(
|
|
356
|
+
"choices",
|
|
357
|
+
N.value.filter((k, $) => $ !== G)
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
function j(G, k) {
|
|
361
|
+
x(
|
|
362
|
+
"choices",
|
|
363
|
+
N.value.map(($, ne) => ne === G ? { ...$, ...k } : $)
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
function pe(G) {
|
|
367
|
+
return f.value[G]?.[0];
|
|
368
|
+
}
|
|
369
|
+
async function Ve() {
|
|
370
|
+
n.value = !0, f.value = {};
|
|
371
|
+
const G = {
|
|
372
|
+
name: M.value.trim() === "" ? null : M.value.trim(),
|
|
373
|
+
type: C.value,
|
|
374
|
+
title: T.value,
|
|
375
|
+
placeholder: U.value,
|
|
376
|
+
help: A.value,
|
|
377
|
+
options: d.value,
|
|
378
|
+
is_enabled: y.value,
|
|
379
|
+
is_required: w.value,
|
|
380
|
+
is_fullsize: F.value,
|
|
381
|
+
in_table: W.value
|
|
382
|
+
};
|
|
383
|
+
try {
|
|
384
|
+
o(
|
|
385
|
+
i.field === null ? await c.createField(i.form.id, G) : await c.saveField(i.field.id, G)
|
|
386
|
+
);
|
|
387
|
+
} catch (k) {
|
|
388
|
+
const $ = k.body;
|
|
389
|
+
$?.errors ? (f.value = $.errors, B.danger(l("panel.failed"))) : B.danger(S(k));
|
|
390
|
+
} finally {
|
|
391
|
+
n.value = !1;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
return (G, k) => (u(), h(e(Ie), {
|
|
395
|
+
open: e(s),
|
|
396
|
+
"onUpdate:open": k[21] || (k[21] = ($) => te(s) ? s.value = $ : null),
|
|
397
|
+
title: r.field ? e(l)("fields.edit-field") : e(l)("fields.new-field"),
|
|
398
|
+
width: 720
|
|
399
|
+
}, {
|
|
400
|
+
footer: a(() => [
|
|
401
|
+
t(e(Ce), { size: "sm" }, {
|
|
402
|
+
default: a(() => [
|
|
403
|
+
t(e(Y), {
|
|
404
|
+
variant: "outline",
|
|
405
|
+
onClick: k[20] || (k[20] = ($) => e(m)())
|
|
406
|
+
}, {
|
|
407
|
+
default: a(() => [
|
|
408
|
+
_(b(e(l)("fields.cancel")), 1)
|
|
409
|
+
]),
|
|
410
|
+
_: 1
|
|
411
|
+
}),
|
|
412
|
+
t(e(Y), {
|
|
413
|
+
type: "primary",
|
|
414
|
+
loading: n.value,
|
|
415
|
+
onClick: Ve
|
|
416
|
+
}, {
|
|
417
|
+
default: a(() => [
|
|
418
|
+
_(b(e(l)("fields.save")), 1)
|
|
419
|
+
]),
|
|
420
|
+
_: 1
|
|
421
|
+
}, 8, ["loading"])
|
|
422
|
+
]),
|
|
423
|
+
_: 1
|
|
424
|
+
})
|
|
425
|
+
]),
|
|
426
|
+
default: a(() => [
|
|
427
|
+
P("div", _l, [
|
|
428
|
+
P("div", wl, [
|
|
429
|
+
t(e(R), {
|
|
430
|
+
label: e(l)("fields.type")
|
|
431
|
+
}, {
|
|
432
|
+
default: a(() => [
|
|
433
|
+
t(e(ve), {
|
|
434
|
+
modelValue: C.value,
|
|
435
|
+
"onUpdate:modelValue": k[0] || (k[0] = ($) => C.value = $),
|
|
436
|
+
options: H.value
|
|
437
|
+
}, null, 8, ["modelValue", "options"])
|
|
438
|
+
]),
|
|
439
|
+
_: 1
|
|
440
|
+
}, 8, ["label"]),
|
|
441
|
+
t(e(R), {
|
|
442
|
+
label: e(l)("fields.name"),
|
|
443
|
+
help: e(l)("fields.name-help"),
|
|
444
|
+
error: pe("name")
|
|
445
|
+
}, {
|
|
446
|
+
default: a(() => [
|
|
447
|
+
t(e(J), {
|
|
448
|
+
modelValue: M.value,
|
|
449
|
+
"onUpdate:modelValue": k[1] || (k[1] = ($) => M.value = $),
|
|
450
|
+
placeholder: "email"
|
|
451
|
+
}, null, 8, ["modelValue"])
|
|
452
|
+
]),
|
|
453
|
+
_: 1
|
|
454
|
+
}, 8, ["label", "help", "error"])
|
|
455
|
+
]),
|
|
456
|
+
t(e(R), {
|
|
457
|
+
label: e(l)("fields.title"),
|
|
458
|
+
error: pe("title"),
|
|
459
|
+
required: ""
|
|
460
|
+
}, {
|
|
461
|
+
default: a(() => [
|
|
462
|
+
t(e(J), {
|
|
463
|
+
modelValue: T.value,
|
|
464
|
+
"onUpdate:modelValue": k[2] || (k[2] = ($) => T.value = $),
|
|
465
|
+
localized: ""
|
|
466
|
+
}, null, 8, ["modelValue"])
|
|
467
|
+
]),
|
|
468
|
+
_: 1
|
|
469
|
+
}, 8, ["label", "error"]),
|
|
470
|
+
C.value !== "hidden" ? (u(), K(X, { key: 0 }, [
|
|
471
|
+
C.value !== "consent" ? (u(), h(e(R), {
|
|
472
|
+
key: 0,
|
|
473
|
+
label: e(l)("fields.placeholder")
|
|
474
|
+
}, {
|
|
475
|
+
default: a(() => [
|
|
476
|
+
t(e(J), {
|
|
477
|
+
modelValue: U.value,
|
|
478
|
+
"onUpdate:modelValue": k[3] || (k[3] = ($) => U.value = $),
|
|
479
|
+
localized: ""
|
|
480
|
+
}, null, 8, ["modelValue"])
|
|
481
|
+
]),
|
|
482
|
+
_: 1
|
|
483
|
+
}, 8, ["label"])) : O("", !0),
|
|
484
|
+
t(e(R), {
|
|
485
|
+
label: e(l)("fields.help")
|
|
486
|
+
}, {
|
|
487
|
+
default: a(() => [
|
|
488
|
+
t(e(J), {
|
|
489
|
+
modelValue: A.value,
|
|
490
|
+
"onUpdate:modelValue": k[4] || (k[4] = ($) => A.value = $),
|
|
491
|
+
localized: ""
|
|
492
|
+
}, null, 8, ["modelValue"])
|
|
493
|
+
]),
|
|
494
|
+
_: 1
|
|
495
|
+
}, 8, ["label"])
|
|
496
|
+
], 64)) : O("", !0),
|
|
497
|
+
C.value === "consent" ? (u(), h(e(R), {
|
|
498
|
+
key: 1,
|
|
499
|
+
label: e(l)("fields.consent-text"),
|
|
500
|
+
help: e(l)("fields.consent-text-help")
|
|
501
|
+
}, {
|
|
502
|
+
default: a(() => [
|
|
503
|
+
t(el, {
|
|
504
|
+
"model-value": d.value.text ?? {},
|
|
505
|
+
"min-height": "100px",
|
|
506
|
+
"onUpdate:modelValue": k[5] || (k[5] = ($) => x("text", $))
|
|
507
|
+
}, null, 8, ["model-value"])
|
|
508
|
+
]),
|
|
509
|
+
_: 1
|
|
510
|
+
}, 8, ["label", "help"])) : O("", !0),
|
|
511
|
+
D.value ? (u(), K("div", kl, [
|
|
512
|
+
t(e(Z), {
|
|
513
|
+
size: "sm",
|
|
514
|
+
weight: "medium"
|
|
515
|
+
}, {
|
|
516
|
+
default: a(() => [
|
|
517
|
+
_(b(e(l)("fields.choices")), 1)
|
|
518
|
+
]),
|
|
519
|
+
_: 1
|
|
520
|
+
}),
|
|
521
|
+
N.value.length === 0 ? (u(), h(e(Z), {
|
|
522
|
+
key: 0,
|
|
523
|
+
size: "sm",
|
|
524
|
+
tone: "placeholder"
|
|
525
|
+
}, {
|
|
526
|
+
default: a(() => [
|
|
527
|
+
_(b(e(l)("fields.no-choices")), 1)
|
|
528
|
+
]),
|
|
529
|
+
_: 1
|
|
530
|
+
})) : O("", !0),
|
|
531
|
+
(u(!0), K(X, null, ye(N.value, ($, ne) => (u(), K("div", {
|
|
532
|
+
key: ne,
|
|
533
|
+
class: "wx-inbox-choices__row"
|
|
534
|
+
}, [
|
|
535
|
+
t(e(J), {
|
|
536
|
+
"model-value": $.value,
|
|
537
|
+
placeholder: e(l)("fields.choice-value"),
|
|
538
|
+
"onUpdate:modelValue": (fe) => j(ne, { value: String(fe) })
|
|
539
|
+
}, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"]),
|
|
540
|
+
t(e(J), {
|
|
541
|
+
"model-value": $.label,
|
|
542
|
+
localized: "",
|
|
543
|
+
placeholder: e(l)("fields.choice-label"),
|
|
544
|
+
"onUpdate:modelValue": (fe) => j(ne, { label: fe })
|
|
545
|
+
}, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"]),
|
|
546
|
+
t(e(ge), {
|
|
547
|
+
icon: "trash",
|
|
548
|
+
title: e(l)("fields.delete"),
|
|
549
|
+
onClick: (fe) => Q(ne)
|
|
550
|
+
}, null, 8, ["title", "onClick"])
|
|
551
|
+
]))), 128)),
|
|
552
|
+
t(e(Y), {
|
|
553
|
+
variant: "outline",
|
|
554
|
+
size: "sm",
|
|
555
|
+
icon: "plus",
|
|
556
|
+
onClick: V
|
|
557
|
+
}, {
|
|
558
|
+
default: a(() => [
|
|
559
|
+
_(b(e(l)("fields.add-choice")), 1)
|
|
560
|
+
]),
|
|
561
|
+
_: 1
|
|
562
|
+
})
|
|
563
|
+
])) : O("", !0),
|
|
564
|
+
P("div", Vl, [
|
|
565
|
+
C.value === "textarea" ? (u(), h(e(R), {
|
|
566
|
+
key: 0,
|
|
567
|
+
label: e(l)("fields.rows")
|
|
568
|
+
}, {
|
|
569
|
+
default: a(() => [
|
|
570
|
+
t(e(he), {
|
|
571
|
+
"model-value": d.value.rows ?? 5,
|
|
572
|
+
min: 2,
|
|
573
|
+
max: 30,
|
|
574
|
+
"onUpdate:modelValue": k[6] || (k[6] = ($) => x("rows", $))
|
|
575
|
+
}, null, 8, ["model-value"])
|
|
576
|
+
]),
|
|
577
|
+
_: 1
|
|
578
|
+
}, 8, ["label"])) : O("", !0),
|
|
579
|
+
["text", "email", "textarea"].includes(C.value) ? (u(), h(e(R), {
|
|
580
|
+
key: 1,
|
|
581
|
+
label: e(l)("fields.maxlength")
|
|
582
|
+
}, {
|
|
583
|
+
default: a(() => [
|
|
584
|
+
t(e(he), {
|
|
585
|
+
"model-value": d.value.maxlength ?? null,
|
|
586
|
+
min: 1,
|
|
587
|
+
max: 2e4,
|
|
588
|
+
"onUpdate:modelValue": k[7] || (k[7] = ($) => x("maxlength", $))
|
|
589
|
+
}, null, 8, ["model-value"])
|
|
590
|
+
]),
|
|
591
|
+
_: 1
|
|
592
|
+
}, 8, ["label"])) : O("", !0),
|
|
593
|
+
C.value === "tel" ? (u(), h(e(R), {
|
|
594
|
+
key: 2,
|
|
595
|
+
label: e(l)("fields.pattern"),
|
|
596
|
+
help: e(l)("fields.pattern-help")
|
|
597
|
+
}, {
|
|
598
|
+
default: a(() => [
|
|
599
|
+
t(e(J), {
|
|
600
|
+
"model-value": d.value.pattern ?? "",
|
|
601
|
+
"onUpdate:modelValue": k[8] || (k[8] = ($) => x("pattern", $))
|
|
602
|
+
}, null, 8, ["model-value"])
|
|
603
|
+
]),
|
|
604
|
+
_: 1
|
|
605
|
+
}, 8, ["label", "help"])) : O("", !0),
|
|
606
|
+
C.value === "date" ? (u(), K(X, { key: 3 }, [
|
|
607
|
+
t(e(R), {
|
|
608
|
+
label: e(l)("fields.earliest")
|
|
609
|
+
}, {
|
|
610
|
+
default: a(() => [
|
|
611
|
+
t(e(Be), {
|
|
612
|
+
clearable: "",
|
|
613
|
+
"model-value": d.value.min ?? null,
|
|
614
|
+
"onUpdate:modelValue": k[9] || (k[9] = ($) => x("min", $))
|
|
615
|
+
}, null, 8, ["model-value"])
|
|
616
|
+
]),
|
|
617
|
+
_: 1
|
|
618
|
+
}, 8, ["label"]),
|
|
619
|
+
t(e(R), {
|
|
620
|
+
label: e(l)("fields.latest")
|
|
621
|
+
}, {
|
|
622
|
+
default: a(() => [
|
|
623
|
+
t(e(Be), {
|
|
624
|
+
clearable: "",
|
|
625
|
+
"model-value": d.value.max ?? null,
|
|
626
|
+
"onUpdate:modelValue": k[10] || (k[10] = ($) => x("max", $))
|
|
627
|
+
}, null, 8, ["model-value"])
|
|
628
|
+
]),
|
|
629
|
+
_: 1
|
|
630
|
+
}, 8, ["label"])
|
|
631
|
+
], 64)) : O("", !0),
|
|
632
|
+
C.value === "checkbox" ? (u(), K(X, { key: 4 }, [
|
|
633
|
+
t(e(R), {
|
|
634
|
+
label: e(l)("fields.min-choices")
|
|
635
|
+
}, {
|
|
636
|
+
default: a(() => [
|
|
637
|
+
t(e(he), {
|
|
638
|
+
"model-value": d.value.min ?? null,
|
|
639
|
+
min: 0,
|
|
640
|
+
"onUpdate:modelValue": k[11] || (k[11] = ($) => x("min", $))
|
|
641
|
+
}, null, 8, ["model-value"])
|
|
642
|
+
]),
|
|
643
|
+
_: 1
|
|
644
|
+
}, 8, ["label"]),
|
|
645
|
+
t(e(R), {
|
|
646
|
+
label: e(l)("fields.max-choices")
|
|
647
|
+
}, {
|
|
648
|
+
default: a(() => [
|
|
649
|
+
t(e(he), {
|
|
650
|
+
"model-value": d.value.max ?? null,
|
|
651
|
+
min: 0,
|
|
652
|
+
"onUpdate:modelValue": k[12] || (k[12] = ($) => x("max", $))
|
|
653
|
+
}, null, 8, ["model-value"])
|
|
654
|
+
]),
|
|
655
|
+
_: 1
|
|
656
|
+
}, 8, ["label"])
|
|
657
|
+
], 64)) : O("", !0),
|
|
658
|
+
C.value === "file" ? (u(), h(e(R), {
|
|
659
|
+
key: 5,
|
|
660
|
+
label: e(l)("fields.max-size")
|
|
661
|
+
}, {
|
|
662
|
+
default: a(() => [
|
|
663
|
+
t(e(he), {
|
|
664
|
+
"model-value": d.value.max_size ?? null,
|
|
665
|
+
min: 1,
|
|
666
|
+
"onUpdate:modelValue": k[13] || (k[13] = ($) => x("max_size", $))
|
|
667
|
+
}, null, 8, ["model-value"])
|
|
668
|
+
]),
|
|
669
|
+
_: 1
|
|
670
|
+
}, 8, ["label"])) : O("", !0)
|
|
671
|
+
]),
|
|
672
|
+
C.value === "file" ? (u(), K(X, { key: 3 }, [
|
|
673
|
+
t(e(R), {
|
|
674
|
+
label: e(l)("fields.extensions"),
|
|
675
|
+
help: e(l)("fields.extensions-help")
|
|
676
|
+
}, {
|
|
677
|
+
default: a(() => [
|
|
678
|
+
t(e(ol), {
|
|
679
|
+
modelValue: L.value,
|
|
680
|
+
"onUpdate:modelValue": k[14] || (k[14] = ($) => L.value = $)
|
|
681
|
+
}, null, 8, ["modelValue"])
|
|
682
|
+
]),
|
|
683
|
+
_: 1
|
|
684
|
+
}, 8, ["label", "help"]),
|
|
685
|
+
t(e(me), {
|
|
686
|
+
"model-value": !!d.value.multiple,
|
|
687
|
+
label: e(l)("fields.multiple"),
|
|
688
|
+
"onUpdate:modelValue": k[15] || (k[15] = ($) => x("multiple", $))
|
|
689
|
+
}, null, 8, ["model-value", "label"])
|
|
690
|
+
], 64)) : O("", !0),
|
|
691
|
+
P("div", $l, [
|
|
692
|
+
t(e(me), {
|
|
693
|
+
modelValue: y.value,
|
|
694
|
+
"onUpdate:modelValue": k[16] || (k[16] = ($) => y.value = $),
|
|
695
|
+
label: e(l)("fields.is-enabled")
|
|
696
|
+
}, null, 8, ["modelValue", "label"]),
|
|
697
|
+
t(e(me), {
|
|
698
|
+
modelValue: w.value,
|
|
699
|
+
"onUpdate:modelValue": k[17] || (k[17] = ($) => w.value = $),
|
|
700
|
+
label: e(l)("fields.is-required")
|
|
701
|
+
}, null, 8, ["modelValue", "label"]),
|
|
702
|
+
C.value !== "hidden" ? (u(), h(e(me), {
|
|
703
|
+
key: 0,
|
|
704
|
+
modelValue: F.value,
|
|
705
|
+
"onUpdate:modelValue": k[18] || (k[18] = ($) => F.value = $),
|
|
706
|
+
label: e(l)("fields.is-fullsize")
|
|
707
|
+
}, null, 8, ["modelValue", "label"])) : O("", !0),
|
|
708
|
+
t(e(me), {
|
|
709
|
+
modelValue: W.value,
|
|
710
|
+
"onUpdate:modelValue": k[19] || (k[19] = ($) => W.value = $),
|
|
711
|
+
label: e(l)("fields.in-table")
|
|
712
|
+
}, null, 8, ["modelValue", "label"])
|
|
713
|
+
])
|
|
714
|
+
])
|
|
715
|
+
]),
|
|
716
|
+
_: 1
|
|
717
|
+
}, 8, ["open", "title"]));
|
|
718
|
+
}
|
|
719
|
+
}), oe = (r, i) => {
|
|
720
|
+
const o = r.__vccOpts || r;
|
|
721
|
+
for (const [m, s] of i)
|
|
722
|
+
o[m] = s;
|
|
723
|
+
return o;
|
|
724
|
+
}, Sl = /* @__PURE__ */ oe(Ul, [["__scopeId", "data-v-cd153059"]]), Cl = { class: "wx-inbox-field" }, zl = { class: "wx-inbox-field__name" }, Tl = /* @__PURE__ */ le({
|
|
725
|
+
__name: "FieldList",
|
|
726
|
+
props: /* @__PURE__ */ We({
|
|
727
|
+
form: {},
|
|
728
|
+
canManage: { type: Boolean }
|
|
729
|
+
}, {
|
|
730
|
+
modelValue: { required: !0 },
|
|
731
|
+
modelModifiers: {}
|
|
732
|
+
}),
|
|
733
|
+
emits: ["update:modelValue"],
|
|
734
|
+
setup(r) {
|
|
735
|
+
const i = r, o = _e(r, "modelValue"), m = se(), s = ie(m), p = be();
|
|
736
|
+
ue();
|
|
737
|
+
const c = ae("webx-inbox"), l = ce(), S = Me(Sl);
|
|
738
|
+
function n(d) {
|
|
739
|
+
return re(d.title, p.active.value, d.key);
|
|
740
|
+
}
|
|
741
|
+
function f(d) {
|
|
742
|
+
return [
|
|
743
|
+
c(`fields.type-${d.type}`),
|
|
744
|
+
...d.is_required ? [c("fields.is-required")] : [],
|
|
745
|
+
...d.in_table ? [c("fields.in-table")] : [],
|
|
746
|
+
...d.is_fullsize ? [] : [c("fields.is-fullsize")]
|
|
747
|
+
];
|
|
748
|
+
}
|
|
749
|
+
const M = I(() => o.value.length === 0);
|
|
750
|
+
async function C(d) {
|
|
751
|
+
const y = await S({ field: d, form: i.form });
|
|
752
|
+
y && (o.value = d === null ? [...o.value, y] : o.value.map((w) => w.id === y.id ? y : w));
|
|
753
|
+
}
|
|
754
|
+
async function T(d) {
|
|
755
|
+
if (await ze({
|
|
756
|
+
title: c("fields.delete-title", { field: n(d) }),
|
|
757
|
+
message: c("fields.delete-text"),
|
|
758
|
+
confirmText: c("fields.delete"),
|
|
759
|
+
cancelText: c("fields.cancel"),
|
|
760
|
+
tone: "danger"
|
|
761
|
+
}))
|
|
762
|
+
try {
|
|
763
|
+
await s.removeField(d.id), o.value = o.value.filter((w) => w.id !== d.id), B.success(c("panel.deleted"));
|
|
764
|
+
} catch (w) {
|
|
765
|
+
B.danger(l(w));
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
function U(d) {
|
|
769
|
+
return i.canManage ? [
|
|
770
|
+
{ key: "edit", icon: "edit", label: c("fields.edit-field"), run: () => {
|
|
771
|
+
C(d);
|
|
772
|
+
} },
|
|
773
|
+
{
|
|
774
|
+
key: "delete",
|
|
775
|
+
icon: "trash",
|
|
776
|
+
label: c("fields.delete"),
|
|
777
|
+
danger: !0,
|
|
778
|
+
run: () => {
|
|
779
|
+
T(d);
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
] : [];
|
|
783
|
+
}
|
|
784
|
+
async function A() {
|
|
785
|
+
try {
|
|
786
|
+
await s.sortFields(
|
|
787
|
+
i.form.id,
|
|
788
|
+
o.value.map((d) => d.id)
|
|
789
|
+
);
|
|
790
|
+
} catch (d) {
|
|
791
|
+
B.danger(l(d, c("panel.reorder-failed")));
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
return (d, y) => (u(), h(e(ee), {
|
|
795
|
+
title: e(c)("panel.tab-fields")
|
|
796
|
+
}, Ke({
|
|
797
|
+
default: a(() => [
|
|
798
|
+
M.value ? (u(), h(e(Se), {
|
|
799
|
+
key: 0,
|
|
800
|
+
title: e(c)("fields.no-fields"),
|
|
801
|
+
description: e(c)("fields.no-fields-help")
|
|
802
|
+
}, null, 8, ["title", "description"])) : (u(), h(e(Re), {
|
|
803
|
+
key: 1,
|
|
804
|
+
modelValue: o.value,
|
|
805
|
+
"onUpdate:modelValue": y[1] || (y[1] = (w) => o.value = w),
|
|
806
|
+
plain: "",
|
|
807
|
+
"item-key": "id",
|
|
808
|
+
"item-label": n,
|
|
809
|
+
disabled: !r.canManage,
|
|
810
|
+
"aria-label": e(c)("panel.tab-fields"),
|
|
811
|
+
onMove: A
|
|
812
|
+
}, {
|
|
813
|
+
default: a(({ item: w }) => [
|
|
814
|
+
P("div", Cl, [
|
|
815
|
+
P("div", zl, [
|
|
816
|
+
t(e(Z), {
|
|
817
|
+
weight: "medium",
|
|
818
|
+
truncate: ""
|
|
819
|
+
}, {
|
|
820
|
+
default: a(() => [
|
|
821
|
+
_(b(n(w)), 1)
|
|
822
|
+
]),
|
|
823
|
+
_: 2
|
|
824
|
+
}, 1024),
|
|
825
|
+
w.is_enabled ? O("", !0) : (u(), h(e(xe), {
|
|
826
|
+
key: 0,
|
|
827
|
+
type: "default"
|
|
828
|
+
}, {
|
|
829
|
+
default: a(() => [
|
|
830
|
+
_(b(e(c)("panel.off")), 1)
|
|
831
|
+
]),
|
|
832
|
+
_: 1
|
|
833
|
+
}))
|
|
834
|
+
]),
|
|
835
|
+
t(e(Z), {
|
|
836
|
+
size: "sm",
|
|
837
|
+
tone: "muted",
|
|
838
|
+
truncate: ""
|
|
839
|
+
}, {
|
|
840
|
+
default: a(() => [
|
|
841
|
+
P("code", null, "fields[" + b(w.key) + "]", 1),
|
|
842
|
+
_(" · " + b(f(w).join(" · ")), 1)
|
|
843
|
+
]),
|
|
844
|
+
_: 2
|
|
845
|
+
}, 1024)
|
|
846
|
+
])
|
|
847
|
+
]),
|
|
848
|
+
actions: a(({ item: w }) => [
|
|
849
|
+
t(e(we), {
|
|
850
|
+
actions: U(w),
|
|
851
|
+
label: n(w)
|
|
852
|
+
}, null, 8, ["actions", "label"])
|
|
853
|
+
]),
|
|
854
|
+
_: 1
|
|
855
|
+
}, 8, ["modelValue", "disabled", "aria-label"]))
|
|
856
|
+
]),
|
|
857
|
+
_: 2
|
|
858
|
+
}, [
|
|
859
|
+
r.canManage ? {
|
|
860
|
+
name: "extra",
|
|
861
|
+
fn: a(() => [
|
|
862
|
+
t(e(Y), {
|
|
863
|
+
type: "primary",
|
|
864
|
+
size: "sm",
|
|
865
|
+
icon: "plus",
|
|
866
|
+
onClick: y[0] || (y[0] = (w) => C(null))
|
|
867
|
+
}, {
|
|
868
|
+
default: a(() => [
|
|
869
|
+
_(b(e(c)("fields.new-field")), 1)
|
|
870
|
+
]),
|
|
871
|
+
_: 1
|
|
872
|
+
})
|
|
873
|
+
]),
|
|
874
|
+
key: "0"
|
|
875
|
+
} : void 0
|
|
876
|
+
]), 1032, ["title"]));
|
|
877
|
+
}
|
|
878
|
+
}), Fl = /* @__PURE__ */ oe(Tl, [["__scopeId", "data-v-3b684f07"]]);
|
|
879
|
+
function de(r, i, o) {
|
|
880
|
+
return I({
|
|
881
|
+
get: () => r.value[i] ?? o,
|
|
882
|
+
set: (m) => {
|
|
883
|
+
const s = { ...r.value };
|
|
884
|
+
m === "" || m === null || m === void 0 ? delete s[i] : s[i] = m, r.value = s;
|
|
885
|
+
}
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
const Wl = /* @__PURE__ */ le({
|
|
889
|
+
__name: "FormAntispam",
|
|
890
|
+
props: {
|
|
891
|
+
modelValue: { required: !0 },
|
|
892
|
+
modelModifiers: {}
|
|
893
|
+
},
|
|
894
|
+
emits: ["update:modelValue"],
|
|
895
|
+
setup(r) {
|
|
896
|
+
const i = _e(r, "modelValue"), o = ae("webx-inbox"), m = de(i, "antispam.honeypot", !0), s = de(i, "antispam.min_seconds", 3), p = de(i, "antispam.throttle", 5), c = de(i, "antispam.captcha", "off"), l = I(() => [
|
|
897
|
+
{ value: "off", label: o("panel.captcha-off") },
|
|
898
|
+
{ value: "recaptcha", label: o("panel.captcha-recaptcha") },
|
|
899
|
+
{ value: "turnstile", label: o("panel.captcha-turnstile") }
|
|
900
|
+
]);
|
|
901
|
+
return (S, n) => (u(), h(e(ee), null, {
|
|
902
|
+
default: a(() => [
|
|
903
|
+
t(e(R), {
|
|
904
|
+
label: e(o)("panel.honeypot"),
|
|
905
|
+
help: e(o)("panel.honeypot-help")
|
|
906
|
+
}, {
|
|
907
|
+
default: a(() => [
|
|
908
|
+
t(e(Qe), {
|
|
909
|
+
modelValue: e(m),
|
|
910
|
+
"onUpdate:modelValue": n[0] || (n[0] = (f) => te(m) ? m.value = f : null)
|
|
911
|
+
}, null, 8, ["modelValue"])
|
|
912
|
+
]),
|
|
913
|
+
_: 1
|
|
914
|
+
}, 8, ["label", "help"]),
|
|
915
|
+
t(e(R), {
|
|
916
|
+
label: e(o)("panel.min-seconds"),
|
|
917
|
+
help: e(o)("panel.min-seconds-help")
|
|
918
|
+
}, {
|
|
919
|
+
default: a(() => [
|
|
920
|
+
t(e(he), {
|
|
921
|
+
modelValue: e(s),
|
|
922
|
+
"onUpdate:modelValue": n[1] || (n[1] = (f) => te(s) ? s.value = f : null),
|
|
923
|
+
min: 0,
|
|
924
|
+
max: 120
|
|
925
|
+
}, null, 8, ["modelValue"])
|
|
926
|
+
]),
|
|
927
|
+
_: 1
|
|
928
|
+
}, 8, ["label", "help"]),
|
|
929
|
+
t(e(R), {
|
|
930
|
+
label: e(o)("panel.throttle"),
|
|
931
|
+
help: e(o)("panel.throttle-help")
|
|
932
|
+
}, {
|
|
933
|
+
default: a(() => [
|
|
934
|
+
t(e(he), {
|
|
935
|
+
modelValue: e(p),
|
|
936
|
+
"onUpdate:modelValue": n[2] || (n[2] = (f) => te(p) ? p.value = f : null),
|
|
937
|
+
min: 0,
|
|
938
|
+
max: 120
|
|
939
|
+
}, null, 8, ["modelValue"])
|
|
940
|
+
]),
|
|
941
|
+
_: 1
|
|
942
|
+
}, 8, ["label", "help"]),
|
|
943
|
+
t(e(R), {
|
|
944
|
+
label: e(o)("panel.captcha"),
|
|
945
|
+
help: e(o)("panel.captcha-help")
|
|
946
|
+
}, {
|
|
947
|
+
default: a(() => [
|
|
948
|
+
t(e(ve), {
|
|
949
|
+
modelValue: e(c),
|
|
950
|
+
"onUpdate:modelValue": n[3] || (n[3] = (f) => te(c) ? c.value = f : null),
|
|
951
|
+
options: l.value
|
|
952
|
+
}, null, 8, ["modelValue", "options"])
|
|
953
|
+
]),
|
|
954
|
+
_: 1
|
|
955
|
+
}, 8, ["label", "help"])
|
|
956
|
+
]),
|
|
957
|
+
_: 1
|
|
958
|
+
}));
|
|
959
|
+
}
|
|
960
|
+
}), ql = { class: "wx-inbox-embed" }, Al = { class: "wx-inbox-embed__snippet" }, Nl = { class: "wx-inbox-embed__snippet" }, Il = /* @__PURE__ */ le({
|
|
961
|
+
__name: "FormEmbed",
|
|
962
|
+
props: {
|
|
963
|
+
form: {},
|
|
964
|
+
slug: {},
|
|
965
|
+
fields: {}
|
|
966
|
+
},
|
|
967
|
+
setup(r) {
|
|
968
|
+
const i = r;
|
|
969
|
+
ue();
|
|
970
|
+
const o = ae("webx-inbox"), m = I(() => `<x-webx-form slug="${i.slug}" />`), s = I(
|
|
971
|
+
() => `{{-- resources/views/blocks/contact.blade.php --}}
|
|
972
|
+
<x-webx-form slug="${i.slug}" />`
|
|
973
|
+
), p = I(() => [
|
|
974
|
+
{ key: "key", label: o("fields.name") },
|
|
975
|
+
{ key: "title", label: o("fields.title") },
|
|
976
|
+
{ key: "type", label: o("fields.type"), hideBelow: 520 }
|
|
977
|
+
]), c = I(() => i.fields.filter((S) => S.is_enabled));
|
|
978
|
+
async function l(S) {
|
|
979
|
+
try {
|
|
980
|
+
await navigator.clipboard.writeText(S), B.success(o("panel.copied"));
|
|
981
|
+
} catch {
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
return (S, n) => (u(), K("div", ql, [
|
|
985
|
+
t(e(ee), {
|
|
986
|
+
title: e(o)("panel.embed-blade")
|
|
987
|
+
}, {
|
|
988
|
+
default: a(() => [
|
|
989
|
+
t(e(Z), {
|
|
990
|
+
size: "sm",
|
|
991
|
+
tone: "muted"
|
|
992
|
+
}, {
|
|
993
|
+
default: a(() => [
|
|
994
|
+
_(b(e(o)("panel.embed-blade-help")), 1)
|
|
995
|
+
]),
|
|
996
|
+
_: 1
|
|
997
|
+
}),
|
|
998
|
+
P("div", Al, [
|
|
999
|
+
P("code", null, b(m.value), 1),
|
|
1000
|
+
t(e(ge), {
|
|
1001
|
+
icon: "copy",
|
|
1002
|
+
title: e(o)("panel.copy"),
|
|
1003
|
+
onClick: n[0] || (n[0] = (f) => l(m.value))
|
|
1004
|
+
}, null, 8, ["title"])
|
|
1005
|
+
])
|
|
1006
|
+
]),
|
|
1007
|
+
_: 1
|
|
1008
|
+
}, 8, ["title"]),
|
|
1009
|
+
t(e(ee), {
|
|
1010
|
+
title: e(o)("panel.embed-block")
|
|
1011
|
+
}, {
|
|
1012
|
+
default: a(() => [
|
|
1013
|
+
t(e(Z), {
|
|
1014
|
+
size: "sm",
|
|
1015
|
+
tone: "muted"
|
|
1016
|
+
}, {
|
|
1017
|
+
default: a(() => [
|
|
1018
|
+
_(b(e(o)("panel.embed-block-help")), 1)
|
|
1019
|
+
]),
|
|
1020
|
+
_: 1
|
|
1021
|
+
}),
|
|
1022
|
+
P("div", Nl, [
|
|
1023
|
+
P("code", null, b(s.value), 1),
|
|
1024
|
+
t(e(ge), {
|
|
1025
|
+
icon: "copy",
|
|
1026
|
+
title: e(o)("panel.copy"),
|
|
1027
|
+
onClick: n[1] || (n[1] = (f) => l(s.value))
|
|
1028
|
+
}, null, 8, ["title"])
|
|
1029
|
+
])
|
|
1030
|
+
]),
|
|
1031
|
+
_: 1
|
|
1032
|
+
}, 8, ["title"]),
|
|
1033
|
+
t(e(ee), {
|
|
1034
|
+
title: e(o)("panel.embed-names")
|
|
1035
|
+
}, {
|
|
1036
|
+
default: a(() => [
|
|
1037
|
+
t(e(Z), {
|
|
1038
|
+
size: "sm",
|
|
1039
|
+
tone: "muted"
|
|
1040
|
+
}, {
|
|
1041
|
+
default: a(() => [
|
|
1042
|
+
_(b(e(o)("panel.embed-names-help")), 1)
|
|
1043
|
+
]),
|
|
1044
|
+
_: 1
|
|
1045
|
+
}),
|
|
1046
|
+
t(e(Ye), {
|
|
1047
|
+
data: c.value,
|
|
1048
|
+
columns: p.value,
|
|
1049
|
+
"row-key": "id",
|
|
1050
|
+
flush: "",
|
|
1051
|
+
"empty-text": e(o)("fields.no-fields")
|
|
1052
|
+
}, {
|
|
1053
|
+
"cell-key": a(({ row: f }) => [
|
|
1054
|
+
t(e(Z), {
|
|
1055
|
+
mono: "",
|
|
1056
|
+
size: "sm"
|
|
1057
|
+
}, {
|
|
1058
|
+
default: a(() => [
|
|
1059
|
+
_("fields[" + b(f.key) + "]", 1)
|
|
1060
|
+
]),
|
|
1061
|
+
_: 2
|
|
1062
|
+
}, 1024)
|
|
1063
|
+
]),
|
|
1064
|
+
"cell-title": a(({ row: f }) => [
|
|
1065
|
+
_(b(Object.values(f.title)[0] ?? f.key), 1)
|
|
1066
|
+
]),
|
|
1067
|
+
"cell-type": a(({ row: f }) => [
|
|
1068
|
+
_(b(e(o)(`fields.type-${f.type}`)), 1)
|
|
1069
|
+
]),
|
|
1070
|
+
_: 1
|
|
1071
|
+
}, 8, ["data", "columns", "empty-text"])
|
|
1072
|
+
]),
|
|
1073
|
+
_: 1
|
|
1074
|
+
}, 8, ["title"])
|
|
1075
|
+
]));
|
|
1076
|
+
}
|
|
1077
|
+
}), Ml = /* @__PURE__ */ oe(Il, [["__scopeId", "data-v-fdabb537"]]), Dl = { class: "wx-inbox-general" }, Ll = /* @__PURE__ */ le({
|
|
1078
|
+
__name: "FormGeneral",
|
|
1079
|
+
props: /* @__PURE__ */ We({
|
|
1080
|
+
errors: {}
|
|
1081
|
+
}, {
|
|
1082
|
+
settings: { required: !0 },
|
|
1083
|
+
settingsModifiers: {},
|
|
1084
|
+
options: { required: !0 },
|
|
1085
|
+
optionsModifiers: {}
|
|
1086
|
+
}),
|
|
1087
|
+
emits: ["update:settings", "update:options"],
|
|
1088
|
+
setup(r) {
|
|
1089
|
+
const i = _e(
|
|
1090
|
+
r,
|
|
1091
|
+
"settings"
|
|
1092
|
+
), o = _e(r, "options"), m = ae("webx-inbox"), s = de(o, "thank-you.heading", {}), p = de(o, "thank-you.text", {}), c = de(o, "design.submit-text", {}), l = de(o, "redirect", "");
|
|
1093
|
+
return (S, n) => (u(), K("div", Dl, [
|
|
1094
|
+
t(e(ee), null, {
|
|
1095
|
+
default: a(() => [
|
|
1096
|
+
t(e(R), {
|
|
1097
|
+
label: e(m)("panel.title"),
|
|
1098
|
+
error: r.errors.title?.[0],
|
|
1099
|
+
required: ""
|
|
1100
|
+
}, {
|
|
1101
|
+
default: a(() => [
|
|
1102
|
+
t(e(J), {
|
|
1103
|
+
modelValue: i.value.title,
|
|
1104
|
+
"onUpdate:modelValue": n[0] || (n[0] = (f) => i.value.title = f),
|
|
1105
|
+
localized: ""
|
|
1106
|
+
}, null, 8, ["modelValue"])
|
|
1107
|
+
]),
|
|
1108
|
+
_: 1
|
|
1109
|
+
}, 8, ["label", "error"]),
|
|
1110
|
+
t(e(R), {
|
|
1111
|
+
label: e(m)("panel.slug"),
|
|
1112
|
+
help: e(m)("panel.slug-help"),
|
|
1113
|
+
error: r.errors.slug?.[0],
|
|
1114
|
+
required: ""
|
|
1115
|
+
}, {
|
|
1116
|
+
default: a(() => [
|
|
1117
|
+
t(e(J), {
|
|
1118
|
+
modelValue: i.value.slug,
|
|
1119
|
+
"onUpdate:modelValue": n[1] || (n[1] = (f) => i.value.slug = f),
|
|
1120
|
+
placeholder: "contact"
|
|
1121
|
+
}, null, 8, ["modelValue"])
|
|
1122
|
+
]),
|
|
1123
|
+
_: 1
|
|
1124
|
+
}, 8, ["label", "help", "error"]),
|
|
1125
|
+
t(e(R), {
|
|
1126
|
+
label: e(m)("panel.is-enabled"),
|
|
1127
|
+
help: e(m)("panel.is-enabled-help")
|
|
1128
|
+
}, {
|
|
1129
|
+
default: a(() => [
|
|
1130
|
+
t(e(Qe), {
|
|
1131
|
+
modelValue: i.value.is_enabled,
|
|
1132
|
+
"onUpdate:modelValue": n[2] || (n[2] = (f) => i.value.is_enabled = f)
|
|
1133
|
+
}, null, 8, ["modelValue"])
|
|
1134
|
+
]),
|
|
1135
|
+
_: 1
|
|
1136
|
+
}, 8, ["label", "help"])
|
|
1137
|
+
]),
|
|
1138
|
+
_: 1
|
|
1139
|
+
}),
|
|
1140
|
+
t(e(ee), {
|
|
1141
|
+
title: e(m)("panel.after-sending")
|
|
1142
|
+
}, {
|
|
1143
|
+
default: a(() => [
|
|
1144
|
+
t(e(R), {
|
|
1145
|
+
label: e(m)("panel.submit-text")
|
|
1146
|
+
}, {
|
|
1147
|
+
default: a(() => [
|
|
1148
|
+
t(e(J), {
|
|
1149
|
+
modelValue: e(c),
|
|
1150
|
+
"onUpdate:modelValue": n[3] || (n[3] = (f) => te(c) ? c.value = f : null),
|
|
1151
|
+
localized: ""
|
|
1152
|
+
}, null, 8, ["modelValue"])
|
|
1153
|
+
]),
|
|
1154
|
+
_: 1
|
|
1155
|
+
}, 8, ["label"]),
|
|
1156
|
+
t(e(R), {
|
|
1157
|
+
label: e(m)("panel.thank-you-heading")
|
|
1158
|
+
}, {
|
|
1159
|
+
default: a(() => [
|
|
1160
|
+
t(e(J), {
|
|
1161
|
+
modelValue: e(s),
|
|
1162
|
+
"onUpdate:modelValue": n[4] || (n[4] = (f) => te(s) ? s.value = f : null),
|
|
1163
|
+
localized: ""
|
|
1164
|
+
}, null, 8, ["modelValue"])
|
|
1165
|
+
]),
|
|
1166
|
+
_: 1
|
|
1167
|
+
}, 8, ["label"]),
|
|
1168
|
+
t(e(R), {
|
|
1169
|
+
label: e(m)("panel.thank-you-text")
|
|
1170
|
+
}, {
|
|
1171
|
+
default: a(() => [
|
|
1172
|
+
t(el, {
|
|
1173
|
+
modelValue: e(p),
|
|
1174
|
+
"onUpdate:modelValue": n[5] || (n[5] = (f) => te(p) ? p.value = f : null)
|
|
1175
|
+
}, null, 8, ["modelValue"])
|
|
1176
|
+
]),
|
|
1177
|
+
_: 1
|
|
1178
|
+
}, 8, ["label"]),
|
|
1179
|
+
t(e(R), {
|
|
1180
|
+
label: e(m)("panel.redirect"),
|
|
1181
|
+
help: e(m)("panel.redirect-help")
|
|
1182
|
+
}, {
|
|
1183
|
+
default: a(() => [
|
|
1184
|
+
t(e(J), {
|
|
1185
|
+
modelValue: e(l),
|
|
1186
|
+
"onUpdate:modelValue": n[6] || (n[6] = (f) => te(l) ? l.value = f : null),
|
|
1187
|
+
placeholder: "/thank-you"
|
|
1188
|
+
}, null, 8, ["modelValue"])
|
|
1189
|
+
]),
|
|
1190
|
+
_: 1
|
|
1191
|
+
}, 8, ["label", "help"])
|
|
1192
|
+
]),
|
|
1193
|
+
_: 1
|
|
1194
|
+
}, 8, ["title"])
|
|
1195
|
+
]));
|
|
1196
|
+
}
|
|
1197
|
+
}), Ol = /* @__PURE__ */ oe(Ll, [["__scopeId", "data-v-35e56e3d"]]), Pl = { class: "wx-inbox-recipients" }, Bl = /* @__PURE__ */ le({
|
|
1198
|
+
__name: "FormNotifications",
|
|
1199
|
+
props: /* @__PURE__ */ We({
|
|
1200
|
+
fields: {},
|
|
1201
|
+
errors: {}
|
|
1202
|
+
}, {
|
|
1203
|
+
modelValue: { required: !0 },
|
|
1204
|
+
modelModifiers: {}
|
|
1205
|
+
}),
|
|
1206
|
+
emits: ["update:modelValue"],
|
|
1207
|
+
setup(r) {
|
|
1208
|
+
const i = r, o = _e(r, "modelValue"), m = se(), s = ie(m), p = ae("webx-inbox"), c = q([]), l = de(o, "recipients", []), S = de(o, "email_field", "");
|
|
1209
|
+
ll(async () => {
|
|
1210
|
+
try {
|
|
1211
|
+
c.value = await s.recipients();
|
|
1212
|
+
} catch {
|
|
1213
|
+
}
|
|
1214
|
+
});
|
|
1215
|
+
const n = I(
|
|
1216
|
+
() => c.value.map((d) => ({ value: d.id, label: `${d.name} · ${d.email}` }))
|
|
1217
|
+
), f = I(() => [
|
|
1218
|
+
{ value: "", label: p("panel.no-email-field") },
|
|
1219
|
+
...i.fields.filter((d) => d.type === "email").map((d) => ({ value: d.key, label: d.key }))
|
|
1220
|
+
]);
|
|
1221
|
+
function M(d) {
|
|
1222
|
+
return "admin_id" in d;
|
|
1223
|
+
}
|
|
1224
|
+
function C(d) {
|
|
1225
|
+
l.value = [...l.value, d];
|
|
1226
|
+
}
|
|
1227
|
+
function T(d) {
|
|
1228
|
+
l.value = l.value.filter((y, w) => w !== d);
|
|
1229
|
+
}
|
|
1230
|
+
function U(d, y) {
|
|
1231
|
+
l.value = l.value.map((w, F) => F === d ? { admin_id: y } : w);
|
|
1232
|
+
}
|
|
1233
|
+
function A(d, y) {
|
|
1234
|
+
l.value = l.value.map((w, F) => F === d ? { email: y } : w);
|
|
1235
|
+
}
|
|
1236
|
+
return (d, y) => (u(), h(e(ee), {
|
|
1237
|
+
title: e(p)("panel.recipients")
|
|
1238
|
+
}, {
|
|
1239
|
+
default: a(() => [
|
|
1240
|
+
t(e(Z), {
|
|
1241
|
+
size: "sm",
|
|
1242
|
+
tone: "muted"
|
|
1243
|
+
}, {
|
|
1244
|
+
default: a(() => [
|
|
1245
|
+
_(b(e(p)("panel.recipients-help")), 1)
|
|
1246
|
+
]),
|
|
1247
|
+
_: 1
|
|
1248
|
+
}),
|
|
1249
|
+
r.errors["options.recipients"] ? (u(), h(e(Fe), {
|
|
1250
|
+
key: 0,
|
|
1251
|
+
type: "danger",
|
|
1252
|
+
variant: "soft",
|
|
1253
|
+
description: r.errors["options.recipients"]?.[0]
|
|
1254
|
+
}, null, 8, ["description"])) : O("", !0),
|
|
1255
|
+
P("div", Pl, [
|
|
1256
|
+
e(l).length === 0 ? (u(), h(e(Z), {
|
|
1257
|
+
key: 0,
|
|
1258
|
+
size: "sm",
|
|
1259
|
+
tone: "placeholder"
|
|
1260
|
+
}, {
|
|
1261
|
+
default: a(() => [
|
|
1262
|
+
_(b(e(p)("panel.no-recipients")), 1)
|
|
1263
|
+
]),
|
|
1264
|
+
_: 1
|
|
1265
|
+
})) : O("", !0),
|
|
1266
|
+
(u(!0), K(X, null, ye(e(l), (w, F) => (u(), K("div", {
|
|
1267
|
+
key: F,
|
|
1268
|
+
class: "wx-inbox-recipients__row"
|
|
1269
|
+
}, [
|
|
1270
|
+
M(w) ? (u(), h(e(ve), {
|
|
1271
|
+
key: 0,
|
|
1272
|
+
"model-value": w.admin_id,
|
|
1273
|
+
options: n.value,
|
|
1274
|
+
"onUpdate:modelValue": (W) => U(F, Number(W))
|
|
1275
|
+
}, null, 8, ["model-value", "options", "onUpdate:modelValue"])) : (u(), h(e(J), {
|
|
1276
|
+
key: 1,
|
|
1277
|
+
"model-value": w.email,
|
|
1278
|
+
type: "email",
|
|
1279
|
+
placeholder: "sales@example.com",
|
|
1280
|
+
"onUpdate:modelValue": (W) => A(F, String(W))
|
|
1281
|
+
}, null, 8, ["model-value", "onUpdate:modelValue"])),
|
|
1282
|
+
t(e(ge), {
|
|
1283
|
+
icon: "trash",
|
|
1284
|
+
title: e(p)("panel.remove"),
|
|
1285
|
+
onClick: (W) => T(F)
|
|
1286
|
+
}, null, 8, ["title", "onClick"])
|
|
1287
|
+
]))), 128))
|
|
1288
|
+
]),
|
|
1289
|
+
t(e(Ce), { size: "sm" }, {
|
|
1290
|
+
default: a(() => [
|
|
1291
|
+
t(e(Y), {
|
|
1292
|
+
variant: "outline",
|
|
1293
|
+
icon: "user",
|
|
1294
|
+
disabled: n.value.length === 0,
|
|
1295
|
+
onClick: y[0] || (y[0] = (w) => C({ admin_id: Number(n.value[0]?.value) }))
|
|
1296
|
+
}, {
|
|
1297
|
+
default: a(() => [
|
|
1298
|
+
_(b(e(p)("panel.add-admin")), 1)
|
|
1299
|
+
]),
|
|
1300
|
+
_: 1
|
|
1301
|
+
}, 8, ["disabled"]),
|
|
1302
|
+
t(e(Y), {
|
|
1303
|
+
variant: "outline",
|
|
1304
|
+
icon: "mail",
|
|
1305
|
+
onClick: y[1] || (y[1] = (w) => C({ email: "" }))
|
|
1306
|
+
}, {
|
|
1307
|
+
default: a(() => [
|
|
1308
|
+
_(b(e(p)("panel.add-email")), 1)
|
|
1309
|
+
]),
|
|
1310
|
+
_: 1
|
|
1311
|
+
})
|
|
1312
|
+
]),
|
|
1313
|
+
_: 1
|
|
1314
|
+
}),
|
|
1315
|
+
t(e(R), {
|
|
1316
|
+
label: e(p)("panel.email-field"),
|
|
1317
|
+
help: e(p)("panel.email-field-help")
|
|
1318
|
+
}, {
|
|
1319
|
+
default: a(() => [
|
|
1320
|
+
t(e(ve), {
|
|
1321
|
+
modelValue: e(S),
|
|
1322
|
+
"onUpdate:modelValue": y[2] || (y[2] = (w) => te(S) ? S.value = w : null),
|
|
1323
|
+
options: f.value
|
|
1324
|
+
}, null, 8, ["modelValue", "options"])
|
|
1325
|
+
]),
|
|
1326
|
+
_: 1
|
|
1327
|
+
}, 8, ["label", "help"])
|
|
1328
|
+
]),
|
|
1329
|
+
_: 1
|
|
1330
|
+
}, 8, ["title"]));
|
|
1331
|
+
}
|
|
1332
|
+
}), El = /* @__PURE__ */ oe(Bl, [["__scopeId", "data-v-48ebf651"]]), Rl = {
|
|
1333
|
+
class: "wx-inbox-editor",
|
|
1334
|
+
"data-wx-fill": ""
|
|
1335
|
+
}, Hl = { class: "wx-inbox-editor__head" }, Gl = { class: "wx-inbox-editor__id" }, jl = { class: "wx-inbox-editor__title" }, Kl = /* @__PURE__ */ le({
|
|
1336
|
+
__name: "FormEditorPage",
|
|
1337
|
+
props: {
|
|
1338
|
+
base: { default: "/inbox" }
|
|
1339
|
+
},
|
|
1340
|
+
setup(r) {
|
|
1341
|
+
const i = r, o = se(), m = ie(o), s = qe(), p = Ae(), c = be();
|
|
1342
|
+
ue();
|
|
1343
|
+
const l = ae("webx-inbox"), S = ce(), n = q(null), f = q([]), M = q(!0), C = q(!1), T = q({});
|
|
1344
|
+
let U = tl({
|
|
1345
|
+
slug: "",
|
|
1346
|
+
title: {},
|
|
1347
|
+
is_enabled: !0
|
|
1348
|
+
});
|
|
1349
|
+
const A = q({}), d = I(() => o.can("inbox.manage")), y = I(() => Number(s.params.id)), w = I(
|
|
1350
|
+
() => n.value === null ? "" : re(U.title, c.active.value, U.slug)
|
|
1351
|
+
), F = I(() => `${i.base}?form=${y.value}`);
|
|
1352
|
+
async function W() {
|
|
1353
|
+
M.value = !0;
|
|
1354
|
+
try {
|
|
1355
|
+
const D = await m.form(y.value);
|
|
1356
|
+
n.value = D, f.value = D.fields ?? [], U.slug = D.slug, U.title = { ...D.title }, U.is_enabled = D.is_enabled, A.value = { ...D.options };
|
|
1357
|
+
} catch (D) {
|
|
1358
|
+
B.danger(S(D)), p.replace(i.base);
|
|
1359
|
+
} finally {
|
|
1360
|
+
M.value = !1;
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
ke(y, () => {
|
|
1364
|
+
W();
|
|
1365
|
+
}, { immediate: !0 });
|
|
1366
|
+
async function H() {
|
|
1367
|
+
C.value = !0, T.value = {};
|
|
1368
|
+
try {
|
|
1369
|
+
const D = await m.saveForm(y.value, {
|
|
1370
|
+
slug: U.slug.trim(),
|
|
1371
|
+
title: U.title,
|
|
1372
|
+
is_enabled: U.is_enabled,
|
|
1373
|
+
options: A.value
|
|
1374
|
+
});
|
|
1375
|
+
n.value = D, B.success(l("panel.saved"));
|
|
1376
|
+
} catch (D) {
|
|
1377
|
+
const N = D.body;
|
|
1378
|
+
N?.errors ? (T.value = N.errors, B.danger(l("panel.failed"))) : B.danger(S(D));
|
|
1379
|
+
} finally {
|
|
1380
|
+
C.value = !1;
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
return (D, N) => (u(), K("div", Rl, [
|
|
1384
|
+
M.value ? (u(), h(e(De), {
|
|
1385
|
+
key: 0,
|
|
1386
|
+
title: "",
|
|
1387
|
+
rows: 8
|
|
1388
|
+
})) : n.value ? (u(), K(X, { key: 1 }, [
|
|
1389
|
+
P("div", Hl, [
|
|
1390
|
+
t(e(Ee), {
|
|
1391
|
+
to: F.value,
|
|
1392
|
+
label: e(l)("panel.forms")
|
|
1393
|
+
}, null, 8, ["to", "label"]),
|
|
1394
|
+
P("div", Gl, [
|
|
1395
|
+
P("h1", jl, b(w.value), 1),
|
|
1396
|
+
t(e(Z), {
|
|
1397
|
+
size: "sm",
|
|
1398
|
+
tone: "muted",
|
|
1399
|
+
mono: ""
|
|
1400
|
+
}, {
|
|
1401
|
+
default: a(() => [
|
|
1402
|
+
_(b(n.value.slug), 1)
|
|
1403
|
+
]),
|
|
1404
|
+
_: 1
|
|
1405
|
+
})
|
|
1406
|
+
]),
|
|
1407
|
+
e(U).is_enabled ? O("", !0) : (u(), h(e(xe), {
|
|
1408
|
+
key: 0,
|
|
1409
|
+
type: "default"
|
|
1410
|
+
}, {
|
|
1411
|
+
default: a(() => [
|
|
1412
|
+
_(b(e(l)("panel.off")), 1)
|
|
1413
|
+
]),
|
|
1414
|
+
_: 1
|
|
1415
|
+
}))
|
|
1416
|
+
]),
|
|
1417
|
+
t(e(Je), {
|
|
1418
|
+
class: "wx-inbox-editor__tabs",
|
|
1419
|
+
"keep-alive": ""
|
|
1420
|
+
}, {
|
|
1421
|
+
default: a(() => [
|
|
1422
|
+
t(e(Ue), {
|
|
1423
|
+
value: "general",
|
|
1424
|
+
label: e(l)("panel.tab-general")
|
|
1425
|
+
}, {
|
|
1426
|
+
default: a(() => [
|
|
1427
|
+
t(Ol, {
|
|
1428
|
+
settings: e(U),
|
|
1429
|
+
"onUpdate:settings": N[0] || (N[0] = (L) => te(U) ? U.value = L : U = L),
|
|
1430
|
+
options: A.value,
|
|
1431
|
+
"onUpdate:options": N[1] || (N[1] = (L) => A.value = L),
|
|
1432
|
+
errors: T.value
|
|
1433
|
+
}, null, 8, ["settings", "options", "errors"])
|
|
1434
|
+
]),
|
|
1435
|
+
_: 1
|
|
1436
|
+
}, 8, ["label"]),
|
|
1437
|
+
t(e(Ue), {
|
|
1438
|
+
value: "fields",
|
|
1439
|
+
label: e(l)("panel.tab-fields")
|
|
1440
|
+
}, {
|
|
1441
|
+
default: a(() => [
|
|
1442
|
+
t(Fl, {
|
|
1443
|
+
modelValue: f.value,
|
|
1444
|
+
"onUpdate:modelValue": N[2] || (N[2] = (L) => f.value = L),
|
|
1445
|
+
form: n.value,
|
|
1446
|
+
"can-manage": d.value
|
|
1447
|
+
}, null, 8, ["modelValue", "form", "can-manage"])
|
|
1448
|
+
]),
|
|
1449
|
+
_: 1
|
|
1450
|
+
}, 8, ["label"]),
|
|
1451
|
+
t(e(Ue), {
|
|
1452
|
+
value: "notifications",
|
|
1453
|
+
label: e(l)("panel.tab-notifications")
|
|
1454
|
+
}, {
|
|
1455
|
+
default: a(() => [
|
|
1456
|
+
t(El, {
|
|
1457
|
+
modelValue: A.value,
|
|
1458
|
+
"onUpdate:modelValue": N[3] || (N[3] = (L) => A.value = L),
|
|
1459
|
+
fields: f.value,
|
|
1460
|
+
errors: T.value
|
|
1461
|
+
}, null, 8, ["modelValue", "fields", "errors"])
|
|
1462
|
+
]),
|
|
1463
|
+
_: 1
|
|
1464
|
+
}, 8, ["label"]),
|
|
1465
|
+
t(e(Ue), {
|
|
1466
|
+
value: "antispam",
|
|
1467
|
+
label: e(l)("panel.tab-antispam")
|
|
1468
|
+
}, {
|
|
1469
|
+
default: a(() => [
|
|
1470
|
+
t(Wl, {
|
|
1471
|
+
modelValue: A.value,
|
|
1472
|
+
"onUpdate:modelValue": N[4] || (N[4] = (L) => A.value = L)
|
|
1473
|
+
}, null, 8, ["modelValue"])
|
|
1474
|
+
]),
|
|
1475
|
+
_: 1
|
|
1476
|
+
}, 8, ["label"]),
|
|
1477
|
+
t(e(Ue), {
|
|
1478
|
+
value: "embed",
|
|
1479
|
+
label: e(l)("panel.tab-embed")
|
|
1480
|
+
}, {
|
|
1481
|
+
default: a(() => [
|
|
1482
|
+
t(Ml, {
|
|
1483
|
+
form: n.value,
|
|
1484
|
+
slug: e(U).slug,
|
|
1485
|
+
fields: f.value
|
|
1486
|
+
}, null, 8, ["form", "slug", "fields"])
|
|
1487
|
+
]),
|
|
1488
|
+
_: 1
|
|
1489
|
+
}, 8, ["label"])
|
|
1490
|
+
]),
|
|
1491
|
+
_: 1
|
|
1492
|
+
}),
|
|
1493
|
+
d.value ? (u(), h(e(il), { key: 0 }, {
|
|
1494
|
+
default: a(() => [
|
|
1495
|
+
t(e(Y), {
|
|
1496
|
+
type: "primary",
|
|
1497
|
+
loading: C.value,
|
|
1498
|
+
onClick: H
|
|
1499
|
+
}, {
|
|
1500
|
+
default: a(() => [
|
|
1501
|
+
_(b(e(l)("panel.save")), 1)
|
|
1502
|
+
]),
|
|
1503
|
+
_: 1
|
|
1504
|
+
}, 8, ["loading"])
|
|
1505
|
+
]),
|
|
1506
|
+
_: 1
|
|
1507
|
+
})) : O("", !0)
|
|
1508
|
+
], 64)) : O("", !0)
|
|
1509
|
+
]));
|
|
1510
|
+
}
|
|
1511
|
+
}), Zl = /* @__PURE__ */ oe(Kl, [["__scopeId", "data-v-194b4a47"]]), Ql = { class: "wx-inbox-create" }, Yl = /* @__PURE__ */ le({
|
|
1512
|
+
__name: "FormCreateDialog",
|
|
1513
|
+
setup(r) {
|
|
1514
|
+
const { resolve: i, dismiss: o, open: m } = Ne(), s = se(), p = ie(s);
|
|
1515
|
+
ue();
|
|
1516
|
+
const c = ae("webx-inbox"), l = ce(), S = q({}), n = q(""), f = q(!1), M = q({});
|
|
1517
|
+
function C(U) {
|
|
1518
|
+
return M.value[U]?.[0];
|
|
1519
|
+
}
|
|
1520
|
+
async function T() {
|
|
1521
|
+
f.value = !0, M.value = {};
|
|
1522
|
+
try {
|
|
1523
|
+
i(
|
|
1524
|
+
await p.createForm({
|
|
1525
|
+
title: S.value,
|
|
1526
|
+
slug: n.value.trim(),
|
|
1527
|
+
is_enabled: !0,
|
|
1528
|
+
options: {}
|
|
1529
|
+
})
|
|
1530
|
+
);
|
|
1531
|
+
} catch (U) {
|
|
1532
|
+
const A = U.body;
|
|
1533
|
+
A?.errors ? (M.value = A.errors, B.danger(c("panel.failed"))) : B.danger(l(U));
|
|
1534
|
+
} finally {
|
|
1535
|
+
f.value = !1;
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
return (U, A) => (u(), h(e(Ie), {
|
|
1539
|
+
open: e(m),
|
|
1540
|
+
"onUpdate:open": A[3] || (A[3] = (d) => te(m) ? m.value = d : null),
|
|
1541
|
+
title: e(c)("panel.new-form-title"),
|
|
1542
|
+
width: 520
|
|
1543
|
+
}, {
|
|
1544
|
+
footer: a(() => [
|
|
1545
|
+
t(e(Ce), { size: "sm" }, {
|
|
1546
|
+
default: a(() => [
|
|
1547
|
+
t(e(Y), {
|
|
1548
|
+
variant: "outline",
|
|
1549
|
+
onClick: A[2] || (A[2] = (d) => e(o)())
|
|
1550
|
+
}, {
|
|
1551
|
+
default: a(() => [
|
|
1552
|
+
_(b(e(c)("panel.cancel")), 1)
|
|
1553
|
+
]),
|
|
1554
|
+
_: 1
|
|
1555
|
+
}),
|
|
1556
|
+
t(e(Y), {
|
|
1557
|
+
type: "primary",
|
|
1558
|
+
loading: f.value,
|
|
1559
|
+
onClick: T
|
|
1560
|
+
}, {
|
|
1561
|
+
default: a(() => [
|
|
1562
|
+
_(b(e(c)("panel.save")), 1)
|
|
1563
|
+
]),
|
|
1564
|
+
_: 1
|
|
1565
|
+
}, 8, ["loading"])
|
|
1566
|
+
]),
|
|
1567
|
+
_: 1
|
|
1568
|
+
})
|
|
1569
|
+
]),
|
|
1570
|
+
default: a(() => [
|
|
1571
|
+
P("div", Ql, [
|
|
1572
|
+
t(e(R), {
|
|
1573
|
+
label: e(c)("panel.title"),
|
|
1574
|
+
error: C("title"),
|
|
1575
|
+
required: ""
|
|
1576
|
+
}, {
|
|
1577
|
+
default: a(() => [
|
|
1578
|
+
t(e(J), {
|
|
1579
|
+
modelValue: S.value,
|
|
1580
|
+
"onUpdate:modelValue": A[0] || (A[0] = (d) => S.value = d),
|
|
1581
|
+
localized: "",
|
|
1582
|
+
autofocus: ""
|
|
1583
|
+
}, null, 8, ["modelValue"])
|
|
1584
|
+
]),
|
|
1585
|
+
_: 1
|
|
1586
|
+
}, 8, ["label", "error"]),
|
|
1587
|
+
t(e(R), {
|
|
1588
|
+
label: e(c)("panel.slug"),
|
|
1589
|
+
help: e(c)("panel.slug-help"),
|
|
1590
|
+
error: C("slug")
|
|
1591
|
+
}, {
|
|
1592
|
+
default: a(() => [
|
|
1593
|
+
t(e(J), {
|
|
1594
|
+
modelValue: n.value,
|
|
1595
|
+
"onUpdate:modelValue": A[1] || (A[1] = (d) => n.value = d),
|
|
1596
|
+
placeholder: "contact"
|
|
1597
|
+
}, null, 8, ["modelValue"])
|
|
1598
|
+
]),
|
|
1599
|
+
_: 1
|
|
1600
|
+
}, 8, ["label", "help", "error"])
|
|
1601
|
+
])
|
|
1602
|
+
]),
|
|
1603
|
+
_: 1
|
|
1604
|
+
}, 8, ["open", "title"]));
|
|
1605
|
+
}
|
|
1606
|
+
}), Jl = /* @__PURE__ */ oe(Yl, [["__scopeId", "data-v-55fb40d8"]]), Xl = { class: "wx-inbox-by-hand" }, et = /* @__PURE__ */ le({
|
|
1607
|
+
__name: "SubmissionCreateDialog",
|
|
1608
|
+
props: {
|
|
1609
|
+
form: {}
|
|
1610
|
+
},
|
|
1611
|
+
setup(r) {
|
|
1612
|
+
const i = r, { resolve: o, dismiss: m, open: s } = Ne(), p = se(), c = ie(p), l = be();
|
|
1613
|
+
ue();
|
|
1614
|
+
const S = ae("webx-inbox"), n = ce(), f = q([]), M = q(!0), C = q(!1), T = q({}), U = q({}), A = I(() => f.value.filter((N) => N.type !== "file")), d = I(() => f.value.some((N) => N.type === "file"));
|
|
1615
|
+
function y(N) {
|
|
1616
|
+
return U.value[`fields.${N.key}`]?.[0];
|
|
1617
|
+
}
|
|
1618
|
+
function w(N) {
|
|
1619
|
+
return re(N.title, l.active.value, N.key);
|
|
1620
|
+
}
|
|
1621
|
+
function F(N, L = "") {
|
|
1622
|
+
return re(
|
|
1623
|
+
N,
|
|
1624
|
+
l.active.value,
|
|
1625
|
+
L
|
|
1626
|
+
);
|
|
1627
|
+
}
|
|
1628
|
+
function W(N) {
|
|
1629
|
+
return (N.options.choices ?? []).map((L) => ({
|
|
1630
|
+
value: L.value,
|
|
1631
|
+
label: F(L.label, L.value)
|
|
1632
|
+
}));
|
|
1633
|
+
}
|
|
1634
|
+
async function H() {
|
|
1635
|
+
try {
|
|
1636
|
+
const N = await c.form(i.form.id);
|
|
1637
|
+
f.value = (N.fields ?? []).filter((L) => L.is_enabled);
|
|
1638
|
+
for (const L of f.value)
|
|
1639
|
+
T.value[L.key] = L.type === "checkbox" ? [] : L.type === "consent" ? !1 : "";
|
|
1640
|
+
} catch (N) {
|
|
1641
|
+
B.danger(n(N));
|
|
1642
|
+
} finally {
|
|
1643
|
+
M.value = !1;
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
H();
|
|
1647
|
+
async function D() {
|
|
1648
|
+
C.value = !0, U.value = {};
|
|
1649
|
+
try {
|
|
1650
|
+
o(await c.createSubmission(i.form.id, T.value));
|
|
1651
|
+
} catch (N) {
|
|
1652
|
+
const L = N.body;
|
|
1653
|
+
L?.errors ? (U.value = L.errors, B.danger(S("panel.failed"))) : B.danger(n(N));
|
|
1654
|
+
} finally {
|
|
1655
|
+
C.value = !1;
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
return (N, L) => (u(), h(e(Ie), {
|
|
1659
|
+
open: e(s),
|
|
1660
|
+
"onUpdate:open": L[1] || (L[1] = (x) => te(s) ? s.value = x : null),
|
|
1661
|
+
title: e(S)("panel.new-submission-title"),
|
|
1662
|
+
width: 560
|
|
1663
|
+
}, {
|
|
1664
|
+
footer: a(() => [
|
|
1665
|
+
t(e(Ce), { size: "sm" }, {
|
|
1666
|
+
default: a(() => [
|
|
1667
|
+
t(e(Y), {
|
|
1668
|
+
variant: "outline",
|
|
1669
|
+
onClick: L[0] || (L[0] = (x) => e(m)())
|
|
1670
|
+
}, {
|
|
1671
|
+
default: a(() => [
|
|
1672
|
+
_(b(e(S)("panel.cancel")), 1)
|
|
1673
|
+
]),
|
|
1674
|
+
_: 1
|
|
1675
|
+
}),
|
|
1676
|
+
t(e(Y), {
|
|
1677
|
+
type: "primary",
|
|
1678
|
+
loading: C.value,
|
|
1679
|
+
disabled: M.value,
|
|
1680
|
+
onClick: D
|
|
1681
|
+
}, {
|
|
1682
|
+
default: a(() => [
|
|
1683
|
+
_(b(e(S)("panel.save")), 1)
|
|
1684
|
+
]),
|
|
1685
|
+
_: 1
|
|
1686
|
+
}, 8, ["loading", "disabled"])
|
|
1687
|
+
]),
|
|
1688
|
+
_: 1
|
|
1689
|
+
})
|
|
1690
|
+
]),
|
|
1691
|
+
default: a(() => [
|
|
1692
|
+
P("div", Xl, [
|
|
1693
|
+
t(e(Fe), {
|
|
1694
|
+
type: "info",
|
|
1695
|
+
closable: !1
|
|
1696
|
+
}, {
|
|
1697
|
+
default: a(() => [
|
|
1698
|
+
_(b(e(S)("panel.new-submission-help")), 1)
|
|
1699
|
+
]),
|
|
1700
|
+
_: 1
|
|
1701
|
+
}),
|
|
1702
|
+
M.value ? (u(), h(e(De), {
|
|
1703
|
+
key: 0,
|
|
1704
|
+
rows: 4
|
|
1705
|
+
})) : (u(), K(X, { key: 1 }, [
|
|
1706
|
+
(u(!0), K(X, null, ye(A.value, (x) => (u(), h(e(R), {
|
|
1707
|
+
key: x.id,
|
|
1708
|
+
label: w(x),
|
|
1709
|
+
help: F(x.help),
|
|
1710
|
+
error: y(x),
|
|
1711
|
+
required: x.is_required
|
|
1712
|
+
}, {
|
|
1713
|
+
default: a(() => [
|
|
1714
|
+
x.type === "textarea" ? (u(), h(e(ul), {
|
|
1715
|
+
key: 0,
|
|
1716
|
+
modelValue: T.value[x.key],
|
|
1717
|
+
"onUpdate:modelValue": (V) => T.value[x.key] = V,
|
|
1718
|
+
rows: x.options.rows ?? 4,
|
|
1719
|
+
placeholder: F(x.placeholder)
|
|
1720
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "rows", "placeholder"])) : x.type === "select" ? (u(), h(e(ve), {
|
|
1721
|
+
key: 1,
|
|
1722
|
+
modelValue: T.value[x.key],
|
|
1723
|
+
"onUpdate:modelValue": (V) => T.value[x.key] = V,
|
|
1724
|
+
options: W(x),
|
|
1725
|
+
clearable: "",
|
|
1726
|
+
placeholder: F(x.placeholder)
|
|
1727
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "options", "placeholder"])) : x.type === "radio" ? (u(), h(e(dl), {
|
|
1728
|
+
key: 2,
|
|
1729
|
+
modelValue: T.value[x.key],
|
|
1730
|
+
"onUpdate:modelValue": (V) => T.value[x.key] = V,
|
|
1731
|
+
options: W(x)
|
|
1732
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "options"])) : x.type === "checkbox" ? (u(), h(e(rl), {
|
|
1733
|
+
key: 3,
|
|
1734
|
+
modelValue: T.value[x.key],
|
|
1735
|
+
"onUpdate:modelValue": (V) => T.value[x.key] = V,
|
|
1736
|
+
options: W(x)
|
|
1737
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "options"])) : x.type === "consent" ? (u(), h(e(me), {
|
|
1738
|
+
key: 4,
|
|
1739
|
+
modelValue: T.value[x.key],
|
|
1740
|
+
"onUpdate:modelValue": (V) => T.value[x.key] = V,
|
|
1741
|
+
label: F(x.options.text, w(x))
|
|
1742
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "label"])) : x.type === "date" ? (u(), h(e(Be), {
|
|
1743
|
+
key: 5,
|
|
1744
|
+
modelValue: T.value[x.key],
|
|
1745
|
+
"onUpdate:modelValue": (V) => T.value[x.key] = V,
|
|
1746
|
+
placeholder: F(x.placeholder)
|
|
1747
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : (u(), h(e(J), {
|
|
1748
|
+
key: 6,
|
|
1749
|
+
modelValue: T.value[x.key],
|
|
1750
|
+
"onUpdate:modelValue": (V) => T.value[x.key] = V,
|
|
1751
|
+
type: x.type === "email" ? "email" : x.type === "tel" ? "tel" : "text",
|
|
1752
|
+
placeholder: F(x.placeholder),
|
|
1753
|
+
maxlength: x.options.maxlength
|
|
1754
|
+
}, null, 8, ["modelValue", "onUpdate:modelValue", "type", "placeholder", "maxlength"]))
|
|
1755
|
+
]),
|
|
1756
|
+
_: 2
|
|
1757
|
+
}, 1032, ["label", "help", "error", "required"]))), 128)),
|
|
1758
|
+
d.value ? (u(), h(e(Fe), {
|
|
1759
|
+
key: 0,
|
|
1760
|
+
type: "warning",
|
|
1761
|
+
closable: !1
|
|
1762
|
+
}, {
|
|
1763
|
+
default: a(() => [
|
|
1764
|
+
_(b(e(S)("panel.no-files-by-hand")), 1)
|
|
1765
|
+
]),
|
|
1766
|
+
_: 1
|
|
1767
|
+
})) : O("", !0)
|
|
1768
|
+
], 64))
|
|
1769
|
+
])
|
|
1770
|
+
]),
|
|
1771
|
+
_: 1
|
|
1772
|
+
}, 8, ["open", "title"]));
|
|
1773
|
+
}
|
|
1774
|
+
}), lt = /* @__PURE__ */ oe(et, [["__scopeId", "data-v-72006299"]]), tt = { class: "wx-submissions" }, at = { class: "wx-submissions__head" }, nt = { class: "wx-submissions__who" }, st = { class: "wx-submissions__mass" }, ot = { class: "wx-submissions__state" }, it = /* @__PURE__ */ le({
|
|
1775
|
+
__name: "SubmissionList",
|
|
1776
|
+
props: {
|
|
1777
|
+
form: {},
|
|
1778
|
+
base: { default: "/inbox" },
|
|
1779
|
+
inline: { type: Boolean, default: !0 }
|
|
1780
|
+
},
|
|
1781
|
+
emits: ["back", "changed"],
|
|
1782
|
+
setup(r, { emit: i }) {
|
|
1783
|
+
const o = r, m = i, s = se(), p = ie(s), c = qe(), l = Ae(), S = be();
|
|
1784
|
+
ue();
|
|
1785
|
+
const n = ae("webx-inbox"), f = ce(), M = q(null), C = q([]), T = q(!1), U = q([]), A = q(!1), d = I(() => s.can("inbox.update")), y = I(() => s.can("inbox.manage")), w = Me(lt), F = I({
|
|
1786
|
+
get: () => typeof c.query.view == "string" && c.query.view !== "" ? c.query.view : "all",
|
|
1787
|
+
set: (v) => {
|
|
1788
|
+
l.replace({
|
|
1789
|
+
query: { ...c.query, view: v === "all" ? void 0 : v, page: void 0 }
|
|
1790
|
+
});
|
|
1791
|
+
}
|
|
1792
|
+
}), W = I(() => ({
|
|
1793
|
+
view: F.value,
|
|
1794
|
+
search: typeof c.query.search == "string" ? c.query.search : "",
|
|
1795
|
+
assignee: typeof c.query.assignee == "string" ? c.query.assignee : null,
|
|
1796
|
+
sort: typeof c.query.sort == "string" ? c.query.sort : null,
|
|
1797
|
+
page: Number(c.query.page ?? 1) || 1
|
|
1798
|
+
})), H = I(() => {
|
|
1799
|
+
const v = M.value?.counts, z = [
|
|
1800
|
+
{ value: "all", label: n("panel.view-all"), badge: v?.all || void 0 },
|
|
1801
|
+
{ value: "unread", label: n("panel.view-unread"), badge: v?.unread || void 0 }
|
|
1802
|
+
];
|
|
1803
|
+
for (const E of C.value)
|
|
1804
|
+
z.push({
|
|
1805
|
+
value: E.key,
|
|
1806
|
+
label: x(E),
|
|
1807
|
+
badge: v?.statuses[E.key] || void 0
|
|
1808
|
+
});
|
|
1809
|
+
return z;
|
|
1810
|
+
}), D = I(() => [
|
|
1811
|
+
...(M.value?.columns ?? []).map((z, E) => ({
|
|
1812
|
+
key: `values.${z.key}`,
|
|
1813
|
+
label: z.label,
|
|
1814
|
+
sortable: !0,
|
|
1815
|
+
// The first answer is what the row is recognised by and stays at any width; every one
|
|
1816
|
+
// after it is worth less than the room it takes, so it goes a step sooner. The steps are
|
|
1817
|
+
// wide — 640, 960 — because an answer is a sentence and not a number: two of them plus
|
|
1818
|
+
// the status and the date is already what a 755px pane holds without scrolling sideways,
|
|
1819
|
+
// which is what the pane beside the forms actually is on a 1280 screen (§11).
|
|
1820
|
+
hideBelow: E === 0 ? void 0 : 320 + E * 320
|
|
1821
|
+
})),
|
|
1822
|
+
// A floor rather than a width: the cell holds a badge, sometimes an avatar and sometimes
|
|
1823
|
+
// a paperclip, and a fixed width that any of them overflows makes the whole table scroll
|
|
1824
|
+
// sideways by two pixels.
|
|
1825
|
+
{ key: "status", label: n("panel.status"), minWidth: 100 },
|
|
1826
|
+
{
|
|
1827
|
+
key: "created_at",
|
|
1828
|
+
label: n("panel.received"),
|
|
1829
|
+
sortable: !0,
|
|
1830
|
+
width: 150,
|
|
1831
|
+
// "today at 16:22" is three words the table will break over two lines given half a
|
|
1832
|
+
// chance, and a date read down a column has to be one line to be read at all.
|
|
1833
|
+
cellClass: "wx-submissions__when",
|
|
1834
|
+
hideBelow: 520
|
|
1835
|
+
// Kept on the card, unlike most dates: "when did this come in" is one of the two
|
|
1836
|
+
// questions a submission is looked at for, and the other one is who sent it.
|
|
1837
|
+
},
|
|
1838
|
+
{ key: "actions", label: "", width: 56, align: "right", hideOnCards: !0 }
|
|
1839
|
+
]), N = I(
|
|
1840
|
+
() => W.value.view === "all" && W.value.search === "" && W.value.assignee === null ? n("panel.submissions-empty") : n("panel.submissions-none")
|
|
1841
|
+
), L = I(
|
|
1842
|
+
() => C.value.map((v) => ({ value: v.id, label: x(v) }))
|
|
1843
|
+
);
|
|
1844
|
+
function x(v) {
|
|
1845
|
+
return re(v.title, S.active.value, v.key);
|
|
1846
|
+
}
|
|
1847
|
+
function V() {
|
|
1848
|
+
return re(o.form.title, S.active.value, o.form.slug);
|
|
1849
|
+
}
|
|
1850
|
+
async function Q(v) {
|
|
1851
|
+
T.value = !0;
|
|
1852
|
+
try {
|
|
1853
|
+
M.value = await p.submissions(o.form.id, {
|
|
1854
|
+
view: W.value.view,
|
|
1855
|
+
search: v?.search ?? W.value.search,
|
|
1856
|
+
assignee: W.value.assignee,
|
|
1857
|
+
sort: v?.sort ? `${v.sort.order === "desc" ? "-" : ""}${v.sort.key}` : null,
|
|
1858
|
+
page: v?.page ?? W.value.page,
|
|
1859
|
+
per_page: v?.perPage
|
|
1860
|
+
});
|
|
1861
|
+
} catch (z) {
|
|
1862
|
+
B.danger(f(z));
|
|
1863
|
+
} finally {
|
|
1864
|
+
T.value = !1;
|
|
1865
|
+
}
|
|
1866
|
+
}
|
|
1867
|
+
function j(v) {
|
|
1868
|
+
const z = {
|
|
1869
|
+
...c.query,
|
|
1870
|
+
search: v.search === "" ? void 0 : v.search,
|
|
1871
|
+
sort: v.sort === null ? void 0 : `${v.sort.order === "desc" ? "-" : ""}${v.sort.key}`,
|
|
1872
|
+
page: v.page === 1 ? void 0 : String(v.page)
|
|
1873
|
+
};
|
|
1874
|
+
l.replace({ query: z }), Q(v);
|
|
1875
|
+
}
|
|
1876
|
+
ke(
|
|
1877
|
+
() => [o.form.id, F.value, W.value.assignee],
|
|
1878
|
+
() => {
|
|
1879
|
+
U.value = [], Q();
|
|
1880
|
+
}
|
|
1881
|
+
), Q(), pe();
|
|
1882
|
+
async function pe() {
|
|
1883
|
+
try {
|
|
1884
|
+
C.value = await p.statuses();
|
|
1885
|
+
} catch (v) {
|
|
1886
|
+
B.danger(f(v));
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1889
|
+
function Ve(v) {
|
|
1890
|
+
l.push({ path: `${o.base}/submissions/${v.id}`, query: { ...c.query } });
|
|
1891
|
+
}
|
|
1892
|
+
function G(v) {
|
|
1893
|
+
return d.value ? [
|
|
1894
|
+
{
|
|
1895
|
+
key: "read",
|
|
1896
|
+
icon: v.is_read ? "eye-off" : "eye",
|
|
1897
|
+
label: v.is_read ? n("panel.mark-unread") : n("panel.mark-read"),
|
|
1898
|
+
run: () => {
|
|
1899
|
+
ne([v.id], v.is_read ? "unread" : "read");
|
|
1900
|
+
}
|
|
1901
|
+
},
|
|
1902
|
+
{
|
|
1903
|
+
key: "delete",
|
|
1904
|
+
icon: "trash",
|
|
1905
|
+
label: n("panel.delete"),
|
|
1906
|
+
danger: !0,
|
|
1907
|
+
run: () => {
|
|
1908
|
+
$([v.id]);
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
] : [];
|
|
1912
|
+
}
|
|
1913
|
+
async function k(v) {
|
|
1914
|
+
typeof v == "number" && (A.value = !0, await ne(
|
|
1915
|
+
U.value.map((z) => z.id),
|
|
1916
|
+
"status",
|
|
1917
|
+
v
|
|
1918
|
+
), A.value = !1);
|
|
1919
|
+
}
|
|
1920
|
+
async function $(v) {
|
|
1921
|
+
await ze({
|
|
1922
|
+
title: v.length === 1 ? n("panel.delete-submission-title") : n("panel.delete-selected-title", { count: v.length }),
|
|
1923
|
+
message: n("panel.delete-submission-text"),
|
|
1924
|
+
confirmText: n("panel.delete"),
|
|
1925
|
+
cancelText: n("panel.cancel"),
|
|
1926
|
+
tone: "danger"
|
|
1927
|
+
}) && await ne(v, "delete");
|
|
1928
|
+
}
|
|
1929
|
+
async function ne(v, z, E) {
|
|
1930
|
+
if (v.length !== 0)
|
|
1931
|
+
try {
|
|
1932
|
+
await p.massSubmissions({ ids: v, action: z, status_id: E }), U.value = [], await Q(), m("changed");
|
|
1933
|
+
} catch ($e) {
|
|
1934
|
+
B.danger(f($e));
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
async function fe() {
|
|
1938
|
+
const v = await w({ form: o.form });
|
|
1939
|
+
v && (B.success(n("panel.created")), await Q(), m("changed"), l.push({ path: `${o.base}/submissions/${v.id}`, query: { ...c.query } }));
|
|
1940
|
+
}
|
|
1941
|
+
const Le = I(
|
|
1942
|
+
() => p.exportUrl(o.form.id, {
|
|
1943
|
+
view: W.value.view,
|
|
1944
|
+
search: W.value.search,
|
|
1945
|
+
assignee: W.value.assignee,
|
|
1946
|
+
sort: W.value.sort
|
|
1947
|
+
})
|
|
1948
|
+
);
|
|
1949
|
+
function g() {
|
|
1950
|
+
l.push(`${o.base}/forms/${o.form.id}`);
|
|
1951
|
+
}
|
|
1952
|
+
return (v, z) => (u(), K("div", tt, [
|
|
1953
|
+
P("div", at, [
|
|
1954
|
+
r.inline ? O("", !0) : (u(), h(e(ge), {
|
|
1955
|
+
key: 0,
|
|
1956
|
+
icon: "arrow-left",
|
|
1957
|
+
title: e(n)("panel.forms"),
|
|
1958
|
+
onClick: z[0] || (z[0] = (E) => m("back"))
|
|
1959
|
+
}, null, 8, ["title"])),
|
|
1960
|
+
P("div", nt, [
|
|
1961
|
+
t(e(Xe), {
|
|
1962
|
+
level: 3,
|
|
1963
|
+
truncate: ""
|
|
1964
|
+
}, {
|
|
1965
|
+
default: a(() => [
|
|
1966
|
+
_(b(V()), 1)
|
|
1967
|
+
]),
|
|
1968
|
+
_: 1
|
|
1969
|
+
}),
|
|
1970
|
+
t(e(Z), {
|
|
1971
|
+
size: "sm",
|
|
1972
|
+
tone: "muted",
|
|
1973
|
+
mono: "",
|
|
1974
|
+
truncate: ""
|
|
1975
|
+
}, {
|
|
1976
|
+
default: a(() => [
|
|
1977
|
+
_(b(r.form.slug), 1)
|
|
1978
|
+
]),
|
|
1979
|
+
_: 1
|
|
1980
|
+
})
|
|
1981
|
+
]),
|
|
1982
|
+
d.value ? (u(), h(e(Y), {
|
|
1983
|
+
key: 1,
|
|
1984
|
+
variant: "outline",
|
|
1985
|
+
icon: "plus",
|
|
1986
|
+
size: "sm",
|
|
1987
|
+
onClick: fe
|
|
1988
|
+
}, {
|
|
1989
|
+
default: a(() => [
|
|
1990
|
+
_(b(e(n)("panel.new-submission")), 1)
|
|
1991
|
+
]),
|
|
1992
|
+
_: 1
|
|
1993
|
+
})) : O("", !0),
|
|
1994
|
+
t(e(Y), {
|
|
1995
|
+
variant: "outline",
|
|
1996
|
+
icon: "download",
|
|
1997
|
+
size: "sm",
|
|
1998
|
+
href: Le.value
|
|
1999
|
+
}, {
|
|
2000
|
+
default: a(() => [
|
|
2001
|
+
_(b(e(n)("panel.export")), 1)
|
|
2002
|
+
]),
|
|
2003
|
+
_: 1
|
|
2004
|
+
}, 8, ["href"]),
|
|
2005
|
+
y.value ? (u(), h(e(Y), {
|
|
2006
|
+
key: 2,
|
|
2007
|
+
variant: "outline",
|
|
2008
|
+
icon: "settings",
|
|
2009
|
+
size: "sm",
|
|
2010
|
+
onClick: g
|
|
2011
|
+
}, {
|
|
2012
|
+
default: a(() => [
|
|
2013
|
+
_(b(e(n)("panel.settings")), 1)
|
|
2014
|
+
]),
|
|
2015
|
+
_: 1
|
|
2016
|
+
})) : O("", !0)
|
|
2017
|
+
]),
|
|
2018
|
+
t(e(Je), {
|
|
2019
|
+
modelValue: F.value,
|
|
2020
|
+
"onUpdate:modelValue": z[3] || (z[3] = (E) => F.value = E),
|
|
2021
|
+
class: "wx-submissions__views",
|
|
2022
|
+
items: H.value,
|
|
2023
|
+
"collapse-below": 560,
|
|
2024
|
+
"aria-label": e(n)("panel.status")
|
|
2025
|
+
}, {
|
|
2026
|
+
default: a(() => [
|
|
2027
|
+
t(e(Ye), {
|
|
2028
|
+
data: M.value,
|
|
2029
|
+
columns: D.value,
|
|
2030
|
+
"row-key": "id",
|
|
2031
|
+
searchable: "",
|
|
2032
|
+
clickable: "",
|
|
2033
|
+
hover: "",
|
|
2034
|
+
flush: "",
|
|
2035
|
+
loading: T.value,
|
|
2036
|
+
selectable: d.value,
|
|
2037
|
+
"row-class": (E) => E.is_read ? void 0 : "is-unread",
|
|
2038
|
+
"search-placeholder": e(n)("panel.search-submissions"),
|
|
2039
|
+
"empty-text": N.value,
|
|
2040
|
+
"cards-below": 640,
|
|
2041
|
+
onRowClick: Ve,
|
|
2042
|
+
onStateChange: j,
|
|
2043
|
+
onSelectionChange: z[2] || (z[2] = (E, $e) => U.value = $e)
|
|
2044
|
+
}, Ke({
|
|
2045
|
+
"cell-status": a(({ row: E }) => [
|
|
2046
|
+
P("div", ot, [
|
|
2047
|
+
E.status ? (u(), h(e(xe), {
|
|
2048
|
+
key: 0,
|
|
2049
|
+
type: E.status.color
|
|
2050
|
+
}, {
|
|
2051
|
+
default: a(() => [
|
|
2052
|
+
_(b(x(E.status)), 1)
|
|
2053
|
+
]),
|
|
2054
|
+
_: 2
|
|
2055
|
+
}, 1032, ["type"])) : O("", !0),
|
|
2056
|
+
E.assignee ? (u(), h(e(cl), {
|
|
2057
|
+
key: 1,
|
|
2058
|
+
name: E.assignee.name,
|
|
2059
|
+
title: E.assignee.name,
|
|
2060
|
+
size: "xs",
|
|
2061
|
+
tone: "auto"
|
|
2062
|
+
}, null, 8, ["name", "title"])) : O("", !0),
|
|
2063
|
+
E.files_count > 0 ? (u(), h(e(pl), {
|
|
2064
|
+
key: 2,
|
|
2065
|
+
content: e(n)("panel.attachments")
|
|
2066
|
+
}, {
|
|
2067
|
+
default: a(() => [
|
|
2068
|
+
t(e(ml), {
|
|
2069
|
+
name: "file",
|
|
2070
|
+
size: "sm"
|
|
2071
|
+
})
|
|
2072
|
+
]),
|
|
2073
|
+
_: 1
|
|
2074
|
+
}, 8, ["content"])) : O("", !0)
|
|
2075
|
+
])
|
|
2076
|
+
]),
|
|
2077
|
+
"cell-created_at": a(({ row: E }) => [
|
|
2078
|
+
t(e(Pe), {
|
|
2079
|
+
value: E.created_at
|
|
2080
|
+
}, null, 8, ["value"])
|
|
2081
|
+
]),
|
|
2082
|
+
"card-actions": a(({ row: E }) => [
|
|
2083
|
+
t(e(we), {
|
|
2084
|
+
actions: G(E),
|
|
2085
|
+
label: String(E.id)
|
|
2086
|
+
}, null, 8, ["actions", "label"])
|
|
2087
|
+
]),
|
|
2088
|
+
"cell-actions": a(({ row: E }) => [
|
|
2089
|
+
t(e(we), {
|
|
2090
|
+
actions: G(E),
|
|
2091
|
+
label: String(E.id)
|
|
2092
|
+
}, null, 8, ["actions", "label"])
|
|
2093
|
+
]),
|
|
2094
|
+
_: 2
|
|
2095
|
+
}, [
|
|
2096
|
+
U.value.length > 0 ? {
|
|
2097
|
+
name: "actions",
|
|
2098
|
+
fn: a(() => [
|
|
2099
|
+
P("div", st, [
|
|
2100
|
+
t(e(Z), {
|
|
2101
|
+
size: "sm",
|
|
2102
|
+
weight: "medium"
|
|
2103
|
+
}, {
|
|
2104
|
+
default: a(() => [
|
|
2105
|
+
_(b(e(n)("panel.selected", { count: U.value.length })), 1)
|
|
2106
|
+
]),
|
|
2107
|
+
_: 1
|
|
2108
|
+
}),
|
|
2109
|
+
t(e(ve), {
|
|
2110
|
+
"model-value": null,
|
|
2111
|
+
options: L.value,
|
|
2112
|
+
placeholder: e(n)("panel.move-to"),
|
|
2113
|
+
disabled: A.value,
|
|
2114
|
+
size: "sm",
|
|
2115
|
+
style: { width: "180px" },
|
|
2116
|
+
"onUpdate:modelValue": k
|
|
2117
|
+
}, null, 8, ["options", "placeholder", "disabled"]),
|
|
2118
|
+
t(e(Y), {
|
|
2119
|
+
size: "sm",
|
|
2120
|
+
variant: "outline",
|
|
2121
|
+
type: "danger",
|
|
2122
|
+
icon: "trash",
|
|
2123
|
+
onClick: z[1] || (z[1] = (E) => $(U.value.map(($e) => $e.id)))
|
|
2124
|
+
}, {
|
|
2125
|
+
default: a(() => [
|
|
2126
|
+
_(b(e(n)("panel.delete")), 1)
|
|
2127
|
+
]),
|
|
2128
|
+
_: 1
|
|
2129
|
+
})
|
|
2130
|
+
])
|
|
2131
|
+
]),
|
|
2132
|
+
key: "0"
|
|
2133
|
+
} : void 0
|
|
2134
|
+
]), 1032, ["data", "columns", "loading", "selectable", "row-class", "search-placeholder", "empty-text"])
|
|
2135
|
+
]),
|
|
2136
|
+
_: 1
|
|
2137
|
+
}, 8, ["modelValue", "items", "aria-label"])
|
|
2138
|
+
]));
|
|
2139
|
+
}
|
|
2140
|
+
}), ut = /* @__PURE__ */ oe(it, [["__scopeId", "data-v-7ef0e131"]]), dt = ["onClick"], rt = { class: "wx-inbox-form__name" }, ct = /* @__PURE__ */ le({
|
|
2141
|
+
__name: "InboxPage",
|
|
2142
|
+
props: {
|
|
2143
|
+
base: { default: "/inbox" }
|
|
2144
|
+
},
|
|
2145
|
+
setup(r) {
|
|
2146
|
+
const i = r, o = se(), m = ie(o), s = qe(), p = Ae(), c = be();
|
|
2147
|
+
ue();
|
|
2148
|
+
const l = ae("webx-inbox"), S = ce(), n = q([]), f = q(!0), M = q(!1), C = I(() => o.can("inbox.manage")), T = Me(Jl), U = I(
|
|
2149
|
+
() => o.state.manifest?.modules.find((V) => V.id === "inbox")?.title ?? l("module.title")
|
|
2150
|
+
), A = I(() => {
|
|
2151
|
+
const V = s.query.form;
|
|
2152
|
+
return typeof V == "string" && V !== "" ? Number(V) : null;
|
|
2153
|
+
}), d = I(() => n.value.find((V) => V.id === A.value) ?? null);
|
|
2154
|
+
function y(V) {
|
|
2155
|
+
return re(V.title, c.active.value, V.slug);
|
|
2156
|
+
}
|
|
2157
|
+
async function w() {
|
|
2158
|
+
f.value = !0;
|
|
2159
|
+
try {
|
|
2160
|
+
n.value = await m.forms();
|
|
2161
|
+
} catch (V) {
|
|
2162
|
+
B.danger(S(V));
|
|
2163
|
+
} finally {
|
|
2164
|
+
f.value = !1;
|
|
2165
|
+
}
|
|
2166
|
+
}
|
|
2167
|
+
w(), ke(d, (V) => {
|
|
2168
|
+
V !== null && (M.value = !0);
|
|
2169
|
+
});
|
|
2170
|
+
function F(V) {
|
|
2171
|
+
p.replace({ query: { ...s.query, form: String(V.id) } }), M.value = !0;
|
|
2172
|
+
}
|
|
2173
|
+
function W(V) {
|
|
2174
|
+
p.push(`${i.base}/forms/${V.id}`);
|
|
2175
|
+
}
|
|
2176
|
+
function H(V) {
|
|
2177
|
+
return C.value ? [
|
|
2178
|
+
{ key: "settings", icon: "settings", label: l("panel.settings"), run: () => W(V) },
|
|
2179
|
+
{ key: "duplicate", icon: "copy", label: l("panel.duplicate"), run: () => N(V) },
|
|
2180
|
+
// A form that has taken submissions is switched off, never deleted (§2.4). The line is
|
|
2181
|
+
// left out rather than greyed: a menu is a list of what is possible.
|
|
2182
|
+
...V.submissions_count === 0 ? [
|
|
2183
|
+
{
|
|
2184
|
+
key: "delete",
|
|
2185
|
+
icon: "trash",
|
|
2186
|
+
label: l("panel.delete"),
|
|
2187
|
+
danger: !0,
|
|
2188
|
+
run: () => L(V)
|
|
2189
|
+
}
|
|
2190
|
+
] : []
|
|
2191
|
+
] : [];
|
|
2192
|
+
}
|
|
2193
|
+
async function D() {
|
|
2194
|
+
const V = await T({});
|
|
2195
|
+
V && (await w(), W(V));
|
|
2196
|
+
}
|
|
2197
|
+
async function N(V) {
|
|
2198
|
+
try {
|
|
2199
|
+
const Q = await m.duplicateForm(V.id);
|
|
2200
|
+
B.success(l("panel.duplicated")), await w(), W(Q);
|
|
2201
|
+
} catch (Q) {
|
|
2202
|
+
B.danger(S(Q));
|
|
2203
|
+
}
|
|
2204
|
+
}
|
|
2205
|
+
async function L(V) {
|
|
2206
|
+
if (await ze({
|
|
2207
|
+
title: l("panel.delete-form-title", { form: y(V) }),
|
|
2208
|
+
message: l("panel.delete-form-text"),
|
|
2209
|
+
confirmText: l("panel.delete"),
|
|
2210
|
+
cancelText: l("panel.cancel"),
|
|
2211
|
+
tone: "danger"
|
|
2212
|
+
}))
|
|
2213
|
+
try {
|
|
2214
|
+
if (await m.removeForm(V.id), B.success(l("panel.deleted")), A.value === V.id) {
|
|
2215
|
+
const j = { ...s.query };
|
|
2216
|
+
delete j.form, p.replace({ query: j }), M.value = !1;
|
|
2217
|
+
}
|
|
2218
|
+
await w();
|
|
2219
|
+
} catch (j) {
|
|
2220
|
+
B.danger(S(j));
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
async function x() {
|
|
2224
|
+
try {
|
|
2225
|
+
await m.sortForms(n.value.map((V) => V.id));
|
|
2226
|
+
} catch (V) {
|
|
2227
|
+
B.danger(S(V, l("panel.reorder-failed"))), await w();
|
|
2228
|
+
}
|
|
2229
|
+
}
|
|
2230
|
+
return (V, Q) => (u(), h(e(Ze), {
|
|
2231
|
+
title: U.value,
|
|
2232
|
+
card: !1,
|
|
2233
|
+
fill: ""
|
|
2234
|
+
}, {
|
|
2235
|
+
actions: a(() => [
|
|
2236
|
+
C.value ? (u(), h(e(Y), {
|
|
2237
|
+
key: 0,
|
|
2238
|
+
variant: "outline",
|
|
2239
|
+
icon: "tag",
|
|
2240
|
+
onClick: Q[0] || (Q[0] = (j) => e(p).push(`${i.base}/statuses`))
|
|
2241
|
+
}, {
|
|
2242
|
+
default: a(() => [
|
|
2243
|
+
_(b(e(l)("panel.statuses")), 1)
|
|
2244
|
+
]),
|
|
2245
|
+
_: 1
|
|
2246
|
+
})) : O("", !0),
|
|
2247
|
+
C.value ? (u(), h(e(Y), {
|
|
2248
|
+
key: 1,
|
|
2249
|
+
type: "primary",
|
|
2250
|
+
icon: "plus",
|
|
2251
|
+
onClick: D
|
|
2252
|
+
}, {
|
|
2253
|
+
default: a(() => [
|
|
2254
|
+
_(b(e(l)("panel.new-form")), 1)
|
|
2255
|
+
]),
|
|
2256
|
+
_: 1
|
|
2257
|
+
})) : O("", !0)
|
|
2258
|
+
]),
|
|
2259
|
+
default: a(() => [
|
|
2260
|
+
t(e(ee), {
|
|
2261
|
+
class: "wx-inbox",
|
|
2262
|
+
padding: "none"
|
|
2263
|
+
}, {
|
|
2264
|
+
default: a(() => [
|
|
2265
|
+
t(e(vl), {
|
|
2266
|
+
open: M.value,
|
|
2267
|
+
"onUpdate:open": Q[2] || (Q[2] = (j) => M.value = j),
|
|
2268
|
+
class: "wx-inbox__panes",
|
|
2269
|
+
"list-width": 270,
|
|
2270
|
+
"detail-min": 420,
|
|
2271
|
+
"detail-label": d.value ? y(d.value) : e(l)("panel.forms")
|
|
2272
|
+
}, {
|
|
2273
|
+
list: a(() => [
|
|
2274
|
+
f.value ? (u(), h(e(De), {
|
|
2275
|
+
key: 0,
|
|
2276
|
+
class: "wx-inbox__loading",
|
|
2277
|
+
rows: 5
|
|
2278
|
+
})) : n.value.length === 0 ? (u(), h(e(Se), {
|
|
2279
|
+
key: 1,
|
|
2280
|
+
title: e(l)("panel.no-forms"),
|
|
2281
|
+
description: e(l)("panel.no-forms-help")
|
|
2282
|
+
}, null, 8, ["title", "description"])) : (u(), h(e(Re), {
|
|
2283
|
+
key: 2,
|
|
2284
|
+
modelValue: n.value,
|
|
2285
|
+
"onUpdate:modelValue": Q[1] || (Q[1] = (j) => n.value = j),
|
|
2286
|
+
class: "wx-inbox__forms",
|
|
2287
|
+
plain: "",
|
|
2288
|
+
size: "sm",
|
|
2289
|
+
"item-key": "id",
|
|
2290
|
+
"item-label": y,
|
|
2291
|
+
disabled: !C.value,
|
|
2292
|
+
title: e(l)("panel.forms"),
|
|
2293
|
+
onMove: x
|
|
2294
|
+
}, {
|
|
2295
|
+
default: a(({ item: j }) => [
|
|
2296
|
+
P("button", {
|
|
2297
|
+
type: "button",
|
|
2298
|
+
class: al(["wx-inbox-form", { "is-current": j.id === A.value }]),
|
|
2299
|
+
onClick: (pe) => F(j)
|
|
2300
|
+
}, [
|
|
2301
|
+
P("span", rt, [
|
|
2302
|
+
t(e(Z), {
|
|
2303
|
+
truncate: "",
|
|
2304
|
+
weight: "medium"
|
|
2305
|
+
}, {
|
|
2306
|
+
default: a(() => [
|
|
2307
|
+
_(b(y(j)), 1)
|
|
2308
|
+
]),
|
|
2309
|
+
_: 2
|
|
2310
|
+
}, 1024),
|
|
2311
|
+
j.is_enabled ? O("", !0) : (u(), h(e(xe), {
|
|
2312
|
+
key: 0,
|
|
2313
|
+
type: "default"
|
|
2314
|
+
}, {
|
|
2315
|
+
default: a(() => [
|
|
2316
|
+
_(b(e(l)("panel.off")), 1)
|
|
2317
|
+
]),
|
|
2318
|
+
_: 1
|
|
2319
|
+
}))
|
|
2320
|
+
]),
|
|
2321
|
+
t(e(Z), {
|
|
2322
|
+
size: "sm",
|
|
2323
|
+
tone: "muted",
|
|
2324
|
+
truncate: ""
|
|
2325
|
+
}, {
|
|
2326
|
+
default: a(() => [
|
|
2327
|
+
_(b(j.slug), 1)
|
|
2328
|
+
]),
|
|
2329
|
+
_: 2
|
|
2330
|
+
}, 1024)
|
|
2331
|
+
], 10, dt),
|
|
2332
|
+
j.unread_count ? (u(), h(e(xe), {
|
|
2333
|
+
key: 0,
|
|
2334
|
+
type: "primary",
|
|
2335
|
+
class: "wx-inbox-form__count",
|
|
2336
|
+
title: e(l)("panel.unread")
|
|
2337
|
+
}, {
|
|
2338
|
+
default: a(() => [
|
|
2339
|
+
_(b(j.unread_count), 1)
|
|
2340
|
+
]),
|
|
2341
|
+
_: 2
|
|
2342
|
+
}, 1032, ["title"])) : j.submissions_count ? (u(), h(e(Z), {
|
|
2343
|
+
key: 1,
|
|
2344
|
+
size: "sm",
|
|
2345
|
+
tone: "muted",
|
|
2346
|
+
title: e(l)("panel.submissions")
|
|
2347
|
+
}, {
|
|
2348
|
+
default: a(() => [
|
|
2349
|
+
_(b(j.submissions_count), 1)
|
|
2350
|
+
]),
|
|
2351
|
+
_: 2
|
|
2352
|
+
}, 1032, ["title"])) : O("", !0)
|
|
2353
|
+
]),
|
|
2354
|
+
actions: a(({ item: j }) => [
|
|
2355
|
+
t(e(we), {
|
|
2356
|
+
actions: H(j),
|
|
2357
|
+
label: y(j)
|
|
2358
|
+
}, null, 8, ["actions", "label"])
|
|
2359
|
+
]),
|
|
2360
|
+
_: 1
|
|
2361
|
+
}, 8, ["modelValue", "disabled", "title"]))
|
|
2362
|
+
]),
|
|
2363
|
+
empty: a(() => [
|
|
2364
|
+
t(e(Se), {
|
|
2365
|
+
description: e(l)("panel.choose-form")
|
|
2366
|
+
}, null, 8, ["description"])
|
|
2367
|
+
]),
|
|
2368
|
+
detail: a(({ inline: j, back: pe }) => [
|
|
2369
|
+
d.value ? (u(), h(ut, {
|
|
2370
|
+
key: d.value.id,
|
|
2371
|
+
form: d.value,
|
|
2372
|
+
base: i.base,
|
|
2373
|
+
inline: j,
|
|
2374
|
+
onBack: pe,
|
|
2375
|
+
onChanged: w
|
|
2376
|
+
}, null, 8, ["form", "base", "inline", "onBack"])) : O("", !0)
|
|
2377
|
+
]),
|
|
2378
|
+
_: 1
|
|
2379
|
+
}, 8, ["open", "detail-label"])
|
|
2380
|
+
]),
|
|
2381
|
+
_: 1
|
|
2382
|
+
})
|
|
2383
|
+
]),
|
|
2384
|
+
_: 1
|
|
2385
|
+
}, 8, ["title"]));
|
|
2386
|
+
}
|
|
2387
|
+
}), pt = { class: "wx-inbox-status-form" }, mt = { class: "wx-inbox-status-form__checks" }, vt = /* @__PURE__ */ le({
|
|
2388
|
+
__name: "StatusDialog",
|
|
2389
|
+
props: {
|
|
2390
|
+
status: {}
|
|
2391
|
+
},
|
|
2392
|
+
setup(r) {
|
|
2393
|
+
const i = r, { resolve: o, dismiss: m, open: s } = Ne(), p = se(), c = ie(p);
|
|
2394
|
+
ue();
|
|
2395
|
+
const l = ae("webx-inbox"), S = ce(), n = q(""), f = q({}), M = q("default"), C = q(!1), T = q(!1), U = q(!1), A = q(!1), d = q({});
|
|
2396
|
+
ke(
|
|
2397
|
+
() => i.status,
|
|
2398
|
+
(W) => {
|
|
2399
|
+
n.value = W?.key ?? "", f.value = { ...W?.title ?? {} }, M.value = W?.color ?? "default", C.value = W?.is_default ?? !1, T.value = W?.is_spam ?? !1, U.value = W?.is_closed ?? !1, d.value = {};
|
|
2400
|
+
},
|
|
2401
|
+
{ immediate: !0 }
|
|
2402
|
+
);
|
|
2403
|
+
const y = I(
|
|
2404
|
+
() => xl.map((W) => ({ value: W, label: l(`panel.color-${W}`) }))
|
|
2405
|
+
);
|
|
2406
|
+
function w(W) {
|
|
2407
|
+
return d.value[W]?.[0];
|
|
2408
|
+
}
|
|
2409
|
+
async function F() {
|
|
2410
|
+
A.value = !0, d.value = {};
|
|
2411
|
+
const W = {
|
|
2412
|
+
key: n.value.trim(),
|
|
2413
|
+
title: f.value,
|
|
2414
|
+
color: M.value,
|
|
2415
|
+
is_default: C.value,
|
|
2416
|
+
is_spam: T.value,
|
|
2417
|
+
is_closed: U.value
|
|
2418
|
+
};
|
|
2419
|
+
try {
|
|
2420
|
+
o(
|
|
2421
|
+
i.status === null ? await c.createStatus(W) : await c.saveStatus(i.status.id, W)
|
|
2422
|
+
);
|
|
2423
|
+
} catch (H) {
|
|
2424
|
+
const D = H.body;
|
|
2425
|
+
D?.errors ? (d.value = D.errors, B.danger(l("panel.failed"))) : B.danger(S(H));
|
|
2426
|
+
} finally {
|
|
2427
|
+
A.value = !1;
|
|
2428
|
+
}
|
|
2429
|
+
}
|
|
2430
|
+
return (W, H) => (u(), h(e(Ie), {
|
|
2431
|
+
open: e(s),
|
|
2432
|
+
"onUpdate:open": H[7] || (H[7] = (D) => te(s) ? s.value = D : null),
|
|
2433
|
+
title: r.status ? e(l)("panel.settings") : e(l)("panel.new-status"),
|
|
2434
|
+
width: 520
|
|
2435
|
+
}, {
|
|
2436
|
+
footer: a(() => [
|
|
2437
|
+
t(e(Ce), { size: "sm" }, {
|
|
2438
|
+
default: a(() => [
|
|
2439
|
+
t(e(Y), {
|
|
2440
|
+
variant: "outline",
|
|
2441
|
+
onClick: H[6] || (H[6] = (D) => e(m)())
|
|
2442
|
+
}, {
|
|
2443
|
+
default: a(() => [
|
|
2444
|
+
_(b(e(l)("panel.cancel")), 1)
|
|
2445
|
+
]),
|
|
2446
|
+
_: 1
|
|
2447
|
+
}),
|
|
2448
|
+
t(e(Y), {
|
|
2449
|
+
type: "primary",
|
|
2450
|
+
loading: A.value,
|
|
2451
|
+
onClick: F
|
|
2452
|
+
}, {
|
|
2453
|
+
default: a(() => [
|
|
2454
|
+
_(b(e(l)("panel.save")), 1)
|
|
2455
|
+
]),
|
|
2456
|
+
_: 1
|
|
2457
|
+
}, 8, ["loading"])
|
|
2458
|
+
]),
|
|
2459
|
+
_: 1
|
|
2460
|
+
})
|
|
2461
|
+
]),
|
|
2462
|
+
default: a(() => [
|
|
2463
|
+
P("div", pt, [
|
|
2464
|
+
t(e(R), {
|
|
2465
|
+
label: e(l)("panel.title"),
|
|
2466
|
+
error: w("title"),
|
|
2467
|
+
required: ""
|
|
2468
|
+
}, {
|
|
2469
|
+
default: a(() => [
|
|
2470
|
+
t(e(J), {
|
|
2471
|
+
modelValue: f.value,
|
|
2472
|
+
"onUpdate:modelValue": H[0] || (H[0] = (D) => f.value = D),
|
|
2473
|
+
localized: ""
|
|
2474
|
+
}, null, 8, ["modelValue"])
|
|
2475
|
+
]),
|
|
2476
|
+
_: 1
|
|
2477
|
+
}, 8, ["label", "error"]),
|
|
2478
|
+
t(e(R), {
|
|
2479
|
+
label: e(l)("panel.status-key"),
|
|
2480
|
+
error: w("key"),
|
|
2481
|
+
required: ""
|
|
2482
|
+
}, {
|
|
2483
|
+
default: a(() => [
|
|
2484
|
+
t(e(J), {
|
|
2485
|
+
modelValue: n.value,
|
|
2486
|
+
"onUpdate:modelValue": H[1] || (H[1] = (D) => n.value = D),
|
|
2487
|
+
placeholder: "in-progress"
|
|
2488
|
+
}, null, 8, ["modelValue"])
|
|
2489
|
+
]),
|
|
2490
|
+
_: 1
|
|
2491
|
+
}, 8, ["label", "error"]),
|
|
2492
|
+
t(e(R), {
|
|
2493
|
+
label: e(l)("panel.status-color"),
|
|
2494
|
+
error: w("color")
|
|
2495
|
+
}, {
|
|
2496
|
+
default: a(() => [
|
|
2497
|
+
t(e(ve), {
|
|
2498
|
+
modelValue: M.value,
|
|
2499
|
+
"onUpdate:modelValue": H[2] || (H[2] = (D) => M.value = D),
|
|
2500
|
+
options: y.value
|
|
2501
|
+
}, null, 8, ["modelValue", "options"])
|
|
2502
|
+
]),
|
|
2503
|
+
_: 1
|
|
2504
|
+
}, 8, ["label", "error"]),
|
|
2505
|
+
P("div", mt, [
|
|
2506
|
+
t(e(me), {
|
|
2507
|
+
modelValue: C.value,
|
|
2508
|
+
"onUpdate:modelValue": H[3] || (H[3] = (D) => C.value = D),
|
|
2509
|
+
label: e(l)("panel.status-default")
|
|
2510
|
+
}, null, 8, ["modelValue", "label"]),
|
|
2511
|
+
t(e(me), {
|
|
2512
|
+
modelValue: T.value,
|
|
2513
|
+
"onUpdate:modelValue": H[4] || (H[4] = (D) => T.value = D),
|
|
2514
|
+
label: e(l)("panel.status-spam")
|
|
2515
|
+
}, null, 8, ["modelValue", "label"]),
|
|
2516
|
+
t(e(me), {
|
|
2517
|
+
modelValue: U.value,
|
|
2518
|
+
"onUpdate:modelValue": H[5] || (H[5] = (D) => U.value = D),
|
|
2519
|
+
disabled: T.value,
|
|
2520
|
+
label: e(l)("panel.status-closed")
|
|
2521
|
+
}, null, 8, ["modelValue", "disabled", "label"])
|
|
2522
|
+
])
|
|
2523
|
+
])
|
|
2524
|
+
]),
|
|
2525
|
+
_: 1
|
|
2526
|
+
}, 8, ["open", "title"]));
|
|
2527
|
+
}
|
|
2528
|
+
}), ft = /* @__PURE__ */ oe(vt, [["__scopeId", "data-v-b520b53b"]]), bt = { class: "wx-inbox-statuses" }, ht = { class: "wx-inbox-status" }, yt = /* @__PURE__ */ le({
|
|
2529
|
+
__name: "StatusesPage",
|
|
2530
|
+
props: {
|
|
2531
|
+
base: { default: "/inbox" }
|
|
2532
|
+
},
|
|
2533
|
+
setup(r) {
|
|
2534
|
+
const i = r, o = se(), m = ie(o), s = be();
|
|
2535
|
+
ue();
|
|
2536
|
+
const p = ae("webx-inbox"), c = ce(), l = q([]), S = q(!0), n = o.can("inbox.manage"), f = Me(ft);
|
|
2537
|
+
function M(y) {
|
|
2538
|
+
return re(y.title, s.active.value, y.key);
|
|
2539
|
+
}
|
|
2540
|
+
async function C() {
|
|
2541
|
+
S.value = !0;
|
|
2542
|
+
try {
|
|
2543
|
+
l.value = await m.statuses();
|
|
2544
|
+
} catch (y) {
|
|
2545
|
+
B.danger(c(y));
|
|
2546
|
+
} finally {
|
|
2547
|
+
S.value = !1;
|
|
2548
|
+
}
|
|
2549
|
+
}
|
|
2550
|
+
C();
|
|
2551
|
+
async function T(y) {
|
|
2552
|
+
await f({ status: y }) && await C();
|
|
2553
|
+
}
|
|
2554
|
+
async function U(y) {
|
|
2555
|
+
if (await ze({
|
|
2556
|
+
title: p("panel.delete-status-title", { status: M(y) }),
|
|
2557
|
+
message: p("panel.delete-status-text"),
|
|
2558
|
+
confirmText: p("panel.delete"),
|
|
2559
|
+
cancelText: p("panel.cancel"),
|
|
2560
|
+
tone: "danger"
|
|
2561
|
+
}))
|
|
2562
|
+
try {
|
|
2563
|
+
await m.removeStatus(y.id), B.success(p("panel.deleted")), await C();
|
|
2564
|
+
} catch (F) {
|
|
2565
|
+
B.danger(c(F));
|
|
2566
|
+
}
|
|
2567
|
+
}
|
|
2568
|
+
function A(y) {
|
|
2569
|
+
return n ? [
|
|
2570
|
+
{ key: "edit", icon: "edit", label: p("panel.settings"), run: () => {
|
|
2571
|
+
T(y);
|
|
2572
|
+
} },
|
|
2573
|
+
// A status with submissions in them cannot go: they would have nothing to be in. The
|
|
2574
|
+
// line is left out rather than greyed, the way every list of the panel does it.
|
|
2575
|
+
...y.submissions_count === 0 ? [
|
|
2576
|
+
{
|
|
2577
|
+
key: "delete",
|
|
2578
|
+
icon: "trash",
|
|
2579
|
+
label: p("panel.delete"),
|
|
2580
|
+
danger: !0,
|
|
2581
|
+
run: () => {
|
|
2582
|
+
U(y);
|
|
2583
|
+
}
|
|
2584
|
+
}
|
|
2585
|
+
] : []
|
|
2586
|
+
] : [];
|
|
2587
|
+
}
|
|
2588
|
+
async function d() {
|
|
2589
|
+
try {
|
|
2590
|
+
await m.sortStatuses(l.value.map((y) => y.id));
|
|
2591
|
+
} catch (y) {
|
|
2592
|
+
B.danger(c(y, p("panel.reorder-failed"))), await C();
|
|
2593
|
+
}
|
|
2594
|
+
}
|
|
2595
|
+
return (y, w) => (u(), K("div", bt, [
|
|
2596
|
+
t(e(Ee), {
|
|
2597
|
+
to: i.base,
|
|
2598
|
+
label: e(p)("panel.forms")
|
|
2599
|
+
}, null, 8, ["to", "label"]),
|
|
2600
|
+
t(e(Ze), {
|
|
2601
|
+
title: e(p)("panel.statuses")
|
|
2602
|
+
}, {
|
|
2603
|
+
actions: a(() => [
|
|
2604
|
+
e(n) ? (u(), h(e(Y), {
|
|
2605
|
+
key: 0,
|
|
2606
|
+
type: "primary",
|
|
2607
|
+
icon: "plus",
|
|
2608
|
+
onClick: w[0] || (w[0] = (F) => T(null))
|
|
2609
|
+
}, {
|
|
2610
|
+
default: a(() => [
|
|
2611
|
+
_(b(e(p)("panel.new-status")), 1)
|
|
2612
|
+
]),
|
|
2613
|
+
_: 1
|
|
2614
|
+
})) : O("", !0)
|
|
2615
|
+
]),
|
|
2616
|
+
default: a(() => [
|
|
2617
|
+
!S.value && l.value.length === 0 ? (u(), h(e(Se), {
|
|
2618
|
+
key: 0,
|
|
2619
|
+
title: e(p)("panel.no-statuses")
|
|
2620
|
+
}, null, 8, ["title"])) : (u(), h(e(Re), {
|
|
2621
|
+
key: 1,
|
|
2622
|
+
modelValue: l.value,
|
|
2623
|
+
"onUpdate:modelValue": w[1] || (w[1] = (F) => l.value = F),
|
|
2624
|
+
plain: "",
|
|
2625
|
+
"item-key": "id",
|
|
2626
|
+
"item-label": M,
|
|
2627
|
+
disabled: !e(n),
|
|
2628
|
+
"aria-label": e(p)("panel.statuses"),
|
|
2629
|
+
onMove: d
|
|
2630
|
+
}, {
|
|
2631
|
+
default: a(({ item: F }) => [
|
|
2632
|
+
P("div", ht, [
|
|
2633
|
+
t(e(xe), {
|
|
2634
|
+
type: F.color
|
|
2635
|
+
}, {
|
|
2636
|
+
default: a(() => [
|
|
2637
|
+
_(b(M(F)), 1)
|
|
2638
|
+
]),
|
|
2639
|
+
_: 2
|
|
2640
|
+
}, 1032, ["type"]),
|
|
2641
|
+
t(e(Z), {
|
|
2642
|
+
size: "sm",
|
|
2643
|
+
tone: "muted",
|
|
2644
|
+
truncate: ""
|
|
2645
|
+
}, {
|
|
2646
|
+
default: a(() => [
|
|
2647
|
+
P("code", null, b(F.key), 1),
|
|
2648
|
+
F.is_default ? (u(), K(X, { key: 0 }, [
|
|
2649
|
+
_(" · " + b(e(p)("panel.status-default")), 1)
|
|
2650
|
+
], 64)) : O("", !0),
|
|
2651
|
+
F.is_spam ? (u(), K(X, { key: 1 }, [
|
|
2652
|
+
_(" · " + b(e(p)("panel.status-spam")), 1)
|
|
2653
|
+
], 64)) : F.is_closed ? (u(), K(X, { key: 2 }, [
|
|
2654
|
+
_(" · " + b(e(p)("panel.status-closed")), 1)
|
|
2655
|
+
], 64)) : O("", !0),
|
|
2656
|
+
F.submissions_count ? (u(), K(X, { key: 3 }, [
|
|
2657
|
+
_(" · " + b(e(p)("panel.in-use")) + " (" + b(F.submissions_count) + ") ", 1)
|
|
2658
|
+
], 64)) : O("", !0)
|
|
2659
|
+
]),
|
|
2660
|
+
_: 2
|
|
2661
|
+
}, 1024)
|
|
2662
|
+
])
|
|
2663
|
+
]),
|
|
2664
|
+
actions: a(({ item: F }) => [
|
|
2665
|
+
t(e(we), {
|
|
2666
|
+
actions: A(F),
|
|
2667
|
+
label: M(F)
|
|
2668
|
+
}, null, 8, ["actions", "label"])
|
|
2669
|
+
]),
|
|
2670
|
+
_: 1
|
|
2671
|
+
}, 8, ["modelValue", "disabled", "aria-label"]))
|
|
2672
|
+
]),
|
|
2673
|
+
_: 1
|
|
2674
|
+
}, 8, ["title"])
|
|
2675
|
+
]));
|
|
2676
|
+
}
|
|
2677
|
+
}), gt = /* @__PURE__ */ oe(yt, [["__scopeId", "data-v-8c5d0882"]]), xt = { class: "wx-submission" }, _t = { class: "wx-submission__head" }, wt = { class: "wx-submission__who" }, kt = {
|
|
2678
|
+
key: 1,
|
|
2679
|
+
class: "wx-submission__panes"
|
|
2680
|
+
}, Vt = { class: "wx-submission__main" }, $t = { class: "wx-submission__value" }, Ut = { class: "wx-submission__files" }, St = { class: "wx-submission__aside" }, Ct = { class: "wx-submission__fields" }, zt = { class: "wx-submission__field" }, Tt = { class: "wx-submission__field" }, Ft = { class: "wx-submission__fields" }, Wt = ["href"], qt = {
|
|
2681
|
+
key: 1,
|
|
2682
|
+
class: "wx-submission__detail"
|
|
2683
|
+
}, At = { class: "wx-submission__by" }, Nt = /* @__PURE__ */ le({
|
|
2684
|
+
__name: "SubmissionPage",
|
|
2685
|
+
props: {
|
|
2686
|
+
base: { default: "/inbox" }
|
|
2687
|
+
},
|
|
2688
|
+
setup(r) {
|
|
2689
|
+
const i = r, o = se(), m = ie(o), s = qe(), p = Ae(), c = be();
|
|
2690
|
+
ue();
|
|
2691
|
+
const l = ae("webx-inbox"), S = ce(), n = q(null), f = q([]), M = q([]), C = q(!0), T = I(() => o.can("inbox.update")), U = I(() => Number(s.params.id)), A = I(() => ({
|
|
2692
|
+
view: typeof s.query.view == "string" ? s.query.view : void 0,
|
|
2693
|
+
search: typeof s.query.search == "string" ? s.query.search : void 0,
|
|
2694
|
+
assignee: typeof s.query.assignee == "string" ? s.query.assignee : void 0
|
|
2695
|
+
})), d = I(() => ({ path: i.base, query: { ...s.query } })), y = I(
|
|
2696
|
+
() => f.value.map((g) => ({ value: g.id, label: F(g) }))
|
|
2697
|
+
), w = I(
|
|
2698
|
+
() => M.value.map((g) => ({ value: g.id, label: g.name }))
|
|
2699
|
+
);
|
|
2700
|
+
function F(g) {
|
|
2701
|
+
return re(g.title, c.active.value, g.key);
|
|
2702
|
+
}
|
|
2703
|
+
const W = I(() => l("panel.submission", { id: String(U.value) })), H = I(() => {
|
|
2704
|
+
const g = n.value?.form;
|
|
2705
|
+
return g === void 0 ? "" : re(g.title ?? {}, c.active.value, g.slug ?? "");
|
|
2706
|
+
}), D = I(() => (n.value?.values ?? []).find((z) => z.type === "email" && (z.value ?? "") !== "")?.value ?? null), N = I(() => {
|
|
2707
|
+
if (D.value === null) return null;
|
|
2708
|
+
const g = encodeURIComponent(`${H.value} — ${W.value}`);
|
|
2709
|
+
return `mailto:${D.value}?subject=${g}`;
|
|
2710
|
+
});
|
|
2711
|
+
async function L() {
|
|
2712
|
+
C.value = !0;
|
|
2713
|
+
try {
|
|
2714
|
+
n.value = await m.submission(U.value, A.value);
|
|
2715
|
+
} catch (g) {
|
|
2716
|
+
B.danger(S(g)), p.replace(d.value);
|
|
2717
|
+
} finally {
|
|
2718
|
+
C.value = !1;
|
|
2719
|
+
}
|
|
2720
|
+
}
|
|
2721
|
+
async function x() {
|
|
2722
|
+
try {
|
|
2723
|
+
f.value = await m.statuses(), T.value && (M.value = await m.recipients());
|
|
2724
|
+
} catch (g) {
|
|
2725
|
+
B.danger(S(g));
|
|
2726
|
+
}
|
|
2727
|
+
}
|
|
2728
|
+
ke(U, () => {
|
|
2729
|
+
L();
|
|
2730
|
+
}, { immediate: !0 }), x();
|
|
2731
|
+
async function V(g) {
|
|
2732
|
+
try {
|
|
2733
|
+
n.value = await m.saveSubmission(U.value, g), B.success(l("panel.saved"));
|
|
2734
|
+
} catch (v) {
|
|
2735
|
+
B.danger(S(v)), await L();
|
|
2736
|
+
}
|
|
2737
|
+
}
|
|
2738
|
+
function Q(g) {
|
|
2739
|
+
typeof g == "number" && V({ status_id: g });
|
|
2740
|
+
}
|
|
2741
|
+
function j(g) {
|
|
2742
|
+
V({ assignee_id: typeof g == "number" ? g : null });
|
|
2743
|
+
}
|
|
2744
|
+
const pe = I(() => !T.value || n.value === null ? [] : [
|
|
2745
|
+
{
|
|
2746
|
+
key: "unread",
|
|
2747
|
+
icon: "eye-off",
|
|
2748
|
+
label: l("panel.mark-unread"),
|
|
2749
|
+
run: () => {
|
|
2750
|
+
Ve();
|
|
2751
|
+
}
|
|
2752
|
+
},
|
|
2753
|
+
{
|
|
2754
|
+
key: "delete",
|
|
2755
|
+
icon: "trash",
|
|
2756
|
+
label: l("panel.delete"),
|
|
2757
|
+
danger: !0,
|
|
2758
|
+
run: () => {
|
|
2759
|
+
G();
|
|
2760
|
+
}
|
|
2761
|
+
}
|
|
2762
|
+
]);
|
|
2763
|
+
async function Ve() {
|
|
2764
|
+
try {
|
|
2765
|
+
await m.massSubmissions({ ids: [U.value], action: "unread" }), p.push(d.value);
|
|
2766
|
+
} catch (g) {
|
|
2767
|
+
B.danger(S(g));
|
|
2768
|
+
}
|
|
2769
|
+
}
|
|
2770
|
+
async function G() {
|
|
2771
|
+
if (await ze({
|
|
2772
|
+
title: l("panel.delete-submission-title"),
|
|
2773
|
+
message: l("panel.delete-submission-text"),
|
|
2774
|
+
confirmText: l("panel.delete"),
|
|
2775
|
+
cancelText: l("panel.cancel"),
|
|
2776
|
+
tone: "danger"
|
|
2777
|
+
}))
|
|
2778
|
+
try {
|
|
2779
|
+
await m.removeSubmission(U.value), B.success(l("panel.deleted")), p.push(d.value);
|
|
2780
|
+
} catch (v) {
|
|
2781
|
+
B.danger(S(v));
|
|
2782
|
+
}
|
|
2783
|
+
}
|
|
2784
|
+
function k(g) {
|
|
2785
|
+
g !== null && p.push({ path: `${i.base}/submissions/${g}`, query: { ...s.query } });
|
|
2786
|
+
}
|
|
2787
|
+
function $(g) {
|
|
2788
|
+
const v = f.value.find((z) => z.key === g);
|
|
2789
|
+
return v === void 0 ? g : F(v);
|
|
2790
|
+
}
|
|
2791
|
+
function ne(g) {
|
|
2792
|
+
switch (g.type) {
|
|
2793
|
+
case "created":
|
|
2794
|
+
return l("panel.event-created");
|
|
2795
|
+
case "status":
|
|
2796
|
+
return l("panel.event-status", { to: $(g.to ?? "") });
|
|
2797
|
+
case "assignee":
|
|
2798
|
+
return g.to === null || g.to === "" ? l("panel.event-unassigned") : l("panel.event-assignee", { to: g.to });
|
|
2799
|
+
case "note":
|
|
2800
|
+
return l("panel.event-note");
|
|
2801
|
+
case "notified":
|
|
2802
|
+
return l("panel.event-notified");
|
|
2803
|
+
default:
|
|
2804
|
+
return g.type;
|
|
2805
|
+
}
|
|
2806
|
+
}
|
|
2807
|
+
function fe(g) {
|
|
2808
|
+
return `${Math.max(1, Math.round(g / 1024))} KB`;
|
|
2809
|
+
}
|
|
2810
|
+
const Le = I(() => {
|
|
2811
|
+
const g = n.value?.meta ?? {}, v = [];
|
|
2812
|
+
typeof g.page == "string" && g.page !== "" && v.push({ label: l("panel.meta-page"), value: g.page, link: !0 }), typeof g.referrer == "string" && g.referrer !== "" && v.push({ label: l("panel.meta-referrer"), value: g.referrer, link: !0 });
|
|
2813
|
+
for (const [z, E] of Object.entries(g.utm ?? {}))
|
|
2814
|
+
v.push({ label: z, value: String(E) });
|
|
2815
|
+
return typeof g.locale == "string" && g.locale !== "" && v.push({ label: l("panel.meta-locale"), value: g.locale }), typeof g.ip == "string" && g.ip !== "" && v.push({ label: l("panel.meta-ip"), value: g.ip }), typeof g.user_agent == "string" && g.user_agent !== "" && v.push({ label: l("panel.meta-agent"), value: g.user_agent }), v;
|
|
2816
|
+
});
|
|
2817
|
+
return (g, v) => (u(), K("div", xt, [
|
|
2818
|
+
P("div", _t, [
|
|
2819
|
+
t(e(Ee), { to: d.value }, null, 8, ["to"]),
|
|
2820
|
+
P("div", wt, [
|
|
2821
|
+
t(e(Xe), {
|
|
2822
|
+
level: 2,
|
|
2823
|
+
truncate: ""
|
|
2824
|
+
}, {
|
|
2825
|
+
default: a(() => [
|
|
2826
|
+
_(b(W.value), 1)
|
|
2827
|
+
]),
|
|
2828
|
+
_: 1
|
|
2829
|
+
}),
|
|
2830
|
+
t(e(Z), {
|
|
2831
|
+
size: "sm",
|
|
2832
|
+
tone: "muted",
|
|
2833
|
+
truncate: ""
|
|
2834
|
+
}, {
|
|
2835
|
+
default: a(() => [
|
|
2836
|
+
_(b(H.value), 1)
|
|
2837
|
+
]),
|
|
2838
|
+
_: 1
|
|
2839
|
+
})
|
|
2840
|
+
]),
|
|
2841
|
+
t(e(ge), {
|
|
2842
|
+
icon: "chevron-left",
|
|
2843
|
+
title: e(l)("panel.previous"),
|
|
2844
|
+
disabled: !n.value?.previous_id,
|
|
2845
|
+
onClick: v[0] || (v[0] = (z) => k(n.value?.previous_id ?? null))
|
|
2846
|
+
}, null, 8, ["title", "disabled"]),
|
|
2847
|
+
t(e(ge), {
|
|
2848
|
+
icon: "chevron-right",
|
|
2849
|
+
title: e(l)("panel.next"),
|
|
2850
|
+
disabled: !n.value?.next_id,
|
|
2851
|
+
onClick: v[1] || (v[1] = (z) => k(n.value?.next_id ?? null))
|
|
2852
|
+
}, null, 8, ["title", "disabled"]),
|
|
2853
|
+
N.value ? (u(), h(e(Y), {
|
|
2854
|
+
key: 0,
|
|
2855
|
+
variant: "outline",
|
|
2856
|
+
icon: "mail",
|
|
2857
|
+
href: N.value
|
|
2858
|
+
}, {
|
|
2859
|
+
default: a(() => [
|
|
2860
|
+
_(b(e(l)("panel.reply")), 1)
|
|
2861
|
+
]),
|
|
2862
|
+
_: 1
|
|
2863
|
+
}, 8, ["href"])) : O("", !0),
|
|
2864
|
+
t(e(we), {
|
|
2865
|
+
actions: pe.value,
|
|
2866
|
+
label: W.value
|
|
2867
|
+
}, null, 8, ["actions", "label"])
|
|
2868
|
+
]),
|
|
2869
|
+
C.value ? (u(), h(e(De), {
|
|
2870
|
+
key: 0,
|
|
2871
|
+
rows: 6
|
|
2872
|
+
})) : n.value ? (u(), K("div", kt, [
|
|
2873
|
+
P("div", Vt, [
|
|
2874
|
+
t(e(ee), {
|
|
2875
|
+
title: e(l)("panel.answers")
|
|
2876
|
+
}, {
|
|
2877
|
+
default: a(() => [
|
|
2878
|
+
n.value.values.length === 0 ? (u(), h(e(Se), {
|
|
2879
|
+
key: 0,
|
|
2880
|
+
size: "sm",
|
|
2881
|
+
description: e(l)("panel.no-answers")
|
|
2882
|
+
}, null, 8, ["description"])) : (u(), h(e(Ge), {
|
|
2883
|
+
key: 1,
|
|
2884
|
+
columns: 1,
|
|
2885
|
+
layout: "vertical"
|
|
2886
|
+
}, {
|
|
2887
|
+
default: a(() => [
|
|
2888
|
+
(u(!0), K(X, null, ye(n.value.values, (z) => (u(), h(e(Te), {
|
|
2889
|
+
key: z.id,
|
|
2890
|
+
label: z.label ?? z.name
|
|
2891
|
+
}, {
|
|
2892
|
+
default: a(() => [
|
|
2893
|
+
P("p", $t, b(z.value || "—"), 1)
|
|
2894
|
+
]),
|
|
2895
|
+
_: 2
|
|
2896
|
+
}, 1032, ["label"]))), 128))
|
|
2897
|
+
]),
|
|
2898
|
+
_: 1
|
|
2899
|
+
}))
|
|
2900
|
+
]),
|
|
2901
|
+
_: 1
|
|
2902
|
+
}, 8, ["title"]),
|
|
2903
|
+
n.value.files.length > 0 ? (u(), h(e(ee), {
|
|
2904
|
+
key: 0,
|
|
2905
|
+
title: e(l)("panel.attachments")
|
|
2906
|
+
}, {
|
|
2907
|
+
default: a(() => [
|
|
2908
|
+
P("div", Ut, [
|
|
2909
|
+
(u(!0), K(X, null, ye(n.value.files, (z) => (u(), h(e(fl), {
|
|
2910
|
+
key: z.id,
|
|
2911
|
+
name: z.name,
|
|
2912
|
+
type: z.mime ?? void 0,
|
|
2913
|
+
"download-url": z.url,
|
|
2914
|
+
"download-label": e(l)("panel.download"),
|
|
2915
|
+
size: "sm"
|
|
2916
|
+
}, {
|
|
2917
|
+
meta: a(() => [
|
|
2918
|
+
_(b(fe(z.size)), 1)
|
|
2919
|
+
]),
|
|
2920
|
+
_: 2
|
|
2921
|
+
}, 1032, ["name", "type", "download-url", "download-label"]))), 128))
|
|
2922
|
+
])
|
|
2923
|
+
]),
|
|
2924
|
+
_: 1
|
|
2925
|
+
}, 8, ["title"])) : O("", !0),
|
|
2926
|
+
t(e(ee), null, {
|
|
2927
|
+
default: a(() => [
|
|
2928
|
+
t(e(nl), {
|
|
2929
|
+
id: n.value.id,
|
|
2930
|
+
type: "inbox_submission",
|
|
2931
|
+
can: T.value,
|
|
2932
|
+
onChange: L
|
|
2933
|
+
}, null, 8, ["id", "can"])
|
|
2934
|
+
]),
|
|
2935
|
+
_: 1
|
|
2936
|
+
})
|
|
2937
|
+
]),
|
|
2938
|
+
P("aside", St, [
|
|
2939
|
+
t(e(ee), null, {
|
|
2940
|
+
default: a(() => [
|
|
2941
|
+
P("div", Ct, [
|
|
2942
|
+
P("label", zt, [
|
|
2943
|
+
t(e(Z), {
|
|
2944
|
+
size: "sm",
|
|
2945
|
+
tone: "muted"
|
|
2946
|
+
}, {
|
|
2947
|
+
default: a(() => [
|
|
2948
|
+
_(b(e(l)("panel.status")), 1)
|
|
2949
|
+
]),
|
|
2950
|
+
_: 1
|
|
2951
|
+
}),
|
|
2952
|
+
t(e(ve), {
|
|
2953
|
+
"model-value": n.value.status?.id ?? null,
|
|
2954
|
+
options: y.value,
|
|
2955
|
+
disabled: !T.value,
|
|
2956
|
+
"onUpdate:modelValue": Q
|
|
2957
|
+
}, null, 8, ["model-value", "options", "disabled"])
|
|
2958
|
+
]),
|
|
2959
|
+
P("label", Tt, [
|
|
2960
|
+
t(e(Z), {
|
|
2961
|
+
size: "sm",
|
|
2962
|
+
tone: "muted"
|
|
2963
|
+
}, {
|
|
2964
|
+
default: a(() => [
|
|
2965
|
+
_(b(e(l)("panel.assignee")), 1)
|
|
2966
|
+
]),
|
|
2967
|
+
_: 1
|
|
2968
|
+
}),
|
|
2969
|
+
t(e(ve), {
|
|
2970
|
+
"model-value": n.value.assignee?.id ?? null,
|
|
2971
|
+
options: w.value,
|
|
2972
|
+
disabled: !T.value,
|
|
2973
|
+
clearable: "",
|
|
2974
|
+
placeholder: e(l)("panel.unassigned"),
|
|
2975
|
+
"onUpdate:modelValue": j
|
|
2976
|
+
}, null, 8, ["model-value", "options", "disabled", "placeholder"])
|
|
2977
|
+
])
|
|
2978
|
+
])
|
|
2979
|
+
]),
|
|
2980
|
+
_: 1
|
|
2981
|
+
}),
|
|
2982
|
+
t(e(ee), {
|
|
2983
|
+
title: e(l)("panel.details")
|
|
2984
|
+
}, {
|
|
2985
|
+
default: a(() => [
|
|
2986
|
+
P("div", Ft, [
|
|
2987
|
+
t(e(Ge), {
|
|
2988
|
+
columns: 1,
|
|
2989
|
+
layout: "vertical",
|
|
2990
|
+
size: "sm"
|
|
2991
|
+
}, {
|
|
2992
|
+
default: a(() => [
|
|
2993
|
+
t(e(Te), {
|
|
2994
|
+
label: e(l)("panel.received")
|
|
2995
|
+
}, {
|
|
2996
|
+
default: a(() => [
|
|
2997
|
+
t(e(Pe), {
|
|
2998
|
+
value: n.value.created_at,
|
|
2999
|
+
tone: "default"
|
|
3000
|
+
}, null, 8, ["value"])
|
|
3001
|
+
]),
|
|
3002
|
+
_: 1
|
|
3003
|
+
}, 8, ["label"]),
|
|
3004
|
+
t(e(Te), {
|
|
3005
|
+
label: e(l)("panel.meta-source")
|
|
3006
|
+
}, {
|
|
3007
|
+
default: a(() => [
|
|
3008
|
+
t(e(xe), {
|
|
3009
|
+
type: n.value.source === "panel" ? "info" : "default"
|
|
3010
|
+
}, {
|
|
3011
|
+
default: a(() => [
|
|
3012
|
+
_(b(n.value.source === "panel" ? e(l)("panel.source-panel") : e(l)("panel.source-web")), 1)
|
|
3013
|
+
]),
|
|
3014
|
+
_: 1
|
|
3015
|
+
}, 8, ["type"])
|
|
3016
|
+
]),
|
|
3017
|
+
_: 1
|
|
3018
|
+
}, 8, ["label"]),
|
|
3019
|
+
(u(!0), K(X, null, ye(Le.value, (z) => (u(), h(e(Te), {
|
|
3020
|
+
key: z.label,
|
|
3021
|
+
label: z.label
|
|
3022
|
+
}, {
|
|
3023
|
+
default: a(() => [
|
|
3024
|
+
z.link ? (u(), K("a", {
|
|
3025
|
+
key: 0,
|
|
3026
|
+
href: z.value,
|
|
3027
|
+
target: "_blank",
|
|
3028
|
+
rel: "noreferrer"
|
|
3029
|
+
}, b(z.value), 9, Wt)) : (u(), K("span", qt, b(z.value), 1))
|
|
3030
|
+
]),
|
|
3031
|
+
_: 2
|
|
3032
|
+
}, 1032, ["label"]))), 128))
|
|
3033
|
+
]),
|
|
3034
|
+
_: 1
|
|
3035
|
+
}),
|
|
3036
|
+
n.value.notify_error ? (u(), h(e(Fe), {
|
|
3037
|
+
key: 0,
|
|
3038
|
+
type: "warning",
|
|
3039
|
+
closable: !1
|
|
3040
|
+
}, {
|
|
3041
|
+
default: a(() => [
|
|
3042
|
+
_(b(e(l)("panel.notify-failed")), 1)
|
|
3043
|
+
]),
|
|
3044
|
+
_: 1
|
|
3045
|
+
})) : n.value.notified_at ? (u(), h(e(Z), {
|
|
3046
|
+
key: 1,
|
|
3047
|
+
size: "sm",
|
|
3048
|
+
tone: "muted"
|
|
3049
|
+
}, {
|
|
3050
|
+
default: a(() => [
|
|
3051
|
+
_(b(e(l)("panel.notified")), 1)
|
|
3052
|
+
]),
|
|
3053
|
+
_: 1
|
|
3054
|
+
})) : (u(), h(e(Z), {
|
|
3055
|
+
key: 2,
|
|
3056
|
+
size: "sm",
|
|
3057
|
+
tone: "muted"
|
|
3058
|
+
}, {
|
|
3059
|
+
default: a(() => [
|
|
3060
|
+
_(b(e(l)("panel.not-notified")), 1)
|
|
3061
|
+
]),
|
|
3062
|
+
_: 1
|
|
3063
|
+
}))
|
|
3064
|
+
])
|
|
3065
|
+
]),
|
|
3066
|
+
_: 1
|
|
3067
|
+
}, 8, ["title"]),
|
|
3068
|
+
t(e(ee), {
|
|
3069
|
+
title: e(l)("panel.log")
|
|
3070
|
+
}, {
|
|
3071
|
+
default: a(() => [
|
|
3072
|
+
t(e(bl), { size: "sm" }, {
|
|
3073
|
+
default: a(() => [
|
|
3074
|
+
(u(!0), K(X, null, ye(n.value.events, (z) => (u(), h(e(hl), {
|
|
3075
|
+
key: z.id
|
|
3076
|
+
}, {
|
|
3077
|
+
default: a(() => [
|
|
3078
|
+
t(e(Z), {
|
|
3079
|
+
size: "sm",
|
|
3080
|
+
as: "p",
|
|
3081
|
+
class: "wx-submission__event"
|
|
3082
|
+
}, {
|
|
3083
|
+
default: a(() => [
|
|
3084
|
+
_(b(ne(z)), 1)
|
|
3085
|
+
]),
|
|
3086
|
+
_: 2
|
|
3087
|
+
}, 1024),
|
|
3088
|
+
P("p", At, [
|
|
3089
|
+
t(e(Z), {
|
|
3090
|
+
size: "sm",
|
|
3091
|
+
tone: "muted"
|
|
3092
|
+
}, {
|
|
3093
|
+
default: a(() => [
|
|
3094
|
+
_(b(z.author?.name ?? e(l)("panel.system")), 1)
|
|
3095
|
+
]),
|
|
3096
|
+
_: 2
|
|
3097
|
+
}, 1024),
|
|
3098
|
+
t(e(Pe), {
|
|
3099
|
+
value: z.created_at
|
|
3100
|
+
}, null, 8, ["value"])
|
|
3101
|
+
])
|
|
3102
|
+
]),
|
|
3103
|
+
_: 2
|
|
3104
|
+
}, 1024))), 128))
|
|
3105
|
+
]),
|
|
3106
|
+
_: 1
|
|
3107
|
+
})
|
|
3108
|
+
]),
|
|
3109
|
+
_: 1
|
|
3110
|
+
}, 8, ["title"])
|
|
3111
|
+
])
|
|
3112
|
+
])) : O("", !0)
|
|
3113
|
+
]));
|
|
3114
|
+
}
|
|
3115
|
+
}), It = /* @__PURE__ */ oe(Nt, [["__scopeId", "data-v-6b6abbf9"]]);
|
|
3116
|
+
function Pt(r = {}) {
|
|
3117
|
+
const i = r.path ?? "/inbox";
|
|
3118
|
+
return {
|
|
3119
|
+
id: "inbox",
|
|
3120
|
+
path: i,
|
|
3121
|
+
landing: r.landing ?? !0,
|
|
3122
|
+
routes: [
|
|
3123
|
+
// The section's own path travels as a prop, so a panel that mounted it somewhere else
|
|
3124
|
+
// still links between its screens correctly.
|
|
3125
|
+
{ path: i, name: "webx.inbox", component: ct, props: { base: i } },
|
|
3126
|
+
{
|
|
3127
|
+
path: `${i}/statuses`,
|
|
3128
|
+
name: "webx.inbox.statuses",
|
|
3129
|
+
component: gt,
|
|
3130
|
+
props: { base: i }
|
|
3131
|
+
},
|
|
3132
|
+
{
|
|
3133
|
+
path: `${i}/forms/:id(\\d+)`,
|
|
3134
|
+
name: "webx.inbox.form",
|
|
3135
|
+
component: Zl,
|
|
3136
|
+
props: { base: i }
|
|
3137
|
+
},
|
|
3138
|
+
// A submission has an address of its own, not a dialog over the list (§11): it goes in
|
|
3139
|
+
// the mail to whoever deals with it, it gets pasted into a chat, an agent links to it.
|
|
3140
|
+
{
|
|
3141
|
+
path: `${i}/submissions/:id(\\d+)`,
|
|
3142
|
+
name: "webx.inbox.submission",
|
|
3143
|
+
component: It,
|
|
3144
|
+
props: { base: i }
|
|
3145
|
+
}
|
|
3146
|
+
]
|
|
3147
|
+
};
|
|
3148
|
+
}
|
|
3149
|
+
export {
|
|
3150
|
+
gl as FIELD_TYPES,
|
|
3151
|
+
xl as STATUS_COLORS,
|
|
3152
|
+
Fl as WxInboxFieldList,
|
|
3153
|
+
Zl as WxInboxFormEditor,
|
|
3154
|
+
ct as WxInboxPage,
|
|
3155
|
+
gt as WxInboxStatusesPage,
|
|
3156
|
+
ut as WxInboxSubmissionList,
|
|
3157
|
+
It as WxInboxSubmissionPage,
|
|
3158
|
+
ie as createInboxApi,
|
|
3159
|
+
Pt as inbox,
|
|
3160
|
+
yl as inboxMessages,
|
|
3161
|
+
de as option
|
|
3162
|
+
};
|
|
3163
|
+
//# sourceMappingURL=index.js.map
|