@bahmni/admin-app 0.0.1-dev.439 → 0.0.1-dev.441
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-CULvIpd5.js → AdminDashboard-C2YLAyRD.js} +2 -2
- package/dist/App.d.ts.map +1 -1
- package/dist/{AuditLog-DkTbV9BG.js → AuditLog-BYlHkWNg.js} +38 -38
- package/dist/CsvExport-BgJK-WCC.js +122 -0
- package/dist/{CsvUpload-DkuV4Ixd.js → CsvUpload-D7iOeVhg.js} +1 -1
- package/dist/{DocumentsTable-DOPEQt14-D496l9qY.js → DocumentsTable-BCWUH3WY-B9REAVh7.js} +14 -14
- package/dist/{FormsTable-5kbGeeFq-2NxLFWoa.js → FormsTable-Bb-cDsSI-CQjE5XbB.js} +84 -84
- package/dist/{LNWAZHJI-DL7T8niD.js → LNWAZHJI-BoBLdPIu.js} +2 -2
- package/dist/{MWZ6AO7Z-DQwcZPbL.js → MWZ6AO7Z-Cg0Kt-G9.js} +5 -5
- package/dist/{Observations-BUz9smcC-AopQYTP_.js → Observations-B5TN5tfi-7m0gXHuQ.js} +59 -59
- package/dist/{YPM2AS64-CUMbqjIc.js → YPM2AS64-DsTQkrYO.js} +138 -138
- package/dist/{index-DCAEnw_P.js → index-C1nJC-ZZ.js} +31641 -31549
- package/dist/index.css +1 -1
- package/dist/index.js +1 -1
- package/dist/locales/locale_en.json +13 -0
- package/dist/locales/locale_es.json +13 -0
- package/dist/pages/CsvExport.d.ts +3 -0
- package/dist/pages/CsvExport.d.ts.map +1 -0
- package/dist/routes/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { A as o, p as a, r as s, t as r } from "./index-C1nJC-ZZ.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "@tanstack/react-query";
|
|
5
5
|
const i = () => /* @__PURE__ */ e(o, { children: /* @__PURE__ */ e(
|
|
6
6
|
a,
|
|
7
7
|
{
|
|
8
|
-
extensionPointId:
|
|
8
|
+
extensionPointId: r,
|
|
9
9
|
appName: s,
|
|
10
10
|
loadingLabelKey: "ADMIN_LOADING_MODULES",
|
|
11
11
|
errorMessageKey: "ADMIN_ERROR_FETCH_CONFIG",
|
package/dist/App.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":"AAqBA,wBAAgB,GAAG,4CA2ClB;AAED,eAAe,GAAG,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as d, jsxs as S } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { useState as l, useRef as
|
|
2
|
+
import { _ as ee, a0 as te, a1 as se, a2 as K, u as ae, a3 as ne, a4 as re, A as ie, S as oe, a5 as ue, a6 as de, a7 as U, U as H, a8 as le } from "./index-C1nJC-ZZ.js";
|
|
3
|
+
import { useState as l, useRef as C, useEffect as k, useMemo as ce, useCallback as me } from "react";
|
|
4
4
|
import { useQuery as _e } from "@tanstack/react-query";
|
|
5
|
-
const
|
|
5
|
+
const G = Symbol.for("constructDateFrom");
|
|
6
6
|
function y(e, t) {
|
|
7
|
-
return typeof e == "function" ? e(t) : e && typeof e == "object" &&
|
|
7
|
+
return typeof e == "function" ? e(t) : e && typeof e == "object" && G in e ? e[G](t) : e instanceof Date ? new e.constructor(t) : new Date(t);
|
|
8
8
|
}
|
|
9
9
|
function w(e, t) {
|
|
10
10
|
return y(e, e);
|
|
@@ -32,15 +32,15 @@ const Le = (e, t) => {
|
|
|
32
32
|
}
|
|
33
33
|
if (!Number.isNaN(r.getTime()))
|
|
34
34
|
return r.toISOString();
|
|
35
|
-
}, q = "NO_EVENTS_FOUND", Y = "NO_MORE_EVENTS_FOUND",
|
|
35
|
+
}, q = "NO_EVENTS_FOUND", Y = "NO_MORE_EVENTS_FOUND", Te = "MATCHING_EVENTS_NOT_FOUND", Ie = () => {
|
|
36
36
|
const [e, t] = l({
|
|
37
37
|
startDate: ee(),
|
|
38
38
|
startTime: "00:00",
|
|
39
39
|
username: "",
|
|
40
40
|
patientId: ""
|
|
41
|
-
}), [r, a] = l(0), [i, u] = l(0), [_, E] = l([]), [R, p] = l(null), [b, f] = l(!1), [F, g] = l(!1), [O, M] = l(1),
|
|
42
|
-
|
|
43
|
-
}, o =
|
|
41
|
+
}), [r, a] = l(0), [i, u] = l(0), [_, E] = l([]), [R, p] = l(null), [b, f] = l(!1), [F, g] = l(!1), [O, M] = l(1), T = C(1), s = (c) => {
|
|
42
|
+
T.current = c, M(c);
|
|
43
|
+
}, o = C(0), [n, j] = l(null), B = C(null), { data: N, isLoading: z, isFetching: L, isError: Q } = _e({
|
|
44
44
|
queryKey: ["auditLogs", n?.requestId],
|
|
45
45
|
queryFn: () => te(n.params),
|
|
46
46
|
enabled: !!n,
|
|
@@ -48,18 +48,18 @@ const Le = (e, t) => {
|
|
|
48
48
|
// (and audit logs must always be fetched fresh). Drop entries as soon as
|
|
49
49
|
// they become inactive instead of retaining them for the default gcTime.
|
|
50
50
|
gcTime: 0
|
|
51
|
-
}),
|
|
51
|
+
}), I = (c, V, m, D, h, $) => {
|
|
52
52
|
o.current += 1, j({
|
|
53
53
|
action: c,
|
|
54
|
-
params:
|
|
54
|
+
params: V,
|
|
55
55
|
alwaysReplace: m,
|
|
56
56
|
defaultFirstIndex: D,
|
|
57
57
|
defaultLastIndex: h,
|
|
58
58
|
emptyMessageKey: $,
|
|
59
59
|
requestId: o.current
|
|
60
60
|
});
|
|
61
|
-
}, A = Le(e.startDate, e.startTime),
|
|
62
|
-
|
|
61
|
+
}, A = Le(e.startDate, e.startTime), X = () => {
|
|
62
|
+
I(
|
|
63
63
|
"init",
|
|
64
64
|
{ startFrom: A, defaultView: !0 },
|
|
65
65
|
!0,
|
|
@@ -67,13 +67,13 @@ const Le = (e, t) => {
|
|
|
67
67
|
0,
|
|
68
68
|
q
|
|
69
69
|
);
|
|
70
|
-
},
|
|
70
|
+
}, v = () => !!r || !!i, W = () => {
|
|
71
71
|
if (!L) {
|
|
72
|
-
if (!
|
|
72
|
+
if (!v()) {
|
|
73
73
|
x();
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
|
-
|
|
76
|
+
I(
|
|
77
77
|
"next",
|
|
78
78
|
{
|
|
79
79
|
lastAuditLogId: i,
|
|
@@ -88,13 +88,13 @@ const Le = (e, t) => {
|
|
|
88
88
|
Y
|
|
89
89
|
);
|
|
90
90
|
}
|
|
91
|
-
},
|
|
91
|
+
}, Z = () => {
|
|
92
92
|
if (!L) {
|
|
93
|
-
if (!
|
|
93
|
+
if (!v()) {
|
|
94
94
|
x();
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
|
-
|
|
97
|
+
I(
|
|
98
98
|
"prev",
|
|
99
99
|
{
|
|
100
100
|
lastAuditLogId: r,
|
|
@@ -109,7 +109,7 @@ const Le = (e, t) => {
|
|
|
109
109
|
);
|
|
110
110
|
}
|
|
111
111
|
}, x = () => {
|
|
112
|
-
L ||
|
|
112
|
+
L || I(
|
|
113
113
|
"runReport",
|
|
114
114
|
{
|
|
115
115
|
defaultView: !0,
|
|
@@ -120,7 +120,7 @@ const Le = (e, t) => {
|
|
|
120
120
|
!0,
|
|
121
121
|
0,
|
|
122
122
|
0,
|
|
123
|
-
|
|
123
|
+
Te
|
|
124
124
|
);
|
|
125
125
|
}, J = () => {
|
|
126
126
|
L || (t({
|
|
@@ -128,11 +128,11 @@ const Le = (e, t) => {
|
|
|
128
128
|
startTime: "",
|
|
129
129
|
username: "",
|
|
130
130
|
patientId: ""
|
|
131
|
-
}),
|
|
131
|
+
}), I("init", { defaultView: !0 }, !0, 0, 0, q));
|
|
132
132
|
};
|
|
133
|
-
return
|
|
134
|
-
|
|
135
|
-
}, []),
|
|
133
|
+
return k(() => {
|
|
134
|
+
X();
|
|
135
|
+
}, []), k(() => {
|
|
136
136
|
if (!n || N === void 0 || B.current === n.requestId) return;
|
|
137
137
|
B.current = n.requestId;
|
|
138
138
|
const c = !!n.params.defaultView, m = (c ? N : [...N].reverse()).map(se), D = m.length === K;
|
|
@@ -140,10 +140,10 @@ const Le = (e, t) => {
|
|
|
140
140
|
if (E(m), p(null), a(m[0].auditLogId), u(m[m.length - 1].auditLogId), c)
|
|
141
141
|
g(!1), f(D), s(1);
|
|
142
142
|
else if (n.action === "next")
|
|
143
|
-
g(!0), f(D), s(
|
|
143
|
+
g(!0), f(D), s(T.current + 1);
|
|
144
144
|
else {
|
|
145
145
|
f(!0);
|
|
146
|
-
const h = Math.max(1,
|
|
146
|
+
const h = Math.max(1, T.current - 1);
|
|
147
147
|
g(h > 1), s(h);
|
|
148
148
|
}
|
|
149
149
|
else
|
|
@@ -152,17 +152,17 @@ const Le = (e, t) => {
|
|
|
152
152
|
filters: e,
|
|
153
153
|
setFilters: t,
|
|
154
154
|
logs: _,
|
|
155
|
-
isLoading:
|
|
155
|
+
isLoading: z || L,
|
|
156
156
|
isFetching: L,
|
|
157
|
-
isError:
|
|
157
|
+
isError: Q,
|
|
158
158
|
emptyMessageKey: R,
|
|
159
159
|
firstIndex: r,
|
|
160
160
|
lastIndex: i,
|
|
161
161
|
hasNext: b,
|
|
162
162
|
hasPrevious: F,
|
|
163
163
|
currentPageNumber: O,
|
|
164
|
-
next:
|
|
165
|
-
prev:
|
|
164
|
+
next: W,
|
|
165
|
+
prev: Z,
|
|
166
166
|
runReport: x,
|
|
167
167
|
reset: J
|
|
168
168
|
};
|
|
@@ -186,7 +186,7 @@ const Le = (e, t) => {
|
|
|
186
186
|
prev: F,
|
|
187
187
|
runReport: g,
|
|
188
188
|
reset: O
|
|
189
|
-
} =
|
|
189
|
+
} = Ie(), M = ce(
|
|
190
190
|
() => [
|
|
191
191
|
{ key: "auditLogId", header: e("EVENT_ID") },
|
|
192
192
|
{ key: "dateCreated", header: e("CREATED_AT") },
|
|
@@ -197,7 +197,7 @@ const Le = (e, t) => {
|
|
|
197
197
|
{ key: "module", header: e("MODULE") }
|
|
198
198
|
],
|
|
199
199
|
[e]
|
|
200
|
-
),
|
|
200
|
+
), T = me(
|
|
201
201
|
(s, o) => {
|
|
202
202
|
switch (o) {
|
|
203
203
|
case "dateCreated":
|
|
@@ -256,7 +256,7 @@ const Le = (e, t) => {
|
|
|
256
256
|
t.startDate?.getTime() ?? "empty"
|
|
257
257
|
),
|
|
258
258
|
/* @__PURE__ */ d(
|
|
259
|
-
|
|
259
|
+
U,
|
|
260
260
|
{
|
|
261
261
|
id: "audit-log-start-time",
|
|
262
262
|
type: "time",
|
|
@@ -270,7 +270,7 @@ const Le = (e, t) => {
|
|
|
270
270
|
}
|
|
271
271
|
),
|
|
272
272
|
/* @__PURE__ */ d(
|
|
273
|
-
|
|
273
|
+
U,
|
|
274
274
|
{
|
|
275
275
|
id: "audit-log-username",
|
|
276
276
|
labelText: e("USERNAME_FILTER_LABEL"),
|
|
@@ -284,7 +284,7 @@ const Le = (e, t) => {
|
|
|
284
284
|
}
|
|
285
285
|
),
|
|
286
286
|
/* @__PURE__ */ d(
|
|
287
|
-
|
|
287
|
+
U,
|
|
288
288
|
{
|
|
289
289
|
id: "audit-log-patient-id",
|
|
290
290
|
labelText: e("PATIENT_ID_FILTER_LABEL"),
|
|
@@ -298,7 +298,7 @@ const Le = (e, t) => {
|
|
|
298
298
|
}
|
|
299
299
|
),
|
|
300
300
|
/* @__PURE__ */ d(
|
|
301
|
-
|
|
301
|
+
H,
|
|
302
302
|
{
|
|
303
303
|
kind: "tertiary",
|
|
304
304
|
onClick: O,
|
|
@@ -308,7 +308,7 @@ const Le = (e, t) => {
|
|
|
308
308
|
}
|
|
309
309
|
),
|
|
310
310
|
/* @__PURE__ */ d(
|
|
311
|
-
|
|
311
|
+
H,
|
|
312
312
|
{
|
|
313
313
|
kind: "primary",
|
|
314
314
|
onClick: g,
|
|
@@ -328,7 +328,7 @@ const Le = (e, t) => {
|
|
|
328
328
|
title: e("AUDIT_LOG_TABLE_HEADER_LABEL"),
|
|
329
329
|
dataTestId: "audit-log-table",
|
|
330
330
|
loading: i,
|
|
331
|
-
renderCell:
|
|
331
|
+
renderCell: T,
|
|
332
332
|
emptyStateMessage: E ? e(E) : void 0,
|
|
333
333
|
errorStateMessage: _ ? e("ADMIN_ERROR_FETCH_CONFIG") : null,
|
|
334
334
|
pagination: {
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { jsx as n, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import { u as M, z as N, x as R, y as O, C as h, M as P, O as g, A as V, S as x, T as D, U as f, V as y } from "./index-C1nJC-ZZ.js";
|
|
3
|
+
import { useState as E, useMemo as b } from "react";
|
|
4
|
+
import { useQuery as L, useMutation as v } from "@tanstack/react-query";
|
|
5
|
+
const X = "CsvExport-module_tile__yBrLM", B = "CsvExport-module_title__epZnI", U = "CsvExport-module_form__w-cN-", z = "CsvExport-module_search__G82i7", r = {
|
|
6
|
+
tile: X,
|
|
7
|
+
title: B,
|
|
8
|
+
form: U,
|
|
9
|
+
search: z
|
|
10
|
+
}, G = 300, S = 2, _ = 5e3, H = "custom:(uuid,setMembers:(uuid))", K = () => {
|
|
11
|
+
const { t } = M(), { addNotification: i } = N(), [p, C] = E(""), [s, c] = E(
|
|
12
|
+
null
|
|
13
|
+
), a = R(p.trim(), G), { data: l = [] } = L({
|
|
14
|
+
queryKey: ["csvExportConceptSearch", a],
|
|
15
|
+
queryFn: () => O(a),
|
|
16
|
+
enabled: a.length >= S && a !== s?.name,
|
|
17
|
+
// Keep prior options visible while the next term loads, but not once the input is too short to search
|
|
18
|
+
placeholderData: (e) => a.length >= S ? e : void 0
|
|
19
|
+
}), T = b(
|
|
20
|
+
() => l.flatMap(
|
|
21
|
+
(e) => e.name?.name ? [{ uuid: e.uuid, name: e.name.name }] : []
|
|
22
|
+
),
|
|
23
|
+
[l]
|
|
24
|
+
), o = v({
|
|
25
|
+
mutationFn: async (e) => (await P(e.uuid, H)).setMembers?.length ? g(e.name) : null,
|
|
26
|
+
onSuccess: (e, u) => {
|
|
27
|
+
const m = u.name;
|
|
28
|
+
if (!e || e.size === 0) {
|
|
29
|
+
i({
|
|
30
|
+
type: "error",
|
|
31
|
+
title: t("ADMIN_CSV_EXPORT_NO_DATA_TITLE"),
|
|
32
|
+
message: t("ADMIN_CSV_EXPORT_NO_DATA_MESSAGE"),
|
|
33
|
+
timeout: _
|
|
34
|
+
});
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
h(e, `${m}.zip`), i({
|
|
38
|
+
type: "success",
|
|
39
|
+
title: t("ADMIN_CSV_EXPORT_SUCCESS_TITLE"),
|
|
40
|
+
message: t("ADMIN_CSV_EXPORT_SUCCESS_MESSAGE", { conceptName: m }),
|
|
41
|
+
timeout: _
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
onError: (e) => {
|
|
45
|
+
i({
|
|
46
|
+
type: "error",
|
|
47
|
+
title: t("ADMIN_CSV_EXPORT_ERROR_TITLE"),
|
|
48
|
+
message: e.message,
|
|
49
|
+
timeout: _
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}), I = (e) => {
|
|
53
|
+
C(e), s && e !== s.name && c(null);
|
|
54
|
+
}, A = (e) => {
|
|
55
|
+
if (e.preventDefault(), !o.isPending) {
|
|
56
|
+
if (!s) {
|
|
57
|
+
i({
|
|
58
|
+
type: "error",
|
|
59
|
+
title: t("ADMIN_CSV_EXPORT_SELECT_CONCEPT_TITLE"),
|
|
60
|
+
message: t("ADMIN_CSV_EXPORT_SELECT_CONCEPT_MESSAGE"),
|
|
61
|
+
timeout: _
|
|
62
|
+
});
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
o.mutate(s);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
return /* @__PURE__ */ n(V, { breadcrumbLabel: t("BREADCRUMB_CSV_EXPORT"), children: /* @__PURE__ */ d(
|
|
69
|
+
x,
|
|
70
|
+
{
|
|
71
|
+
id: "admin-csv-export-page",
|
|
72
|
+
"data-testid": "admin-csv-export-page-test-id",
|
|
73
|
+
"aria-label": "CSV Export Page",
|
|
74
|
+
className: r.tile,
|
|
75
|
+
children: [
|
|
76
|
+
/* @__PURE__ */ n("h2", { className: r.title, children: t("ADMIN_CSV_EXPORT_TITLE") }),
|
|
77
|
+
/* @__PURE__ */ d("form", { className: r.form, onSubmit: A, noValidate: !0, children: [
|
|
78
|
+
/* @__PURE__ */ n("div", { className: r.search, children: /* @__PURE__ */ n(
|
|
79
|
+
D,
|
|
80
|
+
{
|
|
81
|
+
id: "csv-export-concept-search",
|
|
82
|
+
"data-testid": "csv-export-concept-search-test-id",
|
|
83
|
+
titleText: "",
|
|
84
|
+
placeholder: t("ADMIN_CSV_EXPORT_SEARCH_PLACEHOLDER"),
|
|
85
|
+
"aria-label": t("ADMIN_CSV_EXPORT_SEARCH_ARIA_LABEL"),
|
|
86
|
+
items: T,
|
|
87
|
+
itemToString: (e) => e?.name ?? "",
|
|
88
|
+
selectedItem: s,
|
|
89
|
+
onChange: ({ selectedItem: e }) => c(
|
|
90
|
+
typeof e == "object" ? e ?? null : null
|
|
91
|
+
),
|
|
92
|
+
onInputChange: I,
|
|
93
|
+
allowCustomValue: !0,
|
|
94
|
+
disabled: o.isPending,
|
|
95
|
+
size: "md"
|
|
96
|
+
}
|
|
97
|
+
) }),
|
|
98
|
+
/* @__PURE__ */ n(
|
|
99
|
+
f,
|
|
100
|
+
{
|
|
101
|
+
type: "submit",
|
|
102
|
+
kind: "primary",
|
|
103
|
+
size: "md",
|
|
104
|
+
testId: "csv-export-button-test-id",
|
|
105
|
+
disabled: o.isPending,
|
|
106
|
+
children: o.isPending ? /* @__PURE__ */ n(
|
|
107
|
+
y,
|
|
108
|
+
{
|
|
109
|
+
description: t("ADMIN_CSV_EXPORT_IN_PROGRESS"),
|
|
110
|
+
testId: "csv-export-loading-test-id"
|
|
111
|
+
}
|
|
112
|
+
) : t("ADMIN_CSV_EXPORT_BUTTON")
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
] })
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
) });
|
|
119
|
+
};
|
|
120
|
+
export {
|
|
121
|
+
K as CsvExport
|
|
122
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as d, jsxs as h, Fragment as x } from "react/jsx-runtime";
|
|
2
|
-
import { d as G, u as W, z as Y,
|
|
2
|
+
import { d as G, u as W, z as Y, P as J, s as X, h as Z, $ as ee, a as te } from "./index-C1nJC-ZZ.js";
|
|
3
3
|
import { useQuery as ae } from "@tanstack/react-query";
|
|
4
4
|
import { useState as l, useCallback as _, useEffect as I, useMemo as p } from "react";
|
|
5
5
|
const ne = "DocumentsTable-module_documentsTableBody__6iR3w", oe = "DocumentsTable-module_viewAttachmentsLink__aQ1on", de = "DocumentsTable-module_documentViewerContainer__F5m8D", re = "DocumentsTable-module_attachmentItem__17KA7", se = "DocumentsTable-module_attachmentCounter__WFiI3", me = "DocumentsTable-module_attachmentError__RI4U2", ce = "DocumentsTable-module_documentIframe__ptq5I", le = "DocumentsTable-module_documentImage__KQVgS", r = {
|
|
@@ -18,7 +18,7 @@ const ne = "DocumentsTable-module_documentsTableBody__6iR3w", oe = "DocumentsTab
|
|
|
18
18
|
uploadedBy: "DOCUMENTS_UPLOADED_BY",
|
|
19
19
|
attachments: "DOCUMENTS_ATTACHMENTS"
|
|
20
20
|
};
|
|
21
|
-
function
|
|
21
|
+
function R(a) {
|
|
22
22
|
return !a || a.includes(":") ? "#" : `/openmrs/auth?requested_document=/document_images/${a}`;
|
|
23
23
|
}
|
|
24
24
|
function ie(a, E) {
|
|
@@ -42,9 +42,9 @@ const Te = [
|
|
|
42
42
|
U(e), w(!0);
|
|
43
43
|
}, []), H = _(() => {
|
|
44
44
|
w(!1), U(null), O(/* @__PURE__ */ new Set());
|
|
45
|
-
}, []),
|
|
45
|
+
}, []), v = _((e) => {
|
|
46
46
|
O((t) => new Set(t).add(e));
|
|
47
|
-
}, []), { data: i, isLoading:
|
|
47
|
+
}, []), { data: i, isLoading: P, isError: y, error: b } = ae({
|
|
48
48
|
queryKey: [
|
|
49
49
|
"documents",
|
|
50
50
|
g,
|
|
@@ -76,7 +76,7 @@ const Te = [
|
|
|
76
76
|
if (!s || !o) return;
|
|
77
77
|
const t = /* @__PURE__ */ new Set(), m = B(o);
|
|
78
78
|
for (let c = 0; c < m.length; c++) {
|
|
79
|
-
const S =
|
|
79
|
+
const S = R(m[c].url);
|
|
80
80
|
try {
|
|
81
81
|
(await fetch(S, {
|
|
82
82
|
method: "HEAD",
|
|
@@ -89,7 +89,7 @@ const Te = [
|
|
|
89
89
|
e.signal.aborted || O(t);
|
|
90
90
|
})(), () => e.abort();
|
|
91
91
|
}, [s, o]);
|
|
92
|
-
const
|
|
92
|
+
const q = _(
|
|
93
93
|
(e, t) => {
|
|
94
94
|
t !== u ? (V(t), C(1), A(void 0)) : C(e);
|
|
95
95
|
},
|
|
@@ -97,7 +97,7 @@ const Te = [
|
|
|
97
97
|
), N = p(
|
|
98
98
|
() => a?.fields ?? Te,
|
|
99
99
|
[a?.fields]
|
|
100
|
-
),
|
|
100
|
+
), z = p(() => [...i?.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), [i]), j = p(() => ie(N, n), [N, n]), K = p(
|
|
101
101
|
() => N.map((e) => ({
|
|
102
102
|
key: e,
|
|
103
103
|
sortable: e !== "attachments"
|
|
@@ -141,10 +141,10 @@ const Te = [
|
|
|
141
141
|
/* @__PURE__ */ d("div", { "data-testid": "documents-table", children: /* @__PURE__ */ d(
|
|
142
142
|
ee,
|
|
143
143
|
{
|
|
144
|
-
headers:
|
|
144
|
+
headers: j,
|
|
145
145
|
ariaLabel: n("DOCUMENTS_TABLE_HEADING"),
|
|
146
|
-
rows:
|
|
147
|
-
loading:
|
|
146
|
+
rows: z,
|
|
147
|
+
loading: P,
|
|
148
148
|
errorStateMessage: y ? b?.message : null,
|
|
149
149
|
sortable: K,
|
|
150
150
|
emptyStateMessage: n("DOCUMENTS_NO_RECORDS"),
|
|
@@ -154,7 +154,7 @@ const Te = [
|
|
|
154
154
|
pageSize: u,
|
|
155
155
|
totalItems: F,
|
|
156
156
|
page: f,
|
|
157
|
-
onPageChange:
|
|
157
|
+
onPageChange: q
|
|
158
158
|
}
|
|
159
159
|
) }),
|
|
160
160
|
s && o && /* @__PURE__ */ d(
|
|
@@ -169,7 +169,7 @@ const Te = [
|
|
|
169
169
|
size: "lg",
|
|
170
170
|
testId: "document-view-modal",
|
|
171
171
|
children: /* @__PURE__ */ d("div", { className: r.documentViewerContainer, children: T.map((e, t) => {
|
|
172
|
-
const m =
|
|
172
|
+
const m = R(e.url), c = e.contentType?.toLowerCase().includes("pdf"), S = (e.contentType?.toLowerCase().includes("image") ?? !1) || he.test(e.url ?? ""), D = $.has(t);
|
|
173
173
|
return m === "#" || D ? /* @__PURE__ */ h(
|
|
174
174
|
"div",
|
|
175
175
|
{
|
|
@@ -202,7 +202,7 @@ const Te = [
|
|
|
202
202
|
src: m,
|
|
203
203
|
alt: o.documentIdentifier,
|
|
204
204
|
className: r.documentImage,
|
|
205
|
-
onError: () =>
|
|
205
|
+
onError: () => v(t)
|
|
206
206
|
}
|
|
207
207
|
) : /* @__PURE__ */ d(
|
|
208
208
|
"iframe",
|
|
@@ -210,7 +210,7 @@ const Te = [
|
|
|
210
210
|
src: c ? `${m}#toolbar=0` : m,
|
|
211
211
|
className: r.documentIframe,
|
|
212
212
|
title: o.documentIdentifier,
|
|
213
|
-
onError: () =>
|
|
213
|
+
onError: () => v(t)
|
|
214
214
|
}
|
|
215
215
|
)
|
|
216
216
|
]
|