This commit is contained in:
Sergio De la torre 2023-05-29 12:20:57 +02:00
parent fae0d8a444
commit 491a4f8762
2 changed files with 46 additions and 53 deletions

View File

@ -1,7 +1,6 @@
package es.verdnatura.presentation.view.feature.packingHolland.fragment
import android.view.View.GONE
import android.view.View.VISIBLE
import android.view.View.*
import android.view.inputmethod.EditorInfo
import es.verdnatura.R
import es.verdnatura.databinding.FragmentGeneralBlackBinding
@ -47,15 +46,11 @@ class PackingHollandFragment(var entrypoint: String) :
if (!binding.scanInput.text.isNullOrEmpty()) {
try {
binding.scanInput.setText(
itemScanValue(
binding.scanInput.text.toString(),
"buy",
"more"
).toString()
)
shelvingScaned = binding.scanInput.text.toString().toInt()
shelvingScaned = itemScanValue(
binding.scanInput.text.toString(),
"buy",
"more"
).toString().toInt()
showQuantityPacking()
} catch (ex: Exception) {
ex.message!!.toast(requireActivity())
@ -76,9 +71,9 @@ class PackingHollandFragment(var entrypoint: String) :
response.observe(viewLifecycleOwner) {
binding.splashProgress.visibility = GONE
if (it.isError) {
ma.messageWithSound(it.errorMessage, true, false)
ma.messageWithSound(it.errorMessage, true, true)
} else {
showQuantityPacking()
ma.messageWithSound(it.errorMessage, false, true, isToasted = false)
}
}
@ -94,49 +89,48 @@ class PackingHollandFragment(var entrypoint: String) :
customDialogInput.setDescription(getString(R.string.packingQuantity) + shelvingScaned)
.setValue("")
.setOkButton(getString(R.string.modify)) {
if (customDialogInput.getValue().isNotEmpty()
) {
callPacking(customDialogInput.getValue())
}
callPacking(customDialogInput.getValue())
}.setKoButton(getString(R.string.cancel)) {
customDialogInput.dismiss()
}.show()
customDialogInput.setFocusText()
customDialogInput.setFocusText()
ma.hideKeyboard(customDialogInput.getEditText())
customDialogInput.getEditText().setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5 || actionId == 6) {
if (customDialogInput.getValue().isNotEmpty()) {
callPacking(customDialogInput.getValue())
}
callPacking(customDialogInput.getValue())
return@setOnEditorActionListener true
}
false
}
ma.hideKeyboard(customDialogInput.getEditText())
}
private fun callPacking(value: String) {
try {
binding.splashProgress.visibility = VISIBLE
viewModel.travel_updatePacking(
itemFk = shelvingScaned,
packingFk = value.toInt()
)
} catch (ex: Exception) {
getString(R.string.errorInput).toast(requireActivity())
private fun callPacking(value: String) {
if (customDialogInput.getValue().isNotEmpty()) {
try {
ma.hideKeyboard(customDialogInput.getEditText())
customDialogInput.dismiss()
binding.splashProgress.visibility = VISIBLE
viewModel.travel_updatePacking(
itemFk = shelvingScaned,
packingFk = value.toInt()
)
} catch (ex: Exception) {
binding.splashProgress.visibility = INVISIBLE
getString(R.string.errorInput).toast(requireActivity())
customDialogInput.setValue("")
}
}
customDialogInput.setValue("")
}
}

View File

@ -120,7 +120,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
)
//Tarea 4940
/* _pasillerositem.add(
_pasillerositem.add(
PasillerosItemVO(
1,
R.drawable.ic_packaging,
@ -130,21 +130,9 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
R.string.titleUbicatorDescrip
)
)
)*/
//Tarea 5095
_pasillerositem.add(
PasillerosItemVO(
1,
R.drawable.ic_shopping_self,
contextApp.getString(R.string.selfConsumption),
R.string.titleSelfConsumption,
contextApp.getString(
R.string.titleSelfConsumption
)
)
)
//Tarea 4979
/* _pasillerositem.add(
PasillerosItemVO(
@ -252,6 +240,17 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
)
)
)
_pasillerositem.add(
PasillerosItemVO(
1,
R.drawable.ic_shopping_self,
contextApp.getString(R.string.selfConsumption),
R.string.titleSelfConsumption,
contextApp.getString(
R.string.titleSelfConsumption
)
)
)
}
@ -502,7 +501,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
//#tarea4679
/* _pasillerositem.add(
_pasillerositem.add(
PasillerosItemVO(
6,
R.drawable.ic_delivery_truck,
@ -510,7 +509,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
R.string.titleDelivery,
contextApp.getString(R.string.titleDeliveryDescrip)
)
)*/
)
//#tarea4021
/* _pasillerositem.add(