diff --git a/Mohem/src/app/eit/add-cei/add-cei.component.html b/Mohem/src/app/eit/add-cei/add-cei.component.html index bda6751d..6a1c1bc0 100644 --- a/Mohem/src/app/eit/add-cei/add-cei.component.html +++ b/Mohem/src/app/eit/add-cei/add-cei.component.html @@ -1,3 +1,24 @@ -

- add-cei works! -

+ + + + + + + {{'vacation-rule, effectiveDate' | translate}} + {{showEffectiveDate}} + +
+
+
+ + +
+ + {{'vacation-rule, next-label' | translate}} +
+
\ No newline at end of file diff --git a/Mohem/src/app/eit/add-cei/add-cei.component.scss b/Mohem/src/app/eit/add-cei/add-cei.component.scss index e69de29b..a6dbf815 100644 --- a/Mohem/src/app/eit/add-cei/add-cei.component.scss +++ b/Mohem/src/app/eit/add-cei/add-cei.component.scss @@ -0,0 +1,45 @@ +.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/eit/add-cei/add-cei.component.ts b/Mohem/src/app/eit/add-cei/add-cei.component.ts index de223c5d..13195626 100644 --- a/Mohem/src/app/eit/add-cei/add-cei.component.ts +++ b/Mohem/src/app/eit/add-cei/add-cei.component.ts @@ -1,14 +1,1561 @@ -import { Component, OnInit } from '@angular/core'; - +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 { CeiRequest } from "../models/cei.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 { AddCeiResponse } from "../models/add.cei.response"; +import { EITNotificatonBodyResponse } from "../models/EITNotificationBodyRes"; @Component({ selector: 'app-add-cei', templateUrl: './add-cei.component.html', styleUrls: ['./add-cei.component.scss'], }) export class AddCeiComponent 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 ceiResponse: any; + + private eitVALSettoCall: any = []; + private comtransNo: number = 0; + // private parentChilds: any[]; + getPassMnuEntryObj: MenuEntry; + selMenu: MenuResponse; + eitSubmitAction: number = 0; //not submit + private ceiRequest: CeiRequest; + private validateEitObj: any = []; + private ExtraObj: any = {}; + private arrValues: any = []; + selEmp: string; + respID: number; + headerTitle: string = ""; + isResubmit: boolean = false; + private updatedValues: any = []; + addEITData: any; + direction:string; + public showEffectiveDate: string = moment(new Date).format("DD-MM-YYYY"); + public selectedContactData: any; + + + constructor( + public modalController: ModalController, + public cs: CommonService, + private ts: TranslatorService, + private eitService: EitService, + public datePicker: DatePicker + ) { + this.direction = TranslatorService.getCurrentLanguageName(); + this.selectedContactData = this.cs.sharedService.getSharedData('selectedContactFORChildEducation', 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.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.ceiRequest = new CeiRequest(); + - constructor() { } + ////*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() { + this.getCEIDffStructure(); + } + + private getCEIDffStructure() { + const body = { + P_FUNCTION_NAME: this.functionName, + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, + P_MENU_TYPE: this.menuType, + P_SELECTED_RESP_ID: this.respID + }; + this.eitService.getCEIDFFStrutre(body).subscribe((result: any) => { + this.handleCEIDffStructureResult(result); + }); + } + + handleCEIDffStructureResult(result) { + if (result.GetCEIDFFStructureList != null) { + this.ceiResponse = result.GetCEIDFFStructureList; + this.drawCEIFields(result.GetCEIDFFStructureList); + } + } + + private drawCEIFields(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.ceiResponse.length; i++) { + if (this.ceiResponse[i].SEGMENT_NAME == segmentName) { + eitObj = this.ceiResponse[i]; + if ( + this.ceiResponse[i].READ_ONLY == "Y" || + this.ceiResponse[i].DISPLAY_FLAG == "N" + ) { + return false; + } + elemID = this.ceiResponse[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.ceiResponse.length; i++) { + if (this.ceiResponse[i].SEGMENT_NAME == element) { + this.getDefaultValue( + this.ceiResponse[i], + this.ceiResponse[i].DESC_FLEX_NAME, + this.ceiResponse[i].DESC_FLEX_CONTEXT_CODE, + this.ceiResponse[i].SEGMENT_NAME, + this.ceiResponse[i].PARENT_SEGMENTS_VS_SplitedVS, + this.ceiResponse[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.ceiResponse.length; i++) { + if (this.ceiResponse[i].SEGMENT_NAME == parentValue[0].Name) { + if (this.ceiResponse[i].VALIDATION_TYPE == "N") { + let val = (document.getElementById( + this.ceiResponse[i].APPLICATION_COLUMN_NAME + ) as HTMLInputElement).value; + return val; + } else { + let x = document.getElementById( + this.ceiResponse[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.ceiResponse.length; i++) { + if (this.ceiResponse[i].SEGMENT_NAME == segmentName) { + descFlexName = this.ceiResponse[i].DESC_FLEX_NAME; + descFlexContextCode = this.ceiResponse[i].DESC_FLEX_CONTEXT_CODE; + parentValue = this.ceiResponse[i].PARENT_SEGMENTS_VS_SplitedVS; + ParentsList = this.ceiResponse[i].PARENT_SEGMENTS_VS_SplitedVS; + validationType = this.ceiResponse[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.ceiResponse.length; j++) { + if (this.ceiResponse[j].SEGMENT_NAME == parentsList[i].Name) { + if (this.ceiResponse[j].DISPLAY_FLAG != "N") { + if (this.ceiResponse[j].VALIDATION_TYPE == "N") { + let idColName: string; + let val: any; + if ( + this.ceiResponse[j].FORMAT_TYPE == "Y" || + this.ceiResponse[j].FORMAT_TYPE == "I" + ) { + //standard date time or //time + let elem = document.getElementById( + this.ceiResponse[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.ceiResponse[j].FORMAT_TYPE == "Y") + idColName = this.cs.formatStandardDate(val); + } else { + val = (document.getElementById( + this.ceiResponse[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.ceiResponse[j].FORMAT_TYPE == "X") { + //date + // idColName = this.cs.formatDate(val); + idColName = this.cs.formatDateNew(val); + } + } + parentArr.push({ + SEGMENT_NAME: this.ceiResponse[j].SEGMENT_NAME, + VALUE_COLUMN_NAME: val, + DESCRIPTION: "", + ID_COLUMN_NAME: idColName, + FLEX_VALUE_SET_NAME: this.ceiResponse[j].FLEX_VALUE_SET_NAME + }); + break; + } else { + if (this.ceiResponse[j].READ_ONLY != "Y") { + let x = document.getElementById( + this.ceiResponse[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.ceiResponse[j].SEGMENT_NAME, + VALUE_COLUMN_NAME: text, + DESCRIPTION: "", + ID_COLUMN_NAME: val, + FLEX_VALUE_SET_NAME: this.ceiResponse[j].FLEX_VALUE_SET_NAME + }); + break; + } else { + let x = document.getElementById( + this.ceiResponse[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.ceiResponse[j].SEGMENT_NAME, + VALUE_COLUMN_NAME: text, + DESCRIPTION: "", + ID_COLUMN_NAME: val, + FLEX_VALUE_SET_NAME: this.ceiResponse[j].FLEX_VALUE_SET_NAME + }); + break; + } + } + } else { + let x = document.getElementById( + this.ceiResponse[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.ceiResponse[j].SEGMENT_NAME, + VALUE_COLUMN_NAME: text, + DESCRIPTION: "", + ID_COLUMN_NAME: val, + FLEX_VALUE_SET_NAME: this.ceiResponse[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.ceiResponse.length; i++) { + if (this.ceiResponse[i].REQUIRED_FLAG == "Y") { + let elemVal = (document.getElementById( + this.ceiResponse[i].APPLICATION_COLUMN_NAME + ) as HTMLInputElement).value; + if (elemVal == "") { + //alert(this.ceiResponse[i].SEGMENT_NAME+" is required"); + break; + } + } + } + } + + getElementByName(segmentName) { + let elemID: any = ""; + for (let i = 0; i < this.ceiResponse.length; i++) { + if (this.ceiResponse[i].SEGMENT_NAME == segmentName) { + elemID = this.ceiResponse[i].APPLICATION_COLUMN_NAME; + break; + } + } + return document.getElementById(elemID) as HTMLInputElement; + } + + getSelectElementByName(segmentName) { + let elemID: any = ""; + for (let i = 0; i < this.ceiResponse.length; i++) { + if (this.ceiResponse[i].SEGMENT_NAME == segmentName) { + elemID = this.ceiResponse[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.ceiResponse.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.ceiResponse.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.ceiResponse[i].APPLICATION_COLUMN_NAME + ); + let y = updatedObj; + transNo = y.TRANSACTION_NUMBER; // set the transaction number for all items in the updated loop + } + if (this.ceiResponse[i].DISPLAY_FLAG != "N") { + if (this.ceiResponse[i].VALIDATION_TYPE == "N") { + let elem = document.getElementById( + this.ceiResponse[i].APPLICATION_COLUMN_NAME + ) as HTMLInputElement; + let elemVal = (document.getElementById( + this.ceiResponse[i].APPLICATION_COLUMN_NAME + ) as HTMLInputElement).value; + textValue = elemVal; + //let elemVal= (document.getElementById(this.ceiResponse[i].APPLICATION_COLUMN_NAME)).value; + if ( + this.ceiResponse[i].FORMAT_TYPE == "X" && + this.ceiResponse[i].DISPLAY_FLAG != "N" + ) { + //date + elemVal = this.cs.formatDate(elemVal); + } else if ( + this.ceiResponse[i].FORMAT_TYPE == "Y" && + this.ceiResponse[i].DISPLAY_FLAG != "N" + ) { + //standard date time + // elemVal = elem.dataset.dtvalue; + // elemVal = this.cs.formatStandardDate(elemVal); + elemVal = this.cs.formatDate(elemVal); + } else if ( + this.ceiResponse[i].FORMAT_TYPE == "I" && + this.ceiResponse[i].DISPLAY_FLAG != "N" + ) { + //time + if(elemVal.length>5){ + elemVal = elemVal.substring(11, 16); + }else{ + elemVal = elemVal; + } + } + if (this.ceiResponse[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.ceiResponse[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + }); + } else { + let x = document.getElementById( + this.ceiResponse[i].APPLICATION_COLUMN_NAME + ) as HTMLSelectElement; + if (this.ceiResponse[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.ceiResponse[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.ceiResponse[i].APPLICATION_COLUMN_NAME, + VARCHAR2_VALUE: varcharValue, + NUMBER_VALUE: numbervalue, + DATE_VALUE: dateValue + }); + } //end else + } else { + let x = document.getElementById( + this.ceiResponse[i].APPLICATION_COLUMN_NAME + ) as HTMLSelectElement; + let val = x.dataset.colmText; + textValue = x.value; + if (this.ceiResponse[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.ceiResponse[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.ceiResponse[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.ceiResponse[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.ceiResponse[i] + .APPLICATION_COLUMN_NAME, + DATATYPE: this.ceiResponse[i].DATATYPE, + DESC_FLEX_CONTEXT_CODE: this.ceiResponse[i].DESC_FLEX_CONTEXT_CODE, + DESC_FLEX_NAME: this.ceiResponse[i].DESC_FLEX_NAME, + DISPLAY_FLAG: this.ceiResponse[i].DISPLAY_FLAG, + SEGMENT_NAME: this.ceiResponse[i].SEGMENT_NAME, + SEGMENT_PROMPT: this.ceiResponse[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.ceiRequest.EITTransactionTBL; + this.ceiRequest.EITTransactionTBL = this.fixTransactionNo(list); + this.eitService + .submitChildEducation(this.ceiRequest) + .subscribe((result: AddCeiResponse) => { + 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; + } + + + public handleSubmitEitResult(result) { + if (this.cs.validResponse(result)) { + this.cs.sharedService.setSharedData(this.ceiRequest, CeiRequest.SHARED_DATA); + this.cs.sharedService.setSharedData(result, AddCeiResponse.SHARED_DATA); + this.cs.openConfirmCEIPage(); + } + } + + public submitChildEducationTransaction() { + this.arrValues = this.getElementsValues(); + if (this.arrValues) { + this.ceiRequest = { + P_SELECTED_EMPLOYEE_NUMBER: this.selEmp, + P_MENU_TYPE: this.menuType, + P_SELECTED_RESP_ID: this.respID, + P_FUNCTION_NAME: this.functionName, + P_CONTACT_RELATIONSHIP_ID: this.selectedContactData.CONTACT_RELATIONSHIP_ID, + P_DESC_FLEX_CONTEXT_CODE: this.ceiResponse[0].DESC_FLEX_CONTEXT_CODE, + EITTransactionTBL: this.arrValues + }; + + this.eitService.submitChildEducation(this.ceiRequest).subscribe((result: any) => { + this.handleSubmitEitResult(result); + }); + } + } } + diff --git a/Mohem/src/app/eit/cei-homepage/cei-homepage.component.html b/Mohem/src/app/eit/cei-homepage/cei-homepage.component.html index f5eb6475..df5fbc20 100644 --- a/Mohem/src/app/eit/cei-homepage/cei-homepage.component.html +++ b/Mohem/src/app/eit/cei-homepage/cei-homepage.component.html @@ -5,7 +5,7 @@
- + diff --git a/Mohem/src/app/eit/cei-homepage/cei-homepage.component.ts b/Mohem/src/app/eit/cei-homepage/cei-homepage.component.ts index 05483679..c69d0b8d 100644 --- a/Mohem/src/app/eit/cei-homepage/cei-homepage.component.ts +++ b/Mohem/src/app/eit/cei-homepage/cei-homepage.component.ts @@ -11,33 +11,37 @@ import { EitService } from '../services/eit.service'; export class CeiHomepageComponent implements OnInit { public familyMemberData; - public SelectedServiceType; + public selectedServiceType; public direction: string; myColor: string = 'secondary'; constructor( private eitService: EitService, public ts: TranslatorService, public cs: CommonService - ) { - this.eitService.getContactInfo({ - P_MENU_TYPE: 'E', - P_SELECTED_RESP_ID: -999 - }, () => { }, this.ts.trPK('general', 'retry')).subscribe((response) => { - if (this.cs.validResponse(response)) { - this.familyMemberData = response['GetEmployeeContactsList']; - this.SelectedServiceType = this.familyMemberData[0]; - console.log(this.familyMemberData); - } - }); - } + ) {} ngOnInit() { - this.direction = TranslatorService.getCurrentDirection(); + this.getContactInfo(); } - selectedUser(user){ - this.SelectedServiceType = user; + public getContactInfo () { + this.eitService.getContactInfo({ + P_MENU_TYPE: 'E', + P_SELECTED_RESP_ID: -999 + }, () => { }, this.ts.trPK('general', 'retry')).subscribe((response) => { + if (this.cs.validResponse(response)) { + this.familyMemberData = response['GetEmployeeContactsList']; + this.selectedServiceType = this.familyMemberData[0]; + console.log(this.familyMemberData); + } + }); + } + + public gotoTransactionsPage() { + console.log(this.selectedServiceType); + this.cs.sharedService.setSharedData(this.selectedServiceType, 'selectedContactFORChildEducation'); + this.cs.openCEIListPage(); } } diff --git a/Mohem/src/app/eit/cei-list/cei-list.component.html b/Mohem/src/app/eit/cei-list/cei-list.component.html new file mode 100644 index 00000000..31f62243 --- /dev/null +++ b/Mohem/src/app/eit/cei-list/cei-list.component.html @@ -0,0 +1,42 @@ + + + + +
+
+ + + +

