datastake-daf 0.6.744 → 0.6.746

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 (114) hide show
  1. package/dist/components/index.js +620 -900
  2. package/dist/context/index.js +0 -3
  3. package/dist/hooks/index.js +19 -4658
  4. package/dist/layouts/index.js +573 -916
  5. package/dist/pages/index.css +1 -0
  6. package/dist/pages/index.js +4391 -997
  7. package/dist/services/index.js +1 -7
  8. package/dist/style/datastake/mapbox-gl.css +330 -0
  9. package/dist/utils/index.js +466 -808
  10. package/package.json +3 -1
  11. package/rollup.config.js +7 -2
  12. package/src/@daf/core/components/Dashboard/Widget/ImageCarousel/index.jsx +75 -54
  13. package/src/@daf/core/components/Dashboard/Widget/ImageCarousel/style.js +44 -0
  14. package/src/@daf/core/components/DynamicForm/components/ajaxModal.js +1 -1
  15. package/src/@daf/core/components/EditForm/components/Comment/index.js +1 -1
  16. package/src/@daf/core/components/EditForm/components/DataLink/ajaxSelectDataLink.js +1 -1
  17. package/src/@daf/core/components/EditForm/components/DataLink/flat.js +1 -1
  18. package/src/@daf/core/components/EditForm/components/DataLink/index.js +1 -1
  19. package/src/@daf/core/components/EditForm/components/DataLinkGroup/index.js +1 -1
  20. package/src/@daf/core/components/EditForm/components/Repeatable/index.js +1 -1
  21. package/src/@daf/core/components/EditForm/components/ajaxSelect.js +1 -1
  22. package/src/@daf/core/components/EditForm/components/geolocation.js +1 -0
  23. package/src/@daf/core/components/EditForm/helper.js +0 -4
  24. package/src/@daf/core/components/Screens/Admin/AdminModals/CombineAccount/index.jsx +1 -1
  25. package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/index.jsx +1 -1
  26. package/src/@daf/core/components/Screens/Admin/AdminModals/CombineSubjects/index.jsx +1 -1
  27. package/src/@daf/core/components/Screens/TableScreen/TablePageWithTabs/index.jsx +128 -0
  28. package/src/@daf/{pages/pages → core/components/TableScreen}/TablePageWithTabs/index.jsx +5 -5
  29. package/src/@daf/layouts/AppLayout/index.jsx +5 -4
  30. package/src/@daf/layouts/AuthLayout/components/Select/style.js +1 -1
  31. package/src/@daf/layouts/AuthLayout/style.js +1 -1
  32. package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/ChartsContainer/components/Identification/index.js +0 -2
  33. package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/KeyIndicators/config.js +2 -2
  34. package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/MineSites/index.jsx +1 -5
  35. package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/config.js +2 -2
  36. package/src/@daf/pages/Documents/columns.js +102 -0
  37. package/src/@daf/pages/{dashboards/AllInformation/Documents → Documents}/create.jsx +2 -2
  38. package/src/@daf/pages/{dashboards/AllInformation/Documents → Documents}/index.jsx +9 -6
  39. package/src/@daf/pages/{dashboards/DueDilligence/Incidents → Events/Activities}/columns.js +8 -7
  40. package/src/@daf/pages/{dashboards/DueDilligence → Events}/Activities/create.jsx +2 -2
  41. package/src/@daf/pages/{dashboards/DueDilligence → Events}/Activities/index.jsx +6 -6
  42. package/src/@daf/pages/{dashboards/DueDilligence/Activities → Events/Incidents}/columns.js +5 -5
  43. package/src/@daf/pages/{dashboards/DueDilligence → Events}/Incidents/create.jsx +2 -2
  44. package/src/@daf/pages/{dashboards/DueDilligence → Events}/Incidents/index.jsx +5 -5
  45. package/src/@daf/pages/Events/columns.js +226 -0
  46. package/src/@daf/pages/{dashboards/AllInformation/Events → Events}/create.jsx +2 -2
  47. package/src/@daf/pages/{dashboards/AllInformation/Events → Events}/index.jsx +5 -9
  48. package/src/@daf/pages/{dashboards/Operations/ProductionSites → Locations/MineSite}/columns.js +4 -4
  49. package/src/@daf/pages/{dashboards/Operations/ProductionSites → Locations/MineSite}/create.jsx +2 -2
  50. package/src/@daf/pages/{dashboards/Operations/ProductionSites → Locations/MineSite}/index.jsx +5 -5
  51. package/src/@daf/pages/{dashboards/AllInformation/Locations → Locations}/columns.js +5 -5
  52. package/src/@daf/pages/{dashboards/AllInformation/Locations → Locations}/create.jsx +2 -2
  53. package/src/@daf/pages/{dashboards/AllInformation/Locations → Locations}/index.jsx +5 -5
  54. package/src/@daf/pages/{dashboards/Operations → Stakeholders}/Operators/columns.js +5 -5
  55. package/src/@daf/pages/{dashboards/Operations → Stakeholders}/Operators/create.jsx +2 -2
  56. package/src/@daf/pages/{dashboards/Operations → Stakeholders}/Operators/index.jsx +5 -5
  57. package/src/@daf/pages/{dashboards/Operations → Stakeholders}/Workers/columns.js +6 -6
  58. package/src/@daf/pages/{dashboards/Operations → Stakeholders}/Workers/create.jsx +2 -2
  59. package/src/@daf/pages/{dashboards/Operations → Stakeholders}/Workers/index.jsx +5 -5
  60. package/src/@daf/pages/{dashboards/AllInformation/Documents → Stakeholders}/columns.js +5 -5
  61. package/src/@daf/pages/{dashboards/AllInformation/Stakeholders → Stakeholders}/create.jsx +2 -2
  62. package/src/@daf/pages/{dashboards/AllInformation/Stakeholders → Stakeholders}/index.jsx +5 -5
  63. package/src/@daf/pages/Summary/Activities/Restoration/config.js +36 -0
  64. package/src/@daf/pages/Summary/Activities/Restoration/helper.js +98 -0
  65. package/src/@daf/pages/Summary/Activities/Restoration/index.jsx +178 -0
  66. package/src/@daf/pages/Summary/minesite/index.js +0 -0
  67. package/src/@daf/pages/Summary/operator/index.jsx +76 -0
  68. package/src/@daf/services/AuthenticationService.js +0 -1
  69. package/src/@daf/services/LinkedSubjects.js +1 -2
  70. package/src/pages.js +15 -13
  71. package/src/@daf/pages/dashboards/AllInformation/Events/columns.js +0 -151
  72. package/src/@daf/pages/dashboards/AllInformation/Stakeholders/columns.js +0 -132
  73. package/src/@daf/pages/dashboards/DueDilligence/Incidents2/columns.js +0 -176
  74. package/src/@daf/pages/dashboards/DueDilligence/Incidents2/config.js +0 -171
  75. package/src/@daf/pages/dashboards/DueDilligence/Incidents2/create.jsx +0 -104
  76. package/src/@daf/pages/dashboards/DueDilligence/Incidents2/index.jsx +0 -156
  77. /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/ChartsContainer/components/GenderDistribution/config.js +0 -0
  78. /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/ChartsContainer/components/GenderDistribution/index.js +0 -0
  79. /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/ChartsContainer/components/Identification/hook.js +0 -0
  80. /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/ChartsContainer/components/Locations/config.js +0 -0
  81. /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/ChartsContainer/components/Locations/index.js +0 -0
  82. /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/ChartsContainer/index.js +0 -0
  83. /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/KeyIndicators/config.js +0 -0
  84. /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/KeyIndicators/index.js +0 -0
  85. /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/SupplyChainMap/index.js +0 -0
  86. /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/TradeRelationships/index.js +0 -0
  87. /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/config.js +0 -0
  88. /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/index.jsx +0 -0
  89. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/AccumulationGraph/hook.js +0 -0
  90. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/AccumulationGraph/index.jsx +0 -0
  91. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/ContributionsGraph/helper.js +0 -0
  92. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/ContributionsGraph/hook.js +0 -0
  93. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/ContributionsGraph/index.jsx +0 -0
  94. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/CustomSegment/index.jsx +0 -0
  95. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/DataChainOfCustody/index.jsx +0 -0
  96. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/DataCompilation/index.jsx +0 -0
  97. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/DataConsilidation/index.jsx +0 -0
  98. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/KeyIndicators/index.jsx +0 -0
  99. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/MineSites/config.js +0 -0
  100. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/MineSites/helper.js +0 -0
  101. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/Triangulation/config.js +0 -0
  102. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/Triangulation/hook.js +0 -0
  103. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/Triangulation/index.jsx +0 -0
  104. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/index.jsx +0 -0
  105. /package/src/@daf/pages/{dashboards → Dashboards}/helper.js +0 -0
  106. /package/src/@daf/pages/{dashboards/AllInformation/Documents → Documents}/config.js +0 -0
  107. /package/src/@daf/pages/{dashboards/DueDilligence → Events}/Activities/config.js +0 -0
  108. /package/src/@daf/pages/{dashboards/DueDilligence → Events}/Incidents/config.js +0 -0
  109. /package/src/@daf/pages/{dashboards/AllInformation/Events → Events}/config.js +0 -0
  110. /package/src/@daf/pages/{dashboards/Operations/ProductionSites → Locations/MineSite}/config.js +0 -0
  111. /package/src/@daf/pages/{dashboards/AllInformation/Locations → Locations}/config.js +0 -0
  112. /package/src/@daf/pages/{dashboards/Operations → Stakeholders}/Operators/config.js +0 -0
  113. /package/src/@daf/pages/{dashboards/Operations → Stakeholders}/Workers/config.js +0 -0
  114. /package/src/@daf/pages/{dashboards/AllInformation/Stakeholders → Stakeholders}/config.js +0 -0
