refs #6275 feat: back to Salix
This commit is contained in:
parent
ec6d1fd4af
commit
c264406f0e
|
@ -4,7 +4,7 @@ import android.content.Context
|
|||
import androidx.room.*
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ClientTicket
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ClientTicketSalix
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoLoadUnload
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoPending
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.MyLocation
|
||||
|
@ -17,7 +17,7 @@ import java.util.Date
|
|||
|
||||
// Clase que representa la base de datos
|
||||
@Database(
|
||||
entities = [ExpeditionInfoLoadUnload::class, ExpeditionInfoPending::class, SignedTickets::class, RouteInfo::class, ClientTicket::class, RouteLoaded::class],
|
||||
entities = [ExpeditionInfoLoadUnload::class, ExpeditionInfoPending::class, SignedTickets::class, RouteInfo::class, ClientTicketSalix::class, RouteLoaded::class],
|
||||
version = 1
|
||||
)
|
||||
@TypeConverters(MapTypeConverter::class)
|
||||
|
@ -114,10 +114,10 @@ interface RoutesDao {
|
|||
@Dao
|
||||
interface ClientTicketDao {
|
||||
@Query("SELECT * FROM clientTickets ")
|
||||
suspend fun getAll(): List<ClientTicket>
|
||||
suspend fun getAll(): List<ClientTicketSalix>
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
suspend fun insert(routes: List<ClientTicket>)
|
||||
suspend fun insert(routes: List<ClientTicketSalix>)
|
||||
|
||||
@Query("DELETE FROM clientTickets ")
|
||||
suspend fun delete()
|
||||
|
|
|
@ -15,7 +15,7 @@ import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
|
|||
import es.verdnatura.presentation.view.feature.collection.SalixSaleQuantity
|
||||
import es.verdnatura.presentation.view.feature.collection.listSaleSalix
|
||||
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.model.DeviceId
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ClientTicket
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ClientTicketSalix
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.DeliveryInfo
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoLoadUnload
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoLog
|
||||
|
@ -129,7 +129,7 @@ interface SalixService {
|
|||
@GET("Routes/getTickets")
|
||||
fun getTickets(
|
||||
@Query("filter") filter: Any,
|
||||
): Call<MutableList<ClientTicket>>
|
||||
): Call<MutableList<ClientTicketSalix>>
|
||||
|
||||
@GET("Routes/getByWorker")
|
||||
fun getRoutes(
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package es.verdnatura.presentation.view.feature.delivery.activity
|
||||
|
||||
import android.Manifest
|
||||
import android.content.DialogInterface
|
||||
import android.content.pm.PackageManager
|
||||
import android.graphics.Bitmap
|
||||
import android.location.Location
|
||||
|
@ -21,7 +20,7 @@ import es.verdnatura.presentation.base.BaseActivity
|
|||
import es.verdnatura.presentation.base.LocationUpdateCallback
|
||||
import es.verdnatura.presentation.base.database
|
||||
import es.verdnatura.presentation.view.component.CustomDialog
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ClientTicket
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ClientTicketSalix
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.MyLocation
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.SignedTickets
|
||||
import es.verdnatura.presentation.view.feature.delivery.viewmodels.DeliveryViewModel
|
||||
|
@ -44,7 +43,7 @@ class SignedActivity : BaseActivity<ActivitySignBinding>(), LocationUpdateCallba
|
|||
private lateinit var fusedLocationClient: com.google.android.gms.location.FusedLocationProviderClient
|
||||
private var lastLocationCurrent: MyLocation = MyLocation(0.0, 0.0)
|
||||
private lateinit var ticketsSet: HashSet<Long>
|
||||
private lateinit var clientTicket: ClientTicket
|
||||
private lateinit var clientTicket: ClientTicketSalix
|
||||
private lateinit var db: DeliveryDatabase
|
||||
|
||||
override fun init() {
|
||||
|
@ -53,7 +52,7 @@ class SignedActivity : BaseActivity<ActivitySignBinding>(), LocationUpdateCallba
|
|||
|
||||
"ticket" -> {
|
||||
binding.mainToolbar.toolbarTitle.text = getString(R.string.sign)
|
||||
clientTicket = intent.extras!!.getSerializable("clientTicketList") as ClientTicket
|
||||
clientTicket = intent.extras!!.getSerializable("clientTicketList") as ClientTicketSalix
|
||||
setViews(clientTicket)
|
||||
setLocation()
|
||||
}
|
||||
|
@ -91,12 +90,12 @@ class SignedActivity : BaseActivity<ActivitySignBinding>(), LocationUpdateCallba
|
|||
this.longitude = lastLocationCurrent.Longitude
|
||||
}
|
||||
val locationClient = Location("").apply {
|
||||
this.latitude = clientTicket.Latitude ?: 0.0
|
||||
this.longitude = clientTicket.Longitude ?: 0.0
|
||||
this.latitude = clientTicket.latitude ?: 0.0
|
||||
this.longitude = clientTicket.longitude ?: 0.0
|
||||
}
|
||||
|
||||
|
||||
if (clientTicket.Latitude != null && clientTicket.Longitude != null) {
|
||||
if (clientTicket.latitude != null && clientTicket.longitude != null) {
|
||||
if (locationCurrent.distanceTo(locationClient) > 100 ) {
|
||||
|
||||
val customDialogDistance = CustomDialog(this)
|
||||
|
@ -154,11 +153,11 @@ class SignedActivity : BaseActivity<ActivitySignBinding>(), LocationUpdateCallba
|
|||
}
|
||||
|
||||
|
||||
private fun setViews(clientTicketList: ClientTicket) {
|
||||
private fun setViews(clientTicketList: ClientTicketSalix) {
|
||||
|
||||
if (clientTicketList != null) {
|
||||
|
||||
binding.nameAddress.text = clientTicketList.ClientName
|
||||
binding.nameAddress.text = clientTicketList.nickname
|
||||
ticketsSet = HashSet()
|
||||
var sum = 0
|
||||
for (exp in clientTicketList.tickets) {
|
||||
|
|
|
@ -11,11 +11,10 @@ import es.verdnatura.R
|
|||
import es.verdnatura.databinding.ItemTicketRowBinding
|
||||
import es.verdnatura.presentation.common.OnItemButtonCMRRowClickListener
|
||||
import es.verdnatura.presentation.common.OnItemButtonTicketRowClickListener
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ClientTicket
|
||||
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ClientTicketSalix
|
||||
|
||||
class TicketAdapter(
|
||||
private var items: MutableList<ClientTicket>,
|
||||
private var items: MutableList<ClientTicketSalix>,
|
||||
private val onItemButtonTicketRowClickListener: OnItemButtonTicketRowClickListener,
|
||||
private val onItemButtonCMRRowClickListener: OnItemButtonCMRRowClickListener
|
||||
|
||||
|
@ -33,7 +32,7 @@ class TicketAdapter(
|
|||
)
|
||||
}
|
||||
|
||||
fun setHeaders(list: MutableList<ClientTicket>): MutableList<ClientTicket> {
|
||||
fun setHeaders(list: MutableList<ClientTicketSalix>): MutableList<ClientTicketSalix> {
|
||||
|
||||
/* var prevCreated = ""
|
||||
for (route in list) {
|
||||
|
@ -45,7 +44,7 @@ class TicketAdapter(
|
|||
return list
|
||||
}
|
||||
|
||||
fun updateList(newList: MutableList<ClientTicket>) {
|
||||
fun updateList(newList: MutableList<ClientTicketSalix>) {
|
||||
items = newList
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
@ -89,10 +88,10 @@ class TicketAdapter(
|
|||
val binding: ItemTicketRowBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
private val res = binding.root.context.resources
|
||||
fun bind(item: ClientTicket) {
|
||||
fun bind(item: ClientTicketSalix) {
|
||||
binding.apply {
|
||||
|
||||
if (!item.Note.isNullOrEmpty()) {
|
||||
if (!item.ticketObservation.isNullOrEmpty()) {
|
||||
note.setColorFilter(
|
||||
ContextCompat.getColor(
|
||||
note.context,
|
||||
|
|
|
@ -313,7 +313,13 @@ class LoadUnloadFragment(
|
|||
if (binding.mainToolbar.switchButton.isChecked) {
|
||||
counterCalls = 1
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
viewModel.expeditionState_add(myList.filter { it.code == state }, state)
|
||||
val pendingExpeditionSend = myList.map { l ->
|
||||
ExpeditionSalix(
|
||||
expeditionFk = l.id,
|
||||
stateCode = l.code
|
||||
)
|
||||
}
|
||||
viewModel.expeditionStateAddSalix( hashMapOf("expeditions" to pendingExpeditionSend.filter { it.stateCode == state }))
|
||||
} else {
|
||||
updateCount(myList, state)
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import es.verdnatura.presentation.base.database
|
|||
import es.verdnatura.presentation.common.*
|
||||
import es.verdnatura.presentation.view.feature.delivery.adapters.RouteAdapter
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoLoadUnload
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionSalix
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.RouteInfo
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.RouteLoaded
|
||||
import es.verdnatura.presentation.view.feature.delivery.viewmodels.DeliveryViewModel
|
||||
|
@ -64,6 +65,7 @@ class RoutesFragment(
|
|||
}
|
||||
|
||||
private fun pendingOperations() {
|
||||
|
||||
db = database(requireContext().applicationContext)
|
||||
if (mobileApplication.hasNetwork) {
|
||||
lifecycleScope.launch {
|
||||
|
@ -75,31 +77,35 @@ class RoutesFragment(
|
|||
val pendingExpedition =
|
||||
db.expedicionDao().getAllPendingExpeditions()
|
||||
|
||||
if (pendingExpedition.filter { it.code == "DELIVERED" }.isNotEmpty()) {
|
||||
viewModel.expeditionState_add(
|
||||
pendingExpedition.filter { it.code == "DELIVERED" },
|
||||
"DELIVERED"
|
||||
|
||||
val pendingExpeditionSend = pendingExpedition.map { l ->
|
||||
ExpeditionSalix(
|
||||
expeditionFk = l.id,
|
||||
stateCode = l.code
|
||||
)
|
||||
}
|
||||
|
||||
if (pendingExpedition.filter { it.code == "ON DELIVERY" }.isNotEmpty()) {
|
||||
viewModel.expeditionState_add(
|
||||
pendingExpedition.filter { it.code == "ON DELIVERY" },
|
||||
"ON DELIVERY"
|
||||
if (pendingExpeditionSend.filter{ it.stateCode == "DELIVERED" }.isNotEmpty()) {
|
||||
viewModel.expeditionStateAddSalix(
|
||||
hashMapOf("expeditions" to pendingExpeditionSend.filter{ it.stateCode == "DELIVERED" })
|
||||
)
|
||||
}
|
||||
if (pendingExpedition.filter { it.code == "LOST" }.isNotEmpty()) {
|
||||
viewModel.expeditionState_add(
|
||||
pendingExpedition.filter { it.code == "LOST" },
|
||||
"LOST"
|
||||
if (pendingExpeditionSend.filter{ it.stateCode == "ON DELIVERY" }.isNotEmpty()) {
|
||||
viewModel.expeditionStateAddSalix(
|
||||
hashMapOf("expeditions" to pendingExpeditionSend.filter{ it.stateCode == "ON DELIVERY" })
|
||||
)
|
||||
}
|
||||
if (pendingExpedition.filter { it.code == "FOUND" }.isNotEmpty()) {
|
||||
viewModel.expeditionState_add(
|
||||
pendingExpedition.filter { it.code == "FOUND" },
|
||||
"FOUND"
|
||||
if (pendingExpeditionSend.filter{ it.stateCode == "LOST" }.isNotEmpty()) {
|
||||
viewModel.expeditionStateAddSalix(
|
||||
hashMapOf("expeditions" to pendingExpeditionSend.filter{ it.stateCode == "LOST" })
|
||||
)
|
||||
}
|
||||
if (pendingExpeditionSend.filter{ it.stateCode == "FOUND" }.isNotEmpty()) {
|
||||
viewModel.expeditionStateAddSalix(
|
||||
hashMapOf("expeditions" to pendingExpeditionSend.filter{ it.stateCode == "FOUND" })
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
db.routesDao().deleteLoaded(toDateString(Date()))
|
||||
myListRouteLoaded = db.routesDao().getAllLoaded()
|
||||
|
@ -132,6 +138,7 @@ class RoutesFragment(
|
|||
return callBackEndPoint
|
||||
}
|
||||
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
private fun setToolBar() {
|
||||
ma.hideBottomNavigation(View.GONE)
|
||||
|
|
|
@ -21,10 +21,10 @@ import es.verdnatura.presentation.common.*
|
|||
import es.verdnatura.presentation.view.feature.delivery.adapters.ExpeditionSummaryAdapter
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoLoadUnload
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoSummary
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionSalix
|
||||
import es.verdnatura.presentation.view.feature.delivery.viewmodels.DeliveryViewModel
|
||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||
|
||||
|
||||
class SummaryFragment(
|
||||
var title: String = "",
|
||||
var state: String = "",
|
||||
|
@ -46,7 +46,6 @@ class SummaryFragment(
|
|||
private var isScanning = false
|
||||
private var positionSelected = -1
|
||||
|
||||
|
||||
companion object {
|
||||
fun newInstance(title: String, state: String, route: Int) =
|
||||
SummaryFragment(title, state, route)
|
||||
|
@ -126,7 +125,7 @@ class SummaryFragment(
|
|||
}
|
||||
|
||||
iconExit.drawable -> {
|
||||
requireActivity().finish()
|
||||
requireActivity().finish()
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -158,14 +157,27 @@ class SummaryFragment(
|
|||
state: String,
|
||||
address: Int
|
||||
) {
|
||||
|
||||
val listExpedition = list.filter { it.addressFk == address }.map { l ->
|
||||
ExpeditionSalix(
|
||||
expeditionFk = l.id,
|
||||
stateCode = if (l.code == state) {
|
||||
state
|
||||
} else {
|
||||
"FOUND"
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
if (list.filter { it.addressFk == address }
|
||||
.filter { it.code == state }.size == list.filter { it.addressFk == address }.size) {
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
callBack(viewModel.expeditionState_add(list.filter { it.addressFk == address }
|
||||
.filter { it.code == state }, state))
|
||||
counterCalls = 1
|
||||
callBack(
|
||||
viewModel.expeditionStateAddSalix(
|
||||
hashMapOf("expeditions" to listExpedition.filter { it.stateCode == state })
|
||||
)
|
||||
)
|
||||
/* callBack(viewModel.expeditionState_add(list.filter { it.addressFk == address }
|
||||
.filter { it.code == state }, state))*/
|
||||
isScanning = false
|
||||
} else {
|
||||
|
||||
|
@ -175,13 +187,18 @@ class SummaryFragment(
|
|||
alertDialog.setButton(
|
||||
android.app.AlertDialog.BUTTON_POSITIVE, getString(R.string.save)
|
||||
) { dialog, which ->
|
||||
counterCalls = 2
|
||||
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
|
||||
viewModel.expeditionState_add(list.filter { it.addressFk == address }
|
||||
.filter { it.code == state }, state)
|
||||
viewModel.expeditionState_add(list.filter { it.addressFk == address }
|
||||
.filter { it.code != state }, "LOST")
|
||||
|
||||
counterCalls = 1
|
||||
viewModel.expeditionStateAddSalix(hashMapOf("expeditions" to listExpedition.filter { it.stateCode == state }))
|
||||
|
||||
/*
|
||||
viewModel.expeditionState_add(list.filter { it.addressFk == address }
|
||||
.filter { it.code == state }, state)
|
||||
viewModel.expeditionState_add(list.filter { it.addressFk == address }
|
||||
.filter { it.code != state }, "LOST")*/
|
||||
}
|
||||
alertDialog.setButton(
|
||||
android.app.AlertDialog.BUTTON_NEUTRAL, getString(R.string.find)
|
||||
|
@ -191,7 +208,6 @@ class SummaryFragment(
|
|||
alertDialog.show()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private fun openAppDelivery() {
|
||||
|
@ -271,7 +287,6 @@ class SummaryFragment(
|
|||
updateCount(myList, state)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
|
@ -382,7 +397,6 @@ class SummaryFragment(
|
|||
|
||||
}
|
||||
|
||||
|
||||
private fun createList(list: MutableList<ExpeditionInfoLoadUnload>) {
|
||||
|
||||
myList = list
|
||||
|
@ -399,7 +413,6 @@ class SummaryFragment(
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private fun updateCount(list: MutableList<ExpeditionInfoLoadUnload>, state: String) {
|
||||
val countMarked =
|
||||
list.filter { it.addressFk == addressFkSelected }.filter { it.code == state }.size
|
||||
|
@ -424,5 +437,4 @@ class SummaryFragment(
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -31,7 +31,7 @@ import es.verdnatura.presentation.common.*
|
|||
import es.verdnatura.presentation.view.component.CustomDialogInputNotes
|
||||
import es.verdnatura.presentation.view.component.CustomDialogList
|
||||
import es.verdnatura.presentation.view.feature.delivery.adapters.TicketAdapter
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ClientTicket
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ClientTicketSalix
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoLoadUnload
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.RouteInfo
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.Ticket
|
||||
|
@ -52,7 +52,7 @@ class TicketsFragment(
|
|||
|
||||
private var adapter: TicketAdapter? = null
|
||||
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
|
||||
private lateinit var myListClientTicket: MutableList<ClientTicket>
|
||||
private lateinit var myListClientTicket: MutableList<ClientTicketSalix>
|
||||
private var showSigned = false
|
||||
private var showSettings = false
|
||||
private lateinit var db: DeliveryDatabase
|
||||
|
@ -84,7 +84,7 @@ class TicketsFragment(
|
|||
|
||||
binding.mainToolbar.toolbarSubtitle.text =
|
||||
if (::myListClientTicket.isInitialized) {
|
||||
myListClientTicket.filter { it.Signed == 1 }.size.toString() + "/" + myListClientTicket.size
|
||||
myListClientTicket.filter { it.signed == 1 }.size.toString() + "/" + myListClientTicket.size
|
||||
} else {
|
||||
"0/0"
|
||||
}
|
||||
|
@ -170,9 +170,9 @@ class TicketsFragment(
|
|||
if (::myListClientTicket.isInitialized) {
|
||||
adapter!!.updateList(
|
||||
if (showSigned) {
|
||||
myListClientTicket.filter { it.Signed == 1 } as MutableList<ClientTicket>
|
||||
myListClientTicket.filter { it.signed == 1 } as MutableList<ClientTicketSalix>
|
||||
} else {
|
||||
myListClientTicket.filter { it.Signed == 0 } as MutableList<ClientTicket>
|
||||
myListClientTicket.filter { it.signed == 0 } as MutableList<ClientTicketSalix>
|
||||
})
|
||||
}
|
||||
changeColorIcon(iconSigned.drawable, showSigned)
|
||||
|
@ -359,9 +359,9 @@ class TicketsFragment(
|
|||
|
||||
}
|
||||
|
||||
private fun createLisTickets(list: MutableList<ClientTicket>, getSaved: Boolean = false) {
|
||||
private fun createLisTickets(list: MutableList<ClientTicketSalix>, getSaved: Boolean = false) {
|
||||
|
||||
var myListClientTicketAux: MutableList<ClientTicket> = mutableListOf()
|
||||
var myListClientTicketAux: MutableList<ClientTicketSalix> = mutableListOf()
|
||||
|
||||
lifecycleScope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
|
@ -371,17 +371,17 @@ class TicketsFragment(
|
|||
.toMutableList()
|
||||
} else {
|
||||
myListClientTicketAux =
|
||||
list.distinctBy { it.Address } as MutableList<ClientTicket>
|
||||
list.distinctBy { it.addressFk } as MutableList<ClientTicketSalix>
|
||||
|
||||
for (clientTicket in myListClientTicketAux) {
|
||||
val addressId = clientTicket.Address
|
||||
val ticketsForClient = list.filter { it.Address == addressId }
|
||||
val addressId = clientTicket.addressFk
|
||||
val ticketsForClient = list.filter { it.addressFk == addressId }
|
||||
val mappedTickets = ticketsForClient.map { ticket ->
|
||||
Ticket(
|
||||
ticket.Id,
|
||||
ticket.Packages,
|
||||
ticket.PackingType,
|
||||
ticket.Note,
|
||||
ticket.id,
|
||||
ticket.packages,
|
||||
ticket.ipt,
|
||||
ticket.ticketObservation,
|
||||
ticket.cmrFk
|
||||
)
|
||||
}
|
||||
|
@ -399,16 +399,16 @@ class TicketsFragment(
|
|||
myListClientTicket = myListClientTicketAux
|
||||
|
||||
val myListFiltered = if (showSigned) {
|
||||
myListClientTicket.filter { it.Signed == 1 }
|
||||
myListClientTicket.filter { it.signed == 1 }
|
||||
} else {
|
||||
myListClientTicket.filter { it.Signed == 0 }
|
||||
myListClientTicket.filter { it.signed == 0 }
|
||||
}
|
||||
adapter = TicketAdapter(
|
||||
myListFiltered as MutableList<ClientTicket>,
|
||||
myListFiltered as MutableList<ClientTicketSalix>,
|
||||
object : OnItemButtonTicketRowClickListener {
|
||||
|
||||
override fun onItemButtonTicketRowClickListener(
|
||||
item: ClientTicket,
|
||||
item: ClientTicketSalix,
|
||||
action: String
|
||||
) {
|
||||
when (action) {
|
||||
|
@ -417,12 +417,12 @@ class TicketsFragment(
|
|||
val entryPoint = Gson().toJson(
|
||||
mutableMapOf(
|
||||
"route" to route.id.toString(),
|
||||
"address" to item.Address
|
||||
"address" to item.addressFk
|
||||
)
|
||||
)
|
||||
ma.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(title = getString(R.string.titleUnLoadTruck)),
|
||||
entryPoint, myListClientTicket.filter { it.Id == item.Id }
|
||||
entryPoint, myListClientTicket.filter { it.id == item.id }
|
||||
)
|
||||
|
||||
}
|
||||
|
@ -486,7 +486,7 @@ class TicketsFragment(
|
|||
}
|
||||
}
|
||||
|
||||
private fun addNotes(itemClient: ClientTicket) {
|
||||
private fun addNotes(itemClient: ClientTicketSalix) {
|
||||
|
||||
val customDialogInput = CustomDialogInputNotes(requireContext())
|
||||
customDialogInput.setTitle("Notas")
|
||||
|
@ -526,11 +526,11 @@ class TicketsFragment(
|
|||
|
||||
}
|
||||
|
||||
private fun showNotes(item: ClientTicket) {
|
||||
private fun showNotes(item: ClientTicketSalix) {
|
||||
|
||||
val alertDialog = AlertDialog.Builder(requireContext()).create()
|
||||
alertDialog.setTitle(getString(R.string.info))
|
||||
alertDialog.setMessage(item.Note)
|
||||
alertDialog.setMessage(item.ticketObservation)
|
||||
alertDialog.setButton(
|
||||
AlertDialog.BUTTON_NEUTRAL, getString(R.string.close)
|
||||
) { dialog, _ -> dialog.dismiss() }
|
||||
|
@ -546,28 +546,28 @@ class TicketsFragment(
|
|||
}
|
||||
}
|
||||
|
||||
fun showPhones(clientClicked: ClientTicket) {
|
||||
fun showPhones(clientClicked: ClientTicketSalix) {
|
||||
val phones: MutableList<GeneralItem> = mutableListOf()
|
||||
//Tarea 6275
|
||||
/*if (clientClicked.clientPhone!=null){
|
||||
if (clientClicked.clientPhone!=null){
|
||||
phones.add(
|
||||
GeneralItem(
|
||||
text = "${getString(R.string.Cliente)}:$clientClicked.clientPhone",
|
||||
code =clientClicked.clientMobile
|
||||
text = "${getString(R.string.Cliente)}:${clientClicked.clientPhone}",
|
||||
code =clientClicked.clientMobile.toString()
|
||||
))
|
||||
}
|
||||
if (clientClicked.addressMobile!=null){
|
||||
if (clientClicked.clientMobile!=null){
|
||||
phones.add(
|
||||
GeneralItem(
|
||||
text = "${getString(R.string.Cliente)}:$clientClicked.addressPhone",
|
||||
code =clientClicked.addressMobile
|
||||
text = "${getString(R.string.Cliente)}:${clientClicked.clientMobile}",
|
||||
code =clientClicked.clientMobile.toString()
|
||||
))
|
||||
}
|
||||
if (clientClicked.addressPhone!=null){
|
||||
phones.add(
|
||||
GeneralItem(
|
||||
text = "${getString(R.string.Cliente)}:$clientClicked.addressPhone",
|
||||
code =clientClicked.addressPhone
|
||||
text = "${getString(R.string.Cliente)}:${clientClicked.addressPhone}",
|
||||
code =clientClicked.addressPhone.toString()
|
||||
))
|
||||
}
|
||||
if (!clientClicked.salePersonPhone.isNullOrEmpty())
|
||||
|
@ -577,9 +577,9 @@ class TicketsFragment(
|
|||
code =
|
||||
clientClicked.salePersonPhone.toString()
|
||||
)
|
||||
)*/
|
||||
)
|
||||
|
||||
if (clientClicked.Phones != null && clientClicked.Phones!!.isNotEmpty()) {
|
||||
/* if (clientClicked.Phones != null && clientClicked.Phones!!.isNotEmpty()) {
|
||||
for (t in clientClicked.Phones!!) {
|
||||
phones.add(
|
||||
GeneralItem(
|
||||
|
@ -597,7 +597,7 @@ class TicketsFragment(
|
|||
code =
|
||||
clientClicked.SalePersonPhone.toString()
|
||||
)
|
||||
)
|
||||
)*/
|
||||
customDialogList.setValueVisibility(View.GONE)
|
||||
customDialogList.setTitle(getString(R.string.phones))
|
||||
.setKoButton(
|
||||
|
@ -645,22 +645,22 @@ class TicketsFragment(
|
|||
|
||||
}
|
||||
|
||||
fun goMaps(item: ClientTicket) {
|
||||
fun goMaps(item: ClientTicketSalix) {
|
||||
|
||||
if (isGoogleMapsInstalled()) {
|
||||
|
||||
val uri: String
|
||||
if (item.Latitude != null) {
|
||||
uri = "geo:${item.Latitude},${item.Longitude}?q=" + item.ClientName +
|
||||
" " + item.AddressName +
|
||||
" " + item.City +
|
||||
" " + item.PostalCode
|
||||
if (item.latitude != null) {
|
||||
uri = "geo:${item.latitude},${item.longitude}?q=" + item.nickname +
|
||||
" " + item.street +
|
||||
" " + item.city +
|
||||
" " + item.postalCode
|
||||
|
||||
} else {
|
||||
uri = "geo:0,0?q=" + item.ClientName +
|
||||
" " + item.AddressName +
|
||||
" " + item.City +
|
||||
" " + item.PostalCode
|
||||
uri = "geo:0,0?q=" + item.nickname +
|
||||
" " + item.street +
|
||||
" " + item.city +
|
||||
" " + item.postalCode
|
||||
}
|
||||
val locationIntent = Intent(Intent.ACTION_VIEW, Uri.parse(uri))
|
||||
startActivity(locationIntent)
|
||||
|
|
|
@ -7,7 +7,7 @@ import es.verdnatura.db.MapTypeConverter
|
|||
import java.io.Serializable
|
||||
|
||||
class ClientTicketList(
|
||||
var list: MutableList<ClientTicket> = mutableListOf()
|
||||
var list: MutableList<ClientTicketSalix> = mutableListOf()
|
||||
)
|
||||
|
||||
@Entity(tableName = "clientTickets")
|
||||
|
@ -38,6 +38,7 @@ data class ClientTicket(
|
|||
) : Serializable
|
||||
|
||||
//Tarea 6275
|
||||
@Entity(tableName = "clientTickets")
|
||||
data class ClientTicketSalix(
|
||||
@PrimaryKey var id: Long,
|
||||
var clientFk: Int,
|
||||
|
|
|
@ -11,8 +11,8 @@ import es.verdnatura.domain.formatWithQuotes
|
|||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.common.Event
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ClientTicket
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ClientTicketList
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ClientTicketSalix
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.DeliveryInfo
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoList
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoLoadUnload
|
||||
|
@ -217,8 +217,7 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
|
||||
}
|
||||
|
||||
fun expeditionState_add(expeditions: Any?, state: String) {
|
||||
|
||||
/* fun expeditionState_add(expeditions: Any?, state: String) {
|
||||
silex.expeditionState_add(expeditions, state)
|
||||
.enqueue(object : SilexCallback<Unit>(context) {
|
||||
override fun onSuccess(response: Response<Unit>) {
|
||||
|
@ -235,7 +234,7 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
|
||||
}
|
||||
})
|
||||
}
|
||||
}*/
|
||||
|
||||
fun expeditionStateAddSalix(expeditions: Any) {
|
||||
|
||||
|
@ -282,8 +281,8 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
route: Int
|
||||
) {
|
||||
//Tarea 6275
|
||||
//salix.routeGetExpeditionSummary(route)
|
||||
silex.route_getExpeditionSummary(route)
|
||||
salix.routeGetExpeditionSummary(route)
|
||||
// silex.route_getExpeditionSummary(route)
|
||||
.enqueue(object : SalixCallback<List<ExpeditionInfoSummary>>(context) {
|
||||
|
||||
override fun onSuccess(response: Response<List<ExpeditionInfoSummary>>) {
|
||||
|
@ -308,9 +307,9 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
workerFk: Int
|
||||
) {
|
||||
//Redmine 6028 falta que le pongan el email y PR
|
||||
//salix.getRoutes()
|
||||
silex.getRoutes(workerFk)
|
||||
.enqueue(object : SilexCallback<MutableList<RouteInfo>>(context) {
|
||||
salix.getRoutes()
|
||||
// silex.getRoutes(workerFk)
|
||||
.enqueue(object : SalixCallback<MutableList<RouteInfo>>(context) {
|
||||
|
||||
override fun onSuccess(response: Response<MutableList<RouteInfo>>) {
|
||||
|
||||
|
@ -335,10 +334,10 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
routeId: Long
|
||||
) {
|
||||
//Tarea 6275
|
||||
// salix.getTickets("""{"id":$routeId}""")
|
||||
silex.getTickets(routeId)
|
||||
.enqueue(object : SalixCallback<MutableList<ClientTicket>>(context) {
|
||||
override fun onSuccess(response: Response<MutableList<ClientTicket>>) {
|
||||
salix.getTickets("""{"id":$routeId}""")
|
||||
// silex.getTickets(routeId)
|
||||
.enqueue(object : SalixCallback<MutableList<ClientTicketSalix>>(context) {
|
||||
override fun onSuccess(response: Response<MutableList<ClientTicketSalix>>) {
|
||||
_clientTicketList.value =
|
||||
response.body()?.let { ClientTicketList(it) }
|
||||
}
|
||||
|
@ -369,7 +368,7 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun addNote(
|
||||
/* fun addNote(
|
||||
ticketFk: Int
|
||||
) {
|
||||
silex.addNotes(ticketFk)
|
||||
|
@ -386,7 +385,7 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
|
||||
}
|
||||
})
|
||||
}
|
||||
}*/
|
||||
|
||||
fun routeUpdate(
|
||||
route: RouteInfo
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
<variable
|
||||
name="item"
|
||||
type="es.verdnatura.presentation.view.feature.delivery.model.ClientTicket" />
|
||||
type="es.verdnatura.presentation.view.feature.delivery.model.ClientTicketSalix" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
@ -62,7 +62,7 @@
|
|||
android:id="@+id/textView21"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{String.valueOf(item.client)}"
|
||||
android:text="@{String.valueOf(item.clientFk)}"
|
||||
app:autoSizeMaxTextSize="18sp"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
|
@ -83,7 +83,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@{String.valueOf(item.address)}"
|
||||
android:text="@{String.valueOf(item.addressFk)}"
|
||||
android:textAlignment="center"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
|
@ -104,7 +104,7 @@
|
|||
android:id="@+id/textView25"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{item.clientName}"
|
||||
android:text="@{item.nickname}"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="18sp"
|
||||
tools:text="LA FLOR VALENCIA"/>
|
||||
|
@ -113,7 +113,7 @@
|
|||
android:id="@+id/textView24"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{item.addressName}"
|
||||
android:text="@{item.street}"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="@color/colorPrimary"
|
||||
tools:text="C/ Les flors,1"/>
|
||||
|
|
Loading…
Reference in New Issue