feat issues refs #7636
This commit is contained in:
parent
6f0310cb14
commit
a7c66ff0b2
|
@ -62,8 +62,7 @@ class InventaryFragment :
|
|||
buyerId = mobileApplication.dataStoreApp.readDataStoreKey((BUYERID))
|
||||
if (buyerId.isNotBlank()) {
|
||||
viewModel.getInventory(
|
||||
buyerId.toInt(),
|
||||
mobileApplication.dataStoreApp.readDataStoreKey(WAREHOUSEFK)
|
||||
buyerId.toInt(), mobileApplication.dataStoreApp.readDataStoreKey(WAREHOUSEFK)
|
||||
)
|
||||
}
|
||||
binding.filterBuyer.setOnClickListener {
|
||||
|
@ -80,12 +79,10 @@ class InventaryFragment :
|
|||
|
||||
lifecycleScope.launch {
|
||||
mobileApplication.dataStoreApp.editDataStoreKey(
|
||||
BUYER,
|
||||
nombre.getBuyerNickname()
|
||||
BUYER, nombre.getBuyerNickname()
|
||||
)
|
||||
mobileApplication.dataStoreApp.editDataStoreKey(
|
||||
BUYERID,
|
||||
nombre.getBuyerId()
|
||||
BUYERID, nombre.getBuyerId()
|
||||
)
|
||||
}
|
||||
viewModel.getInventory(
|
||||
|
@ -157,17 +154,7 @@ class InventaryFragment :
|
|||
|
||||
} else {
|
||||
|
||||
listInventory.removeAll(listInventoryAux.toSet())
|
||||
|
||||
listInventory.addAll(listInventoryAux.filter {
|
||||
it.itemFk!!.toString().contains(
|
||||
binding.filterItemFk.text.toString(), true
|
||||
) || it.producer?.contains(
|
||||
binding.filterItemFk.text.toString(), true
|
||||
) == true || it.longName?.contains(
|
||||
binding.filterItemFk.text.toString(), ignoreCase = true
|
||||
) == true
|
||||
})
|
||||
setFilterItem()
|
||||
|
||||
}
|
||||
adapter!!.notifyDataSetChanged()
|
||||
|
@ -241,8 +228,11 @@ class InventaryFragment :
|
|||
firstVisiblePosition
|
||||
)
|
||||
}
|
||||
if (binding.filterItemFk.text!!.isNotEmpty()) {
|
||||
setFilterItem()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
response.observe(viewLifecycleOwner) {
|
||||
changeOfflineValue(itemClicked)
|
||||
|
@ -250,6 +240,20 @@ class InventaryFragment :
|
|||
}
|
||||
}
|
||||
|
||||
private fun setFilterItem() {
|
||||
listInventory.removeAll(listInventoryAux.toSet())
|
||||
|
||||
listInventory.addAll(listInventoryAux.filter {
|
||||
it.itemFk!!.toString().contains(
|
||||
binding.filterItemFk.text.toString(), true
|
||||
) || it.producer?.contains(
|
||||
binding.filterItemFk.text.toString(), true
|
||||
) == true || it.longName?.contains(
|
||||
binding.filterItemFk.text.toString(), ignoreCase = true
|
||||
) == true
|
||||
})
|
||||
}
|
||||
|
||||
private fun changeOfflineValue(item: ItemInventaryVO) {
|
||||
try {
|
||||
listInventory.removeAt(listInventory.indexOf(item))
|
||||
|
|
Loading…
Reference in New Issue