feat issues refs #6810
This commit is contained in:
parent
fb421bd6cb
commit
a26a1b2198
|
@ -12,6 +12,7 @@ import com.google.gson.Gson
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentItemCardBinding
|
import es.verdnatura.databinding.FragmentItemCardBinding
|
||||||
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFK
|
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFK
|
||||||
|
import es.verdnatura.domain.notNull
|
||||||
import es.verdnatura.domain.toast
|
import es.verdnatura.domain.toast
|
||||||
import es.verdnatura.presentation.base.BaseFragment
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
|
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
|
||||||
|
@ -163,7 +164,7 @@ class ItemCardFragment(
|
||||||
if (binding.editItemFk.text.toString().isNotEmpty()) try {
|
if (binding.editItemFk.text.toString().isNotEmpty()) try {
|
||||||
getItemCard(
|
getItemCard(
|
||||||
itemScanValue(
|
itemScanValue(
|
||||||
binding.editItemFk.text.toString(), arrayOf("buy"), "more"
|
binding.editItemFk.text.toString(), arrayOf("buy"), "more"
|
||||||
).toString()
|
).toString()
|
||||||
)
|
)
|
||||||
} catch (ex: Exception) {
|
} catch (ex: Exception) {
|
||||||
|
@ -227,18 +228,20 @@ class ItemCardFragment(
|
||||||
responseItemCard.observe(viewLifecycleOwner) {
|
responseItemCard.observe(viewLifecycleOwner) {
|
||||||
getItemCard(itemInfoG!!.id.toString())
|
getItemCard(itemInfoG!!.id.toString())
|
||||||
}
|
}
|
||||||
addressLosesList.observe(viewLifecycleOwner) {
|
|
||||||
|
|
||||||
if (it.list.isEmpty()) {
|
loadAddressLosesList.observe(viewLifecycleOwner) { event ->
|
||||||
ma.messageWithSound(
|
event.getContentIfNotHandled().notNull {
|
||||||
getString(R.string.NotAddress), isError = true, isPlayed = false
|
|
||||||
)
|
if (it.list.isEmpty()) {
|
||||||
} else {
|
ma.messageWithSound(
|
||||||
showDialogTrashFault(it.list)
|
getString(R.string.NotAddress), isError = true, isPlayed = false
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
showDialogTrashFault(it.list)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -515,7 +518,6 @@ class ItemCardFragment(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun showDialogTrashFault(listAddress: List<AddressLoses>) {
|
private fun showDialogTrashFault(listAddress: List<AddressLoses>) {
|
||||||
|
|
||||||
customDynamic.setTitle("")
|
customDynamic.setTitle("")
|
||||||
|
|
|
@ -3,9 +3,11 @@ package es.verdnatura.presentation.view.feature.articulo.fragment
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import androidx.lifecycle.map
|
||||||
import es.verdnatura.domain.SalixCallback
|
import es.verdnatura.domain.SalixCallback
|
||||||
import es.verdnatura.domain.formatWithQuotes
|
import es.verdnatura.domain.formatWithQuotes
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
|
import es.verdnatura.presentation.common.Event
|
||||||
import es.verdnatura.presentation.common.ItemBarCodeSalix
|
import es.verdnatura.presentation.common.ItemBarCodeSalix
|
||||||
import es.verdnatura.presentation.common.ItemDiscardSalixShortage
|
import es.verdnatura.presentation.common.ItemDiscardSalixShortage
|
||||||
import es.verdnatura.presentation.common.ResponseItemVO
|
import es.verdnatura.presentation.common.ResponseItemVO
|
||||||
|
@ -30,6 +32,11 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
val responseItemCard: LiveData<Any>
|
val responseItemCard: LiveData<Any>
|
||||||
get() = _responseItemCard
|
get() = _responseItemCard
|
||||||
|
|
||||||
|
val loadResponseItemCard: LiveData<Event<Any>> =
|
||||||
|
_responseItemCard.map { Event(it) }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private val _responseCode by lazy { MutableLiveData<String>() }
|
private val _responseCode by lazy { MutableLiveData<String>() }
|
||||||
val responseCode: LiveData<String>
|
val responseCode: LiveData<String>
|
||||||
get() = _responseCode
|
get() = _responseCode
|
||||||
|
@ -42,6 +49,8 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
val addressLosesList: LiveData<AddressLosesList>
|
val addressLosesList: LiveData<AddressLosesList>
|
||||||
get() = _addressLosesList
|
get() = _addressLosesList
|
||||||
|
|
||||||
|
val loadAddressLosesList: LiveData<Event<AddressLosesList>> = _addressLosesList.map { Event(it) }
|
||||||
|
|
||||||
fun getItemCard(
|
fun getItemCard(
|
||||||
itemFk: Number,
|
itemFk: Number,
|
||||||
warehouseFk: Int,
|
warehouseFk: Int,
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
android:id="@+id/item_version"
|
android:id="@+id/item_version"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="@dimen/layout_margin_3"
|
android:layout_marginStart="@dimen/default_layout_margin"
|
||||||
android:text=""
|
android:text=""
|
||||||
android:textColor="@color/verdnatura_white"
|
android:textColor="@color/verdnatura_white"
|
||||||
android:textSize="@dimen/body1" />
|
android:textSize="@dimen/body1" />
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
android:id="@+id/user_text"
|
android:id="@+id/user_text"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="@dimen/layout_margin_3"
|
android:layout_marginStart="@dimen/default_layout_margin"
|
||||||
android:text=""
|
android:text=""
|
||||||
android:textColor="@color/verdnatura_white"
|
android:textColor="@color/verdnatura_white"
|
||||||
android:textSize="@dimen/body1" />
|
android:textSize="@dimen/body1" />
|
||||||
|
@ -93,7 +93,7 @@
|
||||||
android:id="@+id/androidid_text"
|
android:id="@+id/androidid_text"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginStart="@dimen/layout_margin_3"
|
android:layout_marginStart="@dimen/default_layout_margin"
|
||||||
android:text=""
|
android:text=""
|
||||||
android:textColor="@color/verdnatura_white"
|
android:textColor="@color/verdnatura_white"
|
||||||
android:textSize="@dimen/body1"
|
android:textSize="@dimen/body1"
|
||||||
|
@ -118,7 +118,7 @@
|
||||||
android:id="@+id/serial_number"
|
android:id="@+id/serial_number"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginStart="@dimen/layout_margin_3"
|
android:layout_marginStart="@dimen/default_layout_margin"
|
||||||
android:text=""
|
android:text=""
|
||||||
android:textColor="@color/verdnatura_white"
|
android:textColor="@color/verdnatura_white"
|
||||||
android:textSize="@dimen/body1" />
|
android:textSize="@dimen/body1" />
|
||||||
|
|
Loading…
Reference in New Issue