@bahmni/widgets 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/{DocumentsTable-BDrRTrAy.js → DocumentsTable-YtzrmAY5.js} +25 -25
- package/dist/{FormsTable-BvhD5iFn.js → FormsTable-D67NVSvr.js} +50 -50
- package/dist/{Observations-lazpTtsV.js → Observations-WD8m5FwS.js} +11 -11
- package/dist/{index-ClqkhB6j.js → index-BSjeukzT.js} +423 -424
- package/dist/index.js +3 -3
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as o, jsxs as _, Fragment as Ee } from "react/jsx-runtime";
|
|
2
|
-
import { p as fe, a as Ae, u as ge, b as
|
|
2
|
+
import { p as fe, a as Ae, u as ge, b as Ce, c as Ne, i as De, X as Ie, A as Le, d as Oe, M as be, Q as ye, _ as X, N as Se, e as ve, x as we, W as Me, f as Ue, h as J, g as te } from "./index-BSjeukzT.js";
|
|
3
3
|
import { useQuery as Re } from "@tanstack/react-query";
|
|
4
4
|
import { useState as p, useRef as Pe, useEffect as f, useMemo as A, useCallback as E } from "react";
|
|
5
5
|
import { useTranslation as ke } from "react-i18next";
|
|
@@ -89,27 +89,27 @@ const ct = "startConsultation", lt = "add", dt = "documents", Z = "document-prin
|
|
|
89
89
|
], 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 }] : [], At = ({ config: n, encounterUuids: d }) => {
|
|
90
90
|
const [l, D] = p(!1), [r, g] = p(
|
|
91
91
|
null
|
|
92
|
-
), [y,
|
|
92
|
+
), [y, M] = p(
|
|
93
93
|
/* @__PURE__ */ new Set()
|
|
94
|
-
), [S,
|
|
94
|
+
), [S, U] = p(
|
|
95
95
|
/* @__PURE__ */ new Set()
|
|
96
96
|
), I = Pe(null), [R, V] = p(
|
|
97
97
|
null
|
|
98
98
|
), W = R !== null;
|
|
99
99
|
f(() => () => I.current?.abort(), []);
|
|
100
|
-
const
|
|
100
|
+
const C = ge(), { t: s } = ke(), { addNotification: v } = Ce(), h = A(
|
|
101
101
|
() => n?.actions?.find(
|
|
102
102
|
(e) => e.type === lt
|
|
103
103
|
),
|
|
104
104
|
[n?.actions]
|
|
105
|
-
), ae =
|
|
105
|
+
), ae = Ne(h?.requiredPrivilege), oe = !!h && ae, se = Number(n?.pageSize) || 5, [P, k] = p(1), [L, re] = p(se), [ce, H] = p(void 0), z = E((e) => {
|
|
106
106
|
g(e), D(!0);
|
|
107
107
|
}, []), le = E(() => {
|
|
108
|
-
I.current?.abort(),
|
|
108
|
+
I.current?.abort(), U(/* @__PURE__ */ new Set()), D(!1), g(null), M(/* @__PURE__ */ new Set());
|
|
109
109
|
}, []), Y = E((e) => {
|
|
110
|
-
M((t) => new Set(t).add(e));
|
|
111
|
-
}, []), G = E((e) => {
|
|
112
110
|
U((t) => new Set(t).add(e));
|
|
111
|
+
}, []), G = E((e) => {
|
|
112
|
+
M((t) => new Set(t).add(e));
|
|
113
113
|
}, []), de = E(() => {
|
|
114
114
|
h && globalThis.dispatchEvent(
|
|
115
115
|
new CustomEvent(ct, {
|
|
@@ -123,14 +123,14 @@ const ct = "startConsultation", lt = "add", dt = "documents", Z = "document-prin
|
|
|
123
123
|
}, [h]), { data: O, isLoading: ie, isError: B, error: $, refetch: q } = Re({
|
|
124
124
|
queryKey: [
|
|
125
125
|
"documents",
|
|
126
|
-
|
|
126
|
+
C,
|
|
127
127
|
d,
|
|
128
128
|
P,
|
|
129
129
|
L
|
|
130
130
|
],
|
|
131
|
-
enabled: !!
|
|
131
|
+
enabled: !!C,
|
|
132
132
|
queryFn: () => De(
|
|
133
|
-
|
|
133
|
+
C,
|
|
134
134
|
d,
|
|
135
135
|
L,
|
|
136
136
|
P
|
|
@@ -138,14 +138,14 @@ const ct = "startConsultation", lt = "add", dt = "documents", Z = "document-prin
|
|
|
138
138
|
});
|
|
139
139
|
Ie(
|
|
140
140
|
(e) => {
|
|
141
|
-
e.patientUUID ===
|
|
141
|
+
e.patientUUID === C && e.updatedResources.documents && q();
|
|
142
142
|
},
|
|
143
|
-
[
|
|
143
|
+
[C, q]
|
|
144
144
|
), f(() => {
|
|
145
145
|
O && H(O.total);
|
|
146
146
|
}, [O]), f(() => {
|
|
147
147
|
k(1), H(void 0);
|
|
148
|
-
}, [
|
|
148
|
+
}, [C]), f(() => {
|
|
149
149
|
B && v({
|
|
150
150
|
title: s("ERROR_DEFAULT_TITLE"),
|
|
151
151
|
message: $?.message ?? "",
|
|
@@ -157,9 +157,9 @@ const ct = "startConsultation", lt = "add", dt = "documents", Z = "document-prin
|
|
|
157
157
|
if (!l || !r) return;
|
|
158
158
|
const a = /* @__PURE__ */ new Set(), u = ee(r);
|
|
159
159
|
for (let i = 0; i < u.length; i++) {
|
|
160
|
-
const
|
|
160
|
+
const N = b(u[i].url);
|
|
161
161
|
try {
|
|
162
|
-
(await fetch(
|
|
162
|
+
(await fetch(N, {
|
|
163
163
|
method: "HEAD",
|
|
164
164
|
signal: e.signal
|
|
165
165
|
})).ok || a.add(i);
|
|
@@ -167,7 +167,7 @@ const ct = "startConsultation", lt = "add", dt = "documents", Z = "document-prin
|
|
|
167
167
|
T instanceof Error && T.name !== "AbortError" && a.add(i);
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
|
-
e.signal.aborted ||
|
|
170
|
+
e.signal.aborted || M(a);
|
|
171
171
|
})(), () => e.abort();
|
|
172
172
|
}, [l, r]), f(() => {
|
|
173
173
|
if (!l || !r) return;
|
|
@@ -183,11 +183,11 @@ const ct = "startConsultation", lt = "add", dt = "documents", Z = "document-prin
|
|
|
183
183
|
}, i = (T) => {
|
|
184
184
|
const pe = T.target;
|
|
185
185
|
it.has(T.key) && !pe?.closest("button, input, textarea, select, a") && a();
|
|
186
|
-
},
|
|
186
|
+
}, N = () => {
|
|
187
187
|
!t && e.scrollTop !== 0 && (e.scrollTop = 0);
|
|
188
188
|
};
|
|
189
|
-
return e.addEventListener("wheel", a, { passive: !0 }), e.addEventListener("touchmove", a, { passive: !0 }), e.addEventListener("mousedown", u), e.addEventListener("keydown", i), e.addEventListener("scroll",
|
|
190
|
-
e.removeEventListener("wheel", a), e.removeEventListener("touchmove", a), e.removeEventListener("mousedown", u), e.removeEventListener("keydown", i), e.removeEventListener("scroll",
|
|
189
|
+
return e.addEventListener("wheel", a, { passive: !0 }), e.addEventListener("touchmove", a, { passive: !0 }), e.addEventListener("mousedown", u), e.addEventListener("keydown", i), e.addEventListener("scroll", N), () => {
|
|
190
|
+
e.removeEventListener("wheel", a), e.removeEventListener("touchmove", a), e.removeEventListener("mousedown", u), e.removeEventListener("keydown", i), e.removeEventListener("scroll", N);
|
|
191
191
|
};
|
|
192
192
|
}, [l, r]);
|
|
193
193
|
const me = E(
|
|
@@ -213,7 +213,7 @@ const ct = "startConsultation", lt = "add", dt = "documents", Z = "document-prin
|
|
|
213
213
|
f(() => {
|
|
214
214
|
if (!l || m.length === 0) return;
|
|
215
215
|
const e = setTimeout(
|
|
216
|
-
() =>
|
|
216
|
+
() => U(new Set(m.keys())),
|
|
217
217
|
mt
|
|
218
218
|
);
|
|
219
219
|
return () => clearTimeout(e);
|
|
@@ -324,7 +324,7 @@ const ct = "startConsultation", lt = "add", dt = "documents", Z = "document-prin
|
|
|
324
324
|
}
|
|
325
325
|
) }),
|
|
326
326
|
l && r && /* @__PURE__ */ o(
|
|
327
|
-
|
|
327
|
+
Me,
|
|
328
328
|
{
|
|
329
329
|
id: "modalIdForActionAreaLayout",
|
|
330
330
|
portalId: "main-display-area",
|
|
@@ -336,7 +336,7 @@ const ct = "startConsultation", lt = "add", dt = "documents", Z = "document-prin
|
|
|
336
336
|
testId: "document-view-modal",
|
|
337
337
|
children: /* @__PURE__ */ _("div", { className: c.documentViewerContainer, children: [
|
|
338
338
|
j.length > 1 && /* @__PURE__ */ o(
|
|
339
|
-
|
|
339
|
+
Ue,
|
|
340
340
|
{
|
|
341
341
|
kind: "tertiary",
|
|
342
342
|
size: "sm",
|
|
@@ -349,8 +349,8 @@ const ct = "startConsultation", lt = "add", dt = "documents", Z = "document-prin
|
|
|
349
349
|
}
|
|
350
350
|
),
|
|
351
351
|
m.map((e, t) => {
|
|
352
|
-
const a = b(e.url), u = e.contentType?.toLowerCase().includes("pdf"), i = (e.contentType?.toLowerCase().includes("image") ?? !1) || ht.test(e.url ?? ""),
|
|
353
|
-
return a === "#" ||
|
|
352
|
+
const a = b(e.url), u = e.contentType?.toLowerCase().includes("pdf"), i = (e.contentType?.toLowerCase().includes("image") ?? !1) || ht.test(e.url ?? ""), N = y.has(t);
|
|
353
|
+
return a === "#" || N ? /* @__PURE__ */ _(
|
|
354
354
|
"div",
|
|
355
355
|
{
|
|
356
356
|
className: c.attachmentError,
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import { jsx as n, jsxs as
|
|
2
|
-
import { u as de, c as le, j as me, C as ce, k as ue, l as fe, m as
|
|
3
|
-
import { useQueryClient as _e, useQuery as
|
|
1
|
+
import { jsx as n, jsxs as q, Fragment as ie } from "react/jsx-runtime";
|
|
2
|
+
import { u as de, c as le, j as me, C as ce, k as ue, l as fe, m as be, X as he, n as Ne, o as ye, J as Oe, d as ge, _ as x, P as V, A as pe, x as $, q as Te, r as Ee, W as Ie, O as Ae, s as Fe } from "./index-BSjeukzT.js";
|
|
3
|
+
import { useQueryClient as _e, useQuery as A } from "@tanstack/react-query";
|
|
4
4
|
import { useState as j, useMemo as i, useCallback as d } from "react";
|
|
5
5
|
import { useTranslation as ve } from "react-i18next";
|
|
6
6
|
const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_modalHeading__wnTmA", De = "FormsTable-module_customAccordianItem__isszs", y = {
|
|
7
7
|
formsTableBody: Re,
|
|
8
8
|
modalHeading: Ce,
|
|
9
9
|
customAccordianItem: De
|
|
10
|
-
}, Le = "startConsultation",
|
|
11
|
-
episodeOfCareUuids:
|
|
10
|
+
}, Le = "startConsultation", Ue = ({
|
|
11
|
+
episodeOfCareUuids: F,
|
|
12
12
|
encounterUuids: m,
|
|
13
13
|
config: G,
|
|
14
|
-
disableActions:
|
|
15
|
-
activeEncounterUuid:
|
|
14
|
+
disableActions: z = !1,
|
|
15
|
+
activeEncounterUuid: b = null
|
|
16
16
|
}) => {
|
|
17
17
|
const { t: o } = ve(), c = de(), [O, _] = j(!1), [a, v] = j(null), {
|
|
18
|
-
numberOfVisits:
|
|
19
|
-
hideThumbnail:
|
|
20
|
-
forms:
|
|
18
|
+
numberOfVisits: K,
|
|
19
|
+
hideThumbnail: Q = !1,
|
|
20
|
+
forms: h
|
|
21
21
|
} = G ?? {}, W = le(
|
|
22
|
-
|
|
23
|
-
), { userPrivileges:
|
|
24
|
-
|
|
22
|
+
Fe.EDIT_OBSERVATIONS
|
|
23
|
+
), { userPrivileges: N } = me(), g = W && !z && !!b, R = ce(
|
|
24
|
+
F,
|
|
25
25
|
m
|
|
26
26
|
), J = _e(), {
|
|
27
27
|
data: C = [],
|
|
28
28
|
isLoading: D,
|
|
29
29
|
isError: L,
|
|
30
|
-
error:
|
|
31
|
-
refetch:
|
|
32
|
-
} =
|
|
33
|
-
queryKey: ["forms", c,
|
|
34
|
-
queryFn: () => ue(c, void 0,
|
|
30
|
+
error: X,
|
|
31
|
+
refetch: Y
|
|
32
|
+
} = A({
|
|
33
|
+
queryKey: ["forms", c, F],
|
|
34
|
+
queryFn: () => ue(c, void 0, K),
|
|
35
35
|
enabled: !!c && !R
|
|
36
36
|
}), S = i(() => {
|
|
37
37
|
let e = C;
|
|
38
38
|
return m && m.length > 0 && (e = e.filter(
|
|
39
39
|
(t) => m.includes(t.encounterUuid)
|
|
40
|
-
)), Array.isArray(
|
|
41
|
-
(t) =>
|
|
40
|
+
)), Array.isArray(h) && h.length > 0 && (e = e.filter(
|
|
41
|
+
(t) => h.some((s) => s.toLowerCase() === t.formName.toLowerCase())
|
|
42
42
|
)), e;
|
|
43
|
-
}, [C, m,
|
|
43
|
+
}, [C, m, h]), { data: B = [] } = A({
|
|
44
44
|
queryKey: ["observationForms"],
|
|
45
45
|
queryFn: () => fe()
|
|
46
46
|
}), M = d(
|
|
@@ -49,36 +49,36 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
|
|
|
49
49
|
(r) => r.name.toLowerCase() === e.toLowerCase()
|
|
50
50
|
);
|
|
51
51
|
if (!t?.privileges || t.privileges.length === 0) return !0;
|
|
52
|
-
if (!
|
|
53
|
-
const s = new Set(
|
|
52
|
+
if (!N || N.length === 0) return !1;
|
|
53
|
+
const s = new Set(N.map((r) => r.name));
|
|
54
54
|
return t.privileges.some(
|
|
55
55
|
(r) => s.has(r.privilegeName) && r.editable
|
|
56
56
|
);
|
|
57
57
|
},
|
|
58
|
-
[B,
|
|
58
|
+
[B, N]
|
|
59
59
|
), u = d(
|
|
60
|
-
(e) => !
|
|
61
|
-
[
|
|
60
|
+
(e) => !b || e.encounterUuid !== b ? !1 : M(e.formName),
|
|
61
|
+
[b, M]
|
|
62
62
|
), {
|
|
63
|
-
data:
|
|
63
|
+
data: p,
|
|
64
64
|
isLoading: Z,
|
|
65
65
|
isError: ee,
|
|
66
|
-
error:
|
|
67
|
-
} =
|
|
66
|
+
error: T
|
|
67
|
+
} = A({
|
|
68
68
|
queryKey: ["formsEncounterFHIR", a?.encounterUuid],
|
|
69
|
-
queryFn: () =>
|
|
69
|
+
queryFn: () => be(a.encounterUuid),
|
|
70
70
|
enabled: !!a?.encounterUuid && O
|
|
71
71
|
});
|
|
72
|
-
|
|
72
|
+
he(
|
|
73
73
|
(e) => {
|
|
74
|
-
e.patientUUID === c && (
|
|
74
|
+
e.patientUUID === c && (Y(), J.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
|
|
75
75
|
},
|
|
76
76
|
[c]
|
|
77
77
|
);
|
|
78
|
-
const re = i(() => !
|
|
79
|
-
if (
|
|
80
|
-
return Oe(
|
|
81
|
-
}, [
|
|
78
|
+
const re = i(() => !p?.entry || !a?.formName ? [] : p.entry.filter((t) => t.resource?.resourceType === "Observation").map((t) => t.resource).filter((t) => Ne(t) ? ye(t)?.toLowerCase() === a.formName.toLowerCase() : !0), [p, a?.formName]), te = i(() => {
|
|
79
|
+
if (T)
|
|
80
|
+
return Oe(T).message;
|
|
81
|
+
}, [T]), f = i(
|
|
82
82
|
() => [
|
|
83
83
|
{ key: "recordedOn", header: o("RECORDED_ON") },
|
|
84
84
|
{ key: "recordedBy", header: o("RECORDED_BY") }
|
|
@@ -96,7 +96,7 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
|
|
|
96
96
|
{ key: "recordedBy", sortable: !0 }
|
|
97
97
|
],
|
|
98
98
|
[]
|
|
99
|
-
),
|
|
99
|
+
), k = i(() => {
|
|
100
100
|
const e = S.reduce(
|
|
101
101
|
(s, r) => {
|
|
102
102
|
const l = r.formName;
|
|
@@ -121,7 +121,7 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
|
|
|
121
121
|
)
|
|
122
122
|
})
|
|
123
123
|
).sort((s, r) => s.formName.localeCompare(r.formName));
|
|
124
|
-
}, [S, o]),
|
|
124
|
+
}, [S, o]), U = d((e) => {
|
|
125
125
|
v(e), _(!0);
|
|
126
126
|
}, []), H = d(() => {
|
|
127
127
|
_(!1), v(null);
|
|
@@ -141,12 +141,12 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
|
|
|
141
141
|
(e, t) => {
|
|
142
142
|
switch (t) {
|
|
143
143
|
case "recordedOn":
|
|
144
|
-
return /* @__PURE__ */ n(
|
|
144
|
+
return /* @__PURE__ */ n(pe, { onClick: () => U(e), children: e.recordedOn });
|
|
145
145
|
case "recordedBy":
|
|
146
146
|
return e.recordedBy;
|
|
147
147
|
case "actions":
|
|
148
148
|
return u(e) ? /* @__PURE__ */ n(
|
|
149
|
-
|
|
149
|
+
x,
|
|
150
150
|
{
|
|
151
151
|
label: o("EDIT_OBSERVATION_FORM"),
|
|
152
152
|
kind: "ghost",
|
|
@@ -160,23 +160,23 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
|
|
|
160
160
|
return null;
|
|
161
161
|
}
|
|
162
162
|
},
|
|
163
|
-
[
|
|
163
|
+
[U, E, u, o]
|
|
164
164
|
);
|
|
165
|
-
return /* @__PURE__ */
|
|
166
|
-
/* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: D || L ||
|
|
165
|
+
return /* @__PURE__ */ q(ie, { children: [
|
|
166
|
+
/* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: D || L || k.length === 0 || R ? /* @__PURE__ */ n(
|
|
167
167
|
$,
|
|
168
168
|
{
|
|
169
169
|
headers: oe,
|
|
170
170
|
ariaLabel: o("FORMS_HEADING"),
|
|
171
171
|
rows: [],
|
|
172
172
|
loading: D,
|
|
173
|
-
errorStateMessage: L ?
|
|
173
|
+
errorStateMessage: L ? X?.message : void 0,
|
|
174
174
|
emptyStateMessage: o("FORMS_UNAVAILABLE"),
|
|
175
175
|
renderCell: P,
|
|
176
176
|
className: y.formsTableBody,
|
|
177
177
|
dataTestId: "forms-table"
|
|
178
178
|
}
|
|
179
|
-
) : /* @__PURE__ */ n(
|
|
179
|
+
) : /* @__PURE__ */ n(Te, { align: "start", children: k.map((e, t) => {
|
|
180
180
|
const { formName: s, records: r } = e, l = se(r);
|
|
181
181
|
return /* @__PURE__ */ n(
|
|
182
182
|
Ee,
|
|
@@ -211,10 +211,10 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
|
|
|
211
211
|
portalId: "main-display-area",
|
|
212
212
|
open: O,
|
|
213
213
|
onRequestClose: H,
|
|
214
|
-
modalHeading: /* @__PURE__ */
|
|
214
|
+
modalHeading: /* @__PURE__ */ q("div", { className: y.modalHeading, children: [
|
|
215
215
|
/* @__PURE__ */ n("span", { children: a.formName }),
|
|
216
216
|
g && u(a) && /* @__PURE__ */ n(
|
|
217
|
-
|
|
217
|
+
x,
|
|
218
218
|
{
|
|
219
219
|
label: o("EDIT_OBSERVATION_FORM"),
|
|
220
220
|
kind: "ghost",
|
|
@@ -232,7 +232,7 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
|
|
|
232
232
|
size: "md",
|
|
233
233
|
testId: "form-details-modal",
|
|
234
234
|
children: /* @__PURE__ */ n(
|
|
235
|
-
|
|
235
|
+
Ae,
|
|
236
236
|
{
|
|
237
237
|
observations: re,
|
|
238
238
|
isLoading: Z,
|
|
@@ -240,7 +240,7 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
|
|
|
240
240
|
errorMessage: te,
|
|
241
241
|
emptyStateMessage: o("NO_FORM_DATA_AVAILABLE"),
|
|
242
242
|
testIdPrefix: a.formName,
|
|
243
|
-
hideThumbnail:
|
|
243
|
+
hideThumbnail: Q,
|
|
244
244
|
formName: a.formName
|
|
245
245
|
}
|
|
246
246
|
)
|
|
@@ -249,5 +249,5 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Ce = "FormsTable-module_mo
|
|
|
249
249
|
] });
|
|
250
250
|
};
|
|
251
251
|
export {
|
|
252
|
-
|
|
252
|
+
Ue as default
|
|
253
253
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as i, jsxs as N } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { t as G, v as F, w as x, K as z, d as H, y as P, F as j, z as X, B as J, u as W, b as Y, D as Z, C as ee, E as se, G as te, X as re, H as ae, I as oe, L as ne, R as ie, Q as ce, x as le } from "./index-BSjeukzT.js";
|
|
3
3
|
import { useQueries as de, useQuery as ue } from "@tanstack/react-query";
|
|
4
|
-
import { useRef as pe, useEffect as C, useMemo as
|
|
4
|
+
import { useRef as pe, useEffect as C, useMemo as I } from "react";
|
|
5
5
|
import { useTranslation as w } from "react-i18next";
|
|
6
6
|
const be = "Observations-module_observations__RKSyo", me = "Observations-module_title__TJL3z", ve = "Observations-module_wrapper__muk2L", ye = "Observations-module_secondary__14nuS", y = {
|
|
7
7
|
observations: be,
|
|
@@ -72,7 +72,7 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
|
|
|
72
72
|
hideThumbnail: n
|
|
73
73
|
}) => {
|
|
74
74
|
const { t: c } = w(), u = (r, a, e) => {
|
|
75
|
-
const p =
|
|
75
|
+
const p = G(r.encounterDetails, c);
|
|
76
76
|
return /* @__PURE__ */ N(
|
|
77
77
|
F,
|
|
78
78
|
{
|
|
@@ -148,7 +148,7 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
|
|
|
148
148
|
type: "error"
|
|
149
149
|
}), p.current.add(0)) : !s && R && p.current.clear();
|
|
150
150
|
}, [m, b, d]);
|
|
151
|
-
const _ =
|
|
151
|
+
const _ = I(() => m.map((s) => s.data?.uuid).filter((s) => !!s), [m]), v = I(() => [.../* @__PURE__ */ new Set([..._, ...r])], [_, r]), f = I(() => u.length === 0 ? !0 : m.every((s) => !s.isLoading), [m, u.length]), g = e === "latest" || e === "latest-encounter", O = ee(
|
|
152
152
|
l,
|
|
153
153
|
n
|
|
154
154
|
), {
|
|
@@ -188,7 +188,7 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
|
|
|
188
188
|
type: "error"
|
|
189
189
|
});
|
|
190
190
|
}, [S]);
|
|
191
|
-
const A =
|
|
191
|
+
const A = I(() => {
|
|
192
192
|
if (!E) return [];
|
|
193
193
|
let s = ae(E);
|
|
194
194
|
e === "latest-encounter" && (s = oe(s));
|
|
@@ -198,12 +198,12 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
|
|
|
198
198
|
{ key: "name", header: "name" },
|
|
199
199
|
{ key: "value", header: "value" },
|
|
200
200
|
{ key: "form", header: "form" }
|
|
201
|
-
], B = V || !f, L = S && f,
|
|
201
|
+
], B = V || !f, L = S && f, Q = (!E || E.entry?.length === 0 || v.length === 0) && f, M = L ? d("ERROR_FETCHING_OBSERVATIONS") : null, k = Q ? d("NO_OBSERVATIONS_FOUND") : void 0, q = A.length > 0 && !B && !L, T = c.titleTranslationKey, h = T ? d(T) : "";
|
|
202
202
|
return /* @__PURE__ */ N(
|
|
203
203
|
"div",
|
|
204
204
|
{
|
|
205
205
|
id: "observations",
|
|
206
|
-
"data-testid":
|
|
206
|
+
"data-testid": T ? `observations-${h}` : "observations",
|
|
207
207
|
"aria-label": "observations-aria-label",
|
|
208
208
|
className: y.observations,
|
|
209
209
|
children: [
|
|
@@ -211,13 +211,13 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
|
|
|
211
211
|
ce,
|
|
212
212
|
{
|
|
213
213
|
id: "observations-title",
|
|
214
|
-
testId:
|
|
214
|
+
testId: T ? `observations-title-${h}` : "observations-title",
|
|
215
215
|
title: h,
|
|
216
216
|
className: y.title,
|
|
217
217
|
children: /* @__PURE__ */ i("p", { children: h })
|
|
218
218
|
}
|
|
219
219
|
),
|
|
220
|
-
|
|
220
|
+
q ? /* @__PURE__ */ i(
|
|
221
221
|
Oe,
|
|
222
222
|
{
|
|
223
223
|
groupedData: A,
|
|
@@ -231,8 +231,8 @@ const be = "Observations-module_observations__RKSyo", me = "Observations-module_
|
|
|
231
231
|
rows: [],
|
|
232
232
|
ariaLabel: d("OBSERVATIONS"),
|
|
233
233
|
loading: B,
|
|
234
|
-
errorStateMessage:
|
|
235
|
-
emptyStateMessage:
|
|
234
|
+
errorStateMessage: M,
|
|
235
|
+
emptyStateMessage: k ?? d("NO_OBSERVATIONS_AVAILABLE"),
|
|
236
236
|
dataTestId: "observations-table"
|
|
237
237
|
}
|
|
238
238
|
)
|