Caste and category
This commit is contained in:
@@ -15,8 +15,9 @@ data class UserData(
|
||||
var phoneNumber: String = "",
|
||||
var careOf: String = "",
|
||||
var maritalStatus: String = "",
|
||||
var category: String = "",
|
||||
var caste: String = "",
|
||||
var subCaste: String = "",
|
||||
var subCaste: String? = "",
|
||||
var house: String = "",
|
||||
var city: String = "",
|
||||
var district: String = "",
|
||||
@@ -30,6 +31,7 @@ data class UserData(
|
||||
var registeredBy: String? = "",
|
||||
var createdAt: String? = "",
|
||||
var registrationCenterName: String? = "",
|
||||
var testStatus: Boolean = false
|
||||
){
|
||||
enum class Gender {
|
||||
MALE,
|
||||
|
||||
@@ -78,6 +78,10 @@ class UserListFragment : BaseFragment() {
|
||||
binding.uploadData.setOnClickListener {
|
||||
showUploadDialog(requireContext())
|
||||
}
|
||||
|
||||
viewModel.allUserData.observe(viewLifecycleOwner) { userDataList ->
|
||||
deteleIncompleteRegistration(userDataList)
|
||||
}
|
||||
}
|
||||
|
||||
private fun logoutUser(context: Context) {
|
||||
@@ -87,7 +91,7 @@ class UserListFragment : BaseFragment() {
|
||||
|
||||
// Positive button
|
||||
builder.setPositiveButton("Yes") { dialog, _ ->
|
||||
saveUserId("")
|
||||
saveUserId()
|
||||
findNavController().navigate(R.id.action_userListFragment_to_loginFragment)
|
||||
dialog.dismiss()
|
||||
}
|
||||
@@ -101,9 +105,9 @@ class UserListFragment : BaseFragment() {
|
||||
dialog.show()
|
||||
}
|
||||
|
||||
private fun saveUserId(userId: String) {
|
||||
private fun saveUserId() {
|
||||
with(sharedPreference.edit()) {
|
||||
putString(Constant.USER_ID, userId)
|
||||
putString(Constant.USER_ID, "")
|
||||
apply()
|
||||
}
|
||||
}
|
||||
@@ -188,7 +192,7 @@ class UserListFragment : BaseFragment() {
|
||||
|
||||
private fun deteleIncompleteRegistration(userDataList: List<UserData>) {
|
||||
userDataList.forEach {
|
||||
if (it._id.isEmpty()) {
|
||||
if (it.userImageURL.isEmpty()) {
|
||||
viewModel.deleteById(it._id)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,10 +122,14 @@ class ReviewDetailsRegistrationFragment : BaseFragment() {
|
||||
requireContext().getString(R.string.care_of_details, userData.careOf)
|
||||
binding.tvMaritalStatus.text =
|
||||
requireContext().getString(R.string.marital_status_details, userData.maritalStatus)
|
||||
binding.tvCategory.text =
|
||||
requireContext().getString(R.string.category_details, userData.category)
|
||||
binding.tvCaste.text =
|
||||
requireContext().getString(R.string.caste_details, userData.caste)
|
||||
binding.tvSubCaste.text =
|
||||
requireContext().getString(R.string.sub_caste_details, userData.subCaste)
|
||||
if (userData.subCaste != "") {
|
||||
binding.tvSubCaste.text =
|
||||
requireContext().getString(R.string.sub_caste_details, userData.subCaste)
|
||||
}
|
||||
binding.tvHouse.text =
|
||||
requireContext().getString(R.string.house_details, userData.house)
|
||||
binding.tvCity.text =
|
||||
|
||||
@@ -76,59 +76,24 @@ class UserDetailsRegistrationFragment : Fragment() {
|
||||
yes1.isChecked = it
|
||||
}
|
||||
}
|
||||
// user.sickleCellHistory.let{
|
||||
// if (it != null) {
|
||||
// if (binding.etFamilyHistory.isVisible) {
|
||||
// binding.etFamilyHistory.setText(it)
|
||||
// yes1history.isChecked = true
|
||||
// }else{
|
||||
// no1history.isChecked = true
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// user.isUnderMedication.let {
|
||||
// if (it != null) {
|
||||
// yes.isChecked = it
|
||||
// }
|
||||
// }
|
||||
user.sickleCellHistory.let {
|
||||
if (it != null) {
|
||||
yes1history.isChecked = true
|
||||
}
|
||||
}
|
||||
|
||||
// user.sickleCellHistory.let{
|
||||
// if (it != null) {
|
||||
// if(yes1history.isChecked){
|
||||
// yes1history.isChecked = true
|
||||
// }else if(no1history.isChecked){
|
||||
// no1history.isChecked
|
||||
// }
|
||||
//
|
||||
//
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
if (yes1history.isChecked) {
|
||||
if (binding.yes1history.isChecked) View.VISIBLE else View.GONE
|
||||
|
||||
user.sickleCellHistory.let { etFamilyHistory.setText(it) }
|
||||
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
binding.tilFamilyHistory.visibility = View.GONE
|
||||
}
|
||||
|
||||
binding.yes1history.setOnClickListener {
|
||||
binding.tilFamilyHistory.visibility =
|
||||
if (binding.yes1history.isChecked) View.VISIBLE else View.GONE
|
||||
user.sickleCellHistory.let { etFamilyHistory.setText(it) }
|
||||
|
||||
}
|
||||
//
|
||||
binding.no1history.setOnClickListener {
|
||||
binding.tilFamilyHistory.visibility =
|
||||
if (binding.no1history.isChecked) View.GONE else View.VISIBLE
|
||||
@@ -200,10 +165,18 @@ class UserDetailsRegistrationFragment : Fragment() {
|
||||
|
||||
val category = etCaste.text.toString()
|
||||
if (category.isEmpty()) {
|
||||
etCaste.error = "Please enter your category"
|
||||
return false
|
||||
} else {
|
||||
userData.category = category
|
||||
}
|
||||
|
||||
val caste = etCaste.text.toString()
|
||||
if (caste.isEmpty()) {
|
||||
etCaste.error = "Please enter your caste"
|
||||
return false
|
||||
} else {
|
||||
userData.caste = category
|
||||
userData.caste = caste
|
||||
}
|
||||
|
||||
val subCaste = etSubCaste.text.toString()
|
||||
@@ -251,13 +224,6 @@ class UserDetailsRegistrationFragment : Fragment() {
|
||||
userData.pinCode = pincode
|
||||
}
|
||||
|
||||
// val bloodGroup = etBloodGroup.text.toString()
|
||||
// if (bloodGroup.isEmpty()) {
|
||||
// etBloodGroup.error = "Please enter your blood group"
|
||||
// return false
|
||||
// } else {
|
||||
// userData.bloodGroup = bloodGroup
|
||||
// }
|
||||
userData.isUnderMedication = yes.isChecked
|
||||
userData.isUnderTransfusion = yes1.isChecked
|
||||
userData.sickleCellHistory = yes1history.isChecked.toString()
|
||||
|
||||
Reference in New Issue
Block a user