diff --git a/patient/lib/presentation/auth/personal_details_screen.dart b/patient/lib/presentation/auth/personal_details_screen.dart index 0aa9da1..8010dff 100644 --- a/patient/lib/presentation/auth/personal_details_screen.dart +++ b/patient/lib/presentation/auth/personal_details_screen.dart @@ -91,11 +91,13 @@ class _PersonalDetailsScreenState extends State { : adultNameController.text, age: isAssessmentForChild ? parseAge(childAgeController.text) : parseAge(adultAgeController.text), isAdult: isAssessmentForChild ? isAdult(childAgeController.text) : isAdult(adultAgeController.text), - phoneNo: phoneController.text, + phoneNo: isAssessmentForChild ? guardianPhoneController.text : phoneController.text, email: '', guardianName: isAssessmentForChild ? adultNameController.text : '', - guardianRelation: isAssessmentForChild ? guardianPhoneController.text : phoneController.text, - country: selectedCountry?.displayName ?? '', + guardianRelation: isAssessmentForChild ? selectedRelation : '', + country: isAssessmentForChild + ? selectedChildCountry?.displayName ?? '' + : selectedCountry?.displayName ?? '', gender: isAssessmentForChild ? selectedChildGender ?? '' : selectedGender ?? '', ); } @@ -110,6 +112,14 @@ class _PersonalDetailsScreenState extends State { onPressed: () { if (_formKey.currentState?.validate() ?? false) { + if (isAssessmentForChild && selectedRelation.isEmpty) { + SnackbarService.showError('Please select your relation with the patient'); + return; + } + if (isAssessmentForChild && (selectedChildGender == null || selectedChildGender!.isEmpty)) { + SnackbarService.showError('Please select patient gender'); + return; + } final personalInfoModel = getPersonalInfo; final authProvider = context.read(); authProvider.storePatientPersonalInfo(personalInfoModel);