refs #4678
This commit is contained in:
parent
491a4f8762
commit
44b8713915
|
@ -2,10 +2,12 @@ package es.verdnatura.db
|
|||
|
||||
import android.content.Context
|
||||
import androidx.room.*
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoLoadUnload
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoPending
|
||||
|
||||
|
||||
// Clase que representa la base de datos
|
||||
@Database(entities = [Expedicion::class], version = 1)
|
||||
@Database(entities = [ExpeditionInfoLoadUnload::class,ExpeditionInfoPending::class], version = 1)
|
||||
abstract class ExpedicionDatabase : RoomDatabase() {
|
||||
abstract fun expedicionDao(): ExpedicionDao
|
||||
|
||||
|
@ -18,7 +20,7 @@ abstract class ExpedicionDatabase : RoomDatabase() {
|
|||
val instance = Room.databaseBuilder(
|
||||
context.applicationContext,
|
||||
ExpedicionDatabase::class.java,
|
||||
"expedicion_database"
|
||||
"expedition_database"
|
||||
)
|
||||
.fallbackToDestructiveMigration()
|
||||
.build()
|
||||
|
@ -29,24 +31,22 @@ abstract class ExpedicionDatabase : RoomDatabase() {
|
|||
}
|
||||
}
|
||||
|
||||
// Clase que representa la entidad Expedicion
|
||||
@Entity(tableName = "expediciones")
|
||||
data class Expedicion(
|
||||
@PrimaryKey val id: Int,
|
||||
val nombre: String,
|
||||
val fecha: Long
|
||||
)
|
||||
|
||||
// Interfaz que define los métodos de acceso a datos para Expedicion
|
||||
@Dao
|
||||
interface ExpedicionDao {
|
||||
@Query("SELECT * FROM expediciones")
|
||||
suspend fun getAll(): List<Expedicion>
|
||||
@Query("SELECT * FROM expedition e WHERE e.routeFk = :parametro1")
|
||||
suspend fun getAll(parametro1:Int): List<ExpeditionInfoLoadUnload>
|
||||
|
||||
@Query("SELECT * FROM expeditionPending")
|
||||
suspend fun getAllPending(): List<ExpeditionInfoLoadUnload>
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
suspend fun insert(expedicion: Expedicion)
|
||||
suspend fun insert(expedition:MutableList<ExpeditionInfoLoadUnload>)
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
suspend fun insertPending(expeditionPending:MutableList<ExpeditionInfoPending>)
|
||||
|
||||
@Delete
|
||||
fun delete(expedicion: Expedicion)
|
||||
fun delete(expedition: ExpeditionInfoLoadUnload)
|
||||
}
|
||||
|
||||
|
|
|
@ -16,10 +16,12 @@ import androidx.databinding.DataBindingUtil
|
|||
import androidx.databinding.ViewDataBinding
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.preference.PreferenceManager
|
||||
import androidx.room.Room
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.ToolbarFragmentBinding
|
||||
import es.verdnatura.db.ExpedicionDatabase
|
||||
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
|
||||
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
|
||||
import es.verdnatura.presentation.view.feature.login.model.WorkForms
|
||||
|
@ -54,6 +56,8 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
|
|||
protected val TRAINNAME = "trainName"
|
||||
protected val TRAINFK = "trainFk"
|
||||
protected val WORKFORMSELECTED = "workFormSelected"
|
||||
protected val SUPPLIERID = "SUPPLIERID"
|
||||
|
||||
|
||||
protected val ITEMPACKING = "itemPackingType"
|
||||
protected val ITEMPACKINGFK = "itemPackingTypeFk"
|
||||
|
@ -144,6 +148,8 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@LayoutRes
|
||||
abstract fun getLayoutId(): Int
|
||||
open fun init() {}
|
||||
|
@ -506,6 +512,7 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
|
|||
WAREHOUSEFK -> prefs.getInt(name, WAREHOUSEFKDEFAULT)
|
||||
PRINTERFK -> prefs.getInt(name, 0)
|
||||
USERFK -> prefs.getInt(USERFK, 0)
|
||||
SUPPLIERID->prefs.getInt(SUPPLIERID,0)
|
||||
else -> {
|
||||
0
|
||||
}
|
||||
|
@ -660,7 +667,7 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
|
|||
urlSalix = "https://test-salix.verdnatura.es"
|
||||
)
|
||||
)
|
||||
var working_in_test = false
|
||||
var working_in_test = true
|
||||
if (working_in_test) {
|
||||
saveWorkForm(
|
||||
WorkForms(
|
||||
|
@ -830,94 +837,13 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
|
|||
|
||||
}
|
||||
|
||||
fun database(myContext:Context): ExpedicionDatabase {
|
||||
|
||||
/*open fun wordToNumber(input: String?): Int {
|
||||
var input = input
|
||||
var isValidInput = true
|
||||
var result = 0
|
||||
var finalResult = 0
|
||||
if (input != null && input.length > 0) {
|
||||
input = input.replace("-".toRegex(), " ")
|
||||
input = input.toLowerCase().replace(" and".toRegex(), " ")
|
||||
val splittedParts =
|
||||
input.trim { it <= ' ' }.split("\\s+".toRegex()).toTypedArray()
|
||||
for (str in splittedParts) {
|
||||
if (!es.verdnatura.warehouse.UTILS.Utils.allowedStrings.contains(str)) {
|
||||
isValidInput = false
|
||||
return -1
|
||||
}
|
||||
}
|
||||
if (isValidInput) {
|
||||
for (str in splittedParts) {
|
||||
if (str.equals("cero", ignoreCase = true)) {
|
||||
result += 0
|
||||
} else if (str.equals("uno", ignoreCase = true)) {
|
||||
result += 1
|
||||
} else if (str.equals("dos", ignoreCase = true)) {
|
||||
result += 2
|
||||
} else if (str.equals("tres", ignoreCase = true)) {
|
||||
result += 3
|
||||
} else if (str.equals("cuatro", ignoreCase = true)) {
|
||||
result += 4
|
||||
} else if (str.equals("cinco", ignoreCase = true)) {
|
||||
result += 5
|
||||
} else if (str.equals("seis", ignoreCase = true)) {
|
||||
result += 6
|
||||
} else if (str.equals("siete", ignoreCase = true)) {
|
||||
result += 7
|
||||
} else if (str.equals("ocho", ignoreCase = true)) {
|
||||
result += 8
|
||||
} else if (str.equals("nueve", ignoreCase = true)) {
|
||||
result += 9
|
||||
} else if (str.equals("diez", ignoreCase = true)) {
|
||||
result += 10
|
||||
} else if (str.equals("once", ignoreCase = true)) {
|
||||
result += 11
|
||||
} else if (str.equals("doce", ignoreCase = true)) {
|
||||
result += 12
|
||||
} else if (str.equals("trece", ignoreCase = true)) {
|
||||
result += 13
|
||||
} else if (str.equals("catorce", ignoreCase = true)) {
|
||||
result += 14
|
||||
} else if (str.equals("quince", ignoreCase = true)) {
|
||||
result += 15
|
||||
} else if (str.equals("dieziseis", ignoreCase = true)) {
|
||||
result += 16
|
||||
} else if (str.equals("diezisiete", ignoreCase = true)) {
|
||||
result += 17
|
||||
} else if (str.equals("dieziocho", ignoreCase = true)) {
|
||||
result += 18
|
||||
} else if (str.equals("diezinueve", ignoreCase = true)) {
|
||||
result += 19
|
||||
} else if (str.equals("veinte", ignoreCase = true)) {
|
||||
result += 20
|
||||
} else if (str.equals("treinta", ignoreCase = true)) {
|
||||
result += 30
|
||||
} else if (str.equals("cuarenta", ignoreCase = true)) {
|
||||
result += 40
|
||||
} else if (str.equals("cincuenta", ignoreCase = true)) {
|
||||
result += 50
|
||||
} else if (str.equals("sesenta", ignoreCase = true)) {
|
||||
result += 60
|
||||
} else if (str.equals("setenta", ignoreCase = true)) {
|
||||
result += 70
|
||||
} else if (str.equals("ochenta", ignoreCase = true)) {
|
||||
result += 80
|
||||
} else if (str.equals("noventa", ignoreCase = true)) {
|
||||
result += 90
|
||||
} else if (str.equals("cien", ignoreCase = true)) {
|
||||
result *= 100
|
||||
} else if (str.equals("mil", ignoreCase = true)) {
|
||||
result *= 1000
|
||||
finalResult += result
|
||||
result = 0
|
||||
}
|
||||
}
|
||||
finalResult += result
|
||||
return finalResult
|
||||
}
|
||||
}
|
||||
return finalResult
|
||||
}*/
|
||||
val db = Room.databaseBuilder(
|
||||
myContext,
|
||||
ExpedicionDatabase::class.java, "expediciones.db"
|
||||
).build()
|
||||
return db
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -50,11 +50,11 @@ class ExpeditionLoadUnloadAdapter(
|
|||
)
|
||||
|
||||
"PALLETIZED" -> expeditionView.setBackgroundColor(
|
||||
getColor(expeditionView.context, R.color.verdnatura_black)
|
||||
getColor(expeditionView.context, R.color.verdnatura_black_5)
|
||||
)
|
||||
else -> {
|
||||
expeditionView.setBackgroundColor(
|
||||
getColor(expeditionView.context, R.color.verdnatura_black)
|
||||
getColor(expeditionView.context, R.color.verdnatura_black_5)
|
||||
)
|
||||
|
||||
}
|
||||
|
|
|
@ -56,20 +56,6 @@ class ExpeditionSummaryAdapter(
|
|||
}else{
|
||||
res.getColor(R.color.verdnatura_black)
|
||||
}
|
||||
|
||||
|
||||
/* if (item.lost == item.total || (item.lost!! > 0 && item.lost == item.total))
|
||||
{
|
||||
fondo.setBackgroundColor(
|
||||
res.getColor(R.color.verdnatura_pumpkin_orange)
|
||||
)
|
||||
}
|
||||
if (item.delivered != null && item.delivered == item.total
|
||||
) {
|
||||
fondo.setBackgroundColor(
|
||||
res.getColor(R.color.verdnatura_black)
|
||||
)
|
||||
}*/
|
||||
showExp.setOnClickListener {
|
||||
onItemImageLoadRowClickListener.onItemImageLoadRowClickListener(item)
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package es.verdnatura.presentation.view.feature.delivery.fragments
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageInfo
|
||||
import android.content.pm.PackageManager
|
||||
|
@ -9,14 +10,10 @@ import android.view.View
|
|||
import android.view.inputmethod.EditorInfo
|
||||
import android.widget.ImageView
|
||||
import android.widget.Toast
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.room.Room
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentExpeditionLoadunloadDeliveryBinding
|
||||
import es.verdnatura.db.Expedicion
|
||||
import es.verdnatura.db.ExpedicionDatabase
|
||||
import es.verdnatura.domain.toast
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
|
@ -25,9 +22,6 @@ import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
|||
import es.verdnatura.presentation.view.feature.delivery.adapters.ExpeditionLoadUnloadAdapter
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoLoadUnload
|
||||
import es.verdnatura.presentation.view.feature.delivery.viewmodels.DeliveryViewModel
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.json.JSONObject
|
||||
|
||||
|
||||
|
@ -47,6 +41,7 @@ class LoadUnloadFragment(
|
|||
private var counterResponse = 0
|
||||
private var route = 0
|
||||
private var addressFk = 0
|
||||
private lateinit var db: ExpedicionDatabase
|
||||
|
||||
companion object {
|
||||
fun newInstance(title: String, state: String, entryPoint: String) =
|
||||
|
@ -57,51 +52,25 @@ class LoadUnloadFragment(
|
|||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
override fun init() {
|
||||
|
||||
route = JSONObject(entryPoint).get("route").toString().toInt()
|
||||
addressFk = JSONObject(entryPoint).get("address").toString().toInt()
|
||||
try {
|
||||
route = JSONObject(entryPoint).get("route").toString().toInt()
|
||||
addressFk = JSONObject(entryPoint).get("address").toString().toInt()
|
||||
} catch (ex: Exception) {
|
||||
}
|
||||
|
||||
setEvents()
|
||||
setToolBar()
|
||||
setSwitchButon()
|
||||
binding.scanInput.requestFocus()
|
||||
viewModel.getExpeditionFromRoute(route)
|
||||
|
||||
super.init()
|
||||
database()
|
||||
|
||||
}
|
||||
|
||||
private fun database() {
|
||||
|
||||
val db = Room.databaseBuilder(
|
||||
requireContext().applicationContext,
|
||||
ExpedicionDatabase::class.java, "expediciones.db"
|
||||
).build()
|
||||
|
||||
// Para insertar una expedición en la base de datos, puedes hacer lo siguiente:
|
||||
/* val expedicion = Expedicion(12345, "Mi expedición", System.currentTimeMillis())
|
||||
db.expedicionDao().insert(expedicion)*/
|
||||
|
||||
// val myViewModel = ViewModelProvider(this).get(DatabaseViewModel::class.java)
|
||||
|
||||
lifecycleScope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
val expedicion = Expedicion(12345, "Mi expedición", System.currentTimeMillis())
|
||||
db.expedicionDao().insert(expedicion)
|
||||
var expediciones = db.expedicionDao().getAll()
|
||||
for (e in expediciones) {
|
||||
println("la exp es " + e.nombre)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Para obtener todas las expediciones de la base de datos, puedes hacer lo siguiente:
|
||||
|
||||
/* db.expedicionDao().getAll().observe(viewLifecycleOwner) { expediciones ->
|
||||
// actualizar la vista con las expediciones
|
||||
}
|
||||
val expediciones = db.expedicionDao().getAll()
|
||||
for (e in expediciones) {
|
||||
println("El nombre de la exp es " + e.nombre)
|
||||
}*/
|
||||
override fun onAttach(context: Context) {
|
||||
super.onAttach(context)
|
||||
// db = database(requireContext().applicationContext)
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
|
@ -109,6 +78,7 @@ class LoadUnloadFragment(
|
|||
ma.hideBottomNavigation(View.GONE)
|
||||
binding.mainToolbar.toolbarTitle.visibility = View.VISIBLE
|
||||
binding.mainToolbar.toolbarSubtitle.visibility = View.VISIBLE
|
||||
binding.mainToolbar.toolbarSubtitle.setTextColor(requireContext().getColor((R.color.verdnatura_pumpkin_orange)))
|
||||
binding.mainToolbar.toolbarIcons.visibility = View.VISIBLE
|
||||
binding.mainToolbar.switchButton.visibility = if (state != "DELIVERED") {
|
||||
View.VISIBLE
|
||||
|
@ -132,8 +102,6 @@ class LoadUnloadFragment(
|
|||
|
||||
when (item) {
|
||||
iconConfirm.drawable -> {
|
||||
// openAppDelivery()
|
||||
//requireActivity().finish()
|
||||
setExpeditionsState(myList, state)
|
||||
}
|
||||
}
|
||||
|
@ -150,22 +118,21 @@ class LoadUnloadFragment(
|
|||
|
||||
if (list.filter { it.code == state }.size == list.size) {
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
|
||||
viewModel.expeditionState_add(list.filter { it.code == state }, state)
|
||||
counterCalls = 1
|
||||
} else {
|
||||
val alertDialog = android.app.AlertDialog.Builder(requireContext()).create()
|
||||
alertDialog.setTitle("Información")
|
||||
alertDialog.setMessage("El total de expediciones escaneadas es diferente al total de la ruta. ¿ Quieres guardar las expediciones escaneadas o buscar la/s expedición/es ?")
|
||||
alertDialog.setTitle(getString(R.string.info))
|
||||
alertDialog.setMessage(getString(R.string.expeditionTotal))
|
||||
alertDialog.setButton(
|
||||
android.app.AlertDialog.BUTTON_NEUTRAL, "GUARDAR"
|
||||
android.app.AlertDialog.BUTTON_NEUTRAL, getString(R.string.save)
|
||||
) { dialog, which ->
|
||||
counterCalls = 2
|
||||
viewModel.expeditionState_add(list.filter { it.code == state }, state)
|
||||
viewModel.expeditionState_add(list.filter { it.code != state }, "LOST")
|
||||
}
|
||||
alertDialog.setButton(
|
||||
android.app.AlertDialog.BUTTON_POSITIVE, "ORDENAR"
|
||||
android.app.AlertDialog.BUTTON_POSITIVE, getString(R.string.ordenar)
|
||||
) { dialog, which ->
|
||||
createList(list.sortedByDescending { it.code })
|
||||
}
|
||||
|
@ -192,21 +159,13 @@ class LoadUnloadFragment(
|
|||
"verdnatura.es.repartoverdnatura.ExpeditionSummaryActivity"
|
||||
)
|
||||
}
|
||||
// i.putExtra("routeId", binding.route.text)
|
||||
i.putExtra("app", "picking")
|
||||
startActivity(i)
|
||||
}
|
||||
|
||||
private fun setEvents() {
|
||||
binding.mainToolbar.backButton.setOnClickListener {
|
||||
requireActivity().onBackPressed()
|
||||
/*val callback = object : OnBackPressedCallback(true /* enabled by default */) {
|
||||
override fun handleOnBackPressed() {
|
||||
println("volviendo antras")
|
||||
}
|
||||
}
|
||||
|
||||
requireActivity().onBackPressedDispatcher.addCallback(viewLifecycleOwner, callback)*/
|
||||
requireActivity().onBackPressed()
|
||||
}
|
||||
|
||||
binding.scanInput.setOnEditorActionListener { _, actionId, _ ->
|
||||
|
@ -214,7 +173,6 @@ class LoadUnloadFragment(
|
|||
if (!binding.scanInput.text.isNullOrEmpty()) {
|
||||
|
||||
try {
|
||||
//viewModel.expeditionLoadUnload_get(binding.scanInput.toInt())
|
||||
markExpedition(
|
||||
binding.scanInput.text.toString().toInt(),
|
||||
if (!binding.mainToolbar.switchButton.isChecked) {
|
||||
|
@ -265,10 +223,7 @@ class LoadUnloadFragment(
|
|||
ma.messageWithSound("", true, true, isToasted = null)
|
||||
}
|
||||
}
|
||||
|
||||
updateCount(myList, state)
|
||||
|
||||
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
|
@ -294,7 +249,8 @@ class LoadUnloadFragment(
|
|||
if (!it.isError) {
|
||||
counterResponse = counterResponse + 1
|
||||
if (counterResponse == counterCalls) {
|
||||
viewModel.getExpeditionFromRoute(route)
|
||||
// viewModel.getExpeditionFromRoute(route)
|
||||
requireActivity().onBackPressed()
|
||||
counterResponse = 0
|
||||
counterCalls = 0
|
||||
}
|
||||
|
@ -306,13 +262,12 @@ class LoadUnloadFragment(
|
|||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
private fun setSwitchButon() {
|
||||
|
||||
binding.mainToolbar.switchButton.tooltipText = getString(R.string.expeditionMarkLost)
|
||||
binding.mainToolbar.switchButton.setOnCheckedChangeListener { buttonView, isChecked ->
|
||||
binding.mainToolbar.switchButton.tooltipText = if (isChecked)
|
||||
getString(R.string.expeditionMarkLost) else
|
||||
getString(R.string.expeditionMarkFound)
|
||||
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
|
||||
if (isChecked) {
|
||||
binding.mainToolbar.toolbarTitle.text =
|
||||
|
@ -326,8 +281,9 @@ class LoadUnloadFragment(
|
|||
|
||||
private fun createList(list: List<ExpeditionInfoLoadUnload>) {
|
||||
myList = list as MutableList<ExpeditionInfoLoadUnload>
|
||||
if (addressFk!=0){
|
||||
myList= list.filter{it.addressFk==addressFk} as MutableList<ExpeditionInfoLoadUnload>
|
||||
if (addressFk != 0) {
|
||||
myList =
|
||||
list.filter { it.addressFk == addressFk } as MutableList<ExpeditionInfoLoadUnload>
|
||||
}
|
||||
adapter = ExpeditionLoadUnloadAdapter(myList)
|
||||
binding.expeditionloadunloadRecyclerview.adapter = adapter
|
||||
|
@ -335,9 +291,27 @@ class LoadUnloadFragment(
|
|||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
binding.mainToolbar.toolbarSubtitle.text =
|
||||
getString(R.string.summaryCount, myList.filter { it.code == state }.size, myList.size)
|
||||
|
||||
setListPosition(list)
|
||||
|
||||
}
|
||||
|
||||
/* private fun updateExpeditionTable(list: MutableList<ExpeditionInfoLoadUnload>) {
|
||||
lifecycleScope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
for (l in list) {
|
||||
println("la route es $route y $addressFk")
|
||||
if (l.addressFk == addressFk) {
|
||||
|
||||
var newList =
|
||||
db.expedicionDao().insert(list.filter { it.routeFk == route }.filter { it.addressFk == addressFk } as MutableList<ExpeditionInfoLoadUnload>)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
private fun setListPosition(list: MutableList<ExpeditionInfoLoadUnload>) {
|
||||
for (i in list.indices) {
|
||||
if (list[i].code != state) {
|
||||
|
@ -348,8 +322,12 @@ class LoadUnloadFragment(
|
|||
}
|
||||
|
||||
private fun updateCount(list: MutableList<ExpeditionInfoLoadUnload>, state: String) {
|
||||
val countMarked = list.filter { it.code == state }.size/list.filter { it.code == state }.size
|
||||
binding.mainToolbar.toolbarSubtitle.text = getString(R.string.summaryCount, countMarked, list.size)
|
||||
|
||||
val countMarked =
|
||||
list.filter { it.code == state }.size
|
||||
binding.mainToolbar.toolbarSubtitle.text =
|
||||
getString(R.string.summaryCount, countMarked, list.size)
|
||||
|
||||
if (countMarked == list.size) {
|
||||
setExpeditionsState(list, state)
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package es.verdnatura.presentation.view.feature.delivery.model
|
||||
|
||||
import androidx.room.Entity
|
||||
import androidx.room.PrimaryKey
|
||||
import java.text.SimpleDateFormat
|
||||
|
||||
class FreeLanceDeliveryInfoList(
|
||||
|
@ -55,18 +57,33 @@ class ExpeditionList(
|
|||
var list: List<ExpeditionInfoLoadUnload> = listOf()
|
||||
)
|
||||
|
||||
@Entity(tableName = "expedition")
|
||||
class ExpeditionInfoLoadUnload(
|
||||
var id: Int,
|
||||
@PrimaryKey var id: Int,
|
||||
var ticketFk: Int,
|
||||
var routeFk: Int,
|
||||
var addressFk: Int,
|
||||
var itemPackingTypeConcat: String,
|
||||
var itemPackingTypeConcat: String?,
|
||||
var city: String,
|
||||
var street: String,
|
||||
var code: String?,
|
||||
var nickname: String,
|
||||
var postalCode: Int
|
||||
)
|
||||
@Entity(tableName = "expeditionPending")
|
||||
class ExpeditionInfoPending(
|
||||
@PrimaryKey var id: Int,
|
||||
var ticketFk: Int,
|
||||
var routeFk: Int,
|
||||
var addressFk: Int,
|
||||
var itemPackingTypeConcat: String?,
|
||||
var city: String,
|
||||
var street: String,
|
||||
var code: String?,
|
||||
var nickname: String,
|
||||
var postalCode: Int
|
||||
)
|
||||
|
||||
|
||||
class ExpeditionSummaryList(
|
||||
var list: List<ExpeditionInfoSummary> = listOf()
|
||||
|
|
|
@ -110,11 +110,11 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
if (extras != null && extras.containsKey("menu")) {
|
||||
comeFromDelivery = true
|
||||
val option = extras.getString("menu")
|
||||
|
||||
saveDataInt("USERFK", extras.getString("userfk")!!.toInt())
|
||||
saveUserAccesPref(
|
||||
extras.getString("user").toString(),
|
||||
extras.getString("password").toString()
|
||||
|
||||
)
|
||||
|
||||
when (option) {
|
||||
|
@ -142,6 +142,35 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
|
||||
), getString(R.string.titleInfo)
|
||||
)
|
||||
"summary"->{
|
||||
|
||||
onPasillerosItemClickListener(
|
||||
PasillerosItemVO(
|
||||
30,
|
||||
R.drawable.ic_info,
|
||||
getString(R.string.titleDeliverySummary),
|
||||
R.string.titleDeliverySummary,
|
||||
getString(
|
||||
R.string.titleDeliverySummary
|
||||
)
|
||||
|
||||
),extras.getString("route").toString()
|
||||
)
|
||||
}
|
||||
"unload"->{
|
||||
onPasillerosItemClickListener(
|
||||
PasillerosItemVO(
|
||||
30,
|
||||
R.drawable.ic_info,
|
||||
getString(R.string.titleInfo),
|
||||
R.string.titleInfo,
|
||||
getString(
|
||||
R.string.titleInfoDescription
|
||||
)
|
||||
|
||||
), getString(R.string.titleInfo)
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -670,7 +699,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
getString(R.string.titleDeliverySummary) -> {
|
||||
|
||||
addFragmentOnTop(
|
||||
SummaryFragment.newInstance(item.title, "ON DELIVERY"),
|
||||
SummaryFragment.newInstance(item.title, "ON DELIVERY",entryPoint.toInt()),
|
||||
if (comeFromDelivery == true) {
|
||||
getString(R.string.titleDeliverySummary)
|
||||
} else {
|
||||
|
@ -724,7 +753,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
getString(
|
||||
R.string.titleInfo
|
||||
)
|
||||
)
|
||||
) || backEntry!!.contains(getString(R.string.titleDeliverySummary))
|
||||
) {
|
||||
finish()
|
||||
}
|
||||
|
|
|
@ -9,13 +9,13 @@
|
|||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
>
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/scan_input"
|
||||
|
@ -25,16 +25,24 @@
|
|||
android:inputType="text"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
/>
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/main_toolbar"/>
|
||||
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/lineMenu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="@dimen/layout_margin_min"
|
||||
android:layout_marginBottom="@dimen/layout_margin_1"
|
||||
android:paddingLeft="@dimen/layout_margin_1"
|
||||
android:paddingRight="@dimen/layout_margin_1">
|
||||
android:paddingRight="@dimen/layout_margin_1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/scan_input">
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -66,25 +74,7 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/verdnatura_white"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/itemcard_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="ExtraText">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:descendantFocusability="blocksDescendants">
|
||||
|
||||
<!--android:id="@+id/itemexpeditionstate_recyclerview"-->
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/expeditionloadunload_recyclerview"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -92,20 +82,8 @@
|
|||
android:clipToPadding="false"
|
||||
android:visibility="visible"
|
||||
tools:listitem="@layout/item_expedition_loadunload_row" />
|
||||
</RelativeLayout>>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<ScrollView
|
||||
android:id="@+id/scroll_view"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
||||
|
||||
<include
|
||||
android:id="@+id/main_toolbar"
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:text="Ruta"
|
||||
android:text="@string/Ruta"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
|
@ -60,7 +60,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Cajas"
|
||||
android:text="@string/boxes"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
@ -70,7 +70,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Tipo"
|
||||
android:text="@string/type"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
@ -80,7 +80,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Escan"
|
||||
android:text="@string/scanAbrev"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
@ -90,7 +90,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Perdidas"
|
||||
android:text="@string/lost"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
@ -100,7 +100,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="Entregadas"
|
||||
android:text="@string/deliveredMenu"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
@ -152,7 +152,6 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<include
|
||||
|
|
|
@ -17,7 +17,14 @@
|
|||
android:layout_margin="@dimen/ef_item_padding"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
<LinearLayout
|
||||
android:id="@+id/expeditionDivider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/verdnatura_white"
|
||||
android:orientation="horizontal" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/expeditionConsign"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -98,9 +105,6 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/verdnatura_white" />
|
||||
|
||||
</LinearLayout>
|
||||
</layout>
|
|
@ -18,6 +18,7 @@
|
|||
<color name="verdnatura_red">#e74c3c</color>
|
||||
<color name="verdnatura_warm_brown">#8b4200</color>
|
||||
<color name="verdnatura_pumpkin_orange">#f7931e</color>
|
||||
<color name="verdnatura_pumpkin_light">#f77956</color>
|
||||
<color name="verdnatura_sunflower_yellow">#ffd400</color>
|
||||
<color name="verdnatura_dark_sky_blue">#4ab4e6</color>
|
||||
<color name="verdnatura_dark_green_verdnatura">#a3d131</color>
|
||||
|
|
Loading…
Reference in New Issue