@bahmni/widgets 0.0.1-dev.210 → 0.0.1-dev.214

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.
Files changed (26) hide show
  1. package/dist/{DocumentsTable-BNl5LEfL.js → DocumentsTable-BDaihbFL.js} +28 -28
  2. package/dist/FormsTable-DNAxVS6U.js +436 -0
  3. package/dist/Observations-ByRwpI4F.js +214 -0
  4. package/dist/appointments/AppointmentsTable.d.ts.map +1 -1
  5. package/dist/appointments/components/AppointmentTabContent.d.ts +4 -0
  6. package/dist/appointments/components/AppointmentTabContent.d.ts.map +1 -1
  7. package/dist/appointments/components/PastAppointments.d.ts +1 -1
  8. package/dist/appointments/components/PastAppointments.d.ts.map +1 -1
  9. package/dist/appointments/components/UpcomingAppointments.d.ts +1 -0
  10. package/dist/appointments/components/UpcomingAppointments.d.ts.map +1 -1
  11. package/dist/appointments/components/__tests__/appointmentComponentTestHelper.d.ts.map +1 -1
  12. package/dist/appointments/hooks/usePaginatedAppointments.d.ts +20 -0
  13. package/dist/appointments/hooks/usePaginatedAppointments.d.ts.map +1 -0
  14. package/dist/forms/FormsTable.d.ts.map +1 -1
  15. package/dist/forms/ObservationItem.d.ts +1 -0
  16. package/dist/forms/ObservationItem.d.ts.map +1 -1
  17. package/dist/{index-BuDLotQZ.js → index-CCRQ_2lk.js} +7847 -7764
  18. package/dist/index.css +1 -1
  19. package/dist/index.js +15 -15
  20. package/dist/observations/Observations.d.ts +1 -0
  21. package/dist/observations/Observations.d.ts.map +1 -1
  22. package/dist/observations/components/ObsByEncounter.d.ts +1 -0
  23. package/dist/observations/components/ObsByEncounter.d.ts.map +1 -1
  24. package/package.json +1 -1
  25. package/dist/FormsTable-BGyseGA8.js +0 -423
  26. package/dist/Observations-Dd1b2dbj.js +0 -172
@@ -1,5 +1,5 @@
1
- import { jsx as s, jsxs as _, Fragment as K } from "react/jsx-runtime";
2
- import { u as Z, a as Q, T as W, X as J, Z as x, h as ee, b as te } from "./index-BuDLotQZ.js";
1
+ import { jsx as s, jsxs as _, Fragment as Q } from "react/jsx-runtime";
2
+ import { u as W, a as X, C as J, t as Z, b as x, h as ee, y as te } from "./index-CCRQ_2lk.js";
3
3
  import { useQuery as ne } from "@tanstack/react-query";
4
4
  import { useState as l, useCallback as p, useEffect as N, useMemo as f } from "react";
5
5
  import { useTranslation as ae } from "react-i18next";
@@ -22,10 +22,10 @@ const oe = "_documentsTableBody_1voj8_1", re = "_viewAttachmentsLink_1voj8_11",
22
22
  function j(n) {
23
23
  return !n || n.includes(":") ? "#" : `/openmrs/auth?requested_document=/document_images/${n}`;
24
24
  }
