@bahmni/registration-app 0.0.1-dev.191 → 0.0.1-dev.192

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,12 +1,12 @@
1
1
  import { jsxs as I, jsx as l } from "react/jsx-runtime";
2
- import { p as C, o as B, u as N, k as H, l as K, e as Q, h as j, H as w, n as x, L as G, A as M, r as P, s as S, V as W, i as z, t as Y, F as J, q as X, W as Z } from "./index-BTczc-KE.js";
2
+ import { d as B, t as k, u as N, g as K, V as Q, E as w, y as x, T as z, h as G, z as H, a as M, _ as j, X as S, i as P, v as X, $ as Y, Q as J, c as W, e as Z } from "./index-NZAakdxu.js";
3
3
  import { useQueries as ee, useQuery as te } from "@tanstack/react-query";
4
- import { useRef as ae, useEffect as $, useMemo as E } from "react";
5
- const F = (t, d, n, u, o) => {
6
- const a = W(t, d), r = a.value, s = z(r);
7
- let i = r;
8
- s === "Image" && (i = /* @__PURE__ */ l(J, { imageSrc: r, alt: r, id: `${r}-img` })), s === "Video" && (i = /* @__PURE__ */ l(X, { id: `${r}-video`, videoSrc: r })), s === "PDF" && (i = /* @__PURE__ */ l(Z, { id: `${r}-pdf`, src: r }));
9
- const b = o("OBSERVATIONS_RECORDED_BY", {
4
+ import { useRef as ae, useEffect as $, useMemo as g } from "react";
5
+ const C = (t, d, n, u, r) => {
6
+ const a = P(t, d, r), s = a.value, o = X(s);
7
+ let i = s;
8
+ o === "Image" && (i = /* @__PURE__ */ l(J, { imageSrc: s, alt: s, id: `${s}-img` })), o === "Video" && (i = /* @__PURE__ */ l(W, { id: `${s}-video`, videoSrc: s })), o === "PDF" && (i = /* @__PURE__ */ l(Z, { id: `${s}-pdf`, src: s }));
9
+ const b = r("OBSERVATIONS_RECORDED_BY", {
10
10
  provider: a.provider
11
11
  }), p = t.display, v = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", c = u ? `${u}-${v}-${p}-${n}-${d}` : `${v}-${p}-${n}-${d}`;
12
12
  return /* @__PURE__ */ l(
@@ -21,46 +21,46 @@ const F = (t, d, n, u, o) => {
21
21
  },
22
22
  `obs-${t.id}`
23
23
  );
24
- }, re = (t, d, n, u, o, a) => /* @__PURE__ */ l(
24
+ }, se = (t, d, n, u, r, a) => /* @__PURE__ */ l(
25
25
  S,
26
26
  {
27
27
  title: t.display,
28
28
  id: `grouped-obs-${t.display}-${u}`,
29
29
  open: n,
30
30
  children: t.members?.map(
31
- (r, s) => F(r, s, o, a, d)
31
+ (s, o) => C(s, o, r, a, d)
32
32
  )
33
33
  },
34
34
  `grouped-obs-${t.id}`
35
- ), se = ({
35
+ ), re = ({
36
36
  groupedData: t,
37
37
  title: d = ""
38
38
  }) => {
39
- const { t: n } = N(), u = (o, a, r) => {
40
- const s = P(o.encounterDetails, n);
39
+ const { t: n } = N(), u = (r, a, s) => {
40
+ const o = j(r.encounterDetails, n);
41
41
  return /* @__PURE__ */ I(
42
42
  S,
43
43
  {
44
- title: s,
45
- id: `encounter-${o.encounterId}`,
44
+ title: o,
45
+ id: `encounter-${r.encounterId}`,
46
46
  open: a,
47
47
  children: [
48
- o.observations.map(
49
- (i, b) => F(i, b, r, d, n)
48
+ r.observations.map(
49
+ (i, b) => C(i, b, s, d, n)
50
50
  ),
51
- o.groupedObservations.map(
52
- (i, b) => re(
51
+ r.groupedObservations.map(
52
+ (i, b) => se(
53
53
  i,
54
54
  n,
55
55
  a,
56
56
  b,
57
- r,
57
+ s,
58
58
  d
59
59
  )
60
60
  )
61
61
  ]
62
62
  },
63
- `encounter-${o.encounterId}`
63
+ `encounter-${r.encounterId}`
64
64
  );
65
65
  };
66
66
  return /* @__PURE__ */ l(
@@ -70,7 +70,7 @@ const F = (t, d, n, u, o) => {
70
70
  "data-testid": "obs-by-encounter-test-id",
71
71
  "aria-label": "obs-by-encounter-aria-label",
72
72
  children: t.map(
73
- (o, a) => u(o, a === 0, a)
73
+ (r, a) => u(r, a === 0, a)
74
74
  )
75
75
  }
76
76
  );
@@ -78,84 +78,84 @@ const F = (t, d, n, u, o) => {
78
78
  observations: oe,
79
79
  title: ie
80
80
  }, ne = (t) => ["conceptUuid", t], de = (t, d) => ["observations", t, ...d], pe = ({ config: t }) => {
81
- const d = t, { conceptNames: n = [], conceptUuid: u = [] } = d, o = ae(/* @__PURE__ */ new Set()), a = C(), { addNotification: r } = B(), { t: s } = N(), i = ee({
81
+ const d = t, { conceptNames: n = [], conceptUuid: u = [] } = d, r = ae(/* @__PURE__ */ new Set()), a = B(), { addNotification: s } = k(), { t: o } = N(), i = ee({
82
82
  queries: n.map((e) => ({
83
83
  queryKey: ne(e),
84
- queryFn: () => H(e),
84
+ queryFn: () => K(e),
85
85
  enabled: !!e
86
86
  }))
87
87
  });
88
88
  $(() => {
89
89
  i.forEach((e, m) => {
90
- if (e.isError && !o.current.has(m)) {
91
- const k = n[m];
92
- r({
93
- title: s("ERROR_DEFAULT_TITLE"),
94
- message: s("ERROR_FETCHING_CONCEPT", { conceptName: k }),
90
+ if (e.isError && !r.current.has(m)) {
91
+ const q = n[m];
92
+ s({
93
+ title: o("ERROR_DEFAULT_TITLE"),
94
+ message: o("ERROR_FETCHING_CONCEPT", { conceptName: q }),
95
95
  type: "error"
96
- }), o.current.add(m);
97
- } else e.isError || o.current.delete(m);
96
+ }), r.current.add(m);
97
+ } else e.isError || r.current.delete(m);
98
98
  });
99
99
  }, [i, n]);
100
- const b = E(() => i.map((e) => e.data?.uuid).filter((e) => !!e), [i]), p = E(() => [.../* @__PURE__ */ new Set([...b, ...u])], [b, u]), v = E(() => n.length === 0 ? !0 : i.every((e) => !e.isLoading), [i, n.length]), {
100
+ const b = g(() => i.map((e) => e.data?.uuid).filter((e) => !!e), [i]), p = g(() => [.../* @__PURE__ */ new Set([...b, ...u])], [b, u]), v = g(() => n.length === 0 ? !0 : i.every((e) => !e.isLoading), [i, n.length]), {
101
101
  data: c,
102
- isLoading: A,
103
- isError: R,
104
- refetch: f
102
+ isLoading: D,
103
+ isError: h,
104
+ refetch: R
105
105
  } = te({
106
106
  queryKey: de(a, p),
107
- queryFn: () => K(a, p),
107
+ queryFn: () => Q(a, p),
108
108
  enabled: !!a && p.length > 0 && v
109
109
  });
110
- Q(
110
+ w(
111
111
  (e) => {
112
112
  e.patientUUID === a && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
113
113
  (m) => p.includes(m)
114
- ) && f();
114
+ ) && R();
115
115
  },
116
- [a, f]
116
+ [a, R]
117
117
  ), $(() => {
118
- R && r({
119
- title: s("ERROR_DEFAULT_TITLE"),
120
- message: s("ERROR_FETCHING_OBSERVATIONS"),
118
+ h && s({
119
+ title: o("ERROR_DEFAULT_TITLE"),
120
+ message: o("ERROR_FETCHING_OBSERVATIONS"),
121
121
  type: "error"
122
122
  });
123
- }, [R]);
124
- const g = E(() => {
123
+ }, [h]);
124
+ const f = g(() => {
125
125
  if (!c) return [];
126
- const e = j(c), m = w(e);
127
- return x(m);
128
- }, [c]), L = [
126
+ const e = x(c), m = z(e);
127
+ return G(m);
128
+ }, [c]), F = [
129
129
  { key: "name", header: "name" },
130
130
  { key: "value", header: "value" },
131
131
  { key: "form", header: "form" }
132
- ], O = A || !v, _ = R && v, q = (!c || c.entry?.length === 0 || p.length === 0) && v, D = _ ? s("ERROR_FETCHING_OBSERVATIONS") : null, U = q ? s("NO_OBSERVATIONS_FOUND") : void 0, V = g.length > 0 && !O && !_, h = d.titleTranslationKey, y = h ? s(h) : "";
132
+ ], _ = D || !v, O = h && v, A = (!c || c.entry?.length === 0 || p.length === 0) && v, L = O ? o("ERROR_FETCHING_OBSERVATIONS") : null, U = A ? o("NO_OBSERVATIONS_FOUND") : void 0, V = f.length > 0 && !_ && !O, E = d.titleTranslationKey, y = E ? o(E) : "";
133
133
  return /* @__PURE__ */ I(
134
134
  "div",
135
135
  {
136
136
  id: "observations",
137
- "data-testid": h ? `observations-${y}` : "observations",
137
+ "data-testid": E ? `observations-${y}` : "observations",
138
138
  "aria-label": "observations-aria-label",
139
139
  className: T.observations,
140
140
  children: [
141
141
  /* @__PURE__ */ l(
142
- G,
142
+ H,
143
143
  {
144
144
  id: "observations-title",
145
- testId: h ? `observations-title-${y}` : "observations-title",
145
+ testId: E ? `observations-title-${y}` : "observations-title",
146
146
  title: y,
147
147
  className: T.title,
148
148
  children: /* @__PURE__ */ l("p", { children: y })
149
149
  }
150
150
  ),
151
- V ? /* @__PURE__ */ l(se, { groupedData: g, title: y }) : /* @__PURE__ */ l(
151
+ V ? /* @__PURE__ */ l(re, { groupedData: f, title: y }) : /* @__PURE__ */ l(
152
152
  M,
153
153
  {
154
- headers: L,
154
+ headers: F,
155
155
  rows: [],
156
- ariaLabel: s("OBSERVATIONS"),
157
- loading: O,
158
- errorStateMessage: D,
156
+ ariaLabel: o("OBSERVATIONS"),
157
+ loading: _,
158
+ errorStateMessage: L,
159
159
  emptyStateMessage: U,
160
160
  dataTestId: "observations-table"
161
161
  }