datastake-daf 0.6.745 → 0.6.747

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 (91) 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/components/index.js +71 -7
  7. package/dist/hooks/index.js +2 -2
  8. package/dist/pages/index.css +1 -0
  9. package/dist/pages/index.js +5924 -32
  10. package/dist/services/index.js +23 -1
  11. package/package.json +1 -1
  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/Screens/TableScreen/TablePageWithTabs/index.jsx +128 -0
  15. package/src/@daf/{pages/pages → core/components/TableScreen}/TablePageWithTabs/index.jsx +3 -3
  16. package/src/@daf/hooks/useSources.js +1 -1
  17. package/src/@daf/pages/Documents/index.jsx +1 -1
  18. package/src/@daf/pages/Events/Activities/index.jsx +1 -1
  19. package/src/@daf/pages/Events/Incidents/index.jsx +1 -1
  20. package/src/@daf/pages/Events/index.jsx +1 -1
  21. package/src/@daf/pages/Locations/MineSite/index.jsx +1 -1
  22. package/src/@daf/pages/Locations/index.jsx +1 -1
  23. package/src/@daf/pages/Stakeholders/Operators/index.jsx +1 -1
  24. package/src/@daf/pages/Stakeholders/Workers/index.jsx +1 -1
  25. package/src/@daf/pages/Stakeholders/index.jsx +1 -1
  26. package/src/@daf/pages/Summary/Activities/Restoration/config.js +36 -0
  27. package/src/@daf/pages/Summary/Activities/Restoration/helper.js +98 -0
  28. package/src/@daf/pages/Summary/Activities/Restoration/index.jsx +178 -0
  29. package/src/@daf/pages/Summary/Minesite/components/LocationMap/index.js +61 -0
  30. package/src/@daf/pages/Summary/Minesite/components/MineSiteDetails/config.js +77 -0
  31. package/src/@daf/pages/Summary/Minesite/components/MineSiteDetails/index.js +47 -0
  32. package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/config.js +26 -0
  33. package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/helper.js +64 -0
  34. package/src/@daf/pages/Summary/Minesite/components/StakeholderMapping/index.js +56 -0
  35. package/src/@daf/pages/Summary/Minesite/index.jsx +162 -0
  36. package/src/@daf/pages/Summary/Operator/components/Governance/config.js +26 -0
  37. package/src/@daf/pages/Summary/Operator/components/Governance/helper.js +61 -0
  38. package/src/@daf/pages/Summary/Operator/components/Governance/index.js +55 -0
  39. package/src/@daf/pages/Summary/Operator/components/KeyInformation/config.js +84 -0
  40. package/src/@daf/pages/Summary/Operator/components/KeyInformation/index.js +46 -0
  41. package/src/@daf/pages/Summary/Operator/components/TradeRelationships/config.js +40 -0
  42. package/src/@daf/pages/Summary/Operator/components/TradeRelationships/helper.js +98 -0
  43. package/src/@daf/pages/Summary/Operator/components/TradeRelationships/hook.js +160 -0
  44. package/src/@daf/pages/Summary/Operator/components/TradeRelationships/index.js +83 -0
  45. package/src/@daf/pages/Summary/Operator/hook.js +176 -0
  46. package/src/@daf/pages/Summary/Operator/index.jsx +170 -0
  47. package/src/@daf/pages/Summary/components/InformationAvailability/components/Contributions/index.js +36 -0
  48. package/src/@daf/pages/Summary/components/InformationAvailability/components/InformationCompleteness/index.js +58 -0
  49. package/src/@daf/pages/Summary/components/InformationAvailability/index.js +42 -0
  50. package/src/@daf/pages/Summary/hook.js +188 -0
  51. package/src/@daf/services/OperatorService.js +16 -0
  52. package/src/@daf/services/SourceService.js +1 -1
  53. package/src/helpers/StringHelper.js +7 -0
  54. package/src/pages.js +6 -4
  55. package/src/@daf/pages/Events/Incidents2/columns.js +0 -176
  56. package/src/@daf/pages/Events/Incidents2/config.js +0 -170
  57. package/src/@daf/pages/Events/Incidents2/create.jsx +0 -104
  58. package/src/@daf/pages/Events/Incidents2/index.jsx +0 -156
  59. /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/ChartsContainer/components/GenderDistribution/config.js +0 -0
  60. /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/ChartsContainer/components/GenderDistribution/index.js +0 -0
  61. /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/ChartsContainer/components/Identification/hook.js +0 -0
  62. /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/ChartsContainer/components/Identification/index.js +0 -0
  63. /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/ChartsContainer/components/Locations/config.js +0 -0
  64. /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/ChartsContainer/components/Locations/index.js +0 -0
  65. /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/ChartsContainer/index.js +0 -0
  66. /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/KeyIndicators/config.js +0 -0
  67. /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/KeyIndicators/index.js +0 -0
  68. /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/SupplyChainMap/index.js +0 -0
  69. /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/components/TradeRelationships/index.js +0 -0
  70. /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/config.js +0 -0
  71. /package/src/@daf/pages/{dashboards → Dashboards}/SupplyChain/index.jsx +0 -0
  72. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/AccumulationGraph/hook.js +0 -0
  73. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/AccumulationGraph/index.jsx +0 -0
  74. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/ContributionsGraph/helper.js +0 -0
  75. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/ContributionsGraph/hook.js +0 -0
  76. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/ContributionsGraph/index.jsx +0 -0
  77. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/CustomSegment/index.jsx +0 -0
  78. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/DataChainOfCustody/index.jsx +0 -0
  79. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/DataCompilation/index.jsx +0 -0
  80. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/DataConsilidation/index.jsx +0 -0
  81. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/KeyIndicators/config.js +0 -0
  82. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/KeyIndicators/index.jsx +0 -0
  83. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/MineSites/config.js +0 -0
  84. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/MineSites/helper.js +0 -0
  85. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/MineSites/index.jsx +0 -0
  86. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/Triangulation/config.js +0 -0
  87. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/Triangulation/hook.js +0 -0
  88. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/components/Triangulation/index.jsx +0 -0
  89. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/config.js +0 -0
  90. /package/src/@daf/pages/{dashboards → Dashboards}/UserDashboard/index.jsx +0 -0
  91. /package/src/@daf/pages/{dashboards → Dashboards}/helper.js +0 -0
@@ -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;
@@ -0,0 +1,61 @@
1
+ import React, { useMemo } from 'react'
2
+ import Widget from '../../../../../core/components/Dashboard/Widget/index.jsx'
3
+ import Map from '../../../../../core/components/Dashboard/Map/index.jsx'
4
+ import { getLinkValue } from '../../../../../../helpers/StringHelper.js'
5
+
6
+ const LocationMap = ({
7
+ selectedPartners = {},
8
+ t = () => {},
9
+ params,
10
+ locationData = {},
11
+ loading = false,
12
+ }) => {
13
+ const data = useMemo(() => {
14
+ return {
15
+ gps: locationData?.gps || {},
16
+ name: locationData?.name || "",
17
+ admin_level_01:
18
+ locationData?.linking?.SCL?.[locationData?.administrativeLevel1]?.name || "",
19
+ admin_level_02:
20
+ locationData?.linking?.SCL?.[locationData?.administrativeLevel2]?.name || "",
21
+ country: locationData?.country,
22
+ };
23
+ }, [locationData]);
24
+
25
+
26
+ return (
27
+ <Widget
28
+ title={t("Location")}
29
+ className="no-px no-pb-body overflow-hidden"
30
+ loading={loading}
31
+ >
32
+ <Map
33
+ showSider={false}
34
+ primaryLink={true}
35
+ mapConfig={{
36
+ maxZoom: 10,
37
+ }}
38
+ type={"location"}
39
+ data={[data]}
40
+ renderTooltip={() => {
41
+ const country = data?.country;
42
+ const adminLevel1Label = t("Province")
43
+ const adminLevel2Label = t("Territory");
44
+
45
+ return [
46
+ {
47
+ label: t(adminLevel1Label),
48
+ value: data?.admin_level_01 || "--",
49
+ },
50
+ {
51
+ label: t(adminLevel2Label),
52
+ value: data?.admin_level_02 || "--",
53
+ },
54
+ ];
55
+ }}
56
+ />
57
+ </Widget>
58
+ )
59
+ }
60
+
61
+ export default LocationMap
@@ -0,0 +1,77 @@
1
+ import React from "react";
2
+ import { Tag } from "antd";
3
+ import { getTagColor } from "../../../../../utils/productTag.js";
4
+
5
+ export function getKeyIndicatorsConfig({ t, data }) {
6
+ return [
7
+ {
8
+ label: t("Extraction Methods"),
9
+ render: () => {
10
+ if (!data?.extractionPoints?.length) {
11
+ return "-";
12
+ }
13
+ return (
14
+ <div
15
+ style={{
16
+ display: "flex",
17
+ flexWrap: "wrap",
18
+ }}
19
+ >
20
+ {data?.extractionPoints?.map((method) => {
21
+ return (
22
+ <Tag
23
+ key={method}
24
+ style={{
25
+ marginBottom: 8,
26
+ }}
27
+ >
28
+ {method}
29
+ </Tag>
30
+ );
31
+ })}
32
+ </div>
33
+ );
34
+ },
35
+ },
36
+ {
37
+ label: t("Products"),
38
+ render: () => {
39
+ if (data?.productsOfLocation?.length === 0) {
40
+ return "-";
41
+ }
42
+
43
+ return (
44
+ <div
45
+ style={{
46
+ display: "flex",
47
+ flexWrap: "wrap",
48
+ }}
49
+ >
50
+ {data?.productsOfLocation?.map((product) => {
51
+ return (
52
+ <Tag
53
+ key={product}
54
+ style={{
55
+ marginBottom: 8,
56
+ }}
57
+ color={getTagColor(product)}
58
+ >
59
+ {product}
60
+ </Tag>
61
+ );
62
+ })}
63
+ </div>
64
+ );
65
+ },
66
+ },
67
+ {
68
+ label: t("Number of Workers on Site"),
69
+ render: () => {
70
+ if (!data.workers) {
71
+ return "-";
72
+ }
73
+ return data.workers;
74
+ },
75
+ },
76
+ ];
77
+ }
@@ -0,0 +1,47 @@
1
+ import React, { useMemo } from 'react'
2
+ import { getKeyIndicatorsConfig } from './config.js'
3
+ import KeyIndicatorsWidget from '../../../../../core/components/Dashboard/Widget/KeyIndicators/index.jsx'
4
+
5
+ const MineSiteDetails = ({
6
+ locationData = {},
7
+ loading = false,
8
+ t = () => {},
9
+ options = {}
10
+ }) => {
11
+
12
+ const data = useMemo(() => {
13
+ return {
14
+ extractionPoints: (locationData?.extractionMethod || []).map((method) => {
15
+ const _method = options?.extractionMethodsOptions?.find(
16
+ (option) => option.value === method,
17
+ )?.label;
18
+
19
+ return _method;
20
+ }),
21
+ products: (
22
+ (locationData?.products || []).map((product) => product.typeOfProduct) || []
23
+ ).map((product) => {
24
+ const _product = options?.minerals?.find(
25
+ (option) => option.value === product,
26
+ )?.label;
27
+
28
+ return _product;
29
+ }),
30
+ workers: locationData?.totalNumberOfWorkers || 0,
31
+ };
32
+ }, [locationData, options]);
33
+
34
+ const config = useMemo(() => getKeyIndicatorsConfig({ t, data }), [t, data]);
35
+
36
+ return (
37
+ <KeyIndicatorsWidget
38
+ title={t("Mine Site Details")}
39
+ className="value-center small-content row-content-col"
40
+ config={config}
41
+ loading={loading}
42
+ widgetClassName="custom-width-b"
43
+ />
44
+ )
45
+ }
46
+
47
+ export default MineSiteDetails
@@ -0,0 +1,26 @@
1
+ export const IconNodesConfig = {
2
+ operators: {
3
+ name: "nashiriki::Operators",
4
+ icon: "Worker",
5
+ order: 1,
6
+ emptyName: "no-operators",
7
+ },
8
+ traders: {
9
+ name: "nashiriki::Traders",
10
+ icon: "Handshake",
11
+ order: 2,
12
+ emptyName: "no-traders",
13
+ },
14
+ government: {
15
+ name: "nashiriki::Government",
16
+ icon: "KYC",
17
+ order: 3,
18
+ emptyName: "no-government",
19
+ },
20
+ other: {
21
+ name: "nashiriki::Other",
22
+ icon: "CivilSociety",
23
+ order: 4,
24
+ emptyName: "no-other",
25
+ },
26
+ };
@@ -0,0 +1,64 @@
1
+ import { IconNodesConfig } from './config.js';
2
+
3
+ export const getStakeholderMappingData = ({data, locationData, id, options, t, goTo, selectedPartners}) => {
4
+ const _data = data;
5
+
6
+ return {
7
+ id: id,
8
+ name: locationData?.name || "",
9
+ country: {
10
+ label:
11
+ options?.countries?.find((country) => country.value === locationData?.country)
12
+ ?.label || "",
13
+ value: (locationData?.country || "").toLowerCase() || "",
14
+ },
15
+ onClick: () => goTo(`/app/view/production-sites/${id}`),
16
+ totalSources: selectedPartners?.partners?.length || 0,
17
+ backgroundColor: "#FFD6E7",
18
+ iconColor: "#C41D7F",
19
+
20
+ icon: "DashboardLocations",
21
+ children: Object.keys(_data)?.map((key, index) => {
22
+ return {
23
+ id: key,
24
+ name: t(IconNodesConfig[key]?.name),
25
+ icon: IconNodesConfig[key]?.icon,
26
+ order: IconNodesConfig[key]?.order || index + 1,
27
+ activeColour: "#b6f5ec",
28
+ iconHoverColor: "#fff",
29
+ hoverColor: "#36cfca",
30
+ content: _data[key].length,
31
+ emptyName: IconNodesConfig[key]?.emptyName
32
+ ? t(`nashiriki::${IconNodesConfig[key]?.emptyName}`)
33
+ : undefined,
34
+ children: (_data[key] || [])?.map((child) => {
35
+ return {
36
+ id: child?.datastakeId || "",
37
+ name: child?.name || "",
38
+ country: {
39
+ label:
40
+ options?.countries?.find(
41
+ (country) => country.value === child?.country,
42
+ )?.label || "",
43
+ value: child?.country ? child?.country?.toLowerCase() : "",
44
+ },
45
+
46
+ icon: "DashboardStakeholder",
47
+ onClick: () => {
48
+ if (child?.type === "operator") {
49
+ goTo(`/app/summary/operators/${child.datastakeId}`);
50
+ return;
51
+ }
52
+
53
+ goTo(`/app/view/stakeholders/${child.datastakeId}`);
54
+ },
55
+ totalSources: child?.sources || 0,
56
+ tooltipHeader: t("nashiriki::link-details"),
57
+ tooltipLabel: t("nashiriki::sources-reporting"),
58
+ value: child?.sources || 0,
59
+ };
60
+ }),
61
+ };
62
+ }),
63
+ };
64
+ }
@@ -0,0 +1,56 @@
1
+ import React, { useMemo } from 'react'
2
+ import { useWidgetFetch } from '../../../../../hooks/useWidgetFetch.js';
3
+ import { getStakeholderMappingData } from './helper.js';
4
+ import Widget from '../../../../../core/components/Dashboard/Widget/index.jsx';
5
+ import StakeholderMappings from '../../../../../core/components/Graphs/StakeholderMappings/index.jsx';
6
+
7
+ const StakeholderMapping = ({
8
+ t = () => {},
9
+ id,
10
+ options = {},
11
+ goTo = () => {},
12
+ selectedPartners = {},
13
+ locationData = {},
14
+ }) => {
15
+
16
+ const defaultFilter = useMemo(() => {
17
+ return {
18
+ basepath: "analytics",
19
+ url: "/widgets/information-map-graph",
20
+ defaultData: [],
21
+ stop: selectedPartners?.loading,
22
+ filters: {
23
+ datastakeId: id,
24
+ sources: selectedPartners?.partners || [],
25
+ coreSubject: "location",
26
+ filterBySources: false,
27
+ metrics: {
28
+ operator: ['operator'],
29
+ government: ['custom', 'governance'],
30
+ trader: ['trade'],
31
+ other: ['civilSociety', 'international'],
32
+ }
33
+ },
34
+ };
35
+ }, [selectedPartners, id]);
36
+
37
+ const { data, loading } = useWidgetFetch({config: defaultFilter});
38
+
39
+ const graphData = useMemo(() => {
40
+ return getStakeholderMappingData({data, locationData, id, options, t, goTo, selectedPartners});
41
+ }, [data, locationData, id, options, t, goTo, selectedPartners]);
42
+
43
+ return (
44
+ <Widget
45
+ loading={loading}
46
+ title={t("Stakeholder Mapping")}
47
+ className={"with-border-header no-px no-p-body"}
48
+ >
49
+ <div style={{ height: 600 }}>
50
+ <StakeholderMappings data={graphData} t={t} />
51
+ </div>
52
+ </Widget>
53
+ )
54
+ }
55
+
56
+ export default StakeholderMapping
@@ -0,0 +1,162 @@
1
+ import React from 'react'
2
+ import { useSummary } from '../hook.js'
3
+ import DashboardLayout from '../../../core/components/Dashboard/DashboardLayout/index.jsx'
4
+ import Header from '../../../core/components/Header/index.jsx'
5
+ import Multiselect from '../../../core/components/Select/MultiSelect/index.jsx'
6
+ import { Select, Spin } from 'antd'
7
+ import MineSiteDetails from './components/MineSiteDetails/index.js'
8
+ import LocationMap from './components/LocationMap/index.js'
9
+ import InformationAvailability from '../components/InformationAvailability/index.js'
10
+ import StakeholderMapping from './components/StakeholderMapping/index.js'
11
+
12
+ const MineSummary = ({
13
+ hasSelect = false,
14
+ loading = false,
15
+ getSingleData = () => {},
16
+ getMultipleData = () => {},
17
+ data = [],
18
+ id = '',
19
+ storageKey = '',
20
+ isPdf = false,
21
+ params = {},
22
+ partners = [],
23
+ selectedPartners = {},
24
+ user = {},
25
+ t = () => {},
26
+ theme = {},
27
+ service,
28
+ options = {},
29
+ goTo = () => {},
30
+ getRedirectLink = () => {},
31
+ goBack = () => {},
32
+ onIdChange = () => {},
33
+ }) => {
34
+ const {
35
+ selectedItem,
36
+ setSelectedItem,
37
+ dataOptions,
38
+ search,
39
+ debouncedSearch,
40
+ onSearch,
41
+ setSearch,
42
+ setDebouncedSearch,
43
+ sourceOptions,
44
+ setSelectedPartners,
45
+ singleItemData,
46
+ loading: loadingData,
47
+ } = useSummary({
48
+ getOne: getSingleData,
49
+ getMultiple: getMultipleData,
50
+ id,
51
+ hasSelect,
52
+ storageKey,
53
+ data,
54
+ isPdf: false,
55
+ params,
56
+ partners,
57
+ selectedPartners,
58
+ user,
59
+ t,
60
+ theme,
61
+ service,
62
+ onIdChange,
63
+ });
64
+
65
+ return (
66
+ <DashboardLayout
67
+ header={
68
+ <Header
69
+ title={t('Mine Summary')}
70
+ className="with-border-header h-w-btn-header no-px-body"
71
+ goBackTo={!hasSelect && goBack}
72
+ addedHeaderFirst
73
+ actionButtons={[
74
+ {
75
+ tooltip: t("Details"),
76
+ icon: "FileEdit",
77
+ onClick: () => {
78
+ goTo(getRedirectLink(`/app/view/production-sites/${params?.id ? params?.id : selectedItem}`));
79
+ },
80
+ },
81
+ {
82
+ tooltip: t("Find Data"),
83
+ icon: "Search",
84
+ onClick: () => {},
85
+ disabled: true,
86
+ },
87
+ ]}
88
+ addedHeader={
89
+ <div className="flex flex-row gap-4" style={{ marginRight: 8 }}>
90
+ <Multiselect
91
+ options={[...sourceOptions]}
92
+ isAvatarGroup
93
+ selectionType="checkbox"
94
+ key={partners?.length}
95
+ canUnselectLast={false}
96
+ onChange={(selected) => {
97
+ setSelectedPartners((prev) => ({
98
+ ...prev,
99
+ partners: selected,
100
+ loading: false,
101
+ }));
102
+ }}
103
+ dropDownWidth={200}
104
+ defaultSelected={(partners || []).map((p) => p.id) || []}
105
+ />
106
+ </div>
107
+ }
108
+ />
109
+ }
110
+ >
111
+ {hasSelect && (
112
+ <section>
113
+ <Select
114
+ showSearch
115
+ debounceTimeout={300}
116
+ onSearch={onSearch}
117
+ isSingle
118
+ style={{ height: "40px", width: "100%" }}
119
+ value={selectedItem}
120
+ onChange={setSelectedItem}
121
+ options={dataOptions}
122
+ filterOption={false}
123
+ loading={loading}
124
+ notFoundContent={loading ? <Spin size="small" /> : null}
125
+ />
126
+ </section>
127
+ )}
128
+ <section>
129
+ <MineSiteDetails
130
+ locationData={hasSelect ? singleItemData : data}
131
+ loading={loadingData}
132
+ t={t}
133
+ options={options}
134
+ />
135
+ <LocationMap
136
+ selectedPartners={selectedPartners}
137
+ t={t}
138
+ params={params}
139
+ locationData={hasSelect ? singleItemData : data}
140
+ loading={loadingData}
141
+ />
142
+ </section>
143
+ <section>
144
+ <InformationAvailability
145
+ selectedPartners={selectedPartners}
146
+ t={t}
147
+ id={params?.id || selectedItem}
148
+ />
149
+ </section>
150
+ <section>
151
+ <StakeholderMapping
152
+ selectedPartners={selectedPartners}
153
+ t={t}
154
+ id={params?.id || selectedItem}
155
+ locationData={hasSelect ? singleItemData : data}
156
+ />
157
+ </section>
158
+ </DashboardLayout>
159
+ )
160
+ }
161
+
162
+ export default MineSummary