From 1e83686fad7b992d1ec83d81bf42d0f732746755 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Sun, 5 Jun 2022 15:27:47 +0300 Subject: [PATCH] worklist count --- .../absence-confirm.component.ts | 116 +++++++++--------- .../services/connector/connector.service.ts | 4 +- .../app/notification/home/home.component.ts | 8 +- .../work-list-main-itg.component.ts | 9 +- .../work-list-rfc/work-list-rfc.component.ts | 14 ++- .../confirm-basic-details.component.ts | 14 ++- .../confirm-contact.component.ts | 4 +- .../confirm-termination.component.ts | 4 +- 8 files changed, 93 insertions(+), 80 deletions(-) diff --git a/Mohem/src/app/absence/absence-confirm/absence-confirm.component.ts b/Mohem/src/app/absence/absence-confirm/absence-confirm.component.ts index ad0fa4c7..40dc3dd3 100644 --- a/Mohem/src/app/absence/absence-confirm/absence-confirm.component.ts +++ b/Mohem/src/app/absence/absence-confirm/absence-confirm.component.ts @@ -15,13 +15,14 @@ import { AbsenceAttachmentComponent } from '../absence-attachment/absence-attach import { WorkListAttachViewComponent } from 'src/app/notification/work-list-attach-view/work-list-attach-view.component'; import { FileUploader } from 'ng2-file-upload'; import { SubmitAbsenceModalComponent } from '../submit-absence-modal/submit-absence-modal.component'; +import { HomeComponent } from "src/app/notification/home/home.component"; @Component({ selector: 'app-absence-confirm', templateUrl: './absence-confirm.component.html', styleUrls: ['./absence-confirm.component.scss'] }) export class AbsenceConfirmComponent implements OnInit { - direction:string; + direction: string; P_TransactionID: number; approversList = []; selEmp: string = ''; @@ -58,7 +59,7 @@ export class AbsenceConfirmComponent implements OnInit { this.P_TransactionID = this.common.sharedService.getSharedData( AbsenceResponse.SHARED_DATA ); - this.getPassNotificationDetails =this.common.sharedService.getSharedData( + this.getPassNotificationDetails = this.common.sharedService.getSharedData( AbsenceNotificatonBodyResponse.NOT_WORKLIST, true ); @@ -89,7 +90,7 @@ export class AbsenceConfirmComponent implements OnInit { this.getApproversList(); } - ngOnInit() {} + ngOnInit() { } startAbApproval() { if (this.attachListOver) { //first call add attach inside success call submit @@ -126,12 +127,12 @@ export class AbsenceConfirmComponent implements OnInit { this.startAbsApprovalProcess(); } else { //stope - let filtered = this.attachListOver.filter(function(el) { + let filtered = this.attachListOver.filter(function (el) { return el.isSuccess == true; }); this.attachListOver = filtered; let msg: string = ''; - // msg = this.translate.translate("addAttach.errorMsg"); + // msg = this.translate.translate("addAttach.errorMsg"); //this.common.showAlert(msg); } } @@ -168,11 +169,12 @@ export class AbsenceConfirmComponent implements OnInit { if (this.common.validResponse(result)) { this.isSubmitBtnClicked = true; //if(this.isResubmitAbs==false){ - // let msg: string = this.ts.trPK('general', 'messageSuccess'); - // this.common.presentAlert(msg); - this.common.greenToastPK("eit", "approval-message-success") + // let msg: string = this.ts.trPK('general', 'messageSuccess'); + // this.common.presentAlert(msg); + this.common.greenToastPK("eit", "approval-message-success") // } // this.navCtrl.popToRoot(); + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); } } @@ -204,61 +206,61 @@ export class AbsenceConfirmComponent implements OnInit { // }); const modal = await this.modalCtrl.create({ component: AbsenceAttachmentComponent, - componentProps:{ indexLastObj: this.attachListOver.length, TransactionID: this.P_TransactionID}, + componentProps: { indexLastObj: this.attachListOver.length, TransactionID: this.P_TransactionID }, keyboardClose: true, animated: false - }); + }); modal.onDidDismiss() - .then((data) => { - if (data == 'cancel' || data == 'undefined') { - return; - } else { - if (!str) { - this.updateFile(data, attachDocID); + .then((data) => { + if (data == 'cancel' || data == 'undefined') { + return; } else { - this.attachListDisplay = data.data; - this.attachItems = this.attachListDisplay.map(function (el) { - var o = Object.assign({}, el); - o.isSuccess = false; - return o; - }); - this.attachListOver = this.attachListOver ? this.attachListOver.concat(this.attachItems) : this.attachItems; + if (!str) { + this.updateFile(data, attachDocID); + } else { + this.attachListDisplay = data.data; + this.attachItems = this.attachListDisplay.map(function (el) { + var o = Object.assign({}, el); + o.isSuccess = false; + return o; + }); + this.attachListOver = this.attachListOver ? this.attachListOver.concat(this.attachItems) : this.attachItems; + } } - } - }); + }); return await modal.present(); } -/*****submit modal********/ -async openSubmitModal() { - this.common.sharedService.setSharedData( this.attachListOver, 'submitAbsAttachmentList'); - this.common.sharedService.setSharedData(this.absComments, 'absComments'); - const modal = await this.modalCtrl.create({ - component: SubmitAbsenceModalComponent, - backdropDismiss: false, + /*****submit modal********/ + async openSubmitModal() { + this.common.sharedService.setSharedData(this.attachListOver, 'submitAbsAttachmentList'); + this.common.sharedService.setSharedData(this.absComments, 'absComments'); + const modal = await this.modalCtrl.create({ + component: SubmitAbsenceModalComponent, + backdropDismiss: false, - }); - modal.cssClass = 'note-modal'; + }); + modal.cssClass = 'note-modal'; - modal.onDidDismiss() - .then((data) => { - console.log(data.data); + modal.onDidDismiss() + .then((data) => { + console.log(data.data); - if (data.data == 'cancel' || data.data == undefined) { - return; - } else { - this.startAbApproval(); - } - }); + if (data.data == 'cancel' || data.data == undefined) { + return; + } else { + this.startAbApproval(); + } + }); - return await modal.present(); + return await modal.present(); -} + } @@ -266,7 +268,7 @@ async openSubmitModal() { removeFile(objectitem) { - + if (this.attachListOver) { let index2 = this.attachListOver.findIndex(item => item == objectitem); if (index2 > -1) { @@ -300,12 +302,12 @@ async openSubmitModal() { } // valid it } - async OpenAttachFiles(value, Type) { + async OpenAttachFiles(value, Type) { this.common.sharedService.setSharedData({ displayData: value, TypeData: Type }, 'WorkListAttachViewPage'); const modal = await this.modalCtrl.create({ component: WorkListAttachViewComponent }); - + modal.onDidDismiss() .then((data) => { }); @@ -314,7 +316,7 @@ async openSubmitModal() { } updateFile(attachList, attachDocID) { - + let req = { P_ATTACHED_DOCUMENT_ID: attachDocID, P_FILE_DATA: attachList[0].P_FILE_DATA, @@ -327,7 +329,7 @@ async openSubmitModal() { let msg: string = ''; // msg = this.translate.translate("addAttach.attachUpdate"); // this.common.showAlert(msg); - + this.getAttachment(this.getPassNotificationDetails.NOTIFICATION_ID); } } // val @@ -345,7 +347,7 @@ async openSubmitModal() { // }); } continueDelete(attach) { - + let req = { P_ATTACHED_DOCUMENT_ID: attach.ATTACHED_DOCUMENT_ID }; @@ -367,9 +369,9 @@ async openSubmitModal() { - /*******************Add attchement Functions*************/ + /*******************Add attchement Functions*************/ - public uploader: FileUploader = new FileUploader({ + public uploader: FileUploader = new FileUploader({ allowedMimeType: ['application/pdf', 'image/jpeg', 'image/png', 'text/plain', 'image/jpg', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'], maxFileSize: 10 * 1024 * 1024, formatDataFunctionIsAsync: true, @@ -386,7 +388,7 @@ async openSubmitModal() { }); - onFileSelectedclick(event){ + onFileSelectedclick(event) { event.target.value = ''; } @@ -430,7 +432,7 @@ async openSubmitModal() { pushObject(fileData, name, type) { - console.log('before push: '+ this.index); + console.log('before push: ' + this.index); //this.attachListOver.length++; try { let array = name.split('.'); @@ -438,11 +440,11 @@ async openSubmitModal() { this.attachListOver.push( { - AttachmentID: this.attachListOver.length, + AttachmentID: this.attachListOver.length, P_FILE_CONTENT_TYPE: attachType,//type.split('/')[1], P_FILE_DATA: fileData.split(',')[1], P_FILE_NAME: name,//.split('.')[0], - P_TRANSACTION_ID: this.P_TransactionID + P_TRANSACTION_ID: this.P_TransactionID }) } catch (e) { diff --git a/Mohem/src/app/hmg-common/services/connector/connector.service.ts b/Mohem/src/app/hmg-common/services/connector/connector.service.ts index 5a1959c6..ccee3973 100644 --- a/Mohem/src/app/hmg-common/services/connector/connector.service.ts +++ b/Mohem/src/app/hmg-common/services/connector/connector.service.ts @@ -27,8 +27,8 @@ export class ConnectorService { public static retryTimes = 0; public static timeOut = 180 * 1000; - // public static host = 'https://uat.hmgwebservices.com/'; - public static host = 'https://hmgwebservices.com/'; + public static host = 'https://uat.hmgwebservices.com/'; + //public static host = 'https://hmgwebservices.com/'; constructor(public httpClient: HttpClient, public cs: CommonService, diff --git a/Mohem/src/app/notification/home/home.component.ts b/Mohem/src/app/notification/home/home.component.ts index d1cbcbcd..0ec194c5 100644 --- a/Mohem/src/app/notification/home/home.component.ts +++ b/Mohem/src/app/notification/home/home.component.ts @@ -702,7 +702,6 @@ export class HomeComponent implements OnInit { openNotificationsDashboard() { this.common.startLoading(); - this.resetFiltersUI(); this.totalRequestCount = 0; this.DS.getOpenNotifications('', '', false).subscribe((result: GetOpenNotificationsResponse) => { if (this.common.validResponse(result)) { @@ -715,9 +714,7 @@ export class HomeComponent implements OnInit { ); this.common.setFilterValues(result['GetOpenNotificationsList']); - const values = this.common.getFiltersData(); - this.data = values.data; - this.filters = values.filters; + } }); @@ -726,6 +723,9 @@ export class HomeComponent implements OnInit { this.workListService.getITGDetails('', '', this.isPostNoLoad).subscribe((result: any) => { this.common.sharedService.setSharedData(result, MenuResponse.ITG_COUNTS); this.common.filterKeys['ITG'] = result.TotalCount; + const values = this.common.getFiltersData(); + this.data = values.data; + this.filters = values.filters; this.totalRequestCount = Math.floor(count + result.TotalCount); this.common.sharedService.setSharedData(this.totalRequestCount, 'total-count'); this.getCOCNotificationCount(); diff --git a/Mohem/src/app/notification/work-list-main-itg/work-list-main-itg.component.ts b/Mohem/src/app/notification/work-list-main-itg/work-list-main-itg.component.ts index f31cf456..85a195e0 100644 --- a/Mohem/src/app/notification/work-list-main-itg/work-list-main-itg.component.ts +++ b/Mohem/src/app/notification/work-list-main-itg/work-list-main-itg.component.ts @@ -218,6 +218,7 @@ export class WorkListMainItgComponent implements OnInit { } } else if (this.index === this.all_request_names.length) { // if its the end request redirecte to worklist home this.common.sharedService.setSharedData(true, 'loadWorkList'); + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); return false; } @@ -233,6 +234,7 @@ export class WorkListMainItgComponent implements OnInit { return; } else { this.common.sharedService.setSharedData(true, 'loadWorkList'); + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); return; } @@ -240,6 +242,7 @@ export class WorkListMainItgComponent implements OnInit { } } this.common.sharedService.setSharedData(true, 'loadWorkList'); + this.common.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.common.openNotificationPage(); return; } @@ -498,8 +501,8 @@ export class WorkListMainItgComponent implements OnInit { } if (this.actionSelected === 'Delegate') { this.common.sharedService.setSharedData(info, 'selectedEmpInfo'), - this.common.sharedService.setSharedData('Delegate','pressedBtn') - this.presentModal(4); + this.common.sharedService.setSharedData('Delegate', 'pressedBtn') + this.presentModal(4); } if (this.actionSelected === 'Doable') { this.actionService(1, this.commentText); @@ -517,7 +520,7 @@ export class WorkListMainItgComponent implements OnInit { this.actionService(2, this.commentText); } if (this.actionSelected === 'RequestInformation') { - this.common.sharedService.setSharedData('RequestInformation','pressedBtn') + this.common.sharedService.setSharedData('RequestInformation', 'pressedBtn') this.presentModal(3); } if (this.actionSelected === 'ReportGenerated') { diff --git a/Mohem/src/app/notification/work-list-rfc/work-list-rfc.component.ts b/Mohem/src/app/notification/work-list-rfc/work-list-rfc.component.ts index e8e41c87..b18b1bba 100644 --- a/Mohem/src/app/notification/work-list-rfc/work-list-rfc.component.ts +++ b/Mohem/src/app/notification/work-list-rfc/work-list-rfc.component.ts @@ -7,6 +7,7 @@ import { WorklistService } from '../service/worklist.service'; import { CommonService } from 'src/app/hmg-common/services/common/common.service'; import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; import { ModalController } from '@ionic/angular'; +import { HomeComponent } from '../home/home.component'; @Component({ selector: 'app-work-list-rfc', @@ -39,7 +40,7 @@ export class WorkListRfcComponent implements OnInit { public ts: TranslatorService, public workListMainService: WorklistMainService, public modalCtrl: ModalController - ) { + ) { this.getPassNotificationDetails = this.cs.sharedService.getSharedData('passNotificationInfo'); this.getpassResAttr = this.cs.sharedService.getSharedData('passResAttr'); @@ -125,7 +126,7 @@ export class WorkListRfcComponent implements OnInit { if (result.MessageStatus == 1) { this.cs.sharedService.setSharedData(true, 'loadWorkList'); - + this.messageSuccess = true; setTimeout(() => { @@ -138,6 +139,7 @@ export class WorkListRfcComponent implements OnInit { }); }, 5000); + this.cs.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.cs.openNotificationPage(); } @@ -178,18 +180,18 @@ export class WorkListRfcComponent implements OnInit { this.modalCtrl.dismiss(); } - select(selectEmp,index){ + select(selectEmp, index) { console.log(selectEmp.USER_NAME); console.log(selectEmp.SEQ); - this.radioButtonValue=selectEmp.USER_NAME + this.radioButtonValue = selectEmp.USER_NAME this.seqNo = selectEmp.SEQ; -////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////// // let emp: any = this.RFCEmployeeListListRes[v]; // this.seqNo = emp.SEQ; // this.radioButtonValue = emp.USER_NAME; - this.active=index; + this.active = index; } } diff --git a/Mohem/src/app/profile/confirm-basic-details/confirm-basic-details.component.ts b/Mohem/src/app/profile/confirm-basic-details/confirm-basic-details.component.ts index 5965adb6..8b34d7f4 100644 --- a/Mohem/src/app/profile/confirm-basic-details/confirm-basic-details.component.ts +++ b/Mohem/src/app/profile/confirm-basic-details/confirm-basic-details.component.ts @@ -15,6 +15,7 @@ import { WorkListButtonRequest } from 'src/app/notification/models/NotificationB import { WorkListAttachViewComponent } from 'src/app/notification/work-list-attach-view/work-list-attach-view.component'; import { ProfileService } from '../service/profile.service'; import { SubmitAddressModalComponent } from '../submit-eit-modal/submit-address-modal.component'; +import { HomeComponent } from 'src/app/notification/home/home.component'; @Component({ selector: 'app-confirm-basic-details', @@ -77,7 +78,7 @@ export class ConfirmBasicDetailsComponent implements OnInit { this.basicRequest = this.cs.sharedService.getSharedData(BasicRequest.SHARED_DATA, false); this.selEmp = this.basicRequest.P_SELECTED_EMPLOYEE_NUMBER; - + this.menuType = this.selMenu.List_Menu.MENU_TYPE; this.headerTitle = this.selMenu.GetMenuEntriesList.PROMPT; this.basicResponseList = this.cs.sharedService.getSharedData('basic-details-response', false); @@ -87,7 +88,7 @@ export class ConfirmBasicDetailsComponent implements OnInit { // this.isDelete = this.isResubmitEIT = this.cs.sharedService.getSharedData('confirmAddEITData', false).isDelete; this.getApproversList(); - + } getApproversList() { @@ -98,7 +99,7 @@ export class ConfirmBasicDetailsComponent implements OnInit { P_PAGE_LIMIT: 1000 } this.eitService.getApproversList(body).subscribe((result: any) => { - this.handleApproversResult(result); + this.handleApproversResult(result); }); } @@ -193,7 +194,8 @@ export class ConfirmBasicDetailsComponent implements OnInit { this.isSubmitBtnClicked = true; // let msg: string = this.ts.trPK("eit", "approval-message-success"); // this.cs.presentAlert(msg); - this.cs.greenToastPK("eit", "approval-message-success") + this.cs.greenToastPK("eit", "approval-message-success"); + this.cs.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.cs.openNotificationPage(); } } @@ -302,7 +304,7 @@ export class ConfirmBasicDetailsComponent implements OnInit { modal.onDidDismiss() .then((data) => { - }); + }); return await modal.present(); } @@ -431,6 +433,6 @@ export class ConfirmBasicDetailsComponent implements OnInit { } catch (e) { } } - + } diff --git a/Mohem/src/app/profile/confirm-contact/confirm-contact.component.ts b/Mohem/src/app/profile/confirm-contact/confirm-contact.component.ts index 33252458..894fb16e 100644 --- a/Mohem/src/app/profile/confirm-contact/confirm-contact.component.ts +++ b/Mohem/src/app/profile/confirm-contact/confirm-contact.component.ts @@ -15,6 +15,7 @@ import { WorkListButtonRequest } from 'src/app/notification/models/NotificationB import { WorkListAttachViewComponent } from 'src/app/notification/work-list-attach-view/work-list-attach-view.component'; import { ProfileService } from '../service/profile.service'; import { SubmitAddressModalComponent } from '../submit-eit-modal/submit-address-modal.component'; +import { HomeComponent } from 'src/app/notification/home/home.component'; @Component({ @@ -194,7 +195,8 @@ export class ConfirmContactComponent implements OnInit { this.isSubmitBtnClicked = true; // let msg: string = this.ts.trPK("eit", "approval-message-success"); // this.cs.presentAlert(msg); - this.cs.greenToastPK("eit", "approval-message-success") + this.cs.greenToastPK("eit", "approval-message-success"); + this.cs.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.cs.openNotificationPage(); } } diff --git a/Mohem/src/app/termination/confirm-termination/confirm-termination.component.ts b/Mohem/src/app/termination/confirm-termination/confirm-termination.component.ts index cb2a834a..c0de3bb0 100644 --- a/Mohem/src/app/termination/confirm-termination/confirm-termination.component.ts +++ b/Mohem/src/app/termination/confirm-termination/confirm-termination.component.ts @@ -7,6 +7,7 @@ import { EitService } from 'src/app/eit/services/eit.service'; import { CommonService } from 'src/app/hmg-common/services/common/common.service'; import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response'; import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; +import { HomeComponent } from 'src/app/notification/home/home.component'; import { WorkListButtonRequest } from 'src/app/notification/models/NotificationButtonReq'; import { WorkListAttachViewComponent } from 'src/app/notification/work-list-attach-view/work-list-attach-view.component'; import { BasicRequest } from 'src/app/profile/models/basic.request'; @@ -188,7 +189,8 @@ export class ConfirmTerminationComponent implements OnInit { this.isSubmitBtnClicked = true; // let msg: string = this.ts.trPK("eit", "approval-message-success"); // this.cs.presentAlert(msg); - this.cs.greenToastPK("eit", "approval-message-success") + this.cs.greenToastPK("eit", "approval-message-success"); + this.cs.sharedService.setSharedData(true, HomeComponent.COUNT_CHANGED); this.cs.openNotificationPage(); } }