@bahmni/widgets 0.0.1-dev.457 → 0.0.1-dev.459

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,388 @@
1
+ import { jsx as a, jsxs as T, Fragment as _e } from "react/jsx-runtime";
2
+ import { u as pe, a as Ae, b as Ee, d as ge, r as fe, c as Ce, e as S, p as Ne, $ as Ie, f as De, E as Le, g as be, z as Q, A as Oe, h as Se, L as ve, W as ye, i as we, j as J, k as ee } from "./index-BgKZQd55.js";
3
+ import { useQuery as Ue } from "@tanstack/react-query";
4
+ import { useState as _, useRef as Me, useEffect as A, useMemo as E, useCallback as p } from "react";
5
+ import { useTranslation as Re } from "react-i18next";
6
+ const ke = "DocumentsTable-module_documentsTableBody__6iR3w", Pe = "DocumentsTable-module_viewAttachmentsLink__aQ1on", Be = "DocumentsTable-module_documentViewerContainer__F5m8D", He = "DocumentsTable-module_printContainer__rtarJ", $e = "DocumentsTable-module_attachmentItem__17KA7", ze = "DocumentsTable-module_attachmentCounter__WFiI3", Fe = "DocumentsTable-module_attachmentError__RI4U2", Ve = "DocumentsTable-module_documentIframe__ptq5I", We = "DocumentsTable-module_attachmentContent__IaCEe", Ge = "DocumentsTable-module_attachmentLoading__FAR6p", qe = "DocumentsTable-module_hiddenWhileLoading__IxocW", Ke = "DocumentsTable-module_documentImage__KQVgS", je = "DocumentsTable-module_header__345GY", Ye = "DocumentsTable-module_documentTypeCell__uWGM8", Qe = "DocumentsTable-module_printAllButton__IVYUW", Je = "DocumentsTable-module_attachmentHeader__yI2xn", s = {
7
+ documentsTableBody: ke,
8
+ viewAttachmentsLink: Pe,
9
+ documentViewerContainer: Be,
10
+ printContainer: He,
11
+ attachmentItem: $e,
12
+ attachmentCounter: ze,
13
+ attachmentError: Fe,
14
+ documentIframe: Ve,
15
+ attachmentContent: We,
16
+ attachmentLoading: Ge,
17
+ hiddenWhileLoading: qe,
18
+ documentImage: Ke,
19
+ header: je,
20
+ documentTypeCell: Ye,
21
+ printAllButton: Qe,
22
+ attachmentHeader: Je
23
+ }, Xe = "startConsultation", Ze = "add", xe = "documents", X = "document-print-container", Z = () => /* @__PURE__ */ a(ee, {}), et = /* @__PURE__ */ new Set([
24
+ "ArrowUp",
25
+ "ArrowDown",
26
+ "PageUp",
27
+ "PageDown",
28
+ "Home",
29
+ "End",
30
+ " "
31
+ ]), tt = 15e3, nt = [
32
+ "documentType",
33
+ "documentIdentifier",
34
+ "attachments",
35
+ "uploadedOn",
36
+ "uploadedBy"
37
+ ], at = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, x = (l) => l.attachments.length > 0 ? l.attachments : l.documentUrl ? [{ url: l.documentUrl, contentType: l.contentType }] : [], dt = ({ config: l, encounterUuids: B }) => {
38
+ const [u, H] = _(!1), [r, $] = _(
39
+ null
40
+ ), [D, v] = _(
41
+ /* @__PURE__ */ new Set()
42
+ ), [L, y] = _(
43
+ /* @__PURE__ */ new Set()
44
+ ), C = Me(null), [w, z] = _(
45
+ null
46
+ ), F = w !== null;
47
+ A(() => () => C.current?.abort(), []);
48
+ const g = pe(), { t: o } = Re(), { addNotification: b } = Ae(), m = E(
49
+ () => l?.actions?.find(
50
+ (e) => e.type === Ze
51
+ ),
52
+ [l?.actions]
53
+ ), te = Ee(m?.requiredPrivilege), ne = !!m && te, ae = Number(l?.pageSize) || 5, [U, M] = _(1), [N, oe] = _(ae), [se, R] = _(void 0), V = p((e) => {
54
+ $(e), H(!0);
55
+ }, []), re = p(() => {
56
+ C.current?.abort(), y(/* @__PURE__ */ new Set()), H(!1), $(null), v(/* @__PURE__ */ new Set());
57
+ }, []), W = p((e) => {
58
+ y((t) => new Set(t).add(e));
59
+ }, []), G = p((e) => {
60
+ v((t) => new Set(t).add(e));
61
+ }, []), ce = p(() => {
62
+ m && globalThis.dispatchEvent(
63
+ new CustomEvent(Xe, {
64
+ detail: {
65
+ encounterType: m.encounterType,
66
+ editOnly: m.editOnly ?? xe,
67
+ ...m.editTitle ? { editTitle: m.editTitle } : {}
68
+ }
69
+ })
70
+ );
71
+ }, [m]), { data: I, isLoading: le, isError: k, error: P, refetch: q } = Ue({
72
+ queryKey: [
73
+ "documents",
74
+ g,
75
+ B,
76
+ U,
77
+ N
78
+ ],
79
+ enabled: !!g,
80
+ queryFn: () => ge(
81
+ g,
82
+ B,
83
+ N,
84
+ U
85
+ )
86
+ });
87
+ fe(
88
+ (e) => {
89
+ e.patientUUID === g && e.updatedResources.documents && q();
90
+ },
91
+ [g, q]
92
+ ), A(() => {
93
+ I && R(I.total);
94
+ }, [I]), A(() => {
95
+ M(1), R(void 0);
96
+ }, [g]), A(() => {
97
+ k && b({
98
+ title: o("ERROR_DEFAULT_TITLE"),
99
+ message: P?.message ?? "",
100
+ type: "error"
101
+ });
102
+ }, [k, P, b, o]), A(() => {
103
+ const e = new AbortController();
104
+ return (async () => {
105
+ if (!u || !r) return;
106
+ const n = /* @__PURE__ */ new Set(), i = x(r);
107
+ for (let c = 0; c < i.length; c++) {
108
+ const f = S(i[c].url);
109
+ try {
110
+ (await fetch(f, {
111
+ method: "HEAD",
112
+ signal: e.signal
113
+ })).ok || n.add(c);
114
+ } catch (h) {
115
+ h instanceof Error && h.name !== "AbortError" && n.add(c);
116
+ }
117
+ }
118
+ e.signal.aborted || v(n);
119
+ })(), () => e.abort();
120
+ }, [u, r]), A(() => {
121
+ if (!u || !r) return;
122
+ const e = document.querySelector(
123
+ '[data-testid="document-view-modal"] .cds--modal-content'
124
+ );
125
+ if (!e) return;
126
+ let t = !1;
127
+ const n = () => {
128
+ t = !0;
129
+ }, i = (h) => {
130
+ h.target === e && n();
131
+ }, c = (h) => {
132
+ const Te = h.target;
133
+ et.has(h.key) && !Te?.closest("button, input, textarea, select, a") && n();
134
+ }, f = () => {
135
+ !t && e.scrollTop !== 0 && (e.scrollTop = 0);
136
+ };
137
+ return e.addEventListener("wheel", n, { passive: !0 }), e.addEventListener("touchmove", n, { passive: !0 }), e.addEventListener("mousedown", i), e.addEventListener("keydown", c), e.addEventListener("scroll", f), () => {
138
+ e.removeEventListener("wheel", n), e.removeEventListener("touchmove", n), e.removeEventListener("mousedown", i), e.removeEventListener("keydown", c), e.removeEventListener("scroll", f);
139
+ };
140
+ }, [u, r]);
141
+ const de = p(
142
+ (e, t) => {
143
+ t !== N ? (oe(t), M(1), R(void 0)) : M(e);
144
+ },
145
+ [N]
146
+ ), O = E(
147
+ () => l?.fields ?? nt,
148
+ [l?.fields]
149
+ ), ie = E(() => [...I?.documents ?? []].sort((t, n) => !t.uploadedOn && !n.uploadedOn ? 0 : t.uploadedOn ? n.uploadedOn ? new Date(n.uploadedOn).getTime() - new Date(t.uploadedOn).getTime() : -1 : 1), [I]), me = E(() => Ce(O, o), [O, o]), ue = E(
150
+ () => O.map((e) => ({
151
+ key: e,
152
+ sortable: e !== "attachments"
153
+ })),
154
+ [O]
155
+ ), d = E(
156
+ () => r ? x(r) : [],
157
+ [r]
158
+ ), K = d.every(
159
+ (e, t) => L.has(t) || D.has(t) || S(e.url) === "#"
160
+ );
161
+ A(() => {
162
+ if (!u || d.length === 0) return;
163
+ const e = setTimeout(
164
+ () => y(new Set(d.keys())),
165
+ tt
166
+ );
167
+ return () => clearTimeout(e);
168
+ }, [u, d]);
169
+ const j = p(
170
+ async (e, t) => {
171
+ if (!r || C.current) return;
172
+ const n = new AbortController(), { signal: i } = n;
173
+ C.current = n, z(t);
174
+ const c = document.getElementById(X);
175
+ try {
176
+ await Ne(
177
+ e,
178
+ r.documentIdentifier,
179
+ { container: c, signal: i }
180
+ );
181
+ } catch {
182
+ i.aborted || b({
183
+ title: o("ERROR_DEFAULT_TITLE"),
184
+ message: o("DOCUMENTS_ERROR_LOADING_ATTACHMENT"),
185
+ type: "error"
186
+ });
187
+ } finally {
188
+ C.current = null, z(null);
189
+ }
190
+ },
191
+ [r, b, o]
192
+ ), Y = E(
193
+ () => d.filter(
194
+ (e, t) => S(e.url) !== "#" && !D.has(t)
195
+ ),
196
+ [d, D]
197
+ ), he = p(
198
+ (e, t) => {
199
+ switch (t) {
200
+ case "documentIdentifier":
201
+ return /* @__PURE__ */ a("span", { children: e.documentIdentifier?.trim() || "-" });
202
+ case "documentType":
203
+ return /* @__PURE__ */ T("div", { className: s.documentTypeCell, children: [
204
+ /* @__PURE__ */ a("span", { children: e.documentType ?? o("DOCUMENTS_NOT_AVAILABLE") }),
205
+ e.description && /* @__PURE__ */ a(
206
+ Le,
207
+ {
208
+ iconName: "fa-file-lines",
209
+ content: e.description,
210
+ ariaLabel: e.description,
211
+ testId: `document-notes-${e.id}`
212
+ }
213
+ )
214
+ ] });
215
+ case "uploadedOn":
216
+ return De(
217
+ e.uploadedOn,
218
+ o,
219
+ !0
220
+ ).formattedResult || o("DOCUMENTS_NOT_AVAILABLE");
221
+ case "uploadedBy":
222
+ return e.uploadedBy ?? o("DOCUMENTS_NOT_AVAILABLE");
223
+ case "attachments":
224
+ return e.attachments.length > 0 || !!e.documentUrl ? /* @__PURE__ */ a(
225
+ Ie,
226
+ {
227
+ onClick: () => V(e),
228
+ className: s.viewAttachmentsLink,
229
+ "data-testid": `view-attachments-${e.id}`,
230
+ children: o("DOCUMENTS_VIEW_ATTACHMENTS")
231
+ }
232
+ ) : "--";
233
+ default:
234
+ return null;
235
+ }
236
+ },
237
+ [V, o]
238
+ );
239
+ return /* @__PURE__ */ T(_e, { children: [
240
+ ne && /* @__PURE__ */ T(be, { className: s.header, testId: "documents-header", children: [
241
+ /* @__PURE__ */ a("p", { children: o("DOCUMENTS_TABLE_HEADING") }),
242
+ /* @__PURE__ */ a(
243
+ Q,
244
+ {
245
+ autoAlign: !0,
246
+ size: "lg",
247
+ kind: "ghost",
248
+ label: o(m.label),
249
+ testId: "documents-add-button",
250
+ onClick: ce,
251
+ children: /* @__PURE__ */ a(Oe, { id: "documents-add-icon", name: "fa-plus", size: Se.LG })
252
+ }
253
+ )
254
+ ] }),
255
+ /* @__PURE__ */ a("div", { "data-testid": "documents-table", children: /* @__PURE__ */ a(
256
+ ve,
257
+ {
258
+ headers: me,
259
+ ariaLabel: o("DOCUMENTS_TABLE_HEADING"),
260
+ rows: ie,
261
+ loading: le,
262
+ errorStateMessage: k ? P?.message : null,
263
+ sortable: ue,
264
+ emptyStateMessage: o("DOCUMENTS_NO_RECORDS"),
265
+ renderCell: he,
266
+ className: s.documentsTableBody,
267
+ dataTestId: "documents-table",
268
+ pageSize: N,
269
+ totalItems: se,
270
+ page: U,
271
+ onPageChange: de
272
+ }
273
+ ) }),
274
+ u && r && /* @__PURE__ */ a(
275
+ ye,
276
+ {
277
+ id: "modalIdForActionAreaLayout",
278
+ portalId: "main-display-area",
279
+ open: u,
280
+ onRequestClose: re,
281
+ modalHeading: r.documentIdentifier,
282
+ passiveModal: !0,
283
+ size: "lg",
284
+ testId: "document-view-modal",
285
+ children: /* @__PURE__ */ T("div", { className: s.documentViewerContainer, children: [
286
+ Y.length > 1 && /* @__PURE__ */ a(
287
+ we,
288
+ {
289
+ kind: "tertiary",
290
+ size: "sm",
291
+ className: s.printAllButton,
292
+ renderIcon: w === "all" ? Z : J,
293
+ disabled: F || !K,
294
+ testId: "print-all-attachments",
295
+ onClick: () => j(Y, "all"),
296
+ children: o("DOCUMENTS_PRINT_ALL")
297
+ }
298
+ ),
299
+ d.map((e, t) => {
300
+ const n = S(e.url), i = e.contentType?.toLowerCase().includes("pdf"), c = (e.contentType?.toLowerCase().includes("image") ?? !1) || at.test(e.url ?? ""), f = D.has(t);
301
+ return n === "#" || f ? /* @__PURE__ */ T(
302
+ "div",
303
+ {
304
+ className: s.attachmentError,
305
+ "data-testid": `attachment-error-${t}`,
306
+ children: [
307
+ d.length > 1 && /* @__PURE__ */ a("p", { className: s.attachmentCounter, children: o("DOCUMENTS_ATTACHMENT_COUNTER", {
308
+ current: t + 1,
309
+ total: d.length
310
+ }) }),
311
+ /* @__PURE__ */ a("p", { children: o("DOCUMENTS_ERROR_LOADING_ATTACHMENT") })
312
+ ]
313
+ },
314
+ `${r.id}-${e.url}`
315
+ ) : /* @__PURE__ */ T(
316
+ "div",
317
+ {
318
+ className: s.attachmentItem,
319
+ "data-testid": `attachment-item-${t}`,
320
+ children: [
321
+ /* @__PURE__ */ T("div", { className: s.attachmentHeader, children: [
322
+ d.length > 1 ? /* @__PURE__ */ a("p", { className: s.attachmentCounter, children: o("DOCUMENTS_ATTACHMENT_COUNTER", {
323
+ current: t + 1,
324
+ total: d.length
325
+ }) }) : /* @__PURE__ */ a("span", {}),
326
+ /* @__PURE__ */ a(
327
+ Q,
328
+ {
329
+ kind: "ghost",
330
+ size: "sm",
331
+ label: o("DOCUMENTS_PRINT_ATTACHMENT", {
332
+ index: t + 1
333
+ }),
334
+ disabled: F || !K,
335
+ testId: `print-attachment-${t}`,
336
+ onClick: () => j([e], t),
337
+ children: w === t ? /* @__PURE__ */ a(Z, {}) : /* @__PURE__ */ a(J, {})
338
+ }
339
+ )
340
+ ] }),
341
+ /* @__PURE__ */ T("div", { className: s.attachmentContent, children: [
342
+ !L.has(t) && /* @__PURE__ */ a(
343
+ "div",
344
+ {
345
+ className: s.attachmentLoading,
346
+ "data-testid": `attachment-loading-${t}`,
347
+ children: /* @__PURE__ */ a(
348
+ ee,
349
+ {
350
+ description: o("DOCUMENTS_LOADING_ATTACHMENT")
351
+ }
352
+ )
353
+ }
354
+ ),
355
+ c ? /* @__PURE__ */ a(
356
+ "img",
357
+ {
358
+ src: n,
359
+ alt: r.documentIdentifier,
360
+ className: `${s.documentImage} ${L.has(t) ? "" : s.hiddenWhileLoading}`,
361
+ onLoad: () => W(t),
362
+ onError: () => G(t)
363
+ }
364
+ ) : /* @__PURE__ */ a(
365
+ "iframe",
366
+ {
367
+ src: i ? `${n}#toolbar=0` : n,
368
+ className: `${s.documentIframe} ${L.has(t) ? "" : s.hiddenWhileLoading}`,
369
+ title: r.documentIdentifier,
370
+ onLoad: () => W(t),
371
+ onError: () => G(t)
372
+ }
373
+ )
374
+ ] })
375
+ ]
376
+ },
377
+ `${r.id}-${e.url}`
378
+ );
379
+ }),
380
+ /* @__PURE__ */ a("div", { id: X, className: s.printContainer })
381
+ ] })
382
+ }
383
+ )
384
+ ] });
385
+ };
386
+ export {
387
+ dt as default
388
+ };
@@ -1,46 +1,46 @@
1
- import { jsx as n, jsxs as q, Fragment as ie } from "react/jsx-runtime";
2
- import { u as de, c as le, j as me, L as ce, U as ue, k as fe, l as be, Z as he, m as Ne, n as ye, J as Oe, e as ge, _ as x, P as V, A as Te, x as $, o as pe, q as Ee, W as Ie, O as Ae, C as Fe } from "./index-B4qp8zC7.js";
3
- import { useQueryClient as _e, useQuery as A } from "@tanstack/react-query";
4
- import { useState as j, useMemo as i, useCallback as d } from "react";
5
- import { useTranslation as ve } from "react-i18next";
6
- const Re = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_modalHeading__wnTmA", De = "FormsTable-module_customAccordianItem__isszs", y = {
1
+ import { jsx as n, jsxs as P, Fragment as ie } from "react/jsx-runtime";
2
+ import { u as de, b as le, l as me, m as ce, q as ue, n as fe, y as be, r as ye, o as he, s as Ne, Q as Oe, f as ge, z as V, F as x, $ as Te, L as $, t as pe, v as Ee, W as Ie, O as Fe, C as Ae } from "./index-BgKZQd55.js";
3
+ import { useQueryClient as ve, useQuery as F } from "@tanstack/react-query";
4
+ import { useState as z, useMemo as i, useCallback as d } from "react";
5
+ import { useTranslation as _e } from "react-i18next";
6
+ const Re = "FormsTable-module_formsTableBody__SvGha", De = "FormsTable-module_modalHeading__wnTmA", Le = "FormsTable-module_customAccordianItem__isszs", N = {
7
7
  formsTableBody: Re,
8
- modalHeading: Le,
9
- customAccordianItem: De
10
- }, Ce = "startConsultation", ke = ({
11
- episodeOfCareUuids: F,
8
+ modalHeading: De,
9
+ customAccordianItem: Le
10
+ }, Ce = "startConsultation", Ue = ({
11
+ episodeOfCareUuids: A,
12
12
  encounterUuids: m,
13
13
  config: G,
14
- disableActions: z = !1,
14
+ disableActions: Q = !1,
15
15
  activeEncounterUuid: b = null
16
16
  }) => {
17
- const { t: o } = ve(), c = de(), [O, _] = j(!1), [a, v] = j(null), {
18
- numberOfVisits: K,
19
- hideThumbnail: Q = !1,
20
- forms: h
17
+ const { t: o } = _e(), c = de(), [O, v] = z(!1), [a, _] = z(null), {
18
+ numberOfVisits: j,
19
+ hideThumbnail: K = !1,
20
+ forms: y
21
21
  } = G ?? {}, W = le(
22
- Fe.EDIT_OBSERVATIONS
23
- ), { userPrivileges: N } = me(), g = W && !z && !!b, R = ce(
24
- F,
22
+ Ae.EDIT_OBSERVATIONS
23
+ ), { userPrivileges: h } = me(), g = W && !Q && !!b, R = ce(
24
+ A,
25
25
  m
26
- ), J = _e(), {
27
- data: L = [],
28
- isLoading: D,
26
+ ), Y = ve(), {
27
+ data: D = [],
28
+ isLoading: L,
29
29
  isError: C,
30
- error: Z,
31
- refetch: Y
32
- } = A({
33
- queryKey: ["forms", c, F],
34
- queryFn: () => ue(c, void 0, K),
30
+ error: J,
31
+ refetch: X
32
+ } = F({
33
+ queryKey: ["forms", c, A],
34
+ queryFn: () => ue(c, void 0, j),
35
35
  enabled: !!c && !R
36
36
  }), S = i(() => {
37
- let e = L;
37
+ let e = D;
38
38
  return m && m.length > 0 && (e = e.filter(
39
39
  (t) => m.includes(t.encounterUuid)
40
- )), Array.isArray(h) && h.length > 0 && (e = e.filter(
41
- (t) => h.some((s) => s.toLowerCase() === t.formName.toLowerCase())
40
+ )), Array.isArray(y) && y.length > 0 && (e = e.filter(
41
+ (t) => y.some((s) => s.toLowerCase() === t.formName.toLowerCase())
42
42
  )), e;
43
- }, [L, m, h]), { data: B = [] } = A({
43
+ }, [D, m, y]), { data: B = [] } = F({
44
44
  queryKey: ["observationForms"],
45
45
  queryFn: () => fe()
46
46
  }), M = d(
@@ -49,33 +49,33 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
49
49
  (r) => r.name.toLowerCase() === e.toLowerCase()
50
50
  );
51
51
  if (!t?.privileges || t.privileges.length === 0) return !0;
52
- if (!N || N.length === 0) return !1;
53
- const s = new Set(N.map((r) => r.name));
52
+ if (!h || h.length === 0) return !1;
53
+ const s = new Set(h.map((r) => r.name));
54
54
  return t.privileges.some(
55
55
  (r) => s.has(r.privilegeName) && r.editable
56
56
  );
57
57
  },
58
- [B, N]
58
+ [B, h]
59
59
  ), u = d(
60
60
  (e) => !b || e.encounterUuid !== b ? !1 : M(e.formName),
61
61
  [b, M]
62
62
  ), {
63
63
  data: T,
64
- isLoading: X,
64
+ isLoading: Z,
65
65
  isError: ee,
66
66
  error: p
67
- } = A({
67
+ } = F({
68
68
  queryKey: ["formsEncounterFHIR", a?.encounterUuid],
69
69
  queryFn: () => be(a.encounterUuid),
70
70
  enabled: !!a?.encounterUuid && O
71
71
  });
72
- he(
72
+ ye(
73
73
  (e) => {
74
- e.patientUUID === c && (Y(), J.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
74
+ e.patientUUID === c && (X(), Y.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
75
75
  },
76
76
  [c]
77
77
  );
78
- const re = i(() => !T?.entry || !a?.formName ? [] : T.entry.filter((t) => t.resource?.resourceType === "Observation").map((t) => t.resource).filter((t) => Ne(t) ? ye(t)?.toLowerCase() === a.formName.toLowerCase() : !0), [T, a?.formName]), te = i(() => {
78
+ const re = i(() => !T?.entry || !a?.formName ? [] : T.entry.filter((t) => t.resource?.resourceType === "Observation").map((t) => t.resource).filter((t) => he(t) ? Ne(t)?.toLowerCase() === a.formName.toLowerCase() : !0), [T, a?.formName]), te = i(() => {
79
79
  if (p)
80
80
  return Oe(p).message;
81
81
  }, [p]), f = i(
@@ -96,7 +96,7 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
96
96
  { key: "recordedBy", sortable: !0 }
97
97
  ],
98
98
  []
99
- ), U = i(() => {
99
+ ), k = i(() => {
100
100
  const e = S.reduce(
101
101
  (s, r) => {
102
102
  const l = r.formName;
@@ -121,10 +121,10 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
121
121
  )
122
122
  })
123
123
  ).sort((s, r) => s.formName.localeCompare(r.formName));
124
- }, [S, o]), k = d((e) => {
125
- v(e), _(!0);
124
+ }, [S, o]), U = d((e) => {
125
+ _(e), v(!0);
126
126
  }, []), H = d(() => {
127
- _(!1), v(null);
127
+ v(!1), _(null);
128
128
  }, []), E = d((e) => {
129
129
  globalThis.dispatchEvent(
130
130
  new CustomEvent(Ce, {
@@ -137,52 +137,52 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
137
137
  }
138
138
  })
139
139
  );
140
- }, []), P = d(
140
+ }, []), q = d(
141
141
  (e, t) => {
142
142
  switch (t) {
143
143
  case "recordedOn":
144
- return /* @__PURE__ */ n(Te, { onClick: () => k(e), children: e.recordedOn });
144
+ return /* @__PURE__ */ n(Te, { onClick: () => U(e), children: e.recordedOn });
145
145
  case "recordedBy":
146
146
  return e.recordedBy;
147
147
  case "actions":
148
148
  return u(e) ? /* @__PURE__ */ n(
149
- x,
149
+ V,
150
150
  {
151
151
  label: o("EDIT_OBSERVATION_FORM"),
152
152
  kind: "ghost",
153
153
  size: "sm",
154
154
  testId: `edit-form-${e.encounterUuid}`,
155
155
  onClick: () => E(e),
156
- children: /* @__PURE__ */ n(V, {})
156
+ children: /* @__PURE__ */ n(x, {})
157
157
  }
158
158
  ) : null;
159
159
  default:
160
160
  return null;
161
161
  }
162
162
  },
163
- [k, E, u, o]
163
+ [U, E, u, o]
164
164
  );
165
- return /* @__PURE__ */ q(ie, { children: [
166
- /* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: D || C || U.length === 0 || R ? /* @__PURE__ */ n(
165
+ return /* @__PURE__ */ P(ie, { children: [
166
+ /* @__PURE__ */ n("div", { id: "forms-table", "data-testid": "forms-table", children: L || C || k.length === 0 || R ? /* @__PURE__ */ n(
167
167
  $,
168
168
  {
169
169
  headers: oe,
170
170
  ariaLabel: o("FORMS_HEADING"),
171
171
  rows: [],
172
- loading: D,
173
- errorStateMessage: C ? Z?.message : void 0,
172
+ loading: L,
173
+ errorStateMessage: C ? J?.message : void 0,
174
174
  emptyStateMessage: o("FORMS_UNAVAILABLE"),
175
- renderCell: P,
176
- className: y.formsTableBody,
175
+ renderCell: q,
176
+ className: N.formsTableBody,
177
177
  dataTestId: "forms-table"
178
178
  }
179
- ) : /* @__PURE__ */ n(pe, { align: "start", children: U.map((e, t) => {
179
+ ) : /* @__PURE__ */ n(pe, { align: "start", children: k.map((e, t) => {
180
180
  const { formName: s, records: r } = e, l = se(r);
181
181
  return /* @__PURE__ */ n(
182
182
  Ee,
183
183
  {
184
184
  title: s,
185
- className: y.customAccordianItem,
185
+ className: N.customAccordianItem,
186
186
  testId: `accordian-title-${s}`,
187
187
  open: t === 0,
188
188
  children: /* @__PURE__ */ n(
@@ -195,8 +195,8 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
195
195
  errorStateMessage: "",
196
196
  sortable: ae,
197
197
  emptyStateMessage: o("FORMS_UNAVAILABLE"),
198
- renderCell: P,
199
- className: y.formsTableBody,
198
+ renderCell: q,
199
+ className: N.formsTableBody,
200
200
  dataTestId: `forms-table-${s}`
201
201
  }
202
202
  )
@@ -211,10 +211,10 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
211
211
  portalId: "main-display-area",
212
212
  open: O,
213
213
  onRequestClose: H,
214
- modalHeading: /* @__PURE__ */ q("div", { className: y.modalHeading, children: [
214
+ modalHeading: /* @__PURE__ */ P("div", { className: N.modalHeading, children: [
215
215
  /* @__PURE__ */ n("span", { children: a.formName }),
216
216
  g && u(a) && /* @__PURE__ */ n(
217
- x,
217
+ V,
218
218
  {
219
219
  label: o("EDIT_OBSERVATION_FORM"),
220
220
  kind: "ghost",
@@ -223,7 +223,7 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
223
223
  onClick: () => {
224
224
  H(), E(a);
225
225
  },
226
- children: /* @__PURE__ */ n(V, {})
226
+ children: /* @__PURE__ */ n(x, {})
227
227
  }
228
228
  )
229
229
  ] }),
@@ -232,15 +232,15 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
232
232
  size: "md",
233
233
  testId: "form-details-modal",
234
234
  children: /* @__PURE__ */ n(
235
- Ae,
235
+ Fe,
236
236
  {
237
237
  observations: re,
238
- isLoading: X,
238
+ isLoading: Z,
239
239
  isError: ee,
240
240
  errorMessage: te,
241
241
  emptyStateMessage: o("NO_FORM_DATA_AVAILABLE"),
242
242
  testIdPrefix: a.formName,
243
- hideThumbnail: Q,
243
+ hideThumbnail: K,
244
244
  formName: a.formName
245
245
  }
246
246
  )
@@ -249,5 +249,5 @@ const Re = "FormsTable-module_formsTableBody__SvGha", Le = "FormsTable-module_mo
249
249
  ] });
250
250
  };
251
251
  export {
252
- ke as default
252
+ Ue as default
253
253
  };