datastake-daf 0.6.742 → 0.6.744

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 (48) hide show
  1. package/build/favicon.ico +0 -0
  2. package/build/logo192.png +0 -0
  3. package/build/logo512.png +0 -0
  4. package/build/manifest.json +25 -0
  5. package/build/robots.txt +3 -0
  6. package/dist/hooks/index.js +4658 -19
  7. package/dist/pages/index.js +3278 -280
  8. package/dist/services/index.js +2 -2
  9. package/package.json +1 -1
  10. package/src/@daf/pages/dashboards/AllInformation/Documents/columns.js +42 -16
  11. package/src/@daf/pages/dashboards/AllInformation/Documents/create.jsx +5 -4
  12. package/src/@daf/pages/dashboards/AllInformation/Documents/index.jsx +18 -26
  13. package/src/@daf/pages/dashboards/AllInformation/Events/columns.js +4 -3
  14. package/src/@daf/pages/dashboards/AllInformation/Events/config.js +158 -6
  15. package/src/@daf/pages/dashboards/AllInformation/Events/create.jsx +2 -2
  16. package/src/@daf/pages/dashboards/AllInformation/Events/index.jsx +11 -1
  17. package/src/@daf/pages/dashboards/AllInformation/Locations/columns.js +4 -3
  18. package/src/@daf/pages/dashboards/AllInformation/Locations/create.jsx +1 -1
  19. package/src/@daf/pages/dashboards/AllInformation/Locations/index.jsx +11 -1
  20. package/src/@daf/pages/dashboards/AllInformation/Stakeholders/columns.js +5 -2
  21. package/src/@daf/pages/dashboards/AllInformation/Stakeholders/create.jsx +1 -1
  22. package/src/@daf/pages/dashboards/AllInformation/Stakeholders/index.jsx +13 -3
  23. package/src/@daf/pages/dashboards/DueDilligence/Activities/columns.js +221 -0
  24. package/src/@daf/pages/dashboards/DueDilligence/Activities/config.js +166 -0
  25. package/src/@daf/pages/dashboards/DueDilligence/Activities/create.jsx +104 -0
  26. package/src/@daf/pages/dashboards/DueDilligence/Activities/index.jsx +157 -0
  27. package/src/@daf/pages/dashboards/DueDilligence/Incidents/columns.js +221 -0
  28. package/src/@daf/pages/dashboards/DueDilligence/Incidents/config.js +166 -0
  29. package/src/@daf/pages/dashboards/DueDilligence/Incidents/create.jsx +104 -0
  30. package/src/@daf/pages/dashboards/DueDilligence/Incidents/index.jsx +157 -0
  31. package/src/@daf/pages/dashboards/DueDilligence/Incidents2/columns.js +176 -0
  32. package/src/@daf/pages/dashboards/DueDilligence/Incidents2/config.js +171 -0
  33. package/src/@daf/pages/dashboards/DueDilligence/Incidents2/create.jsx +104 -0
  34. package/src/@daf/pages/dashboards/DueDilligence/Incidents2/index.jsx +156 -0
  35. package/src/@daf/pages/dashboards/Operations/Operators/columns.js +4 -3
  36. package/src/@daf/pages/dashboards/Operations/Operators/config.js +0 -1
  37. package/src/@daf/pages/dashboards/Operations/Operators/index.jsx +3 -1
  38. package/src/@daf/pages/dashboards/Operations/ProductionSites/columns.js +150 -0
  39. package/src/@daf/pages/dashboards/Operations/ProductionSites/config.js +165 -0
  40. package/src/@daf/pages/dashboards/Operations/ProductionSites/create.jsx +104 -0
  41. package/src/@daf/pages/dashboards/Operations/ProductionSites/index.jsx +155 -0
  42. package/src/@daf/pages/dashboards/Operations/Workers/columns.js +176 -0
  43. package/src/@daf/pages/dashboards/Operations/Workers/config.js +166 -0
  44. package/src/@daf/pages/dashboards/Operations/Workers/create.jsx +104 -0
  45. package/src/@daf/pages/dashboards/Operations/Workers/index.jsx +157 -0
  46. package/src/@daf/services/LinkedSubjects.js +2 -2
  47. package/src/helpers/sourceAvatarConfig.js +37 -0
  48. package/src/pages.js +6 -0
@@ -1342,12 +1342,12 @@ const getNamespace = namespace => {
1342
1342
  class LinkedSubjectsService extends BaseService {
1343
1343
  getForm({
1344
1344
  namespace
1345
- }, language = "en") {
1345
+ }, language = "en", scope) {
1346
1346
  return this.apiGet({
1347
1347
  url: `forms/${namespace === "documents" ? namespace : getNamespace(namespace)}`,
1348
1348
  isApp: true,
1349
1349
  params: {
1350
- scope: "create",
1350
+ scope: scope || "create",
1351
1351
  language
1352
1352
  }
1353
1353
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.742",
3
+ "version": "0.6.744",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -4,15 +4,9 @@ import { findOptions } from '../../../../../helpers/StringHelper.js';
4
4
  import { renderDateFormatted } from '../../../../../helpers/Forms.js';
5
5
  import CustomIcon from '../../../../core/components/Icon/CustomIcon.jsx';
6
6
  import AvatarGroup from '../../../../core/components/AvatarGroup/index.jsx';
7
+ import sourceAvatarConfig from '../../../../../helpers/sourceAvatarConfig.js';
7
8
 
8
- const getLinkValue = (value, linkingObject) => {
9
- if(linkingObject && linkingObject?.[value]) {
10
- return linkingObject?.[value]?.name;
11
- }
12
- return null;
13
- }
14
-
15
- export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data}) => [
9
+ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, applications}) => [
16
10
  {
17
11
  dataIndex: 'datastakeId',
18
12
  title: t('ID'),
@@ -27,8 +21,8 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
27
21
  },
28
22
  },
29
23
  {
30
- dataIndex: 'title',
31
- title: t('Title'),
24
+ dataIndex: 'name',
25
+ title: t('Name'),
32
26
  ellipsis: true,
33
27
  show: true,
34
28
  render: (v, all) => {
@@ -40,8 +34,8 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
40
34
  },
41
35
  },
42
36
  {
43
- dataIndex: 'type',
44
- title: t('Type'),
37
+ dataIndex: 'category',
38
+ title: t('Category'),
45
39
  ellipsis: true,
46
40
  show: true,
47
41
  render: (v, all) => {
@@ -49,12 +43,41 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
49
43
  return <div className="daf-default-cell" />
50
44
  }
51
45
 
52
- const type = findOptions(v, data?.options?.locationCategories);
46
+ const category = findOptions(v, options?.categoriesOptions);
53
47
 
54
- return type ? <Tooltip title={type}>{type}</Tooltip> : '-';
48
+ return category ? <Tooltip title={category}>{category}</Tooltip> : '-';
55
49
  },
56
50
  },
51
+ {
52
+ dataIndex: 'subCategory',
53
+ title: t('Sub Category'),
54
+ ellipsis: true,
55
+ show: true,
56
+ render: (v, all) => {
57
+ if (all.empty) {
58
+ return <div className="daf-default-cell" />
59
+ }
60
+
61
+ const subCategory = findOptions(v, options?.subCategoriesOptions);
57
62
 
63
+ return subCategory ? <Tooltip title={subCategory}>{subCategory}</Tooltip> : '-';
64
+ },
65
+ },
66
+ {
67
+ dataIndex: 'country',
68
+ title: t('Country'),
69
+ ellipsis: true,
70
+ show: true,
71
+ render: (v, all) => {
72
+ if (all.empty) {
73
+ return <div className="daf-default-cell" />
74
+ }
75
+
76
+ const country = findOptions(v, options?.countries);
77
+
78
+ return country ? <Tooltip title={country}>{country}</Tooltip> : '-';
79
+ },
80
+ },
58
81
  {
59
82
  title: t("Last Update"),
60
83
  dataIndex: "updatedAt",
@@ -79,10 +102,13 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
79
102
  if (all.empty) {
80
103
  return <div className="daf-default-cell" />;
81
104
  }
105
+ if (!val || val?.length === 0) {
106
+ return "--";
107
+ }
82
108
 
83
- console.log({val, all})
109
+ const sources = sourceAvatarConfig(val, user, applications);
84
110
 
85
- return <AvatarGroup items={val}></AvatarGroup>;
111
+ return <AvatarGroup items={sources}></AvatarGroup>;
86
112
  },
87
113
  },
