You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1025 lines
35 KiB
TypeScript
1025 lines
35 KiB
TypeScript
import { Component, ElementRef, OnInit } from '@angular/core';
|
|
|
|
import * as moment from 'moment';
|
|
import { EitService } from 'src/app/eit/services/eit.service';
|
|
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
|
|
import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response';
|
|
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
|
|
import { DateTimeInput } from 'src/app/uI-elements/date-time.input';
|
|
import { DateInput } from 'src/app/uI-elements/date.input';
|
|
import { HiddenInput } from 'src/app/uI-elements/hidden.input';
|
|
import { NumberInput } from 'src/app/uI-elements/number.input';
|
|
import { SelectInput } from 'src/app/uI-elements/select.input';
|
|
import { TextInput } from 'src/app/uI-elements/text.input';
|
|
import { TimeInput } from 'src/app/uI-elements/time.input';
|
|
import { TerminationServiceService } from '../service/termination-service.service';
|
|
|
|
|
|
@Component({
|
|
selector: 'app-termination-form',
|
|
templateUrl: './termination-form.component.html',
|
|
styleUrls: ['./termination-form.component.scss'],
|
|
})
|
|
export class TerminationFormComponent implements OnInit {
|
|
public selectedMenu;
|
|
public diffStructure = [];
|
|
public termColStructure = [];
|
|
public isUpdate: boolean;
|
|
private eitVALSettoCall: any = [];
|
|
private textInput;
|
|
private numberInput;
|
|
private dateInput;
|
|
public direction: string;
|
|
private datetimeInput;
|
|
private timeInput;
|
|
private selectInput;
|
|
private hiddenInput;
|
|
private validateEitObj: any = [];
|
|
public menuType: any;
|
|
public respID;
|
|
public selEmp;
|
|
public eitRequest;
|
|
private ExtraObj: any = {};
|
|
private arrValues: any = [];
|
|
selMenu: MenuResponse;
|
|
private country;
|
|
private updatedValues;
|
|
private effectiveDate;
|
|
private comtransNo;
|
|
private reportSubmitRequest = {};
|
|
getPassdirfromNotifiPage: boolean = false;
|
|
private startDate;
|
|
private endDate;
|
|
constructor(public cs: CommonService, private elementRef: ElementRef, public terminationFormService: TerminationServiceService, public ts: TranslatorService, public eitService: EitService) { }
|
|
|
|
ngOnInit() {
|
|
this.getPassdirfromNotifiPage = this.cs.sharedService.getSharedData('dirfromNotificationPage');
|
|
this.selectedMenu = this.cs.sharedService.getSharedData(TerminationServiceService.TERMINATION_PAGE, false);
|
|
this.getTerminationCol();
|
|
this.direction = TranslatorService.getCurrentLanguageName();
|
|
this.effectiveDate = new Date();
|
|
}
|
|
getTerminationCol() {
|
|
this.terminationFormService.getTerminationColStructure({
|
|
P_FUNCTION_NAME: this.selectedMenu.P_FUNCTION_NAME
|
|
}, () => { }, this.ts.trPK('general', 'retry')).subscribe((response) => {
|
|
this.termColStructure = response;
|
|
console.log(response);
|
|
this.getTermDiffStructure();
|
|
})
|
|
}
|
|
getTermDiffStructure() {
|
|
this.terminationFormService.getTermDiffStructure({
|
|
P_DESC_FLEX_CONTEXT_CODE: null,
|
|
P_FUNCTION_NAME: this.selectedMenu.FUNCTION_NAME
|
|
}, () => { }, this.ts.trPK('general', 'retry')).subscribe((response) => {
|
|
console.log("Diff Structure");
|
|
console.log(response);
|
|
this.handleDiffStructure(response);
|
|
})
|
|
}
|
|
handleDiffStructure(result) {
|
|
if (result.GetCcpDffStructureList != null) {
|
|
this.diffStructure = result.GetCcpDffStructureList;
|
|
this.drawEitFields(result.GetCcpDffStructureList);
|
|
if (this.isUpdate) {
|
|
//this.submitAbsObjList = this.cs.sharedService.getSharedData(ProfileService.EMP_ADDRESS);
|
|
//this.fillAbsStructure();
|
|
}
|
|
}
|
|
}
|
|
private drawEitFields(feildsList) {
|
|
const containerId = "containerDiv";
|
|
this.eitVALSettoCall = [];
|
|
for (let i = 0; i < feildsList.length; i++) {
|
|
let defaultVal: string = "";
|
|
let defaultValText: string = "";
|
|
|
|
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
|
|
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].FORMAT_TYPE == "N") {
|
|
// number
|
|
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].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].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
|
|
);
|
|
} 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 {
|
|
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
|
|
);
|
|
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]
|
|
);
|
|
} else {
|
|
this.hiddenInput = new HiddenInput(
|
|
defaultVal,
|
|
feildsList[i].APPLICATION_COLUMN_NAME,
|
|
defaultValText,
|
|
containerId
|
|
);
|
|
this.bindHtmlElemEvents(
|
|
feildsList[i].APPLICATION_COLUMN_NAME,
|
|
feildsList[i]
|
|
);
|
|
}
|
|
}
|
|
if (this.validateEitObj && this.validateEitObj.length > 0) {
|
|
this.fillEITStructure();
|
|
}
|
|
}
|
|
fillDropdownList(segmentName, optionList: any = [], DV: any = "") {
|
|
let elemID: any = "";
|
|
let eitObj: any;
|
|
if (optionList.length > 0) {
|
|
for (let i = 0; i < this.diffStructure.length; i++) {
|
|
if (this.diffStructure[i].SEGMENT_NAME == segmentName) {
|
|
eitObj = this.diffStructure[i];
|
|
if (
|
|
this.diffStructure[i].READ_ONLY == "Y" ||
|
|
this.diffStructure[i].DISPLAY_FLAG == "N"
|
|
) {
|
|
return false;
|
|
}
|
|
elemID = this.diffStructure[i].APPLICATION_COLUMN_NAME;
|
|
break;
|
|
}
|
|
}
|
|
let select = document.getElementById(elemID) as HTMLSelectElement;
|
|
document.getElementById(elemID).innerHTML = "";
|
|
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;
|
|
} 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(changeEvent, e => {
|
|
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 => {
|
|
this.emptyChildElement(element);
|
|
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 => {
|
|
this.emptyChildElement(element);
|
|
for (let i = 0; i < this.diffStructure.length; i++) {
|
|
if (this.diffStructure[i].SEGMENT_NAME == element) {
|
|
this.getDefaultValue(
|
|
this.diffStructure[i],
|
|
this.diffStructure[i].DESC_FLEX_NAME,
|
|
this.diffStructure[i].DESC_FLEX_CONTEXT_CODE,
|
|
this.diffStructure[i].SEGMENT_NAME,
|
|
this.diffStructure[i].PARENT_SEGMENTS_VS_SplitedVS,
|
|
this.diffStructure[i].PARENT_SEGMENTS_DV_Splited
|
|
);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
return false;
|
|
});
|
|
} 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 != "" &&
|
|
(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;
|
|
}
|
|
}
|
|
|
|
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);
|
|
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),
|
|
elem.value = val;
|
|
} else {
|
|
elem.value = val;
|
|
elem.innerText = text;
|
|
elem.setAttribute("value", val);
|
|
}
|
|
}
|
|
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;
|
|
}
|
|
getSelectElementByName(segmentName) {
|
|
let elemID: any = "";
|
|
for (let i = 0; i < this.diffStructure.length; i++) {
|
|
if (this.diffStructure[i].SEGMENT_NAME == segmentName) {
|
|
elemID = this.diffStructure[i].APPLICATION_COLUMN_NAME;
|
|
break;
|
|
}
|
|
}
|
|
return elemID;
|
|
}
|
|
getElementByName(segmentName) {
|
|
let elemID: any = "";
|
|
for (let i = 0; i < this.diffStructure.length; i++) {
|
|
if (this.diffStructure[i].SEGMENT_NAME == segmentName) {
|
|
elemID = this.diffStructure[i].APPLICATION_COLUMN_NAME;
|
|
break;
|
|
}
|
|
}
|
|
return document.getElementById(elemID) as HTMLInputElement;
|
|
}
|
|
|
|
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.diffStructure.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 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.diffStructure.length; i++) {
|
|
if (this.diffStructure[i].SEGMENT_NAME == segmentName) {
|
|
descFlexName = this.diffStructure[i].DESC_FLEX_NAME;
|
|
descFlexContextCode = this.diffStructure[i].DESC_FLEX_CONTEXT_CODE;
|
|
parentValue = this.diffStructure[i].PARENT_SEGMENTS_VS_SplitedVS;
|
|
ParentsList = this.diffStructure[i].PARENT_SEGMENTS_VS_SplitedVS;
|
|
validationType = this.diffStructure[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;
|
|
}
|
|
isStandardDateVal(obj: any): boolean {
|
|
let isSt: boolean = false;
|
|
if (obj.FORMAT_TYPE == "X") {
|
|
|
|
isSt = true;
|
|
|
|
}
|
|
return isSt;
|
|
}
|
|
|
|
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");
|
|
}
|
|
getDependenciesParams(parentsList) {
|
|
let parentArr: any = [];
|
|
for (let i = 0; i < parentsList.length; i++) {
|
|
for (let j = 0; j < this.diffStructure.length; j++) {
|
|
if (this.diffStructure[j].SEGMENT_NAME == parentsList[i].Name) {
|
|
if (this.diffStructure[j].DISPLAY_FLAG != "N") {
|
|
if (this.diffStructure[j].VALIDATION_TYPE == "N") {
|
|
let idColName: string;
|
|
let val: any;
|
|
if (
|
|
this.diffStructure[j].FORMAT_TYPE == "Y" ||
|
|
this.diffStructure[j].FORMAT_TYPE == "I"
|
|
) {
|
|
//standard date time or //time
|
|
let elem = document.getElementById(
|
|
this.diffStructure[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.diffStructure[j].FORMAT_TYPE == "Y")
|
|
idColName = this.cs.formatStandardDate(val);
|
|
} else {
|
|
val = (document.getElementById(
|
|
this.diffStructure[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.diffStructure[j].FORMAT_TYPE == "X") {
|
|
//date
|
|
// idColName = this.cs.formatDate(val);
|
|
idColName = this.cs.formatDateNew(val);
|
|
}
|
|
}
|
|
parentArr.push({
|
|
SEGMENT_NAME: this.diffStructure[j].SEGMENT_NAME,
|
|
VALUE_COLUMN_NAME: val,
|
|
DESCRIPTION: "",
|
|
ID_COLUMN_NAME: idColName,
|
|
FLEX_VALUE_SET_NAME: this.diffStructure[j].FLEX_VALUE_SET_NAME
|
|
});
|
|
break;
|
|
} else {
|
|
if (this.diffStructure[j].READ_ONLY != "Y") {
|
|
let x = document.getElementById(
|
|
this.diffStructure[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.diffStructure[j].SEGMENT_NAME,
|
|
VALUE_COLUMN_NAME: text,
|
|
DESCRIPTION: "",
|
|
ID_COLUMN_NAME: val,
|
|
FLEX_VALUE_SET_NAME: this.diffStructure[j].FLEX_VALUE_SET_NAME
|
|
});
|
|
break;
|
|
} else {
|
|
let x = document.getElementById(
|
|
this.diffStructure[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.diffStructure[j].SEGMENT_NAME,
|
|
VALUE_COLUMN_NAME: text,
|
|
DESCRIPTION: "",
|
|
ID_COLUMN_NAME: val,
|
|
FLEX_VALUE_SET_NAME: this.diffStructure[j].FLEX_VALUE_SET_NAME
|
|
});
|
|
break;
|
|
}
|
|
}
|
|
} else {
|
|
let x = document.getElementById(
|
|
this.diffStructure[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.diffStructure[j].SEGMENT_NAME,
|
|
VALUE_COLUMN_NAME: text,
|
|
DESCRIPTION: "",
|
|
ID_COLUMN_NAME: val,
|
|
FLEX_VALUE_SET_NAME: this.diffStructure[j].FLEX_VALUE_SET_NAME
|
|
});
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return parentArr;
|
|
}
|
|
|
|
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;
|
|
}
|
|
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;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
validateAbcenseTransaction() {
|
|
(this.elementRef.nativeElement.querySelectorAll(
|
|
"ion-item"
|
|
) as HTMLElement[]).forEach(x => {
|
|
x.classList.add("ng-touched");
|
|
x.classList.remove("ng-untouched");
|
|
});
|
|
|
|
let arrValues = this.getElementsValues();
|
|
|
|
if (arrValues) {
|
|
if (!this.startDate || !this.endDate) {
|
|
//this.common.showRequiredMsg();
|
|
return false;
|
|
}
|
|
let Sdata = moment(this.startDate).format("MM/DD/YYYY");
|
|
let Edata = moment(this.endDate).format("MM/DD/YYYY");
|
|
this.reportSubmitRequest = {}
|
|
// this.reports
|
|
// .submitTransaction(this.reportSubmitRequest, {}, this.ts.trPK('general', 'retry'))
|
|
// .subscribe((result: any) => {
|
|
// this.handleSubmitAbsence(result);
|
|
// });
|
|
}
|
|
}
|
|
|
|
|
|
private handleSubmitAbsence(result) {
|
|
if (this.cs.validResponse(result)) {
|
|
if (this.getPassdirfromNotifiPage) {
|
|
//this.cs.sharedService.setSharedData(result.ResubmitAbsenceTransactionList.P_TRANSACTION_ID, AbsenceResponse.SHARED_DATA);
|
|
this.cs.openConfirmAbsece();
|
|
|
|
} else {
|
|
//this.cs.sharedService.setSharedData(result.SumbitAbsenceTransactionList.P_TRANSACTION_ID, AbsenceResponse.SHARED_DATA);
|
|
this.cs.openConfirmAbsece();
|
|
|
|
}
|
|
}
|
|
} getElementsValues() {
|
|
//this.updatedValues=[];//fill updated list
|
|
let valuseArr: any = [];
|
|
let varcharValue: any = null;
|
|
let numbervalue: any = 0;
|
|
let dateValue: any = null;
|
|
let textValue = "";
|
|
let key: string = "";
|
|
let obj: any = {};
|
|
for (let i = 0; i < this.diffStructure.length; i++) {
|
|
varcharValue = null;
|
|
numbervalue = null;
|
|
dateValue = null;
|
|
if (this.diffStructure[i].DISPLAY_FLAG != "N") {
|
|
if (this.diffStructure[i].VALIDATION_TYPE == "N") {
|
|
let elem = document.getElementById(
|
|
this.diffStructure[i].APPLICATION_COLUMN_NAME
|
|
) as HTMLInputElement;
|
|
let elemVal = "";
|
|
if (elem.classList.contains('onic-date')) {
|
|
elemVal = (document.getElementById(
|
|
this.diffStructure[i].APPLICATION_COLUMN_NAME
|
|
) as HTMLInputElement).value;
|
|
if (elemVal) {
|
|
elemVal = moment(elemVal).format("YYYY/MM/DD hh:mm:ss");
|
|
}
|
|
|
|
} else {
|
|
elemVal = (document.getElementById(
|
|
this.diffStructure[i].APPLICATION_COLUMN_NAME
|
|
) as HTMLInputElement).value;
|
|
}
|
|
textValue = elemVal;
|
|
|
|
if (
|
|
this.diffStructure[i].FORMAT_TYPE == "X" &&
|
|
this.diffStructure[i].DISPLAY_FLAG != "N"
|
|
) {
|
|
//date
|
|
elemVal = this.cs.formatDate(elemVal);
|
|
} else if (
|
|
this.diffStructure[i].FORMAT_TYPE == "Y" &&
|
|
this.diffStructure[i].DISPLAY_FLAG != "N"
|
|
) {
|
|
//standard date time
|
|
elemVal = elem.dataset.dtvalue;
|
|
// elemVal = this.common.formatStandardDate(elemVal);
|
|
} else if (
|
|
this.diffStructure[i].FORMAT_TYPE == "I" &&
|
|
this.diffStructure[i].DISPLAY_FLAG != "N"
|
|
) {
|
|
//time
|
|
elemVal = elem.dataset.dtvalue;
|
|
}
|
|
if (this.diffStructure[i].REQUIRED_FLAG == "Y" && !elemVal) {
|
|
elem.classList.add("requiredClassElm");
|
|
return false;
|
|
} else {
|
|
elem.classList.remove("requiredClassElm");
|
|
}
|
|
if (elemVal) varcharValue = elemVal;
|
|
key = "P_" + this.diffStructure[i].APPLICATION_COLUMN_NAME;
|
|
// obj = {};
|
|
obj[key] = varcharValue;
|
|
} else {
|
|
let x = document.getElementById(
|
|
this.diffStructure[i].APPLICATION_COLUMN_NAME
|
|
) as HTMLSelectElement;
|
|
if (this.diffStructure[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.diffStructure[i].REQUIRED_FLAG == "Y" &&
|
|
!varcharValue
|
|
) {
|
|
x.classList.add("requiredClassElm");
|
|
// this.common.showRequiredMsg();
|
|
return false;
|
|
} else {
|
|
x.classList.remove("requiredClassElm");
|
|
}
|
|
|
|
key = "P_" + this.diffStructure[i].APPLICATION_COLUMN_NAME;
|
|
//obj = {};
|
|
obj[key] = varcharValue;
|
|
} //end else
|
|
} else {
|
|
let x = document.getElementById(
|
|
this.diffStructure[i].APPLICATION_COLUMN_NAME
|
|
) as HTMLSelectElement;
|
|
let val = x.dataset.colmText;
|
|
textValue = x.value;
|
|
if (this.diffStructure[i].REQUIRED_FLAG == "Y" && !varcharValue) {
|
|
x.classList.add("requiredClassElm");
|
|
// this.common.showRequiredMsg();
|
|
return false;
|
|
} else {
|
|
x.classList.remove("requiredClassElm");
|
|
}
|
|
if (val) varcharValue = val;
|
|
key = "P_" + this.diffStructure[i].APPLICATION_COLUMN_NAME;
|
|
//obj = {};
|
|
obj[key] = varcharValue;
|
|
}
|
|
} // end for
|
|
|
|
valuseArr.push(obj);
|
|
return valuseArr;
|
|
}
|
|
|
|
|
|
}
|