feat itemShelvingLog #refs 7597

This commit is contained in:
Sergio De la torre 2024-07-03 07:30:07 +02:00
parent 8275340f0e
commit 6f0310cb14
4 changed files with 59 additions and 30 deletions

View File

@ -1,6 +1,5 @@
package es.verdnatura.presentation.view.feature.historicoshelving.adapter package es.verdnatura.presentation.view.feature.historicoshelving.adapter
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.ViewGroup import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
@ -15,7 +14,6 @@ class ItemShelvingLogAdapter(
private val onPasillerosItemClickListener: OnPasillerosItemClickListener private val onPasillerosItemClickListener: OnPasillerosItemClickListener
) : RecyclerView.Adapter<ItemShelvingLogAdapter.ItemHolder>() { ) : RecyclerView.Adapter<ItemShelvingLogAdapter.ItemHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
return ItemHolder( return ItemHolder(
ItemShelvinglogRowBinding.inflate(LayoutInflater.from(parent.context), parent, false) ItemShelvinglogRowBinding.inflate(LayoutInflater.from(parent.context), parent, false)
@ -29,12 +27,13 @@ class ItemShelvingLogAdapter(
holder.binding.root.setOnClickListener { holder.binding.root.setOnClickListener {
if (!items[position].shelvingFk.isNullOrEmpty()) { if (!items[position].shelvingFk.isNullOrEmpty()) {
onPasillerosItemClickListener.onPasillerosItemClickListener( onPasillerosItemClickListener.onPasillerosItemClickListener(
PasillerosItemVO( PasillerosItemVO(
title = holder.binding.root.context.getString( title = holder.binding.root.context.getString(
R.string.titleUbicator R.string.titleUbicator
) )
),items[position].shelvingFk!! ), items[position].shelvingFk!!
) )
} }
@ -47,9 +46,27 @@ class ItemShelvingLogAdapter(
private val res = binding.root.context.resources private val res = binding.root.context.resources
fun bind(item: ItemShelvingLog) { fun bind(item: ItemShelvingLog) {
binding.apply { binding.apply {
//Tarea 7597
/*binding.txtNickname.setOnClickListener {
openWorker(binding, item.user.id)
}
binding.txtVisible.setOnClickListener {
openWorker(binding, item.user.id)
}*/
this.item = item this.item = item
} }
} }
} }
private fun openWorker(binding: ItemShelvinglogRowBinding, id: Int) {
onPasillerosItemClickListener.onPasillerosItemClickListener(
PasillerosItemVO(title = binding.root.context.getString(R.string.titleUserControlVehicle)),
id.toString()
)
}
} }

View File

@ -21,13 +21,20 @@ class ItemShelvingLogViewModel(val context: Context) : BaseViewModel(context) {
//tarea 7168 //tarea 7168
//salix.itemShelvingLogGet(params = listOf(vShelvingFK,records).formatWithQuotes()) //salix.itemShelvingLogGet(params = listOf(vShelvingFK,records).formatWithQuotes())
salix.itemShelvingLogGet(filter = """ /* salix.itemShelvingLogGet(filter = """
|{"where":{"or": [ {"shelvingFk": "$shelvingOrItem"}, |{"where":{"or": [ {"shelvingFk": "$shelvingOrItem"},
|{"itemFk": "$shelvingOrItem"}]}, |{"itemFk": "$shelvingOrItem"}]},
|"limit":$records,"order":"created", |"limit":$records,"order":"created",
|"include": [ { "relation": "worker", "scope": { "fields": ["code"]}}, |"include": [ { "relation": "worker", "scope": { "fields": ["code"],
"include": {
"relation": "user",
"scope": {
"fields": ["nickname"]
}
}}},
|{ "relation": "item", "scope": { "fields": ["longName"]}}]} |{ "relation": "item", "scope": { "fields": ["longName"]}}]}
|""".trimMargin()) |""".trimMargin())*/
//println("itemShelvingLogGET")
salix.itemShelvingLogGet(params = listOf(shelvingOrItem).formatWithQuotes()) salix.itemShelvingLogGet(params = listOf(shelvingOrItem).formatWithQuotes())
.enqueue(object : .enqueue(object :
SalixCallback<List<ItemShelvingLog>>(context) { SalixCallback<List<ItemShelvingLog>>(context) {

View File

@ -2,14 +2,16 @@ package es.verdnatura.presentation.view.feature.historicoshelving.model
import es.verdnatura.domain.isoToString import es.verdnatura.domain.isoToString
class ItemShelvingLog(
data class ItemShelvingLog(
var itemFk: Int? = null, var itemFk: Int? = null,
var longName: String? = null, var longName: String? = null,
var shelvingFk: String? = null, var shelvingFk: String? = null,
var visible: Int? = null, var visible: Int? = null,
var accion: String? = null, var accion: String? = null,
var code: String? = null, var code: String? = null,
//Tarea 7168 var user: UserNickname
//Tarea 7168 y 7597
//Falta crear campos anidados //Falta crear campos anidados
) { ) {
var created: String = "" var created: String = ""
@ -19,10 +21,15 @@ class ItemShelvingLog(
} }
class ItemShelvingSaleDateList( data class ItemShelvingSaleDateList(
var list: List<ItemShelvingLog> = listOf() var list: List<ItemShelvingLog> = listOf()
) )
class ItemShelvingLogList( data class ItemShelvingLogList(
var list: List<ItemShelvingLog> = listOf() var list: List<ItemShelvingLog> = listOf()
)
data class UserNickname(
var id:Int ,
var nickname: String
) )

View File

@ -15,7 +15,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
android:orientation="horizontal" android:orientation="horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -27,23 +26,21 @@
android:paddingBottom="@dimen/layout_margin_min" android:paddingBottom="@dimen/layout_margin_min"
> >
<TextView <TextView
android:id="@+id/itemFk" android:id="@+id/itemFk"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:text="@{String.valueOf(item.itemFk)}" android:text="@{String.valueOf(item.itemFk)}"
android:textSize="@dimen/body2" android:textSize="@dimen/body1"
android:textColor="@color/verdnatura_white" android:textColor="@color/verdnatura_white"
android:layout_weight="1" android:layout_weight="1"
android:gravity="start" android:gravity="start"
/> />
<TextView <TextView
android:layout_width="200dp" android:layout_width="200dp"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:text="@{item.longName}" android:text="@{item.longName}"
android:textSize="@dimen/body2" android:textSize="@dimen/body1"
android:textColor="@color/verdnatura_white" android:textColor="@color/verdnatura_white"
android:singleLine="true" android:singleLine="true"
android:layout_weight="1" android:layout_weight="1"
@ -51,17 +48,19 @@
<TextView <TextView
android:visibility="visible" android:visibility="visible"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:text="@{item.shelvingFk}" android:text="@{item.shelvingFk}"
android:textSize="@dimen/body2" android:textSize="@dimen/body1"
android:textColor="@color/verdnatura_white" android:textColor="@color/verdnatura_white"
android:layout_weight="1" android:layout_weight="1"
android:gravity="center"/> android:gravity="center"/>
<TextView <TextView
android:id="@+id/txtVisible"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:text="@{String.valueOf(item.visible)}" android:text="@{String.valueOf(item.visible)}"
android:textSize="@dimen/body2" android:textSize="@dimen/body1"
android:textColor="@color/verdnatura_white" android:textColor="@color/verdnatura_white"
android:layout_weight="1" android:layout_weight="1"
android:gravity="end"/> android:gravity="end"/>
@ -75,35 +74,34 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/verdnatura_black_5" android:background="@color/verdnatura_black_5"
android:paddingStart="@dimen/layout_margin_min" android:paddingTop="@dimen/pasilleros_margin_main_picker"
android:paddingEnd="@dimen/layout_margin_min"
android:paddingTop="@dimen/pasilleros_margin_main_menu"
> >
<TextView <TextView
android:id="@+id/item2" android:id="@+id/item2"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:text="@{item.accion}" android:text="@{item.accion}"
android:textSize="@dimen/body2" android:textSize="@dimen/body1"
android:textColor="@color/verdnatura_white" android:textColor="@color/verdnatura_white"
android:layout_weight="1" android:layout_weight="1"
android:gravity="start" android:gravity="start"
/> />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:text="@{item.created}" android:text="@{item.created}"
android:textSize="@dimen/body2" android:textSize="@dimen/body1"
android:textColor="@color/verdnatura_white" android:textColor="@color/verdnatura_white"
android:layout_weight="1.5" android:layout_weight="1.5"
android:gravity="center"/> android:gravity="center"/>
<TextView <TextView
android:id="@+id/txtNickname"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:text="@{item.code}" android:text="@{item.code}"
android:textSize="@dimen/body2" android:textSize="@dimen/body1"
android:textColor="@color/verdnatura_white" android:textColor="@color/verdnatura_white"
android:layout_weight="0.5" android:layout_weight="0.5"
android:paddingEnd="@dimen/layout_margin_min" android:paddingEnd="@dimen/layout_margin_min"