diff --git a/Mohem/src/app/notification/notification.module.ts b/Mohem/src/app/notification/notification.module.ts index 8ed84b29..f886cc6d 100644 --- a/Mohem/src/app/notification/notification.module.ts +++ b/Mohem/src/app/notification/notification.module.ts @@ -1,3 +1,4 @@ +import { ViewNoteModalComponent } from './view-note-modal/view-note-modal.component'; import { WorkListReplacementRollComponent } from './work-list-replacement-roll/work-list-replacement-roll.component'; import { HmgCommonModule } from './../hmg-common/hmg-common.module'; import { WorkListAttachViewComponent } from './work-list-attach-view/work-list-attach-view.component'; @@ -10,6 +11,8 @@ import { IonicModule } from '@ionic/angular'; import { NotificationPage } from './notification.page'; import { PipesModule } from '../pipes/pipes.module'; import { WorklistService } from './service/worklist.service'; +import { WorkListRfcComponent } from './work-list-rfc/work-list-rfc.component'; +import { ViewReplacementModalComponent } from './view-replacement-modal/view-replacement-modal.component'; // import { WorklistMainComponent } from './worklist-main/worklist-main.component'; @@ -30,6 +33,19 @@ const routes: Routes = [ path: 'work-list-replacement-roll', component: WorkListReplacementRollComponent }, + { + path: 'work-list-rfc', + component: WorkListRfcComponent + }, + { + path: 'view-note-modal', + component: ViewNoteModalComponent + }, + { + path: 'view-replacement-modal', + component: ViewReplacementModalComponent + }, + // { // path:'worklist-main', // component:WorklistMainComponent @@ -50,7 +66,10 @@ const routes: Routes = [ declarations: [ NotificationPage, HomeComponent, - WorkListReplacementRollComponent + WorkListReplacementRollComponent, + WorkListRfcComponent, + ViewNoteModalComponent, + ViewReplacementModalComponent // WorklistMainComponent ], providers:[WorklistService] diff --git a/Mohem/src/app/notification/service/worklist.service.ts b/Mohem/src/app/notification/service/worklist.service.ts index 5524f79a..f7d3c437 100644 --- a/Mohem/src/app/notification/service/worklist.service.ts +++ b/Mohem/src/app/notification/service/worklist.service.ts @@ -3,6 +3,8 @@ import { AuthenticationService } from "src/app/hmg-common/services/authenticatio import { ConnectorService } from "src/app/hmg-common/services/connector/connector.service"; import { Observable } from 'rxjs'; import { WorkListReplacmentEmployeeRequest } from '../models/ReplacmentEmployeeReq'; +import { WorkListActionHistoryRequest } from '../models/ActionHistoryReq'; +import { WorKListRFCEmployeeResponse } from '../models/RFC-EmployeeRes'; @Injectable() @@ -10,6 +12,7 @@ export class WorklistService { public static getWorkList = 'Services/ERP.svc/REST/GET_WORKLIST'; public static getReplacmentEmployeeList = 'Services/ERP.svc/REST/GET_REPLACEMENT_LIST'; + public static getRFCEmployeeList = 'Services/ERP.svc/REST/GET_RFC_EMPLOYEE_LIST'; constructor( public api: ConnectorService, @@ -28,4 +31,10 @@ export class WorklistService { this.authService.authenticateRequest(request); return this.api.post(WorklistService.getReplacmentEmployeeList, request, onError, errorLabel); } + + public getRFCEmployeeList(ActionHistoryRequest: any, onError?: any, errorLabel?: string): Observable { + const request = ActionHistoryRequest; + this.authService.authenticateRequest(request); + return this.api.post(WorklistService.getRFCEmployeeList, request, onError, errorLabel); + } } \ No newline at end of file diff --git a/Mohem/src/app/notification/view-note-modal/view-note-modal.component.html b/Mohem/src/app/notification/view-note-modal/view-note-modal.component.html new file mode 100644 index 00000000..14b1091b --- /dev/null +++ b/Mohem/src/app/notification/view-note-modal/view-note-modal.component.html @@ -0,0 +1,17 @@ + + + {{'worklist, note' | translate}} + + + + + + + + + + +
+

