feat issues refs #7636

This commit is contained in:
Sergio De la torre 2024-07-03 07:31:18 +02:00
parent 6f0310cb14
commit a7c66ff0b2
1 changed files with 28 additions and 24 deletions

View File

@ -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()
@ -210,11 +197,11 @@ class InventaryFragment :
.setDescription(getString(R.string.quantityReal) + item.nicho + ")")
.setOkButton(getString(R.string.pull)) {
//Tarea 7161
viewModel.itemSetVisibleDiscard(
item.itemFk!!.toInt(),
mobileApplication.dataStoreApp.readDataStoreKey(WAREHOUSEFK),
item.nicho!!
)
viewModel.itemSetVisibleDiscard(
item.itemFk!!.toInt(),
mobileApplication.dataStoreApp.readDataStoreKey(WAREHOUSEFK),
item.nicho!!
)
itemClicked = item
customDialog.dismiss()
}.setOkButtonTwo(getString(R.string.titleUbicator)) {
@ -241,7 +228,10 @@ class InventaryFragment :
firstVisiblePosition
)
}
if (binding.filterItemFk.text!!.isNotEmpty()) {
setFilterItem()
}
}
response.observe(viewLifecycleOwner) {
@ -249,7 +239,21 @@ 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))
@ -258,7 +262,7 @@ class InventaryFragment :
ex.message!!.toast(requireContext())
}
adapter?.notifyItemRemoved(listInventory.indexOf(item))
}
private fun createBuyerList(list: List<BuyerVO>) {