This commit is contained in:
Izlydov 2025-02-20 14:58:37 +03:00
parent ba124a4aa5
commit 44a9b5b7b1

View File

@ -32,6 +32,7 @@ class ProfileFragment : Fragment(R.layout.fragment_profile) {
super.onViewCreated(view, savedInstanceState)
_binding = FragmentProfileBinding.bind(view)
checkForAdmin()
binding.swipeRefresh.setOnRefreshListener {
if (getIsMe()) refreshData() else showData(getUserDto()!!);
}
@ -51,13 +52,11 @@ class ProfileFragment : Fragment(R.layout.fragment_profile) {
binding.recyclerViewLogs.adapter = adapter
if (getIsMe()) {
checkForAdmin()
refreshData()
viewModel.visitListState.collectWithLifecycle(this) { data -> adapter.submitData(data) }
waitForQRScanResult()
} else {
showData(getUserDto()!!)
checkForAdmin()
Log.d("ProfileFragment", "set login")
viewModel.visitListStateFromLogin.collectWithLifecycle(this) { data ->
adapter.submitData(data)
@ -75,6 +74,7 @@ class ProfileFragment : Fragment(R.layout.fragment_profile) {
if (userDTO.roles.any { it.name == "ROLE_ADMIN" }) {
binding.buttonSearch.visibility = View.VISIBLE
}
Log.d("1234", userDTO.isACSBlocked.toString())
binding.rightsUsingSmartphone.text = if (userDTO.isACSBlocked) "Пропуск недействителен" else "Пропуск действителен"
}
@ -110,6 +110,7 @@ class ProfileFragment : Fragment(R.layout.fragment_profile) {
}
Log.d("ProfileFragment", userDTO.login)
setAvatar(userDTO.photo)
checkForAdmin()
}
private fun refreshData() {
@ -169,6 +170,7 @@ class ProfileFragment : Fragment(R.layout.fragment_profile) {
if (state is ProfileViewModel.State.Show) {
val userDto: UserDTO = state.item
showMyData(userDto)
checkForAdmin()
}
}
}