BloodGroup changes
This commit is contained in:
@@ -12,6 +12,7 @@ import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import com.example.hpostesting.data.DataHolder
|
||||
import com.example.hpostesting.data.constant.Constants
|
||||
import com.example.hpostesting.data.dao.UserDao
|
||||
import com.example.hpostesting.data.model.test.TestRightResultType
|
||||
import com.example.hpostesting.data.model.test.TestType
|
||||
import com.example.hpostesting.presentation.dashboard.DashboardActivity
|
||||
@@ -34,7 +35,7 @@ class TestRightResults : Fragment() {
|
||||
private lateinit var binding: FragmentTestRightResultsBinding
|
||||
private val viewModel: TestRightViewModel by activityViewModels()
|
||||
private lateinit var sharedPreference: SharedPreferences
|
||||
|
||||
private var bloodGroup: String = ""
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||
): View {
|
||||
@@ -49,7 +50,19 @@ class TestRightResults : Fragment() {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
setupListeners()
|
||||
updateResults()
|
||||
binding.ivHome.setOnClickListener {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
|
||||
if (binding.etBloodGroup.equals("") || binding.etBloodGroup.equals("Select Blood Group")) {
|
||||
binding.etBloodGroup.error = "Please enter your blood group"
|
||||
Toast.makeText(context, "Please enter your blood group", Toast.LENGTH_SHORT).show()
|
||||
}else{
|
||||
bloodGroup = binding.etBloodGroup.text.toString()
|
||||
checkBloodGroup()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
viewModel.fireBaseUpload.observe(viewLifecycleOwner) {
|
||||
if (it == "Success") {
|
||||
Toast.makeText(
|
||||
@@ -62,11 +75,7 @@ class TestRightResults : Fragment() {
|
||||
}
|
||||
|
||||
private fun setupListeners() {
|
||||
binding.ivHome.setOnClickListener {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
checkBloodGroup()
|
||||
}
|
||||
}
|
||||
|
||||
binding.ivNext.setOnClickListener {
|
||||
val i = Intent(requireContext().applicationContext, DashboardActivity::class.java)
|
||||
startActivity(i)
|
||||
@@ -76,10 +85,7 @@ class TestRightResults : Fragment() {
|
||||
|
||||
private suspend fun checkBloodGroup() {
|
||||
binding.apply {
|
||||
val bloodGroup = etBloodGroup.text.toString()
|
||||
if (bloodGroup.isEmpty()) {
|
||||
etBloodGroup.error = "Please enter your blood group"
|
||||
} else {
|
||||
bloodGroup = etBloodGroup.text.toString()
|
||||
val db: FirebaseFirestore = Firebase.firestore
|
||||
val userdata =
|
||||
db.collection("patientData").whereEqualTo("_id", viewModel.testDetails?._id)
|
||||
@@ -95,7 +101,8 @@ class TestRightResults : Fragment() {
|
||||
startActivity(i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user