@bahmni/home-app 0.0.1-dev.375 → 0.0.1-dev.377

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