ahs-cti 0.0.36 → 0.0.37

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.
Files changed (85) hide show
  1. package/dist/{agentDetailReport-T4JNGFFX.mjs → agentDetailReport-237EX6RU.mjs} +3 -3
  2. package/dist/{agentPerformanceReport-NCP2UPJT.mjs → agentPerformanceReport-YC5FISYA.mjs} +5 -5
  3. package/dist/{auditReport-XF4UDCRV.mjs → auditReport-AXM3UDVY.mjs} +3 -3
  4. package/dist/{callHistory-KVOHY7WQ.mjs → callHistory-L5Y3RIOZ.mjs} +2 -2
  5. package/dist/{campaigns-MQBX3BYQ.mjs → campaigns-HLUCEESZ.mjs} +6 -6
  6. package/dist/{cdrReport-4XCN3MCK.mjs → cdrReport-LDKZ4C5W.mjs} +6 -6
  7. package/{dist-react/chunk-YQE67OO2.mjs → dist/chunk-35EFKRSJ.mjs} +2 -2
  8. package/dist/{chunk-KDTWJCPP.mjs → chunk-B76VHVV3.mjs} +2 -2
  9. package/dist/{chunk-5TAL7WLB.mjs → chunk-BKUTHWV7.mjs} +2 -2
  10. package/dist/{chunk-6HWDDYAJ.mjs → chunk-E552PJN7.mjs} +2 -2
  11. package/dist/{chunk-A2ZEA7YZ.mjs → chunk-FO6G3FID.mjs} +6 -1
  12. package/{dist-react/chunk-AREVEAVD.mjs.map → dist/chunk-FO6G3FID.mjs.map} +1 -1
  13. package/dist/{chunk-KWMR7BJ3.mjs → chunk-M4YVMYCX.mjs} +2 -2
  14. package/dist/{chunk-WI2SKKZA.mjs → chunk-O7GXLWRQ.mjs} +2 -2
  15. package/dist/{chunk-L256V25R.mjs → chunk-RLCMDPZJ.mjs} +2 -2
  16. package/dist/{chunk-WW5D6H5R.mjs → chunk-SYGGG4NF.mjs} +2 -2
  17. package/dist/index.js +479 -241
  18. package/dist/index.js.map +1 -1
  19. package/dist/index.mjs +487 -254
  20. package/dist/index.mjs.map +1 -1
  21. package/dist/{leadIntegrations-OED5MKZ7.mjs → leadIntegrations-6WBRGXZH.mjs} +4 -4
  22. package/dist/{liveStatus-TJRKZQ7H.mjs → liveStatus-TUGLMCT3.mjs} +4 -4
  23. package/dist/{loginReport-FQJ3OSHE.mjs → loginReport-7RHXDB2M.mjs} +4 -4
  24. package/dist/{managementDashboard-7JPQ2H76.mjs → managementDashboard-CIIHP7ET.mjs} +3 -3
  25. package/dist-react/{agentDetailReport-ATRH7YOS.mjs → agentDetailReport-Q2FSBCYY.mjs} +3 -3
  26. package/dist-react/{agentPerformanceReport-F7B6XHE5.mjs → agentPerformanceReport-S74XCLJY.mjs} +5 -5
  27. package/dist-react/{auditReport-CB4SQYIH.mjs → auditReport-HSO7MDZI.mjs} +3 -3
  28. package/dist-react/{callHistory-WJBFD7A6.mjs → callHistory-FGZXPFCO.mjs} +2 -2
  29. package/dist-react/{campaigns-XRE57FLD.mjs → campaigns-EFUWKCJR.mjs} +6 -6
  30. package/dist-react/{cdrReport-ABBBTSEG.mjs → cdrReport-ALE6CRSN.mjs} +6 -6
  31. package/dist-react/{chunk-AREVEAVD.mjs → chunk-BU3SA5MK.mjs} +6 -1
  32. package/{dist/chunk-A2ZEA7YZ.mjs.map → dist-react/chunk-BU3SA5MK.mjs.map} +1 -1
  33. package/dist-react/{chunk-OOZFD5TT.mjs → chunk-BWTRNMSY.mjs} +2 -2
  34. package/dist-react/{chunk-A5I4LSNK.mjs → chunk-D2ZGON5Q.mjs} +2 -2
  35. package/dist-react/{chunk-NBYRMQXE.mjs → chunk-DSJ6MU32.mjs} +2 -2
  36. package/dist-react/{chunk-6ZUZT6G7.mjs → chunk-K753FJWM.mjs} +2 -2
  37. package/dist-react/{chunk-SFYCMFTV.mjs → chunk-MSBV3FVM.mjs} +2 -2
  38. package/dist-react/{chunk-C42EEKB3.mjs → chunk-V4YFGJYD.mjs} +2 -2
  39. package/dist-react/{chunk-7BQXXI2K.mjs → chunk-VBYKJMDH.mjs} +2 -2
  40. package/{dist/chunk-R7P7OM42.mjs → dist-react/chunk-ZZWFK6UN.mjs} +2 -2
  41. package/dist-react/index.js +475 -237
  42. package/dist-react/index.js.map +1 -1
  43. package/dist-react/index.mjs +487 -254
  44. package/dist-react/index.mjs.map +1 -1
  45. package/dist-react/{leadIntegrations-6QTYEG2D.mjs → leadIntegrations-O2SFF566.mjs} +4 -4
  46. package/dist-react/{liveStatus-P4XLDKB3.mjs → liveStatus-GE4LXGBR.mjs} +4 -4
  47. package/dist-react/{loginReport-EYCTYQSF.mjs → loginReport-BA7TURDS.mjs} +4 -4
  48. package/dist-react/{managementDashboard-BI2RWIKE.mjs → managementDashboard-AMEYHYMZ.mjs} +3 -3
  49. package/package.json +1 -1
  50. /package/dist/{agentDetailReport-T4JNGFFX.mjs.map → agentDetailReport-237EX6RU.mjs.map} +0 -0
  51. /package/dist/{agentPerformanceReport-NCP2UPJT.mjs.map → agentPerformanceReport-YC5FISYA.mjs.map} +0 -0
  52. /package/dist/{auditReport-XF4UDCRV.mjs.map → auditReport-AXM3UDVY.mjs.map} +0 -0
  53. /package/dist/{callHistory-KVOHY7WQ.mjs.map → callHistory-L5Y3RIOZ.mjs.map} +0 -0
  54. /package/dist/{campaigns-MQBX3BYQ.mjs.map → campaigns-HLUCEESZ.mjs.map} +0 -0
  55. /package/dist/{cdrReport-4XCN3MCK.mjs.map → cdrReport-LDKZ4C5W.mjs.map} +0 -0
  56. /package/dist/{chunk-R7P7OM42.mjs.map → chunk-35EFKRSJ.mjs.map} +0 -0
  57. /package/dist/{chunk-KDTWJCPP.mjs.map → chunk-B76VHVV3.mjs.map} +0 -0
  58. /package/dist/{chunk-5TAL7WLB.mjs.map → chunk-BKUTHWV7.mjs.map} +0 -0
  59. /package/dist/{chunk-6HWDDYAJ.mjs.map → chunk-E552PJN7.mjs.map} +0 -0
  60. /package/dist/{chunk-KWMR7BJ3.mjs.map → chunk-M4YVMYCX.mjs.map} +0 -0
  61. /package/dist/{chunk-WI2SKKZA.mjs.map → chunk-O7GXLWRQ.mjs.map} +0 -0
  62. /package/dist/{chunk-L256V25R.mjs.map → chunk-RLCMDPZJ.mjs.map} +0 -0
  63. /package/dist/{chunk-WW5D6H5R.mjs.map → chunk-SYGGG4NF.mjs.map} +0 -0
  64. /package/dist/{leadIntegrations-OED5MKZ7.mjs.map → leadIntegrations-6WBRGXZH.mjs.map} +0 -0
  65. /package/dist/{liveStatus-TJRKZQ7H.mjs.map → liveStatus-TUGLMCT3.mjs.map} +0 -0
  66. /package/dist/{loginReport-FQJ3OSHE.mjs.map → loginReport-7RHXDB2M.mjs.map} +0 -0
  67. /package/dist/{managementDashboard-7JPQ2H76.mjs.map → managementDashboard-CIIHP7ET.mjs.map} +0 -0
  68. /package/dist-react/{agentDetailReport-ATRH7YOS.mjs.map → agentDetailReport-Q2FSBCYY.mjs.map} +0 -0
  69. /package/dist-react/{agentPerformanceReport-F7B6XHE5.mjs.map → agentPerformanceReport-S74XCLJY.mjs.map} +0 -0
  70. /package/dist-react/{auditReport-CB4SQYIH.mjs.map → auditReport-HSO7MDZI.mjs.map} +0 -0
  71. /package/dist-react/{callHistory-WJBFD7A6.mjs.map → callHistory-FGZXPFCO.mjs.map} +0 -0
  72. /package/dist-react/{campaigns-XRE57FLD.mjs.map → campaigns-EFUWKCJR.mjs.map} +0 -0
  73. /package/dist-react/{cdrReport-ABBBTSEG.mjs.map → cdrReport-ALE6CRSN.mjs.map} +0 -0
  74. /package/dist-react/{chunk-OOZFD5TT.mjs.map → chunk-BWTRNMSY.mjs.map} +0 -0
  75. /package/dist-react/{chunk-A5I4LSNK.mjs.map → chunk-D2ZGON5Q.mjs.map} +0 -0
  76. /package/dist-react/{chunk-NBYRMQXE.mjs.map → chunk-DSJ6MU32.mjs.map} +0 -0
  77. /package/dist-react/{chunk-6ZUZT6G7.mjs.map → chunk-K753FJWM.mjs.map} +0 -0
  78. /package/dist-react/{chunk-SFYCMFTV.mjs.map → chunk-MSBV3FVM.mjs.map} +0 -0
  79. /package/dist-react/{chunk-C42EEKB3.mjs.map → chunk-V4YFGJYD.mjs.map} +0 -0
  80. /package/dist-react/{chunk-7BQXXI2K.mjs.map → chunk-VBYKJMDH.mjs.map} +0 -0
  81. /package/dist-react/{chunk-YQE67OO2.mjs.map → chunk-ZZWFK6UN.mjs.map} +0 -0
  82. /package/dist-react/{leadIntegrations-6QTYEG2D.mjs.map → leadIntegrations-O2SFF566.mjs.map} +0 -0
  83. /package/dist-react/{liveStatus-P4XLDKB3.mjs.map → liveStatus-GE4LXGBR.mjs.map} +0 -0
  84. /package/dist-react/{loginReport-EYCTYQSF.mjs.map → loginReport-BA7TURDS.mjs.map} +0 -0
  85. /package/dist-react/{managementDashboard-BI2RWIKE.mjs.map → managementDashboard-AMEYHYMZ.mjs.map} +0 -0
