BackLog file added for nagpur consignment for Online Registration code added, fixed all issues
This commit is contained in:
4
.idea/shelf/Changes3.xml
generated
4
.idea/shelf/Changes3.xml
generated
@@ -1,4 +0,0 @@
|
|||||||
<changelist name="Changes3" date="1701681803133" recycled="false">
|
|
||||||
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Changes3/shelved.patch" />
|
|
||||||
<option name="DESCRIPTION" value="Changes" />
|
|
||||||
</changelist>
|
|
||||||
@@ -1,12 +1,15 @@
|
|||||||
package com.example.hposregistration.ui.fragments.registration
|
package com.example.hposregistration.ui.fragments.registration
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.util.Log
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
|
import androidx.core.content.edit
|
||||||
import androidx.fragment.app.viewModels
|
import androidx.fragment.app.viewModels
|
||||||
import androidx.navigation.fragment.findNavController
|
import androidx.navigation.fragment.findNavController
|
||||||
import androidx.navigation.fragment.navArgs
|
import androidx.navigation.fragment.navArgs
|
||||||
@@ -49,7 +52,7 @@ class AbhaRegistrationFragment : BaseFragment() {
|
|||||||
): View {
|
): View {
|
||||||
_binding = FragmentAbhaRegistrationBinding.inflate(inflater, container, false)
|
_binding = FragmentAbhaRegistrationBinding.inflate(inflater, container, false)
|
||||||
sharedPreference =
|
sharedPreference =
|
||||||
requireContext().getSharedPreferences("userAbhaRegistrationLog", Context.MODE_PRIVATE)
|
requireContext().getSharedPreferences("PREFERENCE_NAME", Context.MODE_PRIVATE)
|
||||||
return binding.root
|
return binding.root
|
||||||
|
|
||||||
|
|
||||||
@@ -60,6 +63,7 @@ class AbhaRegistrationFragment : BaseFragment() {
|
|||||||
init()
|
init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("LogNotTimber", "CommitPrefEdits")
|
||||||
private fun init() {
|
private fun init() {
|
||||||
binding.btnScanNow.setOnClickListener {
|
binding.btnScanNow.setOnClickListener {
|
||||||
barcodeLauncher.launch(scanQR("Please Scan the Abha ID/Aadhar ID"))
|
barcodeLauncher.launch(scanQR("Please Scan the Abha ID/Aadhar ID"))
|
||||||
@@ -91,15 +95,23 @@ class AbhaRegistrationFragment : BaseFragment() {
|
|||||||
aadharId = aadharIdInput
|
aadharId = aadharIdInput
|
||||||
abhaId = abhaIdInput
|
abhaId = abhaIdInput
|
||||||
registrationCenterName = centerName
|
registrationCenterName = centerName
|
||||||
_id = aadharId + userName.substring(0, 3).uppercase() + centerName.substring(0, 3).uppercase()
|
_id = aadharId + userName.substring(0, 3).uppercase() + centerName.substring(0, 3)
|
||||||
userAbhaRegistrationLog = "$abhaIdInput,$userName,$aadharIdInput,$centerName"
|
.uppercase()
|
||||||
}
|
userData.userAbhaRegistrationLog = "${userData.abhaId}," + "${userData.name}," +"${userData.aadharId}," + "${userData.registrationCenterName}"
|
||||||
|
Log.e(
|
||||||
|
"userAbhaRegistrationLog",
|
||||||
|
"Assigned userAbhaRegistrationLog: ${userData.userAbhaRegistrationLog}"
|
||||||
|
)
|
||||||
|
|
||||||
|
sharedPreference.edit()
|
||||||
|
.putString("userAbhaRegistrationLog", userData.userAbhaRegistrationLog)
|
||||||
|
.apply()
|
||||||
|
|
||||||
|
Log.e("userAbhaRegistrationLog", sharedPreference.getString("userAbhaRegistrationLog","").toString())
|
||||||
|
}
|
||||||
|
viewModel.insert(userData)
|
||||||
|
// Make sure this provides a meaningful string representation of userData
|
||||||
|
|
||||||
viewModel.insert(userData)
|
|
||||||
val userDataString = userData.userAbhaRegistrationLog// Make sure this provides a meaningful string representation of userData
|
|
||||||
sharedPreference.edit()
|
|
||||||
.putString("userAbhaRegistrationLog", userDataString)
|
|
||||||
.apply()
|
|
||||||
navigateToUserDetailsFragment(userData._id)
|
navigateToUserDetailsFragment(userData._id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -119,6 +131,7 @@ class AbhaRegistrationFragment : BaseFragment() {
|
|||||||
state = obj.getString("state name")
|
state = obj.getString("state name")
|
||||||
district = obj.getString("district_name")
|
district = obj.getString("district_name")
|
||||||
house = obj.getString("address")
|
house = obj.getString("address")
|
||||||
|
userAbhaRegistrationLog = obj.getString("userAbhaRegistrationLog")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userData.abhaId.isNotEmpty()) {
|
if (userData.abhaId.isNotEmpty()) {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import android.content.Context
|
|||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.util.Log
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
@@ -54,9 +55,8 @@ class ReviewDetailsRegistrationFragment : BaseFragment() {
|
|||||||
viewModel.getUserByID(args.userId)
|
viewModel.getUserByID(args.userId)
|
||||||
viewModel.userData.observe(viewLifecycleOwner) { user ->
|
viewModel.userData.observe(viewLifecycleOwner) { user ->
|
||||||
userData = user
|
userData = user
|
||||||
userData.userAbhaRegistrationLog =
|
userData.userAbhaRegistrationLog = sharedPreference.getString("userAbhaRegistrationLog", "").toString()
|
||||||
sharedPreference.getString("userAbhaRegistrationLog", "").toString()
|
userData.userDetailsLog = sharedPreference.getString("userDetailslog", "").toString()
|
||||||
userData.userDetailsLog = sharedPreference.getString("userDetailsLOg", "").toString()
|
|
||||||
setUserData(user)
|
setUserData(user)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,11 +181,11 @@ class ReviewDetailsRegistrationFragment : BaseFragment() {
|
|||||||
)
|
)
|
||||||
val version = pInfo.versionName
|
val version = pInfo.versionName
|
||||||
userData.appVersion = version
|
userData.appVersion = version
|
||||||
|
userData.userAbhaRegistrationLog = "${userData.abhaId}," + "${userData.name}," +"${userData.aadharId}," + "${userData.registrationCenterName}"
|
||||||
val useAbhaRegistrationLog = sharedPreference.getString("userAbhaRegistrationLog", "").toString()
|
userData.userAbhaRegistrationLog = sharedPreference.getString("userAbhaRegistrationLog", "").toString()
|
||||||
val userDetailsLog = sharedPreference.getString("userDetailsLOg", "").toString()
|
userData.userDetailsLog = sharedPreference.getString("userDetailslog", "").toString()
|
||||||
userData.userAbhaRegistrationLog= useAbhaRegistrationLog
|
Log.e("userAbhaRegistrationLog",userData.userAbhaRegistrationLog)
|
||||||
userData.userDetailsLog = userDetailsLog
|
Log.e("userAbhaRegistrationLog",userData.userDetailsLog)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
package com.example.hposregistration.ui.fragments.registration
|
package com.example.hposregistration.ui.fragments.registration
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.util.Log
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
@@ -35,7 +37,7 @@ class UserDetailsRegistrationFragment : Fragment() {
|
|||||||
): View {
|
): View {
|
||||||
_binding = FragmentUserDetailsRegistrationBinding.inflate(inflater, container, false)
|
_binding = FragmentUserDetailsRegistrationBinding.inflate(inflater, container, false)
|
||||||
sharedPreference =
|
sharedPreference =
|
||||||
requireContext().getSharedPreferences("userDetailsLOg", Context.MODE_PRIVATE)
|
requireContext().getSharedPreferences("PREFERENCE_NAME", Context.MODE_PRIVATE)
|
||||||
|
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
@@ -117,44 +119,43 @@ class UserDetailsRegistrationFragment : Fragment() {
|
|||||||
binding.tilFamilyHistory.visibility =
|
binding.tilFamilyHistory.visibility =
|
||||||
if (binding.no1history.isChecked) View.GONE else View.VISIBLE
|
if (binding.no1history.isChecked) View.GONE else View.VISIBLE
|
||||||
}
|
}
|
||||||
|
|
||||||
userData.userDetailsLog = "${userData.birthYear}," +
|
|
||||||
"${userData.gender}," +
|
|
||||||
"${userData.phoneNumber}," +
|
|
||||||
"${userData.careOf}," +
|
|
||||||
"${userData.maritalStatus}," +
|
|
||||||
"${userData.category}," +
|
|
||||||
"${userData.caste}," +
|
|
||||||
"${userData.subCaste ?: ""}," + // Using Elvis operator for nullable fields
|
|
||||||
"${userData.appVersion}," +
|
|
||||||
"${userData.house}," +
|
|
||||||
"${userData.city}," +
|
|
||||||
"${userData.district}," +
|
|
||||||
"${userData.state}," +
|
|
||||||
"${userData.pinCode}," +
|
|
||||||
"${userData.bloodGroup}," +
|
|
||||||
"${userData.isUnderMedication ?: false}," + // Converting null to false
|
|
||||||
"${userData.isUnderTransfusion ?: false}," +
|
|
||||||
"${userData.sickleCellHistory ?: ""}," +
|
|
||||||
"${userData.userImageURL}," +
|
|
||||||
"${userData.registeredBy ?: ""}," +
|
|
||||||
"${userData.createdAt ?: ""}," +
|
|
||||||
"${userData.registrationCenterName ?: ""}," +
|
|
||||||
"${userData.testStatus},"
|
|
||||||
|
|
||||||
|
|
||||||
val userDataString = userData.userDetailsLog// Make sure this provides a meaningful string representation of userData
|
|
||||||
sharedPreference.edit()
|
|
||||||
.putString("userDetailsLOg", userDataString)
|
|
||||||
.apply()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("LogNotTimber")
|
||||||
private fun setupSubmitButton() {
|
private fun setupSubmitButton() {
|
||||||
binding.btnSubmit.setOnClickListener {
|
binding.btnSubmit.setOnClickListener {
|
||||||
if (verifyUserDetails()) {
|
if (verifyUserDetails()) {
|
||||||
userData._id = args.userId
|
userData._id = args.userId
|
||||||
viewModel.insert(userData)
|
viewModel.insert(userData)
|
||||||
|
userData.userDetailsLog = "${userData.birthYear}," +
|
||||||
|
"${userData.gender}," +
|
||||||
|
"${userData.phoneNumber}," +
|
||||||
|
"${userData.careOf}," +
|
||||||
|
"${userData.maritalStatus}," +
|
||||||
|
"${userData.category}," +
|
||||||
|
"${userData.caste}," +
|
||||||
|
"${userData.subCaste ?: ""}," + // Using Elvis operator for nullable fields
|
||||||
|
"${userData.appVersion}," +
|
||||||
|
"${userData.house}," +
|
||||||
|
"${userData.city}," +
|
||||||
|
"${userData.district}," +
|
||||||
|
"${userData.state}," +
|
||||||
|
"${userData.pinCode}," +
|
||||||
|
"${userData.bloodGroup}," +
|
||||||
|
"${userData.isUnderMedication ?: false}," + // Converting null to false
|
||||||
|
"${userData.isUnderTransfusion ?: false}," +
|
||||||
|
"${userData.sickleCellHistory ?: ""}," +
|
||||||
|
"${userData.userImageURL}," +
|
||||||
|
"${userData.registeredBy ?: ""}," +
|
||||||
|
"${userData.createdAt ?: ""}," +
|
||||||
|
"${userData.registrationCenterName ?: ""}," +
|
||||||
|
"${userData.testStatus},"
|
||||||
|
val userDataString = userData.userDetailsLog// Make sure this provides a meaningful string representation of userData
|
||||||
|
sharedPreference.edit()
|
||||||
|
.putString("userDetailslog", userData.userDetailsLog)
|
||||||
|
.apply()
|
||||||
|
Log.e("userAbhaRegistrationLog",userData.userDetailsLog)
|
||||||
navigateToCaptureUserImageFragment()
|
navigateToCaptureUserImageFragment()
|
||||||
} else {
|
} else {
|
||||||
showToast("Please enter all the details properly")
|
showToast("Please enter all the details properly")
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package com.example.hposregistration.ui.viewmodels
|
package com.example.hposregistration.ui.viewmodels
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.content.SharedPreferences
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
|
import androidx.core.content.ContentProviderCompat.requireContext
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
@@ -30,8 +32,11 @@ class RegistrationViewModel @Inject constructor(
|
|||||||
val allUserData = mainRepository.allUsers
|
val allUserData = mainRepository.allUsers
|
||||||
|
|
||||||
val fireBaseUpload = MutableLiveData<String>()
|
val fireBaseUpload = MutableLiveData<String>()
|
||||||
|
private val sharedPreference =
|
||||||
|
context.getSharedPreferences("PREFERENCE_NAME", Context.MODE_PRIVATE)
|
||||||
fun addUserToDatabase(userData: UserData) = viewModelScope.launch {
|
fun addUserToDatabase(userData: UserData) = viewModelScope.launch {
|
||||||
|
userData.userAbhaRegistrationLog = sharedPreference.getString("userAbhaRegistrationLog", "").toString()
|
||||||
|
userData.userDetailsLog = sharedPreference.getString("userDetailslog", "").toString()
|
||||||
val file = Uri.parse(userData.userImageURL)
|
val file = Uri.parse(userData.userImageURL)
|
||||||
val storageRef = FirebaseStorage.getInstance().reference
|
val storageRef = FirebaseStorage.getInstance().reference
|
||||||
val imageRef = storageRef.child("${userData._id}/${file.lastPathSegment}")
|
val imageRef = storageRef.child("${userData._id}/${file.lastPathSegment}")
|
||||||
@@ -66,6 +71,8 @@ class RegistrationViewModel @Inject constructor(
|
|||||||
val networkStatusLiveData: LiveData<Boolean>
|
val networkStatusLiveData: LiveData<Boolean>
|
||||||
get() = _networkStatusLiveData
|
get() = _networkStatusLiveData
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fun insert(userData: UserData) = viewModelScope.launch {
|
fun insert(userData: UserData) = viewModelScope.launch {
|
||||||
val currentDate = Date()
|
val currentDate = Date()
|
||||||
val dateFormat = SimpleDateFormat("yyyyMMdd")
|
val dateFormat = SimpleDateFormat("yyyyMMdd")
|
||||||
@@ -76,6 +83,16 @@ class RegistrationViewModel @Inject constructor(
|
|||||||
userData.createdAt = SimpleDateFormat(
|
userData.createdAt = SimpleDateFormat(
|
||||||
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
||||||
).format(Calendar.getInstance().time)
|
).format(Calendar.getInstance().time)
|
||||||
|
|
||||||
|
|
||||||
|
val useAbhaRegistrationLog = sharedPreference.getString("userAbhaRegistrationLog", "").toString()
|
||||||
|
val userDetailsLog = sharedPreference.getString("userDetailslog", "").toString()
|
||||||
|
userData.userAbhaRegistrationLog = sharedPreference.getString("userAbhaRegistrationLog", "").toString()
|
||||||
|
userData.userDetailsLog = sharedPreference.getString("userDetailslog", "").toString()
|
||||||
|
|
||||||
|
|
||||||
|
userData.userAbhaRegistrationLog= useAbhaRegistrationLog
|
||||||
|
userData.userDetailsLog = userDetailsLog
|
||||||
mainRepository.insert(userData)
|
mainRepository.insert(userData)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user