datastake-daf 0.6.832 → 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/build/favicon.ico +0 -0
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/manifest.json +25 -0
- package/build/robots.txt +3 -0
- package/dist/components/index.js +2135 -2045
- package/dist/pages/index.js +35 -30
- package/dist/utils/index.js +3 -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/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/Summary/Minesite/components/MineSiteDetails/config.js +4 -35
- package/src/helpers/dataFetch.js +3 -3
- package/src/index.js +1 -0
package/dist/pages/index.js
CHANGED
|
@@ -53983,6 +53983,31 @@ function MissingTagButton({
|
|
|
53983
53983
|
});
|
|
53984
53984
|
}
|
|
53985
53985
|
|
|
53986
|
+
const SingleTruncatedLine = ({
|
|
53987
|
+
data = []
|
|
53988
|
+
}) => {
|
|
53989
|
+
const displayText = data?.join(", ");
|
|
53990
|
+
const tooltipText = data?.join("\n");
|
|
53991
|
+
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
53992
|
+
title: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
53993
|
+
style: {
|
|
53994
|
+
whiteSpace: "pre-line"
|
|
53995
|
+
},
|
|
53996
|
+
children: tooltipText
|
|
53997
|
+
}),
|
|
53998
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
53999
|
+
style: {
|
|
54000
|
+
fontWeight: "normal",
|
|
54001
|
+
overflow: "hidden",
|
|
54002
|
+
textOverflow: "ellipsis",
|
|
54003
|
+
whiteSpace: "nowrap",
|
|
54004
|
+
maxWidth: "100%"
|
|
54005
|
+
},
|
|
54006
|
+
children: displayText
|
|
54007
|
+
})
|
|
54008
|
+
});
|
|
54009
|
+
};
|
|
54010
|
+
|
|
53986
54011
|
styled__default["default"].div`
|
|
53987
54012
|
display: flex;
|
|
53988
54013
|
flex-direction: column;
|
|
@@ -60052,20 +60077,8 @@ function getKeyIndicatorsConfig({
|
|
|
60052
60077
|
if (validExtractionPoints?.length === 0 || !validExtractionPoints) {
|
|
60053
60078
|
return "-";
|
|
60054
60079
|
}
|
|
60055
|
-
return /*#__PURE__*/jsxRuntime.jsx(
|
|
60056
|
-
|
|
60057
|
-
return /*#__PURE__*/jsxRuntime.jsxs(React__default["default"].Fragment, {
|
|
60058
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
60059
|
-
title: method,
|
|
60060
|
-
children: /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
60061
|
-
style: {
|
|
60062
|
-
fontWeight: "normal"
|
|
60063
|
-
},
|
|
60064
|
-
children: method
|
|
60065
|
-
})
|
|
60066
|
-
}), index < validExtractionPoints.length - 1 && ", "]
|
|
60067
|
-
}, method);
|
|
60068
|
-
})
|
|
60080
|
+
return /*#__PURE__*/jsxRuntime.jsx(SingleTruncatedLine, {
|
|
60081
|
+
data: validExtractionPoints
|
|
60069
60082
|
});
|
|
60070
60083
|
}
|
|
60071
60084
|
}, {
|
|
@@ -60075,21 +60088,8 @@ function getKeyIndicatorsConfig({
|
|
|
60075
60088
|
if (validProducts?.length === 0 || !validProducts) {
|
|
60076
60089
|
return "-";
|
|
60077
60090
|
}
|
|
60078
|
-
return /*#__PURE__*/jsxRuntime.jsx(
|
|
60079
|
-
|
|
60080
|
-
return /*#__PURE__*/jsxRuntime.jsxs(React__default["default"].Fragment, {
|
|
60081
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
60082
|
-
title: product,
|
|
60083
|
-
children: /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
60084
|
-
style: {
|
|
60085
|
-
fontWeight: "normal",
|
|
60086
|
-
color: getTagColor(product)
|
|
60087
|
-
},
|
|
60088
|
-
children: product
|
|
60089
|
-
})
|
|
60090
|
-
}), index < validProducts.length - 1 && ", "]
|
|
60091
|
-
}, product);
|
|
60092
|
-
})
|
|
60091
|
+
return /*#__PURE__*/jsxRuntime.jsx(SingleTruncatedLine, {
|
|
60092
|
+
data: validProducts
|
|
60093
60093
|
});
|
|
60094
60094
|
}
|
|
60095
60095
|
}, {
|
|
@@ -63299,6 +63299,11 @@ const Edit = ({
|
|
|
63299
63299
|
viewConfig: viewConfig,
|
|
63300
63300
|
namespaceOverrides
|
|
63301
63301
|
});
|
|
63302
|
+
React.useEffect(() => {
|
|
63303
|
+
if (data?.id && !canEdit) {
|
|
63304
|
+
goTo(getViewLink());
|
|
63305
|
+
}
|
|
63306
|
+
}, [canEdit, goTo, getViewLink, namespace, data?.id]);
|
|
63302
63307
|
const action = React.useMemo(() => actionMap?.[namespaceConfig?.action], [namespaceConfig?.action, actionMap]);
|
|
63303
63308
|
const namespaceGet = {
|
|
63304
63309
|
[namespace]: () => {
|
|
@@ -63394,7 +63399,7 @@ const Edit = ({
|
|
|
63394
63399
|
const pageActions = [{
|
|
63395
63400
|
tooltip: t("Save"),
|
|
63396
63401
|
onClick: () => onSubmitData(),
|
|
63397
|
-
disabled: !isChanged,
|
|
63402
|
+
disabled: !isChanged || !canEdit,
|
|
63398
63403
|
type: "primary",
|
|
63399
63404
|
icon: "Save"
|
|
63400
63405
|
}, {
|
package/dist/utils/index.js
CHANGED
|
@@ -15104,10 +15104,10 @@ const formatDataForTable = (data, options) => {
|
|
|
15104
15104
|
children
|
|
15105
15105
|
};
|
|
15106
15106
|
}),
|
|
15107
|
-
meta: dataObj
|
|
15107
|
+
meta: dataObj?.meta
|
|
15108
15108
|
},
|
|
15109
|
-
|
|
15110
|
-
totalItems:
|
|
15109
|
+
options: options || {},
|
|
15110
|
+
totalItems: dataObj?.meta?.total || dataObj?.data?.length || 0
|
|
15111
15111
|
};
|
|
15112
15112
|
};
|
|
15113
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
|
|