diff --git a/.idea/misc.xml b/.idea/misc.xml
index e9020ce4..294d902b 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -71,6 +71,7 @@
+
@@ -138,6 +139,7 @@
+
diff --git a/app/build.gradle b/app/build.gradle
index 0574dd71..202186d0 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -14,8 +14,11 @@ android {
applicationId "es.verdnatura"
minSdkVersion 21
targetSdkVersion 29
- versionCode 94
- versionName "7.3" //VERSION CODE 94. Se ve productos en balda y posibilidad de modificarlo.
+ versionCode 97
+ versionName "7.5.1" //VERSION CODE 97. Control de previa, Llamadas ok, menú ok y textos en iconos y imágenes.
+ //versionName "7.5" //VERSION CODE 96. Control de previa, Llamadas ok, menú ok y textos en iconos y imágenes.
+ //versionName "7.4" //VERSION CODE 95. Envio desde App enlaces correctos, un click controladores y llamadas sacador-controlador hecho pero no probado.
+ //versionName "7.3" //VERSION CODE 94. Se ve productos en balda y posibilidad de modificarlo.
//versionName "7.2.1" //VERSION CODE 93. Si eliges sector en V no aparece insertar las baldas.
//versionName "7.2" //VERSION CODE 92. Ordena sales en presacador por pickingOrder, ya no llama siempre para poner numero de baldas.
//versionName "7" //VERSION CODE 88. Se añade llamadas a parkingsales,incorpora poner numero de baldas
diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json
index 9ffa3141..40355c6f 100644
--- a/app/release/output-metadata.json
+++ b/app/release/output-metadata.json
@@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
- "versionCode": 94,
- "versionName": "7.3",
+ "versionCode": 97,
+ "versionName": "7.5.1",
"outputFile": "app-release.apk"
}
],
diff --git a/app/release/vn-picking.apk b/app/release/vn-picking.apk
index 73de46c5..ccf3e514 100644
Binary files a/app/release/vn-picking.apk and b/app/release/vn-picking.apk differ
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 868888ae..db0cdff2 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -4,15 +4,17 @@
package="es.verdnatura">
+
-
+
diff --git a/app/src/main/java/es/verdnatura/domain/GetLoginUserCase.kt b/app/src/main/java/es/verdnatura/domain/GetLoginUserCase.kt
index 8ea82b13..dce43765 100644
--- a/app/src/main/java/es/verdnatura/domain/GetLoginUserCase.kt
+++ b/app/src/main/java/es/verdnatura/domain/GetLoginUserCase.kt
@@ -89,20 +89,20 @@ class GetLoginUserCase(context: Context) : RestClient(context)
*/
//SALIX SERGIO MENSAJE : PARA NO ENVIAR MENSAJES A COMERCIALES PONGO QUE LAS MODIFICACIONES SE ENVIAN AL CANAL CREADO.
- fun sendChekingPresence(token:String,workerId:Int,message:String) : Call{
+ /*fun sendChekingPresence(token:String,workerId:Int,message:String) : Call{
return salixClient!!.sendChekingPresence(content_type = "application/json", authorization = token, params = SalixMessageVO(workerId = workerId,message = message))
- }
+ }*/
// SERGIO: PARA DESARROLLO SE DESCOMENTA ESTAS LÍNEAS Y SE COMENTAN LAS DE ARRIBA
- /* fun sendChekingPresence(token: String, workerId: Int, message: String): Call
- {
- return salixClient!!.sendGroup(
- content_type = "application/json",
- authorization = token,
- params = SalixGrupo(to = "#android-test", message = message)
- )
- }*/
+ fun sendChekingPresence(token: String, workerId: Int, message: String): Call
+{
+ return salixClient!!.sendGroup(
+ content_type = "application/json",
+ authorization = token,
+ params = SalixGrupo(to = "#android-test", message = message)
+ )
+}
fun checkVersion(usuario: String, password: String, nameApp: String): Call
{
diff --git a/app/src/main/java/es/verdnatura/domain/GetSacadorControladorUserCase.kt b/app/src/main/java/es/verdnatura/domain/GetSacadorControladorUserCase.kt
index 4db5d5c3..39cad186 100644
--- a/app/src/main/java/es/verdnatura/domain/GetSacadorControladorUserCase.kt
+++ b/app/src/main/java/es/verdnatura/domain/GetSacadorControladorUserCase.kt
@@ -42,6 +42,22 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) {
)
}
+ fun sip_getExtension(
+ usuario: String,
+ password: String,
+ WorkerId: String
+ ): Call {
+ val params: ArrayList = ArrayList()
+ params.add(WorkerId)
+ return restClient!!.sip_getExtension(
+ "json",
+ "1",
+ usuario,
+ password,
+ "application/json",
+ params
+ )
+ }
fun ticketOrCollection_checkFullyControlled(
usuario: String,
password: String,
@@ -58,7 +74,6 @@ class GetSacadorControladorUserCase(context: Context) : RestClient(context) {
params
)
}
-
fun collectionNew(
usuario: String,
password: String,
diff --git a/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt b/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt
index ef64f04b..d4dab344 100644
--- a/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt
+++ b/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt
@@ -179,7 +179,7 @@ interface VerdnaturaService {
):
Call*/
- @POST("almacennew/ticketOrCollection_checkFullyControlled")//REVISADA
+ @POST("almacennew/ticket_checkFullyControlled")//REVISADA
fun ticketOrCollection_checkFullyControlled(
@Header("aplicacion") aplicacion: String,
@Header("version") version: String,
@@ -190,6 +190,17 @@ interface VerdnaturaService {
):
Call
+ @POST("almacennew/sip_getExtension")//REVISADA
+ fun sip_getExtension(
+ @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
+
//sergio: de momento se separa para ir viendo como funciona. El precontrol llamara a collectionTicketGet con otro parametro.
@POST("almacennew/collection_getTickets")//REVISADA
fun collection_getTickets(
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 5aa12c79..8ad4a106 100644
--- a/app/src/main/java/es/verdnatura/presentation/base/BaseFragment.kt
+++ b/app/src/main/java/es/verdnatura/presentation/base/BaseFragment.kt
@@ -6,7 +6,6 @@ import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
-import android.content.pm.PackageManager
import android.media.AudioManager
import android.os.Build
import android.os.Bundle
@@ -21,20 +20,16 @@ import android.view.View
import android.view.ViewGroup
import androidx.activity.result.contract.ActivityResultContracts
import androidx.annotation.LayoutRes
-import androidx.core.app.ActivityCompat
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import androidx.fragment.app.Fragment
import com.google.gson.Gson
-import com.google.gson.JsonObject
import com.google.gson.reflect.TypeToken
+import es.verdnatura.R
import es.verdnatura.domain.toast
import es.verdnatura.presentation.common.mediaCurrentVolume
-import es.verdnatura.presentation.common.mediaMaxVolume
-import org.json.JSONObject
import org.koin.androidx.viewmodel.ext.android.viewModel
import timber.log.Timber
-import java.text.SimpleDateFormat
import java.util.*
import kotlin.reflect.KClass
@@ -120,6 +115,7 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
runSound()
//requestRecordAudioPermission()
requestRecordAudioPermissionNew()
+ requestCallPhonePermissionNew()
init()
}
@@ -180,7 +176,37 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
lifecycle.addObserver(this@BaseFragment.viewModel)
addBindingVariables()
}
+ fun getTooltip(image: Int):String {
+ return when (image) {
+ //itemCard
+ R.drawable.ic_autorenew_black_24dp -> "Recarga datos del elemento escaneado/seleccionado"
+ R.drawable.ic_history_black_24dp -> "Ver Histórico del ítem"
+ //presacador
+ R.drawable.ic_local_parking_black_24dp->"Permite aparcar ticket/carro"
+ //collection
+ R.drawable.ic_print_black_24dp->"Imprime ticket"
+ R.drawable.ic_playlist_add_black_24dp->"Añade ítem"
+ R.drawable.face_man_outline->"Visualiza la foto del sacador"
+ R.drawable.phone_call->"Realiza llamada al sacador"
+ R.drawable.car->"Permite coger vehículo"
+ R.drawable.car_off->"Permite dejar el vehículo"
+ //REPETIDO:R.drawable.ic_history_black_24dp->"Realiza llamada al sacador"
+ //sacador
+ R.drawable.ic_add_black_24dp->"Genera colección para sacar"
+ //REPETIDO: R.drawable.car->"Permite coger vehículo"
+ //ubicador:
+ //REPETIDO: R.drawable.ic_add_black_24dp->"Genera colección para sacar"
+ //REPETIDO: ic_autorenew_black_24dp
+ //historico articulo
+ R.drawable.ic_transaction->"Ver filtro "
+ R.drawable.alpha_f_circle_outline->"Ver movimientos de Faltas"
+ R.drawable.alpha_b_circle_outline->"Ver movimientos de Basura"
+
+ else -> {""}
+ }
+
+ }
override fun onInit(status: Int) {
if (status == TextToSpeech.SUCCESS) {
@@ -374,6 +400,23 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
}
}
}*/
+
+ private fun requestCallPhonePermission(){
+ val permissionLauncher = registerForActivityResult(
+ ActivityResultContracts.RequestPermission()
+ )
+ { isGranted ->
+ if (isGranted) {
+ Timber.i("permisos ok")
+ }
+
+ else {
+ Timber.i("Denegados permisos")
+ }
+ }
+
+ permissionLauncher.launch(Manifest.permission.CALL_PHONE)
+ }
private fun requestRecordAudioPermissionNew() {
val permissionLauncher = registerForActivityResult(
@@ -391,7 +434,23 @@ override fun onViewCreated(view: View, savedInstanceState: Bundle?)
permissionLauncher.launch(Manifest.permission.RECORD_AUDIO)
}
+ private fun requestCallPhonePermissionNew() {
+ val permissionLauncher = registerForActivityResult(
+ ActivityResultContracts.RequestPermission()
+ )
+ { isGranted ->
+ if (isGranted) {
+ Timber.i("permisos ok")
+ }
+
+ else {
+ Timber.i("Denegados permisos")
+ }
+ }
+
+ permissionLauncher.launch(Manifest.permission.CALL_PHONE)
+ }
fun cancelSpeech() {
if (mSpeechRecognizer != null) {
mSpeechRecognizer!!.destroy()
diff --git a/app/src/main/java/es/verdnatura/presentation/common/ToolBarAdapterTooltip.kt b/app/src/main/java/es/verdnatura/presentation/common/ToolBarAdapterTooltip.kt
new file mode 100644
index 00000000..8e0c218a
--- /dev/null
+++ b/app/src/main/java/es/verdnatura/presentation/common/ToolBarAdapterTooltip.kt
@@ -0,0 +1,59 @@
+package es.verdnatura.presentation.common
+import android.graphics.drawable.Drawable
+import android.os.Build
+import android.view.LayoutInflater
+import android.view.ViewGroup
+import android.widget.ImageView
+import androidx.annotation.RequiresApi
+import androidx.recyclerview.widget.RecyclerView
+import es.verdnatura.R
+import es.verdnatura.databinding.ItemToolbarRowBinding
+
+class ToolBarAdapterTooltip (
+
+ private val items: List,
+ private val onOptionsSelectedListener: OnOptionsSelectedListener
+ ) : RecyclerView.Adapter() {
+
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
+ return ItemHolder(
+ ItemToolbarRowBinding.inflate(LayoutInflater.from(parent.context), parent, false)
+ )
+ }
+
+ override fun getItemCount() = items.size
+
+ @RequiresApi(Build.VERSION_CODES.O)
+ override fun onBindViewHolder(holder: ItemHolder, position: Int) {
+ holder.bind(items[position])
+
+
+ }
+
+ inner class ItemHolder(
+ val binding: ItemToolbarRowBinding
+ ) : RecyclerView.ViewHolder(binding.root) {
+ private val res = binding.root.context.resources
+
+
+ fun bind(item: ImageView) {
+ binding.apply {
+ imagebuttonIcon.setImageDrawable(item.drawable)
+
+ imagebuttonIcon.setOnClickListener {
+ onOptionsSelectedListener.onOptionsItemSelected(item.drawable)
+ }
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ imagebuttonIcon.tooltipText=item.tooltipText
+ }
+
+ }
+ }
+ }
+ }
+
+
+
+
diff --git a/app/src/main/java/es/verdnatura/presentation/common/UICallbacks.kt b/app/src/main/java/es/verdnatura/presentation/common/UICallbacks.kt
index b224b0eb..52e27b63 100644
--- a/app/src/main/java/es/verdnatura/presentation/common/UICallbacks.kt
+++ b/app/src/main/java/es/verdnatura/presentation/common/UICallbacks.kt
@@ -22,6 +22,7 @@ interface OnOptionsSelectedListener {
fun onOptionsItemSelected(item: Drawable)
}
+
interface OnPasillerosItemClickListener {
fun onPasillerosItemClickListener(item: PasillerosItemVO,entryPoint:String)
}
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 fb8dbd30..75bbea97 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
@@ -1,20 +1,15 @@
package es.verdnatura.presentation.view.feature.articulo.fragment
-
-
-/*import kotlinx.android.synthetic.main.activity_main.*
-import kotlinx.android.synthetic.main.buyers_fragment.*
-import kotlinx.android.synthetic.main.fragment_item_card.*
-import kotlinx.android.synthetic.main.fragment_item_card.binding.splashProgress
-import kotlinx.android.synthetic.main.toolbar.**/
import android.app.AlertDialog
import android.content.Intent
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
-import android.util.Log
+import android.os.Build
import android.view.View
import android.view.View.GONE
import android.view.inputmethod.EditorInfo
+import android.widget.ImageView
+import androidx.annotation.RequiresApi
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
@@ -22,10 +17,8 @@ import es.verdnatura.databinding.FragmentItemCardBinding
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment
-import es.verdnatura.presentation.common.OnBarcodeRowClickListener
-import es.verdnatura.presentation.common.OnItemCardRowClickListener
-import es.verdnatura.presentation.common.OnOptionsSelectedListener
-import es.verdnatura.presentation.common.loadUrl
+import es.verdnatura.presentation.common.*
+import es.verdnatura.presentation.common.ToolBarAdapterTooltip.*
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogInput
import es.verdnatura.presentation.view.component.CustomDialogList
@@ -37,32 +30,31 @@ import es.verdnatura.presentation.view.feature.articulo.model.ItemCardRowVO
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
import es.verdnatura.presentation.view.feature.imageview.activity.ImageViewActivity
-import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
class ItemCardFragment(
- var itemFk:String = ""
-) : BaseFragment(ItemCardViewModel::class) {
+ var itemFk: String = ""
+) : BaseFragment(ItemCardViewModel::class) {
- private var urlLarge:String = ""
- private var titleImage:String = ""
+ private var urlLarge: String = ""
+ private var titleImage: String = ""
private var user = ""
private var password = ""
private var warehouseFk = ""
- private var adapter : ItemCardAdapter? = null
- private var barcodeAdapter : BarcodeAdapter? = null
- private var listItemsRow:ArrayList = ArrayList()
- private var listBarcodes:ArrayList = ArrayList()
- private var itemsPackingType:ArrayList = ArrayList()
+ private var adapter: ItemCardAdapter? = null
+ private var barcodeAdapter: BarcodeAdapter? = null
+ private var listItemsRow: ArrayList = ArrayList()
+ private var listBarcodes: ArrayList = ArrayList()
+ private var itemsPackingType: ArrayList = ArrayList()
-
- private var itemInfoG:ItemCardVO? = null
+ private var itemInfoG: ItemCardVO? = null
companion object {
- fun newInstance(entryPoint:String) = ItemCardFragment(entryPoint)
+ fun newInstance(entryPoint: String) = ItemCardFragment(entryPoint)
}
+
private lateinit var customDialog: CustomDialog
private lateinit var customDialogInput: CustomDialogInput
private lateinit var customDialogList: CustomDialogList
@@ -71,9 +63,10 @@ class ItemCardFragment(
override fun getLayoutId(): Int = R.layout.fragment_item_card
+ @RequiresApi(Build.VERSION_CODES.O)
override fun init() {
- binding.itemcardLayout.visibility=View.GONE
+ binding.itemcardLayout.visibility = View.GONE
(activity as MainActivity).hideBottomNavigation(View.GONE)
setEvents()
@@ -86,7 +79,7 @@ class ItemCardFragment(
customDialogTwo = CustomDialogTwoButtons(requireContext())
- if (!itemFk.isNullOrEmpty()){
+ if (!itemFk.isNullOrEmpty()) {
getItemCard(itemFk)
}
setToolBar()
@@ -94,47 +87,108 @@ class ItemCardFragment(
}
-
+ private fun setToolBar() {
- private fun setToolBar(){
- val listIcons:ArrayList = ArrayList()
- val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme())
- val iconHistory : Drawable = resources.getDrawable(R.drawable.ic_history_black_24dp,resources.newTheme())
+ val listIcons: ArrayList = ArrayList()
+ val iconReload = ImageView(context)
+ iconReload.setImageResource(R.drawable.ic_autorenew_black_24dp)
+ val iconHistory = ImageView(context)
+ iconHistory.setImageResource(R.drawable.ic_history_black_24dp)
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ iconReload.tooltipText = getTooltip(R.drawable.ic_autorenew_black_24dp)
+ iconHistory.tooltipText = getTooltip(R.drawable.ic_history_black_24dp)
+ }
listIcons.add(iconReload)
listIcons.add(iconHistory)
- //toolbar_icons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
- binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
-
- override fun onOptionsItemSelected(item: Drawable) {
- if (item == iconReload){
- // binding.splashProgress.visibility = View.VISIBLE
- binding.splashProgress.visibility = View.VISIBLE
- getItemCard(itemFk)
- }
- if (item == iconHistory){
- if (itemFk.isNullOrEmpty()){
- "Escanea un item".toast(requireActivity())
- }else{
- // //Log.i("VERDNATURA:","el item es ${itemInfoG!!.id}")
- //(activity as MainActivity).onPasillerosItemClickListener( PasillerosItemVO(title = "Historico"),itemFk)
- (activity as MainActivity).onPasillerosItemClickListener( PasillerosItemVO(title = "Historico"),itemInfoG!!.id)
+
+ /*
+ val listIcons:ArrayList = ArrayList()
+ val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme())
+ val iconHistory : Drawable = resources.getDrawable(R.drawable.ic_history_black_24dp,resources.newTheme())
+ listIcons.add(iconReload)
+ listIcons.add(iconHistory)*/
+
+ binding.mainToolbar.toolbarIcons.adapter =
+ ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
+
+
+ override fun onOptionsItemSelected(item: Drawable) {
+
+ when (item) {
+ iconReload.drawable -> {
+ binding.splashProgress.visibility = View.VISIBLE
+ getItemCard(itemFk)
+ }
+ iconHistory.drawable -> {
+ if (itemFk.isNullOrEmpty()) {
+ "Escanea un item".toast(requireActivity())
+ } else {
+ (activity as MainActivity).onPasillerosItemClickListener(
+ PasillerosItemVO(title = "Historico"),
+ itemInfoG!!.id
+ )
+
+ }
+
+ }
}
+ /* if (item == iconReload.drawable) {
+ binding.splashProgress.visibility = View.VISIBLE
+ getItemCard(itemFk)
+ }
+ if (item == iconHistory.drawable) {
+ if (itemFk.isNullOrEmpty()) {
+ "Escanea un item".toast(requireActivity())
+ } else {
+ (activity as MainActivity).onPasillerosItemClickListener(
+ PasillerosItemVO(title = "Historico"),
+ itemInfoG!!.id
+ )
+ }
+
+ }*/
}
- }
- })
+ })
+
+ /* binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
+
+
+ override fun onOptionsItemSelected(item: Drawable) {
+ if (item == iconReload){
+ // binding.splashProgress.visibility = View.VISIBLE
+ binding.splashProgress.visibility = View.VISIBLE
+ getItemCard(itemFk)
+ }
+ if (item == iconHistory){
+ if (itemFk.isNullOrEmpty()){
+ "Escanea un item".toast(requireActivity())
+ }else{
+ // //Log.i("VERDNATURA:","el item es ${itemInfoG!!.id}")
+ //(activity as MainActivity).onPasillerosItemClickListener( PasillerosItemVO(title = "Historico"),itemFk)
+ (activity as MainActivity).onPasillerosItemClickListener( PasillerosItemVO(title = "Historico"),itemInfoG!!.id)
+
+ }
+
+ }
+ }
+
+ })*/
//toolbar_icons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
- binding.mainToolbar.toolbarIcons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
+ binding.mainToolbar.toolbarIcons.layoutManager =
+ LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
}
- private fun setEvents(){
+
+ private fun setEvents() {
//edit_itemFk.requestFocus()
binding.editItemFk.requestFocus()
//edit_itemFk.setOnEditorActionListener { v, actionId, event ->
- binding.editItemFk.setOnEditorActionListener { v, actionId, event ->
+ binding.editItemFk.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
//if (!edit_itemFk.text.toString().isNullOrEmpty())
if (!binding.editItemFk.text.toString().isNullOrEmpty())
@@ -147,55 +201,58 @@ class ItemCardFragment(
}
binding.mainToolbar.backButton.setOnClickListener {
-
+
requireActivity().onBackPressed()
}
- binding.itemcardImage.setOnClickListener{
+ binding.itemcardImage.setOnClickListener {
- val i = Intent(activity,ImageViewActivity::class.java)
- i.putExtra("url",urlLarge)
- i.putExtra("title",titleImage)
+ val i = Intent(activity, ImageViewActivity::class.java)
+ i.putExtra("url", urlLarge)
+ i.putExtra("title", titleImage)
startActivity(i)
}
}
- private fun getItemCard(itemFk:String){
- val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0)
- user = prefs.getString(USER,"").toString()
- password = prefs.getString(PASSWORD,"").toString()
- warehouseFk = prefs.getInt(WAREHOUSEFK,WAREHOUSEFKDEFAULT).toString()
+ private fun getItemCard(itemFk: String) {
+ val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER, 0)
+ user = prefs.getString(USER, "").toString()
+ password = prefs.getString(PASSWORD, "").toString()
+ warehouseFk = prefs.getInt(WAREHOUSEFK, WAREHOUSEFKDEFAULT).toString()
this.itemFk = itemFk
binding.splashProgressTwo.visibility = View.VISIBLE
- viewModel.getItemCard(itemFk,warehouseFk,user,password,"item_card")
+ viewModel.getItemCard(itemFk, warehouseFk, user, password, "item_card")
binding.splashProgress.visibility = View.VISIBLE
- viewModel.getItemPackingType(user,password,"get_ItemPackingType")
+ viewModel.getItemPackingType(user, password, "get_ItemPackingType")
}
override fun observeViewModel() {
- with(viewModel){
+ with(viewModel) {
itemcard.observe(viewLifecycleOwner, Observer {
- if (it.isError){
+ if (it.isError) {
binding.itemcardLayout.visibility = GONE
- binding.splashProgressTwo.visibility=GONE
+ binding.splashProgressTwo.visibility = GONE
binding.mainToolbar.toolbarTitle.text = "ItemCard"
- customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
- customDialog.dismiss()
- }.show()
- }else{
- if (it.id != "0"){
- binding.itemcardLayout.visibility = View.VISIBLE
- setItemCard(it)
- }else{
- binding.splashProgressTwo.visibility=GONE
- binding.itemcardLayout.visibility = View.GONE
- binding.mainToolbar.toolbarTitle.text = "ItemCard"
- customDialog.setTitle("Sin resultados").setDescription("No hemos podido encontrar el articulo. Revisa el sector.").setOkButton("Cerrar"){
+ customDialog.setTitle("Error").setDescription(it.errorMessage)
+ .setOkButton("Cerrar") {
customDialog.dismiss()
}.show()
+ } else {
+ if (it.id != "0") {
+ binding.itemcardLayout.visibility = View.VISIBLE
+ setItemCard(it)
+ } else {
+ binding.splashProgressTwo.visibility = GONE
+ binding.itemcardLayout.visibility = View.GONE
+ binding.mainToolbar.toolbarTitle.text = "ItemCard"
+ customDialog.setTitle("Sin resultados")
+ .setDescription("No hemos podido encontrar el articulo. Revisa el sector.")
+ .setOkButton("Cerrar") {
+ customDialog.dismiss()
+ }.show()
}
}
@@ -209,11 +266,12 @@ class ItemCardFragment(
response.observe(viewLifecycleOwner, Observer {
binding.splashProgress.visibility = View.GONE
- if (it.isError){
- customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
- customDialog.dismiss()
- }.show()
- }else{
+ if (it.isError) {
+ customDialog.setTitle("Error").setDescription(it.errorMessage)
+ .setOkButton("Cerrar") {
+ customDialog.dismiss()
+ }.show()
+ } else {
getItemCard(itemFk)
}
@@ -224,22 +282,22 @@ class ItemCardFragment(
private fun createItemTypeTypeList(list: List) {
itemsPackingType.clear()
list.forEach { item ->
- if (!item.isError){
+ if (!item.isError) {
try {
- itemsPackingType.add(ItemPackingType(item.code,item.description))
+ itemsPackingType.add(ItemPackingType(item.code, item.description))
- }catch (e:Exception){}
+ } catch (e: Exception) {
+ }
}
- }}
+ }
+ }
-
-
- private fun setItemCard(itemInfo:ItemCardVO){
+ private fun setItemCard(itemInfo: ItemCardVO) {
itemInfoG = itemInfo
- binding.mainToolbar.toolbarTitle.text = itemInfo.id+"-"+itemInfo.longName
- titleImage = itemInfo.id+"-"+itemInfo.longName
- // binding.itemcardImage.setImageDrawable(resources.getDrawable(R.drawable.loadphoto,resources.newTheme()))
+ binding.mainToolbar.toolbarTitle.text = itemInfo.id + "-" + itemInfo.longName
+ titleImage = itemInfo.id + "-" + itemInfo.longName
+ // binding.itemcardImage.setImageDrawable(resources.getDrawable(R.drawable.loadphoto,resources.newTheme()))
binding.itemcardImage.loadUrl(itemInfo.urlImage200)
urlLarge = itemInfo.urlImage
binding.itemcardTag1.text = itemInfo.size
@@ -247,141 +305,245 @@ class ItemCardFragment(
binding.itemcardTag3.text = itemInfo.value6
binding.itemcardTag4.text = itemInfo.value7 + " " + itemInfo.origin
listItemsRow = ArrayList()
- listItemsRow.add(ItemCardRowVO(title = getString(R.string.total),value = itemInfo.total,isEditable = false))
- listItemsRow.add(ItemCardRowVO(title = getString(R.string.Disponible),value = itemInfo.available,isEditable = false))
- listItemsRow.add(ItemCardRowVO(title = getString(R.string.Ubicado),value = itemInfo.enAltillo,isEditable = false))
- listItemsRow.add(ItemCardRowVO(title = getString(R.string.SINUBICAR),value = itemInfo.enNicho,isEditable = false, action = "itemStockUpdate"))
+
+ //sergio itemcard por item_getInfo
+ /* listItemsRow.add(
+ ItemCardRowVO(
+ title = getString(R.string.total),
+ value = itemInfo.total,
+ isEditable = false
+ )
+ )*/
+ listItemsRow.add(ItemCardRowVO(title = getString(R.string.total),value = itemInfo.visible,isEditable = false))
+
+ listItemsRow.add(
+ ItemCardRowVO(
+ title = getString(R.string.Disponible),
+ value = itemInfo.available,
+ isEditable = false
+ )
+ )
+
+ //sergio itemcard por item_getInfo
+ /* listItemsRow.add(
+ ItemCardRowVO(
+ title = getString(R.string.Ubicado),
+ value = itemInfo.enAltillo,
+ isEditable = false
+ )
+ )*/
+ listItemsRow.add(ItemCardRowVO(title = getString(R.string.Ubicado),value = itemInfo.vVisibleItemShelving,isEditable = false))
+
+ //sergio itemcard por item_getInfo
+ /* listItemsRow.add(
+ ItemCardRowVO(
+ title = getString(R.string.SINUBICAR),
+ value = itemInfo.enNicho,
+ isEditable = false,
+ action = "itemStockUpdate"
+ )
+ )*/
+ listItemsRow.add(ItemCardRowVO(title = getString(R.string.SINUBICAR),value = itemInfo.unlocated,isEditable = false, action = "itemStockUpdate"))
//EDITABLES
- listItemsRow.add(ItemCardRowVO(title = "Artículos similares",isEditable = true, action = "itemProposal"))
- listItemsRow.add(ItemCardRowVO(title = getString(R.string.DARALTA),value = "",isEditable = true, action = "itemStockUpdateAdd"))
- listItemsRow.add(ItemCardRowVO(title = getString(R.string.DARBAJA),value = "",isEditable = true, action = "itemStockUpdateRemove"))
- listItemsRow.add(ItemCardRowVO(title = getString(R.string.BuscarItem),value = "",isEditable = true, action = "buscarItem"))
+ listItemsRow.add(
+ ItemCardRowVO(
+ title = "Artículos similares",
+ isEditable = true,
+ action = "itemProposal"
+ )
+ )
+ listItemsRow.add(
+ ItemCardRowVO(
+ title = getString(R.string.DARALTA),
+ value = "",
+ isEditable = true,
+ action = "itemStockUpdateAdd"
+ )
+ )
+ listItemsRow.add(
+ ItemCardRowVO(
+ title = getString(R.string.DARBAJA),
+ value = "",
+ isEditable = true,
+ action = "itemStockUpdateRemove"
+ )
+ )
+ listItemsRow.add(
+ ItemCardRowVO(
+ title = getString(R.string.BuscarItem),
+ value = "",
+ isEditable = true,
+ action = "buscarItem"
+ )
+ )
//listItemsRow.add(ItemCardRowVO(title = "NICHO",value = itemInfo.nicho,isEditable = true, action = "itemPlacementSave"))
- // listItemsRow.add(ItemCardRowVO(title = "RESERVA",value = itemInfo.reserva,isEditable = true, action = "itemPlacementSave"))
- listItemsRow.add(ItemCardRowVO(title = getString(R.string.Grouping),value = itemInfo.grouping,isEditable = true, action = "updateGrouping"))
- listItemsRow.add(ItemCardRowVO(title = getString(R.string.Packing),value = itemInfo.packing,isEditable = true, action = "updatePacking"))
- listItemsRow.add(ItemCardRowVO(title = getString(R.string.MINIMO),value = itemInfo.min,isEditable = true, action = "itemSaveMin"))
- listItemsRow.add(ItemCardRowVO(title = getString(R.string.Referencia),value = itemInfo.referencia,isEditable = true, action = "item_saveReference"))
- listItemsRow.add(ItemCardRowVO(title = getString(R.string.Barcode),barcodes = itemInfo.barcodes,isEditable = true, action = "toBarcode"))
+ // listItemsRow.add(ItemCardRowVO(title = "RESERVA",value = itemInfo.reserva,isEditable = true, action = "itemPlacementSave"))
+ listItemsRow.add(
+ ItemCardRowVO(
+ title = getString(R.string.Grouping),
+ value = itemInfo.grouping,
+ isEditable = true,
+ action = "updateGrouping"
+ )
+ )
+ listItemsRow.add(
+ ItemCardRowVO(
+ title = getString(R.string.Packing),
+ value = itemInfo.packing,
+ isEditable = true,
+ action = "updatePacking"
+ )
+ )
+ listItemsRow.add(
+ ItemCardRowVO(
+ title = getString(R.string.MINIMO),
+ value = itemInfo.min,
+ isEditable = true,
+ action = "itemSaveMin"
+ )
+ )
+ listItemsRow.add(
+ ItemCardRowVO(
+ title = getString(R.string.Referencia),
+ value = itemInfo.referencia,
+ isEditable = true,
+ action = "item_saveReference"
+ )
+ )
+ listItemsRow.add(
+ ItemCardRowVO(
+ title = getString(R.string.Barcode),
+ barcodes = itemInfo.barcodes,
+ isEditable = true,
+ action = "toBarcode"
+ )
+ )
//sergio para itemTypePacking
- listItemsRow.add(ItemCardRowVO(title = getString(R.string.tipodeencajado),value = itemInfo.itemPackingTypeFk,isEditable = true, action = "updateSector"))
- // listItemsRow.add(ItemCardRowVO(title = "Artículos similares",value = itemInfo.itemPackingTypeFk,isEditable = true, action = "itemProposal"))
+ listItemsRow.add(
+ ItemCardRowVO(
+ title = getString(R.string.tipodeencajado),
+ value = itemInfo.itemPackingTypeFk,
+ isEditable = true,
+ action = "updateSector"
+ )
+ )
+ // listItemsRow.add(ItemCardRowVO(title = "Artículos similares",value = itemInfo.itemPackingTypeFk,isEditable = true, action = "itemProposal"))
listBarcodes = itemInfo.barcodes as ArrayList
- adapter = ItemCardAdapter(listItemsRow,object: OnItemCardRowClickListener{
+ adapter = ItemCardAdapter(listItemsRow, object : OnItemCardRowClickListener {
override fun onItemCardRowClickListener(item: ItemCardRowVO) {
- if (item.action == "itemProposal"){
+ if (item.action == "itemProposal") {
- (activity as MainActivity).onPasillerosItemClickListener(
- PasillerosItemVO(
- title = "Buscar artículos similares"
- ), itemFk
- )
+ (activity as MainActivity).onPasillerosItemClickListener(
+ PasillerosItemVO(
+ title = "Buscar artículos similares"
+ ), itemFk
+ )
- }
- else{
- if (item.action == "updateSector") {
- showDialogSelectItemTypePacking()
} else {
- if (item.action != "toBarcode" && item.action != "buscarItem" && item.action != "itemStockUpdateAdd" && item.action != "itemStockUpdateRemove") {
- customDialogInput.setTitle(item.title!!)
- .setDescription("Valor actual: " + item.value!!)
- .setOkButton("Guardar") {
- (activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
- editItemCardRow(item, customDialogInput.getValue())
- customDialogInput.dismiss()
-
- }.setKoButton("Cancelar") {
- (activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
- customDialogInput.dismiss()
- }.setValue("").show()
- customDialogInput.getEditText().requestFocus()
- customDialogInput.getEditText()
- .setOnEditorActionListener { v, actionId, event ->
- if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
- if (!customDialogInput.getValue().isNullOrEmpty())
- editItemCardRow(item, customDialogInput.getValue())
- customDialogInput.setValue("")
- customDialogInput.dismiss()
+ if (item.action == "updateSector") {
+ showDialogSelectItemTypePacking()
+ } else {
+ if (item.action != "toBarcode" && item.action != "buscarItem" && item.action != "itemStockUpdateAdd" && item.action != "itemStockUpdateRemove") {
+ customDialogInput.setTitle(item.title!!)
+ .setDescription("Valor actual: " + item.value!!)
+ .setOkButton("Guardar") {
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
- return@setOnEditorActionListener true
- }
- false
- }
- } else if (item.action == "toBarcode") {
- //BARCODE ROW
- prepareBarcodeDialog(item)
- } else if (item.action == "buscarItem") {
- (activity as MainActivity).onPasillerosItemClickListener(
- PasillerosItemVO(
- title = "Buscar item"
- ), itemFk
- )
- } else if (item.action == "itemStockUpdateAdd") {
- customDialogInput.setTitle(item.title!!)
- .setDescription("Indica la cantidad a dar de alta")
- .setOkButton("Guardar") {
- (activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
- editItemCardRow(item, customDialogInput.getValue())
- customDialogInput.dismiss()
-
- }.setKoButton("Cancelar") {
- (activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
- customDialogInput.dismiss()
- }.setValue("").show()
- customDialogInput.getEditText().requestFocus()
- customDialogInput.getEditText()
- .setOnEditorActionListener { v, actionId, event ->
- if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
- if (!customDialogInput.getValue().isNullOrEmpty())
- editItemCardRow(item, customDialogInput.getValue())
- customDialogInput.setValue("")
+ editItemCardRow(item, customDialogInput.getValue())
customDialogInput.dismiss()
- (activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
- return@setOnEditorActionListener true
- }
- false
- }
- } else if (item.action == "itemStockUpdateRemove") {
- customDialogInput.setTitle(item.title!!)
- .setDescription("Indica la cantidad a dar de baja ")
- .setOkButton("Guardar") {
- (activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
- editItemCardRow(item, customDialogInput.getValue())
- customDialogInput.dismiss()
- }.setKoButton("Cancelar") {
- (activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
- customDialogInput.dismiss()
- }.setValue("").show()
- customDialogInput.getEditText().requestFocus()
- customDialogInput.getEditText()
- .setOnEditorActionListener { v, actionId, event ->
- if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
- if (!customDialogInput.getValue().isNullOrEmpty())
- editItemCardRow(item, customDialogInput.getValue())
- customDialogInput.setValue("")
- customDialogInput.dismiss()
+ }.setKoButton("Cancelar") {
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
- return@setOnEditorActionListener true
+ customDialogInput.dismiss()
+ }.setValue("").show()
+ customDialogInput.getEditText().requestFocus()
+ customDialogInput.getEditText()
+ .setOnEditorActionListener { v, actionId, event ->
+ if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
+ if (!customDialogInput.getValue().isNullOrEmpty())
+ editItemCardRow(item, customDialogInput.getValue())
+ customDialogInput.setValue("")
+ customDialogInput.dismiss()
+ (activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
+ return@setOnEditorActionListener true
+ }
+ false
}
- false
- }
+ } else if (item.action == "toBarcode") {
+ //BARCODE ROW
+ prepareBarcodeDialog(item)
+ } else if (item.action == "buscarItem") {
+ (activity as MainActivity).onPasillerosItemClickListener(
+ PasillerosItemVO(
+ title = "Buscar item"
+ ), itemFk
+ )
+ } else if (item.action == "itemStockUpdateAdd") {
+ customDialogInput.setTitle(item.title!!)
+ .setDescription("Indica la cantidad a dar de alta")
+ .setOkButton("Guardar") {
+ (activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
+ editItemCardRow(item, customDialogInput.getValue())
+ customDialogInput.dismiss()
+
+ }.setKoButton("Cancelar") {
+ (activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
+ customDialogInput.dismiss()
+ }.setValue("").show()
+ customDialogInput.getEditText().requestFocus()
+ customDialogInput.getEditText()
+ .setOnEditorActionListener { v, actionId, event ->
+ if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
+ if (!customDialogInput.getValue().isNullOrEmpty())
+ editItemCardRow(item, customDialogInput.getValue())
+ customDialogInput.setValue("")
+ customDialogInput.dismiss()
+ (activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
+ return@setOnEditorActionListener true
+ }
+ false
+ }
+ } else if (item.action == "itemStockUpdateRemove") {
+ customDialogInput.setTitle(item.title!!)
+ .setDescription("Indica la cantidad a dar de baja ")
+ .setOkButton("Guardar") {
+ (activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
+ editItemCardRow(item, customDialogInput.getValue())
+ customDialogInput.dismiss()
+
+ }.setKoButton("Cancelar") {
+ (activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
+ customDialogInput.dismiss()
+ }.setValue("").show()
+ customDialogInput.getEditText().requestFocus()
+ customDialogInput.getEditText()
+ .setOnEditorActionListener { v, actionId, event ->
+ if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
+ if (!customDialogInput.getValue().isNullOrEmpty())
+ editItemCardRow(item, customDialogInput.getValue())
+ customDialogInput.setValue("")
+ customDialogInput.dismiss()
+ (activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
+ return@setOnEditorActionListener true
+ }
+ false
+ }
+ }
}
}
}
- }
})
//itemcard_recyclerview.adapter = adapter
binding.itemcardRecyclerview.adapter = adapter
//itemcard_recyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
- binding.itemcardRecyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
+ binding.itemcardRecyclerview.layoutManager =
+ LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
binding.scrollView.post {
val position = IntArray(2)
if (binding.itemcardImage != null) {
@@ -389,128 +551,187 @@ class ItemCardFragment(
binding.scrollView.scrollTo(0, position[1])
}
}
- binding.splashProgressTwo.visibility=GONE
+ binding.splashProgressTwo.visibility = GONE
}
- private fun editItemCardRow(item:ItemCardRowVO,value:String){
+ private fun editItemCardRow(item: ItemCardRowVO, value: String) {
- when (item.action){
- // cau:sergio itemTrash x itemStock Update . No se utiliza esta funicón
- // "itemStockUpdate" -> prepareItemStockUpdate(item,value)
- "itemStockUpdateAdd" -> prepareItemStockUpdate2(item,value)
- "itemStockUpdateRemove" -> prepareItemStockUpdate2(item,value)
- "itemPlacementSave" -> viewModel.itemPlacementSave(itemFk = itemFk, warehouseFk = warehouseFk, user = user, password = password, value = value,"itemPlacementSave")
- "updateGrouping" -> viewModel.updateGrouping(itemFk = itemFk, user = user, password = password, value = value,warehouseFk = warehouseFk,"buy_updateGrouping")
- "updatePacking" -> viewModel.updatePacking(itemFk = itemFk, user = user, password = password, value = value,warehouseFk = warehouseFk,"buy_updatePacking")
- "itemSaveMin" -> viewModel.itemSaveMin(itemFk = itemFk, user = user, password = password, value = value,"itemSaveMin")
- "item_saveReference"->viewModel.item_saveReference(itemFk = itemFk, user = user, password = password, value = value,"item_saveReference")
+ when (item.action) {
+ // cau:sergio itemTrash x itemStock Update . No se utiliza esta funicón
+ // "itemStockUpdate" -> prepareItemStockUpdate(item,value)
+ "itemStockUpdateAdd" -> prepareItemStockUpdate2(item, value)
+ "itemStockUpdateRemove" -> prepareItemStockUpdate2(item, value)
+ "itemPlacementSave" -> viewModel.itemPlacementSave(
+ itemFk = itemFk,
+ warehouseFk = warehouseFk,
+ user = user,
+ password = password,
+ value = value,
+ "itemPlacementSave"
+ )
+ "updateGrouping" -> viewModel.updateGrouping(
+ itemFk = itemFk,
+ user = user,
+ password = password,
+ value = value,
+ warehouseFk = warehouseFk,
+ "buy_updateGrouping"
+ )
+ "updatePacking" -> viewModel.updatePacking(
+ itemFk = itemFk,
+ user = user,
+ password = password,
+ value = value,
+ warehouseFk = warehouseFk,
+ "buy_updatePacking"
+ )
+ "itemSaveMin" -> viewModel.itemSaveMin(
+ itemFk = itemFk,
+ user = user,
+ password = password,
+ value = value,
+ "itemSaveMin"
+ )
+ "item_saveReference" -> viewModel.item_saveReference(
+ itemFk = itemFk,
+ user = user,
+ password = password,
+ value = value,
+ "item_saveReference"
+ )
}
- if(item.action != "itemStockUpdate")
- // changeOfflineValue(item,value, listBarcodes)
- showProgress()
+ if (item.action != "itemStockUpdate")
+ // changeOfflineValue(item,value, listBarcodes)
+ showProgress()
}
//sergio: changeOffLineValue solo hace visible el progress
- private fun showProgress(){
+ private fun showProgress() {
binding.splashProgress.visibility = View.VISIBLE
}
- /* private fun changeOfflineValue(item:ItemCardRowVO,newValue:String, barcodes:List){
+ /* private fun changeOfflineValue(item:ItemCardRowVO,newValue:String, barcodes:List){
- binding.splashProgress.visibility = View.VISIBLE
+ binding.splashProgress.visibility = View.VISIBLE
- //sergio: esta parte ya estaba comentada
- /*var i = 0
- var position = 0
- listItemsRow.forEach {
- if (it.title == item.title) {
- position = i
- }
- i = i.plus(1)
- }
- if (listItemsRow.get(position).title != "BARCODE") listItemsRow.get(position).value = newValue
- else listItemsRow.get(position).barcodes = barcodes
- adapter?.notifyDataSetChanged()*/
- }*/
+ //sergio: esta parte ya estaba comentada
+ /*var i = 0
+ var position = 0
+ listItemsRow.forEach {
+ if (it.title == item.title) {
+ position = i
+ }
+ i = i.plus(1)
+ }
+ if (listItemsRow.get(position).title != "BARCODE") listItemsRow.get(position).value = newValue
+ else listItemsRow.get(position).barcodes = barcodes
+ adapter?.notifyDataSetChanged()*/
+ }*/
- /* private fun prepareItemStockUpdate(itemB:ItemCardRowVO,value:String){
+ /* private fun prepareItemStockUpdate(itemB:ItemCardRowVO,value:String){
- //sergio: cau: no se llama a esta función itemTrash itemStockUpdate
- try{
+ //sergio: cau: no se llama a esta función itemTrash itemStockUpdate
+ try{
- if (itemB.value!!.toInt() > value.toInt()) {
- customDialogTwo.setTitle(itemB.title!!).setDescription("Indica la causa de eliminar stock:").setOkButton("Falta"){
- viewModel.itemStockUpdate(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = value,isTrash = "0")
- changeOfflineValue(itemB,value, listBarcodes)
- customDialogTwo.dismiss()
+ if (itemB.value!!.toInt() > value.toInt()) {
+ customDialogTwo.setTitle(itemB.title!!).setDescription("Indica la causa de eliminar stock:").setOkButton("Falta"){
+ viewModel.itemStockUpdate(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = value,isTrash = "0")
+ changeOfflineValue(itemB,value, listBarcodes)
+ customDialogTwo.dismiss()
- }.setOkButtonTwo("Basura"){
- viewModel.itemStockUpdate(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = value,isTrash = "1")
- changeOfflineValue(itemB,value, listBarcodes)
- customDialogTwo.dismiss()
+ }.setOkButtonTwo("Basura"){
+ viewModel.itemStockUpdate(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = value,isTrash = "1")
+ changeOfflineValue(itemB,value, listBarcodes)
+ customDialogTwo.dismiss()
- }.setKoButton("Cancelar"){
+ }.setKoButton("Cancelar"){
- customDialogTwo.dismiss()
- }.show()
- }else{
- changeOfflineValue(itemB,value, listBarcodes)
- viewModel.itemStockUpdate(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = value,isTrash = "0")
- }
- }catch (e:Exception){
- binding.itemcardLayout.visibility = View.GONE
- customDialog.setTitle("Error").setDescription("El elemento introducido no es un número").setKoButton("Cancelar"){
- customDialog.dismiss()
- }.show()
- }
+ customDialogTwo.dismiss()
+ }.show()
+ }else{
+ changeOfflineValue(itemB,value, listBarcodes)
+ viewModel.itemStockUpdate(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = value,isTrash = "0")
+ }
+ }catch (e:Exception){
+ binding.itemcardLayout.visibility = View.GONE
+ customDialog.setTitle("Error").setDescription("El elemento introducido no es un número").setKoButton("Cancelar"){
+ customDialog.dismiss()
+ }.show()
+ }
- }*/
+ }*/
- private fun prepareItemStockUpdate2(itemB:ItemCardRowVO,value:String){
- try{
+ private fun prepareItemStockUpdate2(itemB: ItemCardRowVO, value: String) {
+ try {
if (itemB.action == "itemStockUpdateRemove") {
- customDialogTwo.setTitle(itemB.title!!).setDescription("Indica la causa de eliminar stock:").setOkButton("Falta"){
- viewModel.itemTrash(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = value,isTrash = "0","itemTrash")
+ customDialogTwo.setTitle(itemB.title!!)
+ .setDescription("Indica la causa de eliminar stock:").setOkButton("Falta") {
+ viewModel.itemTrash(
+ itemFk = itemFk,
+ warehouseFk = warehouseFk,
+ user = user,
+ password = password,
+ newValue = value,
+ isTrash = "0",
+ "itemTrash"
+ )
//changeOfflineValue(itemB,value, listBarcodes)
showProgress()
customDialogTwo.dismiss()
- }.setOkButtonTwo("Basura"){
- viewModel.itemTrash(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = value,isTrash = "1","itemTrash")
+ }.setOkButtonTwo("Basura") {
+ viewModel.itemTrash(
+ itemFk = itemFk,
+ warehouseFk = warehouseFk,
+ user = user,
+ password = password,
+ newValue = value,
+ isTrash = "1",
+ "itemTrash"
+ )
//changeOfflineValue(itemB,value, listBarcodes)
showProgress()
customDialogTwo.dismiss()
- }.setKoButton("Cancelar"){
+ }.setKoButton("Cancelar") {
customDialogTwo.dismiss()
}.show()
- }else{
+ } else {
//changeOfflineValue(itemB,value, listBarcodes)
- showProgress()
- viewModel.itemTrash(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = (value.toInt() * -1).toString(),isTrash = "0","itemTrash")
+ showProgress()
+ viewModel.itemTrash(
+ itemFk = itemFk,
+ warehouseFk = warehouseFk,
+ user = user,
+ password = password,
+ newValue = (value.toInt() * -1).toString(),
+ isTrash = "0",
+ "itemTrash"
+ )
}
- }catch (e:Exception){
+ } catch (e: Exception) {
binding.itemcardLayout.visibility = View.GONE
- customDialog.setTitle("Error").setDescription("El elemento introducido no es un número").setKoButton("Cancelar"){
- customDialog.dismiss()
- }.show()
+ customDialog.setTitle("Error").setDescription("El elemento introducido no es un número")
+ .setKoButton("Cancelar") {
+ customDialog.dismiss()
+ }.show()
}
}
- private fun prepareBarcodeDialog(itemB:ItemCardRowVO){
+ private fun prepareBarcodeDialog(itemB: ItemCardRowVO) {
- customDialogList.setTitle("Barcodes").setOkButton("Guardar"){
+ customDialogList.setTitle("Barcodes").setOkButton("Guardar") {
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
if (!customDialogList.getValue().isNullOrEmpty())
- updateBarcode(customDialogList.getValue(),"0",itemB)
+ updateBarcode(customDialogList.getValue(), "0", itemB)
customDialogList.dismiss()
- }.setKoButton("Cerrar"){
+ }.setKoButton("Cerrar") {
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
customDialogList.dismiss()
}.setValue("").show()
@@ -520,7 +741,7 @@ class ItemCardFragment(
customDialogList.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
if (!customDialogList.getValue().isNullOrEmpty())
- updateBarcode(customDialogList.getValue(),"0",itemB)
+ updateBarcode(customDialogList.getValue(), "0", itemB)
customDialogList.setValue("")
customDialogList.dismiss()
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
@@ -529,55 +750,71 @@ class ItemCardFragment(
false
}
- barcodeAdapter = BarcodeAdapter(listBarcodes,object: OnBarcodeRowClickListener{
+ barcodeAdapter = BarcodeAdapter(listBarcodes, object : OnBarcodeRowClickListener {
override fun onBarcodeRowClickListener(item: BarcodeVO) {
- updateBarcode(item.code!!,"1",itemB)
+ updateBarcode(item.code!!, "1", itemB)
}
})
customDialogList.getRecyclerView().adapter = barcodeAdapter
- customDialogList.getRecyclerView().layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
+ customDialogList.getRecyclerView().layoutManager =
+ LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
}
- private fun updateBarcode(code:String,delete:String,item:ItemCardRowVO){
- if (delete == "1"){
+ private fun updateBarcode(code: String, delete: String, item: ItemCardRowVO) {
+ if (delete == "1") {
var i = 0
var posDelete = 0
listBarcodes.forEach {
if (it.code == code)
posDelete = i
- i+=1
+ i += 1
}
listBarcodes.removeAt(posDelete)
- }else{
+ } else {
listBarcodes.add(BarcodeVO(code))
}
- 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")
+ 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)
showProgress()
}
- private fun showDialogSelectItemTypePacking(){
+ private fun showDialogSelectItemTypePacking() {
- var array= arrayOfNulls(itemsPackingType.size)
- for (indice in array.indices){
- array[indice]=itemsPackingType[indice].code + " : "+itemsPackingType[indice].description
+ var array = arrayOfNulls(itemsPackingType.size)
+ for (indice in array.indices) {
+ array[indice] =
+ itemsPackingType[indice].code + " : " + itemsPackingType[indice].description
}
val builder = AlertDialog.Builder(this.context)
builder.setTitle(getString(R.string.mensajeseleccionencajado))
- .setItems(array
+ .setItems(
+ array
) { _, position ->
updateItemPackingType(itemsPackingType[position].code.toString())
}
builder.create().show()
- }
+ }
- private fun updateItemPackingType(itemPackingType:String) {
+ private fun updateItemPackingType(itemPackingType: String) {
binding.splashProgress.visibility = View.VISIBLE
- viewModel.updatePackingType(this.itemFk,user,password,itemPackingType,"item_updatePackingType")
+ 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 e196d380..1cdae5c8 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
@@ -58,7 +58,7 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
if (response.body() != null){
_itemcard.value = response.body()!!
}else{
- _itemcard.value = ItemCardVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
+ _itemcard.value = ItemCardVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}
}
@@ -69,7 +69,7 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
getItemCardUserCase.item_getSimilar(user,password,itemFk,warehouseFk,vShipped,vIsShowedByType).enqueue(object :Callback>{
override fun onFailure(call: Call>, t: Throwable) {
val listError:ArrayList = ArrayList()
- listError.add(ItemProposal(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
+ listError.add(ItemProposal(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_itemProposallist.value = ItemProposalList(listError)
}
@@ -80,7 +80,7 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
}else{
val listError:ArrayList = ArrayList()
- listError.add(ItemProposal(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
+ listError.add(ItemProposal(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_itemProposallist.value = ItemProposalList(listError)
}
@@ -95,7 +95,7 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
Callback>{
override fun onFailure(call: Call>, t: Throwable) {
val listError:ArrayList = ArrayList()
- listError.add(ItemPackingType(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
+ listError.add(ItemPackingType(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_itemspackinglist.value = ItemPackingTypeList(listError)
}
@@ -105,7 +105,7 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
}else{
val listError:ArrayList = ArrayList()
- listError.add(ItemPackingType(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
+ listError.add(ItemPackingType(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_itemspackinglist.value = ItemPackingTypeList(listError)
}
}
@@ -136,12 +136,12 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
fun itemTrash(itemFk:String,warehouseFk:String,user:String,password:String,newValue:String,isTrash:String,callFunction:String){
getItemCardUserCase.itemTrash(user,password,itemFk,warehouseFk,newValue,isTrash).enqueue(object : Callback{
override fun onFailure(call: Call, t: Throwable) {
- _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
+ _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(callFunction,response.message()))
+ _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@@ -154,12 +154,12 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
fun itemPlacementSave(itemFk:String,warehouseFk:String,user:String,password:String,value:String,callFunction:String){
getItemCardUserCase.itemPlacementSave(user,password,itemFk,warehouseFk,value).enqueue(object : Callback{
override fun onFailure(call: Call, t: Throwable) {
- _response.value = ResponseItemVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!))
+ _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(callFunction,response.message()))
+ _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@@ -172,12 +172,12 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
fun updateGrouping(itemFk:String,user:String,password:String,value:String,warehouseFk: String,callFunction:String){
getItemCardUserCase.updateGrouping(user,password,itemFk,value,warehouseFk).enqueue(object : Callback{
override fun onFailure(call: Call, t: Throwable) {
- _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
+ _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(callFunction,response.message()))
+ _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@@ -190,12 +190,12 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
fun updatePacking(itemFk:String,user:String,password:String,value:String,warehouseFk: String,callFunction:String){
getItemCardUserCase.updatePacking(user,password,itemFk,value,warehouseFk).enqueue(object : Callback{
override fun onFailure(call: Call, t: Throwable) {
- _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
+ _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(callFunction,response.message()))
+ _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@@ -209,12 +209,12 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
fun updatePackingType(itemFk:String,user:String,password:String,itemPackingType:String,callFunction:String){
getItemCardUserCase.updatePackingType(user,password,itemFk,itemPackingType).enqueue(object : Callback{
override fun onFailure(call: Call, t: Throwable) {
- _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
+ _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(callFunction,response.message()))
+ _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
//if (response.body()=="Finish"){
// //Log.i("VERDNATURA:","Fisnih encontrado")}
@@ -229,12 +229,12 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
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) {
- _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
+ _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(callFunction,response.message()))
+ _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@@ -247,13 +247,13 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
fun item_saveReference(itemFk:String,user:String,password:String,value:String,callFunction:String){
getItemCardUserCase.item_saveReference(user,password,itemFk,value).enqueue(object : Callback{
override fun onFailure(call: Call, t: Throwable) {
- _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
+ _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(callFunction,response.message()))
+ _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false)
}
@@ -266,12 +266,12 @@ class ItemCardViewModel(context: Context) : BaseViewModel() {
fun barcodesEdit(itemFk:String,user:String,password:String,value:String,delete:String,callFunction:String){
getItemCardUserCase.barcodes_edit(user,password,itemFk,value,delete).enqueue(object : Callback{
override fun onFailure(call: Call, t: Throwable) {
- _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
+ _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(callFunction,response.message()))
+ _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemProposalFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemProposalFragment.kt
index b5dbe635..97592c92 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemProposalFragment.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemProposalFragment.kt
@@ -11,7 +11,6 @@ import androidx.core.content.ContextCompat
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
-import es.verdnatura.databinding.FragmentInventaryBinding
import es.verdnatura.databinding.FragmentItemproposalBinding
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnItemProposalClickListener
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/model/ItemCardVO.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/model/ItemCardVO.kt
index a24d14b0..3fd285a4 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/model/ItemCardVO.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/model/ItemCardVO.kt
@@ -31,7 +31,15 @@ class ItemCardVO (
var urlImage200:String = "",
var urlImage:String = "",
var itemPackingTypeFk:String =" ",
- var referencia:String=""
+ var referencia:String="",
+
+
+ //sergio para modificar la llamada de itemCard a item_getInfo
+
+ var vVisibleItemShelving:String = "0", // = enAltillo
+ var visible :String = "0",// = total
+ var unlocated:String = "0" //= enNicho
+
)
class ItemCardRowVO (
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferFragment.kt
index 55693a97..416d8110 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferFragment.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferFragment.kt
@@ -98,20 +98,6 @@ class BufferFragment(
)
- /* if (entryPoint.equals("Vaciado buffer")){
- viewModel.buffer_setTypeByName(user,password, binding.scanInput.text.toString(),"UNLOADING","buffer_setTypeByName")
- }
- if (entryPoint.equals("Llenado buffer")){
- viewModel.buffer_setTypeByName(user,password, binding.scanInput.text.toString(),"LOADING","buffer_setTypeByName")
- }
- if (entryPoint.equals("Acumulación buffer")){
- viewModel.buffer_setTypeByName(user,password, binding.scanInput.text.toString(),"ACCUMULATION","buffer_setTypeByName")
- }
- if (entryPoint.equals("Desactivado buffer")){
- viewModel.buffer_setTypeByName(user,password, binding.scanInput.text.toString(),"DISABLED","buffer_setTypeByName")
- }*/
-
-
}
binding.scanInput.setText("")
(activity as MainActivity).hideKeyboard( binding.scanInput)
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferFragmentViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferFragmentViewModel.kt
index 698d1216..5e121e8d 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferFragmentViewModel.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/buffer/fragment/BufferFragmentViewModel.kt
@@ -8,6 +8,7 @@ import es.verdnatura.domain.GetPaletizadoresUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
+import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO
import retrofit2.Call
import retrofit2.Callback
@@ -41,7 +42,7 @@ class BufferFragmentViewModel(context: Context) : BaseViewModel() {
_itembuffertype.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
@@ -58,7 +59,7 @@ class BufferFragmentViewModel(context: Context) : BaseViewModel() {
//_bufferresponse.value = false
_itembuffertype.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,"Error al realizar la operación"))
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),"Error al realizar la operación"))
}
@@ -73,7 +74,7 @@ class BufferFragmentViewModel(context: Context) : BaseViewModel() {
override fun onFailure(call: Call, t: Throwable) {
_bufferloadresponse.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call, response: Response) {
@@ -81,14 +82,14 @@ class BufferFragmentViewModel(context: Context) : BaseViewModel() {
if (!response.isSuccessful){
_bufferloadresponse.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message()!!))
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()!!))
}else {
if (response.body()!!.isNullOrEmpty()) {
_bufferloadresponse.value = ResponseItemVO(
isError = true,
errorMessage =
- getMessageFromAllResponse(callFunction,response.message()!!)
+ getMessageFromAllResponse(nameofFunction(this),response.message()!!)
)
} else {
_bufferloadresponse.value = ResponseItemVO(
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/fragment/BuscarItemFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/fragment/BuscarItemFragment.kt
index 1ba7c495..5353d6b8 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/fragment/BuscarItemFragment.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/fragment/BuscarItemFragment.kt
@@ -40,7 +40,7 @@ class BuscarItemFragment(
override fun getLayoutId(): Int = R.layout.fragment_buscar_item
override fun init() {
- //requireActivity().main_bottom_navigation.visibility = View.GONE
+
(activity as MainActivity).hideBottomNavigation(GONE)
binding.mainToolbar.toolbarTitle.text = getString(R.string.getubicaition)
customDialog = CustomDialog(requireContext())
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/fragment/BuscarItemViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/fragment/BuscarItemViewModel.kt
index 17f811d9..01abc268 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/fragment/BuscarItemViewModel.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/buscaritem/fragment/BuscarItemViewModel.kt
@@ -8,6 +8,7 @@ import es.verdnatura.domain.GetBuscarItemUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
+import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO
import es.verdnatura.presentation.view.feature.buscaritem.model.LocationListVO
@@ -31,7 +32,7 @@ class BuscarItemViewModel(context: Context) : BaseViewModel() {
getBuscarItemUserCase.searchItemsUbicador(user,password,itemFk).enqueue(object : Callback> {
override fun onFailure(call: Call>, t: Throwable) {
val listError:ArrayList = ArrayList()
- listError.add(ItemLocationVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
+ listError.add(ItemLocationVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_locationList.value = LocationListVO(listError)
}
@@ -43,7 +44,7 @@ class BuscarItemViewModel(context: Context) : BaseViewModel() {
_locationList.value = response.body()?.let { LocationListVO(it) }
}else{
val listError:ArrayList = ArrayList()
- listError.add(ItemLocationVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
+ listError.add(ItemLocationVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_locationList.value = LocationListVO(listError)
}
}
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/BuyersFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/BuyersFragment.kt
index 4ac46629..1800f253 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/BuyersFragment.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/BuyersFragment.kt
@@ -3,8 +3,10 @@ package es.verdnatura.presentation.view.feature.calidad.fragment
import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
+import android.os.Build
import android.os.Bundle
import android.view.View
+import android.widget.ImageView
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
@@ -15,6 +17,7 @@ import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnAjustesItemClickListener
import es.verdnatura.presentation.common.OnBuyerSelectedListener
import es.verdnatura.presentation.common.OnOptionsSelectedListener
+import es.verdnatura.presentation.common.ToolBarAdapterTooltip
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
@@ -50,8 +53,6 @@ class BuyersFragment : BaseFragment(Buyer
super.onAttach(context)
}
-
-
override fun onCreate(savedInstanceState: Bundle?) {
val prefs: SharedPreferences = requireActivity().getSharedPreferences(PREFS_USER,0)
user = prefs.getString(USER,"").toString()
@@ -75,16 +76,31 @@ class BuyersFragment : BaseFragment(Buyer
}
private fun setToolBar(){
- val listIcons:ArrayList = ArrayList()
- val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme())
- listIcons.add(iconReload)
- binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
- override fun onOptionsItemSelected(item: Drawable) {
- if (item == iconReload){
- binding.splashProgress.visibility= View.VISIBLE
- viewModel.itemShelvingBuyerGet(user = user,password = password,"itemShelving_BuyerGet")
+
+ val listIcons: ArrayList = ArrayList()
+ val iconReload = ImageView(context)
+ iconReload.setImageResource(R.drawable.ic_autorenew_black_24dp)
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ iconReload.tooltipText = getTooltip(R.drawable.ic_autorenew_black_24dp)
+
+ }
+ listIcons.add(iconReload)
+
+ /* val listIcons:ArrayList = ArrayList()
+ val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme())
+ listIcons.add(iconReload)*/
+
+ binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapterTooltip(listIcons,object: OnOptionsSelectedListener {
+ override fun onOptionsItemSelected(item: Drawable) {
+ when(item){
+ iconReload.drawable->{
+ binding.splashProgress.visibility= View.VISIBLE
+ viewModel.itemShelvingBuyerGet(user = user,password = password,"itemShelving_BuyerGet")
+ }
}
+
}
})
binding.mainToolbar.toolbarIcons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/BuyersViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/BuyersViewModel.kt
index 63abe38b..50376e3f 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/BuyersViewModel.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/BuyersViewModel.kt
@@ -7,6 +7,7 @@ import es.verdnatura.domain.GetQualityUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
+import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.view.feature.calidad.model.BuyerListVO
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
import es.verdnatura.presentation.view.feature.inventario.model.InventaryListVO
@@ -28,7 +29,7 @@ class BuyersViewModel(context: Context) : BaseViewModel() {
Callback> {
override fun onFailure(call: Call>, t: Throwable) {
val listError:ArrayList = ArrayList()
- listError.add(BuyerVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
+ listError.add(BuyerVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_buyersList.value = BuyerListVO(listError)
}
@@ -40,7 +41,7 @@ class BuyersViewModel(context: Context) : BaseViewModel() {
_buyersList.value = response.body()?.let { BuyerListVO(it) }
}else{
val listError:ArrayList = ArrayList()
- listError.add(BuyerVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,response.message())))
+ listError.add(BuyerVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),response.message())))
_buyersList.value = BuyerListVO(listError)
}
}
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/QaualityFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/QaualityFragment.kt
index fb77c17d..46c85b43 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/QaualityFragment.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/QaualityFragment.kt
@@ -3,9 +3,11 @@ package es.verdnatura.presentation.view.feature.calidad.fragment
import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
+import android.os.Build
import android.os.Bundle
import android.view.View
import android.view.inputmethod.EditorInfo
+import android.widget.ImageView
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
@@ -86,10 +88,20 @@ class QaualityFragment(
}
private fun setToolBar(){
- val listIcons:ArrayList = ArrayList()
+ /*val listIcons:ArrayList = ArrayList()
val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme())
listIcons.add(iconReload)
- binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
+*/
+ val listIcons: ArrayList = ArrayList()
+ val iconReload = ImageView(context)
+ iconReload.setImageResource(R.drawable.ic_autorenew_black_24dp)
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ iconReload.tooltipText = getTooltip(R.drawable.ic_autorenew_black_24dp)
+
+ }
+ listIcons.add(iconReload)
+ binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapterTooltip(listIcons,object: OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
if (item == iconReload){
binding.splashProgress.visibility = View.VISIBLE
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/QaualityViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/QaualityViewModel.kt
index ac7399b4..d6dd601d 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/QaualityViewModel.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/calidad/fragment/QaualityViewModel.kt
@@ -7,6 +7,7 @@ import es.verdnatura.domain.GetQualityUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
+import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.calidad.model.BuyerListVO
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
@@ -35,7 +36,7 @@ class QaualityViewModel(context: Context) : BaseViewModel() {
Callback> {
override fun onFailure(call: Call>, t: Throwable) {
val listError:ArrayList = ArrayList()
- listError.add(ItemBuyerVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
+ listError.add(ItemBuyerVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_buyersList.value = ItemBuyerListVO(listError)
}
@@ -47,7 +48,7 @@ class QaualityViewModel(context: Context) : BaseViewModel() {
_buyersList.value = response.body()?.let { ItemBuyerListVO(it) }
}else{
val listError:ArrayList = ArrayList()
- listError.add(ItemBuyerVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
+ listError.add(ItemBuyerVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_buyersList.value = ItemBuyerListVO(listError)
}
}
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 8646757a..3927d377 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
@@ -5,17 +5,15 @@ import android.graphics.Color
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
-import androidx.core.content.ContextCompat
import androidx.core.content.ContextCompat.getColor
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.R
import es.verdnatura.databinding.ItemArticleRowBinding
import es.verdnatura.domain.toast
+import es.verdnatura.presentation.common.*
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
import es.verdnatura.presentation.view.feature.sacador.model.SaleVO
-import android.graphics.drawable.GradientDrawable
-import es.verdnatura.presentation.common.*
class SaleAdapter(
@@ -25,36 +23,37 @@ class SaleAdapter(
private val onSaleClickListener: OnSaleClickListener,
private val onMistakeClickListener: OnMistakeClickListener,
private val onPackingClick: onPackingClickListener,
-): RecyclerView.Adapter () {
- var context:Context? = null
- var position:Int = 0
+) : RecyclerView.Adapter() {
+ var context: Context? = null
+ var position: Int = 0
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AjustesItemHolder {
this.context = parent.context
return AjustesItemHolder(
- ItemArticleRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
+ ItemArticleRowBinding.inflate(LayoutInflater.from(parent.context), parent, false)
)
}
- override fun getItemCount() =items.size
+ override fun getItemCount() = items.size
override fun onBindViewHolder(holder: AjustesItemHolder, position: Int) {
this.position = position
holder.bind(items[position])
}
- inner class AjustesItemHolder(
+ inner class AjustesItemHolder(
val binding: ItemArticleRowBinding
- ) : RecyclerView.ViewHolder(binding.root){
+ ) : RecyclerView.ViewHolder(binding.root) {
fun bind(sale: SaleVO) {
binding.apply {
if (sale.pickedQuantity.isNullOrEmpty())
sale.pickedQuantity = "0"
- val childLayoutManager = LinearLayoutManager(context!!, RecyclerView.HORIZONTAL, false)
+ val childLayoutManager =
+ LinearLayoutManager(context!!, RecyclerView.HORIZONTAL, false)
itemArticlePlacements.apply {
layoutManager = childLayoutManager
- adapter = PlacementAdapter(sale.placements,onPasillerosItemClickListener)
+ adapter = PlacementAdapter(sale.placements, onPasillerosItemClickListener)
}
//CLICK EVENTS
@@ -63,10 +62,14 @@ class SaleAdapter(
}
itemArticleItemFk.setOnClickListener {
- onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title = "Consultar artículo"),sale.itemFk)
+ onPasillerosItemClickListener.onPasillerosItemClickListener(
+ PasillerosItemVO(
+ title = "Consultar artículo"
+ ), sale.itemFk
+ )
}
- itemPackingItemFk.setOnClickListener{
+ itemPackingItemFk.setOnClickListener {
onPackingClick.onPackingClick(sale)
}
@@ -92,70 +95,147 @@ class SaleAdapter(
onMistakeClickListener.onMistakeClickListener(sale)
false
}*/
- imageErrorMessage.setOnClickListener{
- onMistakeClickListener.onMistakeClickListener(sale)
- false
- }
+ imageErrorMessage.setOnClickListener {
+ onMistakeClickListener.onMistakeClickListener(sale)
+ false
+ }
//ERROR
- if (sale.originalQuantity != sale.quantity){
+ if (sale.originalQuantity != sale.quantity) {
layoutError.visibility = View.VISIBLE
- txtError.text = "Cantidad original: "+sale.originalQuantity
+ txtError.text = "Cantidad original: " + sale.originalQuantity
if (sale.isPrepared == "1" || sale.isControlled == "1")
sale.pickedQuantity = sale.quantity
}
- if (sale.isNew){
+ if (sale.isNew) {
layoutError.visibility = View.VISIBLE
txtError.text = "Artículo nuevo"
}
- paintTicketcolor(sale.level,itemTicketColor)
+ paintTicketcolor(sale.level, itemTicketColor)
- if (!sale.isNew && sale.originalQuantity == sale.quantity){
+ if (!sale.isNew && sale.originalQuantity == sale.quantity) {
layoutError.visibility = View.GONE
}
//SEMAFORO
- if (sale.isPreviousPrepared == "1"){
- itemArticleRowSemaforoPre.setBackgroundColor(ContextCompat.getColor(context!!, R.color.verdnatura_dark_sky_blue))
- }else{
- itemArticleRowSemaforoPre.setBackgroundColor(ContextCompat.getColor(context!!, R.color.verdnatura_warm_grey))
+ if (sale.isPreviousPrepared == "1") {
+ itemArticleRowSemaforoPre.setBackgroundColor(
+ getColor(
+ context!!,
+ R.color.verdnatura_dark_sky_blue
+ )
+ )
+ } else {
+ itemArticleRowSemaforoPre.setBackgroundColor(
+ getColor(
+ context!!,
+ R.color.verdnatura_warm_grey
+ )
+ )
}
- if (sale.isPrepared == "1"){
- itemArticleRowSemaforoSac.setBackgroundColor(ContextCompat.getColor(context!!, R.color.verdnatura_pumpkin_orange))
- }else{
- itemArticleRowSemaforoSac.setBackgroundColor(ContextCompat.getColor(context!!, R.color.verdnatura_warm_grey))
- }
-
- if (sale.isControlled == "1"){
- itemArticleRowSemaforoCon.setBackgroundColor(ContextCompat.getColor(context!!, R.color.verdnatura_dark_mint))
- }else{
- itemArticleRowSemaforoCon.setBackgroundColor(ContextCompat.getColor(context!!, R.color.verdnatura_warm_grey))
+ if (sale.isPrepared == "1") {
+ itemArticleRowSemaforoSac.setBackgroundColor(
+ getColor(
+ context!!,
+ R.color.verdnatura_pumpkin_orange
+ )
+ )
+ } else {
+ itemArticleRowSemaforoSac.setBackgroundColor(
+ getColor(
+ context!!,
+ R.color.verdnatura_warm_grey
+ )
+ )
}
- if (sale.isControlled == "1"){
- contentLayout.setBackgroundColor(ContextCompat.getColor(context!!, R.color.verdnatura_dark_mint))
- }else if (sale.isPrepared == "1"){
- contentLayout.setBackgroundColor(ContextCompat.getColor(context!!, R.color.verdnatura_pumpkin_orange))
- }else if (sale.isPreviousPrepared == "1"){
- contentLayout.setBackgroundColor(ContextCompat.getColor(context!!, R.color.verdnatura_dark_sky_blue))
- }else{
- contentLayout.setBackgroundColor(ContextCompat.getColor(context!!, R.color.verdnatura_black))
+
+ if (sale.isControlled == "1") {
+ itemArticleRowSemaforoCon.setBackgroundColor(
+ getColor(
+ context!!,
+ R.color.verdnatura_dark_mint
+ )
+ )
+ } else {
+ itemArticleRowSemaforoCon.setBackgroundColor(
+ getColor(
+ context!!,
+ R.color.verdnatura_warm_grey
+ )
+ )
}
+ if (sale.isControlled == "1") {
+ contentLayout.setBackgroundColor(
+ getColor(
+ context!!,
+ R.color.verdnatura_dark_mint
+ )
+ )
+ } else if (sale.isPrepared == "1") {
+ contentLayout.setBackgroundColor(
+ getColor(
+ context!!,
+ R.color.verdnatura_pumpkin_orange
+ )
+ )
+ } /*else if (sale.isPreviousPrepared == "1") {
+ contentLayout.setBackgroundColor(
+ getColor(
+ context!!,
+ R.color.verdnatura_dark_sky_blue
+ )
+ )
+ }*/ else if (sale.isPreControlled == "1") {
+
+ contentLayout.setBackgroundColor(
+ 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(
+ context!!,
+ R.color.verdnatura_dark_sky_blue
+ )
+ )
+ } else {
+ contentLayout.setBackgroundColor(getColor(context!!, R.color.verdnatura_black))
+ }
+
//sergio: para de momento que pinten las lineas sin actualizar ni nada
- if (sale.isControlled == "2"){
- itemArticleRowSemaforoCon.setBackgroundColor(ContextCompat.getColor(context!!, R.color.verdnatura_white))
- contentLayout.setBackgroundColor(ContextCompat.getColor(context!!, R.color.verdnatura_dark_mint_light))
+ if (sale.isControlled == "2") {
+ itemArticleRowSemaforoCon.setBackgroundColor(
+ getColor(
+ context!!,
+ R.color.verdnatura_white
+ )
+ )
+ contentLayout.setBackgroundColor(
+ getColor(
+ context!!,
+ R.color.verdnatura_dark_mint_light
+ )
+ )
}
@@ -168,36 +248,47 @@ 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))
+ 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))
- "NEGRO"-> {itemTicketColor.setBackgroundColor(Color.BLACK)
- itemTicketColor.setBackgroundResource((R.drawable.border))}
- "VIOLETA"-> itemTicketColor.setBackgroundColor(0xFF4c2882.toInt())
- "GRIS"-> itemTicketColor.setBackgroundColor(Color.GRAY)
- "ORANGE"-> itemTicketColor.setBackgroundColor(getColor(context!!,android.R.color.holo_orange_light))
- "MORADO"-> itemTicketColor.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())
+ "NEGRO" -> {
+ itemTicketColor.setBackgroundColor(Color.BLACK)
+ itemTicketColor.setBackgroundResource((R.drawable.border))
+ }
+ "VIOLETA" -> itemTicketColor.setBackgroundColor(0xFF4c2882.toInt())
+ "GRIS" -> itemTicketColor.setBackgroundColor(Color.GRAY)
+ "ORANGE" -> itemTicketColor.setBackgroundColor(
+ getColor(
+ context!!,
+ android.R.color.holo_orange_light
+ )
+ )
+ "MORADO" -> itemTicketColor.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())
-
- else->{
+ else -> {
}
}
- // itemTicketColor.setBackgroundResource((R.drawable.rectangle))
+ // itemTicketColor.setBackgroundResource((R.drawable.rectangle))
}
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 a6456671..3d6a35f9 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
@@ -4,9 +4,12 @@ package es.verdnatura.presentation.view.feature.collection.fragment
import kotlinx.android.synthetic.main.fragment_collection.*
import kotlinx.android.synthetic.main.toolbar.**/
import android.content.Context
+import android.content.Intent
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
import android.media.MediaPlayer
+import android.net.Uri
+import android.os.Build
import android.os.Bundle
import android.speech.SpeechRecognizer
import android.util.Log
@@ -15,6 +18,7 @@ import android.view.View.GONE
import android.view.View.VISIBLE
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager
+import android.widget.ImageView
import android.widget.Toast
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
@@ -85,6 +89,10 @@ class CollectionFragment(
private var positionIncreaseQuantity = 0
private var positionReject = 0
private var quantityIncrease = ""
+ private var quantityReject = ""
+ private var typeCollectionMissing = ""
+ private var positionCollectionMissing = 0
+ private var quantityCollectionMissing = ""
private var isMarking = false
//private var myKM: KeyguardManager? = null
@@ -166,16 +174,8 @@ class CollectionFragment(
(activity as MainActivity).hideBottomNavigation(View.GONE)
if (binding.splashProgress != null) binding.splashProgress.visibility = VISIBLE
-
setEvents()
-
- if (type != PRECHECKER) {
- setToolBar()
- } else {
- binding.mainToolbar.toolbarSubtitle.visibility = View.VISIBLE
- binding.scanInput.visibility = View.GONE
- }
-
+ setToolBar()
if (type == SACADOR && voz != "NO") {
setSpeak()
@@ -200,47 +200,76 @@ class CollectionFragment(
binding.mainToolbar.toolbarTitle.text = collection.collectionFk
}
- val listIcons: ArrayList = ArrayList()
+ /* val listIcons: ArrayList = ArrayList()
val iconPrint: Drawable =
resources.getDrawable(R.drawable.ic_print_black_24dp, resources.newTheme())
- /*val iconSearch: Drawable =
- resources.getDrawable(R.drawable.ic_visibility, resources.newTheme())*/
val iconAdd: Drawable =
resources.getDrawable(R.drawable.ic_playlist_add_black_24dp, resources.newTheme())
val iconFace: Drawable =
resources.getDrawable(R.drawable.face_man_outline, resources.newTheme())
+ val iconPhone: Drawable =
+ resources.getDrawable(R.drawable.phone_call, resources.newTheme())
+ */
+ /*val iconSearch: Drawable =
+ resources.getDrawable(R.drawable.ic_visibility, resources.newTheme())*/
- /* val iconShelve:Drawable =
- resources.getDrawable(R.drawable.alpha_b_circle_outline, resources.newTheme())*/
- //listIcons.add(iconShelve)
+ 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 iconFace = ImageView(context)
+ iconFace.setImageResource(R.drawable.face_man_outline)
+ val iconPhone = ImageView(context)
+ iconPhone.setImageResource(R.drawable.phone_call)
+
+ 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)
+ }
+
+
+ if (type.equals("CHECKER")){
+ listIcons.add(iconPhone)
+ }
+
listIcons.add(iconFace)
listIcons.add(iconPrint)
- // listIcons.add(iconSearch)
listIcons.add(iconAdd)
+ //listIcons.add(iconSearch)
binding.mainToolbar.toolbarIcons.adapter =
- ToolBarAdapter(listIcons, object : OnOptionsSelectedListener {
+ ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
- if (item == iconPrint) {
- print()
- }/* else if (item == iconSearch) {
- showDisponibility()
- } */ else if (item == iconAdd) {
- addItem()
- } else if (item == iconFace) {
- showUser()
- }/*else if(item== iconShelve){
- ticketCollection_setUsedShelves()
- }*/
+
+ when (item){
+ iconPrint.drawable->print()
+ iconAdd.drawable->addItem()
+ iconFace.drawable->showUser()
+ iconPhone.drawable->getExtensionFromUser()
+ }
+
}
})
binding.mainToolbar.toolbarIcons.layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
}
+ private fun getExtensionFromUser() {
+
+
+ binding.splashProgress.visibility=VISIBLE
+ viewModel.sip_getExtension(user,password, workerFkFromTicket,"sip_getExtension")
+
+
+ }
+
private fun scanRequest() {
if (binding.scanInput != null) {
binding.scanInput.requestFocus()
@@ -306,8 +335,8 @@ class CollectionFragment(
isMarking = false
binding.collectionSwipe.isRefreshing = false
- if (type != PRECHECKER) {
- if (binding.splashProgress != null) binding.splashProgress.visibility = VISIBLE
+ // if (type != PRECHECKER) {
+ binding.splashProgress.visibility = VISIBLE
viewModel.collectionTicketGet(
user,
password,
@@ -316,7 +345,7 @@ class CollectionFragment(
type, "collection_getTickets"
)
binding.collectionSwipe.isRefreshing = false
- }
+ //}
}
}
@@ -491,15 +520,12 @@ class CollectionFragment(
if (it.isError) {
(activity as MainActivity).messageWithSound(it.errorMessage, isError = true)
- /* customDialog.setTitle("Error").setDescription(it.errorMessage)
- .setOkButton("Aceptar") {
- customDialog.dismiss()
- }.show()*/
+
} else {
- //incresaseSuccesful()
- /*FALTA RELLENAR*/
- TODO("FALTA ADAPTAR LA FUNCION MISSING()")
- // missingTrashSuccesful()
+
+ missingTrashSuccesful()
+
+
} //sergio:esto ya estaba
/* binding.splashProgress.visibility = View.VISIBLE
@@ -522,12 +548,25 @@ class CollectionFragment(
/* binding.splashProgress.visibility = View.VISIBLE
viewModel.collectionTicketGet(user,password,collection.collectionFk,sectorFk)*/
})
+ responseGetExtensionFromUserId.observe(viewLifecycleOwner, Observer {
+ binding.splashProgress.visibility=GONE
+
+ if (it.isError) {
+ (activity as MainActivity).messageWithSound(it.errorMessage+"Usuario:"+workerFkFromTicket, isError = true)
+
+ } else {
+
+ callPicker(it.response)
+ }
+
+ })
mistakeList.observe(viewLifecycleOwner, Observer {
- if (binding.splashProgress != null) binding.splashProgress.visibility = View.GONE
- if (!goBack) showMistakeList(it.list)
+ if (binding.splashProgress != null) binding.splashProgress.visibility = GONE
+ /*sergio:se quita esta comprobacion if (!goBack) */
+ showMistakeList(it.list)
goBack = false
})
//sergio: para si hay algun ticket por revisar
@@ -579,6 +618,22 @@ class CollectionFragment(
}
}
+ private fun callPicker(extensionNumber:String) {
+
+
+ try {
+ val intent = Intent(Intent.ACTION_DIAL).apply {
+ data = Uri.parse("tel:$extensionNumber")
+ }
+
+ startActivity(intent)
+ }catch (e:Exception){
+ d("VERDNATURA::"+e.message)
+ }
+
+
+ }
+
private fun getSalePerson(ticketFk: String): String {
var salePerson = ""
@@ -900,7 +955,7 @@ class CollectionFragment(
View.VISIBLE
storedPosition = 0
storedBackPosition = 0
- if (type != PRECHECKER) {
+ // if (type != PRECHECKER) {
isMarking = false
viewModel.collectionTicketGet(
user,
@@ -919,9 +974,9 @@ class CollectionFragment(
"ticketOrCollection_checkFullyControlled"
)
}
- } else {
- binding.splashProgress.visibility = View.GONE
- }
+ // } else {
+ // binding.splashProgress.visibility = View.GONE
+ //}
////Log.i("VERDNATURA:","La collection es ${txtscan}")
}
}
@@ -1003,9 +1058,10 @@ class CollectionFragment(
sales[position].isControlled = if (sales[position].isControlled == "1") "0" else "1"
if (type == PRECHECKER) {
- sales[position].isControlled =
+ 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
+ if (sales[position].isControlled == "1") "0" else "1"//sergio: para diferenciar precontrol en previa*/
}
saleAdapter!!.notifyDataSetChanged()
@@ -1051,9 +1107,9 @@ class CollectionFragment(
usuario = user,
password = password,
saleFk = sales[position].saleFk,
- vIsChecked = if (type == SACADOR) sales[position].isPrepared else if (type == CONTROLADOR || type == PRECHECKER) sales[position].isControlled 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") "PRECHECKED" else type,//type.toString(),
+ vStateFk = if (type == CONTROLADOR) "CHECKED" else if (type == "PRECHECKER") "PREVIOUS_CONTROL" else type,//type.toString(),
vBuyFk = originalItemScan,
callFunction = "saleTrackingReplace"
)
@@ -1311,31 +1367,7 @@ class CollectionFragment(
}
- /* private fun SalesSorter()
- {
- for (s in sales)
- {
- Log.i("VERDNATURA:","La sale del ticket ${s.ticketFk} es ${s.saleOrder}")
- for (p in s.placements){
- Log.i("VERDNATURA:","La sale del ticket ${s.saleOrder} es ${p.placement}")
- //s.placements=s.placements.sortedBy { it.saleOrder}.sortedByDescending { it.visible }
-
- s.placements=s.placements.sortedWith(compareBy({it.saleOrder})).sortedByDescending { it.visible }
-
- //sales = salesList.sortedWith(compareBy({it.saleOrder}))
-
- /* s.placements=s.placements.sortedWith ( compareBy(
- {it.visible.equals("0")}
- ))*/
- }
- }
-
- d("VERDNATURA","Ordenamos")
-
- binding.fragmentSacadorCollections.adapter?.notifyDataSetChanged()
-
- }*/
private fun checkItemScan(valueToCheck: String): Boolean {
@@ -1646,9 +1678,8 @@ class CollectionFragment(
private fun ticketCollection_setUsedShelves() {
- // Log.d("VERDNATURA::","la descrip es "+SectorDescription.first())
- if (type.equals("CHECKER") && isMarking && !SectorDescription.first().uppercaseChar()
- .equals('V')
+
+ if (type.equals("CHECKER") && (isMarking && SectorDescription.uppercase() != "ALGEMESI V")
) {
@@ -1782,7 +1813,6 @@ class CollectionFragment(
//FALTAS / BASURA / SPLIT
private fun showQuantityDialog(position: Int) {
- // //Log.i("VERDNATURA:","Aparece CustomDialog")
customDialogThreeButtons.setDescription(getString(R.string.txtnuevacantidad)).setValue("")
.setOkButton(getString(R.string.Faltas)) {
checkAndCall(
@@ -1804,26 +1834,13 @@ class CollectionFragment(
customDialogThreeButtons.getValue(),
getString(R.string.BasuraRechazar)
)
- /* if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) {
- getString(R.string.Indicanuevacantidad).toast(requireContext())
- } else {
- missing(position, customDialogThreeButtons.getValue())
- scanRequest()
- customDialogThreeButtons.dismiss()
- }*/
+
}.setOkButtonThree(getString(R.string.Reject)) {
checkAndCall(
position,
customDialogThreeButtons.getValue(),
getString(R.string.Reject)
)
- /* if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) {
- getString(R.string.Indicanuevacantidad).toast(requireContext())
- } else {
- reject(position, customDialogThreeButtons.getValue())
- scanRequest()
- customDialogThreeButtons.dismiss()
- }*/
}.setOkButtonFour(getString(R.string.Split)) {
checkAndCall(
@@ -1831,14 +1848,7 @@ class CollectionFragment(
customDialogThreeButtons.getValue(),
getString(R.string.Split)
)
- /*if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) {
- getString(R.string.Indicanuevacantidad).toast(requireContext())
- } else {
- split(position, customDialogThreeButtons.getValue())
- scanRequest()
- customDialogThreeButtons.dismiss()
- }*/
}.setOkButtonAdd(getString(R.string.Agregar)) {
checkAndCall(
@@ -1846,13 +1856,7 @@ class CollectionFragment(
customDialogThreeButtons.getValue(),
getString(R.string.Agregar)
)
- /* if (customDialogThreeButtons.getValue().trim().isNullOrEmpty()) {
- getString(R.string.Indicanuevacantidad).toast(requireContext())
- } else {
- increaseQuantity(position, customDialogThreeButtons.getValue())
- scanRequest()
- customDialogThreeButtons.dismiss()
- }*/
+
}.setKoButton("Cancelar") {
scanRequest()
customDialogThreeButtons.dismiss()
@@ -1866,9 +1870,9 @@ class CollectionFragment(
when (action) {
getString(R.string.Agregar) -> increaseQuantity(position, value)
- getString(R.string.BasuraRechazar) -> missing(position, value)
- getString(R.string.Faltas) -> trash(position, value)
- getString(R.string.Reject) -> reject(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.Split) -> split(position, value)
}
@@ -1913,7 +1917,40 @@ class CollectionFragment(
}
- private fun trash(position: Int, quantity: String) {
+ private fun TrashMissingReject(
+ position: Int,
+ quantity: String,
+ typeCollectionTrashMissingReject: String
+ ) {
+ typeCollectionMissing = typeCollectionTrashMissingReject
+ positionCollectionMissing = position
+ quantityCollectionMissing = 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 = typeCollectionTrashMissingReject,
+ originalQuantity = quantity,
+ callFunction = "collectionMissingTrash"
+ )
+ /* 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()
@@ -1927,15 +1964,15 @@ class CollectionFragment(
warehouseFk = warehouseFk,
type = "FALSE",
originalQuantity = quantity,
- callFunction = "saleMistake_Add"
+ 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)"
@@ -1980,12 +2017,15 @@ class CollectionFragment(
viewModel.sendChekingPresence(
token = token,
workerId = sales[position].salePersonFk,
- message = message, "sendChekingPresence"
+ 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()
@@ -2006,32 +2046,68 @@ class CollectionFragment(
//sales[position].startQuantity = quantity
- // saleAdapter!!.notifyDataSetChanged()
+ 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"
- )*/
- }
+ /* 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=""
+
+ sales[positionCollectionMissing].quantity = quantityCollectionMissing
saleAdapter!!.notifyDataSetChanged()
+ if (quantityCollectionMissing == "0")
+ markLine(positionCollectionMissing, type)
- val ticket =
- "[" + sales[positionReject].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionReject].ticketFk + "/summary)"
- val message =
- "Se ha modificado la cantidad original " + sales[positionReject].originalQuantity + " del artículo " + sales[positionReject].itemFk + " a nueva cantidad: " + sales[positionReject].quantity + " del ticket " + ticket
+ var totalQuantity: Int = 0
+ try {
+ totalQuantity = sales[positionCollectionMissing].originalQuantity.toInt() - quantityCollectionMissing.toInt()
+ } catch (e: Exception) {
+ }
- sendSalixMessageNew(ticket, message, sales[positionReject].salePersonFk)
+ saleAdapter!!.notifyDataSetChanged()
+
+ val ticket =
+ "[" + sales[positionCollectionMissing].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionCollectionMissing].ticketFk + "/summary)"
+
+
+ when (typeCollectionMissing){
+
+ "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
+ }
+ "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)
+
+ binding.splashProgress.visibility = VISIBLE
+ viewModel.collectionTicketGet(
+ user,
+ password,
+ collection.collectionFk,
+ sectorFk,
+ type,
+ "collection_getTickets"
+ )
}
@@ -2053,7 +2129,7 @@ class CollectionFragment(
val message =
"Se ha modificado la cantidad original " + sales[positionIncreaseQuantity].originalQuantity + " del artículo " + sales[positionIncreaseQuantity].itemFk + " a nueva cantidad: " + sales[positionIncreaseQuantity].quantity + " del ticket " + ticket
- sendSalixMessageNew(ticket, message, sales[positionIncreaseQuantity].salePersonFk)
+ sendSalixMessageNew(message, sales[positionIncreaseQuantity].salePersonFk)
/* val ticket =
"[" + sales[positionIncreaseQuantity].ticketFk + "](https://salix.verdnatura.es/#!/ticket/" + sales[positionIncreaseQuantity].ticketFk + "/summary)"
val message =
@@ -2068,12 +2144,12 @@ class CollectionFragment(
}
- private fun sendSalixMessageNew(ticket: String, message: String, workerId: String) {
+ private fun sendSalixMessageNew(message: String, workerId: String) {
viewModel.sendChekingPresence(
token = token,
workerId = workerId,
- message = message + ticket,
+ message = message,
"sendChekingPresence"
)
}
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 71a90c36..6853dbe1 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
@@ -6,10 +6,7 @@ import androidx.lifecycle.MutableLiveData
import es.verdnatura.domain.GetLoginUserCase
import es.verdnatura.domain.GetSacadorControladorUserCase
import es.verdnatura.domain.GetUbicadorUserCase
-import es.verdnatura.presentation.base.BaseViewModel
-import es.verdnatura.presentation.base.getMessageError
-import es.verdnatura.presentation.base.getMessageFromAllResponse
-import es.verdnatura.presentation.base.getMessageFromResponse
+import es.verdnatura.presentation.base.*
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.collection.ItemVO
import es.verdnatura.presentation.view.feature.collection.mapper.map
@@ -84,6 +81,11 @@ class CollectionViewModel(context: Context) : BaseViewModel()
val item: LiveData
get() = _item
+ private val _responseGetExtensionFromUserId by lazy { MutableLiveData() }
+ val responseGetExtensionFromUserId: LiveData
+ get() = _responseGetExtensionFromUserId
+
+
fun collectionTicketGet(
usuario: String,
password: String,
@@ -105,7 +107,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_collectionTicketList.value = CollectionVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@@ -121,7 +123,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_collectionTicketList.value = CollectionVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message()))
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}
}
})
@@ -153,7 +155,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@@ -163,7 +165,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message()))
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
} else
{
_response.value = ResponseItemVO(isError = false, response = response.body()!!)
@@ -194,7 +196,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
listError.add(
PlacementSupplyVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
)
_placementSuppleyList.value = PlacementSupplyListVO(listError)
@@ -214,7 +216,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
listError.add(
PlacementSupplyVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message())
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
)
_placementSuppleyList.value = PlacementSupplyListVO(listError)
@@ -243,7 +245,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@@ -253,7 +255,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message())
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@@ -279,7 +281,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
override fun onFailure(call: Call, t: Throwable)
{
- _response.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
+ _response.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call, response: Response)
@@ -288,7 +290,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message())
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@@ -316,7 +318,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
override fun onFailure(call: Call, t: Throwable)
{
- _responseUsedShelves.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
+ _responseUsedShelves.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call, response: Response)
@@ -325,7 +327,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_responseUsedShelves.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message())
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@@ -351,7 +353,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
override fun onFailure(call: Call, t: Throwable)
{
- _responseItem_updatePackingShelve.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
+ _responseItem_updatePackingShelve.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call, response: Response)
@@ -360,7 +362,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_responseItem_updatePackingShelve.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message())
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@@ -386,7 +388,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
override fun onFailure(call: Call, t: Throwable)
{
- _responseSaleGroup.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
+ _responseSaleGroup.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call, response: Response)
@@ -395,7 +397,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_responseSaleGroup.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message())
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@@ -414,7 +416,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_item.value = ItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@@ -424,7 +426,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_item.value = ItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message())
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@@ -456,7 +458,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_responseNew.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@@ -466,7 +468,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
if (!response.isSuccessful){
_responseNew.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message()))
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_responseNew.value =
ResponseItemVO(isError = false, response = response.body()!!)
@@ -477,7 +479,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_responseNew.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message())
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@@ -508,7 +510,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@@ -518,7 +520,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message()))
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
} else
{
@@ -552,7 +554,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_responseMissingTrash.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@@ -562,7 +564,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_responseMissingTrash.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message())
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@@ -581,7 +583,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@@ -591,7 +593,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message())
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@@ -611,7 +613,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@@ -622,7 +624,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message())
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@@ -647,7 +649,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
- errorMessage =getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@@ -657,7 +659,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message())
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@@ -677,7 +679,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_responseCode.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@@ -687,7 +689,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_responseCode.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message())
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@@ -717,7 +719,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_responseIncQuantity.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@@ -727,7 +729,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_responseIncQuantity.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message())
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@@ -788,7 +790,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
- errorMessage =getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@@ -801,7 +803,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message())
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@@ -843,6 +845,53 @@ class CollectionViewModel(context: Context) : BaseViewModel()
})
}
+
+
+ fun sip_getExtension(
+ usuario: String,
+ password: String,
+ workerId: String,
+ callFunction: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
+ )
+ {
+
+ if (response.body() != "false")
+ {
+ _responseGetExtensionFromUserId.value = ResponseItemVO(
+ isError = false,
+ response = response.body()!!,
+ errorMessage = ""
+ )
+ }else{
+ _responseGetExtensionFromUserId.value = ResponseItemVO(
+ isError = true,
+ response = response.body()!!,
+ errorMessage = "No se puede realizar la llamada. El usuario no tiene la extensión configurada. Solicítelo a informática.")
+ }
+ }
+ })
+ }
+
fun ticketOrCollection_checkFullyControlled(
usuario: String,
password: String,
@@ -860,7 +909,7 @@ class CollectionViewModel(context: Context) : BaseViewModel()
{
_responsecheckfully.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
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 1726c4d5..660c5efe 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
@@ -3,15 +3,16 @@ package es.verdnatura.presentation.view.feature.collection.fragment
import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
+import android.os.Build
import android.os.Bundle
import android.view.View
import android.view.View.GONE
import android.view.View.VISIBLE
import android.view.inputmethod.EditorInfo
+import android.widget.ImageView
import android.widget.Toast
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
-import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.R
import es.verdnatura.databinding.FragmentCollectionBinding
import es.verdnatura.domain.ConstAndValues.CONTROLADOR
@@ -29,7 +30,6 @@ import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
import es.verdnatura.presentation.view.feature.sacador.model.SaleVO
-import timber.log.Timber.d
class CollectionShowTicketFragment(
var collection: CollectionVO = CollectionVO(),
@@ -49,7 +49,7 @@ class CollectionShowTicketFragment(
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
private lateinit var customDialog: CustomDialog
private var tickets: ArrayList = ArrayList()
- private var state = 0
+
companion object {
fun newInstance(collection: CollectionVO, type: String) =
@@ -106,19 +106,28 @@ class CollectionShowTicketFragment(
binding.mainToolbar.toolbarSubtitle.visibility = VISIBLE
- val listIcons: ArrayList = ArrayList()
+ /*val listIcons: ArrayList = ArrayList()
val iconPrint: Drawable =
resources.getDrawable(R.drawable.ic_print_black_24dp, resources.newTheme())
listIcons.add(iconPrint)
+*/
+ val listIcons: ArrayList = ArrayList()
+ val iconPrint = ImageView(context)
+ iconPrint.setImageResource(R.drawable.ic_print_black_24dp)
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ iconPrint.tooltipText = getTooltip(R.drawable.ic_print_black_24dp)
+
+ }
+ listIcons.add(iconPrint)
binding.mainToolbar.toolbarIcons.adapter =
- ToolBarAdapter(listIcons, object : OnOptionsSelectedListener {
+ ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
- if (item == iconPrint) {
- print()
+ when (item){
+ iconPrint.drawable->print()}
}
- }
+
})
binding.mainToolbar.toolbarIcons.layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
@@ -219,30 +228,24 @@ class CollectionShowTicketFragment(
private fun createCollectionList() {
- state = 0
binding.mainToolbar.toolbarTitle.text = collection.collectionFk
-
binding.splashProgress.visibility = View.GONE
var salesList: ArrayList = ArrayList()
tickets = ArrayList()
var observations = ""
collection.tickets.forEach { ticket ->
ticket.sales.forEach { saleVO ->
- if (type == SACADOR && saleVO.quantity != "0") {
- salesList.add(saleVO)
- if (tickets.firstOrNull { it == saleVO.ticketFk }.isNullOrEmpty())
- tickets.add(saleVO.ticketFk)
- } else if (type == CONTROLADOR || type == PRECHECKER || type == VERTICKET) {
+ if (type == VERTICKET) {
salesList.add(saleVO)
if (tickets.firstOrNull { it == saleVO.ticketFk }.isNullOrEmpty())
tickets.add(saleVO.ticketFk)
+
}
+
+ observations = observations + " " + ticket.observations
}
-
- observations = observations + " " + ticket.observations
}
-
sales = salesList.sortedWith(compareBy({ it.saleOrder }))
saleAdapter =
@@ -284,39 +287,13 @@ class CollectionShowTicketFragment(
}
- /* private fun setListPosition(position: Int, isFromBack: Boolean) {
- storedPosition = position
- if (type == SACADOR) {
- if (binding.fragmentSacadorCollections != null) {
- binding.fragmentSacadorCollections.addViewObserver {
- lm!!.scrollToPositionWithOffset(position, 0)
- }
- }
-
- } else if (isFromBack) {
- if (binding.fragmentSacadorCollections != null) {
- binding.fragmentSacadorCollections.addViewObserver {
- lm!!.scrollToPositionWithOffset(position, 0)
- }
- }
- }
-
- }*/
-
private fun setTotalLines() {
var totalMark = 0
sales.forEach {
- if (type == SACADOR) {
- if (it.isPrepared == "1" || it.isControlled == "1" || it.isPreviousPrepared == "1") {
+
+ if (it.isControlled == "1")
totalMark += 1
- } else if (it.quantity == "0") {
- totalMark += 1
- }
- } else if (type == CONTROLADOR || type == PRECHECKER) {
- if (it.isControlled == "1" || it.isControlled == "2")
- totalMark += 1
- }
}
binding.mainToolbar.toolbarTitle.text =
collection.collectionFk
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/controlador/fragment/ControladorViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/controlador/fragment/ControladorViewModel.kt
index f2bd970b..6b374c9f 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/controlador/fragment/ControladorViewModel.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/controlador/fragment/ControladorViewModel.kt
@@ -8,6 +8,7 @@ import es.verdnatura.domain.GetSacadorControladorUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
+import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.collection.mapper.map
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
@@ -32,7 +33,7 @@ class ControladorViewModel(context: Context) : BaseViewModel() {
getSacadorControladorUserCase.collectionTicketGet(usuario,password,collectionFk,sectorFk,"0",type).enqueue(object :
Callback {
override fun onFailure(call: Call, t: Throwable) {
- _collectionTicketList.value = CollectionVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
+ _collectionTicketList.value = CollectionVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(
call: Call,
@@ -49,7 +50,7 @@ class ControladorViewModel(context: Context) : BaseViewModel() {
}else{
- _collectionTicketList.value = CollectionVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
+ _collectionTicketList.value = CollectionVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}
}
})
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoFragment.kt
index a36f37bd..3c6cb2bb 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoFragment.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoFragment.kt
@@ -3,11 +3,13 @@ package es.verdnatura.presentation.view.feature.controlvehiculo.fragment
import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
+import android.os.Build
import android.os.Bundle
import android.util.Log
import android.util.TypedValue
import android.view.View.*
import android.view.inputmethod.EditorInfo
+import android.widget.ImageView
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
@@ -105,12 +107,27 @@ class ControlVehiculoFragment(
binding.mainToolbar.toolbarTitle.text = getString(R.string.vehiclecontrol)
binding.mainToolbar.toolbarTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13F)
- val listIcons: ArrayList = ArrayList()
- val iconHistory: Drawable =
+ val listIcons: ArrayList = ArrayList()
+ /* val iconHistory: Drawable =
resources.getDrawable(R.drawable.ic_history_black_24dp, resources.newTheme())
val iconVehicleIn: Drawable = resources.getDrawable(R.drawable.car, resources.newTheme())
val iconVehicleOut: Drawable =
- resources.getDrawable(R.drawable.car_off, resources.newTheme())
+ resources.getDrawable(R.drawable.car_off, resources.newTheme())*/
+ val iconHistory = ImageView(context)
+ iconHistory.setImageResource(R.drawable.ic_history_black_24dp)
+ val iconVehicleIn = ImageView(context)
+ iconVehicleIn.setImageResource(R.drawable.car)
+ val iconVehicleOut = ImageView(context)
+ iconVehicleOut.setImageResource(R.drawable.car_off)
+
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+
+ iconHistory.tooltipText=getTooltip(R.drawable.ic_history_black_24dp)
+ iconVehicleIn.tooltipText=getTooltip(R.drawable.car)
+ iconVehicleOut.tooltipText=getTooltip(R.drawable.car_off)
+
+ }
@@ -131,19 +148,24 @@ class ControlVehiculoFragment(
}
- binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons, object : OnOptionsSelectedListener {
+ binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
- if (item == iconHistory) {
+ when (item){
+ iconHistory.drawable-> showScanner("Escanea matrícula para ver histórico", "HISTORY")
+ iconVehicleIn.drawable-> showScanner("Escanea matrícula del vehículo", "IN")
+ iconVehicleOut.drawable-> showScanner("Escanea matrícula para dejar vehículo", "OUT")
+ }
+ /* if (item == iconHistory.drawable) {
showScanner("Escanea matrícula para ver histórico", "HISTORY")
}
- if (item == iconVehicleIn) {
+ if (item == iconVehicleIn.drawable) {
showScanner("Escanea matrícula del vehículo", "IN")
}
- if (item == iconVehicleOut) {
+ if (item == iconVehicleOut.drawable) {
showScanner("Escanea matrícula para dejar vehículo", "OUT")
- }
+ }*/
}
})
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 767c6aa8..e520c1f8 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
@@ -8,6 +8,7 @@ import es.verdnatura.domain.GetVehicleControlTimeUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
+import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemMachineControl
import es.verdnatura.presentation.common.ResponseItemVO
@@ -42,7 +43,7 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
override fun onFailure(call: Call, t: Throwable) {
_responseinsert.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@@ -50,7 +51,7 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
if (response.body() == null || response.body().toString() == "false") {
_responseinsert.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message())
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else {
@@ -74,7 +75,7 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
override fun onFailure(call: Call, t: Throwable) {
_responseinsert.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@@ -82,7 +83,7 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
if (response.body() == null || response.body().toString() == "false") {
_responseinsert.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message())
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else {
//_response.value = ResponseItemVO(isError = false,response = response.body()!!)
@@ -104,7 +105,7 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
override fun onFailure(call: Call, t: Throwable) {
_responsecontrol.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@@ -112,7 +113,7 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
if (response.body() == null) {
_responsecontrol.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message())
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else {
_responsecontrol.value =
@@ -136,7 +137,7 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
// Log.i("VERDNATURA::","${t.message}")
_responsemachine.value = ResponseItemMachineControl(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!),
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!),
type = ""
)
}
@@ -172,7 +173,7 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
override fun onFailure(call: Call, t: Throwable) {
_responsemachine.value = ResponseItemMachineControl(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!),
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!),
type = ""
)
}
@@ -210,7 +211,7 @@ class ControlVehiculoViewModel(context: Context) : BaseViewModel() {
_responsemachine.value = ResponseItemMachineControl(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!),
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!),
type = ""
)
}
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 c6c6fd2b..a4567192 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
@@ -2,11 +2,10 @@ package es.verdnatura.presentation.view.feature.diadeventa.fragment
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
-import android.view.Gravity
+import android.os.Build
import android.view.View
import android.view.inputmethod.EditorInfo
-import android.widget.Toast
-import androidx.appcompat.widget.TooltipCompat
+import android.widget.ImageView
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
@@ -15,6 +14,7 @@ import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.domain.notNull
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnOptionsSelectedListener
+import es.verdnatura.presentation.common.ToolBarAdapterTooltip
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogList
import es.verdnatura.presentation.view.feature.diadeventa.adapter.DayOfSaleAdapter
@@ -63,20 +63,20 @@ class DayOfSaleFragment(
private fun setToolBar(title: String) {
binding.mainToolbar.toolbarTitle.text = title
+ val listIcons: ArrayList = ArrayList()
+ val iconParking = ImageView(context)
+ iconParking.setImageResource(R.drawable.ic_local_parking_black_24dp)
-
- val listIcons: ArrayList = ArrayList()
- val iconParking: Drawable =
- resources.getDrawable(R.drawable.ic_local_parking_black_24dp, resources.newTheme())
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ iconParking.tooltipText = getTooltip(R.drawable.ic_local_parking_black_24dp)
+ }
listIcons.add(iconParking)
-
-
- binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons, object : OnOptionsSelectedListener {
+ binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
- if (item == iconParking) {
+ if (item == iconParking.drawable) {
showParking()
}
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/diadeventa/fragment/DayOfSaleViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/diadeventa/fragment/DayOfSaleViewModel.kt
index 23f6fd83..314b2c38 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/diadeventa/fragment/DayOfSaleViewModel.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/diadeventa/fragment/DayOfSaleViewModel.kt
@@ -5,10 +5,7 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetDayOfSaleUSerCase
-import es.verdnatura.presentation.base.BaseViewModel
-import es.verdnatura.presentation.base.getMessageError
-import es.verdnatura.presentation.base.getMessageFromAllResponse
-import es.verdnatura.presentation.base.getMessageFromResponse
+import es.verdnatura.presentation.base.*
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.diadeventa.model.ItemShelvingSaleDate
@@ -40,7 +37,7 @@ class DayOfSaleViewModel(context: Context) : BaseViewModel() {
Callback> {
override fun onFailure(call: Call>, t: Throwable) {
val listError:ArrayList = ArrayList()
- listError.add(ItemShelvingSaleDate(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
+ listError.add(ItemShelvingSaleDate(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_itemShelvingSaleDateList.value = ItemShelvingSaleDateList(listError)
}
@@ -63,7 +60,7 @@ class DayOfSaleViewModel(context: Context) : BaseViewModel() {
val listError:ArrayList = ArrayList()
- listError.add(ItemShelvingSaleDate(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
+ listError.add(ItemShelvingSaleDate(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_itemShelvingSaleDateList.value = ItemShelvingSaleDateList(listError) }
}
}
@@ -150,19 +147,19 @@ class DayOfSaleViewModel(context: Context) : BaseViewModel() {
GetDayOfSaleUSerCase.shelvingPark(usuario,password,scanItem,parking).enqueue(object :
Callback {
override fun onFailure(call: Call, t: Throwable) {
- _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
+ _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(callFunction,response.message()))
+ _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
if (response.body() == "Finish")
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
else
- _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
+ _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}
}
})
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/faltas/fragment/FaltasFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/faltas/fragment/FaltasFragment.kt
index caf1f7c8..d9358bcf 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/faltas/fragment/FaltasFragment.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/faltas/fragment/FaltasFragment.kt
@@ -3,19 +3,18 @@ package es.verdnatura.presentation.view.feature.faltas.fragment
import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
+import android.os.Build
import android.os.Bundle
import android.view.View
import android.view.inputmethod.EditorInfo
+import android.widget.ImageView
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
import es.verdnatura.databinding.FragmentFaltasBinding
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.presentation.base.BaseFragment
-import es.verdnatura.presentation.common.OnFaltasNichoClickListener
-import es.verdnatura.presentation.common.OnFaltasReviewClickListener
-import es.verdnatura.presentation.common.OnOptionsSelectedListener
-import es.verdnatura.presentation.common.OnPasillerosItemClickListener
+import es.verdnatura.presentation.common.*
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogInput
import es.verdnatura.presentation.view.feature.faltas.adapter.FaltasAdapter
@@ -82,12 +81,19 @@ class FaltasFragment : BaseFragment(Falt
private fun setToolBar(){
- val listIcons:ArrayList = ArrayList()
- val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme())
+
+ val listIcons: ArrayList = ArrayList()
+ val iconReload = ImageView(context)
+ iconReload.setImageResource(R.drawable.ic_autorenew_black_24dp)
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ iconReload.tooltipText = getTooltip(R.drawable.ic_autorenew_black_24dp)
+
+ }
listIcons.add(iconReload)
- binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
+ binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapterTooltip(listIcons,object: OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
- if (item == iconReload){
+ if (item == iconReload.drawable){
binding.splashProgress.visibility = View.VISIBLE
viewModel.getFaltas(user,password,warehouseFk)
}
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/faltas/fragment/FaltasViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/faltas/fragment/FaltasViewModel.kt
index e5d88beb..e6c73fe0 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/faltas/fragment/FaltasViewModel.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/faltas/fragment/FaltasViewModel.kt
@@ -9,6 +9,7 @@ import es.verdnatura.domain.GetItemCardUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
+import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasListVO
@@ -65,12 +66,12 @@ class FaltasViewModel(context: Context) : BaseViewModel() {
getItemCardUserCase.itemStockUpdate(user,password,itemFk,warehouseFk,newValue,isTrash).enqueue(object :
Callback {
override fun onFailure(call: Call, t: Throwable) {
- _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
+ _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(callFunction,response.message()))
+ _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@@ -84,11 +85,11 @@ class FaltasViewModel(context: Context) : BaseViewModel() {
getInventaryUserCase.faultsReview_isChecked(user,password,itemFk,warehouseFk).enqueue(object :
Callback {
override fun onFailure(call: Call, t: Throwable) {
- _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
+ _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(callFunction,response.message()))
+ _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/historicoarticulo/fragment/HistoricoArticuloFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/historicoarticulo/fragment/HistoricoArticuloFragment.kt
index cf4771f9..48ad1714 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/historicoarticulo/fragment/HistoricoArticuloFragment.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/historicoarticulo/fragment/HistoricoArticuloFragment.kt
@@ -12,7 +12,9 @@ import android.content.res.ColorStateList
import android.graphics.Color
import android.graphics.Color.*
import android.graphics.drawable.Drawable
+import android.os.Build
import android.view.View
+import android.widget.ImageView
import androidx.core.content.ContextCompat.getColor
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
@@ -25,6 +27,7 @@ import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
import es.verdnatura.domain.notNull
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnOptionsSelectedListener
+import es.verdnatura.presentation.common.ToolBarAdapterTooltip
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogInput
import es.verdnatura.presentation.view.feature.historicoarticulo.adapter.HistoricoAdapter
@@ -99,37 +102,47 @@ class HistoricoArticuloFragment(
}
private fun setToolBar() {
- val listIcons: ArrayList = ArrayList()
+ /* val listIcons: ArrayList = ArrayList()
val iconReload: Drawable =
resources.getDrawable(R.drawable.ic_transaction, resources.newTheme())
val iconGargabe: Drawable =
resources.getDrawable(R.drawable.alpha_b_circle_outline, resources.newTheme())
val iconFault: Drawable =
- resources.getDrawable(R.drawable.alpha_f_circle_outline, resources.newTheme())
+ resources.getDrawable(R.drawable.alpha_f_circle_outline, resources.newTheme())*/
+
+ val listIcons: ArrayList = ArrayList()
+ val iconReload = ImageView(context)
+ iconReload.setImageResource(R.drawable.ic_transaction)
+ val iconGargabe = ImageView(context)
+ iconGargabe.setImageResource(R.drawable.alpha_b_circle_outline)
+ val iconFault = ImageView(context)
+ iconFault.setImageResource(R.drawable.alpha_f_circle_outline)
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ iconReload.tooltipText = getTooltip(R.drawable.ic_transaction)
+ iconGargabe.tooltipText = getTooltip(R.drawable.alpha_b_circle_outline)
+ iconFault.tooltipText = getTooltip(R.drawable.alpha_f_circle_outline)
+ }
listIcons.add(iconGargabe)
listIcons.add(iconFault)
listIcons.add(iconReload)
- binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons, object : OnOptionsSelectedListener {
+ binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
-
- if (item == iconReload) {
+ when (item){
+ iconReload.drawable->viewModelwithFilter("all")
+ iconGargabe.drawable->{
+ viewModelwithFilter("contenedor")
+ item.setTint(getColor(context!!, verdnatura_pumpkin_orange))}
+ iconFault.drawable->viewModelwithFilter("falta")
+ }
+ /* if (item == iconReload) {
binding.splashProgress.visibility = View.VISIBLE
viewModelwithFilter("all")
- // TooltipCompat.setTooltipText(view!!, "Recarga");
- // view?.let { TooltipCompat.setTooltipText(it, "Recarga") };
- /* val mytoast = Toast.makeText(
- context,
- "Toast Message",
- Toast.LENGTH_SHORT
- )
- mytoast.setGravity(Gravity.TOP or Gravity.RIGHT, 0, -100)
- mytoast.show()*/
-
}
@@ -143,11 +156,10 @@ class HistoricoArticuloFragment(
binding.splashProgress.visibility = View.VISIBLE
viewModelwithFilter("falta")
-
- }
+ }*/
for (it in listIcons) {
if (it != item) {
- it.setTint(getColor(context!!, verdnatura_white))
+ it.drawable.setTint(getColor(context!!, verdnatura_white))
}
}
item.setTint(getColor(context!!, verdnatura_pumpkin_orange))
@@ -162,6 +174,7 @@ class HistoricoArticuloFragment(
private fun viewModelwithFilter(keyfilter: String) {
filter = keyfilter
+ binding.splashProgress.visibility = View.VISIBLE
viewModel.itemDiary(user, password, itemFk, warehouseFk,"itemDiary")
}
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/historicoarticulo/fragment/HistoricoArticuloViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/historicoarticulo/fragment/HistoricoArticuloViewModel.kt
index 854792e6..b03aa2d8 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/historicoarticulo/fragment/HistoricoArticuloViewModel.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/historicoarticulo/fragment/HistoricoArticuloViewModel.kt
@@ -7,6 +7,7 @@ import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetItemCardUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageFromAllResponse
+import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoListVO
import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoVO
@@ -32,7 +33,7 @@ class HistoricoArticuloViewModel(context: Context) : BaseViewModel() {
Callback> {
override fun onFailure(call: Call>, t: Throwable) {
val listError:ArrayList = ArrayList()
- listError.add(ItemHistoricoVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
+ listError.add(ItemHistoricoVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_historicoList.value = ItemHistoricoListVO(listError)
}
@@ -44,7 +45,7 @@ class HistoricoArticuloViewModel(context: Context) : BaseViewModel() {
_historicoList.value = response.body()?.let { ItemHistoricoListVO(it) }
}else{
val listError:ArrayList = ArrayList()
- listError.add(ItemHistoricoVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
+ listError.add(ItemHistoricoVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_historicoList.value = ItemHistoricoListVO(listError)
}
}
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/historicoshelving/fragment/ItemShelvingLogViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/historicoshelving/fragment/ItemShelvingLogViewModel.kt
index 02ae9b43..cc53444f 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/historicoshelving/fragment/ItemShelvingLogViewModel.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/historicoshelving/fragment/ItemShelvingLogViewModel.kt
@@ -8,6 +8,7 @@ import androidx.lifecycle.Transformations
import es.verdnatura.domain.itemShelvingLogUSerCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageFromAllResponse
+import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ResponseItemVO
@@ -37,7 +38,7 @@ class itemShelvingLogViewModel(context: Context) : BaseViewModel() {
Callback> {
override fun onFailure(call: Call>, t: Throwable) {
val listError:ArrayList = ArrayList()
- listError.add(ItemShelvingLog(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!)))
+ listError.add(ItemShelvingLog(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_itemShelvingLogList.value = ItemShelvingLogList(listError)
}
@@ -48,7 +49,7 @@ class itemShelvingLogViewModel(context: Context) : BaseViewModel() {
if (!response.isSuccessful){
val listError:ArrayList = ArrayList()
- listError.add(ItemShelvingLog(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
+ listError.add(ItemShelvingLog(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_itemShelvingLogList.value = ItemShelvingLogList(listError)
}else{
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/historicoshelvinglog/fragment/shelvingLogViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/historicoshelvinglog/fragment/shelvingLogViewModel.kt
index a468baf3..b95a3e6f 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/historicoshelvinglog/fragment/shelvingLogViewModel.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/historicoshelvinglog/fragment/shelvingLogViewModel.kt
@@ -7,6 +7,7 @@ import androidx.lifecycle.Transformations
import es.verdnatura.domain.itemShelvingLogUSerCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageFromAllResponse
+import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLog
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLogList
@@ -30,7 +31,7 @@ class shelvingLogViewModel(context: Context) : BaseViewModel() {
Callback> {
override fun onFailure(call: Call>, t: Throwable) {
val listError:ArrayList = ArrayList()
- listError.add(ShelvingLog(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!)))
+ listError.add(ShelvingLog(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_itemShelvingLogList.value = ShelvingLogList(listError)
}
@@ -41,7 +42,7 @@ class shelvingLogViewModel(context: Context) : BaseViewModel() {
if (!response.isSuccessful){
val listError:ArrayList = ArrayList()
- listError.add(ShelvingLog(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
+ listError.add(ShelvingLog(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_itemShelvingLogList.value = ShelvingLogList(listError)
}else{
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 1bf4c569..935a04aa 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
@@ -6,6 +6,7 @@ import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetVehicleControlTimeUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageFromAllResponse
+import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculo
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculoList
@@ -29,7 +30,7 @@ class HistoricoVehiculoViewModel (context: Context) : BaseViewModel() {
Callback> {
override fun onFailure(call: Call>, t: Throwable) {
val listError:ArrayList = ArrayList()
- listError.add(ItemHistoricoVehiculo(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
+ listError.add(ItemHistoricoVehiculo(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_historicovehiculoList.value = ItemHistoricoVehiculoList(listError)
}
@@ -42,7 +43,7 @@ class HistoricoVehiculoViewModel (context: Context) : BaseViewModel() {
_historicovehiculoList.value = response.body()?.let { ItemHistoricoVehiculoList(it) }
}else{
val listError:ArrayList = ArrayList()
- listError.add(ItemHistoricoVehiculo(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
+ 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/adapter/ToolBarAdapter.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/adapter/ToolBarAdapter.kt
index c4cdb4e8..94cbbb98 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/adapter/ToolBarAdapter.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/adapter/ToolBarAdapter.kt
@@ -1,8 +1,10 @@
package es.verdnatura.presentation.view.feature.inventario.adapter
import android.graphics.drawable.Drawable
+import android.os.Build
import android.view.LayoutInflater
import android.view.ViewGroup
+import androidx.annotation.RequiresApi
import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.databinding.ItemToolbarRowBinding
import es.verdnatura.presentation.common.OnOptionsSelectedListener
@@ -13,6 +15,8 @@ class ToolBarAdapter (
): RecyclerView.Adapter () {
+
+
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
return ItemHolder(
ItemToolbarRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
@@ -21,21 +25,29 @@ class ToolBarAdapter (
override fun getItemCount() =items.size
+ @RequiresApi(Build.VERSION_CODES.O)
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
holder.bind(items[position])
+
+
}
inner class ItemHolder(
val binding: ItemToolbarRowBinding
) : RecyclerView.ViewHolder(binding.root){
private val res = binding.root.context.resources
+ @RequiresApi(Build.VERSION_CODES.O)
fun bind(item: Drawable) {
binding.apply {
imagebuttonIcon.setImageDrawable(item)
- imagebuttonIcon.setOnClickListener {
+ imagebuttonIcon.setOnClickListener {
onOptionsSelectedListener.onOptionsItemSelected(item)
}
+
}
}
}
-}
\ No newline at end of file
+}
+
+
+
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryFragment.kt
index 79764bd7..e1d59d27 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryFragment.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryFragment.kt
@@ -3,8 +3,10 @@ package es.verdnatura.presentation.view.feature.inventario.fragment
import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
+import android.os.Build
import android.os.Bundle
import android.view.View
+import android.widget.ImageView
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
@@ -13,6 +15,7 @@ import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnInvetoryNichoClickListener
import es.verdnatura.presentation.common.OnOptionsSelectedListener
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
+import es.verdnatura.presentation.common.ToolBarAdapterTooltip
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogInput
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
@@ -125,14 +128,20 @@ class InventaryFragment : BaseFragment = ArrayList()
- val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme())
+ val listIcons: ArrayList = ArrayList()
+ val iconReload = ImageView(context)
+ iconReload.setImageResource(R.drawable.ic_autorenew_black_24dp)
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ iconReload.tooltipText = getTooltip(R.drawable.ic_autorenew_black_24dp)
+
+ }
listIcons.add(iconReload)
- binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener{
+ binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapterTooltip(listIcons,object: OnOptionsSelectedListener{
override fun onOptionsItemSelected(item: Drawable) {
- if (item == iconReload){
+ if (item == iconReload.drawable){
binding.splashProgress.visibility = View.VISIBLE
firstVisiblePosition = layoutManager?.findFirstVisibleItemPosition() ?: 0
viewModel.getInventory(user,password,buyerId,warehouseFk,"itemShelving_filterBuyer")
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 68ca7abd..da7dfa2f 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
@@ -9,6 +9,7 @@ import es.verdnatura.domain.GetItemCardUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
+import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.calidad.model.BuyerListVO
@@ -46,7 +47,7 @@ class InventaryViewModel(context: Context) : BaseViewModel() {
Callback> {
override fun onFailure(call: Call>, t: Throwable) {
val listError:ArrayList = ArrayList()
- listError.add(BuyerVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
+ listError.add(BuyerVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_buyersList.value = BuyerListVO(listError)
}
@@ -59,7 +60,7 @@ class InventaryViewModel(context: Context) : BaseViewModel() {
}else{
val listError:ArrayList = ArrayList()
listError.add(BuyerVO(isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message())))
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_buyersList.value = BuyerListVO(listError)
}
}
@@ -104,7 +105,7 @@ class InventaryViewModel(context: Context) : BaseViewModel() {
Callback> {
override fun onFailure(call: Call>, t: Throwable) {
val listError:ArrayList = ArrayList()
- listError.add(ItemInventaryVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!)))
+ listError.add(ItemInventaryVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_inventaryList.value = InventaryListVO(listError)
}
@@ -116,7 +117,7 @@ class InventaryViewModel(context: Context) : BaseViewModel() {
_inventaryList.value = response.body()?.let { InventaryListVO(it) }
}else{
val listError:ArrayList = ArrayList()
- listError.add(ItemInventaryVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
+ listError.add(ItemInventaryVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_inventaryList.value = InventaryListVO(listError)
}
@@ -157,12 +158,12 @@ class InventaryViewModel(context: Context) : BaseViewModel() {
override fun onFailure(call: Call, t: Throwable) {
- _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
+ _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(callFunction,response.message()))
+ _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
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 f0d942ba..0143437e 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
@@ -131,7 +131,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
user,
password,
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message())
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
}
@@ -146,7 +146,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
password,
"",
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
_loginsalixitem.value = loginSalixVO
}
@@ -170,7 +170,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
{
loginDevice = LoginDevice(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message()))
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
} else
@@ -192,7 +192,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
{
loginDevice = LoginDevice(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message())
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
}
}
@@ -206,7 +206,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
"",
"",
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
_logindevice.value = loginDevice
}
@@ -239,7 +239,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
{
workerId = workerId(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message())
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
}
@@ -251,7 +251,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
val workerId =
workerId(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
_workerId.value = workerId
}
@@ -290,7 +290,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
{
_devicelogresponse.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,message)
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),message)
)
}
@@ -342,7 +342,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
user,
password,
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message())
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
}
_versionappitem.value = versionApp
@@ -356,7 +356,7 @@ class LoginViewModel(context: Context) : BaseViewModel()
nameApp,
"",
isError = true,
- errorMessage =getMessageFromAllResponse(callFunction, t.message!!)
+ errorMessage =getMessageFromAllResponse(nameofFunction(this), t.message!!)
)
_versionappitem.value = versionApp
}
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 1b4e0092..5b9df0cc 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
@@ -47,7 +47,7 @@ import es.verdnatura.presentation.view.feature.parking.fragment.ParkingSaleFragm
import es.verdnatura.presentation.view.feature.pasillero.fragment.PasilleroFragment
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
import es.verdnatura.presentation.view.feature.precontrol.PreControladorFragment
-import es.verdnatura.presentation.view.feature.precontrol.ShowTicketFragment
+import es.verdnatura.presentation.view.feature.showticket.ShowTicketFragment
import es.verdnatura.presentation.view.feature.presacador.fragment.PreSacadorFragment
import es.verdnatura.presentation.view.feature.qr.QrFragment
import es.verdnatura.presentation.view.feature.reposicion.fragment.ReposicionFragment
@@ -249,7 +249,11 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL
ControladorFragment.TAG,
false
)
-
+ /*addFragment(
+ CollectionFragment.newInstance(type = "CHECKER", collection = CollectionVO()),
+ R.id.main_frame_layout,
+ ControladorFragment.TAG,
+ false)*/
// true
}
getString(R.string.Paletizadores) -> {
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailViewModel.kt
index b1f2cbc1..2cc90077 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailViewModel.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletDetailViewModel.kt
@@ -8,6 +8,7 @@ import es.verdnatura.domain.GetPaletizadoresUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
+import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletViewListVO
@@ -32,7 +33,7 @@ class ExpeditionPalletDetailViewModel(context: Context): BaseViewModel() {
Callback> {
override fun onFailure(call: Call>, t: Throwable) {
val listError:ArrayList = ArrayList()
- listError.add(ItemPalletViewVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
+ listError.add(ItemPalletViewVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_expeditionPalletList.value = ItemPalletViewListVO(listError)
}
@@ -44,7 +45,7 @@ class ExpeditionPalletDetailViewModel(context: Context): BaseViewModel() {
_expeditionPalletList.value = response.body()?.let { ItemPalletViewListVO(it) }
}else{
val listError:ArrayList = ArrayList()
- listError.add(ItemPalletViewVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
+ listError.add(ItemPalletViewVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_expeditionPalletList.value = ItemPalletViewListVO(listError)
}
}
@@ -55,11 +56,11 @@ class ExpeditionPalletDetailViewModel(context: Context): BaseViewModel() {
fun expeditionPalletDel(usuario:String,password:String,vPalletFk:String,callFunction:String){
getPaletizadoresUserCase.expeditionPalletDel(usuario,password,vPalletFk).enqueue(object : Callback{
override fun onFailure(call: Call, t: Throwable) {
- _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
+ _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(callFunction,response.message()))
+ _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@@ -75,11 +76,11 @@ class ExpeditionPalletDetailViewModel(context: Context): BaseViewModel() {
getPaletizadoresUserCase.expeditionPalletPrintSet(usuario,password,vPalletFk,vSectorFk).enqueue(object : Callback{
override fun onFailure(call: Call, t: Throwable) {
- _response.value = ResponseItemVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!))
+ _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(callFunction,response.message()))
+ _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletViewModel.kt
index 735602d7..ffc2cb50 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletViewModel.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionPalletViewModel.kt
@@ -8,6 +8,7 @@ import es.verdnatura.domain.GetPaletizadoresUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
+import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletListVO
@@ -46,7 +47,7 @@ class ExpeditionPalletViewModel (context: Context) : BaseViewModel() {
Callback> {
override fun onFailure(call: Call>, t: Throwable) {
val listError:ArrayList = ArrayList()
- listError.add(ItemPalletVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
+ listError.add(ItemPalletVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_expeditionPalletList.value = ItemPalletListVO(listError)
}
@@ -58,7 +59,7 @@ class ExpeditionPalletViewModel (context: Context) : BaseViewModel() {
_expeditionPalletList.value = response.body()?.let { ItemPalletListVO(it) }
}else{
val listError:ArrayList = ArrayList()
- listError.add(ItemPalletVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
+ listError.add(ItemPalletVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_expeditionPalletList.value = ItemPalletListVO(listError)
}
}
@@ -71,7 +72,7 @@ class ExpeditionPalletViewModel (context: Context) : BaseViewModel() {
Callback> {
override fun onFailure(call: Call>, t: Throwable) {
val listError:ArrayList = ArrayList()
- listError.add(ItemScanVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!)))
+ listError.add(ItemScanVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_scanList.value = ItemScanList(listError)
}
@@ -83,7 +84,7 @@ class ExpeditionPalletViewModel (context: Context) : BaseViewModel() {
_scanList.value = response.body()?.let { ItemScanList(it) }
}else{
val listError:ArrayList = ArrayList()
- listError.add(ItemScanVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
+ listError.add(ItemScanVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_scanList.value = ItemScanList(listError)
}
}
@@ -94,11 +95,11 @@ class ExpeditionPalletViewModel (context: Context) : BaseViewModel() {
fun expeditionScanPut(usuario:String,password:String,vPalletFk:String,vExpeditionFk:String,callFunction:String){
getPaletizadoresUserCase.expeditionScanPut(usuario,password,vPalletFk,vExpeditionFk).enqueue(object : Callback{
override fun onFailure(call: Call, t: Throwable) {
- _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
+ _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(callFunction,response.message()))
+ _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
@@ -109,11 +110,11 @@ class ExpeditionPalletViewModel (context: Context) : BaseViewModel() {
fun checkRouteExpeditionScanPut(usuario:String,password:String,vPalletFk:String,vExpeditionFk:String,callFunction:String){
getPaletizadoresUserCase.checkRouteExpeditionScanPut(usuario,password,vPalletFk,vExpeditionFk).enqueue(object : Callback{
override fun onFailure(call: Call, t: Throwable) {
- _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
+ _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call, response: Response) {
if (response.body() == null){
- _responseCheckexpeditionScanPut.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
+ _responseCheckexpeditionScanPut.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_responseCheckexpeditionScanPut.value = ResponseItemVO(isError = false,response = response.body()!!)
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanSorterViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanSorterViewModel.kt
index e2379b2d..e99c6d3d 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanSorterViewModel.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionScanSorterViewModel.kt
@@ -7,6 +7,7 @@ import es.verdnatura.domain.GetPaletizadoresUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
+import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO
import retrofit2.Call
import retrofit2.Callback
@@ -25,7 +26,7 @@ class ExpeditionScanSorterViewModel(context: Context) : BaseViewModel() {
GetPaletizadoresUserCase.expedition_scan(usuario,password,vExpeditionId).enqueue(object : Callback{
override fun onFailure(call: Call, t: Throwable) {
- _responsescan.value = messageError(getMessageFromAllResponse(callFunction,t.message!!),"expedition_scan")
+ _responsescan.value = messageError(getMessageFromAllResponse(nameofFunction(this),t.message!!),"expedition_scan")
}
override fun onResponse(call: Call, response: Response) {
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionStateViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionStateViewModel.kt
index b098ca9b..56d53f32 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionStateViewModel.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionStateViewModel.kt
@@ -14,6 +14,7 @@ import es.verdnatura.domain.GetPaletizadoresUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
+import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingTypeList
@@ -105,7 +106,7 @@ class ExpeditionStateViewModel(context: Context) : BaseViewModel() {
_itemexpedition.value = itemExpedetionState(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!), list= listProperties
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!), list= listProperties
)
}
@@ -131,7 +132,7 @@ class ExpeditionStateViewModel(context: Context) : BaseViewModel() {
} else {
_itemexpedition.value = itemExpedetionState(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message()),list = listProperties
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()),list = listProperties
)
}
}
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionTruckListViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionTruckListViewModel.kt
index 1faa4d99..eaccb812 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionTruckListViewModel.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/paletizador/fragment/ExpeditionTruckListViewModel.kt
@@ -8,6 +8,7 @@ import es.verdnatura.domain.GetPaletizadoresUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
+import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemExpeditionTruckList
@@ -34,7 +35,7 @@ class ExpeditionTruckListViewModel(context: Context) : BaseViewModel() {
Callback> {
override fun onFailure(call: Call>, t: Throwable) {
val listError:ArrayList = ArrayList()
- listError.add(ItemExpeditionTruckVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!)))
+ listError.add(ItemExpeditionTruckVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_expeditionTruckList.value = ItemExpeditionTruckList(listError)
}
@@ -46,7 +47,7 @@ class ExpeditionTruckListViewModel(context: Context) : BaseViewModel() {
_expeditionTruckList.value = response.body()?.let { ItemExpeditionTruckList(it) }
}else{
val listError:ArrayList = ArrayList()
- listError.add(ItemExpeditionTruckVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message())))
+ listError.add(ItemExpeditionTruckVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())))
_expeditionTruckList.value = ItemExpeditionTruckList(listError)
}
}
@@ -57,12 +58,12 @@ class ExpeditionTruckListViewModel(context: Context) : BaseViewModel() {
fun expeditionTruckAdd(usuario:String,password:String,vHour:String,vDescription:String,callFunction:String){
getPaletizadoresUserCase.expeditionTruckAdd(usuario,password,vHour,vDescription).enqueue(object : Callback{
override fun onFailure(call: Call, t: Throwable) {
- _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
+ _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(callFunction,response.message()))
+ _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/parking/fragment/ParkingViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/parking/fragment/ParkingViewModel.kt
index 424867d5..226e4d68 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/parking/fragment/ParkingViewModel.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/parking/fragment/ParkingViewModel.kt
@@ -9,6 +9,7 @@ import es.verdnatura.domain.GetUbicadorUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
+import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO
import retrofit2.Call
import retrofit2.Callback
@@ -43,18 +44,18 @@ class ParkingViewModel(context: Context) : BaseViewModel() {
getUbicadorUserCase.shelvingPark(usuario,password,scanItem,parking).enqueue(object :
Callback {
override fun onFailure(call: Call, t: Throwable) {
- _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
+ _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call, response: Response) {
ProgressLoading(GONE)
if (response.body() == null){
- _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
+ _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
if (response.body() == "Finish")
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
else
- _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
+ _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}
}
})
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/parkingSale/fragment/ParkingSaleFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/parkingSale/fragment/ParkingSaleFragment.kt
index e7674aa4..925d74cf 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/parkingSale/fragment/ParkingSaleFragment.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/parkingSale/fragment/ParkingSaleFragment.kt
@@ -44,8 +44,6 @@ class ParkingSaleFragment : BaseFragment {
override fun onFailure(call: Call, t: Throwable) {
- _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
+ _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call, response: Response) {
ProgressLoading(GONE)
if (response.body() == null){
- _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
+ _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}else{
if (response.body() == "Finish")
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
else
- _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
+ _response.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}
}
})
@@ -74,7 +75,7 @@ class ParkingSaleViewModel(context: Context) : BaseViewModel() {
{
_responseParkingAdd.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@@ -84,7 +85,7 @@ class ParkingSaleViewModel(context: Context) : BaseViewModel() {
{
_responseParkingAdd.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message())
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
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 0cc79721..001e8ed3 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
@@ -1,6 +1,7 @@
package es.verdnatura.presentation.view.feature.pasillero.adapter
import android.content.Context
+import android.os.Build
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
@@ -40,6 +41,10 @@ class PasillerosAdapter (
this.item = item
this.title = context?.getString(item.titleToShow)
itemImage.setImageResource(item.iconResource)
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ itemImage.tooltipText=item.description
+ }
}
}
}
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 912de24c..e339d89e 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
@@ -30,12 +30,8 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
*/
- /* _pasillerositem.add(
- PasillerosItemVO(7,
- R.drawable.ic_streetview_black_24dp,
- "Pre Control",R.string.precontrolprevious)
- )
-*/
+
+
//sergio para que aparezca el nuevo menu
@@ -44,52 +40,23 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
7,
R.drawable.ic_streetview_black_24dp,
- "Pre Sacador", R.string.PreSacador
+ "Pre Sacador", R.string.PreSacador,"Carga un ticket de previa para sacarlo"
)
)
+ //precontrol
+ _pasillerositem.add(
+ PasillerosItemVO(7,
+ R.drawable.ic_verified_user_black_24dp_selected,
+ "Pre Control",R.string.precontrolprevious,"Sirve para revisar un ticket de previa"
+ )
+ )
+
//sergio para que aparezca el nuevo menu
_pasillerositem.add(
PasillerosItemVO(
10,
R.drawable.ic_visibility_black_24dp,
- "Ver Ticket", R.string.verticket
- )
- )
-
- _pasillerositem.add(
- PasillerosItemVO(
- 41,
- R.drawable.day_of_sale,
- "Día de venta", R.string.dayofSale
- )
- )
-
- _pasillerositem.add(
- PasillerosItemVO(
- 10,
- R.drawable.revision_icon,
- "Histórico Shelving", R.string.itemShelvingLog
- )
- )
- _pasillerositem.add(
- PasillerosItemVO(7,
- R.drawable.ic_history_orange_24dp,
- "Log Shelving",R.string.shelvingLog)
- )
-
- _pasillerositem.add(
- PasillerosItemVO(
- 22,
- R.drawable.car_info,
- "Historial del vehículo", R.string.vehiclediary
- )
- )
-
- _pasillerositem.add(
- PasillerosItemVO(
- 7,
- R.drawable.ic_baseline_all_inbox_24,
- "Reposición", R.string.reposicion
+ "Ver Ticket", R.string.verticket,"Muestra un ticket sin la posibilidad de modicarlo"
)
)
@@ -97,14 +64,9 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
0,
R.drawable.ic_loyalty_black_24dp,
- "Consultar artículo", R.string.ConsultarArticulo
+ "Consultar artículo", R.string.ConsultarArticulo,"Busca información de un ítem"
)
)
- /* _pasillerositem.add(
- PasillerosItemVO(30,
- R.drawable.ic_loyalty_black_24dp,
- "Consultar expedición",R.string.ExpeditionState)
- )*/
@@ -112,7 +74,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
6,
R.drawable.ic_local_parking_orange_24dp,
- "Parking", R.string.Parking
+ "Parking", R.string.Parking,"Permite aparcar tickets o carros"
)
)
@@ -120,7 +82,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
2,
R.drawable.ic_visibility_black_24dp,
- "Buscar item", R.string.BuscarItem
+ "Buscar item", R.string.BuscarItem,"Busca donde se encuentra un ítem"
)
)
@@ -135,7 +97,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
1,
R.drawable.ic_dashboard_black_24dp,
- "Ubicador", R.string.Ubicador
+ "Ubicador", R.string.Ubicador,"Permite ubicar/saber los ítems de un carro"
)
)
@@ -143,15 +105,53 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
3,
R.drawable.ic_spa_black_24dp,
- "Inventario", R.string.Inventario
+ "Inventario", R.string.Inventario, "Visualiza que falta o está desubicado"
)
)
+ _pasillerositem.add(
+ PasillerosItemVO(
+ 10,
+ R.drawable.revision_icon,
+ "Histórico Shelving", R.string.itemShelvingLog,"Permite saber modificaciones de items en un carro"
+ )
+ )
+ _pasillerositem.add(
+ PasillerosItemVO(7,
+ R.drawable.ic_history_orange_24dp,
+ "Log Shelving",R.string.shelvingLog,"Permite conocer los movimientos en un carro"
+ )
+ )
+
+ _pasillerositem.add(
+ PasillerosItemVO(
+ 22,
+ R.drawable.car_info,
+ "Historial del vehículo", R.string.vehiclediary,"Visualiza quien y cuando ha llevado un vehículo"
+ )
+ )
+ _pasillerositem.add(
+ PasillerosItemVO(
+ 41,
+ R.drawable.day_of_sale,
+ "Día de venta", R.string.dayofSale,"Permite saber la fecha de venta de los items de un carro"
+ )
+ )
+ _pasillerositem.add(
+ PasillerosItemVO(
+ 7,
+ R.drawable.ic_baseline_all_inbox_24,
+ "Reposición", R.string.reposicion,"Indica que falta reponer"
+ )
+ )
+
+
+
_pasillerositem.add(
PasillerosItemVO(
4,
R.drawable.ic_move_to_inbox_black_24dp,
- "Faltas", R.string.Faltas
+ "Faltas", R.string.Faltas,"Visualiza las faltas en almacén"
)
)
@@ -159,7 +159,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
5,
R.drawable.ic_send_black_24dp,
- "Shelving Parking", R.string.ShelvingParking
+ "Shelving Parking", R.string.ShelvingParking,""
)
)
@@ -167,7 +167,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
8,
R.drawable.ic_baseline_star_24,
- "Calidad", R.string.Calidad
+ "Calidad", R.string.Calidad,"Permite conocer la calidad de algunos productos por comprador"
)
)
@@ -179,7 +179,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
30,
R.drawable.pallet_shipping_selected,
- "Paletizar", R.string.PalletMake
+ "Paletizar", R.string.PalletMake,"Permite escanear pallet para incorporarlo al sistema"
)
)
@@ -187,14 +187,14 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
31,
R.drawable.ic_visibility_black_24dp,
- "Consultar expedición", R.string.ExpeditionState
+ "Consultar expedición", R.string.ExpeditionState,"Permite conocer el estado de una expedición"
)
)
_pasillerositem.add(
PasillerosItemVO(
40,
R.drawable.barcode_scan,
- "Escanear expedición", R.string.ExpeditionScan
+ "Escanear expedición", R.string.ExpeditionScan,"Permite escanear expediciones que no han pasado por el sorter"
)
)
@@ -203,7 +203,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
32,
R.drawable.buffer_outline,
- "Gestión de buffers", R.string.BuffersManegement
+ "Gestión de buffers", R.string.BuffersManegement,"Se accede al menú de operaciones con los buffers del sorter"
)
)
@@ -212,7 +212,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
33,
R.drawable.qrcode_scan,
- "Lector Qr", R.string.QrReader
+ "Lector Qr", R.string.QrReader,"Permite leer información en un qr"
)
)
@@ -224,7 +224,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
30,
R.drawable.buffer_empty,
- "Vaciado buffer", R.string.bufferempty
+ "Vaciado buffer", R.string.bufferempty, "Pone en modo vaciado un buffer"
)
)
@@ -232,7 +232,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
31,
R.drawable.buffer_fill,
- "Llenado buffer", R.string.bufferfill
+ "Llenado buffer", R.string.bufferfill,"Pone en modo llenado un buffer"
)
)
@@ -241,7 +241,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
32,
R.drawable.buffer_accumulation,
- "Acumulación buffer", R.string.bufferaccumulate
+ "Acumulación buffer", R.string.bufferaccumulate,"Pone en modo acumulación un buffer"
)
)
@@ -249,7 +249,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
31,
R.drawable.buffer_off,
- "Desactivado buffer", R.string.bufferoff
+ "Desactivado buffer", R.string.bufferoff,"Pone en modo desactivado un buffer"
)
)
@@ -257,7 +257,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
31,
R.drawable.buffer_flejado,
- "Flejado buffer", R.string.bufferfstrapping
+ "Flejado buffer", R.string.bufferfstrapping,"Pone en modo flejado un buffer"
)
)
@@ -266,7 +266,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel() {
PasillerosItemVO(
45,
R.drawable.buffer_load,
- "Cargar expedición en buffer", R.string.bufferload
+ "Cargar expedición en buffer", R.string.bufferload, "Pone en modo cargar un buffer"
)
)
}
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/model/PasillerosItemVO.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/model/PasillerosItemVO.kt
index 0e2ebfa5..c0a03ac5 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/model/PasillerosItemVO.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/model/PasillerosItemVO.kt
@@ -1,9 +1,10 @@
package es.verdnatura.presentation.view.feature.pasillero.model
-class PasillerosItemVO (
+class PasillerosItemVO(
var id: Int = 0,
var iconResource: Int = 0,
val title: String = "",
- val titleToShow:Int = 0
+ val titleToShow: Int = 0,
+ val description: String = ""
)
\ No newline at end of file
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/precontrol/PreControladorFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/precontrol/PreControladorFragment.kt
index 0f45c828..5759f96f 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/precontrol/PreControladorFragment.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/precontrol/PreControladorFragment.kt
@@ -79,8 +79,7 @@ class PreControladorFragment: BaseFragment {
override fun onFailure(call: Call, t: Throwable) {
- _collectionTicketList.value = CollectionVO(isError = true,errorMessage =getMessageFromAllResponse(callFunction,t.message!!))
+ _collectionTicketList.value = CollectionVO(isError = true,errorMessage =getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(
call: Call,
@@ -34,7 +35,7 @@ class PreControladorViewModel(context: Context) : BaseViewModel() {
if (response.body() != null){
_collectionTicketList.value = response.body()?.let { it.map() }
}else{
- _collectionTicketList.value = CollectionVO(isError = true,errorMessage = getMessageFromAllResponse(callFunction,response.message()))
+ _collectionTicketList.value = CollectionVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
}
}
})
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 4e08dc57..721a3338 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
@@ -4,19 +4,19 @@ import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
import android.media.MediaPlayer
+import android.os.Build
import android.os.Bundle
import android.util.Log
import android.util.Log.d
import android.view.View
import android.view.View.GONE
-import android.view.View.VISIBLE
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager
+import android.widget.ImageView
import android.widget.Toast
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
-import com.google.firebase.crashlytics.internal.common.CommonUtils.isNullOrEmpty
import es.verdnatura.R
import es.verdnatura.databinding.FragmentPreSacadorBinding
import es.verdnatura.domain.ConstAndValues.PRESACADOR
@@ -36,7 +36,6 @@ import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
import es.verdnatura.presentation.view.feature.presacador.adapter.PreSacadorAdapter
import es.verdnatura.presentation.view.feature.presacador.model.PreSacadorItemVO
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyListVO
-import es.verdnatura.presentation.view.feature.sacador.model.PlacementVO
import es.verdnatura.presentation.view.feature.sacador.model.SaleVO
/*import kotlinx.android.synthetic.main.activity_main.*
@@ -55,8 +54,8 @@ class PreSacadorFragment :
private var SectorDescription = ""
var mperror: MediaPlayer? = null
var mpok: MediaPlayer? = null
- private var sales: ArrayList = ArrayList()
-
+ //private var sales: ArrayList = ArrayList()
+ private lateinit var sales: MutableList
private lateinit var customDialog: CustomDialog
private lateinit var customDialogList: CustomDialogList
private var saleAdapter: PreSacadorAdapter? = null
@@ -270,42 +269,26 @@ class PreSacadorFragment :
sales.add(it)
}
- //sales.sortedByDescending{ it.carros.get(0).order }
- /* for (s in sales){
- Log.d("VERDNATURA::","item"+ s.itemFk +" pickingorder" + s.carros.get(0).pickingOrder)
- }*/
-
- //val sortedSales = sales.sortedByDescending { it.carros[0].pickingOrder }
-
- //A provar el dilluns
- // var sortedList=sales.sortedWith(compareBy(nullsLast(),{it.carros.get(0).pickingOrder}))
-
+ //sergio: se tiene que ordenar por el pickingOrder del primer carro (Pako)
for (s in sales){
- if (s.carros.isNullOrEmpty()){
-
- }else{
+ Log.d("VERDNATURA::","sales "+s.longName)
+ //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
-
- d("VERDNATURA::","item sin ordenar:"+ s.itemFk + " priority:"+s.carros.get(0).pickingOrder)
- d("VERDNATURA::","item sin ordenar:"+ s.itemFk + " parking :"+s.carros.get(0).parking)
-
}
}
- // var sortedSales=sales.sortedWith(nullsLast(compareByDescending { it.carros.get(0).priority }))
-
var sortedSales=sales.sortedBy{ it.pickingOrder }
- /*for (s in sortedSales){
- d("VERDNATURA::","item ordenado:"+ s.itemFk + " picking "+ s.pickingOrder)
- }*/
+ //sergio: Se ordena las sales por ellas mismas con With
+ sales.sortWith(compareBy({it.pickingOrder}))
lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
saleAdapter = PreSacadorAdapter(
- sortedSales,
+ sales,
pasillerosItemClickListener!!,
object : OnQuantityClickListener {
override fun onQuantityClick(sale: SaleVO) {
@@ -320,6 +303,7 @@ class PreSacadorFragment :
object :
OnSaleClickListener {
override fun onSaleClick(sale: SaleVO) {
+ //sales.forEachIndexed { index, saleVO ->
sales.forEachIndexed { index, saleVO ->
if (saleVO.idMovimiento == sale.saleFk) {
if (saleVO.quantity != saleVO.picked) {
@@ -370,9 +354,12 @@ class PreSacadorFragment :
private fun setListPosition(position: Int) {
storedPosition = position
+
binding.fragmentSacadorCollections.addViewObserver {
lm!!.scrollToPositionWithOffset(position, 0)
+
}
+
}
//SEARCH AND MARK
@@ -789,33 +776,44 @@ class PreSacadorFragment :
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)
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ iconParking.tooltipText=getTooltip(R.drawable.ic_local_parking_black_24dp)
+ }
+
+ listIcons.add(iconParking)
+
+ /*val listIcons: ArrayList = ArrayList()
val iconEraser: Drawable = resources.getDrawable(R.drawable.eraser, resources.newTheme())
val iconParking: Drawable =
- resources.getDrawable(R.drawable.ic_local_parking_black_24dp, resources.newTheme())
+ resources.getDrawable(R.drawable.ic_local_parking_black_24dp, resources.newTheme())*/
+
//sergio para hacer el presacador como sacador
//val iconAdd : Drawable = resources.getDrawable(R.drawable.ic_add_black_24dp,resources.newTheme())
//val iconTransferir : Drawable = resources.getDrawable(R.drawable.ic_swap_horiz_black_24dp,resources.newTheme())
-
// listIcons.add(iconEraser)
- listIcons.add(iconParking)
-
+ //listIcons.add(iconParking)
//listIcons.add(iconAdd)
//listIcons.add(iconTransferir)
binding.mainToolbar.toolbarIcons.adapter =
- ToolBarAdapter(listIcons, object : OnOptionsSelectedListener {
+ ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
- if (item == iconEraser) {
+ /*if (item == iconEraser) {
// saleTracking_update()
- } else if (item == iconParking) {
- // showScannerTicket()
- pasillerosItemClickListener?.onPasillerosItemClickListener(
- PasillerosItemVO(
- title = "Parking"
- ), ""
- )
+ } else*/
+ when (item){
+ iconParking.drawable-> pasillerosItemClickListener?.onPasillerosItemClickListener(
+ PasillerosItemVO(
+ title = "Parking"
+ ), ""
+ )
}
+
}
})
binding.mainToolbar.toolbarIcons.layoutManager =
@@ -874,7 +872,7 @@ class PreSacadorFragment :
override fun getLayoutId(): Int = R.layout.fragment_pre_sacador
override fun onPause() {
- goBack = true
+ // goBack = true //SERGIO: se quita porque si no no entra la primera vez
goBack2 = true
super.onPause()
}
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 1eadaad5..5c58dc78 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
@@ -9,10 +9,7 @@ import es.verdnatura.domain.GetLoginUserCase
import es.verdnatura.domain.GetPreSacadorUseCase
import es.verdnatura.domain.GetSacadorControladorUserCase
import es.verdnatura.domain.GetUbicadorUserCase
-import es.verdnatura.presentation.base.BaseViewModel
-import es.verdnatura.presentation.base.getMessageError
-import es.verdnatura.presentation.base.getMessageFromAllResponse
-import es.verdnatura.presentation.base.getMessageFromResponse
+import es.verdnatura.presentation.base.*
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.presacador.model.PreSacadorItemVO
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyListVO
@@ -107,7 +104,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@@ -117,7 +114,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message())
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@@ -136,7 +133,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@@ -146,7 +143,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message())
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@@ -167,7 +164,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_responseParkingAdd.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@@ -177,7 +174,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_responseParkingAdd.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message())
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@@ -208,7 +205,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
override fun onFailure(call: Call>, t: Throwable)
{
val listError: ArrayList = ArrayList()
- listError.add(PlacementSupplyVO(isError = true, errorMessage = getMessageFromAllResponse(callFunction,t.message!!)))
+ listError.add(PlacementSupplyVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)))
_placementSuppleyList.value = PlacementSupplyListVO(listError)
}
@@ -226,7 +223,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
listError.add(
PlacementSupplyVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message())
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
)
_placementSuppleyList.value = PlacementSupplyListVO(listError)
@@ -253,7 +250,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
override fun onFailure(call: Call, t: Throwable)
{
- _response.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(callFunction,t.message!!))
+ _response.value = ResponseItemVO(isError = true, errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!))
}
override fun onResponse(call: Call, response: Response)
@@ -262,7 +259,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message())
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@@ -299,7 +296,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@@ -309,7 +306,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message())
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
} else
{
@@ -328,7 +325,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_responseCode.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@@ -338,7 +335,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_responseCode.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message()))
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
} else
{
@@ -357,7 +354,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@@ -367,7 +364,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message()))
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
} else
{
_response.value =
@@ -396,7 +393,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@@ -406,7 +403,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message()))
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
} else
{
_response.value = ResponseItemVO(isError = false, response = response.body()!!)
@@ -438,7 +435,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@@ -448,7 +445,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_response.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message()))
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
} else
{
_response.value = ResponseItemVO(isError = false, response = response.body()!!)
@@ -474,7 +471,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_responseIncQuantity.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@@ -484,7 +481,7 @@ class PreSacadorViewModel(context: Context) : BaseViewModel()
{
_responseIncQuantity.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message()))
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
} else
{
_responseIncQuantity.value =
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/model/PreSacadorItemVO.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/model/PreSacadorItemVO.kt
index a9caa5e9..e7afb8fb 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/model/PreSacadorItemVO.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/model/PreSacadorItemVO.kt
@@ -14,7 +14,7 @@ class PreSacadorItemVO (
var idMovimiento : String = "",
var trabajador : String = "",
var carros : List = listOf(),
- var priority:Int =0,
+ //var priority:Int =0, 7-1-2022
var pickingOrder:Int =0
)
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/qr/QrFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/qr/QrFragment.kt
index c86dcee5..a0d83e5d 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/qr/QrFragment.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/qr/QrFragment.kt
@@ -43,13 +43,6 @@ class QrFragment(
binding.splashProgress.visibility = View.GONE
customDialog = CustomDialog(requireContext())
- customDialog.setTitle("Mensaje")
- .setDescription("Operación " )
- .setOkButton("Aceptar") {
- customDialog.dismiss()
- binding.mainToolbar.backButton.performClick()
- }.show()
-
setToolbar()
setEvents()
super.init()
@@ -88,7 +81,6 @@ class QrFragment(
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
-
goBack = false
if (!binding.scanInput.text.isNullOrEmpty()) {
binding.splashProgress.visibility = View.VISIBLE
@@ -101,7 +93,7 @@ class QrFragment(
(activity as MainActivity).hideKeyboard(binding.scanInput)
return@setOnEditorActionListener true
}
- //false
+ // false
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 bf21c5b4..429eabbd 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
@@ -9,6 +9,7 @@ import es.verdnatura.domain.GetQrReaderUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
+import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO
import retrofit2.Call
import retrofit2.Callback
@@ -31,7 +32,7 @@ class QrFragmentViewModel(context: Context) : BaseViewModel() {
_qrresponse.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,t.message!!)
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),t.message!!)
)
}
@@ -61,7 +62,7 @@ class QrFragmentViewModel(context: Context) : BaseViewModel() {
if (response.body() == null) {
_qrresponse.value = ResponseItemVO(
isError = true,
- errorMessage = getMessageFromAllResponse(callFunction,response.message())
+ errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message())
)
}
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/reposicion/fragment/ReposicionFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/reposicion/fragment/ReposicionFragment.kt
index 417a9911..1979a70f 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/reposicion/fragment/ReposicionFragment.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/reposicion/fragment/ReposicionFragment.kt
@@ -4,10 +4,12 @@ import android.content.Context
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
import android.media.MediaPlayer
+import android.os.Build
import android.os.Bundle
import android.view.View
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager
+import android.widget.ImageView
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
@@ -495,22 +497,25 @@ class ReposicionFragment : BaseFragment = ArrayList()
- val iconPrint : Drawable = resources.getDrawable(R.drawable.ic_print_black_24dp,resources.newTheme())
- val iconParking : Drawable = resources.getDrawable(R.drawable.ic_local_parking_black_24dp,resources.newTheme())
- //val iconTransferir : Drawable = resources.getDrawable(R.drawable.ic_swap_horiz_black_24dp,resources.newTheme())
- //listIcons.add(iconPrint)
+ val listIcons: ArrayList = ArrayList()
+ val iconParking = ImageView(context)
+ iconParking.setImageResource(R.drawable.ic_local_parking_black_24dp)
+
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ iconParking.tooltipText = getTooltip(R.drawable.ic_local_parking_black_24dp)
+ }
+
listIcons.add(iconParking)
- //listIcons.add(iconTransferir)
- binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener {
+ binding.mainToolbar.toolbarIcons.adapter = ToolBarAdapterTooltip(listIcons,object: OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
- if (item == iconPrint){
- }else if (item == iconParking){
- pasillerosItemClickListener?.onPasillerosItemClickListener(PasillerosItemVO(title = "Parking"),"")
+ when (item){
+ iconParking.drawable->pasillerosItemClickListener?.onPasillerosItemClickListener(PasillerosItemVO(title = "Parking"),"")
}
+
}
})
binding.mainToolbar.toolbarIcons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/reposicion/fragment/ReposicionViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/reposicion/fragment/ReposicionViewModel.kt
index b014cba0..32ad76d8 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/reposicion/fragment/ReposicionViewModel.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/reposicion/fragment/ReposicionViewModel.kt
@@ -9,6 +9,7 @@ import es.verdnatura.domain.GetUbicadorUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.base.getMessageError
import es.verdnatura.presentation.base.getMessageFromAllResponse
+import es.verdnatura.presentation.base.nameofFunction
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.presacador.model.PreSacadorItemVO
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyListVO
@@ -64,12 +65,12 @@ class ReposicionViewModel(context: Context) : BaseViewModel() {
fun parking(usuario: String,password: String,ticketFk: String,parking:String,callFunction:String){
getUbicadorUserCase.shelvingPark(usuario,password,ticketFk,parking).enqueue(object : Callback{
override fun onFailure(call: Call