|
|
|
|
@ -445,27 +445,26 @@ export class WorkListReplacementRollComponent implements OnInit {
|
|
|
|
|
counter = 0;
|
|
|
|
|
onChangeSelect(select) {
|
|
|
|
|
let selectValue = select.detail.value;
|
|
|
|
|
|
|
|
|
|
if (selectValue == '1') {
|
|
|
|
|
this.isSelect = true;
|
|
|
|
|
this.isFilter = true;
|
|
|
|
|
this.selectedType = 1;
|
|
|
|
|
this.listOfRealted = this.actionHistory;
|
|
|
|
|
if (this.counter > 0) {
|
|
|
|
|
this.actionHistory.forEach((obj, i) => {
|
|
|
|
|
if (this.favoriteUserList.find(x => x['USER_NAME'] === obj.USER_NAME)) {
|
|
|
|
|
this.actionHistory[i].IsFavorite = true;
|
|
|
|
|
} else {
|
|
|
|
|
this.actionHistory[i].IsFavorite = false;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// if (this.counter > 0) {
|
|
|
|
|
this.actionHistory.forEach((obj, i) => {
|
|
|
|
|
if (this.favoriteUserList.find(x => x['USER_NAME'] === obj.USER_NAME)) {
|
|
|
|
|
this.actionHistory[i].IsFavorite = true;
|
|
|
|
|
} else {
|
|
|
|
|
this.actionHistory[i].IsFavorite = false;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
// }
|
|
|
|
|
this.counter = 1;
|
|
|
|
|
} else if (selectValue === '4') {
|
|
|
|
|
// if (this.favoriteUserList.length === 0 || this.favoriteUserList === undefined) {
|
|
|
|
|
this.getFavruite();
|
|
|
|
|
// }
|
|
|
|
|
this.isFilter = true;
|
|
|
|
|
this.isFilter = true;
|
|
|
|
|
this.selectedType = 4;
|
|
|
|
|
} else if (selectValue === '2' || selectValue === '3' || selectValue === '5') {
|
|
|
|
|
this.isSelect = true;
|
|
|
|
|
@ -523,7 +522,9 @@ export class WorkListReplacementRollComponent implements OnInit {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.favLetter.forEach((obj, index) => {
|
|
|
|
|
if (this.activeSelectedLetter) { }
|
|
|
|
|
if (this.activeSelectedLetter) {
|
|
|
|
|
this.selectedLetter(this.activeSelectedLetter);
|
|
|
|
|
}
|
|
|
|
|
if (index === 0) {
|
|
|
|
|
// this.selectedLetter(obj);
|
|
|
|
|
this.favIsActive.push(true);
|
|
|
|
|
@ -531,150 +532,154 @@ export class WorkListReplacementRollComponent implements OnInit {
|
|
|
|
|
this.favIsActive.push(false);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
console.log(this.favLetter);
|
|
|
|
|
console.log(this.favIsActive);
|
|
|
|
|
}
|
|
|
|
|
console.log(this.favLetter);
|
|
|
|
|
console.log(this.favIsActive);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
// this.worklistService.getFavorite({}, () => {
|
|
|
|
|
|
|
|
|
|
// }).subscribe((result) => {
|
|
|
|
|
// if (this.cs.validResponse(result)) {
|
|
|
|
|
// this.cs.stopLoading();
|
|
|
|
|
// this.favoriteUserList = result['Mohemm_GetFavoriteReplacementsList'];
|
|
|
|
|
// this.listOfFav = this.favoriteUserList;
|
|
|
|
|
// this.favoriteUserList.forEach((obj) => {
|
|
|
|
|
// obj.IsFavorite = true;
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
}
|
|
|
|
|
// this.worklistService.getFavorite({}, () => {
|
|
|
|
|
|
|
|
|
|
// }).subscribe((result) => {
|
|
|
|
|
// if (this.cs.validResponse(result)) {
|
|
|
|
|
// this.cs.stopLoading();
|
|
|
|
|
// this.favoriteUserList = result['Mohemm_GetFavoriteReplacementsList'];
|
|
|
|
|
// this.listOfFav = this.favoriteUserList;
|
|
|
|
|
// this.favoriteUserList.forEach((obj) => {
|
|
|
|
|
// obj.IsFavorite = true;
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
saveUserFavruiteList(request, isFav: boolean) {
|
|
|
|
|
this.worklistService.saveFavoriteList(request, () => {
|
|
|
|
|
}).subscribe((result) => {
|
|
|
|
|
if (this.cs.validResponse(result)) {
|
|
|
|
|
if (isFav) {
|
|
|
|
|
this.cs.greenToastPK("replacementRoll", "favorite-saved");
|
|
|
|
|
} else {
|
|
|
|
|
this.cs.redToastPK("replacementRoll", "favorite-unsaved");
|
|
|
|
|
saveUserFavruiteList(request, isFav: boolean) {
|
|
|
|
|
this.worklistService.saveFavoriteList(request, () => {
|
|
|
|
|
}).subscribe((result) => {
|
|
|
|
|
if (this.cs.validResponse(result)) {
|
|
|
|
|
if (isFav) {
|
|
|
|
|
this.cs.greenToastPK("replacementRoll", "favorite-saved");
|
|
|
|
|
} else {
|
|
|
|
|
this.cs.redToastPK("replacementRoll", "favorite-unsaved");
|
|
|
|
|
}
|
|
|
|
|
this.getFavruite();
|
|
|
|
|
}
|
|
|
|
|
this.getFavruite();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setFavorite(selEmp) {
|
|
|
|
|
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 : '';
|
|
|
|
|
selEmp.IsFavorite = !selEmp.IsFavorite;
|
|
|
|
|
let confirmBoxhtml = `<div>
|
|
|
|
|
setFavorite(selEmp) {
|
|
|
|
|
let confirmBoxhtml = `<div>
|
|
|
|
|
<h4>Do you want to add ` + selEmp.EMPLOYEE_DISPLAY_NAME + ` in your favorite list </h4>
|
|
|
|
|
<br/>
|
|
|
|
|
<br/>
|
|
|
|
|
<div class="fav-profileImageDiv"><ion-row>`;
|
|
|
|
|
if (selEmp.EMPLOYEE_IMAGE) {
|
|
|
|
|
confirmBoxhtml += '<div class="img-box"><img class="empImgeRep" src="data:image/png;base64,' + selEmp.EMPLOYEE_IMAGE + '"></div>';
|
|
|
|
|
}
|
|
|
|
|
if (!selEmp.EMPLOYEE_IMAGE) {
|
|
|
|
|
confirmBoxhtml += '<div class="img-box"><img class="empImgeRep" src="../assets/imgs/profile.png"></div>';
|
|
|
|
|
}
|
|
|
|
|
if (selEmp.EMPLOYEE_IMAGE) {
|
|
|
|
|
confirmBoxhtml += '<div class="img-box"><img class="empImgeRep" src="data:image/png;base64,' + selEmp.EMPLOYEE_IMAGE + '"></div>';
|
|
|
|
|
}
|
|
|
|
|
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">
|
|
|
|
|
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': selEmp.IsFavorite
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
this.saveUserFavruiteList(request, selEmp.IsFavorite);
|
|
|
|
|
}, () => { });
|
|
|
|
|
} 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, false);
|
|
|
|
|
const userIndex = this.favoriteUserList.findIndex(x => x['USER_NAME'] === selEmp.USER_NAME)
|
|
|
|
|
if (userIndex === -1) {
|
|
|
|
|
this.cs.presentConfirmDialog(
|
|
|
|
|
confirmBoxhtml
|
|
|
|
|
, () => {
|
|
|
|
|
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 : '';
|
|
|
|
|
selEmp.IsFavorite = !selEmp.IsFavorite;
|
|
|
|
|
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': selEmp.IsFavorite
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
this.saveUserFavruiteList(request, selEmp.IsFavorite);
|
|
|
|
|
}, () => { });
|
|
|
|
|
} else {
|
|
|
|
|
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 : '';
|
|
|
|
|
selEmp.IsFavorite = !selEmp.IsFavorite;
|
|
|
|
|
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, false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
listOfRealted: any = [];
|
|
|
|
|
listOfFav: any = [];
|
|
|
|
|
listOfRealted: any = [];
|
|
|
|
|
listOfFav: any = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
filterList(event) {
|
|
|
|
|
const val = event.target.value;
|
|
|
|
|
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 === '') {
|
|
|
|
|
this.favoriteUserList = this.listOfFav;
|
|
|
|
|
filterList(event) {
|
|
|
|
|
const val = event.target.value;
|
|
|
|
|
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 === '') {
|
|
|
|
|
this.favoriteUserList = this.listOfFav;
|
|
|
|
|
} else {
|
|
|
|
|
this.favoriteUserList = this.listOfFav.filter((item) => {
|
|
|
|
|
return (item.EMPLOYEE_DISPLAY_NAME.toLowerCase().indexOf(val.toLowerCase()) > -1);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this.favoriteUserList = this.listOfFav.filter((item) => {
|
|
|
|
|
return (item.EMPLOYEE_DISPLAY_NAME.toLowerCase().indexOf(val.toLowerCase()) > -1);
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
selectedLetter(el) {
|
|
|
|
|
this.isFavoriteLetterActive = true;
|
|
|
|
|
this.favLetter.forEach((letter, index) => {
|
|
|
|
|
if (letter === el) {
|
|
|
|
|
this.favIsActive[index] = true;
|
|
|
|
|
this.activeSelectedLetter = el;
|
|
|
|
|
this.worklistService.getFavoriteByLetter(letter, () => {
|
|
|
|
|
}).subscribe((result) => {
|
|
|
|
|
if (this.cs.validResponse(result)) {
|
|
|
|
|
this.cs.stopLoading();
|
|
|
|
|
this.favoriteUserList = result['Mohemm_GetFavoriteReplacementsList'];
|
|
|
|
|
this.listOfFav = this.favoriteUserList;
|
|
|
|
|
this.favoriteUserList.forEach((obj) => {
|
|
|
|
|
obj.IsFavorite = true;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.favIsActive[index] = false;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
selectedLetter(el) {
|
|
|
|
|
this.isFavoriteLetterActive = true;
|
|
|
|
|
this.favLetter.forEach((letter, index) => {
|
|
|
|
|
if (letter === el) {
|
|
|
|
|
this.favIsActive[index] = true;
|
|
|
|
|
this.activeSelectedLetter = el;
|
|
|
|
|
this.worklistService.getFavoriteByLetter(letter, () => {
|
|
|
|
|
}).subscribe((result) => {
|
|
|
|
|
if (this.cs.validResponse(result)) {
|
|
|
|
|
this.cs.stopLoading();
|
|
|
|
|
this.favoriteUserList = result['Mohemm_GetFavoriteReplacementsList'];
|
|
|
|
|
this.listOfFav = this.favoriteUserList;
|
|
|
|
|
this.favoriteUserList.forEach((obj) => {
|
|
|
|
|
obj.IsFavorite = true;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.favIsActive[index] = false;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
returnIsActiveFunction(i) {
|
|
|
|
|
return this.favIsActive[i];
|
|
|
|
|
}
|
|
|
|
|
returnIsActiveFunction(i) {
|
|
|
|
|
return this.favIsActive[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
clearSearchInput(){
|
|
|
|
|
this.inputSearch = '';
|
|
|
|
|
}
|
|
|
|
|
clearSearchInput() {
|
|
|
|
|
this.inputSearch = '';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|