EIT Update List page implemented

MOE_DEV_NEW_TEMPORARY_DESIGN
haroon amjad 6 years ago
parent 31af06d2c9
commit 57cf330cef

@ -0,0 +1,44 @@
<ion-header>
<ion-toolbar class="header-toolbar">
<nav-buttons></nav-buttons>
<ion-title color="light">{{'eit, update-title' | translate}}</ion-title>
</ion-toolbar>
</ion-header>
<ion-content padding>
<!-- <button ion-button (click)="resubmitEit()">next</button> -->
<div *ngIf="notificationBodyRes?.length > 0 ">
<ion-card *ngFor="let item of notificationBodyRes; let i=index ">
<ion-card-header class="hrTitle">
<div class="hrTitle">{{'workListMain, notfDetails' | translate}} </div>
<!-- <button ion-button icon-only *ngIf="item.Collection_Notification[0].ACTION!='DELETE_ROW'" (click)="updateEitNot(i)">
<ion-icon name="create"></ion-icon>
</button> -->
<button ion-button *ngIf="item.Collection_Notification[0].ACTION!='DELETE_ROW'" (click)="updateEitNot(i)">
<img class="imgSize" src="../assets/imgs/edit.png"></button>
</ion-card-header>
<ion-card-content>
<div *ngFor="let notificationBody of item.Collection_Notification ">
<ion-row *ngIf=" notificationBody.DISPLAY_FLAG != 'N' ">
<ion-col class="colBold">
<label for="">{{notificationBody.SEGMENT_PROMPT}}</label>
</ion-col>
<ion-col>
<label for="">{{notificationBody.SEGMENT_VALUE_DSP}}</label>
</ion-col>
</ion-row>
</div>
</ion-card-content>
</ion-card>
</div>
</ion-content>
<ion-footer>
<div class="centerDiv">
<ion-button class="footer-button" color="customnavy" ion-button (click)="resubmitEit()">
{{ 'general, next' | translate }}</ion-button>
</div>
</ion-footer>

@ -0,0 +1,27 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { EitUpdateListComponent } from './eit-update-list.component';
describe('EitUpdateListComponent', () => {
let component: EitUpdateListComponent;
let fixture: ComponentFixture<EitUpdateListComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EitUpdateListComponent ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(EitUpdateListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

@ -0,0 +1,125 @@
import { AddEitComponent } from './../add-eit/add-eit.component';
import { ModalController } from '@ionic/angular';
import { EitRequest } from './../models/eit.request';
import { Component, OnInit } from '@angular/core';
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
import { EITNotificatonBodyResponse } from '../models/EITNotificationBodyRes';
import { EitService } from '../services/eit.service';
@Component({
selector: 'app-eit-update-list',
templateUrl: './eit-update-list.component.html',
styleUrls: ['./eit-update-list.component.scss'],
})
export class EitUpdateListComponent implements OnInit {
public notificationBodyRes: any = {};
private updatedData: any = [];
private updatedItem: any;
private itemKey: string = "";
private notificationId: number;
private selEmp: string;
private functionName: string;
private eitTransactionTbl: any = [];
private eitRequest: EitRequest;
private descFlex: string;
constructor(public cs: CommonService, public eitService: EitService, public modalController: ModalController) {
this.notificationBodyRes = this.cs.sharedService.getSharedData(EITNotificatonBodyResponse.SHARED_DATA, true);
let notification = this.cs.sharedService.getSharedData(EITNotificatonBodyResponse.NOT_WORKLIST, true);
this.itemKey = notification.ITEM_KEY;
this.notificationId = notification.NOTIFICATION_ID;
this.functionName = notification.FUNCTION_NAME;
this.selEmp = notification.SELECTED_EMPLOYEE_NUMBER;
this.descFlex = notification.DESC_FLEX_CONTEXT_CODE;
this.fillEitTransactionTable();
}
ngOnInit() { }
async updateEitNot(index) {
let item = this.notificationBodyRes[index].Collection_Notification;
this.cs.sharedService.setSharedData({ dirfromNotificationPage: true, submitEITObjList: item }, 'AddEITData')
const modal = await this.modalController.create({
component: AddEitComponent
});
modal.onDidDismiss()
.then((data: any) => {
if (data) {
this.updatedData = this.updatedData ? this.updatedData.concat(data.updated) : data.updated;
this.notificationBodyRes[index].Collection_Notification = data.updated;
this.updateTransactionList(data.eitRequest.EITTransactionTBL);
}
});
return await modal.present();
}
updateTransactionList(list) {
list.forEach(element => {
const index = this.eitTransactionTbl.findIndex(x => x.TRANSACTION_NUMBER === element.TRANSACTION_NUMBER);
if (index != -1)
this.eitTransactionTbl.splice(index, 1);
});
this.eitTransactionTbl = this.eitTransactionTbl ? this.eitTransactionTbl.concat(list) : list;
}
resubmitEit() {
this.eitRequest = new EitRequest();
this.eitRequest.EITTransactionTBL = this.eitTransactionTbl;
this.eitRequest.P_SELECTED_EMPLOYEE_NUMBER = this.selEmp;
this.eitRequest.P_MENU_TYPE = "E";
this.eitRequest.P_SELECTED_RESP_ID = -999;
this.eitRequest.P_FUNCTION_NAME = this.functionName;
this.eitRequest.P_DESC_FLEX_CONTEXT_CODE = this.descFlex;
let body = {
P_NOTIFICATION_ID: this.notificationId,
P_ITEM_KEY: this.itemKey,
EITTransactionTBL: this.eitTransactionTbl
}
this.eitService.reSubmitEit(body).subscribe((result: any) => {
this.handleResubmitEit(result);
});
}
handleResubmitEit(result) {
if (this.cs.validResponse(result)) {
this.cs.sharedService.setSharedData(result.ResubmitEITTransactionList.P_TRANSACTION_ID, "TransactionIDResubmit");
this.cs.sharedService.setSharedData(this.eitRequest, EitRequest.SHARED_DATA);
this.cs.sharedService.setSharedData({ isResubmit: true }, 'confirmAddEITData');
this.cs.openConfirmEitPage();
}
}
fillEitTransactionTable() {
let valuseArr: any = [];
let varcharValue: any = null;
let numbervalue: any = 0;
let dateValue: any = null;
let transNo: number = 1;
let textValue = "";
// if(this.ExtraObj.transactionNo)
// transNo=this.ExtraObj.transactionNo;
for (let j = 0; j < this.notificationBodyRes.length; j++) {
let list = this.notificationBodyRes[j].Collection_Notification;
for (let i = 0; i < list.length; i++) {
let item = list[i];
varcharValue = null;
numbervalue = null;
dateValue = null;
valuseArr.push(
{
TRANSACTION_NUMBER: item.TRANSACTION_NUMBER,
NAME: item.APPLICATION_COLUMN_NAME,
VARCHAR2_VALUE: item.VARCHAR2_VALUE,
NUMBER_VALUE: item.NUMBER_VALUE,
DATE_VALUE: item.DATE_VALUE,
}
)
}// end for
}
this.eitTransactionTbl = valuseArr;
}
}

@ -12,6 +12,7 @@ import { HomeComponent } from './home/home.component';
import { EitListComponent } from './eit-list/eit-list.component';
import { DatePicker } from '@ionic-native/date-picker/ngx';
import { WorkListAttachViewComponent } from '../notification/work-list-attach-view/work-list-attach-view.component';
import { EitUpdateListComponent } from './eit-update-list/eit-update-list.component';
const routes: Routes = [
@ -38,6 +39,10 @@ const routes: Routes = [
{
path: 'add-attach',
component: AddAttachComponent
},
{
path: 'eit-update-list',
component: EitUpdateListComponent
}
]
}
@ -57,7 +62,8 @@ const routes: Routes = [
EitListComponent,
AddEitComponent,
ConfirmAddEitComponent,
AddAttachComponent
AddAttachComponent,
EitUpdateListComponent
],
entryComponents: [
WorkListAttachViewComponent

@ -121,4 +121,10 @@ export class EitService {
return this.con.post(EitService.updateAttach, request, onError, errorLabel);
}
public reSubmitEit(eit: any, onError?: any, errorLabel?: string): Observable<any> {
const request = eit;
this.authService.authenticateRequest(request);
return this.con.post(EitService.resubmitEit, request, onError, errorLabel);
}
}

Loading…
Cancel
Save