|
|
|
|
@ -39,27 +39,35 @@ export class WorkListReplacementItgComponent implements OnInit {
|
|
|
|
|
relatedList = [];
|
|
|
|
|
public direction = '';
|
|
|
|
|
arr = [];
|
|
|
|
|
delegtedEmp;
|
|
|
|
|
constructor(public vacationRuleService: VacationRuleServiceService,
|
|
|
|
|
public ts: TranslatorService,
|
|
|
|
|
public cs: CommonService,
|
|
|
|
|
public worklistService: WorklistService,
|
|
|
|
|
public modalController: ModalController) {
|
|
|
|
|
this.direction = TranslatorService.getCurrentDirection();
|
|
|
|
|
}
|
|
|
|
|
public modalController: ModalController) {
|
|
|
|
|
this.direction = TranslatorService.getCurrentDirection();
|
|
|
|
|
console.log(this.direction);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// async ionViewWillEnter() {
|
|
|
|
|
// await this.getFavruite();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
|
this.getFavruite();
|
|
|
|
|
if(!this.relatedList || this.relatedList.length === 0 || this.relatedList === undefined){
|
|
|
|
|
this.arr = this.cs.sharedService.getSharedData('workflow-user', false);
|
|
|
|
|
var lookupObject = {};
|
|
|
|
|
|
|
|
|
|
for(var i in this.arr) {
|
|
|
|
|
lookupObject[this.arr[i]['Name']] = this.arr[i];
|
|
|
|
|
}
|
|
|
|
|
console.log(lookupObject);
|
|
|
|
|
for(i in lookupObject) {
|
|
|
|
|
this.relatedList.push(lookupObject[i]);
|
|
|
|
|
}
|
|
|
|
|
this.delegtedEmp = this.cs.sharedService.getSharedData('selectedEmpInfo', true);
|
|
|
|
|
if (this.delegtedEmp === undefined) {
|
|
|
|
|
if (!this.relatedList || this.relatedList.length === 0 || this.relatedList === undefined) {
|
|
|
|
|
this.arr = this.cs.sharedService.getSharedData('workflow-user', false);
|
|
|
|
|
var lookupObject = {};
|
|
|
|
|
for (var i in this.arr) {
|
|
|
|
|
lookupObject[this.arr[i]['Name']] = this.arr[i];
|
|
|
|
|
}
|
|
|
|
|
for (i in lookupObject) {
|
|
|
|
|
this.relatedList.push(lookupObject[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this.select(this.delegtedEmp, 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -139,6 +147,7 @@ export class WorkListReplacementItgComponent implements OnInit {
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
closePage() {
|
|
|
|
|
console.log(this.selEmp);
|
|
|
|
|
this.isSave = true;
|
|
|
|
|
let data: any = null;
|
|
|
|
|
if (this.isSave == true) {
|
|
|
|
|
@ -160,7 +169,7 @@ export class WorkListReplacementItgComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
closeFunction(){
|
|
|
|
|
closeFunction() {
|
|
|
|
|
this.modalController.dismiss({
|
|
|
|
|
'dismissed': true,
|
|
|
|
|
// comments: this.userNote
|
|
|
|
|
@ -168,17 +177,22 @@ export class WorkListReplacementItgComponent implements OnInit {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onChangeSelect(select) {
|
|
|
|
|
console.log(select.detail.value);
|
|
|
|
|
let selectValue = select.detail.value;
|
|
|
|
|
|
|
|
|
|
this.searchKey = '';
|
|
|
|
|
if (selectValue == "1") {
|
|
|
|
|
this.listOfRealted = this.relatedList;
|
|
|
|
|
console.log(this.relatedList);
|
|
|
|
|
this.isSelect = true;
|
|
|
|
|
this.isFilter = true;
|
|
|
|
|
} else if(selectValue == "4" ){
|
|
|
|
|
this.ReplacementList = [];
|
|
|
|
|
} else if (selectValue == "4") {
|
|
|
|
|
this.listOfFav = this.favoriteUserList;
|
|
|
|
|
this.isFilter = true;
|
|
|
|
|
} else if(selectValue === '2' || selectValue === '3' || selectValue === '5'){
|
|
|
|
|
this.ReplacementList = [];
|
|
|
|
|
if(this.favoriteUserList.length === 0 || this.favoriteUserList === undefined){
|
|
|
|
|
this.getFavruite();
|
|
|
|
|
}
|
|
|
|
|
} else if (selectValue === '2' || selectValue === '3' || selectValue === '5') {
|
|
|
|
|
this.isSelect = true;
|
|
|
|
|
this.isFilter = false;
|
|
|
|
|
}
|
|
|
|
|
@ -200,12 +214,10 @@ export class WorkListReplacementItgComponent implements OnInit {
|
|
|
|
|
}, 3000);
|
|
|
|
|
}
|
|
|
|
|
select(selectEmp, index) {
|
|
|
|
|
console.log(selectEmp);
|
|
|
|
|
this.selEmp = selectEmp
|
|
|
|
|
this.userSelected = true;
|
|
|
|
|
this.active = index;
|
|
|
|
|
this.searchKey = selectEmp.EMPLOYEE_DISPLAY_NAME ? selectEmp.EMPLOYEE_DISPLAY_NAME : selectEmp.Name;
|
|
|
|
|
console.log(this.searchKey)
|
|
|
|
|
//this.closePage();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -272,6 +284,7 @@ export class WorkListReplacementItgComponent implements OnInit {
|
|
|
|
|
if (this.cs.validResponse(result)) {
|
|
|
|
|
this.cs.stopLoading();
|
|
|
|
|
this.favoriteUserList = result['Mohemm_GetFavoriteReplacementsList'];
|
|
|
|
|
console.log(this.favoriteUserList);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
@ -279,28 +292,36 @@ export class WorkListReplacementItgComponent implements OnInit {
|
|
|
|
|
listOfRealted = [];
|
|
|
|
|
listOfFav = []
|
|
|
|
|
|
|
|
|
|
filterList(event){
|
|
|
|
|
console.log(this.relatedList);
|
|
|
|
|
console.log(this.favoriteUserList);
|
|
|
|
|
filterList(event) {
|
|
|
|
|
const val = event.target.value;
|
|
|
|
|
if(this.searchKeySelect === '1'){
|
|
|
|
|
if(val === '') {
|
|
|
|
|
if (this.searchKeySelect === '1') {
|
|
|
|
|
if (val === '') {
|
|
|
|
|
this.relatedList = this.listOfRealted;
|
|
|
|
|
} else {
|
|
|
|
|
this.relatedList = this.listOfRealted.filter((item) => {
|
|
|
|
|
return (item.Name.toLowerCase().indexOf(val.toLowerCase()) > -1);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else if(this.searchKeySelect ==='4') {
|
|
|
|
|
if(val === '') {
|
|
|
|
|
} else if (this.searchKeySelect === '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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
isfavEmp(emp) {
|
|
|
|
|
let isEmp = this.favoriteUserList.find(elm => elm.USER_NAME === emp.EmployeeID);
|
|
|
|
|
return isEmp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
saveBtnDisabled() {
|
|
|
|
|
if (!this.userNote || this.userNote === '')
|
|
|
|
|
return true;
|
|
|
|
|
else { return false; }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|