refs #6531 feat:last tickets

This commit is contained in:
Sergio De la torre 2024-02-27 09:46:34 +01:00
parent 3afe9de1c9
commit 9818b0babe
1 changed files with 47 additions and 40 deletions

View File

@ -10,6 +10,7 @@ import es.verdnatura.databinding.FragmentGeneralBlackBinding
import es.verdnatura.domain.ConstAndValues import es.verdnatura.domain.ConstAndValues
import es.verdnatura.presentation.base.BaseFragment import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnCollectionSelectedListener import es.verdnatura.presentation.common.OnCollectionSelectedListener
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionViewModel import es.verdnatura.presentation.view.feature.collection.fragment.CollectionViewModel
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
@ -60,46 +61,52 @@ class ControladorFragment :
binding.splashProgress.visibility = VISIBLE binding.splashProgress.visibility = VISIBLE
binding.scanInput.setText(textScanned_filterDouble(binding.scanInput.text!!.toString())) binding.scanInput.setText(textScanned_filterDouble(binding.scanInput.text!!.toString()))
//Tarea 6458 descomentar si ok //Tarea 6458 descomentar si ok
/* collectionViewModel = CollectionViewModel(mobileApplication) collectionViewModel = CollectionViewModel(mobileApplication)
collectionViewModel!!.ticketState(binding.scanInput.text.toString().toInt()) collectionViewModel!!.ticketState(binding.scanInput.text.toString().toInt())
collectionViewModel!!.responseTicketState.observe( collectionViewModel!!.responseTicketState.observe(
viewLifecycleOwner, viewLifecycleOwner,
Observer { it -> Observer { it ->
binding.splashProgress.visibility = View.GONE binding.splashProgress.visibility = View.GONE
if ((it.code == "ON_CHECKING" || it.code == "CHECKED") && it.user.id != mobileApplication.userId) { if ((it.code == "ON_CHECKING" || it.code == "CHECKED") && it.user.id != mobileApplication.userId) {
var customDialogWarning = CustomDialog(requireContext()) var customDialogWarning = CustomDialog(requireContext())
customDialogWarning.setTitle(getString(R.string.info)) customDialogWarning.setTitle(getString(R.string.info))
customDialogWarning.setDescription( customDialogWarning.setDescription(
if (it.code == "ON_CHECKING") { if (it.code == "ON_CHECKING") {
getString(R.string.checkingByUser, it.user.username) getString(R.string.checkingByUser, it.user.username)
} else { } else {
getString(R.string.checkedByUser, it.user.username) getString(R.string.checkedByUser, it.user.username)
} }
) )
.setOkButton(getString(R.string.aware)) { .setOkButton(getString(R.string.aware)) {
customDialogWarning.dismiss() customDialogWarning.dismiss()
binding.splashProgress.visibility= VISIBLE
viewModel.collectionTicketGet( binding.splashProgress.visibility = VISIBLE
sectorFk = mobileApplication.dataStoreApp.readDataStoreKey( viewModel.collectionTicketGet(
ConstAndValues.SECTORFK sectorFk = mobileApplication.dataStoreApp.readDataStoreKey(
), ConstAndValues.SECTORFK
collectionFk = binding.scanInput.text.toString().toInt(), ),
print = "0", collectionFk = binding.scanInput.text.toString()
type = ConstAndValues.CONTROLADOR .toInt(),
) print = "0",
}.show() type = ConstAndValues.CONTROLADOR
customDialogWarning.currentFocus )
} else {*/ }.setKoButton(getString(R.string.cancel)){
viewModel.collectionTicketGet( binding.scanInput.setText("")
sectorFk = mobileApplication.dataStoreApp.readDataStoreKey( binding.scanInput.requestFocus()
ConstAndValues.SECTORFK customDialogWarning.dismiss()
), }.show()
collectionFk = binding.scanInput.text.toString().toInt(), customDialogWarning.currentFocus
print = "0", } else {
type = ConstAndValues.CONTROLADOR viewModel.collectionTicketGet(
) sectorFk = mobileApplication.dataStoreApp.readDataStoreKey(
// } ConstAndValues.SECTORFK
//}) ),
collectionFk = binding.scanInput.text.toString().toInt(),
print = "0",
type = ConstAndValues.CONTROLADOR
)
}
})
} }