@bahmni/widgets 0.0.1-dev.189 → 0.0.1-dev.191

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,204 @@
1
+ import { jsx as o, jsxs as l, Fragment as V } from "react/jsx-runtime";
2
+ import { u as $, a as H, Q as P, R as z, M as Q, t as Y, b as j, i as G } from "./index-HMYBr9oP.js";
3
+ import { useQuery as K } from "@tanstack/react-query";
4
+ import { useState as C, useCallback as E, useEffect as S, useMemo as f } from "react";
5
+ import { useTranslation as W } from "react-i18next";
6
+ const J = "_documentsTableBody_6qsah_1", X = "_viewAttachmentsLink_6qsah_11", Z = "_documentViewerContainer_6qsah_15", x = "_attachmentItem_6qsah_23", ee = "_attachmentCounter_6qsah_27", te = "_attachmentError_6qsah_36", ae = "_documentIframe_6qsah_44", ne = "_documentImage_6qsah_50", c = {
7
+ documentsTableBody: J,
8
+ viewAttachmentsLink: X,
9
+ documentViewerContainer: Z,
10
+ attachmentItem: x,
11
+ attachmentCounter: ee,
12
+ attachmentError: te,
13
+ documentIframe: ae,
14
+ documentImage: ne
15
+ }, se = {
16
+ documentIdentifier: "DOCUMENTS_DOCUMENT_IDENTIFIER",
17
+ documentType: "DOCUMENTS_TYPE",
18
+ uploadedOn: "DOCUMENTS_UPLOADED_ON",
19
+ uploadedBy: "DOCUMENTS_UPLOADED_BY",
20
+ action: "DOCUMENTS_ACTION"
21
+ };
22
+ function U(t) {
23
+ return !t || t.includes(":") ? "#" : `/openmrs/auth?requested_document=/document_images/${t}`;
24
+ }
25
+ function re(t, u) {
26
+ return t.map((d) => ({
27
+ key: d,
28
+ header: u(se[d])
29
+ }));
30
+ }
31
+ const oe = [
32
+ "documentIdentifier",
33
+ "documentType",
34
+ "uploadedOn",
35
+ "uploadedBy",
36
+ "action"
37
+ ], w = (t) => t.attachments.length > 0 ? t.attachments : t.documentUrl ? [{ url: t.documentUrl, contentType: t.contentType }] : [], ue = ({ config: t, encounterUuids: u }) => {
38
+ const [d, O] = C(!1), [n, y] = C(
39
+ null
40
+ ), [b, T] = C(
41
+ /* @__PURE__ */ new Set()
42
+ ), p = $(), { t: a } = W(), { addNotification: g } = H(), M = E((e) => {
43
+ y(e), O(!0);
44
+ }, []), v = E(() => {
45
+ O(!1), y(null), T(/* @__PURE__ */ new Set());
46
+ }, []), L = E((e) => {
47
+ T((s) => new Set(s).add(e));
48
+ }, []), { data: B, isLoading: R, isError: I, error: A } = K({
49
+ queryKey: ["documents", p, u],
50
+ enabled: !!p,
51
+ queryFn: () => P(p, u)
52
+ });
53
+ S(() => {
54
+ I && g({
55
+ title: a("ERROR_DEFAULT_TITLE"),
56
+ message: A?.message ?? "",
57
+ type: "error"
58
+ });
59
+ }, [I, A, g, a]), S(() => {
60
+ const e = new AbortController();
61
+ return (async () => {
62
+ if (!d || !n) return;
63
+ const r = /* @__PURE__ */ new Set(), _ = w(n);
64
+ for (let m = 0; m < _.length; m++) {
65
+ const N = U(_[m].url);
66
+ try {
67
+ (await fetch(N, {
68
+ method: "HEAD",
69
+ signal: e.signal
70
+ })).ok || r.add(m);
71
+ } catch (D) {
72
+ D instanceof Error && D.name !== "AbortError" && r.add(m);
73
+ }
74
+ }
75
+ e.signal.aborted || T(r);
76
+ })(), () => e.abort();
77
+ }, [d, n]);
78
+ const h = f(
79
+ () => t?.fields ?? oe,
80
+ [t?.fields]
81
+ ), q = f(() => re(h, a), [h, a]), F = f(
82
+ () => h.map((e) => ({
83
+ key: e,
84
+ sortable: e !== "action"
85
+ })),
86
+ [h]
87
+ ), i = f(
88
+ () => n ? w(n) : [],
89
+ [n]
90
+ ), k = E(
91
+ (e, s) => {
92
+ switch (s) {
93
+ case "documentIdentifier":
94
+ return /* @__PURE__ */ o("span", { children: e.documentIdentifier });
95
+ case "documentType":
96
+ return e.documentType ?? a("DOCUMENTS_NOT_AVAILABLE");
97
+ case "uploadedOn":
98
+ return Q(
99
+ e.uploadedOn,
100
+ a,
101
+ G
102
+ ).formattedResult || a("DOCUMENTS_NOT_AVAILABLE");
103
+ case "uploadedBy":
104
+ return e.uploadedBy ?? a("DOCUMENTS_NOT_AVAILABLE");
105
+ case "action":
106
+ return e.attachments.length > 0 || !!e.documentUrl ? /* @__PURE__ */ o(
107
+ z,
108
+ {
109
+ onClick: () => M(e),
110
+ className: c.viewAttachmentsLink,
111
+ "data-testid": `view-attachments-${e.id}`,
112
+ children: a("DOCUMENTS_VIEW_ATTACHMENTS")
113
+ }
114
+ ) : "--";
115
+ default:
116
+ return null;
117
+ }
118
+ },
119
+ [M, a]
120
+ );
121
+ return /* @__PURE__ */ l(V, { children: [
122
+ /* @__PURE__ */ o("div", { "data-testid": "documents-table", children: /* @__PURE__ */ o(
123
+ Y,
124
+ {
125
+ headers: q,
126
+ ariaLabel: a("DOCUMENTS_TABLE_HEADING"),
127
+ rows: B ?? [],
128
+ loading: R,
129
+ errorStateMessage: I ? A?.message : null,
130
+ sortable: F,
131
+ emptyStateMessage: a("DOCUMENTS_NO_RECORDS"),
132
+ renderCell: k,
133
+ className: c.documentsTableBody,
134
+ dataTestId: "documents-table"
135
+ }
136
+ ) }),
137
+ d && n && /* @__PURE__ */ o(
138
+ j,
139
+ {
140
+ id: "modalIdForActionAreaLayout",
141
+ portalId: "main-display-area",
142
+ open: d,
143
+ onRequestClose: v,
144
+ modalHeading: n.documentIdentifier,
145
+ passiveModal: !0,
146
+ size: "lg",
147
+ testId: "document-view-modal",
148
+ children: /* @__PURE__ */ o("div", { className: c.documentViewerContainer, children: i.map((e, s) => {
149
+ const r = U(e.url), _ = e.contentType?.toLowerCase().includes("pdf"), m = e.contentType?.toLowerCase().includes("image"), N = b.has(s);
150
+ return r === "#" || N ? /* @__PURE__ */ l(
151
+ "div",
152
+ {
153
+ className: c.attachmentError,
154
+ "data-testid": `attachment-error-${s}`,
155
+ children: [
156
+ i.length > 1 && /* @__PURE__ */ l("p", { className: c.attachmentCounter, children: [
157
+ s + 1,
158
+ "/",
159
+ i.length
160
+ ] }),
161
+ /* @__PURE__ */ o("p", { children: a("DOCUMENTS_ERROR_LOADING_ATTACHMENT") })
162
+ ]
163
+ },
164
+ `${n.id}-${e.url}`
165
+ ) : /* @__PURE__ */ l(
166
+ "div",
167
+ {
168
+ className: c.attachmentItem,
169
+ "data-testid": `attachment-item-${s}`,
170
+ children: [
171
+ i.length > 1 && /* @__PURE__ */ l("p", { className: c.attachmentCounter, children: [
172
+ s + 1,
173
+ "/",
174
+ i.length
175
+ ] }),
176
+ m ? /* @__PURE__ */ o(
177
+ "img",
178
+ {
179
+ src: r,
180
+ alt: n.documentIdentifier,
181
+ className: c.documentImage,
182
+ onError: () => L(s)
183
+ }
184
+ ) : /* @__PURE__ */ o(
185
+ "iframe",
186
+ {
187
+ src: _ ? `${r}#toolbar=0` : r,
188
+ className: c.documentIframe,
189
+ title: n.documentIdentifier,
190
+ onError: () => L(s)
191
+ }
192
+ )
193
+ ]
194
+ },
195
+ `${n.id}-${e.url}`
196
+ );
197
+ }) })
198
+ }
199
+ )
200
+ ] });
201
+ };
202
+ export {
203
+ ue as default
204
+ };
@@ -1,9 +1,9 @@
1
- import { jsxs as b, jsx as n, Fragment as H } from "react/jsx-runtime";
2
- import { c as M, Z as re, X as te, e as ae, d as oe, f as se, J as ne, u as de, N as ie, q as le, g as ce, x as me, h as ue, j as pe, M as be, R as fe, t as P, B as _e, k as he, b as $e, _ as ye, T as U, i as ge } from "./index-zYYwI7OI.js";
1
+ import { jsxs as b, jsx as n, Fragment as k } from "react/jsx-runtime";
2
+ import { c as M, Z as re, X as te, e as ae, d as oe, f as se, J as ne, u as de, N as ie, q as le, g as ce, x as me, P as ue, h as pe, M as be, R as fe, t as x, B as _e, j as he, b as $e, _ as ye, T as U, i as ge } from "./index-HMYBr9oP.js";
3
3
  import { useQueryClient as ve, useQuery as F } from "@tanstack/react-query";
4
- import { useState as k, useMemo as g, useCallback as L } from "react";
4
+ import { useState as H, useMemo as g, useCallback as L } from "react";
5
5
  import { useTranslation as Ne } from "react-i18next";
6
- const Oe = "_formsTableBody_1pd36_1", Fe = "_customAccordianItem_1pd36_6", Le = "_formContent_1pd36_18", Me = "_formDetailsContainer_1pd36_25", Re = "_observation_1pd36_30", Ce = "_groupContainer_1pd36_39", we = "_rowContainer_1pd36_43", De = "_groupLabel_1pd36_48", Te = "_rowLabel_1pd36_58", Ve = "_rowValue_1pd36_67", Be = "_groupMembers_1pd36_75", Ie = "_memberRow_1pd36_81", Ae = "_memberLabel_1pd36_86", Ee = "_memberValue_1pd36_94", Ge = "_abnormalValue_1pd36_102", Se = "_commentSection_1pd36_110", qe = "_commentText_1pd36_116", xe = "_nestedGroup_1pd36_125", Pe = "_nestedGroupLabel_1pd36_132", Ue = "_nestedGroupMembers_1pd36_141", o = {
6
+ const Oe = "_formsTableBody_1pd36_1", Fe = "_customAccordianItem_1pd36_6", Le = "_formContent_1pd36_18", Me = "_formDetailsContainer_1pd36_25", Re = "_observation_1pd36_30", Ce = "_groupContainer_1pd36_39", we = "_rowContainer_1pd36_43", De = "_groupLabel_1pd36_48", Te = "_rowLabel_1pd36_58", Ve = "_rowValue_1pd36_67", Be = "_groupMembers_1pd36_75", Ie = "_memberRow_1pd36_81", Ae = "_memberLabel_1pd36_86", Ee = "_memberValue_1pd36_94", Ge = "_abnormalValue_1pd36_102", Se = "_commentSection_1pd36_110", qe = "_commentText_1pd36_116", Pe = "_nestedGroup_1pd36_125", xe = "_nestedGroupLabel_1pd36_132", Ue = "_nestedGroupMembers_1pd36_141", o = {
7
7
  formsTableBody: Oe,
8
8
  customAccordianItem: Fe,
9
9
  formContent: Le,
@@ -21,8 +21,8 @@ const Oe = "_formsTableBody_1pd36_1", Fe = "_customAccordianItem_1pd36_6", Le =
21
21
  abnormalValue: Ge,
22
22
  commentSection: Se,
23
23
  commentText: qe,
24
- nestedGroup: xe,
25
- nestedGroupLabel: Pe,
24
+ nestedGroup: Pe,
25
+ nestedGroupLabel: xe,
26
26
  nestedGroupMembers: Ue
27
27
  }, j = (e) => {
28
28
  const r = re(e);
@@ -82,7 +82,7 @@ const Oe = "_formsTableBody_1pd36_1", Fe = "_customAccordianItem_1pd36_6", Le =
82
82
  }
83
83
  );
