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