diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml new file mode 100644 index 0000000..0c0c338 --- /dev/null +++ b/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 43b22c9..a777238 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -4,8 +4,6 @@ diff --git a/.idea/migrations.xml b/.idea/migrations.xml new file mode 100644 index 0000000..f8051a6 --- /dev/null +++ b/.idea/migrations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/example/hposregistration/ui/fragments/UserListFragment.kt b/app/src/main/java/com/example/hposregistration/ui/fragments/UserListFragment.kt index 5b303e2..7e34f64 100644 --- a/app/src/main/java/com/example/hposregistration/ui/fragments/UserListFragment.kt +++ b/app/src/main/java/com/example/hposregistration/ui/fragments/UserListFragment.kt @@ -18,11 +18,14 @@ import com.example.hposregistration.data.Constant import com.example.hposregistration.data.user.UserData import com.example.hposregistration.ui.viewmodels.RegistrationViewModel import com.firebase.ui.firestore.FirestoreRecyclerOptions +import com.google.firebase.firestore.Query import com.google.firebase.firestore.ktx.firestore import com.google.firebase.ktx.Firebase import dagger.hilt.android.AndroidEntryPoint import `in`.sminnovations.hposregistration.R import `in`.sminnovations.hposregistration.databinding.FragmentUserListBinding +import java.text.SimpleDateFormat +import java.util.Date @AndroidEntryPoint class UserListFragment : BaseFragment() { @@ -164,7 +167,17 @@ class UserListFragment : BaseFragment() { private fun fetchFromServer() { binding.noList.visibility = View.GONE binding.rvOrder.visibility = View.VISIBLE + val dateFormat = SimpleDateFormat("yyyy-MM-dd") + val currentDate = Date() + val today = dateFormat.format(currentDate) val query = Firebase.firestore.collection("patientData") + .whereGreaterThanOrEqualTo("createdAt", today) + .orderBy("createdAt", Query.Direction.DESCENDING) + query.get().addOnSuccessListener { + if (it.documents.isEmpty() && isOnline) { + binding.emptyRegistrations.visibility = View.VISIBLE + } + } val recyclerViewOptions = FirestoreRecyclerOptions.Builder().setQuery(query, UserData::class.java) .build() diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a600066..190e61b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -110,6 +110,7 @@ Please enter a valid 10-digit mobile number Please enter your name Please enter your marital status + No registrations are available for display Please enter your category Please enter your caste Please enter your house address