diff --git a/app/src/main/java/es/verdnatura/di/viewModelModule.kt b/app/src/main/java/es/verdnatura/di/viewModelModule.kt index 3ce5545a..967fe9f8 100644 --- a/app/src/main/java/es/verdnatura/di/viewModelModule.kt +++ b/app/src/main/java/es/verdnatura/di/viewModelModule.kt @@ -4,6 +4,7 @@ import es.verdnatura.presentation.view.feature.ajustes.fragment.AjustesViewModel import es.verdnatura.presentation.view.feature.articulo.fragment.ItemCardViewModel import es.verdnatura.presentation.view.feature.buffer.fragment.BufferFragmentViewModel import es.verdnatura.presentation.view.feature.buscaritem.fragment.BuscarItemViewModel +import es.verdnatura.presentation.view.feature.category.ChangeCategoryViewModel import es.verdnatura.presentation.view.feature.claim.fragment.ubication.ClaimViewModel import es.verdnatura.presentation.view.feature.collection.fragment.CollectionViewModel import es.verdnatura.presentation.view.feature.controlador.fragment.ControladorViewModel @@ -29,11 +30,12 @@ import es.verdnatura.presentation.view.feature.paletizador.fragment.PalletScanVi import es.verdnatura.presentation.view.feature.parking.fragment.ParkingViewModel import es.verdnatura.presentation.view.feature.pasillero.fragment.PasilleroViewModel import es.verdnatura.presentation.view.feature.photos.fragment.PhotosViewModel -import es.verdnatura.presentation.view.feature.sacador.fragment.showticket.ShowTicketViewModel import es.verdnatura.presentation.view.feature.presacador.fragment.PreSacadorViewModel import es.verdnatura.presentation.view.feature.qr.QrFragmentViewModel import es.verdnatura.presentation.view.feature.sacador.fragment.SacadorViewModel +import es.verdnatura.presentation.view.feature.sacador.fragment.showticket.ShowTicketViewModel import es.verdnatura.presentation.view.feature.ticket.fragment.TicketViewModel +import es.verdnatura.presentation.view.feature.truck.fragment.RoadMapListViewModel import es.verdnatura.presentation.view.feature.ubicador.fragment.AutomaticAddItemViewModel import es.verdnatura.presentation.view.feature.ubicador.fragment.UbicadorViewModel import org.koin.android.ext.koin.androidContext @@ -42,7 +44,6 @@ import org.koin.dsl.module val viewModelModule = module { - /* viewModel { WorkermistakeViewModel() }*/ @@ -198,4 +199,10 @@ val viewModelModule = module { viewModel { TicketViewModel(androidContext()) } + viewModel { + RoadMapListViewModel(androidContext()) + } + viewModel { + ChangeCategoryViewModel(androidContext()) + } } \ No newline at end of file diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/category/ChangeCategoryViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/category/ChangeCategoryViewModel.kt new file mode 100644 index 00000000..acd589e1 --- /dev/null +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/category/ChangeCategoryViewModel.kt @@ -0,0 +1,65 @@ +package es.verdnatura.presentation.view.feature.category + +import android.content.Context +import androidx.lifecycle.LiveData +import androidx.lifecycle.MutableLiveData +import es.verdnatura.domain.SalixCallback +import es.verdnatura.domain.formatWithQuotes +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 es.verdnatura.presentation.view.feature.articulo.model.ItemDetails +import retrofit2.Response + +class ChangeCategoryViewModel(val context: Context) : BaseViewModel(context) { + private val _itemDetails by lazy { MutableLiveData() } + val itemDetails: LiveData = _itemDetails + + private val _responseDevalue by lazy { MutableLiveData() } + var responseDevalue: LiveData = _responseDevalue + + private val _responseItem by lazy { MutableLiveData() } + var responseItem: LiveData = _responseItem + + fun itemDevalueA2( + itemFk: Long, shelvingFk: String, buyingValue: Double, quantity: Int + ) { + salix.itemDevalueA2(params = arrayListOf(itemFk, shelvingFk, buyingValue, quantity).formatWithQuotes()) + .enqueue(object : SalixCallback(context) { + override fun onSuccess(response: Response) { + _responseDevalue.value = true + super.onSuccess(response) + } + + override fun onError(t: Throwable) { + _responseItem.value = ResponseItemVO( + isError = true, errorMessage = getMessageFromAllResponse( + nameofFunction(this), t.message!! + ) + ) + } + }) + } + + fun itemShelvingGetItemDetails( + barcode: Long, shelvingFk: String + ) { + salix.itemShelvingGetItemDetails( + params = arrayListOf( + barcode, + shelvingFk + ).formatWithQuotes() + ) + .enqueue(object : SalixCallback>(context) { + override fun onSuccess(response: Response>) { + response.body()?.get(0).let { + _itemDetails.value = it + } + + } + + + }) + } +} \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 893c5eb4..ef9e9f9c 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -37,7 +37,12 @@ #1a1a1a #333333 + + #a3d131 +