datastake-daf 0.6.763 → 0.6.765

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.
Files changed (42) hide show
  1. package/dist/components/index.js +45 -19
  2. package/dist/hooks/index.js +1 -1
  3. package/dist/layouts/index.js +36 -11
  4. package/dist/pages/index.js +1974 -999
  5. package/dist/services/index.js +1 -21
  6. package/dist/style/datastake/mapbox-gl.css +330 -0
  7. package/package.json +1 -1
  8. package/src/@daf/core/components/Screens/TableScreen/TablePageWithTabs/index.jsx +9 -4
  9. package/src/@daf/core/components/Table/index.jsx +2 -2
  10. package/src/@daf/core/components/UI/KeyIndicatorNavigateLabel/index.jsx +29 -0
  11. package/src/@daf/hooks/useFilters.js +1 -1
  12. package/src/@daf/layouts/AppLayout/components/MobileDrawer/index.js +4 -2
  13. package/src/@daf/layouts/AppLayout/components/UserDropdown/index.js +23 -2
  14. package/src/@daf/layouts/AppLayout/index.jsx +2 -0
  15. package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/GenderDistribution/config.js +7 -6
  16. package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/GenderDistribution/index.js +2 -1
  17. package/src/@daf/pages/Dashboards/SupplyChain/components/KeyIndicators/config.js +29 -53
  18. package/src/@daf/pages/Dashboards/SupplyChain/index.jsx +2 -2
  19. package/src/@daf/pages/Dashboards/UserDashboard/components/KeyIndicators/config.js +36 -70
  20. package/src/@daf/pages/Documents/index.jsx +9 -13
  21. package/src/@daf/pages/Events/Activities/index.jsx +8 -21
  22. package/src/@daf/pages/Events/Incidents/index.jsx +8 -21
  23. package/src/@daf/pages/Events/index.jsx +8 -20
  24. package/src/@daf/pages/Locations/MineSite/index.jsx +8 -21
  25. package/src/@daf/pages/Locations/index.jsx +9 -12
  26. package/src/@daf/pages/Partners/columns.js +421 -0
  27. package/src/@daf/pages/Partners/config.js +32 -0
  28. package/src/@daf/pages/Partners/create.jsx +145 -0
  29. package/src/@daf/pages/Partners/edit.jsx +98 -0
  30. package/src/@daf/pages/Partners/hook.js +153 -0
  31. package/src/@daf/pages/Partners/index.jsx +233 -8
  32. package/src/@daf/pages/Stakeholders/Operators/index.jsx +8 -22
  33. package/src/@daf/pages/Stakeholders/Workers/index.jsx +8 -21
  34. package/src/@daf/pages/Stakeholders/index.jsx +9 -10
  35. package/src/@daf/pages/Summary/Activities/PlantingCycle/config.js +40 -0
  36. package/src/@daf/pages/Summary/Activities/PlantingCycle/helper.js +122 -0
  37. package/src/@daf/pages/Summary/Activities/PlantingCycle/index.jsx +46 -0
  38. package/src/@daf/pages/Summary/Activities/Restoration/config.js +1 -1
  39. package/src/@daf/pages/hook.js +34 -0
  40. package/src/@daf/services/PartnerService.js +1 -16
  41. package/src/index.js +1 -1
  42. package/src/pages.js +2 -0
@@ -1,20 +1,17 @@
1
1
  import React from "react";
2
2
  import CustomIcon from '../../../../../core/components/Icon/CustomIcon.jsx';
3
+ import KeyIndicatorNavigateLabel from '../../../../../core/components/UI/KeyIndicatorNavigateLabel/index.jsx';
3
4
 
