@iapps/ng-dhis2-ui 1.2.7 → 1.2.61
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.
|
@@ -3534,7 +3534,6 @@ const DataTableActions = (props) => {
|
|
|
3534
3534
|
// license that can be found in the LICENSE file.
|
|
3535
3535
|
|
|
3536
3536
|
const TableCell = ({ cell, getTextColorFromBackGround, }) => {
|
|
3537
|
-
console.log('cel value', cell);
|
|
3538
3537
|
if (cell?.style && cell?.style !== 'default-value') {
|
|
3539
3538
|
return (React__default.createElement(DataTableCell, null,
|
|
3540
3539
|
React__default.createElement("div", { style: { display: 'flex', justifyContent: 'center' } },
|
|
@@ -3785,18 +3784,28 @@ const getTrackedEntityTableData = (response, programId, pager, metaData) => {
|
|
|
3785
3784
|
const orgUnitLabel = metaData.orgUnitLabel;
|
|
3786
3785
|
const orgUnitMap = response.data
|
|
3787
3786
|
.orgUnitsMap;
|
|
3787
|
+
console.log('thhis is the metadata', metaData);
|
|
3788
3788
|
const attributeColumns = metaData.displayInListTrackedEntityAttributes
|
|
3789
3789
|
.sort((a, b) => a.sortOrder - b.sortOrder)
|
|
3790
3790
|
.map((trackedEntityAttribute) => ({
|
|
3791
3791
|
label: trackedEntityAttribute.formName ?? trackedEntityAttribute.name,
|
|
3792
3792
|
key: trackedEntityAttribute.id,
|
|
3793
3793
|
}));
|
|
3794
|
-
const dataElementColumns = metaData.displayInListDataElements
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
}));
|
|
3794
|
+
// const dataElementColumns = metaData.displayInListDataElements
|
|
3795
|
+
// .sort((a, b) => a.sortOrder! - b.sortOrder!)
|
|
3796
|
+
// .map((dataElement) => ({
|
|
3797
|
+
// label: dataElement.formName || dataElement.name,
|
|
3798
|
+
// key: dataElement.id,
|
|
3799
|
+
// }));
|
|
3800
|
+
const dataElementColumns = metaData
|
|
3801
|
+
.programStages.sort((a, b) => a.sortOrder - b.sortOrder) // Sorts stages by sortOrder
|
|
3802
|
+
.flatMap((stage) => stage
|
|
3803
|
+
.programStageDataElements.filter((psde) => psde.displayInReports)
|
|
3804
|
+
.sort((a, b) => a.sortOrder - b.sortOrder) // Sorts data elements within stage
|
|
3805
|
+
.map((psde) => ({
|
|
3806
|
+
label: psde.dataElement.formName || psde.dataElement.name,
|
|
3807
|
+
key: psde.dataElement.id,
|
|
3808
|
+
})));
|
|
3800
3809
|
const dataElementOptions = metaData.displayInListDataElements.map((element) => ({
|
|
3801
3810
|
id: element.id,
|
|
3802
3811
|
options: element.optionSet?.options.map((opt) => ({
|
|
@@ -3837,7 +3846,7 @@ const getTrackedEntityTableData = (response, programId, pager, metaData) => {
|
|
|
3837
3846
|
};
|
|
3838
3847
|
}
|
|
3839
3848
|
catch {
|
|
3840
|
-
return { ...attr };
|
|
3849
|
+
return { ...attr };
|
|
3841
3850
|
}
|
|
3842
3851
|
}
|
|
3843
3852
|
return attr;
|
|
@@ -3856,11 +3865,11 @@ const getTrackedEntityTableData = (response, programId, pager, metaData) => {
|
|
|
3856
3865
|
}
|
|
3857
3866
|
});
|
|
3858
3867
|
dataElementsData.forEach((element) => {
|
|
3859
|
-
//
|
|
3868
|
+
// Finds the matching data element in dataElementOptions by ID
|
|
3860
3869
|
const dataElementOption = dataElementOptions.find((deo) => deo.id === element.dataElement);
|
|
3861
|
-
//
|
|
3870
|
+
// finds a matching option within that data element's options
|
|
3862
3871
|
const matchingOption = dataElementOption?.options?.find((opt) => opt.name === element.value);
|
|
3863
|
-
//
|
|
3872
|
+
// Builds the row entry with value and optional style
|
|
3864
3873
|
if (matchingOption) {
|
|
3865
3874
|
row[element.dataElement] = {
|
|
3866
3875
|
value: element.value,
|
|
@@ -3873,7 +3882,7 @@ const getTrackedEntityTableData = (response, programId, pager, metaData) => {
|
|
|
3873
3882
|
};
|
|
3874
3883
|
}
|
|
3875
3884
|
});
|
|
3876
|
-
//
|
|
3885
|
+
// Includes orgUnit in the row for id access with style
|
|
3877
3886
|
row['orgUnitId'] = { value: matchingEnrollment.orgUnit };
|
|
3878
3887
|
row['orgUnit'] = {
|
|
3879
3888
|
value: orgUnitMap?.get(matchingEnrollment.orgUnit) || '-',
|