@bahmni/home-app 0.0.1-dev.404 → 0.0.1-dev.408
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-BmYFio6a-zmPPe9BV.js → DocumentsTable-BSBWfrYe-K4-fp7cB.js} +11 -11
- package/dist/{FormsTable-Dn0dYzgO-COihlfn-.js → FormsTable-D8eS1feV-DEOnth-4.js} +39 -39
- package/dist/{LNWAZHJI--EdTiJwJ.js → LNWAZHJI-FNLuNz1A.js} +2 -2
- package/dist/{MWZ6AO7Z-VB4PD1cY.js → MWZ6AO7Z-C25CIsAn.js} +2 -2
- package/dist/Observations-CbJng7Yn-MIVn1nyY.js +213 -0
- package/dist/{YPM2AS64-Ze1E-dld.js → YPM2AS64-DJb3J_xq.js} +138 -138
- package/dist/components/HomePageHeader/HomePageHeader.d.ts.map +1 -1
- package/dist/{index-dkqs2X3C.js → index-BLBZZpTy.js} +30565 -30542
- package/dist/index-CiNLyZ2s.js +111 -0
- package/dist/index.js +1 -1
- package/dist/locales/locale_en.json +1 -0
- package/dist/locales/locale_es.json +1 -0
- package/package.json +1 -1
- package/dist/Observations-BgGdEmnb-BvZt75bk.js +0 -213
- package/dist/index-BUK4yYWQ.js +0 -108
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as r, jsxs as p, Fragment as
|
|
2
|
-
import { v as
|
|
1
|
+
import { jsx as r, jsxs as p, Fragment as Y } from "react/jsx-runtime";
|
|
2
|
+
import { v as x, u as G, z as W, t as J, q as X, w as Z, Y as ee, p as te } from "./index-BLBZZpTy.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,7 +38,7 @@ const Te = [
|
|
|
38
38
|
null
|
|
39
39
|
), [$, O] = l(
|
|
40
40
|
/* @__PURE__ */ new Set()
|
|
41
|
-
), g =
|
|
41
|
+
), g = x(), { t: n } = G(), { addNotification: L } = W(), k = Number(a?.pageSize) || 5, [f, C] = l(1), [u, V] = l(k), [q, A] = l(void 0), M = h((e) => {
|
|
42
42
|
U(e), w(!0);
|
|
43
43
|
}, []), F = h(() => {
|
|
44
44
|
w(!1), U(null), O(/* @__PURE__ */ new Set());
|
|
@@ -53,7 +53,7 @@ const Te = [
|
|
|
53
53
|
u
|
|
54
54
|
],
|
|
55
55
|
enabled: !!g,
|
|
56
|
-
queryFn: () =>
|
|
56
|
+
queryFn: () => J(
|
|
57
57
|
g,
|
|
58
58
|
E,
|
|
59
59
|
u,
|
|
@@ -97,7 +97,7 @@ const Te = [
|
|
|
97
97
|
), N = _(
|
|
98
98
|
() => a?.fields ?? Te,
|
|
99
99
|
[a?.fields]
|
|
100
|
-
),
|
|
100
|
+
), j = _(() => [...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]), P = _(() => ie(N, n), [N, n]), K = _(
|
|
101
101
|
() => N.map((e) => ({
|
|
102
102
|
key: e,
|
|
103
103
|
sortable: e !== "attachments"
|
|
@@ -106,7 +106,7 @@ const Te = [
|
|
|
106
106
|
), T = _(
|
|
107
107
|
() => o ? B(o) : [],
|
|
108
108
|
[o]
|
|
109
|
-
),
|
|
109
|
+
), Q = h(
|
|
110
110
|
(e, t) => {
|
|
111
111
|
switch (t) {
|
|
112
112
|
case "documentIdentifier":
|
|
@@ -137,18 +137,18 @@ const Te = [
|
|
|
137
137
|
},
|
|
138
138
|
[M, n]
|
|
139
139
|
);
|
|
140
|
-
return /* @__PURE__ */ p(
|
|
140
|
+
return /* @__PURE__ */ p(Y, { children: [
|
|
141
141
|
/* @__PURE__ */ r("div", { "data-testid": "documents-table", children: /* @__PURE__ */ r(
|
|
142
142
|
ee,
|
|
143
143
|
{
|
|
144
|
-
headers:
|
|
144
|
+
headers: P,
|
|
145
145
|
ariaLabel: n("DOCUMENTS_TABLE_HEADING"),
|
|
146
|
-
rows:
|
|
146
|
+
rows: j,
|
|
147
147
|
loading: H,
|
|
148
148
|
errorStateMessage: y ? b?.message : null,
|
|
149
|
-
sortable:
|
|
149
|
+
sortable: K,
|
|
150
150
|
emptyStateMessage: n("DOCUMENTS_NO_RECORDS"),
|
|
151
|
-
renderCell:
|
|
151
|
+
renderCell: Q,
|
|
152
152
|
className: d.documentsTableBody,
|
|
153
153
|
dataTestId: "documents-table",
|
|
154
154
|
pageSize: u,
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { jsx as i, jsxs as P, Fragment as ye } from "react/jsx-runtime";
|
|
2
|
-
import { u as ge, v as be, e as Oe, a as Ne, b as Te,
|
|
2
|
+
import { u as ge, v as be, e as Oe, a as Ne, b as Te, c as Ie, f as Ae, Q as Ee, d as ve, m as _e, g as Fe, o as Se, S as Q, w as Be, A as $, V as x, q as Me, Y as G, P as Re, F as Ce, p as Le, h as Ue, i as De } from "./index-BLBZZpTy.js";
|
|
3
3
|
import { useQueryClient as ke, useQuery as N } from "@tanstack/react-query";
|
|
4
|
-
import { useState as
|
|
4
|
+
import { useState as Y, useMemo as d, useCallback as c } from "react";
|
|
5
5
|
const qe = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_modalHeading__wnTmA", Ve = "FormsTable-module_customAccordianItem__isszs", T = {
|
|
6
6
|
formsTableBody: qe,
|
|
7
7
|
modalHeading: we,
|
|
8
8
|
customAccordianItem: Ve
|
|
9
|
-
}, He = "startConsultation",
|
|
10
|
-
episodeOfCareUuids:
|
|
9
|
+
}, He = "startConsultation", Qe = ({
|
|
10
|
+
episodeOfCareUuids: B,
|
|
11
11
|
encounterUuids: m,
|
|
12
12
|
config: X,
|
|
13
13
|
disableActions: Z = !1,
|
|
14
|
-
activeEncounterUuid:
|
|
14
|
+
activeEncounterUuid: p = null
|
|
15
15
|
}) => {
|
|
16
|
-
const { t: n } = ge(), u = be(), [y,
|
|
16
|
+
const { t: n } = ge(), u = be(), [y, M] = Y(!1), [s, R] = Y(null), {
|
|
17
17
|
numberOfVisits: J,
|
|
18
18
|
hideThumbnail: W = !1,
|
|
19
19
|
forms: g
|
|
20
20
|
} = X ?? {}, ee = Oe(
|
|
21
21
|
De.EDIT_OBSERVATIONS
|
|
22
|
-
), { userPrivileges: b } = Ne(), I = ee && !Z && !!
|
|
23
|
-
|
|
22
|
+
), { userPrivileges: b } = Ne(), I = ee && !Z && !!p, C = Te(
|
|
23
|
+
B,
|
|
24
24
|
m
|
|
25
25
|
), re = ke(), {
|
|
26
26
|
data: L = [],
|
|
@@ -29,7 +29,7 @@ const qe = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_mo
|
|
|
29
29
|
error: oe,
|
|
30
30
|
refetch: ae
|
|
31
31
|
} = N({
|
|
32
|
-
queryKey: ["forms", u,
|
|
32
|
+
queryKey: ["forms", u, B],
|
|
33
33
|
queryFn: () => Ie(u, void 0, J),
|
|
34
34
|
enabled: !!u && !C
|
|
35
35
|
}), k = d(() => {
|
|
@@ -54,8 +54,8 @@ const qe = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_mo
|
|
|
54
54
|
},
|
|
55
55
|
[O, b]
|
|
56
56
|
), f = c(
|
|
57
|
-
(e) => !
|
|
58
|
-
[
|
|
57
|
+
(e) => !p || e.encounterUuid !== p ? !1 : q(e.formName),
|
|
58
|
+
[p, q]
|
|
59
59
|
), w = c(
|
|
60
60
|
(e) => O.find((r) => r.name === e)?.uuid,
|
|
61
61
|
[O]
|
|
@@ -125,22 +125,22 @@ const qe = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_mo
|
|
|
125
125
|
), Object.keys(e).length > 0 ? e : void 0;
|
|
126
126
|
}, [l]), ue = d(() => {
|
|
127
127
|
if (E)
|
|
128
|
-
return
|
|
128
|
+
return Q(E).message;
|
|
129
129
|
if (_)
|
|
130
|
-
return
|
|
131
|
-
}, [E, _]),
|
|
130
|
+
return Q(_).message;
|
|
131
|
+
}, [E, _]), h = d(
|
|
132
132
|
() => [
|
|
133
133
|
{ key: "recordedOn", header: n("RECORDED_ON") },
|
|
134
134
|
{ key: "recordedBy", header: n("RECORDED_BY") }
|
|
135
135
|
],
|
|
136
136
|
[n]
|
|
137
137
|
), V = d(
|
|
138
|
-
() => [...
|
|
139
|
-
[
|
|
138
|
+
() => [...h, { key: "actions", header: n("ACTIONS") }],
|
|
139
|
+
[h, n]
|
|
140
140
|
), fe = c(
|
|
141
|
-
(e) => I && e.some((r) => f(r)) ? V :
|
|
142
|
-
[I, f, V,
|
|
143
|
-
),
|
|
141
|
+
(e) => I && e.some((r) => f(r)) ? V : h,
|
|
142
|
+
[I, f, V, h]
|
|
143
|
+
), he = h, pe = d(
|
|
144
144
|
() => [
|
|
145
145
|
{ key: "recordedOn", sortable: !0 },
|
|
146
146
|
{ key: "recordedBy", sortable: !0 }
|
|
@@ -155,7 +155,7 @@ const qe = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_mo
|
|
|
155
155
|
return r[t].push({
|
|
156
156
|
id: o.encounterUuid,
|
|
157
157
|
formName: o.formName,
|
|
158
|
-
recordedOn:
|
|
158
|
+
recordedOn: Be(o.encounterDateTime, n, !0).formattedResult,
|
|
159
159
|
recordedBy: a ?? "--",
|
|
160
160
|
encounterDateTime: o.encounterDateTime,
|
|
161
161
|
encounterUuid: o.encounterUuid
|
|
@@ -171,10 +171,10 @@ const qe = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_mo
|
|
|
171
171
|
)
|
|
172
172
|
})
|
|
173
173
|
).sort((r, o) => r.formName.localeCompare(o.formName));
|
|
174
|
-
}, [k, n]),
|
|
175
|
-
|
|
176
|
-
}, []),
|
|
177
|
-
|
|
174
|
+
}, [k, n]), j = c((e) => {
|
|
175
|
+
R(e), M(!0);
|
|
176
|
+
}, []), z = c(() => {
|
|
177
|
+
M(!1), R(null);
|
|
178
178
|
}, []), F = c((e) => {
|
|
179
179
|
globalThis.dispatchEvent(
|
|
180
180
|
new CustomEvent(He, {
|
|
@@ -187,46 +187,46 @@ const qe = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_mo
|
|
|
187
187
|
}
|
|
188
188
|
})
|
|
189
189
|
);
|
|
190
|
-
}, []),
|
|
190
|
+
}, []), K = c(
|
|
191
191
|
(e, r) => {
|
|
192
192
|
switch (r) {
|
|
193
193
|
case "recordedOn":
|
|
194
|
-
return /* @__PURE__ */ i(
|
|
194
|
+
return /* @__PURE__ */ i(Me, { onClick: () => j(e), children: e.recordedOn });
|
|
195
195
|
case "recordedBy":
|
|
196
196
|
return e.recordedBy;
|
|
197
197
|
case "actions":
|
|
198
198
|
return f(e) ? /* @__PURE__ */ i(
|
|
199
|
-
|
|
199
|
+
$,
|
|
200
200
|
{
|
|
201
201
|
label: n("EDIT_OBSERVATION_FORM"),
|
|
202
202
|
kind: "ghost",
|
|
203
203
|
size: "sm",
|
|
204
204
|
testId: `edit-form-${e.encounterUuid}`,
|
|
205
205
|
onClick: () => F(e),
|
|
206
|
-
children: /* @__PURE__ */ i(
|
|
206
|
+
children: /* @__PURE__ */ i(x, {})
|
|
207
207
|
}
|
|
208
208
|
) : null;
|
|
209
209
|
default:
|
|
210
210
|
return null;
|
|
211
211
|
}
|
|
212
212
|
},
|
|
213
|
-
[
|
|
213
|
+
[j, F, f, n]
|
|
214
214
|
);
|
|
215
215
|
return /* @__PURE__ */ P(ye, { children: [
|
|
216
216
|
/* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children: U || D || H.length === 0 || C ? /* @__PURE__ */ i(
|
|
217
217
|
G,
|
|
218
218
|
{
|
|
219
|
-
headers:
|
|
219
|
+
headers: he,
|
|
220
220
|
ariaLabel: n("FORMS_HEADING"),
|
|
221
221
|
rows: [],
|
|
222
222
|
loading: U,
|
|
223
223
|
errorStateMessage: D ? oe?.message : void 0,
|
|
224
224
|
emptyStateMessage: n("FORMS_UNAVAILABLE"),
|
|
225
|
-
renderCell:
|
|
225
|
+
renderCell: K,
|
|
226
226
|
className: T.formsTableBody,
|
|
227
227
|
dataTestId: "forms-table"
|
|
228
228
|
}
|
|
229
|
-
) : /* @__PURE__ */ i(
|
|
229
|
+
) : /* @__PURE__ */ i(Re, { align: "start", children: H.map((e, r) => {
|
|
230
230
|
const { formName: o, records: t } = e, a = fe(t);
|
|
231
231
|
return /* @__PURE__ */ i(
|
|
232
232
|
Ce,
|
|
@@ -243,9 +243,9 @@ const qe = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_mo
|
|
|
243
243
|
rows: t,
|
|
244
244
|
loading: !1,
|
|
245
245
|
errorStateMessage: "",
|
|
246
|
-
sortable:
|
|
246
|
+
sortable: pe,
|
|
247
247
|
emptyStateMessage: n("FORMS_UNAVAILABLE"),
|
|
248
|
-
renderCell:
|
|
248
|
+
renderCell: K,
|
|
249
249
|
className: T.formsTableBody,
|
|
250
250
|
dataTestId: `forms-table-${o}`
|
|
251
251
|
}
|
|
@@ -260,20 +260,20 @@ const qe = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_mo
|
|
|
260
260
|
id: "modalIdForActionAreaLayout",
|
|
261
261
|
portalId: "main-display-area",
|
|
262
262
|
open: y,
|
|
263
|
-
onRequestClose:
|
|
263
|
+
onRequestClose: z,
|
|
264
264
|
modalHeading: /* @__PURE__ */ P("div", { className: T.modalHeading, children: [
|
|
265
265
|
/* @__PURE__ */ i("span", { children: s.formName }),
|
|
266
266
|
I && f(s) && /* @__PURE__ */ i(
|
|
267
|
-
|
|
267
|
+
$,
|
|
268
268
|
{
|
|
269
269
|
label: n("EDIT_OBSERVATION_FORM"),
|
|
270
270
|
kind: "ghost",
|
|
271
271
|
size: "sm",
|
|
272
272
|
testId: `edit-form-modal-${s.encounterUuid}`,
|
|
273
273
|
onClick: () => {
|
|
274
|
-
|
|
274
|
+
z(), F(s);
|
|
275
275
|
},
|
|
276
|
-
children: /* @__PURE__ */ i(
|
|
276
|
+
children: /* @__PURE__ */ i(x, {})
|
|
277
277
|
}
|
|
278
278
|
)
|
|
279
279
|
] }),
|
|
@@ -301,5 +301,5 @@ const qe = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_mo
|
|
|
301
301
|
] });
|
|
302
302
|
};
|
|
303
303
|
export {
|
|
304
|
-
|
|
304
|
+
Qe as default
|
|
305
305
|
};
|
|
@@ -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-DJb3J_xq.js";
|
|
2
|
+
import { T as d, U as f, Z as e } from "./index-BLBZZpTy.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-DJb3J_xq.js";
|
|
2
|
+
import { T as v, U as C, Z as e } from "./index-BLBZZpTy.js";
|
|
3
3
|
var h = (t) => {
|
|
4
4
|
const [r, o] = s({
|
|
5
5
|
prefix: "TanstackQueryDevtools"
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { jsxs as S, jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { v as x, z as k, u as N, J as q, X as M, m as z, j as Q, k as j, l as w, n as G, Y as H, s as J, O as L, r as Y, L as P, x as X, M as W, y as Z, B as ee } from "./index-BLBZZpTy.js";
|
|
3
|
+
import { useQueries as ae, useQuery as re } from "@tanstack/react-query";
|
|
4
|
+
import { useRef as se, useEffect as f, useMemo as O } from "react";
|
|
5
|
+
const A = (a, n, d, l, b, o) => {
|
|
6
|
+
const r = Y(a, n, b), s = r.value, t = P(s);
|
|
7
|
+
let i = s;
|
|
8
|
+
t === "Image" && (i = /* @__PURE__ */ u(
|
|
9
|
+
W,
|
|
10
|
+
{
|
|
11
|
+
imageSrc: s,
|
|
12
|
+
alt: s,
|
|
13
|
+
id: `${s}-img`,
|
|
14
|
+
hideThumbnail: o
|
|
15
|
+
}
|
|
16
|
+
)), t === "Video" && (i = /* @__PURE__ */ u(
|
|
17
|
+
Z,
|
|
18
|
+
{
|
|
19
|
+
id: `${s}-video`,
|
|
20
|
+
videoSrc: s,
|
|
21
|
+
hideThumbnail: o
|
|
22
|
+
}
|
|
23
|
+
)), t === "PDF" && (i = /* @__PURE__ */ u(ee, { id: `${s}-pdf`, src: s }));
|
|
24
|
+
const m = b("OBSERVATIONS_RECORDED_BY", {
|
|
25
|
+
provider: r.provider
|
|
26
|
+
}), p = a.display, y = a.observationValue?.isAbnormal ? "abnormal-obs" : "obs", c = l ? `${l}-${y}-${p}-${d}-${n}` : `${y}-${p}-${d}-${n}`;
|
|
27
|
+
return /* @__PURE__ */ u(
|
|
28
|
+
X,
|
|
29
|
+
{
|
|
30
|
+
header: r.header,
|
|
31
|
+
value: i,
|
|
32
|
+
info: m,
|
|
33
|
+
id: c,
|
|
34
|
+
testId: c,
|
|
35
|
+
ariaLabel: c
|
|
36
|
+
},
|
|
37
|
+
`obs-${a.id}`
|
|
38
|
+
);
|
|
39
|
+
}, te = (a, n, d, l, b, o, r) => /* @__PURE__ */ u(
|
|
40
|
+
L,
|
|
41
|
+
{
|
|
42
|
+
title: a.display,
|
|
43
|
+
id: `grouped-obs-${a.display}-${l}`,
|
|
44
|
+
open: d,
|
|
45
|
+
children: a.members?.map(
|
|
46
|
+
(s, t) => A(
|
|
47
|
+
s,
|
|
48
|
+
t,
|
|
49
|
+
b,
|
|
50
|
+
o,
|
|
51
|
+
n,
|
|
52
|
+
r
|
|
53
|
+
)
|
|
54
|
+
)
|
|
55
|
+
},
|
|
56
|
+
`grouped-obs-${a.id}`
|
|
57
|
+
), oe = ({
|
|
58
|
+
groupedData: a,
|
|
59
|
+
title: n = "",
|
|
60
|
+
hideThumbnail: d
|
|
61
|
+
}) => {
|
|
62
|
+
const { t: l } = N(), b = (o, r, s) => {
|
|
63
|
+
const t = J(o.encounterDetails, l);
|
|
64
|
+
return /* @__PURE__ */ S(
|
|
65
|
+
L,
|
|
66
|
+
{
|
|
67
|
+
title: t,
|
|
68
|
+
id: `encounter-${o.encounterId}`,
|
|
69
|
+
open: r,
|
|
70
|
+
children: [
|
|
71
|
+
o.observations.map(
|
|
72
|
+
(i, m) => A(
|
|
73
|
+
i,
|
|
74
|
+
m,
|
|
75
|
+
s,
|
|
76
|
+
n,
|
|
77
|
+
l,
|
|
78
|
+
d
|
|
79
|
+
)
|
|
80
|
+
),
|
|
81
|
+
o.groupedObservations.map(
|
|
82
|
+
(i, m) => te(
|
|
83
|
+
i,
|
|
84
|
+
l,
|
|
85
|
+
r,
|
|
86
|
+
m,
|
|
87
|
+
s,
|
|
88
|
+
n,
|
|
89
|
+
d
|
|
90
|
+
)
|
|
91
|
+
)
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
`encounter-${o.encounterId}`
|
|
95
|
+
);
|
|
96
|
+
};
|
|
97
|
+
return /* @__PURE__ */ u(
|
|
98
|
+
"div",
|
|
99
|
+
{
|
|
100
|
+
id: "obs-by-encounter",
|
|
101
|
+
"data-testid": "obs-by-encounter-test-id",
|
|
102
|
+
"aria-label": "obs-by-encounter-aria-label",
|
|
103
|
+
children: a.map(
|
|
104
|
+
(o, r) => b(o, r === 0, r)
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
}, ie = "Observations-module_observations__RKSyo", ne = "Observations-module_title__TJL3z", $ = {
|
|
109
|
+
observations: ie,
|
|
110
|
+
title: ne
|
|
111
|
+
}, de = (a) => ["conceptUuid", a], le = (a, n) => ["observations", a, ...n], pe = ({ config: a }) => {
|
|
112
|
+
const n = a, {
|
|
113
|
+
conceptNames: d = [],
|
|
114
|
+
conceptUuid: l = [],
|
|
115
|
+
hideThumbnail: b = !1
|
|
116
|
+
} = n, o = se(/* @__PURE__ */ new Set()), r = x(), { addNotification: s } = k(), { t } = N(), i = ae({
|
|
117
|
+
queries: d.map((e) => ({
|
|
118
|
+
queryKey: de(e),
|
|
119
|
+
queryFn: () => q(e),
|
|
120
|
+
enabled: !!e
|
|
121
|
+
}))
|
|
122
|
+
});
|
|
123
|
+
f(() => {
|
|
124
|
+
i.forEach((e, h) => {
|
|
125
|
+
if (e.isError && !o.current.has(h)) {
|
|
126
|
+
const K = d[h];
|
|
127
|
+
s({
|
|
128
|
+
title: t("ERROR_DEFAULT_TITLE"),
|
|
129
|
+
message: t("ERROR_FETCHING_CONCEPT", { conceptName: K }),
|
|
130
|
+
type: "error"
|
|
131
|
+
}), o.current.add(h);
|
|
132
|
+
} else e.isError || o.current.delete(h);
|
|
133
|
+
});
|
|
134
|
+
}, [i, d]);
|
|
135
|
+
const m = O(() => i.map((e) => e.data?.uuid).filter((e) => !!e), [i]), p = O(() => [.../* @__PURE__ */ new Set([...m, ...l])], [m, l]), y = O(() => d.length === 0 ? !0 : i.every((e) => !e.isLoading), [i, d.length]), {
|
|
136
|
+
data: c,
|
|
137
|
+
isLoading: B,
|
|
138
|
+
isError: T,
|
|
139
|
+
refetch: R
|
|
140
|
+
} = re({
|
|
141
|
+
queryKey: le(r, p),
|
|
142
|
+
queryFn: () => M(r, p),
|
|
143
|
+
enabled: !!r && p.length > 0 && y
|
|
144
|
+
});
|
|
145
|
+
z(
|
|
146
|
+
(e) => {
|
|
147
|
+
e.patientUUID === r && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
|
|
148
|
+
(h) => p.includes(h)
|
|
149
|
+
) && R();
|
|
150
|
+
},
|
|
151
|
+
[r, R]
|
|
152
|
+
), f(() => {
|
|
153
|
+
T && s({
|
|
154
|
+
title: t("ERROR_DEFAULT_TITLE"),
|
|
155
|
+
message: t("ERROR_FETCHING_OBSERVATIONS"),
|
|
156
|
+
type: "error"
|
|
157
|
+
});
|
|
158
|
+
}, [T]);
|
|
159
|
+
const g = O(() => {
|
|
160
|
+
if (!c) return [];
|
|
161
|
+
const e = Q(c), h = j(e);
|
|
162
|
+
return w(h);
|
|
163
|
+
}, [c]), D = [
|
|
164
|
+
{ key: "name", header: "name" },
|
|
165
|
+
{ key: "value", header: "value" },
|
|
166
|
+
{ key: "form", header: "form" }
|
|
167
|
+
], I = B || !y, _ = T && y, F = (!c || c.entry?.length === 0 || p.length === 0) && y, V = _ ? t("ERROR_FETCHING_OBSERVATIONS") : null, U = F ? t("NO_OBSERVATIONS_FOUND") : void 0, C = g.length > 0 && !I && !_, E = n.titleTranslationKey, v = E ? t(E) : "";
|
|
168
|
+
return /* @__PURE__ */ S(
|
|
169
|
+
"div",
|
|
170
|
+
{
|
|
171
|
+
id: "observations",
|
|
172
|
+
"data-testid": E ? `observations-${v}` : "observations",
|
|
173
|
+
"aria-label": "observations-aria-label",
|
|
174
|
+
className: $.observations,
|
|
175
|
+
children: [
|
|
176
|
+
/* @__PURE__ */ u(
|
|
177
|
+
G,
|
|
178
|
+
{
|
|
179
|
+
id: "observations-title",
|
|
180
|
+
testId: E ? `observations-title-${v}` : "observations-title",
|
|
181
|
+
title: v,
|
|
182
|
+
className: $.title,
|
|
183
|
+
children: /* @__PURE__ */ u("p", { children: v })
|
|
184
|
+
}
|
|
185
|
+
),
|
|
186
|
+
C ? /* @__PURE__ */ u(
|
|
187
|
+
oe,
|
|
188
|
+
{
|
|
189
|
+
groupedData: g,
|
|
190
|
+
title: v,
|
|
191
|
+
hideThumbnail: b
|
|
192
|
+
}
|
|
193
|
+
) : /* @__PURE__ */ u(
|
|
194
|
+
H,
|
|
195
|
+
{
|
|
196
|
+
headers: D,
|
|
197
|
+
rows: [],
|
|
198
|
+
ariaLabel: t("OBSERVATIONS"),
|
|
199
|
+
loading: I,
|
|
200
|
+
errorStateMessage: V,
|
|
201
|
+
emptyStateMessage: U ?? t("NO_OBSERVATIONS_AVAILABLE"),
|
|
202
|
+
dataTestId: "observations-table"
|
|
203
|
+
}
|
|
204
|
+
)
|
|
205
|
+
]
|
|
206
|
+
}
|
|
207
|
+
);
|
|
208
|
+
};
|
|
209
|
+
export {
|
|
210
|
+
de as conceptUuidQueryKeys,
|
|
211
|
+
pe as default,
|
|
212
|
+
le as observationsQueryKeys
|
|
213
|
+
};
|