EIT Forms implementation In-Progress
parent
a3d58d4b1c
commit
700d871dca
@ -0,0 +1,25 @@
|
||||
<ion-header>
|
||||
<ion-toolbar class="header-toolbar">
|
||||
<nav-buttons></nav-buttons>
|
||||
<ion-title color="light">{{headerTitle}}</ion-title>
|
||||
|
||||
<ion-buttons *ngIf="getPassdirfromNotifiPage == true" 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 #containerDiv id="containerDiv">
|
||||
</div>
|
||||
</ion-content>
|
||||
|
||||
<ion-footer>
|
||||
<div class="centerDiv">
|
||||
<ion-button class="footer-button" color="customnavy" ion-button (click)="validateEITTransaction()">
|
||||
{{'vacation-rule, next-label' | translate}}</ion-button>
|
||||
</div>
|
||||
</ion-footer>
|
||||
@ -0,0 +1,7 @@
|
||||
.footer-button {
|
||||
border-radius: 2px;
|
||||
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 { AddEitComponent } from './add-eit.component';
|
||||
|
||||
describe('AddEitComponent', () => {
|
||||
let component: AddEitComponent;
|
||||
let fixture: ComponentFixture<AddEitComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ AddEitComponent ],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AddEitComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,3 @@
|
||||
<p>
|
||||
confirm-add-eit works!
|
||||
</p>
|
||||
@ -0,0 +1,27 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ConfirmAddEitComponent } from './confirm-add-eit.component';
|
||||
|
||||
describe('ConfirmAddEitComponent', () => {
|
||||
let component: ConfirmAddEitComponent;
|
||||
let fixture: ComponentFixture<ConfirmAddEitComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ConfirmAddEitComponent ],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ConfirmAddEitComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,14 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-confirm-add-eit',
|
||||
templateUrl: './confirm-add-eit.component.html',
|
||||
styleUrls: ['./confirm-add-eit.component.scss'],
|
||||
})
|
||||
export class ConfirmAddEitComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {}
|
||||
|
||||
}
|
||||
@ -0,0 +1,118 @@
|
||||
<ion-header>
|
||||
<ion-toolbar class="header-toolbar">
|
||||
<nav-buttons></nav-buttons>
|
||||
<ion-title color="light">{{headerTitle}}</ion-title>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content padding>
|
||||
|
||||
<div *ngIf="eitAddedList && eitAddedList.length > 0 ">
|
||||
<ion-card *ngFor="let eitAddedObj of eitAddedList; let i=index ">
|
||||
|
||||
<ion-card-header>
|
||||
|
||||
<!-- <button *ngIf="getPassMnuEntryObj.UPDATE_BUTTON == 'Y' && eitAddedObj.statusID!=2" ion-button icon-only
|
||||
(click)="updateEITRrq(i)">
|
||||
<ion-icon name="create"></ion-icon>
|
||||
</button> -->
|
||||
<button ion-button icon-only (click)="removeAddedItem(i)">
|
||||
<ion-icon name="trash"></ion-icon>
|
||||
</button>
|
||||
|
||||
</ion-card-header>
|
||||
<ion-card-content>
|
||||
|
||||
<ion-grid>
|
||||
<div>
|
||||
<ion-row>
|
||||
<ion-col class="colBold">
|
||||
<label for="">{{"confirmAddEit.status" | translate}}</label>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<label for="">{{eitAddedObj.status}}</label>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</div>
|
||||
<div *ngFor="let item of eitAddedObj.Collection_Transaction">
|
||||
<ion-row *ngIf="item.DISPLAY_FLAG != 'N' ">
|
||||
<ion-col class="colBold">
|
||||
<label for="">{{item.SEGMENT_PROMPT}}</label>
|
||||
</ion-col>
|
||||
<ion-col class="colBold">
|
||||
<label for="">{{item.SEGMENT_VALUE_DSP}}</label>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</div>
|
||||
|
||||
</ion-grid>
|
||||
</ion-card-content>
|
||||
</ion-card>
|
||||
</div>
|
||||
<div class="no-dataDiv"
|
||||
*ngIf="!getResEITTransactionList || getResEITTransactionList[0]?.Collection_Transaction.length <= 0">
|
||||
<!-- <div class="no-dataDiv"> -->
|
||||
<ion-row>
|
||||
<img class="empty-data" src="../assets/imgs/noData.png" />
|
||||
</ion-row>
|
||||
<h4> {{'general.noData' | translate}}</h4>
|
||||
</div>
|
||||
<!-- <no-data *ngIf="!getResEITTransactionList || getResEITTransactionList[0]?.Collection_Transaction.length <= 0" txt="{{'general.noData' | translate}}"></no-data> -->
|
||||
<!-- <div *ngIf="getResEITTransactionList && getResEITTransactionList[0]?.Collection_Transaction.length > 0 "> -->
|
||||
<div>
|
||||
<ion-card *ngFor="let EITTransactionList of getResEITTransactionList; let i=index ">
|
||||
|
||||
<ion-card-header class="boxHdr">
|
||||
<div class="hrTitle">{{this.headerTitle}}</div>
|
||||
|
||||
<button ion-button (click)="deleteEIT(i)"
|
||||
*ngIf="getPassMnuEntryObj.DELETE_BUTTON == 'Y' && EITTransactionList.statusID!=3">
|
||||
<img class="imgSize" src="../assets/imgs/delete.png"></button>
|
||||
<button ion-button *ngIf="getPassMnuEntryObj.UPDATE_BUTTON == 'Y' && EITTransactionList.statusID!=2"
|
||||
(click)="updateEITRrq(i)">
|
||||
<img class="imgSize" src="../assets/imgs/edit.png"></button>
|
||||
</ion-card-header>
|
||||
<ion-card-content>
|
||||
|
||||
|
||||
<ion-grid>
|
||||
<div>
|
||||
<ion-row>
|
||||
<ion-col class="colBold">
|
||||
<label for="">status</label>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<label for="">{{EITTransactionList.status}}</label>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</div>
|
||||
<div *ngFor="let item of EITTransactionList.Collection_Transaction">
|
||||
<ion-row *ngIf="item.DISPLAY_FLAG != 'N' ">
|
||||
<ion-col class="colBold">
|
||||
<label for="">{{item.SEGMENT_PROMPT}}</label>
|
||||
</ion-col>
|
||||
<ion-col>
|
||||
<label for="">{{item.SEGMENT_VALUE_DSP}}</label>
|
||||
</ion-col>
|
||||
</ion-row>
|
||||
</div>
|
||||
|
||||
</ion-grid>
|
||||
</ion-card-content>
|
||||
</ion-card>
|
||||
|
||||
</div>
|
||||
<ion-infinite-scroll (ionInfinite)="doInfinite($event)">
|
||||
<ion-infinite-scroll-content></ion-infinite-scroll-content>
|
||||
</ion-infinite-scroll>
|
||||
|
||||
</ion-content>
|
||||
|
||||
<ion-footer>
|
||||
<div class="centerDiv">
|
||||
<!-- <button *ngIf="getPassMnuEntryObj.ADD_BUTTON == 'Y'" ion-button (click)="addEITRrq()">{{'requestEit.add'
|
||||
| translate}} </button> -->
|
||||
<ion-button class="footer-button" color="customnavy" ion-button (click)="addEITRrq()">
|
||||
{{'general, add' | translate}}</ion-button>
|
||||
</div>
|
||||
</ion-footer>
|
||||
@ -0,0 +1,6 @@
|
||||
.footer-button {
|
||||
border-radius: 2px;
|
||||
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 { EitListComponent } from './eit-list.component';
|
||||
|
||||
describe('EitListComponent', () => {
|
||||
let component: EitListComponent;
|
||||
let fixture: ComponentFixture<EitListComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EitListComponent ],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(EitListComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,457 @@
|
||||
import { AddEitComponent } from './../add-eit/add-eit.component';
|
||||
import { ModalController } from '@ionic/angular';
|
||||
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
|
||||
import { EitRequest } from './../models/eit.request';
|
||||
import { EITTransactionsRequest } from './../models/EITTransactionsReq';
|
||||
import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { EitService } from '../services/eit.service';
|
||||
import { EIT_ACTION } from '../models/submit.eit.action';
|
||||
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
|
||||
import { AddEitResponse } from '../models/add.eit.response';
|
||||
|
||||
@Component({
|
||||
selector: 'app-eit-list',
|
||||
templateUrl: './eit-list.component.html',
|
||||
styleUrls: ['./eit-list.component.scss'],
|
||||
})
|
||||
export class EitListComponent implements OnInit {
|
||||
|
||||
P_PAGE_NUM: number;
|
||||
P_PAGE_LIMIT: number;
|
||||
IsReachEnd: boolean = false;
|
||||
userName: any;
|
||||
isDelete: boolean = false;
|
||||
getResEITTransactionList: any = [];
|
||||
eitAddedList: any = [];
|
||||
getPassMnuEntryObj: any;
|
||||
selMenu: MenuResponse = new MenuResponse();
|
||||
//getMenuResponse :MenuResponse=new MenuResponse
|
||||
EITTransactionsListObj: EITTransactionsRequest = new EITTransactionsRequest();
|
||||
selEmp: string;
|
||||
respID: number;
|
||||
transactionNo: number = 0;
|
||||
menuType: string = "";
|
||||
private functionName: string = "";
|
||||
private eitRequest: EitRequest;
|
||||
private eitTransactionTbl: any = [];
|
||||
private validEitTransactionTbl: any = [];
|
||||
private desxFlexCode: string = "";
|
||||
private selectedIndex: number;
|
||||
private pAction: number = 0;
|
||||
public headerTitle: string = "";
|
||||
|
||||
constructor(private cs: CommonService, private EITService: EitService, private ts: TranslatorService, private modalCtrl: ModalController) {
|
||||
this.selMenu = this.cs.sharedService.getSharedData(MenuResponse.SHARED_DATA, false);
|
||||
this.selEmp = this.cs.sharedService.getSharedData(MenuResponse.SHARED_SEL_EMP, false);
|
||||
this.respID = this.cs.sharedService.getSharedData(MenuResponse.SHARED_SEL_RESP_ID, false);
|
||||
this.getPassMnuEntryObj = this.selMenu.GetMenuEntriesList;
|
||||
this.menuType = this.selMenu.List_Menu.MENU_TYPE;
|
||||
this.transactionNo = 0;
|
||||
this.functionName = this.getPassMnuEntryObj.FUNCTION_NAME;
|
||||
this.headerTitle = this.selMenu.GetMenuEntriesList.PROMPT;
|
||||
this.validEitTransactionTbl = [];
|
||||
this.P_PAGE_NUM = 1;
|
||||
this.P_PAGE_LIMIT = 50;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.getEITTransactions();
|
||||
}
|
||||
|
||||
getEITTransactions() {
|
||||
this.IsReachEnd = false;
|
||||
this.EITTransactionsListObj.P_PAGE_LIMIT = this.P_PAGE_LIMIT;
|
||||
this.EITTransactionsListObj.P_PAGE_NUM = this.P_PAGE_NUM;
|
||||
this.EITTransactionsListObj.P_SELECTED_EMPLOYEE_NUMBER = this.selEmp;
|
||||
this.EITTransactionsListObj.P_SELECTED_RESP_ID = this.respID;
|
||||
this.EITTransactionsListObj.P_MENU_TYPE = this.selMenu.List_Menu.MENU_TYPE;
|
||||
this.EITTransactionsListObj.P_FUNCTION_NAME = this.getPassMnuEntryObj.FUNCTION_NAME;
|
||||
this.EITService.getEITTransactionsList(this.EITTransactionsListObj).
|
||||
subscribe((result: any) => {
|
||||
this.handleEITTransactionsResult(result);
|
||||
});
|
||||
}
|
||||
|
||||
handleEITTransactionsResult(result) {
|
||||
if (this.cs.validResponse(result)) {
|
||||
if (this.cs.hasData(result.GetEITTransactionList)) {
|
||||
this.getResEITTransactionList = result.GetEITTransactionList;
|
||||
this.P_PAGE_NUM++;
|
||||
this.EITTransactionsListObj.P_PAGE_NUM = this.P_PAGE_NUM;
|
||||
let lastItemIndex = this.getResEITTransactionList.length - 1;
|
||||
if (result.GetEITTransactionList[lastItemIndex] && result.GetEITTransactionList[lastItemIndex].Collection_Transaction[0]) {
|
||||
let lastitem = result.GetEITTransactionList[lastItemIndex].Collection_Transaction[0];
|
||||
if (lastitem.NO_OF_ROWS == lastitem.ROW_NUM) {
|
||||
this.IsReachEnd = true;
|
||||
} else {
|
||||
this.IsReachEnd = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
doInfinite(infiniteScroll) {
|
||||
if (!this.IsReachEnd) {
|
||||
|
||||
this.EITService.getEITTransactionsList(this.EITTransactionsListObj).
|
||||
subscribe((result: any) => {
|
||||
if (this.cs.validResponse(result)) {
|
||||
if (this.cs.hasData(result.GetEITTransactionList)) {
|
||||
this.P_PAGE_NUM++;
|
||||
this.EITTransactionsListObj.P_PAGE_NUM = this.P_PAGE_NUM;
|
||||
result.GetEITTransactionList.forEach(vr => {
|
||||
if (vr.Collection_Transaction[0].ROW_NUM == vr.Collection_Transaction[0].NO_OF_ROWS) {
|
||||
this.IsReachEnd = true;
|
||||
} else {
|
||||
this.IsReachEnd = false;
|
||||
}
|
||||
this.getResEITTransactionList.push(vr);
|
||||
});
|
||||
} else {
|
||||
this.IsReachEnd = true;
|
||||
}
|
||||
}
|
||||
//this.P_PAGE_NUM++;
|
||||
if (infiniteScroll)
|
||||
infiniteScroll.target.complete();
|
||||
}, (Error) => console.log(Error), () => infiniteScroll.target.complete());
|
||||
} else {
|
||||
if (infiniteScroll)
|
||||
infiniteScroll.target.complete();
|
||||
}
|
||||
}
|
||||
|
||||
addEITRrq(i) {
|
||||
this.pAction = EIT_ACTION.ADD;
|
||||
// this.sharedData.setSharedData(this.getResEITTransactionList[i].Collection_Transaction,EITTransactionsRequest.SHARED_DATA);
|
||||
this.cs.sharedService.setSharedData(this.pAction, EITTransactionsRequest.SUBMIT_EIT_ACTION);
|
||||
// this.navCtrl.push("AddEitPage");
|
||||
//this.openEit(i);
|
||||
this.openEitNew(i);
|
||||
}
|
||||
updateEITRrq(i) {
|
||||
this.pAction = EIT_ACTION.UPDATE;
|
||||
this.cs.sharedService.setSharedData(this.getResEITTransactionList[i].Collection_Transaction, EITTransactionsRequest.SHARED_DATA);
|
||||
this.cs.sharedService.setSharedData(this.pAction, EITTransactionsRequest.SUBMIT_EIT_ACTION);
|
||||
//this.fillEitTransactionTable(i);
|
||||
//this.navCtrl.push("AddEitPage");
|
||||
//this.openEit(i);
|
||||
this.openEitNew(i);
|
||||
}
|
||||
deleteEIT(i) {
|
||||
this.deleteEITRrq(i);
|
||||
// let alert=this.common.showConfirmMsg(this.translate.translate('requestEit.deleteReq'));
|
||||
// alert.onDidDismiss((data) => {
|
||||
// if(data==true){
|
||||
// this.deleteEITRrq(i);
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
deleteEITRrq(i) {
|
||||
let list: any = this.getResEITTransactionList[i];
|
||||
if (list.statusID != 2) {
|
||||
this.selectedIndex = i;
|
||||
// if(this.transactionNo==0)
|
||||
this.transactionNo++;
|
||||
this.pAction = EIT_ACTION.DELETE;
|
||||
//this.sharedData.setSharedData(this.getResEITTransactionList[i].Collection_Transaction,EITTransactionsRequest.SHARED_DATA);
|
||||
// this.sharedData.setSharedData(EIT_ACTION.DELETE,EITTransactionsRequest.SUBMIT_EIT_ACTION);
|
||||
this.fillEitTransactionTable(i);
|
||||
this.validateEITTransaction();
|
||||
// this.submitEit();
|
||||
//this.navCtrl.push("AddEitPage");
|
||||
} else {
|
||||
let msg: string = "";
|
||||
msg = this.ts.trPK("general", "attemptDel");
|
||||
this.cs.presentAlert(msg);
|
||||
|
||||
// alert("You are attempting to delete a row that has already been deleted.");
|
||||
}
|
||||
}
|
||||
openEitNew(index) {
|
||||
let item: any = [];
|
||||
if (this.pAction == EIT_ACTION.UPDATE)
|
||||
item = this.getResEITTransactionList[index].Collection_Transaction;
|
||||
this.transactionNo++;
|
||||
this.cs.sharedService.setSharedData({ dirfromNotificationPage: false, submitEITObjList: item, transNo: this.transactionNo }, 'AddEITData')
|
||||
this.cs.openAddEitPage();
|
||||
// this.navCtrl.push('AddEitPage', { dirfromNotificationPage: false, submitEITObjList: item, transNo: this.transactionNo });
|
||||
}
|
||||
async openEit(index) {
|
||||
let item: any = [];
|
||||
if (this.pAction == EIT_ACTION.UPDATE)
|
||||
item = this.getResEITTransactionList[index].Collection_Transaction;
|
||||
this.transactionNo++;
|
||||
this.cs.sharedService.setSharedData({ dirfromNotificationPage: false, submitEITObjList: item, transNo: this.transactionNo }, 'AddEITData')
|
||||
const modalPage = await this.modalCtrl.create({
|
||||
component: AddEitComponent
|
||||
});
|
||||
// modalPage.present();
|
||||
|
||||
modalPage.onDidDismiss()
|
||||
.then((data: any) => {
|
||||
if (data) {
|
||||
// this.transactionNo++;
|
||||
//this.updatedData=this.updatedData?this.updatedData.concat(data.updated):data.updated;
|
||||
// this.notificationBodyRes[index].Collection_Transaction=data.updated;
|
||||
this.selectedIndex = index;
|
||||
this.desxFlexCode = data.eitRequest.P_DESC_FLEX_CONTEXT_CODE;
|
||||
if (this.pAction == EIT_ACTION.ADD) {
|
||||
index = this.eitAddedList.length + 1;
|
||||
let status = this.ts.trPK("eit", ".added");
|
||||
let statusID = EIT_ACTION.ADD;
|
||||
let obj = { status: status, statusID: statusID, Collection_Transaction: data.updated };
|
||||
this.eitAddedList.push(obj);
|
||||
} else {
|
||||
let status = this.ts.trPK("eit", ".updated");
|
||||
let statusID = EIT_ACTION.UPDATE;
|
||||
this.getResEITTransactionList[this.selectedIndex].status = status;
|
||||
this.getResEITTransactionList[this.selectedIndex].statusID = statusID;
|
||||
}
|
||||
this.updateTransactionList(data.eitRequest.EITTransactionTBL, false);
|
||||
} else {
|
||||
if (this.transactionNo != 0)
|
||||
this.transactionNo--;
|
||||
}
|
||||
});
|
||||
|
||||
modalPage.present();
|
||||
// modalPage.onDidDismiss(data => {
|
||||
// if (data) {
|
||||
// // this.transactionNo++;
|
||||
// //this.updatedData=this.updatedData?this.updatedData.concat(data.updated):data.updated;
|
||||
// // this.notificationBodyRes[index].Collection_Transaction=data.updated;
|
||||
// this.selectedIndex = index;
|
||||
// this.desxFlexCode = data.eitRequest.P_DESC_FLEX_CONTEXT_CODE;
|
||||
// if (this.pAction == EIT_ACTION.ADD) {
|
||||
// index = this.eitAddedList.length + 1;
|
||||
// let status = this.ts.trPK("eit", ".added");
|
||||
// let statusID = EIT_ACTION.ADD;
|
||||
// let obj = { status: status, statusID: statusID, Collection_Transaction: data.updated };
|
||||
// this.eitAddedList.push(obj);
|
||||
// } else {
|
||||
// let status = this.ts.trPK("eit", ".updated");
|
||||
// let statusID = EIT_ACTION.UPDATE;
|
||||
// this.getResEITTransactionList[this.selectedIndex].status = status;
|
||||
// this.getResEITTransactionList[this.selectedIndex].statusID = statusID;
|
||||
// }
|
||||
// this.updateTransactionList(data.eitRequest.EITTransactionTBL, false);
|
||||
// } else {
|
||||
// if (this.transactionNo != 0)
|
||||
// this.transactionNo--;
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
|
||||
}
|
||||
fillEitTransactionTable(index) {
|
||||
var obj = { peiObjVer: null, peiExtraInfoID: null };
|
||||
let list: any = this.getResEITTransactionList[index].Collection_Transaction;
|
||||
let valuseArr: any = [];
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
let item = list[i];
|
||||
if (item.APPLICATION_COLUMN_NAME != "PEI_ACTION" && item.APPLICATION_COLUMN_NAME != "PEI_EXTRA_INFO_ID" && item.APPLICATION_COLUMN_NAME != "PEI_OBJECT_VERSION_NUMBER") {
|
||||
this.desxFlexCode = item.DESC_FLEX_CONTEXT_CODE;
|
||||
if (item.DATE_VALUE == "") {
|
||||
item.DATE_VALUE = null;
|
||||
}
|
||||
valuseArr.push(
|
||||
{
|
||||
TRANSACTION_NUMBER: this.transactionNo,
|
||||
NAME: item.APPLICATION_COLUMN_NAME,
|
||||
VARCHAR2_VALUE: item.VARCHAR2_VALUE,
|
||||
NUMBER_VALUE: item.NUMBER_VALUE,
|
||||
DATE_VALUE: item.DATE_VALUE,
|
||||
}
|
||||
)
|
||||
} else {
|
||||
if (item.APPLICATION_COLUMN_NAME == "PEI_OBJECT_VERSION_NUMBER")
|
||||
obj.peiObjVer = item.NUMBER_VALUE;
|
||||
else if (item.APPLICATION_COLUMN_NAME == "PEI_EXTRA_INFO_ID")
|
||||
obj.peiExtraInfoID = item.NUMBER_VALUE;
|
||||
}
|
||||
|
||||
}// end for
|
||||
//}
|
||||
valuseArr = this.fillExtraInformation(valuseArr, "DELETE_ROW", obj.peiExtraInfoID, obj.peiObjVer, this.transactionNo);
|
||||
this.eitTransactionTbl = valuseArr;
|
||||
}
|
||||
|
||||
fillExtraInformation(values: any, peiAction: string, peiExtraInfoID: number, peiObjVer: number, transNo: number): any {
|
||||
values.push(
|
||||
{
|
||||
TRANSACTION_NUMBER: transNo,
|
||||
NAME: "PEI_ACTION",
|
||||
VARCHAR2_VALUE: peiAction,
|
||||
NUMBER_VALUE: null,
|
||||
DATE_VALUE: null
|
||||
});
|
||||
values.push(
|
||||
{
|
||||
TRANSACTION_NUMBER: transNo,
|
||||
NAME: "PEI_EXTRA_INFO_ID",
|
||||
VARCHAR2_VALUE: null,
|
||||
NUMBER_VALUE: peiExtraInfoID,
|
||||
DATE_VALUE: null
|
||||
});
|
||||
values.push(
|
||||
{
|
||||
TRANSACTION_NUMBER: transNo,
|
||||
NAME: "PEI_OBJECT_VERSION_NUMBER",
|
||||
VARCHAR2_VALUE: null,
|
||||
NUMBER_VALUE: peiObjVer,
|
||||
DATE_VALUE: null
|
||||
});
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
submitEit() {
|
||||
this.eitRequest = new EitRequest();
|
||||
let list: any = this.fixTransactionNo();
|
||||
this.eitRequest.EITTransactionTBL = list;
|
||||
this.eitRequest.P_SELECTED_EMPLOYEE_NUMBER = this.selEmp;
|
||||
this.eitRequest.P_MENU_TYPE = this.menuType;
|
||||
this.eitRequest.P_SELECTED_RESP_ID = this.respID;//this.selMenu.List_Menu.RESP_ID,//-999,
|
||||
this.eitRequest.P_FUNCTION_NAME = this.functionName;
|
||||
this.eitRequest.P_DESC_FLEX_CONTEXT_CODE = this.desxFlexCode;
|
||||
|
||||
this.EITService.submitEit(this.eitRequest).subscribe((result: AddEitResponse) => {
|
||||
this.handleSubmitEitResult(result);
|
||||
});
|
||||
}
|
||||
handleSubmitEitResult(result) {
|
||||
if (this.cs.validResponse(result)) {
|
||||
this.cs.sharedService.setSharedData(this.eitRequest, EitRequest.SHARED_DATA);
|
||||
this.cs.sharedService.setSharedData(result, AddEitResponse.SHARED_DATA);
|
||||
//this.addrespList=result.SubmitEITTransactionList;
|
||||
// this.itemKey=this.addrespList.P_ITEM_KEY;
|
||||
// this.P_TransactionID=result.SubmitEITTransactionList.P_TRANSACTION_ID;
|
||||
// this.sharedData.setSharedData(result,AddEitResponse.SHARED_DATA);
|
||||
|
||||
// // this.sharedData.setSharedData(result.SubmitEITTransactionList.P_TRANSACTION_ID,"TransactionIDResubmit");
|
||||
// // this.sharedData.setSharedData(this.eitRequest,EitRequest.SHARED_DATA);
|
||||
this.cs.sharedService.setSharedData({ isResubmit: false, isDelete: this.isDelete }, 'confirmAddEITData')
|
||||
this.cs.openConfirmEitPage();
|
||||
// this.navCtrl.push("ConfirmAddEitPage", { isResubmit: false, isDelete: this.isDelete });
|
||||
}
|
||||
}
|
||||
validateEITTransaction() {
|
||||
this.isDelete = false;
|
||||
this.eitRequest = {
|
||||
P_SELECTED_EMPLOYEE_NUMBER: this.selEmp,
|
||||
P_MENU_TYPE: this.menuType,
|
||||
P_SELECTED_RESP_ID: this.respID,
|
||||
P_FUNCTION_NAME: this.functionName,
|
||||
P_DESC_FLEX_CONTEXT_CODE: this.desxFlexCode,
|
||||
EITTransactionTBL: this.eitTransactionTbl
|
||||
}
|
||||
|
||||
this.EITService.validateEITTransaction(this.eitRequest).subscribe((result: any) => {
|
||||
this.handleEITValidateTr(result);
|
||||
});
|
||||
}
|
||||
private handleEITValidateTr(result) {
|
||||
if (this.cs.validResponse(result)) {
|
||||
// public static SHARED_DATA = 'login-request';
|
||||
//this.sharedData.setSharedData(this.eitRequest, EitRequest.SHARED_DATA);
|
||||
let status = this.ts.trPK("eit", ".deleted");
|
||||
let statusID = EIT_ACTION.DELETE;
|
||||
this.isDelete = true;
|
||||
this.getResEITTransactionList[this.selectedIndex].status = status;
|
||||
this.getResEITTransactionList[this.selectedIndex].statusID = statusID;
|
||||
this.updateTransactionList(this.eitTransactionTbl, false);
|
||||
this.submitEit();
|
||||
} else {
|
||||
if (this.transactionNo != 0)
|
||||
this.transactionNo--;
|
||||
}
|
||||
}
|
||||
updateTransactionList(list, isRemove) {
|
||||
//let newlist = this.validEitTransactionTbl.map(a => a.NAME='PEI_EXTRA_INFO_ID');
|
||||
let isAnewRow: boolean = false;
|
||||
let updateDelTransNo: number;
|
||||
if (this.cs.hasData(this.validEitTransactionTbl)) {
|
||||
this.validEitTransactionTbl.forEach(element => {
|
||||
if (element.NAME == 'PEI_EXTRA_INFO_ID') {
|
||||
if (element.NUMBER_VALUE == -1) {
|
||||
isAnewRow = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
list.forEach(element => {
|
||||
// NAME=PEI_EXTRA_INFO_ID
|
||||
//const index = this.validEitTransactionTbl.findIndex(x => x.TRANSACTION_NUMBER === element.TRANSACTION_NUMBER);
|
||||
// let newlist = this.validEitTransactionTbl.map(a => a.NAME==='PEI_EXTRA_INFO_ID');
|
||||
if (isAnewRow == true) {
|
||||
let index: number = this.validEitTransactionTbl.findIndex(x => x.TRANSACTION_NUMBER === element.TRANSACTION_NUMBER);
|
||||
//if(index!=-1)
|
||||
//this.validEitTransactionTbl.splice(index, 1);
|
||||
} else {
|
||||
let index: number = this.validEitTransactionTbl.findIndex(x => x.NAME === 'PEI_EXTRA_INFO_ID' && x.NUMBER_VALUE === element.NUMBER_VALUE);
|
||||
if (index != -1) {
|
||||
//this.validEitTransactionTbl.splice(index, 1);
|
||||
if (!updateDelTransNo)
|
||||
updateDelTransNo = this.validEitTransactionTbl[index].TRANSACTION_NUMBER;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
if (updateDelTransNo)
|
||||
this.removeItems(updateDelTransNo);
|
||||
if (isRemove == false)
|
||||
this.validEitTransactionTbl = this.validEitTransactionTbl ? this.validEitTransactionTbl.concat(list) : list;
|
||||
}
|
||||
|
||||
fixTransactionNo(): any[] {
|
||||
let list: any = [];
|
||||
let newIndex: number = 1;
|
||||
let length: number = this.validEitTransactionTbl.length;
|
||||
for (let i = 0; i < length; i++) {
|
||||
// let item :any={};
|
||||
const item = Object.assign({}, this.validEitTransactionTbl[i]);
|
||||
let transNo: number = item.TRANSACTION_NUMBER;
|
||||
let obj: any = item;
|
||||
if (i == 0) {
|
||||
obj.TRANSACTION_NUMBER = newIndex;
|
||||
list.push(obj);
|
||||
} else {
|
||||
let prevEl: any = this.validEitTransactionTbl[i - 1].TRANSACTION_NUMBER;
|
||||
if (transNo == prevEl) {
|
||||
obj.TRANSACTION_NUMBER = newIndex;
|
||||
list.push(obj);
|
||||
} else {
|
||||
newIndex++;
|
||||
obj.TRANSACTION_NUMBER = newIndex;
|
||||
list.push(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
removeItems(transNo) {
|
||||
let list = [];
|
||||
for (let i = 0; i < this.validEitTransactionTbl.length; i++) {
|
||||
if (this.validEitTransactionTbl[i].TRANSACTION_NUMBER != transNo)
|
||||
list.push(this.validEitTransactionTbl[i]);
|
||||
}
|
||||
this.validEitTransactionTbl = list;
|
||||
}
|
||||
removeAddedItem(index) {
|
||||
let list = [];
|
||||
let item: any = [];
|
||||
for (let i = 0; i < this.eitAddedList.length; i++) {
|
||||
if (i != index)
|
||||
list.push(this.eitAddedList[i]);
|
||||
}
|
||||
item = this.eitAddedList[index];
|
||||
this.eitAddedList = list;
|
||||
this.removeItems(item.Collection_Transaction[0].TRANSACTION_NUMBER);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
import { Request } from '../../hmg-common/services/models/request';
|
||||
|
||||
export class EITTransactionsRequest extends Request{
|
||||
public static SUBMIT_EIT_ACTION='submit-eit-action';
|
||||
public static SHARED_DATA='submit_eit_obj';
|
||||
public P_PAGE_NUM : Number;
|
||||
public P_PAGE_LIMIT : Number;
|
||||
public P_MENU_TYPE:String;
|
||||
public P_SELECTED_EMPLOYEE_NUMBER:String;
|
||||
public P_FUNCTION_NAME:String;
|
||||
public P_SELECTED_RESP_ID : Number;
|
||||
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
import { Response } from '../../hmg-common/services/models/response';
|
||||
import { EitRespModel } from './eit.response.model'
|
||||
|
||||
export class AddEitResponse extends Response {
|
||||
public static SHARED_DATA = 'add-eit-response';
|
||||
SubmitEITTransactionList: EitRespModel;
|
||||
}
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
import { EitTransactionModel } from './eit.transaction.model';
|
||||
|
||||
export class EitRequest {
|
||||
public static SHARED_DATA = 'eit-request';
|
||||
public P_MENU_TYPE: string;
|
||||
public P_SELECTED_EMPLOYEE_NUMBER: string;
|
||||
public P_FUNCTION_NAME: string;
|
||||
public P_SELECTED_RESP_ID: Number;
|
||||
P_DESC_FLEX_CONTEXT_CODE: string;
|
||||
EITTransactionTBL: EitTransactionModel[];
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
export class EitRespModel {
|
||||
P_ITEM_KEY: string;
|
||||
P_RETURN_MSG:string;
|
||||
P_RETURN_STATUS:string;
|
||||
P_TRANSACTION_ID:number;
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
export class EitTransactionModel {
|
||||
TRANSACTION_NUMBER: number;
|
||||
NUMBER_VALUE: number;
|
||||
NAME: string;
|
||||
DATE_VALUE: string;
|
||||
VARCHAR2_VALUE: string;
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
// tslint:disable-next-line:class-name
|
||||
export enum EIT_ACTION {
|
||||
ADD = 1,
|
||||
DELETE = 2,
|
||||
UPDATE=3
|
||||
}
|
||||
Loading…
Reference in New Issue