@bahmni/home-app 0.0.1-dev.372 → 0.0.1-dev.373

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
- import { jsx as r, jsxs as p, Fragment as Q } from "react/jsx-runtime";
2
- import { g as W, u as x, G as Y, H as J, w as X, a as Z, W as ee, p as te } from "./index-BnfcTU4t.js";
1
+ import { jsx as r, jsxs as p, Fragment as K } from "react/jsx-runtime";
2
+ import { g as Q, u as W, G as Y, x as J, a as X, b as Z, W as ee, p as te } from "./index-CptkFVlT.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 = {
@@ -38,9 +38,9 @@ const Te = [
38
38
  null
39
39
  ), [$, O] = l(
40
40
  /* @__PURE__ */ new Set()
41
- ), E = W(), { t: n } = x(), { addNotification: L } = Y(), k = Number(a?.pageSize) || 5, [f, C] = l(1), [u, H] = l(k), [V, A] = l(void 0), M = h((e) => {
41
+ ), E = Q(), { t: n } = W(), { addNotification: L } = Y(), 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));
@@ -91,13 +91,13 @@ const Te = [
91
91
  }, [s, o]);
92
92
  const j = h(
93
93
  (e, t) => {
94
- t !== u ? (H(t), C(1), A(void 0)) : C(e);
94
+ t !== u ? (V(t), C(1), A(void 0)) : C(e);
95
95
  },
96
96
  [u]
97
97
  ), N = _(
98
98
  () => a?.fields ?? Te,
99
99
  [a?.fields]
100
- ), G = _(() => [...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 = _(
100
+ ), x = _(() => [...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]), G = _(() => ie(N, n), [N, n]), P = _(
101
101
  () => N.map((e) => ({
102
102
  key: e,
103
103
  sortable: e !== "attachments"
@@ -106,7 +106,7 @@ const Te = [
106
106
  ), T = _(
107
107
  () => o ? B(o) : [],
108
108
  [o]
109
- ), K = h(
109
+ ), z = h(
110
110
  (e, t) => {
111
111
  switch (t) {
112
112
  case "documentIdentifier":
@@ -137,22 +137,22 @@ const Te = [
137
137
  },
138
138
  [M, n]
139
139
  );
140
- return /* @__PURE__ */ p(Q, { children: [
140
+ return /* @__PURE__ */ p(K, { children: [
141
141
  /* @__PURE__ */ r("div", { "data-testid": "documents-table", children: /* @__PURE__ */ r(
142
142
  ee,
143
143
  {
144
- headers: P,
144
+ headers: G,
145
145
  ariaLabel: n("DOCUMENTS_TABLE_HEADING"),
146
- rows: G,
146
+ rows: x,
147
147
  loading: q,
148
148
  errorStateMessage: y ? b?.message : null,
149
- sortable: z,
149
+ sortable: P,
150
150
  emptyStateMessage: n("DOCUMENTS_NO_RECORDS"),
151
- renderCell: K,
151
+ renderCell: z,
152
152
  className: d.documentsTableBody,
153
153
  dataTestId: "documents-table",
154
154
  pageSize: u,
155
- totalItems: V,
155
+ totalItems: F,
156
156
  page: f,
157
157
  onPageChange: j
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,48 +1,48 @@
1
- import { jsx as i, jsxs as x, Fragment as ge } from "react/jsx-runtime";
2
- import { u as ye, g as be, V as pe, X as Ne, b as Oe, c as Ie, h as Te, y as Ee, e as Ae, f as _e, D as ve, N as Fe, s as z, a as Se, d as K, r as G, w as Ce, W as P, $ as Re, I as Be, p as De, Y as Le, k as Ue } from "./index-BnfcTU4t.js";
3
- import { useQueryClient as Me, useQuery as O } from "@tanstack/react-query";
4
- import { useState as Q, useMemo as d, useCallback as l } from "react";
5
- const ke = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_modalHeading__wnTmA", qe = "FormsTable-module_customAccordianItem__isszs", I = {
1
+ import { jsx as i, jsxs as j, Fragment as he } from "react/jsx-runtime";
2
+ import { u as be, g as ye, H as pe, Q as Ne, f as Oe, c as Te, d as Ie, M as Ee, t as Ae, m as _e, S as ve, T as Se, s as z, b as Fe, e as K, n as Q, a as Ce, W as Y, I as Re, k as Be, p as Le, J as Me, P as Ue } from "./index-CptkFVlT.js";
3
+ import { useQueryClient as De, useQuery as O } from "@tanstack/react-query";
4
+ import { useState as G, useMemo as d, useCallback as l } from "react";
5
+ const ke = "FormsTable-module_formsTableBody__SvGha", qe = "FormsTable-module_modalHeading__wnTmA", He = "FormsTable-module_customAccordianItem__isszs", T = {
6
6
  formsTableBody: ke,
7
- modalHeading: we,
8
- customAccordianItem: qe
9
- }, Ve = "startConsultation", xe = ({
7
+ modalHeading: qe,
8
+ customAccordianItem: He
9
+ }, we = "startConsultation", je = ({
10
10
  episodeOfCareUuids: C,
11
11
  encounterUuids: u,
12
- config: X,
12
+ config: J,
13
13
  disableActions: W = !1,
14
- activeEncounterUuid: g = null
14
+ activeEncounterUuid: h = null
15
15
  }) => {
16
- const { t: n } = ye(), c = be(), [y, R] = Q(!1), [s, B] = Q(null), {
17
- numberOfVisits: Z,
18
- hideThumbnail: J = !1,
19
- forms: b
20
- } = X ?? {}, ee = pe(
16
+ const { t: n } = be(), c = ye(), [b, R] = G(!1), [s, B] = G(null), {
17
+ numberOfVisits: X,
18
+ hideThumbnail: Z = !1,
19
+ forms: y
20
+ } = J ?? {}, ee = pe(
21
21
  Ue.EDIT_OBSERVATIONS
22
- ), { userPrivileges: p } = Ne(), T = ee && !W && !!g, D = Oe(
22
+ ), { userPrivileges: p } = Ne(), I = ee && !W && !!h, L = Oe(
23
23
  C,
24
24
  u
25
- ), re = Me(), {
26
- data: L = [],
25
+ ), re = De(), {
26
+ data: M = [],
27
27
  isLoading: U,
28
- isError: M,
28
+ isError: D,
29
29
  error: oe,
30
30
  refetch: ae
31
31
  } = O({
32
32
  queryKey: ["forms", c, C],
33
- queryFn: () => Ie(c, void 0, Z),
34
- enabled: !!c && !D
33
+ queryFn: () => Te(c, void 0, X),
34
+ enabled: !!c && !L
35
35
  }), k = d(() => {
36
- let e = L;
36
+ let e = M;
37
37
  return u && u.length > 0 && (e = e.filter(
38
38
  (r) => u.includes(r.encounterUuid)
39
- )), Array.isArray(b) && b.length > 0 && (e = e.filter(
40
- (r) => b.some((o) => o.toLowerCase() === r.formName.toLowerCase())
39
+ )), Array.isArray(y) && y.length > 0 && (e = e.filter(
40
+ (r) => y.some((o) => o.toLowerCase() === r.formName.toLowerCase())
41
41
  )), e;
42
- }, [L, u, b]), { data: N = [] } = O({
42
+ }, [M, u, y]), { data: N = [] } = O({
43
43
  queryKey: ["observationForms"],
44
- queryFn: () => Te()
45
- }), w = l(
44
+ queryFn: () => Ie()
45
+ }), q = l(
46
46
  (e) => {
47
47
  const r = N.find((a) => a.name === e);
48
48
  if (!r?.privileges || r.privileges.length === 0) return !0;
@@ -54,15 +54,15 @@ const ke = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_mo
54
54
  },
55
55
  [N, p]
56
56
  ), f = l(
57
- (e) => !g || e.encounterUuid !== g ? !1 : w(e.formName),
58
- [g, w]
59
- ), q = l(
57
+ (e) => !h || e.encounterUuid !== h ? !1 : q(e.formName),
58
+ [h, q]
59
+ ), H = l(
60
60
  (e) => N.find((r) => r.name === e)?.uuid,
61
61
  [N]
62
62
  ), E = d(() => {
63
63
  if (s)
64
- return q(s.formName);
65
- }, [s, q]), {
64
+ return H(s.formName);
65
+ }, [s, H]), {
66
66
  data: m,
67
67
  isLoading: te,
68
68
  isError: se,
@@ -70,7 +70,7 @@ const ke = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_mo
70
70
  } = O({
71
71
  queryKey: ["formMetadata", E],
72
72
  queryFn: () => Ee(E),
73
- enabled: !!E && y
73
+ enabled: !!E && b
74
74
  }), {
75
75
  data: _,
76
76
  isLoading: ne,
@@ -79,7 +79,7 @@ const ke = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_mo
79
79
  } = O({
80
80
  queryKey: ["formsEncounterFHIR", s?.encounterUuid],
81
81
  queryFn: () => Ae(s.encounterUuid),
82
- enabled: !!s?.encounterUuid && y
82
+ enabled: !!s?.encounterUuid && b
83
83
  });
84
84
  _e(
85
85
  (e) => {
@@ -87,7 +87,7 @@ const ke = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_mo
87
87
  },
88
88
  [c]
89
89
  );
90
- const de = d(() => !_?.entry || !s?.formName ? [] : _.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => ve(e) ? Fe(e)?.toLowerCase() === s.formName.toLowerCase() : !0), [_, s?.formName]), le = d(() => {
90
+ const de = d(() => !_?.entry || !s?.formName ? [] : _.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => ve(e) ? Se(e)?.toLowerCase() === s.formName.toLowerCase() : !0), [_, s?.formName]), le = d(() => {
91
91
  if (!m?.schema) return;
92
92
  const e = [], r = (o) => {
93
93
  (o ?? []).forEach((a) => {
@@ -103,8 +103,8 @@ const ke = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_mo
103
103
  const e = {}, r = (o, a) => {
104
104
  for (const t of o)
105
105
  if (t.type === "section") {
106
- const S = t.label?.value ?? "Section";
107
- r(t.controls ?? [], S);
106
+ const F = t.label?.value ?? "Section";
107
+ r(t.controls ?? [], F);
108
108
  } else
109
109
  t.id != null && a && (e[String(t.id)] = a), t.controls && r(t.controls, a);
110
110
  };
@@ -117,34 +117,34 @@ const ke = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_mo
117
117
  return z(A).message;
118
118
  if (v)
119
119
  return z(v).message;
120
- }, [A, v]), h = d(
120
+ }, [A, v]), g = 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
- ), V = d(
127
- () => [...h, { key: "actions", header: n("ACTIONS") }],
128
- [h, n]
126
+ ), w = d(
127
+ () => [...g, { key: "actions", header: n("ACTIONS") }],
128
+ [g, n]
129
129
  ), ce = l(
130
- (e) => T && e.some((r) => f(r)) ? V : h,
131
- [T, f, V, h]
132
- ), fe = h, he = d(
130
+ (e) => I && e.some((r) => f(r)) ? w : g,
131
+ [I, f, w, g]
132
+ ), fe = g, ge = d(
133
133
  () => [
134
134
  { key: "recordedOn", sortable: !0 },
135
135
  { key: "recordedBy", sortable: !0 }
136
136
  ],
137
137
  []
138
- ), H = d(() => {
138
+ ), V = d(() => {
139
139
  const e = k.reduce(
140
140
  (r, o) => {
141
141
  const a = o.formName;
142
142
  r[a] ??= [];
143
- const t = o.providers.map((S) => S.providerName).filter(Boolean).join(", ");
143
+ const t = o.providers.map((F) => F.providerName).filter(Boolean).join(", ");
144
144
  return r[a].push({
145
145
  id: o.encounterUuid,
146
146
  formName: o.formName,
147
- recordedOn: Se(o.encounterDateTime, n, !0).formattedResult,
147
+ recordedOn: Fe(o.encounterDateTime, n, !0).formattedResult,
148
148
  recordedBy: t ?? "--",
149
149
  encounterDateTime: o.encounterDateTime,
150
150
  encounterUuid: o.encounterUuid
@@ -162,11 +162,11 @@ const ke = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_mo
162
162
  ).sort((r, o) => r.formName.localeCompare(o.formName));
163
163
  }, [k, n]), $ = l((e) => {
164
164
  B(e), R(!0);
165
- }, []), Y = l(() => {
165
+ }, []), x = l(() => {
166
166
  R(!1), B(null);
167
- }, []), F = l((e) => {
167
+ }, []), S = l((e) => {
168
168
  globalThis.dispatchEvent(
169
- new CustomEvent(Ve, {
169
+ new CustomEvent(we, {
170
170
  detail: {
171
171
  editOnly: "observationForms",
172
172
  editTitle: "EDIT_OBSERVATION_FORM_TITLE",
@@ -176,7 +176,7 @@ const ke = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_mo
176
176
  }
177
177
  })
178
178
  );
179
- }, []), j = l(
179
+ }, []), P = l(
180
180
  (e, r) => {
181
181
  switch (r) {
182
182
  case "recordedOn":
@@ -191,51 +191,51 @@ const ke = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_mo
191
191
  kind: "ghost",
192
192
  size: "sm",
193
193
  testId: `edit-form-${e.encounterUuid}`,
194
- onClick: () => F(e),
195
- children: /* @__PURE__ */ i(G, {})
194
+ onClick: () => S(e),
195
+ children: /* @__PURE__ */ i(Q, {})
196
196
  }
197
197
  ) : null;
198
198
  default:
199
199
  return null;
200
200
  }
201
201
  },
202
- [$, F, f, n]
202
+ [$, S, f, n]
203
203
  );
204
- return /* @__PURE__ */ x(ge, { children: [
205
- /* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children: U || M || H.length === 0 || D ? /* @__PURE__ */ i(
206
- P,
204
+ return /* @__PURE__ */ j(he, { children: [
205
+ /* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children: U || D || V.length === 0 || L ? /* @__PURE__ */ i(
206
+ Y,
207
207
  {
208
208
  headers: fe,
209
209
  ariaLabel: n("FORMS_HEADING"),
210
210
  rows: [],
211
211
  loading: U,
212
- errorStateMessage: M ? oe?.message : void 0,
212
+ errorStateMessage: D ? oe?.message : void 0,
213
213
  emptyStateMessage: n("FORMS_UNAVAILABLE"),
214
- renderCell: j,
215
- className: I.formsTableBody,
214
+ renderCell: P,
215
+ className: T.formsTableBody,
216
216
  dataTestId: "forms-table"
217
217
  }
218
- ) : /* @__PURE__ */ i(Re, { align: "start", children: H.map((e, r) => {
218
+ ) : /* @__PURE__ */ i(Re, { align: "start", children: V.map((e, r) => {
219
219
  const { formName: o, records: a } = e, t = ce(a);
220
220
  return /* @__PURE__ */ i(
221
221
  Be,
222
222
  {
223
223
  title: o,
224
- className: I.customAccordianItem,
224
+ className: T.customAccordianItem,
225
225
  testId: `accordian-title-${o}`,
226
226
  open: r === 0,
227
227
  children: /* @__PURE__ */ i(
228
- P,
228
+ Y,
229
229
  {
230
230
  headers: t,
231
231
  ariaLabel: n("FORMS_HEADING"),
232
232
  rows: a,
233
233
  loading: !1,
234
234
  errorStateMessage: "",
235
- sortable: he,
235
+ sortable: ge,
236
236
  emptyStateMessage: n("FORMS_UNAVAILABLE"),
237
- renderCell: j,
238
- className: I.formsTableBody,
237
+ renderCell: P,
238
+ className: T.formsTableBody,
239
239
  dataTestId: `forms-table-${o}`
240
240
  }
241
241
  )
@@ -243,16 +243,16 @@ const ke = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_mo
243
243
  o
244
244
  );
245
245
  }) }) }),
246
- y && s && /* @__PURE__ */ i(
247
- De,
246
+ b && s && /* @__PURE__ */ i(
247
+ Le,
248
248
  {
249
249
  id: "modalIdForActionAreaLayout",
250
250
  portalId: "main-display-area",
251
- open: y,
252
- onRequestClose: Y,
253
- modalHeading: /* @__PURE__ */ x("div", { className: I.modalHeading, children: [
251
+ open: b,
252
+ onRequestClose: x,
253
+ modalHeading: /* @__PURE__ */ j("div", { className: T.modalHeading, children: [
254
254
  /* @__PURE__ */ i("span", { children: s.formName }),
255
- T && f(s) && /* @__PURE__ */ i(
255
+ I && f(s) && /* @__PURE__ */ i(
256
256
  K,
257
257
  {
258
258
  label: n("EDIT_OBSERVATION_FORM"),
@@ -260,9 +260,9 @@ const ke = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_mo
260
260
  size: "sm",
261
261
  testId: `edit-form-modal-${s.encounterUuid}`,
262
262
  onClick: () => {
263
- Y(), F(s);
263
+ x(), S(s);
264
264
  },
265
- children: /* @__PURE__ */ i(G, {})
265
+ children: /* @__PURE__ */ i(Q, {})
266
266
  }
267
267
  )
268
268
  ] }),
@@ -271,7 +271,7 @@ const ke = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_mo
271
271
  size: "md",
272
272
  testId: "form-details-modal",
273
273
  children: /* @__PURE__ */ i(
274
- Le,
274
+ Me,
275
275
  {
276
276
  observations: de,
277
277
  isLoading: te || ne,
@@ -279,7 +279,7 @@ const ke = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_mo
279
279
  errorMessage: ue,
280
280
  emptyStateMessage: n("NO_FORM_DATA_AVAILABLE"),
281
281
  testIdPrefix: s.formName,
282
- hideThumbnail: J,
282
+ hideThumbnail: Z,
283
283
  controlOrder: le,
284
284
  sectionMap: me
285
285
  }
@@ -289,5 +289,5 @@ const ke = "FormsTable-module_formsTableBody__SvGha", we = "FormsTable-module_mo
289
289
  ] });
290
290
  };
291
291
  export {
292
- xe as default
292
+ je as default
293
293
  };
@@ -1,5 +1,5 @@
1
- import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-CmiBNAsn.js";
2
- import { a0 as d, a1 as f, a2 as e } from "./index-BnfcTU4t.js";
1
+ import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-DNGYQwaN.js";
2
+ import { a0 as d, a1 as f, a2 as e } from "./index-CptkFVlT.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-CmiBNAsn.js";
2
- import { a0 as v, a1 as C, a2 as e } from "./index-BnfcTU4t.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-DNGYQwaN.js";
2
+ import { a0 as v, a1 as C, a2 as e } from "./index-CptkFVlT.js";
3
3
  var h = (t) => {
4
4
  const [r, o] = s({
5
5
  prefix: "TanstackQueryDevtools"