25
- function he(n, T) {
25
+ function he(n, E) {
26
26
  return n.map((d) => ({
27
27
  key: d,
28
- header: T(ue[d])
28
+ header: E(ue[d])
29
29
  }));
30
30
  }
31
31
  const _e = [
@@ -34,44 +34,44 @@ const _e = [
34
34
  "uploadedOn",
35
35
  "uploadedBy",
36
36
  "action"
37
- ], pe = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, R = (n) => n.attachments.length > 0 ? n.attachments : n.documentUrl ? [{ url: n.documentUrl, contentType: n.contentType }] : [], Ne = ({ config: n, encounterUuids: T }) => {
37
+ ], pe = /\.(jpg|jpeg|png|gif|webp|bmp|svg)$/i, R = (n) => n.attachments.length > 0 ? n.attachments : n.documentUrl ? [{ url: n.documentUrl, contentType: n.contentType }] : [], Ne = ({ config: n, encounterUuids: E }) => {
38
38
  const [d, M] = l(!1), [r, U] = l(
39
39
  null
40
40
  ), [P, A] = l(
41
41
  /* @__PURE__ */ new Set()
42
- ), E = Z(), { t: o } = ae(), { addNotification: w } = Q(), F = Number(n?.pageSize) || 5, [D, O] = l(1), [m, $] = l(F), [k, C] = l(void 0), b = p((e) => {
42
+ ), T = W(), { t: o } = ae(), { addNotification: w } = X(), F = Number(n?.pageSize) || 5, [C, D] = l(1), [m, $] = l(F), [k, O] = l(void 0), b = p((e) => {
43
43
  U(e), M(!0);
44
44
  }, []), V = p(() => {
45
45
  M(!1), U(null), A(/* @__PURE__ */ new Set());
46
46
  }, []), B = p((e) => {
47
47
  A((t) => new Set(t).add(e));
48
- }, []), { data: u, isLoading: z, isError: S, error: y } = ne({
48
+ }, []), { data: u, isLoading: z, isError: y, error: S } = ne({
49
49
  queryKey: [
50
50
  "documents",
51
- E,
52
51
  T,
53
- D,
52
+ E,
53
+ C,
54
54
  m
55
55
  ],
56
- enabled: !!E,
57
- queryFn: () => W(
58
- E,
56
+ enabled: !!T,
57
+ queryFn: () => J(
59
58
  T,
59
+ E,
60
60
  m,
61
- D
61
+ C
62
62
  )
63
63
  });
64
64
  N(() => {
65
- u && C(u.total);
65
+ u && O(u.total);
66
66
  }, [u]), N(() => {
67
- O(1), C(void 0);
68
- }, [E]), N(() => {
69
- S && w({
67
+ D(1), O(void 0);
68
+ }, [T]), N(() => {
69
+ y && w({
70
70
  title: o("ERROR_DEFAULT_TITLE"),
71
- message: y?.message ?? "",
71
+ message: S?.message ?? "",
72
72
  type: "error"
73
73
  });
74
- }, [S, y, w, o]), N(() => {
74
+ }, [y, S, w, o]), N(() => {
75
75
  const e = new AbortController();
76
76
  return (async () => {
77
77
  if (!d || !r) return;
@@ -92,13 +92,13 @@ const _e = [
92
92
  }, [d, r]);
93
93
  const H = p(
94
94
  (e, t) => {
95
- t !== m ? ($(t), O(1), C(void 0)) : O(e);
95
+ t !== m ? ($(t), D(1), O(void 0)) : D(e);
96
96
  },
97
97
  [m]
98
98
  ), g = f(
99
99
  () => n?.fields ?? _e,
100
100
  [n?.fields]
101
- ), q = f(() => [...u?.documents ?? []].sort((t, a) => !t.uploadedOn && !a.uploadedOn ? 0 : t.uploadedOn ? a.uploadedOn ? new Date(a.uploadedOn).getTime() - new Date(t.uploadedOn).getTime() : -1 : 1), [u]), G = f(() => he(g, o), [g, o]), X = f(
101
+ ), q = f(() => [...u?.documents ?? []].sort((t, a) => !t.uploadedOn && !a.uploadedOn ? 0 : t.uploadedOn ? a.uploadedOn ? new Date(a.uploadedOn).getTime() - new Date(t.uploadedOn).getTime() : -1 : 1), [u]), G = f(() => he(g, o), [g, o]), Y = f(
102
102
  () => g.map((e) => ({
103
103
  key: e,
104
104
  sortable: e !== "action"
@@ -107,7 +107,7 @@ const _e = [
107
107
  ), h = f(
108
108
  () => r ? R(r) : [],
109
109
  [r]
110
- ), Y = p(
110
+ ), K = p(
111
111
  (e, t) => {
112
112
  switch (t) {
113
113
  case "documentIdentifier":
@@ -124,7 +124,7 @@ const _e = [
124
124
  return e.uploadedBy ?? o("DOCUMENTS_NOT_AVAILABLE");
125
125
  case "action":
126
126
  return e.attachments.length > 0 || !!e.documentUrl ? /* @__PURE__ */ s(
127
- J,
127
+ Z,
128
128
  {
129
129
  onClick: () => b(e),
130
130
  className: c.viewAttachmentsLink,
@@ -138,7 +138,7 @@ const _e = [
138
138
  },
139
139
  [b, o]
140
140
  );
141
- return /* @__PURE__ */ _(K, { children: [
141
+ return /* @__PURE__ */ _(Q, { children: [
142
142
  /* @__PURE__ */ s("div", { "data-testid": "documents-table", children: /* @__PURE__ */ s(
143
143
  ee,
144
144
  {
@@ -146,15 +146,15 @@ const _e = [
146
146
  ariaLabel: o("DOCUMENTS_TABLE_HEADING"),
147
147
  rows: q,
148
148
  loading: z,
149
- errorStateMessage: S ? y?.message : null,
150
- sortable: X,
149
+ errorStateMessage: y ? S?.message : null,
150
+ sortable: Y,
151
151
  emptyStateMessage: o("DOCUMENTS_NO_RECORDS"),
152
- renderCell: Y,
152
+ renderCell: K,
153
153
  className: c.documentsTableBody,
154
154
  dataTestId: "documents-table",
155
155
  pageSize: m,
156
156
  totalItems: k,
157
- page: D,
157
+ page: C,
158
158
  onPageChange: H
159
159
  }
160
160
  ) }),
@@ -0,0 +1,436 @@
1
+ import { jsxs as f, jsx as a, Fragment as K } from "react/jsx-runtime";
2
+ import { f as Q, c as M, d as oe, w as se, g as ne, v as de, e as ie, O as le, u as ce, i as me, j as ue, m as pe, k as be, l as fe, I as _e, b as ye, t as $e, h as k, J as ge, X as he, y as ve, U as Ne, R as H } from "./index-CCRQ_2lk.js";
3
+ import { useQueryClient as Oe, useQuery as L } from "@tanstack/react-query";
4
+ import { useState as j, useMemo as v, useCallback as R } from "react";
5
+ import { useTranslation as I } from "react-i18next";
6
+ const Fe = "_formsTableBody_1pd36_1", Le = "_customAccordianItem_1pd36_6", Re = "_formContent_1pd36_18", Me = "_formDetailsContainer_1pd36_25", Ce = "_observation_1pd36_30", De = "_groupContainer_1pd36_39", Ve = "_rowContainer_1pd36_43", we = "_groupLabel_1pd36_48", Ie = "_rowLabel_1pd36_58", Te = "_rowValue_1pd36_67", Ee = "_groupMembers_1pd36_75", Be = "_memberRow_1pd36_81", Ae = "_memberLabel_1pd36_86", Ge = "_memberValue_1pd36_94", Se = "_abnormalValue_1pd36_102", Ue = "_commentSection_1pd36_110", qe = "_commentText_1pd36_116", xe = "_nestedGroup_1pd36_125", Pe = "_nestedGroupLabel_1pd36_132", ke = "_nestedGroupMembers_1pd36_141", o = {
7
+ formsTableBody: Fe,
8
+ customAccordianItem: Le,
9
+ formContent: Re,
10
+ formDetailsContainer: Me,
11
+ observation: Ce,
12
+ groupContainer: De,
13
+ rowContainer: Ve,
14
+ groupLabel: we,
15
+ rowLabel: Ie,
16
+ rowValue: Te,
17
+ groupMembers: Ee,
18
+ memberRow: Be,
19
+ memberLabel: Ae,
20
+ memberValue: Ge,
21
+ abnormalValue: Se,
22
+ commentSection: Ue,
23
+ commentText: qe,
24
+ nestedGroup: xe,
25
+ nestedGroupLabel: Pe,
26
+ nestedGroupMembers: ke
27
+ }, z = (e, r) => {
28
+ const t = oe(e);
29
+ return t === "Image" ? /* @__PURE__ */ a(
30
+ se,
31
+ {
32
+ imageSrc: e,
33
+ alt: e,
34
+ id: `${e}-img`,
35
+ hideThumbnail: r
36
+ }
37
+ ) : t === "Video" ? /* @__PURE__ */ a(
38
+ ne,
39
+ {
40
+ id: `${e}-video`,
41
+ videoSrc: e,
42
+ hideThumbnail: r
43
+ }
44
+ ) : t === "PDF" ? /* @__PURE__ */ a(de, { id: `${e}-pdf`, src: e }) : e;
45
+ }, J = (e) => {
46
+ const r = e.observationValue?.referenceRange?.low?.value, t = e.observationValue?.referenceRange?.high?.value, s = r != null, n = t != null;
47
+ let l = "";
48
+ s && n ? l = ` (${r} - ${t})` : s ? l = ` (>${r})` : n && (l = ` (<${t})`);
49
+ const c = e.observationValue?.isAbnormal === !0;
50
+ return { rangeString: l, isAbnormal: c };
51
+ }, X = ({
52
+ member: e,
53
+ depth: r = 0,
54
+ memberIndex: t = 0,
55
+ formName: s = "",
56
+ comment: n,
57
+ hideThumbnail: l
58
+ }) => {
59
+ const { t: c } = I(), d = e.members && e.members.length > 0, p = e.display, m = s ? `${s}-` : "";
60
+ if (d)
61
+ return /* @__PURE__ */ f(
62
+ "div",
63
+ {
64
+ className: o.nestedGroup,
65
+ "data-testid": `${m}obs-nested-group-${p}-${t}`,
66
+ children: [
67
+ /* @__PURE__ */ a(
68
+ "div",
69
+ {
70
+ className: o.nestedGroupLabel,
71
+ "data-testid": `${m}obs-nested-group-label-${p}-${t}`,
72
+ style: { paddingLeft: `${r * 16}px` },
73
+ children: p
74
+ }
75
+ ),
76
+ /* @__PURE__ */ a(
77
+ "div",
78
+ {
79
+ className: o.nestedGroupMembers,
80
+ "data-testid": `${m}obs-nested-group-members-${p}-${t}`,
81
+ children: e.members?.map((N, O) => /* @__PURE__ */ a(
82
+ X,
83
+ {
84
+ member: N,
85
+ depth: r + 1,
86
+ memberIndex: O,
87
+ formName: s,
88
+ hideThumbnail: l
89
+ },
90
+ `${N.id}`
91
+ ))
92
+ }
93
+ )
94
+ ]
95
+ }
96
+ );
97
+ const { rangeString: h, isAbnormal: _ } = J(e), y = Q(e, c), $ = y ? z(y, l) : null;
98
+ return /* @__PURE__ */ f(K, { children: [
99
+ /* @__PURE__ */ f(
100
+ "div",
101
+ {
102
+ className: o.memberRow,
103
+ "data-testid": `${m}obs-member-row-${p}-${t}`,
104
+ style: { paddingLeft: `${r * 16}px` },
105
+ children: [
106
+ /* @__PURE__ */ f(
107
+ "p",
108
+ {
109
+ className: M(
110
+ o.memberLabel,
111
+ _ ? o.abnormalValue : ""
112
+ ),
113
+ "data-testid": `${m}obs-member-label-${p}-${t}`,
114
+ children: [
115
+ p,
116
+ h
117
+ ]
118
+ }
119
+ ),
120
+ /* @__PURE__ */ a(
121
+ "div",
122
+ {
123
+ className: M(
124
+ o.memberValue,
125
+ _ ? o.abnormalValue : ""
126
+ ),
127
+ "data-testid": `${m}obs-member-value-${p}-${t}`,
128
+ children: $
129
+ }
130
+ )
131
+ ]
132
+ }
133
+ ),
134
+ n && /* @__PURE__ */ a(
135
+ "div",
136
+ {
137
+ className: o.commentSection,
138
+ "data-testid": `${m}obs-member-comment-${p}-${t}`,
139
+ style: { paddingLeft: `${r * 16}px` },
140
+ children: /* @__PURE__ */ f("span", { className: o.commentText, children: [
141
+ n,
142
+ e.encounter?.provider && ` - by ${e.encounter.provider}`
143
+ ] })
144
+ }
145
+ )
146
+ ] });
147
+ }, He = ({
148
+ observation: e,
149
+ index: r,
150
+ formName: t = "",
151
+ comment: s,
152
+ hideThumbnail: n
153
+ }) => {
154
+ const { t: l } = I(), c = e.members && e.members.length > 0, { rangeString: d, isAbnormal: p } = J(e), m = t ? `${t}-` : "", h = Q(e, l), _ = h ? z(h, n) : null;
155
+ return /* @__PURE__ */ f(
156
+ "div",
157
+ {
158
+ className: o.observation,
159
+ "data-testid": `${m}observation-item-${e.display}-${r}`,
160
+ children: [
161
+ /* @__PURE__ */ f(
162
+ "div",
163
+ {
164
+ className: c ? o.groupContainer : o.rowContainer,
165
+ "data-testid": `${m}observation-container-${e.display}-${r}`,
166
+ children: [
167
+ /* @__PURE__ */ f(
168
+ "p",
169
+ {
170
+ className: M(
171
+ c ? o.groupLabel : o.rowLabel,
172
+ !c && p ? o.abnormalValue : ""
173
+ ),
174
+ "data-testid": `${m}observation-label-${e.display}-${r}`,
175
+ children: [
176
+ e.display,
177
+ !c && d && /* @__PURE__ */ a("span", { className: o.rangeInfo, children: d })
178
+ ]
179
+ }
180
+ ),
181
+ c ? /* @__PURE__ */ a(
182
+ "div",
183
+ {
184
+ className: o.groupMembers,
185
+ "data-testid": `${m}observation-group-members-${e.display}-${r}`,
186
+ children: e.members?.map((y, $) => /* @__PURE__ */ a(
187
+ X,
188
+ {
189
+ member: y,
190
+ depth: 0,
191
+ memberIndex: $,
192
+ formName: t,
193
+ hideThumbnail: n
194
+ },
195
+ `${y.id}`
196
+ ))
197
+ }
198
+ ) : /* @__PURE__ */ a(
199
+ "div",
200
+ {
201
+ className: M(
202
+ o.rowValue,
203
+ p ? o.abnormalValue : ""
204
+ ),
205
+ "data-testid": `${m}observation-value-${e.display}-${r}`,
206
+ children: _
207
+ }
208
+ )
209
+ ]
210
+ }
211
+ ),
212
+ s && /* @__PURE__ */ a(
213
+ "div",
214
+ {
215
+ className: o.commentSection,
216
+ "data-testid": `${m}observation-comment-${e.display}-${r}`,
217
+ children: /* @__PURE__ */ f("span", { className: o.commentText, children: [
218
+ s,
219
+ e.encounter?.provider && ` - by ${e.encounter.provider}`
220
+ ] })
221
+ }
222
+ )
223
+ ]
224
+ },
225
+ `${e.id}-${r}`
226
+ );
227
+ }, je = (e) => e ? e.extension?.find(
228
+ (t) => t.url === le
229
+ )?.valueString : void 0, Ke = (e) => {
230
+ if (e)
231
+ return e.note?.[0]?.text;
232
+ }, Qe = (e, r) => e.entry?.find((t) => t.resource?.id === r)?.resource, w = (e, r) => {
233
+ const t = Qe(e, r);
234
+ return t ? {
235
+ formFieldPath: je(t),
236
+ comment: Ke(t)
237
+ } : {};
238
+ }, ze = (e, r) => {
239
+ if (!e?.entry || !r)
240
+ return [];
241
+ const t = ie(e);
242
+ return [
243
+ ...t.observations.map((n) => {
244
+ const { formFieldPath: l, comment: c } = w(
245
+ e,
246
+ n.id
247
+ );
248
+ return { obs: n, formFieldPath: l, comment: c };
249
+ }),
250
+ ...t.groupedObservations.flatMap((n) => {
251
+ const { formFieldPath: l } = w(e, n.id);
252
+ return (n.members ?? []).map((c) => {
253
+ const { comment: d } = w(e, c.id);
254
+ return { obs: c, formFieldPath: l, comment: d };
255
+ });
256
+ })
257
+ ].filter(
258
+ ({ formFieldPath: n }) => !n || n.includes(r)
259
+ );
260
+ }, er = ({
261
+ episodeOfCareUuids: e,
262
+ encounterUuids: r,
263
+ config: t
264
+ }) => {
265
+ const { t: s } = I(), n = ce(), [l, c] = j(!1), [d, p] = j(null), { numberOfVisits: m, hideThumbnail: h = !1 } = t ?? {}, _ = me(
266
+ e,
267
+ r
268
+ ), y = Oe(), {
269
+ data: $ = [],
270
+ isLoading: N,
271
+ isError: O,
272
+ error: W,
273
+ refetch: Y
274
+ } = L({
275
+ queryKey: ["forms", n, e],
276
+ queryFn: () => ue(n, void 0, m),
277
+ enabled: !!n && !_
278
+ }), T = v(() => !r || r.length === 0 ? $ : $.filter(
279
+ (i) => r.includes(i.encounterUuid)
280
+ ), [$, r]), { data: E = [] } = L({
281
+ queryKey: ["observationForms"],
282
+ queryFn: () => pe()
283
+ }), B = R(
284
+ (i) => E.find((u) => u.name === i)?.uuid,
285
+ [E]
286
+ ), C = v(() => {
287
+ if (d)
288
+ return B(d.formName);
289
+ }, [d, B]), { isLoading: Z, error: A } = L({
290
+ queryKey: ["formMetadata", C],
291
+ queryFn: () => be(C),
292
+ enabled: !!C && l
293
+ }), {
294
+ data: D,
295
+ isLoading: ee,
296
+ error: G
297
+ } = L({
298
+ queryKey: ["formsEncounterFHIR", d?.encounterUuid],
299
+ queryFn: () => fe(d.encounterUuid),
300
+ enabled: !!d?.encounterUuid && l
301
+ });
302
+ _e(
303
+ (i) => {
304
+ i.patientUUID === n && i.updatedConcepts.size > 0 && (Y(), y.invalidateQueries({ queryKey: ["formsEncounterFHIR"] }));
305
+ },
306
+ [n]
307
+ );
308
+ const S = v(() => !D || !d?.formName ? [] : ze(
309
+ D,
310
+ d.formName
311
+ ), [D, d?.formName]), U = v(
312
+ () => [
313
+ { key: "recordedOn", header: s("FORM_RECORDED_ON") },
314
+ { key: "recordedBy", header: s("FORM_RECORDED_BY") }
315
+ ],
316
+ [s]
317
+ ), re = v(
318
+ () => [
319
+ { key: "recordedOn", sortable: !0 },
320
+ { key: "recordedBy", sortable: !0 }
321
+ ],
322
+ []
323
+ ), q = v(() => {
324
+ const i = T.reduce(
325
+ (u, b) => {
326
+ const F = b.formName;
327
+ u[F] ??= [];
328
+ const V = b.providers.map((ae) => ae.providerName).filter(Boolean).join(", ");
329
+ return u[F].push({
330
+ id: b.encounterUuid,
331
+ formName: b.formName,
332
+ recordedOn: ye(b.encounterDateTime, s, !0).formattedResult,
333
+ recordedBy: V ?? "--",
334
+ encounterDateTime: b.encounterDateTime,
335
+ encounterUuid: b.encounterUuid
336
+ }), u;
337
+ },
338
+ {}
339
+ );
340
+ return Object.entries(i).map(
341
+ ([u, b]) => ({
342
+ formName: u,
343
+ records: b.sort(
344
+ (F, V) => V.encounterDateTime - F.encounterDateTime
345
+ )
346
+ })
347
+ ).sort((u, b) => u.formName.localeCompare(b.formName));
348
+ }, [T, s]), x = R((i) => {
349
+ p(i), c(!0);
350
+ }, []), te = R(() => {
351
+ c(!1), p(null);
352
+ }, []), P = R(
353
+ (i, g) => {
354
+ switch (g) {
355
+ case "recordedOn":
356
+ return /* @__PURE__ */ a($e, { onClick: () => x(i), children: i.recordedOn });
357
+ case "recordedBy":
358
+ return i.recordedBy;
359
+ default:
360
+ return null;
361
+ }
362
+ },
363
+ [x]
364
+ );
365
+ return /* @__PURE__ */ f(K, { children: [
366
+ /* @__PURE__ */ a("div", { "data-testid": "forms-table", children: N || O || q.length === 0 || _ ? /* @__PURE__ */ a(
367
+ k,
368
+ {
369
+ headers: U,
370
+ ariaLabel: s("FORMS_HEADING"),
371
+ rows: [],
372
+ loading: N,
373
+ errorStateMessage: O ? W?.message : void 0,
374
+ emptyStateMessage: s("FORMS_UNAVAILABLE"),
375
+ renderCell: P,
376
+ className: o.formsTableBody,
377
+ dataTestId: "forms-table"
378
+ }
379
+ ) : /* @__PURE__ */ a(ge, { align: "start", children: q.map((i, g) => {
380
+ const { formName: u, records: b } = i;
381
+ return /* @__PURE__ */ a(
382
+ he,
383
+ {
384
+ title: u,
385
+ className: o.customAccordianItem,
386
+ testId: `accordian-title-${u}`,
387
+ open: g === 0,
388
+ children: /* @__PURE__ */ a(
389
+ k,
390
+ {
391
+ headers: U,
392
+ ariaLabel: s("FORMS_HEADING"),
393
+ rows: b,
394
+ loading: !1,
395
+ errorStateMessage: "",
396
+ sortable: re,
397
+ emptyStateMessage: s("FORMS_UNAVAILABLE"),
398
+ renderCell: P,
399
+ className: o.formsTableBody,
400
+ dataTestId: `forms-table-${u}`
401
+ }
402
+ )
403
+ },
404
+ u
405
+ );
406
+ }) }) }),
407
+ l && d && /* @__PURE__ */ a(
408
+ ve,
409
+ {
410
+ id: "modalIdForActionAreaLayout",
411
+ portalId: "main-display-area",
412
+ open: l,
413
+ onRequestClose: te,
414
+ modalHeading: d.formName,
415
+ modalLabel: `${d.recordedOn} | ${d.recordedBy}`,
416
+ passiveModal: !0,
417
+ size: "md",
418
+ testId: "form-details-modal",
419
+ children: /* @__PURE__ */ a("div", { className: o.formContent, children: Z || ee ? /* @__PURE__ */ a(Ne, { width: "100%", lineCount: 3 }) : A ? /* @__PURE__ */ a("div", { children: H(A).message ?? s("ERROR_FETCHING_FORM_METADATA") }) : G ? /* @__PURE__ */ a("div", { children: H(G).message ?? s("ERROR_FETCHING_FORM_DATA") }) : S.length > 0 ? /* @__PURE__ */ a("div", { className: o.formDetailsContainer, children: S.map(({ obs: i, comment: g }, u) => /* @__PURE__ */ a(
420
+ He,
421
+ {
422
+ observation: i,
423
+ index: u,
424
+ formName: d.formName,
425
+ comment: g,
426
+ hideThumbnail: h
427
+ },
428
+ `${i.id}`
429
+ )) }) : /* @__PURE__ */ a("div", { children: s("NO_FORM_DATA_AVAILABLE") }) })
430
+ }
431
+ )
432
+ ] });
433
+ };
434
+ export {
435
+ er as default
436
+ };