{{'general, noData' | translate}}

+
+ +
+
+ +
+
+ +
+ + + +
+ +
+
+
+
+
+
+
+
+
+ +
+
+
+
+ diff --git a/Mohem/src/app/eit/cei-list/cei-list.component.scss b/Mohem/src/app/eit/cei-list/cei-list.component.scss new file mode 100644 index 00000000..28b2905f --- /dev/null +++ b/Mohem/src/app/eit/cei-list/cei-list.component.scss @@ -0,0 +1,330 @@ +.footer-button { + border-radius: 2px; + padding: 0 1.1em; + min-height: 45px; + min-width: 200px; + } + + .datetime{ + text-align: center; + font-family: WorkSans-Bold; + margin-left: 47px; + margin-top: -19px; + + } + .iconCalendar{ + margin-left: 30px !important; + width: 22% !important; + height: 26px !important; + margin-top: -69px !important; + margin-bottom: 20px !important; + } + h4 { + font-size: 2.2rem; + text-align: center; + color: #000000; + } + .grids{ + border-radius: 20px !important; + background: white; + padding-left: 1px; + padding-right: 1px; + margin: 13px; + padding-top: 0px; + padding-bottom: 3px; + padding-left: 13px; + padding-right: 13px; + border: 1px solid #cac8c8; + } + + .bgcolor { + + color: white; + border-top-right-radius: 19px; + border-top-left-radius: 15px; + padding-top: 1; + padding-bottom: 0; + margin-top: 0; + margin-bottom: 0; + /* border-radius: 12px !important; */ + background: #269DB8; + border-bottom: 1px solid #a7a4a4; + border-top: 1px solid #cac8c8; + margin-left: -13px; + margin-right: -13px; + } + .colEit{ + border-right: 1px solid #cac8c8; + border-bottom-left-radius: -10px !important; + padding-top: 8px; + padding-bottom: 8px; + margin-left: 18px; + font-size: 12px !important; + } + + .header-div { + + background-color: #269DB8; + text-transform: capitalize; + height: 160px; + // position: relative; + display: block; + margin-bottom: -28px; + } + + .header-toolbar-new{ + --background: #269DB8; + } + + .addClass{ + background-color: #269DB8; + width: 80px; + height: 80px; + right: 8%; + position: fixed; + color: white; + bottom: 5%; + border-radius: 50%; + z-index: 999; + -webkit-box-shadow: 2px -1px 13px 0px rgba(0,0,0,0.59); + -moz-box-shadow: 2px -1px 13px 0px rgba(0,0,0,0.59); + box-shadow: 2px -1px 13px 0px rgba(0,0,0,0.59); + } + + .contentEit:before { + position: absolute; + content: ""; + // background: #269DB8; + height: 140px; + width: 100%; + left: 0; + top: 0px; + z-index: 1; + } + + .hrClass{ + border-width: 0; + box-sizing: content-box; + border-bottom: 1px solid #e6e6e6; + background: #fff !important; + height: 1px; + } + + //////////////////////////////// + .content:before { + position: absolute; + content: ""; + background: #269DB8; + height: 140px; + width: 100%; + left: 0; + top: 0px; + z-index: 1; + } + + + .colorBG{ + --background: #f0efef; + } + + .Title{ + text-align: center; + color: white; + margin-top: -33px; + font-size: 17px; + } + .title{ + text-align: center; + color: black; + margin-top: 5px; + font-size: 17px; + } + .today-graph{ + display: block !important; + height: 196px; + width: 365px; + /* padding-left: 51px; */ + margin-left: 28px !important; + } + + .headerGrid{ + background-color: white !important; + border: 1px solid #cac8c8 !important; + padding-bottom: 53px; + padding-top: -30px; + margin-left: 13px; + margin-right: 13px; + margin-bottom: 10px; + position: relative; + z-index: 1; + border-radius: 20px; + margin-top: 17px; + } + .result-graph{ + font-size: 14px; + margin-left: -48px; + margin-right: 3px; + margin-bottom: -30px; + + + + } + + .green-label{ + font-size: 15px !important; + margin-left: 7px !important; + margin-right: 42px; + } + .green-label-ar{ + font-size: 15px !important; + margin-left: 7px !important; + margin-right: 15px; + } + .blue-label{ + font-size: 15px !important; + margin-left: 7px !important; + margin-right: 13px; + } + .light-label{ + font-size: 15px !important; + margin-left: 7px !important; + margin-right: -26px; + } + .light-label-ar{ + font-size: 15px !important; + margin-right: 7px !important; + margin-left: -26px; + } + + .light-dote{ + background-color: #3CB9D5; + width: 12px; + height: 12px; + border-radius: 50% !important; + display: inline-block; + } + .blue-dote{ + + background-color: #269DB8; + width: 12px; + height: 12px; + border-radius: 50% !important; + display: inline-block; + } + .green-dote{ + background-color: #1FA269; + width: 12px; + height: 12px; + border-radius: 50% !important; + display: inline-block; + margin-right: -1px; + } + .col{ + text-align: right; + } + + .gridService{ + + /* margin-top: 87px; */ + border-radius: 10px; + /* margin-bottom: -49px; */ + margin-left: 14px; + margin-right: 14px; + + } + .columns{ + margin: 3px; + margin-bottom: 13px; + background: white; + border-radius: 27px; + padding-left: 30px; + padding-right: 6px; + padding-top: 19px; + padding-bottom: 8px; + border: 1px solid #cac8c8 !important; + } + + + .service{ + font-size: 22px; + color: black; + letter-spacing: 1px; + font-weight: bold; + } + .services{ + + font-size: 12px; + color: black; + } + + .adult-dote{ + background-color: #3CB9D5; + width: 15px; + height: 15px; + border-radius: 50% !important; + display: inline-block; + margin-left: -17px; + margin-right: 5px; + } + + .adult-dote-ar{ + background-color: #3CB9D5; + width: 15px; + height: 15px; + border-radius: 50% !important; + display: inline-block; + margin-right: 0px; + margin-left: 5px; + } + .child-dote{ + + background-color: #269DB8; + width: 15px; + height: 15px; + border-radius: 50% !important; + display: inline-block; + margin-left: -17px; + margin-right: 5px; + } + .child-dote-ar{ + background-color: #269DB8; + width: 15px; + height: 15px; + border-radius: 50% !important; + display: inline-block; + margin-right: 1px; + margin-left: 5px; + } + .infants-dote{ + background-color: #1FA269; + width: 15px; + height: 15px; + border-radius: 50% !important; + display: inline-block; + margin-left: -17px; + margin-right: 5px; + // margin-bottom: 6px; + } + + .infants-dote-ar{ + background-color: #1FA269; + width: 15px; + height: 15px; + border-radius: 50% !important; + display: inline-block; + margin-right: 1px; + margin-left: 5px; + } + .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; + } + + \ No newline at end of file diff --git a/Mohem/src/app/eit/cei-list/cei-list.component.spec.ts b/Mohem/src/app/eit/cei-list/cei-list.component.spec.ts new file mode 100644 index 00000000..ef47a3a9 --- /dev/null +++ b/Mohem/src/app/eit/cei-list/cei-list.component.spec.ts @@ -0,0 +1,27 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CeiListComponent } from './cei-list.component'; + +describe('CeiListComponent', () => { + let component: CeiListComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ CeiListComponent ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(CeiListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/Mohem/src/app/eit/cei-list/cei-list.component.ts b/Mohem/src/app/eit/cei-list/cei-list.component.ts new file mode 100644 index 00000000..2b7aeec3 --- /dev/null +++ b/Mohem/src/app/eit/cei-list/cei-list.component.ts @@ -0,0 +1,127 @@ +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +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 { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service'; + +@Component({ + selector: 'app-cei-list', + templateUrl: './cei-list.component.html', + styleUrls: ['./cei-list.component.scss'], +}) +export class CeiListComponent implements OnInit { + Sdate: any; + emp_no: any; + balance:any; + P_PAGE_NUM: number; + P_PAGE_LIMIT: number; + IsReachEnd = false; + userName: any; + isDelete = false; + getResCEITransactionList: any = []; + eitAddedList: any = []; + getPassMnuEntryObj: any; + selMenu: MenuResponse = new MenuResponse(); + CEITransactionsListObj: EITTransactionsRequest = new EITTransactionsRequest(); + selEmp: string; + respID: number; + transactionNo = 0; + menuType = ''; + public functionName = ''; + private pAction = 0; + public headerTitle = ''; + data: any; + accrualNetInfants: any; + accrualUNetChild: any; + accrualNetAdult: any; + + public options = { + cutoutPercentage: 80, + tooltips: { enabled: false }, + legend: { display: false }}; + gaugeType = 'full'; + accrualBalancesList: any; + common: any; + direction: string; + + constructor( + private cs: CommonService, + private EITService: EitService, + public ts: TranslatorService, + public authService:AuthenticationService,) { + this.direction = TranslatorService.getCurrentLanguageName(); + 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.P_PAGE_NUM = 1; + this.P_PAGE_LIMIT = 100; + } + + ngOnInit() { + this.getCEITransactions(); + } + + + public getCEITransactions() { + this.IsReachEnd = false; + this.CEITransactionsListObj.P_PAGE_LIMIT = this.P_PAGE_LIMIT; + this.CEITransactionsListObj.P_PAGE_NUM = this.P_PAGE_NUM; + this.CEITransactionsListObj.P_SELECTED_EMPLOYEE_NUMBER = this.selEmp; + this.CEITransactionsListObj.P_SELECTED_RESP_ID = this.respID; + this.CEITransactionsListObj.P_MENU_TYPE = this.selMenu.List_Menu.MENU_TYPE; + this.CEITransactionsListObj.P_FUNCTION_NAME = this.getPassMnuEntryObj.FUNCTION_NAME; + this.EITService.getCEITransactionsList(this.CEITransactionsListObj). + subscribe((result: any) => { + this.handleCEITransactionsResult(result); + }); + } + + public handleCEITransactionsResult(result) { + if (this.cs.validResponse(result)) { + if (this.cs.hasData(result.GetEITTransactionList)) { + this.getResCEITransactionList = result.GetEITTransactionList; + this.P_PAGE_NUM++; + this.CEITransactionsListObj.P_PAGE_NUM = this.P_PAGE_NUM; + const lastItemIndex = this.getResCEITransactionList.length - 1; + if (result.GetEITTransactionList[lastItemIndex] && result.GetEITTransactionList[lastItemIndex].Collection_Transaction[0]) { + const lastitem = result.GetEITTransactionList[lastItemIndex].Collection_Transaction[0]; + // tslint:disable-next-line: triple-equals + if (lastitem.NO_OF_ROWS == lastitem.ROW_NUM) { + this.IsReachEnd = true; + } else { + this.IsReachEnd = false; + } + } + } + } + } + + public addCEIRrq(i?) { + this.pAction = EIT_ACTION.ADD; + this.cs.sharedService.setSharedData(this.pAction, EITTransactionsRequest.SUBMIT_EIT_ACTION); + this.openCEINew(i); + } + + openCEINew(index) { + let item: any = []; + if (this.pAction == EIT_ACTION.UPDATE) { + item = this.getResCEITransactionList[index].Collection_Transaction; + } + this.transactionNo++; + // tslint:disable-next-line: max-line-length + this.cs.sharedService.setSharedData({ dirfromNotificationPage: false, submitEITObjList: undefined, transNo: this.transactionNo }, 'AddEITData'); + this.cs.openAddCEIPage(); + } + +} + + + diff --git a/Mohem/src/app/eit/confirm-add-cei/confirm-add-cei.component.html b/Mohem/src/app/eit/confirm-add-cei/confirm-add-cei.component.html index f31f1941..6c5d2842 100644 --- a/Mohem/src/app/eit/confirm-add-cei/confirm-add-cei.component.html +++ b/Mohem/src/app/eit/confirm-add-cei/confirm-add-cei.component.html @@ -1,3 +1,127 @@ -

- confirm-add-cei works! -

+ + + + {{headerTitle}} + + + + + + + + + +
{{'general, addAttach' | translate}}
+
+ +
+ +
+
+
+ + + {{ 'general, notAttch' | translate}} + +
+ + +
+ + + + {{attachList.AttachmentID +1 }} . + + + + + {{attachList.P_FILE_NAME }} + + + + + + + +
+ +
+ +
+ + +
+
+ + {{attachRes.FILE_NAME }} + +
+ + + + +
+
+ +
+ + + +
{{'confirmAddEit, comment' | translate}}
+ + + +
+ + +
{{'confirmAddEit, approverList' | translate}}
+
+

{{ 'general, empty' | translate}}

+
+
+ +
+ + +
+
+ +
+
+ + + {{employee.APPROVER}} + + + {{employee.POSITION_TITLE}} + + + +
+
+
+
+
+ +
+ +
+ + +
+ + {{ (isDelete ? 'general, delete' : 'general, submit') | translate }} +
+
\ No newline at end of file diff --git a/Mohem/src/app/eit/confirm-add-cei/confirm-add-cei.component.ts b/Mohem/src/app/eit/confirm-add-cei/confirm-add-cei.component.ts index f9a1a620..2bbef54a 100644 --- a/Mohem/src/app/eit/confirm-add-cei/confirm-add-cei.component.ts +++ b/Mohem/src/app/eit/confirm-add-cei/confirm-add-cei.component.ts @@ -1,4 +1,19 @@ +import { WorkListAttachViewComponent } from './../../notification/work-list-attach-view/work-list-attach-view.component'; +import { AddAttachComponent } from './../add-attach/add-attach.component'; +import { NotificationGetAttachResponse } from './../models/NotificationGetAttachRes'; +import { EITNotificatonBodyResponse } from './../models/EITNotificationBodyRes'; +import { WorkListButtonRequest } from './../models/NotificationButtonReq'; +import { ApproversList } from './../../absence/models/approvers'; +import { CeiRequest } from './../models/cei.request'; import { Component, OnInit } from '@angular/core'; +import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response'; +import { ModalController } from '@ionic/angular'; +import { CommonService } from 'src/app/hmg-common/services/common/common.service'; +import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service'; +import { EitService } from '../services/eit.service'; +import { AddCeiResponse } from '../models/add.cei.response'; +import { FileUploader } from 'ng2-file-upload'; +import { SubmitEitModalComponent } from '../submit-eit-modal/submit-eit-modal.component'; @Component({ selector: 'app-confirm-add-cei', @@ -7,8 +22,423 @@ import { Component, OnInit } from '@angular/core'; }) export class ConfirmAddCeiComponent implements OnInit { - constructor() { } + private P_TransactionID: number; + private ceiRequest: CeiRequest; + approversList = []; + addrespList: any; + eitComments: string = ""; + menuType: string = ""; + selEmp: string = ""; + respID: number; + selMenu: MenuResponse; + getAttachList: any; + attachListDisplay: any = []; + headerTitle: string = ""; + isTrue: any = 0; + attachItems: any; + public isResubmitEIT: boolean = false; + private itemKey: string = ""; + private pActionMode: string = "SUBMIT"; + attachReqObj: WorkListButtonRequest = new WorkListButtonRequest(); + attachmentRes: any; + objIndex1: any; + attachListOver: any = []; + index: any = 0; + getPassNotificationDetails: any; + isSubmitBtnClicked: boolean; + isDelete: boolean = false; - ngOnInit() {} + isUpload: boolean = false; + inQueue: boolean = false; + addAttachmentListReq: any; + attachmentID: number = 0; + addAttachRequest: any = []; + fileData: any; + fileType: any; + dirPage: any; + TransactionID: any; + indexLastObj: any = 0; + filterAllowedType: any = ['application/pdf', 'image/jpeg', 'image/png', 'text/plain', 'image/jpg', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']; + direction: string; + + constructor(public modalController: ModalController, public cs: CommonService, private ts: TranslatorService, private eitService: EitService) { + this.direction = TranslatorService.getCurrentLanguageName() + this.isSubmitBtnClicked = false; + this.ceiRequest = new CeiRequest(); + } + + ngOnInit() { + 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.ceiRequest = this.cs.sharedService.getSharedData(CeiRequest.SHARED_DATA, false); + // this.isResubmitEIT = this.cs.sharedService.getSharedData('confirmAddEITData', false).isResubmit; + if (this.isResubmitEIT) { + this.getPassNotificationDetails = this.cs.sharedService.getSharedData(EITNotificatonBodyResponse.NOT_WORKLIST, false); //WARINING ** + this.P_TransactionID = this.cs.sharedService.getSharedData("TransactionIDResubmit", true); + this.itemKey = this.getPassNotificationDetails.ITEM_KEY; + this.pActionMode = "RESUBMIT"; + this.menuType = "E"; + this.respID = -999; + this.selEmp = this.ceiRequest.P_SELECTED_EMPLOYEE_NUMBER; + this.getApproversList(); + this.getAttachment(this.getPassNotificationDetails.NOTIFICATION_ID); + let msg: string = ""; + msg = this.ts.trPK("eit", "update-title"); + this.headerTitle = msg; + } else { + this.menuType = this.selMenu.List_Menu.MENU_TYPE; + this.headerTitle = this.selMenu.GetMenuEntriesList.PROMPT; + this.addrespList = this.cs.sharedService.getSharedData(AddCeiResponse.SHARED_DATA); + this.itemKey = this.addrespList.SubmitCEITransactionList.P_ITEM_KEY; + this.P_TransactionID = this.addrespList.SubmitCEITransactionList.P_TRANSACTION_ID; + // this.isDelete = this.isResubmitEIT = this.cs.sharedService.getSharedData('confirmAddEITData', false).isDelete; + this.getApproversList(); + } + } + + getApproversList() { + let body: any = { + P_TRANSACTION_ID: this.P_TransactionID, + P_AME_TRANSACTION_TYPE: "SSHRMS", + P_PAGE_NUM: 1, + P_PAGE_LIMIT: 1000 + } + this.eitService.getApproversList( + body). + subscribe((result: any) => { + this.handleApproversResult(result); + }); + } + + handleApproversResult(result) { + if (this.cs.validResponse(result)) { + this.approversList = result.GetApprovesList; + } + } + + startCeiApproval() { + if (this.attachListOver) { + let request = { + AddAttachmentList: this.attachListOver + } + this.eitService.addAttachment( + request). + subscribe((result: any) => { + this.handleAddAttachmentResults(result); + }); + } else { + this.startCeiApprovalProcess(); + } + } + + + handleAddAttachmentResults(result) { + if (this.cs.validResponse(result)) { + //this.isUpload=true; + this.isTrue = 0; + for (let i = 0; i < result.AddAttSuccessList.length; i++) { + if (!result.AddAttSuccessList[i].AddSuccess) { + this.attachListOver[i].isSuccess = false; + // if false display cancel button with waring icon or design + }// end if + else { + // if true remove cancel and set isSuccess = true + this.attachListOver[i].isSuccess = true; + this.isTrue = this.isTrue + 1; //count flag of attach status + } // end else + } // end for + + if (this.isTrue == result.AddAttSuccessList.length) { + this.startCeiApprovalProcess(); + } + else { + //stope + let filtered = this.attachListOver.filter(function (el) { return el.isSuccess == true; }); + this.attachListOver = filtered; + let msg: string = ""; + msg = this.ts.trPK("eit", "attach-errorMsg"); + this.cs.presentAlert(msg); + } + } + } + + startCeiApprovalProcess() { + let request: any = {}; + request.P_SELECTED_EMPLOYEE_NUMBER = this.selEmp; + request.P_MENU_TYPE = this.menuType; + request.P_SELECTED_RESP_ID = this.respID; + request.P_TRANSACTION_ID = this.P_TransactionID; + request.P_ITEM_KEY = this.itemKey; + request.P_ACTION_MODE = this.pActionMode; + request.P_COMMENTS = this.eitComments; + this.eitService.startCeiApprovalProcess( + request). + subscribe((result: any) => { + this.handleResults(result); + }); + } + cancelEitProcess() { + let body: any = { + P_TRANSACTION_ID: this.P_TransactionID + } + this.eitService.cancelHRTransaction( + body). + subscribe((result: any) => { + this.handleCancelResults(result); + }); + + } + handleCancelResults(result) { + if (this.cs.validResponse(result)) { + this.isSubmitBtnClicked = false; + } + } + handleResults(result) { + if (this.cs.validResponse(result)) { + this.isSubmitBtnClicked = true; + let msg: string = this.ts.trPK("eit", "approval-message-success"); + this.cs.presentAlert(msg); + this.cs.openNotificationPage(); + } + } + + async addAttachment(str: boolean, attachItems: any) { + let attachDocID = attachItems.ATTACHED_DOCUMENT_ID; + + this.cs.sharedService.setSharedData( this.P_TransactionID, 'TransactionID'); + this.cs.sharedService.setSharedData(this.attachListOver.length, 'indexLastObj'); + + const modal = await this.modalController.create({ + component: AddAttachComponent + }); + + modal.onDidDismiss() + .then((data) => { + if (data == "cancel" || data == "undefined") { + return; + } else { + if (!str) { + this.updateFile(data, attachDocID); + } else { + console.log(data); + this.attachListDisplay = data.data; + this.attachItems = this.attachListDisplay.map(function (el) { + var o = Object.assign({}, el); + o.isSuccess = false; + return o; + }); + + this.attachListOver = this.attachListOver ? this.attachListOver.concat(this.attachItems) : this.attachItems; + } + } + }); + + return await modal.present(); + } + + /*****submit modal********/ + async openSubmitModal() { + this.cs.sharedService.setSharedData( this.attachListOver, 'submitAttachmentList'); + this.cs.sharedService.setSharedData(this.eitComments, 'eitComments'); + const modal = await this.modalController.create({ + component: SubmitEitModalComponent, + backdropDismiss: false, + + }); + modal.cssClass = 'note-modal'; + + modal.onDidDismiss() + .then((data) => { + console.log(data.data); + + if (data.data == "cancel" || data.data == undefined) { + return; + } else { + this.startCeiApproval(); + } + }); + + return await modal.present(); + + } + + + + removeFile(objectitem) { + if (this.attachListOver) { + let index2 = this.attachListOver.findIndex(item => item == objectitem); + if (index2 > -1) { + this.attachListOver.splice(index2, 1); + } + } + if (this.attachmentRes) { + + let index3 = this.attachmentRes.findIndex(item => item == objectitem); + if (index3 > -1) { + + this.attachmentRes.splice(index3, 1); + } + } + + } + + + getAttachment(NotificationID) { + + this.attachReqObj.P_NOTIFICATION_ID = NotificationID; + + this.eitService.getAttach(this.attachReqObj). + subscribe((result: NotificationGetAttachResponse) => { + this.handleWorkListAttachResult(result); + }); + } + + handleWorkListAttachResult(result) { + if (this.cs.validResponse(result)) { + // this.sharedData.setSharedData(result, WorKListResponse.SHARED_DATA); + if (result.GetAttachementList != null) { + this.attachmentRes = result.GetAttachementList; + } // if result == null + } // valid it + + } + + async OpenAttachFiles(value, Type) { + + this.cs.sharedService.setSharedData({ displayData: value, TypeData: Type }, 'WorkListAttachViewPage'); + const modal = await this.modalController.create({ + component: WorkListAttachViewComponent + }); + + modal.onDidDismiss() + .then((data) => { + }); + + return await modal.present(); + } + + + delelteFile(attach) { + this.cs.confirmAlertDialog((data) => { + if (data == true) { + this.continueDelete(attach); + } + }, this.ts.trPK('general', 'ok'), () => { + + }, this.ts.trPK('general', 'cancel'), this.ts.trPK('general', 'alert'), this.ts.trPK('eit', 'delete-perm')); + } + continueDelete(attach) { + let req = { + P_ATTACHED_DOCUMENT_ID: attach.ATTACHED_DOCUMENT_ID + } + this.eitService.deleteAttach(req). + subscribe((result: any) => { + if (this.cs.validResponse(result)) { + if (result.DeleteAttachmentList.P_RETURN_STATUS === "S") { + this.getAttachment(this.getPassNotificationDetails.NOTIFICATION_ID); + let msg: string = ""; + msg = this.ts.trPK("eit", "deleteAttach"); + this.cs.presentAlert(msg); + } + } + }); + } + + updateFile(attachList, attachDocID) { + let req = { + P_ATTACHED_DOCUMENT_ID: attachDocID, + P_FILE_DATA: attachList[0].P_FILE_DATA, + P_FILE_NAME: attachList[0].P_FILE_NAME, + P_FILE_CONTENT_TYPE: attachList[0].P_FILE_CONTENT_TYPE + } + this.eitService.updateAttach(req). + subscribe((result: any) => { + if (this.cs.validResponse(result)) { + if (result.MessageStatus == 1) { + let msg: string = ""; + msg = this.ts.trPK("eit", "attachUpdate"); + this.cs.presentAlert(msg); + this.getAttachment(this.getPassNotificationDetails.NOTIFICATION_ID); + } + } // val + }); + } + + + ionViewWillLeave() { + if (this.P_TransactionID && this.isSubmitBtnClicked == false) + this.cancelEitProcess(); + } + + public uploader: FileUploader = new FileUploader({ + allowedMimeType: ['application/pdf', 'image/jpeg', 'image/png', 'text/plain', 'image/jpg', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'], + maxFileSize: 10 * 1024 * 1024, + formatDataFunctionIsAsync: true, + formatDataFunction: async (item) => { + return new Promise((resolve, reject) => { + resolve({ + name: item._file.name, + length: item._file.size, + contentType: item._file.type, + date: new Date() + }); + }); + } + }); + + + onFileSelectedclick(event){ + event.target.value = ''; + } + + + + onFileSelected(input) { + if (!(this.filterAllowedType.indexOf(input.target.files[0].type) > -1)) { + let msg: string = ""; + msg = this.ts.trPK("general", "notSupport"); + this.cs.presentAlert(msg); + return + } // todo: show alert that you tried uploading wrong files + + else { + const file = input.target.files[0]; + this.getBase64(file).then( + data => this.pushObject(data, file.name, file.type) + ); + } + } + + + getBase64(file) { + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.readAsDataURL(file); + reader.onload = () => resolve(reader.result); + reader.onerror = error => reject(error); + }); + } + + + pushObject(fileData, name, type) { + try { + let array = name.split('.'); + let attachType: string = array[array.length - 1]; + + this.attachListOver.push( + { + AttachmentID: this.attachListOver.length, + P_FILE_CONTENT_TYPE: attachType,//type.split('/')[1], + P_FILE_DATA: fileData.split(',')[1], + P_FILE_NAME: name,//.split('.')[0], + P_TRANSACTION_ID: this.P_TransactionID + }) + + } catch (e) { + + } + } } + diff --git a/Mohem/src/app/eit/eit.module.ts b/Mohem/src/app/eit/eit.module.ts index 97bcd70f..a42eebc6 100644 --- a/Mohem/src/app/eit/eit.module.ts +++ b/Mohem/src/app/eit/eit.module.ts @@ -15,7 +15,9 @@ import { WorkListAttachViewComponent } from '../notification/work-list-attach-vi import { EitUpdateListComponent } from './eit-update-list/eit-update-list.component'; import { SubmitEitModalComponent } from './submit-eit-modal/submit-eit-modal.component'; import { CeiHomepageComponent } from './cei-homepage/cei-homepage.component'; - +import { CeiListComponent } from './cei-list/cei-list.component'; +import { AddCeiComponent } from './add-cei/add-cei.component'; +import { ConfirmAddCeiComponent } from './confirm-add-cei/confirm-add-cei.component'; const routes: Routes = [ { @@ -51,9 +53,21 @@ const routes: Routes = [ component: SubmitEitModalComponent }, { - path: 'eit-cei', + path: 'cei-homepage', component: CeiHomepageComponent - } + }, + { + path: 'cei-list', + component: CeiListComponent + }, + { + path: 'add-cei', + component: AddCeiComponent + }, + { + path: 'confirm-cei', + component: ConfirmAddCeiComponent + }, ] } ]; @@ -75,7 +89,10 @@ const routes: Routes = [ AddAttachComponent, EitUpdateListComponent, SubmitEitModalComponent, - CeiHomepageComponent + CeiHomepageComponent, + CeiListComponent, + AddCeiComponent, + ConfirmAddCeiComponent ], entryComponents: [ WorkListAttachViewComponent diff --git a/Mohem/src/app/eit/models/add.cei.response.ts b/Mohem/src/app/eit/models/add.cei.response.ts new file mode 100644 index 00000000..070c330a --- /dev/null +++ b/Mohem/src/app/eit/models/add.cei.response.ts @@ -0,0 +1,8 @@ +import { Response } from '../../hmg-common/services/models/response'; +import { EitRespModel } from './eit.response.model' + +export class AddCeiResponse extends Response { + public static SHARED_DATA = 'add-cei-response'; + SubmitCEITransactionList: EitRespModel; +} + diff --git a/Mohem/src/app/eit/models/cei.request.ts b/Mohem/src/app/eit/models/cei.request.ts new file mode 100644 index 00000000..7b06f904 --- /dev/null +++ b/Mohem/src/app/eit/models/cei.request.ts @@ -0,0 +1,12 @@ +import { EitTransactionModel } from './eit.transaction.model'; + +export class CeiRequest { + public static SHARED_DATA = 'cei-request'; + public P_MENU_TYPE: string; + public P_SELECTED_EMPLOYEE_NUMBER: string; + public P_FUNCTION_NAME: string; + public P_SELECTED_RESP_ID: Number; + P_CONTACT_RELATIONSHIP_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.request.ts b/Mohem/src/app/eit/models/eit.request.ts index 51e746a5..cc9d4311 100755 --- a/Mohem/src/app/eit/models/eit.request.ts +++ b/Mohem/src/app/eit/models/eit.request.ts @@ -8,5 +8,4 @@ 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/eit/services/eit.service.ts b/Mohem/src/app/eit/services/eit.service.ts index 31e9d3f9..4b95bdda 100644 --- a/Mohem/src/app/eit/services/eit.service.ts +++ b/Mohem/src/app/eit/services/eit.service.ts @@ -5,6 +5,7 @@ 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'; +import { AddCeiResponse } from '../models/add.cei.response'; import { ApproversList } from 'src/app/absence/models/approvers'; import { WorkListButtonRequest } from '../models/NotificationButtonReq'; @@ -16,13 +17,17 @@ 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 getCEITransctions = 'Services/ERP.svc/REST/GET_CEI_TRANSACTIONS'; public static getEITDFFStrutre = 'Services/ERP.svc/REST/GET_EIT_DFF_STRUCTURE'; + public static getCEIDFFStrutre = 'Services/ERP.svc/REST/GET_CEI_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 submitCEI = 'Services/ERP.svc/REST/SUBMIT_CEI_TRANSACTION'; public static resubmitEit = 'Services/ERP.svc/REST/RESUBMIT_EIT_TRANSACTION'; public static startEitProcess = 'Services/ERP.svc/REST/START_EIT_APPROVAL_PROCESS'; + public static startCeiProcess = 'Services/ERP.svc/REST/START_CEI_APPROVAL_PROCESS'; public static updateAttach = 'Services/ERP.svc/REST/UPDATE_ATTACHMENT'; public static deleteAttach = 'Services/ERP.svc/REST/DELETE_ATTACHMENT'; public static getApproversList = 'Services/ERP.svc/REST/GET_APPROVERS_LIST'; @@ -50,6 +55,13 @@ export class EitService { return this.con.post(EitService.getEITTransctions, request, onError, errorLabel); } + // tslint:disable-next-line: no-shadowed-variable + public getCEITransactionsList(EITTransactionsRequest: EITTransactionsRequest, onError?: any, errorLabel?: string): Observable { + const request = EITTransactionsRequest; + this.authService.authenticateRequest(request); + return this.con.post(EitService.getCEITransctions, request, onError, errorLabel); + } + public submitEit(eit: any, onError?: any, errorLabel?: string): Observable { const request = eit; request.EITTransactionTBLModel = eit.EITTransactionTBL; @@ -57,6 +69,20 @@ export class EitService { return this.con.post(EitService.submitEit, request, onError, errorLabel); } + public submitChildEducation(cei: any, onError?: any, errorLabel?: string): Observable { + const request = cei; + request.EITTransactionTBL = cei.EITTransactionTBL; + this.authService.authenticateRequest(request); + return this.con.post(EitService.submitCEI, request, onError, errorLabel); + } + + public submitCEI(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); @@ -69,6 +95,12 @@ export class EitService { return this.con.post(EitService.getEITDFFStrutre, request, onError, errorLabel); } + public getCEIDFFStrutre(EITDFFStrutreReq: any, onError?: any, errorLabel?: string): Observable { + const request = EITDFFStrutreReq; + this.authService.authenticateRequest(request); + return this.con.post(EitService.getCEIDFFStrutre, request, onError, errorLabel); + } + public getSetValue(SetValueReq: any, onError?: any, errorLabel?: string): Observable { const request = SetValueReq; this.authService.authenticateRequest(request); @@ -102,6 +134,12 @@ export class EitService { return this.con.post(EitService.startEitProcess, request, onError, errorLabel); } + public startCeiApprovalProcess(eitProcess: any, onError?: any, errorLabel?: string): Observable { + const request = eitProcess; + this.authService.authenticateRequest(request); + return this.con.post(EitService.startCeiProcess, request, onError, errorLabel); + } + public cancelHRTransaction(transactionID: any, onError?: any, errorLabel?: string): Observable { const request = transactionID; this.authService.authenticateRequest(request); diff --git a/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts b/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts index b5436fb3..784e92fe 100644 --- a/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts +++ b/Mohem/src/app/hmg-common/services/authentication/authentication.service.ts @@ -142,7 +142,7 @@ export class AuthenticationService { } else { mobileType = 'android'; } - request.VersionID = 3.3;//3.2; + request.VersionID = 3.4;//3.2; request.Channel = 31; request.LanguageID = TranslatorService.getCurrentLanguageCode(); request.MobileType = mobileType; 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 cf33443f..d15a6cec 100644 --- a/Mohem/src/app/hmg-common/services/common/common.service.ts +++ b/Mohem/src/app/hmg-common/services/common/common.service.ts @@ -1129,9 +1129,15 @@ export class CommonService { public openAddEitPage() { this.nav.navigateForward(['/eit/add-eit']); } + public openAddCEIPage() { + this.nav.navigateForward(['/eit/add-cei']); + } public openConfirmEitPage() { this.nav.navigateForward(['/eit/confirm-add-eit']); } + public openConfirmCEIPage() { + this.nav.navigateForward(['/eit/confirm-cei']); + } public openConfirmBasicDetailsPage() { this.nav.navigateForward(['/profile/confirm-basic']); } @@ -1326,7 +1332,10 @@ export class CommonService { this.nav.navigateForward(['/eit/eit-update-list']); } public openCEIPage() { - this.nav.navigateForward(['/eit/eit-cei']); + this.nav.navigateForward(['/eit/cei-homepage']); + } + public openCEIListPage() { + this.nav.navigateForward(['/eit/cei-list']); } public openAnnouncement() { this.nav.navigateForward(['/backend-integrations/announcement']); diff --git a/Mohem/src/app/notification/home/home.component.html b/Mohem/src/app/notification/home/home.component.html index 326c7d16..45af49e2 100644 --- a/Mohem/src/app/notification/home/home.component.html +++ b/Mohem/src/app/notification/home/home.component.html @@ -12,11 +12,9 @@ {{ts.trPK('work-list','open-analysis')}}
- -

{{totalRequestCount}}

-

{{newWorkListResponse[0].NO_OF_ROWS + ITGCount}}

-

{{newWorkListResponse[0].NO_OF_ROWS}}

+

{{totalRequestCount}}

+ + {{ts.trPK('work-list','total')}}
{{ts.trPK('work-list','open-reqest')}}
@@ -45,7 +43,7 @@ {{ts.trPK('work-list','clear-search')}} - + {{ts.trPK('work-list','advanced-search')}} @@ -74,7 +72,6 @@
-
@@ -103,7 +100,6 @@
- diff --git a/Mohem/src/app/notification/home/home.component.ts b/Mohem/src/app/notification/home/home.component.ts index 7b47aad2..ce8635c3 100644 --- a/Mohem/src/app/notification/home/home.component.ts +++ b/Mohem/src/app/notification/home/home.component.ts @@ -186,7 +186,7 @@ export class HomeComponent implements OnInit { this.WorkListObj.P_SEARCH_SENT_DATE = ''; this.WorkListObj.P_SEARCH_ITEM_TYPE_DSP_NAME = ''; this.WorkListObj.P_PAGE_NUM = 0; - this.WorkListObj.P_PAGE_LIMIT = 5; + this.WorkListObj.P_PAGE_LIMIT = 25; } ngOnInit() { @@ -212,7 +212,6 @@ export class HomeComponent implements OnInit { this.selectedFilter = 'HR'; this.filters[0].active = true; this.isPostNoLoad = true; - // this.disableFilters(); this.resetData(); this.direction = TranslatorService.getCurrentLanguageName(); this.worklistNotifications = this.common.sharedService.getSharedData('worklistNotifications', false); @@ -303,11 +302,10 @@ export class HomeComponent implements OnInit { } activeFilter(index: number) { - if (index !== 4) { - this.common.startLoading(); - } - console.log(this.filters); - if (this.currentActiveIndex !== index) { + if (index !== this.currentActiveIndex) { + if (index !== 4) { + this.common.startLoading(); + } this.previousActiveIndex = this.currentActiveIndex; this.currentActiveIndex = index; this.filters[this.previousActiveIndex].active = false; @@ -315,7 +313,6 @@ export class HomeComponent implements OnInit { this.selectedFilter = this.filters[this.currentActiveIndex].key; const filterValue = this.filters[this.currentActiveIndex].value; if (this.selectedFilter !== 'ITG') { - // this.getFilteredData(this.selectedFilter); this.initiateNewWorklistData(this.selectedFilter, filterValue); } } @@ -325,9 +322,12 @@ export class HomeComponent implements OnInit { this.common.openProfile('sideMenu'); } - disableFilters() { + configureFilters() { for (const filter of this.filters) { if (filter.key === this.itemType) { + const index = this.filters.map(function(e) { return e.key; }).indexOf(this.itemType); + this.currentActiveIndex = index; + this.previousActiveIndex = 0; filter.disable = false; filter.active = true; this.selectedFilter = filter.name; @@ -339,12 +339,26 @@ export class HomeComponent implements OnInit { filter.active = false; } } + if (this.itemType === '') { this.filters[0].active = true; } } + enableFilters() { + this.currentActiveIndex = 0; + this.previousActiveIndex = 0; + for (const filter of this.filters) { + filter.disable = false; + if (filter.key === this.itemType) { + filter.active = true; + } else { + filter.active = false; + } + } + } + async openSearchModal() { const modal = await this.modalController.create({ component: WorklistAdvancedSearchComponent, @@ -369,19 +383,10 @@ export class HomeComponent implements OnInit { this.newWorkListResponse = []; this.showFormattedData = []; this.allFormattedData = []; - // this.selectedFilter = 'ALL'; if (this.itemType !== '') { - this.disableFilters(); + this.configureFilters(); } - - this.filters[this.currentActiveIndex].active = false; - this.currentActiveIndex = 0; - this.previousActiveIndex = 0; - this.filters[this.currentActiveIndex].active = true; - // if (this.itemType !== '') { - // this.disableFilters(); - // } this.isPostNoLoad = false; this.getAllPushNotificationFun(); } @@ -494,7 +499,6 @@ export class HomeComponent implements OnInit { this.showFormattedData = this.sortArray(categorizedWorkListResponse); this.allFormattedData = this.showFormattedData; this.common.sharedService.setSharedData(this.newWorkListResponse, HomeComponent.NOTIFICATION_ARR); - // this.assignDataToFilters(); } } else { this.newWorkListResponse = []; @@ -503,7 +507,6 @@ export class HomeComponent implements OnInit { } this.data.datasets[0].data[4] = this.ITGCount; this.showChart = true; - // this.common.stopLoading(); this.isLoading = false; } } @@ -562,11 +565,11 @@ export class HomeComponent implements OnInit { clearSearch() { this.common.startLoading(); - this.isLoading = true; - this.itemType = ''; - this.selectedFilter = 'ALL'; + this.isLoading = false; + this.itemType = 'HRSSA'; + this.selectedFilter = 'HR'; this.isPostNoLoad = true; - // this.disableFilters(); + this.enableFilters(); this.resetData(); this.getAllPushNotificationFun(); } 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 b66eab09..695cd8b3 100644 --- a/Mohem/src/app/profile/add-address/add-address.component.html +++ b/Mohem/src/app/profile/add-address/add-address.component.html @@ -21,7 +21,7 @@ - Effective Date + {{'vacation-rule, effectiveDate' | translate}} diff --git a/Mohem/src/app/profile/add-basic-details/add-basic-details.component.html b/Mohem/src/app/profile/add-basic-details/add-basic-details.component.html index ce1335e8..352a55a6 100644 --- a/Mohem/src/app/profile/add-basic-details/add-basic-details.component.html +++ b/Mohem/src/app/profile/add-basic-details/add-basic-details.component.html @@ -10,7 +10,7 @@ - Effective Date + {{'vacation-rule, effectiveDate' | translate}} {{showEffectiveDate}}
diff --git a/Mohem/src/assets/localization/i18n.json b/Mohem/src/assets/localization/i18n.json index d87fd25f..386b26ee 100644 --- a/Mohem/src/assets/localization/i18n.json +++ b/Mohem/src/assets/localization/i18n.json @@ -1585,6 +1585,10 @@ } }, "vacation-rule": { + "effectiveDate": { + "en": "Effective Date", + "ar": "تاريخ الفعالية" + }, "vacationRule": { "en": "Vacation Rule", "ar": "الإنابة بالإجازات"