Skip to content

Commit

Permalink
Merge pull request #724 from MadhuMosip/develop
Browse files Browse the repository at this point in the history
MOSIP-34136 not translating when user enter same data input field
  • Loading branch information
aranaravi authored Jul 2, 2024
2 parents 5023599 + fd3280b commit dc41198
Showing 1 changed file with 18 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -609,8 +609,9 @@ export class UpdatedemographicComponent implements OnInit, OnDestroy {
}

captureValue(event: any, formControlName: string, language: string, currentValue: any) {
let userNewData = event.target.value.trim();
let self = this;
if (event.target.value.trim() === "") {
if (userNewData === "") {
if (this.userInfoClone[formControlName]) {
delete this.userInfoClone[formControlName]
}
Expand All @@ -620,34 +621,34 @@ export class UpdatedemographicComponent implements OnInit, OnDestroy {
})
} else {
if (formControlName !== "proofOfIdentity") {
if (event.target.value !== currentValue && !/\d/.test(event.target.value)) {
if (userNewData !== currentValue && !/\d/.test(userNewData) && userNewData !== this.userInputValues[formControlName][language] ) {
this.isSameData[formControlName] = false;
this.enteredOnlyNumbers = false;
this.userInfoClone[formControlName] = []
this.getUserPerfLang.forEach(item => {
let newData
if (item === language) {
newData = { "language": language, "value": event.target.value }
newData = { "language": language, "value": userNewData }
this.userInfoClone[formControlName].push(newData)
this.userInputValues[formControlName][language] = event.target.value;
this.userInputValues[formControlName][language] = userNewData;
} else {
this.translateUserInput(item, language, event.target.value, formControlName, 'userInfoClone')
this.translateUserInput(item, language, userNewData, formControlName, 'userInfoClone')
}
})
} else {
if (this.userInfoClone[formControlName]) {
delete this.userInfoClone[formControlName]
}
if(event.target.value === currentValue){
if(userNewData === currentValue){
this.isSameData[formControlName] = true;
}else if(/\d/.test(event.target.value)){
}else if(/\d/.test(userNewData)){
this.enteredOnlyNumbers = true;
}

}
} else {
self[formControlName]["documentreferenceId"] = event.target.value;
this.userInputValues[formControlName] = event.target.value;
self[formControlName]["documentreferenceId"] = userNewData;
this.userInputValues[formControlName] = userNewData;
}
}

Expand Down Expand Up @@ -706,7 +707,8 @@ export class UpdatedemographicComponent implements OnInit, OnDestroy {

captureAddressValue(event: any, formControlName: string, language: string, currentValue: string) {
let self = this;
if (event.target.value.trim() === "") {
let userNewData = event.target.value.trim();
if (userNewData === "") {
if (this.userInfoClone[formControlName]) {
delete this.userInfoClone[formControlName]
}
Expand All @@ -715,17 +717,17 @@ export class UpdatedemographicComponent implements OnInit, OnDestroy {
})
} else {
if (formControlName !== "proofOfAddress") {
if (event.target.value !== currentValue) {
if (userNewData !== currentValue) {
this.isSameData[formControlName] = false;
this.userInfoAddressClone[formControlName] = []
this.getUserPerfLang.forEach(item => {
let newData
if (item === language) {
newData = { "language": language, "value": event.target.value }
newData = { "language": language, "value": userNewData }
this.userInfoAddressClone[formControlName].push(newData)
this.userInputValues[formControlName][language] = event.target.value;
this.userInputValues[formControlName][language] = userNewData;
} else {
this.translateUserInput(item, language, event.target.value, formControlName, 'userInfoAddressClone')
this.translateUserInput(item, language, userNewData, formControlName, 'userInfoAddressClone')
}
})
} else {
Expand All @@ -738,8 +740,8 @@ export class UpdatedemographicComponent implements OnInit, OnDestroy {
this.isSameData[formControlName] = true;
}
} else {
self[formControlName]["documentreferenceId"] = event.target.value;
this.userInputValues[formControlName] = event.target.value;
self[formControlName]["documentreferenceId"] = userNewData;
this.userInputValues[formControlName] = userNewData;
}
}
}
Expand Down

0 comments on commit dc41198

Please sign in to comment.