From 700d871dcaef2520551a29a5b8da41dd58f66993 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 9 Jul 2019 16:29:14 +0300 Subject: [PATCH] EIT Forms implementation In-Progress --- Mohem/config.xml | 1 + Mohem/package-lock.json | 13 + Mohem/package.json | 5 +- .../app/eit/add-eit/add-eit.component.html | 25 + .../app/eit/add-eit/add-eit.component.scss | 7 + .../app/eit/add-eit/add-eit.component.spec.ts | 27 + .../src/app/eit/add-eit/add-eit.component.ts | 1181 +++++++++++++++++ .../confirm-add-eit.component.html | 3 + .../confirm-add-eit.component.scss | 0 .../confirm-add-eit.component.spec.ts | 27 + .../confirm-add-eit.component.ts | 14 + .../app/eit/eit-list/eit-list.component.html | 118 ++ .../app/eit/eit-list/eit-list.component.scss | 6 + .../eit/eit-list/eit-list.component.spec.ts | 27 + .../app/eit/eit-list/eit-list.component.ts | 457 +++++++ Mohem/src/app/eit/eit.module.ts | 24 +- Mohem/src/app/eit/home/home.component.ts | 3 +- .../src/app/eit/models/EITTransactionsReq.ts | 13 + Mohem/src/app/eit/models/add.eit.response.ts | 8 + Mohem/src/app/eit/models/eit.request.ts | 11 + .../src/app/eit/models/eit.response.model.ts | 6 + .../app/eit/models/eit.transaction.model.ts | 7 + Mohem/src/app/eit/models/submit.eit.action.ts | 6 + Mohem/src/app/eit/services/eit.service.ts | 49 + .../services/common/common.service.ts | 55 +- .../app/hmg-common/services/models/request.ts | 13 +- Mohem/src/app/uI-elements/select.input.ts | 24 +- Mohem/src/assets/localization/i18n.json | 28 + 28 files changed, 2137 insertions(+), 21 deletions(-) create mode 100644 Mohem/src/app/eit/add-eit/add-eit.component.html create mode 100644 Mohem/src/app/eit/add-eit/add-eit.component.scss create mode 100644 Mohem/src/app/eit/add-eit/add-eit.component.spec.ts create mode 100644 Mohem/src/app/eit/add-eit/add-eit.component.ts create mode 100644 Mohem/src/app/eit/confirm-add-eit/confirm-add-eit.component.html create mode 100644 Mohem/src/app/eit/confirm-add-eit/confirm-add-eit.component.scss create mode 100644 Mohem/src/app/eit/confirm-add-eit/confirm-add-eit.component.spec.ts create mode 100644 Mohem/src/app/eit/confirm-add-eit/confirm-add-eit.component.ts create mode 100644 Mohem/src/app/eit/eit-list/eit-list.component.html create mode 100644 Mohem/src/app/eit/eit-list/eit-list.component.scss create mode 100644 Mohem/src/app/eit/eit-list/eit-list.component.spec.ts create mode 100644 Mohem/src/app/eit/eit-list/eit-list.component.ts create mode 100755 Mohem/src/app/eit/models/EITTransactionsReq.ts create mode 100755 Mohem/src/app/eit/models/add.eit.response.ts create mode 100755 Mohem/src/app/eit/models/eit.request.ts create mode 100755 Mohem/src/app/eit/models/eit.response.model.ts create mode 100755 Mohem/src/app/eit/models/eit.transaction.model.ts create mode 100755 Mohem/src/app/eit/models/submit.eit.action.ts diff --git a/Mohem/config.xml b/Mohem/config.xml index 64d2a539..c08cf311 100644 --- a/Mohem/config.xml +++ b/Mohem/config.xml @@ -124,4 +124,5 @@ + diff --git a/Mohem/package-lock.json b/Mohem/package-lock.json index fe8529b7..37b0624b 100644 --- a/Mohem/package-lock.json +++ b/Mohem/package-lock.json @@ -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", diff --git a/Mohem/package.json b/Mohem/package.json index afe1d725..4eef272b 100644 --- a/Mohem/package.json +++ b/Mohem/package.json @@ -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", diff --git a/Mohem/src/app/eit/add-eit/add-eit.component.html b/Mohem/src/app/eit/add-eit/add-eit.component.html new file mode 100644 index 00000000..dd6d7ef3 --- /dev/null +++ b/Mohem/src/app/eit/add-eit/add-eit.component.html @@ -0,0 +1,25 @@ + + + + {{headerTitle}} + + + + + + + + + + + +
+
+
+ + +
+ + {{'vacation-rule, next-label' | translate}} +
+
\ No newline at end of file diff --git a/Mohem/src/app/eit/add-eit/add-eit.component.scss b/Mohem/src/app/eit/add-eit/add-eit.component.scss new file mode 100644 index 00000000..44d1bc00 --- /dev/null +++ b/Mohem/src/app/eit/add-eit/add-eit.component.scss @@ -0,0 +1,7 @@ +.footer-button { + border-radius: 2px; + padding: 0 1.1em; + min-height: 45px; + min-width: 200px; + } + \ No newline at end of file diff --git a/Mohem/src/app/eit/add-eit/add-eit.component.spec.ts b/Mohem/src/app/eit/add-eit/add-eit.component.spec.ts new file mode 100644 index 00000000..ef4cc2f3 --- /dev/null +++ b/Mohem/src/app/eit/add-eit/add-eit.component.spec.ts @@ -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; + + 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(); + }); +}); diff --git a/Mohem/src/app/eit/add-eit/add-eit.component.ts b/Mohem/src/app/eit/add-eit/add-eit.component.ts new file mode 100644 index 00000000..1ef96c0d --- /dev/null +++ b/Mohem/src/app/eit/add-eit/add-eit.component.ts @@ -0,0 +1,1181 @@ +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +import { Component, OnInit, ViewChild, ElementRef } from '@angular/core'; +import { MenuEntry } from 'src/app/hmg-common/services/menu/models/menu.entry'; +import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response'; +import { EitRequest } from '../models/eit.request'; +import { ModalController } from '@ionic/angular'; +import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; +import { EITTransactionsRequest } from '../models/EITTransactionsReq'; +import { EitService } from '../services/eit.service'; +import { TextAreaInput } from 'src/app/uI-elements/text-area.input'; +import { NumberInput } from 'src/app/uI-elements/number.input'; +import { TextInput } from 'src/app/uI-elements/text.input'; +import { SelectInput } from 'src/app/uI-elements/select.input'; +import { DateInput } from 'src/app/uI-elements/date.input'; +import { TimeInput } from 'src/app/uI-elements/time.input'; +import { DateTimeInput } from 'src/app/uI-elements/date-time.input'; +import { ButtonInput } from 'src/app/uI-elements/button.input'; +import { HiddenInput } from 'src/app/uI-elements/hidden.input'; +import * as moment from 'moment'; +import { DatePicker } from '@ionic-native/date-picker/ngx'; +import { EIT_ACTION } from '../models/submit.eit.action'; +import { AddEitResponse } from '../models/add.eit.response'; + +@Component({ + selector: 'app-add-eit', + templateUrl: './add-eit.component.html', + styleUrls: ['./add-eit.component.scss'], +}) +export class AddEitComponent implements OnInit { + + @ViewChild('containerDiv') containerDiv: ElementRef; + + ////*new add*///// + getPassNotificationDetails: any; + getPassdirfromNotifiPage: boolean = false; + functionName: string = ""; + menuType: any; + ///////////////// + + private textArea: TextAreaInput; + private numberInput: NumberInput; + private textInput: TextInput; + private selectInput: SelectInput; + private dateInput: DateInput; + private timeInput: TimeInput; + private datetimeInput: DateTimeInput; + private buttonInput: ButtonInput; + private hiddenInput: HiddenInput; + private eitResponse: any; + + private eitVALSettoCall: any = []; + private comtransNo: number = 0; + // private parentChilds: any[]; + getPassMnuEntryObj: MenuEntry; + selMenu: MenuResponse; + eitSubmitAction: number = 0;//not submit + private eitRequest: EitRequest; + private validateEitObj: any = []; + private ExtraObj: any = {}; + private arrValues: any = []; + selEmp: string; + respID: number; + headerTitle: string = ""; + isResubmit: boolean = false; + //private updatedNotObject:any=[]; + private updatedValues: any = []; + addEITData: any; + + constructor(public modalController: ModalController, public cs: CommonService, private ts: TranslatorService, private eitService: EitService, public datePicker: DatePicker) { + this.selEmp = this.cs.sharedService.getSharedData(MenuResponse.SHARED_SEL_EMP, false); + this.respID = this.cs.sharedService.getSharedData(MenuResponse.SHARED_SEL_RESP_ID, false); + this.selMenu = new MenuResponse(); + this.selMenu = this.cs.sharedService.getSharedData(MenuResponse.SHARED_DATA, false); + this.addEITData = this.cs.sharedService.getSharedData("AddEITData", false); + + this.eitRequest = new EitRequest(); + + // this.buttonInput = new ButtonInput('btnSubmit', 'Submit', 'containerDiv', 'Y'); + + ////*new add*///// + /**********resubmit************ */ + // this.getPassNotificationDetails = this.cs.sharedService.getSharedData(EITNotificatonBodyResponse.NOT_WORKLIST, true); + this.getPassdirfromNotifiPage = this.addEITData.dirfromNotificationPage; + if (this.getPassdirfromNotifiPage) { + this.functionName = this.getPassNotificationDetails.FUNCTION_NAME;//;this.getPassNotificationDetails.NOTIFICATION_NAME; + this.menuType = "E"; + this.selEmp = this.getPassNotificationDetails.SELECTED_EMPLOYEE_NUMBER; + this.respID = -999; + this.validateEitObj = this.addEITData.submitEITObjList; + // this.eitSubmitAction=this.getPassNotificationDetails.EIT_ACTION; + let msg: string = ""; + msg = this.ts.trPK("eit", "update-title"); + this.headerTitle = msg; + } else { + this.getPassMnuEntryObj = this.selMenu.GetMenuEntriesList; + this.comtransNo = this.addEITData.transNo; + this.functionName = this.getPassMnuEntryObj.FUNCTION_NAME; + this.menuType = this.selMenu.List_Menu.MENU_TYPE; + this.validateEitObj = this.addEITData.submitEITObjList; + this.headerTitle = this.selMenu.GetMenuEntriesList.PROMPT; + this.eitSubmitAction = this.cs.sharedService.getSharedData(EITTransactionsRequest.SUBMIT_EIT_ACTION); + } + } + + ngOnInit() { + } + + ngAfterViewInit() { + console.log('ngAfterViewInit'); + // console.log(this.containerDiv.nativeElement); + this.getEitDffStructure(); + // this.addFieldToDOM(this.buttonInput, 'btnSubmit', this.cs.presentAlert('Clicked!'), true) + } + + private getEitDffStructure() { + const body = { + P_FUNCTION_NAME: this.functionName, + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, + P_MENU_TYPE: this.menuType, + P_SELECTED_RESP_ID: this.respID + // P_USER_NAME:this.userName + + } + this.eitService.getEITDFFStrutre(body).subscribe((result: any) => { + this.handleEitDffStructureResult(result); + }); + } + + handleEitDffStructureResult(result) { + if (result.GetEITDFFStructureList != null) { + this.eitResponse = result.GetEITDFFStructureList; + this.drawEitFields(result.GetEITDFFStructureList); + } + } + + private drawEitFields(feildsList) { + const containerId = 'containerDiv'; + this.eitVALSettoCall = []; + for (let i = 0; i < feildsList.length; i++) { + console.log(feildsList[i]); + let defaultVal: string = ""; + let defaultValText: string = ""; + defaultVal = feildsList[i].E_SERVICES_DV.P_ID_COLUMN_NAME ? feildsList[i].E_SERVICES_DV.P_ID_COLUMN_NAME : ""; + defaultValText = feildsList[i].E_SERVICES_DV.P_VALUE_COLUMN_NAME ? feildsList[i].E_SERVICES_DV.P_VALUE_COLUMN_NAME : ""; + + if (feildsList[i].DISPLAY_FLAG != "N") { //check if the field should be displayed + if (feildsList[i].VALIDATION_TYPE == "N") {//text , date , time + if (feildsList[i].FORMAT_TYPE == "C") {// character + // if(feildsList[i].DEFAULT_TYPE=="C"||feildsList[i].DEFAULT_TYPE==""){// default type constant + this.textInput = new TextInput(feildsList[i].SEGMENT_PROMPT, feildsList[i].APPLICATION_COLUMN_NAME, defaultVal, containerId, defaultValText, feildsList[i].MOBILE_ENABLED, feildsList[i].DISPLAY_FLAG, feildsList[i].REQUIRED_FLAG); + // }else if(feildsList[i].DEFAULT_TYPE=="P"||feildsList[i].DEFAULT_TYPE=="S"){// profile/ sql + // this.textInput = new TextInput(feildsList[i].SEGMENT_PROMPT,feildsList[i].APPLICATION_COLUMN_NAME,this.getDefaultValue(feildsList[i].DESC_FLEX_NAME,feildsList[i].DESC_FLEX_CONTEXT_CODE,feildsList[i].SEGMENT_NAME,feildsList[i].PARENT_SEGMENTS_VS_SplitedVS,feildsList[i].PARENT_SEGMENTS_DV_Splited),containerId,feildsList[i].MOBILE_ENABLED); + // } + } + else if (feildsList[i].FORMAT_TYPE == "N") {// number + // if(feildsList[i].DEFAULT_TYPE=="C"||feildsList[i].DEFAULT_TYPE==""){ + this.numberInput = new NumberInput(feildsList[i].SEGMENT_PROMPT, feildsList[i].APPLICATION_COLUMN_NAME, defaultVal, containerId, feildsList[i].MOBILE_ENABLED, feildsList[i].DISPLAY_FLAG, feildsList[i].REQUIRED_FLAG); + // }else if(feildsList[i].DEFAULT_TYPE=="P"||feildsList[i].DEFAULT_TYPE=="S"){ + // this.numberInput = new NumberInput(feildsList[i].SEGMENT_PROMPT,feildsList[i].APPLICATION_COLUMN_NAME,this.getDefaultValue(feildsList[i].DESC_FLEX_NAME,feildsList[i].DESC_FLEX_CONTEXT_CODE,feildsList[i].SEGMENT_NAME,feildsList[i].PARENT_SEGMENTS_VS_SplitedVS,feildsList[i].PARENT_SEGMENTS_DV_Splited),containerId,feildsList[i].MOBILE_ENABLED); + // } + } + else if (feildsList[i].FORMAT_TYPE == "X") {// standard date + if (feildsList[i].DEFAULT_TYPE == "C" || feildsList[i].DEFAULT_TYPE == "D" || feildsList[i].DEFAULT_TYPE == "P" || feildsList[i].DEFAULT_TYPE == "S") {//constant + this.dateInput = new DateInput(feildsList[i].SEGMENT_PROMPT, feildsList[i].APPLICATION_COLUMN_NAME, this.cs.reverseFormatDate(defaultVal), containerId, feildsList[i].MOBILE_ENABLED, feildsList[i].DISPLAY_FLAG, feildsList[i].REQUIRED_FLAG); + } else { + this.dateInput = new DateInput(feildsList[i].SEGMENT_PROMPT, feildsList[i].APPLICATION_COLUMN_NAME, "", containerId, feildsList[i].MOBILE_ENABLED, feildsList[i].DISPLAY_FLAG, feildsList[i].REQUIRED_FLAG); + } + // else if(feildsList[i].DEFAULT_TYPE=="D"){//current date + // // this.dateInput = new DateInput(feildsList[i].SEGMENT_PROMPT,feildsList[i].APPLICATION_COLUMN_NAME,"currentDate",containerId,feildsList[i].MOBILE_ENABLED); + // this.dateInput = new DateInput(feildsList[i].SEGMENT_PROMPT,feildsList[i].APPLICATION_COLUMN_NAME,defaultVal,containerId,feildsList[i].MOBILE_ENABLED); + + // }else if(feildsList[i].DEFAULT_TYPE=="P"||feildsList[i].DEFAULT_TYPE=="S"){// sql and profile + // this.dateInput = new DateInput(feildsList[i].SEGMENT_PROMPT,feildsList[i].APPLICATION_COLUMN_NAME,this.getDefaultValue(feildsList[i].DESC_FLEX_NAME,feildsList[i].DESC_FLEX_CONTEXT_CODE,feildsList[i].SEGMENT_NAME,feildsList[i].PARENT_SEGMENTS_VS_SplitedVS,feildsList[i].PARENT_SEGMENTS_DV_Splited),containerId,feildsList[i].MOBILE_ENABLED); + // } + } + else if (feildsList[i].FORMAT_TYPE == "Y") {// standard date time + if (feildsList[i].DEFAULT_TYPE == "C" || feildsList[i].DEFAULT_TYPE == "D" || feildsList[i].DEFAULT_TYPE == "P" || feildsList[i].DEFAULT_TYPE == "S") { + this.datetimeInput = new DateTimeInput(feildsList[i].SEGMENT_PROMPT, feildsList[i].APPLICATION_COLUMN_NAME, this.cs.reverseFormatStandardDate(defaultVal), containerId, feildsList[i].MOBILE_ENABLED, feildsList[i].DISPLAY_FLAG, feildsList[i].REQUIRED_FLAG); + } else { + this.datetimeInput = new DateTimeInput(feildsList[i].SEGMENT_PROMPT, feildsList[i].APPLICATION_COLUMN_NAME, "", containerId, feildsList[i].MOBILE_ENABLED, feildsList[i].DISPLAY_FLAG, feildsList[i].REQUIRED_FLAG); + } + const elem = document.getElementById(feildsList[i].APPLICATION_COLUMN_NAME); + elem.addEventListener("click", (e) => { + if (feildsList[i].MOBILE_ENABLED != 'Y') + return false; + this.showDateTimePicker(feildsList[i].APPLICATION_COLUMN_NAME, feildsList[i].MAXIMUM_SIZE); + e.stopImmediatePropagation(); + }); + // else if(feildsList[i].DEFAULT_TYPE=="D"){ + // this.datetimeInput = new DateTimeInput(feildsList[i].SEGMENT_PROMPT,feildsList[i].APPLICATION_COLUMN_NAME,"currentDateTime",containerId,feildsList[i].MOBILE_ENABLED); + // }else if(feildsList[i].DEFAULT_TYPE=="P"||feildsList[i].DEFAULT_TYPE=="S"){ + // this.datetimeInput = new DateTimeInput(feildsList[i].SEGMENT_PROMPT,feildsList[i].APPLICATION_COLUMN_NAME,this.getDefaultValue(feildsList[i].DESC_FLEX_NAME,feildsList[i].DESC_FLEX_CONTEXT_CODE,feildsList[i].SEGMENT_NAME,feildsList[i].PARENT_SEGMENTS_VS_SplitedVS,feildsList[i].PARENT_SEGMENTS_DV_Splited),containerId,feildsList[i].MOBILE_ENABLED); + // } + } + else if (feildsList[i].FORMAT_TYPE == "I") {//time + if (feildsList[i].DEFAULT_TYPE == "C" || feildsList[i].DEFAULT_TYPE == "D" || feildsList[i].DEFAULT_TYPE == "P" || feildsList[i].DEFAULT_TYPE == "S") { + this.timeInput = new TimeInput(feildsList[i].SEGMENT_PROMPT, feildsList[i].APPLICATION_COLUMN_NAME, defaultVal, containerId, feildsList[i].MOBILE_ENABLED, feildsList[i].DISPLAY_FLAG, feildsList[i].REQUIRED_FLAG); + } else { + this.timeInput = new TimeInput(feildsList[i].SEGMENT_PROMPT, feildsList[i].APPLICATION_COLUMN_NAME, "", containerId, feildsList[i].MOBILE_ENABLED, feildsList[i].DISPLAY_FLAG, feildsList[i].REQUIRED_FLAG); + } + const elem = document.getElementById(feildsList[i].APPLICATION_COLUMN_NAME); + elem.addEventListener("click", (e) => { + if (feildsList[i].MOBILE_ENABLED != 'Y') + return false; + this.showTimePicker(feildsList[i].APPLICATION_COLUMN_NAME, feildsList[i].MAXIMUM_SIZE); + e.stopImmediatePropagation(); + }); + // else if(feildsList[i].DEFAULT_TYPE=="T"){ + // this.timeInput = new TimeInput(feildsList[i].SEGMENT_PROMPT,feildsList[i].APPLICATION_COLUMN_NAME,"currentTime",containerId,feildsList[i].MOBILE_ENABLED); + // }else if(feildsList[i].DEFAULT_TYPE=="P"||feildsList[i].DEFAULT_TYPE=="S"){ + // this.timeInput = new TimeInput(feildsList[i].SEGMENT_PROMPT,feildsList[i].APPLICATION_COLUMN_NAME,this.getDefaultValue(feildsList[i].DESC_FLEX_NAME,feildsList[i].DESC_FLEX_CONTEXT_CODE,feildsList[i].SEGMENT_NAME,feildsList[i].PARENT_SEGMENTS_VS_SplitedVS,feildsList[i].PARENT_SEGMENTS_DV_Splited),containerId,feildsList[i].MOBILE_ENABLED); + // } + } + } else { + if (feildsList[i].READ_ONLY == 'Y') { + this.textInput = new TextInput(feildsList[i].SEGMENT_PROMPT, feildsList[i].APPLICATION_COLUMN_NAME, defaultValText, containerId, defaultVal, feildsList[i].MOBILE_ENABLED, feildsList[i].DISPLAY_FLAG, feildsList[i].REQUIRED_FLAG); + } else { + // dropdown list missing open in differnt page + //check this validation since he doesnt check the other default_type + //if(feildsList[i].DEFAULT_TYPE=="P" || feildsList[i].DEFAULT_TYPE=="S"){ + this.selectInput = new SelectInput(feildsList[i].SEGMENT_PROMPT, feildsList[i].APPLICATION_COLUMN_NAME, defaultVal, containerId, feildsList[i].MOBILE_ENABLED, feildsList[i].DISPLAY_FLAG, feildsList[i].REQUIRED_FLAG); + // }else{ + // this.selectInput = new SelectInput(feildsList[i].SEGMENT_PROMPT,feildsList[i].APPLICATION_COLUMN_NAME,"",containerId,feildsList[i].MOBILE_ENABLED); + // } + // this.getValueSet(feildsList[i].SEGMENT_NAME); + this.fillDropdownList(feildsList[i].SEGMENT_NAME, feildsList[i].E_SERVICES_VS, feildsList[i].E_SERVICES_DV); + // this.eitVALSettoCall.push(feildsList[i]); + } + } + //const elem = document.getElementById(feildsList[i].APPLICATION_COLUMN_NAME); + //elem.addEventListener("click", (e) => { + // this.getValueSet(feildsList[i].SEGMENT_NAME); + // e.stopImmediatePropagation(); + // }); + this.bindHtmlElemEvents(feildsList[i].APPLICATION_COLUMN_NAME, feildsList[i]); + } else { + // if(feildsList[i].VALIDATION_TYPE=="N"){ + this.hiddenInput = new HiddenInput(defaultVal, feildsList[i].APPLICATION_COLUMN_NAME, defaultValText, containerId); + // }else{ + // this.selectInput = new SelectInput(feildsList[i].SEGMENT_PROMPT,feildsList[i].APPLICATION_COLUMN_NAME,defaultVal,containerId,feildsList[i].MOBILE_ENABLED,feildsList[i].DISPLAY_FLAG); + // this.fillDropdownList(feildsList[i].SEGMENT_NAME,feildsList[i].E_SERVICES_VS,feildsList[i].E_SERVICES_DV); + // } + this.bindHtmlElemEvents(feildsList[i].APPLICATION_COLUMN_NAME, feildsList[i]); + } + } + // this.callValueSet(); + // let msg:string=""; + // msg=this.translate.translate("confirmAddEit.start"); + // this.buttonInput = new ButtonInput("EIT_Btn_Submit", this.translate.translate('general.submit'), containerId, ""); + // const elem = document.getElementById("EIT_Btn_Submit"); + // elem.addEventListener("click", (e) => { + // this.validateEITTransaction(); + // }); + if (this.validateEitObj && this.validateEitObj.length > 0) { + this.fillEITStructure(); + } + } + + addFieldToDOM(fieldObject: any, fieldId: any, clickListenerEvent: any, hasClickListener: boolean) { + console.log('AddFieldToDOM'); + const elemDiv = document.createElement('div'); + elemDiv.className = ''; + elemDiv.innerHTML = fieldObject.getTemplate(); + console.log(this.containerDiv.nativeElement) + + this.containerDiv.nativeElement.appendChild(elemDiv); + // document.getElementById('containerDiv').appendChild(elemDiv); + + if (hasClickListener) { + let elem = document.getElementById(fieldId); + elem.addEventListener("click", (e) => { + clickListenerEvent(e); + e.stopImmediatePropagation(); + }); + } + + } + + closemodal() { + this.updatedValues = []; + this.modalController.dismiss(); + } + + public showDateTimePicker(elemID, maxSize) { + let elem = document.getElementById(elemID) as HTMLDivElement; + let date: any; + let value = elem.innerHTML; + if (value) + date = moment(value, "YYYY/MM/DD HH:mm:ss").toDate(); + else + date = new Date(); + this.datePicker.show({ + date: date, + is24Hour: true, + mode: 'datetime' + }).then( + date => { + let dateString: string = moment(date).format("YYYY/MM/DD HH:mm:ss"); + //remove seconds if the maximum size is 17 + if (maxSize == 17) { + elem.innerHTML = dateString.substring(0, 16); + elem.dataset.dtvalue = dateString.substring(0, 16); + } else { + elem.innerHTML = dateString; + elem.dataset.dtvalue = dateString; + } + //elem.innerHTML = dateString; + // elem.dataset.dtvalue = dateString; + }, + err => console.log('Error occurred while getting date: ', err) + ); + } + public showTimePicker(elemID, maxSize) { + let elem = document.getElementById(elemID) as HTMLDivElement; + let date: any; + let value = elem.innerHTML; + if (value) { + let nowDate = moment().format("YYYY/MM/DD") + " " + value; + date = moment(nowDate, "YYYY/MM/DD HH:mm:ss").toDate(); + } else { + date = new Date(); + } + this.datePicker.show({ + date: date, + is24Hour: true, + mode: 'time' + }).then( + date => { + let dateString: string = moment(date).format("HH:mm:ss"); + //remove seconds if the maximum size is 5 + if (maxSize == 5) { + elem.innerHTML = dateString.substring(0, 5); + elem.dataset.dtvalue = dateString.substring(0, 5); + } else { + elem.innerHTML = dateString; + elem.dataset.dtvalue = dateString; + } + }, + err => console.log('Error occurred while getting date: ', err) + ); + } + + fillDropdownList(segmentName, optionList: any = [], DV: any = "") { + let elemID: any = "" + let eitObj: any; + if (optionList.length > 0) { + for (let i = 0; i < this.eitResponse.length; i++) { + if (this.eitResponse[i].SEGMENT_NAME == segmentName) { + eitObj = this.eitResponse[i]; + if (this.eitResponse[i].READ_ONLY == 'Y' || this.eitResponse[i].DISPLAY_FLAG == 'N') { + return false; + } + elemID = this.eitResponse[i].APPLICATION_COLUMN_NAME; + break; + } + } + let select = document.getElementById(elemID) as HTMLSelectElement; + document.getElementById(elemID).innerHTML = ""; + + // for(let i = select.options.length - 1 ; i >= 0 ; i--) + // { + // select.remove(i); + // } + if (eitObj.IsEmptyOption && eitObj.REQUIRED_FLAG == 'N') { + var firstoption = document.createElement("option"); + firstoption.text = this.ts.trPK("general", "choose"); + firstoption.value = ""; + select.add(firstoption); + } + for (let i = 0; i < optionList.length; i++) { + + var option = document.createElement("option"); + option.text = optionList[i].VALUE_COLUMN_NAME; + option.value = optionList[i].ID_COLUMN_NAME; + select.add(option); + + } + if (select.dataset.hiddenval) { + select.value = select.dataset.hiddenval; + //select.dataset.hiddenval=""; + } else { + select.value = DV.P_VALUE_COLUMN_NAME; + } + select.disabled = false; + } + } + + bindHtmlElemEvents(id, obj) { + console.log('bindElement: ' + id); + const elem = document.getElementById(id); + console.log(elem); + try { + elem.addEventListener("change", (e) => { + //console.log("elem change "+elem.id); + //let x=e.currentTarget as HTMLInputElement; + //let isEmpty:boolean=false; + // if(!x.value) + // isEmpty=true; + //emptyChildElement + elem.classList.remove("requiredClassElm"); + if (obj.CHILD_SEGMENTS_VS_Splited && obj.CHILD_SEGMENTS_VS_Splited.length > 0) { + let listArray: any = obj.CHILD_SEGMENTS_VS_Splited; + listArray.forEach(element => { + //if(isEmpty) + this.emptyChildElement(element); + // else + this.getValueSet(element); + }); + } + if (obj.CHILD_SEGMENTS_DV_Splited && obj.CHILD_SEGMENTS_DV_Splited.length > 0) { + let listArray: any = obj.CHILD_SEGMENTS_DV_Splited; + listArray.forEach(element => { + // if(isEmpty){ + this.emptyChildElement(element); + // }else{ + for (let i = 0; i < this.eitResponse.length; i++) { + if (this.eitResponse[i].SEGMENT_NAME == element) { + this.getDefaultValue(this.eitResponse[i], this.eitResponse[i].DESC_FLEX_NAME, this.eitResponse[i].DESC_FLEX_CONTEXT_CODE, this.eitResponse[i].SEGMENT_NAME, this.eitResponse[i].PARENT_SEGMENTS_VS_SplitedVS, this.eitResponse[i].PARENT_SEGMENTS_DV_Splited); + } + } + // } + }); + } + return false; + // e.stopImmediatePropagation(); + }); + } catch (e) { + console.log(e.status); + } + } + + public getDefaultValue(obj, descFlexName, descFlexContextCode, segmentName, parentValue, ParentsList) { + let dependenciesList: any = []; + let parentVal: any = null; + let isStandardDate: boolean = false; + let isStandardTimeDate: boolean = false; + let isStandardTime: boolean = false; + let isHidden: boolean = false; + let isReadOnlyList: boolean = false; + isStandardDate = this.isStandardDate(obj); + isStandardTimeDate = this.isStandardDateTime(obj); + isStandardTime = this.isStandardTime(obj); + if (obj.DISPLAY_FLAG == 'N') + isHidden = true; + if (obj.VALIDATION_TYPE != 'N' && obj.READ_ONLY == 'Y') { + isReadOnlyList = true; + } + //if(parentValue!=""){ parentVal= this.getDependenciesParams(parentValue)[0].ID_COLUMN_NAME;} + //if(ParentsList!=""){dependenciesList =this.getDependenciesParams(ParentsList); } + + if (parentValue != "" && (obj.VALIDATION_TYPE == 'D' || obj.VALIDATION_TYPE == 'Y')) { + let parvalue = this.getDependenciesParams(parentValue); + if (parvalue && parvalue[0]) + parentVal = parvalue[0].ID_COLUMN_NAME; + else { + parentVal = null; + } + if (!parentVal) { return false }; + } + if (ParentsList != "") { + if (parentValue) + ParentsList.concat(parentValue); + dependenciesList = this.getDependenciesParams(ParentsList); + if (!dependenciesList) { return false }; + } + + + //if (dependenciesList==false){return false}; + const body = { + + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, + P_MENU_TYPE: this.menuType, + P_SELECTED_RESP_ID: this.respID,//-999, + P_DESC_FLEX_NAME: descFlexName, + P_DESC_FLEX_CONTEXT_CODE: descFlexContextCode, + P_SEGMENT_NAME: segmentName, + P_PARENT_VALUE: parentVal, + GetValueSetValuesTBL: dependenciesList, + } + + + + this.eitService.getDefaultValue(body).subscribe((result: any) => { + let elem = this.getElementByName(segmentName); + // if(elem.dataset.hiddenval){ + // elem.dataset.hiddenval=""; + // return false; + // } + let obj = this.handleDefaultValueResult(result); + let val = obj.value; + let text = obj.text; + if (isStandardDate) { + elem.value = this.cs.reverseFormatDate(val); + } else if (isStandardTimeDate) { + if (val) { + elem.dataset.dtvalue = this.cs.reverseFormatStandardDate(val); + elem.innerHTML = this.cs.reverseFormatStandardDate(val); + } else { + elem.dataset.dtvalue = ""; + elem.innerHTML = ""; + } + } else if (isStandardTime) { + if (val) { + elem.dataset.dtvalue = val; + elem.innerHTML = val; + } else { + elem.dataset.dtvalue = ""; + elem.innerHTML = ""; + } + } else { + elem.value = val; + } + if (isHidden || isReadOnlyList) { + if (val) + elem.dataset.colmText = val; + else + elem.dataset.colmText = ""; + elem.value = text; + } + var event = new Event('change'); + elem.dispatchEvent(event); + }); + } + + handleDefaultValueResult(result) { + let data = { text: result.GetDefaultValueList.P_VALUE_COLUMN_NAME, value: result.GetDefaultValueList.P_ID_COLUMN_NAME } + return data; + } + + callValueSet() { + for (var i = 0; i < this.eitVALSettoCall.length; i++) { + this.getValueSet(this.eitVALSettoCall[i].SEGMENT_NAME); + } + } + + getParentValue(parentValue) { + if (parentValue.length == 0) { + for (let i = 0; i < this.eitResponse.length; i++) { + if (this.eitResponse[i].SEGMENT_NAME == parentValue[0].Name) { + if (this.eitResponse[i].VALIDATION_TYPE == "N") { + let val = (document.getElementById(this.eitResponse[i].APPLICATION_COLUMN_NAME) as HTMLInputElement).value; + return val; + } else { + let x = (document.getElementById(this.eitResponse[i].APPLICATION_COLUMN_NAME)) as HTMLSelectElement; + if (x.options.length > 0) { + let val = x.options[x.selectedIndex] ? x.options[x.selectedIndex].value : null; + return val; + } else { + return ""; + } + } + } + } + } else { + return ""; + } + } + + public getValueSet(segmentName) { + + let descFlexName: any = ""; + let descFlexContextCode: any = "" + let parentValue: any = []; + let ParentsList: any = []; + let parentVal: any = null; + let dependenciesList: any = []; + let validationType: string = ""; + + for (let i = 0; i < this.eitResponse.length; i++) { + if (this.eitResponse[i].SEGMENT_NAME == segmentName) { + descFlexName = this.eitResponse[i].DESC_FLEX_NAME; + descFlexContextCode = this.eitResponse[i].DESC_FLEX_CONTEXT_CODE; + parentValue = this.eitResponse[i].PARENT_SEGMENTS_VS_SplitedVS; + ParentsList = this.eitResponse[i].PARENT_SEGMENTS_VS_SplitedVS; + validationType = this.eitResponse[i].VALIDATION_TYPE; + break; + } + } + if (parentValue != "" && (validationType == "D" || validationType == "Y")) { + let parvalue = this.getDependenciesParams(parentValue); + if (parvalue && parvalue[0]) + parentVal = parvalue[0].ID_COLUMN_NAME; + else { + parentVal = null; + } + if (!parentVal) { return false }; + } + if (ParentsList != "") { dependenciesList = this.getDependenciesParams(ParentsList); if (!dependenciesList) { return false }; } + const body = { + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, + P_MENU_TYPE: this.menuType, + P_SELECTED_RESP_ID: this.respID,//-999, + P_DESC_FLEX_NAME: descFlexName, + P_DESC_FLEX_CONTEXT_CODE: descFlexContextCode, + P_SEGMENT_NAME: segmentName, + P_PARENT_VALUE: parentVal, + GetValueSetValuesTBL: dependenciesList, + P_PAGE_NUM: 1, + P_PAGE_LIMIT: 1000 + } + + this.eitService.getSetValue(body).subscribe((result: any) => { + if (result.GetValueSetValuesList != null) { + this.fillDropdownList(segmentName, result.GetValueSetValuesList); + } + }); + let arr: any = []; + return arr; + } + + getDependenciesParams(parentsList) { + let parentArr: any = []; + for (let i = 0; i < parentsList.length; i++) { + for (let j = 0; j < this.eitResponse.length; j++) { + if (this.eitResponse[j].SEGMENT_NAME == parentsList[i].Name) { + if (this.eitResponse[j].DISPLAY_FLAG != 'N') { + if (this.eitResponse[j].VALIDATION_TYPE == "N") { + let idColName: string; + let val: any; + if (this.eitResponse[j].FORMAT_TYPE == "Y" || this.eitResponse[j].FORMAT_TYPE == "I") {//standard date time or //time + let elem = document.getElementById(this.eitResponse[j].APPLICATION_COLUMN_NAME) as HTMLDivElement; + val = elem.dataset.dtvalue; + if ((val == undefined || val == "") && parentsList[i].IsRequired == "REQUIRED") { + //alert(parentsList[i].Name +" Is required"); + return false; + } + idColName = val; + if (this.eitResponse[j].FORMAT_TYPE == "Y") + idColName = this.cs.formatStandardDate(val); + } else { + val = (document.getElementById(this.eitResponse[j].APPLICATION_COLUMN_NAME) as HTMLInputElement).value; + if ((val == undefined || val == "") && parentsList[i].IsRequired == "REQUIRED") { + //alert(parentsList[i].Name +" Is required"); + return false; + } + idColName = val; + if (this.eitResponse[j].FORMAT_TYPE == "X") {//date + idColName = this.cs.formatDate(val); + } + } + parentArr.push({ SEGMENT_NAME: this.eitResponse[j].SEGMENT_NAME, VALUE_COLUMN_NAME: val, DESCRIPTION: "", ID_COLUMN_NAME: idColName, FLEX_VALUE_SET_NAME: this.eitResponse[j].FLEX_VALUE_SET_NAME }) + break; + } else { + if (this.eitResponse[j].READ_ONLY != 'Y') { + let x = (document.getElementById(this.eitResponse[j].APPLICATION_COLUMN_NAME)) as HTMLSelectElement; + let text = x.options[x.selectedIndex] ? x.options[x.selectedIndex].text : ""; + let val = x.options[x.selectedIndex] ? x.options[x.selectedIndex].value : undefined; + if ((val == undefined || val == "") && parentsList[i].IsRequired == "REQUIRED") { + //alert(parentsList[i].Name +" Is required"); + return false; + } else { } + if (text == undefined) { text = ""; } + parentArr.push({ SEGMENT_NAME: this.eitResponse[j].SEGMENT_NAME, VALUE_COLUMN_NAME: text, DESCRIPTION: "", ID_COLUMN_NAME: val, FLEX_VALUE_SET_NAME: this.eitResponse[j].FLEX_VALUE_SET_NAME }) + break; + } else { + let x = (document.getElementById(this.eitResponse[j].APPLICATION_COLUMN_NAME)) as HTMLInputElement; + let text = x.value; + let val = x.dataset.colmText; + if ((val == undefined || val == "") && parentsList[i].IsRequired == "REQUIRED") { + //alert(parentsList[i].Name +" Is required"); + return false; + } else { } + if (text == undefined) { text = ""; } + parentArr.push({ SEGMENT_NAME: this.eitResponse[j].SEGMENT_NAME, VALUE_COLUMN_NAME: text, DESCRIPTION: "", ID_COLUMN_NAME: val, FLEX_VALUE_SET_NAME: this.eitResponse[j].FLEX_VALUE_SET_NAME }) + break; + } + } + } else { + let x = (document.getElementById(this.eitResponse[j].APPLICATION_COLUMN_NAME)) as HTMLInputElement; + let text = x.value; + let val = x.dataset.colmText; + if ((val == undefined || val == "") && parentsList[i].IsRequired == "REQUIRED") { + //alert(parentsList[i].Name +" Is required"); + return false; + } else { } + if (text == undefined) { text = ""; } + parentArr.push({ SEGMENT_NAME: this.eitResponse[j].SEGMENT_NAME, VALUE_COLUMN_NAME: text, DESCRIPTION: "", ID_COLUMN_NAME: val, FLEX_VALUE_SET_NAME: this.eitResponse[j].FLEX_VALUE_SET_NAME }) + break; + } + + } + } + + } + return parentArr; + } + + emptyChildElement(segmentName) { + let elem = this.getElementByName(segmentName); + elem.value = null; + elem.innerHTML = ""; + if (("dtvalue" in elem.dataset)) { + elem.dataset.dtvalue = ""; + } + if (("colmText" in elem.dataset)) { + elem.dataset.colmText = ""; + } + var event = new Event('change'); + elem.dispatchEvent(event); + elem.classList.remove("requiredClassElm"); + } + + getRequiredFilds() { + for (let i = 0; i < this.eitResponse.length; i++) { + if (this.eitResponse[i].REQUIRED_FLAG == "Y") { + let elemVal = (document.getElementById(this.eitResponse[i].APPLICATION_COLUMN_NAME) as HTMLInputElement).value; + if (elemVal == "") { + //alert(this.eitResponse[i].SEGMENT_NAME+" is required"); + break; + } + } + } + } + + getElementByName(segmentName) { + let elemID: any = "" + for (let i = 0; i < this.eitResponse.length; i++) { + if (this.eitResponse[i].SEGMENT_NAME == segmentName) { + elemID = this.eitResponse[i].APPLICATION_COLUMN_NAME; + break; + } + } + return document.getElementById(elemID) as HTMLInputElement; + } + + isStandardDate(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "X") {// standard date + if (obj.DEFAULT_TYPE == "C" || obj.DEFAULT_TYPE == "D" || obj.DEFAULT_TYPE == "P" || obj.DEFAULT_TYPE == "S") {//constant + isSt = true; + } + } + return isSt; + } + isStandardDateTime(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "Y") {// standard date time + if (obj.DEFAULT_TYPE == "C" || obj.DEFAULT_TYPE == "D" || obj.DEFAULT_TYPE == "P" || obj.DEFAULT_TYPE == "S") {//constant + isSt = true; + } + } + return isSt; + } + isStandardTime(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "I") {// standard date time + if (obj.DEFAULT_TYPE == "C" || obj.DEFAULT_TYPE == "D" || obj.DEFAULT_TYPE == "P" || obj.DEFAULT_TYPE == "S") {//constant + isSt = true; + } + } + return isSt; + } + + isStandardDateVal(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "X") {// standard date + // if(obj.DEFAULT_TYPE=="C" || obj.DEFAULT_TYPE=="D" || obj.DEFAULT_TYPE=="P"||obj.DEFAULT_TYPE=="S"){//constant + isSt = true; + // } + } + return isSt; + } + isStandardDateTimeVal(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "Y") {// standard date time + //if(obj.DEFAULT_TYPE=="C" || obj.DEFAULT_TYPE=="D" || obj.DEFAULT_TYPE=="P"||obj.DEFAULT_TYPE=="S"){//constant + isSt = true; + //} + } + return isSt; + } + isStandardTimeVal(obj: any): boolean { + let isSt: boolean = false; + if (obj.FORMAT_TYPE == "I") {// standard time + //if(obj.DEFAULT_TYPE=="C" || obj.DEFAULT_TYPE=="D" || obj.DEFAULT_TYPE=="P"||obj.DEFAULT_TYPE=="S"){//constant + isSt = true; + //} + } + return isSt; + } + + fillEITStructure() { + var obj = { peiObjVer: null, peiExtraInfoID: null }; + for (let i = 0; i < this.validateEitObj.length; i++) { + let val: any; + if (this.validateEitObj[i].VARCHAR2_VALUE) + val = this.validateEitObj[i].VARCHAR2_VALUE; + else if (this.validateEitObj[i].DATE_VALUE) + val = this.validateEitObj[i].DATE_VALUE; + else if (this.validateEitObj[i].NUMBER_VALUE) + val = this.validateEitObj[i].NUMBER_VALUE; + const elem = document.getElementById(this.validateEitObj[i].APPLICATION_COLUMN_NAME) as HTMLInputElement; + //obj.transactionNo=this.validateEitObj[i].TRANSACTION_NUMBER; + if (elem) { + if (val) { + let feldDetails = this.eitResponse.find(x => x.APPLICATION_COLUMN_NAME == this.validateEitObj[i].APPLICATION_COLUMN_NAME); + if (feldDetails) { + let isStandardDate = this.isStandardDateVal(feldDetails); + let isStandardDateTime = this.isStandardDateTimeVal(feldDetails); + let isStandardTime = this.isStandardTimeVal(feldDetails); + if (isStandardDate) { + elem.value = this.cs.reverseFormatDate(val); + } else if (isStandardDateTime) { + elem.innerHTML = this.cs.reverseFormatStandardDate(val); + elem.dataset.dtvalue = this.cs.reverseFormatStandardDate(val); + } else if (isStandardTime) { + elem.innerHTML = val; + elem.dataset.dtvalue = val; + } else { + elem.value = val; + elem.setAttribute('value', elem.value); + } + if ((feldDetails.DISPLAY_FLAG == 'N') || (feldDetails.VALIDATION_TYPE != "N" && feldDetails.READ_ONLY == 'Y')) { + elem.dataset.colmText = val; + elem.value = this.validateEitObj[i].SEGMENT_VALUE_DSP; + elem.setAttribute('value', elem.value); + } + } + elem.dataset.hiddenval = val;//hide the value to set it after calling get value set + if (feldDetails.CHILD_SEGMENTS_VS_Splited && feldDetails.CHILD_SEGMENTS_VS_Splited.length > 0) { + let listArray: any = feldDetails.CHILD_SEGMENTS_VS_Splited; + listArray.forEach(element => { + this.getValueSet(element); + }); + } + // var event = new Event('change'); + // elem.dispatchEvent(event); + } + } else { + if (this.validateEitObj[i].APPLICATION_COLUMN_NAME == "PEI_OBJECT_VERSION_NUMBER") + obj.peiObjVer = this.validateEitObj[i].NUMBER_VALUE; + else if (this.validateEitObj[i].APPLICATION_COLUMN_NAME == "PEI_EXTRA_INFO_ID") + obj.peiExtraInfoID = this.validateEitObj[i].NUMBER_VALUE; + } + } + this.ExtraObj = obj; + } + + public getElementsValues(): any { + this.updatedValues = [];//fill updated list + let valuseArr: any = []; + let varcharValue: any = null; + let numbervalue: any = 0; + let dateValue: any = null; + let transNo: number = this.comtransNo; + let textValue = ""; + // if(this.ExtraObj.transactionNo) + // transNo=this.ExtraObj.transactionNo; + for (let i = 0; i < this.eitResponse.length; i++) { + varcharValue = null; + numbervalue = null; + dateValue = null; + /*********set transaction No of the updated object ********/ + if (this.getPassdirfromNotifiPage) { + let updatedObj = this.validateEitObj.find(x => x.APPLICATION_COLUMN_NAME == this.eitResponse[i].APPLICATION_COLUMN_NAME); + let y = updatedObj; + transNo = y.TRANSACTION_NUMBER; // set the transaction number for all items in the updated loop + } + if (this.eitResponse[i].DISPLAY_FLAG != "N") { + if (this.eitResponse[i].VALIDATION_TYPE == "N") { + let elem = document.getElementById(this.eitResponse[i].APPLICATION_COLUMN_NAME) as HTMLInputElement; + let elemVal = (document.getElementById(this.eitResponse[i].APPLICATION_COLUMN_NAME) as HTMLInputElement).value; + textValue = elemVal; + //let elemVal= (document.getElementById(this.eitResponse[i].APPLICATION_COLUMN_NAME)).value; + if (this.eitResponse[i].FORMAT_TYPE == "X" && this.eitResponse[i].DISPLAY_FLAG != "N") {//date + elemVal = this.cs.formatDate(elemVal); + } else if (this.eitResponse[i].FORMAT_TYPE == "Y" && this.eitResponse[i].DISPLAY_FLAG != "N") {//standard date time + elemVal = elem.dataset.dtvalue; + elemVal = this.cs.formatStandardDate(elemVal); + } else if (this.eitResponse[i].FORMAT_TYPE == "I" && this.eitResponse[i].DISPLAY_FLAG != "N") {//time + elemVal = elem.dataset.dtvalue; + } + if (this.eitResponse[i].REQUIRED_FLAG == "Y" && !elemVal) { + elem.classList.add("requiredClassElm"); + //this.common.showRequiredMsg(); + return false; + } else { + elem.classList.remove("requiredClassElm"); + } + if (elemVal) + varcharValue = elemVal; + valuseArr.push( + { + TRANSACTION_NUMBER: transNo, + NAME: this.eitResponse[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + } + ) + } + else { + let x = (document.getElementById(this.eitResponse[i].APPLICATION_COLUMN_NAME)) as HTMLSelectElement; + if (this.eitResponse[i].READ_ONLY == 'Y') { + let text = x.value; + let val = x.dataset.colmText; + varcharValue = val; + textValue = text; + } else { + let val = x.options[x.selectedIndex] ? x.options[x.selectedIndex].value : null; + let txt = x.options[x.selectedIndex] ? x.options[x.selectedIndex].text : null; + varcharValue = val; + textValue = txt; + } + if (this.eitResponse[i].REQUIRED_FLAG == "Y" && !varcharValue) { + x.classList.add("requiredClassElm"); + //this.common.showRequiredMsg(); + return false; + } else { + x.classList.remove("requiredClassElm"); + } + + valuseArr.push( + { + TRANSACTION_NUMBER: transNo, + NAME: this.eitResponse[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + } + ); + }//end else + } else { + let x = (document.getElementById(this.eitResponse[i].APPLICATION_COLUMN_NAME)) as HTMLSelectElement; + let val = x.dataset.colmText; + textValue = x.value; + if (this.eitResponse[i].REQUIRED_FLAG == "Y" && !val) { + x.classList.add("requiredClassElm"); + //this.common.showRequiredMsg(); + return false; + } else { + x.classList.remove("requiredClassElm"); + } + if (val) + varcharValue = val; + valuseArr.push( + { + TRANSACTION_NUMBER: transNo, + NAME: this.eitResponse[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + } + ); + } + + if (this.getPassdirfromNotifiPage) { + let updatedObj = this.validateEitObj.find(x => x.APPLICATION_COLUMN_NAME == this.eitResponse[i].APPLICATION_COLUMN_NAME); + let y = updatedObj; + y.VARCHAR2_VALUE = varcharValue; + y.NUMBER_VALUE = numbervalue; + y.DATE_VALUE = dateValue; + y.SEGMENT_VALUE_DSP = textValue; + transNo = y.TRANSACTION_NUMBER; // set the transaction number for all items in the updated loop + this.updatedValues.push(y); + } else { + if (this.validateEitObj && this.eitSubmitAction == EIT_ACTION.UPDATE) { + let updatedObj = this.validateEitObj.find(x => x.APPLICATION_COLUMN_NAME == this.eitResponse[i].APPLICATION_COLUMN_NAME); + let y = updatedObj; + y.VARCHAR2_VALUE = varcharValue; + y.NUMBER_VALUE = numbervalue; + y.DATE_VALUE = dateValue; + y.SEGMENT_VALUE_DSP = textValue; + transNo = transNo; // set the transaction number for all items in the updated loop + this.updatedValues.push(y); + } else { + let y = { + TRANSACTION_NUMBER: transNo, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue, + SEGMENT_VALUE_DSP: textValue, + APPLICATION_COLUMN_NAME: this.eitResponse[i].APPLICATION_COLUMN_NAME, + DATATYPE: this.eitResponse[i].DATATYPE, + DESC_FLEX_CONTEXT_CODE: this.eitResponse[i].DESC_FLEX_CONTEXT_CODE, + DESC_FLEX_NAME: this.eitResponse[i].DESC_FLEX_NAME, + DISPLAY_FLAG: this.eitResponse[i].DISPLAY_FLAG, + SEGMENT_NAME: this.eitResponse[i].SEGMENT_NAME, + SEGMENT_PROMPT: this.eitResponse[i].SEGMENT_PROMPT + }; + transNo = transNo; // set the transaction number for all items in the updated loop + this.updatedValues.push(y); + } + } + }// end for + + if (this.getPassdirfromNotifiPage) { + let updatedObj1 = this.validateEitObj.find(x => x.APPLICATION_COLUMN_NAME === "PEI_ACTION"); + let updatedObj2 = this.validateEitObj.find(x => x.APPLICATION_COLUMN_NAME === "PEI_EXTRA_INFO_ID"); + let updatedObj3 = this.validateEitObj.find(x => x.APPLICATION_COLUMN_NAME === "PEI_OBJECT_VERSION_NUMBER"); + this.updatedValues.push(updatedObj1); + this.updatedValues.push(updatedObj2); + this.updatedValues.push(updatedObj3); + valuseArr = this.fillExtraInformation(valuseArr, updatedObj1.VARCHAR2_VALUE, updatedObj2.NUMBER_VALUE, updatedObj3.NUMBER_VALUE, transNo); + } else { + if (this.eitSubmitAction == EIT_ACTION.ADD) { + this.updatedValues = this.fillExtraValuesUpdated(this.updatedValues, "NEW_ROW", -1, 0, transNo); + valuseArr = this.fillExtraInformation(valuseArr, "NEW_ROW", -1, 0, transNo); + } else if (this.eitSubmitAction == EIT_ACTION.UPDATE) { + valuseArr = this.fillExtraInformation(valuseArr, "UPDATE_ROW", this.ExtraObj.peiExtraInfoID, this.ExtraObj.peiObjVer, transNo); + } else if (this.eitSubmitAction == EIT_ACTION.DELETE) { + valuseArr = this.fillExtraInformation(valuseArr, "DELETE_ROW", this.ExtraObj.peiExtraInfoID, this.ExtraObj.peiObjVer, transNo); + } + } + return valuseArr; + }// end getElementsValues + + fillExtraValuesUpdated(values: any, peiAction: string, peiExtraInfoID: number, peiObjVer: number, transNo: number): any { + let obj1 = { + TRANSACTION_NUMBER: transNo, + VARCHAR2_VALUE: peiAction, + NUMBER_VALUE: null, + DATE_VALUE: null, + SEGMENT_VALUE_DSP: "", + APPLICATION_COLUMN_NAME: "PEI_ACTION", + DATATYPE: "VARCHAR2", + DESC_FLEX_CONTEXT_CODE: "", + DESC_FLEX_NAME: "", + DISPLAY_FLAG: "N", + SEGMENT_NAME: "", + SEGMENT_PROMPT: "" + }; + let obj2 = { + TRANSACTION_NUMBER: 1, + APPLICATION_COLUMN_NAME: "PEI_OBJECT_VERSION_NUMBER", + VARCHAR2_VALUE: null, + NUMBER_VALUE: peiObjVer, + DATATYPE: "NUMBER", + SEGMENT_VALUE_DSP: "", + DATE_VALUE: null, + DESC_FLEX_CONTEXT_CODE: "", + DESC_FLEX_NAME: "", + DISPLAY_FLAG: "N", + SEGMENT_NAME: "", + SEGMENT_PROMPT: "" + } + let obj3 = { + APPLICATION_COLUMN_NAME: "PEI_EXTRA_INFO_ID", + DATATYPE: "NUMBER", + DATE_VALUE: null, + DESC_FLEX_CONTEXT_CODE: "", + DESC_FLEX_NAME: "", + DISPLAY_FLAG: "N", + NUMBER_VALUE: peiExtraInfoID, + SEGMENT_NAME: "", + SEGMENT_PROMPT: "", + SEGMENT_VALUE_DSP: "", + TRANSACTION_NUMBER: transNo, + VARCHAR2_VALUE: null + } + values.push(obj1); + values.push(obj2); + values.push(obj3); + return values; + } + 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() { + let list = this.eitRequest.EITTransactionTBL; + this.eitRequest.EITTransactionTBL = this.fixTransactionNo(list); + this.eitService.submitEit(this.eitRequest).subscribe((result: AddEitResponse) => { + this.handleSubmitEitResult(result); + }); + } + + fixTransactionNo(transactionTBL: any): any[] { + let list: any = []; + let newIndex: number = 1; + let length: number = transactionTBL.length; + if (length > 0) { + for (let i = 0; i < length; i++) { + // let item :any={}; + const item = Object.assign({}, transactionTBL[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 = transactionTBL[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; + } + 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 }, 'confirmAddEITData') + this.cs.openConfirmEitPage(); + // this.navCtrl.push("ConfirmAddEitPage", { isResubmit: false }); + } + } + + validateEITTransaction() { + // let EITTransactionValues:any= []; + this.arrValues = this.getElementsValues(); + if (this.arrValues) { + this.eitRequest = { + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, + P_MENU_TYPE: this.menuType, + P_SELECTED_RESP_ID: this.respID,//this.selMenu.List_Menu.RESP_ID,//-999, + P_FUNCTION_NAME: this.functionName, + P_DESC_FLEX_CONTEXT_CODE: this.eitResponse[0].DESC_FLEX_CONTEXT_CODE, + EITTransactionTBL: this.arrValues + } + + this.eitService.validateEITTransaction(this.eitRequest).subscribe((result: any) => { + this.handleEITValidateTr(result); + }); + } + } + private handleEITValidateTr(result) { + let data: any = { eitRequest: {}, updated: [] }; + if (this.cs.validResponse(result)) { + // public static SHARED_DATA = 'login-request'; + this.cs.sharedService.setSharedData(this.eitRequest, EitRequest.SHARED_DATA); + if (this.getPassdirfromNotifiPage) { + let data: any = { eitRequest: {}, updated: [] }; + data.eitRequest = this.eitRequest; + data.updated = this.updatedValues; + // this.viewCtrl.dismiss(data); + this.closemodal(); + } else { + this.submitEit(); + // this.navCtrl.push("ConfirmAddEitPage"); + // data = { eitRequest: {}, updated: [] }; + // data.eitRequest = this.eitRequest; + // data.updated = this.updatedValues; + // this.viewCtrl.dismiss(data); + } + } else { + this.updatedValues = []; + data = { eitRequest: {}, updated: [] }; + } + } + +} diff --git a/Mohem/src/app/eit/confirm-add-eit/confirm-add-eit.component.html b/Mohem/src/app/eit/confirm-add-eit/confirm-add-eit.component.html new file mode 100644 index 00000000..a27c9bab --- /dev/null +++ b/Mohem/src/app/eit/confirm-add-eit/confirm-add-eit.component.html @@ -0,0 +1,3 @@ +