@@ -7694,6 +7694,11 @@ var init_endPoint = __esm({
7694
7694
  get DISPOSITIONS() {
7695
7695
  return `${getBaseURL()}${VERSION.v1}/cti/calls/dispositions`;
7696
7696
  },
7697
+ // Master disposition list, used as the hierarchy/notes-flag source when the CTI
7698
+ // list above comes back flat (no parent links) — same fallback the browser phone uses.
7699
+ get AGENT_SELECTABLE_DISPOSITIONS() {
7700
+ return `${getBaseURL()}${VERSION.v1}/master/disposition/agent-selectable`;
7701
+ },
7697
7702
  get HOSPITALS_SERVICES() {
7698
7703
  return `${getBaseURL()}${VERSION.v1}/cti/hospital/services`;
7699
7704
  },
@@ -34256,9 +34261,105 @@ function CallTransferDialog({ open }) {
34256
34261
  )
34257
34262
  ] });
34258
34263
  }
34259
- function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
34264
+ function dispoLevelLabel(depth) {
34265
+ let prefix = "";
34266
+ for (let i = 0; i < depth; i++) prefix += "Sub-";
34267
+ return prefix + "Disposition";
34268
+ }
34269
+ function dispoField(d2, ...keys) {
34270
+ for (const k2 of keys) {
34271
+ const v = d2 == null ? void 0 : d2[k2];
34272
+ if (v !== void 0 && v !== null && v !== "") return v;
34273
+ }
34274
+ return null;
34275
+ }
34276
+ function normDispo(d2) {
34260
34277
  var _a2, _b, _c, _d, _e;
34261
- const [getDispositions, data] = useGetRequest();
34278
+ const id = dispoField(d2, "id", "disposition_id", "dispositionId");
34279
+ const code = String((_b = (_a2 = dispoField(d2, "code", "disposition_code")) != null ? _a2 : dispoField(d2, "name")) != null ? _b : "");
34280
+ const pid = dispoField(d2, "parentId", "parent_id", "parentDispositionId", "parent_disposition_id");
34281
+ const pcode = dispoField(d2, "parentCode", "parent_code");
34282
+ return {
34283
+ key: id != null ? "#" + id : "c:" + code,
34284
+ parentKey: pid != null ? "#" + pid : pcode ? "c:" + pcode : null,
34285
+ code,
34286
+ name: String((_d = (_c = dispoField(d2, "name")) != null ? _c : code) != null ? _d : ""),
34287
+ sortOrder: Number((_e = dispoField(d2, "sortOrder", "sort_order")) != null ? _e : 0),
34288
+ requiresNotes: !!dispoField(d2, "requiresNotes", "requires_notes"),
34289
+ children: []
34290
+ };
34291
+ }
34292
+ function hasSubDispositions(list) {
34293
+ return list.some((d2) => normDispo(d2).parentKey != null);
34294
+ }
34295
+ function hasNotesFlag(list) {
34296
+ return list.some((r) => "requiresNotes" in r || "requires_notes" in r);
34297
+ }
34298
+ function buildDispoTree(list) {
34299
+ const nodes = list.map(normDispo);
34300
+ const byKey = {};
34301
+ let roots = [];
34302
+ nodes.forEach((n) => {
34303
+ byKey[n.key] = n;
34304
+ });
34305
+ nodes.forEach((n) => {
34306
+ const parent = n.parentKey ? byKey[n.parentKey] : null;
34307
+ if (parent && parent !== n) parent.children.push(n);
34308
+ else roots.push(n);
34309
+ });
34310
+ if (!roots.length && nodes.length) {
34311
+ nodes.forEach((n) => {
34312
+ n.children = [];
34313
+ });
34314
+ roots = nodes;
34315
+ }
34316
+ const sortLevel = (arr) => {
34317
+ arr.sort((a, b) => a.sortOrder - b.sortOrder || a.name.localeCompare(b.name));
34318
+ arr.forEach((n) => sortLevel(n.children));
34319
+ };
34320
+ sortLevel(roots);
34321
+ return roots;
34322
+ }
34323
+ async function fetchDispoList(url) {
34324
+ try {
34325
+ const res = await axios_default2.get(url);
34326
+ const body = res == null ? void 0 : res.data;
34327
+ const d2 = body && body.data !== void 0 ? body.data : body;
34328
+ return Array.isArray(d2) ? d2 : d2 && Array.isArray(d2.data) ? d2.data : [];
34329
+ } catch (e) {
34330
+ return [];
34331
+ }
34332
+ }
34333
+ async function withNotesFlags(list) {
34334
+ if (!list.length || hasNotesFlag(list)) return list;
34335
+ const master = await fetchDispoList(END_POINT.AGENT_SELECTABLE_DISPOSITIONS);
34336
+ if (!master.length || !hasNotesFlag(master)) return list;
34337
+ const codeOf = (r) => String(r.code || r.name || "").toUpperCase();
34338
+ const flag = {};
34339
+ master.forEach((m) => {
34340
+ const c = codeOf(m);
34341
+ if (c) flag[c] = !!(m.requiresNotes || m.requires_notes);
34342
+ });
34343
+ return list.map((r) => {
34344
+ const c = codeOf(r);
34345
+ return Object.prototype.hasOwnProperty.call(flag, c) ? __spreadProps(__spreadValues({}, r), { requiresNotes: flag[c] }) : r;
34346
+ });
34347
+ }
34348
+ function DispoFieldLabel({ children }) {
34349
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34350
+ import_material3.Typography,
34351
+ {
34352
+ variant: "caption",
34353
+ sx: { display: "block", fontWeight: 600, fontSize: "0.8rem", color: "text.secondary", mb: 0.5 },
34354
+ children
34355
+ }
34356
+ );
34357
+ }
34358
+ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
34359
+ var _a2, _b, _c, _d;
34360
+ const [dispoTree, setDispoTree] = (0, import_react10.useState)([]);
34361
+ const [dispoPath, setDispoPath] = (0, import_react10.useState)([]);
34362
+ const [notesError, setNotesError] = (0, import_react10.useState)(false);
34262
34363
  const [formData, setFormData] = (0, import_react10.useState)({
34263
34364
  disposition: { label: "", value: "", id: 0 },
34264
34365
  followUp: { label: "No", value: "N" },
@@ -34285,22 +34386,53 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
34285
34386
  selected_break: false,
34286
34387
  notes: ""
34287
34388
  });
