datastake-daf 0.6.781 → 0.6.782
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 +158 -156
- package/dist/pages/index.js +3 -3
- package/package.json +1 -1
- package/src/@daf/pages/Summary/Activities/PlantingCycle/components/CycleOutcomes/index.jsx +1 -1
- package/src/@daf/pages/Summary/Activities/PlantingCycle/components/PlantingLocations/index.jsx +2 -2
package/dist/components/index.js
CHANGED
|
@@ -8486,20 +8486,22 @@ const useHeader = _ref => {
|
|
|
8486
8486
|
const {
|
|
8487
8487
|
useToken: useToken$m
|
|
8488
8488
|
} = antd.theme;
|
|
8489
|
-
function BreadCrumbs({
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
|
|
8489
|
+
function BreadCrumbs(_ref) {
|
|
8490
|
+
let {
|
|
8491
|
+
breadcrumbs = [],
|
|
8492
|
+
mainContWidth = 0
|
|
8493
|
+
} = _ref;
|
|
8493
8494
|
const [splitIndex, setSplitIndex] = React.useState(0);
|
|
8494
8495
|
const {
|
|
8495
8496
|
token
|
|
8496
8497
|
} = useToken$m();
|
|
8497
|
-
const _renderBreadcrumb = (b, i, isLast
|
|
8498
|
+
const _renderBreadcrumb = function (b, i, isLast) {
|
|
8499
|
+
let noOnClickLast = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
8498
8500
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
8499
8501
|
className: "flex breadcrumb-item",
|
|
8500
|
-
onClick: noOnClickLast && isLast ? undefined : b
|
|
8502
|
+
onClick: noOnClickLast && isLast ? undefined : b === null || b === void 0 ? void 0 : b.onClick,
|
|
8501
8503
|
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
8502
|
-
children: b
|
|
8504
|
+
children: b === null || b === void 0 ? void 0 : b.label
|
|
8503
8505
|
}), !isLast && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
8504
8506
|
className: "flex flex-column justify-content-center",
|
|
8505
8507
|
children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
|
|
@@ -8509,7 +8511,7 @@ function BreadCrumbs({
|
|
|
8509
8511
|
color: token.baseGray50
|
|
8510
8512
|
})
|
|
8511
8513
|
})]
|
|
8512
|
-
},
|
|
8514
|
+
}, "breadcrumb-item-".concat(i));
|
|
8513
8515
|
};
|
|
8514
8516
|
React.useEffect(() => {
|
|
8515
8517
|
const _placeholderCont = document.getElementById("header-breadcrumbs");
|
|
@@ -8552,7 +8554,7 @@ function BreadCrumbs({
|
|
|
8552
8554
|
placement: "bottomRight",
|
|
8553
8555
|
menu: {
|
|
8554
8556
|
items: groupedBreadCrumbs[2].map((it, i) => ({
|
|
8555
|
-
key:
|
|
8557
|
+
key: "items-".concat(i),
|
|
8556
8558
|
label: it.label,
|
|
8557
8559
|
onClick: it.onClick
|
|
8558
8560
|
}))
|
|
@@ -9544,24 +9546,29 @@ const processConditionalTableKeys = (tableKeys, item) => {
|
|
|
9544
9546
|
});
|
|
9545
9547
|
return processedKeys;
|
|
9546
9548
|
};
|
|
9547
|
-
const renderFieldData = (type, value, user, config
|
|
9549
|
+
const renderFieldData = function (type, value, user, config) {
|
|
9550
|
+
let getApiBaseUrl = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : () => {};
|
|
9551
|
+
let getAppHeader = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : () => {};
|
|
9552
|
+
let app = arguments.length > 6 ? arguments[6] : undefined;
|
|
9553
|
+
let allValues = arguments.length > 7 ? arguments[7] : undefined;
|
|
9554
|
+
let formValues = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : {};
|
|
9548
9555
|
switch (type) {
|
|
9549
9556
|
case 'year':
|
|
9550
9557
|
return value !== '-' ? renderDateFormatted(value, 'YYYY', 'en') : '-';
|
|
9551
9558
|
case 'date':
|
|
9552
9559
|
{
|
|
9553
|
-
const language = user
|
|
9560
|
+
const language = user !== null && user !== void 0 && user.language && (user === null || user === void 0 ? void 0 : user.language) === 'sp' ? 'es' : user === null || user === void 0 ? void 0 : user.language;
|
|
9554
9561
|
return value !== '-' ? renderDateFormatted(value, 'DD MMM YYYY', language || 'en') : '-';
|
|
9555
9562
|
}
|
|
9556
9563
|
case 'select':
|
|
9557
9564
|
{
|
|
9558
|
-
const options = config
|
|
9565
|
+
const options = (config === null || config === void 0 ? void 0 : config.options) || [];
|
|
9559
9566
|
const option = findOptions(value, options);
|
|
9560
9567
|
return option;
|
|
9561
9568
|
}
|
|
9562
9569
|
case 'multiselect':
|
|
9563
9570
|
{
|
|
9564
|
-
const options = config
|
|
9571
|
+
const options = (config === null || config === void 0 ? void 0 : config.options) || [];
|
|
9565
9572
|
const _val = typeof value === 'string' ? value.split(',').map(v => v.trim()) : value;
|
|
9566
9573
|
const option = findOptions(_val, options);
|
|
9567
9574
|
return option.join(', ');
|
|
@@ -9576,7 +9583,7 @@ const renderFieldData = (type, value, user, config, getApiBaseUrl = () => {}, ge
|
|
|
9576
9583
|
formValues: formValues
|
|
9577
9584
|
});
|
|
9578
9585
|
case 'percentage':
|
|
9579
|
-
return value === '-' || value === null || value === undefined ? '-' :
|
|
9586
|
+
return value === '-' || value === null || value === undefined ? '-' : "".concat(value, " %");
|
|
9580
9587
|
case 'geolocation':
|
|
9581
9588
|
{
|
|
9582
9589
|
const val = JSON.parse(value) || {};
|
|
@@ -9590,7 +9597,7 @@ const renderFieldData = (type, value, user, config, getApiBaseUrl = () => {}, ge
|
|
|
9590
9597
|
case 'upload':
|
|
9591
9598
|
case 'videoUpload':
|
|
9592
9599
|
{
|
|
9593
|
-
const documentName = allValues
|
|
9600
|
+
const documentName = allValues === null || allValues === void 0 ? void 0 : allValues.map(item => item === null || item === void 0 ? void 0 : item.name).join(', ');
|
|
9594
9601
|
return documentName;
|
|
9595
9602
|
}
|
|
9596
9603
|
default:
|
|
@@ -9598,25 +9605,27 @@ const renderFieldData = (type, value, user, config, getApiBaseUrl = () => {}, ge
|
|
|
9598
9605
|
}
|
|
9599
9606
|
};
|
|
9600
9607
|
|
|
9601
|
-
const renderValue =
|
|
9602
|
-
|
|
9603
|
-
|
|
9604
|
-
|
|
9605
|
-
|
|
9606
|
-
|
|
9607
|
-
|
|
9608
|
-
|
|
9609
|
-
|
|
9610
|
-
|
|
9611
|
-
|
|
9612
|
-
|
|
9608
|
+
const renderValue = _ref => {
|
|
9609
|
+
let {
|
|
9610
|
+
value,
|
|
9611
|
+
hasChildren,
|
|
9612
|
+
config,
|
|
9613
|
+
user,
|
|
9614
|
+
getApiBaseUrl = () => {},
|
|
9615
|
+
getAppHeader = () => {},
|
|
9616
|
+
app,
|
|
9617
|
+
allData = {}
|
|
9618
|
+
} = _ref;
|
|
9619
|
+
if ((config === null || config === void 0 ? void 0 : config.type) === 'groupInputs') {
|
|
9620
|
+
if (!(config !== null && config !== void 0 && config.inputs)) return null;
|
|
9613
9621
|
const inputKeys = Object.keys(config.inputs).sort((a, b) => {
|
|
9614
|
-
|
|
9615
|
-
const
|
|
9622
|
+
var _config$inputs$a, _config$inputs$b;
|
|
9623
|
+
const positionA = ((_config$inputs$a = config.inputs[a]) === null || _config$inputs$a === void 0 ? void 0 : _config$inputs$a.position) || 0;
|
|
9624
|
+
const positionB = ((_config$inputs$b = config.inputs[b]) === null || _config$inputs$b === void 0 ? void 0 : _config$inputs$b.position) || 0;
|
|
9616
9625
|
return positionA - positionB;
|
|
9617
9626
|
});
|
|
9618
9627
|
const values = inputKeys.map(inputKey => {
|
|
9619
|
-
let inputValue = value
|
|
9628
|
+
let inputValue = value === null || value === void 0 ? void 0 : value[inputKey];
|
|
9620
9629
|
if (inputValue === null || inputValue === undefined || inputValue === '') {
|
|
9621
9630
|
return '';
|
|
9622
9631
|
} else if (typeof inputValue === 'object' && inputValue !== null) {
|
|
@@ -9657,8 +9666,8 @@ const renderValue = ({
|
|
|
9657
9666
|
} else {
|
|
9658
9667
|
displayValue = String(value);
|
|
9659
9668
|
}
|
|
9660
|
-
const fieldType = config
|
|
9661
|
-
let cssClass =
|
|
9669
|
+
const fieldType = (config === null || config === void 0 ? void 0 : config.type) || 'text';
|
|
9670
|
+
let cssClass = "tree-value ".concat(fieldType, "-type");
|
|
9662
9671
|
if (displayValue === '-') {
|
|
9663
9672
|
cssClass += ' empty';
|
|
9664
9673
|
}
|
|
@@ -9668,19 +9677,21 @@ const renderValue = ({
|
|
|
9668
9677
|
children: displayValue
|
|
9669
9678
|
});
|
|
9670
9679
|
};
|
|
9671
|
-
const determineHasChildren =
|
|
9672
|
-
|
|
9673
|
-
|
|
9674
|
-
|
|
9675
|
-
|
|
9680
|
+
const determineHasChildren = _ref2 => {
|
|
9681
|
+
var _config$meta;
|
|
9682
|
+
let {
|
|
9683
|
+
config,
|
|
9684
|
+
level
|
|
9685
|
+
} = _ref2;
|
|
9686
|
+
if ((config === null || config === void 0 ? void 0 : config.type) === 'groupInputs') {
|
|
9676
9687
|
return false;
|
|
9677
9688
|
}
|
|
9678
|
-
if (config
|
|
9689
|
+
if ((config === null || config === void 0 ? void 0 : config.type) === 'header' && config !== null && config !== void 0 && config.inputs && Object.keys(config.inputs).length > 0) {
|
|
9679
9690
|
return true;
|
|
9680
9691
|
}
|
|
9681
|
-
return config
|
|
9692
|
+
return (config === null || config === void 0 ? void 0 : config.inputs) || (config === null || config === void 0 ? void 0 : config.type) === 'group' || (config === null || config === void 0 ? void 0 : config.type) === 'dataLinkGroup' || (config === null || config === void 0 ? void 0 : config.type) === 'section' || (config === null || config === void 0 ? void 0 : config.type) === 'ajaxSubGroup' ||
|
|
9682
9693
|
// Add this line
|
|
9683
|
-
config
|
|
9694
|
+
(config === null || config === void 0 ? void 0 : config.type) === 'dataLink' && (config === null || config === void 0 || (_config$meta = config.meta) === null || _config$meta === void 0 ? void 0 : _config$meta.tableKeys) || level === 0 && config && typeof config === 'object' && Object.keys(config).some(key => key !== 'id' && key !== 'label' && key !== 'position' && key !== 'subTitle' && typeof config[key] === 'object' && config[key] !== null);
|
|
9684
9695
|
};
|
|
9685
9696
|
|
|
9686
9697
|
const sortByPosition = (items, getConfig) => {
|
|
@@ -9714,19 +9725,18 @@ const resolveDynamicLabel = (labelConfig, item, defaultLabel) => {
|
|
|
9714
9725
|
return labelConfig || defaultLabel;
|
|
9715
9726
|
};
|
|
9716
9727
|
|
|
9717
|
-
const handleSectionChildren =
|
|
9718
|
-
|
|
9719
|
-
|
|
9720
|
-
|
|
9721
|
-
|
|
9722
|
-
|
|
9723
|
-
|
|
9724
|
-
|
|
9725
|
-
|
|
9726
|
-
|
|
9727
|
-
|
|
9728
|
-
|
|
9729
|
-
} = _ref;
|
|
9728
|
+
const handleSectionChildren = ({
|
|
9729
|
+
config,
|
|
9730
|
+
allData,
|
|
9731
|
+
level,
|
|
9732
|
+
t,
|
|
9733
|
+
rootForm,
|
|
9734
|
+
user,
|
|
9735
|
+
getApiBaseUrl = () => {},
|
|
9736
|
+
getAppHeader = () => {},
|
|
9737
|
+
app,
|
|
9738
|
+
TreeNodeComponent
|
|
9739
|
+
}) => {
|
|
9730
9740
|
if (!(level === 0 && config && typeof config === 'object')) {
|
|
9731
9741
|
return null;
|
|
9732
9742
|
}
|
|
@@ -9740,14 +9750,14 @@ const handleSectionChildren = _ref => {
|
|
|
9740
9750
|
let fieldValue;
|
|
9741
9751
|
|
|
9742
9752
|
// Determine field value based on type
|
|
9743
|
-
if (fieldConfig.type === 'dataLinkGroup' && Array.isArray(allData
|
|
9753
|
+
if (fieldConfig.type === 'dataLinkGroup' && Array.isArray(allData?.[fieldKey])) {
|
|
9744
9754
|
fieldValue = allData[fieldKey];
|
|
9745
|
-
} else if (fieldConfig.type === 'dataLinkGroup' && allData
|
|
9755
|
+
} else if (fieldConfig.type === 'dataLinkGroup' && allData?.[fieldKey]) {
|
|
9746
9756
|
fieldValue = allData[fieldKey];
|
|
9747
9757
|
} else if (fieldConfig.type === 'group') {
|
|
9748
9758
|
fieldValue = {};
|
|
9749
9759
|
} else {
|
|
9750
|
-
fieldValue = allData
|
|
9760
|
+
fieldValue = allData?.[fieldKey];
|
|
9751
9761
|
}
|
|
9752
9762
|
return /*#__PURE__*/jsxRuntime.jsx(TreeNodeComponent, {
|
|
9753
9763
|
nodeKey: fieldKey,
|
|
@@ -9766,30 +9776,28 @@ const handleSectionChildren = _ref => {
|
|
|
9766
9776
|
});
|
|
9767
9777
|
};
|
|
9768
9778
|
|
|
9769
|
-
const handleArrayChildren =
|
|
9770
|
-
|
|
9771
|
-
|
|
9772
|
-
|
|
9773
|
-
|
|
9774
|
-
|
|
9775
|
-
|
|
9776
|
-
|
|
9777
|
-
|
|
9778
|
-
|
|
9779
|
-
|
|
9780
|
-
|
|
9781
|
-
|
|
9782
|
-
|
|
9783
|
-
} = _ref;
|
|
9779
|
+
const handleArrayChildren = ({
|
|
9780
|
+
value,
|
|
9781
|
+
config,
|
|
9782
|
+
label,
|
|
9783
|
+
level,
|
|
9784
|
+
t,
|
|
9785
|
+
rootForm,
|
|
9786
|
+
allData,
|
|
9787
|
+
user,
|
|
9788
|
+
getApiBaseUrl = () => {},
|
|
9789
|
+
getAppHeader = () => {},
|
|
9790
|
+
app,
|
|
9791
|
+
TreeNodeComponent
|
|
9792
|
+
}) => {
|
|
9784
9793
|
if (!Array.isArray(value)) {
|
|
9785
9794
|
return null;
|
|
9786
9795
|
}
|
|
9787
9796
|
return value.map((item, itemIndex) => /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
9788
9797
|
className: "array-item",
|
|
9789
9798
|
children: Object.keys(config.inputs).sort((a, b) => {
|
|
9790
|
-
|
|
9791
|
-
const
|
|
9792
|
-
const positionB = ((_config$inputs$b = config.inputs[b]) === null || _config$inputs$b === void 0 ? void 0 : _config$inputs$b.position) || 0;
|
|
9799
|
+
const positionA = config.inputs[a]?.position || 0;
|
|
9800
|
+
const positionB = config.inputs[b]?.position || 0;
|
|
9793
9801
|
return positionA - positionB;
|
|
9794
9802
|
}).map(subInputKey => {
|
|
9795
9803
|
const subInputConfig = config.inputs[subInputKey];
|
|
@@ -9807,9 +9815,9 @@ const handleArrayChildren = _ref => {
|
|
|
9807
9815
|
getApiBaseUrl: getApiBaseUrl,
|
|
9808
9816
|
getAppHeader: getAppHeader,
|
|
9809
9817
|
app: app
|
|
9810
|
-
},
|
|
9818
|
+
}, `${itemIndex}-${subInputKey}`);
|
|
9811
9819
|
})
|
|
9812
|
-
},
|
|
9820
|
+
}, `${itemIndex}`));
|
|
9813
9821
|
};
|
|
9814
9822
|
|
|
9815
9823
|
const noDafApps = ['tif', 'cukura']; //PACKAGE_CHANGE_LATER (remove sbg)
|
|
@@ -9954,44 +9962,44 @@ function useAjaxModal$2({
|
|
|
9954
9962
|
}
|
|
9955
9963
|
|
|
9956
9964
|
const mergeObject = obj => {
|
|
9957
|
-
return Object.entries(obj || {}).reduce((acc,
|
|
9958
|
-
let [key, value] = _ref;
|
|
9965
|
+
return Object.entries(obj || {}).reduce((acc, [key, value]) => {
|
|
9959
9966
|
if (typeof value === "object" && !Array.isArray(value) && value !== null) {
|
|
9960
|
-
return
|
|
9967
|
+
return {
|
|
9968
|
+
...acc,
|
|
9969
|
+
...value
|
|
9970
|
+
};
|
|
9961
9971
|
}
|
|
9962
|
-
return
|
|
9972
|
+
return {
|
|
9973
|
+
...acc,
|
|
9963
9974
|
[key]: value
|
|
9964
|
-
}
|
|
9975
|
+
};
|
|
9965
9976
|
}, {});
|
|
9966
9977
|
};
|
|
9967
|
-
const handleDataLinkGroupWithTableKeys =
|
|
9968
|
-
|
|
9969
|
-
|
|
9970
|
-
|
|
9971
|
-
|
|
9972
|
-
|
|
9973
|
-
|
|
9974
|
-
|
|
9975
|
-
|
|
9976
|
-
|
|
9977
|
-
|
|
9978
|
-
|
|
9979
|
-
|
|
9980
|
-
|
|
9981
|
-
|
|
9982
|
-
TreeNodeComponent
|
|
9983
|
-
} = _ref2;
|
|
9978
|
+
const handleDataLinkGroupWithTableKeys = ({
|
|
9979
|
+
config,
|
|
9980
|
+
inputConfig,
|
|
9981
|
+
inputKey,
|
|
9982
|
+
value,
|
|
9983
|
+
level,
|
|
9984
|
+
t,
|
|
9985
|
+
rootForm,
|
|
9986
|
+
allData,
|
|
9987
|
+
user,
|
|
9988
|
+
getApiBaseUrl = () => {},
|
|
9989
|
+
getAppHeader = () => {},
|
|
9990
|
+
app,
|
|
9991
|
+
TreeNodeComponent
|
|
9992
|
+
}) => {
|
|
9984
9993
|
if (!(config.type === 'dataLinkGroup' || config.type === 'dataLink')) {
|
|
9985
9994
|
return null;
|
|
9986
9995
|
}
|
|
9987
|
-
if (
|
|
9996
|
+
if (inputConfig?.type !== 'dataLink' || !inputConfig?.meta?.tableKeys) {
|
|
9988
9997
|
const parentInputKeys = Object.keys(config.inputs || {});
|
|
9989
9998
|
const isHandledBySiblingDataLink = parentInputKeys.some(otherInputKey => {
|
|
9990
9999
|
const otherConfig = config.inputs[otherInputKey];
|
|
9991
|
-
if (
|
|
9992
|
-
|
|
9993
|
-
const
|
|
9994
|
-
const additionalTableKeys = ((_config$meta = config.meta) === null || _config$meta === void 0 ? void 0 : _config$meta.additionalTableKeys) || [];
|
|
10000
|
+
if (otherConfig?.type === 'dataLink') {
|
|
10001
|
+
const siblingTableKeys = otherConfig?.meta?.tableKeys || [];
|
|
10002
|
+
const additionalTableKeys = config.meta?.additionalTableKeys || [];
|
|
9995
10003
|
const allSiblingKeys = [...siblingTableKeys, ...additionalTableKeys];
|
|
9996
10004
|
return allSiblingKeys.includes(inputKey) && otherInputKey !== inputKey;
|
|
9997
10005
|
}
|
|
@@ -10005,26 +10013,23 @@ const handleDataLinkGroupWithTableKeys = _ref2 => {
|
|
|
10005
10013
|
return null;
|
|
10006
10014
|
}
|
|
10007
10015
|
const tableKeys = inputConfig.meta.tableKeys;
|
|
10008
|
-
const additionalTableKeys =
|
|
10016
|
+
const additionalTableKeys = config.meta?.additionalTableKeys || [];
|
|
10009
10017
|
const parentInputKeys = Object.keys(config.inputs || {});
|
|
10010
10018
|
const siblingInputsMatchingTableKeys = parentInputKeys.filter(siblingKey => siblingKey !== inputKey).filter(siblingKey => tableKeys.includes(siblingKey) || additionalTableKeys.includes(siblingKey));
|
|
10011
10019
|
[...new Set([...tableKeys, ...siblingInputsMatchingTableKeys])];
|
|
10012
|
-
const isAjaxModal = React.useMemo(() =>
|
|
10013
|
-
var _inputConfig$meta2;
|
|
10014
|
-
return !!(inputConfig !== null && inputConfig !== void 0 && (_inputConfig$meta2 = inputConfig.meta) !== null && _inputConfig$meta2 !== void 0 && _inputConfig$meta2.namespace);
|
|
10015
|
-
}, [inputConfig]);
|
|
10020
|
+
const isAjaxModal = React.useMemo(() => !!inputConfig?.meta?.namespace, [inputConfig]);
|
|
10016
10021
|
const ajaxModalValues = useAjaxModal$2({
|
|
10017
10022
|
name: inputKey,
|
|
10018
10023
|
user,
|
|
10019
|
-
namespace: inputConfig
|
|
10020
|
-
skipFetch: inputConfig
|
|
10024
|
+
namespace: inputConfig?.meta?.namespace,
|
|
10025
|
+
skipFetch: inputConfig?.meta?.skipFetch,
|
|
10021
10026
|
isAjaxModal,
|
|
10022
|
-
formScope: inputConfig
|
|
10027
|
+
formScope: inputConfig?.meta?.formScope,
|
|
10023
10028
|
APP: app,
|
|
10024
10029
|
apiBaseUrl: getApiBaseUrl(),
|
|
10025
10030
|
_getAppHeader: getAppHeader
|
|
10026
10031
|
});
|
|
10027
|
-
const dataLinkForm = ajaxModalValues
|
|
10032
|
+
const dataLinkForm = ajaxModalValues?.form;
|
|
10028
10033
|
const createInputsAndValues = item => {
|
|
10029
10034
|
const inputs = {};
|
|
10030
10035
|
const values = {};
|
|
@@ -10036,12 +10041,12 @@ const handleDataLinkGroupWithTableKeys = _ref2 => {
|
|
|
10036
10041
|
'videos': 'Video'
|
|
10037
10042
|
};
|
|
10038
10043
|
tableKeys.filter(tableKey => tableKey !== 'datastakeId').forEach(tableKey => {
|
|
10039
|
-
|
|
10040
|
-
const formInputConfig = (dataLinkForm === null || dataLinkForm === void 0 ? void 0 : dataLinkForm[tableKey]) || (dataLinkForm === null || dataLinkForm === void 0 || (_dataLinkForm$identif = dataLinkForm['identification']) === null || _dataLinkForm$identif === void 0 ? void 0 : _dataLinkForm$identif[tableKey]);
|
|
10044
|
+
const formInputConfig = dataLinkForm?.[tableKey] || dataLinkForm?.['identification']?.[tableKey];
|
|
10041
10045
|
if (formInputConfig) {
|
|
10042
|
-
inputs[tableKey] =
|
|
10046
|
+
inputs[tableKey] = {
|
|
10047
|
+
...formInputConfig,
|
|
10043
10048
|
label: uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : formInputConfig.label || formInputConfig.tableLabel || tableKey
|
|
10044
|
-
}
|
|
10049
|
+
};
|
|
10045
10050
|
if (formInputConfig.label && typeof formInputConfig.label === 'object') {
|
|
10046
10051
|
const dynamicLabelKeys = Object.keys(formInputConfig.label);
|
|
10047
10052
|
let resolvedLabel = null;
|
|
@@ -10049,7 +10054,7 @@ const handleDataLinkGroupWithTableKeys = _ref2 => {
|
|
|
10049
10054
|
const parts = labelKey.split(' is ');
|
|
10050
10055
|
if (parts.length === 2) {
|
|
10051
10056
|
const [conditionKey, conditionValue] = parts;
|
|
10052
|
-
if (
|
|
10057
|
+
if (item?.[conditionKey] === conditionValue) {
|
|
10053
10058
|
resolvedLabel = formInputConfig.label[labelKey];
|
|
10054
10059
|
break;
|
|
10055
10060
|
}
|
|
@@ -10057,37 +10062,37 @@ const handleDataLinkGroupWithTableKeys = _ref2 => {
|
|
|
10057
10062
|
}
|
|
10058
10063
|
inputs[tableKey].label = resolvedLabel || Object.values(formInputConfig.label)[0] || (uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : tableKey);
|
|
10059
10064
|
}
|
|
10060
|
-
values[tableKey] = item
|
|
10065
|
+
values[tableKey] = item?.[tableKey];
|
|
10061
10066
|
} else {
|
|
10062
|
-
var _item$linking;
|
|
10063
10067
|
inputs[tableKey] = {
|
|
10064
10068
|
label: uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : tableKey,
|
|
10065
|
-
type: inputConfig
|
|
10069
|
+
type: inputConfig?.type
|
|
10066
10070
|
};
|
|
10067
|
-
values[tableKey] =
|
|
10071
|
+
values[tableKey] = item?.linking?.SCL?.[item?.[tableKey]]?.name || item?.[tableKey];
|
|
10068
10072
|
}
|
|
10069
10073
|
});
|
|
10070
10074
|
siblingInputsMatchingTableKeys.forEach(siblingKey => {
|
|
10071
10075
|
const siblingConfig = config.inputs[siblingKey];
|
|
10072
10076
|
if (siblingConfig) {
|
|
10073
|
-
inputs[siblingKey] =
|
|
10077
|
+
inputs[siblingKey] = {
|
|
10078
|
+
...siblingConfig,
|
|
10074
10079
|
label: siblingConfig.label || siblingKey
|
|
10075
|
-
}
|
|
10076
|
-
values[siblingKey] = item
|
|
10080
|
+
};
|
|
10081
|
+
values[siblingKey] = item?.[siblingKey];
|
|
10077
10082
|
}
|
|
10078
10083
|
});
|
|
10079
|
-
if (dataLinkForm
|
|
10084
|
+
if (dataLinkForm?.identification && typeof dataLinkForm.identification === 'object') {
|
|
10080
10085
|
Object.keys(dataLinkForm.identification).filter(fieldKey => fieldKey !== 'datastakeId' && !tableKeys.includes(fieldKey)).filter(fieldKey => {
|
|
10081
10086
|
const formInputConfig = dataLinkForm.identification[fieldKey];
|
|
10082
10087
|
return formInputConfig && typeof formInputConfig === 'object' && !Array.isArray(formInputConfig);
|
|
10083
10088
|
}).forEach(fieldKey => {
|
|
10084
|
-
var _item$linking2;
|
|
10085
10089
|
const formInputConfig = dataLinkForm.identification[fieldKey];
|
|
10086
|
-
inputs[fieldKey] =
|
|
10090
|
+
inputs[fieldKey] = {
|
|
10091
|
+
...formInputConfig,
|
|
10087
10092
|
label: uploadTypeFields.includes(fieldKey) ? uploadTypeLabels[fieldKey] : formInputConfig.label || formInputConfig.tableLabel || fieldKey
|
|
10088
|
-
}
|
|
10089
|
-
if (formInputConfig
|
|
10090
|
-
const dynamicLabelKeys = Object.keys(formInputConfig
|
|
10093
|
+
};
|
|
10094
|
+
if (formInputConfig?.label && typeof formInputConfig?.label === 'object') {
|
|
10095
|
+
const dynamicLabelKeys = Object.keys(formInputConfig?.label);
|
|
10091
10096
|
let resolvedLabel = null;
|
|
10092
10097
|
for (const labelKey of dynamicLabelKeys) {
|
|
10093
10098
|
const parts = labelKey.split(' is ');
|
|
@@ -10096,7 +10101,7 @@ const handleDataLinkGroupWithTableKeys = _ref2 => {
|
|
|
10096
10101
|
const flattenedItem = Object.assign({}, item.location, {
|
|
10097
10102
|
address: item.address
|
|
10098
10103
|
});
|
|
10099
|
-
if (
|
|
10104
|
+
if (flattenedItem?.[conditionKey] === conditionValue) {
|
|
10100
10105
|
resolvedLabel = formInputConfig.label[labelKey];
|
|
10101
10106
|
break;
|
|
10102
10107
|
}
|
|
@@ -10104,7 +10109,7 @@ const handleDataLinkGroupWithTableKeys = _ref2 => {
|
|
|
10104
10109
|
}
|
|
10105
10110
|
inputs[fieldKey].label = resolvedLabel || Object.values(formInputConfig.label)[0] || (uploadTypeFields.includes(fieldKey) ? uploadTypeLabels[fieldKey] : fieldKey);
|
|
10106
10111
|
}
|
|
10107
|
-
values[fieldKey] =
|
|
10112
|
+
values[fieldKey] = item?.linking?.SCL?.[item?.[fieldKey]]?.name || item?.[fieldKey];
|
|
10108
10113
|
});
|
|
10109
10114
|
}
|
|
10110
10115
|
return {
|
|
@@ -10114,17 +10119,16 @@ const handleDataLinkGroupWithTableKeys = _ref2 => {
|
|
|
10114
10119
|
};
|
|
10115
10120
|
if (Array.isArray(value)) {
|
|
10116
10121
|
return value.map((item, itemIndex) => {
|
|
10117
|
-
var _merged$inputKey;
|
|
10118
10122
|
const merged = mergeObject(item);
|
|
10119
|
-
const datastakeIdValue =
|
|
10123
|
+
const datastakeIdValue = merged?.[inputKey]?.datastakeId || merged?.datastakeId;
|
|
10120
10124
|
const {
|
|
10121
10125
|
inputs,
|
|
10122
10126
|
values
|
|
10123
10127
|
} = createInputsAndValues(merged);
|
|
10124
10128
|
return /*#__PURE__*/jsxRuntime.jsx(TreeNodeComponent, {
|
|
10125
|
-
nodeKey: datastakeIdValue || t(
|
|
10129
|
+
nodeKey: datastakeIdValue || t(`No ID ${itemIndex + 1}`),
|
|
10126
10130
|
config: {
|
|
10127
|
-
label: datastakeIdValue || t(
|
|
10131
|
+
label: datastakeIdValue || t(`No ID ${itemIndex + 1}`),
|
|
10128
10132
|
type: 'custom-datalink-group',
|
|
10129
10133
|
inputs: inputs
|
|
10130
10134
|
},
|
|
@@ -10138,12 +10142,11 @@ const handleDataLinkGroupWithTableKeys = _ref2 => {
|
|
|
10138
10142
|
getApiBaseUrl: getApiBaseUrl,
|
|
10139
10143
|
getAppHeader: getAppHeader,
|
|
10140
10144
|
app: app
|
|
10141
|
-
},
|
|
10145
|
+
}, `${inputKey}-${itemIndex}`);
|
|
10142
10146
|
});
|
|
10143
10147
|
} else {
|
|
10144
|
-
var _merged$inputKey2;
|
|
10145
10148
|
const merged = mergeObject(value);
|
|
10146
|
-
const datastakeIdValue =
|
|
10149
|
+
const datastakeIdValue = merged?.[inputKey]?.datastakeId || merged?.datastakeId;
|
|
10147
10150
|
const {
|
|
10148
10151
|
inputs,
|
|
10149
10152
|
values
|
|
@@ -10165,7 +10168,7 @@ const handleDataLinkGroupWithTableKeys = _ref2 => {
|
|
|
10165
10168
|
getApiBaseUrl: getApiBaseUrl,
|
|
10166
10169
|
getAppHeader: getAppHeader,
|
|
10167
10170
|
app: app
|
|
10168
|
-
},
|
|
10171
|
+
}, `${inputKey}-group`);
|
|
10169
10172
|
}
|
|
10170
10173
|
};
|
|
10171
10174
|
|
|
@@ -10346,21 +10349,20 @@ const handleDataLinkWithTableKeys = ({
|
|
|
10346
10349
|
}
|
|
10347
10350
|
};
|
|
10348
10351
|
|
|
10349
|
-
const handleGroupChildren =
|
|
10350
|
-
|
|
10351
|
-
|
|
10352
|
-
|
|
10353
|
-
|
|
10354
|
-
|
|
10355
|
-
|
|
10356
|
-
|
|
10357
|
-
|
|
10358
|
-
|
|
10359
|
-
|
|
10360
|
-
|
|
10361
|
-
|
|
10362
|
-
|
|
10363
|
-
if (!(config !== null && config !== void 0 && config.inputs)) {
|
|
10352
|
+
const handleGroupChildren = ({
|
|
10353
|
+
config,
|
|
10354
|
+
value,
|
|
10355
|
+
allData,
|
|
10356
|
+
level,
|
|
10357
|
+
t,
|
|
10358
|
+
rootForm,
|
|
10359
|
+
user,
|
|
10360
|
+
getApiBaseUrl = () => {},
|
|
10361
|
+
getAppHeader = () => {},
|
|
10362
|
+
app,
|
|
10363
|
+
TreeNodeComponent
|
|
10364
|
+
}) => {
|
|
10365
|
+
if (!config?.inputs) {
|
|
10364
10366
|
return null;
|
|
10365
10367
|
}
|
|
10366
10368
|
const inputKeys = Object.keys(config.inputs);
|
|
@@ -10373,7 +10375,7 @@ const handleGroupChildren = _ref => {
|
|
|
10373
10375
|
if (value && typeof value === 'object' && value[inputKey]) {
|
|
10374
10376
|
inputValue = value[inputKey];
|
|
10375
10377
|
} else {
|
|
10376
|
-
inputValue = allData
|
|
10378
|
+
inputValue = allData?.[inputKey];
|
|
10377
10379
|
}
|
|
10378
10380
|
return /*#__PURE__*/jsxRuntime.jsx(TreeNodeComponent, {
|
|
10379
10381
|
nodeKey: inputKey,
|
package/dist/pages/index.js
CHANGED
|
@@ -42783,7 +42783,6 @@ const PlantingLocations = ({
|
|
|
42783
42783
|
id: matchingLocation?.id || locationCheckArrival._id || `event-${index}`,
|
|
42784
42784
|
name: event.name || t("Activity Start"),
|
|
42785
42785
|
date: event.date,
|
|
42786
|
-
sources: 1,
|
|
42787
42786
|
subTitle: event.date ? renderDateFormatted(event.date, "DD MMM YY") : locationName,
|
|
42788
42787
|
plotName: locationName,
|
|
42789
42788
|
territoryTitle: locationName,
|
|
@@ -42802,7 +42801,7 @@ const PlantingLocations = ({
|
|
|
42802
42801
|
},
|
|
42803
42802
|
children: /*#__PURE__*/jsxRuntime.jsx(Map$1, {
|
|
42804
42803
|
data: mappedData,
|
|
42805
|
-
link:
|
|
42804
|
+
link: false,
|
|
42806
42805
|
style: {
|
|
42807
42806
|
height: '100%',
|
|
42808
42807
|
width: '100%'
|
|
@@ -42812,6 +42811,7 @@ const PlantingLocations = ({
|
|
|
42812
42811
|
onClickLink: () => {},
|
|
42813
42812
|
onFilterChange: () => {},
|
|
42814
42813
|
primaryLink: true,
|
|
42814
|
+
showSider: false,
|
|
42815
42815
|
renderTooltipForLocation: data => {
|
|
42816
42816
|
const coordinates = data.gps?.latitude && data.gps?.longitude ? convertDMS(data.gps.latitude, data.gps.longitude) : null;
|
|
42817
42817
|
if (!coordinates) {
|
|
@@ -43543,7 +43543,7 @@ const CycleOutcomes = ({
|
|
|
43543
43543
|
},
|
|
43544
43544
|
children: /*#__PURE__*/jsxRuntime.jsx(StatCard, {
|
|
43545
43545
|
title: t("Total Area Restored"),
|
|
43546
|
-
value: totalAreaRestored ? Number(totalAreaRestored.current).toLocaleString() : 0,
|
|
43546
|
+
value: totalAreaRestored ? Number(totalAreaRestored.current).toLocaleString() + " ha" : 0 + " ha",
|
|
43547
43547
|
icon: "Tree",
|
|
43548
43548
|
change: totalAreaRestoredChange
|
|
43549
43549
|
})
|
package/package.json
CHANGED
|
@@ -82,7 +82,7 @@ const CycleOutcomes = ({
|
|
|
82
82
|
<section style={{ flex: 1 }}>
|
|
83
83
|
<StatCard
|
|
84
84
|
title={t("Total Area Restored")}
|
|
85
|
-
value={totalAreaRestored?Number(totalAreaRestored.current).toLocaleString() : 0}
|
|
85
|
+
value={totalAreaRestored?Number(totalAreaRestored.current).toLocaleString() + " ha" : 0 + " ha"}
|
|
86
86
|
icon="Tree"
|
|
87
87
|
change={totalAreaRestoredChange}
|
|
88
88
|
/>
|
package/src/@daf/pages/Summary/Activities/PlantingCycle/components/PlantingLocations/index.jsx
CHANGED
|
@@ -93,7 +93,6 @@ const PlantingLocations = ({
|
|
|
93
93
|
id: matchingLocation?.id || locationCheckArrival._id || `event-${index}`,
|
|
94
94
|
name: event.name || t("Activity Start"),
|
|
95
95
|
date: event.date,
|
|
96
|
-
sources: 1,
|
|
97
96
|
subTitle: event.date ? renderDateFormatted(event.date, "DD MMM YY") : locationName,
|
|
98
97
|
plotName: locationName,
|
|
99
98
|
territoryTitle: locationName,
|
|
@@ -111,13 +110,14 @@ const PlantingLocations = ({
|
|
|
111
110
|
>
|
|
112
111
|
<MineSiteMap
|
|
113
112
|
data={mappedData}
|
|
114
|
-
link
|
|
113
|
+
link={false}
|
|
115
114
|
style={{ height: '100%', width: '100%' }}
|
|
116
115
|
maxZoom={18}
|
|
117
116
|
isSatellite={true}
|
|
118
117
|
onClickLink={() => { }}
|
|
119
118
|
onFilterChange={() => { }}
|
|
120
119
|
primaryLink
|
|
120
|
+
showSider={false}
|
|
121
121
|
renderTooltipForLocation={(data) => {
|
|
122
122
|
const coordinates = data.gps?.latitude && data.gps?.longitude
|
|
123
123
|
? convertDMS(data.gps.latitude, data.gps.longitude)
|