datastake-daf 0.6.750 → 0.6.752
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 +118 -111
- package/dist/pages/index.js +307 -222
- package/dist/utils/index.js +24 -0
- package/package.json +1 -1
- package/src/@daf/core/components/DynamicForm/index.jsx +26 -11
- package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/GenderDistribution/index.js +2 -2
- package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/Identification/hook.js +1 -1
- package/src/@daf/pages/Dashboards/SupplyChain/components/SupplyChainMap/index.js +6 -1
- package/src/@daf/pages/Dashboards/UserDashboard/components/MineSites/helper.js +3 -3
- package/src/@daf/pages/Locations/MineSite/index.jsx +1 -1
- package/src/@daf/pages/Summary/Minesite/components/MineDetailsSection/index.js +51 -0
- package/src/@daf/pages/Summary/Minesite/components/MineSiteDetails/config.js +31 -37
- package/src/@daf/pages/Summary/Minesite/components/MineSiteDetails/index.js +4 -16
- package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/config.js +6 -6
- package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/helper.js +13 -16
- package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/index.js +3 -3
- package/src/@daf/pages/Summary/Minesite/index.jsx +15 -19
- package/src/@daf/pages/Summary/Operator/components/Governance/config.js +4 -4
- package/src/@daf/pages/Summary/Operator/components/Governance/helper.js +8 -11
- package/src/@daf/pages/Summary/Operator/components/Governance/index.js +9 -3
- package/src/@daf/pages/Summary/Operator/index.jsx +6 -4
- package/src/@daf/pages/Summary/components/InformationAvailability/components/Contributions/index.js +16 -5
- package/src/@daf/pages/Summary/components/InformationAvailability/components/InformationCompleteness/index.js +2 -3
- package/src/@daf/pages/Summary/components/InformationAvailability/index.js +7 -4
- package/src/@daf/pages/Summary/hook.js +3 -3
- package/src/constants/locales/en/translation.js +8 -0
- package/src/constants/locales/fr/translation.js +8 -0
- package/src/constants/locales/sp/translation.js +8 -0
package/dist/utils/index.js
CHANGED
|
@@ -7677,6 +7677,14 @@ function getRedirectPath(user, fallback = '', app, isDatastake) {
|
|
|
7677
7677
|
}
|
|
7678
7678
|
|
|
7679
7679
|
const en = {
|
|
7680
|
+
"no-board-members": "No board members identified",
|
|
7681
|
+
"no-management": "No management identified",
|
|
7682
|
+
"no-beneficiaries": "No beneficiaries identified",
|
|
7683
|
+
"no-stakeholders": "No stakeholders identified",
|
|
7684
|
+
"no-operators": "No operators identified",
|
|
7685
|
+
"no-traders": "No traders identified",
|
|
7686
|
+
"no-government": "No government identified",
|
|
7687
|
+
"no-other": "No other identified",
|
|
7680
7688
|
"No planning required": "No planning required",
|
|
7681
7689
|
"No evaluation required": "No evaluation required",
|
|
7682
7690
|
"No improvement required": "No improvement required",
|
|
@@ -8880,6 +8888,14 @@ const en = {
|
|
|
8880
8888
|
};
|
|
8881
8889
|
|
|
8882
8890
|
const fr = {
|
|
8891
|
+
"no-board-members": "Aucun membre du conseil d'administration identifié",
|
|
8892
|
+
"no-management": "Aucun management identifié",
|
|
8893
|
+
"no-beneficiaries": "Aucun bénéficiaire identifié",
|
|
8894
|
+
"no-stakeholders": "Aucun stakeholder identifié",
|
|
8895
|
+
"no-operators": "Aucun opérateur identifié",
|
|
8896
|
+
"no-traders": "Aucun négociant identifié",
|
|
8897
|
+
"no-government": "Aucun gouvernement identifié",
|
|
8898
|
+
"no-other": "Aucun autre identifié",
|
|
8883
8899
|
"No planning required": "Pas de planification requise",
|
|
8884
8900
|
"No evaluation required": "Pas d'évaluation requise",
|
|
8885
8901
|
"No improvement required": "Pas d'amélioration requise",
|
|
@@ -10716,6 +10732,14 @@ const fr = {
|
|
|
10716
10732
|
};
|
|
10717
10733
|
|
|
10718
10734
|
const sp = {
|
|
10735
|
+
"no-board-members": "No hay miembros del consejo identificados",
|
|
10736
|
+
"no-management": "No hay gerencia identificados",
|
|
10737
|
+
"no-beneficiaries": "No hay beneficiarios identificados",
|
|
10738
|
+
"no-stakeholders": "No hay partes interesadas identificadas",
|
|
10739
|
+
"no-operators": "No hay operadores identificados",
|
|
10740
|
+
"no-traders": "No hay comerciantes identificados",
|
|
10741
|
+
"no-government": "No hay gobierno identificado",
|
|
10742
|
+
"no-other": "No hay otros identificados",
|
|
10719
10743
|
"No planning required": "No se requiere planeación",
|
|
10720
10744
|
"No evaluation required": "No se requiere evaluación",
|
|
10721
10745
|
"No improvement required": "No se requiere mejora",
|
package/package.json
CHANGED
|
@@ -168,19 +168,29 @@ export default function DynamicForm({
|
|
|
168
168
|
}
|
|
169
169
|
}, [data]);
|
|
170
170
|
|
|
171
|
-
// Initialize default values for hidden fields
|
|
171
|
+
// Initialize default values for hidden and disabled fields
|
|
172
172
|
useEffect(() => {
|
|
173
173
|
if (Object.keys(form).length > 0) {
|
|
174
174
|
const updatedValues = { ...values };
|
|
175
175
|
let hasChanges = false;
|
|
176
|
+
const isEditMode = data && (data.id || data._id);
|
|
176
177
|
|
|
177
|
-
// Process all form fields to set default values for hidden fields
|
|
178
|
+
// Process all form fields to set default values for hidden and disabled fields
|
|
178
179
|
Object.keys(form).forEach(formKey => {
|
|
179
180
|
Object.keys(form[formKey]).forEach(fieldKey => {
|
|
180
181
|
const field = form[formKey][fieldKey];
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
182
|
+
const fieldId = field.dataId || fieldKey;
|
|
183
|
+
|
|
184
|
+
// Check if field is disabled
|
|
185
|
+
const isDisabled = (field?.meta?.disableEdit && typeof field?.meta?.disableEdit === 'object')
|
|
186
|
+
? isModal
|
|
187
|
+
? field.meta.disableEdit.create || field.meta.disableEdit.modal || (field?.meta?.disableEdit?.edit && isEditMode)
|
|
188
|
+
: field.meta.disableEdit.create || field.meta.disableEdit.drawer || (field?.meta?.disableEdit?.edit && isEditMode)
|
|
189
|
+
: field?.meta?.disableEdit;
|
|
190
|
+
|
|
191
|
+
// Set default value for hidden fields or disabled fields with default values
|
|
192
|
+
if (field?.meta?.defaultValue !== undefined && !propHasValue(updatedValues[fieldId])) {
|
|
193
|
+
if (field?.meta?.hidden === true || isDisabled) {
|
|
184
194
|
updatedValues[fieldId] = field.meta.defaultValue;
|
|
185
195
|
hasChanges = true;
|
|
186
196
|
}
|
|
@@ -194,7 +204,7 @@ export default function DynamicForm({
|
|
|
194
204
|
MainForm.setFieldsValue(updatedValues);
|
|
195
205
|
}
|
|
196
206
|
}
|
|
197
|
-
}, [form]);
|
|
207
|
+
}, [form, data, isModal]);
|
|
198
208
|
|
|
199
209
|
const setSelectedForm = (id) => {
|
|
200
210
|
setForms(Forms.map(form => {
|
|
@@ -295,11 +305,16 @@ export default function DynamicForm({
|
|
|
295
305
|
}
|
|
296
306
|
value = fileList;
|
|
297
307
|
}
|
|
298
|
-
// Handle default values for hidden fields
|
|
299
|
-
if (input?.meta?.
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
308
|
+
// Handle default values for hidden fields and disabled fields
|
|
309
|
+
if (input?.meta?.defaultValue !== undefined && !propHasValue(value)) {
|
|
310
|
+
const isFieldHidden = input?.meta?.hidden === true;
|
|
311
|
+
const isFieldDisabled = props.disabled || isDisabled;
|
|
312
|
+
|
|
313
|
+
if (isFieldHidden || isFieldDisabled) {
|
|
314
|
+
value = input.meta.defaultValue;
|
|
315
|
+
if (typeof path === 'string') {
|
|
316
|
+
dot.str(path, value, values);
|
|
317
|
+
}
|
|
303
318
|
}
|
|
304
319
|
}
|
|
305
320
|
|
|
@@ -50,7 +50,7 @@ function GenderDistribution({
|
|
|
50
50
|
items: [
|
|
51
51
|
{
|
|
52
52
|
label:
|
|
53
|
-
options?.optionPositionSupplyChain
|
|
53
|
+
options?.optionPositionSupplyChain?.find((o) => {
|
|
54
54
|
return o.value === item.key;
|
|
55
55
|
}).label || item.key,
|
|
56
56
|
value: data[item.key] || 0,
|
|
@@ -68,7 +68,7 @@ function GenderDistribution({
|
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
const _config = config
|
|
71
|
+
const _config = config?.find((c) => c.key === item.key);
|
|
72
72
|
|
|
73
73
|
if (_config) {
|
|
74
74
|
return renderTooltipJsx({
|
|
@@ -60,7 +60,7 @@ export function useIdentification({ data, theme = {}, options = {} }) {
|
|
|
60
60
|
title: "Products",
|
|
61
61
|
items: values.map((val) => ({
|
|
62
62
|
label:
|
|
63
|
-
options
|
|
63
|
+
options?.minerals?.find(
|
|
64
64
|
(mineral) => mineral.value === val.typeOfProduct,
|
|
65
65
|
)?.label || val.typeOfProduct,
|
|
66
66
|
color: colors[
|
|
@@ -52,7 +52,12 @@ function SupplyChainMap({selectedSources = {}, t = () => {}, goTo = () => {}, op
|
|
|
52
52
|
}}
|
|
53
53
|
link
|
|
54
54
|
onClickLink={(data) => {
|
|
55
|
-
|
|
55
|
+
const locationTypes = ['mineSite', 'village'];
|
|
56
|
+
if (locationTypes.includes(data.type)) {
|
|
57
|
+
goTo(getRedirectLink(`/app/view/locations/${data.datastakeId}`));
|
|
58
|
+
} else {
|
|
59
|
+
goTo(getRedirectLink(`/app/view/stakeholders/${data.datastakeId}`));
|
|
60
|
+
}
|
|
56
61
|
}}
|
|
57
62
|
/>
|
|
58
63
|
</Widget>
|
|
@@ -108,7 +108,7 @@ export const onClickLink = (data, getRedirectLink, activeTab, goTo, user) => {
|
|
|
108
108
|
if (activeTab === "stakeholder") {
|
|
109
109
|
switch (data.stakeholderType) {
|
|
110
110
|
case "operator":
|
|
111
|
-
return goTo(getLink(`/app/summary
|
|
111
|
+
return goTo(getLink(`/app/operator-summary/${data?.datastakeId}`));
|
|
112
112
|
case "worker":
|
|
113
113
|
return goTo(getLink(`/app/view/workers/${data?.datastakeId}`));
|
|
114
114
|
default:
|
|
@@ -119,7 +119,7 @@ export const onClickLink = (data, getRedirectLink, activeTab, goTo, user) => {
|
|
|
119
119
|
if (activeTab === "event") {
|
|
120
120
|
switch (data.category) {
|
|
121
121
|
case "mineSite":
|
|
122
|
-
return goTo(getLink(`/app/summary
|
|
122
|
+
return goTo(getLink(`/app/mine-summary/${data?.datastakeId}`));
|
|
123
123
|
default:
|
|
124
124
|
return goTo(getLink(`/app/view/locations/${data?.datastakeId}`));
|
|
125
125
|
}
|
|
@@ -129,7 +129,7 @@ export const onClickLink = (data, getRedirectLink, activeTab, goTo, user) => {
|
|
|
129
129
|
case "mineSite": {
|
|
130
130
|
const isOwnData = user?.company?.id === data?.authorId;
|
|
131
131
|
return goTo(
|
|
132
|
-
`/app/summary
|
|
132
|
+
`/app/mine-summary/${data?.datastakeId}${
|
|
133
133
|
!isOwnData ? `?sourceId=${data?.authorId}` : ""
|
|
134
134
|
}`,
|
|
135
135
|
);
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React, { useMemo } from 'react'
|
|
2
|
+
import MineSiteDetails from '../MineSiteDetails/index.js'
|
|
3
|
+
import LocationMap from '../LocationMap/index.js'
|
|
4
|
+
import { useWidgetFetch } from '../../../../../hooks/useWidgetFetch.js';
|
|
5
|
+
|
|
6
|
+
const MineDetailsSection = ({
|
|
7
|
+
locationData = {},
|
|
8
|
+
loading = false,
|
|
9
|
+
t = () => {},
|
|
10
|
+
options = {},
|
|
11
|
+
selectedPartners = {},
|
|
12
|
+
params = {},
|
|
13
|
+
}) => {
|
|
14
|
+
const defaultFetchConfig = useMemo(
|
|
15
|
+
() => ({
|
|
16
|
+
basepath: "analytics",
|
|
17
|
+
url: '/widgets/mine-site-details',
|
|
18
|
+
defaultData: [],
|
|
19
|
+
stop: selectedPartners?.loading,
|
|
20
|
+
filters: {
|
|
21
|
+
datastakeId: locationData?.datastakeId,
|
|
22
|
+
sources: selectedPartners?.partners || [],
|
|
23
|
+
metrics: ['extractionMethod', 'products', 'totalNumberOfWorkers', 'gps', 'administrativeLevel1', 'administrativeLevel2'],
|
|
24
|
+
filterBySources: false,
|
|
25
|
+
},
|
|
26
|
+
}),
|
|
27
|
+
[selectedPartners, locationData],
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const { data, loading: loadingData } = useWidgetFetch({config: defaultFetchConfig});
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<section>
|
|
34
|
+
<MineSiteDetails
|
|
35
|
+
locationData={data}
|
|
36
|
+
loading={loading || loadingData}
|
|
37
|
+
t={t}
|
|
38
|
+
options={options}
|
|
39
|
+
/>
|
|
40
|
+
<LocationMap
|
|
41
|
+
selectedPartners={selectedPartners}
|
|
42
|
+
t={t}
|
|
43
|
+
params={params}
|
|
44
|
+
locationData={data}
|
|
45
|
+
loading={loading || loadingData}
|
|
46
|
+
/>
|
|
47
|
+
</section>
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export default MineDetailsSection
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Tag } from "antd";
|
|
2
|
+
import { Tag, Tooltip } from "antd";
|
|
3
3
|
import { getTagColor } from "../../../../../utils/productTag.js";
|
|
4
4
|
|
|
5
5
|
export function getKeyIndicatorsConfig({ t, data }) {
|
|
@@ -7,26 +7,20 @@ export function getKeyIndicatorsConfig({ t, data }) {
|
|
|
7
7
|
{
|
|
8
8
|
label: t("Extraction Methods"),
|
|
9
9
|
render: () => {
|
|
10
|
-
|
|
10
|
+
const validExtractionPoints = data?.extractionPoints?.filter(Boolean) || [];
|
|
11
|
+
if (validExtractionPoints?.length === 0 || !validExtractionPoints) {
|
|
11
12
|
return "-";
|
|
12
13
|
}
|
|
13
14
|
return (
|
|
14
|
-
<div
|
|
15
|
-
|
|
16
|
-
display: "flex",
|
|
17
|
-
flexWrap: "wrap",
|
|
18
|
-
}}
|
|
19
|
-
>
|
|
20
|
-
{data?.extractionPoints?.map((method) => {
|
|
15
|
+
<div>
|
|
16
|
+
{validExtractionPoints?.map((method, index) => {
|
|
21
17
|
return (
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
>
|
|
28
|
-
{method}
|
|
29
|
-
</Tag>
|
|
18
|
+
<React.Fragment key={method}>
|
|
19
|
+
<Tooltip title={method}>
|
|
20
|
+
<span style={{ fontWeight: "normal"}}>{method}</span>
|
|
21
|
+
</Tooltip>
|
|
22
|
+
{index < validExtractionPoints.length - 1 && ", "}
|
|
23
|
+
</React.Fragment>
|
|
30
24
|
);
|
|
31
25
|
})}
|
|
32
26
|
</div>
|
|
@@ -36,28 +30,28 @@ export function getKeyIndicatorsConfig({ t, data }) {
|
|
|
36
30
|
{
|
|
37
31
|
label: t("Products"),
|
|
38
32
|
render: () => {
|
|
39
|
-
|
|
33
|
+
const validProducts = data?.products?.filter(Boolean) || [];
|
|
34
|
+
if (validProducts?.length === 0 || !validProducts) {
|
|
40
35
|
return "-";
|
|
41
36
|
}
|
|
42
|
-
|
|
37
|
+
|
|
43
38
|
return (
|
|
44
|
-
<div
|
|
45
|
-
|
|
46
|
-
display: "flex",
|
|
47
|
-
flexWrap: "wrap",
|
|
48
|
-
}}
|
|
49
|
-
>
|
|
50
|
-
{data?.productsOfLocation?.map((product) => {
|
|
39
|
+
<div>
|
|
40
|
+
{validProducts?.map((product, index) => {
|
|
51
41
|
return (
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
42
|
+
<React.Fragment key={product}>
|
|
43
|
+
<Tooltip title={product}>
|
|
44
|
+
<span
|
|
45
|
+
style={{
|
|
46
|
+
fontWeight: "normal",
|
|
47
|
+
color: getTagColor(product)
|
|
48
|
+
}}
|
|
49
|
+
>
|
|
50
|
+
{product}
|
|
51
|
+
</span>
|
|
52
|
+
</Tooltip>
|
|
53
|
+
{index < validProducts.length - 1 && ", "}
|
|
54
|
+
</React.Fragment>
|
|
61
55
|
);
|
|
62
56
|
})}
|
|
63
57
|
</div>
|
|
@@ -68,9 +62,9 @@ export function getKeyIndicatorsConfig({ t, data }) {
|
|
|
68
62
|
label: t("Number of Workers on Site"),
|
|
69
63
|
render: () => {
|
|
70
64
|
if (!data.workers) {
|
|
71
|
-
return
|
|
65
|
+
return 0;
|
|
72
66
|
}
|
|
73
|
-
return data.workers
|
|
67
|
+
return <Tooltip title={data.workers}>{data.workers}</Tooltip>;
|
|
74
68
|
},
|
|
75
69
|
},
|
|
76
70
|
];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useMemo } from 'react'
|
|
2
2
|
import { getKeyIndicatorsConfig } from './config.js'
|
|
3
3
|
import KeyIndicatorsWidget from '../../../../../core/components/Dashboard/Widget/KeyIndicators/index.jsx'
|
|
4
|
+
import { findOptions } from '../../../../../../helpers/StringHelper.js';
|
|
4
5
|
|
|
5
6
|
const MineSiteDetails = ({
|
|
6
7
|
locationData = {},
|
|
@@ -10,23 +11,10 @@ const MineSiteDetails = ({
|
|
|
10
11
|
}) => {
|
|
11
12
|
|
|
12
13
|
const data = useMemo(() => {
|
|
14
|
+
const products = locationData?.products?.map((product) => product.typeOfProduct);
|
|
13
15
|
return {
|
|
14
|
-
extractionPoints: (locationData?.extractionMethod
|
|
15
|
-
|
|
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
|
-
}),
|
|
16
|
+
extractionPoints: findOptions(locationData?.extractionMethod, options?.extractionMethodsOptions),
|
|
17
|
+
products: findOptions(products, options?.mineralOptions),
|
|
30
18
|
workers: locationData?.totalNumberOfWorkers || 0,
|
|
31
19
|
};
|
|
32
20
|
}, [locationData, options]);
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
export const IconNodesConfig = {
|
|
2
|
-
|
|
3
|
-
name: "
|
|
2
|
+
operator: {
|
|
3
|
+
name: "Operators",
|
|
4
4
|
icon: "Worker",
|
|
5
5
|
order: 1,
|
|
6
6
|
emptyName: "no-operators",
|
|
7
7
|
},
|
|
8
|
-
|
|
9
|
-
name: "
|
|
8
|
+
trader: {
|
|
9
|
+
name: "Traders",
|
|
10
10
|
icon: "Handshake",
|
|
11
11
|
order: 2,
|
|
12
12
|
emptyName: "no-traders",
|
|
13
13
|
},
|
|
14
14
|
government: {
|
|
15
|
-
name: "
|
|
15
|
+
name: "Government",
|
|
16
16
|
icon: "KYC",
|
|
17
17
|
order: 3,
|
|
18
18
|
emptyName: "no-government",
|
|
19
19
|
},
|
|
20
20
|
other: {
|
|
21
|
-
name: "
|
|
21
|
+
name: "Other",
|
|
22
22
|
icon: "CivilSociety",
|
|
23
23
|
order: 4,
|
|
24
24
|
emptyName: "no-other",
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { IconNodesConfig } from './config.js';
|
|
2
|
+
import { findOptions } from '../../../../../../helpers/StringHelper.js';
|
|
2
3
|
|
|
3
|
-
export const getStakeholderMappingData = ({data, locationData, id, options, t, goTo, selectedPartners}) => {
|
|
4
|
+
export const getStakeholderMappingData = ({data, locationData, id, options, t, goTo, selectedPartners, mainSubject}) => {
|
|
4
5
|
const _data = data;
|
|
6
|
+
const mainSubjectData = _data?.[mainSubject];
|
|
5
7
|
|
|
6
8
|
return {
|
|
7
|
-
id:
|
|
8
|
-
name:
|
|
9
|
+
id: mainSubjectData?.datastakeId || "",
|
|
10
|
+
name: mainSubjectData?.name || "",
|
|
9
11
|
country: {
|
|
10
|
-
label:
|
|
11
|
-
|
|
12
|
-
?.label || "",
|
|
13
|
-
value: (locationData?.country || "").toLowerCase() || "",
|
|
12
|
+
label: findOptions(mainSubjectData?.country, options?.countries) || "",
|
|
13
|
+
value: (mainSubjectData?.country || "").toLowerCase() || "",
|
|
14
14
|
},
|
|
15
|
-
onClick: () => goTo(`/app/view/production-sites/${
|
|
15
|
+
onClick: () => goTo(`/app/view/production-sites/${mainSubjectData?.datastakeId}`),
|
|
16
16
|
totalSources: selectedPartners?.partners?.length || 0,
|
|
17
17
|
backgroundColor: "#FFD6E7",
|
|
18
18
|
iconColor: "#C41D7F",
|
|
19
19
|
|
|
20
20
|
icon: "DashboardLocations",
|
|
21
|
-
children: Object.keys(_data)?.map((key, index) => {
|
|
21
|
+
children: Object.keys(_data)?.filter(key => (key !== mainSubject))?.map((key, index) => {
|
|
22
22
|
return {
|
|
23
23
|
id: key,
|
|
24
24
|
name: t(IconNodesConfig[key]?.name),
|
|
@@ -29,17 +29,14 @@ export const getStakeholderMappingData = ({data, locationData, id, options, t, g
|
|
|
29
29
|
hoverColor: "#36cfca",
|
|
30
30
|
content: _data[key].length,
|
|
31
31
|
emptyName: IconNodesConfig[key]?.emptyName
|
|
32
|
-
? t(
|
|
32
|
+
? t(`${IconNodesConfig[key]?.emptyName}`)
|
|
33
33
|
: undefined,
|
|
34
34
|
children: (_data[key] || [])?.map((child) => {
|
|
35
35
|
return {
|
|
36
36
|
id: child?.datastakeId || "",
|
|
37
37
|
name: child?.name || "",
|
|
38
38
|
country: {
|
|
39
|
-
label:
|
|
40
|
-
options?.countries?.find(
|
|
41
|
-
(country) => country.value === child?.country,
|
|
42
|
-
)?.label || "",
|
|
39
|
+
label: findOptions(child?.country, options?.countries) || "",
|
|
43
40
|
value: child?.country ? child?.country?.toLowerCase() : "",
|
|
44
41
|
},
|
|
45
42
|
|
|
@@ -53,8 +50,8 @@ export const getStakeholderMappingData = ({data, locationData, id, options, t, g
|
|
|
53
50
|
goTo(`/app/view/stakeholders/${child.datastakeId}`);
|
|
54
51
|
},
|
|
55
52
|
totalSources: child?.sources || 0,
|
|
56
|
-
tooltipHeader: t("
|
|
57
|
-
tooltipLabel: t("
|
|
53
|
+
tooltipHeader: t("link-details"),
|
|
54
|
+
tooltipLabel: t("sources-reporting"),
|
|
58
55
|
value: child?.sources || 0,
|
|
59
56
|
};
|
|
60
57
|
}),
|
|
@@ -25,8 +25,8 @@ const StakeholderMapping = ({
|
|
|
25
25
|
coreSubject: "location",
|
|
26
26
|
filterBySources: false,
|
|
27
27
|
metrics: {
|
|
28
|
-
operator: ['operator'],
|
|
29
|
-
government: ['custom', 'governance'],
|
|
28
|
+
operator: ['operator', 'operator.clientLocation'],
|
|
29
|
+
government: ['custom.stakeholderId', 'governance'],
|
|
30
30
|
trader: ['trade'],
|
|
31
31
|
other: ['civilSociety', 'international'],
|
|
32
32
|
}
|
|
@@ -37,7 +37,7 @@ const StakeholderMapping = ({
|
|
|
37
37
|
const { data, loading } = useWidgetFetch({config: defaultFilter});
|
|
38
38
|
|
|
39
39
|
const graphData = useMemo(() => {
|
|
40
|
-
return getStakeholderMappingData({data, locationData, id, options, t, goTo, selectedPartners});
|
|
40
|
+
return getStakeholderMappingData({data, locationData, id, options, t, goTo, selectedPartners, mainSubject: "mine"});
|
|
41
41
|
}, [data, locationData, id, options, t, goTo, selectedPartners]);
|
|
42
42
|
|
|
43
43
|
return (
|
|
@@ -4,10 +4,9 @@ import DashboardLayout from '../../../core/components/Dashboard/DashboardLayout/
|
|
|
4
4
|
import Header from '../../../core/components/Header/index.jsx'
|
|
5
5
|
import Multiselect from '../../../core/components/Select/MultiSelect/index.jsx'
|
|
6
6
|
import { Select, Spin } from 'antd'
|
|
7
|
-
import MineSiteDetails from './components/MineSiteDetails/index.js'
|
|
8
|
-
import LocationMap from './components/LocationMap/index.js'
|
|
9
7
|
import InformationAvailability from '../components/InformationAvailability/index.js'
|
|
10
8
|
import StakeholderMapping from './components/StakeholderMapping/index.js'
|
|
9
|
+
import MineDetailsSection from './components/MineDetailsSection/index.js'
|
|
11
10
|
|
|
12
11
|
const MineSummary = ({
|
|
13
12
|
hasSelect = false,
|
|
@@ -66,9 +65,10 @@ const MineSummary = ({
|
|
|
66
65
|
<DashboardLayout
|
|
67
66
|
header={
|
|
68
67
|
<Header
|
|
69
|
-
title={t(
|
|
68
|
+
title={hasSelect ? t("Mine Review") : (singleItemData?.name || "") + " " + t("Summary")}
|
|
70
69
|
className="with-border-header h-w-btn-header no-px-body"
|
|
71
70
|
goBackTo={!hasSelect && goBack}
|
|
71
|
+
loading={loading}
|
|
72
72
|
addedHeaderFirst
|
|
73
73
|
actionButtons={[
|
|
74
74
|
{
|
|
@@ -125,26 +125,20 @@ const MineSummary = ({
|
|
|
125
125
|
/>
|
|
126
126
|
</section>
|
|
127
127
|
)}
|
|
128
|
-
<
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
selectedPartners={selectedPartners}
|
|
137
|
-
t={t}
|
|
138
|
-
params={params}
|
|
139
|
-
locationData={hasSelect ? singleItemData : data}
|
|
140
|
-
loading={loadingData}
|
|
141
|
-
/>
|
|
142
|
-
</section>
|
|
128
|
+
<MineDetailsSection
|
|
129
|
+
locationData={singleItemData}
|
|
130
|
+
loading={loadingData}
|
|
131
|
+
t={t}
|
|
132
|
+
options={options}
|
|
133
|
+
selectedPartners={selectedPartners}
|
|
134
|
+
params={params}
|
|
135
|
+
/>
|
|
143
136
|
<section>
|
|
144
137
|
<InformationAvailability
|
|
145
138
|
selectedPartners={selectedPartners}
|
|
146
139
|
t={t}
|
|
147
140
|
id={params?.id || selectedItem}
|
|
141
|
+
partners={partners}
|
|
148
142
|
/>
|
|
149
143
|
</section>
|
|
150
144
|
<section>
|
|
@@ -152,7 +146,9 @@ const MineSummary = ({
|
|
|
152
146
|
selectedPartners={selectedPartners}
|
|
153
147
|
t={t}
|
|
154
148
|
id={params?.id || selectedItem}
|
|
155
|
-
locationData={
|
|
149
|
+
locationData={singleItemData}
|
|
150
|
+
goTo={goTo}
|
|
151
|
+
options={options}
|
|
156
152
|
/>
|
|
157
153
|
</section>
|
|
158
154
|
</DashboardLayout>
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
export const IconNodesConfig = {
|
|
2
2
|
beneficiaries: {
|
|
3
|
-
name: "
|
|
3
|
+
name: "Beneficiaries",
|
|
4
4
|
icon: "CoinsHand",
|
|
5
5
|
order: 3,
|
|
6
6
|
emptyName: "no-beneficiaries",
|
|
7
7
|
},
|
|
8
8
|
boardMembers: {
|
|
9
|
-
name: "
|
|
9
|
+
name: "Board Members",
|
|
10
10
|
icon: "Users",
|
|
11
11
|
order: 1,
|
|
12
12
|
emptyName: "no-board-members",
|
|
13
13
|
},
|
|
14
14
|
management: {
|
|
15
|
-
name: "
|
|
15
|
+
name: "Management",
|
|
16
16
|
icon: "Filters",
|
|
17
17
|
order: 2,
|
|
18
18
|
emptyName: "no-management",
|
|
19
19
|
},
|
|
20
20
|
shareholders: {
|
|
21
|
-
name: "
|
|
21
|
+
name: "Stakeholders",
|
|
22
22
|
icon: "PercentCircle",
|
|
23
23
|
order: 4,
|
|
24
24
|
emptyName: "no-stakeholders",
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { IconNodesConfig } from './config.js';
|
|
2
|
+
import { findOptions } from '../../../../../../helpers/StringHelper.js';
|
|
2
3
|
|
|
3
|
-
export const getGovernanceData = ({data, operatorData, id, options, t, goTo, selectedPartners}) => {
|
|
4
|
+
export const getGovernanceData = ({data, operatorData, id, options, t, goTo, selectedPartners, mainSubject}) => {
|
|
4
5
|
const { sources, ...rest } = data;
|
|
5
6
|
|
|
6
7
|
const _data = rest;
|
|
7
8
|
|
|
9
|
+
const mainSubjectData = _data?.[mainSubject];
|
|
8
10
|
return {
|
|
9
|
-
id:
|
|
10
|
-
name:
|
|
11
|
+
id: mainSubjectData?.datastakeId || id,
|
|
12
|
+
name: mainSubjectData?.name || "",
|
|
11
13
|
country: {
|
|
12
|
-
label:
|
|
13
|
-
options?.countries?.find((country) => country.value === operatorData?.country)
|
|
14
|
-
?.label || "",
|
|
14
|
+
label: findOptions(mainSubjectData?.country, options?.countries) || "",
|
|
15
15
|
value: (operatorData?.country || "").toLowerCase() || "",
|
|
16
16
|
},
|
|
17
17
|
onClick: () => {
|
|
@@ -19,7 +19,7 @@ export const getGovernanceData = ({data, operatorData, id, options, t, goTo, sel
|
|
|
19
19
|
},
|
|
20
20
|
totalSources: selectedPartners?.partners?.length || 0,
|
|
21
21
|
|
|
22
|
-
children: Object.keys(_data)?.map((key, index) => {
|
|
22
|
+
children: Object.keys(_data || {})?.filter(key => (key !== mainSubject))?.map((key, index) => {
|
|
23
23
|
return {
|
|
24
24
|
id: key,
|
|
25
25
|
name: t(IconNodesConfig[key]?.name),
|
|
@@ -35,10 +35,7 @@ export const getGovernanceData = ({data, operatorData, id, options, t, goTo, sel
|
|
|
35
35
|
id: child?.datastakeId || "",
|
|
36
36
|
name: child?.name || "",
|
|
37
37
|
country: {
|
|
38
|
-
label:
|
|
39
|
-
options?.countries?.find(
|
|
40
|
-
(country) => country.value === child?.country,
|
|
41
|
-
)?.label || "",
|
|
38
|
+
label: findOptions(child?.country, options?.countries) || "",
|
|
42
39
|
value: (child?.country || "").toLowerCase() || "",
|
|
43
40
|
},
|
|
44
41
|
|