@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
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import "react";
|
|
2
|
+
import { H as o, M as a, P as s, S as t } from "./index-B11WX0rP.js";
|
|
4
3
|
import "@tanstack/react-query";
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import "react";
|
|
5
|
+
const i = () => /* @__PURE__ */ e(o, { children: /* @__PURE__ */ e(
|
|
6
|
+
a,
|
|
7
7
|
{
|
|
8
8
|
extensionPointId: t,
|
|
9
9
|
appName: s,
|
|
@@ -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 U, useEffect as
|
|
2
|
+
import { ak as ee, al as te, am as se, an as K, a as ae, ao as ne, a6 as re, H as ie, a7 as oe, ap as ue, aq as de, ar as C, aa as k, ac as le } from "./index-B11WX0rP.js";
|
|
3
|
+
import { useState as l, useRef as U, useEffect as G, useMemo as ce, useCallback as me } from "react";
|
|
4
4
|
import { useQuery as Ee } from "@tanstack/react-query";
|
|
5
|
-
const
|
|
5
|
+
const V = 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" && V in e ? e[V](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
|
-
},
|
|
35
|
+
}, q = "NO_EVENTS_FOUND", Y = "NO_MORE_EVENTS_FOUND", Te = "MATCHING_EVENTS_NOT_FOUND", pe = () => {
|
|
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,
|
|
42
|
-
|
|
43
|
-
}, o = U(0), [n,
|
|
41
|
+
}), [r, a] = l(0), [i, u] = l(0), [E, _] = l([]), [R, I] = l(null), [b, f] = l(!1), [O, g] = l(!1), [F, M] = l(1), T = U(1), s = (c) => {
|
|
42
|
+
T.current = c, M(c);
|
|
43
|
+
}, o = U(0), [n, j] = l(null), B = U(null), { data: N, isLoading: z, isFetching: L, isError: Q } = Ee({
|
|
44
44
|
queryKey: ["auditLogs", n?.requestId],
|
|
45
45
|
queryFn: () => te(n.params),
|
|
46
46
|
enabled: !!n,
|
|
@@ -48,24 +48,24 @@ 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
|
-
}),
|
|
52
|
-
o.current += 1,
|
|
51
|
+
}), p = (c, H, m, D, h, $) => {
|
|
52
|
+
o.current += 1, j({
|
|
53
53
|
action: c,
|
|
54
54
|
params: H,
|
|
55
55
|
alwaysReplace: m,
|
|
56
|
-
defaultFirstIndex:
|
|
57
|
-
defaultLastIndex:
|
|
58
|
-
emptyMessageKey:
|
|
56
|
+
defaultFirstIndex: D,
|
|
57
|
+
defaultLastIndex: h,
|
|
58
|
+
emptyMessageKey: $,
|
|
59
59
|
requestId: o.current
|
|
60
60
|
});
|
|
61
61
|
}, A = Le(e.startDate, e.startTime), X = () => {
|
|
62
|
-
|
|
62
|
+
p(
|
|
63
63
|
"init",
|
|
64
64
|
{ startFrom: A, defaultView: !0 },
|
|
65
65
|
!0,
|
|
66
66
|
0,
|
|
67
67
|
0,
|
|
68
|
-
|
|
68
|
+
q
|
|
69
69
|
);
|
|
70
70
|
}, v = () => !!r || !!i, Z = () => {
|
|
71
71
|
if (!L) {
|
|
@@ -73,7 +73,7 @@ const Le = (e, t) => {
|
|
|
73
73
|
x();
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
|
-
|
|
76
|
+
p(
|
|
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
|
+
}, J = () => {
|
|
92
92
|
if (!L) {
|
|
93
93
|
if (!v()) {
|
|
94
94
|
x();
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
|
-
|
|
97
|
+
p(
|
|
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 || p(
|
|
113
113
|
"runReport",
|
|
114
114
|
{
|
|
115
115
|
defaultView: !0,
|
|
@@ -120,54 +120,54 @@ const Le = (e, t) => {
|
|
|
120
120
|
!0,
|
|
121
121
|
0,
|
|
122
122
|
0,
|
|
123
|
-
|
|
123
|
+
Te
|
|
124
124
|
);
|
|
125
|
-
},
|
|
125
|
+
}, W = () => {
|
|
126
126
|
L || (t({
|
|
127
127
|
startDate: null,
|
|
128
128
|
startTime: "",
|
|
129
129
|
username: "",
|
|
130
130
|
patientId: ""
|
|
131
|
-
}),
|
|
131
|
+
}), p("init", { defaultView: !0 }, !0, 0, 0, q));
|
|
132
132
|
};
|
|
133
|
-
return
|
|
133
|
+
return G(() => {
|
|
134
134
|
X();
|
|
135
|
-
}, []),
|
|
135
|
+
}, []), G(() => {
|
|
136
136
|
if (!n || N === void 0 || B.current === n.requestId) return;
|
|
137
137
|
B.current = n.requestId;
|
|
138
|
-
const c = !!n.params.defaultView, m = (c ? N : [...N].reverse()).map(se),
|
|
138
|
+
const c = !!n.params.defaultView, m = (c ? N : [...N].reverse()).map(se), D = m.length === K;
|
|
139
139
|
if (m.length)
|
|
140
|
-
if (_(m),
|
|
141
|
-
g(!1), f(
|
|
140
|
+
if (_(m), I(null), a(m[0].auditLogId), u(m[m.length - 1].auditLogId), c)
|
|
141
|
+
g(!1), f(D), s(1);
|
|
142
142
|
else if (n.action === "next")
|
|
143
|
-
g(!0), f(
|
|
143
|
+
g(!0), f(D), s(T.current + 1);
|
|
144
144
|
else {
|
|
145
145
|
f(!0);
|
|
146
|
-
const
|
|
147
|
-
g(
|
|
146
|
+
const h = Math.max(1, T.current - 1);
|
|
147
|
+
g(h > 1), s(h);
|
|
148
148
|
}
|
|
149
149
|
else
|
|
150
|
-
n.alwaysReplace && _([]),
|
|
150
|
+
n.alwaysReplace && _([]), I(n.emptyMessageKey), a(n.defaultFirstIndex), u(n.defaultLastIndex), c ? (f(!1), g(!1), s(1)) : n.action === "next" ? f(!1) : g(!1);
|
|
151
151
|
}, [N, n]), {
|
|
152
152
|
filters: e,
|
|
153
153
|
setFilters: t,
|
|
154
154
|
logs: E,
|
|
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
|
-
hasPrevious:
|
|
163
|
-
currentPageNumber:
|
|
162
|
+
hasPrevious: O,
|
|
163
|
+
currentPageNumber: F,
|
|
164
164
|
next: Z,
|
|
165
|
-
prev:
|
|
165
|
+
prev: J,
|
|
166
166
|
runReport: x,
|
|
167
|
-
reset:
|
|
167
|
+
reset: W
|
|
168
168
|
};
|
|
169
|
-
},
|
|
170
|
-
page:
|
|
169
|
+
}, Ie = "AuditLog-module_page__-FKzd", Ne = "AuditLog-module_filters__DA4tQ", Ae = "AuditLog-module_filterRow__x6DqE", P = {
|
|
170
|
+
page: Ie,
|
|
171
171
|
filters: Ne,
|
|
172
172
|
filterRow: Ae
|
|
173
173
|
}, be = () => {
|
|
@@ -180,13 +180,13 @@ const Le = (e, t) => {
|
|
|
180
180
|
isError: E,
|
|
181
181
|
emptyMessageKey: _,
|
|
182
182
|
hasNext: R,
|
|
183
|
-
hasPrevious:
|
|
183
|
+
hasPrevious: I,
|
|
184
184
|
currentPageNumber: b,
|
|
185
185
|
next: f,
|
|
186
|
-
prev:
|
|
186
|
+
prev: O,
|
|
187
187
|
runReport: g,
|
|
188
|
-
reset:
|
|
189
|
-
} =
|
|
188
|
+
reset: F
|
|
189
|
+
} = pe(), 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":
|
|
@@ -298,17 +298,17 @@ const Le = (e, t) => {
|
|
|
298
298
|
}
|
|
299
299
|
),
|
|
300
300
|
/* @__PURE__ */ d(
|
|
301
|
-
|
|
301
|
+
k,
|
|
302
302
|
{
|
|
303
303
|
kind: "tertiary",
|
|
304
|
-
onClick:
|
|
304
|
+
onClick: F,
|
|
305
305
|
disabled: u,
|
|
306
306
|
testId: "audit-log-reset-button",
|
|
307
307
|
children: e("AUDIT_LOG_RESET_BUTTON_LABEL")
|
|
308
308
|
}
|
|
309
309
|
),
|
|
310
310
|
/* @__PURE__ */ d(
|
|
311
|
-
|
|
311
|
+
k,
|
|
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(_) : void 0,
|
|
333
333
|
errorStateMessage: E ? e("ADMIN_ERROR_FETCH_CONFIG") : null,
|
|
334
334
|
pagination: {
|
|
@@ -336,11 +336,11 @@ const Le = (e, t) => {
|
|
|
336
336
|
pageSize: K,
|
|
337
337
|
startPage: b,
|
|
338
338
|
hasNext: R,
|
|
339
|
-
hasPrevious:
|
|
339
|
+
hasPrevious: I,
|
|
340
340
|
disabled: u,
|
|
341
341
|
previousLabel: e("AUDIT_LOG_PREV_BUTTON_LABEL"),
|
|
342
342
|
nextLabel: e("AUDIT_LOG_NEXT_BUTTON_LABEL"),
|
|
343
|
-
onSetChange: (s) => s === "next" ? f() :
|
|
343
|
+
onSetChange: (s) => s === "next" ? f() : O()
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
346
|
) })
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import { jsx as a, jsxs as d } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
const X = "CsvExport-module_tile__yBrLM",
|
|
2
|
+
import { a as A, z as M, ad as R, ae as h, af as O, ag as g, ah as P, H as f, a7 as D, ai as V, aa as x, aj as b } from "./index-B11WX0rP.js";
|
|
3
|
+
import { useQuery as y, useMutation as L } from "@tanstack/react-query";
|
|
4
|
+
import { useState as E, useMemo as v } from "react";
|
|
5
|
+
const X = "CsvExport-module_tile__yBrLM", H = "CsvExport-module_title__epZnI", B = "CsvExport-module_form__w-cN-", z = "CsvExport-module_search__G82i7", r = {
|
|
6
6
|
tile: X,
|
|
7
|
-
title:
|
|
8
|
-
form:
|
|
9
|
-
search:
|
|
10
|
-
},
|
|
7
|
+
title: H,
|
|
8
|
+
form: B,
|
|
9
|
+
search: z
|
|
10
|
+
}, G = 300, S = 2, _ = 5e3, U = "custom:(uuid,setMembers:(uuid))", Q = () => {
|
|
11
11
|
const { t } = A(), { addNotification: i } = M(), [p, C] = E(""), [s, c] = E(
|
|
12
12
|
null
|
|
13
|
-
), n = R(p.trim(),
|
|
13
|
+
), n = R(p.trim(), G), { data: l = [] } = y({
|
|
14
14
|
queryKey: ["csvExportConceptSearch", n],
|
|
15
15
|
queryFn: () => h(n),
|
|
16
16
|
enabled: n.length >= S && n !== s?.name,
|
|
17
17
|
// Keep prior options visible while the next term loads, but not once the input is too short to search
|
|
18
18
|
placeholderData: (e) => n.length >= S ? e : void 0
|
|
19
|
-
}), T =
|
|
19
|
+
}), T = v(
|
|
20
20
|
() => l.flatMap(
|
|
21
21
|
(e) => e.name?.name ? [{ uuid: e.uuid, name: e.name.name }] : []
|
|
22
22
|
),
|
|
23
23
|
[l]
|
|
24
|
-
), o =
|
|
25
|
-
mutationFn: async (e) => (await
|
|
26
|
-
onSuccess: (e,
|
|
27
|
-
const
|
|
24
|
+
), o = L({
|
|
25
|
+
mutationFn: async (e) => (await g(e.uuid, U)).setMembers?.length ? P(e.name) : null,
|
|
26
|
+
onSuccess: (e, m) => {
|
|
27
|
+
const u = m.name;
|
|
28
28
|
if (!e || e.size === 0) {
|
|
29
29
|
i({
|
|
30
30
|
type: "error",
|
|
@@ -34,10 +34,10 @@ const X = "CsvExport-module_tile__yBrLM", B = "CsvExport-module_title__epZnI", z
|
|
|
34
34
|
});
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
|
-
O(e, `${
|
|
37
|
+
O(e, `${u}.zip`), i({
|
|
38
38
|
type: "success",
|
|
39
39
|
title: t("ADMIN_CSV_EXPORT_SUCCESS_TITLE"),
|
|
40
|
-
message: t("ADMIN_CSV_EXPORT_SUCCESS_MESSAGE", { conceptName:
|
|
40
|
+
message: t("ADMIN_CSV_EXPORT_SUCCESS_MESSAGE", { conceptName: u }),
|
|
41
41
|
timeout: _
|
|
42
42
|
});
|
|
43
43
|
},
|
|
@@ -65,7 +65,7 @@ const X = "CsvExport-module_tile__yBrLM", B = "CsvExport-module_title__epZnI", z
|
|
|
65
65
|
o.mutate(s);
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
|
-
return /* @__PURE__ */ a(
|
|
68
|
+
return /* @__PURE__ */ a(f, { breadcrumbLabel: t("BREADCRUMB_CSV_EXPORT"), children: /* @__PURE__ */ d(
|
|
69
69
|
D,
|
|
70
70
|
{
|
|
71
71
|
id: "admin-csv-export-page",
|
|
@@ -76,7 +76,7 @@ const X = "CsvExport-module_tile__yBrLM", B = "CsvExport-module_title__epZnI", z
|
|
|
76
76
|
/* @__PURE__ */ a("h2", { className: r.title, children: t("ADMIN_CSV_EXPORT_TITLE") }),
|
|
77
77
|
/* @__PURE__ */ d("form", { className: r.form, onSubmit: N, noValidate: !0, children: [
|
|
78
78
|
/* @__PURE__ */ a("div", { className: r.search, children: /* @__PURE__ */ a(
|
|
79
|
-
|
|
79
|
+
V,
|
|
80
80
|
{
|
|
81
81
|
id: "csv-export-concept-search",
|
|
82
82
|
"data-testid": "csv-export-concept-search-test-id",
|
|
@@ -118,5 +118,5 @@ const X = "CsvExport-module_tile__yBrLM", B = "CsvExport-module_title__epZnI", z
|
|
|
118
118
|
) });
|
|
119
119
|
};
|
|
120
120
|
export {
|
|
121
|
-
|
|
121
|
+
Q as CsvExport
|
|
122
122
|
};
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { jsx as t, jsxs as A } from "react/jsx-runtime";
|
|
2
|
+
import { _ as O, a as C, z as y, a0 as U, a1 as f, a2 as g, a3 as N, a4 as h, a5 as m, a6 as V, H as P, a7 as F, a8 as v, a9 as b, aa as w, ab as x, ac as G } from "./index-B11WX0rP.js";
|
|
3
|
+
import { useState as D, useCallback as R, useRef as Y, useMemo as H } from "react";
|
|
4
|
+
import { useQuery as k, useQueryClient as B } from "@tanstack/react-query";
|
|
5
|
+
const L = ["importedItems"], K = () => k({
|
|
6
|
+
queryKey: L,
|
|
7
|
+
queryFn: O,
|
|
8
|
+
staleTime: 0,
|
|
9
|
+
refetchOnMount: "always"
|
|
10
|
+
}), Q = "", q = () => {
|
|
11
|
+
const { t: e } = C(), _ = B(), { addNotification: l } = y(), [d, n] = D(null);
|
|
12
|
+
return { upload: R(
|
|
13
|
+
async (c, E) => {
|
|
14
|
+
for (const [r, a] of c.entries()) {
|
|
15
|
+
n({
|
|
16
|
+
fileName: a.name,
|
|
17
|
+
fileIndex: r + 1,
|
|
18
|
+
fileCount: c.length,
|
|
19
|
+
percent: 0,
|
|
20
|
+
showProgress: a.size > U
|
|
21
|
+
});
|
|
22
|
+
try {
|
|
23
|
+
await f(
|
|
24
|
+
E.url,
|
|
25
|
+
a,
|
|
26
|
+
Q,
|
|
27
|
+
({ loaded: i, total: u }) => {
|
|
28
|
+
if (!u) return;
|
|
29
|
+
const I = Math.min(100, Math.round(i / u * 100));
|
|
30
|
+
n((s) => s && { ...s, percent: I });
|
|
31
|
+
}
|
|
32
|
+
), l({
|
|
33
|
+
title: e("ADMIN_CSV_UPLOAD_NOTIFICATION_TITLE"),
|
|
34
|
+
message: e("ADMIN_CSV_UPLOAD_NOTIFICATION_MESSAGE", {
|
|
35
|
+
fileName: a.name
|
|
36
|
+
}),
|
|
37
|
+
type: "success",
|
|
38
|
+
timeout: 5e3
|
|
39
|
+
});
|
|
40
|
+
} catch (i) {
|
|
41
|
+
console.error("CSV upload failed", a.name, i), l({
|
|
42
|
+
title: e("ADMIN_CSV_UPLOAD_ERROR_TITLE"),
|
|
43
|
+
message: e("ADMIN_CSV_UPLOAD_ERROR_MESSAGE", {
|
|
44
|
+
fileName: a.name
|
|
45
|
+
}),
|
|
46
|
+
type: "error",
|
|
47
|
+
timeout: 5e3
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
n(null), await _.invalidateQueries({
|
|
52
|
+
queryKey: L
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
[l, _, e]
|
|
56
|
+
), uploadState: d, isUploading: d !== null };
|
|
57
|
+
}, j = "CsvUpload-module_page__AxMNv", z = "CsvUpload-module_selectFiles__bgLlj", W = "CsvUpload-module_selectRow__GxpHF", $ = "CsvUpload-module_typeDropdown__FOJmt", J = "CsvUpload-module_progress__5dGQw", Z = "CsvUpload-module_history__9CbWS", o = {
|
|
58
|
+
page: j,
|
|
59
|
+
selectFiles: z,
|
|
60
|
+
selectRow: W,
|
|
61
|
+
typeDropdown: $,
|
|
62
|
+
progress: J,
|
|
63
|
+
history: Z
|
|
64
|
+
}, X = "dd MMM yyyy h:mm aaa", ee = [...b], T = {
|
|
65
|
+
COMPLETED: "ADMIN_CSV_STATUS_COMPLETED",
|
|
66
|
+
[m]: "ADMIN_CSV_STATUS_COMPLETED_WITH_ERRORS",
|
|
67
|
+
ERROR: "ADMIN_CSV_STATUS_ERROR",
|
|
68
|
+
IN_PROGRESS: "ADMIN_CSV_STATUS_IN_PROGRESS"
|
|
69
|
+
}, re = () => {
|
|
70
|
+
const { t: e } = C(), _ = Y(null), [l, d] = D(null), { data: n = [], isLoading: p, isError: c } = K(), { upload: E, uploadState: r, isUploading: a } = q(), i = H(
|
|
71
|
+
() => [
|
|
72
|
+
{ key: "originalFileName", header: e("ADMIN_CSV_COLUMN_NAME") },
|
|
73
|
+
{ key: "startTime", header: e("ADMIN_CSV_COLUMN_DATE") },
|
|
74
|
+
{ key: "status", header: e("ADMIN_CSV_COLUMN_STATUS") },
|
|
75
|
+
{ key: "errorMessage", header: e("ADMIN_CSV_COLUMN_ERROR_MESSAGE") },
|
|
76
|
+
{ key: "download", header: e("ADMIN_CSV_COLUMN_DOWNLOAD") }
|
|
77
|
+
],
|
|
78
|
+
[e]
|
|
79
|
+
), u = R(
|
|
80
|
+
(s, S) => {
|
|
81
|
+
switch (S) {
|
|
82
|
+
case "startTime":
|
|
83
|
+
return V(s.startTime, e, !1, X).formattedResult;
|
|
84
|
+
case "errorMessage":
|
|
85
|
+
return s.errorMessage ? s.errorMessage : s.status === m ? N(s) ? e("ADMIN_CSV_ERROR_SUMMARY_MESSAGE") : e("ADMIN_CSV_ERROR_SUMMARY_NO_FILE_MESSAGE") : "";
|
|
86
|
+
case "download": {
|
|
87
|
+
const M = g(s);
|
|
88
|
+
return N(s) && M ? /* @__PURE__ */ t(h, { href: M, children: e("ADMIN_CSV_ERROR_FILE_LINK") }) : null;
|
|
89
|
+
}
|
|
90
|
+
case "originalFileName":
|
|
91
|
+
return s.originalFileName;
|
|
92
|
+
case "status":
|
|
93
|
+
return T[s.status] ? e(T[s.status]) : s.status;
|
|
94
|
+
default:
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
[e]
|
|
99
|
+
), I = (s) => {
|
|
100
|
+
const S = Array.from(s.target.files ?? []);
|
|
101
|
+
s.target.value = "", l && S.length > 0 && E(S, l);
|
|
102
|
+
};
|
|
103
|
+
return /* @__PURE__ */ t(P, { breadcrumbLabel: e("MODULE_LABEL_CSV_UPLOAD_KEY"), children: /* @__PURE__ */ A(
|
|
104
|
+
"div",
|
|
105
|
+
{
|
|
106
|
+
id: "admin-csv-upload-page",
|
|
107
|
+
"data-testid": "admin-csv-upload-page-test-id",
|
|
108
|
+
"aria-label": e("MODULE_LABEL_CSV_UPLOAD_KEY"),
|
|
109
|
+
className: o.page,
|
|
110
|
+
children: [
|
|
111
|
+
/* @__PURE__ */ A(F, { className: o.selectFiles, children: [
|
|
112
|
+
/* @__PURE__ */ t("h2", { children: e("ADMIN_CSV_SELECT_FILES_HEADER") }),
|
|
113
|
+
/* @__PURE__ */ A("div", { className: o.selectRow, children: [
|
|
114
|
+
/* @__PURE__ */ t(
|
|
115
|
+
v,
|
|
116
|
+
{
|
|
117
|
+
id: "admin-csv-file-type",
|
|
118
|
+
testId: "admin-csv-file-type-dropdown",
|
|
119
|
+
className: o.typeDropdown,
|
|
120
|
+
titleText: e("ADMIN_CSV_FILE_TYPE_LABEL"),
|
|
121
|
+
hideLabel: !0,
|
|
122
|
+
label: e("ADMIN_CSV_FILE_TYPE_LABEL"),
|
|
123
|
+
items: ee,
|
|
124
|
+
itemToString: (s) => s ? e(s.labelKey) : "",
|
|
125
|
+
selectedItem: l,
|
|
126
|
+
onChange: ({ selectedItem: s }) => d(s),
|
|
127
|
+
disabled: a
|
|
128
|
+
}
|
|
129
|
+
),
|
|
130
|
+
/* @__PURE__ */ t(
|
|
131
|
+
w,
|
|
132
|
+
{
|
|
133
|
+
kind: "primary",
|
|
134
|
+
testId: "admin-csv-upload-button",
|
|
135
|
+
disabled: !l || a,
|
|
136
|
+
onClick: () => _.current?.click(),
|
|
137
|
+
children: e("ADMIN_CSV_UPLOAD_FILES_BUTTON")
|
|
138
|
+
}
|
|
139
|
+
),
|
|
140
|
+
/* @__PURE__ */ t(
|
|
141
|
+
"input",
|
|
142
|
+
{
|
|
143
|
+
ref: _,
|
|
144
|
+
type: "file",
|
|
145
|
+
accept: ".csv,text/csv",
|
|
146
|
+
multiple: !0,
|
|
147
|
+
hidden: !0,
|
|
148
|
+
"data-testid": "admin-csv-file-input",
|
|
149
|
+
onChange: I
|
|
150
|
+
}
|
|
151
|
+
)
|
|
152
|
+
] }),
|
|
153
|
+
r?.showProgress && /* @__PURE__ */ t(
|
|
154
|
+
x,
|
|
155
|
+
{
|
|
156
|
+
testId: "admin-csv-upload-progress",
|
|
157
|
+
className: o.progress,
|
|
158
|
+
label: e("ADMIN_CSV_UPLOAD_PROGRESS_LABEL", {
|
|
159
|
+
fileName: r.fileName,
|
|
160
|
+
current: r.fileIndex,
|
|
161
|
+
total: r.fileCount
|
|
162
|
+
}),
|
|
163
|
+
value: r.percent,
|
|
164
|
+
max: 100,
|
|
165
|
+
helperText: `${r.percent}%`
|
|
166
|
+
}
|
|
167
|
+
)
|
|
168
|
+
] }),
|
|
169
|
+
/* @__PURE__ */ t("div", { className: o.history, children: /* @__PURE__ */ t(
|
|
170
|
+
G,
|
|
171
|
+
{
|
|
172
|
+
columns: i,
|
|
173
|
+
rows: n,
|
|
174
|
+
ariaLabel: e("ADMIN_CSV_UPLOADED_FILES_HEADER"),
|
|
175
|
+
title: e("ADMIN_CSV_UPLOADED_FILES_HEADER"),
|
|
176
|
+
dataTestId: "admin-csv-uploaded-files-table",
|
|
177
|
+
loading: p,
|
|
178
|
+
renderCell: u,
|
|
179
|
+
emptyStateMessage: e("ADMIN_CSV_NO_FILES_UPLOADED"),
|
|
180
|
+
errorStateMessage: c ? e("ADMIN_CSV_ERROR_FETCH_HISTORY") : null
|
|
181
|
+
}
|
|
182
|
+
) })
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
) });
|
|
186
|
+
};
|
|
187
|
+
export {
|
|
188
|
+
re as CsvUpload
|
|
189
|
+
};
|