feat: refs #8020 controlVehiculos
This commit is contained in:
parent
8cecd276b0
commit
ccf56fdebf
|
@ -52,7 +52,7 @@ class ControlVehiculoUsuarioFragment(
|
||||||
|
|
||||||
if (userFk == vUserFK) {
|
if (userFk == vUserFK) {
|
||||||
val androidId: String = mobileApplication.dataStoreApp.readDataStoreKey(ANDROID_ID)
|
val androidId: String = mobileApplication.dataStoreApp.readDataStoreKey(ANDROID_ID)
|
||||||
viewModel.machineGetWorkerPlate(mobileApplication.userId!!)
|
// viewModel.machineGetWorkerPlate(mobileApplication.userId!!)
|
||||||
viewModel.deviceProductionGetnameDevice(
|
viewModel.deviceProductionGetnameDevice(
|
||||||
androidId
|
androidId
|
||||||
)
|
)
|
||||||
|
@ -64,7 +64,8 @@ class ControlVehiculoUsuarioFragment(
|
||||||
binding.userInformation.visibility = INVISIBLE
|
binding.userInformation.visibility = INVISIBLE
|
||||||
binding.nameVehiclecontrol.visibility = INVISIBLE
|
binding.nameVehiclecontrol.visibility = INVISIBLE
|
||||||
binding.userImage.setOnClickListener { binding.mainToolbar.backButton.performClick() }
|
binding.userImage.setOnClickListener { binding.mainToolbar.backButton.performClick() }
|
||||||
viewModel.machineGetWorkerPlate(mobileApplication.userId!!)
|
// viewModel.machineGetWorkerPlate(mobileApplication.userId!!)
|
||||||
|
binding.nameVehiclecontrol.visibility = VISIBLE
|
||||||
viewModel.getNameWorker(userFk)
|
viewModel.getNameWorker(userFk)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,35 +108,15 @@ class ControlVehiculoViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun machineGetWorkerPlate(userId: Int) {
|
|
||||||
salix.machineGetWorkerPlate(
|
|
||||||
arrayListOf(userId)
|
|
||||||
).enqueue(object : SalixCallback<List<JsonObject>>(context) {
|
|
||||||
override fun onSuccess(response: Response<List<JsonObject>>) {
|
|
||||||
_responseMachine.value =
|
|
||||||
ResponseItemMachineControl(
|
|
||||||
response = if (response.body()!!.isEmpty()) {
|
|
||||||
""
|
|
||||||
} else {
|
|
||||||
response.body()!![0].entrySet().first().value.toString()
|
|
||||||
.replace("\"", "")
|
|
||||||
},
|
|
||||||
type = "getWorkerPlate"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getNameWorker(
|
fun getNameWorker(
|
||||||
workerId: Int
|
workerId: Int
|
||||||
) {
|
) {
|
||||||
salix.getNameWorker(
|
salix.getNameWorker(
|
||||||
"""{"fields": ["firstName","lastName"],"where": {"id":$workerId}}"""
|
"""{"limit":1, "where":{"id":$workerId},"skip":0,"fields":["firstName","lastName"]}"""
|
||||||
).enqueue(object : SalixCallback<NameWorker>(context) {
|
).enqueue(object : SalixCallback<List<NameWorker>>(context) {
|
||||||
|
|
||||||
override fun onSuccess(response: Response<NameWorker>) {
|
override fun onSuccess(response: Response<List<NameWorker>>) {
|
||||||
_responseGetName.value = response.body()
|
_responseGetName.value = response.body()?.get(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue