@iapps/ng-dhis2-ui 1.3.4 → 1.3.5
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.
|
@@ -11939,6 +11939,9 @@ class ProgramEntryFormFieldUtil {
|
|
|
11939
11939
|
});
|
|
11940
11940
|
}
|
|
11941
11941
|
get dataElements() {
|
|
11942
|
+
if (this.config.excludeProgramStages) {
|
|
11943
|
+
return [];
|
|
11944
|
+
}
|
|
11942
11945
|
const programStages = this.config.programStage
|
|
11943
11946
|
? this.program.programStages?.filter((programStage) => programStage.id === this.config.programStage)
|
|
11944
11947
|
: this.program.programStages;
|
|
@@ -12920,7 +12923,7 @@ class ProgramEntryFormMetaData {
|
|
|
12920
12923
|
});
|
|
12921
12924
|
}
|
|
12922
12925
|
get programStageSections() {
|
|
12923
|
-
if (!this.program) {
|
|
12926
|
+
if (!this.program || this.config.excludeProgramStages) {
|
|
12924
12927
|
return [];
|
|
12925
12928
|
}
|
|
12926
12929
|
const { displayType, formType } = this.config;
|
|
@@ -13094,15 +13097,16 @@ class ProgramEntryFormModule {
|
|
|
13094
13097
|
if (!this.instance()) {
|
|
13095
13098
|
return {};
|
|
13096
13099
|
}
|
|
13097
|
-
const
|
|
13098
|
-
|
|
13099
|
-
|
|
13100
|
-
|
|
13101
|
-
|
|
13100
|
+
const attributeDataValues = this.trackedEntityInstance()
|
|
13101
|
+
? this.#getTrackedEntityDataValues(this.trackedEntityInstance())
|
|
13102
|
+
: {};
|
|
13103
|
+
// TODO: Consider refactoring this logic to avoid potential issues with nested data values. The current implementation may not handle deeply nested structures correctly, which could lead to unexpected behavior when updating the instance with new data values.
|
|
13104
|
+
const currentInstanceDataValues = this.config().formType === 'TRACKER'
|
|
13105
|
+
? this.#getTrackedEntityDataValues(this.instance())
|
|
13106
|
+
: this.instance();
|
|
13102
13107
|
return {
|
|
13103
|
-
...
|
|
13104
|
-
...(
|
|
13105
|
-
...(this.instance() || {}),
|
|
13108
|
+
...attributeDataValues,
|
|
13109
|
+
...(currentInstanceDataValues || {}),
|
|
13106
13110
|
};
|
|
13107
13111
|
}, /* @ts-ignore */
|
|
13108
13112
|
...(ngDevMode ? [{ debugName: "dataEntities" }] : /* istanbul ignore next */ []));
|
|
@@ -13140,6 +13144,16 @@ class ProgramEntryFormModule {
|
|
|
13140
13144
|
}, /* @ts-ignore */
|
|
13141
13145
|
...(ngDevMode ? [{ debugName: "FormActionButtons" }] : /* istanbul ignore next */ []));
|
|
13142
13146
|
}
|
|
13147
|
+
#getTrackedEntityDataValues(trackedEntity) {
|
|
13148
|
+
const attributeDataValues = Object.keys(trackedEntity?.attributeEntities ?? {}).reduce((acc, key) => {
|
|
13149
|
+
acc[key] = trackedEntity?.attributeEntities?.[key]?.value;
|
|
13150
|
+
return acc;
|
|
13151
|
+
}, {});
|
|
13152
|
+
return {
|
|
13153
|
+
...attributeDataValues,
|
|
13154
|
+
...(trackedEntity?.reportEntities ?? {}),
|
|
13155
|
+
};
|
|
13156
|
+
}
|
|
13143
13157
|
async ngOnInit() {
|
|
13144
13158
|
this.loading.set(true);
|
|
13145
13159
|
try {
|