datastake-daf 0.6.699 → 0.6.701
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 +448 -428
- package/dist/hooks/index.js +631 -0
- package/dist/layouts/index.js +448 -428
- package/dist/pages/index.js +12767 -0
- package/dist/services/index.js +60 -0
- package/dist/style/datastake/datastake.css +15 -3
- package/dist/utils/index.js +448 -428
- package/package.json +1 -1
- package/rollup.config.js +20 -0
- package/src/@daf/core/components/Icon/configs/Onboarding.js +12 -0
- package/src/@daf/core/components/Icon/configs/index.js +2 -0
- package/src/@daf/hooks/useSources.js +29 -0
- package/src/@daf/hooks/useWidgetFetch.js +44 -0
- package/src/@daf/pages/dashboards/SupplyChain/components/ChartsContainer/components/GenderDistribution/config.js +17 -0
- package/src/@daf/pages/dashboards/SupplyChain/components/ChartsContainer/components/GenderDistribution/index.js +128 -0
- package/src/@daf/pages/dashboards/SupplyChain/components/ChartsContainer/components/Identification/hook.js +79 -0
- package/src/@daf/pages/dashboards/SupplyChain/components/ChartsContainer/components/Identification/index.js +64 -0
- package/src/@daf/pages/dashboards/SupplyChain/components/ChartsContainer/components/Locations/config.js +9 -0
- package/src/@daf/pages/dashboards/SupplyChain/components/ChartsContainer/components/Locations/index.js +103 -0
- package/src/@daf/pages/dashboards/SupplyChain/components/ChartsContainer/index.js +82 -0
- package/src/@daf/pages/dashboards/SupplyChain/components/KeyIndicators/config.js +88 -0
- package/src/@daf/pages/dashboards/SupplyChain/components/KeyIndicators/index.js +54 -0
- package/src/@daf/pages/dashboards/SupplyChain/components/SupplyChainMap/index.js +70 -0
- package/src/@daf/pages/dashboards/SupplyChain/components/TradeRelationships/index.js +48 -0
- package/src/@daf/pages/dashboards/SupplyChain/config.js +216 -0
- package/src/@daf/pages/dashboards/SupplyChain/index.jsx +96 -0
- package/src/@daf/services/DashboardService.js +14 -0
- package/src/@daf/services/SourceService.js +36 -0
- package/src/hooks.js +3 -2
- package/src/pages.js +1 -0
- package/src/services.js +3 -1
- package/src/styles/datastake/datastake.css +15 -3
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import CustomIcon from '../../../../../core/components/Icon/CustomIcon.jsx';
|
|
3
|
+
|
|
4
|
+
export const getRowConfig = ({ t, data = {}, goTo, getRedirectLink, theme = {} }) => [
|
|
5
|
+
{
|
|
6
|
+
label: (
|
|
7
|
+
<div className="flex">
|
|
8
|
+
<div className="flex-1">{t("Identified Mine Sites")}</div>
|
|
9
|
+
<div className="cursor-pointer" onClick={() => goTo(getRedirectLink("/app/scl"))}>
|
|
10
|
+
<CustomIcon
|
|
11
|
+
name="LinkNewTab"
|
|
12
|
+
width={16}
|
|
13
|
+
height={16}
|
|
14
|
+
color={theme.colorPrimary}
|
|
15
|
+
/>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
),
|
|
19
|
+
render: () => {
|
|
20
|
+
return <span>{data.mineSites ?? 0}</span>;
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
label: (
|
|
25
|
+
<div className="flex">
|
|
26
|
+
<div className="flex-1">{t("Identified Operators")}</div>
|
|
27
|
+
<div
|
|
28
|
+
className="cursor-pointer"
|
|
29
|
+
onClick={() => goTo(getRedirectLink("/app/operators"))}
|
|
30
|
+
>
|
|
31
|
+
<CustomIcon
|
|
32
|
+
name="LinkNewTab"
|
|
33
|
+
width={16}
|
|
34
|
+
height={16}
|
|
35
|
+
color={theme.colorPrimary}
|
|
36
|
+
/>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
),
|
|
40
|
+
render: () => <span>{data?.operators ?? 0}</span>,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
label: (
|
|
44
|
+
<div className="flex">
|
|
45
|
+
<div className="flex-1">{t("Trade Connections")}</div>
|
|
46
|
+
</div>
|
|
47
|
+
),
|
|
48
|
+
render: () => <span>{data?.connections ?? 0}</span>,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: (
|
|
52
|
+
<div className="flex">
|
|
53
|
+
<div className="flex-1">{t("Associated Documents")}</div>
|
|
54
|
+
<div
|
|
55
|
+
className="cursor-pointer"
|
|
56
|
+
onClick={() => goTo(getRedirectLink("/app/documents"))}
|
|
57
|
+
>
|
|
58
|
+
<CustomIcon
|
|
59
|
+
name="LinkNewTab"
|
|
60
|
+
width={16}
|
|
61
|
+
height={16}
|
|
62
|
+
color={theme.colorPrimary}
|
|
63
|
+
/>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
),
|
|
67
|
+
render: () => <span>{data.documents ?? 0}</span>,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
label: (
|
|
71
|
+
<div className="flex">
|
|
72
|
+
<div className="flex-1">{t("Information Sources")}</div>
|
|
73
|
+
<div
|
|
74
|
+
className="cursor-pointer"
|
|
75
|
+
onClick={() => goTo(getRedirectLink("/app/partners"))}
|
|
76
|
+
>
|
|
77
|
+
<CustomIcon
|
|
78
|
+
name="LinkNewTab"
|
|
79
|
+
width={16}
|
|
80
|
+
height={16}
|
|
81
|
+
color={theme.colorPrimary}
|
|
82
|
+
/>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
),
|
|
86
|
+
render: () => <span>{data.sources ?? 0}</span>,
|
|
87
|
+
},
|
|
88
|
+
];
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React, { useMemo } from 'react'
|
|
2
|
+
import { useWidgetFetch } from '../../../../../hooks/useWidgetFetch.js';
|
|
3
|
+
import { getRowConfig } from './config';
|
|
4
|
+
import KeyIndicatorsWidget from '../../../../../core/components/Dashboard/Widget/KeyIndicators/index.jsx';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
|
|
7
|
+
const defaultFetchConfig = {
|
|
8
|
+
basepath: "analytics",
|
|
9
|
+
url: '/widgets/key-informations',
|
|
10
|
+
filters: {
|
|
11
|
+
"filterBySources": true,
|
|
12
|
+
metrics: ['connections', 'documents', 'mineSites', 'operators', 'sources']
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
function KeyIndicators({selectedSources = {}, theme = {}, getRedirectLink = () => {}, t = () => {}, goTo = () => {} }) {
|
|
17
|
+
const fetchConfig = useMemo(() => ({
|
|
18
|
+
...defaultFetchConfig,
|
|
19
|
+
filters: { ...defaultFetchConfig.filters, sources: selectedSources?.partners || [] },
|
|
20
|
+
stop: selectedSources?.loading,
|
|
21
|
+
}), [selectedSources]);
|
|
22
|
+
|
|
23
|
+
const { data, loading } = useWidgetFetch({config:fetchConfig});
|
|
24
|
+
|
|
25
|
+
const config = useMemo(() => {
|
|
26
|
+
return getRowConfig({
|
|
27
|
+
t,
|
|
28
|
+
data: { ...data },
|
|
29
|
+
goTo,
|
|
30
|
+
getRedirectLink,
|
|
31
|
+
theme,
|
|
32
|
+
})
|
|
33
|
+
}, [t, data, goTo, getRedirectLink, theme])
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<KeyIndicatorsWidget
|
|
37
|
+
t={t}
|
|
38
|
+
config={config}
|
|
39
|
+
loading={loading}
|
|
40
|
+
title={ t("Key Information")}
|
|
41
|
+
className="small-content"
|
|
42
|
+
/>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
KeyIndicators.propTypes = {
|
|
47
|
+
selectedSources: PropTypes.object,
|
|
48
|
+
theme: PropTypes.object,
|
|
49
|
+
getRedirectLink: PropTypes.func,
|
|
50
|
+
t: PropTypes.func,
|
|
51
|
+
goTo: PropTypes.func,
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default KeyIndicators
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React, { useMemo } from 'react'
|
|
2
|
+
import { useWidgetFetch } from '../../../../../hooks/useWidgetFetch.js';
|
|
3
|
+
import Widget from '../../../../../core/components/Dashboard/Widget/index.jsx';
|
|
4
|
+
import Map from '../../../../../core/components/Dashboard/Map/index.jsx';
|
|
5
|
+
import { getTagColor } from '../../../../../utils/productTag.js';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
function SupplyChainMap({selectedSources = {}, t = () => {}, goTo = () => {}, options = {}, getRedirectLink = () => {} }) {
|
|
10
|
+
|
|
11
|
+
const defaultConfig = useMemo(
|
|
12
|
+
() => ({
|
|
13
|
+
basepath: "analytics",
|
|
14
|
+
url: "/widgets/trade-connection-map",
|
|
15
|
+
filters: {
|
|
16
|
+
sources: selectedSources?.partners || [],
|
|
17
|
+
},
|
|
18
|
+
stop: selectedSources?.loading,
|
|
19
|
+
defaultData: [],
|
|
20
|
+
}),
|
|
21
|
+
[selectedSources],
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const { loading, data } = useWidgetFetch({config: defaultConfig});
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<Widget
|
|
28
|
+
title={t("Supply Chain Map")}
|
|
29
|
+
loading={loading}
|
|
30
|
+
className="flex flex-1 with-border-header no-p-body"
|
|
31
|
+
>
|
|
32
|
+
<Map
|
|
33
|
+
type={"chain"}
|
|
34
|
+
data={Array.isArray(data) && data.length > 0 ? data : []}
|
|
35
|
+
renderTooltip={(data) => {
|
|
36
|
+
const productsText = data?.products?.[0];
|
|
37
|
+
const minerals = options?.minerals || [];
|
|
38
|
+
return [
|
|
39
|
+
{
|
|
40
|
+
label: t("Products"),
|
|
41
|
+
value:
|
|
42
|
+
minerals.find((mineral) => mineral.value === productsText)?.label ||
|
|
43
|
+
productsText ||
|
|
44
|
+
"-",
|
|
45
|
+
...(productsText && { tag: getTagColor(productsText) }),
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
label: t("Participants"),
|
|
49
|
+
value: data?.participants || "-",
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
}}
|
|
53
|
+
link
|
|
54
|
+
onClickLink={(data) => {
|
|
55
|
+
goTo(getRedirectLink(`/app/view/stakeholders/${data.datastakeId}`));
|
|
56
|
+
}}
|
|
57
|
+
/>
|
|
58
|
+
</Widget>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
SupplyChainMap.propTypes = {
|
|
63
|
+
selectedSources: PropTypes.object,
|
|
64
|
+
t: PropTypes.func,
|
|
65
|
+
goTo: PropTypes.func,
|
|
66
|
+
options: PropTypes.object,
|
|
67
|
+
getRedirectLink: PropTypes.func,
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export default SupplyChainMap
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React, { useMemo } from 'react'
|
|
2
|
+
import { useWidgetFetch } from '../../../../../hooks/useWidgetFetch.js';
|
|
3
|
+
import Widget from '../../../../../core/components/Dashboard/Widget/index.jsx';
|
|
4
|
+
import DataChainOfCustody from '../../../../../core/components/Graphs/DataChainOfCustody/index.jsx';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
|
|
7
|
+
const defaultFetchConfig = {
|
|
8
|
+
basepath: "analytics",
|
|
9
|
+
url: "/widgets/datachain-of-custody",
|
|
10
|
+
filters: {},
|
|
11
|
+
defaultData: [],
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
function TradeRelationships({goTo, t = () => {}, options = {}, mapDataFunction = () => {}, hardcodedData = [] }) {
|
|
15
|
+
|
|
16
|
+
const fetchConfig = useMemo(
|
|
17
|
+
() => ({
|
|
18
|
+
...defaultFetchConfig,
|
|
19
|
+
filters: {},
|
|
20
|
+
}),
|
|
21
|
+
[],
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const { data, loading } = useWidgetFetch({config: fetchConfig});
|
|
25
|
+
|
|
26
|
+
const mappedData = mapDataFunction(Object.keys(data)?.length > 0 ? data : hardcodedData, options?.category ?? [], goTo);
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Widget
|
|
30
|
+
loading={loading}
|
|
31
|
+
title={t("Trade Relationships")}
|
|
32
|
+
className="flex flex-1 with-border-header no-p-body"
|
|
33
|
+
>
|
|
34
|
+
<div style={{ height: 600 }}>
|
|
35
|
+
<DataChainOfCustody data={mappedData} maxZoom={1} />
|
|
36
|
+
</div>
|
|
37
|
+
</Widget>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
TradeRelationships.propTypes = {
|
|
42
|
+
goTo: PropTypes.func,
|
|
43
|
+
t: PropTypes.func,
|
|
44
|
+
options: PropTypes.object,
|
|
45
|
+
mapDataFunction: PropTypes.func,
|
|
46
|
+
hardcodedData: PropTypes.array,
|
|
47
|
+
}
|
|
48
|
+
export default TradeRelationships
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import CustomIcon from '../../../core/components/Icon/CustomIcon.jsx';
|
|
3
|
+
import { findOptions } from '../../../../helpers/StringHelper.js';3
|
|
4
|
+
|
|
5
|
+
const theme = window.theme;
|
|
6
|
+
|
|
7
|
+
const kycIcon = <CustomIcon name="KYC" color="#6C737F" width={18} height={18} />;
|
|
8
|
+
|
|
9
|
+
const buildingIcon = <CustomIcon name="Building" color="#6C737F" width={18} height={18} />;
|
|
10
|
+
const individualIcon = <CustomIcon name="UserCircle" color="#6C737F" width={18} height={18} />;
|
|
11
|
+
const csIcon = <CustomIcon name="CivilSociety" color="#6C737F" width={18} height={18} />;
|
|
12
|
+
const leftIcon = (
|
|
13
|
+
<CustomIcon
|
|
14
|
+
name="NashirikiSmallLogo"
|
|
15
|
+
color={theme.colorPrimary8}
|
|
16
|
+
width={16}
|
|
17
|
+
height={16}
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
20
|
+
const middleIcon = (
|
|
21
|
+
<CustomIcon
|
|
22
|
+
name="NashirikiSmallLogo"
|
|
23
|
+
color={theme.colorPrimary2}
|
|
24
|
+
width={16}
|
|
25
|
+
height={16}
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const rightIcon = <CustomIcon name="NashirikiSmallLogo" color="white" width={16} height={16} />;
|
|
30
|
+
|
|
31
|
+
const mapIcon = (category) => {
|
|
32
|
+
switch (category) {
|
|
33
|
+
case "businessEntity":
|
|
34
|
+
return buildingIcon;
|
|
35
|
+
case "civilSociety":
|
|
36
|
+
return csIcon;
|
|
37
|
+
case "government":
|
|
38
|
+
return kycIcon;
|
|
39
|
+
case "individual":
|
|
40
|
+
return individualIcon;
|
|
41
|
+
default:
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const leftBackground = theme.colorPrimary3;
|
|
46
|
+
const rightBackground = theme.colorPrimary6;
|
|
47
|
+
|
|
48
|
+
export const mapDataFunction = (data = {}, options = [], goTo = () => {}) => {
|
|
49
|
+
const mapChildren = (items, type, parentId, isDirect = true) => {
|
|
50
|
+
return (items ?? [])?.map((item) => ({
|
|
51
|
+
id: item.id,
|
|
52
|
+
number: 0,
|
|
53
|
+
name: item.name,
|
|
54
|
+
sources: parentId ? [parentId] : [],
|
|
55
|
+
subTitle: findOptions(item.category, options),
|
|
56
|
+
leftIcon: type === "client" ? rightIcon : leftIcon,
|
|
57
|
+
leftBackground: type === "client" ? rightBackground : leftBackground,
|
|
58
|
+
topIcon: mapIcon(item.category),
|
|
59
|
+
children: mapChildren(item.sources ?? item.clients ?? [], type, item.id, false),
|
|
60
|
+
onClick: () => {
|
|
61
|
+
if (isDirect && parentId === data.id) {
|
|
62
|
+
goTo(`/app/partners?datastakeId=${item.id}`);
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
}));
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
id: data.id,
|
|
70
|
+
number: 0,
|
|
71
|
+
name: data.name,
|
|
72
|
+
subTitle: findOptions(data.category, options),
|
|
73
|
+
leftIcon: middleIcon,
|
|
74
|
+
leftBackground: theme.colorPrimary10,
|
|
75
|
+
topIcon: mapIcon(data.category),
|
|
76
|
+
left: mapChildren(data.sources, "source", data.id),
|
|
77
|
+
right: mapChildren(data.clients, "client", data.id),
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const hardcodedData = {
|
|
82
|
+
id: "1",
|
|
83
|
+
number: 15,
|
|
84
|
+
name: "This Organisation",
|
|
85
|
+
subTitle: "Legal Form",
|
|
86
|
+
leftIcon: middleIcon,
|
|
87
|
+
topIcon: kycIcon,
|
|
88
|
+
left: [
|
|
89
|
+
{
|
|
90
|
+
id: "2",
|
|
91
|
+
number: 15,
|
|
92
|
+
name: "Client",
|
|
93
|
+
sources: ["1"],
|
|
94
|
+
leftBackground,
|
|
95
|
+
leftIcon,
|
|
96
|
+
subTitle: "Legal Form",
|
|
97
|
+
topIcon: kycIcon,
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
id: "3",
|
|
101
|
+
number: 15,
|
|
102
|
+
name: "Client",
|
|
103
|
+
sources: ["1"],
|
|
104
|
+
leftBackground,
|
|
105
|
+
leftIcon,
|
|
106
|
+
subTitle: "Legal Form",
|
|
107
|
+
topIcon: kycIcon,
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
id: "4",
|
|
111
|
+
number: 15,
|
|
112
|
+
name: "Client",
|
|
113
|
+
sources: ["1"],
|
|
114
|
+
leftBackground,
|
|
115
|
+
leftIcon,
|
|
116
|
+
subTitle: "Legal Form",
|
|
117
|
+
topIcon: kycIcon,
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: "5",
|
|
121
|
+
number: 15,
|
|
122
|
+
name: "Client",
|
|
123
|
+
sources: ["1"],
|
|
124
|
+
leftBackground,
|
|
125
|
+
leftIcon,
|
|
126
|
+
subTitle: "Legal Form",
|
|
127
|
+
topIcon: kycIcon,
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
right: [
|
|
131
|
+
{
|
|
132
|
+
id: "6",
|
|
133
|
+
number: 15,
|
|
134
|
+
name: "Buyer",
|
|
135
|
+
sources: ["1"],
|
|
136
|
+
subTitle: "Legal Form",
|
|
137
|
+
leftIcon: rightIcon,
|
|
138
|
+
topIcon: kycIcon,
|
|
139
|
+
leftBackground: rightBackground,
|
|
140
|
+
children: [
|
|
141
|
+
{
|
|
142
|
+
id: "61",
|
|
143
|
+
name: "Buyer 2",
|
|
144
|
+
sources: ["6"],
|
|
145
|
+
leftIcon: rightIcon,
|
|
146
|
+
topIcon: kycIcon,
|
|
147
|
+
leftBackground: rightBackground,
|
|
148
|
+
subTitle: "Legal Form",
|
|
149
|
+
children: [
|
|
150
|
+
{
|
|
151
|
+
id: "611",
|
|
152
|
+
leftIcon: rightIcon,
|
|
153
|
+
topIcon: kycIcon,
|
|
154
|
+
leftBackground: rightBackground,
|
|
155
|
+
subTitle: "Legal Form",
|
|
156
|
+
name: "Buyer 3",
|
|
157
|
+
sources: ["61"],
|
|
158
|
+
},
|
|
159
|
+
],
|
|
160
|
+
},
|
|
161
|
+
],
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
id: "7",
|
|
165
|
+
number: 15,
|
|
166
|
+
subTitle: "Legal Form",
|
|
167
|
+
name: "Buyer",
|
|
168
|
+
leftIcon: rightIcon,
|
|
169
|
+
topIcon: kycIcon,
|
|
170
|
+
leftBackground: rightBackground,
|
|
171
|
+
sources: ["1"],
|
|
172
|
+
children: [
|
|
173
|
+
{
|
|
174
|
+
id: "71",
|
|
175
|
+
leftIcon: rightIcon,
|
|
176
|
+
topIcon: kycIcon,
|
|
177
|
+
leftBackground: rightBackground,
|
|
178
|
+
name: "Buyer 2",
|
|
179
|
+
sources: ["1", "7", "8", "9"],
|
|
180
|
+
subTitle: "Legal Form",
|
|
181
|
+
children: [
|
|
182
|
+
{
|
|
183
|
+
id: "711",
|
|
184
|
+
leftIcon: rightIcon,
|
|
185
|
+
topIcon: kycIcon,
|
|
186
|
+
leftBackground: rightBackground,
|
|
187
|
+
name: "Buyer 3",
|
|
188
|
+
sources: ["71", "1"],
|
|
189
|
+
subTitle: "Legal Form",
|
|
190
|
+
},
|
|
191
|
+
],
|
|
192
|
+
},
|
|
193
|
+
],
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
leftIcon: rightIcon,
|
|
197
|
+
topIcon: kycIcon,
|
|
198
|
+
leftBackground: rightBackground,
|
|
199
|
+
id: "8",
|
|
200
|
+
number: 15,
|
|
201
|
+
name: "Buyer",
|
|
202
|
+
sources: ["1"],
|
|
203
|
+
subTitle: "Legal Form",
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
leftIcon: rightIcon,
|
|
207
|
+
topIcon: kycIcon,
|
|
208
|
+
leftBackground: rightBackground,
|
|
209
|
+
id: "9",
|
|
210
|
+
number: 15,
|
|
211
|
+
name: "Buyer",
|
|
212
|
+
sources: ["1"],
|
|
213
|
+
subTitle: "Legal Form",
|
|
214
|
+
},
|
|
215
|
+
],
|
|
216
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import React, { useMemo, useEffect } from 'react'
|
|
2
|
+
import CustomIcon from '../../../core/components/Icon/CustomIcon.jsx';
|
|
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 KeyIndicators from './components/KeyIndicators';
|
|
7
|
+
import SupplyChainMap from './components/SupplyChainMap';
|
|
8
|
+
import TradeRelationships from './components/TradeRelationships';
|
|
9
|
+
import ChartsContainer from './components/ChartsContainer';
|
|
10
|
+
|
|
11
|
+
function SupplyChain({
|
|
12
|
+
t = () => {},
|
|
13
|
+
goTo = () => {},
|
|
14
|
+
getRedirectLink = () => {},
|
|
15
|
+
theme = {},
|
|
16
|
+
user = {},
|
|
17
|
+
options = {},
|
|
18
|
+
partners,
|
|
19
|
+
selectedPartners,
|
|
20
|
+
setSelectedPartners,
|
|
21
|
+
informationSources,
|
|
22
|
+
mapDataFunction,
|
|
23
|
+
hardcodedData,
|
|
24
|
+
breadCrumbs = [],
|
|
25
|
+
}) {
|
|
26
|
+
|
|
27
|
+
const sourceOptions = useMemo(() => {
|
|
28
|
+
if(!partners?.length) return [];
|
|
29
|
+
|
|
30
|
+
return partners?.map((partner) => {
|
|
31
|
+
const isOwnData = partner.id === user?.company?.id;
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
label: partner.nickName,
|
|
35
|
+
value: partner.id,
|
|
36
|
+
avatar: isOwnData ? <span>OWN</span> : <CustomIcon name={"Search02"} size={14} />,
|
|
37
|
+
background: isOwnData ? theme.colorPrimary7 : undefined,
|
|
38
|
+
color: isOwnData ? "white" : undefined,
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
}, [partners, user]);
|
|
42
|
+
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
window.theme = theme;
|
|
45
|
+
}, [theme])
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<DashboardLayout
|
|
50
|
+
header={
|
|
51
|
+
<Header
|
|
52
|
+
title={t('Mineral Supply Chain Transparency')}
|
|
53
|
+
addedHeader={
|
|
54
|
+
<div>
|
|
55
|
+
<Multiselect
|
|
56
|
+
options={[...sourceOptions]}
|
|
57
|
+
isAvatarGroup
|
|
58
|
+
selectionType="checkbox"
|
|
59
|
+
canUnselectLast={false}
|
|
60
|
+
key={partners?.length}
|
|
61
|
+
onChange={(selected) => {
|
|
62
|
+
setSelectedPartners((prev) => ({
|
|
63
|
+
...prev,
|
|
64
|
+
partners: selected,
|
|
65
|
+
loading: false,
|
|
66
|
+
}));
|
|
67
|
+
}}
|
|
68
|
+
dropDownWidth={200}
|
|
69
|
+
defaultSelected={partners?.map((p) => p.id) || []}
|
|
70
|
+
/>
|
|
71
|
+
</div>
|
|
72
|
+
}
|
|
73
|
+
breadcrumbs={breadCrumbs}
|
|
74
|
+
/>
|
|
75
|
+
}
|
|
76
|
+
>
|
|
77
|
+
<section>
|
|
78
|
+
<KeyIndicators selectedSources={selectedPartners} theme={theme} t={t} goTo={goTo} getRedirectLink={getRedirectLink} />
|
|
79
|
+
</section>
|
|
80
|
+
<section>
|
|
81
|
+
<SupplyChainMap selectedSources={selectedPartners} t={t} goTo={goTo} options={options} getRedirectLink={getRedirectLink} />
|
|
82
|
+
</section>
|
|
83
|
+
<section>
|
|
84
|
+
<TradeRelationships selectedSources={selectedPartners} mapDataFunction={mapDataFunction} t={t} options={options} goTo={goTo} hardcodedData={hardcodedData} />
|
|
85
|
+
</section>
|
|
86
|
+
<section>
|
|
87
|
+
<ChartsContainer selectedSources={selectedPartners} t={t} theme={theme} options={options} />
|
|
88
|
+
</section>
|
|
89
|
+
<section>
|
|
90
|
+
<ChartsContainer selectedSources={selectedPartners} isTradeActions={true} t={t} theme={theme} options={options} />
|
|
91
|
+
</section>
|
|
92
|
+
</DashboardLayout>
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export default SupplyChain;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseService } from "./BaseService.js";
|
|
2
|
+
import { createLazyService } from "./helpers/LazyService.js";
|
|
3
|
+
|
|
4
|
+
class DashboardService extends BaseService {
|
|
5
|
+
getWidget({url, params = {}, filters = {}, basepath = "dashboard"}) {
|
|
6
|
+
return this.apiGet({
|
|
7
|
+
url: `/${basepath}${url}`,
|
|
8
|
+
params: { ...params, ...filters },
|
|
9
|
+
isApp: true,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default createLazyService(DashboardService);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { BaseService } from "./BaseService.js";
|
|
2
|
+
import { createLazyService } from "./helpers/LazyService.js";
|
|
3
|
+
|
|
4
|
+
class SourceService extends BaseService {
|
|
5
|
+
get(tab, filters) {
|
|
6
|
+
const { page, pageSize, search, searchParams, ...rest } = filters;
|
|
7
|
+
const params = {
|
|
8
|
+
filters: rest,
|
|
9
|
+
pagination: {
|
|
10
|
+
skip: page,
|
|
11
|
+
take: pageSize,
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
if (search && searchParams.length > 0) {
|
|
15
|
+
params.search = {
|
|
16
|
+
qs: search,
|
|
17
|
+
fields: searchParams,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return this.apiGet({
|
|
22
|
+
url: "/partner",
|
|
23
|
+
isApp: true,
|
|
24
|
+
params,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
getSources({type,id}) {
|
|
30
|
+
return this.apiGet({
|
|
31
|
+
url: `/${type}/sources-for-subject/${id}`,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default createLazyService(SourceService);
|
package/src/hooks.js
CHANGED
|
@@ -6,8 +6,9 @@ export { default as useLinearGradientAreaChart } from "./@daf/hooks/useLinearGra
|
|
|
6
6
|
export { default as useRadialBarChart } from "./@daf/hooks/useRadialBarChart";
|
|
7
7
|
export { useMapConfig } from "./@daf/hooks/useMapHelper.js";
|
|
8
8
|
export { useIsMobile } from "./@daf/hooks/useIsMobile";
|
|
9
|
-
export { default as useSource } from "./@daf/hooks/useSources.js";
|
|
9
|
+
export { default as useSource, useSources } from "./@daf/hooks/useSources.js";
|
|
10
10
|
export { useMapOnExpandableWidget } from "./@daf/hooks/useMapOnExpandableWidget";
|
|
11
11
|
export { checkPermission, checkPermissionList, usePermissions } from "./@daf/hooks/usePermissions";
|
|
12
12
|
export { useFirebase } from "./@daf/hooks/useFirebase.js"
|
|
13
|
-
export { useIsDatastake } from "./@daf/hooks/useIsDatastake.js"
|
|
13
|
+
export { useIsDatastake } from "./@daf/hooks/useIsDatastake.js"
|
|
14
|
+
export { useWidgetFetch } from "./@daf/hooks/useWidgetFetch.js"
|
package/src/pages.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SupplyChainDashboard } from './@daf/pages/dashboards/SupplyChain/index.jsx';
|
package/src/services.js
CHANGED
|
@@ -13,4 +13,6 @@ export { default as ChannelsService } from './@daf/services/ChannelsService.js';
|
|
|
13
13
|
export { default as DataStoreService } from './@daf/services/DataStoreService.js';
|
|
14
14
|
export { default as NotificationService } from './@daf/services/NotificationService.js';
|
|
15
15
|
export { default as QueryService } from './@daf/services/QueryService.js';
|
|
16
|
-
export { default as UserService } from './@daf/services/UserService.js';
|
|
16
|
+
export { default as UserService } from './@daf/services/UserService.js';
|
|
17
|
+
export { default as SourceService } from './@daf/services/SourceService.js';
|
|
18
|
+
export { default as DashboardService } from './@daf/services/DashboardService.js';
|