datastake-daf 0.6.767 → 0.6.769

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 (79) hide show
  1. package/dist/components/index.js +1007 -730
  2. package/dist/layouts/index.js +495 -459
  3. package/dist/pages/index.js +7914 -6836
  4. package/dist/style/datastake/mapbox-gl.css +330 -0
  5. package/dist/utils/index.js +481 -457
  6. package/package.json +1 -1
  7. package/src/@daf/core/components/Charts/ColumnChart/index.jsx +10 -0
  8. package/src/@daf/core/components/Charts/LineChart/index.jsx +14 -0
  9. package/src/@daf/core/components/Dashboard/Map/ChainIcon/Markers/StakeholderMarker.js +5 -2
  10. package/src/@daf/core/components/Dashboard/Map/ChainIcon/index.js +67 -27
  11. package/src/@daf/core/components/Dashboard/Map/hook.js +26 -32
  12. package/src/@daf/core/components/Dashboard/Widget/ActivityIndicators/index.jsx +2 -0
  13. package/src/@daf/core/components/Dashboard/Widget/StatCard/StatCard.stories.js +226 -0
  14. package/src/@daf/core/components/Dashboard/Widget/StatCard/index.js +103 -0
  15. package/src/@daf/core/components/Dashboard/Widget/StatCard/style.js +83 -0
  16. package/src/@daf/core/components/Icon/configs/Down.js +8 -0
  17. package/src/@daf/core/components/Icon/configs/Up.js +8 -0
  18. package/src/@daf/core/components/Icon/configs/index.js +4 -0
  19. package/src/@daf/core/components/Icon/configs/partnerIcon.js +1 -1
  20. package/src/@daf/core/components/Screens/BaseScreen/index.jsx +1 -1
  21. package/src/@daf/core/components/Screens/TableScreen/TablePageWithTabs/index.jsx +1 -1
  22. package/src/@daf/core/components/Sidenav/Menu.jsx +4 -4
  23. package/src/@daf/core/components/UI/MissingTagButton/index.jsx +36 -0
  24. package/src/@daf/pages/Dashboards/SupplyChain/components/SupplyChainMap/index.js +0 -2
  25. package/src/@daf/pages/Documents/config.js +0 -10
  26. package/src/@daf/pages/Documents/index.jsx +51 -108
  27. package/src/@daf/pages/Events/Activities/config.js +1 -11
  28. package/src/@daf/pages/Events/Activities/index.jsx +47 -105
  29. package/src/@daf/pages/Events/Incidents/config.js +1 -11
  30. package/src/@daf/pages/Events/Incidents/index.jsx +47 -105
  31. package/src/@daf/pages/Events/config.js +18 -34
  32. package/src/@daf/pages/Events/index.jsx +49 -111
  33. package/src/@daf/pages/Locations/MineSite/config.js +0 -10
  34. package/src/@daf/pages/Locations/MineSite/index.jsx +47 -105
  35. package/src/@daf/pages/Locations/config.js +4 -16
  36. package/src/@daf/pages/Locations/index.jsx +53 -110
  37. package/src/@daf/pages/Stakeholders/Operators/config.js +0 -10
  38. package/src/@daf/pages/Stakeholders/Operators/index.jsx +47 -105
  39. package/src/@daf/pages/Stakeholders/Workers/config.js +0 -10
  40. package/src/@daf/pages/Stakeholders/Workers/index.jsx +47 -105
  41. package/src/@daf/pages/Stakeholders/config.js +3 -15
  42. package/src/@daf/pages/Stakeholders/index.jsx +53 -109
  43. package/src/@daf/pages/Summary/Activities/PlantingCycle/components/AssociatedInformation/index.jsx +43 -0
  44. package/src/@daf/pages/Summary/Activities/PlantingCycle/components/CommunityParticipation/CommunityStats/helper.js +60 -0
  45. package/src/@daf/pages/Summary/Activities/PlantingCycle/components/CommunityParticipation/CommunityStats/index.jsx +36 -0
  46. package/src/@daf/pages/Summary/Activities/PlantingCycle/components/CommunityParticipation/GenderDistribution/helper.js +117 -0
  47. package/src/@daf/pages/Summary/Activities/PlantingCycle/components/CommunityParticipation/GenderDistribution/index.jsx +49 -0
  48. package/src/@daf/pages/Summary/Activities/PlantingCycle/components/CommunityParticipation/JobsTimeline/index.jsx +212 -0
  49. package/src/@daf/pages/Summary/Activities/PlantingCycle/components/CommunityParticipation/index.jsx +72 -0
  50. package/src/@daf/pages/Summary/Activities/PlantingCycle/components/CycleIndicators/CyclePartners/helper.js +91 -0
  51. package/src/@daf/pages/Summary/Activities/PlantingCycle/components/CycleIndicators/CyclePartners/index.jsx +50 -0
  52. package/src/@daf/pages/Summary/Activities/PlantingCycle/components/CycleIndicators/HealthAndSafety/helper.js +134 -0
  53. package/src/@daf/pages/Summary/Activities/PlantingCycle/components/CycleIndicators/HealthAndSafety/index.jsx +49 -0
  54. package/src/@daf/pages/Summary/Activities/PlantingCycle/components/CycleIndicators/index.jsx +112 -0
  55. package/src/@daf/pages/Summary/Activities/PlantingCycle/components/CycleOutcomes/index.jsx +498 -0
  56. package/src/@daf/pages/Summary/Activities/PlantingCycle/components/KeyInformation/index.jsx +49 -0
  57. package/src/@daf/pages/Summary/Activities/PlantingCycle/components/PlantingLocations/index.jsx +120 -0
  58. package/src/@daf/pages/Summary/Activities/PlantingCycle/config.js +5 -10
  59. package/src/@daf/pages/Summary/Activities/PlantingCycle/helper.js +218 -0
  60. package/src/@daf/pages/Summary/Activities/PlantingCycle/index.jsx +22 -32
  61. package/src/@daf/pages/Summary/Activities/Restoration/components/ActivityImagery/index.jsx +29 -0
  62. package/src/@daf/pages/Summary/Activities/Restoration/components/ActivityLocation/index.jsx +94 -0
  63. package/src/@daf/pages/Summary/Activities/Restoration/components/WorkersDistribution/index.jsx +49 -0
  64. package/src/@daf/pages/Summary/Activities/Restoration/index.jsx +16 -138
  65. package/src/@daf/pages/TablePage/config.js +78 -0
  66. package/src/@daf/{core/components/Screens/TableScreen/TableWithTabsAndCreate → pages/TablePage}/create.jsx +6 -5
  67. package/src/@daf/pages/TablePage/hook.js +123 -0
  68. package/src/@daf/pages/TablePage/index.jsx +142 -0
  69. package/src/index.js +2 -0
  70. package/src/@daf/core/components/Screens/TableScreen/TableWithTabsAndCreate/index.jsx +0 -115
  71. package/src/@daf/pages/Documents/create.jsx +0 -105
  72. package/src/@daf/pages/Events/Activities/create.jsx +0 -104
  73. package/src/@daf/pages/Events/Incidents/create.jsx +0 -104
  74. package/src/@daf/pages/Events/create.jsx +0 -104
  75. package/src/@daf/pages/Locations/MineSite/create.jsx +0 -104
  76. package/src/@daf/pages/Locations/create.jsx +0 -104
  77. package/src/@daf/pages/Stakeholders/Operators/create.jsx +0 -104
  78. package/src/@daf/pages/Stakeholders/Workers/create.jsx +0 -104
  79. package/src/@daf/pages/Stakeholders/create.jsx +0 -105
