refs #6873 feat:modify filter

This commit is contained in:
Sergio De la torre 2024-02-19 08:25:12 +01:00
parent d9031969b0
commit e0c9fc7c60
1 changed files with 2 additions and 7 deletions

View File

@ -84,7 +84,7 @@ class HistoricoArticuloFragment(
when (item) { when (item) {
iconReload.drawable -> viewModelwithFilter("all") iconReload.drawable -> viewModelwithFilter("all")
iconGargabe.drawable -> { iconGargabe.drawable -> {
viewModelwithFilter("contenedor") viewModelwithFilter("merma")
item.setTint(getColor(context!!, verdnatura_pumpkin_orange)) item.setTint(getColor(context!!, verdnatura_pumpkin_orange))
} }
@ -173,16 +173,11 @@ class HistoricoArticuloFragment(
listHistoric.clear() listHistoric.clear()
listHistoryAux.clear() listHistoryAux.clear()
lista.forEach { lista.forEach {
if (filter.equals("all")) { if (filter == "all" || (filter == "falta" && it.name?.contains(filter, true) == true) || (filter != "falta" && it.name?.contains("merma", true) == true && !it.name?.contains("falta", true)!!)) {
listHistoric.add(it)
} else {
if (it.name?.contains(filter, true)!!) {
listHistoric.add(it) listHistoric.add(it)
} }
} }
}
adapter = HistoricoAdapter(listHistoric) adapter = HistoricoAdapter(listHistoric)
binding.historicoRecyclerview.adapter = adapter binding.historicoRecyclerview.adapter = adapter
binding.historicoRecyclerview.layoutManager = binding.historicoRecyclerview.layoutManager =