Fixed address flow issues

MOHEMM-SFH-COLORS
umasoodch 4 years ago
parent e21ff86a49
commit e9b8119169

@ -22,21 +22,23 @@ export class HMGUtils {
) { }
async getCurrentLocation(callBack: Function) {
if (this.platform.is('android')) {
this.devicePermissionsService.requestLocationAutherization().then( async granted => {
if(granted == true){
this.devicePermissionsService.requestLocationAutherization().then( async granted => {
if(granted == true) {
if (this.platform.is('android')) {
if ((await this.isHuaweiDevice())) {
this.getHMSLocation(callBack);
} else {
this.getGMSLocation(callBack);
}
}else{
this.common.presentAlert(this.ts.trPK('general', 'location-permission-dialog'));
} else {
this.getIOSLocation(callBack);
}
});
} else {
this.getIOSLocation(callBack);
}
} else {
return false;
}
});
}
@ -84,7 +86,7 @@ export class HMGUtils {
} catch (_err) {
console.log("Huawei Location Plugin [Error]: " + + JSON.stringify(_err));
this.common.presentAlert('Error while initializing Huawei Location Plugin');
this.common.presentAlert(this.ts.trPK('general', 'huawei-plugin-issue'));
}
}

@ -18,6 +18,7 @@ import { BackgroundGeolocation } from '@ionic-native/background-geolocation/ngx'
import { Platform } from '@ionic/angular';
import { ModalController } from '@ionic/angular';
import { FirebaseX } from '@ionic-native/firebase-x/ngx';
import { HMGUtils } from 'src/app/hmg-common/hmg_utils';
@Injectable({
@ -49,13 +50,14 @@ export class AttendScanService {
public backgroundGeolocation: BackgroundGeolocation,
public platform: Platform,
public modalController: ModalController,
public firebasex: FirebaseX
public firebasex: FirebaseX,
public hmgUtils: HMGUtils
) {
this.userData = this.common.sharedService.getSharedData(AuthenticatedUser.SHARED_DATA, false);
console.log(this.userData);
}
getDeviceLocation() {
public getDeviceLocation() {
this.isGpsRequired = true;
this.isFakeLocationUsed = false;
const isVirtual = this.device.isVirtual;
@ -64,43 +66,58 @@ export class AttendScanService {
alert('You are using virtual device');
return false;
}
this.permissions.requestLocationAutherization().then(granted => {
this.location = granted as boolean;
if (this.location) {
if (this.platform.is('android')) {
this.backgroundGeolocation.getCurrentLocation({ timeout: 10000, enableHighAccuracy: true, maximumAge: 3000 }).then((resp) => {
if (resp && (resp.latitude && resp.longitude)) {
if (resp.isFromMockProvider || resp.mockLocationsEnabled) {
this.isFakeLocationUsed = true;
}
this.lat = resp.latitude;
this.longt = resp.longitude;
this.attendance(true);
//////////// Getting location from hmg_utils //////////////////
try {
this.hmgUtils.getCurrentLocation((resp) => {
console.log(resp);
if (resp) {
this.isFakeLocationUsed = resp.isfake;
this.lat = resp.latitude;
this.longt = resp.longitude;
this.attendance(true);
}
});
} catch (e) {
this.common.presentAlert(this.ts.trPK('general', 'something-went-wrong'));
}
// this.permissions.requestLocationAutherization().then(granted => {
// this.location = granted as boolean;
// if (this.location) {
// if (this.platform.is('android')) {
// this.backgroundGeolocation.getCurrentLocation({ timeout: 10000, enableHighAccuracy: true, maximumAge: 3000 }).then((resp) => {
// if (resp && (resp.latitude && resp.longitude)) {
// if (resp.isFromMockProvider || resp.mockLocationsEnabled) {
// this.isFakeLocationUsed = true;
// }
// this.lat = resp.latitude;
// this.longt = resp.longitude;
// this.attendance(true);
} else {
this.common.presentAlert(this.ts.trPK('home', 'position-error'));
}
}, (error) => {
this.common.presentAlert(this.ts.trPK('home', 'position-error'));
});
} else {
this.geolocation.getCurrentPosition({maximumAge: 3000, timeout: 10000, enableHighAccuracy: true}).then(resp => {
if(resp && resp.coords.latitude && resp.coords.longitude) {
this.lat = resp.coords.latitude;
this.longt = resp.coords.longitude;
this.attendance(true);
// } else {
// this.common.presentAlert(this.ts.trPK('home', 'position-error'));
// }
// }, (error) => {
// this.common.presentAlert(this.ts.trPK('home', 'position-error'));
// });
// } else {
// this.geolocation.getCurrentPosition({maximumAge: 3000, timeout: 10000, enableHighAccuracy: true}).then(resp => {
// if(resp && resp.coords.latitude && resp.coords.longitude) {
// this.lat = resp.coords.latitude;
// this.longt = resp.coords.longitude;
// this.attendance(true);
} else {
this.common.presentAlert(this.ts.trPK('home', 'position-error'));
}
}).catch(error => {
this.common.presentAlert(this.ts.trPK('home', 'position-error'));
});
}
} else {
return false;
}
});
// } else {
// this.common.presentAlert(this.ts.trPK('home', 'position-error'));
// }
// }).catch(error => {
// this.common.presentAlert(this.ts.trPK('home', 'position-error'));
// });
// }
// } else {
// return false;
// }
// });
}
public attendance(isGPSValue: boolean) {

@ -19,7 +19,6 @@
</ion-col>
</ion-row>
<p>umarrrrrrrrrrrrrrrr {{check}}</p>
<ion-row padding>
<ion-col size="5" [ngClass]="{'margin-col': direction === 'en', 'disable-attendance': !serviceEnableNFC}" class="buttonStyle" >
<div class="textAndIcon" (click)="startNFCCode()">

@ -80,22 +80,6 @@ export class AttendanceOptionsComponent implements OnInit {
this.priviligeList = AuthenticationService.servicePrivilage;
this.setServicesPrivilage();
this.checkNFCStatus("one");
this.test();
}
async test () {
const test = await this.hmgUtils.isHuaweiDevice();
if (test) {
this.check = 'this device is huawei device :' + test;
console.log('this device is huawei device :' + test);
} else {
this.check = 'this device is not huawei device :' + test;
console.log('this device is non-huawei device :' + test);
}
this.hmgUtils.getCurrentLocation((data) => {
console.log(data);
});
}
public checkFirebaseDocument() {
@ -297,7 +281,7 @@ export class AttendanceOptionsComponent implements OnInit {
component: WifiModalComponent,
showBackdrop: true,
backdropDismiss: false,
componentProps:{ enableLocationWIFI: this.enableLocationWIFI, lat: this.lat, longt: this.longt},
componentProps:{ enableLocationWIFI: this.enableLocationWIFI, lat: this.lat, longt: this.longt}
});
modal.cssClass = "wifi-modal";
await modal.present();
@ -305,63 +289,88 @@ export class AttendanceOptionsComponent implements OnInit {
showWifiNotEnabled(){
this.common.showErrorMessageDialog(()=>{
},
this.ts.trPK("general", "ok"),
this.ts.trPK("general","wifi-not-enable-text"));
}
public showWifiNotEnabled(){
this.common.showErrorMessageDialog(()=>{
},
this.ts.trPK("general", "ok"),
this.ts.trPK("general","wifi-not-enable-text"));
}
getDeviceLocation(source: string) {
this.isFakeLocationUsed = false;
this.devicePermissionsService.requestLocationAutherization().then(granted => {
this.location = granted as boolean;
if (this.location) {
if (this.platform.is('android')) {
this.backgroundGeolocation.getCurrentLocation({ timeout: 10000, enableHighAccuracy: true, maximumAge: 3000 }).then((resp) => {
if (resp && (resp.latitude && resp.longitude)) {
if (resp.isFromMockProvider || resp.mockLocationsEnabled) {
this.isFakeLocationUsed = true;
this.fakeSwipeAttendance(source);
} else {
this.lat = resp.latitude;
this.longt = resp.longitude;
if (source === 'WIFI') {
this.startWifi();
} else if (source === 'NFC') {
this.checkNFCStatus('two');
}
}
} else {
this.common.presentAlert(this.ts.trPK('home', 'position-error'));
}
}, (error) => {
this.common.presentAlert(this.ts.trPK('home', 'position-error'));
});
} else {
this.geolocation.getCurrentPosition({maximumAge: 3000, timeout: 10000, enableHighAccuracy: true}).then(resp => {
if(resp && resp.coords.latitude && resp.coords.longitude) {
this.lat = resp.coords.latitude;
this.longt = resp.coords.longitude;
if (source === 'WIFI') {
this.startWifi();
} else if (source === 'NFC') {
this.checkNFCStatus('two');
}
} else {
this.common.presentAlert(this.ts.trPK('home', 'position-error'));
}
}).catch(error => {
this.common.presentAlert(this.ts.trPK('home', 'position-error'));
});
}
} else {
return false;
}
});
public getDeviceLocation(source: string) {
try {
this.hmgUtils.getCurrentLocation((resp) => {
console.log(resp);
if (resp) {
this.isFakeLocationUsed = resp.isfake;
this.lat = resp.latitude;
this.longt = resp.longitude;
if (this.isFakeLocationUsed) {
this.fakeSwipeAttendance(source);
} else {
this.lat = resp.latitude;
this.longt = resp.longitude;
if (source === 'WIFI') {
this.startWifi();
} else if (source === 'NFC') {
this.checkNFCStatus('two');
}
}
}
});
} catch (e) {
this.common.presentAlert(this.ts.trPK('general', 'something-went-wrong'));
}
// this.isFakeLocationUsed = false;
// this.devicePermissionsService.requestLocationAutherization().then(granted => {
// this.location = granted as boolean;
// if (this.location) {
// if (this.platform.is('android')) {
// this.backgroundGeolocation.getCurrentLocation({ timeout: 10000, enableHighAccuracy: true, maximumAge: 3000 }).then((resp) => {
// if (resp && (resp.latitude && resp.longitude)) {
// if (resp.isFromMockProvider || resp.mockLocationsEnabled) {
// this.isFakeLocationUsed = true;
// this.fakeSwipeAttendance(source);
// } else {
// this.lat = resp.latitude;
// this.longt = resp.longitude;
// if (source === 'WIFI') {
// this.startWifi();
// } else if (source === 'NFC') {
// this.checkNFCStatus('two');
// }
// }
// } else {
// this.common.presentAlert(this.ts.trPK('home', 'position-error'));
// }
// }, (error) => {
// this.common.presentAlert(this.ts.trPK('home', 'position-error'));
// });
// } else {
// this.geolocation.getCurrentPosition({maximumAge: 3000, timeout: 10000, enableHighAccuracy: true}).then(resp => {
// if(resp && resp.coords.latitude && resp.coords.longitude) {
// this.lat = resp.coords.latitude;
// this.longt = resp.coords.longitude;
// if (source === 'WIFI') {
// this.startWifi();
// } else if (source === 'NFC') {
// this.checkNFCStatus('two');
// }
// } else {
// this.common.presentAlert(this.ts.trPK('home', 'position-error'));
// }
// }).catch(error => {
// this.common.presentAlert(this.ts.trPK('home', 'position-error'));
// });
// }
// } else {
// return false;
// }
// });
}
fakeSwipeAttendance(sourceName: string) {
public fakeSwipeAttendance(sourceName: string) {
const request: any = {};
request.Latitude = this.lat;
request.Longitude = this.longt;

@ -2,21 +2,15 @@ import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { DatePicker } from '@ionic-native/date-picker/ngx';
import { ModalController } from '@ionic/angular';
import * as moment from 'moment';
import { AccrualService } from 'src/app/accrual-balances/services/accrual.service';
import { AddEitComponent } from 'src/app/eit/add-eit/add-eit.component';
import { AddEitResponse } from 'src/app/eit/models/add.eit.response';
import { EitAddressRequest } from 'src/app/eit/models/eit-address.request';
import { EitRequest } from 'src/app/eit/models/eit.request';
import { EITTransactionsRequest } from 'src/app/eit/models/EITTransactionsReq';
import { EIT_ACTION } from 'src/app/eit/models/submit.eit.action';
import { EitService } from 'src/app/eit/services/eit.service';
import { AuthenticationService } from 'src/app/hmg-common/services/authentication/authentication.service';
import { AuthenticatedUser } from 'src/app/hmg-common/services/authentication/models/authenticated-user';
import { CommonService } from 'src/app/hmg-common/services/common/common.service';
import { MenuResponse } from 'src/app/hmg-common/services/menu/models/menu-response';
import { MenuEntry } from 'src/app/hmg-common/services/menu/models/menu.entry';
import { TranslatorService } from 'src/app/hmg-common/services/translator/translator.service';
import { EITNotificatonBodyResponse } from 'src/app/notification/models/EITNotificationBodyRes';
import { ButtonInput } from 'src/app/uI-elements/button.input';
import { DateTimeInput } from 'src/app/uI-elements/date-time.input';
import { DateInput } from 'src/app/uI-elements/date.input';
@ -37,12 +31,11 @@ export class AddAddressComponent implements OnInit {
public countries: any = [];
@ViewChild("containerDiv") containerDiv: ElementRef;
////*new add*/////
getPassNotificationDetails: any;
getPassdirfromNotifiPage: boolean = false;
functionName: string = "";
menuType: any;
/////////////////
private textArea: TextAreaInput;
private numberInput: NumberInput;
@ -57,10 +50,9 @@ export class AddAddressComponent implements OnInit {
private eitVALSettoCall: any = [];
private comtransNo: number = 0;
// private parentChilds: any[];
getPassMnuEntryObj: MenuEntry;
selMenu: MenuResponse;
eitSubmitAction: number = 0; //not submit
eitSubmitAction: number = 0;
private eitRequest: EitAddressRequest;
private validateEitObj: any = [];
private ExtraObj: any = {};
@ -69,7 +61,6 @@ export class AddAddressComponent implements OnInit {
respID: number;
headerTitle: string = "";
isResubmit: boolean = false;
//private updatedNotObject:any=[];
private updatedValues: any = [];
addEITData: any;
direction: string;
@ -101,48 +92,15 @@ export class AddAddressComponent implements OnInit {
MenuResponse.SHARED_DATA,
false
);
// this.addEITData = this.cs.sharedService.getSharedData("AddEITData", false);
// console.log("addEITData: " + this.addEITData);
// console.log("dirfromNotificationPage: " + this.addEITData.dirfromNotificationPage);
this.eitRequest = new EitAddressRequest();
// this.buttonInput = new ButtonInput('btnSubmit', 'Submit', 'containerDiv', 'Y');
////*new add*/////
/**********resubmit************ */
// this.getPassNotificationDetails = this.cs.sharedService.getSharedData(EITNotificatonBodyResponse.NOT_WORKLIST, false);//WARINING
// this.getPassdirfromNotifiPage = this.addEITData.dirfromNotificationPage;
// if (this.getPassdirfromNotifiPage) {
// this.functionName = this.getPassNotificationDetails.FUNCTION_NAME; //;this.getPassNotificationDetails.NOTIFICATION_NAME;
// this.menuType = "E";
// this.selEmp = this.getPassNotificationDetails.SELECTED_EMPLOYEE_NUMBER;
// this.respID = -999;
// this.validateEitObj = this.addEITData.submitEITObjList;
// // this.eitSubmitAction=this.getPassNotificationDetails.EIT_ACTION;
// let msg: string = "";
// msg = this.ts.trPK("eit", "update-title");
// this.headerTitle = msg;
// } else {
// this.getPassMnuEntryObj = this.selMenu.GetMenuEntriesList;
// this.comtransNo = this.addEITData.transNo;
// this.functionName = this.getPassMnuEntryObj.FUNCTION_NAME;
// this.menuType = this.selMenu.List_Menu.MENU_TYPE;
// this.validateEitObj = this.addEITData.submitEITObjList;
this.headerTitle = this.selMenu.GetMenuEntriesList.PROMPT;
// this.eitSubmitAction = this.cs.sharedService.getSharedData(
// EITTransactionsRequest.SUBMIT_EIT_ACTION
// );
// }
}
ngOnInit() { }
ngAfterViewInit() {
console.log("ngAfterViewInit");
// console.log(this.containerDiv.nativeElement);
this.selectedStatus = this.cs.sharedService.getSharedData(ProfileService.SELECTED_STATUS);
var addressEntries = this.cs.sharedService.getSharedData(ProfileService.ADRESS_ENTRIES);
const addressEntries = this.cs.sharedService.getSharedData(ProfileService.ADRESS_ENTRIES);
if (addressEntries && addressEntries.UPDATE_BUTTON === 'Y') {
this.isUpdate = true;
let countryDetail = this.cs.sharedService.getSharedData(ProfileService.COUNTRY);
@ -152,9 +110,6 @@ export class AddAddressComponent implements OnInit {
this.isUpdate = false;
}
this.getEitDffStructure();
// this.addFieldToDOM(this.buttonInput, 'btnSubmit', this.cs.presentAlert('Clicked!'), true)
this.getCountires();
this.effectiveDate = new Date();
}
@ -166,7 +121,6 @@ export class AddAddressComponent implements OnInit {
P_MENU_TYPE: this.menuType,
P_SELECTED_RESP_ID: this.respID,
P_COUNTRY_CODE: 'SA'
// P_USER_NAME:this.userName
};
this.profileService.getAddressDiffStructure(body).subscribe((result: any) => {
this.handleEitDffStructureResult(result);
@ -190,12 +144,6 @@ export class AddAddressComponent implements OnInit {
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
@ -203,7 +151,6 @@ export class AddAddressComponent implements OnInit {
//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,
@ -214,12 +161,8 @@ export class AddAddressComponent implements OnInit {
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,
@ -229,9 +172,6 @@ export class AddAddressComponent implements OnInit {
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 (
@ -263,13 +203,6 @@ export class AddAddressComponent implements OnInit {
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 (
@ -303,19 +236,6 @@ export class AddAddressComponent implements OnInit {
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 (
@ -360,9 +280,6 @@ export class AddAddressComponent implements OnInit {
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,
@ -372,53 +289,30 @@ export class AddAddressComponent implements OnInit {
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();
}
@ -437,8 +331,6 @@ export class AddAddressComponent implements OnInit {
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 => {
@ -477,8 +369,6 @@ export class AddAddressComponent implements OnInit {
elem.innerHTML = dateString;
elem.dataset.dtvalue = dateString;
}
//elem.innerHTML = dateString;
// elem.dataset.dtvalue = dateString;
},
err => console.log("Error occurred while getting date: ", err)
);
@ -534,11 +424,6 @@ export class AddAddressComponent implements OnInit {
}
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");
@ -553,7 +438,6 @@ export class AddAddressComponent implements OnInit {
}
if (select.dataset.hiddenval) {
select.value = select.dataset.hiddenval;
//select.dataset.hiddenval="";
} else {
select.value = DV.P_ID_COLUMN_NAME;
}
@ -571,14 +455,7 @@ export class AddAddressComponent implements OnInit {
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 &&
@ -586,9 +463,7 @@ export class AddAddressComponent implements OnInit {
) {
let listArray: any = obj.CHILD_SEGMENTS_VS_Splited;
listArray.forEach(element => {
//if(isEmpty)
this.emptyChildElement(element);
// else
this.getValueSet(element);
});
}
@ -598,9 +473,7 @@ export class AddAddressComponent implements OnInit {
) {
let listArray: any = obj.CHILD_SEGMENTS_DV_Splited;
listArray.forEach(element => {
// if(isEmpty){
this.emptyChildElement(element);
// }else{
for (let i = 0; i < this.eitResponse.length; i++) {
if (this.eitResponse[i].SEGMENT_NAME == element) {
this.getDefaultValue(
@ -613,11 +486,9 @@ export class AddAddressComponent implements OnInit {
);
}
}
// }
});
}
return false;
// e.stopImmediatePropagation();
});
} catch (e) {
console.log(e.status);
@ -650,9 +521,6 @@ export class AddAddressComponent implements OnInit {
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")
@ -674,7 +542,6 @@ export class AddAddressComponent implements OnInit {
}
}
//if (dependenciesList==false){return false};
const body = {
P_SELECTED_EMPLOYEE_NUMBER: this.selEmp,
P_MENU_TYPE: this.menuType,
@ -688,11 +555,6 @@ export class AddAddressComponent implements OnInit {
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;
@ -724,20 +586,11 @@ export class AddAddressComponent implements OnInit {
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) {
@ -1572,32 +1425,29 @@ export class AddAddressComponent implements OnInit {
EitRequest.SHARED_DATA
);
this.cs.sharedService.setSharedData(result, AddEitResponse.SHARED_DATA);
//this.addrespList=result.SubmitEITTransactionList;
// this.itemKey=this.addrespList.P_ITEM_KEY;
// this.P_TransactionID=result.SubmitEITTransactionList.P_TRANSACTION_ID;
// this.sharedData.setSharedData(result,AddEitResponse.SHARED_DATA);
// // this.sharedData.setSharedData(result.SubmitEITTransactionList.P_TRANSACTION_ID,"TransactionIDResubmit");
// // this.sharedData.setSharedData(this.eitRequest,EitRequest.SHARED_DATA);
this.cs.sharedService.setSharedData(
{ isResubmit: false },
"confirmAddEITData"
);
this.cs.openConfirmAddAddress();
//this.cs.openConfirmEitPage();
// this.navCtrl.push("ConfirmAddEitPage", { isResubmit: false });
}
}
validateEITTransaction() {
// // let EITTransactionValues:any= [];
// let today = new Date(this.Sdate);
// let day = today.getDate();
// let month = today.getMonth() + 1;
// let year = today.getFullYear();
// let todayDate = month + '/' + day + '/' + year;
// let effectiveDate = todayDate;
public checkSelectedStatus() {
if (this.selectedStatus && this.selectedStatus.data) {
if (this.selectedStatus.data == '1') {
return 'CORRECT';
} else if (this.selectedStatus.data == '2') {
return 'CHANGE';
} else {
return 'NEW';
}
} else {
return 'NEW';
}
}
public validateEITTransaction() {
this.arrValues = this.getElementsValues();
if (this.arrValues) {
this.eitRequest = {
@ -1609,21 +1459,19 @@ export class AddAddressComponent implements OnInit {
EITTransactionTBL: this.arrValues,
P_COUNTRY_CODE: this.country,
P_EFFECTIVE_DATE: moment(this.effectiveDate).format('DD-MMM-YYYY'),
P_ACTION: this.selectedStatus.data == '1' ? 'CHANGE' : this.selectedStatus.data == '2' ? 'CORRECT' : 'NEW'
P_ACTION: this.checkSelectedStatus()
};
this.profileService
.submitAddressTransaction(this.eitRequest)
.subscribe((result: any) => {
this.handleSubmitEitResult(result);
// this.handleEITValidateTr(result);
});
}
}
private handleEITValidateTr(result) {
let data: any = { eitRequest: {}, updated: [] };
if (this.cs.validResponse(result)) {
// public static SHARED_DATA = 'login-request';
this.cs.sharedService.setSharedData(
this.eitRequest,
EitRequest.SHARED_DATA
@ -1632,17 +1480,9 @@ export class AddAddressComponent implements OnInit {
let data: any = { eitRequest: {}, updated: [] };
data.eitRequest = this.eitRequest;
data.updated = this.updatedValues;
// this.viewCtrl.dismiss(data);
this.modalController.dismiss(data);
// this.closemodal();
} else {
this.cs.openConfirmAddAddress();
//this.submitEit();
// this.navCtrl.push("ConfirmAddEitPage");
// data = { eitRequest: {}, updated: [] };
// data.eitRequest = this.eitRequest;
// data.updated = this.updatedValues;
// this.viewCtrl.dismiss(data);
}
} else {
this.updatedValues = [];
@ -1668,7 +1508,6 @@ export class AddAddressComponent implements OnInit {
const elem = document.getElementById(
this.submitAbsObjList[i].APPLICATION_COLUMN_NAME
) as HTMLInputElement;
//obj.transactionNo=this.submitAbsObjList[i].TRANSACTION_NUMBER;
if (elem) {
if (val) {
let feldDetails = this.eitResponse.find(
@ -1683,8 +1522,6 @@ export class AddAddressComponent implements OnInit {
if (isStandardDate) {
//elem.value = this.common.reverseFormatDate(val);
} else if (isStandardDateTime) {
// elem.innerHTML = this.common.reverseFormatStandardDate(val);
// elem.dataset.dtvalue = this.common.reverseFormatStandardDate(val);
} else if (isStandardTime) {
elem.innerHTML = val;
elem.dataset.dtvalue = val;
@ -1712,13 +1549,10 @@ export class AddAddressComponent implements OnInit {
this.getValueSet(element);
});
}
//var event = new Event('change');
//elem.dispatchEvent(event);
}
} else {
}
}
//this.ExtraObj=obj;
}
}

@ -307,9 +307,11 @@ export class HomeComponent implements OnInit {
}
async presentModal(source: string) {
console.log(source);
const modal = await this.modalController.create({
component: EditDetailProfileComponent,
cssClass: 'my-custom-modal-css'
cssClass: 'my-custom-modal-css',
componentProps:{ sourceName: source}
});
modal.onDidDismiss()

@ -9,13 +9,16 @@
<ion-item lines="none">
<ion-label >
<h3 style="color: black; font-size: 20px; white-space: break-spaces !important">{{ts.trPK('general','correct-or-complete')}}</h3></ion-label>
<h3 *ngIf="sourceName === 'basicDetails'" style="color: black; font-size: 20px; white-space: break-spaces !important">{{ts.trPK('general','correct-or-complete')}}</h3>
<h3 *ngIf="sourceName === 'address'" style="color: black; font-size: 20px; white-space: break-spaces !important">{{ts.trPK('general','correct-or-complete-address')}}</h3>
</ion-label>
<ion-radio slot="start" color="secondary" mode='md' value="1"></ion-radio>
</ion-item>
<ion-item lines="none">
<ion-label>
<h3 style="color: black; font-size: 20px; white-space: break-spaces !important">{{ts.trPK('general','new-info')}}</h3>
<h3 *ngIf="sourceName === 'basicDetails'" style="color: black; font-size: 20px; white-space: break-spaces !important">{{ts.trPK('general','new-info')}}</h3>
<h3 *ngIf="sourceName === 'address'" style="color: black; font-size: 20px; white-space: break-spaces !important">{{ts.trPK('general','new-info-address')}}</h3>
</ion-label>
<ion-radio slot="start" color="secondary" mode='md' value="2"></ion-radio>
</ion-item>

@ -9,6 +9,7 @@ import { TranslatorService } from 'src/app/hmg-common/services/translator/transl
})
export class EditDetailProfileComponent implements OnInit {
public isChange: any;
public sourceName: any;
constructor(
public modalController: ModalController,
@ -17,7 +18,9 @@ export class EditDetailProfileComponent implements OnInit {
colorRadio = "#269db8"
ngOnInit() { }
ngOnInit() {
console.log(this.sourceName);
}
dismiss(actionValue: any) {
// using the injected ModalController this page

@ -209,6 +209,14 @@
}
},
"general": {
"huawei-plugin-issue": {
"en": "Error while initializing Huawei Location Plugin",
"ar": "خطأ أثناء تهيئة Huawei Location Plugin"
},
"something-went-wrong": {
"en": "Something went wrong! Please try again",
"ar": "هناك خطأ ما! حاول مرة اخرى"
},
"invalid-huawei-location": {
"en": "Error while getting location from Huawei HMS services",
"ar": "خطأ أثناء الحصول على الموقع من خدمات Huawei HMS"
@ -698,7 +706,7 @@
"ar": "إستخدم الرقم التعريفي"
},
"auth-please": {
"en": "Please Authenticated",
"en": "Please Authenticate",
"ar": "عرف نفسك"
},
"dial-code": {
@ -1021,6 +1029,14 @@
"en": "Main Address",
"ar": "العنوان الرئيسي"
},
"correct-or-complete-address": {
"en": "Correct or amend this address",
"ar": "تصحيح أو تعديل هذا العنوان"
},
"new-info-address": {
"en": "Enter a new address if you have moved",
"ar": "أدخل عنوان جديد إذا كنت قد انتقلت"
},
"correct-or-complete": {
"en": "correct or complete the current details",
"ar": "تعديل او اكمال التفاصيل الحالية"

Loading…
Cancel
Save