datastake-daf 0.6.746 → 0.6.747
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/hooks/index.js +2 -2
- package/dist/pages/index.js +2478 -176
- package/dist/services/index.js +23 -1
- package/package.json +1 -1
- package/src/@daf/hooks/useSources.js +1 -1
- package/src/@daf/pages/Summary/Minesite/components/LocationMap/index.js +61 -0
- package/src/@daf/pages/Summary/Minesite/components/MineSiteDetails/config.js +77 -0
- package/src/@daf/pages/Summary/Minesite/components/MineSiteDetails/index.js +47 -0
- package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/config.js +26 -0
- package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/helper.js +64 -0
- package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/index.js +56 -0
- package/src/@daf/pages/Summary/Minesite/index.jsx +162 -0
- package/src/@daf/pages/Summary/Operator/components/Governance/config.js +26 -0
- package/src/@daf/pages/Summary/Operator/components/Governance/helper.js +61 -0
- package/src/@daf/pages/Summary/Operator/components/Governance/index.js +55 -0
- package/src/@daf/pages/Summary/Operator/components/KeyInformation/config.js +84 -0
- package/src/@daf/pages/Summary/Operator/components/KeyInformation/index.js +46 -0
- package/src/@daf/pages/Summary/Operator/components/TradeRelationships/config.js +40 -0
- package/src/@daf/pages/Summary/Operator/components/TradeRelationships/helper.js +98 -0
- package/src/@daf/pages/Summary/Operator/components/TradeRelationships/hook.js +160 -0
- package/src/@daf/pages/Summary/Operator/components/TradeRelationships/index.js +83 -0
- package/src/@daf/pages/Summary/Operator/hook.js +176 -0
- package/src/@daf/pages/Summary/Operator/index.jsx +170 -0
- package/src/@daf/pages/Summary/components/InformationAvailability/components/Contributions/index.js +36 -0
- package/src/@daf/pages/Summary/components/InformationAvailability/components/InformationCompleteness/index.js +58 -0
- package/src/@daf/pages/Summary/components/InformationAvailability/index.js +42 -0
- package/src/@daf/pages/Summary/hook.js +188 -0
- package/src/@daf/services/OperatorService.js +16 -0
- package/src/@daf/services/SourceService.js +1 -1
- package/src/helpers/StringHelper.js +7 -0
- package/src/pages.js +2 -2
- package/dist/style/datastake/mapbox-gl.css +0 -330
- package/src/@daf/pages/Summary/minesite/index.js +0 -0
- package/src/@daf/pages/Summary/operator/index.jsx +0 -76
package/dist/services/index.js
CHANGED
|
@@ -1188,7 +1188,7 @@ class SourceService extends BaseService {
|
|
|
1188
1188
|
id
|
|
1189
1189
|
}) {
|
|
1190
1190
|
return this.apiGet({
|
|
1191
|
-
url: `/${type}/sources
|
|
1191
|
+
url: `/${type}/sources/${id}`
|
|
1192
1192
|
});
|
|
1193
1193
|
}
|
|
1194
1194
|
}
|
|
@@ -1435,8 +1435,30 @@ var LinkedSubjects = createLazyService(LinkedSubjectsService);
|
|
|
1435
1435
|
|
|
1436
1436
|
class OperatorService extends BaseService {
|
|
1437
1437
|
get(params) {
|
|
1438
|
+
const {
|
|
1439
|
+
datastakeId,
|
|
1440
|
+
...rest
|
|
1441
|
+
} = params;
|
|
1442
|
+
if (datastakeId) {
|
|
1443
|
+
return this.apiGet({
|
|
1444
|
+
url: `/stakeholder/${datastakeId}`,
|
|
1445
|
+
params: {
|
|
1446
|
+
...rest
|
|
1447
|
+
},
|
|
1448
|
+
isApp: true
|
|
1449
|
+
});
|
|
1450
|
+
}
|
|
1438
1451
|
return this.apiGet({
|
|
1439
1452
|
url: "/stakeholder",
|
|
1453
|
+
params: {
|
|
1454
|
+
...rest
|
|
1455
|
+
},
|
|
1456
|
+
isApp: true
|
|
1457
|
+
});
|
|
1458
|
+
}
|
|
1459
|
+
getOne(id, params) {
|
|
1460
|
+
return this.apiGet({
|
|
1461
|
+
url: `/stakeholder/${id}`,
|
|
1440
1462
|
params,
|
|
1441
1463
|
isApp: true
|
|
1442
1464
|
});
|
package/package.json
CHANGED
|
@@ -82,7 +82,7 @@ export default function useSource({ user = {}, t = () => {}, getData = () => {},
|
|
|
82
82
|
|
|
83
83
|
export const useSources = ({type, id, user, t = () => {}}) => {
|
|
84
84
|
function getData(params) {
|
|
85
|
-
if(id) {
|
|
85
|
+
if(id !== undefined && id !== null) {
|
|
86
86
|
return SourceService.getSources({type, id});
|
|
87
87
|
} else {
|
|
88
88
|
return SourceService.get(null, params);
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React, { useMemo } from 'react'
|
|
2
|
+
import Widget from '../../../../../core/components/Dashboard/Widget/index.jsx'
|
|
3
|
+
import Map from '../../../../../core/components/Dashboard/Map/index.jsx'
|
|
4
|
+
import { getLinkValue } from '../../../../../../helpers/StringHelper.js'
|
|
5
|
+
|
|
6
|
+
const LocationMap = ({
|
|
7
|
+
selectedPartners = {},
|
|
8
|
+
t = () => {},
|
|
9
|
+
params,
|
|
10
|
+
locationData = {},
|
|
11
|
+
loading = false,
|
|
12
|
+
}) => {
|
|
13
|
+
const data = useMemo(() => {
|
|
14
|
+
return {
|
|
15
|
+
gps: locationData?.gps || {},
|
|
16
|
+
name: locationData?.name || "",
|
|
17
|
+
admin_level_01:
|
|
18
|
+
locationData?.linking?.SCL?.[locationData?.administrativeLevel1]?.name || "",
|
|
19
|
+
admin_level_02:
|
|
20
|
+
locationData?.linking?.SCL?.[locationData?.administrativeLevel2]?.name || "",
|
|
21
|
+
country: locationData?.country,
|
|
22
|
+
};
|
|
23
|
+
}, [locationData]);
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<Widget
|
|
28
|
+
title={t("Location")}
|
|
29
|
+
className="no-px no-pb-body overflow-hidden"
|
|
30
|
+
loading={loading}
|
|
31
|
+
>
|
|
32
|
+
<Map
|
|
33
|
+
showSider={false}
|
|
34
|
+
primaryLink={true}
|
|
35
|
+
mapConfig={{
|
|
36
|
+
maxZoom: 10,
|
|
37
|
+
}}
|
|
38
|
+
type={"location"}
|
|
39
|
+
data={[data]}
|
|
40
|
+
renderTooltip={() => {
|
|
41
|
+
const country = data?.country;
|
|
42
|
+
const adminLevel1Label = t("Province")
|
|
43
|
+
const adminLevel2Label = t("Territory");
|
|
44
|
+
|
|
45
|
+
return [
|
|
46
|
+
{
|
|
47
|
+
label: t(adminLevel1Label),
|
|
48
|
+
value: data?.admin_level_01 || "--",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: t(adminLevel2Label),
|
|
52
|
+
value: data?.admin_level_02 || "--",
|
|
53
|
+
},
|
|
54
|
+
];
|
|
55
|
+
}}
|
|
56
|
+
/>
|
|
57
|
+
</Widget>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export default LocationMap
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Tag } from "antd";
|
|
3
|
+
import { getTagColor } from "../../../../../utils/productTag.js";
|
|
4
|
+
|
|
5
|
+
export function getKeyIndicatorsConfig({ t, data }) {
|
|
6
|
+
return [
|
|
7
|
+
{
|
|
8
|
+
label: t("Extraction Methods"),
|
|
9
|
+
render: () => {
|
|
10
|
+
if (!data?.extractionPoints?.length) {
|
|
11
|
+
return "-";
|
|
12
|
+
}
|
|
13
|
+
return (
|
|
14
|
+
<div
|
|
15
|
+
style={{
|
|
16
|
+
display: "flex",
|
|
17
|
+
flexWrap: "wrap",
|
|
18
|
+
}}
|
|
19
|
+
>
|
|
20
|
+
{data?.extractionPoints?.map((method) => {
|
|
21
|
+
return (
|
|
22
|
+
<Tag
|
|
23
|
+
key={method}
|
|
24
|
+
style={{
|
|
25
|
+
marginBottom: 8,
|
|
26
|
+
}}
|
|
27
|
+
>
|
|
28
|
+
{method}
|
|
29
|
+
</Tag>
|
|
30
|
+
);
|
|
31
|
+
})}
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
label: t("Products"),
|
|
38
|
+
render: () => {
|
|
39
|
+
if (data?.productsOfLocation?.length === 0) {
|
|
40
|
+
return "-";
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<div
|
|
45
|
+
style={{
|
|
46
|
+
display: "flex",
|
|
47
|
+
flexWrap: "wrap",
|
|
48
|
+
}}
|
|
49
|
+
>
|
|
50
|
+
{data?.productsOfLocation?.map((product) => {
|
|
51
|
+
return (
|
|
52
|
+
<Tag
|
|
53
|
+
key={product}
|
|
54
|
+
style={{
|
|
55
|
+
marginBottom: 8,
|
|
56
|
+
}}
|
|
57
|
+
color={getTagColor(product)}
|
|
58
|
+
>
|
|
59
|
+
{product}
|
|
60
|
+
</Tag>
|
|
61
|
+
);
|
|
62
|
+
})}
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
label: t("Number of Workers on Site"),
|
|
69
|
+
render: () => {
|
|
70
|
+
if (!data.workers) {
|
|
71
|
+
return "-";
|
|
72
|
+
}
|
|
73
|
+
return data.workers;
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
];
|
|
77
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React, { useMemo } from 'react'
|
|
2
|
+
import { getKeyIndicatorsConfig } from './config.js'
|
|
3
|
+
import KeyIndicatorsWidget from '../../../../../core/components/Dashboard/Widget/KeyIndicators/index.jsx'
|
|
4
|
+
|
|
5
|
+
const MineSiteDetails = ({
|
|
6
|
+
locationData = {},
|
|
7
|
+
loading = false,
|
|
8
|
+
t = () => {},
|
|
9
|
+
options = {}
|
|
10
|
+
}) => {
|
|
11
|
+
|
|
12
|
+
const data = useMemo(() => {
|
|
13
|
+
return {
|
|
14
|
+
extractionPoints: (locationData?.extractionMethod || []).map((method) => {
|
|
15
|
+
const _method = options?.extractionMethodsOptions?.find(
|
|
16
|
+
(option) => option.value === method,
|
|
17
|
+
)?.label;
|
|
18
|
+
|
|
19
|
+
return _method;
|
|
20
|
+
}),
|
|
21
|
+
products: (
|
|
22
|
+
(locationData?.products || []).map((product) => product.typeOfProduct) || []
|
|
23
|
+
).map((product) => {
|
|
24
|
+
const _product = options?.minerals?.find(
|
|
25
|
+
(option) => option.value === product,
|
|
26
|
+
)?.label;
|
|
27
|
+
|
|
28
|
+
return _product;
|
|
29
|
+
}),
|
|
30
|
+
workers: locationData?.totalNumberOfWorkers || 0,
|
|
31
|
+
};
|
|
32
|
+
}, [locationData, options]);
|
|
33
|
+
|
|
34
|
+
const config = useMemo(() => getKeyIndicatorsConfig({ t, data }), [t, data]);
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<KeyIndicatorsWidget
|
|
38
|
+
title={t("Mine Site Details")}
|
|
39
|
+
className="value-center small-content row-content-col"
|
|
40
|
+
config={config}
|
|
41
|
+
loading={loading}
|
|
42
|
+
widgetClassName="custom-width-b"
|
|
43
|
+
/>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default MineSiteDetails
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const IconNodesConfig = {
|
|
2
|
+
operators: {
|
|
3
|
+
name: "nashiriki::Operators",
|
|
4
|
+
icon: "Worker",
|
|
5
|
+
order: 1,
|
|
6
|
+
emptyName: "no-operators",
|
|
7
|
+
},
|
|
8
|
+
traders: {
|
|
9
|
+
name: "nashiriki::Traders",
|
|
10
|
+
icon: "Handshake",
|
|
11
|
+
order: 2,
|
|
12
|
+
emptyName: "no-traders",
|
|
13
|
+
},
|
|
14
|
+
government: {
|
|
15
|
+
name: "nashiriki::Government",
|
|
16
|
+
icon: "KYC",
|
|
17
|
+
order: 3,
|
|
18
|
+
emptyName: "no-government",
|
|
19
|
+
},
|
|
20
|
+
other: {
|
|
21
|
+
name: "nashiriki::Other",
|
|
22
|
+
icon: "CivilSociety",
|
|
23
|
+
order: 4,
|
|
24
|
+
emptyName: "no-other",
|
|
25
|
+
},
|
|
26
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { IconNodesConfig } from './config.js';
|
|
2
|
+
|
|
3
|
+
export const getStakeholderMappingData = ({data, locationData, id, options, t, goTo, selectedPartners}) => {
|
|
4
|
+
const _data = data;
|
|
5
|
+
|
|
6
|
+
return {
|
|
7
|
+
id: id,
|
|
8
|
+
name: locationData?.name || "",
|
|
9
|
+
country: {
|
|
10
|
+
label:
|
|
11
|
+
options?.countries?.find((country) => country.value === locationData?.country)
|
|
12
|
+
?.label || "",
|
|
13
|
+
value: (locationData?.country || "").toLowerCase() || "",
|
|
14
|
+
},
|
|
15
|
+
onClick: () => goTo(`/app/view/production-sites/${id}`),
|
|
16
|
+
totalSources: selectedPartners?.partners?.length || 0,
|
|
17
|
+
backgroundColor: "#FFD6E7",
|
|
18
|
+
iconColor: "#C41D7F",
|
|
19
|
+
|
|
20
|
+
icon: "DashboardLocations",
|
|
21
|
+
children: Object.keys(_data)?.map((key, index) => {
|
|
22
|
+
return {
|
|
23
|
+
id: key,
|
|
24
|
+
name: t(IconNodesConfig[key]?.name),
|
|
25
|
+
icon: IconNodesConfig[key]?.icon,
|
|
26
|
+
order: IconNodesConfig[key]?.order || index + 1,
|
|
27
|
+
activeColour: "#b6f5ec",
|
|
28
|
+
iconHoverColor: "#fff",
|
|
29
|
+
hoverColor: "#36cfca",
|
|
30
|
+
content: _data[key].length,
|
|
31
|
+
emptyName: IconNodesConfig[key]?.emptyName
|
|
32
|
+
? t(`nashiriki::${IconNodesConfig[key]?.emptyName}`)
|
|
33
|
+
: undefined,
|
|
34
|
+
children: (_data[key] || [])?.map((child) => {
|
|
35
|
+
return {
|
|
36
|
+
id: child?.datastakeId || "",
|
|
37
|
+
name: child?.name || "",
|
|
38
|
+
country: {
|
|
39
|
+
label:
|
|
40
|
+
options?.countries?.find(
|
|
41
|
+
(country) => country.value === child?.country,
|
|
42
|
+
)?.label || "",
|
|
43
|
+
value: child?.country ? child?.country?.toLowerCase() : "",
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
icon: "DashboardStakeholder",
|
|
47
|
+
onClick: () => {
|
|
48
|
+
if (child?.type === "operator") {
|
|
49
|
+
goTo(`/app/summary/operators/${child.datastakeId}`);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
goTo(`/app/view/stakeholders/${child.datastakeId}`);
|
|
54
|
+
},
|
|
55
|
+
totalSources: child?.sources || 0,
|
|
56
|
+
tooltipHeader: t("nashiriki::link-details"),
|
|
57
|
+
tooltipLabel: t("nashiriki::sources-reporting"),
|
|
58
|
+
value: child?.sources || 0,
|
|
59
|
+
};
|
|
60
|
+
}),
|
|
61
|
+
};
|
|
62
|
+
}),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React, { useMemo } from 'react'
|
|
2
|
+
import { useWidgetFetch } from '../../../../../hooks/useWidgetFetch.js';
|
|
3
|
+
import { getStakeholderMappingData } from './helper.js';
|
|
4
|
+
import Widget from '../../../../../core/components/Dashboard/Widget/index.jsx';
|
|
5
|
+
import StakeholderMappings from '../../../../../core/components/Graphs/StakeholderMappings/index.jsx';
|
|
6
|
+
|
|
7
|
+
const StakeholderMapping = ({
|
|
8
|
+
t = () => {},
|
|
9
|
+
id,
|
|
10
|
+
options = {},
|
|
11
|
+
goTo = () => {},
|
|
12
|
+
selectedPartners = {},
|
|
13
|
+
locationData = {},
|
|
14
|
+
}) => {
|
|
15
|
+
|
|
16
|
+
const defaultFilter = useMemo(() => {
|
|
17
|
+
return {
|
|
18
|
+
basepath: "analytics",
|
|
19
|
+
url: "/widgets/information-map-graph",
|
|
20
|
+
defaultData: [],
|
|
21
|
+
stop: selectedPartners?.loading,
|
|
22
|
+
filters: {
|
|
23
|
+
datastakeId: id,
|
|
24
|
+
sources: selectedPartners?.partners || [],
|
|
25
|
+
coreSubject: "location",
|
|
26
|
+
filterBySources: false,
|
|
27
|
+
metrics: {
|
|
28
|
+
operator: ['operator'],
|
|
29
|
+
government: ['custom', 'governance'],
|
|
30
|
+
trader: ['trade'],
|
|
31
|
+
other: ['civilSociety', 'international'],
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}, [selectedPartners, id]);
|
|
36
|
+
|
|
37
|
+
const { data, loading } = useWidgetFetch({config: defaultFilter});
|
|
38
|
+
|
|
39
|
+
const graphData = useMemo(() => {
|
|
40
|
+
return getStakeholderMappingData({data, locationData, id, options, t, goTo, selectedPartners});
|
|
41
|
+
}, [data, locationData, id, options, t, goTo, selectedPartners]);
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<Widget
|
|
45
|
+
loading={loading}
|
|
46
|
+
title={t("Stakeholder Mapping")}
|
|
47
|
+
className={"with-border-header no-px no-p-body"}
|
|
48
|
+
>
|
|
49
|
+
<div style={{ height: 600 }}>
|
|
50
|
+
<StakeholderMappings data={graphData} t={t} />
|
|
51
|
+
</div>
|
|
52
|
+
</Widget>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export default StakeholderMapping
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { useSummary } from '../hook.js'
|
|
3
|
+
import DashboardLayout from '../../../core/components/Dashboard/DashboardLayout/index.jsx'
|
|
4
|
+
import Header from '../../../core/components/Header/index.jsx'
|
|
5
|
+
import Multiselect from '../../../core/components/Select/MultiSelect/index.jsx'
|
|
6
|
+
import { Select, Spin } from 'antd'
|
|
7
|
+
import MineSiteDetails from './components/MineSiteDetails/index.js'
|
|
8
|
+
import LocationMap from './components/LocationMap/index.js'
|
|
9
|
+
import InformationAvailability from '../components/InformationAvailability/index.js'
|
|
10
|
+
import StakeholderMapping from './components/StakeholderMapping/index.js'
|
|
11
|
+
|
|
12
|
+
const MineSummary = ({
|
|
13
|
+
hasSelect = false,
|
|
14
|
+
loading = false,
|
|
15
|
+
getSingleData = () => {},
|
|
16
|
+
getMultipleData = () => {},
|
|
17
|
+
data = [],
|
|
18
|
+
id = '',
|
|
19
|
+
storageKey = '',
|
|
20
|
+
isPdf = false,
|
|
21
|
+
params = {},
|
|
22
|
+
partners = [],
|
|
23
|
+
selectedPartners = {},
|
|
24
|
+
user = {},
|
|
25
|
+
t = () => {},
|
|
26
|
+
theme = {},
|
|
27
|
+
service,
|
|
28
|
+
options = {},
|
|
29
|
+
goTo = () => {},
|
|
30
|
+
getRedirectLink = () => {},
|
|
31
|
+
goBack = () => {},
|
|
32
|
+
onIdChange = () => {},
|
|
33
|
+
}) => {
|
|
34
|
+
const {
|
|
35
|
+
selectedItem,
|
|
36
|
+
setSelectedItem,
|
|
37
|
+
dataOptions,
|
|
38
|
+
search,
|
|
39
|
+
debouncedSearch,
|
|
40
|
+
onSearch,
|
|
41
|
+
setSearch,
|
|
42
|
+
setDebouncedSearch,
|
|
43
|
+
sourceOptions,
|
|
44
|
+
setSelectedPartners,
|
|
45
|
+
singleItemData,
|
|
46
|
+
loading: loadingData,
|
|
47
|
+
} = useSummary({
|
|
48
|
+
getOne: getSingleData,
|
|
49
|
+
getMultiple: getMultipleData,
|
|
50
|
+
id,
|
|
51
|
+
hasSelect,
|
|
52
|
+
storageKey,
|
|
53
|
+
data,
|
|
54
|
+
isPdf: false,
|
|
55
|
+
params,
|
|
56
|
+
partners,
|
|
57
|
+
selectedPartners,
|
|
58
|
+
user,
|
|
59
|
+
t,
|
|
60
|
+
theme,
|
|
61
|
+
service,
|
|
62
|
+
onIdChange,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<DashboardLayout
|
|
67
|
+
header={
|
|
68
|
+
<Header
|
|
69
|
+
title={t('Mine Summary')}
|
|
70
|
+
className="with-border-header h-w-btn-header no-px-body"
|
|
71
|
+
goBackTo={!hasSelect && goBack}
|
|
72
|
+
addedHeaderFirst
|
|
73
|
+
actionButtons={[
|
|
74
|
+
{
|
|
75
|
+
tooltip: t("Details"),
|
|
76
|
+
icon: "FileEdit",
|
|
77
|
+
onClick: () => {
|
|
78
|
+
goTo(getRedirectLink(`/app/view/production-sites/${params?.id ? params?.id : selectedItem}`));
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
tooltip: t("Find Data"),
|
|
83
|
+
icon: "Search",
|
|
84
|
+
onClick: () => {},
|
|
85
|
+
disabled: true,
|
|
86
|
+
},
|
|
87
|
+
]}
|
|
88
|
+
addedHeader={
|
|
89
|
+
<div className="flex flex-row gap-4" style={{ marginRight: 8 }}>
|
|
90
|
+
<Multiselect
|
|
91
|
+
options={[...sourceOptions]}
|
|
92
|
+
isAvatarGroup
|
|
93
|
+
selectionType="checkbox"
|
|
94
|
+
key={partners?.length}
|
|
95
|
+
canUnselectLast={false}
|
|
96
|
+
onChange={(selected) => {
|
|
97
|
+
setSelectedPartners((prev) => ({
|
|
98
|
+
...prev,
|
|
99
|
+
partners: selected,
|
|
100
|
+
loading: false,
|
|
101
|
+
}));
|
|
102
|
+
}}
|
|
103
|
+
dropDownWidth={200}
|
|
104
|
+
defaultSelected={(partners || []).map((p) => p.id) || []}
|
|
105
|
+
/>
|
|
106
|
+
</div>
|
|
107
|
+
}
|
|
108
|
+
/>
|
|
109
|
+
}
|
|
110
|
+
>
|
|
111
|
+
{hasSelect && (
|
|
112
|
+
<section>
|
|
113
|
+
<Select
|
|
114
|
+
showSearch
|
|
115
|
+
debounceTimeout={300}
|
|
116
|
+
onSearch={onSearch}
|
|
117
|
+
isSingle
|
|
118
|
+
style={{ height: "40px", width: "100%" }}
|
|
119
|
+
value={selectedItem}
|
|
120
|
+
onChange={setSelectedItem}
|
|
121
|
+
options={dataOptions}
|
|
122
|
+
filterOption={false}
|
|
123
|
+
loading={loading}
|
|
124
|
+
notFoundContent={loading ? <Spin size="small" /> : null}
|
|
125
|
+
/>
|
|
126
|
+
</section>
|
|
127
|
+
)}
|
|
128
|
+
<section>
|
|
129
|
+
<MineSiteDetails
|
|
130
|
+
locationData={hasSelect ? singleItemData : data}
|
|
131
|
+
loading={loadingData}
|
|
132
|
+
t={t}
|
|
133
|
+
options={options}
|
|
134
|
+
/>
|
|
135
|
+
<LocationMap
|
|
136
|
+
selectedPartners={selectedPartners}
|
|
137
|
+
t={t}
|
|
138
|
+
params={params}
|
|
139
|
+
locationData={hasSelect ? singleItemData : data}
|
|
140
|
+
loading={loadingData}
|
|
141
|
+
/>
|
|
142
|
+
</section>
|
|
143
|
+
<section>
|
|
144
|
+
<InformationAvailability
|
|
145
|
+
selectedPartners={selectedPartners}
|
|
146
|
+
t={t}
|
|
147
|
+
id={params?.id || selectedItem}
|
|
148
|
+
/>
|
|
149
|
+
</section>
|
|
150
|
+
<section>
|
|
151
|
+
<StakeholderMapping
|
|
152
|
+
selectedPartners={selectedPartners}
|
|
153
|
+
t={t}
|
|
154
|
+
id={params?.id || selectedItem}
|
|
155
|
+
locationData={hasSelect ? singleItemData : data}
|
|
156
|
+
/>
|
|
157
|
+
</section>
|
|
158
|
+
</DashboardLayout>
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export default MineSummary
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const IconNodesConfig = {
|
|
2
|
+
beneficiaries: {
|
|
3
|
+
name: "nashiriki::beneficiaries",
|
|
4
|
+
icon: "CoinsHand",
|
|
5
|
+
order: 3,
|
|
6
|
+
emptyName: "no-beneficiaries",
|
|
7
|
+
},
|
|
8
|
+
boardMembers: {
|
|
9
|
+
name: "nashiriki::board-members",
|
|
10
|
+
icon: "Users",
|
|
11
|
+
order: 1,
|
|
12
|
+
emptyName: "no-board-members",
|
|
13
|
+
},
|
|
14
|
+
management: {
|
|
15
|
+
name: "nashiriki::management",
|
|
16
|
+
icon: "Filters",
|
|
17
|
+
order: 2,
|
|
18
|
+
emptyName: "no-management",
|
|
19
|
+
},
|
|
20
|
+
shareholders: {
|
|
21
|
+
name: "nashiriki::stakeholders",
|
|
22
|
+
icon: "PercentCircle",
|
|
23
|
+
order: 4,
|
|
24
|
+
emptyName: "no-stakeholders",
|
|
25
|
+
},
|
|
26
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { IconNodesConfig } from './config.js';
|
|
2
|
+
|
|
3
|
+
export const getGovernanceData = ({data, operatorData, id, options, t, goTo, selectedPartners}) => {
|
|
4
|
+
const { sources, ...rest } = data;
|
|
5
|
+
|
|
6
|
+
const _data = rest;
|
|
7
|
+
|
|
8
|
+
return {
|
|
9
|
+
id: operatorData?.datastakeId || id,
|
|
10
|
+
name: t(operatorData?.name || ""),
|
|
11
|
+
country: {
|
|
12
|
+
label:
|
|
13
|
+
options?.countries?.find((country) => country.value === operatorData?.country)
|
|
14
|
+
?.label || "",
|
|
15
|
+
value: (operatorData?.country || "").toLowerCase() || "",
|
|
16
|
+
},
|
|
17
|
+
onClick: () => {
|
|
18
|
+
goTo(`/app/view/operators/${operatorData?.datastakeId || id}`);
|
|
19
|
+
},
|
|
20
|
+
totalSources: selectedPartners?.partners?.length || 0,
|
|
21
|
+
|
|
22
|
+
children: Object.keys(_data)?.map((key, index) => {
|
|
23
|
+
return {
|
|
24
|
+
id: key,
|
|
25
|
+
name: t(IconNodesConfig[key]?.name),
|
|
26
|
+
icon: IconNodesConfig[key]?.icon,
|
|
27
|
+
order: IconNodesConfig[key]?.order || index + 1,
|
|
28
|
+
emptyName: t(`${IconNodesConfig[key]?.emptyName}`),
|
|
29
|
+
activeColour: "#b6f5ec",
|
|
30
|
+
iconHoverColor: "#fff",
|
|
31
|
+
hoverColor: "#36cfca",
|
|
32
|
+
content: _data[key].length,
|
|
33
|
+
children: _data[key]?.map((child) => {
|
|
34
|
+
return {
|
|
35
|
+
id: child?.datastakeId || "",
|
|
36
|
+
name: child?.name || "",
|
|
37
|
+
country: {
|
|
38
|
+
label:
|
|
39
|
+
options?.countries?.find(
|
|
40
|
+
(country) => country.value === child?.country,
|
|
41
|
+
)?.label || "",
|
|
42
|
+
value: (child?.country || "").toLowerCase() || "",
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
totalSources: child?.sources || 0,
|
|
46
|
+
tooltipLabel: t("Holding"),
|
|
47
|
+
onClick: () => {
|
|
48
|
+
if (child?.type === "operator") {
|
|
49
|
+
goTo(`/app/operator-summary/${child.datastakeId}`);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
goTo(`/app/view/stakeholders/${child.datastakeId}`);
|
|
54
|
+
},
|
|
55
|
+
value: child?.holding || 0,
|
|
56
|
+
};
|
|
57
|
+
}),
|
|
58
|
+
};
|
|
59
|
+
}),
|
|
60
|
+
};
|
|
61
|
+
}
|