@@ -0,0 +1,83 @@
1
+ import styled from 'styled-components';
2
+
3
+ const Style = styled.div`
4
+ background: #ffffff;
5
+ border-radius: 8px;
6
+ border: 1px solid #E5E7EB;
7
+ padding: var(--size-lg);
8
+ display: flex;
9
+ flex-direction: column;
10
+ position: relative;
11
+ height: 100%;
12
+ min-height: 120px;
13
+ width: 100%;
14
+ min-width: 300px;
15
+
16
+ .stat-card-header {
17
+ display: flex;
18
+ justify-content: space-between;
19
+ align-items: flex-start;
20
+ margin-bottom: auto;
21
+ }
22
+
23
+ .stat-card-title {
24
+ font-size: 14px;
25
+ font-weight: 500;
26
+ color: #6C737F;
27
+ line-height: 100%;
28
+ letter-spacing: 0%;
29
+ margin: 0;
30
+ }
31
+
32
+ .stat-card-icon {
33
+ display: flex;
34
+ align-items: center;
35
+ justify-content: center;
36
+ color: #6C737F;
37
+ }
38
+
39
+ .stat-card-content {
40
+ display: flex;
41
+ justify-content: space-between;
42
+ align-items: flex-end;
43
+ margin-top: auto;
44
+ }
45
+
46
+ .stat-card-value {
47
+ font-size: 32px;
48
+ font-weight: 600;
49
+ color: #384250;
50
+ margin: 0;
51
+ line-height: 1.2;
52
+ letter-spacing: 0%;
53
+ }
54
+
55
+ .stat-card-change {
56
+ display: flex;
57
+ align-items: center;
58
+ gap: 4px;
59
+ padding: 1px 8px;
60
+ border-radius: 4px;
61
+ border: 1px solid ${props => props.changeBorderColor || '#A7F3D0'};
62
+ background-color: ${props => props.changeColor || '#ECFDF3'};
63
+
64
+ .change-icon {
65
+ display: flex;
66
+ align-items: center;
67
+ gap: 2px;
68
+ color: ${props => props.changeTextColor || '#52C41A'};
69
+ }
70
+
71
+ .change-value {
72
+ font-size: 12px;
73
+ font-weight: 500;
74
+ line-height: 18px;
75
+ letter-spacing: 0%;
76
+ color: ${props => props.changeTextColor || '#52C41A'};
77
+ margin: 0;
78
+ }
79
+ }
80
+ `;
81
+
82
+ export default Style;
83
+
@@ -0,0 +1,8 @@
1
+ const config = {
2
+ viewBox: '0 0 11 10',
3
+ children: (
4
+ <path d="M7.75 0.75V6.25M7.75 6.25L5.75 4.25M7.75 6.25L9.75 4.25M2.75 0.75V8.75M2.75 8.75L0.75 6.75M2.75 8.75L4.75 6.75" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
5
+ ),
6
+ }
7
+
8
+ export default config;
@@ -0,0 +1,8 @@
1
+ const config = {
2
+ viewBox: '0 0 11 10',
3
+ children: (
4
+ <path d="M2.75 8.75V0.75M2.75 0.75L0.75 2.75M2.75 0.75L4.75 2.75M7.75 8.75V3.25M7.75 3.25L5.75 5.25M7.75 3.25L9.75 5.25" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round"/>
5
+ ),
6
+ }
7
+
8
+ export default config;
@@ -226,6 +226,8 @@ import ClockPlus from "./ClockPlus";
226
226
  import WaziDarkIcon from "./WaziDarkIcon";
