Blood group and incubation time added together.
This commit is contained in:
@@ -52,7 +52,7 @@ class UserListAdapter(
|
||||
userName.text = "Name: ${model.name}"
|
||||
userId.text = "User ID:${model._id}"
|
||||
if (model.incubationTime == "") {
|
||||
btnStartIncubation.visibility = View.VISIBLE
|
||||
|
||||
} else {
|
||||
userId.text =
|
||||
"User ID:${model._id} \n Time: ${isBetween15And30Minutes(model.incubationTime)} \n Started at: ${
|
||||
@@ -62,7 +62,7 @@ class UserListAdapter(
|
||||
).parse(model.incubationTime)!!
|
||||
)
|
||||
}"
|
||||
btnStartIncubation.visibility = View.GONE
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -112,6 +112,25 @@ class UserListAdapter(
|
||||
"Blood group updated successfully",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
btnBlood.visibility = View.GONE
|
||||
Firebase.firestore.collection("patientData").whereEqualTo("_id", model._id).get()
|
||||
.addOnSuccessListener { data ->
|
||||
if (data.documents.isNotEmpty()) {
|
||||
data.documents.forEach { userData ->
|
||||
Firebase.firestore.collection("patientData").document(userData.id)
|
||||
.update(
|
||||
"incubationTime", SimpleDateFormat(
|
||||
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
||||
).format(Calendar.getInstance().time).toString()
|
||||
).addOnSuccessListener {
|
||||
Toast.makeText(
|
||||
view.context, "Incubation started", Toast.LENGTH_SHORT
|
||||
).show()
|
||||
startListening()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.addOnFailureListener { e ->
|
||||
Toast.makeText(
|
||||
@@ -149,27 +168,7 @@ class UserListAdapter(
|
||||
alertDialog.show()
|
||||
}
|
||||
|
||||
btnStartIncubation.setOnClickListener {
|
||||
it.visibility = View.GONE
|
||||
Firebase.firestore.collection("patientData").whereEqualTo("_id", model._id).get()
|
||||
.addOnSuccessListener { data ->
|
||||
if (data.documents.isNotEmpty()) {
|
||||
data.documents.forEach { userData ->
|
||||
Firebase.firestore.collection("patientData").document(userData.id)
|
||||
.update(
|
||||
"incubationTime", SimpleDateFormat(
|
||||
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
||||
).format(Calendar.getInstance().time).toString()
|
||||
).addOnSuccessListener {
|
||||
Toast.makeText(
|
||||
view.context, "Incubation started", Toast.LENGTH_SHORT
|
||||
).show()
|
||||
startListening()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
userCard.setOnClickListener {
|
||||
if (batLevel < 40) {
|
||||
Toast.makeText(
|
||||
|
||||
@@ -72,15 +72,7 @@
|
||||
app:layout_constraintTop_toBottomOf="@id/userId"
|
||||
tools:text="Test Status: Completed"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_startIncubation"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:text="@string/start_incubation"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintStart_toEndOf="@+id/btn_blood"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/btn_blood" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_blood"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -88,7 +80,6 @@
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:text="@string/blood_group"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintEnd_toStartOf="@+id/btn_startIncubation"
|
||||
app:layout_constraintTop_toBottomOf="@id/teststatus" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
Reference in New Issue
Block a user