34389
+ setDispoPath([]);
34390
+ setNotesError(false);
34288
34391
  };
34289
34392
  const handleClose = () => {
34290
34393
  handleReset();
34291
34394
  setOpen(false);
34292
34395
  };
34293
34396
  (0, import_react10.useEffect)(() => {
34294
- getDispositions(END_POINT.DISPOSITIONS);
34397
+ let cancelled = false;
34398
+ (async () => {
34399
+ let list = await fetchDispoList(END_POINT.DISPOSITIONS);
34400
+ if (list.length && !hasSubDispositions(list)) {
34401
+ const alt = await fetchDispoList(END_POINT.AGENT_SELECTABLE_DISPOSITIONS);
34402
+ if (hasSubDispositions(alt)) list = alt;
34403
+ }
34404
+ list = await withNotesFlags(list);
34405
+ if (!cancelled) {
34406
+ setDispoTree(buildDispoTree(list));
34407
+ setDispoPath([]);
34408
+ }
34409
+ })();
34410
+ return () => {
34411
+ cancelled = true;
34412
+ };
34295
34413
  }, []);
34296
- const dispositionsOptions = (0, import_react10.useMemo)(() => {
34297
- var _a3, _b2, _c2, _d2;
34298
- return ((_d2 = (_c2 = (_b2 = (_a3 = data == null ? void 0 : data.data) == null ? void 0 : _a3.data) == null ? void 0 : _b2.filter((item) => item.name !== "Resolved")) == null ? void 0 : _c2.map((item) => ({
34299
- label: item.name,
34300
- value: item.code,
34301
- id: item.disposition_id
34302
- }))) == null ? void 0 : _d2.sort((a, b) => a.label.localeCompare(b.label))) || [];
34303
- }, [(_a2 = data == null ? void 0 : data.data) == null ? void 0 : _a2.data]);
34414
+ const notesRequired = dispoPath.some((n) => n.requiresNotes);
34415
+ const pickDispo = (level, picked) => {
34416
+ setDispoPath((prev) => {
34417
+ const next = prev.slice(0, level);
34418
+ if (picked) next.push(picked);
34419
+ return next;
34420
+ });
34421
+ setNotesError(false);
34422
+ };
34423
+ const handleSubmit = () => {
34424
+ if (notesRequired && !formData.notes.trim()) {
34425
+ setNotesError(true);
34426
+ return;
34427
+ }
34428
+ const leaf = dispoPath[dispoPath.length - 1];
34429
+ onSubmitDisposition(__spreadProps(__spreadValues({}, formData), {
34430
+ disposition: leaf ? { label: leaf.name, value: leaf.code, id: 0 } : { label: "", value: "", id: 0 }
34431
+ }));
34432
+ };
34433
+ const selectedNode = dispoPath[dispoPath.length - 1] || null;
34434
+ const dispoBreadcrumb = dispoPath.map((n) => n.name).join(" \u203A ");
34435
+ const dispoHint = selectedNode ? selectedNode.children.length ? `You can pick a ${dispoLevelLabel(dispoPath.length).toLowerCase()} for more detail.` : "Leaf reached \u2014 this path is complete." : "";
34304
34436
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34305
34437
  import_material3.Dialog,
