diff --git a/.idea/misc.xml b/.idea/misc.xml index b469062f..686069a9 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,19 +4,29 @@ diff --git a/app/build.gradle b/app/build.gradle index eca02c38..8de11e84 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -14,9 +14,11 @@ android { applicationId "es.verdnatura" minSdkVersion 21 targetSdkVersion 30 - versionCode 109 //para pruebas sacadores - versionName "8" //VERSION CODE 109, obligado seleccionar impresora, controlador sube el recyclerViewer, controlador ordenado por picked, mensaje error a collectioNew - + versionCode 112 + versionName "8.2" //versionCode 112 : desmarcar, previa update quantity dels carros, afegir P, etc.., impressores + //versionName "8.1" //versionCode 111 de proves . Instal.lat a Ismael y Juan + //versionName "8.1" //VERSION CODE 110, SOLO A V SE LE DESPLAZA LAS LINEAS EN PANTALLA CONTROLADOR + //versionName "8" //VERSION CODE 109, obligado seleccionar impresora, controlador sube el recyclerViewer, controlador ordenado por picked, mensaje error a collectioNew testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json index 49d9bcfe..e94d469f 100644 --- a/app/release/output-metadata.json +++ b/app/release/output-metadata.json @@ -11,8 +11,8 @@ "type": "SINGLE", "filters": [], "attributes": [], - "versionCode": 109, - "versionName": "8", + "versionCode": 112, + "versionName": "8.2", "outputFile": "app-release.apk" } ], diff --git a/app/release/vn-picking_all.apk b/app/release/vn-picking_all.apk new file mode 100644 index 00000000..43381ddb Binary files /dev/null and b/app/release/vn-picking_all.apk differ diff --git a/app/src/main/java/es/verdnatura/domain/ApiSalixUtils.kt b/app/src/main/java/es/verdnatura/domain/ApiSalixUtils.kt index 31ba5203..41601483 100644 --- a/app/src/main/java/es/verdnatura/domain/ApiSalixUtils.kt +++ b/app/src/main/java/es/verdnatura/domain/ApiSalixUtils.kt @@ -6,7 +6,7 @@ import retrofit2.converter.gson.GsonConverterFactory class ApiSalixUtils { companion object { //const val BASE_URL:String = "http://192.168.1.155:9009/" - //const val BASE_URL: String = "https://test-salix.verdnatura.es/api/" + // const val BASE_URL: String = "https://test-salix.verdnatura.es/api/" const val BASE_URL: String = "https://salix.verdnatura.es/api/" fun getApiService(): SalixService { val salixRetrofit = Retrofit.Builder().baseUrl(BASE_URL).addConverterFactory( diff --git a/app/src/main/java/es/verdnatura/domain/ApiUtils.kt b/app/src/main/java/es/verdnatura/domain/ApiUtils.kt index f366b91e..7584f6d0 100644 --- a/app/src/main/java/es/verdnatura/domain/ApiUtils.kt +++ b/app/src/main/java/es/verdnatura/domain/ApiUtils.kt @@ -12,8 +12,10 @@ import java.util.concurrent.TimeUnit class ApiUtils { companion object { //const val BASE_URL:String = "http://192.168.1.54:8009/" - const val BASE_URL: String = "https://app.verdnatura.es/" - //const val BASE_URL:String = "https://test-app.verdnatura.es/" + const val BASE_URL:String = "https://10.1.3.102/" + + //const val BASE_URL: String = "https://app.verdnatura.es/" + fun getApiService(context: Context): VerdnaturaService { diff --git a/app/src/main/java/es/verdnatura/domain/GetItemCardUserCase.kt b/app/src/main/java/es/verdnatura/domain/GetItemCardUserCase.kt index 09bc8984..c3eba5fe 100644 --- a/app/src/main/java/es/verdnatura/domain/GetItemCardUserCase.kt +++ b/app/src/main/java/es/verdnatura/domain/GetItemCardUserCase.kt @@ -1,11 +1,14 @@ package es.verdnatura.domain import android.content.Context +import es.verdnatura.presentation.common.itemBarCodeSalix +import es.verdnatura.presentation.common.itemPackingTypeSalix import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType import es.verdnatura.presentation.view.feature.articulo.model.ItemProposal import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoVO import retrofit2.Call +import java.security.AuthProvider class GetItemCardUserCase(context: Context) : RestClient(context) { @@ -64,6 +67,13 @@ class GetItemCardUserCase(context: Context) : RestClient(context) { ) } + fun getItemPackingTypeSalix(token:String): Call> { + return salixClient!!.get_ItemPackingType( + content_type = "application/json", + authorization = token + ) + } + fun itemStockUpdate( usuario: String, password: String, @@ -195,6 +205,20 @@ class GetItemCardUserCase(context: Context) : RestClient(context) { ) } + fun updatePackingTypeSalix( + token:String, + itemFk: String, + ItemPackingType: String + ): Call { + val params=itemPackingTypeSalix(ItemPackingType) + + return salixClient!!.update_ItemPackingType( + content_type ="application/json", + authorization = token, + itemFk = itemFk, + params = params + ) + } fun itemSaveMin( usuario: String, password: String, @@ -255,6 +279,22 @@ class GetItemCardUserCase(context: Context) : RestClient(context) { ) } + + fun barcodes_editSalix( + token:String, + itemFk: String, + value: String, + + ): Call { + + return salixClient!!.barcodes_edit( + content_type = "application/json", + authorization=token, + itemBarCodeSalix(itemFk,value) + ) + } + + fun itemDiary( usuario: String, password: String, diff --git a/app/src/main/java/es/verdnatura/domain/GetLoginUserCase.kt b/app/src/main/java/es/verdnatura/domain/GetLoginUserCase.kt index 7f32ee18..8b947216 100644 --- a/app/src/main/java/es/verdnatura/domain/GetLoginUserCase.kt +++ b/app/src/main/java/es/verdnatura/domain/GetLoginUserCase.kt @@ -79,7 +79,7 @@ class GetLoginUserCase(context: Context) : RestClient(context) fun sendChekingPresence(token:String,workerId:Int,message:String) : Call{ - var working_in_test=false + var working_in_test=false // Enviar a grupo test Android o a los usuarios if (!working_in_test) { diff --git a/app/src/main/java/es/verdnatura/domain/GetSacadorControladorUserCase.kt b/app/src/main/java/es/verdnatura/domain/GetSacadorControladorUserCase.kt index 6c7b2a58..21dd2ef7 100644 --- a/app/src/main/java/es/verdnatura/domain/GetSacadorControladorUserCase.kt +++ b/app/src/main/java/es/verdnatura/domain/GetSacadorControladorUserCase.kt @@ -1,9 +1,13 @@ package es.verdnatura.domain import android.content.Context +import com.google.gson.JsonObject +import es.verdnatura.presentation.view.feature.collection.SalixSaleQuantity +import es.verdnatura.presentation.view.feature.login.model.workerId import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeVO import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO +import org.json.JSONObject import retrofit2.Call class GetSacadorControladorUserCase(context: Context) : RestClient(context) { @@ -42,6 +46,19 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) { ) } + fun sip_getExtensionSalix( + token:String, + WorkerId: String + ): Call { + val params: ArrayList = ArrayList() + params.add(WorkerId) + return salixClient!!.sip_getExtension( + content_type = "application/json", + authorization = token, + idWorker=WorkerId + ) + } + fun sip_getExtension( usuario: String, password: String, @@ -58,6 +75,8 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) { params ) } + + fun ticket_checkFullyControlled( usuario: String, password: String, @@ -125,7 +144,7 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) { fun collectionGetSalix(token:String): Call> { // val params:ArrayList = ArrayList() - return salixClient!!.getCollectionSalix(content_type = "application/json",token) + return salixClient!!.getCollectionSalix(content_type = "application/json", authorization = token) } fun saleTrackingReplace( @@ -386,7 +405,19 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) { params ) } - + fun itemShelving_updateFromSale(usuario: String, password: String, saleFk: String,visible:String): Call { + val params: ArrayList = ArrayList() + params.add(saleFk) + params.add(visible) + return restClient!!.itemShelving_updateFromSale( + "json", + "1", + usuario, + password, + "application/json", + params + ) + } fun ticket_setState( usuario: String, password: String, @@ -419,6 +450,16 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) { ) } + fun getIdFromCodeSalix(token: String, barCodeValue: String): Call { + + return salixClient!!.barcodes_toitem( + "application/json", + authorization = token, + barCodeValue=barCodeValue + + ) + } + fun collectionIncreaseQuantity( usuario: String, password: String, @@ -438,6 +479,24 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) { ) } + fun collectionIncreaseQuantitySalix( + + token: String, + saleFk: String, + quantity: String + ): Call { + + + return salixClient!!.collectionIncreaseQuantitySalix( + "json", + "1", + token, + "application/json", + SalixSaleQuantity(saleId = saleFk.toInt(), quantity = quantity.toInt()) + + ) + } + fun saleMistakeAdd( usuario: String, password: String, diff --git a/app/src/main/java/es/verdnatura/domain/GetUbicadorUserCase.kt b/app/src/main/java/es/verdnatura/domain/GetUbicadorUserCase.kt index 2e3937ec..861c4471 100644 --- a/app/src/main/java/es/verdnatura/domain/GetUbicadorUserCase.kt +++ b/app/src/main/java/es/verdnatura/domain/GetUbicadorUserCase.kt @@ -28,21 +28,17 @@ class GetUbicadorUserCase(context: Context) : RestClient(context) { password: String, shelving: String, item: String, - deep: String, quantity: String, packing: String, warehouse: String, - level: String, grouping:String ): Call { val params: ArrayList = ArrayList() params.add(shelving) params.add(item) - params.add(deep) params.add(quantity) params.add(packing) params.add(warehouse) - params.add(level) params.add(grouping) return restClient!!.itemShelvingMake( "json", @@ -93,16 +89,12 @@ class GetUbicadorUserCase(context: Context) : RestClient(context) { password: String, shelving: String, items: List, - deep: String, - warehouse: String, - level: String + warehouse: String ): Call { val params: ArrayList = ArrayList() params.add(shelving) params.add(items) - params.add(deep) params.add(warehouse) - params.add(level) return restClient!!.itemShelvingMake_multi( "json", "1", diff --git a/app/src/main/java/es/verdnatura/domain/GetWokerMistakeUSerCase.kt b/app/src/main/java/es/verdnatura/domain/GetWokerMistakeUSerCase.kt index 824355ad..a2863630 100644 --- a/app/src/main/java/es/verdnatura/domain/GetWokerMistakeUSerCase.kt +++ b/app/src/main/java/es/verdnatura/domain/GetWokerMistakeUSerCase.kt @@ -49,8 +49,8 @@ class GetWokerMistakeUSerCase(context: Context) : RestClient(context) { fun department_getHasMistake(usuario: String, password: String): Call> { return restClient!!.department_getHasMistake("json", "1", usuario, password, "application/json") } - fun department_getHasMistakeSalix(usuario: String, password: String): Call> { - return salixClient!!.department_getHasMistake("json", "1", usuario, password, "application/json") + fun department_getHasMistakeSalix(token:String): Call> { + return salixClient!!.department_getHasMistake(content_type = "application/json", authorization = token) } diff --git a/app/src/main/java/es/verdnatura/domain/SalixService.kt b/app/src/main/java/es/verdnatura/domain/SalixService.kt index fe4bbcdf..835d0b2a 100644 --- a/app/src/main/java/es/verdnatura/domain/SalixService.kt +++ b/app/src/main/java/es/verdnatura/domain/SalixService.kt @@ -1,16 +1,20 @@ package es.verdnatura.domain +import com.google.gson.JsonObject +import es.verdnatura.presentation.common.itemBarCodeSalix +import es.verdnatura.presentation.common.itemPackingTypeSalix import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO +import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType +import es.verdnatura.presentation.view.feature.collection.SalixSaleQuantity import es.verdnatura.presentation.view.feature.login.model.LoginSalixVO import es.verdnatura.presentation.view.feature.login.model.SalixGrupo import es.verdnatura.presentation.view.feature.login.model.SalixMessageVO import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO import es.verdnatura.presentation.view.feature.workermistake.model.DepartmentMistake +import org.json.JSONObject import retrofit2.Call -import retrofit2.http.Body -import retrofit2.http.GET -import retrofit2.http.Header -import retrofit2.http.POST +import retrofit2.http.* +import java.net.URLEncoder interface SalixService { @@ -57,20 +61,76 @@ interface SalixService { ): Call> + @POST("collections/setSaleQuantity") + fun collectionIncreaseQuantitySalix( + @Header("aplicacion") aplicacion: String, + @Header("version") version: String, + @Header("Authorization") authorization: String, + @Header("Content-Type") content_type: String, + @Body params: SalixSaleQuantity + ): + Call + + //https://test-salix.verdnatura.es/api/Departments?filter={"fields": {"id": true, "name": true},"where": {"name": "COMPRAS"}} // http://test-salix.verdnatura.es/api/Departments?filter={"fields": {"id": true, "name": true},"where": {"hasToMistake": "FALSE"}} - // @GET("api/Departments?filter{\"fields\": {\"id\": true, \"name\": true},\"where\": {\"hasToMistake\": \"FALSE\"}}") - @GET("api/Departments") + // @GET("api/Departments?filter={\"fields\": {\"id\": true, \"name\": true},\"where\": {\"hasToMistake\": \"FALSE\"}}") + @GET("Departments") fun department_getHasMistake( - @Header("aplicacion") aplicacion: String, - @Header("version") version: String, - @Header("user") user: String, - @Header("pass") pass: String, - @Header("Content-Type") content_type: String, - + @Header("Content-Type") content_type: String, + @Header("Authorization") authorization: String, + @Query("filter") filter:String = "{\"fields\": {\"id\": true, \"name\": true},\"where\": {\"name\": \"INFORMATICA\"}}" + // @Query("name") name:String ="COMPRAS" ): Call> + @GET("Workers/{idWorker}/sip") + fun sip_getExtension( + @Header("Content-Type") content_type: String, + @Header("Authorization") authorization: String, + @Path("idWorker") idWorker:String + + ): + Call + + @PATCH("Items/{itemFk}") + fun update_ItemPackingType( + @Header("Content-Type") content_type: String, + @Header("Authorization") authorization: String, + @Path("itemFk") itemFk:String, + @Body params: itemPackingTypeSalix + ): + Call + + //Fins que Salix 8.3 no puje no descomentar + @GET("ItemPackingTypes") + fun get_ItemPackingType( + @Header("Content-Type") content_type: String, + @Header("Authorization") authorization: String, + + ): + Call> + + + + + @PUT("ItemBarCodes")//REVISADA + fun barcodes_edit( + @Header("Content-Type") content_type: String, + @Header("Authorization") authorization: String, + @Body params: itemBarCodeSalix + ): + Call + + + @GET("ItemBarCodes/{barCodeValue}/toItem")//REVISADA + fun barcodes_toitem( + @Header("Content-Type") content_type: String, + @Header("Authorization") authorization: String, + @Path("barCodeValue") barCodeValue:String + ): + Call + } \ No newline at end of file diff --git a/app/src/main/java/es/verdnatura/domain/SalixServiceMessages.kt b/app/src/main/java/es/verdnatura/domain/SalixServiceMessages.kt new file mode 100644 index 00000000..730eb97b --- /dev/null +++ b/app/src/main/java/es/verdnatura/domain/SalixServiceMessages.kt @@ -0,0 +1,18 @@ +package es.verdnatura.domain + +import es.verdnatura.presentation.view.feature.login.model.SalixMessageVO +import retrofit2.Call +import retrofit2.http.Body +import retrofit2.http.Header +import retrofit2.http.POST + +interface SalixServiceMessages { + + @POST("chats/sendCheckingPresence") + fun sendChekingPresence( + @Header("Content-Type") content_type: String, + @Header("Authorization") authorization: String, + @Body params: SalixMessageVO + ): + Call +} \ No newline at end of file diff --git a/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt b/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt index 97c5006b..a346cd55 100644 --- a/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt +++ b/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt @@ -105,7 +105,7 @@ interface VerdnaturaService { Call //AJUSTES ========================================================================> - @POST("almacennew/sector_get")//REVISADA + @POST("almacennew/sector_get")//SALIX fun getSectors( @Header("aplicacion") aplicacion: String, @Header("version") version: String, @@ -115,7 +115,7 @@ interface VerdnaturaService { ): Call> - @POST("almacennew/printer_get")//REVISADA + @POST("almacennew/printer_get")//NO SALIX fun printer_get( @Header("aplicacion") aplicacion: String, @Header("version") version: String, @@ -125,7 +125,7 @@ interface VerdnaturaService { ): Call> - @POST("almacennew/worker_getPrinter")//REVISADA + @POST("almacennew/worker_getPrinter")//NO SALIX fun worker_getPrinter( @Header("aplicacion") aplicacion: String, @@ -136,7 +136,7 @@ interface VerdnaturaService { ): Call> - @POST("almacennew/worker_updatePrinter")//REVISADA + @POST("almacennew/worker_updatePrinter")//NO SALIX fun worker_updatePrinter( @Header("aplicacion") aplicacion: String, @Header("version") version: String, @@ -147,7 +147,7 @@ interface VerdnaturaService { ): Call - @POST("almacennew/worker_updateSector")//REVISADA + @POST("almacennew/worker_updateSector")//NO SALIX fun worker_updateSector( @Header("aplicacion") aplicacion: String, @Header("version") version: String, @@ -158,7 +158,7 @@ interface VerdnaturaService { ): Call - @POST("almacennew/worker_getSector")//REVISADA + @POST("almacennew/worker_getSector")//NO SALIX fun worker_getSector( @Header("aplicacion") aplicacion: String, @Header("version") version: String, @@ -170,7 +170,7 @@ interface VerdnaturaService { //PRESACADORES ========================================================================> - @POST("almacennew/ticketToPrePrepare")//REVISADA + @POST("almacennew/ticketToPrePrepare")//NO SALIX fun ticketToPrePrepare( @Header("aplicacion") aplicacion: String, @Header("version") version: String, @@ -181,7 +181,7 @@ interface VerdnaturaService { ): Call> - @POST("almacennew/sectorCollection_getSale")//REVISADA + @POST("almacennew/sectorCollection_getSale")//NO SALIX fun sectorCollection_getSale( @Header("aplicacion") aplicacion: String, @Header("version") version: String, @@ -192,7 +192,7 @@ interface VerdnaturaService { ): Call> - @POST("almacennew/itemPlacementSupplyGetOrder")//REVISADA + @POST("almacennew/itemPlacementSupplyGetOrder")//NO SALIX fun itemPlacementSupplyGetOrder( @Header("aplicacion") aplicacion: String, @Header("version") version: String, @@ -203,7 +203,7 @@ interface VerdnaturaService { ): Call> - @POST("almacennew/itemPlacementSupplyCloseOrder")//REVISADA + @POST("almacennew/itemPlacementSupplyCloseOrder")//NO SALIX fun itemPlacementSupplyCloseOrder( @Header("aplicacion") aplicacion: String, @Header("version") version: String, @@ -215,7 +215,7 @@ interface VerdnaturaService { Call //SACADORES / CONTROLADORES ========================================================================> - @POST("almacennew/collectionGet") //REVISADA + @POST("almacennew/collectionGet") //NO SALIX fun collectionGet( @Header("aplicacion") aplicacion: String, @Header("version") version: String, @@ -226,7 +226,7 @@ interface VerdnaturaService { Call> - @POST("almacennew/sectorCollection_get") //REVISADA + @POST("almacennew/sectorCollection_get") //NO SALIX fun sectorCollection_get( @Header("aplicacion") aplicacion: String, @Header("version") version: String, @@ -236,7 +236,7 @@ interface VerdnaturaService { ): Call> - @POST("almacennew/collectionNew")//REVISADA + @POST("almacennew/collectionNew")//NO SALIX fun collectionNew( @Header("aplicacion") aplicacion: String, @Header("version") version: String, @@ -247,7 +247,7 @@ interface VerdnaturaService { ): Call - @POST("almacennew/sectorCollection_new")//REVISADA + @POST("almacennew/sectorCollection_new")//NO SALIX fun sectorCollection_new( @Header("aplicacion") aplicacion: String, @Header("version") version: String, @@ -258,7 +258,7 @@ interface VerdnaturaService { ): Call - @POST("almacennew/sectorCollectionSaleGroup_add")//REVISADA + @POST("almacennew/sectorCollectionSaleGroup_add")//NO SALIX fun sectorCollectionSaleGroup_add( @Header("aplicacion") aplicacion: String, @Header("version") version: String, @@ -269,7 +269,7 @@ interface VerdnaturaService { ): Call - @POST("almacennew/saleTracking_addPrevOK")//REVISADA + @POST("almacennew/saleTracking_addPrevOK")//NO SALIX fun saleTracking_addPrevOK( @Header("aplicacion") aplicacion: String, @Header("version") version: String, @@ -280,7 +280,7 @@ interface VerdnaturaService { ): Call - @POST("almacennew/saleTracking_updateIsChecked")//REVISADA + @POST("almacennew/saleTracking_updateIsChecked")//NO SALIX fun saleTracking_updateIsChecked( @Header("aplicacion") aplicacion: String, @Header("version") version: String, @@ -302,7 +302,7 @@ interface VerdnaturaService { ): Call*/ - @POST("almacennew/ticket_checkFullyControlled")//REVISADA + @POST("almacennew/ticket_checkFullyControlled")//NO SALIX fun ticket_checkFullyControlled( @Header("aplicacion") aplicacion: String, @Header("version") version: String, @@ -503,6 +503,17 @@ interface VerdnaturaService { ): Call + @POST("almacennew/itemShelving_updateFromSale")//REVISADA + fun itemShelving_updateFromSale( + @Header("aplicacion") aplicacion: String, + @Header("version") version: String, + @Header("user") user: String, + @Header("pass") pass: String, + @Header("Content-Type") content_type: String, + @Body params: List + ): + Call + @POST("almacennew/ticket_setState")//REVISADA fun ticket_setState( @Header("aplicacion") aplicacion: String, diff --git a/app/src/main/java/es/verdnatura/presentation/base/BaseFragment.kt b/app/src/main/java/es/verdnatura/presentation/base/BaseFragment.kt index 3ca57078..9038f0ce 100644 --- a/app/src/main/java/es/verdnatura/presentation/base/BaseFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/base/BaseFragment.kt @@ -88,6 +88,7 @@ abstract class BaseFragment(viewModelCla protected val FALTA = 6 protected val ERROR = -1 + val allowedStrings = Arrays.asList( "cero", "uno", "dos", "tres", "cuatro", "cinco", "seis", "siete", @@ -534,6 +535,15 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?) else -> {""} } + } + + fun removeSector(){ + val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0) + val editor = prefs.edit() + editor.remove(SECTORFK).commit() + editor.remove(SECTORDESCRIP).commit() + editor.remove(WAREHOUSEFK).commit() + } fun setDefaults(key: String?, value: String?, context: Context?) { diff --git a/app/src/main/java/es/verdnatura/presentation/base/BaseViewModel.kt b/app/src/main/java/es/verdnatura/presentation/base/BaseViewModel.kt index 10bf0247..d0363b15 100644 --- a/app/src/main/java/es/verdnatura/presentation/base/BaseViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/base/BaseViewModel.kt @@ -40,6 +40,6 @@ fun getMessageFromAllResponse(callFunction: String, ResponseMessage: String): St } } //} - return "$messageFromError.$returnMessage" + return "$messageFromError.\r$returnMessage" } diff --git a/app/src/main/java/es/verdnatura/presentation/common/SalixBackItems.kt b/app/src/main/java/es/verdnatura/presentation/common/SalixBackItems.kt new file mode 100644 index 00000000..2f2a59ef --- /dev/null +++ b/app/src/main/java/es/verdnatura/presentation/common/SalixBackItems.kt @@ -0,0 +1,10 @@ +package es.verdnatura.presentation.common + +class itemPackingTypeSalix( + var itemPackingTypeFk: String = "" +) + +class itemBarCodeSalix( + var itemFk: String = "", + var code:String="" +) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ajustes/adapter/AjustesAdapter.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ajustes/adapter/AjustesAdapter.kt index 0b90bf37..600b337b 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ajustes/adapter/AjustesAdapter.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ajustes/adapter/AjustesAdapter.kt @@ -1,22 +1,31 @@ package es.verdnatura.presentation.view.feature.ajustes.adapter +import android.content.Context +import android.content.res.Resources import android.view.LayoutInflater import android.view.ViewGroup +import androidx.core.content.ContextCompat +import androidx.core.content.res.ResourcesCompat.getColor import androidx.recyclerview.widget.RecyclerView +import es.verdnatura.R import es.verdnatura.databinding.ItemAjustesRowBinding import es.verdnatura.presentation.common.OnAjustesItemClickListener import es.verdnatura.presentation.view.feature.ajustes.model.AjustesItemVO +import java.security.AccessController.getContext class AjustesAdapter ( private val items: List, private val onAjustesItemClickListener: OnAjustesItemClickListener ): RecyclerView.Adapter () { - + var context: Context? = null override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AjustesItemHolder { + this.context = parent.context + return AjustesItemHolder( ItemAjustesRowBinding.inflate(LayoutInflater.from(parent.context),parent,false) ) + } override fun getItemCount() =items.size @@ -29,12 +38,22 @@ class AjustesAdapter ( } - class AjustesItemHolder( + inner class AjustesItemHolder( val binding: ItemAjustesRowBinding ) : RecyclerView.ViewHolder(binding.root){ fun bind(item: AjustesItemVO) { binding.apply { - this.item = item + + this.item = item + + if (item.title=="Cerrar Sesión"){ + binding.itemTitle.setTextColor( + ContextCompat.getColor( + context!!, + R.color.verdnatura_pumpkin_orange + ) + ) + } } } } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ajustes/fragment/AjustesFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ajustes/fragment/AjustesFragment.kt index 00eb72af..a18607d7 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ajustes/fragment/AjustesFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ajustes/fragment/AjustesFragment.kt @@ -3,23 +3,19 @@ package es.verdnatura.presentation.view.feature.ajustes.fragment import android.app.AlertDialog import android.content.ClipData import android.content.ClipboardManager -import android.content.Context import android.content.Context.CLIPBOARD_SERVICE import android.content.SharedPreferences import android.os.Bundle -import android.provider.Settings -import android.util.Log -import android.view.KeyEvent import android.view.View +import androidx.appcompat.app.ActionBar import androidx.appcompat.widget.TooltipCompat.setTooltipText -import androidx.preference.PreferenceManager import androidx.recyclerview.widget.LinearLayoutManager import es.verdnatura.R import es.verdnatura.databinding.FragmentAjustesBinding +import es.verdnatura.databinding.ToolbarFragmentBinding import es.verdnatura.domain.notNull import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.common.OnAjustesItemClickListener -import es.verdnatura.presentation.common.hideKeyboard import es.verdnatura.presentation.view.component.CustomDialog import es.verdnatura.presentation.view.feature.ajustes.adapter.AjustesAdapter import es.verdnatura.presentation.view.feature.ajustes.model.AjustesItemVO @@ -35,7 +31,6 @@ class AjustesFragment : private lateinit var customDialog: CustomDialog private var sectorListVO: List = listOf() private var printersList: List = listOf() - private var vozList: List = listOf() private var prefs: SharedPreferences? = null private var ajustesAdapter: AjustesAdapter? = null @@ -71,7 +66,12 @@ class AjustesFragment : override fun init() { - ma.hideBottomNavigation(View.VISIBLE) + //ma.hideBottomNavigationFragment(View.VISIBLE) + + binding.mainToolbar.toolbarTitle.text="Configuración" + binding.mainToolbar.backButton.visibility=View.INVISIBLE + + binding.userText.setText(getData(USER)) val versionName = requireActivity().packageManager.getPackageInfo( requireActivity().packageName, @@ -288,7 +288,7 @@ class AjustesFragment : dialog.show() } - private fun showDialogVoz(array: Array) { + /* private fun showDialogVoz(array: Array) { val builder = AlertDialog.Builder(this.context) @@ -315,7 +315,7 @@ class AjustesFragment : val dialog = builder.create() dialog.show() - } + }*/ private fun showDialogCarros(array: Array) { val builder = AlertDialog.Builder(this.context) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt index 453adfd8..814a8777 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt @@ -178,8 +178,15 @@ class ItemCardFragment( binding.splashProgressTwo.visibility = View.VISIBLE viewModel.getItemCard(itemFk, warehouseFk, user, password, "item_card") binding.splashProgress.visibility = View.VISIBLE - viewModel.getItemPackingType(getData(USER), getData(PASSWORD), "get_ItemPackingType") + + var working_in_test=false //sergio:No descomentar fins que Salix puje versió 8.3 + + if (working_in_test){ + viewModel.getItemPackingTypeSalix(getData(TOKEN)) + }else { + viewModel.getItemPackingType(getData(USER), getData(PASSWORD), "get_ItemPackingType") + } } override fun observeViewModel() { @@ -719,14 +726,27 @@ class ItemCardFragment( } else { listBarcodes.add(BarcodeVO(code)) } - viewModel.barcodesEdit( - itemFk = itemInfoG!!.id, - user = user, - password = password, - value = code, - delete = delete, - "itemBarcode_update" - ) + + // var working_in_test=false //sergio:Revisar como borrar directamente en Salix o crear proc en back para borrar. + + if (delete=="0") { + viewModel.barcodesEditSalix( + token=getData(TOKEN), + itemFk = itemInfoG!!.id, + barCodeValue = code, + + ) + } + + else{ + viewModel.barcodesEdit( + itemFk = itemInfoG!!.id, + user = user, + password = password, + value = code, + delete = delete, + "itemBarcode_update") + } // viewModel.barcodesEdit(itemFk = itemFk, user = user, password = password, value = code, delete = delete,"itemBarcode_update") barcodeAdapter!!.notifyDataSetChanged() //changeOfflineValue(item,"", listBarcodes) @@ -745,7 +765,9 @@ class ItemCardFragment( .setItems( array ) { _, position -> - updateItemPackingType(itemsPackingType[position].code.toString()) + + updateItemPackingType(itemsPackingType[position].code.toString()) + } builder.create().show() @@ -753,13 +775,23 @@ class ItemCardFragment( private fun updateItemPackingType(itemPackingType: String) { binding.splashProgress.visibility = View.VISIBLE - viewModel.updatePackingType( + + var working_in_test=true //sergio: en proves app + if (working_in_test){ + viewModel.updatePackingTypeSalix( + getData(TOKEN), this.itemFk, - user, - password, itemPackingType, "item_updatePackingType" - ) + )}else{ + viewModel.updatePackingType( + this.itemFk, + user, + password, + itemPackingType, + "item_updatePackingType" + ) + } } } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardViewModel.kt index 9b1cf575..01d73100 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardViewModel.kt @@ -109,7 +109,28 @@ class ItemCardViewModel(context: Context) : BaseViewModel() { }) } + fun getItemPackingTypeSalix(token:String) { + getItemCardUserCase.getItemPackingTypeSalix(token).enqueue(object : + Callback>{ + override fun onFailure(call: Call>, t: Throwable) { + val listError:ArrayList = ArrayList() + listError.add(ItemPackingType(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!))) + _itemspackinglist.value = ItemPackingTypeList(listError) + } + override fun onResponse(call: Call>, response: Response>) { + if (response.body() != null){ + _itemspackinglist.value = response.body()?.let { ItemPackingTypeList(it) } + + }else{ + val listError:ArrayList = ArrayList() + listError.add(ItemPackingType(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))) + _itemspackinglist.value = ItemPackingTypeList(listError) + } + } + + }) + } fun itemStockUpdate(itemFk:String,warehouseFk:String,user:String,password:String,newValue:String,isTrash:String,callFunction:String){ getItemCardUserCase.itemStockUpdate(user,password,itemFk,warehouseFk,newValue,isTrash).enqueue(object : Callback{ @@ -221,7 +242,25 @@ class ItemCardViewModel(context: Context) : BaseViewModel() { }) } + fun updatePackingTypeSalix(token:String,itemFk:String,itemPackingType:String,callFunction:String){ + getItemCardUserCase.updatePackingTypeSalix(token,itemFk,itemPackingType).enqueue(object : Callback{ + override fun onFailure(call: Call, t: Throwable) { + _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) + } + override fun onResponse(call: Call, response: Response) { + if (response.body() == null){ + _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) + }else{ + //if (response.body()=="Finish"){ + // //Log.i("VERDNATURA:","Fisnih encontrado")} + _response.value = ResponseItemVO(isError = false,response = response.body()!!.toString()) + } + + } + + }) + } fun itemSaveMin(itemFk:String,user:String,password:String,value:String,callFunction:String){ getItemCardUserCase.itemSaveMin(user,password,itemFk,value).enqueue(object : Callback{ override fun onFailure(call: Call, t: Throwable) { @@ -276,4 +315,24 @@ class ItemCardViewModel(context: Context) : BaseViewModel() { }) } + + + fun barcodesEditSalix(token:String,itemFk:String,barCodeValue:String){ + getItemCardUserCase.barcodes_editSalix(token,itemFk,barCodeValue).enqueue(object : Callback{ + override fun onFailure(call: Call, t: Throwable) { + _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) + } + + override fun onResponse(call: Call, response: Response) { + if (response.body() == null){ + _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())) + }else{ + _response.value = ResponseItemVO(isError = false,response = response.message()!!) + } + + } + + }) + } + } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/CollectionVO.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/CollectionVO.kt index 445d89bc..6d309f74 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/CollectionVO.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/CollectionVO.kt @@ -7,4 +7,8 @@ class ItemVO( var available : String = "", var isError: Boolean = false, var errorMessage: String = "" -) \ No newline at end of file +) +class SalixSaleQuantity( + var saleId : Int =0, + var quantity: Int = 0 +) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/adapter/SaleAdapter.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/adapter/SaleAdapter.kt index 3927d377..63722bb2 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/adapter/SaleAdapter.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/adapter/SaleAdapter.kt @@ -1,7 +1,12 @@ package es.verdnatura.presentation.view.feature.collection.adapter import android.content.Context +import android.graphics.BlendMode +import android.graphics.BlendModeColorFilter import android.graphics.Color +import android.graphics.PorterDuff +import android.os.Build +import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -10,6 +15,7 @@ import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import es.verdnatura.R import es.verdnatura.databinding.ItemArticleRowBinding +import es.verdnatura.databinding.ItemArticleRowFragmentBinding import es.verdnatura.domain.toast import es.verdnatura.presentation.common.* import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO @@ -30,6 +36,8 @@ class SaleAdapter( this.context = parent.context return AjustesItemHolder( ItemArticleRowBinding.inflate(LayoutInflater.from(parent.context), parent, false) + //working_in_design + //ItemArticleRowFragmentBinding.inflate(LayoutInflater.from(parent.context), parent, false) ) } @@ -41,6 +49,8 @@ class SaleAdapter( } inner class AjustesItemHolder( + //working_in_design + // val binding: ItemArticleRowFragmentBinding val binding: ItemArticleRowBinding ) : RecyclerView.ViewHolder(binding.root) { fun bind(sale: SaleVO) { @@ -117,6 +127,10 @@ class SaleAdapter( paintTicketcolor(sale.level, itemTicketColor) + //working_in_design : modificar llamada cuando no estemos en + //paintTicketcolor(sale.color, itemColor) + + if (!sale.isNew && sale.originalQuantity == sale.quantity) { layoutError.visibility = View.GONE @@ -246,45 +260,206 @@ class SaleAdapter( } } - private fun paintTicketcolor(color: String, itemTicketColor: View) { - - when (color) { - "ROJO" -> itemTicketColor.setBackgroundColor(Color.RED) - "AMARILLO" -> itemTicketColor.setBackgroundColor(Color.YELLOW) - "VERDE" -> itemTicketColor.setBackgroundColor(Color.GREEN) - "AZUL" -> itemTicketColor.setBackgroundColor(Color.BLUE) - "BLANCO" -> itemTicketColor.setBackgroundColor(Color.WHITE) - // "NEGRO"-> itemTicketColor.setBackgroundResource((R.drawable.rectangle)) - + private fun paintTicketcolorOld(color:String,itemView:View){ + when (color.uppercase()) { + "ROJO" -> itemView.setBackgroundColor(Color.RED) + "AMARILLO" -> itemView.setBackgroundColor(Color.YELLOW) + "VERDE" -> itemView.setBackgroundColor(Color.GREEN) + "AZUL" -> itemView.setBackgroundColor(Color.BLUE) + "BLANCO" ->{itemView.setBackgroundColor(Color.WHITE) + itemView.setBackgroundResource((R.drawable.border))} "NEGRO" -> { - itemTicketColor.setBackgroundColor(Color.BLACK) - itemTicketColor.setBackgroundResource((R.drawable.border)) + itemView.setBackgroundColor(Color.BLACK) } - "VIOLETA" -> itemTicketColor.setBackgroundColor(0xFF4c2882.toInt()) - "GRIS" -> itemTicketColor.setBackgroundColor(Color.GRAY) - "ORANGE" -> itemTicketColor.setBackgroundColor( + "VIOLETA" -> itemView.setBackgroundColor(0xFF4c2882.toInt()) + "GRIS" -> itemView.setBackgroundColor(Color.GRAY) + "ORANGE" -> itemView.setBackgroundColor( getColor( context!!, android.R.color.holo_orange_light ) ) - "MORADO" -> itemTicketColor.setBackgroundColor( + "MORADO" -> itemView.setBackgroundColor( getColor( context!!, android.R.color.holo_purple ) ) - "CELESTE" -> itemTicketColor.setBackgroundColor(0xFF5b85F5.toInt()) - "ROSA" -> itemTicketColor.setBackgroundColor(0xFFfc0fc0.toInt()) - "DORADO" -> itemTicketColor.setBackgroundColor(0xFFb8860b.toInt()) - "MARRON" -> itemTicketColor.setBackgroundColor(0xFF663300.toInt()) - "PERLA" -> itemTicketColor.setBackgroundColor(0xFFcdcecf.toInt()) - "MARFIL" -> itemTicketColor.setBackgroundColor(0xFFf7eada.toInt()) - "CIAN" -> itemTicketColor.setBackgroundColor(0xFF00ffff.toInt()) - "BEIGE" -> itemTicketColor.setBackgroundColor(0xFFf2e7bf.toInt()) - + "CELESTE" -> itemView.setBackgroundColor(0xFF5b85F5.toInt()) + "ROSA" -> itemView.setBackgroundColor(0xFFfc0fc0.toInt()) + "DORADO" -> itemView.setBackgroundColor(0xFFb8860b.toInt()) + "MARRON" -> itemView.setBackgroundColor(0xFF663300.toInt()) + "PERLA" -> itemView.setBackgroundColor(0xFFcdcecf.toInt()) + "MARFIL" -> itemView.setBackgroundColor(0xFFf7eada.toInt()) + "CIAN" -> itemView.setBackgroundColor(0xFF00ffff.toInt()) + "BEIGE" -> itemView.setBackgroundColor(0xFFf2e7bf.toInt()) + "trasparente" -> itemView.setBackgroundColor(0xFFf2e7bf.toInt()) else -> { + itemView.setBackgroundColor(Color.TRANSPARENT) + itemView.setBackgroundResource(R.drawable.background_item_color) + + } + } + } + + private fun paintTicketcolor(color: String, itemView: View) { + + when (color.uppercase()) { + "ROJO" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(Color.RED, BlendMode.SRC_ATOP) + } else { + itemView.background.setColorFilter(Color.RED, PorterDuff.Mode.SRC_ATOP) + } + // itemView.background.setColorFilter(Color.RED, PorterDuff.Mode.SRC_ATOP) + + "AMARILLO" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(Color.YELLOW, BlendMode.SRC_ATOP) + } else { + itemView.background.setColorFilter(Color.YELLOW, PorterDuff.Mode.SRC_ATOP) + } + "VERDE" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(Color.GREEN, BlendMode.SRC_ATOP) + } else { + itemView.background.setColorFilter(Color.GREEN, PorterDuff.Mode.SRC_ATOP) + } + "AZUL" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(Color.BLUE, BlendMode.SRC_ATOP) + } else { + itemView.background.setColorFilter(Color.BLUE, PorterDuff.Mode.SRC_ATOP) + } + "BLANCO" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(Color.WHITE, BlendMode.SRC_ATOP) + } else { + itemView.background.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_ATOP) + } + // "NEGRO"-> itemView.setBackgroundResource((R.drawable.rectangle)) + + "NEGRO" -> { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(Color.BLACK, BlendMode.SRC_ATOP) + } else { + itemView.background.setColorFilter(Color.BLACK, PorterDuff.Mode.SRC_ATOP) + } + + itemView.setBackgroundResource((R.drawable.border)) + } + "VIOLETA" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(Color.parseColor("0xFF4c2882"), BlendMode.SRC_ATOP) + } else { + itemView.background.setColorFilter(0xFF4c2882.toInt(), PorterDuff.Mode.SRC_ATOP) + } + + "GRIS" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(Color.GRAY, BlendMode.SRC_ATOP) + } else { + itemView.background.setColorFilter(Color.GRAY, PorterDuff.Mode.SRC_ATOP) + } + "ORANGE" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(getColor( + context!!, + android.R.color.holo_orange_light + ), BlendMode.SRC_ATOP) + } else { + itemView.background.setColorFilter(getColor( + context!!, + android.R.color.holo_orange_light + ), PorterDuff.Mode.SRC_ATOP) + } + + "MORADO" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(getColor( + context!!, + android.R.color.holo_purple + ), BlendMode.SRC_ATOP) + } else { + itemView.background.setColorFilter(getColor( + context!!, + android.R.color.holo_purple + ), PorterDuff.Mode.SRC_ATOP) + } + + "CELESTE" -> itemView.setBackgroundColor(0xFF5b85F5.toInt()) + + + + "ROSA" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(0xFFfc0fc0.toInt(), BlendMode.SRC_ATOP) + } else { + itemView.background.setColorFilter( + 0xFFfc0fc0.toInt(), + PorterDuff.Mode.SRC_ATOP + ) + } + + "DORADO" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(0xFFb8860b.toInt(), BlendMode.SRC_ATOP) + } else { + itemView.background.setColorFilter( + 0xFFb8860b.toInt(), + PorterDuff.Mode.SRC_ATOP + ) + } + "MARRON" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(0xFF663300.toInt(), BlendMode.SRC_ATOP) + } else { + itemView.background.setColorFilter( + 0xFF663300.toInt(), + PorterDuff.Mode.SRC_ATOP + ) + } + "PERLA" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(0xFFcdcecf.toInt(), BlendMode.SRC_ATOP) + } else { + itemView.background.setColorFilter( + 0xFFcdcecf.toInt(), + PorterDuff.Mode.SRC_ATOP + ) + } + "MARFIL" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(0xFFf7eada.toInt(), BlendMode.SRC_ATOP) + } else { + itemView.background.setColorFilter( + 0xFFf7eada.toInt(), + PorterDuff.Mode.SRC_ATOP + ) + } + "CIAN" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(0xFF00ffff.toInt(), BlendMode.SRC_ATOP) + } else { + itemView.background.setColorFilter( + 0xFF00ffff.toInt(), + PorterDuff.Mode.SRC_ATOP + ) + } + "BEIGE" -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + itemView.background.colorFilter = + BlendModeColorFilter(0xFFf2e7bf.toInt(), BlendMode.SRC_ATOP) + } else { + itemView.background.setColorFilter( + 0xFFf2e7bf.toInt(), + PorterDuff.Mode.SRC_ATOP + ) + } + + else -> { + itemView.visibility=View.INVISIBLE } } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragment.kt index 2358d48e..771cbf7e 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragment.kt @@ -11,11 +11,11 @@ import android.os.Bundle import android.speech.SpeechRecognizer import android.util.Log import android.view.View -import android.view.View.GONE -import android.view.View.VISIBLE +import android.view.View.* import android.view.inputmethod.EditorInfo import android.view.inputmethod.InputMethodManager import android.widget.ImageView +import android.widget.RelativeLayout.TRUE import android.widget.Toast import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager @@ -24,8 +24,6 @@ import es.verdnatura.R import es.verdnatura.databinding.FragmentCollectionBinding import es.verdnatura.domain.ConstAndValues.CONTROLADOR import es.verdnatura.domain.ConstAndValues.OK -import es.verdnatura.domain.ConstAndValues.ON_CHECKING -import es.verdnatura.domain.ConstAndValues.ON_PREPARATION import es.verdnatura.domain.ConstAndValues.PRECHECKER import es.verdnatura.domain.ConstAndValues.SACADOR import es.verdnatura.domain.toast @@ -83,7 +81,9 @@ class CollectionFragment( private var isMarking = false private var positionCollectionSplit = 0 private var quantityCollectionSplit = "" + //private var myKM: KeyguardManager? = null + private var positionUnmarked = -1 private var state = 0 @@ -112,6 +112,8 @@ class CollectionFragment( mperror = MediaPlayer.create((activity as MainActivity), R.raw.error) mpok = MediaPlayer.create((activity as MainActivity), R.raw.ok) + + if ((collection.collectionFk != null) && type.equals(CONTROLADOR)) { //sergio: comprueba si viene de la pantalla de controlador @@ -163,6 +165,7 @@ class CollectionFragment( createCollectionList() } + super.init() } @@ -188,35 +191,47 @@ class CollectionFragment( iconFace.setImageResource(R.drawable.face_man_outline) val iconPhone = ImageView(context) iconPhone.setImageResource(R.drawable.phone_call) + val iconParking = ImageView(context) + iconParking.setImageResource(R.drawable.ic_local_parking_black_24dp) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - iconPrint.tooltipText=getTooltip(R.drawable.ic_local_parking_black_24dp) - iconAdd.tooltipText=getTooltip(R.drawable.ic_playlist_add_black_24dp) - iconFace.tooltipText=getTooltip(R.drawable.face_man_outline) - iconPhone.tooltipText=getTooltip(R.drawable.phone_call) + iconPrint.tooltipText = getTooltip(R.drawable.ic_print_black_24dp) + iconAdd.tooltipText = getTooltip(R.drawable.ic_playlist_add_black_24dp) + iconFace.tooltipText = getTooltip(R.drawable.face_man_outline) + iconPhone.tooltipText = getTooltip(R.drawable.phone_call) + iconParking.tooltipText = getTooltip(R.drawable.ic_local_parking_black_24dp) } - if (type.equals("CHECKER")){ + if (type.equals("CHECKER")) { listIcons.add(iconPhone) - } + } + listIcons.add(iconFace) listIcons.add(iconPrint) listIcons.add(iconAdd) - //listIcons.add(iconSearch) + if (type.equals(PRECHECKER)) { + listIcons.add(iconParking) + listIcons.remove(iconPrint) + } binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener { override fun onOptionsItemSelected(item: Drawable) { - when (item){ - iconPrint.drawable->print() - iconAdd.drawable->addItem() - iconFace.drawable->showUser() - iconPhone.drawable->getExtensionFromUser() + when (item) { + iconPrint.drawable -> print() + iconAdd.drawable -> addItem() + iconFace.drawable -> showUser() + iconPhone.drawable -> getExtensionFromUser() + iconParking.drawable->pasillerosItemClickListener?.onPasillerosItemClickListener( + PasillerosItemVO( + title = "Parking" + ), "" + ) } } @@ -228,9 +243,18 @@ class CollectionFragment( private fun getExtensionFromUser() { - binding.splashProgress.visibility=VISIBLE - viewModel.sip_getExtension(getData(USER), - getData(PASSWORD), workerFkFromTicket,"sip_getExtension") + binding.splashProgress.visibility = VISIBLE + + var working_in_test = true // sergio: en proves app + + if (working_in_test) { + viewModel.sip_getExtensionSalix(getData(TOKEN), workerFkFromTicket, "sip_getExtension") + } else { + viewModel.sip_getExtension( + getData(USER), + getData(PASSWORD), workerFkFromTicket, "sip_getExtension" + ) + } } @@ -287,16 +311,16 @@ class CollectionFragment( isMarking = false binding.collectionSwipe.isRefreshing = false - // if (type != PRECHECKER) { - binding.splashProgress.visibility = VISIBLE - viewModel.collectionTicketGet( - getData(USER), - getData(PASSWORD), - collection.collectionFk, - getData(SECTORFK), - type, "collection_getTickets" - ) - binding.collectionSwipe.isRefreshing = false + // if (type != PRECHECKER) { + binding.splashProgress.visibility = VISIBLE + viewModel.collectionTicketGet( + getData(USER), + getData(PASSWORD), + collection.collectionFk, + getData(SECTORFK), + type, "collection_getTickets" + ) + binding.collectionSwipe.isRefreshing = false //} } } @@ -308,6 +332,7 @@ class CollectionFragment( } } + private fun showKeyboards() { try { requireActivity().showKeyboard() @@ -349,18 +374,19 @@ class CollectionFragment( responseUsedShelves.observe(viewLifecycleOwner, Observer { binding.splashProgress.visibility = GONE - if (!goBack){ - ma.messageWithSound( - if (it.isError) it.errorMessage else "Baldas guardadas", - it.isError,true - )} + if (!goBack) { + ma.messageWithSound( + if (it.isError) it.errorMessage else "Baldas guardadas", + it.isError, true + ) + } }) responseItem_updatePackingShelve.observe(viewLifecycleOwner, Observer { binding.splashProgress.visibility = GONE ma.messageWithSound( if (it.isError) it.errorMessage else "Packing guardado", - it.isError,!it.isError + it.isError, !it.isError ) if (!it.isError) { viewModel.collectionTicketGet( @@ -379,9 +405,9 @@ class CollectionFragment( if (it.isError) { - ma.messageWithSound(it.errorMessage, true,true) + ma.messageWithSound(it.errorMessage, true, true) } else { - ma.messageWithSound("Previa recogida", false,true) + ma.messageWithSound("Previa recogida", false, true) binding.splashProgress.visibility = VISIBLE viewModel.collectionTicketGet( getData(USER), @@ -420,23 +446,23 @@ class CollectionFragment( View.VISIBLE - if (!goBack){ - sendSalixMessage( - item = dataMessageSalix.item, - ticketFk = dataMessageSalix.ticket, - quantity = dataMessageSalix.quantity, - salePerson = dataMessageSalix.personSale - ) - viewModel.collectionTicketGet( - getData(USER), - getData(PASSWORD), - collection.collectionFk, - getData(SECTORFK), - type, "collection_getTickets" - ) + if (!goBack) { + sendSalixMessage( + item = dataMessageSalix.item, + ticketFk = dataMessageSalix.ticket, + quantity = dataMessageSalix.quantity, + salePerson = dataMessageSalix.personSale + ) + viewModel.collectionTicketGet( + getData(USER), + getData(PASSWORD), + collection.collectionFk, + getData(SECTORFK), + type, "collection_getTickets" + ) - // //Log.i("VERDNATURA:","La collection es ${collection.collectionFk}") - } + // //Log.i("VERDNATURA:","La collection es ${collection.collectionFk}") + } } // } @@ -474,16 +500,16 @@ class CollectionFragment( responseMissingTrash.observe(viewLifecycleOwner, Observer { - if (!goBack){ - if (it.isError) { - ma.messageWithSound(it.errorMessage, isError = true,true) + if (!goBack) { + if (it.isError) { + ma.messageWithSound(it.errorMessage, isError = true, true) - } else { + } else { - missingTrashSuccesful() + missingTrashSuccesful() - } - } //sergio:esto ya estaba + } + } //sergio:esto ya estaba /* binding.splashProgress.visibility = View.VISIBLE viewModel.collectionTicketGet(user,password,collection.collectionFk,getData(SECTORFK))*/ }) @@ -492,11 +518,14 @@ class CollectionFragment( responseIncQuantity.observe(viewLifecycleOwner, Observer { if (it.isError) { - ma.messageWithSound(it.errorMessage, isError = true,true) + ma.messageWithSound(it.errorMessage, isError = true, true) } else { - if (!goBack){ incresaseSuccesful()}else{ - goBack=false} + if (!goBack) { + incresaseSuccesful() + } else { + goBack = false + } } }) @@ -504,26 +533,30 @@ class CollectionFragment( responseSaleMove.observe(viewLifecycleOwner, Observer { if (it.isError) { - ma.messageWithSound(it.errorMessage, isError = true,true) + ma.messageWithSound(it.errorMessage, isError = true, true) } else { if (!goBack) - responseSaleMoveSuccesful() - goBack=false + responseSaleMoveSuccesful() + goBack = false } }) responseGetExtensionFromUserId.observe(viewLifecycleOwner, Observer { - binding.splashProgress.visibility=GONE + binding.splashProgress.visibility = GONE if (it.isError) { if (!goBack) - ma.messageWithSound(it.errorMessage+"Usuario:"+workerFkFromTicket, isError = true,true) + ma.messageWithSound( + it.errorMessage + "Usuario:" + workerFkFromTicket, + isError = true, + true + ) goBack = false } else { if (!goBack) - callPicker(it.response) + callPicker(it.response) goBack = false } @@ -534,14 +567,14 @@ class CollectionFragment( if (binding.splashProgress != null) binding.splashProgress.visibility = GONE /*sergio:se quita y se pone esta comprobacion porque si no aparece de nuevo otra vez al volver atrás */ if (!goBack) - showMistakeList(it.list) + showMistakeList(it.list) goBack = false }) //sergio: para si hay algun ticket por revisar responsecheckfully.observe(viewLifecycleOwner, Observer { binding.splashProgress.visibility = View.GONE if (it.isError) { - ma.messageWithSound(it.errorMessage,it.isError,false) + ma.messageWithSound(it.errorMessage, it.isError, false) /*customDialog.setTitle("Error").setDescription(it.errorMessage) .setOkButton("Aceptar") { customDialog.dismiss() @@ -575,13 +608,63 @@ class CollectionFragment( } }) + responseDel.observe(viewLifecycleOwner, Observer { + + + + if (it.isError) { + binding.splashProgress.visibility = GONE + if (!goBack) { + + ma.messageWithSound(it.errorMessage, it.isError, false) + + } + } else { + + viewModel.collectionTicketGet( + getData(USER), + getData(PASSWORD), + collection.collectionFk, + getData(SECTORFK), + type, "collection_getTickets" + ) + + goBack = false + } + + }) + responseItemShelvingUpdate.observe(viewLifecycleOwner, Observer { + + if (it.isError) { + + if (!goBack) { + + ma.messageWithSound(it.errorMessage, it.isError, false) + + } + + + } else { + viewModel.saleTrackingDel( + getData(USER), + getData(PASSWORD), + saleFk = sales[positionUnmarked].saleFk, + "saleTracking_del" + ) + + goBack = false + } + }) responseSalixMessage.observe(viewLifecycleOwner, Observer { if (it.isError) { - if (!goBack){ - ma.messageWithSound(it.errorMessage,it.isError,false)}else{goBack=false} + if (!goBack) { + ma.messageWithSound(it.errorMessage, it.isError, false) + } else { + goBack = false + } /*customDialog.setTitle("Error").setDescription(it.errorMessage) .setOkButton("Aceptar") { @@ -606,22 +689,22 @@ class CollectionFragment( val message = "Se ha enviado a Split el articulo " + sales[positionCollectionSplit].itemFk + " del ticket " + ticket - sendSalixMessageNew(message,sales[positionCollectionSplit].salePersonFk) + sendSalixMessageNew(message, sales[positionCollectionSplit].salePersonFk) } - private fun callPicker(extensionNumber:String) { + private fun callPicker(extensionNumber: String) { - try { - val intent = Intent(Intent.ACTION_DIAL).apply { - data = Uri.parse("tel:$extensionNumber") - } + try { + val intent = Intent(Intent.ACTION_DIAL).apply { + data = Uri.parse("tel:$extensionNumber") + } - startActivity(intent) - }catch (e:Exception){ - d("VERDNATURA::"+e.message) - } + startActivity(intent) + } catch (e: Exception) { + d("VERDNATURA::" + e.message) + } } @@ -697,11 +780,11 @@ class CollectionFragment( sales = salesList.sortedWith(compareBy({ it.saleOrder })) - if (type==CONTROLADOR){ + if (type == CONTROLADOR) { sales = salesList.sortedWith(compareBy({ it.picked })) - /* for (s in sales){ - Log.d("VERDNATURA::","El item es ${s.itemFk} y su picked ${s.picked} y saleorder ${s.saleOrder}") - }*/ + /* for (s in sales){ + Log.d("VERDNATURA::","El item es ${s.itemFk} y su picked ${s.picked} y saleorder ${s.saleOrder}") + }*/ } //pruebas sergio // sales = salesList.sortedWith(compareBy({it.placements.get(0).created})) @@ -753,8 +836,10 @@ class CollectionFragment( if (binding.splashProgress != null) binding.splashProgress.visibility = View.VISIBLE mistakeSale = sale - viewModel.mistakeType(usuario = getData(USER), - getData(PASSWORD)) + viewModel.mistakeType( + usuario = getData(USER), + getData(PASSWORD) + ) } } }, object : onPackingClickListener { @@ -934,26 +1019,26 @@ class CollectionFragment( View.VISIBLE storedPosition = 0 storedBackPosition = 0 - // if (type != PRECHECKER) { - isMarking = false - viewModel.collectionTicketGet( + // if (type != PRECHECKER) { + isMarking = false + viewModel.collectionTicketGet( + getData(USER), + getData(PASSWORD), + txtscan, + getData(SECTORFK), + type, + "collection_getTickets" + ) + + if (type.equals(CONTROLADOR)) { + viewModel.ticket_checkFullyControlled( getData(USER), getData(PASSWORD), txtscan, - getData(SECTORFK), - type, - "collection_getTickets" + "ticket_checkFullyControlled" ) - - if (type.equals(CONTROLADOR)) { - viewModel.ticket_checkFullyControlled( - getData(USER), - getData(PASSWORD), - txtscan, - "ticket_checkFullyControlled" - ) - } - // } else { + } + // } else { // binding.splashProgress.visibility = View.GONE //} ////Log.i("VERDNATURA:","La collection es ${txtscan}") @@ -1037,24 +1122,25 @@ class CollectionFragment( sales[position].isControlled = if (sales[position].isControlled == "1") "0" else "1" if (type == PRECHECKER) { - sales[position].isPreControlled= if ( sales[position].isPreControlled == "1") "0" else "1" - /* sales[position].isControlled = - //if (sales[position].isControlled == "2") "0" else "2" //sergio: para diferenciar precontrol en previa - if (sales[position].isControlled == "1") "0" else "1"//sergio: para diferenciar precontrol en previa*/ + sales[position].isPreControlled = + if (sales[position].isPreControlled == "1") "0" else "1" + /* sales[position].isControlled = + //if (sales[position].isControlled == "2") "0" else "2" //sergio: para diferenciar precontrol en previa + if (sales[position].isControlled == "1") "0" else "1"//sergio: para diferenciar precontrol en previa*/ } saleAdapter!!.notifyDataSetChanged() setListPosition(position, false) - /* if (type != PRECHECKER) { - saleTrackingReplace(position, newType) - isMarking = true - } -*/ + /* if (type != PRECHECKER) { + saleTrackingReplace(position, newType) + isMarking = true + } + */ // sergio - /* if (type == PRECHECKER) { - saleTrackingReplace(position, newType) - }*/ + /* if (type == PRECHECKER) { + saleTrackingReplace(position, newType) + }*/ saleTrackingReplace(position, newType) isMarking = true @@ -1063,7 +1149,7 @@ class CollectionFragment( private fun setListPosition(position: Int, isFromBack: Boolean) { storedPosition = position - if (type == SACADOR || type == CONTROLADOR) { + if (type == SACADOR || (type == CONTROLADOR && (getData(SECTORDESCRIP).uppercase() == "ALGEMESI V"))) { if (binding.fragmentSacadorCollections != null) { binding.fragmentSacadorCollections.addViewObserver { lm!!.scrollToPositionWithOffset(position, 0) @@ -1086,7 +1172,7 @@ class CollectionFragment( getData(USER), getData(PASSWORD), saleFk = sales[position].saleFk, - vIsChecked = if (type == SACADOR) sales[position].isPrepared else if (type == CONTROLADOR ) sales[position].isControlled else if (type=="PRECHECKER") sales[position].isPreControlled else "1", + vIsChecked = if (type == SACADOR) sales[position].isPrepared else if (type == CONTROLADOR) sales[position].isControlled else if (type == "PRECHECKER") sales[position].isPreControlled else "1", vOriginalQuantity = sales[position].pickedQuantity, vStateFk = if (type == CONTROLADOR) "CHECKED" else if (type == "PRECHECKER") "PREVIOUS_CONTROL" else type,//type.toString(), vBuyFk = originalItemScan, @@ -1106,12 +1192,26 @@ class CollectionFragment( saleAdapter!!.notifyDataSetChanged() setListPosition(position, false) if (type != PRECHECKER) { - viewModel.saleTrackingDel( + + + binding.splashProgress.visibility= VISIBLE + viewModel.itemShelving_updateFromSale( getData(USER), getData(PASSWORD), - saleFk = sales[position].saleFk, - "saleTracking_del" + sales[position].saleFk, + sales[position].quantity, + "" ) + positionUnmarked = position + + /* viewModel.saleTrackingDel( + getData(USER), + getData(PASSWORD), + saleFk = sales[position].saleFk, + "saleTracking_del" + )*/ + + } setTotalLines() scanRequest() @@ -1199,10 +1299,21 @@ class CollectionFragment( itemShelvingFkStored = itemShelvingFk if (binding.splashProgress != null) binding.splashProgress.visibility = View.VISIBLE - viewModel.getIdFromCode(usuario = getData(USER), - password = getData(PASSWORD), - code = customDialogList.getValueTwo(), "barcodeToItem" - ) + + var working_in_test = true // sergio: en proves app + if (working_in_test) { + viewModel.getIdFromCodeSalix( + token = getData(USER), + code = customDialogList.getValueTwo(), + ) + } else { + viewModel.getIdFromCode( + usuario = getData(USER), + password = getData(PASSWORD), + code = customDialogList.getValueTwo(), "barcodeToItem" + ) + } + customDialogList.dismiss() } scanRequest() @@ -1268,11 +1379,21 @@ class CollectionFragment( } else { itemShelvingFkStored = itemShelvingFk binding.splashProgress.visibility = View.VISIBLE - viewModel.getIdFromCode( - getData(USER), - getData(PASSWORD), - code = customDialogList.getValueTwo(), "barcodeToItem" - ) + + var working_in_test = true //sergio: en proves app + if (working_in_test) { + viewModel.getIdFromCodeSalix( + getData(TOKEN), + code = customDialogList.getValueTwo() + ) + + } else { + viewModel.getIdFromCode( + getData(USER), + getData(PASSWORD), + code = customDialogList.getValueTwo(), "barcodeToItem" + ) + } customDialogList.dismiss() scanRequest() } @@ -1346,7 +1467,6 @@ class CollectionFragment( } - private fun checkItemScan(valueToCheck: String): Boolean { if (storedPosition >= 0 && sales.size > storedPosition) { @@ -1391,6 +1511,7 @@ class CollectionFragment( callFunction = "itemShelvingSaleSupplyAdd" ) + } catch (e: Exception) { } @@ -1421,7 +1542,7 @@ class CollectionFragment( //OPTIONS private fun print() { - if (ma.havePrinter()){ + if (ma.havePrinter() && ma.haveSector()) { viewModel.collectionStickerPrint( getData(USER), getData(PASSWORD), @@ -1430,11 +1551,17 @@ class CollectionFragment( "collectionStickerPrint" ) (getString(R.string.Imprimiendo) + getData(PRINTERNAME)).toast(requireContext()) - }else{ + } else { - ma.messageWithSound("Falta seleccionar impresora.",isError = true,true,"Error al imprimir",false) + ma.messageWithSound( + "Falta seleccionar impresora.", + isError = true, + true, + "Error al imprimir", + false + ) - } + } } @@ -1652,8 +1779,8 @@ class CollectionFragment( if (totalMark == sales.size) { getString(R.string.Coleccióncompleta).toast(this.context, Toast.LENGTH_SHORT) if (!goBack) - ticketCollection_setUsedShelves() - goBack=false + ticketCollection_setUsedShelves() + goBack = false //showBottomNavigation(View.VISIBLE) //sergio: se quita porque se realiza desde triggers @@ -1665,7 +1792,7 @@ class CollectionFragment( private fun ticketCollection_setUsedShelves() { - if (type.equals("CHECKER") && (isMarking && getData(SECTORDESCRIP).uppercase() != "ALGEMESI V") + if (type.equals("CHECKER") && (isMarking && getData(SECTORDESCRIP).uppercase() != "ALGEMESI V") ) { @@ -1850,9 +1977,9 @@ class CollectionFragment( when (action) { getString(R.string.Agregar) -> increaseQuantity(position, value) - getString(R.string.BasuraRechazar) -> TrashMissingReject(position, value,"TRUE") - getString(R.string.Faltas) -> TrashMissingReject(position, value,"FALSE") - getString(R.string.Reject) -> TrashMissingReject(position, value,"reject") + getString(R.string.BasuraRechazar) -> TrashMissingReject(position, value, "TRUE") + getString(R.string.Faltas) -> TrashMissingReject(position, value, "FALSE") + getString(R.string.Reject) -> TrashMissingReject(position, value, "reject") getString(R.string.Split) -> split(position, value) } @@ -1864,8 +1991,8 @@ class CollectionFragment( private fun split(position: Int, quantity: String) { - quantityCollectionSplit=quantity - positionCollectionSplit=position + quantityCollectionSplit = quantity + positionCollectionSplit = position var totalQuantity: Int = 0 try { @@ -1881,22 +2008,22 @@ class CollectionFragment( "saleMove" ) - /* sales[position].quantity = quantity + /* sales[position].quantity = quantity - if (quantity == "0") - markLine(position, type) - saleAdapter!!.notifyDataSetChanged() + if (quantity == "0") + markLine(position, type) + saleAdapter!!.notifyDataSetChanged() - //enviar mensaje a salix - val ticket = - "[" + sales[position].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[position].ticketFk + "/summary)" - val message = - "Se ha enviado a Split el articulo " + sales[position].itemFk + " del ticket " + ticket - viewModel.sendChekingPresence( - token = getData(TOKEN), - workerId = sales[position].salePersonFk, - message = message, "sendChekingPresence" - )*/ + //enviar mensaje a salix + val ticket = + "[" + sales[position].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[position].ticketFk + "/summary)" + val message = + "Se ha enviado a Split el articulo " + sales[position].itemFk + " del ticket " + ticket + viewModel.sendChekingPresence( + token = getData(TOKEN), + workerId = sales[position].salePersonFk, + message = message, "sendChekingPresence" + )*/ } @@ -1925,129 +2052,129 @@ class CollectionFragment( originalQuantity = quantity, callFunction = "collectionMissingTrash" ) - /* sales[position].quantity = quantity - saleAdapter!!.notifyDataSetChanged() - if (quantity == "0") - markLine(position, type) + /* sales[position].quantity = quantity + saleAdapter!!.notifyDataSetChanged() + if (quantity == "0") + markLine(position, type) -*/ + */ } - /* private fun trash(position: Int, quantity: String) { - var totalQuantity: Int = 0 - try { - totalQuantity = sales[position].quantity.toInt() - quantity.toInt() - } catch (e: Exception) { - } - viewModel.collectionMissingTrash( - usuario = user, - password = password, - saleFk = sales[position].saleFk, - quantity = totalQuantity.toString(), - warehouseFk = warehouseFk, - type = "FALSE", - originalQuantity = quantity, - callFunction = "collectionMissingTrash" - ) + /* private fun trash(position: Int, quantity: String) { + var totalQuantity: Int = 0 + try { + totalQuantity = sales[position].quantity.toInt() - quantity.toInt() + } catch (e: Exception) { + } + viewModel.collectionMissingTrash( + usuario = user, + password = password, + saleFk = sales[position].saleFk, + quantity = totalQuantity.toString(), + warehouseFk = warehouseFk, + type = "FALSE", + originalQuantity = quantity, + callFunction = "collectionMissingTrash" + ) - sales[position].quantity = quantity - saleAdapter!!.notifyDataSetChanged() - if (quantity == "0") - markLine(position, type) + sales[position].quantity = quantity + saleAdapter!!.notifyDataSetChanged() + if (quantity == "0") + markLine(position, type) - //enviar mensaje a salix - val ticket = - "[" + sales[position].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[position].ticketFk + "/summary)" - val message = - "Se ha enviado a Faltas la cantidad de " + totalQuantity + " del articulo " + sales[position].itemFk + " ticket " + ticket - viewModel.sendChekingPresence( - token = token, - workerId = sales[position].salePersonFk, - message = message, "sendChekingPresence" - ) - } - - private fun missing(position: Int, quantity: String) { - var totalQuantity: Int = 0 - try { - totalQuantity = sales[position].quantity.toInt() - quantity.toInt() - } catch (e: Exception) { - } - viewModel.collectionMissingTrash( - usuario = user, - password = password, - saleFk = sales[position].saleFk, - quantity = totalQuantity.toString(), - warehouseFk = warehouseFk, - type = "TRUE", - originalQuantity = quantity, - callFunction = "collectionMissingTrash", - ) - //sales[position].originalQuantity = quantity - sales[position].quantity = quantity - //sales[position].startQuantity = quantity - - if (quantity == "0") - markLine(position, type) - saleAdapter!!.notifyDataSetChanged() - - //enviar mensaje a salix - val ticket = - "[" + sales[position].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[position].ticketFk + "/summary)" - val message = - "Se ha enviado a Basura " + totalQuantity + " del articulo " + sales[position].itemFk + " ticket " + ticket - viewModel.sendChekingPresence( - token = token, - workerId = sales[position].salePersonFk, - message = message, - "sendChekingPresence" - ) - } - - private fun reject(position: Int, quantity: String) { - positionReject = position - quantityReject = quantity - - var totalQuantity: Int = 0 - try { - totalQuantity = sales[position].quantity.toInt() - quantity.toInt() - } catch (e: Exception) { - } - viewModel.collectionMissingTrash( - usuario = user, - password = password, - saleFk = sales[position].saleFk, - quantity = totalQuantity.toString(), - warehouseFk = warehouseFk, - type = "reject", - originalQuantity = quantity, callFunction = "collectionMissingTrash" - ) - - //sales[position].originalQuantity = quantity - sales[position].quantity = quantity - //sales[position].startQuantity = quantity - - - saleAdapter!!.notifyDataSetChanged() - if (quantity == "0") - markLine(position, type) - - //enviar mensaje a salix - /* val ticket = + //enviar mensaje a salix + val ticket = "[" + sales[position].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[position].ticketFk + "/summary)" val message = - "Se ha modificado la cantidad original " + sales[position].originalQuantity + " del artículo " + sales[position].itemFk + " a nueva cantidad: " + sales[position].quantity + " del ticket " + ticket + "Se ha enviado a Faltas la cantidad de " + totalQuantity + " del articulo " + sales[position].itemFk + " ticket " + ticket viewModel.sendChekingPresence( token = token, workerId = sales[position].salePersonFk, message = message, "sendChekingPresence" - )*/ - }*/ + ) + } + + private fun missing(position: Int, quantity: String) { + var totalQuantity: Int = 0 + try { + totalQuantity = sales[position].quantity.toInt() - quantity.toInt() + } catch (e: Exception) { + } + viewModel.collectionMissingTrash( + usuario = user, + password = password, + saleFk = sales[position].saleFk, + quantity = totalQuantity.toString(), + warehouseFk = warehouseFk, + type = "TRUE", + originalQuantity = quantity, + callFunction = "collectionMissingTrash", + ) + //sales[position].originalQuantity = quantity + sales[position].quantity = quantity + //sales[position].startQuantity = quantity + + if (quantity == "0") + markLine(position, type) + saleAdapter!!.notifyDataSetChanged() + + //enviar mensaje a salix + val ticket = + "[" + sales[position].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[position].ticketFk + "/summary)" + val message = + "Se ha enviado a Basura " + totalQuantity + " del articulo " + sales[position].itemFk + " ticket " + ticket + viewModel.sendChekingPresence( + token = token, + workerId = sales[position].salePersonFk, + message = message, + "sendChekingPresence" + ) + } + + private fun reject(position: Int, quantity: String) { + positionReject = position + quantityReject = quantity + + var totalQuantity: Int = 0 + try { + totalQuantity = sales[position].quantity.toInt() - quantity.toInt() + } catch (e: Exception) { + } + viewModel.collectionMissingTrash( + usuario = user, + password = password, + saleFk = sales[position].saleFk, + quantity = totalQuantity.toString(), + warehouseFk = warehouseFk, + type = "reject", + originalQuantity = quantity, callFunction = "collectionMissingTrash" + ) + + //sales[position].originalQuantity = quantity + sales[position].quantity = quantity + //sales[position].startQuantity = quantity + + + saleAdapter!!.notifyDataSetChanged() + if (quantity == "0") + markLine(position, type) + + //enviar mensaje a salix + /* val ticket = + "[" + sales[position].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[position].ticketFk + "/summary)" + val message = + "Se ha modificado la cantidad original " + sales[position].originalQuantity + " del artículo " + sales[position].itemFk + " a nueva cantidad: " + sales[position].quantity + " del ticket " + ticket + viewModel.sendChekingPresence( + token = token, + workerId = sales[position].salePersonFk, + message = message, "sendChekingPresence" + )*/ + }*/ private fun missingTrashSuccesful() { - var message="" + var message = "" sales[positionCollectionMissing].quantity = quantityCollectionMissing saleAdapter!!.notifyDataSetChanged() @@ -2056,33 +2183,37 @@ class CollectionFragment( var totalQuantity: Int = 0 try { - totalQuantity = sales[positionCollectionMissing].originalQuantity.toInt() - quantityCollectionMissing.toInt() + totalQuantity = + sales[positionCollectionMissing].originalQuantity.toInt() - quantityCollectionMissing.toInt() } catch (e: Exception) { } - saleAdapter!!.notifyDataSetChanged() + saleAdapter!!.notifyDataSetChanged() - val ticket = - "[" + sales[positionCollectionMissing].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionCollectionMissing].ticketFk + "/summary)" + val ticket = + "[" + sales[positionCollectionMissing].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionCollectionMissing].ticketFk + "/summary)" - when (typeCollectionMissing){ + when (typeCollectionMissing) { - "TRUE"->{ - message = "Se ha enviado a Basura " + totalQuantity + " del articulo " + sales[positionCollectionMissing].itemFk + " ticket " + ticket + "TRUE" -> { + message = + "Se ha enviado a Basura " + totalQuantity + " del articulo " + sales[positionCollectionMissing].itemFk + " ticket " + ticket } - "FALSE"->{ - message= "Se ha enviado a Faltas la cantidad de " + totalQuantity + " del articulo " + sales[positionCollectionMissing].itemFk + " ticket " + ticket + "FALSE" -> { + message = + "Se ha enviado a Faltas la cantidad de " + totalQuantity + " del articulo " + sales[positionCollectionMissing].itemFk + " ticket " + ticket } - "reject"->{ - message = "Se ha modificado la cantidad de " + sales[positionCollectionMissing].originalQuantity + " del artículo " + sales[positionCollectionMissing].itemFk + " a nueva cantidad: " + sales[positionCollectionMissing].quantity + " del ticket " + ticket + "reject" -> { + message = + "Se ha modificado la cantidad de " + sales[positionCollectionMissing].originalQuantity + " del artículo " + sales[positionCollectionMissing].itemFk + " a nueva cantidad: " + sales[positionCollectionMissing].quantity + " del ticket " + ticket } } - sendSalixMessageNew(message, sales[positionCollectionMissing].salePersonFk) + sendSalixMessageNew(message, sales[positionCollectionMissing].salePersonFk) binding.splashProgress.visibility = VISIBLE viewModel.collectionTicketGet( @@ -2103,7 +2234,7 @@ class CollectionFragment( // sergio: se añade linea para que se actualice la originalQuantity //sales[positionIncreaseQuantity].originalQuantity = quantityIncrease - sales[positionIncreaseQuantity].quantity = quantityIncrease + sales[positionIncreaseQuantity].quantity = quantityIncrease /*if (type == CONTROLADOR){ showShelving(position,0,quantityPicked) }*/ @@ -2148,63 +2279,74 @@ class CollectionFragment( positionIncreaseQuantity = position quantityIncrease = quantity - viewModel.collectionIncreaseQuantity( - getData(USER), - getData(PASSWORD), - saleFk = sales[position].saleFk, - quantity = quantity, "collection_increaseQuantity" - ) + var working_in_test = true // sergio: en proves app + + if (!working_in_test) { + viewModel.collectionIncreaseQuantity( + getData(USER), + getData(PASSWORD), + saleFk = sales[position].saleFk, + quantity = quantity, "collection_increaseQuantity" + ) + + } else { + viewModel.collectionIncreaseQuantitySalix( + getData(TOKEN), + saleFk = sales[position].saleFk, + quantity = quantity, "collection_increaseQuantity" + ) + } } //ESTADOS private fun changeTicketState() { - if (type == CONTROLADOR) { - tickets.forEach { - viewModel.ticket_setState( - usuario=getData(USER), - password = getData(PASSWORD), - ticketFk = it, - state = "CHECKED", - callFunction = "ticket_setState" - ) - } - } else if (type == SACADOR) { - tickets.forEach { - viewModel.ticket_setState( - usuario=getData(USER), - password = getData(PASSWORD), - ticketFk = it, - state = "PREPARED", - callFunction = "ticket_setState" - ) - } - - } - } - - /* private fun changeInitTicketState() { if (type == CONTROLADOR) { tickets.forEach { - viewModel.collectionUpdateState( - getData(USER), - getData(PASSWORD), - collectionFk = it, - state = ON_CHECKING, "collection_updateState" + viewModel.ticket_setState( + usuario = getData(USER), + password = getData(PASSWORD), + ticketFk = it, + state = "CHECKED", + callFunction = "ticket_setState" ) } } else if (type == SACADOR) { tickets.forEach { - viewModel.collectionUpdateState( - getData(USER), - getData(PASSWORD), - collectionFk = it, - state = ON_PREPARATION, "collection_updateState" + viewModel.ticket_setState( + usuario = getData(USER), + password = getData(PASSWORD), + ticketFk = it, + state = "PREPARED", + callFunction = "ticket_setState" ) } + } - }*/ + } + + /* private fun changeInitTicketState() { + if (type == CONTROLADOR) { + tickets.forEach { + viewModel.collectionUpdateState( + getData(USER), + getData(PASSWORD), + collectionFk = it, + state = ON_CHECKING, "collection_updateState" + ) + } + } else if (type == SACADOR) { + tickets.forEach { + viewModel.collectionUpdateState( + getData(USER), + getData(PASSWORD), + collectionFk = it, + state = ON_PREPARATION, "collection_updateState" + ) + } + } + }*/ //OTROS private fun showScanner(index: Int, sale: SaleVO) { @@ -2267,8 +2409,9 @@ class CollectionFragment( override fun onBarcodeRowClickListener(item: BarcodeVO) { list.forEach { if (it.description == item.code) { - viewModel.saleMistakeAdd(usuario = getData(USER), - password = getData(PASSWORD), + viewModel.saleMistakeAdd( + usuario = getData(USER), + password = getData(PASSWORD), vSaleFk = mistakeSale?.saleFk!!, vUserFk = mistakeSale?.workerFk!!, vTypeFk = it.id, "saleMistake_Add" diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionViewModel.kt index faaff1bf..4c10bc7a 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionViewModel.kt @@ -1,8 +1,10 @@ package es.verdnatura.presentation.view.feature.collection.fragment import android.content.Context +import android.util.Log import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData +import com.google.gson.JsonObject import es.verdnatura.domain.GetLoginUserCase import es.verdnatura.domain.GetSacadorControladorUserCase import es.verdnatura.domain.GetUbicadorUserCase @@ -11,6 +13,7 @@ import es.verdnatura.presentation.common.ResponseItemVO import es.verdnatura.presentation.view.feature.collection.ItemVO import es.verdnatura.presentation.view.feature.collection.mapper.map import es.verdnatura.presentation.view.feature.sacador.model.* +import org.json.JSONObject import retrofit2.Call import retrofit2.Callback import retrofit2.Response @@ -37,6 +40,14 @@ class CollectionViewModel(context: Context) : BaseViewModel() val response: LiveData get() = _response + private val _responseDel by lazy { MutableLiveData() } + val responseDel: LiveData + get() = _responseDel + + private val _responseItemShelvingUpdate by lazy { MutableLiveData() } + val responseItemShelvingUpdate: LiveData + get() = _responseItemShelvingUpdate + private val _responseSaleMove by lazy { MutableLiveData() } val responseSaleMove: LiveData get() = _responseSaleMove @@ -585,7 +596,7 @@ class CollectionViewModel(context: Context) : BaseViewModel() { override fun onFailure(call: Call, t: Throwable) { - _response.value = ResponseItemVO( + _responseDel.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) ) @@ -595,19 +606,49 @@ class CollectionViewModel(context: Context) : BaseViewModel() { if (response.body() == null) { - _response.value = ResponseItemVO( + _responseDel.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) ) } else { - _response.value = + _responseDel.value = ResponseItemVO(isError = false, response = response.body()!!) } } }) } + fun itemShelving_updateFromSale(usuario: String, password: String, itemShelvingFk: String,visible:String,callFunction:String) + { + getSacadorControladorUserCase.itemShelving_updateFromSale(usuario, password, itemShelvingFk, visible) + .enqueue(object : Callback + { + override fun onFailure(call: Call, t: Throwable) + { + _responseItemShelvingUpdate.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) + ) + } + + override fun onResponse(call: Call, response: Response) + { + if (!response.isSuccessful ) + { + _responseItemShelvingUpdate.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) + ) + } else + { + _responseItemShelvingUpdate.value = + ResponseItemVO(isError = false, response = response.message()!!) + } + } + }) + } + fun parking(usuario: String, password: String, ticketFk: String, parking: String,callFunction:String) { getUbicadorUserCase.shelvingPark(usuario, password, ticketFk, parking) @@ -704,6 +745,36 @@ class CollectionViewModel(context: Context) : BaseViewModel() }) } + fun getIdFromCodeSalix(token: String, code: String) + { + getSacadorControladorUserCase.getIdFromCodeSalix(token, code) + .enqueue(object : Callback + { + override fun onFailure(call: Call, t: Throwable) + { + _responseCode.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) + ) + } + + override fun onResponse(call: Call, response: Response) + { + if (response.body() == null) + { + _responseCode.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) + ) + } else + { + _responseCode.value = + ResponseItemVO(isError = false, response = response.body()!!) + } + } + }) + } + fun collectionIncreaseQuantity( usuario: String, password: String, @@ -730,14 +801,6 @@ class CollectionViewModel(context: Context) : BaseViewModel() override fun onResponse(call: Call, response: Response) { - /* if (response.isSuccessful){ - _responseIncQuantity.value = - ResponseItemVO(isError = false, response = response.body()!!) - }else{ - _responseIncQuantity.value = ResponseItemVO( - isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) - }*/ if (response.body() == null) { _responseIncQuantity.value = ResponseItemVO( @@ -753,6 +816,44 @@ class CollectionViewModel(context: Context) : BaseViewModel() }) } + fun collectionIncreaseQuantitySalix( + + token: String, + saleFk: String, + quantity: String,callFunction:String + ) + { + getSacadorControladorUserCase.collectionIncreaseQuantitySalix( + token, + saleFk, + quantity + ).enqueue(object : Callback + { + override fun onFailure(call: Call, t: Throwable) + { + _responseIncQuantity.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) + ) + } + + override fun onResponse(call: Call, response: Response) + { + + if (!response.isSuccessful) + { + _responseIncQuantity.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) + ) + } else + { + _responseIncQuantity.value = + ResponseItemVO(isError = false, response = response.message().toString()) + } + } + }) + } fun sendChekingPresence(token: String, workerId: String, message: String,calledFunction:String) { try @@ -763,11 +864,11 @@ class CollectionViewModel(context: Context) : BaseViewModel() override fun onResponse(call: Call, response: Response) { - if (!response.isSuccessful) + if (!response.isSuccessful || response.message()=="false") { _responseSalixMessage.value = ResponseItemVO( isError = true, - errorMessage = "Error en la llamada $calledFunction al enviar mensaje rocket." + getMessageFromAllResponse( + errorMessage = "Error al enviar mensaje rocket." + getMessageFromAllResponse( nameofFunction(this),response.message() )) //Log.i("Salix","Mensaje enviado a salix") @@ -777,11 +878,11 @@ class CollectionViewModel(context: Context) : BaseViewModel() override fun onFailure(call: Call, t: Throwable) { - /*_responseSalixMessage.value = ResponseItemVO( + _responseSalixMessage.value = ResponseItemVO( isError = true, - errorMessage = "Error en la llamada $calledFunction al enviar mensaje rocket." + getMessageFromAllResponse( + errorMessage = "Error al enviar mensaje rocket." + getMessageFromAllResponse( nameofFunction(this),t.message!!)) -*/ + //Log.i("Salix Error",""+t.message) } }) @@ -908,7 +1009,67 @@ class CollectionViewModel(context: Context) : BaseViewModel() } }) } + fun sip_getExtensionSalix( + token:String, + workerId: String, + callFunction:String + ) + { + getSacadorControladorUserCase.sip_getExtensionSalix( + token, + workerId + ).enqueue(object : + Callback + { + override fun onFailure(call: Call, t: Throwable) + { + _responseGetExtensionFromUserId.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) + ) + } + override fun onResponse( + call: Call, + response: Response + ) + { + // No se ajusta ya que la response is Successful pero el valor retornado es un error y por lo tanto response.body nulo y tira error + /* if (response.isSuccessful ){ + _responseGetExtensionFromUserId.value = ResponseItemVO( + isError = false, + response = JSONObject(response.body()!!.toString()).get("extension").toString(), + errorMessage = "") + }else{ + _responseGetExtensionFromUserId.value = ResponseItemVO( + isError = true, + response = response.message()!!, + errorMessage = "No se puede realizar la llamada. El usuario no tiene la extensión configurada. Solicítelo a informática.") + + }*/ + if (response.body() != null) + { + _responseGetExtensionFromUserId.value = ResponseItemVO( + isError = false, + response = JSONObject(response.body()!!.toString()).get("extension").toString(), + errorMessage = "" + ) + // Se prueba el call como JSONOBJECT pero no da resultado porque el sevidor puede devolver un null directamente y salta error MAlformed + // Se deja Any para obtener cualquier tipo de objeto y si no es nulo se parsea a Json + + // Per al cas que el CAll siga Any enlloc de JsonObject: + //var answerError=(JSONObject(response.body().toString()).get("extension").toString()) + //var messageFromError = answerError.get("extension").toString() + //Log.d("VERDNATURA::","Message ext"+messageFromError) + }else{ + _responseGetExtensionFromUserId.value = ResponseItemVO( + isError = true, + response = response.message()!!, + errorMessage = "No se puede realizar la llamada. El usuario no tiene la extensión configurada. Solicítelo a informática.") + } + } + }) + } fun ticket_checkFullyControlled( usuario: String, password: String, diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/ShowTicketFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/ShowTicketFragment.kt index 3ced79d0..87105bf4 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/ShowTicketFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/ShowTicketFragment.kt @@ -106,7 +106,7 @@ class CollectionShowTicketFragment( private fun print() { - if (ma.havePrinter()) { + if (ma.havePrinter() && ma.haveSector()) { viewModel.collectionStickerPrint( usuario = getData(USER), password = getData(PASSWORD), diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/diadeventa/fragment/DayOfSaleFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/diadeventa/fragment/DayOfSaleFragment.kt index 8d1ec42b..e418e345 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/diadeventa/fragment/DayOfSaleFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/diadeventa/fragment/DayOfSaleFragment.kt @@ -119,7 +119,7 @@ class DayOfSaleFragment( if (it.list.isEmpty()){ customDialog.setTitle("Sin resultados") - .setDescription("No se ha podido obtener datos de la etiqueta escaneada. ") + .setDescription("No hay nada vendido para el carro escaneado. ") .setOkButton("Cerrar") { customDialog.dismiss() }.show() diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/historicovehiculo/fragment/HistoricoVehiculoFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/historicovehiculo/fragment/HistoricoVehiculoFragment.kt index 84650bbd..fe31d3da 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/historicovehiculo/fragment/HistoricoVehiculoFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/historicovehiculo/fragment/HistoricoVehiculoFragment.kt @@ -61,6 +61,11 @@ class HistoricoVehiculoFragment ( if (it.list.isEmpty()){ ma.messageWithSound("Solo puedes visualizar cuando has cogido tu mismo el vehículo a no ser que tengas permisos para ello.",true,true,"Información") + }else{ + if (it.list[0].isError){ + ma.messageWithSound(it.list[0].errorMessage,true,true,"Información") + + } } } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/historicovehiculo/fragment/HistoricoVehiculoViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/historicovehiculo/fragment/HistoricoVehiculoViewModel.kt index 935a04aa..e126e6f4 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/historicovehiculo/fragment/HistoricoVehiculoViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/historicovehiculo/fragment/HistoricoVehiculoViewModel.kt @@ -13,6 +13,7 @@ import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHisto import retrofit2.Call import retrofit2.Callback import retrofit2.Response +import timber.log.Timber.d import timber.log.Timber.i class HistoricoVehiculoViewModel (context: Context) : BaseViewModel() { @@ -32,6 +33,7 @@ class HistoricoVehiculoViewModel (context: Context) : BaseViewModel() { val listError:ArrayList = ArrayList() listError.add(ItemHistoricoVehiculo(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!))) _historicovehiculoList.value = ItemHistoricoVehiculoList(listError) + } override fun onResponse( @@ -39,13 +41,16 @@ class HistoricoVehiculoViewModel (context: Context) : BaseViewModel() { response: Response> ) { if (response.body() != null){ - i("El response es "+response.body()) + _historicovehiculoList.value = response.body()?.let { ItemHistoricoVehiculoList(it) } + }else{ val listError:ArrayList = ArrayList() listError.add(ItemHistoricoVehiculo(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))) _historicovehiculoList.value = ItemHistoricoVehiculoList(listError) + } + } }) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryViewModel.kt index 3fe6431b..3e700d7c 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryViewModel.kt @@ -194,14 +194,43 @@ class InventaryViewModel(context: Context) : BaseViewModel() { }) } - - - fun department_getHasMistake(usuario: String, password: String) + fun department_getHasMistakeSalix(token:String) { - var working_in_test=false - //getWorkerMistakeUserCase.department_getHasMistakeSalix(usuario, password) - getWorkerMistakeUserCase.department_getHasMistake(usuario, password) + getWorkerMistakeUserCase.department_getHasMistakeSalix(token) + + .enqueue(object : Callback> + { + override fun onFailure(call: Call>, t: Throwable) + { + val listError: ArrayList = ArrayList() + listError.add(DepartmentMistake(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!))) + _mistakeDepartmentList.value = departmentMistakeList(listError) + } + + override fun onResponse( + call: Call>, + response: Response> + ) + { + if (response.body() != null) + { + _mistakeDepartmentList.value = response.body()?.let { departmentMistakeList(it) } + } else + { + val listError: ArrayList = ArrayList() + listError.add(DepartmentMistake("0", "")) + _mistakeDepartmentList.value = departmentMistakeList(listError) + } + } + + }) + } + + fun department_getHasMistake(usuario:String, password:String) + { + + getWorkerMistakeUserCase.department_getHasMistake(usuario, password) .enqueue(object : Callback> { override fun onFailure(call: Call>, t: Throwable) @@ -314,11 +343,18 @@ class InventaryViewModel(context: Context) : BaseViewModel() { { if (!response.isSuccessful) { + if (response.code()==403){ + _responseAddMistake.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this),"Usuario sin permisos para realizar la acción") + ) + }else{ d("Error message:"+{response.errorBody()}+"-"+response.message()+"-"+response.raw()) _responseAddMistake.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) ) + } } else { diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt index cb578415..6e1decac 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt @@ -8,6 +8,7 @@ import android.content.pm.PackageInfo import android.content.pm.PackageManager import android.net.Uri import android.provider.Settings +import android.util.Log import android.view.KeyEvent import android.view.View import androidx.lifecycle.Observer @@ -86,8 +87,9 @@ class LoginFragment : BaseFragment(LoginVi @SuppressLint("HardwareIds") private fun saveIdentifiers() { - val AndroidId: String = Settings.Secure.getString(requireActivity().contentResolver, Settings.Secure.ANDROID_ID) - saveData(ANDROID_ID,AndroidId) + val AndroidId: String = + Settings.Secure.getString(requireActivity().contentResolver, Settings.Secure.ANDROID_ID) + saveData(ANDROID_ID, AndroidId) } @@ -260,31 +262,37 @@ class LoginFragment : BaseFragment(LoginVi workergetSector.observe(viewLifecycleOwner) { binding.splashProgress.visibility = View.GONE - if (it.id != 0) { - saveDataInt("sectorFk", it.id) - saveData("sectordescrip", it.description) - it.warehouseFk?.let { it1 -> saveDataInt("warehouseFk", it1) } + + if (it.isError) { + removeSector() + Log.d("VERDNATURA::","ERROR") + } else { + if (it.id != 0) { + saveDataInt("sectorFk", it.id) + saveData("sectordescrip", it.description) + it.warehouseFk?.let { it1 -> saveDataInt("warehouseFk", it1) } + } } } - loadWorkerPrintList.observe(viewLifecycleOwner, Observer{ event -> + loadWorkerPrintList.observe(viewLifecycleOwner, Observer { event -> binding.splashProgress.visibility = View.GONE event.getContentIfNotHandled().notNull { - if (it.list.isEmpty()){ - "Tiene que seleccionar impresora.".toast(context) - }else{ - if (!it.list.get(0).isError){ + if (it.list.isEmpty()) { + "Tiene que seleccionar impresora.".toast(context) + } else { + if (!it.list.get(0).isError) { saveDataInt(PRINTERFK, it.list.get(0).id!!) saveData(PRINTERNAME, it.list.get(0).name!!) - }else{ + } else { it.list.get(0).errorMessage.toast(context) } } - } + } - }) + }) @@ -332,12 +340,12 @@ class LoginFragment : BaseFragment(LoginVi editor.apply() } - /* private fun saveUserFkPref(loginitem: LoginItemVO) { - val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0) - val editor = prefs.edit() - editor.putString(USERFK, loginitem.id) - editor.apply() - }*/ + /* private fun saveUserFkPref(loginitem: LoginItemVO) { + val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0) + val editor = prefs.edit() + editor.putString(USERFK, loginitem.id) + editor.apply() + }*/ private fun saveUserFkPref(workerId: String) { val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0) @@ -386,10 +394,10 @@ class LoginFragment : BaseFragment(LoginVi editor.commit() }*/ - /* fun getDefaults(key: String?, context: Context?): String? { - val preferences = PreferenceManager.getDefaultSharedPreferences(context) - return preferences.getString(key, null) - }*/ + /* fun getDefaults(key: String?, context: Context?): String? { + val preferences = PreferenceManager.getDefaultSharedPreferences(context) + return preferences.getString(key, null) + }*/ // sergio:creada restart en BaseFragment para AjustesFragment... 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 d414e610..b4340f6f 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 @@ -401,7 +401,6 @@ class LoginViewModel(context: Context) : BaseViewModel() getLoginUserCase.worker_getSector(user,password).enqueue(object : Callback{ override fun onFailure(call: Call, t: Throwable) { - Timber.d("El sector failure " + t.message!!) _workergetSector.value = SectorItemVO(0,"",0,isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt index 76fa4ce8..940facc8 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt @@ -9,6 +9,7 @@ import android.widget.Toast import androidx.core.content.ContextCompat import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentManager +import com.google.android.material.bottomnavigation.LabelVisibilityMode.LABEL_VISIBILITY_UNLABELED import es.verdnatura.BuildConfig import es.verdnatura.R import es.verdnatura.databinding.ActivityMainBinding @@ -85,17 +86,24 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL mperror = MediaPlayer.create((this), R.raw.error) mpok = MediaPlayer.create((this), R.raw.ok) - - customDialog = CustomDialogMainActivity(this) - setBottomMenu() + + // working_in_design = para nuevo diseño app + SetisWorkingInDesign(false) + + + if (isWorkingInDesign()) { + setBottomMenuFragment() + } else { + setBottomMenu() + } - - - if (haveSector() && havePrinter()) addFragment( - PasilleroFragment.newInstance("Verdnatura"), + if (haveSector() && havePrinter()) addFragment( + /* working_in_design nuevo diseño*/ + // PasilleroFragment.newInstance("Verdnatura_design",true), + PasilleroFragment.newInstance("Verdnatura", false), R.id.main_frame_layout, PasilleroFragment.TAG, false @@ -113,39 +121,34 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL } - //navigationDrawer() - } - private fun navigationDrawer(){ - - /* val drawerLayout = binding.drawerLayout - drawerLayout.open() - - val toggle = ActionBarDrawerToggle( - this, - drawerLayout, - toolbar, - "abierto", - "cerrado" - ) - drawerLayout.addDrawerListener(toggle) - toggle.syncState()*/ - - } - /* private fun navigateToFragment(){ - val navHostFragment = - supportFragmentManager.findFragmentById(R.id.main_frame_layout) as NavHostFragment - val navController = navHostFragment.navController - navController.navigate(R.id.action_pasilleroFragment_to_ajustesFragment) - } -*/ - private fun haveSector(): Boolean { + fun haveSector(): Boolean { val prefs: SharedPreferences = getSharedPreferences("es.verdnatura.user.prefs", 0) val sectorFk = prefs.getInt("sectorFk", -1) return sectorFk != -1 } + + fun isWorkingInDesign():Boolean{ + val prefs: SharedPreferences = getSharedPreferences("es.verdnatura.user.prefs", 0) + val working= prefs.getInt("working_in_design", -1) + return working != -1 + } + fun SetisWorkingInDesign(isWorkingIn: Boolean) { + val prefs: SharedPreferences = getSharedPreferences("es.verdnatura.user.prefs", 0) + val editor = prefs.edit() + if (isWorkingIn){ + editor.putInt("working_in_design", 0) + editor.apply() + }else{ + editor.putInt("working_in_design", -1) + editor.apply() + } + + + } + fun havePrinter(): Boolean { val prefs: SharedPreferences = getSharedPreferences("es.verdnatura.user.prefs", 0) val printerFk = prefs.getInt("printerFk", -1) @@ -262,7 +265,7 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE) delete_Fragments() addFragment( - PasilleroFragment.newInstance("Verdnatura"), + PasilleroFragment.newInstance("Verdnatura", isInitMenu = false), R.id.main_frame_layout, PasilleroFragment.TAG, false @@ -290,11 +293,11 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL ControladorFragment.TAG, false ) - /*addFragment( - CollectionFragment.newInstance(type = "CHECKER", collection = CollectionVO()), - R.id.main_frame_layout, - ControladorFragment.TAG, - false)*/ + /* addFragment( + CollectionFragment.newInstance(type = "CHECKER", collection = CollectionVO()), + R.id.main_frame_layout, + ControladorFragment.TAG, + false)*/ // true } getString(R.string.Paletizadores) -> { @@ -302,7 +305,7 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL delete_Fragments() //addFragment(ExpeditionTruckListFragment.newInstance(),R.id.main_frame_layout, ExpeditionTruckListFragment.TAG,false) addFragment( - PasilleroFragment.newInstance("Paletizadores"), + PasilleroFragment.newInstance("Paletizadores", isInitMenu = false), R.id.main_frame_layout, PasilleroFragment.TAG, false @@ -332,6 +335,186 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL } } + fun setBottomMenuFragment() { + val bottomMenu = binding.mainBottomNavigation + //iconos abajo sin texto + bottomMenu.labelVisibilityMode = LABEL_VISIBILITY_UNLABELED + + bottomMenu.itemIconTintList = null + GlobalScope.launch(Dispatchers.Main) { + val bottomMenuItems: ArrayList = ArrayList() + + bottomMenuItems.add( + ItemMenuVO( + 0, + title = getString(R.string.Pasilleros), + defaultImage = ContextCompat.getDrawable( + applicationContext, R.drawable.ic_init_ui + ), + selectedImage = ContextCompat.getDrawable( + applicationContext, R.drawable.ic_init_ui_selected + ) + ) + ) + + bottomMenuItems.add( + ItemMenuVO( + 1, + title = getString(R.string.verticket), + defaultImage = ContextCompat.getDrawable( + applicationContext, R.drawable.ic_eye_ui + ), + selectedImage = ContextCompat.getDrawable( + applicationContext, R.drawable.ic_eye_ui_selected + ) + ) + ) + + bottomMenuItems.add( + ItemMenuVO( + 2, + title = getString(R.string.Parking), + defaultImage = ContextCompat.getDrawable( + applicationContext, R.drawable.ic_parking_ui + ), + selectedImage = ContextCompat.getDrawable( + applicationContext, R.drawable.ic_parking_ui_selected + ) + ) + ) + + bottomMenuItems.add( + ItemMenuVO( + 3, + title = getString(R.string.Ajustes), + defaultImage = ContextCompat.getDrawable( + applicationContext, R.drawable.ic_setting_ui + ), + selectedImage = ContextCompat.getDrawable( + applicationContext, R.drawable.ic_setting_ui_selected + ) + ) + ) + + + // Add al items to menu view + bottomMenuItems.forEach { + bottomMenu.menu.add(Menu.NONE, it.id, Menu.NONE, it.title).icon = it.defaultImage + } + + + if (haveSector()) { + // Select first item by default + firstItem = bottomMenuItems.first() + bottomMenu.selectedItemId = firstItem!!.id + bottomMenu.menu.findItem(firstItem!!.id).icon = firstItem!!.selectedImage + lastBottomMenuItemSelected = firstItem + } else { + // Select last item by default + val lastItem = bottomMenuItems.last() + bottomMenu.selectedItemId = lastItem.id + bottomMenu.menu.findItem(lastItem.id).icon = lastItem.selectedImage + lastBottomMenuItemSelected = lastItem + } + + + bottomMenu.setOnNavigationItemSelectedListener { menuItem -> + // Get selected item from itemList and apply ui changes to menu view + val selectedItemMenu = bottomMenuItems.find { menuItem.itemId == it.id } + menuItem.icon = selectedItemMenu?.selectedImage + + // Get last selected item and disable it + bottomMenu.menu.findItem(lastBottomMenuItemSelected?.id!!).icon = + lastBottomMenuItemSelected?.defaultImage + lastBottomMenuItemSelected = selectedItemMenu + + + when (selectedItemMenu?.title) { + + + getString(R.string.Pasilleros) -> { + fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE) + delete_Fragments() + addFragment( + PasilleroFragment.newInstance("Verdnatura_design", true), + R.id.main_frame_layout, + PasilleroFragment.TAG, + false + ) + + } + getString(R.string.Sacadores) -> { + fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE) + delete_Fragments() + addFragment( + ControlVehiculoFragment.newInstance(MAINACTIVITY), + R.id.main_frame_layout, + MAINACTIVITY.TAG, + false + ) + + } + getString(R.string.verticket) -> { + fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE) + delete_Fragments() + addFragment( + ShowTicketFragment.newInstance(), + R.id.main_frame_layout, + MAINACTIVITY.TAG, + false + ) + + } + getString(R.string.Parking) -> { + fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE) + delete_Fragments() + addFragment( + ParkingFragment.newInstance(), + R.id.main_frame_layout, + MAINACTIVITY.TAG, + false + ) + + + } + getString(R.string.Ajustes) -> { + fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE) + delete_Fragments() + addFragment( + AjustesFragment.newInstance(), + R.id.main_frame_layout, + AjustesFragment.TAG, + false + ) + } + + + } + + true + } + /* working_in_design: para cuando son seleccionados de nuevo */ + + /*bottomMenu.setOnNavigationItemReselectedListener { + when (it.title){ + getString(R.string.Pasilleros) -> { + fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE) + delete_Fragments() + addFragment( + PasilleroFragment.newInstance("Verdnatura_design",true), + R.id.main_frame_layout, + PasilleroFragment.TAG, + false + ) + + } + } + + }*/ + + } + } + private fun delete_Fragments() { fm.getFragments().forEach { ///Log.i("VERDNATURA:", "si esta ${it.tag.toString()}") @@ -344,6 +527,7 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL override fun onPasillerosItemClickListener(item: PasillerosItemVO, entryPoint: String) { + when (item.title) { "Asociar Sacador SmartTags" -> { @@ -358,6 +542,43 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL "Paletizar" -> { addFragmentOnTop(ExpeditionTruckListFragment.newInstance()) } + + getString(R.string.Paletizadores) -> { + fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE) + // delete_Fragments() + //addFragment(ExpeditionTruckListFragment.newInstance(),R.id.main_frame_layout, ExpeditionTruckListFragment.TAG,false) + addFragment( + PasilleroFragment.newInstance( + getString(R.string.Paletizadores), + isInitMenu = false + ), + R.id.main_frame_layout, + PasilleroFragment.TAG, + false + ) + } + getString(R.string.Controladores) -> { + fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE) + delete_Fragments() + addFragment( + ControladorFragment.newInstance(), + R.id.main_frame_layout, + ControladorFragment.TAG, + false + ) + } + + getString(R.string.Pasilleros) -> { + fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE) + delete_Fragments() + addFragment( + PasilleroFragment.newInstance("Verdnatura", isInitMenu = false), + R.id.main_frame_layout, + PasilleroFragment.TAG, + false + ) + } + getString(R.string.ExpeditionState) -> { // addFragment(ExpeditionStateFragment.newInstance(entryPoint),R.id.main_frame_layout, ExpeditionTruckListFragment.TAG,false) addFragmentOnTop(ExpeditionStateFragment.newInstance(item.title)) @@ -367,7 +588,12 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL } "Gestión de buffers" -> { - addFragmentOnTop(PasilleroFragment.newInstance("Gestión de buffer")) + addFragmentOnTop( + PasilleroFragment.newInstance( + "Gestión de buffer", + isInitMenu = false + ) + ) } "Control de usuario de vehículo" -> { @@ -482,7 +708,7 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL addFragmentOnTop(WorkermistakeFragment.newInstance(item.title)) } - "Obtener colección previa"->{ + "Obtener colección previa" -> { addFragmentOnTop(InitPreSacadorFragment.newInstance(item.title)) } @@ -548,26 +774,26 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL } - /* fun onParkingSaleSelected(sales: SaleVO) { - addFragmentOnTop(ParkingSaleFragment.newInstance(SaleVO = sales)) - }*/ + /* fun onParkingSaleSelected(sales: SaleVO) { + addFragmentOnTop(ParkingSaleFragment.newInstance(SaleVO = sales)) + }*/ override fun onCollectionSelected(collection: CollectionVO, type: String) { // fm.popBackStack() - when (type){ - PREITEMPICKER->{ - // d("VERDNATURA::"," entrando en preitempicker") + when (type) { + PREITEMPICKER -> { + // d("VERDNATURA::"," entrando en preitempicker") // d("VERDNATURA::"," entrando en preitempicker, la colecc es "+collection.collectionFk) - addFragmentOnTop(EndSacadorFragment.newInstance(collection,type)) + addFragmentOnTop(EndSacadorFragment.newInstance(collection, type)) } - "SHOWTICKET"->{ + "SHOWTICKET" -> { addFragmentOnTop(CollectionShowTicketFragment.newInstance(collection, type)) } - else->{ + else -> { addFragmentOnTop(CollectionFragment.newInstance(collection, type)) } } @@ -593,7 +819,7 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL fun onVehicleSelected(tag: String) { fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE) - // se pone a true en la pila para que cuando se vuelva atrás permanezca ya que se borran todos los fragmentos desde otras opciones + // se pone a true en la pila para que cuando se vuelva atrás permanezca ya que se borran todos los fragmentos desde otras opciones addFragment( ControlVehiculoFragment.newInstance(tag), R.id.main_frame_layout, @@ -604,10 +830,12 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL // addFragmentOnTop(ControlVehiculoFragment.newInstance(tag)) } - fun openFragmentPickers(delete:Boolean) { + fun openFragmentPickers(delete: Boolean) { //delete_Fragments() fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE) - if (delete){delete_Fragments()} + if (delete) { + delete_Fragments() + } addFragment( SacadorFragment.newInstance(), R.id.main_frame_layout, @@ -633,30 +861,39 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL binding.mainBottomNavigation.visibility = visible } - fun messageWithSound(message: String, isError: Boolean,isPlayed:Boolean?,titleWithError:String="Error",isToasted:Boolean?=false) { + fun hideBottomNavigationFragment(visible: Int) { + binding.mainBottomNavigationFragment.visibility = visible + } + + + fun messageWithSound( + message: String, + isError: Boolean, + isPlayed: Boolean?, + titleWithError: String = "Error", + isToasted: Boolean? = false + ) { if (!isError) { - if (isPlayed == true)(mpok?.start()) + if (isPlayed == true) (mpok?.start()) message.toast(this, Toast.LENGTH_SHORT) } else { - if (isPlayed == true)( mperror?.start()) + if (isPlayed == true) (mperror?.start()) - if (isToasted==true){ - message.toast(this, Toast.LENGTH_SHORT) - }else{ - customDialog.setTitle(titleWithError).setDescription(message) - .setOkButton("Aceptar") { - customDialog.dismiss() - }.show() - } + if (isToasted == true) { + message.toast(this, Toast.LENGTH_SHORT) + } else { + customDialog.setTitle(titleWithError).setDescription(message) + .setOkButton("Aceptar") { + customDialog.dismiss() + }.show() + } } - - } } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailFragment.kt index 3333a76c..8e8866dd 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailFragment.kt @@ -105,7 +105,7 @@ class ExpeditionPalletDetailFragment( }else if(item == iconPrint){ binding.splashProgress.visibility = View.VISIBLE - if (ma.havePrinter()) { + if (ma.havePrinter() && ma.haveSector()) { (getString(R.string.Imprimiendo) + getData(PRINTERNAME)).toast( requireContext() ) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/adapter/PasillerosAdapter.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/adapter/PasillerosAdapter.kt index fecfd494..7b5ee2f8 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/adapter/PasillerosAdapter.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/adapter/PasillerosAdapter.kt @@ -2,9 +2,15 @@ package es.verdnatura.presentation.view.feature.pasillero.adapter import android.content.Context import android.os.Build +import android.util.Log import android.view.LayoutInflater import android.view.ViewGroup +import androidx.databinding.DataBindingUtil +import androidx.databinding.ViewDataBinding import androidx.recyclerview.widget.RecyclerView +import es.verdnatura.BR +import es.verdnatura.R +import es.verdnatura.databinding.ItemMainMenuBinding import es.verdnatura.databinding.ItemPasillerosMainMenuBinding import es.verdnatura.presentation.common.OnPasillerosItemClickListener import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO @@ -12,15 +18,58 @@ import timber.log.Timber.d class PasillerosAdapter ( private val items: List, - private val onPasillerosItemClickListener: OnPasillerosItemClickListener + private val onPasillerosItemClickListener: OnPasillerosItemClickListener, + private val isMenuInit:Boolean + ): RecyclerView.Adapter () { var context : Context? = null override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PasillerosItemHolder { this.context = parent.context - return PasillerosItemHolder( - ItemPasillerosMainMenuBinding.inflate(LayoutInflater.from(parent.context),parent,false) - ) + + + val binding: ViewDataBinding = DataBindingUtil.inflate( + LayoutInflater.from(parent.context), + viewType, + parent, + false) + + + + return if (isMenuInit){ + PasillerosItemHolder(binding as ItemMainMenuBinding) + }else{ + PasillerosItemHolder(binding as ItemPasillerosMainMenuBinding) + } + + /* return if (!isMenuInit){ + PasillerosItemHolder( + //sergio working_in_design : modificar vista + + //ItemPasillerosMainMenuBinding.inflate(LayoutInflater.from(parent.context),parent,false) + ItemPasillerosMainMenuBinding.inflate(LayoutInflater.from(parent.context),parent,false) + + ) + }else{ + PasillerosItemHolder( + //sergio working_in_design : modificar vista + // ItemMainMenuBinding.inflate(LayoutInflater.from(parent.context),parent,false) + ItemMainMenuBinding.inflate(LayoutInflater.from(parent.context),parent,false) + ) + }*/ + + + + } + + override fun getItemViewType(position: Int): Int { + if (isMenuInit) return R.layout.item_main_menu + else{ + return R.layout.item_pasilleros_main_menu + } + + // return super.getItemViewType(position) + } override fun getItemCount() =items.size @@ -35,23 +84,64 @@ class PasillerosAdapter ( inner class PasillerosItemHolder( - val binding: ItemPasillerosMainMenuBinding + //sergio working_in_design : modificar vista + //val binding: ItemMainMenuBinding + val binding: ViewDataBinding + //val binding_: ItemPasillerosMainMenuBinding + + ) : RecyclerView.ViewHolder(binding.root){ + + + fun bind(item: PasillerosItemVO) { - binding.apply { + + binding.setVariable(BR.item,item) + binding.setVariable(BR.title, context?.getString(item.titleToShow)) + + + if (isMenuInit) + { + + try { + (binding as ItemMainMenuBinding).itemImage.setImageResource(item.iconResource) + }catch(exception:Exception){ + d("Exception::"+exception.message) + } + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + (binding as ItemMainMenuBinding).itemImage.tooltipText=item.description + } + + } + else{ + + try { + (binding as ItemPasillerosMainMenuBinding).itemImage.setImageResource(item.iconResource) + }catch(exception:Exception){ + d("Exception::"+exception.message) + } + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + (binding as ItemPasillerosMainMenuBinding).itemImage.tooltipText=item.description + } + + } + + /* binding.apply { this.item = item this.title = context?.getString(item.titleToShow) try { itemImage.setImageResource(item.iconResource) }catch(exception:Exception){ - d("Exception::"+exception.message) + d("Exception::"+exception.message) } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { itemImage.tooltipText=item.description } - } + }*/ } } } \ No newline at end of file diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroFragment.kt index 51ea7063..5ecfb628 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroFragment.kt @@ -3,7 +3,12 @@ package es.verdnatura.presentation.view.feature.pasillero.fragment import android.content.Context import android.os.Bundle import android.view.View +import android.widget.LinearLayout.VERTICAL +import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.LinearLayoutManager.HORIZONTAL +import androidx.recyclerview.widget.RecyclerView +import androidx.recyclerview.widget.RecyclerView.HORIZONTAL import es.verdnatura.R import es.verdnatura.databinding.FragmentPasilleroBinding import es.verdnatura.presentation.base.BaseFragment @@ -12,13 +17,15 @@ import es.verdnatura.presentation.view.feature.pasillero.adapter.PasillerosAdapt class PasilleroFragment( - var tagName: String = "" + var tagName: String = "", + var isInitMenu: Boolean ) : BaseFragment(PasilleroViewModel::class) { private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null companion object { - fun newInstance(tagName: String) = PasilleroFragment(tagName) + fun newInstance(tagName: String, isInitMenu: Boolean) = + PasilleroFragment(tagName, isInitMenu = isInitMenu) } override fun onAttach(context: Context) { @@ -29,36 +36,94 @@ class PasilleroFragment( override fun getLayoutId(): Int = R.layout.fragment_pasillero override fun init() { - ma.hideBottomNavigation(View.VISIBLE) - binding.mainToolbar.toolbarTitle.text = tagName - binding.mainToolbar.backButton.visibility = View.GONE + ma.hideBottomNavigation(View.VISIBLE) + + + + if (!ma.isWorkingInDesign()) { + binding.mainToolbar.toolbarTitle.text = tagName + binding.mainToolbar.backButton.visibility = View.VISIBLE + + binding.mainToolbarDesign.toolbarTitle.visibility = View.GONE + binding.mainToolbarDesign.toolbarSubtitle.visibility = View.GONE + binding.mainToolbarDesign.backButton.visibility = View.GONE + when (tagName) { + "Verdnatura" -> { + binding.mainToolbar.backButton.visibility = View.GONE + } + "Paletizadores" -> { + binding.mainToolbar.backButton.visibility = View.GONE + } + "Controlar ticket" -> { + binding.mainToolbar.backButton.visibility = View.GONE + } + "Verdnatura_design" -> { + binding.mainToolbar.backButton.visibility = View.GONE + + } + else-> binding.mainToolbar.backButton.visibility = View.VISIBLE + } + + } else { + when (tagName) { + "Verdnatura_design" -> { + binding.mainToolbarDesign.imageViewMenu.visibility = View.VISIBLE + binding.mainToolbarDesign.backButton.visibility = View.GONE + binding.mainToolbar.backButton.visibility = View.GONE + } + + tagName -> { + binding.mainToolbarDesign.toolbarTitle.text = tagName + binding.mainToolbarDesign.imageViewMenu.visibility = View.GONE + } + } + + + /* binding.mainToolbarDesign.toolbarTitle.visibility = View.VISIBLE + binding.mainToolbar.toolbarTitle.visibility = View.GONE + binding.mainToolbar.toolbarSubtitle.visibility = View.GONE + binding.mainToolbar.toolbarTitleSeparator.visibility = View.GONE*/ + + binding.mainToolbarDesign.backButton.visibility=View.INVISIBLE + binding.mainToolbarDesign.backButton.setOnClickListener { + + requireActivity().onBackPressed() + } + } + + + + super.init() } override fun onCreate(savedInstanceState: Bundle?) { - if (tagName.equals("Verdnatura")) { - viewModel.inititializeDefaultData() - } - if (tagName.equals("Paletizadores")) { - viewModel.inititializeDefaultPallet() + when (tagName) { + "Verdnatura" -> {viewModel.inititializeDefaultData()} + "Paletizadores" -> viewModel.inititializeDefaultPallet() + "Gestión de buffer" -> viewModel.inititializeDefaultBuffer() + "Verdnatura_design" -> viewModel.inititializeDefaultDataInit() } - if (tagName.equals("Gestión de buffer")) { - viewModel.inititializeDefaultBuffer() - - } super.onCreate(savedInstanceState) } override fun observeViewModel() { with(viewModel) { - binding.pasillerosItems.adapter= PasillerosAdapter(pasillerositem, pasillerosItemClickListener!!) + /* val mLayoutManager: RecyclerView.LayoutManager = GridLayoutManager( + activity, + requireActivity()!!.resources.getInteger(R.integer.number_of_grid_items) + )*/ + + binding.pasillerosItems.adapter = + PasillerosAdapter(pasillerositem, pasillerosItemClickListener!!, isInitMenu) binding.pasillerosItems.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) + } super.observeViewModel() 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 d8d841a9..2e875ea8 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 @@ -281,4 +281,51 @@ class PasilleroViewModel : BaseViewModel() { ) } + fun inititializeDefaultDataInit(){ + _pasillerositem.add( + PasillerosItemVO( + 7, + R.drawable.ic_corridor_ui, + "Pasilleros", R.string.Pasilleros,"Accede menú de los pasilleros:presacar, ver ticket, ubicador..." + ) + ) + //precontrol + _pasillerositem.add( + PasillerosItemVO(7, + R.drawable.ic_picker_ui, + "Sacadores",R.string.Sacadores,"Accede a sacar pedidos" + ) + ) + + //sergio para que aparezca el nuevo menu + _pasillerositem.add( + PasillerosItemVO( + 10, + R.drawable.ic_controller_ui, + "Controladores", R.string.Controladores,"Accede a la revisión de los tickets" + ) + ) + + _pasillerositem.add( + PasillerosItemVO( + 0, + R.drawable.ic_pallet_ui, + "Paletizadores", R.string.Paletizadores,"Accede al menú de paletizadores: paletizar, buffer..." + ) + ) + + + + _pasillerositem.add( + PasillerosItemVO( + 6, + R.drawable.ic_claim_ui, + "Reclamaciones", R.string.claims,"Accede al menú de reclamaciones" + ) + ) + + + + } + } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/EndSacadorFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/EndSacadorFragment.kt index b2ae3c48..e855f611 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/EndSacadorFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/EndSacadorFragment.kt @@ -1,5 +1,6 @@ package es.verdnatura.presentation.view.feature.presacador.fragment +import android.annotation.SuppressLint import android.content.Context import android.graphics.drawable.Drawable import android.media.MediaPlayer @@ -18,7 +19,6 @@ import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import es.verdnatura.R import es.verdnatura.databinding.FragmentPreSacadorBinding -import es.verdnatura.domain.ConstAndValues.PRESACADOR import es.verdnatura.domain.toast import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.common.* @@ -36,13 +36,14 @@ import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyListVO import es.verdnatura.presentation.view.feature.sacador.model.SaleVO -class EndSacadorFragment ( +class EndSacadorFragment( var collection: CollectionVO = CollectionVO(), var type: String = "" -): +) : BaseFragment(PreSacadorViewModel::class) { var mperror: MediaPlayer? = null var mpok: MediaPlayer? = null + //private var sales: ArrayList = ArrayList() private lateinit var sales: MutableList private lateinit var customDialog: CustomDialog @@ -64,10 +65,12 @@ class EndSacadorFragment ( private lateinit var customDialogThreeButtons: CustomDialogThreeButtons private var ticketFk = "" private var originalScanned = "" + private var positionUnmarked = -1 - fun changevariables(){ + fun changevariables() { TODO("Refactor llevar variables i deixar soles una com positionToChange i quantityToChange") } + private var typeCollectionMissing = "" private var positionCollectionMissing = 0 private var quantityCollectionMissing = "" @@ -76,13 +79,12 @@ class EndSacadorFragment ( private var quantityCollectionSplit = "" private var positionCollectionSplit = 0 - // private val listIcons:ArrayList = ArrayList() + // private val listIcons:ArrayList = ArrayList() //sergio: se añada para leer el articulo leido que era el buyFk private var originalItemScan: String = "" - override fun onAttach(context: Context) { if (context is OnPasillerosItemClickListener) pasillerosItemClickListener = context super.onAttach(context) @@ -108,7 +110,7 @@ class EndSacadorFragment ( setToolBar() setEvents() - // Log.d("VERDNATURA","La col "+collection.collectionFk+ " y el type "+type) + // Log.d("VERDNATURA","La col "+collection.collectionFk+ " y el type "+type) searchSaleCollection() super.init() @@ -135,7 +137,8 @@ class EndSacadorFragment ( pasillerosItemClickListener?.onPasillerosItemClickListener( PasillerosItemVO( title = "Parking" - ), "") + ), "" + ) // parkingTicket(binding.scanInput.text.toString()) } else { //if (binding.scanInput.text.length > 6){ @@ -169,6 +172,7 @@ class EndSacadorFragment ( } } + @SuppressLint("LogNotTimber") override fun observeViewModel() { with(viewModel) { salesList.observe(viewLifecycleOwner, Observer { @@ -176,6 +180,29 @@ class EndSacadorFragment ( createSaleList(it) }) + responseItemShelvingUpdate.observe(viewLifecycleOwner, Observer { + + if (!goBack) { + if (it.isError) { + + ma.messageWithSound(it.errorMessage, it.isError, false) + + } else { + saleTrackingReplace(positionUnmarked) + setTotalLines() + /* viewModel.saleTrackingDel( + getData(USER), + getData(PASSWORD), + saleFk = sales[positionUnmarked].saleFk, + "saleTracking_del" + )*/ + + goBack = false + } + + } + }) + placementSuppleyList.observe(viewLifecycleOwner, Observer { binding.splashProgress.visibility = View.GONE if (!goBack) printShelvingResult(it) @@ -183,38 +210,37 @@ class EndSacadorFragment ( }) responseSalixMessage.observe(viewLifecycleOwner, Observer { - if (!goBack) - { - if (it.isError) { - ma.messageWithSound(it.errorMessage,true,false) - /* customDialog.setTitle("Error").setDescription(it.errorMessage) - .setOkButton("Aceptar") { - customDialog.dismiss() - }.show()*/ - } + if (!goBack) { + if (it.isError) { + ma.messageWithSound(it.errorMessage, true, false) + /* customDialog.setTitle("Error").setDescription(it.errorMessage) + .setOkButton("Aceptar") { + customDialog.dismiss() + }.show()*/ + } } - goBack=false + goBack = false }) responseIncQuantity.observe(viewLifecycleOwner, Observer { - if (!goBack){ + if (!goBack) { if (it.isError) { - ma.messageWithSound(it.errorMessage, isError = true,true) + ma.messageWithSound(it.errorMessage, isError = true, true) } else { incresaseSuccesful() setTotalLines() } } - goBack=false + goBack = false }) responseParkingAdd.observe(viewLifecycleOwner, Observer { binding.splashProgress.visibility = GONE if (it.isError) { - ma.messageWithSound(it.errorMessage,true,false) + ma.messageWithSound(it.errorMessage, true, false) /* customDialog.setTitle("Error").setDescription(it.errorMessage) .setOkButton("Aceptar") { customDialog.dismiss() @@ -227,13 +253,11 @@ class EndSacadorFragment ( responseSaleTrackingUpdate.observe(viewLifecycleOwner, Observer { - ma.messageWithSound(it.errorMessage, isError = it.isError,true) + ma.messageWithSound(it.errorMessage, isError = it.isError, true) try { sales.clear() - } - catch(e:Exception) - { + } catch (e: Exception) { } @@ -241,23 +265,23 @@ class EndSacadorFragment ( }) responseSaleMove.observe(viewLifecycleOwner, Observer { - if (!goBack) { - if (it.isError) { - ma.messageWithSound(it.errorMessage, isError = true, true) + if (!goBack) { + if (it.isError) { + ma.messageWithSound(it.errorMessage, isError = true, true) - } else { - responseSaleMoveSuccesful() - setTotalLines() - } - goBack=false - } + } else { + responseSaleMoveSuccesful() + setTotalLines() + } + goBack = false + } }) responseMissingTrash.observe(viewLifecycleOwner, Observer { if (it.isError) { - ma.messageWithSound(it.errorMessage, isError = true,true) + ma.messageWithSound(it.errorMessage, isError = true, true) } else { missingTrashSuccesful() @@ -266,48 +290,84 @@ class EndSacadorFragment ( }) responseSaleGroupAdd.observe(viewLifecycleOwner, Observer { - binding.splashProgress.visibility=GONE + binding.splashProgress.visibility = GONE - if (!goBack){ - if (it.isError) { - ma.messageWithSound(it.errorMessage, isError = true,true, isToasted = true) + if (!goBack) { + if (it.isError) { + ma.messageWithSound(it.errorMessage, isError = true, true, isToasted = true) - } else { - viewModel.sectorCollection_getSale(getData(USER),getData(PASSWORD),collection.collectionFk,getData(SECTORFK)) - }} + } else { + viewModel.sectorCollection_getSale( + getData(USER), + getData(PASSWORD), + collection.collectionFk, + getData(SECTORFK) + ) + } + } }) responseSaleAddPrevOK.observe(viewLifecycleOwner, Observer { - binding.splashProgress.visibility=GONE + binding.splashProgress.visibility = GONE - if (!goBack){ + if (!goBack) { if (it.isError) { - ma.messageWithSound(it.errorMessage, isError = true,true) + ma.messageWithSound(it.errorMessage, isError = true, true) } else { - ma.messageWithSound("Previa ok", isError = false,false) + ma.messageWithSound("Previa ok", isError = false, false) } - } - goBack=false + } + goBack = false }) + response.observe(viewLifecycleOwner, Observer { + binding.splashProgress.visibility = GONE + if (!goBack) { + if (it.isError) { + ma.messageWithSound(it.errorMessage, isError = true, true) + + } else { + ma.messageWithSound("Previa ok", isError = false, false) + + } + } + goBack = false + }) responseSaleupdateIsChecked.observe(viewLifecycleOwner, Observer { - binding.splashProgress.visibility=GONE + binding.splashProgress.visibility = GONE - if (!goBack){ - if (it.isError) { - ma.messageWithSound(it.errorMessage, isError = true,true) + if (!goBack) { + if (it.isError) { + ma.messageWithSound(it.errorMessage, isError = true, true) - } else { - // ma.messageWithSound("Checked update ok", isError = false,false) + } else { + if (positionUnmarked != -1) { - }} - goBack=false + searchSaleCollection() + saleAdapter!!.notifyDataSetChanged() + positionUnmarked = -1 + } + + } + } + goBack = false }) + responseItemShelvingSaleSupplyAdd.observe(viewLifecycleOwner, Observer { + binding.splashProgress.visibility = GONE + if (!goBack) { + if (it.isError) { + ma.messageWithSound(it.errorMessage, isError = true, true) + searchSaleCollection() + } + } + goBack = false + + }) responseCode.observe(viewLifecycleOwner, Observer { binding.splashProgress.visibility = View.GONE @@ -343,7 +403,7 @@ class EndSacadorFragment ( private fun responseSaleMoveSuccesful() { - Log.d("VERDNATURA::","responseSaleMove succesful") + Log.d("VERDNATURA::", "responseSaleMove succesful") try { sales[positionCollectionSplit].saldo = quantityCollectionSplit.toInt() } catch (e: Exception) { @@ -360,7 +420,7 @@ class EndSacadorFragment ( val ticket = "[" + sales[positionCollectionSplit].id + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionCollectionSplit].id + "/summary)" val message = - "Se ha enviado a Split el articulo " + sales[positionCollectionSplit].itemFk +" del ticket " + ticket + "Se ha enviado a Split el articulo " + sales[positionCollectionSplit].itemFk + " del ticket " + ticket /* viewModel.sendChekingPresence( @@ -369,7 +429,7 @@ class EndSacadorFragment ( message = message, "sendChekingPresence" )*/ - sendSalixMessageNew(message,sales[positionCollectionSplit].salesPersonFk) + sendSalixMessageNew(message, sales[positionCollectionSplit].salesPersonFk) } @@ -386,13 +446,13 @@ class EndSacadorFragment ( saleAdapter?.notifyDataSetChanged() val ticket = - "[" + sales[positionIncreaseQuantity].id + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionIncreaseQuantity].id + "/summary)" + "[" + sales[positionIncreaseQuantity].id + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionIncreaseQuantity].id + "/summary)" val message = - "Se ha modificado desde previa la cantidad original " + sales[positionIncreaseQuantity].quantity + " del artículo " + sales[positionIncreaseQuantity].itemFk +" a nueva cantidad: " + quantityIncrease + " del ticket " + ticket + "Se ha modificado desde previa la cantidad original " + sales[positionIncreaseQuantity].quantity + " del artículo " + sales[positionIncreaseQuantity].itemFk + " a nueva cantidad: " + quantityIncrease + " del ticket " + ticket - sendSalixMessageNew(message, sales[positionIncreaseQuantity].salesPersonFk) + sendSalixMessageNew(message, sales[positionIncreaseQuantity].salesPersonFk) searchSaleCollection() } @@ -402,7 +462,8 @@ class EndSacadorFragment ( var totalQuantity: Int = 0 try { - totalQuantity = sales[positionCollectionMissing].saldo.toInt() - quantityCollectionMissing.toInt() + totalQuantity = + sales[positionCollectionMissing].saldo.toInt() - quantityCollectionMissing.toInt() } catch (e: Exception) { } @@ -422,29 +483,30 @@ class EndSacadorFragment ( saleAdapter!!.notifyDataSetChanged() - - var message="" + var message = "" val ticket = - "[" + sales[positionCollectionMissing].id + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionCollectionMissing].id + "/summary)" + "[" + sales[positionCollectionMissing].id + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionCollectionMissing].id + "/summary)" - when (typeCollectionMissing){ + when (typeCollectionMissing) { - "TRUE"->{ - message = "Se ha enviado desde previa a Basura " + totalQuantity + " del articulo " + sales[positionCollectionMissing].itemFk + " ticket " + ticket - } + "TRUE" -> { + message = + "Se ha enviado desde previa a Basura " + totalQuantity + " del articulo " + sales[positionCollectionMissing].itemFk + " ticket " + ticket + } - "FALSE"->{ - message= "Se ha enviado desde previa a Faltas la cantidad de " + totalQuantity + " del articulo " + sales[positionCollectionMissing].itemFk + " ticket " + ticket + "FALSE" -> { + message = + "Se ha enviado desde previa a Faltas la cantidad de " + totalQuantity + " del articulo " + sales[positionCollectionMissing].itemFk + " ticket " + ticket } - - "reject"->{ - var quantityOriginal=totalQuantity.toInt()+quantityCollectionMissing.toInt() - message = "Se ha modificado desde previa la cantidad de " +quantityOriginal+ " del artículo " + sales[positionCollectionMissing].itemFk + " a nueva cantidad: " + quantityCollectionMissing+ " del ticket " + ticket + "reject" -> { + var quantityOriginal = totalQuantity.toInt() + quantityCollectionMissing.toInt() + message = + "Se ha modificado desde previa la cantidad de " + quantityOriginal + " del artículo " + sales[positionCollectionMissing].itemFk + " a nueva cantidad: " + quantityCollectionMissing + " del ticket " + ticket } } @@ -452,58 +514,65 @@ class EndSacadorFragment ( sendSalixMessageNew(message, sales[positionCollectionMissing].salesPersonFk) searchSaleCollection() } + private fun sendSalixMessageNew(message: String, workerId: String) { + if (!goBack) { - if (!goBack){ - - if (!workerId.isNullOrEmpty()) - viewModel.sendChekingPresence( - token = getData(TOKEN), - workerId = workerId, - message = message, - "sendChekingPresence" - )} + if (!workerId.isNullOrEmpty()) + viewModel.sendChekingPresence( + token = getData(TOKEN), + workerId = workerId, + message = message, + "sendChekingPresence" + ) + } } //CREATE LIST - private fun searchSaleCollection(){ + private fun searchSaleCollection() { binding.splashProgress.visibility = View.VISIBLE - viewModel.sectorCollection_getSale(getData(USER),getData(PASSWORD),collection.collectionFk, vSectorFk = getData(SECTORFK)) + viewModel.sectorCollection_getSale( + getData(USER), + getData(PASSWORD), + collection.collectionFk, + vSectorFk = getData(SECTORFK) + ) } private fun searchTicket(ticketFk: String) { - Log.i(TAG, "Escaneamos ticket en previa"+ticketFk) + Log.i(TAG, "Escaneamos ticket en previa" + ticketFk) ticket = ticketFk - - /* viewModel.ticketToPrePrepare( - usuario = getData(USER), - getData(PASSWORD), - ticketFk = ticketFk, - sectorFk = getData(SECTORFK) - )*/ + /* viewModel.ticketToPrePrepare( + usuario = getData(USER), + getData(PASSWORD), + ticketFk = ticketFk, + sectorFk = getData(SECTORFK) + )*/ - if (!ticketFk.isNullOrEmpty()) - binding.splashProgress.visibility = View.VISIBLE - viewModel.sectorCollectionSaleGroup_add(getData(USER),getData(PASSWORD),ticketFk, - collection.collectionFk,"sectorCollectionSaleGroup_add") + if (!ticketFk.isNullOrEmpty()) + binding.splashProgress.visibility = View.VISIBLE + viewModel.sectorCollectionSaleGroup_add( + getData(USER), getData(PASSWORD), ticketFk, + collection.collectionFk, "sectorCollectionSaleGroup_add" + ) } private fun createSaleList(salesList: List) { binding.splashProgress.visibility = GONE if (salesList.isNullOrEmpty()) { - ma.messageWithSound("Colección sin tickets. Escanea tickets para añadirlos",false,false,"Pre Sacador") + ma.messageWithSound( + "Colección sin tickets. Escanea tickets para añadirlos", + false, + false, + "Pre Sacador" + ) - /* customDialog.setTitle("Pre Sacador") - .setDescription("No hemos podido obtener movimientos para el ticket escaneado") - .setKoButton("Cancelar") { - customDialog.dismiss() - }.show()*/ } else { binding.mainToolbar.toolbarTitle.text = ticket sales = ArrayList() @@ -514,20 +583,20 @@ class EndSacadorFragment ( //sergio: se tiene que ordenar por el pickingOrder del primer carro (Pako) - for (s in sales){ - Log.d("VERDNATURA::","sales "+s.longName) - Log.d("VERDNATURA::","sales "+s.salesPersonFk) + for (s in sales) { + + // Log.d("VERDNATURA::","sales comercial"+s.salesPersonFk) //sergio: para que no de error si no hay carros. Ya está asignado a 0 el pickingorder si no hay item en el carro - if (!s.carros.isNullOrEmpty()){ - s.pickingOrder=s.carros.get(0).pickingOrder + if (!s.carros.isNullOrEmpty()) { + s.pickingOrder = s.carros.get(0).pickingOrder } } - var sortedSales=sales.sortedBy{ it.pickingOrder } + var sortedSales = sales.sortedBy { it.pickingOrder } //sergio: Se ordena las sales por ellas mismas con With - sales.sortWith(compareBy({it.pickingOrder})) + sales.sortWith(compareBy({ it.pickingOrder })) lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false) @@ -599,11 +668,13 @@ class EndSacadorFragment ( } - private fun saleTracking_addPrevOK(){ + private fun saleTracking_addPrevOK() { - binding.splashProgress.visibility=VISIBLE - viewModel.saleTracking_addPrevOK(usuario = getData(USER), password = getData(PASSWORD), - vSectorCollectionFk = collection.collectionFk, callFunction = "saleTracking_addPrevOK") + binding.splashProgress.visibility = VISIBLE + viewModel.saleTracking_addPrevOK( + usuario = getData(USER), password = getData(PASSWORD), + vSectorCollectionFk = collection.collectionFk, callFunction = "saleTracking_addPrevOK" + ) } @@ -699,39 +770,36 @@ class EndSacadorFragment ( private fun saleTrackingReplace(position: Int) { + if (sales[position].picked == sales[position].quantity) { - if (sales[position].picked == sales[position].quantity) { - - viewModel.saleTracking_updateIsChecked( - usuario = getData(USER), - password = getData(PASSWORD), - vSaleFk = sales[position].idMovimiento, - vIsChecked = if (sales[position].picked == sales[position].quantity) "1" else "0", - callFunction = "saleTracking_updateIsChecked" - ) - } - if (sales[position].picked==0){ - viewModel.saleTracking_updateIsChecked( - usuario = getData(USER), - password = getData(PASSWORD), - vSaleFk = sales[position].idMovimiento, - vIsChecked = if (sales[position].picked == sales[position].quantity) "1" else "0", - callFunction = "saleTracking_updateIsChecked" - ) - } - - /* viewModel.saleTrackingReplace( - usuario = getData(USER), - password = getData(PASSWORD), - saleFk = sales[position].idMovimiento, - vIsChecked = if (sales[position].picked == sales[position].quantity) "1" else "0", - vOriginalQuantity = sales[position].picked.toString(), - vStateFk = PRESACADOR, - vBuyFk = originalItemScan, callFunction = "saleTrackingReplace" - - )*/ + viewModel.saleTracking_updateIsChecked( + usuario = getData(USER), + password = getData(PASSWORD), + vSaleFk = sales[position].idMovimiento, + vIsChecked = if (sales[position].picked == sales[position].quantity) "1" else "0", + callFunction = "saleTracking_updateIsChecked" + ) + } + if (sales[position].picked == 0) { + viewModel.saleTracking_updateIsChecked( + usuario = getData(USER), + password = getData(PASSWORD), + vSaleFk = sales[position].idMovimiento, + vIsChecked = if (sales[position].picked == sales[position].quantity) "1" else "0", + callFunction = "saleTracking_updateIsChecked" + ) + } + /* viewModel.saleTrackingReplace( + usuario = getData(USER), + password = getData(PASSWORD), + saleFk = sales[position].idMovimiento, + vIsChecked = if (sales[position].picked == sales[position].quantity) "1" else "0", + vOriginalQuantity = sales[position].picked.toString(), + vStateFk = PRESACADOR, + vBuyFk = originalItemScan, callFunction = "saleTrackingReplace" + )*/ } @@ -745,14 +813,24 @@ class EndSacadorFragment ( sales[position].picked = 0 saleAdapter!!.notifyDataSetChanged() setListPosition(position) - /* viewModel.saleTrackingDel( - usuario =getData(USER), + + viewModel.itemShelving_updateFromSale( + usuario = getData(USER), password = getData(PASSWORD), - saleFk = sales[position].idMovimiento, "saleTracking_del" - )*/ - //sergio: previa nuevo - saleTrackingReplace(position) - setTotalLines() + saleFk = sales[position].idMovimiento, + visible = sales[position].quantity.toString(), + "itemShelving_updateFromSale" + ) + positionUnmarked = position + //sergio: anterior previa + /* viewModel.saleTrackingDel( + usuario =getData(USER), + password = getData(PASSWORD), + saleFk = sales[position].idMovimiento, "saleTracking_del" + )*/ + //sergio: previa se pone después itemshelving_update + //saleTrackingReplace(positionUnmarked) + //setTotalLines() scanRequest() customDialog.dismiss() }.setKoButton("Cancelar") { @@ -910,6 +988,15 @@ class EndSacadorFragment ( sales[storedPosition].carros[storedShelvingPosition].stockTotal = (shelvingVisible.toInt() - customDialogList.getValue().toInt()).toString() + + //sergio: se añade línea que actualiza la pantalla. Es posible que falle + // el itemShelvingSaleSupplyAdd que se actualiza pantalla si falla se actualizará todo + + sales[storedPosition].carros[storedShelvingPosition].visible = + "(" + (shelvingVisible.toInt() - customDialogList.getValue() + .toInt()).toString() + ")" + + viewModel.itemShelvingSaleSupplyAdd( usuario = getData(USER), password = getData(PASSWORD), @@ -1054,7 +1141,7 @@ class EndSacadorFragment ( private fun setToolBar() { binding.mainToolbar.toolbarSubtitle.visibility = View.VISIBLE - val listIcons:ArrayList = ArrayList() + val listIcons: ArrayList = ArrayList() val iconParking = ImageView(context) iconParking.setImageResource(R.drawable.ic_local_parking_black_24dp) @@ -1063,8 +1150,8 @@ class EndSacadorFragment ( iconEraser.setImageResource(R.drawable.previous_delete) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - iconParking.tooltipText=getTooltip(R.drawable.ic_local_parking_black_24dp) - iconEraser.tooltipText=getTooltip(R.drawable.previous_delete) + iconParking.tooltipText = getTooltip(R.drawable.ic_local_parking_black_24dp) + iconEraser.tooltipText = getTooltip(R.drawable.previous_delete) } @@ -1078,8 +1165,8 @@ class EndSacadorFragment ( /*if (item == iconEraser) { } else*/ - when (item){ - iconParking.drawable-> pasillerosItemClickListener?.onPasillerosItemClickListener( + when (item) { + iconParking.drawable -> pasillerosItemClickListener?.onPasillerosItemClickListener( PasillerosItemVO( title = "Parking" ), "" @@ -1137,7 +1224,7 @@ class EndSacadorFragment ( companion object { fun newInstance(collection: CollectionVO?, entrypoint: String) = EndSacadorFragment( - collection!!,entrypoint + collection!!, entrypoint ) } @@ -1149,10 +1236,11 @@ class EndSacadorFragment ( super.onPause() } - override fun onResume(){ - goBack=false + override fun onResume() { + goBack = false super.onResume() } + private fun showErrorMessage(text: String) { customDialog.setTitle("Error al marcar la linea").setDescription(text) .setKoButton("Cerrar") { @@ -1213,9 +1301,9 @@ class EndSacadorFragment ( when (action) { getString(R.string.Agregar) -> increaseQuantity(position, value) - getString(R.string.BasuraRechazar) -> TrashMissingReject(position, value,"TRUE") - getString(R.string.Faltas) -> TrashMissingReject(position, value,"FALSE") - getString(R.string.Reject) -> TrashMissingReject(position, value,"reject") + getString(R.string.BasuraRechazar) -> TrashMissingReject(position, value, "TRUE") + getString(R.string.Faltas) -> TrashMissingReject(position, value, "FALSE") + getString(R.string.Reject) -> TrashMissingReject(position, value, "reject") getString(R.string.Split) -> split(position, value) } @@ -1224,6 +1312,7 @@ class EndSacadorFragment ( customDialogThreeButtons.dismiss() } } + private fun TrashMissingReject( position: Int, quantity: String, @@ -1304,8 +1393,8 @@ class EndSacadorFragment ( private fun split(position: Int, quantity: String) { - positionCollectionSplit=position - quantityCollectionSplit=quantity + positionCollectionSplit = position + quantityCollectionSplit = quantity var totalQuantity: Int = 0 try { @@ -1314,12 +1403,12 @@ class EndSacadorFragment ( } viewModel.saleMove( usuario = getData(USER), - password = getData(PASSWORD), + password = getData(PASSWORD), saleFk = sales[position].idMovimiento, quantity = totalQuantity.toString(), originalQuantity = sales[position].quantity.toString(), "saleMove" ) - Log.d("VERDNATURA::","responseSaleMove enviando") + Log.d("VERDNATURA::", "responseSaleMove enviando") /* try { sales[position].saldo = quantity.toInt() @@ -1447,16 +1536,16 @@ class EndSacadorFragment ( ) //enviar mensaje a salix - /* val ticket = - "[" + ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + ticketFk + "/summary)" - val message = - "Se ha modificado la cantidad original desde previa" + sales[position].saldo + " del artículo " + sales[position].itemFk + " a nueva cantidad: " + quantity + " del ticket " + ticket - viewModel.sendChekingPresence( - token = getData(TOKEN), - workerId = sales[position].salesPersonFk, - message = message, - "sendChekingPresence" - )*/ + /* val ticket = + "[" + ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + ticketFk + "/summary)" + val message = + "Se ha modificado la cantidad original desde previa" + sales[position].saldo + " del artículo " + sales[position].itemFk + " a nueva cantidad: " + quantity + " del ticket " + ticket + viewModel.sendChekingPresence( + token = getData(TOKEN), + workerId = sales[position].salesPersonFk, + message = message, + "sendChekingPresence" + )*/ try { sales[position].saldo = quantity.toInt() @@ -1493,7 +1582,7 @@ class EndSacadorFragment ( "sendChekingPresence" ) - Log.d("VERDNATURA","el trabajador es "+sales[position].salesPersonFk) + Log.d("VERDNATURA", "el trabajador es " + sales[position].salesPersonFk) try { sales[position].saldo = quantity.toInt() } catch (e: Exception) { @@ -1505,6 +1594,7 @@ class EndSacadorFragment ( } + private fun increaseQuantity(position: Int, quantity: String) { positionIncreaseQuantity = position quantityIncrease = quantity diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorFragment.kt index 9de43901..749acaa9 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorFragment.kt @@ -631,6 +631,7 @@ class PreSacadorFragment : sales[position].picked = 0 saleAdapter!!.notifyDataSetChanged() setListPosition(position) + viewModel.saleTrackingDel( usuario =getData(USER), password = getData(PASSWORD), @@ -700,11 +701,14 @@ class PreSacadorFragment : } else { itemShelvingFkStored = itemShelvingFk binding.splashProgress.visibility = View.VISIBLE + + viewModel.getIdFromCode( usuario = getData(USER), password = getData(PASSWORD), code = customDialogList.getValueTwo(), "barcodeToItem" ) + customDialogList.dismiss() } scanRequest() diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorViewModel.kt index e83be592..351c86bf 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorViewModel.kt @@ -38,6 +38,9 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() val response: LiveData get() = _response + private val _responseItemShelvingSaleSupplyAdd by lazy { MutableLiveData() } + val responseItemShelvingSaleSupplyAdd: LiveData + get() = _responseItemShelvingSaleSupplyAdd private val _responseSaleTrackingUpdate by lazy { MutableLiveData() } val responseSaleTrackingUpdate: LiveData @@ -72,6 +75,10 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() val responseMissingTrash: LiveData get() = _responseMissingTrash + private val _responseItemShelvingUpdate by lazy { MutableLiveData() } + val responseItemShelvingUpdate: LiveData + get() = _responseItemShelvingUpdate + //sergio: previa nuevo private val _collectionList by lazy { MutableLiveData() } @@ -289,20 +296,20 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() { override fun onFailure(call: Call, t: Throwable) { - _response.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) + _responseItemShelvingSaleSupplyAdd.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) } override fun onResponse(call: Call, response: Response) { if (response.body() == null) { - _response.value = ResponseItemVO( + _responseItemShelvingSaleSupplyAdd.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) ) } else { - _response.value = ResponseItemVO(isError = false, response = response.body()!!) + _responseItemShelvingSaleSupplyAdd.value = ResponseItemVO(isError = false, response = response.body()!!) } } }) @@ -544,11 +551,11 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() { override fun onResponse(call: Call, response: Response) { - if (!response.isSuccessful) + if (!response.isSuccessful ||response.message()=="false") { _responseSalixMessage.value = ResponseItemVO( isError = true, - errorMessage = "Error en la llamada $calledFunction al enviar mensaje rocket." + getMessageFromAllResponse( + errorMessage = "Error al enviar mensaje rocket." + getMessageFromAllResponse( nameofFunction(this),response.message() ) ) @@ -559,10 +566,10 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() override fun onFailure(call: Call, t: Throwable) { - /* _responseSalixMessage.value = ResponseItemVO( + _responseSalixMessage.value = ResponseItemVO( isError = true, - errorMessage = "Error en la llamada $calledFunction al enviar mensaje rocket." + getMessageFromAllResponse( - nameofFunction(this),t.message!!))*/ + errorMessage = "Error al enviar mensaje rocket." + getMessageFromAllResponse( + nameofFunction(this),t.message!!)) } }) @@ -797,4 +804,35 @@ class PreSacadorViewModel(context: Context) : BaseViewModel() }) } + + fun itemShelving_updateFromSale(usuario: String, password: String, saleFk: String,visible:String,callFunction:String) + { + getSacadorControladorUserCase.itemShelving_updateFromSale(usuario, password, saleFk, visible) + .enqueue(object : Callback + { + override fun onFailure(call: Call, t: Throwable) + { + _responseItemShelvingUpdate.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!) + ) + } + + override fun onResponse(call: Call, response: Response) + { + if (!response.isSuccessful ) + { + _responseItemShelvingUpdate.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()) + ) + } else + { + _responseItemShelvingUpdate.value = + ResponseItemVO(isError = false, response = response.message()!!) + } + } + }) + } + } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/qr/QrFragmentViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/qr/QrFragmentViewModel.kt index 918f1aa1..d0645939 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/qr/QrFragmentViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/qr/QrFragmentViewModel.kt @@ -38,7 +38,7 @@ class QrFragmentViewModel(context: Context) : BaseViewModel() { override fun onResponse(call: Call, response: Response) { - if (response.raw().code() == 555) { + if (response.raw().code() == 555 || response.raw().code()==403) { //Log.i("VERDNATURA:","UserError ${response.raw().message().toString()}") // var message = response.raw().message().toString() @@ -46,7 +46,7 @@ class QrFragmentViewModel(context: Context) : BaseViewModel() { _qrresponse.value = ResponseItemVO( response = "", isError = true, - errorMessage = "Ususario sin permisos" + errorMessage = "Usuario sin permisos para realizar la acción" ) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/SacadorFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/SacadorFragment.kt index f63a6336..7fa97f5f 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/SacadorFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/SacadorFragment.kt @@ -54,7 +54,7 @@ class SacadorFragment : setToolBar() setEvents() - var working_in_test=false + var working_in_test=false //sergio: Ok en app if (!working_in_test) { viewModel.collectionGetSalix(token = getData(TOKEN)) @@ -68,6 +68,8 @@ class SacadorFragment : } + + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) // Use the Kotlin extension in the fragment-ktx artifact @@ -77,7 +79,7 @@ class SacadorFragment : resultTagMode=result Log.d("VERDNATURA::","el result es "+result) if (result.equals("complete") && getData(TAGSTYPE).equals("SmartTags")) { - viewModel.collectionNew(getData(USER), + viewModel.collection_new_wagon(getData(USER), getData(PASSWORD), getData(SECTORFK), getData(WAGON), getData(TAGSTYPE),"collection_new_wagon") } @@ -123,7 +125,7 @@ class SacadorFragment : iconAdd.drawable -> { binding.splashProgress.visibility = View.VISIBLE // checkTagsMode() - viewModel.collectionNew(getData(USER), + viewModel.collection_new_wagon(getData(USER), getData(PASSWORD),getData(SECTORFK),getData(WAGON),getData(TAGSTYPE),"collection_new_wagon") } iconVehicleIn.drawable-> ma.onVehicleSelected(SacadorFragment.TAG) @@ -156,7 +158,7 @@ class SacadorFragment : } else { Log.d("VERDNATURA::","ResultMode"+resultTagMode) if (resultTagMode.equals("complete")) { - viewModel.collectionNew(getData(USER), + viewModel.collection_new_wagon(getData(USER), getData(PASSWORD), getData(SECTORFK), getData(WAGON), getData(TAGSTYPE),"collection_new_wagon") } else { requireActivity().addFragment( @@ -207,7 +209,7 @@ class SacadorFragment : //sergio:para asegurarnos que aparece en pantalla. - var working_in_test=false + var working_in_test=false //sergio: ok en app SACADOR if (!working_in_test) { viewModel.collectionGetSalix(token=getData(TOKEN)) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/SacadorViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/SacadorViewModel.kt index 6769c88a..793b3367 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/SacadorViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/fragment/SacadorViewModel.kt @@ -120,13 +120,13 @@ class SacadorViewModel(context: Context) : BaseViewModel() { }) } - fun collectionNew(usuario: String, password: String, sectorFk: String, wagons: String,tagtype:String,callFunction:String){ + fun collection_new_wagon(usuario: String, password: String, sectorFk: String, wagons: String,tagtype:String,callFunction:String){ getSacadorControladorUserCase.collectionNew(usuario, password, sectorFk, wagons,tagtype).enqueue( object : Callback { override fun onFailure(call: Call, t: Throwable) { _response.value = - ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)+".Es posible que tengas colecciones pendientes, falle bbdd o Internet") + ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/model/TicketItemVO.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/model/TicketItemVO.kt index 81300495..ffeb27fe 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/model/TicketItemVO.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/sacador/model/TicketItemVO.kt @@ -65,7 +65,7 @@ class SaleVO( var saleGroupFk: String = "", var packingShelve:String="", - var picked:String="" + var picked:String="", ) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/showticket/ShowTicketFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/showticket/ShowTicketFragment.kt index d2236caa..9e5d27e1 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/showticket/ShowTicketFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/showticket/ShowTicketFragment.kt @@ -10,98 +10,100 @@ import es.verdnatura.databinding.FragmentControladorBinding import es.verdnatura.domain.ConstAndValues import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.common.OnCollectionSelectedListener -import es.verdnatura.presentation.view.feature.main.activity.MainActivity import es.verdnatura.presentation.view.feature.precontrol.ShowTicketViewModel import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO -class ShowTicketFragment: BaseFragment( - ShowTicketViewModel::class) { +class ShowTicketFragment : BaseFragment( + ShowTicketViewModel::class +) { - private var goBack:Boolean = false - private var onCollectionSelectedListener : OnCollectionSelectedListener? = null - override fun getLayoutId(): Int = R.layout.fragment_controlador - private var type = "" + private var goBack: Boolean = false + private var onCollectionSelectedListener: OnCollectionSelectedListener? = null + override fun getLayoutId(): Int = R.layout.fragment_controlador + private var type = "" - companion object { - fun newInstance() = ShowTicketFragment() + companion object { + fun newInstance() = ShowTicketFragment() + } + + override fun onAttach(context: Context) { + super.onAttach(context) + if (context is OnCollectionSelectedListener) onCollectionSelectedListener = context + } + + override fun init() { + + binding.splashProgress.visibility = View.GONE + binding.mainToolbar.toolbarTitle.text = getString(R.string.verticket) + binding.mainToolbar.backButton.visibility=View.VISIBLE + + setEvents() + super.init() + } + + override fun onPause() { + goBack = true + super.onPause() + } + + override fun onCreate(savedInstanceState: Bundle?) { + + type = ConstAndValues.VERTICKET + super.onCreate(savedInstanceState) + } + + private fun setEvents() { + + binding.mainToolbar.backButton.setOnClickListener { + requireActivity().onBackPressed() } - override fun onAttach(context: Context) { - super.onAttach(context) - if (context is OnCollectionSelectedListener) onCollectionSelectedListener = context - } + binding.scanInput.requestFocus() + binding.scanInput.setOnEditorActionListener { v, actionId, event -> + if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) { + goBack = false + if (!binding.scanInput.text.isNullOrEmpty()) { + binding.splashProgress.visibility = View.VISIBLE - override fun init() { - - binding.splashProgress.visibility = View.GONE - binding.mainToolbar.toolbarTitle.text = getString(R.string.verticket) - setEvents() - super.init() - } - - override fun onPause() { - goBack = true - super.onPause() - } - - override fun onCreate(savedInstanceState: Bundle?) { - - type=ConstAndValues.VERTICKET - super.onCreate(savedInstanceState) - } - - private fun setEvents(){ - - binding.mainToolbar.backButton.setOnClickListener { - requireActivity().onBackPressed() - } - - binding.scanInput.requestFocus() - binding.scanInput.setOnEditorActionListener { v, actionId, event -> - if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) { - goBack=false; - if (!binding.scanInput.text.isNullOrEmpty()) { - binding.splashProgress.visibility = View.VISIBLE - - viewModel.collectionTicketGet( - usuario = getData(USER), - password = getData(PASSWORD), - sectorFk = getData(SECTORFK), - collectionFk = binding.scanInput.text.toString(), - type = type, - callFunction = "collection_getTickets" - ) - } - binding.scanInput.setText("") - ma.hideKeyboard(binding.scanInput) - return@setOnEditorActionListener true + viewModel.collectionTicketGet( + usuario = getData(USER), + password = getData(PASSWORD), + sectorFk = getData(SECTORFK), + collectionFk = binding.scanInput.text.toString(), + type = type, + callFunction = "collection_getTickets" + ) } - false + binding.scanInput.setText("") + ma.hideKeyboard(binding.scanInput) + return@setOnEditorActionListener true } + false } + } - override fun observeViewModel() { - with(viewModel){ - collectionTicketList.observe(viewLifecycleOwner, Observer { - binding.splashProgress.visibility = View.GONE - if (it.isError){ - ma.messageWithSound(it.errorMessage,true,false) - }else{ - if (!goBack)navigateToCollectionList(it) - goBack = false - } + override fun observeViewModel() { + with(viewModel) { + collectionTicketList.observe(viewLifecycleOwner, Observer { + binding.splashProgress.visibility = View.GONE + if (it.isError) { + ma.messageWithSound(it.errorMessage, true, false) + } else { + if (!goBack) navigateToCollectionList(it) + goBack = false + } - }) - - - } + }) } - private fun navigateToCollectionList(collection: CollectionVO){ - onCollectionSelectedListener?.onCollectionSelected(collection, ConstAndValues.VERTICKET) - } } + private fun navigateToCollectionList(collection: CollectionVO) { + onCollectionSelectedListener?.onCollectionSelected(collection, ConstAndValues.VERTICKET) + } + +} + diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemFragment.kt index f3c20707..31d013a7 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemFragment.kt @@ -90,7 +90,7 @@ class AutomaticAddItemFragment( } listItems = ArrayList() binding.splashProgress.visibility = View.VISIBLE - viewModel.itemShelvingMake_multi( getData(USER),getData(PASSWORD),shelvingFk,listString,deep.toString(),getData(WAREHOUSEFK),"1") + viewModel.itemShelvingMake_multi( getData(USER),getData(PASSWORD),shelvingFk,listString,getData(WAREHOUSEFK)) } binding.mainToolbar.backButton.setOnClickListener { diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemViewModel.kt index faa7855f..fa754da5 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemViewModel.kt @@ -19,8 +19,8 @@ class AutomaticAddItemViewModel (context: Context): BaseViewModel() { get() = _response - fun itemShelvingMake_multi(usuario:String,password:String,shelving:String,items:List,deep:String,warehouse:String,level:String){ - getUbicadorUserCase.itemShelvingMake_multi(usuario,password,shelving,items,deep,warehouse,level).enqueue(object : + fun itemShelvingMake_multi(usuario:String,password:String,shelving:String,items:List,warehouse:String){ + getUbicadorUserCase.itemShelvingMake_multi(usuario,password,shelving,items,warehouse).enqueue(object : Callback { override fun onFailure(call: Call, t: Throwable) { _response.value = ResponseItemVO(isError = true,errorMessage ="Error al guardar items itemShelvingMake."+t.message!!) diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt index 1dc08ffd..73108ead 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorViewModel.kt @@ -93,7 +93,7 @@ class UbicadorViewModel(context: Context) : BaseViewModel() { fun itemShelvingMake(usuario:String,password:String,shelving:String,item:String,deep:String,quantity:String,packing:String,warehouse:String,level:String,callFunction:String,grouping: String){ - getUbicadorUserCase.itemShelvingMake(usuario,password,shelving,item,deep,quantity,packing,warehouse,level,grouping).enqueue(object : Callback{ + getUbicadorUserCase.itemShelvingMake(usuario,password,shelving,item,quantity,packing,warehouse,grouping).enqueue(object : Callback{ override fun onFailure(call: Call, t: Throwable) { _responseMake.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)) } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/workermistake/fragment/WorkermistakeFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/workermistake/fragment/WorkermistakeFragment.kt index fecd4b8d..37ec077a 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/workermistake/fragment/WorkermistakeFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/workermistake/fragment/WorkermistakeFragment.kt @@ -60,7 +60,16 @@ class WorkermistakeFragment( var entryPoint: String = "" } override fun onCreate(savedInstanceState: Bundle?) { - viewModel.department_getHasMistake(usuario = getData(USER),password = getData(PASSWORD)) + + + var working_in_test=false //sergio:No descomentar fins que Salix puje versió 8.3 + + if (!working_in_test){ + viewModel.department_getHasMistake(usuario = getData(USER),password = getData(PASSWORD)) + }else{ + viewModel.department_getHasMistakeSalix(getData(TOKEN)) + } + super.onCreate(savedInstanceState) } diff --git a/app/src/main/res/drawable/background_item_color.xml b/app/src/main/res/drawable/background_item_color.xml new file mode 100644 index 00000000..90c9f3cc --- /dev/null +++ b/app/src/main/res/drawable/background_item_color.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/background_round.xml b/app/src/main/res/drawable/background_round.xml new file mode 100644 index 00000000..6dde1593 --- /dev/null +++ b/app/src/main/res/drawable/background_round.xml @@ -0,0 +1,18 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/background_round_square.xml b/app/src/main/res/drawable/background_round_square.xml new file mode 100644 index 00000000..d2986166 --- /dev/null +++ b/app/src/main/res/drawable/background_round_square.xml @@ -0,0 +1,14 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/emoticon_error_fragment.xml b/app/src/main/res/drawable/emoticon_error_fragment.xml new file mode 100644 index 00000000..48cd6760 --- /dev/null +++ b/app/src/main/res/drawable/emoticon_error_fragment.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_barcode_ui.xml b/app/src/main/res/drawable/ic_barcode_ui.xml new file mode 100644 index 00000000..2c507af6 --- /dev/null +++ b/app/src/main/res/drawable/ic_barcode_ui.xml @@ -0,0 +1,4 @@ + + + diff --git a/app/src/main/res/drawable/ic_barcode_ui_selected.xml b/app/src/main/res/drawable/ic_barcode_ui_selected.xml new file mode 100644 index 00000000..5fcc8053 --- /dev/null +++ b/app/src/main/res/drawable/ic_barcode_ui_selected.xml @@ -0,0 +1,4 @@ + + + diff --git a/app/src/main/res/drawable/ic_claim_ui.xml b/app/src/main/res/drawable/ic_claim_ui.xml new file mode 100644 index 00000000..391288a2 --- /dev/null +++ b/app/src/main/res/drawable/ic_claim_ui.xml @@ -0,0 +1,4 @@ + + + diff --git a/app/src/main/res/drawable/ic_controller_ui.xml b/app/src/main/res/drawable/ic_controller_ui.xml new file mode 100644 index 00000000..bddddd5f --- /dev/null +++ b/app/src/main/res/drawable/ic_controller_ui.xml @@ -0,0 +1,4 @@ + + + diff --git a/app/src/main/res/drawable/ic_controller_ui_selected.xml b/app/src/main/res/drawable/ic_controller_ui_selected.xml new file mode 100644 index 00000000..5d7ca5f2 --- /dev/null +++ b/app/src/main/res/drawable/ic_controller_ui_selected.xml @@ -0,0 +1,4 @@ + + + diff --git a/app/src/main/res/drawable/ic_corridor_ui.xml b/app/src/main/res/drawable/ic_corridor_ui.xml new file mode 100644 index 00000000..af260dce --- /dev/null +++ b/app/src/main/res/drawable/ic_corridor_ui.xml @@ -0,0 +1,5 @@ + + + + diff --git a/app/src/main/res/drawable/ic_eye_ui.xml b/app/src/main/res/drawable/ic_eye_ui.xml new file mode 100644 index 00000000..fd64899e --- /dev/null +++ b/app/src/main/res/drawable/ic_eye_ui.xml @@ -0,0 +1,6 @@ + + + diff --git a/app/src/main/res/drawable/ic_eye_ui_selected.xml b/app/src/main/res/drawable/ic_eye_ui_selected.xml new file mode 100644 index 00000000..0497eae4 --- /dev/null +++ b/app/src/main/res/drawable/ic_eye_ui_selected.xml @@ -0,0 +1,4 @@ + + + diff --git a/app/src/main/res/drawable/ic_init_ui.xml b/app/src/main/res/drawable/ic_init_ui.xml new file mode 100644 index 00000000..e4ec6e26 --- /dev/null +++ b/app/src/main/res/drawable/ic_init_ui.xml @@ -0,0 +1,4 @@ + + + diff --git a/app/src/main/res/drawable/ic_init_ui_selected.xml b/app/src/main/res/drawable/ic_init_ui_selected.xml new file mode 100644 index 00000000..2ee06357 --- /dev/null +++ b/app/src/main/res/drawable/ic_init_ui_selected.xml @@ -0,0 +1,4 @@ + + + diff --git a/app/src/main/res/drawable/ic_pallet_ui.xml b/app/src/main/res/drawable/ic_pallet_ui.xml new file mode 100644 index 00000000..639c656a --- /dev/null +++ b/app/src/main/res/drawable/ic_pallet_ui.xml @@ -0,0 +1,5 @@ + + + + diff --git a/app/src/main/res/drawable/ic_parking_ui.xml b/app/src/main/res/drawable/ic_parking_ui.xml new file mode 100644 index 00000000..2ed6bb9e --- /dev/null +++ b/app/src/main/res/drawable/ic_parking_ui.xml @@ -0,0 +1,4 @@ + + + diff --git a/app/src/main/res/drawable/ic_parking_ui_selected.xml b/app/src/main/res/drawable/ic_parking_ui_selected.xml new file mode 100644 index 00000000..0a78e5c2 --- /dev/null +++ b/app/src/main/res/drawable/ic_parking_ui_selected.xml @@ -0,0 +1,4 @@ + + + diff --git a/app/src/main/res/drawable/ic_picker_ui.xml b/app/src/main/res/drawable/ic_picker_ui.xml new file mode 100644 index 00000000..ac8a5fb4 --- /dev/null +++ b/app/src/main/res/drawable/ic_picker_ui.xml @@ -0,0 +1,5 @@ + + + + diff --git a/app/src/main/res/drawable/ic_qr_ui.xml b/app/src/main/res/drawable/ic_qr_ui.xml new file mode 100644 index 00000000..e4b9a5bf --- /dev/null +++ b/app/src/main/res/drawable/ic_qr_ui.xml @@ -0,0 +1,4 @@ + + + diff --git a/app/src/main/res/drawable/ic_setting_ui.xml b/app/src/main/res/drawable/ic_setting_ui.xml new file mode 100644 index 00000000..1bb7ffd1 --- /dev/null +++ b/app/src/main/res/drawable/ic_setting_ui.xml @@ -0,0 +1,6 @@ + + + diff --git a/app/src/main/res/drawable/ic_setting_ui_selected.xml b/app/src/main/res/drawable/ic_setting_ui_selected.xml new file mode 100644 index 00000000..6042af14 --- /dev/null +++ b/app/src/main/res/drawable/ic_setting_ui_selected.xml @@ -0,0 +1,6 @@ + + + diff --git a/app/src/main/res/drawable/ic_vn_logo_negativo_app_warehouse.xml b/app/src/main/res/drawable/ic_vn_logo_negativo_app_warehouse.xml new file mode 100644 index 00000000..a13b13e8 --- /dev/null +++ b/app/src/main/res/drawable/ic_vn_logo_negativo_app_warehouse.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/font/roboto_medium.ttf b/app/src/main/res/font/roboto_medium.ttf new file mode 100644 index 00000000..e89b0b79 Binary files /dev/null and b/app/src/main/res/font/roboto_medium.ttf differ diff --git a/app/src/main/res/font/roboto_medium_italic.ttf b/app/src/main/res/font/roboto_medium_italic.ttf new file mode 100644 index 00000000..a5a41d3d Binary files /dev/null and b/app/src/main/res/font/roboto_medium_italic.ttf differ diff --git a/app/src/main/res/font/roboto_regular.ttf b/app/src/main/res/font/roboto_regular.ttf new file mode 100644 index 00000000..3d6861b4 Binary files /dev/null and b/app/src/main/res/font/roboto_regular.ttf differ diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index df7bf3fa..aa399c81 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -35,6 +35,16 @@ app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /> + diff --git a/app/src/main/res/layout/component_custom_edit_dialog.xml b/app/src/main/res/layout/component_custom_edit_dialog.xml index d78e3d37..564603f5 100644 --- a/app/src/main/res/layout/component_custom_edit_dialog.xml +++ b/app/src/main/res/layout/component_custom_edit_dialog.xml @@ -39,6 +39,30 @@ tools:text="Este cambio no podrá deshacerse a no ser que vuelvas a vincular el dispositivo" tools:visibility="visible" /> + + + + + + - @@ -8,6 +9,20 @@ android:layout_height="match_parent" android:background="@color/verdnatura_black"> + + + + + + + - android:padding="@dimen/navigation_row_limit_padding"> + android:orientation="horizontal" + > + android:textStyle="bold" /> @@ -63,7 +83,8 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:text="" - android:textColor="@color/verdnatura_brown_grey" + android:layout_marginLeft="@dimen/layout_margin_8" + android:textColor="@color/verdnatura_white" android:textSize="@dimen/body1"/> @@ -84,8 +105,9 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:text="" + android:layout_marginLeft="@dimen/layout_margin_6" android:tooltipText="@string/copied" - android:textColor="@color/verdnatura_brown_grey" + android:textColor="@color/verdnatura_white" android:textSize="@dimen/body1"/> + + + - + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_collection.xml b/app/src/main/res/layout/fragment_collection.xml index 424d33de..341e3165 100644 --- a/app/src/main/res/layout/fragment_collection.xml +++ b/app/src/main/res/layout/fragment_collection.xml @@ -67,7 +67,7 @@ app:lottie_speed="2" /> - + + + + + + + + app:stackFromEnd="false" + tool:listitem="@layout/item_pasilleros_main_menu" /> + app:layout_constraintTop_toTopOf="parent" + tool:visibility="visible"/> + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_ajustes_row.xml b/app/src/main/res/layout/item_ajustes_row.xml index 2128223d..ef43ea19 100644 --- a/app/src/main/res/layout/item_ajustes_row.xml +++ b/app/src/main/res/layout/item_ajustes_row.xml @@ -13,6 +13,10 @@ android:layout_height="wrap_content" android:orientation="vertical" style="@style/LayoutClickable"> + + android:layout_marginBottom="@dimen/layout_margin_min" + > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + background_oval_checked + + + + + + + + + + + + + + + + + + + + + + + + /> + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_main_menu.xml b/app/src/main/res/layout/item_main_menu.xml new file mode 100644 index 00000000..95dfa0b3 --- /dev/null +++ b/app/src/main/res/layout/item_main_menu.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_pasilleros_main_menu.xml b/app/src/main/res/layout/item_pasilleros_main_menu.xml index 490ba9e1..52db275c 100644 --- a/app/src/main/res/layout/item_pasilleros_main_menu.xml +++ b/app/src/main/res/layout/item_pasilleros_main_menu.xml @@ -16,6 +16,7 @@ android:layout_height="wrap_content" android:orientation="vertical" style="@style/LayoutClickable"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 776f5b9c..eb87b92a 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -162,4 +162,5 @@ No hay impresora Selecciona impresora Ubicación de reclamación + Reclamaciones diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index a6baf966..50c5738c 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -89,6 +89,8 @@ 90dp 10dp + + 5 \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 97010d7a..bf6ecb21 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -160,5 +160,6 @@ Worker mistaker Find department Claim Ubication + Claims diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index a21174de..9e122ea5 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -10,6 +10,7 @@ false true @color/verdnatura_white + @font/roboto_medium @@ -105,7 +106,8 @@ @@ -134,5 +136,9 @@ 10sp normal - +