|
|
|
|
@ -1,11 +1,11 @@
|
|
|
|
|
import { Component, OnInit } from "@angular/core";
|
|
|
|
|
import { Component, OnInit, ViewChild } from "@angular/core";
|
|
|
|
|
import { Location } from "@angular/common";
|
|
|
|
|
import { TranslatorService } from "src/app/hmg-common/services/translator/translator.service";
|
|
|
|
|
import { CommonService } from "src/app/hmg-common/services/common/common.service";
|
|
|
|
|
import { AuthenticationService } from "src/app/hmg-common/services/authentication/authentication.service";
|
|
|
|
|
import { MenuResponse } from "src/app/hmg-common/services/menu/models/menu-response";
|
|
|
|
|
import { MyTeamService } from "../service/my-team.service";
|
|
|
|
|
import { ModalController } from "@ionic/angular";
|
|
|
|
|
import { ModalController, IonInfiniteScroll } from "@ionic/angular";
|
|
|
|
|
import { DetailsComponent } from '../details/details.component';
|
|
|
|
|
@Component({
|
|
|
|
|
selector: "app-home",
|
|
|
|
|
@ -13,6 +13,8 @@ import { DetailsComponent } from '../details/details.component';
|
|
|
|
|
styleUrls: ["./home.component.scss"]
|
|
|
|
|
})
|
|
|
|
|
export class HomeComponent implements OnInit {
|
|
|
|
|
@ViewChild(IonInfiniteScroll) infiniteScroll: IonInfiniteScroll;
|
|
|
|
|
|
|
|
|
|
pageNum: number = 1;
|
|
|
|
|
pageLimit: number = 50;
|
|
|
|
|
empSubordinate: any;
|
|
|
|
|
@ -115,8 +117,9 @@ export class HomeComponent implements OnInit {
|
|
|
|
|
handleEmpResult(result) {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
if (this.common.hasData(result.GetEmployeeSubordinatesList)) {
|
|
|
|
|
|
|
|
|
|
this.empSubordinate = result.GetEmployeeSubordinatesList;
|
|
|
|
|
this.pageNum++;
|
|
|
|
|
this.infiniteRequest.P_PAGE_NUM++;
|
|
|
|
|
const lastItemIndex = this.empSubordinate.length - 1;
|
|
|
|
|
if (result.GetEmployeeSubordinatesList[lastItemIndex]) {
|
|
|
|
|
const lastitem = result.GetEmployeeSubordinatesList[lastItemIndex];
|
|
|
|
|
@ -131,8 +134,18 @@ export class HomeComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
doInfinite(infiniteScroll) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
doInfinite1(infiniteScroll) {
|
|
|
|
|
console.log("test");
|
|
|
|
|
if (!this.IsReachEnd && this.infiniteRequest) {
|
|
|
|
|
console.log("not ReachEnd");
|
|
|
|
|
|
|
|
|
|
this.infiniteRequest.P_PAGE_NUM = this.pageNum;
|
|
|
|
|
this.myTeamService
|
|
|
|
|
.getEmployeeSubordinates(this.infiniteRequest)
|
|
|
|
|
@ -140,7 +153,7 @@ export class HomeComponent implements OnInit {
|
|
|
|
|
(result: any) => {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
this.pageNum++;
|
|
|
|
|
if (this.common.hasData(result.GetWorkList)) {
|
|
|
|
|
if (this.common.hasData(result.GetEmployeeSubordinatesList)) {
|
|
|
|
|
result.GetEmployeeSubordinatesList.forEach(vr => {
|
|
|
|
|
if (vr.ROW_NUM == vr.NO_OF_ROWS) {
|
|
|
|
|
this.IsReachEnd = true;
|
|
|
|
|
@ -169,6 +182,47 @@ export class HomeComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
doInfinite(infiniteScroll) {
|
|
|
|
|
//this.pageNum= this.pageNum + 1;
|
|
|
|
|
console.log("test doInfinite");
|
|
|
|
|
if (!this.IsReachEnd) {
|
|
|
|
|
console.log("test doInfinite not ReachEnd");
|
|
|
|
|
|
|
|
|
|
this.myTeamService
|
|
|
|
|
.getEmployeeSubordinates(this.infiniteRequest).subscribe(
|
|
|
|
|
(result: any) => {
|
|
|
|
|
if (this.common.validResponse(result)) {
|
|
|
|
|
this.infiniteRequest.P_PAGE_NUM++;
|
|
|
|
|
if (this.common.hasData(result.GetEmployeeSubordinatesList)) {
|
|
|
|
|
result.GetEmployeeSubordinatesList.forEach(element => {
|
|
|
|
|
if (element.ROW_NUM == element.NO_OF_ROWS) {
|
|
|
|
|
this.IsReachEnd = true;
|
|
|
|
|
} else {
|
|
|
|
|
this.IsReachEnd = false;
|
|
|
|
|
}
|
|
|
|
|
this.empSubordinate.push(element);
|
|
|
|
|
});
|
|
|
|
|
} // if list length >0
|
|
|
|
|
else {
|
|
|
|
|
this.IsReachEnd = true;
|
|
|
|
|
}
|
|
|
|
|
} // if response == 1
|
|
|
|
|
//this.pageNum++;
|
|
|
|
|
this.infiniteScroll.complete();
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
if (this.infiniteScroll)
|
|
|
|
|
this.infiniteScroll.complete();
|
|
|
|
|
}
|
|
|
|
|
} //end infiniteScroll
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getDetails(index) {
|
|
|
|
|
this.common.sharedService.setSharedData(
|
|
|
|
|
this.empSubordinate[index],
|
|
|
|
|
|