34306
34438
  {
@@ -34309,251 +34441,357 @@ function EndCallDispositionDialog({ open, setOpen, onSubmitDisposition }) {
34309
34441
  "aria-describedby": "alert-dialog-description",
34310
34442
  maxWidth: "sm",
34311
34443
  fullWidth: true,
34312
- slotProps: { paper: { sx: { minWidth: 600 } } },
34444
+ slotProps: { paper: { sx: { minWidth: 600, borderRadius: 3, maxHeight: "85vh" } } },
34313
34445
  sx: {
34314
34446
  minWidth: "650px"
34315
34447
  },
34316
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Paper, { sx: { borderRadius: 2 }, children: [
34317
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34318
- import_material3.Box,
34319
- {
34320
- sx: {
34321
- display: "flex",
34322
- justifyContent: "center",
34323
- alignItems: "center",
34324
- padding: "4px 16px",
34325
- boxShadow: "0px 1px 2px #f5f5f5ff"
34326
- },
34327
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
34328
- import_material3.Typography,
34448
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
34449
+ import_material3.Paper,
34450
+ {
34451
+ sx: {
34452
+ borderRadius: 3,
34453
+ display: "flex",
34454
+ flexDirection: "column",
34455
+ maxHeight: "85vh",
34456
+ overflow: "hidden"
34457
+ },
34458
+ children: [
34459
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34460
+ import_material3.Box,
34329
34461
  {
34330
- variant: "body1",
34331
- sx: { m: 1 },
34332
- children: [
34333
- " ",
34334
- "Call Disposition"
34335
- ]
34462
+ sx: {
34463
+ flexShrink: 0,
34464
+ px: 2,
34465
+ py: 1.5,
34466
+ borderBottom: "1px solid",
34467
+ borderColor: "divider"
34468
+ },
34469
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34470
+ import_material3.Typography,
34471
+ {
34472
+ variant: "h6",
34473
+ sx: { fontWeight: 600, color: "text.primary", fontSize: "1.05rem" },
34474
+ children: "Call Disposition"
34475
+ }
34476
+ )
34336
34477
  }
34337
- )
34338
- }
34339
- ),
34340
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
34341
- import_material3.Box,
34342
- {
34343
- sx: {
34344
- boxShadow: "1px 1px 4px #d3d3d3ff",
34345
- padding: "10px",
34346
- margin: "10px",
34347
- borderRadius: "10px"
34348
- },
34349
- children: [
34350
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
34351
- import_material3.Box,
34352
- {
34353
- sx: { display: "flex", gap: 2 },
34354
- children: [
34355
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34356
- import_material3.Autocomplete,
34357
- {
34358
- value: formData.disposition,
34359
- options: dispositionsOptions,
34360
- getOptionLabel: (opt) => opt.label,
34361
- onChange: (_, val) => handleChange("disposition", val),
34362
- size: "small",
34363
- renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34364
- import_material3.TextField,
34365
- __spreadProps(__spreadValues({}, params), {
34366
- label: "Disposition",
34367
- fullWidth: true
34368
- })
34369
- ),
34370
- sx: { flex: 1 }
34371
- }
34372
- ),
34373
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34374
- import_material3.Autocomplete,
34375
- {
34376
- options: followUpOptions,
34377
- getOptionLabel: (opt) => opt.label,
34378
- value: formData.followUp,
34379
- onChange: (_, val) => handleChange("followUp", val),
34380
- size: "small",
34381
- renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34382
- import_material3.TextField,
34383
- __spreadProps(__spreadValues({}, params), {
34384
- label: "Follow Up",
34385
- fullWidth: true
34386
- })
34387
- ),
34388
- sx: { flex: 1 }
34389
- }
34390
- )
34391
- ]
34392
- }
34393
- ),
34394
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
34395
- import_material3.Box,
34396
- {
34397
- sx: { display: "flex", gap: 2, mt: 2 },
34398
- children: [
34399
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
34400
- import_material3.Box,
34401
- {
34402
- sx: {
34403
- flex: "1",
34404
- border: "1px solid #bdbdbd",
34405
- borderRadius: "5px"
34406
- },
34407
- children: [
34478
+ ),
34479
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Box, { sx: { flex: 1, minHeight: 0, overflowY: "auto", p: 1.5 }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
34480
+ import_material3.Box,
34481
+ {
34482
+ sx: {
34483
+ boxShadow: "1px 1px 4px #d3d3d3ff",
34484
+ padding: "10px",
34485
+ borderRadius: "10px"
34486
+ },
34487
+ children: [
34488
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
34489
+ import_material3.Box,
34490
+ {
34491
+ sx: { display: "flex", flexDirection: "column", gap: 2 },
34492
+ children: [
34493
+ (() => {
34494
+ const levels = [];
34495
+ let siblings = dispoTree;
34496
+ let depth = 0;
34497
+ while (siblings.length) {
34498
+ const chosen = dispoPath[depth] || null;
34499
+ const options = siblings;
34500
+ const level = depth;
34501
+ levels.push(
34502
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { children: [
34503
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DispoFieldLabel, { children: dispoLevelLabel(level) }),
34504
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34505
+ import_material3.Autocomplete,
34506
+ {
34507
+ value: chosen,
34508
+ options,
34509
+ getOptionLabel: (opt) => opt ? opt.name : "",
34510
+ isOptionEqualToValue: (opt, val) => (opt == null ? void 0 : opt.key) === (val == null ? void 0 : val.key),
34511
+ onChange: (_, picked) => pickDispo(level, picked),
34512
+ size: "small",
34513
+ renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34514
+ import_material3.TextField,
34515
+ __spreadProps(__spreadValues({}, params), {
34516
+ placeholder: `Select ${dispoLevelLabel(level).toLowerCase()}\u2026`,
34517
+ fullWidth: true
34518
+ })
34519
+ ),
34520
+ fullWidth: true
34521
+ }
34522
+ )
34523
+ ] }, level)
34524
+ );
34525
+ if (!chosen) break;
34526
+ siblings = chosen.children;
34527
+ depth++;
34528
+ }
34529
+ if (!levels.length) {
34530
+ levels.push(
34531
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { children: [
34532
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DispoFieldLabel, { children: "Disposition" }),
34533
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34534
+ import_material3.TextField,
34535
+ {
34536
+ size: "small",
34537
+ value: "",
34538
+ disabled: true,
34539
+ placeholder: "Loading dispositions\u2026",
34540
+ fullWidth: true
34541
+ }
34542
+ )
34543
+ ] }, "loading")
34544
+ );
34545
+ }
34546
+ return levels;
34547
+ })(),
34548
+ dispoPath.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: { mt: 0.5 }, children: [
34408
34549
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34409
- import_material3.Checkbox,
34550
+ import_material3.Box,
34410
34551
  {
34411
- name: "selected_break",
34412
34552
  sx: {
34413
- padding: "6px"
34414
- },
34415
- checked: formData.selected_break,
34416
- onChange: (event) => {
34417
- handleChange("selected_break", event.target.checked);
34553
+ px: 1.5,
34554
+ py: 1,
34555
+ borderRadius: "8px",
34556
+ bgcolor: "#e6f4f1",
34557
+ fontSize: "0.8rem",
34558
+ fontWeight: 500,
34559
+ color: "text.primary",
34560
+ wordBreak: "break-word"
34418
34561
  },
34419
- slotProps: {
34420
- input: { "aria-label": "controlled" }
34421
- }
34562
+ children: dispoBreadcrumb
34422
34563
  }
34423
34564
  ),
34424
- " ",
34425
- "Mark as break"
34426
- ]
34427
- }
34428
- ),
34429
- ((_c = (_b = formData == null ? void 0 : formData.followUp) == null ? void 0 : _b.label) == null ? void 0 : _c.toLowerCase()) === "yes" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34430
- import_material3.TextField,
34431
- {
34432
- size: "small",
34433
- label: "Callback Date",
34434
- type: "date",
34435
- slotProps: {
34436
- inputLabel: { shrink: true },
34437
- htmlInput: {
34438
- min: (/* @__PURE__ */ new Date()).toISOString().split("T")[0]
34439
- }
34440
- },
34441
- value: formData.callbackDate,
34442
- onChange: (e) => {
34443
- handleChange("callbackDate", e.target.value);
34444
- const isToday = e.target.value === (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
34445
- if (isToday) {
34446
- const now = /* @__PURE__ */ new Date();
34447
- const currentHr = now.getHours();
34448
- if (formData.callbackHrs && Number(formData.callbackHrs) < currentHr) {
34449
- handleChange("callbackHrs", "");
34450
- handleChange("callbackMins", "");
34451
- } else if (formData.callbackHrs && Number(formData.callbackHrs) === currentHr && formData.callbackMins && Number(formData.callbackMins) < now.getMinutes()) {
34452
- handleChange("callbackMins", "");
34565
+ dispoHint && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
34566
+ import_material3.Typography,
34567
+ {
34568
+ variant: "caption",
34569
+ sx: {
34570
+ display: "block",
34571
+ mt: 0.5,
34572
+ color: notesRequired ? "warning.main" : "text.secondary"
34573
+ },
34574
+ children: [
34575
+ dispoHint,
34576
+ notesRequired ? " Notes are required for this disposition." : ""
34577
+ ]
34453
34578
  }
34579
+ )
34580
+ ] })
34581
+ ]
34582
+ }
34583
+ ),
34584
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34585
+ import_material3.Box,
34586
+ {
34587
+ sx: { display: "flex", gap: 2, mt: 2 },
34588
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: { flex: 1 }, children: [
34589
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DispoFieldLabel, { children: "Follow up" }),
34590
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34591
+ import_material3.Autocomplete,
34592
+ {
34593
+ options: followUpOptions,
34594
+ getOptionLabel: (opt) => opt.label,
34595
+ value: formData.followUp,
34596
+ onChange: (_, val) => handleChange("followUp", val),
34597
+ size: "small",
34598
+ renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34599
+ import_material3.TextField,
34600
+ __spreadProps(__spreadValues({}, params), {
34601
+ placeholder: "Select follow up",
34602
+ fullWidth: true
34603
+ })
34604
+ ),
34605
+ fullWidth: true
34454
34606
  }
