@bahmni/widgets 0.0.1-dev.466 → 0.0.1-dev.469
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-CEht6QNt.js → DocumentsTable-CPng66yD.js} +47 -47
- package/dist/{FormsTable-CMW9OS_w.js → FormsTable-CHLYmk5-.js} +65 -65
- package/dist/{Observations-CAulJ6G6.js → Observations-CKJBO_rQ.js} +38 -38
- package/dist/charts/constants.d.ts +21 -0
- package/dist/charts/constants.d.ts.map +1 -0
- package/dist/charts/index.d.ts +6 -0
- package/dist/charts/index.d.ts.map +1 -0
- package/dist/charts/mappers/index.d.ts +27 -0
- package/dist/charts/mappers/index.d.ts.map +1 -0
- package/dist/charts/model.d.ts +56 -0
- package/dist/charts/model.d.ts.map +1 -0
- package/dist/charts/utils.d.ts +16 -0
- package/dist/charts/utils.d.ts.map +1 -0
- package/dist/index-CcA9PbrN.js +10334 -0
- package/dist/{index-Bq3AX0i2.js → index-CmbXgAAP.js} +51607 -36563
- package/dist/index.css +1 -1
- package/dist/index.js +14 -14
- package/dist/registry/widgetMap.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { jsx as a, jsxs as h, Fragment as pe } from "react/jsx-runtime";
|
|
2
|
-
import { u as _e, a as Ae, b as
|
|
2
|
+
import { u as _e, a as Ae, b as ge, o as Ee, m as fe, s as Ce, c as Ie, d as y, p as De, e as Ne, f as Le, g as be, S as Se, h as Q, i as ye, w as ve, A as Oe, F as we, j as Me, k as J, B as ee } from "./index-CmbXgAAP.js";
|
|
3
3
|
import { useQuery as Ue } from "@tanstack/react-query";
|
|
4
4
|
import { useState as T, useRef as Re, useEffect as _, useMemo as A, useCallback as p } from "react";
|
|
5
5
|
import { useTranslation as ke } from "react-i18next";
|
|
6
|
-
const
|
|
7
|
-
documentsTableBody:
|
|
8
|
-
viewAttachmentsLink:
|
|
6
|
+
const Be = "DocumentsTable-module_documentsTableBody__6iR3w", Pe = "DocumentsTable-module_viewAttachmentsLink__aQ1on", He = "DocumentsTable-module_documentViewerContainer__F5m8D", $e = "DocumentsTable-module_printContainer__rtarJ", Fe = "DocumentsTable-module_attachmentItem__17KA7", ze = "DocumentsTable-module_attachmentCounter__WFiI3", Ve = "DocumentsTable-module_attachmentError__RI4U2", We = "DocumentsTable-module_documentIframe__ptq5I", Ge = "DocumentsTable-module_attachmentContent__IaCEe", qe = "DocumentsTable-module_attachmentLoading__FAR6p", je = "DocumentsTable-module_hiddenWhileLoading__IxocW", Ke = "DocumentsTable-module_documentImage__KQVgS", Ye = "DocumentsTable-module_header__345GY", Qe = "DocumentsTable-module_documentTypeCell__uWGM8", Je = "DocumentsTable-module_printAllButton__IVYUW", Xe = "DocumentsTable-module_attachmentHeader__yI2xn", s = {
|
|
7
|
+
documentsTableBody: Be,
|
|
8
|
+
viewAttachmentsLink: Pe,
|
|
9
9
|
documentViewerContainer: He,
|
|
10
10
|
printContainer: $e,
|
|
11
|
-
attachmentItem:
|
|
12
|
-
attachmentCounter:
|
|
13
|
-
attachmentError:
|
|
14
|
-
documentIframe:
|
|
11
|
+
attachmentItem: Fe,
|
|
12
|
+
attachmentCounter: ze,
|
|
13
|
+
attachmentError: Ve,
|
|
14
|
+
documentIframe: We,
|
|
15
15
|
attachmentContent: Ge,
|
|
16
16
|
attachmentLoading: qe,
|
|
17
17
|
hiddenWhileLoading: je,
|
|
@@ -34,73 +34,73 @@ const Pe = "DocumentsTable-module_documentsTableBody__6iR3w", Be = "DocumentsTab
|
|
|
34
34
|
"attachments",
|
|
35
35
|
"uploadedOn",
|
|
36
36
|
"uploadedBy"
|
|
37
|
-
], nt = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, x = (l) => l.attachments.length > 0 ? l.attachments : l.documentUrl ? [{ url: l.documentUrl, contentType: l.contentType }] : [], lt = ({ config: l, encounterUuids:
|
|
37
|
+
], nt = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, x = (l) => l.attachments.length > 0 ? l.attachments : l.documentUrl ? [{ url: l.documentUrl, contentType: l.contentType }] : [], lt = ({ config: l, encounterUuids: P }) => {
|
|
38
38
|
const [m, H] = T(!1), [r, $] = T(
|
|
39
39
|
null
|
|
40
40
|
), [N, v] = T(
|
|
41
41
|
/* @__PURE__ */ new Set()
|
|
42
42
|
), [L, O] = T(
|
|
43
43
|
/* @__PURE__ */ new Set()
|
|
44
|
-
), C = Re(null), [w,
|
|
44
|
+
), C = Re(null), [w, F] = T(
|
|
45
45
|
null
|
|
46
|
-
),
|
|
46
|
+
), z = w !== null;
|
|
47
47
|
_(() => () => C.current?.abort(), []);
|
|
48
|
-
const
|
|
48
|
+
const g = _e(), { t: o } = ke(), { addNotification: b } = Ae(), E = A(
|
|
49
49
|
() => l?.actions?.find(
|
|
50
50
|
(e) => e.type === Ze
|
|
51
51
|
),
|
|
52
52
|
[l?.actions]
|
|
53
|
-
), te =
|
|
53
|
+
), te = ge(E?.requiredPrivilege), ne = !!E && te, ae = Number(l?.pageSize) || 5, [M, U] = T(1), [I, oe] = T(ae), [se, R] = T(void 0), V = p((e) => {
|
|
54
54
|
$(e), H(!0);
|
|
55
55
|
}, []), re = p(() => {
|
|
56
56
|
C.current?.abort(), O(/* @__PURE__ */ new Set()), H(!1), $(null), v(/* @__PURE__ */ new Set());
|
|
57
|
-
}, []),
|
|
57
|
+
}, []), W = p((e) => {
|
|
58
58
|
O((t) => new Set(t).add(e));
|
|
59
59
|
}, []), G = p((e) => {
|
|
60
60
|
v((t) => new Set(t).add(e));
|
|
61
61
|
}, []), ce = p(() => {
|
|
62
|
-
|
|
63
|
-
context: { encounterType:
|
|
62
|
+
E && Ee({
|
|
63
|
+
context: { encounterType: E.encounterType },
|
|
64
64
|
action: { type: "create", resourceType: "DocumentReference" }
|
|
65
65
|
});
|
|
66
|
-
}, [
|
|
66
|
+
}, [E]), { data: D, isLoading: le, isError: k, error: B, refetch: q } = Ue({
|
|
67
67
|
queryKey: [
|
|
68
68
|
"documents",
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
g,
|
|
70
|
+
P,
|
|
71
71
|
M,
|
|
72
72
|
I
|
|
73
73
|
],
|
|
74
|
-
enabled: !!
|
|
74
|
+
enabled: !!g,
|
|
75
75
|
queryFn: () => fe(
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
g,
|
|
77
|
+
P,
|
|
78
78
|
I,
|
|
79
79
|
M
|
|
80
80
|
)
|
|
81
81
|
});
|
|
82
82
|
Ce(
|
|
83
83
|
(e) => {
|
|
84
|
-
e.patientUUID ===
|
|
84
|
+
e.patientUUID === g && e.updatedResources.documents && q();
|
|
85
85
|
},
|
|
86
|
-
[
|
|
86
|
+
[g, q]
|
|
87
87
|
), _(() => {
|
|
88
88
|
D && R(D.total);
|
|
89
89
|
}, [D]), _(() => {
|
|
90
90
|
U(1), R(void 0);
|
|
91
|
-
}, [
|
|
91
|
+
}, [g]), _(() => {
|
|
92
92
|
k && b({
|
|
93
93
|
title: o("ERROR_DEFAULT_TITLE"),
|
|
94
|
-
message:
|
|
94
|
+
message: B?.message ?? "",
|
|
95
95
|
type: "error"
|
|
96
96
|
});
|
|
97
|
-
}, [k,
|
|
97
|
+
}, [k, B, b, o]), _(() => {
|
|
98
98
|
const e = new AbortController();
|
|
99
99
|
return (async () => {
|
|
100
100
|
if (!m || !r) return;
|
|
101
101
|
const n = /* @__PURE__ */ new Set(), i = x(r);
|
|
102
102
|
for (let c = 0; c < i.length; c++) {
|
|
103
|
-
const f =
|
|
103
|
+
const f = y(i[c].url);
|
|
104
104
|
try {
|
|
105
105
|
(await fetch(f, {
|
|
106
106
|
method: "HEAD",
|
|
@@ -138,20 +138,20 @@ const Pe = "DocumentsTable-module_documentsTableBody__6iR3w", Be = "DocumentsTab
|
|
|
138
138
|
t !== I ? (oe(t), U(1), R(void 0)) : U(e);
|
|
139
139
|
},
|
|
140
140
|
[I]
|
|
141
|
-
),
|
|
141
|
+
), S = A(
|
|
142
142
|
() => l?.fields ?? tt,
|
|
143
143
|
[l?.fields]
|
|
144
|
-
), ie = A(() => [...D?.documents ?? []].sort((t, n) => !t.uploadedOn && !n.uploadedOn ? 0 : t.uploadedOn ? n.uploadedOn ? new Date(n.uploadedOn).getTime() - new Date(t.uploadedOn).getTime() : -1 : 1), [D]), me = A(() => Ie(
|
|
145
|
-
() =>
|
|
144
|
+
), ie = A(() => [...D?.documents ?? []].sort((t, n) => !t.uploadedOn && !n.uploadedOn ? 0 : t.uploadedOn ? n.uploadedOn ? new Date(n.uploadedOn).getTime() - new Date(t.uploadedOn).getTime() : -1 : 1), [D]), me = A(() => Ie(S, o), [S, o]), ue = A(
|
|
145
|
+
() => S.map((e) => ({
|
|
146
146
|
key: e,
|
|
147
147
|
sortable: e !== "attachments"
|
|
148
148
|
})),
|
|
149
|
-
[
|
|
149
|
+
[S]
|
|
150
150
|
), d = A(
|
|
151
151
|
() => r ? x(r) : [],
|
|
152
152
|
[r]
|
|
153
153
|
), j = d.every(
|
|
154
|
-
(e, t) => L.has(t) || N.has(t) ||
|
|
154
|
+
(e, t) => L.has(t) || N.has(t) || y(e.url) === "#"
|
|
155
155
|
);
|
|
156
156
|
_(() => {
|
|
157
157
|
if (!m || d.length === 0) return;
|
|
@@ -165,7 +165,7 @@ const Pe = "DocumentsTable-module_documentsTableBody__6iR3w", Be = "DocumentsTab
|
|
|
165
165
|
async (e, t) => {
|
|
166
166
|
if (!r || C.current) return;
|
|
167
167
|
const n = new AbortController(), { signal: i } = n;
|
|
168
|
-
C.current = n,
|
|
168
|
+
C.current = n, F(t);
|
|
169
169
|
const c = document.getElementById(X);
|
|
170
170
|
try {
|
|
171
171
|
await De(
|
|
@@ -180,13 +180,13 @@ const Pe = "DocumentsTable-module_documentsTableBody__6iR3w", Be = "DocumentsTab
|
|
|
180
180
|
type: "error"
|
|
181
181
|
});
|
|
182
182
|
} finally {
|
|
183
|
-
C.current = null,
|
|
183
|
+
C.current = null, F(null);
|
|
184
184
|
}
|
|
185
185
|
},
|
|
186
186
|
[r, b, o]
|
|
187
187
|
), Y = A(
|
|
188
188
|
() => d.filter(
|
|
189
|
-
(e, t) =>
|
|
189
|
+
(e, t) => y(e.url) !== "#" && !N.has(t)
|
|
190
190
|
),
|
|
191
191
|
[d, N]
|
|
192
192
|
), he = p(
|
|
@@ -219,7 +219,7 @@ const Pe = "DocumentsTable-module_documentsTableBody__6iR3w", Be = "DocumentsTab
|
|
|
219
219
|
return e.attachments.length > 0 || !!e.documentUrl ? /* @__PURE__ */ a(
|
|
220
220
|
Ne,
|
|
221
221
|
{
|
|
222
|
-
onClick: () =>
|
|
222
|
+
onClick: () => V(e),
|
|
223
223
|
className: s.viewAttachmentsLink,
|
|
224
224
|
"data-testid": `view-attachments-${e.id}`,
|
|
225
225
|
children: o("DOCUMENTS_VIEW_ATTACHMENTS")
|
|
@@ -229,10 +229,10 @@ const Pe = "DocumentsTable-module_documentsTableBody__6iR3w", Be = "DocumentsTab
|
|
|
229
229
|
return null;
|
|
230
230
|
}
|
|
231
231
|
},
|
|
232
|
-
[
|
|
232
|
+
[V, o]
|
|
233
233
|
);
|
|
234
234
|
return /* @__PURE__ */ h(pe, { children: [
|
|
235
|
-
ne && /* @__PURE__ */ h(
|
|
235
|
+
ne && /* @__PURE__ */ h(Se, { className: s.header, testId: "documents-header", children: [
|
|
236
236
|
/* @__PURE__ */ a("p", { children: o("DOCUMENTS_TABLE_HEADING") }),
|
|
237
237
|
/* @__PURE__ */ a(
|
|
238
238
|
Q,
|
|
@@ -240,10 +240,10 @@ const Pe = "DocumentsTable-module_documentsTableBody__6iR3w", Be = "DocumentsTab
|
|
|
240
240
|
autoAlign: !0,
|
|
241
241
|
size: "lg",
|
|
242
242
|
kind: "ghost",
|
|
243
|
-
label: o(
|
|
243
|
+
label: o(E.label),
|
|
244
244
|
testId: "documents-add-button",
|
|
245
245
|
onClick: ce,
|
|
246
|
-
children: /* @__PURE__ */ a(
|
|
246
|
+
children: /* @__PURE__ */ a(ye, { id: "documents-add-icon", name: "fa-plus", size: ve.LG })
|
|
247
247
|
}
|
|
248
248
|
)
|
|
249
249
|
] }),
|
|
@@ -254,7 +254,7 @@ const Pe = "DocumentsTable-module_documentsTableBody__6iR3w", Be = "DocumentsTab
|
|
|
254
254
|
ariaLabel: o("DOCUMENTS_TABLE_HEADING"),
|
|
255
255
|
rows: ie,
|
|
256
256
|
loading: le,
|
|
257
|
-
errorStateMessage: k ?
|
|
257
|
+
errorStateMessage: k ? B?.message : null,
|
|
258
258
|
sortable: ue,
|
|
259
259
|
emptyStateMessage: o("DOCUMENTS_NO_RECORDS"),
|
|
260
260
|
renderCell: he,
|
|
@@ -285,14 +285,14 @@ const Pe = "DocumentsTable-module_documentsTableBody__6iR3w", Be = "DocumentsTab
|
|
|
285
285
|
size: "sm",
|
|
286
286
|
className: s.printAllButton,
|
|
287
287
|
renderIcon: w === "all" ? Z : J,
|
|
288
|
-
disabled:
|
|
288
|
+
disabled: z || !j,
|
|
289
289
|
testId: "print-all-attachments",
|
|
290
290
|
onClick: () => K(Y, "all"),
|
|
291
291
|
children: o("DOCUMENTS_PRINT_ALL")
|
|
292
292
|
}
|
|
293
293
|
),
|
|
294
294
|
d.map((e, t) => {
|
|
295
|
-
const n =
|
|
295
|
+
const n = y(e.url), i = e.contentType?.toLowerCase().includes("pdf"), c = (e.contentType?.toLowerCase().includes("image") ?? !1) || nt.test(e.url ?? ""), f = N.has(t);
|
|
296
296
|
return n === "#" || f ? /* @__PURE__ */ h(
|
|
297
297
|
"div",
|
|
298
298
|
{
|
|
@@ -326,7 +326,7 @@ const Pe = "DocumentsTable-module_documentsTableBody__6iR3w", Be = "DocumentsTab
|
|
|
326
326
|
label: o("DOCUMENTS_PRINT_ATTACHMENT", {
|
|
327
327
|
index: t + 1
|
|
328
328
|
}),
|
|
329
|
-
disabled:
|
|
329
|
+
disabled: z || !j,
|
|
330
330
|
testId: `print-attachment-${t}`,
|
|
331
331
|
onClick: () => K([e], t),
|
|
332
332
|
children: w === t ? /* @__PURE__ */ a(Z, {}) : /* @__PURE__ */ a(J, {})
|
|
@@ -353,7 +353,7 @@ const Pe = "DocumentsTable-module_documentsTableBody__6iR3w", Be = "DocumentsTab
|
|
|
353
353
|
src: n,
|
|
354
354
|
alt: r.documentIdentifier,
|
|
355
355
|
className: `${s.documentImage} ${L.has(t) ? "" : s.hiddenWhileLoading}`,
|
|
356
|
-
onLoad: () =>
|
|
356
|
+
onLoad: () => W(t),
|
|
357
357
|
onError: () => G(t)
|
|
358
358
|
}
|
|
359
359
|
) : /* @__PURE__ */ a(
|
|
@@ -362,7 +362,7 @@ const Pe = "DocumentsTable-module_documentsTableBody__6iR3w", Be = "DocumentsTab
|
|
|
362
362
|
src: i ? `${n}#toolbar=0` : n,
|
|
363
363
|
className: `${s.documentIframe} ${L.has(t) ? "" : s.hiddenWhileLoading}`,
|
|
364
364
|
title: r.documentIdentifier,
|
|
365
|
-
onLoad: () =>
|
|
365
|
+
onLoad: () => W(t),
|
|
366
366
|
onError: () => G(t)
|
|
367
367
|
}
|
|
368
368
|
)
|
|
@@ -1,70 +1,70 @@
|
|
|
1
1
|
import { jsx as n, jsxs as q, Fragment as ie } from "react/jsx-runtime";
|
|
2
|
-
import { u as de, b as le, l as me, U as ce,
|
|
3
|
-
import { useQueryClient as Re, useQuery as
|
|
2
|
+
import { u as de, b as le, l as me, U as ce, V as ue, n as fe, E as ye, s as be, q as he, r as pe, Q as ge, f as Ne, o as Oe, h as V, G as x, e as Fe, A as G, t as Ie, v as Te, F as Ee, O as Ae, C as ve } from "./index-CmbXgAAP.js";
|
|
3
|
+
import { useQueryClient as Re, useQuery as E } from "@tanstack/react-query";
|
|
4
4
|
import { useState as $, useMemo as i, useCallback as d } from "react";
|
|
5
|
-
import { useTranslation as
|
|
6
|
-
const
|
|
7
|
-
formsTableBody:
|
|
5
|
+
import { useTranslation as De } from "react-i18next";
|
|
6
|
+
const _e = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_modalHeading__wnTmA", Be = "FormsTable-module_customAccordianItem__isszs", p = {
|
|
7
|
+
formsTableBody: _e,
|
|
8
8
|
modalHeading: Le,
|
|
9
|
-
customAccordianItem:
|
|
9
|
+
customAccordianItem: Be
|
|
10
10
|
}, He = ({
|
|
11
|
-
episodeOfCareUuids:
|
|
11
|
+
episodeOfCareUuids: A,
|
|
12
12
|
encounterUuids: m,
|
|
13
|
-
config:
|
|
14
|
-
disableActions:
|
|
13
|
+
config: Q,
|
|
14
|
+
disableActions: j = !1,
|
|
15
15
|
activeEncounterUuid: y = null
|
|
16
16
|
}) => {
|
|
17
|
-
const { t: o } =
|
|
18
|
-
numberOfVisits:
|
|
17
|
+
const { t: o } = De(), c = de(), [g, v] = $(!1), [a, R] = $(null), {
|
|
18
|
+
numberOfVisits: z,
|
|
19
19
|
hideThumbnail: K = !1,
|
|
20
20
|
forms: b
|
|
21
|
-
} =
|
|
22
|
-
|
|
23
|
-
), { userPrivileges:
|
|
24
|
-
|
|
21
|
+
} = Q ?? {}, W = le(
|
|
22
|
+
ve.EDIT_OBSERVATIONS
|
|
23
|
+
), { userPrivileges: h } = me(), N = W && !j && !!y, D = ce(
|
|
24
|
+
A,
|
|
25
25
|
m
|
|
26
26
|
), Y = Re(), {
|
|
27
|
-
data:
|
|
27
|
+
data: _ = [],
|
|
28
28
|
isLoading: L,
|
|
29
|
-
isError:
|
|
29
|
+
isError: B,
|
|
30
30
|
error: J,
|
|
31
31
|
refetch: X
|
|
32
|
-
} =
|
|
33
|
-
queryKey: ["forms", c,
|
|
34
|
-
queryFn: () => ue(c, void 0,
|
|
35
|
-
enabled: !!c && !
|
|
36
|
-
}),
|
|
37
|
-
let e =
|
|
32
|
+
} = E({
|
|
33
|
+
queryKey: ["forms", c, A],
|
|
34
|
+
queryFn: () => ue(c, void 0, z),
|
|
35
|
+
enabled: !!c && !D
|
|
36
|
+
}), C = i(() => {
|
|
37
|
+
let e = _;
|
|
38
38
|
return m && m.length > 0 && (e = e.filter(
|
|
39
39
|
(s) => m.includes(s.encounterUuid)
|
|
40
40
|
)), Array.isArray(b) && b.length > 0 && (e = e.filter(
|
|
41
41
|
(s) => b.some((t) => t.toLowerCase() === s.formName.toLowerCase())
|
|
42
42
|
)), e;
|
|
43
|
-
}, [
|
|
43
|
+
}, [_, m, b]), { data: M = [] } = E({
|
|
44
44
|
queryKey: ["observationForms"],
|
|
45
45
|
queryFn: () => fe()
|
|
46
|
-
}),
|
|
46
|
+
}), S = d(
|
|
47
47
|
(e) => {
|
|
48
|
-
const s =
|
|
48
|
+
const s = M.find(
|
|
49
49
|
(r) => r.name.toLowerCase() === e.toLowerCase()
|
|
50
50
|
);
|
|
51
51
|
if (!s?.privileges || s.privileges.length === 0) return !0;
|
|
52
|
-
if (!
|
|
53
|
-
const t = new Set(
|
|
52
|
+
if (!h || h.length === 0) return !1;
|
|
53
|
+
const t = new Set(h.map((r) => r.name));
|
|
54
54
|
return s.privileges.some(
|
|
55
55
|
(r) => t.has(r.privilegeName) && r.editable
|
|
56
56
|
);
|
|
57
57
|
},
|
|
58
|
-
[
|
|
58
|
+
[M, h]
|
|
59
59
|
), u = d(
|
|
60
|
-
(e) => !y || e.encounterUuid !== y ? !1 :
|
|
61
|
-
[y,
|
|
60
|
+
(e) => !y || e.encounterUuid !== y ? !1 : S(e.formName),
|
|
61
|
+
[y, S]
|
|
62
62
|
), {
|
|
63
63
|
data: O,
|
|
64
64
|
isLoading: Z,
|
|
65
65
|
isError: ee,
|
|
66
|
-
error:
|
|
67
|
-
} =
|
|
66
|
+
error: F
|
|
67
|
+
} = E({
|
|
68
68
|
queryKey: ["formsEncounterFHIR", a?.encounterUuid],
|
|
69
69
|
queryFn: () => ye(a.encounterUuid),
|
|
70
70
|
enabled: !!a?.encounterUuid && g
|
|
@@ -75,10 +75,10 @@ const De = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
|
|
|
75
75
|
},
|
|
76
76
|
[c]
|
|
77
77
|
);
|
|
78
|
-
const re = i(() => !O?.entry || !a?.formName ? [] : O.entry.filter((s) => s.resource?.resourceType === "Observation").map((s) => s.resource).filter((s) =>
|
|
79
|
-
if (
|
|
80
|
-
return ge(
|
|
81
|
-
}, [
|
|
78
|
+
const re = i(() => !O?.entry || !a?.formName ? [] : O.entry.filter((s) => s.resource?.resourceType === "Observation").map((s) => s.resource).filter((s) => he(s) ? pe(s)?.toLowerCase() === a.formName.toLowerCase() : !0), [O, a?.formName]), se = i(() => {
|
|
79
|
+
if (F)
|
|
80
|
+
return ge(F).message;
|
|
81
|
+
}, [F]), f = i(
|
|
82
82
|
() => [
|
|
83
83
|
{ key: "recordedOn", header: o("RECORDED_ON") },
|
|
84
84
|
{ key: "recordedBy", header: o("RECORDED_BY") }
|
|
@@ -97,16 +97,16 @@ const De = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
|
|
|
97
97
|
],
|
|
98
98
|
[]
|
|
99
99
|
), U = i(() => {
|
|
100
|
-
const e =
|
|
100
|
+
const e = C.reduce(
|
|
101
101
|
(t, r) => {
|
|
102
102
|
const l = r.formName;
|
|
103
103
|
t[l] ??= [];
|
|
104
|
-
const
|
|
104
|
+
const T = r.providers.map((ne) => ne.providerName).filter(Boolean).join(", ");
|
|
105
105
|
return t[l].push({
|
|
106
106
|
id: r.encounterUuid,
|
|
107
107
|
formName: r.formName,
|
|
108
108
|
recordedOn: Ne(r.encounterDateTime, o, !0).formattedResult,
|
|
109
|
-
recordedBy:
|
|
109
|
+
recordedBy: T ?? "--",
|
|
110
110
|
encounterDateTime: r.encounterDateTime,
|
|
111
111
|
encounterUuid: r.encounterUuid
|
|
112
112
|
}), t;
|
|
@@ -117,15 +117,15 @@ const De = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
|
|
|
117
117
|
([t, r]) => ({
|
|
118
118
|
formName: t,
|
|
119
119
|
records: r.sort(
|
|
120
|
-
(l,
|
|
120
|
+
(l, T) => T.encounterDateTime - l.encounterDateTime
|
|
121
121
|
)
|
|
122
122
|
})
|
|
123
123
|
).sort((t, r) => t.formName.localeCompare(r.formName));
|
|
124
|
-
}, [
|
|
125
|
-
R(e),
|
|
124
|
+
}, [C, o]), H = d((e) => {
|
|
125
|
+
R(e), v(!0);
|
|
126
126
|
}, []), k = d(() => {
|
|
127
|
-
|
|
128
|
-
}, []),
|
|
127
|
+
v(!1), R(null);
|
|
128
|
+
}, []), I = d((e) => {
|
|
129
129
|
Oe({
|
|
130
130
|
context: {
|
|
131
131
|
encounter: { resourceType: "Encounter", id: e.encounterUuid },
|
|
@@ -138,52 +138,52 @@ const De = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
|
|
|
138
138
|
(e, s) => {
|
|
139
139
|
switch (s) {
|
|
140
140
|
case "recordedOn":
|
|
141
|
-
return /* @__PURE__ */ n(
|
|
141
|
+
return /* @__PURE__ */ n(Fe, { onClick: () => H(e), children: e.recordedOn });
|
|
142
142
|
case "recordedBy":
|
|
143
143
|
return e.recordedBy;
|
|
144
144
|
case "actions":
|
|
145
145
|
return u(e) ? /* @__PURE__ */ n(
|
|
146
|
-
|
|
146
|
+
V,
|
|
147
147
|
{
|
|
148
148
|
label: o("EDIT_OBSERVATION_FORM"),
|
|
149
149
|
kind: "ghost",
|
|
150
150
|
size: "sm",
|
|
151
151
|
testId: `edit-form-${e.encounterUuid}`,
|
|
152
|
-
onClick: () =>
|
|
153
|
-
children: /* @__PURE__ */ n(
|
|
152
|
+
onClick: () => I(e),
|
|
153
|
+
children: /* @__PURE__ */ n(x, {})
|
|
154
154
|
}
|
|
155
155
|
) : null;
|
|
156
156
|
default:
|
|
157
157
|
return null;
|
|
158
158
|
}
|
|
159
159
|
},
|
|
160
|
-
[H,
|
|
160
|
+
[H, I, u, o]
|
|
161
161
|
);
|
|
162
162
|
return /* @__PURE__ */ q(ie, { children: [
|
|
163
|
-
/* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: L ||
|
|
164
|
-
|
|
163
|
+
/* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: L || B || U.length === 0 || D ? /* @__PURE__ */ n(
|
|
164
|
+
G,
|
|
165
165
|
{
|
|
166
166
|
headers: oe,
|
|
167
167
|
ariaLabel: o("FORMS_HEADING"),
|
|
168
168
|
rows: [],
|
|
169
169
|
loading: L,
|
|
170
|
-
errorStateMessage:
|
|
170
|
+
errorStateMessage: B ? J?.message : void 0,
|
|
171
171
|
emptyStateMessage: o("FORMS_UNAVAILABLE"),
|
|
172
172
|
renderCell: P,
|
|
173
|
-
className:
|
|
173
|
+
className: p.formsTableBody,
|
|
174
174
|
dataTestId: "forms-table"
|
|
175
175
|
}
|
|
176
|
-
) : /* @__PURE__ */ n(
|
|
176
|
+
) : /* @__PURE__ */ n(Ie, { align: "start", children: U.map((e, s) => {
|
|
177
177
|
const { formName: t, records: r } = e, l = te(r);
|
|
178
178
|
return /* @__PURE__ */ n(
|
|
179
|
-
|
|
179
|
+
Te,
|
|
180
180
|
{
|
|
181
181
|
title: t,
|
|
182
|
-
className:
|
|
182
|
+
className: p.customAccordianItem,
|
|
183
183
|
testId: `accordian-title-${t}`,
|
|
184
184
|
open: s === 0,
|
|
185
185
|
children: /* @__PURE__ */ n(
|
|
186
|
-
|
|
186
|
+
G,
|
|
187
187
|
{
|
|
188
188
|
headers: l,
|
|
189
189
|
ariaLabel: o("FORMS_HEADING"),
|
|
@@ -193,7 +193,7 @@ const De = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
|
|
|
193
193
|
sortable: ae,
|
|
194
194
|
emptyStateMessage: o("FORMS_UNAVAILABLE"),
|
|
195
195
|
renderCell: P,
|
|
196
|
-
className:
|
|
196
|
+
className: p.formsTableBody,
|
|
197
197
|
dataTestId: `forms-table-${t}`
|
|
198
198
|
}
|
|
199
199
|
)
|
|
@@ -202,25 +202,25 @@ const De = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
|
|
|
202
202
|
);
|
|
203
203
|
}) }) }),
|
|
204
204
|
g && a && /* @__PURE__ */ n(
|
|
205
|
-
|
|
205
|
+
Ee,
|
|
206
206
|
{
|
|
207
207
|
id: "modalIdForActionAreaLayout",
|
|
208
208
|
portalId: "main-display-area",
|
|
209
209
|
open: g,
|
|
210
210
|
onRequestClose: k,
|
|
211
|
-
modalHeading: /* @__PURE__ */ q("div", { className:
|
|
211
|
+
modalHeading: /* @__PURE__ */ q("div", { className: p.modalHeading, children: [
|
|
212
212
|
/* @__PURE__ */ n("span", { children: a.formName }),
|
|
213
213
|
N && u(a) && /* @__PURE__ */ n(
|
|
214
|
-
|
|
214
|
+
V,
|
|
215
215
|
{
|
|
216
216
|
label: o("EDIT_OBSERVATION_FORM"),
|
|
217
217
|
kind: "ghost",
|
|
218
218
|
size: "sm",
|
|
219
219
|
testId: `edit-form-modal-${a.encounterUuid}`,
|
|
220
220
|
onClick: () => {
|
|
221
|
-
k(),
|
|
221
|
+
k(), I(a);
|
|
222
222
|
},
|
|
223
|
-
children: /* @__PURE__ */ n(
|
|
223
|
+
children: /* @__PURE__ */ n(x, {})
|
|
224
224
|
}
|
|
225
225
|
)
|
|
226
226
|
] }),
|
|
@@ -229,7 +229,7 @@ const De = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
|
|
|
229
229
|
size: "md",
|
|
230
230
|
testId: "form-details-modal",
|
|
231
231
|
children: /* @__PURE__ */ n(
|
|
232
|
-
|
|
232
|
+
Ae,
|
|
233
233
|
{
|
|
234
234
|
observations: re,
|
|
235
235
|
isLoading: Z,
|