@bahmni/registration-app 0.0.1-dev.147 → 0.0.1-dev.148

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.
@@ -1,8 +1,8 @@
1
- import { jsx as t, jsxs as p, Fragment as Z } from "react/jsx-runtime";
2
- import { u as J, b as Q, m as Y, p as X, a as ee, h as re, d as ae, c as oe, y as te, $ as U, U as ne, W as se, e as me, Z as de, f as x, K as ie, H as v } from "./index-DbgtnTLR.js";
1
+ import { jsx as t, jsxs as p, Fragment as W } from "react/jsx-runtime";
2
+ import { u as J, H as Q, w as X, W as Z, q as ee, U as re, F as ae, i as oe, C as te, A as G, Y as ne, G as se, a as me, V as de, b as U, g as ie, c as v } from "./index-BA_3C-qM.js";
3
3
  import { useQuery as h } from "@tanstack/react-query";
4
- import { useState as G, useMemo as $, useCallback as y } from "react";
5
- const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue = "_formContent_1pd36_18", pe = "_formDetailsContainer_1pd36_25", be = "_observation_1pd36_30", _e = "_groupContainer_1pd36_39", fe = "_rowContainer_1pd36_43", $e = "_groupLabel_1pd36_48", Ne = "_rowLabel_1pd36_58", ge = "_rowValue_1pd36_67", he = "_groupMembers_1pd36_75", ye = "_memberRow_1pd36_81", ve = "_memberLabel_1pd36_86", Ae = "_memberValue_1pd36_94", Me = "_abnormalValue_1pd36_102", Te = "_commentSection_1pd36_110", Le = "_commentText_1pd36_116", Ce = "_nestedGroup_1pd36_125", De = "_nestedGroupLabel_1pd36_132", Oe = "_nestedGroupMembers_1pd36_141", o = {
4
+ import { useState as x, useMemo as N, useCallback as y } from "react";
5
+ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue = "_formContent_1pd36_18", pe = "_formDetailsContainer_1pd36_25", be = "_observation_1pd36_30", _e = "_groupContainer_1pd36_39", fe = "_rowContainer_1pd36_43", Ne = "_groupLabel_1pd36_48", $e = "_rowLabel_1pd36_58", ge = "_rowValue_1pd36_67", he = "_groupMembers_1pd36_75", ye = "_memberRow_1pd36_81", ve = "_memberLabel_1pd36_86", Ae = "_memberValue_1pd36_94", Me = "_abnormalValue_1pd36_102", Te = "_commentSection_1pd36_110", Ce = "_commentText_1pd36_116", Le = "_nestedGroup_1pd36_125", De = "_nestedGroupLabel_1pd36_132", Oe = "_nestedGroupMembers_1pd36_141", o = {
6
6
  formsTableBody: le,
7
7
  customAccordianItem: ce,
8
8
  formContent: ue,
@@ -10,8 +10,8 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
10
10
  observation: be,
11
11
  groupContainer: _e,
12
12
  rowContainer: fe,
13
- groupLabel: $e,
14
- rowLabel: Ne,
13
+ groupLabel: Ne,
14
+ rowLabel: $e,
15
15
  rowValue: ge,
16
16
  groupMembers: he,
17
17
  memberRow: ye,
@@ -19,8 +19,8 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
19
19
  memberValue: Ae,
20
20
  abnormalValue: Me,
21
21
  commentSection: Te,
22
- commentText: Le,
23
- nestedGroup: Ce,
22
+ commentText: Ce,
23
+ nestedGroup: Le,
24
24
  nestedGroupLabel: De,
25
25
  nestedGroupMembers: Oe
26
26
  }, Re = "ABNORMAL", q = (e) => {
@@ -54,15 +54,15 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
54
54
  {
55
55
  className: o.nestedGroupMembers,
56
56
  "data-testid": `${c}obs-nested-group-members-${m}-${d}`,
57
- children: e.groupMembers?.map((N, g) => /* @__PURE__ */ t(
57
+ children: e.groupMembers?.map(($, g) => /* @__PURE__ */ t(
58
58
  k,
59
59
  {
60
- member: N,
60
+ member: $,
61
61
  depth: s + 1,
62
62
  memberIndex: g,
63
63
  formName: r
64
64
  },
65
- `${N.concept.uuid}`
65
+ `${$.concept.uuid}`
66
66
  ))
67
67
  }
68
68
  )
@@ -188,24 +188,24 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
188
188
  },
189
189
  `${e.concept.uuid}-${s}`
190
190
  );
191
- }, Ve = ({
191
+ }, Be = ({
192
192
  episodeOfCareUuids: e,
193
193
  encounterUuids: s,
194
194
  config: d
195
195
  }) => {
196
- const { t: r } = J(), u = Q(), [m, c] = G(!1), [a, b] = G(null), _ = d?.numberOfVisits, N = Y(
196
+ const { t: r } = J(), u = Q(), [m, c] = x(!1), [a, b] = x(null), _ = d?.numberOfVisits, $ = X(
197
197
  e,
198
198
  s
199
199
  ), {
200
200
  data: g = [],
201
- isLoading: L,
202
- isError: C,
201
+ isLoading: C,
202
+ isError: L,
203
203
  error: H
204
204
  } = h({
205
205
  queryKey: ["forms", u, e],
206
- queryFn: () => X(u, void 0, _),
207
- enabled: !!u && !N
208
- }), D = $(() => !s || s.length === 0 ? g : g.filter(
206
+ queryFn: () => Z(u, void 0, _),
207
+ enabled: !!u && !$
208
+ }), D = N(() => !s || s.length === 0 ? g : g.filter(
209
209
  (n) => s.includes(n.encounterUuid)
210
210
  ), [g, s]), { data: O = [] } = h({
211
211
  queryKey: ["observationForms"],
@@ -213,12 +213,12 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
213
213
  }), R = y(
214
214
  (n) => O.find((l) => l.name === n)?.uuid,
215
215
  [O]
216
- ), A = $(() => {
216
+ ), A = N(() => {
217
217
  if (a)
218
218
  return R(a.formName);
219
219
  }, [a, R]), {
220
220
  data: we,
221
- isLoading: K,
221
+ isLoading: j,
222
222
  error: F
223
223
  } = h({
224
224
  queryKey: ["formMetadata", A],
@@ -226,32 +226,32 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
226
226
  enabled: !!A && m
227
227
  }), {
228
228
  data: M,
229
- isLoading: j,
229
+ isLoading: K,
230
230
  error: w
231
231
  } = h({
232
232
  queryKey: ["formsEncounter", a?.encounterUuid],
233
233
  queryFn: () => ae(a.encounterUuid, !0),
234
234
  enabled: !!a?.encounterUuid && m
235
- }), I = $(() => !M?.observations || !a?.formName ? [] : M.observations.filter(
235
+ }), I = N(() => !M?.observations || !a?.formName ? [] : M.observations.filter(
236
236
  (n) => "formFieldPath" in n && typeof n.formFieldPath == "string" && n.formFieldPath.includes(a.formName)
237
- ), [M?.observations, a?.formName]), E = $(
237
+ ), [M?.observations, a?.formName]), V = N(
238
238
  () => [
239
239
  { key: "recordedOn", header: r("FORM_RECORDED_ON") },
240
240
  { key: "recordedBy", header: r("FORM_RECORDED_BY") }
241
241
  ],
242
242
  [r]
243
- ), P = $(
243
+ ), P = N(
244
244
  () => [
245
245
  { key: "recordedOn", sortable: !0 },
246
246
  { key: "recordedBy", sortable: !0 }
247
247
  ],
248
248
  []
249
- ), S = $(() => {
249
+ ), E = N(() => {
250
250
  const n = D.reduce(
251
251
  (l, i) => {
252
252
  const f = i.formName;
253
253
  l[f] ??= [];
254
- const T = i.providers.map((W) => W.providerName).filter(Boolean).join(", ");
254
+ const T = i.providers.map((z) => z.providerName).filter(Boolean).join(", ");
255
255
  return l[f].push({
256
256
  id: i.encounterUuid,
257
257
  formName: i.formName,
@@ -271,38 +271,38 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
271
271
  )
272
272
  })
273
273
  ).sort((l, i) => l.formName.localeCompare(i.formName));
274
- }, [D, r]), B = y((n) => {
274
+ }, [D, r]), S = y((n) => {
275
275
  b(n), c(!0);
276
- }, []), z = y(() => {
276
+ }, []), Y = y(() => {
277
277
  c(!1), b(null);
278
- }, []), V = y(
278
+ }, []), B = y(
279
279
  (n, l) => {
280
280
  switch (l) {
281
281
  case "recordedOn":
282
- return /* @__PURE__ */ t(te, { onClick: () => B(n), children: n.recordedOn });
282
+ return /* @__PURE__ */ t(te, { onClick: () => S(n), children: n.recordedOn });
283
283
  case "recordedBy":
284
284
  return n.recordedBy;
285
285
  default:
286
286
  return null;
287
287
  }
288
288
  },
289
- [B]
289
+ [S]
290
290
  );
291
- return /* @__PURE__ */ p(Z, { children: [
292
- /* @__PURE__ */ t("div", { "data-testid": "forms-table", children: L || C || S.length === 0 || N ? /* @__PURE__ */ t(
293
- U,
291
+ return /* @__PURE__ */ p(W, { children: [
292
+ /* @__PURE__ */ t("div", { "data-testid": "forms-table", children: C || L || E.length === 0 || $ ? /* @__PURE__ */ t(
293
+ G,
294
294
  {
295
- headers: E,
295
+ headers: V,
296
296
  ariaLabel: r("FORMS_HEADING"),
297
297
  rows: [],
298
- loading: L,
299
- errorStateMessage: C ? H?.message : void 0,
298
+ loading: C,
299
+ errorStateMessage: L ? H?.message : void 0,
300
300
  emptyStateMessage: r("FORMS_UNAVAILABLE"),
301
- renderCell: V,
301
+ renderCell: B,
302
302
  className: o.formsTableBody,
303
303
  dataTestId: "forms-table"
304
304
  }
305
- ) : /* @__PURE__ */ t(ne, { align: "start", children: S.map((n, l) => {
305
+ ) : /* @__PURE__ */ t(ne, { align: "start", children: E.map((n, l) => {
306
306
  const { formName: i, records: f } = n;
307
307
  return /* @__PURE__ */ t(
308
308
  se,
@@ -312,16 +312,16 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
312
312
  testId: `accordian-title-${i}`,
313
313
  open: l === 0,
314
314
  children: /* @__PURE__ */ t(
315
- U,
315
+ G,
316
316
  {
317
- headers: E,
317
+ headers: V,
318
318
  ariaLabel: r("FORMS_HEADING"),
319
319
  rows: f,
320
320
  loading: !1,
321
321
  errorStateMessage: "",
322
322
  sortable: P,
323
323
  emptyStateMessage: r("FORMS_UNAVAILABLE"),
324
- renderCell: V,
324
+ renderCell: B,
325
325
  className: o.formsTableBody,
326
326
  dataTestId: `forms-table-${i}`
327
327
  }
@@ -335,13 +335,13 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
335
335
  {
336
336
  id: "modalIdForActionAreaLayout",
337
337
  open: m,
338
- onRequestClose: z,
338
+ onRequestClose: Y,
339
339
  modalHeading: a.formName,
340
340
  modalLabel: `${a.recordedOn} | ${a.recordedBy}`,
341
341
  passiveModal: !0,
342
342
  size: "md",
343
343
  testId: "form-details-modal",
344
- children: /* @__PURE__ */ t("div", { className: o.formContent, children: K || j ? /* @__PURE__ */ t(de, { width: "100%", lineCount: 3 }) : F ? /* @__PURE__ */ t("div", { children: x(F).message ?? r("ERROR_FETCHING_FORM_METADATA") }) : w ? /* @__PURE__ */ t("div", { children: x(w).message ?? r("ERROR_FETCHING_FORM_DATA") }) : I.length > 0 ? /* @__PURE__ */ t("div", { className: o.formDetailsContainer, children: I.map((n, l) => /* @__PURE__ */ t(
344
+ children: /* @__PURE__ */ t("div", { className: o.formContent, children: j || K ? /* @__PURE__ */ t(de, { width: "100%", lineCount: 3 }) : F ? /* @__PURE__ */ t("div", { children: U(F).message ?? r("ERROR_FETCHING_FORM_METADATA") }) : w ? /* @__PURE__ */ t("div", { children: U(w).message ?? r("ERROR_FETCHING_FORM_DATA") }) : I.length > 0 ? /* @__PURE__ */ t("div", { className: o.formDetailsContainer, children: I.map((n, l) => /* @__PURE__ */ t(
345
345
  Fe,
346
346
  {
347
347
  observation: n,
@@ -355,5 +355,5 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
355
355
  ] });
356
356
  };
357
357
  export {
358
- Ve as default
358
+ Be as default
359
359
  };
@@ -1,25 +1,25 @@
1
- import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-CBxUINrF.js";
2
- import { o as d, q as f, r as e } from "./index-DbgtnTLR.js";
1
+ import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-DlEtdfM4.js";
2
+ import { l as d, m as f, n as e } from "./index-BA_3C-qM.js";
3
3
  var p = (a) => {
4
- const [r, o] = c({
4
+ const [r, t] = c({
5
5
  prefix: "TanstackQueryDevtools"
6
6
  }), n = d(), s = f(() => {
7
- const t = r.theme_preference || l;
8
- return t !== "system" ? t : n();
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: o,
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: o
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-CBxUINrF.js";
2
- import { o as v, q as C, r as e } from "./index-DbgtnTLR.js";
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-DlEtdfM4.js";
2
+ import { l as v, m as C, n as e } from "./index-BA_3C-qM.js";
3
3
  var h = (t) => {
4
4
  const [r, o] = s({
5
5
  prefix: "TanstackQueryDevtools"
@@ -0,0 +1,163 @@
1
+ import { jsxs as $, jsx as b } from "react/jsx-runtime";
2
+ import { H as C, h as K, u as I, P as U, j as V, K as H, X as Q, Q as M, d as j, A as G, e as w, f as N, J as x, B as P, O as X, k as J, M as Y } from "./index-BA_3C-qM.js";
3
+ import { useQueries as z, useQuery as W } from "@tanstack/react-query";
4
+ import { useRef as Z, useEffect as _, useMemo as h } from "react";
5
+ const S = (e, d, o, l, t) => {
6
+ const a = x(e, d), r = a.value, s = P(r);
7
+ let i = r;
8
+ s === "Image" && (i = /* @__PURE__ */ b(J, { imageSrc: r, alt: r, id: `${r}-img` })), s === "Video" && (i = /* @__PURE__ */ b(Y, { id: `${r}-video`, videoSrc: r }));
9
+ const c = t("OBSERVATIONS_RECORDED_BY", {
10
+ provider: a.provider
11
+ }), m = e.display, p = e.observationValue?.isAbnormal ? "abnormal-obs" : "obs", u = l ? `${l}-${p}-${m}-${o}-${d}` : `${p}-${m}-${o}-${d}`;
12
+ return /* @__PURE__ */ b(
13
+ X,
14
+ {
15
+ header: a.header,
16
+ value: i,
17
+ info: c,
18
+ id: u,
19
+ testId: u,
20
+ ariaLabel: u
21
+ },
22
+ `obs-${e.id}`
23
+ );
24
+ }, ee = (e, d, o, l, t, a) => /* @__PURE__ */ b(
25
+ N,
26
+ {
27
+ title: e.display,
28
+ id: `grouped-obs-${e.display}-${l}`,
29
+ open: o,
30
+ children: e.members?.map(
31
+ (r, s) => S(r, s, t, a, d)
32
+ )
33
+ },
34
+ `grouped-obs-${e.id}`
35
+ ), te = ({
36
+ groupedData: e,
37
+ title: d = ""
38
+ }) => {
39
+ const { t: o } = I(), l = (t, a, r) => {
40
+ const s = w(t.encounterDetails, o);
41
+ return /* @__PURE__ */ $(
42
+ N,
43
+ {
44
+ title: s,
45
+ id: `encounter-${t.encounterId}`,
46
+ open: a,
47
+ children: [
48
+ t.observations.map(
49
+ (i, c) => S(i, c, r, d, o)
50
+ ),
51
+ t.groupedObservations.map(
52
+ (i, c) => ee(
53
+ i,
54
+ o,
55
+ a,
56
+ c,
57
+ r,
58
+ d
59
+ )
60
+ )
61
+ ]
62
+ },
63
+ `encounter-${t.encounterId}`
64
+ );
65
+ };
66
+ return /* @__PURE__ */ b(
67
+ "div",
68
+ {
69
+ id: "obs-by-encounter",
70
+ "data-testid": "obs-by-encounter-test-id",
71
+ "aria-label": "obs-by-encounter-aria-label",
72
+ children: e.map(
73
+ (t, a) => l(t, a === 0, a)
74
+ )
75
+ }
76
+ );
77
+ }, ae = "_observations_kfbhq_1", re = "_title_kfbhq_12", T = {
78
+ observations: ae,
79
+ title: re
80
+ }, se = (e) => ["conceptUuid", e], oe = (e, d) => ["observations", e, ...d], ue = ({ config: e }) => {
81
+ const d = e, { conceptNames: o = [], conceptUuid: l = [] } = d, t = Z(/* @__PURE__ */ new Set()), a = C(), { addNotification: r } = K(), { t: s } = I(), i = z({
82
+ queries: o.map((n) => ({
83
+ queryKey: se(n),
84
+ queryFn: () => U(n),
85
+ enabled: !!n
86
+ }))
87
+ });
88
+ _(() => {
89
+ i.forEach((n, y) => {
90
+ if (n.isError && !t.current.has(y)) {
91
+ const q = o[y];
92
+ r({
93
+ title: s("ERROR_DEFAULT_TITLE"),
94
+ message: s("ERROR_FETCHING_CONCEPT", { conceptName: q }),
95
+ type: "error"
96
+ }), t.current.add(y);
97
+ } else n.isError || t.current.delete(y);
98
+ });
99
+ }, [i, o]);
100
+ const c = h(() => i.map((n) => n.data?.uuid).filter((n) => !!n), [i]), m = h(() => [.../* @__PURE__ */ new Set([...c, ...l])], [c, l]), p = h(() => o.length === 0 ? !0 : i.every((n) => !n.isLoading), [i, o.length]), {
101
+ data: u,
102
+ isLoading: A,
103
+ isError: R
104
+ } = W({
105
+ queryKey: oe(a, m),
106
+ queryFn: () => V(a, m),
107
+ enabled: !!a && m.length > 0 && p
108
+ });
109
+ _(() => {
110
+ R && r({
111
+ title: s("ERROR_DEFAULT_TITLE"),
112
+ message: s("ERROR_FETCHING_OBSERVATIONS"),
113
+ type: "error"
114
+ });
115
+ }, [R]);
116
+ const g = h(() => {
117
+ if (!u) return [];
118
+ const n = H(u), y = Q(n);
119
+ return M(y);
120
+ }, [u]), B = [
121
+ { key: "name", header: "name" },
122
+ { key: "value", header: "value" },
123
+ { key: "form", header: "form" }
124
+ ], O = A || !p, f = R && p, D = (!u || u.entry?.length === 0 || m.length === 0) && p, F = f ? s("ERROR_FETCHING_OBSERVATIONS") : null, L = D ? s("NO_OBSERVATIONS_FOUND") : void 0, k = g.length > 0 && !O && !f, E = d.titleTranslationKey, v = E ? s(E) : "";
125
+ return /* @__PURE__ */ $(
126
+ "div",
127
+ {
128
+ id: "observations",
129
+ "data-testid": E ? `observations-${v}` : "observations",
130
+ "aria-label": "observations-aria-label",
131
+ className: T.observations,
132
+ children: [
133
+ /* @__PURE__ */ b(
134
+ j,
135
+ {
136
+ id: "observations-title",
137
+ testId: E ? `observations-title-${v}` : "observations-title",
138
+ title: v,
139
+ className: T.title,
140
+ children: /* @__PURE__ */ b("p", { children: v })
141
+ }
142
+ ),
143
+ k ? /* @__PURE__ */ b(te, { groupedData: g, title: v }) : /* @__PURE__ */ b(
144
+ G,
145
+ {
146
+ headers: B,
147
+ rows: [],
148
+ ariaLabel: s("OBSERVATIONS"),
149
+ loading: O,
150
+ errorStateMessage: F,
151
+ emptyStateMessage: L,
152
+ dataTestId: "observations-table"
153
+ }
154
+ )
155
+ ]
156
+ }
157
+ );
158
+ };
159
+ export {
160
+ se as conceptUuidQueryKeys,
161
+ ue as default,
162
+ oe as observationsQueryKeys
163
+ };