feat historical #refs 7168
This commit is contained in:
parent
2695a96f39
commit
3bed3d96b4
|
@ -1,10 +1,12 @@
|
||||||
package es.verdnatura.presentation.view.feature.historicoshelving.fragment
|
package es.verdnatura.presentation.view.feature.historicoshelving.fragment
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.view.View
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentItemshelvinglogBinding
|
import es.verdnatura.databinding.FragmentItemshelvinglogBinding
|
||||||
|
import es.verdnatura.domain.ConstAndValues.LIMITRECORDSSHELVINGLOG
|
||||||
import es.verdnatura.presentation.base.BaseFragment
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||||
import es.verdnatura.presentation.view.component.CustomDialog
|
import es.verdnatura.presentation.view.component.CustomDialog
|
||||||
|
@ -18,6 +20,8 @@ class ItemShelvingLogFragment(
|
||||||
private var adapter: ItemShelvingLogAdapter? = null
|
private var adapter: ItemShelvingLogAdapter? = null
|
||||||
private var itemScan = ""
|
private var itemScan = ""
|
||||||
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
|
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
|
||||||
|
private var records: Int = LIMITRECORDSSHELVINGLOG
|
||||||
|
private var shelving:String = ""
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun newInstance(entryPoint: String) = ItemShelvingLogFragment(entryPoint)
|
fun newInstance(entryPoint: String) = ItemShelvingLogFragment(entryPoint)
|
||||||
|
@ -35,6 +39,7 @@ class ItemShelvingLogFragment(
|
||||||
super.init()
|
super.init()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onAttach(context: Context) {
|
override fun onAttach(context: Context) {
|
||||||
if (context is OnPasillerosItemClickListener) pasillerosItemClickListener = context
|
if (context is OnPasillerosItemClickListener) pasillerosItemClickListener = context
|
||||||
super.onAttach(context)
|
super.onAttach(context)
|
||||||
|
@ -46,11 +51,26 @@ class ItemShelvingLogFragment(
|
||||||
|
|
||||||
private fun setEvents() {
|
private fun setEvents() {
|
||||||
binding.scanInput.requestFocus()
|
binding.scanInput.requestFocus()
|
||||||
|
binding.loadMoreButton.setOnClickListener {
|
||||||
|
records += LIMITRECORDSSHELVINGLOG
|
||||||
|
viewModel.itemShelvingLogGet(
|
||||||
|
shelving,
|
||||||
|
records
|
||||||
|
)
|
||||||
|
}
|
||||||
binding.scanInput.setOnEditorActionListener { v, actionId, event ->
|
binding.scanInput.setOnEditorActionListener { v, actionId, event ->
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
||||||
if (binding.scanInput.text.toString().isNotEmpty()) {
|
if (binding.scanInput.text.toString().isNotEmpty()) {
|
||||||
viewModel.itemShelvingLogGet(binding.scanInput.text.toString())
|
//Tarea 7168
|
||||||
itemScan = binding.scanInput.text.toString()
|
/* records = LIMITRECORDSSHELVINGLOG
|
||||||
|
shelving = binding.scanInput.text.toString()
|
||||||
|
viewModel.itemShelvingLogGet(
|
||||||
|
shelving,
|
||||||
|
records
|
||||||
|
)*/
|
||||||
|
|
||||||
|
viewModel.itemShelvingLogGet(binding.scanInput.text.toString())
|
||||||
|
itemScan = binding.scanInput.text.toString()
|
||||||
}
|
}
|
||||||
binding.scanInput.setText("")
|
binding.scanInput.setText("")
|
||||||
ma.hideKeyboard(binding.scanInput)
|
ma.hideKeyboard(binding.scanInput)
|
||||||
|
@ -80,6 +100,12 @@ class ItemShelvingLogFragment(
|
||||||
it.list,
|
it.list,
|
||||||
onPasillerosItemClickListener = pasillerosItemClickListener!!
|
onPasillerosItemClickListener = pasillerosItemClickListener!!
|
||||||
)
|
)
|
||||||
|
//TAREA 7168
|
||||||
|
/* if (it.list.size == records) {
|
||||||
|
binding.loadMoreButton.visibility = View.VISIBLE
|
||||||
|
} else {
|
||||||
|
binding.loadMoreButton.visibility = View.GONE
|
||||||
|
}*/
|
||||||
binding.itemshelvinglogRecyclerview.adapter = adapter
|
binding.itemshelvinglogRecyclerview.adapter = adapter
|
||||||
binding.itemshelvinglogRecyclerview.layoutManager =
|
binding.itemshelvinglogRecyclerview.layoutManager =
|
||||||
LinearLayoutManager(
|
LinearLayoutManager(
|
||||||
|
|
|
@ -3,6 +3,7 @@ package es.verdnatura.presentation.view.feature.historicoshelving.fragment
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import es.verdnatura.domain.ConstAndValues.LIMITRECORDSSHELVINGLOG
|
||||||
import es.verdnatura.domain.SalixCallback
|
import es.verdnatura.domain.SalixCallback
|
||||||
import es.verdnatura.domain.formatWithQuotes
|
import es.verdnatura.domain.formatWithQuotes
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
|
@ -16,8 +17,10 @@ class ItemShelvingLogViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
val itemShelvingLogList: LiveData<ItemShelvingLogList>
|
val itemShelvingLogList: LiveData<ItemShelvingLogList>
|
||||||
get() = _itemShelvingLogList
|
get() = _itemShelvingLogList
|
||||||
|
|
||||||
fun itemShelvingLogGet(vShelvingFK: String) {
|
fun itemShelvingLogGet(vShelvingFK: String, records: Int = LIMITRECORDSSHELVINGLOG) {
|
||||||
|
|
||||||
|
//tarea 7168
|
||||||
|
//salix.itemShelvingLogGet(params = listOf(vShelvingFK,records).formatWithQuotes())
|
||||||
salix.itemShelvingLogGet(params = listOf(vShelvingFK).formatWithQuotes())
|
salix.itemShelvingLogGet(params = listOf(vShelvingFK).formatWithQuotes())
|
||||||
.enqueue(object :
|
.enqueue(object :
|
||||||
SalixCallback<List<ItemShelvingLog>>(context) {
|
SalixCallback<List<ItemShelvingLog>>(context) {
|
||||||
|
|
Loading…
Reference in New Issue