feat itemShelvingLog #refs 7597

This commit is contained in:
Sergio De la torre 2024-07-10 07:32:52 +02:00
parent 67cd2b1fd2
commit 67bf5a9a1c
5 changed files with 30 additions and 44 deletions

View File

@ -47,15 +47,12 @@ class ItemShelvingLogAdapter(
fun bind(item: ItemShelvingLog) { fun bind(item: ItemShelvingLog) {
binding.apply { binding.apply {
binding.txtNickname.setOnClickListener {
//Tarea 7597 if (item.worker.id != null) openWorker(binding, item.worker.id!!)
/*binding.txtNickname.setOnClickListener { }
openWorker(binding, item.user.id) binding.txtVisible.setOnClickListener {
} if (item.worker.id != null) openWorker(binding, item.worker.id!!)
binding.txtVisible.setOnClickListener { }
openWorker(binding, item.user.id)
}*/
this.item = item this.item = item
@ -63,10 +60,11 @@ class ItemShelvingLogAdapter(
} }
} }
} }
private fun openWorker(binding: ItemShelvinglogRowBinding, id: Int) { private fun openWorker(binding: ItemShelvinglogRowBinding, id: Int) {
onPasillerosItemClickListener.onPasillerosItemClickListener( onPasillerosItemClickListener.onPasillerosItemClickListener(
PasillerosItemVO(title = binding.root.context.getString(R.string.titleUserControlVehicle)), PasillerosItemVO(title = binding.root.context.getString(R.string.titleUserControlVehicle)),
id.toString() id.toString()
) )
} }
} }

View File