+ confirm-add-eit works! +

diff --git a/Mohem/src/app/eit/confirm-add-eit/confirm-add-eit.component.scss b/Mohem/src/app/eit/confirm-add-eit/confirm-add-eit.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/Mohem/src/app/eit/confirm-add-eit/confirm-add-eit.component.spec.ts b/Mohem/src/app/eit/confirm-add-eit/confirm-add-eit.component.spec.ts new file mode 100644 index 00000000..4e7175df --- /dev/null +++ b/Mohem/src/app/eit/confirm-add-eit/confirm-add-eit.component.spec.ts @@ -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; + + 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(); + }); +}); diff --git a/Mohem/src/app/eit/confirm-add-eit/confirm-add-eit.component.ts b/Mohem/src/app/eit/confirm-add-eit/confirm-add-eit.component.ts new file mode 100644 index 00000000..eb4d817b --- /dev/null +++ b/Mohem/src/app/eit/confirm-add-eit/confirm-add-eit.component.ts @@ -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() {} + +} diff --git a/Mohem/src/app/eit/eit-list/eit-list.component.html b/Mohem/src/app/eit/eit-list/eit-list.component.html new file mode 100644 index 00000000..8a518869 --- /dev/null +++ b/Mohem/src/app/eit/eit-list/eit-list.component.html @@ -0,0 +1,118 @@ + + + + {{headerTitle}} + + + + + +
+ + + + + + + + + + + +
+ + + + + + + + +
+
+ + + + + + + + +
+ +
+
+
+
+
+ + + + +

