diff --git a/Mohem/src/app/app.component.html b/Mohem/src/app/app.component.html index b9633c40..37e31ee2 100644 --- a/Mohem/src/app/app.component.html +++ b/Mohem/src/app/app.component.html @@ -78,7 +78,7 @@ - + {{ts.trPK('general','business-card')}} @@ -177,7 +177,7 @@ - + {{ts.trPK('general','business-card')}} diff --git a/Mohem/src/app/my-team/details/details.component.ts b/Mohem/src/app/my-team/details/details.component.ts index 4a2b0d4a..4bd1e2fc 100644 --- a/Mohem/src/app/my-team/details/details.component.ts +++ b/Mohem/src/app/my-team/details/details.component.ts @@ -14,6 +14,7 @@ import { GetTimeCardSummaryRequest } from 'src/app/time-card/service/models/get- import { DashboredService } from 'src/app/hmg-common/services/dashbored/dashbored.service'; import { AttendanceTrackingResponse } from 'src/app/hmg-common/services/dashbored/attendance-tracking.response'; import { WorklistService } from 'src/app/notification/service/worklist.service'; +import { element } from 'protractor'; @Component({ selector: 'app-details', templateUrl: './details.component.html', @@ -93,9 +94,9 @@ export class DetailsComponent implements OnInit { public itemType = ''; public monthNo: any; isFavorite = false; - public EmpNumer:any; - public isFavor:any; - public EmployeeTotal:any; + public EmpNumer: any; + public isFavor: any; + public EmployeeTotal: any; // public activeSegment = 'About'; @@ -247,7 +248,7 @@ export class DetailsComponent implements OnInit { let jobTitle = this.employee.POSITION_NAME.split('.'); if (jobTitle && jobTitle.length > 1) { this.jobName = jobTitle[0] + " " + jobTitle[1]; - } + } const request = { P_SELECTED_EMPLOYEE_NUMBER: this.employee.EMPLOYEE_NUMBER @@ -266,12 +267,12 @@ export class DetailsComponent implements OnInit { this.common.startLoading(); this.initAttendance(); } - else if(this.activeSegment != 'Attendance' && this.activeSegment != 'TeamMembers'){ + else if (this.activeSegment != 'Attendance' && this.activeSegment != 'TeamMembers') { this.activeSegment = 'About'; } } - + initAttendance() { @@ -323,7 +324,7 @@ export class DetailsComponent implements OnInit { } monthCardSliders(monthNo) { - + /* change */ @@ -336,7 +337,7 @@ export class DetailsComponent implements OnInit { //end this.calendarConfig(this.getMonthName(monthNo), this.currentYear); - + } @@ -364,7 +365,7 @@ export class DetailsComponent implements OnInit { this.preMonth = 12; } this.currentDate = new Date(this.currentYear, (this.preMonth - 1), 1); - + this.calendarConfig(this.getMonthName(this.preMonth), this.currentYear); this.preMonth = this.preMonth - 1; this.nextMonth = this.preMonth + 2; @@ -539,7 +540,7 @@ export class DetailsComponent implements OnInit { this.isSpecialist = this.common.sharedService.getSharedData('isSpecialist', false) ? true : false; if (this.employee) { this.getEmpSubordinate(userID); - this.isFavorite = false; + // this.isFavorite = false; this.getFavorit(); } } @@ -603,7 +604,7 @@ export class DetailsComponent implements OnInit { }; this.getEmployeeSubordinatesRequestObject = body; this.myTeamService.getEmployeeSubordinates(body).subscribe((result: any) => { - + if (this.common.validResponse(result)) { this.handleEmpResult(result.GetEmployeeSubordinatesList); } @@ -611,7 +612,7 @@ export class DetailsComponent implements OnInit { } handleEmpResult(result) { - this.EmployeeTotal = result.length; + this.EmployeeTotal = result.length; const lastItemIndex = result.length - 1; const lastItem = result[lastItemIndex]; if (lastItem) { @@ -642,7 +643,7 @@ export class DetailsComponent implements OnInit { doInfinite(infiniteScroll) { if (!this.isReachEnd) { this.myTeamService.getEmployeeSubordinates(this.getEmployeeSubordinatesRequestObject).subscribe((result: any) => { - + if (this.common.validResponse(result)) { this.handleEmpResult(result.GetEmployeeSubordinatesList); } @@ -750,11 +751,11 @@ export class DetailsComponent implements OnInit { // handleRespondSuborinatesAttStatusResult(result) { // // this.EmpTotal = result.GetSubordinatesAttdStatusList.length; // this.EmpTotal = result.GetSubordinatesAttdStatusList[0].NUMBER_OF_EMPLOYEES; - + // } activeFilter(index: number) { - + if (this.currentActiveIndex !== index) { this.previousActiveIndex = this.currentActiveIndex; this.currentActiveIndex = index; @@ -790,90 +791,75 @@ export class DetailsComponent implements OnInit { selEmp.EMPLOYEE_DISPLAY_NAME = selEmp.EMPLOYEE_DISPLAY_NAME ? selEmp.EMPLOYEE_DISPLAY_NAME : selEmp.NAME; selEmp.EMPLOYEE_IMAGE = selEmp.EMPLOYEE_IMAGE ? selEmp.EMPLOYEE_IMAGE : ''; selEmp.EMAIL_ADDRESS = selEmp.EMAIL_ADDRESS ? selEmp.EMAIL_ADDRESS : ''; - var confirmBoxhtml = ` - Do you want to add ` + selEmp.EMPLOYEE_DISPLAY_NAME + ` in your favorite list - - - `; - if (selEmp.EMPLOYEE_IMAGE) - confirmBoxhtml += ''; - if (!selEmp.EMPLOYEE_IMAGE) - confirmBoxhtml += ''; - - confirmBoxhtml += ` - - ` + selEmp.EMPLOYEE_DISPLAY_NAME + ` - - - - - ` - let userIndex = this.favoriteUserList.findIndex(x => x['USER_NAME'] == selEmp.USER_NAME) - if (userIndex == -1) - this.common.presentConfirmDialog( - confirmBoxhtml - , () => { - - var request = - [ { "USER_NAME": this.employee.EMPLOYEE_NUMBER, "EMPLOYEE_DISPLAY_NAME": this.employee.EMPLOYEE_DISPLAY_NAME, "EMAIL_ADDRESS": this.employee.EMAIL_ADDRESS, "EMPLOYEE_IMAGE": this.employee.EMPLOYEE_IMAGE, "IsFavorite": !this.isFavorite}]; - - this.saveUserFavruiteList(request); - // this.isFavorite = false; - - }, () => { - - }) - - // if (selectValue == "1" || selectValue == "2" || selectValue == "3") { - // this.isSelect = true; - // } - // else { - // this.isSelect = false; - - - - // } - } - - getFavruite() { - - this.worklistService.getFavorite({}, () => { - }).subscribe((result) => { - if (this.common.validResponse(result)) { - this.common.stopLoading(); - this.favoriteUserList = result['Mohemm_GetFavoriteReplacementsList']; - - - + if(!this.isFavorite) { + let confirmBoxhtml = ` + Do you want to add ` + selEmp.EMPLOYEE_DISPLAY_NAME + ` in your favorite list + + + `; + if (selEmp.EMPLOYEE_IMAGE) { + confirmBoxhtml += ''; } - }) + if (!selEmp.EMPLOYEE_IMAGE) { + confirmBoxhtml += ''; + } + + confirmBoxhtml += ` + ` + selEmp.EMPLOYEE_DISPLAY_NAME + ` + + + `; + const userIndex = this.favoriteUserList.findIndex(x => x['USER_NAME'] === selEmp.USER_NAME) + if (userIndex === -1) { + this.common.presentConfirmDialog( + confirmBoxhtml + , () => { + const request = + [ + { + "USER_NAME": this.employee.EMPLOYEE_NUMBER, + "EMPLOYEE_DISPLAY_NAME": this.employee.EMPLOYEE_DISPLAY_NAME, + "EMAIL_ADDRESS": this.employee.EMAIL_ADDRESS, + "EMPLOYEE_IMAGE": this.employee.EMPLOYEE_IMAGE, + "IsFavorite": true + } + ]; + + this.saveUserFavruiteList(request); + }, + () => {}); + } + } else { + const request = + [ + { + "USER_NAME": this.employee.EMPLOYEE_NUMBER, + "EMPLOYEE_DISPLAY_NAME": this.employee.EMPLOYEE_DISPLAY_NAME, + "EMAIL_ADDRESS": this.employee.EMAIL_ADDRESS, + "EMPLOYEE_IMAGE": this.employee.EMPLOYEE_IMAGE, + "IsFavorite": false + } + ]; + this.saveUserFavruiteList(request); + } } + saveUserFavruiteList(request) { this.worklistService.saveFavoriteList(request, () => { }).subscribe((result) => { if (this.common.validResponse(result)) { this.common.toastPK("replacementRoll", "favorite-saved"); - this.isFavorite = !this.isFavorite; - + this.getFavorit(); } - }) + }); } - getFavorit(){ + getFavorit() { this.worklistService.getFavoriteMyTeam({}, () => { - }).subscribe((result) => { - this.EmpNumer = result.Mohemm_GetFavoriteReplacementsList; - - this.EmpNumer.forEach(element => { - if(element.USER_NAME === this.employee.EMPLOYEE_NUMBER){ - - this.isFavorite = true; - - } - }); - + }).subscribe((result) => { + this.EmpNumer = result.Mohemm_GetFavoriteReplacementsList; + this.isFavorite = this.EmpNumer.some(element => element.USER_NAME === this.employee.EMPLOYEE_NUMBER); + this.common.stopLoading(); }); } - - } diff --git a/Mohem/src/app/notification/work-list-replacement-roll/work-list-replacement-roll.component.html b/Mohem/src/app/notification/work-list-replacement-roll/work-list-replacement-roll.component.html index 72f61e70..d23640aa 100644 --- a/Mohem/src/app/notification/work-list-replacement-roll/work-list-replacement-roll.component.html +++ b/Mohem/src/app/notification/work-list-replacement-roll/work-list-replacement-roll.component.html @@ -94,9 +94,12 @@ {{employee.NAME}} - + + + + diff --git a/Mohem/src/app/notification/work-list-replacement-roll/work-list-replacement-roll.component.ts b/Mohem/src/app/notification/work-list-replacement-roll/work-list-replacement-roll.component.ts index 88cd77b1..df8aa22c 100644 --- a/Mohem/src/app/notification/work-list-replacement-roll/work-list-replacement-roll.component.ts +++ b/Mohem/src/app/notification/work-list-replacement-roll/work-list-replacement-roll.component.ts @@ -53,26 +53,26 @@ export class WorkListReplacementRollComponent implements OnInit { this.P_PAGE_NUM = 1; this.P_PAGE_LIMIT = 50; this.getPassActionMode = this.cs.sharedService.getSharedData('passActionMode', false); - console.log(this.getPassActionMode); // this.getFavruite(); this.getPassNotificationDetails = this.cs.sharedService.getSharedData('passNotificationInfo', false); this.getpassResAttr = this.cs.sharedService.getSharedData('passResAttr', false); - console.log(this.getpassResAttr); this.pQuestion = this.cs.sharedService.getSharedData('pQuestion', false); // tslint:disable-next-line: max-line-length this.arr = this.cs.sharedService.getSharedData('actionHistoryData', false) ? this.cs.sharedService.getSharedData('actionHistoryData', false) : []; - var lookupObject = {}; - - for(var i in this.arr) { + var lookupObject = {}; + + // tslint:disable-next-line: forin + for (var i in this.arr) { lookupObject[this.arr[i]['USER_NAME']] = this.arr[i]; - } + } + + // tslint:disable-next-line: forin + for (i in lookupObject) { + this.actionHistory.push(lookupObject[i]); + } - for(i in lookupObject) { - this.actionHistory.push(lookupObject[i]); - } - console.log(this.actionHistory); if (this.getPassActionMode === 'ANSWER_INFO') { this.isAnswer = true; @@ -214,7 +214,6 @@ export class WorkListReplacementRollComponent implements OnInit { select(selectEmp, index) { - console.log(selectEmp.EMPLOYEE_DISPLAY_NAME); this.selEmp = selectEmp this.active = index; this.userSelected = true; @@ -251,11 +250,7 @@ export class WorkListReplacementRollComponent implements OnInit { if (this.selEmp && this.isAnswer == false) { // this.selectedUserInf = this.ReplacementList[this.selEmp]; this.selectedUserInf = this.selEmp; - console.log("selEmp " + this.selEmp.USER_NAME); - if (this.selectedUserInf && this.selectedUserInf.USER_NAME) { - - console.log("userInfo " + this.selectedUserInf.USER_NAME); if (this.userNote) { if (this.getPassActionMode == "APPROVE_AND_FORWARD" || this.getPassActionMode == "FORWARD") { @@ -267,7 +262,6 @@ export class WorkListReplacementRollComponent implements OnInit { this.getpassResAttr[index_Note].ATTRIBUTE_TEXT_VALUE = this.userNote; this.P_RESPOND_ATTRIBUTES_TBL = this.getpassResAttr; - console.log(this.P_RESPOND_ATTRIBUTES_TBL); this.WorkListActionObj.P_FORWARD_TO_USER_NAME = this.selectedUserInf.USER_NAME; this.WorkListActionObj.P_ACTION_MODE = this.getPassActionMode; this.WorkListActionObj.P_COMMENTS = ""// response Attr @@ -353,8 +347,9 @@ export class WorkListReplacementRollComponent implements OnInit { 'dismissed': true, data: "Success" }); - if (this.selEmp && this.isAnswer == false) + if (this.selEmp && this.isAnswer == false) { this.setFavorite(this.selEmp); + } }, 5000); this.cs.openNotificationPage(); @@ -416,15 +411,16 @@ export class WorkListReplacementRollComponent implements OnInit { } } //this.P_PAGE_NUM++; - if (infiniteScroll) + if (infiniteScroll) { infiniteScroll.target.complete(); + } - // console.log(resFlag); }, (Error) => console.log(Error), () => infiniteScroll.target.complete()); } else { - if (infiniteScroll) + if (infiniteScroll) { infiniteScroll.target.complete(); + } } } @@ -438,7 +434,6 @@ export class WorkListReplacementRollComponent implements OnInit { selectedType; onChangeSelect(select) { - console.log(select.detail.value); let selectValue = select.detail.value; if (selectValue == '1') { @@ -446,14 +441,13 @@ export class WorkListReplacementRollComponent implements OnInit { this.isFilter = true; this.selectedType = 1; this.listOfRealted = this.actionHistory; - } else if(selectValue === '4'){ - console.log(this.listOfFav.length) - if(this.favoriteUserList.length === 0 || this.favoriteUserList === undefined ) { + } else if (selectValue === '4') { + if (this.favoriteUserList.length === 0 || this.favoriteUserList === undefined) { this.getFavruite(); } this.isFilter = true; this.selectedType = 4; - } else if( selectValue === '2' || selectValue === '3' || selectValue === '5'){ + } else if (selectValue === '2' || selectValue === '3' || selectValue === '5') { this.isSelect = true; this.isFilter = false; this.selectedType = 0; @@ -494,8 +488,20 @@ export class WorkListReplacementRollComponent implements OnInit { this.cs.stopLoading(); this.favoriteUserList = result['Mohemm_GetFavoriteReplacementsList']; this.listOfFav = this.favoriteUserList; + + /**** THIS CODE TO CHECK STAR OF EMPLOYEE IF THE IT IS IN FAVOORIT LIST AND SHOW IN WORKFLOW LIST****/ + // this.actionHistory.forEach((obj, i) => { + // if(this.favoriteUserList.some(x => x['USER_NAME'] === obj.USER_NAME)) { + // this.actionHistory[i].isInFavorite = true; + // } else { + // this.actionHistory[i].isInFavorite = false; + // } + // }); + // console.log(this.actionHistory); + /**** END ****/ + } - }) + }); } saveUserFavruiteList(request) { this.worklistService.saveFavoriteList(request, () => { @@ -511,80 +517,80 @@ export class WorkListReplacementRollComponent implements OnInit { selEmp.EMPLOYEE_DISPLAY_NAME = selEmp.EMPLOYEE_DISPLAY_NAME ? selEmp.EMPLOYEE_DISPLAY_NAME : selEmp.NAME; selEmp.EMPLOYEE_IMAGE = selEmp.EMPLOYEE_IMAGE ? selEmp.EMPLOYEE_IMAGE : ''; selEmp.EMAIL_ADDRESS = selEmp.EMAIL_ADDRESS ? selEmp.EMAIL_ADDRESS : ''; - var confirmBoxhtml = ` - Do you want to add ` + selEmp.EMPLOYEE_DISPLAY_NAME + ` in your favorite list - - - `; - if (selEmp.EMPLOYEE_IMAGE) - confirmBoxhtml += ''; - if (!selEmp.EMPLOYEE_IMAGE) - confirmBoxhtml += ''; - - confirmBoxhtml += ` - - ` + selEmp.EMPLOYEE_DISPLAY_NAME + ` - - - - - ` - let userIndex = this.favoriteUserList.findIndex(x => x['USER_NAME'] == selEmp.USER_NAME) - if (userIndex == -1) - this.cs.presentConfirmDialog( - confirmBoxhtml - , () => { - var request = - [{ "USER_NAME": selEmp['USER_NAME'], "EMPLOYEE_DISPLAY_NAME": selEmp['EMPLOYEE_DISPLAY_NAME'], "EMAIL_ADDRESS": selEmp.EMAIL_ADDRESS, "EMPLOYEE_IMAGE": selEmp.EMPLOYEE_IMAGE, "IsFavorite": true }]; - - this.saveUserFavruiteList(request); - }, () => { - - }) - - // if (selectValue == "1" || selectValue == "2" || selectValue == "3") { - // this.isSelect = true; - // } - // else { - // this.isSelect = false; - + if (this.favoriteUserList.some(x => x['USER_NAME'] === selEmp.USER_NAME)) { + let confirmBoxhtml = ` + Do you want to add ` + selEmp.EMPLOYEE_DISPLAY_NAME + ` in your favorite list + + + `; + if (selEmp.EMPLOYEE_IMAGE) { + confirmBoxhtml += ''; + } + if (!selEmp.EMPLOYEE_IMAGE) { + confirmBoxhtml += ''; + } + confirmBoxhtml += ` + ` + selEmp.EMPLOYEE_DISPLAY_NAME + ` + + + `; + const userIndex = this.favoriteUserList.findIndex(x => x['USER_NAME'] === selEmp.USER_NAME) + if (userIndex === -1) { + this.cs.presentConfirmDialog( + confirmBoxhtml + , () => { + const request = + [ + { + 'USER_NAME': selEmp['USER_NAME'], + 'EMPLOYEE_DISPLAY_NAME': selEmp['EMPLOYEE_DISPLAY_NAME'], + 'EMAIL_ADDRESS': selEmp.EMAIL_ADDRESS, + 'EMPLOYEE_IMAGE': selEmp.EMPLOYEE_IMAGE, + 'IsFavorite': true + } + ]; - // } + this.saveUserFavruiteList(request); + }, () => { }); + } + } else { + const request = + [ + { + 'USER_NAME': selEmp['USER_NAME'], + 'EMPLOYEE_DISPLAY_NAME': selEmp['EMPLOYEE_DISPLAY_NAME'], + 'EMAIL_ADDRESS': selEmp.EMAIL_ADDRESS, + 'EMPLOYEE_IMAGE': selEmp.EMPLOYEE_IMAGE, + 'IsFavorite': false + } + ]; + this.saveUserFavruiteList(request); + } } - // onChangeInput() { - // if (this.inputSearch.length > 0) { - // this.searchKeyEnter = true; - - // } else { - // this.searchKeyEnter = false; - - // } - // } - listOfRealted: any = []; listOfFav: any = []; - filterList(event){ + filterList(event) { const val = event.target.value; - if(this.selectedType === 1){ - if(val === '') { + if (this.selectedType === 1) { + if (val === '') { this.actionHistory = this.listOfRealted; } else { this.actionHistory = this.listOfRealted.filter((item) => { return (item.NAME.toLowerCase().indexOf(val.toLowerCase()) > -1); }); } - } else if(this.selectedType === 4) { - if(val === '') { + } else if (this.selectedType === 4) { + if (val === '') { this.favoriteUserList = this.listOfFav; } else { this.favoriteUserList = this.listOfFav.filter((item) => { return (item.EMPLOYEE_DISPLAY_NAME.toLowerCase().indexOf(val.toLowerCase()) > -1); }); } - }else{ + } else { return; } } diff --git a/Mohem/src/assets/imgs/business-card-design.png b/Mohem/src/assets/imgs/business-card-design.png new file mode 100644 index 00000000..77743c13 Binary files /dev/null and b/Mohem/src/assets/imgs/business-card-design.png differ