feat issues refs #6810

This commit is contained in:
Sergio De la torre 2024-06-27 16:23:49 +02:00
parent fb421bd6cb
commit a26a1b2198
3 changed files with 26 additions and 15 deletions

View File

@ -12,6 +12,7 @@ import com.google.gson.Gson
import es.verdnatura.R
import es.verdnatura.databinding.FragmentItemCardBinding
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFK
import es.verdnatura.domain.notNull
import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
@ -163,7 +164,7 @@ class ItemCardFragment(
if (binding.editItemFk.text.toString().isNotEmpty()) try {
getItemCard(
itemScanValue(
binding.editItemFk.text.toString(), arrayOf("buy"), "more"
binding.editItemFk.text.toString(), arrayOf("buy"), "more"
).toString()
)
} catch (ex: Exception) {
@ -227,18 +228,20 @@ class ItemCardFragment(
responseItemCard.observe(viewLifecycleOwner) {
getItemCard(itemInfoG!!.id.toString())
}
addressLosesList.observe(viewLifecycleOwner) {
if (it.list.isEmpty()) {
ma.messageWithSound(
getString(R.string.NotAddress), isError = true, isPlayed = false
)
} else {
showDialogTrashFault(it.list)
loadAddressLosesList.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull {
if (it.list.isEmpty()) {
ma.messageWithSound(
getString(R.string.NotAddress), isError = true, isPlayed = false
)
} else {
showDialogTrashFault(it.list)
}
}
}
}
}
@ -515,7 +518,6 @@ class ItemCardFragment(
}
private fun showDialogTrashFault(listAddress: List<AddressLoses>) {
customDynamic.setTitle("")

View File

@ -3,9 +3,11 @@ package es.verdnatura.presentation.view.feature.articulo.fragment
import android.content.Context
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.map
import es.verdnatura.domain.SalixCallback
import es.verdnatura.domain.formatWithQuotes
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ItemBarCodeSalix
import es.verdnatura.presentation.common.ItemDiscardSalixShortage
import es.verdnatura.presentation.common.ResponseItemVO
@ -30,6 +32,11 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
val responseItemCard: LiveData<Any>
get() = _responseItemCard
val loadResponseItemCard: LiveData<Event<Any>> =
_responseItemCard.map { Event(it) }
private val _responseCode by lazy { MutableLiveData<String>() }
val responseCode: LiveData<String>
get() = _responseCode
@ -42,6 +49,8 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
val addressLosesList: LiveData<AddressLosesList>
get() = _addressLosesList
val loadAddressLosesList: LiveData<Event<AddressLosesList>> = _addressLosesList.map { Event(it) }
fun getItemCard(
itemFk: Number,
warehouseFk: Int,

View File

@ -44,7 +44,7 @@
android:id="@+id/item_version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/layout_margin_3"
android:layout_marginStart="@dimen/default_layout_margin"
android:text=""
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body1" />
@ -69,7 +69,7 @@
android:id="@+id/user_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/layout_margin_3"
android:layout_marginStart="@dimen/default_layout_margin"
android:text=""
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body1" />
@ -93,7 +93,7 @@
android:id="@+id/androidid_text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/layout_margin_3"
android:layout_marginStart="@dimen/default_layout_margin"
android:text=""
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body1"
@ -118,7 +118,7 @@
android:id="@+id/serial_number"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/layout_margin_3"
android:layout_marginStart="@dimen/default_layout_margin"
android:text=""
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body1" />