@bahmni/appointments-app 0.0.1-dev.408 → 0.0.1-dev.410
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-BSBWfrYe-7sT9K9jA.js → DocumentsTable-DYaZZTBA-DvCjrOBZ.js} +1 -1
- package/dist/FormsTable-m3xk-F34-CvHAKK4l.js +272 -0
- package/dist/{LNWAZHJI-Dzu6p6g6.js → LNWAZHJI-DgVCOB8V.js} +10 -10
- package/dist/{MWZ6AO7Z-CO-OnM_M.js → MWZ6AO7Z-d44xNVJl.js} +7 -7
- package/dist/Observations-BjPcu9m0-D28FP8If.js +246 -0
- package/dist/{YPM2AS64-CBzS55qv.js → YPM2AS64-xujzTpMG.js} +1 -1
- package/dist/{index-SYnmvoqG.js → index-ClUHCl2k.js} +35807 -35726
- package/dist/{index-CnBnwkoy.js → index-Cz00oY59.js} +16 -16
- package/dist/{index-BzoSgaWK.js → index-D_X9nUGj.js} +9 -9
- package/dist/index.css +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/FormsTable-D8eS1feV-CIT_9HX0.js +0 -305
- package/dist/Observations-CbJng7Yn-CZ5BTdqm.js +0 -213
|
@@ -1,305 +0,0 @@
|
|
|
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, 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-SYnmvoqG.js";
|
|
3
|
-
import { useQueryClient as ke, useQuery as N } from "@tanstack/react-query";
|
|
4
|
-
import { useState as Y, useMemo as d, useCallback as c } from "react";
|
|
5
|
-
const qe = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_modalHeading__wnTmA", Ve = "FormsTable-module_customAccordianItem__isszs", T = {
|
|
6
|
-
formsTableBody: qe,
|
|
7
|
-
modalHeading: we,
|
|
8
|
-
customAccordianItem: Ve
|
|
9
|
-
}, He = "startConsultation", Qe = ({
|
|
10
|
-
episodeOfCareUuids: B,
|
|
11
|
-
encounterUuids: m,
|
|
12
|
-
config: X,
|
|
13
|
-
disableActions: Z = !1,
|
|
14
|
-
activeEncounterUuid: p = null
|
|
15
|
-
}) => {
|
|
16
|
-
const { t: n } = ge(), u = be(), [y, M] = Y(!1), [s, R] = Y(null), {
|
|
17
|
-
numberOfVisits: J,
|
|
18
|
-
hideThumbnail: W = !1,
|
|
19
|
-
forms: g
|
|
20
|
-
} = X ?? {}, ee = Oe(
|
|
21
|
-
De.EDIT_OBSERVATIONS
|
|
22
|
-
), { userPrivileges: b } = Ne(), I = ee && !Z && !!p, C = Te(
|
|
23
|
-
B,
|
|
24
|
-
m
|
|
25
|
-
), re = ke(), {
|
|
26
|
-
data: L = [],
|
|
27
|
-
isLoading: U,
|
|
28
|
-
isError: D,
|
|
29
|
-
error: oe,
|
|
30
|
-
refetch: ae
|
|
31
|
-
} = N({
|
|
32
|
-
queryKey: ["forms", u, B],
|
|
33
|
-
queryFn: () => Ie(u, void 0, J),
|
|
34
|
-
enabled: !!u && !C
|
|
35
|
-
}), k = d(() => {
|
|
36
|
-
let e = L;
|
|
37
|
-
return m && m.length > 0 && (e = e.filter(
|
|
38
|
-
(r) => m.includes(r.encounterUuid)
|
|
39
|
-
)), Array.isArray(g) && g.length > 0 && (e = e.filter(
|
|
40
|
-
(r) => g.some((o) => o.toLowerCase() === r.formName.toLowerCase())
|
|
41
|
-
)), e;
|
|
42
|
-
}, [L, m, g]), { data: O = [] } = N({
|
|
43
|
-
queryKey: ["observationForms"],
|
|
44
|
-
queryFn: () => Ae()
|
|
45
|
-
}), q = c(
|
|
46
|
-
(e) => {
|
|
47
|
-
const r = O.find((t) => t.name === e);
|
|
48
|
-
if (!r?.privileges || r.privileges.length === 0) return !0;
|
|
49
|
-
if (!b || b.length === 0) return !1;
|
|
50
|
-
const o = new Set(b.map((t) => t.name));
|
|
51
|
-
return r.privileges.some(
|
|
52
|
-
(t) => o.has(t.privilegeName) && t.editable
|
|
53
|
-
);
|
|
54
|
-
},
|
|
55
|
-
[O, b]
|
|
56
|
-
), f = c(
|
|
57
|
-
(e) => !p || e.encounterUuid !== p ? !1 : q(e.formName),
|
|
58
|
-
[p, q]
|
|
59
|
-
), w = c(
|
|
60
|
-
(e) => O.find((r) => r.name === e)?.uuid,
|
|
61
|
-
[O]
|
|
62
|
-
), A = d(() => {
|
|
63
|
-
if (s)
|
|
64
|
-
return w(s.formName);
|
|
65
|
-
}, [s, w]), {
|
|
66
|
-
data: l,
|
|
67
|
-
isLoading: te,
|
|
68
|
-
isError: se,
|
|
69
|
-
error: E
|
|
70
|
-
} = N({
|
|
71
|
-
queryKey: ["formMetadata", A],
|
|
72
|
-
queryFn: () => Ee(A),
|
|
73
|
-
enabled: !!A && y
|
|
74
|
-
}), {
|
|
75
|
-
data: v,
|
|
76
|
-
isLoading: ne,
|
|
77
|
-
isError: ie,
|
|
78
|
-
error: _
|
|
79
|
-
} = N({
|
|
80
|
-
queryKey: ["formsEncounterFHIR", s?.encounterUuid],
|
|
81
|
-
queryFn: () => ve(s.encounterUuid),
|
|
82
|
-
enabled: !!s?.encounterUuid && y
|
|
83
|
-
});
|
|
84
|
-
_e(
|
|
85
|
-
(e) => {
|
|
86
|
-
e.patientUUID === u && (ae(), re.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
|
|
87
|
-
},
|
|
88
|
-
[u]
|
|
89
|
-
);
|
|
90
|
-
const de = d(() => !v?.entry || !s?.formName ? [] : v.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => Fe(e) ? Se(e)?.toLowerCase() === s.formName.toLowerCase() : !0), [v, s?.formName]), le = d(() => {
|
|
91
|
-
if (!l?.schema) return;
|
|
92
|
-
const e = [], r = (o) => {
|
|
93
|
-
(o ?? []).forEach((t) => {
|
|
94
|
-
const a = t;
|
|
95
|
-
a.id != null && e.push(String(a.id)), a.controls && r(a.controls);
|
|
96
|
-
});
|
|
97
|
-
};
|
|
98
|
-
return r(
|
|
99
|
-
l.schema.controls ?? []
|
|
100
|
-
), e.length > 0 ? e : void 0;
|
|
101
|
-
}, [l]), ce = d(() => {
|
|
102
|
-
if (!l?.schema) return;
|
|
103
|
-
const e = {}, r = (o, t) => {
|
|
104
|
-
for (const a of o)
|
|
105
|
-
if (a.type === "section") {
|
|
106
|
-
const S = a.label?.value ?? "Section";
|
|
107
|
-
r(a.controls ?? [], S);
|
|
108
|
-
} else
|
|
109
|
-
a.id != null && t && (e[String(a.id)] = t), a.controls && r(a.controls, t);
|
|
110
|
-
};
|
|
111
|
-
return r(
|
|
112
|
-
l.schema.controls ?? [],
|
|
113
|
-
null
|
|
114
|
-
), Object.keys(e).length > 0 ? e : void 0;
|
|
115
|
-
}, [l]), me = d(() => {
|
|
116
|
-
if (!l?.schema) return;
|
|
117
|
-
const e = {}, r = (o) => {
|
|
118
|
-
(o ?? []).forEach((t) => {
|
|
119
|
-
const a = t;
|
|
120
|
-
a.concept?.uuid && a.concept?.datatype && (e[a.concept.uuid] = a.concept.datatype), a.controls && r(a.controls);
|
|
121
|
-
});
|
|
122
|
-
};
|
|
123
|
-
return r(
|
|
124
|
-
l.schema.controls ?? []
|
|
125
|
-
), Object.keys(e).length > 0 ? e : void 0;
|
|
126
|
-
}, [l]), ue = d(() => {
|
|
127
|
-
if (E)
|
|
128
|
-
return Q(E).message;
|
|
129
|
-
if (_)
|
|
130
|
-
return Q(_).message;
|
|
131
|
-
}, [E, _]), h = d(
|
|
132
|
-
() => [
|
|
133
|
-
{ key: "recordedOn", header: n("RECORDED_ON") },
|
|
134
|
-
{ key: "recordedBy", header: n("RECORDED_BY") }
|
|
135
|
-
],
|
|
136
|
-
[n]
|
|
137
|
-
), V = d(
|
|
138
|
-
() => [...h, { key: "actions", header: n("ACTIONS") }],
|
|
139
|
-
[h, n]
|
|
140
|
-
), fe = c(
|
|
141
|
-
(e) => I && e.some((r) => f(r)) ? V : h,
|
|
142
|
-
[I, f, V, h]
|
|
143
|
-
), he = h, pe = d(
|
|
144
|
-
() => [
|
|
145
|
-
{ key: "recordedOn", sortable: !0 },
|
|
146
|
-
{ key: "recordedBy", sortable: !0 }
|
|
147
|
-
],
|
|
148
|
-
[]
|
|
149
|
-
), H = d(() => {
|
|
150
|
-
const e = k.reduce(
|
|
151
|
-
(r, o) => {
|
|
152
|
-
const t = o.formName;
|
|
153
|
-
r[t] ??= [];
|
|
154
|
-
const a = o.providers.map((S) => S.providerName).filter(Boolean).join(", ");
|
|
155
|
-
return r[t].push({
|
|
156
|
-
id: o.encounterUuid,
|
|
157
|
-
formName: o.formName,
|
|
158
|
-
recordedOn: Be(o.encounterDateTime, n, !0).formattedResult,
|
|
159
|
-
recordedBy: a ?? "--",
|
|
160
|
-
encounterDateTime: o.encounterDateTime,
|
|
161
|
-
encounterUuid: o.encounterUuid
|
|
162
|
-
}), r;
|
|
163
|
-
},
|
|
164
|
-
{}
|
|
165
|
-
);
|
|
166
|
-
return Object.entries(e).map(
|
|
167
|
-
([r, o]) => ({
|
|
168
|
-
formName: r,
|
|
169
|
-
records: o.sort(
|
|
170
|
-
(t, a) => a.encounterDateTime - t.encounterDateTime
|
|
171
|
-
)
|
|
172
|
-
})
|
|
173
|
-
).sort((r, o) => r.formName.localeCompare(o.formName));
|
|
174
|
-
}, [k, n]), j = c((e) => {
|
|
175
|
-
R(e), M(!0);
|
|
176
|
-
}, []), z = c(() => {
|
|
177
|
-
M(!1), R(null);
|
|
178
|
-
}, []), F = c((e) => {
|
|
179
|
-
globalThis.dispatchEvent(
|
|
180
|
-
new CustomEvent(He, {
|
|
181
|
-
detail: {
|
|
182
|
-
editOnly: "observationForms",
|
|
183
|
-
editTitle: "EDIT_OBSERVATION_FORM_TITLE",
|
|
184
|
-
sourceEncounterUuid: e.encounterUuid,
|
|
185
|
-
formName: e.formName,
|
|
186
|
-
directFormMode: !0
|
|
187
|
-
}
|
|
188
|
-
})
|
|
189
|
-
);
|
|
190
|
-
}, []), K = c(
|
|
191
|
-
(e, r) => {
|
|
192
|
-
switch (r) {
|
|
193
|
-
case "recordedOn":
|
|
194
|
-
return /* @__PURE__ */ i(Me, { onClick: () => j(e), children: e.recordedOn });
|
|
195
|
-
case "recordedBy":
|
|
196
|
-
return e.recordedBy;
|
|
197
|
-
case "actions":
|
|
198
|
-
return f(e) ? /* @__PURE__ */ i(
|
|
199
|
-
$,
|
|
200
|
-
{
|
|
201
|
-
label: n("EDIT_OBSERVATION_FORM"),
|
|
202
|
-
kind: "ghost",
|
|
203
|
-
size: "sm",
|
|
204
|
-
testId: `edit-form-${e.encounterUuid}`,
|
|
205
|
-
onClick: () => F(e),
|
|
206
|
-
children: /* @__PURE__ */ i(x, {})
|
|
207
|
-
}
|
|
208
|
-
) : null;
|
|
209
|
-
default:
|
|
210
|
-
return null;
|
|
211
|
-
}
|
|
212
|
-
},
|
|
213
|
-
[j, F, f, n]
|
|
214
|
-
);
|
|
215
|
-
return /* @__PURE__ */ P(ye, { children: [
|
|
216
|
-
/* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children: U || D || H.length === 0 || C ? /* @__PURE__ */ i(
|
|
217
|
-
G,
|
|
218
|
-
{
|
|
219
|
-
headers: he,
|
|
220
|
-
ariaLabel: n("FORMS_HEADING"),
|
|
221
|
-
rows: [],
|
|
222
|
-
loading: U,
|
|
223
|
-
errorStateMessage: D ? oe?.message : void 0,
|
|
224
|
-
emptyStateMessage: n("FORMS_UNAVAILABLE"),
|
|
225
|
-
renderCell: K,
|
|
226
|
-
className: T.formsTableBody,
|
|
227
|
-
dataTestId: "forms-table"
|
|
228
|
-
}
|
|
229
|
-
) : /* @__PURE__ */ i(Re, { align: "start", children: H.map((e, r) => {
|
|
230
|
-
const { formName: o, records: t } = e, a = fe(t);
|
|
231
|
-
return /* @__PURE__ */ i(
|
|
232
|
-
Ce,
|
|
233
|
-
{
|
|
234
|
-
title: o,
|
|
235
|
-
className: T.customAccordianItem,
|
|
236
|
-
testId: `accordian-title-${o}`,
|
|
237
|
-
open: r === 0,
|
|
238
|
-
children: /* @__PURE__ */ i(
|
|
239
|
-
G,
|
|
240
|
-
{
|
|
241
|
-
headers: a,
|
|
242
|
-
ariaLabel: n("FORMS_HEADING"),
|
|
243
|
-
rows: t,
|
|
244
|
-
loading: !1,
|
|
245
|
-
errorStateMessage: "",
|
|
246
|
-
sortable: pe,
|
|
247
|
-
emptyStateMessage: n("FORMS_UNAVAILABLE"),
|
|
248
|
-
renderCell: K,
|
|
249
|
-
className: T.formsTableBody,
|
|
250
|
-
dataTestId: `forms-table-${o}`
|
|
251
|
-
}
|
|
252
|
-
)
|
|
253
|
-
},
|
|
254
|
-
o
|
|
255
|
-
);
|
|
256
|
-
}) }) }),
|
|
257
|
-
y && s && /* @__PURE__ */ i(
|
|
258
|
-
Le,
|
|
259
|
-
{
|
|
260
|
-
id: "modalIdForActionAreaLayout",
|
|
261
|
-
portalId: "main-display-area",
|
|
262
|
-
open: y,
|
|
263
|
-
onRequestClose: z,
|
|
264
|
-
modalHeading: /* @__PURE__ */ P("div", { className: T.modalHeading, children: [
|
|
265
|
-
/* @__PURE__ */ i("span", { children: s.formName }),
|
|
266
|
-
I && f(s) && /* @__PURE__ */ i(
|
|
267
|
-
$,
|
|
268
|
-
{
|
|
269
|
-
label: n("EDIT_OBSERVATION_FORM"),
|
|
270
|
-
kind: "ghost",
|
|
271
|
-
size: "sm",
|
|
272
|
-
testId: `edit-form-modal-${s.encounterUuid}`,
|
|
273
|
-
onClick: () => {
|
|
274
|
-
z(), F(s);
|
|
275
|
-
},
|
|
276
|
-
children: /* @__PURE__ */ i(x, {})
|
|
277
|
-
}
|
|
278
|
-
)
|
|
279
|
-
] }),
|
|
280
|
-
modalLabel: `${s.recordedOn} | ${s.recordedBy}`,
|
|
281
|
-
passiveModal: !0,
|
|
282
|
-
size: "md",
|
|
283
|
-
testId: "form-details-modal",
|
|
284
|
-
children: /* @__PURE__ */ i(
|
|
285
|
-
Ue,
|
|
286
|
-
{
|
|
287
|
-
observations: de,
|
|
288
|
-
isLoading: te || ne,
|
|
289
|
-
isError: se || ie,
|
|
290
|
-
errorMessage: ue,
|
|
291
|
-
emptyStateMessage: n("NO_FORM_DATA_AVAILABLE"),
|
|
292
|
-
testIdPrefix: s.formName,
|
|
293
|
-
hideThumbnail: W,
|
|
294
|
-
controlOrder: le,
|
|
295
|
-
sectionMap: ce,
|
|
296
|
-
conceptDatatypeMap: me
|
|
297
|
-
}
|
|
298
|
-
)
|
|
299
|
-
}
|
|
300
|
-
)
|
|
301
|
-
] });
|
|
302
|
-
};
|
|
303
|
-
export {
|
|
304
|
-
Qe as default
|
|
305
|
-
};
|
|
@@ -1,213 +0,0 @@
|
|
|
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-SYnmvoqG.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
|
-
};
|