refs #6028 silex→salix

This commit is contained in:
Sergio De la torre 2023-12-05 12:34:21 +01:00
parent e1f3eafcaf
commit 642ed4c283
5 changed files with 17 additions and 15 deletions

View File

@ -11,7 +11,7 @@
"type": "SINGLE", "type": "SINGLE",
"filters": [], "filters": [],
"attributes": [], "attributes": [],
"versionCode": 238, "versionCode": 239,
"versionName": "23.48Beta", "versionName": "23.48Beta",
"outputFile": "app-beta-release.apk" "outputFile": "app-beta-release.apk"
} }

View File

@ -124,6 +124,10 @@ interface SalixService {
@Query("filter") filter: Any, @Query("filter") filter: Any,
): Call<MutableList<ClientTicket>> ): Call<MutableList<ClientTicket>>
@GET("Routes/getByWorker")
fun getRoutes(
): Call<MutableList<RouteInfo>>
@POST("Applications/{routine}/execute-proc") @POST("Applications/{routine}/execute-proc")
fun executeProc( fun executeProc(

View File

@ -33,7 +33,6 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import java.util.Date import java.util.Date
class RoutesFragment( class RoutesFragment(
var title: String = "" var title: String = ""
) : BaseFragment<FragmentRouteBinding, DeliveryViewModel>( ) : BaseFragment<FragmentRouteBinding, DeliveryViewModel>(
@ -60,11 +59,10 @@ class RoutesFragment(
setToolBar() setToolBar()
binding.scanInput.requestFocus() binding.scanInput.requestFocus()
pendingOperations() pendingOperations()
callBack(viewModel.getRoutes(mobileApplication.userId!!)) callBack(viewModel.getRoutes(mobileApplication.userId!!))
} }
private fun pendingOperations() { private fun pendingOperations() {
db = database(requireContext().applicationContext) db = database(requireContext().applicationContext)
if (mobileApplication.hasNetwork) { if (mobileApplication.hasNetwork) {
@ -129,13 +127,11 @@ class RoutesFragment(
} }
} }
private fun callBack(callBackEndPoint: Unit) { private fun callBack(callBackEndPoint: Unit) {
binding.splashProgress.visibility = View.VISIBLE binding.splashProgress.visibility = View.VISIBLE
return callBackEndPoint return callBackEndPoint
} }
@RequiresApi(Build.VERSION_CODES.O) @RequiresApi(Build.VERSION_CODES.O)
private fun setToolBar() { private fun setToolBar() {
ma.hideBottomNavigation(View.GONE) ma.hideBottomNavigation(View.GONE)
@ -229,10 +225,8 @@ class RoutesFragment(
getString(R.string.deliveryApp).toast(context) getString(R.string.deliveryApp).toast(context)
} }
} }
private fun setEvents() { private fun setEvents() {
binding.mainToolbar.backButton.setOnClickListener { binding.mainToolbar.backButton.setOnClickListener {
requireActivity().onBackPressed() requireActivity().onBackPressed()
@ -265,7 +259,6 @@ class RoutesFragment(
adapter!!.updateList(filteredList) adapter!!.updateList(filteredList)
} }
@RequiresApi(Build.VERSION_CODES.O) @RequiresApi(Build.VERSION_CODES.O)
override fun observeViewModel() { override fun observeViewModel() {
with(viewModel) { with(viewModel) {
@ -319,10 +312,8 @@ class RoutesFragment(
} }
private fun createListRoutes(list: MutableList<RouteInfo>, getSaved: Boolean = false) { private fun createListRoutes(list: MutableList<RouteInfo>, getSaved: Boolean = false) {
lifecycleScope.launch { lifecycleScope.launch {
withContext(Dispatchers.IO) { withContext(Dispatchers.IO) {
@ -353,8 +344,6 @@ class RoutesFragment(
} }
"showTickets" -> { "showTickets" -> {
//println("La ruta de los tickets es: " + item.id)
//openAppDelivery(item)
ma.onPasillerosItemClickListener( ma.onPasillerosItemClickListener(
PasillerosItemVO(title = getString(R.string.tickets)), PasillerosItemVO(title = getString(R.string.tickets)),
Gson().toJson(item) Gson().toJson(item)
@ -364,7 +353,11 @@ class RoutesFragment(
} }
}, myListRouteLoaded }, if (::myListRouteLoaded.isInitialized) {
myListRouteLoaded
} else {
listOf()
}
) )
binding.routeRecyclerview.addItemDecoration( binding.routeRecyclerview.addItemDecoration(
@ -385,7 +378,6 @@ class RoutesFragment(
} }
} }
private fun setListPosition(list: MutableList<ExpeditionInfoLoadUnload>) { private fun setListPosition(list: MutableList<ExpeditionInfoLoadUnload>) {
for (i in list.indices) { for (i in list.indices) {
binding.routeRecyclerview.scrollToPosition(i) binding.routeRecyclerview.scrollToPosition(i)

View File

@ -3,6 +3,7 @@ package es.verdnatura.presentation.view.feature.delivery.model
import androidx.room.Entity import androidx.room.Entity
import androidx.room.PrimaryKey import androidx.room.PrimaryKey
import androidx.room.TypeConverters import androidx.room.TypeConverters
import com.google.gson.annotations.SerializedName
import es.verdnatura.db.MapTypeConverter import es.verdnatura.db.MapTypeConverter
import java.io.Serializable import java.io.Serializable
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
@ -142,11 +143,14 @@ class RouteLoaded(
@Entity(tableName = "routes") @Entity(tableName = "routes")
class RouteInfo( class RouteInfo(
@PrimaryKey var id: Long, @PrimaryKey var id: Long,
@SerializedName(value = "driver", alternate = ["workerUserName"])
var driver: String, var driver: String,
var hour: String?, var hour: String?,
@TypeConverters(MapTypeConverter::class) var created: Date, @TypeConverters(MapTypeConverter::class) var created: Date,
var m3: Double, var m3: Double,
@SerializedName(value = "numberPlate", alternate = ["vehiclePlateNumber"])
var numberPlate: String?, var numberPlate: String?,
@SerializedName(value = "name", alternate = ["agencyName"])
var name: String, var name: String,
var kmStart: Long, var kmStart: Long,
var kmEnd: Long, var kmEnd: Long,

View File

@ -328,6 +328,8 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
fun getRoutes( fun getRoutes(
workerFk: Int workerFk: Int
) { ) {
//Redmine 6028 falta que le pongan el email y PR
//salix.getRoutes()
silex.getRoutes(workerFk) silex.getRoutes(workerFk)
.enqueue(object : SilexCallback<MutableList<RouteInfo>>(context) { .enqueue(object : SilexCallback<MutableList<RouteInfo>>(context) {