@realtek/core-theme 0.0.372 → 0.0.373
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-lib/FacebookCourseMappingsSection-7b-UVe60.cjs +3 -0
- package/dist-lib/FacebookCourseMappingsSection-7b-UVe60.cjs.map +1 -0
- package/dist-lib/{FacebookCourseMappingsSection-Bz02KuSg.js → FacebookCourseMappingsSection-rwzWu8Z5.js} +812 -618
- package/dist-lib/FacebookCourseMappingsSection-rwzWu8Z5.js.map +1 -0
- package/dist-lib/index.cjs +3 -3
- package/dist-lib/index.cjs.map +1 -1
- package/dist-lib/index.js +656 -531
- package/dist-lib/index.js.map +1 -1
- package/package.json +1 -1
- package/dist-lib/FacebookCourseMappingsSection-Bz02KuSg.js.map +0 -1
- package/dist-lib/FacebookCourseMappingsSection-tY0WM5Yl.cjs +0 -3
- package/dist-lib/FacebookCourseMappingsSection-tY0WM5Yl.cjs.map +0 -1
|
@@ -2,7 +2,7 @@ import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
|
2
2
|
import { O as t, b as n, u as r, y as i } from "./authApi-B0Y5f--u.js";
|
|
3
3
|
import { H as a, lt as o } from "./adminApi-BjbNzQRi.js";
|
|
4
4
|
import { useCallback as s, useEffect as c, useLayoutEffect as l, useMemo as u, useRef as d, useState as f } from "react";
|
|
5
|
-
import { Alert as p, Breadcrumb as m, Button as h, Checkbox as ee, Col as g, Collapse as
|
|
5
|
+
import { Alert as p, Breadcrumb as m, Button as h, Checkbox as ee, Col as g, Collapse as te, DatePicker as ne, Drawer as _, Dropdown as re, Empty as v, Form as y, Input as ie, InputNumber as b, Modal as ae, Popconfirm as x, Progress as S, Radio as C, Row as w, Segmented as oe, Select as T, Skeleton as E, Space as D, Switch as O, Table as k, Tabs as se, Tag as A, TimePicker as j, Tooltip as M, Typography as ce, message as N } from "antd";
|
|
6
6
|
import { ArrowDownOutlined as le, ArrowUpOutlined as ue, BarChartOutlined as P, CheckCircleOutlined as de, ClockCircleOutlined as F, DeleteOutlined as fe, DragOutlined as pe, EditOutlined as me, InboxOutlined as I, InfoCircleOutlined as L, MoreOutlined as he, PlusOutlined as ge, ReloadOutlined as R, SearchOutlined as _e, SwapOutlined as ve, SyncOutlined as z, TeamOutlined as ye, ThunderboltOutlined as B, UserOutlined as V, WarningOutlined as H } from "@ant-design/icons";
|
|
7
7
|
import { Fragment as U, jsx as W, jsxs as G } from "react/jsx-runtime";
|
|
8
8
|
import K from "dayjs";
|
|
@@ -32,7 +32,7 @@ function xe({ items: e = [], loading: t = !1, className: n = "", ariaLabel: r =
|
|
|
32
32
|
3
|
|
33
33
|
].map((e) => /* @__PURE__ */ W("div", {
|
|
34
34
|
className: "cc-stat",
|
|
35
|
-
children: /* @__PURE__ */ W(
|
|
35
|
+
children: /* @__PURE__ */ W(E.Button, {
|
|
36
36
|
active: !0,
|
|
37
37
|
size: "small",
|
|
38
38
|
style: { width: 56 }
|
|
@@ -140,24 +140,29 @@ var Pe = ({ formId: e, counsellorIds: t, isActive: n, version: r }, i) => $(i ?
|
|
|
140
140
|
isActive: n,
|
|
141
141
|
...r == null ? {} : { version: r }
|
|
142
142
|
})
|
|
143
|
-
})
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
}), Fe = (e, { groupBy: t = "", details: n = !1 } = {}) => {
|
|
144
|
+
t && e.set("groupBy", t), n && e.set("details", "1");
|
|
145
|
+
};
|
|
146
|
+
function Ie({ page: e = 1, limit: t = 20, formId: n = "", groupBy: r = "" } = {}) {
|
|
147
|
+
let i = new URLSearchParams({
|
|
146
148
|
page: String(e),
|
|
147
149
|
limit: String(t)
|
|
148
150
|
});
|
|
149
|
-
return n &&
|
|
151
|
+
return n && i.set("formId", n), Fe(i, { groupBy: r }), $(`/distribution-skips?${i}`);
|
|
150
152
|
}
|
|
151
|
-
function
|
|
152
|
-
let
|
|
153
|
+
function Le({ status: e = "unassigned", page: t = 1, limit: n = 20, formId: r = "", groupBy: i = "", details: a = !1 } = {}) {
|
|
154
|
+
let o = new URLSearchParams({
|
|
153
155
|
status: e,
|
|
154
156
|
page: String(t),
|
|
155
157
|
limit: String(n)
|
|
156
158
|
});
|
|
157
|
-
return r &&
|
|
159
|
+
return r && o.set("formId", r), Fe(o, {
|
|
160
|
+
groupBy: i,
|
|
161
|
+
details: a
|
|
162
|
+
}), $(`/unassigned-leads?${o}`);
|
|
158
163
|
}
|
|
159
|
-
var
|
|
160
|
-
function
|
|
164
|
+
var Re = (e) => $(`/distribution/${encodeURIComponent(e)}`, { method: "DELETE" }), ze = () => $("/distribution-alerts"), Be = () => $("/reassign/summary").then((e) => e.counsellors || []);
|
|
165
|
+
function Ve({ fromUserId: e, formId: t = "", page: n = 1, limit: r = 20 } = {}) {
|
|
161
166
|
let i = new URLSearchParams({
|
|
162
167
|
fromUserId: e,
|
|
163
168
|
page: String(n),
|
|
@@ -165,53 +170,56 @@ function Be({ fromUserId: e, formId: t = "", page: n = 1, limit: r = 20 } = {})
|
|
|
165
170
|
});
|
|
166
171
|
return t && i.set("formId", t), $(`/reassign/leads?${i}`);
|
|
167
172
|
}
|
|
168
|
-
var
|
|
173
|
+
var He = (e) => $("/reassign", {
|
|
169
174
|
method: "POST",
|
|
170
175
|
body: JSON.stringify(e)
|
|
171
176
|
});
|
|
172
|
-
function
|
|
177
|
+
function Ue({ page: e = 1, limit: t = 20, formId: n = "", leadId: r = "" } = {}) {
|
|
173
178
|
let i = new URLSearchParams({
|
|
174
179
|
page: String(e),
|
|
175
180
|
limit: String(t)
|
|
176
181
|
});
|
|
177
182
|
return n && i.set("formId", n), r && i.set("leadId", r), $(`/reassignments?${i}`);
|
|
178
183
|
}
|
|
179
|
-
var
|
|
180
|
-
function
|
|
181
|
-
let
|
|
184
|
+
var We = () => $("/meta");
|
|
185
|
+
function Ge({ page: e = 1, limit: t = 20, formId: n = "", groupBy: r = "", details: i = !1 } = {}) {
|
|
186
|
+
let a = new URLSearchParams({
|
|
182
187
|
page: String(e),
|
|
183
188
|
limit: String(t)
|
|
184
189
|
});
|
|
185
|
-
return n &&
|
|
190
|
+
return n && a.set("formId", n), Fe(a, {
|
|
191
|
+
groupBy: r,
|
|
192
|
+
details: i
|
|
193
|
+
}), $(`/failed-leads?${a}`);
|
|
186
194
|
}
|
|
187
|
-
var
|
|
188
|
-
function
|
|
195
|
+
var Ke = (e) => $(`/failed-leads/${encodeURIComponent(e)}/retry`, { method: "POST" });
|
|
196
|
+
function qe({ page: e = 1, limit: t = 20, formId: n = "" } = {}) {
|
|
189
197
|
let r = new URLSearchParams({
|
|
190
198
|
page: String(e),
|
|
191
199
|
limit: String(t)
|
|
192
200
|
});
|
|
193
201
|
return n && r.set("formId", n), $(`/history?${r}`);
|
|
194
202
|
}
|
|
195
|
-
var
|
|
203
|
+
var Je = (e) => {
|
|
196
204
|
let t = new URLSearchParams();
|
|
197
205
|
Object.entries(e || {}).forEach(([e, n]) => {
|
|
198
206
|
n != null && n !== "" && t.set(e, String(n));
|
|
199
207
|
});
|
|
200
208
|
let n = t.toString();
|
|
201
209
|
return n ? `?${n}` : "";
|
|
202
|
-
},
|
|
210
|
+
}, Ye = (e) => $(`/distribution/overview${Je({ date: e })}`), Xe = () => $("/distribution/settings"), Ze = (e) => $("/distribution/settings", {
|
|
203
211
|
method: "PUT",
|
|
204
212
|
body: JSON.stringify(e)
|
|
205
|
-
}),
|
|
213
|
+
}), Qe = (e, t, n = "") => $(`/distribution/counsellors/${encodeURIComponent(e)}/enabled`, {
|
|
206
214
|
method: "PUT",
|
|
207
215
|
body: JSON.stringify({
|
|
208
216
|
enabled: t,
|
|
209
217
|
reason: n
|
|
210
218
|
})
|
|
211
|
-
}),
|
|
219
|
+
}), $e = (e) => $(`/distribution/leaves${Je({ from: e })}`), et = (e) => $("/distribution/leaves", {
|
|
212
220
|
method: "POST",
|
|
213
221
|
body: JSON.stringify(e)
|
|
214
|
-
}),
|
|
222
|
+
}), tt = (e) => $(`/distribution/leaves/${encodeURIComponent(e)}`, { method: "DELETE" }), nt = (e) => $(`/distribution/queue${Je(e)}`), rt = (e) => $(`/distribution/assignments${Je(e)}`), { Text: it } = ce, at = (e) => e ? new Date(e).toLocaleString() : "—", ot = (e, t) => `${e} ${t}${e === 1 ? "" : "s"}`, st = [
|
|
215
223
|
{
|
|
216
224
|
value: "on_leave",
|
|
217
225
|
label: "On leave"
|
|
@@ -228,27 +236,27 @@ var qe = (e) => {
|
|
|
228
236
|
value: "other",
|
|
229
237
|
label: "Other"
|
|
230
238
|
}
|
|
231
|
-
],
|
|
239
|
+
], ct = {
|
|
232
240
|
no_active_counsellor: "no active counsellor",
|
|
233
241
|
distribution_not_configured: "no counsellors set up for the form",
|
|
234
242
|
distribution_disabled: "automatic turns are paused",
|
|
235
243
|
default_owner_inactive_or_missing: "default owner inactive"
|
|
236
|
-
},
|
|
244
|
+
}, lt = {
|
|
237
245
|
not_open_or_not_assigned_to_counsellor: "no longer open or no longer with this counsellor",
|
|
238
246
|
changed_during_reassign: "was updated by the counsellor while moving (run again)",
|
|
239
247
|
update_failed: "could not be saved"
|
|
240
248
|
};
|
|
241
|
-
function
|
|
249
|
+
function ut({ canEdit: e = !0, fromId: t, toId: n, movingCount: r, reasonOk: i, minReason: a }) {
|
|
242
250
|
if (!e) return "You don't have permission to move leads.";
|
|
243
251
|
let o = [];
|
|
244
252
|
return t || o.push("choose who the leads are moving from"), r || o.push("choose at least one lead"), n || o.push("choose who gets the leads"), i || o.push(`write a reason of at least ${a} characters`), o.length ? `To continue, ${o.join(", ")}.` : "";
|
|
245
253
|
}
|
|
246
|
-
function
|
|
254
|
+
function dt({ id: e, rows: t = [], value: n, onChange: r, minWidth: i = 260 }) {
|
|
247
255
|
let a = u(() => t.map((e) => ({
|
|
248
256
|
value: e.formId,
|
|
249
257
|
label: e.formName
|
|
250
258
|
})), [t]);
|
|
251
|
-
return /* @__PURE__ */ W(
|
|
259
|
+
return /* @__PURE__ */ W(T, {
|
|
252
260
|
id: e,
|
|
253
261
|
showSearch: !0,
|
|
254
262
|
optionFilterProp: "label",
|
|
@@ -266,7 +274,7 @@ function ut({ id: e, rows: t = [], value: n, onChange: r, minWidth: i = 260 }) {
|
|
|
266
274
|
notFoundContent: "No matching forms"
|
|
267
275
|
});
|
|
268
276
|
}
|
|
269
|
-
function
|
|
277
|
+
function ft({ refreshKey: e = 0, pollMs: t = 6e4 } = {}) {
|
|
270
278
|
let [n, r] = f({
|
|
271
279
|
alerts: null,
|
|
272
280
|
alertsOk: !1,
|
|
@@ -274,7 +282,7 @@ function dt({ refreshKey: e = 0, pollMs: t = 6e4 } = {}) {
|
|
|
274
282
|
});
|
|
275
283
|
return c(() => {
|
|
276
284
|
let e = !0, n = () => {
|
|
277
|
-
typeof document < "u" && document.hidden || Promise.allSettled([
|
|
285
|
+
typeof document < "u" && document.hidden || Promise.allSettled([ze(), Ge({
|
|
278
286
|
page: 1,
|
|
279
287
|
limit: 1
|
|
280
288
|
})]).then(([t, n]) => {
|
|
@@ -292,15 +300,15 @@ function dt({ refreshKey: e = 0, pollMs: t = 6e4 } = {}) {
|
|
|
292
300
|
};
|
|
293
301
|
}, [e, t]), n;
|
|
294
302
|
}
|
|
295
|
-
function
|
|
303
|
+
function pt(e) {
|
|
296
304
|
let t = [...e?.formsWithoutActiveCounsellor || [], ...e?.waitingForms || []].map((e) => String(e.formId)).filter(Boolean);
|
|
297
305
|
return [...new Set(t)];
|
|
298
306
|
}
|
|
299
|
-
function
|
|
300
|
-
let i = Number(e?.unassignedCount || 0), a = e?.formsWithoutActiveCounsellor || [], o = Number(t || 0), s =
|
|
307
|
+
function mt({ alerts: e, failedCount: t = 0, onViewLeads: n, onShowForms: r }) {
|
|
308
|
+
let i = Number(e?.unassignedCount || 0), a = e?.formsWithoutActiveCounsellor || [], o = Number(t || 0), s = pt(e);
|
|
301
309
|
if (!i && !a.length && !o) return null;
|
|
302
310
|
let c = [];
|
|
303
|
-
i && c.push(`${
|
|
311
|
+
i && c.push(`${ot(i, "lead")} waiting`), a.length && c.push(`${ot(a.length, "form")} with no active counsellor`), o && c.push(`${ot(o, "lead")} failed`);
|
|
304
312
|
let l = [...new Set([...a, ...e?.waitingForms || []].map((e) => e.formName).filter(Boolean))], u = l.slice(0, 2).join(", "), d = l.length > 2 ? ` and ${l.length - 2} more` : "";
|
|
305
313
|
return /* @__PURE__ */ W(q, {
|
|
306
314
|
className: "fb-attention",
|
|
@@ -321,17 +329,17 @@ function pt({ alerts: e, failedCount: t = 0, onViewLeads: n, onShowForms: r }) {
|
|
|
321
329
|
})
|
|
322
330
|
});
|
|
323
331
|
}
|
|
324
|
-
function
|
|
325
|
-
let [l, d] = f([]), [m, ee] = f(!1), [g,
|
|
332
|
+
function ht({ rows: e = [], eligibleCounsellors: t = [], onChanged: n, limits: r, reasonTypes: i, canEdit: a = !0, refreshKey: o = 0 }) {
|
|
333
|
+
let [l, d] = f([]), [m, ee] = f(!1), [g, ne] = f(""), [_, re] = f(""), [v, y] = f({
|
|
326
334
|
leads: [],
|
|
327
335
|
total: 0
|
|
328
|
-
}), [
|
|
336
|
+
}), [b, x] = f(!1), [S, w] = f(1), [oe, E] = f([]), [D, O] = f(!1), [se, j] = f(""), [M, ce] = f("on_leave"), [le, ue] = f(""), [P, de] = f(!1), [F, fe] = f(""), [pe, me] = f({
|
|
329
337
|
reassignments: [],
|
|
330
338
|
total: 0
|
|
331
|
-
}), [I, L] = f(1), [he, ge] = f(!1), R = Number(r?.minReason) || 5, _e = Number(r?.maxReason) || 500, z = Number(r?.maxPerRun) || 500, ye = i?.length ? i :
|
|
339
|
+
}), [I, L] = f(1), [he, ge] = f(!1), R = Number(r?.minReason) || 5, _e = Number(r?.maxReason) || 500, z = Number(r?.maxPerRun) || 500, ye = i?.length ? i : st, B = Object.fromEntries(ye.map((e) => [e.value, e.label])), V = B[M] ? M : ye[0]?.value, H = s(async () => {
|
|
332
340
|
ee(!0);
|
|
333
341
|
try {
|
|
334
|
-
d(await
|
|
342
|
+
d(await Be()), fe("");
|
|
335
343
|
} catch (e) {
|
|
336
344
|
fe(e.message);
|
|
337
345
|
} finally {
|
|
@@ -339,36 +347,36 @@ function mt({ rows: e = [], eligibleCounsellors: t = [], onChanged: n, limits: r
|
|
|
339
347
|
}
|
|
340
348
|
}, []), K = s(async () => {
|
|
341
349
|
if (!g) {
|
|
342
|
-
|
|
350
|
+
y({
|
|
343
351
|
leads: [],
|
|
344
352
|
total: 0
|
|
345
353
|
});
|
|
346
354
|
return;
|
|
347
355
|
}
|
|
348
|
-
|
|
356
|
+
x(!0);
|
|
349
357
|
try {
|
|
350
|
-
|
|
358
|
+
y(await Ve({
|
|
351
359
|
fromUserId: g,
|
|
352
|
-
formId:
|
|
353
|
-
page:
|
|
360
|
+
formId: _,
|
|
361
|
+
page: S,
|
|
354
362
|
limit: 20
|
|
355
363
|
})), fe("");
|
|
356
364
|
} catch (e) {
|
|
357
|
-
fe(e.message),
|
|
365
|
+
fe(e.message), y({
|
|
358
366
|
leads: [],
|
|
359
367
|
total: 0
|
|
360
368
|
});
|
|
361
369
|
} finally {
|
|
362
|
-
|
|
370
|
+
x(!1);
|
|
363
371
|
}
|
|
364
372
|
}, [
|
|
365
373
|
g,
|
|
366
|
-
|
|
367
|
-
|
|
374
|
+
_,
|
|
375
|
+
S
|
|
368
376
|
]), q = s(async () => {
|
|
369
377
|
ge(!0);
|
|
370
378
|
try {
|
|
371
|
-
me(await
|
|
379
|
+
me(await Ue({
|
|
372
380
|
page: I,
|
|
373
381
|
limit: 10
|
|
374
382
|
}));
|
|
@@ -385,49 +393,49 @@ function mt({ rows: e = [], eligibleCounsellors: t = [], onChanged: n, limits: r
|
|
|
385
393
|
}, [K, o]), c(() => {
|
|
386
394
|
q();
|
|
387
395
|
}, [q, o]);
|
|
388
|
-
let be = l.find((e) => e.userId === g), J = Number(
|
|
396
|
+
let be = l.find((e) => e.userId === g), J = Number(v.total || 0), xe = D ? Math.min(J, z) : oe.length, Se = u(() => t.filter((e) => e.userId !== g && e.isActive !== !1).map((e) => ({
|
|
389
397
|
value: e.userId,
|
|
390
398
|
label: e.name || e.email || e.userId
|
|
391
|
-
})), [t, g]), Y = Se.find((e) => e.value ===
|
|
399
|
+
})), [t, g]), Y = Se.find((e) => e.value === se)?.label || "", X = le.trim().length >= R, Ce = ut({
|
|
392
400
|
canEdit: a,
|
|
393
401
|
fromId: g,
|
|
394
|
-
toId:
|
|
402
|
+
toId: se,
|
|
395
403
|
movingCount: xe,
|
|
396
404
|
reasonOk: X,
|
|
397
405
|
minReason: R
|
|
398
406
|
}), we = !Ce && !P, Te = (e) => {
|
|
399
|
-
|
|
407
|
+
ne(e), w(1), E([]), O(!1), j("");
|
|
400
408
|
}, Ee = (e) => {
|
|
401
|
-
|
|
409
|
+
re(e), w(1), E([]), O(!1);
|
|
402
410
|
}, De = async () => {
|
|
403
411
|
de(!0);
|
|
404
412
|
try {
|
|
405
|
-
let e = await
|
|
413
|
+
let e = await He({
|
|
406
414
|
fromUserId: g,
|
|
407
|
-
toUserId:
|
|
415
|
+
toUserId: se,
|
|
408
416
|
reasonType: V,
|
|
409
417
|
reason: le.trim(),
|
|
410
|
-
...
|
|
411
|
-
...
|
|
418
|
+
..._ ? { formId: _ } : {},
|
|
419
|
+
...D ? { allOpen: !0 } : { leadIds: oe }
|
|
412
420
|
}), t = e.skipped || [];
|
|
413
421
|
if (N.success(`${e.moved} lead${e.moved === 1 ? "" : "s"} moved to ${e.to?.name || Y}`), t.length) {
|
|
414
422
|
let e = t.reduce((e, t) => ({
|
|
415
423
|
...e,
|
|
416
424
|
[t.reason]: (e[t.reason] || 0) + 1
|
|
417
425
|
}), {});
|
|
418
|
-
|
|
426
|
+
ae.warning({
|
|
419
427
|
title: `${t.length} lead${t.length === 1 ? " was" : "s were"} not moved`,
|
|
420
428
|
content: /* @__PURE__ */ W("ul", {
|
|
421
429
|
style: { paddingLeft: 18 },
|
|
422
430
|
children: Object.entries(e).map(([e, t]) => /* @__PURE__ */ G("li", { children: [
|
|
423
431
|
t,
|
|
424
432
|
" — ",
|
|
425
|
-
|
|
433
|
+
lt[e] || e
|
|
426
434
|
] }, e))
|
|
427
435
|
})
|
|
428
436
|
});
|
|
429
437
|
}
|
|
430
|
-
e.auditSaved === !1 && N.warning("Leads were moved, but the history row could not be saved. Each lead still has its own activity entry."), e.remaining > 0 && N.info(`${e.remaining} open lead${e.remaining === 1 ? "" : "s"} still with ${e.from?.name || "this counsellor"}. Run again to move them.`),
|
|
438
|
+
e.auditSaved === !1 && N.warning("Leads were moved, but the history row could not be saved. Each lead still has its own activity entry."), e.remaining > 0 && N.info(`${e.remaining} open lead${e.remaining === 1 ? "" : "s"} still with ${e.from?.name || "this counsellor"}. Run again to move them.`), E([]), O(!1), ue(""), await Promise.all([
|
|
431
439
|
H(),
|
|
432
440
|
K(),
|
|
433
441
|
q()
|
|
@@ -437,7 +445,7 @@ function mt({ rows: e = [], eligibleCounsellors: t = [], onChanged: n, limits: r
|
|
|
437
445
|
} finally {
|
|
438
446
|
de(!1);
|
|
439
447
|
}
|
|
440
|
-
}, Z = () =>
|
|
448
|
+
}, Z = () => ae.confirm({
|
|
441
449
|
title: `Move ${xe} lead${xe === 1 ? "" : "s"} to ${Y}?`,
|
|
442
450
|
okText: "Reassign",
|
|
443
451
|
width: 520,
|
|
@@ -461,7 +469,7 @@ function mt({ rows: e = [], eligibleCounsellors: t = [], onChanged: n, limits: r
|
|
|
461
469
|
le.trim()
|
|
462
470
|
]
|
|
463
471
|
}),
|
|
464
|
-
/* @__PURE__ */ W(
|
|
472
|
+
/* @__PURE__ */ W(it, {
|
|
465
473
|
type: "secondary",
|
|
466
474
|
children: "Each lead gets an activity entry and a history row. The previous counsellor stops seeing these leads. Pending follow-up reminders are not moved."
|
|
467
475
|
})
|
|
@@ -471,10 +479,10 @@ function mt({ rows: e = [], eligibleCounsellors: t = [], onChanged: n, limits: r
|
|
|
471
479
|
{
|
|
472
480
|
title: "Lead",
|
|
473
481
|
dataIndex: "name",
|
|
474
|
-
render: (e, t) => /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W(
|
|
482
|
+
render: (e, t) => /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W(it, {
|
|
475
483
|
strong: !0,
|
|
476
484
|
children: e || t.leadCode || t.facebookLeadId
|
|
477
|
-
}), /* @__PURE__ */ W("div", { children: /* @__PURE__ */ W(
|
|
485
|
+
}), /* @__PURE__ */ W("div", { children: /* @__PURE__ */ W(it, {
|
|
478
486
|
type: "secondary",
|
|
479
487
|
className: "fb-small",
|
|
480
488
|
children: t.leadCode || t.facebookLeadId
|
|
@@ -488,18 +496,18 @@ function mt({ rows: e = [], eligibleCounsellors: t = [], onChanged: n, limits: r
|
|
|
488
496
|
{
|
|
489
497
|
title: "Status",
|
|
490
498
|
dataIndex: "status",
|
|
491
|
-
render: (e) => /* @__PURE__ */ W(
|
|
499
|
+
render: (e) => /* @__PURE__ */ W(A, { children: e || "New Lead" })
|
|
492
500
|
},
|
|
493
501
|
{
|
|
494
502
|
title: "Received",
|
|
495
503
|
dataIndex: "createdAt",
|
|
496
|
-
render:
|
|
504
|
+
render: at
|
|
497
505
|
}
|
|
498
506
|
], ke = [
|
|
499
507
|
{
|
|
500
508
|
title: "When",
|
|
501
509
|
dataIndex: "reassignedAt",
|
|
502
|
-
render:
|
|
510
|
+
render: at
|
|
503
511
|
},
|
|
504
512
|
{
|
|
505
513
|
title: "Lead",
|
|
@@ -518,7 +526,7 @@ function mt({ rows: e = [], eligibleCounsellors: t = [], onChanged: n, limits: r
|
|
|
518
526
|
},
|
|
519
527
|
{
|
|
520
528
|
title: "Reason",
|
|
521
|
-
render: (e, t) => /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W(
|
|
529
|
+
render: (e, t) => /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W(A, { children: B[t.reasonType] || "Other" }), /* @__PURE__ */ W("div", {
|
|
522
530
|
style: { fontSize: 12 },
|
|
523
531
|
children: t.reason
|
|
524
532
|
})] })
|
|
@@ -531,7 +539,7 @@ function mt({ rows: e = [], eligibleCounsellors: t = [], onChanged: n, limits: r
|
|
|
531
539
|
return /* @__PURE__ */ G("div", {
|
|
532
540
|
className: "fb-tab-body",
|
|
533
541
|
children: [
|
|
534
|
-
/* @__PURE__ */ W(
|
|
542
|
+
/* @__PURE__ */ W(it, {
|
|
535
543
|
type: "secondary",
|
|
536
544
|
className: "fb-tab-intro",
|
|
537
545
|
children: "Automatic turns keep sending leads to a counsellor who is on leave. Move their open leads to someone else here."
|
|
@@ -551,7 +559,7 @@ function mt({ rows: e = [], eligibleCounsellors: t = [], onChanged: n, limits: r
|
|
|
551
559
|
className: "fb-field-label",
|
|
552
560
|
htmlFor: "fb-reassign-from",
|
|
553
561
|
children: "From"
|
|
554
|
-
}), /* @__PURE__ */ W(
|
|
562
|
+
}), /* @__PURE__ */ W(T, {
|
|
555
563
|
id: "fb-reassign-from",
|
|
556
564
|
showSearch: !0,
|
|
557
565
|
optionFilterProp: "label",
|
|
@@ -571,10 +579,10 @@ function mt({ rows: e = [], eligibleCounsellors: t = [], onChanged: n, limits: r
|
|
|
571
579
|
className: "fb-field-label",
|
|
572
580
|
htmlFor: "fb-reassign-form",
|
|
573
581
|
children: "Form"
|
|
574
|
-
}), /* @__PURE__ */ W(
|
|
582
|
+
}), /* @__PURE__ */ W(dt, {
|
|
575
583
|
id: "fb-reassign-form",
|
|
576
584
|
rows: e,
|
|
577
|
-
value:
|
|
585
|
+
value: _,
|
|
578
586
|
onChange: Ee,
|
|
579
587
|
minWidth: 0
|
|
580
588
|
})]
|
|
@@ -583,15 +591,15 @@ function mt({ rows: e = [], eligibleCounsellors: t = [], onChanged: n, limits: r
|
|
|
583
591
|
g && /* @__PURE__ */ G(U, { children: [
|
|
584
592
|
/* @__PURE__ */ G("div", {
|
|
585
593
|
className: "fb-block",
|
|
586
|
-
children: [/* @__PURE__ */ G(
|
|
587
|
-
value:
|
|
594
|
+
children: [/* @__PURE__ */ G(C.Group, {
|
|
595
|
+
value: D ? "all" : "pick",
|
|
588
596
|
onChange: (e) => {
|
|
589
|
-
|
|
597
|
+
O(e.target.value === "all"), e.target.value === "all" && E([]);
|
|
590
598
|
},
|
|
591
|
-
children: [/* @__PURE__ */ W(
|
|
599
|
+
children: [/* @__PURE__ */ W(C.Button, {
|
|
592
600
|
value: "pick",
|
|
593
601
|
children: "Choose leads"
|
|
594
|
-
}), /* @__PURE__ */ G(
|
|
602
|
+
}), /* @__PURE__ */ G(C.Button, {
|
|
595
603
|
value: "all",
|
|
596
604
|
children: [
|
|
597
605
|
"All ",
|
|
@@ -600,7 +608,7 @@ function mt({ rows: e = [], eligibleCounsellors: t = [], onChanged: n, limits: r
|
|
|
600
608
|
J === 1 ? "" : "s"
|
|
601
609
|
]
|
|
602
610
|
})]
|
|
603
|
-
}),
|
|
611
|
+
}), D && J > z && /* @__PURE__ */ G(it, {
|
|
604
612
|
type: "secondary",
|
|
605
613
|
className: "fb-hint-inline",
|
|
606
614
|
children: [
|
|
@@ -610,23 +618,23 @@ function mt({ rows: e = [], eligibleCounsellors: t = [], onChanged: n, limits: r
|
|
|
610
618
|
]
|
|
611
619
|
})]
|
|
612
620
|
}),
|
|
613
|
-
/* @__PURE__ */ W(
|
|
621
|
+
/* @__PURE__ */ W(k, {
|
|
614
622
|
size: "small",
|
|
615
623
|
rowKey: "id",
|
|
616
|
-
loading:
|
|
624
|
+
loading: b,
|
|
617
625
|
columns: Oe,
|
|
618
|
-
dataSource:
|
|
619
|
-
rowSelection:
|
|
620
|
-
selectedRowKeys:
|
|
626
|
+
dataSource: v.leads,
|
|
627
|
+
rowSelection: D ? void 0 : {
|
|
628
|
+
selectedRowKeys: oe,
|
|
621
629
|
preserveSelectedRowKeys: !0,
|
|
622
|
-
onChange: (e) =>
|
|
630
|
+
onChange: (e) => E(e)
|
|
623
631
|
},
|
|
624
632
|
pagination: {
|
|
625
|
-
current:
|
|
633
|
+
current: S,
|
|
626
634
|
pageSize: 20,
|
|
627
635
|
total: J,
|
|
628
636
|
showSizeChanger: !1,
|
|
629
|
-
onChange:
|
|
637
|
+
onChange: w
|
|
630
638
|
},
|
|
631
639
|
locale: { emptyText: "No open Facebook leads for this counsellor" },
|
|
632
640
|
scroll: { x: 640 }
|
|
@@ -640,13 +648,13 @@ function mt({ rows: e = [], eligibleCounsellors: t = [], onChanged: n, limits: r
|
|
|
640
648
|
className: "fb-field-label",
|
|
641
649
|
htmlFor: "fb-reassign-to",
|
|
642
650
|
children: "To"
|
|
643
|
-
}), /* @__PURE__ */ W(
|
|
651
|
+
}), /* @__PURE__ */ W(T, {
|
|
644
652
|
id: "fb-reassign-to",
|
|
645
653
|
showSearch: !0,
|
|
646
654
|
optionFilterProp: "label",
|
|
647
655
|
placeholder: "Choose an active counsellor",
|
|
648
|
-
value:
|
|
649
|
-
onChange:
|
|
656
|
+
value: se || void 0,
|
|
657
|
+
onChange: j,
|
|
650
658
|
options: Se,
|
|
651
659
|
notFoundContent: "No other active counsellor available"
|
|
652
660
|
})]
|
|
@@ -657,7 +665,7 @@ function mt({ rows: e = [], eligibleCounsellors: t = [], onChanged: n, limits: r
|
|
|
657
665
|
className: "fb-field-label",
|
|
658
666
|
htmlFor: "fb-reassign-type",
|
|
659
667
|
children: "Reason type"
|
|
660
|
-
}), /* @__PURE__ */ W(
|
|
668
|
+
}), /* @__PURE__ */ W(T, {
|
|
661
669
|
id: "fb-reassign-type",
|
|
662
670
|
value: V,
|
|
663
671
|
onChange: ce,
|
|
@@ -672,7 +680,7 @@ function mt({ rows: e = [], eligibleCounsellors: t = [], onChanged: n, limits: r
|
|
|
672
680
|
htmlFor: "fb-reassign-reason",
|
|
673
681
|
children: "Reason"
|
|
674
682
|
}),
|
|
675
|
-
/* @__PURE__ */ W(
|
|
683
|
+
/* @__PURE__ */ W(ie.TextArea, {
|
|
676
684
|
id: "fb-reassign-reason",
|
|
677
685
|
rows: 2,
|
|
678
686
|
maxLength: _e,
|
|
@@ -709,13 +717,13 @@ function mt({ rows: e = [], eligibleCounsellors: t = [], onChanged: n, limits: r
|
|
|
709
717
|
]
|
|
710
718
|
})
|
|
711
719
|
] }),
|
|
712
|
-
/* @__PURE__ */ W(
|
|
720
|
+
/* @__PURE__ */ W(te, {
|
|
713
721
|
ghost: !0,
|
|
714
722
|
className: "fb-history-collapse",
|
|
715
723
|
items: [{
|
|
716
724
|
key: "history",
|
|
717
725
|
label: "Reassignment history",
|
|
718
|
-
children: /* @__PURE__ */ W(
|
|
726
|
+
children: /* @__PURE__ */ W(k, {
|
|
719
727
|
size: "small",
|
|
720
728
|
rowKey: "id",
|
|
721
729
|
loading: he,
|
|
@@ -738,10 +746,10 @@ function mt({ rows: e = [], eligibleCounsellors: t = [], onChanged: n, limits: r
|
|
|
738
746
|
}
|
|
739
747
|
//#endregion
|
|
740
748
|
//#region src/pages/Modules/Admin/FacebookDistributionUI.jsx
|
|
741
|
-
var { Text:
|
|
749
|
+
var { Text: gt } = ce, _t = (e) => String(e?.userId || ""), vt = 50, yt = (e) => {
|
|
742
750
|
let t = e ? new Date(e) : null;
|
|
743
751
|
return t && !Number.isNaN(t.getTime()) ? t.toLocaleString() : "—";
|
|
744
|
-
},
|
|
752
|
+
}, bt = (e) => e && e.charAt(0).toUpperCase() + e.slice(1), xt = {
|
|
745
753
|
ready: {
|
|
746
754
|
label: "Ready",
|
|
747
755
|
tone: "good"
|
|
@@ -762,13 +770,17 @@ var { Text: ht } = ce, gt = (e) => String(e?.userId || ""), _t = 50, vt = (e) =>
|
|
|
762
770
|
label: "Unknown form",
|
|
763
771
|
tone: "muted"
|
|
764
772
|
}
|
|
765
|
-
},
|
|
773
|
+
}, St = {
|
|
766
774
|
inactive: "Inactive",
|
|
767
775
|
locked: "Account locked",
|
|
768
776
|
deleted: "Deleted",
|
|
769
777
|
not_counsellor: "No longer a counsellor",
|
|
770
|
-
unavailable: "Unavailable"
|
|
771
|
-
|
|
778
|
+
unavailable: "Unavailable",
|
|
779
|
+
logged_out: "Not logged in",
|
|
780
|
+
on_leave: "On leave",
|
|
781
|
+
admin_disabled: "Switched off by admin",
|
|
782
|
+
at_cap: "At the open-lead limit"
|
|
783
|
+
}, Ct = (e) => St[e] || "Unavailable", wt = {
|
|
772
784
|
meta_fetch: "Could not read the lead from Facebook",
|
|
773
785
|
lms_create: "Could not create the lead",
|
|
774
786
|
invalid_lead_fields: "The lead had unreadable details",
|
|
@@ -781,12 +793,12 @@ var { Text: ht } = ce, gt = (e) => String(e?.userId || ""), _t = 50, vt = (e) =>
|
|
|
781
793
|
meta_forms: "Could not read the forms from Facebook",
|
|
782
794
|
mismatched_page_or_form: "The lead came from a different Facebook page or form",
|
|
783
795
|
mismatched_meta_form: "The lead came from a different Facebook page or form"
|
|
784
|
-
},
|
|
796
|
+
}, Tt = (e) => wt[e] || "Failed", Et = (e) => bt(ct[e]) || "Waiting for setup", Dt = (e) => {
|
|
785
797
|
if (!e || typeof e != "object") return null;
|
|
786
798
|
let t = e.counsellorIds || e.counsellors;
|
|
787
799
|
return Array.isArray(t) ? t.map((e) => String(e?.userId ?? e?.legacyUserId ?? e)) : null;
|
|
788
800
|
};
|
|
789
|
-
function
|
|
801
|
+
function Ot(e) {
|
|
790
802
|
let { area: t, action: n, before: r, after: i } = e || {}, a = String(t || "").toLowerCase(), o = String(n || "").toLowerCase(), s = /delete|remove/.test(o), c = /create|add/.test(o) || !r;
|
|
791
803
|
if (/retry/.test(o) || /failed/.test(a)) return "Retried failed lead";
|
|
792
804
|
if (/mapping|course/.test(a)) {
|
|
@@ -798,32 +810,32 @@ function Dt(e) {
|
|
|
798
810
|
if (s) return "Counsellors removed";
|
|
799
811
|
if (c) return "Counsellors set up";
|
|
800
812
|
if (typeof r?.isActive == "boolean" && typeof i?.isActive == "boolean" && r.isActive !== i.isActive) return i.isActive ? "Resumed" : "Paused";
|
|
801
|
-
let e =
|
|
813
|
+
let e = Dt(r), t = Dt(i);
|
|
802
814
|
return e && t && e.length === t.length && [...e].sort().join() === [...t].sort().join() ? "Order changed" : "Counsellors changed";
|
|
803
815
|
}
|
|
804
816
|
return "Setup changed";
|
|
805
817
|
}
|
|
806
|
-
function
|
|
818
|
+
function kt({ mapping: e, distribution: t, inFormsList: n = !0 }, r = {}) {
|
|
807
819
|
let { forms: i = !0, mappings: a = !0, distributions: o = !0 } = r;
|
|
808
820
|
if (!a || !o) return null;
|
|
809
821
|
if (i && !n) return "unknown_form";
|
|
810
822
|
let s = t?.counsellors || [];
|
|
811
823
|
return !e || !e.isActive || !t || !s.length ? "needs_setup" : t.isActive === !1 ? "paused" : s.some((e) => e.isActive !== !1) ? "ready" : "no_active";
|
|
812
824
|
}
|
|
813
|
-
function
|
|
825
|
+
function At(e) {
|
|
814
826
|
let t = e?.counsellors || [];
|
|
815
827
|
if (!t.length) return "";
|
|
816
|
-
let n = Math.max(t.findIndex((t) =>
|
|
828
|
+
let n = Math.max(t.findIndex((t) => _t(t) === String(e.nextUserId || "")), 0);
|
|
817
829
|
return [...t.slice(n), ...t.slice(0, n)].find((e) => e.isActive !== !1)?.name || "";
|
|
818
830
|
}
|
|
819
|
-
function
|
|
831
|
+
function jt(e, t, n) {
|
|
820
832
|
if (t === n || t < 0 || n < 0 || t >= e.length || n >= e.length) return e;
|
|
821
833
|
let r = [...e], [i] = r.splice(t, 1);
|
|
822
834
|
return r.splice(n, 0, i), r;
|
|
823
835
|
}
|
|
824
|
-
function
|
|
836
|
+
function Mt(e, t) {
|
|
825
837
|
if (!t.length) return "";
|
|
826
|
-
let n = (e?.counsellors || []).map(
|
|
838
|
+
let n = (e?.counsellors || []).map(_t).filter(Boolean), r = String(e?.nextUserId || "");
|
|
827
839
|
if (n.length === t.length && n.every((e, n) => e === t[n]) && t.includes(r)) return r;
|
|
828
840
|
let i = String(e?.lastAssignedUserId || "");
|
|
829
841
|
if (!i && n.includes(r) && (i = n[(n.indexOf(r) - 1 + n.length) % n.length]), t.includes(i)) return t[(t.indexOf(i) + 1) % t.length];
|
|
@@ -836,7 +848,7 @@ function jt(e, t) {
|
|
|
836
848
|
}
|
|
837
849
|
return t.includes(r) ? r : t[0];
|
|
838
850
|
}
|
|
839
|
-
async function
|
|
851
|
+
async function Nt({ mapping: e, distribution: t, saveMapping: n, saveDistribution: r }) {
|
|
840
852
|
let i = {
|
|
841
853
|
mappingSaved: !1,
|
|
842
854
|
distributionSaved: !1,
|
|
@@ -863,24 +875,24 @@ async function Mt({ mapping: e, distribution: t, saveMapping: n, saveDistributio
|
|
|
863
875
|
}
|
|
864
876
|
return i;
|
|
865
877
|
}
|
|
866
|
-
var
|
|
867
|
-
function
|
|
868
|
-
return e.length ? e.length === 1 ? `${e[0]} is inactive and will be skipped. Remove them or keep the place for when they return.` : `${
|
|
878
|
+
var Pt = (e) => e.length < 2 ? e[0] || "" : `${e.slice(0, -1).join(", ")} and ${e[e.length - 1]}`;
|
|
879
|
+
function Ft(e) {
|
|
880
|
+
return e.length ? e.length === 1 ? `${e[0]} is inactive and will be skipped. Remove them or keep the place for when they return.` : `${Pt(e)} are inactive and will be skipped. Remove them or keep their places for when they return.` : "";
|
|
869
881
|
}
|
|
870
|
-
function
|
|
871
|
-
let t =
|
|
872
|
-
return t ? /* @__PURE__ */ G(
|
|
882
|
+
function It({ status: e }) {
|
|
883
|
+
let t = xt[e];
|
|
884
|
+
return t ? /* @__PURE__ */ G(A, {
|
|
873
885
|
className: `fb-status fb-status--${t.tone}`,
|
|
874
886
|
children: [/* @__PURE__ */ W("span", {
|
|
875
887
|
className: "fb-status-dot",
|
|
876
888
|
"aria-hidden": "true"
|
|
877
889
|
}), t.label]
|
|
878
|
-
}) : /* @__PURE__ */ W(
|
|
890
|
+
}) : /* @__PURE__ */ W(gt, {
|
|
879
891
|
type: "secondary",
|
|
880
892
|
children: "—"
|
|
881
893
|
});
|
|
882
894
|
}
|
|
883
|
-
function
|
|
895
|
+
function Lt({ number: e, title: t, aside: n }) {
|
|
884
896
|
return /* @__PURE__ */ G("div", {
|
|
885
897
|
className: "fb-setup-heading",
|
|
886
898
|
children: [/* @__PURE__ */ G("h3", { children: [/* @__PURE__ */ W("span", {
|
|
@@ -893,30 +905,30 @@ function It({ number: e, title: t, aside: n }) {
|
|
|
893
905
|
})]
|
|
894
906
|
});
|
|
895
907
|
}
|
|
896
|
-
var
|
|
908
|
+
var Rt = (e, t) => ({
|
|
897
909
|
base: {
|
|
898
910
|
mapping: e || null,
|
|
899
911
|
current: t || null
|
|
900
912
|
},
|
|
901
913
|
courseId: e?.courseId || void 0,
|
|
902
914
|
mappingActive: e?.isActive ?? !0,
|
|
903
|
-
orderedIds: (t?.counsellors || []).map(
|
|
915
|
+
orderedIds: (t?.counsellors || []).map(_t).filter(Boolean),
|
|
904
916
|
enabled: t?.isActive !== !1
|
|
905
917
|
});
|
|
906
|
-
function
|
|
907
|
-
let [
|
|
908
|
-
let e = new Map(a.map((e) => [
|
|
918
|
+
function zt({ open: e, row: t, mapping: n, current: r, courses: i = [], counsellors: a = [], limits: o, permissions: c = {}, section: m = "course", onClose: g, onSaved: te, onReload: ne, onAfterClose: re }) {
|
|
919
|
+
let [y] = f(() => Rt(n, r)), [b, x] = f(y.base), [S, C] = f(y.courseId), [w, oe] = f(y.mappingActive), [E, D] = f(y.orderedIds), [k, se] = f(y.enabled), [j, ce] = f(""), [P, F] = f(!1), [fe, me] = f(""), [I, L] = f(""), [he, ge] = f(null), [R, ve] = f(null), z = d(null), ye = d(null), B = d(null), V = d(!1), { canAdd: H = !0, canEdit: U = !0 } = c, K = b.mapping ? U : H, q = b.current ? U : H, be = !K && !q, J = Number(o?.maxCounsellors) || vt, xe = b.current?.counsellors, Se = b.mapping, Y = u(() => {
|
|
920
|
+
let e = new Map(a.map((e) => [_t(e), {
|
|
909
921
|
...e,
|
|
910
922
|
isActive: !0
|
|
911
923
|
}]));
|
|
912
924
|
return (xe || []).forEach((t) => {
|
|
913
|
-
let n =
|
|
925
|
+
let n = _t(t);
|
|
914
926
|
e.has(n) || e.set(n, {
|
|
915
927
|
...t,
|
|
916
928
|
isActive: !1
|
|
917
929
|
});
|
|
918
930
|
}), e;
|
|
919
|
-
}, [a, xe]), X = s((e) => Y.get(e)?.name || "Unnamed counsellor", [Y]), Ce = u(() => new Set(
|
|
931
|
+
}, [a, xe]), X = s((e) => Y.get(e)?.name || "Unnamed counsellor", [Y]), Ce = u(() => new Set(E), [E]), we = E.map((e) => Y.get(e)).filter(Boolean), Ee = [...a].filter((e) => !Ce.has(_t(e))).sort((e, t) => String(e.name).localeCompare(String(t.name))), De = [...we, ...Ee].filter((e) => `${e.name || ""} ${e.email || ""}`.toLowerCase().includes(j.trim().toLowerCase())), Z = we.filter((e) => !e.isActive), Oe = we.length - Z.length, ke = (b.current?.counsellors || []).map(_t).filter(Boolean), Ae = ke.length !== E.length || ke.some((e, t) => e !== E[t]), je = b.current ? Ae || k !== (b.current.isActive !== !1) : E.length > 0, $ = b.mapping ? String(S) !== String(b.mapping.courseId) || w !== b.mapping.isActive : !!S, Me = $ || je, Ne = Mt(b.current, E), Fe = E.indexOf(Ne), Ie = (Fe < 0 ? E : [...E.slice(Fe), ...E.slice(0, Fe)]).find((e) => Y.get(e)?.isActive) || "", Le = Y.get(Ie)?.name || "No one yet", Re = u(() => {
|
|
920
932
|
let e = i.map((e) => ({
|
|
921
933
|
value: e.courseId,
|
|
922
934
|
label: e.courseName
|
|
@@ -926,16 +938,16 @@ function Rt({ open: e, row: t, mapping: n, current: r, courses: i = [], counsell
|
|
|
926
938
|
label: Se.courseName || "Course no longer available"
|
|
927
939
|
}), e;
|
|
928
940
|
}, [i, Se]), ze = (e, t) => {
|
|
929
|
-
let n =
|
|
930
|
-
|
|
941
|
+
let n = Rt(e, t);
|
|
942
|
+
x(n.base), C(n.courseId), oe(n.mappingActive), D(n.orderedIds), se(n.enabled);
|
|
931
943
|
}, Be = (e, t) => {
|
|
932
|
-
|
|
944
|
+
D((n) => t ? [...n.filter((t) => t !== e), e] : n.filter((t) => t !== e)), L(t ? `${X(e)} added to the list` : `${X(e)} removed from the list`);
|
|
933
945
|
}, Ve = (e, t) => {
|
|
934
|
-
let n =
|
|
935
|
-
n < 0 || r < 0 || r >=
|
|
946
|
+
let n = E.indexOf(e), r = n + (t === "up" ? -1 : 1);
|
|
947
|
+
n < 0 || r < 0 || r >= E.length || (B.current = {
|
|
936
948
|
id: e,
|
|
937
949
|
direction: t
|
|
938
|
-
},
|
|
950
|
+
}, D((e) => jt(e, n, r)), L(`${X(e)} moved to place ${r + 1} of ${E.length}`));
|
|
939
951
|
};
|
|
940
952
|
l(() => {
|
|
941
953
|
let e = B.current;
|
|
@@ -943,7 +955,7 @@ function Rt({ open: e, row: t, mapping: n, current: r, courses: i = [], counsell
|
|
|
943
955
|
B.current = null;
|
|
944
956
|
let t = [...z.current?.querySelectorAll("[data-move-id]") || []].filter((t) => t.dataset.moveId === e.id && !t.disabled);
|
|
945
957
|
(t.find((t) => t.dataset.moveDirection === e.direction) || t[0])?.focus();
|
|
946
|
-
}, [
|
|
958
|
+
}, [E]);
|
|
947
959
|
let He = (e, t) => {
|
|
948
960
|
ve(t), e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", t);
|
|
949
961
|
}, Ue = (e, t, n) => {
|
|
@@ -952,14 +964,14 @@ function Rt({ open: e, row: t, mapping: n, current: r, courses: i = [], counsell
|
|
|
952
964
|
ve(null), ge(null);
|
|
953
965
|
}, Ge = (e) => {
|
|
954
966
|
let t = R;
|
|
955
|
-
We(), !(!Ce.has(t) || !Ce.has(e) || t === e) && (
|
|
967
|
+
We(), !(!Ce.has(t) || !Ce.has(e) || t === e) && (D((n) => jt(n, n.indexOf(t), n.indexOf(e))), L(`${X(t)} moved`));
|
|
956
968
|
}, Ke = () => {
|
|
957
969
|
if (!P) {
|
|
958
970
|
if (!Me) {
|
|
959
971
|
g();
|
|
960
972
|
return;
|
|
961
973
|
}
|
|
962
|
-
V.current || (V.current = !0,
|
|
974
|
+
V.current || (V.current = !0, ae.confirm({
|
|
963
975
|
title: "Discard your changes?",
|
|
964
976
|
content: "Your changes to this form have not been saved.",
|
|
965
977
|
okText: "Discard changes",
|
|
@@ -992,65 +1004,65 @@ function Rt({ open: e, row: t, mapping: n, current: r, courses: i = [], counsell
|
|
|
992
1004
|
loading: P,
|
|
993
1005
|
disabled: !Me,
|
|
994
1006
|
onClick: async () => {
|
|
995
|
-
if (me(""), je && !
|
|
1007
|
+
if (me(""), je && !E.length) {
|
|
996
1008
|
me("Choose at least one counsellor. To stop using counsellors on this form, use Remove distribution in the form menu.");
|
|
997
1009
|
return;
|
|
998
1010
|
}
|
|
999
|
-
if (je &&
|
|
1000
|
-
me(`You can choose up to ${J} counsellors. You have chosen ${
|
|
1011
|
+
if (je && E.length > J) {
|
|
1012
|
+
me(`You can choose up to ${J} counsellors. You have chosen ${E.length}.`);
|
|
1001
1013
|
return;
|
|
1002
1014
|
}
|
|
1003
1015
|
F(!0);
|
|
1004
|
-
let e = await
|
|
1016
|
+
let e = await Nt({
|
|
1005
1017
|
mapping: $ ? {
|
|
1006
1018
|
input: {
|
|
1007
1019
|
formId: t.formId,
|
|
1008
|
-
courseId:
|
|
1009
|
-
isActive:
|
|
1020
|
+
courseId: S,
|
|
1021
|
+
isActive: w
|
|
1010
1022
|
},
|
|
1011
|
-
isEdit: !!
|
|
1023
|
+
isEdit: !!b.mapping
|
|
1012
1024
|
} : null,
|
|
1013
1025
|
distribution: je ? {
|
|
1014
1026
|
input: {
|
|
1015
1027
|
formId: t.formId,
|
|
1016
|
-
counsellorIds:
|
|
1017
|
-
isActive:
|
|
1018
|
-
version:
|
|
1028
|
+
counsellorIds: E,
|
|
1029
|
+
isActive: k,
|
|
1030
|
+
version: b.current?.version ?? 0
|
|
1019
1031
|
},
|
|
1020
|
-
isEdit: !!
|
|
1032
|
+
isEdit: !!b.current
|
|
1021
1033
|
} : null,
|
|
1022
1034
|
saveMapping: Te,
|
|
1023
1035
|
saveDistribution: Pe
|
|
1024
1036
|
});
|
|
1025
1037
|
if (!e.error) {
|
|
1026
|
-
F(!1), N.success("Form setup saved"),
|
|
1038
|
+
F(!1), N.success("Form setup saved"), te?.(), g();
|
|
1027
1039
|
return;
|
|
1028
1040
|
}
|
|
1029
1041
|
let n = e.mappingSaved ? "The course was saved. " : "";
|
|
1030
1042
|
if (e.failedPart === "mapping") me(`Nothing was saved. The course could not be saved: ${Q(e.error)}`);
|
|
1031
1043
|
else if (e.error?.status === 409) try {
|
|
1032
|
-
let e = await
|
|
1044
|
+
let e = await ne();
|
|
1033
1045
|
ze(e?.mapping, e?.current), me(`${n}Someone else changed these counsellors while you were editing, so yours were not saved. The latest list is now showing. Check it and save again.`);
|
|
1034
1046
|
} catch {
|
|
1035
1047
|
me(`${n}Someone else changed these counsellors while you were editing, so yours were not saved. The latest list could not be loaded. Close this panel and open it again.`);
|
|
1036
1048
|
}
|
|
1037
|
-
else e.mappingSaved &&
|
|
1049
|
+
else e.mappingSaved && x((e) => ({
|
|
1038
1050
|
...e,
|
|
1039
1051
|
mapping: {
|
|
1040
1052
|
...e.mapping || {},
|
|
1041
1053
|
formId: t.formId,
|
|
1042
|
-
courseId:
|
|
1043
|
-
isActive:
|
|
1044
|
-
courseName: Re.find((e) => e.value ===
|
|
1054
|
+
courseId: S,
|
|
1055
|
+
isActive: w,
|
|
1056
|
+
courseName: Re.find((e) => e.value === S)?.label || e.mapping?.courseName || ""
|
|
1045
1057
|
}
|
|
1046
1058
|
})), me(`${n}The counsellors were not saved: ${Q(e.error)}`);
|
|
1047
|
-
e.mappingSaved &&
|
|
1059
|
+
e.mappingSaved && te?.(), F(!1);
|
|
1048
1060
|
},
|
|
1049
1061
|
children: "Save"
|
|
1050
1062
|
})]
|
|
1051
1063
|
})]
|
|
1052
|
-
}), Je = !!(
|
|
1053
|
-
return /* @__PURE__ */ G(
|
|
1064
|
+
}), Je = !!(b.mapping || b.current);
|
|
1065
|
+
return /* @__PURE__ */ G(_, {
|
|
1054
1066
|
open: e,
|
|
1055
1067
|
size: 560,
|
|
1056
1068
|
rootClassName: "fb-setup-drawer",
|
|
@@ -1063,15 +1075,15 @@ function Rt({ open: e, row: t, mapping: n, current: r, courses: i = [], counsell
|
|
|
1063
1075
|
onClose: Ke,
|
|
1064
1076
|
footer: qe,
|
|
1065
1077
|
afterOpenChange: (e) => {
|
|
1066
|
-
e && m === "counsellors" && ye.current?.scrollIntoView?.({ block: "start" }), e ||
|
|
1078
|
+
e && m === "counsellors" && ye.current?.scrollIntoView?.({ block: "start" }), e || re?.();
|
|
1067
1079
|
},
|
|
1068
1080
|
children: [
|
|
1069
1081
|
/* @__PURE__ */ G("div", {
|
|
1070
1082
|
className: "fb-setup-form-name",
|
|
1071
|
-
children: [/* @__PURE__ */ W(
|
|
1083
|
+
children: [/* @__PURE__ */ W(gt, {
|
|
1072
1084
|
strong: !0,
|
|
1073
1085
|
children: t?.formName
|
|
1074
|
-
}), /* @__PURE__ */ G(
|
|
1086
|
+
}), /* @__PURE__ */ G(gt, {
|
|
1075
1087
|
type: "secondary",
|
|
1076
1088
|
className: "fb-small",
|
|
1077
1089
|
copyable: {
|
|
@@ -1091,23 +1103,23 @@ function Rt({ open: e, row: t, mapping: n, current: r, courses: i = [], counsell
|
|
|
1091
1103
|
className: "fb-setup-section",
|
|
1092
1104
|
"aria-label": "Course",
|
|
1093
1105
|
children: [
|
|
1094
|
-
/* @__PURE__ */ W(
|
|
1106
|
+
/* @__PURE__ */ W(Lt, {
|
|
1095
1107
|
number: "1",
|
|
1096
1108
|
title: "Course"
|
|
1097
1109
|
}),
|
|
1098
|
-
/* @__PURE__ */ W(
|
|
1110
|
+
/* @__PURE__ */ W(T, {
|
|
1099
1111
|
className: "fb-setup-select",
|
|
1100
1112
|
showSearch: !0,
|
|
1101
1113
|
optionFilterProp: "label",
|
|
1102
1114
|
"aria-label": "Course",
|
|
1103
1115
|
placeholder: "Choose a course",
|
|
1104
|
-
value:
|
|
1105
|
-
onChange:
|
|
1116
|
+
value: S,
|
|
1117
|
+
onChange: C,
|
|
1106
1118
|
options: Re,
|
|
1107
1119
|
disabled: !K || P,
|
|
1108
1120
|
notFoundContent: "No matching courses"
|
|
1109
1121
|
}),
|
|
1110
|
-
|
|
1122
|
+
S ? /* @__PURE__ */ G("label", {
|
|
1111
1123
|
className: "fb-setup-toggle",
|
|
1112
1124
|
children: [/* @__PURE__ */ G("span", { children: [/* @__PURE__ */ W("span", {
|
|
1113
1125
|
className: "fb-setup-toggle-title",
|
|
@@ -1115,10 +1127,10 @@ function Rt({ open: e, row: t, mapping: n, current: r, courses: i = [], counsell
|
|
|
1115
1127
|
}), /* @__PURE__ */ W("span", {
|
|
1116
1128
|
className: "fb-hint",
|
|
1117
1129
|
children: "When off, new leads still come in, but without a course."
|
|
1118
|
-
})] }), /* @__PURE__ */ W(
|
|
1130
|
+
})] }), /* @__PURE__ */ W(O, {
|
|
1119
1131
|
"aria-label": "Use this course for new leads",
|
|
1120
|
-
checked:
|
|
1121
|
-
onChange:
|
|
1132
|
+
checked: w,
|
|
1133
|
+
onChange: oe,
|
|
1122
1134
|
disabled: !K || P
|
|
1123
1135
|
})]
|
|
1124
1136
|
}) : /* @__PURE__ */ W("div", {
|
|
@@ -1132,7 +1144,7 @@ function Rt({ open: e, row: t, mapping: n, current: r, courses: i = [], counsell
|
|
|
1132
1144
|
"aria-label": "Counsellors and order",
|
|
1133
1145
|
ref: ye,
|
|
1134
1146
|
children: [
|
|
1135
|
-
/* @__PURE__ */ W(
|
|
1147
|
+
/* @__PURE__ */ W(Lt, {
|
|
1136
1148
|
number: "2",
|
|
1137
1149
|
title: "Counsellors and order",
|
|
1138
1150
|
aside: `${Oe} active${Z.length ? `, ${Z.length} inactive` : ""}`
|
|
@@ -1141,20 +1153,20 @@ function Rt({ open: e, row: t, mapping: n, current: r, courses: i = [], counsell
|
|
|
1141
1153
|
type: "warning",
|
|
1142
1154
|
showIcon: !0,
|
|
1143
1155
|
className: "fb-block",
|
|
1144
|
-
title:
|
|
1156
|
+
title: Ft(Z.map((e) => e.name || "Unnamed counsellor")),
|
|
1145
1157
|
description: q && /* @__PURE__ */ W("div", {
|
|
1146
1158
|
className: "fb-inactive-actions",
|
|
1147
1159
|
children: Z.map((e) => /* @__PURE__ */ G(h, {
|
|
1148
1160
|
size: "small",
|
|
1149
1161
|
disabled: P,
|
|
1150
|
-
onClick: () => Be(
|
|
1162
|
+
onClick: () => Be(_t(e), !1),
|
|
1151
1163
|
children: ["Remove ", e.name || "Unnamed counsellor"]
|
|
1152
|
-
},
|
|
1164
|
+
}, _t(e)))
|
|
1153
1165
|
})
|
|
1154
1166
|
}),
|
|
1155
|
-
/* @__PURE__ */ W(
|
|
1167
|
+
/* @__PURE__ */ W(ie, {
|
|
1156
1168
|
allowClear: !0,
|
|
1157
|
-
value:
|
|
1169
|
+
value: j,
|
|
1158
1170
|
prefix: /* @__PURE__ */ W(_e, { "aria-hidden": "true" }),
|
|
1159
1171
|
className: "fb-block",
|
|
1160
1172
|
placeholder: "Search counsellors",
|
|
@@ -1164,8 +1176,8 @@ function Rt({ open: e, row: t, mapping: n, current: r, courses: i = [], counsell
|
|
|
1164
1176
|
/* @__PURE__ */ W("div", {
|
|
1165
1177
|
className: "fb-dist-draggable-list",
|
|
1166
1178
|
ref: z,
|
|
1167
|
-
children: De.length === 0 ? /* @__PURE__ */ W(
|
|
1168
|
-
let t =
|
|
1179
|
+
children: De.length === 0 ? /* @__PURE__ */ W(v, { description: a.length || E.length ? "No matching counsellors" : "No active counsellors to choose from" }) : De.map((e) => {
|
|
1180
|
+
let t = _t(e), n = e.name || "Unnamed counsellor", r = Ce.has(t), i = E.indexOf(t);
|
|
1169
1181
|
return /* @__PURE__ */ G("div", {
|
|
1170
1182
|
"data-person-row": t,
|
|
1171
1183
|
className: `fb-dist-unified-row ${r ? "selected" : ""} ${he === t ? "drag-over" : ""}`,
|
|
@@ -1198,17 +1210,17 @@ function Rt({ open: e, row: t, mapping: n, current: r, courses: i = [], counsell
|
|
|
1198
1210
|
}),
|
|
1199
1211
|
/* @__PURE__ */ G("div", {
|
|
1200
1212
|
className: "fb-dist-person-name",
|
|
1201
|
-
children: [/* @__PURE__ */ W(
|
|
1213
|
+
children: [/* @__PURE__ */ W(gt, {
|
|
1202
1214
|
strong: r,
|
|
1203
1215
|
children: n
|
|
1204
|
-
}), e.email && /* @__PURE__ */ W(
|
|
1216
|
+
}), e.email && /* @__PURE__ */ W(gt, {
|
|
1205
1217
|
type: "secondary",
|
|
1206
1218
|
className: "fb-small",
|
|
1207
1219
|
ellipsis: !0,
|
|
1208
1220
|
children: e.email
|
|
1209
1221
|
})]
|
|
1210
1222
|
}),
|
|
1211
|
-
!e.isActive && /* @__PURE__ */ G(
|
|
1223
|
+
!e.isActive && /* @__PURE__ */ G(A, {
|
|
1212
1224
|
className: "fb-status fb-status--bad",
|
|
1213
1225
|
children: [/* @__PURE__ */ W("span", {
|
|
1214
1226
|
className: "fb-status-dot",
|
|
@@ -1217,7 +1229,7 @@ function Rt({ open: e, row: t, mapping: n, current: r, courses: i = [], counsell
|
|
|
1217
1229
|
}),
|
|
1218
1230
|
r && /* @__PURE__ */ G("span", {
|
|
1219
1231
|
className: "fb-dist-order-buttons",
|
|
1220
|
-
children: [/* @__PURE__ */ W(
|
|
1232
|
+
children: [/* @__PURE__ */ W(M, {
|
|
1221
1233
|
title: `Move ${n} up`,
|
|
1222
1234
|
children: /* @__PURE__ */ W(h, {
|
|
1223
1235
|
type: "text",
|
|
@@ -1228,7 +1240,7 @@ function Rt({ open: e, row: t, mapping: n, current: r, courses: i = [], counsell
|
|
|
1228
1240
|
disabled: i <= 0 || P || !q,
|
|
1229
1241
|
onClick: () => Ve(t, "up")
|
|
1230
1242
|
})
|
|
1231
|
-
}), /* @__PURE__ */ W(
|
|
1243
|
+
}), /* @__PURE__ */ W(M, {
|
|
1232
1244
|
title: `Move ${n} down`,
|
|
1233
1245
|
children: /* @__PURE__ */ W(h, {
|
|
1234
1246
|
type: "text",
|
|
@@ -1236,7 +1248,7 @@ function Rt({ open: e, row: t, mapping: n, current: r, courses: i = [], counsell
|
|
|
1236
1248
|
"aria-label": `Move ${n} down`,
|
|
1237
1249
|
"data-move-id": t,
|
|
1238
1250
|
"data-move-direction": "down",
|
|
1239
|
-
disabled: i >=
|
|
1251
|
+
disabled: i >= E.length - 1 || P || !q,
|
|
1240
1252
|
onClick: () => Ve(t, "down")
|
|
1241
1253
|
})
|
|
1242
1254
|
})]
|
|
@@ -1267,7 +1279,7 @@ function Rt({ open: e, row: t, mapping: n, current: r, courses: i = [], counsell
|
|
|
1267
1279
|
/* @__PURE__ */ G("section", {
|
|
1268
1280
|
className: "fb-setup-section",
|
|
1269
1281
|
"aria-label": "Automatic turns",
|
|
1270
|
-
children: [/* @__PURE__ */ W(
|
|
1282
|
+
children: [/* @__PURE__ */ W(Lt, {
|
|
1271
1283
|
number: "3",
|
|
1272
1284
|
title: "Automatic turns"
|
|
1273
1285
|
}), /* @__PURE__ */ G("label", {
|
|
@@ -1278,10 +1290,10 @@ function Rt({ open: e, row: t, mapping: n, current: r, courses: i = [], counsell
|
|
|
1278
1290
|
}), /* @__PURE__ */ W("span", {
|
|
1279
1291
|
className: "fb-hint",
|
|
1280
1292
|
children: "When paused, new leads wait until you turn this back on."
|
|
1281
|
-
})] }), /* @__PURE__ */ W(
|
|
1293
|
+
})] }), /* @__PURE__ */ W(O, {
|
|
1282
1294
|
"aria-label": "Send leads to this form automatically",
|
|
1283
|
-
checked:
|
|
1284
|
-
onChange:
|
|
1295
|
+
checked: k,
|
|
1296
|
+
onChange: se,
|
|
1285
1297
|
checkedChildren: "On",
|
|
1286
1298
|
unCheckedChildren: "Paused",
|
|
1287
1299
|
disabled: !q || P
|
|
@@ -1291,7 +1303,7 @@ function Rt({ open: e, row: t, mapping: n, current: r, courses: i = [], counsell
|
|
|
1291
1303
|
]
|
|
1292
1304
|
});
|
|
1293
1305
|
}
|
|
1294
|
-
function
|
|
1306
|
+
function Bt(e, t) {
|
|
1295
1307
|
let [n, r] = f(0), [i, a] = f({
|
|
1296
1308
|
data: null,
|
|
1297
1309
|
error: "",
|
|
@@ -1331,7 +1343,7 @@ function zt(e, t) {
|
|
|
1331
1343
|
reload: l
|
|
1332
1344
|
};
|
|
1333
1345
|
}
|
|
1334
|
-
function
|
|
1346
|
+
function Vt({ title: e, resource: t }) {
|
|
1335
1347
|
return t.error ? /* @__PURE__ */ W(p, {
|
|
1336
1348
|
type: "error",
|
|
1337
1349
|
showIcon: !0,
|
|
@@ -1345,59 +1357,112 @@ function Bt({ title: e, resource: t }) {
|
|
|
1345
1357
|
})
|
|
1346
1358
|
}) : null;
|
|
1347
1359
|
}
|
|
1348
|
-
var
|
|
1349
|
-
function
|
|
1350
|
-
let
|
|
1351
|
-
|
|
1352
|
-
|
|
1360
|
+
var Ht = (e, t) => t.formName || e.find((e) => e.formId === String(t.formId))?.formName || "Unknown form", Ut = (e, t) => e.find((e) => e.formId === String(t))?.mapping?.courseName || "";
|
|
1361
|
+
function Wt({ lead: e, details: t }) {
|
|
1362
|
+
let n = t?.[e.facebookLeadId];
|
|
1363
|
+
return /* @__PURE__ */ G("span", {
|
|
1364
|
+
className: "fb-lead-cell",
|
|
1365
|
+
children: [/* @__PURE__ */ W("span", {
|
|
1366
|
+
className: "fb-lead-cell__name",
|
|
1367
|
+
children: n?.name || (n?.error ? "Details unavailable" : "—")
|
|
1368
|
+
}), /* @__PURE__ */ G("span", {
|
|
1369
|
+
className: "fb-lead-cell__id",
|
|
1370
|
+
children: ["Lead ", e.facebookLeadId]
|
|
1371
|
+
})]
|
|
1372
|
+
});
|
|
1373
|
+
}
|
|
1374
|
+
var Gt = (e) => [
|
|
1375
|
+
{
|
|
1376
|
+
title: "Phone",
|
|
1377
|
+
key: "phone",
|
|
1378
|
+
render: (t, n) => e?.[n.facebookLeadId]?.phone || "—"
|
|
1379
|
+
},
|
|
1380
|
+
{
|
|
1381
|
+
title: "Email",
|
|
1382
|
+
key: "email",
|
|
1383
|
+
render: (t, n) => e?.[n.facebookLeadId]?.email || "—"
|
|
1384
|
+
},
|
|
1385
|
+
{
|
|
1386
|
+
title: "City",
|
|
1387
|
+
key: "city",
|
|
1388
|
+
render: (t, n) => e?.[n.facebookLeadId]?.city || "—"
|
|
1389
|
+
}
|
|
1390
|
+
];
|
|
1391
|
+
function Kt({ rows: e, resource: t, unit: n, describe: r, renderBody: i, emptyText: a, fallback: o }) {
|
|
1392
|
+
let s = t.data?.groups;
|
|
1393
|
+
return Array.isArray(s) ? s.length ? /* @__PURE__ */ W(te, {
|
|
1394
|
+
accordion: !0,
|
|
1395
|
+
className: "fb-groups",
|
|
1396
|
+
expandIconPlacement: "end",
|
|
1397
|
+
items: s.map((t) => {
|
|
1398
|
+
let a = t.formName || Ht(e, t), o = Ut(e, t.formId);
|
|
1399
|
+
return {
|
|
1400
|
+
key: String(t.formId),
|
|
1401
|
+
label: /* @__PURE__ */ G("span", {
|
|
1402
|
+
className: "fb-group__head",
|
|
1403
|
+
children: [/* @__PURE__ */ W("span", {
|
|
1404
|
+
className: "fb-group__title",
|
|
1405
|
+
children: a
|
|
1406
|
+
}), /* @__PURE__ */ W("span", {
|
|
1407
|
+
className: "fb-group__course",
|
|
1408
|
+
children: o ? `Course: ${o}` : "No course mapped"
|
|
1409
|
+
})]
|
|
1410
|
+
}),
|
|
1411
|
+
extra: /* @__PURE__ */ G("span", {
|
|
1412
|
+
className: "fb-group__meta",
|
|
1413
|
+
children: [r(t), /* @__PURE__ */ G(A, {
|
|
1414
|
+
className: "fb-group__count",
|
|
1415
|
+
"aria-label": `${t.count} ${n}`,
|
|
1416
|
+
children: [
|
|
1417
|
+
t.count,
|
|
1418
|
+
" ",
|
|
1419
|
+
n
|
|
1420
|
+
]
|
|
1421
|
+
})]
|
|
1422
|
+
}),
|
|
1423
|
+
children: i(t)
|
|
1424
|
+
};
|
|
1425
|
+
})
|
|
1426
|
+
}) : /* @__PURE__ */ W(v, {
|
|
1427
|
+
image: v.PRESENTED_IMAGE_SIMPLE,
|
|
1428
|
+
description: t.loading ? " " : a
|
|
1429
|
+
}) : t.loading && !t.data ? /* @__PURE__ */ W(k, {
|
|
1430
|
+
size: "small",
|
|
1431
|
+
loading: !0,
|
|
1432
|
+
dataSource: [],
|
|
1433
|
+
columns: []
|
|
1434
|
+
}) : o;
|
|
1435
|
+
}
|
|
1436
|
+
function qt({ rows: e, formId: t, status: n, refreshKey: r, showForm: i }) {
|
|
1437
|
+
let [a, o] = f(1), c = Bt(s(() => Le({
|
|
1438
|
+
status: n,
|
|
1439
|
+
page: a,
|
|
1353
1440
|
limit: 20,
|
|
1354
|
-
formId:
|
|
1441
|
+
formId: t,
|
|
1442
|
+
details: !0
|
|
1355
1443
|
}), [
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
]),
|
|
1360
|
-
|
|
1361
|
-
limit: 20,
|
|
1362
|
-
formId: i
|
|
1363
|
-
}), [d, i]), g = zt(m, n), _ = zt(ee, n), v = _.reload, y = (e) => {
|
|
1364
|
-
a(e), u(1), p(1);
|
|
1365
|
-
}, te = (t) => {
|
|
1366
|
-
re.confirm({
|
|
1367
|
-
title: "Try this lead again?",
|
|
1368
|
-
content: /* @__PURE__ */ G("span", { children: [
|
|
1369
|
-
"We will try to bring in lead ",
|
|
1370
|
-
/* @__PURE__ */ W("strong", { children: t.facebookLeadId }),
|
|
1371
|
-
" from ",
|
|
1372
|
-
/* @__PURE__ */ W("strong", { children: Vt(e, t) }),
|
|
1373
|
-
" again."
|
|
1374
|
-
] }),
|
|
1375
|
-
okText: "Retry",
|
|
1376
|
-
cancelText: "Cancel",
|
|
1377
|
-
autoFocusButton: "cancel",
|
|
1378
|
-
onOk: async () => {
|
|
1379
|
-
try {
|
|
1380
|
-
await Ge(t.facebookLeadId), N.success("This lead will be tried again");
|
|
1381
|
-
} catch (e) {
|
|
1382
|
-
N.error(e?.status === 409 ? "This lead is no longer failed. The list has been updated." : Q(e));
|
|
1383
|
-
}
|
|
1384
|
-
v(), r?.();
|
|
1385
|
-
}
|
|
1386
|
-
});
|
|
1387
|
-
}, b = [
|
|
1388
|
-
{
|
|
1444
|
+
n,
|
|
1445
|
+
a,
|
|
1446
|
+
t
|
|
1447
|
+
]), r), l = c.data?.details, u = [
|
|
1448
|
+
...i ? [{
|
|
1389
1449
|
title: "Form",
|
|
1390
1450
|
dataIndex: "formName",
|
|
1391
|
-
render: (t, n) =>
|
|
1392
|
-
},
|
|
1451
|
+
render: (t, n) => Ht(e, n)
|
|
1452
|
+
}] : [],
|
|
1393
1453
|
{
|
|
1394
|
-
title: "Lead
|
|
1395
|
-
dataIndex: "facebookLeadId"
|
|
1454
|
+
title: "Lead",
|
|
1455
|
+
dataIndex: "facebookLeadId",
|
|
1456
|
+
render: (e, t) => /* @__PURE__ */ W(Wt, {
|
|
1457
|
+
lead: t,
|
|
1458
|
+
details: l
|
|
1459
|
+
})
|
|
1396
1460
|
},
|
|
1461
|
+
...Gt(l),
|
|
1397
1462
|
{
|
|
1398
1463
|
title: "Why it is waiting",
|
|
1399
1464
|
dataIndex: "reason",
|
|
1400
|
-
render:
|
|
1465
|
+
render: Et
|
|
1401
1466
|
},
|
|
1402
1467
|
{
|
|
1403
1468
|
title: "Status",
|
|
@@ -1407,27 +1472,82 @@ function Ht({ rows: e = [], canEdit: t = !0, refreshKey: n = 0, onChanged: r })
|
|
|
1407
1472
|
{
|
|
1408
1473
|
title: "First seen",
|
|
1409
1474
|
dataIndex: "firstSeenAt",
|
|
1410
|
-
render:
|
|
1475
|
+
render: yt
|
|
1411
1476
|
},
|
|
1412
|
-
...
|
|
1477
|
+
...n === "unassigned" ? [] : [{
|
|
1413
1478
|
title: "Sorted at",
|
|
1414
1479
|
dataIndex: "resolvedAt",
|
|
1415
|
-
render:
|
|
1480
|
+
render: yt
|
|
1416
1481
|
}]
|
|
1417
|
-
]
|
|
1418
|
-
|
|
1482
|
+
];
|
|
1483
|
+
return /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W(Vt, {
|
|
1484
|
+
title: "Could not load waiting leads",
|
|
1485
|
+
resource: c
|
|
1486
|
+
}), /* @__PURE__ */ W(k, {
|
|
1487
|
+
size: "small",
|
|
1488
|
+
rowKey: (e) => String(e.id || `${e.facebookLeadId}-${e.formId}`),
|
|
1489
|
+
loading: c.loading,
|
|
1490
|
+
dataSource: c.data?.leads || [],
|
|
1491
|
+
columns: u,
|
|
1492
|
+
scroll: { x: 900 },
|
|
1493
|
+
locale: { emptyText: c.loading || c.error ? " " : "No leads are waiting." },
|
|
1494
|
+
pagination: {
|
|
1495
|
+
current: a,
|
|
1496
|
+
pageSize: 20,
|
|
1497
|
+
total: Number(c.data?.total || 0),
|
|
1498
|
+
showSizeChanger: !1,
|
|
1499
|
+
hideOnSinglePage: !0,
|
|
1500
|
+
onChange: o
|
|
1501
|
+
}
|
|
1502
|
+
})] });
|
|
1503
|
+
}
|
|
1504
|
+
function Jt({ rows: e, formId: t, refreshKey: n, showForm: r, canEdit: i, onChanged: a }) {
|
|
1505
|
+
let [o, c] = f(1), l = Bt(s(() => Ge({
|
|
1506
|
+
page: o,
|
|
1507
|
+
limit: 20,
|
|
1508
|
+
formId: t,
|
|
1509
|
+
details: !0
|
|
1510
|
+
}), [o, t]), n), u = l.reload, d = l.data?.details, p = (t) => {
|
|
1511
|
+
ae.confirm({
|
|
1512
|
+
title: "Try this lead again?",
|
|
1513
|
+
content: /* @__PURE__ */ G("span", { children: [
|
|
1514
|
+
"We will try to bring in lead ",
|
|
1515
|
+
/* @__PURE__ */ W("strong", { children: t.facebookLeadId }),
|
|
1516
|
+
" from ",
|
|
1517
|
+
/* @__PURE__ */ W("strong", { children: Ht(e, t) }),
|
|
1518
|
+
" again."
|
|
1519
|
+
] }),
|
|
1520
|
+
okText: "Retry",
|
|
1521
|
+
cancelText: "Cancel",
|
|
1522
|
+
autoFocusButton: "cancel",
|
|
1523
|
+
onOk: async () => {
|
|
1524
|
+
try {
|
|
1525
|
+
await Ke(t.facebookLeadId), N.success("This lead will be tried again");
|
|
1526
|
+
} catch (e) {
|
|
1527
|
+
N.error(e?.status === 409 ? "This lead is no longer failed. The list has been updated." : Q(e));
|
|
1528
|
+
}
|
|
1529
|
+
u(), a?.();
|
|
1530
|
+
}
|
|
1531
|
+
});
|
|
1532
|
+
}, m = [
|
|
1533
|
+
...r ? [{
|
|
1419
1534
|
title: "Form",
|
|
1420
1535
|
dataIndex: "formName",
|
|
1421
|
-
render: (t, n) =>
|
|
1422
|
-
},
|
|
1536
|
+
render: (t, n) => Ht(e, n)
|
|
1537
|
+
}] : [],
|
|
1423
1538
|
{
|
|
1424
|
-
title: "Lead
|
|
1425
|
-
dataIndex: "facebookLeadId"
|
|
1539
|
+
title: "Lead",
|
|
1540
|
+
dataIndex: "facebookLeadId",
|
|
1541
|
+
render: (e, t) => /* @__PURE__ */ W(Wt, {
|
|
1542
|
+
lead: t,
|
|
1543
|
+
details: d
|
|
1544
|
+
})
|
|
1426
1545
|
},
|
|
1546
|
+
...Gt(d).slice(0, 2),
|
|
1427
1547
|
{
|
|
1428
1548
|
title: "What went wrong",
|
|
1429
1549
|
dataIndex: "reason",
|
|
1430
|
-
render:
|
|
1550
|
+
render: Tt
|
|
1431
1551
|
},
|
|
1432
1552
|
{
|
|
1433
1553
|
title: "Tries",
|
|
@@ -1438,25 +1558,59 @@ function Ht({ rows: e = [], canEdit: t = !0, refreshKey: n = 0, onChanged: r })
|
|
|
1438
1558
|
{
|
|
1439
1559
|
title: "When",
|
|
1440
1560
|
dataIndex: "lastFailedAt",
|
|
1441
|
-
render: (e, t) =>
|
|
1561
|
+
render: (e, t) => yt(e || t.firstSeenAt)
|
|
1442
1562
|
},
|
|
1443
1563
|
{
|
|
1444
1564
|
title: "",
|
|
1445
1565
|
key: "retry",
|
|
1446
1566
|
width: 96,
|
|
1447
|
-
render: (e,
|
|
1448
|
-
title:
|
|
1567
|
+
render: (e, t) => /* @__PURE__ */ W(M, {
|
|
1568
|
+
title: i ? "" : "You don't have permission to retry leads",
|
|
1449
1569
|
children: /* @__PURE__ */ W("span", { children: /* @__PURE__ */ W(h, {
|
|
1450
1570
|
size: "small",
|
|
1451
1571
|
className: "fb-inline-btn",
|
|
1452
|
-
disabled: !
|
|
1453
|
-
"aria-label": `Retry lead ${
|
|
1454
|
-
onClick: () =>
|
|
1572
|
+
disabled: !i,
|
|
1573
|
+
"aria-label": `Retry lead ${t.facebookLeadId}`,
|
|
1574
|
+
onClick: () => p(t),
|
|
1455
1575
|
children: "Retry"
|
|
1456
1576
|
}) })
|
|
1457
1577
|
})
|
|
1458
1578
|
}
|
|
1459
|
-
]
|
|
1579
|
+
];
|
|
1580
|
+
return /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W(Vt, {
|
|
1581
|
+
title: "Could not load failed leads",
|
|
1582
|
+
resource: l
|
|
1583
|
+
}), /* @__PURE__ */ W(k, {
|
|
1584
|
+
size: "small",
|
|
1585
|
+
rowKey: (e) => String(e.facebookLeadId),
|
|
1586
|
+
loading: l.loading,
|
|
1587
|
+
dataSource: l.data?.leads || [],
|
|
1588
|
+
columns: m,
|
|
1589
|
+
scroll: { x: 860 },
|
|
1590
|
+
locale: { emptyText: l.loading || l.error ? " " : "No failed leads." },
|
|
1591
|
+
pagination: {
|
|
1592
|
+
current: o,
|
|
1593
|
+
pageSize: 20,
|
|
1594
|
+
total: Number(l.data?.total || 0),
|
|
1595
|
+
showSizeChanger: !1,
|
|
1596
|
+
hideOnSinglePage: !0,
|
|
1597
|
+
onChange: c
|
|
1598
|
+
}
|
|
1599
|
+
})] });
|
|
1600
|
+
}
|
|
1601
|
+
var Yt = (e, t) => Object.entries(e || {}).map(([e, n]) => /* @__PURE__ */ G(A, {
|
|
1602
|
+
className: "fb-group__reason",
|
|
1603
|
+
children: [t(e), n > 1 ? ` · ${n}` : ""]
|
|
1604
|
+
}, e));
|
|
1605
|
+
function Xt({ rows: e = [], canEdit: t = !0, refreshKey: n = 0, onChanged: r }) {
|
|
1606
|
+
let [i, a] = f(""), [o, c] = f("unassigned"), l = s(() => Le({
|
|
1607
|
+
status: o,
|
|
1608
|
+
formId: i,
|
|
1609
|
+
groupBy: "form"
|
|
1610
|
+
}), [o, i]), u = s(() => Ge({
|
|
1611
|
+
formId: i,
|
|
1612
|
+
groupBy: "form"
|
|
1613
|
+
}), [i]), d = Bt(l, n), p = Bt(u, n), m = (e, t) => Array.isArray(e.data?.groups) ? e.data.groups.reduce((e, t) => e + Number(t.count || 0), 0) : e.data?.[t], h = m(d, o === "unassigned" ? "unassignedCount" : "total"), ee = m(p, "failedCount") ?? p.data?.total;
|
|
1460
1614
|
return /* @__PURE__ */ G("div", {
|
|
1461
1615
|
className: "fb-tab-body",
|
|
1462
1616
|
children: [
|
|
@@ -1468,23 +1622,21 @@ function Ht({ rows: e = [], canEdit: t = !0, refreshKey: n = 0, onChanged: r })
|
|
|
1468
1622
|
className: "fb-field-label",
|
|
1469
1623
|
htmlFor: "fb-attention-form",
|
|
1470
1624
|
children: "Form"
|
|
1471
|
-
}), /* @__PURE__ */ W(
|
|
1625
|
+
}), /* @__PURE__ */ W(dt, {
|
|
1472
1626
|
id: "fb-attention-form",
|
|
1473
1627
|
rows: e,
|
|
1474
1628
|
value: i,
|
|
1475
|
-
onChange:
|
|
1629
|
+
onChange: a
|
|
1476
1630
|
})]
|
|
1477
1631
|
})
|
|
1478
1632
|
}),
|
|
1479
1633
|
/* @__PURE__ */ G("div", {
|
|
1480
1634
|
className: "fb-subhead",
|
|
1481
|
-
children: [/* @__PURE__ */ G("h4", { children: ["Waiting leads",
|
|
1635
|
+
children: [/* @__PURE__ */ G("h4", { children: ["Waiting leads", h === void 0 ? "" : ` (${h})`] }), /* @__PURE__ */ W(T, {
|
|
1482
1636
|
"aria-label": "Show waiting leads",
|
|
1483
1637
|
value: o,
|
|
1484
1638
|
className: "fb-subhead-select",
|
|
1485
|
-
onChange:
|
|
1486
|
-
c(e), u(1);
|
|
1487
|
-
},
|
|
1639
|
+
onChange: c,
|
|
1488
1640
|
options: [
|
|
1489
1641
|
{
|
|
1490
1642
|
value: "unassigned",
|
|
@@ -1501,66 +1653,80 @@ function Ht({ rows: e = [], canEdit: t = !0, refreshKey: n = 0, onChanged: r })
|
|
|
1501
1653
|
]
|
|
1502
1654
|
})]
|
|
1503
1655
|
}),
|
|
1504
|
-
/* @__PURE__ */ W(
|
|
1656
|
+
/* @__PURE__ */ W(Vt, {
|
|
1505
1657
|
title: "Could not load waiting leads",
|
|
1506
|
-
resource:
|
|
1658
|
+
resource: d
|
|
1507
1659
|
}),
|
|
1508
|
-
/* @__PURE__ */ W(
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1660
|
+
/* @__PURE__ */ W(Kt, {
|
|
1661
|
+
rows: e,
|
|
1662
|
+
resource: d,
|
|
1663
|
+
unit: o === "unassigned" ? "waiting" : "leads",
|
|
1664
|
+
emptyText: "No leads are waiting.",
|
|
1665
|
+
describe: (e) => /* @__PURE__ */ G(U, { children: [Yt(e.reasons, Et), e.latest ? /* @__PURE__ */ G("span", {
|
|
1666
|
+
className: "fb-group__latest",
|
|
1667
|
+
children: ["Latest ", yt(e.latest)]
|
|
1668
|
+
}) : null] }),
|
|
1669
|
+
renderBody: (t) => /* @__PURE__ */ W(qt, {
|
|
1670
|
+
rows: e,
|
|
1671
|
+
formId: String(t.formId),
|
|
1672
|
+
status: o,
|
|
1673
|
+
refreshKey: n
|
|
1674
|
+
}),
|
|
1675
|
+
fallback: /* @__PURE__ */ W(qt, {
|
|
1676
|
+
rows: e,
|
|
1677
|
+
formId: i,
|
|
1678
|
+
status: o,
|
|
1679
|
+
refreshKey: n,
|
|
1680
|
+
showForm: !0
|
|
1681
|
+
})
|
|
1524
1682
|
}),
|
|
1525
1683
|
/* @__PURE__ */ W("div", {
|
|
1526
1684
|
className: "fb-subhead",
|
|
1527
|
-
children: /* @__PURE__ */ G("h4", { children: ["Failed leads",
|
|
1685
|
+
children: /* @__PURE__ */ G("h4", { children: ["Failed leads", ee === void 0 ? "" : ` (${ee})`] })
|
|
1528
1686
|
}),
|
|
1529
|
-
/* @__PURE__ */ W(
|
|
1687
|
+
/* @__PURE__ */ W(Vt, {
|
|
1530
1688
|
title: "Could not load failed leads",
|
|
1531
|
-
resource:
|
|
1689
|
+
resource: p
|
|
1532
1690
|
}),
|
|
1533
|
-
/* @__PURE__ */ W(
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
}
|
|
1691
|
+
/* @__PURE__ */ W(Kt, {
|
|
1692
|
+
rows: e,
|
|
1693
|
+
resource: p,
|
|
1694
|
+
unit: "failed",
|
|
1695
|
+
emptyText: "No failed leads.",
|
|
1696
|
+
describe: (e) => /* @__PURE__ */ G(U, { children: [Yt(e.reasons, Tt), e.latest ? /* @__PURE__ */ G("span", {
|
|
1697
|
+
className: "fb-group__latest",
|
|
1698
|
+
children: ["Latest ", yt(e.latest)]
|
|
1699
|
+
}) : null] }),
|
|
1700
|
+
renderBody: (i) => /* @__PURE__ */ W(Jt, {
|
|
1701
|
+
rows: e,
|
|
1702
|
+
formId: String(i.formId),
|
|
1703
|
+
refreshKey: n,
|
|
1704
|
+
canEdit: t,
|
|
1705
|
+
onChanged: r
|
|
1706
|
+
}),
|
|
1707
|
+
fallback: /* @__PURE__ */ W(Jt, {
|
|
1708
|
+
rows: e,
|
|
1709
|
+
formId: i,
|
|
1710
|
+
refreshKey: n,
|
|
1711
|
+
canEdit: t,
|
|
1712
|
+
onChanged: r,
|
|
1713
|
+
showForm: !0
|
|
1714
|
+
})
|
|
1549
1715
|
})
|
|
1550
1716
|
]
|
|
1551
1717
|
});
|
|
1552
1718
|
}
|
|
1553
|
-
function
|
|
1554
|
-
let [
|
|
1719
|
+
function Zt({ rows: e, formId: t, refreshKey: n, showForm: r }) {
|
|
1720
|
+
let [i, a] = f(1), o = Bt(s(() => Ie({
|
|
1555
1721
|
page: i,
|
|
1556
1722
|
limit: 20,
|
|
1557
|
-
formId:
|
|
1558
|
-
}), [i,
|
|
1559
|
-
{
|
|
1723
|
+
formId: t
|
|
1724
|
+
}), [i, t]), n), c = [
|
|
1725
|
+
...r ? [{
|
|
1560
1726
|
title: "Form",
|
|
1561
1727
|
dataIndex: "formName",
|
|
1562
|
-
render: (t, n) =>
|
|
1563
|
-
},
|
|
1728
|
+
render: (t, n) => Ht(e, n)
|
|
1729
|
+
}] : [],
|
|
1564
1730
|
{
|
|
1565
1731
|
title: "Lead ID",
|
|
1566
1732
|
dataIndex: "facebookLeadId"
|
|
@@ -1573,7 +1739,7 @@ function Ut({ rows: e = [], refreshKey: t = 0 }) {
|
|
|
1573
1739
|
{
|
|
1574
1740
|
title: "Reason",
|
|
1575
1741
|
dataIndex: "reason",
|
|
1576
|
-
render:
|
|
1742
|
+
render: Ct
|
|
1577
1743
|
},
|
|
1578
1744
|
{
|
|
1579
1745
|
title: "Went to",
|
|
@@ -1583,9 +1749,35 @@ function Ut({ rows: e = [], refreshKey: t = 0 }) {
|
|
|
1583
1749
|
{
|
|
1584
1750
|
title: "When",
|
|
1585
1751
|
dataIndex: "skippedAt",
|
|
1586
|
-
render:
|
|
1752
|
+
render: yt
|
|
1587
1753
|
}
|
|
1588
1754
|
];
|
|
1755
|
+
return /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W(Vt, {
|
|
1756
|
+
title: "Could not load skipped counsellors",
|
|
1757
|
+
resource: o
|
|
1758
|
+
}), /* @__PURE__ */ W(k, {
|
|
1759
|
+
size: "small",
|
|
1760
|
+
rowKey: (e) => String(e.id || `${e.facebookLeadId}-${e.skippedCounsellorLegacyId}`),
|
|
1761
|
+
loading: o.loading,
|
|
1762
|
+
dataSource: o.data?.skips || [],
|
|
1763
|
+
columns: c,
|
|
1764
|
+
scroll: { x: 860 },
|
|
1765
|
+
locale: { emptyText: o.loading || o.error ? " " : "No one has been skipped yet." },
|
|
1766
|
+
pagination: {
|
|
1767
|
+
current: i,
|
|
1768
|
+
pageSize: 20,
|
|
1769
|
+
total: Number(o.data?.total || 0),
|
|
1770
|
+
showSizeChanger: !1,
|
|
1771
|
+
hideOnSinglePage: !0,
|
|
1772
|
+
onChange: a
|
|
1773
|
+
}
|
|
1774
|
+
})] });
|
|
1775
|
+
}
|
|
1776
|
+
function Qt({ rows: e = [], refreshKey: t = 0 }) {
|
|
1777
|
+
let [n, r] = f(""), i = Bt(s(() => Ie({
|
|
1778
|
+
formId: n,
|
|
1779
|
+
groupBy: "form"
|
|
1780
|
+
}), [n]), t);
|
|
1589
1781
|
return /* @__PURE__ */ G("div", {
|
|
1590
1782
|
className: "fb-tab-body",
|
|
1591
1783
|
children: [
|
|
@@ -1597,42 +1789,44 @@ function Ut({ rows: e = [], refreshKey: t = 0 }) {
|
|
|
1597
1789
|
className: "fb-field-label",
|
|
1598
1790
|
htmlFor: "fb-skips-form",
|
|
1599
1791
|
children: "Form"
|
|
1600
|
-
}), /* @__PURE__ */ W(
|
|
1792
|
+
}), /* @__PURE__ */ W(dt, {
|
|
1601
1793
|
id: "fb-skips-form",
|
|
1602
1794
|
rows: e,
|
|
1603
1795
|
value: n,
|
|
1604
|
-
onChange:
|
|
1605
|
-
r(e), a(1);
|
|
1606
|
-
}
|
|
1796
|
+
onChange: r
|
|
1607
1797
|
})]
|
|
1608
1798
|
})
|
|
1609
1799
|
}),
|
|
1610
|
-
/* @__PURE__ */ W(
|
|
1800
|
+
/* @__PURE__ */ W(Vt, {
|
|
1611
1801
|
title: "Could not load skipped counsellors",
|
|
1612
|
-
resource:
|
|
1802
|
+
resource: i
|
|
1613
1803
|
}),
|
|
1614
|
-
/* @__PURE__ */ W(
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1804
|
+
/* @__PURE__ */ W(Kt, {
|
|
1805
|
+
rows: e,
|
|
1806
|
+
resource: i,
|
|
1807
|
+
unit: "skips",
|
|
1808
|
+
emptyText: "No one has been skipped yet.",
|
|
1809
|
+
describe: (e) => /* @__PURE__ */ G(U, { children: [e.people?.length ? /* @__PURE__ */ G("span", {
|
|
1810
|
+
className: "fb-group__people",
|
|
1811
|
+
children: ["Skipped: ", e.people.join(", ")]
|
|
1812
|
+
}) : null, Yt(e.reasons, Ct)] }),
|
|
1813
|
+
renderBody: (n) => /* @__PURE__ */ W(Zt, {
|
|
1814
|
+
rows: e,
|
|
1815
|
+
formId: String(n.formId),
|
|
1816
|
+
refreshKey: t
|
|
1817
|
+
}),
|
|
1818
|
+
fallback: /* @__PURE__ */ W(Zt, {
|
|
1819
|
+
rows: e,
|
|
1820
|
+
formId: n,
|
|
1821
|
+
refreshKey: t,
|
|
1822
|
+
showForm: !0
|
|
1823
|
+
})
|
|
1630
1824
|
})
|
|
1631
1825
|
]
|
|
1632
1826
|
});
|
|
1633
1827
|
}
|
|
1634
|
-
function
|
|
1635
|
-
let [n, r] = f(""), [i, a] = f(1), o =
|
|
1828
|
+
function $t({ rows: e = [], refreshKey: t = 0 }) {
|
|
1829
|
+
let [n, r] = f(""), [i, a] = f(1), o = Bt(s(() => qe({
|
|
1636
1830
|
page: i,
|
|
1637
1831
|
limit: 20,
|
|
1638
1832
|
formId: n
|
|
@@ -1641,17 +1835,17 @@ function Wt({ rows: e = [], refreshKey: t = 0 }) {
|
|
|
1641
1835
|
title: "When",
|
|
1642
1836
|
dataIndex: "at",
|
|
1643
1837
|
width: 190,
|
|
1644
|
-
render:
|
|
1838
|
+
render: yt
|
|
1645
1839
|
},
|
|
1646
1840
|
{
|
|
1647
1841
|
title: "Form",
|
|
1648
1842
|
dataIndex: "formName",
|
|
1649
|
-
render: (t, n) =>
|
|
1843
|
+
render: (t, n) => Ht(e, n)
|
|
1650
1844
|
},
|
|
1651
1845
|
{
|
|
1652
1846
|
title: "What changed",
|
|
1653
1847
|
key: "change",
|
|
1654
|
-
render: (e, t) =>
|
|
1848
|
+
render: (e, t) => Ot(t)
|
|
1655
1849
|
},
|
|
1656
1850
|
{
|
|
1657
1851
|
title: "By",
|
|
@@ -1670,7 +1864,7 @@ function Wt({ rows: e = [], refreshKey: t = 0 }) {
|
|
|
1670
1864
|
className: "fb-field-label",
|
|
1671
1865
|
htmlFor: "fb-history-form",
|
|
1672
1866
|
children: "Form"
|
|
1673
|
-
}), /* @__PURE__ */ W(
|
|
1867
|
+
}), /* @__PURE__ */ W(dt, {
|
|
1674
1868
|
id: "fb-history-form",
|
|
1675
1869
|
rows: e,
|
|
1676
1870
|
value: n,
|
|
@@ -1680,11 +1874,11 @@ function Wt({ rows: e = [], refreshKey: t = 0 }) {
|
|
|
1680
1874
|
})]
|
|
1681
1875
|
})
|
|
1682
1876
|
}),
|
|
1683
|
-
/* @__PURE__ */ W(
|
|
1877
|
+
/* @__PURE__ */ W(Vt, {
|
|
1684
1878
|
title: "Could not load history",
|
|
1685
1879
|
resource: o
|
|
1686
1880
|
}),
|
|
1687
|
-
/* @__PURE__ */ W(
|
|
1881
|
+
/* @__PURE__ */ W(k, {
|
|
1688
1882
|
size: "small",
|
|
1689
1883
|
rowKey: (e) => String(e.id || `${e.formId}-${e.at}`),
|
|
1690
1884
|
loading: o.loading,
|
|
@@ -1706,8 +1900,8 @@ function Wt({ rows: e = [], refreshKey: t = 0 }) {
|
|
|
1706
1900
|
}
|
|
1707
1901
|
//#endregion
|
|
1708
1902
|
//#region src/pages/Modules/Admin/settings/settingsUi.jsx
|
|
1709
|
-
var { Title:
|
|
1710
|
-
function
|
|
1903
|
+
var { Title: en, Text: tn } = ce;
|
|
1904
|
+
function nn({ icon: e, title: t, subtitle: n, actions: r, crumbs: i = [], onHome: a }) {
|
|
1711
1905
|
return /* @__PURE__ */ G("div", {
|
|
1712
1906
|
className: "cc-settings-header",
|
|
1713
1907
|
children: [a ? /* @__PURE__ */ W(m, {
|
|
@@ -1733,17 +1927,17 @@ function qt({ icon: e, title: t, subtitle: n, actions: r, crumbs: i = [], onHome
|
|
|
1733
1927
|
children: e
|
|
1734
1928
|
}) : null, /* @__PURE__ */ G("div", {
|
|
1735
1929
|
style: { minWidth: 0 },
|
|
1736
|
-
children: [/* @__PURE__ */ W(
|
|
1930
|
+
children: [/* @__PURE__ */ W(en, {
|
|
1737
1931
|
level: 3,
|
|
1738
1932
|
className: "cc-settings-header__title",
|
|
1739
1933
|
children: t
|
|
1740
|
-
}), n ? /* @__PURE__ */ W(
|
|
1934
|
+
}), n ? /* @__PURE__ */ W(tn, {
|
|
1741
1935
|
type: "secondary",
|
|
1742
1936
|
className: "cc-settings-header__sub",
|
|
1743
1937
|
children: n
|
|
1744
1938
|
}) : null]
|
|
1745
1939
|
})]
|
|
1746
|
-
}), r ? /* @__PURE__ */ W(
|
|
1940
|
+
}), r ? /* @__PURE__ */ W(D, {
|
|
1747
1941
|
wrap: !0,
|
|
1748
1942
|
className: "cc-settings-header__actions",
|
|
1749
1943
|
children: r
|
|
@@ -1751,7 +1945,7 @@ function qt({ icon: e, title: t, subtitle: n, actions: r, crumbs: i = [], onHome
|
|
|
1751
1945
|
})]
|
|
1752
1946
|
});
|
|
1753
1947
|
}
|
|
1754
|
-
function
|
|
1948
|
+
function rn({ items: e }) {
|
|
1755
1949
|
return /* @__PURE__ */ W("div", {
|
|
1756
1950
|
className: "cc-settings-tiles",
|
|
1757
1951
|
children: e.filter(Boolean).map((e) => /* @__PURE__ */ G("div", {
|
|
@@ -1780,13 +1974,13 @@ function Jt({ items: e }) {
|
|
|
1780
1974
|
}, e.key))
|
|
1781
1975
|
});
|
|
1782
1976
|
}
|
|
1783
|
-
function
|
|
1977
|
+
function an({ tone: e = "grey", icon: t, children: n }) {
|
|
1784
1978
|
return /* @__PURE__ */ G("span", {
|
|
1785
1979
|
className: `cc-settings-pill is-${e}`,
|
|
1786
1980
|
children: [t, n]
|
|
1787
1981
|
});
|
|
1788
1982
|
}
|
|
1789
|
-
function
|
|
1983
|
+
function on({ name: e }) {
|
|
1790
1984
|
let t = String(e || "").trim().split(/\s+/).filter(Boolean).slice(0, 2).map((e) => e[0].toUpperCase()).join("") || "?";
|
|
1791
1985
|
return /* @__PURE__ */ W("span", {
|
|
1792
1986
|
className: "cc-settings-initials",
|
|
@@ -1796,22 +1990,22 @@ function Xt({ name: e }) {
|
|
|
1796
1990
|
}
|
|
1797
1991
|
//#endregion
|
|
1798
1992
|
//#region src/pages/Modules/Admin/leadDistributionView.js
|
|
1799
|
-
function
|
|
1993
|
+
function sn(e, t) {
|
|
1800
1994
|
let n = Number(e) || 0, r = Number(t);
|
|
1801
1995
|
return n <= 0 || !Number.isFinite(r) ? 0 : Math.floor(n * Math.min(1, Math.max(0, r)));
|
|
1802
1996
|
}
|
|
1803
|
-
function
|
|
1997
|
+
function cn(e) {
|
|
1804
1998
|
if (e == null || e === "") return e;
|
|
1805
1999
|
let t = Number(e);
|
|
1806
2000
|
return Number.isFinite(t) ? Math.round(t * 100) : e;
|
|
1807
2001
|
}
|
|
1808
|
-
function
|
|
2002
|
+
function ln(e) {
|
|
1809
2003
|
if (e == null || e === "") return e;
|
|
1810
2004
|
let t = Number(e);
|
|
1811
2005
|
return Number.isFinite(t) ? Math.round(t) / 100 : e;
|
|
1812
2006
|
}
|
|
1813
|
-
function
|
|
1814
|
-
let n = Number(e.cap ?? t.openLeadCap ?? 0) || 0, r = Number(e.untouched ?? 0) || 0, i = e.refillAt ??
|
|
2007
|
+
function un(e = {}, t = {}) {
|
|
2008
|
+
let n = Number(e.cap ?? t.openLeadCap ?? 0) || 0, r = Number(e.untouched ?? 0) || 0, i = e.refillAt ?? sn(n, t.refillAtRatio ?? .5);
|
|
1815
2009
|
if (n <= 0) return {
|
|
1816
2010
|
text: String(r),
|
|
1817
2011
|
percent: 0,
|
|
@@ -1852,7 +2046,7 @@ function en(e = {}, t = {}) {
|
|
|
1852
2046
|
room: n - r
|
|
1853
2047
|
};
|
|
1854
2048
|
}
|
|
1855
|
-
var
|
|
2049
|
+
var dn = {
|
|
1856
2050
|
assigned: {
|
|
1857
2051
|
label: "Lead assigned",
|
|
1858
2052
|
tone: "blue"
|
|
@@ -1866,7 +2060,7 @@ var tn = {
|
|
|
1866
2060
|
tone: "green"
|
|
1867
2061
|
}
|
|
1868
2062
|
};
|
|
1869
|
-
function
|
|
2063
|
+
function fn(e = {}) {
|
|
1870
2064
|
let t = Number(e.cap) || 0, n = Number(e.untouchedBefore) || 0, r = t > 0 ? ` of ${t}` : "";
|
|
1871
2065
|
switch (e.event) {
|
|
1872
2066
|
case "assigned": return `${e.formName ? `${e.formName} · ` : ""}untouched ${n} → ${n + 1}${r}`;
|
|
@@ -1877,7 +2071,7 @@ function nn(e = {}) {
|
|
|
1877
2071
|
}
|
|
1878
2072
|
//#endregion
|
|
1879
2073
|
//#region src/pages/Modules/Admin/LeadDistributionPanels.jsx
|
|
1880
|
-
var { Text:
|
|
2074
|
+
var { Text: pn, Paragraph: mn } = ce, hn = {
|
|
1881
2075
|
eligible: {
|
|
1882
2076
|
label: "Active – Eligible",
|
|
1883
2077
|
color: "green"
|
|
@@ -1910,17 +2104,17 @@ var { Text: rn, Paragraph: an } = ce, on = {
|
|
|
1910
2104
|
label: "Past day",
|
|
1911
2105
|
color: "default"
|
|
1912
2106
|
}
|
|
1913
|
-
},
|
|
2107
|
+
}, gn = {
|
|
1914
2108
|
awaiting_cutoff: "Waiting for cut-off",
|
|
1915
2109
|
no_active_counsellor: "Waiting for a counsellor who is online and under the open-lead limit",
|
|
1916
2110
|
distribution_not_configured: "Form has no counsellor list",
|
|
1917
2111
|
distribution_disabled: "Form distribution is switched off"
|
|
1918
|
-
},
|
|
2112
|
+
}, _n = (e) => e ? K(e).format("h:mm A") : "–", vn = (e) => e ? K(e).format("D MMM, h:mm A") : "–", yn = (e) => {
|
|
1919
2113
|
if (!e) return "–";
|
|
1920
2114
|
let t = Math.max(0, K().diff(K(e), "minute"));
|
|
1921
2115
|
return t < 60 ? `${t} min` : `${Math.floor(t / 60)} h ${t % 60} min`;
|
|
1922
2116
|
};
|
|
1923
|
-
function
|
|
2117
|
+
function bn(e, t) {
|
|
1924
2118
|
let [n, r] = f({ loading: !0 }), [i, a] = f(0);
|
|
1925
2119
|
return c(() => {
|
|
1926
2120
|
let t = !0;
|
|
@@ -1940,7 +2134,7 @@ function dn(e, t) {
|
|
|
1940
2134
|
})), a((e) => e + 1);
|
|
1941
2135
|
}];
|
|
1942
2136
|
}
|
|
1943
|
-
var
|
|
2137
|
+
var xn = ({ text: e, onRetry: t }) => /* @__PURE__ */ W(p, {
|
|
1944
2138
|
type: "error",
|
|
1945
2139
|
showIcon: !0,
|
|
1946
2140
|
message: e,
|
|
@@ -1950,27 +2144,27 @@ var fn = ({ text: e, onRetry: t }) => /* @__PURE__ */ W(p, {
|
|
|
1950
2144
|
children: "Try again"
|
|
1951
2145
|
})
|
|
1952
2146
|
});
|
|
1953
|
-
function
|
|
1954
|
-
let [t, n] = f(null), [r, i] =
|
|
2147
|
+
function Sn({ canEdit: e = !1 }) {
|
|
2148
|
+
let [t, n] = f(null), [r, i] = bn(() => Ye(t ? t.format("YYYY-MM-DD") : ""), [t]), [a, o] = f(null), [s, c] = f(""), l = r.data ?? {}, u = l.summary ?? {}, d = !t || l.day === l.today, m = Number(l.settings?.openLeadCap ?? 0) || 0, ee = u.refillAt ?? sn(m, l.settings?.refillAtRatio ?? .5), g = async (e, t) => {
|
|
1955
2149
|
c(`t${e.legacyUserId}`);
|
|
1956
2150
|
try {
|
|
1957
|
-
await
|
|
2151
|
+
await Qe(e.legacyUserId, t, t ? "" : "Disabled by admin"), N.success(`${e.name} ${t ? "will receive new leads again" : "will not receive new leads"}`), i();
|
|
1958
2152
|
} catch (e) {
|
|
1959
2153
|
N.error(Q(e));
|
|
1960
2154
|
} finally {
|
|
1961
2155
|
c("");
|
|
1962
2156
|
}
|
|
1963
|
-
},
|
|
2157
|
+
}, te = [
|
|
1964
2158
|
{
|
|
1965
2159
|
title: "Counsellor",
|
|
1966
2160
|
key: "name",
|
|
1967
|
-
render: (e, t) => /* @__PURE__ */ G(
|
|
2161
|
+
render: (e, t) => /* @__PURE__ */ G(D, {
|
|
1968
2162
|
direction: "vertical",
|
|
1969
2163
|
size: 0,
|
|
1970
|
-
children: [/* @__PURE__ */ W(
|
|
2164
|
+
children: [/* @__PURE__ */ W(pn, {
|
|
1971
2165
|
strong: !0,
|
|
1972
2166
|
children: t.name
|
|
1973
|
-
}), /* @__PURE__ */ W(
|
|
2167
|
+
}), /* @__PURE__ */ W(pn, {
|
|
1974
2168
|
type: "secondary",
|
|
1975
2169
|
style: { fontSize: 12 },
|
|
1976
2170
|
children: (t.forms ?? []).join(", ")
|
|
@@ -1980,22 +2174,22 @@ function pn({ canEdit: e = !1 }) {
|
|
|
1980
2174
|
{
|
|
1981
2175
|
title: "First login",
|
|
1982
2176
|
dataIndex: "firstLoginAt",
|
|
1983
|
-
render:
|
|
2177
|
+
render: _n,
|
|
1984
2178
|
sorter: (e, t) => String(e.firstLoginAt ?? "").localeCompare(String(t.firstLoginAt ?? ""))
|
|
1985
2179
|
},
|
|
1986
2180
|
{
|
|
1987
2181
|
title: "Last seen / logout",
|
|
1988
2182
|
key: "seen",
|
|
1989
|
-
render: (e, t) => t.loggedOutAt && (!t.lastSeenAt || t.loggedOutAt > t.lastSeenAt) ? `Logged out ${
|
|
2183
|
+
render: (e, t) => t.loggedOutAt && (!t.lastSeenAt || t.loggedOutAt > t.lastSeenAt) ? `Logged out ${_n(t.loggedOutAt)}` : _n(t.lastSeenAt)
|
|
1990
2184
|
},
|
|
1991
2185
|
{
|
|
1992
2186
|
title: "Status",
|
|
1993
2187
|
dataIndex: "status",
|
|
1994
|
-
render: (e) => /* @__PURE__ */ W(
|
|
1995
|
-
color:
|
|
1996
|
-
children:
|
|
2188
|
+
render: (e) => /* @__PURE__ */ W(A, {
|
|
2189
|
+
color: hn[e]?.color,
|
|
2190
|
+
children: hn[e]?.label ?? e
|
|
1997
2191
|
}),
|
|
1998
|
-
filters: Object.entries(
|
|
2192
|
+
filters: Object.entries(hn).map(([e, t]) => ({
|
|
1999
2193
|
value: e,
|
|
2000
2194
|
text: t.label
|
|
2001
2195
|
})),
|
|
@@ -2006,8 +2200,8 @@ function pn({ canEdit: e = !1 }) {
|
|
|
2006
2200
|
dataIndex: "untouched",
|
|
2007
2201
|
sorter: (e, t) => (e.untouched ?? 0) - (t.untouched ?? 0),
|
|
2008
2202
|
render: (e, t) => {
|
|
2009
|
-
let n =
|
|
2010
|
-
return /* @__PURE__ */ W(
|
|
2203
|
+
let n = un(t, l.settings);
|
|
2204
|
+
return /* @__PURE__ */ W(M, {
|
|
2011
2205
|
title: "Untouched leads this counsellor holds / the most one counsellor may hold",
|
|
2012
2206
|
children: /* @__PURE__ */ G("div", {
|
|
2013
2207
|
className: "ld-quota",
|
|
@@ -2016,7 +2210,7 @@ function pn({ canEdit: e = !1 }) {
|
|
|
2016
2210
|
className: `ld-quota__text is-${n.tone}`,
|
|
2017
2211
|
children: n.text
|
|
2018
2212
|
}),
|
|
2019
|
-
n.cap > 0 ? /* @__PURE__ */ W(
|
|
2213
|
+
n.cap > 0 ? /* @__PURE__ */ W(S, {
|
|
2020
2214
|
percent: n.percent,
|
|
2021
2215
|
size: "small",
|
|
2022
2216
|
showInfo: !1,
|
|
@@ -2046,7 +2240,7 @@ function pn({ canEdit: e = !1 }) {
|
|
|
2046
2240
|
dataIndex: "resetsToday",
|
|
2047
2241
|
align: "right",
|
|
2048
2242
|
sorter: (e, t) => (e.resetsToday ?? 0) - (t.resetsToday ?? 0),
|
|
2049
|
-
render: (e) => e ? /* @__PURE__ */ W(
|
|
2243
|
+
render: (e) => e ? /* @__PURE__ */ W(an, {
|
|
2050
2244
|
tone: "green",
|
|
2051
2245
|
icon: /* @__PURE__ */ W(z, {}),
|
|
2052
2246
|
children: e
|
|
@@ -2074,7 +2268,7 @@ function pn({ canEdit: e = !1 }) {
|
|
|
2074
2268
|
title: "Progress",
|
|
2075
2269
|
key: "progress",
|
|
2076
2270
|
width: 140,
|
|
2077
|
-
render: (e, t) => /* @__PURE__ */ W(
|
|
2271
|
+
render: (e, t) => /* @__PURE__ */ W(S, {
|
|
2078
2272
|
percent: t.target ? Math.min(100, Math.round(t.assigned / t.target * 100)) : 0,
|
|
2079
2273
|
size: "small",
|
|
2080
2274
|
showInfo: !1
|
|
@@ -2084,7 +2278,7 @@ function pn({ canEdit: e = !1 }) {
|
|
|
2084
2278
|
title: "Difference",
|
|
2085
2279
|
dataIndex: "difference",
|
|
2086
2280
|
align: "right",
|
|
2087
|
-
render: (e, t) => t.status === "eligible" && e > 0 ? /* @__PURE__ */ G(
|
|
2281
|
+
render: (e, t) => t.status === "eligible" && e > 0 ? /* @__PURE__ */ G(pn, {
|
|
2088
2282
|
type: "warning",
|
|
2089
2283
|
children: [e, " behind"]
|
|
2090
2284
|
}) : t.status === "eligible" ? "On target" : "–"
|
|
@@ -2093,12 +2287,12 @@ function pn({ canEdit: e = !1 }) {
|
|
|
2093
2287
|
title: "",
|
|
2094
2288
|
key: "act",
|
|
2095
2289
|
width: 210,
|
|
2096
|
-
render: (e, t) => t.status === "inactive" ? null : /* @__PURE__ */ G(
|
|
2290
|
+
render: (e, t) => t.status === "inactive" ? null : /* @__PURE__ */ G(D, { children: [t.status === "admin_disabled" ? /* @__PURE__ */ W(h, {
|
|
2097
2291
|
size: "small",
|
|
2098
2292
|
loading: s === `t${t.legacyUserId}`,
|
|
2099
2293
|
onClick: () => g(t, !0),
|
|
2100
2294
|
children: "Enable"
|
|
2101
|
-
}) : /* @__PURE__ */ W(
|
|
2295
|
+
}) : /* @__PURE__ */ W(x, {
|
|
2102
2296
|
title: `Stop new leads for ${t.name}?`,
|
|
2103
2297
|
description: "Leads they already have stay with them.",
|
|
2104
2298
|
okText: "Disable",
|
|
@@ -2120,22 +2314,22 @@ function pn({ canEdit: e = !1 }) {
|
|
|
2120
2314
|
return /* @__PURE__ */ G("div", {
|
|
2121
2315
|
className: "ld-today ld-panel",
|
|
2122
2316
|
children: [
|
|
2123
|
-
/* @__PURE__ */ G(
|
|
2317
|
+
/* @__PURE__ */ G(D, {
|
|
2124
2318
|
wrap: !0,
|
|
2125
2319
|
style: {
|
|
2126
2320
|
marginBottom: 12,
|
|
2127
2321
|
width: "100%",
|
|
2128
2322
|
justifyContent: "space-between"
|
|
2129
2323
|
},
|
|
2130
|
-
children: [/* @__PURE__ */ G(
|
|
2324
|
+
children: [/* @__PURE__ */ G(D, {
|
|
2131
2325
|
wrap: !0,
|
|
2132
|
-
children: [/* @__PURE__ */ W(
|
|
2326
|
+
children: [/* @__PURE__ */ W(ne, {
|
|
2133
2327
|
value: t,
|
|
2134
2328
|
onChange: n,
|
|
2135
2329
|
allowClear: !0,
|
|
2136
2330
|
placeholder: "Today",
|
|
2137
2331
|
disabledDate: (e) => e && e.isAfter(K(), "day")
|
|
2138
|
-
}), l.settings ? /* @__PURE__ */ W(
|
|
2332
|
+
}), l.settings ? /* @__PURE__ */ W(A, {
|
|
2139
2333
|
color: l.settings.mode === "equal_daily" ? "magenta" : "default",
|
|
2140
2334
|
children: l.settings.mode === "equal_daily" ? "Equal daily distribution" : "Round-robin (earlier behaviour)"
|
|
2141
2335
|
}) : null]
|
|
@@ -2145,7 +2339,7 @@ function pn({ canEdit: e = !1 }) {
|
|
|
2145
2339
|
children: "Refresh"
|
|
2146
2340
|
})]
|
|
2147
2341
|
}),
|
|
2148
|
-
r.loading && !r.data ? /* @__PURE__ */ W(
|
|
2342
|
+
r.loading && !r.data ? /* @__PURE__ */ W(E, { active: !0 }) : r.error ? /* @__PURE__ */ W(xn, {
|
|
2149
2343
|
text: r.error,
|
|
2150
2344
|
onRetry: i
|
|
2151
2345
|
}) : /* @__PURE__ */ G(U, { children: [
|
|
@@ -2153,9 +2347,9 @@ function pn({ canEdit: e = !1 }) {
|
|
|
2153
2347
|
style: { marginBottom: 12 },
|
|
2154
2348
|
showIcon: !0,
|
|
2155
2349
|
type: l.holding ? "info" : "success",
|
|
2156
|
-
message: l.holding ? `Leads received until ${
|
|
2350
|
+
message: l.holding ? `Leads received until ${_n(l.cutoffAt)} wait, then they are shared equally among counsellors who are online at ${_n(l.cutoffAt)}.` : `Cut-off ${_n(l.cutoffAt)} has passed: each new lead goes to the online counsellor with the fewest leads today.`
|
|
2157
2351
|
}) : null,
|
|
2158
|
-
/* @__PURE__ */ W(
|
|
2352
|
+
/* @__PURE__ */ W(rn, { items: [
|
|
2159
2353
|
{
|
|
2160
2354
|
key: "received",
|
|
2161
2355
|
label: "Received",
|
|
@@ -2248,23 +2442,23 @@ function pn({ canEdit: e = !1 }) {
|
|
|
2248
2442
|
". \"Left to assign\" is the queue for everyone together, not for one counsellor."
|
|
2249
2443
|
] })]
|
|
2250
2444
|
}) : null,
|
|
2251
|
-
u.balance !== "balanced" && (u.spread ?? 0) > 1 ? /* @__PURE__ */ W(
|
|
2445
|
+
u.balance !== "balanced" && (u.spread ?? 0) > 1 ? /* @__PURE__ */ W(mn, {
|
|
2252
2446
|
type: "secondary",
|
|
2253
2447
|
style: { fontSize: 12 },
|
|
2254
2448
|
children: "Counsellors who joined later get new leads first until they catch up. Leads already assigned are never moved, so an exact match is not always possible."
|
|
2255
2449
|
}) : null,
|
|
2256
|
-
/* @__PURE__ */ W(
|
|
2450
|
+
/* @__PURE__ */ W(k, {
|
|
2257
2451
|
rowKey: "legacyUserId",
|
|
2258
2452
|
size: "small",
|
|
2259
|
-
columns:
|
|
2453
|
+
columns: te,
|
|
2260
2454
|
dataSource: l.counsellors ?? [],
|
|
2261
2455
|
pagination: !1,
|
|
2262
2456
|
scroll: { x: "max-content" },
|
|
2263
2457
|
loading: r.loading,
|
|
2264
|
-
locale: { emptyText: /* @__PURE__ */ W(
|
|
2458
|
+
locale: { emptyText: /* @__PURE__ */ W(v, { description: "No counsellor is on any form's list yet. Add counsellors in the Forms tab." }) }
|
|
2265
2459
|
})
|
|
2266
2460
|
] }),
|
|
2267
|
-
a ? /* @__PURE__ */ W(
|
|
2461
|
+
a ? /* @__PURE__ */ W(Cn, {
|
|
2268
2462
|
counsellor: a,
|
|
2269
2463
|
onClose: (e) => {
|
|
2270
2464
|
o(null), e && i();
|
|
@@ -2273,12 +2467,12 @@ function pn({ canEdit: e = !1 }) {
|
|
|
2273
2467
|
]
|
|
2274
2468
|
});
|
|
2275
2469
|
}
|
|
2276
|
-
function
|
|
2277
|
-
let [n] =
|
|
2470
|
+
function Cn({ counsellor: e, onClose: t }) {
|
|
2471
|
+
let [n] = y.useForm(), [r, i] = bn(() => $e(K().format("YYYY-MM-DD")), []), [a, o] = f(!1), [s, c] = f(!1), l = (Array.isArray(r.data) ? r.data : []).filter((t) => Number(t.legacyUserId) === Number(e.legacyUserId)), u = async () => {
|
|
2278
2472
|
let t = await n.validateFields();
|
|
2279
2473
|
o(!0);
|
|
2280
2474
|
try {
|
|
2281
|
-
await
|
|
2475
|
+
await et({
|
|
2282
2476
|
legacyUserId: e.legacyUserId,
|
|
2283
2477
|
from: t.range[0].format("YYYY-MM-DD"),
|
|
2284
2478
|
to: t.range[1].format("YYYY-MM-DD"),
|
|
@@ -2291,12 +2485,12 @@ function mn({ counsellor: e, onClose: t }) {
|
|
|
2291
2485
|
}
|
|
2292
2486
|
}, d = async (e) => {
|
|
2293
2487
|
try {
|
|
2294
|
-
await
|
|
2488
|
+
await tt(e), N.success("Leave removed"), c(!0), i();
|
|
2295
2489
|
} catch (e) {
|
|
2296
2490
|
N.error(Q(e));
|
|
2297
2491
|
}
|
|
2298
2492
|
};
|
|
2299
|
-
return /* @__PURE__ */ G(
|
|
2493
|
+
return /* @__PURE__ */ G(ae, {
|
|
2300
2494
|
open: !0,
|
|
2301
2495
|
title: `Leave · ${e.name}`,
|
|
2302
2496
|
onCancel: () => t(s),
|
|
@@ -2305,26 +2499,26 @@ function mn({ counsellor: e, onClose: t }) {
|
|
|
2305
2499
|
children: "Close"
|
|
2306
2500
|
}),
|
|
2307
2501
|
children: [
|
|
2308
|
-
/* @__PURE__ */ G(
|
|
2502
|
+
/* @__PURE__ */ G(y, {
|
|
2309
2503
|
form: n,
|
|
2310
2504
|
layout: "vertical",
|
|
2311
2505
|
children: [
|
|
2312
|
-
/* @__PURE__ */ W(
|
|
2506
|
+
/* @__PURE__ */ W(y.Item, {
|
|
2313
2507
|
name: "range",
|
|
2314
2508
|
label: "Days on leave",
|
|
2315
2509
|
rules: [{
|
|
2316
2510
|
required: !0,
|
|
2317
2511
|
message: "Choose the days"
|
|
2318
2512
|
}],
|
|
2319
|
-
children: /* @__PURE__ */ W(
|
|
2513
|
+
children: /* @__PURE__ */ W(ne.RangePicker, {
|
|
2320
2514
|
style: { width: "100%" },
|
|
2321
2515
|
disabledDate: (e) => e && e.isBefore(K(), "day")
|
|
2322
2516
|
})
|
|
2323
2517
|
}),
|
|
2324
|
-
/* @__PURE__ */ W(
|
|
2518
|
+
/* @__PURE__ */ W(y.Item, {
|
|
2325
2519
|
name: "reason",
|
|
2326
2520
|
label: "Reason (optional)",
|
|
2327
|
-
children: /* @__PURE__ */ W(
|
|
2521
|
+
children: /* @__PURE__ */ W(ie, { maxLength: 300 })
|
|
2328
2522
|
}),
|
|
2329
2523
|
/* @__PURE__ */ W(h, {
|
|
2330
2524
|
type: "primary",
|
|
@@ -2334,31 +2528,31 @@ function mn({ counsellor: e, onClose: t }) {
|
|
|
2334
2528
|
})
|
|
2335
2529
|
]
|
|
2336
2530
|
}),
|
|
2337
|
-
/* @__PURE__ */ W(
|
|
2531
|
+
/* @__PURE__ */ W(mn, {
|
|
2338
2532
|
type: "secondary",
|
|
2339
2533
|
style: { margin: "12px 0 4px" },
|
|
2340
2534
|
children: "Upcoming leave"
|
|
2341
2535
|
}),
|
|
2342
|
-
r.loading ? /* @__PURE__ */ W(
|
|
2536
|
+
r.loading ? /* @__PURE__ */ W(E, {
|
|
2343
2537
|
active: !0,
|
|
2344
2538
|
paragraph: { rows: 1 }
|
|
2345
|
-
}) : r.error ? /* @__PURE__ */ W(
|
|
2539
|
+
}) : r.error ? /* @__PURE__ */ W(xn, {
|
|
2346
2540
|
text: r.error,
|
|
2347
2541
|
onRetry: i
|
|
2348
|
-
}) : l.length ? /* @__PURE__ */ W(
|
|
2542
|
+
}) : l.length ? /* @__PURE__ */ W(D, {
|
|
2349
2543
|
direction: "vertical",
|
|
2350
2544
|
style: { width: "100%" },
|
|
2351
|
-
children: l.map((e) => /* @__PURE__ */ G(
|
|
2545
|
+
children: l.map((e) => /* @__PURE__ */ G(D, {
|
|
2352
2546
|
style: {
|
|
2353
2547
|
justifyContent: "space-between",
|
|
2354
2548
|
width: "100%"
|
|
2355
2549
|
},
|
|
2356
|
-
children: [/* @__PURE__ */ G(
|
|
2550
|
+
children: [/* @__PURE__ */ G(pn, { children: [
|
|
2357
2551
|
K(e.from).format("D MMM"),
|
|
2358
2552
|
" – ",
|
|
2359
2553
|
K(e.to).format("D MMM YYYY"),
|
|
2360
2554
|
e.reason ? ` · ${e.reason}` : ""
|
|
2361
|
-
] }), /* @__PURE__ */ W(
|
|
2555
|
+
] }), /* @__PURE__ */ W(x, {
|
|
2362
2556
|
title: "Remove this leave?",
|
|
2363
2557
|
okText: "Remove",
|
|
2364
2558
|
onConfirm: () => d(String(e._id)),
|
|
@@ -2370,15 +2564,15 @@ function mn({ counsellor: e, onClose: t }) {
|
|
|
2370
2564
|
})
|
|
2371
2565
|
})]
|
|
2372
2566
|
}, String(e._id)))
|
|
2373
|
-
}) : /* @__PURE__ */ W(
|
|
2567
|
+
}) : /* @__PURE__ */ W(pn, {
|
|
2374
2568
|
type: "secondary",
|
|
2375
2569
|
children: "None."
|
|
2376
2570
|
})
|
|
2377
2571
|
]
|
|
2378
2572
|
});
|
|
2379
2573
|
}
|
|
2380
|
-
function
|
|
2381
|
-
let [t, n] = f("waiting"), [r, i] = f(""), [a, o] = f(1), [s, c] =
|
|
2574
|
+
function wn({ rows: e = [] }) {
|
|
2575
|
+
let [t, n] = f("waiting"), [r, i] = f(""), [a, o] = f(1), [s, c] = bn(() => nt({
|
|
2382
2576
|
status: t === "waiting" ? "" : t,
|
|
2383
2577
|
formId: r,
|
|
2384
2578
|
page: a,
|
|
@@ -2400,47 +2594,47 @@ function hn({ rows: e = [] }) {
|
|
|
2400
2594
|
{
|
|
2401
2595
|
title: "Received",
|
|
2402
2596
|
dataIndex: "createdAt",
|
|
2403
|
-
render:
|
|
2597
|
+
render: vn
|
|
2404
2598
|
},
|
|
2405
2599
|
{
|
|
2406
2600
|
title: "Waiting",
|
|
2407
2601
|
dataIndex: "createdAt",
|
|
2408
2602
|
key: "waited",
|
|
2409
|
-
render: (e, t) => t.status === "dead" ? "–" :
|
|
2603
|
+
render: (e, t) => t.status === "dead" ? "–" : yn(e)
|
|
2410
2604
|
},
|
|
2411
2605
|
{
|
|
2412
2606
|
title: "Status",
|
|
2413
2607
|
dataIndex: "status",
|
|
2414
|
-
render: (e, t) => e === "dead" ? /* @__PURE__ */ W(
|
|
2608
|
+
render: (e, t) => e === "dead" ? /* @__PURE__ */ W(A, {
|
|
2415
2609
|
color: "red",
|
|
2416
2610
|
children: "Assignment Failed"
|
|
2417
|
-
}) : e === "processing" ? /* @__PURE__ */ W(
|
|
2611
|
+
}) : e === "processing" ? /* @__PURE__ */ W(A, {
|
|
2418
2612
|
color: "blue",
|
|
2419
2613
|
children: "Assigning…"
|
|
2420
|
-
}) : /* @__PURE__ */ W(
|
|
2614
|
+
}) : /* @__PURE__ */ W(A, {
|
|
2421
2615
|
color: t.lastResult === "awaiting_cutoff" ? "purple" : "gold",
|
|
2422
|
-
children:
|
|
2616
|
+
children: gn[t.lastResult] ?? "Pending Assignment"
|
|
2423
2617
|
})
|
|
2424
2618
|
},
|
|
2425
2619
|
{
|
|
2426
2620
|
title: "Next try",
|
|
2427
2621
|
dataIndex: "nextAttemptAt",
|
|
2428
|
-
render: (e, t) => t.status === "dead" ? "–" :
|
|
2622
|
+
render: (e, t) => t.status === "dead" ? "–" : vn(e)
|
|
2429
2623
|
},
|
|
2430
2624
|
{
|
|
2431
2625
|
title: "Detail",
|
|
2432
2626
|
key: "detail",
|
|
2433
|
-
render: (e, t) => t.lastErrorCode || (
|
|
2627
|
+
render: (e, t) => t.lastErrorCode || (gn[t.lastResult] ? "" : t.lastResult) || "–"
|
|
2434
2628
|
}
|
|
2435
2629
|
];
|
|
2436
2630
|
return /* @__PURE__ */ G("div", {
|
|
2437
2631
|
className: "ld-queue",
|
|
2438
2632
|
children: [
|
|
2439
|
-
/* @__PURE__ */ G(
|
|
2633
|
+
/* @__PURE__ */ G(D, {
|
|
2440
2634
|
wrap: !0,
|
|
2441
2635
|
style: { marginBottom: 12 },
|
|
2442
2636
|
children: [
|
|
2443
|
-
/* @__PURE__ */ W(
|
|
2637
|
+
/* @__PURE__ */ W(oe, {
|
|
2444
2638
|
value: t,
|
|
2445
2639
|
onChange: (e) => {
|
|
2446
2640
|
n(e), o(1);
|
|
@@ -2460,7 +2654,7 @@ function hn({ rows: e = [] }) {
|
|
|
2460
2654
|
}
|
|
2461
2655
|
]
|
|
2462
2656
|
}),
|
|
2463
|
-
/* @__PURE__ */ W(
|
|
2657
|
+
/* @__PURE__ */ W(T, {
|
|
2464
2658
|
style: { minWidth: 220 },
|
|
2465
2659
|
value: r,
|
|
2466
2660
|
onChange: (e) => {
|
|
@@ -2481,15 +2675,15 @@ function hn({ rows: e = [] }) {
|
|
|
2481
2675
|
})
|
|
2482
2676
|
]
|
|
2483
2677
|
}),
|
|
2484
|
-
/* @__PURE__ */ W(
|
|
2678
|
+
/* @__PURE__ */ W(mn, {
|
|
2485
2679
|
type: "secondary",
|
|
2486
2680
|
style: { fontSize: 12 },
|
|
2487
2681
|
children: "Leads stay here safely until a counsellor can take them; nothing is lost when nobody is logged in. A lead becomes an LMS lead when it is assigned."
|
|
2488
2682
|
}),
|
|
2489
|
-
s.error ? /* @__PURE__ */ W(
|
|
2683
|
+
s.error ? /* @__PURE__ */ W(xn, {
|
|
2490
2684
|
text: s.error,
|
|
2491
2685
|
onRetry: c
|
|
2492
|
-
}) : /* @__PURE__ */ W(
|
|
2686
|
+
}) : /* @__PURE__ */ W(k, {
|
|
2493
2687
|
rowKey: (e) => String(e._id ?? e.facebookLeadId),
|
|
2494
2688
|
size: "small",
|
|
2495
2689
|
loading: s.loading,
|
|
@@ -2503,12 +2697,12 @@ function hn({ rows: e = [] }) {
|
|
|
2503
2697
|
onChange: o,
|
|
2504
2698
|
showSizeChanger: !1
|
|
2505
2699
|
},
|
|
2506
|
-
locale: { emptyText: /* @__PURE__ */ W(
|
|
2700
|
+
locale: { emptyText: /* @__PURE__ */ W(v, { description: t === "failed" ? "No failed leads." : "No leads are waiting." }) }
|
|
2507
2701
|
})
|
|
2508
2702
|
]
|
|
2509
2703
|
});
|
|
2510
2704
|
}
|
|
2511
|
-
var
|
|
2705
|
+
var Tn = [
|
|
2512
2706
|
{
|
|
2513
2707
|
value: "report",
|
|
2514
2708
|
label: "Report"
|
|
@@ -2521,12 +2715,12 @@ var gn = [
|
|
|
2521
2715
|
value: "assignments",
|
|
2522
2716
|
label: "Assignments"
|
|
2523
2717
|
}
|
|
2524
|
-
],
|
|
2718
|
+
], En = (e) => e ? {
|
|
2525
2719
|
from: e[0].format("YYYY-MM-DD"),
|
|
2526
2720
|
to: e[1].format("YYYY-MM-DD")
|
|
2527
2721
|
} : {};
|
|
2528
|
-
function
|
|
2529
|
-
let [e, t] = f("report"), [n, r] = f(""), [i, o] = f(null), [s, c] =
|
|
2722
|
+
function Dn() {
|
|
2723
|
+
let [e, t] = f("report"), [n, r] = f(""), [i, o] = f(null), [s, c] = bn(() => a(En(i)), [i]), l = (Array.isArray(s.data?.rows) ? s.data.rows : []).map((e) => ({
|
|
2530
2724
|
value: String(e.legacyUserId),
|
|
2531
2725
|
label: e.name
|
|
2532
2726
|
}));
|
|
@@ -2535,13 +2729,13 @@ function vn() {
|
|
|
2535
2729
|
children: [
|
|
2536
2730
|
/* @__PURE__ */ G("div", {
|
|
2537
2731
|
className: "ld-toolbar",
|
|
2538
|
-
children: [/* @__PURE__ */ W(
|
|
2732
|
+
children: [/* @__PURE__ */ W(oe, {
|
|
2539
2733
|
value: e,
|
|
2540
2734
|
onChange: t,
|
|
2541
|
-
options:
|
|
2542
|
-
}), e === "assignments" ? null : /* @__PURE__ */ G(
|
|
2735
|
+
options: Tn
|
|
2736
|
+
}), e === "assignments" ? null : /* @__PURE__ */ G(D, {
|
|
2543
2737
|
wrap: !0,
|
|
2544
|
-
children: [/* @__PURE__ */ W(
|
|
2738
|
+
children: [/* @__PURE__ */ W(T, {
|
|
2545
2739
|
style: { minWidth: 200 },
|
|
2546
2740
|
value: n,
|
|
2547
2741
|
onChange: r,
|
|
@@ -2552,7 +2746,7 @@ function vn() {
|
|
|
2552
2746
|
}, ...l],
|
|
2553
2747
|
showSearch: !0,
|
|
2554
2748
|
optionFilterProp: "label"
|
|
2555
|
-
}), /* @__PURE__ */ W(
|
|
2749
|
+
}), /* @__PURE__ */ W(ne.RangePicker, {
|
|
2556
2750
|
value: i,
|
|
2557
2751
|
onChange: o,
|
|
2558
2752
|
allowEmpty: [!1, !1],
|
|
@@ -2560,20 +2754,20 @@ function vn() {
|
|
|
2560
2754
|
})]
|
|
2561
2755
|
})]
|
|
2562
2756
|
}),
|
|
2563
|
-
e === "report" ? /* @__PURE__ */ W(
|
|
2757
|
+
e === "report" ? /* @__PURE__ */ W(On, {
|
|
2564
2758
|
state: s,
|
|
2565
2759
|
reload: c,
|
|
2566
2760
|
counsellor: n
|
|
2567
2761
|
}) : null,
|
|
2568
|
-
e === "log" ? /* @__PURE__ */ W(
|
|
2762
|
+
e === "log" ? /* @__PURE__ */ W(kn, {
|
|
2569
2763
|
counsellor: n,
|
|
2570
2764
|
range: i
|
|
2571
|
-
}, `${n}|${JSON.stringify(
|
|
2572
|
-
e === "assignments" ? /* @__PURE__ */ W(
|
|
2765
|
+
}, `${n}|${JSON.stringify(En(i))}`) : null,
|
|
2766
|
+
e === "assignments" ? /* @__PURE__ */ W(An, {}) : null
|
|
2573
2767
|
]
|
|
2574
2768
|
});
|
|
2575
2769
|
}
|
|
2576
|
-
function
|
|
2770
|
+
function On({ state: e, reload: t, counsellor: n }) {
|
|
2577
2771
|
let r = Array.isArray(e.data?.rows) ? e.data.rows : [], i = n ? r.filter((e) => String(e.legacyUserId) === n) : r, a = n ? {
|
|
2578
2772
|
...e.data?.summary,
|
|
2579
2773
|
counsellors: i.length,
|
|
@@ -2583,7 +2777,7 @@ function yn({ state: e, reload: t, counsellor: n }) {
|
|
|
2583
2777
|
{
|
|
2584
2778
|
title: "Counsellor",
|
|
2585
2779
|
dataIndex: "name",
|
|
2586
|
-
render: (e) => /* @__PURE__ */ W(
|
|
2780
|
+
render: (e) => /* @__PURE__ */ W(pn, {
|
|
2587
2781
|
strong: !0,
|
|
2588
2782
|
children: e
|
|
2589
2783
|
}),
|
|
@@ -2600,7 +2794,7 @@ function yn({ state: e, reload: t, counsellor: n }) {
|
|
|
2600
2794
|
children: [/* @__PURE__ */ W("span", {
|
|
2601
2795
|
className: "ld-num",
|
|
2602
2796
|
children: e ?? 0
|
|
2603
|
-
}), /* @__PURE__ */ W(
|
|
2797
|
+
}), /* @__PURE__ */ W(S, {
|
|
2604
2798
|
percent: Math.round((e ?? 0) / o * 100),
|
|
2605
2799
|
size: "small",
|
|
2606
2800
|
showInfo: !1,
|
|
@@ -2613,7 +2807,7 @@ function yn({ state: e, reload: t, counsellor: n }) {
|
|
|
2613
2807
|
dataIndex: "resets",
|
|
2614
2808
|
align: "right",
|
|
2615
2809
|
sorter: (e, t) => e.resets - t.resets,
|
|
2616
|
-
render: (e) => e ? /* @__PURE__ */ W(
|
|
2810
|
+
render: (e) => e ? /* @__PURE__ */ W(an, {
|
|
2617
2811
|
tone: "green",
|
|
2618
2812
|
icon: /* @__PURE__ */ W(z, {}),
|
|
2619
2813
|
children: e
|
|
@@ -2627,7 +2821,7 @@ function yn({ state: e, reload: t, counsellor: n }) {
|
|
|
2627
2821
|
dataIndex: "timesCapped",
|
|
2628
2822
|
align: "right",
|
|
2629
2823
|
sorter: (e, t) => e.timesCapped - t.timesCapped,
|
|
2630
|
-
render: (e) => e ? /* @__PURE__ */ W(
|
|
2824
|
+
render: (e) => e ? /* @__PURE__ */ W(an, {
|
|
2631
2825
|
tone: "amber",
|
|
2632
2826
|
children: e
|
|
2633
2827
|
}) : /* @__PURE__ */ W("span", {
|
|
@@ -2638,24 +2832,24 @@ function yn({ state: e, reload: t, counsellor: n }) {
|
|
|
2638
2832
|
{
|
|
2639
2833
|
title: "Last reset",
|
|
2640
2834
|
dataIndex: "lastResetAt",
|
|
2641
|
-
render: (e) => e ?
|
|
2835
|
+
render: (e) => e ? vn(e) : "Never"
|
|
2642
2836
|
},
|
|
2643
2837
|
{
|
|
2644
2838
|
title: "First lead",
|
|
2645
2839
|
dataIndex: "firstAssignedAt",
|
|
2646
|
-
render:
|
|
2840
|
+
render: vn
|
|
2647
2841
|
},
|
|
2648
2842
|
{
|
|
2649
2843
|
title: "Last lead",
|
|
2650
2844
|
dataIndex: "lastAssignedAt",
|
|
2651
|
-
render:
|
|
2845
|
+
render: vn
|
|
2652
2846
|
}
|
|
2653
2847
|
];
|
|
2654
|
-
return e.error ? /* @__PURE__ */ W(
|
|
2848
|
+
return e.error ? /* @__PURE__ */ W(xn, {
|
|
2655
2849
|
text: e.error,
|
|
2656
2850
|
onRetry: t
|
|
2657
2851
|
}) : /* @__PURE__ */ G(U, { children: [
|
|
2658
|
-
/* @__PURE__ */ W(
|
|
2852
|
+
/* @__PURE__ */ W(rn, { items: [
|
|
2659
2853
|
{
|
|
2660
2854
|
key: "people",
|
|
2661
2855
|
label: "Counsellors",
|
|
@@ -2686,12 +2880,12 @@ function yn({ state: e, reload: t, counsellor: n }) {
|
|
|
2686
2880
|
icon: /* @__PURE__ */ W(F, {})
|
|
2687
2881
|
}
|
|
2688
2882
|
] }),
|
|
2689
|
-
/* @__PURE__ */ W(
|
|
2883
|
+
/* @__PURE__ */ W(mn, {
|
|
2690
2884
|
type: "secondary",
|
|
2691
2885
|
style: { fontSize: 12 },
|
|
2692
2886
|
children: "Leads received count every automatic assignment in equal daily mode. A reset is when a counsellor who reached the open-lead limit worked enough leads for their quota to refill."
|
|
2693
2887
|
}),
|
|
2694
|
-
/* @__PURE__ */ W(
|
|
2888
|
+
/* @__PURE__ */ W(k, {
|
|
2695
2889
|
rowKey: "legacyUserId",
|
|
2696
2890
|
size: "small",
|
|
2697
2891
|
loading: e.loading,
|
|
@@ -2699,17 +2893,17 @@ function yn({ state: e, reload: t, counsellor: n }) {
|
|
|
2699
2893
|
dataSource: i,
|
|
2700
2894
|
pagination: !1,
|
|
2701
2895
|
scroll: { x: "max-content" },
|
|
2702
|
-
locale: { emptyText: /* @__PURE__ */ W(
|
|
2896
|
+
locale: { emptyText: /* @__PURE__ */ W(v, { description: "Nothing recorded for these filters yet." }) }
|
|
2703
2897
|
})
|
|
2704
2898
|
] });
|
|
2705
2899
|
}
|
|
2706
|
-
function
|
|
2707
|
-
let [n, r] = f(""), [i, a] = f(1), [s, c] =
|
|
2900
|
+
function kn({ counsellor: e, range: t }) {
|
|
2901
|
+
let [n, r] = f(""), [i, a] = f(1), [s, c] = bn(() => o({
|
|
2708
2902
|
legacyUserId: e,
|
|
2709
2903
|
event: n,
|
|
2710
2904
|
page: i,
|
|
2711
2905
|
limit: 25,
|
|
2712
|
-
...
|
|
2906
|
+
...En(t)
|
|
2713
2907
|
}), [
|
|
2714
2908
|
e,
|
|
2715
2909
|
t,
|
|
@@ -2719,7 +2913,7 @@ function bn({ counsellor: e, range: t }) {
|
|
|
2719
2913
|
{
|
|
2720
2914
|
title: "When",
|
|
2721
2915
|
dataIndex: "at",
|
|
2722
|
-
render:
|
|
2916
|
+
render: vn
|
|
2723
2917
|
},
|
|
2724
2918
|
{
|
|
2725
2919
|
title: "Counsellor",
|
|
@@ -2729,21 +2923,21 @@ function bn({ counsellor: e, range: t }) {
|
|
|
2729
2923
|
{
|
|
2730
2924
|
title: "Event",
|
|
2731
2925
|
dataIndex: "event",
|
|
2732
|
-
render: (e) => /* @__PURE__ */ W(
|
|
2733
|
-
tone:
|
|
2734
|
-
children:
|
|
2926
|
+
render: (e) => /* @__PURE__ */ W(an, {
|
|
2927
|
+
tone: dn[e]?.tone ?? "grey",
|
|
2928
|
+
children: dn[e]?.label ?? e
|
|
2735
2929
|
})
|
|
2736
2930
|
},
|
|
2737
2931
|
{
|
|
2738
2932
|
title: "Detail",
|
|
2739
2933
|
key: "detail",
|
|
2740
|
-
render: (e, t) =>
|
|
2934
|
+
render: (e, t) => fn(t)
|
|
2741
2935
|
}
|
|
2742
2936
|
];
|
|
2743
|
-
return /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ G(
|
|
2937
|
+
return /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ G(D, {
|
|
2744
2938
|
wrap: !0,
|
|
2745
2939
|
style: { marginBottom: 12 },
|
|
2746
|
-
children: [/* @__PURE__ */ W(
|
|
2940
|
+
children: [/* @__PURE__ */ W(oe, {
|
|
2747
2941
|
value: n,
|
|
2748
2942
|
onChange: (e) => {
|
|
2749
2943
|
r(e), a(1);
|
|
@@ -2751,7 +2945,7 @@ function bn({ counsellor: e, range: t }) {
|
|
|
2751
2945
|
options: [{
|
|
2752
2946
|
value: "",
|
|
2753
2947
|
label: "All events"
|
|
2754
|
-
}, ...Object.entries(
|
|
2948
|
+
}, ...Object.entries(dn).map(([e, t]) => ({
|
|
2755
2949
|
value: e,
|
|
2756
2950
|
label: t.label
|
|
2757
2951
|
}))]
|
|
@@ -2760,10 +2954,10 @@ function bn({ counsellor: e, range: t }) {
|
|
|
2760
2954
|
onClick: c,
|
|
2761
2955
|
children: "Refresh"
|
|
2762
2956
|
})]
|
|
2763
|
-
}), s.error ? /* @__PURE__ */ W(
|
|
2957
|
+
}), s.error ? /* @__PURE__ */ W(xn, {
|
|
2764
2958
|
text: s.error,
|
|
2765
2959
|
onRetry: c
|
|
2766
|
-
}) : /* @__PURE__ */ W(
|
|
2960
|
+
}) : /* @__PURE__ */ W(k, {
|
|
2767
2961
|
rowKey: (e) => String(e._id),
|
|
2768
2962
|
size: "small",
|
|
2769
2963
|
loading: s.loading,
|
|
@@ -2777,11 +2971,11 @@ function bn({ counsellor: e, range: t }) {
|
|
|
2777
2971
|
onChange: a,
|
|
2778
2972
|
showSizeChanger: !1
|
|
2779
2973
|
},
|
|
2780
|
-
locale: { emptyText: /* @__PURE__ */ W(
|
|
2974
|
+
locale: { emptyText: /* @__PURE__ */ W(v, { description: "No events for these filters yet." }) }
|
|
2781
2975
|
})] });
|
|
2782
2976
|
}
|
|
2783
|
-
function
|
|
2784
|
-
let [e, t] = f(K()), [n, r] = f(1), [i, a] =
|
|
2977
|
+
function An() {
|
|
2978
|
+
let [e, t] = f(K()), [n, r] = f(1), [i, a] = bn(() => rt({
|
|
2785
2979
|
date: e ? e.format("YYYY-MM-DD") : "",
|
|
2786
2980
|
page: n,
|
|
2787
2981
|
limit: 25
|
|
@@ -2797,12 +2991,12 @@ function xn() {
|
|
|
2797
2991
|
{
|
|
2798
2992
|
title: "Received",
|
|
2799
2993
|
dataIndex: "receivedAt",
|
|
2800
|
-
render:
|
|
2994
|
+
render: vn
|
|
2801
2995
|
},
|
|
2802
2996
|
{
|
|
2803
2997
|
title: "Assigned",
|
|
2804
2998
|
dataIndex: "assignedAt",
|
|
2805
|
-
render:
|
|
2999
|
+
render: vn
|
|
2806
3000
|
},
|
|
2807
3001
|
{
|
|
2808
3002
|
title: "Counsellor",
|
|
@@ -2816,19 +3010,19 @@ function xn() {
|
|
|
2816
3010
|
{
|
|
2817
3011
|
title: "Skipped",
|
|
2818
3012
|
dataIndex: "skipped",
|
|
2819
|
-
render: (e) => Array.isArray(e) && e.length ? /* @__PURE__ */ W(
|
|
2820
|
-
title: e.map((e) => `${e.name || `#${e.legacyUserId}`}: ${
|
|
2821
|
-
children: /* @__PURE__ */ G(
|
|
3013
|
+
render: (e) => Array.isArray(e) && e.length ? /* @__PURE__ */ W(M, {
|
|
3014
|
+
title: e.map((e) => `${e.name || `#${e.legacyUserId}`}: ${hn[e.reason]?.label ?? e.reason}`).join("\n"),
|
|
3015
|
+
children: /* @__PURE__ */ G(A, { children: [e.length, " skipped"] })
|
|
2822
3016
|
}) : "–"
|
|
2823
3017
|
}
|
|
2824
3018
|
];
|
|
2825
3019
|
return /* @__PURE__ */ G("div", {
|
|
2826
3020
|
className: "ld-assignments",
|
|
2827
3021
|
children: [
|
|
2828
|
-
/* @__PURE__ */ G(
|
|
3022
|
+
/* @__PURE__ */ G(D, {
|
|
2829
3023
|
wrap: !0,
|
|
2830
3024
|
style: { marginBottom: 12 },
|
|
2831
|
-
children: [/* @__PURE__ */ W(
|
|
3025
|
+
children: [/* @__PURE__ */ W(ne, {
|
|
2832
3026
|
value: e,
|
|
2833
3027
|
onChange: (e) => {
|
|
2834
3028
|
t(e), r(1);
|
|
@@ -2841,15 +3035,15 @@ function xn() {
|
|
|
2841
3035
|
children: "Refresh"
|
|
2842
3036
|
})]
|
|
2843
3037
|
}),
|
|
2844
|
-
/* @__PURE__ */ W(
|
|
3038
|
+
/* @__PURE__ */ W(mn, {
|
|
2845
3039
|
type: "secondary",
|
|
2846
3040
|
style: { fontSize: 12 },
|
|
2847
3041
|
children: "Every automatic assignment in equal daily mode. Manual reassignments are in the Reassign leads tab and History."
|
|
2848
3042
|
}),
|
|
2849
|
-
i.error ? /* @__PURE__ */ W(
|
|
3043
|
+
i.error ? /* @__PURE__ */ W(xn, {
|
|
2850
3044
|
text: i.error,
|
|
2851
3045
|
onRetry: a
|
|
2852
|
-
}) : /* @__PURE__ */ W(
|
|
3046
|
+
}) : /* @__PURE__ */ W(k, {
|
|
2853
3047
|
rowKey: (e) => String(e._id),
|
|
2854
3048
|
size: "small",
|
|
2855
3049
|
loading: i.loading,
|
|
@@ -2863,12 +3057,12 @@ function xn() {
|
|
|
2863
3057
|
onChange: r,
|
|
2864
3058
|
showSizeChanger: !1
|
|
2865
3059
|
},
|
|
2866
|
-
locale: { emptyText: /* @__PURE__ */ W(
|
|
3060
|
+
locale: { emptyText: /* @__PURE__ */ W(v, { description: "No assignments for this day yet." }) }
|
|
2867
3061
|
})
|
|
2868
3062
|
]
|
|
2869
3063
|
});
|
|
2870
3064
|
}
|
|
2871
|
-
var
|
|
3065
|
+
var jn = [
|
|
2872
3066
|
"Asia/Kolkata",
|
|
2873
3067
|
"Asia/Dubai",
|
|
2874
3068
|
"Asia/Singapore",
|
|
@@ -2876,8 +3070,8 @@ var Sn = [
|
|
|
2876
3070
|
"America/New_York",
|
|
2877
3071
|
"UTC"
|
|
2878
3072
|
];
|
|
2879
|
-
function
|
|
2880
|
-
let [t] =
|
|
3073
|
+
function Mn({ canEdit: e = !1 }) {
|
|
3074
|
+
let [t] = y.useForm(), [n, r] = bn(() => Xe(), []), [i, a] = f(!1), o = n.data?.settings;
|
|
2881
3075
|
c(() => {
|
|
2882
3076
|
o && t.setFieldsValue({
|
|
2883
3077
|
openLeadCap: 15,
|
|
@@ -2889,21 +3083,21 @@ function Cn({ canEdit: e = !1 }) {
|
|
|
2889
3083
|
resetTime: K(o.resetTime, "HH:mm")
|
|
2890
3084
|
});
|
|
2891
3085
|
}, [o, t]);
|
|
2892
|
-
let s =
|
|
3086
|
+
let s = y.useWatch("mode", t), l = y.useWatch("openLeadCap", t), u = y.useWatch("refillAtRatio", t), d = async () => {
|
|
2893
3087
|
let e = await t.validateFields(), n = {
|
|
2894
3088
|
...e,
|
|
2895
3089
|
startTime: e.startTime.format("HH:mm"),
|
|
2896
3090
|
cutoffTime: e.cutoffTime.format("HH:mm"),
|
|
2897
3091
|
resetTime: e.resetTime.format("HH:mm")
|
|
2898
3092
|
};
|
|
2899
|
-
|
|
3093
|
+
ae.confirm({
|
|
2900
3094
|
title: "Save distribution settings?",
|
|
2901
3095
|
content: n.mode === "equal_daily" ? "New leads will go to the online counsellor with the fewest leads today. Leads already assigned do not move." : "New leads will go back to plain round-robin.",
|
|
2902
3096
|
okText: "Save",
|
|
2903
3097
|
onOk: async () => {
|
|
2904
3098
|
a(!0);
|
|
2905
3099
|
try {
|
|
2906
|
-
await
|
|
3100
|
+
await Ze(n), N.success("Distribution settings saved"), r();
|
|
2907
3101
|
} catch (e) {
|
|
2908
3102
|
N.error(Q(e));
|
|
2909
3103
|
} finally {
|
|
@@ -2912,13 +3106,13 @@ function Cn({ canEdit: e = !1 }) {
|
|
|
2912
3106
|
}
|
|
2913
3107
|
});
|
|
2914
3108
|
};
|
|
2915
|
-
if (n.loading && !n.data) return /* @__PURE__ */ W(
|
|
2916
|
-
if (n.error) return /* @__PURE__ */ W(
|
|
3109
|
+
if (n.loading && !n.data) return /* @__PURE__ */ W(E, { active: !0 });
|
|
3110
|
+
if (n.error) return /* @__PURE__ */ W(xn, {
|
|
2917
3111
|
text: n.error,
|
|
2918
3112
|
onRetry: r
|
|
2919
3113
|
});
|
|
2920
|
-
let p =
|
|
2921
|
-
return /* @__PURE__ */ G(
|
|
3114
|
+
let p = sn(l, u);
|
|
3115
|
+
return /* @__PURE__ */ G(y, {
|
|
2922
3116
|
form: t,
|
|
2923
3117
|
layout: "vertical",
|
|
2924
3118
|
disabled: !e,
|
|
@@ -2932,18 +3126,18 @@ function Cn({ canEdit: e = !1 }) {
|
|
|
2932
3126
|
className: "ld-card__title",
|
|
2933
3127
|
children: [/* @__PURE__ */ W(ye, {}), " Who gets leads"]
|
|
2934
3128
|
}),
|
|
2935
|
-
/* @__PURE__ */ W(
|
|
3129
|
+
/* @__PURE__ */ W(y.Item, {
|
|
2936
3130
|
name: "mode",
|
|
2937
3131
|
label: "Only give leads to counsellors who are logged in",
|
|
2938
3132
|
valuePropName: "checked",
|
|
2939
3133
|
getValueProps: (e) => ({ checked: e === "equal_daily" }),
|
|
2940
3134
|
normalize: (e) => e ? "equal_daily" : "round_robin",
|
|
2941
|
-
children: /* @__PURE__ */ W(
|
|
3135
|
+
children: /* @__PURE__ */ W(O, {
|
|
2942
3136
|
checkedChildren: "On",
|
|
2943
3137
|
unCheckedChildren: "Off"
|
|
2944
3138
|
})
|
|
2945
3139
|
}),
|
|
2946
|
-
/* @__PURE__ */ W(
|
|
3140
|
+
/* @__PURE__ */ W(mn, {
|
|
2947
3141
|
type: "secondary",
|
|
2948
3142
|
style: { marginBottom: 0 },
|
|
2949
3143
|
children: s === "equal_daily" ? "Only counsellors who are logged in right now, enabled, not on leave and under the open-lead limit get leads. Each lead goes to the one with the fewest leads today; equal counts take turns (round robin). A lead nobody can take waits and is offered again every 2 minutes." : "Off: round robin as before. Leads take turns through each form's counsellor list, skipping only inactive users. Login, leave and the open-lead limit are not checked, and nothing waits for a login."
|
|
@@ -2959,13 +3153,13 @@ function Cn({ canEdit: e = !1 }) {
|
|
|
2959
3153
|
children: [
|
|
2960
3154
|
/* @__PURE__ */ W(H, {}),
|
|
2961
3155
|
" ",
|
|
2962
|
-
/* @__PURE__ */ W(
|
|
3156
|
+
/* @__PURE__ */ W(pn, {
|
|
2963
3157
|
strong: !0,
|
|
2964
3158
|
children: "Open-lead limit"
|
|
2965
3159
|
})
|
|
2966
3160
|
]
|
|
2967
3161
|
}),
|
|
2968
|
-
/* @__PURE__ */ W(
|
|
3162
|
+
/* @__PURE__ */ W(mn, {
|
|
2969
3163
|
type: "secondary",
|
|
2970
3164
|
style: {
|
|
2971
3165
|
margin: "4px 0 12px",
|
|
@@ -2973,17 +3167,17 @@ function Cn({ canEdit: e = !1 }) {
|
|
|
2973
3167
|
},
|
|
2974
3168
|
children: "A counsellor who has this many untouched leads gets no new lead until they work some (a call, a follow-up, a status change or a save). Their leads are never moved. 0 = no limit."
|
|
2975
3169
|
}),
|
|
2976
|
-
/* @__PURE__ */ G(
|
|
3170
|
+
/* @__PURE__ */ G(w, {
|
|
2977
3171
|
gutter: 12,
|
|
2978
3172
|
children: [
|
|
2979
3173
|
/* @__PURE__ */ W(g, {
|
|
2980
3174
|
xs: 24,
|
|
2981
3175
|
md: 8,
|
|
2982
|
-
children: /* @__PURE__ */ W(
|
|
3176
|
+
children: /* @__PURE__ */ W(y.Item, {
|
|
2983
3177
|
name: "openLeadCap",
|
|
2984
3178
|
label: "Untouched leads per counsellor",
|
|
2985
3179
|
rules: [{ required: !0 }],
|
|
2986
|
-
children: /* @__PURE__ */ W(
|
|
3180
|
+
children: /* @__PURE__ */ W(b, {
|
|
2987
3181
|
min: 0,
|
|
2988
3182
|
max: 500,
|
|
2989
3183
|
addonAfter: "leads",
|
|
@@ -2994,16 +3188,16 @@ function Cn({ canEdit: e = !1 }) {
|
|
|
2994
3188
|
/* @__PURE__ */ W(g, {
|
|
2995
3189
|
xs: 24,
|
|
2996
3190
|
md: 8,
|
|
2997
|
-
children: /* @__PURE__ */ W(
|
|
3191
|
+
children: /* @__PURE__ */ W(y.Item, {
|
|
2998
3192
|
name: "refillAtRatio",
|
|
2999
3193
|
label: "Refill when untouched falls to",
|
|
3000
3194
|
rules: [{
|
|
3001
3195
|
required: !0,
|
|
3002
3196
|
message: "Enter 0 to 100"
|
|
3003
3197
|
}],
|
|
3004
|
-
getValueProps: (e) => ({ value:
|
|
3005
|
-
normalize:
|
|
3006
|
-
children: /* @__PURE__ */ W(
|
|
3198
|
+
getValueProps: (e) => ({ value: cn(e) }),
|
|
3199
|
+
normalize: ln,
|
|
3200
|
+
children: /* @__PURE__ */ W(b, {
|
|
3007
3201
|
min: 0,
|
|
3008
3202
|
max: 100,
|
|
3009
3203
|
step: 5,
|
|
@@ -3016,11 +3210,11 @@ function Cn({ canEdit: e = !1 }) {
|
|
|
3016
3210
|
/* @__PURE__ */ W(g, {
|
|
3017
3211
|
xs: 24,
|
|
3018
3212
|
md: 8,
|
|
3019
|
-
children: /* @__PURE__ */ W(
|
|
3213
|
+
children: /* @__PURE__ */ W(y.Item, {
|
|
3020
3214
|
name: "capWindowDays",
|
|
3021
3215
|
label: "Count untouched leads from",
|
|
3022
3216
|
rules: [{ required: !0 }],
|
|
3023
|
-
children: /* @__PURE__ */ W(
|
|
3217
|
+
children: /* @__PURE__ */ W(T, { options: [
|
|
3024
3218
|
{
|
|
3025
3219
|
value: 0,
|
|
3026
3220
|
label: "Today"
|
|
@@ -3068,17 +3262,17 @@ function Cn({ canEdit: e = !1 }) {
|
|
|
3068
3262
|
children: [/* @__PURE__ */ G("div", {
|
|
3069
3263
|
className: "ld-card__title",
|
|
3070
3264
|
children: [/* @__PURE__ */ W(F, {}), " Daily timing"]
|
|
3071
|
-
}), /* @__PURE__ */ G(
|
|
3265
|
+
}), /* @__PURE__ */ G(w, {
|
|
3072
3266
|
gutter: 12,
|
|
3073
3267
|
children: [
|
|
3074
3268
|
/* @__PURE__ */ W(g, {
|
|
3075
3269
|
xs: 12,
|
|
3076
3270
|
md: 6,
|
|
3077
|
-
children: /* @__PURE__ */ W(
|
|
3271
|
+
children: /* @__PURE__ */ W(y.Item, {
|
|
3078
3272
|
name: "startTime",
|
|
3079
3273
|
label: "Day starts",
|
|
3080
3274
|
rules: [{ required: !0 }],
|
|
3081
|
-
children: /* @__PURE__ */ W(
|
|
3275
|
+
children: /* @__PURE__ */ W(j, {
|
|
3082
3276
|
format: "HH:mm",
|
|
3083
3277
|
minuteStep: 5,
|
|
3084
3278
|
style: { width: "100%" }
|
|
@@ -3088,12 +3282,12 @@ function Cn({ canEdit: e = !1 }) {
|
|
|
3088
3282
|
/* @__PURE__ */ W(g, {
|
|
3089
3283
|
xs: 12,
|
|
3090
3284
|
md: 6,
|
|
3091
|
-
children: /* @__PURE__ */ W(
|
|
3285
|
+
children: /* @__PURE__ */ W(y.Item, {
|
|
3092
3286
|
name: "cutoffTime",
|
|
3093
3287
|
label: "Initial cut-off",
|
|
3094
3288
|
rules: [{ required: !0 }],
|
|
3095
3289
|
extra: "Morning leads wait until this time.",
|
|
3096
|
-
children: /* @__PURE__ */ W(
|
|
3290
|
+
children: /* @__PURE__ */ W(j, {
|
|
3097
3291
|
format: "HH:mm",
|
|
3098
3292
|
minuteStep: 5,
|
|
3099
3293
|
style: { width: "100%" }
|
|
@@ -3103,11 +3297,11 @@ function Cn({ canEdit: e = !1 }) {
|
|
|
3103
3297
|
/* @__PURE__ */ W(g, {
|
|
3104
3298
|
xs: 12,
|
|
3105
3299
|
md: 6,
|
|
3106
|
-
children: /* @__PURE__ */ W(
|
|
3300
|
+
children: /* @__PURE__ */ W(y.Item, {
|
|
3107
3301
|
name: "resetTime",
|
|
3108
3302
|
label: "Daily reset",
|
|
3109
3303
|
rules: [{ required: !0 }],
|
|
3110
|
-
children: /* @__PURE__ */ W(
|
|
3304
|
+
children: /* @__PURE__ */ W(j, {
|
|
3111
3305
|
format: "HH:mm",
|
|
3112
3306
|
minuteStep: 5,
|
|
3113
3307
|
style: { width: "100%" }
|
|
@@ -3117,11 +3311,11 @@ function Cn({ canEdit: e = !1 }) {
|
|
|
3117
3311
|
/* @__PURE__ */ W(g, {
|
|
3118
3312
|
xs: 12,
|
|
3119
3313
|
md: 6,
|
|
3120
|
-
children: /* @__PURE__ */ W(
|
|
3314
|
+
children: /* @__PURE__ */ W(y.Item, {
|
|
3121
3315
|
name: "timezone",
|
|
3122
3316
|
label: "Time zone",
|
|
3123
3317
|
rules: [{ required: !0 }],
|
|
3124
|
-
children: /* @__PURE__ */ W(
|
|
3318
|
+
children: /* @__PURE__ */ W(T, { options: jn.map((e) => ({
|
|
3125
3319
|
value: e,
|
|
3126
3320
|
label: e
|
|
3127
3321
|
})) })
|
|
@@ -3130,22 +3324,22 @@ function Cn({ canEdit: e = !1 }) {
|
|
|
3130
3324
|
/* @__PURE__ */ W(g, {
|
|
3131
3325
|
xs: 24,
|
|
3132
3326
|
md: 12,
|
|
3133
|
-
children: /* @__PURE__ */ W(
|
|
3327
|
+
children: /* @__PURE__ */ W(y.Item, {
|
|
3134
3328
|
name: "holdUntilCutoff",
|
|
3135
3329
|
label: "Hold morning leads until the cut-off",
|
|
3136
3330
|
valuePropName: "checked",
|
|
3137
3331
|
extra: "Off (recommended): leads go to whoever is online as they arrive; the open-lead limit spreads the morning backlog.",
|
|
3138
|
-
children: /* @__PURE__ */ W(
|
|
3332
|
+
children: /* @__PURE__ */ W(O, {})
|
|
3139
3333
|
})
|
|
3140
3334
|
}),
|
|
3141
3335
|
/* @__PURE__ */ W(g, {
|
|
3142
3336
|
xs: 24,
|
|
3143
3337
|
md: 12,
|
|
3144
|
-
children: /* @__PURE__ */ W(
|
|
3338
|
+
children: /* @__PURE__ */ W(y.Item, {
|
|
3145
3339
|
name: "onlineWindowMinutes",
|
|
3146
3340
|
label: "Offline after no activity for",
|
|
3147
3341
|
rules: [{ required: !0 }],
|
|
3148
|
-
children: /* @__PURE__ */ W(
|
|
3342
|
+
children: /* @__PURE__ */ W(b, {
|
|
3149
3343
|
min: 2,
|
|
3150
3344
|
max: 120,
|
|
3151
3345
|
addonAfter: "minutes",
|
|
@@ -3164,7 +3358,7 @@ function Cn({ canEdit: e = !1 }) {
|
|
|
3164
3358
|
loading: i,
|
|
3165
3359
|
onClick: d,
|
|
3166
3360
|
children: "Save settings"
|
|
3167
|
-
}) : /* @__PURE__ */ W(
|
|
3361
|
+
}) : /* @__PURE__ */ W(pn, {
|
|
3168
3362
|
type: "secondary",
|
|
3169
3363
|
children: "Only users who can edit lead mapping can change these settings."
|
|
3170
3364
|
})
|
|
@@ -3174,51 +3368,51 @@ function Cn({ canEdit: e = !1 }) {
|
|
|
3174
3368
|
}
|
|
3175
3369
|
//#endregion
|
|
3176
3370
|
//#region src/pages/Modules/Admin/FacebookCourseMappingsSection.jsx
|
|
3177
|
-
var
|
|
3178
|
-
function
|
|
3371
|
+
var Nn = /* @__PURE__ */ e({ default: () => Kn }), { Text: Pn, Title: Fn } = ce, In = 10, Ln = "—", Rn = "You don't have permission to do this.", zn = "This could not be loaded. Press Try again first.";
|
|
3372
|
+
function Bn(e, t) {
|
|
3179
3373
|
return Array.isArray(e) ? e : Array.isArray(e?.[t]) ? e[t] : [];
|
|
3180
3374
|
}
|
|
3181
|
-
var
|
|
3375
|
+
var Vn = {
|
|
3182
3376
|
forms: {
|
|
3183
3377
|
load: X,
|
|
3184
|
-
read: (e) =>
|
|
3378
|
+
read: (e) => Bn(e, "forms"),
|
|
3185
3379
|
label: "Facebook forms"
|
|
3186
3380
|
},
|
|
3187
3381
|
courses: {
|
|
3188
3382
|
load: Ce,
|
|
3189
|
-
read: (e) =>
|
|
3383
|
+
read: (e) => Bn(e, "courses"),
|
|
3190
3384
|
label: "courses"
|
|
3191
3385
|
},
|
|
3192
3386
|
mappings: {
|
|
3193
3387
|
load: we,
|
|
3194
|
-
read: (e) =>
|
|
3388
|
+
read: (e) => Bn(e, "mappings"),
|
|
3195
3389
|
label: "chosen courses"
|
|
3196
3390
|
},
|
|
3197
3391
|
distributions: {
|
|
3198
3392
|
load: Me,
|
|
3199
|
-
read: (e) =>
|
|
3393
|
+
read: (e) => Bn(e, "distributions"),
|
|
3200
3394
|
label: "counsellor lists"
|
|
3201
3395
|
},
|
|
3202
3396
|
counsellors: {
|
|
3203
3397
|
load: Ne,
|
|
3204
|
-
read: (e) =>
|
|
3398
|
+
read: (e) => Bn(e, "counsellors"),
|
|
3205
3399
|
label: "active counsellors"
|
|
3206
3400
|
}
|
|
3207
|
-
},
|
|
3401
|
+
}, Hn = Object.keys(Vn), Un = Object.fromEntries(Hn.map((e) => [e, []])), Wn = Object.fromEntries(Hn.map((e) => [e, {
|
|
3208
3402
|
loaded: !1,
|
|
3209
3403
|
ok: !1,
|
|
3210
3404
|
error: ""
|
|
3211
3405
|
}]));
|
|
3212
|
-
function
|
|
3406
|
+
function Gn({ distribution: e }) {
|
|
3213
3407
|
let t = e?.counsellors || [];
|
|
3214
|
-
if (!t.length) return /* @__PURE__ */ W(
|
|
3408
|
+
if (!t.length) return /* @__PURE__ */ W(Pn, {
|
|
3215
3409
|
type: "secondary",
|
|
3216
3410
|
children: "Not set up"
|
|
3217
3411
|
});
|
|
3218
|
-
let n = t.map((e) => e.name || "Unnamed counsellor"), r =
|
|
3412
|
+
let n = t.map((e) => e.name || "Unnamed counsellor"), r = At(e);
|
|
3219
3413
|
return /* @__PURE__ */ G("div", {
|
|
3220
3414
|
className: "fb-who",
|
|
3221
|
-
children: [/* @__PURE__ */ W(
|
|
3415
|
+
children: [/* @__PURE__ */ W(M, {
|
|
3222
3416
|
title: n.join(", "),
|
|
3223
3417
|
trigger: ["hover", "focus"],
|
|
3224
3418
|
children: /* @__PURE__ */ G("span", {
|
|
@@ -3242,23 +3436,23 @@ function In({ distribution: e }) {
|
|
|
3242
3436
|
})]
|
|
3243
3437
|
});
|
|
3244
3438
|
}
|
|
3245
|
-
function
|
|
3246
|
-
let [e, t] = f(
|
|
3439
|
+
function Kn() {
|
|
3440
|
+
let [e, t] = f(Un), [n, r] = f(Wn), [i, a] = f(!0), [o, l] = f(null), [p, m] = f("forms"), [ee, g] = f(""), [te, ne] = f("all"), [_, y] = f(null), [b, x] = f(1), [S, C] = f(""), [w, oe] = f(null), [D, O] = f(!1), [A, j] = f(0), M = d(0), ce = d(0), le = d({
|
|
3247
3441
|
element: null,
|
|
3248
3442
|
formId: ""
|
|
3249
3443
|
}), ue = d(null), P = s(async () => {
|
|
3250
|
-
let e = ++
|
|
3444
|
+
let e = ++M.current;
|
|
3251
3445
|
a(!0);
|
|
3252
|
-
let n = await Promise.allSettled(
|
|
3253
|
-
e ===
|
|
3446
|
+
let n = await Promise.allSettled(Hn.map((e) => Vn[e].load()));
|
|
3447
|
+
e === M.current && (t((e) => {
|
|
3254
3448
|
let t = { ...e };
|
|
3255
3449
|
return n.forEach((e, n) => {
|
|
3256
|
-
e.status === "fulfilled" && (t[
|
|
3450
|
+
e.status === "fulfilled" && (t[Hn[n]] = Vn[Hn[n]].read(e.value));
|
|
3257
3451
|
}), t;
|
|
3258
3452
|
}), r((e) => {
|
|
3259
3453
|
let t = { ...e };
|
|
3260
3454
|
return n.forEach((n, r) => {
|
|
3261
|
-
let i =
|
|
3455
|
+
let i = Hn[r];
|
|
3262
3456
|
t[i] = n.status === "fulfilled" ? {
|
|
3263
3457
|
loaded: !0,
|
|
3264
3458
|
ok: !0,
|
|
@@ -3270,22 +3464,22 @@ function Ln() {
|
|
|
3270
3464
|
};
|
|
3271
3465
|
}), t;
|
|
3272
3466
|
}), a(!1));
|
|
3273
|
-
}, []), de = s(() => (
|
|
3467
|
+
}, []), de = s(() => (j((e) => e + 1), P()), [P]);
|
|
3274
3468
|
c(() => {
|
|
3275
3469
|
P();
|
|
3276
3470
|
}, [P]), c(() => {
|
|
3277
3471
|
let e = !0;
|
|
3278
|
-
return
|
|
3472
|
+
return We().then((t) => {
|
|
3279
3473
|
e && l(t);
|
|
3280
3474
|
}).catch(() => {}), () => {
|
|
3281
3475
|
e = !1;
|
|
3282
3476
|
};
|
|
3283
3477
|
}, []);
|
|
3284
|
-
let { alerts: F, alertsOk: pe, failedCount: I } =
|
|
3478
|
+
let { alerts: F, alertsOk: pe, failedCount: I } = ft({ refreshKey: A }), L = {
|
|
3285
3479
|
add: o?.permissions?.canAdd !== !1,
|
|
3286
3480
|
edit: o?.permissions?.canEdit !== !1,
|
|
3287
3481
|
remove: o?.permissions?.canDelete !== !1
|
|
3288
|
-
}, { forms: ve, courses: z, mappings: B, distributions: V, counsellors: H } = e, U = n.forms.loaded, K = n.mappings.loaded, be = n.distributions.loaded, J = !U || !K || !be, Se = i && !
|
|
3482
|
+
}, { forms: ve, courses: z, mappings: B, distributions: V, counsellors: H } = e, U = n.forms.loaded, K = n.mappings.loaded, be = n.distributions.loaded, J = !U || !K || !be, Se = i && !Hn.some((e) => n[e].loaded), Y = u(() => new Map(V.map((e) => [String(e.formId), e])), [V]), X = u(() => new Map(B.map((e) => [String(e.formId), e])), [B]), Te = u(() => new Map(z.map((e) => [String(e.courseId), e.courseName])), [z]), De = u(() => {
|
|
3289
3483
|
let e = ve.map((e) => ({
|
|
3290
3484
|
formId: String(e.id),
|
|
3291
3485
|
formName: e.name || "Unnamed form",
|
|
@@ -3306,7 +3500,7 @@ function Ln() {
|
|
|
3306
3500
|
mapping: t,
|
|
3307
3501
|
distribution: n,
|
|
3308
3502
|
courseName: t && (Te.get(String(t.courseId)) || t.courseName) || "",
|
|
3309
|
-
status:
|
|
3503
|
+
status: kt({
|
|
3310
3504
|
mapping: t,
|
|
3311
3505
|
distribution: n,
|
|
3312
3506
|
inFormsList: e.inFormsList
|
|
@@ -3329,47 +3523,47 @@ function Ln() {
|
|
|
3329
3523
|
be
|
|
3330
3524
|
]), Z = u(() => {
|
|
3331
3525
|
let e = ee.trim().toLowerCase();
|
|
3332
|
-
return De.filter((t) =>
|
|
3526
|
+
return De.filter((t) => _ && !_.includes(t.formId) || te !== "all" && t.status !== te ? !1 : `${t.formName} ${t.formId} ${t.courseName}`.toLowerCase().includes(e));
|
|
3333
3527
|
}, [
|
|
3334
3528
|
De,
|
|
3335
|
-
y,
|
|
3336
3529
|
_,
|
|
3530
|
+
te,
|
|
3337
3531
|
ee
|
|
3338
|
-
]), Oe = !!ee.trim() ||
|
|
3339
|
-
g(""),
|
|
3532
|
+
]), Oe = !!ee.trim() || te !== "all" || !!_, ke = Math.min(b, Math.max(1, Math.ceil(Z.length / In))), Ae = () => {
|
|
3533
|
+
g(""), ne("all"), y(null), x(1);
|
|
3340
3534
|
}, je = (e) => {
|
|
3341
|
-
g(""),
|
|
3535
|
+
g(""), ne("all"), y(e), x(1), m("forms");
|
|
3342
3536
|
}, $ = (e) => {
|
|
3343
|
-
g(""),
|
|
3344
|
-
}, Pe = n.forms.ok && n.mappings.ok && n.distributions.ok, Fe = (e) => De.filter((t) => t.status === e).length, Ie = pe ? Number(F?.unassignedCount || 0) : null,
|
|
3537
|
+
g(""), y(null), ne(e), x(1), m("forms");
|
|
3538
|
+
}, Pe = n.forms.ok && n.mappings.ok && n.distributions.ok, Fe = (e) => De.filter((t) => t.status === e).length, Ie = pe ? Number(F?.unassignedCount || 0) : null, Le = Ie === null || I === null ? null : Ie + I, ze = [
|
|
3345
3539
|
{
|
|
3346
3540
|
key: "ready",
|
|
3347
3541
|
label: "forms ready",
|
|
3348
|
-
value: Pe ? Fe("ready") :
|
|
3542
|
+
value: Pe ? Fe("ready") : Ln,
|
|
3349
3543
|
onClick: Pe ? () => $("ready") : void 0
|
|
3350
3544
|
},
|
|
3351
3545
|
{
|
|
3352
3546
|
key: "setup",
|
|
3353
3547
|
label: "need setup",
|
|
3354
|
-
value: Pe ? Fe("needs_setup") :
|
|
3548
|
+
value: Pe ? Fe("needs_setup") : Ln,
|
|
3355
3549
|
onClick: Pe ? () => $("needs_setup") : void 0
|
|
3356
3550
|
},
|
|
3357
3551
|
{
|
|
3358
3552
|
key: "waiting",
|
|
3359
3553
|
label: "leads waiting",
|
|
3360
|
-
value: Ie ??
|
|
3554
|
+
value: Ie ?? Ln,
|
|
3361
3555
|
onClick: Ie === null ? void 0 : () => m("attention")
|
|
3362
3556
|
},
|
|
3363
3557
|
{
|
|
3364
3558
|
key: "failed",
|
|
3365
3559
|
label: "failed leads",
|
|
3366
|
-
value: I ??
|
|
3560
|
+
value: I ?? Ln,
|
|
3367
3561
|
onClick: I === null ? void 0 : () => m("attention")
|
|
3368
3562
|
},
|
|
3369
3563
|
{
|
|
3370
3564
|
key: "counsellors",
|
|
3371
3565
|
label: "active counsellors",
|
|
3372
|
-
value: n.counsellors.ok ? H.length :
|
|
3566
|
+
value: n.counsellors.ok ? H.length : Ln
|
|
3373
3567
|
}
|
|
3374
3568
|
], Be = (e) => {
|
|
3375
3569
|
t((t) => ({
|
|
@@ -3392,10 +3586,10 @@ function Ln() {
|
|
|
3392
3586
|
Me(),
|
|
3393
3587
|
Ne()
|
|
3394
3588
|
]), i = {
|
|
3395
|
-
courses:
|
|
3396
|
-
mappings:
|
|
3397
|
-
distributions:
|
|
3398
|
-
counsellors:
|
|
3589
|
+
courses: Bn(e, "courses"),
|
|
3590
|
+
mappings: Bn(t, "mappings"),
|
|
3591
|
+
distributions: Bn(n, "distributions"),
|
|
3592
|
+
counsellors: Bn(r, "counsellors")
|
|
3399
3593
|
};
|
|
3400
3594
|
return Be(i), i;
|
|
3401
3595
|
}, He = async (e, t, n = null) => {
|
|
@@ -3403,20 +3597,20 @@ function Ln() {
|
|
|
3403
3597
|
le.current = {
|
|
3404
3598
|
element: n,
|
|
3405
3599
|
formId: e.formId
|
|
3406
|
-
},
|
|
3600
|
+
}, C(e.formId);
|
|
3407
3601
|
try {
|
|
3408
|
-
await Ve(), ce.current += 1,
|
|
3602
|
+
await Ve(), ce.current += 1, oe({
|
|
3409
3603
|
token: ce.current,
|
|
3410
3604
|
row: e,
|
|
3411
3605
|
section: t
|
|
3412
|
-
}),
|
|
3606
|
+
}), O(!0);
|
|
3413
3607
|
} catch (e) {
|
|
3414
3608
|
N.error(Q(e, "Could not open this form. Please try again."));
|
|
3415
3609
|
} finally {
|
|
3416
|
-
|
|
3610
|
+
C("");
|
|
3417
3611
|
}
|
|
3418
3612
|
}
|
|
3419
|
-
},
|
|
3613
|
+
}, Ue = () => {
|
|
3420
3614
|
let { element: e, formId: t } = le.current;
|
|
3421
3615
|
if (e?.isConnected) {
|
|
3422
3616
|
e.focus();
|
|
@@ -3424,9 +3618,9 @@ function Ln() {
|
|
|
3424
3618
|
}
|
|
3425
3619
|
[...ue.current?.querySelectorAll("[data-form-menu]") || []].find((e) => e.dataset.formMenu === t)?.focus();
|
|
3426
3620
|
}, Ge = () => {
|
|
3427
|
-
|
|
3621
|
+
j((e) => e + 1), P();
|
|
3428
3622
|
}, Ke = (e) => {
|
|
3429
|
-
|
|
3623
|
+
ae.confirm({
|
|
3430
3624
|
title: "Remove course mapping?",
|
|
3431
3625
|
content: /* @__PURE__ */ G("span", { children: [
|
|
3432
3626
|
"Remove the course mapping for ",
|
|
@@ -3439,18 +3633,18 @@ function Ln() {
|
|
|
3439
3633
|
cancelText: "Cancel",
|
|
3440
3634
|
autoFocusButton: "cancel",
|
|
3441
3635
|
onOk: async () => {
|
|
3442
|
-
|
|
3636
|
+
C(e.formId);
|
|
3443
3637
|
try {
|
|
3444
3638
|
await Ee(e.formId), N.success("Course mapping removed"), Ge();
|
|
3445
3639
|
} catch (e) {
|
|
3446
3640
|
throw N.error(Q(e, "Could not remove the mapping. Please try again.")), e;
|
|
3447
3641
|
} finally {
|
|
3448
|
-
|
|
3642
|
+
C("");
|
|
3449
3643
|
}
|
|
3450
3644
|
}
|
|
3451
3645
|
});
|
|
3452
3646
|
}, qe = (e) => {
|
|
3453
|
-
|
|
3647
|
+
ae.confirm({
|
|
3454
3648
|
title: "Remove counsellor distribution?",
|
|
3455
3649
|
content: /* @__PURE__ */ G("span", { children: [
|
|
3456
3650
|
"Remove the saved counsellors and whose turn is next for ",
|
|
@@ -3462,19 +3656,19 @@ function Ln() {
|
|
|
3462
3656
|
cancelText: "Cancel",
|
|
3463
3657
|
autoFocusButton: "cancel",
|
|
3464
3658
|
onOk: async () => {
|
|
3465
|
-
|
|
3659
|
+
C(e.formId);
|
|
3466
3660
|
try {
|
|
3467
|
-
if ((await
|
|
3661
|
+
if ((await Re(e.formId))?.deleted === !1) throw Error("This has already been removed. Refresh and try again.");
|
|
3468
3662
|
N.success("Counsellor distribution removed"), Ge();
|
|
3469
3663
|
} catch (e) {
|
|
3470
3664
|
throw N.error(Q(e, "Could not remove the distribution. Please try again.")), e;
|
|
3471
3665
|
} finally {
|
|
3472
|
-
|
|
3666
|
+
C("");
|
|
3473
3667
|
}
|
|
3474
3668
|
}
|
|
3475
3669
|
});
|
|
3476
3670
|
}, Je = (e) => {
|
|
3477
|
-
let t = (e) => J ?
|
|
3671
|
+
let t = (e) => J ? zn : e ? "" : Rn, n = t(e.mapping ? L.edit : L.add), r = t(e.distribution ? L.edit : L.add);
|
|
3478
3672
|
return {
|
|
3479
3673
|
items: [
|
|
3480
3674
|
{
|
|
@@ -3524,7 +3718,7 @@ function Ln() {
|
|
|
3524
3718
|
Ye(e), He(t, "course", e.currentTarget);
|
|
3525
3719
|
},
|
|
3526
3720
|
children: e
|
|
3527
|
-
}), /* @__PURE__ */ W("div", { children: /* @__PURE__ */ G(
|
|
3721
|
+
}), /* @__PURE__ */ W("div", { children: /* @__PURE__ */ G(Pn, {
|
|
3528
3722
|
type: "secondary",
|
|
3529
3723
|
className: "fb-small",
|
|
3530
3724
|
children: ["Form ID: ", t.formId]
|
|
@@ -3535,7 +3729,7 @@ function Ln() {
|
|
|
3535
3729
|
key: "course",
|
|
3536
3730
|
render: (e, t) => K ? t.mapping ? /* @__PURE__ */ G("span", {
|
|
3537
3731
|
className: "fb-course",
|
|
3538
|
-
children: [t.courseName || "Course no longer available", !t.mapping.isActive && /* @__PURE__ */ W(
|
|
3732
|
+
children: [t.courseName || "Course no longer available", !t.mapping.isActive && /* @__PURE__ */ W(Pn, {
|
|
3539
3733
|
type: "secondary",
|
|
3540
3734
|
children: " (off)"
|
|
3541
3735
|
})]
|
|
@@ -3543,26 +3737,26 @@ function Ln() {
|
|
|
3543
3737
|
size: "small",
|
|
3544
3738
|
className: "fb-inline-btn",
|
|
3545
3739
|
disabled: J,
|
|
3546
|
-
loading:
|
|
3740
|
+
loading: S === t.formId,
|
|
3547
3741
|
onClick: (e) => {
|
|
3548
3742
|
Ye(e), He(t, "course", e.currentTarget);
|
|
3549
3743
|
},
|
|
3550
3744
|
"aria-label": `Map course for ${t.formName}`,
|
|
3551
3745
|
children: "Map course"
|
|
3552
|
-
}) : /* @__PURE__ */ W(
|
|
3746
|
+
}) : /* @__PURE__ */ W(Pn, {
|
|
3553
3747
|
type: "secondary",
|
|
3554
3748
|
children: "No course yet"
|
|
3555
|
-
}) : /* @__PURE__ */ W(
|
|
3749
|
+
}) : /* @__PURE__ */ W(Pn, {
|
|
3556
3750
|
type: "secondary",
|
|
3557
|
-
children:
|
|
3751
|
+
children: Ln
|
|
3558
3752
|
})
|
|
3559
3753
|
},
|
|
3560
3754
|
{
|
|
3561
3755
|
title: "Who gets leads",
|
|
3562
3756
|
key: "who",
|
|
3563
|
-
render: (e, t) => be ? /* @__PURE__ */ W(
|
|
3757
|
+
render: (e, t) => be ? /* @__PURE__ */ W(Gn, { distribution: t.distribution }) : /* @__PURE__ */ W(Pn, {
|
|
3564
3758
|
type: "secondary",
|
|
3565
|
-
children:
|
|
3759
|
+
children: Ln
|
|
3566
3760
|
})
|
|
3567
3761
|
},
|
|
3568
3762
|
{
|
|
@@ -3570,7 +3764,7 @@ function Ln() {
|
|
|
3570
3764
|
dataIndex: "status",
|
|
3571
3765
|
key: "status",
|
|
3572
3766
|
width: 170,
|
|
3573
|
-
render: (e) => /* @__PURE__ */ W(
|
|
3767
|
+
render: (e) => /* @__PURE__ */ W(It, { status: e })
|
|
3574
3768
|
},
|
|
3575
3769
|
{
|
|
3576
3770
|
title: /* @__PURE__ */ W("span", {
|
|
@@ -3582,7 +3776,7 @@ function Ln() {
|
|
|
3582
3776
|
align: "center",
|
|
3583
3777
|
render: (e, t) => /* @__PURE__ */ W("span", {
|
|
3584
3778
|
onClick: Ye,
|
|
3585
|
-
children: /* @__PURE__ */ W(
|
|
3779
|
+
children: /* @__PURE__ */ W(re, {
|
|
3586
3780
|
menu: Je(t),
|
|
3587
3781
|
trigger: ["click"],
|
|
3588
3782
|
placement: "bottomRight",
|
|
@@ -3591,25 +3785,25 @@ function Ln() {
|
|
|
3591
3785
|
className: "fb-form-actions-trigger",
|
|
3592
3786
|
"aria-label": `Actions for ${t.formName}`,
|
|
3593
3787
|
"data-form-menu": t.formId,
|
|
3594
|
-
loading:
|
|
3788
|
+
loading: S === t.formId,
|
|
3595
3789
|
icon: /* @__PURE__ */ W(he, {})
|
|
3596
3790
|
})
|
|
3597
3791
|
})
|
|
3598
3792
|
})
|
|
3599
3793
|
}
|
|
3600
|
-
], Ze = () => i ? " " : J ? /* @__PURE__ */ W(
|
|
3794
|
+
], Ze = () => i ? " " : J ? /* @__PURE__ */ W(v, { description: "Forms can't be shown right now." }) : Oe ? /* @__PURE__ */ W(v, {
|
|
3601
3795
|
description: "No forms match these filters.",
|
|
3602
3796
|
children: /* @__PURE__ */ W(h, {
|
|
3603
3797
|
onClick: Ae,
|
|
3604
3798
|
children: "Clear filters"
|
|
3605
3799
|
})
|
|
3606
|
-
}) : /* @__PURE__ */ W(
|
|
3800
|
+
}) : /* @__PURE__ */ W(v, {
|
|
3607
3801
|
description: "No Facebook forms yet. Create a lead form on Facebook, then refresh.",
|
|
3608
3802
|
children: /* @__PURE__ */ W(h, {
|
|
3609
3803
|
onClick: de,
|
|
3610
3804
|
children: "Refresh"
|
|
3611
3805
|
})
|
|
3612
|
-
}), Qe =
|
|
3806
|
+
}), Qe = Hn.filter((e) => !n[e].ok && n[e].error), $e = Qe.every((e) => n[e].loaded), et = () => `Could not load ${Qe.map((e) => Vn[e].label).join(", ")}. ${[...new Set(Qe.map((e) => n[e].error))].join(" ")}`, tt = /* @__PURE__ */ G("div", {
|
|
3613
3807
|
className: "fb-tab-body",
|
|
3614
3808
|
children: [
|
|
3615
3809
|
/* @__PURE__ */ G("div", {
|
|
@@ -3620,14 +3814,14 @@ function Ln() {
|
|
|
3620
3814
|
className: "fb-field-label",
|
|
3621
3815
|
htmlFor: "fb-forms-search",
|
|
3622
3816
|
children: "Search forms"
|
|
3623
|
-
}), /* @__PURE__ */ W(
|
|
3817
|
+
}), /* @__PURE__ */ W(ie, {
|
|
3624
3818
|
id: "fb-forms-search",
|
|
3625
3819
|
allowClear: !0,
|
|
3626
3820
|
prefix: /* @__PURE__ */ W(_e, { "aria-hidden": "true" }),
|
|
3627
3821
|
placeholder: "Form or course name",
|
|
3628
3822
|
value: ee,
|
|
3629
3823
|
onChange: (e) => {
|
|
3630
|
-
g(e.target.value),
|
|
3824
|
+
g(e.target.value), x(1);
|
|
3631
3825
|
}
|
|
3632
3826
|
})]
|
|
3633
3827
|
}), /* @__PURE__ */ G("div", {
|
|
@@ -3636,41 +3830,41 @@ function Ln() {
|
|
|
3636
3830
|
className: "fb-field-label",
|
|
3637
3831
|
htmlFor: "fb-forms-show",
|
|
3638
3832
|
children: "Show"
|
|
3639
|
-
}), /* @__PURE__ */ W(
|
|
3833
|
+
}), /* @__PURE__ */ W(T, {
|
|
3640
3834
|
id: "fb-forms-show",
|
|
3641
3835
|
className: "fb-show-select",
|
|
3642
|
-
value:
|
|
3836
|
+
value: te,
|
|
3643
3837
|
disabled: !K || !be,
|
|
3644
3838
|
onChange: (e) => {
|
|
3645
|
-
|
|
3839
|
+
ne(e), x(1);
|
|
3646
3840
|
},
|
|
3647
3841
|
options: [{
|
|
3648
3842
|
value: "all",
|
|
3649
3843
|
label: "All forms"
|
|
3650
|
-
}, ...Object.entries(
|
|
3844
|
+
}, ...Object.entries(xt).map(([e, t]) => ({
|
|
3651
3845
|
value: e,
|
|
3652
3846
|
label: t.label
|
|
3653
3847
|
}))]
|
|
3654
3848
|
})]
|
|
3655
3849
|
})]
|
|
3656
3850
|
}),
|
|
3657
|
-
|
|
3851
|
+
_ && /* @__PURE__ */ G("div", {
|
|
3658
3852
|
className: "fb-filter-note",
|
|
3659
3853
|
role: "status",
|
|
3660
|
-
children: [/* @__PURE__ */ W("span", { children:
|
|
3854
|
+
children: [/* @__PURE__ */ W("span", { children: _.length === 1 ? "Showing 1 form that needs attention." : `Showing ${_.length} forms that need attention.` }), /* @__PURE__ */ W(h, {
|
|
3661
3855
|
size: "small",
|
|
3662
3856
|
type: "link",
|
|
3663
3857
|
onClick: () => {
|
|
3664
|
-
|
|
3858
|
+
y(null), x(1);
|
|
3665
3859
|
},
|
|
3666
3860
|
children: "Show all forms"
|
|
3667
3861
|
})]
|
|
3668
3862
|
}),
|
|
3669
|
-
Se ? /* @__PURE__ */ W(
|
|
3863
|
+
Se ? /* @__PURE__ */ W(E, {
|
|
3670
3864
|
active: !0,
|
|
3671
3865
|
title: !1,
|
|
3672
3866
|
paragraph: { rows: 6 }
|
|
3673
|
-
}) : /* @__PURE__ */ W(
|
|
3867
|
+
}) : /* @__PURE__ */ W(k, {
|
|
3674
3868
|
rowKey: "formId",
|
|
3675
3869
|
className: `fb-forms-table${J ? "" : " fb-forms-table--open"}`,
|
|
3676
3870
|
columns: Xe,
|
|
@@ -3681,14 +3875,14 @@ function Ln() {
|
|
|
3681
3875
|
onRow: (e) => ({ onClick: () => He(e, "course") }),
|
|
3682
3876
|
pagination: {
|
|
3683
3877
|
current: ke,
|
|
3684
|
-
pageSize:
|
|
3878
|
+
pageSize: In,
|
|
3685
3879
|
showSizeChanger: !1,
|
|
3686
|
-
onChange:
|
|
3880
|
+
onChange: x,
|
|
3687
3881
|
showTotal: (e) => `${e} Facebook form${e === 1 ? "" : "s"}`
|
|
3688
3882
|
},
|
|
3689
3883
|
locale: { emptyText: Ze() }
|
|
3690
3884
|
}),
|
|
3691
|
-
/* @__PURE__ */ W(
|
|
3885
|
+
/* @__PURE__ */ W(Pn, {
|
|
3692
3886
|
type: "secondary",
|
|
3693
3887
|
className: "fb-small",
|
|
3694
3888
|
children: "Changing a form affects future leads only. Leads you already have keep their course and counsellor."
|
|
@@ -3696,7 +3890,7 @@ function Ln() {
|
|
|
3696
3890
|
]
|
|
3697
3891
|
}), nt = {
|
|
3698
3892
|
rows: De,
|
|
3699
|
-
refreshKey:
|
|
3893
|
+
refreshKey: A
|
|
3700
3894
|
}, rt = [
|
|
3701
3895
|
{
|
|
3702
3896
|
key: "forms",
|
|
@@ -3705,66 +3899,66 @@ function Ln() {
|
|
|
3705
3899
|
},
|
|
3706
3900
|
{
|
|
3707
3901
|
key: "attention",
|
|
3708
|
-
label: `Needs attention${
|
|
3709
|
-
children: /* @__PURE__ */ W(
|
|
3902
|
+
label: `Needs attention${Le === null ? "" : ` (${Le})`}`,
|
|
3903
|
+
children: /* @__PURE__ */ W(Xt, {
|
|
3710
3904
|
...nt,
|
|
3711
3905
|
canEdit: L.edit,
|
|
3712
|
-
onChanged: () =>
|
|
3906
|
+
onChanged: () => j((e) => e + 1)
|
|
3713
3907
|
})
|
|
3714
3908
|
},
|
|
3715
3909
|
{
|
|
3716
3910
|
key: "skips",
|
|
3717
3911
|
label: "Skipped counsellors",
|
|
3718
|
-
children: /* @__PURE__ */ W(
|
|
3912
|
+
children: /* @__PURE__ */ W(Qt, { ...nt })
|
|
3719
3913
|
},
|
|
3720
3914
|
{
|
|
3721
3915
|
key: "reassign",
|
|
3722
3916
|
label: "Reassign leads",
|
|
3723
|
-
children: /* @__PURE__ */ W(
|
|
3917
|
+
children: /* @__PURE__ */ W(ht, {
|
|
3724
3918
|
...nt,
|
|
3725
3919
|
eligibleCounsellors: H,
|
|
3726
3920
|
limits: o?.limits,
|
|
3727
3921
|
reasonTypes: o?.reasonTypes,
|
|
3728
3922
|
canEdit: L.edit,
|
|
3729
|
-
onChanged: () =>
|
|
3923
|
+
onChanged: () => j((e) => e + 1)
|
|
3730
3924
|
})
|
|
3731
3925
|
},
|
|
3732
3926
|
{
|
|
3733
3927
|
key: "history",
|
|
3734
3928
|
label: "History",
|
|
3735
|
-
children: /* @__PURE__ */ W(
|
|
3929
|
+
children: /* @__PURE__ */ W($t, { ...nt })
|
|
3736
3930
|
},
|
|
3737
3931
|
{
|
|
3738
3932
|
key: "today",
|
|
3739
3933
|
label: "Today",
|
|
3740
|
-
children: /* @__PURE__ */ W(
|
|
3934
|
+
children: /* @__PURE__ */ W(Sn, { canEdit: L.edit })
|
|
3741
3935
|
},
|
|
3742
3936
|
{
|
|
3743
3937
|
key: "queue",
|
|
3744
3938
|
label: "Pending queue",
|
|
3745
|
-
children: /* @__PURE__ */ W(
|
|
3939
|
+
children: /* @__PURE__ */ W(wn, { rows: De })
|
|
3746
3940
|
},
|
|
3747
3941
|
{
|
|
3748
3942
|
key: "assignments",
|
|
3749
3943
|
label: "Assignment history",
|
|
3750
|
-
children: /* @__PURE__ */ W(
|
|
3944
|
+
children: /* @__PURE__ */ W(Dn, {})
|
|
3751
3945
|
},
|
|
3752
3946
|
{
|
|
3753
3947
|
key: "distributionSettings",
|
|
3754
3948
|
label: "Distribution settings",
|
|
3755
|
-
children: /* @__PURE__ */ W(
|
|
3949
|
+
children: /* @__PURE__ */ W(Mn, { canEdit: L.edit })
|
|
3756
3950
|
}
|
|
3757
|
-
], it =
|
|
3951
|
+
], it = w ? De.find((e) => e.formId === w.row.formId) || w.row : null;
|
|
3758
3952
|
return /* @__PURE__ */ G("div", {
|
|
3759
3953
|
className: "facebook-course-mapping",
|
|
3760
3954
|
ref: ue,
|
|
3761
3955
|
children: [
|
|
3762
3956
|
/* @__PURE__ */ G("div", {
|
|
3763
3957
|
className: "admin-section-head fb-head",
|
|
3764
|
-
children: [/* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W(
|
|
3958
|
+
children: [/* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W(Fn, {
|
|
3765
3959
|
level: 4,
|
|
3766
3960
|
children: "Facebook Leads"
|
|
3767
|
-
}), /* @__PURE__ */ W(
|
|
3961
|
+
}), /* @__PURE__ */ W(Pn, {
|
|
3768
3962
|
type: "secondary",
|
|
3769
3963
|
children: "Choose the course and counsellors for each Facebook form."
|
|
3770
3964
|
})] }), /* @__PURE__ */ W(h, {
|
|
@@ -3795,25 +3989,25 @@ function Ln() {
|
|
|
3795
3989
|
type: "info",
|
|
3796
3990
|
title: "Your role can't make some changes here, so those actions are turned off."
|
|
3797
3991
|
}),
|
|
3798
|
-
/* @__PURE__ */ W(
|
|
3992
|
+
/* @__PURE__ */ W(mt, {
|
|
3799
3993
|
alerts: F,
|
|
3800
3994
|
failedCount: I ?? 0,
|
|
3801
3995
|
onViewLeads: () => m("attention"),
|
|
3802
3996
|
onShowForms: je
|
|
3803
3997
|
}),
|
|
3804
|
-
/* @__PURE__ */ W(
|
|
3998
|
+
/* @__PURE__ */ W(se, {
|
|
3805
3999
|
size: "small",
|
|
3806
4000
|
activeKey: p,
|
|
3807
4001
|
onChange: m,
|
|
3808
4002
|
items: rt,
|
|
3809
4003
|
className: "fb-tabs"
|
|
3810
4004
|
}),
|
|
3811
|
-
|
|
3812
|
-
open:
|
|
4005
|
+
w && /* @__PURE__ */ W(zt, {
|
|
4006
|
+
open: D,
|
|
3813
4007
|
row: it,
|
|
3814
|
-
section:
|
|
3815
|
-
mapping: X.get(
|
|
3816
|
-
current: Y.get(
|
|
4008
|
+
section: w.section,
|
|
4009
|
+
mapping: X.get(w.row.formId),
|
|
4010
|
+
current: Y.get(w.row.formId),
|
|
3817
4011
|
courses: z,
|
|
3818
4012
|
counsellors: H,
|
|
3819
4013
|
limits: o?.limits,
|
|
@@ -3821,21 +4015,21 @@ function Ln() {
|
|
|
3821
4015
|
canAdd: L.add,
|
|
3822
4016
|
canEdit: L.edit
|
|
3823
4017
|
},
|
|
3824
|
-
onClose: () =>
|
|
4018
|
+
onClose: () => O(!1),
|
|
3825
4019
|
onSaved: Ge,
|
|
3826
|
-
onAfterClose:
|
|
4020
|
+
onAfterClose: Ue,
|
|
3827
4021
|
onReload: async () => {
|
|
3828
|
-
let e = await Ve(), t =
|
|
4022
|
+
let e = await Ve(), t = w.row.formId;
|
|
3829
4023
|
return {
|
|
3830
4024
|
mapping: e.mappings.find((e) => String(e.formId) === t),
|
|
3831
4025
|
current: e.distributions.find((e) => String(e.formId) === t)
|
|
3832
4026
|
};
|
|
3833
4027
|
}
|
|
3834
|
-
},
|
|
4028
|
+
}, w.token)
|
|
3835
4029
|
]
|
|
3836
4030
|
});
|
|
3837
4031
|
}
|
|
3838
4032
|
//#endregion
|
|
3839
|
-
export {
|
|
4033
|
+
export { rn as a, xe as c, nn as i, q as l, Nn as n, an as o, on as r, Xe as s, Kn as t };
|
|
3840
4034
|
|
|
3841
|
-
//# sourceMappingURL=FacebookCourseMappingsSection-
|
|
4035
|
+
//# sourceMappingURL=FacebookCourseMappingsSection-rwzWu8Z5.js.map
|