@bahmni/admin-app 0.0.1-dev.453 → 0.0.1-dev.456
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/{AdminDashboard-4L5vxprA.js → AdminDashboard-CW3dg5aH.js} +1 -1
- package/dist/{AuditLog-DnSXSTJ_.js → AuditLog-4UIEeMim.js} +24 -24
- package/dist/{CsvExport-OtNzuu0e.js → CsvExport-BLWgpSqE.js} +19 -19
- package/dist/{CsvUpload-CAF80PsH.js → CsvUpload-CCl-44UF.js} +1 -1
- package/dist/{DocumentsTable-DH1dnlXy-hDxq_tz2.js → DocumentsTable-CIA5vIKF-D8A7W_YZ.js} +36 -36
- package/dist/{FormsTable-B8Zxjboo-Cerow-cD.js → FormsTable-CNZ9uLEn-COEQdXsG.js} +46 -46
- package/dist/{LNWAZHJI-DVbBzE5X.js → LNWAZHJI-DhcOz-DA.js} +2 -2
- package/dist/{MWZ6AO7Z-CYl-OPQp.js → MWZ6AO7Z-C5NeGavZ.js} +2 -2
- package/dist/{Observations-BzjjSeWg-tAqFoqhr.js → Observations-DrtP4xat-3o42-Jun.js} +18 -18
- package/dist/{YPM2AS64-CLLOAMRV.js → YPM2AS64-B31dtVSY.js} +1 -1
- package/dist/{index-Grpo3EV8.js → index-BhPzl7gM.js} +2862 -2865
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { G as o, L as a, O as s, P as t } from "./index-
|
|
2
|
+
import { G as o, L as a, O as s, P as t } from "./index-BhPzl7gM.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "@tanstack/react-query";
|
|
5
5
|
const i = () => /* @__PURE__ */ e(o, { children: /* @__PURE__ */ e(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as d, jsxs as S } from "react/jsx-runtime";
|
|
2
|
-
import { a7 as ee, a8 as te, a9 as se, aa as K, u as ae, ab as ne, ac as re, G as ie, a3 as oe, ad as ue, ae as de, af as C, a5 as H, ag as le } from "./index-
|
|
2
|
+
import { a7 as ee, a8 as te, a9 as se, aa as K, u as ae, ab as ne, ac as re, G as ie, a3 as oe, ad as ue, ae as de, af as C, a5 as H, ag as le } from "./index-BhPzl7gM.js";
|
|
3
3
|
import { useState as l, useRef as P, useEffect as V, useMemo as ce, useCallback as me } from "react";
|
|
4
4
|
import { useQuery as Ee } from "@tanstack/react-query";
|
|
5
5
|
const k = Symbol.for("constructDateFrom");
|
|
@@ -32,15 +32,15 @@ const Le = (e, t) => {
|
|
|
32
32
|
}
|
|
33
33
|
if (!Number.isNaN(r.getTime()))
|
|
34
34
|
return r.toISOString();
|
|
35
|
-
}, q = "NO_EVENTS_FOUND", Y = "NO_MORE_EVENTS_FOUND", Te = "MATCHING_EVENTS_NOT_FOUND",
|
|
35
|
+
}, q = "NO_EVENTS_FOUND", Y = "NO_MORE_EVENTS_FOUND", Te = "MATCHING_EVENTS_NOT_FOUND", Ie = () => {
|
|
36
36
|
const [e, t] = l({
|
|
37
37
|
startDate: ee(),
|
|
38
38
|
startTime: "00:00",
|
|
39
39
|
username: "",
|
|
40
40
|
patientId: ""
|
|
41
|
-
}), [r, a] = l(0), [i, u] = l(0), [E, _] = l([]), [R,
|
|
41
|
+
}), [r, a] = l(0), [i, u] = l(0), [E, _] = l([]), [R, p] = l(null), [b, f] = l(!1), [O, g] = l(!1), [F, M] = l(1), T = P(1), s = (c) => {
|
|
42
42
|
T.current = c, M(c);
|
|
43
|
-
}, o = P(0), [n,
|
|
43
|
+
}, o = P(0), [n, Q] = l(null), B = P(null), { data: N, isLoading: j, isFetching: L, isError: z } = Ee({
|
|
44
44
|
queryKey: ["auditLogs", n?.requestId],
|
|
45
45
|
queryFn: () => te(n.params),
|
|
46
46
|
enabled: !!n,
|
|
@@ -48,18 +48,18 @@ const Le = (e, t) => {
|
|
|
48
48
|
// (and audit logs must always be fetched fresh). Drop entries as soon as
|
|
49
49
|
// they become inactive instead of retaining them for the default gcTime.
|
|
50
50
|
gcTime: 0
|
|
51
|
-
}),
|
|
52
|
-
o.current += 1,
|
|
51
|
+
}), I = (c, G, m, h, D, W) => {
|
|
52
|
+
o.current += 1, Q({
|
|
53
53
|
action: c,
|
|
54
54
|
params: G,
|
|
55
55
|
alwaysReplace: m,
|
|
56
56
|
defaultFirstIndex: h,
|
|
57
57
|
defaultLastIndex: D,
|
|
58
|
-
emptyMessageKey:
|
|
58
|
+
emptyMessageKey: W,
|
|
59
59
|
requestId: o.current
|
|
60
60
|
});
|
|
61
61
|
}, A = Le(e.startDate, e.startTime), X = () => {
|
|
62
|
-
|
|
62
|
+
I(
|
|
63
63
|
"init",
|
|
64
64
|
{ startFrom: A, defaultView: !0 },
|
|
65
65
|
!0,
|
|
@@ -73,7 +73,7 @@ const Le = (e, t) => {
|
|
|
73
73
|
x();
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
|
-
|
|
76
|
+
I(
|
|
77
77
|
"next",
|
|
78
78
|
{
|
|
79
79
|
lastAuditLogId: i,
|
|
@@ -88,13 +88,13 @@ const Le = (e, t) => {
|
|
|
88
88
|
Y
|
|
89
89
|
);
|
|
90
90
|
}
|
|
91
|
-
},
|
|
91
|
+
}, $ = () => {
|
|
92
92
|
if (!L) {
|
|
93
93
|
if (!v()) {
|
|
94
94
|
x();
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
|
-
|
|
97
|
+
I(
|
|
98
98
|
"prev",
|
|
99
99
|
{
|
|
100
100
|
lastAuditLogId: r,
|
|
@@ -109,7 +109,7 @@ const Le = (e, t) => {
|
|
|
109
109
|
);
|
|
110
110
|
}
|
|
111
111
|
}, x = () => {
|
|
112
|
-
L ||
|
|
112
|
+
L || I(
|
|
113
113
|
"runReport",
|
|
114
114
|
{
|
|
115
115
|
defaultView: !0,
|
|
@@ -122,13 +122,13 @@ const Le = (e, t) => {
|
|
|
122
122
|
0,
|
|
123
123
|
Te
|
|
124
124
|
);
|
|
125
|
-
},
|
|
125
|
+
}, J = () => {
|
|
126
126
|
L || (t({
|
|
127
127
|
startDate: null,
|
|
128
128
|
startTime: "",
|
|
129
129
|
username: "",
|
|
130
130
|
patientId: ""
|
|
131
|
-
}),
|
|
131
|
+
}), I("init", { defaultView: !0 }, !0, 0, 0, q));
|
|
132
132
|
};
|
|
133
133
|
return V(() => {
|
|
134
134
|
X();
|
|
@@ -137,7 +137,7 @@ const Le = (e, t) => {
|
|
|
137
137
|
B.current = n.requestId;
|
|
138
138
|
const c = !!n.params.defaultView, m = (c ? N : [...N].reverse()).map(se), h = m.length === K;
|
|
139
139
|
if (m.length)
|
|
140
|
-
if (_(m),
|
|
140
|
+
if (_(m), p(null), a(m[0].auditLogId), u(m[m.length - 1].auditLogId), c)
|
|
141
141
|
g(!1), f(h), s(1);
|
|
142
142
|
else if (n.action === "next")
|
|
143
143
|
g(!0), f(h), s(T.current + 1);
|
|
@@ -147,12 +147,12 @@ const Le = (e, t) => {
|
|
|
147
147
|
g(D > 1), s(D);
|
|
148
148
|
}
|
|
149
149
|
else
|
|
150
|
-
n.alwaysReplace && _([]),
|
|
150
|
+
n.alwaysReplace && _([]), p(n.emptyMessageKey), a(n.defaultFirstIndex), u(n.defaultLastIndex), c ? (f(!1), g(!1), s(1)) : n.action === "next" ? f(!1) : g(!1);
|
|
151
151
|
}, [N, n]), {
|
|
152
152
|
filters: e,
|
|
153
153
|
setFilters: t,
|
|
154
154
|
logs: E,
|
|
155
|
-
isLoading:
|
|
155
|
+
isLoading: j || L,
|
|
156
156
|
isFetching: L,
|
|
157
157
|
isError: z,
|
|
158
158
|
emptyMessageKey: R,
|
|
@@ -162,12 +162,12 @@ const Le = (e, t) => {
|
|
|
162
162
|
hasPrevious: O,
|
|
163
163
|
currentPageNumber: F,
|
|
164
164
|
next: Z,
|
|
165
|
-
prev:
|
|
165
|
+
prev: $,
|
|
166
166
|
runReport: x,
|
|
167
|
-
reset:
|
|
167
|
+
reset: J
|
|
168
168
|
};
|
|
169
|
-
},
|
|
170
|
-
page:
|
|
169
|
+
}, pe = "AuditLog-module_page__-FKzd", Ne = "AuditLog-module_filters__DA4tQ", Ae = "AuditLog-module_filterRow__x6DqE", U = {
|
|
170
|
+
page: pe,
|
|
171
171
|
filters: Ne,
|
|
172
172
|
filterRow: Ae
|
|
173
173
|
}, be = () => {
|
|
@@ -180,13 +180,13 @@ const Le = (e, t) => {
|
|
|
180
180
|
isError: E,
|
|
181
181
|
emptyMessageKey: _,
|
|
182
182
|
hasNext: R,
|
|
183
|
-
hasPrevious:
|
|
183
|
+
hasPrevious: p,
|
|
184
184
|
currentPageNumber: b,
|
|
185
185
|
next: f,
|
|
186
186
|
prev: O,
|
|
187
187
|
runReport: g,
|
|
188
188
|
reset: F
|
|
189
|
-
} =
|
|
189
|
+
} = Ie(), M = ce(
|
|
190
190
|
() => [
|
|
191
191
|
{ key: "auditLogId", header: e("EVENT_ID") },
|
|
192
192
|
{ key: "dateCreated", header: e("CREATED_AT") },
|
|
@@ -336,7 +336,7 @@ const Le = (e, t) => {
|
|
|
336
336
|
pageSize: K,
|
|
337
337
|
startPage: b,
|
|
338
338
|
hasNext: R,
|
|
339
|
-
hasPrevious:
|
|
339
|
+
hasPrevious: p,
|
|
340
340
|
disabled: u,
|
|
341
341
|
previousLabel: e("AUDIT_LOG_PREV_BUTTON_LABEL"),
|
|
342
342
|
nextLabel: e("AUDIT_LOG_NEXT_BUTTON_LABEL"),
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { jsx as a, jsxs as d } from "react/jsx-runtime";
|
|
2
|
-
import { u as A, z as M, V as R, _ as h, a0 as O, a1 as P, a2 as g, G as D, a3 as V, a4 as f, a5 as x, a6 as y } from "./index-
|
|
2
|
+
import { u as A, z as M, V as R, _ as h, a0 as O, a1 as P, a2 as g, G as D, a3 as V, a4 as f, a5 as x, a6 as y } from "./index-BhPzl7gM.js";
|
|
3
3
|
import { useState as E, useMemo as b } from "react";
|
|
4
4
|
import { useQuery as L, useMutation as v } from "@tanstack/react-query";
|
|
5
|
-
const X = "CsvExport-module_tile__yBrLM",
|
|
5
|
+
const X = "CsvExport-module_tile__yBrLM", G = "CsvExport-module_title__epZnI", B = "CsvExport-module_form__w-cN-", z = "CsvExport-module_search__G82i7", r = {
|
|
6
6
|
tile: X,
|
|
7
|
-
title:
|
|
7
|
+
title: G,
|
|
8
8
|
form: B,
|
|
9
|
-
search:
|
|
10
|
-
},
|
|
11
|
-
const { t } = A(), { addNotification:
|
|
9
|
+
search: z
|
|
10
|
+
}, H = 300, p = 2, _ = 5e3, U = "custom:(uuid,setMembers:(uuid))", q = () => {
|
|
11
|
+
const { t } = A(), { addNotification: i } = M(), [S, C] = E(""), [s, c] = E(
|
|
12
12
|
null
|
|
13
|
-
), n = R(
|
|
13
|
+
), n = R(S.trim(), H), { data: l = [] } = L({
|
|
14
14
|
queryKey: ["csvExportConceptSearch", n],
|
|
15
15
|
queryFn: () => h(n),
|
|
16
|
-
enabled: n.length >=
|
|
16
|
+
enabled: n.length >= p && n !== s?.name,
|
|
17
17
|
// Keep prior options visible while the next term loads, but not once the input is too short to search
|
|
18
|
-
placeholderData: (e) => n.length >=
|
|
18
|
+
placeholderData: (e) => n.length >= p ? e : void 0
|
|
19
19
|
}), T = b(
|
|
20
20
|
() => l.flatMap(
|
|
21
21
|
(e) => e.name?.name ? [{ uuid: e.uuid, name: e.name.name }] : []
|
|
22
22
|
),
|
|
23
23
|
[l]
|
|
24
24
|
), o = v({
|
|
25
|
-
mutationFn: async (e) => (await P(e.uuid,
|
|
25
|
+
mutationFn: async (e) => (await P(e.uuid, U)).setMembers?.length ? g(e.name) : null,
|
|
26
26
|
onSuccess: (e, u) => {
|
|
27
27
|
const m = u.name;
|
|
28
28
|
if (!e || e.size === 0) {
|
|
29
|
-
|
|
29
|
+
i({
|
|
30
30
|
type: "error",
|
|
31
31
|
title: t("ADMIN_CSV_EXPORT_NO_DATA_TITLE"),
|
|
32
32
|
message: t("ADMIN_CSV_EXPORT_NO_DATA_MESSAGE"),
|
|
@@ -34,7 +34,7 @@ const X = "CsvExport-module_tile__yBrLM", z = "CsvExport-module_title__epZnI", B
|
|
|
34
34
|
});
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
|
-
O(e, `${m}.zip`),
|
|
37
|
+
O(e, `${m}.zip`), i({
|
|
38
38
|
type: "success",
|
|
39
39
|
title: t("ADMIN_CSV_EXPORT_SUCCESS_TITLE"),
|
|
40
40
|
message: t("ADMIN_CSV_EXPORT_SUCCESS_MESSAGE", { conceptName: m }),
|
|
@@ -42,7 +42,7 @@ const X = "CsvExport-module_tile__yBrLM", z = "CsvExport-module_title__epZnI", B
|
|
|
42
42
|
});
|
|
43
43
|
},
|
|
44
44
|
onError: (e) => {
|
|
45
|
-
|
|
45
|
+
i({
|
|
46
46
|
type: "error",
|
|
47
47
|
title: t("ADMIN_CSV_EXPORT_ERROR_TITLE"),
|
|
48
48
|
message: e.message,
|
|
@@ -54,7 +54,7 @@ const X = "CsvExport-module_tile__yBrLM", z = "CsvExport-module_title__epZnI", B
|
|
|
54
54
|
}, N = (e) => {
|
|
55
55
|
if (e.preventDefault(), !o.isPending) {
|
|
56
56
|
if (!s) {
|
|
57
|
-
|
|
57
|
+
i({
|
|
58
58
|
type: "error",
|
|
59
59
|
title: t("ADMIN_CSV_EXPORT_SELECT_CONCEPT_TITLE"),
|
|
60
60
|
message: t("ADMIN_CSV_EXPORT_SELECT_CONCEPT_MESSAGE"),
|
|
@@ -71,11 +71,11 @@ const X = "CsvExport-module_tile__yBrLM", z = "CsvExport-module_title__epZnI", B
|
|
|
71
71
|
id: "admin-csv-export-page",
|
|
72
72
|
"data-testid": "admin-csv-export-page-test-id",
|
|
73
73
|
"aria-label": "CSV Export Page",
|
|
74
|
-
className:
|
|
74
|
+
className: r.tile,
|
|
75
75
|
children: [
|
|
76
|
-
/* @__PURE__ */ a("h2", { className:
|
|
77
|
-
/* @__PURE__ */ d("form", { className:
|
|
78
|
-
/* @__PURE__ */ a("div", { className:
|
|
76
|
+
/* @__PURE__ */ a("h2", { className: r.title, children: t("ADMIN_CSV_EXPORT_TITLE") }),
|
|
77
|
+
/* @__PURE__ */ d("form", { className: r.form, onSubmit: N, noValidate: !0, children: [
|
|
78
|
+
/* @__PURE__ */ a("div", { className: r.search, children: /* @__PURE__ */ a(
|
|
79
79
|
f,
|
|
80
80
|
{
|
|
81
81
|
id: "csv-export-concept-search",
|
|
@@ -118,5 +118,5 @@ const X = "CsvExport-module_tile__yBrLM", z = "CsvExport-module_title__epZnI", B
|
|
|
118
118
|
) });
|
|
119
119
|
};
|
|
120
120
|
export {
|
|
121
|
-
|
|
121
|
+
q as CsvExport
|
|
122
122
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as a, jsxs as T, Fragment as Ee } from "react/jsx-runtime";
|
|
2
|
-
import { d as ge, u as
|
|
2
|
+
import { d as ge, u as Ne, z as fe, w as Ce, A as Ae, a as be, K as ye, h as De, T as Ie, b as Le, j as Q, E as Oe, c as we, I as ve, n as Ue, e as Se, f as J, U as te, N as Me, H as Re } from "./index-BhPzl7gM.js";
|
|
3
3
|
import { useQuery as $e } from "@tanstack/react-query";
|
|
4
|
-
import { useState as p, useRef as ke, useEffect as g, useMemo as
|
|
4
|
+
import { useState as p, useRef as ke, useEffect as g, useMemo as N, useCallback as _ } from "react";
|
|
5
5
|
const He = "DocumentsTable-module_documentsTableBody__6iR3w", Be = "DocumentsTable-module_viewAttachmentsLink__aQ1on", xe = "DocumentsTable-module_documentViewerContainer__F5m8D", ze = "DocumentsTable-module_printContainer__rtarJ", Fe = "DocumentsTable-module_attachmentItem__17KA7", Pe = "DocumentsTable-module_attachmentCounter__WFiI3", Ve = "DocumentsTable-module_attachmentError__RI4U2", We = "DocumentsTable-module_documentIframe__ptq5I", qe = "DocumentsTable-module_attachmentContent__IaCEe", Ge = "DocumentsTable-module_attachmentLoading__FAR6p", je = "DocumentsTable-module_hiddenWhileLoading__IxocW", Ke = "DocumentsTable-module_documentImage__KQVgS", Ye = "DocumentsTable-module_header__345GY", Qe = "DocumentsTable-module_documentTypeCell__uWGM8", Je = "DocumentsTable-module_printAllButton__IVYUW", Ze = "DocumentsTable-module_attachmentHeader__yI2xn", d = {
|
|
6
6
|
documentsTableBody: He,
|
|
7
7
|
viewAttachmentsLink: Be,
|
|
@@ -60,13 +60,13 @@ function rt({ url: n }, i) {
|
|
|
60
60
|
}
|
|
61
61
|
async function dt(n, i, {
|
|
62
62
|
container: l,
|
|
63
|
-
signal:
|
|
63
|
+
signal: A
|
|
64
64
|
}) {
|
|
65
|
-
const r = { container: l, focus: !1, signal:
|
|
66
|
-
for (const
|
|
67
|
-
if (
|
|
68
|
-
ot(
|
|
69
|
-
rt(
|
|
65
|
+
const r = { container: l, focus: !1, signal: A };
|
|
66
|
+
for (const f of n) {
|
|
67
|
+
if (A.aborted) break;
|
|
68
|
+
ot(f) ? await Me(ne(f.url), r) : await Re(
|
|
69
|
+
rt(f, i),
|
|
70
70
|
r
|
|
71
71
|
);
|
|
72
72
|
}
|
|
@@ -86,25 +86,25 @@ const st = "startConsultation", lt = "add", it = "documents", Z = "document-prin
|
|
|
86
86
|
"uploadedOn",
|
|
87
87
|
"uploadedBy"
|
|
88
88
|
], ht = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, ee = (n) => n.attachments.length > 0 ? n.attachments : n.documentUrl ? [{ url: n.documentUrl, contentType: n.contentType }] : [], gt = ({ config: n, encounterUuids: i }) => {
|
|
89
|
-
const [l,
|
|
89
|
+
const [l, A] = p(!1), [r, f] = p(
|
|
90
90
|
null
|
|
91
91
|
), [L, S] = p(
|
|
92
92
|
/* @__PURE__ */ new Set()
|
|
93
93
|
), [O, M] = p(
|
|
94
94
|
/* @__PURE__ */ new Set()
|
|
95
|
-
),
|
|
95
|
+
), b = ke(null), [R, F] = p(
|
|
96
96
|
null
|
|
97
97
|
), P = R !== null;
|
|
98
|
-
g(() => () =>
|
|
99
|
-
const
|
|
98
|
+
g(() => () => b.current?.abort(), []);
|
|
99
|
+
const C = ge(), { t: o } = Ne(), { addNotification: w } = fe(), m = N(
|
|
100
100
|
() => n?.actions?.find(
|
|
101
101
|
(e) => e.type === lt
|
|
102
102
|
),
|
|
103
103
|
[n?.actions]
|
|
104
|
-
), ae =
|
|
105
|
-
|
|
104
|
+
), ae = Ce(m?.requiredPrivilege), oe = !!m && ae, re = Number(n?.pageSize) || 5, [$, k] = p(1), [y, de] = p(re), [se, H] = p(void 0), V = _((e) => {
|
|
105
|
+
f(e), A(!0);
|
|
106
106
|
}, []), le = _(() => {
|
|
107
|
-
|
|
107
|
+
b.current?.abort(), M(/* @__PURE__ */ new Set()), A(!1), f(null), S(/* @__PURE__ */ new Set());
|
|
108
108
|
}, []), W = _((e) => {
|
|
109
109
|
M((t) => new Set(t).add(e));
|
|
110
110
|
}, []), q = _((e) => {
|
|
@@ -122,29 +122,29 @@ const st = "startConsultation", lt = "add", it = "documents", Z = "document-prin
|
|
|
122
122
|
}, [m]), { data: D, isLoading: ce, isError: B, error: x, refetch: G } = $e({
|
|
123
123
|
queryKey: [
|
|
124
124
|
"documents",
|
|
125
|
-
|
|
125
|
+
C,
|
|
126
126
|
i,
|
|
127
127
|
$,
|
|
128
|
-
|
|
128
|
+
y
|
|
129
129
|
],
|
|
130
|
-
enabled: !!
|
|
131
|
-
queryFn: () =>
|
|
132
|
-
|
|
130
|
+
enabled: !!C,
|
|
131
|
+
queryFn: () => Ae(
|
|
132
|
+
C,
|
|
133
133
|
i,
|
|
134
|
-
|
|
134
|
+
y,
|
|
135
135
|
$
|
|
136
136
|
)
|
|
137
137
|
});
|
|
138
|
-
|
|
138
|
+
be(
|
|
139
139
|
(e) => {
|
|
140
|
-
e.patientUUID ===
|
|
140
|
+
e.patientUUID === C && e.updatedResources.documents && G();
|
|
141
141
|
},
|
|
142
|
-
[
|
|
142
|
+
[C, G]
|
|
143
143
|
), g(() => {
|
|
144
144
|
D && H(D.total);
|
|
145
145
|
}, [D]), g(() => {
|
|
146
146
|
k(1), H(void 0);
|
|
147
|
-
}, [
|
|
147
|
+
}, [C]), g(() => {
|
|
148
148
|
B && w({
|
|
149
149
|
title: o("ERROR_DEFAULT_TITLE"),
|
|
150
150
|
message: x?.message ?? "",
|
|
@@ -191,19 +191,19 @@ const st = "startConsultation", lt = "add", it = "documents", Z = "document-prin
|
|
|
191
191
|
}, [l, r]);
|
|
192
192
|
const ue = _(
|
|
193
193
|
(e, t) => {
|
|
194
|
-
t !==
|
|
194
|
+
t !== y ? (de(t), k(1), H(void 0)) : k(e);
|
|
195
195
|
},
|
|
196
|
-
[
|
|
197
|
-
), v =
|
|
196
|
+
[y]
|
|
197
|
+
), v = N(
|
|
198
198
|
() => n?.fields ?? mt,
|
|
199
199
|
[n?.fields]
|
|
200
|
-
), me =
|
|
200
|
+
), me = N(() => [...D?.documents ?? []].sort((e, t) => !e.uploadedOn && !t.uploadedOn ? 0 : e.uploadedOn ? t.uploadedOn ? new Date(t.uploadedOn).getTime() - new Date(e.uploadedOn).getTime() : -1 : 1), [D]), he = N(() => tt(v, o), [v, o]), Te = N(
|
|
201
201
|
() => v.map((e) => ({
|
|
202
202
|
key: e,
|
|
203
203
|
sortable: e !== "attachments"
|
|
204
204
|
})),
|
|
205
205
|
[v]
|
|
206
|
-
), u =
|
|
206
|
+
), u = N(
|
|
207
207
|
() => r ? ee(r) : [],
|
|
208
208
|
[r]
|
|
209
209
|
), j = u.every(
|
|
@@ -219,9 +219,9 @@ const st = "startConsultation", lt = "add", it = "documents", Z = "document-prin
|
|
|
219
219
|
}, [l, u]);
|
|
220
220
|
const K = _(
|
|
221
221
|
async (e, t) => {
|
|
222
|
-
if (!r ||
|
|
222
|
+
if (!r || b.current) return;
|
|
223
223
|
const s = new AbortController(), { signal: c } = s;
|
|
224
|
-
|
|
224
|
+
b.current = s, F(t);
|
|
225
225
|
const h = document.getElementById(Z);
|
|
226
226
|
try {
|
|
227
227
|
await dt(
|
|
@@ -236,11 +236,11 @@ const st = "startConsultation", lt = "add", it = "documents", Z = "document-prin
|
|
|
236
236
|
type: "error"
|
|
237
237
|
});
|
|
238
238
|
} finally {
|
|
239
|
-
|
|
239
|
+
b.current = null, F(null);
|
|
240
240
|
}
|
|
241
241
|
},
|
|
242
242
|
[r, w, o]
|
|
243
|
-
), Y =
|
|
243
|
+
), Y = N(
|
|
244
244
|
() => u.filter(
|
|
245
245
|
(e, t) => I(e.url) !== "#" && !L.has(t)
|
|
246
246
|
),
|
|
@@ -273,7 +273,7 @@ const st = "startConsultation", lt = "add", it = "documents", Z = "document-prin
|
|
|
273
273
|
return e.uploadedBy ?? o("DOCUMENTS_NOT_AVAILABLE");
|
|
274
274
|
case "attachments":
|
|
275
275
|
return e.attachments.length > 0 || e.documentUrl ? /* @__PURE__ */ a(
|
|
276
|
-
|
|
276
|
+
ye,
|
|
277
277
|
{
|
|
278
278
|
onClick: () => V(e),
|
|
279
279
|
className: d.viewAttachmentsLink,
|
|
@@ -316,7 +316,7 @@ const st = "startConsultation", lt = "add", it = "documents", Z = "document-prin
|
|
|
316
316
|
renderCell: pe,
|
|
317
317
|
className: d.documentsTableBody,
|
|
318
318
|
dataTestId: "documents-table",
|
|
319
|
-
pageSize:
|
|
319
|
+
pageSize: y,
|
|
320
320
|
totalItems: se,
|
|
321
321
|
page: $,
|
|
322
322
|
onPageChange: ue
|
|
@@ -1,83 +1,83 @@
|
|
|
1
1
|
import { jsx as n, jsxs as H, Fragment as ne } from "react/jsx-runtime";
|
|
2
|
-
import { u as ie, d as de, w as le, Z as me, g as ue, x as ce, i as fe, p as ye, a as
|
|
2
|
+
import { u as ie, d as de, w as le, Z as me, g as ue, x as ce, i as fe, p as ye, a as Ne, C as ge, k as he, R as pe, h as Te, j as V, l as K, K as Ie, I as j, q as Oe, W as be, n as Ee, M as Ae, m as _e } from "./index-BhPzl7gM.js";
|
|
3
3
|
import { useQueryClient as Ce, useQuery as E } from "@tanstack/react-query";
|
|
4
4
|
import { useState as x, useMemo as i, useCallback as d } from "react";
|
|
5
|
-
const Re = "FormsTable-module_formsTableBody__SvGha", ve = "FormsTable-module_modalHeading__wnTmA", Le = "FormsTable-module_customAccordianItem__isszs",
|
|
5
|
+
const Re = "FormsTable-module_formsTableBody__SvGha", ve = "FormsTable-module_modalHeading__wnTmA", Le = "FormsTable-module_customAccordianItem__isszs", h = {
|
|
6
6
|
formsTableBody: Re,
|
|
7
7
|
modalHeading: ve,
|
|
8
8
|
customAccordianItem: Le
|
|
9
|
-
},
|
|
9
|
+
}, Ue = "startConsultation", Se = ({
|
|
10
10
|
episodeOfCareUuids: A,
|
|
11
11
|
encounterUuids: l,
|
|
12
|
-
config:
|
|
13
|
-
disableActions:
|
|
12
|
+
config: $,
|
|
13
|
+
disableActions: z = !1,
|
|
14
14
|
activeEncounterUuid: y = null
|
|
15
15
|
}) => {
|
|
16
16
|
const { t: o } = ie(), m = de(), [p, _] = x(!1), [t, C] = x(null), {
|
|
17
|
-
numberOfVisits:
|
|
18
|
-
hideThumbnail:
|
|
19
|
-
forms:
|
|
20
|
-
} =
|
|
17
|
+
numberOfVisits: Q,
|
|
18
|
+
hideThumbnail: G = !1,
|
|
19
|
+
forms: N
|
|
20
|
+
} = $ ?? {}, P = le(
|
|
21
21
|
_e.EDIT_OBSERVATIONS
|
|
22
|
-
), { userPrivileges:
|
|
22
|
+
), { userPrivileges: g } = me(), T = P && !z && !!y, R = ue(
|
|
23
23
|
A,
|
|
24
24
|
l
|
|
25
25
|
), W = Ce(), {
|
|
26
26
|
data: v = [],
|
|
27
27
|
isLoading: L,
|
|
28
|
-
isError:
|
|
28
|
+
isError: U,
|
|
29
29
|
error: Z,
|
|
30
30
|
refetch: Y
|
|
31
31
|
} = E({
|
|
32
32
|
queryKey: ["forms", m, A],
|
|
33
|
-
queryFn: () => ce(m, void 0,
|
|
33
|
+
queryFn: () => ce(m, void 0, Q),
|
|
34
34
|
enabled: !!m && !R
|
|
35
35
|
}), B = i(() => {
|
|
36
36
|
let e = v;
|
|
37
37
|
return l && l.length > 0 && (e = e.filter(
|
|
38
38
|
(r) => l.includes(r.encounterUuid)
|
|
39
|
-
)), Array.isArray(
|
|
40
|
-
(r) =>
|
|
39
|
+
)), Array.isArray(N) && N.length > 0 && (e = e.filter(
|
|
40
|
+
(r) => N.some((a) => a.toLowerCase() === r.formName.toLowerCase())
|
|
41
41
|
)), e;
|
|
42
|
-
}, [v, l,
|
|
42
|
+
}, [v, l, N]), { data: F = [] } = E({
|
|
43
43
|
queryKey: ["observationForms"],
|
|
44
44
|
queryFn: () => fe()
|
|
45
|
-
}),
|
|
45
|
+
}), M = d(
|
|
46
46
|
(e) => {
|
|
47
|
-
const r =
|
|
47
|
+
const r = F.find(
|
|
48
48
|
(s) => s.name.toLowerCase() === e.toLowerCase()
|
|
49
49
|
);
|
|
50
50
|
if (!r?.privileges || r.privileges.length === 0) return !0;
|
|
51
|
-
if (!
|
|
52
|
-
const a = new Set(
|
|
51
|
+
if (!g || g.length === 0) return !1;
|
|
52
|
+
const a = new Set(g.map((s) => s.name));
|
|
53
53
|
return r.privileges.some(
|
|
54
54
|
(s) => a.has(s.privilegeName) && s.editable
|
|
55
55
|
);
|
|
56
56
|
},
|
|
57
|
-
[
|
|
57
|
+
[F, g]
|
|
58
58
|
), u = d(
|
|
59
|
-
(e) => !y || e.encounterUuid !== y ? !1 :
|
|
60
|
-
[y,
|
|
59
|
+
(e) => !y || e.encounterUuid !== y ? !1 : M(e.formName),
|
|
60
|
+
[y, M]
|
|
61
61
|
), {
|
|
62
62
|
data: I,
|
|
63
63
|
isLoading: J,
|
|
64
64
|
isError: X,
|
|
65
|
-
error:
|
|
65
|
+
error: O
|
|
66
66
|
} = E({
|
|
67
67
|
queryKey: ["formsEncounterFHIR", t?.encounterUuid],
|
|
68
68
|
queryFn: () => ye(t.encounterUuid),
|
|
69
69
|
enabled: !!t?.encounterUuid && p
|
|
70
70
|
});
|
|
71
|
-
|
|
71
|
+
Ne(
|
|
72
72
|
(e) => {
|
|
73
73
|
e.patientUUID === m && (Y(), W.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
|
|
74
74
|
},
|
|
75
75
|
[m]
|
|
76
76
|
);
|
|
77
|
-
const ee = i(() => !I?.entry || !t?.formName ? [] : I.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) =>
|
|
78
|
-
if (
|
|
79
|
-
return pe(
|
|
80
|
-
}, [
|
|
77
|
+
const ee = i(() => !I?.entry || !t?.formName ? [] : I.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => ge(e) ? he(e)?.toLowerCase() === t.formName.toLowerCase() : !0), [I, t?.formName]), re = i(() => {
|
|
78
|
+
if (O)
|
|
79
|
+
return pe(O).message;
|
|
80
|
+
}, [O]), c = i(
|
|
81
81
|
() => [
|
|
82
82
|
{ key: "recordedOn", header: o("RECORDED_ON") },
|
|
83
83
|
{ key: "recordedBy", header: o("RECORDED_BY") }
|
|
@@ -120,13 +120,13 @@ const Re = "FormsTable-module_formsTableBody__SvGha", ve = "FormsTable-module_mo
|
|
|
120
120
|
)
|
|
121
121
|
})
|
|
122
122
|
).sort((r, a) => r.formName.localeCompare(a.formName));
|
|
123
|
-
}, [B, o]),
|
|
123
|
+
}, [B, o]), w = d((e) => {
|
|
124
124
|
C(e), _(!0);
|
|
125
|
-
}, []),
|
|
125
|
+
}, []), k = d(() => {
|
|
126
126
|
_(!1), C(null);
|
|
127
|
-
}, []),
|
|
127
|
+
}, []), b = d((e) => {
|
|
128
128
|
globalThis.dispatchEvent(
|
|
129
|
-
new CustomEvent(
|
|
129
|
+
new CustomEvent(Ue, {
|
|
130
130
|
detail: {
|
|
131
131
|
editOnly: "observationForms",
|
|
132
132
|
editTitle: "EDIT_OBSERVATION_FORM_TITLE",
|
|
@@ -140,7 +140,7 @@ const Re = "FormsTable-module_formsTableBody__SvGha", ve = "FormsTable-module_mo
|
|
|
140
140
|
(e, r) => {
|
|
141
141
|
switch (r) {
|
|
142
142
|
case "recordedOn":
|
|
143
|
-
return /* @__PURE__ */ n(Ie, { onClick: () =>
|
|
143
|
+
return /* @__PURE__ */ n(Ie, { onClick: () => w(e), children: e.recordedOn });
|
|
144
144
|
case "recordedBy":
|
|
145
145
|
return e.recordedBy;
|
|
146
146
|
case "actions":
|
|
@@ -151,7 +151,7 @@ const Re = "FormsTable-module_formsTableBody__SvGha", ve = "FormsTable-module_mo
|
|
|
151
151
|
kind: "ghost",
|
|
152
152
|
size: "sm",
|
|
153
153
|
testId: `edit-form-${e.encounterUuid}`,
|
|
154
|
-
onClick: () =>
|
|
154
|
+
onClick: () => b(e),
|
|
155
155
|
children: /* @__PURE__ */ n(K, {})
|
|
156
156
|
}
|
|
157
157
|
) : null;
|
|
@@ -159,29 +159,29 @@ const Re = "FormsTable-module_formsTableBody__SvGha", ve = "FormsTable-module_mo
|
|
|
159
159
|
return null;
|
|
160
160
|
}
|
|
161
161
|
},
|
|
162
|
-
[
|
|
162
|
+
[w, b, u, o]
|
|
163
163
|
);
|
|
164
164
|
return /* @__PURE__ */ H(ne, { children: [
|
|
165
|
-
/* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: L ||
|
|
165
|
+
/* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: L || U || S.length === 0 || R ? /* @__PURE__ */ n(
|
|
166
166
|
j,
|
|
167
167
|
{
|
|
168
168
|
headers: oe,
|
|
169
169
|
ariaLabel: o("FORMS_HEADING"),
|
|
170
170
|
rows: [],
|
|
171
171
|
loading: L,
|
|
172
|
-
errorStateMessage:
|
|
172
|
+
errorStateMessage: U ? Z?.message : void 0,
|
|
173
173
|
emptyStateMessage: o("FORMS_UNAVAILABLE"),
|
|
174
174
|
renderCell: q,
|
|
175
|
-
className:
|
|
175
|
+
className: h.formsTableBody,
|
|
176
176
|
dataTestId: "forms-table"
|
|
177
177
|
}
|
|
178
|
-
) : /* @__PURE__ */ n(
|
|
178
|
+
) : /* @__PURE__ */ n(Oe, { align: "start", children: S.map((e, r) => {
|
|
179
179
|
const { formName: a, records: s } = e, f = ae(s);
|
|
180
180
|
return /* @__PURE__ */ n(
|
|
181
|
-
|
|
181
|
+
be,
|
|
182
182
|
{
|
|
183
183
|
title: a,
|
|
184
|
-
className:
|
|
184
|
+
className: h.customAccordianItem,
|
|
185
185
|
testId: `accordian-title-${a}`,
|
|
186
186
|
open: r === 0,
|
|
187
187
|
children: /* @__PURE__ */ n(
|
|
@@ -195,7 +195,7 @@ const Re = "FormsTable-module_formsTableBody__SvGha", ve = "FormsTable-module_mo
|
|
|
195
195
|
sortable: te,
|
|
196
196
|
emptyStateMessage: o("FORMS_UNAVAILABLE"),
|
|
197
197
|
renderCell: q,
|
|
198
|
-
className:
|
|
198
|
+
className: h.formsTableBody,
|
|
199
199
|
dataTestId: `forms-table-${a}`
|
|
200
200
|
}
|
|
201
201
|
)
|
|
@@ -209,8 +209,8 @@ const Re = "FormsTable-module_formsTableBody__SvGha", ve = "FormsTable-module_mo
|
|
|
209
209
|
id: "modalIdForActionAreaLayout",
|
|
210
210
|
portalId: "main-display-area",
|
|
211
211
|
open: p,
|
|
212
|
-
onRequestClose:
|
|
213
|
-
modalHeading: /* @__PURE__ */ H("div", { className:
|
|
212
|
+
onRequestClose: k,
|
|
213
|
+
modalHeading: /* @__PURE__ */ H("div", { className: h.modalHeading, children: [
|
|
214
214
|
/* @__PURE__ */ n("span", { children: t.formName }),
|
|
215
215
|
T && u(t) && /* @__PURE__ */ n(
|
|
216
216
|
V,
|
|
@@ -220,7 +220,7 @@ const Re = "FormsTable-module_formsTableBody__SvGha", ve = "FormsTable-module_mo
|
|
|
220
220
|
size: "sm",
|
|
221
221
|
testId: `edit-form-modal-${t.encounterUuid}`,
|
|
222
222
|
onClick: () => {
|
|
223
|
-
|
|
223
|
+
k(), b(t);
|
|
224
224
|
},
|
|
225
225
|
children: /* @__PURE__ */ n(K, {})
|
|
226
226
|
}
|
|
@@ -239,7 +239,7 @@ const Re = "FormsTable-module_formsTableBody__SvGha", ve = "FormsTable-module_mo
|
|
|
239
239
|
errorMessage: re,
|
|
240
240
|
emptyStateMessage: o("NO_FORM_DATA_AVAILABLE"),
|
|
241
241
|
testIdPrefix: t.formName,
|
|
242
|
-
hideThumbnail:
|
|
242
|
+
hideThumbnail: G,
|
|
243
243
|
formName: t.formName
|
|
244
244
|
}
|
|
245
245
|
)
|