feat issues refs #7636

This commit is contained in:
Sergio De la torre 2024-08-07 11:50:26 +02:00
parent a2aae3bd73
commit 1bd592db0f
4 changed files with 53 additions and 10 deletions

View File

@ -274,7 +274,7 @@ class EndSacadorFragment(
}
})
loadResponseSaleGropAdd.observe(viewLifecycleOwner) { event ->
loadResponseSaleGroupAdd.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull {
if (!goBack) {

View File

@ -83,9 +83,15 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
private val _responseSaleGroupAdd by lazy { MutableLiveData<ResponseItemVO>() }
val responseSaleGroupAdd: LiveData<ResponseItemVO>
get() = _responseSaleGroupAdd
val loadResponseSaleGropAdd: LiveData<Event<ResponseItemVO>> =
val loadResponseSaleGroupAdd: LiveData<Event<ResponseItemVO>> =
_responseSaleGroupAdd.map { Event(it) }
private val _responseSaleGroupAdded by lazy { MutableLiveData<Int>() }
val responseSaleGroupAdded: LiveData<Int>
get() = _responseSaleGroupAdded
val loadResponseSaleGropAdded: LiveData<Event<Int>> =
_responseSaleGroupAdded.map { Event(it) }
private val _responseReserveSectorCollection by lazy { MutableLiveData<ResponseItemVO>() }
val responseReserveSectorCollection: LiveData<ResponseItemVO>
get() = _responseReserveSectorCollection
@ -311,7 +317,7 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
}
fun sectorCollectionSaleGroupAdd(
vSaleGroupFk: Int, vSectorCollectionFk: Int
vSaleGroupFk: Int, vSectorCollectionFk: Int,
) {
salix.sectorCollectionSaleGroupAdd(
arrayListOf(
@ -324,6 +330,7 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
nameofFunction(this), response.message()
)
)
_responseSaleGroupAdded.value = vSaleGroupFk
}
override fun onError(t: Throwable) {

View File

@ -115,14 +115,19 @@ class SacadorFragment(
iconAdd.drawable -> {
if (type == "PREPARED") {
viewModel.collection_assign(
)
} else {
viewModel.sectorCollectionNew(
mobileApplication.dataStoreApp.readDataStoreKey(
SECTORFK
if (hasSector()) {
viewModel.collection_assign(
)
)
}
} else {
if (hasSector()) {
viewModel.sectorCollectionNew(
mobileApplication.dataStoreApp.readDataStoreKey(
SECTORFK
)
)
}
}
}
@ -138,6 +143,21 @@ class SacadorFragment(
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
}
private fun hasSector(): Boolean {
return if (ma.haveSector()) {
true
} else {
ma.messageWithSound(
message = getString(R.string.errorSector),
isError = true,
isPlayed = true,
isToasted = false
)
false
}
}
private fun showPrintPrevious() {
customDialogInput.setInputText(InputType.TYPE_CLASS_NUMBER)

View File

@ -122,9 +122,11 @@ class SacadorFragmentNew(
iconAdd.drawable -> {
if (type == "PREPARED") {
if (hasSector())
viewModel.collection_assignNew(
)
} else {
if (hasSector())
viewModel.sectorCollectionNew(
mobileApplication.dataStoreApp.readDataStoreKey(
SECTORFK
@ -317,4 +319,18 @@ class SacadorFragmentNew(
}
adapter?.notifyDataSetChanged()
}
private fun hasSector(): Boolean {
return if (ma.haveSector()) {
true
} else {
ma.messageWithSound(
message = getString(R.string.errorSector),
isError = true,
isPlayed = true,
isToasted = false
)
false
}
}
}