datastake-daf 0.6.816 → 0.6.817
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 +1196 -1285
- package/dist/pages/index.js +1315 -579
- package/dist/services/index.js +202 -0
- package/dist/utils/index.js +28 -0
- package/package.json +1 -1
- package/src/@daf/core/components/Charts/RadarChart/index.jsx +3 -12
- package/src/@daf/core/components/Charts/style.js +1 -2
- package/src/@daf/core/components/Dashboard/Map/ChainIcon/index.js +123 -104
- package/src/@daf/core/components/Dashboard/Widget/VegetationWidget/index.jsx +4 -0
- package/src/@daf/core/components/Table/index.jsx +11 -6
- package/src/@daf/pages/Events/Activities/columns.js +15 -11
- package/src/@daf/pages/Events/Incidents/columns.js +15 -11
- package/src/@daf/pages/Events/Testimonials/columns.js +173 -0
- package/src/@daf/pages/Events/Testimonials/config.js +175 -0
- package/src/@daf/pages/Events/columns.js +7 -3
- package/src/@daf/pages/Locations/ConflictAreas/columns.js +140 -0
- package/src/@daf/pages/Locations/ConflictAreas/config.js +41 -0
- package/src/@daf/pages/Locations/MineSite/columns.js +21 -12
- package/src/@daf/pages/Locations/MineSite/config.js +2 -1
- package/src/@daf/pages/Locations/columns.js +7 -3
- package/src/@daf/pages/Stakeholders/ArmedGroups/columns.js +110 -0
- package/src/@daf/pages/Stakeholders/ArmedGroups/config.js +41 -0
- package/src/@daf/pages/Stakeholders/Operators/columns.js +30 -14
- package/src/@daf/pages/Stakeholders/Workers/columns.js +23 -13
- package/src/@daf/pages/Stakeholders/columns.js +8 -4
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/BiodiversityHabitat/ObservedFauna.jsx +11 -6
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/MangroveGrowth/PlantedSpecies.jsx +10 -25
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/MangroveGrowth/SeedlingsHeight.jsx +13 -10
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/MangroveGrowth/VegetationHealth.jsx +4 -19
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/SoilWaterProfile/SoilType.jsx +10 -22
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/SoilWaterProfile/WaterQuality.jsx +10 -26
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/chartHelpers.js +0 -74
- package/src/@daf/pages/TablePage/config.js +1 -1
- package/src/@daf/pages/TablePage/helper.js +45 -0
- package/src/@daf/services/EventsService.js +115 -0
- package/src/@daf/services/LinkedSubjects.js +1 -0
- package/src/@daf/services/WorkersService.js +80 -0
- package/src/helpers/errorHandling.js +142 -74
- package/src/services.js +3 -1
- package/src/utils.js +1 -1
- package/dist/style/datastake/mapbox-gl.css +0 -330
|
@@ -117,19 +117,23 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
117
117
|
},
|
|
118
118
|
},
|
|
119
119
|
{
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
120
|
+
title: t("Sources"),
|
|
121
|
+
dataIndex: "sources",
|
|
122
|
+
key: "sources",
|
|
123
|
+
show: activeTab !== "own",
|
|
124
|
+
render: (val, all) => {
|
|
125
|
+
if (all.empty) {
|
|
126
|
+
return <div className="daf-default-cell" />;
|
|
127
|
+
}
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
if (!val || val?.length === 0) {
|
|
130
|
+
return "-";
|
|
131
|
+
}
|
|
130
132
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
+
const sources = sourceAvatarConfig(val, user, applications);
|
|
134
|
+
|
|
135
|
+
return <AvatarGroup items={sources} />;
|
|
136
|
+
},
|
|
133
137
|
},
|
|
134
138
|
{
|
|
135
139
|
title: t("Status"),
|
|
@@ -117,19 +117,23 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
117
117
|
},
|
|
118
118
|
},
|
|
119
119
|
{
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
120
|
+
title: t("Sources"),
|
|
121
|
+
dataIndex: "sources",
|
|
122
|
+
key: "sources",
|
|
123
|
+
show: activeTab !== "own",
|
|
124
|
+
render: (val, all) => {
|
|
125
|
+
if (all.empty) {
|
|
126
|
+
return <div className="daf-default-cell" />;
|
|
127
|
+
}
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
if (!val || val?.length === 0) {
|
|
130
|
+
return "-";
|
|
131
|
+
}
|
|
130
132
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
+
const sources = sourceAvatarConfig(val, user, applications);
|
|
134
|
+
|
|
135
|
+
return <AvatarGroup items={sources} />;
|
|
136
|
+
},
|
|
133
137
|
},
|
|
134
138
|
{
|
|
135
139
|
title: t("Status"),
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Tooltip, Tag } from 'antd';
|
|
3
|
+
import { findOptions, getLinkValue } from '../../../../helpers/StringHelper.js';
|
|
4
|
+
import { renderDateFormatted } from '../../../../helpers/Forms.js';
|
|
5
|
+
import AvatarGroup from '../../../core/components/AvatarGroup/index.jsx';
|
|
6
|
+
import sourceAvatarConfig from '../../../../helpers/sourceAvatarConfig.js';
|
|
7
|
+
import { getEventCategoryBySubject } from '../helper.js';
|
|
8
|
+
import { renderStatusTag } from '../../../utils/tags.js';
|
|
9
|
+
import NavigationAction from '../../../core/components/Table/NavigationAction/index.jsx';
|
|
10
|
+
|
|
11
|
+
export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data, applications}) => [
|
|
12
|
+
{
|
|
13
|
+
dataIndex: 'datastakeId',
|
|
14
|
+
title: t('ID'),
|
|
15
|
+
ellipsis: true,
|
|
16
|
+
show: true,
|
|
17
|
+
key: "datastakeId",
|
|
18
|
+
sorter: () => 0 + 0,
|
|
19
|
+
render: (v, all) => {
|
|
20
|
+
if (all.empty) {
|
|
21
|
+
return <div className="daf-default-cell" />
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return <Tooltip title={v}>{v}</Tooltip>;
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
dataIndex: 'name',
|
|
29
|
+
title: t('Title'),
|
|
30
|
+
ellipsis: true,
|
|
31
|
+
show: true,
|
|
32
|
+
key: "name",
|
|
33
|
+
sorter: () => 0 + 0,
|
|
34
|
+
render: (v, all) => {
|
|
35
|
+
if (all.empty) {
|
|
36
|
+
return <div className="daf-default-cell" />
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return <Tooltip title={v}>{v}</Tooltip>;
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
title: t("type"),
|
|
44
|
+
dataIndex: "typeOfTestimonials",
|
|
45
|
+
key: "typeOfTestimonials",
|
|
46
|
+
sorter: () => 0 + 0,
|
|
47
|
+
show: true,
|
|
48
|
+
render: (title, all) => {
|
|
49
|
+
if (all.empty) {
|
|
50
|
+
return <div className="daf-default-cell" />;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const type = findOptions(title, data?.options?.testimonialsType);
|
|
54
|
+
|
|
55
|
+
return type ? <Tooltip title={type}>{type}</Tooltip> : '-';
|
|
56
|
+
},
|
|
57
|
+
ellipsis: true,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
title: t("Date"),
|
|
61
|
+
dataIndex: "date",
|
|
62
|
+
key: "date",
|
|
63
|
+
sorter: () => 0 + 0,
|
|
64
|
+
render: (date, all) => {
|
|
65
|
+
if (all.empty) {
|
|
66
|
+
return <div className="daf-default-cell" />;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
|
|
70
|
+
return <Tooltip title={_date}>{_date}</Tooltip>;
|
|
71
|
+
},
|
|
72
|
+
ellipsis: true,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
dataIndex: 'mineSite',
|
|
76
|
+
title: t('Location'),
|
|
77
|
+
ellipsis: true,
|
|
78
|
+
show: true,
|
|
79
|
+
render: (v, all) => {
|
|
80
|
+
if (all.empty) {
|
|
81
|
+
return <div className="daf-default-cell" />
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// const country = findOptions(v, data?.options?.positionSupplyChainOptions);
|
|
85
|
+
const mineSite = all?.location?.name
|
|
86
|
+
|
|
87
|
+
return mineSite ? <Tooltip title={mineSite}>{mineSite}</Tooltip> : '-';
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
dataIndex: 'eventCategory',
|
|
92
|
+
title: t('Category'),
|
|
93
|
+
ellipsis: true,
|
|
94
|
+
show: true,
|
|
95
|
+
render: (v, all) => {
|
|
96
|
+
if (all.empty) {
|
|
97
|
+
return <div className="daf-default-cell" />
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const eventCategory = findOptions(v, data?.options?.eventCategoryOptions || data?.options?.categoryOptions);
|
|
101
|
+
const categoryValue = getEventCategoryBySubject(eventCategory, subject);
|
|
102
|
+
|
|
103
|
+
return categoryValue ? <Tooltip title={categoryValue}>{categoryValue}</Tooltip> : '-';
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
title: t("Sources"),
|
|
108
|
+
dataIndex: "sources",
|
|
109
|
+
key: "sources",
|
|
110
|
+
show: activeTab !== "own",
|
|
111
|
+
render: (val, all) => {
|
|
112
|
+
if (all.empty) {
|
|
113
|
+
return <div className="daf-default-cell" />;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (!val || val?.length === 0) {
|
|
117
|
+
return "-";
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const sources = sourceAvatarConfig(val, user, applications);
|
|
121
|
+
|
|
122
|
+
return <AvatarGroup items={sources} />;
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
title: t("Status"),
|
|
127
|
+
dataIndex: "status",
|
|
128
|
+
key: "status",
|
|
129
|
+
show: activeTab === "own",
|
|
130
|
+
render: (val, all) => {
|
|
131
|
+
if (all.empty) {
|
|
132
|
+
return <div className="daf-default-cell" />
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const _val = all?.published || all?.status === "submitted" ? "submitted" : val;
|
|
136
|
+
|
|
137
|
+
return renderStatusTag({ value: _val, t });
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
title: t("Last Update"),
|
|
142
|
+
dataIndex: "updatedAt",
|
|
143
|
+
key: "updatedAt",
|
|
144
|
+
render: (date, all) => {
|
|
145
|
+
if (all.empty) {
|
|
146
|
+
return <div className="daf-default-cell" />;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
|
|
150
|
+
return <Tooltip title={_date}>{_date}</Tooltip>;
|
|
151
|
+
},
|
|
152
|
+
ellipsis: true,
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
id: 'actions',
|
|
156
|
+
title: "",
|
|
157
|
+
width: 60,
|
|
158
|
+
render: (_, all) => {
|
|
159
|
+
if (all.empty) {
|
|
160
|
+
return <div className="daf-default-cell" />;
|
|
161
|
+
}
|
|
162
|
+
const onClick = () => {
|
|
163
|
+
let link = `/app/view/${subject}/${all.datastakeId}`;
|
|
164
|
+
if (activeTab === "shared") {
|
|
165
|
+
link += `?sourceId=${all?.authorId?.id}`;
|
|
166
|
+
}
|
|
167
|
+
goTo(getRedirectLink(link));
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
return <NavigationAction onClick={onClick} theme={theme} />;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
].filter((column) => column.show !== false);
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { getStatusOptions } from '../../../utils/filters';
|
|
2
|
+
|
|
3
|
+
export const getFiltersConfig = ({t}) => {
|
|
4
|
+
return {
|
|
5
|
+
timeframe: {
|
|
6
|
+
type: "timeframe",
|
|
7
|
+
label: "Timeframe",
|
|
8
|
+
style: { flex: 1 },
|
|
9
|
+
t: t,
|
|
10
|
+
},
|
|
11
|
+
country: {
|
|
12
|
+
type: 'select',
|
|
13
|
+
label: 'Country',
|
|
14
|
+
placeholder: () => `${t('Filter by')} ${t('Country').toLowerCase()}`,
|
|
15
|
+
style: { flex: 1 },
|
|
16
|
+
labelStyle: { flex: 1 },
|
|
17
|
+
getLabel: (option) => option.label,
|
|
18
|
+
getValue: (option) => option.value,
|
|
19
|
+
},
|
|
20
|
+
administrativeLevel1: {
|
|
21
|
+
type: 'ajaxSelect',
|
|
22
|
+
label: ({ t = (s) => s, options = {}, filters = {}, language = 'en' }) => {
|
|
23
|
+
const { administrativeLevel1 } = options;
|
|
24
|
+
|
|
25
|
+
if (administrativeLevel1) {
|
|
26
|
+
if (options.country) {
|
|
27
|
+
const _item = administrativeLevel1[filters.country];
|
|
28
|
+
if (_item) {
|
|
29
|
+
if (_item[language]) {
|
|
30
|
+
return _item[language]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return t('Province');
|
|
37
|
+
},
|
|
38
|
+
placeholder: () => `${t('Filter by')} ${t('Province').toLowerCase()}`,
|
|
39
|
+
filters: (data) => ({
|
|
40
|
+
country: data.country,
|
|
41
|
+
level: 'level_1',
|
|
42
|
+
}),
|
|
43
|
+
show: (data) => !data.country,
|
|
44
|
+
disabled: (data) => !data.country,
|
|
45
|
+
mapper: { label: "name", value: "id" },
|
|
46
|
+
method: 'getOptions',
|
|
47
|
+
entity: 'AdministrativeLevel',
|
|
48
|
+
style: { flex: 1 },
|
|
49
|
+
labelStyle: { flex: 1 },
|
|
50
|
+
},
|
|
51
|
+
administrativeLevel2: {
|
|
52
|
+
type: 'ajaxSelect',
|
|
53
|
+
label: ({ t = (s) => s, options = {}, filters = {}, language = 'en' }) => {
|
|
54
|
+
const { administrativeLevel2 } = options;
|
|
55
|
+
|
|
56
|
+
if (administrativeLevel2) {
|
|
57
|
+
if (options.country) {
|
|
58
|
+
const _item = administrativeLevel2[filters.country];
|
|
59
|
+
if (_item) {
|
|
60
|
+
if (_item[language]) {
|
|
61
|
+
return _item[language]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return t('Province');
|
|
68
|
+
},
|
|
69
|
+
show: (data) => !(data.country && data.administrativeLevel1),
|
|
70
|
+
placeholder: () => `${t('Filter by')} ${t('Territory').toLowerCase()}`,
|
|
71
|
+
filters: (data) => ({
|
|
72
|
+
country: data.country,
|
|
73
|
+
level: 'level_2',
|
|
74
|
+
administrativeLevel1: data.administrativeLevel1,
|
|
75
|
+
}),
|
|
76
|
+
disabled: (data) => !(data.country && data.administrativeLevel1),
|
|
77
|
+
mapper: { label: "name", value: "id" },
|
|
78
|
+
method: 'getOptions',
|
|
79
|
+
entity: 'AdministrativeLevel',
|
|
80
|
+
style: { flex: 1 },
|
|
81
|
+
labelStyle: { flex: 1 },
|
|
82
|
+
},
|
|
83
|
+
eventCategory: {
|
|
84
|
+
type: 'select',
|
|
85
|
+
label: 'Category',
|
|
86
|
+
placeholder: () => `${t('Filter by')} ${t('Category').toLowerCase()}`,
|
|
87
|
+
style: { flex: 1 },
|
|
88
|
+
labelStyle: { flex: 1 },
|
|
89
|
+
getLabel: (option) => option.label,
|
|
90
|
+
getValue: (option) => option.value,
|
|
91
|
+
filterOptions: (val) => {
|
|
92
|
+
if (val) {
|
|
93
|
+
const { option, filters } = val
|
|
94
|
+
if (filters && option) {
|
|
95
|
+
const { filters: optionFilters } = option;
|
|
96
|
+
if (Array.isArray(optionFilters) && optionFilters.length) {
|
|
97
|
+
const { value, condition } = optionFilters[0];
|
|
98
|
+
if (condition === 'includes') {
|
|
99
|
+
return value.includes('corporation');
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return true;
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
// positionInTheMineralSupplyChain: {
|
|
108
|
+
// type: 'select',
|
|
109
|
+
// label: 'Position',
|
|
110
|
+
// placeholder: () => `${t('Filter by')} ${t('Position').toLowerCase()}`,
|
|
111
|
+
// style: { flex: 1 },
|
|
112
|
+
// labelStyle: { flex: 1 },
|
|
113
|
+
// getLabel: (option) => option.label,
|
|
114
|
+
// getValue: (option) => option.value,
|
|
115
|
+
// },
|
|
116
|
+
status: {
|
|
117
|
+
type: "select",
|
|
118
|
+
label: "Status",
|
|
119
|
+
placeholder: () => `${t("Filter by")} ${t("Status").toLowerCase()}`,
|
|
120
|
+
style: { flex: 1 },
|
|
121
|
+
labelStyle: { fley: 1 },
|
|
122
|
+
getLabel: (option) => option.label,
|
|
123
|
+
getValue: (option) => option.value,
|
|
124
|
+
},
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export const getFilterOptions = (options, t) => {
|
|
129
|
+
const {
|
|
130
|
+
timeframe = [],
|
|
131
|
+
statusOptions,
|
|
132
|
+
categoryOptions,
|
|
133
|
+
countries,
|
|
134
|
+
subCategory,
|
|
135
|
+
category,
|
|
136
|
+
stakeholderCategoryOptions,
|
|
137
|
+
stakeholderSubCategoriesOptions,
|
|
138
|
+
administrativeLevel1,
|
|
139
|
+
administrativeLevel2,
|
|
140
|
+
positionInMineralSupplyChainOptions,
|
|
141
|
+
subCategoriesOptions,
|
|
142
|
+
eventCategoryOptions,
|
|
143
|
+
} = options || {};
|
|
144
|
+
|
|
145
|
+
const _categoryOptions = (eventCategoryOptions || categoryOptions || [])?.map((item) => ({
|
|
146
|
+
value: item.value,
|
|
147
|
+
label: typeof item.label === 'object' ? Object.values(item.label)[1] : item.label,
|
|
148
|
+
}))
|
|
149
|
+
|
|
150
|
+
const _default = {
|
|
151
|
+
timeframe: timeframe,
|
|
152
|
+
status: getStatusOptions(t) || [],
|
|
153
|
+
eventCategory: _categoryOptions || [],
|
|
154
|
+
country: countries || [],
|
|
155
|
+
subCategory: subCategoriesOptions || [],
|
|
156
|
+
// category: category,
|
|
157
|
+
administrativeLevel1,
|
|
158
|
+
administrativeLevel2,
|
|
159
|
+
// positionInTheMineralSupplyChain: positionInMineralSupplyChainOptions || [],
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return _default;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export const formConfig = {
|
|
166
|
+
namespace: 'testimonials',
|
|
167
|
+
view: 'testimonials',
|
|
168
|
+
scope: 'create',
|
|
169
|
+
formType: 'testimonial',
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export const viewConfig = {
|
|
173
|
+
title: "Testimonials",
|
|
174
|
+
createTitle: "New Testimonial",
|
|
175
|
+
}
|
|
@@ -147,13 +147,17 @@ export const getColumns = ({ t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
147
147
|
key: "sources",
|
|
148
148
|
show: activeTab !== "own",
|
|
149
149
|
render: (val, all) => {
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
if (all.empty) {
|
|
151
|
+
return <div className="daf-default-cell" />;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (!val || val?.length === 0) {
|
|
155
|
+
return "-";
|
|
152
156
|
}
|
|
153
157
|
|
|
154
158
|
const sources = sourceAvatarConfig(val, user, applications);
|
|
155
159
|
|
|
156
|
-
return <AvatarGroup items={sources}
|
|
160
|
+
return <AvatarGroup items={sources} />;
|
|
157
161
|
},
|
|
158
162
|
},
|
|
159
163
|
{
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Tooltip } from 'antd';
|
|
3
|
+
import { findOptions, getLinkValue } from '../../../../helpers/StringHelper.js';
|
|
4
|
+
import { renderDateFormatted } from '../../../../helpers/Forms.js';
|
|
5
|
+
import CustomIcon from '../../../core/components/Icon/CustomIcon.jsx';
|
|
6
|
+
import AvatarGroup from '../../../core/components/AvatarGroup/index.jsx';
|
|
7
|
+
import sourceAvatarConfig from '../../../../helpers/sourceAvatarConfig.js';
|
|
8
|
+
import MoreMenu from '../../../core/components/Table/MoreMenu/index.jsx';
|
|
9
|
+
import NavigationAction from '../../../core/components/Table/NavigationAction/index.jsx';
|
|
10
|
+
import { renderStatusTag } from '../../../utils/tags.js';
|
|
11
|
+
|
|
12
|
+
export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data, applications}) => [
|
|
13
|
+
{
|
|
14
|
+
dataIndex: 'datastakeId',
|
|
15
|
+
title: t('ID'),
|
|
16
|
+
ellipsis: true,
|
|
17
|
+
show: true,
|
|
18
|
+
key: "datastakeId",
|
|
19
|
+
sorter: () => 0 + 0,
|
|
20
|
+
render: (v, all) => {
|
|
21
|
+
if (all.empty) {
|
|
22
|
+
return <div className="daf-default-cell" />
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return <Tooltip title={v}>{v}</Tooltip>;
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
dataIndex: "name",
|
|
30
|
+
title: t('Name'),
|
|
31
|
+
ellipsis: true,
|
|
32
|
+
show: true,
|
|
33
|
+
key: "name",
|
|
34
|
+
sorter: () => 0 + 0,
|
|
35
|
+
render: (v, all) => {
|
|
36
|
+
if (all.empty) {
|
|
37
|
+
return <div className="daf-default-cell" />
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return <Tooltip title={v}>{v}</Tooltip>;
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
dataIndex: 'region',
|
|
45
|
+
title: findOptions(user?.company?.country, options?.administrativeLevel1)?.length > 2 ? findOptions(user?.company?.country, options?.administrativeLevel1) : t("Province"),
|
|
46
|
+
ellipsis: true,
|
|
47
|
+
show: true,
|
|
48
|
+
render: (v, all) => {
|
|
49
|
+
if (all.empty) {
|
|
50
|
+
return <div className="daf-default-cell" />
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const region = getLinkValue(all?.administrativeLevel1, all?.linking?.SCL);
|
|
54
|
+
|
|
55
|
+
return region ? <Tooltip title={region}>{region}</Tooltip> : '-';
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
dataIndex: 'territory',
|
|
60
|
+
title: findOptions(user?.company?.country, options?.administrativeLevel2)?.length > 2 ? findOptions(user?.company?.country, options?.administrativeLevel2) : t("Territory"),
|
|
61
|
+
ellipsis: true,
|
|
62
|
+
show: true,
|
|
63
|
+
render: (v, all) => {
|
|
64
|
+
if (all.empty) {
|
|
65
|
+
return <div className="daf-default-cell" />
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const district = getLinkValue(all?.administrativeLevel2, all?.linking?.SCL);
|
|
69
|
+
|
|
70
|
+
return district ? <Tooltip title={district}>{district}</Tooltip> : '-';
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
title: t("Last Update"),
|
|
75
|
+
dataIndex: "updatedAt",
|
|
76
|
+
key: "updatedAt",
|
|
77
|
+
render: (date, all) => {
|
|
78
|
+
if (all.empty) {
|
|
79
|
+
return <div className="daf-default-cell" />;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
|
|
83
|
+
return <Tooltip title={_date}>{_date}</Tooltip>;
|
|
84
|
+
},
|
|
85
|
+
ellipsis: true,
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
title: t("Sources"),
|
|
89
|
+
dataIndex: "sources",
|
|
90
|
+
key: "sources",
|
|
91
|
+
show: activeTab !== "own",
|
|
92
|
+
render: (val, all) => {
|
|
93
|
+
if (all.empty) {
|
|
94
|
+
return <div className="daf-default-cell" />;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (!val || val?.length === 0) {
|
|
98
|
+
return "-";
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const sources = sourceAvatarConfig(val, user, applications);
|
|
102
|
+
|
|
103
|
+
return <AvatarGroup items={sources} />;
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
title: t("Status"),
|
|
108
|
+
dataIndex: 'status',
|
|
109
|
+
ellipsis: true,
|
|
110
|
+
show: activeTab == "own",
|
|
111
|
+
render: (v, all) => {
|
|
112
|
+
if (all.empty) {
|
|
113
|
+
return <div className="daf-default-cell" />
|
|
114
|
+
}
|
|
115
|
+
const _val = all?.published || all?.status === "submitted" ? "submitted" : v;
|
|
116
|
+
|
|
117
|
+
return renderStatusTag({ value: _val, t });
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
id: 'actions',
|
|
122
|
+
title: "",
|
|
123
|
+
width: 60,
|
|
124
|
+
render: (_, all) => {
|
|
125
|
+
if (all.empty) {
|
|
126
|
+
return <div className="daf-default-cell" />;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const onClick = () => {
|
|
130
|
+
let link = `/app/view/${subject}/${all.datastakeId}`;
|
|
131
|
+
if (activeTab === "shared") {
|
|
132
|
+
link += `?sourceId=${all?.authorId?.id}`;
|
|
133
|
+
}
|
|
134
|
+
goTo(getRedirectLink(link));
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
return <NavigationAction onClick={onClick} theme={theme} />;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
].filter((column) => column.show !== false);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { getStatusOptions } from '../../../utils/filters';
|
|
2
|
+
|
|
3
|
+
export const getFiltersConfig = ({t}) => {
|
|
4
|
+
return {
|
|
5
|
+
status: {
|
|
6
|
+
type: "select",
|
|
7
|
+
label: "Status",
|
|
8
|
+
placeholder: () => `${t("Filter by")} ${t("Status").toLowerCase()}`,
|
|
9
|
+
style: { flex: 1 },
|
|
10
|
+
labelStyle: { fley: 1 },
|
|
11
|
+
getLabel: (option) => option.label,
|
|
12
|
+
getValue: (option) => option.value,
|
|
13
|
+
},
|
|
14
|
+
timeframe: {
|
|
15
|
+
type: "timeframe",
|
|
16
|
+
label: "Timeframe",
|
|
17
|
+
style: { flex: 1 },
|
|
18
|
+
},
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const getFilterOptions = (options, t) => {
|
|
23
|
+
const _default = {
|
|
24
|
+
status: getStatusOptions(t) || [],
|
|
25
|
+
timeframe: [],
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return _default;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const formConfig = {
|
|
32
|
+
namespace: 'conflict-areas',
|
|
33
|
+
view: ['scoping', 'new'],
|
|
34
|
+
scope: 'conflictAreaCreate',
|
|
35
|
+
formType: 'conflict-area',
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const viewConfig = {
|
|
39
|
+
title: "Conflict Areas",
|
|
40
|
+
createTitle: "New Conflict Area",
|
|
41
|
+
}
|
|
@@ -50,7 +50,11 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
50
50
|
return <div className="daf-default-cell" />
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
const locationCategories = [
|
|
53
|
+
const locationCategories = [
|
|
54
|
+
...(data?.options?.locationCategories || []),
|
|
55
|
+
...(options?.productionSiteCategories || []),
|
|
56
|
+
...(options?.locationCategories || [])
|
|
57
|
+
]
|
|
54
58
|
|
|
55
59
|
const category = findOptions(v, locationCategories);
|
|
56
60
|
|
|
@@ -145,20 +149,25 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
145
149
|
return renderStatusTag({ value: _val, t });
|
|
146
150
|
},
|
|
147
151
|
},
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
render: (v, all) => {
|
|
152
|
+
{
|
|
153
|
+
title: t("Sources"),
|
|
154
|
+
dataIndex: "sources",
|
|
155
|
+
key: "sources",
|
|
156
|
+
show: activeTab !== "own",
|
|
157
|
+
render: (val, all) => {
|
|
155
158
|
if (all.empty) {
|
|
156
|
-
|
|
159
|
+
return <div className="daf-default-cell" />;
|
|
157
160
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
+
|
|
162
|
+
if (!val || val?.length === 0) {
|
|
163
|
+
return "-";
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const sources = sourceAvatarConfig(val, user, applications);
|
|
167
|
+
|
|
168
|
+
return <AvatarGroup items={sources} />;
|
|
161
169
|
},
|
|
170
|
+
},
|
|
162
171
|
{
|
|
163
172
|
id: 'actions',
|
|
164
173
|
title: "",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getStatusOptions } from '../../../utils/filters';
|
|
2
2
|
|
|
3
|
-
export const getFiltersConfig = ({t}) => {
|
|
3
|
+
export const getFiltersConfig = ({t, screen}) => {
|
|
4
4
|
return {
|
|
5
5
|
country: {
|
|
6
6
|
type: 'select',
|
|
@@ -91,6 +91,7 @@ export const getFiltersConfig = ({t}) => {
|
|
|
91
91
|
labelStyle: { flex: 1 },
|
|
92
92
|
getLabel: (option) => option.label,
|
|
93
93
|
getValue: (option) => option.value,
|
|
94
|
+
show: () => screen === 'scl',
|
|
94
95
|
},
|
|
95
96
|
positionInTheMineralSupplyChain: {
|
|
96
97
|
type: 'select',
|