datastake-daf 0.6.750 → 0.6.751
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 +70 -70
- package/dist/pages/index.js +286 -211
- package/dist/utils/index.js +24 -0
- package/package.json +1 -1
- 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/style/datastake/mapbox-gl.css +0 -330
package/dist/pages/index.js
CHANGED
|
@@ -10323,7 +10323,12 @@ function SupplyChainMap({
|
|
|
10323
10323
|
},
|
|
10324
10324
|
link: true,
|
|
10325
10325
|
onClickLink: data => {
|
|
10326
|
-
|
|
10326
|
+
const locationTypes = ['mineSite', 'village'];
|
|
10327
|
+
if (locationTypes.includes(data.type)) {
|
|
10328
|
+
goTo(getRedirectLink(`/app/view/locations/${data.datastakeId}`));
|
|
10329
|
+
} else {
|
|
10330
|
+
goTo(getRedirectLink(`/app/view/stakeholders/${data.datastakeId}`));
|
|
10331
|
+
}
|
|
10327
10332
|
}
|
|
10328
10333
|
})
|
|
10329
10334
|
});
|
|
@@ -12152,7 +12157,7 @@ function useIdentification({
|
|
|
12152
12157
|
return {
|
|
12153
12158
|
title: "Products",
|
|
12154
12159
|
items: values.map(val => ({
|
|
12155
|
-
label: options
|
|
12160
|
+
label: options?.minerals?.find(mineral => mineral.value === val.typeOfProduct)?.label || val.typeOfProduct,
|
|
12156
12161
|
color: colors[allSeenProducts.indexOf(val.typeOfProduct) % colors.length],
|
|
12157
12162
|
value: val.value.toLocaleString()
|
|
12158
12163
|
}))
|
|
@@ -12807,7 +12812,7 @@ function GenderDistribution({
|
|
|
12807
12812
|
return renderTooltipJsx({
|
|
12808
12813
|
title: t("Role"),
|
|
12809
12814
|
items: [{
|
|
12810
|
-
label: options?.optionPositionSupplyChain
|
|
12815
|
+
label: options?.optionPositionSupplyChain?.find(o => {
|
|
12811
12816
|
return o.value === item.key;
|
|
12812
12817
|
}).label || item.key,
|
|
12813
12818
|
value: data[item.key] || 0
|
|
@@ -12823,7 +12828,7 @@ function GenderDistribution({
|
|
|
12823
12828
|
}))
|
|
12824
12829
|
});
|
|
12825
12830
|
}
|
|
12826
|
-
const _config = config
|
|
12831
|
+
const _config = config?.find(c => c.key === item.key);
|
|
12827
12832
|
if (_config) {
|
|
12828
12833
|
return renderTooltipJsx({
|
|
12829
12834
|
title: t("Gender"),
|
|
@@ -13387,7 +13392,7 @@ const onClickLink = (data, getRedirectLink, activeTab, goTo, user) => {
|
|
|
13387
13392
|
if (activeTab === "stakeholder") {
|
|
13388
13393
|
switch (data.stakeholderType) {
|
|
13389
13394
|
case "operator":
|
|
13390
|
-
return goTo(getLink(`/app/summary
|
|
13395
|
+
return goTo(getLink(`/app/operator-summary/${data?.datastakeId}`));
|
|
13391
13396
|
case "worker":
|
|
13392
13397
|
return goTo(getLink(`/app/view/workers/${data?.datastakeId}`));
|
|
13393
13398
|
default:
|
|
@@ -13397,7 +13402,7 @@ const onClickLink = (data, getRedirectLink, activeTab, goTo, user) => {
|
|
|
13397
13402
|
if (activeTab === "event") {
|
|
13398
13403
|
switch (data.category) {
|
|
13399
13404
|
case "mineSite":
|
|
13400
|
-
return goTo(getLink(`/app/summary
|
|
13405
|
+
return goTo(getLink(`/app/mine-summary/${data?.datastakeId}`));
|
|
13401
13406
|
default:
|
|
13402
13407
|
return goTo(getLink(`/app/view/locations/${data?.datastakeId}`));
|
|
13403
13408
|
}
|
|
@@ -13406,7 +13411,7 @@ const onClickLink = (data, getRedirectLink, activeTab, goTo, user) => {
|
|
|
13406
13411
|
case "mineSite":
|
|
13407
13412
|
{
|
|
13408
13413
|
const isOwnData = user?.company?.id === data?.authorId;
|
|
13409
|
-
return goTo(`/app/summary
|
|
13414
|
+
return goTo(`/app/mine-summary/${data?.datastakeId}${!isOwnData ? `?sourceId=${data?.authorId}` : ""}`);
|
|
13410
13415
|
}
|
|
13411
13416
|
case "area":
|
|
13412
13417
|
return goTo(getLink(`/app/view/conflict-areas/${data?.datastakeId}`));
|
|
@@ -35045,7 +35050,7 @@ const ProductionSitesTable = ({
|
|
|
35045
35050
|
goTo: goTo,
|
|
35046
35051
|
defaultActiveTab: "own",
|
|
35047
35052
|
columns: columns,
|
|
35048
|
-
data: data,
|
|
35053
|
+
data: data?.data,
|
|
35049
35054
|
checkboxConfig: checkboxConfig,
|
|
35050
35055
|
APP: APP,
|
|
35051
35056
|
getApiBaseUrl: getApiBaseUrl,
|
|
@@ -35210,13 +35215,13 @@ const useSummary = ({
|
|
|
35210
35215
|
}
|
|
35211
35216
|
}, [params?.id, hasSelect, getOne, getMultiple, _partners, isPdf, id, filters]);
|
|
35212
35217
|
React.useEffect(() => {
|
|
35213
|
-
if (selectedItem && _partners !== undefined) {
|
|
35218
|
+
if ((selectedItem || params?.id) && _partners !== undefined) {
|
|
35214
35219
|
const fetchSingleItem = async () => {
|
|
35215
35220
|
setLoading(true);
|
|
35216
35221
|
try {
|
|
35217
35222
|
const {
|
|
35218
35223
|
data
|
|
35219
|
-
} = await service.getOne(selectedItem, {
|
|
35224
|
+
} = await service.getOne(selectedItem || params?.id, {
|
|
35220
35225
|
sources: _partners
|
|
35221
35226
|
});
|
|
35222
35227
|
setSingleItemData(data);
|
|
@@ -35228,7 +35233,7 @@ const useSummary = ({
|
|
|
35228
35233
|
};
|
|
35229
35234
|
fetchSingleItem();
|
|
35230
35235
|
}
|
|
35231
|
-
}, [selectedItem, service, _partners]);
|
|
35236
|
+
}, [selectedItem, service, _partners, params?.id]);
|
|
35232
35237
|
React.useEffect(() => {
|
|
35233
35238
|
_setPartners(selectedPartners?.partners);
|
|
35234
35239
|
}, [selectedPartners]);
|
|
@@ -35583,8 +35588,8 @@ const InformationCompleteness = ({
|
|
|
35583
35588
|
}) => {
|
|
35584
35589
|
const graphData = React.useMemo(() => {
|
|
35585
35590
|
const keys = {
|
|
35586
|
-
ownDataCompletion: data?.
|
|
35587
|
-
consolidatedCompletion: data?.
|
|
35591
|
+
ownDataCompletion: typeof data?.percentage === "object" ? data?.percentage?.percentage : data?.percentage || 0,
|
|
35592
|
+
consolidatedCompletion: data?.consolidatedPercentage || 0
|
|
35588
35593
|
};
|
|
35589
35594
|
const _data = Object.keys(keys).map(key => {
|
|
35590
35595
|
const item = keys[key];
|
|
@@ -35620,22 +35625,32 @@ const InformationCompleteness = ({
|
|
|
35620
35625
|
const Contributions = ({
|
|
35621
35626
|
data = {},
|
|
35622
35627
|
loading = false,
|
|
35623
|
-
t = () => {}
|
|
35628
|
+
t = () => {},
|
|
35629
|
+
partners = []
|
|
35624
35630
|
}) => {
|
|
35631
|
+
const dataPoints = data?.datapointsByAuthor || {};
|
|
35632
|
+
const _data = React.useMemo(() => {
|
|
35633
|
+
return Object.keys(dataPoints).map(key => {
|
|
35634
|
+
return {
|
|
35635
|
+
name: partners?.find(partner => partner.id === key)?.name,
|
|
35636
|
+
datapoints: dataPoints[key]
|
|
35637
|
+
};
|
|
35638
|
+
});
|
|
35639
|
+
}, [dataPoints, partners]);
|
|
35625
35640
|
return /*#__PURE__*/jsxRuntime.jsx(Widget, {
|
|
35626
35641
|
title: t("Contributions"),
|
|
35627
35642
|
className: "with-border-header h-w-btn-header",
|
|
35628
35643
|
loading: loading,
|
|
35629
35644
|
children: /*#__PURE__*/jsxRuntime.jsx(BarChart, {
|
|
35630
|
-
data:
|
|
35631
|
-
xFieldKey: "
|
|
35632
|
-
yFieldKey: "
|
|
35645
|
+
data: _data || [],
|
|
35646
|
+
xFieldKey: "datapoints",
|
|
35647
|
+
yFieldKey: "name",
|
|
35633
35648
|
renderTooltipContent: (title, item) => {
|
|
35634
35649
|
return {
|
|
35635
35650
|
title: title,
|
|
35636
35651
|
items: [{
|
|
35637
35652
|
label: t("Datapoints"),
|
|
35638
|
-
value: item?.[0]?.data?.
|
|
35653
|
+
value: item?.[0]?.data?.datapoints || 0
|
|
35639
35654
|
}]
|
|
35640
35655
|
};
|
|
35641
35656
|
}
|
|
@@ -35646,15 +35661,18 @@ const Contributions = ({
|
|
|
35646
35661
|
const InformationAvailability = ({
|
|
35647
35662
|
selectedPartners = {},
|
|
35648
35663
|
t = () => {},
|
|
35649
|
-
id
|
|
35664
|
+
id,
|
|
35665
|
+
subject,
|
|
35666
|
+
partners
|
|
35650
35667
|
}) => {
|
|
35651
35668
|
const defaultFetchConfig = React.useMemo(() => ({
|
|
35652
|
-
basepath: "
|
|
35653
|
-
url:
|
|
35669
|
+
basepath: subject === "stakeholder" ? "stakeholder" : "location",
|
|
35670
|
+
url: `/completion/${id}`,
|
|
35654
35671
|
defaultData: [],
|
|
35655
35672
|
stop: selectedPartners?.loading,
|
|
35656
35673
|
filters: {
|
|
35657
|
-
datastakeId: id,
|
|
35674
|
+
// datastakeId: id,
|
|
35675
|
+
scope: subject === "stakeholder" ? "operatorInfo" : "locationInfo",
|
|
35658
35676
|
sources: selectedPartners?.partners || []
|
|
35659
35677
|
}
|
|
35660
35678
|
}), [id, selectedPartners]);
|
|
@@ -35677,7 +35695,8 @@ const InformationAvailability = ({
|
|
|
35677
35695
|
}), /*#__PURE__*/jsxRuntime.jsx(Contributions, {
|
|
35678
35696
|
data: data,
|
|
35679
35697
|
loading: loading,
|
|
35680
|
-
t: t
|
|
35698
|
+
t: t,
|
|
35699
|
+
partners: partners
|
|
35681
35700
|
})]
|
|
35682
35701
|
})
|
|
35683
35702
|
});
|
|
@@ -36324,25 +36343,25 @@ const TradeRelationships = ({
|
|
|
36324
36343
|
|
|
36325
36344
|
const IconNodesConfig$1 = {
|
|
36326
36345
|
beneficiaries: {
|
|
36327
|
-
name: "
|
|
36346
|
+
name: "Beneficiaries",
|
|
36328
36347
|
icon: "CoinsHand",
|
|
36329
36348
|
order: 3,
|
|
36330
36349
|
emptyName: "no-beneficiaries"
|
|
36331
36350
|
},
|
|
36332
36351
|
boardMembers: {
|
|
36333
|
-
name: "
|
|
36352
|
+
name: "Board Members",
|
|
36334
36353
|
icon: "Users",
|
|
36335
36354
|
order: 1,
|
|
36336
36355
|
emptyName: "no-board-members"
|
|
36337
36356
|
},
|
|
36338
36357
|
management: {
|
|
36339
|
-
name: "
|
|
36358
|
+
name: "Management",
|
|
36340
36359
|
icon: "Filters",
|
|
36341
36360
|
order: 2,
|
|
36342
36361
|
emptyName: "no-management"
|
|
36343
36362
|
},
|
|
36344
36363
|
shareholders: {
|
|
36345
|
-
name: "
|
|
36364
|
+
name: "Stakeholders",
|
|
36346
36365
|
icon: "PercentCircle",
|
|
36347
36366
|
order: 4,
|
|
36348
36367
|
emptyName: "no-stakeholders"
|
|
@@ -36356,25 +36375,27 @@ const getGovernanceData = ({
|
|
|
36356
36375
|
options,
|
|
36357
36376
|
t,
|
|
36358
36377
|
goTo,
|
|
36359
|
-
selectedPartners
|
|
36378
|
+
selectedPartners,
|
|
36379
|
+
mainSubject
|
|
36360
36380
|
}) => {
|
|
36361
36381
|
const {
|
|
36362
36382
|
sources,
|
|
36363
36383
|
...rest
|
|
36364
36384
|
} = data;
|
|
36365
36385
|
const _data = rest;
|
|
36386
|
+
const mainSubjectData = _data?.[mainSubject];
|
|
36366
36387
|
return {
|
|
36367
|
-
id:
|
|
36368
|
-
name:
|
|
36388
|
+
id: mainSubjectData?.datastakeId || id,
|
|
36389
|
+
name: mainSubjectData?.name || "",
|
|
36369
36390
|
country: {
|
|
36370
|
-
label:
|
|
36391
|
+
label: findOptions(mainSubjectData?.country, options?.countries) || "",
|
|
36371
36392
|
value: (operatorData?.country || "").toLowerCase() || ""
|
|
36372
36393
|
},
|
|
36373
36394
|
onClick: () => {
|
|
36374
36395
|
goTo(`/app/view/operators/${operatorData?.datastakeId || id}`);
|
|
36375
36396
|
},
|
|
36376
36397
|
totalSources: selectedPartners?.partners?.length || 0,
|
|
36377
|
-
children: Object.keys(_data)?.map((key, index) => {
|
|
36398
|
+
children: Object.keys(_data || {})?.filter(key => key !== mainSubject)?.map((key, index) => {
|
|
36378
36399
|
return {
|
|
36379
36400
|
id: key,
|
|
36380
36401
|
name: t(IconNodesConfig$1[key]?.name),
|
|
@@ -36390,7 +36411,7 @@ const getGovernanceData = ({
|
|
|
36390
36411
|
id: child?.datastakeId || "",
|
|
36391
36412
|
name: child?.name || "",
|
|
36392
36413
|
country: {
|
|
36393
|
-
label:
|
|
36414
|
+
label: findOptions(child?.country, options?.countries) || "",
|
|
36394
36415
|
value: (child?.country || "").toLowerCase() || ""
|
|
36395
36416
|
},
|
|
36396
36417
|
totalSources: child?.sources || 0,
|
|
@@ -36841,12 +36862,18 @@ const Governance = ({
|
|
|
36841
36862
|
filters: {
|
|
36842
36863
|
datastakeId: id,
|
|
36843
36864
|
sources: selectedPartners?.partners || [],
|
|
36844
|
-
coreSubject: "stakeholder"
|
|
36865
|
+
coreSubject: "stakeholder",
|
|
36866
|
+
metrics: {
|
|
36867
|
+
shareholders: ['shareholders'],
|
|
36868
|
+
boardMembers: ['boardMembers'],
|
|
36869
|
+
management: ['management'],
|
|
36870
|
+
beneficiaries: ['directBeneficiaries']
|
|
36871
|
+
}
|
|
36845
36872
|
},
|
|
36846
36873
|
defaultData: {},
|
|
36847
36874
|
stop: selectedPartners?.loading
|
|
36848
36875
|
};
|
|
36849
|
-
}, [selectedPartners]);
|
|
36876
|
+
}, [selectedPartners, id]);
|
|
36850
36877
|
const {
|
|
36851
36878
|
data,
|
|
36852
36879
|
loading
|
|
@@ -36861,7 +36888,8 @@ const Governance = ({
|
|
|
36861
36888
|
options,
|
|
36862
36889
|
t,
|
|
36863
36890
|
goTo,
|
|
36864
|
-
selectedPartners
|
|
36891
|
+
selectedPartners,
|
|
36892
|
+
mainSubject: "stakeholder"
|
|
36865
36893
|
});
|
|
36866
36894
|
}, [data, operatorData, options, t]);
|
|
36867
36895
|
return /*#__PURE__*/jsxRuntime.jsx(Widget, {
|
|
@@ -36937,7 +36965,7 @@ const OperatorSummary = ({
|
|
|
36937
36965
|
});
|
|
36938
36966
|
return /*#__PURE__*/jsxRuntime.jsxs(DashboardLayout, {
|
|
36939
36967
|
header: /*#__PURE__*/jsxRuntime.jsx(DAFHeader, {
|
|
36940
|
-
title: t(
|
|
36968
|
+
title: hasSelect ? t("Operator Review") : (singleItemData?.name || "") + " " + t("Summary"),
|
|
36941
36969
|
className: "with-border-header h-w-btn-header no-px-body",
|
|
36942
36970
|
goBackTo: !hasSelect && goBack,
|
|
36943
36971
|
addedHeaderFirst: true,
|
|
@@ -36999,13 +37027,15 @@ const OperatorSummary = ({
|
|
|
36999
37027
|
selectedPartners: selectedPartners,
|
|
37000
37028
|
t: t,
|
|
37001
37029
|
id: params?.id || selectedItem,
|
|
37002
|
-
data:
|
|
37030
|
+
data: singleItemData,
|
|
37003
37031
|
loading: loading
|
|
37004
37032
|
}), /*#__PURE__*/jsxRuntime.jsx("section", {
|
|
37005
37033
|
children: /*#__PURE__*/jsxRuntime.jsx(InformationAvailability, {
|
|
37006
37034
|
selectedPartners: selectedPartners,
|
|
37007
37035
|
t: t,
|
|
37008
|
-
id: params?.id || selectedItem
|
|
37036
|
+
id: params?.id || selectedItem,
|
|
37037
|
+
subject: "stakeholder",
|
|
37038
|
+
partners: partners
|
|
37009
37039
|
})
|
|
37010
37040
|
}), /*#__PURE__*/jsxRuntime.jsx("section", {
|
|
37011
37041
|
children: /*#__PURE__*/jsxRuntime.jsx(TradeRelationships, {
|
|
@@ -37015,7 +37045,7 @@ const OperatorSummary = ({
|
|
|
37015
37045
|
options: options,
|
|
37016
37046
|
goTo: goTo,
|
|
37017
37047
|
getRedirectLink: getRedirectLink,
|
|
37018
|
-
operatorData:
|
|
37048
|
+
operatorData: singleItemData
|
|
37019
37049
|
})
|
|
37020
37050
|
}), /*#__PURE__*/jsxRuntime.jsx("section", {
|
|
37021
37051
|
children: /*#__PURE__*/jsxRuntime.jsx(Governance, {
|
|
@@ -37025,7 +37055,7 @@ const OperatorSummary = ({
|
|
|
37025
37055
|
options: options,
|
|
37026
37056
|
goTo: goTo,
|
|
37027
37057
|
getRedirectLink: getRedirectLink,
|
|
37028
|
-
operatorData:
|
|
37058
|
+
operatorData: singleItemData
|
|
37029
37059
|
})
|
|
37030
37060
|
})]
|
|
37031
37061
|
});
|
|
@@ -41376,161 +41406,27 @@ const RestorationActivitySummary = ({
|
|
|
41376
41406
|
});
|
|
41377
41407
|
};
|
|
41378
41408
|
|
|
41379
|
-
function getKeyIndicatorsConfig({
|
|
41380
|
-
t,
|
|
41381
|
-
data
|
|
41382
|
-
}) {
|
|
41383
|
-
return [{
|
|
41384
|
-
label: t("Extraction Methods"),
|
|
41385
|
-
render: () => {
|
|
41386
|
-
if (!data?.extractionPoints?.length) {
|
|
41387
|
-
return "-";
|
|
41388
|
-
}
|
|
41389
|
-
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
41390
|
-
style: {
|
|
41391
|
-
display: "flex",
|
|
41392
|
-
flexWrap: "wrap"
|
|
41393
|
-
},
|
|
41394
|
-
children: data?.extractionPoints?.map(method => {
|
|
41395
|
-
return /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
|
|
41396
|
-
style: {
|
|
41397
|
-
marginBottom: 8
|
|
41398
|
-
},
|
|
41399
|
-
children: method
|
|
41400
|
-
}, method);
|
|
41401
|
-
})
|
|
41402
|
-
});
|
|
41403
|
-
}
|
|
41404
|
-
}, {
|
|
41405
|
-
label: t("Products"),
|
|
41406
|
-
render: () => {
|
|
41407
|
-
if (data?.productsOfLocation?.length === 0) {
|
|
41408
|
-
return "-";
|
|
41409
|
-
}
|
|
41410
|
-
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
41411
|
-
style: {
|
|
41412
|
-
display: "flex",
|
|
41413
|
-
flexWrap: "wrap"
|
|
41414
|
-
},
|
|
41415
|
-
children: data?.productsOfLocation?.map(product => {
|
|
41416
|
-
return /*#__PURE__*/jsxRuntime.jsx(antd.Tag, {
|
|
41417
|
-
style: {
|
|
41418
|
-
marginBottom: 8
|
|
41419
|
-
},
|
|
41420
|
-
color: getTagColor(product),
|
|
41421
|
-
children: product
|
|
41422
|
-
}, product);
|
|
41423
|
-
})
|
|
41424
|
-
});
|
|
41425
|
-
}
|
|
41426
|
-
}, {
|
|
41427
|
-
label: t("Number of Workers on Site"),
|
|
41428
|
-
render: () => {
|
|
41429
|
-
if (!data.workers) {
|
|
41430
|
-
return "-";
|
|
41431
|
-
}
|
|
41432
|
-
return data.workers;
|
|
41433
|
-
}
|
|
41434
|
-
}];
|
|
41435
|
-
}
|
|
41436
|
-
|
|
41437
|
-
const MineSiteDetails = ({
|
|
41438
|
-
locationData = {},
|
|
41439
|
-
loading = false,
|
|
41440
|
-
t = () => {},
|
|
41441
|
-
options = {}
|
|
41442
|
-
}) => {
|
|
41443
|
-
const data = React.useMemo(() => {
|
|
41444
|
-
return {
|
|
41445
|
-
extractionPoints: (locationData?.extractionMethod || []).map(method => {
|
|
41446
|
-
const _method = options?.extractionMethodsOptions?.find(option => option.value === method)?.label;
|
|
41447
|
-
return _method;
|
|
41448
|
-
}),
|
|
41449
|
-
products: ((locationData?.products || []).map(product => product.typeOfProduct) || []).map(product => {
|
|
41450
|
-
const _product = options?.minerals?.find(option => option.value === product)?.label;
|
|
41451
|
-
return _product;
|
|
41452
|
-
}),
|
|
41453
|
-
workers: locationData?.totalNumberOfWorkers || 0
|
|
41454
|
-
};
|
|
41455
|
-
}, [locationData, options]);
|
|
41456
|
-
const config = React.useMemo(() => getKeyIndicatorsConfig({
|
|
41457
|
-
t,
|
|
41458
|
-
data
|
|
41459
|
-
}), [t, data]);
|
|
41460
|
-
return /*#__PURE__*/jsxRuntime.jsx(KeyIndicatorsWidget, {
|
|
41461
|
-
title: t("Mine Site Details"),
|
|
41462
|
-
className: "value-center small-content row-content-col",
|
|
41463
|
-
config: config,
|
|
41464
|
-
loading: loading,
|
|
41465
|
-
widgetClassName: "custom-width-b"
|
|
41466
|
-
});
|
|
41467
|
-
};
|
|
41468
|
-
|
|
41469
|
-
const LocationMap = ({
|
|
41470
|
-
selectedPartners = {},
|
|
41471
|
-
t = () => {},
|
|
41472
|
-
params,
|
|
41473
|
-
locationData = {},
|
|
41474
|
-
loading = false
|
|
41475
|
-
}) => {
|
|
41476
|
-
const data = React.useMemo(() => {
|
|
41477
|
-
return {
|
|
41478
|
-
gps: locationData?.gps || {},
|
|
41479
|
-
name: locationData?.name || "",
|
|
41480
|
-
admin_level_01: locationData?.linking?.SCL?.[locationData?.administrativeLevel1]?.name || "",
|
|
41481
|
-
admin_level_02: locationData?.linking?.SCL?.[locationData?.administrativeLevel2]?.name || "",
|
|
41482
|
-
country: locationData?.country
|
|
41483
|
-
};
|
|
41484
|
-
}, [locationData]);
|
|
41485
|
-
return /*#__PURE__*/jsxRuntime.jsx(Widget, {
|
|
41486
|
-
title: t("Location"),
|
|
41487
|
-
className: "no-px no-pb-body overflow-hidden",
|
|
41488
|
-
loading: loading,
|
|
41489
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Map$1, {
|
|
41490
|
-
showSider: false,
|
|
41491
|
-
primaryLink: true,
|
|
41492
|
-
mapConfig: {
|
|
41493
|
-
maxZoom: 10
|
|
41494
|
-
},
|
|
41495
|
-
type: "location",
|
|
41496
|
-
data: [data],
|
|
41497
|
-
renderTooltip: () => {
|
|
41498
|
-
data?.country;
|
|
41499
|
-
const adminLevel1Label = t("Province");
|
|
41500
|
-
const adminLevel2Label = t("Territory");
|
|
41501
|
-
return [{
|
|
41502
|
-
label: t(adminLevel1Label),
|
|
41503
|
-
value: data?.admin_level_01 || "--"
|
|
41504
|
-
}, {
|
|
41505
|
-
label: t(adminLevel2Label),
|
|
41506
|
-
value: data?.admin_level_02 || "--"
|
|
41507
|
-
}];
|
|
41508
|
-
}
|
|
41509
|
-
})
|
|
41510
|
-
});
|
|
41511
|
-
};
|
|
41512
|
-
|
|
41513
41409
|
const IconNodesConfig = {
|
|
41514
|
-
|
|
41515
|
-
name: "
|
|
41410
|
+
operator: {
|
|
41411
|
+
name: "Operators",
|
|
41516
41412
|
icon: "Worker",
|
|
41517
41413
|
order: 1,
|
|
41518
41414
|
emptyName: "no-operators"
|
|
41519
41415
|
},
|
|
41520
|
-
|
|
41521
|
-
name: "
|
|
41416
|
+
trader: {
|
|
41417
|
+
name: "Traders",
|
|
41522
41418
|
icon: "Handshake",
|
|
41523
41419
|
order: 2,
|
|
41524
41420
|
emptyName: "no-traders"
|
|
41525
41421
|
},
|
|
41526
41422
|
government: {
|
|
41527
|
-
name: "
|
|
41423
|
+
name: "Government",
|
|
41528
41424
|
icon: "KYC",
|
|
41529
41425
|
order: 3,
|
|
41530
41426
|
emptyName: "no-government"
|
|
41531
41427
|
},
|
|
41532
41428
|
other: {
|
|
41533
|
-
name: "
|
|
41429
|
+
name: "Other",
|
|
41534
41430
|
icon: "CivilSociety",
|
|
41535
41431
|
order: 4,
|
|
41536
41432
|
emptyName: "no-other"
|
|
@@ -41544,22 +41440,24 @@ const getStakeholderMappingData = ({
|
|
|
41544
41440
|
options,
|
|
41545
41441
|
t,
|
|
41546
41442
|
goTo,
|
|
41547
|
-
selectedPartners
|
|
41443
|
+
selectedPartners,
|
|
41444
|
+
mainSubject
|
|
41548
41445
|
}) => {
|
|
41549
41446
|
const _data = data;
|
|
41447
|
+
const mainSubjectData = _data?.[mainSubject];
|
|
41550
41448
|
return {
|
|
41551
|
-
id:
|
|
41552
|
-
name:
|
|
41449
|
+
id: mainSubjectData?.datastakeId || "",
|
|
41450
|
+
name: mainSubjectData?.name || "",
|
|
41553
41451
|
country: {
|
|
41554
|
-
label:
|
|
41555
|
-
value: (
|
|
41452
|
+
label: findOptions(mainSubjectData?.country, options?.countries) || "",
|
|
41453
|
+
value: (mainSubjectData?.country || "").toLowerCase() || ""
|
|
41556
41454
|
},
|
|
41557
|
-
onClick: () => goTo(`/app/view/production-sites/${
|
|
41455
|
+
onClick: () => goTo(`/app/view/production-sites/${mainSubjectData?.datastakeId}`),
|
|
41558
41456
|
totalSources: selectedPartners?.partners?.length || 0,
|
|
41559
41457
|
backgroundColor: "#FFD6E7",
|
|
41560
41458
|
iconColor: "#C41D7F",
|
|
41561
41459
|
icon: "DashboardLocations",
|
|
41562
|
-
children: Object.keys(_data)?.map((key, index) => {
|
|
41460
|
+
children: Object.keys(_data)?.filter(key => key !== mainSubject)?.map((key, index) => {
|
|
41563
41461
|
return {
|
|
41564
41462
|
id: key,
|
|
41565
41463
|
name: t(IconNodesConfig[key]?.name),
|
|
@@ -41569,13 +41467,13 @@ const getStakeholderMappingData = ({
|
|
|
41569
41467
|
iconHoverColor: "#fff",
|
|
41570
41468
|
hoverColor: "#36cfca",
|
|
41571
41469
|
content: _data[key].length,
|
|
41572
|
-
emptyName: IconNodesConfig[key]?.emptyName ? t(
|
|
41470
|
+
emptyName: IconNodesConfig[key]?.emptyName ? t(`${IconNodesConfig[key]?.emptyName}`) : undefined,
|
|
41573
41471
|
children: (_data[key] || [])?.map(child => {
|
|
41574
41472
|
return {
|
|
41575
41473
|
id: child?.datastakeId || "",
|
|
41576
41474
|
name: child?.name || "",
|
|
41577
41475
|
country: {
|
|
41578
|
-
label:
|
|
41476
|
+
label: findOptions(child?.country, options?.countries) || "",
|
|
41579
41477
|
value: child?.country ? child?.country?.toLowerCase() : ""
|
|
41580
41478
|
},
|
|
41581
41479
|
icon: "DashboardStakeholder",
|
|
@@ -41587,8 +41485,8 @@ const getStakeholderMappingData = ({
|
|
|
41587
41485
|
goTo(`/app/view/stakeholders/${child.datastakeId}`);
|
|
41588
41486
|
},
|
|
41589
41487
|
totalSources: child?.sources || 0,
|
|
41590
|
-
tooltipHeader: t("
|
|
41591
|
-
tooltipLabel: t("
|
|
41488
|
+
tooltipHeader: t("link-details"),
|
|
41489
|
+
tooltipLabel: t("sources-reporting"),
|
|
41592
41490
|
value: child?.sources || 0
|
|
41593
41491
|
};
|
|
41594
41492
|
})
|
|
@@ -41617,8 +41515,8 @@ const StakeholderMapping = ({
|
|
|
41617
41515
|
coreSubject: "location",
|
|
41618
41516
|
filterBySources: false,
|
|
41619
41517
|
metrics: {
|
|
41620
|
-
operator: ['operator'],
|
|
41621
|
-
government: ['custom', 'governance'],
|
|
41518
|
+
operator: ['operator', 'operator.clientLocation'],
|
|
41519
|
+
government: ['custom.stakeholderId', 'governance'],
|
|
41622
41520
|
trader: ['trade'],
|
|
41623
41521
|
other: ['civilSociety', 'international']
|
|
41624
41522
|
}
|
|
@@ -41639,7 +41537,8 @@ const StakeholderMapping = ({
|
|
|
41639
41537
|
options,
|
|
41640
41538
|
t,
|
|
41641
41539
|
goTo,
|
|
41642
|
-
selectedPartners
|
|
41540
|
+
selectedPartners,
|
|
41541
|
+
mainSubject: "mine"
|
|
41643
41542
|
});
|
|
41644
41543
|
}, [data, locationData, id, options, t, goTo, selectedPartners]);
|
|
41645
41544
|
return /*#__PURE__*/jsxRuntime.jsx(Widget, {
|
|
@@ -41658,6 +41557,184 @@ const StakeholderMapping = ({
|
|
|
41658
41557
|
});
|
|
41659
41558
|
};
|
|
41660
41559
|
|
|
41560
|
+
function getKeyIndicatorsConfig({
|
|
41561
|
+
t,
|
|
41562
|
+
data
|
|
41563
|
+
}) {
|
|
41564
|
+
return [{
|
|
41565
|
+
label: t("Extraction Methods"),
|
|
41566
|
+
render: () => {
|
|
41567
|
+
const validExtractionPoints = data?.extractionPoints?.filter(Boolean) || [];
|
|
41568
|
+
if (validExtractionPoints?.length === 0 || !validExtractionPoints) {
|
|
41569
|
+
return "-";
|
|
41570
|
+
}
|
|
41571
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
41572
|
+
children: validExtractionPoints?.map((method, index) => {
|
|
41573
|
+
return /*#__PURE__*/jsxRuntime.jsxs(React__default["default"].Fragment, {
|
|
41574
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
41575
|
+
title: method,
|
|
41576
|
+
children: /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
41577
|
+
style: {
|
|
41578
|
+
fontWeight: "normal"
|
|
41579
|
+
},
|
|
41580
|
+
children: method
|
|
41581
|
+
})
|
|
41582
|
+
}), index < validExtractionPoints.length - 1 && ", "]
|
|
41583
|
+
}, method);
|
|
41584
|
+
})
|
|
41585
|
+
});
|
|
41586
|
+
}
|
|
41587
|
+
}, {
|
|
41588
|
+
label: t("Products"),
|
|
41589
|
+
render: () => {
|
|
41590
|
+
const validProducts = data?.products?.filter(Boolean) || [];
|
|
41591
|
+
if (validProducts?.length === 0 || !validProducts) {
|
|
41592
|
+
return "-";
|
|
41593
|
+
}
|
|
41594
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
41595
|
+
children: validProducts?.map((product, index) => {
|
|
41596
|
+
return /*#__PURE__*/jsxRuntime.jsxs(React__default["default"].Fragment, {
|
|
41597
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
41598
|
+
title: product,
|
|
41599
|
+
children: /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
41600
|
+
style: {
|
|
41601
|
+
fontWeight: "normal",
|
|
41602
|
+
color: getTagColor(product)
|
|
41603
|
+
},
|
|
41604
|
+
children: product
|
|
41605
|
+
})
|
|
41606
|
+
}), index < validProducts.length - 1 && ", "]
|
|
41607
|
+
}, product);
|
|
41608
|
+
})
|
|
41609
|
+
});
|
|
41610
|
+
}
|
|
41611
|
+
}, {
|
|
41612
|
+
label: t("Number of Workers on Site"),
|
|
41613
|
+
render: () => {
|
|
41614
|
+
if (!data.workers) {
|
|
41615
|
+
return 0;
|
|
41616
|
+
}
|
|
41617
|
+
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
41618
|
+
title: data.workers,
|
|
41619
|
+
children: data.workers
|
|
41620
|
+
});
|
|
41621
|
+
}
|
|
41622
|
+
}];
|
|
41623
|
+
}
|
|
41624
|
+
|
|
41625
|
+
const MineSiteDetails = ({
|
|
41626
|
+
locationData = {},
|
|
41627
|
+
loading = false,
|
|
41628
|
+
t = () => {},
|
|
41629
|
+
options = {}
|
|
41630
|
+
}) => {
|
|
41631
|
+
const data = React.useMemo(() => {
|
|
41632
|
+
const products = locationData?.products?.map(product => product.typeOfProduct);
|
|
41633
|
+
return {
|
|
41634
|
+
extractionPoints: findOptions(locationData?.extractionMethod, options?.extractionMethodsOptions),
|
|
41635
|
+
products: findOptions(products, options?.mineralOptions),
|
|
41636
|
+
workers: locationData?.totalNumberOfWorkers || 0
|
|
41637
|
+
};
|
|
41638
|
+
}, [locationData, options]);
|
|
41639
|
+
const config = React.useMemo(() => getKeyIndicatorsConfig({
|
|
41640
|
+
t,
|
|
41641
|
+
data
|
|
41642
|
+
}), [t, data]);
|
|
41643
|
+
return /*#__PURE__*/jsxRuntime.jsx(KeyIndicatorsWidget, {
|
|
41644
|
+
title: t("Mine Site Details"),
|
|
41645
|
+
className: "value-center small-content row-content-col",
|
|
41646
|
+
config: config,
|
|
41647
|
+
loading: loading,
|
|
41648
|
+
widgetClassName: "custom-width-b"
|
|
41649
|
+
});
|
|
41650
|
+
};
|
|
41651
|
+
|
|
41652
|
+
const LocationMap = ({
|
|
41653
|
+
selectedPartners = {},
|
|
41654
|
+
t = () => {},
|
|
41655
|
+
params,
|
|
41656
|
+
locationData = {},
|
|
41657
|
+
loading = false
|
|
41658
|
+
}) => {
|
|
41659
|
+
const data = React.useMemo(() => {
|
|
41660
|
+
return {
|
|
41661
|
+
gps: locationData?.gps || {},
|
|
41662
|
+
name: locationData?.name || "",
|
|
41663
|
+
admin_level_01: locationData?.linking?.SCL?.[locationData?.administrativeLevel1]?.name || "",
|
|
41664
|
+
admin_level_02: locationData?.linking?.SCL?.[locationData?.administrativeLevel2]?.name || "",
|
|
41665
|
+
country: locationData?.country
|
|
41666
|
+
};
|
|
41667
|
+
}, [locationData]);
|
|
41668
|
+
return /*#__PURE__*/jsxRuntime.jsx(Widget, {
|
|
41669
|
+
title: t("Location"),
|
|
41670
|
+
className: "no-px no-pb-body overflow-hidden",
|
|
41671
|
+
loading: loading,
|
|
41672
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Map$1, {
|
|
41673
|
+
showSider: false,
|
|
41674
|
+
primaryLink: true,
|
|
41675
|
+
mapConfig: {
|
|
41676
|
+
maxZoom: 10
|
|
41677
|
+
},
|
|
41678
|
+
type: "location",
|
|
41679
|
+
data: [data],
|
|
41680
|
+
renderTooltip: () => {
|
|
41681
|
+
data?.country;
|
|
41682
|
+
const adminLevel1Label = t("Province");
|
|
41683
|
+
const adminLevel2Label = t("Territory");
|
|
41684
|
+
return [{
|
|
41685
|
+
label: t(adminLevel1Label),
|
|
41686
|
+
value: data?.admin_level_01 || "--"
|
|
41687
|
+
}, {
|
|
41688
|
+
label: t(adminLevel2Label),
|
|
41689
|
+
value: data?.admin_level_02 || "--"
|
|
41690
|
+
}];
|
|
41691
|
+
}
|
|
41692
|
+
})
|
|
41693
|
+
});
|
|
41694
|
+
};
|
|
41695
|
+
|
|
41696
|
+
const MineDetailsSection = ({
|
|
41697
|
+
locationData = {},
|
|
41698
|
+
loading = false,
|
|
41699
|
+
t = () => {},
|
|
41700
|
+
options = {},
|
|
41701
|
+
selectedPartners = {},
|
|
41702
|
+
params = {}
|
|
41703
|
+
}) => {
|
|
41704
|
+
const defaultFetchConfig = React.useMemo(() => ({
|
|
41705
|
+
basepath: "analytics",
|
|
41706
|
+
url: '/widgets/mine-site-details',
|
|
41707
|
+
defaultData: [],
|
|
41708
|
+
stop: selectedPartners?.loading,
|
|
41709
|
+
filters: {
|
|
41710
|
+
datastakeId: locationData?.datastakeId,
|
|
41711
|
+
sources: selectedPartners?.partners || [],
|
|
41712
|
+
metrics: ['extractionMethod', 'products', 'totalNumberOfWorkers', 'gps', 'administrativeLevel1', 'administrativeLevel2'],
|
|
41713
|
+
filterBySources: false
|
|
41714
|
+
}
|
|
41715
|
+
}), [selectedPartners, locationData]);
|
|
41716
|
+
const {
|
|
41717
|
+
data,
|
|
41718
|
+
loading: loadingData
|
|
41719
|
+
} = useWidgetFetch({
|
|
41720
|
+
config: defaultFetchConfig
|
|
41721
|
+
});
|
|
41722
|
+
return /*#__PURE__*/jsxRuntime.jsxs("section", {
|
|
41723
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(MineSiteDetails, {
|
|
41724
|
+
locationData: data,
|
|
41725
|
+
loading: loading || loadingData,
|
|
41726
|
+
t: t,
|
|
41727
|
+
options: options
|
|
41728
|
+
}), /*#__PURE__*/jsxRuntime.jsx(LocationMap, {
|
|
41729
|
+
selectedPartners: selectedPartners,
|
|
41730
|
+
t: t,
|
|
41731
|
+
params: params,
|
|
41732
|
+
locationData: data,
|
|
41733
|
+
loading: loading || loadingData
|
|
41734
|
+
})]
|
|
41735
|
+
});
|
|
41736
|
+
};
|
|
41737
|
+
|
|
41661
41738
|
const MineSummary = ({
|
|
41662
41739
|
hasSelect = false,
|
|
41663
41740
|
loading = false,
|
|
@@ -41712,9 +41789,10 @@ const MineSummary = ({
|
|
|
41712
41789
|
});
|
|
41713
41790
|
return /*#__PURE__*/jsxRuntime.jsxs(DashboardLayout, {
|
|
41714
41791
|
header: /*#__PURE__*/jsxRuntime.jsx(DAFHeader, {
|
|
41715
|
-
title: t(
|
|
41792
|
+
title: hasSelect ? t("Mine Review") : (singleItemData?.name || "") + " " + t("Summary"),
|
|
41716
41793
|
className: "with-border-header h-w-btn-header no-px-body",
|
|
41717
41794
|
goBackTo: !hasSelect && goBack,
|
|
41795
|
+
loading: loading,
|
|
41718
41796
|
addedHeaderFirst: true,
|
|
41719
41797
|
actionButtons: [{
|
|
41720
41798
|
tooltip: t("Details"),
|
|
@@ -41769,31 +41847,28 @@ const MineSummary = ({
|
|
|
41769
41847
|
size: "small"
|
|
41770
41848
|
}) : null
|
|
41771
41849
|
})
|
|
41772
|
-
}), /*#__PURE__*/jsxRuntime.
|
|
41773
|
-
|
|
41774
|
-
|
|
41775
|
-
|
|
41776
|
-
|
|
41777
|
-
|
|
41778
|
-
|
|
41779
|
-
selectedPartners: selectedPartners,
|
|
41780
|
-
t: t,
|
|
41781
|
-
params: params,
|
|
41782
|
-
locationData: hasSelect ? singleItemData : data,
|
|
41783
|
-
loading: loadingData
|
|
41784
|
-
})]
|
|
41850
|
+
}), /*#__PURE__*/jsxRuntime.jsx(MineDetailsSection, {
|
|
41851
|
+
locationData: singleItemData,
|
|
41852
|
+
loading: loadingData,
|
|
41853
|
+
t: t,
|
|
41854
|
+
options: options,
|
|
41855
|
+
selectedPartners: selectedPartners,
|
|
41856
|
+
params: params
|
|
41785
41857
|
}), /*#__PURE__*/jsxRuntime.jsx("section", {
|
|
41786
41858
|
children: /*#__PURE__*/jsxRuntime.jsx(InformationAvailability, {
|
|
41787
41859
|
selectedPartners: selectedPartners,
|
|
41788
41860
|
t: t,
|
|
41789
|
-
id: params?.id || selectedItem
|
|
41861
|
+
id: params?.id || selectedItem,
|
|
41862
|
+
partners: partners
|
|
41790
41863
|
})
|
|
41791
41864
|
}), /*#__PURE__*/jsxRuntime.jsx("section", {
|
|
41792
41865
|
children: /*#__PURE__*/jsxRuntime.jsx(StakeholderMapping, {
|
|
41793
41866
|
selectedPartners: selectedPartners,
|
|
41794
41867
|
t: t,
|
|
41795
41868
|
id: params?.id || selectedItem,
|
|
41796
|
-
locationData:
|
|
41869
|
+
locationData: singleItemData,
|
|
41870
|
+
goTo: goTo,
|
|
41871
|
+
options: options
|
|
41797
41872
|
})
|
|
41798
41873
|
})]
|
|
41799
41874
|
});
|