feat itemShelvingLog #refs 7597
This commit is contained in:
parent
67cd2b1fd2
commit
67bf5a9a1c
|
@ -47,15 +47,12 @@ class ItemShelvingLogAdapter(
|
|||
fun bind(item: ItemShelvingLog) {
|
||||
binding.apply {
|
||||
|
||||
|
||||
//Tarea 7597
|
||||
/*binding.txtNickname.setOnClickListener {
|
||||
openWorker(binding, item.user.id)
|
||||
}
|
||||
binding.txtVisible.setOnClickListener {
|
||||
openWorker(binding, item.user.id)
|
||||
}*/
|
||||
|
||||
binding.txtNickname.setOnClickListener {
|
||||
if (item.worker.id != null) openWorker(binding, item.worker.id!!)
|
||||
}
|
||||
binding.txtVisible.setOnClickListener {
|
||||
if (item.worker.id != null) openWorker(binding, item.worker.id!!)
|
||||
}
|
||||
|
||||
|
||||
this.item = item
|
||||
|
@ -63,10 +60,11 @@ class ItemShelvingLogAdapter(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun openWorker(binding: ItemShelvinglogRowBinding, id: Int) {
|
||||
onPasillerosItemClickListener.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(title = binding.root.context.getString(R.string.titleUserControlVehicle)),
|
||||
id.toString()
|
||||
id.toString()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,15 +62,12 @@ class ItemShelvingLogFragment(
|
|||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
||||
if (binding.scanInput.text.toString().isNotEmpty()) {
|
||||
//Tarea 7168
|
||||
/* records = LIMITRECORDSSHELVINGLOG
|
||||
records = LIMITRECORDSSHELVINGLOG
|
||||
shelving = binding.scanInput.text.toString()
|
||||
viewModel.itemShelvingLogGet(
|
||||
shelving,
|
||||
records
|
||||
)*/
|
||||
|
||||
viewModel.itemShelvingLogGet(binding.scanInput.text.toString())
|
||||
itemScan = binding.scanInput.text.toString()
|
||||
)
|
||||
}
|
||||
binding.scanInput.setText("")
|
||||
ma.hideKeyboard(binding.scanInput)
|
||||
|
@ -101,11 +98,11 @@ class ItemShelvingLogFragment(
|
|||
onPasillerosItemClickListener = pasillerosItemClickListener!!
|
||||
)
|
||||
//TAREA 7168
|
||||
/* if (it.list.size == records) {
|
||||
if (it.list.size == records) {
|
||||
binding.loadMoreButton.visibility = View.VISIBLE
|
||||
} else {
|
||||
binding.loadMoreButton.visibility = View.GONE
|
||||
}*/
|
||||
}
|
||||
binding.itemshelvinglogRecyclerview.adapter = adapter
|
||||
binding.itemshelvinglogRecyclerview.layoutManager =
|
||||
LinearLayoutManager(
|
||||
|
|
|
@ -5,7 +5,6 @@ import androidx.lifecycle.LiveData
|
|||
import androidx.lifecycle.MutableLiveData
|
||||
import es.verdnatura.domain.ConstAndValues.LIMITRECORDSSHELVINGLOG
|
||||
import es.verdnatura.domain.SalixCallback
|
||||
import es.verdnatura.domain.formatWithQuotes
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.view.feature.historicoshelving.model.ItemShelvingLog
|
||||
import es.verdnatura.presentation.view.feature.historicoshelving.model.ItemShelvingLogList
|
||||
|
@ -18,24 +17,15 @@ class ItemShelvingLogViewModel(val context: Context) : BaseViewModel(context) {
|
|||
get() = _itemShelvingLogList
|
||||
|
||||
fun itemShelvingLogGet(shelvingOrItem: String, records: Int = LIMITRECORDSSHELVINGLOG) {
|
||||
|
||||
//tarea 7168
|
||||
//salix.itemShelvingLogGet(params = listOf(vShelvingFK,records).formatWithQuotes())
|
||||
/* salix.itemShelvingLogGet(filter = """
|
||||
|{"where":{"or": [ {"shelvingFk": "$shelvingOrItem"},
|
||||
|{"itemFk": "$shelvingOrItem"}]},
|
||||
|"limit":$records,"order":"created",
|
||||
|"include": [ { "relation": "worker", "scope": { "fields": ["code"],
|
||||
"include": {
|
||||
"relation": "user",
|
||||
"scope": {
|
||||
"fields": ["nickname"]
|
||||
}
|
||||
}}},
|
||||
|{ "relation": "item", "scope": { "fields": ["longName"]}}]}
|
||||
|""".trimMargin())*/
|
||||
//println("itemShelvingLogGET")
|
||||
salix.itemShelvingLogGet(params = listOf(shelvingOrItem).formatWithQuotes())
|
||||
salix.itemShelvingLogGet(
|
||||
filter = """{ "where": { "or": [ {"shelvingFk": "$shelvingOrItem"}, {"itemFk": "$shelvingOrItem"} ] },
|
||||
"limit": $records,
|
||||
"order": "created DESC",
|
||||
"include": [ { "relation": "worker", "scope": { "fields": ["code"]} },
|
||||
{ "relation": "item", "scope": { "fields": ["longName"] } } ] }
|
||||
""".trim()
|
||||
)
|
||||
.enqueue(object :
|
||||
SalixCallback<List<ItemShelvingLog>>(context) {
|
||||
override fun onSuccess(response: Response<List<ItemShelvingLog>>) {
|
||||
|
|
|
@ -10,9 +10,8 @@ data class ItemShelvingLog(
|
|||
var visible: Int? = null,
|
||||
var accion: String? = null,
|
||||
var code: String? = null,
|
||||
var user: UserNickname
|
||||
//Tarea 7168 y 7597
|
||||
//Falta crear campos anidados
|
||||
var worker: Worker,
|
||||
var item:ItemSalix? = null
|
||||
) {
|
||||
var created: String = ""
|
||||
get() {
|
||||
|
@ -21,6 +20,8 @@ data class ItemShelvingLog(
|
|||
|
||||
}
|
||||
|
||||
data class ItemSalix(var longName: String?)
|
||||
|
||||
data class ItemShelvingSaleDateList(
|
||||
var list: List<ItemShelvingLog> = listOf()
|
||||
)
|
||||
|
@ -29,7 +30,7 @@ data class ItemShelvingLogList(
|
|||
var list: List<ItemShelvingLog> = listOf()
|
||||
)
|
||||
|
||||
data class UserNickname(
|
||||
var id:Int ,
|
||||
var nickname: String
|
||||
)
|
||||
data class Worker(
|
||||
var id:Int? ,
|
||||
var code: String,
|
||||
)
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
<TextView
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="match_parent"
|
||||
android:text="@{item.longName}"
|
||||
android:text="@{item.item.longName}"
|
||||
android:textSize="@dimen/body1"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:singleLine="true"
|
||||
|
@ -100,7 +100,7 @@
|
|||
android:id="@+id/txtNickname"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:text="@{item.code}"
|
||||
android:text="@{item.worker.code}"
|
||||
android:textSize="@dimen/body1"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:layout_weight="0.5"
|
||||
|
|
Loading…
Reference in New Issue