{{'general.noData' | translate}}

+
+ + +
+ + + +
{{this.headerTitle}}
+ + + +
+ + + + +
+ + + + + + + + +
+
+ + + + + + + + +
+ +
+
+
+ +
+ + + + +
+ + +
+ + + {{'general, add' | translate}} +
+
\ No newline at end of file diff --git a/Mohem/src/app/eit/eit-list/eit-list.component.scss b/Mohem/src/app/eit/eit-list/eit-list.component.scss new file mode 100644 index 00000000..a27a7ef0 --- /dev/null +++ b/Mohem/src/app/eit/eit-list/eit-list.component.scss @@ -0,0 +1,6 @@ +.footer-button { + border-radius: 2px; + padding: 0 1.1em; + min-height: 45px; + min-width: 200px; + } \ No newline at end of file diff --git a/Mohem/src/app/eit/eit-list/eit-list.component.spec.ts b/Mohem/src/app/eit/eit-list/eit-list.component.spec.ts new file mode 100644 index 00000000..c34639df --- /dev/null +++ b/Mohem/src/app/eit/eit-list/eit-list.component.spec.ts @@ -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; + + 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(); + }); +}); diff --git a/Mohem/src/app/eit/eit-list/eit-list.component.ts b/Mohem/src/app/eit/eit-list/eit-list.component.ts new file mode 100644 index 00000000..ef6560c8 --- /dev/null +++ b/Mohem/src/app/eit/eit-list/eit-list.component.ts @@ -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); + } +} diff --git a/Mohem/src/app/eit/eit.module.ts b/Mohem/src/app/eit/eit.module.ts index 9faddf46..8a7977d6 100644 --- a/Mohem/src/app/eit/eit.module.ts +++ b/Mohem/src/app/eit/eit.module.ts @@ -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 { } diff --git a/Mohem/src/app/eit/home/home.component.ts b/Mohem/src/app/eit/home/home.component.ts index e6a1dd4d..c0665342 100644 --- a/Mohem/src/app/eit/home/home.component.ts +++ b/Mohem/src/app/eit/home/home.component.ts @@ -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(); } } diff --git a/Mohem/src/app/eit/models/EITTransactionsReq.ts b/Mohem/src/app/eit/models/EITTransactionsReq.ts new file mode 100755 index 00000000..b7921767 --- /dev/null +++ b/Mohem/src/app/eit/models/EITTransactionsReq.ts @@ -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; + +} \ No newline at end of file diff --git a/Mohem/src/app/eit/models/add.eit.response.ts b/Mohem/src/app/eit/models/add.eit.response.ts new file mode 100755 index 00000000..b54537a7 --- /dev/null +++ b/Mohem/src/app/eit/models/add.eit.response.ts @@ -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; +} + diff --git a/Mohem/src/app/eit/models/eit.request.ts b/Mohem/src/app/eit/models/eit.request.ts new file mode 100755 index 00000000..cc9d4311 --- /dev/null +++ b/Mohem/src/app/eit/models/eit.request.ts @@ -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[]; +} \ No newline at end of file diff --git a/Mohem/src/app/eit/models/eit.response.model.ts b/Mohem/src/app/eit/models/eit.response.model.ts new file mode 100755 index 00000000..bd6f4a5d --- /dev/null +++ b/Mohem/src/app/eit/models/eit.response.model.ts @@ -0,0 +1,6 @@ +export class EitRespModel { + P_ITEM_KEY: string; + P_RETURN_MSG:string; + P_RETURN_STATUS:string; + P_TRANSACTION_ID:number; +} \ No newline at end of file diff --git a/Mohem/src/app/eit/models/eit.transaction.model.ts b/Mohem/src/app/eit/models/eit.transaction.model.ts new file mode 100755 index 00000000..aa65466a --- /dev/null +++ b/Mohem/src/app/eit/models/eit.transaction.model.ts @@ -0,0 +1,7 @@ +export class EitTransactionModel { + TRANSACTION_NUMBER: number; + NUMBER_VALUE: number; + NAME: string; + DATE_VALUE: string; + VARCHAR2_VALUE: string; +} \ No newline at end of file diff --git a/Mohem/src/app/eit/models/submit.eit.action.ts b/Mohem/src/app/eit/models/submit.eit.action.ts new file mode 100755 index 00000000..80b4cb28 --- /dev/null +++ b/Mohem/src/app/eit/models/submit.eit.action.ts @@ -0,0 +1,6 @@ +// tslint:disable-next-line:class-name +export enum EIT_ACTION { + ADD = 1, + DELETE = 2, + UPDATE=3 +} diff --git a/Mohem/src/app/eit/services/eit.service.ts b/Mohem/src/app/eit/services/eit.service.ts index 6c1cfcac..86d089d6 100644 --- a/Mohem/src/app/eit/services/eit.service.ts +++ b/Mohem/src/app/eit/services/eit.service.ts @@ -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 { + 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 { + 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 { + 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 { + 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 { + 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 { + const request = DefaultValueReq; + this.authService.authenticateRequest(request); + return this.con.post(EitService.getDefaultValue, request, onError, errorLabel); + } + } diff --git a/Mohem/src/app/hmg-common/services/common/common.service.ts b/Mohem/src/app/hmg-common/services/common/common.service.ts index dad0721e..526a05f6 100644 --- a/Mohem/src/app/hmg-common/services/common/common.service.ts +++ b/Mohem/src/app/hmg-common/services/common/common.service.ts @@ -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; + } + } diff --git a/Mohem/src/app/hmg-common/services/models/request.ts b/Mohem/src/app/hmg-common/services/models/request.ts index 6da4a70d..2ff1aed9 100644 --- a/Mohem/src/app/hmg-common/services/models/request.ts +++ b/Mohem/src/app/hmg-common/services/models/request.ts @@ -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; } diff --git a/Mohem/src/app/uI-elements/select.input.ts b/Mohem/src/app/uI-elements/select.input.ts index d7e6079c..c0716ddb 100644 --- a/Mohem/src/app/uI-elements/select.input.ts +++ b/Mohem/src/app/uI-elements/select.input.ts @@ -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 = - // "
" + - // "" + - // "" + - // "
"; + "
" + + "" + + "" + + "
"; - "" + - "" + this.label + "" + - "" + - "" + this.value + "" + - "" + - " "; + // "" + + // "" + this.label + "" + + // "" + + // "" + this.value + "" + + // "" + + // " "; return template; } diff --git a/Mohem/src/assets/localization/i18n.json b/Mohem/src/assets/localization/i18n.json index 67bf868d..b45e33e6 100644 --- a/Mohem/src/assets/localization/i18n.json +++ b/Mohem/src/assets/localization/i18n.json @@ -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": "تحديث" } } } \ No newline at end of file