@bahmni/appointments-app 0.0.1-dev.314 → 0.0.1-dev.315

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 h, Fragment as x } from "react/jsx-runtime";
2
- import { n as G, u as W, o as Y, U as J, a as X, g as Z, O as ee, h as te } from "./index-Z_FLt8Y9.js";
2
+ import { n as G, u as W, o as Y, j as J, a as X, g as Z, O as ee, h as te } from "./index-CWpCbDfm.js";
3
3
  import { useQuery as ae } from "@tanstack/react-query";
4
4
  import { useState as l, useCallback as _, useEffect as N, useMemo as p } 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 = {
@@ -34,17 +34,17 @@ const Te = [
34
34
  "uploadedOn",
35
35
  "uploadedBy"
36
36
  ], he = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, B = (a) => a.attachments.length > 0 ? a.attachments : a.documentUrl ? [{ url: a.documentUrl, contentType: a.contentType }] : [], Oe = ({ config: a, encounterUuids: g }) => {
37
- const [s, U] = l(!1), [o, w] = l(
37
+ const [s, w] = l(!1), [o, M] = l(
38
38
  null
39
39
  ), [$, D] = l(
40
40
  /* @__PURE__ */ new Set()
41
- ), E = G(), { t: n } = W(), { addNotification: M } = Y(), k = Number(a?.pageSize) || 5, [I, C] = l(1), [u, V] = l(k), [F, A] = l(void 0), L = _((e) => {
42
- w(e), U(!0);
43
- }, []), H = _(() => {
44
- U(!1), w(null), D(/* @__PURE__ */ new Set());
41
+ ), E = G(), { t: n } = W(), { addNotification: U } = Y(), k = Number(a?.pageSize) || 5, [I, C] = l(1), [u, V] = l(k), [F, A] = l(void 0), L = _((e) => {
42
+ M(e), w(!0);
43
+ }, []), j = _(() => {
44
+ w(!1), M(null), D(/* @__PURE__ */ new Set());
45
45
  }, []), v = _((e) => {
46
46
  D((t) => new Set(t).add(e));
47
- }, []), { data: i, isLoading: q, isError: b, error: y } = ae({
47
+ }, []), { data: i, isLoading: H, isError: b, error: y } = ae({
48
48
  queryKey: [
49
49
  "documents",
50
50
  E,
@@ -65,12 +65,12 @@ const Te = [
65
65
  }, [i]), N(() => {
66
66
  C(1), A(void 0);
67
67
  }, [E]), N(() => {
68
- b && M({
68
+ b && U({
69
69
  title: n("ERROR_DEFAULT_TITLE"),
70
70
  message: y?.message ?? "",
71
71
  type: "error"
72
72
  });
73
- }, [b, y, M, n]), N(() => {
73
+ }, [b, y, U, n]), N(() => {
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 || D(t);
90
90
  })(), () => e.abort();
91
91
  }, [s, o]);
92
- const j = _(
92
+ const q = _(
93
93
  (e, t) => {
94
94
  t !== u ? (V(t), C(1), A(void 0)) : C(e);
95
95
  },
@@ -144,7 +144,7 @@ const Te = [
144
144
  headers: z,
145
145
  ariaLabel: n("DOCUMENTS_TABLE_HEADING"),
146
146
  rows: P,
147
- loading: q,
147
+ loading: H,
148
148
  errorStateMessage: b ? y?.message : null,
149
149
  sortable: K,
150
150
  emptyStateMessage: n("DOCUMENTS_NO_RECORDS"),
@@ -154,7 +154,7 @@ const Te = [
154
154
  pageSize: u,
155
155
  totalItems: F,
156
156
  page: I,
157
- onPageChange: j
157
+ onPageChange: q
158
158
  }
159
159
  ) }),
160
160
  s && o && /* @__PURE__ */ r(
@@ -163,7 +163,7 @@ const Te = [
163
163
  id: "modalIdForActionAreaLayout",
164
164
  portalId: "main-display-area",
165
165
  open: s,
166
- onRequestClose: H,
166
+ onRequestClose: j,
167
167
  modalHeading: o.documentIdentifier,
168
168
  passiveModal: !0,
169
169
  size: "lg",
@@ -0,0 +1,234 @@
1
+ import { jsx as i, jsxs as re, Fragment as oe } from "react/jsx-runtime";
2
+ import { u as ae, n as se, x as te, F as ne, P as de, B as ie, Z as le, b as ue, D as q, g as me, a as ce, O as w, w as fe, v as ye, h as he, Q as be, $ as ge } from "./index-CWpCbDfm.js";
3
+ import { useQueryClient as pe, useQuery as h } from "@tanstack/react-query";
4
+ import { useState as k, useMemo as d, useCallback as b } from "react";
5
+ const Ne = "FormsTable-module_formsTableBody__SvGha", Oe = "FormsTable-module_customAccordianItem__isszs", M = {
6
+ formsTableBody: Ne,
7
+ customAccordianItem: Oe
8
+ }, Ae = (m) => m ? m.extension?.find(
9
+ (l) => l.url === ge
10
+ )?.valueString : void 0, Te = ({
11
+ episodeOfCareUuids: m,
12
+ encounterUuids: l,
13
+ config: x
14
+ }) => {
15
+ const { t: n } = ae(), c = se(), [f, F] = k(!1), [s, v] = k(null), {
16
+ numberOfVisits: $,
17
+ hideThumbnail: H = !1,
18
+ forms: y
19
+ } = x ?? {}, I = te(
20
+ m,
21
+ l
22
+ ), K = pe(), {
23
+ data: T = [],
24
+ isLoading: B,
25
+ isError: E,
26
+ error: Q,
27
+ refetch: V
28
+ } = h({
29
+ queryKey: ["forms", c, m],
30
+ queryFn: () => ne(c, void 0, $),
31
+ enabled: !!c && !I
32
+ }), D = d(() => {
33
+ let e = T;
34
+ return l && l.length > 0 && (e = e.filter(
35
+ (r) => l.includes(r.encounterUuid)
36
+ )), Array.isArray(y) && y.length > 0 && (e = e.filter(
37
+ (r) => y.some((o) => o.toLowerCase() === r.formName.toLowerCase())
38
+ )), e;
39
+ }, [T, l, y]), { data: L = [] } = h({
40
+ queryKey: ["observationForms"],
41
+ queryFn: () => de()
42
+ }), S = b(
43
+ (e) => L.find((r) => r.name === e)?.uuid,
44
+ [L]
45
+ ), g = d(() => {
46
+ if (s)
47
+ return S(s.formName);
48
+ }, [s, S]), {
49
+ data: u,
50
+ isLoading: j,
51
+ isError: z,
52
+ error: p
53
+ } = h({
54
+ queryKey: ["formMetadata", g],
55
+ queryFn: () => ie(g),
56
+ enabled: !!g && f
57
+ }), {
58
+ data: N,
59
+ isLoading: G,
60
+ isError: P,
61
+ error: O
62
+ } = h({
63
+ queryKey: ["formsEncounterFHIR", s?.encounterUuid],
64
+ queryFn: () => le(s.encounterUuid),
65
+ enabled: !!s?.encounterUuid && f
66
+ });
67
+ ue(
68
+ (e) => {
69
+ e.patientUUID === c && e.updatedConcepts.size > 0 && (V(), K.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
70
+ },
71
+ [c]
72
+ );
73
+ const Z = d(() => !N?.entry || !s?.formName ? [] : N.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => {
74
+ const r = Ae(e);
75
+ return !r || r.includes(s.formName);
76
+ }), [N, s?.formName]), Y = d(() => {
77
+ if (!u?.schema) return;
78
+ const e = [], r = (o) => {
79
+ (o ?? []).forEach((t) => {
80
+ const a = t;
81
+ a.id != null && e.push(String(a.id)), a.controls && r(a.controls);
82
+ });
83
+ };
84
+ return r(
85
+ u.schema.controls ?? []
86
+ ), e.length > 0 ? e : void 0;
87
+ }, [u]), J = d(() => {
88
+ if (!u?.schema) return;
89
+ const e = {}, r = (o, t) => {
90
+ for (const a of o)
91
+ if (a.type === "section") {
92
+ const A = a.label?.value ?? "Section";
93
+ r(a.controls ?? [], A);
94
+ } else
95
+ a.id != null && t && (e[String(a.id)] = t), a.controls && r(a.controls, t);
96
+ };
97
+ return r(
98
+ u.schema.controls ?? [],
99
+ null
100
+ ), Object.keys(e).length > 0 ? e : void 0;
101
+ }, [u]), W = d(() => {
102
+ if (p)
103
+ return q(p).message;
104
+ if (O)
105
+ return q(O).message;
106
+ }, [p, O]), _ = d(
107
+ () => [
108
+ { key: "recordedOn", header: n("RECORDED_ON") },
109
+ { key: "recordedBy", header: n("RECORDED_BY") }
110
+ ],
111
+ [n]
112
+ ), X = d(
113
+ () => [
114
+ { key: "recordedOn", sortable: !0 },
115
+ { key: "recordedBy", sortable: !0 }
116
+ ],
117
+ []
118
+ ), C = d(() => {
119
+ const e = D.reduce(
120
+ (r, o) => {
121
+ const t = o.formName;
122
+ r[t] ??= [];
123
+ const a = o.providers.map((A) => A.providerName).filter(Boolean).join(", ");
124
+ return r[t].push({
125
+ id: o.encounterUuid,
126
+ formName: o.formName,
127
+ recordedOn: me(o.encounterDateTime, n, !0).formattedResult,
128
+ recordedBy: a ?? "--",
129
+ encounterDateTime: o.encounterDateTime,
130
+ encounterUuid: o.encounterUuid
131
+ }), r;
132
+ },
133
+ {}
134
+ );
135
+ return Object.entries(e).map(
136
+ ([r, o]) => ({
137
+ formName: r,
138
+ records: o.sort(
139
+ (t, a) => a.encounterDateTime - t.encounterDateTime
140
+ )
141
+ })
142
+ ).sort((r, o) => r.formName.localeCompare(o.formName));
143
+ }, [D, n]), R = b((e) => {
144
+ v(e), F(!0);
145
+ }, []), ee = b(() => {
146
+ F(!1), v(null);
147
+ }, []), U = b(
148
+ (e, r) => {
149
+ switch (r) {
150
+ case "recordedOn":
151
+ return /* @__PURE__ */ i(ce, { onClick: () => R(e), children: e.recordedOn });
152
+ case "recordedBy":
153
+ return e.recordedBy;
154
+ default:
155
+ return null;
156
+ }
157
+ },
158
+ [R]
159
+ );
160
+ return /* @__PURE__ */ re(oe, { children: [
161
+ /* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children: B || E || C.length === 0 || I ? /* @__PURE__ */ i(
162
+ w,
163
+ {
164
+ headers: _,
165
+ ariaLabel: n("FORMS_HEADING"),
166
+ rows: [],
167
+ loading: B,
168
+ errorStateMessage: E ? Q?.message : void 0,
169
+ emptyStateMessage: n("FORMS_UNAVAILABLE"),
170
+ renderCell: U,
171
+ className: M.formsTableBody,
172
+ dataTestId: "forms-table"
173
+ }
174
+ ) : /* @__PURE__ */ i(fe, { align: "start", children: C.map((e, r) => {
175
+ const { formName: o, records: t } = e;
176
+ return /* @__PURE__ */ i(
177
+ ye,
178
+ {
179
+ title: o,
180
+ className: M.customAccordianItem,
181
+ testId: `accordian-title-${o}`,
182
+ open: r === 0,
183
+ children: /* @__PURE__ */ i(
184
+ w,
185
+ {
186
+ headers: _,
187
+ ariaLabel: n("FORMS_HEADING"),
188
+ rows: t,
189
+ loading: !1,
190
+ errorStateMessage: "",
191
+ sortable: X,
192
+ emptyStateMessage: n("FORMS_UNAVAILABLE"),
193
+ renderCell: U,
194
+ className: M.formsTableBody,
195
+ dataTestId: `forms-table-${o}`
196
+ }
197
+ )
198
+ },
199
+ o
200
+ );
201
+ }) }) }),
202
+ f && s && /* @__PURE__ */ i(
203
+ he,
204
+ {
205
+ id: "modalIdForActionAreaLayout",
206
+ portalId: "main-display-area",
207
+ open: f,
208
+ onRequestClose: ee,
209
+ modalHeading: s.formName,
210
+ modalLabel: `${s.recordedOn} | ${s.recordedBy}`,
211
+ passiveModal: !0,
212
+ size: "md",
213
+ testId: "form-details-modal",
214
+ children: /* @__PURE__ */ i(
215
+ be,
216
+ {
217
+ observations: Z,
218
+ isLoading: j || G,
219
+ isError: z || P,
220
+ errorMessage: W,
221
+ emptyStateMessage: n("NO_FORM_DATA_AVAILABLE"),
222
+ testIdPrefix: s.formName,
223
+ hideThumbnail: H,
224
+ controlOrder: Y,
225
+ sectionMap: J
226
+ }
227
+ )
228
+ }
229
+ )
230
+ ] });
231
+ };
232
+ export {
233
+ Te as default
234
+ };
@@ -1,5 +1,5 @@
1
- import { c, T as l, P as m, a as i, D as u, Q as v } from "./YPM2AS64-DlxIiUTN.js";
2
- import { ah as d, ai as f, aj as e } from "./index-Z_FLt8Y9.js";
1
+ import { c, T as l, P as m, a as i, D as u, Q as v } from "./YPM2AS64-2FJFexRr.js";
2
+ import { ah as d, ai as f, aj as e } from "./index-CWpCbDfm.js";
3
3
  var h = (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 i, a as u, b as m, C as P, Q as d } from "./YPM2AS64-DlxIiUTN.js";
2
- import { ah as h, ai as v, aj as e } from "./index-Z_FLt8Y9.js";
1
+ import { c as s, T as c, P as i, a as u, b as m, C as P, Q as d } from "./YPM2AS64-2FJFexRr.js";
2
+ import { ah as h, ai as v, aj as e } from "./index-CWpCbDfm.js";
3
3
  var C = (t) => {
4
4
  const [r, o] = s({
5
5
  prefix: "TanstackQueryDevtools"
@@ -1,12 +1,12 @@
1
- import { jsxs as I, jsx as u } from "react/jsx-runtime";
2
- import { n as K, o as q, u as N, $ as G, Z as Q, b as k, J as w, X as x, c as z, d as H, O as J, G as Y, E as M, Y as j, e as P, f as X, M as Z, S as W, z as ee } from "./index-Z_FLt8Y9.js";
1
+ import { jsxs as S, jsx as u } from "react/jsx-runtime";
2
+ import { n as V, o as k, u as N, I as q, k as G, b as Q, Y as x, J as z, X as w, c as H, O as J, K as Y, d as M, G as j, e as P, f as X, M as W, S as Z, z as ee } from "./index-CWpCbDfm.js";
3
3
  import { useQueries as te, useQuery as ae } from "@tanstack/react-query";
4
- import { useRef as se, useEffect as _, useMemo as O } from "react";
4
+ import { useRef as se, useEffect as $, useMemo as O } from "react";
5
5
  const D = (t, n, d, l, b, r) => {
6
6
  const a = j(t, n, b), s = a.value, o = P(s);
7
7
  let i = s;
8
8
  o === "Image" && (i = /* @__PURE__ */ u(
9
- Z,
9
+ W,
10
10
  {
11
11
  imageSrc: s,
12
12
  alt: s,
@@ -14,7 +14,7 @@ const D = (t, n, d, l, b, r) => {
14
14
  hideThumbnail: r
15
15
  }
16
16
  )), o === "Video" && (i = /* @__PURE__ */ u(
17
- W,
17
+ Z,
18
18
  {
19
19
  id: `${s}-video`,
20
20
  videoSrc: s,
@@ -23,7 +23,7 @@ const D = (t, n, d, l, b, r) => {
23
23
  )), o === "PDF" && (i = /* @__PURE__ */ u(ee, { id: `${s}-pdf`, src: s }));
24
24
  const m = b("OBSERVATIONS_RECORDED_BY", {
25
25
  provider: a.provider
26
- }), p = t.display, y = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", c = l ? `${l}-${y}-${p}-${d}-${n}` : `${y}-${p}-${d}-${n}`;
26
+ }), p = t.display, v = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", c = l ? `${l}-${v}-${p}-${d}-${n}` : `${v}-${p}-${d}-${n}`;
27
27
  return /* @__PURE__ */ u(
28
28
  X,
29
29
  {
@@ -61,7 +61,7 @@ const D = (t, n, d, l, b, r) => {
61
61
  }) => {
62
62
  const { t: l } = N(), b = (r, a, s) => {
63
63
  const o = Y(r.encounterDetails, l);
64
- return /* @__PURE__ */ I(
64
+ return /* @__PURE__ */ S(
65
65
  M,
66
66
  {
67
67
  title: o,
@@ -105,7 +105,7 @@ const D = (t, n, d, l, b, r) => {
105
105
  )
106
106
  }
107
107
  );
108
- }, ie = "Observations-module_observations__RKSyo", ne = "Observations-module_title__TJL3z", S = {
108
+ }, ie = "Observations-module_observations__RKSyo", ne = "Observations-module_title__TJL3z", I = {
109
109
  observations: ie,
110
110
  title: ne
111
111
  }, de = (t) => ["conceptUuid", t], le = (t, n) => ["observations", t, ...n], pe = ({ config: t }) => {
@@ -113,81 +113,81 @@ const D = (t, n, d, l, b, r) => {
113
113
  conceptNames: d = [],
114
114
  conceptUuid: l = [],
115
115
  hideThumbnail: b = !1
116
- } = n, r = se(/* @__PURE__ */ new Set()), a = K(), { addNotification: s } = q(), { t: o } = N(), i = te({
116
+ } = n, r = se(/* @__PURE__ */ new Set()), a = V(), { addNotification: s } = k(), { t: o } = N(), i = te({
117
117
  queries: d.map((e) => ({
118
118
  queryKey: de(e),
119
- queryFn: () => G(e),
119
+ queryFn: () => q(e),
120
120
  enabled: !!e
121
121
  }))
122
122
  });
123
- _(() => {
123
+ $(() => {
124
124
  i.forEach((e, h) => {
125
125
  if (e.isError && !r.current.has(h)) {
126
- const V = d[h];
126
+ const B = d[h];
127
127
  s({
128
128
  title: o("ERROR_DEFAULT_TITLE"),
129
- message: o("ERROR_FETCHING_CONCEPT", { conceptName: V }),
129
+ message: o("ERROR_FETCHING_CONCEPT", { conceptName: B }),
130
130
  type: "error"
131
131
  }), r.current.add(h);
132
132
  } else e.isError || r.current.delete(h);
133
133
  });
134
134
  }, [i, d]);
135
- const m = O(() => i.map((e) => e.data?.uuid).filter((e) => !!e), [i]), p = O(() => [.../* @__PURE__ */ new Set([...m, ...l])], [m, l]), y = O(() => d.length === 0 ? !0 : i.every((e) => !e.isLoading), [i, d.length]), {
135
+ const m = O(() => i.map((e) => e.data?.uuid).filter((e) => !!e), [i]), p = O(() => [.../* @__PURE__ */ new Set([...m, ...l])], [m, l]), v = O(() => d.length === 0 ? !0 : i.every((e) => !e.isLoading), [i, d.length]), {
136
136
  data: c,
137
137
  isLoading: F,
138
138
  isError: R,
139
139
  refetch: T
140
140
  } = ae({
141
141
  queryKey: le(a, p),
142
- queryFn: () => Q(a, p),
143
- enabled: !!a && p.length > 0 && y
142
+ queryFn: () => G(a, p),
143
+ enabled: !!a && p.length > 0 && v
144
144
  });
145
- k(
145
+ Q(
146
146
  (e) => {
147
147
  e.patientUUID === a && e.updatedConcepts.size > 0 && [...e.updatedConcepts.keys()].some(
148
148
  (h) => p.includes(h)
149
149
  ) && T();
150
150
  },
151
151
  [a, T]
152
- ), _(() => {
152
+ ), $(() => {
153
153
  R && s({
154
154
  title: o("ERROR_DEFAULT_TITLE"),
155
155
  message: o("ERROR_FETCHING_OBSERVATIONS"),
156
156
  type: "error"
157
157
  });
158
158
  }, [R]);
159
- const $ = O(() => {
159
+ const f = O(() => {
160
160
  if (!c) return [];
161
- const e = w(c), h = x(e);
162
- return z(h);
161
+ const e = x(c), h = z(e);
162
+ return w(h);
163
163
  }, [c]), L = [
164
164
  { key: "name", header: "name" },
165
165
  { key: "value", header: "value" },
166
166
  { key: "form", header: "form" }
167
- ], f = F || !y, g = R && y, A = (!c || c.entry?.length === 0 || p.length === 0) && y, C = g ? o("ERROR_FETCHING_OBSERVATIONS") : null, U = A ? o("NO_OBSERVATIONS_FOUND") : void 0, B = $.length > 0 && !f && !g, E = n.titleTranslationKey, v = E ? o(E) : "";
168
- return /* @__PURE__ */ I(
167
+ ], g = F || !v, _ = R && v, A = (!c || c.entry?.length === 0 || p.length === 0) && v, C = _ ? o("ERROR_FETCHING_OBSERVATIONS") : null, K = A ? o("NO_OBSERVATIONS_FOUND") : void 0, U = f.length > 0 && !g && !_, E = n.titleTranslationKey, y = E ? o(E) : "";
168
+ return /* @__PURE__ */ S(
169
169
  "div",
170
170
  {
171
171
  id: "observations",
172
- "data-testid": E ? `observations-${v}` : "observations",
172
+ "data-testid": E ? `observations-${y}` : "observations",
173
173
  "aria-label": "observations-aria-label",
174
- className: S.observations,
174
+ className: I.observations,
175
175
  children: [
176
176
  /* @__PURE__ */ u(
177
177
  H,
178
178
  {
179
179
  id: "observations-title",
180
- testId: E ? `observations-title-${v}` : "observations-title",
181
- title: v,
182
- className: S.title,
183
- children: /* @__PURE__ */ u("p", { children: v })
180
+ testId: E ? `observations-title-${y}` : "observations-title",
181
+ title: y,
182
+ className: I.title,
183
+ children: /* @__PURE__ */ u("p", { children: y })
184
184
  }
185
185
  ),
186
- B ? /* @__PURE__ */ u(
186
+ U ? /* @__PURE__ */ u(
187
187
  oe,
188
188
  {
189
- groupedData: $,
190
- title: v,
189
+ groupedData: f,
190
+ title: y,
191
191
  hideThumbnail: b
192
192
  }
193
193
  ) : /* @__PURE__ */ u(
@@ -196,9 +196,9 @@ const D = (t, n, d, l, b, r) => {
196
196
  headers: L,
197
197
  rows: [],
198
198
  ariaLabel: o("OBSERVATIONS"),
199
- loading: f,
199
+ loading: g,
200
200
  errorStateMessage: C,
201
- emptyStateMessage: U,
201
+ emptyStateMessage: K,
202
202
  dataTestId: "observations-table"
203
203
  }
204
204
  )
@@ -1,4 +1,4 @@
1
- import { ak as we, al as z, am as xt, an as B, ai as q, aj as y, ao as Ro, ap as ye, aq as R, ar as _, as as k, at as N, au as A, av as bs, aw as ir, ax as $e, ay as U, az as Hn, aA as Vn, aB as dt, aC as D, aD as xs, aE as cn, aF as Be, aG as ws, aH as qt, aI as zt, aJ as $s, aK as Cs, aL as $n, aM as Ss, aN as Nr, aO as Bt, aP as zo, aQ as ks, aR as Es, aS as j, aT as Ur, aU as Ms, aV as Ds, aW as sr, aX as As, aY as Ts, aZ as zn, a_ as Fs, a$ as Is, b0 as Z, b1 as Ps, b2 as Ls } from "./index-Z_FLt8Y9.js";
1
+ import { ak as we, al as z, am as xt, an as B, ai as q, aj as y, ao as Ro, ap as ye, aq as R, ar as _, as as k, at as N, au as A, av as bs, aw as ir, ax as $e, ay as U, az as Hn, aA as Vn, aB as dt, aC as D, aD as xs, aE as cn, aF as Be, aG as ws, aH as qt, aI as zt, aJ as $s, aK as Cs, aL as $n, aM as Ss, aN as Nr, aO as Bt, aP as zo, aQ as ks, aR as Es, aS as j, aT as Ur, aU as Ms, aV as Ds, aW as sr, aX as As, aY as Ts, aZ as zn, a_ as Fs, a$ as Is, b0 as Z, b1 as Ps, b2 as Ls } from "./index-CWpCbDfm.js";
2
2
  var Os = (e) => e != null, qs = (e) => e.filter(Os);
3
3
  function _s(e) {
4
4
  return (...t) => {
@@ -95109,7 +95109,7 @@ function zlt(t, e, r) {
95109
95109
  return n;
95110
95110
  };
95111
95111
  }
95112
- b0(() => Promise.resolve().then(() => fF2)), b0(() => Promise.resolve().then(() => BF2)), b0(() => Promise.resolve().then(() => Mj2)), b0(() => Promise.resolve().then(() => Nj2)), b0(() => import("./DocumentsTable-CFMS0Z9e-DM7MblNw.js")), b0(() => Promise.resolve().then(() => xW2)), b0(() => import("./FormsTable-BOqHNyfQ-BXe_DSfY.js")), b0(() => Promise.resolve().then(() => lW2)), b0(() => import("./Observations-DvN06foI-zk9N5pqV.js")), b0(
95112
+ b0(() => Promise.resolve().then(() => fF2)), b0(() => Promise.resolve().then(() => BF2)), b0(() => Promise.resolve().then(() => Mj2)), b0(() => Promise.resolve().then(() => Nj2)), b0(() => import("./DocumentsTable-Vqt2a9Au-B3ocUw0s.js")), b0(() => Promise.resolve().then(() => xW2)), b0(() => import("./FormsTable-Chdn76ek-B8qsYMVy.js")), b0(() => Promise.resolve().then(() => lW2)), b0(() => import("./Observations-7ynzJK04-OYQQQmHR.js")), b0(
95113
95113
  () => Promise.resolve().then(() => XW2)
95114
95114
  ), b0(
95115
95115
  () => Promise.resolve().then(() => LU2)
@@ -183021,7 +183021,7 @@ var Dst = (t, e = !1) => {
183021
183021
  const e = oJ1(() => {
183022
183022
  const r = this, [n] = this.#n, [a] = this.#o, [c] = this.#a, [l] = this.#c, [i] = this.#p, [s] = this.#e;
183023
183023
  let d;
183024
- return this.#l ? d = this.#l : (d = rJ1(() => import("./LNWAZHJI--RHjA59u.js")), this.#l = d), zJ1(this.#h, this.#r), eJ1(d, tJ1({
183024
+ return this.#l ? d = this.#l : (d = rJ1(() => import("./LNWAZHJI-D5RzP8si.js")), this.#l = d), zJ1(this.#h, this.#r), eJ1(d, tJ1({
183025
183025
  get queryFlavor() {
183026
183026
  return r.#d;
183027
183027
  },
@@ -183119,7 +183119,7 @@ var Dst = (t, e = !1) => {
183119
183119
  const e = oJ1(() => {
183120
183120
  const r = this, [n] = this.#n, [a] = this.#o, [c] = this.#a, [l] = this.#c, [i] = this.#p, [s] = this.#e, [d] = this.#l;
183121
183121
  let u;
183122
- return this.#i ? u = this.#i : (u = rJ1(() => import("./MWZ6AO7Z-CZ_HOvvX.js")), this.#i = u), zJ1(this.#h, this.#r), eJ1(u, tJ1({
183122
+ return this.#i ? u = this.#i : (u = rJ1(() => import("./MWZ6AO7Z-CHyUq0M5.js")), this.#i = u), zJ1(this.#h, this.#r), eJ1(u, tJ1({
183123
183123
  get queryFlavor() {
183124
183124
  return r.#d;
183125
183125
  },
@@ -183279,11 +183279,11 @@ const hct = {
183279
183279
  }), bct = b0(
183280
183280
  () => import("./index-CFigb5vF.js").then((t) => ({ default: t.IndexPage }))
183281
183281
  ), xct = b0(
183282
- () => import("./index-rmAXX5cR.js").then((t) => ({
183282
+ () => import("./index-jqdZQtSn.js").then((t) => ({
183283
183283
  default: t.default
183284
183284
  }))
183285
183285
  ), Nct = b0(
183286
- () => import("./index-B2zp1DYp.js").then((t) => ({
183286
+ () => import("./index-DPFJ60fI.js").then((t) => ({
183287
183287
  default: t.default
183288
183288
  }))
183289
183289
  ), Cct = [
@@ -183325,33 +183325,33 @@ function Ist() {
183325
183325
  ] }) }) }) }) : /* @__PURE__ */ ce(vL1, {});
183326
183326
  }
183327
183327
  export {
183328
- llt as $,
183328
+ ilt as $,
183329
183329
  wct as A,
183330
- ult as B,
183330
+ hlt as B,
183331
183331
  Xit as C,
183332
183332
  At as D,
183333
- Zct as E,
183334
- hlt as F,
183335
- wlt as G,
183336
- xM0 as H,
183337
- qit as I,
183338
- vlt as J,
183339
- Wit as K,
183333
+ qit as E,
183334
+ plt as F,
183335
+ glt as G,
183336
+ Wit as H,
183337
+ llt as I,
183338
+ Elt as J,
183339
+ wlt as K,
183340
183340
  o00 as L,
183341
183341
  mA2 as M,
183342
183342
  tit as N,
183343
183343
  K0 as O,
183344
- dlt as P,
183344
+ ult as P,
183345
183345
  AR1 as Q,
183346
183346
  jit as R,
183347
183347
  NA2 as S,
183348
183348
  oit as T,
183349
- flt as U,
183349
+ xM0 as U,
183350
183350
  nit as V,
183351
183351
  Git as W,
183352
- Elt as X,
183353
- glt as Y,
183354
- slt as Z,
183352
+ Mlt as X,
183353
+ vlt as Y,
183354
+ dlt as Z,
183355
183355
  Bit as _,
183356
183356
  r5 as a,
183357
183357
  W8 as a$,
@@ -183423,24 +183423,24 @@ export {
183423
183423
  Cst as b1,
183424
183424
  B4t as b2,
183425
183425
  Ist as b3,
183426
- Mlt as c,
183427
- uE as d,
183426
+ uE as c,
183427
+ Zct as d,
183428
183428
  Yye as e,
183429
183429
  jN2 as f,
183430
183430
  r2 as g,
183431
183431
  qt as h,
183432
- Sz as i,
183433
- plt as j,
183434
- ilt as k,
183435
- sM as l,
183436
- Iit as m,
183432
+ zlt as i,
183433
+ flt as j,
183434
+ slt as k,
183435
+ Sz as l,
183436
+ sM as m,
183437
183437
  or as n,
183438
183438
  Vr as o,
183439
- qlt as p,
183440
- sst as q,
183441
- tst as r,
183442
- zlt as s,
183443
- vt0 as t,
183439
+ Iit as p,
183440
+ qlt as q,
183441
+ vt0 as r,
183442
+ sst as s,
183443
+ tst as t,
183444
183444
  P2 as u,
183445
183445
  Pi as v,
183446
183446
  Bi as w,
@@ -1,5 +1,5 @@
1
1
  import { jsx as r, jsxs as b } from "react/jsx-runtime";
2
- import { I as f, K as B, L as O, R as V, T as Z, V as ee, W as te, a0 as ie, m as ae, a1 as ne, u as Q, a2 as R, a3 as le, a4 as re, a5 as se, a6 as E, a7 as F, a8 as C, a9 as Y, aa as k, ab as x, ac as $, l as oe, o as de, t as H, ad as ce, p as me, ae as Ae, af as Ie, ag as ue, r as _e, y as Te } from "./index-Z_FLt8Y9.js";
2
+ import { E as f, H as B, L as O, R as V, T as Z, V as ee, W as te, a0 as ie, p as ae, a1 as ne, u as Q, a2 as R, a3 as le, a4 as re, a5 as se, a6 as E, a7 as F, a8 as C, a9 as Y, aa as x, ab as k, ac as H, m as oe, o as de, r as $, ad as ce, q as me, ae as Ae, af as Ie, ag as ue, t as _e, y as Te } from "./index-CWpCbDfm.js";
3
3
  import { useState as g, useMemo as N, useEffect as h, useRef as Le, useCallback as U } from "react";
4
4
  import { useQuery as M, useQueryClient as ve } from "@tanstack/react-query";
5
5
  const Ne = "Available for appointments", q = "Get Appointment Unavailability", pe = "Add Appointment Unavailability", w = "Appointment Location", be = () => {
@@ -11,10 +11,10 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
11
11
  }, G = (e) => ({
12
12
  id: "",
13
13
  text: e
14
- }), ye = (e) => ({
14
+ }), De = (e) => ({
15
15
  display: e,
16
16
  uuid: ""
17
- }), De = (e, a) => {
17
+ }), ye = (e, a) => {
18
18
  const n = e.map((t) => ({
19
19
  id: t.uuid,
20
20
  text: t.name,
@@ -137,7 +137,7 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
137
137
  isLoading: a || o || L || s,
138
138
  isError: n || c || m || _
139
139
  };
140
- }, Se = "UnavailabilityForm-module_formContent__WmNHR", Pe = "UnavailabilityForm-module_formField__8he7o", Be = "UnavailabilityForm-module_loading__IDEY6", Oe = "UnavailabilityForm-module_error__jDeOm", Ve = "UnavailabilityForm-module_grid__t6NKR", Fe = "UnavailabilityForm-module_column__QFdnQ", Ce = "UnavailabilityForm-module_dateTimeColumn__6bi0F", Ye = "UnavailabilityForm-module_datePicker__6HgbO", ke = "UnavailabilityForm-module_timePicker__DHNpK", d = {
140
+ }, Se = "UnavailabilityForm-module_formContent__WmNHR", Pe = "UnavailabilityForm-module_formField__8he7o", Be = "UnavailabilityForm-module_loading__IDEY6", Oe = "UnavailabilityForm-module_error__jDeOm", Ve = "UnavailabilityForm-module_grid__t6NKR", Fe = "UnavailabilityForm-module_column__QFdnQ", Ce = "UnavailabilityForm-module_dateTimeColumn__6bi0F", Ye = "UnavailabilityForm-module_datePicker__6HgbO", xe = "UnavailabilityForm-module_timePicker__DHNpK", d = {
141
141
  formContent: Se,
142
142
  formField: Pe,
143
143
  loading: Be,
@@ -146,8 +146,8 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
146
146
  column: Fe,
147
147
  dateTimeColumn: Ce,
148
148
  datePicker: Ye,
149
- timePicker: ke
150
- }, xe = ({
149
+ timePicker: xe
150
+ }, ke = ({
151
151
  errors: e,
152
152
  formDataRef: a,
153
153
  onClearErrors: n
@@ -173,7 +173,7 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
173
173
  ),
174
174
  [A]
175
175
  ), u = N(
176
- () => R(!1, !1, o, ye, {
176
+ () => R(!1, !1, o, De, {
177
177
  loading: "",
178
178
  error: "",
179
179
  empty: t("ADMIN_UNAVAILABILITY_FORM_NO_LOCATIONS")
@@ -183,7 +183,7 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
183
183
  () => R(
184
184
  !1,
185
185
  !1,
186
- De(
186
+ ye(
187
187
  _,
188
188
  t("ADMIN_UNAVAILABILITY_FORM_ALL_SERVICES")
189
189
  ),
@@ -195,7 +195,7 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
195
195
  }
196
196
  ),
197
197
  [_]
198
- ), y = N(
198
+ ), D = N(
199
199
  () => R(
200
200
  !1,
201
201
  !1,
@@ -215,10 +215,10 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
215
215
  return h(() => {
216
216
  if (o.length === 0) return;
217
217
  const i = be(), p = o.some(
218
- (D) => D.uuid === i
218
+ (y) => y.uuid === i
219
219
  );
220
- s((D) => ({
221
- ...D,
220
+ s((y) => ({
221
+ ...y,
222
222
  locationUuid: p ? i : ""
223
223
  }));
224
224
  }, [o]), h(() => {
@@ -229,9 +229,9 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
229
229
  }, [v]), h(() => {
230
230
  I.length > 0 && s((i) => ({
231
231
  ...i,
232
- selectedProviderItems: y
232
+ selectedProviderItems: D
233
233
  }));
234
- }, [y]), a.current = {
234
+ }, [D]), a.current = {
235
235
  ...l,
236
236
  filteredServicesCount: _.length,
237
237
  availableProvidersCount: I.length
@@ -327,7 +327,7 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
327
327
  }
328
328
  ),
329
329
  /* @__PURE__ */ r(
330
- k,
330
+ x,
331
331
  {
332
332
  id: "start-time",
333
333
  "data-testid": "start-time-input",
@@ -342,7 +342,7 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
342
342
  use24HourFormat: !1,
343
343
  className: d.timePicker,
344
344
  children: /* @__PURE__ */ b(
345
- x,
345
+ k,
346
346
  {
347
347
  id: "start-time-period",
348
348
  "data-testid": "start-time-period-select",
@@ -402,7 +402,7 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
402
402
  }
403
403
  ),
404
404
  /* @__PURE__ */ r(
405
- k,
405
+ x,
406
406
  {
407
407
  id: "end-time",
408
408
  "data-testid": "end-time-input",
@@ -417,7 +417,7 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
417
417
  use24HourFormat: !1,
418
418
  className: d.timePicker,
419
419
  children: /* @__PURE__ */ b(
420
- x,
420
+ k,
421
421
  {
422
422
  id: "end-time-period",
423
423
  "data-testid": "end-time-period-select",
@@ -450,7 +450,7 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
450
450
  lg: 8,
451
451
  className: d.column,
452
452
  children: /* @__PURE__ */ r(
453
- $,
453
+ H,
454
454
  {
455
455
  id: "service-multiselect",
456
456
  "data-testid": "service-multiselect",
@@ -478,13 +478,13 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
478
478
  lg: 8,
479
479
  className: d.column,
480
480
  children: /* @__PURE__ */ r(
481
- $,
481
+ H,
482
482
  {
483
483
  id: "provider-multiselect",
484
484
  "data-testid": "provider-multiselect",
485
485
  titleText: t("ADMIN_UNAVAILABILITY_FORM_PROVIDER_LABEL"),
486
486
  placeholder: t("ADMIN_UNAVAILABILITY_FORM_PROVIDER_LABEL"),
487
- items: y,
487
+ items: D,
488
488
  itemToString: (i) => i?.text ?? "",
489
489
  selectedItems: l.selectedProviderItems,
490
490
  onChange: (i) => s({
@@ -501,16 +501,16 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
501
501
  ]
502
502
  }
503
503
  );
504
- }, $e = "index-module_page__s2h2y", He = {
505
- page: $e
504
+ }, He = "index-module_page__s2h2y", $e = {
505
+ page: He
506
506
  }, Qe = () => {
507
- const { t: e } = Q(), a = ve(), { userPrivileges: n } = oe(), { addNotification: t } = de(), [o, c] = g(!1), [A, L] = g(!1), m = Le(null), [l, s] = g({}), _ = H(
507
+ const { t: e } = Q(), a = ve(), { userPrivileges: n } = oe(), { addNotification: t } = de(), [o, c] = g(!1), [A, L] = g(!1), m = Le(null), [l, s] = g({}), _ = $(
508
508
  n,
509
509
  q
510
- ), I = H(n, [
510
+ ), I = $(n, [
511
511
  pe,
512
512
  q
513
- ]), { data: u, isLoading: v, isError: y } = M({
513
+ ]), { data: u, isLoading: v, isError: D } = M({
514
514
  queryKey: ["appointmentUnavailabilities"],
515
515
  queryFn: ce,
516
516
  enabled: _
@@ -537,7 +537,7 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
537
537
  key: "providerName",
538
538
  header: e("ADMIN_UNAVAILABILITY_COLUMN_PROVIDER")
539
539
  }
540
- ], [e]), D = N(() => u ? u.map((T) => ge(T, e)) : [], [u, e]), S = U(
540
+ ], [e]), y = N(() => u ? u.map((T) => ge(T, e)) : [], [u, e]), S = U(
541
541
  async (T) => {
542
542
  L(!0);
543
543
  try {
@@ -586,7 +586,7 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
586
586
  id: "appointment-unavailability-page",
587
587
  "data-testid": "appointment-unavailability-page-test-id",
588
588
  "aria-label": "appointment-unavailability-page-aria-label",
589
- className: He.page,
589
+ className: $e.page,
590
590
  children: /* @__PURE__ */ r(
591
591
  _e,
592
592
  {
@@ -595,10 +595,10 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
595
595
  "aria-label": "appointment-unavailability-actions-table-aria-label",
596
596
  title: e("ADMIN_UNAVAILABILITY_TITLE"),
597
597
  headers: p,
598
- rows: D,
598
+ rows: y,
599
599
  ariaLabel: "unavailability-table",
600
600
  loading: v,
601
- errorStateMessage: y ? e("ADMIN_UNAVAILABILITY_ERROR_MESSAGE") : null,
601
+ errorStateMessage: D ? e("ADMIN_UNAVAILABILITY_ERROR_MESSAGE") : null,
602
602
  emptyStateMessage: e("ADMIN_UNAVAILABILITY_EMPTY_MESSAGE"),
603
603
  actionButton: !o && I ? {
604
604
  label: e("ADMIN_UNAVAILABILITY_ADD_BUTTON"),
@@ -622,7 +622,7 @@ const Ne = "Available for appointments", q = "Get Appointment Unavailability", p
622
622
  onSecondaryButtonClick: J,
623
623
  isSecondaryButtonDisabled: A,
624
624
  content: /* @__PURE__ */ r(
625
- xe,
625
+ ke,
626
626
  {
627
627
  errors: l,
628
628
  formDataRef: m,
@@ -1,5 +1,5 @@
1
1
  import { jsx as n, jsxs as y } from "react/jsx-runtime";
2
- import { s as V, A as O, u as C, i as P, N as h, o as x, l as B, t as L, m as G, p as U, q, r as H, y as F, C as $, H as k, _ as w } from "./index-Z_FLt8Y9.js";
2
+ import { i as V, A as O, u as C, l as P, N as h, o as x, m as B, r as L, p as G, q as U, s as q, t as F, y as H, C as $, U as k, _ as w } from "./index-CWpCbDfm.js";
3
3
  import { useState as I, useMemo as _ } from "react";
4
4
  import { useQueryClient as j, useQuery as K } from "@tanstack/react-query";
5
5
  const Q = V(
@@ -130,7 +130,7 @@ const le = () => {
130
130
  return /* @__PURE__ */ n(
131
131
  q,
132
132
  {
133
- header: /* @__PURE__ */ n(F, { breadcrumbItems: f }),
133
+ header: /* @__PURE__ */ n(H, { breadcrumbItems: f }),
134
134
  main: m ? /* @__PURE__ */ y(
135
135
  "div",
136
136
  {
@@ -140,7 +140,7 @@ const le = () => {
140
140
  className: d.page,
141
141
  children: [
142
142
  /* @__PURE__ */ n(
143
- H,
143
+ F,
144
144
  {
145
145
  id: "all-services",
146
146
  title: e("ADMIN_ALL_SERVICES_TITLE"),
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { b3 as t } from "./index-Z_FLt8Y9.js";
1
+ import { b3 as t } from "./index-CWpCbDfm.js";
2
2
  export {
3
3
  t as AppointmentsApp
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bahmni/appointments-app",
3
- "version": "0.0.1-dev.314",
3
+ "version": "0.0.1-dev.315",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -1,234 +0,0 @@
1
- import { jsx as i, jsxs as re, Fragment as ae } from "react/jsx-runtime";
2
- import { u as te, n as oe, x as se, j as ne, B as de, F as ie, P as le, b as ue, D as q, g as me, a as ce, O as k, w as fe, v as ye, h as he, Q as be, k as pe } from "./index-Z_FLt8Y9.js";
3
- import { useQueryClient as ge, useQuery as h } from "@tanstack/react-query";
4
- import { useState as j, useMemo as d, useCallback as b } from "react";
5
- const Ne = "FormsTable-module_formsTableBody__SvGha", Oe = "FormsTable-module_customAccordianItem__isszs", M = {
6
- formsTableBody: Ne,
7
- customAccordianItem: Oe
8
- }, Ae = (m) => m ? m.extension?.find(
9
- (l) => l.url === pe
10
- )?.valueString : void 0, Ie = ({
11
- episodeOfCareUuids: m,
12
- encounterUuids: l,
13
- config: w
14
- }) => {
15
- const { t: n } = te(), c = oe(), [f, T] = j(!1), [o, v] = j(null), {
16
- numberOfVisits: x,
17
- hideThumbnail: K = !1,
18
- forms: y
19
- } = w ?? {}, F = se(
20
- m,
21
- l
22
- ), Q = ge(), {
23
- data: I = [],
24
- isLoading: B,
25
- isError: E,
26
- error: V,
27
- refetch: H
28
- } = h({
29
- queryKey: ["forms", c, m],
30
- queryFn: () => ne(c, void 0, x),
31
- enabled: !!c && !F
32
- }), L = d(() => {
33
- let e = I;
34
- return l && l.length > 0 && (e = e.filter(
35
- (r) => l.includes(r.encounterUuid)
36
- )), Array.isArray(y) && y.length > 0 && (e = e.filter(
37
- (r) => y.some((a) => a.toLowerCase() === r.formName.toLowerCase())
38
- )), e;
39
- }, [I, l, y]), { data: D = [] } = h({
40
- queryKey: ["observationForms"],
41
- queryFn: () => de()
42
- }), S = b(
43
- (e) => D.find((r) => r.name === e)?.uuid,
44
- [D]
45
- ), p = d(() => {
46
- if (o)
47
- return S(o.formName);
48
- }, [o, S]), {
49
- data: u,
50
- isLoading: $,
51
- isError: z,
52
- error: g
53
- } = h({
54
- queryKey: ["formMetadata", p],
55
- queryFn: () => ie(p),
56
- enabled: !!p && f
57
- }), {
58
- data: N,
59
- isLoading: G,
60
- isError: P,
61
- error: O
62
- } = h({
63
- queryKey: ["formsEncounterFHIR", o?.encounterUuid],
64
- queryFn: () => le(o.encounterUuid),
65
- enabled: !!o?.encounterUuid && f
66
- });
67
- ue(
68
- (e) => {
69
- e.patientUUID === c && e.updatedConcepts.size > 0 && (H(), Q.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
70
- },
71
- [c]
72
- );
73
- const Y = d(() => !N?.entry || !o?.formName ? [] : N.entry.filter((e) => e.resource?.resourceType === "Observation").map((e) => e.resource).filter((e) => {
74
- const r = Ae(e);
75
- return !r || r.includes(o.formName);
76
- }), [N, o?.formName]), J = d(() => {
77
- if (!u?.schema) return;
78
- const e = [], r = (a) => {
79
- (a ?? []).forEach((s) => {
80
- const t = s;
81
- t.id != null && e.push(String(t.id)), t.controls && r(t.controls);
82
- });
83
- };
84
- return r(
85
- u.schema.controls ?? []
86
- ), e.length > 0 ? e : void 0;
87
- }, [u]), W = d(() => {
88
- if (!u?.schema) return;
89
- const e = {}, r = (a, s) => {
90
- for (const t of a)
91
- if (t.type === "section") {
92
- const A = t.label?.value ?? "Section";
93
- r(t.controls ?? [], A);
94
- } else
95
- t.id != null && s && (e[String(t.id)] = s), t.controls && r(t.controls, s);
96
- };
97
- return r(
98
- u.schema.controls ?? [],
99
- null
100
- ), Object.keys(e).length > 0 ? e : void 0;
101
- }, [u]), X = d(() => {
102
- if (g)
103
- return q(g).message;
104
- if (O)
105
- return q(O).message;
106
- }, [g, O]), _ = d(
107
- () => [
108
- { key: "recordedOn", header: n("RECORDED_ON") },
109
- { key: "recordedBy", header: n("RECORDED_BY") }
110
- ],
111
- [n]
112
- ), Z = d(
113
- () => [
114
- { key: "recordedOn", sortable: !0 },
115
- { key: "recordedBy", sortable: !0 }
116
- ],
117
- []
118
- ), C = d(() => {
119
- const e = L.reduce(
120
- (r, a) => {
121
- const s = a.formName;
122
- r[s] ??= [];
123
- const t = a.providers.map((A) => A.providerName).filter(Boolean).join(", ");
124
- return r[s].push({
125
- id: a.encounterUuid,
126
- formName: a.formName,
127
- recordedOn: me(a.encounterDateTime, n, !0).formattedResult,
128
- recordedBy: t ?? "--",
129
- encounterDateTime: a.encounterDateTime,
130
- encounterUuid: a.encounterUuid
131
- }), r;
132
- },
133
- {}
134
- );
135
- return Object.entries(e).map(
136
- ([r, a]) => ({
137
- formName: r,
138
- records: a.sort(
139
- (s, t) => t.encounterDateTime - s.encounterDateTime
140
- )
141
- })
142
- ).sort((r, a) => r.formName.localeCompare(a.formName));
143
- }, [L, n]), R = b((e) => {
144
- v(e), T(!0);
145
- }, []), ee = b(() => {
146
- T(!1), v(null);
147
- }, []), U = b(
148
- (e, r) => {
149
- switch (r) {
150
- case "recordedOn":
151
- return /* @__PURE__ */ i(ce, { onClick: () => R(e), children: e.recordedOn });
152
- case "recordedBy":
153
- return e.recordedBy;
154
- default:
155
- return null;
156
- }
157
- },
158
- [R]
159
- );
160
- return /* @__PURE__ */ re(ae, { children: [
161
- /* @__PURE__ */ i("div", { id: "forms-table", "data-testid": "forms-table", children: B || E || C.length === 0 || F ? /* @__PURE__ */ i(
162
- k,
163
- {
164
- headers: _,
165
- ariaLabel: n("FORMS_HEADING"),
166
- rows: [],
167
- loading: B,
168
- errorStateMessage: E ? V?.message : void 0,
169
- emptyStateMessage: n("FORMS_UNAVAILABLE"),
170
- renderCell: U,
171
- className: M.formsTableBody,
172
- dataTestId: "forms-table"
173
- }
174
- ) : /* @__PURE__ */ i(fe, { align: "start", children: C.map((e, r) => {
175
- const { formName: a, records: s } = e;
176
- return /* @__PURE__ */ i(
177
- ye,
178
- {
179
- title: a,
180
- className: M.customAccordianItem,
181
- testId: `accordian-title-${a}`,
182
- open: r === 0,
183
- children: /* @__PURE__ */ i(
184
- k,
185
- {
186
- headers: _,
187
- ariaLabel: n("FORMS_HEADING"),
188
- rows: s,
189
- loading: !1,
190
- errorStateMessage: "",
191
- sortable: Z,
192
- emptyStateMessage: n("FORMS_UNAVAILABLE"),
193
- renderCell: U,
194
- className: M.formsTableBody,
195
- dataTestId: `forms-table-${a}`
196
- }
197
- )
198
- },
199
- a
200
- );
201
- }) }) }),
202
- f && o && /* @__PURE__ */ i(
203
- he,
204
- {
205
- id: "modalIdForActionAreaLayout",
206
- portalId: "main-display-area",
207
- open: f,
208
- onRequestClose: ee,
209
- modalHeading: o.formName,
210
- modalLabel: `${o.recordedOn} | ${o.recordedBy}`,
211
- passiveModal: !0,
212
- size: "md",
213
- testId: "form-details-modal",
214
- children: /* @__PURE__ */ i(
215
- be,
216
- {
217
- observations: Y,
218
- isLoading: $ || G,
219
- isError: z || P,
220
- errorMessage: X,
221
- emptyStateMessage: n("NO_FORM_DATA_AVAILABLE"),
222
- testIdPrefix: o.formName,
223
- hideThumbnail: K,
224
- controlOrder: J,
225
- sectionMap: W
226
- }
227
- )
228
- }
229
- )
230
- ] });
231
- };
232
- export {
233
- Ie as default
234
- };