@bahmni/appointments-app 0.0.1-dev.405 → 0.0.1-dev.409
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-CIJwgXmb-D1TQHecI.js → DocumentsTable-ju-Rev1y-Dk2ESvXf.js} +11 -11
- package/dist/{FormsTable-DMPfuqmY-CPlSuZtA.js → FormsTable-CTy4JTE8-Cn7OXlPy.js} +65 -65
- package/dist/{LNWAZHJI-yNLSiU7P.js → LNWAZHJI-DHAhIGpP.js} +7 -7
- package/dist/{MWZ6AO7Z-1OLYoGcm.js → MWZ6AO7Z-BoGt41p_.js} +2 -2
- package/dist/Observations-GHKQrxHf-C5n95y1v.js +246 -0
- package/dist/{YPM2AS64-BSMOwRa0.js → YPM2AS64-DO638Kn-.js} +1 -1
- package/dist/{index-C5qmSsJM.js → index-5kVVG9ro.js} +18 -18
- package/dist/{index-Cl8zGTvc.js → index-CrHWa1Oc.js} +32 -32
- package/dist/{index-CDAgqrus.js → index-DqgfD6Rf.js} +28953 -28897
- package/dist/index.css +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/Observations-BflI1_YX-Cp-d90I-.js +0 -213
|
@@ -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, n as J, q as X, w as Z, Y as ee, p as te } from "./index-DqgfD6Rf.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,45 +1,45 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
2
|
-
import { u as ge, v as be, e as Oe, a as
|
|
3
|
-
import { useQueryClient as ke, useQuery as
|
|
4
|
-
import { useState as
|
|
5
|
-
const qe = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_modalHeading__wnTmA", Ve = "FormsTable-module_customAccordianItem__isszs",
|
|
1
|
+
import { jsx as i, jsxs as x, Fragment as ye } from "react/jsx-runtime";
|
|
2
|
+
import { u as ge, v as be, e as Oe, a as Te, b as Ne, r as Ie, m as Ae, t as Ee, c as ve, d as _e, f as Fe, g as Se, S as K, w as Be, A as z, V as G, q as Me, Y as Q, P as Ce, F as Le, p as Ue, h as De, y as Re } from "./index-DqgfD6Rf.js";
|
|
3
|
+
import { useQueryClient as ke, useQuery as T } 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", N = {
|
|
6
6
|
formsTableBody: qe,
|
|
7
7
|
modalHeading: we,
|
|
8
8
|
customAccordianItem: Ve
|
|
9
|
-
}, He = "startConsultation",
|
|
10
|
-
episodeOfCareUuids:
|
|
9
|
+
}, He = "startConsultation", Ke = ({
|
|
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, C] = Y(null), {
|
|
17
17
|
numberOfVisits: J,
|
|
18
18
|
hideThumbnail: W = !1,
|
|
19
19
|
forms: g
|
|
20
20
|
} = X ?? {}, ee = Oe(
|
|
21
|
-
|
|
22
|
-
), { userPrivileges: b } =
|
|
23
|
-
|
|
21
|
+
Re.EDIT_OBSERVATIONS
|
|
22
|
+
), { userPrivileges: b } = Te(), I = ee && !Z && !!p, L = Ne(
|
|
23
|
+
B,
|
|
24
24
|
m
|
|
25
25
|
), re = ke(), {
|
|
26
|
-
data:
|
|
27
|
-
isLoading:
|
|
28
|
-
isError:
|
|
26
|
+
data: U = [],
|
|
27
|
+
isLoading: D,
|
|
28
|
+
isError: R,
|
|
29
29
|
error: oe,
|
|
30
30
|
refetch: ae
|
|
31
|
-
} =
|
|
32
|
-
queryKey: ["forms", u,
|
|
31
|
+
} = T({
|
|
32
|
+
queryKey: ["forms", u, B],
|
|
33
33
|
queryFn: () => Ie(u, void 0, J),
|
|
34
|
-
enabled: !!u && !
|
|
34
|
+
enabled: !!u && !L
|
|
35
35
|
}), k = d(() => {
|
|
36
|
-
let e =
|
|
36
|
+
let e = U;
|
|
37
37
|
return m && m.length > 0 && (e = e.filter(
|
|
38
38
|
(r) => m.includes(r.encounterUuid)
|
|
39
39
|
)), Array.isArray(g) && g.length > 0 && (e = e.filter(
|
|
40
40
|
(r) => g.some((o) => o.toLowerCase() === r.formName.toLowerCase())
|
|
41
41
|
)), e;
|
|
42
|
-
}, [
|
|
42
|
+
}, [U, m, g]), { data: O = [] } = T({
|
|
43
43
|
queryKey: ["observationForms"],
|
|
44
44
|
queryFn: () => Ae()
|
|
45
45
|
}), q = c(
|
|
@@ -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]
|
|
@@ -67,7 +67,7 @@ const qe = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_mo
|
|
|
67
67
|
isLoading: te,
|
|
68
68
|
isError: se,
|
|
69
69
|
error: E
|
|
70
|
-
} =
|
|
70
|
+
} = T({
|
|
71
71
|
queryKey: ["formMetadata", A],
|
|
72
72
|
queryFn: () => Ee(A),
|
|
73
73
|
enabled: !!A && y
|
|
@@ -76,7 +76,7 @@ const qe = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_mo
|
|
|
76
76
|
isLoading: ne,
|
|
77
77
|
isError: ie,
|
|
78
78
|
error: _
|
|
79
|
-
} =
|
|
79
|
+
} = T({
|
|
80
80
|
queryKey: ["formsEncounterFHIR", s?.encounterUuid],
|
|
81
81
|
queryFn: () => ve(s.encounterUuid),
|
|
82
82
|
enabled: !!s?.encounterUuid && y
|
|
@@ -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 K(E).message;
|
|
129
129
|
if (_)
|
|
130
|
-
return
|
|
131
|
-
}, [E, _]),
|
|
130
|
+
return K(_).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
|
+
C(e), M(!0);
|
|
176
|
+
}, []), P = c(() => {
|
|
177
|
+
M(!1), C(null);
|
|
178
178
|
}, []), F = c((e) => {
|
|
179
179
|
globalThis.dispatchEvent(
|
|
180
180
|
new CustomEvent(He, {
|
|
@@ -187,66 +187,66 @@ const qe = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_mo
|
|
|
187
187
|
}
|
|
188
188
|
})
|
|
189
189
|
);
|
|
190
|
-
}, []),
|
|
190
|
+
}, []), $ = 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
|
+
z,
|
|
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(G, {})
|
|
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
|
-
return /* @__PURE__ */
|
|
216
|
-
/* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children:
|
|
217
|
-
|
|
215
|
+
return /* @__PURE__ */ x(ye, { children: [
|
|
216
|
+
/* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children: D || R || H.length === 0 || L ? /* @__PURE__ */ i(
|
|
217
|
+
Q,
|
|
218
218
|
{
|
|
219
|
-
headers:
|
|
219
|
+
headers: he,
|
|
220
220
|
ariaLabel: n("FORMS_HEADING"),
|
|
221
221
|
rows: [],
|
|
222
|
-
loading:
|
|
223
|
-
errorStateMessage:
|
|
222
|
+
loading: D,
|
|
223
|
+
errorStateMessage: R ? oe?.message : void 0,
|
|
224
224
|
emptyStateMessage: n("FORMS_UNAVAILABLE"),
|
|
225
|
-
renderCell:
|
|
226
|
-
className:
|
|
225
|
+
renderCell: $,
|
|
226
|
+
className: N.formsTableBody,
|
|
227
227
|
dataTestId: "forms-table"
|
|
228
228
|
}
|
|
229
|
-
) : /* @__PURE__ */ i(
|
|
229
|
+
) : /* @__PURE__ */ i(Ce, { 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
|
+
Le,
|
|
233
233
|
{
|
|
234
234
|
title: o,
|
|
235
|
-
className:
|
|
235
|
+
className: N.customAccordianItem,
|
|
236
236
|
testId: `accordian-title-${o}`,
|
|
237
237
|
open: r === 0,
|
|
238
238
|
children: /* @__PURE__ */ i(
|
|
239
|
-
|
|
239
|
+
Q,
|
|
240
240
|
{
|
|
241
241
|
headers: a,
|
|
242
242
|
ariaLabel: n("FORMS_HEADING"),
|
|
243
243
|
rows: t,
|
|
244
244
|
loading: !1,
|
|
245
245
|
errorStateMessage: "",
|
|
246
|
-
sortable:
|
|
246
|
+
sortable: pe,
|
|
247
247
|
emptyStateMessage: n("FORMS_UNAVAILABLE"),
|
|
248
|
-
renderCell:
|
|
249
|
-
className:
|
|
248
|
+
renderCell: $,
|
|
249
|
+
className: N.formsTableBody,
|
|
250
250
|
dataTestId: `forms-table-${o}`
|
|
251
251
|
}
|
|
252
252
|
)
|
|
@@ -255,25 +255,25 @@ const qe = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_mo
|
|
|
255
255
|
);
|
|
256
256
|
}) }) }),
|
|
257
257
|
y && s && /* @__PURE__ */ i(
|
|
258
|
-
|
|
258
|
+
Ue,
|
|
259
259
|
{
|
|
260
260
|
id: "modalIdForActionAreaLayout",
|
|
261
261
|
portalId: "main-display-area",
|
|
262
262
|
open: y,
|
|
263
|
-
onRequestClose:
|
|
264
|
-
modalHeading: /* @__PURE__ */
|
|
263
|
+
onRequestClose: P,
|
|
264
|
+
modalHeading: /* @__PURE__ */ x("div", { className: N.modalHeading, children: [
|
|
265
265
|
/* @__PURE__ */ i("span", { children: s.formName }),
|
|
266
266
|
I && f(s) && /* @__PURE__ */ i(
|
|
267
|
-
|
|
267
|
+
z,
|
|
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
|
+
P(), F(s);
|
|
275
275
|
},
|
|
276
|
-
children: /* @__PURE__ */ i(
|
|
276
|
+
children: /* @__PURE__ */ i(G, {})
|
|
277
277
|
}
|
|
278
278
|
)
|
|
279
279
|
] }),
|
|
@@ -282,7 +282,7 @@ const qe = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_mo
|
|
|
282
282
|
size: "md",
|
|
283
283
|
testId: "form-details-modal",
|
|
284
284
|
children: /* @__PURE__ */ i(
|
|
285
|
-
|
|
285
|
+
De,
|
|
286
286
|
{
|
|
287
287
|
observations: de,
|
|
288
288
|
isLoading: te || ne,
|
|
@@ -301,5 +301,5 @@ const qe = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_mo
|
|
|
301
301
|
] });
|
|
302
302
|
};
|
|
303
303
|
export {
|
|
304
|
-
|
|
304
|
+
Ke as default
|
|
305
305
|
};
|
|
@@ -1,25 +1,25 @@
|
|
|
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-DO638Kn-.js";
|
|
2
|
+
import { ap as p, aq as d, ar as e } from "./index-DqgfD6Rf.js";
|
|
3
3
|
var f = (a) => {
|
|
4
|
-
const [r,
|
|
4
|
+
const [r, t] = c({
|
|
5
5
|
prefix: "TanstackQueryDevtools"
|
|
6
6
|
}), n = p(), s = d(() => {
|
|
7
|
-
const
|
|
8
|
-
return
|
|
7
|
+
const o = r.theme_preference || l;
|
|
8
|
+
return o !== "system" ? o : n();
|
|
9
9
|
});
|
|
10
10
|
return e(i.Provider, {
|
|
11
11
|
value: a,
|
|
12
12
|
get children() {
|
|
13
13
|
return e(m, {
|
|
14
14
|
localStore: r,
|
|
15
|
-
setLocalStore:
|
|
15
|
+
setLocalStore: t,
|
|
16
16
|
get children() {
|
|
17
17
|
return e(u.Provider, {
|
|
18
18
|
value: s,
|
|
19
19
|
get children() {
|
|
20
20
|
return e(v, {
|
|
21
21
|
localStore: r,
|
|
22
|
-
setLocalStore:
|
|
22
|
+
setLocalStore: t
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
});
|
|
@@ -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-DO638Kn-.js";
|
|
2
|
+
import { ap as v, aq as C, ar as e } from "./index-DqgfD6Rf.js";
|
|
3
3
|
var h = (t) => {
|
|
4
4
|
const [r, o] = s({
|
|
5
5
|
prefix: "TanstackQueryDevtools"
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { jsxs as I, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { v as M, z, u as B, X as G, b as j, i as H, Q as Y, d as X, j as J, k as P, l as W, o as Z, s as ee, Y as ae, x as se, L as U, B as re, C as te, w as ie, D as oe, M as ne, E as de, G as le } from "./index-DqgfD6Rf.js";
|
|
3
|
+
import { useQueries as ue, useQuery as ce } from "@tanstack/react-query";
|
|
4
|
+
import { useRef as pe, useEffect as D, useMemo as g } from "react";
|
|
5
|
+
const me = "Observations-module_observations__RKSyo", be = "Observations-module_title__TJL3z", ve = "Observations-module_wrapper__muk2L", he = "Observations-module_secondary__14nuS", O = {
|
|
6
|
+
observations: me,
|
|
7
|
+
title: be,
|
|
8
|
+
wrapper: ve,
|
|
9
|
+
secondary: he
|
|
10
|
+
}, V = (s, l, o, d, c, r) => {
|
|
11
|
+
const t = re(s, l, c), e = t.value, p = te(e);
|
|
12
|
+
let i = e;
|
|
13
|
+
p === "Image" && (i = /* @__PURE__ */ n(
|
|
14
|
+
ne,
|
|
15
|
+
{
|
|
16
|
+
imageSrc: e,
|
|
17
|
+
alt: e,
|
|
18
|
+
id: `${e}-img`,
|
|
19
|
+
hideThumbnail: r
|
|
20
|
+
}
|
|
21
|
+
)), p === "Video" && (i = /* @__PURE__ */ n(
|
|
22
|
+
de,
|
|
23
|
+
{
|
|
24
|
+
id: `${e}-video`,
|
|
25
|
+
videoSrc: e,
|
|
26
|
+
hideThumbnail: r
|
|
27
|
+
}
|
|
28
|
+
)), p === "PDF" && (i = /* @__PURE__ */ n(le, { id: `${e}-pdf`, src: e }));
|
|
29
|
+
const m = /* @__PURE__ */ I("div", { className: O.wrapper, children: [
|
|
30
|
+
/* @__PURE__ */ n("span", { children: t.header.display }),
|
|
31
|
+
t.header.referenceRange && /* @__PURE__ */ n("span", { className: O.secondary, children: t.header.referenceRange })
|
|
32
|
+
] }), u = c("OBSERVATIONS_RECORDED_BY", {
|
|
33
|
+
provider: t.provider
|
|
34
|
+
}), b = s.effectiveDateTime ? ie(s.effectiveDateTime, c, !0).formattedResult : void 0, T = /* @__PURE__ */ I("div", { className: O.wrapper, children: [
|
|
35
|
+
/* @__PURE__ */ n("span", { children: u }),
|
|
36
|
+
b && /* @__PURE__ */ n("span", { className: O.secondary, children: b })
|
|
37
|
+
] }), v = s.display, h = s.observationValue?.isAbnormal ? "abnormal-obs" : "obs", R = d ? `${d}-${h}-${v}-${o}-${l}` : `${h}-${v}-${o}-${l}`;
|
|
38
|
+
return /* @__PURE__ */ n(
|
|
39
|
+
oe,
|
|
40
|
+
{
|
|
41
|
+
header: m,
|
|
42
|
+
value: i,
|
|
43
|
+
info: T,
|
|
44
|
+
id: R,
|
|
45
|
+
testId: R,
|
|
46
|
+
ariaLabel: R
|
|
47
|
+
},
|
|
48
|
+
`obs-${s.id}`
|
|
49
|
+
);
|
|
50
|
+
}, ye = (s, l, o, d, c, r, t) => /* @__PURE__ */ n(
|
|
51
|
+
U,
|
|
52
|
+
{
|
|
53
|
+
title: s.display,
|
|
54
|
+
id: `grouped-obs-${s.display}-${d}`,
|
|
55
|
+
open: o,
|
|
56
|
+
children: s.members?.map(
|
|
57
|
+
(e, p) => V(
|
|
58
|
+
e,
|
|
59
|
+
p,
|
|
60
|
+
c,
|
|
61
|
+
r,
|
|
62
|
+
l,
|
|
63
|
+
t
|
|
64
|
+
)
|
|
65
|
+
)
|
|
66
|
+
},
|
|
67
|
+
`grouped-obs-${s.id}`
|
|
68
|
+
), Oe = ({
|
|
69
|
+
groupedData: s,
|
|
70
|
+
title: l = "",
|
|
71
|
+
hideThumbnail: o
|
|
72
|
+
}) => {
|
|
73
|
+
const { t: d } = B(), c = (r, t, e) => {
|
|
74
|
+
const p = se(r.encounterDetails, d);
|
|
75
|
+
return /* @__PURE__ */ I(
|
|
76
|
+
U,
|
|
77
|
+
{
|
|
78
|
+
title: p,
|
|
79
|
+
id: `encounter-${r.encounterId}`,
|
|
80
|
+
open: t,
|
|
81
|
+
children: [
|
|
82
|
+
r.observations.map(
|
|
83
|
+
(i, m) => V(
|
|
84
|
+
i,
|
|
85
|
+
m,
|
|
86
|
+
e,
|
|
87
|
+
l,
|
|
88
|
+
d,
|
|
89
|
+
o
|
|
90
|
+
)
|
|
91
|
+
),
|
|
92
|
+
r.groupedObservations.map(
|
|
93
|
+
(i, m) => ye(
|
|
94
|
+
i,
|
|
95
|
+
d,
|
|
96
|
+
t,
|
|
97
|
+
m,
|
|
98
|
+
e,
|
|
99
|
+
l,
|
|
100
|
+
o
|
|
101
|
+
)
|
|
102
|
+
)
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
`encounter-${r.encounterId}`
|
|
106
|
+
);
|
|
107
|
+
};
|
|
108
|
+
return /* @__PURE__ */ n(
|
|
109
|
+
"div",
|
|
110
|
+
{
|
|
111
|
+
id: "obs-by-encounter",
|
|
112
|
+
"data-testid": "obs-by-encounter-test-id",
|
|
113
|
+
"aria-label": "obs-by-encounter-aria-label",
|
|
114
|
+
children: s.map(
|
|
115
|
+
(r, t) => c(r, t === 0, t)
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
}, Re = (s) => ["conceptUuid", s], _e = (s, l, o, d) => [
|
|
120
|
+
"observations",
|
|
121
|
+
s,
|
|
122
|
+
...l,
|
|
123
|
+
o,
|
|
124
|
+
d
|
|
125
|
+
], Ie = ({
|
|
126
|
+
config: s,
|
|
127
|
+
episodeOfCareUuids: l,
|
|
128
|
+
encounterUuids: o
|
|
129
|
+
}) => {
|
|
130
|
+
const d = s, {
|
|
131
|
+
conceptNames: c = [],
|
|
132
|
+
conceptUuid: r = [],
|
|
133
|
+
hideThumbnail: t = !1,
|
|
134
|
+
scope: e = "all"
|
|
135
|
+
} = d, p = pe(/* @__PURE__ */ new Set()), i = M(), { addNotification: m } = z(), { t: u } = B(), b = ue({
|
|
136
|
+
queries: c.map((a) => ({
|
|
137
|
+
queryKey: Re(a),
|
|
138
|
+
queryFn: () => G(a),
|
|
139
|
+
enabled: !!a
|
|
140
|
+
}))
|
|
141
|
+
});
|
|
142
|
+
D(() => {
|
|
143
|
+
const a = b.some((x) => x.isError), y = p.current.size > 0;
|
|
144
|
+
a && !y ? (m({
|
|
145
|
+
title: u("ERROR_DEFAULT_TITLE"),
|
|
146
|
+
message: u("ERROR_FETCHING_OBSERVATIONS"),
|
|
147
|
+
type: "error"
|
|
148
|
+
}), p.current.add(0)) : !a && y && p.current.clear();
|
|
149
|
+
}, [b, m, u]);
|
|
150
|
+
const T = g(() => b.map((a) => a.data?.uuid).filter((a) => !!a), [b]), v = g(() => [.../* @__PURE__ */ new Set([...T, ...r])], [T, r]), h = g(() => c.length === 0 ? !0 : b.every((a) => !a.isLoading), [b, c.length]), R = e === "latest" || e === "latest-encounter", w = j(
|
|
151
|
+
l,
|
|
152
|
+
o
|
|
153
|
+
), {
|
|
154
|
+
data: _,
|
|
155
|
+
isLoading: F,
|
|
156
|
+
isError: S,
|
|
157
|
+
refetch: N
|
|
158
|
+
} = ce({
|
|
159
|
+
queryKey: _e(
|
|
160
|
+
i,
|
|
161
|
+
v,
|
|
162
|
+
o,
|
|
163
|
+
e
|
|
164
|
+
),
|
|
165
|
+
queryFn: () => R ? H(
|
|
166
|
+
i,
|
|
167
|
+
v,
|
|
168
|
+
o
|
|
169
|
+
) : Y(
|
|
170
|
+
i,
|
|
171
|
+
v,
|
|
172
|
+
o
|
|
173
|
+
),
|
|
174
|
+
enabled: !!i && v.length > 0 && h && !w
|
|
175
|
+
});
|
|
176
|
+
X(
|
|
177
|
+
(a) => {
|
|
178
|
+
a.patientUUID === i && a.updatedConcepts.size > 0 && [...a.updatedConcepts.keys()].some(
|
|
179
|
+
(y) => v.includes(y)
|
|
180
|
+
) && N();
|
|
181
|
+
},
|
|
182
|
+
[i, N]
|
|
183
|
+
), D(() => {
|
|
184
|
+
S && m({
|
|
185
|
+
title: u("ERROR_DEFAULT_TITLE"),
|
|
186
|
+
message: u("ERROR_FETCHING_OBSERVATIONS"),
|
|
187
|
+
type: "error"
|
|
188
|
+
});
|
|
189
|
+
}, [S]);
|
|
190
|
+
const $ = g(() => {
|
|
191
|
+
if (!_) return [];
|
|
192
|
+
let a = J(_);
|
|
193
|
+
e === "latest-encounter" && (a = P(a));
|
|
194
|
+
const y = W(a);
|
|
195
|
+
return Z(y);
|
|
196
|
+
}, [_, e]), C = [
|
|
197
|
+
{ key: "name", header: "name" },
|
|
198
|
+
{ key: "value", header: "value" },
|
|
199
|
+
{ key: "form", header: "form" }
|
|
200
|
+
], L = F || !h, A = S && h, K = (!_ || _.entry?.length === 0 || v.length === 0) && h, Q = A ? u("ERROR_FETCHING_OBSERVATIONS") : null, k = K ? u("NO_OBSERVATIONS_FOUND") : void 0, q = $.length > 0 && !L && !A, E = d.titleTranslationKey, f = E ? u(E) : "";
|
|
201
|
+
return /* @__PURE__ */ I(
|
|
202
|
+
"div",
|
|
203
|
+
{
|
|
204
|
+
id: "observations",
|
|
205
|
+
"data-testid": E ? `observations-${f}` : "observations",
|
|
206
|
+
"aria-label": "observations-aria-label",
|
|
207
|
+
className: O.observations,
|
|
208
|
+
children: [
|
|
209
|
+
/* @__PURE__ */ n(
|
|
210
|
+
ee,
|
|
211
|
+
{
|
|
212
|
+
id: "observations-title",
|
|
213
|
+
testId: E ? `observations-title-${f}` : "observations-title",
|
|
214
|
+
title: f,
|
|
215
|
+
className: O.title,
|
|
216
|
+
children: /* @__PURE__ */ n("p", { children: f })
|
|
217
|
+
}
|
|
218
|
+
),
|
|
219
|
+
q ? /* @__PURE__ */ n(
|
|
220
|
+
Oe,
|
|
221
|
+
{
|
|
222
|
+
groupedData: $,
|
|
223
|
+
title: f,
|
|
224
|
+
hideThumbnail: t
|
|
225
|
+
}
|
|
226
|
+
) : /* @__PURE__ */ n(
|
|
227
|
+
ae,
|
|
228
|
+
{
|
|
229
|
+
headers: C,
|
|
230
|
+
rows: [],
|
|
231
|
+
ariaLabel: u("OBSERVATIONS"),
|
|
232
|
+
loading: L,
|
|
233
|
+
errorStateMessage: Q,
|
|
234
|
+
emptyStateMessage: k ?? u("NO_OBSERVATIONS_AVAILABLE"),
|
|
235
|
+
dataTestId: "observations-table"
|
|
236
|
+
}
|
|
237
|
+
)
|
|
238
|
+
]
|
|
239
|
+
}
|
|
240
|
+
);
|
|
241
|
+
};
|
|
242
|
+
export {
|
|
243
|
+
Re as conceptUuidQueryKeys,
|
|
244
|
+
Ie as default,
|
|
245
|
+
_e as observationsQueryKeys
|
|
246
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { as as we, at as z, au as xt, av as B, aq as q, ar as y, aw as Ro, ax as ye, ay as R, az as _, aA as k, aB as N, aC as A, aD as bs, aE as ir, aF as $e, aG as U, aH as Hn, aI as Vn, aJ as dt, aK as D, aL as xs, aM as cn, aN as Be, aO as ws, aP as qt, aQ as zt, aR as $s, aS as Cs, aT as $n, aU as Ss, aV as Nr, aW as Bt, aX as zo, aY as ks, aZ as Es, a_ as j, a$ as Ur, b0 as Ms, b1 as Ds, b2 as sr, b3 as As, b4 as Ts, b5 as zn, b6 as Fs, b7 as Is, b8 as Z, b9 as Ps, ba as Ls } from "./index-DqgfD6Rf.js";
|
|
2
2
|
var Os = (e) => e != null, qs = (e) => e.filter(Os);
|
|
3
3
|
function _s(e) {
|
|
4
4
|
return (...t) => {
|