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.content.Context
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import androidx.lifecycle.Observer
|
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.adapter.CollectionAdapter
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||||
|
|
||||||
//private var getCollections = false
|
|
||||||
|
|
||||||
class SacadorFragment :
|
class SacadorFragment :
|
||||||
BaseFragment<FragmentSacadorBinding, SacadorViewModel>(SacadorViewModel::class) {
|
BaseFragment<FragmentSacadorBinding, SacadorViewModel>(SacadorViewModel::class) {
|
||||||
|
@ -33,7 +31,6 @@ class SacadorFragment :
|
||||||
private var adapter: CollectionAdapter? = null
|
private var adapter: CollectionAdapter? = null
|
||||||
private var resultTagMode: String? = ""
|
private var resultTagMode: String? = ""
|
||||||
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun newInstance() = SacadorFragment()
|
fun newInstance() = SacadorFragment()
|
||||||
}
|
}
|
||||||
|
@ -45,7 +42,6 @@ class SacadorFragment :
|
||||||
|
|
||||||
override fun getLayoutId(): Int = R.layout.fragment_sacador
|
override fun getLayoutId(): Int = R.layout.fragment_sacador
|
||||||
|
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
|
|
||||||
customDialog = CustomDialog(requireContext())
|
customDialog = CustomDialog(requireContext())
|
||||||
|
@ -54,49 +50,10 @@ class SacadorFragment :
|
||||||
binding.mainToolbar.toolbarTitle.text = getString(R.string.getcollection)
|
binding.mainToolbar.toolbarTitle.text = getString(R.string.getcollection)
|
||||||
setToolBar()
|
setToolBar()
|
||||||
setEvents()
|
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()
|
viewModel.collectionGetSalix()
|
||||||
} else {
|
|
||||||
viewModel.collectionGet(
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
//}
|
|
||||||
super.init()
|
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() {
|
override fun onPause() {
|
||||||
goBack = true
|
goBack = true
|
||||||
goBack2 = true
|
goBack2 = true
|
||||||
|
@ -135,10 +92,6 @@ class SacadorFragment :
|
||||||
|
|
||||||
iconAdd.drawable -> {
|
iconAdd.drawable -> {
|
||||||
binding.splashProgress.visibility = View.VISIBLE
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
// checkTagsMode()
|
|
||||||
//Tarea 4351 cambiar getData(WAGON) por getData(NUMBEROFWAGONS)
|
|
||||||
|
|
||||||
//Tarea 4520
|
|
||||||
viewModel.collection_assign(
|
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() {
|
override fun observeViewModel() {
|
||||||
|
|
||||||
with(viewModel) {
|
with(viewModel) {
|
||||||
|
@ -204,17 +122,7 @@ class SacadorFragment :
|
||||||
binding.splashProgress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
goBack2 = false
|
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 {
|
response.observe(viewLifecycleOwner, Observer {
|
||||||
binding.splashProgressTwo.visibility = View.GONE
|
binding.splashProgressTwo.visibility = View.GONE
|
||||||
binding.splashProgress.visibility = View.GONE
|
binding.splashProgress.visibility = View.GONE
|
||||||
|
@ -225,52 +133,9 @@ class SacadorFragment :
|
||||||
if (goBack) addCollectionToList(it.response.toInt())
|
if (goBack) addCollectionToList(it.response.toInt())
|
||||||
}
|
}
|
||||||
goBack = false
|
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()
|
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) {
|
private fun navigateToCollectionList(collection: CollectionVO) {
|
||||||
collectionsList.add(collection)
|
collectionsList.add(collection)
|
||||||
adapter?.notifyDataSetChanged()
|
adapter?.notifyDataSetChanged()
|
||||||
|
|
||||||
onCollectionSelectedListener?.onCollectionSelected(collection, SACADOR)
|
onCollectionSelectedListener?.onCollectionSelected(collection, SACADOR)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,22 +6,24 @@ import es.verdnatura.presentation.common.convertToDateString
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import kotlin.collections.ArrayList
|
|
||||||
|
|
||||||
fun List<CollectionVO>.toDateFormat(context:Context): ArrayList<CollectionVO> {
|
fun List<CollectionVO>.toDateFormat(context: Context): ArrayList<CollectionVO> {
|
||||||
val collections : ArrayList<CollectionVO> = ArrayList()
|
val collections: ArrayList<CollectionVO> = ArrayList()
|
||||||
this.forEach {
|
this.forEach {
|
||||||
collections.add(CollectionVO(
|
collections.add(
|
||||||
|
CollectionVO(
|
||||||
collectionFk = it.collectionFk,
|
collectionFk = it.collectionFk,
|
||||||
created = getCalendarFromDate(it.created,context).convertToDateString()
|
created = getCalendarFromDate(it.created, context).convertToDateString(),
|
||||||
))
|
ticketTotalCount = it.ticketTotalCount
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
return collections
|
return collections
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun getCalendarFromDate(date:String,context:Context): Calendar {
|
private fun getCalendarFromDate(date: String, context: Context): Calendar {
|
||||||
val sdf = SimpleDateFormat(context.getString(R.string.dateFormat))
|
val sdf = SimpleDateFormat(context.getString(R.string.dateFormat))
|
||||||
val cal = Calendar.getInstance()
|
val cal = Calendar.getInstance()
|
||||||
cal.time = sdf.parse(date)!!
|
cal.time = sdf.parse(date)!!
|
||||||
|
|
|
@ -11,7 +11,8 @@ class CollectionVO(
|
||||||
var isError: Boolean = false,
|
var isError: Boolean = false,
|
||||||
var errorMessage: String = "",
|
var errorMessage: String = "",
|
||||||
var itemPackingTypeFk: String = "",
|
var itemPackingTypeFk: String = "",
|
||||||
var rgb: String? = null
|
var rgb: String? = null,
|
||||||
|
var ticketTotalCount: Int? = null
|
||||||
)
|
)
|
||||||
|
|
||||||
class TicketVO(
|
class TicketVO(
|
||||||
|
@ -68,9 +69,13 @@ class SaleVO(
|
||||||
var packingShelve: String = "",
|
var packingShelve: String = "",
|
||||||
|
|
||||||
var picked: String = "",
|
var picked: String = "",
|
||||||
|
var isParent: Boolean = false,
|
||||||
|
var totalSales: Int = 0,
|
||||||
|
var sonSales: MutableList<SaleVO> = mutableListOf(),
|
||||||
|
var code: String = ""
|
||||||
|
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
class PlacementVO(
|
class PlacementVO(
|
||||||
var saleFk: String = "",
|
var saleFk: String = "",
|
||||||
|
|
|
@ -41,6 +41,15 @@
|
||||||
android:textSize="@dimen/h7"
|
android:textSize="@dimen/h7"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:layout_marginLeft="@dimen/pasilleros_margin_main_menu"/>
|
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
|
<ImageView
|
||||||
android:layout_marginLeft="@dimen/default_layout_margin"
|
android:layout_marginLeft="@dimen/default_layout_margin"
|
||||||
|
|
|
@ -544,5 +544,6 @@
|
||||||
<string name="freelance">Porteador</string>
|
<string name="freelance">Porteador</string>
|
||||||
<string name="errorScanned">Texto escaneado no válido</string>
|
<string name="errorScanned">Texto escaneado no válido</string>
|
||||||
<string name="deleteQuantity">Va a eliminar la cantidad del artículo:</string>
|
<string name="deleteQuantity">Va a eliminar la cantidad del artículo:</string>
|
||||||
|
<string name="tickets">" Tickets:"</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
<string name="Nivel">Level:</string>
|
<string name="Nivel">Level:</string>
|
||||||
<string name="de">of</string>
|
<string name="de">of</string>
|
||||||
<string name="Ticket">Ticket</string>
|
<string name="Ticket">Ticket</string>
|
||||||
|
<string name="tickets">Tickets:</string>
|
||||||
<string name="Concepto">Concept</string>
|
<string name="Concepto">Concept</string>
|
||||||
<string name="SinServir">NoServing</string>
|
<string name="SinServir">NoServing</string>
|
||||||
<string name="Aparcado">Parked</string>
|
<string name="Aparcado">Parked</string>
|
||||||
|
|
Loading…
Reference in New Issue