@bahmni/appointments-app 0.0.1-dev.212 → 0.0.1-dev.215

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.
@@ -0,0 +1,212 @@
1
+ import { jsxs as S, jsx as u } from "react/jsx-runtime";
2
+ import { c as V, e as w, u as N, o as x, q as K, a as M, w as P, l as Q, r as z, E as G, y as H, x as j, t as Y, v as q, z as Z, f as J, A as W, k as X, P as ee, B as ae, C as te } from "./index-CU8j8cbs.js";
3
+ import { useRef as se, useEffect as $, useMemo as R } from "react";
4
+ const A = (a, o, d, l, b, r) => {
5
+ const t = Z(a, o, b), s = t.value, i = J(s);
6
+ let n = s;
7
+ i === "Image" && (n = /* @__PURE__ */ u(
8
+ X,
9
+ {
10
+ imageSrc: s,
11
+ alt: s,
12
+ id: `${s}-img`,
13
+ hideThumbnail: r
14
+ }
15
+ )), i === "Video" && (n = /* @__PURE__ */ u(
16
+ ee,
17
+ {
18
+ id: `${s}-video`,
19
+ videoSrc: s,
20
+ hideThumbnail: r
21
+ }
22
+ )), i === "PDF" && (n = /* @__PURE__ */ u(ae, { id: `${s}-pdf`, src: s }));
23
+ const p = b("OBSERVATIONS_RECORDED_BY", {
24
+ provider: t.provider
25
+ }), m = a.display, v = a.observationValue?.isAbnormal ? "abnormal-obs" : "obs", c = l ? `${l}-${v}-${m}-${d}-${o}` : `${v}-${m}-${d}-${o}`;
26
+ return /* @__PURE__ */ u(
27
+ W,
28
+ {
29
+ header: t.header,
30
+ value: n,
31
+ info: p,
32
+ id: c,
33
+ testId: c,
34
+ ariaLabel: c
35
+ },
36
+ `obs-${a.id}`
37
+ );
38
+ }, re = (a, o, d, l, b, r, t) => /* @__PURE__ */ u(
39
+ q,
40
+ {
41
+ title: a.display,
42
+ id: `grouped-obs-${a.display}-${l}`,
43
+ open: d,
44
+ children: a.members?.map(
45
+ (s, i) => A(
46
+ s,
47
+ i,
48
+ b,
49
+ r,
50
+ o,
51
+ t
52
+ )
53
+ )
54
+ },
55
+ `grouped-obs-${a.id}`
56
+ ), ie = ({
57
+ groupedData: a,
58
+ title: o = "",
59
+ hideThumbnail: d
60
+ }) => {
61
+ const { t: l } = N(), b = (r, t, s) => {
62
+ const i = Y(r.encounterDetails, l);
63
+ return /* @__PURE__ */ S(
64
+ q,
65
+ {
66
+ title: i,
67
+ id: `encounter-${r.encounterId}`,
68
+ open: t,
69
+ children: [
70
+ r.observations.map(
71
+ (n, p) => A(
72
+ n,
73
+ p,
74
+ s,
75
+ o,
76
+ l,
77
+ d
78
+ )
79
+ ),
80
+ r.groupedObservations.map(
81
+ (n, p) => re(
82
+ n,
83
+ l,
84
+ t,
85
+ p,
86
+ s,
87
+ o,
88
+ d
89
+ )
90
+ )
91
+ ]
92
+ },
93
+ `encounter-${r.encounterId}`
94
+ );
95
+ };
96
+ return /* @__PURE__ */ u(
97
+ "div",
98
+ {
99
+ id: "obs-by-encounter",
100
+ "data-testid": "obs-by-encounter-test-id",
101
+ "aria-label": "obs-by-encounter-aria-label",
102
+ children: a.map(
103
+ (r, t) => b(r, t === 0, t)
104
+ )
105
+ }
106
+ );
107
+ }, ne = "_observations_kfbhq_1", oe = "_title_kfbhq_12", I = {
108
+ observations: ne,
109
+ title: oe
110
+ }, de = (a) => ["conceptUuid", a], le = (a, o) => ["observations", a, ...o], pe = ({ config: a }) => {
111
+ const o = a, {
112
+ conceptNames: d = [],
113
+ conceptUuid: l = [],
114
+ hideThumbnail: b = !1
115
+ } = o, r = se(/* @__PURE__ */ new Set()), t = V(), { addNotification: s } = w(), { t: i } = N(), n = x({
116
+ queries: d.map((e) => ({
117
+ queryKey: de(e),
118
+ queryFn: () => K(e),
119
+ enabled: !!e
120
+ }))
121
+ });
122
+ $(() => {
123
+ n.forEach((e, h) => {
124
+ if (e.isError && !r.current.has(h)) {
125
+ const U = d[h];
126
+ s({
127
+ title: i("ERROR_DEFAULT_TITLE"),
128
+ message: i("ERROR_FETCHING_CONCEPT", { conceptName: U }),
129
+ type: "error"
130
+ }), r.current.add(h);
131
+ } else e.isError || r.current.delete(h);
132
+ });
133
+ }, [n, d]);
134
+ const p = R(() => n.map((e) => e.data?.uuid).filter((e) => !!e), [n]), m = R(() => [.../* @__PURE__ */ new Set([...p, ...l])], [p, l]), v = R(() => d.length === 0 ? !0 : n.every((e) => !e.isLoading), [n, d.length]), {
135
+ data: c,
136
+ isLoading: D,
137
+ isError: T,
138
+ refetch: f
139
+ } = M({
140
+ queryKey: le(t, m),
141
+ queryFn: () => te(t, m),
142
+ enabled: !!t && m.length > 0 && v
143
+ });
144
+ P(
145
+ (e) => {
146
+ e.patientUUID === t && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
147
+ (h) => m.includes(h)
148
+ ) && f();
149
+ },
150
+ [t, f]
151
+ ), $(() => {
152
+ T && s({
153
+ title: i("ERROR_DEFAULT_TITLE"),
154
+ message: i("ERROR_FETCHING_OBSERVATIONS"),
155
+ type: "error"
156
+ });
157
+ }, [T]);
158
+ const g = R(() => {
159
+ if (!c) return [];
160
+ const e = Q(c), h = z(e);
161
+ return G(h);
162
+ }, [c]), F = [
163
+ { key: "name", header: "name" },
164
+ { key: "value", header: "value" },
165
+ { key: "form", header: "form" }
166
+ ], O = D || !v, _ = T && v, B = (!c || c.entry?.length === 0 || m.length === 0) && v, C = _ ? i("ERROR_FETCHING_OBSERVATIONS") : null, L = B ? i("NO_OBSERVATIONS_FOUND") : void 0, k = g.length > 0 && !O && !_, E = o.titleTranslationKey, y = E ? i(E) : "";
167
+ return /* @__PURE__ */ S(
168
+ "div",
169
+ {
170
+ id: "observations",
171
+ "data-testid": E ? `observations-${y}` : "observations",
172
+ "aria-label": "observations-aria-label",
173
+ className: I.observations,
174
+ children: [
175
+ /* @__PURE__ */ u(
176
+ H,
177
+ {
178
+ id: "observations-title",
179
+ testId: E ? `observations-title-${y}` : "observations-title",
180
+ title: y,
181
+ className: I.title,
182
+ children: /* @__PURE__ */ u("p", { children: y })
183
+ }
184
+ ),
185
+ k ? /* @__PURE__ */ u(
186
+ ie,
187
+ {
188
+ groupedData: g,
189
+ title: y,
190
+ hideThumbnail: b
191
+ }
192
+ ) : /* @__PURE__ */ u(
193
+ j,
194
+ {
195
+ headers: F,
196
+ rows: [],
197
+ ariaLabel: i("OBSERVATIONS"),
198
+ loading: O,
199
+ errorStateMessage: C,
200
+ emptyStateMessage: L,
201
+ dataTestId: "observations-table"
202
+ }
203
+ )
204
+ ]
205
+ }
206
+ );
207
+ };
208
+ export {
209
+ de as conceptUuidQueryKeys,
210
+ pe as default,
211
+ le as observationsQueryKeys
212
+ };
@@ -1,4 +1,4 @@
1
- import { a1 as we, a2 as z, a3 as xt, a4 as B, _ as q, a0 as y, a5 as Ro, a6 as ye, a7 as R, a8 as _, a9 as k, aa as N, ab as A, ac as bs, ad as ir, ae as $e, af as G, ag as Hn, ah as Vn, ai as dt, aj as D, ak as xs, al as cn, am as Be, an as ws, ao as qt, ap as zt, aq as $s, ar as Cs, as as $n, at as Ss, au as Nr, av as Bt, aw as zo, ax as ks, ay as Es, az as j, aA as Gr, aB as Ms, aC as Ds, aD as sr, aE as As, aF as Ts, aG as zn, aH as Fs, aI as Is, aJ as Z, aK as Ps, aL as Ls } from "./index-DIv6b2ab.js";
1
+ import { a1 as we, a2 as z, a3 as xt, a4 as B, $ as q, a0 as y, a5 as Ro, a6 as ye, a7 as R, a8 as _, a9 as k, aa as N, ab as A, ac as bs, ad as ir, ae as $e, af as G, ag as Hn, ah as Vn, ai as dt, aj as D, ak as xs, al as cn, am as Be, an as ws, ao as qt, ap as zt, aq as $s, ar as Cs, as as $n, at as Ss, au as Nr, av as Bt, aw as zo, ax as ks, ay as Es, az as j, aA as Gr, aB as Ms, aC as Ds, aD as sr, aE as As, aF as Ts, aG as zn, aH as Fs, aI as Is, aJ as Z, aK as Ps, aL as Ls } from "./index-CU8j8cbs.js";
2
2
  var Os = (e) => e != null, qs = (e) => e.filter(Os);
3
3
  function _s(e) {
4
4
  return (...t) => {