datastake-daf 0.6.763 → 0.6.764
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 +93 -60
- package/dist/hooks/index.js +1 -1
- package/dist/layouts/index.js +36 -11
- package/dist/pages/index.js +1872 -995
- package/dist/services/index.js +1 -21
- package/package.json +1 -1
- package/src/@daf/core/components/Screens/TableScreen/TablePageWithTabs/index.jsx +9 -4
- package/src/@daf/core/components/Table/index.jsx +2 -2
- package/src/@daf/core/components/UI/KeyIndicatorNavigateLabel/index.jsx +29 -0
- package/src/@daf/hooks/useFilters.js +1 -1
- package/src/@daf/layouts/AppLayout/components/MobileDrawer/index.js +4 -2
- package/src/@daf/layouts/AppLayout/components/UserDropdown/index.js +23 -2
- package/src/@daf/layouts/AppLayout/index.jsx +2 -0
- package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/GenderDistribution/config.js +7 -6
- package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/GenderDistribution/index.js +2 -1
- package/src/@daf/pages/Dashboards/SupplyChain/components/KeyIndicators/config.js +29 -53
- package/src/@daf/pages/Dashboards/SupplyChain/index.jsx +2 -2
- package/src/@daf/pages/Dashboards/UserDashboard/components/KeyIndicators/config.js +36 -70
- package/src/@daf/pages/Documents/index.jsx +9 -13
- package/src/@daf/pages/Events/Activities/index.jsx +8 -21
- package/src/@daf/pages/Events/Incidents/index.jsx +8 -21
- package/src/@daf/pages/Events/index.jsx +8 -20
- package/src/@daf/pages/Locations/MineSite/index.jsx +8 -21
- package/src/@daf/pages/Locations/index.jsx +9 -12
- package/src/@daf/pages/Partners/columns.js +421 -0
- package/src/@daf/pages/Partners/config.js +32 -0
- package/src/@daf/pages/Partners/create.jsx +145 -0
- package/src/@daf/pages/Partners/edit.jsx +98 -0
- package/src/@daf/pages/Partners/hook.js +153 -0
- package/src/@daf/pages/Partners/index.jsx +233 -8
- package/src/@daf/pages/Stakeholders/Operators/index.jsx +8 -22
- package/src/@daf/pages/Stakeholders/Workers/index.jsx +8 -21
- package/src/@daf/pages/Stakeholders/index.jsx +9 -10
- package/src/@daf/pages/hook.js +34 -0
- package/src/@daf/services/PartnerService.js +1 -16
- package/src/index.js +1 -1
- package/src/pages.js +1 -0
|
@@ -5,6 +5,7 @@ import { checkboxConfig, getFiltersConfig, filtersConfig, getFilterOptions } fro
|
|
|
5
5
|
import { useGetQueryParams } from '../../../hooks/useGetQueryParams.js';
|
|
6
6
|
import StakeholdersCreate from './create.jsx';
|
|
7
7
|
import { displayMessage } from '../../../../helpers/messages.js';
|
|
8
|
+
import { useFetchData } from '../../hook.js';
|
|
8
9
|
|
|
9
10
|
const WorkersTable = ({
|
|
10
11
|
t = () => {},
|
|
@@ -53,27 +54,13 @@ const WorkersTable = ({
|
|
|
53
54
|
applications,
|
|
54
55
|
}), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}, [otherParams, extendingFilters])
|
|
64
|
-
|
|
65
|
-
useEffect(() => {
|
|
66
|
-
getData({
|
|
67
|
-
pagination: paginationQuery,
|
|
68
|
-
...(Object.keys(searchParams).length > 0 && { search: searchParams }),
|
|
69
|
-
...otherParams,
|
|
70
|
-
tab: activeTab,
|
|
71
|
-
sortBy: {
|
|
72
|
-
[sortBy || "updatedAt"]: sortDir ? (sortDir === "ascend" ? 1 : -1) : -1,
|
|
73
|
-
},
|
|
74
|
-
...extendingFilters
|
|
75
|
-
}, 'workers')
|
|
76
|
-
}, [location.search, activeTab, JSON.stringify(extendingFilters)]);
|
|
57
|
+
useFetchData({
|
|
58
|
+
location,
|
|
59
|
+
getData,
|
|
60
|
+
activeTab,
|
|
61
|
+
extendingFilters,
|
|
62
|
+
subject: 'workers',
|
|
63
|
+
})
|
|
77
64
|
|
|
78
65
|
const selectFiltersConfig = useMemo(() => {
|
|
79
66
|
return getFiltersConfig({t});
|
|
@@ -6,6 +6,7 @@ import { useGetQueryParams } from '../../hooks/useGetQueryParams.js';
|
|
|
6
6
|
import StakeholdersCreate from './create.jsx';
|
|
7
7
|
import { displayMessage } from '../../../helpers/messages.js';
|
|
8
8
|
import DAFHeader from '../../core/components/Header/index.jsx';
|
|
9
|
+
import { useFetchData } from '../hook.js';
|
|
9
10
|
|
|
10
11
|
const StakeholdersTable = ({
|
|
11
12
|
t = () => {},
|
|
@@ -36,6 +37,7 @@ const StakeholdersTable = ({
|
|
|
36
37
|
applications = [],
|
|
37
38
|
subjectClear = () => {},
|
|
38
39
|
breadcrumbs = [],
|
|
40
|
+
extendingFilters = {},
|
|
39
41
|
}) => {
|
|
40
42
|
const [selectOptions, setSelectOptions] = useState();
|
|
41
43
|
const [activeTab, setActiveTab] = useState("own");
|
|
@@ -51,16 +53,13 @@ const StakeholdersTable = ({
|
|
|
51
53
|
applications,
|
|
52
54
|
}), [t, goTo, user, options, activeTab, getRedirectLink, theme, applications]);
|
|
53
55
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
tab: activeTab,
|
|
62
|
-
}, 'stakeholders')
|
|
63
|
-
}, [paginationQuery, otherParams, searchParams, activeTab]);
|
|
56
|
+
useFetchData({
|
|
57
|
+
location,
|
|
58
|
+
getData,
|
|
59
|
+
activeTab,
|
|
60
|
+
extendingFilters,
|
|
61
|
+
subject: 'stakeholders',
|
|
62
|
+
})
|
|
64
63
|
|
|
65
64
|
const selectFiltersConfig = useMemo(() => {
|
|
66
65
|
return getFiltersConfig({t});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { useGetQueryParams } from "../hooks/useGetQueryParams";
|
|
3
|
+
|
|
4
|
+
export const useFetchData = ({
|
|
5
|
+
location,
|
|
6
|
+
getData,
|
|
7
|
+
activeTab,
|
|
8
|
+
extendingFilters,
|
|
9
|
+
subject,
|
|
10
|
+
}) => {
|
|
11
|
+
const { paginationQuery, searchParams, otherParams, sortBy, sortDir, } = useGetQueryParams({location});
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const cleanSearchParams = Object.fromEntries(
|
|
14
|
+
Object.entries(searchParams).filter(([_, value]) => value != null && value !== '')
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
const hasPagination = paginationQuery.skip != null || paginationQuery.take != null;
|
|
18
|
+
|
|
19
|
+
if (!hasPagination) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
getData({
|
|
24
|
+
pagination: paginationQuery,
|
|
25
|
+
...(Object.keys(otherParams).length > 0 && otherParams ),
|
|
26
|
+
...(Object.keys(cleanSearchParams).length > 0 && { search: cleanSearchParams }),
|
|
27
|
+
tab: activeTab,
|
|
28
|
+
sortBy: {
|
|
29
|
+
[sortBy || "updatedAt"]: sortDir ? (sortDir === "ascend" ? 1 : -1) : -1,
|
|
30
|
+
},
|
|
31
|
+
...extendingFilters,
|
|
32
|
+
}, subject)
|
|
33
|
+
}, [location.search, activeTab, JSON.stringify(extendingFilters)]);
|
|
34
|
+
}
|
|
@@ -3,25 +3,10 @@ import { createLazyService } from "./helpers/LazyService.js";
|
|
|
3
3
|
|
|
4
4
|
class PartnerService extends BaseService {
|
|
5
5
|
get(tab, filters) {
|
|
6
|
-
const { page, pageSize, search, searchParams, ...rest } = filters;
|
|
7
|
-
const params = {
|
|
8
|
-
filters: rest,
|
|
9
|
-
pagination: {
|
|
10
|
-
skip: page,
|
|
11
|
-
take: pageSize,
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
if (search && searchParams.length > 0) {
|
|
15
|
-
params.search = {
|
|
16
|
-
qs: search,
|
|
17
|
-
fields: searchParams,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
|
|
21
6
|
return this.apiGet({
|
|
22
7
|
url: "/partner",
|
|
23
8
|
isApp: true,
|
|
24
|
-
params,
|
|
9
|
+
params: filters,
|
|
25
10
|
});
|
|
26
11
|
}
|
|
27
12
|
|
package/src/index.js
CHANGED
|
@@ -190,7 +190,7 @@ export { InformationChannelProvider } from "./@daf/core/components/Screens/Infor
|
|
|
190
190
|
// UI
|
|
191
191
|
export { default as SDGIcons } from "./@daf/core/components/UI/SDGIcon/index.jsx";
|
|
192
192
|
export { default as CountryFlag } from "./@daf/core/components/UI/CountryFlag/index.jsx"
|
|
193
|
-
|
|
193
|
+
export { default as KeyIndicatorNavigateLabel } from "./@daf/core/components/UI/KeyIndicatorNavigateLabel/index.jsx";
|
|
194
194
|
|
|
195
195
|
//Settings
|
|
196
196
|
export { default as Settings } from "./@daf/core/components/Screens/Settings/index.js";
|
package/src/pages.js
CHANGED
|
@@ -12,6 +12,7 @@ export { default as ActivitiesTable } from './@daf/pages/Events/Activities/index
|
|
|
12
12
|
export { default as IncidentsTable } from './@daf/pages/Events/Incidents/index.jsx';
|
|
13
13
|
export { default as ProductionSitesTable } from './@daf/pages/Locations/MineSite/index.jsx';
|
|
14
14
|
export { default as UsersTable } from './@daf/core/components/Screens/Users/index.jsx';
|
|
15
|
+
export { default as PartnersTable } from './@daf/pages/Partners/index.jsx';
|
|
15
16
|
|
|
16
17
|
// Summary
|
|
17
18
|
export { default as OperatorSummary } from './@daf/pages/Summary/Operator/index.jsx';
|