datastake-daf 0.6.794 → 0.6.795
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/build/favicon.ico +0 -0
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/manifest.json +25 -0
- package/build/robots.txt +3 -0
- package/dist/components/index.js +3159 -4303
- package/dist/pages/index.js +2045 -3246
- package/dist/services/index.js +3 -69
- package/dist/utils/index.js +20 -14
- package/package.json +1 -1
- package/src/@daf/core/components/Dashboard/Map/hook.js +25 -1
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/hook.js +1 -0
- 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 +1 -0
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/helper.js +2 -2
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/index.jsx +8 -18
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineSubjects/index.jsx +6 -6
- 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 +7 -6
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Subjects.jsx +2 -2
- package/src/@daf/core/components/Screens/Admin/AdminScreens/index.js +0 -1
- package/src/@daf/core/components/Screens/Admin/AdminTables/AccountTable/index.jsx +0 -1
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/index.jsx +45 -73
- package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/columns.js +37 -37
- package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/index.jsx +22 -48
- package/src/@daf/core/components/Screens/Admin/AdminTables/UserTable/index.jsx +0 -1
- package/src/@daf/core/components/Screens/Admin/AdminViews/components/Edit/index.jsx +1 -3
- package/src/@daf/core/components/Screens/Admin/AdminViews/components/SidebarMenu/index.jsx +3 -5
- package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/helper.js +8 -13
- package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/index.jsx +2 -2
- package/src/@daf/core/components/Screens/Admin/AdminViews/index.jsx +4 -3
- package/src/@daf/core/components/Screens/Admin/adminRoutes.js +2 -81
- package/src/@daf/pages/Dashboards/SelfAssesment/components/AssociatedInformation/index.jsx +1 -1
- package/src/@daf/pages/Dashboards/SelfAssesment/components/OrganisationInformation/columns.js +0 -1
- package/src/@daf/pages/Dashboards/SelfAssesment/components/ProductionSites/columns.js +3 -2
- package/src/@daf/pages/Dashboards/SelfAssesment/components/ProductionSites/index.jsx +13 -4
- package/src/@daf/pages/Dashboards/SelfAssesment/index.jsx +22 -20
- package/src/@daf/pages/Events/Activities/columns.js +1 -1
- package/src/@daf/pages/Events/Activities/config.js +23 -30
- package/src/@daf/pages/Events/Incidents/columns.js +1 -1
- package/src/@daf/pages/Events/Incidents/config.js +23 -30
- package/src/@daf/pages/Events/config.js +7 -7
- package/src/@daf/pages/Locations/MineSite/columns.js +3 -3
- package/src/@daf/pages/Locations/MineSite/config.js +20 -14
- package/src/@daf/pages/Locations/config.js +3 -3
- package/src/@daf/pages/Stakeholders/Operators/columns.js +2 -2
- package/src/@daf/pages/Stakeholders/Operators/config.js +9 -16
- package/src/@daf/pages/Stakeholders/Workers/columns.js +1 -1
- package/src/@daf/pages/Stakeholders/Workers/config.js +23 -29
- package/src/@daf/pages/Stakeholders/config.js +3 -3
- package/src/@daf/pages/Summary/Operator/components/TradeRelationships/helper.js +1 -1
- package/src/@daf/pages/TablePage/helper.js +17 -1
- package/src/@daf/pages/TablePage/hook.js +3 -1
- package/src/@daf/pages/TablePage/index.jsx +8 -6
- package/src/@daf/pages/View/index.jsx +4 -2
- package/src/@daf/services/AdminService.js +7 -79
- package/src/@daf/services/DashboardService.js +1 -2
- package/src/@daf/utils/filters.js +26 -15
- package/src/constants/locales/en/translation.js +1 -7
- package/src/constants/locales/fr/translation.js +2 -1
- package/src/constants/locales/sp/translation.js +2 -1
- package/src/pages.js +1 -10
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/columns.js +0 -79
- package/src/@daf/core/components/Screens/Admin/AdminScreens/SubjectsView.jsx +0 -272
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/column.js +0 -223
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/helper.js +0 -65
- package/src/@daf/core/components/Screens/Admin/AdminViews/EditLocation/index.jsx +0 -81
- package/src/@daf/core/components/Screens/Admin/AdminViews/EditStakeholder/index.jsx +0 -76
- package/src/@daf/core/components/Screens/Admin/AdminViews/ViewLocation/config.js +0 -38
- package/src/@daf/core/components/Screens/Admin/AdminViews/ViewLocation/helpers.js +0 -13
- package/src/@daf/core/components/Screens/Admin/AdminViews/ViewLocation/index.jsx +0 -77
- package/src/@daf/core/components/Screens/Admin/AdminViews/ViewStakeholder/config.js +0 -38
- package/src/@daf/core/components/Screens/Admin/AdminViews/ViewStakeholder/helpers.js +0 -0
- package/src/@daf/core/components/Screens/Admin/AdminViews/ViewStakeholder/index.jsx +0 -75
- package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/columns.js +0 -180
- package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/config.js +0 -0
- package/src/@daf/pages/SelfAssesment/components/AssociatedInformationTable/index.jsx +0 -27
- package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/columns.js +0 -157
- package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/config.js +0 -31
- package/src/@daf/pages/SelfAssesment/components/OrgInformationTable/index.js +0 -77
- package/src/@daf/pages/SelfAssesment/components/ProductionSiteTable/columns.js +0 -117
- package/src/@daf/pages/SelfAssesment/components/ProductionSiteTable/index.jsx +0 -54
- package/src/@daf/pages/SelfAssesment/index.jsx +0 -0
|
@@ -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
|
|
5
|
+
import { theme, Tag } from "antd";
|
|
6
6
|
import CustomIcon from "../../../../Icon/CustomIcon.jsx";
|
|
7
7
|
import {
|
|
8
8
|
getTabs,
|
|
@@ -10,10 +10,9 @@ import {
|
|
|
10
10
|
filtersConfig,
|
|
11
11
|
defaultUrlParams,
|
|
12
12
|
checkboxConfig,
|
|
13
|
-
} from "
|
|
14
|
-
import { getColumns } from "
|
|
13
|
+
} from "../SubjectsTable/helper.js";
|
|
14
|
+
import { getColumns } from "../SubjectsTable/columns.js";
|
|
15
15
|
import CombineLocationModal from "../../AdminModals/CombineLocation/index.jsx";
|
|
16
|
-
|
|
17
16
|
const { useToken } = theme;
|
|
18
17
|
|
|
19
18
|
export default function LocationTable({
|
|
@@ -29,49 +28,14 @@ export default function LocationTable({
|
|
|
29
28
|
view,
|
|
30
29
|
headerTitle,
|
|
31
30
|
breadcrumbs,
|
|
32
|
-
|
|
31
|
+
mergeSubjectsFunction,
|
|
33
32
|
refetchTrigger,
|
|
34
33
|
}) {
|
|
35
34
|
const [showFilters, setShowFilters] = useState(false);
|
|
36
35
|
const [hasError, setHasError] = useState(false);
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
const { token } = useToken();
|
|
41
|
-
const [isCombineModalOpen, setIsModalOpen] = useState(false);
|
|
42
|
-
|
|
43
|
-
const getDataWithStringPagination = async ({ params }) => {
|
|
44
|
-
const { pagination, tab, filters, search, sort, ...otherParams } = params;
|
|
45
|
-
|
|
46
|
-
let paginationObj = { page: 1, pageSize: 20 };
|
|
47
|
-
if (pagination) {
|
|
48
|
-
try {
|
|
49
|
-
paginationObj = typeof pagination === 'string' ? JSON.parse(pagination) : pagination;
|
|
50
|
-
} catch (e) {
|
|
51
|
-
console.error('Failed to parse pagination', e);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
let activeTab = tab || "active";
|
|
56
|
-
if (!tab && filters) {
|
|
57
|
-
try {
|
|
58
|
-
const parsedFilters = typeof filters === 'string' ? JSON.parse(filters) : filters;
|
|
59
|
-
activeTab = parsedFilters.activeTab || "active";
|
|
60
|
-
} catch (e) {
|
|
61
|
-
activeTab = "active";
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const transformedParams = {
|
|
66
|
-
pagination: {
|
|
67
|
-
skip: String(paginationObj.page || 1),
|
|
68
|
-
take: String(paginationObj.pageSize || 20),
|
|
69
|
-
},
|
|
70
|
-
tab: activeTab,
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
return getData({ params: transformedParams });
|
|
74
|
-
};
|
|
36
|
+
const [selectedLocations, setSelectedLocations] = useState([]);
|
|
37
|
+
const { token } = useToken();
|
|
38
|
+
const [combineLocationVisible, setCombineLocationVisible] = useState(false);
|
|
75
39
|
|
|
76
40
|
const {
|
|
77
41
|
filter,
|
|
@@ -94,7 +58,7 @@ export default function LocationTable({
|
|
|
94
58
|
defaultPageSize,
|
|
95
59
|
filtersConfig,
|
|
96
60
|
getRedirectLink,
|
|
97
|
-
getData
|
|
61
|
+
getData,
|
|
98
62
|
refetchTrigger,
|
|
99
63
|
});
|
|
100
64
|
|
|
@@ -102,7 +66,7 @@ export default function LocationTable({
|
|
|
102
66
|
return {
|
|
103
67
|
category: config.options?.category,
|
|
104
68
|
country: config.options?.countries,
|
|
105
|
-
sources: [],
|
|
69
|
+
sources: [], //TODO: add sources logic and make sure you only show unique sources only once
|
|
106
70
|
};
|
|
107
71
|
}, [config.options]);
|
|
108
72
|
|
|
@@ -112,7 +76,7 @@ export default function LocationTable({
|
|
|
112
76
|
goTo,
|
|
113
77
|
token,
|
|
114
78
|
module,
|
|
115
|
-
selectedLocations,
|
|
79
|
+
selectedLocations,
|
|
116
80
|
setSelectedLocations,
|
|
117
81
|
getRedirectLink,
|
|
118
82
|
selectOptions,
|
|
@@ -129,8 +93,8 @@ export default function LocationTable({
|
|
|
129
93
|
actionButton={[
|
|
130
94
|
{
|
|
131
95
|
icon: "Merge",
|
|
132
|
-
onClick: () =>
|
|
133
|
-
tooltip:
|
|
96
|
+
onClick: () => setCombineLocationVisible(true),
|
|
97
|
+
tooltip: "Combine",
|
|
134
98
|
disabled: selectedLocations.length < 2,
|
|
135
99
|
},
|
|
136
100
|
]}
|
|
@@ -148,15 +112,25 @@ export default function LocationTable({
|
|
|
148
112
|
breadcrumbs={breadcrumbs}
|
|
149
113
|
>
|
|
150
114
|
{selectedLocations.length > 0 && (
|
|
151
|
-
<div
|
|
115
|
+
<div
|
|
116
|
+
className="flex flex-row ml-6 mt-5"
|
|
117
|
+
style={{
|
|
118
|
+
flexWrap: "wrap",
|
|
119
|
+
gap: "8px",
|
|
120
|
+
}}
|
|
121
|
+
>
|
|
152
122
|
{selectedLocations.map((account) => (
|
|
153
123
|
<Tag
|
|
154
124
|
key={account.userId}
|
|
155
125
|
className="flex flex-row gap-2 items-center"
|
|
156
126
|
onClick={() =>
|
|
157
|
-
setSelectedLocations((prev) =>
|
|
127
|
+
setSelectedLocations((prev) =>
|
|
128
|
+
prev.filter((a) => a.datastakeId !== account.datastakeId),
|
|
129
|
+
)
|
|
158
130
|
}
|
|
159
|
-
style={{
|
|
131
|
+
style={{
|
|
132
|
+
cursor: "pointer",
|
|
133
|
+
}}
|
|
160
134
|
>
|
|
161
135
|
<span>{account.datastakeId}</span>
|
|
162
136
|
<CustomIcon name="Close" size={10} />
|
|
@@ -182,27 +156,25 @@ export default function LocationTable({
|
|
|
182
156
|
/>
|
|
183
157
|
</AdminTable>
|
|
184
158
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
setSelectedLocations([])
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
entity={headerTitle}
|
|
205
|
-
/>
|
|
159
|
+
<CombineLocationModal
|
|
160
|
+
isOpen={combineLocationVisible}
|
|
161
|
+
t={t}
|
|
162
|
+
onClose={() => {
|
|
163
|
+
setCombineLocationVisible(false);
|
|
164
|
+
}}
|
|
165
|
+
onSuccess={(data) => {
|
|
166
|
+
setCombineLocationVisible(false);
|
|
167
|
+
setLoading(true);
|
|
168
|
+
if (typeof mergeSubjectsFunction === 'function') {
|
|
169
|
+
mergeSubjectsFunction(data);
|
|
170
|
+
setSelectedLocations([])
|
|
171
|
+
}
|
|
172
|
+
}}
|
|
173
|
+
selectedLocations={selectedLocations}
|
|
174
|
+
selectOptions={selectOptions || {}}
|
|
175
|
+
module={module}
|
|
176
|
+
entity={headerTitle}
|
|
177
|
+
/>
|
|
206
178
|
</>
|
|
207
179
|
);
|
|
208
|
-
}
|
|
180
|
+
}
|
|
@@ -104,48 +104,48 @@ export const getColumns = ({
|
|
|
104
104
|
return <Tooltip title={country}>{country}</Tooltip>;
|
|
105
105
|
},
|
|
106
106
|
},
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
107
|
+
{
|
|
108
|
+
title: t("Province"),
|
|
109
|
+
dataIndex: "administrativeLevel1",
|
|
110
|
+
key: "administrativeLevel1",
|
|
111
|
+
ellipsis: true,
|
|
112
|
+
show: entity.includes("locations"),
|
|
113
|
+
render: (value, all) => {
|
|
114
|
+
if (all.empty) {
|
|
115
|
+
return <div className="daf-default-cell" />;
|
|
116
|
+
}
|
|
117
117
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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
124
|
|
|
125
|
-
|
|
125
|
+
return <Tooltip title={label || '-'}>{label || '-'}</Tooltip>;
|
|
126
|
+
},
|
|
126
127
|
},
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
128
|
+
{
|
|
129
|
+
title: t("Territory"),
|
|
130
|
+
dataIndex: "administrativeLevel2",
|
|
131
|
+
key: "administrativeLevel2",
|
|
132
|
+
show: entity.includes("locations"),
|
|
133
|
+
ellipsis: true,
|
|
134
|
+
render: (value, all) => {
|
|
135
|
+
if (all.empty) {
|
|
136
|
+
return <div className="daf-default-cell" />;
|
|
137
|
+
}
|
|
138
138
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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
145
|
|
|
146
|
-
|
|
146
|
+
return <Tooltip title={label || '-'}>{label || '-'}</Tooltip>;
|
|
147
|
+
},
|
|
147
148
|
},
|
|
148
|
-
},
|
|
149
149
|
{
|
|
150
150
|
title: t("Sources"),
|
|
151
151
|
dataIndex: "sources",
|
|
@@ -210,7 +210,7 @@ export const getColumns = ({
|
|
|
210
210
|
<div
|
|
211
211
|
className="cursor-pointer"
|
|
212
212
|
onClick={() => {
|
|
213
|
-
goTo(getRedirectLink(`/app/
|
|
213
|
+
goTo(getRedirectLink(`/app/accounts/view/${all.id}/details`));
|
|
214
214
|
}}
|
|
215
215
|
>
|
|
216
216
|
<CustomIcon name="Link" width={18} height={18} />
|
|
@@ -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
|
|
5
|
+
import { theme, Tag } from "antd";
|
|
6
6
|
import CustomIcon from "../../../../Icon/CustomIcon.jsx";
|
|
7
7
|
import {
|
|
8
8
|
getTabs,
|
|
@@ -38,41 +38,6 @@ export default function SubjectsTable({
|
|
|
38
38
|
const { token } = useToken();
|
|
39
39
|
const [isCombineModalOpen, setIsModalOpen] = useState(false);
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const getDataWithStringPagination = async ({ params }) => {
|
|
45
|
-
const { pagination, tab, filters, search, sort, ...otherParams } = params;
|
|
46
|
-
|
|
47
|
-
let paginationObj = { page: 1, pageSize: 20 };
|
|
48
|
-
if (pagination) {
|
|
49
|
-
try {
|
|
50
|
-
paginationObj = typeof pagination === 'string' ? JSON.parse(pagination) : pagination;
|
|
51
|
-
} catch (e) {
|
|
52
|
-
console.error('Failed to parse pagination', e);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
let activeTab = tab || "active";
|
|
57
|
-
if (!tab && filters) {
|
|
58
|
-
try {
|
|
59
|
-
const parsedFilters = typeof filters === 'string' ? JSON.parse(filters) : filters;
|
|
60
|
-
activeTab = parsedFilters.activeTab || "active";
|
|
61
|
-
} catch (e) {
|
|
62
|
-
activeTab = "active";
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const transformedParams = {
|
|
67
|
-
pagination: {
|
|
68
|
-
skip: String(paginationObj.page || 1),
|
|
69
|
-
take: String(paginationObj.pageSize || 20),
|
|
70
|
-
},
|
|
71
|
-
tab: activeTab,
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
return getData({ params: transformedParams });
|
|
75
|
-
};
|
|
76
41
|
const {
|
|
77
42
|
filter,
|
|
78
43
|
activeTab,
|
|
@@ -94,7 +59,7 @@ const getDataWithStringPagination = async ({ params }) => {
|
|
|
94
59
|
defaultPageSize,
|
|
95
60
|
filtersConfig,
|
|
96
61
|
getRedirectLink,
|
|
97
|
-
getData
|
|
62
|
+
getData,
|
|
98
63
|
refetchTrigger,
|
|
99
64
|
});
|
|
100
65
|
|
|
@@ -102,7 +67,7 @@ const getDataWithStringPagination = async ({ params }) => {
|
|
|
102
67
|
return {
|
|
103
68
|
category: config.options?.category,
|
|
104
69
|
country: config.options?.countries,
|
|
105
|
-
sources: [],
|
|
70
|
+
sources: [], //TODO: add sources logic and make sure you only show unique sources only once
|
|
106
71
|
};
|
|
107
72
|
}, [config.options]);
|
|
108
73
|
|
|
@@ -148,15 +113,25 @@ const getDataWithStringPagination = async ({ params }) => {
|
|
|
148
113
|
breadcrumbs={breadcrumbs}
|
|
149
114
|
>
|
|
150
115
|
{selectedSubjects.length > 0 && (
|
|
151
|
-
<div
|
|
116
|
+
<div
|
|
117
|
+
className="flex flex-row ml-6 mt-5"
|
|
118
|
+
style={{
|
|
119
|
+
flexWrap: "wrap",
|
|
120
|
+
gap: "8px",
|
|
121
|
+
}}
|
|
122
|
+
>
|
|
152
123
|
{selectedSubjects.map((account) => (
|
|
153
124
|
<Tag
|
|
154
125
|
key={account.userId}
|
|
155
126
|
className="flex flex-row gap-2 items-center"
|
|
156
127
|
onClick={() =>
|
|
157
|
-
setSelectedSubjects((prev) =>
|
|
128
|
+
setSelectedSubjects((prev) =>
|
|
129
|
+
prev.filter((a) => a.datastakeId !== account.datastakeId),
|
|
130
|
+
)
|
|
158
131
|
}
|
|
159
|
-
style={{
|
|
132
|
+
style={{
|
|
133
|
+
cursor: "pointer",
|
|
134
|
+
}}
|
|
160
135
|
>
|
|
161
136
|
<span>{account.datastakeId}</span>
|
|
162
137
|
<CustomIcon name="Close" size={10} />
|
|
@@ -185,20 +160,19 @@ const getDataWithStringPagination = async ({ params }) => {
|
|
|
185
160
|
<CombineSubjectsModal
|
|
186
161
|
isOpen={isCombineModalOpen}
|
|
187
162
|
t={t}
|
|
188
|
-
onClose={() =>
|
|
163
|
+
onClose={() => {
|
|
164
|
+
setIsModalOpen(false);
|
|
165
|
+
}}
|
|
189
166
|
onSuccess={(data) => {
|
|
190
167
|
setIsModalOpen(false);
|
|
191
168
|
setLoading(true);
|
|
192
|
-
message.success(t("Subjects successfully merged."))
|
|
193
169
|
if (typeof mergeSubjectsFunction === 'function') {
|
|
194
|
-
mergeSubjectsFunction(data)
|
|
195
|
-
|
|
196
|
-
fetchData();
|
|
197
|
-
});
|
|
170
|
+
mergeSubjectsFunction(data);
|
|
171
|
+
setSelectedSubjects([])
|
|
198
172
|
}
|
|
199
173
|
}}
|
|
200
174
|
selectedSubjects={selectedSubjects}
|
|
201
|
-
selectOptions={selectOptions}
|
|
175
|
+
selectOptions={selectOptions || {}}
|
|
202
176
|
module={module}
|
|
203
177
|
entity={headerTitle}
|
|
204
178
|
/>
|
|
@@ -37,7 +37,7 @@ export default function Edit({
|
|
|
37
37
|
|
|
38
38
|
const deleteUser = useCallback(
|
|
39
39
|
(id) => {
|
|
40
|
-
// TODO: add call
|
|
40
|
+
// TODO: add call
|
|
41
41
|
console.log("DELETE", id);
|
|
42
42
|
fetchData();
|
|
43
43
|
},
|
|
@@ -174,8 +174,6 @@ export default function Edit({
|
|
|
174
174
|
);
|
|
175
175
|
};
|
|
176
176
|
|
|
177
|
-
console.log(conf,"data");
|
|
178
|
-
|
|
179
177
|
return (
|
|
180
178
|
<div className="form-edit flex-row">
|
|
181
179
|
<Form
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { Menu } from "antd";
|
|
2
|
-
import { config
|
|
2
|
+
import { config } from "../../config";
|
|
3
3
|
|
|
4
|
-
export default function SideBarMenu({ selectedGroup, onChange = () => {}, t
|
|
5
|
-
const menuConfig = config || defaultConfig;
|
|
6
|
-
|
|
4
|
+
export default function SideBarMenu({ selectedGroup, onChange = () => {}, t }) {
|
|
7
5
|
return (
|
|
8
6
|
<Menu
|
|
9
7
|
mode="inline"
|
|
@@ -14,7 +12,7 @@ export default function SideBarMenu({ selectedGroup, onChange = () => {}, t, con
|
|
|
14
12
|
onChange(g.key);
|
|
15
13
|
}}
|
|
16
14
|
items={
|
|
17
|
-
|
|
15
|
+
config.map((conf) => {
|
|
18
16
|
return {
|
|
19
17
|
key: conf.key,
|
|
20
18
|
label: t(conf.label),
|
|
@@ -167,7 +167,10 @@ export const getColumns = ({
|
|
|
167
167
|
return cols.filter((v) => v.show);
|
|
168
168
|
};
|
|
169
169
|
|
|
170
|
-
export const checkboxConfig = {
|
|
170
|
+
export const checkboxConfig = {
|
|
171
|
+
name: "Name",
|
|
172
|
+
datastakeId: "ID",
|
|
173
|
+
};
|
|
171
174
|
|
|
172
175
|
export const selectFiltersConfig = {
|
|
173
176
|
userRole: {
|
|
@@ -191,17 +194,9 @@ export const selectFiltersConfig = {
|
|
|
191
194
|
};
|
|
192
195
|
|
|
193
196
|
export const filtersConfig = {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
export const defaultUrlParams = {
|
|
198
|
-
search: "",
|
|
199
|
-
userRole: null,
|
|
200
|
-
status: null,
|
|
197
|
+
name: "",
|
|
198
|
+
datastakeId: "",
|
|
201
199
|
};
|
|
202
200
|
|
|
203
|
-
export const
|
|
204
|
-
|
|
205
|
-
userRole: null,
|
|
206
|
-
status: null,
|
|
207
|
-
};
|
|
201
|
+
export const defaultUrlParams = {};
|
|
202
|
+
export const defaultTableFilters = {};
|
|
@@ -60,10 +60,10 @@ export default function Users({
|
|
|
60
60
|
userRole: userRoles.filter((u) => !u.isForAppAdmin),
|
|
61
61
|
status: accountStatuses,
|
|
62
62
|
};
|
|
63
|
-
}, [userRoles
|
|
63
|
+
}, [userRoles]);
|
|
64
64
|
|
|
65
65
|
const canClearSearch = useMemo(() => {
|
|
66
|
-
return !!activeFilters.search
|
|
66
|
+
return !!activeFilters.search;
|
|
67
67
|
}, [activeFilters]);
|
|
68
68
|
|
|
69
69
|
const onDeleteUserClick = useCallback(
|
|
@@ -55,6 +55,7 @@ function AdminView({
|
|
|
55
55
|
}, [data]);
|
|
56
56
|
|
|
57
57
|
const goToView = useCallback(() => {
|
|
58
|
+
console.log("goToView");
|
|
58
59
|
changeNotificationState({
|
|
59
60
|
onYes: () => {
|
|
60
61
|
setEditData(data);
|
|
@@ -62,7 +63,7 @@ function AdminView({
|
|
|
62
63
|
goTo(`/app/accounts/view/${id}/${group}`);
|
|
63
64
|
},
|
|
64
65
|
});
|
|
65
|
-
}, [goTo, changeNotificationState, data
|
|
66
|
+
}, [goTo, changeNotificationState, data]);
|
|
66
67
|
|
|
67
68
|
const breadCrumbs = useMemo(() => {
|
|
68
69
|
return renderBreadCrumbs({
|
|
@@ -98,9 +99,9 @@ function AdminView({
|
|
|
98
99
|
setIsChanged(false);
|
|
99
100
|
setLoading(false);
|
|
100
101
|
} catch (err) {
|
|
101
|
-
|
|
102
|
+
console.log(err);
|
|
102
103
|
}
|
|
103
|
-
}, [id
|
|
104
|
+
}, [id]);
|
|
104
105
|
|
|
105
106
|
useEffect(() => {
|
|
106
107
|
fetchData();
|
|
@@ -5,7 +5,6 @@ import AdminAccountsScreen from "./AdminScreens/Accounts.jsx";
|
|
|
5
5
|
import AdminAccountsViewScreen from "./AdminScreens/AccountsView.jsx";
|
|
6
6
|
import AdminSubjectsScreen from "./AdminScreens/Subjects.jsx";
|
|
7
7
|
import AdminLocationScreen from "./AdminScreens/Location.jsx";
|
|
8
|
-
import AdminSubjectsViewScreen from "./AdminScreens/SubjectsView.jsx";
|
|
9
8
|
|
|
10
9
|
export function getAdminRoutes(config) {
|
|
11
10
|
const {
|
|
@@ -16,8 +15,6 @@ export function getAdminRoutes(config) {
|
|
|
16
15
|
useAdminAccountsViewConfig,
|
|
17
16
|
useAdminSubjectsConfig,
|
|
18
17
|
useAdminLocationConfig,
|
|
19
|
-
useAdminSubjectsViewConfig,
|
|
20
|
-
useAdminLocationViewConfig,
|
|
21
18
|
userIsAdmin,
|
|
22
19
|
} = config;
|
|
23
20
|
|
|
@@ -59,38 +56,6 @@ export function getAdminRoutes(config) {
|
|
|
59
56
|
return <AdminLocationScreen config={locationConfig} />;
|
|
60
57
|
}
|
|
61
58
|
|
|
62
|
-
function LocationViewWrapper() {
|
|
63
|
-
const locationViewConfig =
|
|
64
|
-
typeof useAdminLocationViewConfig === "function"
|
|
65
|
-
? useAdminLocationViewConfig()
|
|
66
|
-
: undefined;
|
|
67
|
-
return <AdminSubjectsViewScreen config={{ ...locationViewConfig, subject: "location" }} />;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function StakeholderViewWrapper() {
|
|
71
|
-
const stakeholderViewConfig =
|
|
72
|
-
typeof useAdminSubjectsViewConfig === "function"
|
|
73
|
-
? useAdminSubjectsViewConfig()
|
|
74
|
-
: undefined;
|
|
75
|
-
return <AdminSubjectsViewScreen config={{ ...stakeholderViewConfig, subject: "stakeholder" }} />;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function LocationEditWrapper() {
|
|
79
|
-
const locationViewConfig =
|
|
80
|
-
typeof useAdminLocationViewConfig === "function"
|
|
81
|
-
? useAdminLocationViewConfig()
|
|
82
|
-
: undefined;
|
|
83
|
-
return <AdminSubjectsViewScreen config={{ ...locationViewConfig, subject: "location", mode: "edit" }} />;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
function StakeholderEditWrapper() {
|
|
87
|
-
const stakeholderViewConfig =
|
|
88
|
-
typeof useAdminSubjectsViewConfig === "function"
|
|
89
|
-
? useAdminSubjectsViewConfig()
|
|
90
|
-
: undefined;
|
|
91
|
-
return <AdminSubjectsViewScreen config={{ ...stakeholderViewConfig, subject: "stakeholder", mode: "edit" }} />;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
59
|
const subjectsIndexComponent =
|
|
95
60
|
typeof useAdminLocationConfig === "function"
|
|
96
61
|
? <LocationWrapper />
|
|
@@ -139,7 +104,7 @@ export function getAdminRoutes(config) {
|
|
|
139
104
|
...(typeof useAdminLocationConfig === "function"
|
|
140
105
|
? [
|
|
141
106
|
{
|
|
142
|
-
path: "
|
|
107
|
+
path: "subjects/location",
|
|
143
108
|
key: `${APP_PREFIX}_ADMIN_SUBJECTS_LOCATIONS`,
|
|
144
109
|
exact: true,
|
|
145
110
|
visible: (user) => userIsAdmin(user),
|
|
@@ -150,7 +115,7 @@ export function getAdminRoutes(config) {
|
|
|
150
115
|
...(typeof useAdminSubjectsConfig === "function"
|
|
151
116
|
? [
|
|
152
117
|
{
|
|
153
|
-
path: "
|
|
118
|
+
path: "subjects/stakeholder",
|
|
154
119
|
key: `${APP_PREFIX}_ADMIN_SUBJECTS_STAKEHOLDERS`,
|
|
155
120
|
exact: true,
|
|
156
121
|
visible: (user) => userIsAdmin(user),
|
|
@@ -158,50 +123,6 @@ export function getAdminRoutes(config) {
|
|
|
158
123
|
},
|
|
159
124
|
]
|
|
160
125
|
: []),
|
|
161
|
-
...(typeof useAdminLocationViewConfig === "function"
|
|
162
|
-
? [
|
|
163
|
-
{
|
|
164
|
-
path: "management/subject/location/:id",
|
|
165
|
-
key: `${APP_PREFIX}_ADMIN_LOCATION_VIEW`,
|
|
166
|
-
exact: true,
|
|
167
|
-
visible: (user) => userIsAdmin(user),
|
|
168
|
-
component: <LocationViewWrapper />,
|
|
169
|
-
},
|
|
170
|
-
]
|
|
171
|
-
: []),
|
|
172
|
-
...(typeof useAdminSubjectsViewConfig === "function"
|
|
173
|
-
? [
|
|
174
|
-
{
|
|
175
|
-
path: "management/subject/stakeholder/:id",
|
|
176
|
-
key: `${APP_PREFIX}_ADMIN_STAKEHOLDER_VIEW`,
|
|
177
|
-
exact: true,
|
|
178
|
-
visible: (user) => userIsAdmin(user),
|
|
179
|
-
component: <StakeholderViewWrapper />,
|
|
180
|
-
},
|
|
181
|
-
]
|
|
182
|
-
: []),
|
|
183
|
-
...(typeof useAdminLocationViewConfig === "function"
|
|
184
|
-
? [
|
|
185
|
-
{
|
|
186
|
-
path: "management/subject/location/edit/:id",
|
|
187
|
-
key: `${APP_PREFIX}_ADMIN_LOCATION_EDIT`,
|
|
188
|
-
exact: true,
|
|
189
|
-
visible: (user) => userIsAdmin(user),
|
|
190
|
-
component: <LocationEditWrapper />,
|
|
191
|
-
},
|
|
192
|
-
]
|
|
193
|
-
: []),
|
|
194
|
-
...(typeof useAdminSubjectsViewConfig === "function"
|
|
195
|
-
? [
|
|
196
|
-
{
|
|
197
|
-
path: "management/subject/stakeholder/edit/:id",
|
|
198
|
-
key: `${APP_PREFIX}_ADMIN_STAKEHOLDER_EDIT`,
|
|
199
|
-
exact: true,
|
|
200
|
-
visible: (user) => userIsAdmin(user),
|
|
201
|
-
component: <StakeholderEditWrapper />,
|
|
202
|
-
},
|
|
203
|
-
]
|
|
204
|
-
: []),
|
|
205
126
|
];
|
|
206
127
|
|
|
207
128
|
return routes;
|