84
84
  const { units: p, rangeString: y, isAbnormal: f } = K(e), _ = e.observationValue?.value?.toString(), h = _ ? j(_) : null;
85
- return /* @__PURE__ */ b(H, { children: [
85
+ return /* @__PURE__ */ b(k, { children: [
86
86
  /* @__PURE__ */ b(
87
87
  "div",
88
88
  {
@@ -134,7 +134,7 @@ const Oe = "_formsTableBody_1pd36_1", Fe = "_customAccordianItem_1pd36_6", Le =
134
134
  }
135
135
  )
136
136
  ] });
137
- }, ke = ({
137
+ }, He = ({
138
138
  observation: e,
139
139
  index: r,
140
140
  formName: a = "",
@@ -215,7 +215,7 @@ const Oe = "_formsTableBody_1pd36_1", Fe = "_customAccordianItem_1pd36_6", Le =
215
215
  },
216
216
  `${e.id}-${r}`
217
217
  );
218
- }, He = (e) => e ? e.extension?.find(
218
+ }, ke = (e) => e ? e.extension?.find(
219
219
  (a) => a.url === ne
220
220
  )?.valueString : void 0, je = (e) => {
221
221
  if (e)
@@ -223,7 +223,7 @@ const Oe = "_formsTableBody_1pd36_1", Fe = "_customAccordianItem_1pd36_6", Le =
223
223
  }, Ke = (e, r) => e.entry?.find((a) => a.resource?.id === r)?.resource, D = (e, r) => {
224
224
  const a = Ke(e, r);
225
225
  return a ? {
226
- formFieldPath: He(a),
226
+ formFieldPath: ke(a),
227
227
  comment: je(a)
228
228
  } : {};
229
229
  }, Qe = (e, r) => {
@@ -253,7 +253,7 @@ const Oe = "_formsTableBody_1pd36_1", Fe = "_customAccordianItem_1pd36_6", Le =
253
253
  encounterUuids: r,
254
254
  config: a
255
255
  }) => {
256
- const { t: d } = Ne(), s = de(), [c, i] = k(!1), [t, p] = k(null), y = a?.numberOfVisits, f = ie(
256
+ const { t: d } = Ne(), s = de(), [c, i] = H(!1), [t, p] = H(null), y = a?.numberOfVisits, f = ie(
257
257
  e,
258
258
  r
259
259
  ), _ = ve(), {
@@ -340,7 +340,7 @@ const Oe = "_formsTableBody_1pd36_1", Fe = "_customAccordianItem_1pd36_6", Le =
340
340
  p(l), i(!0);
341
341
  }, []), Y = L(() => {
342
342
  i(!1), p(null);
343
- }, []), x = L(
343
+ }, []), P = L(
344
344
  (l, $) => {
345
345
  switch ($) {
346
346
  case "recordedOn":
@@ -353,9 +353,9 @@ const Oe = "_formsTableBody_1pd36_1", Fe = "_customAccordianItem_1pd36_6", Le =
353
353
  },
354
354
  [q]
355
355
  );
356
- return /* @__PURE__ */ b(H, { children: [
356
+ return /* @__PURE__ */ b(k, { children: [
357
357
  /* @__PURE__ */ n("div", { "data-testid": "forms-table", children: v || N || S.length === 0 || f ? /* @__PURE__ */ n(
358
- P,
358
+ x,
359
359
  {
360
360
  headers: G,
361
361
  ariaLabel: d("FORMS_HEADING"),
@@ -363,7 +363,7 @@ const Oe = "_formsTableBody_1pd36_1", Fe = "_customAccordianItem_1pd36_6", Le =
363
363
  loading: v,
364
364
  errorStateMessage: N ? X?.message : void 0,
365
365
  emptyStateMessage: d("FORMS_UNAVAILABLE"),
366
- renderCell: x,
366
+ renderCell: P,
367
367
  className: o.formsTableBody,
368
368
  dataTestId: "forms-table"
369
369
  }
@@ -377,7 +377,7 @@ const Oe = "_formsTableBody_1pd36_1", Fe = "_customAccordianItem_1pd36_6", Le =
377
377
  testId: `accordian-title-${m}`,
378
378
  open: $ === 0,
379
379
  children: /* @__PURE__ */ n(
380
- P,
380
+ x,
381
381
  {
382
382
  headers: G,
383
383
  ariaLabel: d("FORMS_HEADING"),
@@ -386,7 +386,7 @@ const Oe = "_formsTableBody_1pd36_1", Fe = "_customAccordianItem_1pd36_6", Le =
386
386
  errorStateMessage: "",
387
387
  sortable: W,
388
388
  emptyStateMessage: d("FORMS_UNAVAILABLE"),
389
- renderCell: x,
389
+ renderCell: P,
390
390
  className: o.formsTableBody,
391
391
  dataTestId: `forms-table-${m}`
392
392
  }
@@ -408,7 +408,7 @@ const Oe = "_formsTableBody_1pd36_1", Fe = "_customAccordianItem_1pd36_6", Le =
408
408
  size: "md",
409
409
  testId: "form-details-modal",
410
410
  children: /* @__PURE__ */ n("div", { className: o.formContent, children: J || Z ? /* @__PURE__ */ n(ye, { width: "100%", lineCount: 3 }) : I ? /* @__PURE__ */ n("div", { children: U(I).message ?? d("ERROR_FETCHING_FORM_METADATA") }) : A ? /* @__PURE__ */ n("div", { children: U(A).message ?? d("ERROR_FETCHING_FORM_DATA") }) : E.length > 0 ? /* @__PURE__ */ n("div", { className: o.formDetailsContainer, children: E.map(({ obs: l, comment: $ }, m) => /* @__PURE__ */ n(
411
- ke,
411
+ He,
412
412
  {
413
413
  observation: l,
414
414
  index: m,
@@ -1,17 +1,17 @@
1
1
  import { jsx as l, jsxs as S } from "react/jsx-runtime";
2
- import { l as M, m as C, n as Q, Z as V, G as k, X as q, e as G, d as K, u as j, a as P, o as H, p as X, j as Z, f as z, r as J, s as Y, v as W, t as x } from "./index-zYYwI7OI.js";
2
+ import { k as w, l as C, m as M, Z as Q, G as V, X as q, e as G, d as K, u as P, a as j, n as H, o as X, h as Z, f as z, p as J, s as Y, r as W, t as x } from "./index-HMYBr9oP.js";
3
3
  import { useQueries as ee, useQuery as te } from "@tanstack/react-query";
4
4
  import { useRef as se, useEffect as $, useMemo as E } from "react";
5
5
  import { useTranslation as D } from "react-i18next";
6
6
  const U = (t, c, i, d, a) => {
7
- const s = Q(t, c), o = s.value, r = V(o);
7
+ const s = M(t, c), o = s.value, r = Q(o);
8
8
  let n = o;
9
9
  r === "Image" && (n = /* @__PURE__ */ l(q, { imageSrc: o, alt: o, id: `${o}-img` })), r === "Video" && (n = /* @__PURE__ */ l(G, { id: `${o}-video`, videoSrc: o })), r === "PDF" && (n = /* @__PURE__ */ l(K, { id: `${o}-pdf`, src: o }));
10
10
  const u = a("OBSERVATIONS_RECORDED_BY", {
11
11
  provider: s.provider
12
12
  }), b = t.display, p = t.observationValue?.isAbnormal ? "abnormal-obs" : "obs", f = d ? `${d}-${p}-${b}-${i}-${c}` : `${p}-${b}-${i}-${c}`;
13
13
  return /* @__PURE__ */ l(
14
- k,
14
+ V,
15
15
  {
16
16
  header: s.header,
17
17
  value: n,
@@ -38,7 +38,7 @@ const U = (t, c, i, d, a) => {
38
38
  title: c = ""
39
39
  }) => {
40
40
  const { t: i } = D(), d = (a, s, o) => {
41
- const r = M(a.encounterDetails, i);
41
+ const r = w(a.encounterDetails, i);
42
42
  return /* @__PURE__ */ S(
43
43
  C,
44
44
  {
@@ -79,7 +79,7 @@ const U = (t, c, i, d, a) => {
79
79
  observations: ae,
80
80
  title: ne
81
81
  }, ie = (t) => ["conceptUuid", t], ce = (t, c) => ["observations", t, ...c], me = ({ config: t }) => {
82
- const c = t, { conceptNames: i = [], conceptUuid: d = [] } = c, a = se(/* @__PURE__ */ new Set()), s = j(), { addNotification: o } = P(), { t: r } = D(), n = ee({
82
+ const c = t, { conceptNames: i = [], conceptUuid: d = [] } = c, a = se(/* @__PURE__ */ new Set()), s = P(), { addNotification: o } = j(), { t: r } = D(), n = ee({
83
83
  queries: i.map((e) => ({
84
84
  queryKey: ie(e),
85
85
  queryFn: () => H(e),
@@ -130,7 +130,7 @@ const U = (t, c, i, d, a) => {
130
130
  { key: "name", header: "name" },
131
131
  { key: "value", header: "value" },
132
132
  { key: "form", header: "form" }
133
- ], I = f || !v, _ = O && v, A = (!p || p.entry?.length === 0 || b.length === 0) && v, F = _ ? r("ERROR_FETCHING_OBSERVATIONS") : null, L = A ? r("NO_OBSERVATIONS_FOUND") : void 0, w = R.length > 0 && !I && !_, y = c.titleTranslationKey, h = y ? r(y) : "";
133
+ ], I = f || !v, _ = O && v, A = (!p || p.entry?.length === 0 || b.length === 0) && v, F = _ ? r("ERROR_FETCHING_OBSERVATIONS") : null, L = A ? r("NO_OBSERVATIONS_FOUND") : void 0, k = R.length > 0 && !I && !_, y = c.titleTranslationKey, h = y ? r(y) : "";
134
134
  return /* @__PURE__ */ S(
135
135
  "div",
136
136
  {
@@ -149,7 +149,7 @@ const U = (t, c, i, d, a) => {
149
149
  children: /* @__PURE__ */ l("p", { children: h })
150
150
  }
151
151
  ),
152
- w ? /* @__PURE__ */ l(re, { groupedData: R, title: h }) : /* @__PURE__ */ l(
152
+ k ? /* @__PURE__ */ l(re, { groupedData: R, title: h }) : /* @__PURE__ */ l(
153
153
  x,
154
154
  {
155
155
  headers: B,
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentsTable.d.ts","sourceRoot":"","sources":["../../src/documents/DocumentsTable.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAGzE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAiChD,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA0IzC,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"DocumentsTable.d.ts","sourceRoot":"","sources":["../../src/documents/DocumentsTable.tsx"],"names":[],"mappings":"AASA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAGzE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAsBhD,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAmOzC,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/documents/utils.ts"],"names":[],"mappings":"AAOA,wBAAgB,mBAAmB,CACjC,WAAW,CAAC,EAAE,MAAM,GACnB,KAAK,GAAG,OAAO,GAAG,UAAU,CAgB9B;AAED,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAI5D;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EAAE,EAChB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GACzB,KAAK,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAKxC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/documents/utils.ts"],"names":[],"mappings":"AAQA,wBAAgB,mBAAmB,CACjC,WAAW,CAAC,EAAE,MAAM,GACnB,KAAK,GAAG,OAAO,GAAG,UAAU,CAgB9B;AAED,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAI5D;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EAAE,EAChB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GACzB,KAAK,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAKxC"}
@@ -74580,6 +74580,8 @@ const ys = (t, e) => t?.length === 0 ? !1 : e?.length === 0, Htt = async () => {
74580
74580
  }, The = (t, e) => {
74581
74581
  if (!t || t.length === 0)
74582
74582
  return !1;
74583
+ if (!e || e.length === 0)
74584
+ return !0;
74583
74585
  const r = Array.isArray(e) ? e : [e];
74584
74586
  return t.some(
74585
74587
  (n) => r.includes(n.name)
@@ -74731,15 +74733,16 @@ const ple = "consultation:saved", bn = (t, e = []) => {
74731
74733
  };
74732
74734
  function Dtt(t) {
74733
74735
  return t.filter((e) => e.resource?.resourceType === "DocumentReference").map((e) => {
74734
- const r = e.resource, n = r.content?.[0]?.attachment, a = r.masterIdentifier?.value ?? r.id ?? "";
74736
+ const r = e.resource, n = r.masterIdentifier?.value ?? r.id ?? "", a = (r.content ?? []).map((s) => s.attachment).filter((s) => !!s).map((s) => ({ url: s.url ?? "", contentType: s.contentType })), i = a[0];
74735
74737
  return {
74736
- id: r.id ?? a,
74737
- documentIdentifier: a,
74738
+ id: r.id ?? n,
74739
+ documentIdentifier: n,
74738
74740
  documentType: r.type?.coding?.[0]?.display ?? r.category?.[0]?.coding?.[0]?.display,
74739
74741
  uploadedOn: r.date ?? "",
74740
74742
  uploadedBy: r.author?.[0]?.display,
74741
- contentType: n?.contentType,
74742
- documentUrl: n?.url ?? ""
74743
+ contentType: i?.contentType,
74744
+ documentUrl: i?.url ?? "",
74745
+ attachments: a
74743
74746
  };
74744
74747
  });
74745
74748
  }
@@ -81299,7 +81302,7 @@ const Lot = [
81299
81302
  },
81300
81303
  {
81301
81304
  type: "patientDocuments",
81302
- component: Pr(() => import("./DocumentsTable-CafHkVha.js"))
81305
+ component: Pr(() => import("./DocumentsTable-DjFKN-vZ.js"))
81303
81306
  },
81304
81307
  {
81305
81308
  type: "flowSheet",
@@ -81307,7 +81310,7 @@ const Lot = [
81307
81310
  },
81308
81311
  {
81309
81312
  type: "forms",
81310
- component: Pr(() => import("./FormsTable-BMmldQfg.js"))
81313
+ component: Pr(() => import("./FormsTable-mzSugDHQ.js"))
81311
81314
  },
81312
81315
  {
81313
81316
  type: "labOrders",
@@ -81315,7 +81318,7 @@ const Lot = [
81315
81318
  },
81316
81319
  {
81317
81320
  type: "observations",
81318
- component: Pr(() => import("./Observations-CHkBu95w.js"))
81321
+ component: Pr(() => import("./Observations-DsWnt3nO.js"))
81319
81322
  },
81320
81323
  {
81321
81324
  type: "ordersControl",
@@ -81387,71 +81390,70 @@ const Tat = (t) => {
81387
81390
  d1.getInstance().reset();
81388
81391
  };
81389
81392
  export {
81390
- Aot as $,
81393
+ zat as $,
81391
81394
  Jtt as A,
81392
81395
  Y2 as B,
81393
81396
  Hnt as C,
81394
81397
  _nt as D,
81395
- q0t as E,
81396
- T0t as F,
81398
+ T0t as E,
81399
+ iot as F,
81397
81400
  tqe as G,
81398
- iot as H,
81399
- mot as I,
81401
+ mot as H,
81402
+ xat as I,
81400
81403
  uat as J,
81401
- xat as K,
81404
+ Stt as K,
81402
81405
  M2t as L,
81403
81406
  ar as M,
81404
81407
  ys as N,
81405
- Stt as O,
81406
- K0 as P,
81408
+ Eat as O,
81409
+ pat as P,
81407
81410
  gat as Q,
81408
81411
  $c as R,
81409
81412
  Mat as S,
81410
81413
  Zr as T,
81411
- Eat as U,
81414
+ l5e as U,
81412
81415
  G2t as V,
81413
- l5e as W,
81416
+ Nat as W,
81414
81417
  Fot as X,
81415
- Nat as Y,
81418
+ Aot as Y,
81416
81419
  cat as Z,
81417
81420
  Pot as _,
81418
81421
  o1 as a,
81419
- zat as a0,
81420
- _ot as a1,
81421
- Aat as a2,
81422
- d5e as a3,
81423
- _at as a4,
81424
- Cat as a5,
81425
- Tat as a6,
81426
- Oat as a7,
81427
- Lat as a8,
81428
- Dat as a9,
81429
- Rat as aa,
81430
- $at as ab,
81431
- Sat as ac,
81422
+ _ot as a0,
81423
+ Aat as a1,
81424
+ d5e as a2,
81425
+ _at as a3,
81426
+ Cat as a4,
81427
+ Tat as a5,
81428
+ Oat as a6,
81429
+ Lat as a7,
81430
+ Dat as a8,
81431
+ Rat as a9,
81432
+ $at as aa,
81433
+ Sat as ab,
81432
81434
  $1 as b,
81433
81435
  T0 as c,
81434
81436
  Wot as d,
81435
81437
  qot as e,
81436
81438
  h0t as f,
81437
81439
  fat as g,
81438
- pat as h,
81440
+ bn as h,
81439
81441
  mhe as i,
81440
- bn as j,
81441
- G2 as k,
81442
- yat as l,
81443
- jot as m,
81444
- Vat as n,
81445
- dat as o,
81446
- hat as p,
81442
+ G2 as j,
81443
+ yat as k,
81444
+ jot as l,
81445
+ Vat as m,
81446
+ dat as n,
81447
+ hat as o,
81448
+ Hat as p,
81447
81449
  wat as q,
81448
- Hat as r,
81450
+ L4 as r,
81449
81451
  bat as s,
81450
81452
  Ar as t,
81451
81453
  p1 as u,
81452
- L4 as v,
81453
- vat as w,
81454
+ vat as v,
81455
+ W1t as w,
81454
81456
  mat as x,
81455
- W1t as y,
81456
- t0t as z
81457
+ t0t as y,
81458
+ q0t as z
81457
81459
  };