From 9e509e143fd04e6b50d850828674bed9f54eb7c9 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Sat, 26 Jun 2021 14:15:06 +0300 Subject: [PATCH] user profile --- Mohem/src/app/app.scss | 2 +- .../src/app/eit/models/eit-address.request.ts | 14 + Mohem/src/app/eit/models/eit.request.ts | 1 + .../services/common/common.service.ts | 15 +- .../item-details/item-details.component.scss | 1 + .../add-address/add-address.component.html | 37 +- .../add-address/add-address.component.scss | 44 + .../add-address/add-address.component.ts | 1627 ++++++++++++++++- .../src/app/profile/home/home.component.html | 21 +- .../src/app/profile/home/home.component.scss | 6 + Mohem/src/app/profile/home/home.component.ts | 48 +- Mohem/src/app/profile/profile.module.ts | 37 +- .../app/profile/service/profile.service.ts | 68 +- 13 files changed, 1852 insertions(+), 69 deletions(-) create mode 100644 Mohem/src/app/eit/models/eit-address.request.ts diff --git a/Mohem/src/app/app.scss b/Mohem/src/app/app.scss index cc3da01e..e91e3666 100644 --- a/Mohem/src/app/app.scss +++ b/Mohem/src/app/app.scss @@ -12,7 +12,7 @@ .alert-tappable.sc-ion-alert-md, .alert-tappable.sc-ion-alert-ios { - height: 70px; + height: 50px; } .main-badge{ position: absolute; diff --git a/Mohem/src/app/eit/models/eit-address.request.ts b/Mohem/src/app/eit/models/eit-address.request.ts new file mode 100644 index 00000000..3254b52f --- /dev/null +++ b/Mohem/src/app/eit/models/eit-address.request.ts @@ -0,0 +1,14 @@ + +import { EitTransactionModel } from './eit.transaction.model'; + +export class EitAddressRequest { + 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[]; + P_COUNTRY_CODE: string + P_EFFECTIVE_DATE: string +} \ No newline at end of file diff --git a/Mohem/src/app/eit/models/eit.request.ts b/Mohem/src/app/eit/models/eit.request.ts index cc9d4311..51e746a5 100755 --- a/Mohem/src/app/eit/models/eit.request.ts +++ b/Mohem/src/app/eit/models/eit.request.ts @@ -8,4 +8,5 @@ export class EitRequest { 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/hmg-common/services/common/common.service.ts b/Mohem/src/app/hmg-common/services/common/common.service.ts index e0ab4cc0..6768e7d4 100644 --- a/Mohem/src/app/hmg-common/services/common/common.service.ts +++ b/Mohem/src/app/hmg-common/services/common/common.service.ts @@ -1099,16 +1099,16 @@ export class CommonService { public openChangePassword() { this.nav.navigateForward(['/authentication/changepassowrd']); } - + // public openProfile() { // this.nav.navigateForward(['/profile/home']); // } public openProfile(target: any) { const navigationExtras: NavigationExtras = { - queryParams: { - targetValue: target - } + queryParams: { + targetValue: target + } }; this.nav.navigateForward(['/profile/home'], navigationExtras); } @@ -1138,11 +1138,11 @@ export class CommonService { public openHRRequestFormPage() { this.nav.navigateForward(['/mowadhafi/hr-request-form']); } - public openRequestDetailsPage() { + public openRequestDetailsPage() { this.nav.navigateForward(['/mowadhafi/request-details']); } - + public openPage(link: string) { this.nav.navigateForward([link]); @@ -1244,6 +1244,9 @@ export class CommonService { public openEditprofile() { this.nav.navigateForward(['/profile/editProfile']); } + public openAddAddress() { + this.nav.navigateForward(['/profile/add-address']); + } public openPerformanceevaluation() { this.nav.navigateForward(['/profile/performanceevaluation']); } diff --git a/Mohem/src/app/itemforsale/item-details/item-details.component.scss b/Mohem/src/app/itemforsale/item-details/item-details.component.scss index f20e56fc..60f81f96 100644 --- a/Mohem/src/app/itemforsale/item-details/item-details.component.scss +++ b/Mohem/src/app/itemforsale/item-details/item-details.component.scss @@ -32,4 +32,5 @@ ion-card-header{ } .details-button ion-button{ --background: #565656; + width: 125px; } \ No newline at end of file diff --git a/Mohem/src/app/profile/add-address/add-address.component.html b/Mohem/src/app/profile/add-address/add-address.component.html index 68757de5..1db8fcc7 100644 --- a/Mohem/src/app/profile/add-address/add-address.component.html +++ b/Mohem/src/app/profile/add-address/add-address.component.html @@ -1,3 +1,34 @@ -

- add-address works! -

+ + + + + + + + {{ts.trPK('general','country')}} + + {{country.COUNTRY_NAME}} + + + + + + Effective Date + + +
+
+
+ + +
+ + {{'vacation-rule, next-label' | translate}} +
+
\ No newline at end of file diff --git a/Mohem/src/app/profile/add-address/add-address.component.scss b/Mohem/src/app/profile/add-address/add-address.component.scss index e69de29b..e2348ac3 100644 --- a/Mohem/src/app/profile/add-address/add-address.component.scss +++ b/Mohem/src/app/profile/add-address/add-address.component.scss @@ -0,0 +1,44 @@ +.footer-button { + border-radius: 2px; + padding: 0 1.1em; + min-height: 45px; + min-width: 200px; + } + + ion-label { + color: var(--customnavy) !important; + } + + .daynamicForm-Label { + font-size: 16px; + color: #a2a5a6 !important; + display: block; + overflow: hidden; + -webkit-flex: 1; + flex: 1; + font-size: inherit; + white-space: normal; + padding: 5px 0px; + margin: 10px auto; + padding-left: 10px; + } + + + .header-toolbar-new{ + --background: #269DB8; + } + .addEitOkButton{ + white-space: normal !important; + text-transform: capitalize !important; + min-height: 45px !important; + min-width: 5px !important; + margin: 8px !important; + background-color: #269DB8; + width: 80% !important; + color: white!important; + border-radius: 16px !important; + } + .country{ + margin-top: 10px; + padding: 10px; + } \ No newline at end of file diff --git a/Mohem/src/app/profile/add-address/add-address.component.ts b/Mohem/src/app/profile/add-address/add-address.component.ts index 4283c002..532fccf0 100644 --- a/Mohem/src/app/profile/add-address/add-address.component.ts +++ b/Mohem/src/app/profile/add-address/add-address.component.ts @@ -1,4 +1,32 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'; +import { DatePicker } from '@ionic-native/date-picker/ngx'; +import { ModalController } from '@ionic/angular'; +import * as moment from 'moment'; +import { AccrualService } from 'src/app/accrual-balances/services/accrual.service'; +import { AddEitComponent } from 'src/app/eit/add-eit/add-eit.component'; +import { AddEitResponse } from 'src/app/eit/models/add.eit.response'; +import { EitAddressRequest } from 'src/app/eit/models/eit-address.request'; +import { EitRequest } from 'src/app/eit/models/eit.request'; +import { EITTransactionsRequest } from 'src/app/eit/models/EITTransactionsReq'; +import { EIT_ACTION } from 'src/app/eit/models/submit.eit.action'; +import { EitService } from 'src/app/eit/services/eit.service'; +import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service'; +import { AuthenticatedUser } from 'src/app/hmg-common/services/authentication/models/authenticated-user'; +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response'; +import { MenuEntry } from 'src/app/hmg-common/services/menu/models/menu.entry'; +import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; +import { EITNotificatonBodyResponse } from 'src/app/notification/models/EITNotificationBodyRes'; +import { ButtonInput } from 'src/app/uI-elements/button.input'; +import { DateTimeInput } from 'src/app/uI-elements/date-time.input'; +import { DateInput } from 'src/app/uI-elements/date.input'; +import { HiddenInput } from 'src/app/uI-elements/hidden.input'; +import { NumberInput } from 'src/app/uI-elements/number.input'; +import { SelectInput } from 'src/app/uI-elements/select.input'; +import { TextAreaInput } from 'src/app/uI-elements/text-area.input'; +import { TextInput } from 'src/app/uI-elements/text.input'; +import { TimeInput } from 'src/app/uI-elements/time.input'; +import { ProfileService } from '../service/profile.service'; @Component({ selector: 'app-add-address', @@ -6,9 +34,1602 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./add-address.component.scss'], }) export class AddAddressComponent implements OnInit { + public countries: any = []; + @ViewChild("containerDiv") containerDiv: ElementRef; - constructor() { } + ////*new add*///// + getPassNotificationDetails: any; + getPassdirfromNotifiPage: boolean = false; + functionName: string = ""; + menuType: any; + ///////////////// - ngOnInit() {} + 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: EitAddressRequest; + 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; + direction: string; + country: any = 'SA'; + public effectiveDate: any; + constructor( + public modalController: ModalController, + public cs: CommonService, + private ts: TranslatorService, + private eitService: EitService, + public datePicker: DatePicker, + public profileService: ProfileService + ) { + this.direction = TranslatorService.getCurrentLanguageName(); + 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); + // console.log("addEITData: " + this.addEITData); + // console.log("dirfromNotificationPage: " + this.addEITData.dirfromNotificationPage); + + this.eitRequest = new EitAddressRequest(); + + // this.buttonInput = new ButtonInput('btnSubmit', 'Submit', 'containerDiv', 'Y'); + + ////*new add*///// + /**********resubmit************ */ + // this.getPassNotificationDetails = this.cs.sharedService.getSharedData(EITNotificatonBodyResponse.NOT_WORKLIST, false);//WARINING + // 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) + this.getCountires(); + this.effectiveDate = new Date(); + } + + private getEitDffStructure() { + const body = { + P_FUNCTION_NAME: this.selMenu.GetMenuEntriesList.FUNCTION_NAME, + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, + P_MENU_TYPE: this.menuType, + P_SELECTED_RESP_ID: this.respID + // P_USER_NAME:this.userName + }; + this.profileService.getAddressDiffStructure(body).subscribe((result: any) => { + this.handleEitDffStructureResult(result); + }); + } + + handleEitDffStructureResult(result) { + if (result.GetAddressDffStructureList != null) { + this.eitResponse = result.GetAddressDffStructureList; + this.drawEitFields(result.GetAddressDffStructureList); + } + } + + private drawEitFields(feildsList) { + const containerId = "containerDiv"; + this.eitVALSettoCall = []; + for (let i = 0; i < feildsList.length; 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, + this.direction + ); + } 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, + this.direction + ); + } + // 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, + this.direction + ); + } 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, + this.direction + ); + } + 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, + "", + containerId, + feildsList[i].MOBILE_ENABLED, + feildsList[i].DISPLAY_FLAG, + feildsList[i].REQUIRED_FLAG, + this.direction + ); + } 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, + this.direction + ); + } + } + } else { + if (feildsList[i].READ_ONLY == "Y") { + 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 { + // 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() { + console.log("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_ID_COLUMN_NAME; + } + select.disabled = false; + } + } + + bindHtmlElemEvents(id, obj) { + const elem = document.getElementById(id); + console.log(elem); + console.log(obj); + const elemType = elem.tagName; + let changeEvent = "ionChange"; + + if (elemType == "SELECT") changeEvent = "change"; + + try { + // elem.addEventListener("change", (e) => { + elem.addEventListener(changeEvent, 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; + let isSelectElement: 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 (obj.VALIDATION_TYPE != "N" && obj.READ_ONLY == "N") { + isSelectElement = 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); + // console.log(elem); + // if(elem.dataset.hiddenval){ + // elem.dataset.hiddenval=""; + // return false; + // } + let obj = this.handleDefaultValueResult(result); + let val = obj.value; + let text = obj.text; + if (val == null) { val = ""; } + if (text == null) { text = ""; } + if (isStandardDate) { + console.log("isStandardDate"); + elem.value = this.cs.reverseFormatDate(val); + } else if (isStandardTimeDate) { + console.log("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) { + console.log("isStandardTime"); + if (val) { + elem.dataset.dtvalue = val; + elem.innerHTML = val; + elem.value = val; + } else { + elem.dataset.dtvalue = ""; + elem.innerHTML = ""; + } + } else { + if (isSelectElement) { + let elem = this.getSelectElementByName(segmentName); + elem = document.getElementById(elem), + //alert(elem.length); + // var firstoption = document.createElement("option"); + // firstoption.text = text; + // firstoption.value = val; + // elem.add(firstoption); + elem.value = val; + //elem.text=text; + + } else { + // console.log("else - " + elem.value); + elem.value = val; + elem.innerText = text; + elem.setAttribute("value", val); + // console.log("else - " + elem.value); + } + } + if (isHidden || isReadOnlyList) { + if (val) elem.dataset.colmText = val; + else elem.dataset.colmText = ""; + elem.value = text; + } + var event = new Event("ionChange"); + 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); + idColName = this.cs.formatDateNew(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; + } + + getSelectElementByName(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 elemID; + } + + 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: any; + // 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); + elemVal = this.cs.formatDate(elemVal); + } else if ( + this.eitResponse[i].FORMAT_TYPE == "I" && + this.eitResponse[i].DISPLAY_FLAG != "N" + ) { + //time + if (elemVal.length > 5) { + elemVal = elemVal.substring(11, 16); + } else { + elemVal = elemVal; + } + } + if (this.eitResponse[i].REQUIRED_FLAG == "Y" && !elemVal) { + elem.classList.add("requiredClassElm"); + //this.common.showRequiredMsg(); + return false; + } else { + elem.classList.remove("requiredClassElm"); + } + // if (elemVal != 'null'){ + varcharValue = elemVal; + //} else{ + // elemVal = null; + // } + 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= []; + // let today = new Date(this.Sdate); + // let day = today.getDate(); + // let month = today.getMonth() + 1; + // let year = today.getFullYear(); + // let todayDate = month + '/' + day + '/' + year; + // let effectiveDate = todayDate; + this.arrValues = this.getElementsValues(); + if (this.arrValues) { + this.eitRequest = { + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, + P_MENU_TYPE: this.selMenu.List_Menu.MENU_TYPE, + 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, + P_COUNTRY_CODE: this.country, + P_EFFECTIVE_DATE: '28-June-2021' + }; + + this.profileService + .submitAddressTransaction(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.modalController.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: [] }; + } + } + getCountires() { + + this.profileService.getCountries({}).subscribe((result) => { + console.log(result); + this.countries = result['GetCountriesList']; + }) + } } diff --git a/Mohem/src/app/profile/home/home.component.html b/Mohem/src/app/profile/home/home.component.html index 0731de70..5a8c0b15 100644 --- a/Mohem/src/app/profile/home/home.component.html +++ b/Mohem/src/app/profile/home/home.component.html @@ -367,7 +367,7 @@ - + + + + + + + Update + + + + Add + + + + + + \ No newline at end of file diff --git a/Mohem/src/app/profile/home/home.component.scss b/Mohem/src/app/profile/home/home.component.scss index 9a5f8f61..cfe18dd7 100644 --- a/Mohem/src/app/profile/home/home.component.scss +++ b/Mohem/src/app/profile/home/home.component.scss @@ -1069,4 +1069,10 @@ $actionBtnSize: 36px; letter-spacing: -0.64px; color: #2B353E; opacity: 1; +} +.update{ + --background: #20A169; background: white; width: 100%; +} +.add{ + --background: #00bcd4; background: white; width: 100%; } \ No newline at end of file diff --git a/Mohem/src/app/profile/home/home.component.ts b/Mohem/src/app/profile/home/home.component.ts index d3243e35..7359131a 100644 --- a/Mohem/src/app/profile/home/home.component.ts +++ b/Mohem/src/app/profile/home/home.component.ts @@ -32,12 +32,12 @@ export class HomeComponent implements OnInit { public editBasic = false; public editAddress = false; public targetValue: any; - public employeeBasicDetails: any = []; + public employeeBasicDetails: any = []; public fullName: string; public maritalStatus: string; public birthDate: any; public civilIdentityNumber: any; - + public employeeAdress: any = []; constructor( public ts: TranslatorService, public cs: CommonService, @@ -59,9 +59,9 @@ export class HomeComponent implements OnInit { this.targetValue = params.targetValue; if (this.targetValue === 'sideMenu') { this.personalInfoSegment = true; - } else if(this.targetValue === 'basicDetails') { + } else if (this.targetValue === 'basicDetails') { this.basicDetailsSegment = true; - } else if(this.targetValue === 'address') { + } else if (this.targetValue === 'address') { this.addressSegment = true; } else { this.personalInfoSegment = true; @@ -71,6 +71,7 @@ export class HomeComponent implements OnInit { ngOnInit() { this.getProfile(); + } public getBasicDetails() { @@ -83,16 +84,17 @@ export class HomeComponent implements OnInit { if (this.cs.validResponse(result)) { this.employeeBasicDetails = result.GetEmployeeBasicDetailsList; console.log(this.employeeBasicDetails); - for( let i = 0; i < this.employeeBasicDetails.length; i++ ){ - if (this.employeeBasicDetails[i].APPLICATION_COLUMN_NAME === 'FULL_NAME') { + this.getAddress(); + for (let i = 0; i < this.employeeBasicDetails.length; i++) { + if (this.employeeBasicDetails[i].APPLICATION_COLUMN_NAME === 'FULL_NAME') { this.fullName = this.employeeBasicDetails[i].SEGMENT_VALUE_DSP; - } else if (this.employeeBasicDetails[i].APPLICATION_COLUMN_NAME === 'MARITAL_STATUS') { + } else if (this.employeeBasicDetails[i].APPLICATION_COLUMN_NAME === 'MARITAL_STATUS') { this.maritalStatus = this.employeeBasicDetails[i].SEGMENT_VALUE_DSP; - } else if (this.employeeBasicDetails[i].APPLICATION_COLUMN_NAME === 'DATE_OF_BIRTH') { + } else if (this.employeeBasicDetails[i].APPLICATION_COLUMN_NAME === 'DATE_OF_BIRTH') { this.birthDate = this.employeeBasicDetails[i].SEGMENT_VALUE_DSP; - } else if (this.employeeBasicDetails[i].APPLICATION_COLUMN_NAME === 'NATIONAL_IDENTIFIER') { + } else if (this.employeeBasicDetails[i].APPLICATION_COLUMN_NAME === 'NATIONAL_IDENTIFIER') { this.civilIdentityNumber = this.employeeBasicDetails[i].SEGMENT_VALUE_DSP; - } + } } } }); @@ -152,8 +154,8 @@ export class HomeComponent implements OnInit { } } - public selectedSegment(segmentData){ - switch (segmentData){ + public selectedSegment(segmentData) { + switch (segmentData) { case "personal": this.personalInfoSegment = true; this.basicDetailsSegment = false; @@ -178,8 +180,8 @@ export class HomeComponent implements OnInit { } } - public allowEdit(allowVal){ - switch(allowVal){ + public allowEdit(allowVal) { + switch (allowVal) { case 1: this.editBasic = true; break; @@ -189,8 +191,8 @@ export class HomeComponent implements OnInit { } } - public disableEdit(disableVal){ - switch(disableVal){ + public disableEdit(disableVal) { + switch (disableVal) { case 1: this.editBasic = false; break; @@ -211,5 +213,19 @@ export class HomeComponent implements OnInit { updateImageProfile() { this.cs.openChangeImagePage(); } + getAddress() { + const body = { + P_SELECTED_EMPLOYEE_NUMBER: this.personalInfo.EMPLOYEE_NUMBER, + P_MENU_TYPE: "E", + P_SELECTED_RESP_ID: -999 + }; + this.profileService.getEmployeeAddress(body).subscribe((result) => { + console.log(result); + this.employeeAdress = result.GetEmployeeAddressList; + }) + } + openAddAddress() { + this.cs.openAddAddress(); + } } diff --git a/Mohem/src/app/profile/profile.module.ts b/Mohem/src/app/profile/profile.module.ts index c77c723e..0dc9ee50 100644 --- a/Mohem/src/app/profile/profile.module.ts +++ b/Mohem/src/app/profile/profile.module.ts @@ -11,11 +11,13 @@ import { NgxChartsModule } from '@swimlane/ngx-charts'; import { ProfilePage } from './profile.page'; import { HomeComponent } from './home/home.component'; -import {EditProfileComponent} from './edit-profile/edit-profile.component'; -import {ProfileImageComponent} from './profile-image/profile-image.component' -import {PerformanceEvaluationComponent} from './performance-evaluation/performance-evaluation.component' +import { EditProfileComponent } from './edit-profile/edit-profile.component'; +import { ProfileImageComponent } from './profile-image/profile-image.component' +import { PerformanceEvaluationComponent } from './performance-evaluation/performance-evaluation.component' import { from } from 'rxjs'; import { EditDetailProfileComponent } from './modal/edit-detail-profile/edit-detail-profile.component'; +import { AddAddressComponent } from './add-address/add-address.component'; +import { DatePicker } from '@ionic-native/date-picker/ngx'; const routes: Routes = [ { @@ -23,8 +25,12 @@ const routes: Routes = [ component: ProfilePage, children: [ { - path: 'home', - component: HomeComponent + path: 'home', + component: HomeComponent + }, + { + path: 'add-address', + component: AddAddressComponent } ], }, @@ -33,11 +39,11 @@ const routes: Routes = [ component: ProfilePage, children: [ { - path: 'profileImg', - component: ProfileImageComponent + path: 'profileImg', + component: ProfileImageComponent } ], - + }, { @@ -45,8 +51,8 @@ const routes: Routes = [ component: ProfilePage, children: [ { - path: 'editprofile', - component: EditProfileComponent + path: 'editprofile', + component: EditProfileComponent } ], }, @@ -56,8 +62,8 @@ const routes: Routes = [ component: ProfilePage, children: [ { - path: 'performanceevaluation', - component: PerformanceEvaluationComponent + path: 'performanceevaluation', + component: PerformanceEvaluationComponent } ], }, @@ -73,7 +79,8 @@ const routes: Routes = [ NgxChartsModule, RouterModule.forChild(routes) ], - declarations: [ProfilePage ,EditDetailProfileComponent, HomeComponent,ProfileImageComponent,EditProfileComponent,PerformanceEvaluationComponent], - entryComponents:[EditDetailProfileComponent] + declarations: [ProfilePage, EditDetailProfileComponent, AddAddressComponent, HomeComponent, ProfileImageComponent, EditProfileComponent, PerformanceEvaluationComponent], + entryComponents: [EditDetailProfileComponent], + providers: [DatePicker] }) -export class ProfilePageModule {} +export class ProfilePageModule { } diff --git a/Mohem/src/app/profile/service/profile.service.ts b/Mohem/src/app/profile/service/profile.service.ts index cc7fc012..9c52d8b9 100644 --- a/Mohem/src/app/profile/service/profile.service.ts +++ b/Mohem/src/app/profile/service/profile.service.ts @@ -6,29 +6,53 @@ import { AuthenticationService } from "src/app/hmg-common/services/authenticatio providedIn: 'root' }) export class ProfileService { - public static updateEmpImage ="Services/ERP.svc/REST/UPDATE_EMPLOYEE_IMAGE"; - public static getEmployeeBasicDetails ="Services/ERP.svc/REST/GET_EMPLOYEE_BASIC_DETAILS"; + public static updateEmpImage = "Services/ERP.svc/REST/UPDATE_EMPLOYEE_IMAGE"; + public static getEmployeeBasicDetails = "Services/ERP.svc/REST/GET_EMPLOYEE_BASIC_DETAILS"; + public static getEmployeeAddress = "Services/ERP.svc/REST/GET_EMPLOYEE_ADDRESS"; + public static getCountries = "Services/ERP.svc/REST/GET_COUNTRIES"; + public static getDiffStructure = "Services/ERP.svc/REST/GET_ADDRESS_DFF_STRUCTURE" + public static submitAddressTransactions = "Services/ERP.svc/REST/SUBMIT_ADDRESS_TRANSACTION" + constructor( + public api: ConnectorService, + public authService: AuthenticationService + ) { } - constructor( - public api: ConnectorService, - public authService: AuthenticationService - ) {} + public updateImageProfile(updateImgRequest: any, onError?: any, errorLabel?: string + ): Observable { + const request = updateImgRequest; + this.authService.authenticateRequest(request); + return this.api.post( + ProfileService.updateEmpImage, + request, + onError, + errorLabel + ); + } - public updateImageProfile( updateImgRequest: any,onError?: any,errorLabel?: string - ): Observable { - const request = updateImgRequest; - this.authService.authenticateRequest(request); - return this.api.post( - ProfileService.updateEmpImage, - request, - onError, - errorLabel - ); - } + public getEmployeeBasicDetails(basicEmployeeDetailsRequest: any, onError?: any, errorLabel?: string): Observable { + const request = basicEmployeeDetailsRequest; + this.authService.authenticateRequest(request); + return this.api.post(ProfileService.getEmployeeBasicDetails, request, onError, errorLabel); + } + public getEmployeeAddress(basicEmployeeDetailsRequest: any, onError?: any, errorLabel?: string): Observable { + const request = basicEmployeeDetailsRequest; + this.authService.authenticateRequest(request); + return this.api.post(ProfileService.getEmployeeAddress, request, onError, errorLabel); + } + public getCountries(basicEmployeeDetailsRequest: any, onError?: any, errorLabel?: string): Observable { + const request = basicEmployeeDetailsRequest; + this.authService.authenticateRequest(request); + return this.api.post(ProfileService.getCountries, request, onError, errorLabel); + } + public getAddressDiffStructure(basicEmployeeDetailsRequest: any, onError?: any, errorLabel?: string): Observable { + const request = basicEmployeeDetailsRequest; + this.authService.authenticateRequest(request); + return this.api.post(ProfileService.getDiffStructure, request, onError, errorLabel); + } + public submitAddressTransaction(validateEITTransactionReq: any, onError?: any, errorLabel?: string): Observable { + const request = validateEITTransactionReq; + this.authService.authenticateRequest(request); + return this.api.post(ProfileService.submitAddressTransactions, request, onError, errorLabel); + } - public getEmployeeBasicDetails(basicEmployeeDetailsRequest: any, onError?: any, errorLabel?: string): Observable { - const request = basicEmployeeDetailsRequest; - this.authService.authenticateRequest(request); - return this.api.post(ProfileService.getEmployeeBasicDetails, request, onError, errorLabel); - } } \ No newline at end of file