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