Añadida funcionalidad de recuperar/guardar sector. Refactor Login. Cambiado icono que cerraba app en móviles viejos. Se añade campo prioridad. Pantalla de allo trabajador.
This commit is contained in:
parent
87aea478c3
commit
897061f92b
|
@ -1,17 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetDropDown">
|
||||
<targetSelectedWithDropDown>
|
||||
<Target>
|
||||
<type value="QUICK_BOOT_TARGET" />
|
||||
<deviceKey>
|
||||
<Key>
|
||||
<type value="VIRTUAL_DEVICE_PATH" />
|
||||
<value value="C:\Users\sergiodt\.android\avd\Pixel_3a_API_30_x86.avd" />
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</targetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2022-02-03T05:45:46.227830600Z" />
|
||||
</component>
|
||||
</project>
|
|
@ -4,6 +4,7 @@
|
|||
<option name="filePathToZoomLevelMap">
|
||||
<map>
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable-v24/background_gradient.xml" value="0.1" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable-v24/ic_history_orang.xml" value="0.22037037037037038" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable-v24/ic_history_orange_24dp.xml" value="0.38229166666666664" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.13541666666666666" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable-v24/selector_bottombar_text.xml" value="0.13541666666666666" />
|
||||
|
@ -48,6 +49,7 @@
|
|||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_device_hub_black_24dp_selected.xml" value="0.22" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_flash_auto_black_24dp.xml" value="0.15052083333333333" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_history_black_24dp.xml" value="0.15052083333333333" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_history_orange.xml" value="0.22037037037037038" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_launcher_background.xml" value="0.24010416666666667" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_local_florist_black_24dp.xml" value="0.15052083333333333" />
|
||||
<entry key="..\:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable/ic_local_florist_black_24dp_selected.xml" value="0.21041666666666667" />
|
||||
|
|
|
@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
|
|||
//apply plugin: 'kotlin-android-extensions'//deprecated:sergio
|
||||
apply plugin: 'kotlin-kapt'
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
apply plugin: 'com.google.firebase.crashlytics'
|
||||
//apply plugin: 'com.google.firebase.crashlytics'
|
||||
|
||||
|
||||
android {
|
||||
|
@ -14,8 +14,10 @@ android {
|
|||
applicationId "es.verdnatura"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 29
|
||||
versionCode 101
|
||||
versionName "7.6.1" //VERSION CODE 101. Pide las baldas, se había quitado sin querer y se quita menú Voz
|
||||
versionCode 102
|
||||
versionName "7.7" //VERSION CODE 102.Incorpora pantalla Fallo trabajador, ara es guarda i recupera el sector en bbdd, es lleva demanar permisos de sonido,
|
||||
// i es soluciona l'error en Pasillero que tancava la app en antics mòvils.S'afegeix camp prioritat al buscar item. No demana posar vehicle un altra vegada al fer botó enrere.
|
||||
//versionName "7.6.1" //VERSION CODE 101. Pide las baldas, se había quitado sin querer y se quita menú Voz
|
||||
//versionName "7.6" //VERSION CODE 100. Envios rocket a previa, revisados databinding layouts,
|
||||
//versionName "7.5.1" //VERSION CODE 97. Control de previa, Llamadas ok, menú ok y textos en iconos y imágenes.
|
||||
//versionName "7.5.1" VERSION CODE 99 PARA TESTEAR APP-->INSTALADA EN VARIOS USUARIO 24-01-2022
|
||||
|
@ -111,7 +113,7 @@ dependencies {
|
|||
|
||||
// Add the Firebase Crashlytics SDK.
|
||||
implementation 'com.google.firebase:firebase-analytics:17.5.0'
|
||||
implementation 'com.google.firebase:firebase-crashlytics:17.2.1'
|
||||
//implementation 'com.google.firebase:firebase-crashlytics:17.2.1'
|
||||
|
||||
//search
|
||||
implementation 'com.github.mirrajabi:search-dialog:1.1'
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 101,
|
||||
"versionName": "7.6.1",
|
||||
"versionCode": 102,
|
||||
"versionName": "7.7",
|
||||
"outputFile": "app-release.apk"
|
||||
}
|
||||
],
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -13,4 +13,13 @@ class GetAjustesUserCase(context: Context) : RestClient(context) {
|
|||
fun getSectorsSalix(token:String): Call<List<SectorItemVO>> {
|
||||
return salixClient!!.getSectorsSalix(content_type = "application/json", authorization = token)
|
||||
}
|
||||
fun worker_updateSector(usuario: String, password: String,sectorFk:String): Call<Unit> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(sectorFk)
|
||||
|
||||
return restClient!!.worker_updateSector("json", "1", usuario, password, "application/json",params)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,21 +1,13 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import android.content.Context
|
||||
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
||||
import es.verdnatura.presentation.view.feature.login.model.*
|
||||
import retrofit2.Call
|
||||
|
||||
class GetLoginUserCase(context: Context) : RestClient(context)
|
||||
{
|
||||
|
||||
fun login(usuario: String, password: String, androiid: String): Call<String>
|
||||
{
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(usuario)
|
||||
params.add(password)
|
||||
params.add(androiid)
|
||||
return restClient!!.login("json", "1", usuario, password, "application/json", params)
|
||||
}
|
||||
|
||||
fun device_checkLogin(
|
||||
usuario: String,
|
||||
password: String,
|
||||
|
@ -81,16 +73,30 @@ class GetLoginUserCase(context: Context) : RestClient(context)
|
|||
|
||||
}
|
||||
|
||||
|
||||
//SALIX SERGIO MENSAJE : PARA NO ENVIAR MENSAJES A COMERCIALES PONGO QUE LAS MODIFICACIONES SE ENVIAN AL CANAL CREADO.
|
||||
// SALIX SERGIO MENSAJE : PARA NO ENVIAR MENSAJES A COMERCIALES PONGO QUE LAS MODIFICACIONES SE ENVIAN AL CANAL CREADO.
|
||||
// SE CAMBIA VARIABLE A TRUE/FALSE
|
||||
|
||||
|
||||
fun sendChekingPresence(token:String,workerId:Int,message:String) : Call<Boolean>{
|
||||
return salixClient!!.sendChekingPresence(content_type = "application/json", authorization = token, params = SalixMessageVO(workerId = workerId,message = message))
|
||||
}
|
||||
|
||||
var working_in_test=false
|
||||
|
||||
if (!working_in_test) {
|
||||
|
||||
return salixClient!!.sendChekingPresence(
|
||||
content_type = "application/json",
|
||||
authorization = token,
|
||||
params = SalixMessageVO(workerId = workerId, message = message)
|
||||
)
|
||||
}else{
|
||||
|
||||
return salixClient!!.sendGroup(
|
||||
content_type = "application/json",
|
||||
authorization = token,
|
||||
params = SalixGrupo(to = "#android-test", message = message))
|
||||
}
|
||||
}
|
||||
|
||||
// SERGIO: PARA DESARROLLO SE DESCOMENTA ESTAS LÍNEAS Y SE COMENTAN LAS DE ARRIBA
|
||||
|
||||
/*fun sendChekingPresence(token: String, workerId: Int, message: String): Call<Boolean>
|
||||
{
|
||||
|
@ -107,5 +113,9 @@ val params: ArrayList<String> = ArrayList()
|
|||
params.add(nameApp)
|
||||
return restClient!!.getVersion("json", "1", usuario, password, "application/json", params)
|
||||
}
|
||||
fun worker_getSector(usuario: String, password: String): Call<SectorItemVO> {
|
||||
//val params: ArrayList<String> = ArrayList()
|
||||
|
||||
return restClient!!.worker_getSector("json", "1", usuario, password, "application/json")
|
||||
}
|
||||
}
|
|
@ -114,6 +114,27 @@ interface VerdnaturaService {
|
|||
):
|
||||
Call<List<SectorItemVO>>
|
||||
|
||||
@POST("almacennew/worker_updateSector")//REVISADA
|
||||
fun worker_updateSector(
|
||||
@Header("aplicacion") aplicacion: String,
|
||||
@Header("version") version: String,
|
||||
@Header("user") user: String,
|
||||
@Header("pass") pass: String,
|
||||
@Header("Content-Type") content_type: String,
|
||||
@Body params:List<String>
|
||||
):
|
||||
Call<Unit>
|
||||
|
||||
@POST("almacennew/worker_getSector")//REVISADA
|
||||
fun worker_getSector(
|
||||
@Header("aplicacion") aplicacion: String,
|
||||
@Header("version") version: String,
|
||||
@Header("user") user: String,
|
||||
@Header("pass") pass: String,
|
||||
@Header("Content-Type") content_type: String
|
||||
):
|
||||
Call<SectorItemVO>
|
||||
|
||||
//PRESACADORES ========================================================================>
|
||||
|
||||
@POST("almacennew/ticketToPrePrepare")//REVISADA
|
||||
|
|
|
@ -129,8 +129,10 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
|
|||
observeViewModel()
|
||||
runSound()
|
||||
//requestRecordAudioPermission()
|
||||
requestRecordAudioPermissionNew()
|
||||
requestCallPhonePermissionNew()
|
||||
//requestRecordAudioPermissionNew()
|
||||
|
||||
//sergio: para llamadas con SIP
|
||||
//requestCallPhonePermissionNew()
|
||||
init()
|
||||
|
||||
|
||||
|
@ -526,6 +528,7 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
|
|||
|
||||
when (name){
|
||||
name-> editor.putString(name, value)
|
||||
ANDROID_ID->editor.putString(name, value)
|
||||
}
|
||||
|
||||
editor.apply()
|
||||
|
@ -533,6 +536,22 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
|
|||
|
||||
}
|
||||
|
||||
fun saveDataInt(name:String,value:Int){
|
||||
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
|
||||
val editor = prefs.edit()
|
||||
|
||||
when (name){
|
||||
name-> editor.putInt(name, value)
|
||||
ANDROID_ID->editor.putInt(name, value)
|
||||
}
|
||||
|
||||
editor.apply()
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
fun saveBuyer(buyernickname: String) {
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
|
||||
val editor = prefs.edit()
|
||||
|
|
|
@ -25,6 +25,7 @@ import es.verdnatura.presentation.view.feature.ajustes.model.AjustesItemVO
|
|||
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||
import timber.log.Timber.d
|
||||
|
||||
class AjustesFragment :
|
||||
BaseFragment<FragmentAjustesBinding, AjustesViewModel>(AjustesViewModel::class) {
|
||||
|
@ -76,16 +77,13 @@ class AjustesFragment :
|
|||
|
||||
binding.androididText.setText(
|
||||
getData(ANDROID_ID)
|
||||
/*Settings.Secure.getString(
|
||||
context?.contentResolver,
|
||||
Settings.Secure.ANDROID_ID
|
||||
)*/
|
||||
)
|
||||
binding.txtserver.setText(this.getDefaults("base_url", this.requireContext()))
|
||||
|
||||
super.init()
|
||||
|
||||
setEvents()
|
||||
|
||||
}
|
||||
|
||||
fun setEvents() {
|
||||
|
@ -146,6 +144,13 @@ class AjustesFragment :
|
|||
}
|
||||
}
|
||||
})
|
||||
|
||||
workerupdateSector.observe(viewLifecycleOwner, {
|
||||
binding.splashProgress.visibility = View.GONE
|
||||
|
||||
ma.messageWithSound(it.errorMessage,it.isError,false)
|
||||
})
|
||||
|
||||
binding.ajustessItems.adapter = ajustesAdapter
|
||||
binding.ajustessItems.layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
|
@ -202,6 +207,8 @@ class AjustesFragment :
|
|||
viewModel.ajustesitem.get(0).sectorFk = it.id
|
||||
viewModel.ajustesitem.get(0).warehouse = it.warehouseFk
|
||||
viewModel.ajustesitem.get(0).selected = it.description
|
||||
d("El sector marcado es "+it.id.toString())
|
||||
viewModel.worker_updateSector(getData(USER),getData(PASSWORD),it.id.toString())
|
||||
ajustesAdapter!!.notifyDataSetChanged()
|
||||
|
||||
return@forEach
|
||||
|
@ -226,6 +233,7 @@ class AjustesFragment :
|
|||
editor.putString(VOZ, it)
|
||||
editor.apply()
|
||||
viewModel.ajustesitem.get(2).selected = it
|
||||
|
||||
ajustesAdapter!!.notifyDataSetChanged()
|
||||
|
||||
return@forEach
|
||||
|
|
|
@ -11,12 +11,14 @@ import es.verdnatura.presentation.base.BaseViewModel
|
|||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
import es.verdnatura.presentation.common.Event
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
import es.verdnatura.presentation.view.feature.ajustes.model.AjustesItemVO
|
||||
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
||||
import es.verdnatura.presentation.view.feature.ajustes.model.SectorListVO
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
import timber.log.Timber.d
|
||||
|
||||
|
||||
class AjustesViewModel(context: Context) : BaseViewModel() {
|
||||
|
@ -32,6 +34,11 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
|||
val sectorList: LiveData<SectorListVO>
|
||||
get() = _sectorList
|
||||
|
||||
private val _workerupdateSector by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val workerupdateSector: LiveData<ResponseItemVO>
|
||||
get() = _workerupdateSector
|
||||
|
||||
|
||||
|
||||
val loadSectorList = Transformations.map(_sectorList) {Event(it)}
|
||||
|
||||
|
@ -136,4 +143,38 @@ class AjustesViewModel(context: Context) : BaseViewModel() {
|
|||
|
||||
})
|
||||
}
|
||||
fun worker_updateSector(user:String,password:String,sectorFk:String){
|
||||
d("El sector marcado dentro es "+sectorFk)
|
||||
getAjustesUserCase.worker_updateSector(user,password,sectorFk).enqueue(object : Callback<Unit>{
|
||||
override fun onFailure(call: Call<Unit>, t: Throwable) {
|
||||
|
||||
_workerupdateSector.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<Unit>,
|
||||
response: Response<Unit>
|
||||
) {
|
||||
|
||||
if (!response.isSuccessful()){
|
||||
_workerupdateSector.value=ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
|
||||
)
|
||||
}else{
|
||||
_workerupdateSector.value=ResponseItemVO(response="Actualizado sector",isError = false, errorMessage ="Actualizado sector")
|
||||
}
|
||||
|
||||
/*if (response.body() != null){
|
||||
_sectorList.value = response.body()?.let { SectorListVO(it) }
|
||||
}else{
|
||||
val listError:ArrayList<SectorItemVO> = ArrayList()
|
||||
listError.add(SectorItemVO(0,"",0,true,"Error en la llamada sector_get"))
|
||||
_sectorList.value = SectorListVO(listError)
|
||||
}*/
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ class AjustesItemVO (
|
|||
|
||||
class SectorItemVO (
|
||||
var id: Int,
|
||||
var description:String = "",
|
||||
var description:String = "des",
|
||||
val warehouseFk:Int?,
|
||||
val isError : Boolean = false,
|
||||
var errorMessage : String = ""
|
||||
|
|
|
@ -21,7 +21,6 @@ class BuscarItemFragment(
|
|||
) : BaseFragment<FragmentBuscarItemBinding,BuscarItemViewModel>(BuscarItemViewModel::class) {
|
||||
|
||||
private var adapter : LocationAdapter? = null
|
||||
// private lateinit var customDialog: CustomDialog
|
||||
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
|
||||
|
||||
companion object {
|
||||
|
@ -38,7 +37,6 @@ class BuscarItemFragment(
|
|||
|
||||
ma.hideBottomNavigation(GONE)
|
||||
binding.mainToolbar.toolbarTitle.text = getString(R.string.getubicaition)
|
||||
// customDialog = CustomDialog(requireContext())
|
||||
setEvents()
|
||||
if (!itemFk.isNullOrEmpty()){
|
||||
getLocations(itemFk)
|
||||
|
|
|
@ -10,7 +10,8 @@ class ItemLocationVO (
|
|||
var created:String = "",
|
||||
var itemFk:String = "",
|
||||
val isError : Boolean = false,
|
||||
var errorMessage : String = ""
|
||||
var errorMessage : String = "",
|
||||
var priority:String = ""
|
||||
)
|
||||
|
||||
class LocationListVO (
|
||||
|
|
|
@ -678,31 +678,12 @@ class CollectionFragment(
|
|||
observations = observations + " " + ticket.observations
|
||||
}
|
||||
|
||||
//sales = salesList.sortedWith(compareBy({it.placements.get(0).placement}))
|
||||
|
||||
sales = salesList.sortedWith(compareBy({ it.saleOrder }))
|
||||
//sales=salesList
|
||||
/* for (s in sales)
|
||||
{
|
||||
Log.i("VERDNATURA:","La sale del ticket ${s.ticketFk} es ${s.saleOrder}")
|
||||
for (p in s.placements){
|
||||
Log.i("VERDNATURA:","La sale del ticket ${s.saleOrder} es ${p.placement}")
|
||||
//s.placements=s.placements.sortedBy { it.saleOrder}.sortedBy { !it.visible.equals("0") }
|
||||
s.placements=s.placements.sortedBy { !it.visible.equals("0") }
|
||||
// Log.i("VERDNATURA:","La sale del ticket ${s.saleOrder} es saleorder ${p.saleOrder}")
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
/*for (s in salesList)
|
||||
{
|
||||
Log.i("VERDNATURA:","La sale del ticket ${s.ticketFk} es ${s.saleOrder}")
|
||||
for (p in s.placements){
|
||||
Log.i("VERDNATURA:","La sale del ticket ${s.saleOrder} es ${p.placement}")
|
||||
// Log.i("VERDNATURA:","La sale del ticket ${s.saleOrder} es saleorder ${p.saleOrder}")
|
||||
}
|
||||
}*/
|
||||
//pruebas sergio
|
||||
// sales = salesList.sortedWith(compareBy({it.placements.get(0).created}))
|
||||
//sales = salesList.sortedWith(compareBy({it.placements.get(0).placement}))
|
||||
// SalesSorter()
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package es.verdnatura.presentation.view.feature.login.fragment
|
||||
|
||||
import android.app.AlarmManager
|
||||
import android.app.PendingIntent
|
||||
//import es.verdnatura.presentation.view.feature.login.model.LoginItemVO
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.SharedPreferences
|
||||
|
@ -9,19 +9,17 @@ import android.content.pm.PackageInfo
|
|||
import android.content.pm.PackageManager
|
||||
import android.net.Uri
|
||||
import android.provider.Settings
|
||||
import android.util.Log
|
||||
import android.view.KeyEvent
|
||||
import android.view.View
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.preference.PreferenceManager
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentLoginBinding
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.common.hideKeyboard
|
||||
import es.verdnatura.presentation.view.component.CustomDialog
|
||||
import es.verdnatura.presentation.view.feature.login.activity.LoginActivity
|
||||
import es.verdnatura.presentation.view.feature.login.model.LoginItemVO
|
||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||
import timber.log.Timber
|
||||
import timber.log.Timber.d
|
||||
import java.lang.Boolean.TRUE
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
|
@ -40,13 +38,20 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
customDialog = CustomDialog(requireContext())
|
||||
saveIdentifiers()
|
||||
checkUser()
|
||||
binding.buttonLogin.setOnClickListener(View.OnClickListener {
|
||||
binding.buttonLogin.setOnClickListener({
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
viewModel.device_checkLogin(
|
||||
/* viewModel.device_checkLogin(
|
||||
binding.edittextUsername.text.toString(),
|
||||
binding.edittextPassword.text.toString(),
|
||||
getData(ANDROID_ID), callFunction = "device_checkLogin"
|
||||
)
|
||||
*/
|
||||
viewModel.loginSalix(
|
||||
user = binding.edittextUsername.text.toString(),
|
||||
password = binding.edittextPassword.text.toString(),
|
||||
callFunction = "login de Salix"
|
||||
)
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
@ -59,8 +64,8 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
|
||||
|
||||
|
||||
binding.edittextServer.setText(this.getDefaults("base_url", this.requireContext()))
|
||||
binding.edittextServer.setOnKeyListener(View.OnKeyListener { v, keyCode, event ->
|
||||
binding.edittextServer.setText(getDefaults("base_url", this.requireContext()))
|
||||
binding.edittextServer.setOnKeyListener { _, keyCode, event ->
|
||||
if (keyCode == KeyEvent.KEYCODE_ENTER && event.action == KeyEvent.ACTION_UP) {
|
||||
this.setDefaults(
|
||||
"base_url",
|
||||
|
@ -70,12 +75,12 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
this.hideKeyboard()
|
||||
//sergio: deberia lanzar la funcion nueva creada por mi restartapp de BaseFragment. Pero no vuelve a arrancar
|
||||
exitProcess(0)
|
||||
restartapp()
|
||||
return@OnKeyListener false
|
||||
//restartapp()
|
||||
//return@OnKeyListener false
|
||||
|
||||
}
|
||||
false
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
binding.textviewWelcome.setOnLongClickListener {
|
||||
|
@ -89,18 +94,11 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
|
||||
}
|
||||
|
||||
@SuppressLint("HardwareIds")
|
||||
private fun saveIdentifiers() {
|
||||
|
||||
val resolver = requireActivity().contentResolver
|
||||
|
||||
val AndroidId: String = Settings.Secure.getString(resolver, Settings.Secure.ANDROID_ID)
|
||||
var deviceName = Settings.Secure.getString(resolver, "bluetooth_name")
|
||||
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
|
||||
val editor = prefs.edit()
|
||||
editor.putString(ANDROID_ID, AndroidId)
|
||||
editor.putString(DEVICENAME, deviceName)
|
||||
editor.apply()
|
||||
val AndroidId: String = Settings.Secure.getString(requireActivity().contentResolver, Settings.Secure.ANDROID_ID)
|
||||
saveData(ANDROID_ID,AndroidId)
|
||||
|
||||
}
|
||||
|
||||
|
@ -119,18 +117,17 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
override fun observeViewModel() {
|
||||
with(viewModel) {
|
||||
|
||||
versionappitem.observe(viewLifecycleOwner, Observer {
|
||||
versionappitem.observe(viewLifecycleOwner, {
|
||||
|
||||
if (it.isError) {
|
||||
binding.splashProgress.visibility = View.INVISIBLE
|
||||
ma.messageWithSound(it.errorMessage,true,false)
|
||||
/* customDialog.setTitle("Error").setDescription(it.errorMessage)
|
||||
binding.splashProgress.visibility = View.GONE
|
||||
customDialog.setTitle("Error").setDescription(it.errorMessage)
|
||||
.setOkButton("Cerrar") {
|
||||
customDialog.dismiss()
|
||||
}.show()*/
|
||||
}.show()
|
||||
} else {
|
||||
|
||||
if (it.version.equals(getInfoVersionNameApp())) {
|
||||
if (it.version == getInfoVersionNameApp()) {
|
||||
goToMain()
|
||||
} else {
|
||||
|
||||
|
@ -161,22 +158,21 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
}
|
||||
|
||||
})
|
||||
logindevice.observe(viewLifecycleOwner, Observer {
|
||||
logindevice.observe(viewLifecycleOwner, {
|
||||
|
||||
if (it.isError) {
|
||||
binding.splashProgress.visibility = View.INVISIBLE
|
||||
ma.messageWithSound(it.errorMessage,true,false)
|
||||
/* customDialog.setTitle("Error").setDescription(it.errorMessage)
|
||||
binding.splashProgress.visibility = View.GONE
|
||||
customDialog.setTitle("Error").setDescription(it.errorMessage)
|
||||
.setOkButton("Cerrar") {
|
||||
customDialog.dismiss()
|
||||
}.show()*/
|
||||
}.show()
|
||||
} else {
|
||||
if (it.vIsAuthorized.equals("0")) {
|
||||
if (it.vIsAuthorized == "0") {
|
||||
|
||||
customDialog.setTitle("Error").setDescription(it.vMessage!!)
|
||||
.setOkButton("Cerrar") {
|
||||
customDialog.dismiss()
|
||||
binding.splashProgress.visibility = View.INVISIBLE
|
||||
binding.splashProgress.visibility = View.GONE
|
||||
// goToMain()
|
||||
}.show()
|
||||
|
||||
|
@ -187,6 +183,11 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
binding.edittextPassword.text.toString(),
|
||||
callFunction = "worker_getId"
|
||||
)
|
||||
|
||||
viewModel.worker_getSector(
|
||||
binding.edittextUsername.text.toString(),
|
||||
binding.edittextPassword.text.toString())
|
||||
|
||||
deviceLog_add(
|
||||
binding.edittextUsername.text.toString(),
|
||||
binding.edittextPassword.text.toString(),
|
||||
|
@ -195,12 +196,11 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
getData(ANDROID_ID), "deviceLog_add"
|
||||
)
|
||||
|
||||
//saveUserFkPref(it)
|
||||
if (binding.switchRemember.isChecked) {
|
||||
saveRemember(true)
|
||||
} else {
|
||||
saveRemember(false)
|
||||
}
|
||||
if (binding.switchRemember.isChecked) {
|
||||
saveRemember(true)
|
||||
} else {
|
||||
saveRemember(false)
|
||||
}
|
||||
|
||||
saveUserAccesPref(
|
||||
binding.edittextUsername.text.toString(),
|
||||
|
@ -208,26 +208,23 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
)
|
||||
|
||||
|
||||
if (it.vIsAuthorized.equals("1") && it.vMessage.isNullOrEmpty()) {
|
||||
if (it.vIsAuthorized == "1" && it.vMessage.isNullOrEmpty()) {
|
||||
|
||||
loginSalix(
|
||||
user = binding.edittextUsername.text.toString(),
|
||||
password = binding.edittextPassword.text.toString(),
|
||||
callFunction = "login de Salix"
|
||||
)
|
||||
getVersion()
|
||||
|
||||
}
|
||||
if (it.vIsAuthorized.equals("1") && !it.vMessage.isNullOrEmpty()) {
|
||||
if (it.vIsAuthorized == "1" && !it.vMessage.isNullOrEmpty()) {
|
||||
binding.splashProgress.visibility = View.GONE
|
||||
customDialog.setTitle("Mensaje").setDescription(it.vMessage)
|
||||
.setOkButton("Cerrar") {
|
||||
customDialog.dismiss()
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
/* binding.splashProgress.visibility = View.VISIBLE
|
||||
loginSalix(
|
||||
user = binding.edittextUsername.text.toString(),
|
||||
password = binding.edittextPassword.text.toString(),
|
||||
"login de Salix"
|
||||
)
|
||||
)*/
|
||||
getVersion()
|
||||
}.show()
|
||||
|
||||
}
|
||||
|
@ -240,7 +237,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
|
||||
|
||||
|
||||
workerId.observe(viewLifecycleOwner, Observer {
|
||||
workerId.observe(viewLifecycleOwner, {
|
||||
|
||||
if (!it.isError) {
|
||||
saveUserFkPref(it.Id.toString())
|
||||
|
@ -249,14 +246,13 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
|
||||
})
|
||||
|
||||
loginitem.observe(viewLifecycleOwner, Observer {
|
||||
/* loginitem.observe(viewLifecycleOwner, Observer {
|
||||
binding.splashProgress.visibility = View.INVISIBLE
|
||||
if (it.isError) {
|
||||
ma.messageWithSound(it.errorMessage,true,false)
|
||||
/* customDialog.setTitle("Error").setDescription(it.errorMessage)
|
||||
customDialog.setTitle("Error").setDescription(it.errorMessage)
|
||||
.setOkButton("Cerrar") {
|
||||
customDialog.dismiss()
|
||||
}.show()*/
|
||||
}.show()
|
||||
} else {
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
saveUserFkPref(it)
|
||||
|
@ -278,9 +274,9 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
)
|
||||
}
|
||||
|
||||
})
|
||||
})*/
|
||||
|
||||
devicelogresponse.observe(viewLifecycleOwner, Observer {
|
||||
devicelogresponse.observe(viewLifecycleOwner, {
|
||||
|
||||
if (it.isError) {
|
||||
customDialog.setTitle("Error")
|
||||
|
@ -294,48 +290,46 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
}
|
||||
})
|
||||
|
||||
loginsalixitem.observe(viewLifecycleOwner, Observer {
|
||||
workergetSector.observe(viewLifecycleOwner, {
|
||||
binding.splashProgress.visibility = View.GONE
|
||||
|
||||
if (it.id!=0){
|
||||
d("El sector guardado es"+it.id)
|
||||
d("El sector description es"+it.description.toString())
|
||||
d("El sector warehouse es"+it.warehouseFk.toString())
|
||||
saveDataInt("sectorFk",it.id)
|
||||
saveData("sectordescrip",it.description)
|
||||
it.warehouseFk?.let { it1 -> saveDataInt("warehouseFk", it1) }
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
loginsalixitem.observe(viewLifecycleOwner, {
|
||||
|
||||
if (it.isError) {
|
||||
binding.splashProgress.visibility = View.GONE
|
||||
saveTokenPref("")
|
||||
customDialog.setTitle("Error")
|
||||
.setDescription(it.errorMessage + ". Puedes continuar pero algunas funcionalidades no estarán disponibles.")
|
||||
// .setDescription(it.errorMessage + ". Puedes continuar pero algunas funcionalidades no estarán disponibles.")
|
||||
.setDescription(it.errorMessage)
|
||||
.setOkButton(
|
||||
"Entendido"
|
||||
) {
|
||||
customDialog.dismiss()
|
||||
getVersion()
|
||||
//getVersion()
|
||||
//exitProcess(0)
|
||||
}.show()
|
||||
} else {
|
||||
saveTokenPref(it.token)
|
||||
getVersion()
|
||||
viewModel.device_checkLogin(
|
||||
binding.edittextUsername.text.toString(),
|
||||
binding.edittextPassword.text.toString(),
|
||||
getData(ANDROID_ID), callFunction = "device_checkLogin"
|
||||
)
|
||||
//getVersion()
|
||||
}
|
||||
})
|
||||
|
||||
/* version.observe(viewLifecycleOwner, Observer {
|
||||
binding.splashProgress.visibility = View.INVISIBLE
|
||||
if (it) {
|
||||
binding.constrainlayoutLogin.visibility=INVISIBLE
|
||||
goToMain()
|
||||
binding.splashProgress.visibility = View.INVISIBLE
|
||||
|
||||
} else {
|
||||
binding.splashProgress.visibility = View.INVISIBLE
|
||||
customDialog.setTitle(getString(R.string.Actualizar))
|
||||
.setDescription(getString(R.string.updatemng)).setOkButton(
|
||||
getString(
|
||||
R.string.Actualizar
|
||||
)
|
||||
) {
|
||||
val openURL = Intent(Intent.ACTION_VIEW)
|
||||
openURL.data = Uri.parse("https://app.verdnatura.es/bin/vn-picking.apk")
|
||||
startActivity(openURL)
|
||||
}.setKoButton("Cancelar") {
|
||||
customDialog.dismiss()
|
||||
goToMain()
|
||||
}.show()
|
||||
}
|
||||
})*/
|
||||
}
|
||||
super.observeViewModel()
|
||||
}
|
||||
|
@ -353,12 +347,12 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
editor.apply()
|
||||
}
|
||||
|
||||
private fun saveUserFkPref(loginitem: LoginItemVO) {
|
||||
/* private fun saveUserFkPref(loginitem: LoginItemVO) {
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
|
||||
val editor = prefs.edit()
|
||||
editor.putString(USERFK, loginitem.id)
|
||||
editor.apply()
|
||||
}
|
||||
}*/
|
||||
|
||||
private fun saveUserFkPref(workerId: String) {
|
||||
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
|
||||
|
@ -400,6 +394,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
}
|
||||
|
||||
fun setDefaults(key: String?, value: String?, context: Context?) {
|
||||
|
||||
val preferences: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
val editor = preferences.edit()
|
||||
editor.putString(key, value)
|
||||
|
@ -412,18 +407,6 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
|
|||
}
|
||||
|
||||
// sergio:creada restart en BaseFragment para AjustesFragment...
|
||||
fun restartapp() {
|
||||
val mStartActivity = Intent(context, LoginActivity::class.java)
|
||||
val mPendingIntentId = 123456
|
||||
val mPendingIntent = PendingIntent.getActivity(
|
||||
context,
|
||||
mPendingIntentId,
|
||||
mStartActivity,
|
||||
PendingIntent.FLAG_CANCEL_CURRENT
|
||||
)
|
||||
val mgr = requireContext().getSystemService(Context.ALARM_SERVICE) as AlarmManager
|
||||
mgr[AlarmManager.RTC, System.currentTimeMillis() + 100] = mPendingIntent
|
||||
exitProcess(0)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package es.verdnatura.presentation.view.feature.login.fragment
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.google.gson.Gson
|
||||
|
@ -9,36 +8,36 @@ import com.google.gson.JsonObject
|
|||
import com.google.gson.reflect.TypeToken
|
||||
import es.verdnatura.domain.GetLoginUserCase
|
||||
import es.verdnatura.domain.NodeJsService
|
||||
import es.verdnatura.presentation.base.*
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
import es.verdnatura.presentation.view.feature.login.model.*
|
||||
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
||||
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.versionApp
|
||||
import es.verdnatura.presentation.view.feature.login.model.workerId
|
||||
import es.verdnatura.presentation.view.feature.paletizador.model.itemsExpeditionDynamics
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
import timber.log.Timber
|
||||
import timber.log.Timber.d
|
||||
|
||||
class LoginViewModel(context: Context) : BaseViewModel()
|
||||
{
|
||||
|
||||
private val getLoginUserCase: GetLoginUserCase = GetLoginUserCase(context)
|
||||
|
||||
private val _loginitem by lazy { MutableLiveData<LoginItemVO>() }
|
||||
val loginitem: LiveData<LoginItemVO>
|
||||
get() = _loginitem
|
||||
|
||||
private val _loginsalixitem by lazy { MutableLiveData<LoginSalixVO>() }
|
||||
val loginsalixitem: LiveData<LoginSalixVO>
|
||||
get() = _loginsalixitem
|
||||
|
||||
/* private val _version by lazy { MutableLiveData<Boolean>() }
|
||||
val version: LiveData<Boolean>
|
||||
get() = _version*/
|
||||
|
||||
private val _devicelogresponse by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val devicelogresponse: LiveData<ResponseItemVO>
|
||||
get() = _devicelogresponse
|
||||
|
||||
//sergio: nueva version para actualizar
|
||||
private val _versionappitem by lazy { MutableLiveData<versionApp>() }
|
||||
val versionappitem: LiveData<versionApp>
|
||||
get() = _versionappitem
|
||||
|
@ -56,55 +55,9 @@ class LoginViewModel(context: Context) : BaseViewModel()
|
|||
get() = _nodejs
|
||||
|
||||
|
||||
//sergio:anterior login
|
||||
fun login(user: String, password: String, androiid: String)
|
||||
{
|
||||
getLoginUserCase.login(user, password, androiid).enqueue(object : Callback<String>
|
||||
{
|
||||
override fun onResponse(call: Call<String>, response: Response<String>)
|
||||
{
|
||||
|
||||
var loginItemVO: LoginItemVO?
|
||||
if (response.raw().code() == 555)
|
||||
{
|
||||
var message = response.raw().message().toString()
|
||||
|
||||
if (message.contains("autorizado"))
|
||||
{
|
||||
loginItemVO = LoginItemVO(
|
||||
id = "0",
|
||||
isError = true,
|
||||
errorMessage = "Usuario no autorizado para este dispositivo"
|
||||
)
|
||||
} else
|
||||
{
|
||||
loginItemVO = LoginItemVO(
|
||||
id = "0",
|
||||
isError = true,
|
||||
errorMessage = "Usuario o contraseña incorrectos"
|
||||
)
|
||||
}
|
||||
|
||||
} else if (!response.body().isNullOrEmpty())
|
||||
{
|
||||
loginItemVO = response.body()?.let { LoginItemVO(id = it) }
|
||||
} else
|
||||
{
|
||||
loginItemVO =
|
||||
LoginItemVO(id = "0", isError = true, errorMessage = "Error desconocido")
|
||||
}
|
||||
|
||||
_loginitem.value = loginItemVO!!
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<String>, t: Throwable)
|
||||
{
|
||||
val loginItemVO: LoginItemVO? =
|
||||
LoginItemVO(id = "0", isError = true, errorMessage = t.message!!)
|
||||
_loginitem.value = loginItemVO
|
||||
}
|
||||
})
|
||||
}
|
||||
private val _workergetSector by lazy { MutableLiveData<SectorItemVO>() }
|
||||
val workergetSector: LiveData<SectorItemVO>
|
||||
get() = _workergetSector
|
||||
|
||||
fun loginSalix(user: String, password: String,callFunction:String)
|
||||
{
|
||||
|
@ -113,9 +66,10 @@ class LoginViewModel(context: Context) : BaseViewModel()
|
|||
override fun onResponse(call: Call<LoginSalixVO>, response: Response<LoginSalixVO>)
|
||||
{
|
||||
|
||||
var loginSalixVO: LoginSalixVO?
|
||||
val loginSalixVO: LoginSalixVO?
|
||||
if (response.body() != null)
|
||||
{
|
||||
|
||||
loginSalixVO = response.body()?.token?.let {
|
||||
LoginSalixVO(
|
||||
user,
|
||||
|
@ -127,12 +81,15 @@ class LoginViewModel(context: Context) : BaseViewModel()
|
|||
}
|
||||
} else
|
||||
{
|
||||
|
||||
loginSalixVO = LoginSalixVO(
|
||||
user,
|
||||
password,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
|
||||
)
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this),if (response.message()=="Unauthorized"){"Revisa tu usuario y contraseña. En caso de no poder acceder contacta co Informática"}else{response.message()
|
||||
}))
|
||||
|
||||
|
||||
}
|
||||
|
||||
_loginsalixitem.value = loginSalixVO
|
||||
|
@ -155,7 +112,6 @@ class LoginViewModel(context: Context) : BaseViewModel()
|
|||
|
||||
fun device_checkLogin(user: String, password: String, android_id: String,callFunction:String)
|
||||
{
|
||||
//var name=nameofFunction(object{})
|
||||
|
||||
getLoginUserCase.device_checkLogin(user, password, android_id)
|
||||
.enqueue(object : Callback<LoginDevice>
|
||||
|
@ -163,7 +119,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
|
|||
override fun onResponse(call: Call<LoginDevice>, response: Response<LoginDevice>)
|
||||
{
|
||||
|
||||
var loginDevice: LoginDevice?
|
||||
val loginDevice: LoginDevice?
|
||||
|
||||
|
||||
if (!response.isSuccessful)
|
||||
|
@ -201,6 +157,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
|
|||
|
||||
override fun onFailure(call: Call<LoginDevice>, t: Throwable)
|
||||
{
|
||||
|
||||
val loginDevice =
|
||||
LoginDevice(
|
||||
"",
|
||||
|
@ -223,7 +180,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
|
|||
override fun onResponse(call: Call<String>, response: Response<String>)
|
||||
{
|
||||
|
||||
var workerId: workerId?
|
||||
val workerId: workerId?
|
||||
|
||||
|
||||
if (response.body() != null)
|
||||
|
@ -295,22 +252,6 @@ class LoginViewModel(context: Context) : BaseViewModel()
|
|||
|
||||
}
|
||||
|
||||
/*fun checkVersion_old(user:String,password:String,version:String){
|
||||
getLoginUserCase.checkVersion(user,password,version).enqueue(object : Callback<Boolean>{
|
||||
override fun onResponse(call: Call<Boolean>, response: Response<Boolean>) {
|
||||
if (response.body() != null){
|
||||
_version.value = response.body()
|
||||
}else{
|
||||
_version.value = true
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<Boolean>, t: Throwable) {
|
||||
_version.value = true
|
||||
}
|
||||
})
|
||||
}*/
|
||||
//sergio:checkVersion new
|
||||
fun checkVersion(user: String, password: String, nameApp: String,callFunction: String)
|
||||
{
|
||||
getLoginUserCase.checkVersion(user, password, nameApp)
|
||||
|
@ -319,12 +260,12 @@ class LoginViewModel(context: Context) : BaseViewModel()
|
|||
override fun onResponse(call: Call<versionApp>, response: Response<versionApp>)
|
||||
{
|
||||
|
||||
var versionApp: versionApp?
|
||||
//var versionApp: versionApp?
|
||||
|
||||
if (response.body() != null)
|
||||
{
|
||||
|
||||
versionApp = response.body()?.let {
|
||||
_versionappitem.value = response.body()?.let {
|
||||
|
||||
versionApp(
|
||||
it.appname,
|
||||
|
@ -338,27 +279,28 @@ class LoginViewModel(context: Context) : BaseViewModel()
|
|||
|
||||
} else
|
||||
{
|
||||
versionApp = versionApp(
|
||||
_versionappitem.value = versionApp(
|
||||
user,
|
||||
password,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
|
||||
)
|
||||
}
|
||||
_versionappitem.value = versionApp
|
||||
|
||||
// _versionappitem.value = versionApp
|
||||
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<versionApp>, t: Throwable)
|
||||
{
|
||||
val versionApp =
|
||||
_versionappitem.value =
|
||||
versionApp(
|
||||
nameApp,
|
||||
"",
|
||||
isError = true,
|
||||
errorMessage =getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
_versionappitem.value = versionApp
|
||||
//_versionappitem.value = versionApp
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -375,7 +317,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
|
|||
{
|
||||
|
||||
|
||||
var workerId: NodeJsService.SmartTagNode?
|
||||
val workerId: NodeJsService.SmartTagNode?
|
||||
|
||||
/* if (response.isSuccessful()){
|
||||
Log.i("VERDNATURA::","OK")
|
||||
|
@ -387,7 +329,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
|
|||
|
||||
if (response.body() != null)
|
||||
{
|
||||
Log.i("VERDNATURA::", "el valor nodejs no es nulo ")
|
||||
|
||||
workerId = NodeJsService.SmartTagNode(
|
||||
response.body().toString(),
|
||||
isError = false,
|
||||
|
@ -400,7 +342,6 @@ class LoginViewModel(context: Context) : BaseViewModel()
|
|||
isError = true,
|
||||
errorMessage = "Error al llamar al servicio Node."
|
||||
)
|
||||
Log.i("VERDNATURA::", "el valor nodejs es NULL")
|
||||
}
|
||||
|
||||
_nodejs.value = workerId
|
||||
|
@ -411,7 +352,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
|
|||
val workerId =
|
||||
NodeJsService.SmartTagNode(isError = true, errorMessage = t.message!!)
|
||||
|
||||
Log.i("VERDNATURA::","el error nodejs es "+t.message+"--"+t.cause.toString()+"--"+t.stackTrace.toString())
|
||||
// Log.i("VERDNATURA::","el error nodejs es "+t.message+"--"+t.cause.toString()+"--"+t.stackTrace.toString())
|
||||
|
||||
_nodejs.value = workerId
|
||||
}
|
||||
|
@ -436,5 +377,36 @@ class LoginViewModel(context: Context) : BaseViewModel()
|
|||
}
|
||||
return list
|
||||
}
|
||||
fun worker_getSector(user:String,password:String){
|
||||
|
||||
getLoginUserCase.worker_getSector(user,password).enqueue(object : Callback<SectorItemVO>{
|
||||
override fun onFailure(call: Call<SectorItemVO>, t: Throwable) {
|
||||
|
||||
Timber.d("El sector failure " + t.message!!)
|
||||
_workergetSector.value = SectorItemVO(0,"",0,isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<SectorItemVO>,
|
||||
response: Response<SectorItemVO>
|
||||
) {
|
||||
|
||||
if (!response.isSuccessful()){
|
||||
d("El sector is not successfull")
|
||||
_workergetSector.value= SectorItemVO(0,"",0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
|
||||
)
|
||||
}else{
|
||||
|
||||
d("El sector is successfull")
|
||||
_workergetSector.value = response.body()?.let { SectorItemVO(it.id,it.description,it.warehouseFk,isError = false) }
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,11 +2,11 @@ package es.verdnatura.presentation.view.feature.login.model
|
|||
|
||||
|
||||
|
||||
class LoginItemVO(
|
||||
/*class LoginItemVO(
|
||||
val id: String = "",
|
||||
var isError: Boolean = false,
|
||||
var errorMessage: String = ""
|
||||
)
|
||||
)*/
|
||||
|
||||
class LoginSalixVO(
|
||||
val user: String = "",
|
||||
|
|
|
@ -43,18 +43,16 @@ import es.verdnatura.presentation.view.feature.paletizador.fragment.*
|
|||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckVO
|
||||
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletVO
|
||||
import es.verdnatura.presentation.view.feature.parking.fragment.ParkingFragment
|
||||
import es.verdnatura.presentation.view.feature.parking.fragment.ParkingSaleFragment
|
||||
import es.verdnatura.presentation.view.feature.pasillero.fragment.PasilleroFragment
|
||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||
import es.verdnatura.presentation.view.feature.precontrol.PreControladorFragment
|
||||
import es.verdnatura.presentation.view.feature.showticket.ShowTicketFragment
|
||||
import es.verdnatura.presentation.view.feature.presacador.fragment.PreSacadorFragment
|
||||
import es.verdnatura.presentation.view.feature.qr.QrFragment
|
||||
import es.verdnatura.presentation.view.feature.reposicion.fragment.ReposicionFragment
|
||||
import es.verdnatura.presentation.view.feature.sacador.fragment.SacadorFragment
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.SaleVO
|
||||
import es.verdnatura.presentation.view.feature.shelvingparking.fragment.ShelvingParkingFragment
|
||||
import es.verdnatura.presentation.view.feature.showticket.ShowTicketFragment
|
||||
import es.verdnatura.presentation.view.feature.smarttag.register.RegisterSmartTagsFragment
|
||||
import es.verdnatura.presentation.view.feature.smarttag.sacador.fragment.AssociateSmartTagsFragment
|
||||
import es.verdnatura.presentation.view.feature.ubicador.fragment.AutomaticAddItemFragment
|
||||
|
@ -117,18 +115,18 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
private fun navigationDrawer(){
|
||||
|
||||
|
||||
val drawerLayout = binding.drawerLayout
|
||||
drawerLayout.open()
|
||||
/* val drawerLayout = binding.drawerLayout
|
||||
drawerLayout.open()
|
||||
|
||||
/* val toggle = ActionBarDrawerToggle(
|
||||
this,
|
||||
drawerLayout,
|
||||
toolbar,
|
||||
"abierto",
|
||||
"cerrado"
|
||||
)
|
||||
drawerLayout.addDrawerListener(toggle)
|
||||
toggle.syncState()*/
|
||||
val toggle = ActionBarDrawerToggle(
|
||||
this,
|
||||
drawerLayout,
|
||||
toolbar,
|
||||
"abierto",
|
||||
"cerrado"
|
||||
)
|
||||
drawerLayout.addDrawerListener(toggle)
|
||||
toggle.syncState()*/
|
||||
|
||||
}
|
||||
/* private fun navigateToFragment(){
|
||||
|
@ -143,9 +141,9 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
val sectorFk = prefs.getInt("sectorFk", -1)
|
||||
return sectorFk != -1
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private fun setBottomMenu() {
|
||||
val bottomMenu = binding.mainBottomNavigation
|
||||
bottomMenu.itemIconTintList = null
|
||||
|
@ -532,9 +530,9 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
}
|
||||
|
||||
|
||||
fun onParkingSaleSelected(sales: SaleVO) {
|
||||
/* fun onParkingSaleSelected(sales: SaleVO) {
|
||||
addFragmentOnTop(ParkingSaleFragment.newInstance(SaleVO = sales))
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
override fun onCollectionSelected(collection: CollectionVO, type: String) {
|
||||
|
|
|
@ -8,6 +8,7 @@ import androidx.recyclerview.widget.RecyclerView
|
|||
import es.verdnatura.databinding.ItemPasillerosMainMenuBinding
|
||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||
import timber.log.Timber.d
|
||||
|
||||
class PasillerosAdapter (
|
||||
private val items: List<PasillerosItemVO>,
|
||||
|
@ -40,7 +41,12 @@ class PasillerosAdapter (
|
|||
binding.apply {
|
||||
this.item = item
|
||||
this.title = context?.getString(item.titleToShow)
|
||||
itemImage.setImageResource(item.iconResource)
|
||||
|
||||
try {
|
||||
itemImage.setImageResource(item.iconResource)
|
||||
}catch(exception:Exception){
|
||||
d("Exception::"+exception.message)
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
itemImage.tooltipText=item.description
|
||||
|
|
|
@ -121,7 +121,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
|
|||
)
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(7,
|
||||
R.drawable.ic_history_orange_24dp,
|
||||
R.drawable.ic_history_orange,
|
||||
"Log Shelving",R.string.shelvingLog,"Permite conocer los movimientos en un carro"
|
||||
)
|
||||
)
|
||||
|
|
|
@ -613,15 +613,20 @@ class PreSacadorFragment :
|
|||
vIsChecked = if (sales[position].picked == sales[position].quantity) "1" else "0",
|
||||
vOriginalQuantity = sales[position].picked.toString(),
|
||||
vStateFk = PRESACADOR,
|
||||
|
||||
//sergio: se añade originalItemScan para
|
||||
vBuyFk = originalItemScan, callFunction = "saleTrackingReplace"
|
||||
|
||||
)
|
||||
|
||||
// ////Log.i("VERDNATURA:","El id movimiento es ${sales[position].idMovimiento}")
|
||||
// ////Log.i("VERDNATURA:","Checked is ${if (sales[position].picked == sales[position].quantity) "1" else "0"}")
|
||||
// ////Log.i("VERDNATURA:","Position is ${position}")
|
||||
viewModel.saleTrackingReplace(
|
||||
usuario = getData(USER),
|
||||
password = getData(PASSWORD),
|
||||
saleFk = sales[position].idMovimiento,
|
||||
vIsChecked = if (sales[position].picked == sales[position].quantity) "1" else "0",
|
||||
vOriginalQuantity = sales[position].picked.toString(),
|
||||
vStateFk = PRESACADOR,
|
||||
vBuyFk = originalItemScan, callFunction = "saleTrackingReplace"
|
||||
|
||||
)
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -13,11 +13,9 @@ import es.verdnatura.domain.ConstAndValues.SACADOR
|
|||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.common.*
|
||||
import es.verdnatura.presentation.view.component.CustomDialog
|
||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||
import es.verdnatura.presentation.view.feature.sacador.adapter.CollectionAdapter
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
import es.verdnatura.presentation.view.feature.smarttag.sacador.fragment.AssociateSmartTagsFragment
|
||||
import timber.log.Timber.d
|
||||
|
||||
|
||||
class SacadorFragment :
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<vector android:height="24dp"
|
||||
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<vector
|
||||
android:height="24dp"
|
||||
android:width="24dp"
|
||||
android:viewportHeight="24"
|
||||
android:viewportWidth="24"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#F7931E" android:pathData="M13,3c-4.97,0 -9,4.03 -9,9L1,12l3.89,3.89 0.07,0.14L9,12L6,12c0,-3.87 3.13,-7 7,-7s7,3.13 7,7 -3.13,7 -7,7c-1.93,0 -3.68,-0.79 -4.94,-2.06l-1.42,1.42C8.27,19.99 10.51,21 13,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,8v5l4.28,2.54 0.72,-1.21 -3.5,-2.08L13.5,8L12,8z"/>
|
||||
</vector>
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
<vector
|
||||
android:height="24dp"
|
||||
android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0"
|
||||
android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FFFFFF" android:pathData="M13,3c-4.97,0 -9,4.03 -9,9L1,12l3.89,3.89 0.07,0.14L9,12L6,12c0,-3.87 3.13,-7 7,-7s7,3.13 7,7 -3.13,7 -7,7c-1.93,0 -3.68,-0.79 -4.94,-2.06l-1.42,1.42C8.27,19.99 10.51,21 13,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,8v5l4.28,2.54 0.72,-1.21 -3.5,-2.08L13.5,8L12,8z"/>
|
||||
</vector>
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<vector
|
||||
android:height="24dp"
|
||||
android:width="24dp"
|
||||
android:viewportHeight="24"
|
||||
android:viewportWidth="24"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#F7931E" android:pathData="M13,3c-4.97,0 -9,4.03 -9,9L1,12l3.89,3.89 0.07,0.14L9,12L6,12c0,-3.87 3.13,-7 7,-7s7,3.13 7,7 -3.13,7 -7,7c-1.93,0 -3.68,-0.79 -4.94,-2.06l-1.42,1.42C8.27,19.99 10.51,21 13,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,8v5l4.28,2.54 0.72,-1.21 -3.5,-2.08L13.5,8L12,8z"/>
|
||||
</vector>
|
|
@ -69,6 +69,14 @@
|
|||
android:textColor="@color/verdnatura_white"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Prioridad"
|
||||
android:textSize="@dimen/body2"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -49,6 +49,14 @@
|
|||
android:textColor="@color/verdnatura_white"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{item.priority}"
|
||||
android:textSize="@dimen/body2"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -22,7 +22,7 @@ buildscript {
|
|||
classpath 'com.android.tools.build:gradle:7.0.4'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath 'com.google.gms:google-services:4.3.10'//4.3.5
|
||||
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'//2.5.2
|
||||
// classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'//2.5.2
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
|
Loading…
Reference in New Issue