{{getTextNote}}

+
+
\ No newline at end of file diff --git a/Mohem/src/app/notification/view-note-modal/view-note-modal.component.scss b/Mohem/src/app/notification/view-note-modal/view-note-modal.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/Mohem/src/app/notification/view-note-modal/view-note-modal.component.spec.ts b/Mohem/src/app/notification/view-note-modal/view-note-modal.component.spec.ts new file mode 100644 index 00000000..6a5e32fc --- /dev/null +++ b/Mohem/src/app/notification/view-note-modal/view-note-modal.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ViewNoteModalComponent } from './view-note-modal.component'; + +describe('ViewNoteModalComponent', () => { + let component: ViewNoteModalComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ViewNoteModalComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ViewNoteModalComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/notification/view-note-modal/view-note-modal.component.ts b/Mohem/src/app/notification/view-note-modal/view-note-modal.component.ts new file mode 100644 index 00000000..f20705df --- /dev/null +++ b/Mohem/src/app/notification/view-note-modal/view-note-modal.component.ts @@ -0,0 +1,24 @@ +import { Component, OnInit } from '@angular/core'; +import { ModalController } from '@ionic/angular'; +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; + +@Component({ + selector: 'app-view-note-modal', + templateUrl: './view-note-modal.component.html', + styleUrls: ['./view-note-modal.component.scss'], +}) +export class ViewNoteModalComponent implements OnInit { + + getTextNote: any; + + constructor(private modalCtrl: ModalController, private cs: CommonService) { } + + ngOnInit() { + this.getTextNote = this.cs.sharedService.getSharedData('textNote'); + } + + closeModal() { + this.modalCtrl.dismiss(); + } + +} diff --git a/Mohem/src/app/notification/view-replacement-modal/view-replacement-modal.component.html b/Mohem/src/app/notification/view-replacement-modal/view-replacement-modal.component.html index 31549e41..34857daf 100644 --- a/Mohem/src/app/notification/view-replacement-modal/view-replacement-modal.component.html +++ b/Mohem/src/app/notification/view-replacement-modal/view-replacement-modal.component.html @@ -1,3 +1,46 @@ -

- view-replacement-modal works! -

+ + +
+ + + + + + + + + + + + + + + + + + + + + {{RepList.USER_NAME}} + {{RepList.EMPLOYEE_DISPLAY_NAME}} + {{RepList.EMAIL_ADDRESS}} + + + + + + + + + + + + +
+
\ No newline at end of file diff --git a/Mohem/src/app/notification/view-replacement-modal/view-replacement-modal.component.scss b/Mohem/src/app/notification/view-replacement-modal/view-replacement-modal.component.scss index e69de29b..b4736409 100644 --- a/Mohem/src/app/notification/view-replacement-modal/view-replacement-modal.component.scss +++ b/Mohem/src/app/notification/view-replacement-modal/view-replacement-modal.component.scss @@ -0,0 +1,11 @@ +ion-content { + margin-top: 40px !important; + width: 95% !important; + height: 80% !important; + top: 5% !important; + left: 2% !important; + right: 5% !important; + bottom: 5% !important; + padding-top: 30px !important; + border: solid 1px #dedede; +} diff --git a/Mohem/src/app/notification/view-replacement-modal/view-replacement-modal.component.ts b/Mohem/src/app/notification/view-replacement-modal/view-replacement-modal.component.ts index d1ff05a1..8d1d54e5 100644 --- a/Mohem/src/app/notification/view-replacement-modal/view-replacement-modal.component.ts +++ b/Mohem/src/app/notification/view-replacement-modal/view-replacement-modal.component.ts @@ -1,4 +1,9 @@ +import { WorklistService } from './../service/worklist.service'; import { Component, OnInit } from '@angular/core'; +import { WorkListReplacmentEmployeeRequest } from '../models/ReplacmentEmployeeReq'; +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'; @Component({ selector: 'app-view-replacement-modal', @@ -7,8 +12,65 @@ import { Component, OnInit } from '@angular/core'; }) export class ViewReplacementModalComponent implements OnInit { - constructor() { } + radioButtonValue: any; + getRepList: any;//WorKListReplacmentEmployeeResponse=new WorKListReplacmentEmployeeResponse(); + IsReachEnd: boolean = false; + private getReplacmentEmployeeReq: WorkListReplacmentEmployeeRequest = new WorkListReplacmentEmployeeRequest(); - ngOnInit() {} + + constructor(private cs: CommonService, private ts: TranslatorService, public modalCtrl: ModalController, public worklistService: WorklistService) { + this.getReplacmentEmployeeReq = this.cs.sharedService.getSharedData('replacmentReqObj'); + this.getRepList = this.cs.sharedService.getSharedData('replacmentResObj'); + } + + ngOnInit() { } + + radioSelect(v) { + this.radioButtonValue = v; + } + + OkBtnModal() { + if (!this.radioButtonValue) { + let msg: string = this.ts.trPK("replacementRoll", "msg"); + this.cs.presentAlert(msg); + return; + } else { + let data = this.radioButtonValue; + this.modalCtrl.dismiss(data); + } + } + + closeBtnModal() { + this.modalCtrl.dismiss("cancel"); + } + + doInfinite(infiniteScroll) { + if (!this.IsReachEnd) { + this.getReplacmentEmployeeReq.P_PAGE_NUM++; + this.worklistService.getReplacmentEmployeeList(this.getReplacmentEmployeeReq). + subscribe((result: any) => { + if (this.cs.validResponse(result)) { + if (result.ReplacementList != undefined) { + (result.ReplacementList).forEach(element => { + if (element.ROW_NUM == element.NO_OF_ROWS) { + this.IsReachEnd = true; + } else { + this.IsReachEnd = false; + } + this.getRepList.push(element); + }); + }// if list length >0 + else { + this.IsReachEnd = true; + } + }// if response == 1 + //this.pageNum++; + infiniteScroll.target.complete(); + }); + } else { + if (infiniteScroll) + infiniteScroll.target.complete(); + } + }//end infiniteScroll } 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 fece6581..374df0e2 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 @@ -12,9 +12,9 @@ {{'replacementRoll, searchBy' | translate}} - {{'addAttach, name' | translate}} - {{'login, username' | translate}} - {{'general, email' | translate}} + {{'addAttach, name' | translate}} + {{'login, username' | translate}} + {{'general, email' | 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 fcaf6bda..b9964870 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 @@ -39,7 +39,7 @@ export class WorkListReplacementRollComponent implements OnInit { constructor(public worklistService: WorklistService, private cs: CommonService, private ts: TranslatorService, public workListMainService: WorklistMainService, public modalCtrl: ModalController) { this.P_PAGE_NUM = 1; - this.P_PAGE_LIMIT = 50; + this.P_PAGE_LIMIT = 50; this.getPassActionMode = this.cs.sharedService.getSharedData('passActionMode'); this.getPassNotificationDetails = this.cs.sharedService.getSharedData('passNotificationInfo'); this.getpassResAttr = this.cs.sharedService.getSharedData('passResAttr'); @@ -279,14 +279,14 @@ export class WorkListReplacementRollComponent implements OnInit { } //this.P_PAGE_NUM++; if (infiniteScroll) - infiniteScroll.complete(); + infiniteScroll.target.complete(); // console.log(resFlag); - }, (Error) => console.log(Error), () => infiniteScroll.complete()); + }, (Error) => console.log(Error), () => infiniteScroll.target.complete()); } else { if (infiniteScroll) - infiniteScroll.complete(); + infiniteScroll.target.complete(); } } diff --git a/Mohem/src/app/notification/work-list-rfc/work-list-rfc.component.html b/Mohem/src/app/notification/work-list-rfc/work-list-rfc.component.html new file mode 100644 index 00000000..f29ecac0 --- /dev/null +++ b/Mohem/src/app/notification/work-list-rfc/work-list-rfc.component.html @@ -0,0 +1,39 @@ + + + + {{ 'workListMain, rfc' | translate}} + + + + + +
+ {{"replacementRoll.msgRFC" | translate}} +
+ + + {{rfcEmployeeList.EMPLOYEE_DISPLAY_NAME}} + {{rfcEmployeeList.ACTION}} + + + + + + + + +
+ + + + +
+ +
+ + +
+ + {{'general, submit' | translate}} +
+
\ No newline at end of file diff --git a/Mohem/src/app/notification/work-list-rfc/work-list-rfc.component.scss b/Mohem/src/app/notification/work-list-rfc/work-list-rfc.component.scss new file mode 100644 index 00000000..129d608e --- /dev/null +++ b/Mohem/src/app/notification/work-list-rfc/work-list-rfc.component.scss @@ -0,0 +1,7 @@ +.footer-button { + border-radius: 3px; + padding: 0 1.1em; + min-height: 45px; + min-width: 200px; + } + \ No newline at end of file diff --git a/Mohem/src/app/notification/work-list-rfc/work-list-rfc.component.spec.ts b/Mohem/src/app/notification/work-list-rfc/work-list-rfc.component.spec.ts new file mode 100644 index 00000000..04cb6bbb --- /dev/null +++ b/Mohem/src/app/notification/work-list-rfc/work-list-rfc.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { WorkListRfcComponent } from './work-list-rfc.component'; + +describe('WorkListRfcComponent', () => { + let component: WorkListRfcComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ WorkListRfcComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(WorkListRfcComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); 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 new file mode 100644 index 00000000..a61b7aed --- /dev/null +++ b/Mohem/src/app/notification/work-list-rfc/work-list-rfc.component.ts @@ -0,0 +1,156 @@ +import { WorklistMainService } from './../service/work-list.main.service'; +import { Component, OnInit } from '@angular/core'; +import { WorkListActionHistoryRequest } from '../models/ActionHistoryReq'; +import { WorkListActionRequest } from '../models/NotificationActionReq'; +import { WorKListRFCEmployeeResponse } from '../models/RFC-EmployeeRes'; +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'; + +@Component({ + selector: 'app-work-list-rfc', + templateUrl: './work-list-rfc.component.html', + styleUrls: ['./work-list-rfc.component.scss'], +}) +export class WorkListRfcComponent implements OnInit { + + private WorkListActionHistoryObj: WorkListActionHistoryRequest; + private WorkListActionObj: WorkListActionRequest; + + getPassNotificationDetails: any; + RFCEmployeeListListRes: any; + radioButtonValue: any; + pageNum: number = 1; + seqNo: any; + //forwordTo:any; + IsReachEnd: boolean = false; + comments: any; + userNote: any; + getpassResAttr: any = []; + P_PAGE_NUM: number = 1; + P_PAGE_LIMIT: number = 50; + + constructor(public worklistService: WorklistService, private cs: CommonService, private ts: TranslatorService, public workListMainService: WorklistMainService) { + this.getPassNotificationDetails = this.cs.sharedService.getSharedData('passNotificationInfo'); + this.getpassResAttr = this.cs.sharedService.getSharedData('passResAttr'); + + this.WorkListActionHistoryObj = new WorkListActionHistoryRequest(); + this.WorkListActionHistoryObj.P_PAGE_NUM = this.P_PAGE_NUM; + this.WorkListActionHistoryObj.P_PAGE_LIMIT = this.P_PAGE_LIMIT; + this.WorkListActionHistoryObj.P_NOTIFICATION_ID = this.getPassNotificationDetails.NOTIFICATION_ID; + + this.WorkListActionObj = new WorkListActionRequest(); + this.WorkListActionObj.P_NOTIFICATION_ID = this.getPassNotificationDetails.NOTIFICATION_ID; + this.WorkListActionObj.P_FORWARD_TO_USER_NAME = ""; + this.WorkListActionObj.P_ACTION_MODE = ""; + this.WorkListActionObj.P_COMMENTS = ""; + this.WorkListActionObj.P_APPROVER_INDEX = null; + this.WorkListActionObj.RespondAttributeList = this.getpassResAttr; + } + + ngOnInit() { + this.getRFCEmployee(this.WorkListActionHistoryObj); + } + + getRFCEmployee(WorkListActionHistoryObj) { + this.IsReachEnd = false; + this.worklistService.getRFCEmployeeList(WorkListActionHistoryObj). + subscribe((result: WorKListRFCEmployeeResponse) => { + this.handleWorkListRFCEmployeeResult(result); + }); + } + + handleWorkListRFCEmployeeResult(result) { + + if (this.cs.validResponse(result)) { + if (this.cs.hasData(result.GetRFCEmployeeListList)) { + this.RFCEmployeeListListRes = result.GetRFCEmployeeListList; + this.P_PAGE_NUM++; + let lastItemIndex = this.RFCEmployeeListListRes.length - 1; + if (result.GetRFCEmployeeListList[lastItemIndex]) { + let lastitem = result.GetRFCEmployeeListList[lastItemIndex]; + if (lastitem.NO_OF_ROWS == lastitem.ROW_NUM) { + this.IsReachEnd = true; + } else { + this.IsReachEnd = false; + } + } + } + } + } + radioChecked(v) { + let emp: any = this.RFCEmployeeListListRes[v]; + this.seqNo = emp.SEQ; + this.radioButtonValue = emp.USER_NAME; + + } + + submitAction() { + if (this.radioButtonValue) { + if (this.userNote) { + this.WorkListActionObj.P_FORWARD_TO_USER_NAME = this.radioButtonValue; + this.WorkListActionObj.P_ACTION_MODE = "RFC"; + this.WorkListActionObj.P_COMMENTS = this.userNote;// response Attr + this.WorkListActionObj.P_APPROVER_INDEX = this.seqNo; + this.workListMainService.actionButton(this.WorkListActionObj). + subscribe((result: any) => { + this.handleApplayActionResult(result); + }); + } else { + 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", "msgRFC"); + this.cs.showErrorMessageDialog(() => { + }, this.ts.trPK('general', 'ok'), msg); + + } + } + + handleApplayActionResult(result) { + if (this.cs.validResponse(result)) { + if (result.MessageStatus == 1) { + // let msg:string=""; + // msg=this.translate.translate("general.success"); + // this.common.showAlert(msg); + // this.navCtrl.push("HomePage"); + this.cs.openHome(); + } + } // valid it + } + + doInfinite(infiniteScroll) { + if (!this.IsReachEnd) { + this.WorkListActionHistoryObj.P_PAGE_NUM = this.P_PAGE_NUM; + this.worklistService.getRFCEmployeeList(this.WorkListActionHistoryObj). + subscribe((result) => { + if (this.cs.validResponse(result)) { + if (result.RFCEmployeeList != undefined) { + this.P_PAGE_NUM++ + (result.RFCEmployeeList).forEach(element => { + if (element.ROW_NUM == element.NO_OF_ROWS) { + this.IsReachEnd = true; + } + else { + this.IsReachEnd = false; + } + //this.WorkListResObj.push(element); + }); + }// if list length >0 + else { + this.IsReachEnd = true; + } + }// if response == 1 + //this.pageNum++; + infiniteScroll.target.complete(); + }); + } else { + if (infiniteScroll) + infiniteScroll.target.complete(); + } + }//end infiniteScroll + +} diff --git a/Mohem/src/assets/localization/i18n.json b/Mohem/src/assets/localization/i18n.json index 5f19c7b5..05c89c6f 100644 --- a/Mohem/src/assets/localization/i18n.json +++ b/Mohem/src/assets/localization/i18n.json @@ -1367,6 +1367,10 @@ "suppDoc": { "en": "Support Documents", "ar": "مستندات الدعم" + }, + "rfc": { + "en": "Return for correction", + "ar": "عودة لتصحيح" } }, "addAttach":{ @@ -1444,6 +1448,10 @@ "answer":{ "en": "Answer", "ar":"جواب" + }, + "msgRFC":{ + "en": "Select a person", + "ar":"اختيار شخص" } }, "worklist": { @@ -1502,6 +1510,10 @@ "search": { "en":"Search", "ar":"بحث" + }, + "note": { + "en":"Note", + "ar":"مذكرة" } } } \ No newline at end of file