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

View File

@ -120,7 +120,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
) )
//Tarea 4940 //Tarea 4940
/* _pasillerositem.add( _pasillerositem.add(
PasillerosItemVO( PasillerosItemVO(
1, 1,
R.drawable.ic_packaging, R.drawable.ic_packaging,
@ -130,20 +130,8 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
R.string.titleUbicatorDescrip 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 //Tarea 4979
/* _pasillerositem.add( /* _pasillerositem.add(
@ -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 //#tarea4679
/* _pasillerositem.add( _pasillerositem.add(
PasillerosItemVO( PasillerosItemVO(
6, 6,
R.drawable.ic_delivery_truck, R.drawable.ic_delivery_truck,
@ -510,7 +509,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
R.string.titleDelivery, R.string.titleDelivery,
contextApp.getString(R.string.titleDeliveryDescrip) contextApp.getString(R.string.titleDeliveryDescrip)
) )
)*/ )
//#tarea4021 //#tarea4021
/* _pasillerositem.add( /* _pasillerositem.add(