feat: refs #6861 reservas

This commit is contained in:
Sergio De la torre 2024-10-16 11:40:48 +02:00
parent 24ccf9ce2f
commit d7ca5c3e08
1 changed files with 36 additions and 16 deletions

View File

@ -344,18 +344,28 @@ class CollectionFragmentPickerNew(
} }
} }
responseExistsItemShelvingSale.observe(viewLifecycleOwner) { loadExistsResponse.observe(viewLifecycleOwner) { event ->
if (!goBack) { event.getContentIfNotHandled().notNull {
if (it.exists) {
markLine(it.position, it.quantity, true) getString(R.string.updateSalesReserve).toast(
} else { requireContext()
)
updateScreen()
}
}
loadFindItemShelvingResponse.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull {
if (it.shelvingFk != myGroupList[it.position].code) {
getString(R.string.updateSalesReserve).toast( getString(R.string.updateSalesReserve).toast(
requireContext() requireContext()
) )
viewModel.collectionTicketGetSalix(collection.collectionFk, false) updateScreen()
} else {
markLine(it.position, it.quantity, true)
} }
} }
} }
responseParking.observe(viewLifecycleOwner) { responseParking.observe(viewLifecycleOwner) {
@ -502,7 +512,7 @@ class CollectionFragmentPickerNew(
saleAdapter = SaleAdapterNew( saleAdapter = SaleAdapterNew(
myGroupList, myGroupList,
pasillerosItemClickListener!!, pasillerosItemClickListener!!,
object : OnSaleClickSaleListener { object : OnSaleClickSaleListener {
override fun onSaleClick(mySale: Sale) { override fun onSaleClick(mySale: Sale) {
myGroupList.forEachIndexed { index, sale -> myGroupList.forEachIndexed { index, sale ->
@ -859,13 +869,22 @@ class CollectionFragmentPickerNew(
}.setOkButtonTwo(getString(R.string.no)) { }.setOkButtonTwo(getString(R.string.no)) {
scanRequest() scanRequest()
customDialogThreeButtonsQuantity.dismiss() customDialogThreeButtonsQuantity.dismiss()
if (quantity == 0) { viewModel.itemShelvingSaleExists(
viewModel.itemShelvingSaleExists( myGroupList[position].itemShelvingSaleFk,
myGroupList[position].itemShelvingSaleFk, position, quantity myGroupList[position].itemShelvingFk,
) position,
} else { quantity
markLine(position, quantity, true) )
} /* if (quantity == 0) {
viewModel.itemShelvingSaleExists(
myGroupList[position].itemShelvingSaleFk,
myGroupList[position].itemShelvingFk,
position,
quantity
)
} else {
markLine(position, quantity, true)
}*/
}.setKoButton(getString(R.string.cancel)) { }.setKoButton(getString(R.string.cancel)) {
scanRequest() scanRequest()
customDialogThreeButtonsQuantity.dismiss() customDialogThreeButtonsQuantity.dismiss()
@ -1143,7 +1162,8 @@ class CollectionFragmentPickerNew(
origin = value[0].origin, origin = value[0].origin,
size = value[0].size, size = value[0].size,
itemShelvingSaleFk = value[0].itemShelvingSaleFk, itemShelvingSaleFk = value[0].itemShelvingSaleFk,
longName = value[0].parkingCode ?: "" longName = value[0].parkingCode ?: "",
itemShelvingFk = 0
) )
//prime elemento//hay que hacer una copia si no queda la referencia //prime elemento//hay que hacer una copia si no queda la referencia