20/06/2023 -test session bug resolve
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 != "") {
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
tools:layout_editor_absoluteX="-16dp"
|
||||
tools:layout_editor_absoluteY="158dp">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
@@ -314,7 +316,7 @@
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.checkbox.MaterialCheckBox
|
||||
<TextView
|
||||
android:id="@+id/cb_item1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -324,14 +326,66 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/til_blood_group" />
|
||||
|
||||
<com.google.android.material.checkbox.MaterialCheckBox
|
||||
<RadioGroup
|
||||
android:id="@+id/radioGroup"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/cb_item1">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/yes"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="Yes"
|
||||
android:textSize="16dp" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/no"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="true"
|
||||
android:text="No"
|
||||
android:textSize="16dp" />
|
||||
</RadioGroup>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cb_item2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:text="@string/is_patient_undergoing_any_blood_transfusion"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cb_item1" />
|
||||
app:layout_constraintTop_toBottomOf="@id/radioGroup" />
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/radioGroup1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cb_item2">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/yes1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="Yes"
|
||||
android:textSize="16dp" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/no1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="true"
|
||||
android:text="No"
|
||||
android:textSize="16dp" />
|
||||
</RadioGroup>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/til_familyHistory"
|
||||
@@ -342,7 +396,7 @@
|
||||
android:layout_marginTop="16dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cb_item2">
|
||||
app:layout_constraintTop_toBottomOf="@id/radioGroup1">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/et_familyHistory"
|
||||
|
||||
Reference in New Issue
Block a user