@bahmni/home-app 0.0.1-dev.423 → 0.0.1-dev.425

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,5 +1,5 @@
1
1
  import { jsx as r, jsxs as p, Fragment as Y } from "react/jsx-runtime";
2
- import { v as x, u as G, z as W, E as J, q as X, w as Z, Y as ee, p as te } from "./index-0gCl6Ezv.js";
2
+ import { g as x, u as G, z as W, U as J, K as X, w as Z, Y as ee, p as te } from "./index-ExXHC3NK.js";
3
3
  import { useQuery as ae } from "@tanstack/react-query";
4
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 = {
@@ -21,10 +21,10 @@ const ne = "DocumentsTable-module_documentsTableBody__6iR3w", oe = "DocumentsTab
21
21
  function R(a) {
22
22
  return !a || a.includes(":") ? "#" : `/openmrs/auth?requested_document=/document_images/${a}`;
23
23
  }
24
- function ie(a, E) {
24
+ function ie(a, g) {
25
25
  return a.map((s) => ({
26
26
  key: s,
27
- header: E(ue[s])
27
+ header: g(ue[s])
28
28
  }));
29
29
  }
30
30
  const Te = [
@@ -33,29 +33,29 @@ 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 }] : [], Ne = ({ config: a, encounterUuids: E }) => {
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
37
  const [s, w] = l(!1), [o, U] = l(
38
38
  null
39
39
  ), [$, O] = l(
40
40
  /* @__PURE__ */ new Set()
41
- ), g = x(), { t: n } = G(), { addNotification: L } = W(), k = Number(a?.pageSize) || 5, [f, C] = l(1), [u, V] = l(k), [q, A] = l(void 0), M = h((e) => {
41
+ ), E = x(), { t: n } = G(), { 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
42
  U(e), w(!0);
43
- }, []), F = h(() => {
43
+ }, []), H = h(() => {
44
44
  w(!1), U(null), O(/* @__PURE__ */ new Set());
45
45
  }, []), v = h((e) => {
46
46
  O((t) => new Set(t).add(e));
47
- }, []), { data: i, isLoading: H, isError: y, error: b } = ae({
47
+ }, []), { data: i, isLoading: q, isError: y, error: b } = ae({
48
48
  queryKey: [
49
49
  "documents",
50
- g,
51
50
  E,
51
+ g,
52
52
  f,
53
53
  u
54
54
  ],
55
- enabled: !!g,
55
+ enabled: !!E,
56
56
  queryFn: () => J(
57
- g,
58
57
  E,
58
+ g,
59
59
  u,
60
60
  f
61
61
  )
@@ -64,7 +64,7 @@ const Te = [
64
64
  i && A(i.total);
65
65
  }, [i]), I(() => {
66
66
  C(1), A(void 0);
67
- }, [g]), I(() => {
67
+ }, [E]), I(() => {
68
68
  y && L({
69
69
  title: n("ERROR_DEFAULT_TITLE"),
70
70
  message: b?.message ?? "",
@@ -97,7 +97,7 @@ const Te = [
97
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(N, n), [N, n]), K = _(
100
+ ), K = _(() => [...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]), j = _(() => ie(N, n), [N, n]), P = _(
101
101
  () => N.map((e) => ({
102
102
  key: e,
103
103
  sortable: e !== "attachments"
@@ -141,18 +141,18 @@ const Te = [
141
141
  /* @__PURE__ */ r("div", { "data-testid": "documents-table", children: /* @__PURE__ */ r(
142
142
  ee,
143
143
  {
144
- headers: P,
144
+ headers: j,
145
145
  ariaLabel: n("DOCUMENTS_TABLE_HEADING"),
146
- rows: j,
147
- loading: H,
146
+ rows: K,
147
+ loading: q,
148
148
  errorStateMessage: y ? b?.message : null,
149
- sortable: K,
149
+ sortable: P,
150
150
  emptyStateMessage: n("DOCUMENTS_NO_RECORDS"),
151
151
  renderCell: Q,
152
152
  className: d.documentsTableBody,
153
153
  dataTestId: "documents-table",
154
154
  pageSize: u,
155
- totalItems: q,
155
+ totalItems: F,
156
156
  page: f,
157
157
  onPageChange: z
158
158
  }
@@ -163,7 +163,7 @@ const Te = [
163
163
  id: "modalIdForActionAreaLayout",
164
164
  portalId: "main-display-area",
165
165
  open: s,
166
- onRequestClose: F,
166
+ onRequestClose: H,
167
167
  modalHeading: o.documentIdentifier,
168
168
  passiveModal: !0,
169
169
  size: "lg",
@@ -1,78 +1,78 @@
1
- import { jsx as n, jsxs as P, Fragment as he } from "react/jsx-runtime";
2
- import { u as ge, v as Ne, i as Te, e as Oe, a as be, b as Ie, J as Ae, N as Ee, c as _e, m as ve, d as Fe, V as Me, y as Se, S as K, w as Be, A as j, f as x, q as Re, Y as z, P as Ce, F as Le, p as Ue, h as De, g as qe } from "./index-0gCl6Ezv.js";
1
+ import { jsx as n, jsxs as K, Fragment as ge } from "react/jsx-runtime";
2
+ import { u as he, g as Oe, h as Te, Z as Ne, y as be, j as Ie, e as Ee, O as Ae, a as _e, m as Fe, f as ve, $ as Me, S as Ce, b as x, w as Se, C as G, H as z, K as Be, Y as P, F as De, c as Le, p as Ue, v as Re, l as ke } from "./index-ExXHC3NK.js";
3
3
  import { useQueryClient as we, useQuery as T } from "@tanstack/react-query";
4
4
  import { useState as Q, useMemo as i, useCallback as d } from "react";
5
- const Ve = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_modalHeading__wnTmA", He = "FormsTable-module_customAccordianItem__isszs", O = {
6
- formsTableBody: Ve,
7
- modalHeading: ke,
8
- customAccordianItem: He
9
- }, $e = "startConsultation", xe = ({
10
- episodeOfCareUuids: F,
5
+ const qe = "FormsTable-module_formsTableBody__SvGha", He = "FormsTable-module_modalHeading__wnTmA", Ve = "FormsTable-module_customAccordianItem__isszs", N = {
6
+ formsTableBody: qe,
7
+ modalHeading: He,
8
+ customAccordianItem: Ve
9
+ }, $e = "startConsultation", ze = ({
10
+ episodeOfCareUuids: v,
11
11
  encounterUuids: l,
12
12
  config: Y,
13
- disableActions: J = !1,
13
+ disableActions: Z = !1,
14
14
  activeEncounterUuid: y = null
15
15
  }) => {
16
- const { t } = ge(), m = Ne(), [p, M] = Q(!1), [o, S] = Q(null), {
17
- numberOfVisits: Z,
18
- hideThumbnail: X = !1,
19
- forms: h
16
+ const { t } = he(), m = Oe(), [p, M] = Q(!1), [o, C] = Q(null), {
17
+ numberOfVisits: X,
18
+ hideThumbnail: J = !1,
19
+ forms: g
20
20
  } = Y ?? {}, W = Te(
21
- qe.EDIT_OBSERVATIONS
22
- ), { userPrivileges: g } = Oe(), b = W && !J && !!y, B = be(
23
- F,
21
+ ke.EDIT_OBSERVATIONS
22
+ ), { userPrivileges: h } = Ne(), b = W && !Z && !!y, S = be(
23
+ v,
24
24
  l
25
25
  ), ee = we(), {
26
- data: R = [],
27
- isLoading: C,
26
+ data: B = [],
27
+ isLoading: D,
28
28
  isError: L,
29
29
  error: re,
30
30
  refetch: ae
31
31
  } = T({
32
- queryKey: ["forms", m, F],
33
- queryFn: () => Ie(m, void 0, Z),
34
- enabled: !!m && !B
32
+ queryKey: ["forms", m, v],
33
+ queryFn: () => Ie(m, void 0, X),
34
+ enabled: !!m && !S
35
35
  }), U = i(() => {
36
- let e = R;
36
+ let e = B;
37
37
  return l && l.length > 0 && (e = e.filter(
38
38
  (r) => l.includes(r.encounterUuid)
39
- )), Array.isArray(h) && h.length > 0 && (e = e.filter(
40
- (r) => h.some((a) => a.toLowerCase() === r.formName.toLowerCase())
39
+ )), Array.isArray(g) && g.length > 0 && (e = e.filter(
40
+ (r) => g.some((a) => a.toLowerCase() === r.formName.toLowerCase())
41
41
  )), e;
42
- }, [R, l, h]), { data: N = [] } = T({
42
+ }, [B, l, g]), { data: O = [] } = T({
43
43
  queryKey: ["observationForms"],
44
- queryFn: () => Ae()
45
- }), D = d(
44
+ queryFn: () => Ee()
45
+ }), R = d(
46
46
  (e) => {
47
- const r = N.find((s) => s.name === e);
47
+ const r = O.find((s) => s.name === e);
48
48
  if (!r?.privileges || r.privileges.length === 0) return !0;
49
- if (!g || g.length === 0) return !1;
50
- const a = new Set(g.map((s) => s.name));
49
+ if (!h || h.length === 0) return !1;
50
+ const a = new Set(h.map((s) => s.name));
51
51
  return r.privileges.some(
52
52
  (s) => a.has(s.privilegeName) && s.editable
53
53
  );
54
54
  },
55
- [N, g]
55
+ [O, h]
56
56
  ), u = d(
57
- (e) => !y || e.encounterUuid !== y ? !1 : D(e.formName),
58
- [y, D]
59
- ), q = d(
60
- (e) => N.find((r) => r.name === e)?.uuid,
61
- [N]
57
+ (e) => !y || e.encounterUuid !== y ? !1 : R(e.formName),
58
+ [y, R]
59
+ ), k = d(
60
+ (e) => O.find((r) => r.name === e)?.uuid,
61
+ [O]
62
62
  ), I = i(() => {
63
63
  if (o)
64
- return q(o.formName);
65
- }, [o, q]), {
64
+ return k(o.formName);
65
+ }, [o, k]), {
66
66
  data: w,
67
67
  isLoading: oe,
68
68
  isError: te,
69
- error: A
69
+ error: E
70
70
  } = T({
71
71
  queryKey: ["formMetadata", I],
72
- queryFn: () => Ee(I),
72
+ queryFn: () => Ae(I),
73
73
  enabled: !!I && p
74
74
  }), {
75
- data: E,
75
+ data: A,
76
76
  isLoading: se,
77
77
  isError: ne,
78
78
  error: _
@@ -81,39 +81,39 @@ const Ve = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
81
81
  queryFn: () => _e(o.encounterUuid),
82
82
  enabled: !!o?.encounterUuid && p
83
83
  });
84
- ve(
84
+ Fe(
85
85
  (e) => {
86
86
  e.patientUUID === m && (ae(), ee.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
87
87
  },
88
88
  [m]
89
89
  );
90
- const ie = i(() => !E?.entry || !o?.formName ? [] : E.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => Fe(e) ? Me(e)?.toLowerCase() === o.formName.toLowerCase() : !0), [E, o?.formName]), { controlOrder: de, sectionMap: le, conceptDatatypeMap: me } = i(
91
- () => Se(w?.schema),
90
+ const ie = i(() => !A?.entry || !o?.formName ? [] : A.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => ve(e) ? Me(e)?.toLowerCase() === o.formName.toLowerCase() : !0), [A, o?.formName]), { controlOrder: de, sectionMap: le, conceptDatatypeMap: me } = i(
91
+ () => Ce(w?.schema),
92
92
  [w]
93
93
  ), ue = i(() => {
94
- if (A)
95
- return K(A).message;
94
+ if (E)
95
+ return x(E).message;
96
96
  if (_)
97
- return K(_).message;
98
- }, [A, _]), c = i(
97
+ return x(_).message;
98
+ }, [E, _]), c = i(
99
99
  () => [
100
100
  { key: "recordedOn", header: t("RECORDED_ON") },
101
101
  { key: "recordedBy", header: t("RECORDED_BY") }
102
102
  ],
103
103
  [t]
104
- ), V = i(
104
+ ), q = i(
105
105
  () => [...c, { key: "actions", header: t("ACTIONS") }],
106
106
  [c, t]
107
107
  ), ce = d(
108
- (e) => b && e.some((r) => u(r)) ? V : c,
109
- [b, u, V, c]
108
+ (e) => b && e.some((r) => u(r)) ? q : c,
109
+ [b, u, q, c]
110
110
  ), fe = c, ye = i(
111
111
  () => [
112
112
  { key: "recordedOn", sortable: !0 },
113
113
  { key: "recordedBy", sortable: !0 }
114
114
  ],
115
115
  []
116
- ), k = i(() => {
116
+ ), H = i(() => {
117
117
  const e = U.reduce(
118
118
  (r, a) => {
119
119
  const s = a.formName;
@@ -122,7 +122,7 @@ const Ve = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
122
122
  return r[s].push({
123
123
  id: a.encounterUuid,
124
124
  formName: a.formName,
125
- recordedOn: Be(a.encounterDateTime, t, !0).formattedResult,
125
+ recordedOn: Se(a.encounterDateTime, t, !0).formattedResult,
126
126
  recordedBy: f ?? "--",
127
127
  encounterDateTime: a.encounterDateTime,
128
128
  encounterUuid: a.encounterUuid
@@ -138,11 +138,11 @@ const Ve = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
138
138
  )
139
139
  })
140
140
  ).sort((r, a) => r.formName.localeCompare(a.formName));
141
- }, [U, t]), H = d((e) => {
142
- S(e), M(!0);
141
+ }, [U, t]), V = d((e) => {
142
+ C(e), M(!0);
143
143
  }, []), $ = d(() => {
144
- M(!1), S(null);
145
- }, []), v = d((e) => {
144
+ M(!1), C(null);
145
+ }, []), F = d((e) => {
146
146
  globalThis.dispatchEvent(
147
147
  new CustomEvent($e, {
148
148
  detail: {
@@ -154,56 +154,56 @@ const Ve = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
154
154
  }
155
155
  })
156
156
  );
157
- }, []), G = d(
157
+ }, []), j = d(
158
158
  (e, r) => {
159
159
  switch (r) {
160
160
  case "recordedOn":
161
- return /* @__PURE__ */ n(Re, { onClick: () => H(e), children: e.recordedOn });
161
+ return /* @__PURE__ */ n(Be, { onClick: () => V(e), children: e.recordedOn });
162
162
  case "recordedBy":
163
163
  return e.recordedBy;
164
164
  case "actions":
165
165
  return u(e) ? /* @__PURE__ */ n(
166
- j,
166
+ G,
167
167
  {
168
168
  label: t("EDIT_OBSERVATION_FORM"),
169
169
  kind: "ghost",
170
170
  size: "sm",
171
171
  testId: `edit-form-${e.encounterUuid}`,
172
- onClick: () => v(e),
173
- children: /* @__PURE__ */ n(x, {})
172
+ onClick: () => F(e),
173
+ children: /* @__PURE__ */ n(z, {})
174
174
  }
175
175
  ) : null;
176
176
  default:
177
177
  return null;
178
178
  }
179
179
  },
180
- [H, v, u, t]
180
+ [V, F, u, t]
181
181
  );
182
- return /* @__PURE__ */ P(he, { children: [
183
- /* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: C || L || k.length === 0 || B ? /* @__PURE__ */ n(
184
- z,
182
+ return /* @__PURE__ */ K(ge, { children: [
183
+ /* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: D || L || H.length === 0 || S ? /* @__PURE__ */ n(
184
+ P,
185
185
  {
186
186
  headers: fe,
187
187
  ariaLabel: t("FORMS_HEADING"),
188
188
  rows: [],
189
- loading: C,
189
+ loading: D,
190
190
  errorStateMessage: L ? re?.message : void 0,
191
191
  emptyStateMessage: t("FORMS_UNAVAILABLE"),
192
- renderCell: G,
193
- className: O.formsTableBody,
192
+ renderCell: j,
193
+ className: N.formsTableBody,
194
194
  dataTestId: "forms-table"
195
195
  }
196
- ) : /* @__PURE__ */ n(Ce, { align: "start", children: k.map((e, r) => {
196
+ ) : /* @__PURE__ */ n(De, { align: "start", children: H.map((e, r) => {
197
197
  const { formName: a, records: s } = e, f = ce(s);
198
198
  return /* @__PURE__ */ n(
199
199
  Le,
200
200
  {
201
201
  title: a,
202
- className: O.customAccordianItem,
202
+ className: N.customAccordianItem,
203
203
  testId: `accordian-title-${a}`,
204
204
  open: r === 0,
205
205
  children: /* @__PURE__ */ n(
206
- z,
206
+ P,
207
207
  {
208
208
  headers: f,
209
209
  ariaLabel: t("FORMS_HEADING"),
@@ -212,8 +212,8 @@ const Ve = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
212
212
  errorStateMessage: "",
213
213
  sortable: ye,
214
214
  emptyStateMessage: t("FORMS_UNAVAILABLE"),
215
- renderCell: G,
216
- className: O.formsTableBody,
215
+ renderCell: j,
216
+ className: N.formsTableBody,
217
217
  dataTestId: `forms-table-${a}`
218
218
  }
219
219
  )
@@ -228,19 +228,19 @@ const Ve = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
228
228
  portalId: "main-display-area",
229
229
  open: p,
230
230
  onRequestClose: $,
231
- modalHeading: /* @__PURE__ */ P("div", { className: O.modalHeading, children: [
231
+ modalHeading: /* @__PURE__ */ K("div", { className: N.modalHeading, children: [
232
232
  /* @__PURE__ */ n("span", { children: o.formName }),
233
233
  b && u(o) && /* @__PURE__ */ n(
234
- j,
234
+ G,
235
235
  {
236
236
  label: t("EDIT_OBSERVATION_FORM"),
237
237
  kind: "ghost",
238
238
  size: "sm",
239
239
  testId: `edit-form-modal-${o.encounterUuid}`,
240
240
  onClick: () => {
241
- $(), v(o);
241
+ $(), F(o);
242
242
  },
243
- children: /* @__PURE__ */ n(x, {})
243
+ children: /* @__PURE__ */ n(z, {})
244
244
  }
245
245
  )
246
246
  ] }),
@@ -249,7 +249,7 @@ const Ve = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
249
249
  size: "md",
250
250
  testId: "form-details-modal",
251
251
  children: /* @__PURE__ */ n(
252
- De,
252
+ Re,
253
253
  {
254
254
  observations: ie,
255
255
  isLoading: oe || se,
@@ -257,7 +257,7 @@ const Ve = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
257
257
  errorMessage: ue,
258
258
  emptyStateMessage: t("NO_FORM_DATA_AVAILABLE"),
259
259
  testIdPrefix: o.formName,
260
- hideThumbnail: X,
260
+ hideThumbnail: J,
261
261
  controlOrder: de,
262
262
  sectionMap: le,
263
263
  conceptDatatypeMap: me
@@ -268,5 +268,5 @@ const Ve = "FormsTable-module_formsTableBody__SvGha", ke = "FormsTable-module_mo
268
268
  ] });
269
269
  };
270
270
  export {
271
- xe as default
271
+ ze as default
272
272
  };
@@ -1,5 +1,5 @@
1
- import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-CYiHJeWi.js";
2
- import { $ as d, a0 as f, a1 as e } from "./index-0gCl6Ezv.js";
1
+ import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-CN-mULjB.js";
2
+ import { I as d, L as f, M as e } from "./index-ExXHC3NK.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-CYiHJeWi.js";
2
- import { $ as v, a0 as C, a1 as e } from "./index-0gCl6Ezv.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-CN-mULjB.js";
2
+ import { I as v, L as C, M as e } from "./index-ExXHC3NK.js";
3
3
  var h = (t) => {
4
4
  const [r, o] = s({
5
5
  prefix: "TanstackQueryDevtools"