Modificados ficheros para quitar la función synthetic deprecated

This commit is contained in:
Sergio De la torre 2021-11-26 17:28:22 +01:00
parent 42023e7f61
commit 155a2102cf
35 changed files with 337 additions and 415 deletions

View File

@ -12,7 +12,7 @@ import es.verdnatura.presentation.view.feature.controlador.fragment.ControladorV
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoViewModel
import es.verdnatura.presentation.view.feature.diadeventa.fragment.DayOfSaleViewModel
import es.verdnatura.presentation.view.feature.faltas.fragment.FaltasViewModel
import es.verdnatura.presentation.view.feature.historico.fragment.HistoricoViewModel
import es.verdnatura.presentation.view.feature.historicoarticulo.fragment.HistoricoArticuloViewModel
import es.verdnatura.presentation.view.feature.historicoshelving.fragment.itemShelvingLogViewModel
import es.verdnatura.presentation.view.feature.historicoshelvinglog.fragment.shelvingLogViewModel
import es.verdnatura.presentation.view.feature.historicovehiculo.fragment.HistoricoVehiculoViewModel
@ -56,7 +56,7 @@ val viewModelModule = module {
// Pasilleros / Item Card / Historico
viewModel {
HistoricoViewModel(androidContext())
HistoricoArticuloViewModel(androidContext())
}
// Pasilleros / Buscar Item

View File

@ -4,7 +4,7 @@ import android.content.Context
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
import es.verdnatura.presentation.view.feature.articulo.model.ItemProposal
import es.verdnatura.presentation.view.feature.historico.model.ItemHistoricoVO
import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoVO
import retrofit2.Call
class GetItemCardUserCase(context: Context) : RestClient(context) {

View File

@ -11,7 +11,7 @@ import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
import es.verdnatura.presentation.view.feature.calidad.model.ItemBuyerVO
import es.verdnatura.presentation.view.feature.diadeventa.model.ItemShelvingSaleDate
import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO
import es.verdnatura.presentation.view.feature.historico.model.ItemHistoricoVO
import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoVO
import es.verdnatura.presentation.view.feature.historicoshelving.model.ItemShelvingLog
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLog
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculo

View File

@ -2,14 +2,17 @@ package es.verdnatura.presentation.view.feature.articulo.fragment
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.buyers_fragment.*
import kotlinx.android.synthetic.main.fragment_item_card.*
import kotlinx.android.synthetic.main.fragment_item_card.binding.splashProgress
import kotlinx.android.synthetic.main.toolbar.**/
import android.app.AlertDialog
import android.content.Intent
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
import android.view.View
import android.view.inputmethod.EditorInfo
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
@ -30,17 +33,10 @@ import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardRowVO
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
import es.verdnatura.presentation.view.feature.calidad.model.BuyerListVO
import es.verdnatura.presentation.view.feature.imageview.activity.ImageViewActivity
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.buyers_fragment.*
import kotlinx.android.synthetic.main.fragment_item_card.*
import kotlinx.android.synthetic.main.fragment_item_card.binding.splashProgress
import kotlinx.android.synthetic.main.toolbar.**/
import timber.log.Timber
class ItemCardFragment(
var itemFk:String = ""
@ -73,9 +69,8 @@ class ItemCardFragment(
override fun getLayoutId(): Int = R.layout.fragment_item_card
override fun init() {
//binding.itemcardLayout.visibility = View.GONE
binding.itemcardLayout.visibility=View.GONE
//requireActivity().main_bottom_navigation.visibility = View.GONE
(activity as MainActivity).hideBottomNavigation(View.GONE)
setEvents()
@ -157,7 +152,7 @@ class ItemCardFragment(
//itemcard_image.setOnClickListener {
binding.itemcardImage.setOnClickListener{
val i:Intent = Intent(activity,ImageViewActivity::class.java)
val i = Intent(activity,ImageViewActivity::class.java)
i.putExtra("url",urlLarge)
i.putExtra("title",titleImage)
startActivity(i)
@ -178,7 +173,7 @@ class ItemCardFragment(
override fun observeViewModel() {
with(viewModel){
itemcard.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = View.GONE
if (it.isError){
binding.itemcardLayout.visibility = View.GONE
binding.mainToolbar.toolbarTitle.text = "ItemCard"
@ -198,6 +193,7 @@ class ItemCardFragment(
}
}
//binding.splashProgress.visibility = View.GONE
})
itemspackinglist.observe(viewLifecycleOwner, Observer {
@ -382,14 +378,14 @@ class ItemCardFragment(
binding.itemcardRecyclerview.adapter = adapter
//itemcard_recyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
binding.itemcardRecyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
binding.scrollView.post({
binding.scrollView.post {
val position = IntArray(2)
if (binding.itemcardImage != null){
if (binding.itemcardImage != null) {
binding.itemcardImage.getLocationInWindow(position)
binding.scrollView.scrollTo(0, position[1])
}
})
}
binding.splashProgress.visibility = View.GONE
}
private fun editItemCardRow(item:ItemCardRowVO,value:String){

View File

@ -24,10 +24,6 @@ class DayOfSaleViewModel(context: Context) : BaseViewModel() {
GetDayOfSaleUSerCase(context)
/* private val _itemexpedition by lazy { MutableLiveData<itemExpedetionState>() }
val itemexpedition: LiveData<itemExpedetionState>
get() = _itemexpedition*/
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
val response: LiveData<ResponseItemVO>
get() = _response
@ -37,12 +33,8 @@ class DayOfSaleViewModel(context: Context) : BaseViewModel() {
val itemShelvingSaleDateList: LiveData<ItemShelvingSaleDateList>
get() = _itemShelvingSaleDateList
//val loadHistoricoVehiculoList = Transformations.map(_itemShelvingSaleDateList) { Event(it) }
val loadItemShelvingSaleDateList = Transformations.map(_itemShelvingSaleDateList) { Event(it) }
fun itemShelving_getSaleDate(usuario:String,password:String,vShelvingFK: String,callFunction:String){
GetDayOfSaleUSerCase.itemShelving_getSaleDate(usuario,password,vShelvingFK).enqueue(object :
Callback<List<ItemShelvingSaleDate>> {

View File

@ -1,4 +1,4 @@
package es.verdnatura.presentation.view.feature.historico.adapter
package es.verdnatura.presentation.view.feature.historicoarticulo.adapter
import android.view.LayoutInflater
import android.view.ViewGroup
@ -6,7 +6,7 @@ import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.R
import es.verdnatura.databinding.ItemHistoricoRowBinding
import es.verdnatura.presentation.view.feature.historico.model.ItemHistoricoVO
import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoVO
import androidx.core.content.ContextCompat
import java.text.SimpleDateFormat
import java.util.*

View File

@ -1,4 +1,4 @@
package es.verdnatura.presentation.view.feature.historico.fragment
package es.verdnatura.presentation.view.feature.historicoarticulo.fragment
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_buscar_item.*
@ -25,19 +25,19 @@ import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnOptionsSelectedListener
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogInput
import es.verdnatura.presentation.view.feature.historico.adapter.HistoricoAdapter
import es.verdnatura.presentation.view.feature.historico.model.ItemHistoricoListVO
import es.verdnatura.presentation.view.feature.historico.model.ItemHistoricoVO
import es.verdnatura.presentation.view.feature.historicoarticulo.adapter.HistoricoAdapter
import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoListVO
import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoVO
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import java.text.SimpleDateFormat
import java.util.*
class HistoricoFragment(
class HistoricoArticuloFragment(
var itemFk: String = ""
) : BaseFragment<FragmentHistoricoBinding, HistoricoViewModel>(
HistoricoViewModel::class
) : BaseFragment<FragmentHistoricoBinding, HistoricoArticuloViewModel>(
HistoricoArticuloViewModel::class
) {
private var user = ""
@ -52,7 +52,7 @@ class HistoricoFragment(
private var filter: String = ""
companion object {
fun newInstance(entryPoint: String) = HistoricoFragment(entryPoint)
fun newInstance(entryPoint: String) = HistoricoArticuloFragment(entryPoint)
}
override fun getLayoutId(): Int = R.layout.fragment_historico

View File

@ -1,4 +1,4 @@
package es.verdnatura.presentation.view.feature.historico.fragment
package es.verdnatura.presentation.view.feature.historicoarticulo.fragment
import android.content.Context
import androidx.lifecycle.LiveData
@ -6,16 +6,15 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetItemCardUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.view.feature.historico.model.ItemHistoricoListVO
import es.verdnatura.presentation.view.feature.historico.model.ItemHistoricoVO
import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoListVO
import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoVO
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
class HistoricoViewModel(context: Context) : BaseViewModel() {
class HistoricoArticuloViewModel(context: Context) : BaseViewModel() {
private val getItemCardUserCase: GetItemCardUserCase = GetItemCardUserCase(context)

View File

@ -1,4 +1,4 @@
package es.verdnatura.presentation.view.feature.historico.model
package es.verdnatura.presentation.view.feature.historicoarticulo.model
class ItemHistoricoVO (
var shipped:String = "",

View File

@ -14,17 +14,17 @@ package es.verdnatura.presentation.view.feature.historicoshelving.fragment
import es.verdnatura.presentation.view.component.CustomDialogList
import es.verdnatura.presentation.view.feature.historicoshelving.adapter.ItemShelvingLogAdapter
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import kotlinx.android.synthetic.main.activity_main.*
/* import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.buyers_fragment.*
import kotlinx.android.synthetic.main.fragment_historicovehiculo.*
import kotlinx.android.synthetic.main.fragment_item_card.*
import kotlinx.android.synthetic.main.fragment_item_card.edit_itemFk
import kotlinx.android.synthetic.main.fragment_item_card.binding.scanInput
import kotlinx.android.synthetic.main.fragment_item_card.splash_progress
import kotlinx.android.synthetic.main.fragment_itemexpeditionstate_card.*
import kotlinx.android.synthetic.main.fragment_itemshelvingdayofsale.*
import kotlinx.android.synthetic.main.fragment_itemshelvinglog.*
import kotlinx.android.synthetic.main.fragment_parking.*
import kotlinx.android.synthetic.main.toolbar.*
import kotlinx.android.synthetic.main.toolbar.**/
class itemShelvingLogFragment(
var entryPoint: String = ""
@ -56,44 +56,41 @@ class itemShelvingLogFragment(
}
private fun setToolBar(title: String) {
toolbar_title.text = title
binding.mainToolbar.toolbarTitle.text = title
}
private fun setEvents() {
edit_itemFk.requestFocus()
edit_itemFk.setOnEditorActionListener { v, actionId, event ->
binding.scanInput.requestFocus()
binding.scanInput.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
if (!edit_itemFk.text.toString().isNullOrEmpty()) {
itemShelvingLog_get(edit_itemFk.text.toString())
if (!binding.scanInput.text.toString().isNullOrEmpty()) {
itemShelvingLog_get(binding.scanInput.text.toString())
itemScan = edit_itemFk.text.toString()
itemScan = binding.scanInput.text.toString()
}
edit_itemFk.setText("")
(activity as MainActivity).hideKeyboard(edit_itemFk)
binding.scanInput.setText("")
(activity as MainActivity).hideKeyboard(binding.scanInput)
return@setOnEditorActionListener true
}
false
}
backButton.setOnClickListener {
binding.mainToolbar.backButton.setOnClickListener {
requireActivity().onBackPressed()
}
}
private fun itemShelvingLog_get(vShelvingFK: String) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
user = prefs.getString(USER, "").toString()
password = prefs.getString(PASSWORD, "").toString()
warehouseFk = prefs.getInt(WAREHOUSEFK, 1).toString()
splash_progress.visibility = View.VISIBLE
binding.splashProgress.visibility = View.VISIBLE
viewModel.itemShelvingLog_get(user, password,vShelvingFK,"itemShelvingLog_get")
}
@ -104,13 +101,12 @@ class itemShelvingLogFragment(
loadItemShelvingLogList.observe(viewLifecycleOwner, Observer{ event ->
event.getContentIfNotHandled().notNull {
splash_progress.visibility = View.GONE
binding.splashProgress.visibility = View.GONE
adapter = ItemShelvingLogAdapter(it.list)
itemshelvinglog_recyclerview.adapter = adapter
itemshelvinglog_recyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
binding.itemshelvinglogRecyclerview.adapter = adapter
binding.itemshelvinglogRecyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
setToolBar(getString(R.string.itemShelvingLog)+":"+itemScan)
// navigateToToday(it)
if (it.list.isEmpty()){
customDialog.setTitle("Sin resultados")
.setDescription("No se ha podido obtener datos de la etiqueta escaneada. ")
@ -130,10 +126,10 @@ class itemShelvingLogFragment(
}
})
response.observe(viewLifecycleOwner, Observer {
/* response.observe(viewLifecycleOwner, Observer {
if (it.isError){
splash_progress.visibility = View.GONE
binding.splashProgress.visibility = View.GONE
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss()
}.show()
@ -141,15 +137,15 @@ class itemShelvingLogFragment(
}else{
it.response.toast(requireContext())
/* customDialog.setTitle("Información").setDescription(it.response).setOkButton("Cerrar") {
*//* customDialog.setTitle("Información").setDescription(it.response).setOkButton("Cerrar") {
customDialog.dismiss()
}.show()*/
}.show()*//*
}
})
*/
}
}

View File

@ -24,19 +24,8 @@ class itemShelvingLogViewModel(context: Context) : BaseViewModel() {
itemShelvingLogUSerCase(context)
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
val response: LiveData<ResponseItemVO>
get() = _response
private val _itemShelvingSaleDateList by lazy { MutableLiveData<ItemShelvingSaleDateList>() }
val itemShelvingSaleDateList: LiveData<ItemShelvingSaleDateList>
get() = _itemShelvingSaleDateList
private val _itemShelvingLogList by lazy { MutableLiveData<ItemShelvingLogList>() }
val itemShelvingLogList: LiveData<ItemShelvingLogList>
get() = _itemShelvingLogList
val loadItemShelvingLogList = Transformations.map(_itemShelvingLogList) { Event(it) }
@ -71,8 +60,6 @@ class itemShelvingLogViewModel(context: Context) : BaseViewModel() {
}
i("finalizada la lista ${response.body()}")
}
}

View File

@ -6,26 +6,25 @@ import android.view.inputmethod.EditorInfo
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
import es.verdnatura.databinding.FragmentItemshelvinglogBinding
import es.verdnatura.databinding.FragmentShelvinglogBinding
import es.verdnatura.domain.notNull
import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogList
import es.verdnatura.presentation.view.feature.historicoshelvinglog.adapter.ShelvingLogAdapter
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import kotlinx.android.synthetic.main.activity_main.*
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.buyers_fragment.*
import kotlinx.android.synthetic.main.fragment_historicovehiculo.*
import kotlinx.android.synthetic.main.fragment_item_card.*
import kotlinx.android.synthetic.main.fragment_item_card.edit_itemFk
import kotlinx.android.synthetic.main.fragment_item_card.binding.scanInput
import kotlinx.android.synthetic.main.fragment_item_card.splash_progress
import kotlinx.android.synthetic.main.fragment_itemexpeditionstate_card.*
import kotlinx.android.synthetic.main.fragment_itemshelvingdayofsale.*
import kotlinx.android.synthetic.main.fragment_itemshelvinglog.*
import kotlinx.android.synthetic.main.fragment_parking.*
import kotlinx.android.synthetic.main.toolbar.*
import kotlinx.android.synthetic.main.toolbar.**/
class shelvingLogFragment(
var entryPoint: String = ""
@ -58,30 +57,30 @@ class shelvingLogFragment(
}
private fun setToolBar(title: String) {
toolbar_title.text = title
binding.mainToolbar.toolbarTitle.text = title
}
private fun setEvents() {
edit_itemFk.requestFocus()
edit_itemFk.setOnEditorActionListener { v, actionId, event ->
binding.scanInput.requestFocus()
binding.scanInput.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
if (!edit_itemFk.text.toString().isNullOrEmpty()) {
shelvingLog_get(edit_itemFk.text.toString())
if (!binding.scanInput.text.toString().isNullOrEmpty()) {
shelvingLog_get(binding.scanInput.text.toString())
itemScan = edit_itemFk.text.toString()
itemScan = binding.scanInput.text.toString()
}
edit_itemFk.setText("")
(activity as MainActivity).hideKeyboard(edit_itemFk)
binding.scanInput.setText("")
(activity as MainActivity).hideKeyboard(binding.scanInput)
return@setOnEditorActionListener true
}
false
}
backButton.setOnClickListener {
binding.mainToolbar.backButton.setOnClickListener {
requireActivity().onBackPressed()
}
@ -95,7 +94,7 @@ class shelvingLogFragment(
user = prefs.getString(USER, "").toString()
password = prefs.getString(PASSWORD, "").toString()
warehouseFk = prefs.getInt(WAREHOUSEFK, 1).toString()
splash_progress.visibility = View.VISIBLE
binding.splashProgress.visibility = View.VISIBLE
viewModel.shelvingLog_get(user, password,vShelvingFK,"shelvingLog_get")
}
@ -106,10 +105,10 @@ class shelvingLogFragment(
loadShelvingLogList.observe(viewLifecycleOwner, Observer{ event ->
event.getContentIfNotHandled().notNull {
splash_progress.visibility = View.GONE
binding.splashProgress.visibility = View.GONE
adapter = ShelvingLogAdapter(it.list)
itemshelvinglog_recyclerview.adapter = adapter
itemshelvinglog_recyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
binding.itemshelvinglogRecyclerview.adapter = adapter
binding.itemshelvinglogRecyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
setToolBar(getString(R.string.shelvingLog)+":"+itemScan)
if (it.list.isEmpty()){
@ -131,10 +130,10 @@ class shelvingLogFragment(
}
})
response.observe(viewLifecycleOwner, Observer {
/* response.observe(viewLifecycleOwner, Observer {
if (it.isError){
splash_progress.visibility = View.GONE
binding.splashProgress.visibility = View.GONE
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss()
}.show()
@ -142,14 +141,14 @@ class shelvingLogFragment(
}else{
it.response.toast(requireContext())
/* customDialog.setTitle("Información").setDescription(it.response).setOkButton("Cerrar") {
customDialog.setTitle("Información").setDescription(it.response).setOkButton("Cerrar") {
customDialog.dismiss()
}.show()*/
}.show()
}
})
})*/
}

View File

@ -2,41 +2,29 @@ package es.verdnatura.presentation.view.feature.historicoshelvinglog.fragment
import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import es.verdnatura.domain.itemShelvingLogUSerCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLog
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLogList
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
import timber.log.Timber.i
class shelvingLogViewModel(context: Context) : BaseViewModel() {
private val itemShelvingLogUSerCase: itemShelvingLogUSerCase =
itemShelvingLogUSerCase(context)
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
val response: LiveData<ResponseItemVO>
get() = _response
private val _itemShelvingLogList by lazy { MutableLiveData<ShelvingLogList>() }
val itemShelvingLogList: LiveData<ShelvingLogList>
get() = _itemShelvingLogList
val loadShelvingLogList = Transformations.map(_itemShelvingLogList) { Event(it) }
fun shelvingLog_get(usuario:String,password:String,vShelvingFK: String,callFunction:String){
itemShelvingLogUSerCase.shelvingLog_get(usuario,password,vShelvingFK).enqueue(object :
Callback<List<ShelvingLog>> {
@ -59,14 +47,11 @@ class shelvingLogViewModel(context: Context) : BaseViewModel() {
if (response.body() != null)
{
i("crea la lista " + response.body())
_itemShelvingLogList.value = response.body()?.let {
ShelvingLogList(it)
}
i("finalizada la lista ${response.body()}")
}
}

View File

@ -4,7 +4,7 @@ package es.verdnatura.presentation.view.feature.historicoshelvinglog.model
class ShelvingLog(
var id:String = "",
var originFk:String = "",
var name:String = "",
var workerName:String = "",
var action:String = "",
var creationDate:String = "",
var description:String = "",

View File

@ -2,25 +2,21 @@ package es.verdnatura.presentation.view.feature.historicovehiculo.fragment
import android.content.SharedPreferences
import android.util.Log
import android.view.View
import android.view.inputmethod.EditorInfo
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
import es.verdnatura.databinding.FragmentHistoricovehiculoBinding
import es.verdnatura.domain.notNull
import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogInput
import es.verdnatura.presentation.view.feature.historicovehiculo.adapter.HistoricoVehiculoAdapter
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculoList
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import kotlinx.android.synthetic.main.activity_main.*
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_historicovehiculo.*
import kotlinx.android.synthetic.main.fragment_historicovehiculo.splash_progress
import kotlinx.android.synthetic.main.toolbar.*
import kotlinx.android.synthetic.main.toolbar.**/
import java.text.SimpleDateFormat
import java.util.*
@ -57,20 +53,17 @@ class HistoricoVehiculoFragment (
warehouseFk = prefs.getInt(WAREHOUSEFK,1).toString()
customDialogInput = CustomDialogInput(requireContext())
customDialog = CustomDialog(requireContext())
requireActivity().main_bottom_navigation.visibility = View.GONE
(activity as MainActivity).hideBottomNavigation(View.GONE)
////Log.i("VERDNATURA:","la matricula es $numberPlate")
//sergio: revisar entrypoint
viewModel.machineWorker_getHistorical(user,password,numberPlate,"machineWorker_getHistorical")
toolbar_title.text = getString(R.string.vehiclediary)
binding.mainToolbar.toolbarTitle.text = getString(R.string.vehiclediary)
setEvents()
super.init()
}
private fun setEvents(){
backButton.setOnClickListener {
binding.mainToolbar.backButton.setOnClickListener {
requireActivity().onBackPressed()
}
}
@ -79,10 +72,10 @@ class HistoricoVehiculoFragment (
with(viewModel){
loadHistoricoVehiculoList.observe(viewLifecycleOwner, Observer{ event ->
event.getContentIfNotHandled().notNull {
splash_progress.visibility = View.GONE
binding.splashProgress.visibility = View.GONE
adapter = HistoricoVehiculoAdapter(it.list)
historicovehiculo_recyclerview.adapter = adapter
historicovehiculo_recyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
binding.historicovehiculoRecyclerview.adapter = adapter
binding.historicovehiculoRecyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
navigateToToday(it)
}
@ -102,7 +95,7 @@ class HistoricoVehiculoFragment (
positionToday += 1
}
historicovehiculo_recyclerview.scrollToPosition(positionToday)
binding.historicovehiculoRecyclerview.scrollToPosition(positionToday)
}

View File

@ -1,12 +1,10 @@
package es.verdnatura.presentation.view.feature.historicovehiculo.fragment
import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetVehicleControlTimeUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculo
@ -21,8 +19,6 @@ class HistoricoVehiculoViewModel (context: Context) : BaseViewModel() {
private val _historicovehiculoList by lazy { MutableLiveData<ItemHistoricoVehiculoList>() }
val historicovehiculoList: LiveData<ItemHistoricoVehiculoList>
get() = _historicovehiculoList
val loadHistoricoVehiculoList = Transformations.map(_historicovehiculoList) { Event(it) }

View File

@ -4,9 +4,6 @@ import es.verdnatura.R
import es.verdnatura.databinding.ActivityImageviewBinding
import es.verdnatura.presentation.base.BaseActivity
import es.verdnatura.presentation.common.loadUrl
import kotlinx.android.synthetic.main.activity_imageview.*
import kotlinx.android.synthetic.main.toolbar.*
class ImageViewActivity : BaseActivity<ActivityImageviewBinding>(){
@ -14,10 +11,10 @@ class ImageViewActivity : BaseActivity<ActivityImageviewBinding>(){
override fun init() {
toolbar_title.text = (intent.getStringExtra("title"))
imgView.loadUrl(intent.getStringExtra("url"))
binding.mainToolbar.toolbarTitle.text = (intent.getStringExtra("title"))
binding.imgView.loadUrl(intent.getStringExtra("url"))
backButton.setOnClickListener {
binding.mainToolbar.backButton.setOnClickListener {
onBackPressed()
}
}

View File

@ -19,16 +19,17 @@ import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
import es.verdnatura.presentation.view.feature.inventario.adapter.InventoryAdapter
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import ir.mirrajabi.searchdialog.SimpleSearchDialogCompat
import ir.mirrajabi.searchdialog.core.SearchResultListener
import kotlinx.android.synthetic.main.activity_main.*
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.buyers_fragment.*
import kotlinx.android.synthetic.main.fragment_ajustes.*
import kotlinx.android.synthetic.main.fragment_buscar_item.location_recyclerview
import kotlinx.android.synthetic.main.fragment_buscar_item.splash_progress
import kotlinx.android.synthetic.main.fragment_buscar_item.binding.splashProgress
import kotlinx.android.synthetic.main.fragment_inventary.*
import kotlinx.android.synthetic.main.fragment_inventary.filter_itemFk
import kotlinx.android.synthetic.main.toolbar.*
import kotlinx.android.synthetic.main.fragment_inventary.binding.filterItemFk
import kotlinx.android.synthetic.main.toolbar.**/
class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewModel>(InventaryViewModel::class) {
@ -59,8 +60,6 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
fun newInstance() = InventaryFragment()
}
//override fun getLayoutId(): Int = R.layout.fragment_inventary
override fun getLayoutId(): Int = R.layout.fragment_inventary
override fun onAttach(context: Context) {
@ -83,24 +82,22 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
override fun init() {
filter_buyer.setText(prefs!!.getString(BUYER,""))
splash_progress.visibility = View.VISIBLE
binding.filterBuyer.setText(prefs!!.getString(BUYER,""))
binding.splashProgress.visibility = View.VISIBLE
buyerId=prefs!!.getString(BUYERID,"").toString()
////Log.i("VERDNATURA:","el sector es $warehouseFk")
////Log.i("VERDNATURA:","el sbuyerid es $buyerId")
viewModel.getInventory(user,password,buyerId,warehouseFk,"itemShelving_filterBuyer")
filter_buyer.setOnClickListener{
binding.filterBuyer.setOnClickListener{
//SimpleSearchDialogCompat(context,getString(R.string.compradores),getString(R.string.escribirparteNombre),null,initData(),
SimpleSearchDialogCompat(context,getString(R.string.compradores),getString(R.string.escribirparteNombre),null,items,
SearchResultListener { baseSearchDialogCompat, nombre, position ->
//////Log.i("VERDNATURA:","nombre "+nombre.title)
//////Log.i("VERDNATURA:","el id es "+nombre.getBuyerId())
filter_buyer.setText((nombre.title))
binding.filterBuyer.setText((nombre.title))
saveBuyer(nombre.getBuyerNickname())
saveBuyerId(nombre.getBuyerId())
buyerId=nombre.getBuyerId()
viewModel.getInventory(user,password,nombre.getBuyerId(),warehouseFk,"itemShelving_filterBuyer")
splash_progress.visibility = View.VISIBLE
binding.splashProgress.visibility = View.VISIBLE
baseSearchDialogCompat.dismiss()
}).show()
}
@ -108,15 +105,15 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
customDialogInput = CustomDialogInput(requireContext())
customDialog = CustomDialog(requireContext())
requireActivity().main_bottom_navigation.visibility = View.GONE
splash_progress.visibility = View.VISIBLE
toolbar_title.text = getString(R.string.itemShelvingRadar)
(activity as MainActivity).hideBottomNavigation(View.GONE)
binding.splashProgress.visibility = View.VISIBLE
binding.mainToolbar.toolbarTitle.text = getString(R.string.itemShelvingRadar)
setToolBar()
setEvents()
if (reload){
reload = false
splash_progress.visibility = View.VISIBLE
binding.splashProgress.visibility = View.VISIBLE
hideLoad = false
viewModel.getInventory(user,password,buyerId,warehouseFk,"itemShelving_filterBuyer")
}
@ -133,30 +130,29 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
listIcons.add(iconReload)
toolbar_icons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener{
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener{
override fun onOptionsItemSelected(item: Drawable) {
if (item == iconReload){
splash_progress.visibility = View.VISIBLE
binding.splashProgress.visibility = View.VISIBLE
firstVisiblePosition = layoutManager?.findFirstVisibleItemPosition() ?: 0
// sergio.
viewModel.getInventory(user,password,buyerId,warehouseFk,"itemShelving_filterBuyer")
//viewModel.getInventory(user,password,prefs!!.getInt(SECTORFK,1).toString())
}
}
})
toolbar_icons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
binding.mainToolbar.toolbarIcons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
}
private fun setEvents(){
backButton.setOnClickListener {
binding.mainToolbar.backButton.setOnClickListener {
requireActivity().onBackPressed()
}
filter_itemFk.setOnKeyListener { v, keyCode, event ->
if (filter_itemFk.text.toString().isNullOrEmpty()){
binding.filterItemFk.setOnKeyListener { v, keyCode, event ->
if (binding.filterItemFk.text.toString().isNullOrEmpty()){
if (listInvetory.size != listInvetoryAux.size){
listInvetory.removeAll(listInvetoryAux)
listInvetoryAux.forEach {
@ -168,7 +164,7 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
}else{
listInvetory.removeAll(listInvetoryAux)
listInvetoryAux.forEach {
if ((it.itemFk.contains(filter_itemFk.text.toString(),true)) || (it.producer.contains(filter_itemFk.text.toString(),true))){
if ((it.itemFk.contains(binding.filterItemFk.text.toString(),true)) || (it.producer.contains(binding.filterItemFk.text.toString(),true))){
listInvetory.add(it)
}
}
@ -188,9 +184,9 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
override fun onResume() {
super.onResume()
if (location_recyclerview.layoutManager != null){
if (binding.locationRecyclerview.layoutManager != null){
if (firstVisiblePosition <= listInvetory.size){
location_recyclerview.layoutManager!!.scrollToPosition(firstVisiblePosition)
binding.locationRecyclerview.layoutManager!!.scrollToPosition(firstVisiblePosition)
}
}
}
@ -200,14 +196,14 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
//sergio: para compradores
buyersList.observe(viewLifecycleOwner, Observer {
splash_progress.visibility = View.GONE
binding.splashProgress.visibility = View.GONE
createBuyerList(it.list)
})
inventaryList.observe(viewLifecycleOwner, Observer {
if (hideLoad){
splash_progress.visibility = View.GONE
binding.splashProgress.visibility = View.GONE
}else{
hideLoad = true
}
@ -237,32 +233,15 @@ class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewMod
// customDialogInput.dismiss()
customDialog.dismiss()
}.show()
// }.setValue("0").show()
//sergio: ya no recoge focus porque no tiene cuadro para insertar número de artículo
/* customDialogInput.getEditText().requestFocus()
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
if (!customDialogInput.getValue().isNullOrEmpty()){
////Log.i("VERDNATURA:","A tirar tanto viewmodel fuera")
viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,customDialogInput.getValue(),"0")
changeOfflineValue(item)
}
customDialogInput.setValue("")
customDialogInput.dismiss()
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
return@setOnEditorActionListener true
}
false
}*/
}
},onPasillerosItemClickListener = pasillerosItemClickListener!!)
location_recyclerview.adapter = adapter
binding.locationRecyclerview.adapter = adapter
layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
location_recyclerview.layoutManager = layoutManager
binding.locationRecyclerview.layoutManager = layoutManager
if (firstVisiblePosition <= listInvetory.size){
location_recyclerview.layoutManager!!.scrollToPosition(firstVisiblePosition)
binding.locationRecyclerview.layoutManager!!.scrollToPosition(firstVisiblePosition)
}

View File

@ -1,5 +1,9 @@
package es.verdnatura.presentation.view.feature.login.fragment
//import android.preference.PreferenceManager
/*import kotlinx.android.synthetic.main.fragment_ajustes.*
import kotlinx.android.synthetic.main.fragment_login.*
import kotlinx.android.synthetic.main.fragment_login.binding.splashProgress*/
import android.app.AlarmManager
import android.app.PendingIntent
import android.content.Context
@ -8,26 +12,19 @@ import android.content.SharedPreferences
import android.content.pm.PackageInfo
import android.content.pm.PackageManager
import android.net.Uri
//import android.preference.PreferenceManager
import androidx.preference.PreferenceManager
import android.provider.Settings
import android.view.KeyEvent
import android.view.View
import androidx.lifecycle.Observer
import android.provider.Settings
import android.util.Log
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.LoginDevice
import es.verdnatura.presentation.view.feature.login.model.LoginItemVO
import es.verdnatura.presentation.view.feature.login.model.workerId
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import kotlinx.android.synthetic.main.fragment_ajustes.*
import kotlinx.android.synthetic.main.fragment_login.*
import kotlinx.android.synthetic.main.fragment_login.splash_progress
import java.lang.Boolean.TRUE
class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginViewModel::class) {
@ -45,36 +42,36 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
customDialog = CustomDialog(requireContext())
saveIdentifiers()
checkUser()
button_login.setOnClickListener(View.OnClickListener {
splash_progress.visibility = View.VISIBLE
binding.buttonLogin.setOnClickListener(View.OnClickListener {
binding.splashProgress.visibility = View.VISIBLE
// Log.i(TD,"el imei pasado al login es ${getANDROIDID()}")
/* viewModel.login(
edittext_username.text.toString(),
edittext_password.text.toString(),
binding.edittextUsername.text.toString(),
binding.edittextPassword.text.toString(),
getANDROIDID()
)*/
viewModel.device_checkLogin(
edittext_username.text.toString(),
edittext_password.text.toString(),
binding.edittextUsername.text.toString(),
binding.edittextPassword.text.toString(),
getANDROIDID(),callFunction = "device_checkLogin"
)
})
textview_remember_password.setOnClickListener {
edittext_username.setText("")
edittext_password.setText("")
switch_remember.isChecked = false
binding.textviewRememberPassword.setOnClickListener {
binding.edittextUsername.setText("")
binding.edittextPassword.setText("")
binding.switchRemember.isChecked = false
saveRemember(false)
}
edittext_server.setText(this.getDefaults("base_url", this.requireContext()))
edittext_server.setOnKeyListener(View.OnKeyListener { v, keyCode, event ->
binding.edittextServer.setText(this.getDefaults("base_url", this.requireContext()))
binding.edittextServer.setOnKeyListener(View.OnKeyListener { v, keyCode, event ->
if (keyCode == KeyEvent.KEYCODE_ENTER && event.action == KeyEvent.ACTION_UP) {
this.setDefaults("base_url", edittext_server.text.toString(), this.requireContext())
this.setDefaults("base_url", binding.edittextServer.text.toString(), this.requireContext())
this.hideKeyboard()
//sergio: deberia lanzar la funcion nueva creada por mi restartapp de BaseFragment. Pero no vuelve a arrancar
restartapp()
@ -85,8 +82,8 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
})
textview_welcome.setOnLongClickListener {
edittext_server.isEnabled = TRUE
binding.textviewWelcome.setOnLongClickListener {
binding.edittextServer.isEnabled = TRUE
true
}
@ -114,10 +111,10 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
private fun checkUser() {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
if (prefs.getBoolean(RECORDAR, false)) {
edittext_username.setText(prefs.getString(USER, ""))
edittext_password.setText(prefs.getString(PASSWORD, ""))
if (edittext_password.text.toString().isNotEmpty()) {
switch_remember.isChecked = true
binding.edittextUsername.setText(prefs.getString(USER, ""))
binding.edittextPassword.setText(prefs.getString(PASSWORD, ""))
if (binding.edittextPassword.text.toString().isNotEmpty()) {
binding.switchRemember.isChecked = true
}
}
@ -127,16 +124,16 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
with(viewModel) {
versionappitem.observe(viewLifecycleOwner, Observer {
splash_progress.visibility = View.INVISIBLE
binding.splashProgress.visibility = View.INVISIBLE
if (it.isError) {
customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
} else {
splash_progress.visibility = View.VISIBLE
binding.splashProgress.visibility = View.VISIBLE
if (it.version.equals(getInfoVersionNameApp())) {
splash_progress.visibility = View.INVISIBLE
binding.splashProgress.visibility = View.INVISIBLE
goToMain()
} else {
@ -168,16 +165,16 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
})
logindevice.observe(viewLifecycleOwner, Observer {
splash_progress.visibility = View.INVISIBLE
binding.splashProgress.visibility = View.INVISIBLE
if (it.isError) {
customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
} else {
splash_progress.visibility = View.VISIBLE
binding.splashProgress.visibility = View.VISIBLE
if (it.vIsAuthorized.equals("0")) {
splash_progress.visibility = View.INVISIBLE
binding.splashProgress.visibility = View.INVISIBLE
// Log.i("VERDNATURA:",it.vMessage)
customDialog.setTitle("Error").setDescription(it.vMessage!!)
@ -189,38 +186,38 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
} else {
//sergio: se añade el log
viewModel.worker_getId(
edittext_username.text.toString(),
edittext_password.text.toString(),
binding.edittextUsername.text.toString(),
binding.edittextPassword.text.toString(),
callFunction = "worker_getId"
)
deviceLog_add(
edittext_username.text.toString(),
edittext_password.text.toString(),
binding.edittextUsername.text.toString(),
binding.edittextPassword.text.toString(),
"warehouse",
getInfoVersionNameApp(),
getANDROIDID(),"deviceLog_add"
)
splash_progress.visibility = View.INVISIBLE
binding.splashProgress.visibility = View.INVISIBLE
//saveUserFkPref(it)
if (switch_remember.isChecked) {
if (binding.switchRemember.isChecked) {
saveRemember(true)
} else {
saveRemember(false)
}
saveUserAccesPref(
edittext_username.text.toString(),
edittext_password.text.toString()
binding.edittextUsername.text.toString(),
binding.edittextPassword.text.toString()
)
if (it.vIsAuthorized.equals("1") && it.vMessage.isNullOrEmpty()) {
// Log.i("VERDNATURA", "Sin mensaje")
splash_progress.visibility = View.VISIBLE
binding.splashProgress.visibility = View.VISIBLE
loginSalix(
user = edittext_username.text.toString(),
password = edittext_password.text.toString(),
user = binding.edittextUsername.text.toString(),
password = binding.edittextPassword.text.toString(),
callFunction = "login de Salix"
)
@ -230,10 +227,10 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
customDialog.setTitle("Mensaje").setDescription(it.vMessage)
.setOkButton("Cerrar") {
customDialog.dismiss()
splash_progress.visibility = View.VISIBLE
binding.splashProgress.visibility = View.VISIBLE
loginSalix(
user = edittext_username.text.toString(),
password = edittext_password.text.toString(),"login de Salix"
user = binding.edittextUsername.text.toString(),
password = binding.edittextPassword.text.toString(),"login de Salix"
)
}.show()
@ -248,7 +245,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
workerId.observe(viewLifecycleOwner, Observer {
splash_progress.visibility = View.INVISIBLE
binding.splashProgress.visibility = View.INVISIBLE
if (!it.isError) {
saveUserFkPref(it.Id.toString())
}
@ -263,29 +260,29 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
})
loginitem.observe(viewLifecycleOwner, Observer {
splash_progress.visibility = View.INVISIBLE
binding.splashProgress.visibility = View.INVISIBLE
if (it.isError) {
customDialog.setTitle("Error").setDescription(it.errorMessage)
.setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
} else {
splash_progress.visibility = View.VISIBLE
binding.splashProgress.visibility = View.VISIBLE
saveUserFkPref(it)
if (switch_remember.isChecked) {
if (binding.switchRemember.isChecked) {
saveRemember(true)
} else {
saveRemember(false)
}
saveUserAccesPref(
edittext_username.text.toString(),
edittext_password.text.toString()
binding.edittextUsername.text.toString(),
binding.edittextPassword.text.toString()
)
loginSalix(
user = edittext_username.text.toString(),
password = edittext_password.text.toString(),
user = binding.edittextUsername.text.toString(),
password = binding.edittextPassword.text.toString(),
callFunction = "login de Salix"
)
}
@ -293,7 +290,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
})
devicelogresponse.observe(viewLifecycleOwner, Observer {
splash_progress.visibility = View.INVISIBLE
binding.splashProgress.visibility = View.INVISIBLE
if (it.isError) {
customDialog.setTitle("Error")
.setDescription(it.errorMessage)
@ -309,7 +306,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
})
loginsalixitem.observe(viewLifecycleOwner, Observer {
splash_progress.visibility = View.INVISIBLE
binding.splashProgress.visibility = View.INVISIBLE
if (it.isError) {
saveTokenPref("")
customDialog.setTitle("Error")
@ -327,7 +324,7 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
})
version.observe(viewLifecycleOwner, Observer {
splash_progress.visibility = View.INVISIBLE
binding.splashProgress.visibility = View.INVISIBLE
if (it) {
/* customDialog.setTitle("Atención").setDescription("La aplicación se encuentra en fase de desarrollo. Algunas funcionalidades están desactivadas y se van a ir añadiendo de forma progresiva.").setOkButton("Entrar"){
goToMain()
@ -402,15 +399,15 @@ class LoginFragment : BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginVi
private fun goToMain() {
val intent = Intent(activity, MainActivity::class.java)
startActivity(intent)
//splash_progress.visibility=View.GONE
//binding.splashProgress.visibility=View.GONE
requireActivity().finish()
}
private fun getVersion() {
splash_progress.visibility = View.VISIBLE
binding.splashProgress.visibility = View.VISIBLE
viewModel.checkVersion(
user = edittext_username.text.toString(),
password = edittext_password.text.toString(),
user = binding.edittextUsername.text.toString(),
password = binding.edittextPassword.text.toString(),
nameApp = "warehouse","getVersion"
)

View File

@ -28,7 +28,7 @@ import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlV
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoUsuarioFragment
import es.verdnatura.presentation.view.feature.diadeventa.fragment.DayOfSaleFragment
import es.verdnatura.presentation.view.feature.faltas.fragment.FaltasFragment
import es.verdnatura.presentation.view.feature.historico.fragment.HistoricoFragment
import es.verdnatura.presentation.view.feature.historicoarticulo.fragment.HistoricoArticuloFragment
import es.verdnatura.presentation.view.feature.historicoshelving.fragment.itemShelvingLogFragment
import es.verdnatura.presentation.view.feature.historicoshelvinglog.fragment.shelvingLogFragment
import es.verdnatura.presentation.view.feature.historicovehiculo.fragment.HistoricoVehiculoFragment
@ -354,7 +354,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
// }
"Historico" -> {
addFragmentOnTop(HistoricoFragment.newInstance(entryPoint))
addFragmentOnTop(HistoricoArticuloFragment.newInstance(entryPoint))
}
//segio: esta opción no se muestra, solo es accesible para añadir fragmentos de otras partes.
"Historico Vehículo" -> {

View File

@ -1,6 +1,7 @@
package es.verdnatura.presentation.view.feature.parking.fragment
import android.annotation.SuppressLint
/*import kotlinx.android.synthetic.main.fragment_parking.*
import kotlinx.android.synthetic.main.toolbar.**/
import android.content.SharedPreferences
import android.media.MediaPlayer
import android.os.Bundle
@ -17,9 +18,6 @@ import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.parking.adapter.ParkingAdapter
import kotlinx.android.synthetic.main.fragment_parking.*
import kotlinx.android.synthetic.main.toolbar.*
import timber.log.Timber
class ParkingFragment : BaseFragment<FragmentParkingBinding,ParkingViewModel>(ParkingViewModel::class) {
@ -43,30 +41,30 @@ class ParkingFragment : BaseFragment<FragmentParkingBinding,ParkingViewModel>(Pa
override fun init() {
setEvents()
toolbar_title.text = "Parking"
binding.mainToolbar.toolbarTitle.text = getString(R.string.Parking)
//sergio: después de las últimas actualizaciones se queda activo. Se cambia opción visibilidad.
//viewModel.hideProgressLoading()
splash_progress.visibility=View.GONE
binding.splashProgress.visibility=View.GONE
setList()
customDialog = CustomDialog(requireContext())
super.init()
}
private fun setEvents(){
scan_input.requestFocus()
scan_input.setOnEditorActionListener { v, actionId, event ->
binding.scanInput.requestFocus()
binding.scanInput.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
if (!scan_input.text.isNullOrEmpty()) {
checkScan(scan_input.text.toString())
if (!binding.scanInput.text.isNullOrEmpty()) {
checkScan(binding.scanInput.text.toString())
}
scan_input.setText("")
binding.scanInput.setText("")
requireActivity().hideKeyboard()
return@setOnEditorActionListener true
}
false
}
backButton.setOnClickListener {
binding.mainToolbar.backButton.setOnClickListener {
requireActivity().onBackPressed()
}
}
@ -76,20 +74,37 @@ class ParkingFragment : BaseFragment<FragmentParkingBinding,ParkingViewModel>(Pa
response.observe(viewLifecycleOwner, Observer {
if (it.isError){
mperror?.start()
splash_progress.visibility = View.GONE
// binding.splashProgress.visibility = View.GONE
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.dismiss()
}.show()
}else{
numParking -= 1
if (numParking <= 0) {
splash_progress.visibility = View.GONE
viewModel.hideProgressLoading()
// binding.splashProgress.visibility = View.GONE
//viewModel.hideProgressLoading()
mpok?.start()
setList()
}
}
})
isLoading.observe(viewLifecycleOwner, Observer {
if (it){
binding.splashProgress.visibility = View.VISIBLE
}else{
binding.splashProgress.visibility = View.GONE
}
})
isLoadingProgress.observe(viewLifecycleOwner, {
binding.splashProgress.visibility = it
})
}
}
@ -103,8 +118,8 @@ class ParkingFragment : BaseFragment<FragmentParkingBinding,ParkingViewModel>(Pa
})
val lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
fragment_parking_scan_list.adapter = adapter
fragment_parking_scan_list.layoutManager = lm
binding.fragmentParkingScanList.adapter = adapter
binding.fragmentParkingScanList.layoutManager = lm
}
private fun checkScan(txtScan:String){
@ -116,7 +131,7 @@ class ParkingFragment : BaseFragment<FragmentParkingBinding,ParkingViewModel>(Pa
if (isParking){
numParking = scanerList.size
scanerList.forEach {
splash_progress.visibility = View.VISIBLE
// binding.splashProgress.visibility = View.VSIIBLE
viewModel.parking(
usuario = user,
password = password,

View File

@ -1,6 +1,8 @@
package es.verdnatura.presentation.view.feature.parking.fragment
import android.content.Context
import android.view.View.GONE
import android.view.View.VISIBLE
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.GetUbicadorUserCase
@ -22,6 +24,9 @@ class ParkingViewModel(context: Context) : BaseViewModel() {
private val _isLoading by lazy { MutableLiveData<Boolean>() }
val isLoading: LiveData<Boolean> = _isLoading
private val _isLoadingProgress by lazy { MutableLiveData<Int>() }
val isLoadingProgress: LiveData<Int> = _isLoadingProgress
private fun showProgressLoading() {
_isLoading.value = true
}
@ -29,10 +34,12 @@ class ParkingViewModel(context: Context) : BaseViewModel() {
fun hideProgressLoading() {
_isLoading.value = false
}
fun ProgressLoading(visibility:Int) {
_isLoadingProgress.value = visibility
}
fun parking(usuario: String,password: String,scanItem: String,parking:String,callFunction:String){
showProgressLoading()
ProgressLoading(VISIBLE)
getUbicadorUserCase.shelvingPark(usuario,password,scanItem,parking).enqueue(object :
Callback<String> {
override fun onFailure(call: Call<String>, t: Throwable) {
@ -40,6 +47,7 @@ class ParkingViewModel(context: Context) : BaseViewModel() {
}
override fun onResponse(call: Call<String>, response: Response<String>) {
ProgressLoading(GONE)
if (response.body() == null){
_response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
}else{

View File

@ -8,10 +8,11 @@ import es.verdnatura.R
import es.verdnatura.databinding.FragmentPasilleroBinding
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.pasillero.adapter.PasillerosAdapter
import kotlinx.android.synthetic.main.activity_main.*
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_pasillero.*
import kotlinx.android.synthetic.main.toolbar.*
import kotlinx.android.synthetic.main.toolbar.**/
class PasilleroFragment(
var tagName: String = ""
@ -31,10 +32,9 @@ class PasilleroFragment(
override fun getLayoutId(): Int = R.layout.fragment_pasillero
override fun init() {
requireActivity().main_bottom_navigation.visibility = View.VISIBLE
// toolbar_title.text = "Paletizadores"
toolbar_title.text = tagName
backButton.visibility = View.GONE
(activity as MainActivity).hideBottomNavigation(View.VISIBLE)
binding.mainToolbar.toolbarTitle.text = tagName
binding.mainToolbar.backButton.visibility = View.GONE
super.init()
}
@ -59,9 +59,8 @@ class PasilleroFragment(
override fun observeViewModel() {
with(viewModel) {
pasilleros_items.adapter =
PasillerosAdapter(pasillerositem, pasillerosItemClickListener!!)
pasilleros_items.layoutManager =
binding.pasillerosItems.adapter= PasillerosAdapter(pasillerositem, pasillerosItemClickListener!!)
binding.pasillerosItems.layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
}

View File

@ -30,7 +30,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
*/
/* _pasillerositem.add(
_pasillerositem.add(
PasillerosItemVO(7,
R.drawable.ic_streetview_black_24dp,
"Pre Control",R.string.precontrolprevious)
@ -40,7 +40,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(7,
R.drawable.ic_history_orange_24dp,
"Log Shelving",R.string.shelvingLog)
)*/
)
//sergio para que aparezca el nuevo menu

View File

@ -15,8 +15,8 @@ import es.verdnatura.presentation.common.OnCollectionSelectedListener
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
import kotlinx.android.synthetic.main.fragment_controlador.*
import kotlinx.android.synthetic.main.toolbar.*
/*import kotlinx.android.synthetic.main.fragment_controlador.*
import kotlinx.android.synthetic.main.toolbar.**/
class PreControladorFragment: BaseFragment<FragmentControladorBinding,PreControladorViewModel>(PreControladorViewModel::class) {
@ -44,9 +44,9 @@ class PreControladorFragment: BaseFragment<FragmentControladorBinding,PreControl
override fun init() {
splash_progress.visibility = View.GONE
binding.splashProgress.visibility = View.GONE
customDialog = CustomDialog(requireContext())
toolbar_title.text = getString(R.string.verticket)
binding.mainToolbar.toolbarTitle.text = getString(R.string.verticket)
setEvents()
super.init()
}
@ -68,29 +68,29 @@ class PreControladorFragment: BaseFragment<FragmentControladorBinding,PreControl
private fun setEvents(){
backButton.setOnClickListener {
binding.mainToolbar.backButton.setOnClickListener {
requireActivity().onBackPressed()
}
scan_input.requestFocus()
scan_input.setOnEditorActionListener { v, actionId, event ->
binding.scanInput.requestFocus()
binding.scanInput.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
goBack=false;
if (!scan_input.text.isNullOrEmpty()) {
splash_progress.visibility = View.VISIBLE
if (!binding.scanInput.text.isNullOrEmpty()) {
binding.splashProgress.visibility = View.VISIBLE
////Log.i("VERDNATURA:","lanzamos desde precontrol")
// viewModel.collection_getTickets(
viewModel.collectionTicketGet(
usuario = user,
password = password,
sectorFk = sectorFk,
collectionFk = scan_input.text.toString(),
collectionFk = binding.scanInput.text.toString(),
type = type,callFunction = "collection_getTickets"
)
// //Log.i("VERDNATURA:","La collection es ${scan_input.text.toString()}")
// //Log.i("VERDNATURA:","La collection es ${binding.scanInput.text.toString()}")
}
scan_input.setText("")
(activity as MainActivity).hideKeyboard(scan_input)
binding.scanInput.setText("")
(activity as MainActivity).hideKeyboard(binding.scanInput)
return@setOnEditorActionListener true
}
false
@ -100,7 +100,7 @@ class PreControladorFragment: BaseFragment<FragmentControladorBinding,PreControl
override fun observeViewModel() {
with(viewModel){
collectionTicketList.observe(viewLifecycleOwner, Observer {
splash_progress.visibility = View.GONE
binding.splashProgress.visibility = View.GONE
if (it.isError){
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Aceptar"){
customDialog.dismiss()

View File

@ -1,14 +1,8 @@
package es.verdnatura.presentation.view.feature.qr
import android.annotation.SuppressLint
import android.content.SharedPreferences
import android.graphics.Typeface
import android.inputmethodservice.Keyboard
import android.os.Bundle
import android.text.InputType
import android.util.Log
import android.view.KeyEvent
import android.view.KeyEvent.*
import android.view.View
import android.view.inputmethod.EditorInfo
@ -19,8 +13,9 @@ import es.verdnatura.domain.ConstAndValues
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import kotlinx.android.synthetic.main.fragment_controlador.*
import kotlinx.android.synthetic.main.toolbar.*
/*import kotlinx.android.synthetic.main.fragment_controlador.*
import kotlinx.android.synthetic.main.toolbar.**/
class QrFragment(
var entryPoint: String = ""
@ -43,14 +38,14 @@ class QrFragment(
override fun init() {
splash_progress.visibility = View.GONE
binding.splashProgress.visibility = View.GONE
customDialog = CustomDialog(requireContext())
customDialog.setTitle("Mensaje")
.setDescription("Operación " )
.setOkButton("Aceptar") {
customDialog.dismiss()
backButton.performClick()
binding.mainToolbar.backButton.performClick()
}.show()
setToolbar()
@ -60,7 +55,7 @@ class QrFragment(
private fun setToolbar() {
toolbar_title.text = entryPoint
binding.mainToolbar.toolbarTitle.text = entryPoint
}
override fun onPause() {
@ -81,27 +76,27 @@ class QrFragment(
private fun setEvents() {
backButton.setOnClickListener {
binding.mainToolbar.backButton.setOnClickListener {
requireActivity().onBackPressed()
}
scan_input.requestFocus()
scan_input.setOnEditorActionListener { v, actionId, event ->
binding.scanInput.requestFocus()
binding.scanInput.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
goBack = false
if (!scan_input.text.isNullOrEmpty()) {
splash_progress.visibility = View.VISIBLE
viewModel.qr_getCall(user, password, scan_input.text.toString(),"qr_getCall")
itemscaned = scan_input.text.toString()
if (!binding.scanInput.text.isNullOrEmpty()) {
binding.splashProgress.visibility = View.VISIBLE
viewModel.qr_getCall(user, password, binding.scanInput.text.toString(),"qr_getCall")
itemscaned = binding.scanInput.text.toString()
}
}
scan_input.setText("")
(activity as MainActivity).hideKeyboard(scan_input)
binding.scanInput.setText("")
(activity as MainActivity).hideKeyboard(binding.scanInput)
return@setOnEditorActionListener true
}
//false
@ -115,7 +110,7 @@ class QrFragment(
with(viewModel) {
qrresponse.observe(viewLifecycleOwner, Observer {
splash_progress.visibility = View.GONE
binding.splashProgress.visibility = View.GONE
if (it.isError) {
// getMessageFromJSON(it.errorMessage)
@ -129,7 +124,7 @@ class QrFragment(
.setDescription("Operación " + itemscaned + ". " + it.response)
.setOkButton("Aceptar") {
customDialog.dismiss()
backButton.performClick()
binding.mainToolbar.backButton.performClick()
}.show()
}

View File

@ -28,9 +28,9 @@ import es.verdnatura.presentation.view.feature.presacador.model.PreSacadorItemVO
import es.verdnatura.presentation.view.feature.reposicion.adapter.ReposicionAdapter
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyListVO
import es.verdnatura.presentation.view.feature.sacador.model.SaleVO
import kotlinx.android.synthetic.main.activity_main.*
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.reposicion_fragment.*
import kotlinx.android.synthetic.main.toolbar.*
import kotlinx.android.synthetic.main.toolbar.**/
class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionViewModel>(
ReposicionViewModel::class){
@ -81,9 +81,10 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
customDialogList = CustomDialogList(requireContext())
customDialogInput = CustomDialogInput(requireContext())
customDialogThreeButtons = CustomDialogThreeButtons(requireContext())
requireActivity().main_bottom_navigation.visibility = View.GONE
splash_progress.visibility = View.GONE
toolbar_title.text = getString(R.string.itemPlacementSupplyGetOrder)
//requireActivity().main_bottom_navigation.visibility = View.GONE
(activity as MainActivity).hideBottomNavigation(View.GONE)
binding.splashProgress.visibility = View.GONE
binding.mainToolbar.toolbarTitle.text = getString(R.string.itemPlacementSupplyGetOrder)
setToolBar()
setEvents()
super.init()
@ -110,22 +111,22 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
private fun setEvents(){
backButton.setOnClickListener {
binding.mainToolbar.backButton.setOnClickListener {
requireActivity().onBackPressed()
}
btn_obtener.setOnClickListener {
splash_progress.visibility = View.VISIBLE
binding.btnObtener.setOnClickListener {
binding.splashProgress.visibility = View.VISIBLE
viewModel.itemPlacementSupplyGetOrder(usuario = user,password = password,sectorFk = sectorFk,"itemPlacementSupplyGetOrder")
}
btn_cancelar.setOnClickListener {
binding.btnCancelar.setOnClickListener {
customDialog.setTitle("Confirmar").setDescription("¿Estás seguro de cerrar el pedido?").setKoButton("Cerrar"){
scanRequest()
customDialog.dismiss()
}.setOkButton("Cerrar"){
splash_progress.visibility = View.VISIBLE
binding.splashProgress.visibility = View.VISIBLE
if (sales.count() > 0){
viewModel.itemPlacementSupplyCloseOrder(usuario = user,password = password,id = sales[0].id,quantity = sales[0].quantity.toString(),"itemPlacementSupplyCloseOrder")
}
@ -139,20 +140,20 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
//ESCANER =========
hideKeyboards()
scan_input.requestFocus()
scan_input.setOnEditorActionListener { v, actionId, event ->
binding.scanInput.requestFocus()
binding.scanInput.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
if (!scan_input.text.toString().isNullOrEmpty()){
if (!binding.scanInput.text.toString().isNullOrEmpty()){
if (sales.count() > 0 && sales[0].saldo == 0){
"Pedido completado".toast(requireContext())
}else{
findSale(scan_input.text.toString())
findSale(binding.scanInput.text.toString())
}
}
scan_input.setText("")
binding.scanInput.setText("")
hideKeyboards()
return@setOnEditorActionListener true
}
@ -163,10 +164,10 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
//LISTA =========
collection_swipe.setOnRefreshListener {
splash_progress.visibility = View.VISIBLE
binding.collectionSwipe.setOnRefreshListener {
binding.splashProgress.visibility = View.VISIBLE
viewModel.itemPlacementSupplyGetOrder(usuario = user,password = password,sectorFk = sectorFk,"itemPlacementSupplyGetOrder")
collection_swipe.isRefreshing = false
binding.collectionSwipe.isRefreshing = false
}
}
@ -178,18 +179,18 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
override fun observeViewModel() {
with(viewModel){
salesList.observe(viewLifecycleOwner, Observer {
splash_progress.visibility = View.GONE
binding.splashProgress.visibility = View.GONE
createSaleList(it)
})
placementSuppleyList.observe(viewLifecycleOwner, Observer {
splash_progress.visibility = View.GONE
binding.splashProgress.visibility = View.GONE
if (!goBack) printShelvingResult(it)
goBack = false
})
responseCode.observe(viewLifecycleOwner, Observer {
splash_progress.visibility = View.GONE
binding.splashProgress.visibility = View.GONE
if (!goBack2){
if (it.isError){
customDialog.setTitle("Error").setDescription(it.errorMessage).setKoButton("Cerrar"){
@ -216,10 +217,10 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
})
responseClose.observe(viewLifecycleOwner, Observer {
splash_progress.visibility = View.GONE
binding.splashProgress.visibility = View.GONE
sales.clear()
saleAdapter!!.notifyDataSetChanged()
btn_cancelar.visibility = View.GONE
binding.btnCancelar.visibility = View.GONE
})
}
@ -228,7 +229,7 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
}
private fun createSaleList(salesList : List<PreSacadorItemVO>){
splash_progress.visibility = View.GONE
binding.splashProgress.visibility = View.GONE
if (salesList.isNullOrEmpty()){
customDialog.setTitle("Reposición").setDescription("No existen pedidos para reponer").setKoButton("Cancelar"){
if (sales.count()>0){
@ -237,16 +238,16 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
}
customDialog.dismiss()
}.show()
scan_input.visibility = View.GONE
btn_cancelar.visibility = View.GONE
binding.scanInput.visibility = View.GONE
binding.btnCancelar.visibility = View.GONE
}else if(salesList.count() > 0 && salesList[0].saldo == 0){
"Pedido completado".toast(requireContext())
scan_input.visibility = View.GONE
btn_cancelar.visibility = View.GONE
binding.scanInput.visibility = View.GONE
binding.btnCancelar.visibility = View.GONE
}else{
scan_input.visibility = View.VISIBLE
btn_cancelar.visibility = View.VISIBLE
binding.scanInput.visibility = View.VISIBLE
binding.btnCancelar.visibility = View.VISIBLE
sales = ArrayList()
salesList.forEach {
@ -268,8 +269,8 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
}
}
})
fragment_sacador_collections.adapter = saleAdapter
fragment_sacador_collections.layoutManager = lm
binding.fragmentSacadorCollections.adapter = saleAdapter
binding.fragmentSacadorCollections.layoutManager = lm
}
}
@ -342,7 +343,7 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
private fun showShelving(position:Int,shelvingPosition:Int){
storedShelvingPosition = shelvingPosition
storedPosition = position
splash_progress.visibility = View.VISIBLE
binding.splashProgress.visibility = View.VISIBLE
var quantityGet = "0"
try{
quantityGet = (sales[position].saldo - sales[position].picked).toString()
@ -384,7 +385,7 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
customDialogList.dismiss()
}else{
itemShelvingFkStored = itemShelvingFk
splash_progress.visibility = View.VISIBLE
binding.splashProgress.visibility = View.VISIBLE
viewModel.getIdFromCode(
usuario = user,
password = password,
@ -422,7 +423,7 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
customDialogList.dismiss()
}else{
itemShelvingFkStored = itemShelvingFk
splash_progress.visibility = View.VISIBLE
binding.splashProgress.visibility = View.VISIBLE
viewModel.getIdFromCode(
usuario = user,
password = password,
@ -491,8 +492,7 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
//OTROS
private fun setToolBar(){
toolbar_subtitle.visibility = View.VISIBLE
binding.mainToolbar.toolbarSubtitle.visibility = View.VISIBLE
val listIcons:ArrayList<Drawable> = ArrayList()
val iconPrint : Drawable = resources.getDrawable(R.drawable.ic_print_black_24dp,resources.newTheme())
val iconParking : Drawable = resources.getDrawable(R.drawable.ic_local_parking_black_24dp,resources.newTheme())
@ -502,7 +502,7 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
listIcons.add(iconParking)
//listIcons.add(iconTransferir)
toolbar_icons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
if (item == iconPrint){
@ -511,12 +511,12 @@ class ReposicionFragment : BaseFragment<ReposicionFragmentBinding, ReposicionVie
}
}
})
toolbar_icons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
binding.mainToolbar.toolbarIcons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
}
private fun scanRequest(){
scan_input.requestFocus()
binding.scanInput.requestFocus()
hideKeyboards()
}

View File

@ -15,9 +15,9 @@ import es.verdnatura.presentation.view.component.CustomDialogInput
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.shelvingparking.adapter.ShelvingParkingAdapter
import kotlinx.android.synthetic.main.activity_main.*
/*import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_shelving_parking.*
import kotlinx.android.synthetic.main.toolbar.*
import kotlinx.android.synthetic.main.toolbar.**/
class ShelvingParkingFragment : BaseFragment<FragmentShelvingParkingBinding, ShelvingParkingViewModel>(
ShelvingParkingViewModel::class) {
@ -48,47 +48,47 @@ class ShelvingParkingFragment : BaseFragment<FragmentShelvingParkingBinding, She
warehouseFk = prefs.getInt(WAREHOUSEFK,1).toString()
customDialogInput = CustomDialogInput(requireContext())
customDialog = CustomDialog(requireContext())
requireActivity().main_bottom_navigation.visibility = View.GONE
toolbar_title.text = getString(R.string.shelvingParking_get)
(activity as MainActivity).hideBottomNavigation(View.GONE)
binding.mainToolbar.toolbarTitle.text = getString(R.string.shelvingParking_get)
setEvents()
super.init()
}
private fun setEvents(){
backButton.setOnClickListener {
binding.mainToolbar.backButton.setOnClickListener {
requireActivity().onBackPressed()
}
shelvingText.requestFocus()
shelvingText.setOnEditorActionListener { v, actionId, event ->
binding.shelvingText.requestFocus()
binding.shelvingText.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
if (!shelvingText.text.toString().isNullOrEmpty()){
toolbar_title.text = shelvingText.text.toString()
splash_progress.visibility = View.VISIBLE
viewModel.shelvingParking_get(user,password,shelvingText.text.toString(),warehouseFk,dayrange.text.toString(),"shelvingParking_get")
if (!binding.shelvingText.text.toString().isNullOrEmpty()){
binding.mainToolbar.toolbarTitle.text = binding.shelvingText.text.toString()
binding.splashProgress.visibility = View.VISIBLE
viewModel.shelvingParking_get(user,password,binding.shelvingText.text.toString(),warehouseFk,binding.dayrange.text.toString(),"shelvingParking_get")
}
shelvingText.setText("")
(activity as MainActivity).hideKeyboard(shelvingText)
binding.shelvingText.setText("")
(activity as MainActivity).hideKeyboard(binding.shelvingText)
return@setOnEditorActionListener true
}
return@setOnEditorActionListener false
}
dayrange.setOnEditorActionListener { v, actionId, event ->
binding.dayrange.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
if (!shelvingText.text.toString().isNullOrEmpty())
splash_progress.visibility = View.VISIBLE
if (!binding.shelvingText.text.toString().isNullOrEmpty())
binding.splashProgress.visibility = View.VISIBLE
else
shelvingText.requestFocus()
binding.shelvingText.requestFocus()
toolbar_title.text = shelvingText.text.toString()
viewModel.shelvingParking_get(user,password,shelvingText.text.toString(),warehouseFk,dayrange.text.toString(),"shelvingParking_get")
shelvingText.setText("")
(activity as MainActivity).hideKeyboard(dayrange)
binding.mainToolbar.toolbarTitle.text = binding.shelvingText.text.toString()
viewModel.shelvingParking_get(user,password,binding.shelvingText.text.toString(),warehouseFk,binding.dayrange.text.toString(),"shelvingParking_get")
binding.shelvingText.setText("")
(activity as MainActivity).hideKeyboard(binding.dayrange)
return@setOnEditorActionListener true
}
@ -100,10 +100,10 @@ class ShelvingParkingFragment : BaseFragment<FragmentShelvingParkingBinding, She
with(viewModel){
loadShelvingList.observe(viewLifecycleOwner, Observer { event ->
event.getContentIfNotHandled().notNull {
splash_progress.visibility = View.GONE
binding.splashProgress.visibility = View.GONE
adapter = ShelvingParkingAdapter(it.list)
location_recyclerview.adapter = adapter
location_recyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
binding.locationRecyclerview.adapter = adapter
binding.locationRecyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
}
})

View File

@ -7,7 +7,7 @@
<variable
name="viewModel"
type="es.verdnatura.presentation.view.feature.historico.fragment.HistoricoViewModel" />
type="es.verdnatura.presentation.view.feature.historicoarticulo.fragment.HistoricoArticuloViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout

View File

@ -3,12 +3,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="viewModel"
type="es.verdnatura.presentation.view.feature.historicovehiculo.fragment.HistoricoVehiculoViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"

View File

@ -27,14 +27,14 @@
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textinputlayout_username"
android:id="@+id/textinputlayout_scan"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColorHint="@android:color/darker_gray"
android:layout_marginTop="@dimen/toolbar_height">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edit_itemFk"
android:id="@+id/scan_input"
style="@style/InputLineTextSearch"
android:layout_width="match_parent"
android:backgroundTint="@android:color/white"

View File

@ -3,12 +3,6 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="viewModel"
type="es.verdnatura.presentation.view.feature.qr.QrFragmentViewModel" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"

View File

@ -27,14 +27,14 @@
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textinputlayout_username"
android:id="@+id/textinputlayout_scan"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColorHint="@android:color/darker_gray"
android:layout_marginTop="@dimen/toolbar_height">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edit_itemFk"
android:id="@+id/scan_input"
style="@style/InputLineTextSearch"
android:layout_width="match_parent"
android:backgroundTint="@android:color/white"

View File

@ -7,7 +7,7 @@
<variable
name="item"
type="es.verdnatura.presentation.view.feature.historico.model.ItemHistoricoVO" />
type="es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoVO" />
</data>
<LinearLayout
android:layout_width="match_parent"

View File

@ -34,7 +34,7 @@
android:id="@+id/itemFk"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{item.name}"
android:text="@{item.workerName}"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"