diff --git a/Mohem/src/app/hmg-common/services/common/common.service.ts b/Mohem/src/app/hmg-common/services/common/common.service.ts index 55beb912..d6bf1a7b 100644 --- a/Mohem/src/app/hmg-common/services/common/common.service.ts +++ b/Mohem/src/app/hmg-common/services/common/common.service.ts @@ -1107,6 +1107,7 @@ public getMonthNameAr(value: number): string { this.nav.navigateForward(['/eit/homepage']); } public openMyTeamPage() { + console.log('someeeeeeee'); this.nav.navigateForward(['/my-team/home']); } public openMyTeamDetailPage() { diff --git a/Mohem/src/app/hmg-common/ui/employee-information/employee-information.component.scss b/Mohem/src/app/hmg-common/ui/employee-information/employee-information.component.scss index f497860c..36e5a37d 100644 --- a/Mohem/src/app/hmg-common/ui/employee-information/employee-information.component.scss +++ b/Mohem/src/app/hmg-common/ui/employee-information/employee-information.component.scss @@ -36,6 +36,10 @@ border-radius: 80px; border: 1px solid #ccc; margin: 0px auto 6px; + img { + width: 100%; + max-height: 100%; + } } .employee-name{ diff --git a/Mohem/src/app/my-team/details/details.component.html b/Mohem/src/app/my-team/details/details.component.html index b7e24248..bafd4514 100644 --- a/Mohem/src/app/my-team/details/details.component.html +++ b/Mohem/src/app/my-team/details/details.component.html @@ -1,7 +1,7 @@ - + EMPLOYEE DETAIL @@ -13,11 +13,11 @@
- Team Member Image + Team Member Image
-

Rohit Shety

- Graphic Designer +

{{employee.EMPLOYEE_NAME}}

+ {{employee.JOB_NAME}}
@@ -29,7 +29,7 @@ Call
- +
@@ -37,7 +37,7 @@ Create Request
- +
@@ -71,6 +71,66 @@
+
+ + + + + + + + +
+ + + + {{ts.trPK('searchForReplacment','name')}} + {{ts.trPK('searchForReplacment','userName')}} + {{ts.trPK('searchForReplacment','email')}} + + + + + + + + + + +
+ +
+ + + Clear Search + + + +
+ + + + + + + + + +
+
@@ -109,7 +169,7 @@

Position

{{employee.POSITION_NAME}}

- +

Grade

{{employee.GRADE_NAME}}

@@ -117,8 +177,5 @@
- \ No newline at end of file diff --git a/Mohem/src/app/my-team/details/details.component.scss b/Mohem/src/app/my-team/details/details.component.scss index 0da377f8..c7469bfa 100644 --- a/Mohem/src/app/my-team/details/details.component.scss +++ b/Mohem/src/app/my-team/details/details.component.scss @@ -111,6 +111,7 @@ ion-title{ background: white; margin-top: 15px; border-radius: 20px; + margin-bottom: 15px; ion-col{ padding: 15px; border-bottom: 1px solid #ccc; @@ -159,3 +160,52 @@ ion-title{ border-bottom: 1px solid #ccc; } + ///////////////////////// Team Members css //////////////////////@extend + +.filters-row { + margin-top: 10px; +} + +.search-dropdown{ + background: #22c6b3; + ion-select { + .select-text{ + margin-left: -10px; + } + .select-icon{ + .select-icon-inner{ + opacity: 1; + color: white; + margin-top: -1px; + } + } + } +} + +.input-container{ + background: white; + ion-input{ + border-bottom-color: transparent; + } +} + +.search-container{ + margin-top: 15px; + ion-col{ + background: white; + border-radius: 12px; + padding-right: 10px; + flex: none; + ion-icon{ + margin-right: 3px; + font-size: 14px; + margin-left: 3px; + vertical-align: middle; + } + span{ + font-size: 12px; + vertical-align: middle; + } + } +} + diff --git a/Mohem/src/app/my-team/details/details.component.ts b/Mohem/src/app/my-team/details/details.component.ts index feb1196b..d57f395f 100644 --- a/Mohem/src/app/my-team/details/details.component.ts +++ b/Mohem/src/app/my-team/details/details.component.ts @@ -20,18 +20,59 @@ export class DetailsComponent implements OnInit { public activeSegment = 'About'; pageNum = 1; pageLimit = 50; - modalFlag: any = false; empSubordinate: any; employee: any; - IsReachEnd = false; + isReachEnd = false; searchKey: any; - public searchKeySelect: any; + public isSearch = false; + public searchKeySelect = 'Name'; + public getEmployeeSubordinatesRequestObject: any; infiniteRequest: any; isSpecialist = false; selMenu: MenuResponse = new MenuResponse(); public opendEmployees: any = []; public headerTitle = ''; public userImage: any = '../assets/imgs/profile.png'; + + public filters = [ + { + value: 0, + name: 'All', + active: true, + color: '#124375' + }, + { + value: 0, + name: 'Present', + active: false, + color: '#18a169' + }, + { + value: 0, + name: 'Absent', + active: false, + color: '#38c9b3' + }, + { + value: 0, + name: 'Late', + active: false, + color: '#114475' + } + ]; + + public slideOptsOne = { + slidesPerView: 4, + spaceBetween: 10 + }; + + public previousActiveIndex = 0; + public currentActiveIndex = 0; + public searchNameOrUserName = ''; + public searchEmail = ''; + public showEmailInput = false; + public showUserNameOrNameInput = true; + constructor( public menuService: MenuService, public common: CommonService, @@ -47,11 +88,12 @@ export class DetailsComponent implements OnInit { } public segmentChanged(event: any) { - console.log(event); this.activeSegment = event.detail.value; } intializeMemberDetail(userID?) { + this.empSubordinate = []; + this.activeSegment = 'About'; this.pageLimit = 50; this.pageNum = 1; this.employee = this.common.sharedService.getSharedData(MyTeamService.EMPLOYEE_SHARED_DATA, false); @@ -60,14 +102,9 @@ export class DetailsComponent implements OnInit { this.opendEmployees.push(this.employee); this.common.sharedService.setSharedData(this.opendEmployees, DetailsComponent.opendEmployeesARR); } - this.selMenu = this.common.sharedService.getSharedData( - MenuResponse.SHARED_DATA, - false - ); + this.selMenu = this.common.sharedService.getSharedData(MenuResponse.SHARED_DATA, false); this.headerTitle = this.selMenu.List_Menu.MENU_NAME; - this.isSpecialist = this.common.sharedService.getSharedData('isSpecialist', false) ? true : false; - if (this.employee) { this.getEmpSubordinate(userID); } @@ -76,11 +113,12 @@ export class DetailsComponent implements OnInit { goback() { const user = this.authService.getAuthenticatedUser(); - if (this.employee.SUPERVISOR_NUMBER === user.EMPLOYEE_NUMBER || this.opendEmployees.length == 1){ + if (this.employee.SUPERVISOR_NUMBER === user.EMPLOYEE_NUMBER || this.opendEmployees.length === 1) { this.opendEmployees = []; this.common.openMyTeamPage(); } else { - for (let i = 0; i < this.opendEmployees.length; i++){ + // tslint:disable-next-line: prefer-for-of + for (let i = 0; i < this.opendEmployees.length; i++) { if (this.opendEmployees[i].EMPLOYEE_NUMBER === this.employee.SUPERVISOR_NUMBER) { this.common.sharedService.setSharedData( this.opendEmployees[i], @@ -93,47 +131,30 @@ export class DetailsComponent implements OnInit { } } + searchEmployeeTwo() { + console.log('umar 1999'); + this.isSearch = true; + this.empSubordinate = []; + this.getEmpSubordinate(''); + } + + clearSearchTwo() { + this.isSearch = false; + this.getEmployeeSubordinatesRequestObject.P_PAGE_NUM = 1; + this.empSubordinate = []; + this.isReachEnd = false; + this.searchNameOrUserName = ''; + this.searchEmail = ''; + this.getEmpSubordinate(''); + } + getEmpSubordinate(userID) { - this.modalFlag = this.employee.isModal; let selEmpNo: string = null; this.pageNum = 1; - this.IsReachEnd = false; - let searchEmpNum = ''; - let searchEmpName = ''; - let searchEmpEmail = ''; - if (this.searchKey) { - switch (this.searchKeySelect) { - case '1': { - searchEmpName = this.searchKey; - searchEmpNum = ''; - searchEmpEmail = ''; - - break; - } - case '2': { - searchEmpNum = this.searchKey; - searchEmpName = ''; - searchEmpEmail = ''; - break; - } - case '3': { - searchEmpEmail = this.searchKey; - searchEmpNum = ''; - searchEmpName = ''; - break; - } - default: { - searchEmpNum = ''; - searchEmpName = ''; - searchEmpEmail = ''; - break; - } - } - } else { - searchEmpNum = ''; - searchEmpName = ''; - searchEmpEmail = ''; - } + this.isReachEnd = false; + const searchEmpNum = (this.searchKeySelect === 'User Name') ? this.searchNameOrUserName : ''; + const searchEmpName = (this.searchKeySelect === 'Name') ? this.searchNameOrUserName : ''; + const searchEmpEmail = (this.searchKeySelect === 'Email') ? this.searchEmail : ''; if (userID) { selEmpNo = userID; } else { @@ -147,83 +168,64 @@ export class DetailsComponent implements OnInit { P_PAGE_NUM: this.pageNum, P_PAGE_LIMIT: this.pageLimit }; - this.infiniteRequest = body; - this.myTeamService - .getEmployeeSubordinates(body) - .subscribe((result: any) => { - this.handleEmpResult(result); - }); + this.getEmployeeSubordinatesRequestObject = body; + this.myTeamService.getEmployeeSubordinates(body).subscribe((result: any) => { + console.log('one'); + if (this.common.validResponse(result)) { + this.handleEmpResult(result.GetEmployeeSubordinatesList); + } + }); } handleEmpResult(result) { - if (this.common.validResponse(result)) { - if (this.common.hasData(result.GetEmployeeSubordinatesList)) { - this.empSubordinate = result.GetEmployeeSubordinatesList; - this.infiniteRequest.P_PAGE_NUM = this.pageNum++; - const lastItemIndex = this.empSubordinate.length - 1; - if (result.GetEmployeeSubordinatesList[lastItemIndex]) { - const lastitem = result.GetEmployeeSubordinatesList[lastItemIndex]; - if (lastitem.NO_OF_ROWS === lastitem.ROW_NUM) { - this.IsReachEnd = true; - } else { - this.IsReachEnd = false; - } + const lastItemIndex = result.length - 1; + const lastItem = result[lastItemIndex]; + if (lastItem) { + if (lastItem.NO_OF_ROWS === lastItem.ROW_NUM) { + this.isReachEnd = true; + if (this.infiniteScroll) { + this.infiniteScroll.complete(); } } else { - this.empSubordinate = []; + this.isReachEnd = false; + if (this.infiniteScroll) { + this.infiniteScroll.complete(); + } } } - } - doInfinite(infiniteScroll) { - if (!this.IsReachEnd && this.infiniteRequest) { - this.myTeamService - .getEmployeeSubordinates(this.infiniteRequest) - .subscribe( - (result: any) => { - if (this.common.validResponse(result)) { - this.infiniteRequest.P_PAGE_NUM = this.pageNum++; - - if (this.common.hasData(result.GetEmployeeSubordinatesList)) { - result.GetEmployeeSubordinatesList.forEach(vr => { - if (vr.ROW_NUM === vr.NO_OF_ROWS) { - this.IsReachEnd = true; - } else { - this.IsReachEnd = false; - } - this.empSubordinate.push(vr); - }); - } else { - this.IsReachEnd = true; - } - } - if (infiniteScroll) { this.infiniteScroll.complete(); } - }, - Error => console.log(Error), - () => this.infiniteScroll.complete() - ); + if (this.common.hasData(result)) { + this.getEmployeeSubordinatesRequestObject.P_PAGE_NUM++; + if (this.empSubordinate.length === 0) { + this.empSubordinate = result; + } else { + this.empSubordinate = this.empSubordinate.concat(result); + } } else { - if (infiniteScroll) { this.infiniteScroll.complete(); } + this.empSubordinate = []; + } +} + +doInfinite(infiniteScroll) { + if (!this.isReachEnd) { + this.myTeamService.getEmployeeSubordinates(this.getEmployeeSubordinatesRequestObject).subscribe((result: any) => { + console.log('two'); + if (this.common.validResponse(result)) { + this.handleEmpResult(result.GetEmployeeSubordinatesList); + } + this.infiniteScroll.complete(); + }); + } else { + if (this.infiniteScroll) { + this.infiniteScroll.complete(); } } +} + getDetails(index) { - this.common.sharedService.setSharedData( - this.empSubordinate[index], - MyTeamService.EMPLOYEE_SHARED_DATA - ); + this.common.sharedService.setSharedData(this.empSubordinate[index], MyTeamService.EMPLOYEE_SHARED_DATA); this.intializeMemberDetail(); } - async presentModal() { - const modal = await this.modalController.create({ - component: DetailsComponent, - keyboardClose: true, - animated: false - }); - const dismissed = modal.onDidDismiss(); - dismissed.then(() => { - this.modalFlag = false; - }); - return await modal.present(); - } + getMenuEntries(item) { let selEmpNo = null; const respID: any = -999; @@ -261,19 +263,11 @@ export class DetailsComponent implements OnInit { } sortMenuEntires(list) { - this.close().then(() => { - }); const tree = this.common.list_to_tree(list); this.common.sharedService.setSharedData(tree, 'menuEntries'); this.common.openEITPage(); } - public async close() { - const modal = await this.modalController.getTop(); - if (modal) { - modal.dismiss(); - } - } goToSubordinate() { this.selMenu.search = true; this.common.sharedService.setSharedData( @@ -283,9 +277,14 @@ export class DetailsComponent implements OnInit { this.common.openMyTeamPage(); } - dismiss() { - this.modalController.dismiss({ - dismissed: true - }); + + showSelectedField(value: any) { + if (this.searchKeySelect === 'User Name' || this.searchKeySelect === 'User Name') { + this.showEmailInput = false; + this.showUserNameOrNameInput = true; + } else if (this.searchKeySelect === 'Email') { + this.showUserNameOrNameInput = false; + this.showEmailInput = true; + } } } diff --git a/Mohem/src/app/my-team/home/home.component.ts b/Mohem/src/app/my-team/home/home.component.ts index e0d67465..1b15619f 100644 --- a/Mohem/src/app/my-team/home/home.component.ts +++ b/Mohem/src/app/my-team/home/home.component.ts @@ -16,7 +16,7 @@ export class HomeComponent implements OnInit { @ViewChild(IonInfiniteScroll) infiniteScroll: IonInfiniteScroll; public pageNum = 1; - public pageLimit = 5; + public pageLimit = 50; public empSubordinate = []; public employee: any; public isReachEnd = false; @@ -157,10 +157,14 @@ export class HomeComponent implements OnInit { if (lastItem) { if (lastItem.NO_OF_ROWS === lastItem.ROW_NUM) { this.isReachEnd = true; - this.infiniteScroll.complete(); + if (this.infiniteScroll) { + this.infiniteScroll.complete(); + } } else { this.isReachEnd = false; - this.infiniteScroll.complete(); + if (this.infiniteScroll) { + this.infiniteScroll.complete(); + } } } if (this.common.hasData(result)) { @@ -203,7 +207,7 @@ export class HomeComponent implements OnInit { getDetails(index) { this.common.sharedService.setSharedData(this.empSubordinate[index], MyTeamService.EMPLOYEE_SHARED_DATA); this.common.sharedService.setSharedData(this.selMenu, MenuResponse.SHARED_DATA); - this.common.openMyTeamDetailPage(); + this.common.openMyTeamDetails(); } goToSubordinate() {