EIT Forms implementation In-Progress

production
haroon amjad 6 years ago
parent a3d58d4b1c
commit 700d871dca

@ -124,4 +124,5 @@
<variable name="GEOLOCATION_USAGE_DESCRIPTION" value="To fetch location for marking attendance" />
</plugin>
<plugin name="cordova-plugin-cszbar" spec="1.3.4" />
<plugin name="cordova-plugin-datepicker" spec="0.9.3" />
</widget>

@ -910,6 +910,14 @@
}
}
},
"@ionic-native/date-picker": {
"version": "5.9.0",
"resolved": "https://registry.npmjs.org/@ionic-native/date-picker/-/date-picker-5.9.0.tgz",
"integrity": "sha512-8h0+N7gRkYagi7z1xTDPCj6B2+MC2Gxgu1M4F+8krP3E296KIMSp8zsOlRt6c6KRgobCdDy55inhLCX2IIjR1Q==",
"requires": {
"@types/cordova": "^0.0.34"
}
},
"@ionic-native/device": {
"version": "5.8.0",
"resolved": "https://registry.npmjs.org/@ionic-native/device/-/device-5.8.0.tgz",
@ -3975,6 +3983,11 @@
"resolved": "https://registry.npmjs.org/cordova-plugin-cszbar/-/cordova-plugin-cszbar-1.3.4.tgz",
"integrity": "sha1-+0mTGSPjVjwNTJaVaawGAsXz62o="
},
"cordova-plugin-datepicker": {
"version": "0.9.3",
"resolved": "https://registry.npmjs.org/cordova-plugin-datepicker/-/cordova-plugin-datepicker-0.9.3.tgz",
"integrity": "sha1-JVipzlmY9tbcBs+S/Yu7nQkB8Wo="
},
"cordova-plugin-device": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/cordova-plugin-device/-/cordova-plugin-device-2.0.2.tgz",

@ -31,6 +31,7 @@
"@ionic-native/call-number": "^5.8.0",
"@ionic-native/camera": "^5.8.0",
"@ionic-native/core": "^5.8.0",
"@ionic-native/date-picker": "^5.9.0",
"@ionic-native/device": "^5.8.0",
"@ionic-native/diagnostic": "^5.8.0",
"@ionic-native/fingerprint-aio": "^5.8.0",
@ -70,6 +71,7 @@
"cordova-plugin-camera": "^4.0.3",
"cordova-plugin-compat": "^1.2.0",
"cordova-plugin-cszbar": "1.3.4",
"cordova-plugin-datepicker": "0.9.3",
"cordova-plugin-device": "2.0.2",
"cordova-plugin-dialogs": "^2.0.1",
"cordova-plugin-fingerprint-aio": "^1.7.0",
@ -190,7 +192,8 @@
},
"cordova-android-support-gradle-release": {
"ANDROID_SUPPORT_VERSION": "27.+"
}
},
"cordova-plugin-datepicker": {}
},
"platforms": [
"browser",

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

@ -1,3 +1,5 @@
import { ConfirmAddEitComponent } from './confirm-add-eit/confirm-add-eit.component';
import { AddEitComponent } from './add-eit/add-eit.component';
import { HmgCommonModule } from 'src/app/hmg-common/hmg-common.module';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
@ -8,6 +10,8 @@ import { IonicModule } from '@ionic/angular';
import { EITPage } from './eit.page';
import { HomeComponent } from './home/home.component';
import { EitListComponent } from './eit-list/eit-list.component';
import { DatePicker } from '@ionic-native/date-picker/ngx';
const routes: Routes = [
{
@ -17,6 +21,18 @@ const routes: Routes = [
{
path: 'homepage',
component: HomeComponent
},
{
path: 'eit-list',
component: EitListComponent
},
{
path: 'add-eit',
component: AddEitComponent
},
{
path: 'confirm-add-eit',
component: ConfirmAddEitComponent
}
]
}
@ -32,7 +48,13 @@ const routes: Routes = [
],
declarations: [
EITPage,
HomeComponent
HomeComponent,
EitListComponent,
AddEitComponent,
ConfirmAddEitComponent
],
providers: [
DatePicker
]
})
export class EITPageModule { }

