@iapps/ng-dhis2-ui 1.2.4 → 1.2.6
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/fesm2022/iapps-ng-dhis2-ui.mjs +59 -15
- package/fesm2022/iapps-ng-dhis2-ui.mjs.map +1 -1
- package/lib/modules/form/utils/field-type.util.d.ts +1 -1
- package/lib/modules/form/utils/field.util.d.ts +1 -1
- package/lib/modules/program-entry-form/models/program-entry-form.config.d.ts +2 -0
- package/lib/modules/program-entry-form/utils/program-entry-form-field.util.d.ts +18 -2
- package/package.json +1 -1
|
@@ -3986,7 +3986,7 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
3986
3986
|
.setOrgUnit(orgUnitState)
|
|
3987
3987
|
.setOuMode(this.ouMode)
|
|
3988
3988
|
.setStatus(this.enrollmentStatus)
|
|
3989
|
-
.setEventStatus(this.eventStatus?.status, this.eventStatus
|
|
3989
|
+
.setEventStatus(this.eventStatus?.status, this.eventStatus?.programStage)
|
|
3990
3990
|
.setFilters(dataQueryFiltersState)
|
|
3991
3991
|
.setPagination(new Pager({
|
|
3992
3992
|
pageSize: pager.pageSize,
|
|
@@ -6625,6 +6625,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImpor
|
|
|
6625
6625
|
class FlatFormComponent extends BaseFormWrapperComponent {
|
|
6626
6626
|
ngOnInit() {
|
|
6627
6627
|
this.formGroup = FormUtil.getFormGroup(this.fields(), this.dataValues());
|
|
6628
|
+
this.onFormUpdate();
|
|
6628
6629
|
}
|
|
6629
6630
|
onFormUpdate() {
|
|
6630
6631
|
this.updateDataValues(this.formGroup.getRawValue());
|
|
@@ -7185,8 +7186,11 @@ class ProgramEntryFormFieldUtil {
|
|
|
7185
7186
|
});
|
|
7186
7187
|
}
|
|
7187
7188
|
get dataElements() {
|
|
7188
|
-
|
|
7189
|
-
|
|
7189
|
+
const programStages = this.config.programStage
|
|
7190
|
+
? this.program.programStages?.filter((programStage) => programStage.id === this.config.programStage)
|
|
7191
|
+
: this.program.programStages;
|
|
7192
|
+
return flatten((programStages || []).map((programStage) => {
|
|
7193
|
+
const dataElements = (programStage.programStageDataElements || []).map((stageDataElement) => {
|
|
7190
7194
|
return {
|
|
7191
7195
|
...stageDataElement.dataElement,
|
|
7192
7196
|
sortOrder: stageDataElement.sortOrder,
|
|
@@ -7196,6 +7200,28 @@ class ProgramEntryFormFieldUtil {
|
|
|
7196
7200
|
metaType: 'DATA_ELEMENT',
|
|
7197
7201
|
};
|
|
7198
7202
|
});
|
|
7203
|
+
const eventDateName = programStage.executionDateLabel ||
|
|
7204
|
+
`Reporting date - ${programStage.name}`;
|
|
7205
|
+
return [
|
|
7206
|
+
{
|
|
7207
|
+
id: 'occurredAt',
|
|
7208
|
+
code: 'OCCURRED_AT',
|
|
7209
|
+
formName: eventDateName,
|
|
7210
|
+
name: eventDateName,
|
|
7211
|
+
shortName: eventDateName,
|
|
7212
|
+
displayName: eventDateName,
|
|
7213
|
+
sortOrder: 1,
|
|
7214
|
+
mandatory: true,
|
|
7215
|
+
stepId: programStage.id,
|
|
7216
|
+
valueType: 'DATE',
|
|
7217
|
+
metaType: 'EVENT_DATE',
|
|
7218
|
+
domainType: 'TRACKER',
|
|
7219
|
+
aggregationType: 'NONE',
|
|
7220
|
+
lastUpdated: '',
|
|
7221
|
+
created: '',
|
|
7222
|
+
},
|
|
7223
|
+
...dataElements,
|
|
7224
|
+
];
|
|
7199
7225
|
}));
|
|
7200
7226
|
}
|
|
7201
7227
|
#getOrgUniField() {
|
|
@@ -7214,7 +7240,7 @@ class ProgramEntryFormFieldUtil {
|
|
|
7214
7240
|
});
|
|
7215
7241
|
}
|
|
7216
7242
|
#getEnrollmentDateField() {
|
|
7217
|
-
if (this.config.hideEnrollmentDate) {
|
|
7243
|
+
if (this.config.hideEnrollmentDate || this.config.programStage) {
|
|
7218
7244
|
return null;
|
|
7219
7245
|
}
|
|
7220
7246
|
return new FormField({
|
|
@@ -7229,7 +7255,7 @@ class ProgramEntryFormFieldUtil {
|
|
|
7229
7255
|
});
|
|
7230
7256
|
}
|
|
7231
7257
|
#getIncidentDateField() {
|
|
7232
|
-
if (!this.program.displayIncidentDate) {
|
|
7258
|
+
if (!this.program.displayIncidentDate || this.config.programStage) {
|
|
7233
7259
|
return null;
|
|
7234
7260
|
}
|
|
7235
7261
|
return new DateField({
|
|
@@ -7340,7 +7366,6 @@ class ProgramEntryFormMetaData {
|
|
|
7340
7366
|
.with(this.d2.programModule.trackedEntityTypeAttribute.select([
|
|
7341
7367
|
'trackedEntityAttribute',
|
|
7342
7368
|
])), 'ToOne')
|
|
7343
|
-
.with(this.d2.programModule.programTrackedEntityAttribute.with(this.d2.programModule.trackedEntityAttribute.with(this.d2.optionSetModule.optionSet.with(this.d2.optionSetModule.option), 'ToOne'), 'ToOne'))
|
|
7344
7369
|
.with(this.d2.programModule.programRuleVariable
|
|
7345
7370
|
.with(this.d2.dataElementModule.dataElement.select([
|
|
7346
7371
|
'id',
|
|
@@ -7353,13 +7378,17 @@ class ProgramEntryFormMetaData {
|
|
|
7353
7378
|
'name',
|
|
7354
7379
|
]), 'ToOne'))
|
|
7355
7380
|
.byId(program);
|
|
7381
|
+
if (!this.config.programStage) {
|
|
7382
|
+
programQuery.with(this.d2.programModule.programTrackedEntityAttribute.with(this.d2.programModule.trackedEntityAttribute.with(this.d2.optionSetModule.optionSet.with(this.d2.optionSetModule.option), 'ToOne'), 'ToOne'));
|
|
7383
|
+
}
|
|
7356
7384
|
if (this.config.displayType === 'FLAT') {
|
|
7357
7385
|
programQuery.with(this.d2.programModule.programSection.with(this.d2.programModule.trackedEntityAttribute.select(['id'])));
|
|
7358
7386
|
}
|
|
7359
|
-
if (!this.config.excludeProgramStages) {
|
|
7360
|
-
|
|
7387
|
+
if (!this.config.excludeProgramStages || this.config.programStage) {
|
|
7388
|
+
const programStageQuery = this.d2.programModule.programStage
|
|
7361
7389
|
.with(this.d2.programModule.programStageSection)
|
|
7362
|
-
.with(this.d2.programModule.programStageDataElement.with(this.d2.dataElementModule.dataElement.with(this.d2.optionSetModule.optionSet.with(this.d2.optionSetModule.option), 'ToOne'), 'ToOne'))
|
|
7390
|
+
.with(this.d2.programModule.programStageDataElement.with(this.d2.dataElementModule.dataElement.with(this.d2.optionSetModule.optionSet.with(this.d2.optionSetModule.option), 'ToOne'), 'ToOne'));
|
|
7391
|
+
programQuery.with(programStageQuery);
|
|
7363
7392
|
}
|
|
7364
7393
|
return programQuery.get();
|
|
7365
7394
|
}
|
|
@@ -7577,14 +7606,22 @@ class ProgramEntryFormModule {
|
|
|
7577
7606
|
}
|
|
7578
7607
|
async #saveInstance() {
|
|
7579
7608
|
switch (this.config().formType) {
|
|
7580
|
-
case 'TRACKER':
|
|
7609
|
+
case 'TRACKER': {
|
|
7610
|
+
if (this.config().autoComplete) {
|
|
7611
|
+
this.instance().complete();
|
|
7612
|
+
}
|
|
7581
7613
|
return this.instanceQuery
|
|
7582
7614
|
.setData(this.instance())
|
|
7583
7615
|
.save();
|
|
7584
|
-
|
|
7616
|
+
}
|
|
7617
|
+
case 'EVENT': {
|
|
7618
|
+
if (this.config().autoComplete) {
|
|
7619
|
+
this.instance().complete();
|
|
7620
|
+
}
|
|
7585
7621
|
return this.instanceQuery
|
|
7586
7622
|
.setData(this.instance())
|
|
7587
7623
|
.save();
|
|
7624
|
+
}
|
|
7588
7625
|
default:
|
|
7589
7626
|
return firstValueFrom(of(null));
|
|
7590
7627
|
}
|
|
@@ -7614,10 +7651,17 @@ class ProgramEntryFormModule {
|
|
|
7614
7651
|
.setEnrollment(this.enrollment())
|
|
7615
7652
|
.setTrackedEntity(this.trackedEntity())
|
|
7616
7653
|
.setOrgUnit(this.orgUnit());
|
|
7617
|
-
|
|
7618
|
-
|
|
7619
|
-
|
|
7620
|
-
|
|
7654
|
+
if (!this.event()) {
|
|
7655
|
+
return await this.instanceQuery.create();
|
|
7656
|
+
}
|
|
7657
|
+
const instance = (await this.instanceQuery.setEvent(this.event()).get()).data;
|
|
7658
|
+
if (!instance) {
|
|
7659
|
+
return await this.instanceQuery.create();
|
|
7660
|
+
}
|
|
7661
|
+
if (this.metaData()?.program) {
|
|
7662
|
+
instance.setFields(this.metaData().program);
|
|
7663
|
+
}
|
|
7664
|
+
return instance;
|
|
7621
7665
|
}
|
|
7622
7666
|
#getInstance() {
|
|
7623
7667
|
switch (this.config().formType) {
|