@iapps/ng-dhis2-ui 1.3.1 → 1.3.2
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.
|
@@ -11317,6 +11317,7 @@ class BaseFormWrapperComponent {
|
|
|
11317
11317
|
this.formValidityUpdate.emit(isFormValid);
|
|
11318
11318
|
}
|
|
11319
11319
|
executeRules() {
|
|
11320
|
+
console.log(this.#updatedDataValues());
|
|
11320
11321
|
this.ruleActions.set(new ProgramRuleEngine()
|
|
11321
11322
|
.setRules(this.rules())
|
|
11322
11323
|
.setDataValues(this.#updatedDataValues())
|
|
@@ -12825,7 +12826,7 @@ class ProgramEntryFormMetaData {
|
|
|
12825
12826
|
.with(this.d2.programModule.programStageDataElement.with(this.d2.dataElementModule.dataElement.with(this.d2.optionSetModule.optionSet.with(this.d2.optionSetModule.option), 'ToOne'), 'ToOne'));
|
|
12826
12827
|
programQuery.with(programStageQuery);
|
|
12827
12828
|
}
|
|
12828
|
-
return programQuery.get(
|
|
12829
|
+
return programQuery.get();
|
|
12829
12830
|
}
|
|
12830
12831
|
async #getProgramMetaData() {
|
|
12831
12832
|
const program = this.config.program;
|
|
@@ -12885,7 +12886,7 @@ class ProgramEntryFormMetaData {
|
|
|
12885
12886
|
'displayName',
|
|
12886
12887
|
]), 'ToOne'))
|
|
12887
12888
|
.paginate(new Pager({ paging: false }))
|
|
12888
|
-
.get(
|
|
12889
|
+
.get(),
|
|
12889
12890
|
]);
|
|
12890
12891
|
const [programResponse, programRuleResponse] = metaDataResponse;
|
|
12891
12892
|
const metaData = programResponse.data;
|
|
@@ -13061,7 +13062,7 @@ class ProgramEntryFormMetaData {
|
|
|
13061
13062
|
if (this.config?.formFieldExtensions &&
|
|
13062
13063
|
this.config.formFieldExtensions.length > 0 &&
|
|
13063
13064
|
this.config.formFieldExtensions[0]?.optionsSourceCode) {
|
|
13064
|
-
const orgUnitResponse = await this.d2.httpInstance.get(`organisationUnits.json?fields=id,name,code&paging=false&filter=organisationUnitGroups.code:eq:${this.config.formFieldExtensions[0].optionsSourceCode}
|
|
13065
|
+
const orgUnitResponse = await this.d2.httpInstance.get(`organisationUnits.json?fields=id,name,code&paging=false&filter=organisationUnitGroups.code:eq:${this.config.formFieldExtensions[0].optionsSourceCode}`);
|
|
13065
13066
|
const orgUnitsResponse = orgUnitResponse?.data?.['organisationUnits'];
|
|
13066
13067
|
const organisationUnits = Array.isArray(orgUnitsResponse)
|
|
13067
13068
|
? orgUnitsResponse
|
|
@@ -13169,27 +13170,6 @@ class ProgramEntryFormModule {
|
|
|
13169
13170
|
}, /* @ts-ignore */
|
|
13170
13171
|
...(ngDevMode ? [{ debugName: "FormActionButtons" }] : /* istanbul ignore next */ []));
|
|
13171
13172
|
}
|
|
13172
|
-
// async ngOnInit() {
|
|
13173
|
-
// this.loading.set(true);
|
|
13174
|
-
// try {
|
|
13175
|
-
// // Loading metadata
|
|
13176
|
-
// const metaData = await new ProgramEntryFormMetaData()
|
|
13177
|
-
// .setConfig(this.config())
|
|
13178
|
-
// .get();
|
|
13179
|
-
// this.metaData.set(metaData);
|
|
13180
|
-
// // Load initial instance information
|
|
13181
|
-
// const instance = await this.#getInstance();
|
|
13182
|
-
// this.instance.set(instance);
|
|
13183
|
-
// if (this.config().autoAssignedValues) {
|
|
13184
|
-
// this.#updateInstanceWithAutoAssignedValues(
|
|
13185
|
-
// this.config().autoAssignedValues || []
|
|
13186
|
-
// );
|
|
13187
|
-
// }
|
|
13188
|
-
// this.loading.set(false);
|
|
13189
|
-
// } catch (err) {
|
|
13190
|
-
// this.loading.set(false);
|
|
13191
|
-
// }
|
|
13192
|
-
// }
|
|
13193
13173
|
async ngOnInit() {
|
|
13194
13174
|
this.loading.set(true);
|
|
13195
13175
|
try {
|
|
@@ -13392,22 +13372,24 @@ class ProgramEntryFormModule {
|
|
|
13392
13372
|
return instance;
|
|
13393
13373
|
}
|
|
13394
13374
|
async #getTrackerInstance() {
|
|
13395
|
-
|
|
13396
|
-
|
|
13397
|
-
|
|
13375
|
+
const d2 = window.d2Web;
|
|
13376
|
+
this.instanceQuery = d2?.trackerModule?.trackedEntity
|
|
13377
|
+
?.setProgram(this.config().program)
|
|
13378
|
+
?.setOrgUnit(this.orgUnit());
|
|
13379
|
+
if (!this.instanceQuery) {
|
|
13380
|
+
throw new Error('Could not initialize tracker query');
|
|
13381
|
+
}
|
|
13398
13382
|
if (!this.trackedEntity()) {
|
|
13399
|
-
|
|
13400
|
-
return await this.#setReservedValuesForCodeGeneration(instance);
|
|
13383
|
+
return await this.instanceQuery.create();
|
|
13401
13384
|
}
|
|
13402
13385
|
const instanceResult = (await this.instanceQuery
|
|
13403
13386
|
.setTrackedEntity(this.trackedEntity())
|
|
13404
13387
|
.get()).data;
|
|
13405
13388
|
if (!instanceResult) {
|
|
13406
|
-
|
|
13407
|
-
return await this.#setReservedValuesForCodeGeneration(instance);
|
|
13389
|
+
return await this.instanceQuery.create();
|
|
13408
13390
|
}
|
|
13409
13391
|
this.instanceQuery.setInstanceFields(this.metaData()?.program);
|
|
13410
|
-
const instance = await this
|
|
13392
|
+
const instance = await this.instanceQuery.setReservedValues();
|
|
13411
13393
|
if (this.orgUnit()) {
|
|
13412
13394
|
instance.setOrgUnit(this.orgUnit());
|
|
13413
13395
|
}
|