datastake-daf 0.6.748 → 0.6.749
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 +3979 -2782
- package/dist/pages/index.js +1305 -692
- package/package.json +1 -1
- package/src/@daf/core/components/Screens/Settings/Edit/components/Form/index.js +115 -0
- package/src/@daf/core/components/Screens/Settings/Edit/components/Form/style.js +35 -0
- package/src/@daf/core/components/Screens/Settings/Edit/components/Inputs/ImageUpload.js +67 -0
- package/src/@daf/core/components/Screens/Settings/Edit/components/Inputs/Phone.js +24 -0
- package/src/@daf/core/components/Screens/Settings/Edit/components/Inputs/ResetPassword.js +122 -0
- package/src/@daf/core/components/Screens/Settings/Edit/components/Inputs/Select.js +26 -0
- package/src/@daf/core/components/Screens/Settings/Edit/components/Inputs/Switch.js +56 -0
- package/src/@daf/core/components/Screens/Settings/Edit/components/Inputs/Text.js +19 -0
- package/src/@daf/core/components/Screens/Settings/Edit/components/Inputs/TransferRights.js +30 -0
- package/src/@daf/core/components/Screens/Settings/Edit/components/helper.js +13 -0
- package/src/@daf/core/components/Screens/Settings/Edit/components/style.js +56 -0
- package/src/@daf/core/components/Screens/Settings/Edit/index.js +63 -0
- package/src/@daf/core/components/Screens/Settings/View/components/Content/helper.js +142 -0
- package/src/@daf/core/components/Screens/Settings/View/components/Content/index.js +61 -0
- package/src/@daf/core/components/Screens/Settings/View/components/Content/style.js +338 -0
- package/src/@daf/core/components/Screens/Settings/View/index.js +46 -0
- package/src/@daf/core/components/Screens/Settings/components/Header/index.js +64 -0
- package/src/@daf/core/components/Screens/Settings/components/Menu/index.js +36 -0
- package/src/@daf/core/components/Screens/Settings/config.js +30 -0
- package/src/@daf/core/components/Screens/Settings/index.js +164 -0
- package/src/@daf/pages/Documents/columns.js +25 -8
- package/src/@daf/pages/Documents/config.js +7 -10
- package/src/@daf/pages/Events/Activities/columns.js +19 -9
- package/src/@daf/pages/Events/Activities/config.js +23 -13
- package/src/@daf/pages/Events/Incidents/columns.js +19 -9
- package/src/@daf/pages/Events/Incidents/config.js +23 -13
- package/src/@daf/pages/Events/columns.js +33 -8
- package/src/@daf/pages/Events/config.js +14 -22
- package/src/@daf/pages/Locations/MineSite/columns.js +53 -18
- package/src/@daf/pages/Locations/columns.js +54 -32
- package/src/@daf/pages/Locations/config.js +12 -2
- package/src/@daf/pages/Stakeholders/Operators/columns.js +57 -22
- package/src/@daf/pages/Stakeholders/columns.js +45 -23
- package/src/@daf/pages/Stakeholders/config.js +12 -2
- package/src/@daf/pages/Stakeholders/index.jsx +1 -0
- package/src/@daf/services/BaseService.js +15 -0
- package/src/index.js +9 -0
- 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
- package/dist/style/datastake/mapbox-gl.css +0 -330
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
// Base Settings Screen Component
|
|
2
|
+
import React, { useState, useCallback, useMemo, useEffect } from "react";
|
|
3
|
+
import SettingsView from "./View";
|
|
4
|
+
import SettingsEdit from "./Edit";
|
|
5
|
+
import { getDefaultActiveForm, ACTIVE_FORM_KEY } from "./config";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Base Settings Component
|
|
9
|
+
* Provides common settings screen functionality that applications can use or extend
|
|
10
|
+
*
|
|
11
|
+
* @param {Object} props
|
|
12
|
+
* @param {Object} props.sections - Settings sections configuration
|
|
13
|
+
* @param {Object} props.data - Current settings data
|
|
14
|
+
* @param {Function} props.onSave - Callback when saving settings
|
|
15
|
+
* @param {Function} props.onChange - Callback when data changes
|
|
16
|
+
* @param {Object} props.permissions - User permissions for settings
|
|
17
|
+
* @param {string} props.mode - 'view' or 'edit' mode
|
|
18
|
+
* @param {Function} props.onModeChange - Callback when mode changes (view <-> edit)
|
|
19
|
+
* @param {Object} props.customComponents - Custom input components to override defaults
|
|
20
|
+
* @param {string} props.defaultSection - Default active section key
|
|
21
|
+
* @param {Object} props.query - URL query parameters (for active section)
|
|
22
|
+
* @param {Function} props.t - Translation function (e.g., from react-i18next)
|
|
23
|
+
* @param {Function} props.renderHeader - Optional custom header render function
|
|
24
|
+
* @param {Function} props.renderMenu - Optional custom menu render function
|
|
25
|
+
*/
|
|
26
|
+
export default function Settings({
|
|
27
|
+
sections = {},
|
|
28
|
+
data = {},
|
|
29
|
+
onSave,
|
|
30
|
+
onChange,
|
|
31
|
+
permissions = {},
|
|
32
|
+
mode = 'view',
|
|
33
|
+
onModeChange,
|
|
34
|
+
customComponents = {},
|
|
35
|
+
defaultSection = 'user',
|
|
36
|
+
query = null,
|
|
37
|
+
t = (key) => key,
|
|
38
|
+
renderHeader,
|
|
39
|
+
renderMenu,
|
|
40
|
+
}) {
|
|
41
|
+
// Get active form from URL query or default
|
|
42
|
+
const activeFormKey = useMemo(() =>
|
|
43
|
+
getDefaultActiveForm(query, sections, defaultSection),
|
|
44
|
+
[query, sections, defaultSection]
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
const activeForm = useMemo(() =>
|
|
48
|
+
sections[activeFormKey],
|
|
49
|
+
[sections, activeFormKey]
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
const [isChanged, setIsChanged] = useState(false);
|
|
53
|
+
const [inputLoading, setInputLoading] = useState(false);
|
|
54
|
+
|
|
55
|
+
// Handle section change
|
|
56
|
+
const changeSection = useCallback((key) => {
|
|
57
|
+
if (onModeChange && typeof onModeChange === 'function') {
|
|
58
|
+
// If parent provides navigation, use it
|
|
59
|
+
onModeChange(mode, key);
|
|
60
|
+
}
|
|
61
|
+
}, [mode, onModeChange]);
|
|
62
|
+
|
|
63
|
+
// Navigate to view mode
|
|
64
|
+
const goToView = useCallback(() => {
|
|
65
|
+
if (onModeChange) {
|
|
66
|
+
onModeChange('view', activeFormKey);
|
|
67
|
+
}
|
|
68
|
+
}, [activeFormKey, onModeChange]);
|
|
69
|
+
|
|
70
|
+
// Navigate to edit mode
|
|
71
|
+
const goToEdit = useCallback(() => {
|
|
72
|
+
if (onModeChange) {
|
|
73
|
+
onModeChange('edit', activeFormKey);
|
|
74
|
+
}
|
|
75
|
+
}, [activeFormKey, onModeChange]);
|
|
76
|
+
|
|
77
|
+
// Handle save
|
|
78
|
+
const handleSave = useCallback(async () => {
|
|
79
|
+
if (onSave) {
|
|
80
|
+
try {
|
|
81
|
+
await onSave(data);
|
|
82
|
+
setIsChanged(false);
|
|
83
|
+
goToView();
|
|
84
|
+
} catch (error) {
|
|
85
|
+
console.error('Error saving settings:', error);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}, [data, onSave, goToView]);
|
|
89
|
+
|
|
90
|
+
// Handle cancel
|
|
91
|
+
const handleCancel = useCallback(() => {
|
|
92
|
+
setIsChanged(false);
|
|
93
|
+
goToView();
|
|
94
|
+
}, [goToView]);
|
|
95
|
+
|
|
96
|
+
// Handle data change
|
|
97
|
+
const handleChange = useCallback((newData) => {
|
|
98
|
+
setIsChanged(true);
|
|
99
|
+
if (onChange) {
|
|
100
|
+
onChange(newData);
|
|
101
|
+
}
|
|
102
|
+
}, [onChange]);
|
|
103
|
+
|
|
104
|
+
// Render based on mode
|
|
105
|
+
if (mode === 'edit') {
|
|
106
|
+
return (
|
|
107
|
+
<SettingsEdit
|
|
108
|
+
sections={sections}
|
|
109
|
+
activeForm={activeForm}
|
|
110
|
+
activeFormKey={activeFormKey}
|
|
111
|
+
data={data}
|
|
112
|
+
isChanged={isChanged}
|
|
113
|
+
onChange={handleChange}
|
|
114
|
+
onSave={handleSave}
|
|
115
|
+
onCancel={handleCancel}
|
|
116
|
+
setInputLoading={setInputLoading}
|
|
117
|
+
inputLoading={inputLoading}
|
|
118
|
+
permissions={permissions}
|
|
119
|
+
changeSection={changeSection}
|
|
120
|
+
goToView={goToView}
|
|
121
|
+
customComponents={customComponents}
|
|
122
|
+
renderHeader={renderHeader}
|
|
123
|
+
renderMenu={renderMenu}
|
|
124
|
+
t={t}
|
|
125
|
+
>
|
|
126
|
+
{/* Applications should wrap this component and provide their own header/menu/children */}
|
|
127
|
+
</SettingsEdit>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<SettingsView
|
|
133
|
+
sections={sections}
|
|
134
|
+
activeForm={activeForm}
|
|
135
|
+
activeFormKey={activeFormKey}
|
|
136
|
+
data={data}
|
|
137
|
+
permissions={permissions}
|
|
138
|
+
goToEdit={goToEdit}
|
|
139
|
+
goToView={goToView}
|
|
140
|
+
changeSection={changeSection}
|
|
141
|
+
customComponents={customComponents}
|
|
142
|
+
t={t}
|
|
143
|
+
>
|
|
144
|
+
{/* Applications should wrap this component and provide their own header/menu/children */}
|
|
145
|
+
</SettingsView>
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Named exports for direct use
|
|
150
|
+
export { default as SettingsView } from "./View";
|
|
151
|
+
export { default as SettingsEdit } from "./Edit";
|
|
152
|
+
|
|
153
|
+
// Optional exports for Header and Menu (require react-i18next and react-router-dom in the consuming app)
|
|
154
|
+
export { default as SettingsHeader } from "./components/Header";
|
|
155
|
+
export { default as SettingsMenu } from "./components/Menu";
|
|
156
|
+
|
|
157
|
+
// Configuration exports
|
|
158
|
+
export {
|
|
159
|
+
INPUT_TYPES,
|
|
160
|
+
ACTIVE_FORM_KEY,
|
|
161
|
+
PLACEHOLDER,
|
|
162
|
+
getDefaultActiveForm,
|
|
163
|
+
} from "./config";
|
|
164
|
+
|
|
@@ -5,7 +5,7 @@ import { renderDateFormatted } from '../../../helpers/Forms.js';
|
|
|
5
5
|
import CustomIcon from '../../core/components/Icon/CustomIcon.jsx';
|
|
6
6
|
import AvatarGroup from '../../core/components/AvatarGroup/index.jsx';
|
|
7
7
|
import sourceAvatarConfig from '../../../helpers/sourceAvatarConfig.js';
|
|
8
|
-
|
|
8
|
+
import MoreMenu from '../../core/components/Table/MoreMenu/index.jsx';
|
|
9
9
|
export const getColumns = ({ t, goTo, user, options, activeTab, getRedirectLink, theme, subject, applications }) => [
|
|
10
10
|
{
|
|
11
11
|
dataIndex: 'datastakeId',
|
|
@@ -89,13 +89,30 @@ export const getColumns = ({ t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
89
89
|
if (all.empty) {
|
|
90
90
|
return <div className="daf-default-cell" />;
|
|
91
91
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
92
|
+
const onClick = () => {
|
|
93
|
+
const link = `/app/view/${subject}/${all.datastakeId}`;
|
|
94
|
+
if (activeTab === "shared") {
|
|
95
|
+
link += `?sourceId=${all?.authorId?.id}`;
|
|
96
|
+
}
|
|
97
|
+
goTo(getRedirectLink(link));
|
|
98
|
+
};
|
|
99
|
+
const moreMenuItems = [
|
|
100
|
+
{
|
|
101
|
+
label: t("Details"),
|
|
102
|
+
value: "details",
|
|
103
|
+
onClick: onClick,
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
label: t("Remove"),
|
|
107
|
+
value: "remove",
|
|
108
|
+
onClick: () => {
|
|
109
|
+
console.log("remove");
|
|
110
|
+
},
|
|
111
|
+
disabled: true,
|
|
112
|
+
},
|
|
113
|
+
];
|
|
114
|
+
return <div >
|
|
115
|
+
<MoreMenu items={moreMenuItems} />
|
|
99
116
|
</div>;
|
|
100
117
|
}
|
|
101
118
|
}
|
|
@@ -5,14 +5,11 @@ export const checkboxConfig = {
|
|
|
5
5
|
|
|
6
6
|
export const getFiltersConfig = ({t}) => {
|
|
7
7
|
return {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
getLabel: (option) => option.label,
|
|
14
|
-
getValue: (option) => option.value,
|
|
15
|
-
},
|
|
8
|
+
timeframe: {
|
|
9
|
+
type: "timeframe",
|
|
10
|
+
label: "Timeframe",
|
|
11
|
+
style: { flex: 1 },
|
|
12
|
+
},
|
|
16
13
|
}
|
|
17
14
|
}
|
|
18
15
|
|
|
@@ -22,9 +19,9 @@ export const filtersConfig = {
|
|
|
22
19
|
};
|
|
23
20
|
|
|
24
21
|
export const getFilterOptions = (options, t) => {
|
|
25
|
-
const {
|
|
22
|
+
const { timeframe = [] } = options || {};
|
|
26
23
|
const _default = {
|
|
27
|
-
|
|
24
|
+
timeframe: timeframe,
|
|
28
25
|
}
|
|
29
26
|
|
|
30
27
|
return _default;
|
|
@@ -5,7 +5,7 @@ import { renderDateFormatted } from '../../../../helpers/Forms.js';
|
|
|
5
5
|
import CustomIcon from '../../../core/components/Icon/CustomIcon.jsx';
|
|
6
6
|
import AvatarGroup from '../../../core/components/AvatarGroup/index.jsx';
|
|
7
7
|
import sourceAvatarConfig from '../../../../helpers/sourceAvatarConfig.js';
|
|
8
|
-
|
|
8
|
+
import MoreMenu from '../../../core/components/Table/MoreMenu/index.jsx';
|
|
9
9
|
const getLinkValue = (value, linkingObject) => {
|
|
10
10
|
if(linkingObject && linkingObject?.[value]) {
|
|
11
11
|
return linkingObject?.[value]?.name;
|
|
@@ -209,14 +209,24 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
209
209
|
if (all.empty) {
|
|
210
210
|
return <div className="daf-default-cell" />;
|
|
211
211
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
212
|
+
const onClick = () => {
|
|
213
|
+
const link = `/app/view/${subject}/${all.datastakeId}`;
|
|
214
|
+
if (activeTab === "shared") {
|
|
215
|
+
link += `?sourceId=${all?.authorId?.id}`;
|
|
216
|
+
}
|
|
217
|
+
goTo(getRedirectLink(link));
|
|
218
|
+
};
|
|
219
|
+
const moreMenuItems = [
|
|
220
|
+
{
|
|
221
|
+
label: t("Details"),
|
|
222
|
+
value: "details",
|
|
223
|
+
onClick: onClick,
|
|
224
|
+
},
|
|
225
|
+
|
|
226
|
+
];
|
|
227
|
+
return <div >
|
|
228
|
+
<MoreMenu items={moreMenuItems} />
|
|
229
|
+
</div>;
|
|
220
230
|
}
|
|
221
231
|
}
|
|
222
232
|
].filter((column) => column.show !== false);
|
|
@@ -5,15 +5,22 @@ export const checkboxConfig = {
|
|
|
5
5
|
|
|
6
6
|
export const getFiltersConfig = ({t}) => {
|
|
7
7
|
return {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
getLabel: (option) => option.label,
|
|
15
|
-
getValue: (option) => option.value,
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
timeframe: {
|
|
11
|
+
type: "timeframe",
|
|
12
|
+
label: "Timeframe",
|
|
13
|
+
style: { flex: 1 },
|
|
16
14
|
},
|
|
15
|
+
country: {
|
|
16
|
+
type: 'select',
|
|
17
|
+
label: 'Country',
|
|
18
|
+
placeholder: (t) => `${t('Filter by')} ${t('Country').toLowerCase()}`,
|
|
19
|
+
style: { flex: 1 },
|
|
20
|
+
labelStyle: { flex: 1 },
|
|
21
|
+
getLabel: (option) => option.label,
|
|
22
|
+
getValue: (option) => option.value,
|
|
23
|
+
},
|
|
17
24
|
administrativeLevel1: {
|
|
18
25
|
type: 'ajaxSelect',
|
|
19
26
|
label: ({ t = (s) => s, options = {}, filters = {}, language = 'en' }) => {
|
|
@@ -77,10 +84,10 @@ export const getFiltersConfig = ({t}) => {
|
|
|
77
84
|
style: { flex: 1 },
|
|
78
85
|
labelStyle: { flex: 1 },
|
|
79
86
|
},
|
|
80
|
-
|
|
87
|
+
category: {
|
|
81
88
|
type: 'select',
|
|
82
|
-
label: '
|
|
83
|
-
placeholder: (t) => `${t('Filter by')} ${t('
|
|
89
|
+
label: 'Category',
|
|
90
|
+
placeholder: (t) => `${t('Filter by')} ${t('Category').toLowerCase()}`,
|
|
84
91
|
style: { flex: 1 },
|
|
85
92
|
labelStyle: { flex: 1 },
|
|
86
93
|
getLabel: (option) => option.label,
|
|
@@ -129,11 +136,13 @@ export const filtersConfig = {
|
|
|
129
136
|
|
|
130
137
|
export const getFilterOptions = (options, t) => {
|
|
131
138
|
const {
|
|
139
|
+
timeframe = [],
|
|
140
|
+
|
|
132
141
|
statusOptions = [],
|
|
133
142
|
categoryOptions = [],
|
|
134
143
|
countries = [],
|
|
135
144
|
subCategory = [],
|
|
136
|
-
|
|
145
|
+
category = [],
|
|
137
146
|
stakeholderCategoryOptions,
|
|
138
147
|
stakeholderSubCategoriesOptions,
|
|
139
148
|
administrativeLevel1,
|
|
@@ -143,6 +152,7 @@ export const getFilterOptions = (options, t) => {
|
|
|
143
152
|
} = options || {};
|
|
144
153
|
|
|
145
154
|
const _default = {
|
|
155
|
+
timeframe: timeframe,
|
|
146
156
|
status: [
|
|
147
157
|
{
|
|
148
158
|
value: "submitted",
|
|
@@ -156,7 +166,7 @@ export const getFilterOptions = (options, t) => {
|
|
|
156
166
|
category: stakeholderCategoryOptions || categoryOptions,
|
|
157
167
|
country: countries,
|
|
158
168
|
subCategory: subCategoriesOptions,
|
|
159
|
-
|
|
169
|
+
category: category,
|
|
160
170
|
administrativeLevel1,
|
|
161
171
|
administrativeLevel2,
|
|
162
172
|
positionInTheMineralSupplyChain: positionInMineralSupplyChainOptions,
|
|
@@ -5,7 +5,7 @@ import { renderDateFormatted } from '../../../../helpers/Forms.js';
|
|
|
5
5
|
import CustomIcon from '../../../core/components/Icon/CustomIcon.jsx';
|
|
6
6
|
import AvatarGroup from '../../../core/components/AvatarGroup/index.jsx';
|
|
7
7
|
import sourceAvatarConfig from '../../../../helpers/sourceAvatarConfig.js';
|
|
8
|
-
|
|
8
|
+
import MoreMenu from '../../../core/components/Table/MoreMenu/index.jsx';
|
|
9
9
|
const getLinkValue = (value, linkingObject) => {
|
|
10
10
|
if(linkingObject && linkingObject?.[value]) {
|
|
11
11
|
return linkingObject?.[value]?.name;
|
|
@@ -208,14 +208,24 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
208
208
|
if (all.empty) {
|
|
209
209
|
return <div className="daf-default-cell" />;
|
|
210
210
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
211
|
+
const onClick = () => {
|
|
212
|
+
const link = `/app/view/${subject}/${all.datastakeId}`;
|
|
213
|
+
if (activeTab === "shared") {
|
|
214
|
+
link += `?sourceId=${all?.authorId?.id}`;
|
|
215
|
+
}
|
|
216
|
+
goTo(getRedirectLink(link));
|
|
217
|
+
};
|
|
218
|
+
const moreMenuItems = [
|
|
219
|
+
{
|
|
220
|
+
label: t("Details"),
|
|
221
|
+
value: "details",
|
|
222
|
+
onClick: onClick,
|
|
223
|
+
},
|
|
224
|
+
|
|
225
|
+
];
|
|
226
|
+
return <div >
|
|
227
|
+
<MoreMenu items={moreMenuItems} />
|
|
228
|
+
</div>;
|
|
219
229
|
}
|
|
220
230
|
}
|
|
221
231
|
].filter((column) => column.show !== false);
|
|
@@ -5,15 +5,22 @@ export const checkboxConfig = {
|
|
|
5
5
|
|
|
6
6
|
export const getFiltersConfig = ({t}) => {
|
|
7
7
|
return {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
getLabel: (option) => option.label,
|
|
15
|
-
getValue: (option) => option.value,
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
timeframe: {
|
|
11
|
+
type: "timeframe",
|
|
12
|
+
label: "Timeframe",
|
|
13
|
+
style: { flex: 1 },
|
|
16
14
|
},
|
|
15
|
+
country: {
|
|
16
|
+
type: 'select',
|
|
17
|
+
label: 'Country',
|
|
18
|
+
placeholder: (t) => `${t('Filter by')} ${t('Country').toLowerCase()}`,
|
|
19
|
+
style: { flex: 1 },
|
|
20
|
+
labelStyle: { flex: 1 },
|
|
21
|
+
getLabel: (option) => option.label,
|
|
22
|
+
getValue: (option) => option.value,
|
|
23
|
+
},
|
|
17
24
|
administrativeLevel1: {
|
|
18
25
|
type: 'ajaxSelect',
|
|
19
26
|
label: ({ t = (s) => s, options = {}, filters = {}, language = 'en' }) => {
|
|
@@ -77,10 +84,10 @@ export const getFiltersConfig = ({t}) => {
|
|
|
77
84
|
style: { flex: 1 },
|
|
78
85
|
labelStyle: { flex: 1 },
|
|
79
86
|
},
|
|
80
|
-
|
|
87
|
+
category: {
|
|
81
88
|
type: 'select',
|
|
82
|
-
label: '
|
|
83
|
-
placeholder: (t) => `${t('Filter by')} ${t('
|
|
89
|
+
label: 'Category',
|
|
90
|
+
placeholder: (t) => `${t('Filter by')} ${t('Category').toLowerCase()}`,
|
|
84
91
|
style: { flex: 1 },
|
|
85
92
|
labelStyle: { flex: 1 },
|
|
86
93
|
getLabel: (option) => option.label,
|
|
@@ -129,11 +136,13 @@ export const filtersConfig = {
|
|
|
129
136
|
|
|
130
137
|
export const getFilterOptions = (options, t) => {
|
|
131
138
|
const {
|
|
139
|
+
timeframe = [],
|
|
140
|
+
|
|
132
141
|
statusOptions = [],
|
|
133
142
|
categoryOptions = [],
|
|
134
143
|
countries = [],
|
|
135
144
|
subCategory = [],
|
|
136
|
-
|
|
145
|
+
category = [],
|
|
137
146
|
stakeholderCategoryOptions,
|
|
138
147
|
stakeholderSubCategoriesOptions,
|
|
139
148
|
administrativeLevel1,
|
|
@@ -143,6 +152,7 @@ export const getFilterOptions = (options, t) => {
|
|
|
143
152
|
} = options || {};
|
|
144
153
|
|
|
145
154
|
const _default = {
|
|
155
|
+
timeframe: timeframe,
|
|
146
156
|
status: [
|
|
147
157
|
{
|
|
148
158
|
value: "submitted",
|
|
@@ -156,7 +166,7 @@ export const getFilterOptions = (options, t) => {
|
|
|
156
166
|
category: stakeholderCategoryOptions || categoryOptions,
|
|
157
167
|
country: countries,
|
|
158
168
|
subCategory: subCategoriesOptions,
|
|
159
|
-
|
|
169
|
+
category: category,
|
|
160
170
|
administrativeLevel1,
|
|
161
171
|
administrativeLevel2,
|
|
162
172
|
positionInTheMineralSupplyChain: positionInMineralSupplyChainOptions,
|
|
@@ -7,7 +7,7 @@ import CustomIcon from '../../core/components/Icon/CustomIcon.jsx';
|
|
|
7
7
|
import AvatarGroup from '../../core/components/AvatarGroup/index.jsx';
|
|
8
8
|
import sourceAvatarConfig from '../../../helpers/sourceAvatarConfig.js';
|
|
9
9
|
import MoreTags from '../../core/components/Table/MoreTags/index.jsx';
|
|
10
|
-
|
|
10
|
+
import MoreMenu from '../../core/components/Table/MoreMenu/index.jsx';
|
|
11
11
|
const getLinkValue = (value, linkingObject) => {
|
|
12
12
|
if (linkingObject && linkingObject?.[value]) {
|
|
13
13
|
return linkingObject?.[value]?.name;
|
|
@@ -205,6 +205,21 @@ export const getColumns = ({ t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
205
205
|
},
|
|
206
206
|
ellipsis: true,
|
|
207
207
|
},
|
|
208
|
+
{
|
|
209
|
+
title: t("Last Update"),
|
|
210
|
+
dataIndex: "updatedAt",
|
|
211
|
+
key: "updatedAt",
|
|
212
|
+
width: 125,
|
|
213
|
+
render: (date, all) => {
|
|
214
|
+
if (all.empty) {
|
|
215
|
+
return <div className="daf-default-cell" />;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
|
|
219
|
+
return <Tooltip title={_date}>{_date}</Tooltip>;
|
|
220
|
+
},
|
|
221
|
+
ellipsis: true,
|
|
222
|
+
},
|
|
208
223
|
{
|
|
209
224
|
id: 'actions',
|
|
210
225
|
title: "",
|
|
@@ -213,13 +228,23 @@ export const getColumns = ({ t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
213
228
|
if (all.empty) {
|
|
214
229
|
return <div className="daf-default-cell" />;
|
|
215
230
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
231
|
+
const onClick = () => {
|
|
232
|
+
const link = `/app/view/${subject}/${all.datastakeId}`;
|
|
233
|
+
if (activeTab === "shared") {
|
|
234
|
+
link += `?sourceId=${all?.authorId?.id}`;
|
|
235
|
+
}
|
|
236
|
+
goTo(getRedirectLink(link));
|
|
237
|
+
};
|
|
238
|
+
const moreMenuItems = [
|
|
239
|
+
{
|
|
240
|
+
label: t("Details"),
|
|
241
|
+
value: "details",
|
|
242
|
+
onClick: onClick,
|
|
243
|
+
},
|
|
244
|
+
|
|
245
|
+
];
|
|
246
|
+
return <div >
|
|
247
|
+
<MoreMenu items={moreMenuItems} />
|
|
223
248
|
</div>;
|
|
224
249
|
}
|
|
225
250
|
}
|
|
@@ -145,15 +145,10 @@ export const filtersConfig = {
|
|
|
145
145
|
export const getFilterOptions = (options, t) => {
|
|
146
146
|
const {
|
|
147
147
|
timeframe = [],
|
|
148
|
-
|
|
148
|
+
status = [],
|
|
149
149
|
categoryOptions = [],
|
|
150
150
|
countries = [],
|
|
151
|
-
|
|
152
|
-
subCategoriesOptions,
|
|
153
|
-
stakeholderCategoryOptions,
|
|
154
|
-
stakeholderSubCategoriesOptions,
|
|
155
|
-
administrativeLevel1,
|
|
156
|
-
administrativeLevel2,
|
|
151
|
+
|
|
157
152
|
category=[],
|
|
158
153
|
} = options || {};
|
|
159
154
|
console.log({options})
|
|
@@ -161,22 +156,19 @@ export const getFilterOptions = (options, t) => {
|
|
|
161
156
|
const _default = {
|
|
162
157
|
timeframe: timeframe,
|
|
163
158
|
country: countries,
|
|
159
|
+
category: category,
|
|
164
160
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
value: "private",
|
|
177
|
-
label: "Private",
|
|
178
|
-
},
|
|
179
|
-
],
|
|
161
|
+
status: [
|
|
162
|
+
{
|
|
163
|
+
value: "submitted",
|
|
164
|
+
label: "Submitted",
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
value: "private",
|
|
168
|
+
label: "Private",
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
|
|
180
172
|
}
|
|
181
173
|
|
|
182
174
|
return _default;
|