diff --git a/Mohem/src/app/eit/eit-update-list/eit-update-list.component.html b/Mohem/src/app/eit/eit-update-list/eit-update-list.component.html new file mode 100644 index 00000000..5c562226 --- /dev/null +++ b/Mohem/src/app/eit/eit-update-list/eit-update-list.component.html @@ -0,0 +1,44 @@ + + + + {{'eit, update-title' | translate}} + + + + + + 0 "> + + + + {{'workListMain, notfDetails' | translate}} + + + + + + + + + + + {{notificationBody.SEGMENT_PROMPT}} + + + {{notificationBody.SEGMENT_VALUE_DSP}} + + + + + + + + + + + + {{ 'general, next' | translate }} + + \ No newline at end of file diff --git a/Mohem/src/app/eit/eit-update-list/eit-update-list.component.scss b/Mohem/src/app/eit/eit-update-list/eit-update-list.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/Mohem/src/app/eit/eit-update-list/eit-update-list.component.spec.ts b/Mohem/src/app/eit/eit-update-list/eit-update-list.component.spec.ts new file mode 100644 index 00000000..df56466e --- /dev/null +++ b/Mohem/src/app/eit/eit-update-list/eit-update-list.component.spec.ts @@ -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; + + 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(); + }); +}); diff --git a/Mohem/src/app/eit/eit-update-list/eit-update-list.component.ts b/Mohem/src/app/eit/eit-update-list/eit-update-list.component.ts new file mode 100644 index 00000000..7218ba91 --- /dev/null +++ b/Mohem/src/app/eit/eit-update-list/eit-update-list.component.ts @@ -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; + } + +} diff --git a/Mohem/src/app/eit/eit.module.ts b/Mohem/src/app/eit/eit.module.ts index 648bb042..0e823e56 100644 --- a/Mohem/src/app/eit/eit.module.ts +++ b/Mohem/src/app/eit/eit.module.ts @@ -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 diff --git a/Mohem/src/app/eit/services/eit.service.ts b/Mohem/src/app/eit/services/eit.service.ts index 37ab4bd0..c88b7401 100644 --- a/Mohem/src/app/eit/services/eit.service.ts +++ b/Mohem/src/app/eit/services/eit.service.ts @@ -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 { + const request = eit; + this.authService.authenticateRequest(request); + return this.con.post(EitService.resubmitEit, request, onError, errorLabel); + } + }