refs #6964 refactor:settings

This commit is contained in:
Sergio De la torre 2024-03-06 12:46:50 +01:00
parent 220c8e8062
commit e67b6fbf12
2 changed files with 49 additions and 4 deletions

View File

@ -6,7 +6,6 @@ import android.graphics.drawable.Drawable
import android.os.Build
import android.text.InputType
import android.text.TextWatcher
import android.view.MenuItem
import android.view.View
import android.view.View.GONE
import android.view.View.VISIBLE
@ -45,6 +44,7 @@ class UbicadorFragmentNew(
private var listItems: MutableList<ItemUbicador> = mutableListOf()
private var listLocalItems: ArrayList<ItemUbicador> = ArrayList()
private lateinit var customDialog: CustomDialog
private lateinit var customDialogOlder: CustomDialog
private var parking: String = ""
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
private var isShelvinLogfromMainScreen = false
@ -108,6 +108,7 @@ class UbicadorFragmentNew(
private fun setDialogs() {
customDialogInput = CustomDialogInput(requireContext())
customDialog = CustomDialog(requireContext())
customDialogOlder = CustomDialog(requireContext())
customDialogTwoButtons = CustomDialogTwoButtons(requireContext())
}
@ -390,10 +391,13 @@ class UbicadorFragmentNew(
}
private fun customDialogActionParking() {
viewModel.setParking(
shelvingFk, customDialogInput.getValue()
)
parking = customDialogInput.getValue()
//Tarea 6964
/* viewModel.hasItemOlder(shelvingFk,customDialogInput.getValue())*/
viewModel.setParking(
shelvingFk, customDialogInput.getValue()
)
customDialogInput.dismiss()
}
@ -515,6 +519,25 @@ class UbicadorFragmentNew(
}
})
responseHasOlder.observe(viewLifecycleOwner, Observer {
ma.messageWithSound("",true,true,"",false)
customDialogOlder.setTitle(getString(R.string.info))
.setDescription(getString(R.string.itemOlderInfo, shelvingFk))
.setOkButton(
getString(R.string.ok)
) {
customDialogOlder.dismiss()
//customDialogActionParking()
viewModel.setParking(
shelvingFk, parking)
}.setKoButton(getString(R.string.cancel)) {
customDialogOlder.dismiss()
}.show()
})
}
}

View File

@ -32,6 +32,10 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
val response: LiveData<ResponseItemVO>
get() = _response
private val _responseHasOlder by lazy { MutableLiveData<Boolean>() }
val responseHasOlder: LiveData<Boolean>
get() = _responseHasOlder
private val _responsepriority by lazy { MutableLiveData<ResponseItemVO>() }
val responsepriority: LiveData<ResponseItemVO>
get() = _responsepriority
@ -206,6 +210,24 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
})
}
fun hasItemOlder(
shelving: String,
parking: String
) {
salix.hasItemOlder(shelving,parking)
.enqueue(object : SalixCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) {
if (response.body() == false) {
setParking(shelving, parking)
} else {
_responseHasOlder.value = true
}
}
})
}
fun itemShelving_merge(
vShelf: Int, vShelvingFk: String