227
227
  import SpacingHeight from "./SpacingHeight";
228
228
  import SpacingWidth from "./SpacingWidth";
229
+ import Up from "./Up";
230
+ import Down from "./Down";
229
231
 
230
232
  const config = {
231
233
  AppAdmin,
@@ -456,6 +458,8 @@ const config = {
456
458
  WaziDarkIcon,
457
459
  SpacingHeight,
458
460
  SpacingWidth,
461
+ Up,
462
+ Down,
459
463
  };
460
464
 
461
465
  export default config;
@@ -1,7 +1,7 @@
1
1
  const config = {
2
2
  viewBox: "0 0 18 14",
3
3
  children: (
4
- <path d="M5.08333 2.53462H0.75V8.75H1.50141C2.09639 8.75 2.67622 8.93763 3.15841 9.2862L7.44192 12.3827C7.74723 12.6034 8.15773 12.6105 8.47051 12.4006C8.95317 12.0765 9.00645 11.3867 8.5793 10.9924L6.81667 9.36538L9.68494 11.9601C9.95925 12.2082 10.366 12.2412 10.6767 12.0404C11.0996 11.7672 11.1772 11.1801 10.8398 10.8064L9.15 8.93462L11.4946 11.4923C11.828 11.8561 12.3838 11.9055 12.7762 11.6063C13.2258 11.2635 13.2802 10.607 12.8932 10.1948L11.0167 8.19615L13.3903 10.686C13.711 11.0223 14.2308 11.0702 14.6075 10.7981C15.0685 10.4651 15.1251 9.79991 14.727 9.39379L14.2167 8.87308M16.75 8.57952V2.79983M16.75 8.57952C16.75 8.57952 16.75 5.25112 16.75 2.79983M16.75 8.57952C16.75 8.72136 16.662 8.85066 16.5235 8.91219L15.2216 9.49081C15.0608 9.56228 14.8682 9.52676 14.7494 9.40375L8.66241 3.09692C8.52364 2.95315 8.28848 2.93195 8.1222 3.04823L7.31667 3.61154C6.63455 4.08854 5.73081 4.19895 4.93775 3.90217L4.14065 3.60388C3.96864 3.53951 3.93837 3.32657 4.08656 3.22341L6.64053 1.44562C7.4038 0.914316 8.33376 0.75 9.28973 0.75H9.89529C10.373 0.75 10.8476 0.821816 11.3003 0.962629L16.4777 2.44993C16.6404 2.50054 16.75 2.64134 16.75 2.79983" stroke="#722ED1" strokeWidth="1.5" strokeLinejoin="round"/>
4
+ <path d="M5.08333 2.53462H0.75V8.75H1.50141C2.09639 8.75 2.67622 8.93763 3.15841 9.2862L7.44192 12.3827C7.74723 12.6034 8.15773 12.6105 8.47051 12.4006C8.95317 12.0765 9.00645 11.3867 8.5793 10.9924L6.81667 9.36538L9.68494 11.9601C9.95925 12.2082 10.366 12.2412 10.6767 12.0404C11.0996 11.7672 11.1772 11.1801 10.8398 10.8064L9.15 8.93462L11.4946 11.4923C11.828 11.8561 12.3838 11.9055 12.7762 11.6063C13.2258 11.2635 13.2802 10.607 12.8932 10.1948L11.0167 8.19615L13.3903 10.686C13.711 11.0223 14.2308 11.0702 14.6075 10.7981C15.0685 10.4651 15.1251 9.79991 14.727 9.39379L14.2167 8.87308M16.75 8.57952V2.79983M16.75 8.57952C16.75 8.57952 16.75 5.25112 16.75 2.79983M16.75 8.57952C16.75 8.72136 16.662 8.85066 16.5235 8.91219L15.2216 9.49081C15.0608 9.56228 14.8682 9.52676 14.7494 9.40375L8.66241 3.09692C8.52364 2.95315 8.28848 2.93195 8.1222 3.04823L7.31667 3.61154C6.63455 4.08854 5.73081 4.19895 4.93775 3.90217L4.14065 3.60388C3.96864 3.53951 3.93837 3.32657 4.08656 3.22341L6.64053 1.44562C7.4038 0.914316 8.33376 0.75 9.28973 0.75H9.89529C10.373 0.75 10.8476 0.821816 11.3003 0.962629L16.4777 2.44993C16.6404 2.50054 16.75 2.64134 16.75 2.79983" stroke="currentColor" strokeWidth="1.5" strokeLinejoin="round"/>
5
5
  ),
6
6
  };
7
7
 
@@ -134,7 +134,7 @@ const BaseScreen = ({
134
134
  <div className="daf-table-wrapper pagination-w-padding">
135
135
  <DAFTable
136
136
  columns={columns}
137
- data={data?.data}
137
+ data={Array.isArray(data?.data) ? data?.data : data?.data?.data}
138
138
  loading={loading}
139
139
  hideOnLoading={false}
140
140
  pagination={pagination}
@@ -90,7 +90,7 @@ const TablePageWithTabs = ({
90
90
  checkboxConfig={checkboxConfig}
91
91
  defaultTableFilters={{}}
92
92
  columns={columns}
93
- data={data}
93
+ data={data?.data}
94
94
  loading={loading}
95
95
  location={location}
96
96
  goTo={goTo}
@@ -468,9 +468,9 @@ export default function SidenavMenu({
468
468
  className={formatClassname([
469
469
  typeof selectedKeys[0] === "string"
470
470
  ? !!(
471
- selectedKeys[0].includes(subitem.path) ||
471
+ matchPath({ path: subitem.path, exact: true }, selectedKeys[0]) ||
472
472
  (subitem.subPath || []).find((p) =>
473
- matchPath(p, selectedKeys[0])
473
+ matchPath({ path: p, exact: true }, selectedKeys[0])
474
474
  )
475
475
  ) && "selected-label"
476
476
  : "",
@@ -494,9 +494,9 @@ export default function SidenavMenu({
494
494
  className: formatClassname([
495
495
  typeof selectedKeys[0] === "string"
496
496
  ? !!(
497
- selectedKeys[0].includes(subitem.path) ||
497
+ matchPath({ path: subitem.path, exact: true }, selectedKeys[0]) ||
498
498
  (subitem.subPath || []).find((p) =>
499
- matchPath(p, selectedKeys[0])
499
+ matchPath({ path: p, exact: true }, selectedKeys[0])
500
500
  )
501
501
  ) && "selected-it"
502
502
  : "",
@@ -0,0 +1,36 @@
1
+ import React from 'react'
2
+ import { Tag, Tooltip } from 'antd'
3
+ import { formatClassname } from '../../../../../helpers/ClassesHelper.js'
4
+
5
+ function MissingTagButton({
6
+ hasMissing,
7
+ setHighlightMandatory,
8
+ highlightMandatory,
9
+ t,
10
+ }) {
11
+ return (
12
+ <>
13
+ {hasMissing ? (
14
+ <Tag
15
+ onClick={() => setHighlightMandatory(!highlightMandatory)}
16
+ className={formatClassname(['ml-2 highlight-tag', highlightMandatory && 'highlighted'])}
17
+ style={{textAlign: "center"}}
18
+ >
19
+ {t('missing-inputs')}
20
+ </Tag>
21
+ ) : (
22
+ <Tooltip title={t('all-inputs-fullfilled')}>
23
+ <Tag
24
+ onClick={() => setHighlightMandatory(!highlightMandatory)}
25
+ className={formatClassname(['ml-2 highlight-tag disabled'])}
26
+ style={{textAlign: "center"}}
27
+ >
28
+ {t('missing-inputs')}
29
+ </Tag>
30
+ </Tooltip>
31
+ )}
32
+ </>
33
+ )
34
+ }
35
+
36
+ export default MissingTagButton;
@@ -24,8 +24,6 @@ function SupplyChainMap({selectedSources = {}, t = () => {}, goTo = () => {}, op
24
24
 
25
25
  const { loading, data } = useWidgetFetch({config: defaultConfig});
26
26
 
27
- console.log('data', data);
28
-
29
27
  return (
30
28
  <Widget
31
29
  title={t("Supply Chain Map")}
@@ -1,8 +1,3 @@
1
- export const checkboxConfig = {
2
- name: 'Name',
3
- datastakeId: 'ID'
4
- }
5
-
6
1
  export const getFiltersConfig = ({t}) => {
7
2
  return {
8
3
  timeframe: {
@@ -13,11 +8,6 @@ export const getFiltersConfig = ({t}) => {
13
8
  }
14
9
  }
15
10
 
16
- export const filtersConfig = {
17
- name: '',
18
- datastakeId: '',
19
- };
20
-
21
11
  export const getFilterOptions = (options, t) => {
22
12
  const { timeframe = [] } = options || {};
23
13
  const _default = {
@@ -1,11 +1,6 @@
1
- import React, { useMemo, useState, useEffect, useCallback } from 'react'
2
- import TablePageWithTabs from '../../core/components/Screens/TableScreen/TablePageWithTabs/index.jsx'
1
+ import React from 'react'
3
2
  import { getColumns } from './columns.js';
4
- import { checkboxConfig, getFiltersConfig, filtersConfig, getFilterOptions } from './config.js';
5
- import { useGetQueryParams } from '../../hooks/useGetQueryParams.js';
6
- import StakeholdersCreate from './create.jsx';
7
- import { displayMessage } from '../../../helpers/messages.js';
8
- import { useFetchData } from '../hook.js';
3
+ import TablePage from '../TablePage/index.jsx';
9
4
 
10
5
  const DocumentsTable = ({
11
6
  t = () => {},
@@ -37,109 +32,57 @@ const DocumentsTable = ({
37
32
  subjectClear = () => {},
38
33
  breadcrumbs = [],
39
34
  extendingFilters = {},
35
+ createDefaultValues = {},
40
36
  }) => {
41
- const [selectOptions, setSelectOptions] = useState();
42
- const [activeTab, setActiveTab] = useState("own");
43
- const columns = useMemo(() => getColumns({
44
- t,
45
- goTo,
46
- user,
47
- options,
48
- activeTab,
49
- getRedirectLink,
50
- theme,
51
- subject: 'documents',
52
- applications,
53
- }), [t, goTo, user, options, activeTab, getRedirectLink, theme, applications]);
54
-
55
- useFetchData({
56
- location,
57
- getData,
58
- activeTab,
59
- extendingFilters,
60
- subject: 'documents',
61
- })
62
-
63
- const selectFiltersConfig = useMemo(() => {
64
- return getFiltersConfig({t});
65
- }, [t]);
66
-
67
- useEffect(() => {
68
- setSelectOptions((prev) => ({
69
- ...prev,
70
- ...getFilterOptions(options, t),
71
- }))
72
- }, [options, t])
73
-
74
- const handleActiveTabChange = useCallback((value) => {
75
- setActiveTab(value);
76
- }, []);
77
-
78
- useEffect(
79
- () => () => {
80
- subjectClear();
81
- },
82
- [],
83
- );
84
-
85
37
  return (
86
- <TablePageWithTabs
87
- t={t}
88
- title={t("Documents")}
89
- breadCrumbs={breadcrumbs}
90
- location={location}
91
- loading={loading}
92
- goTo={goTo}
93
- defaultActiveTab={"own"}
94
- columns={columns}
95
- data={data}
96
- checkboxConfig={checkboxConfig}
97
- APP={APP}
98
- getApiBaseUrl={getApiBaseUrl}
99
- selectOptions={selectOptions}
100
- selectFiltersConfig={selectFiltersConfig}
101
- getRedirectLink={getRedirectLink}
102
- filtersConfig={filtersConfig}
103
- isMobile={isMobile}
104
- view="documents"
105
- getActiveTab={handleActiveTabChange}
106
- onDownload={() => {
107
- console.log("download");
108
- }}
109
- drawerTitle={t("Create Document")}
110
- >
111
- {({onDrawerClose}) => (
112
- <StakeholdersCreate
113
- t={t}
114
- goTo={goTo}
115
- user={user}
116
- APP={APP}
117
- getApiBaseUrl={getApiBaseUrl}
118
- getAppHeader={getAppHeader}
119
- getData={getFormData}
120
- saveData={saveFormData}
121
- loading={formLoading}
122
- onSubmitted={(type, m, data) => {
123
- if (data.datastakeId) {
124
- displayMessage(
125
- type,
126
- t("affirmations::subject-created-successfully") || m,
127
- );
128
- goTo(`/app/edit/documents/${data.datastakeId}`);
129
- }
130
- }}
131
- onCancel={onDrawerClose}
132
- query={query}
133
- ajaxForms={ajaxForms}
134
- changeAjaxForms={changeAjaxForms}
135
- ajaxOptions={ajaxOptions}
136
- changeAjaxOptions={changeAjaxOptions}
137
- formData={formData}
138
- formValue={formValue}
139
- form={form}
140
- />
141
- )}
142
- </TablePageWithTabs>
38
+ <TablePage
39
+ t={t}
40
+ goTo={goTo}
41
+ user={user}
42
+ options={options}
43
+ getRedirectLink={getRedirectLink}
44
+ theme={theme}
45
+ loading={loading}
46
+ data={data}
47
+ isMobile={isMobile}
48
+ APP={APP}
49
+ location={location}
50
+ applications={applications}
51
+
52
+ subject="documents"
53
+ getData={getData}
54
+ getApiBaseUrl={getApiBaseUrl}
55
+ getAppHeader={getAppHeader}
56
+ subjectClear={subjectClear}
57
+ getColumns={getColumns}
58
+
59
+ viewConfig={{
60
+ title: "Documents",
61
+ breadcrumbs: breadcrumbs,
62
+ createTitle: "Create Document",
63
+ }}
64
+
65
+ formConfig={{
66
+ getFormData,
67
+ saveFormData,
68
+ formLoading,
69
+ query,
70
+ ajaxForms,
71
+ changeAjaxForms,
72
+ ajaxOptions,
73
+ changeAjaxOptions,
74
+ formData,
75
+ formValue,
76
+ form,
77
+ namespace: 'document',
78
+ view: 'scoping',
79
+ scope: 'create',
80
+ formType: 'document',
81
+ defaultValues: createDefaultValues,
82
+ }}
83
+
84
+ onDownload={() => console.log("download")}
85
+ />
143
86
  )
144
87
  }
145
88
 
@@ -1,8 +1,3 @@
1
- export const checkboxConfig = {
2
- name: 'Name',
3
- datastakeId: 'ID'
4
- }
5
-
6
1
  export const getFiltersConfig = ({t}) => {
7
2
  return {
8
3
 
@@ -129,11 +124,6 @@ timeframe: {
129
124
  }
130
125
  }
131
126
 
132
- export const filtersConfig = {
133
- name: '',
134
- datastakeId: '',
135
- };
136
-
137
127
  export const getFilterOptions = (options, t) => {
138
128
  const {
139
129
  timeframe = [],
@@ -166,7 +156,7 @@ export const getFilterOptions = (options, t) => {
166
156
  category: stakeholderCategoryOptions || categoryOptions,
167
157
  country: countries,
168
158
  subCategory: subCategoriesOptions,
169
- category: category,
159
+ // category: category,
170
160
  administrativeLevel1,
171
161
  administrativeLevel2,
172
162
  positionInTheMineralSupplyChain: positionInMineralSupplyChainOptions,
@@ -1,11 +1,6 @@
1
- import React, { useMemo, useState, useEffect, useCallback } from 'react'
2
- import TablePageWithTabs from '../../../core/components/Screens/TableScreen/TablePageWithTabs/index.jsx'
1
+ import React from 'react'
3
2
  import { getColumns } from './columns.js';
4
- import { checkboxConfig, getFiltersConfig, filtersConfig, getFilterOptions } from './config.js';
5
- import { useGetQueryParams } from '../../../hooks/useGetQueryParams.js';
6
- import StakeholdersCreate from './create.jsx';
7
- import { displayMessage } from '../../../../helpers/messages.js';
8
- import { useFetchData } from '../../hook.js';
3
+ import TablePage from '../../TablePage/index.jsx';
9
4
 
10
5
  const ActivitiesTable = ({
11
6
  t = () => {},
@@ -38,105 +33,52 @@ const ActivitiesTable = ({
38
33
  applications = [],
39
34
  breadcrumbs = [],
40
35
  }) => {
41
- const [selectOptions, setSelectOptions] = useState();
42
- const [activeTab, setActiveTab] = useState("own");
43
-
44
- const columns = useMemo(() => getColumns({
45
- t,
46
- goTo,
47
- user,
48
- options,
49
- activeTab,
50
- getRedirectLink,
51
- theme,
52
- subject: 'activities',
53
- data,
54
- applications,
55
- }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
56
-
57
- useFetchData({
58
- location,
59
- getData,
60
- activeTab,
61
- extendingFilters,
62
- subject: 'activities',
63
- })
64
-
65
- const selectFiltersConfig = useMemo(() => {
66
- return getFiltersConfig({t});
67
- }, [t]);
68
-
69
- useEffect(() => {
70
- setSelectOptions((prev) => ({
71
- ...prev,
72
- ...getFilterOptions(options, t),
73
- }))
74
- }, [options, t])
75
-
76
- const handleActiveTabChange = useCallback((value) => {
77
- setActiveTab(value);
78
- }, []);
79
-
80
36
  return (
81
- <TablePageWithTabs
82
- t={t}
83
- title={t("Activities")}
84
- breadCrumbs={breadcrumbs}
85
- location={location}
86
- loading={loading}
87
- goTo={goTo}
88
- defaultActiveTab={"own"}
89
- columns={columns}
90
- data={data}
91
- checkboxConfig={checkboxConfig}
92
- APP={APP}
93
- getApiBaseUrl={getApiBaseUrl}
94
- selectOptions={selectOptions}
95
- selectFiltersConfig={selectFiltersConfig}
96
- getRedirectLink={getRedirectLink}
97
- filtersConfig={filtersConfig}
98
- isMobile={isMobile}
99
- view="activities"
100
- getActiveTab={handleActiveTabChange}
101
- onDownload={() => {
102
- console.log("download");
103
- }}
104
- drawerTitle={t("Create Activity")}
105
- >
106
- {({onDrawerClose}) => (
107
- <StakeholdersCreate
108
- defaultData={createDefaultValues}
109
- t={t}
110
- goTo={goTo}
111
- user={user}
112
- APP={APP}
113
- getApiBaseUrl={getApiBaseUrl}
114
- getAppHeader={getAppHeader}
115
- getData={getFormData}
116
- saveData={saveFormData}
117
- loading={formLoading}
118
- onSubmitted={(type, m, data) => {
119
- if (data.datastakeId) {
120
- displayMessage(
121
- type,
122
- t("affirmations::subject-created-successfully") || m,
123
- );
124
- // goTo(`/app/edit/stakeholders/${data.datastakeId}`);
125
- goTo(`/app/edit/activities/${data.datastakeId}`)
126
- }
127
- }}
128
- onCancel={onDrawerClose}
129
- query={query}
130
- ajaxForms={ajaxForms}
131
- changeAjaxForms={changeAjaxForms}
132
- ajaxOptions={ajaxOptions}
133
- changeAjaxOptions={changeAjaxOptions}
134
- formData={formData}
135
- formValue={formValue}
136
- form={form}
137
- />
138
- )}
139
- </TablePageWithTabs>
37
+ <TablePage
38
+ t={t}
39
+ goTo={goTo}
40
+ user={user}
41
+ options={options}
42
+ getRedirectLink={getRedirectLink}
43
+ theme={theme}
44
+ loading={loading}
45
+ data={data}
46
+ isMobile={isMobile}
47
+ APP={APP}
48
+ location={location}
49
+ applications={applications}
50
+
51
+ subject="activities"
52
+ getData={getData}
53
+ getApiBaseUrl={getApiBaseUrl}
54
+ getAppHeader={getAppHeader}
55
+ getColumns={getColumns}
56
+ viewConfig={{
57
+ title: "Activities",
58
+ breadcrumbs: breadcrumbs,
59
+ createTitle: "Create Activity",
60
+ }}
61
+ extendingFilters={extendingFilters}
62
+ formConfig={{
63
+ getFormData,
64
+ saveFormData,
65
+ formLoading,
66
+ query,
67
+ ajaxForms,
68
+ changeAjaxForms,
69
+ ajaxOptions,
70
+ changeAjaxOptions,
71
+ formData,
72
+ formValue,
73
+ form,
74
+ namespace: "corrective-actions",
75
+ view: 'corrective-actions',
76
+ scope: 'createActivity',
77
+ formType: 'activity',
78
+ defaultValues: createDefaultValues,
79
+ }}
80
+ onDownload={() => console.log("download")}
81
+ />
140
82
  )
141
83
  }
142
84
 
@@ -1,8 +1,3 @@
1
- export const checkboxConfig = {
2
- name: 'Name',
3
- datastakeId: 'ID'
4
- }
5
-
6
1
  export const getFiltersConfig = ({t}) => {
7
2
  return {
8
3
 
@@ -129,11 +124,6 @@ timeframe: {
129
124
  }
130
125
  }
131
126
 
132
- export const filtersConfig = {
133
- name: '',
134
- datastakeId: '',
135
- };
136
-
137
127
  export const getFilterOptions = (options, t) => {
138
128
  const {
139
129
  timeframe = [],
@@ -166,7 +156,7 @@ export const getFilterOptions = (options, t) => {
166
156
  category: stakeholderCategoryOptions || categoryOptions,
167
157
  country: countries,
168
158
  subCategory: subCategoriesOptions,
169
- category: category,
159
+ // category: category,
170
160
  administrativeLevel1,
171
161
  administrativeLevel2,
172
162
  positionInTheMineralSupplyChain: positionInMineralSupplyChainOptions,