Blood group and incubation time added together.
This commit is contained in:
@@ -52,7 +52,7 @@ class UserListAdapter(
|
|||||||
userName.text = "Name: ${model.name}"
|
userName.text = "Name: ${model.name}"
|
||||||
userId.text = "User ID:${model._id}"
|
userId.text = "User ID:${model._id}"
|
||||||
if (model.incubationTime == "") {
|
if (model.incubationTime == "") {
|
||||||
btnStartIncubation.visibility = View.VISIBLE
|
|
||||||
} else {
|
} else {
|
||||||
userId.text =
|
userId.text =
|
||||||
"User ID:${model._id} \n Time: ${isBetween15And30Minutes(model.incubationTime)} \n Started at: ${
|
"User ID:${model._id} \n Time: ${isBetween15And30Minutes(model.incubationTime)} \n Started at: ${
|
||||||
@@ -62,7 +62,7 @@ class UserListAdapter(
|
|||||||
).parse(model.incubationTime)!!
|
).parse(model.incubationTime)!!
|
||||||
)
|
)
|
||||||
}"
|
}"
|
||||||
btnStartIncubation.visibility = View.GONE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -112,6 +112,25 @@ class UserListAdapter(
|
|||||||
"Blood group updated successfully",
|
"Blood group updated successfully",
|
||||||
Toast.LENGTH_SHORT
|
Toast.LENGTH_SHORT
|
||||||
).show()
|
).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 ->
|
.addOnFailureListener { e ->
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
@@ -149,27 +168,7 @@ class UserListAdapter(
|
|||||||
alertDialog.show()
|
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 {
|
userCard.setOnClickListener {
|
||||||
if (batLevel < 40) {
|
if (batLevel < 40) {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
|
|||||||
@@ -72,15 +72,7 @@
|
|||||||
app:layout_constraintTop_toBottomOf="@id/userId"
|
app:layout_constraintTop_toBottomOf="@id/userId"
|
||||||
tools:text="Test Status: Completed"/>
|
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
|
<Button
|
||||||
android:id="@+id/btn_blood"
|
android:id="@+id/btn_blood"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@@ -88,7 +80,6 @@
|
|||||||
android:layout_marginHorizontal="16dp"
|
android:layout_marginHorizontal="16dp"
|
||||||
android:text="@string/blood_group"
|
android:text="@string/blood_group"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/btn_startIncubation"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/teststatus" />
|
app:layout_constraintTop_toBottomOf="@id/teststatus" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|||||||
Reference in New Issue
Block a user