datastake-daf 0.6.765 → 0.6.767

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 (64) hide show
  1. package/dist/components/index.js +482 -245
  2. package/dist/layouts/index.js +0 -3
  3. package/dist/pages/index.js +299 -241
  4. package/dist/services/index.js +18 -0
  5. package/dist/utils/index.js +328 -5
  6. package/package.json +4 -2
  7. package/src/@daf/core/components/Charts/BarChart/index.jsx +4 -0
  8. package/src/@daf/core/components/Dashboard/Map/ChainIcon/Markers/StakeholderMarker.js +1 -1
  9. package/src/@daf/core/components/Dashboard/Map/ChainIcon/index.js +1 -9
  10. package/src/@daf/core/components/Dashboard/Map/StakeholderIcon/index.js +3 -0
  11. package/src/@daf/core/components/Dashboard/Map/hook.js +31 -1
  12. package/src/@daf/core/components/Graphs/StakeholderMappings/index.jsx +0 -2
  13. package/src/@daf/core/components/Graphs/TradeRelationship/index.jsx +49 -11
  14. package/src/@daf/core/components/Graphs/components/BaseGraph.jsx +10 -7
  15. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/KeyIndicatorsWidget/config.js +2 -2
  16. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/KeyIndicatorsWidget/index.jsx +1 -1
  17. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserActivity/helper.js +4 -1
  18. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserActivity/index.jsx +5 -0
  19. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/index.jsx +1 -0
  20. package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/index.jsx +34 -26
  21. package/src/@daf/core/components/Screens/Admin/AdminDashboard/index.jsx +56 -52
  22. package/src/@daf/core/components/Screens/Admin/AdminScreens/Dashboard.jsx +52 -67
  23. package/src/@daf/core/components/Screens/Admin/AdminScreens/Location.jsx +96 -0
  24. package/src/@daf/core/components/Screens/Admin/AdminScreens/Subjects.jsx +96 -0
  25. package/src/@daf/core/components/Screens/Admin/AdminScreens/index.js +2 -1
  26. package/src/@daf/core/components/Screens/Admin/adminRoutes.js +116 -89
  27. package/src/@daf/core/components/Screens/TableScreen/TableWithTabsAndCreate/create.jsx +106 -0
  28. package/src/@daf/core/components/Screens/TableScreen/TableWithTabsAndCreate/index.jsx +115 -0
  29. package/src/@daf/core/components/Table/MoreTags/index.jsx +17 -5
  30. package/src/@daf/hooks/useMapHelper.js +5 -0
  31. package/src/@daf/layouts/AuthLayout/components/Navbar/index.jsx +0 -1
  32. package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/Identification/hook.js +10 -10
  33. package/src/@daf/pages/Dashboards/SupplyChain/components/SupplyChainMap/index.js +11 -5
  34. package/src/@daf/pages/Dashboards/UserDashboard/components/ContributionsGraph/helper.js +1 -14
  35. package/src/@daf/pages/Dashboards/UserDashboard/components/ContributionsGraph/hook.js +12 -5
  36. package/src/@daf/pages/Dashboards/UserDashboard/components/MineSites/index.jsx +1 -1
  37. package/src/@daf/pages/Dashboards/UserDashboard/components/Triangulation/hook.js +1 -1
  38. package/src/@daf/pages/Data/Channels/columns.js +175 -0
  39. package/src/@daf/pages/Data/Channels/config.js +0 -0
  40. package/src/@daf/pages/Data/Channels/create.jsx +0 -0
  41. package/src/@daf/pages/Data/Channels/index.jsx +0 -0
  42. package/src/@daf/pages/Events/Activities/columns.js +1 -4
  43. package/src/@daf/pages/Events/helper.js +2 -2
  44. package/src/@daf/pages/Events/index.jsx +1 -1
  45. package/src/@daf/pages/Locations/MineSite/columns.js +6 -4
  46. package/src/@daf/pages/Stakeholders/Operators/columns.js +4 -2
  47. package/src/@daf/pages/Summary/Activities/PlantingCycle/index.jsx +1 -0
  48. package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/config.js +2 -2
  49. package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/helper.js +7 -7
  50. package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/index.js +3 -2
  51. package/src/@daf/pages/Summary/Minesite/index.jsx +3 -1
  52. package/src/@daf/pages/Summary/Operator/components/Governance/index.js +0 -1
  53. package/src/@daf/pages/Summary/Operator/components/KeyInformation/config.js +33 -21
  54. package/src/@daf/pages/Summary/Operator/components/TradeRelationships/helper.js +13 -13
  55. package/src/@daf/pages/Summary/Operator/components/TradeRelationships/hook.js +8 -8
  56. package/src/@daf/pages/Summary/Operator/components/TradeRelationships/index.js +10 -3
  57. package/src/@daf/pages/Summary/Operator/index.jsx +3 -0
  58. package/src/@daf/pages/Summary/components/InformationAvailability/index.js +4 -3
  59. package/src/@daf/services/AdminService.js +14 -0
  60. package/src/constants/locales/en/translation.js +109 -2
  61. package/src/constants/locales/fr/translation.js +109 -1
  62. package/src/constants/locales/sp/translation.js +104 -1
  63. package/src/index.js +2 -0
  64. package/dist/style/datastake/mapbox-gl.css +0 -330
