From 7a0dccae86ea4465d2c19c7bb677e44b99b2921f Mon Sep 17 00:00:00 2001 From: Sachin s p <52343650+SachinPremkumar@users.noreply.github.com> Date: Mon, 1 Jul 2024 15:56:07 +0530 Subject: [PATCH] fixed UIN generation failed issue (#399) Signed-off-by: Sachin S P Co-authored-by: Sachin S P --- .../dto/registration/RegistrationDto.java | 2 +- .../impl/PreRegZipHandlingServiceImpl.java | 18 +++++----- .../packetmanager/dto/SimpleType.java | 2 +- .../widgets/pre_reg_data_control.dart | 36 +++++++++++-------- 4 files changed, 32 insertions(+), 26 deletions(-) diff --git a/android/clientmanager/src/main/java/io/mosip/registration/clientmanager/dto/registration/RegistrationDto.java b/android/clientmanager/src/main/java/io/mosip/registration/clientmanager/dto/registration/RegistrationDto.java index 657b4d23..7552ebb2 100644 --- a/android/clientmanager/src/main/java/io/mosip/registration/clientmanager/dto/registration/RegistrationDto.java +++ b/android/clientmanager/src/main/java/io/mosip/registration/clientmanager/dto/registration/RegistrationDto.java @@ -180,7 +180,7 @@ public void addDemographicField(String fieldId, String value, String language) { v = v != null ? v : new ArrayList(); ((List)v).removeIf( e -> e.getLanguage().equalsIgnoreCase(language)); if(isValidValue(value)) - ((List)v).add(new SimpleType(language, value,"")); + ((List)v).add(new SimpleType(language, value)); return v; }); clearAndNotifyAllObservers(); diff --git a/android/clientmanager/src/main/java/io/mosip/registration/clientmanager/service/external/impl/PreRegZipHandlingServiceImpl.java b/android/clientmanager/src/main/java/io/mosip/registration/clientmanager/service/external/impl/PreRegZipHandlingServiceImpl.java index 69de4eb6..0e106ff2 100644 --- a/android/clientmanager/src/main/java/io/mosip/registration/clientmanager/service/external/impl/PreRegZipHandlingServiceImpl.java +++ b/android/clientmanager/src/main/java/io/mosip/registration/clientmanager/service/external/impl/PreRegZipHandlingServiceImpl.java @@ -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; } diff --git a/android/packetmanager/src/main/java/io/mosip/registration/packetmanager/dto/SimpleType.java b/android/packetmanager/src/main/java/io/mosip/registration/packetmanager/dto/SimpleType.java index 116e640d..3e8f7a99 100644 --- a/android/packetmanager/src/main/java/io/mosip/registration/packetmanager/dto/SimpleType.java +++ b/android/packetmanager/src/main/java/io/mosip/registration/packetmanager/dto/SimpleType.java @@ -12,5 +12,5 @@ public class SimpleType { private String language; private String value; - private String name; + } diff --git a/lib/ui/process_ui/widgets/pre_reg_data_control.dart b/lib/ui/process_ui/widgets/pre_reg_data_control.dart index 02ce3b7d..c0183650 100644 --- a/lib/ui/process_ui/widgets/pre_reg_data_control.dart +++ b/lib/ui/process_ui/widgets/pre_reg_data_control.dart @@ -93,11 +93,11 @@ class _PreRegDataControlState extends State { 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, ); @@ -109,7 +109,7 @@ class _PreRegDataControlState extends State { if(e.id == "gender"){ globalProvider.setLanguageSpecificValue( key!, - name, + value, language, globalProvider.fieldInputValue, ); @@ -117,21 +117,27 @@ class _PreRegDataControlState extends State { 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){ @@ -139,14 +145,14 @@ class _PreRegDataControlState extends State { 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!); } } }