datastake-daf 0.6.846 → 0.6.847
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/favicon.ico +0 -0
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/manifest.json +25 -0
- package/build/robots.txt +3 -0
- package/dist/components/index.js +58 -16
- package/dist/hooks/index.js +10 -12
- package/dist/pages/index.js +4543 -4120
- package/dist/style/datastake/mapbox-gl.css +330 -0
- package/dist/utils/index.js +1 -9
- package/package.json +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminModals/NewUser/index.jsx +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminTables/AccountTable/helper.js +77 -59
- package/src/@daf/core/components/Screens/Admin/AdminViews/index.jsx +8 -1
- package/src/@daf/hooks/useSources.js +4 -6
- package/src/@daf/hooks/useWidgetFetch.js +40 -34
- package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/IncidentsTime/config.js +0 -3
- package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/IncidentsTime/hook.js +4 -69
- package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/IncidentsTime/index.js +92 -29
- package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/ProblemSolver/hook.js +34 -59
- package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/ProblemSolver/index.js +69 -36
- package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/TerritorialDistribution/index.js +75 -50
- package/src/@daf/pages/Dashboards/ConflictManagement/index.js +11 -11
- package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/GenderDistribution/index.js +51 -46
- package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/Identification/hook.js +20 -20
- package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/Identification/index.js +2 -26
- package/src/@daf/pages/Dashboards/SupplyChain/index.jsx +1 -0
- package/src/@daf/pages/Dashboards/UserDashboard/components/DataChainOfCustody/index.jsx +1 -2
- package/src/@daf/pages/Dashboards/UserDashboard/index.jsx +0 -1
- package/src/@daf/pages/Dashboards/helper.js +20 -25
- package/src/@daf/utils/timeFilterUtils.js +250 -233
- package/src/constants/locales/fr/translation.js +0 -9
- package/src/constants/locales/sp/translation.js +0 -1
- package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/TerritorialDistribution/hook.js +0 -56
|
@@ -2,6 +2,8 @@ import React, { useMemo, useEffect } from "react";
|
|
|
2
2
|
import KeyIndicators from "./components/KeyIndicators/index.js";
|
|
3
3
|
import MineSites from "./components/MineSite/index.js";
|
|
4
4
|
import RisksWidget from "./components/RisksWidget/index.js";
|
|
5
|
+
import { useSources } from "../../../hooks/useSources.js";
|
|
6
|
+
import { renderBreadCrumbs } from "../../../../helpers/breadCrumbs.js";
|
|
5
7
|
import CustomIcon from "../../../core/components/Icon/CustomIcon.jsx";
|
|
6
8
|
import { Header, Multiselect } from "../../../../index.js";
|
|
7
9
|
import DashboardLayout from '../../../core/components/Dashboard/DashboardLayout/index.jsx';
|
|
@@ -14,23 +16,21 @@ export default function ConflictManagement({
|
|
|
14
16
|
getRedirectLink = (s) => s,
|
|
15
17
|
theme = {},
|
|
16
18
|
options = {},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
selectedPartners,
|
|
20
|
-
setSelectedPartners,
|
|
21
|
-
informationSources
|
|
19
|
+
breadcrumbs = [],
|
|
20
|
+
|
|
22
21
|
}) {
|
|
22
|
+
const { partners, selectedPartners, setSelectedPartners, informationSources } =
|
|
23
|
+
useSources({ user, t });
|
|
24
|
+
|
|
23
25
|
// const { pushPath } = useHistory();
|
|
24
26
|
|
|
25
27
|
// useEffect(() => {
|
|
26
28
|
// pushPath(`/app/conflict-management`);
|
|
27
29
|
// }, []);
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
// return renderBreadCrumbs({ t, view: "conflict-management", mod: APP, goTo });
|
|
33
|
-
// }, [t, APP, goTo]);
|
|
31
|
+
const breadCrumbs = useMemo(() => {
|
|
32
|
+
return renderBreadCrumbs({ t, view: "conflict-management", mod: APP, goTo });
|
|
33
|
+
}, [t, APP, goTo]);
|
|
34
34
|
|
|
35
35
|
const sourceOptions = useMemo(() => {
|
|
36
36
|
return partners.map((partner) => {
|
|
@@ -53,7 +53,7 @@ export default function ConflictManagement({
|
|
|
53
53
|
header={
|
|
54
54
|
<Header
|
|
55
55
|
title={t("conflict-management")}
|
|
56
|
-
breadcrumbs={
|
|
56
|
+
breadcrumbs={breadCrumbs}
|
|
57
57
|
supportText={
|
|
58
58
|
<>
|
|
59
59
|
{t("Supported by")}{" "}
|
|
@@ -39,6 +39,56 @@ function GenderDistribution({
|
|
|
39
39
|
|
|
40
40
|
const isEmpty = useMemo(() => Object.keys(data).filter((k) => !!data[k]).length === 0, [data]);
|
|
41
41
|
|
|
42
|
+
const getTooltipChildren = useCallback(
|
|
43
|
+
(item) => {
|
|
44
|
+
if (isTradeActions) {
|
|
45
|
+
if (isEmpty) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return renderTooltipJsx({
|
|
50
|
+
title: t("Role"),
|
|
51
|
+
items: [
|
|
52
|
+
{
|
|
53
|
+
label:
|
|
54
|
+
(options?.optionPositionSupplyChain || options?.positionSupplyChainOptions || [])?.find((o) => {
|
|
55
|
+
return o.value === item.key;
|
|
56
|
+
}).label || item.key,
|
|
57
|
+
value: data[item.key] || 0,
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
});
|
|
61
|
+
} else {
|
|
62
|
+
if (isEmpty) {
|
|
63
|
+
return renderTooltipJsx({
|
|
64
|
+
title: t("Gender"),
|
|
65
|
+
items: config.map((conf) => ({
|
|
66
|
+
label: t(conf.label),
|
|
67
|
+
value: 0,
|
|
68
|
+
})),
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const _config = config?.find((c) => c.key === item.key);
|
|
73
|
+
|
|
74
|
+
if (_config) {
|
|
75
|
+
return renderTooltipJsx({
|
|
76
|
+
title: t("Gender"),
|
|
77
|
+
items: [
|
|
78
|
+
{
|
|
79
|
+
label: t(_config.label),
|
|
80
|
+
value: `${Math.round(item.percent * 100)}%`,
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
[t, data, isTradeActions],
|
|
90
|
+
);
|
|
91
|
+
|
|
42
92
|
return (
|
|
43
93
|
<Widget
|
|
44
94
|
loading={loading}
|
|
@@ -60,52 +110,7 @@ function GenderDistribution({
|
|
|
60
110
|
isPie
|
|
61
111
|
t={t}
|
|
62
112
|
isEmpty={isEmpty}
|
|
63
|
-
getTooltipChildren={
|
|
64
|
-
if (isTradeActions) {
|
|
65
|
-
if (isEmpty) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return renderTooltipJsx({
|
|
70
|
-
title: t("Role"),
|
|
71
|
-
items: [
|
|
72
|
-
{
|
|
73
|
-
label:
|
|
74
|
-
(options?.optionPositionSupplyChain || options?.positionSupplyChainOptions || [])?.find((o) => {
|
|
75
|
-
return o.value === item.key;
|
|
76
|
-
}).label || item.key,
|
|
77
|
-
value: data[item.key] || 0,
|
|
78
|
-
},
|
|
79
|
-
],
|
|
80
|
-
});
|
|
81
|
-
} else {
|
|
82
|
-
if (isEmpty) {
|
|
83
|
-
return renderTooltipJsx({
|
|
84
|
-
title: t("Gender"),
|
|
85
|
-
items: config.map((conf) => ({
|
|
86
|
-
label: t(conf.label),
|
|
87
|
-
value: 0,
|
|
88
|
-
})),
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const _config = config?.find((c) => c.key === item.key);
|
|
93
|
-
|
|
94
|
-
if (_config) {
|
|
95
|
-
return renderTooltipJsx({
|
|
96
|
-
title: t("Gender"),
|
|
97
|
-
items: [
|
|
98
|
-
{
|
|
99
|
-
label: t(_config.label),
|
|
100
|
-
value: `${Math.round(item.percent * 100)}%`,
|
|
101
|
-
},
|
|
102
|
-
],
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return null;
|
|
107
|
-
}
|
|
108
|
-
}}
|
|
113
|
+
getTooltipChildren={getTooltipChildren}
|
|
109
114
|
/>
|
|
110
115
|
</div>
|
|
111
116
|
</Widget>
|
|
@@ -53,27 +53,27 @@ export function useIdentification({ data, theme = {}, options = {} }) {
|
|
|
53
53
|
yFieldKey: "value",
|
|
54
54
|
seriesField: "typeOfProduct",
|
|
55
55
|
color: allSeenProducts.map((_, index) => colors[index % colors.length]),
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
56
|
+
renderTooltipContent: (title, items) => {
|
|
57
|
+
if (Array.isArray(items) && items[0]) {
|
|
58
|
+
const title = items[0].title;
|
|
59
|
+
const values = graphData.filter((d) => d.date === title);
|
|
60
|
+
return {
|
|
61
|
+
title: "Products",
|
|
62
|
+
items: values.map((val) => {
|
|
63
|
+
return{
|
|
64
|
+
label: findOptions(val.typeOfProduct, options?.mineralOptions) || val.typeOfProduct,
|
|
65
|
+
color: colors[
|
|
66
|
+
allSeenProducts.indexOf(val.typeOfProduct) % colors.length
|
|
67
|
+
],
|
|
68
|
+
value: val.value.toLocaleString(),
|
|
69
|
+
}
|
|
70
|
+
}),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
return { title: "", items: [] };
|
|
74
|
+
},
|
|
75
75
|
};
|
|
76
76
|
}, [graphData, allSeenProducts, options.minerals]);
|
|
77
77
|
|
|
78
|
-
return
|
|
78
|
+
return chartConfig;
|
|
79
79
|
}
|
|
@@ -4,7 +4,6 @@ import LineChart from '../../../../../../../core/components/Charts/LineChart/ind
|
|
|
4
4
|
import { Select } from 'antd';
|
|
5
5
|
import { useIdentification } from './hook';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
|
-
import { findOptions } from '../../../../../../../../helpers/StringHelper.js';
|
|
8
7
|
|
|
9
8
|
function Identification({
|
|
10
9
|
selectedSources = {},
|
|
@@ -26,7 +25,7 @@ function Identification({
|
|
|
26
25
|
[t],
|
|
27
26
|
);
|
|
28
27
|
|
|
29
|
-
const
|
|
28
|
+
const chartConfig = useIdentification({ data, theme, options });
|
|
30
29
|
|
|
31
30
|
return (
|
|
32
31
|
<Widget
|
|
@@ -46,30 +45,7 @@ function Identification({
|
|
|
46
45
|
</>
|
|
47
46
|
}
|
|
48
47
|
>
|
|
49
|
-
<LineChart
|
|
50
|
-
{...chartConfig}
|
|
51
|
-
height="400px"
|
|
52
|
-
t={t}
|
|
53
|
-
renderTooltipContent={(title, items) => {
|
|
54
|
-
if (Array.isArray(items) && items[0]) {
|
|
55
|
-
const title = items[0].title;
|
|
56
|
-
const values = graphData.filter((d) => d.date === title);
|
|
57
|
-
return {
|
|
58
|
-
title: "Products",
|
|
59
|
-
items: values.map((val) => {
|
|
60
|
-
return{
|
|
61
|
-
label: findOptions(val.typeOfProduct, options?.mineralOptions) || val.typeOfProduct,
|
|
62
|
-
color: colors[
|
|
63
|
-
allSeenProducts.indexOf(val.typeOfProduct) % colors.length
|
|
64
|
-
],
|
|
65
|
-
value: val.value.toLocaleString(),
|
|
66
|
-
}
|
|
67
|
-
}),
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
return { title: "", items: [] };
|
|
71
|
-
}}
|
|
72
|
-
/>
|
|
48
|
+
<LineChart {...chartConfig} height="400px" t={t} />
|
|
73
49
|
</Widget>
|
|
74
50
|
)
|
|
75
51
|
}
|
|
@@ -5,6 +5,7 @@ import Header from '../../../core/components/Header/index.jsx';
|
|
|
5
5
|
import Multiselect from '../../../core/components/Select/MultiSelect/index.jsx';
|
|
6
6
|
import KeyIndicators from './components/KeyIndicators';
|
|
7
7
|
import SupplyChainMap from './components/SupplyChainMap';
|
|
8
|
+
import TradeRelationships from './components/TradeRelationships';
|
|
8
9
|
import ChartsContainer from './components/ChartsContainer';
|
|
9
10
|
|
|
10
11
|
function SupplyChain({
|
|
@@ -18,14 +18,13 @@ function DataChainOfCustody({
|
|
|
18
18
|
goTo = () => {},
|
|
19
19
|
options = {},
|
|
20
20
|
hardcodedData = [],
|
|
21
|
-
APP
|
|
22
21
|
}) {
|
|
23
22
|
const fetchConfig = useMemo(() => ({
|
|
24
23
|
...defaultFetchConfig,}),[],
|
|
25
24
|
);
|
|
26
25
|
const { data, loading } = useWidgetFetch({config: fetchConfig});
|
|
27
26
|
|
|
28
|
-
const mappedData = mapDataForChainOfCustody(Object.keys(data)?.length > 0 ? data : hardcodedData, options, goTo
|
|
27
|
+
const mappedData = mapDataForChainOfCustody(Object.keys(data)?.length > 0 ? data : hardcodedData, options, goTo);
|
|
29
28
|
|
|
30
29
|
return (
|
|
31
30
|
<Widget
|
|
@@ -9,29 +9,24 @@ const kycIcon = <CustomIcon name="KYC" color="#6C737F" width={18} height={18} />
|
|
|
9
9
|
const buildingIcon = <CustomIcon name="Building" color="#6C737F" width={18} height={18} />;
|
|
10
10
|
const individualIcon = <CustomIcon name="UserCircle" color="#6C737F" width={18} height={18} />;
|
|
11
11
|
const csIcon = <CustomIcon name="CivilSociety" color="#6C737F" width={18} height={18} />;
|
|
12
|
+
const leftIcon = (
|
|
13
|
+
<CustomIcon
|
|
14
|
+
name="WaziDarkIcon"
|
|
15
|
+
color={theme.colorPrimary8}
|
|
16
|
+
width={16}
|
|
17
|
+
height={16}
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
20
|
+
const middleIcon = (
|
|
21
|
+
<CustomIcon
|
|
22
|
+
name="WaziDarkIcon"
|
|
23
|
+
color={theme.colorPrimary2}
|
|
24
|
+
width={16}
|
|
25
|
+
height={16}
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
12
28
|
|
|
13
|
-
const
|
|
14
|
-
nashiriki: {
|
|
15
|
-
left: "NashirikiSmallLogo",
|
|
16
|
-
right: "NashirikiSmallLogo",
|
|
17
|
-
middle: "NashirikiSmallLogo",
|
|
18
|
-
},
|
|
19
|
-
wazi: {
|
|
20
|
-
left: "WaziDarkIcon",
|
|
21
|
-
right: "WaziDarkIcon",
|
|
22
|
-
middle: "WaziDarkIcon",
|
|
23
|
-
},
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const directionColors = {
|
|
27
|
-
left: theme.colorPrimary8,
|
|
28
|
-
right: "white",
|
|
29
|
-
middle: theme.colorPrimary2,
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const getDirectionIcon = (APP, direction) => {
|
|
33
|
-
return <CustomIcon name={directionIcons[APP][direction]} color={directionColors[direction]} width={16} height={16} />;
|
|
34
|
-
}
|
|
29
|
+
const rightIcon = <CustomIcon name="WaziDarkIcon" color="white" width={16} height={16} />;
|
|
35
30
|
|
|
36
31
|
const mapIcon = (category) => {
|
|
37
32
|
switch (category) {
|
|
@@ -50,7 +45,7 @@ const mapIcon = (category) => {
|
|
|
50
45
|
const leftBackground = theme.colorPrimary3;
|
|
51
46
|
const rightBackground = theme.colorPrimary6;
|
|
52
47
|
|
|
53
|
-
export const mapDataForChainOfCustody = (data = {}, options = {}, goTo = () => {}
|
|
48
|
+
export const mapDataForChainOfCustody = (data = {}, options = {}, goTo = () => {}) => {
|
|
54
49
|
const mapChildren = (items, type, parentId, isDirect = true) => {
|
|
55
50
|
return (items ?? []).map((item) => {
|
|
56
51
|
return {
|
|
@@ -59,7 +54,7 @@ export const mapDataForChainOfCustody = (data = {}, options = {}, goTo = () => {
|
|
|
59
54
|
name: item.name,
|
|
60
55
|
sources: parentId ? [parentId] : [],
|
|
61
56
|
subTitle: findOptions(item?.category, options?.categoriesOptions || options?.category || []),
|
|
62
|
-
leftIcon:
|
|
57
|
+
leftIcon: type === "client" ? rightIcon : leftIcon,
|
|
63
58
|
leftBackground: type === "client" ? rightBackground : leftBackground,
|
|
64
59
|
topIcon: mapIcon(item.category),
|
|
65
60
|
children: mapChildren(item.sources ?? item.clients ?? [], type, item.id, false),
|
|
@@ -76,7 +71,7 @@ export const mapDataForChainOfCustody = (data = {}, options = {}, goTo = () => {
|
|
|
76
71
|
number: 0,
|
|
77
72
|
name: data.name,
|
|
78
73
|
subTitle: findOptions(data?.category, options?.categoriesOptions || options?.category || []),
|
|
79
|
-
leftIcon:
|
|
74
|
+
leftIcon: middleIcon,
|
|
80
75
|
leftBackground: theme.colorPrimary10,
|
|
81
76
|
topIcon: mapIcon(data.category),
|
|
82
77
|
left: mapChildren(data.sources, "source", data.id),
|