fixing favruite in worklist and my team

MOHEMM-SFH-COLORS
enadhilal 4 years ago
parent b12eeb4a1a
commit a03b32a2b0

@ -78,7 +78,7 @@
<ion-item *ngIf='userInfo?.show_business' (click)="openBusinessCard()"> <ion-item *ngIf='userInfo?.show_business' (click)="openBusinessCard()">
<ion-thumbnail slot="start" class="menu-thumb"> <ion-thumbnail slot="start" class="menu-thumb">
<img style= "height: 25px !important;" src="../assets/imgs/ID_ico_menu.png" item-left> <img style= "height: 25px !important;" src="../assets/imgs/business-card-design.png" item-left>
</ion-thumbnail> </ion-thumbnail>
<ion-label class="changepassword" > <ion-label class="changepassword" >
{{ts.trPK('general','business-card')}} {{ts.trPK('general','business-card')}}
@ -177,7 +177,7 @@
<ion-item *ngIf='userInfo?.show_business' (click)="openBusinessCard()"> <ion-item *ngIf='userInfo?.show_business' (click)="openBusinessCard()">
<ion-thumbnail slot="start" class="menu-thumb"> <ion-thumbnail slot="start" class="menu-thumb">
<img style= "height: 25px !important;" src="../assets/imgs/ID_ico_menu.png" item-left> <img style= "height: 25px !important;" src="../assets/imgs/business-card-design.png" item-left>
</ion-thumbnail> </ion-thumbnail>
<ion-label class="changepassword" > <ion-label class="changepassword" >
{{ts.trPK('general','business-card')}} {{ts.trPK('general','business-card')}}

@ -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 { DashboredService } from 'src/app/hmg-common/services/dashbored/dashbored.service';
import { AttendanceTrackingResponse } from 'src/app/hmg-common/services/dashbored/attendance-tracking.response'; import { AttendanceTrackingResponse } from 'src/app/hmg-common/services/dashbored/attendance-tracking.response';
import { WorklistService } from 'src/app/notification/service/worklist.service'; import { WorklistService } from 'src/app/notification/service/worklist.service';
import { element } from 'protractor';
@Component({ @Component({
selector: 'app-details', selector: 'app-details',
templateUrl: './details.component.html', templateUrl: './details.component.html',
@ -93,9 +94,9 @@ export class DetailsComponent implements OnInit {
public itemType = ''; public itemType = '';
public monthNo: any; public monthNo: any;
isFavorite = false; isFavorite = false;
public EmpNumer:any; public EmpNumer: any;
public isFavor:any; public isFavor: any;
public EmployeeTotal:any; public EmployeeTotal: any;
// public activeSegment = 'About'; // public activeSegment = 'About';
@ -247,7 +248,7 @@ export class DetailsComponent implements OnInit {
let jobTitle = this.employee.POSITION_NAME.split('.'); let jobTitle = this.employee.POSITION_NAME.split('.');
if (jobTitle && jobTitle.length > 1) { if (jobTitle && jobTitle.length > 1) {
this.jobName = jobTitle[0] + " " + jobTitle[1]; this.jobName = jobTitle[0] + " " + jobTitle[1];
} }
const request = { const request = {
P_SELECTED_EMPLOYEE_NUMBER: this.employee.EMPLOYEE_NUMBER P_SELECTED_EMPLOYEE_NUMBER: this.employee.EMPLOYEE_NUMBER
@ -266,12 +267,12 @@ export class DetailsComponent implements OnInit {
this.common.startLoading(); this.common.startLoading();
this.initAttendance(); this.initAttendance();
} }
else if(this.activeSegment != 'Attendance' && this.activeSegment != 'TeamMembers'){ else if (this.activeSegment != 'Attendance' && this.activeSegment != 'TeamMembers') {
this.activeSegment = 'About'; this.activeSegment = 'About';
} }
} }
initAttendance() { initAttendance() {
@ -323,7 +324,7 @@ export class DetailsComponent implements OnInit {
} }
monthCardSliders(monthNo) { monthCardSliders(monthNo) {
/* change /* change
*/ */
@ -336,7 +337,7 @@ export class DetailsComponent implements OnInit {
//end //end
this.calendarConfig(this.getMonthName(monthNo), this.currentYear); this.calendarConfig(this.getMonthName(monthNo), this.currentYear);
} }
@ -364,7 +365,7 @@ export class DetailsComponent implements OnInit {
this.preMonth = 12; this.preMonth = 12;
} }
this.currentDate = new Date(this.currentYear, (this.preMonth - 1), 1); this.currentDate = new Date(this.currentYear, (this.preMonth - 1), 1);
this.calendarConfig(this.getMonthName(this.preMonth), this.currentYear); this.calendarConfig(this.getMonthName(this.preMonth), this.currentYear);
this.preMonth = this.preMonth - 1; this.preMonth = this.preMonth - 1;
this.nextMonth = this.preMonth + 2; this.nextMonth = this.preMonth + 2;
@ -539,7 +540,7 @@ export class DetailsComponent implements OnInit {
this.isSpecialist = this.common.sharedService.getSharedData('isSpecialist', false) ? true : false; this.isSpecialist = this.common.sharedService.getSharedData('isSpecialist', false) ? true : false;
if (this.employee) { if (this.employee) {
this.getEmpSubordinate(userID); this.getEmpSubordinate(userID);
this.isFavorite = false; // this.isFavorite = false;
this.getFavorit(); this.getFavorit();
} }
} }
@ -603,7 +604,7 @@ export class DetailsComponent implements OnInit {
}; };
this.getEmployeeSubordinatesRequestObject = body; this.getEmployeeSubordinatesRequestObject = body;
this.myTeamService.getEmployeeSubordinates(body).subscribe((result: any) => { this.myTeamService.getEmployeeSubordinates(body).subscribe((result: any) => {
if (this.common.validResponse(result)) { if (this.common.validResponse(result)) {
this.handleEmpResult(result.GetEmployeeSubordinatesList); this.handleEmpResult(result.GetEmployeeSubordinatesList);
} }
@ -611,7 +612,7 @@ export class DetailsComponent implements OnInit {
} }
handleEmpResult(result) { handleEmpResult(result) {
this.EmployeeTotal = result.length; this.EmployeeTotal = result.length;
const lastItemIndex = result.length - 1; const lastItemIndex = result.length - 1;
const lastItem = result[lastItemIndex]; const lastItem = result[lastItemIndex];
if (lastItem) { if (lastItem) {
@ -642,7 +643,7 @@ export class DetailsComponent implements OnInit {
doInfinite(infiniteScroll) { doInfinite(infiniteScroll) {
if (!this.isReachEnd) { if (!this.isReachEnd) {
this.myTeamService.getEmployeeSubordinates(this.getEmployeeSubordinatesRequestObject).subscribe((result: any) => { this.myTeamService.getEmployeeSubordinates(this.getEmployeeSubordinatesRequestObject).subscribe((result: any) => {
if (this.common.validResponse(result)) { if (this.common.validResponse(result)) {
this.handleEmpResult(result.GetEmployeeSubordinatesList); this.handleEmpResult(result.GetEmployeeSubordinatesList);
} }
@ -750,11 +751,11 @@ export class DetailsComponent implements OnInit {
// handleRespondSuborinatesAttStatusResult(result) { // handleRespondSuborinatesAttStatusResult(result) {
// // this.EmpTotal = result.GetSubordinatesAttdStatusList.length; // // this.EmpTotal = result.GetSubordinatesAttdStatusList.length;
// this.EmpTotal = result.GetSubordinatesAttdStatusList[0].NUMBER_OF_EMPLOYEES; // this.EmpTotal = result.GetSubordinatesAttdStatusList[0].NUMBER_OF_EMPLOYEES;
// } // }
activeFilter(index: number) { activeFilter(index: number) {
if (this.currentActiveIndex !== index) { if (this.currentActiveIndex !== index) {
this.previousActiveIndex = this.currentActiveIndex; this.previousActiveIndex = this.currentActiveIndex;
this.currentActiveIndex = index; 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_DISPLAY_NAME = selEmp.EMPLOYEE_DISPLAY_NAME ? selEmp.EMPLOYEE_DISPLAY_NAME : selEmp.NAME;
selEmp.EMPLOYEE_IMAGE = selEmp.EMPLOYEE_IMAGE ? selEmp.EMPLOYEE_IMAGE : ''; selEmp.EMPLOYEE_IMAGE = selEmp.EMPLOYEE_IMAGE ? selEmp.EMPLOYEE_IMAGE : '';
selEmp.EMAIL_ADDRESS = selEmp.EMAIL_ADDRESS ? selEmp.EMAIL_ADDRESS : ''; selEmp.EMAIL_ADDRESS = selEmp.EMAIL_ADDRESS ? selEmp.EMAIL_ADDRESS : '';
var confirmBoxhtml = `<div> if(!this.isFavorite) {
<h4>Do you want to add ` + selEmp.EMPLOYEE_DISPLAY_NAME + ` in your favorite list </h4> let confirmBoxhtml = `<div>
<br/> <h4>Do you want to add ` + selEmp.EMPLOYEE_DISPLAY_NAME + ` in your favorite list </h4>
<br/> <br/>
<div class="fav-profileImageDiv"><ion-row>`; <br/>
if (selEmp.EMPLOYEE_IMAGE) <div class="fav-profileImageDiv"><ion-row>`;
confirmBoxhtml += '<div class="img-box"><img class="empImgeRep" src="data:image/png;base64,' + selEmp.EMPLOYEE_IMAGE + '"></div>'; if (selEmp.EMPLOYEE_IMAGE) {
if (!selEmp.EMPLOYEE_IMAGE) confirmBoxhtml += '<div class="img-box"><img class="empImgeRep" src="data:image/png;base64,' + selEmp.EMPLOYEE_IMAGE + '"></div>';
confirmBoxhtml += '<div class="img-box"><img class="empImgeRep" src="../assets/imgs/profile.png"></div>';
confirmBoxhtml += ` <div class="name-box"><ion-label class="fav-employee-details">
<span>` + selEmp.EMPLOYEE_DISPLAY_NAME + `</span>
</ion-label>
</div></ion-row> </div>
</div>`
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 (!selEmp.EMPLOYEE_IMAGE) {
confirmBoxhtml += '<div class="img-box"><img class="empImgeRep" src="../assets/imgs/profile.png"></div>';
}
confirmBoxhtml += ` <div class="name-box"><ion-label class="fav-employee-details">
<span>` + selEmp.EMPLOYEE_DISPLAY_NAME + `</span>
</ion-label>
</div></ion-row> </div>
</div>`;
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) { saveUserFavruiteList(request) {
this.worklistService.saveFavoriteList(request, () => { this.worklistService.saveFavoriteList(request, () => {
}).subscribe((result) => { }).subscribe((result) => {
if (this.common.validResponse(result)) { if (this.common.validResponse(result)) {
this.common.toastPK("replacementRoll", "favorite-saved"); this.common.toastPK("replacementRoll", "favorite-saved");
this.isFavorite = !this.isFavorite; this.getFavorit();
} }
}) });
} }
getFavorit(){ getFavorit() {
this.worklistService.getFavoriteMyTeam({}, () => { this.worklistService.getFavoriteMyTeam({}, () => {
}).subscribe((result) => { }).subscribe((result) => {
this.EmpNumer = result.Mohemm_GetFavoriteReplacementsList; this.EmpNumer = result.Mohemm_GetFavoriteReplacementsList;
this.isFavorite = this.EmpNumer.some(element => element.USER_NAME === this.employee.EMPLOYEE_NUMBER);
this.EmpNumer.forEach(element => { this.common.stopLoading();
if(element.USER_NAME === this.employee.EMPLOYEE_NUMBER){
this.isFavorite = true;
}
});
}); });
} }
} }

@ -94,9 +94,12 @@
<span (click)="select(employee,i)">{{employee.NAME}}</span> <span (click)="select(employee,i)">{{employee.NAME}}</span>
</ion-label> </ion-label>
<div [ngClass]="direction == 'en' ? 'star-fav' : 'star-fav-left'" (click)="setFavorite(employee)"> <div *ngIf='!employee.isInFavorite' [ngClass]="direction == 'en' ? 'star-fav' : 'star-fav-left'" (click)="setFavorite(employee)">
<img src="assets/imgs/fav.svg" /> <img src="assets/imgs/fav.svg" />
</div> </div>
<div *ngIf='employee.isInFavorite' [ngClass]="direction == 'en' ? 'star-fav' : 'star-fav-left'" (click)="setFavorite(employee)">
<img src="assets/imgs/fav filled.svg" />
</div>
</div> </div>
</div> </div>
</div> </div>

@ -53,26 +53,26 @@ export class WorkListReplacementRollComponent implements OnInit {
this.P_PAGE_NUM = 1; this.P_PAGE_NUM = 1;
this.P_PAGE_LIMIT = 50; this.P_PAGE_LIMIT = 50;
this.getPassActionMode = this.cs.sharedService.getSharedData('passActionMode', false); this.getPassActionMode = this.cs.sharedService.getSharedData('passActionMode', false);
console.log(this.getPassActionMode);
// this.getFavruite(); // this.getFavruite();
this.getPassNotificationDetails = this.cs.sharedService.getSharedData('passNotificationInfo', false); this.getPassNotificationDetails = this.cs.sharedService.getSharedData('passNotificationInfo', false);
this.getpassResAttr = this.cs.sharedService.getSharedData('passResAttr', false); this.getpassResAttr = this.cs.sharedService.getSharedData('passResAttr', false);
console.log(this.getpassResAttr);
this.pQuestion = this.cs.sharedService.getSharedData('pQuestion', false); this.pQuestion = this.cs.sharedService.getSharedData('pQuestion', false);
// tslint:disable-next-line: max-line-length // tslint:disable-next-line: max-line-length
this.arr = this.cs.sharedService.getSharedData('actionHistoryData', false) ? this.cs.sharedService.getSharedData('actionHistoryData', false) : []; this.arr = this.cs.sharedService.getSharedData('actionHistoryData', false) ? this.cs.sharedService.getSharedData('actionHistoryData', false) : [];
var lookupObject = {}; var lookupObject = {};
for(var i in this.arr) { // tslint:disable-next-line: forin
for (var i in this.arr) {
lookupObject[this.arr[i]['USER_NAME']] = this.arr[i]; 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') { if (this.getPassActionMode === 'ANSWER_INFO') {
this.isAnswer = true; this.isAnswer = true;
@ -214,7 +214,6 @@ export class WorkListReplacementRollComponent implements OnInit {
select(selectEmp, index) { select(selectEmp, index) {
console.log(selectEmp.EMPLOYEE_DISPLAY_NAME);
this.selEmp = selectEmp this.selEmp = selectEmp
this.active = index; this.active = index;
this.userSelected = true; this.userSelected = true;
@ -251,11 +250,7 @@ export class WorkListReplacementRollComponent implements OnInit {
if (this.selEmp && this.isAnswer == false) { if (this.selEmp && this.isAnswer == false) {
// this.selectedUserInf = this.ReplacementList[this.selEmp]; // this.selectedUserInf = this.ReplacementList[this.selEmp];
this.selectedUserInf = this.selEmp; this.selectedUserInf = this.selEmp;
console.log("selEmp " + this.selEmp.USER_NAME);
if (this.selectedUserInf && this.selectedUserInf.USER_NAME) { if (this.selectedUserInf && this.selectedUserInf.USER_NAME) {
console.log("userInfo " + this.selectedUserInf.USER_NAME);
if (this.userNote) { if (this.userNote) {
if (this.getPassActionMode == "APPROVE_AND_FORWARD" || this.getPassActionMode == "FORWARD") { 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.getpassResAttr[index_Note].ATTRIBUTE_TEXT_VALUE = this.userNote;
this.P_RESPOND_ATTRIBUTES_TBL = this.getpassResAttr; 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_FORWARD_TO_USER_NAME = this.selectedUserInf.USER_NAME;
this.WorkListActionObj.P_ACTION_MODE = this.getPassActionMode; this.WorkListActionObj.P_ACTION_MODE = this.getPassActionMode;
this.WorkListActionObj.P_COMMENTS = ""// response Attr this.WorkListActionObj.P_COMMENTS = ""// response Attr
@ -353,8 +347,9 @@ export class WorkListReplacementRollComponent implements OnInit {
'dismissed': true, 'dismissed': true,
data: "Success" data: "Success"
}); });
if (this.selEmp && this.isAnswer == false) if (this.selEmp && this.isAnswer == false) {
this.setFavorite(this.selEmp); this.setFavorite(this.selEmp);
}
}, 5000); }, 5000);
this.cs.openNotificationPage(); this.cs.openNotificationPage();
@ -416,15 +411,16 @@ export class WorkListReplacementRollComponent implements OnInit {
} }
} }
//this.P_PAGE_NUM++; //this.P_PAGE_NUM++;
if (infiniteScroll) if (infiniteScroll) {
infiniteScroll.target.complete(); infiniteScroll.target.complete();
}
// console.log(resFlag);
}, (Error) => console.log(Error), () => infiniteScroll.target.complete()); }, (Error) => console.log(Error), () => infiniteScroll.target.complete());
} else { } else {
if (infiniteScroll) if (infiniteScroll) {
infiniteScroll.target.complete(); infiniteScroll.target.complete();
}
} }
} }
@ -438,7 +434,6 @@ export class WorkListReplacementRollComponent implements OnInit {
selectedType; selectedType;
onChangeSelect(select) { onChangeSelect(select) {
console.log(select.detail.value);
let selectValue = select.detail.value; let selectValue = select.detail.value;
if (selectValue == '1') { if (selectValue == '1') {
@ -446,14 +441,13 @@ export class WorkListReplacementRollComponent implements OnInit {
this.isFilter = true; this.isFilter = true;
this.selectedType = 1; this.selectedType = 1;
this.listOfRealted = this.actionHistory; this.listOfRealted = this.actionHistory;
} else if(selectValue === '4'){ } else if (selectValue === '4') {
console.log(this.listOfFav.length) if (this.favoriteUserList.length === 0 || this.favoriteUserList === undefined) {
if(this.favoriteUserList.length === 0 || this.favoriteUserList === undefined ) {
this.getFavruite(); this.getFavruite();
} }
this.isFilter = true; this.isFilter = true;
this.selectedType = 4; this.selectedType = 4;
} else if( selectValue === '2' || selectValue === '3' || selectValue === '5'){ } else if (selectValue === '2' || selectValue === '3' || selectValue === '5') {
this.isSelect = true; this.isSelect = true;
this.isFilter = false; this.isFilter = false;
this.selectedType = 0; this.selectedType = 0;
@ -494,8 +488,20 @@ export class WorkListReplacementRollComponent implements OnInit {
this.cs.stopLoading(); this.cs.stopLoading();
this.favoriteUserList = result['Mohemm_GetFavoriteReplacementsList']; this.favoriteUserList = result['Mohemm_GetFavoriteReplacementsList'];
this.listOfFav = this.favoriteUserList; 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) { saveUserFavruiteList(request) {
this.worklistService.saveFavoriteList(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_DISPLAY_NAME = selEmp.EMPLOYEE_DISPLAY_NAME ? selEmp.EMPLOYEE_DISPLAY_NAME : selEmp.NAME;
selEmp.EMPLOYEE_IMAGE = selEmp.EMPLOYEE_IMAGE ? selEmp.EMPLOYEE_IMAGE : ''; selEmp.EMPLOYEE_IMAGE = selEmp.EMPLOYEE_IMAGE ? selEmp.EMPLOYEE_IMAGE : '';
selEmp.EMAIL_ADDRESS = selEmp.EMAIL_ADDRESS ? selEmp.EMAIL_ADDRESS : ''; selEmp.EMAIL_ADDRESS = selEmp.EMAIL_ADDRESS ? selEmp.EMAIL_ADDRESS : '';
var confirmBoxhtml = `<div> if (this.favoriteUserList.some(x => x['USER_NAME'] === selEmp.USER_NAME)) {
<h4>Do you want to add ` + selEmp.EMPLOYEE_DISPLAY_NAME + ` in your favorite list </h4> let confirmBoxhtml = `<div>
<br/> <h4>Do you want to add ` + selEmp.EMPLOYEE_DISPLAY_NAME + ` in your favorite list </h4>
<br/> <br/>
<div class="fav-profileImageDiv"><ion-row>`; <br/>
if (selEmp.EMPLOYEE_IMAGE) <div class="fav-profileImageDiv"><ion-row>`;
confirmBoxhtml += '<div class="img-box"><img class="empImgeRep" src="data:image/png;base64,' + selEmp.EMPLOYEE_IMAGE + '"></div>'; if (selEmp.EMPLOYEE_IMAGE) {
if (!selEmp.EMPLOYEE_IMAGE) confirmBoxhtml += '<div class="img-box"><img class="empImgeRep" src="data:image/png;base64,' + selEmp.EMPLOYEE_IMAGE + '"></div>';
confirmBoxhtml += '<div class="img-box"><img class="empImgeRep" src="../assets/imgs/profile.png"></div>'; }
if (!selEmp.EMPLOYEE_IMAGE) {
confirmBoxhtml += ` <div class="name-box"><ion-label class="fav-employee-details"> confirmBoxhtml += '<div class="img-box"><img class="empImgeRep" src="../assets/imgs/profile.png"></div>';
}
<span>` + selEmp.EMPLOYEE_DISPLAY_NAME + `</span>
</ion-label>
</div></ion-row> </div>
</div>`
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;
confirmBoxhtml += ` <div class="name-box"><ion-label class="fav-employee-details">
<span>` + selEmp.EMPLOYEE_DISPLAY_NAME + `</span>
</ion-label>
</div></ion-row> </div>
</div>`;
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 = []; listOfRealted: any = [];
listOfFav: any = []; listOfFav: any = [];
filterList(event){ filterList(event) {
const val = event.target.value; const val = event.target.value;
if(this.selectedType === 1){ if (this.selectedType === 1) {
if(val === '') { if (val === '') {
this.actionHistory = this.listOfRealted; this.actionHistory = this.listOfRealted;
} else { } else {
this.actionHistory = this.listOfRealted.filter((item) => { this.actionHistory = this.listOfRealted.filter((item) => {
return (item.NAME.toLowerCase().indexOf(val.toLowerCase()) > -1); return (item.NAME.toLowerCase().indexOf(val.toLowerCase()) > -1);
}); });
} }
} else if(this.selectedType === 4) { } else if (this.selectedType === 4) {
if(val === '') { if (val === '') {
this.favoriteUserList = this.listOfFav; this.favoriteUserList = this.listOfFav;
} else { } else {
this.favoriteUserList = this.listOfFav.filter((item) => { this.favoriteUserList = this.listOfFav.filter((item) => {
return (item.EMPLOYEE_DISPLAY_NAME.toLowerCase().indexOf(val.toLowerCase()) > -1); return (item.EMPLOYEE_DISPLAY_NAME.toLowerCase().indexOf(val.toLowerCase()) > -1);
}); });
} }
}else{ } else {
return; return;
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Loading…
Cancel
Save