@bahmni/home-app 0.0.1-dev.363 → 0.0.1-dev.366

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,7 +1,7 @@
1
1
  import { jsx as r, jsxs as p, Fragment as x } from "react/jsx-runtime";
2
- import { g as G, u as Y, K as W, f as J, n as X, a as Z, U as ee, p as te } from "./index-D_2zBN1T.js";
2
+ import { g as G, u as Y, K as W, w as J, a as X, b as Z, U as ee, p as te } from "./index-Tm1TzWsm.js";
3
3
  import { useQuery as ae } from "@tanstack/react-query";
4
- import { useState as l, useCallback as h, useEffect as D, useMemo as _ } from "react";
4
+ import { useState as l, useCallback as h, useEffect as I, useMemo as _ } from "react";
5
5
  const ne = "DocumentsTable-module_documentsTableBody__6iR3w", oe = "DocumentsTable-module_viewAttachmentsLink__aQ1on", re = "DocumentsTable-module_documentViewerContainer__F5m8D", de = "DocumentsTable-module_attachmentItem__17KA7", se = "DocumentsTable-module_attachmentCounter__WFiI3", me = "DocumentsTable-module_attachmentError__RI4U2", ce = "DocumentsTable-module_documentIframe__ptq5I", le = "DocumentsTable-module_documentImage__KQVgS", d = {
6
6
  documentsTableBody: ne,
7
7
  viewAttachmentsLink: oe,
@@ -33,23 +33,23 @@ const Te = [
33
33
  "attachments",
34
34
  "uploadedOn",
35
35
  "uploadedBy"
36
- ], pe = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, B = (a) => a.attachments.length > 0 ? a.attachments : a.documentUrl ? [{ url: a.documentUrl, contentType: a.contentType }] : [], fe = ({ config: a, encounterUuids: g }) => {
37
- const [s, U] = l(!1), [o, w] = l(
36
+ ], pe = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, B = (a) => a.attachments.length > 0 ? a.attachments : a.documentUrl ? [{ url: a.documentUrl, contentType: a.contentType }] : [], Ne = ({ config: a, encounterUuids: g }) => {
37
+ const [s, S] = l(!1), [o, U] = l(
38
38
  null
39
- ), [$, I] = l(
39
+ ), [$, O] = l(
40
40
  /* @__PURE__ */ new Set()
41
- ), E = G(), { t: n } = Y(), { addNotification: L } = W(), k = Number(a?.pageSize) || 5, [O, C] = l(1), [u, V] = l(k), [F, A] = l(void 0), M = h((e) => {
42
- w(e), U(!0);
41
+ ), E = G(), { t: n } = Y(), { addNotification: L } = W(), k = Number(a?.pageSize) || 5, [f, C] = l(1), [u, V] = l(k), [F, A] = l(void 0), M = h((e) => {
42
+ U(e), S(!0);
43
43
  }, []), H = h(() => {
44
- U(!1), w(null), I(/* @__PURE__ */ new Set());
44
+ S(!1), U(null), O(/* @__PURE__ */ new Set());
45
45
  }, []), v = h((e) => {
46
- I((t) => new Set(t).add(e));
46
+ O((t) => new Set(t).add(e));
47
47
  }, []), { data: i, isLoading: q, isError: b, error: y } = ae({
48
48
  queryKey: [
49
49
  "documents",
50
50
  E,
51
51
  g,
52
- O,
52
+ f,
53
53
  u
54
54
  ],
55
55
  enabled: !!E,
@@ -57,36 +57,36 @@ const Te = [
57
57
  E,
58
58
  g,
59
59
  u,
60
- O
60
+ f
61
61
  )
62
62
  });
63
- D(() => {
63
+ I(() => {
64
64
  i && A(i.total);
65
- }, [i]), D(() => {
65
+ }, [i]), I(() => {
66
66
  C(1), A(void 0);
67
- }, [E]), D(() => {
67
+ }, [E]), I(() => {
68
68
  b && L({
69
69
  title: n("ERROR_DEFAULT_TITLE"),
70
70
  message: y?.message ?? "",
71
71
  type: "error"
72
72
  });
73
- }, [b, y, L, n]), D(() => {
73
+ }, [b, y, L, n]), I(() => {
74
74
  const e = new AbortController();
75
75
  return (async () => {
76
76
  if (!s || !o) return;
77
77
  const t = /* @__PURE__ */ new Set(), m = B(o);
78
78
  for (let c = 0; c < m.length; c++) {
79
- const S = R(m[c].url);
79
+ const w = R(m[c].url);
80
80
  try {
81
- (await fetch(S, {
81
+ (await fetch(w, {
82
82
  method: "HEAD",
83
83
  signal: e.signal
84
84
  })).ok || t.add(c);
85
- } catch (N) {
86
- N instanceof Error && N.name !== "AbortError" && t.add(c);
85
+ } catch (D) {
86
+ D instanceof Error && D.name !== "AbortError" && t.add(c);
87
87
  }
88
88
  }
89
- e.signal.aborted || I(t);
89
+ e.signal.aborted || O(t);
90
90
  })(), () => e.abort();
91
91
  }, [s, o]);
92
92
  const K = h(
@@ -94,15 +94,15 @@ const Te = [
94
94
  t !== u ? (V(t), C(1), A(void 0)) : C(e);
95
95
  },
96
96
  [u]
97
- ), f = _(
97
+ ), N = _(
98
98
  () => a?.fields ?? Te,
99
99
  [a?.fields]
100
- ), j = _(() => [...i?.documents ?? []].sort((e, t) => !e.uploadedOn && !t.uploadedOn ? 0 : e.uploadedOn ? t.uploadedOn ? new Date(t.uploadedOn).getTime() - new Date(e.uploadedOn).getTime() : -1 : 1), [i]), P = _(() => ie(f, n), [f, n]), z = _(
101
- () => f.map((e) => ({
100
+ ), j = _(() => [...i?.documents ?? []].sort((e, t) => !e.uploadedOn && !t.uploadedOn ? 0 : e.uploadedOn ? t.uploadedOn ? new Date(t.uploadedOn).getTime() - new Date(e.uploadedOn).getTime() : -1 : 1), [i]), P = _(() => ie(N, n), [N, n]), z = _(
101
+ () => N.map((e) => ({
102
102
  key: e,
103
103
  sortable: e !== "attachments"
104
104
  })),
105
- [f]
105
+ [N]
106
106
  ), T = _(
107
107
  () => o ? B(o) : [],
108
108
  [o]
@@ -153,7 +153,7 @@ const Te = [
153
153
  dataTestId: "documents-table",
154
154
  pageSize: u,
155
155
  totalItems: F,
156
- page: O,
156
+ page: f,
157
157
  onPageChange: K
158
158
  }
159
159
  ) }),
@@ -169,8 +169,8 @@ const Te = [
169
169
  size: "lg",
170
170
  testId: "document-view-modal",
171
171
  children: /* @__PURE__ */ r("div", { className: d.documentViewerContainer, children: T.map((e, t) => {
172
- const m = R(e.url), c = e.contentType?.toLowerCase().includes("pdf"), S = (e.contentType?.toLowerCase().includes("image") ?? !1) || pe.test(e.url ?? ""), N = $.has(t);
173
- return m === "#" || N ? /* @__PURE__ */ p(
172
+ const m = R(e.url), c = e.contentType?.toLowerCase().includes("pdf"), w = (e.contentType?.toLowerCase().includes("image") ?? !1) || pe.test(e.url ?? ""), D = $.has(t);
173
+ return m === "#" || D ? /* @__PURE__ */ p(
174
174
  "div",
175
175
  {
176
176
  className: d.attachmentError,
@@ -196,7 +196,7 @@ const Te = [
196
196
  "/",
197
197
  T.length
198
198
  ] }),
199
- S ? /* @__PURE__ */ r(
199
+ w ? /* @__PURE__ */ r(
200
200
  "img",
201
201
  {
202
202
  src: m,
@@ -223,5 +223,5 @@ const Te = [
223
223
  ] });
224
224
  };
225
225
  export {
226
- fe as default
226
+ Ne as default
227
227
  };
@@ -1,6 +1,6 @@
1
- import { jsx as i, jsxs as G, Fragment as he } from "react/jsx-runtime";
2
- import { u as ge, g as pe, v as be, J as Ne, b as Oe, c as Te, h as Ie, d as Ee, e as Ae, i as ve, R as _e, y as Se, s as K, a as Fe, j as Y, t as x, n as Re, U as P, S as Ue, $ as Ce, p as Be, G as Le, z as De } from "./index-D_2zBN1T.js";
3
- import { useQueryClient as Me, useQuery as O } from "@tanstack/react-query";
1
+ import { jsx as i, jsxs as G, Fragment as ye } from "react/jsx-runtime";
2
+ import { u as ge, g as pe, v as be, J as Oe, c as Ne, m as Te, h as Ie, f as Ee, e as Ae, d as ve, R as _e, H as Se, s as K, b as Fe, i as Y, t as x, a as Re, U as P, S as Ue, $ as Ce, p as Be, G as Le, O as De } from "./index-Tm1TzWsm.js";
3
+ import { useQueryClient as Me, useQuery as N } from "@tanstack/react-query";
4
4
  import { useState as Q, useMemo as d, useCallback as l } from "react";
5
5
  const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_modalHeading__wnTmA", we = "FormsTable-module_customAccordianItem__isszs", T = {
6
6
  formsTableBody: ke,
@@ -11,7 +11,7 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
11
11
  encounterUuids: u,
12
12
  config: J,
13
13
  disableActions: X = !1,
14
- activeEncounterUuid: h = null
14
+ activeEncounterUuid: y = null
15
15
  }) => {
16
16
  const { t: n } = ge(), c = pe(), [g, U] = Q(!1), [s, C] = Q(null), {
17
17
  numberOfVisits: Z,
@@ -19,7 +19,7 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
19
19
  forms: p
20
20
  } = J ?? {}, ee = be(
21
21
  De.EDIT_OBSERVATIONS
22
- ), { userPrivileges: b } = Ne(), I = ee && !X && !!h, B = Oe(
22
+ ), { userPrivileges: b } = Oe(), I = ee && !X && !!y, B = Ne(
23
23
  R,
24
24
  u
25
25
  ), re = Me(), {
@@ -28,7 +28,7 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
28
28
  isError: M,
29
29
  error: oe,
30
30
  refetch: ae
31
- } = O({
31
+ } = N({
32
32
  queryKey: ["forms", c, R],
33
33
  queryFn: () => Te(c, void 0, Z),
34
34
  enabled: !!c && !B
@@ -39,12 +39,12 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
39
39
  )), Array.isArray(p) && p.length > 0 && (e = e.filter(
40
40
  (r) => p.some((o) => o.toLowerCase() === r.formName.toLowerCase())
41
41
  )), e;
42
- }, [L, u, p]), { data: N = [] } = O({
42
+ }, [L, u, p]), { data: O = [] } = N({
43
43
  queryKey: ["observationForms"],
44
44
  queryFn: () => Ie()
45
45
  }), q = l(
46
46
  (e) => {
47
- const r = N.find((a) => a.name === e);
47
+ const r = O.find((a) => a.name === e);
48
48
  if (!r?.privileges || r.privileges.length === 0) return !0;
49
49
  if (!b || b.length === 0) return !1;
50
50
  const o = new Set(b.map((a) => a.name));
@@ -52,13 +52,13 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
52
52
  (a) => o.has(a.privilegeName) && a.editable
53
53
  );
54
54
  },
55
- [N, b]
55
+ [O, b]
56
56
  ), f = l(
57
- (e) => !h || e.encounterUuid !== h ? !1 : q(e.formName),
58
- [h, q]
57
+ (e) => !y || e.encounterUuid !== y ? !1 : q(e.formName),
58
+ [y, q]
59
59
  ), w = l(
60
- (e) => N.find((r) => r.name === e)?.uuid,
61
- [N]
60
+ (e) => O.find((r) => r.name === e)?.uuid,
61
+ [O]
62
62
  ), E = d(() => {
63
63
  if (s)
64
64
  return w(s.formName);
@@ -67,7 +67,7 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
67
67
  isLoading: te,
68
68
  isError: se,
69
69
  error: A
70
- } = O({
70
+ } = N({
71
71
  queryKey: ["formMetadata", E],
72
72
  queryFn: () => Ee(E),
73
73
  enabled: !!E && g
@@ -76,7 +76,7 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
76
76
  isLoading: ne,
77
77
  isError: ie,
78
78
  error: _
79
- } = O({
79
+ } = N({
80
80
  queryKey: ["formsEncounterFHIR", s?.encounterUuid],
81
81
  queryFn: () => Ae(s.encounterUuid),
82
82
  enabled: !!s?.encounterUuid && g
@@ -117,19 +117,19 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
117
117
  return K(A).message;
118
118
  if (_)
119
119
  return K(_).message;
120
- }, [A, _]), y = d(
120
+ }, [A, _]), h = d(
121
121
  () => [
122
122
  { key: "recordedOn", header: n("RECORDED_ON") },
123
123
  { key: "recordedBy", header: n("RECORDED_BY") }
124
124
  ],
125
125
  [n]
126
126
  ), H = d(
127
- () => [...y, { key: "actions", header: n("ACTIONS") }],
128
- [y, n]
127
+ () => [...h, { key: "actions", header: n("ACTIONS") }],
128
+ [h, n]
129
129
  ), ce = l(
130
- (e) => I && e.some((r) => f(r)) ? H : y,
131
- [I, f, H, y]
132
- ), fe = y, ye = d(
130
+ (e) => I && e.some((r) => f(r)) ? H : h,
131
+ [I, f, H, h]
132
+ ), fe = h, he = d(
133
133
  () => [
134
134
  { key: "recordedOn", sortable: !0 },
135
135
  { key: "recordedBy", sortable: !0 }
@@ -162,7 +162,7 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
162
162
  ).sort((r, o) => r.formName.localeCompare(o.formName));
163
163
  }, [k, n]), $ = l((e) => {
164
164
  C(e), U(!0);
165
- }, []), z = l(() => {
165
+ }, []), j = l(() => {
166
166
  U(!1), C(null);
167
167
  }, []), S = l((e) => {
168
168
  globalThis.dispatchEvent(
@@ -176,7 +176,7 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
176
176
  }
177
177
  })
178
178
  );
179
- }, []), j = l(
179
+ }, []), z = l(
180
180
  (e, r) => {
181
181
  switch (r) {
182
182
  case "recordedOn":
@@ -201,7 +201,7 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
201
201
  },
202
202
  [$, S, f, n]
203
203
  );
204
- return /* @__PURE__ */ G(he, { children: [
204
+ return /* @__PURE__ */ G(ye, { children: [
205
205
  /* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children: D || M || V.length === 0 || B ? /* @__PURE__ */ i(
206
206
  P,
207
207
  {
@@ -211,7 +211,7 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
211
211
  loading: D,
212
212
  errorStateMessage: M ? oe?.message : void 0,
213
213
  emptyStateMessage: n("FORMS_UNAVAILABLE"),
214
- renderCell: j,
214
+ renderCell: z,
215
215
  className: T.formsTableBody,
216
216
  dataTestId: "forms-table"
217
217
  }
@@ -232,9 +232,9 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
232
232
  rows: a,
233
233
  loading: !1,
234
234
  errorStateMessage: "",
235
- sortable: ye,
235
+ sortable: he,
236
236
  emptyStateMessage: n("FORMS_UNAVAILABLE"),
237
- renderCell: j,
237
+ renderCell: z,
238
238
  className: T.formsTableBody,
239
239
  dataTestId: `forms-table-${o}`
240
240
  }
@@ -249,7 +249,7 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
249
249
  id: "modalIdForActionAreaLayout",
250
250
  portalId: "main-display-area",
251
251
  open: g,
252
- onRequestClose: z,
252
+ onRequestClose: j,
253
253
  modalHeading: /* @__PURE__ */ G("div", { className: T.modalHeading, children: [
254
254
  /* @__PURE__ */ i("span", { children: s.formName }),
255
255
  I && f(s) && /* @__PURE__ */ i(
@@ -260,7 +260,7 @@ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_mo
260
260
  size: "sm",
261
261
  testId: `edit-form-modal-${s.encounterUuid}`,
262
262
  onClick: () => {
263
- z(), S(s);
263
+ j(), S(s);
264
264
  },
265
265
  children: /* @__PURE__ */ i(x, {})
266
266
  }
@@ -1,5 +1,5 @@
1
- import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-BSA4KMKK.js";
2
- import { a0 as d, a1 as f, a2 as e } from "./index-D_2zBN1T.js";
1
+ import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-BXtg8TtV.js";
2
+ import { a0 as d, a1 as f, a2 as e } from "./index-Tm1TzWsm.js";
3
3
  var p = (a) => {
4
4
  const [r, t] = c({
5
5
  prefix: "TanstackQueryDevtools"
@@ -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-BSA4KMKK.js";
2
- import { a0 as v, a1 as C, a2 as e } from "./index-D_2zBN1T.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-BXtg8TtV.js";
2
+ import { a0 as v, a1 as C, a2 as e } from "./index-Tm1TzWsm.js";
3
3
  var h = (t) => {
4
4
  const [r, o] = s({
5
5
  prefix: "TanstackQueryDevtools"
@@ -1,8 +1,8 @@
1
1
  import { jsxs as S, jsx as u } from "react/jsx-runtime";
2
- import { g as Y, K as q, u as N, k as M, l as k, i as x, M as H, m as Q, x as w, o as G, U as j, V as z, q as U, H as P, r as J, I as W, w as X, A as Z, B as ee } from "./index-D_2zBN1T.js";
2
+ import { g as B, K as V, u as N, j as M, k, d as x, x as Q, A as G, _ as j, l as w, U as z, M as H, q as A, n as P, o as J, I as W, r as X, y as Z, z as ee } from "./index-Tm1TzWsm.js";
3
3
  import { useQueries as ae, useQuery as te } from "@tanstack/react-query";
4
4
  import { useRef as se, useEffect as $, useMemo as E } from "react";
5
- const A = (a, n, d, l, b, r) => {
5
+ const D = (a, n, d, l, b, r) => {
6
6
  const t = P(a, n, b), s = t.value, o = J(s);
7
7
  let i = s;
8
8
  o === "Image" && (i = /* @__PURE__ */ u(
@@ -37,13 +37,13 @@ const A = (a, n, d, l, b, r) => {
37
37
  `obs-${a.id}`
38
38
  );
39
39
  }, re = (a, n, d, l, b, r, t) => /* @__PURE__ */ u(
40
- U,
40
+ A,
41
41
  {
42
42
  title: a.display,
43
43
  id: `grouped-obs-${a.display}-${l}`,
44
44
  open: d,
45
45
  children: a.members?.map(
46
- (s, o) => A(
46
+ (s, o) => D(
47
47
  s,
48
48
  o,
49
49
  b,
@@ -60,16 +60,16 @@ const A = (a, n, d, l, b, r) => {
60
60
  hideThumbnail: d
61
61
  }) => {
62
62
  const { t: l } = N(), b = (r, t, s) => {
63
- const o = z(r.encounterDetails, l);
63
+ const o = H(r.encounterDetails, l);
64
64
  return /* @__PURE__ */ S(
65
- U,
65
+ A,
66
66
  {
67
67
  title: o,
68
68
  id: `encounter-${r.encounterId}`,
69
69
  open: t,
70
70
  children: [
71
71
  r.observations.map(
72
- (i, m) => A(
72
+ (i, m) => D(
73
73
  i,
74
74
  m,
75
75
  s,
@@ -113,7 +113,7 @@ const A = (a, n, d, l, b, r) => {
113
113
  conceptNames: d = [],
114
114
  conceptUuid: l = [],
115
115
  hideThumbnail: b = !1
116
- } = n, r = se(/* @__PURE__ */ new Set()), t = Y(), { addNotification: s } = q(), { t: o } = N(), i = ae({
116
+ } = n, r = se(/* @__PURE__ */ new Set()), t = B(), { addNotification: s } = V(), { t: o } = N(), i = ae({
117
117
  queries: d.map((e) => ({
118
118
  queryKey: de(e),
119
119
  queryFn: () => M(e),
@@ -123,10 +123,10 @@ const A = (a, n, d, l, b, r) => {
123
123
  $(() => {
124
124
  i.forEach((e, h) => {
125
125
  if (e.isError && !r.current.has(h)) {
126
- const K = d[h];
126
+ const q = d[h];
127
127
  s({
128
128
  title: o("ERROR_DEFAULT_TITLE"),
129
- message: o("ERROR_FETCHING_CONCEPT", { conceptName: K }),
129
+ message: o("ERROR_FETCHING_CONCEPT", { conceptName: q }),
130
130
  type: "error"
131
131
  }), r.current.add(h);
132
132
  } else e.isError || r.current.delete(h);
@@ -134,7 +134,7 @@ const A = (a, n, d, l, b, r) => {
134
134
  }, [i, d]);
135
135
  const m = E(() => i.map((e) => e.data?.uuid).filter((e) => !!e), [i]), p = E(() => [.../* @__PURE__ */ new Set([...m, ...l])], [m, l]), y = E(() => d.length === 0 ? !0 : i.every((e) => !e.isLoading), [i, d.length]), {
136
136
  data: c,
137
- isLoading: D,
137
+ isLoading: F,
138
138
  isError: g,
139
139
  refetch: T
140
140
  } = te({
@@ -158,13 +158,13 @@ const A = (a, n, d, l, b, r) => {
158
158
  }, [g]);
159
159
  const O = E(() => {
160
160
  if (!c) return [];
161
- const e = H(c), h = Q(e);
162
- return w(h);
163
- }, [c]), F = [
161
+ const e = Q(c), h = G(e);
162
+ return j(h);
163
+ }, [c]), L = [
164
164
  { key: "name", header: "name" },
165
165
  { key: "value", header: "value" },
166
166
  { key: "form", header: "form" }
167
- ], f = D || !y, _ = g && y, L = (!c || c.entry?.length === 0 || p.length === 0) && y, V = _ ? o("ERROR_FETCHING_OBSERVATIONS") : null, B = L ? o("NO_OBSERVATIONS_FOUND") : void 0, C = O.length > 0 && !f && !_, R = n.titleTranslationKey, v = R ? o(R) : "";
167
+ ], _ = F || !y, f = g && y, U = (!c || c.entry?.length === 0 || p.length === 0) && y, C = f ? o("ERROR_FETCHING_OBSERVATIONS") : null, K = U ? o("NO_OBSERVATIONS_FOUND") : void 0, Y = O.length > 0 && !_ && !f, R = n.titleTranslationKey, v = R ? o(R) : "";
168
168
  return /* @__PURE__ */ S(
169
169
  "div",
170
170
  {
@@ -174,7 +174,7 @@ const A = (a, n, d, l, b, r) => {
174
174
  className: I.observations,
175
175
  children: [
176
176
  /* @__PURE__ */ u(
177
- G,
177
+ w,
178
178
  {
179
179
  id: "observations-title",
180
180
  testId: R ? `observations-title-${v}` : "observations-title",
@@ -183,7 +183,7 @@ const A = (a, n, d, l, b, r) => {
183
183
  children: /* @__PURE__ */ u("p", { children: v })
184
184
  }
185
185
  ),
186
- C ? /* @__PURE__ */ u(
186
+ Y ? /* @__PURE__ */ u(
187
187
  oe,
188
188
  {
189
189
  groupedData: O,
@@ -191,14 +191,14 @@ const A = (a, n, d, l, b, r) => {
191
191
  hideThumbnail: b
192
192
  }
193
193
  ) : /* @__PURE__ */ u(
194
- j,
194
+ z,
195
195
  {
196
- headers: F,
196
+ headers: L,
197
197
  rows: [],
198
198
  ariaLabel: o("OBSERVATIONS"),
199
- loading: f,
200
- errorStateMessage: V,
201
- emptyStateMessage: B,
199
+ loading: _,
200
+ errorStateMessage: C,
201
+ emptyStateMessage: K,
202
202
  dataTestId: "observations-table"
203
203
  }
204
204
  )
@@ -1,4 +1,4 @@
1
- import { a3 as we, a4 as z, a5 as xt, a6 as B, a1 as q, a2 as y, a7 as Ro, a8 as ye, a9 as R, aa as _, ab as k, ac as N, ad as A, ae as bs, af as ir, ag as $e, ah as G, ai as Hn, aj as Vn, ak as dt, al as D, am as xs, an as cn, ao as Be, ap as ws, aq as qt, ar as zt, as as $s, at as Cs, au as $n, av as Ss, aw as Nr, ax as Bt, ay as zo, az as ks, aA as Es, aB as j, aC as Gr, aD as Ms, aE as Ds, aF as sr, aG as As, aH as Ts, aI as zn, aJ as Fs, aK as Is, aL as Z, aM as Ps, aN as Ls } from "./index-D_2zBN1T.js";
1
+ import { a3 as we, a4 as z, a5 as xt, a6 as B, a1 as q, a2 as y, a7 as Ro, a8 as ye, a9 as R, aa as _, ab as k, ac as N, ad as A, ae as bs, af as ir, ag as $e, ah as G, ai as Hn, aj as Vn, ak as dt, al as D, am as xs, an as cn, ao as Be, ap as ws, aq as qt, ar as zt, as as $s, at as Cs, au as $n, av as Ss, aw as Nr, ax as Bt, ay as zo, az as ks, aA as Es, aB as j, aC as Gr, aD as Ms, aE as Ds, aF as sr, aG as As, aH as Ts, aI as zn, aJ as Fs, aK as Is, aL as Z, aM as Ps, aN as Ls } from "./index-Tm1TzWsm.js";
2
2
  var Os = (e) => e != null, qs = (e) => e.filter(Os);
3
3
  function _s(e) {
4
4
  return (...t) => {
@@ -1,5 +1,5 @@
1
1
  import { jsxs as Ne, jsx as ne, Fragment as Xi } from "react/jsx-runtime";
2
- import { u as ot, C as Qi, N as Ji, D as ec, E as tc, J as rc, _ as nc, F as oc, L as hi, O as ac, P as lc, K as ic, Q as cc, T as sc, W as fc, Y as pc, X as hc, Z as uc } from "./index-D_2zBN1T.js";
2
+ import { u as ot, B as Qi, N as Ji, C as ec, D as tc, J as rc, E as nc, F as oc, L as hi, P as ac, Q as lc, K as ic, T as cc, V as sc, W as fc, Y as pc, X as hc, Z as uc } from "./index-Tm1TzWsm.js";
3
3
  import * as X from "react";
4
4
  import r, { createContext as at, useContext as $e, Children as q1, useState as pe, useLayoutEffect as V1, useEffect as ie, useMemo as lt, useCallback as Me, useRef as oe, forwardRef as y1, useReducer as dc, cloneElement as G1, isValidElement as wc } from "react";
5
5
  import { useQuery as mc } from "@tanstack/react-query";
@@ -98076,22 +98076,31 @@ function sKe(t, e) {
98076
98076
  const c = dKe(o), { issued: l } = o, i = o.performer?.[0].display ?? "-";
98077
98077
  o?.basedOn?.forEach((s) => {
98078
98078
  const d = s.reference?.split("/").pop();
98079
- d && r.set(d, {
98080
- reportId: a,
98081
- attachments: c,
98082
- reportedDate: l,
98083
- reportedBy: i
98084
- });
98079
+ if (d) {
98080
+ const u = {
98081
+ reportId: a,
98082
+ attachments: c,
98083
+ reportedDate: l,
98084
+ reportedBy: i
98085
+ }, h = r.get(d) ?? [];
98086
+ r.set(d, [...h, u]);
98087
+ }
98085
98088
  });
98086
98089
  }), t.map((o) => {
98087
98090
  const a = r.get(o.id);
98088
- return a ? {
98089
- ...o,
98090
- reportId: a.reportId,
98091
- attachments: a.attachments,
98092
- reportedDate: a.reportedDate,
98093
- reportedBy: a.reportedBy
98094
- } : o;
98091
+ if (a && a.length > 0) {
98092
+ const c = a.map((s) => s.reportId), l = a.flatMap(
98093
+ (s) => s.attachments ?? []
98094
+ ), i = a.at(-1);
98095
+ return {
98096
+ ...o,
98097
+ reportIds: c,
98098
+ attachments: l.length > 0 ? l : void 0,
98099
+ reportedDate: i.reportedDate,
98100
+ reportedBy: i.reportedBy
98101
+ };
98102
+ }
98103
+ return o;
98095
98104
  });
98096
98105
  }
98097
98106
  function dKe(t) {
@@ -98120,7 +98129,7 @@ const Po0 = "RadiologyInvestigationTable-module_inProgressStatus__PKgxl", jo0 =
98120
98129
  reportDetails: ea0,
98121
98130
  reportTile: ta0
98122
98131
  }, ra0 = ({ investigation: t, headers: e, renderCell: r, showLinkedOrders: o, showReport: a }) => {
98123
- const { t: c } = b2(), l = t.status === "completed", i = !!t.reportId;
98132
+ const { t: c } = b2(), l = t.status === "completed", i = !!t.reportIds?.[0];
98124
98133
  if (!o && !a)
98125
98134
  return null;
98126
98135
  const s = (h) => /* @__PURE__ */ ee(
@@ -98158,7 +98167,12 @@ const Po0 = "RadiologyInvestigationTable-module_inProgressStatus__PKgxl", jo0 =
98158
98167
  " ",
98159
98168
  u
98160
98169
  ] }),
98161
- /* @__PURE__ */ u1(lKe, { reportId: t.reportId })
98170
+ /* @__PURE__ */ u1(
98171
+ lKe,
98172
+ {
98173
+ reportId: t.reportIds?.[0]
98174
+ }
98175
+ )
98162
98176
  ] }) }) })
98163
98177
  ] });
98164
98178
  }, na0 = ({
@@ -98368,8 +98382,8 @@ const hKe = (t) => ["radiologyInvestigation", t], fa0 = async (t, e, r, o) => {
98368
98382
  X.imagingStudies
98369
98383
  ), a1 = k.length > 0 && s, e1 = !K;
98370
98384
  let s1 = !1;
98371
- d && !u ? s1 = !!X.reportId && e1 : u || (s1 = !!X.reportId);
98372
- const f1 = X.imagingStudies && X.imagingStudies.length > 0 && X.imagingStudies[0]?.id, V1 = (K ? !!K.reportId : !!X.reportId) && f1;
98385
+ d && !u ? s1 = !!X.reportIds?.[0] && e1 : u || (s1 = !!X.reportIds?.[0]);
98386
+ const f1 = X.imagingStudies && X.imagingStudies.length > 0 && X.imagingStudies[0]?.id, V1 = (K ? !!K.reportIds?.[0] : !!X.reportIds?.[0]) && f1;
98373
98387
  return a1 || s1 || V1 ? /* @__PURE__ */ ee(
98374
98388
  "div",
98375
98389
  {
@@ -98525,7 +98539,7 @@ const hKe = (t) => ["radiologyInvestigation", t], fa0 = async (t, e, r, o) => {
98525
98539
  }
98526
98540
  );
98527
98541
  const Y = m?.reportedDate && a2(m.reportedDate, a, !0).formattedResult, G = V && a2(V, a, !0).formattedResult, q = m?.reportedBy, n1 = (X) => {
98528
- const K = X.linkedOrders && X.linkedOrders.length > 0, k = X.status === "completed", a1 = !!X.reportId, e1 = d && K, s1 = u && k && a1;
98542
+ const K = X.linkedOrders && X.linkedOrders.length > 0, k = X.status === "completed", a1 = !!X.reportIds?.[0], e1 = d && K, s1 = u && k && a1;
98529
98543
  return !e1 && !s1 ? null : /* @__PURE__ */ u1(
98530
98544
  ra0,
98531
98545
  {
@@ -98595,7 +98609,7 @@ const hKe = (t) => ["radiologyInvestigation", t], fa0 = async (t, e, r, o) => {
98595
98609
  k
98596
98610
  );
98597
98611
  }) }),
98598
- m && w === "report" && /* @__PURE__ */ u1(
98612
+ m?.reportIds?.[0] && w === "report" && /* @__PURE__ */ u1(
98599
98613
  pt,
98600
98614
  {
98601
98615
  open: !!m,
@@ -98612,7 +98626,7 @@ const hKe = (t) => ["radiologyInvestigation", t], fa0 = async (t, e, r, o) => {
98612
98626
  children: /* @__PURE__ */ u1(pt.Body, { children: /* @__PURE__ */ u1(
98613
98627
  lKe,
98614
98628
  {
98615
- reportId: m.reportId
98629
+ reportId: m.reportIds[0]
98616
98630
  }
98617
98631
  ) })
98618
98632
  }
@@ -98804,21 +98818,21 @@ function Fa0(t, e) {
98804
98818
  const qa0 = ({
98805
98819
  test: t,
98806
98820
  isOpen: e,
98807
- hasProcessedReport: r,
98808
- reportId: o
98821
+ hasProcessedReport: r
98809
98822
  }) => {
98810
- const { t: a } = b2(), [c, l] = b1(!1), {
98823
+ const { t: o } = b2(), [a, c] = b1(!1), l = t.reportIds ?? [], {
98811
98824
  data: i,
98812
98825
  isLoading: s,
98813
98826
  isError: d
98814
98827
  } = u0({
98815
- queryKey: ["diagnosticReportBundle", o],
98816
- queryFn: () => GUe(o),
98817
- enabled: e && r && !!o
98818
- }), u = te(() => {
98819
- if (i)
98820
- return Fa0(i, a);
98821
- }, [i, a]), h = Array.isArray(u) && u.length > 0, f = te(() => !h || !u ? [] : u.map((p, g) => ({
98828
+ queryKey: ["diagnosticReportBundles", l],
98829
+ queryFn: async () => await Promise.all(
98830
+ l.map((p) => GUe(p))
98831
+ ),
98832
+ enabled: e && r && l.length > 0
98833
+ }), u = te(() => !i || i.length === 0 ? void 0 : i.flatMap(
98834
+ (p) => Fa0(p, o) ?? []
98835
+ ), [i, o]), h = Array.isArray(u) && u.length > 0, f = te(() => !h || !u ? [] : u.map((p, g) => ({
98822
98836
  id: `${t.id}-${g}`,
98823
98837
  testName: p.TestName,
98824
98838
  value: p.value,
@@ -98829,12 +98843,12 @@ const qa0 = ({
98829
98843
  interpretation: p.interpretation
98830
98844
  })), [h, u, t.id]), m = te(
98831
98845
  () => [
98832
- { key: "testName", header: a("LAB_TEST_NAME") },
98833
- { key: "result", header: a("LAB_TEST_RESULT") },
98834
- { key: "referenceRange", header: a("LAB_TEST_REFERENCE_RANGE") },
98835
- { key: "reportedOn", header: a("LAB_TEST_REPORTED_ON") }
98846
+ { key: "testName", header: o("LAB_TEST_NAME") },
98847
+ { key: "result", header: o("LAB_TEST_RESULT") },
98848
+ { key: "referenceRange", header: o("LAB_TEST_REFERENCE_RANGE") },
98849
+ { key: "reportedOn", header: o("LAB_TEST_REPORTED_ON") }
98836
98850
  ],
98837
- [a]
98851
+ [o]
98838
98852
  ), M = (p, g) => {
98839
98853
  const C = p.interpretation === "A";
98840
98854
  switch (g) {
@@ -98861,22 +98875,22 @@ const qa0 = ({
98861
98875
  headers: m,
98862
98876
  rows: f,
98863
98877
  loading: s,
98864
- errorStateMessage: d ? a("LAB_TEST_ERROR_LOADING") : void 0,
98878
+ errorStateMessage: d ? o("LAB_TEST_ERROR_LOADING") : void 0,
98865
98879
  ariaLabel: `${t.testName} results`,
98866
98880
  dataTestId: `lab-test-results-table-${t.testName}`,
98867
98881
  renderCell: M,
98868
98882
  className: w0.labTestResultsTable
98869
98883
  }
98870
- ) : /* @__PURE__ */ u1("div", { className: w0.testResultsPending, children: a("LAB_TEST_RESULTS_PENDING") + " ...." }) : null, E = t.attachments && t.attachments.length > 0, V = t.attachments && a("LAB_TEST_VIEW_ATTACHMENT", { count: t.attachments.length });
98884
+ ) : /* @__PURE__ */ u1("div", { className: w0.testResultsPending, children: o("LAB_TEST_RESULTS_PENDING") + " ...." }) : null, E = t.attachments && t.attachments.length > 0, V = t.attachments && o("LAB_TEST_VIEW_ATTACHMENT", { count: t.attachments.length });
98871
98885
  return /* @__PURE__ */ ee("div", { className: w0.labTest, children: [
98872
98886
  /* @__PURE__ */ ee("div", { className: w0.labTestHeader, children: [
98873
98887
  /* @__PURE__ */ ee("div", { className: w0.labTestInfo, children: [
98874
98888
  /* @__PURE__ */ u1("span", { children: t.testName }),
98875
- t.testType === "Panel" && /* @__PURE__ */ u1("span", { className: w0.testDetails, children: a(`LAB_TEST_${t.testType.toUpperCase()}`) }),
98889
+ t.testType === "Panel" && /* @__PURE__ */ u1("span", { className: w0.testDetails, children: o(`LAB_TEST_${t.testType.toUpperCase()}`) }),
98876
98890
  E && /* @__PURE__ */ u1(
98877
98891
  Bc,
98878
98892
  {
98879
- onClick: () => l(!0),
98893
+ onClick: () => c(!0),
98880
98894
  className: w0.viewAttachmentsLink,
98881
98895
  children: V
98882
98896
  }
@@ -98889,20 +98903,20 @@ const qa0 = ({
98889
98903
  ariaLabel: t.note
98890
98904
  }
98891
98905
  ),
98892
- t.priority === Uc.stat && /* @__PURE__ */ u1(H3, { type: "red", "data-testid": `lab-test-priority-${t.priority}`, children: a(`LAB_TEST_${t.priority.toUpperCase()}`) })
98906
+ t.priority === Uc.stat && /* @__PURE__ */ u1(H3, { type: "red", "data-testid": `lab-test-priority-${t.priority}`, children: o(`LAB_TEST_${t.priority.toUpperCase()}`) })
98893
98907
  ] }),
98894
98908
  /* @__PURE__ */ ee("span", { className: w0.testDetails, children: [
98895
- a("LAB_TEST_ORDERED_BY"),
98909
+ o("LAB_TEST_ORDERED_BY"),
98896
98910
  ": ",
98897
98911
  t.orderedBy
98898
98912
  ] })
98899
98913
  ] }),
98900
98914
  w(),
98901
- E && c && /* @__PURE__ */ u1(
98915
+ E && a && /* @__PURE__ */ u1(
98902
98916
  pt,
98903
98917
  {
98904
- open: c,
98905
- onRequestClose: () => l(!1),
98918
+ open: a,
98919
+ onRequestClose: () => c(!1),
98906
98920
  passiveModal: !0,
98907
98921
  modalHeading: V,
98908
98922
  testId: "attachments-modal",
@@ -99045,8 +99059,7 @@ const qa0 = ({
99045
99059
  {
99046
99060
  test: o1,
99047
99061
  isOpen: s.has(t1),
99048
- hasProcessedReport: !!o1.reportId,
99049
- reportId: o1.reportId
99062
+ hasProcessedReport: !!o1.reportIds && o1.reportIds.length > 0
99050
99063
  },
99051
99064
  o1.id ?? `${J.date}-${o1.testName}`
99052
99065
  ))
@@ -106819,7 +106832,7 @@ $s0();
106819
106832
  const Ds0 = [];
106820
106833
  for (let t = 0; t < 256; ++t)
106821
106834
  Ds0.push((t + 256).toString(16).slice(1));
106822
- F0(() => Promise.resolve().then(() => t30)), F0(() => Promise.resolve().then(() => A30)), F0(() => Promise.resolve().then(() => l40)), F0(() => Promise.resolve().then(() => f40)), F0(() => import("./DocumentsTable-ClhCu3Gn-D4UYKIjC.js")), F0(() => Promise.resolve().then(() => pc0)), F0(() => import("./FormsTable-B1Jf7c-q-Ba0js1N-.js")), F0(() => Promise.resolve().then(() => Ka0)), F0(() => import("./Observations-BU2hE5R4-D_9DwuCD.js")), F0(
106835
+ F0(() => Promise.resolve().then(() => t30)), F0(() => Promise.resolve().then(() => A30)), F0(() => Promise.resolve().then(() => l40)), F0(() => Promise.resolve().then(() => f40)), F0(() => import("./DocumentsTable-gaNpd5Oz-DGu1GHiv.js")), F0(() => Promise.resolve().then(() => pc0)), F0(() => import("./FormsTable-D4dXAIbr-dCkjOP7W.js")), F0(() => Promise.resolve().then(() => Ka0)), F0(() => import("./Observations-DA1z7g3V-CUyhn00q.js")), F0(
106823
106836
  () => Promise.resolve().then(() => Jc0)
106824
106837
  ), F0(
106825
106838
  () => Promise.resolve().then(() => wa0)
@@ -188863,7 +188876,7 @@ var lvt = (t, e = !1) => {
188863
188876
  const e = W32(() => {
188864
188877
  const r = this, [o] = this.#n, [a] = this.#o, [c] = this.#a, [l] = this.#c, [i] = this.#p, [s] = this.#t;
188865
188878
  let d;
188866
- return this.#l ? d = this.#l : (d = q32(() => import("./LNWAZHJI-BsV9z0e3.js")), this.#l = d), h42(this.#h, this.#r), j32(d, F32({
188879
+ return this.#l ? d = this.#l : (d = q32(() => import("./LNWAZHJI-CQpzE-D9.js")), this.#l = d), h42(this.#h, this.#r), j32(d, F32({
188867
188880
  get queryFlavor() {
188868
188881
  return r.#d;
188869
188882
  },
@@ -188961,7 +188974,7 @@ var lvt = (t, e = !1) => {
188961
188974
  const e = W32(() => {
188962
188975
  const r = this, [o] = this.#n, [a] = this.#o, [c] = this.#a, [l] = this.#c, [i] = this.#p, [s] = this.#t, [d] = this.#l;
188963
188976
  let u;
188964
- return this.#i ? u = this.#i : (u = q32(() => import("./MWZ6AO7Z-BkW6dEEa.js")), this.#i = u), h42(this.#h, this.#r), j32(u, F32({
188977
+ return this.#i ? u = this.#i : (u = q32(() => import("./MWZ6AO7Z-CTzUrMm7.js")), this.#i = u), h42(this.#h, this.#r), j32(u, F32({
188965
188978
  get queryFlavor() {
188966
188979
  return r.#d;
188967
188980
  },
@@ -189091,7 +189104,7 @@ const nwt = {
189091
189104
  }
189092
189105
  }
189093
189106
  }, owt = "home", hvt = "/bahmni/home/index.html#/login", pvt = "/bahmni/home/index.html#/changePassword", fvt = 6, awt = F0(
189094
- () => import("./index-Djg0dKbg.js").then((t) => ({
189107
+ () => import("./index-CBuTZ-Dc.js").then((t) => ({
189095
189108
  default: t.HomePage
189096
189109
  }))
189097
189110
  ), cwt = [
@@ -189122,34 +189135,34 @@ function mvt() {
189122
189135
  }
189123
189136
  export {
189124
189137
  ei as $,
189125
- fB2 as A,
189126
- cB2 as B,
189127
- Dgt as C,
189128
- HV as D,
189129
- Ogt as E,
189138
+ Gwt as A,
189139
+ Dgt as B,
189140
+ HV as C,
189141
+ Ogt as D,
189142
+ Tgt as E,
189130
189143
  fvt as F,
189131
189144
  cE as G,
189132
- Wwt as H,
189145
+ qwt as H,
189133
189146
  LZ2 as I,
189134
189147
  pi as J,
189135
189148
  Br as K,
189136
189149
  Rgt as L,
189137
- Kwt as M,
189150
+ Uwt as M,
189138
189151
  ZY0 as N,
189139
- Sgt as O,
189140
- Rn0 as P,
189141
- pvt as Q,
189152
+ Qwt as O,
189153
+ Sgt as P,
189154
+ Rn0 as Q,
189142
189155
  aKe as R,
189143
189156
  Ql as S,
189144
- _gt as T,
189157
+ pvt as T,
189145
189158
  Y0 as U,
189146
- Uwt as V,
189159
+ _gt as V,
189147
189160
  hvt as W,
189148
189161
  Cft as X,
189149
189162
  D8 as Y,
189150
189163
  egt as Z,
189151
- Tgt as _,
189152
- a2 as a,
189164
+ Ywt as _,
189165
+ Bc as a,
189153
189166
  uvt as a0,
189154
189167
  A0 as a1,
189155
189168
  j32 as a2,
@@ -189201,29 +189214,29 @@ export {
189201
189214
  k0 as ax,
189202
189215
  O32 as ay,
189203
189216
  Bgt as az,
189204
- ci as b,
189205
- Bwt as c,
189206
- Iwt as d,
189217
+ a2 as b,
189218
+ ci as c,
189219
+ Ir as d,
189207
189220
  HK2 as e,
189208
- Pwt as f,
189221
+ Iwt as f,
189209
189222
  Dt as g,
189210
189223
  SK2 as h,
189211
- Ir as i,
189212
- n7 as j,
189213
- Zwt as k,
189214
- kwt as l,
189215
- Gwt as m,
189216
- Bc as n,
189217
- nv as o,
189224
+ n7 as i,
189225
+ Zwt as j,
189226
+ kwt as k,
189227
+ nv as l,
189228
+ Bwt as m,
189229
+ Wwt as n,
189230
+ LM1 as o,
189218
189231
  pt as p,
189219
189232
  gwt as q,
189220
- LM1 as r,
189233
+ rB2 as r,
189221
189234
  mt as s,
189222
189235
  mw as t,
189223
189236
  b2 as u,
189224
189237
  tE as v,
189225
- rB2 as w,
189226
- Ywt as x,
189227
- qwt as y,
189228
- Qwt as z
189238
+ Pwt as w,
189239
+ Kwt as x,
189240
+ fB2 as y,
189241
+ cB2 as z
189229
189242
  };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { aO as a } from "./index-D_2zBN1T.js";
1
+ import { aO as a } from "./index-Tm1TzWsm.js";
2
2
  export {
3
3
  a as HomeApp
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bahmni/home-app",
3
- "version": "0.0.1-dev.363",
3
+ "version": "0.0.1-dev.366",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",