refs #4755 mostrar tickets
This commit is contained in:
parent
fd2f0d430e
commit
fd80d694cc
|
@ -3,7 +3,6 @@ package es.verdnatura.presentation.view.feature.sacador.fragment
|
|||
import android.content.Context
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import androidx.lifecycle.Observer
|
||||
|
@ -20,7 +19,6 @@ import es.verdnatura.presentation.view.component.CustomDialog
|
|||
import es.verdnatura.presentation.view.feature.sacador.adapter.CollectionAdapter
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
|
||||
//private var getCollections = false
|
||||
|
||||
class SacadorFragment :
|
||||
BaseFragment<FragmentSacadorBinding, SacadorViewModel>(SacadorViewModel::class) {
|
||||
|
@ -33,7 +31,6 @@ class SacadorFragment :
|
|||
private var adapter: CollectionAdapter? = null
|
||||
private var resultTagMode: String? = ""
|
||||
|
||||
|
||||
companion object {
|
||||
fun newInstance() = SacadorFragment()
|
||||
}
|
||||
|
@ -45,7 +42,6 @@ class SacadorFragment :
|
|||
|
||||
override fun getLayoutId(): Int = R.layout.fragment_sacador
|
||||
|
||||
|
||||
override fun init() {
|
||||
|
||||
customDialog = CustomDialog(requireContext())
|
||||
|
@ -54,49 +50,10 @@ class SacadorFragment :
|
|||
binding.mainToolbar.toolbarTitle.text = getString(R.string.getcollection)
|
||||
setToolBar()
|
||||
setEvents()
|
||||
|
||||
/* if (getCollections) {
|
||||
viewModel.collection_new_smart(
|
||||
getData(USER),
|
||||
getData(PASSWORD),
|
||||
getData(SECTORFK),
|
||||
getData(WAGON),
|
||||
getData(TAGSTYPE)
|
||||
)
|
||||
|
||||
} else {*/
|
||||
val working_in_test = true //sergio: Ok en app
|
||||
if (!working_in_test) {
|
||||
viewModel.collectionGetSalix()
|
||||
} else {
|
||||
viewModel.collectionGet(
|
||||
)
|
||||
}
|
||||
|
||||
//}
|
||||
super.init()
|
||||
}
|
||||
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
/* setFragmentResultListener("requestKey") { _, bundle ->
|
||||
|
||||
val result = bundle.getString("tagMode")
|
||||
|
||||
resultTagMode = result
|
||||
if (result.equals(getString(R.string.complete)) && getData(TAGSTYPE).equals(getString(R.string.smarttags))) {
|
||||
getCollections = true
|
||||
|
||||
} else {
|
||||
getCollections = false
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
goBack = true
|
||||
goBack2 = true
|
||||
|
@ -135,10 +92,6 @@ class SacadorFragment :
|
|||
|
||||
iconAdd.drawable -> {
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
// checkTagsMode()
|
||||
//Tarea 4351 cambiar getData(WAGON) por getData(NUMBEROFWAGONS)
|
||||
|
||||
//Tarea 4520
|
||||
viewModel.collection_assign(
|
||||
)
|
||||
|
||||
|
@ -159,41 +112,6 @@ class SacadorFragment :
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* private fun checkTagsMode() {
|
||||
|
||||
//sergio:codigo smarttags
|
||||
//Tarea 4351 cambiar getData(WAGON por NUMBEROFWAGONS)
|
||||
if (getData(TAGSTYPE).equals(getString(R.string.stickers))) {
|
||||
viewModel.collectionNew(
|
||||
getData(USER),
|
||||
getData(PASSWORD),
|
||||
getData(SECTORFK),
|
||||
getData(NUMBEROFWAGONS)
|
||||
)
|
||||
} else if (getCollections) {
|
||||
|
||||
viewModel.collection_new_smart(
|
||||
getData(USER),
|
||||
getData(PASSWORD),
|
||||
getData(SECTORFK),
|
||||
getData(WAGON),
|
||||
getData(TAGSTYPE)
|
||||
)
|
||||
|
||||
} else {
|
||||
requireActivity().addFragment(
|
||||
AssociateSmartTagsFragment.newInstance(AssociateSmartTagsFragment.TAG),
|
||||
R.id.main_frame_layout,
|
||||
AssociateSmartTagsFragment.TAG
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
|
||||
}*/
|
||||
|
||||
|
||||
override fun observeViewModel() {
|
||||
|
||||
with(viewModel) {
|
||||
|
@ -204,17 +122,7 @@ class SacadorFragment :
|
|||
binding.splashProgress.visibility = View.GONE
|
||||
goBack2 = false
|
||||
})
|
||||
/* collectionTicketList.observe(viewLifecycleOwner, Observer {
|
||||
binding.splashProgress_two.visibility = View.GONE
|
||||
if (it.isError){
|
||||
customDialog.setTitle(getString(R.string.error)).setDescription(it.errorMessage).setOkButton(getString(R.string.accept)){
|
||||
customDialog.dismiss()
|
||||
}.show()
|
||||
}else{
|
||||
if (!goBack)navigateToCollectionList(it)
|
||||
}
|
||||
goBack = false
|
||||
})*/
|
||||
|
||||
response.observe(viewLifecycleOwner, Observer {
|
||||
binding.splashProgressTwo.visibility = View.GONE
|
||||
binding.splashProgress.visibility = View.GONE
|
||||
|
@ -225,52 +133,9 @@ class SacadorFragment :
|
|||
if (goBack) addCollectionToList(it.response.toInt())
|
||||
}
|
||||
goBack = false
|
||||
//sergio:para asegurarnos que aparece en pantalla.
|
||||
|
||||
val working_in_test = true //sergio: ok en app SACADOR
|
||||
if (!working_in_test) {
|
||||
viewModel.collectionGetSalix()
|
||||
} else {
|
||||
viewModel.collectionGet()
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
/* responseCollectionSmart.observe(viewLifecycleOwner, Observer {
|
||||
binding.splashProgress.visibility = View.GONE
|
||||
|
||||
getCollections = false
|
||||
if (!goBack) {
|
||||
if (it.isError) {
|
||||
ma.messageWithSound(it.errorMessage, true, false)
|
||||
|
||||
} else {
|
||||
|
||||
viewModel.smartTagInsertTicket(it.response)
|
||||
|
||||
goBack = false
|
||||
}
|
||||
}
|
||||
})*/
|
||||
|
||||
|
||||
/* registerSmarttagInsert.observe(viewLifecycleOwner, Observer {
|
||||
|
||||
if (!goBack) {
|
||||
if (it.isError) {
|
||||
ma.messageWithSound(it.errorMessage, true, false)
|
||||
getCollections = true
|
||||
} else {
|
||||
ma.messageWithSound(getString(R.string.ticketInsert), false, false)
|
||||
getCollections = false
|
||||
viewModel.collectionGetSalix(getData(TOKEN))
|
||||
}
|
||||
goBack = false
|
||||
}
|
||||
})
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -318,7 +183,6 @@ class SacadorFragment :
|
|||
private fun navigateToCollectionList(collection: CollectionVO) {
|
||||
collectionsList.add(collection)
|
||||
adapter?.notifyDataSetChanged()
|
||||
|
||||
onCollectionSelectedListener?.onCollectionSelected(collection, SACADOR)
|
||||
}
|
||||
|
||||
|
|
|
@ -6,15 +6,17 @@ import es.verdnatura.presentation.common.convertToDateString
|
|||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
fun List<CollectionVO>.toDateFormat(context: Context): ArrayList<CollectionVO> {
|
||||
val collections: ArrayList<CollectionVO> = ArrayList()
|
||||
this.forEach {
|
||||
collections.add(CollectionVO(
|
||||
collections.add(
|
||||
CollectionVO(
|
||||
collectionFk = it.collectionFk,
|
||||
created = getCalendarFromDate(it.created,context).convertToDateString()
|
||||
))
|
||||
created = getCalendarFromDate(it.created, context).convertToDateString(),
|
||||
ticketTotalCount = it.ticketTotalCount
|
||||
)
|
||||
)
|
||||
|
||||
}
|
||||
return collections
|
||||
|
|
|
@ -11,7 +11,8 @@ class CollectionVO(
|
|||
var isError: Boolean = false,
|
||||
var errorMessage: String = "",
|
||||
var itemPackingTypeFk: String = "",
|
||||
var rgb: String? = null
|
||||
var rgb: String? = null,
|
||||
var ticketTotalCount: Int? = null
|
||||
)
|
||||
|
||||
class TicketVO(
|
||||
|
@ -68,6 +69,10 @@ class SaleVO(
|
|||
var packingShelve: String = "",
|
||||
|
||||
var picked: String = "",
|
||||
var isParent: Boolean = false,
|
||||
var totalSales: Int = 0,
|
||||
var sonSales: MutableList<SaleVO> = mutableListOf(),
|
||||
var code: String = ""
|
||||
|
||||
|
||||
)
|
||||
|
|
|
@ -41,6 +41,15 @@
|
|||
android:textSize="@dimen/h7"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/pasilleros_margin_main_menu"/>
|
||||
<TextView
|
||||
android:id="@+id/totalTicketsId"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:text="@{@string/tickets + String.valueOf(item.ticketTotalCount)}"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="@dimen/h7"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/packaging_margin_main_menu"/>
|
||||
|
||||
<ImageView
|
||||
android:layout_marginLeft="@dimen/default_layout_margin"
|
||||
|
|
|
@ -544,5 +544,6 @@
|
|||
<string name="freelance">Porteador</string>
|
||||
<string name="errorScanned">Texto escaneado no válido</string>
|
||||
<string name="deleteQuantity">Va a eliminar la cantidad del artículo:</string>
|
||||
<string name="tickets">" Tickets:"</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
<string name="Nivel">Level:</string>
|
||||
<string name="de">of</string>
|
||||
<string name="Ticket">Ticket</string>
|
||||
<string name="tickets">Tickets:</string>
|
||||
<string name="Concepto">Concept</string>
|
||||
<string name="SinServir">NoServing</string>
|
||||
<string name="Aparcado">Parked</string>
|
||||
|
|
Loading…
Reference in New Issue