@ -50,8 +50,7 @@ export class HomeComponent implements OnInit {
if (menuEntry.REQUEST_TYPE == 'ABSENCE') {
this.cs.openAbsencePage();
} else if (menuEntry.REQUEST_TYPE == 'EIT') {
// this.navCtrl.push('EitListPage');
this.cs.openEitListPage();
}
}

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

@ -1,7 +1,9 @@
import { EITTransactionsRequest } from './../models/EITTransactionsReq';
import { Observable } from 'rxjs';
import { Injectable } from '@angular/core';
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
import { ConnectorService } from 'src/app/hmg-common/services/connector/connector.service';
import { AddEitResponse } from '../models/add.eit.response';
@Injectable({
providedIn: 'root'
@ -10,6 +12,16 @@ export class EitService {
/* EIT Services URLs */
public static getMenuEntries = 'Services/ERP.svc/REST/GET_MENU_ENTRIES';
public static getEITTransctions = 'Services/ERP.svc/REST/GET_EIT_TRANSACTIONS';
public static getEITDFFStrutre = 'Services/ERP.svc/REST/GET_EIT_DFF_STRUCTURE';
public static getSetValue = 'Services/ERP.svc/REST/GET_VALUE_SET_VALUES';
public static getDefaultValue = 'Services/ERP.svc/REST/GET_DEFAULT_VALUE';
public static validateEITTransctions = 'Services/ERP.svc/REST/VALIDATE_EIT_TRANSACTION';
public static submitEit = 'Services/ERP.svc/REST/SUBMIT_EIT_TRANSACTION';
public static resubmitEit = 'Services/ERP.svc/REST/RESUBMIT_EIT_TRANSACTION';
public static startEitProcess = 'Services/ERP.svc/REST/START_EIT_APPROVAL_PROCESS';
public static updateAttach = 'Services/ERP.svc/REST/UPDATE_ATTACHMENT';
public static delteAttach = 'Services/ERP.svc/REST/DELETE_ATTACHMENT';
constructor(public authService: AuthenticationService, public con: ConnectorService) { }
@ -20,4 +32,41 @@ export class EitService {
return this.con.post(EitService.getMenuEntries, request, onError, errorLabel);
}
public getEITTransactionsList(EITTransactionsRequest: EITTransactionsRequest, onError?: any, errorLabel?: string): Observable<any> {
const request = EITTransactionsRequest;
this.authService.authenticateRequest(request);
return this.con.post(EitService.getEITTransctions, request, onError, errorLabel);
}
public submitEit(eit: any, onError?: any, errorLabel?: string): Observable<AddEitResponse> {
const request = eit;
request.EITTransactionTBLModel = eit.EITTransactionTBL;
this.authService.authenticateRequest(request);
return this.con.post(EitService.submitEit, request, onError, errorLabel);
}
public validateEITTransaction(validateEITTransactionReq: any, onError?: any, errorLabel?: string): Observable<any> {
const request = validateEITTransactionReq;
this.authService.authenticateRequest(request);
return this.con.post(EitService.validateEITTransctions, request, onError, errorLabel);
}
public getEITDFFStrutre(EITDFFStrutreReq: any, onError?: any, errorLabel?: string): Observable<any> {
const request = EITDFFStrutreReq;
this.authService.authenticateRequest(request);
return this.con.post(EitService.getEITDFFStrutre, request, onError, errorLabel);
}
public getSetValue(SetValueReq: any, onError?: any, errorLabel?: string): Observable<any> {
const request = SetValueReq;
this.authService.authenticateRequest(request);
return this.con.post(EitService.getSetValue, request, onError, errorLabel);
}
public getDefaultValue(DefaultValueReq: any, onError?: any, errorLabel?: string): Observable<any> {
const request = DefaultValueReq;
this.authService.authenticateRequest(request);
return this.con.post(EitService.getDefaultValue, request, onError, errorLabel);
}
}

@ -912,7 +912,16 @@ export class CommonService {
public openAbsencePage() {
this.nav.navigateForward(["/absence/home"]);
}
public openEitListPage() {
this.nav.navigateForward(["/eit/eit-list"]);
}
public openAddEitPage() {
this.nav.navigateForward(["/eit/add-eit"]);
}
public openConfirmEitPage() {
this.nav.navigateForward(["/eit/confirm-add-eit"]);
}
public reload(url: string, from: string) {
console.log("force reload called from:" + from);
// window.location.reload();
@ -1035,4 +1044,48 @@ export class CommonService {
return roots;
}
reverseFormatDate(date) {
let FormatedDate;
if (date) {
FormatedDate = date.replace(/\//g, '-');
FormatedDate = FormatedDate.replace(/ 00:00:00/g, '');
} else {
FormatedDate = date;
}
return FormatedDate;
}
reverseFormatStandardDate(date) {
let FormatedDate;
if (date) {
FormatedDate = date.replace(/\//g, '-');
//FormatedDate=FormatedDate+" 00:00:00"
} else {
FormatedDate = date;
}
return FormatedDate;
}
formatDate(date) {
let FormatedDate;
if (date) {
FormatedDate = date.replace(/-/g, '/');
FormatedDate = FormatedDate + " 00:00:00"
} else {
FormatedDate = date;
}
return FormatedDate;
}
formatStandardDate(date) {
let FormatedDate;
if (date) {
FormatedDate = date.replace(/-/g, '/');
} else {
FormatedDate = date;
}
//FormatedDate=FormatedDate+" 00:00:00"
return FormatedDate;
}
}

@ -9,8 +9,13 @@ export class Request {
public MobileType: string;
public BookedBy?: number;
public P_SESSION_ID: number;
public MobileNumber : string;
public LogInTokenID : string;
public P_USER_NAME:string;
public UserName:string;
public MobileNumber: string;
public LogInTokenID: string;
public P_USER_NAME: string;
public UserName: string;
public P_PASSWORD: string;
public P_MOBILE_NUMBER: string;
public P_EMAIL_ADDRESS: string;
public P_NOTIFICATION_ID: number;
}

@ -23,19 +23,19 @@ export class SelectInput extends UiElement {
if (this.disabled == "N") { this.disabled = "disabled" } else { this.disabled = "" }
if (this.hidden == "N") { this.hidden = "display:none;" } else { this.hidden = "" }
const template =
// "<div class='custom-text-area-element' style='" + this.hidden + "'>" +
// "<label class='daynamicForm-Label " + requiredClass + "' id='title' >" + this.label + "</label>" +
// "<select class='daynamicForm-Select' id='" + this.elementId + "' " + this.disabled + ">" +
// "<option value='" + this.value + "' >" + this.value + "</option>" +
// "</select>" +
// "</div> ";
"<div class='custom-text-area-element' style='" + this.hidden + "'>" +
"<label class='daynamicForm-Label " + requiredClass + "' id='title' >" + this.label + "</label>" +
"<select class='daynamicForm-Select' id='" + this.elementId + "' " + this.disabled + ">" +
"<option value='" + this.value + "' >" + this.value + "</option>" +
"</select>" +
"</div> ";
"<ion-item style='" + this.hidden + "'>" +
"<ion-label id='title' >" + this.label + "</ion-label>" +
"<ion-select id='" + this.elementId + "' " + this.disabled + ">" +
"<ion-select-option value='" + this.value + "' >" + this.value + "</ion-select-option>" +
"</ion-select>" +
"</ion-item> ";
// "<ion-item style='" + this.hidden + "'>" +
// "<ion-label id='title' >" + this.label + "</ion-label>" +
// "<ion-select id='" + this.elementId + "' " + this.disabled + ">" +
// "<ion-select-option value='" + this.value + "' >" + this.value + "</ion-select-option>" +
// "</ion-select>" +
// "</ion-item> ";
return template;
}

@ -672,6 +672,10 @@
"not-allowed": {
"en": "User has no permissions",
"ar": "المستخدم ليس لدية صلاحيات"
},
"attemptDel": {
"en": "You are attempting to delete a row that has already been deleted.",
"ar": "أنت تحاول حذف صف تم حذفه بالفعل."
}
},
"home": {
@ -1072,6 +1076,30 @@
"my-requests": {
"en": "My Requests",
"ar": "طلباتي"
},
"added": {
"en": "Added",
"ar": "وأضاف"
},
"updated": {
"en": "My Requests",
"ar": "محدث"
},
"deleted": {
"en": "Deleted",
"ar": "تم الحذف"
},
"deleteReq": {
"en": "Are you sure you want to delete this reuqest?",
"ar": "هل أنت متأكد أنك تريد حذف هذا الطلب؟"
},
"next": {
"en": "Next",
"ar": "التالى"
},
"update-title": {
"en": "Update",
"ar": "تحديث"
}
}
}
Loading…
Cancel
Save