diff --git a/app/src/main/java/es/verdnatura/dataStore/DataStoreLocal.kt b/app/src/main/java/es/verdnatura/dataStore/DataStoreLocal.kt index 340415a2..2d030d39 100644 --- a/app/src/main/java/es/verdnatura/dataStore/DataStoreLocal.kt +++ b/app/src/main/java/es/verdnatura/dataStore/DataStoreLocal.kt @@ -24,6 +24,7 @@ import es.verdnatura.domain.ConstAndValues.NUMBEROFWAGONS import es.verdnatura.domain.ConstAndValues.PRINTERFK import es.verdnatura.domain.ConstAndValues.PRINTERFKDEFAULT import es.verdnatura.domain.ConstAndValues.PRINTERNAME +import es.verdnatura.domain.ConstAndValues.RESERVATIONMODE import es.verdnatura.domain.ConstAndValues.SECTORDESCRIP import es.verdnatura.domain.ConstAndValues.SECTORFK import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT @@ -97,6 +98,9 @@ class DataStoreLocal(var mobileApplication: MobileApplication) { editDataStoreKey( NUMBEROFWAGONS, operator.numberOfWagons ) + editDataStoreKey( + RESERVATIONMODE, operator.isOnReservationMode + ) } diff --git a/app/src/main/java/es/verdnatura/domain/ConstAndValues.kt b/app/src/main/java/es/verdnatura/domain/ConstAndValues.kt index 0ea0e910..eb6fd66e 100644 --- a/app/src/main/java/es/verdnatura/domain/ConstAndValues.kt +++ b/app/src/main/java/es/verdnatura/domain/ConstAndValues.kt @@ -64,6 +64,7 @@ object ConstAndValues { const val INVENTORYPARKINGTO = "INVENTORYPARKINGTO" const val INVENTORYPARKINGFROM = "INVENTORYPARKINGFROM" const val LIMITRECORDSSHELVINGLOG = 25 + const val RESERVATIONMODE = "operatorReservationMode" } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginViewModel.kt index 09b6371c..dfbbccad 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginViewModel.kt @@ -300,7 +300,7 @@ class LoginViewModel(val context: Context) : BaseViewModel(context) { workerId: Int ) { val filter = - """{"fields":["itemPackingTypeFk","numberOfWagons","sectorFk","trainFk","labelerFk"],"include":[{"relation":"sector","scope":{"fields":["description","warehouseFk"]}},{"relation":"printer","scope":{"fields":["name"]}},{"relation":"train","scope":{"fields":["name"]}}]}""" + """{"fields":["itemPackingTypeFk","numberOfWagons","sectorFk","trainFk","labelerFk","isOnReservationMode"],"include":[{"relation":"sector","scope":{"fields":["description","warehouseFk"]}},{"relation":"printer","scope":{"fields":["name"]}},{"relation":"train","scope":{"fields":["name"]}}]}""" salix.operator_getData(id = workerId, filter) .enqueue(object : SalixCallback(context) { override fun onError(t: Throwable) { diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/login/model/LoginItemVO.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/login/model/LoginItemVO.kt index ea610609..d2d4727e 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/login/model/LoginItemVO.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/login/model/LoginItemVO.kt @@ -9,6 +9,7 @@ class LoginSalixVO( var isError: Boolean = false, var errorMessage: String = "" ) + data class LoginApp( val user: String, val password: String, @@ -18,6 +19,7 @@ data class LoginApp( val nameApp: String ) + data class LoginAppData( val id: Int, val token: String, @@ -74,15 +76,17 @@ class OperatorSalix( val numberOfWagons: Int = 0, var itemPackingTypeFk: String? = null, val isError: Boolean = false, - var errorMessage: String = "" + var errorMessage: String = "", + val isOnReservationMode: Boolean = false ) data class Sector( - val id: Int=0, - val description: String="", - val warehouseFk: Int=0, + val id: Int = 0, + val description: String = "", + val warehouseFk: Int = 0, val backupPrinterFk: Int? ) + data class Printer(val id: Int, val name: String) data class Train(val id: Int, val name: String) @@ -129,4 +133,9 @@ class workerId( val Id: Int? = null, var isError: Boolean = false, var errorMessage: String = "" +) + +data class NameWorker( + val firstName : String, + val lastName :String ) \ No newline at end of file diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt index 11600221..87fd46a6 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt @@ -4,6 +4,7 @@ import android.annotation.SuppressLint import android.content.Context import es.verdnatura.MobileApplication import es.verdnatura.R +import es.verdnatura.domain.ConstAndValues.RESERVATIONMODE import es.verdnatura.presentation.base.BaseViewModel import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO @@ -14,6 +15,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) { val pasillerositem: List get() = _pasillerositem val userId = (contextApp as MobileApplication).userId + val isOnReservationMode = (contextApp as MobileApplication).dataStoreApp.readDataStoreKey(RESERVATIONMODE) fun inititializeDefaultData() { @@ -537,31 +539,35 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) { fun inititializeDefaultPrevia() { - _pasillerositem.add( - PasillerosItemVO( - 7, - R.drawable.ic_previous_presacador, - contextApp.getString(R.string.titlePrePicker), - R.string.titlePrePicker, - contextApp.getString( - R.string.titlePickerDescrip + if (isOnReservationMode || userId == 19591){ + // if (userId == 19591 || userId == 18404 || userId == 9) { + _pasillerositem.add( + PasillerosItemVO( + 7, + R.drawable.ic_previous_presacador, + contextApp.getString(R.string.titlePrePickerTest), + R.string.titlePrePickerTest, + contextApp.getString( + R.string.titlePickerDescrip + ) + ) ) - ) - ) - - if (userId == 19591 || userId == 18404) { + // } + }else{ _pasillerositem.add( PasillerosItemVO( 7, R.drawable.ic_previous_presacador, - contextApp.getString(R.string.titlePrePickerTest), - R.string.titlePrePickerTest, + contextApp.getString(R.string.titlePrePicker), + R.string.titlePrePicker, contextApp.getString( R.string.titlePickerDescrip ) ) ) } + + _pasillerositem.add( PasillerosItemVO( 7,