@webx-ui/module-inbox 0.11.5 → 0.12.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.
@@ -1,1807 +0,0 @@
1
- import { inject as Qe, defineComponent as oe, useModel as Fe, computed as A, ref as U, watch as ge, openBlock as m, createElementBlock as M, createElementVNode as G, toDisplayString as I, createCommentVNode as W, createBlock as _, unref as e, withCtx as d, createTextVNode as z, createVNode as u, mergeModels as Ie, nextTick as Je, isRef as Pe, Fragment as Z, renderList as Oe, useTemplateRef as et, createSlots as Le, mergeProps as tt, defineAsyncComponent as _e } from "vue";
2
- import { useLocales as ie, localizedValue as pe, WxBadge as xe, WxAction as De, WxAutocomplete as lt, useModal as Me, WxDialog as He, WxAlert as Ne, WxSkeleton as at, WxFormItem as L, WxTextarea as nt, WxSelect as we, WxRadioGroup as st, WxCheckboxGroup as ot, WxCheckbox as se, WxDatePicker as Ue, WxInput as K, WxSpace as Xe, WxButton as te, toast as j, useElementWidth as it, createModal as Ge, WxTabs as rt, WxTable as ut, WxEntityCard as dt, WxAvatar as qe, WxIcon as ke, WxTooltip as ct, WxText as ee, confirm as Ye, WxLocales as mt, WxRichText as ze, WxInputNumber as me, WxTagsInput as pt, WxCard as ht, WxEmpty as ft, WxSortableList as vt } from "@webx-ui/core";
3
- import { useAdmin as re, i18nKey as bt, useTranslate as le, createRelationsApi as yt, useErrorText as Ve, rowMenuWidth as gt, WxScreenHead as xt, WxRowMenu as We, WxDate as Re, WxFilterChips as wt, useRichTextLabels as kt, useShortcodesWhen as _t, useRemoveConfirm as Vt, slugify as Tt } from "@webx-ui/module-admin";
4
- import { useRoute as $t, useRouter as St } from "vue-router";
5
- const At = {
6
- module: {
7
- title: "Inbox"
8
- },
9
- panel: {
10
- forms: "Forms",
11
- "new-form": "New form",
12
- "no-forms": "No forms yet.",
13
- "no-forms-help": "A form is a few questions and a list of who hears the answers.",
14
- unread: "Unread",
15
- submissions: "Submissions in all",
16
- off: "Off",
17
- settings: "Settings",
18
- duplicate: "Duplicate",
19
- delete: "Delete",
20
- "delete-form-title": "Delete “:form”?",
21
- "delete-form-text": "The form and its questions go. This cannot be undone.",
22
- cancel: "Cancel",
23
- save: "Save",
24
- saved: "Saved.",
25
- deleted: "Deleted.",
26
- duplicated: "A copy was made.",
27
- failed: "Some values were not accepted. Check the highlighted fields.",
28
- "reorder-failed": "The new order could not be saved.",
29
- reorder: "Reorder",
30
- "new-form-title": "New form",
31
- title: "Title",
32
- description: "Description",
33
- "description-help": "A line under the title of the form on the site and in a dialog. Empty — nothing is shown.",
34
- slug: "Address",
35
- "slug-help": "What the form is called on the site and where it posts.",
36
- "is-enabled": "Active",
37
- "is-enabled-help": "A form that is off is neither drawn nor accepted.",
38
- "tab-general": "General",
39
- "tab-fields": "Fields",
40
- "tab-notifications": "Notifications",
41
- "tab-antispam": "Antispam",
42
- "tab-embed": "Embedding",
43
- "after-sending": "After sending",
44
- "thank-you-heading": "Heading",
45
- "thank-you-text": "Text",
46
- "submit-text": "Text on the button",
47
- redirect: "Instead of the thank-you, go to",
48
- "redirect-help": "A page of the site opens in the language the form was sent in, or in the main one when it has no translation. Nowhere — the thank-you takes the form’s place.",
49
- recipients: "Who is written to",
50
- "recipients-help": "Nobody here means nobody is told. The submission is kept either way.",
51
- "mail-route": "Letters leave through",
52
- "no-recipients": "Nobody yet.",
53
- "add-admin": "Add an administrator",
54
- "add-email": "Add an address",
55
- remove: "Remove",
56
- "remove-recipient-title": "Remove this recipient?",
57
- "remove-recipient-text": "They stop being told when something arrives.",
58
- "email-field": "Field with the visitor’s address",
59
- "email-field-help": "A reply to the letter goes to this address.",
60
- "email-field-help-channels": "A reply to the letter goes to this address; in channels it is {{reply_to}}.",
61
- "notify-via": "How to tell about a submission",
62
- "via-email": "By letter to addresses",
63
- "via-channels": "Through notification channels",
64
- "notify-through": "Notify through",
65
- "notify-through-help": "Channels of the Notifications section: Telegram, e-mail and others. A submission from the site goes to each of them by its own template.",
66
- "pick-channels": "Add a channel",
67
- "no-channels": "No channels chosen.",
68
- "no-channels-yet": "No channels yet.",
69
- "set-up-channels": "Set up channels",
70
- channels: "Channels",
71
- "channels-none": "Nothing was sent through channels.",
72
- "channels-failed": "A channel did not deliver the notification",
73
- "no-email-field": "None",
74
- honeypot: "Hidden field",
75
- "honeypot-help": "A field nobody sees and a robot fills in.",
76
- "min-seconds": "Fastest a person could send it, in seconds",
77
- "min-seconds-help": "Zero switches the check off.",
78
- throttle: "Sends a minute from one address",
79
- "throttle-help": "Zero switches the limit off.",
80
- captcha: "Captcha",
81
- "captcha-keys": "The keys are not set in the panel but in the site’s .env: WEBX_INBOX_RECAPTCHA_KEY / WEBX_INBOX_RECAPTCHA_SECRET for reCAPTCHA, WEBX_INBOX_TURNSTILE_KEY / WEBX_INBOX_TURNSTILE_SECRET for Turnstile.",
82
- "captcha-off": "Off",
83
- "captcha-recaptcha": "reCAPTCHA",
84
- "captcha-turnstile": "Turnstile",
85
- "captcha-unconfigured": "The site has no keys for this captcha yet, so the form refuses every submission until they are in its .env.",
86
- "captcha-recaptcha-checkbox": "This site draws reCAPTCHA as the “I’m not a robot” checkbox, so its keys must be v2 Checkbox keys. To run it invisibly, create v2 Invisible keys and set WEBX_INBOX_RECAPTCHA_TYPE=invisible.",
87
- "captcha-recaptcha-invisible": "This site runs reCAPTCHA invisibly when the form is sent, so its keys must be v2 Invisible keys (WEBX_INBOX_RECAPTCHA_TYPE=invisible).",
88
- "captcha-recaptcha-v3": "This site runs reCAPTCHA v3: no widget, only a score checked when the form is sent, so its keys must be v3 keys (WEBX_INBOX_RECAPTCHA_TYPE=v3).",
89
- "captcha-turnstile-checkbox": "This site draws Turnstile when the page opens, and a Managed widget shows visitors “Verify you are human”. To run it invisibly, set WEBX_INBOX_TURNSTILE_MODE=invisible and the widget mode to Invisible in Cloudflare.",
90
- "captcha-turnstile-invisible": "This site runs Turnstile invisibly when the form is sent. Set the widget mode to Invisible in Cloudflare: a Managed widget still shows a challenge when it decides one is needed.",
91
- "embed-blade": "On a page of the site",
92
- "embed-blade-help": "Put the tag where the form belongs. The markup is published and rewritten by the site.",
93
- "embed-block": "In the block builder",
94
- "embed-block-help": "A block type prints the same tag, so an editor drops the form in without touching a template.",
95
- "embed-block-panel-help": "On this site block templates are written in the panel, in Blocks: put the same tag into the template of a block there.",
96
- "embed-extras": "Filled in and placed",
97
- "embed-extras-help": ":values fills the hidden fields by their name; placement names where the form stands, so the submission remembers it and the site can style each place.",
98
- loading: "Loading…",
99
- "embed-names": "Names of the fields",
100
- "embed-names-help": "A hidden field is filled in by the page: the address it was sent from, a product, a campaign.",
101
- copy: "Copy",
102
- copied: "Copied.",
103
- statuses: "Statuses",
104
- "new-status": "New status",
105
- "status-key": "Key",
106
- "status-color": "Colour",
107
- "status-default": "Given to a new submission",
108
- "status-spam": "Spam",
109
- "status-closed": "Nothing further expected",
110
- "in-use": "In use",
111
- "delete-status-title": "Delete “:status”?",
112
- "delete-status-text": "Only a status nothing is in can go.",
113
- "no-statuses": "No statuses yet.",
114
- "color-default": "Grey",
115
- "color-primary": "Blue",
116
- "color-success": "Green",
117
- "color-warning": "Amber",
118
- "color-info": "Cyan",
119
- "color-danger": "Red",
120
- // The submissions: the list on the right of the section, and one of them opened.
121
- id: "ID",
122
- received: "Received",
123
- status: "Status",
124
- assignee: "Assignee",
125
- unassigned: "Nobody",
126
- "submissions-empty": "Nothing has come in through this form yet.",
127
- "search-submissions": "Search the answers",
128
- "view-all": "All",
129
- "view-unread": "Unread",
130
- export: "Export",
131
- "new-submission": "New submission",
132
- "new-submission-title": "A submission by hand",
133
- "new-submission-help": "For one that came by telephone or on paper. It is written the same way and lands in the same list.",
134
- created: "Added.",
135
- submission: "Submission :id",
136
- previous: "Previous",
137
- next: "Next",
138
- "mark-read": "Mark as read",
139
- "mark-unread": "Mark as unread",
140
- "delete-submission-title": "Delete this submission?",
141
- "delete-submission-text": "It goes with its attachments. This cannot be undone.",
142
- selected: ":count selected",
143
- "move-to": "Move to",
144
- "delete-selected-title": "Delete :count submissions?",
145
- answers: "Answers",
146
- attachments: "Attachments",
147
- details: "Details",
148
- "meta-page": "Page",
149
- "meta-placement": "Placement",
150
- "any-placement": "Any placement",
151
- "placement-none": "Not specified",
152
- "meta-referrer": "Came from",
153
- "meta-ip": "Address",
154
- "meta-agent": "Browser",
155
- "meta-locale": "Language",
156
- "meta-source": "How it arrived",
157
- "source-web": "From the site",
158
- "source-panel": "Typed in",
159
- notified: "The notification went out",
160
- "not-notified": "No notification was sent",
161
- "notify-failed": "The notification could not be sent",
162
- reply: "Reply by mail",
163
- log: "What has happened",
164
- "event-created": "Arrived",
165
- "event-status": "Status: :to",
166
- "event-assignee": "Given to :to",
167
- "event-unassigned": "Left to nobody",
168
- "event-note": "A note was added",
169
- "event-notified": "The notification went out",
170
- "event-handled": "Handed to :name",
171
- "event-handler-error": ":name failed: :error",
172
- system: "System",
173
- "no-answers": "Nothing was filled in.",
174
- download: "Download",
175
- "no-files-by-hand": "A file cannot be attached by hand: the files a submission carries are what was posted with it.",
176
- "submissions-none": "Nothing here under this filter.",
177
- "notifies-nobody": "Nobody is told about this form",
178
- "notifies-nobody-text": "Every submission is kept here, but no letter goes out. Add a recipient on the Notifications tab.",
179
- "notifies-nobody-short": "Nobody is told",
180
- "recipient-admin_deleted": "This administrator no longer exists and gets no letter.",
181
- "recipient-admin_inactive": "This administrator is switched off and gets no letter.",
182
- "recipient-invalid_email": "This is not an e-mail address.",
183
- "event-no-recipients": "Nobody was told: the form names no recipients",
184
- "notified-nobody": "No notification: the form names nobody to tell",
185
- "notify-queued": "The notification is waiting in the queue",
186
- "notify-again": "Send the notification again",
187
- "notify-sent-again": "The notification has been sent again",
188
- "notify-recipient-queued": "waiting",
189
- "notify-recipient-delivered": "sent",
190
- "notify-recipient-failed": "failed",
191
- "notify-recipient-trapped": "test transport",
192
- "event-notify-queued": "The notification was queued",
193
- "event-notify-failed": "The notification to :to failed",
194
- "event-value": "Answer “:field” corrected: “:from” → “:to”"
195
- },
196
- fields: {
197
- field: "Field",
198
- "new-field": "New field",
199
- "edit-field": "Field",
200
- edit: "Edit",
201
- "no-fields": "No questions yet.",
202
- "no-fields-help": "A form with no fields draws nothing on the page.",
203
- "save-first": "Save the form first, then write its questions.",
204
- delete: "Delete",
205
- "delete-title": "Delete “:field”?",
206
- "delete-text": "It stops being asked. Answers already given keep it.",
207
- cancel: "Cancel",
208
- save: "Save",
209
- name: "Name",
210
- "name-help": "Needed for variables in notifications — {{field.:name}} — and for integrations. Usually there is no need to change it.",
211
- "name-renamed": "Templates of notification channels that use {{field.:old}} stop working — change them to {{field.:new}}. Answers already received stay with the field.",
212
- advanced: "Advanced",
213
- type: "Type",
214
- title: "Label",
215
- placeholder: "Placeholder",
216
- help: "Hint under the field",
217
- "is-enabled": "Shown",
218
- "is-required": "Required",
219
- "is-fullsize": "Full width",
220
- "in-table": "A column in the list",
221
- choices: "Choices",
222
- "choice-value": "Value",
223
- "choice-label": "Label",
224
- "add-choice": "Add a choice",
225
- "no-choices": "No choices yet. A field with none accepts nothing.",
226
- maxlength: "Longest answer, in characters",
227
- rows: "Height, in lines",
228
- pattern: "Pattern the answer has to match",
229
- "pattern-help": "The browser’s own, written without delimiters: [0-9+ ()-]{6,}",
230
- earliest: "Earliest date",
231
- latest: "Latest date",
232
- "min-choices": "Fewest ticks",
233
- "max-choices": "Most ticks",
234
- "consent-text": "The sentence beside the tick",
235
- "consent-text-help": "A link is allowed here: it is printed as written.",
236
- "max-size": "Largest file, in kilobytes",
237
- extensions: "Extensions allowed",
238
- "extensions-help": "Comma separated. Empty means the list the site allows.",
239
- multiple: "Several files at once",
240
- "type-text": "Text",
241
- "type-email": "E-mail",
242
- "type-tel": "Telephone",
243
- "type-textarea": "Long text",
244
- "type-select": "Drop-down",
245
- "type-radio": "One of several",
246
- "type-checkbox": "Several of several",
247
- "type-consent": "Consent",
248
- "type-date": "Date",
249
- "type-file": "File",
250
- "type-hidden": "Hidden"
251
- },
252
- relations: {
253
- form: "Form",
254
- "field-search": "Find a form by its name or address",
255
- "field-empty": "No form",
256
- "field-remove": "Remove the form",
257
- "field-missing": "No such form",
258
- "field-off": "Switched off",
259
- "field-nothing": "No form matches",
260
- "field-searching": "Searching…",
261
- unknown: "The Inbox has no form “:slug”. It has: :forms.",
262
- "unknown-none": "The Inbox has no form “:slug” — it has no forms yet."
263
- }
264
- }, Be = /* @__PURE__ */ new WeakSet();
265
- function he() {
266
- try {
267
- const { i18n: a } = re();
268
- Be.has(a) || (a.defaults("webx-inbox", At), Be.add(a));
269
- } catch {
270
- }
271
- }
272
- function Ct() {
273
- const a = Qe(bt, null), n = ie();
274
- return (c) => {
275
- const b = a?.state.locale;
276
- return (b === void 0 ? void 0 : c.title[b]) || pe(c.title, n.active.value, c.key);
277
- };
278
- }
279
- const Nt = { class: "wx-inbox-form-field" }, Ut = {
280
- key: 0,
281
- class: "wx-inbox-form-field__chosen"
282
- }, Wt = { class: "wx-inbox-form-field__text" }, Ft = { class: "wx-inbox-form-field__title" }, It = {
283
- key: 0,
284
- class: "wx-inbox-form-field__slug"
285
- }, Et = {
286
- key: 1,
287
- class: "wx-inbox-form-field__empty"
288
- }, qt = { class: "wx-inbox-form-field__search" }, zt = /* @__PURE__ */ oe({
289
- name: "WxInboxFormField",
290
- __name: "FormField",
291
- props: /* @__PURE__ */ Ie({
292
- disabled: { type: Boolean, default: !1 },
293
- placeholder: { default: void 0 },
294
- emptyText: { default: void 0 }
295
- }, {
296
- modelValue: { default: null },
297
- modelModifiers: {}
298
- }),
299
- emits: ["update:modelValue"],
300
- setup(a) {
301
- const n = a, c = Fe(a, "modelValue");
302
- he();
303
- const b = re(), w = le("webx-inbox"), B = yt(b, "inbox-form"), t = A(() => typeof c.value == "string" ? c.value.trim() : ""), l = U(/* @__PURE__ */ new Map()), g = U(/* @__PURE__ */ new Set()), S = U([]), N = U(!1), C = U("");
304
- function q(V) {
305
- const v = new Map(l.value);
306
- for (const T of V) T.slug && v.set(T.slug, T);
307
- l.value = v;
308
- }
309
- async function x(V) {
310
- if (!(V === "" || l.value.has(V) || g.value.has(V)))
311
- try {
312
- const v = await B.search(V);
313
- q(v), v.some((T) => T.slug === V) || (g.value = /* @__PURE__ */ new Set([...g.value, V]));
314
- } catch {
315
- }
316
- }
317
- ge(t, (V) => {
318
- x(V);
319
- }, { immediate: !0 });
320
- const p = A(() => t.value === "" ? null : l.value.get(t.value) ?? null), H = A(() => t.value === "" ? null : p.value === null ? g.value.has(t.value) ? w("relations.field-missing") : null : p.value.visible ? null : w("relations.field-off")), k = A(
321
- () => S.value.filter((V) => V.slug && V.slug !== t.value).map((V) => ({
322
- value: V.title,
323
- description: [V.slug, V.visible ? null : w("relations.field-off")].filter((v) => typeof v == "string" && v !== "").join(" · "),
324
- id: V.slug
325
- }))
326
- );
327
- async function y(V) {
328
- N.value = !0;
329
- try {
330
- const v = await B.search(V);
331
- S.value = v, q(v);
332
- } catch {
333
- S.value = [];
334
- } finally {
335
- N.value = !1;
336
- }
337
- }
338
- function $() {
339
- S.value.length === 0 && !N.value && y(C.value);
340
- }
341
- function E(V) {
342
- typeof V.id != "string" || V.id === "" || (c.value = V.id, Je(() => {
343
- C.value = "";
344
- }));
345
- }
346
- function P() {
347
- c.value = null;
348
- }
349
- const X = A(() => n.placeholder ?? w("relations.field-search"));
350
- return (V, v) => (m(), M("div", Nt, [
351
- t.value !== "" ? (m(), M("div", Ut, [
352
- G("span", Wt, [
353
- G("span", Ft, I(p.value?.title ?? t.value), 1),
354
- p.value ? (m(), M("span", It, I(t.value), 1)) : W("", !0)
355
- ]),
356
- H.value ? (m(), _(e(xe), {
357
- key: 0,
358
- type: "warning"
359
- }, {
360
- default: d(() => [
361
- z(I(H.value), 1)
362
- ]),
363
- _: 1
364
- })) : W("", !0),
365
- n.disabled ? W("", !0) : (m(), _(e(De), {
366
- key: 1,
367
- type: "remove",
368
- size: "sm",
369
- title: e(w)("relations.field-remove"),
370
- onClick: P
371
- }, null, 8, ["title"]))
372
- ])) : (m(), M("p", Et, I(n.emptyText ?? e(w)("relations.field-empty")), 1)),
373
- G("div", qt, [
374
- u(e(lt), {
375
- modelValue: C.value,
376
- "onUpdate:modelValue": v[0] || (v[0] = (T) => C.value = T),
377
- options: k.value,
378
- remote: "",
379
- teleport: "",
380
- loading: N.value,
381
- "loading-text": e(w)("relations.field-searching"),
382
- "empty-text": e(w)("relations.field-nothing"),
383
- placeholder: X.value,
384
- "aria-label": X.value,
385
- disabled: n.disabled,
386
- onSearch: y,
387
- onOpen: $,
388
- onSelect: E
389
- }, null, 8, ["modelValue", "options", "loading", "loading-text", "empty-text", "placeholder", "aria-label", "disabled"])
390
- ])
391
- ]));
392
- }
393
- }), fe = (a, n) => {
394
- const c = a.__vccOpts || a;
395
- for (const [b, w] of n)
396
- c[b] = w;
397
- return c;
398
- }, Rt = /* @__PURE__ */ fe(zt, [["__scopeId", "data-v-91f60441"]]);
399
- function rl(a = {}) {
400
- const n = a.path ?? "/inbox";
401
- return {
402
- id: "inbox",
403
- path: n,
404
- landing: a.landing ?? !0,
405
- routes: [
406
- // The section's own path travels as a prop, so a panel that mounted it somewhere else
407
- // still links between its screens correctly.
408
- {
409
- path: n,
410
- name: "webx.inbox",
411
- meta: { help: "inbox.index" },
412
- component: () => import("./InboxPage-D20_MKcX.js"),
413
- props: { base: n }
414
- },
415
- {
416
- path: `${n}/statuses`,
417
- name: "webx.inbox.statuses",
418
- meta: { help: "inbox.statuses" },
419
- component: () => import("./StatusesPage-hBgS8sYt.js"),
420
- props: { base: n }
421
- },
422
- {
423
- path: `${n}/forms/:id(\\d+)`,
424
- name: "webx.inbox.form",
425
- meta: { help: "inbox.form" },
426
- component: () => import("./FormEditorPage-DC5AjYv6.js"),
427
- props: { base: n }
428
- },
429
- // A submission has an address of its own, not a dialog over the list (§11): it goes in
430
- // the mail to whoever deals with it, it gets pasted into a chat, an agent links to it.
431
- {
432
- path: `${n}/submissions/:id(\\d+)`,
433
- name: "webx.inbox.submission",
434
- meta: { help: "inbox.submission" },
435
- component: () => import("./SubmissionPage-3Fhny2qD.js"),
436
- props: { base: n }
437
- }
438
- ],
439
- // A form of the Inbox as a field of any screen or block — the contact block's form — chosen
440
- // by name and kept by slug. Here and not in the panel: what it lists is this section's.
441
- types: {
442
- "wx-inbox-form": { component: Rt, kind: "field" }
443
- }
444
- };
445
- }
446
- const ye = /* @__PURE__ */ new WeakMap();
447
- function Te(a) {
448
- const n = `${a.apiPath}/inbox`, c = (t) => t.data, b = () => {
449
- }, w = (t) => (ye.delete(a.http), t);
450
- function B() {
451
- const t = ye.get(a.http);
452
- if (t !== void 0)
453
- return t.then((g) => [...g]);
454
- const l = a.http.get(`${n}/statuses`).then(c);
455
- return ye.set(a.http, l), l.catch(() => ye.delete(a.http)), l.then((g) => [...g]);
456
- }
457
- return {
458
- forms: () => a.http.get(`${n}/forms`).then(c),
459
- form: (t) => a.http.get(`${n}/forms/${t}`).then(c),
460
- createForm: (t) => a.http.post(`${n}/forms`, t).then(c),
461
- saveForm: (t, l) => a.http.put(`${n}/forms/${t}`, l).then(c),
462
- removeForm: (t) => a.http.delete(`${n}/forms/${t}`).then(b),
463
- duplicateForm: (t) => a.http.post(`${n}/forms/${t}/duplicate`, {}).then(c),
464
- sortForms: (t) => a.http.post(`${n}/forms/sorting`, { ids: t }).then(b),
465
- fields: (t) => a.http.get(`${n}/forms/${t}/fields`).then(c),
466
- createField: (t, l) => a.http.post(`${n}/forms/${t}/fields`, l).then(c),
467
- saveField: (t, l) => a.http.put(`${n}/fields/${t}`, l).then(c),
468
- removeField: (t) => a.http.delete(`${n}/fields/${t}`).then(b),
469
- sortFields: (t, l) => a.http.post(`${n}/forms/${t}/fields/sorting`, { ids: l }).then(b),
470
- statuses: B,
471
- createStatus: (t) => a.http.post(`${n}/statuses`, t).then(c).then(w),
472
- saveStatus: (t, l) => a.http.put(`${n}/statuses/${t}`, l).then(c).then(w),
473
- removeStatus: (t) => a.http.delete(`${n}/statuses/${t}`).then(b).then(w),
474
- sortStatuses: (t) => a.http.post(`${n}/statuses/sorting`, { ids: t }).then(b).then(w),
475
- recipients: () => a.http.get(`${n}/recipients`).then(c),
476
- submissions: (t, l = {}) => a.http.get(`${n}/forms/${t}/submissions`, { query: Ce(l) }).then((g) => ({
477
- ...g.meta,
478
- data: g.data,
479
- columns: g.columns,
480
- counts: g.counts,
481
- // Optional on the wire: a server from before placements answers without them.
482
- placements: g.placements ?? []
483
- })),
484
- submission: (t, l = {}) => a.http.get(`${n}/submissions/${t}`, { query: Ce(l) }).then(c),
485
- createSubmission: (t, l) => a.http.post(`${n}/forms/${t}/submissions`, { fields: l }).then(c),
486
- saveSubmission: (t, l) => a.http.put(`${n}/submissions/${t}`, l).then(c),
487
- removeSubmission: (t) => a.http.delete(`${n}/submissions/${t}`).then(b),
488
- notifySubmission: (t) => a.http.post(`${n}/submissions/${t}/notify`).then(c),
489
- massSubmissions: (t) => a.http.post(`${n}/submissions/mass`, t).then(c),
490
- exportUrl: (t, l = {}) => {
491
- const g = new URLSearchParams();
492
- for (const [N, C] of Object.entries(Ce(l)))
493
- C != null && C !== "" && g.set(N, String(C));
494
- const S = g.toString();
495
- return `${n}/forms/${t}/submissions/export${S === "" ? "" : `?${S}`}`;
496
- }
497
- };
498
- }
499
- function Ce(a) {
500
- return {
501
- view: a.view === void 0 || a.view === "" ? void 0 : a.view,
502
- search: a.search === void 0 || a.search === "" ? void 0 : a.search,
503
- assignee: a.assignee ?? void 0,
504
- placement: a.placement ?? void 0,
505
- sort: a.sort ?? void 0,
506
- page: a.page,
507
- per_page: a.per_page
508
- };
509
- }
510
- function ul(a, n, c) {
511
- return A({
512
- get: () => a.value[n] ?? c,
513
- set: (b) => {
514
- const w = { ...a.value };
515
- b === "" || b === null || b === void 0 ? delete w[n] : w[n] = b, a.value = w;
516
- }
517
- });
518
- }
519
- const Bt = { class: "wx-inbox-by-hand" }, Pt = /* @__PURE__ */ oe({
520
- __name: "SubmissionCreateDialog",
521
- props: {
522
- form: {}
523
- },
524
- setup(a) {
525
- const n = a, { resolve: c, dismiss: b, open: w } = Me(), B = re(), t = Te(B), l = ie();
526
- he();
527
- const g = le("webx-inbox"), S = Ve(), N = U([]), C = U(!0), q = U(!1), x = U({}), p = U({}), H = A(() => N.value.filter((v) => v.type !== "file")), k = A(() => N.value.some((v) => v.type === "file"));
528
- function y(v) {
529
- return p.value[`fields.${v.key}`]?.[0];
530
- }
531
- function $(v) {
532
- return pe(v.title, l.active.value, v.key);
533
- }
534
- function E(v, T = "") {
535
- return pe(
536
- v,
537
- l.active.value,
538
- T
539
- );
540
- }
541
- function P(v) {
542
- return (v.options.choices ?? []).map((T) => ({
543
- value: T.value,
544
- label: E(T.label, T.value)
545
- }));
546
- }
547
- async function X() {
548
- try {
549
- const v = await t.form(n.form.id);
550
- N.value = (v.fields ?? []).filter((T) => T.is_enabled);
551
- for (const T of N.value)
552
- x.value[T.key] = T.type === "checkbox" ? [] : T.type === "consent" ? !1 : "";
553
- } catch (v) {
554
- j.danger(S(v));
555
- } finally {
556
- C.value = !1;
557
- }
558
- }
559
- X();
560
- async function V() {
561
- q.value = !0, p.value = {};
562
- try {
563
- c(await t.createSubmission(n.form.id, x.value));
564
- } catch (v) {
565
- const T = v.body;
566
- T?.errors ? (p.value = T.errors, j.danger(g("panel.failed"))) : j.danger(S(v));
567
- } finally {
568
- q.value = !1;
569
- }
570
- }
571
- return (v, T) => (m(), _(e(He), {
572
- open: e(w),
573
- "onUpdate:open": T[1] || (T[1] = (i) => Pe(w) ? w.value = i : null),
574
- title: e(g)("panel.new-submission-title"),
575
- width: 560
576
- }, {
577
- footer: d(() => [
578
- u(e(Xe), { size: "sm" }, {
579
- default: d(() => [
580
- u(e(te), {
581
- variant: "outline",
582
- onClick: T[0] || (T[0] = (i) => e(b)())
583
- }, {
584
- default: d(() => [
585
- z(I(e(g)("panel.cancel")), 1)
586
- ]),
587
- _: 1
588
- }),
589
- u(e(te), {
590
- type: "primary",
591
- loading: q.value,
592
- disabled: C.value,
593
- onClick: V
594
- }, {
595
- default: d(() => [
596
- z(I(e(g)("panel.save")), 1)
597
- ]),
598
- _: 1
599
- }, 8, ["loading", "disabled"])
600
- ]),
601
- _: 1
602
- })
603
- ]),
604
- default: d(() => [
605
- G("div", Bt, [
606
- u(e(Ne), {
607
- type: "info",
608
- closable: !1
609
- }, {
610
- default: d(() => [
611
- z(I(e(g)("panel.new-submission-help")), 1)
612
- ]),
613
- _: 1
614
- }),
615
- C.value ? (m(), _(e(at), {
616
- key: 0,
617
- rows: 4
618
- })) : (m(), M(Z, { key: 1 }, [
619
- (m(!0), M(Z, null, Oe(H.value, (i) => (m(), _(e(L), {
620
- key: i.id,
621
- label: $(i),
622
- help: E(i.help),
623
- error: y(i),
624
- required: i.is_required
625
- }, {
626
- default: d(() => [
627
- i.type === "textarea" ? (m(), _(e(nt), {
628
- key: 0,
629
- modelValue: x.value[i.key],
630
- "onUpdate:modelValue": (R) => x.value[i.key] = R,
631
- rows: i.options.rows ?? 4,
632
- placeholder: E(i.placeholder)
633
- }, null, 8, ["modelValue", "onUpdate:modelValue", "rows", "placeholder"])) : i.type === "select" ? (m(), _(e(we), {
634
- key: 1,
635
- modelValue: x.value[i.key],
636
- "onUpdate:modelValue": (R) => x.value[i.key] = R,
637
- options: P(i),
638
- clearable: "",
639
- placeholder: E(i.placeholder)
640
- }, null, 8, ["modelValue", "onUpdate:modelValue", "options", "placeholder"])) : i.type === "radio" ? (m(), _(e(st), {
641
- key: 2,
642
- modelValue: x.value[i.key],
643
- "onUpdate:modelValue": (R) => x.value[i.key] = R,
644
- options: P(i)
645
- }, null, 8, ["modelValue", "onUpdate:modelValue", "options"])) : i.type === "checkbox" ? (m(), _(e(ot), {
646
- key: 3,
647
- modelValue: x.value[i.key],
648
- "onUpdate:modelValue": (R) => x.value[i.key] = R,
649
- options: P(i)
650
- }, null, 8, ["modelValue", "onUpdate:modelValue", "options"])) : i.type === "consent" ? (m(), _(e(se), {
651
- key: 4,
652
- modelValue: x.value[i.key],
653
- "onUpdate:modelValue": (R) => x.value[i.key] = R,
654
- label: E(i.options.text, $(i))
655
- }, null, 8, ["modelValue", "onUpdate:modelValue", "label"])) : i.type === "date" ? (m(), _(e(Ue), {
656
- key: 5,
657
- modelValue: x.value[i.key],
658
- "onUpdate:modelValue": (R) => x.value[i.key] = R,
659
- placeholder: E(i.placeholder)
660
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])) : (m(), _(e(K), {
661
- key: 6,
662
- modelValue: x.value[i.key],
663
- "onUpdate:modelValue": (R) => x.value[i.key] = R,
664
- type: i.type === "email" ? "email" : i.type === "tel" ? "tel" : "text",
665
- placeholder: E(i.placeholder),
666
- maxlength: i.options.maxlength
667
- }, null, 8, ["modelValue", "onUpdate:modelValue", "type", "placeholder", "maxlength"]))
668
- ]),
669
- _: 2
670
- }, 1032, ["label", "help", "error", "required"]))), 128)),
671
- k.value ? (m(), _(e(Ne), {
672
- key: 0,
673
- type: "warning",
674
- closable: !1
675
- }, {
676
- default: d(() => [
677
- z(I(e(g)("panel.no-files-by-hand")), 1)
678
- ]),
679
- _: 1
680
- })) : W("", !0)
681
- ], 64))
682
- ])
683
- ]),
684
- _: 1
685
- }, 8, ["open", "title"]));
686
- }
687
- }), Ot = /* @__PURE__ */ fe(Pt, [["__scopeId", "data-v-72006299"]]), Lt = { class: "wx-submissions__mass" }, Dt = { class: "wx-submissions__state" }, Mt = 640, Ht = /* @__PURE__ */ oe({
688
- __name: "SubmissionList",
689
- props: {
690
- form: {},
691
- base: { default: "/inbox" }
692
- },
693
- emits: ["changed"],
694
- setup(a, { expose: n, emit: c }) {
695
- const b = a, w = c, B = re(), t = Te(B), l = $t(), g = St(), S = ie();
696
- he();
697
- const N = et("root"), C = it(N), q = A(() => C.value > 0 && C.value < Mt), x = A(() => q.value ? Number.POSITIVE_INFINITY : 0), p = le("webx-inbox"), H = le("webx-admin"), k = Ve(), y = U(null), $ = U([]), E = U(!1), P = U([]), X = U(!1), V = A(() => B.can("inbox.update")), v = Ge(Ot), T = A({
698
- get: () => typeof l.query.view == "string" && l.query.view !== "" ? l.query.view : "all",
699
- set: (o) => {
700
- g.replace({
701
- query: { ...l.query, view: o === "all" ? void 0 : o, page: void 0 }
702
- });
703
- }
704
- }), i = A(() => ({
705
- view: T.value,
706
- search: typeof l.query.search == "string" ? l.query.search : "",
707
- assignee: typeof l.query.assignee == "string" ? l.query.assignee : null,
708
- placement: typeof l.query.placement == "string" ? l.query.placement : null,
709
- sort: typeof l.query.sort == "string" ? l.query.sort : null,
710
- page: Number(l.query.page ?? 1) || 1
711
- })), R = A(
712
- () => (y.value?.placements ?? []).map(
713
- (o) => o === null ? { value: "none", label: p("panel.placement-none") } : { value: o, label: o }
714
- )
715
- ), ve = A(
716
- () => R.value.length > 1 || i.value.placement !== null
717
- ), ue = A(() => {
718
- const o = i.value.placement;
719
- if (o === null) return [];
720
- const F = R.value.find((h) => h.value === o)?.label ?? (o === "none" ? p("panel.placement-none") : o);
721
- return [
722
- {
723
- key: "placement",
724
- label: `${p("panel.meta-placement")}: ${F}`,
725
- clear: () => be(void 0)
726
- }
727
- ];
728
- });
729
- function be(o) {
730
- g.replace({
731
- query: {
732
- ...l.query,
733
- placement: typeof o == "string" && o !== "" ? o : void 0,
734
- page: void 0
735
- }
736
- });
737
- }
738
- const Q = A(() => {
739
- const o = y.value?.counts, F = [
740
- { value: "all", label: p("panel.view-all"), badge: o?.all || void 0 },
741
- { value: "unread", label: p("panel.view-unread"), badge: o?.unread || void 0 }
742
- ];
743
- for (const h of $.value)
744
- F.push({
745
- value: h.key,
746
- label: J(h),
747
- badge: o?.statuses[h.key] || void 0
748
- });
749
- return F;
750
- });
751
- function de(o, F) {
752
- const h = y.value?.columns?.[F];
753
- return h ? o.values[h.key] ?? "" : "";
754
- }
755
- const D = A(() => {
756
- const o = y.value?.columns ?? [];
757
- return q.value ? [{ key: "card", label: "" }] : [
758
- ...o.map((F, h) => ({
759
- key: `values.${F.key}`,
760
- label: F.label,
761
- sortable: !0,
762
- // The first answer is what the row is recognised by and stays at any width; every one
763
- // after it is worth less than the room it takes, so it goes a step sooner. The steps are
764
- // wide — 640, 960 — because an answer is a sentence and not a number: two of them plus
765
- // the status and the date is already what a 755px pane holds without scrolling sideways,
766
- // which is what the pane beside the forms actually is on a 1280 screen (§11).
767
- hideBelow: h === 0 ? void 0 : 320 + h * 320
768
- })),
769
- // A floor rather than a width: the cell holds a badge, sometimes an avatar and sometimes
770
- // a paperclip, and a fixed width that any of them overflows makes the whole table scroll
771
- // sideways by two pixels.
772
- { key: "status", label: p("panel.status"), minWidth: 100 },
773
- {
774
- key: "created_at",
775
- label: p("panel.received"),
776
- sortable: !0,
777
- width: 120,
778
- // "today at 16:22" is three words the table will break over two lines given half a
779
- // chance, and a date read down a column has to be one line to be read at all.
780
- cellClass: "wx-submissions__when",
781
- hideBelow: 520
782
- // Kept on the card, unlike most dates: "when did this come in" is one of the two
783
- // questions a submission is looked at for, and the other one is who sent it.
784
- },
785
- { key: "actions", label: "", width: gt, align: "right", hideOnCards: !0 }
786
- ];
787
- }), $e = A(
788
- () => i.value.view === "all" && i.value.search === "" && i.value.assignee === null && i.value.placement === null ? p("panel.submissions-empty") : p("panel.submissions-none")
789
- ), Se = A(
790
- () => $.value.map((o) => ({ value: o.id, label: J(o) }))
791
- ), J = Ct();
792
- function ae() {
793
- return pe(b.form.title, S.active.value, b.form.slug);
794
- }
795
- async function ne(o) {
796
- E.value = !0;
797
- try {
798
- y.value = await t.submissions(b.form.id, {
799
- view: i.value.view,
800
- search: o?.search ?? i.value.search,
801
- assignee: i.value.assignee,
802
- placement: i.value.placement,
803
- sort: o?.sort ? `${o.sort.order === "desc" ? "-" : ""}${o.sort.key}` : null,
804
- page: o?.page ?? i.value.page,
805
- per_page: o?.perPage
806
- });
807
- } catch (F) {
808
- j.danger(k(F));
809
- } finally {
810
- E.value = !1;
811
- }
812
- }
813
- function f(o) {
814
- const F = {
815
- ...l.query,
816
- search: o.search === "" ? void 0 : o.search,
817
- sort: o.sort === null ? void 0 : `${o.sort.order === "desc" ? "-" : ""}${o.sort.key}`,
818
- page: o.page === 1 ? void 0 : String(o.page)
819
- };
820
- g.replace({ query: F }), ne(o);
821
- }
822
- ge([() => b.form.id, T, () => i.value.assignee, () => i.value.placement], () => {
823
- P.value = [], ne();
824
- }), r();
825
- async function r() {
826
- try {
827
- $.value = await t.statuses();
828
- } catch (o) {
829
- j.danger(k(o));
830
- }
831
- }
832
- function s(o) {
833
- g.push({ path: `${b.base}/submissions/${o.id}`, query: { ...l.query } });
834
- }
835
- function O(o) {
836
- return V.value ? [
837
- {
838
- key: "read",
839
- icon: o.is_read ? "eye-off" : "eye",
840
- label: o.is_read ? p("panel.mark-unread") : p("panel.mark-read"),
841
- run: () => {
842
- Ae([o.id], o.is_read ? "unread" : "read");
843
- }
844
- },
845
- {
846
- key: "delete",
847
- icon: "trash",
848
- label: p("panel.delete"),
849
- danger: !0,
850
- run: () => {
851
- Ee([o.id]);
852
- }
853
- }
854
- ] : [];
855
- }
856
- async function Y(o) {
857
- typeof o == "number" && (X.value = !0, await Ae(
858
- P.value.map((F) => F.id),
859
- "status",
860
- o
861
- ), X.value = !1);
862
- }
863
- async function Ee(o) {
864
- await Ye({
865
- title: o.length === 1 ? p("panel.delete-submission-title") : p("panel.delete-selected-title", { count: o.length }),
866
- message: p("panel.delete-submission-text"),
867
- confirmText: p("panel.delete"),
868
- cancelText: p("panel.cancel"),
869
- tone: "danger"
870
- }) && await Ae(o, "delete");
871
- }
872
- async function Ae(o, F, h) {
873
- if (o.length !== 0)
874
- try {
875
- await t.massSubmissions({ ids: o, action: F, status_id: h }), P.value = [], await ne(), w("changed");
876
- } catch (ce) {
877
- j.danger(k(ce));
878
- }
879
- }
880
- async function je() {
881
- const o = await v({ form: b.form });
882
- o && (j.success(p("panel.created")), await ne(), w("changed"), g.push({ path: `${b.base}/submissions/${o.id}`, query: { ...l.query } }));
883
- }
884
- const Ke = A(
885
- () => t.exportUrl(b.form.id, {
886
- view: i.value.view,
887
- search: i.value.search,
888
- assignee: i.value.assignee,
889
- placement: i.value.placement,
890
- sort: i.value.sort
891
- })
892
- ), Ze = A(() => [
893
- { key: "export", label: p("panel.export"), icon: "download", href: Ke.value }
894
- ]);
895
- return n({ create: je }), (o, F) => (m(), M("div", {
896
- ref_key: "root",
897
- ref: N,
898
- class: "wx-submissions"
899
- }, [
900
- u(e(xt), {
901
- class: "wx-submissions__head",
902
- level: 3,
903
- title: ae(),
904
- subtitle: a.form.slug,
905
- actions: Ze.value
906
- }, null, 8, ["title", "subtitle", "actions"]),
907
- u(e(rt), {
908
- modelValue: T.value,
909
- "onUpdate:modelValue": F[2] || (F[2] = (h) => T.value = h),
910
- class: "wx-submissions__views",
911
- items: Q.value,
912
- "collapse-below": 560,
913
- "aria-label": e(p)("panel.status")
914
- }, {
915
- default: d(() => [
916
- u(e(ut), {
917
- data: y.value,
918
- columns: D.value,
919
- "row-key": "id",
920
- searchable: "",
921
- clickable: "",
922
- hover: "",
923
- flush: "",
924
- loading: E.value,
925
- "loading-text": e(p)("panel.loading"),
926
- selectable: V.value,
927
- "select-row-label": e(H)("filters.select-row"),
928
- "select-all-label": e(H)("filters.select-all"),
929
- "row-class": (h) => h.is_read ? void 0 : "is-unread",
930
- "search-placeholder": e(p)("panel.search-submissions"),
931
- "empty-text": $e.value,
932
- "cards-below": x.value,
933
- "filters-count": ue.value.length,
934
- onRowClick: s,
935
- onStateChange: f,
936
- onSelectionChange: F[1] || (F[1] = (h, ce) => P.value = ce)
937
- }, Le({
938
- "cell-status": d(({ row: h }) => [
939
- G("div", Dt, [
940
- h.status ? (m(), _(e(xe), {
941
- key: 0,
942
- type: h.status.color
943
- }, {
944
- default: d(() => [
945
- z(I(e(J)(h.status)), 1)
946
- ]),
947
- _: 2
948
- }, 1032, ["type"])) : W("", !0),
949
- h.assignee ? (m(), _(e(qe), {
950
- key: 1,
951
- name: h.assignee.name,
952
- title: h.assignee.name,
953
- size: "xs",
954
- tone: "auto"
955
- }, null, 8, ["name", "title"])) : W("", !0),
956
- h.files_count > 0 ? (m(), _(e(ct), {
957
- key: 2,
958
- content: e(p)("panel.attachments")
959
- }, {
960
- default: d(() => [
961
- u(e(ke), {
962
- name: "file",
963
- size: "sm"
964
- })
965
- ]),
966
- _: 1
967
- }, 8, ["content"])) : W("", !0)
968
- ])
969
- ]),
970
- "cell-created_at": d(({ row: h }) => [
971
- u(e(Re), {
972
- value: h.created_at,
973
- compact: ""
974
- }, null, 8, ["value"])
975
- ]),
976
- "cell-card": d(({ row: h }) => [
977
- u(e(dt), {
978
- variant: "plain",
979
- shape: "circle",
980
- title: de(h, 0)
981
- }, {
982
- subtitle: d(() => [
983
- z(I(de(h, 1)), 1)
984
- ]),
985
- meta: d(() => [
986
- h.status ? (m(), _(e(xe), {
987
- key: 0,
988
- type: h.status.color,
989
- size: "sm"
990
- }, {
991
- default: d(() => [
992
- z(I(e(J)(h.status)), 1)
993
- ]),
994
- _: 2
995
- }, 1032, ["type"])) : W("", !0),
996
- h.assignee ? (m(), _(e(qe), {
997
- key: 1,
998
- name: h.assignee.name,
999
- title: h.assignee.name,
1000
- size: "xs",
1001
- tone: "auto"
1002
- }, null, 8, ["name", "title"])) : W("", !0),
1003
- h.files_count > 0 ? (m(), _(e(ke), {
1004
- key: 2,
1005
- name: "file",
1006
- size: "sm"
1007
- })) : W("", !0),
1008
- u(e(Re), {
1009
- value: h.created_at
1010
- }, null, 8, ["value"])
1011
- ]),
1012
- _: 2
1013
- }, 1032, ["title"])
1014
- ]),
1015
- "card-actions": d(({ row: h }) => [
1016
- u(e(We), {
1017
- actions: O(h),
1018
- label: String(h.id)
1019
- }, null, 8, ["actions", "label"])
1020
- ]),
1021
- "cell-actions": d(({ row: h }) => [
1022
- u(e(We), {
1023
- actions: O(h),
1024
- label: String(h.id)
1025
- }, null, 8, ["actions", "label"])
1026
- ]),
1027
- _: 2
1028
- }, [
1029
- P.value.length > 0 ? {
1030
- name: "actions",
1031
- fn: d(() => [
1032
- G("div", Lt, [
1033
- u(e(ee), {
1034
- size: "sm",
1035
- weight: "medium"
1036
- }, {
1037
- default: d(() => [
1038
- z(I(e(p)("panel.selected", { count: P.value.length })), 1)
1039
- ]),
1040
- _: 1
1041
- }),
1042
- u(e(we), {
1043
- "model-value": null,
1044
- options: Se.value,
1045
- placeholder: e(p)("panel.move-to"),
1046
- disabled: X.value,
1047
- size: "sm",
1048
- style: { width: "180px" },
1049
- "onUpdate:modelValue": Y
1050
- }, null, 8, ["options", "placeholder", "disabled"]),
1051
- u(e(te), {
1052
- size: "sm",
1053
- variant: "outline",
1054
- type: "danger",
1055
- onClick: F[0] || (F[0] = (h) => Ee(P.value.map((ce) => ce.id)))
1056
- }, {
1057
- default: d(() => [
1058
- z(I(e(p)("panel.delete")), 1)
1059
- ]),
1060
- _: 1
1061
- })
1062
- ])
1063
- ]),
1064
- key: "0"
1065
- } : void 0,
1066
- ve.value ? {
1067
- name: "filters",
1068
- fn: d(() => [
1069
- u(e(L), {
1070
- label: e(p)("panel.meta-placement")
1071
- }, {
1072
- default: d(() => [
1073
- u(e(we), {
1074
- "model-value": i.value.placement,
1075
- options: R.value,
1076
- placeholder: e(p)("panel.any-placement"),
1077
- clearable: "",
1078
- size: "sm",
1079
- "onUpdate:modelValue": be
1080
- }, null, 8, ["model-value", "options", "placeholder"])
1081
- ]),
1082
- _: 1
1083
- }, 8, ["label"])
1084
- ]),
1085
- key: "1"
1086
- } : void 0,
1087
- ue.value.length > 0 ? {
1088
- name: "applied",
1089
- fn: d(() => [
1090
- u(e(wt), { filters: ue.value }, null, 8, ["filters"])
1091
- ]),
1092
- key: "2"
1093
- } : void 0
1094
- ]), 1032, ["data", "columns", "loading", "loading-text", "selectable", "select-row-label", "select-all-label", "row-class", "search-placeholder", "empty-text", "cards-below", "filters-count"])
1095
- ]),
1096
- _: 1
1097
- }, 8, ["modelValue", "items", "aria-label"])
1098
- ], 512));
1099
- }
1100
- }), dl = /* @__PURE__ */ fe(Ht, [["__scopeId", "data-v-c743b9e7"]]), Xt = /* @__PURE__ */ oe({
1101
- __name: "LocalizedRichText",
1102
- props: /* @__PURE__ */ Ie({
1103
- placeholder: { default: void 0 },
1104
- minHeight: { default: "160px" }
1105
- }, {
1106
- modelValue: { default: "" },
1107
- modelModifiers: {}
1108
- }),
1109
- emits: ["update:modelValue"],
1110
- setup(a) {
1111
- const n = Fe(a, "modelValue"), c = a, b = ie(), w = kt(), B = _t(() => !0), t = le("webx-admin"), l = A(() => {
1112
- const S = b.active.value;
1113
- return b.list.value.some((C) => C.code === S) ? S : b.list.value[0]?.code ?? "";
1114
- }), g = A({
1115
- get: () => {
1116
- const S = n.value;
1117
- return typeof S == "string" ? l.value === "" || l.value === b.list.value[0]?.code ? S : "" : S[l.value] ?? "";
1118
- },
1119
- set: (S) => {
1120
- if (l.value === "") {
1121
- n.value = S;
1122
- return;
1123
- }
1124
- const N = typeof n.value == "string" ? { [l.value]: n.value } : n.value;
1125
- n.value = { ...N, [l.value]: S };
1126
- }
1127
- });
1128
- return (S, N) => e(b).list.value.length > 0 ? (m(), _(e(mt), { key: 0 }, {
1129
- default: d(() => [
1130
- u(e(ze), {
1131
- modelValue: g.value,
1132
- "onUpdate:modelValue": N[0] || (N[0] = (C) => g.value = C),
1133
- placeholder: c.placeholder,
1134
- "min-height": c.minHeight,
1135
- labels: e(w),
1136
- tokens: e(B).length > 0 ? e(B) : void 0,
1137
- "tokens-title": e(t)("shortcodes.title"),
1138
- "tokens-label": e(t)("shortcodes.insert")
1139
- }, null, 8, ["modelValue", "placeholder", "min-height", "labels", "tokens", "tokens-title", "tokens-label"])
1140
- ]),
1141
- _: 1
1142
- })) : (m(), _(e(ze), {
1143
- key: 1,
1144
- modelValue: g.value,
1145
- "onUpdate:modelValue": N[1] || (N[1] = (C) => g.value = C),
1146
- placeholder: c.placeholder,
1147
- "min-height": c.minHeight,
1148
- labels: e(w),
1149
- tokens: e(B).length > 0 ? e(B) : void 0,
1150
- "tokens-title": e(t)("shortcodes.title"),
1151
- "tokens-label": e(t)("shortcodes.insert")
1152
- }, null, 8, ["modelValue", "placeholder", "min-height", "labels", "tokens", "tokens-title", "tokens-label"]));
1153
- }
1154
- }), Gt = [
1155
- "text",
1156
- "email",
1157
- "tel",
1158
- "textarea",
1159
- "select",
1160
- "radio",
1161
- "checkbox",
1162
- "consent",
1163
- "date",
1164
- "file",
1165
- "hidden"
1166
- ], cl = ["default", "primary", "success", "warning", "info", "danger"], Yt = { class: "wx-inbox-field-form" }, jt = {
1167
- key: 2,
1168
- class: "wx-inbox-choices"
1169
- }, Kt = { class: "wx-inbox-field-form__row" }, Zt = { class: "wx-inbox-field-form__checks" }, Qt = { class: "wx-inbox-field-form__advanced" }, Jt = /* @__PURE__ */ oe({
1170
- __name: "FieldDialog",
1171
- props: {
1172
- field: {},
1173
- form: {},
1174
- taken: { default: () => [] }
1175
- },
1176
- setup(a) {
1177
- const n = a, { resolve: c, dismiss: b, open: w } = Me(), B = re(), t = Te(B);
1178
- he();
1179
- const l = le("webx-inbox"), g = Vt(), S = Ve(), N = U(!1), C = U({}), q = U(""), x = U("text"), p = U({}), H = U({}), k = U({}), y = U({}), $ = U(!1), E = ie(), P = U(!0), X = U(!1), V = U(!0), v = U(!1);
1180
- ge(
1181
- () => n.field,
1182
- (f) => {
1183
- q.value = f?.name ?? "", x.value = f?.type ?? "text", p.value = { ...f?.title ?? {} }, H.value = { ...f?.placeholder ?? {} }, k.value = { ...f?.help ?? {} }, y.value = { ...f?.options ?? {} }, P.value = f?.is_enabled ?? !0, X.value = f?.is_required ?? !1, V.value = f?.is_fullsize ?? !0, v.value = f?.in_table ?? !1, $.value = f !== null, C.value = {};
1184
- },
1185
- { immediate: !0 }
1186
- );
1187
- function T(f) {
1188
- const r = f ?? {}, s = r[E.active.value];
1189
- if (typeof s == "string" && s.trim() !== "") return [s, E.active.value];
1190
- const O = Object.entries(r).find(
1191
- ([, Y]) => typeof Y == "string" && Y.trim() !== ""
1192
- );
1193
- return O === void 0 ? ["", E.active.value] : [O[1], O[0]];
1194
- }
1195
- function i([f, r]) {
1196
- let s = Tt(f, "_", r).slice(0, 60).replace(/_+$/, "");
1197
- if (s === "") return "";
1198
- /^[a-z]/.test(s) || (s = `field_${s}`);
1199
- let O = s;
1200
- for (let Y = 2; n.taken.includes(O); Y++) O = `${s}_${Y}`;
1201
- return O;
1202
- }
1203
- ge(
1204
- () => T(p.value),
1205
- (f) => {
1206
- $.value || (q.value = i(f));
1207
- }
1208
- );
1209
- function R(f) {
1210
- q.value = f, $.value = f.trim() !== "", $.value || (q.value = i(T(p.value)));
1211
- }
1212
- const ve = A(() => {
1213
- const f = n.field?.name ?? "", r = q.value.trim();
1214
- return f !== "" && r !== "" && r !== f ? f : null;
1215
- }), ue = A(
1216
- () => Gt.map((f) => ({ value: f, label: l(`fields.type-${f}`) }))
1217
- ), be = A(() => ["select", "radio", "checkbox"].includes(x.value)), Q = A(
1218
- () => Array.isArray(y.value.choices) ? y.value.choices : []
1219
- ), de = A({
1220
- get: () => Array.isArray(y.value.extensions) ? y.value.extensions : [],
1221
- set: (f) => D(
1222
- "extensions",
1223
- f.map((r) => r.replace(/^\./, ""))
1224
- )
1225
- });
1226
- function D(f, r) {
1227
- y.value = { ...y.value, [f]: r };
1228
- }
1229
- function $e() {
1230
- D("choices", [...Q.value, { value: "", label: {} }]);
1231
- }
1232
- function Se(f) {
1233
- D(
1234
- "choices",
1235
- Q.value.filter((r, s) => s !== f)
1236
- );
1237
- }
1238
- function J(f, r) {
1239
- D(
1240
- "choices",
1241
- Q.value.map((s, O) => O === f ? { ...s, ...r } : s)
1242
- );
1243
- }
1244
- function ae(f) {
1245
- return C.value[f]?.[0];
1246
- }
1247
- async function ne() {
1248
- N.value = !0, C.value = {};
1249
- const f = {
1250
- name: q.value.trim() === "" ? null : q.value.trim(),
1251
- type: x.value,
1252
- title: p.value,
1253
- placeholder: H.value,
1254
- help: k.value,
1255
- options: y.value,
1256
- is_enabled: P.value,
1257
- is_required: X.value,
1258
- is_fullsize: V.value,
1259
- in_table: v.value
1260
- };
1261
- try {
1262
- c(
1263
- n.field === null ? await t.createField(n.form.id, f) : await t.saveField(n.field.id, f)
1264
- );
1265
- } catch (r) {
1266
- const s = r.body;
1267
- s?.errors ? (C.value = s.errors, j.danger(l("panel.failed"))) : j.danger(S(r));
1268
- } finally {
1269
- N.value = !1;
1270
- }
1271
- }
1272
- return (f, r) => (m(), _(e(He), {
1273
- open: e(w),
1274
- "onUpdate:open": r[21] || (r[21] = (s) => Pe(w) ? w.value = s : null),
1275
- title: a.field ? e(l)("fields.edit-field") : e(l)("fields.new-field"),
1276
- width: 720
1277
- }, {
1278
- footer: d(() => [
1279
- u(e(Xe), { size: "sm" }, {
1280
- default: d(() => [
1281
- u(e(te), {
1282
- variant: "outline",
1283
- onClick: r[20] || (r[20] = (s) => e(b)())
1284
- }, {
1285
- default: d(() => [
1286
- z(I(e(l)("fields.cancel")), 1)
1287
- ]),
1288
- _: 1
1289
- }),
1290
- u(e(te), {
1291
- type: "primary",
1292
- loading: N.value,
1293
- onClick: ne
1294
- }, {
1295
- default: d(() => [
1296
- z(I(e(l)("fields.save")), 1)
1297
- ]),
1298
- _: 1
1299
- }, 8, ["loading"])
1300
- ]),
1301
- _: 1
1302
- })
1303
- ]),
1304
- default: d(() => [
1305
- G("div", Yt, [
1306
- u(e(L), {
1307
- label: e(l)("fields.type")
1308
- }, {
1309
- default: d(() => [
1310
- u(e(we), {
1311
- modelValue: x.value,
1312
- "onUpdate:modelValue": r[0] || (r[0] = (s) => x.value = s),
1313
- options: ue.value
1314
- }, null, 8, ["modelValue", "options"])
1315
- ]),
1316
- _: 1
1317
- }, 8, ["label"]),
1318
- u(e(L), {
1319
- label: e(l)("fields.title"),
1320
- error: ae("title"),
1321
- required: ""
1322
- }, {
1323
- default: d(() => [
1324
- u(e(K), {
1325
- modelValue: p.value,
1326
- "onUpdate:modelValue": r[1] || (r[1] = (s) => p.value = s),
1327
- localized: ""
1328
- }, null, 8, ["modelValue"])
1329
- ]),
1330
- _: 1
1331
- }, 8, ["label", "error"]),
1332
- x.value !== "hidden" ? (m(), M(Z, { key: 0 }, [
1333
- x.value !== "consent" ? (m(), _(e(L), {
1334
- key: 0,
1335
- label: e(l)("fields.placeholder")
1336
- }, {
1337
- default: d(() => [
1338
- u(e(K), {
1339
- modelValue: H.value,
1340
- "onUpdate:modelValue": r[2] || (r[2] = (s) => H.value = s),
1341
- localized: ""
1342
- }, null, 8, ["modelValue"])
1343
- ]),
1344
- _: 1
1345
- }, 8, ["label"])) : W("", !0),
1346
- u(e(L), {
1347
- label: e(l)("fields.help")
1348
- }, {
1349
- default: d(() => [
1350
- u(e(K), {
1351
- modelValue: k.value,
1352
- "onUpdate:modelValue": r[3] || (r[3] = (s) => k.value = s),
1353
- localized: ""
1354
- }, null, 8, ["modelValue"])
1355
- ]),
1356
- _: 1
1357
- }, 8, ["label"])
1358
- ], 64)) : W("", !0),
1359
- x.value === "consent" ? (m(), _(e(L), {
1360
- key: 1,
1361
- label: e(l)("fields.consent-text"),
1362
- help: e(l)("fields.consent-text-help")
1363
- }, {
1364
- default: d(() => [
1365
- u(Xt, {
1366
- "model-value": y.value.text ?? {},
1367
- "min-height": "100px",
1368
- "onUpdate:modelValue": r[4] || (r[4] = (s) => D("text", s))
1369
- }, null, 8, ["model-value"])
1370
- ]),
1371
- _: 1
1372
- }, 8, ["label", "help"])) : W("", !0),
1373
- be.value ? (m(), M("div", jt, [
1374
- u(e(ee), {
1375
- size: "sm",
1376
- weight: "medium"
1377
- }, {
1378
- default: d(() => [
1379
- z(I(e(l)("fields.choices")), 1)
1380
- ]),
1381
- _: 1
1382
- }),
1383
- Q.value.length === 0 ? (m(), _(e(ee), {
1384
- key: 0,
1385
- size: "sm",
1386
- tone: "placeholder"
1387
- }, {
1388
- default: d(() => [
1389
- z(I(e(l)("fields.no-choices")), 1)
1390
- ]),
1391
- _: 1
1392
- })) : W("", !0),
1393
- (m(!0), M(Z, null, Oe(Q.value, (s, O) => (m(), M("div", {
1394
- key: O,
1395
- class: "wx-inbox-choices__row"
1396
- }, [
1397
- u(e(K), {
1398
- "model-value": s.value,
1399
- placeholder: e(l)("fields.choice-value"),
1400
- "onUpdate:modelValue": (Y) => J(O, { value: String(Y) })
1401
- }, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"]),
1402
- u(e(K), {
1403
- "model-value": s.label,
1404
- localized: "",
1405
- placeholder: e(l)("fields.choice-label"),
1406
- "onUpdate:modelValue": (Y) => J(O, { label: Y })
1407
- }, null, 8, ["model-value", "placeholder", "onUpdate:modelValue"]),
1408
- u(e(De), tt({
1409
- icon: "trash",
1410
- tone: "danger",
1411
- title: e(l)("fields.delete")
1412
- }, { ref_for: !0 }, e(g), {
1413
- onClick: (Y) => Se(O)
1414
- }), null, 16, ["title", "onClick"])
1415
- ]))), 128)),
1416
- u(e(te), {
1417
- variant: "outline",
1418
- size: "sm",
1419
- onClick: $e
1420
- }, {
1421
- icon: d(() => [
1422
- u(e(ke), { name: "plus" })
1423
- ]),
1424
- default: d(() => [
1425
- z(" " + I(e(l)("fields.add-choice")), 1)
1426
- ]),
1427
- _: 1
1428
- }),
1429
- ae("options.choices") ? (m(), _(e(ee), {
1430
- key: 1,
1431
- size: "sm",
1432
- tone: "danger"
1433
- }, {
1434
- default: d(() => [
1435
- z(I(ae("options.choices")), 1)
1436
- ]),
1437
- _: 1
1438
- })) : W("", !0)
1439
- ])) : W("", !0),
1440
- G("div", Kt, [
1441
- x.value === "textarea" ? (m(), _(e(L), {
1442
- key: 0,
1443
- label: e(l)("fields.rows")
1444
- }, {
1445
- default: d(() => [
1446
- u(e(me), {
1447
- "model-value": y.value.rows ?? 5,
1448
- min: 2,
1449
- max: 30,
1450
- "onUpdate:modelValue": r[5] || (r[5] = (s) => D("rows", s))
1451
- }, null, 8, ["model-value"])
1452
- ]),
1453
- _: 1
1454
- }, 8, ["label"])) : W("", !0),
1455
- ["text", "email", "textarea"].includes(x.value) ? (m(), _(e(L), {
1456
- key: 1,
1457
- label: e(l)("fields.maxlength")
1458
- }, {
1459
- default: d(() => [
1460
- u(e(me), {
1461
- "model-value": y.value.maxlength ?? null,
1462
- min: 1,
1463
- max: 2e4,
1464
- "onUpdate:modelValue": r[6] || (r[6] = (s) => D("maxlength", s))
1465
- }, null, 8, ["model-value"])
1466
- ]),
1467
- _: 1
1468
- }, 8, ["label"])) : W("", !0),
1469
- x.value === "tel" ? (m(), _(e(L), {
1470
- key: 2,
1471
- label: e(l)("fields.pattern"),
1472
- help: e(l)("fields.pattern-help")
1473
- }, {
1474
- default: d(() => [
1475
- u(e(K), {
1476
- "model-value": y.value.pattern ?? "",
1477
- "onUpdate:modelValue": r[7] || (r[7] = (s) => D("pattern", s))
1478
- }, null, 8, ["model-value"])
1479
- ]),
1480
- _: 1
1481
- }, 8, ["label", "help"])) : W("", !0),
1482
- x.value === "date" ? (m(), M(Z, { key: 3 }, [
1483
- u(e(L), {
1484
- label: e(l)("fields.earliest")
1485
- }, {
1486
- default: d(() => [
1487
- u(e(Ue), {
1488
- clearable: "",
1489
- "model-value": y.value.min ?? null,
1490
- "onUpdate:modelValue": r[8] || (r[8] = (s) => D("min", s))
1491
- }, null, 8, ["model-value"])
1492
- ]),
1493
- _: 1
1494
- }, 8, ["label"]),
1495
- u(e(L), {
1496
- label: e(l)("fields.latest")
1497
- }, {
1498
- default: d(() => [
1499
- u(e(Ue), {
1500
- clearable: "",
1501
- "model-value": y.value.max ?? null,
1502
- "onUpdate:modelValue": r[9] || (r[9] = (s) => D("max", s))
1503
- }, null, 8, ["model-value"])
1504
- ]),
1505
- _: 1
1506
- }, 8, ["label"])
1507
- ], 64)) : W("", !0),
1508
- x.value === "checkbox" ? (m(), M(Z, { key: 4 }, [
1509
- u(e(L), {
1510
- label: e(l)("fields.min-choices")
1511
- }, {
1512
- default: d(() => [
1513
- u(e(me), {
1514
- "model-value": y.value.min ?? null,
1515
- min: 0,
1516
- "onUpdate:modelValue": r[10] || (r[10] = (s) => D("min", s))
1517
- }, null, 8, ["model-value"])
1518
- ]),
1519
- _: 1
1520
- }, 8, ["label"]),
1521
- u(e(L), {
1522
- label: e(l)("fields.max-choices")
1523
- }, {
1524
- default: d(() => [
1525
- u(e(me), {
1526
- "model-value": y.value.max ?? null,
1527
- min: 0,
1528
- "onUpdate:modelValue": r[11] || (r[11] = (s) => D("max", s))
1529
- }, null, 8, ["model-value"])
1530
- ]),
1531
- _: 1
1532
- }, 8, ["label"])
1533
- ], 64)) : W("", !0),
1534
- x.value === "file" ? (m(), _(e(L), {
1535
- key: 5,
1536
- label: e(l)("fields.max-size")
1537
- }, {
1538
- default: d(() => [
1539
- u(e(me), {
1540
- "model-value": y.value.max_size ?? null,
1541
- min: 1,
1542
- "onUpdate:modelValue": r[12] || (r[12] = (s) => D("max_size", s))
1543
- }, null, 8, ["model-value"])
1544
- ]),
1545
- _: 1
1546
- }, 8, ["label"])) : W("", !0)
1547
- ]),
1548
- x.value === "file" ? (m(), M(Z, { key: 3 }, [
1549
- u(e(L), {
1550
- label: e(l)("fields.extensions"),
1551
- help: e(l)("fields.extensions-help")
1552
- }, {
1553
- default: d(() => [
1554
- u(e(pt), {
1555
- modelValue: de.value,
1556
- "onUpdate:modelValue": r[13] || (r[13] = (s) => de.value = s)
1557
- }, null, 8, ["modelValue"])
1558
- ]),
1559
- _: 1
1560
- }, 8, ["label", "help"]),
1561
- u(e(se), {
1562
- "model-value": !!y.value.multiple,
1563
- label: e(l)("fields.multiple"),
1564
- "onUpdate:modelValue": r[14] || (r[14] = (s) => D("multiple", s))
1565
- }, null, 8, ["model-value", "label"])
1566
- ], 64)) : W("", !0),
1567
- G("div", Zt, [
1568
- u(e(se), {
1569
- modelValue: P.value,
1570
- "onUpdate:modelValue": r[15] || (r[15] = (s) => P.value = s),
1571
- label: e(l)("fields.is-enabled")
1572
- }, null, 8, ["modelValue", "label"]),
1573
- u(e(se), {
1574
- modelValue: X.value,
1575
- "onUpdate:modelValue": r[16] || (r[16] = (s) => X.value = s),
1576
- label: e(l)("fields.is-required")
1577
- }, null, 8, ["modelValue", "label"]),
1578
- x.value !== "hidden" ? (m(), _(e(se), {
1579
- key: 0,
1580
- modelValue: V.value,
1581
- "onUpdate:modelValue": r[17] || (r[17] = (s) => V.value = s),
1582
- label: e(l)("fields.is-fullsize")
1583
- }, null, 8, ["modelValue", "label"])) : W("", !0),
1584
- u(e(se), {
1585
- modelValue: v.value,
1586
- "onUpdate:modelValue": r[18] || (r[18] = (s) => v.value = s),
1587
- label: e(l)("fields.in-table")
1588
- }, null, 8, ["modelValue", "label"])
1589
- ]),
1590
- G("section", Qt, [
1591
- u(e(ee), {
1592
- size: "sm",
1593
- weight: "medium",
1594
- tone: "muted"
1595
- }, {
1596
- default: d(() => [
1597
- z(I(e(l)("fields.advanced")), 1)
1598
- ]),
1599
- _: 1
1600
- }),
1601
- u(e(L), {
1602
- label: e(l)("fields.name"),
1603
- help: e(l)("fields.name-help", { name: q.value.trim() || "name" }),
1604
- error: ae("name")
1605
- }, {
1606
- default: d(() => [
1607
- u(e(K), {
1608
- "model-value": q.value,
1609
- placeholder: "phone",
1610
- "onUpdate:modelValue": r[19] || (r[19] = (s) => R(String(s ?? "")))
1611
- }, null, 8, ["model-value"])
1612
- ]),
1613
- _: 1
1614
- }, 8, ["label", "help", "error"]),
1615
- ve.value ? (m(), _(e(Ne), {
1616
- key: 0,
1617
- type: "warning",
1618
- variant: "soft",
1619
- description: e(l)("fields.name-renamed", { old: ve.value, new: q.value.trim() })
1620
- }, null, 8, ["description"])) : W("", !0)
1621
- ])
1622
- ])
1623
- ]),
1624
- _: 1
1625
- }, 8, ["open", "title"]));
1626
- }
1627
- }), el = /* @__PURE__ */ fe(Jt, [["__scopeId", "data-v-8b202bc1"]]), tl = { class: "wx-inbox-field" }, ll = { class: "wx-inbox-field__name" }, al = /* @__PURE__ */ oe({
1628
- __name: "FieldList",
1629
- props: /* @__PURE__ */ Ie({
1630
- form: {},
1631
- canManage: { type: Boolean }
1632
- }, {
1633
- modelValue: { required: !0 },
1634
- modelModifiers: {}
1635
- }),
1636
- emits: ["update:modelValue"],
1637
- setup(a) {
1638
- const n = a, c = Fe(a, "modelValue"), b = re(), w = Te(b), B = ie();
1639
- he();
1640
- const t = le("webx-inbox"), l = Ve(), g = Ge(el);
1641
- function S(k) {
1642
- return pe(k.title, B.active.value, k.key);
1643
- }
1644
- function N(k) {
1645
- return [
1646
- t(`fields.type-${k.type}`),
1647
- ...k.is_required ? [t("fields.is-required")] : [],
1648
- ...k.in_table ? [t("fields.in-table")] : [],
1649
- ...k.is_fullsize ? [] : [t("fields.is-fullsize")]
1650
- ];
1651
- }
1652
- const C = A(() => c.value.length === 0);
1653
- async function q(k) {
1654
- const y = c.value.filter((E) => E.id !== k?.id).map((E) => E.key), $ = await g({ field: k, form: n.form, taken: y });
1655
- $ && (c.value = k === null ? [...c.value, $] : c.value.map((E) => E.id === $.id ? $ : E));
1656
- }
1657
- async function x(k) {
1658
- if (await Ye({
1659
- title: t("fields.delete-title", { field: S(k) }),
1660
- message: t("fields.delete-text"),
1661
- confirmText: t("fields.delete"),
1662
- cancelText: t("fields.cancel"),
1663
- tone: "danger"
1664
- }))
1665
- try {
1666
- await w.removeField(k.id), c.value = c.value.filter(($) => $.id !== k.id), j.success(t("panel.deleted"));
1667
- } catch ($) {
1668
- j.danger(l($));
1669
- }
1670
- }
1671
- function p(k) {
1672
- return n.canManage ? [
1673
- { key: "edit", icon: "edit", label: t("fields.edit"), run: () => {
1674
- q(k);
1675
- } },
1676
- {
1677
- key: "delete",
1678
- icon: "trash",
1679
- label: t("fields.delete"),
1680
- danger: !0,
1681
- run: () => {
1682
- x(k);
1683
- }
1684
- }
1685
- ] : [];
1686
- }
1687
- async function H() {
1688
- try {
1689
- await w.sortFields(
1690
- n.form.id,
1691
- c.value.map((k) => k.id)
1692
- );
1693
- } catch (k) {
1694
- j.danger(l(k, t("panel.reorder-failed")));
1695
- }
1696
- }
1697
- return (k, y) => (m(), _(e(ht), {
1698
- title: e(t)("panel.tab-fields")
1699
- }, Le({
1700
- default: d(() => [
1701
- C.value ? (m(), _(e(ft), {
1702
- key: 0,
1703
- title: e(t)("fields.no-fields"),
1704
- description: e(t)("fields.no-fields-help")
1705
- }, null, 8, ["title", "description"])) : (m(), _(e(vt), {
1706
- key: 1,
1707
- modelValue: c.value,
1708
- "onUpdate:modelValue": y[1] || (y[1] = ($) => c.value = $),
1709
- plain: "",
1710
- "item-key": "id",
1711
- "item-label": S,
1712
- "drag-label": e(t)("panel.reorder"),
1713
- disabled: !a.canManage,
1714
- "aria-label": e(t)("panel.tab-fields"),
1715
- onMove: H
1716
- }, {
1717
- default: d(({ item: $ }) => [
1718
- G("div", tl, [
1719
- G("div", ll, [
1720
- u(e(ee), {
1721
- weight: "medium",
1722
- truncate: ""
1723
- }, {
1724
- default: d(() => [
1725
- z(I(S($)), 1)
1726
- ]),
1727
- _: 2
1728
- }, 1024),
1729
- $.is_enabled ? W("", !0) : (m(), _(e(xe), {
1730
- key: 0,
1731
- type: "default"
1732
- }, {
1733
- default: d(() => [
1734
- z(I(e(t)("panel.off")), 1)
1735
- ]),
1736
- _: 1
1737
- }))
1738
- ]),
1739
- u(e(ee), {
1740
- size: "sm",
1741
- tone: "muted",
1742
- truncate: ""
1743
- }, {
1744
- default: d(() => [
1745
- $.name ? (m(), M(Z, { key: 0 }, [
1746
- G("code", null, I($.name), 1),
1747
- y[2] || (y[2] = z(" · ", -1))
1748
- ], 64)) : W("", !0),
1749
- z(I(N($).join(" · ")), 1)
1750
- ]),
1751
- _: 2
1752
- }, 1024)
1753
- ])
1754
- ]),
1755
- actions: d(({ item: $ }) => [
1756
- u(e(We), {
1757
- actions: p($),
1758
- label: S($)
1759
- }, null, 8, ["actions", "label"])
1760
- ]),
1761
- _: 1
1762
- }, 8, ["modelValue", "drag-label", "disabled", "aria-label"]))
1763
- ]),
1764
- _: 2
1765
- }, [
1766
- a.canManage ? {
1767
- name: "extra",
1768
- fn: d(() => [
1769
- u(e(te), {
1770
- type: "primary",
1771
- size: "sm",
1772
- onClick: y[0] || (y[0] = ($) => q(null))
1773
- }, {
1774
- icon: d(() => [
1775
- u(e(ke), { name: "plus" })
1776
- ]),
1777
- default: d(() => [
1778
- z(" " + I(e(t)("fields.new-field")), 1)
1779
- ]),
1780
- _: 1
1781
- })
1782
- ]),
1783
- key: "0"
1784
- } : void 0
1785
- ]), 1032, ["title"]));
1786
- }
1787
- }), ml = /* @__PURE__ */ fe(al, [["__scopeId", "data-v-5d9f662e"]]), pl = _e(() => import("./InboxPage-D20_MKcX.js")), hl = _e(() => import("./FormEditorPage-DC5AjYv6.js")), fl = _e(() => import("./StatusesPage-hBgS8sYt.js")), vl = _e(() => import("./SubmissionPage-3Fhny2qD.js"));
1788
- export {
1789
- ml as F,
1790
- dl as S,
1791
- hl as W,
1792
- fe as _,
1793
- Xt as a,
1794
- cl as b,
1795
- Te as c,
1796
- Ct as d,
1797
- Gt as e,
1798
- Rt as f,
1799
- pl as g,
1800
- fl as h,
1801
- vl as i,
1802
- rl as j,
1803
- At as k,
1804
- ul as o,
1805
- he as u
1806
- };
1807
- //# sourceMappingURL=index-C_zPRhNm.js.map