refs #4676 delivery->picking
This commit is contained in:
parent
a068ed3f6c
commit
1771608eff
|
@ -6,12 +6,10 @@ import androidx.recyclerview.widget.RecyclerView
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.ItemExpeditionSummaryRowBinding
|
import es.verdnatura.databinding.ItemExpeditionSummaryRowBinding
|
||||||
import es.verdnatura.presentation.common.OnAddressRowClickListener
|
import es.verdnatura.presentation.common.OnAddressRowClickListener
|
||||||
import es.verdnatura.presentation.common.OnItemCardRowClickListener
|
|
||||||
import es.verdnatura.presentation.common.OnItemImageLoadRowClickListener
|
import es.verdnatura.presentation.common.OnItemImageLoadRowClickListener
|
||||||
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoSummary
|
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoSummary
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ExpeditionSummaryAdapter(
|
class ExpeditionSummaryAdapter(
|
||||||
private val items: List<ExpeditionInfoSummary>,
|
private val items: List<ExpeditionInfoSummary>,
|
||||||
private val onAddressRowClickListener: OnAddressRowClickListener,
|
private val onAddressRowClickListener: OnAddressRowClickListener,
|
||||||
|
@ -47,15 +45,17 @@ class ExpeditionSummaryAdapter(
|
||||||
fun bind(item: ExpeditionInfoSummary) {
|
fun bind(item: ExpeditionInfoSummary) {
|
||||||
binding.apply {
|
binding.apply {
|
||||||
|
|
||||||
if (item.delivery != item.total || item.delivered == item.total)
|
if (item.delivery != item.total) {
|
||||||
|
|
||||||
{
|
|
||||||
fondo.setBackgroundColor(
|
fondo.setBackgroundColor(
|
||||||
res.getColor(R.color.verdnatura_pumpkin_light)
|
res.getColor(R.color.verdnatura_pumpkin_light)
|
||||||
)
|
)
|
||||||
}else{
|
} else {
|
||||||
res.getColor(R.color.verdnatura_black)
|
fondo.setBackgroundColor(res.getColor(R.color.verdnatura_black))
|
||||||
}
|
}
|
||||||
|
if (item.delivered == item.total){
|
||||||
|
fondo.setBackgroundColor(res.getColor(R.color.verdnatura_black))
|
||||||
|
}
|
||||||
|
|
||||||
showExp.setOnClickListener {
|
showExp.setOnClickListener {
|
||||||
onItemImageLoadRowClickListener.onItemImageLoadRowClickListener(item)
|
onItemImageLoadRowClickListener.onItemImageLoadRowClickListener(item)
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,11 +83,12 @@ class RouteAdapter(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.header){
|
if (item.header){
|
||||||
linearLayoutLoadVan.visibility
|
headerRouteLayout.visibility = View.VISIBLE
|
||||||
headerRoute.visibility= View.VISIBLE
|
|
||||||
headerRoute.text = toDateString(item.created)
|
headerRoute.text = toDateString(item.created)
|
||||||
}else{
|
}else{
|
||||||
headerRoute.visibility=View.GONE
|
headerRouteLayout.visibility = View.GONE
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
this.item = item
|
this.item = item
|
||||||
|
|
||||||
|
|
|
@ -133,8 +133,24 @@ class LoadUnloadFragment(
|
||||||
android.app.AlertDialog.BUTTON_NEUTRAL, getString(R.string.save)
|
android.app.AlertDialog.BUTTON_NEUTRAL, getString(R.string.save)
|
||||||
) { dialog, which ->
|
) { dialog, which ->
|
||||||
counterCalls = 2
|
counterCalls = 2
|
||||||
viewModel.expeditionState_add(list.filter { it.code == state }, state)
|
if (list.filter { it.code == state }.isEmpty()){
|
||||||
viewModel.expeditionState_add(list.filter { it.code != state }, "LOST")
|
counterCalls--
|
||||||
|
}else{
|
||||||
|
viewModel.expeditionState_add(list.filter { it.code == state }, state)
|
||||||
|
}
|
||||||
|
if (list.filter { it.code != state && it.code != "FOUND" }.isEmpty()){
|
||||||
|
counterCalls--
|
||||||
|
}else{
|
||||||
|
viewModel.expeditionState_add(
|
||||||
|
list.filter { it.code != state && it.code != "FOUND" },
|
||||||
|
"LOST"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
/*viewModel.expeditionState_add(list.filter { it.code == state }, state)
|
||||||
|
viewModel.expeditionState_add(
|
||||||
|
list.filter { it.code != state && it.code != "FOUND" },
|
||||||
|
"LOST"
|
||||||
|
)*/
|
||||||
}
|
}
|
||||||
alertDialog.setButton(
|
alertDialog.setButton(
|
||||||
android.app.AlertDialog.BUTTON_POSITIVE, getString(R.string.ordenar)
|
android.app.AlertDialog.BUTTON_POSITIVE, getString(R.string.ordenar)
|
||||||
|
@ -206,7 +222,7 @@ class LoadUnloadFragment(
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.scanInput.requestFocus()
|
binding.scanInput.requestFocus()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun markExpedition(expedNumber: Int, state: String) {
|
private fun markExpedition(expedNumber: Int, state: String) {
|
||||||
|
@ -229,7 +245,14 @@ class LoadUnloadFragment(
|
||||||
ma.messageWithSound("", true, true, isToasted = null)
|
ma.messageWithSound("", true, true, isToasted = null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateCount(myList, state)
|
|
||||||
|
if (binding.mainToolbar.switchButton.isChecked) {
|
||||||
|
counterCalls = 1
|
||||||
|
binding.splashProgress.visibility = View.VISIBLE
|
||||||
|
viewModel.expeditionState_add(myList.filter { it.code == state }, state)
|
||||||
|
} else {
|
||||||
|
updateCount(myList, state)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
|
@ -256,7 +279,11 @@ class LoadUnloadFragment(
|
||||||
counterResponse = counterResponse + 1
|
counterResponse = counterResponse + 1
|
||||||
if (counterResponse == counterCalls) {
|
if (counterResponse == counterCalls) {
|
||||||
// viewModel.getExpeditionFromRoute(route)
|
// viewModel.getExpeditionFromRoute(route)
|
||||||
requireActivity().onBackPressed()
|
if (!binding.mainToolbar.switchButton.isChecked) {
|
||||||
|
requireActivity().onBackPressed()
|
||||||
|
} else {
|
||||||
|
binding.mainToolbar.switchButton.isChecked = false
|
||||||
|
}
|
||||||
counterResponse = 0
|
counterResponse = 0
|
||||||
counterCalls = 0
|
counterCalls = 0
|
||||||
}
|
}
|
||||||
|
@ -271,16 +298,17 @@ class LoadUnloadFragment(
|
||||||
binding.mainToolbar.switchButton.tooltipText = getString(R.string.expeditionMarkLost)
|
binding.mainToolbar.switchButton.tooltipText = getString(R.string.expeditionMarkLost)
|
||||||
binding.mainToolbar.switchButton.setOnCheckedChangeListener { buttonView, isChecked ->
|
binding.mainToolbar.switchButton.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||||
binding.mainToolbar.switchButton.tooltipText = if (isChecked)
|
binding.mainToolbar.switchButton.tooltipText = if (isChecked)
|
||||||
getString(R.string.expeditionMarkLost) else
|
getString(R.string.expeditionMarkFound) else
|
||||||
getString(R.string.expeditionMarkFound)
|
getString(R.string.expeditionMarkLost)
|
||||||
|
|
||||||
|
|
||||||
if (isChecked) {
|
binding.mainToolbar.toolbarTitle.text = if (isChecked) {
|
||||||
binding.mainToolbar.toolbarTitle.text =
|
|
||||||
getString(R.string.loading)
|
|
||||||
} else {
|
|
||||||
getString(R.string.unloading)
|
getString(R.string.unloading)
|
||||||
|
} else {
|
||||||
|
getString(R.string.loading)
|
||||||
}
|
}
|
||||||
|
getString(R.string.unloading)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -297,15 +325,15 @@ class LoadUnloadFragment(
|
||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
db.expedicionDao().insert(list.filter { it.routeFk == route }
|
db.expedicionDao().insert(list.filter { it.routeFk == route }
|
||||||
)
|
)
|
||||||
myList = db.expedicionDao().getAll(route) as MutableList<ExpeditionInfoLoadUnload>
|
myList = db.expedicionDao().getAll(route) as MutableList<ExpeditionInfoLoadUnload>
|
||||||
// myList = list as MutableList<ExpeditionInfoLoadUnload>
|
// myList = list as MutableList<ExpeditionInfoLoadUnload>
|
||||||
}
|
}
|
||||||
if (addressFk != 0) {
|
if (addressFk != 0) {
|
||||||
myList =
|
myList =
|
||||||
myList.filter { it.addressFk == addressFk } as MutableList<ExpeditionInfoLoadUnload>
|
myList.filter { it.addressFk == addressFk } as MutableList<ExpeditionInfoLoadUnload>
|
||||||
}else{
|
} else {
|
||||||
myList.filter{
|
myList.filter {
|
||||||
it.routeFk == route
|
it.routeFk == route
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,21 +118,21 @@
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/itemcard_layout"
|
android:id="@+id/itemcard_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="0dp"
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
tools:ignore="ExtraText"
|
tools:ignore="ExtraText"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/divider">
|
app:layout_constraintTop_toTopOf="@+id/divider">
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:descendantFocusability="blocksDescendants">
|
android:descendantFocusability="blocksDescendants">
|
||||||
|
|
||||||
<!--android:id="@+id/itemexpeditionstate_recyclerview"-->
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/expeditionSummary_recyclerview"
|
android:id="@+id/expeditionSummary_recyclerview"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -50,14 +50,16 @@
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/itemcard_layout"
|
android:id="@+id/itemcard_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="0dp"
|
||||||
android:padding="5dp"
|
android:padding="5dp"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
tools:ignore="ExtraText"
|
tools:ignore="ExtraText"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/divider">
|
app:layout_constraintTop_toTopOf="@+id/divider"
|
||||||
|
>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -17,8 +17,9 @@
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:id="@+id/headerRouteLayout"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="30dp"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
|
Loading…
Reference in New Issue