@@ -1,10 +1,10 @@
1
1
  import React, { useMemo, useState, useEffect, useCallback } from 'react'
2
- import TablePageWithTabs from '../../../pages/TablePageWithTabs/index.jsx'
2
+ import TablePageWithTabs from '../../../core/components/Screens/TableScreen/TablePageWithTabs/index.jsx'
3
3
  import { getColumns } from './columns.js';
4
4
  import { checkboxConfig, getFiltersConfig, filtersConfig, getFilterOptions } from './config.js';
5
- import { useGetQueryParams } from '../../../../hooks/useGetQueryParams.js';
5
+ import { useGetQueryParams } from '../../../hooks/useGetQueryParams.js';
6
6
  import ProductionSitesCreate from './create.jsx';
7
- import { displayMessage } from '../../../../../helpers/messages.js';
7
+ import { displayMessage } from '../../../../helpers/messages.js';
8
8
 
9
9
  const ProductionSitesTable = ({
10
10
  t = () => {},
@@ -36,7 +36,7 @@ const ProductionSitesTable = ({
36
36
  createDefaultValues = {},
37
37
  }) => {
38
38
  const [selectOptions, setSelectOptions] = useState();
39
- const [activeTab, setActiveTab] = useState();
39
+ const [activeTab, setActiveTab] = useState('own');
40
40
 
41
41
  const columns = useMemo(() => getColumns({
42
42
  t,
@@ -97,7 +97,7 @@ const ProductionSitesTable = ({
97
97
  location={location}
98
98
  loading={loading}
99
99
  goTo={goTo}
100
- defaultActiveTab={"all"}
100
+ defaultActiveTab={"own"}
101
101
  columns={columns}
102
102
  data={data}
103
103
  checkboxConfig={checkboxConfig}
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
2
  import { Tooltip } from 'antd';
3
- import { findOptions } from '../../../../../helpers/StringHelper.js';
4
- import { renderDateFormatted } from '../../../../../helpers/Forms.js';
5
- import CustomIcon from '../../../../core/components/Icon/CustomIcon.jsx';
6
- import AvatarGroup from '../../../../core/components/AvatarGroup/index.jsx';
7
- import sourceAvatarConfig from '../../../../../helpers/sourceAvatarConfig.js';
3
+ import { findOptions } from '../../../helpers/StringHelper.js';
4
+ import { renderDateFormatted } from '../../../helpers/Forms.js';
5
+ import CustomIcon from '../../core/components/Icon/CustomIcon.jsx';
6
+ import AvatarGroup from '../../core/components/AvatarGroup/index.jsx';
7
+ import sourceAvatarConfig from '../../../helpers/sourceAvatarConfig.js';
8
8
 
9
9
  const getLinkValue = (value, linkingObject) => {
10
10
  if(linkingObject && linkingObject?.[value]) {
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect} from 'react'
2
2
  import { message } from 'antd';
3
- import { MessageTypes } from '../../../../../helpers/messages.js';
4
- import DynamicForm from '../../../../core/components/DynamicForm/index.jsx';
3
+ import { MessageTypes } from '../../../helpers/messages.js';
4
+ import DynamicForm from '../../core/components/DynamicForm/index.jsx';
5
5
 
6
6
  const StakeholdersCreate = ({
7
7
  namespace = 'locations',
@@ -1,10 +1,10 @@
1
1
  import React, { useMemo, useState, useEffect, useCallback } from 'react'
2
- import TablePageWithTabs from '../../../pages/TablePageWithTabs/index.jsx'
2
+ import TablePageWithTabs from '../../core/components/Screens/TableScreen/TablePageWithTabs/index.jsx'
3
3
  import { getColumns } from './columns.js';
4
4
  import { checkboxConfig, getFiltersConfig, filtersConfig, getFilterOptions } from './config.js';
5
- import { useGetQueryParams } from '../../../../hooks/useGetQueryParams.js';
5
+ import { useGetQueryParams } from '../../hooks/useGetQueryParams.js';
6
6
  import StakeholdersCreate from './create.jsx';
7
- import { displayMessage } from '../../../../../helpers/messages.js';
7
+ import { displayMessage } from '../../../helpers/messages.js';
8
8
 
9
9
  const LocationsTable = ({
10
10
  t = () => {},
@@ -36,7 +36,7 @@ const LocationsTable = ({
36
36
  subjectClear = () => {},
37
37
  }) => {
38
38
  const [selectOptions, setSelectOptions] = useState();
39
- const [activeTab, setActiveTab] = useState();
39
+ const [activeTab, setActiveTab] = useState("own");
40
40
 
41
41
  const columns = useMemo(() => getColumns({
42
42
  t,
@@ -96,7 +96,7 @@ const LocationsTable = ({
96
96
  location={location}
97
97
  loading={loading}
98
98
  goTo={goTo}
99
- defaultActiveTab={"all"}
99
+ defaultActiveTab={"own"}
100
100
  columns={columns}
101
101
  data={data}
102
102
  checkboxConfig={checkboxConfig}
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
2
  import { Tooltip } from 'antd';
3
- import { findOptions } from '../../../../../helpers/StringHelper.js';
4
- import { renderDateFormatted } from '../../../../../helpers/Forms.js';
5
- import CustomIcon from '../../../../core/components/Icon/CustomIcon.jsx';
6
- import AvatarGroup from '../../../../core/components/AvatarGroup/index.jsx';
7
- import sourceAvatarConfig from '../../../../../helpers/sourceAvatarConfig.js';
3
+ import { findOptions } from '../../../../helpers/StringHelper.js';
4
+ import { renderDateFormatted } from '../../../../helpers/Forms.js';
5
+ import CustomIcon from '../../../core/components/Icon/CustomIcon.jsx';
6
+ import AvatarGroup from '../../../core/components/AvatarGroup/index.jsx';
7
+ import sourceAvatarConfig from '../../../../helpers/sourceAvatarConfig.js';
8
8
 
9
9
  const getLinkValue = (value, linkingObject) => {
10
10
  if(linkingObject && linkingObject?.[value]) {
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect} from 'react'
2
2
  import { message } from 'antd';
3
- import { MessageTypes } from '../../../../../helpers/messages.js';
4
- import DynamicForm from '../../../../core/components/DynamicForm/index.jsx';
3
+ import { MessageTypes } from '../../../../helpers/messages.js';
4
+ import DynamicForm from '../../../core/components/DynamicForm/index.jsx';
5
5
 
6
6
  const StakeholdersCreate = ({
7
7
  namespace = "OPERATOR",
@@ -1,10 +1,10 @@
1
1
  import React, { useMemo, useState, useEffect, useCallback } from 'react'
2
- import TablePageWithTabs from '../../../pages/TablePageWithTabs/index.jsx'
2
+ import TablePageWithTabs from '../../../core/components/Screens/TableScreen/TablePageWithTabs/index.jsx'
3
3
  import { getColumns } from './columns.js';
4
4
  import { checkboxConfig, getFiltersConfig, filtersConfig, getFilterOptions } from './config.js';
5
- import { useGetQueryParams } from '../../../../hooks/useGetQueryParams.js';
5
+ import { useGetQueryParams } from '../../../hooks/useGetQueryParams.js';
6
6
  import StakeholdersCreate from './create.jsx';
7
- import { displayMessage } from '../../../../../helpers/messages.js';
7
+ import { displayMessage } from '../../../../helpers/messages.js';
8
8
 
9
9
  const OperatorsTable = ({
10
10
  t = () => {},
@@ -37,7 +37,7 @@ const OperatorsTable = ({
37
37
  applications = [],
38
38
  }) => {
39
39
  const [selectOptions, setSelectOptions] = useState();
40
- const [activeTab, setActiveTab] = useState();
40
+ const [activeTab, setActiveTab] = useState('own');
41
41
 
42
42
  const columns = useMemo(() => getColumns({
43
43
  t,
@@ -99,7 +99,7 @@ const OperatorsTable = ({
99
99
  location={location}
100
100
  loading={loading}
101
101
  goTo={goTo}
102
- defaultActiveTab={"all"}
102
+ defaultActiveTab={"own"}
103
103
  columns={columns}
104
104
  data={data}
105
105
  checkboxConfig={checkboxConfig}
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
2
  import { Tooltip, Tag } from 'antd';
3
- import { findOptions } from '../../../../../helpers/StringHelper.js';
4
- import { renderDateFormatted } from '../../../../../helpers/Forms.js';
5
- import CustomIcon from '../../../../core/components/Icon/CustomIcon.jsx';
6
- import AvatarGroup from '../../../../core/components/AvatarGroup/index.jsx';
7
- import sourceAvatarConfig from '../../../../../helpers/sourceAvatarConfig.js';
3
+ import { findOptions } from '../../../../helpers/StringHelper.js';
4
+ import { renderDateFormatted } from '../../../../helpers/Forms.js';
5
+ import CustomIcon from '../../../core/components/Icon/CustomIcon.jsx';
6
+ import AvatarGroup from '../../../core/components/AvatarGroup/index.jsx';
7
+ import sourceAvatarConfig from '../../../../helpers/sourceAvatarConfig.js';
8
8
 
9
9
  const getLinkValue = (value, linkingObject) => {
10
10
  if(linkingObject && linkingObject?.[value]) {
@@ -137,7 +137,7 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
137
137
 
138
138
  const sources = sourceAvatarConfig(val, user, applications);
139
139
 
140
- return <AvatarGroup items={val}></AvatarGroup>;
140
+ return <AvatarGroup items={sources}></AvatarGroup>;
141
141
  },
142
142
  },
143
143
  {
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect} from 'react'
2
2
  import { message } from 'antd';
3
- import { MessageTypes } from '../../../../../helpers/messages.js';
4
- import DynamicForm from '../../../../core/components/DynamicForm/index.jsx';
3
+ import { MessageTypes } from '../../../../helpers/messages.js';
4
+ import DynamicForm from '../../../core/components/DynamicForm/index.jsx';
5
5
 
6
6
  const StakeholdersCreate = ({
7
7
  namespace = "WORKERS",
@@ -1,10 +1,10 @@
1
1
  import React, { useMemo, useState, useEffect, useCallback } from 'react'
2
- import TablePageWithTabs from '../../../pages/TablePageWithTabs/index.jsx'
2
+ import TablePageWithTabs from '../../../core/components/Screens/TableScreen/TablePageWithTabs/index.jsx'
3
3
  import { getColumns } from './columns.js';
4
4
  import { checkboxConfig, getFiltersConfig, filtersConfig, getFilterOptions } from './config.js';
5
- import { useGetQueryParams } from '../../../../hooks/useGetQueryParams.js';
5
+ import { useGetQueryParams } from '../../../hooks/useGetQueryParams.js';
6
6
  import StakeholdersCreate from './create.jsx';
7
- import { displayMessage } from '../../../../../helpers/messages.js';
7
+ import { displayMessage } from '../../../../helpers/messages.js';
8
8
 
9
9
  const WorkersTable = ({
10
10
  t = () => {},
@@ -37,7 +37,7 @@ const WorkersTable = ({
37
37
  applications = [],
38
38
  }) => {
39
39
  const [selectOptions, setSelectOptions] = useState();
40
- const [activeTab, setActiveTab] = useState();
40
+ const [activeTab, setActiveTab] = useState('own');
41
41
 
42
42
  const columns = useMemo(() => getColumns({
43
43
  t,
@@ -99,7 +99,7 @@ const WorkersTable = ({
99
99
  location={location}
100
100
  loading={loading}
101
101
  goTo={goTo}
102
- defaultActiveTab={"all"}
102
+ defaultActiveTab={"own"}
103
103
  columns={columns}
104
104
  data={data}
105
105
  checkboxConfig={checkboxConfig}
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
2
  import { Tooltip } from 'antd';
3
- import { findOptions } from '../../../../../helpers/StringHelper.js';
4
- import { renderDateFormatted } from '../../../../../helpers/Forms.js';
5
- import CustomIcon from '../../../../core/components/Icon/CustomIcon.jsx';
6
- import AvatarGroup from '../../../../core/components/AvatarGroup/index.jsx';
7
- import sourceAvatarConfig from '../../../../../helpers/sourceAvatarConfig.js';
3
+ import { findOptions } from '../../../helpers/StringHelper.js';
4
+ import { renderDateFormatted } from '../../../helpers/Forms.js';
5
+ import CustomIcon from '../../core/components/Icon/CustomIcon.jsx';
6
+ import AvatarGroup from '../../core/components/AvatarGroup/index.jsx';
7
+ import sourceAvatarConfig from '../../../helpers/sourceAvatarConfig.js';
8
8
 
9
9
  export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, applications}) => [
10
10
  {
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect} from 'react'
2
2
  import { message } from 'antd';
3
- import { MessageTypes } from '../../../../../helpers/messages.js';
4
- import DynamicForm from '../../../../core/components/DynamicForm/index.jsx';
3
+ import { MessageTypes } from '../../../helpers/messages.js';
4
+ import DynamicForm from '../../core/components/DynamicForm/index.jsx';
5
5
 
6
6
  const StakeholdersCreate = ({
7
7
  namespace = 'stakeholders',
@@ -1,10 +1,10 @@
1
1
  import React, { useMemo, useState, useEffect, useCallback } from 'react'
2
- import TablePageWithTabs from '../../../pages/TablePageWithTabs/index.jsx'
2
+ import TablePageWithTabs from '../../core/components/Screens/TableScreen/TablePageWithTabs/index.jsx'
3
3
  import { getColumns } from './columns.js';
4
4
  import { checkboxConfig, getFiltersConfig, filtersConfig, getFilterOptions } from './config.js';
5
- import { useGetQueryParams } from '../../../../hooks/useGetQueryParams.js';
5
+ import { useGetQueryParams } from '../../hooks/useGetQueryParams.js';
6
6
  import StakeholdersCreate from './create.jsx';
7
- import { displayMessage } from '../../../../../helpers/messages.js';
7
+ import { displayMessage } from '../../../helpers/messages.js';
8
8
 
9
9
  const StakeholdersTable = ({
10
10
  t = () => {},
@@ -36,7 +36,7 @@ const StakeholdersTable = ({
36
36
  subjectClear = () => {},
37
37
  }) => {
38
38
  const [selectOptions, setSelectOptions] = useState();
39
- const [activeTab, setActiveTab] = useState();
39
+ const [activeTab, setActiveTab] = useState("own");
40
40
  const columns = useMemo(() => getColumns({
41
41
  t,
42
42
  goTo,
@@ -92,7 +92,7 @@ const StakeholdersTable = ({
92
92
  location={location}
93
93
  loading={loading}
94
94
  goTo={goTo}
95
- defaultActiveTab={"all"}
95
+ defaultActiveTab={"own"}
96
96
  columns={columns}
97
97
  data={data}
98
98
  checkboxConfig={checkboxConfig}
@@ -0,0 +1,36 @@
1
+ import React from "react";
2
+
3
+ export const getKeyIndicatorsRowConfig = ({ t, data = {} }) => [
4
+
5
+ {
6
+ label: t('Primary Data Collection'),
7
+ render: () => {
8
+ let displayValue = '-';
9
+
10
+ if (data?.origin?.[0]?.name === 'straatos') {
11
+ displayValue = data?.author?.name || '-';
12
+ } else if (data?.formCompleterType === 'localRelay') {
13
+ displayValue = 'Relay (Allcot Senegal)';
14
+ } else if (data?.formCompleterType === 'technicalPartner') {
15
+ displayValue = data?.technicalPartner?.name || '-';
16
+ } else {
17
+ displayValue = data?.author?.name || '-';
18
+ }
19
+
20
+ return <div className="flex">{displayValue}</div>;
21
+ }
22
+ },
23
+ {
24
+ label: t('Implementation Partner'),
25
+ render: () => <div>{data?.technicalPartner?.name || '-'}</div>
26
+ },
27
+ {
28
+ label: t('Activity Participants'),
29
+ render: () => <div>{'0'}</div>
30
+ },
31
+ {
32
+ label: t('Hectares Planted'),
33
+ render: () => <div>{data?.hectaresPlanted || '0 ha'}</div>
34
+ },
35
+
36
+ ];
@@ -0,0 +1,98 @@
1
+ // ============================================================================
2
+ // REGION: Photo/Image Extraction
3
+ // ============================================================================
4
+
5
+ /**
6
+ * Extract images from a photo document
7
+ * Handles both documents with pictures arrays and direct image objects
8
+ */
9
+ export const extractFromPhotoDoc = (photoDoc, label, docIndex) => {
10
+ const photos = photoDoc?.pictures?.filter(p => p?.url) || (photoDoc?.url ? [photoDoc] : []);
11
+
12
+ return photos.map((photo, photoIndex) => ({
13
+ src: normalizeUrl(photo.url),
14
+ alt: photo.name || photo.alt || `${label} - Image ${docIndex + 1}-${photoIndex + 1}`
15
+ }));
16
+ };
17
+
18
+ /**
19
+ * Normalize URL by removing trailing colon if present
20
+ */
21
+ const normalizeUrl = (url) => url?.endsWith(':') ? url.slice(0, -1) : url;
22
+
23
+ // ============================================================================
24
+ // REGION: Gender Distribution
25
+ // ============================================================================
26
+
27
+ // Gender distribution colors for pie chart
28
+ const GENDER_COLORS = ['#016C6E', '#00AEB1']; // Male (dark teal), Female (light teal)
29
+
30
+ /**
31
+ * Get gender distribution data from activityData
32
+ * Maps genderDistributionMale and genderDistributionFemale to a structured object
33
+ */
34
+ export const getGenderDistributionData = (activityData) => {
35
+ return {
36
+ Male: activityData?.genderDistributionMale || 0,
37
+ Female: activityData?.genderDistributionFemale || 0,
38
+ };
39
+ };
40
+
41
+ /**
42
+ * Check if gender distribution is empty
43
+ * Returns true if all values are 0 or falsy
44
+ */
45
+ export const isGenderDistributionEmpty = (genderDistributionData) => {
46
+ return Object.values(genderDistributionData).every(val => !val || val === 0);
47
+ };
48
+
49
+ /**
50
+ * Calculate pie chart data from gender distribution
51
+ * Computes percentages and assigns colors based on gender distribution values
52
+ */
53
+ export const calculateGenderPieData = (genderDistributionData) => {
54
+ const total = Object.values(genderDistributionData).reduce((all, val) => all + (val || 0), 0);
55
+
56
+ return Object.keys(genderDistributionData).map((key, index) => {
57
+ const color = GENDER_COLORS[index % GENDER_COLORS.length];
58
+
59
+ return {
60
+ value: genderDistributionData[key] || 0,
61
+ percent: total > 0 ? (genderDistributionData[key] || 0) / total : 0,
62
+ color: color,
63
+ label: key,
64
+ key: key,
65
+ };
66
+ });
67
+ };
68
+
69
+ /**
70
+ * Get tooltip children for gender distribution pie chart
71
+ * Generates tooltip content showing gender label and value
72
+ */
73
+ export const getGenderTooltipChildren = (item, isEmpty, genderDistributionData, t, renderTooltipJsx) => {
74
+ if (isEmpty) {
75
+ if (!Object.keys(genderDistributionData).length) {
76
+ return null;
77
+ }
78
+
79
+ return renderTooltipJsx({
80
+ title: t("Gender"),
81
+ items: Object.keys(genderDistributionData).map((k) => ({
82
+ label: k,
83
+ value: 0,
84
+ })),
85
+ });
86
+ }
87
+
88
+ return renderTooltipJsx({
89
+ title: t("Gender"),
90
+ items: [
91
+ {
92
+ color: item.color,
93
+ label: t(item.label),
94
+ value: `${item.value || 0}`,
95
+ },
96
+ ],
97
+ });
98
+ };
@@ -0,0 +1,178 @@
1
+ import { useMemo, useCallback } from 'react';
2
+ import { DashboardLayout, Header, ImageCarousel, KeyIndicators, MineSiteMap, Widget, PieChart } from '../../../../../../src/index.js'
3
+ import { getKeyIndicatorsRowConfig } from './config';
4
+ import { extractFromPhotoDoc, getGenderDistributionData, isGenderDistributionEmpty, calculateGenderPieData, getGenderTooltipChildren } from './helper';
5
+ import { renderTooltipJsx } from '../../../../../../src/utils';
6
+ import { useResizeContext } from '../../../../../../src/context';
7
+
8
+ const RestorationActivitySummary = ({ activityData, supportText, onDownload, downloadDisabled, actionButtons, breadcrumbs, goBackTo, loading, t = () => { } }) => {
9
+ const { isCollapsed, isNestedSidebarCollapsed } = useResizeContext();
10
+ const keyIndicatorsConfig = useMemo(() => getKeyIndicatorsRowConfig({ t, data: activityData }), [t, activityData]);
11
+ const images = useMemo(() => {
12
+
13
+ const photoArrays = [
14
+ { data: activityData?.groupPhotos, label: 'Group Photo' },
15
+ { data: activityData?.photosStartActivity, label: 'Start of Activity' },
16
+ { data: activityData?.photosDuringActivity, label: 'During Activity' },
17
+ { data: activityData?.photosEndActivity, label: 'End of Activity' }
18
+ ];
19
+
20
+ return photoArrays
21
+ .flatMap(({ data, label }) =>
22
+ Array.isArray(data)
23
+ ? data.flatMap((photoDoc, index) => extractFromPhotoDoc(photoDoc, label, index))
24
+ : []
25
+ );
26
+ }, [activityData]);
27
+ const genderDistributionData = useMemo(() => getGenderDistributionData(activityData), [activityData]);
28
+ const isEmpty = useMemo(() => isGenderDistributionEmpty(genderDistributionData), [genderDistributionData]);
29
+ const pieData = useMemo(() => calculateGenderPieData(genderDistributionData), [genderDistributionData]);
30
+
31
+ const getTooltipChildren = useCallback(
32
+ (item) => getGenderTooltipChildren(item, isEmpty, genderDistributionData, t, renderTooltipJsx),
33
+ [t, isEmpty, genderDistributionData],
34
+ );
35
+ return (
36
+ <DashboardLayout
37
+ header={
38
+ <Header
39
+ title={'Restoration Activity Summary'}
40
+ supportText={supportText || ''}
41
+ onDownload={onDownload}
42
+ downloadDisabled={downloadDisabled}
43
+ actionButtons={actionButtons}
44
+ breadcrumbs={breadcrumbs}
45
+ goBackTo={goBackTo}
46
+ loading={loading}
47
+ />
48
+ }
49
+ >
50
+ <section>
51
+ <KeyIndicators title={t("Key Information")} config={keyIndicatorsConfig} loading={loading} />
52
+ </section>
53
+
54
+ <section>
55
+ <Widget
56
+ title={t("Activity Location")}
57
+ className="no-px no-pb-body"
58
+ style={{ height: '100%', display: 'flex', flexDirection: 'column' }}
59
+ >
60
+ <div style={{ flex: 1, minHeight: 0 }}>
61
+ <MineSiteMap
62
+ loading={loading}
63
+ t={t}
64
+ isSatellite={true}
65
+ app={"straatos"}
66
+ showSider={false}
67
+ user={null}
68
+ data={[
69
+ {
70
+ _id: {},
71
+ id: "7f2aaed4-4b2e-406c-8e0a-6659c5c8367b",
72
+ color: "#6698E4",
73
+ parent: {
74
+ _id: {},
75
+ createdAt: "2024-06-13T14:51:55.296Z",
76
+ updatedAt: "2024-06-13T14:51:55.296Z",
77
+ id: "a5340bf1-2c7d-413f-a2a5-ccd7dc8f7a7c",
78
+ name: "New Mine",
79
+ authorId: "4e6066e9-00d8-423a-94ec-c7c9d3432fec",
80
+ collectId: "f8a2b6a9cc935ef3e5844427f49aade34e152eca",
81
+ country: "AL",
82
+ category: "mineSite",
83
+ datastakeId: "LOC-00000000141",
84
+ __v: 0,
85
+ },
86
+ administrativeLevel1: "6839cb26-5af4-44a3-b136-a0f0a0bcecc6",
87
+ administrativeLevel2: "f849835d-5640-4bee-ae98-9f1c810c1abe",
88
+ // "name": "New Mine",
89
+ country: "AL",
90
+ category: "mineSite",
91
+ authorId: "4e6066e9-00d8-423a-94ec-c7c9d3432fec",
92
+ gps: {
93
+ latitude: 7,
94
+ longitude: 1,
95
+ },
96
+ area: [
97
+ [6, 5],
98
+ [7, 1],
99
+ [9, 2],
100
+ ],
101
+ associatedSubjects: [
102
+ {
103
+ entity: "Event",
104
+ _id: {},
105
+ nature: "",
106
+ },
107
+ ],
108
+ published: false,
109
+ version: 1,
110
+ createdAt: "2024-06-13T14:51:55.296Z",
111
+ updatedAt: "2024-06-13T14:51:55.296Z",
112
+ name: "Name",
113
+ type: "Loc Type",
114
+ __v: 0,
115
+ datastakeId: "LOC-00000000141",
116
+ },
117
+ ]}
118
+ // tooltipAsText: true,
119
+ primaryLink={true}
120
+ renderTooltip={() => {
121
+ return [
122
+ {
123
+ label: "Name",
124
+ value: "Name",
125
+ },
126
+ ];
127
+ }}
128
+ center={[13, -15]}
129
+ mapConfig={{ maxZoom: 18 }}
130
+ type={'territory'}
131
+ link={true}
132
+ onClickLink={() => { }}
133
+ />
134
+ </div>
135
+ </Widget>
136
+ </section>
137
+
138
+ <section>
139
+ <div style={{ maxWidth: "70%", width: "calc(100% - 405px)" }}>
140
+ <ImageCarousel
141
+ loading={loading}
142
+ images={images}
143
+ title={t("straatos::activity-imagery")}
144
+ key={`${isCollapsed}-${isNestedSidebarCollapsed}`}
145
+ customArrows={true}
146
+ activeDotColor="#003435"
147
+ />
148
+ </div>
149
+ <Widget
150
+ loading={loading}
151
+ title={<div>{t("Workers Distribution")}</div>}
152
+ className="with-border-header h-w-btn-header "
153
+ >
154
+ <div
155
+ style={{
156
+ marginTop: "auto",
157
+ marginBottom: "auto",
158
+ }}
159
+ >
160
+ <PieChart
161
+ mouseXOffset={10}
162
+ mouseYOffset={10}
163
+ changeOpacityOnHover={false}
164
+ data={pieData}
165
+ doConstraints={false}
166
+ isPie
167
+ t={t}
168
+ isEmpty={isEmpty}
169
+ getTooltipChildren={getTooltipChildren}
170
+ />
171
+ </div>
172
+ </Widget>
173
+ </section>
174
+ </DashboardLayout>
175
+ )
176
+ }
177
+
178
+ export default RestorationActivitySummary;
File without changes