feat reservas #refs 6861
This commit is contained in:
parent
83635cfa2e
commit
59fe13f151
|
@ -53,6 +53,8 @@ object ConstAndValues {
|
|||
const val ENTRYNUMBERIMAGES = "ENTRYNUMBERIMAGES"
|
||||
const val ENTRYTYPE = "ENTRYTYPE"
|
||||
const val BASEURLSALIX = "base_urlSalix"
|
||||
const val BASEURLLILIUM = "base_urlLilium"
|
||||
const val BASE_URL_LILIUM = "https://lilium.verdnatura.es"
|
||||
const val BASE_URL_SALIX = "https://salix.verdnatura.es"
|
||||
const val ENTRY = "ENTRY"
|
||||
const val RENEWINTERVAL = "renewInterval"
|
||||
|
|
|
@ -95,6 +95,18 @@ class SaleAdapterNew(
|
|||
itemParkingCode.setOnClickListener {
|
||||
onPackingClick.onPackingClick(sale)
|
||||
}
|
||||
itemCode.setOnClickListener {
|
||||
onPackingClick.onPackingClick(sale)
|
||||
}
|
||||
|
||||
itemArticleLongInfo.setOnClickListener {
|
||||
onPasillerosItemClickListener.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(
|
||||
title = binding.root.context.getString(R.string.titleItemConsult)
|
||||
), sale.itemFk.toString()
|
||||
)
|
||||
}
|
||||
|
||||
itemArticleItemFkNew.setOnClickListener {
|
||||
onPasillerosItemClickListener.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(
|
||||
|
|
|
@ -369,10 +369,9 @@ class CollectionFragmentPickerNew(
|
|||
|
||||
}
|
||||
|
||||
responseCollectionAddItem.observe(viewLifecycleOwner) {
|
||||
if (!goBack) {
|
||||
loadResponseAddItem.observe(viewLifecycleOwner) { event ->
|
||||
event.getContentIfNotHandled().notNull {
|
||||
updateScreen()
|
||||
goBack = false
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1002,7 +1001,8 @@ class CollectionFragmentPickerNew(
|
|||
viewModel.collectionAddWithReservation(
|
||||
customDialogList.getValue().toInt(),
|
||||
customDialogList.getValueTwo().toInt(),
|
||||
ticketSelected
|
||||
ticketSelected,
|
||||
saleGroupFk = null
|
||||
)
|
||||
|
||||
customDialogList.dismiss()
|
||||
|
|
|
@ -226,7 +226,6 @@ class CollectionFragmentPickerPreviousNew(
|
|||
mpok!!.start()
|
||||
return true
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
} catch (ex: Exception) {
|
||||
|
@ -252,6 +251,7 @@ class CollectionFragmentPickerPreviousNew(
|
|||
private fun setEvents() {
|
||||
|
||||
binding.mainToolbar.backButton.setOnClickListener {
|
||||
println("reserva fuera")
|
||||
ma.onMyBackPressed()
|
||||
}
|
||||
//ESCANER =========
|
||||
|
@ -321,25 +321,6 @@ class CollectionFragmentPickerPreviousNew(
|
|||
|
||||
with(viewModel) {
|
||||
|
||||
/* collectionTicketList.observe(viewLifecycleOwner, Observer {
|
||||
if (!it.isError) {
|
||||
if (it.tickets.isNotEmpty()) {
|
||||
//collection = it
|
||||
createCollectionList()
|
||||
workerFkFromTicket = it.tickets.get(0).sales.get(0).workerFk
|
||||
|
||||
} else {
|
||||
binding.mainToolbar.toolbarSubtitle.text = "0/0"
|
||||
}
|
||||
} else {
|
||||
customDialog.setTitle(getString(R.string.error)).setDescription(it.errorMessage)
|
||||
.setOkButton(getString(R.string.accept)) {
|
||||
customDialog.dismiss()
|
||||
if (activity != null) ma.onMyBackPressed()
|
||||
}.show()
|
||||
}
|
||||
|
||||
})*/
|
||||
loadCollectionTicketSalix.observe(viewLifecycleOwner) { event ->
|
||||
event.getContentIfNotHandled().notNull {
|
||||
if (!it.isError) {
|
||||
|
@ -368,31 +349,6 @@ class CollectionFragmentPickerPreviousNew(
|
|||
}
|
||||
}
|
||||
|
||||
/* collectionTicketSalix.observe(viewLifecycleOwner, Observer {
|
||||
|
||||
if (!it.isError) {
|
||||
|
||||
if (it.tickets.isNotEmpty()) {
|
||||
collection = it
|
||||
createCollectionList()
|
||||
workerFkFromTicket = if (it.tickets[0].sales.isNotEmpty()) {
|
||||
it.tickets[0].sales[0].workerFk.toString()
|
||||
} else {
|
||||
""
|
||||
}
|
||||
|
||||
} else {
|
||||
binding.mainToolbar.toolbarSubtitle.text = "0/0"
|
||||
}
|
||||
} else {
|
||||
customDialog.setTitle(getString(R.string.error)).setDescription(it.errorMessage)
|
||||
.setOkButton(getString(R.string.accept)) {
|
||||
customDialog.dismiss()
|
||||
if (activity != null) ma.onMyBackPressed()
|
||||
}.show()
|
||||
}
|
||||
|
||||
})*/
|
||||
responseExistsItemShelvingSale.observe(viewLifecycleOwner) {
|
||||
if (!goBack) {
|
||||
if (it.exists) {
|
||||
|
@ -416,11 +372,9 @@ class CollectionFragmentPickerPreviousNew(
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
responseCollectionAddItem.observe(viewLifecycleOwner) {
|
||||
if (!goBack) {
|
||||
loadResponseAddItem.observe(viewLifecycleOwner) { event ->
|
||||
event.getContentIfNotHandled().notNull {
|
||||
updateScreen()
|
||||
goBack = false
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -446,16 +400,18 @@ class CollectionFragmentPickerPreviousNew(
|
|||
|
||||
responseConfirmReservedItemShelvingSale.observe(viewLifecycleOwner) {
|
||||
|
||||
|
||||
if (it.isError) {
|
||||
ma.messageWithSound(
|
||||
it.errorMessage, isError = true, true
|
||||
)
|
||||
setTotalLines()
|
||||
}
|
||||
if (!it.isError) {
|
||||
myGroupList[positionConfirm].isPicked = 1
|
||||
saleAdapter!!.notifyDataSetChanged()
|
||||
saleAdapter!!.notifyItemChanged(positionConfirm)
|
||||
lm!!.scrollToPositionWithOffset(storedBackPosition + 1, 0)
|
||||
|
||||
setTotalLines()
|
||||
/*viewModel.collectionTicketGetSalix(
|
||||
collection.collectionFk, print = false
|
||||
)*/
|
||||
|
@ -498,7 +454,7 @@ class CollectionFragmentPickerPreviousNew(
|
|||
lm!!.scrollToPositionWithOffset(positionMarkPrevia, 0)
|
||||
|
||||
ma.messageWithSound(
|
||||
"Previa recogida", it.isError, !it.isError
|
||||
getString(R.string.previousCollected), it.isError, !it.isError
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -540,7 +496,6 @@ class CollectionFragmentPickerPreviousNew(
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private fun createCollectionList() {
|
||||
state = 0
|
||||
binding.mainToolbar.toolbarTitle.text = collection.collectionFk.toString()
|
||||
|
@ -554,7 +509,7 @@ class CollectionFragmentPickerPreviousNew(
|
|||
val myPickingTo = mobileApplication.dataStoreApp.readDataStoreKey<Int>("PICKING_TO")
|
||||
collection.tickets.forEach { ticket ->
|
||||
|
||||
if (!observations.isNullOrEmpty()) observations =
|
||||
if (observations.isNotEmpty()) observations =
|
||||
observations + " " + ticket.observations
|
||||
ticket.sales.forEach { sale ->
|
||||
|
||||
|
@ -573,7 +528,7 @@ class CollectionFragmentPickerPreviousNew(
|
|||
|
||||
//quitar comentarios FALTA AGRUPAR LAS PREVIAS
|
||||
myGroupList =
|
||||
groupSaleGroup(salesList).sortedWith(compareBy<Sale> { it.pickingOrder }.thenBy { it.itemFk })
|
||||
salesList.sortedWith(compareBy<Sale> { it.pickingOrder }.thenBy { it.itemFk })
|
||||
// sales //sales porque no se ggrupan las previas hay que cambiar los estados.
|
||||
|
||||
saleAdapter = SaleAdapterNew(
|
||||
|
@ -598,14 +553,15 @@ class CollectionFragmentPickerPreviousNew(
|
|||
}
|
||||
},
|
||||
object : OnSaleClickSaleListener {
|
||||
override fun onSaleClick(mysale: Sale) {
|
||||
override fun onSaleClick(sale: Sale) {
|
||||
|
||||
var position = myGroupList.indexOfFirst { it.itemShelvingSaleFk == mysale.itemShelvingSaleFk }
|
||||
val position =
|
||||
myGroupList.indexOfFirst { it.itemShelvingSaleFk == sale.itemShelvingSaleFk }
|
||||
if (position > -1) {
|
||||
if (mysale.isPicked ==1){
|
||||
if (sale.isPicked == 1) {
|
||||
unMarkLine(position, myGroupList[position])
|
||||
} else {
|
||||
showScanner(position, mysale)
|
||||
showScanner(position, sale)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1021,7 +977,7 @@ class CollectionFragmentPickerPreviousNew(
|
|||
|
||||
customDialogList.getEditText().setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
||||
if (!customDialogList.getValue().isNullOrEmpty()) {
|
||||
if (customDialogList.getValue().isNotEmpty()) {
|
||||
try {
|
||||
customDialogList.setValue(
|
||||
itemScanValue(
|
||||
|
@ -1070,18 +1026,23 @@ class CollectionFragmentPickerPreviousNew(
|
|||
|
||||
private fun customDialogAddItem() {
|
||||
|
||||
if (!customDialogList.getValueTwo().isNullOrEmpty()) {
|
||||
if (customDialogList.getValueTwo().isNotEmpty()) {
|
||||
if (ticketSelected == 0) {
|
||||
getString(R.string.Seleccionaunticketdelaista).toast(requireContext())
|
||||
} else if (customDialogList.getValue().isNullOrEmpty() || customDialogList.getValueTwo()
|
||||
.isNullOrEmpty()
|
||||
} else if (customDialogList.getValue().isEmpty() || customDialogList.getValueTwo()
|
||||
.isEmpty()
|
||||
) {
|
||||
getString(R.string.Todosloscampossonobligatorios).toast(requireContext())
|
||||
} else {
|
||||
val saleGroupSelected =
|
||||
collection.tickets.find { it.ticketFk == ticketSelected }?.sales?.get(0)?.saleGroupFk
|
||||
?: 0
|
||||
|
||||
viewModel.collectionAddWithReservation(
|
||||
customDialogList.getValue().toInt(),
|
||||
customDialogList.getValueTwo().toInt(),
|
||||
ticketSelected
|
||||
ticketSelected,
|
||||
saleGroupFk = saleGroupSelected
|
||||
)
|
||||
|
||||
customDialogList.dismiss()
|
||||
|
@ -1095,7 +1056,7 @@ class CollectionFragmentPickerPreviousNew(
|
|||
}
|
||||
|
||||
private fun toastDisponibility(item: ItemVO) {
|
||||
if (item.available.isNullOrEmpty()) {
|
||||
if (item.available.isEmpty()) {
|
||||
item.available = "0"
|
||||
}
|
||||
customDialog.setTitle(getString(R.string.itemPoints) + item.id)
|
||||
|
@ -1202,64 +1163,6 @@ class CollectionFragmentPickerPreviousNew(
|
|||
|
||||
}
|
||||
|
||||
private fun groupSaleGroup(salesList: ArrayList<Sale>): MutableList<Sale> {/* var myMap = salesList.groupBy { it.saleGroupFk }
|
||||
var myList: MutableList<Sale> = mutableListOf()
|
||||
|
||||
for ((key, value) in myMap.entries) {
|
||||
if (key == null) { // si no tiene saleGroup se añaden las líneas
|
||||
for (s in value) {
|
||||
myList.add(s)
|
||||
}
|
||||
} else { // si tiene saleGroup se crea el padre con el tamaño e indicando que es padre, como ejemplo se toma el primer elemento
|
||||
|
||||
*//*crea padre*//*
|
||||
if (value.size > 1) {
|
||||
var mySale = //= value[0]
|
||||
Sale(
|
||||
level = value[0].level,
|
||||
isPicked = value[0].isPicked,
|
||||
parkingCode = "Líneas : ${value.size}",
|
||||
pickingOrder = value[0].pickingOrder,
|
||||
workerFk = value[0].workerFk,
|
||||
originalQuantity = value[0].originalQuantity,
|
||||
saleQuantity = 0,
|
||||
saleFk = value[0].saleFk,
|
||||
saleGroupFk = value[0].saleGroupFk,
|
||||
semaphore = value[0].semaphore,
|
||||
ticketFk = value[0].ticketFk,
|
||||
itemFk = value[0].saleGroupFk!!,
|
||||
isAdded = value[0].isAdded,
|
||||
hasMistake = value[0].hasMistake,
|
||||
origin = value[0].origin,
|
||||
size = value[0].size,
|
||||
itemShelvingSaleFk = value[0].itemShelvingSaleFk,
|
||||
longName = value[0].parkingCode ?: ""
|
||||
)
|
||||
|
||||
//prime elemento//hay que hacer una copia si no queda la referencia
|
||||
mySale.totalSales = value.size //total líneas
|
||||
mySale.isParent = true
|
||||
value as MutableList<Sale>
|
||||
mySale.sonSales =
|
||||
value.sortedWith(compareBy { it.isPicked }) as MutableList<Sale>*//*mySale.line1 = "Previa :${mySale.saleGroupFk}"
|
||||
mySale.line2 = "Líneas: ${value.size}"
|
||||
mySale.line3 = value[0].code*//*
|
||||
// mySale.placements = listOf(PlacementVO(shelving = value[0].code!!))
|
||||
|
||||
myList.add(mySale)
|
||||
} else {
|
||||
for (s in value) {
|
||||
myList.add(s)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
return salesList
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -194,6 +194,8 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
|
||||
val loadResponseDel: LiveData<Event<ResponseItemVO>> = _responseDel.map { Event(it) }
|
||||
|
||||
val loadResponseAddItem: LiveData<Event<ResponseItemVO>> = _responseCollectionAddItem.map { Event(it) }
|
||||
|
||||
val loadResponseSaleTrackingMark: LiveData<Event<ResponseItemVO>> =
|
||||
_responseSaleTracking_mark.map { Event(it) }
|
||||
|
||||
|
|
|
@ -35,6 +35,8 @@ class SectorCollectionReserveFragment(
|
|||
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
|
||||
private var listSalesGroup: ArrayList<BarcodeVO> = ArrayList()
|
||||
private var listSaleGroupAdapter: BarcodeAdapter? = null
|
||||
private var onBack = false
|
||||
private var isReserved = false
|
||||
|
||||
val listIcons: ArrayList<ImageView> = ArrayList()
|
||||
|
||||
|
@ -50,6 +52,11 @@ class SectorCollectionReserveFragment(
|
|||
if (context is OnCollectionTicketSelectedListener) onCollectionSelectedListener = context
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
onBack = true
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
override fun init() {
|
||||
|
||||
customDialogList = CustomDialogList(requireContext())
|
||||
|
@ -57,15 +64,28 @@ class SectorCollectionReserveFragment(
|
|||
binding.mainToolbar.toolbarTitle.text = title
|
||||
setEvents()
|
||||
setToolBar()
|
||||
checkParkingsToPicker()
|
||||
|
||||
println("reserve collec $collectionFk")
|
||||
super.init()
|
||||
if (!onBack) {
|
||||
checkParkingsToPicker()
|
||||
} else {
|
||||
if (onBack) {
|
||||
requireActivity().supportFragmentManager.popBackStack()
|
||||
} else {
|
||||
ma.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(title = "titlePrePickerTest"),
|
||||
entryPoint = collectionFk.toString()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkParkingsToPicker() {
|
||||
//Habrá que ver si tiene tickets ya asociados
|
||||
binding.mainToolbar.toolbarTitle.text = collectionFk.toString()
|
||||
showDialogLinkTickets()
|
||||
viewModel.hasSalesReserved(collectionFk)
|
||||
//showDialogLinkTickets()
|
||||
|
||||
}
|
||||
|
||||
|
@ -81,8 +101,8 @@ class SectorCollectionReserveFragment(
|
|||
iconParkingFrom.tooltipText = getString(R.string.editParking)
|
||||
iconReset.tooltipText = getString(R.string.resetParking)
|
||||
|
||||
listIcons.add(iconReset)
|
||||
listIcons.add(iconParkingFrom)
|
||||
//listIcons.add(iconReset)
|
||||
// listIcons.add(iconParkingFrom)
|
||||
|
||||
binding.mainToolbar.toolbarIcons.adapter =
|
||||
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
|
||||
|
@ -108,7 +128,9 @@ class SectorCollectionReserveFragment(
|
|||
}
|
||||
|
||||
private fun showDialogLinkTickets() {
|
||||
|
||||
customDialogList.setOnDismissListener {
|
||||
if (!isReserved) ma.onMyBackPressed()
|
||||
}
|
||||
customDialogList.setTitle(
|
||||
getString(R.string.tickets)
|
||||
)
|
||||
|
@ -132,7 +154,9 @@ class SectorCollectionReserveFragment(
|
|||
ma.hideKeyboard(customDialogList.getEditText())
|
||||
listSalesGroup = ArrayList()
|
||||
customDialogList.dismiss()
|
||||
ma.onMyBackPressed()
|
||||
|
||||
// gotoPicker()
|
||||
/*ma.onMyBackPressed()*/
|
||||
}.setValue("").show()
|
||||
|
||||
customDialogList.getEditText().requestFocus()
|
||||
|
@ -146,8 +170,7 @@ class SectorCollectionReserveFragment(
|
|||
if (listSalesGroup.firstOrNull { it.code == customDialogList.getValue() } == null) {
|
||||
listSalesGroup.add(0, BarcodeVO(code = customDialogList.getValue()))
|
||||
viewModel.sectorCollectionSaleGroupAdd(
|
||||
customDialogList.getValue().toInt(),
|
||||
collectionFk
|
||||
customDialogList.getValue().toInt(), collectionFk
|
||||
)
|
||||
} else {
|
||||
throw Exception(getString(R.string.ticketScanned))
|
||||
|
@ -189,8 +212,8 @@ class SectorCollectionReserveFragment(
|
|||
@SuppressLint("SetTextI18n")
|
||||
private fun setEvents() {
|
||||
|
||||
binding.scanInput.visibility = View.VISIBLE
|
||||
binding.scanInput.setHint(getString(R.string.scanCollection))
|
||||
//binding.scanInput.visibility = View.VISIBLE
|
||||
//binding.scanInput.setHint(getString(R.string.scanCollection))
|
||||
binding.mainToolbar.backButton.setOnClickListener {
|
||||
ma.onMyBackPressed()
|
||||
}
|
||||
|
@ -234,7 +257,6 @@ class SectorCollectionReserveFragment(
|
|||
loadResponseSaleGropAdd.observe(viewLifecycleOwner) { event ->
|
||||
event.getContentIfNotHandled().notNull {
|
||||
|
||||
|
||||
if (it.isError) {
|
||||
listSalesGroup.removeAt(0)
|
||||
ma.messageWithSound(
|
||||
|
@ -246,40 +268,37 @@ class SectorCollectionReserveFragment(
|
|||
|
||||
} else {
|
||||
ma.messageWithSound(
|
||||
message = "",
|
||||
isError = false,
|
||||
isPlayed = true,
|
||||
isToasted = false
|
||||
message = "", isError = false, isPlayed = true, isToasted = false
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
loadResponseHasSaleReserved.observe(viewLifecycleOwner) { event ->
|
||||
event.getContentIfNotHandled().notNull {
|
||||
|
||||
if (it == "1") {
|
||||
isReserved = true
|
||||
gotoPicker()
|
||||
} else {
|
||||
showDialogLinkTickets()
|
||||
}
|
||||
}
|
||||
}
|
||||
loadResponseReserveSectorCollection.observe(viewLifecycleOwner) { event ->
|
||||
event.getContentIfNotHandled().notNull {
|
||||
|
||||
|
||||
if (it.isError) {
|
||||
ma.messageWithSound(
|
||||
it.errorMessage,
|
||||
isError = true,
|
||||
true,
|
||||
isToasted = true
|
||||
it.errorMessage, isError = true, true, isToasted = true
|
||||
)
|
||||
|
||||
} else {
|
||||
ma.messageWithSound(
|
||||
message = "",
|
||||
isError = false,
|
||||
isPlayed = true,
|
||||
isToasted = false
|
||||
message = "", isError = false, isPlayed = true, isToasted = false
|
||||
)
|
||||
customDialogList.dismiss()
|
||||
ma.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(title = "PREITEMPICKERTEST"),
|
||||
entryPoint = collectionFk.toString()
|
||||
)
|
||||
|
||||
//navigateToCollectionList(collectionFk = collectionFk)
|
||||
gotoPicker()
|
||||
//anar a SacadorFragmentNew
|
||||
|
||||
}
|
||||
|
@ -289,4 +308,14 @@ class SectorCollectionReserveFragment(
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
private fun gotoPicker() {
|
||||
if (::customDialogList.isInitialized) customDialogList.dismiss()
|
||||
|
||||
ma.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(title = "PREITEMPICKERTEST"), entryPoint = collectionFk.toString()
|
||||
)
|
||||
onBack = true
|
||||
}
|
||||
|
||||
}
|
|
@ -2,12 +2,10 @@ package es.verdnatura.presentation.view.feature.sacador.fragment
|
|||
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.os.Build
|
||||
import android.text.InputType
|
||||
import android.view.View
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import android.widget.ImageView
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentSacadorBinding
|
||||
|
@ -70,7 +68,7 @@ class SacadorFragmentNew(
|
|||
}
|
||||
|
||||
"PREITEMPICKERTEST" -> {
|
||||
viewModel.sectorCollectionGet()
|
||||
viewModel.sectorCollectionPartial()
|
||||
}
|
||||
|
||||
else -> {
|
||||
|
@ -100,13 +98,10 @@ class SacadorFragmentNew(
|
|||
val iconPrint = ImageView(context)
|
||||
iconPrint.setImageResource(R.drawable.ic_print_black_24dp)
|
||||
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
iconAdd.tooltipText = getTooltip(R.drawable.ic_add_black_24dp)
|
||||
iconVehicleIn.tooltipText = getTooltip(R.drawable.car)
|
||||
iconAdd.tooltipText = getTooltip(R.drawable.ic_add_black_24dp)
|
||||
iconPrint.tooltipText = getTooltip(R.drawable.ic_print_black_24dp)
|
||||
}
|
||||
|
||||
if (type == "PREPARED") {
|
||||
listIcons.add(iconVehicleIn)
|
||||
|
@ -164,7 +159,7 @@ class SacadorFragmentNew(
|
|||
ma.hideKeyboard(customDialogInput.getEditText())
|
||||
|
||||
customDialogInput.getEditText().setOnEditorActionListener { _, actionId, _ ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5 || actionId == 6) {
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
||||
|
||||
print()
|
||||
|
||||
|
@ -210,31 +205,31 @@ class SacadorFragmentNew(
|
|||
|
||||
with(viewModel) {
|
||||
|
||||
collectionListLocal.observe(viewLifecycleOwner, Observer {
|
||||
collectionListLocal.observe(viewLifecycleOwner) {
|
||||
//if (!goBack2)
|
||||
|
||||
createCollectionList(it.list)
|
||||
|
||||
goBack2 = false
|
||||
})
|
||||
}
|
||||
|
||||
collectionList.observe(viewLifecycleOwner, Observer { it ->
|
||||
collectionList.observe(viewLifecycleOwner) { it ->
|
||||
//if (!goBack2)
|
||||
var myCollectionsList = mutableListOf<CollectionTicket>()
|
||||
val myCollectionsList = mutableListOf<CollectionTicket>()
|
||||
it.list.forEach {
|
||||
myCollectionsList.add(CollectionTicket(it.collectionFk))
|
||||
}
|
||||
createCollectionList(myCollectionsList)
|
||||
goBack2 = false
|
||||
})
|
||||
}
|
||||
|
||||
response.observe(viewLifecycleOwner, Observer {
|
||||
response.observe(viewLifecycleOwner) {
|
||||
|
||||
if (it.isError) {
|
||||
ma.messageWithSound(it.errorMessage, true, false)
|
||||
ma.messageWithSound(it.errorMessage, isError = true, isPlayed = false)
|
||||
|
||||
} else {
|
||||
if (!it.response.isNullOrBlank()) {
|
||||
if (it.response.isNotBlank()) {
|
||||
addCollectionToList(it.response.toInt())
|
||||
|
||||
} else {
|
||||
|
@ -249,7 +244,8 @@ class SacadorFragmentNew(
|
|||
|
||||
"PREITEMPICKERTEST" -> {
|
||||
println("SacadorFragmentNew sectorCollectionGET")
|
||||
viewModel.sectorCollectionGet()
|
||||
// viewModel.sectorCollectionGet()
|
||||
viewModel.sectorCollectionPartial()
|
||||
}
|
||||
|
||||
else -> {
|
||||
|
@ -260,7 +256,7 @@ class SacadorFragmentNew(
|
|||
}
|
||||
goBack = false
|
||||
//callBack(type)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -293,8 +289,6 @@ class SacadorFragmentNew(
|
|||
created = getString(R.string.newCreated)
|
||||
)
|
||||
)
|
||||
|
||||
adapter?.notifyDataSetChanged()
|
||||
} else {
|
||||
customDialog.setTitle(getString(R.string.info))
|
||||
.setDescription(getString(R.string.collectionPending) + collection)
|
||||
|
|
|
@ -279,6 +279,48 @@ class SacadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun sectorCollectionPartial() {
|
||||
salix.sectorCollectionGetPartial().enqueue(object :
|
||||
SalixCallback<List<CollectionVO>>(context) {
|
||||
override fun onSuccess(response: Response<List<CollectionVO>>) {
|
||||
|
||||
if (response.body() != null) {
|
||||
_collectionList.value =
|
||||
response.body()?.let { CollectionListVO(it.toDateFormat(context)) }
|
||||
} else {
|
||||
val listError: ArrayList<CollectionVO> = ArrayList()
|
||||
listError.add(
|
||||
CollectionVO(
|
||||
0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
response.message()
|
||||
)
|
||||
)
|
||||
)
|
||||
_collectionList.value = CollectionListVO(listError)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun onError(t: Throwable) {
|
||||
val listError: ArrayList<CollectionVO> = ArrayList()
|
||||
listError.add(
|
||||
CollectionVO(
|
||||
0,
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),
|
||||
t.message!!
|
||||
)
|
||||
)
|
||||
)
|
||||
_collectionList.value = CollectionListVO(listError)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun collectionGetSalix() {
|
||||
salix.getCollectionSalix().enqueue(object :
|
||||
SalixCallback<List<CollectionVO>>(context) {
|
||||
|
|
Loading…
Reference in New Issue