@iapps/ng-dhis2-ui 1.1.53 → 1.1.54
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 +30 -9
- 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/line-list/containers/line-list.component.d.ts +2 -1
- package/lib/modules/line-list/services/line-list.service.d.ts +1 -1
- package/lib/shared/utils/predefinedDimensions.d.ts +6 -6
- package/package.json +1 -1
|
@@ -3295,15 +3295,24 @@ class LineListService {
|
|
|
3295
3295
|
getProgramMetadata(programId) {
|
|
3296
3296
|
return this.httpClient.get(`programs/${programId}.json?fields=programType,programStages[id,name,programStageDataElements[dataElement[id,name]]],organisationUnits[id,name],*`);
|
|
3297
3297
|
}
|
|
3298
|
-
getTrackedEntityInstances(programId, orgUnit, page, pageSize, filters = [], startDate, endDate, ouMode) {
|
|
3298
|
+
getTrackedEntityInstances(programId, orgUnit, page, pageSize, filters = [], startDate, endDate, ouMode, filterRootOrgUnit) {
|
|
3299
3299
|
const filterParams = buildFilters(filters);
|
|
3300
3300
|
const dateFilter = startDate && endDate ? `&programStartDate=${startDate}&programEndDate=${endDate}` : '';
|
|
3301
3301
|
const ouModeIdentifier = ouMode ? `&ouMode=${ouMode}` : ``;
|
|
3302
3302
|
return this.httpClient.get(`trackedEntityInstances.json?program=${programId}&ou=${orgUnit}${ouModeIdentifier}&page=${page}&pageSize=${pageSize}&fields=trackedEntityInstance,orgUnit,attributes[*,displayInList],enrollments[*]&totalPages=true&${filterParams}${dateFilter}&order=created:desc`).pipe(map$1((response) => {
|
|
3303
|
-
|
|
3304
|
-
|
|
3303
|
+
if (filterRootOrgUnit) {
|
|
3304
|
+
response.trackedEntityInstances = response.trackedEntityInstances.filter((tei) => tei.orgUnit !== orgUnit // Exclude TEIs with the root orgUnit
|
|
3305
|
+
);
|
|
3306
|
+
}
|
|
3305
3307
|
return response;
|
|
3306
3308
|
}));
|
|
3309
|
+
// pipe(
|
|
3310
|
+
// map((response: any) => {
|
|
3311
|
+
// //TODO: use the api to to order by desc
|
|
3312
|
+
// // response.trackedEntityInstances.reverse();
|
|
3313
|
+
// return response;
|
|
3314
|
+
// })
|
|
3315
|
+
// );
|
|
3307
3316
|
}
|
|
3308
3317
|
getEvents(programId, orgUnit, page, pageSize, filters = [], startDate, endDate, ouMode) {
|
|
3309
3318
|
const filterParams = buildFilters(filters);
|
|
@@ -3317,7 +3326,7 @@ class LineListService {
|
|
|
3317
3326
|
const ouModeIdentifier = ouMode ? `&ouMode=${ouMode}` : ``;
|
|
3318
3327
|
return this.httpClient.get(`events.json?programStage=${programStageId}&orgUnit=${orgUnit}${ouModeIdentifier}&page=${page}&pageSize=${pageSize}&fields=*&totalPages=true&${filterParams}${dateFilter}`);
|
|
3319
3328
|
}
|
|
3320
|
-
getLineListData(programId, orgUnit = '', programStageId, page = 1, pageSize = 10, filters = [], startDate, endDate, ouMode) {
|
|
3329
|
+
getLineListData(programId, orgUnit = '', programStageId, page = 1, pageSize = 10, filters = [], startDate, endDate, ouMode, filterRootOrgUnit) {
|
|
3321
3330
|
return this.getProgramMetadata(programId).pipe(switchMap((programMetadata) => {
|
|
3322
3331
|
if (programStageId) {
|
|
3323
3332
|
return this.getEventsByProgramStage(programStageId, orgUnit, page, pageSize, filters, startDate, endDate, ouMode).pipe(map$1((events) => ({
|
|
@@ -3326,7 +3335,7 @@ class LineListService {
|
|
|
3326
3335
|
})));
|
|
3327
3336
|
}
|
|
3328
3337
|
if (programMetadata.programType === 'WITH_REGISTRATION') {
|
|
3329
|
-
return this.getTrackedEntityInstances(programId, orgUnit, page, pageSize, filters, startDate, endDate, ouMode).pipe(map$1((teis) => ({
|
|
3338
|
+
return this.getTrackedEntityInstances(programId, orgUnit, page, pageSize, filters, startDate, endDate, ouMode, filterRootOrgUnit).pipe(map$1((teis) => ({
|
|
3330
3339
|
metadata: programMetadata,
|
|
3331
3340
|
data: teis,
|
|
3332
3341
|
})));
|
|
@@ -3378,7 +3387,10 @@ const getTrackedEntityData = (response, programId, pager, filters) => {
|
|
|
3378
3387
|
//organisation units from metadata
|
|
3379
3388
|
let orgUnitsFromMetaData = response.metadata.organisationUnits;
|
|
3380
3389
|
//a Map to efficiently look up orgUnit names by ID
|
|
3381
|
-
const orgUnitMap = new Map(orgUnitsFromMetaData.map((ou) => [
|
|
3390
|
+
const orgUnitMap = new Map(orgUnitsFromMetaData.map((ou) => [
|
|
3391
|
+
ou.id,
|
|
3392
|
+
ou.name,
|
|
3393
|
+
]));
|
|
3382
3394
|
const mappedProgramMetadataAttributes = programMetaData.map((attr) => ({
|
|
3383
3395
|
displayInList: attr.displayInList,
|
|
3384
3396
|
searchable: attr.searchable,
|
|
@@ -3449,11 +3461,17 @@ const getTrackedEntityData = (response, programId, pager, filters) => {
|
|
|
3449
3461
|
? matchingEnrollment.attributes
|
|
3450
3462
|
: tei.attributes;
|
|
3451
3463
|
attributesToUse.forEach((attr) => (row[attr.attribute] = attr.value));
|
|
3464
|
+
//include orgUnit in the row for id access
|
|
3465
|
+
row['orgUnitId'] = tei.orgUnit;
|
|
3452
3466
|
// Access the name of the orgUnit using the Map
|
|
3453
3467
|
row['orgUnit'] = orgUnitMap.get(tei.orgUnit) || tei.orgUnit || 'N/A';
|
|
3454
3468
|
return row;
|
|
3455
3469
|
});
|
|
3456
|
-
return {
|
|
3470
|
+
return {
|
|
3471
|
+
columns: entityColumns,
|
|
3472
|
+
data: attributesData,
|
|
3473
|
+
filteredEntityColumns: filteredEntityColumns,
|
|
3474
|
+
};
|
|
3457
3475
|
};
|
|
3458
3476
|
const getEventData = (response, pager) => {
|
|
3459
3477
|
const events = response.data.events;
|
|
@@ -3497,6 +3515,7 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
3497
3515
|
this.isButtonLoading = false;
|
|
3498
3516
|
this.buttonLabel = '';
|
|
3499
3517
|
this.firstValue = new EventEmitter();
|
|
3518
|
+
this.filterRootOrgUnit = false;
|
|
3500
3519
|
this.setReactStateUpdaters = (updaters) => {
|
|
3501
3520
|
this.reactStateUpdaters = updaters;
|
|
3502
3521
|
};
|
|
@@ -3556,7 +3575,7 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
3556
3575
|
this.lineListService
|
|
3557
3576
|
.getLineListData(this.programId, this.orgUnit, this.programStageId, pager.page, pager.pageSize, attributeFiltersState,
|
|
3558
3577
|
// this.attributeFilters,
|
|
3559
|
-
this.startDate, this.endDate, this.ouMode)
|
|
3578
|
+
this.startDate, this.endDate, this.ouMode, this.filterRootOrgUnit)
|
|
3560
3579
|
.subscribe((response) => {
|
|
3561
3580
|
let entityColumns = [];
|
|
3562
3581
|
let responsePager;
|
|
@@ -3782,7 +3801,7 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
3782
3801
|
this.render();
|
|
3783
3802
|
}
|
|
3784
3803
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: LineListTableComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
3785
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.8", type: LineListTableComponent, isStandalone: false, selector: "app-line-list", inputs: { programId: "programId", orgUnit: "orgUnit", programStageId: "programStageId", actionOptions: "actionOptions", attributeFilters: "attributeFilters", startDate: "startDate", endDate: "endDate", filters: "filters", ouMode: "ouMode", dispatchTeis: "dispatchTeis", showFilterButton: "showFilterButton", isButtonLoading: "isButtonLoading", buttonLabel: "buttonLabel", buttonFilter: "buttonFilter" }, outputs: { actionSelected: "actionSelected", approvalSelected: "approvalSelected", firstValue: "firstValue" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: ["[data-test=dhis2-uiwidgets-pagination]{display:flex!important;flex-direction:row!important;justify-content:space-between!important;align-items:center!important}\n"] }); }
|
|
3804
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.8", type: LineListTableComponent, isStandalone: false, selector: "app-line-list", inputs: { programId: "programId", orgUnit: "orgUnit", programStageId: "programStageId", actionOptions: "actionOptions", attributeFilters: "attributeFilters", startDate: "startDate", endDate: "endDate", filters: "filters", ouMode: "ouMode", dispatchTeis: "dispatchTeis", showFilterButton: "showFilterButton", isButtonLoading: "isButtonLoading", buttonLabel: "buttonLabel", buttonFilter: "buttonFilter", filterRootOrgUnit: "filterRootOrgUnit" }, outputs: { actionSelected: "actionSelected", approvalSelected: "approvalSelected", firstValue: "firstValue" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: ["[data-test=dhis2-uiwidgets-pagination]{display:flex!important;flex-direction:row!important;justify-content:space-between!important;align-items:center!important}\n"] }); }
|
|
3786
3805
|
}
|
|
3787
3806
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: LineListTableComponent, decorators: [{
|
|
3788
3807
|
type: Component,
|
|
@@ -3821,6 +3840,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImpor
|
|
|
3821
3840
|
type: Output
|
|
3822
3841
|
}], buttonFilter: [{
|
|
3823
3842
|
type: Input
|
|
3843
|
+
}], filterRootOrgUnit: [{
|
|
3844
|
+
type: Input
|
|
3824
3845
|
}] } });
|
|
3825
3846
|
|
|
3826
3847
|
class LineListModule {
|