@bahmni/widgets 0.0.1-dev.269 → 0.0.1-dev.271
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/{DocumentsTable-CWc_01xl.js → DocumentsTable-Blmvrcxt.js} +85 -85
- package/dist/FormsTable-ln6iYzAc.js +207 -0
- package/dist/{Observations-0noP4PJi.js → Observations-aatDTD34.js} +31 -31
- package/dist/forms/FormsTable.d.ts.map +1 -1
- package/dist/{index-BaQzqsoc.js → index-CG6CxLD9.js} +2067 -2066
- package/dist/index.css +1 -1
- package/dist/index.js +10 -10
- package/package.json +1 -1
- package/dist/FormsTable-BmPCw62a.js +0 -198
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { u as W, a as X, p as J,
|
|
1
|
+
import { jsx as r, jsxs as T, Fragment as Y } from "react/jsx-runtime";
|
|
2
|
+
import { u as W, a as X, p as J, b as Z, T as x, m as ee, y as te } from "./index-CG6CxLD9.js";
|
|
3
3
|
import { useQuery as ne } from "@tanstack/react-query";
|
|
4
|
-
import { useState as
|
|
4
|
+
import { useState as m, useCallback as p, useEffect as I, useMemo as _ } from "react";
|
|
5
5
|
import { useTranslation as ae } from "react-i18next";
|
|
6
|
-
const oe = "
|
|
6
|
+
const oe = "DocumentsTable-module_documentsTableBody__6iR3w", se = "DocumentsTable-module_viewAttachmentsLink__aQ1on", re = "DocumentsTable-module_documentViewerContainer__F5m8D", ce = "DocumentsTable-module_attachmentItem__17KA7", de = "DocumentsTable-module_attachmentCounter__WFiI3", le = "DocumentsTable-module_attachmentError__RI4U2", me = "DocumentsTable-module_documentIframe__ptq5I", ie = "DocumentsTable-module_documentImage__KQVgS", c = {
|
|
7
7
|
documentsTableBody: oe,
|
|
8
|
-
viewAttachmentsLink:
|
|
9
|
-
documentViewerContainer:
|
|
8
|
+
viewAttachmentsLink: se,
|
|
9
|
+
documentViewerContainer: re,
|
|
10
10
|
attachmentItem: ce,
|
|
11
11
|
attachmentCounter: de,
|
|
12
|
-
attachmentError:
|
|
13
|
-
documentIframe:
|
|
14
|
-
documentImage:
|
|
12
|
+
attachmentError: le,
|
|
13
|
+
documentIframe: me,
|
|
14
|
+
documentImage: ie
|
|
15
15
|
}, ue = {
|
|
16
16
|
documentIdentifier: "DOCUMENTS_DOCUMENT_IDENTIFIER",
|
|
17
17
|
documentType: "DOCUMENTS_TYPE",
|
|
@@ -19,99 +19,99 @@ const oe = "_documentsTableBody_1voj8_1", re = "_viewAttachmentsLink_1voj8_11",
|
|
|
19
19
|
uploadedBy: "DOCUMENTS_UPLOADED_BY",
|
|
20
20
|
action: "DOCUMENTS_ACTION"
|
|
21
21
|
};
|
|
22
|
-
function
|
|
22
|
+
function B(n) {
|
|
23
23
|
return !n || n.includes(":") ? "#" : `/openmrs/auth?requested_document=/document_images/${n}`;
|
|
24
24
|
}
|
|
25
|
-
function he(n,
|
|
25
|
+
function he(n, f) {
|
|
26
26
|
return n.map((d) => ({
|
|
27
27
|
key: d,
|
|
28
|
-
header:
|
|
28
|
+
header: f(ue[d])
|
|
29
29
|
}));
|
|
30
30
|
}
|
|
31
|
-
const
|
|
31
|
+
const Te = [
|
|
32
32
|
"documentIdentifier",
|
|
33
33
|
"documentType",
|
|
34
34
|
"uploadedOn",
|
|
35
35
|
"uploadedBy",
|
|
36
36
|
"action"
|
|
37
|
-
], pe = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i,
|
|
38
|
-
const [d, M] =
|
|
37
|
+
], pe = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, F = (n) => n.attachments.length > 0 ? n.attachments : n.documentUrl ? [{ url: n.documentUrl, contentType: n.contentType }] : [], Ie = ({ config: n, encounterUuids: f }) => {
|
|
38
|
+
const [d, M] = m(!1), [s, U] = m(
|
|
39
39
|
null
|
|
40
|
-
), [P, A] =
|
|
40
|
+
), [P, A] = m(
|
|
41
41
|
/* @__PURE__ */ new Set()
|
|
42
|
-
),
|
|
42
|
+
), E = W(), { t: o } = ae(), { addNotification: w } = X(), V = Number(n?.pageSize) || 5, [N, O] = m(1), [i, $] = m(V), [k, C] = m(void 0), v = p((e) => {
|
|
43
43
|
U(e), M(!0);
|
|
44
|
-
}, []),
|
|
44
|
+
}, []), z = p(() => {
|
|
45
45
|
M(!1), U(null), A(/* @__PURE__ */ new Set());
|
|
46
|
-
}, []),
|
|
46
|
+
}, []), R = p((e) => {
|
|
47
47
|
A((t) => new Set(t).add(e));
|
|
48
|
-
}, []), { data: u, isLoading:
|
|
48
|
+
}, []), { data: u, isLoading: H, isError: S, error: y } = ne({
|
|
49
49
|
queryKey: [
|
|
50
50
|
"documents",
|
|
51
|
-
T,
|
|
52
51
|
E,
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
f,
|
|
53
|
+
N,
|
|
54
|
+
i
|
|
55
55
|
],
|
|
56
|
-
enabled: !!
|
|
56
|
+
enabled: !!E,
|
|
57
57
|
queryFn: () => J(
|
|
58
|
-
T,
|
|
59
58
|
E,
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
f,
|
|
60
|
+
i,
|
|
61
|
+
N
|
|
62
62
|
)
|
|
63
63
|
});
|
|
64
|
-
|
|
64
|
+
I(() => {
|
|
65
65
|
u && C(u.total);
|
|
66
|
-
}, [u]),
|
|
66
|
+
}, [u]), I(() => {
|
|
67
67
|
O(1), C(void 0);
|
|
68
|
-
}, [
|
|
68
|
+
}, [E]), I(() => {
|
|
69
69
|
S && w({
|
|
70
70
|
title: o("ERROR_DEFAULT_TITLE"),
|
|
71
71
|
message: y?.message ?? "",
|
|
72
72
|
type: "error"
|
|
73
73
|
});
|
|
74
|
-
}, [S, y, w, o]),
|
|
74
|
+
}, [S, y, w, o]), I(() => {
|
|
75
75
|
const e = new AbortController();
|
|
76
76
|
return (async () => {
|
|
77
|
-
if (!d || !
|
|
78
|
-
const a = /* @__PURE__ */ new Set(),
|
|
79
|
-
for (let
|
|
80
|
-
const
|
|
77
|
+
if (!d || !s) return;
|
|
78
|
+
const a = /* @__PURE__ */ new Set(), g = F(s);
|
|
79
|
+
for (let l = 0; l < g.length; l++) {
|
|
80
|
+
const b = B(g[l].url);
|
|
81
81
|
try {
|
|
82
|
-
(await fetch(
|
|
82
|
+
(await fetch(b, {
|
|
83
83
|
method: "HEAD",
|
|
84
84
|
signal: e.signal
|
|
85
|
-
})).ok || a.add(
|
|
85
|
+
})).ok || a.add(l);
|
|
86
86
|
} catch (L) {
|
|
87
|
-
L instanceof Error && L.name !== "AbortError" && a.add(
|
|
87
|
+
L instanceof Error && L.name !== "AbortError" && a.add(l);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
e.signal.aborted || A(a);
|
|
91
91
|
})(), () => e.abort();
|
|
92
|
-
}, [d,
|
|
93
|
-
const
|
|
92
|
+
}, [d, s]);
|
|
93
|
+
const q = p(
|
|
94
94
|
(e, t) => {
|
|
95
|
-
t !==
|
|
95
|
+
t !== i ? ($(t), O(1), C(void 0)) : O(e);
|
|
96
96
|
},
|
|
97
|
-
[
|
|
98
|
-
),
|
|
99
|
-
() => n?.fields ??
|
|
97
|
+
[i]
|
|
98
|
+
), D = _(
|
|
99
|
+
() => n?.fields ?? Te,
|
|
100
100
|
[n?.fields]
|
|
101
|
-
),
|
|
102
|
-
() =>
|
|
101
|
+
), j = _(() => [...u?.documents ?? []].sort((t, a) => !t.uploadedOn && !a.uploadedOn ? 0 : t.uploadedOn ? a.uploadedOn ? new Date(a.uploadedOn).getTime() - new Date(t.uploadedOn).getTime() : -1 : 1), [u]), K = _(() => he(D, o), [D, o]), G = _(
|
|
102
|
+
() => D.map((e) => ({
|
|
103
103
|
key: e,
|
|
104
104
|
sortable: e !== "action"
|
|
105
105
|
})),
|
|
106
|
-
[
|
|
107
|
-
), h =
|
|
108
|
-
() =>
|
|
109
|
-
[
|
|
110
|
-
),
|
|
106
|
+
[D]
|
|
107
|
+
), h = _(
|
|
108
|
+
() => s ? F(s) : [],
|
|
109
|
+
[s]
|
|
110
|
+
), Q = p(
|
|
111
111
|
(e, t) => {
|
|
112
112
|
switch (t) {
|
|
113
113
|
case "documentIdentifier":
|
|
114
|
-
return /* @__PURE__ */
|
|
114
|
+
return /* @__PURE__ */ r("span", { children: e.documentIdentifier });
|
|
115
115
|
case "documentType":
|
|
116
116
|
return e.documentType ?? o("DOCUMENTS_NOT_AVAILABLE");
|
|
117
117
|
case "uploadedOn":
|
|
@@ -123,10 +123,10 @@ const _e = [
|
|
|
123
123
|
case "uploadedBy":
|
|
124
124
|
return e.uploadedBy ?? o("DOCUMENTS_NOT_AVAILABLE");
|
|
125
125
|
case "action":
|
|
126
|
-
return e.attachments.length > 0 || !!e.documentUrl ? /* @__PURE__ */
|
|
126
|
+
return e.attachments.length > 0 || !!e.documentUrl ? /* @__PURE__ */ r(
|
|
127
127
|
Z,
|
|
128
128
|
{
|
|
129
|
-
onClick: () =>
|
|
129
|
+
onClick: () => v(e),
|
|
130
130
|
className: c.viewAttachmentsLink,
|
|
131
131
|
"data-testid": `view-attachments-${e.id}`,
|
|
132
132
|
children: o("DOCUMENTS_VIEW_ATTACHMENTS")
|
|
@@ -136,87 +136,87 @@ const _e = [
|
|
|
136
136
|
return null;
|
|
137
137
|
}
|
|
138
138
|
},
|
|
139
|
-
[
|
|
139
|
+
[v, o]
|
|
140
140
|
);
|
|
141
|
-
return /* @__PURE__ */
|
|
142
|
-
/* @__PURE__ */
|
|
141
|
+
return /* @__PURE__ */ T(Y, { children: [
|
|
142
|
+
/* @__PURE__ */ r("div", { "data-testid": "documents-table", children: /* @__PURE__ */ r(
|
|
143
143
|
ee,
|
|
144
144
|
{
|
|
145
|
-
headers:
|
|
145
|
+
headers: K,
|
|
146
146
|
ariaLabel: o("DOCUMENTS_TABLE_HEADING"),
|
|
147
|
-
rows:
|
|
148
|
-
loading:
|
|
147
|
+
rows: j,
|
|
148
|
+
loading: H,
|
|
149
149
|
errorStateMessage: S ? y?.message : null,
|
|
150
|
-
sortable:
|
|
150
|
+
sortable: G,
|
|
151
151
|
emptyStateMessage: o("DOCUMENTS_NO_RECORDS"),
|
|
152
|
-
renderCell:
|
|
152
|
+
renderCell: Q,
|
|
153
153
|
className: c.documentsTableBody,
|
|
154
154
|
dataTestId: "documents-table",
|
|
155
|
-
pageSize:
|
|
155
|
+
pageSize: i,
|
|
156
156
|
totalItems: k,
|
|
157
|
-
page:
|
|
158
|
-
onPageChange:
|
|
157
|
+
page: N,
|
|
158
|
+
onPageChange: q
|
|
159
159
|
}
|
|
160
160
|
) }),
|
|
161
|
-
d &&
|
|
161
|
+
d && s && /* @__PURE__ */ r(
|
|
162
162
|
te,
|
|
163
163
|
{
|
|
164
164
|
id: "modalIdForActionAreaLayout",
|
|
165
165
|
portalId: "main-display-area",
|
|
166
166
|
open: d,
|
|
167
|
-
onRequestClose:
|
|
168
|
-
modalHeading:
|
|
167
|
+
onRequestClose: z,
|
|
168
|
+
modalHeading: s.documentIdentifier,
|
|
169
169
|
passiveModal: !0,
|
|
170
170
|
size: "lg",
|
|
171
171
|
testId: "document-view-modal",
|
|
172
|
-
children: /* @__PURE__ */
|
|
173
|
-
const a =
|
|
174
|
-
return a === "#" ||
|
|
172
|
+
children: /* @__PURE__ */ r("div", { className: c.documentViewerContainer, children: h.map((e, t) => {
|
|
173
|
+
const a = B(e.url), g = e.contentType?.toLowerCase().includes("pdf"), l = (e.contentType?.toLowerCase().includes("image") ?? !1) || pe.test(e.url ?? ""), b = P.has(t);
|
|
174
|
+
return a === "#" || b ? /* @__PURE__ */ T(
|
|
175
175
|
"div",
|
|
176
176
|
{
|
|
177
177
|
className: c.attachmentError,
|
|
178
178
|
"data-testid": `attachment-error-${t}`,
|
|
179
179
|
children: [
|
|
180
|
-
h.length > 1 && /* @__PURE__ */
|
|
180
|
+
h.length > 1 && /* @__PURE__ */ T("p", { className: c.attachmentCounter, children: [
|
|
181
181
|
t + 1,
|
|
182
182
|
"/",
|
|
183
183
|
h.length
|
|
184
184
|
] }),
|
|
185
|
-
/* @__PURE__ */
|
|
185
|
+
/* @__PURE__ */ r("p", { children: o("DOCUMENTS_ERROR_LOADING_ATTACHMENT") })
|
|
186
186
|
]
|
|
187
187
|
},
|
|
188
|
-
`${
|
|
189
|
-
) : /* @__PURE__ */
|
|
188
|
+
`${s.id}-${e.url}`
|
|
189
|
+
) : /* @__PURE__ */ T(
|
|
190
190
|
"div",
|
|
191
191
|
{
|
|
192
192
|
className: c.attachmentItem,
|
|
193
193
|
"data-testid": `attachment-item-${t}`,
|
|
194
194
|
children: [
|
|
195
|
-
h.length > 1 && /* @__PURE__ */
|
|
195
|
+
h.length > 1 && /* @__PURE__ */ T("p", { className: c.attachmentCounter, children: [
|
|
196
196
|
t + 1,
|
|
197
197
|
"/",
|
|
198
198
|
h.length
|
|
199
199
|
] }),
|
|
200
|
-
|
|
200
|
+
l ? /* @__PURE__ */ r(
|
|
201
201
|
"img",
|
|
202
202
|
{
|
|
203
203
|
src: a,
|
|
204
|
-
alt:
|
|
204
|
+
alt: s.documentIdentifier,
|
|
205
205
|
className: c.documentImage,
|
|
206
|
-
onError: () =>
|
|
206
|
+
onError: () => R(t)
|
|
207
207
|
}
|
|
208
|
-
) : /* @__PURE__ */
|
|
208
|
+
) : /* @__PURE__ */ r(
|
|
209
209
|
"iframe",
|
|
210
210
|
{
|
|
211
|
-
src:
|
|
211
|
+
src: g ? `${a}#toolbar=0` : a,
|
|
212
212
|
className: c.documentIframe,
|
|
213
|
-
title:
|
|
214
|
-
onError: () =>
|
|
213
|
+
title: s.documentIdentifier,
|
|
214
|
+
onError: () => R(t)
|
|
215
215
|
}
|
|
216
216
|
)
|
|
217
217
|
]
|
|
218
218
|
},
|
|
219
|
-
`${
|
|
219
|
+
`${s.id}-${e.url}`
|
|
220
220
|
);
|
|
221
221
|
}) })
|
|
222
222
|
}
|
|
@@ -224,5 +224,5 @@ const _e = [
|
|
|
224
224
|
] });
|
|
225
225
|
};
|
|
226
226
|
export {
|
|
227
|
-
|
|
227
|
+
Ie as default
|
|
228
228
|
};
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { jsx as n, jsxs as Z, Fragment as ee } from "react/jsx-runtime";
|
|
2
|
+
import { z as re, u as te, D as oe, K as ae, Y as se, G as ne, I as de, c as ie, M as U, T as me, b as le, m as x, e as ce, t as ue, y as fe, O as ye } from "./index-CG6CxLD9.js";
|
|
3
|
+
import { useQueryClient as be, useQuery as y } from "@tanstack/react-query";
|
|
4
|
+
import { useState as k, useMemo as d, useCallback as b } from "react";
|
|
5
|
+
import { useTranslation as pe } from "react-i18next";
|
|
6
|
+
const ge = "FormsTable-module_formsTableBody__SvGha", Fe = "FormsTable-module_customAccordianItem__isszs", O = {
|
|
7
|
+
formsTableBody: ge,
|
|
8
|
+
customAccordianItem: Fe
|
|
9
|
+
}, he = (m) => m ? m.extension?.find(
|
|
10
|
+
(p) => p.url === re
|
|
11
|
+
)?.valueString : void 0, Me = ({
|
|
12
|
+
episodeOfCareUuids: m,
|
|
13
|
+
encounterUuids: i,
|
|
14
|
+
config: p
|
|
15
|
+
}) => {
|
|
16
|
+
const { t: s } = pe(), l = te(), [c, D] = k(!1), [o, I] = k(null), {
|
|
17
|
+
numberOfVisits: K,
|
|
18
|
+
hideThumbnail: P = !1,
|
|
19
|
+
forms: u
|
|
20
|
+
} = p ?? {}, M = oe(
|
|
21
|
+
m,
|
|
22
|
+
i
|
|
23
|
+
), w = be(), {
|
|
24
|
+
data: A = [],
|
|
25
|
+
isLoading: T,
|
|
26
|
+
isError: v,
|
|
27
|
+
error: z,
|
|
28
|
+
refetch: G
|
|
29
|
+
} = y({
|
|
30
|
+
queryKey: ["forms", l, m],
|
|
31
|
+
queryFn: () => ae(l, void 0, K),
|
|
32
|
+
enabled: !!l && !M
|
|
33
|
+
}), B = d(() => {
|
|
34
|
+
let e = A;
|
|
35
|
+
return i && i.length > 0 && (e = e.filter(
|
|
36
|
+
(t) => i.includes(t.encounterUuid)
|
|
37
|
+
)), Array.isArray(u) && u.length > 0 && (e = e.filter(
|
|
38
|
+
(t) => u.some((r) => r.toLowerCase() === t.formName.toLowerCase())
|
|
39
|
+
)), e;
|
|
40
|
+
}, [A, i, u]), { data: L = [] } = y({
|
|
41
|
+
queryKey: ["observationForms"],
|
|
42
|
+
queryFn: () => se()
|
|
43
|
+
}), R = b(
|
|
44
|
+
(e) => L.find((r) => r.name === e)?.uuid,
|
|
45
|
+
[L]
|
|
46
|
+
), g = d(() => {
|
|
47
|
+
if (o)
|
|
48
|
+
return R(o.formName);
|
|
49
|
+
}, [o, R]), {
|
|
50
|
+
isLoading: H,
|
|
51
|
+
isError: j,
|
|
52
|
+
error: F
|
|
53
|
+
} = y({
|
|
54
|
+
queryKey: ["formMetadata", g],
|
|
55
|
+
queryFn: () => ne(g),
|
|
56
|
+
enabled: !!g && c
|
|
57
|
+
}), {
|
|
58
|
+
data: h,
|
|
59
|
+
isLoading: V,
|
|
60
|
+
isError: $,
|
|
61
|
+
error: N
|
|
62
|
+
} = y({
|
|
63
|
+
queryKey: ["formsEncounterFHIR", o?.encounterUuid],
|
|
64
|
+
queryFn: () => de(o.encounterUuid),
|
|
65
|
+
enabled: !!o?.encounterUuid && c
|
|
66
|
+
});
|
|
67
|
+
ie(
|
|
68
|
+
(e) => {
|
|
69
|
+
e.patientUUID === l && e.updatedConcepts.size > 0 && (G(), w.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
|
|
70
|
+
},
|
|
71
|
+
[l]
|
|
72
|
+
);
|
|
73
|
+
const Q = d(() => !h?.entry || !o?.formName ? [] : h.entry.filter((t) => t.resource?.resourceType === "Observation").map((t) => t.resource).filter((t) => {
|
|
74
|
+
const r = he(t);
|
|
75
|
+
return !r || r.includes(o.formName);
|
|
76
|
+
}), [h, o?.formName]), Y = d(() => {
|
|
77
|
+
if (F)
|
|
78
|
+
return U(F).message;
|
|
79
|
+
if (N)
|
|
80
|
+
return U(N).message;
|
|
81
|
+
}, [F, N]), _ = d(
|
|
82
|
+
() => [
|
|
83
|
+
{ key: "recordedOn", header: s("RECORDED_ON") },
|
|
84
|
+
{ key: "recordedBy", header: s("RECORDED_BY") }
|
|
85
|
+
],
|
|
86
|
+
[s]
|
|
87
|
+
), J = d(
|
|
88
|
+
() => [
|
|
89
|
+
{ key: "recordedOn", sortable: !0 },
|
|
90
|
+
{ key: "recordedBy", sortable: !0 }
|
|
91
|
+
],
|
|
92
|
+
[]
|
|
93
|
+
), C = d(() => {
|
|
94
|
+
const e = B.reduce(
|
|
95
|
+
(r, a) => {
|
|
96
|
+
const f = a.formName;
|
|
97
|
+
r[f] ??= [];
|
|
98
|
+
const E = a.providers.map((X) => X.providerName).filter(Boolean).join(", ");
|
|
99
|
+
return r[f].push({
|
|
100
|
+
id: a.encounterUuid,
|
|
101
|
+
formName: a.formName,
|
|
102
|
+
recordedOn: me(a.encounterDateTime, s, !0).formattedResult,
|
|
103
|
+
recordedBy: E ?? "--",
|
|
104
|
+
encounterDateTime: a.encounterDateTime,
|
|
105
|
+
encounterUuid: a.encounterUuid
|
|
106
|
+
}), r;
|
|
107
|
+
},
|
|
108
|
+
{}
|
|
109
|
+
);
|
|
110
|
+
return Object.entries(e).map(
|
|
111
|
+
([r, a]) => ({
|
|
112
|
+
formName: r,
|
|
113
|
+
records: a.sort(
|
|
114
|
+
(f, E) => E.encounterDateTime - f.encounterDateTime
|
|
115
|
+
)
|
|
116
|
+
})
|
|
117
|
+
).sort((r, a) => r.formName.localeCompare(a.formName));
|
|
118
|
+
}, [B, s]), S = b((e) => {
|
|
119
|
+
I(e), D(!0);
|
|
120
|
+
}, []), W = b(() => {
|
|
121
|
+
D(!1), I(null);
|
|
122
|
+
}, []), q = b(
|
|
123
|
+
(e, t) => {
|
|
124
|
+
switch (t) {
|
|
125
|
+
case "recordedOn":
|
|
126
|
+
return /* @__PURE__ */ n(le, { onClick: () => S(e), children: e.recordedOn });
|
|
127
|
+
case "recordedBy":
|
|
128
|
+
return e.recordedBy;
|
|
129
|
+
default:
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
[S]
|
|
134
|
+
);
|
|
135
|
+
return /* @__PURE__ */ Z(ee, { children: [
|
|
136
|
+
/* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: T || v || C.length === 0 || M ? /* @__PURE__ */ n(
|
|
137
|
+
x,
|
|
138
|
+
{
|
|
139
|
+
headers: _,
|
|
140
|
+
ariaLabel: s("FORMS_HEADING"),
|
|
141
|
+
rows: [],
|
|
142
|
+
loading: T,
|
|
143
|
+
errorStateMessage: v ? z?.message : void 0,
|
|
144
|
+
emptyStateMessage: s("FORMS_UNAVAILABLE"),
|
|
145
|
+
renderCell: q,
|
|
146
|
+
className: O.formsTableBody,
|
|
147
|
+
dataTestId: "forms-table"
|
|
148
|
+
}
|
|
149
|
+
) : /* @__PURE__ */ n(ce, { align: "start", children: C.map((e, t) => {
|
|
150
|
+
const { formName: r, records: a } = e;
|
|
151
|
+
return /* @__PURE__ */ n(
|
|
152
|
+
ue,
|
|
153
|
+
{
|
|
154
|
+
title: r,
|
|
155
|
+
className: O.customAccordianItem,
|
|
156
|
+
testId: `accordian-title-${r}`,
|
|
157
|
+
open: t === 0,
|
|
158
|
+
children: /* @__PURE__ */ n(
|
|
159
|
+
x,
|
|
160
|
+
{
|
|
161
|
+
headers: _,
|
|
162
|
+
ariaLabel: s("FORMS_HEADING"),
|
|
163
|
+
rows: a,
|
|
164
|
+
loading: !1,
|
|
165
|
+
errorStateMessage: "",
|
|
166
|
+
sortable: J,
|
|
167
|
+
emptyStateMessage: s("FORMS_UNAVAILABLE"),
|
|
168
|
+
renderCell: q,
|
|
169
|
+
className: O.formsTableBody,
|
|
170
|
+
dataTestId: `forms-table-${r}`
|
|
171
|
+
}
|
|
172
|
+
)
|
|
173
|
+
},
|
|
174
|
+
r
|
|
175
|
+
);
|
|
176
|
+
}) }) }),
|
|
177
|
+
c && o && /* @__PURE__ */ n(
|
|
178
|
+
fe,
|
|
179
|
+
{
|
|
180
|
+
id: "modalIdForActionAreaLayout",
|
|
181
|
+
portalId: "main-display-area",
|
|
182
|
+
open: c,
|
|
183
|
+
onRequestClose: W,
|
|
184
|
+
modalHeading: o.formName,
|
|
185
|
+
modalLabel: `${o.recordedOn} | ${o.recordedBy}`,
|
|
186
|
+
passiveModal: !0,
|
|
187
|
+
size: "md",
|
|
188
|
+
testId: "form-details-modal",
|
|
189
|
+
children: /* @__PURE__ */ n(
|
|
190
|
+
ye,
|
|
191
|
+
{
|
|
192
|
+
observations: Q,
|
|
193
|
+
isLoading: H || V,
|
|
194
|
+
isError: j || $,
|
|
195
|
+
errorMessage: Y,
|
|
196
|
+
emptyStateMessage: s("NO_FORM_DATA_AVAILABLE"),
|
|
197
|
+
testIdPrefix: o.formName,
|
|
198
|
+
hideThumbnail: P
|
|
199
|
+
}
|
|
200
|
+
)
|
|
201
|
+
}
|
|
202
|
+
)
|
|
203
|
+
] });
|
|
204
|
+
};
|
|
205
|
+
export {
|
|
206
|
+
Me as default
|
|
207
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as l, jsxs as
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as l, jsxs as C } from "react/jsx-runtime";
|
|
2
|
+
import { f as V, x as D, d as k, g as w, i as Q, h as q, j as G, k as P, u as j, a as z, l as H, n as J, c as Y, o as x, q as W, s as X, r as Z, m as ee } from "./index-CG6CxLD9.js";
|
|
3
3
|
import { useQueries as te, useQuery as se } from "@tanstack/react-query";
|
|
4
|
-
import { useRef as oe, useEffect as
|
|
4
|
+
import { useRef as oe, useEffect as S, useMemo as h } from "react";
|
|
5
5
|
import { useTranslation as U } from "react-i18next";
|
|
6
6
|
const B = (t, i, c, d, u, r) => {
|
|
7
|
-
const s = k(t, i, u), o = s.value, a =
|
|
7
|
+
const s = k(t, i, u), o = s.value, a = w(o);
|
|
8
8
|
let n = o;
|
|
9
9
|
a === "Image" && (n = /* @__PURE__ */ l(
|
|
10
10
|
q,
|
|
@@ -24,7 +24,7 @@ const B = (t, i, c, d, u, r) => {
|
|
|
24
24
|
)), a === "PDF" && (n = /* @__PURE__ */ l(P, { id: `${o}-pdf`, src: o }));
|
|
25
25
|
const b = u("OBSERVATIONS_RECORDED_BY", {
|
|
26
26
|
provider: s.provider
|
|
27
|
-
}),
|
|
27
|
+
}), m = t.display, p = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", y = d ? `${d}-${p}-${m}-${c}-${i}` : `${p}-${m}-${c}-${i}`;
|
|
28
28
|
return /* @__PURE__ */ l(
|
|
29
29
|
Q,
|
|
30
30
|
{
|
|
@@ -62,7 +62,7 @@ const B = (t, i, c, d, u, r) => {
|
|
|
62
62
|
}) => {
|
|
63
63
|
const { t: d } = U(), u = (r, s, o) => {
|
|
64
64
|
const a = V(r.encounterDetails, d);
|
|
65
|
-
return /* @__PURE__ */
|
|
65
|
+
return /* @__PURE__ */ C(
|
|
66
66
|
D,
|
|
67
67
|
{
|
|
68
68
|
title: a,
|
|
@@ -106,7 +106,7 @@ const B = (t, i, c, d, u, r) => {
|
|
|
106
106
|
)
|
|
107
107
|
}
|
|
108
108
|
);
|
|
109
|
-
}, ne = "
|
|
109
|
+
}, ne = "Observations-module_observations__RKSyo", ie = "Observations-module_title__TJL3z", N = {
|
|
110
110
|
observations: ne,
|
|
111
111
|
title: ie
|
|
112
112
|
}, ce = (t) => ["conceptUuid", t], de = (t, i) => ["observations", t, ...i], ve = ({ config: t }) => {
|
|
@@ -114,59 +114,59 @@ const B = (t, i, c, d, u, r) => {
|
|
|
114
114
|
conceptNames: c = [],
|
|
115
115
|
conceptUuid: d = [],
|
|
116
116
|
hideThumbnail: u = !1
|
|
117
|
-
} = i, r = oe(/* @__PURE__ */ new Set()), s = j(), { addNotification: o } =
|
|
117
|
+
} = i, r = oe(/* @__PURE__ */ new Set()), s = j(), { addNotification: o } = z(), { t: a } = U(), n = te({
|
|
118
118
|
queries: c.map((e) => ({
|
|
119
119
|
queryKey: ce(e),
|
|
120
|
-
queryFn: () =>
|
|
120
|
+
queryFn: () => H(e),
|
|
121
121
|
enabled: !!e
|
|
122
122
|
}))
|
|
123
123
|
});
|
|
124
|
-
|
|
124
|
+
S(() => {
|
|
125
125
|
n.forEach((e, v) => {
|
|
126
126
|
if (e.isError && !r.current.has(v)) {
|
|
127
|
-
const
|
|
127
|
+
const T = c[v];
|
|
128
128
|
o({
|
|
129
129
|
title: a("ERROR_DEFAULT_TITLE"),
|
|
130
|
-
message: a("ERROR_FETCHING_CONCEPT", { conceptName:
|
|
130
|
+
message: a("ERROR_FETCHING_CONCEPT", { conceptName: T }),
|
|
131
131
|
type: "error"
|
|
132
132
|
}), r.current.add(v);
|
|
133
133
|
} else e.isError || r.current.delete(v);
|
|
134
134
|
});
|
|
135
135
|
}, [n, c]);
|
|
136
|
-
const b = h(() => n.map((e) => e.data?.uuid).filter((e) => !!e), [n]),
|
|
137
|
-
data:
|
|
136
|
+
const b = h(() => n.map((e) => e.data?.uuid).filter((e) => !!e), [n]), m = h(() => [.../* @__PURE__ */ new Set([...b, ...d])], [b, d]), f = h(() => c.length === 0 ? !0 : n.every((e) => !e.isLoading), [n, c.length]), {
|
|
137
|
+
data: p,
|
|
138
138
|
isLoading: y,
|
|
139
139
|
isError: g,
|
|
140
|
-
refetch:
|
|
140
|
+
refetch: R
|
|
141
141
|
} = se({
|
|
142
|
-
queryKey: de(s,
|
|
143
|
-
queryFn: () =>
|
|
144
|
-
enabled: !!s &&
|
|
142
|
+
queryKey: de(s, m),
|
|
143
|
+
queryFn: () => J(s, m),
|
|
144
|
+
enabled: !!s && m.length > 0 && f
|
|
145
145
|
});
|
|
146
146
|
Y(
|
|
147
147
|
(e) => {
|
|
148
148
|
e.patientUUID === s && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
|
|
149
|
-
(
|
|
150
|
-
) &&
|
|
149
|
+
(T) => m.includes(T)
|
|
150
|
+
) && R();
|
|
151
151
|
},
|
|
152
|
-
[s,
|
|
153
|
-
),
|
|
152
|
+
[s, R]
|
|
153
|
+
), S(() => {
|
|
154
154
|
g && o({
|
|
155
155
|
title: a("ERROR_DEFAULT_TITLE"),
|
|
156
156
|
message: a("ERROR_FETCHING_OBSERVATIONS"),
|
|
157
157
|
type: "error"
|
|
158
158
|
});
|
|
159
159
|
}, [g]);
|
|
160
|
-
const
|
|
161
|
-
if (!
|
|
162
|
-
const e =
|
|
160
|
+
const _ = h(() => {
|
|
161
|
+
if (!p) return [];
|
|
162
|
+
const e = x(p), v = W(e);
|
|
163
163
|
return X(v);
|
|
164
|
-
}, [
|
|
164
|
+
}, [p]), A = [
|
|
165
165
|
{ key: "name", header: "name" },
|
|
166
166
|
{ key: "value", header: "value" },
|
|
167
167
|
{ key: "form", header: "form" }
|
|
168
|
-
],
|
|
169
|
-
return /* @__PURE__ */
|
|
168
|
+
], I = y || !f, $ = g && f, F = (!p || p.entry?.length === 0 || m.length === 0) && f, L = $ ? a("ERROR_FETCHING_OBSERVATIONS") : null, K = F ? a("NO_OBSERVATIONS_FOUND") : void 0, M = _.length > 0 && !I && !$, O = i.titleTranslationKey, E = O ? a(O) : "";
|
|
169
|
+
return /* @__PURE__ */ C(
|
|
170
170
|
"div",
|
|
171
171
|
{
|
|
172
172
|
id: "observations",
|
|
@@ -187,7 +187,7 @@ const B = (t, i, c, d, u, r) => {
|
|
|
187
187
|
M ? /* @__PURE__ */ l(
|
|
188
188
|
ae,
|
|
189
189
|
{
|
|
190
|
-
groupedData:
|
|
190
|
+
groupedData: _,
|
|
191
191
|
title: E,
|
|
192
192
|
hideThumbnail: u
|
|
193
193
|
}
|
|
@@ -197,9 +197,9 @@ const B = (t, i, c, d, u, r) => {
|
|
|
197
197
|
headers: A,
|
|
198
198
|
rows: [],
|
|
199
199
|
ariaLabel: a("OBSERVATIONS"),
|
|
200
|
-
loading:
|
|
200
|
+
loading: I,
|
|
201
201
|
errorStateMessage: L,
|
|
202
|
-
emptyStateMessage:
|
|
202
|
+
emptyStateMessage: K,
|
|
203
203
|
dataTestId: "observations-table"
|
|
204
204
|
}
|
|
205
205
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormsTable.d.ts","sourceRoot":"","sources":["../../src/forms/FormsTable.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAG9D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"FormsTable.d.ts","sourceRoot":"","sources":["../../src/forms/FormsTable.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAG9D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAWhD;;;GAGG;AACH,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAwSrC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|