diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 662fec0..92a5e6c 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -7,8 +7,8 @@ - - + + diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..fb0d77e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/shelf/Uncommitted_changes_before_Update_at_21-06-2023_11_16_[Changes]/shelved.patch b/.idea/shelf/Uncommitted_changes_before_Update_at_21-06-2023_11_16_[Changes]/shelved.patch new file mode 100644 index 0000000..81da1e4 --- /dev/null +++ b/.idea/shelf/Uncommitted_changes_before_Update_at_21-06-2023_11_16_[Changes]/shelved.patch @@ -0,0 +1,13 @@ +Index: .idea/misc.xml +=================================================================== +diff --git a/.idea/misc.xml b/.idea/misc.xml +--- a/.idea/misc.xml ++++ b/.idea/misc.xml +@@ -1,6 +1,6 @@ + + +- ++ + + + diff --git a/.idea/shelf/Uncommitted_changes_before_Update_at_21-06-2023_11_16_[Changes]1/shelved.patch b/.idea/shelf/Uncommitted_changes_before_Update_at_21-06-2023_11_16_[Changes]1/shelved.patch new file mode 100644 index 0000000..cb3673a --- /dev/null +++ b/.idea/shelf/Uncommitted_changes_before_Update_at_21-06-2023_11_16_[Changes]1/shelved.patch @@ -0,0 +1,77 @@ +Index: app/src/main/java/com/example/hposregistration/ui/fragments/registration/AbhaRegistrationFragment.kt +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/app/src/main/java/com/example/hposregistration/ui/fragments/registration/AbhaRegistrationFragment.kt b/app/src/main/java/com/example/hposregistration/ui/fragments/registration/AbhaRegistrationFragment.kt +--- a/app/src/main/java/com/example/hposregistration/ui/fragments/registration/AbhaRegistrationFragment.kt ++++ b/app/src/main/java/com/example/hposregistration/ui/fragments/registration/AbhaRegistrationFragment.kt +@@ -68,6 +68,7 @@ + aadharID.setText(user.AadharId) + etAbhaId.setText(user.AbhaId) + etName.setText(user.name) ++ + } + } + +Index: .idea/deploymentTargetDropDown.xml +=================================================================== +diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml +deleted file mode 100644 +--- a/.idea/deploymentTargetDropDown.xml ++++ /dev/null +@@ -1,17 +0,0 @@ +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +\ No newline at end of file +Index: .idea/vcs.xml +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/.idea/vcs.xml b/.idea/vcs.xml +new file mode 100644 +--- /dev/null ++++ b/.idea/vcs.xml +@@ -0,0 +1,6 @@ ++ ++ ++ ++ ++ ++ +\ No newline at end of file +Index: .idea/gradle.xml +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +diff --git a/.idea/gradle.xml b/.idea/gradle.xml +--- a/.idea/gradle.xml ++++ b/.idea/gradle.xml +@@ -7,8 +7,8 @@ + + + +- +- ++ ++ + + + diff --git a/.idea/shelf/Uncommitted_changes_before_Update_at_21-06-2023_11_16__Changes_.xml b/.idea/shelf/Uncommitted_changes_before_Update_at_21-06-2023_11_16__Changes_.xml new file mode 100644 index 0000000..6e7cf62 --- /dev/null +++ b/.idea/shelf/Uncommitted_changes_before_Update_at_21-06-2023_11_16__Changes_.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/shelf/Uncommitted_changes_before_Update_at_21-06-2023_11_16__Changes_1.xml b/.idea/shelf/Uncommitted_changes_before_Update_at_21-06-2023_11_16__Changes_1.xml new file mode 100644 index 0000000..90bf95d --- /dev/null +++ b/.idea/shelf/Uncommitted_changes_before_Update_at_21-06-2023_11_16__Changes_1.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/example/hposregistration/ui/fragments/registration/AbhaRegistrationFragment.kt b/app/src/main/java/com/example/hposregistration/ui/fragments/registration/AbhaRegistrationFragment.kt index b481995..2725c59 100644 --- a/app/src/main/java/com/example/hposregistration/ui/fragments/registration/AbhaRegistrationFragment.kt +++ b/app/src/main/java/com/example/hposregistration/ui/fragments/registration/AbhaRegistrationFragment.kt @@ -68,6 +68,8 @@ class AbhaRegistrationFragment : BaseFragment() { aadharID.setText(user.AadharId) etAbhaId.setText(user.AbhaId) etName.setText(user.name) + centerName.setText(user.CenterName) + } } @@ -83,9 +85,7 @@ class AbhaRegistrationFragment : BaseFragment() { AadharId = aadharId AbhaId = abhaId CenterName = centerName - _id = - aadharId + userName.substring(0, 3).uppercase() + centerName.substring(0, 3) - .uppercase() + _id = aadharId + userName.substring(0, 3).uppercase() + centerName.substring(0, 3).uppercase() } viewModel.insert(userData) @@ -180,7 +180,7 @@ class AbhaRegistrationFragment : BaseFragment() { return false } if (!checkCenterName(centerName)) { - etName.error = "Center name can't be empty" + etCenterName.error = "Center name can't be empty or less than 3 characters" return false } } @@ -188,11 +188,11 @@ class AbhaRegistrationFragment : BaseFragment() { } private fun checkAbhaIDNumber(abhaId: String): Boolean { - return abhaId.isNotEmpty() || abhaId.length == 14 + return abhaId.isNotEmpty() && abhaId.length >= 14 } private fun checkAadharIDNumber(aadharId: String): Boolean { - return aadharId.isNotEmpty() || aadharId.length == 12 + return aadharId.isNotEmpty() && aadharId.length >= 12 } private fun checkUserName(userName: String): Boolean { @@ -200,7 +200,7 @@ class AbhaRegistrationFragment : BaseFragment() { } private fun checkCenterName(centerName: String): Boolean { - return centerName.isNotEmpty() + return centerName.isNotEmpty() && centerName.length >= 3 } private fun navigateToUserDetailsFragment(userId: String) { diff --git a/app/src/main/java/com/example/hposregistration/ui/fragments/registration/CaptureUserImageFragment.kt b/app/src/main/java/com/example/hposregistration/ui/fragments/registration/CaptureUserImageFragment.kt index c96ce79..b685550 100644 --- a/app/src/main/java/com/example/hposregistration/ui/fragments/registration/CaptureUserImageFragment.kt +++ b/app/src/main/java/com/example/hposregistration/ui/fragments/registration/CaptureUserImageFragment.kt @@ -72,6 +72,10 @@ class CaptureUserImageFragment : Fragment() { userData = user if (userData.userImage.isNotEmpty()) { binding.userImage.loadImageFromUri(Uri.parse(user.userImage)) + binding.btnSubmit.isEnabled = true + binding.btnSubmit.setOnClickListener { + navigate() + } } } } @@ -100,6 +104,7 @@ class CaptureUserImageFragment : Fragment() { if (grantedPermissions.isNotEmpty()) { binding.userImage.setOnClickListener { + takePicture() } } @@ -119,6 +124,10 @@ class CaptureUserImageFragment : Fragment() { private fun submitImage(uri: Uri) { userData.userImage = uri.toString() viewModel.insert(userData) + navigate() + } + + private fun navigate() { val action = CaptureUserImageFragmentDirections .actionCaptureUserImageFragment2ToReviewDetailsRegistrationFragment(args.userId) findNavController().navigate(action) diff --git a/app/src/main/java/com/example/hposregistration/ui/fragments/registration/ReviewDetailsRegistrationFragment.kt b/app/src/main/java/com/example/hposregistration/ui/fragments/registration/ReviewDetailsRegistrationFragment.kt index a0012b5..12564de 100644 --- a/app/src/main/java/com/example/hposregistration/ui/fragments/registration/ReviewDetailsRegistrationFragment.kt +++ b/app/src/main/java/com/example/hposregistration/ui/fragments/registration/ReviewDetailsRegistrationFragment.kt @@ -124,11 +124,19 @@ class ReviewDetailsRegistrationFragment : BaseFragment() { binding.tvIsUnderMedication.text = requireContext().getString( R.string.is_patient_under_any_medication_details, "Yes" ) + } else { + binding.tvIsUnderMedication.text = requireContext().getString( + R.string.is_patient_under_any_medication_details, "No" + ) } if (userData.isUnderTransfusion!!) { binding.tvIsUnderTransfusion.text = requireContext().getString( R.string.is_patient_undergoing_any_blood_transfusion_details, "Yes" ) + }else{ + binding.tvIsUnderTransfusion.text = requireContext().getString( + R.string.is_patient_undergoing_any_blood_transfusion_details, "No" + ) } if (userData.sickleCellHistory != "") { diff --git a/app/src/main/java/com/example/hposregistration/ui/fragments/registration/UserDetailsRegistrationFragment.kt b/app/src/main/java/com/example/hposregistration/ui/fragments/registration/UserDetailsRegistrationFragment.kt index 259f9bd..d689d9a 100644 --- a/app/src/main/java/com/example/hposregistration/ui/fragments/registration/UserDetailsRegistrationFragment.kt +++ b/app/src/main/java/com/example/hposregistration/ui/fragments/registration/UserDetailsRegistrationFragment.kt @@ -4,6 +4,7 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup +import android.widget.RadioButton import android.widget.Toast import androidx.fragment.app.Fragment import androidx.fragment.app.viewModels @@ -14,6 +15,7 @@ import com.example.hposregistration.databinding.FragmentUserDetailsRegistrationB import com.example.hposregistration.ui.viewmodels.RegistrationViewModel import dagger.hilt.android.AndroidEntryPoint + @AndroidEntryPoint class UserDetailsRegistrationFragment : Fragment() { @@ -66,8 +68,17 @@ class UserDetailsRegistrationFragment : Fragment() { user.state.let { etState.setText(it) } user.pinCode.let { etPincode.setText(it) } user.bloodGroup.let { etBloodGroup.setText(it, false) } - cbItem1.isChecked = user.isUnderMedication ?: false - cbItem2.isChecked = user.isUnderTransfusion ?: false + user.isUnderMedication.let { + if (it != null) { + yes.isChecked = it + } + } + user.isUnderTransfusion.let { + if (it != null) { + yes1.isChecked = it + } + } + user.sickleCellHistory.let { etFamilyHistory.setText(it) } } } @@ -194,11 +205,8 @@ class UserDetailsRegistrationFragment : Fragment() { } else { userData.bloodGroup = bloodGroup } - - userData.isUnderMedication = cbItem1.isChecked - userData.isUnderTransfusion = cbItem2.isChecked - - + userData.isUnderMedication = yes.isChecked + userData.isUnderTransfusion = yes1.isChecked val familyHistory = etFamilyHistory.text.toString() if (familyHistory.isEmpty()) { etFamilyHistory.error = "Please enter your family history" diff --git a/app/src/main/res/layout/fragment_user_details_registration.xml b/app/src/main/res/layout/fragment_user_details_registration.xml index 7d74bb6..499ea60 100644 --- a/app/src/main/res/layout/fragment_user_details_registration.xml +++ b/app/src/main/res/layout/fragment_user_details_registration.xml @@ -8,7 +8,9 @@ + android:layout_height="match_parent" + tools:layout_editor_absoluteX="-16dp" + tools:layout_editor_absoluteY="158dp"> - - + + + + + + + + app:layout_constraintTop_toBottomOf="@id/radioGroup" /> + + + + + + + + app:layout_constraintTop_toBottomOf="@id/radioGroup1">