@bahmni/reports-app 0.0.1-dev.424 → 0.0.1-dev.425
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-UkcrH_C6-zRHXTTTR.js → DocumentsTable-Dbzg_SOZ-CBCxlBWf.js} +12 -12
- package/dist/{FormsTable-DLTsXZ-p-D0mnsZiI.js → FormsTable-BMa68g2K-ulhZCvD6.js} +72 -72
- package/dist/{LNWAZHJI-Cxi_5FDX.js → LNWAZHJI-DXtKGI34.js} +2 -2
- package/dist/{MWZ6AO7Z-CacP6p_H.js → MWZ6AO7Z-B9WXpsWU.js} +2 -2
- package/dist/{Observations-DLpjVw7J-D6qxEqW6.js → Observations-DxmGTSMO-DQ_1fZxL.js} +59 -59
- package/dist/{ReportsPage-DEDTNiLx.js → ReportsPage-OQLqI347.js} +8 -8
- package/dist/{YPM2AS64-B3xeYlPj.js → YPM2AS64-9u-qHMWS.js} +1 -1
- package/dist/{index-DzhWhDfi.js → index-Drn6hy5Z.js} +49 -49
- package/dist/index.css +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as r, jsxs as p, Fragment as Y } from "react/jsx-runtime";
|
|
2
|
-
import { g as x, u as G, z as W,
|
|
2
|
+
import { g as x, u as G, z as W, U as J, K as X, w as Z, Y as ee, p as te } from "./index-Drn6hy5Z.js";
|
|
3
3
|
import { useQuery as ae } from "@tanstack/react-query";
|
|
4
4
|
import { useState as l, useCallback as h, useEffect as I, useMemo as _ } from "react";
|
|
5
5
|
const ne = "DocumentsTable-module_documentsTableBody__6iR3w", oe = "DocumentsTable-module_viewAttachmentsLink__aQ1on", re = "DocumentsTable-module_documentViewerContainer__F5m8D", de = "DocumentsTable-module_attachmentItem__17KA7", se = "DocumentsTable-module_attachmentCounter__WFiI3", me = "DocumentsTable-module_attachmentError__RI4U2", ce = "DocumentsTable-module_documentIframe__ptq5I", le = "DocumentsTable-module_documentImage__KQVgS", d = {
|
|
@@ -38,13 +38,13 @@ const Te = [
|
|
|
38
38
|
null
|
|
39
39
|
), [$, O] = l(
|
|
40
40
|
/* @__PURE__ */ new Set()
|
|
41
|
-
), E = x(), { t: n } = G(), { addNotification: L } = W(), k = Number(a?.pageSize) || 5, [f, C] = l(1), [u,
|
|
41
|
+
), E = x(), { t: n } = G(), { addNotification: L } = W(), k = Number(a?.pageSize) || 5, [f, C] = l(1), [u, V] = l(k), [F, A] = l(void 0), M = h((e) => {
|
|
42
42
|
U(e), w(!0);
|
|
43
|
-
}, []),
|
|
43
|
+
}, []), H = h(() => {
|
|
44
44
|
w(!1), U(null), O(/* @__PURE__ */ new Set());
|
|
45
45
|
}, []), v = h((e) => {
|
|
46
46
|
O((t) => new Set(t).add(e));
|
|
47
|
-
}, []), { data: i, isLoading:
|
|
47
|
+
}, []), { data: i, isLoading: q, isError: y, error: b } = ae({
|
|
48
48
|
queryKey: [
|
|
49
49
|
"documents",
|
|
50
50
|
E,
|
|
@@ -91,13 +91,13 @@ const Te = [
|
|
|
91
91
|
}, [s, o]);
|
|
92
92
|
const z = h(
|
|
93
93
|
(e, t) => {
|
|
94
|
-
t !== u ? (
|
|
94
|
+
t !== u ? (V(t), C(1), A(void 0)) : C(e);
|
|
95
95
|
},
|
|
96
96
|
[u]
|
|
97
97
|
), N = _(
|
|
98
98
|
() => a?.fields ?? Te,
|
|
99
99
|
[a?.fields]
|
|
100
|
-
),
|
|
100
|
+
), K = _(() => [...i?.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), [i]), j = _(() => ie(N, n), [N, n]), P = _(
|
|
101
101
|
() => N.map((e) => ({
|
|
102
102
|
key: e,
|
|
103
103
|
sortable: e !== "attachments"
|
|
@@ -141,18 +141,18 @@ const Te = [
|
|
|
141
141
|
/* @__PURE__ */ r("div", { "data-testid": "documents-table", children: /* @__PURE__ */ r(
|
|
142
142
|
ee,
|
|
143
143
|
{
|
|
144
|
-
headers:
|
|
144
|
+
headers: j,
|
|
145
145
|
ariaLabel: n("DOCUMENTS_TABLE_HEADING"),
|
|
146
|
-
rows:
|
|
147
|
-
loading:
|
|
146
|
+
rows: K,
|
|
147
|
+
loading: q,
|
|
148
148
|
errorStateMessage: y ? b?.message : null,
|
|
149
|
-
sortable:
|
|
149
|
+
sortable: P,
|
|
150
150
|
emptyStateMessage: n("DOCUMENTS_NO_RECORDS"),
|
|
151
151
|
renderCell: Q,
|
|
152
152
|
className: d.documentsTableBody,
|
|
153
153
|
dataTestId: "documents-table",
|
|
154
154
|
pageSize: u,
|
|
155
|
-
totalItems:
|
|
155
|
+
totalItems: F,
|
|
156
156
|
page: f,
|
|
157
157
|
onPageChange: z
|
|
158
158
|
}
|
|
@@ -163,7 +163,7 @@ const Te = [
|
|
|
163
163
|
id: "modalIdForActionAreaLayout",
|
|
164
164
|
portalId: "main-display-area",
|
|
165
165
|
open: s,
|
|
166
|
-
onRequestClose:
|
|
166
|
+
onRequestClose: H,
|
|
167
167
|
modalHeading: o.documentIdentifier,
|
|
168
168
|
passiveModal: !0,
|
|
169
169
|
size: "lg",
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { jsx as n, jsxs as
|
|
2
|
-
import { u as he, g as
|
|
3
|
-
import { useQueryClient as we, useQuery as
|
|
1
|
+
import { jsx as n, jsxs as K, Fragment as ge } from "react/jsx-runtime";
|
|
2
|
+
import { u as he, g as Oe, h as Te, Z as Ne, y as be, j as Ie, e as Ee, O as Ae, a as _e, m as Fe, f as ve, $ as Me, S as Ce, b as x, w as Se, C as G, H as z, K as Be, Y as P, F as De, c as Le, p as Ue, v as Re, l as ke } from "./index-Drn6hy5Z.js";
|
|
3
|
+
import { useQueryClient as we, useQuery as T } from "@tanstack/react-query";
|
|
4
4
|
import { useState as Q, useMemo as i, useCallback as d } from "react";
|
|
5
|
-
const
|
|
6
|
-
formsTableBody:
|
|
7
|
-
modalHeading:
|
|
8
|
-
customAccordianItem:
|
|
9
|
-
},
|
|
10
|
-
episodeOfCareUuids:
|
|
5
|
+
const qe = "FormsTable-module_formsTableBody__SvGha", He = "FormsTable-module_modalHeading__wnTmA", Ve = "FormsTable-module_customAccordianItem__isszs", N = {
|
|
6
|
+
formsTableBody: qe,
|
|
7
|
+
modalHeading: He,
|
|
8
|
+
customAccordianItem: Ve
|
|
9
|
+
}, $e = "startConsultation", ze = ({
|
|
10
|
+
episodeOfCareUuids: v,
|
|
11
11
|
encounterUuids: l,
|
|
12
|
-
config:
|
|
13
|
-
disableActions:
|
|
12
|
+
config: Y,
|
|
13
|
+
disableActions: Z = !1,
|
|
14
14
|
activeEncounterUuid: y = null
|
|
15
15
|
}) => {
|
|
16
|
-
const { t } = he(), m =
|
|
17
|
-
numberOfVisits:
|
|
16
|
+
const { t } = he(), m = Oe(), [p, M] = Q(!1), [o, C] = Q(null), {
|
|
17
|
+
numberOfVisits: X,
|
|
18
18
|
hideThumbnail: J = !1,
|
|
19
19
|
forms: g
|
|
20
|
-
} =
|
|
21
|
-
|
|
22
|
-
), { userPrivileges: h } =
|
|
23
|
-
|
|
20
|
+
} = Y ?? {}, W = Te(
|
|
21
|
+
ke.EDIT_OBSERVATIONS
|
|
22
|
+
), { userPrivileges: h } = Ne(), b = W && !Z && !!y, S = be(
|
|
23
|
+
v,
|
|
24
24
|
l
|
|
25
25
|
), ee = we(), {
|
|
26
|
-
data:
|
|
26
|
+
data: B = [],
|
|
27
27
|
isLoading: D,
|
|
28
28
|
isError: L,
|
|
29
29
|
error: re,
|
|
30
30
|
refetch: ae
|
|
31
|
-
} =
|
|
32
|
-
queryKey: ["forms", m,
|
|
33
|
-
queryFn: () => Ie(m, void 0,
|
|
31
|
+
} = T({
|
|
32
|
+
queryKey: ["forms", m, v],
|
|
33
|
+
queryFn: () => Ie(m, void 0, X),
|
|
34
34
|
enabled: !!m && !S
|
|
35
35
|
}), U = i(() => {
|
|
36
|
-
let e =
|
|
36
|
+
let e = B;
|
|
37
37
|
return l && l.length > 0 && (e = e.filter(
|
|
38
38
|
(r) => l.includes(r.encounterUuid)
|
|
39
39
|
)), Array.isArray(g) && g.length > 0 && (e = e.filter(
|
|
40
40
|
(r) => g.some((a) => a.toLowerCase() === r.formName.toLowerCase())
|
|
41
41
|
)), e;
|
|
42
|
-
}, [
|
|
42
|
+
}, [B, l, g]), { data: O = [] } = T({
|
|
43
43
|
queryKey: ["observationForms"],
|
|
44
|
-
queryFn: () =>
|
|
44
|
+
queryFn: () => Ee()
|
|
45
45
|
}), R = d(
|
|
46
46
|
(e) => {
|
|
47
|
-
const r =
|
|
47
|
+
const r = O.find((s) => s.name === e);
|
|
48
48
|
if (!r?.privileges || r.privileges.length === 0) return !0;
|
|
49
49
|
if (!h || h.length === 0) return !1;
|
|
50
50
|
const a = new Set(h.map((s) => s.name));
|
|
@@ -52,31 +52,31 @@ const Ve = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
|
|
|
52
52
|
(s) => a.has(s.privilegeName) && s.editable
|
|
53
53
|
);
|
|
54
54
|
},
|
|
55
|
-
[
|
|
55
|
+
[O, h]
|
|
56
56
|
), u = d(
|
|
57
57
|
(e) => !y || e.encounterUuid !== y ? !1 : R(e.formName),
|
|
58
58
|
[y, R]
|
|
59
|
-
),
|
|
60
|
-
(e) =>
|
|
61
|
-
[
|
|
59
|
+
), k = d(
|
|
60
|
+
(e) => O.find((r) => r.name === e)?.uuid,
|
|
61
|
+
[O]
|
|
62
62
|
), I = i(() => {
|
|
63
63
|
if (o)
|
|
64
|
-
return
|
|
65
|
-
}, [o,
|
|
64
|
+
return k(o.formName);
|
|
65
|
+
}, [o, k]), {
|
|
66
66
|
data: w,
|
|
67
67
|
isLoading: oe,
|
|
68
68
|
isError: te,
|
|
69
|
-
error:
|
|
70
|
-
} =
|
|
69
|
+
error: E
|
|
70
|
+
} = T({
|
|
71
71
|
queryKey: ["formMetadata", I],
|
|
72
|
-
queryFn: () =>
|
|
72
|
+
queryFn: () => Ae(I),
|
|
73
73
|
enabled: !!I && p
|
|
74
74
|
}), {
|
|
75
|
-
data:
|
|
75
|
+
data: A,
|
|
76
76
|
isLoading: se,
|
|
77
77
|
isError: ne,
|
|
78
78
|
error: _
|
|
79
|
-
} =
|
|
79
|
+
} = T({
|
|
80
80
|
queryKey: ["formsEncounterFHIR", o?.encounterUuid],
|
|
81
81
|
queryFn: () => _e(o.encounterUuid),
|
|
82
82
|
enabled: !!o?.encounterUuid && p
|
|
@@ -87,33 +87,33 @@ const Ve = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
|
|
|
87
87
|
},
|
|
88
88
|
[m]
|
|
89
89
|
);
|
|
90
|
-
const ie = i(() => !
|
|
91
|
-
() =>
|
|
90
|
+
const ie = i(() => !A?.entry || !o?.formName ? [] : A.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => ve(e) ? Me(e)?.toLowerCase() === o.formName.toLowerCase() : !0), [A, o?.formName]), { controlOrder: de, sectionMap: le, conceptDatatypeMap: me } = i(
|
|
91
|
+
() => Ce(w?.schema),
|
|
92
92
|
[w]
|
|
93
93
|
), ue = i(() => {
|
|
94
|
-
if (
|
|
95
|
-
return
|
|
94
|
+
if (E)
|
|
95
|
+
return x(E).message;
|
|
96
96
|
if (_)
|
|
97
|
-
return
|
|
98
|
-
}, [
|
|
97
|
+
return x(_).message;
|
|
98
|
+
}, [E, _]), c = i(
|
|
99
99
|
() => [
|
|
100
100
|
{ key: "recordedOn", header: t("RECORDED_ON") },
|
|
101
101
|
{ key: "recordedBy", header: t("RECORDED_BY") }
|
|
102
102
|
],
|
|
103
103
|
[t]
|
|
104
|
-
),
|
|
104
|
+
), q = i(
|
|
105
105
|
() => [...c, { key: "actions", header: t("ACTIONS") }],
|
|
106
106
|
[c, t]
|
|
107
107
|
), ce = d(
|
|
108
|
-
(e) => b && e.some((r) => u(r)) ?
|
|
109
|
-
[b, u,
|
|
108
|
+
(e) => b && e.some((r) => u(r)) ? q : c,
|
|
109
|
+
[b, u, q, c]
|
|
110
110
|
), fe = c, ye = i(
|
|
111
111
|
() => [
|
|
112
112
|
{ key: "recordedOn", sortable: !0 },
|
|
113
113
|
{ key: "recordedBy", sortable: !0 }
|
|
114
114
|
],
|
|
115
115
|
[]
|
|
116
|
-
),
|
|
116
|
+
), H = i(() => {
|
|
117
117
|
const e = U.reduce(
|
|
118
118
|
(r, a) => {
|
|
119
119
|
const s = a.formName;
|
|
@@ -138,13 +138,13 @@ const Ve = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
|
|
|
138
138
|
)
|
|
139
139
|
})
|
|
140
140
|
).sort((r, a) => r.formName.localeCompare(a.formName));
|
|
141
|
-
}, [U, t]),
|
|
142
|
-
|
|
143
|
-
}, []),
|
|
144
|
-
|
|
141
|
+
}, [U, t]), V = d((e) => {
|
|
142
|
+
C(e), M(!0);
|
|
143
|
+
}, []), $ = d(() => {
|
|
144
|
+
M(!1), C(null);
|
|
145
145
|
}, []), F = d((e) => {
|
|
146
146
|
globalThis.dispatchEvent(
|
|
147
|
-
new CustomEvent(
|
|
147
|
+
new CustomEvent($e, {
|
|
148
148
|
detail: {
|
|
149
149
|
editOnly: "observationForms",
|
|
150
150
|
editTitle: "EDIT_OBSERVATION_FORM_TITLE",
|
|
@@ -154,34 +154,34 @@ const Ve = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
|
|
|
154
154
|
}
|
|
155
155
|
})
|
|
156
156
|
);
|
|
157
|
-
}, []),
|
|
157
|
+
}, []), j = d(
|
|
158
158
|
(e, r) => {
|
|
159
159
|
switch (r) {
|
|
160
160
|
case "recordedOn":
|
|
161
|
-
return /* @__PURE__ */ n(
|
|
161
|
+
return /* @__PURE__ */ n(Be, { onClick: () => V(e), children: e.recordedOn });
|
|
162
162
|
case "recordedBy":
|
|
163
163
|
return e.recordedBy;
|
|
164
164
|
case "actions":
|
|
165
165
|
return u(e) ? /* @__PURE__ */ n(
|
|
166
|
-
|
|
166
|
+
G,
|
|
167
167
|
{
|
|
168
168
|
label: t("EDIT_OBSERVATION_FORM"),
|
|
169
169
|
kind: "ghost",
|
|
170
170
|
size: "sm",
|
|
171
171
|
testId: `edit-form-${e.encounterUuid}`,
|
|
172
172
|
onClick: () => F(e),
|
|
173
|
-
children: /* @__PURE__ */ n(
|
|
173
|
+
children: /* @__PURE__ */ n(z, {})
|
|
174
174
|
}
|
|
175
175
|
) : null;
|
|
176
176
|
default:
|
|
177
177
|
return null;
|
|
178
178
|
}
|
|
179
179
|
},
|
|
180
|
-
[
|
|
180
|
+
[V, F, u, t]
|
|
181
181
|
);
|
|
182
|
-
return /* @__PURE__ */
|
|
183
|
-
/* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: D || L ||
|
|
184
|
-
|
|
182
|
+
return /* @__PURE__ */ K(ge, { children: [
|
|
183
|
+
/* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: D || L || H.length === 0 || S ? /* @__PURE__ */ n(
|
|
184
|
+
P,
|
|
185
185
|
{
|
|
186
186
|
headers: fe,
|
|
187
187
|
ariaLabel: t("FORMS_HEADING"),
|
|
@@ -189,21 +189,21 @@ const Ve = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
|
|
|
189
189
|
loading: D,
|
|
190
190
|
errorStateMessage: L ? re?.message : void 0,
|
|
191
191
|
emptyStateMessage: t("FORMS_UNAVAILABLE"),
|
|
192
|
-
renderCell:
|
|
193
|
-
className:
|
|
192
|
+
renderCell: j,
|
|
193
|
+
className: N.formsTableBody,
|
|
194
194
|
dataTestId: "forms-table"
|
|
195
195
|
}
|
|
196
|
-
) : /* @__PURE__ */ n(De, { align: "start", children:
|
|
196
|
+
) : /* @__PURE__ */ n(De, { align: "start", children: H.map((e, r) => {
|
|
197
197
|
const { formName: a, records: s } = e, f = ce(s);
|
|
198
198
|
return /* @__PURE__ */ n(
|
|
199
199
|
Le,
|
|
200
200
|
{
|
|
201
201
|
title: a,
|
|
202
|
-
className:
|
|
202
|
+
className: N.customAccordianItem,
|
|
203
203
|
testId: `accordian-title-${a}`,
|
|
204
204
|
open: r === 0,
|
|
205
205
|
children: /* @__PURE__ */ n(
|
|
206
|
-
|
|
206
|
+
P,
|
|
207
207
|
{
|
|
208
208
|
headers: f,
|
|
209
209
|
ariaLabel: t("FORMS_HEADING"),
|
|
@@ -212,8 +212,8 @@ const Ve = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
|
|
|
212
212
|
errorStateMessage: "",
|
|
213
213
|
sortable: ye,
|
|
214
214
|
emptyStateMessage: t("FORMS_UNAVAILABLE"),
|
|
215
|
-
renderCell:
|
|
216
|
-
className:
|
|
215
|
+
renderCell: j,
|
|
216
|
+
className: N.formsTableBody,
|
|
217
217
|
dataTestId: `forms-table-${a}`
|
|
218
218
|
}
|
|
219
219
|
)
|
|
@@ -227,20 +227,20 @@ const Ve = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
|
|
|
227
227
|
id: "modalIdForActionAreaLayout",
|
|
228
228
|
portalId: "main-display-area",
|
|
229
229
|
open: p,
|
|
230
|
-
onRequestClose:
|
|
231
|
-
modalHeading: /* @__PURE__ */
|
|
230
|
+
onRequestClose: $,
|
|
231
|
+
modalHeading: /* @__PURE__ */ K("div", { className: N.modalHeading, children: [
|
|
232
232
|
/* @__PURE__ */ n("span", { children: o.formName }),
|
|
233
233
|
b && u(o) && /* @__PURE__ */ n(
|
|
234
|
-
|
|
234
|
+
G,
|
|
235
235
|
{
|
|
236
236
|
label: t("EDIT_OBSERVATION_FORM"),
|
|
237
237
|
kind: "ghost",
|
|
238
238
|
size: "sm",
|
|
239
239
|
testId: `edit-form-modal-${o.encounterUuid}`,
|
|
240
240
|
onClick: () => {
|
|
241
|
-
|
|
241
|
+
$(), F(o);
|
|
242
242
|
},
|
|
243
|
-
children: /* @__PURE__ */ n(
|
|
243
|
+
children: /* @__PURE__ */ n(z, {})
|
|
244
244
|
}
|
|
245
245
|
)
|
|
246
246
|
] }),
|
|
@@ -268,5 +268,5 @@ const Ve = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
|
|
|
268
268
|
] });
|
|
269
269
|
};
|
|
270
270
|
export {
|
|
271
|
-
|
|
271
|
+
ze as default
|
|
272
272
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-
|
|
2
|
-
import {
|
|
1
|
+
import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-9u-qHMWS.js";
|
|
2
|
+
import { _ as d, a0 as f, a1 as e } from "./index-Drn6hy5Z.js";
|
|
3
3
|
var p = (a) => {
|
|
4
4
|
const [r, t] = c({
|
|
5
5
|
prefix: "TanstackQueryDevtools"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as s, T as c, P as u, a as i, b as m, C as P, Q as d } from "./YPM2AS64-
|
|
2
|
-
import {
|
|
1
|
+
import { c as s, T as c, P as u, a as i, b as m, C as P, Q as d } from "./YPM2AS64-9u-qHMWS.js";
|
|
2
|
+
import { _ as v, a0 as C, a1 as e } from "./index-Drn6hy5Z.js";
|
|
3
3
|
var h = (t) => {
|
|
4
4
|
const [r, o] = s({
|
|
5
5
|
prefix: "TanstackQueryDevtools"
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { g as
|
|
1
|
+
import { jsxs as S, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { g as H, z as M, u as B, B as x, y as G, d as J, P, m as Y, Q as j, r as W, i as X, t as Z, k as ee, Y as ae, J as se, n as U, X as re, W as te, w as ie, o as oe, R as ne, q as de, D as le } from "./index-Drn6hy5Z.js";
|
|
3
3
|
import { useQueries as ue, useQuery as ce } from "@tanstack/react-query";
|
|
4
|
-
import { useRef as me, useEffect as
|
|
5
|
-
const pe = "Observations-module_observations__RKSyo", be = "Observations-module_title__TJL3z",
|
|
4
|
+
import { useRef as me, useEffect as L, useMemo as E } from "react";
|
|
5
|
+
const pe = "Observations-module_observations__RKSyo", be = "Observations-module_title__TJL3z", he = "Observations-module_wrapper__muk2L", ve = "Observations-module_secondary__14nuS", R = {
|
|
6
6
|
observations: pe,
|
|
7
7
|
title: be,
|
|
8
|
-
wrapper:
|
|
9
|
-
secondary:
|
|
8
|
+
wrapper: he,
|
|
9
|
+
secondary: ve
|
|
10
10
|
}, V = (s, l, o, d, c, r) => {
|
|
11
11
|
const t = re(s, l, c), e = t.value, m = te(e);
|
|
12
12
|
let i = e;
|
|
@@ -26,24 +26,24 @@ const pe = "Observations-module_observations__RKSyo", be = "Observations-module_
|
|
|
26
26
|
hideThumbnail: r
|
|
27
27
|
}
|
|
28
28
|
)), m === "PDF" && (i = /* @__PURE__ */ n(le, { id: `${e}-pdf`, src: e }));
|
|
29
|
-
const p = /* @__PURE__ */
|
|
29
|
+
const p = /* @__PURE__ */ S("div", { className: R.wrapper, children: [
|
|
30
30
|
/* @__PURE__ */ n("span", { children: t.header.display }),
|
|
31
|
-
t.header.referenceRange && /* @__PURE__ */ n("span", { className:
|
|
31
|
+
t.header.referenceRange && /* @__PURE__ */ n("span", { className: R.secondary, children: t.header.referenceRange })
|
|
32
32
|
] }), u = c("OBSERVATIONS_RECORDED_BY", {
|
|
33
33
|
provider: t.provider
|
|
34
|
-
}), b = s.effectiveDateTime ? ie(s.effectiveDateTime, c, !0).formattedResult : void 0, f = /* @__PURE__ */
|
|
34
|
+
}), b = s.effectiveDateTime ? ie(s.effectiveDateTime, c, !0).formattedResult : void 0, f = /* @__PURE__ */ S("div", { className: R.wrapper, children: [
|
|
35
35
|
/* @__PURE__ */ n("span", { children: u }),
|
|
36
|
-
b && /* @__PURE__ */ n("span", { className:
|
|
37
|
-
] }),
|
|
36
|
+
b && /* @__PURE__ */ n("span", { className: R.secondary, children: b })
|
|
37
|
+
] }), h = s.display, v = s.observationValue?.isAbnormal ? "abnormal-obs" : "obs", O = d ? `${d}-${v}-${h}-${o}-${l}` : `${v}-${h}-${o}-${l}`;
|
|
38
38
|
return /* @__PURE__ */ n(
|
|
39
39
|
oe,
|
|
40
40
|
{
|
|
41
41
|
header: p,
|
|
42
42
|
value: i,
|
|
43
43
|
info: f,
|
|
44
|
-
id:
|
|
45
|
-
testId:
|
|
46
|
-
ariaLabel:
|
|
44
|
+
id: O,
|
|
45
|
+
testId: O,
|
|
46
|
+
ariaLabel: O
|
|
47
47
|
},
|
|
48
48
|
`obs-${s.id}`
|
|
49
49
|
);
|
|
@@ -65,14 +65,14 @@ const pe = "Observations-module_observations__RKSyo", be = "Observations-module_
|
|
|
65
65
|
)
|
|
66
66
|
},
|
|
67
67
|
`grouped-obs-${s.id}`
|
|
68
|
-
),
|
|
68
|
+
), Re = ({
|
|
69
69
|
groupedData: s,
|
|
70
70
|
title: l = "",
|
|
71
71
|
hideThumbnail: o
|
|
72
72
|
}) => {
|
|
73
73
|
const { t: d } = B(), c = (r, t, e) => {
|
|
74
74
|
const m = se(r.encounterDetails, d);
|
|
75
|
-
return /* @__PURE__ */
|
|
75
|
+
return /* @__PURE__ */ S(
|
|
76
76
|
U,
|
|
77
77
|
{
|
|
78
78
|
title: m,
|
|
@@ -116,13 +116,13 @@ const pe = "Observations-module_observations__RKSyo", be = "Observations-module_
|
|
|
116
116
|
)
|
|
117
117
|
}
|
|
118
118
|
);
|
|
119
|
-
},
|
|
119
|
+
}, Oe = (s) => ["conceptUuid", s], _e = (s, l, o, d) => [
|
|
120
120
|
"observations",
|
|
121
121
|
s,
|
|
122
122
|
...l,
|
|
123
123
|
o,
|
|
124
124
|
d
|
|
125
|
-
],
|
|
125
|
+
], Se = ({
|
|
126
126
|
config: s,
|
|
127
127
|
episodeOfCareUuids: l,
|
|
128
128
|
encounterUuids: o
|
|
@@ -132,14 +132,14 @@ const pe = "Observations-module_observations__RKSyo", be = "Observations-module_
|
|
|
132
132
|
conceptUuid: r = [],
|
|
133
133
|
hideThumbnail: t = !1,
|
|
134
134
|
scope: e = "all"
|
|
135
|
-
} = d, m = me(/* @__PURE__ */ new Set()), i =
|
|
135
|
+
} = d, m = me(/* @__PURE__ */ new Set()), i = H(), { addNotification: p } = M(), { t: u } = B(), b = ue({
|
|
136
136
|
queries: c.map((a) => ({
|
|
137
|
-
queryKey:
|
|
137
|
+
queryKey: Oe(a),
|
|
138
138
|
queryFn: () => x(a),
|
|
139
139
|
enabled: !!a
|
|
140
140
|
}))
|
|
141
141
|
});
|
|
142
|
-
|
|
142
|
+
L(() => {
|
|
143
143
|
const a = b.some((z) => z.isError), y = m.current.size > 0;
|
|
144
144
|
a && !y ? (p({
|
|
145
145
|
title: u("ERROR_DEFAULT_TITLE"),
|
|
@@ -147,91 +147,91 @@ const pe = "Observations-module_observations__RKSyo", be = "Observations-module_
|
|
|
147
147
|
type: "error"
|
|
148
148
|
}), m.current.add(0)) : !a && y && m.current.clear();
|
|
149
149
|
}, [b, p, u]);
|
|
150
|
-
const f =
|
|
150
|
+
const f = E(() => b.map((a) => a.data?.uuid).filter((a) => !!a), [b]), h = E(() => [.../* @__PURE__ */ new Set([...f, ...r])], [f, r]), v = E(() => c.length === 0 ? !0 : b.every((a) => !a.isLoading), [b, c.length]), O = e === "latest" || e === "latest-encounter", F = G(
|
|
151
151
|
l,
|
|
152
152
|
o
|
|
153
153
|
), {
|
|
154
|
-
data:
|
|
155
|
-
isLoading:
|
|
156
|
-
isError:
|
|
154
|
+
data: _,
|
|
155
|
+
isLoading: w,
|
|
156
|
+
isError: I,
|
|
157
157
|
refetch: N
|
|
158
158
|
} = ce({
|
|
159
|
-
queryKey:
|
|
159
|
+
queryKey: _e(
|
|
160
160
|
i,
|
|
161
|
-
|
|
161
|
+
h,
|
|
162
162
|
o,
|
|
163
163
|
e
|
|
164
164
|
),
|
|
165
|
-
queryFn: () =>
|
|
165
|
+
queryFn: () => O ? J(
|
|
166
166
|
i,
|
|
167
|
-
|
|
167
|
+
h,
|
|
168
168
|
o
|
|
169
|
-
) :
|
|
169
|
+
) : P(
|
|
170
170
|
i,
|
|
171
|
-
|
|
171
|
+
h,
|
|
172
172
|
o
|
|
173
173
|
),
|
|
174
|
-
enabled: !!i &&
|
|
174
|
+
enabled: !!i && h.length > 0 && v && !F
|
|
175
175
|
});
|
|
176
|
-
|
|
176
|
+
Y(
|
|
177
177
|
(a) => {
|
|
178
178
|
a.patientUUID === i && a.updatedConcepts.size > 0 && [...a.updatedConcepts.keys()].some(
|
|
179
|
-
(y) =>
|
|
179
|
+
(y) => h.includes(y)
|
|
180
180
|
) && N();
|
|
181
181
|
},
|
|
182
182
|
[i, N]
|
|
183
|
-
),
|
|
184
|
-
|
|
183
|
+
), L(() => {
|
|
184
|
+
I && p({
|
|
185
185
|
title: u("ERROR_DEFAULT_TITLE"),
|
|
186
186
|
message: u("ERROR_FETCHING_OBSERVATIONS"),
|
|
187
187
|
type: "error"
|
|
188
188
|
});
|
|
189
|
-
}, [
|
|
190
|
-
const $ =
|
|
191
|
-
if (!
|
|
192
|
-
let a =
|
|
189
|
+
}, [I]);
|
|
190
|
+
const $ = E(() => {
|
|
191
|
+
if (!_) return [];
|
|
192
|
+
let a = j(_);
|
|
193
193
|
e === "latest-encounter" && (a = W(a));
|
|
194
194
|
const y = X(a);
|
|
195
195
|
return Z(y);
|
|
196
|
-
}, [
|
|
196
|
+
}, [_, e]), k = [
|
|
197
197
|
{ key: "name", header: "name" },
|
|
198
198
|
{ key: "value", header: "value" },
|
|
199
199
|
{ key: "form", header: "form" }
|
|
200
|
-
],
|
|
201
|
-
return /* @__PURE__ */
|
|
200
|
+
], D = w || !v, A = I && v, q = (!_ || _.entry?.length === 0 || h.length === 0) && v, C = A ? u("ERROR_FETCHING_OBSERVATIONS") : null, K = q ? u("NO_OBSERVATIONS_FOUND") : void 0, Q = $.length > 0 && !D && !A, g = d.titleTranslationKey, T = g ? u(g) : "";
|
|
201
|
+
return /* @__PURE__ */ S(
|
|
202
202
|
"div",
|
|
203
203
|
{
|
|
204
204
|
id: "observations",
|
|
205
|
-
"data-testid":
|
|
205
|
+
"data-testid": g ? `observations-${T}` : "observations",
|
|
206
206
|
"aria-label": "observations-aria-label",
|
|
207
|
-
className:
|
|
207
|
+
className: R.observations,
|
|
208
208
|
children: [
|
|
209
209
|
/* @__PURE__ */ n(
|
|
210
210
|
ee,
|
|
211
211
|
{
|
|
212
212
|
id: "observations-title",
|
|
213
|
-
testId:
|
|
214
|
-
title:
|
|
215
|
-
className:
|
|
216
|
-
children: /* @__PURE__ */ n("p", { children:
|
|
213
|
+
testId: g ? `observations-title-${T}` : "observations-title",
|
|
214
|
+
title: T,
|
|
215
|
+
className: R.title,
|
|
216
|
+
children: /* @__PURE__ */ n("p", { children: T })
|
|
217
217
|
}
|
|
218
218
|
),
|
|
219
|
-
|
|
220
|
-
|
|
219
|
+
Q ? /* @__PURE__ */ n(
|
|
220
|
+
Re,
|
|
221
221
|
{
|
|
222
222
|
groupedData: $,
|
|
223
|
-
title:
|
|
223
|
+
title: T,
|
|
224
224
|
hideThumbnail: t
|
|
225
225
|
}
|
|
226
226
|
) : /* @__PURE__ */ n(
|
|
227
227
|
ae,
|
|
228
228
|
{
|
|
229
|
-
headers:
|
|
229
|
+
headers: k,
|
|
230
230
|
rows: [],
|
|
231
231
|
ariaLabel: u("OBSERVATIONS"),
|
|
232
|
-
loading:
|
|
233
|
-
errorStateMessage:
|
|
234
|
-
emptyStateMessage:
|
|
232
|
+
loading: D,
|
|
233
|
+
errorStateMessage: C,
|
|
234
|
+
emptyStateMessage: K ?? u("NO_OBSERVATIONS_AVAILABLE"),
|
|
235
235
|
dataTestId: "observations-table"
|
|
236
236
|
}
|
|
237
237
|
)
|
|
@@ -240,7 +240,7 @@ const pe = "Observations-module_observations__RKSyo", be = "Observations-module_
|
|
|
240
240
|
);
|
|
241
241
|
};
|
|
242
242
|
export {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
243
|
+
Oe as conceptUuidQueryKeys,
|
|
244
|
+
Se as default,
|
|
245
|
+
_e as observationsQueryKeys
|
|
246
246
|
};
|