Skip to content

Commit

Permalink
fixed UIN generation failed issue (#399)
Browse files Browse the repository at this point in the history
Signed-off-by: Sachin S P <[email protected]>
Co-authored-by: Sachin S P <[email protected]>
  • Loading branch information
SachinPremkumar and Sachin S P authored Jul 1, 2024
1 parent 9c3f804 commit 7a0dcca
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public void addDemographicField(String fieldId, String value, String language) {
v = v != null ? v : new ArrayList<SimpleType>();
((List<SimpleType>)v).removeIf( e -> e.getLanguage().equalsIgnoreCase(language));
if(isValidValue(value))
((List<SimpleType>)v).add(new SimpleType(language, value,""));
((List<SimpleType>)v).add(new SimpleType(language, value));
return v;
});
clearAndNotifyAllObservers();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,15 +340,15 @@ private Object getValueFromJson(String key, String fieldType, JSONObject jsonObj
break;
}
}
if(genericValueListDynamic!=null) {
for (GenericValueDto dto : genericValueListDynamic) {
if (dto.getCode().equalsIgnoreCase(value)) {
updatedName = dto.getName();
break;
}
}
}
list.add(new SimpleType(object.optString("language", ""), object.optString("value",""), updatedName!= "" ? updatedName : value));
// if(genericValueListDynamic!=null) {
// for (GenericValueDto dto : genericValueListDynamic) {
// if (dto.getCode().equalsIgnoreCase(value)) {
// updatedName = dto.getName();
// break;
// }
// }
// }
list.add(new SimpleType(object.optString("language", ""), updatedName!= "" ? updatedName : object.optString("value","")));
}
return list;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ public class SimpleType {

private String language;
private String value;
private String name;

}
36 changes: 21 additions & 15 deletions lib/ui/process_ui/widgets/pre_reg_data_control.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ class _PreRegDataControlState extends State<PreRegDataControl> {
String name = obj['name'] ?? '';
String language = obj['language'] ?? '';
String value = obj["value"] ?? '';
GenericData data = GenericData(name: name, code: value, langCode: language);
GenericData data = GenericData(name: value, code: value, langCode: language);
if(e.controlType == "textbox"){
globalProvider.setLanguageSpecificValue(
key!,
name,
value,
language,
globalProvider.fieldInputValue,
);
Expand All @@ -109,44 +109,50 @@ class _PreRegDataControlState extends State<PreRegDataControl> {
if(e.id == "gender"){
globalProvider.setLanguageSpecificValue(
key!,
name,
value,
language,
globalProvider.fieldInputValue,
);
}
if(e.fieldType == "dynamic"){
globalProvider.setLanguageSpecificValue(
key!,
name,
value,
language,
globalProvider.fieldInputValue,
);
}
if(e.id != "gender" && e.fieldType != "dynamic") {
if(language == lang) {
globalProvider.setLanguageSpecificValue(
"${e.group}${e.subType}",
data,
lang,
globalProvider.fieldInputValue,
);
globalProvider.setLocationHierarchy(
e.group!, data.code, index!);
temp = await registrationTaskProvider.getLocationValues("$index", globalProvider.selectedLanguage);
for(var subData in temp) {
GenericData dataSubValue = GenericData(name: subData!.name, code: subData.code, langCode: lang);
if (language == lang) {
if (data.code == subData.code) {
globalProvider.setLanguageSpecificValue(
"${e.group}${e.subType}",
dataSubValue,
lang,
globalProvider.fieldInputValue,
);
globalProvider.setLocationHierarchy(
e.group!, subData.code, index!);
}
}
}
}
for(var parentData in allValue){
String dynamicName = parentData!.name ?? '';
String dynamicValue = parentData.code ?? '';
GenericData dataValue = GenericData(name: dynamicName, code: dynamicValue, langCode: lang);
if(dynamicValue == value){
globalProvider.setLocationHierarchy(
e.group!, dynamicValue, index!);
globalProvider.setLanguageSpecificValue(
"${e.group}${e.subType}",
dataValue,
lang,
globalProvider.fieldInputValue,
);
globalProvider.setLocationHierarchy(
e.group!, dataValue.code, index!);
}
}
}
Expand Down

0 comments on commit 7a0dcca

Please sign in to comment.