datastake-daf 0.6.783 → 0.6.785
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 +78 -70
- package/dist/hooks/index.js +3 -1
- package/dist/pages/index.js +1082 -270
- package/dist/style/datastake/mapbox-gl.css +330 -0
- package/dist/utils/index.js +67 -0
- package/package.json +1 -1
- package/src/@daf/core/components/Charts/BarChart/index.jsx +1 -1
- package/src/@daf/core/components/Dashboard/Map/ChainIcon/utils.js +2 -2
- package/src/@daf/core/components/Screens/BaseScreen/index.jsx +1 -0
- package/src/@daf/core/components/Select/MultiSelect/index.jsx +4 -2
- package/src/@daf/core/components/Select/MultiSelect/style.js +15 -0
- package/src/@daf/hooks/useGetQueryParams.js +3 -1
- package/src/@daf/pages/Dashboards/UserDashboard/components/ContributionsGraph/hook.js +6 -7
- package/src/@daf/pages/Dashboards/UserDashboard/components/ContributionsGraph/index.jsx +1 -1
- package/src/@daf/pages/Documents/config.js +5 -5
- package/src/@daf/pages/Events/Activities/columns.js +5 -0
- package/src/@daf/pages/Events/Activities/config.js +21 -17
- package/src/@daf/pages/Events/Incidents/columns.js +5 -0
- package/src/@daf/pages/Events/Incidents/config.js +14 -11
- package/src/@daf/pages/Events/columns.js +6 -0
- package/src/@daf/pages/Events/config.js +0 -16
- package/src/@daf/pages/Locations/MineSite/columns.js +5 -1
- package/src/@daf/pages/Locations/MineSite/config.js +21 -24
- package/src/@daf/pages/Partners/columns.js +3 -1
- package/src/@daf/pages/Partners/config.js +13 -9
- package/src/@daf/pages/Partners/create.jsx +5 -2
- package/src/@daf/pages/Partners/edit.jsx +4 -2
- package/src/@daf/pages/Stakeholders/Operators/columns.js +6 -0
- package/src/@daf/pages/Stakeholders/Operators/config.js +8 -8
- package/src/@daf/pages/Stakeholders/Workers/columns.js +19 -13
- package/src/@daf/pages/Stakeholders/Workers/config.js +8 -23
- 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/pages/Summary/Minesite/index.jsx +6 -4
- package/src/@daf/pages/Summary/Operator/components/TradeRelationships/index.js +2 -0
- package/src/@daf/pages/Summary/Operator/index.jsx +6 -3
- package/src/@daf/pages/TablePage/index.jsx +8 -2
- package/src/@daf/pages/Template/components/LinkingTemplate/config.js +14 -1
- package/src/@daf/pages/Template/components/LinkingTemplate/index.jsx +4 -2
- package/src/@daf/pages/Template/index.jsx +1 -10
- package/src/@daf/pages/View/hooks/usePrepareForm.js +4 -4
- package/src/@daf/pages/View/index.jsx +2 -1
- package/src/@daf/utils/numbers.js +57 -0
- package/src/constants/locales/en/translation.js +3 -0
- package/src/constants/locales/fr/translation.js +3 -0
- package/src/constants/locales/sp/translation.js +3 -0
- package/src/pages.js +1 -0
- package/src/utils.js +1 -1
|
@@ -31,7 +31,7 @@ export const usePrepareForm = ({
|
|
|
31
31
|
} = JSON.parse(JSON.stringify(allData[dKey][nKey] || {}));
|
|
32
32
|
|
|
33
33
|
if (data.datastakeId === id || id === "user") {
|
|
34
|
-
|
|
34
|
+
// if (viewConfig.linkingSubjects.includes(namespace)) {
|
|
35
35
|
setForm({
|
|
36
36
|
...form,
|
|
37
37
|
linking: {
|
|
@@ -41,9 +41,9 @@ export const usePrepareForm = ({
|
|
|
41
41
|
template: "linkingSubjects",
|
|
42
42
|
},
|
|
43
43
|
});
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
// } else {
|
|
45
|
+
// setForm(form);
|
|
46
|
+
// }
|
|
47
47
|
setData(data);
|
|
48
48
|
setGroups(config.groups || {});
|
|
49
49
|
setLinkingForms(linkingForms);
|
|
@@ -227,13 +227,14 @@ const View = ({
|
|
|
227
227
|
extraButtons={extraPageActions}
|
|
228
228
|
addedHeaderFirst
|
|
229
229
|
addedHeader={
|
|
230
|
-
<div className="flex flex-row gap-4"
|
|
230
|
+
<div className="flex flex-row gap-4">
|
|
231
231
|
<Multiselect
|
|
232
232
|
options={[...sourceOptions]}
|
|
233
233
|
isAvatarGroup
|
|
234
234
|
selectionType="checkbox"
|
|
235
235
|
key={partners?.length}
|
|
236
236
|
canUnselectLast={false}
|
|
237
|
+
isSingle
|
|
237
238
|
onChange={(selected) => {
|
|
238
239
|
setSelectedPartners((prev) => ({
|
|
239
240
|
...prev,
|
|
@@ -32,3 +32,60 @@ export const renderPercentage = (val) => {
|
|
|
32
32
|
|
|
33
33
|
return val + "%";
|
|
34
34
|
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Calculates stat change object for StatCard component based on current and previous values
|
|
38
|
+
* @param {Object} data - Object with current and previous values
|
|
39
|
+
* @param {number} data.current - Current value
|
|
40
|
+
* @param {number} data.previous - Previous value
|
|
41
|
+
* @param {Object} options - Optional configuration
|
|
42
|
+
* @param {string} options.tooltipText - Custom tooltip text
|
|
43
|
+
* @param {string} options.format - Format type: 'percentage' (default) or 'absolute'
|
|
44
|
+
* @param {number} options.decimalPlaces - Number of decimal places for percentage (default: 1)
|
|
45
|
+
* @returns {Object|null} Change object for StatCard or null if data is invalid
|
|
46
|
+
*/
|
|
47
|
+
export const calculateStatChange = (data, options = {}) => {
|
|
48
|
+
if (!data || typeof data !== 'object') {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const { current, previous } = data;
|
|
53
|
+
|
|
54
|
+
// Validate that both values are numbers
|
|
55
|
+
if (typeof current !== 'number' || typeof previous !== 'number') {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// If previous is 0, we can't calculate percentage change
|
|
60
|
+
if (previous === 0) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const {
|
|
65
|
+
tooltipText,
|
|
66
|
+
format = 'percentage',
|
|
67
|
+
decimalPlaces = 1,
|
|
68
|
+
} = options;
|
|
69
|
+
|
|
70
|
+
// Calculate the difference
|
|
71
|
+
const difference = current - previous;
|
|
72
|
+
const isPositive = difference >= 0;
|
|
73
|
+
const direction = isPositive ? 'up' : 'down';
|
|
74
|
+
|
|
75
|
+
// Format the value
|
|
76
|
+
let value;
|
|
77
|
+
if (format === 'absolute') {
|
|
78
|
+
// Show absolute difference
|
|
79
|
+
value = Math.abs(difference).toLocaleString();
|
|
80
|
+
} else {
|
|
81
|
+
// Show percentage change
|
|
82
|
+
const percentageChange = (Math.abs(difference) / previous) * 100;
|
|
83
|
+
value = `${percentageChange.toFixed(decimalPlaces)}%`;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
value,
|
|
88
|
+
direction,
|
|
89
|
+
tooltipText: tooltipText || undefined,
|
|
90
|
+
};
|
|
91
|
+
};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
const sp = {
|
|
2
|
+
"Site": "Sitio",
|
|
3
|
+
"Production Sites": "Centros de producción",
|
|
4
|
+
"Type of account": "Tipo de cuenta",
|
|
2
5
|
"Identified Customers": "Clientes identificados",
|
|
3
6
|
"Identified Suppliers": "Proveedores identificados",
|
|
4
7
|
"Associated Mine Sites": "Sitios mineros asociados",
|
package/src/pages.js
CHANGED
|
@@ -19,6 +19,7 @@ export { default as TablePage } from './@daf/pages/TablePage/index.jsx';
|
|
|
19
19
|
export { default as OperatorSummary } from './@daf/pages/Summary/Operator/index.jsx';
|
|
20
20
|
export { default as RestorationActivitySummary } from './@daf/pages/Summary/Activities/Restoration/index.jsx';
|
|
21
21
|
export { default as PlantingCycleSummary } from './@daf/pages/Summary/Activities/PlantingCycle/index.jsx';
|
|
22
|
+
export { default as MonitoringCampaignSummary } from './@daf/pages/Summary/Activities/MonitoringCampaign/index.jsx';
|
|
22
23
|
export { default as MineSummary } from './@daf/pages/Summary/Minesite/index.jsx';
|
|
23
24
|
|
|
24
25
|
// View
|
package/src/utils.js
CHANGED
|
@@ -31,7 +31,7 @@ export { convertUndefinedToNull, hasKeyInObject, removeKeysFromObject } from './
|
|
|
31
31
|
|
|
32
32
|
export { default as ErrorFormat, formatErrors } from './helpers/ErrorFormater'
|
|
33
33
|
|
|
34
|
-
export { renderNumber, renderPercentage } from "./@daf/utils/numbers.js"
|
|
34
|
+
export { renderNumber, renderPercentage, calculateStatChange } from "./@daf/utils/numbers.js"
|
|
35
35
|
|
|
36
36
|
export { MessageTypes, displayMessage} from './helpers/messages.js'
|
|
37
37
|
|