datastake-daf 0.6.831 → 0.6.833
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 +726 -582
- package/dist/hooks/index.js +8 -0
- package/dist/pages/index.js +1850 -176
- package/dist/services/index.js +8 -0
- package/dist/utils/index.js +4 -3
- package/package.json +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Documents.jsx +4 -0
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Events.jsx +4 -0
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Location.jsx +4 -0
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Subjects.jsx +4 -0
- package/src/@daf/core/components/Screens/Admin/AdminTables/DocumentsTable/helper.js +19 -29
- package/src/@daf/core/components/Screens/Admin/AdminTables/DocumentsTable/index.jsx +16 -3
- package/src/@daf/core/components/Screens/Admin/AdminTables/EventsTable/helper.js +15 -20
- package/src/@daf/core/components/Screens/Admin/AdminTables/EventsTable/index.jsx +13 -4
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/helper.js +114 -29
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/index.jsx +16 -3
- package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/helper.js +29 -29
- package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/index.jsx +16 -3
- package/src/@daf/core/components/Screens/Admin/AdminTables/hook.js +1 -0
- 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/core/components/UI/SingleTruncatedLine/index.jsx +25 -0
- package/src/@daf/pages/Edit/index.jsx +7 -1
- package/src/@daf/pages/Events/Activities/columns.js +1 -1
- 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/pages/Summary/Minesite/components/MineSiteDetails/config.js +4 -35
- package/src/@daf/services/DashboardService.js +9 -0
- package/src/constants/locales/en/translation.js +1 -0
- package/src/helpers/dataFetch.js +3 -3
- package/src/index.js +1 -0
- package/src/pages.js +4 -1
package/dist/services/index.js
CHANGED
|
@@ -1516,6 +1516,14 @@ class DashboardService extends BaseService {
|
|
|
1516
1516
|
isUserManager: true
|
|
1517
1517
|
});
|
|
1518
1518
|
}
|
|
1519
|
+
|
|
1520
|
+
// getWidgetConflictManagement({ url, params = {}, filters = {} }) {
|
|
1521
|
+
// return this.apiGet({
|
|
1522
|
+
// url: `/dashboard/conflict-management${url}`,
|
|
1523
|
+
// params: { ...params, ...filters },
|
|
1524
|
+
// isApp: true,
|
|
1525
|
+
// });
|
|
1526
|
+
// }
|
|
1519
1527
|
}
|
|
1520
1528
|
var DashboardService$1 = createLazyService(DashboardService);
|
|
1521
1529
|
|
package/dist/utils/index.js
CHANGED
|
@@ -7850,6 +7850,7 @@ function mapUser(user) {
|
|
|
7850
7850
|
}
|
|
7851
7851
|
|
|
7852
7852
|
const en = {
|
|
7853
|
+
"conflict-management": "Conflict Management",
|
|
7853
7854
|
"review-requests": "Review Requests",
|
|
7854
7855
|
"create-account": "Create Account",
|
|
7855
7856
|
"manage-users": "Manage Users",
|
|
@@ -15103,10 +15104,10 @@ const formatDataForTable = (data, options) => {
|
|
|
15103
15104
|
children
|
|
15104
15105
|
};
|
|
15105
15106
|
}),
|
|
15106
|
-
meta: dataObj
|
|
15107
|
+
meta: dataObj?.meta
|
|
15107
15108
|
},
|
|
15108
|
-
|
|
15109
|
-
totalItems:
|
|
15109
|
+
options: options || {},
|
|
15110
|
+
totalItems: dataObj?.meta?.total || dataObj?.data?.length || 0
|
|
15110
15111
|
};
|
|
15111
15112
|
};
|
|
15112
15113
|
|
package/package.json
CHANGED
|
@@ -42,6 +42,8 @@ export default function AdminLocationScreen({ config }) {
|
|
|
42
42
|
refetchTrigger,
|
|
43
43
|
getData,
|
|
44
44
|
user,
|
|
45
|
+
APP,
|
|
46
|
+
apiUrl
|
|
45
47
|
} = config;
|
|
46
48
|
|
|
47
49
|
|
|
@@ -75,6 +77,8 @@ export default function AdminLocationScreen({ config }) {
|
|
|
75
77
|
}}
|
|
76
78
|
user={user}
|
|
77
79
|
options={options}
|
|
80
|
+
APP={APP}
|
|
81
|
+
apiUrl={apiUrl}
|
|
78
82
|
/>
|
|
79
83
|
);
|
|
80
84
|
}
|
|
@@ -42,6 +42,8 @@ export default function AdminEventsScreen({ config }) {
|
|
|
42
42
|
refetchTrigger,
|
|
43
43
|
getData,
|
|
44
44
|
user,
|
|
45
|
+
APP,
|
|
46
|
+
apiUrl
|
|
45
47
|
} = config;
|
|
46
48
|
|
|
47
49
|
|
|
@@ -71,6 +73,8 @@ export default function AdminEventsScreen({ config }) {
|
|
|
71
73
|
options:options}}
|
|
72
74
|
user={user}
|
|
73
75
|
options={options}
|
|
76
|
+
APP={APP}
|
|
77
|
+
apiUrl={apiUrl}
|
|
74
78
|
/>
|
|
75
79
|
);
|
|
76
80
|
}
|
|
@@ -43,6 +43,8 @@ export default function AdminLocationScreen({ config }) {
|
|
|
43
43
|
refetchTrigger,
|
|
44
44
|
getData,
|
|
45
45
|
user,
|
|
46
|
+
APP,
|
|
47
|
+
apiUrl
|
|
46
48
|
} = config;
|
|
47
49
|
|
|
48
50
|
const handleMergeLocations = useCallback(
|
|
@@ -92,6 +94,8 @@ export default function AdminLocationScreen({ config }) {
|
|
|
92
94
|
}}
|
|
93
95
|
user={user}
|
|
94
96
|
options={options}
|
|
97
|
+
APP={APP}
|
|
98
|
+
apiUrl={apiUrl}
|
|
95
99
|
/>
|
|
96
100
|
);
|
|
97
101
|
}
|
|
@@ -43,6 +43,8 @@ export default function AdminSubjectsScreen({ config }) {
|
|
|
43
43
|
refetchTrigger,
|
|
44
44
|
getData,
|
|
45
45
|
user,
|
|
46
|
+
APP,
|
|
47
|
+
apiUrl
|
|
46
48
|
} = config;
|
|
47
49
|
|
|
48
50
|
const handleMergeSubjects = useCallback(
|
|
@@ -92,6 +94,8 @@ export default function AdminSubjectsScreen({ config }) {
|
|
|
92
94
|
}}
|
|
93
95
|
user={user}
|
|
94
96
|
options={options}
|
|
97
|
+
APP={APP}
|
|
98
|
+
apiUrl={apiUrl}
|
|
95
99
|
/>
|
|
96
100
|
);
|
|
97
101
|
}
|
|
@@ -1,32 +1,22 @@
|
|
|
1
|
-
export const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
sources: {
|
|
21
|
-
type: "select",
|
|
22
|
-
label: "Sources",
|
|
23
|
-
placeholder: (t) => t("Sources"),
|
|
24
|
-
style: { flex: 1 },
|
|
25
|
-
labelStyle: { flex: 1 },
|
|
26
|
-
getLabel: (option) => option.label,
|
|
27
|
-
getValue: (option) => option.value,
|
|
28
|
-
},
|
|
29
|
-
};
|
|
1
|
+
export const getFiltersConfig = ({t}) => {
|
|
2
|
+
return {
|
|
3
|
+
timeframe: {
|
|
4
|
+
type: "timeframe",
|
|
5
|
+
label: "Timeframe",
|
|
6
|
+
style: { flex: 1 },
|
|
7
|
+
},
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const getFilterOptions = (options, t) => {
|
|
12
|
+
const { timeframe = [] } = options || {};
|
|
13
|
+
const _default = {
|
|
14
|
+
timeframe: timeframe,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return _default;
|
|
18
|
+
}
|
|
19
|
+
|
|
30
20
|
|
|
31
21
|
export const filtersConfig = {
|
|
32
22
|
name: "",
|
|
@@ -5,7 +5,8 @@ import DAFTable from "../../../../Table/index.jsx";
|
|
|
5
5
|
import { theme, Tag, message } from "antd";
|
|
6
6
|
import CustomIcon from "../../../../Icon/CustomIcon.jsx";
|
|
7
7
|
import {
|
|
8
|
-
|
|
8
|
+
getFiltersConfig,
|
|
9
|
+
getFilterOptions,
|
|
9
10
|
filtersConfig,
|
|
10
11
|
defaultUrlParams,
|
|
11
12
|
checkboxConfig,
|
|
@@ -31,12 +32,22 @@ export default function DocumentsTable({
|
|
|
31
32
|
refetchTrigger,
|
|
32
33
|
user,
|
|
33
34
|
options,
|
|
35
|
+
APP,
|
|
36
|
+
apiUrl
|
|
34
37
|
}) {
|
|
35
38
|
const [showFilters, setShowFilters] = useState(false);
|
|
36
39
|
const [hasError, setHasError] = useState(false);
|
|
37
40
|
const [selectedDocuments, setSelectedDocuments] = useState([]);
|
|
38
41
|
const { token } = useToken();
|
|
39
42
|
|
|
43
|
+
const selectFiltersConfig = useMemo(() => {
|
|
44
|
+
return getFiltersConfig({t});
|
|
45
|
+
}, [t]);
|
|
46
|
+
|
|
47
|
+
const filterOptions = useMemo(() => {
|
|
48
|
+
return getFilterOptions(options, t);
|
|
49
|
+
}, [options, t]);
|
|
50
|
+
|
|
40
51
|
const {
|
|
41
52
|
filter,
|
|
42
53
|
activeTab,
|
|
@@ -103,7 +114,7 @@ export default function DocumentsTable({
|
|
|
103
114
|
hasError={hasError}
|
|
104
115
|
setHasError={setHasError}
|
|
105
116
|
canClearSearch={canClearSearch}
|
|
106
|
-
selectOptions={
|
|
117
|
+
selectOptions={filterOptions}
|
|
107
118
|
checkboxConfig={checkboxConfig}
|
|
108
119
|
defaultTableFilters={{}}
|
|
109
120
|
breadcrumbs={breadcrumbs}
|
|
@@ -132,7 +143,7 @@ export default function DocumentsTable({
|
|
|
132
143
|
hideOnLoading={false}
|
|
133
144
|
pagination={filter.pagination}
|
|
134
145
|
rowKey="id"
|
|
135
|
-
selectOptions={
|
|
146
|
+
selectOptions={filterOptions}
|
|
136
147
|
doEmptyRows
|
|
137
148
|
setShowFilters={setShowFilters}
|
|
138
149
|
filtersConfig={selectFiltersConfig}
|
|
@@ -140,6 +151,8 @@ export default function DocumentsTable({
|
|
|
140
151
|
showFilters={showFilters}
|
|
141
152
|
defaultFilters={filter.defaultFilters}
|
|
142
153
|
onChange={filter.onTableChange}
|
|
154
|
+
app={APP}
|
|
155
|
+
apiUrl={apiUrl}
|
|
143
156
|
/>
|
|
144
157
|
</AdminTable>
|
|
145
158
|
|
|
@@ -15,31 +15,26 @@ export const getTabs = ({ t }) => {
|
|
|
15
15
|
];
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
export const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
labelStyle: { flex: 1 },
|
|
25
|
-
getLabel: (option) => option.label,
|
|
26
|
-
getValue: (option) => option.value,
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const getSelectFiltersConfig = ({t}) => {
|
|
31
|
-
return {
|
|
32
|
-
eventsType: {
|
|
33
|
-
type: "select",
|
|
34
|
-
label: "type",
|
|
35
|
-
placeholder: t("type"),
|
|
18
|
+
export const getFiltersConfig = ({t}) => {
|
|
19
|
+
return {
|
|
20
|
+
typeOfEvent:{
|
|
21
|
+
type: 'select',
|
|
22
|
+
label: 'type',
|
|
23
|
+
placeholder: (t) => `${t('Filter by')} ${t('type').toLowerCase()}`,
|
|
36
24
|
style: { flex: 1 },
|
|
37
25
|
labelStyle: { flex: 1 },
|
|
38
26
|
getLabel: (option) => option.label,
|
|
39
27
|
getValue: (option) => option.value,
|
|
40
|
-
}
|
|
28
|
+
}
|
|
41
29
|
}
|
|
42
|
-
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const getFilterOptions = (options, t) => {
|
|
33
|
+
const { eventsType } = options || {};
|
|
34
|
+
return {
|
|
35
|
+
typeOfEvent: eventsType || [],
|
|
36
|
+
}
|
|
37
|
+
}
|
|
43
38
|
|
|
44
39
|
export const filtersConfig = {
|
|
45
40
|
name: "",
|
|
@@ -8,7 +8,8 @@ import {
|
|
|
8
8
|
filtersConfig,
|
|
9
9
|
defaultUrlParams,
|
|
10
10
|
checkboxConfig,
|
|
11
|
-
|
|
11
|
+
getFiltersConfig,
|
|
12
|
+
getFilterOptions,
|
|
12
13
|
} from "./helper.js";
|
|
13
14
|
import { getColumns } from "./column.js";
|
|
14
15
|
import { getTabs } from "../helper.js";
|
|
@@ -31,6 +32,8 @@ export default function EventsTable({
|
|
|
31
32
|
refetchTrigger,
|
|
32
33
|
user,
|
|
33
34
|
options,
|
|
35
|
+
APP,
|
|
36
|
+
apiUrl
|
|
34
37
|
}) {
|
|
35
38
|
const [showFilters, setShowFilters] = useState(false);
|
|
36
39
|
const [hasError, setHasError] = useState(false);
|
|
@@ -38,9 +41,13 @@ export default function EventsTable({
|
|
|
38
41
|
const { token } = useToken();
|
|
39
42
|
|
|
40
43
|
const selectFiltersConfig = useMemo(() => {
|
|
41
|
-
return
|
|
44
|
+
return getFiltersConfig({t});
|
|
42
45
|
}, [t]);
|
|
43
46
|
|
|
47
|
+
const filterOptions = useMemo(() => {
|
|
48
|
+
return getFilterOptions(options, t);
|
|
49
|
+
}, [options, t]);
|
|
50
|
+
|
|
44
51
|
const {
|
|
45
52
|
filter,
|
|
46
53
|
activeTab,
|
|
@@ -105,7 +112,7 @@ export default function EventsTable({
|
|
|
105
112
|
hasError={hasError}
|
|
106
113
|
setHasError={setHasError}
|
|
107
114
|
canClearSearch={canClearSearch}
|
|
108
|
-
selectOptions={
|
|
115
|
+
selectOptions={filterOptions}
|
|
109
116
|
checkboxConfig={checkboxConfig}
|
|
110
117
|
defaultTableFilters={{}}
|
|
111
118
|
breadcrumbs={breadcrumbs}
|
|
@@ -134,7 +141,7 @@ export default function EventsTable({
|
|
|
134
141
|
hideOnLoading={false}
|
|
135
142
|
pagination={filter.pagination}
|
|
136
143
|
rowKey="id"
|
|
137
|
-
selectOptions={
|
|
144
|
+
selectOptions={filterOptions}
|
|
138
145
|
doEmptyRows
|
|
139
146
|
setShowFilters={setShowFilters}
|
|
140
147
|
filtersConfig={selectFiltersConfig}
|
|
@@ -142,6 +149,8 @@ export default function EventsTable({
|
|
|
142
149
|
showFilters={showFilters}
|
|
143
150
|
defaultFilters={filter.defaultFilters}
|
|
144
151
|
onChange={filter.onTableChange}
|
|
152
|
+
app={APP}
|
|
153
|
+
apiUrl={apiUrl}
|
|
145
154
|
/>
|
|
146
155
|
</AdminTable>
|
|
147
156
|
|
|
@@ -1,32 +1,117 @@
|
|
|
1
|
-
export const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
1
|
+
export const getFiltersConfig = ({t}) => {
|
|
2
|
+
return {
|
|
3
|
+
category:{
|
|
4
|
+
type: 'select',
|
|
5
|
+
label: 'Category',
|
|
6
|
+
placeholder: (t) => `${t('Filter by')} ${t('Category').toLowerCase()}`,
|
|
7
|
+
style: { flex: 1 },
|
|
8
|
+
labelStyle: { flex: 1 },
|
|
9
|
+
getLabel: (option) => option.label,
|
|
10
|
+
getValue: (option) => option.value,
|
|
11
|
+
},
|
|
12
|
+
country: {
|
|
13
|
+
type: 'select',
|
|
14
|
+
label: 'Country',
|
|
15
|
+
placeholder: () => `${t('Filter by')} ${t('Country').toLowerCase()}`,
|
|
16
|
+
style: { flex: 1 },
|
|
17
|
+
labelStyle: { flex: 1 },
|
|
18
|
+
getLabel: (option) => option.label,
|
|
19
|
+
getValue: (option) => option.value,
|
|
20
|
+
},
|
|
21
|
+
administrativeLevel1: {
|
|
22
|
+
type: 'ajaxSelect',
|
|
23
|
+
label: ({ t = (s) => s, options = {}, filters = {}, language = 'en' }) => {
|
|
24
|
+
const { administrativeLevel1 } = options;
|
|
25
|
+
|
|
26
|
+
if (administrativeLevel1) {
|
|
27
|
+
if (options.country) {
|
|
28
|
+
const _item = administrativeLevel1[filters.country];
|
|
29
|
+
if (_item) {
|
|
30
|
+
if (_item[language]) {
|
|
31
|
+
return _item[language]
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return t('Province');
|
|
38
|
+
},
|
|
39
|
+
placeholder: () => `${t('Filter by')} ${t('Province').toLowerCase()}`,
|
|
40
|
+
filters: (data) => ({
|
|
41
|
+
country: data.country,
|
|
42
|
+
level: 'level_1',
|
|
43
|
+
}),
|
|
44
|
+
show: (data) => !data.country,
|
|
45
|
+
disabled: (data) => !data.country,
|
|
46
|
+
mapper: { label: "name", value: "id" },
|
|
47
|
+
method: 'getOptions',
|
|
48
|
+
entity: 'AdministrativeLevel',
|
|
49
|
+
style: { flex: 1 },
|
|
50
|
+
labelStyle: { flex: 1 },
|
|
51
|
+
},
|
|
52
|
+
administrativeLevel2: {
|
|
53
|
+
type: 'ajaxSelect',
|
|
54
|
+
label: ({ t = (s) => s, options = {}, filters = {}, language = 'en' }) => {
|
|
55
|
+
const { administrativeLevel2 } = options;
|
|
56
|
+
|
|
57
|
+
if (administrativeLevel2) {
|
|
58
|
+
if (options.country) {
|
|
59
|
+
const _item = administrativeLevel2[filters.country];
|
|
60
|
+
if (_item) {
|
|
61
|
+
if (_item[language]) {
|
|
62
|
+
return _item[language]
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return t('Province');
|
|
69
|
+
},
|
|
70
|
+
show: (data) => !(data.country && data.administrativeLevel1),
|
|
71
|
+
placeholder: () => `${t('Filter by')} ${t('Territory').toLowerCase()}`,
|
|
72
|
+
filters: (data) => ({
|
|
73
|
+
country: data.country,
|
|
74
|
+
level: 'level_2',
|
|
75
|
+
administrativeLevel1: data.administrativeLevel1,
|
|
76
|
+
}),
|
|
77
|
+
disabled: (data) => !(data.country && data.administrativeLevel1),
|
|
78
|
+
mapper: { label: "name", value: "id" },
|
|
79
|
+
method: 'getOptions',
|
|
80
|
+
entity: 'AdministrativeLevel',
|
|
81
|
+
style: { flex: 1 },
|
|
82
|
+
labelStyle: { flex: 1 },
|
|
83
|
+
},
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export const getFilterOptions = (options, t) => {
|
|
88
|
+
const {
|
|
89
|
+
statusOptions = [],
|
|
90
|
+
categoryOptions = [],
|
|
91
|
+
countries = [],
|
|
92
|
+
product=[],
|
|
93
|
+
subCategory = [],
|
|
94
|
+
subCategoriesOptions,
|
|
95
|
+
stakeholderCategoryOptions,
|
|
96
|
+
stakeholderSubCategoriesOptions,
|
|
97
|
+
administrativeLevel1,
|
|
98
|
+
administrativeLevel2,
|
|
99
|
+
mineralOptions,
|
|
100
|
+
minerals,
|
|
101
|
+
productionSiteCategories,
|
|
102
|
+
locationCategories = [],
|
|
103
|
+
} = options || {};
|
|
104
|
+
|
|
105
|
+
const _default = {
|
|
106
|
+
// category: stakeholderCategoryOptions || categoryOptions,
|
|
107
|
+
country: countries || [],
|
|
108
|
+
administrativeLevel1,
|
|
109
|
+
administrativeLevel2,
|
|
110
|
+
category: locationCategories || [],
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return _default;
|
|
114
|
+
}
|
|
30
115
|
|
|
31
116
|
export const filtersConfig = {
|
|
32
117
|
name: "",
|
|
@@ -5,10 +5,11 @@ import DAFTable from "../../../../Table/index.jsx";
|
|
|
5
5
|
import { theme, Tag, message } from "antd";
|
|
6
6
|
import CustomIcon from "../../../../Icon/CustomIcon.jsx";
|
|
7
7
|
import {
|
|
8
|
-
selectFiltersConfig,
|
|
9
8
|
filtersConfig,
|
|
10
9
|
defaultUrlParams,
|
|
11
10
|
checkboxConfig,
|
|
11
|
+
getFiltersConfig,
|
|
12
|
+
getFilterOptions,
|
|
12
13
|
} from "./helper.js";
|
|
13
14
|
import { getColumns } from "./column.js";
|
|
14
15
|
import CombineLocationModal from "../../AdminModals/CombineLocation/index.jsx";
|
|
@@ -33,6 +34,8 @@ export default function LocationTable({
|
|
|
33
34
|
refetchTrigger,
|
|
34
35
|
user,
|
|
35
36
|
options,
|
|
37
|
+
APP,
|
|
38
|
+
apiUrl
|
|
36
39
|
}) {
|
|
37
40
|
const [showFilters, setShowFilters] = useState(false);
|
|
38
41
|
const [hasError, setHasError] = useState(false);
|
|
@@ -42,6 +45,14 @@ export default function LocationTable({
|
|
|
42
45
|
const { token } = useToken();
|
|
43
46
|
const [isCombineModalOpen, setIsModalOpen] = useState(false);
|
|
44
47
|
|
|
48
|
+
const selectFiltersConfig = useMemo(() => {
|
|
49
|
+
return getFiltersConfig({t});
|
|
50
|
+
}, [t]);
|
|
51
|
+
|
|
52
|
+
const filterOptions = useMemo(() => {
|
|
53
|
+
return getFilterOptions(options, t);
|
|
54
|
+
}, [options, t]);
|
|
55
|
+
|
|
45
56
|
const {
|
|
46
57
|
filter,
|
|
47
58
|
activeTab,
|
|
@@ -107,7 +118,7 @@ export default function LocationTable({
|
|
|
107
118
|
hasError={hasError}
|
|
108
119
|
setHasError={setHasError}
|
|
109
120
|
canClearSearch={canClearSearch}
|
|
110
|
-
selectOptions={
|
|
121
|
+
selectOptions={filterOptions}
|
|
111
122
|
checkboxConfig={checkboxConfig}
|
|
112
123
|
defaultTableFilters={{}}
|
|
113
124
|
breadcrumbs={breadcrumbs}
|
|
@@ -136,7 +147,7 @@ export default function LocationTable({
|
|
|
136
147
|
hideOnLoading={false}
|
|
137
148
|
pagination={filter.pagination}
|
|
138
149
|
rowKey="id"
|
|
139
|
-
selectOptions={
|
|
150
|
+
selectOptions={filterOptions}
|
|
140
151
|
doEmptyRows
|
|
141
152
|
setShowFilters={setShowFilters}
|
|
142
153
|
filtersConfig={selectFiltersConfig}
|
|
@@ -144,6 +155,8 @@ export default function LocationTable({
|
|
|
144
155
|
showFilters={showFilters}
|
|
145
156
|
defaultFilters={filter.defaultFilters}
|
|
146
157
|
onChange={filter.onTableChange}
|
|
158
|
+
app={APP}
|
|
159
|
+
apiUrl={apiUrl}
|
|
147
160
|
/>
|
|
148
161
|
</AdminTable>
|
|
149
162
|
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
export const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
}
|
|
1
|
+
export const getFiltersConfig = ({t}) => {
|
|
2
|
+
return {
|
|
3
|
+
country: {
|
|
4
|
+
type: 'select',
|
|
5
|
+
placeholder: t('Country'),
|
|
6
|
+
style: { flex: 1 },
|
|
7
|
+
labelStyle: { flex: 1 },
|
|
8
|
+
getLabel: (option) => option.label,
|
|
9
|
+
getValue: (option) => option.value,
|
|
10
|
+
},
|
|
11
|
+
category:{
|
|
12
|
+
type: 'select',
|
|
13
|
+
label: 'Category',
|
|
14
|
+
placeholder: (t) => `${t('Filter by')} ${t('Category').toLowerCase()}`,
|
|
15
|
+
style: { flex: 1 },
|
|
16
|
+
labelStyle: { flex: 1 },
|
|
17
|
+
getLabel: (option) => option.label,
|
|
18
|
+
getValue: (option) => option.value,
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const getFilterOptions = (options, t) => {
|
|
24
|
+
const { countries, category, categoriesOptions } = options || {};
|
|
25
|
+
return {
|
|
26
|
+
country: countries || [],
|
|
27
|
+
category: categoriesOptions || category || [],
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
30
|
|
|
31
31
|
export const filtersConfig = {
|
|
32
32
|
name: "",
|
|
@@ -5,7 +5,8 @@ import DAFTable from "../../../../Table/index.jsx";
|
|
|
5
5
|
import { theme, Tag, message } from "antd";
|
|
6
6
|
import CustomIcon from "../../../../Icon/CustomIcon.jsx";
|
|
7
7
|
import {
|
|
8
|
-
|
|
8
|
+
getFiltersConfig,
|
|
9
|
+
getFilterOptions,
|
|
9
10
|
filtersConfig,
|
|
10
11
|
defaultUrlParams,
|
|
11
12
|
checkboxConfig,
|
|
@@ -33,6 +34,8 @@ export default function SubjectsTable({
|
|
|
33
34
|
refetchTrigger,
|
|
34
35
|
user,
|
|
35
36
|
options,
|
|
37
|
+
APP,
|
|
38
|
+
apiUrl
|
|
36
39
|
}) {
|
|
37
40
|
const [showFilters, setShowFilters] = useState(false);
|
|
38
41
|
const [hasError, setHasError] = useState(false);
|
|
@@ -40,6 +43,14 @@ export default function SubjectsTable({
|
|
|
40
43
|
const { token } = useToken();
|
|
41
44
|
const [isCombineModalOpen, setIsModalOpen] = useState(false);
|
|
42
45
|
|
|
46
|
+
const selectFiltersConfig = useMemo(() => {
|
|
47
|
+
return getFiltersConfig({t});
|
|
48
|
+
}, [t]);
|
|
49
|
+
|
|
50
|
+
const filterOptions = useMemo(() => {
|
|
51
|
+
return getFilterOptions(options, t);
|
|
52
|
+
}, [options, t]);
|
|
53
|
+
|
|
43
54
|
const {
|
|
44
55
|
filter,
|
|
45
56
|
activeTab,
|
|
@@ -104,7 +115,7 @@ export default function SubjectsTable({
|
|
|
104
115
|
hasError={hasError}
|
|
105
116
|
setHasError={setHasError}
|
|
106
117
|
canClearSearch={canClearSearch}
|
|
107
|
-
selectOptions={
|
|
118
|
+
selectOptions={filterOptions}
|
|
108
119
|
checkboxConfig={checkboxConfig}
|
|
109
120
|
defaultTableFilters={{}}
|
|
110
121
|
breadcrumbs={breadcrumbs}
|
|
@@ -133,7 +144,7 @@ export default function SubjectsTable({
|
|
|
133
144
|
hideOnLoading={false}
|
|
134
145
|
pagination={filter.pagination}
|
|
135
146
|
rowKey="id"
|
|
136
|
-
selectOptions={
|
|
147
|
+
selectOptions={filterOptions}
|
|
137
148
|
doEmptyRows
|
|
138
149
|
setShowFilters={setShowFilters}
|
|
139
150
|
filtersConfig={selectFiltersConfig}
|
|
@@ -141,6 +152,8 @@ export default function SubjectsTable({
|
|
|
141
152
|
showFilters={showFilters}
|
|
142
153
|
defaultFilters={filter.defaultFilters}
|
|
143
154
|
onChange={filter.onTableChange}
|
|
155
|
+
app={APP}
|
|
156
|
+
apiUrl={apiUrl}
|
|
144
157
|
/>
|
|
145
158
|
</AdminTable>
|
|
146
159
|
|
|
@@ -124,6 +124,7 @@ export const useGetParams = ({location}) => {
|
|
|
124
124
|
...(Object.keys(rest)?.length > 0 && rest ),
|
|
125
125
|
...(Object.keys(cleanSearchParams)?.length > 0 && { search: cleanSearchParams }),
|
|
126
126
|
tab: activeTab,
|
|
127
|
+
...(activeTab === "deleted" && {status: 'deleted'})
|
|
127
128
|
}
|
|
128
129
|
}, [location.search]);
|
|
129
130
|
|