4
5
  export const getRowConfig = ({ t, data = {}, goTo, getRedirectLink, theme = {} }) => [
5
6
  {
6
7
  label: (
7
- <div className="flex">
8
- <div className="flex-1">{t("Identified Mine Sites")}</div>
9
- <div className="cursor-pointer" onClick={() => goTo(getRedirectLink("/app/production-sites"))}>
10
- <CustomIcon
11
- name="LinkNewTab"
12
- width={16}
13
- height={16}
14
- color={theme.colorPrimary}
15
- />
16
- </div>
17
- </div>
8
+ <KeyIndicatorNavigateLabel
9
+ t={t}
10
+ getRedirectLink={getRedirectLink}
11
+ theme={theme}
12
+ label="Identified Mine Sites"
13
+ link="/app/production-sites"
14
+ />
18
15
  ),
19
16
  render: () => {
20
17
  return <span>{data.mineSites ?? 0}</span>;
@@ -22,20 +19,13 @@ export const getRowConfig = ({ t, data = {}, goTo, getRedirectLink, theme = {} }
22
19
  },
23
20
  {
24
21
  label: (
25
- <div className="flex">
26
- <div className="flex-1">{t("Identified Operators")}</div>
27
- <div
28
- className="cursor-pointer"
29
- onClick={() => goTo(getRedirectLink("/app/operators"))}
30
- >
31
- <CustomIcon
32
- name="LinkNewTab"
33
- width={16}
34
- height={16}
35
- color={theme.colorPrimary}
36
- />
37
- </div>
38
- </div>
22
+ <KeyIndicatorNavigateLabel
23
+ t={t}
24
+ getRedirectLink={getRedirectLink}
25
+ theme={theme}
26
+ label="Identified Operators"
27
+ link="/app/operators"
28
+ />
39
29
  ),
40
30
  render: () => <span>{data?.operators ?? 0}</span>,
41
31
  },
@@ -49,39 +39,25 @@ export const getRowConfig = ({ t, data = {}, goTo, getRedirectLink, theme = {} }
49
39
  },
50
40
  {
51
41
  label: (
52
- <div className="flex">
53
- <div className="flex-1">{t("Associated Documents")}</div>
54
- <div
55
- className="cursor-pointer"
56
- onClick={() => goTo(getRedirectLink("/app/documents"))}
57
- >
58
- <CustomIcon
59
- name="LinkNewTab"
60
- width={16}
61
- height={16}
62
- color={theme.colorPrimary}
63
- />
64
- </div>
65
- </div>
42
+ <KeyIndicatorNavigateLabel
43
+ t={t}
44
+ getRedirectLink={getRedirectLink}
45
+ theme={theme}
46
+ label="Associated Documents"
47
+ link="/app/documents"
48
+ />
66
49
  ),
67
50
  render: () => <span>{data.documents ?? 0}</span>,
68
51
  },
69
52
  {
70
53
  label: (
71
- <div className="flex">
72
- <div className="flex-1">{t("Information Sources")}</div>
73
- <div
74
- className="cursor-pointer"
75
- onClick={() => goTo(getRedirectLink("/app/partners"))}
76
- >
77
- <CustomIcon
78
- name="LinkNewTab"
79
- width={16}
80
- height={16}
81
- color={theme.colorPrimary}
82
- />
83
- </div>
84
- </div>
54
+ <KeyIndicatorNavigateLabel
55
+ t={t}
56
+ getRedirectLink={getRedirectLink}
57
+ theme={theme}
58
+ label="Information Sources"
59
+ link="/app/partners"
60
+ />
85
61
  ),
86
62
  render: () => <span>{data.sources ?? 0}</span>,
87
63
  },
@@ -79,9 +79,9 @@ function SupplyChain({
79
79
  <section>
80
80
  <SupplyChainMap selectedSources={selectedPartners} t={t} goTo={goTo} options={options} getRedirectLink={getRedirectLink} />
81
81
  </section>
82
- <section>
82
+ {/* <section>
83
83
  <TradeRelationships selectedSources={selectedPartners} t={t} options={options} goTo={goTo} hardcodedData={hardcodedData} />
84
- </section>
84
+ </section> */}
85
85
  <section>
86
86
  <ChartsContainer selectedSources={selectedPartners} t={t} theme={theme} options={options} />
87
87
  </section>
@@ -1,23 +1,17 @@
1
1
  import React from 'react';
2
2
  import CustomIcon from '../../../../../core/components/Icon/CustomIcon.jsx';
3
+ import KeyIndicatorNavigateLabel from '../../../../../core/components/UI/KeyIndicatorNavigateLabel/index.jsx';
3
4
 
4
5
  export const getRowConfig = ({ t, data = {}, goTo, getRedirectLink, theme = {} }) => [
5
6
  {
6
7
  label: (
7
- <div className="flex">
8
- <div className="flex-1">{t("Monitored Locations")}</div>
9
- <div
10
- className="cursor-pointer"
11
- onClick={() => goTo(getRedirectLink("/app/locations"))}
12
- >
13
- <CustomIcon
14
- name="LinkNewTab"
15
- width={16}
16
- height={16}
17
- color={theme.colorPrimary}
18
- />
19
- </div>
20
- </div>
8
+ <KeyIndicatorNavigateLabel
9
+ t={t}
10
+ getRedirectLink={getRedirectLink}
11
+ theme={theme}
12
+ label="Monitored Locations"
13
+ link="/app/locations"
14
+ />
21
15
  ),
22
16
  render: () => {
23
17
  return <span>{data.locations ?? 0}</span>;
@@ -25,39 +19,25 @@ export const getRowConfig = ({ t, data = {}, goTo, getRedirectLink, theme = {} }
25
19
  },
26
20
  {
27
21
  label: (
28
- <div className="flex">
29
- <div className="flex-1">{t("Identified Stakeholders")}</div>
30
- <div
31
- className="cursor-pointer"
32
- onClick={() => goTo(getRedirectLink("/app/stakeholders"))}
33
- >
34
- <CustomIcon
35
- name="LinkNewTab"
36
- width={16}
37
- height={16}
38
- color={theme.colorPrimary}
39
- />
40
- </div>
41
- </div>
22
+ <KeyIndicatorNavigateLabel
23
+ t={t}
24
+ getRedirectLink={getRedirectLink}
25
+ theme={theme}
26
+ label="Identified Stakeholders"
27
+ link="/app/stakeholders"
28
+ />
42
29
  ),
43
30
  render: () => <span>{data?.stakeholders ?? 0}</span>,
44
31
  },
45
32
  {
46
33
  label: (
47
- <div className="flex">
48
- <div className="flex-1">{t("Corrective Actions")}</div>
49
- <div
50
- className="cursor-pointer"
51
- onClick={() => goTo(getRedirectLink("/app/activities"))}
52
- >
53
- <CustomIcon
54
- name="LinkNewTab"
55
- width={16}
56
- height={16}
57
- color={theme.colorPrimary}
58
- />
59
- </div>
60
- </div>
34
+ <KeyIndicatorNavigateLabel
35
+ t={t}
36
+ getRedirectLink={getRedirectLink}
37
+ theme={theme}
38
+ label="Activities"
39
+ link="/app/activities"
40
+ />
61
41
  ),
62
42
  render: () => {
63
43
  return (
@@ -73,20 +53,13 @@ export const getRowConfig = ({ t, data = {}, goTo, getRedirectLink, theme = {} }
73
53
  },
74
54
  {
75
55
  label: (
76
- <div className="flex">
77
- <div className="flex-1">{t("Reported Incidents")}</div>
78
- <div
79
- className="cursor-pointer"
80
- onClick={() => goTo(getRedirectLink("/app/incidents"))}
81
- >
82
- <CustomIcon
83
- name="LinkNewTab"
84
- width={16}
85
- height={16}
86
- color={theme.colorPrimary}
87
- />
88
- </div>
89
- </div>
56
+ <KeyIndicatorNavigateLabel
57
+ t={t}
58
+ getRedirectLink={getRedirectLink}
59
+ theme={theme}
60
+ label="Reported Incidents"
61
+ link="/app/incidents"
62
+ />
90
63
  ),
91
64
  render: () => (
92
65
  <span>
@@ -100,20 +73,13 @@ export const getRowConfig = ({ t, data = {}, goTo, getRedirectLink, theme = {} }
100
73
  },
101
74
  {
102
75
  label: (
103
- <div className="flex">
104
- <div className="flex-1">{t("Information Sources")}</div>
105
- <div
106
- className="cursor-pointer"
107
- onClick={() => goTo(getRedirectLink("/app/partners"))}
108
- >
109
- <CustomIcon
110
- name="LinkNewTab"
111
- width={16}
112
- height={16}
113
- color={theme.colorPrimary}
114
- />
115
- </div>
116
- </div>
76
+ <KeyIndicatorNavigateLabel
77
+ t={t}
78
+ getRedirectLink={getRedirectLink}
79
+ theme={theme}
80
+ label="Information Sources"
81
+ link="/app/partners"
82
+ />
117
83
  ),
118
84
  render: () => <span>{data.sources ?? 0}</span>,
119
85
  },
@@ -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 DocumentsTable = ({
10
11
  t = () => {},
@@ -35,6 +36,7 @@ const DocumentsTable = ({
35
36
  applications = [],
36
37
  subjectClear = () => {},
37
38
  breadcrumbs = [],
39
+ extendingFilters = {},
38
40
  }) => {
39
41
  const [selectOptions, setSelectOptions] = useState();
40
42
  const [activeTab, setActiveTab] = useState("own");
@@ -50,19 +52,13 @@ const DocumentsTable = ({
50
52
  applications,
51
53
  }), [t, goTo, user, options, activeTab, getRedirectLink, theme, applications]);
52
54
 
53
- const { paginationQuery, searchParams, otherParams, sortBy, sortDir } = useGetQueryParams({location});
54
-
55
- useEffect(() => {
56
- getData({
57
- pagination: paginationQuery,
58
- ...(Object.keys(otherParams).length > 0 && { filters: otherParams }),
59
- ...(Object.keys(searchParams).length > 0 && { search: searchParams }),
60
- tab: activeTab,
61
- sortBy: {
62
- [sortBy || "updatedAt"]: sortDir ? (sortDir === "ascend" ? 1 : -1) : -1,
63
- }
64
- }, 'documents')
65
- }, [paginationQuery, otherParams, searchParams, activeTab]);
55
+ useFetchData({
56
+ location,
57
+ getData,
58
+ activeTab,
59
+ extendingFilters,
60
+ subject: 'documents',
61
+ })
66
62
 
67
63
  const selectFiltersConfig = useMemo(() => {
68
64
  return getFiltersConfig({t});
@@ -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 ActivitiesTable = ({
10
11
  t = () => {},
@@ -53,27 +54,13 @@ const ActivitiesTable = ({
53
54
  applications,
54
55
  }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
55
56
 
56
- const { paginationQuery, searchParams, otherParams, sortBy, sortDir } = useGetQueryParams({location});
57
-
58
- const filters = useMemo(() => {
59
- return {
60
- ...otherParams,
61
- ...extendingFilters
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
- }, 'activities')
76
- }, [location.search, activeTab, JSON.stringify(extendingFilters)]);
57
+ useFetchData({
58
+ location,
59
+ getData,
60
+ activeTab,
61
+ extendingFilters,
62
+ subject: 'activities',
63
+ })
77
64
 
78
65
  const selectFiltersConfig = useMemo(() => {
79
66
  return getFiltersConfig({t});
@@ -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 IncidentsTable = ({
10
11
  t = () => {},
@@ -53,27 +54,13 @@ const IncidentsTable = ({
53
54
  applications,
54
55
  }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
55
56
 
56
- const { paginationQuery, searchParams, otherParams, sortBy, sortDir } = useGetQueryParams({location});
57
-
58
- const filters = useMemo(() => {
59
- return {
60
- ...otherParams,
61
- ...extendingFilters
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
- }, 'incidents')
76
- }, [location.search, activeTab, JSON.stringify(extendingFilters)]);
57
+ useFetchData({
58
+ location,
59
+ getData,
60
+ activeTab,
61
+ extendingFilters,
62
+ subject: 'incidents',
63
+ })
77
64
 
78
65
  const selectFiltersConfig = useMemo(() => {
79
66
  return getFiltersConfig({t});
@@ -5,6 +5,7 @@ import { checkboxConfig, getFiltersConfig, filtersConfig, getFilterOptions } fro
5
5
  import { useGetQueryParams } from '../../hooks/useGetQueryParams.js';
6
6
  import EventsCreate from './create.jsx';
7
7
  import { displayMessage } from '../../../helpers/messages.js';
8
+ import { useFetchData } from '../hook.js';
8
9
 
9
10
  const EventsTable = ({
10
11
  t = () => {},
@@ -53,26 +54,13 @@ const EventsTable = ({
53
54
  applications,
54
55
  }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
55
56
 
56
- const { paginationQuery, searchParams, otherParams, sortBy, sortDir } = useGetQueryParams({location});
57
-
58
- const filters = useMemo(() => {
59
- return {
60
- ...otherParams,
61
- ...extendingFilters
62
- }
63
- }, [otherParams, extendingFilters])
64
-
65
- useEffect(() => {
66
- getData({
67
- pagination: paginationQuery,
68
- ...(Object.keys(filters).length > 0 && { filters: filters }),
69
- ...(Object.keys(searchParams).length > 0 && { search: searchParams }),
70
- tab: activeTab,
71
- sortBy: {
72
- [sortBy || "updatedAt"]: sortDir ? (sortDir === "ascend" ? 1 : -1) : -1,
73
- }
74
- }, 'events')
75
- }, [location.search, activeTab, JSON.stringify(extendingFilters)]);
57
+ useFetchData({
58
+ location,
59
+ getData,
60
+ activeTab,
61
+ extendingFilters,
62
+ subject: 'events',
63
+ })
76
64
 
77
65
  const selectFiltersConfig = useMemo(() => {
78
66
  return getFiltersConfig({t});
@@ -5,6 +5,7 @@ import { checkboxConfig, getFiltersConfig, filtersConfig, getFilterOptions } fro
5
5
  import { useGetQueryParams } from '../../../hooks/useGetQueryParams.js';
6
6
  import ProductionSitesCreate from './create.jsx';
7
7
  import { displayMessage } from '../../../../helpers/messages.js';
8
+ import { useFetchData } from '../../hook.js';
8
9
 
9
10
  const ProductionSitesTable = ({
10
11
  t = () => {},
@@ -53,27 +54,13 @@ const ProductionSitesTable = ({
53
54
  applications,
54
55
  }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
55
56
 
56
- const { paginationQuery, searchParams, otherParams, sortBy, sortDir } = useGetQueryParams({location});
57
-
58
- const filters = useMemo(() => {
59
- return {
60
- ...otherParams,
61
- ...extendingFilters
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
- }, 'production-sites')
76
- }, [location.search, activeTab, JSON.stringify(extendingFilters)]);
57
+ useFetchData({
58
+ location,
59
+ getData,
60
+ activeTab,
61
+ extendingFilters,
62
+ subject: 'production-sites',
63
+ })
77
64
 
78
65
  const selectFiltersConfig = useMemo(() => {
79
66
  return getFiltersConfig({t});
@@ -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 LocationsTable = ({
10
11
  t = () => {},
@@ -35,6 +36,7 @@ const LocationsTable = ({
35
36
  applications = [],
36
37
  subjectClear = () => {},
37
38
  breadcrumbs = [],
39
+ extendingFilters = {},
38
40
  }) => {
39
41
  const [selectOptions, setSelectOptions] = useState();
40
42
  const [activeTab, setActiveTab] = useState("own");
@@ -52,18 +54,13 @@ const LocationsTable = ({
52
54
  applications,
53
55
  }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
54
56
 
55
- const { paginationQuery, searchParams, otherParams } = useGetQueryParams({location});
56
-
57
- useEffect(() => {
58
- getData({
59
- pagination: paginationQuery,
60
- ...(Object.keys(otherParams).length > 0 && { filters: otherParams }),
61
- ...(Object.keys(searchParams).length > 0 && { search: searchParams }),
62
- tab: activeTab,
63
- }, 'locations')
64
- }, [paginationQuery, otherParams, searchParams, activeTab]);
65
-
66
- console.log({data})
57
+ useFetchData({
58
+ location,
59
+ getData,
60
+ activeTab,
61
+ extendingFilters,
62
+ subject: 'locations',
63
+ })
67
64
 
68
65
  const selectFiltersConfig = useMemo(() => {
69
66
  return getFiltersConfig({t});