34455
- },
34456
- fullWidth: true,
34457
- sx: { flex: 1 }
34458
- }
34459
- ) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Box, { sx: { flex: 1 } })
34460
- ]
34461
- }
34462
- ),
34463
- ((_e = (_d = formData == null ? void 0 : formData.followUp) == null ? void 0 : _d.label) == null ? void 0 : _e.toLowerCase()) === "yes" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
34464
- import_material3.Box,
34465
- {
34466
- sx: { display: "flex", gap: 2, mt: 2 },
34467
- children: [
34468
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34469
- import_material3.Autocomplete,
34470
- {
34471
- size: "small",
34472
- options: Array.from({ length: 24 }, (_, i) => String(i).padStart(2, "0")),
34473
- getOptionDisabled: (option) => {
34474
- const isToday = formData.callbackDate === (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
34475
- return isToday && Number(option) < (/* @__PURE__ */ new Date()).getHours();
34476
- },
34477
- value: formData.callbackHrs || null,
34478
- onChange: (_, value) => handleChange("callbackHrs", value || ""),
34479
- renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.TextField, __spreadProps(__spreadValues({}, params), { label: "Hours (0-23)" })),
34480
- fullWidth: true,
34481
- sx: { flex: 1 }
34482
- }
34483
- ),
34607
+ )
34608
+ ] })
34609
+ }
34610
+ ),
34611
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
34612
+ import_material3.Box,
34613
+ {
34614
+ sx: { display: "flex", gap: 2, mt: 2 },
34615
+ children: [
34616
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
34617
+ import_material3.Box,
34618
+ {
34619
+ sx: {
34620
+ flex: "1",
34621
+ border: "1px solid #bdbdbd",
34622
+ borderRadius: "5px"
34623
+ },
34624
+ children: [
34625
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34626
+ import_material3.Checkbox,
34627
+ {
34628
+ name: "selected_break",
34629
+ sx: {
34630
+ padding: "6px"
34631
+ },
34632
+ checked: formData.selected_break,
34633
+ onChange: (event) => {
34634
+ handleChange("selected_break", event.target.checked);
34635
+ },
34636
+ slotProps: {
34637
+ input: { "aria-label": "controlled" }
34638
+ }
34639
+ }
34640
+ ),
34641
+ " ",
34642
+ "Mark as break"
34643
+ ]
34644
+ }
34645
+ ),
34646
+ ((_b = (_a2 = formData == null ? void 0 : formData.followUp) == null ? void 0 : _a2.label) == null ? void 0 : _b.toLowerCase()) === "yes" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: { flex: 1 }, children: [
34647
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DispoFieldLabel, { children: "Callback date" }),
34648
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34649
+ import_material3.TextField,
34650
+ {
34651
+ size: "small",
34652
+ type: "date",
34653
+ slotProps: {
34654
+ htmlInput: {
34655
+ min: (/* @__PURE__ */ new Date()).toISOString().split("T")[0]
34656
+ }
34657
+ },
34658
+ value: formData.callbackDate,
34659
+ onChange: (e) => {
34660
+ handleChange("callbackDate", e.target.value);
34661
+ const isToday = e.target.value === (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
34662
+ if (isToday) {
34663
+ const now = /* @__PURE__ */ new Date();
34664
+ const currentHr = now.getHours();
34665
+ if (formData.callbackHrs && Number(formData.callbackHrs) < currentHr) {
34666
+ handleChange("callbackHrs", "");
34667
+ handleChange("callbackMins", "");
34668
+ } else if (formData.callbackHrs && Number(formData.callbackHrs) === currentHr && formData.callbackMins && Number(formData.callbackMins) < now.getMinutes()) {
34669
+ handleChange("callbackMins", "");
34670
+ }
34671
+ }
34672
+ },
34673
+ fullWidth: true
34674
+ }
34675
+ )
34676
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Box, { sx: { flex: 1 } })
34677
+ ]
34678
+ }
34679
+ ),
34680
+ ((_d = (_c = formData == null ? void 0 : formData.followUp) == null ? void 0 : _c.label) == null ? void 0 : _d.toLowerCase()) === "yes" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
34681
+ import_material3.Box,
34682
+ {
34683
+ sx: { display: "flex", gap: 2, mt: 2 },
34684
+ children: [
34685
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: { flex: 1 }, children: [
34686
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DispoFieldLabel, { children: "Hrs" }),
34687
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34688
+ import_material3.Autocomplete,
34689
+ {
34690
+ size: "small",
34691
+ options: Array.from({ length: 24 }, (_, i) => String(i).padStart(2, "0")),
34692
+ getOptionDisabled: (option) => {
34693
+ const isToday = formData.callbackDate === (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
34694
+ return isToday && Number(option) < (/* @__PURE__ */ new Date()).getHours();
34695
+ },
34696
+ value: formData.callbackHrs || null,
34697
+ onChange: (_, value) => handleChange("callbackHrs", value || ""),
34698
+ renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.TextField, __spreadProps(__spreadValues({}, params), { placeholder: "Hrs" })),
34699
+ fullWidth: true
34700
+ }
34701
+ )
34702
+ ] }),
34703
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: { flex: 1 }, children: [
34704
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DispoFieldLabel, { children: "Mins" }),
34705
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34706
+ import_material3.Autocomplete,
34707
+ {
34708
+ size: "small",
34709
+ options: Array.from({ length: 60 }, (_, i) => String(i).padStart(2, "0")),
34710
+ getOptionDisabled: (option) => {
34711
+ const isToday = formData.callbackDate === (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
34712
+ const now = /* @__PURE__ */ new Date();
34713
+ const isCurrentHr = isToday && formData.callbackHrs === String(now.getHours()).padStart(2, "0");
34714
+ return isCurrentHr && Number(option) < now.getMinutes();
34715
+ },
34716
+ value: formData.callbackMins || null,
34717
+ onChange: (_, value) => handleChange("callbackMins", value || ""),
34718
+ renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.TextField, __spreadProps(__spreadValues({}, params), { placeholder: "Mins" })),
34719
+ fullWidth: true
34720
+ }
34721
+ )
34722
+ ] })
34723
+ ]
34724
+ }
34725
+ ),
34726
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_material3.Box, { sx: { mt: 2 }, children: [
34727
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DispoFieldLabel, { children: notesRequired ? "Notes *" : "Notes" }),
34484
34728
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34485
- import_material3.Autocomplete,
34729
+ import_material3.TextField,
34486
34730
  {
34487
34731
  size: "small",
34488
- options: Array.from({ length: 60 }, (_, i) => String(i).padStart(2, "0")),
34489
- getOptionDisabled: (option) => {
34490
- const isToday = formData.callbackDate === (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
34491
- const now = /* @__PURE__ */ new Date();
34492
- const isCurrentHr = isToday && formData.callbackHrs === String(now.getHours()).padStart(2, "0");
34493
- return isCurrentHr && Number(option) < now.getMinutes();
34732
+ placeholder: notesRequired ? "Notes are required for this disposition" : "Notes (optional)",
34733
+ multiline: true,
34734
+ minRows: 2,
34735
+ maxRows: 4,
34736
+ value: formData.notes,
34737
+ onChange: (e) => {
34738
+ handleChange("notes", e.target.value);
34739
+ if (notesError) setNotesError(false);
34494
34740
  },
34495
- value: formData.callbackMins || null,
34496
- onChange: (_, value) => handleChange("callbackMins", value || ""),
34497
- renderInput: (params) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.TextField, __spreadProps(__spreadValues({}, params), { label: "Minutes (0-59)" })),
34498
- fullWidth: true,
34499
- sx: { flex: 1 }
34741
+ error: notesError,
34742
+ helperText: notesError ? "Notes are required for this disposition." : "",
34743
+ fullWidth: true
34500
34744
  }
34501
34745
  )
34502
- ]
34503
- }
34504
- ),
34505
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_material3.Box, { sx: { mt: 2 }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34506
- import_material3.TextField,
34507
- {
34508
- size: "small",
34509
- label: "Notes",
34510
- multiline: true,
34511
- minRows: 2,
34512
- maxRows: 4,
34513
- value: formData.notes,
34514
- onChange: (e) => handleChange("notes", e.target.value),
34515
- fullWidth: true
34516
- }
34517
- ) })
34518
- ]
34519
- }
34520
- ),
34521
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
34522
- import_material3.Box,
34523
- {
34524
- sx: { textAlign: "right", m: 2 },
34525
- children: [
34526
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34527
- import_material3.Button,
34528
- {
34529
- variant: "outlined",
34530
- color: "error",
34531
- size: "large",
34532
- onClick: handleClose,
34533
- sx: {
34534
- px: 2,
34535
- mx: 1,
34536
- borderRadius: "10px",
34537
- textTransform: "capitalize"
34538
- },
34539
- children: "cancel"
34540
- }
34541
- ),
34542
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34543
- import_material3.Button,
34544
- {
34545
- variant: "contained",
34546
- color: "primary",
34547
- size: "large",
34548
- onClick: () => onSubmitDisposition(formData),
34549
- sx: { px: 2, borderRadius: "10px", textTransform: "capitalize" },
34550
- children: "Submit"
34551
- }
34552
- )
34553
- ]
34554
- }
34555
- )
34556
- ] })
34746
+ ] })
34747
+ ]
34748
+ }
34749
+ ) }),
34750
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
34751
+ import_material3.Box,
34752
+ {
34753
+ sx: {
34754
+ flexShrink: 0,
34755
+ textAlign: "right",
34756
+ px: 2,
34757
+ py: 1.5,
34758
+ borderTop: "1px solid",
34759
+ borderColor: "divider"
34760
+ },
34761
+ children: [
34762
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34763
+ import_material3.Button,
34764
+ {
34765
+ variant: "outlined",
34766
+ color: "error",
34767
+ size: "large",
34768
+ onClick: handleClose,
34769
+ sx: {
34770
+ px: 2,
34771
+ mx: 1,
34772
+ borderRadius: "10px",
34773
+ textTransform: "capitalize"
34774
+ },
34775
+ children: "cancel"
34776
+ }
34777
+ ),
34778
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
34779
+ import_material3.Button,
34780
+ {
34781
+ variant: "contained",
34782
+ color: "primary",
34783
+ size: "large",
34784
+ onClick: handleSubmit,
34785
+ sx: { px: 2, borderRadius: "10px", textTransform: "capitalize" },
34786
+ children: "Submit"
34787
+ }
34788
+ )
34789
+ ]
34790
+ }
34791
+ )
34792
+ ]
34793
+ }
34794
+ )
34557
34795
  }
34558
34796
  ) });
34559
34797
  }