refs #5713 feat:add reset button
This commit is contained in:
parent
c9d7978519
commit
0c0c6f540f
|
@ -131,34 +131,35 @@ class UbicadorFragment(
|
|||
binding.mainToolbar.switchButton.isChecked = false
|
||||
} else {
|
||||
modeCheckUbication = isChecked
|
||||
binding.mainToolbar.toolbarIcons.adapter!!.notifyDataSetChanged()
|
||||
binding.mainToolbar.switchButton.tooltipText = if (isChecked)
|
||||
getString(R.string.activateModoChecking) else
|
||||
getString(R.string.allowCheckingMode)
|
||||
binding.textinputlayoutMatricula.hint =
|
||||
if (isChecked) getString(R.string.scanItem) else {
|
||||
getString(R.string.scanPlate)
|
||||
|
||||
}
|
||||
if (!isChecked) {
|
||||
listLocalItems.clear()
|
||||
listIcons.remove(iconReset)
|
||||
}else{
|
||||
listIcons.add(iconReset)
|
||||
}
|
||||
binding.mainToolbar.toolbarIcons.adapter!!.notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
|
||||
val iconChecker = ImageView(context)
|
||||
iconChecker.setImageResource(R.drawable.ic_ubicator_check)
|
||||
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
iconReload.tooltipText = getTooltip(R.drawable.ic_autorenew_black_24dp)
|
||||
iconAdd.tooltipText = getString(R.string.addItemShelving)
|
||||
iconChecker.tooltipText = getTooltip(R.drawable.ic_ubicator_check)
|
||||
iconReset.tooltipText = getTooltip(R.drawable.ic_remove_checks)
|
||||
|
||||
}
|
||||
listIcons.add(iconAdd)
|
||||
listIcons.add(iconReload)
|
||||
//listIcons.add(iconChecker)
|
||||
//tarea 5713
|
||||
//listIcons.add(iconReset)
|
||||
|
||||
|
||||
binding.mainToolbar.toolbarIcons.adapter =
|
||||
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
|
||||
|
@ -191,34 +192,31 @@ class UbicadorFragment(
|
|||
}
|
||||
}
|
||||
|
||||
iconChecker.drawable -> {
|
||||
if (!shelvingFk.isNullOrEmpty()) {
|
||||
ma.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(title = getString(R.string.titleChecker)),
|
||||
entryPoint = shelvingFk
|
||||
)
|
||||
|
||||
iconReset.drawable -> {
|
||||
if (!shelvingFk.isNullOrBlank()) {
|
||||
customDialog.setTitle(getString(R.string.checkItemShelvingDescrip))
|
||||
.setDescription(getString(R.string.checkItemShelving))
|
||||
.setOkButton(getString(R.string.ok)) {
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
viewModel.itemShelving_deleteChecked(shelvingFk)
|
||||
customDialog.dismiss()
|
||||
}
|
||||
.setKoButton(getString(R.string.cancel)) {
|
||||
customDialog.dismiss()
|
||||
|
||||
}
|
||||
.show()
|
||||
} else {
|
||||
getString(R.string.scanShelving).toast(
|
||||
requireActivity(),
|
||||
Toast.LENGTH_SHORT
|
||||
ma.messageWithSound(
|
||||
getString(R.string.scanPlate),
|
||||
isError = true,
|
||||
isPlayed = true,
|
||||
isToasted = true
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
iconReset.drawable -> {
|
||||
customDialog.setTitle(getString(R.string.checkItemShelvingDescrip))
|
||||
.setDescription(getString(R.string.checkItemShelving))
|
||||
.setOkButton(getString(R.string.ok)) {
|
||||
// viewModel.itemShelvingDelete()
|
||||
}
|
||||
.setKoButton(getString(R.string.cancel)) {
|
||||
customDialog.dismiss()
|
||||
|
||||
}
|
||||
.show()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
@ -308,12 +306,16 @@ class UbicadorFragment(
|
|||
entryPoint = shelvingFk
|
||||
)
|
||||
else
|
||||
getString(R.string.scanShelving).toast(requireActivity(), Toast.LENGTH_SHORT)
|
||||
getString(R.string.scanShelving).toast(
|
||||
requireActivity(),
|
||||
Toast.LENGTH_SHORT
|
||||
)
|
||||
}
|
||||
|
||||
binding.parkingImg.setOnClickListener {
|
||||
if (!shelvingFk.isNullOrBlank()) {
|
||||
customDialogInput.setTitle(getString(R.string.parkingShelving)).setValue("")
|
||||
customDialogInput.setTitle(getString(R.string.parkingShelving))
|
||||
.setValue("")
|
||||
.setOkButton(
|
||||
getString(
|
||||
R.string.parking
|
||||
|
@ -341,31 +343,33 @@ class UbicadorFragment(
|
|||
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.shelvingPark(
|
||||
shelvingFk,
|
||||
customDialogInput.getValue()
|
||||
)
|
||||
customDialogInput.dismiss()
|
||||
parking = customDialogInput.getValue()
|
||||
binding.mainToolbar.toolbarTitle.text =
|
||||
shelvingFk.uppercase() + getString(R.string.pUppercase) + parking + getString(
|
||||
R.string.label
|
||||
) + etiquetas
|
||||
customDialogInput.getEditText()
|
||||
.setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
viewModel.shelvingPark(
|
||||
shelvingFk,
|
||||
customDialogInput.getValue()
|
||||
)
|
||||
customDialogInput.dismiss()
|
||||
parking = customDialogInput.getValue()
|
||||
binding.mainToolbar.toolbarTitle.text =
|
||||
shelvingFk.uppercase() + getString(R.string.pUppercase) + parking + getString(
|
||||
R.string.label
|
||||
) + etiquetas
|
||||
|
||||
|
||||
return@setOnEditorActionListener true
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
binding.editImg.setOnClickListener {
|
||||
if (!shelvingFk.isNullOrBlank()
|
||||
) {
|
||||
customDialogInput.setTitle(getString(R.string.changeShelving)).setValue("")
|
||||
customDialogInput.setTitle(getString(R.string.changeShelving))
|
||||
.setValue("")
|
||||
.setOkButton(getString(R.string.save)) {
|
||||
if (!customDialogInput.getValue().isNullOrBlank()) {
|
||||
viewModel.shelvingChangeSalix(
|
||||
|
@ -393,24 +397,25 @@ class UbicadorFragment(
|
|||
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) {
|
||||
customDialogInput.getEditText()
|
||||
.setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
|
||||
viewModel.shelvingChangeSalix(
|
||||
shelvingFk,
|
||||
customDialogInput.getValue()
|
||||
)
|
||||
shelvingFk = customDialogInput.getValue()
|
||||
binding.mainToolbar.toolbarTitle.text =
|
||||
shelvingFk.uppercase() + getString(R.string.pUppercase) + parking + getString(
|
||||
R.string.label
|
||||
) + etiquetas
|
||||
viewModel.shelvingChangeSalix(
|
||||
shelvingFk,
|
||||
customDialogInput.getValue()
|
||||
)
|
||||
shelvingFk = customDialogInput.getValue()
|
||||
binding.mainToolbar.toolbarTitle.text =
|
||||
shelvingFk.uppercase() + getString(R.string.pUppercase) + parking + getString(
|
||||
R.string.label
|
||||
) + etiquetas
|
||||
|
||||
customDialogInput.dismiss()
|
||||
return@setOnEditorActionListener true
|
||||
customDialogInput.dismiss()
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -475,11 +480,14 @@ class UbicadorFragment(
|
|||
private fun setTooltips() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
binding.editImg.tooltipText = getTooltip(R.drawable.ic_mode_edit_black_24dp)
|
||||
binding.deleteImg.tooltipText = getTooltip(R.drawable.ic_delete_forever_black_24dp)
|
||||
binding.deleteImg.tooltipText =
|
||||
getTooltip(R.drawable.ic_delete_forever_black_24dp)
|
||||
binding.editPrioridad.tooltipText =
|
||||
getString(R.string.changePriority)
|
||||
binding.parkingImg.tooltipText = getTooltip(R.drawable.ic_local_parking_black_24dp)
|
||||
binding.automaticImg.tooltipText = getTooltip(R.drawable.ic_flash_auto_black_24dp)
|
||||
binding.parkingImg.tooltipText =
|
||||
getTooltip(R.drawable.ic_local_parking_black_24dp)
|
||||
binding.automaticImg.tooltipText =
|
||||
getTooltip(R.drawable.ic_flash_auto_black_24dp)
|
||||
|
||||
|
||||
}
|
||||
|
@ -546,6 +554,7 @@ class UbicadorFragment(
|
|||
if (!binding.mainToolbar.switchButton.isChecked && listItems.isNotEmpty()) {
|
||||
|
||||
listItems = listItems.asReversed()
|
||||
|
||||
}
|
||||
adapter = UbicadorAdapter(
|
||||
listItems.sortedBy { it.isChecked },
|
||||
|
@ -594,11 +603,14 @@ class UbicadorFragment(
|
|||
|
||||
}
|
||||
if (modeCheckUbication) {
|
||||
listItems.sortedBy { it.isChecked }.forEachIndexed { index, item ->
|
||||
if (item.item == itemScannedScreen) {
|
||||
binding.locationRecyclerview.scrollToPosition(index)
|
||||
listItems.sortedBy { it.isChecked }
|
||||
.forEachIndexed { index, item ->
|
||||
if (item.item == itemScannedScreen) {
|
||||
binding.locationRecyclerview.scrollToPosition(
|
||||
index
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
(binding.locationRecyclerview.layoutManager as LinearLayoutManager).scrollToPosition(
|
||||
|
@ -715,7 +727,8 @@ class UbicadorFragment(
|
|||
if (item.visible.toInt() - customDialogInput.getValue()
|
||||
.toInt() > 0
|
||||
) {
|
||||
item.visible.toInt() - customDialogInput.getValue().toInt()
|
||||
item.visible.toInt() - customDialogInput.getValue()
|
||||
.toInt()
|
||||
} else {
|
||||
0
|
||||
}
|
||||
|
@ -750,8 +763,10 @@ class UbicadorFragment(
|
|||
) {
|
||||
var title = getString(R.string.newItem)
|
||||
if (delete) title = getString(R.string.editItem) + itemFk
|
||||
customDialogUbicador.setTitle(title).setItemValue(itemFk).setPackingValue(packing)
|
||||
.setGroupingValue(grouping).setEtiquetaValue(etiquetas).setVisibleValue(visible)
|
||||
customDialogUbicador.setTitle(title).setItemValue(itemFk)
|
||||
.setPackingValue(packing)
|
||||
.setGroupingValue(grouping).setEtiquetaValue(etiquetas)
|
||||
.setVisibleValue(visible)
|
||||
.setOkButton(getString(R.string.save)) {
|
||||
var packingUpdate = false
|
||||
|
||||
|
@ -794,91 +809,94 @@ class UbicadorFragment(
|
|||
customDialogUbicador.getEditItem().requestFocus()
|
||||
ma.hideKeyboard(customDialogUbicador.getEditItem())
|
||||
|
||||
customDialogUbicador.getVisibleItem().setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
var packingUpdate = false
|
||||
if (packing != customDialogUbicador.getPackingValue() || etiquetas != customDialogUbicador.getEtiquetaValue()) {
|
||||
packingUpdate = true
|
||||
}
|
||||
saveNewItem(
|
||||
customDialogUbicador.getItemValue().toInt(),
|
||||
customDialogUbicador.getEtiquetaValue().toInt(),
|
||||
if (customDialogUbicador.getPackingValue().isNullOrEmpty()) {
|
||||
null
|
||||
} else {
|
||||
customDialogUbicador.getPackingValue().toInt()
|
||||
},
|
||||
if (customDialogUbicador.getVisibleValue().isNullOrEmpty()) {
|
||||
null
|
||||
} else {
|
||||
customDialogUbicador.getVisibleValue().toInt()
|
||||
},
|
||||
if (delete) packingUpdate else null,
|
||||
itemUbicador.id,
|
||||
customDialogUbicador.getGroupingValue().toInt()
|
||||
)
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
customDialogUbicador.getEditItem().setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
|
||||
if (!customDialogUbicador.getItemValue().isNullOrEmpty()) {
|
||||
try {
|
||||
|
||||
customDialogUbicador.setItemValue(
|
||||
itemScanValue(
|
||||
customDialogUbicador.getItemValue(),
|
||||
"buy",
|
||||
"more"
|
||||
).toString()
|
||||
)
|
||||
|
||||
} catch (ex: Exception) {
|
||||
ma.messageWithSound(ex.message.toString(), true, true)
|
||||
customDialogUbicador.setItemValue("")
|
||||
customDialogUbicador.getVisibleItem()
|
||||
.setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
var packingUpdate = false
|
||||
if (packing != customDialogUbicador.getPackingValue() || etiquetas != customDialogUbicador.getEtiquetaValue()) {
|
||||
packingUpdate = true
|
||||
}
|
||||
}
|
||||
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
|
||||
customDialogUbicador.getPackingItem().requestFocus()
|
||||
}
|
||||
|
||||
customDialogUbicador.getEtiquetaItem().setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
var packingUpdate = false
|
||||
if (packing != customDialogUbicador.getPackingValue() || etiquetas != customDialogUbicador.getEtiquetaValue()) {
|
||||
packingUpdate = true
|
||||
}
|
||||
saveNewItem(
|
||||
customDialogUbicador.getItemValue().toInt(),
|
||||
customDialogUbicador.getEtiquetaValue().toInt(),
|
||||
if (customDialogUbicador.getPackingValue().isNullOrEmpty()) {
|
||||
null
|
||||
} else {
|
||||
customDialogUbicador.getPackingValue().toInt()
|
||||
},
|
||||
if (customDialogUbicador.getVisibleValue().isNullOrEmpty()) {
|
||||
null
|
||||
} else {
|
||||
customDialogUbicador.getVisibleValue().toInt()
|
||||
},
|
||||
if (delete) packingUpdate else null,
|
||||
itemUbicador.id,
|
||||
if (customDialogUbicador.getGroupingValue().isNullOrEmpty()) {
|
||||
null
|
||||
} else {
|
||||
saveNewItem(
|
||||
customDialogUbicador.getItemValue().toInt(),
|
||||
customDialogUbicador.getEtiquetaValue().toInt(),
|
||||
if (customDialogUbicador.getPackingValue().isNullOrEmpty()) {
|
||||
null
|
||||
} else {
|
||||
customDialogUbicador.getPackingValue().toInt()
|
||||
},
|
||||
if (customDialogUbicador.getVisibleValue().isNullOrEmpty()) {
|
||||
null
|
||||
} else {
|
||||
customDialogUbicador.getVisibleValue().toInt()
|
||||
},
|
||||
if (delete) packingUpdate else null,
|
||||
itemUbicador.id,
|
||||
customDialogUbicador.getGroupingValue().toInt()
|
||||
}
|
||||
)
|
||||
return@setOnEditorActionListener true
|
||||
)
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
customDialogUbicador.getEditItem()
|
||||
.setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
|
||||
if (!customDialogUbicador.getItemValue().isNullOrEmpty()) {
|
||||
try {
|
||||
|
||||
customDialogUbicador.setItemValue(
|
||||
itemScanValue(
|
||||
customDialogUbicador.getItemValue(),
|
||||
"buy",
|
||||
"more"
|
||||
).toString()
|
||||
)
|
||||
|
||||
} catch (ex: Exception) {
|
||||
ma.messageWithSound(ex.message.toString(), true, true)
|
||||
customDialogUbicador.setItemValue("")
|
||||
}
|
||||
}
|
||||
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
|
||||
customDialogUbicador.getPackingItem().requestFocus()
|
||||
}
|
||||
|
||||
customDialogUbicador.getEtiquetaItem()
|
||||
.setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
var packingUpdate = false
|
||||
if (packing != customDialogUbicador.getPackingValue() || etiquetas != customDialogUbicador.getEtiquetaValue()) {
|
||||
packingUpdate = true
|
||||
}
|
||||
saveNewItem(
|
||||
customDialogUbicador.getItemValue().toInt(),
|
||||
customDialogUbicador.getEtiquetaValue().toInt(),
|
||||
if (customDialogUbicador.getPackingValue().isNullOrEmpty()) {
|
||||
null
|
||||
} else {
|
||||
customDialogUbicador.getPackingValue().toInt()
|
||||
},
|
||||
if (customDialogUbicador.getVisibleValue().isNullOrEmpty()) {
|
||||
null
|
||||
} else {
|
||||
customDialogUbicador.getVisibleValue().toInt()
|
||||
},
|
||||
if (delete) packingUpdate else null,
|
||||
itemUbicador.id,
|
||||
if (customDialogUbicador.getGroupingValue().isNullOrEmpty()) {
|
||||
null
|
||||
} else {
|
||||
customDialogUbicador.getGroupingValue().toInt()
|
||||
}
|
||||
)
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -998,7 +1016,8 @@ class UbicadorFragment(
|
|||
.setDescription(getString(R.string.selectAction))
|
||||
.setOkButton(getString(R.string.transfer)) {
|
||||
customDialogInput.setTitle(getString(R.string.shelvingNew))
|
||||
.setDescription(getString(R.string.selectDestiny) + item.item).setValue("")
|
||||
.setDescription(getString(R.string.selectDestiny) + item.item)
|
||||
.setValue("")
|
||||
.setOkButton(getString(R.string.transfer)) {
|
||||
if (customDialogInput.getValue().isNotEmpty()) {
|
||||
binding.splashProgress.visibility = VISIBLE
|
||||
|
@ -1053,7 +1072,11 @@ class UbicadorFragment(
|
|||
customDialogTwoButtons.dismiss()
|
||||
customDialog.dismiss()
|
||||
} else {
|
||||
viewModel.itemShelving_selfConsumption(shelvingFk, item.item, 0)
|
||||
viewModel.itemShelving_selfConsumption(
|
||||
shelvingFk,
|
||||
item.item,
|
||||
0
|
||||
)
|
||||
}
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
customDialog.dismiss()
|
||||
|
|
|
@ -108,9 +108,9 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
shelving: String
|
||||
|
||||
) {
|
||||
//Tarea 5134 ok
|
||||
salix.updateShelvingPriority("""{"code": "$shelving"}""", hashMapOf("priority" to priority))
|
||||
.enqueue(object : SalixCallback<Any>(context) {
|
||||
salix.updateShelvingPriority(
|
||||
where = JsonObject().apply { addProperty("code", shelving) },
|
||||
params = hashMapOf("priority" to priority)).enqueue(object : SalixCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_responsepriority.value = ResponseItemVO(
|
||||
isError = true,
|
||||
|
@ -268,8 +268,10 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
vShelvingFk: String
|
||||
|
||||
) {
|
||||
salix.itemShelvingsUpdate(where = """{"id":$vShelf}""", params= hashMapOf("shelvingFk" to vShelvingFk))
|
||||
.enqueue(object : SilexCallback<Any>(context) {
|
||||
salix.itemShelvingsUpdate(
|
||||
where = JsonObject().apply { addProperty("id", vShelf) },
|
||||
params = hashMapOf("shelvingFk" to vShelvingFk))
|
||||
.enqueue(object : SalixCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
|
@ -284,6 +286,27 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun itemShelving_deleteChecked(
|
||||
vShelvingFk: String
|
||||
|
||||
) {
|
||||
salix.itemShelvingsUpdate(
|
||||
where = JsonObject().apply { addProperty("shelvingFk", vShelvingFk) },
|
||||
params = hashMapOf("isChecked" to null))
|
||||
.enqueue(object : SilexCallback<Any>(context) {
|
||||
override fun onError(t: Throwable) {
|
||||
_response.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_response.value =
|
||||
ResponseItemVO(isError = false, response = response.message()!!)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun shelvinLog_add(
|
||||
code: String
|
||||
|
|
Loading…
Reference in New Issue