@ -62,15 +62,12 @@ class ItemShelvingLogFragment(
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) { if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
if (binding.scanInput.text.toString().isNotEmpty()) { if (binding.scanInput.text.toString().isNotEmpty()) {
//Tarea 7168 //Tarea 7168
/* records = LIMITRECORDSSHELVINGLOG records = LIMITRECORDSSHELVINGLOG
shelving = binding.scanInput.text.toString() shelving = binding.scanInput.text.toString()
viewModel.itemShelvingLogGet( viewModel.itemShelvingLogGet(
shelving, shelving,
records records
)*/ )
viewModel.itemShelvingLogGet(binding.scanInput.text.toString())
itemScan = binding.scanInput.text.toString()
} }
binding.scanInput.setText("") binding.scanInput.setText("")
ma.hideKeyboard(binding.scanInput) ma.hideKeyboard(binding.scanInput)
@ -101,11 +98,11 @@ class ItemShelvingLogFragment(
onPasillerosItemClickListener = pasillerosItemClickListener!! onPasillerosItemClickListener = pasillerosItemClickListener!!
) )
//TAREA 7168 //TAREA 7168
/* if (it.list.size == records) { if (it.list.size == records) {
binding.loadMoreButton.visibility = View.VISIBLE binding.loadMoreButton.visibility = View.VISIBLE
} else { } else {
binding.loadMoreButton.visibility = View.GONE binding.loadMoreButton.visibility = View.GONE
}*/ }
binding.itemshelvinglogRecyclerview.adapter = adapter binding.itemshelvinglogRecyclerview.adapter = adapter
binding.itemshelvinglogRecyclerview.layoutManager = binding.itemshelvinglogRecyclerview.layoutManager =
LinearLayoutManager( LinearLayoutManager(

View File

@ -5,7 +5,6 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.ConstAndValues.LIMITRECORDSSHELVINGLOG import es.verdnatura.domain.ConstAndValues.LIMITRECORDSSHELVINGLOG
import es.verdnatura.domain.SalixCallback import es.verdnatura.domain.SalixCallback
import es.verdnatura.domain.formatWithQuotes
import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.view.feature.historicoshelving.model.ItemShelvingLog import es.verdnatura.presentation.view.feature.historicoshelving.model.ItemShelvingLog
import es.verdnatura.presentation.view.feature.historicoshelving.model.ItemShelvingLogList import es.verdnatura.presentation.view.feature.historicoshelving.model.ItemShelvingLogList
@ -18,24 +17,15 @@ class ItemShelvingLogViewModel(val context: Context) : BaseViewModel(context) {
get() = _itemShelvingLogList get() = _itemShelvingLogList
fun itemShelvingLogGet(shelvingOrItem: String, records: Int = LIMITRECORDSSHELVINGLOG) { fun itemShelvingLogGet(shelvingOrItem: String, records: Int = LIMITRECORDSSHELVINGLOG) {
//tarea 7168 //tarea 7168
//salix.itemShelvingLogGet(params = listOf(vShelvingFK,records).formatWithQuotes()) salix.itemShelvingLogGet(
/* salix.itemShelvingLogGet(filter = """ filter = """{ "where": { "or": [ {"shelvingFk": "$shelvingOrItem"}, {"itemFk": "$shelvingOrItem"} ] },
|{"where":{"or": [ {"shelvingFk": "$shelvingOrItem"}, "limit": $records,
|{"itemFk": "$shelvingOrItem"}]}, "order": "created DESC",
|"limit":$records,"order":"created", "include": [ { "relation": "worker", "scope": { "fields": ["code"]} },
|"include": [ { "relation": "worker", "scope": { "fields": ["code"], { "relation": "item", "scope": { "fields": ["longName"] } } ] }
"include": { """.trim()
"relation": "user", )
"scope": {
"fields": ["nickname"]
}
}}},
|{ "relation": "item", "scope": { "fields": ["longName"]}}]}
|""".trimMargin())*/
//println("itemShelvingLogGET")
salix.itemShelvingLogGet(params = listOf(shelvingOrItem).formatWithQuotes())
.enqueue(object : .enqueue(object :
SalixCallback<List<ItemShelvingLog>>(context) { SalixCallback<List<ItemShelvingLog>>(context) {
override fun onSuccess(response: Response<List<ItemShelvingLog>>) { override fun onSuccess(response: Response<List<ItemShelvingLog>>) {

View File

@ -10,9 +10,8 @@ data class ItemShelvingLog(
var visible: Int? = null, var visible: Int? = null,
var accion: String? = null, var accion: String? = null,
var code: String? = null, var code: String? = null,
var user: UserNickname var worker: Worker,
//Tarea 7168 y 7597 var item:ItemSalix? = null
//Falta crear campos anidados
) { ) {
var created: String = "" var created: String = ""
get() { get() {
@ -21,6 +20,8 @@ data class ItemShelvingLog(
} }
data class ItemSalix(var longName: String?)
data class ItemShelvingSaleDateList( data class ItemShelvingSaleDateList(
var list: List<ItemShelvingLog> = listOf() var list: List<ItemShelvingLog> = listOf()
) )
@ -29,7 +30,7 @@ data class ItemShelvingLogList(
var list: List<ItemShelvingLog> = listOf() var list: List<ItemShelvingLog> = listOf()
) )
data class UserNickname( data class Worker(
var id:Int , var id:Int? ,
var nickname: String var code: String,
) )

View File

@ -39,7 +39,7 @@
<TextView <TextView
android:layout_width="200dp" android:layout_width="200dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:text="@{item.longName}" android:text="@{item.item.longName}"
android:textSize="@dimen/body1" android:textSize="@dimen/body1"
android:textColor="@color/verdnatura_white" android:textColor="@color/verdnatura_white"
android:singleLine="true" android:singleLine="true"
@ -100,7 +100,7 @@
android:id="@+id/txtNickname" android:id="@+id/txtNickname"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:text="@{item.code}" android:text="@{item.worker.code}"
android:textSize="@dimen/body1" android:textSize="@dimen/body1"
android:textColor="@color/verdnatura_white" android:textColor="@color/verdnatura_white"
android:layout_weight="0.5" android:layout_weight="0.5"