@iapps/ng-dhis2-ui 1.1.77 → 1.1.79
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 +187 -47
- package/fesm2022/iapps-ng-dhis2-ui.mjs.map +1 -1
- package/lib/modules/form/models/form-metadata-section.model.d.ts +2 -0
- package/lib/modules/form/models/form-metadata.model.d.ts +1 -0
- 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/components/data-table-actions/data-table-actions.d.ts +3 -4
- package/lib/modules/line-list/components/dropdown-menu/dropdown-menu.d.ts +2 -11
- package/lib/modules/line-list/containers/line-list.component.d.ts +2 -3
- package/lib/modules/line-list/models/dropdown-menu.model.d.ts +9 -0
- package/lib/modules/line-list/models/index.d.ts +2 -0
- package/lib/modules/line-list/models/line-list-action-option.model.d.ts +5 -0
- package/lib/modules/program-entry-form/models/program-entry-form.config.d.ts +2 -0
- package/package.json +1 -1
|
@@ -3564,6 +3564,78 @@ 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
|
|
3568
|
+
// private getTrackedEntityInstances(
|
|
3569
|
+
// programId: string,
|
|
3570
|
+
// orgUnit: string,
|
|
3571
|
+
// page: number,
|
|
3572
|
+
// pageSize: number,
|
|
3573
|
+
// filters: AttributeFilter[] = [],
|
|
3574
|
+
// startDate?: string,
|
|
3575
|
+
// endDate?: string,
|
|
3576
|
+
// ouMode?: string,
|
|
3577
|
+
// filterRootOrgUnit?: boolean,
|
|
3578
|
+
// useOuModeWithOlderDHIS2Instance?: boolean,
|
|
3579
|
+
// filtersFromEvents: FilterConfig[] = []
|
|
3580
|
+
// ): Observable<TrackedEntityResponse> {
|
|
3581
|
+
// const filterParams = buildFilters(filters);
|
|
3582
|
+
// const filterParamsFromEvents = buildFiltersFromEvents(filtersFromEvents);
|
|
3583
|
+
// const dateFilter = [
|
|
3584
|
+
// startDate ? `enrollmentEnrolledAfter=${startDate}` : '',
|
|
3585
|
+
// endDate ? `enrollmentEnrolledBefore=${endDate}` : '',
|
|
3586
|
+
// ]
|
|
3587
|
+
// .filter(Boolean)
|
|
3588
|
+
// .join('&');
|
|
3589
|
+
// const ouModeIdentifier =
|
|
3590
|
+
// ouMode && useOuModeWithOlderDHIS2Instance
|
|
3591
|
+
// ? `&ouMode=${ouMode}`
|
|
3592
|
+
// : `&orgUnitMode=${ouMode}`;
|
|
3593
|
+
// return this.httpClient
|
|
3594
|
+
// .get(
|
|
3595
|
+
// `tracker/trackedEntities.json?program=${programId}&orgUnit=${orgUnit}${ouModeIdentifier}&page=${page}&pageSize=${pageSize}&fields=trackedEntity,orgUnit,attributes[*],enrollments[*]&totalPages=true&${filterParams}${dateFilter}&order=createdAt:desc`
|
|
3596
|
+
// )
|
|
3597
|
+
// .pipe(
|
|
3598
|
+
// switchMap((response: any) => {
|
|
3599
|
+
// if (filterRootOrgUnit) {
|
|
3600
|
+
// response.trackedEntities = response.trackedEntities.filter(
|
|
3601
|
+
// (tei: any) => tei.orgUnit !== orgUnit
|
|
3602
|
+
// );
|
|
3603
|
+
// }
|
|
3604
|
+
// // **Step 1:** Extract unique orgUnits from enrollments
|
|
3605
|
+
// const uniqueOrgUnitIds = new Set<string>();
|
|
3606
|
+
// if (response && response.trackedEntities) {
|
|
3607
|
+
// response.trackedEntities.forEach((tei: any) => {
|
|
3608
|
+
// tei.enrollments?.forEach((enrollment: any) => {
|
|
3609
|
+
// if (enrollment.program === programId) {
|
|
3610
|
+
// uniqueOrgUnitIds.add(enrollment.orgUnit);
|
|
3611
|
+
// }
|
|
3612
|
+
// });
|
|
3613
|
+
// });
|
|
3614
|
+
// } else {
|
|
3615
|
+
// if (response && response.instances) {
|
|
3616
|
+
// response?.instances?.forEach((tei: any) => {
|
|
3617
|
+
// tei.enrollments?.forEach((enrollment: any) => {
|
|
3618
|
+
// if (enrollment.program === programId) {
|
|
3619
|
+
// uniqueOrgUnitIds.add(enrollment?.orgUnit);
|
|
3620
|
+
// }
|
|
3621
|
+
// });
|
|
3622
|
+
// });
|
|
3623
|
+
// }
|
|
3624
|
+
// }
|
|
3625
|
+
// // If no unique orgUnits found, return immediately
|
|
3626
|
+
// if (uniqueOrgUnitIds.size === 0) {
|
|
3627
|
+
// return of({ ...response, orgUnitsMap: new Map<string, string>() });
|
|
3628
|
+
// }
|
|
3629
|
+
// // **Step 2:** Fetch orgUnit names in a single request
|
|
3630
|
+
// return this.fetchOrgUnits(Array.from(uniqueOrgUnitIds)).pipe(
|
|
3631
|
+
// map((orgUnitsMap: Map<string, string>) => ({
|
|
3632
|
+
// ...response,
|
|
3633
|
+
// orgUnitsMap, // Attach orgUnitId → orgUnitName map
|
|
3634
|
+
// }))
|
|
3635
|
+
// );
|
|
3636
|
+
// })
|
|
3637
|
+
// );
|
|
3638
|
+
// }
|
|
3567
3639
|
getTrackedEntityInstances(programId, orgUnit, page, pageSize, filters = [], startDate, endDate, ouMode, filterRootOrgUnit, useOuModeWithOlderDHIS2Instance, filtersFromEvents = []) {
|
|
3568
3640
|
const filterParams = buildFilters(filters);
|
|
3569
3641
|
const filterParamsFromEvents = buildFiltersFromEvents(filtersFromEvents);
|
|
@@ -3576,13 +3648,17 @@ class LineListService {
|
|
|
3576
3648
|
const ouModeIdentifier = ouMode && useOuModeWithOlderDHIS2Instance
|
|
3577
3649
|
? `&ouMode=${ouMode}`
|
|
3578
3650
|
: `&orgUnitMode=${ouMode}`;
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3651
|
+
let baseUrl = '';
|
|
3652
|
+
if (filtersFromEvents.length === 0) {
|
|
3653
|
+
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`;
|
|
3654
|
+
}
|
|
3655
|
+
else {
|
|
3656
|
+
baseUrl = `tracker/trackedEntities.json?program=${programId}&orgUnit=${orgUnit}${ouModeIdentifier}&fields=trackedEntity,orgUnit,attributes[*],enrollments[*]&${filterParams}${dateFilter}&order=createdAt:desc&paging=false`;
|
|
3657
|
+
}
|
|
3658
|
+
return this.httpClient.get(baseUrl).pipe(switchMap((response) => {
|
|
3582
3659
|
if (filterRootOrgUnit) {
|
|
3583
3660
|
response.trackedEntities = response.trackedEntities.filter((tei) => tei.orgUnit !== orgUnit);
|
|
3584
3661
|
}
|
|
3585
|
-
// **Step 1:** Extract unique orgUnits from enrollments
|
|
3586
3662
|
const uniqueOrgUnitIds = new Set();
|
|
3587
3663
|
if (response && response.trackedEntities) {
|
|
3588
3664
|
response.trackedEntities.forEach((tei) => {
|
|
@@ -3594,28 +3670,51 @@ class LineListService {
|
|
|
3594
3670
|
});
|
|
3595
3671
|
}
|
|
3596
3672
|
else {
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
}
|
|
3603
|
-
});
|
|
3673
|
+
response?.instances?.forEach((tei) => {
|
|
3674
|
+
tei.enrollments?.forEach((enrollment) => {
|
|
3675
|
+
if (enrollment.program === programId) {
|
|
3676
|
+
uniqueOrgUnitIds.add(enrollment.orgUnit);
|
|
3677
|
+
}
|
|
3604
3678
|
});
|
|
3679
|
+
});
|
|
3680
|
+
}
|
|
3681
|
+
if (filtersFromEvents.length === 0) {
|
|
3682
|
+
if (uniqueOrgUnitIds.size === 0) {
|
|
3683
|
+
return of({ ...response, orgUnitsMap: new Map() });
|
|
3605
3684
|
}
|
|
3685
|
+
return this.fetchOrgUnits(Array.from(uniqueOrgUnitIds)).pipe(map$1((orgUnitsMap) => ({
|
|
3686
|
+
...response,
|
|
3687
|
+
orgUnitsMap,
|
|
3688
|
+
})));
|
|
3606
3689
|
}
|
|
3607
|
-
//
|
|
3608
|
-
|
|
3609
|
-
|
|
3690
|
+
// NEW LOGIC STARTS HERE if filtersFromEvents is present
|
|
3691
|
+
const filteredTrackedEntities = getFilteredTrackedEntites(response.trackedEntities, filtersFromEvents);
|
|
3692
|
+
const trackedEntityIds = filteredTrackedEntities
|
|
3693
|
+
.map((tei) => tei.trackedEntity)
|
|
3694
|
+
.join(',');
|
|
3695
|
+
if (!trackedEntityIds) {
|
|
3696
|
+
return of({
|
|
3697
|
+
trackedEntities: [],
|
|
3698
|
+
orgUnitsMap: new Map(),
|
|
3699
|
+
});
|
|
3610
3700
|
}
|
|
3611
|
-
|
|
3612
|
-
return this.
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3701
|
+
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}`;
|
|
3702
|
+
return this.httpClient.get(refetchUrl).pipe(switchMap((filteredResponse) => {
|
|
3703
|
+
const orgUnitIds = new Set();
|
|
3704
|
+
filteredResponse.trackedEntities?.forEach((tei) => {
|
|
3705
|
+
tei.enrollments?.forEach((enrollment) => {
|
|
3706
|
+
if (enrollment.program === programId) {
|
|
3707
|
+
orgUnitIds.add(enrollment.orgUnit);
|
|
3708
|
+
}
|
|
3709
|
+
});
|
|
3710
|
+
});
|
|
3711
|
+
return this.fetchOrgUnits(Array.from(orgUnitIds)).pipe(map$1((orgUnitsMap) => ({
|
|
3712
|
+
...filteredResponse,
|
|
3713
|
+
orgUnitsMap,
|
|
3714
|
+
})));
|
|
3715
|
+
}));
|
|
3616
3716
|
}));
|
|
3617
3717
|
}
|
|
3618
|
-
//filter=id:in:[id1,id2,id3]
|
|
3619
3718
|
/**
|
|
3620
3719
|
* Fetch orgUnit names for given orgUnit IDs
|
|
3621
3720
|
*/
|
|
@@ -3906,9 +4005,9 @@ const getTrackedEntityData = (response, programId, pager, isOptionSetNameVisible
|
|
|
3906
4005
|
: null,
|
|
3907
4006
|
sortOrder: attr.sortOrder,
|
|
3908
4007
|
}));
|
|
3909
|
-
if (filters) {
|
|
3910
|
-
|
|
3911
|
-
}
|
|
4008
|
+
// if (filters) {
|
|
4009
|
+
// teis = getFilteredTrackedEntites(teis, filters);
|
|
4010
|
+
// }
|
|
3912
4011
|
const allAttributes = new Set();
|
|
3913
4012
|
teis.forEach((tei) => {
|
|
3914
4013
|
const matchingEnrollment = tei.enrollments.find((enrollment) => enrollment.program === programId);
|
|
@@ -3971,7 +4070,7 @@ const getTrackedEntityData = (response, programId, pager, isOptionSetNameVisible
|
|
|
3971
4070
|
label: foundAttribute?.displayName || attrId,
|
|
3972
4071
|
key: attrId,
|
|
3973
4072
|
valueType: foundAttribute?.valueType,
|
|
3974
|
-
options: mappedAttr?.optionSet ?? undefined
|
|
4073
|
+
options: mappedAttr?.optionSet ?? undefined,
|
|
3975
4074
|
};
|
|
3976
4075
|
})
|
|
3977
4076
|
.filter((column) => {
|
|
@@ -3987,7 +4086,6 @@ const getTrackedEntityData = (response, programId, pager, isOptionSetNameVisible
|
|
|
3987
4086
|
return sortOrderA - sortOrderB;
|
|
3988
4087
|
})
|
|
3989
4088
|
.filter((column) => searchableKeys.has(column.key));
|
|
3990
|
-
console.log('filtered entity columns', filteredEntityColumns);
|
|
3991
4089
|
const attributesData = teis.map((tei, idx) => {
|
|
3992
4090
|
const row = {
|
|
3993
4091
|
trackedEntityInstance: tei.trackedEntity,
|
|
@@ -4061,7 +4159,6 @@ const getTrackedEntityData = (response, programId, pager, isOptionSetNameVisible
|
|
|
4061
4159
|
})),
|
|
4062
4160
|
];
|
|
4063
4161
|
}
|
|
4064
|
-
console.log('filtered entity columns', filteredEntityColumns);
|
|
4065
4162
|
return {
|
|
4066
4163
|
columns: entityColumns,
|
|
4067
4164
|
data: attributesData,
|
|
@@ -4346,6 +4443,22 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
4346
4443
|
return updatedFilters;
|
|
4347
4444
|
});
|
|
4348
4445
|
};
|
|
4446
|
+
//TODO: MERGE THIS WITH HANDLE INPUT CHANGE PUT A CHECK FOR IF ITS A SELECT FIELD TO USE EQ
|
|
4447
|
+
const handleInputChangeForSelectField = (key, value) => {
|
|
4448
|
+
setInputValues((prevValues) => ({
|
|
4449
|
+
...prevValues,
|
|
4450
|
+
[key]: value ?? '',
|
|
4451
|
+
}));
|
|
4452
|
+
setAttributeFiltersState((prevFilters = []) => {
|
|
4453
|
+
// Remove old filter for this key
|
|
4454
|
+
const filteredFilters = prevFilters.filter((f) => f.attribute !== key);
|
|
4455
|
+
// Only add new filter if value is not empty
|
|
4456
|
+
const updatedFilters = value.trim()
|
|
4457
|
+
? [...filteredFilters, { attribute: key, operator: 'eq', value }]
|
|
4458
|
+
: filteredFilters;
|
|
4459
|
+
return updatedFilters;
|
|
4460
|
+
});
|
|
4461
|
+
};
|
|
4349
4462
|
const handleDateSelect = (key, selectedDate) => {
|
|
4350
4463
|
const selectedDateString = selectedDate?.calendarDateString ?? ''; // Default to empty string if null
|
|
4351
4464
|
// Update dateStates
|
|
@@ -4392,7 +4505,7 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
4392
4505
|
// <div>
|
|
4393
4506
|
// <div/>
|
|
4394
4507
|
React__default.createElement("div", null,
|
|
4395
|
-
React__default.createElement(Modal$1, { hide: hide },
|
|
4508
|
+
React__default.createElement(Modal$1, { hide: hide, position: "middle" },
|
|
4396
4509
|
React__default.createElement(ModalTitle$1, null, "Select organization unit"),
|
|
4397
4510
|
React__default.createElement(ModalContent$1, null,
|
|
4398
4511
|
React__default.createElement(OrgUnitFormField$1, { key: selectedOrgUnit, onSelectOrgUnit: (selectedOrgUnit) => {
|
|
@@ -4412,12 +4525,15 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
4412
4525
|
} },
|
|
4413
4526
|
React__default.createElement(InputField$1, { key: "location",
|
|
4414
4527
|
//label={orgUnitLabel}
|
|
4415
|
-
label: orgUnitLabel ? orgUnitLabel : 'registering unit', value: selectedOrgUnit,
|
|
4528
|
+
label: orgUnitLabel ? orgUnitLabel : 'registering unit', value: selectedOrgUnit, onFocus: () => setHide(false), className: "custom-input", onChange: (event) => {
|
|
4416
4529
|
setSelectedOrgUnit(event.value);
|
|
4417
4530
|
setOrgUnitState(defaultOrgUnit);
|
|
4418
4531
|
} }),
|
|
4419
4532
|
React__default.createElement(CalendarInput, { label: "Start date:", calendar: "gregory", locale: "en-GB", timeZone: "Africa/Dar_es_Salaam", className: "custom-input", date: startDateState, onDateSelect: (selectedDate) => {
|
|
4420
|
-
|
|
4533
|
+
if (selectedDate?.calendarDateString) {
|
|
4534
|
+
setStartDateState(selectedDate.calendarDateString);
|
|
4535
|
+
}
|
|
4536
|
+
// setStartDateState(selectedDate.calendarDateString);
|
|
4421
4537
|
} }),
|
|
4422
4538
|
React__default.createElement(CalendarInput, { label: "End date:", calendar: "gregory", locale: "en-GB", timeZone: "Africa/Dar_es_Salaam", className: "custom-input", date: endDateState, onDateSelect: (selectedDate) => {
|
|
4423
4539
|
setEndDateState(selectedDate.calendarDateString);
|
|
@@ -4434,7 +4550,7 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
4434
4550
|
...prevValues,
|
|
4435
4551
|
[key]: selected ?? '',
|
|
4436
4552
|
}));
|
|
4437
|
-
|
|
4553
|
+
handleInputChangeForSelectField(key, selected ?? '');
|
|
4438
4554
|
} }, (options.options ?? []).map((opt) => (React__default.createElement(SingleSelectOption, { key: opt.id, label: opt.name, value: opt.code })))));
|
|
4439
4555
|
}
|
|
4440
4556
|
// Fallback: default InputField
|
|
@@ -4474,6 +4590,9 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
4474
4590
|
React__default.createElement(DataTableRow, null, columns.map((col) => (React__default.createElement(DataTableColumnHeader, { key: col.key }, col.label))))),
|
|
4475
4591
|
React__default.createElement(TableBody, null, data.length > 0 ? (data.map((row) => (React__default.createElement(DataTableRow, { key: row.index }, columns.map((col) => (React__default.createElement(DataTableCell, { key: col.key }, col.key === 'actions'
|
|
4476
4592
|
? this.actionOptions && (React__default.createElement(DataTableActions, { actionOptions: this.actionOptions, actionOptionOrientation: this.actionOptionOrientation, onClick: (option) => {
|
|
4593
|
+
if (option.onClick) {
|
|
4594
|
+
option.onClick(row);
|
|
4595
|
+
}
|
|
4477
4596
|
this.actionSelected.emit({
|
|
4478
4597
|
action: option.label,
|
|
4479
4598
|
row,
|
|
@@ -4537,11 +4656,11 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
4537
4656
|
this.render();
|
|
4538
4657
|
}
|
|
4539
4658
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: LineListTableComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
4540
|
-
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"] }); }
|
|
4659
|
+
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"] }); }
|
|
4541
4660
|
}
|
|
4542
4661
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: LineListTableComponent, decorators: [{
|
|
4543
4662
|
type: Component,
|
|
4544
|
-
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"] }]
|
|
4663
|
+
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"] }]
|
|
4545
4664
|
}], propDecorators: { programId: [{
|
|
4546
4665
|
type: Input
|
|
4547
4666
|
}], orgUnit: [{
|
|
@@ -4605,6 +4724,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImpor
|
|
|
4605
4724
|
// Use of this source code is governed by a BSD-style
|
|
4606
4725
|
// license that can be found in the LICENSE file.
|
|
4607
4726
|
|
|
4727
|
+
// Copyright 2025 UDSM DHIS2 Lab. All rights reserved.
|
|
4728
|
+
// Use of this source code is governed by a BSD-style
|
|
4729
|
+
// license that can be found in the LICENSE file.
|
|
4730
|
+
|
|
4608
4731
|
const dropdownStyles = {
|
|
4609
4732
|
layer: {
|
|
4610
4733
|
zIndex: '1 !important',
|
|
@@ -5482,9 +5605,20 @@ class MetadataRule {
|
|
|
5482
5605
|
class FormMetadataSection {
|
|
5483
5606
|
constructor(params) {
|
|
5484
5607
|
this.params = params;
|
|
5608
|
+
this.inheritedAttributes = [];
|
|
5609
|
+
this.inheritedAttributes =
|
|
5610
|
+
(this.params.program['trackedEntityType'] || {})['trackedEntityTypeAttributes'] || [];
|
|
5485
5611
|
}
|
|
5486
5612
|
get attributes() {
|
|
5487
|
-
|
|
5613
|
+
let programTrackedEntityAttributes = this.params.program['programTrackedEntityAttributes'] || [];
|
|
5614
|
+
if (this.params.excludeInheritedAttributes) {
|
|
5615
|
+
programTrackedEntityAttributes = programTrackedEntityAttributes.filter((programTrackedEntityAttribute) => {
|
|
5616
|
+
return !this.inheritedAttributes.find((inheritedAttribute) => inheritedAttribute['trackedEntityAttribute']?.id ===
|
|
5617
|
+
programTrackedEntityAttribute['trackedEntityAttribute']
|
|
5618
|
+
?.id);
|
|
5619
|
+
});
|
|
5620
|
+
}
|
|
5621
|
+
return programTrackedEntityAttributes.map((programTrackedEntityAttribute) => {
|
|
5488
5622
|
return {
|
|
5489
5623
|
...programTrackedEntityAttribute['trackedEntityAttribute'],
|
|
5490
5624
|
formName: (programTrackedEntityAttribute['trackedEntityAttribute'] || {})['name'],
|
|
@@ -5524,7 +5658,7 @@ class FormMetadataSection {
|
|
|
5524
5658
|
return {
|
|
5525
5659
|
id: this.params.section?.id,
|
|
5526
5660
|
name: this.params.section?.name,
|
|
5527
|
-
fieldGroups: this.fieldGroups,
|
|
5661
|
+
fieldGroups: this.fieldGroups.filter((fieldGroup) => fieldGroup.fields?.length > 0),
|
|
5528
5662
|
};
|
|
5529
5663
|
}
|
|
5530
5664
|
}
|
|
@@ -5632,6 +5766,7 @@ class FormMetaData {
|
|
|
5632
5766
|
},
|
|
5633
5767
|
program,
|
|
5634
5768
|
locale: this.params.locale,
|
|
5769
|
+
excludeInheritedAttributes: this.params.excludeInheritedAttributes,
|
|
5635
5770
|
}).toJson();
|
|
5636
5771
|
});
|
|
5637
5772
|
}
|
|
@@ -5660,6 +5795,7 @@ class FormMetaData {
|
|
|
5660
5795
|
},
|
|
5661
5796
|
program,
|
|
5662
5797
|
locale: this.params.locale,
|
|
5798
|
+
excludeInheritedAttributes: this.params.excludeInheritedAttributes,
|
|
5663
5799
|
}).toJson();
|
|
5664
5800
|
}
|
|
5665
5801
|
#getReportingDateSection(program) {
|
|
@@ -5696,6 +5832,7 @@ class FormMetaData {
|
|
|
5696
5832
|
},
|
|
5697
5833
|
program,
|
|
5698
5834
|
locale: this.params.locale,
|
|
5835
|
+
excludeInheritedAttributes: this.params.excludeInheritedAttributes,
|
|
5699
5836
|
}).toJson();
|
|
5700
5837
|
}
|
|
5701
5838
|
#getRegistrationSection(program) {
|
|
@@ -5728,6 +5865,7 @@ class FormMetaData {
|
|
|
5728
5865
|
},
|
|
5729
5866
|
program,
|
|
5730
5867
|
locale: this.params.locale,
|
|
5868
|
+
excludeInheritedAttributes: this.params.excludeInheritedAttributes,
|
|
5731
5869
|
}).toJson();
|
|
5732
5870
|
}
|
|
5733
5871
|
#getMergedRegistrationSection(program) {
|
|
@@ -5803,6 +5941,7 @@ class FormMetaData {
|
|
|
5803
5941
|
},
|
|
5804
5942
|
program,
|
|
5805
5943
|
locale: this.params.locale,
|
|
5944
|
+
excludeInheritedAttributes: this.params.excludeInheritedAttributes,
|
|
5806
5945
|
}).toJson();
|
|
5807
5946
|
}
|
|
5808
5947
|
toJson() {
|
|
@@ -5893,18 +6032,6 @@ const FileUploadField = (props) => {
|
|
|
5893
6032
|
else {
|
|
5894
6033
|
onChange(file);
|
|
5895
6034
|
}
|
|
5896
|
-
// this.ngZone.run(() => {
|
|
5897
|
-
// this.form().get(this.field().id) ||
|
|
5898
|
-
// this.form()
|
|
5899
|
-
// .get(this.field().key)
|
|
5900
|
-
// ?.setValue((event?.files || [])[0]);
|
|
5901
|
-
// this.update.emit({
|
|
5902
|
-
// form: this.form(),
|
|
5903
|
-
// value: (event?.files || [])[0],
|
|
5904
|
-
// });
|
|
5905
|
-
// });
|
|
5906
|
-
// setValue((event?.files || [])[0]);
|
|
5907
|
-
// setTouched(true);
|
|
5908
6035
|
} }, file && (React__default.createElement(FileListItem, { cancelText: "Cancel", label: file.name, loading: uploading, onRemove: () => {
|
|
5909
6036
|
setFile(null);
|
|
5910
6037
|
}, removeText: "Remove" }))));
|
|
@@ -7415,6 +7542,7 @@ class TrackerFormComponent {
|
|
|
7415
7542
|
programs: [program],
|
|
7416
7543
|
programStage: this.programStage(),
|
|
7417
7544
|
disableEnrollmentDate: true,
|
|
7545
|
+
excludeInheritedAttributes: true,
|
|
7418
7546
|
}).toJson();
|
|
7419
7547
|
}
|
|
7420
7548
|
}
|
|
@@ -7530,7 +7658,14 @@ class ProgramEntryFormFieldUtil {
|
|
|
7530
7658
|
this.config = config;
|
|
7531
7659
|
}
|
|
7532
7660
|
get attributes() {
|
|
7533
|
-
|
|
7661
|
+
let programTrackedEntityAttributes = this.program.programTrackedEntityAttributes || [];
|
|
7662
|
+
if (this.config.excludeInheritedAttributes) {
|
|
7663
|
+
programTrackedEntityAttributes = programTrackedEntityAttributes.filter((programTrackedEntityAttribute) => {
|
|
7664
|
+
return !(this.program.trackedEntityType?.trackedEntityTypeAttributes || []).find((inheritedAttribute) => inheritedAttribute.trackedEntityAttribute?.id ===
|
|
7665
|
+
programTrackedEntityAttribute?.trackedEntityAttribute?.id);
|
|
7666
|
+
});
|
|
7667
|
+
}
|
|
7668
|
+
return programTrackedEntityAttributes.map((programTrackedEntityAttribute) => {
|
|
7534
7669
|
return {
|
|
7535
7670
|
...programTrackedEntityAttribute.trackedEntityAttribute,
|
|
7536
7671
|
sortOrder: programTrackedEntityAttribute.sortOrder,
|
|
@@ -7692,6 +7827,11 @@ class ProgramEntryFormMetaData {
|
|
|
7692
7827
|
'useFirstStageDuringRegistration',
|
|
7693
7828
|
'trackedEntityType',
|
|
7694
7829
|
])
|
|
7830
|
+
.with(this.d2.programModule.trackedEntityType
|
|
7831
|
+
.select(['id', 'name'])
|
|
7832
|
+
.with(this.d2.programModule.trackedEntityTypeAttribute.select([
|
|
7833
|
+
'trackedEntityAttribute',
|
|
7834
|
+
])), 'ToOne')
|
|
7695
7835
|
.with(this.d2.programModule.programTrackedEntityAttribute.with(this.d2.programModule.trackedEntityAttribute.with(this.d2.optionSetModule.optionSet.with(this.d2.optionSetModule.option), 'ToOne'), 'ToOne'))
|
|
7696
7836
|
.with(this.d2.programModule.programRuleVariable
|
|
7697
7837
|
.with(this.d2.dataElementModule.dataElement.select([
|