Faltas
This commit is contained in:
parent
57b04a9309
commit
780c6d01e1
|
@ -3,6 +3,7 @@ package es.verdnatura.di
|
|||
import es.verdnatura.presentation.view.feature.ajustes.fragment.AjustesViewModel
|
||||
import es.verdnatura.presentation.view.feature.articulo.fragment.ItemCardViewModel
|
||||
import es.verdnatura.presentation.view.feature.buscaritem.fragment.BuscarItemViewModel
|
||||
import es.verdnatura.presentation.view.feature.faltas.fragment.FaltasViewModel
|
||||
import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryViewModel
|
||||
import es.verdnatura.presentation.view.feature.login.fragment.LoginViewModel
|
||||
import es.verdnatura.presentation.view.feature.pasillero.fragment.PasilleroViewModel
|
||||
|
@ -34,6 +35,10 @@ val viewModelModule = module{
|
|||
viewModel {
|
||||
InventaryViewModel()
|
||||
}
|
||||
// Pasilleros / Faltas
|
||||
viewModel {
|
||||
FaltasViewModel()
|
||||
}
|
||||
|
||||
// Ajustes
|
||||
viewModel {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO
|
||||
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
|
||||
import retrofit2.Call
|
||||
|
||||
|
@ -11,4 +12,17 @@ class GetInventaryUserCase : RestClient() {
|
|||
return restClient!!.itemShelvingRadar("json","1",usuario,password,"application/json",params = params)!!
|
||||
}
|
||||
|
||||
fun faultsReview(usuario:String,password:String,warehouseFk:String) : Call<List<ItemFaltasVO>> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
params.add(warehouseFk)
|
||||
return restClient!!.faultsReview("json","1",usuario,password,"application/json",params = params)!!
|
||||
}
|
||||
|
||||
fun faultsReview_isChecked(usuario:String,password:String,itemFk:String,warehouseFk:String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
params.add(itemFk)
|
||||
params.add(warehouseFk)
|
||||
return restClient!!.faultsReview_isChecked("json","1",usuario,password,"application/json",params = params)!!
|
||||
}
|
||||
|
||||
}
|
|
@ -4,6 +4,7 @@ package es.verdnatura.domain
|
|||
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
|
||||
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO
|
||||
import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO
|
||||
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
|
||||
import retrofit2.Call
|
||||
import retrofit2.http.Body
|
||||
|
@ -129,5 +130,23 @@ interface VerdnaturaService {
|
|||
@Body params: List<String>):
|
||||
Call<List<ItemInventaryVO>>
|
||||
|
||||
@POST("almacenv2/faultsReview")
|
||||
fun faultsReview(@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<List<ItemFaltasVO>>
|
||||
|
||||
@POST("almacenv2/faultsReview_isChecked")
|
||||
fun faultsReview_isChecked(@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<String>
|
||||
|
||||
|
||||
}
|
|
@ -5,6 +5,7 @@ import es.verdnatura.presentation.view.feature.ajustes.model.AjustesItemVO
|
|||
import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
|
||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardRowVO
|
||||
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO
|
||||
import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO
|
||||
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
|
||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||
|
||||
|
@ -36,3 +37,10 @@ interface OnLocationRowClickListener {
|
|||
interface OnInvetoryNichoClickListener {
|
||||
fun onInvetoryNichoClickListener(item: ItemInventaryVO)
|
||||
}
|
||||
|
||||
interface OnFaltasNichoClickListener {
|
||||
fun onFaltasNichoClickListener(item: ItemFaltasVO)
|
||||
}
|
||||
interface OnFaltasReviewClickListener {
|
||||
fun onFaltasReviewClickListener(item: ItemFaltasVO)
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package es.verdnatura.presentation.view.feature.faltas.adapter
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import es.verdnatura.databinding.ItemFaltasRowBinding
|
||||
import es.verdnatura.presentation.common.OnFaltasNichoClickListener
|
||||
import es.verdnatura.presentation.common.OnFaltasReviewClickListener
|
||||
import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO
|
||||
|
||||
class FaltasAdapter (
|
||||
private val items: List<ItemFaltasVO>,
|
||||
private val onFaltasNichoClickListener: OnFaltasNichoClickListener,
|
||||
private val onFaltasReviewClickListener:OnFaltasReviewClickListener
|
||||
): RecyclerView.Adapter<FaltasAdapter.ItemHolder> () {
|
||||
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
|
||||
return ItemHolder(
|
||||
ItemFaltasRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
|
||||
)
|
||||
}
|
||||
|
||||
override fun getItemCount() =items.size
|
||||
|
||||
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
|
||||
holder.bind(items[position])
|
||||
}
|
||||
|
||||
inner class ItemHolder(
|
||||
val binding: ItemFaltasRowBinding
|
||||
) : RecyclerView.ViewHolder(binding.root){
|
||||
private val res = binding.root.context.resources
|
||||
fun bind(item: ItemFaltasVO) {
|
||||
binding.apply {
|
||||
this.item = item
|
||||
if(item.producer.isNullOrEmpty()){
|
||||
itemProducer.visibility = View.GONE
|
||||
}else{
|
||||
itemProducer.visibility = View.VISIBLE
|
||||
}
|
||||
itemNicho.setOnClickListener {
|
||||
onFaltasNichoClickListener.onFaltasNichoClickListener(item)
|
||||
}
|
||||
itemFaltas.setOnClickListener {
|
||||
onFaltasReviewClickListener.onFaltasReviewClickListener(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,194 @@
|
|||
package es.verdnatura.presentation.view.feature.faltas.fragment
|
||||
|
||||
import android.content.SharedPreferences
|
||||
import android.graphics.drawable.Drawable
|
||||
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.FragmentFaltasBinding
|
||||
import es.verdnatura.domain.notNull
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.common.OnFaltasNichoClickListener
|
||||
import es.verdnatura.presentation.common.OnFaltasReviewClickListener
|
||||
|
||||
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.faltas.adapter.FaltasAdapter
|
||||
import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO
|
||||
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
|
||||
|
||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.android.synthetic.main.fragment_faltas.*
|
||||
import kotlinx.android.synthetic.main.toolbar.*
|
||||
|
||||
class FaltasFragment : BaseFragment<FragmentFaltasBinding, FaltasViewModel>(FaltasViewModel::class) {
|
||||
|
||||
private var user = ""
|
||||
private var password = ""
|
||||
private var sectorFk = ""
|
||||
private var warehouseFk = ""
|
||||
private var adapter : FaltasAdapter? = null
|
||||
private lateinit var customDialogInput: CustomDialogInput
|
||||
private var listInvetory:ArrayList<ItemFaltasVO> = ArrayList()
|
||||
private var listInvetoryAux:ArrayList<ItemFaltasVO> = ArrayList()
|
||||
private lateinit var customDialog: CustomDialog
|
||||
|
||||
companion object {
|
||||
fun newInstance() = FaltasFragment()
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int = R.layout.fragment_faltas
|
||||
|
||||
override fun init() {
|
||||
activity!!.main_bottom_navigation.visibility = View.GONE
|
||||
toolbar_title.text = "itemShelvingRadar"
|
||||
setToolBar()
|
||||
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0)
|
||||
user = prefs.getString(USER,"").toString()
|
||||
password = prefs.getString(PASSWORD,"").toString()
|
||||
sectorFk = prefs.getInt(SECTORFK,1).toString()
|
||||
warehouseFk = prefs.getInt(WAREHOUSEFK,1).toString()
|
||||
viewModel.getFaltas(user,password,warehouseFk)
|
||||
customDialogInput = CustomDialogInput(requireContext())
|
||||
customDialog = CustomDialog(requireContext())
|
||||
setEvents()
|
||||
super.init()
|
||||
}
|
||||
|
||||
|
||||
private fun setToolBar(){
|
||||
val listIcons:ArrayList<Drawable> = ArrayList()
|
||||
val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme())
|
||||
listIcons.add(iconReload)
|
||||
toolbar_icons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
|
||||
override fun onOptionsItemSelected(item: Drawable) {
|
||||
if (item == iconReload){
|
||||
splash_progress.visibility = View.VISIBLE
|
||||
viewModel.getFaltas(user,password,warehouseFk)
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
toolbar_icons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||
}
|
||||
|
||||
private fun setEvents(){
|
||||
backButton.setOnClickListener {
|
||||
activity!!.onBackPressed()
|
||||
}
|
||||
|
||||
filter_itemFk.setOnKeyListener { v, keyCode, event ->
|
||||
if (filter_itemFk.text.toString().isNullOrEmpty()){
|
||||
if (listInvetory.size != listInvetoryAux.size){
|
||||
listInvetory.removeAll(listInvetoryAux)
|
||||
listInvetoryAux.forEach {
|
||||
listInvetory.add(it)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}else{
|
||||
listInvetory.removeAll(listInvetoryAux)
|
||||
listInvetoryAux.forEach {
|
||||
if (it.itemFk.contains(filter_itemFk.text.toString(),true)){
|
||||
listInvetory.add(it)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
adapter!!.notifyDataSetChanged()
|
||||
return@setOnKeyListener false
|
||||
}
|
||||
}
|
||||
|
||||
override fun observeViewModel() {
|
||||
with(viewModel){
|
||||
loadFaltasList.observe(viewLifecycleOwner, Observer { event ->
|
||||
splash_progress.visibility = View.GONE
|
||||
event.getContentIfNotHandled().notNull {
|
||||
listInvetory = ArrayList()
|
||||
listInvetoryAux = ArrayList()
|
||||
it.list.forEach {
|
||||
listInvetory.add(it)
|
||||
listInvetoryAux.add(it)
|
||||
}
|
||||
|
||||
adapter = FaltasAdapter(listInvetory,object: OnFaltasNichoClickListener {
|
||||
override fun onFaltasNichoClickListener(item: ItemFaltasVO) {
|
||||
customDialogInput.setTitle(item.itemFk+"\n"+item.longName+" "+item.size).setDescription("Cantidad real("+item.nicho+")").setOkButton("Tirar"){
|
||||
viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,customDialogInput.getValue(),"0")
|
||||
changeOfflineValue(item)
|
||||
customDialogInput.hide()
|
||||
}.setKoButton("Cancelar"){
|
||||
customDialogInput.hide()
|
||||
}.setValue("0").show()
|
||||
|
||||
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()){
|
||||
viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,customDialogInput.getValue(),"0")
|
||||
changeOfflineValue(item)
|
||||
}
|
||||
customDialogInput.setValue("")
|
||||
customDialogInput.hide()
|
||||
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
}
|
||||
},object: OnFaltasReviewClickListener{
|
||||
override fun onFaltasReviewClickListener(item: ItemFaltasVO) {
|
||||
viewModel.faultsReview_isChecked(user,password,item.itemFk,warehouseFk)
|
||||
changeOfflineValue(item)
|
||||
}
|
||||
|
||||
})
|
||||
location_recyclerview.adapter = adapter
|
||||
location_recyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
response.observe(viewLifecycleOwner, Observer {
|
||||
if (it.isError){
|
||||
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
|
||||
customDialog.hide()
|
||||
}.show()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private fun changeOfflineValue(item: ItemFaltasVO){
|
||||
var i = 0
|
||||
var position = 0
|
||||
listInvetory.forEach {
|
||||
if (it.itemFk == item.itemFk) {
|
||||
position = i
|
||||
}
|
||||
i = i.plus(1)
|
||||
}
|
||||
listInvetory.removeAt(position)
|
||||
|
||||
i = 0
|
||||
position = 0
|
||||
listInvetoryAux.forEach {
|
||||
if (it.itemFk == item.itemFk) {
|
||||
position = i
|
||||
}
|
||||
i = i.plus(1)
|
||||
}
|
||||
listInvetoryAux.removeAt(position)
|
||||
adapter?.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
package es.verdnatura.presentation.view.feature.faltas.fragment
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
import es.verdnatura.domain.GetInventaryUserCase
|
||||
import es.verdnatura.domain.GetItemCardUserCase
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.common.Event
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasListVO
|
||||
import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO
|
||||
import es.verdnatura.presentation.view.feature.inventario.model.InventaryListVO
|
||||
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
class FaltasViewModel : BaseViewModel() {
|
||||
|
||||
|
||||
private val getInventaryUserCase: GetInventaryUserCase = GetInventaryUserCase()
|
||||
private val getItemCardUserCase: GetItemCardUserCase = GetItemCardUserCase()
|
||||
|
||||
|
||||
private val _faltasList by lazy { MutableLiveData<ItemFaltasListVO>() }
|
||||
val faltasList: LiveData<ItemFaltasListVO>
|
||||
get() = _faltasList
|
||||
|
||||
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val response: LiveData<ResponseItemVO>
|
||||
get() = _response
|
||||
|
||||
|
||||
val loadFaltasList = Transformations.map(_faltasList) { Event(it) }
|
||||
|
||||
|
||||
fun getFaltas(user:String,password:String,warehouseFk:String){
|
||||
getInventaryUserCase.faultsReview(user,password,warehouseFk).enqueue(object :
|
||||
Callback<List<ItemFaltasVO>> {
|
||||
override fun onFailure(call: Call<List<ItemFaltasVO>>, t: Throwable) {
|
||||
val listError:ArrayList<ItemFaltasVO> = ArrayList()
|
||||
listError.add(ItemFaltasVO(isError = true,errorMessage = t.message!!))
|
||||
_faltasList.value = ItemFaltasListVO(listError)
|
||||
}
|
||||
|
||||
override fun onResponse(
|
||||
call: Call<List<ItemFaltasVO>>,
|
||||
response: Response<List<ItemFaltasVO>>
|
||||
) {
|
||||
if (response.body() != null){
|
||||
_faltasList.value = response.body()?.let { ItemFaltasListVO(it) }
|
||||
}else{
|
||||
val listError:ArrayList<ItemFaltasVO> = ArrayList()
|
||||
listError.add(ItemFaltasVO(isError = true,errorMessage = "Error en la llamada de faultsReview"))
|
||||
_faltasList.value = ItemFaltasListVO(listError)
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun itemStockUpdate(itemFk:String,warehouseFk:String,user:String,password:String,newValue:String,isTrash:String){
|
||||
getItemCardUserCase.itemStockUpdate(user,password,itemFk,warehouseFk,newValue,isTrash).enqueue(object :
|
||||
Callback<String> {
|
||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al guardar STOCK "+itemFk+ " Respuesta:"+t.message!!)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<String>, response: Response<String>) {
|
||||
if (response.body() == null){
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemStockUpdate")
|
||||
}else{
|
||||
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun faultsReview_isChecked(user:String,password:String,itemFk:String,warehouseFk:String){
|
||||
getInventaryUserCase.faultsReview_isChecked(user,password,itemFk,warehouseFk).enqueue(object :
|
||||
Callback<String> {
|
||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = "Error faultsReview_isChecked "+itemFk+ " Respuesta:"+t.message!!)
|
||||
}
|
||||
override fun onResponse(call: Call<String>, response: Response<String>) {
|
||||
if (response.body() == null){
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada faultsReview_isChecked")
|
||||
}else{
|
||||
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package es.verdnatura.presentation.view.feature.faltas.model
|
||||
|
||||
class ItemFaltasVO (
|
||||
var itemFk:String = "",
|
||||
var longName:String= "",
|
||||
var size:String= "",
|
||||
var producer:String= "",
|
||||
var downstairs:String= "",
|
||||
var upstairs:String= "",
|
||||
var nicho:String= "",
|
||||
var faltas:String= "",
|
||||
var isError:Boolean = false,
|
||||
var errorMessage:String = ""
|
||||
)
|
||||
|
||||
|
||||
class ItemFaltasListVO (
|
||||
var list: List<ItemFaltasVO> = listOf()
|
||||
)
|
|
@ -6,7 +6,6 @@ import android.view.ViewGroup
|
|||
import androidx.recyclerview.widget.RecyclerView
|
||||
import es.verdnatura.databinding.ItemInventaryRowBinding
|
||||
import es.verdnatura.presentation.common.OnInvetoryNichoClickListener
|
||||
import es.verdnatura.presentation.common.OnItemCardRowClickListener
|
||||
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
|
||||
|
||||
class InventoryAdapter (
|
||||
|
|
|
@ -2,14 +2,10 @@ package es.verdnatura.presentation.view.feature.inventario.adapter
|
|||
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import es.verdnatura.databinding.ItemInventaryRowBinding
|
||||
import es.verdnatura.databinding.ItemToolbarRowBinding
|
||||
import es.verdnatura.presentation.common.OnInvetoryNichoClickListener
|
||||
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
||||
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
|
||||
|
||||
class ToolBarAdapter (
|
||||
private val items: List<Drawable>,
|
||||
|
|
|
@ -2,8 +2,6 @@ package es.verdnatura.presentation.view.feature.inventario.fragment
|
|||
|
||||
import android.content.SharedPreferences
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import androidx.lifecycle.Observer
|
||||
|
@ -13,19 +11,14 @@ import es.verdnatura.databinding.FragmentInventaryBinding
|
|||
import es.verdnatura.domain.notNull
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.common.OnInvetoryNichoClickListener
|
||||
import es.verdnatura.presentation.common.OnLocationRowClickListener
|
||||
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
||||
import es.verdnatura.presentation.common.TAG
|
||||
import es.verdnatura.presentation.view.component.CustomDialog
|
||||
import es.verdnatura.presentation.view.component.CustomDialogInput
|
||||
import es.verdnatura.presentation.view.feature.buscaritem.adapter.LocationAdapter
|
||||
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO
|
||||
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 kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.android.synthetic.main.fragment_buscar_item.*
|
||||
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_inventary.*
|
||||
|
|
|
@ -3,14 +3,11 @@ package es.verdnatura.presentation.view.feature.inventario.fragment
|
|||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.Transformations
|
||||
import es.verdnatura.domain.GetBuscarItemUserCase
|
||||
import es.verdnatura.domain.GetInventaryUserCase
|
||||
import es.verdnatura.domain.GetItemCardUserCase
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.common.Event
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO
|
||||
import es.verdnatura.presentation.view.feature.buscaritem.model.LocationListVO
|
||||
import es.verdnatura.presentation.view.feature.inventario.model.InventaryListVO
|
||||
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
|
||||
import retrofit2.Call
|
||||
|
|
|
@ -17,6 +17,7 @@ import es.verdnatura.presentation.view.component.CustomDialog
|
|||
import es.verdnatura.presentation.view.feature.ajustes.fragment.AjustesFragment
|
||||
import es.verdnatura.presentation.view.feature.articulo.fragment.ItemCardFragment
|
||||
import es.verdnatura.presentation.view.feature.buscaritem.fragment.BuscarItemFragment
|
||||
import es.verdnatura.presentation.view.feature.faltas.fragment.FaltasFragment
|
||||
import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryFragment
|
||||
import es.verdnatura.presentation.view.feature.main.model.ItemMenuVO
|
||||
import es.verdnatura.presentation.view.feature.pasillero.fragment.PasilleroFragment
|
||||
|
@ -147,6 +148,9 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
|
|||
"Inventario" -> {
|
||||
addFragmentOnTop(InventaryFragment.newInstance())
|
||||
}
|
||||
"Faltas" -> {
|
||||
addFragmentOnTop(FaltasFragment.newInstance())
|
||||
}
|
||||
}
|
||||
Log.i("Item: ",item.title)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,137 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:tools="http://schemas.android.com/tools"
|
||||
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.faltas.model.ItemFaltasVO" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:paddingTop="@dimen/toolbar_height">
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/textinputlayout_username"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColorHint="@android:color/darker_gray">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/filter_itemFk"
|
||||
style="@style/InputLineTextSearch"
|
||||
android:layout_width="match_parent"
|
||||
android:backgroundTint="@android:color/white"
|
||||
android:hint="Filtro"
|
||||
android:inputType="number"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textColorHint="@android:color/darker_gray" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="@dimen/layout_margin_min"
|
||||
android:layout_marginBottom="@dimen/layout_margin_1"
|
||||
android:paddingLeft="@dimen/layout_margin_min"
|
||||
android:paddingRight="@dimen/layout_margin_min">
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Downstairs"
|
||||
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"
|
||||
android:text="Upstairs"
|
||||
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"
|
||||
android:text="Nicho"
|
||||
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"
|
||||
android:text="Faltas"
|
||||
android:textSize="@dimen/body2"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/location_recyclerview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipToPadding="false"
|
||||
tools:listitem="@layout/item_faltas_row"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
<include
|
||||
android:id="@+id/main_toolbar"
|
||||
layout="@layout/toolbar"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/splash_progress"
|
||||
android:visibility="visible"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/verdnatura_black_8_alpha_6"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:gravity="center">
|
||||
|
||||
<com.airbnb.lottie.LottieAnimationView
|
||||
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/verdnatura_logo_large_height"
|
||||
|
||||
app:lottie_autoPlay="true"
|
||||
app:lottie_loop="true"
|
||||
app:lottie_rawRes="@raw/orange_loading"
|
||||
app:lottie_speed="2" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
|
@ -0,0 +1,173 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tool="http://schemas.android.com/tools">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="item"
|
||||
type="es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO" />
|
||||
</data>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:id="@+id/item_row_layout"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/verdnatura_black_5"
|
||||
android:paddingLeft="@dimen/pasilleros_margin_main_menu"
|
||||
android:paddingRight="@dimen/pasilleros_margin_main_menu"
|
||||
android:paddingTop="@dimen/pasilleros_margin_main_menu">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_fk"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{item.itemFk}"
|
||||
android:textSize="@dimen/h7"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:layout_weight="1"
|
||||
android:gravity="left"
|
||||
tool:text="31100"/>
|
||||
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/verdnatura_black_5"
|
||||
android:paddingLeft="@dimen/pasilleros_margin_main_menu"
|
||||
android:paddingRight="@dimen/pasilleros_margin_main_menu">
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{item.longName}"
|
||||
android:textSize="@dimen/body2"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:layout_weight="1"
|
||||
android:gravity="left"
|
||||
tool:text="Alstromeria Blanca"/>
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/verdnatura_black_5"
|
||||
android:paddingLeft="@dimen/pasilleros_margin_main_menu"
|
||||
android:paddingRight="@dimen/pasilleros_margin_main_menu">
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{item.size}"
|
||||
android:textSize="@dimen/body2"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:layout_weight="2"
|
||||
android:gravity="left"
|
||||
tool:text="80" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/verdnatura_black_5"
|
||||
android:paddingLeft="@dimen/pasilleros_margin_main_menu"
|
||||
android:paddingRight="@dimen/pasilleros_margin_main_menu"
|
||||
android:paddingBottom="@dimen/pasilleros_margin_main_menu">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_producer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{item.producer}"
|
||||
android:textSize="@dimen/body2"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:layout_weight="1"
|
||||
android:gravity="left"
|
||||
tool:text="Benchmark"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/verdnatura_black_5"
|
||||
android:paddingLeft="@dimen/pasilleros_margin_main_menu"
|
||||
android:paddingRight="@dimen/pasilleros_margin_main_menu"
|
||||
android:paddingBottom="@dimen/pasilleros_margin_main_menu">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_down"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{item.downstairs}"
|
||||
android:textSize="@dimen/h6"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/verdnatura_pumpkin_orange"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
tool:text="730"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_up"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{item.upstairs}"
|
||||
android:textSize="@dimen/h6"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/verdnatura_pumpkin_orange"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
tool:text="0" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_nicho"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{item.nicho}"
|
||||
android:textSize="@dimen/h6"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/verdnatura_red"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
tool:text="-50" />
|
||||
<TextView
|
||||
android:id="@+id/item_faltas"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{item.faltas}"
|
||||
android:textSize="@dimen/h6"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/verdnatura_dark_sky_blue"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
tool:text="-50" />
|
||||
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/verdnatura_black_9"/>
|
||||
</LinearLayout>
|
||||
</layout>
|
Loading…
Reference in New Issue