88
114
  {
@@ -3,8 +3,8 @@ import { message } from 'antd';
3
3
  import { MessageTypes } from '../../../../../helpers/messages.js';
4
4
  import DynamicForm from '../../../../core/components/DynamicForm/index.jsx';
5
5
 
6
- const DocumentsCreate = ({
7
- namespace = 'documents',
6
+ const StakeholdersCreate = ({
7
+ namespace = 'stakeholders',
8
8
  view = 'scoping',
9
9
  edit = false,
10
10
  formData = {},
@@ -39,7 +39,7 @@ const DocumentsCreate = ({
39
39
  useEffect(() => {
40
40
  if (Object.keys(form).length === 0 && !formData[`${APP}-${view}`]) {
41
41
  if (!edit) {
42
- getData({ namespace, module: APP, view, scope: 'global' });
42
+ getData({ namespace, module: APP, view, scope: 'create' });
43
43
  } else {
44
44
  form = formConfig;
45
45
  data = formValue;
@@ -76,6 +76,7 @@ const DocumentsCreate = ({
76
76
  ...payloadData,
77
77
  form: 'document'
78
78
  };
79
+
79
80
 
80
81
  const callback = (type, m, data) => {
81
82
  if (setSelectedFormNext) {
@@ -101,4 +102,4 @@ const DocumentsCreate = ({
101
102
  )
102
103
  }
103
104
 
104
- export default DocumentsCreate
105
+ export default StakeholdersCreate
@@ -3,7 +3,7 @@ import TablePageWithTabs from '../../../pages/TablePageWithTabs/index.jsx'
3
3
  import { getColumns } from './columns.js';
4
4
  import { checkboxConfig, getFiltersConfig, filtersConfig, getFilterOptions } from './config.js';
5
5
  import { useGetQueryParams } from '../../../../hooks/useGetQueryParams.js';
6
- import DocumentsCreate from './create.jsx';
6
+ import StakeholdersCreate from './create.jsx';
7
7
  import { displayMessage } from '../../../../../helpers/messages.js';
8
8
 
9
9
  const DocumentsTable = ({
@@ -32,11 +32,11 @@ const DocumentsTable = ({
32
32
  formData = {},
33
33
  formValue = {},
34
34
  form = {},
35
- extendingFilters = {},
35
+ applications = [],
36
+ subjectClear = () => {},
36
37
  }) => {
37
38
  const [selectOptions, setSelectOptions] = useState();
38
39
  const [activeTab, setActiveTab] = useState();
39
-
40
40
  const columns = useMemo(() => getColumns({
41
41
  t,
42
42
  goTo,
@@ -46,35 +46,21 @@ const DocumentsTable = ({
46
46
  getRedirectLink,
47
47
  theme,
48
48
  subject: 'documents',
49
- data,
50
- }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data]);
49
+ applications,
50
+ }), [t, goTo, user, options, activeTab, getRedirectLink, theme, applications]);
51
51
 
52
52
  const breadCrumbs = [];
53
53
 
54
- const { paginationQuery, searchParams, otherParams, sortBy, sortDir } = useGetQueryParams({location});
55
-
56
- const filters = useMemo(() => {
57
- return {
58
- ...otherParams,
59
- ...extendingFilters
60
- }
61
- }, [otherParams, extendingFilters])
54
+ const { paginationQuery, searchParams, otherParams } = useGetQueryParams({location});
62
55
 
63
56
  useEffect(() => {
64
- console.log("fetching data")
65
57
  getData({
66
58
  pagination: paginationQuery,
67
- ...(Object.keys(filters).length > 0 && { filters: filters }),
59
+ ...(Object.keys(otherParams).length > 0 && { filters: otherParams }),
68
60
  ...(Object.keys(searchParams).length > 0 && { search: searchParams }),
69
61
  tab: activeTab,
70
- sortBy: {
71
- [sortBy || "updatedAt"]: sortDir ? (sortDir === "ascend" ? 1 : -1) : -1,
72
- }
73
62
  }, 'documents')
74
- console.log("data fetched")
75
- }, [location.search, activeTab, JSON.stringify(extendingFilters)]);
76
-
77
- console.log({data})
63
+ }, [paginationQuery, otherParams, searchParams, activeTab]);
78
64
 
79
65
  const selectFiltersConfig = useMemo(() => {
80
66
  return getFiltersConfig({t});
@@ -91,10 +77,17 @@ const DocumentsTable = ({
91
77
  setActiveTab(value);
92
78
  }, []);
93
79
 
80
+ useEffect(
81
+ () => () => {
82
+ subjectClear();
83
+ },
84
+ [],
85
+ );
86
+
94
87
  return (
95
88
  <TablePageWithTabs
96
89
  t={t}
97
- title={t("documents")}
90
+ title={t("Documents")}
98
91
  breadCrumbs={breadCrumbs}
99
92
  location={location}
100
93
  loading={loading}
@@ -118,7 +111,7 @@ const DocumentsTable = ({
118
111
  drawerTitle={t("Create Document")}
119
112
  >
120
113
  {({onDrawerClose}) => (
121
- <DocumentsCreate
114
+ <StakeholdersCreate
122
115
  t={t}
123
116
  goTo={goTo}
124
117
  user={user}
@@ -134,8 +127,7 @@ const DocumentsTable = ({
134
127
  type,
135
128
  t("affirmations::subject-created-successfully") || m,
136
129
  );
137
- // goTo(`/app/edit/stakeholders/${data.datastakeId}`);
138
- goTo(`/app/edit/documents/${data.datastakeId}`)
130
+ goTo(`/app/edit/documents/${data.datastakeId}`);
139
131
  }
140
132
  }}
141
133
  onCancel={onDrawerClose}
@@ -4,6 +4,7 @@ import { findOptions } from '../../../../../helpers/StringHelper.js';
4
4
  import { renderDateFormatted } from '../../../../../helpers/Forms.js';
5
5
  import CustomIcon from '../../../../core/components/Icon/CustomIcon.jsx';
6
6
  import AvatarGroup from '../../../../core/components/AvatarGroup/index.jsx';
7
+ import sourceAvatarConfig from '../../../../../helpers/sourceAvatarConfig.js';
7
8
 
8
9
  const getLinkValue = (value, linkingObject) => {
9
10
  if(linkingObject && linkingObject?.[value]) {
@@ -12,7 +13,7 @@ const getLinkValue = (value, linkingObject) => {
12
13
  return null;
13
14
  }
14
15
 
15
- export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data}) => [
16
+ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data, applications}) => [
16
17
  {
17
18
  dataIndex: 'datastakeId',
18
19
  title: t('ID'),
@@ -124,9 +125,9 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
124
125
  return <div className="daf-default-cell" />;
125
126
  }
126
127
 
127
- console.log({val, all})
128
+ const sources = sourceAvatarConfig(val, user, applications);
128
129
 
129
- return <AvatarGroup items={val}></AvatarGroup>;
130
+ return <AvatarGroup items={sources}></AvatarGroup>;
130
131
  },
131
132
  },
132
133
  {
@@ -5,15 +5,136 @@ export const checkboxConfig = {
5
5
 
6
6
  export const getFiltersConfig = ({t}) => {
7
7
  return {
8
- country: {
8
+
9
+ timeframe: {
10
+ type: "timeframe",
11
+ label: "Timeframe",
12
+ style: { flex: 1 },
13
+ },
14
+ country: {
15
+ type: 'select',
16
+ label: 'Country',
17
+ placeholder: (t) => `${t('Filter by')} ${t('Country').toLowerCase()}`,
18
+ style: { flex: 1 },
19
+ labelStyle: { flex: 1 },
20
+ getLabel: (option) => option.label,
21
+ getValue: (option) => option.value,
22
+ },
23
+ administrativeLevel1: {
24
+ type: 'ajaxSelect',
25
+ label: ({ t = (s) => s, options = {}, filters = {}, language = 'en' }) => {
26
+ const { administrativeLevel1 } = options;
27
+
28
+ if (administrativeLevel1) {
29
+ if (options.country) {
30
+ const _item = administrativeLevel1[filters.country];
31
+ if (_item) {
32
+ if (_item[language]) {
33
+ return _item[language]
34
+ }
35
+ }
36
+ }
37
+ }
38
+
39
+ return t('Province');
40
+ },
41
+ placeholder: (t) => `${t('Filter by')} ${t('Province').toLowerCase()}`,
42
+ filters: (data) => ({
43
+ country: data.country,
44
+ level: 'level_1',
45
+ }),
46
+ show: (data) => !data.country,
47
+ disabled: (data) => !data.country,
48
+ mapper: { label: "name", value: "id" },
49
+ method: 'getOptions',
50
+ entity: 'AdministrativeLevel',
51
+ style: { flex: 1 },
52
+ labelStyle: { flex: 1 },
53
+ },
54
+ administrativeLevel2: {
55
+ type: 'ajaxSelect',
56
+ label: ({ t = (s) => s, options = {}, filters = {}, language = 'en' }) => {
57
+ const { administrativeLevel2 } = options;
58
+
59
+ if (administrativeLevel2) {
60
+ if (options.country) {
61
+ const _item = administrativeLevel2[filters.country];
62
+ if (_item) {
63
+ if (_item[language]) {
64
+ return _item[language]
65
+ }
66
+ }
67
+ }
68
+ }
69
+
70
+ return t('Province');
71
+ },
72
+ show: (data) => !(data.country && data.administrativeLevel1),
73
+ placeholder: (t) => `${t('Filter by')} ${t('Territory').toLowerCase()}`,
74
+ filters: (data) => ({
75
+ country: data.country,
76
+ level: 'level_2',
77
+ administrativeLevel1: data.administrativeLevel1,
78
+ }),
79
+ disabled: (data) => !(data.country && data.administrativeLevel1),
80
+ mapper: { label: "name", value: "id" },
81
+ method: 'getOptions',
82
+ entity: 'AdministrativeLevel',
83
+ style: { flex: 1 },
84
+ labelStyle: { flex: 1 },
85
+ },
86
+ subCategory: {
87
+ type: 'select',
88
+ label: 'Category',
89
+ placeholder: (t) => `${t('Filter by')} ${t('Category').toLowerCase()}`,
90
+ style: { flex: 1 },
91
+ labelStyle: { flex: 1 },
92
+ getLabel: (option) => option.label,
93
+ getValue: (option) => option.value,
94
+ filterOptions: (val) => {
95
+ if (val) {
96
+ const { option, filters } = val
97
+ if (filters && option) {
98
+ const { filters: optionFilters } = option;
99
+ if (Array.isArray(optionFilters) && optionFilters.length) {
100
+ const { value, condition } = optionFilters[0];
101
+ if (condition === 'includes') {
102
+ return value.includes('corporation');
103
+ }
104
+ }
105
+ }
106
+ }
107
+ return true;
108
+ },
109
+ },
110
+ positionInTheMineralSupplyChain: {
111
+ type: 'select',
112
+ label: 'Position',
113
+ placeholder: (t) => `${t('Filter by')} ${t('Position').toLowerCase()}`,
114
+ style: { flex: 1 },
115
+ labelStyle: { flex: 1 },
116
+ getLabel: (option) => option.label,
117
+ getValue: (option) => option.value,
118
+ },
119
+ status: {
120
+ type: "select",
121
+ label: "Status",
122
+ placeholder: (t) => `${t("Filter by")} ${t("Status").toLowerCase()}`,
123
+ style: { flex: 1 },
124
+ labelStyle: { fley: 1 },
125
+ getLabel: (option) => option.label,
126
+ getValue: (option) => option.value,
127
+ },
128
+ category:{
9
129
  type: 'select',
10
- placeholder: t('Country'),
130
+ label: 'Category',
131
+ placeholder: (t) => `${t('Filter by')} ${t('Category').toLowerCase()}`,
11
132
  style: { flex: 1 },
12
133
  labelStyle: { flex: 1 },
13
134
  getLabel: (option) => option.label,
14
135
  getValue: (option) => option.value,
15
- },
16
- }
136
+ }
137
+ }
17
138
  }
18
139
 
19
140
  export const filtersConfig = {
@@ -22,9 +143,40 @@ export const filtersConfig = {
22
143
  };
23
144
 
24
145
  export const getFilterOptions = (options, t) => {
25
- const { countries } = options || {};
146
+ const {
147
+ timeframe = [],
148
+ statusOptions = [],
149
+ categoryOptions = [],
150
+ countries = [],
151
+ subCategory = [],
152
+ subCategoriesOptions,
153
+ stakeholderCategoryOptions,
154
+ stakeholderSubCategoriesOptions,
155
+ administrativeLevel1,
156
+ administrativeLevel2,
157
+ category=[],
158
+ } = options || {};
159
+ console.log({options})
160
+
26
161
  const _default = {
27
- country: countries,
162
+ timeframe: timeframe,
163
+ country: countries,
164
+
165
+ category: stakeholderCategoryOptions || categoryOptions,
166
+ administrativeLevel1,
167
+ administrativeLevel2,
168
+ // subCategory: subCategoriesOptions,
169
+ category: category,
170
+ status: [
171
+ {
172
+ value: "submitted",
173
+ label: "Submitted",
174
+ },
175
+ {
176
+ value: "private",
177
+ label: "Private",
178
+ },
179
+ ],
28
180
  }
29
181
 
30
182
  return _default;
@@ -4,7 +4,7 @@ import { MessageTypes } from '../../../../../helpers/messages.js';
4
4
  import DynamicForm from '../../../../core/components/DynamicForm/index.jsx';
5
5
 
6
6
  const EventsCreate = ({
7
- namespace = 'events',
7
+ namespace = 'event',
8
8
  view = 'scoping',
9
9
  edit = false,
10
10
  formData = {},
@@ -39,7 +39,7 @@ const EventsCreate = ({
39
39
  useEffect(() => {
40
40
  if (Object.keys(form).length === 0 && !formData[`${APP}-${view}`]) {
41
41
  if (!edit) {
42
- getData({ namespace, module: APP, view, scope: 'global' });
42
+ getData({ namespace, module: APP, view, scope: 'create' });
43
43
  } else {
44
44
  form = formConfig;
45
45
  data = formValue;
@@ -33,6 +33,8 @@ const EventsTable = ({
33
33
  formValue = {},
34
34
  form = {},
35
35
  extendingFilters = {},
36
+ applications = [],
37
+ subjectClear = () => {},
36
38
  }) => {
37
39
  const [selectOptions, setSelectOptions] = useState();
38
40
  const [activeTab, setActiveTab] = useState();
@@ -47,7 +49,8 @@ const EventsTable = ({
47
49
  theme,
48
50
  subject: 'events',
49
51
  data,
50
- }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data]);
52
+ applications,
53
+ }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
51
54
 
52
55
  const breadCrumbs = [];
53
56
 
@@ -91,6 +94,13 @@ const EventsTable = ({
91
94
  setActiveTab(value);
92
95
  }, []);
93
96
 
97
+ useEffect(
98
+ () => () => {
99
+ subjectClear();
100
+ },
101
+ [],
102
+ );
103
+
94
104
  return (
95
105
  <TablePageWithTabs
96
106
  t={t}
@@ -4,6 +4,7 @@ import { findOptions } from '../../../../../helpers/StringHelper.js';
4
4
  import { renderDateFormatted } from '../../../../../helpers/Forms.js';
5
5
  import CustomIcon from '../../../../core/components/Icon/CustomIcon.jsx';
6
6
  import AvatarGroup from '../../../../core/components/AvatarGroup/index.jsx';
7
+ import sourceAvatarConfig from '../../../../../helpers/sourceAvatarConfig.js';
7
8
 
8
9
  const getLinkValue = (value, linkingObject) => {
9
10
  if(linkingObject && linkingObject?.[value]) {
@@ -12,7 +13,7 @@ const getLinkValue = (value, linkingObject) => {
12
13
  return null;
13
14
  }
14
15
 
15
- export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data}) => [
16
+ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data, applications}) => [
16
17
  {
17
18
  dataIndex: 'datastakeId',
18
19
  title: t('ID'),
@@ -124,9 +125,9 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
124
125
  return <div className="daf-default-cell" />;
125
126
  }
126
127
 
127
- console.log({val, all})
128
+ const sources = sourceAvatarConfig(val, user, applications);
128
129
 
129
- return <AvatarGroup items={val}></AvatarGroup>;
130
+ return <AvatarGroup items={sources}></AvatarGroup>;
130
131
  },
131
132
  },
132
133
  {
@@ -39,7 +39,7 @@ const StakeholdersCreate = ({
39
39
  useEffect(() => {
40
40
  if (Object.keys(form).length === 0 && !formData[`${APP}-${view}`]) {
41
41
  if (!edit) {
42
- getData({ namespace, module: APP, view, scope: 'global' });
42
+ getData({ namespace, module: APP, view, scope: 'create' });
43
43
  } else {
44
44
  form = formConfig;
45
45
  data = formValue;
@@ -32,6 +32,8 @@ const LocationsTable = ({
32
32
  formData = {},
33
33
  formValue = {},
34
34
  form = {},
35
+ applications = [],
36
+ subjectClear = () => {},
35
37
  }) => {
36
38
  const [selectOptions, setSelectOptions] = useState();
37
39
  const [activeTab, setActiveTab] = useState();
@@ -46,7 +48,8 @@ const LocationsTable = ({
46
48
  theme,
47
49
  subject: 'locations',
48
50
  data,
49
- }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data]);
51
+ applications,
52
+ }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
50
53
 
51
54
  const breadCrumbs = [];
52
55
 
@@ -78,6 +81,13 @@ const LocationsTable = ({
78
81
  setActiveTab(value);
79
82
  }, []);
80
83
 
84
+ useEffect(
85
+ () => () => {
86
+ subjectClear();
87
+ },
88
+ [],
89
+ );
90
+
81
91
  return (
82
92
  <TablePageWithTabs
83
93
  t={t}
@@ -4,8 +4,9 @@ import { findOptions } from '../../../../../helpers/StringHelper.js';
4
4
  import { renderDateFormatted } from '../../../../../helpers/Forms.js';
5
5
  import CustomIcon from '../../../../core/components/Icon/CustomIcon.jsx';
6
6
  import AvatarGroup from '../../../../core/components/AvatarGroup/index.jsx';
7
+ import sourceAvatarConfig from '../../../../../helpers/sourceAvatarConfig.js';
7
8
 
8
- export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject}) => [
9
+ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, applications}) => [
9
10
  {
10
11
  dataIndex: 'datastakeId',
11
12
  title: t('ID'),
@@ -105,7 +106,9 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
105
106
  return "--";
106
107
  }
107
108
 
108
- return <AvatarGroup items={val}></AvatarGroup>;
109
+ const sources = sourceAvatarConfig(val, user, applications);
110
+
111
+ return <AvatarGroup items={sources}></AvatarGroup>;
109
112
  },
110
113
  },
111
114
  {
@@ -39,7 +39,7 @@ const StakeholdersCreate = ({
39
39
  useEffect(() => {
40
40
  if (Object.keys(form).length === 0 && !formData[`${APP}-${view}`]) {
41
41
  if (!edit) {
42
- getData({ namespace, module: APP, view, scope: 'global' });
42
+ getData({ namespace, module: APP, view, scope: 'create' });
43
43
  } else {
44
44
  form = formConfig;
45
45
  data = formValue;
@@ -32,6 +32,8 @@ const StakeholdersTable = ({
32
32
  formData = {},
33
33
  formValue = {},
34
34
  form = {},
35
+ applications = [],
36
+ subjectClear = () => {},
35
37
  }) => {
36
38
  const [selectOptions, setSelectOptions] = useState();
37
39
  const [activeTab, setActiveTab] = useState();
@@ -43,8 +45,9 @@ const StakeholdersTable = ({
43
45
  activeTab,
44
46
  getRedirectLink,
45
47
  theme,
46
- subject: 'stakeholders'
47
- }), [t, goTo, user, options, activeTab, getRedirectLink, theme]);
48
+ subject: 'stakeholders',
49
+ applications,
50
+ }), [t, goTo, user, options, activeTab, getRedirectLink, theme, applications]);
48
51
 
49
52
  const breadCrumbs = [];
50
53
 
@@ -74,6 +77,13 @@ const StakeholdersTable = ({
74
77
  setActiveTab(value);
75
78
  }, []);
76
79
 
80
+ useEffect(
81
+ () => () => {
82
+ subjectClear();
83
+ },
84
+ [],
85
+ );
86
+
77
87
  return (
78
88
  <TablePageWithTabs
79
89
  t={t}
@@ -117,7 +127,7 @@ const StakeholdersTable = ({
117
127
  type,
118
128
  t("affirmations::subject-created-successfully") || m,
119
129
  );
120
- goTo(`/app/stakeholders`);
130
+ goTo(`/app/edit/stakeholders/${data.datastakeId}`);
121
131
  }
122
132
  }}
123
133
  onCancel={onDrawerClose}