@bahmni/registration-app 0.0.1-dev.151 → 0.0.1-dev.152

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,30 +1,30 @@
1
- import { jsx as t, jsxs as p, Fragment as W } from "react/jsx-runtime";
2
- import { u as J, H as Q, w as X, K as Z, U as ee, W as re, q as ae, i as oe, C as te, A as G, Y as ne, G as se, a as me, b as de, V as U, g as ie, c as v } from "./index-D9OpcJ-A.js";
3
- import { useQuery as h } from "@tanstack/react-query";
4
- import { useState as x, useMemo as N, useCallback as y } from "react";
5
- const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue = "_formContent_1pd36_18", pe = "_formDetailsContainer_1pd36_25", be = "_observation_1pd36_30", _e = "_groupContainer_1pd36_39", fe = "_rowContainer_1pd36_43", Ne = "_groupLabel_1pd36_48", $e = "_rowLabel_1pd36_58", ge = "_rowValue_1pd36_67", he = "_groupMembers_1pd36_75", ye = "_memberRow_1pd36_81", ve = "_memberLabel_1pd36_86", Ae = "_memberValue_1pd36_94", Me = "_abnormalValue_1pd36_102", Te = "_commentSection_1pd36_110", Ce = "_commentText_1pd36_116", Le = "_nestedGroup_1pd36_125", De = "_nestedGroupLabel_1pd36_132", Oe = "_nestedGroupMembers_1pd36_141", o = {
6
- formsTableBody: le,
7
- customAccordianItem: ce,
8
- formContent: ue,
9
- formDetailsContainer: pe,
10
- observation: be,
11
- groupContainer: _e,
12
- rowContainer: fe,
13
- groupLabel: Ne,
14
- rowLabel: $e,
15
- rowValue: ge,
16
- groupMembers: he,
17
- memberRow: ye,
18
- memberLabel: ve,
19
- memberValue: Ae,
20
- abnormalValue: Me,
21
- commentSection: Te,
22
- commentText: Ce,
23
- nestedGroup: Le,
24
- nestedGroupLabel: De,
25
- nestedGroupMembers: Oe
26
- }, Re = "ABNORMAL", q = (e) => {
27
- const s = e.concept?.units, d = e.concept?.lowNormal, r = e.concept?.hiNormal, u = d != null, m = r != null, c = u && m ? ` (${d} - ${r})` : u ? ` (>${d})` : m ? ` (<${r})` : "", a = e.interpretation && e.interpretation.toUpperCase() === Re;
1
+ import { jsx as n, jsxs as p, Fragment as J } from "react/jsx-runtime";
2
+ import { u as X, h as Z, w as ee, K as re, U as ae, W as oe, q as te, e as ne, i as se, C as me, A as U, Y as de, G as ie, a as le, b as ce, V as x, g as ue, c as y } from "./index-B6DRKpTQ.js";
3
+ import { useQueryClient as pe, useQuery as g } from "@tanstack/react-query";
4
+ import { useState as q, useMemo as N, useCallback as h } from "react";
5
+ const be = "_formsTableBody_1pd36_1", _e = "_customAccordianItem_1pd36_6", fe = "_formContent_1pd36_18", Ne = "_formDetailsContainer_1pd36_25", $e = "_observation_1pd36_30", ge = "_groupContainer_1pd36_39", he = "_rowContainer_1pd36_43", ye = "_groupLabel_1pd36_48", ve = "_rowLabel_1pd36_58", Ae = "_rowValue_1pd36_67", Ce = "_groupMembers_1pd36_75", Me = "_memberRow_1pd36_81", Te = "_memberLabel_1pd36_86", Le = "_memberValue_1pd36_94", De = "_abnormalValue_1pd36_102", Oe = "_commentSection_1pd36_110", Re = "_commentText_1pd36_116", Fe = "_nestedGroup_1pd36_125", we = "_nestedGroupLabel_1pd36_132", Ie = "_nestedGroupMembers_1pd36_141", o = {
6
+ formsTableBody: be,
7
+ customAccordianItem: _e,
8
+ formContent: fe,
9
+ formDetailsContainer: Ne,
10
+ observation: $e,
11
+ groupContainer: ge,
12
+ rowContainer: he,
13
+ groupLabel: ye,
14
+ rowLabel: ve,
15
+ rowValue: Ae,
16
+ groupMembers: Ce,
17
+ memberRow: Me,
18
+ memberLabel: Te,
19
+ memberValue: Le,
20
+ abnormalValue: De,
21
+ commentSection: Oe,
22
+ commentText: Re,
23
+ nestedGroup: Fe,
24
+ nestedGroupLabel: we,
25
+ nestedGroupMembers: Ie
26
+ }, Ve = "ABNORMAL", K = (e) => {
27
+ const s = e.concept?.units, d = e.concept?.lowNormal, r = e.concept?.hiNormal, u = d != null, m = r != null, c = u && m ? ` (${d} - ${r})` : u ? ` (>${d})` : m ? ` (<${r})` : "", a = e.interpretation && e.interpretation.toUpperCase() === Ve;
28
28
  return { units: s, rangeString: c, isAbnormal: a };
29
29
  }, k = ({
30
30
  member: e,
@@ -40,7 +40,7 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
40
40
  className: o.nestedGroup,
41
41
  "data-testid": `${c}obs-nested-group-${m}-${d}`,
42
42
  children: [
43
- /* @__PURE__ */ t(
43
+ /* @__PURE__ */ n(
44
44
  "div",
45
45
  {
46
46
  className: o.nestedGroupLabel,
@@ -49,17 +49,17 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
49
49
  children: m
50
50
  }
51
51
  ),
52
- /* @__PURE__ */ t(
52
+ /* @__PURE__ */ n(
53
53
  "div",
54
54
  {
55
55
  className: o.nestedGroupMembers,
56
56
  "data-testid": `${c}obs-nested-group-members-${m}-${d}`,
57
- children: e.groupMembers?.map(($, g) => /* @__PURE__ */ t(
57
+ children: e.groupMembers?.map(($, v) => /* @__PURE__ */ n(
58
58
  k,
59
59
  {
60
60
  member: $,
61
61
  depth: s + 1,
62
- memberIndex: g,
62
+ memberIndex: v,
63
63
  formName: r
64
64
  },
65
65
  `${$.concept.uuid}`
@@ -69,7 +69,7 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
69
69
  ]
70
70
  }
71
71
  );
72
- const { units: a, rangeString: b, isAbnormal: _ } = q(e);
72
+ const { units: a, rangeString: b, isAbnormal: _ } = K(e);
73
73
  return /* @__PURE__ */ p(
74
74
  "div",
75
75
  {
@@ -80,7 +80,7 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
80
80
  /* @__PURE__ */ p(
81
81
  "p",
82
82
  {
83
- className: v(
83
+ className: y(
84
84
  o.memberLabel,
85
85
  _ ? o.abnormalValue : ""
86
86
  ),
@@ -94,7 +94,7 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
94
94
  /* @__PURE__ */ p(
95
95
  "p",
96
96
  {
97
- className: v(
97
+ className: y(
98
98
  o.memberValue,
99
99
  _ ? o.abnormalValue : ""
100
100
  ),
@@ -108,12 +108,12 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
108
108
  ]
109
109
  }
110
110
  );
111
- }, Fe = ({
111
+ }, Ee = ({
112
112
  observation: e,
113
113
  index: s,
114
114
  formName: d = ""
115
115
  }) => {
116
- const r = e.groupMembers && e.groupMembers.length > 0, { units: u, rangeString: m, isAbnormal: c } = q(e), a = d ? `${d}-` : "";
116
+ const r = e.groupMembers && e.groupMembers.length > 0, { units: u, rangeString: m, isAbnormal: c } = K(e), a = d ? `${d}-` : "";
117
117
  return /* @__PURE__ */ p(
118
118
  "div",
119
119
  {
@@ -129,23 +129,23 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
129
129
  /* @__PURE__ */ p(
130
130
  "p",
131
131
  {
132
- className: v(
132
+ className: y(
133
133
  r ? o.groupLabel : o.rowLabel,
134
134
  !r && c ? o.abnormalValue : ""
135
135
  ),
136
136
  "data-testid": `${a}observation-label-${e.conceptNameToDisplay}-${s}`,
137
137
  children: [
138
138
  e.conceptNameToDisplay,
139
- !r && m && /* @__PURE__ */ t("span", { className: o.rangeInfo, children: m })
139
+ !r && m && /* @__PURE__ */ n("span", { className: o.rangeInfo, children: m })
140
140
  ]
141
141
  }
142
142
  ),
143
- r ? /* @__PURE__ */ t(
143
+ r ? /* @__PURE__ */ n(
144
144
  "div",
145
145
  {
146
146
  className: o.groupMembers,
147
147
  "data-testid": `${a}observation-group-members-${e.conceptNameToDisplay}-${s}`,
148
- children: e.groupMembers?.map((b, _) => /* @__PURE__ */ t(
148
+ children: e.groupMembers?.map((b, _) => /* @__PURE__ */ n(
149
149
  k,
150
150
  {
151
151
  member: b,
@@ -159,7 +159,7 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
159
159
  ) : /* @__PURE__ */ p(
160
160
  "p",
161
161
  {
162
- className: v(
162
+ className: y(
163
163
  o.rowValue,
164
164
  c ? o.abnormalValue : ""
165
165
  ),
@@ -173,7 +173,7 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
173
173
  ]
174
174
  }
175
175
  ),
176
- e.comment && /* @__PURE__ */ t(
176
+ e.comment && /* @__PURE__ */ n(
177
177
  "div",
178
178
  {
179
179
  className: o.commentSection,
@@ -188,74 +188,82 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
188
188
  },
189
189
  `${e.concept.uuid}-${s}`
190
190
  );
191
- }, Be = ({
191
+ }, qe = ({
192
192
  episodeOfCareUuids: e,
193
193
  encounterUuids: s,
194
194
  config: d
195
195
  }) => {
196
- const { t: r } = J(), u = Q(), [m, c] = x(!1), [a, b] = x(null), _ = d?.numberOfVisits, $ = X(
196
+ const { t: r } = X(), u = Z(), [m, c] = q(!1), [a, b] = q(null), _ = d?.numberOfVisits, $ = ee(
197
197
  e,
198
198
  s
199
- ), {
200
- data: g = [],
201
- isLoading: C,
202
- isError: L,
203
- error: H
204
- } = h({
199
+ ), v = pe(), {
200
+ data: A = [],
201
+ isLoading: L,
202
+ isError: D,
203
+ error: j,
204
+ refetch: H
205
+ } = g({
205
206
  queryKey: ["forms", u, e],
206
- queryFn: () => Z(u, void 0, _),
207
+ queryFn: () => re(u, void 0, _),
207
208
  enabled: !!u && !$
208
- }), D = N(() => !s || s.length === 0 ? g : g.filter(
209
- (n) => s.includes(n.encounterUuid)
210
- ), [g, s]), { data: O = [] } = h({
209
+ }), O = N(() => !s || s.length === 0 ? A : A.filter(
210
+ (t) => s.includes(t.encounterUuid)
211
+ ), [A, s]), { data: R = [] } = g({
211
212
  queryKey: ["observationForms"],
212
- queryFn: () => ee()
213
- }), R = y(
214
- (n) => O.find((l) => l.name === n)?.uuid,
215
- [O]
216
- ), A = N(() => {
213
+ queryFn: () => ae()
214
+ }), F = h(
215
+ (t) => R.find((l) => l.name === t)?.uuid,
216
+ [R]
217
+ ), C = N(() => {
217
218
  if (a)
218
- return R(a.formName);
219
- }, [a, R]), {
220
- data: we,
221
- isLoading: K,
222
- error: F
223
- } = h({
224
- queryKey: ["formMetadata", A],
225
- queryFn: () => re(A),
226
- enabled: !!A && m
219
+ return F(a.formName);
220
+ }, [a, F]), {
221
+ data: Se,
222
+ isLoading: P,
223
+ error: w
224
+ } = g({
225
+ queryKey: ["formMetadata", C],
226
+ queryFn: () => oe(C),
227
+ enabled: !!C && m
227
228
  }), {
228
229
  data: M,
229
- isLoading: j,
230
- error: w
231
- } = h({
230
+ isLoading: Q,
231
+ error: I
232
+ } = g({
232
233
  queryKey: ["formsEncounter", a?.encounterUuid],
233
- queryFn: () => ae(a.encounterUuid, !0),
234
+ queryFn: () => te(a.encounterUuid, !0),
234
235
  enabled: !!a?.encounterUuid && m
235
- }), I = N(() => !M?.observations || !a?.formName ? [] : M.observations.filter(
236
- (n) => "formFieldPath" in n && typeof n.formFieldPath == "string" && n.formFieldPath.includes(a.formName)
237
- ), [M?.observations, a?.formName]), V = N(
236
+ });
237
+ ne(
238
+ (t) => {
239
+ t.patientUUID === u && t.updatedConcepts.size > 0 && (H(), v.invalidateQueries({ queryKey: ["formsEncounter"] }));
240
+ },
241
+ [u]
242
+ );
243
+ const V = N(() => !M?.observations || !a?.formName ? [] : M.observations.filter(
244
+ (t) => "formFieldPath" in t && typeof t.formFieldPath == "string" && t.formFieldPath.includes(a.formName)
245
+ ), [M?.observations, a?.formName]), E = N(
238
246
  () => [
239
247
  { key: "recordedOn", header: r("FORM_RECORDED_ON") },
240
248
  { key: "recordedBy", header: r("FORM_RECORDED_BY") }
241
249
  ],
242
250
  [r]
243
- ), P = N(
251
+ ), Y = N(
244
252
  () => [
245
253
  { key: "recordedOn", sortable: !0 },
246
254
  { key: "recordedBy", sortable: !0 }
247
255
  ],
248
256
  []
249
- ), E = N(() => {
250
- const n = D.reduce(
257
+ ), S = N(() => {
258
+ const t = O.reduce(
251
259
  (l, i) => {
252
260
  const f = i.formName;
253
261
  l[f] ??= [];
254
- const T = i.providers.map((z) => z.providerName).filter(Boolean).join(", ");
262
+ const T = i.providers.map((W) => W.providerName).filter(Boolean).join(", ");
255
263
  return l[f].push({
256
264
  id: i.encounterUuid,
257
265
  formName: i.formName,
258
- recordedOn: oe(i.encounterDateTime, r, ie).formattedResult,
266
+ recordedOn: se(i.encounterDateTime, r, ue).formattedResult,
259
267
  recordedBy: T ?? "--",
260
268
  encounterDateTime: i.encounterDateTime,
261
269
  encounterUuid: i.encounterUuid
@@ -263,7 +271,7 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
263
271
  },
264
272
  {}
265
273
  );
266
- return Object.entries(n).map(
274
+ return Object.entries(t).map(
267
275
  ([l, i]) => ({
268
276
  formName: l,
269
277
  records: i.sort(
@@ -271,57 +279,57 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
271
279
  )
272
280
  })
273
281
  ).sort((l, i) => l.formName.localeCompare(i.formName));
274
- }, [D, r]), S = y((n) => {
275
- b(n), c(!0);
276
- }, []), Y = y(() => {
282
+ }, [O, r]), B = h((t) => {
283
+ b(t), c(!0);
284
+ }, []), z = h(() => {
277
285
  c(!1), b(null);
278
- }, []), B = y(
279
- (n, l) => {
286
+ }, []), G = h(
287
+ (t, l) => {
280
288
  switch (l) {
281
289
  case "recordedOn":
282
- return /* @__PURE__ */ t(te, { onClick: () => S(n), children: n.recordedOn });
290
+ return /* @__PURE__ */ n(me, { onClick: () => B(t), children: t.recordedOn });
283
291
  case "recordedBy":
284
- return n.recordedBy;
292
+ return t.recordedBy;
285
293
  default:
286
294
  return null;
287
295
  }
288
296
  },
289
- [S]
297
+ [B]
290
298
  );
291
- return /* @__PURE__ */ p(W, { children: [
292
- /* @__PURE__ */ t("div", { "data-testid": "forms-table", children: C || L || E.length === 0 || $ ? /* @__PURE__ */ t(
293
- G,
299
+ return /* @__PURE__ */ p(J, { children: [
300
+ /* @__PURE__ */ n("div", { "data-testid": "forms-table", children: L || D || S.length === 0 || $ ? /* @__PURE__ */ n(
301
+ U,
294
302
  {
295
- headers: V,
303
+ headers: E,
296
304
  ariaLabel: r("FORMS_HEADING"),
297
305
  rows: [],
298
- loading: C,
299
- errorStateMessage: L ? H?.message : void 0,
306
+ loading: L,
307
+ errorStateMessage: D ? j?.message : void 0,
300
308
  emptyStateMessage: r("FORMS_UNAVAILABLE"),
301
- renderCell: B,
309
+ renderCell: G,
302
310
  className: o.formsTableBody,
303
311
  dataTestId: "forms-table"
304
312
  }
305
- ) : /* @__PURE__ */ t(ne, { align: "start", children: E.map((n, l) => {
306
- const { formName: i, records: f } = n;
307
- return /* @__PURE__ */ t(
308
- se,
313
+ ) : /* @__PURE__ */ n(de, { align: "start", children: S.map((t, l) => {
314
+ const { formName: i, records: f } = t;
315
+ return /* @__PURE__ */ n(
316
+ ie,
309
317
  {
310
318
  title: i,
311
319
  className: o.customAccordianItem,
312
320
  testId: `accordian-title-${i}`,
313
321
  open: l === 0,
314
- children: /* @__PURE__ */ t(
315
- G,
322
+ children: /* @__PURE__ */ n(
323
+ U,
316
324
  {
317
- headers: V,
325
+ headers: E,
318
326
  ariaLabel: r("FORMS_HEADING"),
319
327
  rows: f,
320
328
  loading: !1,
321
329
  errorStateMessage: "",
322
- sortable: P,
330
+ sortable: Y,
323
331
  emptyStateMessage: r("FORMS_UNAVAILABLE"),
324
- renderCell: B,
332
+ renderCell: G,
325
333
  className: o.formsTableBody,
326
334
  dataTestId: `forms-table-${i}`
327
335
  }
@@ -330,30 +338,30 @@ const le = "_formsTableBody_1pd36_1", ce = "_customAccordianItem_1pd36_6", ue =
330
338
  i
331
339
  );
332
340
  }) }) }),
333
- m && a && /* @__PURE__ */ t(
334
- me,
341
+ m && a && /* @__PURE__ */ n(
342
+ le,
335
343
  {
336
344
  id: "modalIdForActionAreaLayout",
337
345
  open: m,
338
- onRequestClose: Y,
346
+ onRequestClose: z,
339
347
  modalHeading: a.formName,
340
348
  modalLabel: `${a.recordedOn} | ${a.recordedBy}`,
341
349
  passiveModal: !0,
342
350
  size: "md",
343
351
  testId: "form-details-modal",
344
- children: /* @__PURE__ */ t("div", { className: o.formContent, children: K || j ? /* @__PURE__ */ t(de, { width: "100%", lineCount: 3 }) : F ? /* @__PURE__ */ t("div", { children: U(F).message ?? r("ERROR_FETCHING_FORM_METADATA") }) : w ? /* @__PURE__ */ t("div", { children: U(w).message ?? r("ERROR_FETCHING_FORM_DATA") }) : I.length > 0 ? /* @__PURE__ */ t("div", { className: o.formDetailsContainer, children: I.map((n, l) => /* @__PURE__ */ t(
345
- Fe,
352
+ children: /* @__PURE__ */ n("div", { className: o.formContent, children: P || Q ? /* @__PURE__ */ n(ce, { width: "100%", lineCount: 3 }) : w ? /* @__PURE__ */ n("div", { children: x(w).message ?? r("ERROR_FETCHING_FORM_METADATA") }) : I ? /* @__PURE__ */ n("div", { children: x(I).message ?? r("ERROR_FETCHING_FORM_DATA") }) : V.length > 0 ? /* @__PURE__ */ n("div", { className: o.formDetailsContainer, children: V.map((t, l) => /* @__PURE__ */ n(
353
+ Ee,
346
354
  {
347
- observation: n,
355
+ observation: t,
348
356
  index: l,
349
357
  formName: a.formName
350
358
  },
351
- `${n.concept.uuid}`
352
- )) }) : /* @__PURE__ */ t("div", { children: r("NO_FORM_DATA_AVAILABLE") }) })
359
+ `${t.concept.uuid}`
360
+ )) }) : /* @__PURE__ */ n("div", { children: r("NO_FORM_DATA_AVAILABLE") }) })
353
361
  }
354
362
  )
355
363
  ] });
356
364
  };
357
365
  export {
358
- Be as default
366
+ qe as default
359
367
  };
@@ -1,5 +1,5 @@
1
- import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-CfDIPvcn.js";
2
- import { l as d, m as f, n as e } from "./index-D9OpcJ-A.js";
1
+ import { c, T as l, P as m, a as u, D as v, Q as i } from "./YPM2AS64-BBeTDdWD.js";
2
+ import { l as d, m as f, n as e } from "./index-B6DRKpTQ.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-CfDIPvcn.js";
2
- import { l as v, m as C, n as e } from "./index-D9OpcJ-A.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-BBeTDdWD.js";
2
+ import { l as v, m as C, n as e } from "./index-B6DRKpTQ.js";
3
3
  var h = (t) => {
4
4
  const [r, o] = s({
5
5
  prefix: "TanstackQueryDevtools"
@@ -0,0 +1,171 @@
1
+ import { jsxs as I, jsx as c } from "react/jsx-runtime";
2
+ import { h as q, p as B, u as N, j as Q, F as x, e as H, d as K, Q as M, f as j, k as w, A as G, J as P, H as S, X, P as J, L as Y, M as z, x as W } from "./index-B6DRKpTQ.js";
3
+ import { useQueries as Z, useQuery as ee } from "@tanstack/react-query";
4
+ import { useRef as te, useEffect as T, useMemo as h } from "react";
5
+ const A = (t, d, i, l, s) => {
6
+ const a = X(t, d), r = a.value, o = J(r);
7
+ let n = r;
8
+ o === "Image" && (n = /* @__PURE__ */ c(z, { imageSrc: r, alt: r, id: `${r}-img` })), o === "Video" && (n = /* @__PURE__ */ c(W, { id: `${r}-video`, videoSrc: r }));
9
+ const b = s("OBSERVATIONS_RECORDED_BY", {
10
+ provider: a.provider
11
+ }), m = t.display, v = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", u = l ? `${l}-${v}-${m}-${i}-${d}` : `${v}-${m}-${i}-${d}`;
12
+ return /* @__PURE__ */ c(
13
+ Y,
14
+ {
15
+ header: a.header,
16
+ value: n,
17
+ info: b,
18
+ id: u,
19
+ testId: u,
20
+ ariaLabel: u
21
+ },
22
+ `obs-${t.id}`
23
+ );
24
+ }, ae = (t, d, i, l, s, a) => /* @__PURE__ */ c(
25
+ S,
26
+ {
27
+ title: t.display,
28
+ id: `grouped-obs-${t.display}-${l}`,
29
+ open: i,
30
+ children: t.members?.map(
31
+ (r, o) => A(r, o, s, a, d)
32
+ )
33
+ },
34
+ `grouped-obs-${t.id}`
35
+ ), se = ({
36
+ groupedData: t,
37
+ title: d = ""
38
+ }) => {
39
+ const { t: i } = N(), l = (s, a, r) => {
40
+ const o = P(s.encounterDetails, i);
41
+ return /* @__PURE__ */ I(
42
+ S,
43
+ {
44
+ title: o,
45
+ id: `encounter-${s.encounterId}`,
46
+ open: a,
47
+ children: [
48
+ s.observations.map(
49
+ (n, b) => A(n, b, r, d, i)
50
+ ),
51
+ s.groupedObservations.map(
52
+ (n, b) => ae(
53
+ n,
54
+ i,
55
+ a,
56
+ b,
57
+ r,
58
+ d
59
+ )
60
+ )
61
+ ]
62
+ },
63
+ `encounter-${s.encounterId}`
64
+ );
65
+ };
66
+ return /* @__PURE__ */ c(
67
+ "div",
68
+ {
69
+ id: "obs-by-encounter",
70
+ "data-testid": "obs-by-encounter-test-id",
71
+ "aria-label": "obs-by-encounter-aria-label",
72
+ children: t.map(
73
+ (s, a) => l(s, a === 0, a)
74
+ )
75
+ }
76
+ );
77
+ }, re = "_observations_kfbhq_1", oe = "_title_kfbhq_12", $ = {
78
+ observations: re,
79
+ title: oe
80
+ }, ie = (t) => ["conceptUuid", t], ne = (t, d) => ["observations", t, ...d], be = ({ config: t }) => {
81
+ const d = t, { conceptNames: i = [], conceptUuid: l = [] } = d, s = te(/* @__PURE__ */ new Set()), a = q(), { addNotification: r } = B(), { t: o } = N(), n = Z({
82
+ queries: i.map((e) => ({
83
+ queryKey: ie(e),
84
+ queryFn: () => Q(e),
85
+ enabled: !!e
86
+ }))
87
+ });
88
+ T(() => {
89
+ n.forEach((e, p) => {
90
+ if (e.isError && !s.current.has(p)) {
91
+ const V = i[p];
92
+ r({
93
+ title: o("ERROR_DEFAULT_TITLE"),
94
+ message: o("ERROR_FETCHING_CONCEPT", { conceptName: V }),
95
+ type: "error"
96
+ }), s.current.add(p);
97
+ } else e.isError || s.current.delete(p);
98
+ });
99
+ }, [n, i]);
100
+ const b = h(() => n.map((e) => e.data?.uuid).filter((e) => !!e), [n]), m = h(() => [.../* @__PURE__ */ new Set([...b, ...l])], [b, l]), v = h(() => i.length === 0 ? !0 : n.every((e) => !e.isLoading), [n, i.length]), {
101
+ data: u,
102
+ isLoading: F,
103
+ isError: R,
104
+ refetch: f
105
+ } = ee({
106
+ queryKey: ne(a, m),
107
+ queryFn: () => x(a, m),
108
+ enabled: !!a && m.length > 0 && v
109
+ });
110
+ H(
111
+ (e) => {
112
+ e.patientUUID === a && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
113
+ (p) => m.includes(p)
114
+ ) && f();
115
+ },
116
+ [a, f]
117
+ ), T(() => {
118
+ R && r({
119
+ title: o("ERROR_DEFAULT_TITLE"),
120
+ message: o("ERROR_FETCHING_OBSERVATIONS"),
121
+ type: "error"
122
+ });
123
+ }, [R]);
124
+ const g = h(() => {
125
+ if (!u) return [];
126
+ const e = K(u), p = M(e);
127
+ return j(p);
128
+ }, [u]), L = [
129
+ { key: "name", header: "name" },
130
+ { key: "value", header: "value" },
131
+ { key: "form", header: "form" }
132
+ ], O = F || !v, _ = R && v, D = (!u || u.entry?.length === 0 || m.length === 0) && v, U = _ ? o("ERROR_FETCHING_OBSERVATIONS") : null, k = D ? o("NO_OBSERVATIONS_FOUND") : void 0, C = g.length > 0 && !O && !_, E = d.titleTranslationKey, y = E ? o(E) : "";
133
+ return /* @__PURE__ */ I(
134
+ "div",
135
+ {
136
+ id: "observations",
137
+ "data-testid": E ? `observations-${y}` : "observations",
138
+ "aria-label": "observations-aria-label",
139
+ className: $.observations,
140
+ children: [
141
+ /* @__PURE__ */ c(
142
+ w,
143
+ {
144
+ id: "observations-title",
145
+ testId: E ? `observations-title-${y}` : "observations-title",
146
+ title: y,
147
+ className: $.title,
148
+ children: /* @__PURE__ */ c("p", { children: y })
149
+ }
150
+ ),
151
+ C ? /* @__PURE__ */ c(se, { groupedData: g, title: y }) : /* @__PURE__ */ c(
152
+ G,
153
+ {
154
+ headers: L,
155
+ rows: [],
156
+ ariaLabel: o("OBSERVATIONS"),
157
+ loading: O,
158
+ errorStateMessage: U,
159
+ emptyStateMessage: k,
160
+ dataTestId: "observations-table"
161
+ }
162
+ )
163
+ ]
164
+ }
165
+ );
166
+ };
167
+ export {
168
+ ie as conceptUuidQueryKeys,
169
+ be as default,
170
+ ne as observationsQueryKeys
171
+ };
@@ -1,4 +1,4 @@
1
- import { o as we, p as z, r as xt, s as B, m as q, n as y, t as Ro, v as ye, S as R, y as _, z as k, B as N, D as A, E as bs, I as ir, N as $e, O as U, R as Hn, T as Vn, Z as dt, _ as D, $ as xs, a0 as cn, a1 as Be, a2 as ws, a3 as qt, a4 as zt, a5 as $s, a6 as Cs, a7 as $n, a8 as Ss, a9 as Nr, aa as Bt, ab as zo, ac as ks, ad as Es, ae as j, af as Ur, ag as Ms, ah as Ds, ai as sr, aj as As, ak as Ts, al as zn, am as Fs, an as Is, ao as Z, ap as Ps, aq as Os } from "./index-D9OpcJ-A.js";
1
+ import { o as we, r as z, s as xt, t as B, m as q, n as y, v as Ro, y as ye, S as R, z as _, B as k, D as N, E as A, I as bs, N as ir, O as $e, R as U, T as Hn, Z as Vn, _ as dt, $ as D, a0 as xs, a1 as cn, a2 as Be, a3 as ws, a4 as qt, a5 as zt, a6 as $s, a7 as Cs, a8 as $n, a9 as Ss, aa as Nr, ab as Bt, ac as zo, ad as ks, ae as Es, af as j, ag as Ur, ah as Ms, ai as Ds, aj as sr, ak as As, al as Ts, am as zn, an as Fs, ao as Is, ap as Z, aq as Ps, ar as Os } from "./index-B6DRKpTQ.js";
2
2
  var Ls = (e) => e != null, qs = (e) => e.filter(Ls);
3
3
  function _s(e) {
4
4
  return (...t) => {