feat reservas refs #6861
This commit is contained in:
parent
56fe4c3486
commit
aefc872465
|
@ -214,6 +214,12 @@ interface SalixService {
|
||||||
@Query("params") params: Any? = null
|
@Query("params") params: Any? = null
|
||||||
): Call<Any>
|
): Call<Any>
|
||||||
|
|
||||||
|
@POST("Applications/itemShelvingSale_addBySaleGroup/execute-proc")
|
||||||
|
fun getReserveBySaleGroup(
|
||||||
|
@Query("schema") schema: String = "vn",
|
||||||
|
@Query("params") params: Any? = null
|
||||||
|
): Call<Any>
|
||||||
|
|
||||||
@POST("Applications/collection_addWithReservation/execute-proc")
|
@POST("Applications/collection_addWithReservation/execute-proc")
|
||||||
fun collectionAddWithReservation(
|
fun collectionAddWithReservation(
|
||||||
@Query("schema") schema: String = "vn",
|
@Query("schema") schema: String = "vn",
|
||||||
|
|
|
@ -27,7 +27,7 @@ import es.verdnatura.presentation.view.feature.sacador.model.CollectionTicket
|
||||||
|
|
||||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||||
class SectorCollectionReserveFragment(
|
class SectorCollectionReserveFragment(
|
||||||
var title: String = "", var collectionFk: Int = 0
|
var title: String = "", var collectionFk: Int = 0, var hasToAdd: Boolean = false
|
||||||
) : BaseFragment<FragmentGeneralBlackBinding, PreSacadorViewModel>(
|
) : BaseFragment<FragmentGeneralBlackBinding, PreSacadorViewModel>(
|
||||||
PreSacadorViewModel::class
|
PreSacadorViewModel::class
|
||||||
) {
|
) {
|
||||||
|
@ -42,8 +42,8 @@ class SectorCollectionReserveFragment(
|
||||||
val listIcons: ArrayList<ImageView> = ArrayList()
|
val listIcons: ArrayList<ImageView> = ArrayList()
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun newInstance(title: String, collectionFk: Int) =
|
fun newInstance(title: String, collectionFk: Int, hasToAdd: Boolean) =
|
||||||
SectorCollectionReserveFragment(title, collectionFk)
|
SectorCollectionReserveFragment(title, collectionFk, hasToAdd)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getLayoutId(): Int = R.layout.fragment_general_black
|
override fun getLayoutId(): Int = R.layout.fragment_general_black
|
||||||
|
@ -59,6 +59,7 @@ class SectorCollectionReserveFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
|
println("hasToAdd $hasToAdd")
|
||||||
|
|
||||||
customDialogList = CustomDialogList(requireContext())
|
customDialogList = CustomDialogList(requireContext())
|
||||||
ma.hideBottomNavigation(View.GONE)
|
ma.hideBottomNavigation(View.GONE)
|
||||||
|
@ -133,7 +134,7 @@ class SectorCollectionReserveFragment(
|
||||||
|
|
||||||
private fun showDialogLinkTickets() {
|
private fun showDialogLinkTickets() {
|
||||||
customDialogList.setOnDismissListener {
|
customDialogList.setOnDismissListener {
|
||||||
// if (!isReserved) ma.onMyBackPressed()
|
// if (!isReserved) ma.onMyBackPressed()
|
||||||
}
|
}
|
||||||
customDialogList.setTitle(
|
customDialogList.setTitle(
|
||||||
getString(R.string.tickets)
|
getString(R.string.tickets)
|
||||||
|
@ -144,7 +145,11 @@ class SectorCollectionReserveFragment(
|
||||||
).setOkButton(getString(R.string.book)) {
|
).setOkButton(getString(R.string.book)) {
|
||||||
try {
|
try {
|
||||||
//Reservar colección
|
//Reservar colección
|
||||||
viewModel.getReserveBySectorCollection(collectionFk)
|
if (!hasToAdd) {
|
||||||
|
viewModel.getReserveBySectorCollection(collectionFk)
|
||||||
|
} else {
|
||||||
|
gotoPicker()
|
||||||
|
}
|
||||||
} catch (ex: Exception) {
|
} catch (ex: Exception) {
|
||||||
ma.messageWithSound(
|
ma.messageWithSound(
|
||||||
message = getString(R.string.errorInput),
|
message = getString(R.string.errorInput),
|
||||||
|
@ -288,7 +293,7 @@ class SectorCollectionReserveFragment(
|
||||||
loadResponseHasSaleReserved.observe(viewLifecycleOwner) { event ->
|
loadResponseHasSaleReserved.observe(viewLifecycleOwner) { event ->
|
||||||
event.getContentIfNotHandled().notNull {
|
event.getContentIfNotHandled().notNull {
|
||||||
|
|
||||||
if (it > 0) {
|
if (it > 0 && !hasToAdd) {
|
||||||
isReserved = true
|
isReserved = true
|
||||||
gotoPicker()
|
gotoPicker()
|
||||||
} else {
|
} else {
|
||||||
|
@ -302,7 +307,11 @@ class SectorCollectionReserveFragment(
|
||||||
message = "", isError = false, isPlayed = true, isToasted = false
|
message = "", isError = false, isPlayed = true, isToasted = false
|
||||||
)
|
)
|
||||||
listSalesGroup.add(BarcodeVO(code = it.toString()))
|
listSalesGroup.add(BarcodeVO(code = it.toString()))
|
||||||
listSaleGroupAdapter!!.notifyItemInserted(listSalesGroup.size -1 )
|
listSaleGroupAdapter!!.notifyItemInserted(listSalesGroup.size - 1)
|
||||||
|
|
||||||
|
if (hasToAdd) {
|
||||||
|
viewModel.getReserveBySaleGroup(it)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loadResponseReserveSectorCollection.observe(viewLifecycleOwner) { event ->
|
loadResponseReserveSectorCollection.observe(viewLifecycleOwner) { event ->
|
||||||
|
@ -325,6 +334,23 @@ class SectorCollectionReserveFragment(
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
loadResponseReserveSaleGroup.observe(viewLifecycleOwner) { event ->
|
||||||
|
event.getContentIfNotHandled().notNull {
|
||||||
|
|
||||||
|
if (it.isError) {
|
||||||
|
ma.messageWithSound(
|
||||||
|
it.errorMessage, isError = true, true, isToasted = true
|
||||||
|
)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
ma.messageWithSound(
|
||||||
|
message = "", isError = false, isPlayed = true, isToasted = false
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -335,7 +361,7 @@ class SectorCollectionReserveFragment(
|
||||||
ma.onPasillerosItemClickListener(
|
ma.onPasillerosItemClickListener(
|
||||||
PasillerosItemVO(title = "PREITEMPICKERTEST"), entryPoint = collectionFk.toString()
|
PasillerosItemVO(title = "PREITEMPICKERTEST"), entryPoint = collectionFk.toString()
|
||||||
)
|
)
|
||||||
// onBack = true
|
// onBack = true
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue