This commit is contained in:
Sergio De la torre 2023-11-06 16:48:31 +01:00
parent f8272a4df2
commit 9ee06e52b0
2 changed files with 87 additions and 59 deletions

View File

@ -208,10 +208,10 @@ class UbicadorFragment(
iconReset.drawable -> {
customDialog.setTitle(getString(R.string.checkItemShelvingDescrip))
.setDescription(getString(R.string.checkItemShelving))
.setOkButton(getString(R.string.cancel)) {
customDialog.dismiss()
.setOkButton(getString(R.string.ok)) {
// viewModel.itemShelvingDelete()
}
.setKoButton(getString(R.string.ok)) {
.setKoButton(getString(R.string.cancel)) {
customDialog.dismiss()
}
@ -312,6 +312,7 @@ class UbicadorFragment(
}
binding.parkingImg.setOnClickListener {
if (!shelvingFk.isNullOrBlank()) {
customDialogInput.setTitle(getString(R.string.parkingShelving)).setValue("")
.setOkButton(
getString(
@ -331,7 +332,12 @@ class UbicadorFragment(
}.setKoButton(getString(R.string.cancel)) {
customDialogInput.dismiss()
}.show()
} else {
getString(R.string.errorShelving).toast(
requireContext()
)
}
customDialogInput.getEditText().requestFocus()
ma.hideKeyboard(customDialogInput.getEditText())
@ -357,8 +363,11 @@ class UbicadorFragment(
}
binding.editImg.setOnClickListener {
if (!shelvingFk.isNullOrBlank()
) {
customDialogInput.setTitle(getString(R.string.changeShelving)).setValue("")
.setOkButton(getString(R.string.save)) {
if (!customDialogInput.getValue().isNullOrBlank()) {
viewModel.shelvingChangeSalix(
shelvingFk, customDialogInput.getValue()
)
@ -367,17 +376,26 @@ class UbicadorFragment(
shelvingFk.uppercase() + getString(R.string.pUppercase) + parking + getString(
R.string.label
) + etiquetas
// if (mpok != null) mpok!!.start()
} else {
getString(R.string.errorShelving).toast(
requireContext()
)
}
customDialogInput.dismiss()
}.setKoButton(getString(R.string.cancel)) {
customDialogInput.dismiss()
}.show()
} else {
getString(R.string.errorShelving).toast(
requireContext()
)
}
customDialogInput.getEditText().requestFocus()
ma.hideKeyboard(customDialogInput.getEditText())
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
viewModel.shelvingChangeSalix(
shelvingFk,
customDialogInput.getValue()
@ -387,7 +405,7 @@ class UbicadorFragment(
shelvingFk.uppercase() + getString(R.string.pUppercase) + parking + getString(
R.string.label
) + etiquetas
// if (mpok != null) mpok!!.start()
customDialogInput.dismiss()
return@setOnEditorActionListener true
}
@ -397,9 +415,11 @@ class UbicadorFragment(
}
binding.deleteImg.setOnClickListener {
if (!shelvingFk.isNullOrBlank()) {
customDialog.setTitle(getString(R.string.empty))
.setDescription(getString(R.string.operationNoReturn))
.setOkButton(getString(R.string.empty)) {
viewModel.clearShelvingList(
shelvingFk
)
@ -411,14 +431,20 @@ class UbicadorFragment(
adapter!!.notifyDataSetChanged()
}
customDialog.dismiss()
}.setKoButton(getString(R.string.cancel)) {
}
customDialog.setKoButton(getString(R.string.cancel)) {
customDialog.dismiss()
}.show()
} else {
getString(R.string.errorShelving).toast(
requireContext()
)
}
}
}
private fun checkUbications(itemScanned: Int) {
itemScannedScreen = itemScanned
@ -686,7 +712,9 @@ class UbicadorFragment(
if (customDialogInput.getValue().toInt() > 0) {
binding.splashProgress.visibility = VISIBLE
var quantity =
if (item.visible.toInt() - customDialogInput.getValue().toInt() > 0) {
if (item.visible.toInt() - customDialogInput.getValue()
.toInt() > 0
) {
item.visible.toInt() - customDialogInput.getValue().toInt()
} else {
0

View File

@ -268,7 +268,7 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
vShelvingFk: String
) {
salix.itemShelvingsUpdate(id= """{"id":$vShelf}""", params= hashMapOf("shelvingFk" to vShelvingFk))
salix.itemShelvingsUpdate(where = """{"id":$vShelf}""", params= hashMapOf("shelvingFk" to vShelvingFk))
.enqueue(object : SilexCallback<Any>(context) {
override fun onError(t: Throwable) {
_response.value = ResponseItemVO(
@ -377,7 +377,7 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
) {
salix.itemShelvingsUpdate(
id = JsonObject().apply { addProperty("shelvingFk", shelvingFk) },
where = JsonObject().apply { addProperty("shelvingFk", shelvingFk) },
hashMapOf("visible" to 0)
)
.enqueue(object : SalixCallback<Any>(context) {
@ -402,7 +402,7 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
) {
salix.itemShelvingsUpdate(
id = JsonObject().apply { addProperty("shelvingFk", shelvingFkIn) },
where = JsonObject().apply { addProperty("shelvingFk", shelvingFkIn) },
hashMapOf("shelvingFk" to shelvingFkOut)
)
.enqueue(object : SalixCallback<Any>(context) {