@bahmni/registration-app 0.0.1-dev.107 → 0.0.1-dev.109

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.
@@ -0,0 +1,319 @@
1
+ import { jsx as o, jsxs as p, Fragment as z } from "react/jsx-runtime";
2
+ import { u as X, C as Y, F as W, r as Z, e as ee, t as re, Q as ae, a as oe, V as ne, b as G, _ as te, c as se, d as de, E as ie, f as I, X as me, N } from "./index-CYlbHpG4.js";
3
+ import { useQuery as f } from "@tanstack/react-query";
4
+ import { useState as U, useMemo as b, useCallback as g } from "react";
5
+ import { createPortal as le } from "react-dom";
6
+ const ce = "_formsTableBody_1pd36_1", ue = "_customAccordianItem_1pd36_6", pe = "_formContent_1pd36_18", _e = "_formDetailsContainer_1pd36_25", be = "_observation_1pd36_30", fe = "_groupContainer_1pd36_39", ge = "_rowContainer_1pd36_43", Ne = "_groupLabel_1pd36_48", he = "_rowLabel_1pd36_58", ye = "_rowValue_1pd36_67", ve = "_groupMembers_1pd36_75", Me = "_memberRow_1pd36_81", Ae = "_memberLabel_1pd36_86", Ce = "_memberValue_1pd36_94", Le = "_abnormalValue_1pd36_102", Oe = "_commentSection_1pd36_110", Re = "_commentText_1pd36_116", Fe = "_nestedGroup_1pd36_125", Te = "_nestedGroupLabel_1pd36_132", De = "_nestedGroupMembers_1pd36_141", r = {
7
+ formsTableBody: ce,
8
+ customAccordianItem: ue,
9
+ formContent: pe,
10
+ formDetailsContainer: _e,
11
+ observation: be,
12
+ groupContainer: fe,
13
+ rowContainer: ge,
14
+ groupLabel: Ne,
15
+ rowLabel: he,
16
+ rowValue: ye,
17
+ groupMembers: ve,
18
+ memberRow: Me,
19
+ memberLabel: Ae,
20
+ memberValue: Ce,
21
+ abnormalValue: Le,
22
+ commentSection: Oe,
23
+ commentText: Re,
24
+ nestedGroup: Fe,
25
+ nestedGroupLabel: Te,
26
+ nestedGroupMembers: De
27
+ }, Ee = "ABNORMAL", q = (e) => {
28
+ const i = e.concept?.units, m = e.concept?.lowNormal, a = e.concept?.hiNormal, l = m != null, c = a != null, u = l && c ? ` (${m} - ${a})` : l ? ` (>${m})` : c ? ` (<${a})` : "", t = e.interpretation && e.interpretation.toUpperCase() === Ee;
29
+ return { units: i, rangeString: u, isAbnormal: t };
30
+ }, x = ({
31
+ member: e,
32
+ depth: i = 0
33
+ }) => {
34
+ const m = e.groupMembers && e.groupMembers.length > 0, a = e.conceptNameToDisplay ?? e.concept?.shortName ?? e.concept?.name;
35
+ if (m)
36
+ return /* @__PURE__ */ p("div", { className: r.nestedGroup, children: [
37
+ /* @__PURE__ */ o(
38
+ "div",
39
+ {
40
+ className: r.nestedGroupLabel,
41
+ style: { paddingLeft: `${i * 16}px` },
42
+ children: a
43
+ }
44
+ ),
45
+ /* @__PURE__ */ o("div", { className: r.nestedGroupMembers, children: e.groupMembers?.map((t) => /* @__PURE__ */ o(
46
+ x,
47
+ {
48
+ member: t,
49
+ depth: i + 1
50
+ },
51
+ `${t.concept.uuid}`
52
+ )) })
53
+ ] });
54
+ const { units: l, rangeString: c, isAbnormal: u } = q(e);
55
+ return /* @__PURE__ */ p(
56
+ "div",
57
+ {
58
+ className: r.memberRow,
59
+ style: { paddingLeft: `${i * 16}px` },
60
+ children: [
61
+ /* @__PURE__ */ p(
62
+ "p",
63
+ {
64
+ className: N(
65
+ r.memberLabel,
66
+ u ? r.abnormalValue : ""
67
+ ),
68
+ children: [
69
+ a,
70
+ c
71
+ ]
72
+ }
73
+ ),
74
+ /* @__PURE__ */ p(
75
+ "p",
76
+ {
77
+ className: N(
78
+ r.memberValue,
79
+ u ? r.abnormalValue : ""
80
+ ),
81
+ children: [
82
+ e.valueAsString,
83
+ l && ` ${l}`
84
+ ]
85
+ }
86
+ )
87
+ ]
88
+ }
89
+ );
90
+ }, we = ({
91
+ observation: e,
92
+ index: i
93
+ }) => {
94
+ const m = e.groupMembers && e.groupMembers.length > 0, { units: a, rangeString: l, isAbnormal: c } = q(e);
95
+ return /* @__PURE__ */ p(
96
+ "div",
97
+ {
98
+ className: r.observation,
99
+ children: [
100
+ /* @__PURE__ */ p(
101
+ "div",
102
+ {
103
+ className: m ? r.groupContainer : r.rowContainer,
104
+ children: [
105
+ /* @__PURE__ */ p(
106
+ "p",
107
+ {
108
+ className: N(
109
+ m ? r.groupLabel : r.rowLabel,
110
+ !m && c ? r.abnormalValue : ""
111
+ ),
112
+ children: [
113
+ e.conceptNameToDisplay,
114
+ !m && l && /* @__PURE__ */ o("span", { className: r.rangeInfo, children: l })
115
+ ]
116
+ }
117
+ ),
118
+ m ? /* @__PURE__ */ o("div", { className: r.groupMembers, children: e.groupMembers?.map((u) => /* @__PURE__ */ o(
119
+ x,
120
+ {
121
+ member: u,
122
+ depth: 0
123
+ },
124
+ `${u.concept.uuid}`
125
+ )) }) : /* @__PURE__ */ p(
126
+ "p",
127
+ {
128
+ className: N(
129
+ r.rowValue,
130
+ c ? r.abnormalValue : ""
131
+ ),
132
+ children: [
133
+ e.valueAsString,
134
+ a && ` ${a}`
135
+ ]
136
+ }
137
+ )
138
+ ]
139
+ }
140
+ ),
141
+ e.comment && /* @__PURE__ */ o("div", { className: r.commentSection, children: /* @__PURE__ */ p("span", { className: r.commentText, children: [
142
+ e.comment,
143
+ e.providers?.[0]?.name && ` - by ${e.providers[0].name}`
144
+ ] }) })
145
+ ]
146
+ },
147
+ `${e.concept.uuid}-${i}`
148
+ );
149
+ }, Ue = ({
150
+ episodeOfCareUuids: e,
151
+ encounterUuids: i,
152
+ config: m
153
+ }) => {
154
+ const { t: a } = X(), l = Y(), [c, u] = U(!1), [t, A] = U(null), k = m?.numberOfVisits, C = W(
155
+ e,
156
+ i
157
+ ), {
158
+ data: h = [],
159
+ isLoading: L,
160
+ isError: O,
161
+ error: H
162
+ } = f({
163
+ queryKey: ["forms", l, e],
164
+ queryFn: () => Z(l, void 0, k),
165
+ enabled: !!l && !C
166
+ }), R = b(() => !i || i.length === 0 ? h : h.filter(
167
+ (n) => i.includes(n.encounterUuid)
168
+ ), [h, i]), { data: F = [] } = f({
169
+ queryKey: ["observationForms"],
170
+ queryFn: ee
171
+ }), T = g(
172
+ (n) => F.find((s) => s.name === n)?.uuid,
173
+ [F]
174
+ ), y = b(() => {
175
+ if (t)
176
+ return T(t.formName);
177
+ }, [t, T]), {
178
+ data: Be,
179
+ isLoading: j,
180
+ error: D
181
+ } = f({
182
+ queryKey: ["formMetadata", y],
183
+ queryFn: () => re(y),
184
+ enabled: !!y && c
185
+ }), {
186
+ data: v,
187
+ isLoading: K,
188
+ error: E
189
+ } = f({
190
+ queryKey: ["formsEncounter", t?.encounterUuid],
191
+ queryFn: () => ae(t.encounterUuid, !0),
192
+ enabled: !!t?.encounterUuid && c
193
+ }), w = b(() => !v?.observations || !t?.formName ? [] : v.observations.filter(
194
+ (n) => "formFieldPath" in n && typeof n.formFieldPath == "string" && n.formFieldPath.includes(t.formName)
195
+ ), [v?.observations, t?.formName]), B = b(
196
+ () => [
197
+ { key: "recordedOn", header: a("FORM_RECORDED_ON") },
198
+ { key: "recordedBy", header: a("FORM_RECORDED_BY") }
199
+ ],
200
+ [a]
201
+ ), P = b(
202
+ () => [
203
+ { key: "recordedOn", sortable: !0 },
204
+ { key: "recordedBy", sortable: !0 }
205
+ ],
206
+ []
207
+ ), V = b(() => {
208
+ const n = R.reduce(
209
+ (s, d) => {
210
+ const _ = d.formName;
211
+ s[_] ??= [];
212
+ const M = d.providers.map((J) => J.providerName).filter(Boolean).join(", ");
213
+ return s[_].push({
214
+ id: d.encounterUuid,
215
+ formName: d.formName,
216
+ recordedOn: oe(d.encounterDateTime, a, me).formattedResult,
217
+ recordedBy: M ?? "--",
218
+ encounterDateTime: d.encounterDateTime,
219
+ encounterUuid: d.encounterUuid
220
+ }), s;
221
+ },
222
+ {}
223
+ );
224
+ return Object.entries(n).map(
225
+ ([s, d]) => ({
226
+ formName: s,
227
+ records: d.sort(
228
+ (_, M) => M.encounterDateTime - _.encounterDateTime
229
+ )
230
+ })
231
+ ).sort((s, d) => s.formName.localeCompare(d.formName));
232
+ }, [R, a]), S = g((n) => {
233
+ A(n), u(!0);
234
+ }, []), Q = g(() => {
235
+ u(!1), A(null);
236
+ }, []), $ = g(
237
+ (n, s) => {
238
+ switch (s) {
239
+ case "recordedOn":
240
+ return /* @__PURE__ */ o(ne, { onClick: () => S(n), children: n.recordedOn });
241
+ case "recordedBy":
242
+ return n.recordedBy;
243
+ default:
244
+ return null;
245
+ }
246
+ },
247
+ [S]
248
+ );
249
+ return /* @__PURE__ */ p(z, { children: [
250
+ /* @__PURE__ */ o("div", { "data-testid": "forms-table", children: L || O || V.length === 0 || C ? /* @__PURE__ */ o(
251
+ G,
252
+ {
253
+ headers: B,
254
+ ariaLabel: a("FORMS_HEADING"),
255
+ rows: [],
256
+ loading: L,
257
+ errorStateMessage: O ? H?.message : void 0,
258
+ emptyStateMessage: a("FORMS_UNAVAILABLE"),
259
+ renderCell: $,
260
+ className: r.formsTableBody,
261
+ "data-testid": "sortable-data-table"
262
+ }
263
+ ) : /* @__PURE__ */ o(te, { align: "start", children: V.map((n, s) => {
264
+ const { formName: d, records: _ } = n;
265
+ return /* @__PURE__ */ o(
266
+ se,
267
+ {
268
+ title: d,
269
+ className: r.customAccordianItem,
270
+ testId: `accordian-title-${d}`,
271
+ open: s === 0,
272
+ children: /* @__PURE__ */ o(
273
+ G,
274
+ {
275
+ headers: B,
276
+ ariaLabel: a("FORMS_HEADING"),
277
+ rows: _,
278
+ loading: !1,
279
+ errorStateMessage: "",
280
+ sortable: P,
281
+ emptyStateMessage: a("FORMS_UNAVAILABLE"),
282
+ renderCell: $,
283
+ className: r.formsTableBody,
284
+ "data-testid": "forms-data-table"
285
+ }
286
+ )
287
+ },
288
+ d
289
+ );
290
+ }) }) }),
291
+ c && t && le(
292
+ /* @__PURE__ */ o(
293
+ de,
294
+ {
295
+ id: "formDetailsModal",
296
+ open: c,
297
+ onRequestClose: Q,
298
+ modalHeading: t.formName,
299
+ modalLabel: `${t.recordedOn} | ${t.recordedBy}`,
300
+ passiveModal: !0,
301
+ size: "md",
302
+ testId: "form-details-modal",
303
+ children: /* @__PURE__ */ o("div", { className: r.formContent, children: j || K ? /* @__PURE__ */ o(ie, { width: "100%", lineCount: 3 }) : D ? /* @__PURE__ */ o("div", { children: I(D).message ?? a("ERROR_FETCHING_FORM_METADATA") }) : E ? /* @__PURE__ */ o("div", { children: I(E).message ?? a("ERROR_FETCHING_FORM_DATA") }) : w.length > 0 ? /* @__PURE__ */ o("div", { className: r.formDetailsContainer, children: w.map((n, s) => /* @__PURE__ */ o(
304
+ we,
305
+ {
306
+ observation: n,
307
+ index: s
308
+ },
309
+ `${n.concept.uuid}`
310
+ )) }) : /* @__PURE__ */ o("div", { children: a("NO_FORM_DATA_AVAILABLE") }) })
311
+ }
312
+ ),
313
+ document.getElementById("actionAreaLayout") ?? document.body
314
+ )
315
+ ] });
316
+ };
317
+ export {
318
+ Ue as default
319
+ };
@@ -1,23 +1,23 @@
1
- import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-3cUxZD_P.js";
2
- import { g as d, c as f, d as e } from "./index-_PCIoEAm.js";
3
- var p = (a) => {
1
+ import { c, T as l, P as m, a as i, D as u, Q as v } from "./YPM2AS64-DzlvhM4M.js";
2
+ import { g as d, h as f, i as e } from "./index-CYlbHpG4.js";
3
+ var h = (a) => {
4
4
  const [r, t] = c({
5
5
  prefix: "TanstackQueryDevtools"
6
6
  }), n = d(), s = f(() => {
7
7
  const o = r.theme_preference || l;
8
8
  return o !== "system" ? o : n();
9
9
  });
10
- return e(i.Provider, {
10
+ return e(v.Provider, {
11
11
  value: a,
12
12
  get children() {
13
13
  return e(m, {
14
14
  localStore: r,
15
15
  setLocalStore: t,
16
16
  get children() {
17
- return e(u.Provider, {
17
+ return e(i.Provider, {
18
18
  value: s,
19
19
  get children() {
20
- return e(v, {
20
+ return e(u, {
21
21
  localStore: r,
22
22
  setLocalStore: t
23
23
  });
@@ -27,7 +27,7 @@ var p = (a) => {
27
27
  });
28
28
  }
29
29
  });
30
- }, C = p;
30
+ }, C = h;
31
31
  export {
32
32
  C as default
33
33
  };
@@ -1,26 +1,26 @@
1
- import { c as s, T as c, P as u, a as i, b as m, C as d, Q as P } from "./YPM2AS64-3cUxZD_P.js";
2
- import { g as v, c as C, d as e } from "./index-_PCIoEAm.js";
3
- var h = (t) => {
1
+ import { c as s, T as c, P as i, a as u, b as m, C as P, Q as d } from "./YPM2AS64-DzlvhM4M.js";
2
+ import { g as h, h as v, i as e } from "./index-CYlbHpG4.js";
3
+ var C = (t) => {
4
4
  const [r, o] = s({
5
5
  prefix: "TanstackQueryDevtools"
6
- }), a = v(), l = C(() => {
6
+ }), a = h(), l = v(() => {
7
7
  const n = r.theme_preference || c;
8
8
  return n !== "system" ? n : a();
9
9
  });
10
- return e(P.Provider, {
10
+ return e(d.Provider, {
11
11
  value: t,
12
12
  get children() {
13
- return e(u, {
13
+ return e(i, {
14
14
  disabled: !0,
15
15
  localStore: r,
16
16
  setLocalStore: o,
17
17
  get children() {
18
- return e(i.Provider, {
18
+ return e(u.Provider, {
19
19
  value: l,
20
20
  get children() {
21
21
  return e(m, {
22
22
  get children() {
23
- return e(d, {
23
+ return e(P, {
24
24
  localStore: r,
25
25
  setLocalStore: o,
26
26
  get onClose() {
@@ -36,7 +36,7 @@ var h = (t) => {
36
36
  });
37
37
  }
38
38
  });
39
- }, p = h;
39
+ }, p = C;
40
40
  export {
41
41
  p as default
42
42
  };
@@ -1,4 +1,4 @@
1
- import { f as we, h as z, o as xt, i as B, c as q, d as y, P as Ro, m as ye, S as R, j as _, k, n as N, p as A, q as bs, r as ir, s as $e, v as U, w as Hn, x as Vn, y as dt, z as D, B as xs, D as cn, F as Be, H as ws, I as qt, K as zt, L as $s, M as Cs, N as $n, O as Ss, R as Nr, T as Bt, $ as zo, U as ks, W as Es, Y as j, Z as Ur, a0 as Ms, a1 as Ds, a2 as sr, a3 as As, a4 as Ts, a5 as zn, a6 as Fs, a7 as Is, a8 as Z, a9 as Ps, aa as Ls } from "./index-_PCIoEAm.js";
1
+ import { j as we, k as z, o as xt, l as B, h as q, i as y, P as Ro, m as ye, S as R, n as _, p as k, q as N, s as A, v as bs, w as ir, x as $e, y as U, z as Hn, A as Vn, B as dt, D, G as xs, H as cn, I as Be, J as ws, K as qt, L as zt, M as $s, O as Cs, R as $n, T as Ss, U as Nr, W as Bt, $ as zo, Y as ks, Z as Es, a0 as j, a1 as Ur, a2 as Ms, a3 as Ds, a4 as sr, a5 as As, a6 as Ts, a7 as zn, a8 as Fs, a9 as Is, aa as Z, ab as Ps, ac as Ls } from "./index-CYlbHpG4.js";
2
2
  var Os = (e) => e != null, qs = (e) => e.filter(Os);
3
3
  function _s(e) {
4
4
  return (...t) => {