datastake-daf 0.6.815 → 0.6.816
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 +1703 -1578
- package/dist/pages/index.js +344 -685
- package/dist/style/datastake/mapbox-gl.css +330 -0
- package/dist/utils/index.js +0 -28
- package/package.json +1 -1
- package/src/@daf/core/components/Charts/RadarChart/index.jsx +12 -3
- package/src/@daf/core/components/Charts/style.js +2 -1
- package/src/@daf/core/components/Dashboard/Map/ChainIcon/index.js +104 -123
- package/src/@daf/core/components/Dashboard/Widget/VegetationWidget/index.jsx +0 -4
- package/src/@daf/core/components/Table/index.jsx +6 -11
- package/src/@daf/pages/Events/Activities/columns.js +11 -15
- package/src/@daf/pages/Events/Incidents/columns.js +11 -15
- package/src/@daf/pages/Events/columns.js +3 -7
- package/src/@daf/pages/Locations/MineSite/columns.js +11 -16
- package/src/@daf/pages/Locations/columns.js +3 -7
- package/src/@daf/pages/Stakeholders/Operators/columns.js +12 -16
- package/src/@daf/pages/Stakeholders/Workers/columns.js +12 -16
- package/src/@daf/pages/Stakeholders/columns.js +4 -8
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/BiodiversityHabitat/ObservedFauna.jsx +6 -11
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/MangroveGrowth/PlantedSpecies.jsx +25 -10
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/MangroveGrowth/SeedlingsHeight.jsx +10 -13
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/MangroveGrowth/VegetationHealth.jsx +19 -4
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/SoilWaterProfile/SoilType.jsx +22 -10
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/SoilWaterProfile/WaterQuality.jsx +26 -10
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/chartHelpers.js +74 -0
- package/src/@daf/pages/TablePage/helper.js +0 -15
- package/src/helpers/errorHandling.js +74 -142
- package/src/utils.js +1 -1
- package/src/@daf/pages/Events/Testimonials/columns.js +0 -173
- package/src/@daf/pages/Events/Testimonials/config.js +0 -175
|
@@ -1,173 +0,0 @@
|
|
|
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);
|
|
@@ -1,175 +0,0 @@
|
|
|
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
|
-
}
|