View Note Modal, Work List RFC & View Replacement Modal Implemented

MOE_DEV_NEW_TEMPORARY_DESIGN
haroon amjad 6 years ago
parent f07de65e5c
commit 61275a4c85

@ -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]

@ -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<any> {
const request = ActionHistoryRequest;
this.authService.authenticateRequest(request);
return this.api.post(WorklistService.getRFCEmployeeList, request, onError, errorLabel);
}
}

@ -0,0 +1,17 @@
<ion-header>
<ion-toolbar class="header-toolbar">
<ion-title color="light">{{'worklist, note' | translate}}</ion-title>
<ion-buttons slot="primary">
<ion-button style="background: none !important;" (click)="closeModal()">
<ion-icon slot="icon-only" name="close"></ion-icon>
</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
<ion-content padding>
<div>
<p class="">{{getTextNote}}</p>
</div>
</ion-content>

@ -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<ViewNoteModalComponent>;
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();
});
});

@ -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();
}
}

@ -1,3 +1,46 @@
<p>
view-replacement-modal works!
</p>
<ion-content padding>
<!-- (ionChange)="radioChecked($event)" -->
<div>
<ion-grid style="padding-top: 30px;" class="btnGrid">
<ion-row>
<ion-col col-6 class="gridBtnCol">
<button ion-button class="gridBtn" (click)="closeBtnModal()">
{{'general, cancel' | translate}}
</button>
</ion-col>
<ion-col col-6 class="gridBtnCol">
<button ion-button class="gridBtn" (click)="OkBtnModal()">
{{'general. ok' | translate}}
</button>
</ion-col>
</ion-row>
</ion-grid>
<ion-list>
<!-- <ion-list-header>
Select a Person
</ion-list-header> -->
<ion-radio-group>
<ion-item *ngFor="let RepList of getRepList">
<!-- <ion-col> -->
<ion-label>{{RepList.USER_NAME}}</ion-label>
<ion-label>{{RepList.EMPLOYEE_DISPLAY_NAME}}</ion-label>
<ion-label>{{RepList.EMAIL_ADDRESS}}</ion-label>
<ion-radio value="{{RepList.USER_NAME}}" (ionSelect)="radioSelect(RepList)"></ion-radio>
<!-- <ion-radio (ionSelect)="select(item)" [value]="item"></ion-radio> -->
<!-- </ion-col> -->
</ion-item>
</ion-radio-group>
</ion-list>
<ion-infinite-scroll (ionInfinite)="doInfinite($event)">
<ion-infinite-scroll-content></ion-infinite-scroll-content>
</ion-infinite-scroll>
</div>
</ion-content>

@ -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;
}

@ -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
}

@ -12,9 +12,9 @@
<ion-label class="boldTxtNav">{{'replacementRoll, searchBy' | translate}}</ion-label>
<ion-select okText='{{"general.ok" | translate }}' cancelText='{{"general.cancel" | translate }}'
[(ngModel)]="searchBy">
<ion-option value="1" selected="true">{{'addAttach, name' | translate}}</ion-option>
<ion-option value="2">{{'login, username' | translate}}</ion-option>
<ion-option value="3">{{'general, email' | translate}}</ion-option>
<ion-select-option value="1" selected="true">{{'addAttach, name' | translate}}</ion-select-option>
<ion-select-option value="2">{{'login, username' | translate}}</ion-select-option>
<ion-select-option value="3">{{'general, email' | translate}}</ion-select-option>
</ion-select>
</ion-item>
<ion-item>

@ -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();
}
}

@ -0,0 +1,39 @@
<ion-header>
<ion-toolbar class="header-toolbar">
<nav-buttons></nav-buttons>
<ion-title color="light">{{ 'workListMain, rfc' | translate}}</ion-title>
</ion-toolbar>
</ion-header>
<ion-content padding>
<div class="tipsPadding boldTxtNav">
{{"replacementRoll.msgRFC" | translate}}
</div>
<ion-list (ionChange)="radioChecked($event)" radio-group>
<ion-item *ngFor="let rfcEmployeeList of RFCEmployeeListListRes; let i = index;">
<ion-label>{{rfcEmployeeList.EMPLOYEE_DISPLAY_NAME}}</ion-label>
<ion-label>{{rfcEmployeeList.ACTION}}</ion-label>
<ion-radio value="{{i}}"></ion-radio>
</ion-item>
</ion-list>
<ion-infinite-scroll (ionInfinite)="doInfinite($event)">
<ion-infinite-scroll-content></ion-infinite-scroll-content>
</ion-infinite-scroll>
<div>
<label class="boldTxtNav">{{"replacementRoll.enterNote" | translate}}</label>
<ion-item>
<ion-textarea [(ngModel)]="userNote"></ion-textarea>
</ion-item>
</div>
</ion-content>
<ion-footer>
<div class="centerDiv">
<ion-button class="footer-button" color="customnavy" ion-button (click)="submitAction()">
{{'general, submit' | translate}}</ion-button>
</div>
</ion-footer>

@ -0,0 +1,7 @@
.footer-button {
border-radius: 3px;
padding: 0 1.1em;
min-height: 45px;
min-width: 200px;
}

@ -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<WorkListRfcComponent>;
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();
});
});

@ -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
}

@ -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":"مذكرة"
}
}
}
Loading…
Cancel
Save