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)) buyerId = mobileApplication.dataStoreApp.readDataStoreKey((BUYERID))
if (buyerId.isNotBlank()) { if (buyerId.isNotBlank()) {
viewModel.getInventory( viewModel.getInventory(
buyerId.toInt(), buyerId.toInt(), mobileApplication.dataStoreApp.readDataStoreKey(WAREHOUSEFK)
mobileApplication.dataStoreApp.readDataStoreKey(WAREHOUSEFK)
) )
} }
binding.filterBuyer.setOnClickListener { binding.filterBuyer.setOnClickListener {
@ -80,12 +79,10 @@ class InventaryFragment :
lifecycleScope.launch { lifecycleScope.launch {
mobileApplication.dataStoreApp.editDataStoreKey( mobileApplication.dataStoreApp.editDataStoreKey(
BUYER, BUYER, nombre.getBuyerNickname()
nombre.getBuyerNickname()
) )
mobileApplication.dataStoreApp.editDataStoreKey( mobileApplication.dataStoreApp.editDataStoreKey(
BUYERID, BUYERID, nombre.getBuyerId()
nombre.getBuyerId()
) )
} }
viewModel.getInventory( viewModel.getInventory(
@ -157,17 +154,7 @@ class InventaryFragment :
} else { } else {
listInventory.removeAll(listInventoryAux.toSet()) setFilterItem()
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
})
} }
adapter!!.notifyDataSetChanged() adapter!!.notifyDataSetChanged()
@ -210,11 +197,11 @@ class InventaryFragment :
.setDescription(getString(R.string.quantityReal) + item.nicho + ")") .setDescription(getString(R.string.quantityReal) + item.nicho + ")")
.setOkButton(getString(R.string.pull)) { .setOkButton(getString(R.string.pull)) {
//Tarea 7161 //Tarea 7161
viewModel.itemSetVisibleDiscard( viewModel.itemSetVisibleDiscard(
item.itemFk!!.toInt(), item.itemFk!!.toInt(),
mobileApplication.dataStoreApp.readDataStoreKey(WAREHOUSEFK), mobileApplication.dataStoreApp.readDataStoreKey(WAREHOUSEFK),
item.nicho!! item.nicho!!
) )
itemClicked = item itemClicked = item
customDialog.dismiss() customDialog.dismiss()
}.setOkButtonTwo(getString(R.string.titleUbicator)) { }.setOkButtonTwo(getString(R.string.titleUbicator)) {
@ -241,7 +228,10 @@ class InventaryFragment :
firstVisiblePosition firstVisiblePosition
) )
} }
if (binding.filterItemFk.text!!.isNotEmpty()) {
setFilterItem()
}
} }
response.observe(viewLifecycleOwner) { response.observe(viewLifecycleOwner) {
@ -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) { private fun changeOfflineValue(item: ItemInventaryVO) {
try { try {
listInventory.removeAt(listInventory.indexOf(item)) listInventory.removeAt(listInventory.indexOf(item))