diff --git a/HRM.UI/ClientApp/src/app/payroll/allowance-deduction/allowance-deduction-parameterization/allowance-deduction-parameterization-entry/allowance-deduction-parameterization-entry.component.css b/HRM.UI/ClientApp/src/app/payroll/allowance-deduction/allowance-deduction-parameterization/allowance-deduction-parameterization-entry/allowance-deduction-parameterization-entry.component.css index dfb44a1..66ad5b0 100644 --- a/HRM.UI/ClientApp/src/app/payroll/allowance-deduction/allowance-deduction-parameterization/allowance-deduction-parameterization-entry/allowance-deduction-parameterization-entry.component.css +++ b/HRM.UI/ClientApp/src/app/payroll/allowance-deduction/allowance-deduction-parameterization/allowance-deduction-parameterization-entry/allowance-deduction-parameterization-entry.component.css @@ -167,6 +167,13 @@ kendo-numerictextbox{ border-top: 1px solid #e9ecef; } +/* virtual scrolling needs every row the same height ([rowHeight]="40"): 32px inputs + 4px padding */ +:host ::ng-deep .adp-emp-grid .k-grid-content td { + height: 40px; + padding-top: 4px; + padding-bottom: 4px; +} + .adp-sum { font-weight: bold; } diff --git a/HRM.UI/ClientApp/src/app/payroll/allowance-deduction/allowance-deduction-parameterization/allowance-deduction-parameterization-entry/allowance-deduction-parameterization-entry.component.html b/HRM.UI/ClientApp/src/app/payroll/allowance-deduction/allowance-deduction-parameterization/allowance-deduction-parameterization-entry/allowance-deduction-parameterization-entry.component.html index d659042..fded34f 100644 --- a/HRM.UI/ClientApp/src/app/payroll/allowance-deduction/allowance-deduction-parameterization/allowance-deduction-parameterization-entry/allowance-deduction-parameterization-entry.component.html +++ b/HRM.UI/ClientApp/src/app/payroll/allowance-deduction/allowance-deduction-parameterization/allowance-deduction-parameterization-entry/allowance-deduction-parameterization-entry.component.html @@ -457,8 +457,18 @@ - --> + + diff --git a/HRM.UI/ClientApp/src/app/payroll/allowance-deduction/allowance-deduction-parameterization/allowance-deduction-parameterization-entry/allowance-deduction-parameterization-entry.component.ts b/HRM.UI/ClientApp/src/app/payroll/allowance-deduction/allowance-deduction-parameterization/allowance-deduction-parameterization-entry/allowance-deduction-parameterization-entry.component.ts index 0549bc2..1489aef 100644 --- a/HRM.UI/ClientApp/src/app/payroll/allowance-deduction/allowance-deduction-parameterization/allowance-deduction-parameterization-entry/allowance-deduction-parameterization-entry.component.ts +++ b/HRM.UI/ClientApp/src/app/payroll/allowance-deduction/allowance-deduction-parameterization/allowance-deduction-parameterization-entry/allowance-deduction-parameterization-entry.component.ts @@ -1,4 +1,5 @@ -import {Component, OnInit, ChangeDetectionStrategy} from '@angular/core'; +import {Component, OnInit, ChangeDetectionStrategy, DoCheck} from '@angular/core'; +import { GridDataResult, PageChangeEvent } from '@progress/kendo-angular-grid'; import {FormGroup, FormControl, FormBuilder, Validators} from '@angular/forms'; import {SearchEmployee} from '../../../../_models/Employee/searchEmployee'; import {AdparameterService} from '../../../../_services/payroll/adparameter.service'; @@ -34,7 +35,7 @@ import { EmployeePickerComponent } from 'src/app/picker/employee-picker.componen standalone: false, }) -export class AllowanceDeductionParameterizationEntryComponent implements OnInit { +export class AllowanceDeductionParameterizationEntryComponent implements OnInit, DoCheck { _adPram: ADParameter; _allowDeducts: AllowanceDeduction[]; _grades: Grade[]; @@ -363,7 +364,6 @@ export class AllowanceDeductionParameterizationEntryComponent implements OnInit } public Save() { - debugger; if (this._fromValidator.invalid) { return; } @@ -389,7 +389,6 @@ export class AllowanceDeductionParameterizationEntryComponent implements OnInit } if (this._adPram.adParameterEmployees.length > 0) { this._adPram.adParameterEmployees.forEach(x => { - debugger; let adParamEmpItem: ADParameterEmployee = this.prADParameterEmployees.find(y => y.id === x.id); let oPayrollType: PayrollType = new PayrollType(); if (adParamEmpItem) { @@ -402,8 +401,6 @@ export class AllowanceDeductionParameterizationEntryComponent implements OnInit x.oldTillDate = adParamEmpItem.tillDate; } } - - }); } debugger; @@ -451,6 +448,49 @@ export class AllowanceDeductionParameterizationEntryComponent implements OnInit return parseFloat((value).toFixed(2)); } + //#region Employee grid: virtual scrolling (display only) + // The employee grid shows only the rows on screen (a window of empGridPageSize rows), so 12k-20k + // employees load at once. _individualEmplyees stays the one full list that every existing function + // (Add, Remove, Remove All, Sum, Save, tabs) works on; each window holds the same row objects, so an + // amount or date typed in the grid lands in that list exactly as before. + empGridView: GridDataResult = { data: [], total: 0 }; + empGridSkip = 0; + empGridPageSize = 50; + private empGridSource: ADParameterEmployee[]; + private empGridLength = -1; + + /** Rebuilds the window when the list is replaced (tab change, load) or grows / shrinks (Add, Remove, Remove All). */ + ngDoCheck(): void { + const list = this._individualEmplyees; + const length = list ? list.length : 0; + if (list !== this.empGridSource || length !== this.empGridLength) { + if (list !== this.empGridSource) { + this.empGridSkip = 0; // another list (tab): start from the top + } + this.empGridSource = list; + this.empGridLength = length; + this.loadEmpGridView(); + } + } + + /** The grid scrolled: show the rows of the new window. */ + onEmpGridPageChange(event: PageChangeEvent): void { + this.empGridSkip = event.skip; + this.loadEmpGridView(); + } + + private loadEmpGridView(): void { + const list = this._individualEmplyees || []; + if (this.empGridSkip >= list.length) { // rows were removed below the current window + this.empGridSkip = Math.max(0, list.length - this.empGridPageSize); + } + this.empGridView = { + data: list.slice(this.empGridSkip, this.empGridSkip + this.empGridPageSize), + total: list.length + }; + } + //#endregion + }