datastake-daf 0.6.784 → 0.6.786
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.
- package/dist/components/index.js +71 -74
- package/dist/hooks/index.js +9 -1
- package/dist/pages/index.js +892 -103
- package/dist/utils/index.js +58 -0
- package/package.json +1 -1
- package/src/@daf/core/components/Dashboard/Map/hook.js +1 -1
- package/src/@daf/hooks/useGetQueryParams.js +3 -1
- package/src/@daf/pages/Events/Activities/columns.js +2 -2
- package/src/@daf/pages/Events/Activities/config.js +2 -2
- package/src/@daf/pages/Events/Incidents/columns.js +2 -2
- package/src/@daf/pages/Events/Incidents/config.js +2 -2
- package/src/@daf/pages/Locations/MineSite/columns.js +2 -2
- package/src/@daf/pages/Locations/columns.js +2 -2
- package/src/@daf/pages/Stakeholders/Operators/columns.js +2 -2
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/KeyInformation/index.jsx +48 -0
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/MangroveGrowth/PlantedSpecies.jsx +73 -0
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/MangroveGrowth/SeedlingsHeight.jsx +44 -0
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/MangroveGrowth/Stats.jsx +86 -0
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/MangroveGrowth/VegetationHealth.jsx +73 -0
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/MangroveGrowth/index.jsx +92 -0
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/components/MonitoringScopeAndFindings/index.jsx +348 -0
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/config.js +35 -0
- package/src/@daf/pages/Summary/Activities/MonitoringCampaign/index.jsx +30 -0
- package/src/@daf/pages/Summary/Activities/PlantingCycle/components/CommunityParticipation/CommunityStats/helper.js +1 -1
- package/src/@daf/pages/Summary/Activities/PlantingCycle/components/CycleIndicators/index.jsx +1 -1
- package/src/@daf/pages/Summary/Activities/PlantingCycle/components/CycleOutcomes/index.jsx +1 -1
- package/src/@daf/pages/Summary/Activities/PlantingCycle/helper.js +0 -56
- package/src/@daf/utils/numbers.js +57 -0
- package/src/pages.js +1 -0
- package/src/utils.js +1 -1
package/dist/pages/index.js
CHANGED
|
@@ -9963,7 +9963,7 @@ const useMap = ({
|
|
|
9963
9963
|
});
|
|
9964
9964
|
function handleSelectMarker(clickedMarker) {
|
|
9965
9965
|
setSelectedMarkersId(prev => {
|
|
9966
|
-
if (
|
|
9966
|
+
if (openPopupIdRef.current === clickedMarker.datastakeId) {
|
|
9967
9967
|
// Deselecting - clear polylines
|
|
9968
9968
|
openPopupIdRef.current = null;
|
|
9969
9969
|
setMarkerWithPopup(null);
|
|
@@ -15380,7 +15380,7 @@ const getColumns$d = ({
|
|
|
15380
15380
|
}
|
|
15381
15381
|
}, {
|
|
15382
15382
|
dataIndex: 'province',
|
|
15383
|
-
title: t(
|
|
15383
|
+
title: findOptions(user?.company?.country, options?.administrativeLevel1) || t("Province"),
|
|
15384
15384
|
ellipsis: true,
|
|
15385
15385
|
show: true,
|
|
15386
15386
|
render: (v, all) => {
|
|
@@ -15397,7 +15397,7 @@ const getColumns$d = ({
|
|
|
15397
15397
|
}
|
|
15398
15398
|
}, {
|
|
15399
15399
|
dataIndex: 'territory',
|
|
15400
|
-
title: t(
|
|
15400
|
+
title: findOptions(user?.company?.country, options?.administrativeLevel2) || t("Territory"),
|
|
15401
15401
|
ellipsis: true,
|
|
15402
15402
|
show: true,
|
|
15403
15403
|
render: (v, all) => {
|
|
@@ -30172,6 +30172,8 @@ const useGetQueryParams = ({
|
|
|
30172
30172
|
searchParams: rawSearchParams,
|
|
30173
30173
|
sortBy,
|
|
30174
30174
|
sortDir,
|
|
30175
|
+
status,
|
|
30176
|
+
product,
|
|
30175
30177
|
...rest
|
|
30176
30178
|
} = queryParams;
|
|
30177
30179
|
return {
|
|
@@ -30184,7 +30186,13 @@ const useGetQueryParams = ({
|
|
|
30184
30186
|
fields: safeJsonParse(rawSearchParams)
|
|
30185
30187
|
},
|
|
30186
30188
|
otherParams: {
|
|
30187
|
-
...rest
|
|
30189
|
+
...rest,
|
|
30190
|
+
...(product && {
|
|
30191
|
+
"products.typeOfProduct": product
|
|
30192
|
+
}),
|
|
30193
|
+
...(status && {
|
|
30194
|
+
published: status === "submitted" ? true : false
|
|
30195
|
+
})
|
|
30188
30196
|
},
|
|
30189
30197
|
sortBy,
|
|
30190
30198
|
sortDir
|
|
@@ -31654,7 +31662,7 @@ const getFiltersConfig$6 = ({
|
|
|
31654
31662
|
flex: 1
|
|
31655
31663
|
}
|
|
31656
31664
|
},
|
|
31657
|
-
|
|
31665
|
+
eventCategory: {
|
|
31658
31666
|
type: 'select',
|
|
31659
31667
|
label: 'Category',
|
|
31660
31668
|
placeholder: () => `${t('Filter by')} ${t('Category').toLowerCase()}`,
|
|
@@ -31747,7 +31755,7 @@ const getFilterOptions$6 = (options, t) => {
|
|
|
31747
31755
|
value: "private",
|
|
31748
31756
|
label: t("Private")
|
|
31749
31757
|
}],
|
|
31750
|
-
|
|
31758
|
+
eventCategory: _categoryOptions,
|
|
31751
31759
|
country: countries,
|
|
31752
31760
|
subCategory: subCategoriesOptions,
|
|
31753
31761
|
// category: category,
|
|
@@ -31863,7 +31871,7 @@ const getColumns$9 = ({
|
|
|
31863
31871
|
}
|
|
31864
31872
|
}, {
|
|
31865
31873
|
dataIndex: 'province',
|
|
31866
|
-
title: t(
|
|
31874
|
+
title: findOptions(user?.company?.country, options?.administrativeLevel1) || t("Province"),
|
|
31867
31875
|
ellipsis: true,
|
|
31868
31876
|
show: true,
|
|
31869
31877
|
render: (v, all) => {
|
|
@@ -31880,7 +31888,7 @@ const getColumns$9 = ({
|
|
|
31880
31888
|
}
|
|
31881
31889
|
}, {
|
|
31882
31890
|
dataIndex: 'territory',
|
|
31883
|
-
title: t(
|
|
31891
|
+
title: findOptions(user?.company?.country, options?.administrativeLevel2) || t("Territory"),
|
|
31884
31892
|
ellipsis: true,
|
|
31885
31893
|
show: true,
|
|
31886
31894
|
render: (v, all) => {
|
|
@@ -32098,7 +32106,7 @@ const getFiltersConfig$5 = ({
|
|
|
32098
32106
|
flex: 1
|
|
32099
32107
|
}
|
|
32100
32108
|
},
|
|
32101
|
-
|
|
32109
|
+
eventCategory: {
|
|
32102
32110
|
type: 'select',
|
|
32103
32111
|
label: 'Category',
|
|
32104
32112
|
placeholder: t => `${t('Filter by')} ${t('Category').toLowerCase()}`,
|
|
@@ -32191,7 +32199,7 @@ const getFilterOptions$5 = (options, t) => {
|
|
|
32191
32199
|
value: "private",
|
|
32192
32200
|
label: t("Private")
|
|
32193
32201
|
}],
|
|
32194
|
-
|
|
32202
|
+
eventCategory: _categoryOptions,
|
|
32195
32203
|
country: countries,
|
|
32196
32204
|
subCategory: subCategoriesOptions,
|
|
32197
32205
|
// category: category,
|
|
@@ -32298,7 +32306,7 @@ const getColumns$8 = ({
|
|
|
32298
32306
|
}
|
|
32299
32307
|
}, {
|
|
32300
32308
|
dataIndex: 'province',
|
|
32301
|
-
title: t(
|
|
32309
|
+
title: findOptions(user?.company?.country, options?.administrativeLevel1) || t("Province"),
|
|
32302
32310
|
ellipsis: true,
|
|
32303
32311
|
show: true,
|
|
32304
32312
|
render: (v, all) => {
|
|
@@ -32315,7 +32323,7 @@ const getColumns$8 = ({
|
|
|
32315
32323
|
}
|
|
32316
32324
|
}, {
|
|
32317
32325
|
dataIndex: 'territory',
|
|
32318
|
-
title: t(
|
|
32326
|
+
title: findOptions(user?.company?.country, options?.administrativeLevel2) || t("Territory"),
|
|
32319
32327
|
ellipsis: true,
|
|
32320
32328
|
show: true,
|
|
32321
32329
|
render: (v, all) => {
|
|
@@ -32554,7 +32562,7 @@ const getColumns$7 = ({
|
|
|
32554
32562
|
}
|
|
32555
32563
|
}, {
|
|
32556
32564
|
dataIndex: 'province',
|
|
32557
|
-
title: t(
|
|
32565
|
+
title: findOptions(user?.company?.country, options?.administrativeLevel1) || t("Province"),
|
|
32558
32566
|
ellipsis: true,
|
|
32559
32567
|
show: true,
|
|
32560
32568
|
render: (v, all) => {
|
|
@@ -32571,7 +32579,7 @@ const getColumns$7 = ({
|
|
|
32571
32579
|
}
|
|
32572
32580
|
}, {
|
|
32573
32581
|
dataIndex: 'territory',
|
|
32574
|
-
title: t(
|
|
32582
|
+
title: findOptions(user?.company?.country, options?.administrativeLevel2) || t("Territory"),
|
|
32575
32583
|
ellipsis: true,
|
|
32576
32584
|
show: true,
|
|
32577
32585
|
render: (v, all) => {
|
|
@@ -32931,7 +32939,7 @@ const getColumns$6 = ({
|
|
|
32931
32939
|
}
|
|
32932
32940
|
}, {
|
|
32933
32941
|
dataIndex: 'region',
|
|
32934
|
-
title: t(
|
|
32942
|
+
title: findOptions(user?.company?.country, options?.administrativeLevel1) || t("Province"),
|
|
32935
32943
|
ellipsis: true,
|
|
32936
32944
|
show: true,
|
|
32937
32945
|
render: (v, all) => {
|
|
@@ -32948,7 +32956,7 @@ const getColumns$6 = ({
|
|
|
32948
32956
|
}
|
|
32949
32957
|
}, {
|
|
32950
32958
|
dataIndex: 'territory',
|
|
32951
|
-
title: t(
|
|
32959
|
+
title: findOptions(user?.company?.country, options?.administrativeLevel2) || t("Territory"),
|
|
32952
32960
|
ellipsis: true,
|
|
32953
32961
|
show: true,
|
|
32954
32962
|
render: (v, all) => {
|
|
@@ -36289,7 +36297,7 @@ const getKeyIndicatorConfig = ({
|
|
|
36289
36297
|
}
|
|
36290
36298
|
}];
|
|
36291
36299
|
|
|
36292
|
-
const KeyInformation$
|
|
36300
|
+
const KeyInformation$2 = ({
|
|
36293
36301
|
options = {},
|
|
36294
36302
|
selectedPartners = {},
|
|
36295
36303
|
t = () => {},
|
|
@@ -38001,7 +38009,7 @@ const OperatorSummary = ({
|
|
|
38001
38009
|
size: "small"
|
|
38002
38010
|
}) : null
|
|
38003
38011
|
})
|
|
38004
|
-
}), /*#__PURE__*/jsxRuntime.jsx(KeyInformation$
|
|
38012
|
+
}), /*#__PURE__*/jsxRuntime.jsx(KeyInformation$2, {
|
|
38005
38013
|
options: options,
|
|
38006
38014
|
selectedPartners: selectedPartners,
|
|
38007
38015
|
t: t,
|
|
@@ -42120,6 +42128,63 @@ const renderNumber = (val, doubleDigit = false) => {
|
|
|
42120
42128
|
return _string;
|
|
42121
42129
|
};
|
|
42122
42130
|
|
|
42131
|
+
/**
|
|
42132
|
+
* Calculates stat change object for StatCard component based on current and previous values
|
|
42133
|
+
* @param {Object} data - Object with current and previous values
|
|
42134
|
+
* @param {number} data.current - Current value
|
|
42135
|
+
* @param {number} data.previous - Previous value
|
|
42136
|
+
* @param {Object} options - Optional configuration
|
|
42137
|
+
* @param {string} options.tooltipText - Custom tooltip text
|
|
42138
|
+
* @param {string} options.format - Format type: 'percentage' (default) or 'absolute'
|
|
42139
|
+
* @param {number} options.decimalPlaces - Number of decimal places for percentage (default: 1)
|
|
42140
|
+
* @returns {Object|null} Change object for StatCard or null if data is invalid
|
|
42141
|
+
*/
|
|
42142
|
+
const calculateStatChange = (data, options = {}) => {
|
|
42143
|
+
if (!data || typeof data !== 'object') {
|
|
42144
|
+
return null;
|
|
42145
|
+
}
|
|
42146
|
+
const {
|
|
42147
|
+
current,
|
|
42148
|
+
previous
|
|
42149
|
+
} = data;
|
|
42150
|
+
|
|
42151
|
+
// Validate that both values are numbers
|
|
42152
|
+
if (typeof current !== 'number' || typeof previous !== 'number') {
|
|
42153
|
+
return null;
|
|
42154
|
+
}
|
|
42155
|
+
|
|
42156
|
+
// If previous is 0, we can't calculate percentage change
|
|
42157
|
+
if (previous === 0) {
|
|
42158
|
+
return null;
|
|
42159
|
+
}
|
|
42160
|
+
const {
|
|
42161
|
+
tooltipText,
|
|
42162
|
+
format = 'percentage',
|
|
42163
|
+
decimalPlaces = 1
|
|
42164
|
+
} = options;
|
|
42165
|
+
|
|
42166
|
+
// Calculate the difference
|
|
42167
|
+
const difference = current - previous;
|
|
42168
|
+
const isPositive = difference >= 0;
|
|
42169
|
+
const direction = isPositive ? 'up' : 'down';
|
|
42170
|
+
|
|
42171
|
+
// Format the value
|
|
42172
|
+
let value;
|
|
42173
|
+
if (format === 'absolute') {
|
|
42174
|
+
// Show absolute difference
|
|
42175
|
+
value = Math.abs(difference).toLocaleString();
|
|
42176
|
+
} else {
|
|
42177
|
+
// Show percentage change
|
|
42178
|
+
const percentageChange = Math.abs(difference) / previous * 100;
|
|
42179
|
+
value = `${percentageChange.toFixed(decimalPlaces)}%`;
|
|
42180
|
+
}
|
|
42181
|
+
return {
|
|
42182
|
+
value,
|
|
42183
|
+
direction,
|
|
42184
|
+
tooltipText: tooltipText || undefined
|
|
42185
|
+
};
|
|
42186
|
+
};
|
|
42187
|
+
|
|
42123
42188
|
styled__default["default"].div`
|
|
42124
42189
|
height: 333px;
|
|
42125
42190
|
width: calc(100% - 48px);
|
|
@@ -43274,7 +43339,7 @@ styled__default["default"].div`
|
|
|
43274
43339
|
flex: 1;
|
|
43275
43340
|
`;
|
|
43276
43341
|
|
|
43277
|
-
const getKeyIndicatorsRowConfig$
|
|
43342
|
+
const getKeyIndicatorsRowConfig$2 = ({
|
|
43278
43343
|
t,
|
|
43279
43344
|
data = {}
|
|
43280
43345
|
}) => [{
|
|
@@ -43933,7 +43998,7 @@ const RestorationActivitySummary = ({
|
|
|
43933
43998
|
loading,
|
|
43934
43999
|
t = () => {}
|
|
43935
44000
|
}) => {
|
|
43936
|
-
const keyIndicatorsConfig = React.useMemo(() => getKeyIndicatorsRowConfig$
|
|
44001
|
+
const keyIndicatorsConfig = React.useMemo(() => getKeyIndicatorsRowConfig$2({
|
|
43937
44002
|
t,
|
|
43938
44003
|
data: activityData
|
|
43939
44004
|
}), [t, activityData]);
|
|
@@ -44143,63 +44208,6 @@ const PlantingLocations = ({
|
|
|
44143
44208
|
});
|
|
44144
44209
|
};
|
|
44145
44210
|
|
|
44146
|
-
/**
|
|
44147
|
-
* Calculates stat change object for StatCard component based on current and previous values
|
|
44148
|
-
* @param {Object} data - Object with current and previous values
|
|
44149
|
-
* @param {number} data.current - Current value
|
|
44150
|
-
* @param {number} data.previous - Previous value
|
|
44151
|
-
* @param {Object} options - Optional configuration
|
|
44152
|
-
* @param {string} options.tooltipText - Custom tooltip text
|
|
44153
|
-
* @param {string} options.format - Format type: 'percentage' (default) or 'absolute'
|
|
44154
|
-
* @param {number} options.decimalPlaces - Number of decimal places for percentage (default: 1)
|
|
44155
|
-
* @returns {Object|null} Change object for StatCard or null if data is invalid
|
|
44156
|
-
*/
|
|
44157
|
-
const calculateStatChange = (data, options = {}) => {
|
|
44158
|
-
if (!data || typeof data !== 'object') {
|
|
44159
|
-
return null;
|
|
44160
|
-
}
|
|
44161
|
-
const {
|
|
44162
|
-
current,
|
|
44163
|
-
previous
|
|
44164
|
-
} = data;
|
|
44165
|
-
|
|
44166
|
-
// Validate that both values are numbers
|
|
44167
|
-
if (typeof current !== 'number' || typeof previous !== 'number') {
|
|
44168
|
-
return null;
|
|
44169
|
-
}
|
|
44170
|
-
|
|
44171
|
-
// If previous is 0, we can't calculate percentage change
|
|
44172
|
-
if (previous === 0) {
|
|
44173
|
-
return null;
|
|
44174
|
-
}
|
|
44175
|
-
const {
|
|
44176
|
-
tooltipText,
|
|
44177
|
-
format = 'percentage',
|
|
44178
|
-
decimalPlaces = 1
|
|
44179
|
-
} = options;
|
|
44180
|
-
|
|
44181
|
-
// Calculate the difference
|
|
44182
|
-
const difference = current - previous;
|
|
44183
|
-
const isPositive = difference >= 0;
|
|
44184
|
-
const direction = isPositive ? 'up' : 'down';
|
|
44185
|
-
|
|
44186
|
-
// Format the value
|
|
44187
|
-
let value;
|
|
44188
|
-
if (format === 'absolute') {
|
|
44189
|
-
// Show absolute difference
|
|
44190
|
-
value = Math.abs(difference).toLocaleString();
|
|
44191
|
-
} else {
|
|
44192
|
-
// Show percentage change
|
|
44193
|
-
const percentageChange = Math.abs(difference) / previous * 100;
|
|
44194
|
-
value = `${percentageChange.toFixed(decimalPlaces)}%`;
|
|
44195
|
-
}
|
|
44196
|
-
return {
|
|
44197
|
-
value,
|
|
44198
|
-
direction,
|
|
44199
|
-
tooltipText: tooltipText || undefined
|
|
44200
|
-
};
|
|
44201
|
-
};
|
|
44202
|
-
|
|
44203
44211
|
/**
|
|
44204
44212
|
* Formats a date based on the time filter
|
|
44205
44213
|
* @param {dayjs.Dayjs} date - The date to format
|
|
@@ -46557,6 +46565,152 @@ const AssociatedInformation = ({
|
|
|
46557
46565
|
});
|
|
46558
46566
|
};
|
|
46559
46567
|
|
|
46568
|
+
const getKeyIndicatorsRowConfig$1 = ({
|
|
46569
|
+
t,
|
|
46570
|
+
data = {}
|
|
46571
|
+
}) => [{
|
|
46572
|
+
label: t('Region'),
|
|
46573
|
+
render: () => {
|
|
46574
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
46575
|
+
children: data?.region || '-'
|
|
46576
|
+
});
|
|
46577
|
+
}
|
|
46578
|
+
}, {
|
|
46579
|
+
label: t('Associated Plots'),
|
|
46580
|
+
render: () => {
|
|
46581
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
46582
|
+
children: data?.associatedPlotsCount || '0'
|
|
46583
|
+
});
|
|
46584
|
+
}
|
|
46585
|
+
}, {
|
|
46586
|
+
label: t('Implementation Partners'),
|
|
46587
|
+
render: () => {
|
|
46588
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
46589
|
+
children: data?.partnersCount || '0'
|
|
46590
|
+
});
|
|
46591
|
+
}
|
|
46592
|
+
}, {
|
|
46593
|
+
label: t('Total Activities'),
|
|
46594
|
+
render: () => {
|
|
46595
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
46596
|
+
children: data?.activitiesCount || '0'
|
|
46597
|
+
});
|
|
46598
|
+
}
|
|
46599
|
+
}, {
|
|
46600
|
+
label: t('Information Sources'),
|
|
46601
|
+
render: () => {
|
|
46602
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
46603
|
+
children: data?.informationSourcesCount || '0'
|
|
46604
|
+
});
|
|
46605
|
+
}
|
|
46606
|
+
}];
|
|
46607
|
+
|
|
46608
|
+
const KeyInformation$1 = ({
|
|
46609
|
+
id,
|
|
46610
|
+
t = () => {},
|
|
46611
|
+
getSummaryDetail,
|
|
46612
|
+
loading = false
|
|
46613
|
+
}) => {
|
|
46614
|
+
const defaultConfig = React.useMemo(() => ({
|
|
46615
|
+
basepath: "planting-cycle",
|
|
46616
|
+
url: `/summary/${id}/key-information`,
|
|
46617
|
+
stop: !id
|
|
46618
|
+
}), [id]);
|
|
46619
|
+
const customGetData = React.useMemo(() => {
|
|
46620
|
+
if (getSummaryDetail && id) {
|
|
46621
|
+
return ({
|
|
46622
|
+
url,
|
|
46623
|
+
params = {}
|
|
46624
|
+
}) => {
|
|
46625
|
+
const match = url.match(/\/summary\/[^/]+\/(.+)/);
|
|
46626
|
+
if (match) {
|
|
46627
|
+
const [, type] = match;
|
|
46628
|
+
return getSummaryDetail(id, type, params);
|
|
46629
|
+
}
|
|
46630
|
+
throw new Error(`Invalid URL format: ${url}`);
|
|
46631
|
+
};
|
|
46632
|
+
}
|
|
46633
|
+
return undefined;
|
|
46634
|
+
}, [getSummaryDetail, id]);
|
|
46635
|
+
const {
|
|
46636
|
+
loading: keyInformationLoading,
|
|
46637
|
+
data: keyInformationData
|
|
46638
|
+
} = useWidgetFetch({
|
|
46639
|
+
config: defaultConfig,
|
|
46640
|
+
getData: customGetData
|
|
46641
|
+
});
|
|
46642
|
+
const keyIndicatorsConfig = React.useMemo(() => getKeyIndicatorsRowConfig$1({
|
|
46643
|
+
t,
|
|
46644
|
+
data: keyInformationData
|
|
46645
|
+
}), [t, keyInformationData]);
|
|
46646
|
+
return /*#__PURE__*/jsxRuntime.jsx("section", {
|
|
46647
|
+
children: /*#__PURE__*/jsxRuntime.jsx(KeyIndicatorsWidget, {
|
|
46648
|
+
title: t("Key Information"),
|
|
46649
|
+
config: keyIndicatorsConfig,
|
|
46650
|
+
loading: loading || keyInformationLoading
|
|
46651
|
+
})
|
|
46652
|
+
});
|
|
46653
|
+
};
|
|
46654
|
+
|
|
46655
|
+
const PlantingCycleSummary = ({
|
|
46656
|
+
header,
|
|
46657
|
+
activityData,
|
|
46658
|
+
loading = false,
|
|
46659
|
+
id,
|
|
46660
|
+
projectId,
|
|
46661
|
+
t = () => {},
|
|
46662
|
+
getSummaryDetail,
|
|
46663
|
+
navigate,
|
|
46664
|
+
selectOptions
|
|
46665
|
+
}) => {
|
|
46666
|
+
return /*#__PURE__*/jsxRuntime.jsxs(DashboardLayout, {
|
|
46667
|
+
header: /*#__PURE__*/jsxRuntime.jsx(DAFHeader, {
|
|
46668
|
+
title: header?.title + ' Summary' || '',
|
|
46669
|
+
supportText: header?.supportText || '',
|
|
46670
|
+
onDownload: header?.onDownload,
|
|
46671
|
+
downloadDisabled: header?.downloadDisabled,
|
|
46672
|
+
actionButtons: header?.actionButtons,
|
|
46673
|
+
breadcrumbs: header?.breadcrumbs,
|
|
46674
|
+
goBackTo: header?.goBackTo,
|
|
46675
|
+
loading: header?.loading
|
|
46676
|
+
}),
|
|
46677
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(KeyInformation$1, {
|
|
46678
|
+
id: id,
|
|
46679
|
+
t: t,
|
|
46680
|
+
getSummaryDetail: getSummaryDetail,
|
|
46681
|
+
loading: loading
|
|
46682
|
+
}), /*#__PURE__*/jsxRuntime.jsx(PlantingLocations, {
|
|
46683
|
+
id: id,
|
|
46684
|
+
getSummaryDetail: getSummaryDetail,
|
|
46685
|
+
loading: loading,
|
|
46686
|
+
t: t
|
|
46687
|
+
}), /*#__PURE__*/jsxRuntime.jsx(CycleOutcomes, {
|
|
46688
|
+
id: id,
|
|
46689
|
+
getSummaryDetail: getSummaryDetail,
|
|
46690
|
+
loading: loading,
|
|
46691
|
+
t: t
|
|
46692
|
+
}), /*#__PURE__*/jsxRuntime.jsx(CycleIndicators, {
|
|
46693
|
+
id: id,
|
|
46694
|
+
getSummaryDetail: getSummaryDetail,
|
|
46695
|
+
loading: loading,
|
|
46696
|
+
t: t
|
|
46697
|
+
}), /*#__PURE__*/jsxRuntime.jsx(CommunityParticipation, {
|
|
46698
|
+
id: id,
|
|
46699
|
+
getSummaryDetail: getSummaryDetail,
|
|
46700
|
+
loading: loading,
|
|
46701
|
+
t: t
|
|
46702
|
+
}), /*#__PURE__*/jsxRuntime.jsx(AssociatedInformation, {
|
|
46703
|
+
id: id,
|
|
46704
|
+
projectId: projectId,
|
|
46705
|
+
getSummaryDetail: getSummaryDetail,
|
|
46706
|
+
loading: loading,
|
|
46707
|
+
t: t,
|
|
46708
|
+
navigate: navigate,
|
|
46709
|
+
selectOptions: selectOptions
|
|
46710
|
+
})]
|
|
46711
|
+
});
|
|
46712
|
+
};
|
|
46713
|
+
|
|
46560
46714
|
const getKeyIndicatorsRowConfig = ({
|
|
46561
46715
|
t,
|
|
46562
46716
|
data = {}
|
|
@@ -46604,7 +46758,7 @@ const KeyInformation = ({
|
|
|
46604
46758
|
loading = false
|
|
46605
46759
|
}) => {
|
|
46606
46760
|
const defaultConfig = React.useMemo(() => ({
|
|
46607
|
-
basepath: "
|
|
46761
|
+
basepath: "events/monitoring-campaign",
|
|
46608
46762
|
url: `/summary/${id}/key-information`,
|
|
46609
46763
|
stop: !id
|
|
46610
46764
|
}), [id]);
|
|
@@ -46644,7 +46798,659 @@ const KeyInformation = ({
|
|
|
46644
46798
|
});
|
|
46645
46799
|
};
|
|
46646
46800
|
|
|
46647
|
-
const
|
|
46801
|
+
const VISITS_TAB = "visits";
|
|
46802
|
+
const GROWTH_AND_SURVIVAL_TAB = "growthAndSurvival";
|
|
46803
|
+
const FAUNA_SIGHTINGS_TAB = "faunaSightings";
|
|
46804
|
+
const INVASIVE_SPECIES_TAB = "invasiveSpecies";
|
|
46805
|
+
const SYMPTOM_HOTSPOTS_TAB = "symptomHotspots";
|
|
46806
|
+
const SOIL_TAB = "soil";
|
|
46807
|
+
const MonitoringScopeAndFindings = ({
|
|
46808
|
+
id,
|
|
46809
|
+
getSummaryDetail,
|
|
46810
|
+
loading = false,
|
|
46811
|
+
t = s => s
|
|
46812
|
+
}) => {
|
|
46813
|
+
const [activeTab, setActiveTab] = React.useState(VISITS_TAB);
|
|
46814
|
+
const defaultConfig = React.useMemo(() => ({
|
|
46815
|
+
basepath: "events/monitoring-campaign",
|
|
46816
|
+
url: `/summary/${id}/monitoring-scope`,
|
|
46817
|
+
stop: !id
|
|
46818
|
+
}), [id]);
|
|
46819
|
+
const customGetData = React.useMemo(() => {
|
|
46820
|
+
if (getSummaryDetail && id) {
|
|
46821
|
+
return ({
|
|
46822
|
+
url,
|
|
46823
|
+
params = {}
|
|
46824
|
+
}) => {
|
|
46825
|
+
const match = url.match(/\/summary\/[^/]+\/(.+)/);
|
|
46826
|
+
if (match) {
|
|
46827
|
+
const [, type] = match;
|
|
46828
|
+
return getSummaryDetail(id, type, {
|
|
46829
|
+
...params,
|
|
46830
|
+
tab: activeTab
|
|
46831
|
+
});
|
|
46832
|
+
}
|
|
46833
|
+
throw new Error(`Invalid URL format: ${url}`);
|
|
46834
|
+
};
|
|
46835
|
+
}
|
|
46836
|
+
return undefined;
|
|
46837
|
+
}, [getSummaryDetail, id, activeTab]);
|
|
46838
|
+
const {
|
|
46839
|
+
loading: monitoringScopeLoading,
|
|
46840
|
+
data: monitoringScopeData
|
|
46841
|
+
} = useWidgetFetch({
|
|
46842
|
+
config: defaultConfig,
|
|
46843
|
+
getData: customGetData
|
|
46844
|
+
});
|
|
46845
|
+
const filtersConfig = React.useMemo(() => {
|
|
46846
|
+
switch (activeTab) {
|
|
46847
|
+
case GROWTH_AND_SURVIVAL_TAB:
|
|
46848
|
+
return [{
|
|
46849
|
+
label: t("Mangrove Survival Rate"),
|
|
46850
|
+
placeholder: t("Select"),
|
|
46851
|
+
key: "mangroveSurvivalRate",
|
|
46852
|
+
type: "slider"
|
|
46853
|
+
}, {
|
|
46854
|
+
label: t("Planting Density"),
|
|
46855
|
+
placeholder: t("Select"),
|
|
46856
|
+
key: "plantingDensity",
|
|
46857
|
+
type: "select"
|
|
46858
|
+
}];
|
|
46859
|
+
case FAUNA_SIGHTINGS_TAB:
|
|
46860
|
+
return [{
|
|
46861
|
+
label: t("Fauna Observed"),
|
|
46862
|
+
placeholder: t("Select"),
|
|
46863
|
+
key: "faunaSightings",
|
|
46864
|
+
type: "select",
|
|
46865
|
+
options: [{
|
|
46866
|
+
label: t("Birds"),
|
|
46867
|
+
value: "birds"
|
|
46868
|
+
}, {
|
|
46869
|
+
label: t("Crabs"),
|
|
46870
|
+
value: "crabs"
|
|
46871
|
+
}, {
|
|
46872
|
+
label: t("Fish"),
|
|
46873
|
+
value: "fish"
|
|
46874
|
+
}, {
|
|
46875
|
+
label: t("Molluscs"),
|
|
46876
|
+
value: "molluscs"
|
|
46877
|
+
}, {
|
|
46878
|
+
label: t("Oysters"),
|
|
46879
|
+
value: "oysters"
|
|
46880
|
+
}]
|
|
46881
|
+
}];
|
|
46882
|
+
case INVASIVE_SPECIES_TAB:
|
|
46883
|
+
return [{
|
|
46884
|
+
label: t("Fauna Observed"),
|
|
46885
|
+
placeholder: t("Select"),
|
|
46886
|
+
key: "invasiveSpecies",
|
|
46887
|
+
type: "select",
|
|
46888
|
+
options: [{
|
|
46889
|
+
label: t("Spiders"),
|
|
46890
|
+
value: "spiders"
|
|
46891
|
+
}, {
|
|
46892
|
+
label: t("Scale insects"),
|
|
46893
|
+
value: "scaleInsects"
|
|
46894
|
+
}, {
|
|
46895
|
+
label: t("Caterpillars"),
|
|
46896
|
+
value: "caterpillars"
|
|
46897
|
+
}, {
|
|
46898
|
+
label: t("Unidentified pests"),
|
|
46899
|
+
value: "unidentifiedPests"
|
|
46900
|
+
}, {
|
|
46901
|
+
label: t("Other"),
|
|
46902
|
+
value: "other"
|
|
46903
|
+
}]
|
|
46904
|
+
}];
|
|
46905
|
+
case SYMPTOM_HOTSPOTS_TAB:
|
|
46906
|
+
return [{
|
|
46907
|
+
label: t("Symptom Hotspots"),
|
|
46908
|
+
placeholder: t("Select"),
|
|
46909
|
+
key: "symptomHotspots",
|
|
46910
|
+
type: "select",
|
|
46911
|
+
options: [{
|
|
46912
|
+
label: t("Reddish spots on leaves"),
|
|
46913
|
+
value: "reddishSpotsOnLeaves"
|
|
46914
|
+
}, {
|
|
46915
|
+
label: t("Black spots on leaves"),
|
|
46916
|
+
value: "blackSpotsOnLeaves"
|
|
46917
|
+
}, {
|
|
46918
|
+
label: t("Yellowing of leaves"),
|
|
46919
|
+
value: "yellowingOfLeaves"
|
|
46920
|
+
}, {
|
|
46921
|
+
label: t("Presence of mosaic"),
|
|
46922
|
+
value: "presenceOfMosaic"
|
|
46923
|
+
}]
|
|
46924
|
+
}];
|
|
46925
|
+
case SOIL_TAB:
|
|
46926
|
+
return [{
|
|
46927
|
+
label: t("Soil"),
|
|
46928
|
+
placeholder: t("Select"),
|
|
46929
|
+
key: "soil",
|
|
46930
|
+
type: "select",
|
|
46931
|
+
options: [{
|
|
46932
|
+
label: t("Sandy"),
|
|
46933
|
+
value: "sandy"
|
|
46934
|
+
}, {
|
|
46935
|
+
label: t("Clay"),
|
|
46936
|
+
value: "clay"
|
|
46937
|
+
}, {
|
|
46938
|
+
label: t("Muddy"),
|
|
46939
|
+
value: "muddy"
|
|
46940
|
+
}, {
|
|
46941
|
+
label: t("Loamy"),
|
|
46942
|
+
value: "loamy"
|
|
46943
|
+
}, {
|
|
46944
|
+
label: t("Mixed"),
|
|
46945
|
+
value: "mixed"
|
|
46946
|
+
}]
|
|
46947
|
+
}];
|
|
46948
|
+
default:
|
|
46949
|
+
return [];
|
|
46950
|
+
}
|
|
46951
|
+
}, [activeTab, t]);
|
|
46952
|
+
const mappedData = React.useMemo(() => {
|
|
46953
|
+
if (!monitoringScopeData || !monitoringScopeData.plots) {
|
|
46954
|
+
return [];
|
|
46955
|
+
}
|
|
46956
|
+
const {
|
|
46957
|
+
plots = [],
|
|
46958
|
+
monitoringActivities = []
|
|
46959
|
+
} = monitoringScopeData;
|
|
46960
|
+
if (activeTab === VISITS_TAB) {
|
|
46961
|
+
return plots.map((plot, index) => {
|
|
46962
|
+
const area = plot?.perimeter ? plot.perimeter.map(coord => Array.isArray(coord) && coord.length >= 2 ? [coord[1], coord[0]] : coord) : null;
|
|
46963
|
+
const validArea = area && Array.isArray(area) && area.length >= 3 ? area : null;
|
|
46964
|
+
const matchingActivity = monitoringActivities?.find(activity => activity.plotId === plot.id || activity.plotId === plot._id);
|
|
46965
|
+
const gps = matchingActivity?.locationCheckArrival ? {
|
|
46966
|
+
latitude: matchingActivity.locationCheckArrival.latitude,
|
|
46967
|
+
longitude: matchingActivity.locationCheckArrival.longitude
|
|
46968
|
+
} : null;
|
|
46969
|
+
return {
|
|
46970
|
+
_id: plot._id || {},
|
|
46971
|
+
area: validArea,
|
|
46972
|
+
color: "#15FFFFB2",
|
|
46973
|
+
datastakeId: plot.datastakeId || `PLOT-${String(index + 1).padStart(9, '0')}`,
|
|
46974
|
+
gps: gps,
|
|
46975
|
+
id: plot.id || plot._id || `plot-${index}`,
|
|
46976
|
+
name: plot.name || t("Plot"),
|
|
46977
|
+
date: matchingActivity?.date,
|
|
46978
|
+
subTitle: matchingActivity?.date ? renderDateFormatted(matchingActivity.date, "DD MMM YY") : plot.name,
|
|
46979
|
+
plotName: plot.name,
|
|
46980
|
+
territoryTitle: plot.name,
|
|
46981
|
+
type: plot.type || 'Operational Plot',
|
|
46982
|
+
lastVisit: matchingActivity?.date,
|
|
46983
|
+
implementer: matchingActivity?.implementer,
|
|
46984
|
+
areaHa: plot.area
|
|
46985
|
+
};
|
|
46986
|
+
});
|
|
46987
|
+
}
|
|
46988
|
+
return plots.map((plot, index) => {
|
|
46989
|
+
const area = plot?.perimeter ? plot.perimeter.map(coord => Array.isArray(coord) && coord.length >= 2 ? [coord[1], coord[0]] : coord) : null;
|
|
46990
|
+
const validArea = area && Array.isArray(area) && area.length >= 3 ? area : null;
|
|
46991
|
+
return {
|
|
46992
|
+
_id: plot._id || {},
|
|
46993
|
+
area: validArea,
|
|
46994
|
+
color: "#15FFFFB2",
|
|
46995
|
+
datastakeId: plot.datastakeId || `PLOT-${String(index + 1).padStart(9, '0')}`,
|
|
46996
|
+
id: plot.id || plot._id || `plot-${index}`,
|
|
46997
|
+
name: plot.name || t("Plot"),
|
|
46998
|
+
plotName: plot.name,
|
|
46999
|
+
territoryTitle: plot.name,
|
|
47000
|
+
type: plot.type || 'Operational Plot'
|
|
47001
|
+
};
|
|
47002
|
+
});
|
|
47003
|
+
}, [monitoringScopeData, activeTab, t]);
|
|
47004
|
+
return /*#__PURE__*/jsxRuntime.jsx("section", {
|
|
47005
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Widget, {
|
|
47006
|
+
title: t("Monitoring Scope & Findings"),
|
|
47007
|
+
className: "v2-widget no-px no-p-body h-w-btn-header with-border-header",
|
|
47008
|
+
style: {
|
|
47009
|
+
height: '100%',
|
|
47010
|
+
display: 'flex',
|
|
47011
|
+
flexDirection: 'column'
|
|
47012
|
+
},
|
|
47013
|
+
tabsConfig: {
|
|
47014
|
+
tabs: [{
|
|
47015
|
+
label: t("Visits"),
|
|
47016
|
+
value: VISITS_TAB
|
|
47017
|
+
}, {
|
|
47018
|
+
label: t("Growth & Survival"),
|
|
47019
|
+
value: GROWTH_AND_SURVIVAL_TAB
|
|
47020
|
+
}, {
|
|
47021
|
+
label: t("Fauna Sightings"),
|
|
47022
|
+
value: FAUNA_SIGHTINGS_TAB
|
|
47023
|
+
}, {
|
|
47024
|
+
label: t("Invasive Species"),
|
|
47025
|
+
value: INVASIVE_SPECIES_TAB
|
|
47026
|
+
}, {
|
|
47027
|
+
label: t("Symptom Hotspots"),
|
|
47028
|
+
value: SYMPTOM_HOTSPOTS_TAB
|
|
47029
|
+
}, {
|
|
47030
|
+
label: t("Soil"),
|
|
47031
|
+
value: SOIL_TAB
|
|
47032
|
+
}],
|
|
47033
|
+
value: activeTab,
|
|
47034
|
+
onChange: setActiveTab
|
|
47035
|
+
},
|
|
47036
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Map$1, {
|
|
47037
|
+
data: mappedData,
|
|
47038
|
+
link: false,
|
|
47039
|
+
style: {
|
|
47040
|
+
height: '100%',
|
|
47041
|
+
width: '100%'
|
|
47042
|
+
},
|
|
47043
|
+
maxZoom: 18,
|
|
47044
|
+
isSatellite: true,
|
|
47045
|
+
onClickLink: () => {},
|
|
47046
|
+
onFilterChange: () => {},
|
|
47047
|
+
primaryLink: true,
|
|
47048
|
+
showSider: false,
|
|
47049
|
+
filtersConfig: filtersConfig,
|
|
47050
|
+
renderTooltipForLocation: data => {
|
|
47051
|
+
if (activeTab === VISITS_TAB && data.gps) {
|
|
47052
|
+
const coordinates = data.gps?.latitude && data.gps?.longitude ? convertDMS(data.gps.latitude, data.gps.longitude) : null;
|
|
47053
|
+
if (!coordinates) {
|
|
47054
|
+
return [];
|
|
47055
|
+
}
|
|
47056
|
+
const iconColor = "#016C6E";
|
|
47057
|
+
const tooltipItems = [{
|
|
47058
|
+
label: t("Coordinates"),
|
|
47059
|
+
value: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
47060
|
+
style: {
|
|
47061
|
+
display: 'flex',
|
|
47062
|
+
alignItems: 'center',
|
|
47063
|
+
gap: '6px',
|
|
47064
|
+
flexWrap: 'nowrap'
|
|
47065
|
+
},
|
|
47066
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
47067
|
+
style: {
|
|
47068
|
+
display: 'flex',
|
|
47069
|
+
alignItems: 'center'
|
|
47070
|
+
},
|
|
47071
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
|
|
47072
|
+
name: "SpacingHeight",
|
|
47073
|
+
width: 14,
|
|
47074
|
+
height: 14,
|
|
47075
|
+
color: iconColor
|
|
47076
|
+
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
47077
|
+
style: {
|
|
47078
|
+
fontWeight: 600,
|
|
47079
|
+
marginLeft: '4px'
|
|
47080
|
+
},
|
|
47081
|
+
children: coordinates[0]
|
|
47082
|
+
})]
|
|
47083
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
47084
|
+
style: {
|
|
47085
|
+
display: 'flex',
|
|
47086
|
+
alignItems: 'center'
|
|
47087
|
+
},
|
|
47088
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
|
|
47089
|
+
name: "SpacingWidth",
|
|
47090
|
+
width: 14,
|
|
47091
|
+
height: 14,
|
|
47092
|
+
color: iconColor
|
|
47093
|
+
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
47094
|
+
style: {
|
|
47095
|
+
fontWeight: 600,
|
|
47096
|
+
marginLeft: '4px'
|
|
47097
|
+
},
|
|
47098
|
+
children: coordinates[1]
|
|
47099
|
+
})]
|
|
47100
|
+
})]
|
|
47101
|
+
})
|
|
47102
|
+
}];
|
|
47103
|
+
if (data.date) {
|
|
47104
|
+
tooltipItems.push({
|
|
47105
|
+
label: t("Date"),
|
|
47106
|
+
value: renderDateFormatted(data.date, "DD MMM YY")
|
|
47107
|
+
});
|
|
47108
|
+
}
|
|
47109
|
+
if (data.implementer) {
|
|
47110
|
+
tooltipItems.push({
|
|
47111
|
+
label: t("Implementer"),
|
|
47112
|
+
value: data.implementer
|
|
47113
|
+
});
|
|
47114
|
+
}
|
|
47115
|
+
return tooltipItems;
|
|
47116
|
+
}
|
|
47117
|
+
return [];
|
|
47118
|
+
},
|
|
47119
|
+
renderTooltipForTerritory: data => {
|
|
47120
|
+
const items = [{
|
|
47121
|
+
label: t("Plot Name"),
|
|
47122
|
+
value: data.plotName || data.name || "--"
|
|
47123
|
+
}];
|
|
47124
|
+
if (activeTab === VISITS_TAB && data.lastVisit) {
|
|
47125
|
+
items.push({
|
|
47126
|
+
label: t("Last visit"),
|
|
47127
|
+
value: renderDateFormatted(data.lastVisit, "DD MMM YY")
|
|
47128
|
+
});
|
|
47129
|
+
}
|
|
47130
|
+
if (activeTab === VISITS_TAB && data.areaHa) {
|
|
47131
|
+
items.push({
|
|
47132
|
+
label: t("Area"),
|
|
47133
|
+
value: `${data.areaHa} ha`
|
|
47134
|
+
});
|
|
47135
|
+
}
|
|
47136
|
+
return items;
|
|
47137
|
+
},
|
|
47138
|
+
renderTooltipTags: () => {},
|
|
47139
|
+
type: "location-territory",
|
|
47140
|
+
loading: loading || monitoringScopeLoading
|
|
47141
|
+
})
|
|
47142
|
+
})
|
|
47143
|
+
});
|
|
47144
|
+
};
|
|
47145
|
+
|
|
47146
|
+
const COLORS$1 = ['#016C6E', '#F5C2AC', '#F0A888', '#DF571E', '#C04B19', '#9B3D14', '#7A2F0F'];
|
|
47147
|
+
const VegetationHealth = ({
|
|
47148
|
+
vegetationHealthChart,
|
|
47149
|
+
t = s => s
|
|
47150
|
+
}) => {
|
|
47151
|
+
const pieData = React.useMemo(() => {
|
|
47152
|
+
const data = vegetationHealthChart || [];
|
|
47153
|
+
const total = data.reduce((sum, item) => sum + (Number(item?.value) || 0), 0);
|
|
47154
|
+
return data.map((item, index) => ({
|
|
47155
|
+
value: Number(item?.value) || 0,
|
|
47156
|
+
percent: total > 0 ? (Number(item?.value) || 0) / total : 0,
|
|
47157
|
+
color: COLORS$1[index % COLORS$1.length],
|
|
47158
|
+
label: item?.type || '',
|
|
47159
|
+
key: item?.type || `item-${index}`
|
|
47160
|
+
}));
|
|
47161
|
+
}, [vegetationHealthChart]);
|
|
47162
|
+
const isEmpty = React.useMemo(() => {
|
|
47163
|
+
return !vegetationHealthChart || vegetationHealthChart.length === 0 || vegetationHealthChart.every(item => !item?.value || Number(item.value) === 0);
|
|
47164
|
+
}, [vegetationHealthChart]);
|
|
47165
|
+
const getTooltipChildren = React.useCallback(item => {
|
|
47166
|
+
if (isEmpty) {
|
|
47167
|
+
return null;
|
|
47168
|
+
}
|
|
47169
|
+
return renderTooltipJsx({
|
|
47170
|
+
title: t("Vegetation Health"),
|
|
47171
|
+
items: [{
|
|
47172
|
+
color: item.color,
|
|
47173
|
+
label: item.label || '',
|
|
47174
|
+
value: `${item.value || 0}%`
|
|
47175
|
+
}]
|
|
47176
|
+
});
|
|
47177
|
+
}, [t, isEmpty]);
|
|
47178
|
+
return /*#__PURE__*/jsxRuntime.jsx(Widget, {
|
|
47179
|
+
title: t("Vegetation Health"),
|
|
47180
|
+
className: "with-border-header h-w-btn-header",
|
|
47181
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
47182
|
+
className: "flex flex-1 flex-column justify-content-center",
|
|
47183
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
47184
|
+
className: "flex justify-content-center w-full",
|
|
47185
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Chart, {
|
|
47186
|
+
data: pieData,
|
|
47187
|
+
isPie: true,
|
|
47188
|
+
isEmpty: isEmpty,
|
|
47189
|
+
getTooltipChildren: getTooltipChildren,
|
|
47190
|
+
mouseXOffset: 10,
|
|
47191
|
+
mouseYOffset: 10,
|
|
47192
|
+
changeOpacityOnHover: false,
|
|
47193
|
+
doConstraints: false
|
|
47194
|
+
})
|
|
47195
|
+
})
|
|
47196
|
+
})
|
|
47197
|
+
});
|
|
47198
|
+
};
|
|
47199
|
+
|
|
47200
|
+
const SeedlingsHeight = ({
|
|
47201
|
+
seedlingsHeightChart,
|
|
47202
|
+
t = s => s
|
|
47203
|
+
}) => {
|
|
47204
|
+
return /*#__PURE__*/jsxRuntime.jsx(Widget, {
|
|
47205
|
+
title: t("Seedlings Height"),
|
|
47206
|
+
className: "with-border-header h-w-btn-header",
|
|
47207
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
47208
|
+
className: "flex flex-1 flex-column justify-content-center",
|
|
47209
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
47210
|
+
className: "flex justify-content-center w-full",
|
|
47211
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ColumnChart, {
|
|
47212
|
+
data: seedlingsHeightChart || [],
|
|
47213
|
+
xFieldKey: "label",
|
|
47214
|
+
yFieldKey: "value",
|
|
47215
|
+
animated: true,
|
|
47216
|
+
height: 200,
|
|
47217
|
+
color: "#016C6E",
|
|
47218
|
+
renderTooltipContent: (title, data) => {
|
|
47219
|
+
if (!data || data.length === 0) return {};
|
|
47220
|
+
const item = data[0]?.data || data[0];
|
|
47221
|
+
return {
|
|
47222
|
+
title: t("Seedlings Height"),
|
|
47223
|
+
subTitle: title,
|
|
47224
|
+
items: [{
|
|
47225
|
+
label: t("Count"),
|
|
47226
|
+
value: item?.value || 0
|
|
47227
|
+
}]
|
|
47228
|
+
};
|
|
47229
|
+
}
|
|
47230
|
+
})
|
|
47231
|
+
})
|
|
47232
|
+
})
|
|
47233
|
+
});
|
|
47234
|
+
};
|
|
47235
|
+
|
|
47236
|
+
const COLORS = ['#016C6E', '#F5C2AC', '#F0A888', '#DF571E', '#C04B19', '#9B3D14', '#7A2F0F'];
|
|
47237
|
+
const PlantedSpecies = ({
|
|
47238
|
+
plantedSpeciesChart,
|
|
47239
|
+
t = s => s
|
|
47240
|
+
}) => {
|
|
47241
|
+
const pieData = React.useMemo(() => {
|
|
47242
|
+
const data = plantedSpeciesChart || [];
|
|
47243
|
+
const total = data.reduce((sum, item) => sum + (Number(item?.value) || 0), 0);
|
|
47244
|
+
return data.map((item, index) => ({
|
|
47245
|
+
value: Number(item?.value) || 0,
|
|
47246
|
+
percent: total > 0 ? (Number(item?.value) || 0) / total : 0,
|
|
47247
|
+
color: COLORS[index % COLORS.length],
|
|
47248
|
+
label: item?.type || '',
|
|
47249
|
+
key: item?.type || `item-${index}`
|
|
47250
|
+
}));
|
|
47251
|
+
}, [plantedSpeciesChart]);
|
|
47252
|
+
const isEmpty = React.useMemo(() => {
|
|
47253
|
+
return !plantedSpeciesChart || plantedSpeciesChart.length === 0 || plantedSpeciesChart.every(item => !item?.value || Number(item.value) === 0);
|
|
47254
|
+
}, [plantedSpeciesChart]);
|
|
47255
|
+
const getTooltipChildren = React.useCallback(item => {
|
|
47256
|
+
if (isEmpty) {
|
|
47257
|
+
return null;
|
|
47258
|
+
}
|
|
47259
|
+
return renderTooltipJsx({
|
|
47260
|
+
title: t("Planted Species"),
|
|
47261
|
+
items: [{
|
|
47262
|
+
color: item.color,
|
|
47263
|
+
label: item.label || '',
|
|
47264
|
+
value: item.value || 0
|
|
47265
|
+
}]
|
|
47266
|
+
});
|
|
47267
|
+
}, [t, isEmpty]);
|
|
47268
|
+
return /*#__PURE__*/jsxRuntime.jsx(Widget, {
|
|
47269
|
+
title: t("Planted Species"),
|
|
47270
|
+
className: "with-border-header h-w-btn-header",
|
|
47271
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
47272
|
+
className: "flex flex-1 flex-column justify-content-center",
|
|
47273
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
47274
|
+
className: "flex justify-content-center w-full",
|
|
47275
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Chart, {
|
|
47276
|
+
data: pieData,
|
|
47277
|
+
isPie: true,
|
|
47278
|
+
isEmpty: isEmpty,
|
|
47279
|
+
getTooltipChildren: getTooltipChildren,
|
|
47280
|
+
mouseXOffset: 10,
|
|
47281
|
+
mouseYOffset: 10,
|
|
47282
|
+
changeOpacityOnHover: false,
|
|
47283
|
+
doConstraints: false
|
|
47284
|
+
})
|
|
47285
|
+
})
|
|
47286
|
+
})
|
|
47287
|
+
});
|
|
47288
|
+
};
|
|
47289
|
+
|
|
47290
|
+
const Stats = ({
|
|
47291
|
+
survivalRate,
|
|
47292
|
+
averageHeight,
|
|
47293
|
+
averageDiameter,
|
|
47294
|
+
t = s => s
|
|
47295
|
+
}) => {
|
|
47296
|
+
const survivalRateChange = React.useMemo(() => {
|
|
47297
|
+
if (!survivalRate) return null;
|
|
47298
|
+
return calculateStatChange({
|
|
47299
|
+
current: Number(survivalRate.current) || 0,
|
|
47300
|
+
previous: Number(survivalRate.previous) || 0
|
|
47301
|
+
}, {
|
|
47302
|
+
tooltipText: t("In comparison to last period"),
|
|
47303
|
+
format: 'absolute'
|
|
47304
|
+
});
|
|
47305
|
+
}, [survivalRate, t]);
|
|
47306
|
+
const averageHeightChange = React.useMemo(() => {
|
|
47307
|
+
if (!averageHeight) return null;
|
|
47308
|
+
return calculateStatChange({
|
|
47309
|
+
current: Number(averageHeight.current) || 0,
|
|
47310
|
+
previous: Number(averageHeight.previous) || 0
|
|
47311
|
+
}, {
|
|
47312
|
+
tooltipText: t("In comparison to last period"),
|
|
47313
|
+
format: 'absolute'
|
|
47314
|
+
});
|
|
47315
|
+
}, [averageHeight, t]);
|
|
47316
|
+
const averageDiameterChange = React.useMemo(() => {
|
|
47317
|
+
if (!averageDiameter) return null;
|
|
47318
|
+
return calculateStatChange({
|
|
47319
|
+
current: Number(averageDiameter.current) || 0,
|
|
47320
|
+
previous: Number(averageDiameter.previous) || 0
|
|
47321
|
+
}, {
|
|
47322
|
+
tooltipText: t("In comparison to last period"),
|
|
47323
|
+
format: 'absolute'
|
|
47324
|
+
});
|
|
47325
|
+
}, [averageDiameter, t]);
|
|
47326
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
47327
|
+
style: {
|
|
47328
|
+
display: "flex",
|
|
47329
|
+
gap: "24px",
|
|
47330
|
+
marginBottom: "24px"
|
|
47331
|
+
},
|
|
47332
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("section", {
|
|
47333
|
+
style: {
|
|
47334
|
+
flex: 1
|
|
47335
|
+
},
|
|
47336
|
+
children: /*#__PURE__*/jsxRuntime.jsx(StatCard, {
|
|
47337
|
+
title: t("Survival Rate"),
|
|
47338
|
+
value: survivalRate ? Number(survivalRate.current).toLocaleString() : "0",
|
|
47339
|
+
icon: "EventCalendar",
|
|
47340
|
+
change: survivalRateChange
|
|
47341
|
+
})
|
|
47342
|
+
}), /*#__PURE__*/jsxRuntime.jsx("section", {
|
|
47343
|
+
style: {
|
|
47344
|
+
flex: 1
|
|
47345
|
+
},
|
|
47346
|
+
children: /*#__PURE__*/jsxRuntime.jsx(StatCard, {
|
|
47347
|
+
title: t("Average Height"),
|
|
47348
|
+
value: averageHeight ? Number(averageHeight.current).toLocaleString() + " cm" : "0 cm",
|
|
47349
|
+
icon: "ProjectLocation",
|
|
47350
|
+
change: averageHeightChange
|
|
47351
|
+
})
|
|
47352
|
+
}), /*#__PURE__*/jsxRuntime.jsx("section", {
|
|
47353
|
+
style: {
|
|
47354
|
+
flex: 1
|
|
47355
|
+
},
|
|
47356
|
+
children: /*#__PURE__*/jsxRuntime.jsx(StatCard, {
|
|
47357
|
+
title: t("Average Diameter"),
|
|
47358
|
+
value: averageDiameter ? Number(averageDiameter.current).toLocaleString() + " mm" : "0 mm",
|
|
47359
|
+
icon: "Activity",
|
|
47360
|
+
change: averageDiameterChange
|
|
47361
|
+
})
|
|
47362
|
+
})]
|
|
47363
|
+
});
|
|
47364
|
+
};
|
|
47365
|
+
|
|
47366
|
+
const MangroveGrowth = ({
|
|
47367
|
+
id,
|
|
47368
|
+
getSummaryDetail,
|
|
47369
|
+
loading = false,
|
|
47370
|
+
t = s => s
|
|
47371
|
+
}) => {
|
|
47372
|
+
const defaultConfig = React.useMemo(() => ({
|
|
47373
|
+
basepath: "events/monitoring-campaign",
|
|
47374
|
+
url: `/summary/${id}/outcomes`,
|
|
47375
|
+
stop: !id
|
|
47376
|
+
}), [id]);
|
|
47377
|
+
const customGetData = React.useMemo(() => {
|
|
47378
|
+
if (getSummaryDetail && id) {
|
|
47379
|
+
return ({
|
|
47380
|
+
url,
|
|
47381
|
+
params = {}
|
|
47382
|
+
}) => {
|
|
47383
|
+
const match = url.match(/\/summary\/[^/]+\/(.+)/);
|
|
47384
|
+
if (match) {
|
|
47385
|
+
const [, type] = match;
|
|
47386
|
+
return getSummaryDetail(id, type, params);
|
|
47387
|
+
}
|
|
47388
|
+
throw new Error(`Invalid URL format: ${url}`);
|
|
47389
|
+
};
|
|
47390
|
+
}
|
|
47391
|
+
return undefined;
|
|
47392
|
+
}, [getSummaryDetail, id]);
|
|
47393
|
+
const {
|
|
47394
|
+
loading: outcomesLoading,
|
|
47395
|
+
data: outcomesData
|
|
47396
|
+
} = useWidgetFetch({
|
|
47397
|
+
config: defaultConfig,
|
|
47398
|
+
getData: customGetData
|
|
47399
|
+
});
|
|
47400
|
+
const {
|
|
47401
|
+
survivalRate,
|
|
47402
|
+
averageHeight,
|
|
47403
|
+
averageDiameter,
|
|
47404
|
+
vegetationHealthChart,
|
|
47405
|
+
seedlingsHeightChart,
|
|
47406
|
+
plantedSpeciesChart
|
|
47407
|
+
} = outcomesData || {};
|
|
47408
|
+
return /*#__PURE__*/jsxRuntime.jsx("section", {
|
|
47409
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(Widget, {
|
|
47410
|
+
title: t("Mangrove Growth"),
|
|
47411
|
+
loading: loading || outcomesLoading,
|
|
47412
|
+
className: "with-border-header h-w-btn-header",
|
|
47413
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Stats, {
|
|
47414
|
+
survivalRate: survivalRate,
|
|
47415
|
+
averageHeight: averageHeight,
|
|
47416
|
+
averageDiameter: averageDiameter,
|
|
47417
|
+
t: t
|
|
47418
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
47419
|
+
style: {
|
|
47420
|
+
display: "flex",
|
|
47421
|
+
gap: "24px"
|
|
47422
|
+
},
|
|
47423
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("section", {
|
|
47424
|
+
style: {
|
|
47425
|
+
flex: 1
|
|
47426
|
+
},
|
|
47427
|
+
children: /*#__PURE__*/jsxRuntime.jsx(VegetationHealth, {
|
|
47428
|
+
vegetationHealthChart: vegetationHealthChart,
|
|
47429
|
+
t: t
|
|
47430
|
+
})
|
|
47431
|
+
}), /*#__PURE__*/jsxRuntime.jsx("section", {
|
|
47432
|
+
style: {
|
|
47433
|
+
flex: 1
|
|
47434
|
+
},
|
|
47435
|
+
children: /*#__PURE__*/jsxRuntime.jsx(SeedlingsHeight, {
|
|
47436
|
+
seedlingsHeightChart: seedlingsHeightChart,
|
|
47437
|
+
t: t
|
|
47438
|
+
})
|
|
47439
|
+
}), /*#__PURE__*/jsxRuntime.jsx("section", {
|
|
47440
|
+
style: {
|
|
47441
|
+
flex: 1
|
|
47442
|
+
},
|
|
47443
|
+
children: /*#__PURE__*/jsxRuntime.jsx(PlantedSpecies, {
|
|
47444
|
+
plantedSpeciesChart: plantedSpeciesChart,
|
|
47445
|
+
t: t
|
|
47446
|
+
})
|
|
47447
|
+
})]
|
|
47448
|
+
})]
|
|
47449
|
+
})
|
|
47450
|
+
});
|
|
47451
|
+
};
|
|
47452
|
+
|
|
47453
|
+
const MonitoringCampaignSummary = ({
|
|
46648
47454
|
header,
|
|
46649
47455
|
activityData,
|
|
46650
47456
|
loading = false,
|
|
@@ -46671,34 +47477,16 @@ const PlantingCycleSummary = ({
|
|
|
46671
47477
|
t: t,
|
|
46672
47478
|
getSummaryDetail: getSummaryDetail,
|
|
46673
47479
|
loading: loading
|
|
46674
|
-
}), /*#__PURE__*/jsxRuntime.jsx(
|
|
46675
|
-
id: id,
|
|
46676
|
-
getSummaryDetail: getSummaryDetail,
|
|
46677
|
-
loading: loading,
|
|
46678
|
-
t: t
|
|
46679
|
-
}), /*#__PURE__*/jsxRuntime.jsx(CycleOutcomes, {
|
|
46680
|
-
id: id,
|
|
46681
|
-
getSummaryDetail: getSummaryDetail,
|
|
46682
|
-
loading: loading,
|
|
46683
|
-
t: t
|
|
46684
|
-
}), /*#__PURE__*/jsxRuntime.jsx(CycleIndicators, {
|
|
46685
|
-
id: id,
|
|
46686
|
-
getSummaryDetail: getSummaryDetail,
|
|
46687
|
-
loading: loading,
|
|
46688
|
-
t: t
|
|
46689
|
-
}), /*#__PURE__*/jsxRuntime.jsx(CommunityParticipation, {
|
|
47480
|
+
}), /*#__PURE__*/jsxRuntime.jsx(MonitoringScopeAndFindings, {
|
|
46690
47481
|
id: id,
|
|
47482
|
+
t: t,
|
|
46691
47483
|
getSummaryDetail: getSummaryDetail,
|
|
46692
|
-
loading: loading
|
|
46693
|
-
|
|
46694
|
-
}), /*#__PURE__*/jsxRuntime.jsx(AssociatedInformation, {
|
|
47484
|
+
loading: loading
|
|
47485
|
+
}), /*#__PURE__*/jsxRuntime.jsx(MangroveGrowth, {
|
|
46695
47486
|
id: id,
|
|
46696
|
-
projectId: projectId,
|
|
46697
|
-
getSummaryDetail: getSummaryDetail,
|
|
46698
|
-
loading: loading,
|
|
46699
47487
|
t: t,
|
|
46700
|
-
|
|
46701
|
-
|
|
47488
|
+
getSummaryDetail: getSummaryDetail,
|
|
47489
|
+
loading: loading
|
|
46702
47490
|
})]
|
|
46703
47491
|
});
|
|
46704
47492
|
};
|
|
@@ -48270,6 +49058,7 @@ exports.EventsTable = EventsTable;
|
|
|
48270
49058
|
exports.IncidentsTable = IncidentsTable;
|
|
48271
49059
|
exports.LocationsTable = LocationsTable;
|
|
48272
49060
|
exports.MineSummary = MineSummary;
|
|
49061
|
+
exports.MonitoringCampaignSummary = MonitoringCampaignSummary;
|
|
48273
49062
|
exports.OperatorSummary = OperatorSummary;
|
|
48274
49063
|
exports.OperatorsTable = OperatorsTable;
|
|
48275
49064
|
exports.PartnersTable = PartnersTable;
|