datastake-daf 0.6.831 → 0.6.832
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 +2251 -2197
- package/dist/hooks/index.js +8 -0
- package/dist/pages/index.js +2027 -358
- package/dist/services/index.js +8 -0
- package/dist/utils/index.js +1 -0
- package/package.json +1 -1
- package/src/@daf/core/components/Screens/ConflictManagement/components/KeyIndicators/config.js +106 -0
- package/src/@daf/core/components/Screens/ConflictManagement/components/KeyIndicators/index.js +47 -0
- package/src/@daf/core/components/Screens/ConflictManagement/components/MineSite/helper.js +3 -0
- package/src/@daf/core/components/Screens/ConflictManagement/components/MineSite/index.js +218 -0
- package/src/@daf/core/components/Screens/ConflictManagement/components/RisksWidget/components/IncidentsTime/hook.js +32 -0
- package/src/@daf/core/components/Screens/ConflictManagement/components/RisksWidget/components/IncidentsTime/index.js +73 -0
- package/src/@daf/core/components/Screens/ConflictManagement/components/RisksWidget/components/ProblemSolver/hook.js +86 -0
- package/src/@daf/core/components/Screens/ConflictManagement/components/RisksWidget/components/ProblemSolver/index.js +102 -0
- package/src/@daf/core/components/Screens/ConflictManagement/components/RisksWidget/components/TerritorialDistribution/config.js +34 -0
- package/src/@daf/core/components/Screens/ConflictManagement/components/RisksWidget/components/TerritorialDistribution/index.js +107 -0
- package/src/@daf/core/components/Screens/ConflictManagement/components/RisksWidget/config.js +5 -0
- package/src/@daf/core/components/Screens/ConflictManagement/components/RisksWidget/index.js +77 -0
- package/src/@daf/core/components/Screens/ConflictManagement/index.js +136 -0
- package/src/@daf/pages/Events/Testimonials/columns.js +1 -1
- package/src/@daf/pages/Events/columns.js +2 -3
- package/src/@daf/pages/Locations/columns.js +1 -1
- package/src/@daf/services/DashboardService.js +9 -0
- package/src/constants/locales/en/translation.js +1 -0
- package/src/pages.js +4 -1
- package/build/favicon.ico +0 -0
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/manifest.json +0 -25
- package/build/robots.txt +0 -3
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
import { useMemo, useState } from "react";
|
|
3
|
+
|
|
4
|
+
export default function useTerritorialDistribution({ t = (s)=>{s}, options = {} }) {
|
|
5
|
+
const [filters, setFilters] = useState({ filter1: 'all', filter2: 'all' });
|
|
6
|
+
|
|
7
|
+
const filtersConfig = useMemo((t) => ({
|
|
8
|
+
onApply: (val) => setFilters(val),
|
|
9
|
+
options: {
|
|
10
|
+
filter1: [{ label: t('All'), value: 'all' }],
|
|
11
|
+
filter2: [{ label: t('All'), value: 'all' }],
|
|
12
|
+
},
|
|
13
|
+
selectedFilters: filters,
|
|
14
|
+
type: 'small',
|
|
15
|
+
t,
|
|
16
|
+
}), [t, filters]);
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
filters,
|
|
20
|
+
filtersConfig,
|
|
21
|
+
setFilters,
|
|
22
|
+
t,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const getColors = (theme) => {
|
|
27
|
+
return [
|
|
28
|
+
theme.colorPrimary8,
|
|
29
|
+
theme.colorPrimary7,
|
|
30
|
+
theme.colorPrimary5,
|
|
31
|
+
theme.colorPrimary6,
|
|
32
|
+
theme.colorPrimary4,
|
|
33
|
+
]
|
|
34
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import React, { useMemo, useCallback } from 'react'
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { renderTooltipJsx } from '../../../../../../../../utils/tooltip.js';
|
|
4
|
+
import Widget from '../../../../../../../../core/components/Dashboard/Widget/index.jsx';
|
|
5
|
+
import Chart from '../../../../../../../../core/components/Charts/PieChart/chart.jsx';
|
|
6
|
+
import {useWidgetFetch} from '../../../../../../../../hooks/useWidgetFetch.js';
|
|
7
|
+
import { getColors } from './config.js';
|
|
8
|
+
import useTerritorialDistribution from './config.js';
|
|
9
|
+
|
|
10
|
+
function TerritorialDistribution({ selectedPartners = {}, loading: parentLoading = false, t = (s) => s, theme = {}, category = "conflict", selectedRange ,goTo = () => {}, getRedirectLink = () => {}}) {
|
|
11
|
+
const { filters, filtersConfig } = useTerritorialDistribution({ t });
|
|
12
|
+
const colors = getColors(theme);
|
|
13
|
+
|
|
14
|
+
const defaultFetchConfig = useMemo(
|
|
15
|
+
() => ({
|
|
16
|
+
url: "/territorial-distribution",
|
|
17
|
+
filters: {
|
|
18
|
+
...filters,
|
|
19
|
+
category,
|
|
20
|
+
period: selectedRange,
|
|
21
|
+
sources: selectedPartners?.partners || [],
|
|
22
|
+
},
|
|
23
|
+
defaultData: [],
|
|
24
|
+
stop: selectedPartners?.loading,
|
|
25
|
+
}),
|
|
26
|
+
[filters, category, selectedRange, selectedPartners],
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const { data, loading } = useWidgetFetch({ config: defaultFetchConfig });
|
|
30
|
+
|
|
31
|
+
const pieData = useMemo(() => {
|
|
32
|
+
if (!data || Array.isArray(data)) return [];
|
|
33
|
+
const all = Object.keys(data);
|
|
34
|
+
const totalEvents = all.reduce((acc, key) => acc + (data[key]?.events?.length || 0), 0);
|
|
35
|
+
|
|
36
|
+
return all
|
|
37
|
+
.sort((a, b) => (data[b]?.events?.length || 0) - (data[a]?.events?.length || 0))
|
|
38
|
+
.map((key, index) => {
|
|
39
|
+
const item = data[key];
|
|
40
|
+
return {
|
|
41
|
+
value: item?.events?.length,
|
|
42
|
+
label: item?.locationData?.name,
|
|
43
|
+
locationData: item?.locationData,
|
|
44
|
+
color: colors[index % colors.length],
|
|
45
|
+
percent: totalEvents ? (item?.events?.length / totalEvents) : 0,
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}, [data, colors]);
|
|
49
|
+
|
|
50
|
+
const isEmpty = !pieData.length;
|
|
51
|
+
|
|
52
|
+
const getTooltipChildren = useCallback((items) => {
|
|
53
|
+
const item = items[0];
|
|
54
|
+
|
|
55
|
+
return renderTooltipJsx({
|
|
56
|
+
title: item?.label || t("Undetermined"),
|
|
57
|
+
link: true,
|
|
58
|
+
onClickLink: () => {
|
|
59
|
+
if (item?.label) {
|
|
60
|
+
goTo(
|
|
61
|
+
`/app/incident?administrativeLevel1=${item?.locationData?.administrativeLevel1}&administrativeLevel2=${item?.locationData?.administrativeLevel2}&country=${item?.locationData?.country}`,
|
|
62
|
+
);
|
|
63
|
+
} else {
|
|
64
|
+
goTo("/app/incident");
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
items: [
|
|
68
|
+
{
|
|
69
|
+
label: t("Number of incidents"),
|
|
70
|
+
value: item?.value,
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
});
|
|
74
|
+
}, [t, goTo]);
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<Widget
|
|
78
|
+
loading={loading || parentLoading}
|
|
79
|
+
title={t("Territorial Distribution")}
|
|
80
|
+
className="with-border-header"
|
|
81
|
+
filtersConfig={filtersConfig}
|
|
82
|
+
>
|
|
83
|
+
<Chart
|
|
84
|
+
mouseXOffset={10}
|
|
85
|
+
mouseYOffset={10}
|
|
86
|
+
changeOpacityOnHover={false}
|
|
87
|
+
data={pieData}
|
|
88
|
+
doConstraints={false}
|
|
89
|
+
isPie
|
|
90
|
+
t={t}
|
|
91
|
+
isEmpty={isEmpty}
|
|
92
|
+
getTooltipChildren={getTooltipChildren}
|
|
93
|
+
/>
|
|
94
|
+
</Widget>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
TerritorialDistribution.propTypes = {
|
|
99
|
+
selectedPartners: PropTypes.object,
|
|
100
|
+
loading: PropTypes.bool,
|
|
101
|
+
t: PropTypes.func,
|
|
102
|
+
theme: PropTypes.object,
|
|
103
|
+
category: PropTypes.string,
|
|
104
|
+
selectedRange: PropTypes.string,
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export default TerritorialDistribution;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Select } from "antd";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import Widget from "../../../../Dashboard/Widget/index.jsx";
|
|
4
|
+
import IncidentsTime from "./components/IncidentsTime/index.js";
|
|
5
|
+
import TerritorialDistribution from "./components/TerritorialDistribution/index.js";
|
|
6
|
+
import ProblemSolver from "./components/ProblemSolver/index.js";
|
|
7
|
+
import { filterOptions } from "./config.js";
|
|
8
|
+
|
|
9
|
+
export default function RisksWidget({
|
|
10
|
+
title = "Analytics",
|
|
11
|
+
selectedPartners = {},
|
|
12
|
+
t = (s) => s,
|
|
13
|
+
goTo = () => {},
|
|
14
|
+
getRedirectLink = (s) => s,
|
|
15
|
+
theme = {},
|
|
16
|
+
APP,
|
|
17
|
+
options = {},
|
|
18
|
+
category = "conflict",
|
|
19
|
+
user = {},
|
|
20
|
+
}) {
|
|
21
|
+
const [range, setRange] = useState(filterOptions[0].value);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Widget
|
|
25
|
+
title={t(title)}
|
|
26
|
+
className="with-border-header month-select-header"
|
|
27
|
+
addedHeader={
|
|
28
|
+
<>
|
|
29
|
+
<div className="flex-1" />
|
|
30
|
+
<div>
|
|
31
|
+
<Select
|
|
32
|
+
value={range}
|
|
33
|
+
className="custom-select white month-select"
|
|
34
|
+
onChange={(val) => setRange(val)}
|
|
35
|
+
>
|
|
36
|
+
{filterOptions.map((o) => (
|
|
37
|
+
<Select.Option value={o.value} key={o.value}>
|
|
38
|
+
{t(o.label)}
|
|
39
|
+
</Select.Option>
|
|
40
|
+
))}
|
|
41
|
+
</Select>
|
|
42
|
+
</div>
|
|
43
|
+
</>
|
|
44
|
+
}
|
|
45
|
+
>
|
|
46
|
+
<div className="flex flex-row flex-col-mobile gap-6">
|
|
47
|
+
<IncidentsTime
|
|
48
|
+
selectedRange={range}
|
|
49
|
+
selectedPartners={selectedPartners}
|
|
50
|
+
t={t}
|
|
51
|
+
theme={theme}
|
|
52
|
+
goTo={goTo}
|
|
53
|
+
getRedirectLink={getRedirectLink}
|
|
54
|
+
options={options}
|
|
55
|
+
user={user}
|
|
56
|
+
/>
|
|
57
|
+
<TerritorialDistribution
|
|
58
|
+
category={category}
|
|
59
|
+
selectedRange={range}
|
|
60
|
+
selectedPartners={selectedPartners}
|
|
61
|
+
t={t}
|
|
62
|
+
theme={theme}
|
|
63
|
+
goTo={goTo}
|
|
64
|
+
getRedirectLink={getRedirectLink}
|
|
65
|
+
/>
|
|
66
|
+
<ProblemSolver
|
|
67
|
+
selectedRange={range}
|
|
68
|
+
selectedPartners={selectedPartners}
|
|
69
|
+
t={t}
|
|
70
|
+
theme={theme}
|
|
71
|
+
goTo={goTo}
|
|
72
|
+
getRedirectLink={getRedirectLink}
|
|
73
|
+
/>
|
|
74
|
+
</div>
|
|
75
|
+
</Widget>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import React, { useMemo, useEffect } from "react";
|
|
2
|
+
import Header from "../../Header/index.jsx";
|
|
3
|
+
import KeyIndicators from "./components/KeyIndicators/index.js";
|
|
4
|
+
import Multiselect from "../../Select/MultiSelect/index.jsx";
|
|
5
|
+
import MineSites from "./components/MineSite/index.js";
|
|
6
|
+
import RisksWidget from "./components/RisksWidget/index.js";
|
|
7
|
+
import { useSources } from "../../../../hooks/useSources.js";
|
|
8
|
+
import { renderBreadCrumbs } from "../../../../../helpers/breadCrumbs.js";
|
|
9
|
+
import CustomIcon from "../../Icon/CustomIcon.jsx";
|
|
10
|
+
|
|
11
|
+
export default function ConflictManagement({
|
|
12
|
+
t=()=>{},
|
|
13
|
+
user = {},
|
|
14
|
+
APP,
|
|
15
|
+
goTo = () => {},
|
|
16
|
+
getRedirectLink = (s) => s,
|
|
17
|
+
theme = {},
|
|
18
|
+
options = {}
|
|
19
|
+
}) {
|
|
20
|
+
const { partners, selectedPartners, setSelectedPartners, informationSources } =
|
|
21
|
+
useSources({ user, t });
|
|
22
|
+
|
|
23
|
+
// const { pushPath } = useHistory();
|
|
24
|
+
|
|
25
|
+
// useEffect(() => {
|
|
26
|
+
// pushPath(`/app/conflict-management`);
|
|
27
|
+
// }, []);
|
|
28
|
+
|
|
29
|
+
const breadCrumbs = useMemo(() => {
|
|
30
|
+
return renderBreadCrumbs({ t, view: "conflict-management", mod: APP, goTo });
|
|
31
|
+
}, [t, APP, goTo]);
|
|
32
|
+
|
|
33
|
+
const sourceOptions = useMemo(() => {
|
|
34
|
+
return partners.map((partner) => {
|
|
35
|
+
const isOwnData = partner.id === user?.company?.id;
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
label: partner.nickName,
|
|
39
|
+
value: partner.id,
|
|
40
|
+
avatar: isOwnData ? <span>OWN</span> : <CustomIcon name={"Search02"} width={14} height={14} />,
|
|
41
|
+
background: isOwnData ? theme.colorPrimary7 : undefined,
|
|
42
|
+
color: isOwnData ? "white" : undefined,
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
}, [partners, user, theme]);
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<div className="daf-analysis">
|
|
49
|
+
<Header
|
|
50
|
+
title={t("conflict-management")}
|
|
51
|
+
breadcrumbs={breadCrumbs}
|
|
52
|
+
supportText={
|
|
53
|
+
<>
|
|
54
|
+
{t("Supported by")}{" "}
|
|
55
|
+
<a
|
|
56
|
+
href="https://www.eeas.europa.eu/delegations/dr-congo-kinshasa_en?s=94"
|
|
57
|
+
target="_blank"
|
|
58
|
+
rel="noreferrer"
|
|
59
|
+
>
|
|
60
|
+
{t("European Union")}
|
|
61
|
+
</a>
|
|
62
|
+
</>
|
|
63
|
+
}
|
|
64
|
+
addedHeader={
|
|
65
|
+
<div>
|
|
66
|
+
<div className="flex-1" />
|
|
67
|
+
<Multiselect
|
|
68
|
+
options={[...sourceOptions]}
|
|
69
|
+
isAvatarGroup
|
|
70
|
+
canUnselectLast={false}
|
|
71
|
+
key={partners?.length}
|
|
72
|
+
onChange={(selected) => {
|
|
73
|
+
setSelectedPartners((prev) => ({
|
|
74
|
+
...prev,
|
|
75
|
+
partners: selected,
|
|
76
|
+
loading: false,
|
|
77
|
+
}));
|
|
78
|
+
}}
|
|
79
|
+
dropDownWidth={200}
|
|
80
|
+
selectionType="checkbox"
|
|
81
|
+
defaultSelected={partners.map((p) => p.id) || []}
|
|
82
|
+
/>
|
|
83
|
+
</div>
|
|
84
|
+
}
|
|
85
|
+
/>
|
|
86
|
+
|
|
87
|
+
<div className="content">
|
|
88
|
+
<div className="view-content">
|
|
89
|
+
<div className="daf-analysis-layout">
|
|
90
|
+
<div className="sections-cont w-pt">
|
|
91
|
+
<section>
|
|
92
|
+
<KeyIndicators
|
|
93
|
+
selectedPartners={selectedPartners}
|
|
94
|
+
partners={
|
|
95
|
+
informationSources > 0
|
|
96
|
+
? informationSources
|
|
97
|
+
: selectedPartners?.partners?.length > 0
|
|
98
|
+
? selectedPartners?.partners?.length
|
|
99
|
+
: 0
|
|
100
|
+
}
|
|
101
|
+
t={t}
|
|
102
|
+
goTo={goTo}
|
|
103
|
+
getRedirectLink={getRedirectLink}
|
|
104
|
+
theme={theme}
|
|
105
|
+
/>
|
|
106
|
+
</section>
|
|
107
|
+
<section>
|
|
108
|
+
<MineSites
|
|
109
|
+
selectedPartners={selectedPartners}
|
|
110
|
+
t={t}
|
|
111
|
+
goTo={goTo}
|
|
112
|
+
getRedirectLink={getRedirectLink}
|
|
113
|
+
theme={theme}
|
|
114
|
+
APP={APP}
|
|
115
|
+
options={options}
|
|
116
|
+
/>
|
|
117
|
+
</section>
|
|
118
|
+
<section>
|
|
119
|
+
<RisksWidget
|
|
120
|
+
selectedPartners={selectedPartners}
|
|
121
|
+
t={t}
|
|
122
|
+
goTo={goTo}
|
|
123
|
+
getRedirectLink={getRedirectLink}
|
|
124
|
+
theme={theme}
|
|
125
|
+
APP={APP}
|
|
126
|
+
options={options}
|
|
127
|
+
/>
|
|
128
|
+
</section>
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
</div>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
@@ -50,7 +50,7 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
50
50
|
return <div className="daf-default-cell" />;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
const type = findOptions(title,
|
|
53
|
+
const type = findOptions(title, options?.testimonialsType);
|
|
54
54
|
|
|
55
55
|
return type ? <Tooltip title={type}>{type}</Tooltip> : '-';
|
|
56
56
|
},
|
|
@@ -51,9 +51,8 @@ export const getColumns = ({ t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
51
51
|
return <div className="daf-default-cell" />
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
const type = findOptions(v,
|
|
55
|
-
|
|
56
|
-
return type ? <Tooltip title={type}>{type}</Tooltip> : '-';
|
|
54
|
+
const type = findOptions(v, options?.eventType || options?.eventsType);
|
|
55
|
+
return <Tooltip title={type}>{type}</Tooltip>;
|
|
57
56
|
},
|
|
58
57
|
},
|
|
59
58
|
{
|
|
@@ -43,7 +43,7 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
43
43
|
return <div className="daf-default-cell" />
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
const locationCategories = [...(
|
|
46
|
+
const locationCategories = [...(options?.locationCategories || []), ...(options?.productionSiteCategories || [])]
|
|
47
47
|
|
|
48
48
|
const category = findOptions(v, locationCategories);
|
|
49
49
|
|
|
@@ -24,6 +24,15 @@ class DashboardService extends BaseService {
|
|
|
24
24
|
isUserManager: true,
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
+
|
|
28
|
+
// getWidgetConflictManagement({ url, params = {}, filters = {} }) {
|
|
29
|
+
// return this.apiGet({
|
|
30
|
+
// url: `/dashboard/conflict-management${url}`,
|
|
31
|
+
// params: { ...params, ...filters },
|
|
32
|
+
// isApp: true,
|
|
33
|
+
// });
|
|
34
|
+
// }
|
|
35
|
+
|
|
27
36
|
}
|
|
28
37
|
|
|
29
38
|
export default createLazyService(DashboardService);
|
package/src/pages.js
CHANGED
|
@@ -20,4 +20,7 @@ export { default as UsersTable } from './@daf/core/components/Screens/Users/inde
|
|
|
20
20
|
export { default as View } from './@daf/pages/View/index.jsx';
|
|
21
21
|
|
|
22
22
|
// Edit
|
|
23
|
-
export { default as Edit } from './@daf/pages/Edit/index.jsx';
|
|
23
|
+
export { default as Edit } from './@daf/pages/Edit/index.jsx';
|
|
24
|
+
|
|
25
|
+
// Conflict Management
|
|
26
|
+
export { default as ConflictManagement } from './@daf/core/components/Screens/ConflictManagement/index.js';
|
package/build/favicon.ico
DELETED
|
Binary file
|
package/build/logo192.png
DELETED
|
Binary file
|
package/build/logo512.png
DELETED
|
Binary file
|
package/build/manifest.json
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"short_name": "React App",
|
|
3
|
-
"name": "Create React App Sample",
|
|
4
|
-
"icons": [
|
|
5
|
-
{
|
|
6
|
-
"src": "favicon.ico",
|
|
7
|
-
"sizes": "64x64 32x32 24x24 16x16",
|
|
8
|
-
"type": "image/x-icon"
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"src": "logo192.png",
|
|
12
|
-
"type": "image/png",
|
|
13
|
-
"sizes": "192x192"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"src": "logo512.png",
|
|
17
|
-
"type": "image/png",
|
|
18
|
-
"sizes": "512x512"
|
|
19
|
-
}
|
|
20
|
-
],
|
|
21
|
-
"start_url": ".",
|
|
22
|
-
"display": "standalone",
|
|
23
|
-
"theme_color": "#000000",
|
|
24
|
-
"background_color": "#ffffff"
|
|
25
|
-
}
|
package/build/robots.txt
DELETED