remove get notifiction open count

mekawy-issues
ashwaq 6 years ago
parent 49a47fbc34
commit ea34f65959

@ -33,6 +33,8 @@ import { WorkListReplacementRollComponent } from '../work-list-replacement-roll/
import { WorkListRfcComponent } from '../work-list-rfc/work-list-rfc.component'; import { WorkListRfcComponent } from '../work-list-rfc/work-list-rfc.component';
import { MOItemHistoryRes } from '../models/MOItemHistoryRes'; import { MOItemHistoryRes } from '../models/MOItemHistoryRes';
import { MOItemHistoryReq } from '../models/MOItemHistoryReq'; import { MOItemHistoryReq } from '../models/MOItemHistoryReq';
import { GetOpenNotificationsResponse } from 'src/app/hmg-common/services/dashbored/models/GetOpenNotificationsResponse';
import { DashboredService } from 'src/app/hmg-common/services/dashbored/dashbored.service';
@Component({ @Component({
selector: 'app-worklist-main-mr', selector: 'app-worklist-main-mr',
@ -105,9 +107,12 @@ export class WorklistMainMRComponent implements OnInit {
moreDisabled: boolean = true; moreDisabled: boolean = true;
direction: string; direction: string;
defaultSegment = ''; defaultSegment = '';
public isPostNoLoad = true;
public worklistNotifications: any;
public totalRequestCount = 0;
constructor( constructor(
public common: CommonService, public common: CommonService,
public ts: TranslatorService, public ts: TranslatorService,
public worklistMainService: WorklistMainService, public worklistMainService: WorklistMainService,
@ -116,7 +121,8 @@ export class WorklistMainMRComponent implements OnInit {
public events: Events, public events: Events,
public worklistAttachService: WorklistAttachService, public worklistAttachService: WorklistAttachService,
private modalCtrl: ModalController, private modalCtrl: ModalController,
public worklistService: WorklistService public worklistService: WorklistService,
public dashboredService: DashboredService,
) { ) {
this.direction = TranslatorService.getCurrentLanguageName() this.direction = TranslatorService.getCurrentLanguageName()
//this.getPassNotificationDetails = this.common.sharedService.getSharedData('passNotificationInfo'); //this.getPassNotificationDetails = this.common.sharedService.getSharedData('passNotificationInfo');
@ -307,7 +313,7 @@ export class WorklistMainMRComponent implements OnInit {
setTimeout(() => { setTimeout(() => {
this.messageSuccess = false; this.messageSuccess = false;
this.getNotificationCountAfterSubmit(); this.openNotificationsDashboard();
this.nextNotfification(); this.nextNotfification();
}, 5000); }, 5000);
@ -643,19 +649,19 @@ export class WorklistMainMRComponent implements OnInit {
} }
} }
getNotificationCountAfterSubmit() { // getNotificationCountAfterSubmit() {
const req: any = {}; // const req: any = {};
this.menuService.getNotificationCount(req).subscribe((result: any) => { // this.menuService.getNotificationCount(req).subscribe((result: any) => {
if (this.common.validResponse(result)) { // if (this.common.validResponse(result)) {
this.notificationCount = // this.notificationCount =
result.GetOpenNotificationsNumList.P_OPEN_NOTIFICATIONS_NUM; // result.GetOpenNotificationsNumList.P_OPEN_NOTIFICATIONS_NUM;
if (this.notificationCount <= 0) { // if (this.notificationCount <= 0) {
this.notificationCount = null; // this.notificationCount = null;
} // }
this.events.publish('getNotCount', this.notificationCount); // this.events.publish('getNotCount', this.notificationCount);
} // }
}); // });
} // }
@ -1000,7 +1006,7 @@ export class WorklistMainMRComponent implements OnInit {
if (data.data == 'cancel' || data.data == undefined) { if (data.data == 'cancel' || data.data == undefined) {
return; return;
} else if (data.data == 'Success') { } else if (data.data == 'Success') {
this.getNotificationCountAfterSubmit(); this.openNotificationsDashboard();
this.nextNotfification(); this.nextNotfification();
} }
@ -1032,7 +1038,7 @@ export class WorklistMainMRComponent implements OnInit {
if (data.data == 'cancel' || data.data == undefined) { if (data.data == 'cancel' || data.data == undefined) {
return; return;
} else if (data.data == 'Success') { } else if (data.data == 'Success') {
this.getNotificationCountAfterSubmit(); this.openNotificationsDashboard();
this.nextNotfification(); this.nextNotfification();
} }
@ -1089,7 +1095,15 @@ export class WorklistMainMRComponent implements OnInit {
} }
openNotificationsDashboard() {
this.dashboredService.getOpenNotifications('', '', this.isPostNoLoad).subscribe((result: GetOpenNotificationsResponse) => {
if (this.common.validResponse(result)) {
this.worklistNotifications = result;
this.totalRequestCount = this.worklistNotifications.P_OPEN_NTF_NUMBER;
this.common.sharedService.setSharedData(result, 'worklistNotifications');
}
});
}
} }

@ -35,6 +35,7 @@ import { QuotationAnalysisRequest } from '../models/quotationAnalysisReq';
import { MoreActionModalComponent } from '../more-action-modal/more-action-modal.component' import { MoreActionModalComponent } from '../more-action-modal/more-action-modal.component'
import { WorkListReplacementRollComponent } from '../work-list-replacement-roll/work-list-replacement-roll.component'; import { WorkListReplacementRollComponent } from '../work-list-replacement-roll/work-list-replacement-roll.component';
import { WorkListRfcComponent } from '../work-list-rfc/work-list-rfc.component'; import { WorkListRfcComponent } from '../work-list-rfc/work-list-rfc.component';
import { DashboredService } from 'src/app/hmg-common/services/dashbored/dashbored.service';
@Component({ @Component({
selector: 'app-worklist-main-po', selector: 'app-worklist-main-po',
@ -54,7 +55,9 @@ export class WorklistMainPoComponent implements OnInit {
public static PASS_PO_HEADER_ID = "passPOHeader"; public static PASS_PO_HEADER_ID = "passPOHeader";
public static PASS_ACTION_MODE = "passActionMode"; public static PASS_ACTION_MODE = "passActionMode";
public static PASS_ACTION_MORE = "passActioMore"; public static PASS_ACTION_MORE = "passActioMore";
public isPostNoLoad = true;
public worklistNotifications: any;
public totalRequestCount = 0;
getPassNotificationDetails: any; getPassNotificationDetails: any;
public static PASS_RES_ATTR = "passResAttr"; public static PASS_RES_ATTR = "passResAttr";
TransactionID: number = -999; TransactionID: number = -999;
@ -129,6 +132,8 @@ export class WorklistMainPoComponent implements OnInit {
public worklistAttachService: WorklistAttachService, public worklistAttachService: WorklistAttachService,
private modalCtrl: ModalController, private modalCtrl: ModalController,
public worklistService: WorklistService, public worklistService: WorklistService,
public dashboredService: DashboredService,
) { ) {
this.direction = TranslatorService.getCurrentLanguageName() this.direction = TranslatorService.getCurrentLanguageName()
this.WorkListActionHistoryObj = new WorkListActionHistoryRequest(); this.WorkListActionHistoryObj = new WorkListActionHistoryRequest();
@ -340,7 +345,7 @@ export class WorklistMainPoComponent implements OnInit {
setTimeout(() => { setTimeout(() => {
this.messageSuccess = false; this.messageSuccess = false;
this.getNotificationCountAfterSubmit(); this.openNotificationsDashboard();
this.nextNotfification(); this.nextNotfification();
}, 5000); }, 5000);
@ -679,19 +684,19 @@ export class WorklistMainPoComponent implements OnInit {
} }
} }
getNotificationCountAfterSubmit() { // getNotificationCountAfterSubmit() {
const req: any = {}; // const req: any = {};
this.menuService.getNotificationCount(req).subscribe((result: any) => { // this.menuService.getNotificationCount(req).subscribe((result: any) => {
if (this.common.validResponse(result)) { // if (this.common.validResponse(result)) {
this.notificationCount = // this.notificationCount =
result.GetOpenNotificationsNumList.P_OPEN_NOTIFICATIONS_NUM; // result.GetOpenNotificationsNumList.P_OPEN_NOTIFICATIONS_NUM;
if (this.notificationCount <= 0) { // if (this.notificationCount <= 0) {
this.notificationCount = null; // this.notificationCount = null;
} // }
this.events.publish("getNotCount", this.notificationCount); // this.events.publish("getNotCount", this.notificationCount);
} // }
}); // });
} // }
@ -1068,7 +1073,7 @@ export class WorklistMainPoComponent implements OnInit {
if (data.data == "cancel" || data.data == undefined) { if (data.data == "cancel" || data.data == undefined) {
return; return;
} else if (data.data == "Success") { } else if (data.data == "Success") {
this.getNotificationCountAfterSubmit(); this.openNotificationsDashboard();
this.nextNotfification(); this.nextNotfification();
} }
@ -1112,4 +1117,15 @@ export class WorklistMainPoComponent implements OnInit {
} }
openNotificationsDashboard() {
this.dashboredService.getOpenNotifications('', '', this.isPostNoLoad).subscribe((result: GetOpenNotificationsResponse) => {
if (this.common.validResponse(result)) {
this.worklistNotifications = result;
this.totalRequestCount = this.worklistNotifications.P_OPEN_NTF_NUMBER;
this.common.sharedService.setSharedData(result, 'worklistNotifications');
}
});
}
} }

@ -31,6 +31,8 @@ import { ApplyActionModalComponent } from '../apply-action-modal/apply-action-mo
import { MoreActionModalComponent } from '../more-action-modal/more-action-modal.component'; import { MoreActionModalComponent } from '../more-action-modal/more-action-modal.component';
import { WorkListReplacementRollComponent } from '../work-list-replacement-roll/work-list-replacement-roll.component'; import { WorkListReplacementRollComponent } from '../work-list-replacement-roll/work-list-replacement-roll.component';
import { WorkListRfcComponent } from '../work-list-rfc/work-list-rfc.component'; import { WorkListRfcComponent } from '../work-list-rfc/work-list-rfc.component';
import { DashboredService } from 'src/app/hmg-common/services/dashbored/dashbored.service';
import { GetOpenNotificationsResponse } from 'src/app/hmg-common/services/dashbored/models/GetOpenNotificationsResponse';
@Component({ @Component({
selector: 'app-worklist-main-pr', selector: 'app-worklist-main-pr',
@ -38,7 +40,9 @@ import { WorkListRfcComponent } from '../work-list-rfc/work-list-rfc.component';
styleUrls: ['./worklist-main-pr.component.scss'], styleUrls: ['./worklist-main-pr.component.scss'],
}) })
export class WorklistMainPRComponent implements OnInit { export class WorklistMainPRComponent implements OnInit {
public isPostNoLoad = true;
public worklistNotifications: any;
public totalRequestCount = 0;
private WorkListBodyObj: WorkListBodyRequest; private WorkListBodyObj: WorkListBodyRequest;
private WorkListButtonsObj: WorkListButtonRequest; private WorkListButtonsObj: WorkListButtonRequest;
private WorkListActionObj: WorkListActionRequest; private WorkListActionObj: WorkListActionRequest;
@ -106,6 +110,7 @@ export class WorklistMainPRComponent implements OnInit {
constructor( constructor(
public dashboredService: DashboredService,
public common: CommonService, public common: CommonService,
public ts: TranslatorService, public ts: TranslatorService,
public worklistMainService: WorklistMainService, public worklistMainService: WorklistMainService,
@ -340,7 +345,7 @@ export class WorklistMainPRComponent implements OnInit {
this.messageSuccess = false; this.messageSuccess = false;
}, 5000); }, 5000);
this.getNotificationCountAfterSubmit(); this.openNotificationsDashboard();
this.nextNotfification(); this.nextNotfification();
} }
} // valid it } // valid it
@ -677,19 +682,19 @@ export class WorklistMainPRComponent implements OnInit {
} }
} }
getNotificationCountAfterSubmit() { // getNotificationCountAfterSubmit() {
const req: any = {}; // const req: any = {};
this.menuService.getNotificationCount(req).subscribe((result: any) => { // this.menuService.getNotificationCount(req).subscribe((result: any) => {
if (this.common.validResponse(result)) { // if (this.common.validResponse(result)) {
this.notificationCount = // this.notificationCount =
result.GetOpenNotificationsNumList.P_OPEN_NOTIFICATIONS_NUM; // result.GetOpenNotificationsNumList.P_OPEN_NOTIFICATIONS_NUM;
if (this.notificationCount <= 0) { // if (this.notificationCount <= 0) {
this.notificationCount = null; // this.notificationCount = null;
} // }
this.events.publish('getNotCount', this.notificationCount); // this.events.publish('getNotCount', this.notificationCount);
} // }
}); // });
} // }
@ -1000,7 +1005,7 @@ export class WorklistMainPRComponent implements OnInit {
if (data.data == 'cancel' || data.data == undefined) { if (data.data == 'cancel' || data.data == undefined) {
return; return;
} else if (data.data == 'Success') { } else if (data.data == 'Success') {
this.getNotificationCountAfterSubmit(); this.openNotificationsDashboard();
this.nextNotfification(); this.nextNotfification();
} }
@ -1043,4 +1048,14 @@ export class WorklistMainPRComponent implements OnInit {
} }
openNotificationsDashboard() {
this.dashboredService.getOpenNotifications('', '', this.isPostNoLoad).subscribe((result: GetOpenNotificationsResponse) => {
if (this.common.validResponse(result)) {
this.worklistNotifications = result;
this.totalRequestCount = this.worklistNotifications.P_OPEN_NTF_NUMBER;
this.common.sharedService.setSharedData(result, 'worklistNotifications');
}
});
}
} }

@ -35,6 +35,7 @@ import { WorkListSubmitterInfoRequest } from '../models/WorklistsubmitterInfoReq
import { WorkListReplacementRollComponent } from '../work-list-replacement-roll/work-list-replacement-roll.component'; import { WorkListReplacementRollComponent } from '../work-list-replacement-roll/work-list-replacement-roll.component';
import { WorkListRfcComponent } from '../work-list-rfc/work-list-rfc.component'; import { WorkListRfcComponent } from '../work-list-rfc/work-list-rfc.component';
import { ApplyActionModalComponent } from '../apply-action-modal/apply-action-modal.component'; import { ApplyActionModalComponent } from '../apply-action-modal/apply-action-modal.component';
import { GetOpenNotificationsResponse } from 'src/app/hmg-common/services/dashbored/models/GetOpenNotificationsResponse';
@ -97,6 +98,9 @@ export class WorklistMainComponent implements OnInit {
dirfromNotificationPage: boolean = false; dirfromNotificationPage: boolean = false;
direction: string; direction: string;
defaultSegment = ''; defaultSegment = '';
public isPostNoLoad = true;
public worklistNotifications: any;
public totalRequestCount = 0;
constructor( constructor(
public worklistService: WorklistService, public worklistService: WorklistService,
@ -350,7 +354,7 @@ export class WorklistMainComponent implements OnInit {
setTimeout(() => { setTimeout(() => {
this.messageSuccess = false; this.messageSuccess = false;
this.getNotificationCountAfterSubmit(); this.openNotificationsDashboard();
this.nextNotfification(); this.nextNotfification();
}, 5000); }, 5000);
@ -363,21 +367,34 @@ export class WorklistMainComponent implements OnInit {
//let itemExist = false; //let itemExist = false;
let itemNo = this.getPassNotificationDetails.ROW_NUM; let itemNo = this.getPassNotificationDetails.ROW_NUM;
itemNo += 1; itemNo += 1;
if (itemNo > this.notificationArray.length) { console.log( this.notificationArray);
this.common.openNotificationPage(); let sortArr =this.sortArray(this.notificationArray);
} else { console.log( sortArr);
for (let i = 0; i < this.notificationArray.length; i++) {
if (this.notificationArray[i].ROW_NUM == itemNo) { const sortedActivities = this.notificationArray.slice().sort((a, b) => b.BEGIN_DATE - a.BEGIN_DATE)
this.common.sharedService.setSharedData(this.notificationArray[i], HomeComponent.NOTIFICATION_DATA); console.log(sortedActivities);
// itemExist = true; // if (itemNo > this.notificationArray.length) {
this.intializeNotificationDetail(); // this.common.openNotificationPage();
break; // } else {
} // for (let i = 0; i < this.notificationArray.length; i++) {
} // if (this.notificationArray[i].ROW_NUM == itemNo) {
// if(itemExist==false){ // this.common.sharedService.setSharedData(this.notificationArray[i], HomeComponent.NOTIFICATION_DATA);
// this.nextNotfification(); // // itemExist = true;
// } // this.intializeNotificationDetail();
} // break;
// }
// }
// // if(itemExist==false){
// // this.nextNotfification();
// // }
// }
}
sortArray(arrayToSort: any) {
return arrayToSort.sort((a: any, b: any) =>
new Date(b.BEGIN_DATE).getTime() - new Date(a.BEGIN_DATE).getTime()
);
} }
actionButton(action) { actionButton(action) {
@ -687,19 +704,19 @@ export class WorklistMainComponent implements OnInit {
} }
} }
getNotificationCountAfterSubmit() { // getNotificationCountAfterSubmit() {
const req: any = {}; // const req: any = {};
this.menuService.getNotificationCount(req).subscribe((result: any) => { // this.menuService.getNotificationCount(req).subscribe((result: any) => {
if (this.common.validResponse(result)) { // if (this.common.validResponse(result)) {
this.notificationCount = // this.notificationCount =
result.GetOpenNotificationsNumList.P_OPEN_NOTIFICATIONS_NUM; // result.GetOpenNotificationsNumList.P_OPEN_NOTIFICATIONS_NUM;
if (this.notificationCount <= 0) { // if (this.notificationCount <= 0) {
this.notificationCount = null; // this.notificationCount = null;
} // }
this.events.publish("getNotCount", this.notificationCount); // this.events.publish("getNotCount", this.notificationCount);
} // }
}); // });
} // }
getAttachmentNotification(WorkListAttachObj) { getAttachmentNotification(WorkListAttachObj) {
@ -904,7 +921,7 @@ export class WorklistMainComponent implements OnInit {
if (data.data == "cancel" || data.data == undefined) { if (data.data == "cancel" || data.data == undefined) {
return; return;
} else if (data.data == "Success") { } else if (data.data == "Success") {
this.getNotificationCountAfterSubmit(); this.openNotificationsDashboard();
this.nextNotfification(); this.nextNotfification();
} }
@ -936,7 +953,7 @@ export class WorklistMainComponent implements OnInit {
if (data.data == "cancel" || data.data == undefined) { if (data.data == "cancel" || data.data == undefined) {
return; return;
} else if (data.data == "Success") { } else if (data.data == "Success") {
this.getNotificationCountAfterSubmit(); this.openNotificationsDashboard();
this.nextNotfification(); this.nextNotfification();
} }
@ -1017,4 +1034,15 @@ export class WorklistMainComponent implements OnInit {
} }
}//end infiniteScroll }//end infiniteScroll
openNotificationsDashboard() {
this.dashboredService.getOpenNotifications('', '', this.isPostNoLoad).subscribe((result: GetOpenNotificationsResponse) => {
if (this.common.validResponse(result)) {
this.worklistNotifications = result;
this.totalRequestCount = this.worklistNotifications.P_OPEN_NTF_NUMBER;
this.common.sharedService.setSharedData(result, 'worklistNotifications');
}
});
}
} }

Loading…
Cancel
Save