From ddb4ab09c440447e35cba6003ec8598d72327b03 Mon Sep 17 00:00:00 2001 From: Sergio De la torre Date: Thu, 6 Oct 2022 07:01:04 +0200 Subject: [PATCH] =?UTF-8?q?Version=209.2.1=20Refactor=20Inicio,=20pintar?= =?UTF-8?q?=20a=20trav=C3=A9s=20del=20rgb,=20modificado=20dise=C3=B1o,se?= =?UTF-8?q?=20a=C3=B1ade=20shelvingLog=20y=20muestra=20colecci=C3=B3n=20a?= =?UTF-8?q?=20trav=C3=A9s=20de=20ticket?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/misc.xml | 7 + .../domain/GetSacadorControladorUserCase.kt | 30 ++- .../verdnatura/domain/GetUbicadorUserCase.kt | 19 ++ .../domain/GetVehicleControlTimeUserCase.kt | 13 +- .../es/verdnatura/domain/VerdnaturaService.kt | 23 ++ .../presentation/base/BaseFragment.kt | 5 +- .../component/CustomDialogInputThreeValues.kt | 6 +- .../feature/collection/adapter/SaleAdapter.kt | 63 +++-- .../collection/fragment/CollectionFragment.kt | 100 ++++++-- .../fragment/CollectionViewModel.kt | 228 +++++++++++------- .../ControlVehiculoUsuarioFragment.kt | 139 +++++++++-- .../fragment/ControlVehiculoViewModel.kt | 44 ++++ .../pasillero/fragment/PasilleroViewModel.kt | 4 +- .../ubicador/fragment/UbicadorFragment.kt | 142 ++++++----- .../ubicador/fragment/UbicadorViewModel.kt | 36 ++- .../main/res/drawable-v24/ic_collection.xml | 8 + ...ckground_and_round_collection_fragment.xml | 20 ++ app/src/main/res/drawable/background_test.xml | 5 + .../drawable/ic_delete_forever_black_24dp.xml | 6 +- app/src/main/res/drawable/ic_item.xml | 13 + app/src/main/res/drawable/ic_ticket.xml | 8 + app/src/main/res/drawable/round.xml | 6 + ...ponent_custom_edit_dialog_three_values.xml | 27 ++- .../res/layout/item_article_row_fragment.xml | 52 ++-- app/src/main/res/values-es/strings.xml | 4 +- app/src/main/res/values/dimens.xml | 2 + app/src/main/res/values/strings.xml | 4 +- 27 files changed, 754 insertions(+), 260 deletions(-) create mode 100644 app/src/main/res/drawable-v24/ic_collection.xml create mode 100644 app/src/main/res/drawable/background_and_round_collection_fragment.xml create mode 100644 app/src/main/res/drawable/background_test.xml create mode 100644 app/src/main/res/drawable/ic_item.xml create mode 100644 app/src/main/res/drawable/ic_ticket.xml create mode 100644 app/src/main/res/drawable/round.xml diff --git a/.idea/misc.xml b/.idea/misc.xml index 61e3cef2..7a377a7d 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -5,6 +5,7 @@ + @@ -12,6 +13,7 @@ + @@ -19,6 +21,7 @@ + @@ -67,6 +70,7 @@ + @@ -85,6 +89,7 @@ + @@ -118,6 +123,7 @@ + @@ -140,6 +146,7 @@ + diff --git a/app/src/main/java/es/verdnatura/domain/GetSacadorControladorUserCase.kt b/app/src/main/java/es/verdnatura/domain/GetSacadorControladorUserCase.kt index 84d98026..a8e415ee 100644 --- a/app/src/main/java/es/verdnatura/domain/GetSacadorControladorUserCase.kt +++ b/app/src/main/java/es/verdnatura/domain/GetSacadorControladorUserCase.kt @@ -43,7 +43,33 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) { ) } - fun sip_getExtensionSalix( + + fun collection_get( + usuario: String, + password: String, + collectionFk: String, + sectorFk: String, + print: String, + type: String + ): Call { + val params: ArrayList = ArrayList() + params.add(collectionFk) + params.add(sectorFk) + params.add(print) + params.add(type) + return restClient!!.collection_get( + "json", + "1", + usuario, + password, + "application/json", + params + ) + } + + + + /* fun sip_getExtensionSalix( token:String, WorkerId: String ): Call { @@ -72,7 +98,7 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) { params ) } - +*/ fun ticket_checkFullyControlled( usuario: String, diff --git a/app/src/main/java/es/verdnatura/domain/GetUbicadorUserCase.kt b/app/src/main/java/es/verdnatura/domain/GetUbicadorUserCase.kt index 9b0e65f2..8f9d25f7 100644 --- a/app/src/main/java/es/verdnatura/domain/GetUbicadorUserCase.kt +++ b/app/src/main/java/es/verdnatura/domain/GetUbicadorUserCase.kt @@ -237,6 +237,25 @@ class GetUbicadorUserCase(context: Context) : RestClient(context) { params ) } + + fun shelvinLog_add( + usuario: String, + password: String, + code: String + + ): Call { + val params: ArrayList = ArrayList() + params.add(code) + return restClient!!.shelvingLog_add( + "json", + "1", + usuario, + password, + "application/json", + params + ) + } + fun itemShelvingDelete(usuario: String, password: String, itemFk: String): Call { val params: ArrayList = ArrayList() params.add(itemFk) diff --git a/app/src/main/java/es/verdnatura/domain/GetVehicleControlTimeUserCase.kt b/app/src/main/java/es/verdnatura/domain/GetVehicleControlTimeUserCase.kt index d1bd0e78..fcca77d6 100644 --- a/app/src/main/java/es/verdnatura/domain/GetVehicleControlTimeUserCase.kt +++ b/app/src/main/java/es/verdnatura/domain/GetVehicleControlTimeUserCase.kt @@ -120,5 +120,16 @@ class GetVehicleControlTimeUserCase(context: Context) : RestClient(context) { params ) } - + 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 + ) + } } \ 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 55903e8e..11e5e368 100644 --- a/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt +++ b/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt @@ -442,6 +442,17 @@ interface VerdnaturaService { ): Call + @POST("almacennew/collection_get")//REVISADA + fun collection_get( + @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_get")//REVISADA fun ticket_get( @Header("aplicacion") aplicacion: String, @@ -1186,6 +1197,18 @@ interface VerdnaturaService { ): Call + + @POST("almacennew/shelvingLog_add")//REVISADA + fun shelvingLog_add( + @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/itemShelvingDelete")//REVISADA fun itemShelvingDelete( @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 d98e2c58..d3dbcb29 100644 --- a/app/src/main/java/es/verdnatura/presentation/base/BaseFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/base/BaseFragment.kt @@ -260,7 +260,8 @@ abstract class BaseFragment(viewModelCla R.drawable.ic_delete_forever_black_24dp -> getString(R.string.deleteAllitems) R.drawable.ic_flash_auto_black_24dp -> getString(R.string.allowAutomaticAddItem) R.drawable.ic_logo_salix -> getString(R.string.accessSalix) - + R.drawable.ic_eye_ui -> getString(R.string.icViewCollection) + R.drawable.ic_collection->getString(R.string.icViewCollection) else -> { "" } @@ -661,7 +662,7 @@ abstract class BaseFragment(viewModelCla saveWorkForm( WorkForms( "Sergio", - "httpsergiodt://10.1.4.42:9000", + "http://10.1.4.42:9000", urlSalix = "https://test-salix.verdnatura.es/api/" ) ) diff --git a/app/src/main/java/es/verdnatura/presentation/view/component/CustomDialogInputThreeValues.kt b/app/src/main/java/es/verdnatura/presentation/view/component/CustomDialogInputThreeValues.kt index f126e210..3d05edae 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/component/CustomDialogInputThreeValues.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/component/CustomDialogInputThreeValues.kt @@ -115,9 +115,9 @@ class CustomDialogInputThreeValues(context: Context) : Dialog(context, R.style.D fun setInfoTex(text:String,text2:String,text3:String){ - binding.textinputlayoutOne.hint = text - binding.textinputlayoutTwo.hint = text2 - binding.textinputlayoutThree.hint = text3 + binding.customDialogValueOne.hint = text + binding.customDialogValueTwo.hint = text2 + binding.customDialogValueThree.hint = text3 } 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 203ed4bf..b906116d 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 @@ -2,10 +2,12 @@ package es.verdnatura.presentation.view.feature.collection.adapter import android.content.Context import android.graphics.Color +import android.graphics.drawable.Drawable import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.core.content.ContextCompat.getColor +import androidx.core.graphics.drawable.DrawableCompat import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import es.verdnatura.R @@ -119,10 +121,13 @@ class SaleAdapter( txtError.text = binding.root.context.getString(R.string.newItem) } + //3969 Refactor collectionColors + paintTicketcolor(sale.rgb, itemTicketColor) + //paintTicketcolorOld(sale.level, itemTicketColor) - paintTicketcolor(sale.level, itemTicketColor) - //paintTicketcolor(sale.color, itemColor) - + val backgroundDrawableSac: Drawable = binding.itemArticleRowSemaforoSac.background + val backgroundDrawablePre: Drawable = binding.itemArticleRowSemaforoPre.background + val backgroundDrawableCon: Drawable = binding.itemArticleRowSemaforoCon.background if (!sale.isNew && sale.originalQuantity == sale.quantity) { layoutError.visibility = View.GONE @@ -131,53 +136,60 @@ class SaleAdapter( //SEMAFORO if (sale.isPreviousPrepared == "1") { - itemArticleRowSemaforoPre.setBackgroundColor( + DrawableCompat.setTint(backgroundDrawablePre, getColor(context!!,R.color.verdnatura_dark_sky_blue)) + /*itemArticleRowSemaforoPre.setBackgroundColor( getColor( context!!, R.color.verdnatura_dark_sky_blue ) - ) + )*/ } else { - itemArticleRowSemaforoPre.setBackgroundColor( + DrawableCompat.setTint(backgroundDrawablePre, getColor(context!!,R.color.verdnatura_warm_grey)) + /* itemArticleRowSemaforoPre.setBackgroundColor( getColor( context!!, R.color.verdnatura_warm_grey ) - ) + )*/ } if (sale.isPrepared == "1") { - itemArticleRowSemaforoSac.setBackgroundColor( + DrawableCompat.setTint(backgroundDrawableSac, getColor(context!!,R.color.verdnatura_pumpkin_orange)) + /* itemArticleRowSemaforoSac.setBackgroundColor( getColor( context!!, R.color.verdnatura_pumpkin_orange ) - ) + )*/ } else { - itemArticleRowSemaforoSac.setBackgroundColor( + DrawableCompat.setTint(backgroundDrawableSac, getColor(context!!,R.color.verdnatura_warm_grey)) + /* itemArticleRowSemaforoSac.setBackgroundColor( getColor( context!!, R.color.verdnatura_warm_grey ) - ) + )*/ } if (sale.isControlled == "1") { - itemArticleRowSemaforoCon.setBackgroundColor( + + DrawableCompat.setTint(backgroundDrawableCon, getColor(context!!,R.color.verdnatura_dark_mint)) + /*itemArticleRowSemaforoCon.setBackgroundColor( getColor( context!!, R.color.verdnatura_dark_mint ) - ) + )*/ } else { - itemArticleRowSemaforoCon.setBackgroundColor( + DrawableCompat.setTint(backgroundDrawableCon, getColor(context!!,R.color.verdnatura_warm_grey)) + /*itemArticleRowSemaforoCon.setBackgroundColor( getColor( context!!, R.color.verdnatura_warm_grey ) - ) + )*/ } @@ -210,12 +222,13 @@ class SaleAdapter( R.color.verdnatura_dark_mint_light_precontrolled ) ) - itemArticleRowSemaforoCon.setBackgroundColor( + DrawableCompat.setTint(backgroundDrawableCon, getColor(context!!,R.color.verdnatura_dark_mint_light_precontrolled)) + /* itemArticleRowSemaforoCon.setBackgroundColor( getColor( context!!, R.color.verdnatura_dark_mint_light_precontrolled ) - ) + )*/ } else if (sale.isPreviousPrepared == "1") { contentLayout.setBackgroundColor( getColor( @@ -230,12 +243,13 @@ class SaleAdapter( //sergio: para de momento que pinten las lineas sin actualizar ni nada if (sale.isControlled == "2") { - itemArticleRowSemaforoCon.setBackgroundColor( + DrawableCompat.setTint(backgroundDrawableCon, getColor(context!!,R.color.verdnatura_white)) + /* itemArticleRowSemaforoCon.setBackgroundColor( getColor( context!!, R.color.verdnatura_white ) - ) + )*/ contentLayout.setBackgroundColor( getColor( context!!, @@ -245,6 +259,7 @@ class SaleAdapter( } + //ASIGNAMOS VALOR A LA VSITA this.sale = sale @@ -296,8 +311,16 @@ class SaleAdapter( } } }*/ + private fun paintTicketcolor(color: String?, itemView: View) { - private fun paintTicketcolor(color: String, itemView: View) { + if (color.isNullOrBlank()) { + itemView.setBackgroundColor((Color.TRANSPARENT)) + } else { + itemView.setBackgroundColor(Color.parseColor(color)) + } + + } + private fun paintTicketcolorOld(color: String, itemView: View) { when (color.uppercase().trim()) { 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 b9c5842b..9b0cfabf 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 @@ -9,7 +9,6 @@ import android.net.Uri import android.os.Build 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 @@ -17,7 +16,6 @@ import android.view.inputmethod.EditorInfo import android.view.inputmethod.InputMethodManager import android.widget.ImageView import android.widget.Toast -import androidx.core.view.isVisible import androidx.lifecycle.Observer import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView @@ -88,6 +86,8 @@ class CollectionFragment( private var itemShelvingSaleSupplyAddCall = -1 private var saleTrackingCall = -1 + private var lastScanned: String = "" + private var buttonPushedGetCollection = false //private var myKM: KeyguardManager? = null private var positionUnmarked = -1 @@ -151,8 +151,9 @@ class CollectionFragment( override fun onResume() { - if (type==CONTROLADOR && storedBackPosition!=0){ - setListPosition(storedBackPosition, false)} + if (type == CONTROLADOR && storedBackPosition != 0) { + setListPosition(storedBackPosition, true) + } super.onResume() scanRequest() } @@ -162,7 +163,7 @@ class CollectionFragment( customDialogInput = CustomDialogInput(requireContext()) customDialog = CustomDialog(requireContext()) customDialogThreeButtons = CustomDialogThreeButtons(requireContext()) - ma.hideBottomNavigation(View.GONE) + ma.hideBottomNavigation(GONE) binding.splashProgress.visibility = VISIBLE setEvents() @@ -181,7 +182,6 @@ class CollectionFragment( goBack = true goBack2 = true goMistakeBack = true - } private fun setToolBar() { @@ -195,14 +195,23 @@ class CollectionFragment( val listIcons: ArrayList = ArrayList() + val iconPrint = ImageView(context) iconPrint.setImageResource(R.drawable.ic_print_black_24dp) + val iconAdd = ImageView(context) iconAdd.setImageResource(R.drawable.ic_playlist_add_black_24dp) + + val iconViewCollection = ImageView(context) + iconViewCollection.setImageResource(R.drawable.ic_collection) + + val iconWorker = ImageView(context) iconWorker.setImageResource(R.drawable.ic_worker) + val iconPhone = ImageView(context) iconPhone.setImageResource(R.drawable.phone_call) + val iconParking = ImageView(context) iconParking.setImageResource(R.drawable.ic_local_parking_black_24dp) @@ -210,20 +219,26 @@ class CollectionFragment( iconPrint.tooltipText = getTooltip(R.drawable.ic_print_black_24dp) iconAdd.tooltipText = getTooltip(R.drawable.ic_playlist_add_black_24dp) - iconWorker.tooltipText = getTooltip(R.drawable.ic_worker) + iconViewCollection.tooltipText = getTooltip(R.drawable.ic_collection) iconPhone.tooltipText = getTooltip(R.drawable.phone_call) iconParking.tooltipText = getTooltip(R.drawable.ic_local_parking_black_24dp) } if (type.equals("CHECKER")) { - listIcons.add(iconPhone) + // listIcons.add(iconPhone) } - listIcons.add(iconWorker) + listIcons.add(iconPrint) + if (type == CONTROLADOR) { + listIcons.add(iconViewCollection) + } + listIcons.add(iconAdd) + + listIcons.add(iconWorker) if (type.equals(PRECHECKER)) { listIcons.add(iconParking) listIcons.remove(iconPrint) @@ -235,10 +250,11 @@ class CollectionFragment( override fun onOptionsItemSelected(item: Drawable) { when (item) { + iconViewCollection.drawable -> getCollection() iconPrint.drawable -> print() iconAdd.drawable -> addItem() iconWorker.drawable -> showUser() - iconPhone.drawable -> getExtensionFromUser() + //iconPhone.drawable -> getExtensionFromUser() iconParking.drawable -> pasillerosItemClickListener?.onPasillerosItemClickListener( PasillerosItemVO( title = getString(R.string.Parking) @@ -252,8 +268,36 @@ class CollectionFragment( LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false) } - private fun getExtensionFromUser() { + private fun getCollection() { + + binding.splashProgress.visibility = VISIBLE + + if (!buttonPushedGetCollection) { + viewModel.collection_get( + getData(USER), + getData(PASSWORD), + collection.collectionFk, + getData(SECTORFK), + type + ) + + buttonPushedGetCollection = true + } else { + viewModel.collectionTicketGet( + getData(USER), + getData(PASSWORD), + lastScanned, + getData(SECTORFK), + type + + ) + buttonPushedGetCollection = false + } + lastScanned = collection.collectionFk + } + + /* private fun getExtensionFromUser() { binding.splashProgress.visibility = VISIBLE @@ -270,7 +314,7 @@ class CollectionFragment( }*/ - } + }*/ private fun scanRequest() { binding.scanInput.requestFocus() @@ -306,6 +350,7 @@ class CollectionFragment( binding.scanInput.setText(textScanned_filterDouble(binding.scanInput.text!!.toString())) findSale(binding.scanInput.text.toString()) + buttonPushedGetCollection = false } binding.scanInput.setText("") @@ -331,6 +376,7 @@ class CollectionFragment( getData(SECTORFK), type ) + buttonPushedGetCollection = false binding.collectionSwipe.isRefreshing = false //} } @@ -607,6 +653,24 @@ class CollectionFragment( }) + responseSaleMistakeAdd.observe(viewLifecycleOwner, Observer { + + + if (!goBack) { + if (it.isError) { + ma.messageWithSound(it.errorMessage, isError = true, true) + + } else { + ma.messageWithSound( + getString(R.string.errorRegistered), + isError = false, + false + ) + goBack = true + } + + } + }) responseSaleMove.observe(viewLifecycleOwner, Observer { if (it.isError) { @@ -1054,10 +1118,10 @@ class CollectionFragment( binding.fragmentSacadorCollections.layoutManager = lm setTotalLines() - if (storedPosition != 0) - setListPosition(storedPosition, true) - else if (storedBackPosition != 0) - setListPosition(storedBackPosition, true) + if (storedPosition != 0) + setListPosition(storedPosition, true) + else if (storedBackPosition != 0) + setListPosition(storedBackPosition, true) setScrollListener(lm!!) //sergio: se quita porque se realiza desde triggers @@ -1211,7 +1275,6 @@ class CollectionFragment( if (!isOk) { if (txtscan.contains("-")) { - // Log.d("VERDNATURA::", "VAMOS A PARKING DESDE PANTALLA CONTROLADOR") if (tickets.size > 0) { @@ -1386,6 +1449,7 @@ class CollectionFragment( } } else if (isFromBack) { + if (binding.fragmentSacadorCollections != null) { binding.fragmentSacadorCollections.addViewObserver { lm!!.scrollToPositionWithOffset(position, 0) @@ -1413,7 +1477,6 @@ class CollectionFragment( } - //Tarea #4371 se quita para ver si funciona correctamente private fun saleTracking_mark(position: Int, type: String) { @@ -1434,6 +1497,7 @@ class CollectionFragment( ) } + private fun unMarkLine(position: Int, newType: String) { state = 0 if (sales[position].isPrepared == "1") { 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 1df2eb38..6a41d491 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 @@ -48,6 +48,10 @@ class CollectionViewModel(context: Context) : BaseViewModel() { val response: LiveData get() = _response + private val _responseSaleMistakeAdd by lazy { MutableLiveData() } + val responseSaleMistakeAdd: LiveData + get() = _responseSaleMistakeAdd + private val _responseItemShelvingSaleSupplyAdd by lazy { MutableLiveData() } val responseItemShelvingSaleSupplyAdd: LiveData get() = _responseItemShelvingSaleSupplyAdd @@ -180,7 +184,47 @@ class CollectionViewModel(context: Context) : BaseViewModel() { } }) } + fun collection_get( + usuario: String, + password: String, + collectionFk: String, + sectorFk: String, + type: String + ) { + getSacadorControladorUserCase.collection_get( + usuario, + password, + collectionFk, + sectorFk, + "0", + type + ).enqueue(object : + Callback { + override fun onFailure(call: Call, t: Throwable) { + _collectionTicketList.value = CollectionVO( + isError = true, + errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) + ) + } + override fun onResponse( + call: Call, + response: Response + ) { + if (response.body() != null) { + _collectionTicketList.value = response.body()?.let { it.map(contextApp) } + } else { + _collectionTicketList.value = CollectionVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } + } + }) + } fun saleTrackingReplace( usuario: String, @@ -1007,7 +1051,7 @@ class CollectionViewModel(context: Context) : BaseViewModel() { .enqueue(object : Callback { override fun onFailure(call: Call, t: Throwable) { - _response.value = ResponseItemVO( + _responseSaleMistakeAdd.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) ) @@ -1018,7 +1062,7 @@ class CollectionViewModel(context: Context) : BaseViewModel() { response: Response ) { if (!response.isSuccessful) { - _response.value = ResponseItemVO( + _responseSaleMistakeAdd.value = ResponseItemVO( isError = true, errorMessage = getMessageFromAllResponse( nameofFunction(this), @@ -1026,7 +1070,7 @@ class CollectionViewModel(context: Context) : BaseViewModel() { ) ) } else { - _response.value = + _responseSaleMistakeAdd.value = ResponseItemVO(isError = false, response = response.message()) } } @@ -1059,103 +1103,103 @@ class CollectionViewModel(context: Context) : BaseViewModel() { } - fun sip_getExtension( - usuario: String, - password: String, - workerId: String - ) { - getSacadorControladorUserCase.sip_getExtension( - usuario, - password, - workerId - ).enqueue(object : - Callback { - override fun onFailure(call: Call, t: Throwable) { - _responseGetExtensionFromUserId.value = ResponseItemVO( - isError = true, - errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!) - ) - } + /* fun sip_getExtension( + usuario: String, + password: String, + workerId: String + ) { + getSacadorControladorUserCase.sip_getExtension( + usuario, + password, + 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 - ) { + override fun onResponse( + call: Call, + response: Response + ) { - if (response.body() != "false") { - _responseGetExtensionFromUserId.value = ResponseItemVO( - isError = false, - response = response.body()!!, - errorMessage = "" - ) - } else { - _responseGetExtensionFromUserId.value = ResponseItemVO( - isError = true, - response = response.body()!!, - errorMessage = "" - ) - } - } - }) - } - - fun sip_getExtensionSalix( - token: String, - workerId: 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 ){ + if (response.body() != "false") { _responseGetExtensionFromUserId.value = ResponseItemVO( isError = false, - response = JSONObject(response.body()!!.toString()).get("extension").toString(), - errorMessage = "") - }else{ + response = response.body()!!, + 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.") + response = response.body()!!, + errorMessage = "" + ) + } + } + }) + } - }*/ - 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 + fun sip_getExtensionSalix( + token: String, + workerId: 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!!) + ) + } - // 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 = "", - errorMessage = response.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 = "", + errorMessage = response.message()!! + ) + } + } + }) + }*/ fun ticket_checkFullyControlled( usuario: String, diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoUsuarioFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoUsuarioFragment.kt index da7f290e..4a4774c2 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoUsuarioFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoUsuarioFragment.kt @@ -1,13 +1,21 @@ package es.verdnatura.presentation.view.feature.controlvehiculo.fragment +import android.content.Intent +import android.graphics.drawable.Drawable +import android.net.Uri +import android.os.Build import android.view.View.* +import android.widget.ImageView +import androidx.annotation.RequiresApi import androidx.lifecycle.Observer +import androidx.recyclerview.widget.LinearLayoutManager import es.verdnatura.R import es.verdnatura.databinding.FragmentVehiclecontrolUserBinding import es.verdnatura.presentation.base.BaseFragment +import es.verdnatura.presentation.common.OnOptionsSelectedListener +import es.verdnatura.presentation.common.ToolBarAdapterTooltip import es.verdnatura.presentation.common.loadUrl -import es.verdnatura.presentation.view.component.CustomDialog -import es.verdnatura.presentation.view.feature.main.activity.MainActivity +import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO class ControlVehiculoUsuarioFragment( @@ -19,22 +27,57 @@ class ControlVehiculoUsuarioFragment( private var userFk = "" private var goBack: Boolean = false override fun getLayoutId(): Int = R.layout.fragment_vehiclecontrol_user - //private lateinit var customDialog: CustomDialog + companion object { fun newInstance(vUserFK: String) = ControlVehiculoUsuarioFragment(vUserFK) } + @RequiresApi(Build.VERSION_CODES.O) override fun init() { binding.mainToolbar.toolbarTitle.text = getString(R.string.vehiclecontroluser) - // customDialog = CustomDialog(requireContext()) goBack = false binding.splashProgress.visibility = GONE setEvents() + setToolBar() setControlVehicleUser() super.init() } + @RequiresApi(Build.VERSION_CODES.O) + private fun setToolBar() { + + binding.mainToolbar.toolbarSubtitle.visibility = VISIBLE + binding.mainToolbar.toolbarIcons.visibility = VISIBLE + binding.mainToolbar.backButton.visibility = VISIBLE + + val listIcons: ArrayList = ArrayList() + val iconPhone = ImageView(context) + iconPhone.setImageResource(R.drawable.phone_call) + + iconPhone.tooltipText = getTooltip(R.drawable.phone_call) + // listIcons.add(iconPhone) + binding.mainToolbar.toolbarIcons.adapter = + ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener { + override fun onOptionsItemSelected(item: Drawable) { + + when (item) { + iconPhone.drawable -> getExtensionFromUser() + + } + + } + }) + binding.mainToolbar.toolbarIcons.layoutManager = + LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false) + } + + private fun getExtensionFromUser() { + + binding.splashProgress.visibility = VISIBLE + viewModel.sip_getExtensionSalix(getData(TOKEN), vUserFK) + } + override fun onPause() { goBack = true super.onPause() @@ -42,25 +85,39 @@ class ControlVehiculoUsuarioFragment( private fun setControlVehicleUser() { - userFk=getData(USERFK) + userFk = getData(USERFK) if (userFk.equals(vUserFK)) { binding.splashProgress.visibility = VISIBLE - viewModel.machine_getWorkerPlate(getData(USER),getData(PASSWORD)) - viewModel.deviceProduction_getnameDevice(getData(USER),getData(PASSWORD), getData(ANDROID_ID)) - viewModel.deviceProductionUser_getWorker(getData(USER),getData(PASSWORD), getData(ANDROID_ID)) + viewModel.machine_getWorkerPlate(getData(USER), getData(PASSWORD)) + viewModel.deviceProduction_getnameDevice( + getData(USER), + getData(PASSWORD), + getData(ANDROID_ID) + ) + viewModel.deviceProductionUser_getWorker( + getData(USER), + getData(PASSWORD), + getData(ANDROID_ID) + ) } else { userFk = vUserFK binding.userInformation.visibility = INVISIBLE binding.nameVehiclecontrol.visibility = INVISIBLE - binding.userInformation.setOnClickListener({binding.mainToolbar.backButton.performClick()}) - + binding.userInformation.setOnClickListener({ binding.mainToolbar.backButton.performClick() }) + viewModel.machine_getWorkerPlate(getData(USER), getData(PASSWORD)) } - binding.userImage.loadUrl("https://salix.verdnatura.es/api/Images/user/160x160/$userFk/download?access_token=${getData(TOKEN)}") - viewModel.machine_getWorkerPlate(getData(USER),getData(PASSWORD)) + binding.userImage.loadUrl( + "https://salix.verdnatura.es/api/Images/user/160x160/$userFk/download?access_token=${ + getData( + TOKEN + ) + }" + ) + binding.nameVehiclecontrol.text = getData(USER) binding.registeredVehiclecontrol.text = "" binding.deviceName.text = "" @@ -87,33 +144,63 @@ class ControlVehiculoUsuarioFragment( responsemachine.observe(viewLifecycleOwner, Observer { binding.splashProgress.visibility = GONE if (it.isError) { - ma.messageWithSound(it.errorMessage,true,false) + ma.messageWithSound(it.errorMessage, true, false) } else { - //sergio: se modifica el response = null. En casi todas las llamadas se utilizaba para ver si había error. - // Ahora ya no. + if (it.response == "false") { - + if (it.type.equals("getWorker")) { + binding.assignedDevicename.text = + getString(R.string.noAssigned)} } else { - - if (it.type.equals("getnameDevice")) { - binding.deviceName.text = it.response - } - if (it.type.equals("getWorker")) { - binding.assignedDevicename.text = it.response - } - if (it.type.equals("getWorkerPlate")) { - binding.registeredVehiclecontrol.text = it.response - } + when (it.type){ + "getnameDevice"-> binding.deviceName.text = it.response + "getWorker"-> binding.assignedDevicename.text = + it.response + "getWorkerPlate"-> binding.registeredVehiclecontrol.text = it.response } + } + + } + + }) + responseGetExtensionFromUserId.observe(viewLifecycleOwner, Observer { + + binding.splashProgress.visibility = GONE + + if (it.isError) { + ma.messageWithSound( + getString(R.string.noSIP) + it.errorMessage + getString(R.string.user) + vUserFK, + isError = true, + true + ) + + } else { + + callPicker(it.response) } }) } + } + private fun callPicker(extensionNumber: String) { + + + try { + val intent = Intent(Intent.ACTION_DIAL).apply { + data = Uri.parse("tel:$extensionNumber") + } + + startActivity(intent) + } catch (e: Exception) { + + } + + } } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoViewModel.kt index adc1c4d8..3b9fafb8 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoViewModel.kt @@ -9,6 +9,7 @@ import es.verdnatura.presentation.base.getMessageFromAllResponse import es.verdnatura.presentation.base.nameofFunction import es.verdnatura.presentation.common.ResponseItemMachineControl import es.verdnatura.presentation.common.ResponseItemVO +import org.json.JSONObject import retrofit2.Call import retrofit2.Callback import retrofit2.Response @@ -30,6 +31,10 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() { val responsemachine: LiveData get() = _responsemachine + private val _responseGetExtensionFromUserId by lazy { MutableLiveData() } + val responseGetExtensionFromUserId: LiveData + get() = _responseGetExtensionFromUserId + fun machineWorker_add( usuario: String, password: String, @@ -246,5 +251,44 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() { }) } + fun sip_getExtensionSalix( + token: String, + workerId: String + ) { + getVehicleControlTimeUserCase.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 + ) { + + if (response.body() != null) { + _responseGetExtensionFromUserId.value = ResponseItemVO( + isError = false, + response = JSONObject(response.body()!!.toString()).get("extension") + .toString(), + errorMessage = "" + ) + + } else { + _responseGetExtensionFromUserId.value = ResponseItemVO( + isError = true, + response = "", + errorMessage = response.message()!! + ) + } + } + }) + } } \ No newline at end of file diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt index cbdc44e2..a0913b95 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 @@ -62,7 +62,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() { _pasillerositem.add( PasillerosItemVO( 10, - R.drawable.ic_visibility_black_24dp, + R.drawable.ic_ticket, contextApp.getString(R.string.titleShowTicket), R.string.titleShowTicket, contextApp.getString( @@ -74,7 +74,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() { _pasillerositem.add( PasillerosItemVO( 0, - R.drawable.ic_loyalty_black_24dp, + R.drawable.ic_item, contextApp.getString(R.string.titleItemConsult), R.string.titleItemConsult, contextApp.getString( diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt index 95a58fc7..575cff20 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/UbicadorFragment.kt @@ -6,6 +6,7 @@ import android.graphics.drawable.Drawable import android.media.MediaPlayer import android.os.Build import android.os.Bundle +import android.util.Log.d import android.view.View import android.view.inputmethod.EditorInfo import android.widget.ImageView @@ -45,6 +46,7 @@ class UbicadorFragment( private var parking: String = "" private var etiquetas: String = "0" private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null + private var isShelvinLogfromMainScreen = false var mperror: MediaPlayer? = null var mpok: MediaPlayer? = null @@ -72,9 +74,14 @@ class UbicadorFragment( setEvents() setToolBar() if (!shelvingFk.isNullOrEmpty()) { + isShelvinLogfromMainScreen = false binding.splashProgress.visibility = View.VISIBLE binding.mainToolbar.toolbarTitle.text = shelvingFk viewModel.itemShelvingList(getData(USER), getData(PASSWORD), shelvingFk) + + } else { + isShelvinLogfromMainScreen = true + } super.init() } @@ -141,6 +148,7 @@ class UbicadorFragment( binding.mainToolbar.toolbarTitle.text = binding.editMatricula.text.toString() shelvingFk = binding.editMatricula.text.toString() binding.splashProgress.visibility = View.VISIBLE + viewModel.itemShelvingList( getData(USER), getData(PASSWORD), @@ -186,22 +194,28 @@ class UbicadorFragment( } binding.parkingImg.setOnClickListener { - customDialogInput.setTitle(getString(R.string.parkingShelving)).setValue("").setOkButton(getString( - R.string.parking)) { - viewModel.shelvingPark( - getData(USER), - getData(PASSWORD), - shelvingFk, - customDialogInput.getValue() - ) - parking = customDialogInput.getValue() - binding.mainToolbar.toolbarTitle.text = - shelvingFk.uppercase() + getString(R.string.pUppercase) +parking + getString(R.string.label) + etiquetas - if (mpok != null) mpok!!.start() - customDialogInput.dismiss() - }.setKoButton(getString(R.string.cancel)) { - customDialogInput.dismiss() - }.show() + customDialogInput.setTitle(getString(R.string.parkingShelving)).setValue("") + .setOkButton( + getString( + R.string.parking + ) + ) { + viewModel.shelvingPark( + getData(USER), + getData(PASSWORD), + shelvingFk, + customDialogInput.getValue() + ) + parking = customDialogInput.getValue() + binding.mainToolbar.toolbarTitle.text = + shelvingFk.uppercase() + getString(R.string.pUppercase) + parking + getString( + R.string.label + ) + etiquetas + if (mpok != null) mpok!!.start() + customDialogInput.dismiss() + }.setKoButton(getString(R.string.cancel)) { + customDialogInput.dismiss() + }.show() customDialogInput.getEditText().requestFocus() ma.hideKeyboard(customDialogInput.getEditText()) @@ -217,7 +231,9 @@ class UbicadorFragment( customDialogInput.dismiss() parking = customDialogInput.getValue() binding.mainToolbar.toolbarTitle.text = - shelvingFk.uppercase() + getString(R.string.pUppercase) + parking + getString(R.string.label) + etiquetas + shelvingFk.uppercase() + getString(R.string.pUppercase) + parking + getString( + R.string.label + ) + etiquetas if (mpok != null) { mpok!!.start() } @@ -230,21 +246,24 @@ class UbicadorFragment( } binding.editImg.setOnClickListener { - customDialogInput.setTitle(getString(R.string.changeShelving)).setValue("").setOkButton(getString(R.string.save)) { - viewModel.shelvingChange( - getData(USER), - getData(PASSWORD), - shelvingFk, - customDialogInput.getValue() - ) - shelvingFk = customDialogInput.getValue() - binding.mainToolbar.toolbarTitle.text = - shelvingFk.uppercase() +getString(R.string.pUppercase) + parking +getString(R.string.label) + etiquetas - if (mpok != null) mpok!!.start() - customDialogInput.dismiss() - }.setKoButton(getString(R.string.cancel)) { - customDialogInput.dismiss() - }.show() + customDialogInput.setTitle(getString(R.string.changeShelving)).setValue("") + .setOkButton(getString(R.string.save)) { + viewModel.shelvingChange( + getData(USER), + getData(PASSWORD), + shelvingFk, + customDialogInput.getValue() + ) + shelvingFk = customDialogInput.getValue() + binding.mainToolbar.toolbarTitle.text = + shelvingFk.uppercase() + getString(R.string.pUppercase) + parking + getString( + R.string.label + ) + etiquetas + if (mpok != null) mpok!!.start() + customDialogInput.dismiss() + }.setKoButton(getString(R.string.cancel)) { + customDialogInput.dismiss() + }.show() customDialogInput.getEditText().requestFocus() ma.hideKeyboard(customDialogInput.getEditText()) @@ -259,7 +278,9 @@ class UbicadorFragment( ) shelvingFk = customDialogInput.getValue() binding.mainToolbar.toolbarTitle.text = - shelvingFk.uppercase() +getString(R.string.pUppercase) + parking +getString(R.string.label) + etiquetas + shelvingFk.uppercase() + getString(R.string.pUppercase) + parking + getString( + R.string.label + ) + etiquetas if (mpok != null) mpok!!.start() customDialogInput.dismiss() return@setOnEditorActionListener true @@ -271,7 +292,8 @@ class UbicadorFragment( binding.deleteImg.setOnClickListener { customDialog.setTitle(getString(R.string.empty)) - .setDescription(getString(R.string.operationNoReturn)).setOkButton(getString(R.string.empty)) { + .setDescription(getString(R.string.operationNoReturn)) + .setOkButton(getString(R.string.empty)) { viewModel.clearShelvingList( getData(USER), getData(PASSWORD), shelvingFk @@ -300,7 +322,7 @@ class UbicadorFragment( binding.editPrioridad.tooltipText = getString(R.string.changePriority) binding.parkingImg.tooltipText = getTooltip(R.drawable.ic_local_parking_black_24dp) - binding.automaticImg.tooltipText =getTooltip(R.drawable.ic_flash_auto_black_24dp) + binding.automaticImg.tooltipText = getTooltip(R.drawable.ic_flash_auto_black_24dp) } @@ -313,7 +335,7 @@ class UbicadorFragment( event.getContentIfNotHandled().notNull { deep = it.list.size listItems = ArrayList() - var contEtiquetas= 0 + var contEtiquetas = 0 it.list.forEach { item -> try { contEtiquetas += item.stickers.toInt() @@ -325,7 +347,9 @@ class UbicadorFragment( } etiquetas = contEtiquetas.toString() binding.mainToolbar.toolbarTitle.text = - shelvingFk.uppercase() +getString(R.string.pUppercase) + parking +getString(R.string.label) + etiquetas + shelvingFk.uppercase() + getString(R.string.pUppercase) + parking + getString( + R.string.label + ) + etiquetas if (it.list.size > 0) binding.editPrioridad.setText(it.list[0].priority) binding.splashProgress.visibility = View.GONE @@ -363,6 +387,11 @@ class UbicadorFragment( binding.locationRecyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, true) + if (isShelvinLogfromMainScreen){ + //tarea 4454 + viewModel.shelvinLog_add(getData(USER),getData(PASSWORD),shelvingFk) + } + } }) @@ -372,8 +401,8 @@ class UbicadorFragment( ma.messageWithSound(it.errorMessage, it.isError, false) - }else{ - ma.messageWithSound("", it.isError, true) + } else { + ma.messageWithSound("", it.isError, true, isToasted = false) } }) @@ -567,13 +596,13 @@ class UbicadorFragment( itemShelvingFk, groupingPack ) - /* changeOfflineValue( - ItemUbicadorVO( - item = itemFk, - visible = visible, - packing = packing - ) - )*/ + /* changeOfflineValue( + ItemUbicadorVO( + item = itemFk, + visible = visible, + packing = packing + ) + )*/ customDialogUbicador.setItemValue("").setPackingValue("").setGroupingValue("") .setEtiquetaValue("").setVisibleValue("") customDialogUbicador.getEditItem().requestFocus() @@ -600,14 +629,14 @@ class UbicadorFragment( itemShelvingFk, groupingPack ) - /* changeOfflineValue( - ItemUbicadorVO( - item = itemFk, - visible = visible_calc, - packing = packing, - stickers = etiquetas - ) - )*/ + /* changeOfflineValue( + ItemUbicadorVO( + item = itemFk, + visible = visible_calc, + packing = packing, + stickers = etiquetas + ) + )*/ customDialogUbicador.setItemValue("").setPackingValue("").setGroupingValue("") .setEtiquetaValue("").setVisibleValue("") customDialogUbicador.getEditItem().requestFocus() @@ -623,7 +652,10 @@ class UbicadorFragment( } } else { - getString(R.string.mandatoryPacking).toast((activity as MainActivity), Toast.LENGTH_LONG) + getString(R.string.mandatoryPacking).toast( + (activity as MainActivity), + Toast.LENGTH_LONG + ) } } 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 341f2a34..cb759094 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 @@ -328,6 +328,38 @@ class UbicadorViewModel(context: Context) : BaseViewModel() { }) } + + + fun shelvinLog_add( + usuario: String, + password: String, + code: String + + + ) { + getUbicadorUserCase.shelvinLog_add(usuario, password, code) + .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.isSuccessful) { + _response.value = ResponseItemVO( + isError = true, + errorMessage = getMessageFromAllResponse( + nameofFunction(this), + response.message() + ) + ) + } + } + }) + } + fun itemShelving_return( usuario: String, password: String, @@ -370,9 +402,7 @@ class UbicadorViewModel(context: Context) : BaseViewModel() { } else { _reubicationList.value = response.body()?.let { ReubicationList(it) } - /* for (item in response.body()!!){ - Log.d("VERDNATURA","El item es "+item.itemFk+":"+item.shelvingFk) - }*/ + } } }) diff --git a/app/src/main/res/drawable-v24/ic_collection.xml b/app/src/main/res/drawable-v24/ic_collection.xml new file mode 100644 index 00000000..64ee62e9 --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_collection.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/background_and_round_collection_fragment.xml b/app/src/main/res/drawable/background_and_round_collection_fragment.xml new file mode 100644 index 00000000..9a3b191c --- /dev/null +++ b/app/src/main/res/drawable/background_and_round_collection_fragment.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/background_test.xml b/app/src/main/res/drawable/background_test.xml new file mode 100644 index 00000000..b5470246 --- /dev/null +++ b/app/src/main/res/drawable/background_test.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_delete_forever_black_24dp.xml b/app/src/main/res/drawable/ic_delete_forever_black_24dp.xml index e16ada2c..35a3db78 100644 --- a/app/src/main/res/drawable/ic_delete_forever_black_24dp.xml +++ b/app/src/main/res/drawable/ic_delete_forever_black_24dp.xml @@ -1,5 +1,7 @@ - + android:width="24dp" + xmlns:android="http://schemas.android.com/apk/res/android"> + diff --git a/app/src/main/res/drawable/ic_item.xml b/app/src/main/res/drawable/ic_item.xml new file mode 100644 index 00000000..14f0723a --- /dev/null +++ b/app/src/main/res/drawable/ic_item.xml @@ -0,0 +1,13 @@ + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_ticket.xml b/app/src/main/res/drawable/ic_ticket.xml new file mode 100644 index 00000000..ba91c394 --- /dev/null +++ b/app/src/main/res/drawable/ic_ticket.xml @@ -0,0 +1,8 @@ + + + + diff --git a/app/src/main/res/drawable/round.xml b/app/src/main/res/drawable/round.xml new file mode 100644 index 00000000..7c950011 --- /dev/null +++ b/app/src/main/res/drawable/round.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/component_custom_edit_dialog_three_values.xml b/app/src/main/res/layout/component_custom_edit_dialog_three_values.xml index 91df8db7..befb6691 100644 --- a/app/src/main/res/layout/component_custom_edit_dialog_three_values.xml +++ b/app/src/main/res/layout/component_custom_edit_dialog_three_values.xml @@ -45,37 +45,43 @@ android:id="@+id/textinputlayout_one" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_margin="@dimen/layout_margin_min" - android:textColorHint="@android:color/darker_gray"> + android:layout_marginTop="@dimen/default_layout_margin" + android:textColorHint="@android:color/darker_gray" + app:hintEnabled="false"> + android:visibility="visible" + app:hintEnabled="false" /> - + app:hintEnabled="false"> + + + > + app:hintEnabled="false" + + > + + + + + + + @@ -137,32 +163,12 @@ - - - - - - - background_oval_checked + app:layout_constraintTop_toTopOf="parent" + > diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 8e749019..a0153ffc 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -373,7 +373,7 @@ Pallet Expedition ( ¿Estás seguro de cerrar la sesión? - Causa del error registada + Causa del error registrada Artículo: "Cantidad original: " No se puede realizar la llamada. El usuario no tiene la extensión configurada. Solicítelo a informática. @@ -487,5 +487,7 @@ Nombre Borrar forma trabajo ¿Desea borrar definitivamente la forma de trabajo? + Ver colección o último ticket + No asignado diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 9d1a9970..b804f895 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -90,6 +90,8 @@ 20dp 15dp 30dp + 18dp + 90dp diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 097f00af..5c4ca8f8 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -285,6 +285,7 @@ Element introduced is not a number Buyer Access Salix to see more information + Access to collection or ticket Ítem : Change plate Wagoon scaned¿Do you want register another? @@ -486,7 +487,8 @@ Server Salix Name Delete work form - ¿Do you delete definitely? + ¿Do you remove definitely? + Not assigned