datastake-daf 0.6.786 → 0.6.788
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 +226 -91
- package/dist/pages/index.js +774 -33
- package/dist/style/datastake/mapbox-gl.css +330 -0
- package/package.json +1 -1
- package/src/@daf/core/components/Dashboard/Widget/ActivityIndicators/ActivityIndicators.stories.js +24 -0
- package/src/@daf/core/components/Dashboard/Widget/ActivityIndicators/index.jsx +1 -0
- package/src/@daf/core/components/Dashboard/Widget/ActivityIndicators/style.js +34 -0
- package/src/@daf/core/components/Dashboard/Widget/KeyIndicators/KeyIndicators.stories.js +39 -0
- package/src/@daf/core/components/Dashboard/Widget/KeyIndicators/LabelWithIcon.jsx +38 -0
- package/src/@daf/core/components/Dashboard/Widget/KeyIndicators/index.jsx +16 -3
- package/src/@daf/core/components/Dashboard/Widget/KeyIndicators/style.js +33 -0
- package/src/@daf/pages/Summary/Activities/Monitoring/components/ActivityImagery/index.jsx +29 -0
- package/src/@daf/pages/Summary/Activities/Monitoring/components/ActivityLocation/index.jsx +94 -0
- package/src/@daf/pages/Summary/Activities/Monitoring/components/MangroveGrowthAndSurvival/components/PlantedSpecies/index.jsx +56 -0
- package/src/@daf/pages/Summary/Activities/Monitoring/components/MangroveGrowthAndSurvival/components/SeedlingsHeight/index.jsx +121 -0
- package/src/@daf/pages/Summary/Activities/Monitoring/components/MangroveGrowthAndSurvival/components/SurvivalRate/index.jsx +94 -0
- package/src/@daf/pages/Summary/Activities/Monitoring/components/MangroveGrowthAndSurvival/index.jsx +54 -0
- package/src/@daf/pages/Summary/Activities/Monitoring/components/WorkersDistribution/index.jsx +49 -0
- package/src/@daf/pages/Summary/Activities/Monitoring/config.js +51 -0
- package/src/@daf/pages/Summary/Activities/Monitoring/helper.js +236 -0
- package/src/@daf/pages/Summary/Activities/Monitoring/index.jsx +66 -0
- package/src/pages.js +1 -0
package/dist/pages/index.js
CHANGED
|
@@ -7184,12 +7184,45 @@ const Style$g = styled__default["default"].div`
|
|
|
7184
7184
|
margin-top: 14px;
|
|
7185
7185
|
}
|
|
7186
7186
|
}
|
|
7187
|
+
|
|
7188
|
+
&.row-item-with-icon {
|
|
7189
|
+
display: flex;
|
|
7190
|
+
align-items: center;
|
|
7191
|
+
justify-content: space-between;
|
|
7192
|
+
gap: 8px;
|
|
7193
|
+
|
|
7194
|
+
h4 {
|
|
7195
|
+
margin-bottom: 0;
|
|
7196
|
+
flex: 0 0 auto;
|
|
7197
|
+
}
|
|
7198
|
+
|
|
7199
|
+
.flex {
|
|
7200
|
+
flex: 0 0 auto;
|
|
7201
|
+
display: flex;
|
|
7202
|
+
align-items: center;
|
|
7203
|
+
font-size: 16px;
|
|
7204
|
+
font-weight: 500;
|
|
7205
|
+
line-height: 38px;
|
|
7206
|
+
letter-spacing: 0;
|
|
7207
|
+
color: var(--base-gray-90);
|
|
7208
|
+
font-family: 'SF UI Display', -apple-system, BlinkMacSystemFont, sans-serif;
|
|
7209
|
+
}
|
|
7210
|
+
}
|
|
7187
7211
|
}
|
|
7188
7212
|
|
|
7189
7213
|
&.small-content {
|
|
7190
7214
|
span {
|
|
7191
7215
|
font-size: 16px;
|
|
7192
7216
|
}
|
|
7217
|
+
|
|
7218
|
+
.row-item-with-icon {
|
|
7219
|
+
.flex {
|
|
7220
|
+
font-size: 16px;
|
|
7221
|
+
line-height: 38px;
|
|
7222
|
+
font-weight: 500;
|
|
7223
|
+
color: var(--base-gray-90);
|
|
7224
|
+
}
|
|
7225
|
+
}
|
|
7193
7226
|
}
|
|
7194
7227
|
|
|
7195
7228
|
.ant-tag {
|
|
@@ -7507,6 +7540,50 @@ Widget.propTypes = {
|
|
|
7507
7540
|
};
|
|
7508
7541
|
Widget.displayName = 'Widget';
|
|
7509
7542
|
|
|
7543
|
+
const LabelWithIcon = ({
|
|
7544
|
+
t,
|
|
7545
|
+
name,
|
|
7546
|
+
icon,
|
|
7547
|
+
iconColor = "#028788",
|
|
7548
|
+
iconWidth = 16,
|
|
7549
|
+
iconHeight = 16
|
|
7550
|
+
}) => {
|
|
7551
|
+
// name is expected to be already translated (string) or a translation key
|
|
7552
|
+
// If it's a string that looks like a translation key (contains '::'), translate it
|
|
7553
|
+
// Otherwise, use it as-is (already translated)
|
|
7554
|
+
const displayText = typeof name === 'string' && name.includes('::') && t && typeof t === 'function' ? t(name) : name;
|
|
7555
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
7556
|
+
className: "flex items-center",
|
|
7557
|
+
style: {
|
|
7558
|
+
gap: 8
|
|
7559
|
+
},
|
|
7560
|
+
children: [icon && /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
|
|
7561
|
+
name: icon,
|
|
7562
|
+
color: iconColor,
|
|
7563
|
+
width: iconWidth,
|
|
7564
|
+
height: iconHeight
|
|
7565
|
+
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
7566
|
+
style: {
|
|
7567
|
+
fontSize: '14px',
|
|
7568
|
+
fontWeight: 500,
|
|
7569
|
+
lineHeight: '26px',
|
|
7570
|
+
letterSpacing: '0%',
|
|
7571
|
+
color: 'var(--base-gray-70)',
|
|
7572
|
+
fontFamily: 'SF UI Display, -apple-system, BlinkMacSystemFont, sans-serif'
|
|
7573
|
+
},
|
|
7574
|
+
children: displayText
|
|
7575
|
+
})]
|
|
7576
|
+
});
|
|
7577
|
+
};
|
|
7578
|
+
LabelWithIcon.propTypes = {
|
|
7579
|
+
t: PropTypes__default["default"].func,
|
|
7580
|
+
name: PropTypes__default["default"].string.isRequired,
|
|
7581
|
+
icon: PropTypes__default["default"].string,
|
|
7582
|
+
iconColor: PropTypes__default["default"].string,
|
|
7583
|
+
iconWidth: PropTypes__default["default"].number,
|
|
7584
|
+
iconHeight: PropTypes__default["default"].number
|
|
7585
|
+
};
|
|
7586
|
+
|
|
7510
7587
|
function KeyIndicatorsWidget({
|
|
7511
7588
|
t = s => s,
|
|
7512
7589
|
className,
|
|
@@ -7527,10 +7604,12 @@ function KeyIndicatorsWidget({
|
|
|
7527
7604
|
children: [children, /*#__PURE__*/jsxRuntime.jsx(Style$g, {
|
|
7528
7605
|
className: formatClassname(["flex", className]),
|
|
7529
7606
|
children: config.map((c, i) => /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
7530
|
-
className:
|
|
7607
|
+
className: `row-item ${c.icon ? 'row-item-with-icon' : ''}`,
|
|
7531
7608
|
children: [/*#__PURE__*/jsxRuntime.jsx(Label$1, {
|
|
7532
7609
|
label: c.label,
|
|
7533
|
-
|
|
7610
|
+
icon: c.icon,
|
|
7611
|
+
withTooltip: withTooltip,
|
|
7612
|
+
t: t
|
|
7534
7613
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
7535
7614
|
className: "flex",
|
|
7536
7615
|
children: c.render()
|
|
@@ -7547,8 +7626,29 @@ function KeyIndicatorsWidget({
|
|
|
7547
7626
|
}
|
|
7548
7627
|
function Label$1({
|
|
7549
7628
|
label,
|
|
7550
|
-
|
|
7629
|
+
icon,
|
|
7630
|
+
withTooltip,
|
|
7631
|
+
t
|
|
7551
7632
|
}) {
|
|
7633
|
+
if (icon) {
|
|
7634
|
+
const labelContent = /*#__PURE__*/jsxRuntime.jsx(LabelWithIcon, {
|
|
7635
|
+
t: t,
|
|
7636
|
+
name: label,
|
|
7637
|
+
icon: icon
|
|
7638
|
+
});
|
|
7639
|
+
if (withTooltip) {
|
|
7640
|
+
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
7641
|
+
title: label,
|
|
7642
|
+
placement: "topLeft",
|
|
7643
|
+
children: /*#__PURE__*/jsxRuntime.jsx("h4", {
|
|
7644
|
+
children: labelContent
|
|
7645
|
+
})
|
|
7646
|
+
});
|
|
7647
|
+
}
|
|
7648
|
+
return /*#__PURE__*/jsxRuntime.jsx("h4", {
|
|
7649
|
+
children: labelContent
|
|
7650
|
+
});
|
|
7651
|
+
}
|
|
7552
7652
|
if (withTooltip) {
|
|
7553
7653
|
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
7554
7654
|
title: label,
|
|
@@ -12172,7 +12272,7 @@ const mapDataForChainOfCustody = (data = {}, options = {}, goTo = () => {}) => {
|
|
|
12172
12272
|
hardcodedData: PropTypes__default["default"].array
|
|
12173
12273
|
});
|
|
12174
12274
|
|
|
12175
|
-
const Container = styled__default["default"].div`
|
|
12275
|
+
const Container$1 = styled__default["default"].div`
|
|
12176
12276
|
height: ${props => props.height || '300px'};
|
|
12177
12277
|
width: ${props => props.isPdf ? props.width ? props.width : '1000px' : 'calc(100% - 48px)'};
|
|
12178
12278
|
`;
|
|
@@ -12446,7 +12546,7 @@ function LineChart({
|
|
|
12446
12546
|
className: "flex flex-1 flex-column justify-content-center",
|
|
12447
12547
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
12448
12548
|
className: "flex justify-content-center",
|
|
12449
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Container, {
|
|
12549
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Container$1, {
|
|
12450
12550
|
ref: containerRef,
|
|
12451
12551
|
height: height,
|
|
12452
12552
|
isPdf: isPdf,
|
|
@@ -14360,7 +14460,7 @@ function BarChart({
|
|
|
14360
14460
|
className: "flex flex-1 flex-column justify-content-center",
|
|
14361
14461
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
14362
14462
|
className: "flex justify-content-center",
|
|
14363
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Container, {
|
|
14463
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Container$1, {
|
|
14364
14464
|
ref: containerRef,
|
|
14365
14465
|
height: height,
|
|
14366
14466
|
isPdf: isPdf,
|
|
@@ -36498,7 +36598,7 @@ function RadialBarChart({
|
|
|
36498
36598
|
className: "flex flex-1 flex-column justify-content-center",
|
|
36499
36599
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
36500
36600
|
className: "flex justify-content-center",
|
|
36501
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Container, {
|
|
36601
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Container$1, {
|
|
36502
36602
|
ref: containerRef,
|
|
36503
36603
|
isPdf: isPdf
|
|
36504
36604
|
})
|
|
@@ -38624,6 +38724,40 @@ const Style$1 = styled__default["default"].div`
|
|
|
38624
38724
|
}
|
|
38625
38725
|
}
|
|
38626
38726
|
}
|
|
38727
|
+
|
|
38728
|
+
&.single-column {
|
|
38729
|
+
grid-template-columns: 1fr;
|
|
38730
|
+
|
|
38731
|
+
.indicator-item {
|
|
38732
|
+
/* Remove the 2-column specific separators first */
|
|
38733
|
+
&:nth-child(1),
|
|
38734
|
+
&:nth-child(2),
|
|
38735
|
+
&:nth-child(3),
|
|
38736
|
+
&:nth-child(4) {
|
|
38737
|
+
&::after {
|
|
38738
|
+
display: none !important;
|
|
38739
|
+
}
|
|
38740
|
+
}
|
|
38741
|
+
|
|
38742
|
+
/* On single column, all items except last get separator */
|
|
38743
|
+
&:not(:last-child) {
|
|
38744
|
+
&::after {
|
|
38745
|
+
content: '' !important;
|
|
38746
|
+
position: absolute;
|
|
38747
|
+
bottom: 0;
|
|
38748
|
+
left: var(--size-lg);
|
|
38749
|
+
right: var(--size-lg);
|
|
38750
|
+
height: 1px;
|
|
38751
|
+
background-color: var(--border-color, #E5E7EB);
|
|
38752
|
+
display: block !important;
|
|
38753
|
+
}
|
|
38754
|
+
}
|
|
38755
|
+
|
|
38756
|
+
&:last-child::after {
|
|
38757
|
+
display: none !important;
|
|
38758
|
+
}
|
|
38759
|
+
}
|
|
38760
|
+
}
|
|
38627
38761
|
`;
|
|
38628
38762
|
const NoMinWidth = styled__default["default"].div`
|
|
38629
38763
|
.indicator-item {
|
|
@@ -41919,7 +42053,7 @@ function ColumnChart({
|
|
|
41919
42053
|
className: "flex flex-1 flex-column justify-content-center",
|
|
41920
42054
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
41921
42055
|
className: "flex justify-content-center",
|
|
41922
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Container, {
|
|
42056
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Container$1, {
|
|
41923
42057
|
ref: containerRef,
|
|
41924
42058
|
height: height,
|
|
41925
42059
|
isPdf: isPdf,
|
|
@@ -43339,7 +43473,7 @@ styled__default["default"].div`
|
|
|
43339
43473
|
flex: 1;
|
|
43340
43474
|
`;
|
|
43341
43475
|
|
|
43342
|
-
const getKeyIndicatorsRowConfig$
|
|
43476
|
+
const getKeyIndicatorsRowConfig$3 = ({
|
|
43343
43477
|
t,
|
|
43344
43478
|
data = {}
|
|
43345
43479
|
}) => [{
|
|
@@ -43449,40 +43583,40 @@ const getGenderTooltipChildren$1 = (item, isEmpty, genderDistributionData, t, re
|
|
|
43449
43583
|
}]
|
|
43450
43584
|
});
|
|
43451
43585
|
};
|
|
43452
|
-
const getIndicatorType$
|
|
43586
|
+
const getIndicatorType$2 = value => {
|
|
43453
43587
|
if (value === "yes" || value === true) return "compliant";
|
|
43454
43588
|
if (value === "no" || value === false) return "notCompliant";
|
|
43455
43589
|
if (value === null || value === undefined) return "empty";
|
|
43456
43590
|
return "empty"; // default fallback
|
|
43457
43591
|
};
|
|
43458
|
-
const getActivityIndicatorsConfig = (activityData, t) => {
|
|
43592
|
+
const getActivityIndicatorsConfig$1 = (activityData, t) => {
|
|
43459
43593
|
return [{
|
|
43460
43594
|
icon: "Aid",
|
|
43461
43595
|
label: t("Aid kit availability"),
|
|
43462
|
-
type: getIndicatorType$
|
|
43596
|
+
type: getIndicatorType$2(activityData?.aidKitAccessible)
|
|
43463
43597
|
}, {
|
|
43464
43598
|
icon: "MineOperators",
|
|
43465
43599
|
label: t("H&S training delivery"),
|
|
43466
|
-
type: getIndicatorType$
|
|
43600
|
+
type: getIndicatorType$2(activityData?.hsTrainingConfirmation)
|
|
43467
43601
|
}, {
|
|
43468
43602
|
icon: "Users",
|
|
43469
43603
|
label: t("Workers safe pairing"),
|
|
43470
|
-
type: getIndicatorType$
|
|
43604
|
+
type: getIndicatorType$2(activityData?.duosFormed)
|
|
43471
43605
|
}, {
|
|
43472
43606
|
icon: "Bear",
|
|
43473
43607
|
label: t("No children"),
|
|
43474
|
-
type: getIndicatorType$
|
|
43608
|
+
type: getIndicatorType$2(activityData?.presenceOfChildren)
|
|
43475
43609
|
}, {
|
|
43476
43610
|
icon: "Security",
|
|
43477
43611
|
label: t("Security presence"),
|
|
43478
|
-
type: getIndicatorType$
|
|
43612
|
+
type: getIndicatorType$2(activityData?.focalPointPresent)
|
|
43479
43613
|
}, {
|
|
43480
43614
|
icon: "UserCircle",
|
|
43481
43615
|
label: t("Relay presence"),
|
|
43482
|
-
type: getIndicatorType$
|
|
43616
|
+
type: getIndicatorType$2(activityData?.relayPresent)
|
|
43483
43617
|
}];
|
|
43484
43618
|
};
|
|
43485
|
-
const getMapDataFromActivity = (activityData, t) => {
|
|
43619
|
+
const getMapDataFromActivity$1 = (activityData, t) => {
|
|
43486
43620
|
const location = activityData?.location;
|
|
43487
43621
|
const perimeter = location?.perimeter;
|
|
43488
43622
|
const area = Array.isArray(perimeter) && perimeter.length > 0 ? perimeter.filter(coord => Array.isArray(coord) && coord.length >= 2).map(coord => {
|
|
@@ -43598,12 +43732,12 @@ const getMapDataFromActivity = (activityData, t) => {
|
|
|
43598
43732
|
return mapData;
|
|
43599
43733
|
};
|
|
43600
43734
|
|
|
43601
|
-
const ActivityLocation = ({
|
|
43735
|
+
const ActivityLocation$1 = ({
|
|
43602
43736
|
activityData,
|
|
43603
43737
|
loading = false,
|
|
43604
43738
|
t = s => s
|
|
43605
43739
|
}) => {
|
|
43606
|
-
const mapData = React.useMemo(() => getMapDataFromActivity(activityData, t), [activityData, t]);
|
|
43740
|
+
const mapData = React.useMemo(() => getMapDataFromActivity$1(activityData, t), [activityData, t]);
|
|
43607
43741
|
return /*#__PURE__*/jsxRuntime.jsx("section", {
|
|
43608
43742
|
children: /*#__PURE__*/jsxRuntime.jsx(Widget, {
|
|
43609
43743
|
title: t("Activity Location"),
|
|
@@ -43998,13 +44132,13 @@ const RestorationActivitySummary = ({
|
|
|
43998
44132
|
loading,
|
|
43999
44133
|
t = () => {}
|
|
44000
44134
|
}) => {
|
|
44001
|
-
const keyIndicatorsConfig = React.useMemo(() => getKeyIndicatorsRowConfig$
|
|
44135
|
+
const keyIndicatorsConfig = React.useMemo(() => getKeyIndicatorsRowConfig$3({
|
|
44002
44136
|
t,
|
|
44003
44137
|
data: activityData
|
|
44004
44138
|
}), [t, activityData]);
|
|
44005
44139
|
|
|
44006
44140
|
// Activity Indicators Config - mapped from activityData
|
|
44007
|
-
const activityIndicatorsConfig = React.useMemo(() => getActivityIndicatorsConfig(activityData, t), [activityData, t]);
|
|
44141
|
+
const activityIndicatorsConfig = React.useMemo(() => getActivityIndicatorsConfig$1(activityData, t), [activityData, t]);
|
|
44008
44142
|
return /*#__PURE__*/jsxRuntime.jsxs(DashboardLayout, {
|
|
44009
44143
|
header: /*#__PURE__*/jsxRuntime.jsx(DAFHeader, {
|
|
44010
44144
|
title: 'Restoration Activity Summary',
|
|
@@ -44022,7 +44156,7 @@ const RestorationActivitySummary = ({
|
|
|
44022
44156
|
config: keyIndicatorsConfig,
|
|
44023
44157
|
loading: loading
|
|
44024
44158
|
})
|
|
44025
|
-
}), /*#__PURE__*/jsxRuntime.jsx(ActivityLocation, {
|
|
44159
|
+
}), /*#__PURE__*/jsxRuntime.jsx(ActivityLocation$1, {
|
|
44026
44160
|
activityData: activityData,
|
|
44027
44161
|
loading: loading,
|
|
44028
44162
|
t: t
|
|
@@ -44979,7 +45113,7 @@ const HEALTH_SAFETY_COLORS = {
|
|
|
44979
45113
|
notCompliant: '#F97066',
|
|
44980
45114
|
empty: '#D9D9D9'
|
|
44981
45115
|
};
|
|
44982
|
-
const getIndicatorType = value => {
|
|
45116
|
+
const getIndicatorType$1 = value => {
|
|
44983
45117
|
if (value === "yes" || value === true) return "compliant";
|
|
44984
45118
|
if (value === "no" || value === false) return "notCompliant";
|
|
44985
45119
|
if (value === null || value === undefined) return "empty";
|
|
@@ -45021,7 +45155,7 @@ const getHealthAndSafetyDistributionData = activityData => {
|
|
|
45021
45155
|
field
|
|
45022
45156
|
}) => {
|
|
45023
45157
|
const value = activityData?.[field];
|
|
45024
|
-
const type = getIndicatorType(value);
|
|
45158
|
+
const type = getIndicatorType$1(value);
|
|
45025
45159
|
distribution[type] = (distribution[type] || 0) + 1;
|
|
45026
45160
|
});
|
|
45027
45161
|
return distribution;
|
|
@@ -46565,7 +46699,7 @@ const AssociatedInformation = ({
|
|
|
46565
46699
|
});
|
|
46566
46700
|
};
|
|
46567
46701
|
|
|
46568
|
-
const getKeyIndicatorsRowConfig$
|
|
46702
|
+
const getKeyIndicatorsRowConfig$2 = ({
|
|
46569
46703
|
t,
|
|
46570
46704
|
data = {}
|
|
46571
46705
|
}) => [{
|
|
@@ -46639,7 +46773,7 @@ const KeyInformation$1 = ({
|
|
|
46639
46773
|
config: defaultConfig,
|
|
46640
46774
|
getData: customGetData
|
|
46641
46775
|
});
|
|
46642
|
-
const keyIndicatorsConfig = React.useMemo(() => getKeyIndicatorsRowConfig$
|
|
46776
|
+
const keyIndicatorsConfig = React.useMemo(() => getKeyIndicatorsRowConfig$2({
|
|
46643
46777
|
t,
|
|
46644
46778
|
data: keyInformationData
|
|
46645
46779
|
}), [t, keyInformationData]);
|
|
@@ -46711,7 +46845,7 @@ const PlantingCycleSummary = ({
|
|
|
46711
46845
|
});
|
|
46712
46846
|
};
|
|
46713
46847
|
|
|
46714
|
-
const getKeyIndicatorsRowConfig = ({
|
|
46848
|
+
const getKeyIndicatorsRowConfig$1 = ({
|
|
46715
46849
|
t,
|
|
46716
46850
|
data = {}
|
|
46717
46851
|
}) => [{
|
|
@@ -46785,7 +46919,7 @@ const KeyInformation = ({
|
|
|
46785
46919
|
config: defaultConfig,
|
|
46786
46920
|
getData: customGetData
|
|
46787
46921
|
});
|
|
46788
|
-
const keyIndicatorsConfig = React.useMemo(() => getKeyIndicatorsRowConfig({
|
|
46922
|
+
const keyIndicatorsConfig = React.useMemo(() => getKeyIndicatorsRowConfig$1({
|
|
46789
46923
|
t,
|
|
46790
46924
|
data: keyInformationData
|
|
46791
46925
|
}), [t, keyInformationData]);
|
|
@@ -47197,7 +47331,7 @@ const VegetationHealth = ({
|
|
|
47197
47331
|
});
|
|
47198
47332
|
};
|
|
47199
47333
|
|
|
47200
|
-
const SeedlingsHeight = ({
|
|
47334
|
+
const SeedlingsHeight$1 = ({
|
|
47201
47335
|
seedlingsHeightChart,
|
|
47202
47336
|
t = s => s
|
|
47203
47337
|
}) => {
|
|
@@ -47234,7 +47368,7 @@ const SeedlingsHeight = ({
|
|
|
47234
47368
|
};
|
|
47235
47369
|
|
|
47236
47370
|
const COLORS = ['#016C6E', '#F5C2AC', '#F0A888', '#DF571E', '#C04B19', '#9B3D14', '#7A2F0F'];
|
|
47237
|
-
const PlantedSpecies = ({
|
|
47371
|
+
const PlantedSpecies$1 = ({
|
|
47238
47372
|
plantedSpeciesChart,
|
|
47239
47373
|
t = s => s
|
|
47240
47374
|
}) => {
|
|
@@ -47432,7 +47566,7 @@ const MangroveGrowth = ({
|
|
|
47432
47566
|
style: {
|
|
47433
47567
|
flex: 1
|
|
47434
47568
|
},
|
|
47435
|
-
children: /*#__PURE__*/jsxRuntime.jsx(SeedlingsHeight, {
|
|
47569
|
+
children: /*#__PURE__*/jsxRuntime.jsx(SeedlingsHeight$1, {
|
|
47436
47570
|
seedlingsHeightChart: seedlingsHeightChart,
|
|
47437
47571
|
t: t
|
|
47438
47572
|
})
|
|
@@ -47440,7 +47574,7 @@ const MangroveGrowth = ({
|
|
|
47440
47574
|
style: {
|
|
47441
47575
|
flex: 1
|
|
47442
47576
|
},
|
|
47443
|
-
children: /*#__PURE__*/jsxRuntime.jsx(PlantedSpecies, {
|
|
47577
|
+
children: /*#__PURE__*/jsxRuntime.jsx(PlantedSpecies$1, {
|
|
47444
47578
|
plantedSpeciesChart: plantedSpeciesChart,
|
|
47445
47579
|
t: t
|
|
47446
47580
|
})
|
|
@@ -47966,6 +48100,612 @@ const MineSummary = ({
|
|
|
47966
48100
|
});
|
|
47967
48101
|
};
|
|
47968
48102
|
|
|
48103
|
+
const getKeyIndicatorsRowConfig = ({
|
|
48104
|
+
t,
|
|
48105
|
+
data = {}
|
|
48106
|
+
}) => [{
|
|
48107
|
+
label: t('Primary Data Collection'),
|
|
48108
|
+
render: () => {
|
|
48109
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
48110
|
+
className: "flex",
|
|
48111
|
+
children: '-'
|
|
48112
|
+
});
|
|
48113
|
+
}
|
|
48114
|
+
}, {
|
|
48115
|
+
label: t('Monitoring Organization'),
|
|
48116
|
+
render: () => /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
48117
|
+
children: data?.technicalPartner?.name || '-'
|
|
48118
|
+
})
|
|
48119
|
+
}, {
|
|
48120
|
+
label: t('Team Members'),
|
|
48121
|
+
render: () => /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
48122
|
+
children: [" ", data?.teamMembers?.length || '0']
|
|
48123
|
+
})
|
|
48124
|
+
}, {
|
|
48125
|
+
label: t('Monitored Area'),
|
|
48126
|
+
render: () => /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
48127
|
+
children: data?.totalAreaParcelMonitored ? `${data?.totalAreaParcelMonitored} ha` : '0 ha'
|
|
48128
|
+
})
|
|
48129
|
+
}];
|
|
48130
|
+
const getSiteConditionsConfig = ({
|
|
48131
|
+
t,
|
|
48132
|
+
data = {}
|
|
48133
|
+
}) => [{
|
|
48134
|
+
label: t('Season'),
|
|
48135
|
+
icon: 'Tree',
|
|
48136
|
+
render: () => /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
48137
|
+
children: camelCaseToTitle(data?.season) || '-'
|
|
48138
|
+
})
|
|
48139
|
+
}, {
|
|
48140
|
+
label: t('Weather conditions'),
|
|
48141
|
+
icon: 'Globe',
|
|
48142
|
+
render: () => /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
48143
|
+
children: camelCaseToTitle(data?.weatherConditions) || '-'
|
|
48144
|
+
})
|
|
48145
|
+
}, {
|
|
48146
|
+
label: t('Tide level'),
|
|
48147
|
+
icon: 'WaterDrop',
|
|
48148
|
+
render: () => /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
48149
|
+
children: camelCaseToTitle(data?.tideLevel) || '-'
|
|
48150
|
+
})
|
|
48151
|
+
}, {
|
|
48152
|
+
label: t('Disturbances'),
|
|
48153
|
+
icon: 'Lightning',
|
|
48154
|
+
render: () => /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
48155
|
+
children: data?.hasDisturbances ? t('Yes') : t('No')
|
|
48156
|
+
})
|
|
48157
|
+
}];
|
|
48158
|
+
|
|
48159
|
+
const getIndicatorType = value => {
|
|
48160
|
+
if (value === "yes" || value === true) return "compliant";
|
|
48161
|
+
if (value === "no" || value === false) return "notCompliant";
|
|
48162
|
+
if (value === null || value === undefined) return "empty";
|
|
48163
|
+
return "empty"; // default fallback
|
|
48164
|
+
};
|
|
48165
|
+
const getActivityIndicatorsConfig = (activityData, t) => {
|
|
48166
|
+
return [{
|
|
48167
|
+
icon: "Aid",
|
|
48168
|
+
label: t("Aid kit availability"),
|
|
48169
|
+
type: getIndicatorType(activityData?.aidKitAccessible)
|
|
48170
|
+
}, {
|
|
48171
|
+
icon: "MineOperators",
|
|
48172
|
+
label: t("H&S training delivery"),
|
|
48173
|
+
type: getIndicatorType(activityData?.hsTrainingConfirmation)
|
|
48174
|
+
}, {
|
|
48175
|
+
icon: "Users",
|
|
48176
|
+
label: t("Workers safe pairing"),
|
|
48177
|
+
type: getIndicatorType(activityData?.duosFormed)
|
|
48178
|
+
}, {
|
|
48179
|
+
icon: "Bear",
|
|
48180
|
+
label: t("No children"),
|
|
48181
|
+
type: getIndicatorType(activityData?.presenceOfChildren)
|
|
48182
|
+
}, {
|
|
48183
|
+
icon: "Security",
|
|
48184
|
+
label: t("Security presence"),
|
|
48185
|
+
type: getIndicatorType(activityData?.focalPointPresent)
|
|
48186
|
+
}, {
|
|
48187
|
+
icon: "UserCircle",
|
|
48188
|
+
label: t("Relay presence"),
|
|
48189
|
+
type: getIndicatorType(activityData?.relayPresent)
|
|
48190
|
+
}];
|
|
48191
|
+
};
|
|
48192
|
+
const getMapDataFromActivity = (activityData, t) => {
|
|
48193
|
+
const location = activityData?.location;
|
|
48194
|
+
const perimeter = location?.perimeter;
|
|
48195
|
+
const area = Array.isArray(perimeter) && perimeter.length > 0 ? perimeter.filter(coord => Array.isArray(coord) && coord.length >= 2).map(coord => {
|
|
48196
|
+
const first = typeof coord[0] === 'number' ? coord[0] : parseFloat(coord[0]);
|
|
48197
|
+
const second = typeof coord[1] === 'number' ? coord[1] : parseFloat(coord[1]);
|
|
48198
|
+
if (isNaN(first) || isNaN(second) || !isFinite(first) || !isFinite(second)) {
|
|
48199
|
+
return null;
|
|
48200
|
+
}
|
|
48201
|
+
|
|
48202
|
+
// Try both formats and use Leaflet to validate
|
|
48203
|
+
// First try as [lat, lng]
|
|
48204
|
+
try {
|
|
48205
|
+
const latLng1 = L__default["default"].latLng(first, second);
|
|
48206
|
+
if (latLng1.lat >= -90 && latLng1.lat <= 90 && latLng1.lng >= -180 && latLng1.lng <= 180) {
|
|
48207
|
+
return [latLng1.lat, latLng1.lng];
|
|
48208
|
+
}
|
|
48209
|
+
} catch (e) {
|
|
48210
|
+
// Not valid as [lat, lng], try swapping
|
|
48211
|
+
}
|
|
48212
|
+
|
|
48213
|
+
// Try as [lng, lat] (GeoJSON format) - swap them
|
|
48214
|
+
try {
|
|
48215
|
+
const latLng2 = L__default["default"].latLng(second, first);
|
|
48216
|
+
if (latLng2.lat >= -90 && latLng2.lat <= 90 && latLng2.lng >= -180 && latLng2.lng <= 180) {
|
|
48217
|
+
return [latLng2.lat, latLng2.lng];
|
|
48218
|
+
}
|
|
48219
|
+
} catch (e) {
|
|
48220
|
+
// Invalid coordinates
|
|
48221
|
+
}
|
|
48222
|
+
return null;
|
|
48223
|
+
}).filter(coord => coord !== null) : null;
|
|
48224
|
+
|
|
48225
|
+
// Don't return early - we need to check for markers even if there's no perimeter
|
|
48226
|
+
|
|
48227
|
+
const mapData = [];
|
|
48228
|
+
const baseColor = '#15FFFFB2';
|
|
48229
|
+
const locationName = location?.name || activityData?.name || t("Activity Location");
|
|
48230
|
+
const datastakeId = location?.datastakeId || activityData?.datastakeId;
|
|
48231
|
+
|
|
48232
|
+
// Helper to validate coordinates
|
|
48233
|
+
const isValidCoordinate = coord => {
|
|
48234
|
+
const num = typeof coord === 'number' ? coord : parseFloat(coord);
|
|
48235
|
+
return !isNaN(num) && isFinite(num);
|
|
48236
|
+
};
|
|
48237
|
+
|
|
48238
|
+
// Entry 1: Perimeter polygon (independent - show if it exists)
|
|
48239
|
+
if (area && area.length >= 3) {
|
|
48240
|
+
mapData.push({
|
|
48241
|
+
_id: {},
|
|
48242
|
+
id: `${activityData?.id || activityData?.datastakeId || 'perimeter'}-perimeter`,
|
|
48243
|
+
area: area,
|
|
48244
|
+
color: baseColor,
|
|
48245
|
+
// No gps property - this will display only the polygon without markers
|
|
48246
|
+
name: locationName,
|
|
48247
|
+
plotName: locationName,
|
|
48248
|
+
territoryTitle: t("Associated Plot"),
|
|
48249
|
+
subTitle: t("Activity Location"),
|
|
48250
|
+
type: t("Activity Location"),
|
|
48251
|
+
datastakeId: datastakeId,
|
|
48252
|
+
sources: null,
|
|
48253
|
+
link: null
|
|
48254
|
+
});
|
|
48255
|
+
}
|
|
48256
|
+
|
|
48257
|
+
// Entry 2: Arrival marker (independent - show if it exists)
|
|
48258
|
+
const arrivalLat = activityData?.locationCheckArrival?.latitude;
|
|
48259
|
+
const arrivalLng = activityData?.locationCheckArrival?.longitude;
|
|
48260
|
+
if (isValidCoordinate(arrivalLat) && isValidCoordinate(arrivalLng)) {
|
|
48261
|
+
mapData.push({
|
|
48262
|
+
_id: {},
|
|
48263
|
+
id: `${activityData?.id || activityData?.datastakeId || 'arrival'}-arrival`,
|
|
48264
|
+
// Include area if it exists, so marker can show on top of polygon
|
|
48265
|
+
area: area && area.length >= 3 ? area : null,
|
|
48266
|
+
color: baseColor,
|
|
48267
|
+
gps: {
|
|
48268
|
+
latitude: typeof arrivalLat === 'number' ? arrivalLat : parseFloat(arrivalLat),
|
|
48269
|
+
longitude: typeof arrivalLng === 'number' ? arrivalLng : parseFloat(arrivalLng)
|
|
48270
|
+
},
|
|
48271
|
+
name: t("Activity Start"),
|
|
48272
|
+
plotName: locationName,
|
|
48273
|
+
territoryTitle: t("Associated Plot"),
|
|
48274
|
+
datastakeId: `${datastakeId}-arrival`,
|
|
48275
|
+
sources: null,
|
|
48276
|
+
link: null
|
|
48277
|
+
});
|
|
48278
|
+
}
|
|
48279
|
+
|
|
48280
|
+
// Entry 3: Departure marker (independent - show if it exists)
|
|
48281
|
+
const departureLat = activityData?.locationCheckDeparture?.latitude;
|
|
48282
|
+
const departureLng = activityData?.locationCheckDeparture?.longitude;
|
|
48283
|
+
if (isValidCoordinate(departureLat) && isValidCoordinate(departureLng)) {
|
|
48284
|
+
mapData.push({
|
|
48285
|
+
_id: {},
|
|
48286
|
+
id: `${activityData?.id || activityData?.datastakeId || 'departure'}-departure`,
|
|
48287
|
+
// Include area if it exists, so marker can show on top of polygon
|
|
48288
|
+
area: area && area.length >= 3 ? area : null,
|
|
48289
|
+
color: baseColor,
|
|
48290
|
+
gps: {
|
|
48291
|
+
latitude: typeof departureLat === 'number' ? departureLat : parseFloat(departureLat),
|
|
48292
|
+
longitude: typeof departureLng === 'number' ? departureLng : parseFloat(departureLng)
|
|
48293
|
+
},
|
|
48294
|
+
name: t("Activity End"),
|
|
48295
|
+
plotName: locationName,
|
|
48296
|
+
territoryTitle: t("Associated Plot"),
|
|
48297
|
+
datastakeId: `${datastakeId}-departure`,
|
|
48298
|
+
markerColor: "#FF7A45",
|
|
48299
|
+
sources: null,
|
|
48300
|
+
link: null
|
|
48301
|
+
});
|
|
48302
|
+
}
|
|
48303
|
+
|
|
48304
|
+
// Return mapData even if empty - let the map component handle empty arrays
|
|
48305
|
+
return mapData;
|
|
48306
|
+
};
|
|
48307
|
+
|
|
48308
|
+
const ActivityLocation = ({
|
|
48309
|
+
activityData,
|
|
48310
|
+
loading = false,
|
|
48311
|
+
t = s => s
|
|
48312
|
+
}) => {
|
|
48313
|
+
const mapData = React.useMemo(() => getMapDataFromActivity(activityData, t), [activityData, t]);
|
|
48314
|
+
return /*#__PURE__*/jsxRuntime.jsx("section", {
|
|
48315
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Widget, {
|
|
48316
|
+
title: t("Activity Location"),
|
|
48317
|
+
className: "no-px h-w-btn-header no-pt-body no-p-body no-pb-body",
|
|
48318
|
+
style: {
|
|
48319
|
+
height: '100%',
|
|
48320
|
+
display: 'flex',
|
|
48321
|
+
flexDirection: 'column'
|
|
48322
|
+
},
|
|
48323
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
48324
|
+
style: {
|
|
48325
|
+
flex: 1,
|
|
48326
|
+
minHeight: 0
|
|
48327
|
+
},
|
|
48328
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Map$1, {
|
|
48329
|
+
loading: loading,
|
|
48330
|
+
t: t,
|
|
48331
|
+
isSatellite: true,
|
|
48332
|
+
app: "straatos",
|
|
48333
|
+
type: 'location-territory',
|
|
48334
|
+
showSider: false,
|
|
48335
|
+
user: null,
|
|
48336
|
+
data: mapData,
|
|
48337
|
+
maxZoom: 18,
|
|
48338
|
+
primaryLink: true,
|
|
48339
|
+
style: {
|
|
48340
|
+
height: '100%',
|
|
48341
|
+
width: '100%'
|
|
48342
|
+
},
|
|
48343
|
+
renderTooltipForLocation: data => {
|
|
48344
|
+
const coordinates = data.gps?.latitude && data.gps?.longitude ? convertDMS(data.gps.latitude, data.gps.longitude) : null;
|
|
48345
|
+
if (!coordinates) {
|
|
48346
|
+
return [];
|
|
48347
|
+
}
|
|
48348
|
+
const isActivityEnd = data.name === t("Activity End") || data.id?.includes('-departure');
|
|
48349
|
+
const iconColor = isActivityEnd ? "#FF7A45" : "#016C6E";
|
|
48350
|
+
return [{
|
|
48351
|
+
label: t("Coordinates"),
|
|
48352
|
+
value: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
48353
|
+
style: {
|
|
48354
|
+
display: 'flex',
|
|
48355
|
+
alignItems: 'center',
|
|
48356
|
+
gap: '6px',
|
|
48357
|
+
flexWrap: 'nowrap'
|
|
48358
|
+
},
|
|
48359
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
48360
|
+
style: {
|
|
48361
|
+
display: 'flex',
|
|
48362
|
+
alignItems: 'center'
|
|
48363
|
+
},
|
|
48364
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
|
|
48365
|
+
name: "SpacingHeight",
|
|
48366
|
+
width: 14,
|
|
48367
|
+
height: 14,
|
|
48368
|
+
color: iconColor
|
|
48369
|
+
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
48370
|
+
style: {
|
|
48371
|
+
fontWeight: 600,
|
|
48372
|
+
marginLeft: '4px'
|
|
48373
|
+
},
|
|
48374
|
+
children: coordinates[0]
|
|
48375
|
+
})]
|
|
48376
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
48377
|
+
style: {
|
|
48378
|
+
display: 'flex',
|
|
48379
|
+
alignItems: 'center'
|
|
48380
|
+
},
|
|
48381
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
|
|
48382
|
+
name: "SpacingWidth",
|
|
48383
|
+
width: 14,
|
|
48384
|
+
height: 14,
|
|
48385
|
+
color: iconColor
|
|
48386
|
+
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
48387
|
+
style: {
|
|
48388
|
+
fontWeight: 600,
|
|
48389
|
+
marginLeft: '4px'
|
|
48390
|
+
},
|
|
48391
|
+
children: coordinates[1]
|
|
48392
|
+
})]
|
|
48393
|
+
})]
|
|
48394
|
+
})
|
|
48395
|
+
}];
|
|
48396
|
+
},
|
|
48397
|
+
renderTooltipForTerritory: data => {
|
|
48398
|
+
return [{
|
|
48399
|
+
label: t("Plot Name"),
|
|
48400
|
+
value: data.plotName || data.name || "--"
|
|
48401
|
+
}];
|
|
48402
|
+
},
|
|
48403
|
+
link: true
|
|
48404
|
+
})
|
|
48405
|
+
})
|
|
48406
|
+
})
|
|
48407
|
+
});
|
|
48408
|
+
};
|
|
48409
|
+
|
|
48410
|
+
const PlantedSpecies = ({
|
|
48411
|
+
activityData,
|
|
48412
|
+
loading = false,
|
|
48413
|
+
t = s => s
|
|
48414
|
+
}) => {
|
|
48415
|
+
const speciesConfig = React.useMemo(() => {
|
|
48416
|
+
// Extract planted species from activityData
|
|
48417
|
+
// Assuming the data structure might have plantedSpecies array or similar
|
|
48418
|
+
const species = activityData?.plantedSpecies || activityData?.mangroveSpecies || [];
|
|
48419
|
+
|
|
48420
|
+
// If species is an array, map it to config format
|
|
48421
|
+
if (Array.isArray(species)) {
|
|
48422
|
+
return species.map((speciesItem, index) => {
|
|
48423
|
+
const speciesName = typeof speciesItem === 'string' ? speciesItem : speciesItem?.name || speciesItem?.species || `Species ${index + 1}`;
|
|
48424
|
+
|
|
48425
|
+
// Determine if species is selected/planted (you may need to adjust this logic)
|
|
48426
|
+
const isSelected = typeof speciesItem === 'object' ? speciesItem?.selected !== false : true;
|
|
48427
|
+
return {
|
|
48428
|
+
icon: 'Tree',
|
|
48429
|
+
label: speciesName,
|
|
48430
|
+
type: isSelected ? 'compliant' : 'notCompliant',
|
|
48431
|
+
statusIcon: isSelected ? 'Check' : 'Close'
|
|
48432
|
+
};
|
|
48433
|
+
});
|
|
48434
|
+
}
|
|
48435
|
+
|
|
48436
|
+
// Fallback: if no species data, show default species from image
|
|
48437
|
+
return [{
|
|
48438
|
+
icon: 'Tree',
|
|
48439
|
+
label: 'Rhyzophora sp',
|
|
48440
|
+
type: 'compliant',
|
|
48441
|
+
statusIcon: 'Check'
|
|
48442
|
+
}, {
|
|
48443
|
+
icon: 'Tree',
|
|
48444
|
+
label: 'Rhyzophora',
|
|
48445
|
+
type: 'notCompliant',
|
|
48446
|
+
statusIcon: 'Close'
|
|
48447
|
+
}, {
|
|
48448
|
+
icon: 'Tree',
|
|
48449
|
+
label: 'Rhyzophora mangle',
|
|
48450
|
+
type: 'notCompliant',
|
|
48451
|
+
statusIcon: 'Close'
|
|
48452
|
+
}];
|
|
48453
|
+
}, [activityData]);
|
|
48454
|
+
return /*#__PURE__*/jsxRuntime.jsx(ActivityIndicatorsWidget, {
|
|
48455
|
+
title: t("Planted Species"),
|
|
48456
|
+
config: speciesConfig,
|
|
48457
|
+
loading: loading,
|
|
48458
|
+
widgetClassName: "h-w-btn-header",
|
|
48459
|
+
t: t,
|
|
48460
|
+
className: "single-column"
|
|
48461
|
+
});
|
|
48462
|
+
};
|
|
48463
|
+
|
|
48464
|
+
const SurvivalRate = ({
|
|
48465
|
+
activityData,
|
|
48466
|
+
loading = false,
|
|
48467
|
+
t = s => s
|
|
48468
|
+
}) => {
|
|
48469
|
+
React.useMemo(() => {
|
|
48470
|
+
// Extract survival rate from activityData
|
|
48471
|
+
// Assuming the data might have survivalRate as a percentage (0-100)
|
|
48472
|
+
const survivalRate = activityData?.survivalRate || activityData?.mangroveSurvivalRate || 78;
|
|
48473
|
+
const survivalPercent = typeof survivalRate === 'number' ? survivalRate : parseFloat(survivalRate) || 78;
|
|
48474
|
+
return [{
|
|
48475
|
+
type: t("Survival Rate"),
|
|
48476
|
+
value: survivalPercent
|
|
48477
|
+
}, {
|
|
48478
|
+
type: t("Non-survival"),
|
|
48479
|
+
value: 100 - survivalPercent
|
|
48480
|
+
}];
|
|
48481
|
+
}, [activityData, t]);
|
|
48482
|
+
React.useMemo(() => {
|
|
48483
|
+
return (title, data) => {
|
|
48484
|
+
if (!data || data.length === 0) {
|
|
48485
|
+
return {
|
|
48486
|
+
title: t("Survival Rate"),
|
|
48487
|
+
items: [{
|
|
48488
|
+
label: t("No Data"),
|
|
48489
|
+
value: '-'
|
|
48490
|
+
}]
|
|
48491
|
+
};
|
|
48492
|
+
}
|
|
48493
|
+
const item = data[0];
|
|
48494
|
+
const value = item?.value || item?.data?.value || 0;
|
|
48495
|
+
const itemType = item?.type || item?.data?.type || t("Survival Rate");
|
|
48496
|
+
|
|
48497
|
+
// Determine color based on item type
|
|
48498
|
+
const itemColor = itemType === t("Survival Rate") ? '#00AEB1' : '#E8EDF3';
|
|
48499
|
+
return {
|
|
48500
|
+
title: t("Survival Rate"),
|
|
48501
|
+
items: [{
|
|
48502
|
+
label: itemType,
|
|
48503
|
+
value: `${value.toFixed(1)}%`,
|
|
48504
|
+
color: itemColor
|
|
48505
|
+
}]
|
|
48506
|
+
};
|
|
48507
|
+
};
|
|
48508
|
+
}, [t]);
|
|
48509
|
+
React.useMemo(() => {
|
|
48510
|
+
return !activityData?.survivalRate && !activityData?.mangroveSurvivalRate;
|
|
48511
|
+
}, [activityData]);
|
|
48512
|
+
return /*#__PURE__*/jsxRuntime.jsx(Widget, {
|
|
48513
|
+
loading: loading,
|
|
48514
|
+
title: t("Survival Rate"),
|
|
48515
|
+
className: "with-border-header h-w-btn-header"
|
|
48516
|
+
});
|
|
48517
|
+
};
|
|
48518
|
+
|
|
48519
|
+
const SeedlingsHeight = ({
|
|
48520
|
+
activityData,
|
|
48521
|
+
loading = false,
|
|
48522
|
+
t = s => s
|
|
48523
|
+
}) => {
|
|
48524
|
+
const heightData = React.useMemo(() => {
|
|
48525
|
+
// Extract seedlings height from activityData
|
|
48526
|
+
// Assuming the data might have averageHeight, seedlingsHeight, or similar
|
|
48527
|
+
const averageHeight = activityData?.averageHeight || activityData?.seedlingsHeight || activityData?.mangroveAverageHeight || 28; // Default from image
|
|
48528
|
+
|
|
48529
|
+
const heightValue = typeof averageHeight === 'number' ? averageHeight : parseFloat(averageHeight) || 28;
|
|
48530
|
+
return [{
|
|
48531
|
+
label: t("Average Height"),
|
|
48532
|
+
value: heightValue
|
|
48533
|
+
}];
|
|
48534
|
+
}, [activityData, t]);
|
|
48535
|
+
const renderTooltipContent = React.useMemo(() => {
|
|
48536
|
+
return (title, data) => {
|
|
48537
|
+
if (!data || data.length === 0) {
|
|
48538
|
+
return {
|
|
48539
|
+
title: t("Average Height"),
|
|
48540
|
+
items: [{
|
|
48541
|
+
label: t("No Data"),
|
|
48542
|
+
value: '-'
|
|
48543
|
+
}]
|
|
48544
|
+
};
|
|
48545
|
+
}
|
|
48546
|
+
const item = data[0];
|
|
48547
|
+
const value = item?.value || item?.data?.value || 0;
|
|
48548
|
+
return {
|
|
48549
|
+
title: t("Average Height"),
|
|
48550
|
+
items: [{
|
|
48551
|
+
label: t("Average Height"),
|
|
48552
|
+
value: `${value.toFixed(1)}cm`,
|
|
48553
|
+
color: '#00AEB1'
|
|
48554
|
+
}]
|
|
48555
|
+
};
|
|
48556
|
+
};
|
|
48557
|
+
}, [t]);
|
|
48558
|
+
const isEmpty = React.useMemo(() => {
|
|
48559
|
+
return !activityData?.averageHeight && !activityData?.seedlingsHeight && !activityData?.mangroveAverageHeight;
|
|
48560
|
+
}, [activityData]);
|
|
48561
|
+
return /*#__PURE__*/jsxRuntime.jsx(Widget, {
|
|
48562
|
+
loading: loading,
|
|
48563
|
+
title: t("Seedlings Height"),
|
|
48564
|
+
className: "with-border-header h-w-btn-header",
|
|
48565
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
48566
|
+
style: {
|
|
48567
|
+
display: 'flex',
|
|
48568
|
+
flexDirection: 'column',
|
|
48569
|
+
minHeight: '250px',
|
|
48570
|
+
padding: '20px 0'
|
|
48571
|
+
},
|
|
48572
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(ColumnChart, {
|
|
48573
|
+
data: isEmpty ? [] : heightData,
|
|
48574
|
+
xFieldKey: "label",
|
|
48575
|
+
yFieldKey: "value",
|
|
48576
|
+
color: "#00AEB1",
|
|
48577
|
+
height: 250,
|
|
48578
|
+
animated: true,
|
|
48579
|
+
renderTooltipContent: renderTooltipContent,
|
|
48580
|
+
yAxis: {
|
|
48581
|
+
min: 0,
|
|
48582
|
+
max: 35,
|
|
48583
|
+
tickMethod: () => [0, 5, 10, 15, 20, 25, 30, 35],
|
|
48584
|
+
label: {
|
|
48585
|
+
formatter: v => `${v}cm`
|
|
48586
|
+
}
|
|
48587
|
+
},
|
|
48588
|
+
xAxis: {
|
|
48589
|
+
label: {
|
|
48590
|
+
formatter: () => ''
|
|
48591
|
+
}
|
|
48592
|
+
},
|
|
48593
|
+
tooltipConfig: {
|
|
48594
|
+
showTitle: true
|
|
48595
|
+
}
|
|
48596
|
+
}), !isEmpty && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
48597
|
+
style: {
|
|
48598
|
+
marginTop: '16px',
|
|
48599
|
+
textAlign: 'center',
|
|
48600
|
+
fontSize: '14px',
|
|
48601
|
+
color: '#475467',
|
|
48602
|
+
fontWeight: 500
|
|
48603
|
+
},
|
|
48604
|
+
children: [t("Average Height"), ": ", heightData[0]?.value.toFixed(0), "cm"]
|
|
48605
|
+
})]
|
|
48606
|
+
})
|
|
48607
|
+
});
|
|
48608
|
+
};
|
|
48609
|
+
|
|
48610
|
+
const Container = styled__default["default"].div`
|
|
48611
|
+
display: grid;
|
|
48612
|
+
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
|
48613
|
+
gap: 24px;
|
|
48614
|
+
width: 100%;
|
|
48615
|
+
|
|
48616
|
+
@media (max-width: 768px) {
|
|
48617
|
+
grid-template-columns: 1fr;
|
|
48618
|
+
}
|
|
48619
|
+
`;
|
|
48620
|
+
const MangroveGrowthAndSurvival = ({
|
|
48621
|
+
activityData,
|
|
48622
|
+
loading = false,
|
|
48623
|
+
t = s => s
|
|
48624
|
+
}) => {
|
|
48625
|
+
return /*#__PURE__*/jsxRuntime.jsx(Widget, {
|
|
48626
|
+
title: t("Mangrove Growth & Survival"),
|
|
48627
|
+
className: "with-border-header h-w-btn-header",
|
|
48628
|
+
children: /*#__PURE__*/jsxRuntime.jsx("section", {
|
|
48629
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(Container, {
|
|
48630
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(PlantedSpecies, {
|
|
48631
|
+
activityData: activityData,
|
|
48632
|
+
loading: loading,
|
|
48633
|
+
t: t
|
|
48634
|
+
}), /*#__PURE__*/jsxRuntime.jsx(SurvivalRate, {
|
|
48635
|
+
activityData: activityData,
|
|
48636
|
+
loading: loading,
|
|
48637
|
+
t: t
|
|
48638
|
+
}), /*#__PURE__*/jsxRuntime.jsx(SeedlingsHeight, {
|
|
48639
|
+
activityData: activityData,
|
|
48640
|
+
loading: loading,
|
|
48641
|
+
t: t
|
|
48642
|
+
})]
|
|
48643
|
+
})
|
|
48644
|
+
})
|
|
48645
|
+
});
|
|
48646
|
+
};
|
|
48647
|
+
|
|
48648
|
+
const MonitoringActivitySummary = ({
|
|
48649
|
+
activityData,
|
|
48650
|
+
supportText,
|
|
48651
|
+
onDownload,
|
|
48652
|
+
downloadDisabled,
|
|
48653
|
+
actionButtons,
|
|
48654
|
+
breadcrumbs,
|
|
48655
|
+
goBackTo,
|
|
48656
|
+
loading,
|
|
48657
|
+
t = () => {}
|
|
48658
|
+
}) => {
|
|
48659
|
+
const keyIndicatorsConfig = React.useMemo(() => getKeyIndicatorsRowConfig({
|
|
48660
|
+
t,
|
|
48661
|
+
data: activityData
|
|
48662
|
+
}), [t, activityData]);
|
|
48663
|
+
|
|
48664
|
+
// Activity Indicators Config - mapped from activityData
|
|
48665
|
+
React.useMemo(() => getActivityIndicatorsConfig(activityData, t), [activityData, t]);
|
|
48666
|
+
|
|
48667
|
+
// Site Conditions Config
|
|
48668
|
+
const siteConditionsConfig = React.useMemo(() => getSiteConditionsConfig({
|
|
48669
|
+
t,
|
|
48670
|
+
data: activityData
|
|
48671
|
+
}), [t, activityData]);
|
|
48672
|
+
console.log({
|
|
48673
|
+
activityData
|
|
48674
|
+
});
|
|
48675
|
+
return /*#__PURE__*/jsxRuntime.jsxs(DashboardLayout, {
|
|
48676
|
+
header: /*#__PURE__*/jsxRuntime.jsx(DAFHeader, {
|
|
48677
|
+
title: 'Monitoring Activity Summary',
|
|
48678
|
+
supportText: supportText || '',
|
|
48679
|
+
onDownload: onDownload,
|
|
48680
|
+
downloadDisabled: downloadDisabled,
|
|
48681
|
+
actionButtons: actionButtons,
|
|
48682
|
+
breadcrumbs: breadcrumbs,
|
|
48683
|
+
goBackTo: goBackTo,
|
|
48684
|
+
loading: loading
|
|
48685
|
+
}),
|
|
48686
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("section", {
|
|
48687
|
+
children: /*#__PURE__*/jsxRuntime.jsx(KeyIndicatorsWidget, {
|
|
48688
|
+
title: t("Key Information"),
|
|
48689
|
+
config: keyIndicatorsConfig,
|
|
48690
|
+
loading: loading
|
|
48691
|
+
})
|
|
48692
|
+
}), /*#__PURE__*/jsxRuntime.jsx(ActivityLocation, {
|
|
48693
|
+
activityData: activityData,
|
|
48694
|
+
loading: loading,
|
|
48695
|
+
t: t
|
|
48696
|
+
}), /*#__PURE__*/jsxRuntime.jsx(KeyIndicatorsWidget, {
|
|
48697
|
+
loading: loading,
|
|
48698
|
+
config: siteConditionsConfig,
|
|
48699
|
+
title: t("straatos::site-conditions"),
|
|
48700
|
+
widgetClassName: "h-w-btn-header"
|
|
48701
|
+
}), /*#__PURE__*/jsxRuntime.jsx(MangroveGrowthAndSurvival, {
|
|
48702
|
+
activityData: activityData,
|
|
48703
|
+
loading: loading,
|
|
48704
|
+
t: t
|
|
48705
|
+
})]
|
|
48706
|
+
});
|
|
48707
|
+
};
|
|
48708
|
+
|
|
47969
48709
|
const useViewUrlParams = ({
|
|
47970
48710
|
params,
|
|
47971
48711
|
push,
|
|
@@ -49058,6 +49798,7 @@ exports.EventsTable = EventsTable;
|
|
|
49058
49798
|
exports.IncidentsTable = IncidentsTable;
|
|
49059
49799
|
exports.LocationsTable = LocationsTable;
|
|
49060
49800
|
exports.MineSummary = MineSummary;
|
|
49801
|
+
exports.MonitoringActivitySummary = MonitoringActivitySummary;
|
|
49061
49802
|
exports.MonitoringCampaignSummary = MonitoringCampaignSummary;
|
|
49062
49803
|
exports.OperatorSummary = OperatorSummary;
|
|
49063
49804
|
exports.OperatorsTable = OperatorsTable;
|