feat: refactorResponse Claim refs #7827
This commit is contained in:
parent
da3bff7f17
commit
c20b7b1b5e
|
@ -70,19 +70,6 @@ class ClaimUbicationFragment(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun observeViewModel() {
|
|
||||||
|
|
||||||
with(viewModel) {
|
|
||||||
responseadd.observe(viewLifecycleOwner) {
|
|
||||||
customDialogList.dismiss()
|
|
||||||
listClaims.clear()
|
|
||||||
showInputClaim()
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getTextToPosition(tagsScaned: Int): String {
|
private fun getTextToPosition(tagsScaned: Int): String {
|
||||||
var message = getString(R.string.dataCompllete)
|
var message = getString(R.string.dataCompllete)
|
||||||
when (tagsScaned) {
|
when (tagsScaned) {
|
||||||
|
@ -135,6 +122,8 @@ class ClaimUbicationFragment(
|
||||||
customDialogList.getValue().uppercase()
|
customDialogList.getValue().uppercase()
|
||||||
)
|
)
|
||||||
customDialogList.dismiss()
|
customDialogList.dismiss()
|
||||||
|
listClaims.clear()
|
||||||
|
showInputClaim()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
getString(R.string.errorInput).toast(requireContext())
|
getString(R.string.errorInput).toast(requireContext())
|
||||||
listClaims.clear()
|
listClaims.clear()
|
||||||
|
|
|
@ -1,37 +1,15 @@
|
||||||
package es.verdnatura.presentation.view.feature.claim.fragment.ubication
|
package es.verdnatura.presentation.view.feature.claim.fragment.ubication
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.lifecycle.LiveData
|
|
||||||
import androidx.lifecycle.MutableLiveData
|
|
||||||
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.base.getMessageFromAllResponse
|
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
|
||||||
import es.verdnatura.presentation.common.ResponseItemVO
|
|
||||||
import retrofit2.Response
|
|
||||||
|
|
||||||
class ClaimViewModel(val context: Context) : BaseViewModel(context) {
|
class ClaimViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
private val _responseadd by lazy { MutableLiveData<ResponseItemVO>() }
|
|
||||||
val responseadd: LiveData<ResponseItemVO>
|
|
||||||
get() = _responseadd
|
|
||||||
|
|
||||||
fun itemShelvingAddByClaim(claimFK: Int, shelvingFK: String) {
|
fun itemShelvingAddByClaim(claimFK: Int, shelvingFK: String) {
|
||||||
salix.itemShelvingAddByClaim(arrayListOf(claimFK, shelvingFK).formatWithQuotes())
|
salix.itemShelvingAddByClaim(arrayListOf(claimFK, shelvingFK).formatWithQuotes())
|
||||||
.enqueue(object : SalixCallback<Unit>(context) {
|
.enqueue(object : SalixCallback<Unit>(context) {
|
||||||
override fun onSuccess(response: Response<Unit>) {
|
|
||||||
|
|
||||||
_responseadd.value = ResponseItemVO(
|
|
||||||
isError = false,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
super.onSuccess(response)
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue