datastake-daf 0.6.786 → 0.6.787
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/components/index.js +685 -407
- package/dist/services/index.js +10 -1
- package/dist/utils/index.js +28 -12
- package/package.json +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/hook.js +0 -1
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/index.jsx +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/hook.js +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/index.jsx +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminModals/AddUser/index.jsx +0 -1
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/index.jsx +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminModals/NewAccount/index.jsx +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Dashboard.jsx +2 -2
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Location.jsx +5 -5
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Subjects.jsx +2 -2
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/column.js +224 -0
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/helper.js +65 -0
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/index.jsx +23 -5
- package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/columns.js +36 -36
- package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/index.jsx +12 -21
- package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/helper.js +13 -8
- package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/index.jsx +2 -2
- package/src/@daf/core/components/Screens/Admin/adminRoutes.js +2 -2
- package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/columns.js +180 -0
- package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/config.js +0 -0
- package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/index.jsx +27 -0
- package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/columns.js +157 -0
- package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/config.js +31 -0
- package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/index.js +77 -0
- package/src/@daf/pages/SelfAssesment/components/ProductionSiteTable/columns.js +117 -0
- package/src/@daf/pages/SelfAssesment/components/ProductionSiteTable/index.jsx +54 -0
- package/src/@daf/pages/SelfAssesment/index.jsx +0 -0
- package/src/@daf/services/AdminService.js +12 -3
- package/src/@daf/services/DashboardService.js +2 -1
- package/src/@daf/utils/filters.js +89 -89
- package/src/constants/locales/en/translation.js +3 -0
- package/src/constants/locales/fr/translation.js +1 -1
- package/src/constants/locales/sp/translation.js +1 -1
- package/build/favicon.ico +0 -0
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/manifest.json +0 -25
- package/build/robots.txt +0 -3
package/dist/services/index.js
CHANGED
|
@@ -765,7 +765,7 @@ class AdminService extends BaseService {
|
|
|
765
765
|
params
|
|
766
766
|
}) {
|
|
767
767
|
return this.apiGet({
|
|
768
|
-
url:
|
|
768
|
+
url: `/management/subjects/${subject}`,
|
|
769
769
|
params
|
|
770
770
|
});
|
|
771
771
|
}
|
|
@@ -778,6 +778,15 @@ class AdminService extends BaseService {
|
|
|
778
778
|
data
|
|
779
779
|
});
|
|
780
780
|
}
|
|
781
|
+
getUserGrowth(activeFilter) {
|
|
782
|
+
return this.apiGet({
|
|
783
|
+
url: `/accounts/dashboard/user-growth`,
|
|
784
|
+
isUserManager: true,
|
|
785
|
+
params: {
|
|
786
|
+
activeFilter
|
|
787
|
+
}
|
|
788
|
+
});
|
|
789
|
+
}
|
|
781
790
|
}
|
|
782
791
|
var AdminService$1 = createLazyService(AdminService);
|
|
783
792
|
|
package/dist/utils/index.js
CHANGED
|
@@ -7506,7 +7506,6 @@ const getDefaultActiveFilters = (params, selectFiltersConfig, defaultPageSize, d
|
|
|
7506
7506
|
});
|
|
7507
7507
|
return o;
|
|
7508
7508
|
};
|
|
7509
|
-
const NEW_PAGINATION_APPS = ["nashiriki"];
|
|
7510
7509
|
const filterParams = (value, module) => {
|
|
7511
7510
|
const {
|
|
7512
7511
|
activeFilters,
|
|
@@ -7522,10 +7521,12 @@ const filterParams = (value, module) => {
|
|
|
7522
7521
|
...filters
|
|
7523
7522
|
} = activeFilters || {};
|
|
7524
7523
|
const params = {};
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
|
|
7528
|
-
|
|
7524
|
+
// Use skip and take inside pagination object
|
|
7525
|
+
// Calculate skip from page number (page 1 = skip 1, page 2 = skip 21, etc.)
|
|
7526
|
+
params.pagination = {
|
|
7527
|
+
skip: page ? (page - 1) * (pageSize || 20) + 1 : 1,
|
|
7528
|
+
take: pageSize || 20
|
|
7529
|
+
};
|
|
7529
7530
|
if (search && searchParams) {
|
|
7530
7531
|
params.search = JSON.stringify({
|
|
7531
7532
|
qs: search,
|
|
@@ -7540,12 +7541,24 @@ const filterParams = (value, module) => {
|
|
|
7540
7541
|
}
|
|
7541
7542
|
if (Object.keys(filters).length) {
|
|
7542
7543
|
if (value.sourceId && value.sourceId === "overview") {
|
|
7543
|
-
|
|
7544
|
+
const {
|
|
7545
|
+
activeTab,
|
|
7546
|
+
...restFilters
|
|
7547
|
+
} = filters;
|
|
7548
|
+
Object.assign(params, restFilters);
|
|
7549
|
+
if (activeTab !== undefined) {
|
|
7550
|
+
params.tab = activeTab;
|
|
7551
|
+
}
|
|
7544
7552
|
} else {
|
|
7545
|
-
|
|
7546
|
-
|
|
7547
|
-
|
|
7548
|
-
|
|
7553
|
+
const {
|
|
7554
|
+
authorId,
|
|
7555
|
+
activeTab,
|
|
7556
|
+
...restFilters
|
|
7557
|
+
} = filters;
|
|
7558
|
+
Object.assign(params, restFilters);
|
|
7559
|
+
if (activeTab !== undefined) {
|
|
7560
|
+
params.tab = activeTab;
|
|
7561
|
+
}
|
|
7549
7562
|
}
|
|
7550
7563
|
}
|
|
7551
7564
|
return {
|
|
@@ -7752,6 +7765,9 @@ function getRedirectPath(user, fallback = '', app, isDatastake) {
|
|
|
7752
7765
|
}
|
|
7753
7766
|
|
|
7754
7767
|
const en = {
|
|
7768
|
+
"sbg-admin::remove-user-title": "Remove User Title",
|
|
7769
|
+
"sbg-admin::remove-user-body": "Remove User Body",
|
|
7770
|
+
"add-account": "Add Account",
|
|
7755
7771
|
"Site": "Site",
|
|
7756
7772
|
"Production Sites": "Production Sites",
|
|
7757
7773
|
"Type of account": "Type of account",
|
|
@@ -9451,7 +9467,7 @@ const fr = {
|
|
|
9451
9467
|
Documentation: "Documents",
|
|
9452
9468
|
"Edit project": "Modifier le projet",
|
|
9453
9469
|
Name: "Nom",
|
|
9454
|
-
Type: "
|
|
9470
|
+
Type: "Type",
|
|
9455
9471
|
type: "Type",
|
|
9456
9472
|
Province: "Province",
|
|
9457
9473
|
Territory: "Territoire",
|
|
@@ -11262,7 +11278,7 @@ const sp = {
|
|
|
11262
11278
|
"Documentation": "Documentos",
|
|
11263
11279
|
"Edit project": "Modificar proyecto",
|
|
11264
11280
|
"Name": "Nombre",
|
|
11265
|
-
"Type": "
|
|
11281
|
+
"Type": "Tipo",
|
|
11266
11282
|
"type": "Tipo",
|
|
11267
11283
|
"Province": "Provincia",
|
|
11268
11284
|
"Territory": "Territorio",
|
package/package.json
CHANGED
|
@@ -10,7 +10,6 @@ const { useToken } = theme;
|
|
|
10
10
|
export default function useTopContributors({ container, data = [], t }) {
|
|
11
11
|
const [mainGraph, setMainGraph] = useState(null);
|
|
12
12
|
const { token } = useToken();
|
|
13
|
-
|
|
14
13
|
useEffect(() => {
|
|
15
14
|
if (container.current) {
|
|
16
15
|
if (mainGraph) {
|
|
@@ -12,7 +12,7 @@ export default function useUserGrowth({ container, data: mainData = {}, t, trans
|
|
|
12
12
|
const [mainGraph, setMainGraph] = useState(null);
|
|
13
13
|
const [data, setData] = useState([]);
|
|
14
14
|
const { token } = useToken();
|
|
15
|
-
|
|
15
|
+
console.log("mainData", mainData);
|
|
16
16
|
const fetchData = () => {
|
|
17
17
|
const { dates = [] } = mainData;
|
|
18
18
|
const _data = [];
|
|
@@ -9,7 +9,7 @@ export default function UserGrowth({ loading, data = [], t, translationKeys, fet
|
|
|
9
9
|
const [selectValue, setSelectValue] = useState(selectOptions[0]?.value);
|
|
10
10
|
|
|
11
11
|
useUserGrowth({ container, data, t, translationKeys });
|
|
12
|
-
|
|
12
|
+
console.log("usergrowthhhhh", data);
|
|
13
13
|
|
|
14
14
|
useEffect(() => {
|
|
15
15
|
if (typeof fetchUserGrowth === "function") {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Modal from "../../../../Modal/index.jsx";
|
|
2
2
|
import { Form, Input, Select, theme } from "antd";
|
|
3
3
|
import { Container } from "../CombineModalStyle.js";
|
|
4
|
-
import { findOptions } from "../../../../../../../helpers/StringHelper.js";
|
|
4
|
+
// import { findOptions } from "../../../../../../../helpers/StringHelper.js";
|
|
5
5
|
import DAFTable from "../../../../Table/index.jsx";
|
|
6
6
|
import { useMemo, useState } from "react";
|
|
7
7
|
import { getColumns } from "./helper.js";
|
|
@@ -20,7 +20,7 @@ export default function AdminDashboardScreen({ config }) {
|
|
|
20
20
|
userGrowthDataLoading,
|
|
21
21
|
} = useWidgetFetch();
|
|
22
22
|
|
|
23
|
-
console.log({userGrowthData});
|
|
23
|
+
// console.log({userGrowthData});
|
|
24
24
|
|
|
25
25
|
const actionsWidgetsConfig = useMemo(
|
|
26
26
|
() => getActionWidgetsConfig({ getRedirectLink }),
|
|
@@ -39,7 +39,7 @@ export default function AdminDashboardScreen({ config }) {
|
|
|
39
39
|
const safeUserActivity = Array.isArray(data?.data?.userActivity) ? data.data.userActivity : [];
|
|
40
40
|
const safeTopContributors = Array.isArray(data?.topContributors) ? data.topContributors : [];
|
|
41
41
|
const safeUserGrowth = Array.isArray(data?.userGrowthData) ? data.userGrowthData : [];
|
|
42
|
-
|
|
42
|
+
console.log("safeUserGrowth", safeUserGrowth);
|
|
43
43
|
|
|
44
44
|
return (
|
|
45
45
|
<AdminDashboard
|
|
@@ -47,11 +47,11 @@ export default function AdminLocationScreen({ config }) {
|
|
|
47
47
|
const handleMergeLocations = useCallback(
|
|
48
48
|
async (mergeData) => {
|
|
49
49
|
try {
|
|
50
|
-
if (AdminService.
|
|
51
|
-
await AdminService.
|
|
50
|
+
if (AdminService.mergeSubjects) {
|
|
51
|
+
await AdminService.mergeSubjects({ subject: 'location', ...mergeData });
|
|
52
52
|
message.success(t("Locations merged successfully"));
|
|
53
53
|
} else {
|
|
54
|
-
console.warn("AdminService.
|
|
54
|
+
console.warn("AdminService.mergeSubjects is not implemented");
|
|
55
55
|
message.success(t("Locations merged successfully"));
|
|
56
56
|
}
|
|
57
57
|
} catch (err) {
|
|
@@ -61,12 +61,12 @@ export default function AdminLocationScreen({ config }) {
|
|
|
61
61
|
[AdminService, t, handleError]
|
|
62
62
|
);
|
|
63
63
|
|
|
64
|
-
// Use custom getData if provided, otherwise use default AdminService.
|
|
64
|
+
// Use custom getData if provided, otherwise use default AdminService.getSubjects
|
|
65
65
|
const getLocations = useCallback((params) => {
|
|
66
66
|
if (getData) {
|
|
67
67
|
return getData(params);
|
|
68
68
|
}
|
|
69
|
-
return AdminService.
|
|
69
|
+
return AdminService.getSubjects({ subject: 'location', params });
|
|
70
70
|
}, [getData, AdminService]);
|
|
71
71
|
|
|
72
72
|
return (
|
|
@@ -48,7 +48,7 @@ export default function AdminSubjectsScreen({ config }) {
|
|
|
48
48
|
async (mergeData) => {
|
|
49
49
|
try {
|
|
50
50
|
if (AdminService.mergeSubjects) {
|
|
51
|
-
await AdminService.mergeSubjects(mergeData);
|
|
51
|
+
await AdminService.mergeSubjects({ subject: 'stakeholder', ...mergeData });
|
|
52
52
|
message.success(t("Subjects merged successfully"));
|
|
53
53
|
} else {
|
|
54
54
|
console.warn("AdminService.mergeSubjects is not implemented");
|
|
@@ -66,7 +66,7 @@ export default function AdminSubjectsScreen({ config }) {
|
|
|
66
66
|
if (getData) {
|
|
67
67
|
return getData(params);
|
|
68
68
|
}
|
|
69
|
-
return AdminService.getSubjects(params);
|
|
69
|
+
return AdminService.getSubjects({ subject: 'stakeholder', params });
|
|
70
70
|
}, [getData, AdminService]);
|
|
71
71
|
|
|
72
72
|
return (
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { Checkbox, Tooltip, Avatar } from "antd";
|
|
2
|
+
import CustomIcon from "../../../../Icon/CustomIcon.jsx";
|
|
3
|
+
import { findOptions } from "../../../../../../../helpers/StringHelper.js";
|
|
4
|
+
import { getNameByLevel } from "./helper.js";
|
|
5
|
+
|
|
6
|
+
export const getColumns = ({
|
|
7
|
+
t,
|
|
8
|
+
goTo = () => {},
|
|
9
|
+
show = "show",
|
|
10
|
+
getRedirectLink = () => {},
|
|
11
|
+
token,
|
|
12
|
+
selectedLocations,
|
|
13
|
+
setSelectedLocations,
|
|
14
|
+
selectOptions,
|
|
15
|
+
entity,
|
|
16
|
+
}) => {
|
|
17
|
+
const cols = [
|
|
18
|
+
{
|
|
19
|
+
title: "",
|
|
20
|
+
dataIndex: "select",
|
|
21
|
+
key: "select",
|
|
22
|
+
width: 50,
|
|
23
|
+
show: true,
|
|
24
|
+
render: (v, all) => {
|
|
25
|
+
if (all.empty) {
|
|
26
|
+
return <div className="daf-default-cell" />;
|
|
27
|
+
}
|
|
28
|
+
return (
|
|
29
|
+
<Checkbox
|
|
30
|
+
onChange={() =>
|
|
31
|
+
setSelectedLocations((prev) => {
|
|
32
|
+
const isSelected = prev.some((p) => p.id === all.id);
|
|
33
|
+
if (isSelected) {
|
|
34
|
+
return prev.filter((p) => p.id !== all.id);
|
|
35
|
+
}
|
|
36
|
+
return [...prev, all];
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
checked={selectedLocations.some((p) => p.id === all.id)}
|
|
40
|
+
disabled={
|
|
41
|
+
selectedLocations?.length >= 3 &&
|
|
42
|
+
!selectedLocations.some((p) => p.id === all.id)
|
|
43
|
+
}
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
title: t("ID"),
|
|
50
|
+
dataIndex: "datastakeId",
|
|
51
|
+
key: "datastakeId",
|
|
52
|
+
ellipsis: true,
|
|
53
|
+
show: true,
|
|
54
|
+
render: (value, all) => {
|
|
55
|
+
if (all.empty) {
|
|
56
|
+
return <div className="daf-default-cell" />;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return <Tooltip title={value}>{value}</Tooltip>;
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
title: t("Name"),
|
|
64
|
+
dataIndex: "name",
|
|
65
|
+
key: "name",
|
|
66
|
+
ellipsis: true,
|
|
67
|
+
show: true,
|
|
68
|
+
render: (value, all) => {
|
|
69
|
+
if (all.empty) {
|
|
70
|
+
return <div className="daf-default-cell" />;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return <Tooltip title={value}>{value}</Tooltip>;
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
title: t("Category"),
|
|
78
|
+
dataIndex: "category",
|
|
79
|
+
key: "category",
|
|
80
|
+
ellipsis: true,
|
|
81
|
+
show: true,
|
|
82
|
+
render: (value, all) => {
|
|
83
|
+
if (all.empty) {
|
|
84
|
+
return <div className="daf-default-cell" />;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const category = findOptions(value, selectOptions?.category || []) || "--";
|
|
88
|
+
|
|
89
|
+
return <Tooltip title={category}>{category}</Tooltip>;
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
title: t("Country"),
|
|
94
|
+
dataIndex: "country",
|
|
95
|
+
key: "country",
|
|
96
|
+
ellipsis: true,
|
|
97
|
+
show: true,
|
|
98
|
+
render: (value, all) => {
|
|
99
|
+
if (all.empty) {
|
|
100
|
+
return <div className="daf-default-cell" />;
|
|
101
|
+
}
|
|
102
|
+
const country = findOptions(value, selectOptions?.country || []) || "--";
|
|
103
|
+
|
|
104
|
+
return <Tooltip title={country}>{country}</Tooltip>;
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
title: t("Admin Level 1"),
|
|
109
|
+
dataIndex: "administrativeLevel1",
|
|
110
|
+
key: "administrativeLevel1",
|
|
111
|
+
ellipsis: true,
|
|
112
|
+
show: entity.includes("location"),
|
|
113
|
+
render: (value, all) => {
|
|
114
|
+
if (all.empty) {
|
|
115
|
+
return <div className="daf-default-cell" />;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
let label;
|
|
119
|
+
if(all?.administrativeLevel1 && value === all?.administrativeLevel1) {
|
|
120
|
+
label = all?.linking?.SCL?.[value]?.name
|
|
121
|
+
} else {
|
|
122
|
+
label = getNameByLevel(all?.linking?.SCL, "level_1")?.name
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return <Tooltip title={label || '-'}>{label || '-'}</Tooltip>;
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
title: t("Admin Level 2"),
|
|
130
|
+
dataIndex: "administrativeLevel2",
|
|
131
|
+
key: "administrativeLevel2",
|
|
132
|
+
show: entity.includes("location"),
|
|
133
|
+
ellipsis: true,
|
|
134
|
+
render: (value, all) => {
|
|
135
|
+
if (all.empty) {
|
|
136
|
+
return <div className="daf-default-cell" />;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
let label;
|
|
140
|
+
if(all?.administrativeLevel2 && value === all?.administrativeLevel2) {
|
|
141
|
+
label = all?.linking?.SCL?.[value]?.name
|
|
142
|
+
} else {
|
|
143
|
+
label = getNameByLevel(all?.linking?.SCL, "level_2")?.name
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return <Tooltip title={label || '-'}>{label || '-'}</Tooltip>;
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
title: t("Sources"),
|
|
151
|
+
dataIndex: "sources",
|
|
152
|
+
key: "sources",
|
|
153
|
+
show: true,
|
|
154
|
+
render: (value, all) => {
|
|
155
|
+
if (all.empty) {
|
|
156
|
+
return <div className="daf-default-cell" />;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const MAX_SOURCES = 3;
|
|
160
|
+
const count = value?.length === MAX_SOURCES + 1 ? value?.length : MAX_SOURCES;
|
|
161
|
+
return (
|
|
162
|
+
Array.isArray(value) && value?.length > 0 ? <Avatar.Group
|
|
163
|
+
max={{
|
|
164
|
+
count: count,
|
|
165
|
+
style: {
|
|
166
|
+
color: token.baseGray90,
|
|
167
|
+
backgroundColor: token.baseGray20,
|
|
168
|
+
border: `1px solid ${token.baseGray40}`,
|
|
169
|
+
},
|
|
170
|
+
}}
|
|
171
|
+
size={"small"}
|
|
172
|
+
>
|
|
173
|
+
{value.map((v, i) => (
|
|
174
|
+
<Avatar
|
|
175
|
+
key={i}
|
|
176
|
+
size={"small"}
|
|
177
|
+
style={{
|
|
178
|
+
backgroundColor: token.baseGray20,
|
|
179
|
+
color: token.baseGray90,
|
|
180
|
+
border: `1px solid ${token.baseGray40}`,
|
|
181
|
+
display: "flex",
|
|
182
|
+
alignItems: "center",
|
|
183
|
+
justifyContent: "center",
|
|
184
|
+
}}
|
|
185
|
+
>
|
|
186
|
+
<CustomIcon
|
|
187
|
+
name="Organisation02"
|
|
188
|
+
width={18}
|
|
189
|
+
height={18}
|
|
190
|
+
color={token.baseGray90}
|
|
191
|
+
/>
|
|
192
|
+
</Avatar>
|
|
193
|
+
))}
|
|
194
|
+
</Avatar.Group> : '-'
|
|
195
|
+
);
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
title: "",
|
|
200
|
+
dataIndex: "actions",
|
|
201
|
+
key: "actions",
|
|
202
|
+
width: 60,
|
|
203
|
+
show: true,
|
|
204
|
+
render: (value, all) => {
|
|
205
|
+
if (all.empty) {
|
|
206
|
+
return <div className="daf-default-cell" />;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
return (
|
|
210
|
+
<div
|
|
211
|
+
className="cursor-pointer"
|
|
212
|
+
onClick={() => {
|
|
213
|
+
goTo(getRedirectLink(`/app/accounts/view/${all.id}/details`));
|
|
214
|
+
}}
|
|
215
|
+
>
|
|
216
|
+
<CustomIcon name="Link" width={18} height={18} />
|
|
217
|
+
</div>
|
|
218
|
+
);
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
];
|
|
222
|
+
|
|
223
|
+
return cols.filter((c) => c[show]);
|
|
224
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export const getTabs = ({ t }) => {
|
|
2
|
+
return [
|
|
3
|
+
{
|
|
4
|
+
key: "active",
|
|
5
|
+
label: t("Active"),
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
key: "pending",
|
|
9
|
+
label: t("Pending"),
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
key: 'suspended',
|
|
13
|
+
label: t("Suspended"),
|
|
14
|
+
}
|
|
15
|
+
];
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const selectFiltersConfig = {
|
|
19
|
+
category: {
|
|
20
|
+
type: "select",
|
|
21
|
+
label: "Category",
|
|
22
|
+
placeholder: (t) => t("Category"),
|
|
23
|
+
style: { flex: 1 },
|
|
24
|
+
labelStyle: { flex: 1 },
|
|
25
|
+
getLabel: (option) => option.label,
|
|
26
|
+
getValue: (option) => option.value,
|
|
27
|
+
},
|
|
28
|
+
country: {
|
|
29
|
+
type: "select",
|
|
30
|
+
label: "Country",
|
|
31
|
+
placeholder: (t) => t("Country"),
|
|
32
|
+
style: { flex: 1 },
|
|
33
|
+
labelStyle: { flex: 1 },
|
|
34
|
+
getLabel: (option) => option.label,
|
|
35
|
+
getValue: (option) => option.value,
|
|
36
|
+
},
|
|
37
|
+
sources: {
|
|
38
|
+
type: "select",
|
|
39
|
+
label: "Sources",
|
|
40
|
+
placeholder: (t) => t("Sources"),
|
|
41
|
+
style: { flex: 1 },
|
|
42
|
+
labelStyle: { flex: 1 },
|
|
43
|
+
getLabel: (option) => option.label,
|
|
44
|
+
getValue: (option) => option.value,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const filtersConfig = {
|
|
49
|
+
name: "",
|
|
50
|
+
datastakeId: "",
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const defaultUrlParams = { activeTab: "active" };
|
|
54
|
+
|
|
55
|
+
export const checkboxConfig = {
|
|
56
|
+
name: "Name",
|
|
57
|
+
datastakeId: "ID",
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const getNameByLevel = (data, level) => {
|
|
61
|
+
const entry = Object.values(data || {}).find(item => item.level === level);
|
|
62
|
+
return entry;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
@@ -2,7 +2,7 @@ import { useState, useMemo } from "react";
|
|
|
2
2
|
import { useAdminTable } from "../hook";
|
|
3
3
|
import AdminTable from "../components/index.jsx";
|
|
4
4
|
import DAFTable from "../../../../Table/index.jsx";
|
|
5
|
-
import { theme, Tag } from "antd";
|
|
5
|
+
import { theme, Tag, message } from "antd";
|
|
6
6
|
import CustomIcon from "../../../../Icon/CustomIcon.jsx";
|
|
7
7
|
import {
|
|
8
8
|
getTabs,
|
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
defaultUrlParams,
|
|
12
12
|
checkboxConfig,
|
|
13
13
|
} from "../SubjectsTable/helper.js";
|
|
14
|
-
import { getColumns } from "../SubjectsTable/columns.js";
|
|
15
14
|
import CombineLocationModal from "../../AdminModals/CombineLocation/index.jsx";
|
|
15
|
+
import { getColumns } from "./column.js";
|
|
16
16
|
const { useToken } = theme;
|
|
17
17
|
|
|
18
18
|
export default function LocationTable({
|
|
@@ -37,6 +37,22 @@ export default function LocationTable({
|
|
|
37
37
|
const { token } = useToken();
|
|
38
38
|
const [combineLocationVisible, setCombineLocationVisible] = useState(false);
|
|
39
39
|
|
|
40
|
+
// Wrapper to transform pagination params to strings and ensure tab is at root level
|
|
41
|
+
const getDataWithStringPagination = async ({ params }) => {
|
|
42
|
+
// Extract tab from the params (it should already be there from filterParams)
|
|
43
|
+
const { pagination, tab, ...otherParams } = params;
|
|
44
|
+
|
|
45
|
+
const transformedParams = {
|
|
46
|
+
...otherParams,
|
|
47
|
+
pagination: {
|
|
48
|
+
skip: String(pagination?.skip || 1),
|
|
49
|
+
take: String(pagination?.take || 20),
|
|
50
|
+
},
|
|
51
|
+
tab: tab || "active", // Ensure tab is at root level with default value
|
|
52
|
+
};
|
|
53
|
+
return getData({ params: transformedParams });
|
|
54
|
+
};
|
|
55
|
+
|
|
40
56
|
const {
|
|
41
57
|
filter,
|
|
42
58
|
activeTab,
|
|
@@ -58,7 +74,7 @@ export default function LocationTable({
|
|
|
58
74
|
defaultPageSize,
|
|
59
75
|
filtersConfig,
|
|
60
76
|
getRedirectLink,
|
|
61
|
-
getData,
|
|
77
|
+
getData: getDataWithStringPagination,
|
|
62
78
|
refetchTrigger,
|
|
63
79
|
});
|
|
64
80
|
|
|
@@ -80,7 +96,7 @@ export default function LocationTable({
|
|
|
80
96
|
setSelectedLocations,
|
|
81
97
|
getRedirectLink,
|
|
82
98
|
selectOptions,
|
|
83
|
-
entity: headerTitle
|
|
99
|
+
entity: headerTitle,
|
|
84
100
|
});
|
|
85
101
|
}, [t, goTo, module, token, selectedLocations, getRedirectLink, selectOptions, headerTitle]);
|
|
86
102
|
|
|
@@ -89,7 +105,7 @@ export default function LocationTable({
|
|
|
89
105
|
<AdminTable
|
|
90
106
|
filters={filter}
|
|
91
107
|
t={t}
|
|
92
|
-
headerTitle={
|
|
108
|
+
headerTitle={"test"}
|
|
93
109
|
actionButton={[
|
|
94
110
|
{
|
|
95
111
|
icon: "Merge",
|
|
@@ -110,6 +126,7 @@ export default function LocationTable({
|
|
|
110
126
|
checkboxConfig={checkboxConfig}
|
|
111
127
|
defaultTableFilters={{}}
|
|
112
128
|
breadcrumbs={breadcrumbs}
|
|
129
|
+
|
|
113
130
|
>
|
|
114
131
|
{selectedLocations.length > 0 && (
|
|
115
132
|
<div
|
|
@@ -168,6 +185,7 @@ export default function LocationTable({
|
|
|
168
185
|
if (typeof mergeSubjectsFunction === 'function') {
|
|
169
186
|
mergeSubjectsFunction(data);
|
|
170
187
|
setSelectedLocations([])
|
|
188
|
+
message.success(t("Locations successfully merged."))
|
|
171
189
|
}
|
|
172
190
|
}}
|
|
173
191
|
selectedLocations={selectedLocations}
|