@iapps/ng-dhis2-ui 1.1.11 → 1.1.13
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.
|
@@ -3282,8 +3282,10 @@ const addActionsColumn = (columns, actionOptions) => {
|
|
|
3282
3282
|
class LineListTableComponent extends ReactWrapperModule {
|
|
3283
3283
|
constructor() {
|
|
3284
3284
|
super(...arguments);
|
|
3285
|
+
this.showApprovalButton = false;
|
|
3285
3286
|
this.actionSelected = new EventEmitter();
|
|
3286
3287
|
this.reactStateUpdaters = null;
|
|
3288
|
+
this.approvalSelected = new EventEmitter();
|
|
3287
3289
|
this.setReactStateUpdaters = (updaters) => {
|
|
3288
3290
|
this.reactStateUpdaters = updaters;
|
|
3289
3291
|
};
|
|
@@ -3385,31 +3387,67 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
3385
3387
|
},
|
|
3386
3388
|
}));
|
|
3387
3389
|
};
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3390
|
+
// // Add this handler for the Approval button
|
|
3391
|
+
// const handleApprovalClick = () => {
|
|
3392
|
+
// console.log('Approval button clicked');
|
|
3393
|
+
// // Optionally emit an event to Angular parent component
|
|
3394
|
+
// // this.actionSelected.emit({ action: 'Approval', row: null });
|
|
3395
|
+
// };
|
|
3396
|
+
// Updated handler using the new approvalSelected emitter
|
|
3397
|
+
const handleApprovalClick = () => {
|
|
3398
|
+
this.lineListService
|
|
3399
|
+
.getLineListData(this.programId, this.orgUnit, this.programStageId, pager.page, pager.pageSize, this.attributeFilters, this.startDate, this.endDate, this.ouMode)
|
|
3400
|
+
.subscribe((response) => {
|
|
3401
|
+
if ('trackedEntityInstances' in response.data) {
|
|
3402
|
+
const trackedEntityInstances = response.data
|
|
3403
|
+
.trackedEntityInstances;
|
|
3404
|
+
const teiIds = trackedEntityInstances.map((tei) => tei.trackedEntityInstance);
|
|
3405
|
+
// Emit TEI IDs using the new emitter
|
|
3406
|
+
console.log('teis emitted', teiIds);
|
|
3407
|
+
this.approvalSelected.emit(teiIds);
|
|
3408
|
+
}
|
|
3409
|
+
else {
|
|
3410
|
+
console.log('No tracked entity instances found in the response');
|
|
3411
|
+
this.approvalSelected.emit([]); // Emit empty array if no TEIs
|
|
3412
|
+
}
|
|
3413
|
+
});
|
|
3414
|
+
};
|
|
3415
|
+
return (React__default.createElement("div", null,
|
|
3416
|
+
this.showApprovalButton && (React__default.createElement("div", { style: {
|
|
3417
|
+
width: '100%',
|
|
3418
|
+
display: 'flex',
|
|
3419
|
+
justifyContent: 'flex-end',
|
|
3420
|
+
alignItems: 'center',
|
|
3421
|
+
gap: 8,
|
|
3422
|
+
padding: 8,
|
|
3423
|
+
marginBottom: 16,
|
|
3424
|
+
} },
|
|
3425
|
+
React__default.createElement(Button$1, { className: "bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600", onClick: handleApprovalClick, primary: true }, "Approval"))),
|
|
3426
|
+
loading ? (React__default.createElement("div", { style: {
|
|
3427
|
+
display: 'flex',
|
|
3428
|
+
alignItems: 'center',
|
|
3429
|
+
gap: 8,
|
|
3430
|
+
padding: 8,
|
|
3431
|
+
} },
|
|
3432
|
+
React__default.createElement(CircularLoader$1, { small: true }),
|
|
3433
|
+
React__default.createElement("div", { style: {
|
|
3434
|
+
fontSize: 14,
|
|
3435
|
+
} }, "Loading"))) : (React__default.createElement(DataTable, null,
|
|
3436
|
+
React__default.createElement(TableHead, null,
|
|
3437
|
+
React__default.createElement(DataTableRow, null, columns.map((col) => (React__default.createElement(DataTableColumnHeader, { key: col.key }, col.label))))),
|
|
3438
|
+
React__default.createElement(TableBody, null, data.map((row) => (React__default.createElement(DataTableRow, { key: row.index }, columns.map((col) => (React__default.createElement(DataTableCell, { key: col.key }, col.key === 'actions' ? (React__default.createElement(DropdownMenu$1, { dropdownOptions: getDropdownOptions(row), onClick: (option) => option.onClick?.() })) : (row[col.key])))))))),
|
|
3439
|
+
React__default.createElement(TableFoot, null,
|
|
3440
|
+
React__default.createElement(DataTableRow, null,
|
|
3441
|
+
React__default.createElement(DataTableCell, { colSpan: columns.length.toString() },
|
|
3442
|
+
React__default.createElement("div", null,
|
|
3443
|
+
React__default.createElement(Pagination, { page: pager.page, pageCount: pager.pageCount, pageSize: pager.pageSize, total: pager.total, onPageChange: (page) => setPager((prev) => ({ ...prev, page })), onPageSizeChange: (pageSize) => {
|
|
3444
|
+
const newPageSize = Number(pageSize);
|
|
3445
|
+
setPager((prev) => ({
|
|
3446
|
+
...prev,
|
|
3447
|
+
page: 1,
|
|
3448
|
+
pageSize: newPageSize,
|
|
3449
|
+
}));
|
|
3450
|
+
}, pageSizes: ['5', '10', '20', '50'] })))))))));
|
|
3413
3451
|
};
|
|
3414
3452
|
}
|
|
3415
3453
|
ngOnChanges(changes) {
|
|
@@ -3442,7 +3480,7 @@ class LineListTableComponent extends ReactWrapperModule {
|
|
|
3442
3480
|
this.render();
|
|
3443
3481
|
}
|
|
3444
3482
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: LineListTableComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
3445
|
-
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" }, outputs: { actionSelected: "actionSelected" }, 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"] }); }
|
|
3483
|
+
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", showApprovalButton: "showApprovalButton" }, outputs: { actionSelected: "actionSelected", approvalSelected: "approvalSelected" }, 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"] }); }
|
|
3446
3484
|
}
|
|
3447
3485
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImport: i0, type: LineListTableComponent, decorators: [{
|
|
3448
3486
|
type: Component,
|
|
@@ -3465,8 +3503,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.8", ngImpor
|
|
|
3465
3503
|
type: Input
|
|
3466
3504
|
}], ouMode: [{
|
|
3467
3505
|
type: Input
|
|
3506
|
+
}], showApprovalButton: [{
|
|
3507
|
+
type: Input
|
|
3468
3508
|
}], actionSelected: [{
|
|
3469
3509
|
type: Output
|
|
3510
|
+
}], approvalSelected: [{
|
|
3511
|
+
type: Output
|
|
3470
3512
|
}] } });
|
|
3471
3513
|
|
|
3472
3514
|
class LineListModule {
|
|
@@ -5503,7 +5545,7 @@ class SelectionFiltersComponent extends ReactWrapperModule {
|
|
|
5503
5545
|
organisationUnit: selectedOrganisationUnit || this.organisationUnit || filters.organisationUnit,
|
|
5504
5546
|
startDate: filters.startDate,
|
|
5505
5547
|
endDate: filters.endDate,
|
|
5506
|
-
program: this.program,
|
|
5548
|
+
program: this.program || filters.program,
|
|
5507
5549
|
});
|
|
5508
5550
|
};
|
|
5509
5551
|
const getAttributeColumnSpan = (index) => {
|