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
package/dist/services/index.js
CHANGED
|
@@ -765,85 +765,19 @@ class AdminService extends BaseService {
|
|
|
765
765
|
params
|
|
766
766
|
}) {
|
|
767
767
|
return this.apiGet({
|
|
768
|
-
url:
|
|
768
|
+
url: `${subject}`,
|
|
769
769
|
params
|
|
770
770
|
});
|
|
771
771
|
}
|
|
772
|
-
mergeLocations({
|
|
773
|
-
ids,
|
|
774
|
-
data
|
|
775
|
-
}) {
|
|
776
|
-
const [id1, id2, ...remainingIds] = ids || [];
|
|
777
|
-
if (!id1 || !id2) {
|
|
778
|
-
throw new Error('At least two IDs are required for merging');
|
|
779
|
-
}
|
|
780
|
-
const url = `/management/merge/location/${id1}/${id2}`;
|
|
781
|
-
const payload = {
|
|
782
|
-
...data
|
|
783
|
-
};
|
|
784
|
-
if (remainingIds.length > 0) {
|
|
785
|
-
payload.additionalIds = remainingIds;
|
|
786
|
-
}
|
|
787
|
-
return this.apiPost({
|
|
788
|
-
url,
|
|
789
|
-
data: payload
|
|
790
|
-
});
|
|
791
|
-
}
|
|
792
772
|
mergeSubjects({
|
|
793
773
|
subject,
|
|
794
|
-
|
|
795
|
-
data
|
|
774
|
+
...data
|
|
796
775
|
}) {
|
|
797
|
-
const [id1, id2, ...remainingIds] = ids || [];
|
|
798
|
-
if (!id1 || !id2) {
|
|
799
|
-
throw new Error('At least two IDs are required for merging');
|
|
800
|
-
}
|
|
801
|
-
const url = `/management/merge/${subject}/${id1}/${id2}`;
|
|
802
|
-
const payload = {
|
|
803
|
-
...data
|
|
804
|
-
};
|
|
805
|
-
if (remainingIds.length > 0) {
|
|
806
|
-
payload.additionalIds = remainingIds;
|
|
807
|
-
}
|
|
808
776
|
return this.apiPost({
|
|
809
|
-
url
|
|
810
|
-
data: payload
|
|
811
|
-
});
|
|
812
|
-
}
|
|
813
|
-
viewLocation({
|
|
814
|
-
id
|
|
815
|
-
}) {
|
|
816
|
-
return this.apiGet({
|
|
817
|
-
url: `/management/subject/location/${id}`
|
|
818
|
-
});
|
|
819
|
-
}
|
|
820
|
-
viewStakeholder({
|
|
821
|
-
id
|
|
822
|
-
}) {
|
|
823
|
-
return this.apiGet({
|
|
824
|
-
url: `/management/subject/stakeholder/${id}`
|
|
825
|
-
});
|
|
826
|
-
}
|
|
827
|
-
updateSubject({
|
|
828
|
-
subject,
|
|
829
|
-
id,
|
|
830
|
-
data
|
|
831
|
-
}) {
|
|
832
|
-
const type = subject === 'location' ? 'location' : 'stakeholder';
|
|
833
|
-
return this.apiPut({
|
|
834
|
-
url: `/management/subject/${type}/${id}`,
|
|
777
|
+
url: `/merge/${subject}`,
|
|
835
778
|
data
|
|
836
779
|
});
|
|
837
780
|
}
|
|
838
|
-
getUserGrowth(activeFilter) {
|
|
839
|
-
return this.apiGet({
|
|
840
|
-
url: `/accounts/dashboard/user-growth`,
|
|
841
|
-
isUserManager: true,
|
|
842
|
-
params: {
|
|
843
|
-
activeFilter
|
|
844
|
-
}
|
|
845
|
-
});
|
|
846
|
-
}
|
|
847
781
|
}
|
|
848
782
|
var AdminService$1 = createLazyService(AdminService);
|
|
849
783
|
|
package/dist/utils/index.js
CHANGED
|
@@ -7506,14 +7506,15 @@ const getDefaultActiveFilters = (params, selectFiltersConfig, defaultPageSize, d
|
|
|
7506
7506
|
});
|
|
7507
7507
|
return o;
|
|
7508
7508
|
};
|
|
7509
|
+
const NEW_PAGINATION_APPS = ["nashiriki"];
|
|
7509
7510
|
const filterParams = (value, module) => {
|
|
7510
7511
|
const {
|
|
7511
7512
|
activeFilters,
|
|
7512
7513
|
...rest
|
|
7513
7514
|
} = value;
|
|
7514
7515
|
const {
|
|
7515
|
-
page
|
|
7516
|
-
pageSize
|
|
7516
|
+
page,
|
|
7517
|
+
pageSize,
|
|
7517
7518
|
sortDir,
|
|
7518
7519
|
sortBy,
|
|
7519
7520
|
search,
|
|
@@ -7522,10 +7523,9 @@ const filterParams = (value, module) => {
|
|
|
7522
7523
|
} = activeFilters || {};
|
|
7523
7524
|
const params = {};
|
|
7524
7525
|
params.pagination = JSON.stringify({
|
|
7525
|
-
page,
|
|
7526
|
-
pageSize
|
|
7526
|
+
[NEW_PAGINATION_APPS.includes(module) ? "skip" : "page"]: page,
|
|
7527
|
+
[NEW_PAGINATION_APPS.includes(module) ? "take" : "pageSize"]: pageSize
|
|
7527
7528
|
});
|
|
7528
|
-
params.filters = JSON.stringify(filters);
|
|
7529
7529
|
if (search && searchParams) {
|
|
7530
7530
|
params.search = JSON.stringify({
|
|
7531
7531
|
qs: search,
|
|
@@ -7538,6 +7538,16 @@ const filterParams = (value, module) => {
|
|
|
7538
7538
|
by: sortBy
|
|
7539
7539
|
});
|
|
7540
7540
|
}
|
|
7541
|
+
if (Object.keys(filters).length) {
|
|
7542
|
+
if (value.sourceId && value.sourceId === "overview") {
|
|
7543
|
+
params.filters = JSON.stringify(filters);
|
|
7544
|
+
} else {
|
|
7545
|
+
params.filters = JSON.stringify({
|
|
7546
|
+
...filters,
|
|
7547
|
+
authorId: undefined
|
|
7548
|
+
});
|
|
7549
|
+
}
|
|
7550
|
+
}
|
|
7541
7551
|
return {
|
|
7542
7552
|
...rest,
|
|
7543
7553
|
...params
|
|
@@ -7742,13 +7752,7 @@ function getRedirectPath(user, fallback = '', app, isDatastake) {
|
|
|
7742
7752
|
}
|
|
7743
7753
|
|
|
7744
7754
|
const en = {
|
|
7745
|
-
"
|
|
7746
|
-
"sbg-admin::remove-user-body": "Remove User Body",
|
|
7747
|
-
"Administrative-level-1": "Administrative Level 1",
|
|
7748
|
-
"Administrative-level-2": "Administrative Level 2",
|
|
7749
|
-
"merge-output": "Merge Output",
|
|
7750
|
-
"admin::current_subjects": "Current Subjects",
|
|
7751
|
-
"add-account": "Add Account",
|
|
7755
|
+
"All Data": "All Data",
|
|
7752
7756
|
"Site": "Site",
|
|
7753
7757
|
"Production Sites": "Production Sites",
|
|
7754
7758
|
"Type of account": "Type of account",
|
|
@@ -9070,6 +9074,7 @@ const en = {
|
|
|
9070
9074
|
};
|
|
9071
9075
|
|
|
9072
9076
|
const fr = {
|
|
9077
|
+
"All Data": "Toutes les données",
|
|
9073
9078
|
"Site": "Site",
|
|
9074
9079
|
"Production Sites": "Sites de production",
|
|
9075
9080
|
"Type of account": "Type de compte",
|
|
@@ -9448,7 +9453,7 @@ const fr = {
|
|
|
9448
9453
|
Documentation: "Documents",
|
|
9449
9454
|
"Edit project": "Modifier le projet",
|
|
9450
9455
|
Name: "Nom",
|
|
9451
|
-
Type: "
|
|
9456
|
+
Type: "Tapez",
|
|
9452
9457
|
type: "Type",
|
|
9453
9458
|
Province: "Province",
|
|
9454
9459
|
Territory: "Territoire",
|
|
@@ -11025,6 +11030,7 @@ const fr = {
|
|
|
11025
11030
|
};
|
|
11026
11031
|
|
|
11027
11032
|
const sp = {
|
|
11033
|
+
"All Data": "Todos los datos",
|
|
11028
11034
|
"Site": "Sitio",
|
|
11029
11035
|
"Production Sites": "Centros de producción",
|
|
11030
11036
|
"Type of account": "Tipo de cuenta",
|
|
@@ -11259,7 +11265,7 @@ const sp = {
|
|
|
11259
11265
|
"Documentation": "Documentos",
|
|
11260
11266
|
"Edit project": "Modificar proyecto",
|
|
11261
11267
|
"Name": "Nombre",
|
|
11262
|
-
"Type": "
|
|
11268
|
+
"Type": "Escribe",
|
|
11263
11269
|
"type": "Tipo",
|
|
11264
11270
|
"Province": "Provincia",
|
|
11265
11271
|
"Territory": "Territorio",
|
package/package.json
CHANGED
|
@@ -11,6 +11,21 @@ import {
|
|
|
11
11
|
import { useMapHelper } from "./helper";
|
|
12
12
|
import { isLocation, isStakeholder } from "./ChainIcon/utils";
|
|
13
13
|
|
|
14
|
+
const calculatePolygonArea = (coordinates) => {
|
|
15
|
+
if (!coordinates || !Array.isArray(coordinates) || coordinates.length < 3) return 0;
|
|
16
|
+
let area = 0;
|
|
17
|
+
for (let i = 0; i < coordinates.length; i++) {
|
|
18
|
+
const j = (i + 1) % coordinates.length;
|
|
19
|
+
const lat1 = coordinates[i][0];
|
|
20
|
+
const lng1 = coordinates[i][1];
|
|
21
|
+
const lat2 = coordinates[j][0];
|
|
22
|
+
const lng2 = coordinates[j][1];
|
|
23
|
+
area += lat1 * lng2;
|
|
24
|
+
area -= lng1 * lat2;
|
|
25
|
+
}
|
|
26
|
+
return Math.abs(area / 2);
|
|
27
|
+
};
|
|
28
|
+
|
|
14
29
|
export const useMap = ({
|
|
15
30
|
type,
|
|
16
31
|
data: allData = null,
|
|
@@ -240,7 +255,16 @@ export const useMap = ({
|
|
|
240
255
|
const maxTotal = Math.max(...(data || []).map((d) => d.total));
|
|
241
256
|
|
|
242
257
|
const dataToRender = type === "chain" ? filteredData : data;
|
|
243
|
-
|
|
258
|
+
|
|
259
|
+
const sortedData = type === "territory"
|
|
260
|
+
? [...dataToRender].sort((a, b) => {
|
|
261
|
+
const areaA = calculatePolygonArea(a.area);
|
|
262
|
+
const areaB = calculatePolygonArea(b.area);
|
|
263
|
+
return areaB - areaA;
|
|
264
|
+
})
|
|
265
|
+
: dataToRender;
|
|
266
|
+
|
|
267
|
+
sortedData.forEach((d, i) => {
|
|
244
268
|
addIconToMapInitialy(
|
|
245
269
|
[d?.marker?.lat, d?.marker?.lng],
|
|
246
270
|
"location",
|
|
@@ -10,6 +10,7 @@ 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
|
+
|
|
13
14
|
useEffect(() => {
|
|
14
15
|
if (container.current) {
|
|
15
16
|
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
|
+
|
|
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
|
+
|
|
13
13
|
|
|
14
14
|
useEffect(() => {
|
|
15
15
|
if (typeof fetchUserGrowth === "function") {
|
|
@@ -47,7 +47,7 @@ export const getColumns = ({ t, selectOptions, module, entity }) => {
|
|
|
47
47
|
dataIndex: "administrativeLevel1",
|
|
48
48
|
key: "administrativeLevel1",
|
|
49
49
|
ellipsis: true,
|
|
50
|
-
show: entity
|
|
50
|
+
show: entity.includes("locations"),
|
|
51
51
|
render: (value, all) => {
|
|
52
52
|
let label;
|
|
53
53
|
if(all?.administrativeLevel1 && value === all?.administrativeLevel1) {
|
|
@@ -63,7 +63,7 @@ export const getColumns = ({ t, selectOptions, module, entity }) => {
|
|
|
63
63
|
title: t("Territory"),
|
|
64
64
|
dataIndex: "administrativeLevel2",
|
|
65
65
|
key: "administrativeLevel2",
|
|
66
|
-
show: entity
|
|
66
|
+
show: entity.includes("locations"),
|
|
67
67
|
render: (value, all) => {
|
|
68
68
|
let label;
|
|
69
69
|
if(all?.administrativeLevel2 && value === all?.administrativeLevel2) {
|
|
@@ -1,10 +1,11 @@
|
|
|
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
5
|
import DAFTable from "../../../../Table/index.jsx";
|
|
5
6
|
import { useMemo, useState } from "react";
|
|
6
|
-
import { getNameByLevel } from "../../AdminTables/SubjectsTable/helper.js";
|
|
7
7
|
import { getColumns } from "./helper.js";
|
|
8
|
+
import { getNameByLevel } from "../../AdminTables/SubjectsTable/helper.js";
|
|
8
9
|
|
|
9
10
|
const { useToken } = theme;
|
|
10
11
|
|
|
@@ -34,22 +35,10 @@ export default function CombineLocationModal({
|
|
|
34
35
|
|
|
35
36
|
const onSubmit = () => {
|
|
36
37
|
MainForm.validateFields().then((data) => {
|
|
37
|
-
const ids = selectedLocations.map((location) => location.
|
|
38
|
-
const allowedKeys = [
|
|
39
|
-
"id",
|
|
40
|
-
"name",
|
|
41
|
-
"country",
|
|
42
|
-
"category",
|
|
43
|
-
"administrativeLevel1",
|
|
44
|
-
"administrativeLevel2"
|
|
45
|
-
];
|
|
46
|
-
const filteredData = Object.fromEntries(
|
|
47
|
-
Object.entries(data).filter(([key]) => allowedKeys.includes(key))
|
|
48
|
-
);
|
|
49
|
-
|
|
38
|
+
const ids = selectedLocations.map((location) => location._id);
|
|
50
39
|
onSuccess({
|
|
51
40
|
ids,
|
|
52
|
-
data
|
|
41
|
+
data,
|
|
53
42
|
});
|
|
54
43
|
});
|
|
55
44
|
};
|
|
@@ -68,7 +57,8 @@ export default function CombineLocationModal({
|
|
|
68
57
|
setIsDisabled(() => {
|
|
69
58
|
const values = MainForm.getFieldsValue();
|
|
70
59
|
|
|
71
|
-
const requiredFields =
|
|
60
|
+
const requiredFields =
|
|
61
|
+
entity === "location"
|
|
72
62
|
? ["id", "name", "category", "country", "administrativeLevel1", "administrativeLevel2"]
|
|
73
63
|
: ["id", "name", "category", "country"];
|
|
74
64
|
|
|
@@ -124,7 +114,7 @@ export default function CombineLocationModal({
|
|
|
124
114
|
options={selectedLocations.map((location) => {
|
|
125
115
|
return {
|
|
126
116
|
label: location?.datastakeId || "-",
|
|
127
|
-
|
|
117
|
+
value: location?.datastakeId || "-",
|
|
128
118
|
};
|
|
129
119
|
})}
|
|
130
120
|
placeholder={t("ID")}
|
|
@@ -179,7 +169,7 @@ export default function CombineLocationModal({
|
|
|
179
169
|
></Select>
|
|
180
170
|
</Form.Item>
|
|
181
171
|
|
|
182
|
-
{entity
|
|
172
|
+
{entity.includes("locations") && (
|
|
183
173
|
<>
|
|
184
174
|
<Form.Item className="flex-1" name="administrativeLevel1">
|
|
185
175
|
<Select
|
|
@@ -36,7 +36,7 @@ export default function CombineSubjectsModal({
|
|
|
36
36
|
|
|
37
37
|
const onSubmit = () => {
|
|
38
38
|
MainForm.validateFields().then((data) => {
|
|
39
|
-
const ids = selectedSubjects.map((subject) => subject.
|
|
39
|
+
const ids = selectedSubjects.map((subject) => subject._id);
|
|
40
40
|
onSuccess({
|
|
41
41
|
ids,
|
|
42
42
|
data,
|
|
@@ -47,7 +47,7 @@ export default function CombineSubjectsModal({
|
|
|
47
47
|
return (
|
|
48
48
|
<Modal
|
|
49
49
|
open={isOpen}
|
|
50
|
-
title={t("merge")}
|
|
50
|
+
title={t("admin::merge")}
|
|
51
51
|
onClose={onClose}
|
|
52
52
|
onSuccess={onSubmit}
|
|
53
53
|
withModalFormWrapper={false}
|
|
@@ -59,7 +59,7 @@ export default function CombineSubjectsModal({
|
|
|
59
59
|
const values = MainForm.getFieldsValue();
|
|
60
60
|
|
|
61
61
|
const requiredFields =
|
|
62
|
-
entity
|
|
62
|
+
entity === "location"
|
|
63
63
|
? ["id", "name", "category", "country", "administrativeLevel1", "administrativeLevel2"]
|
|
64
64
|
: ["id", "name", "category", "country"];
|
|
65
65
|
|
|
@@ -75,7 +75,7 @@ export default function CombineSubjectsModal({
|
|
|
75
75
|
color: token.baseGray90,
|
|
76
76
|
}}
|
|
77
77
|
>
|
|
78
|
-
{t("current_subjects")}
|
|
78
|
+
{t("admin::current_subjects")}
|
|
79
79
|
</span>
|
|
80
80
|
<DAFTable
|
|
81
81
|
columns={columns}
|
|
@@ -93,7 +93,7 @@ export default function CombineSubjectsModal({
|
|
|
93
93
|
marginTop: 14,
|
|
94
94
|
}}
|
|
95
95
|
>
|
|
96
|
-
{t("merged_output")}
|
|
96
|
+
{t("admin::merged_output")}
|
|
97
97
|
</span>
|
|
98
98
|
|
|
99
99
|
<Form
|
|
@@ -135,7 +135,7 @@ export default function CombineSubjectsModal({
|
|
|
135
135
|
></Select>
|
|
136
136
|
</Form.Item>
|
|
137
137
|
|
|
138
|
-
{entity.includes("
|
|
138
|
+
{entity.includes("locations") && (
|
|
139
139
|
<>
|
|
140
140
|
<Form.Item className="flex-1" name="administrativeLevel1">
|
|
141
141
|
<Select
|
|
@@ -20,7 +20,7 @@ export default function AdminDashboardScreen({ config }) {
|
|
|
20
20
|
userGrowthDataLoading,
|
|
21
21
|
} = useWidgetFetch();
|
|
22
22
|
|
|
23
|
-
|
|
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
|
+
|
|
43
43
|
|
|
44
44
|
return (
|
|
45
45
|
<AdminDashboard
|
|
@@ -48,11 +48,11 @@ export default function AdminLocationScreen({ config }) {
|
|
|
48
48
|
async (mergeData) => {
|
|
49
49
|
try {
|
|
50
50
|
if (AdminService.mergeLocations) {
|
|
51
|
-
await AdminService.mergeLocations(
|
|
51
|
+
await AdminService.mergeLocations(mergeData);
|
|
52
52
|
message.success(t("Locations merged successfully"));
|
|
53
53
|
} else {
|
|
54
54
|
console.warn("AdminService.mergeLocations is not implemented");
|
|
55
|
-
message.
|
|
55
|
+
message.success(t("Locations merged successfully"));
|
|
56
56
|
}
|
|
57
57
|
} catch (err) {
|
|
58
58
|
handleError?.(err);
|
|
@@ -61,11 +61,12 @@ export default function AdminLocationScreen({ config }) {
|
|
|
61
61
|
[AdminService, t, handleError]
|
|
62
62
|
);
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
// Use custom getData if provided, otherwise use default AdminService.getLocations
|
|
65
|
+
const getLocations = useCallback((params) => {
|
|
65
66
|
if (getData) {
|
|
66
67
|
return getData(params);
|
|
67
68
|
}
|
|
68
|
-
return AdminService.
|
|
69
|
+
return AdminService.getLocations(params);
|
|
69
70
|
}, [getData, AdminService]);
|
|
70
71
|
|
|
71
72
|
return (
|
|
@@ -76,12 +77,12 @@ export default function AdminLocationScreen({ config }) {
|
|
|
76
77
|
location={location}
|
|
77
78
|
module={module}
|
|
78
79
|
headerTitle={headerTitle}
|
|
79
|
-
getData={
|
|
80
|
+
getData={getLocations}
|
|
80
81
|
isMobile={isMobile}
|
|
81
82
|
defaultPageSize={defaultPageSize}
|
|
82
83
|
view={view}
|
|
83
84
|
breadcrumbs={breadcrumbs}
|
|
84
|
-
|
|
85
|
+
mergeSubjectsFunction={handleMergeLocations}
|
|
85
86
|
refetchTrigger={refetchTrigger}
|
|
86
87
|
config={{
|
|
87
88
|
options: {
|
|
@@ -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(
|
|
51
|
+
await AdminService.mergeSubjects(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(
|
|
69
|
+
return AdminService.getSubjects(params);
|
|
70
70
|
}, [getData, AdminService]);
|
|
71
71
|
|
|
72
72
|
return (
|
|
@@ -10,4 +10,3 @@ export { default as AdminAccountsScreen } from "./Accounts.jsx";
|
|
|
10
10
|
export { default as AdminAccountsViewScreen } from "./AccountsView.jsx";
|
|
11
11
|
export { default as AdminSubjectsScreen } from "./Subjects.jsx";
|
|
12
12
|
export { default as AdminLocationScreen } from "./Location.jsx";
|
|
13
|
-
export { default as AdminSubjectsViewScreen } from "./SubjectsView.jsx";
|