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