From bc3b3616a7b75c33d8c0611c589a51dceae96cb8 Mon Sep 17 00:00:00 2001 From: enadhilal Date: Mon, 6 Sep 2021 16:43:00 +0300 Subject: [PATCH] fixing workflow list and fixing search in offer page --- .../work-list-replacement-roll.component.html | 13 ++++- .../work-list-replacement-roll.component.ts | 51 +++++++++++++------ .../offersdiscount/home/home.component.html | 5 +- .../app/offersdiscount/home/home.component.ts | 14 +++-- 4 files changed, 59 insertions(+), 24 deletions(-) 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 c001a51b..57066e50 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 @@ -74,8 +74,10 @@ -
+ +
{{'replacementRoll, related' | translate}}
@@ -127,6 +129,13 @@
+
+ +

+ Sorry there is no data +

+
+
{{'replacementRoll, search-result' | translate}}
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 776a93a0..51bf6edb 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 @@ -45,7 +45,8 @@ export class WorkListReplacementRollComponent implements OnInit { P_RESPOND_ATTRIBUTES_TBL: any[]; typingTimer: any; userSelected: boolean; - actionHistory: [] = []; + actionHistory = []; + arr = []; favoriteUserList: [] = []; isFilter = true; constructor(public worklistService: WorklistService, private cs: CommonService, public ts: TranslatorService, public workListMainService: WorklistMainService, public modalCtrl: ModalController) { @@ -59,8 +60,21 @@ export class WorkListReplacementRollComponent implements OnInit { console.log(this.getpassResAttr); this.pQuestion = this.cs.sharedService.getSharedData('pQuestion', false); - this.actionHistory = this.cs.sharedService.getSharedData('actionHistoryData', false) ? this.cs.sharedService.getSharedData('actionHistoryData', false) : []; - if (this.getPassActionMode == "ANSWER_INFO") { + // 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) { + lookupObject[this.arr[i]['USER_NAME']] = this.arr[i]; + } + + for(i in lookupObject) { + this.actionHistory.push(lookupObject[i]); + } + + console.log(this.actionHistory); + + if (this.getPassActionMode === 'ANSWER_INFO') { this.isAnswer = true; } @@ -285,15 +299,17 @@ export class WorkListReplacementRollComponent implements OnInit { }); } else { - let msg: string = this.ts.trPK("replacementRoll", "enterNote"); - this.cs.showErrorMessageDialog(() => { - }, this.ts.trPK('general', 'ok'), msg); + this.cs.toastPK("replacementRoll", "enterNote"); + // let msg: string = this.ts.trPK("replacementRoll", "enterNote"); + // this.cs.showErrorMessageDialog(() => { + // }, this.ts.trPK('general', 'ok'), msg); } } else { - let msg: string = this.ts.trPK("replacementRoll", "msg"); - this.cs.showErrorMessageDialog(() => { - }, this.ts.trPK('general', 'ok'), msg); + this.cs.toastPK("replacementRoll", "msg"); + // let msg: string = this.ts.trPK("replacementRoll", "msg"); + // this.cs.showErrorMessageDialog(() => { + // }, this.ts.trPK('general', 'ok'), msg); } } else if (this.isAnswer == true) { if (this.userNote) { @@ -308,14 +324,16 @@ export class WorkListReplacementRollComponent implements OnInit { this.handleApplayActionResult(result); }); } else { - let msg: string = this.ts.trPK("replacementRoll", "enterNote"); - this.cs.showErrorMessageDialog(() => { - }, this.ts.trPK('general', 'ok'), msg); + this.cs.toastPK("replacementRoll", "enterNote"); + // let msg: string = this.ts.trPK("replacementRoll", "enterNote"); + // this.cs.showErrorMessageDialog(() => { + // }, this.ts.trPK('general', 'ok'), msg); } } else { - let msg: string = this.ts.trPK("replacementRoll", "msg"); - this.cs.showErrorMessageDialog(() => { - }, this.ts.trPK('general', 'ok'), msg); + this.cs.toastPK("replacementRoll", "msg"); + // let msg: string = this.ts.trPK("replacementRoll", "msg"); + // this.cs.showErrorMessageDialog(() => { + // }, this.ts.trPK('general', 'ok'), msg); } } @@ -430,8 +448,9 @@ export class WorkListReplacementRollComponent implements OnInit { this.listOfRealted = this.actionHistory; } 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.isFilter = true; this.selectedType = 4; } else if( selectValue === '2' || selectValue === '3' || selectValue === '5'){ diff --git a/Mohem/src/app/offersdiscount/home/home.component.html b/Mohem/src/app/offersdiscount/home/home.component.html index 27292915..9c5cadcf 100644 --- a/Mohem/src/app/offersdiscount/home/home.component.html +++ b/Mohem/src/app/offersdiscount/home/home.component.html @@ -13,10 +13,11 @@ - + + diff --git a/Mohem/src/app/offersdiscount/home/home.component.ts b/Mohem/src/app/offersdiscount/home/home.component.ts index d38415bb..02ae6873 100644 --- a/Mohem/src/app/offersdiscount/home/home.component.ts +++ b/Mohem/src/app/offersdiscount/home/home.component.ts @@ -107,6 +107,7 @@ export class HomeComponent implements AfterViewInit { var parseJSON = data['data']; var offers = JSON.parse(parseJSON); this.offersData = offers; + this.tempSearch = this.offersData; } } @@ -137,11 +138,16 @@ export class HomeComponent implements AfterViewInit { return temporalDivElement.textContent || temporalDivElement.innerText || ""; } + search(t) { - this.offersData = this.tempSearch.filter((post, index) => { - if (post.Title.toLowerCase().indexOf(t.toLowerCase()) > -1) - return true; - }); + console.log(this.tempSearch); + if(t === ''){ + this.offersData = this.tempSearch; + } else{ + this.offersData = this.tempSearch.filter((post) => { + return (post.Title.toLowerCase().indexOf(t.toLowerCase()) > -1); + }); + } }