refs #5613 userId
This commit is contained in:
parent
7d318e0e07
commit
fd862edbef
|
@ -9,6 +9,7 @@ import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
|
|||
import es.verdnatura.presentation.view.feature.collection.SalixSaleQuantity
|
||||
import es.verdnatura.presentation.view.feature.collection.listSaleSalix
|
||||
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLogSalix
|
||||
import es.verdnatura.presentation.view.feature.login.model.DataUserSalix
|
||||
import es.verdnatura.presentation.view.feature.login.model.LoginSalixVO
|
||||
import es.verdnatura.presentation.view.feature.login.model.OperatorSalix
|
||||
import es.verdnatura.presentation.view.feature.login.model.RenewToken
|
||||
|
@ -31,6 +32,11 @@ interface SalixService {
|
|||
):
|
||||
Call<LoginSalixVO>
|
||||
|
||||
@GET("VnUsers/getCurrentUserData")
|
||||
fun getCurrentUserData(
|
||||
):
|
||||
Call<DataUserSalix>
|
||||
|
||||
/* @POST("chats/sendCheckingPresence")
|
||||
fun sendChekingPresence(
|
||||
@Body params: SalixMessageVO
|
||||
|
|
|
@ -142,7 +142,7 @@ class AjustesFragment :
|
|||
ma.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(
|
||||
title = getString(R.string.titleUserControlVehicle)
|
||||
), getDataInt(USERFK).toString()
|
||||
), mobileApplication.userId.toString()
|
||||
)
|
||||
|
||||
} else if (item.id == 6) {
|
||||
|
@ -416,7 +416,7 @@ class AjustesFragment :
|
|||
editor.apply()
|
||||
|
||||
viewModel.ajustesitem.get(2).selected = it.name
|
||||
viewModel.worker_updateOperatorSalix("printer",getDataInt(USERFK),getDataInt(SECTORFK),it.id!!)
|
||||
viewModel.worker_updateOperatorSalix("printer",mobileApplication.userId!!,getDataInt(SECTORFK),it.id!!)
|
||||
ajustesAdapter!!.notifyDataSetChanged()
|
||||
ajustesAdapter
|
||||
|
||||
|
@ -484,7 +484,7 @@ class AjustesFragment :
|
|||
viewModel.ajustesitem.get(0).warehouse = it.warehouseFk
|
||||
viewModel.ajustesitem.get(0).selected = it.description
|
||||
|
||||
viewModel.worker_updateOperatorSalix("sector",getDataInt(USERFK),it.id,null)
|
||||
viewModel.worker_updateOperatorSalix("sector",mobileApplication.userId!!,it.id,null)
|
||||
|
||||
ajustesAdapter!!.notifyDataSetChanged()
|
||||
|
||||
|
|
|
@ -83,7 +83,8 @@ class ControlVehiculoUsuarioFragment(
|
|||
}
|
||||
|
||||
private fun setControlVehicleUser() {
|
||||
userFk = getDataInt(USERFK)
|
||||
|
||||
userFk = mobileApplication.userId!!
|
||||
|
||||
if (userFk == vUserFK.toInt()) {
|
||||
binding.splashProgress.visibility = VISIBLE
|
||||
|
|
|
@ -19,8 +19,8 @@ class InfoFragment(var title: String) :
|
|||
binding.mainToolbar.toolbarTitle.text = title
|
||||
ma.hideBottomNavigation(View.GONE)
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
viewModel.getInfoCompany(getDataInt(USERFK))
|
||||
viewModel.getInfoFreelance(getDataInt(USERFK))
|
||||
viewModel.getInfoCompany(mobileApplication.userId!!)
|
||||
viewModel.getInfoFreelance(mobileApplication.userId!!)
|
||||
setEvents()
|
||||
}
|
||||
|
||||
|
|
|
@ -323,7 +323,7 @@ class LoginFragment(var imageUri: Uri?) :
|
|||
|
||||
} else {
|
||||
//sergio: se añade el log
|
||||
viewModel.worker_getId()
|
||||
viewModel.getCurrentUserData()
|
||||
viewModel.worker_getSector()
|
||||
viewModel.worker_getPrinter()
|
||||
//viewModel.operator_getDataSalix("{\"where\": {\"workerFk\":${getDataInt(USERFK)}}}")
|
||||
|
@ -585,7 +585,7 @@ class LoginFragment(var imageUri: Uri?) :
|
|||
}
|
||||
|
||||
private fun goToMain() {
|
||||
setupFirebase((requireActivity().application as MobileApplication).userId.toString())
|
||||
setupFirebase((requireActivity().application as MobileApplication).userName.toString())
|
||||
val intent = Intent(activity, MainActivity::class.java)
|
||||
intent.data = imageUri
|
||||
startActivity(intent)
|
||||
|
|
|
@ -17,6 +17,7 @@ import es.verdnatura.presentation.common.ResponseItemVO
|
|||
import es.verdnatura.presentation.view.feature.ajustes.model.Printers
|
||||
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
||||
import es.verdnatura.presentation.view.feature.ajustes.model.WorkerPrintersList
|
||||
import es.verdnatura.presentation.view.feature.login.model.DataUserSalix
|
||||
import es.verdnatura.presentation.view.feature.login.model.LoginDevice
|
||||
import es.verdnatura.presentation.view.feature.login.model.LoginSalixVO
|
||||
import es.verdnatura.presentation.view.feature.login.model.OperatorList
|
||||
|
@ -189,6 +190,16 @@ class LoginViewModel(val context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun getCurrentUserData() {
|
||||
salix.getCurrentUserData().enqueue(object : SilexCallback<DataUserSalix>(context) {
|
||||
override fun onSuccess(response: Response<DataUserSalix>) {
|
||||
app.userName = response.body()?.let { it.nickname }
|
||||
app.userId = response.body()?.let { it.id }
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun deviceLog_add(
|
||||
app: String, versionApp: String, android_id: String
|
||||
) {
|
||||
|
|
|
@ -9,8 +9,17 @@ class LoginSalixVO(
|
|||
var isError: Boolean = false,
|
||||
var errorMessage: String = ""
|
||||
)
|
||||
|
||||
class DataUserSalix(
|
||||
val id: Int? = null,
|
||||
val name: String = "",
|
||||
val nickname: String = "",
|
||||
var isError: Boolean = false,
|
||||
var errorMessage: String = ""
|
||||
)
|
||||
|
||||
class RenewToken(
|
||||
val id:String,
|
||||
val id: String,
|
||||
val ttl: Long = 0,
|
||||
var isError: Boolean = false,
|
||||
var errorMessage: String = ""
|
||||
|
|
|
@ -46,7 +46,7 @@ class TicketAdvanceFragment(var title: String) :
|
|||
|
||||
viewModel.ticket_advancePackaging(
|
||||
binding.scanInput.text.toString().toInt(),
|
||||
getDataInt(USERFK)
|
||||
mobileApplication.userId!!
|
||||
)
|
||||
} catch (ex: Exception) {
|
||||
getString(R.string.ticketFormatError)
|
||||
|
|
Loading…
Reference in New Issue