@iapps/ng-dhis2-ui 1.1.64 → 1.1.66
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 +222 -48
- 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/models/line-list.models.d.ts +25 -5
- package/lib/modules/line-list/utils/line-list-utils.d.ts +1 -1
- package/package.json +1 -1
|
@@ -3300,7 +3300,9 @@ class LineListService {
|
|
|
3300
3300
|
this.httpClient = httpClient;
|
|
3301
3301
|
}
|
|
3302
3302
|
getProgramMetadata(programId) {
|
|
3303
|
-
return this.httpClient.get(`programs/${programId}.json?fields=programType,programStages[id,name,programStageDataElements[dataElement[id,name
|
|
3303
|
+
return this.httpClient.get(`programs/${programId}.json?fields=programType,programStages[id,name,programStageDataElements[dataElement[id,name,shortName,formName,code,optionSetValue,valueType,
|
|
3304
|
+
optionSet[id,name,options[id,name,code]]]]],programTrackedEntityAttributes[*,trackedEntityAttribute[id,name,unique,generated,formName,code,optionSetValue
|
|
3305
|
+
,valueType,optionSet[id,name,options[id,name,code]]]]`);
|
|
3304
3306
|
}
|
|
3305
3307
|
// private getTrackedEntityInstances(
|
|
3306
3308
|
// programId: string,
|
|
@@ -3338,8 +3340,12 @@ class LineListService {
|
|
|
3338
3340
|
const dateFilter = [
|
|
3339
3341
|
startDate ? `enrollmentEnrolledAfter=${startDate}` : '',
|
|
3340
3342
|
endDate ? `enrollmentEnrolledBefore=${endDate}` : '',
|
|
3341
|
-
]
|
|
3342
|
-
|
|
3343
|
+
]
|
|
3344
|
+
.filter(Boolean)
|
|
3345
|
+
.join('&');
|
|
3346
|
+
const ouModeIdentifier = ouMode && useOuModeWithOlderDHIS2Instance
|
|
3347
|
+
? `&ouMode=${ouMode}`
|
|
3348
|
+
: `&orgUnitMode=${ouMode}`;
|
|
3343
3349
|
return this.httpClient
|
|
3344
3350
|
.get(`tracker/trackedEntities.json?program=${programId}&orgUnit=${orgUnit}${ouModeIdentifier}&page=${page}&pageSize=${pageSize}&fields=trackedEntity,orgUnit,attributes[*],enrollments[*]&totalPages=true&${filterParams}${dateFilter}&order=createdAt:desc`)
|
|
3345
3351
|
.pipe(switchMap((response) => {
|
|
@@ -3348,13 +3354,26 @@ class LineListService {
|
|
|
3348
3354
|
}
|
|
3349
3355
|
// **Step 1:** Extract unique orgUnits from enrollments
|
|
3350
3356
|
const uniqueOrgUnitIds = new Set();
|
|
3351
|
-
response.trackedEntities
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3357
|
+
if (response && response.trackedEntities) {
|
|
3358
|
+
response.trackedEntities.forEach((tei) => {
|
|
3359
|
+
tei.enrollments?.forEach((enrollment) => {
|
|
3360
|
+
if (enrollment.program === programId) {
|
|
3361
|
+
uniqueOrgUnitIds.add(enrollment.orgUnit);
|
|
3362
|
+
}
|
|
3363
|
+
});
|
|
3356
3364
|
});
|
|
3357
|
-
}
|
|
3365
|
+
}
|
|
3366
|
+
else {
|
|
3367
|
+
if (response && response.instances) {
|
|
3368
|
+
response?.instances?.forEach((tei) => {
|
|
3369
|
+
tei.enrollments?.forEach((enrollment) => {
|
|
3370
|
+
if (enrollment.program === programId) {
|
|
3371
|
+
uniqueOrgUnitIds.add(enrollment?.orgUnit);
|
|
3372
|
+
}
|
|
3373
|
+
});
|
|
3374
|
+
});
|
|
3375
|
+
}
|
|
3376
|
+
}
|
|
3358
3377
|
// If no unique orgUnits found, return immediately
|
|
3359
3378
|
if (uniqueOrgUnitIds.size === 0) {
|
|
3360
3379
|
return of({ ...response, orgUnitsMap: new Map() });
|
|
@@ -3385,7 +3404,9 @@ class LineListService {
|
|
|
3385
3404
|
getEvents(programId, orgUnit, page, pageSize, filters = [], startDate, endDate, ouMode, useOuModeWithOlderDHIS2Instance) {
|
|
3386
3405
|
const filterParams = buildFilters(filters);
|
|
3387
3406
|
const dateFilter = startDate && endDate ? `&startDate=${startDate}&endDate=${endDate}` : '';
|
|
3388
|
-
const ouModeIdentifier = ouMode && useOuModeWithOlderDHIS2Instance
|
|
3407
|
+
const ouModeIdentifier = ouMode && useOuModeWithOlderDHIS2Instance
|
|
3408
|
+
? `&ouMode=${ouMode}`
|
|
3409
|
+
: `&ouMode=${ouMode}`;
|
|
3389
3410
|
// const ouModeIdentifier = ouMode ? `&ouMode=${ouMode}`: ``;
|
|
3390
3411
|
return this.httpClient.get(`events.json?program=${programId}&orgUnit=${orgUnit}${ouModeIdentifier}&page=${page}&pageSize=${pageSize}&fields=*&totalPages=true&${filterParams}${dateFilter}`);
|
|
3391
3412
|
}
|
|
@@ -3407,7 +3428,7 @@ class LineListService {
|
|
|
3407
3428
|
return this.getTrackedEntityInstances(programId, orgUnit, page, pageSize, filters, startDate, endDate, ouMode, filterRootOrgUnit, useOuModeWithOlderDHIS2Instance).pipe(map$1((teis) => ({
|
|
3408
3429
|
metadata: programMetadata,
|
|
3409
3430
|
data: teis,
|
|
3410
|
-
orgUnits: teis.orgUnitsMap
|
|
3431
|
+
orgUnits: teis.orgUnitsMap,
|
|
3411
3432
|
})));
|
|
3412
3433
|
}
|
|
3413
3434
|
else {
|
|
@@ -3440,7 +3461,7 @@ const getProgramStageData = (response, programStageId, pager) => {
|
|
|
3440
3461
|
key: dataElementId,
|
|
3441
3462
|
}));
|
|
3442
3463
|
const dataElementsData = events.map((event, idx) => {
|
|
3443
|
-
|
|
3464
|
+
const row = {
|
|
3444
3465
|
event: event.event,
|
|
3445
3466
|
index: (pager.page - 1) * pager.pageSize + idx + 1,
|
|
3446
3467
|
};
|
|
@@ -3450,24 +3471,151 @@ const getProgramStageData = (response, programStageId, pager) => {
|
|
|
3450
3471
|
});
|
|
3451
3472
|
return { columns: entityColumns, data: dataElementsData };
|
|
3452
3473
|
};
|
|
3453
|
-
const getTrackedEntityData = (
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3474
|
+
// export const getTrackedEntityData = (
|
|
3475
|
+
// response: LineListResponse,
|
|
3476
|
+
// programId: string,
|
|
3477
|
+
// pager: any,
|
|
3478
|
+
// isOptionSetNameVisible: boolean,
|
|
3479
|
+
// filters?: FilterConfig[]
|
|
3480
|
+
// ): {
|
|
3481
|
+
// columns: ColumnDefinition[];
|
|
3482
|
+
// data: TableRow[];
|
|
3483
|
+
// filteredEntityColumns: ColumnDefinition[];
|
|
3484
|
+
// } => {
|
|
3485
|
+
// let teis =
|
|
3486
|
+
// (response.data as TrackedEntityResponse)?.trackedEntities ??
|
|
3487
|
+
// (response.data as TrackedEntityResponse)?.instances ??
|
|
3488
|
+
// [];
|
|
3489
|
+
// const programMetaData = response.metadata.programTrackedEntityAttributes;
|
|
3490
|
+
// // //organisation units from metadata
|
|
3491
|
+
// // let orgUnitsFromMetaData = response.metadata.organisationUnits;
|
|
3492
|
+
// // //a Map to efficiently look up orgUnit names by ID
|
|
3493
|
+
// // const orgUnitMap = new Map<string, string>(
|
|
3494
|
+
// // orgUnitsFromMetaData.map((ou: { id: string; name: string }) => [
|
|
3495
|
+
// // ou.id,
|
|
3496
|
+
// // ou.name,
|
|
3497
|
+
// // ])
|
|
3498
|
+
// // );
|
|
3499
|
+
// const orgUnitMap = (response.data as TrackedEntityResponse).orgUnitsMap;
|
|
3500
|
+
// const mappedProgramMetadataAttributes = programMetaData.map((attr) => ({
|
|
3501
|
+
// displayInList: attr.displayInList,
|
|
3502
|
+
// searchable: attr.searchable,
|
|
3503
|
+
// id: attr.trackedEntityAttribute.id,
|
|
3504
|
+
// }));
|
|
3505
|
+
// const programAttributesMap = programMetaData.reduce(
|
|
3506
|
+
// (acc: { [key: string]: string }, attribute: any) => {
|
|
3507
|
+
// if (attribute.displayInList) {
|
|
3508
|
+
// acc[attribute.id] = attribute.displayName;
|
|
3509
|
+
// }
|
|
3510
|
+
// return acc;
|
|
3511
|
+
// },
|
|
3512
|
+
// {}
|
|
3513
|
+
// );
|
|
3514
|
+
// if (filters) {
|
|
3515
|
+
// teis = getFilteredTrackedEntites(teis, filters);
|
|
3516
|
+
// }
|
|
3517
|
+
// const allAttributes = new Set<string>();
|
|
3518
|
+
// teis.forEach((tei: any) => {
|
|
3519
|
+
// const matchingEnrollment = tei.enrollments.find(
|
|
3520
|
+
// (enrollment: any) => enrollment.program === programId
|
|
3521
|
+
// );
|
|
3522
|
+
// const attributes = matchingEnrollment
|
|
3523
|
+
// ? matchingEnrollment.attributes
|
|
3524
|
+
// : tei.attributes;
|
|
3525
|
+
// attributes.forEach((attr: any) => allAttributes.add(attr.attribute));
|
|
3526
|
+
// });
|
|
3527
|
+
// let entityColumns = Array.from(allAttributes).map((attrId: string) => {
|
|
3528
|
+
// const foundAttribute = teis
|
|
3529
|
+
// .flatMap((tei: any) => {
|
|
3530
|
+
// const matchingEnrollment = tei.enrollments.find(
|
|
3531
|
+
// (enrollment: any) => enrollment.program === programId
|
|
3532
|
+
// );
|
|
3533
|
+
// return matchingEnrollment
|
|
3534
|
+
// ? matchingEnrollment.attributes
|
|
3535
|
+
// : tei.attributes;
|
|
3536
|
+
// })
|
|
3537
|
+
// .find((attr: any) => attr.attribute === attrId);
|
|
3538
|
+
// return {
|
|
3539
|
+
// label: foundAttribute?.displayName || attrId,
|
|
3540
|
+
// key: attrId,
|
|
3541
|
+
// };
|
|
3542
|
+
// });
|
|
3543
|
+
// entityColumns = entityColumns.filter((column) => {
|
|
3544
|
+
// // Check if the column label is part of any value in programAttributesMap
|
|
3545
|
+
// return Object.values(programAttributesMap).some((value: string) =>
|
|
3546
|
+
// value.includes(column.label)
|
|
3547
|
+
// );
|
|
3548
|
+
// });
|
|
3549
|
+
// // Add orgUnit as the first column
|
|
3550
|
+
// entityColumns.unshift({
|
|
3551
|
+
// label: 'Location',
|
|
3552
|
+
// key: 'orgUnit',
|
|
3553
|
+
// });
|
|
3554
|
+
// const searchableAttributes = mappedProgramMetadataAttributes
|
|
3555
|
+
// .filter((attr) => attr.searchable && attr.displayInList)
|
|
3556
|
+
// .map((attr) => ({
|
|
3557
|
+
// // label: attr.trackedEntityAttribute.displayName,
|
|
3558
|
+
// key: attr.id,
|
|
3559
|
+
// }));
|
|
3560
|
+
// // Extract keys from searchableAttributes for quick lookup
|
|
3561
|
+
// const searchableKeys = new Set(searchableAttributes.map((attr) => attr.key));
|
|
3562
|
+
// // Filter entityColumns to keep only those whose key exists in searchableAttributes
|
|
3563
|
+
// const filteredEntityColumns = entityColumns.filter((column) =>
|
|
3564
|
+
// searchableKeys.has(column.key)
|
|
3565
|
+
// );
|
|
3566
|
+
// const attributesData = teis.map((tei: any, idx: number) => {
|
|
3567
|
+
// const row: TableRow = {
|
|
3568
|
+
// trackedEntityInstance: tei.trackedEntity,
|
|
3569
|
+
// index: (pager.page - 1) * pager.pageSize + idx + 1,
|
|
3570
|
+
// };
|
|
3571
|
+
// allAttributes.forEach((attrId: string) => (row[attrId] = ''));
|
|
3572
|
+
// const matchingEnrollment = tei.enrollments.find(
|
|
3573
|
+
// (enrollment: any) => enrollment.program === programId
|
|
3574
|
+
// );
|
|
3575
|
+
// const attributesToUse = matchingEnrollment
|
|
3576
|
+
// ? matchingEnrollment.attributes
|
|
3577
|
+
// : tei.attributes;
|
|
3578
|
+
// console.log('RESPONSE::: ', JSON.stringify(attributesToUse));
|
|
3579
|
+
// console.log('HERE WEARE', JSON.stringify(response.metadata));
|
|
3580
|
+
// if (isOptionSetNameVisible) {
|
|
3581
|
+
// attributesToUse.forEach(
|
|
3582
|
+
// (attr: any) => (row[attr.attribute] = attr.value)
|
|
3583
|
+
// );
|
|
3584
|
+
// } else {
|
|
3585
|
+
// attributesToUse.forEach(
|
|
3586
|
+
// (attr: any) => (row[attr.attribute] = attr.value)
|
|
3587
|
+
// );
|
|
3588
|
+
// }
|
|
3589
|
+
// //include orgUnit in the row for id access
|
|
3590
|
+
// row['orgUnitId'] = matchingEnrollment.orgUnit;
|
|
3591
|
+
// // Access the name of the orgUnit using the Map
|
|
3592
|
+
// // row['orgUnit'] = matchingEnrollment.orgUnitName;
|
|
3593
|
+
// row['orgUnit'] = orgUnitMap?.get(matchingEnrollment.orgUnit) || 'N/A';
|
|
3594
|
+
// // row['orgUnit'] =
|
|
3595
|
+
// // orgUnitMap && orgUnitMap[matchingEnrollment.orgUnit]
|
|
3596
|
+
// // ? orgUnitMap[matchingEnrollment.orgUnit]
|
|
3597
|
+
// // : 'N/A';
|
|
3598
|
+
// return row;
|
|
3599
|
+
// });
|
|
3600
|
+
// return {
|
|
3601
|
+
// columns: entityColumns,
|
|
3602
|
+
// data: attributesData,
|
|
3603
|
+
// filteredEntityColumns: filteredEntityColumns,
|
|
3604
|
+
// };
|
|
3605
|
+
// };
|
|
3606
|
+
const getTrackedEntityData = (response, programId, pager, isOptionSetNameVisible, filters) => {
|
|
3607
|
+
let teis = response.data?.trackedEntities ??
|
|
3608
|
+
response.data?.instances ??
|
|
3609
|
+
[];
|
|
3610
|
+
const programMetaData = response.metadata.programTrackedEntityAttributes;
|
|
3466
3611
|
const orgUnitMap = response.data.orgUnitsMap;
|
|
3467
3612
|
const mappedProgramMetadataAttributes = programMetaData.map((attr) => ({
|
|
3468
3613
|
displayInList: attr.displayInList,
|
|
3469
3614
|
searchable: attr.searchable,
|
|
3470
3615
|
id: attr.trackedEntityAttribute.id,
|
|
3616
|
+
optionSet: attr.trackedEntityAttribute.optionSetValue
|
|
3617
|
+
? attr.trackedEntityAttribute.optionSet
|
|
3618
|
+
: null,
|
|
3471
3619
|
}));
|
|
3472
3620
|
const programAttributesMap = programMetaData.reduce((acc, attribute) => {
|
|
3473
3621
|
if (attribute.displayInList) {
|
|
@@ -3501,7 +3649,6 @@ const getTrackedEntityData = (response, programId, pager, filters) => {
|
|
|
3501
3649
|
};
|
|
3502
3650
|
});
|
|
3503
3651
|
entityColumns = entityColumns.filter((column) => {
|
|
3504
|
-
// Check if the column label is part of any value in programAttributesMap
|
|
3505
3652
|
return Object.values(programAttributesMap).some((value) => value.includes(column.label));
|
|
3506
3653
|
});
|
|
3507
3654
|
// Add orgUnit as the first column
|
|
@@ -3512,15 +3659,12 @@ const getTrackedEntityData = (response, programId, pager, filters) => {
|
|
|
3512
3659
|
const searchableAttributes = mappedProgramMetadataAttributes
|
|
3513
3660
|
.filter((attr) => attr.searchable && attr.displayInList)
|
|
3514
3661
|
.map((attr) => ({
|
|
3515
|
-
// label: attr.trackedEntityAttribute.displayName,
|
|
3516
3662
|
key: attr.id,
|
|
3517
3663
|
}));
|
|
3518
|
-
// Extract keys from searchableAttributes for quick lookup
|
|
3519
3664
|
const searchableKeys = new Set(searchableAttributes.map((attr) => attr.key));
|
|
3520
|
-
// Filter entityColumns to keep only those whose key exists in searchableAttributes
|
|
3521
3665
|
const filteredEntityColumns = entityColumns.filter((column) => searchableKeys.has(column.key));
|
|
3522
3666
|
const attributesData = teis.map((tei, idx) => {
|
|
3523
|
-
|
|
3667
|
+
const row = {
|
|
3524
3668
|
trackedEntityInstance: tei.trackedEntity,
|
|
3525
3669
|
index: (pager.page - 1) * pager.pageSize + idx + 1,
|
|
3526
3670
|
};
|
|
@@ -3529,16 +3673,27 @@ const getTrackedEntityData = (response, programId, pager, filters) => {
|
|
|
3529
3673
|
const attributesToUse = matchingEnrollment
|
|
3530
3674
|
? matchingEnrollment.attributes
|
|
3531
3675
|
: tei.attributes;
|
|
3532
|
-
|
|
3533
|
-
|
|
3676
|
+
// If option set names are visible, transform the attribute values
|
|
3677
|
+
if (isOptionSetNameVisible) {
|
|
3678
|
+
attributesToUse.forEach((attr) => {
|
|
3679
|
+
const attributeMeta = programMetaData.find((metadata) => metadata.trackedEntityAttribute.id === attr.attribute);
|
|
3680
|
+
// Check if the attribute has an option set and map value to option name
|
|
3681
|
+
if (attributeMeta?.trackedEntityAttribute.optionSetValue) {
|
|
3682
|
+
const optionSet = attributeMeta?.trackedEntityAttribute?.optionSet;
|
|
3683
|
+
const option = optionSet?.options?.find((option) => option.code === attr.value);
|
|
3684
|
+
row[attr.attribute] = option ? option.name : attr.value;
|
|
3685
|
+
}
|
|
3686
|
+
else {
|
|
3687
|
+
row[attr.attribute] = attr.value;
|
|
3688
|
+
}
|
|
3689
|
+
});
|
|
3690
|
+
}
|
|
3691
|
+
else {
|
|
3692
|
+
attributesToUse.forEach((attr) => (row[attr.attribute] = attr.value));
|
|
3693
|
+
}
|
|
3694
|
+
// Include orgUnit in the row for id access
|
|
3534
3695
|
row['orgUnitId'] = matchingEnrollment.orgUnit;
|
|
3535
|
-
// Access the name of the orgUnit using the Map
|
|
3536
|
-
// row['orgUnit'] = matchingEnrollment.orgUnitName;
|
|
3537
3696
|
row['orgUnit'] = orgUnitMap?.get(matchingEnrollment.orgUnit) || 'N/A';
|
|
3538
|
-
// row['orgUnit'] =
|
|
3539
|
-
// orgUnitMap && orgUnitMap[matchingEnrollment.orgUnit]
|
|
3540
|
-
// ? orgUnitMap[matchingEnrollment.orgUnit]
|
|
3541
|
-
// : 'N/A';
|
|
3542
3697
|
return row;
|
|
3543
3698
|
});
|
|
3544
3699
|
return {
|
|
@@ -3550,15 +3705,15 @@ const getTrackedEntityData = (response, programId, pager, filters) => {
|
|
|
3550
3705
|
const getEventData = (response, pager) => {
|
|
3551
3706
|
const events = response.data.events;
|
|
3552
3707
|
const uniqueDataElements = new Set();
|
|
3553
|
-
events
|
|
3554
|
-
event
|
|
3708
|
+
events?.forEach((event) => {
|
|
3709
|
+
event?.dataValues.forEach((dv) => uniqueDataElements.add(dv.dataElement));
|
|
3555
3710
|
});
|
|
3556
3711
|
const entityColumns = Array.from(uniqueDataElements).map((dataElement) => ({
|
|
3557
3712
|
label: response.metadata.programStages[0].programStageDataElements.find((psde) => psde.dataElement.id === dataElement)?.dataElement.name || dataElement,
|
|
3558
3713
|
key: dataElement,
|
|
3559
3714
|
}));
|
|
3560
3715
|
const dataElementsData = events.map((event, idx) => {
|
|
3561
|
-
|
|
3716
|
+
const row = {
|
|
3562
3717
|
event: event.event,
|
|
3563
3718
|
index: (pager.page - 1) * pager.pageSize + idx + 1,
|
|
3564
3719
|
};
|
|
@@ -3774,6 +3929,7 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
3774
3929
|
this.firstValue = new EventEmitter();
|
|
3775
3930
|
this.filterRootOrgUnit = false;
|
|
3776
3931
|
this.showFilters = false;
|
|
3932
|
+
this.isOptionSetNameVisible = false;
|
|
3777
3933
|
this.setReactStateUpdaters = (updaters) => {
|
|
3778
3934
|
this.reactStateUpdaters = updaters;
|
|
3779
3935
|
};
|
|
@@ -3789,6 +3945,7 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
3789
3945
|
});
|
|
3790
3946
|
const paginationRef = useRef(null);
|
|
3791
3947
|
const [programIdState, setProgramIdState] = useState(this.programId);
|
|
3948
|
+
const [isOptionSetNameVisibleState, setOptionSetNameVisible] = useState(this.isOptionSetNameVisible);
|
|
3792
3949
|
const [orgUnitState, setOrgUnitState] = useState(this.orgUnit);
|
|
3793
3950
|
const [programStageIdState, setProgramStageIdState] = useState(this.programStageId);
|
|
3794
3951
|
const [attributeFiltersState, setAttributeFiltersState] = useState(this.attributeFilters);
|
|
@@ -3817,6 +3974,7 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
3817
3974
|
setStartDateState,
|
|
3818
3975
|
setEndDateState,
|
|
3819
3976
|
setIsButtonLoading,
|
|
3977
|
+
setOptionSetNameVisible
|
|
3820
3978
|
});
|
|
3821
3979
|
useEffect(() => {
|
|
3822
3980
|
this.setReactStateUpdaters?.(updateRefs.current);
|
|
@@ -3836,16 +3994,26 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
3836
3994
|
entityColumns = columns;
|
|
3837
3995
|
entityData = data;
|
|
3838
3996
|
}
|
|
3839
|
-
else if ('trackedEntities' in response.data
|
|
3840
|
-
|
|
3841
|
-
const
|
|
3997
|
+
else if ('trackedEntities' in response.data ||
|
|
3998
|
+
'instances' in response.data) {
|
|
3999
|
+
const responseData = response.data;
|
|
4000
|
+
responsePager = response.data.pager || {
|
|
4001
|
+
page: responseData.page,
|
|
4002
|
+
pageSize: responseData.pageSize,
|
|
4003
|
+
total: responseData.total,
|
|
4004
|
+
pageCount: responseData.pageCount,
|
|
4005
|
+
};
|
|
4006
|
+
const { columns, data, filteredEntityColumns } = getTrackedEntityData(response, this.programId, pager, this.isOptionSetNameVisible, this.filters);
|
|
3842
4007
|
entityColumns = columns;
|
|
3843
4008
|
entityData = data;
|
|
3844
4009
|
//TODO: Should be done on the parent
|
|
3845
4010
|
const checkValues = [
|
|
3846
4011
|
...new Set(response.data?.trackedEntities?.[0]?.enrollments?.[0]?.events?.flatMap((event) => event.dataValues
|
|
3847
4012
|
.filter((dataValue) => /^[A-Za-z]{3}$/.test(dataValue.value))
|
|
3848
|
-
.map((dataValue) => dataValue.value))
|
|
4013
|
+
.map((dataValue) => dataValue.value)) ??
|
|
4014
|
+
response.data?.instances?.[0]?.enrollments?.[0]?.events?.flatMap((event) => event.dataValues
|
|
4015
|
+
.filter((dataValue) => /^[A-Za-z]{3}$/.test(dataValue.value))
|
|
4016
|
+
.map((dataValue) => dataValue.value))),
|
|
3849
4017
|
];
|
|
3850
4018
|
if (checkValues) {
|
|
3851
4019
|
// this.firstValue.emit(firstTei);
|
|
@@ -3879,6 +4047,7 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
3879
4047
|
endDateState,
|
|
3880
4048
|
pager.page,
|
|
3881
4049
|
pager.pageSize,
|
|
4050
|
+
isOptionSetNameVisibleState
|
|
3882
4051
|
]);
|
|
3883
4052
|
const getDropdownOptions = (row) => {
|
|
3884
4053
|
return (this.actionOptions || []).map((option) => ({
|
|
@@ -3894,7 +4063,8 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
3894
4063
|
this.lineListService
|
|
3895
4064
|
.getLineListData(this.programId, this.orgUnit, this.programStageId, pager.page, 1000, this.attributeFilters, this.startDate, this.endDate, this.ouMode)
|
|
3896
4065
|
.subscribe((response) => {
|
|
3897
|
-
if ('trackedEntities' in response.data
|
|
4066
|
+
if ('trackedEntities' in response.data ||
|
|
4067
|
+
'instances' in response.data) {
|
|
3898
4068
|
const trackedEntityInstances = response.data.trackedEntities;
|
|
3899
4069
|
// Map TEIs to objects with teiId and enrollmentId
|
|
3900
4070
|
const teiEnrollmentList = trackedEntityInstances
|
|
@@ -4044,6 +4214,9 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
4044
4214
|
if (changes['programId']) {
|
|
4045
4215
|
this.reactStateUpdaters.setProgramIdState(this.programId);
|
|
4046
4216
|
}
|
|
4217
|
+
if (changes['isOptionSetNameVisible']) {
|
|
4218
|
+
this.reactStateUpdaters.setOptionSetNameVisible(this.isOptionSetNameVisible);
|
|
4219
|
+
}
|
|
4047
4220
|
if (changes['orgUnit']) {
|
|
4048
4221
|
this.reactStateUpdaters.setOrgUnitState(this.orgUnit);
|
|
4049
4222
|
}
|
|
@@ -4072,7 +4245,7 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
4072
4245
|
this.render();
|
|
4073
4246
|
}
|
|
4074
4247
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: LineListTableComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
4075
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.8", type: LineListTableComponent, isStandalone: false, selector: "ng-dhis2-ui-line-list", inputs: { programId: "programId", orgUnit: "orgUnit", programStageId: "programStageId", actionOptions: "actionOptions", attributeFilters: "attributeFilters", useOuModeWithOlderDHIS2Instance: "useOuModeWithOlderDHIS2Instance", startDate: "startDate", endDate: "endDate", filters: "filters", ouMode: "ouMode", dispatchTeis: "dispatchTeis", isButtonLoading: "isButtonLoading", buttonLabel: "buttonLabel", buttonFilter: "buttonFilter", filterRootOrgUnit: "filterRootOrgUnit", showFilters: "showFilters" }, outputs: { actionSelected: "actionSelected", approvalSelected: "approvalSelected", firstValue: "firstValue" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: ["::ng-deep .custom-input{display:flex!important;gap:4px!important;align-items:center!important;border:1px solid #9FADBA!important;border-radius:4px!important;padding-left:16px}::ng-deep .custom-input input{border:none!important;outline:none!important;box-shadow:none!important}::ng-deep .custom-input input:focus{border:none!important;box-shadow:none!important}::ng-deep .custom-input label{color:gray!important;opacity:1}::ng-deep .table-top-toolbar{background-color:var(--colors-grey100)!important;color:var(--colors-grey900)!important}\n"] }); }
|
|
4248
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.8", type: LineListTableComponent, isStandalone: false, selector: "ng-dhis2-ui-line-list", inputs: { programId: "programId", orgUnit: "orgUnit", programStageId: "programStageId", actionOptions: "actionOptions", attributeFilters: "attributeFilters", useOuModeWithOlderDHIS2Instance: "useOuModeWithOlderDHIS2Instance", startDate: "startDate", endDate: "endDate", filters: "filters", ouMode: "ouMode", dispatchTeis: "dispatchTeis", isButtonLoading: "isButtonLoading", buttonLabel: "buttonLabel", buttonFilter: "buttonFilter", filterRootOrgUnit: "filterRootOrgUnit", showFilters: "showFilters", isOptionSetNameVisible: "isOptionSetNameVisible" }, outputs: { actionSelected: "actionSelected", approvalSelected: "approvalSelected", firstValue: "firstValue" }, usesInheritance: true, usesOnChanges: true, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, styles: ["::ng-deep .custom-input{display:flex!important;gap:4px!important;align-items:center!important;border:1px solid #9FADBA!important;border-radius:4px!important;padding-left:16px}::ng-deep .custom-input input{border:none!important;outline:none!important;box-shadow:none!important}::ng-deep .custom-input input:focus{border:none!important;box-shadow:none!important}::ng-deep .custom-input label{color:gray!important;opacity:1}::ng-deep .table-top-toolbar{background-color:var(--colors-grey100)!important;color:var(--colors-grey900)!important}\n"] }); }
|
|
4076
4249
|
}
|
|
4077
4250
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: LineListTableComponent, decorators: [{
|
|
4078
4251
|
type: Component,
|
|
@@ -4115,6 +4288,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImpor
|
|
|
4115
4288
|
type: Input
|
|
4116
4289
|
}], showFilters: [{
|
|
4117
4290
|
type: Input
|
|
4291
|
+
}], isOptionSetNameVisible: [{
|
|
4292
|
+
type: Input
|
|
4118
4293
|
}] } });
|
|
4119
4294
|
|
|
4120
4295
|
class LineListModule {
|
|
@@ -6757,7 +6932,6 @@ class SelectionFiltersComponent extends ReactWrapperModule {
|
|
|
6757
6932
|
} },
|
|
6758
6933
|
React__default.createElement("div", { style: { width: '100%' } },
|
|
6759
6934
|
React__default.createElement(InputField$1, { value: displayValue, label: "Organization Unit", readOnly: false, onFocus: () => setShowOrgUnit(true), onBlur: () => {
|
|
6760
|
-
this.ngZone.run(() => console.log('THIS IS IT::: '));
|
|
6761
6935
|
setTouched(true);
|
|
6762
6936
|
} }),
|
|
6763
6937
|
showOrgUnit && (React__default.createElement(this.FieldOrgUnitSelector, { onCancelOrgUnit: () => {
|