@@ -4,6 +4,7 @@ import Widget from '../../../../../core/components/Dashboard/Widget/index.jsx';
4
4
  import Map from '../../../../../core/components/Dashboard/Map/index.jsx';
5
5
  import { getTagColor } from '../../../../../utils/productTag.js';
6
6
  import PropTypes from 'prop-types';
7
+ import { findOptions } from '../../../../../../helpers/StringHelper.js';
7
8
 
8
9
 
9
10
  function SupplyChainMap({selectedSources = {}, t = () => {}, goTo = () => {}, options = {}, getRedirectLink = () => {} }) {
@@ -23,6 +24,8 @@ function SupplyChainMap({selectedSources = {}, t = () => {}, goTo = () => {}, op
23
24
 
24
25
  const { loading, data } = useWidgetFetch({config: defaultConfig});
25
26
 
27
+ console.log('data', data);
28
+
26
29
  return (
27
30
  <Widget
28
31
  title={t("Supply Chain Map")}
@@ -34,26 +37,29 @@ function SupplyChainMap({selectedSources = {}, t = () => {}, goTo = () => {}, op
34
37
  data={Array.isArray(data) && data.length > 0 ? data : []}
35
38
  renderTooltip={(data) => {
36
39
  const productsText = data?.products?.[0];
37
- const minerals = options?.minerals || [];
40
+ const minerals = options?.mineralOptions || [];
41
+ const participants = data?.stakeholders?.map((stakeholder) => stakeholder.name);
38
42
  return [
39
43
  {
40
44
  label: t("Products"),
41
45
  value:
42
- minerals.find((mineral) => mineral.value === productsText)?.label ||
46
+ findOptions(productsText, minerals) ||
43
47
  productsText ||
44
48
  "-",
45
49
  ...(productsText && { tag: getTagColor(productsText) }),
46
50
  },
47
51
  {
48
52
  label: t("Participants"),
49
- value: data?.participants || "-",
53
+ value: participants?.length > 0 ? participants.join(', ') : "-",
50
54
  },
51
55
  ];
52
56
  }}
53
57
  link
54
58
  onClickLink={(data) => {
55
- const locationTypes = ['mineSite', 'village'];
56
- if (locationTypes.includes(data.type)) {
59
+ const locationTypes = ['village', 'town', 'area', 'territory'];
60
+ if(data?.type === 'mineSite') {
61
+ goTo(getRedirectLink(`/app/mine-summary/${data.datastakeId}`));
62
+ } else if (locationTypes.includes(data.type)) {
57
63
  goTo(getRedirectLink(`/app/view/locations/${data.datastakeId}`));
58
64
  } else {
59
65
  goTo(getRedirectLink(`/app/view/stakeholders/${data.datastakeId}`));
@@ -1,19 +1,6 @@
1
1
  export const mapData = ({ t, data = [], tabSelected }) => {
2
2
  if (!data.length) {
3
- return [
4
- { category: "", type: t("Stakeholders"), value: 0.5 },
5
- { category: "", type: t("Locations"), value: 0.5 },
6
- { category: "", type: t("Events"), value: 0.5 },
7
- { category: " ", type: "Stakeholders", value: 0.5 },
8
- { category: " ", type: "Locations", value: 0.5 },
9
- { category: " ", type: t("Events"), value: 0.5 },
10
- { category: " ", type: t("Stakeholders"), value: 0.5 },
11
- { category: " ", type: t("Locations"), value: 0.5 },
12
- { category: " ", type: t("Events"), value: 0.5 },
13
- { category: " ", type: t("Stakeholders"), value: 0.5 },
14
- { category: " ", type: t("Locations"), value: 0.5 },
15
- { category: " ", type: t("Events"), value: 0.5 },
16
- ];
3
+ return [];
17
4
  }
18
5
 
19
6
  const metricTypes = {
@@ -11,16 +11,23 @@ export const useContributionsGraph = ({
11
11
  return mapData({ t, data, tabSelected });
12
12
  }, [data, t]);
13
13
 
14
+ const isEmpty = useMemo(() => _data?.length === 0, [_data]);
15
+
14
16
  const chartConfig = useMemo(() => {
15
17
  return {
16
18
  data: _data,
17
- xField: "value",
18
- yField: "category",
19
+ xFieldKey: "value",
20
+ yFieldKey: "category",
19
21
  seriesField: "type",
20
22
  isGroup: true,
23
+ ...(isEmpty && {
24
+ xAxisConfig: {
25
+ min: 0,
26
+ max: 10,
27
+ tickCount: 5,
28
+ }
29
+ }),
21
30
  renderTooltipContent: (title, items) => {
22
- const isEmpty = !data.length;
23
-
24
31
  const tooltipItems = items.map((item) => ({
25
32
  label: item.name,
26
33
  color: item.color,
@@ -40,7 +47,7 @@ export const useContributionsGraph = ({
40
47
  ],
41
48
  }
42
49
 
43
- }, [_data, t, theme]);
50
+ }, [_data, t, theme, isEmpty]);
44
51
 
45
52
  return chartConfig;
46
53
  }
@@ -86,7 +86,7 @@ function MineSites({
86
86
  return [
87
87
  {
88
88
  label: t("Category"),
89
- value: findOptions(data?.category, locationCategories ?? []) || "--",
89
+ value: findOptions(data?.category, options?.categoriesOptions ?? []) || "--",
90
90
  },
91
91
  ];
92
92
  }
@@ -59,7 +59,7 @@ export const useTriangulation = ({ widgetData, t = () => {}, section, theme = {}
59
59
  return renderTooltipJsx({
60
60
  title: t(
61
61
  section === "data-compilation"
62
- ? "nashiriki::Information Sharing"
62
+ ? "Information Sharing"
63
63
  : "Triangulation",
64
64
  ),
65
65
  items: [
@@ -0,0 +1,175 @@
1
+ import React from 'react';
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';
8
+ import MoreMenu from '../../../core/components/Table/MoreMenu/index.jsx';
9
+
10
+
11
+ const getLinkValue = (value, linkingObject) => {
12
+ if(linkingObject && linkingObject?.[value]) {
13
+ return linkingObject?.[value]?.name;
14
+ }
15
+ return null;
16
+ }
17
+
18
+ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data, applications}) => [
19
+ {
20
+ dataIndex: 'datastakeId',
21
+ title: t('ID'),
22
+ ellipsis: true,
23
+ show: true,
24
+ render: (v, all) => {
25
+ if (all.empty) {
26
+ return <div className="daf-default-cell" />
27
+ }
28
+
29
+ return <Tooltip title={v}>{v}</Tooltip>;
30
+ },
31
+ },
32
+ {
33
+ dataIndex: 'partner',
34
+ title: t('Partner'),
35
+ ellipsis: true,
36
+ show: true,
37
+ render: (v, all) => {
38
+ if (all.empty) {
39
+ return <div className="daf-default-cell" />
40
+ }
41
+
42
+ return <Tooltip title={v}>{v}</Tooltip>;
43
+ },
44
+ },
45
+ {
46
+ dataIndex: 'dataPoints',
47
+ title: t('Data Points'),
48
+ ellipsis: true,
49
+ show: true,
50
+ render: (v, all) => {
51
+ if (all.empty) {
52
+ return <div className="daf-default-cell" />
53
+ }
54
+
55
+ const category = findOptions(v, data?.options?.locationCategories);
56
+
57
+ return category ? <Tooltip title={category}>{category}</Tooltip> : '-';
58
+ },
59
+ },
60
+ {
61
+ dataIndex: 'country',
62
+ title: t('Country'),
63
+ ellipsis: true,
64
+ show: true,
65
+ render: (v, all) => {
66
+ if (all.empty) {
67
+ return <div className="daf-default-cell" />
68
+ }
69
+
70
+ const country = findOptions(v, options?.countries);
71
+
72
+ return country ? <Tooltip title={country}>{country}</Tooltip> : '-';
73
+ },
74
+ },
75
+ {
76
+ dataIndex: 'province',
77
+ title: t('Province'),
78
+ ellipsis: true,
79
+ show: true,
80
+ render: (v, all) => {
81
+ if (all.empty) {
82
+ return <div className="daf-default-cell" />
83
+ }
84
+
85
+ const province = getLinkValue(all?.administrativeLevel1, all?.linking?.SCL);
86
+
87
+ return province ? <Tooltip title={province}>{province}</Tooltip> : '-';
88
+ },
89
+ },
90
+ {
91
+ dataIndex: 'territory',
92
+ title: t('Territory'),
93
+ ellipsis: true,
94
+ show: true,
95
+ render: (v, all) => {
96
+ if (all.empty) {
97
+ return <div className="daf-default-cell" />
98
+ }
99
+
100
+ const territory = getLinkValue(all?.administrativeLevel2, all?.linking?.SCL);
101
+
102
+ return territory ? <Tooltip title={territory}>{territory}</Tooltip> : '-';
103
+ },
104
+ },
105
+ {
106
+ title: t("Sources"),
107
+ dataIndex: "sources",
108
+ key: "sources",
109
+ show: activeTab !== "own",
110
+ render: (val, all) => {
111
+ if (all.empty) {
112
+ return <div className="daf-default-cell" />;
113
+ }
114
+
115
+ const sources = sourceAvatarConfig(val, user, applications);
116
+
117
+ return <AvatarGroup items={sources}></AvatarGroup>;
118
+ },
119
+ },
120
+ {
121
+ title: t("Last Update"),
122
+ dataIndex: "updatedAt",
123
+ key: "updatedAt",
124
+ width: 125,
125
+ render: (date, all) => {
126
+ if (all.empty) {
127
+ return <div className="daf-default-cell" />;
128
+ }
129
+
130
+ const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
131
+ return <Tooltip title={_date}>{_date}</Tooltip>;
132
+ },
133
+ ellipsis: true,
134
+ },
135
+
136
+ {
137
+ id: 'actions',
138
+ title: "",
139
+ width: 60,
140
+ render: (_, all) => {
141
+ if (all.empty) {
142
+ return <div className="daf-default-cell" />;
143
+ }
144
+ const onClick = () => {
145
+ const link = `/app/view/${subject}/${all.datastakeId}`;
146
+ if (activeTab === "shared") {
147
+ link += `?sourceId=${all?.authorId?.id}`;
148
+ }
149
+ goTo(getRedirectLink(link));
150
+ };
151
+ const moreMenuItems = [
152
+ {
153
+ label: t("Details"),
154
+ value: "details",
155
+ onClick: onClick,
156
+ },
157
+ {
158
+ label: t("Summary"),
159
+ value: "Summary",
160
+ onClick: () => {
161
+ let link = `/app/summary/${subject}/${all.datastakeId}`
162
+ if (activeTab === "shared") {
163
+ link += `?sourceId=${all?.authorId?.id}`;
164
+ }
165
+ goTo(getRedirectLink(link));
166
+ },
167
+ // disabled: true,
168
+ },
169
+ ];
170
+ return <div >
171
+ <MoreMenu items={moreMenuItems} />
172
+ </div>;
173
+ }
174
+ }
175
+ ].filter((column) => column.show !== false);
File without changes
File without changes
File without changes
@@ -106,10 +106,7 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
106
106
  }
107
107
 
108
108
  const eventCategory = findOptions(v, data?.options?.eventCategoryOptions);
109
- const categoryValue = getEventCategoryBySubject(eventCategory, subject);
110
- console.log({categoryValue})
111
- console.log({eventCategory})
112
- console.log({subject})
109
+ const categoryValue = getEventCategoryBySubject(eventCategory, "correctiveActions", true);
113
110
 
114
111
  return categoryValue ? <Tooltip title={categoryValue}>{categoryValue}</Tooltip> : '-';
115
112
  },
@@ -1,9 +1,9 @@
1
- export const getEventCategoryBySubject = (eventCategoryObject, subject) => {
1
+ export const getEventCategoryBySubject = (eventCategoryObject, subject, isSingular = false) => {
2
2
  if (!eventCategoryObject || typeof eventCategoryObject !== 'object') {
3
3
  return null;
4
4
  }
5
5
 
6
- const subjectSingular = subject.endsWith('ies')
6
+ const subjectSingular = isSingular ? subject : subject.endsWith('ies')
7
7
  ? subject.slice(0, -3) + 'y'
8
8
  : subject.endsWith('s')
9
9
  ? subject.slice(0, -1)
@@ -87,7 +87,7 @@ const EventsTable = ({
87
87
  return (
88
88
  <TablePageWithTabs
89
89
  t={t}
90
- title={t("events")}
90
+ title={t("Events")}
91
91
  breadCrumbs={breadcrumbs}
92
92
  location={location}
93
93
  loading={loading}
@@ -7,6 +7,7 @@ import AvatarGroup from '../../../core/components/AvatarGroup/index.jsx';
7
7
  import sourceAvatarConfig from '../../../../helpers/sourceAvatarConfig.js';
8
8
  import MoreMenu from '../../../core/components/Table/MoreMenu/index.jsx';
9
9
  import MoreOptions from '../../../core/components/Table/MoreOptions/index.jsx';
10
+ import { renderStatusTag } from '../../../utils/tags.js';
10
11
 
11
12
  export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data, applications}) => [
12
13
  {
@@ -89,8 +90,8 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
89
90
  return <div className="daf-default-cell" />
90
91
  }
91
92
 
92
- const operators = all?.operatorOfLocation?.map((operator) => operator?.clientLocation?.name);
93
- return (operators && operators.length > 0) ? <MoreOptions data={operators || []} tooltipPlacement="topLeft" /> : '-';
93
+ const operators = all?.operator?.map((operator) => operator?.locationClient?.name)?.filter(Boolean);
94
+ return (operators && operators.length > 0) ? <MoreOptions data={operators || []} toolTipPlacement={operators?.length < 2 ? "topLeft" : "top"} /> : '-';
94
95
  },
95
96
  },
96
97
  {
@@ -117,8 +118,9 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
117
118
  if (all.empty) {
118
119
  return <div className="daf-default-cell" />
119
120
  }
120
- const status = findOptions(v, data?.options?.statusOptions);
121
- return status ? <Tooltip title={status}>{status}</Tooltip> : '-';
121
+ const _val = all?.published || all?.status === "submitted" ? "submitted" : v;
122
+
123
+ return renderStatusTag({ value: _val, t });
122
124
  },
123
125
  },
124
126
 
@@ -6,6 +6,7 @@ import CustomIcon from '../../../core/components/Icon/CustomIcon.jsx';
6
6
  import AvatarGroup from '../../../core/components/AvatarGroup/index.jsx';
7
7
  import sourceAvatarConfig from '../../../../helpers/sourceAvatarConfig.js';
8
8
  import MoreMenu from '../../../core/components/Table/MoreMenu/index.jsx';
9
+ import { renderStatusTag } from '../../../utils/tags.js';
9
10
 
10
11
  export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data, applications}) => [
11
12
  {
@@ -133,8 +134,9 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
133
134
  if (all.empty) {
134
135
  return <div className="daf-default-cell" />
135
136
  }
136
- const status = findOptions(v, data?.options?.statusOptions);
137
- return status ? <Tooltip title={status}>{status}</Tooltip> : '-';
137
+ const _val = all?.published || all?.status === "submitted" ? "submitted" : v;
138
+
139
+ return renderStatusTag({ value: _val, t });
138
140
  },
139
141
  },
140
142
 
@@ -37,6 +37,7 @@ const PlantingCycleSummary = ({ activityData, supportText, onDownload, downloadD
37
37
  data={[]}
38
38
  />
39
39
  </Widget>
40
+
40
41
  </section>
41
42
  </DashboardLayout>
42
43
  )
@@ -12,10 +12,10 @@ export const IconNodesConfig = {
12
12
  emptyName: "no-traders",
13
13
  },
14
14
  government: {
15
- name: "Government",
15
+ name: "Governance",
16
16
  icon: "KYC",
17
17
  order: 3,
18
- emptyName: "no-government",
18
+ emptyName: "no-governance",
19
19
  },
20
20
  other: {
21
21
  name: "Other",
@@ -1,18 +1,18 @@
1
1
  import { IconNodesConfig } from './config.js';
2
2
  import { findOptions } from '../../../../../../helpers/StringHelper.js';
3
3
 
4
- export const getStakeholderMappingData = ({data, locationData, id, options, t, goTo, selectedPartners, mainSubject}) => {
4
+ export const getStakeholderMappingData = ({data, locationData, id, options, t, goTo, selectedPartners, mainSubject, APP}) => {
5
5
  const _data = data;
6
6
  const mainSubjectData = _data?.[mainSubject];
7
7
 
8
8
  return {
9
- id: mainSubjectData?.datastakeId || "",
10
- name: mainSubjectData?.name || "",
9
+ id: mainSubjectData?.datastakeId || locationData?.datastakeId || "",
10
+ name: mainSubjectData?.name || locationData?.name || "",
11
11
  country: {
12
- label: findOptions(mainSubjectData?.country, options?.countries) || "",
13
- value: (mainSubjectData?.country || "").toLowerCase() || "",
12
+ label: findOptions((mainSubjectData?.country || locationData?.country), options?.countries) || "",
13
+ value: ((mainSubjectData?.country || locationData?.country) || "").toLowerCase() || "",
14
14
  },
15
- onClick: () => goTo(`/app/view/production-sites/${mainSubjectData?.datastakeId}`),
15
+ onClick: () => goTo(`/app/view/${APP === 'nashiriki' ? 'scl' : 'production-sites'}/${mainSubjectData?.datastakeId || locationData?.datastakeId}`),
16
16
  totalSources: selectedPartners?.partners?.length || 0,
17
17
  backgroundColor: "#FFD6E7",
18
18
  iconColor: "#C41D7F",
@@ -43,7 +43,7 @@ export const getStakeholderMappingData = ({data, locationData, id, options, t, g
43
43
  icon: "DashboardStakeholder",
44
44
  onClick: () => {
45
45
  if (child?.type === "operator") {
46
- goTo(`/app/summary/operators/${child.datastakeId}`);
46
+ goTo(`/app/${APP === 'nashiriki' ? 'summary/operators' : 'operator-summary'}/${child.datastakeId}`);
47
47
  return;
48
48
  }
49
49
 
@@ -11,6 +11,7 @@ const StakeholderMapping = ({
11
11
  goTo = () => {},
12
12
  selectedPartners = {},
13
13
  locationData = {},
14
+ APP,
14
15
  }) => {
15
16
 
16
17
  const defaultFilter = useMemo(() => {
@@ -25,7 +26,7 @@ const StakeholderMapping = ({
25
26
  coreSubject: "location",
26
27
  filterBySources: false,
27
28
  metrics: {
28
- operator: ['operator', 'operator.clientLocation'],
29
+ operator: ['operator.locationClient'],
29
30
  government: ['custom.stakeholderId', 'governance'],
30
31
  trader: ['trade'],
31
32
  other: ['civilSociety', 'international'],
@@ -37,7 +38,7 @@ const StakeholderMapping = ({
37
38
  const { data, loading } = useWidgetFetch({config: defaultFilter});
38
39
 
39
40
  const graphData = useMemo(() => {
40
- return getStakeholderMappingData({data, locationData, id, options, t, goTo, selectedPartners, mainSubject: "mine"});
41
+ return getStakeholderMappingData({data, locationData, id, options, t, goTo, selectedPartners, mainSubject: "mine", APP});
41
42
  }, [data, locationData, id, options, t, goTo, selectedPartners]);
42
43
 
43
44
  return (
@@ -30,6 +30,7 @@ const MineSummary = ({
30
30
  goBack = () => {},
31
31
  onIdChange = () => {},
32
32
  breadcrumbs = [],
33
+ APP,
33
34
  }) => {
34
35
  const {
35
36
  selectedItem,
@@ -78,7 +79,7 @@ const MineSummary = ({
78
79
  tooltip: t("Details"),
79
80
  icon: "FileEdit",
80
81
  onClick: () => {
81
- goTo(getRedirectLink(`/app/view/production-sites/${params?.id ? params?.id : selectedItem}`));
82
+ goTo(getRedirectLink(`/app/view/${APP === 'nashiriki' ? 'scl' : 'production-sites'}/${params?.id ? params?.id : selectedItem}`));
82
83
  },
83
84
  },
84
85
  {
@@ -142,6 +143,7 @@ const MineSummary = ({
142
143
  t={t}
143
144
  id={params?.id || selectedItem}
144
145
  partners={partners}
146
+ APP={APP}
145
147
  />
146
148
  </section>
147
149
  <section>
@@ -11,7 +11,6 @@ const Governance = ({
11
11
  id,
12
12
  options = {},
13
13
  goTo = () => {},
14
-
15
14
  }) => {
16
15
  const defaultFetchConfig = useMemo(() => {
17
16
  return {
@@ -2,6 +2,13 @@ import React from "react";
2
2
  import { Tag, Tooltip } from "antd";
3
3
  import CountryFlag from "../../../../../core/components/UI/CountryFlag/index.jsx";
4
4
  import {findOptions, truncateString } from "../../../../../../helpers/StringHelper.js";
5
+ import MoreTags from "../../../../../core/components/Table/MoreTags/index.jsx";
6
+
7
+ const getAllProducts = (arr) => {
8
+ return arr.flatMap(item =>
9
+ (item.products || []).map(product => product.typeOfProduct)
10
+ );
11
+ }
5
12
 
6
13
  export const getKeyIndicatorConfig = ({ t, data = {}, options = {} }) => [
7
14
  {
@@ -28,14 +35,14 @@ export const getKeyIndicatorConfig = ({ t, data = {}, options = {} }) => [
28
35
  {
29
36
  label: t("Supply Chain Position"),
30
37
  render: () => {
31
- const position = findOptions(data?.positionSupplyChain, options?.positionSupplyChainOptions);
38
+ const position = findOptions(data?.positionSupplyChain, options?.positionSupplyChainOptions || options?.optionPositionSupplyChain);
32
39
  return <div>{position|| "-"}</div>;
33
40
  },
34
41
  },
35
42
  {
36
43
  label: t("Legal Form"),
37
44
  render: () => {
38
- const subCategory = findOptions(data?.subCategory, options?.subCategoriesOptions);
45
+ const subCategory = findOptions(data?.subCategory, options?.subCategoriesOptions || options?.subCategory);
39
46
  if(subCategory?.length > 22) {
40
47
  const _subCategory = truncateString(subCategory, 22);
41
48
  return <Tooltip title={subCategory}>
@@ -48,43 +55,48 @@ export const getKeyIndicatorConfig = ({ t, data = {}, options = {} }) => [
48
55
  {
49
56
  label: t("Products"),
50
57
  render: () => {
51
- if ((data?.products || []).length === 0) {
52
- return "-";
53
- }
58
+
59
+ const clientProducts = getAllProducts(data?.clients || []);
60
+ const supplierProducts = getAllProducts(data?.suppliers || []);
61
+ const locationProducts = getAllProducts(data?.locationSuppliers || []);
62
+
63
+ const allProducts = [...clientProducts, ...supplierProducts, ...locationProducts];
64
+ const uniqueProducts = [...new Set(allProducts)];
65
+ const products = findOptions(uniqueProducts, options?.mineralOptions || options?.minerals);
66
+
54
67
 
55
68
  return (
56
- <div style={{ display: "flex", flexWrap: "wrap" }}>
57
- {data?.products?.map((product) => {
58
- return (
59
- <Tag
60
- color="processing"
61
- style={{ color: "#1677FF", marginBottom: 8 }}
62
- key={product}
63
- >
64
- {t(product)}
65
- </Tag>
66
- );
67
- })}
68
- </div>
69
+ <>
70
+ {products.length > 0 ? (
71
+ <div style={{ display: "flex", flexWrap: "wrap" }}>
72
+ <MoreTags
73
+ values={products}
74
+ limit={3}
75
+ tagColor="processing"
76
+ style={{ fontWeight: "normal", fontSize: 14 }}
77
+ />
78
+ </div>
79
+ ) : "-"}
80
+ </>
69
81
  );
70
82
  },
71
83
  },
72
84
  {
73
85
  label: t("Associated Mine Sites"),
74
86
  render: () => {
75
- return <div>{data?.associatedMineSites || 0}</div>;
87
+ return <div>{data?.locationSuppliers?.length || 0}</div>;
76
88
  },
77
89
  },
78
90
  {
79
91
  label: t("Identified Suppliers"),
80
92
  render: () => {
81
- return <div>{data?.identifiedSuppliers || 0}</div>;
93
+ return <div>{data?.suppliers?.length || 0}</div>;
82
94
  },
83
95
  },
84
96
  {
85
97
  label: t("Identified Customers"),
86
98
  render: () => {
87
- return <div>{data?.identifiedCustomers || 0}</div>;
99
+ return <div>{data?.clients?.length || 0}</div>;
88
100
  },
89
101
  },
90
102
  ];