@iapps/ng-dhis2-ui 1.1.78 → 1.1.80
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.
|
@@ -3564,6 +3564,7 @@ class LineListService {
|
|
|
3564
3564
|
// })
|
|
3565
3565
|
// );
|
|
3566
3566
|
// }
|
|
3567
|
+
//tracker/trackedEntities.json?program=${programId}&orgUnit=${orgUnit}${ouModeIdentifier}&page=${page}&pageSize=${pageSize}&fields=trackedEntity,orgUnit,attributes[*],enrollments[*]&totalPages=true&${filterParams}${dateFilter}&order=createdAt:desc&trackedEntities=uid1,uid2,uid3
|
|
3567
3568
|
getTrackedEntityInstances(programId, orgUnit, page, pageSize, filters = [], startDate, endDate, ouMode, filterRootOrgUnit, useOuModeWithOlderDHIS2Instance, filtersFromEvents = []) {
|
|
3568
3569
|
const filterParams = buildFilters(filters);
|
|
3569
3570
|
const filterParamsFromEvents = buildFiltersFromEvents(filtersFromEvents);
|
|
@@ -3615,7 +3616,109 @@ class LineListService {
|
|
|
3615
3616
|
})));
|
|
3616
3617
|
}));
|
|
3617
3618
|
}
|
|
3618
|
-
//
|
|
3619
|
+
// private getTrackedEntityInstances(
|
|
3620
|
+
// programId: string,
|
|
3621
|
+
// orgUnit: string,
|
|
3622
|
+
// page: number,
|
|
3623
|
+
// pageSize: number,
|
|
3624
|
+
// filters: AttributeFilter[] = [],
|
|
3625
|
+
// startDate?: string,
|
|
3626
|
+
// endDate?: string,
|
|
3627
|
+
// ouMode?: string,
|
|
3628
|
+
// filterRootOrgUnit?: boolean,
|
|
3629
|
+
// useOuModeWithOlderDHIS2Instance?: boolean,
|
|
3630
|
+
// filtersFromEvents: FilterConfig[] = []
|
|
3631
|
+
// ): Observable<TrackedEntityResponse> {
|
|
3632
|
+
// const filterParams = buildFilters(filters);
|
|
3633
|
+
// const filterParamsFromEvents = buildFiltersFromEvents(filtersFromEvents);
|
|
3634
|
+
// const dateFilter = [
|
|
3635
|
+
// startDate ? `enrollmentEnrolledAfter=${startDate}` : '',
|
|
3636
|
+
// endDate ? `enrollmentEnrolledBefore=${endDate}` : '',
|
|
3637
|
+
// ]
|
|
3638
|
+
// .filter(Boolean)
|
|
3639
|
+
// .join('&');
|
|
3640
|
+
// const ouModeIdentifier =
|
|
3641
|
+
// ouMode && useOuModeWithOlderDHIS2Instance
|
|
3642
|
+
// ? `&ouMode=${ouMode}`
|
|
3643
|
+
// : `&orgUnitMode=${ouMode}`;
|
|
3644
|
+
// let baseUrl='';
|
|
3645
|
+
// if(filtersFromEvents.length === 0) {
|
|
3646
|
+
// baseUrl = `tracker/trackedEntities.json?program=${programId}&orgUnit=${orgUnit}${ouModeIdentifier}&page=${page}&pageSize=${pageSize}&fields=trackedEntity,orgUnit,attributes[*],enrollments[*]&totalPages=true&${filterParams}${dateFilter}&order=createdAt:desc`;
|
|
3647
|
+
// } else {
|
|
3648
|
+
// baseUrl = `tracker/trackedEntities.json?program=${programId}&orgUnit=${orgUnit}${ouModeIdentifier}&fields=trackedEntity,orgUnit,attributes[*],enrollments[*]&${filterParams}${dateFilter}&order=createdAt:desc&paging=false`;
|
|
3649
|
+
// }
|
|
3650
|
+
// return this.httpClient.get(baseUrl).pipe(
|
|
3651
|
+
// switchMap((response: any) => {
|
|
3652
|
+
// if (filterRootOrgUnit) {
|
|
3653
|
+
// response.trackedEntities = response.trackedEntities.filter(
|
|
3654
|
+
// (tei: any) => tei.orgUnit !== orgUnit
|
|
3655
|
+
// );
|
|
3656
|
+
// }
|
|
3657
|
+
// const uniqueOrgUnitIds = new Set<string>();
|
|
3658
|
+
// if (response && response.trackedEntities) {
|
|
3659
|
+
// response.trackedEntities.forEach((tei: any) => {
|
|
3660
|
+
// tei.enrollments?.forEach((enrollment: any) => {
|
|
3661
|
+
// if (enrollment.program === programId) {
|
|
3662
|
+
// uniqueOrgUnitIds.add(enrollment.orgUnit);
|
|
3663
|
+
// }
|
|
3664
|
+
// });
|
|
3665
|
+
// });
|
|
3666
|
+
// } else {
|
|
3667
|
+
// response?.instances?.forEach((tei: any) => {
|
|
3668
|
+
// tei.enrollments?.forEach((enrollment: any) => {
|
|
3669
|
+
// if (enrollment.program === programId) {
|
|
3670
|
+
// uniqueOrgUnitIds.add(enrollment.orgUnit);
|
|
3671
|
+
// }
|
|
3672
|
+
// });
|
|
3673
|
+
// });
|
|
3674
|
+
// }
|
|
3675
|
+
// if (filtersFromEvents.length === 0) {
|
|
3676
|
+
// if (uniqueOrgUnitIds.size === 0) {
|
|
3677
|
+
// return of({ ...response, orgUnitsMap: new Map<string, string>() });
|
|
3678
|
+
// }
|
|
3679
|
+
// return this.fetchOrgUnits(Array.from(uniqueOrgUnitIds)).pipe(
|
|
3680
|
+
// map((orgUnitsMap: Map<string, string>) => ({
|
|
3681
|
+
// ...response,
|
|
3682
|
+
// orgUnitsMap,
|
|
3683
|
+
// }))
|
|
3684
|
+
// );
|
|
3685
|
+
// }
|
|
3686
|
+
// // NEW LOGIC STARTS HERE if filtersFromEvents is present
|
|
3687
|
+
// const filteredTrackedEntities = getFilteredTrackedEntites(
|
|
3688
|
+
// response.trackedEntities,
|
|
3689
|
+
// filtersFromEvents
|
|
3690
|
+
// );
|
|
3691
|
+
// const trackedEntityIds = filteredTrackedEntities
|
|
3692
|
+
// .map((tei: any) => tei.trackedEntity)
|
|
3693
|
+
// .join(',');
|
|
3694
|
+
// if (!trackedEntityIds) {
|
|
3695
|
+
// return of({
|
|
3696
|
+
// trackedEntities: [],
|
|
3697
|
+
// orgUnitsMap: new Map<string, string>(),
|
|
3698
|
+
// });
|
|
3699
|
+
// }
|
|
3700
|
+
// const refetchUrl = `tracker/trackedEntities.json?program=${programId}&orgUnit=${orgUnit}${ouModeIdentifier}&page=${page}&pageSize=${pageSize}&fields=trackedEntity,orgUnit,attributes[*],enrollments[*]&totalPages=true&${filterParams}${dateFilter}&order=createdAt:desc&trackedEntities=${trackedEntityIds}`;
|
|
3701
|
+
// return this.httpClient.get(refetchUrl).pipe(
|
|
3702
|
+
// switchMap((filteredResponse: any) => {
|
|
3703
|
+
// const orgUnitIds = new Set<string>();
|
|
3704
|
+
// filteredResponse.trackedEntities?.forEach((tei: any) => {
|
|
3705
|
+
// tei.enrollments?.forEach((enrollment: any) => {
|
|
3706
|
+
// if (enrollment.program === programId) {
|
|
3707
|
+
// orgUnitIds.add(enrollment.orgUnit);
|
|
3708
|
+
// }
|
|
3709
|
+
// });
|
|
3710
|
+
// });
|
|
3711
|
+
// return this.fetchOrgUnits(Array.from(orgUnitIds)).pipe(
|
|
3712
|
+
// map((orgUnitsMap: Map<string, string>) => ({
|
|
3713
|
+
// ...filteredResponse,
|
|
3714
|
+
// orgUnitsMap,
|
|
3715
|
+
// }))
|
|
3716
|
+
// );
|
|
3717
|
+
// })
|
|
3718
|
+
// );
|
|
3719
|
+
// })
|
|
3720
|
+
// );
|
|
3721
|
+
// }
|
|
3619
3722
|
/**
|
|
3620
3723
|
* Fetch orgUnit names for given orgUnit IDs
|
|
3621
3724
|
*/
|
|
@@ -4344,6 +4447,22 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
4344
4447
|
return updatedFilters;
|
|
4345
4448
|
});
|
|
4346
4449
|
};
|
|
4450
|
+
//TODO: MERGE THIS WITH HANDLE INPUT CHANGE PUT A CHECK FOR IF ITS A SELECT FIELD TO USE EQ
|
|
4451
|
+
const handleInputChangeForSelectField = (key, value) => {
|
|
4452
|
+
setInputValues((prevValues) => ({
|
|
4453
|
+
...prevValues,
|
|
4454
|
+
[key]: value ?? '',
|
|
4455
|
+
}));
|
|
4456
|
+
setAttributeFiltersState((prevFilters = []) => {
|
|
4457
|
+
// Remove old filter for this key
|
|
4458
|
+
const filteredFilters = prevFilters.filter((f) => f.attribute !== key);
|
|
4459
|
+
// Only add new filter if value is not empty
|
|
4460
|
+
const updatedFilters = value.trim()
|
|
4461
|
+
? [...filteredFilters, { attribute: key, operator: 'eq', value }]
|
|
4462
|
+
: filteredFilters;
|
|
4463
|
+
return updatedFilters;
|
|
4464
|
+
});
|
|
4465
|
+
};
|
|
4347
4466
|
const handleDateSelect = (key, selectedDate) => {
|
|
4348
4467
|
const selectedDateString = selectedDate?.calendarDateString ?? ''; // Default to empty string if null
|
|
4349
4468
|
// Update dateStates
|
|
@@ -4410,12 +4529,15 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
4410
4529
|
} },
|
|
4411
4530
|
React__default.createElement(InputField$1, { key: "location",
|
|
4412
4531
|
//label={orgUnitLabel}
|
|
4413
|
-
label: orgUnitLabel ? orgUnitLabel : 'registering unit', value: selectedOrgUnit,
|
|
4532
|
+
label: orgUnitLabel ? orgUnitLabel : 'registering unit', value: selectedOrgUnit, onFocus: () => setHide(false), className: "custom-input", onChange: (event) => {
|
|
4414
4533
|
setSelectedOrgUnit(event.value);
|
|
4415
4534
|
setOrgUnitState(defaultOrgUnit);
|
|
4416
4535
|
} }),
|
|
4417
4536
|
React__default.createElement(CalendarInput, { label: "Start date:", calendar: "gregory", locale: "en-GB", timeZone: "Africa/Dar_es_Salaam", className: "custom-input", date: startDateState, onDateSelect: (selectedDate) => {
|
|
4418
|
-
|
|
4537
|
+
if (selectedDate?.calendarDateString) {
|
|
4538
|
+
setStartDateState(selectedDate.calendarDateString);
|
|
4539
|
+
}
|
|
4540
|
+
// setStartDateState(selectedDate.calendarDateString);
|
|
4419
4541
|
} }),
|
|
4420
4542
|
React__default.createElement(CalendarInput, { label: "End date:", calendar: "gregory", locale: "en-GB", timeZone: "Africa/Dar_es_Salaam", className: "custom-input", date: endDateState, onDateSelect: (selectedDate) => {
|
|
4421
4543
|
setEndDateState(selectedDate.calendarDateString);
|
|
@@ -4432,7 +4554,7 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
4432
4554
|
...prevValues,
|
|
4433
4555
|
[key]: selected ?? '',
|
|
4434
4556
|
}));
|
|
4435
|
-
|
|
4557
|
+
handleInputChangeForSelectField(key, selected ?? '');
|
|
4436
4558
|
} }, (options.options ?? []).map((opt) => (React__default.createElement(SingleSelectOption, { key: opt.id, label: opt.name, value: opt.code })))));
|
|
4437
4559
|
}
|
|
4438
4560
|
// Fallback: default InputField
|
|
@@ -4538,11 +4660,11 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
4538
4660
|
this.render();
|
|
4539
4661
|
}
|
|
4540
4662
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: LineListTableComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
4541
|
-
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", actionOptionOrientation: "actionOptionOrientation", 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;margin:0;padding:0 0 0 8px;background-color:#fff!important}::ng-deep .custom-input div{margin:0!important}::ng-deep .custom-input label{font-size:12px;padding-right:0}::ng-deep .custom-input input{border:none!important;font-size:12px!important;display:flex;align-items:center;padding-left:4px;height:40px;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}::ng-deep .custom-select-input{display:flex!important;gap:4px!important;align-items:center!important;border:1px solid #9fadba!important;border-radius:4px!important;margin:0;padding:0 0 0 8px;background-color:#fff!important}::ng-deep .custom-select-input div{margin:0!important}::ng-deep .custom-select-input [data-test=dhis2-uiwidgets-singleselectfield-label]{font-size:12px;color:gray!important}::ng-deep .custom-select-input [data-test=dhis2-uicore-select-input]{border:none!important;font-size:12px!important;display:flex;align-items:center;padding-left:4px;height:40px;outline:none!important;box-shadow:none!important}::ng-deep .custom-select-input [data-test=dhis2-uicore-select-input]:focus-within{box-shadow:none!important}::ng-deep .custom-select-input input:focus{border:none!important;box-shadow:none!important}\n"] }); }
|
|
4663
|
+
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", actionOptionOrientation: "actionOptionOrientation", 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;margin:0;padding:0 0 0 8px;background-color:#fff!important}::ng-deep .custom-input div{margin:0!important}::ng-deep .custom-input label{font-size:12px;padding-right:0}::ng-deep .custom-input input{border:none!important;font-size:12px!important;display:flex;align-items:center;padding-left:4px;height:40px;outline:none!important;box-shadow:none!important}::ng-deep .custom-input input:focus{border:none!important;box-shadow:none!important}::ng-deep .custom-input [data-test=calendar-clear-button]{background-color:#f2f2f2!important;color:#870808!important;border-radius:6px!important;padding:4px 10px!important;font-size:14px!important}::ng-deep .custom-input [data-test=calendar-clear-button]:hover{background-color:#ddd}::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}::ng-deep .custom-select-input{display:flex!important;gap:4px!important;align-items:center!important;border:1px solid #9fadba!important;border-radius:4px!important;margin:0;padding:0 0 0 8px;background-color:#fff!important}::ng-deep .custom-select-input div{margin:0!important}::ng-deep .custom-select-input [data-test=dhis2-uiwidgets-singleselectfield-label]{font-size:12px;color:gray!important}::ng-deep .custom-select-input [data-test=dhis2-uicore-select-input]{border:none!important;font-size:12px!important;display:flex;align-items:center;padding-left:4px;height:40px;outline:none!important;box-shadow:none!important}::ng-deep .custom-select-input [data-test=dhis2-uicore-select-input]:focus-within{box-shadow:none!important}::ng-deep .custom-select-input input:focus{border:none!important;box-shadow:none!important}\n"] }); }
|
|
4542
4664
|
}
|
|
4543
4665
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: LineListTableComponent, decorators: [{
|
|
4544
4666
|
type: Component,
|
|
4545
|
-
args: [{ selector: 'ng-dhis2-ui-line-list', template: '<ng-content></ng-content>', standalone: false, styles: ["::ng-deep .custom-input{display:flex!important;gap:4px!important;align-items:center!important;border:1px solid #9fadba!important;border-radius:4px!important;margin:0;padding:0 0 0 8px;background-color:#fff!important}::ng-deep .custom-input div{margin:0!important}::ng-deep .custom-input label{font-size:12px;padding-right:0}::ng-deep .custom-input input{border:none!important;font-size:12px!important;display:flex;align-items:center;padding-left:4px;height:40px;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}::ng-deep .custom-select-input{display:flex!important;gap:4px!important;align-items:center!important;border:1px solid #9fadba!important;border-radius:4px!important;margin:0;padding:0 0 0 8px;background-color:#fff!important}::ng-deep .custom-select-input div{margin:0!important}::ng-deep .custom-select-input [data-test=dhis2-uiwidgets-singleselectfield-label]{font-size:12px;color:gray!important}::ng-deep .custom-select-input [data-test=dhis2-uicore-select-input]{border:none!important;font-size:12px!important;display:flex;align-items:center;padding-left:4px;height:40px;outline:none!important;box-shadow:none!important}::ng-deep .custom-select-input [data-test=dhis2-uicore-select-input]:focus-within{box-shadow:none!important}::ng-deep .custom-select-input input:focus{border:none!important;box-shadow:none!important}\n"] }]
|
|
4667
|
+
args: [{ selector: 'ng-dhis2-ui-line-list', template: '<ng-content></ng-content>', standalone: false, styles: ["::ng-deep .custom-input{display:flex!important;gap:4px!important;align-items:center!important;border:1px solid #9fadba!important;border-radius:4px!important;margin:0;padding:0 0 0 8px;background-color:#fff!important}::ng-deep .custom-input div{margin:0!important}::ng-deep .custom-input label{font-size:12px;padding-right:0}::ng-deep .custom-input input{border:none!important;font-size:12px!important;display:flex;align-items:center;padding-left:4px;height:40px;outline:none!important;box-shadow:none!important}::ng-deep .custom-input input:focus{border:none!important;box-shadow:none!important}::ng-deep .custom-input [data-test=calendar-clear-button]{background-color:#f2f2f2!important;color:#870808!important;border-radius:6px!important;padding:4px 10px!important;font-size:14px!important}::ng-deep .custom-input [data-test=calendar-clear-button]:hover{background-color:#ddd}::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}::ng-deep .custom-select-input{display:flex!important;gap:4px!important;align-items:center!important;border:1px solid #9fadba!important;border-radius:4px!important;margin:0;padding:0 0 0 8px;background-color:#fff!important}::ng-deep .custom-select-input div{margin:0!important}::ng-deep .custom-select-input [data-test=dhis2-uiwidgets-singleselectfield-label]{font-size:12px;color:gray!important}::ng-deep .custom-select-input [data-test=dhis2-uicore-select-input]{border:none!important;font-size:12px!important;display:flex;align-items:center;padding-left:4px;height:40px;outline:none!important;box-shadow:none!important}::ng-deep .custom-select-input [data-test=dhis2-uicore-select-input]:focus-within{box-shadow:none!important}::ng-deep .custom-select-input input:focus{border:none!important;box-shadow:none!important}\n"] }]
|
|
4546
4668
|
}], propDecorators: { programId: [{
|
|
4547
4669
|
type: Input
|
|
4548
4670
|
}], orgUnit: [{
|