Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOSIP-34136 not translating when user enter same data input field #724

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading