datastake-daf 0.6.782 → 0.6.784
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 +400 -328
- package/dist/hooks/index.js +3 -1
- package/dist/pages/index.js +3035 -685
- package/dist/utils/index.js +22 -0
- package/package.json +1 -1
- package/src/@daf/core/components/Charts/BarChart/index.jsx +1 -1
- package/src/@daf/core/components/Dashboard/Map/ChainIcon/Markers/StakeholderMarker.js +9 -76
- package/src/@daf/core/components/Dashboard/Map/ChainIcon/index.js +116 -8
- package/src/@daf/core/components/Dashboard/Map/ChainIcon/utils.js +73 -17
- package/src/@daf/core/components/Dashboard/Map/helper.js +1 -0
- package/src/@daf/core/components/Dashboard/Map/hook.js +64 -29
- package/src/@daf/core/components/Dashboard/Map/style.js +20 -5
- package/src/@daf/core/components/Screens/BaseScreen/index.jsx +1 -0
- package/src/@daf/core/components/Select/MultiSelect/index.jsx +4 -2
- package/src/@daf/core/components/Select/MultiSelect/style.js +15 -0
- package/src/@daf/hooks/useGetQueryParams.js +3 -1
- package/src/@daf/pages/Dashboards/UserDashboard/components/ContributionsGraph/hook.js +6 -7
- package/src/@daf/pages/Dashboards/UserDashboard/components/ContributionsGraph/index.jsx +1 -1
- package/src/@daf/pages/Documents/config.js +5 -5
- package/src/@daf/pages/Events/Activities/columns.js +5 -0
- package/src/@daf/pages/Events/Activities/config.js +21 -17
- package/src/@daf/pages/Events/Incidents/columns.js +5 -0
- package/src/@daf/pages/Events/Incidents/config.js +14 -11
- package/src/@daf/pages/Events/columns.js +6 -0
- package/src/@daf/pages/Events/config.js +0 -16
- package/src/@daf/pages/Locations/MineSite/columns.js +5 -1
- package/src/@daf/pages/Locations/MineSite/config.js +21 -24
- package/src/@daf/pages/Partners/columns.js +3 -1
- package/src/@daf/pages/Partners/config.js +13 -9
- package/src/@daf/pages/Partners/create.jsx +5 -2
- package/src/@daf/pages/Partners/edit.jsx +4 -2
- package/src/@daf/pages/Stakeholders/Operators/columns.js +6 -0
- package/src/@daf/pages/Stakeholders/Operators/config.js +8 -8
- package/src/@daf/pages/Stakeholders/Workers/columns.js +19 -13
- package/src/@daf/pages/Stakeholders/Workers/config.js +8 -23
- package/src/@daf/pages/Summary/Minesite/index.jsx +6 -4
- package/src/@daf/pages/Summary/Operator/components/TradeRelationships/index.js +2 -0
- package/src/@daf/pages/Summary/Operator/index.jsx +6 -3
- package/src/@daf/pages/TablePage/index.jsx +8 -2
- package/src/@daf/pages/Template/components/LinkingTemplate/columns.js +95 -0
- package/src/@daf/pages/Template/components/LinkingTemplate/config.js +88 -0
- package/src/@daf/pages/Template/components/LinkingTemplate/index.jsx +121 -0
- package/src/@daf/pages/Template/index.jsx +10 -0
- package/src/@daf/pages/View/hooks/useCallToGetData.js +73 -0
- package/src/@daf/pages/View/hooks/usePrepareForm.js +86 -0
- package/src/@daf/pages/View/hooks/useSubmitSubject.js +40 -0
- package/src/@daf/pages/View/hooks/useViewActions.js +83 -0
- package/src/@daf/pages/View/hooks/useViewPermissions.js +74 -0
- package/src/@daf/pages/View/hooks/useViewUrlParams.js +93 -0
- package/src/@daf/pages/View/index.jsx +326 -0
- package/src/@daf/utils/object.js +3 -1
- package/src/constants/locales/en/translation.js +3 -0
- package/src/constants/locales/fr/translation.js +3 -0
- package/src/constants/locales/sp/translation.js +3 -0
- package/src/pages.js +4 -1
- package/src/utils.js +1 -1
- package/dist/style/datastake/mapbox-gl.css +0 -330
- package/src/@daf/hooks/useViewFormUrlParams.js +0 -84
|
@@ -7,6 +7,8 @@ const Style = styled.div`
|
|
|
7
7
|
width: 100%;
|
|
8
8
|
height: 472px;
|
|
9
9
|
|
|
10
|
+
|
|
11
|
+
|
|
10
12
|
.filter-cont {
|
|
11
13
|
position: absolute;
|
|
12
14
|
top: 24px;
|
|
@@ -109,11 +111,24 @@ const Style = styled.div`
|
|
|
109
111
|
align-items: center;
|
|
110
112
|
}
|
|
111
113
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
.marker-chain {
|
|
115
|
+
display: flex;
|
|
116
|
+
align-items: center;
|
|
117
|
+
justify-content: center;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.animated-polyline {
|
|
121
|
+
stroke-dasharray: 10 10;
|
|
122
|
+
animation: dash-flow 1.5s linear infinite;
|
|
123
|
+
stroke-linecap: round;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@keyframes dash-flow {
|
|
127
|
+
to {
|
|
128
|
+
stroke-dashoffset: -20;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
117
132
|
|
|
118
133
|
}
|
|
119
134
|
|
|
@@ -4,6 +4,7 @@ import PropTypes from "prop-types";
|
|
|
4
4
|
import { Avatar, Checkbox } from "antd";
|
|
5
5
|
import { theme } from "antd";
|
|
6
6
|
import React from "react";
|
|
7
|
+
import MultiSelectStyled from "./style";
|
|
7
8
|
const { useToken } = theme;
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -163,7 +164,7 @@ export default function Multiselect({
|
|
|
163
164
|
};
|
|
164
165
|
|
|
165
166
|
return (
|
|
166
|
-
<
|
|
167
|
+
<MultiSelectStyled
|
|
167
168
|
mode={isSingle ? undefined : "multiple"}
|
|
168
169
|
value={selectValue}
|
|
169
170
|
onChange={onSelectChange}
|
|
@@ -231,6 +232,7 @@ export default function Multiselect({
|
|
|
231
232
|
display: "flex",
|
|
232
233
|
alignItems: "center",
|
|
233
234
|
justifyContent: "center",
|
|
235
|
+
padding: 0,
|
|
234
236
|
}}
|
|
235
237
|
>
|
|
236
238
|
{option?.avatar || getFirstChar(option?.label)}
|
|
@@ -289,7 +291,7 @@ export default function Multiselect({
|
|
|
289
291
|
}
|
|
290
292
|
}}
|
|
291
293
|
{...restProps}
|
|
292
|
-
></
|
|
294
|
+
></MultiSelectStyled>
|
|
293
295
|
);
|
|
294
296
|
}
|
|
295
297
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { Select } from 'antd';
|
|
3
|
+
|
|
4
|
+
const MultiSelectStyled = styled(Select)`
|
|
5
|
+
&.ant-select-single {
|
|
6
|
+
.ant-select-selector {
|
|
7
|
+
padding-inline-end: 24px !important;
|
|
8
|
+
padding: 0 !important;
|
|
9
|
+
max-width: 56px !important;
|
|
10
|
+
width: 56px !important;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
export default MultiSelectStyled;
|
|
@@ -12,6 +12,7 @@ export const useContributionsGraph = ({
|
|
|
12
12
|
}, [data, t]);
|
|
13
13
|
|
|
14
14
|
const isEmpty = useMemo(() => _data?.length === 0, [_data]);
|
|
15
|
+
console.log({_data, isEmpty})
|
|
15
16
|
|
|
16
17
|
const chartConfig = useMemo(() => {
|
|
17
18
|
return {
|
|
@@ -20,13 +21,11 @@ export const useContributionsGraph = ({
|
|
|
20
21
|
yFieldKey: "category",
|
|
21
22
|
seriesField: "type",
|
|
22
23
|
isGroup: true,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
}),
|
|
24
|
+
xAxisConfig: isEmpty ? {
|
|
25
|
+
min: 0,
|
|
26
|
+
max: 10,
|
|
27
|
+
tickCount: 5,
|
|
28
|
+
} : {},
|
|
30
29
|
renderTooltipContent: (title, items) => {
|
|
31
30
|
const tooltipItems = items.map((item) => ({
|
|
32
31
|
label: item.name,
|
|
@@ -41,7 +41,7 @@ function ContributionsGraph({
|
|
|
41
41
|
title={t("Contributions")}
|
|
42
42
|
className="with-border-header h-w-btn-header no-px-body"
|
|
43
43
|
>
|
|
44
|
-
<BarChart {...chartConfig} height="400px" t={t} />
|
|
44
|
+
<BarChart {...chartConfig} height="400px" t={t} key={data?.length} />
|
|
45
45
|
</Widget>
|
|
46
46
|
)
|
|
47
47
|
}
|
|
@@ -14,6 +14,8 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
14
14
|
title: t('ID'),
|
|
15
15
|
ellipsis: true,
|
|
16
16
|
show: true,
|
|
17
|
+
key: "datastakeId",
|
|
18
|
+
sorter: () => 0 + 0,
|
|
17
19
|
render: (v, all) => {
|
|
18
20
|
if (all.empty) {
|
|
19
21
|
return <div className="daf-default-cell" />
|
|
@@ -27,6 +29,8 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
27
29
|
title: t('Title'),
|
|
28
30
|
ellipsis: true,
|
|
29
31
|
show: true,
|
|
32
|
+
key: "name",
|
|
33
|
+
sorter: () => 0 + 0,
|
|
30
34
|
render: (v, all) => {
|
|
31
35
|
if (all.empty) {
|
|
32
36
|
return <div className="daf-default-cell" />
|
|
@@ -39,6 +43,7 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
39
43
|
title: t("Date"),
|
|
40
44
|
dataIndex: "date",
|
|
41
45
|
key: "date",
|
|
46
|
+
sorter: () => 0 + 0,
|
|
42
47
|
render: (date, all) => {
|
|
43
48
|
if (all.empty) {
|
|
44
49
|
return <div className="daf-default-cell" />;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
export const getFiltersConfig = ({t}) => {
|
|
2
2
|
return {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
style: { flex: 1 },
|
|
3
|
+
timeframe: {
|
|
4
|
+
type: "timeframe",
|
|
5
|
+
label: "Timeframe",
|
|
6
|
+
style: { flex: 1 },
|
|
7
|
+
t: t,
|
|
9
8
|
},
|
|
10
9
|
country: {
|
|
11
10
|
type: 'select',
|
|
12
11
|
label: 'Country',
|
|
13
|
-
placeholder: (
|
|
12
|
+
placeholder: () => `${t('Filter by')} ${t('Country').toLowerCase()}`,
|
|
14
13
|
style: { flex: 1 },
|
|
15
14
|
labelStyle: { flex: 1 },
|
|
16
15
|
getLabel: (option) => option.label,
|
|
@@ -34,7 +33,7 @@ timeframe: {
|
|
|
34
33
|
|
|
35
34
|
return t('Province');
|
|
36
35
|
},
|
|
37
|
-
placeholder: (
|
|
36
|
+
placeholder: () => `${t('Filter by')} ${t('Province').toLowerCase()}`,
|
|
38
37
|
filters: (data) => ({
|
|
39
38
|
country: data.country,
|
|
40
39
|
level: 'level_1',
|
|
@@ -66,7 +65,7 @@ timeframe: {
|
|
|
66
65
|
return t('Province');
|
|
67
66
|
},
|
|
68
67
|
show: (data) => !(data.country && data.administrativeLevel1),
|
|
69
|
-
placeholder: (
|
|
68
|
+
placeholder: () => `${t('Filter by')} ${t('Territory').toLowerCase()}`,
|
|
70
69
|
filters: (data) => ({
|
|
71
70
|
country: data.country,
|
|
72
71
|
level: 'level_2',
|
|
@@ -82,7 +81,7 @@ timeframe: {
|
|
|
82
81
|
category: {
|
|
83
82
|
type: 'select',
|
|
84
83
|
label: 'Category',
|
|
85
|
-
placeholder: (
|
|
84
|
+
placeholder: () => `${t('Filter by')} ${t('Category').toLowerCase()}`,
|
|
86
85
|
style: { flex: 1 },
|
|
87
86
|
labelStyle: { flex: 1 },
|
|
88
87
|
getLabel: (option) => option.label,
|
|
@@ -106,7 +105,7 @@ timeframe: {
|
|
|
106
105
|
positionInTheMineralSupplyChain: {
|
|
107
106
|
type: 'select',
|
|
108
107
|
label: 'Position',
|
|
109
|
-
placeholder: (
|
|
108
|
+
placeholder: () => `${t('Filter by')} ${t('Position').toLowerCase()}`,
|
|
110
109
|
style: { flex: 1 },
|
|
111
110
|
labelStyle: { flex: 1 },
|
|
112
111
|
getLabel: (option) => option.label,
|
|
@@ -115,7 +114,7 @@ timeframe: {
|
|
|
115
114
|
status: {
|
|
116
115
|
type: "select",
|
|
117
116
|
label: "Status",
|
|
118
|
-
placeholder: (
|
|
117
|
+
placeholder: () => `${t("Filter by")} ${t("Status").toLowerCase()}`,
|
|
119
118
|
style: { flex: 1 },
|
|
120
119
|
labelStyle: { fley: 1 },
|
|
121
120
|
getLabel: (option) => option.label,
|
|
@@ -127,7 +126,6 @@ timeframe: {
|
|
|
127
126
|
export const getFilterOptions = (options, t) => {
|
|
128
127
|
const {
|
|
129
128
|
timeframe = [],
|
|
130
|
-
|
|
131
129
|
statusOptions = [],
|
|
132
130
|
categoryOptions = [],
|
|
133
131
|
countries = [],
|
|
@@ -139,21 +137,27 @@ export const getFilterOptions = (options, t) => {
|
|
|
139
137
|
administrativeLevel2,
|
|
140
138
|
positionInMineralSupplyChainOptions,
|
|
141
139
|
subCategoriesOptions,
|
|
142
|
-
|
|
140
|
+
eventCategoryOptions = [],
|
|
141
|
+
} = options || {};
|
|
142
|
+
|
|
143
|
+
const _categoryOptions = eventCategoryOptions?.map((item) => ({
|
|
144
|
+
value: item.value,
|
|
145
|
+
label: typeof item.label === 'object' ? Object.values(item.label)[1] : item.label,
|
|
146
|
+
}))
|
|
143
147
|
|
|
144
148
|
const _default = {
|
|
145
149
|
timeframe: timeframe,
|
|
146
150
|
status: [
|
|
147
151
|
{
|
|
148
152
|
value: "submitted",
|
|
149
|
-
label: "Submitted",
|
|
153
|
+
label: t("Submitted"),
|
|
150
154
|
},
|
|
151
155
|
{
|
|
152
156
|
value: "private",
|
|
153
|
-
label: "Private",
|
|
157
|
+
label: t("Private"),
|
|
154
158
|
},
|
|
155
159
|
],
|
|
156
|
-
category:
|
|
160
|
+
category: _categoryOptions,
|
|
157
161
|
country: countries,
|
|
158
162
|
subCategory: subCategoriesOptions,
|
|
159
163
|
// category: category,
|
|
@@ -14,6 +14,8 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
14
14
|
title: t('ID'),
|
|
15
15
|
ellipsis: true,
|
|
16
16
|
show: true,
|
|
17
|
+
key: "datastakeId",
|
|
18
|
+
sorter: () => 0 + 0,
|
|
17
19
|
render: (v, all) => {
|
|
18
20
|
if (all.empty) {
|
|
19
21
|
return <div className="daf-default-cell" />
|
|
@@ -27,6 +29,8 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
27
29
|
title: t('Title'),
|
|
28
30
|
ellipsis: true,
|
|
29
31
|
show: true,
|
|
32
|
+
key: "name",
|
|
33
|
+
sorter: () => 0 + 0,
|
|
30
34
|
render: (v, all) => {
|
|
31
35
|
if (all.empty) {
|
|
32
36
|
return <div className="daf-default-cell" />
|
|
@@ -39,6 +43,7 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
39
43
|
title: t("Date"),
|
|
40
44
|
dataIndex: "date",
|
|
41
45
|
key: "date",
|
|
46
|
+
sorter: () => 0 + 0,
|
|
42
47
|
render: (date, all) => {
|
|
43
48
|
if (all.empty) {
|
|
44
49
|
return <div className="daf-default-cell" />;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
export const getFiltersConfig = ({t}) => {
|
|
2
2
|
return {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
label: "Timeframe",
|
|
8
|
-
style: { flex: 1 },
|
|
3
|
+
timeframe: {
|
|
4
|
+
type: "timeframe",
|
|
5
|
+
label: "Timeframe",
|
|
6
|
+
style: { flex: 1 },
|
|
9
7
|
},
|
|
10
8
|
country: {
|
|
11
9
|
type: 'select',
|
|
@@ -127,7 +125,6 @@ timeframe: {
|
|
|
127
125
|
export const getFilterOptions = (options, t) => {
|
|
128
126
|
const {
|
|
129
127
|
timeframe = [],
|
|
130
|
-
|
|
131
128
|
statusOptions = [],
|
|
132
129
|
categoryOptions = [],
|
|
133
130
|
countries = [],
|
|
@@ -139,21 +136,27 @@ export const getFilterOptions = (options, t) => {
|
|
|
139
136
|
administrativeLevel2,
|
|
140
137
|
positionInMineralSupplyChainOptions,
|
|
141
138
|
subCategoriesOptions,
|
|
142
|
-
|
|
139
|
+
eventCategoryOptions = [],
|
|
140
|
+
} = options || {};
|
|
141
|
+
|
|
142
|
+
const _categoryOptions = eventCategoryOptions?.map((item) => ({
|
|
143
|
+
value: item.value,
|
|
144
|
+
label: typeof item.label === 'object' ? Object.values(item.label)[0] : item.label,
|
|
145
|
+
}))
|
|
143
146
|
|
|
144
147
|
const _default = {
|
|
145
148
|
timeframe: timeframe,
|
|
146
149
|
status: [
|
|
147
150
|
{
|
|
148
151
|
value: "submitted",
|
|
149
|
-
label: "Submitted",
|
|
152
|
+
label: t("Submitted"),
|
|
150
153
|
},
|
|
151
154
|
{
|
|
152
155
|
value: "private",
|
|
153
|
-
label: "Private",
|
|
156
|
+
label: t("Private"),
|
|
154
157
|
},
|
|
155
158
|
],
|
|
156
|
-
category:
|
|
159
|
+
category: _categoryOptions,
|
|
157
160
|
country: countries,
|
|
158
161
|
subCategory: subCategoriesOptions,
|
|
159
162
|
// category: category,
|
|
@@ -14,6 +14,8 @@ export const getColumns = ({ t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
14
14
|
title: t('ID'),
|
|
15
15
|
ellipsis: true,
|
|
16
16
|
show: true,
|
|
17
|
+
key: "datastakeId",
|
|
18
|
+
sorter: () => 0 + 0,
|
|
17
19
|
render: (v, all) => {
|
|
18
20
|
if (all.empty) {
|
|
19
21
|
return <div className="daf-default-cell" />
|
|
@@ -27,6 +29,8 @@ export const getColumns = ({ t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
27
29
|
title: t('Title'),
|
|
28
30
|
ellipsis: true,
|
|
29
31
|
show: true,
|
|
32
|
+
key: "name",
|
|
33
|
+
sorter: () => 0 + 0,
|
|
30
34
|
render: (v, all) => {
|
|
31
35
|
if (all.empty) {
|
|
32
36
|
return <div className="daf-default-cell" />
|
|
@@ -40,6 +44,8 @@ export const getColumns = ({ t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
40
44
|
title: t('Type'),
|
|
41
45
|
ellipsis: true,
|
|
42
46
|
show: true,
|
|
47
|
+
key: "typeOfEvent",
|
|
48
|
+
sorter: () => 0 + 0,
|
|
43
49
|
render: (v, all) => {
|
|
44
50
|
if (all.empty) {
|
|
45
51
|
return <div className="daf-default-cell" />
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export const getFiltersConfig = ({t}) => {
|
|
2
2
|
return {
|
|
3
|
-
|
|
4
3
|
timeframe: {
|
|
5
4
|
type: "timeframe",
|
|
6
5
|
label: "Timeframe",
|
|
@@ -86,21 +85,6 @@ export const getFiltersConfig = ({t}) => {
|
|
|
86
85
|
labelStyle: { flex: 1 },
|
|
87
86
|
getLabel: (option) => option.label,
|
|
88
87
|
getValue: (option) => option.value,
|
|
89
|
-
filterOptions: (val) => {
|
|
90
|
-
if (val) {
|
|
91
|
-
const { option, filters } = val
|
|
92
|
-
if (filters && option) {
|
|
93
|
-
const { filters: optionFilters } = option;
|
|
94
|
-
if (Array.isArray(optionFilters) && optionFilters.length) {
|
|
95
|
-
const { value, condition } = optionFilters[0];
|
|
96
|
-
if (condition === 'includes') {
|
|
97
|
-
return value.includes('corporation');
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return true;
|
|
103
|
-
},
|
|
104
88
|
},
|
|
105
89
|
category:{
|
|
106
90
|
type: 'select',
|
|
@@ -15,6 +15,8 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
15
15
|
title: t('ID'),
|
|
16
16
|
ellipsis: true,
|
|
17
17
|
show: true,
|
|
18
|
+
key: "datastakeId",
|
|
19
|
+
sorter: () => 0 + 0,
|
|
18
20
|
render: (v, all) => {
|
|
19
21
|
if (all.empty) {
|
|
20
22
|
return <div className="daf-default-cell" />
|
|
@@ -28,6 +30,8 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
28
30
|
title: t('Name'),
|
|
29
31
|
ellipsis: true,
|
|
30
32
|
show: true,
|
|
33
|
+
key: "name",
|
|
34
|
+
sorter: () => 0 + 0,
|
|
31
35
|
render: (v, all) => {
|
|
32
36
|
if (all.empty) {
|
|
33
37
|
return <div className="daf-default-cell" />
|
|
@@ -68,7 +72,7 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
68
72
|
},
|
|
69
73
|
{
|
|
70
74
|
dataIndex: 'category',
|
|
71
|
-
title: t('
|
|
75
|
+
title: t('type'),
|
|
72
76
|
ellipsis: true,
|
|
73
77
|
show: true,
|
|
74
78
|
render: (v, all) => {
|
|
@@ -3,7 +3,7 @@ export const getFiltersConfig = ({t}) => {
|
|
|
3
3
|
country: {
|
|
4
4
|
type: 'select',
|
|
5
5
|
label: 'Country',
|
|
6
|
-
placeholder: (
|
|
6
|
+
placeholder: () => `${t('Filter by')} ${t('Country').toLowerCase()}`,
|
|
7
7
|
style: { flex: 1 },
|
|
8
8
|
labelStyle: { flex: 1 },
|
|
9
9
|
getLabel: (option) => option.label,
|
|
@@ -27,7 +27,7 @@ export const getFiltersConfig = ({t}) => {
|
|
|
27
27
|
|
|
28
28
|
return t('Province');
|
|
29
29
|
},
|
|
30
|
-
placeholder: (
|
|
30
|
+
placeholder: () => `${t('Filter by')} ${t('Province').toLowerCase()}`,
|
|
31
31
|
filters: (data) => ({
|
|
32
32
|
country: data.country,
|
|
33
33
|
level: 'level_1',
|
|
@@ -59,7 +59,7 @@ export const getFiltersConfig = ({t}) => {
|
|
|
59
59
|
return t('Province');
|
|
60
60
|
},
|
|
61
61
|
show: (data) => !(data.country && data.administrativeLevel1),
|
|
62
|
-
placeholder: (
|
|
62
|
+
placeholder: () => `${t('Filter by')} ${t('Territory').toLowerCase()}`,
|
|
63
63
|
filters: (data) => ({
|
|
64
64
|
country: data.country,
|
|
65
65
|
level: 'level_2',
|
|
@@ -75,31 +75,25 @@ export const getFiltersConfig = ({t}) => {
|
|
|
75
75
|
product: {
|
|
76
76
|
type: 'select',
|
|
77
77
|
label: 'Product',
|
|
78
|
-
placeholder: (
|
|
78
|
+
placeholder: () => `${t('Filter by')} ${t('Product').toLowerCase()}`,
|
|
79
|
+
style: { flex: 1 },
|
|
80
|
+
labelStyle: { flex: 1 },
|
|
81
|
+
getLabel: (option) => option.label,
|
|
82
|
+
getValue: (option) => option.value,
|
|
83
|
+
},
|
|
84
|
+
type: {
|
|
85
|
+
type: 'select',
|
|
86
|
+
label: 'Type',
|
|
87
|
+
placeholder: () => `${t('Filter by')} ${t('Type').toLowerCase()}`,
|
|
79
88
|
style: { flex: 1 },
|
|
80
89
|
labelStyle: { flex: 1 },
|
|
81
90
|
getLabel: (option) => option.label,
|
|
82
91
|
getValue: (option) => option.value,
|
|
83
|
-
filterOptions: (val) => {
|
|
84
|
-
if (val) {
|
|
85
|
-
const { option, filters } = val
|
|
86
|
-
if (filters && option) {
|
|
87
|
-
const { filters: optionFilters } = option;
|
|
88
|
-
if (Array.isArray(optionFilters) && optionFilters.length) {
|
|
89
|
-
const { value, condition } = optionFilters[0];
|
|
90
|
-
if (condition === 'includes') {
|
|
91
|
-
return value.includes('corporation');
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return true;
|
|
97
|
-
},
|
|
98
92
|
},
|
|
99
93
|
positionInTheMineralSupplyChain: {
|
|
100
94
|
type: 'select',
|
|
101
95
|
label: 'Position',
|
|
102
|
-
placeholder: (
|
|
96
|
+
placeholder: () => `${t('Filter by')} ${t('Position').toLowerCase()}`,
|
|
103
97
|
style: { flex: 1 },
|
|
104
98
|
labelStyle: { flex: 1 },
|
|
105
99
|
getLabel: (option) => option.label,
|
|
@@ -108,7 +102,7 @@ export const getFiltersConfig = ({t}) => {
|
|
|
108
102
|
status: {
|
|
109
103
|
type: "select",
|
|
110
104
|
label: "Status",
|
|
111
|
-
placeholder: (
|
|
105
|
+
placeholder: () => `${t("Filter by")} ${t("Status").toLowerCase()}`,
|
|
112
106
|
style: { flex: 1 },
|
|
113
107
|
labelStyle: { fley: 1 },
|
|
114
108
|
getLabel: (option) => option.label,
|
|
@@ -129,23 +123,26 @@ export const getFilterOptions = (options, t) => {
|
|
|
129
123
|
stakeholderSubCategoriesOptions,
|
|
130
124
|
administrativeLevel1,
|
|
131
125
|
administrativeLevel2,
|
|
126
|
+
mineralOptions,
|
|
127
|
+
locationCategories = [],
|
|
132
128
|
} = options || {};
|
|
133
129
|
|
|
134
130
|
const _default = {
|
|
135
131
|
category: stakeholderCategoryOptions || categoryOptions,
|
|
136
132
|
country: countries,
|
|
137
|
-
product:
|
|
133
|
+
product: mineralOptions,
|
|
134
|
+
type: locationCategories,
|
|
138
135
|
administrativeLevel1,
|
|
139
136
|
administrativeLevel2,
|
|
140
137
|
subCategory: subCategoriesOptions,
|
|
141
138
|
status: [
|
|
142
139
|
{
|
|
143
140
|
value: "submitted",
|
|
144
|
-
label: "Submitted",
|
|
141
|
+
label: t("Submitted"),
|
|
145
142
|
},
|
|
146
143
|
{
|
|
147
144
|
value: "private",
|
|
148
|
-
label: "Private",
|
|
145
|
+
label: t("Private"),
|
|
149
146
|
},
|
|
150
147
|
],
|
|
151
148
|
}
|
|
@@ -4,7 +4,7 @@ import MoreMenu from '../../core/components/Table/MoreMenu/index.jsx';
|
|
|
4
4
|
import TooltipIcon from '../../core/components/Icon/TooltipIcon.jsx';
|
|
5
5
|
import { findOptions, camelCaseToTitle } from '../../../helpers/StringHelper.js';
|
|
6
6
|
import { copyToClipboard } from '../../../helpers/copyToClipboard.js';
|
|
7
|
-
import {
|
|
7
|
+
import { getPartnershipTypes, getPartnerTypes } from './config.js';
|
|
8
8
|
|
|
9
9
|
export const getColumns = ({
|
|
10
10
|
t,
|
|
@@ -63,6 +63,7 @@ export const getColumns = ({
|
|
|
63
63
|
return <div className="daf-default-cell" />;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
const partnershipTypes = getPartnershipTypes(t);
|
|
66
67
|
return partnershipTypes.find((v) => v.value === val)?.label || val || "-";
|
|
67
68
|
},
|
|
68
69
|
},
|
|
@@ -76,6 +77,7 @@ export const getColumns = ({
|
|
|
76
77
|
return <div className="daf-default-cell" />;
|
|
77
78
|
}
|
|
78
79
|
|
|
80
|
+
const partnerTypes = getPartnerTypes(t);
|
|
79
81
|
return partnerTypes.find((v) => v.value === val)?.label || val || "-";
|
|
80
82
|
},
|
|
81
83
|
},
|
|
@@ -20,13 +20,17 @@ export const checkboxConfig = {
|
|
|
20
20
|
datastakeId: "ID",
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
export const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
export const getPartnerTypes = (t) => {
|
|
24
|
+
return [
|
|
25
|
+
{ label: t("Individual"), value: "individual" },
|
|
26
|
+
{ label: t("Organisation"), value: "organisation" },
|
|
27
|
+
]
|
|
28
|
+
}
|
|
27
29
|
|
|
28
|
-
export const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
export const getPartnershipTypes = (t) => {
|
|
31
|
+
return [
|
|
32
|
+
{ label: t("Source"), value: "source" },
|
|
33
|
+
{ label: t("Client"), value: "client" },
|
|
34
|
+
{ label: t("Exchange"), value: "exchange" },
|
|
35
|
+
]
|
|
36
|
+
}
|
|
@@ -2,7 +2,7 @@ import React, { useMemo } from 'react'
|
|
|
2
2
|
import { message } from 'antd';
|
|
3
3
|
import PartnerService from '../../services/PartnerService.js';
|
|
4
4
|
import DynamicForm from '../../core/components/DynamicForm/index.jsx';
|
|
5
|
-
import {
|
|
5
|
+
import { getPartnerTypes, getPartnershipTypes } from './config.js';
|
|
6
6
|
|
|
7
7
|
const data = {};
|
|
8
8
|
|
|
@@ -22,6 +22,9 @@ const Create = ({
|
|
|
22
22
|
getApiBaseUrl = () => {},
|
|
23
23
|
}) => {
|
|
24
24
|
|
|
25
|
+
const partnerTypes = useMemo(() => getPartnerTypes(t), [t]);
|
|
26
|
+
const partnershipTypes = useMemo(() => getPartnershipTypes(t), [t]);
|
|
27
|
+
|
|
25
28
|
const form = useMemo(
|
|
26
29
|
() => ({
|
|
27
30
|
identification: {
|
|
@@ -49,7 +52,7 @@ const Create = ({
|
|
|
49
52
|
dataId: "partnerType",
|
|
50
53
|
options: partnerTypes.map((o) => ({ ...o, label: t(o.label) })),
|
|
51
54
|
rules: [{ required: true, message: "errors::field is required" }],
|
|
52
|
-
},
|
|
55
|
+
},
|
|
53
56
|
nickName: {
|
|
54
57
|
label: {
|
|
55
58
|
"partnerType is individual": t("Person name"),
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react'
|
|
1
|
+
import React, { useState, useEffect, useMemo } from 'react'
|
|
2
2
|
import { Form, Input, Select } from "antd";
|
|
3
3
|
import PartnerService from '../../services/PartnerService.js';
|
|
4
4
|
import Loading from '../../core/components/Loading/index.jsx';
|
|
5
5
|
import ProjectVisualisationFooter from '../../core/components/ProjectVisualisation/Footer.js';
|
|
6
|
-
import {
|
|
6
|
+
import { getPartnerTypes, getPartnershipTypes } from './config.js';
|
|
7
7
|
import { licensingOptions } from '../../core/components/DataStore/components/Settings/config.js';
|
|
8
8
|
|
|
9
9
|
const Edit = ({
|
|
@@ -14,6 +14,8 @@ const Edit = ({
|
|
|
14
14
|
}) => {
|
|
15
15
|
const [MainForm] = Form.useForm();
|
|
16
16
|
const [loading, setLoading] = useState(false);
|
|
17
|
+
const partnerTypes = useMemo(() => getPartnerTypes(t), [t]);
|
|
18
|
+
const partnershipTypes = useMemo(() => getPartnershipTypes(t), [t]);
|
|
17
19
|
|
|
18
20
|
useEffect(() => {
|
|
19
21
|
MainForm.setFieldsValue({ ...partner, licensing: 'no_citation' });
|