feat roadMaps #refs 7195

This commit is contained in:
Sergio De la torre 2024-06-04 14:00:40 +02:00
parent 305feb1ac2
commit 1524ab3284
20 changed files with 1249 additions and 265 deletions

View File

@ -54,14 +54,14 @@ import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemPalletViewVO
import es.verdnatura.presentation.view.feature.paletizador.model.ItemScanVO
import es.verdnatura.presentation.view.feature.presacador.model.PreSacadorItemVO
import es.verdnatura.presentation.view.feature.roadmap.model.RoadMapTruck
import es.verdnatura.presentation.view.feature.roadmap.model.RoadStopMapTruck
import es.verdnatura.presentation.view.feature.roadmap.model.StopMapTruckPallet
import es.verdnatura.presentation.view.feature.sacador.model.CollectionTicket
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeVO
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO
import es.verdnatura.presentation.view.feature.sacador.model.TicketStateSalix
import es.verdnatura.presentation.view.feature.truck.model.RoadMapTruck
import es.verdnatura.presentation.view.feature.truck.model.StopMapTruck
import es.verdnatura.presentation.view.feature.truck.model.StopMapTruckPallet
import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicador
import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorVO
import es.verdnatura.presentation.view.feature.workermistake.model.DepartmentMistake
@ -876,10 +876,16 @@ interface SalixService {
@Query("filter") filter: String
): Call<List<RoadMapTruck>>
@GET("ExpeditionTrucks")
@PATCH("RoadMaps/{id}")
fun roadMapUpdate(
@Path("id") id: Number,
@Body params: Any
): Call<Any>
@GET("RoadMapStops")
fun getStopMapTruckList(
@Query("filter") filter: String
): Call<List<StopMapTruck>>
): Call<List<RoadStopMapTruck>>
@POST("Applications/expeditionPallet_List/execute-proc")
fun getStopMapTruckPalletList(
@ -938,7 +944,7 @@ interface SalixService {
Call<List<EntrySalix>>
@GET("Entries")
fun getEntries_fromSupplier(
fun getEntriesFromSupplier(
@Query("filter") filter: String
):
Call<List<EntrySalix>>

View File

@ -1,11 +1,11 @@
package es.verdnatura.presentation.view.feature.truck.adapter
package es.verdnatura.presentation.view.feature.roadmap.adapter
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.databinding.ItemRoadmapTruckRowBinding
import es.verdnatura.presentation.common.OnRoadMapClickListener
import es.verdnatura.presentation.view.feature.truck.model.RoadMapTruck
import es.verdnatura.presentation.view.feature.roadmap.model.RoadMapTruck
class RoadMapListAdapter(
private var items: List<RoadMapTruck>,

View File

@ -1,15 +1,15 @@
package es.verdnatura.presentation.view.feature.truck.adapter
package es.verdnatura.presentation.view.feature.roadmap.adapter
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.databinding.ItemStopmapTruckRowBinding
import es.verdnatura.presentation.common.OnStopMapClickListener
import es.verdnatura.presentation.view.feature.truck.model.StopMapTruck
import es.verdnatura.presentation.view.feature.truck.model.TruckAction
import es.verdnatura.presentation.view.feature.roadmap.model.RoadStopMapTruck
import es.verdnatura.presentation.view.feature.roadmap.model.TruckAction
class StopMapListAdapter(
private var items: List<StopMapTruck>,
private var items: List<RoadStopMapTruck>,
private val onStopMapClickListener: OnStopMapClickListener
) : RecyclerView.Adapter<StopMapListAdapter.ItemHolder>() {
@ -25,13 +25,9 @@ class StopMapListAdapter(
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
holder.bind(items[position])
holder.binding.root.setOnClickListener {
// onStopMapClickListener.onStopMapClickListener(items[position], "")
}
}
fun setList(itemsList: List<StopMapTruck>) {
fun setList(itemsList: List<RoadStopMapTruck>) {
items = itemsList
notifyDataSetChanged()
}
@ -40,22 +36,41 @@ class StopMapListAdapter(
val binding: ItemStopmapTruckRowBinding
) : RecyclerView.ViewHolder(binding.root) {
private val res = binding.root.context.resources
fun bind(item: StopMapTruck) {
fun bind(item: RoadStopMapTruck) {
binding.apply {
binding.loadPallet.setOnClickListener {
onStopMapClickListener.onStopMapClickListener(
item,
"",
action = TruckAction.LOAD
)
onStopMapClickListener.onStopMapClickListener(item, "", TruckAction.LOAD)
}
binding.unLoadPallet.setOnClickListener {
onStopMapClickListener.onStopMapClickListener(item, "", TruckAction.UNLOAD)
}
/* binding.icCall.setOnClickListener {
onStopMapClickListener.onStopMapClickListener(
item,
"",
action = TruckAction.UNLOAD
TruckAction.CALL
)
}
binding.ubication.setOnClickListener {
onStopMapClickListener.onStopMapClickListener(
item,
"",
TruckAction.GOTOMAPS
)
}*/
binding.moreActions.setOnClickListener {
onStopMapClickListener.onStopMapClickListener(
item,
"",
TruckAction.OPTIONS, binding.root
)
}
this.item = item
}
}

View File

@ -1,4 +1,4 @@
package es.verdnatura.presentation.view.feature.truck.adapter
package es.verdnatura.presentation.view.feature.roadmap.adapter
import android.view.LayoutInflater
import android.view.View.GONE
@ -8,8 +8,8 @@ import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.R
import es.verdnatura.databinding.ItemStopmapTruckPalletRowBinding
import es.verdnatura.presentation.common.OnPrintClickListener
import es.verdnatura.presentation.view.feature.truck.model.StopMapTruckPallet
import es.verdnatura.presentation.view.feature.truck.model.TruckAction
import es.verdnatura.presentation.view.feature.roadmap.model.StopMapTruckPallet
import es.verdnatura.presentation.view.feature.roadmap.model.TruckAction
class StopMapPalletListAdapter(
private var items: List<StopMapTruckPallet>,

View File

@ -1,4 +1,4 @@
package es.verdnatura.presentation.view.feature.truck.fragment
package es.verdnatura.presentation.view.feature.roadmap.fragment
import android.content.Context
import android.graphics.drawable.Drawable
@ -13,10 +13,11 @@ import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnOptionsSelectedListener
import es.verdnatura.presentation.common.OnRoadMapClickListener
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.truck.adapter.RoadMapListAdapter
import es.verdnatura.presentation.view.feature.truck.model.RoadMapTruck
import es.verdnatura.presentation.view.feature.truck.model.RoadMapTruckList
import es.verdnatura.presentation.view.feature.roadmap.adapter.RoadMapListAdapter
import es.verdnatura.presentation.view.feature.roadmap.model.RoadMapTruck
import es.verdnatura.presentation.view.feature.roadmap.model.RoadMapTruckList
import java.time.LocalDate
import java.time.LocalTime
import java.time.format.DateTimeFormatter
class RoadMapListFragment(
@ -48,7 +49,13 @@ class RoadMapListFragment(
ma.onMyBackPressed()
}
setToolBar()
viewModel.roadMapTruckList()
viewModel.roadMapTruckList(
"""{"where": { "etd": {
"between": ["${LocalDate.now().atTime(LocalTime.MIN)}",
"${
LocalDate.now().atTime(LocalTime.MAX)
}"]}},"order": "etd ASC"}"""
)
super.init()
}
@ -85,7 +92,17 @@ class RoadMapListFragment(
ToolBarAdapter(listIcons, object : OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
when (item) {
iconReload -> viewModel.roadMapTruckList()
iconReload -> {
binding.filterTxt.setText("")
viewModel.roadMapTruckList(
"""{"where": { "etd": {
"between": ["${LocalDate.now().atTime(LocalTime.MIN)}",
"${
LocalDate.now().atTime(LocalTime.MAX)
}"]}},"order": "etd ASC"}"""
)
}
}
}
})

View File

@ -1,4 +1,4 @@
package es.verdnatura.presentation.view.feature.truck.fragment
package es.verdnatura.presentation.view.feature.roadmap.fragment
import android.content.Context
import androidx.lifecycle.LiveData
@ -8,15 +8,13 @@ import es.verdnatura.domain.SalixCallback
import es.verdnatura.domain.formatWithQuotes
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.view.feature.truck.model.RoadMapTruck
import es.verdnatura.presentation.view.feature.truck.model.RoadMapTruckList
import es.verdnatura.presentation.view.feature.truck.model.StopMapTruck
import es.verdnatura.presentation.view.feature.truck.model.StopMapTruckList
import es.verdnatura.presentation.view.feature.truck.model.StopMapTruckPallet
import es.verdnatura.presentation.view.feature.truck.model.StopMapTruckPalletList
import es.verdnatura.presentation.view.feature.roadmap.model.RoadMapTruck
import es.verdnatura.presentation.view.feature.roadmap.model.RoadMapTruckList
import es.verdnatura.presentation.view.feature.roadmap.model.RoadStopMapTruck
import es.verdnatura.presentation.view.feature.roadmap.model.RoadStopMapTruckList
import es.verdnatura.presentation.view.feature.roadmap.model.StopMapTruckPallet
import es.verdnatura.presentation.view.feature.roadmap.model.StopMapTruckPalletList
import retrofit2.Response
import java.time.LocalDate
import java.time.LocalTime
class RoadMapListViewModel(val context: Context) : BaseViewModel(context) {
@ -24,8 +22,8 @@ class RoadMapListViewModel(val context: Context) : BaseViewModel(context) {
val loadRoadMapTruckList: LiveData<Event<RoadMapTruckList>> =
_roadMapTruckList.map { Event(it) }
private val _stopMapTruckList by lazy { MutableLiveData<StopMapTruckList>() }
val loadStopMapTruckList: LiveData<Event<StopMapTruckList>> =
private val _stopMapTruckList by lazy { MutableLiveData<RoadStopMapTruckList>() }
val loadStopMapTruckList: LiveData<Event<RoadStopMapTruckList>> =
_stopMapTruckList.map { Event(it) }
private val _stopMapTruckPalletList by lazy { MutableLiveData<StopMapTruckPalletList>() }
@ -36,13 +34,12 @@ class RoadMapListViewModel(val context: Context) : BaseViewModel(context) {
val loadResponseState: LiveData<Event<Boolean>> =
_responseState.map { Event(it) }
fun roadMapTruckList() {
private val _responseUpdate by lazy { MutableLiveData<Boolean>() }
var responseUpdate: LiveData<Boolean> = _responseUpdate
fun roadMapTruckList(filter: String) {
salix.roadmapTruckGet(
"""{"where": { "etd": {
"between": ["${LocalDate.now().atTime(LocalTime.MIN)}",
"${
LocalDate.now().atTime(LocalTime.MAX)
}"]}},"order": "etd ASC"}"""
filter
).enqueue(object : SalixCallback<List<RoadMapTruck>>(context) {
override fun onSuccess(response: Response<List<RoadMapTruck>>) {
_roadMapTruckList.value =
@ -51,18 +48,41 @@ class RoadMapListViewModel(val context: Context) : BaseViewModel(context) {
})
}
fun roadMapUpdate(roadmapFk: Int, params: Any) {
salix.roadMapUpdate(
id = roadmapFk,
params = params
).enqueue(object : SalixCallback<Any>(context) {
override fun onSuccess(response: Response<Any>) {
_responseUpdate.value = true
super.onSuccess(response)
}
})
}
fun getStopMapTruckList(roadMap: Int) {
salix.getStopMapTruckList(
"""{"where": { "roadMapMapFk":$roadMap},"order": "eta ASC"}"""
"""{ "where":{"roadMapFk":$roadMap},
| "fields": [ "id","eta","description","warehouseFk"],
| "include": [ { "relation": "warehouse",
| "scope": { "fields": ["name","addressFk"],
| "include":[{ "relation":"address",
| "scope":{ "fields": ["nickname","street","city","postalCode","latitude","longitude","mobile","phone","address","clientFk"],
| "include":[{ "relation":"client",
| "scope":{ "fields": ["phone"] } } ]} } ] } } ] }""".trimMargin()
// """{"where": { "roadMapFk":$roadMap},"order": "eta ASC"}"""
/* """{"where": { "eta": {
"between": ["${LocalDate.now().atTime(LocalTime.MIN)}",
"${
LocalDate.now().atTime(LocalTime.MAX)
}"]}},"order": "eta ASC"}"""*/
).enqueue(object : SalixCallback<List<StopMapTruck>>(context) {
override fun onSuccess(response: Response<List<StopMapTruck>>) {
).enqueue(object : SalixCallback<List<RoadStopMapTruck>>(context) {
override fun onSuccess(response: Response<List<RoadStopMapTruck>>) {
_stopMapTruckList.value =
response.body()?.let { StopMapTruckList(it) }
response.body()?.let { RoadStopMapTruckList(it) }
}
})
}

View File

@ -0,0 +1,222 @@
package es.verdnatura.presentation.view.feature.roadmap.fragment
import android.app.AlertDialog
import android.content.Context
import android.graphics.drawable.Drawable
import android.widget.DatePicker
import android.widget.EditText
import android.widget.TimePicker
import androidx.core.content.res.ResourcesCompat
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
import es.verdnatura.databinding.FragmentRoadmapSettingsBinding
import es.verdnatura.domain.notNull
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnOptionsSelectedListener
import es.verdnatura.presentation.common.OnRoadMapClickListener
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.roadmap.adapter.RoadMapListAdapter
import es.verdnatura.presentation.view.feature.roadmap.model.RoadMapTruck
import java.time.LocalDate
import java.time.format.DateTimeFormatter
import java.util.Calendar
class RoadMapSettingsFragment(
private var roadMap: RoadMapTruck
) : BaseFragment<FragmentRoadmapSettingsBinding, RoadMapListViewModel>(
RoadMapListViewModel::class
) {
private var adapter: RoadMapListAdapter? = null
private var onRoadMapClickListener: OnRoadMapClickListener? = null
private var originalList = listOf<RoadMapTruck>()
companion object {
fun newInstance(roadMap: RoadMapTruck) = RoadMapSettingsFragment(roadMap)
}
override fun onAttach(context: Context) {
if (context is OnRoadMapClickListener) onRoadMapClickListener = context
super.onAttach(context)
}
override fun getLayoutId(): Int = R.layout.fragment_roadmap_settings
override fun init() {
binding.mainToolbar.toolbarTitle.text = roadMap.trailerPlate
//LocalDate.now().format(DateTimeFormatter.ofPattern("dd/MM/yyyy"))
binding.mainToolbar.backButton.setOnClickListener {
ma.onMyBackPressed()
}
setToolBar()
setEventsCliks()
viewModel.roadMapTruckList(filter = """{"where": { "id": ${roadMap.id}}}""")
super.init()
}
private fun setEventsCliks() {
binding.saveButton.setOnClickListener {
val myRoadMap = RoadMapTruck(
id = roadMap.id,
driverName = roadMap.driverName,
trailerPlate = roadMap.trailerPlate,
observations = roadMap.observations,
kmStart = binding.kmStart.text?.takeIf { it.isNotBlank() }?.toString()
?.toInt(),
kmEnd = binding.kmEnd.text?.takeIf { it.isNotBlank() }?.toString()?.toInt()
)
myRoadMap.started = binding.dateInit.text?.takeIf { it.isNotBlank() }?.toString()
myRoadMap.finished = binding.dateEnd.text?.takeIf { it.isNotBlank() }?.toString()
viewModel.roadMapUpdate(
roadMap.id, myRoadMap
)
}
binding.dateInit.setOnFocusChangeListener { _, b ->
if (b) {
showDatePickerDialog(requireContext(), binding.dateInit) { year, month, day ->
val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd")
val localDate = LocalDate.of(
year, month, day
)
binding.dateInit.setText(localDate.format(formatter).toString())
}
}
}
binding.dateEnd.setOnFocusChangeListener { _, b ->
if (b) {
showDatePickerDialog(requireContext(), binding.dateEnd) { year, month, day ->
val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd")
val localDate = LocalDate.of(
year, month, day
)
binding.dateEnd.setText(localDate.format(formatter).toString())
}
}
}
binding.dateEnd.setOnClickListener {
binding.textClock.showContextMenu()
}
}
private fun setRoadMap(roadMap: RoadMapTruck) {
binding.kmStart.setText(roadMap.kmStart?.toString() ?: "")
binding.kmEnd.setText(roadMap.kmEnd?.toString() ?: "")
binding.dateInit.setText(roadMap.started ?: "")
binding.dateEnd.setText(roadMap.finished ?: "")
}
private fun setToolBar() {
val listIcons: ArrayList<Drawable> = ArrayList()
val iconReload: Drawable = ResourcesCompat.getDrawable(
resources, R.drawable.ic_autorenew_black_24dp, null
)!!
// listIcons.add(iconReload)
binding.mainToolbar.toolbarIcons.adapter =
ToolBarAdapter(listIcons, object : OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
when (item) {
iconReload -> {
// viewModel.roadMapTruckList($road)
}
}
}
})
binding.mainToolbar.toolbarIcons.layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
}
override fun observeViewModel() {
with(viewModel) {
responseUpdate.observe(viewLifecycleOwner) {
ma.onMyBackPressed()
}
loadRoadMapTruckList.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull { setRoadMap(it.list[0]) }
}
}
}
private fun showDatePickerDialog(
context: Context, editTextSelected: EditText, onDateSelected: (Int, Int, Int) -> Unit
) {
val calendar = Calendar.getInstance()
val initialYear = calendar[Calendar.YEAR]
val initialMonth = calendar[Calendar.MONTH]
val initialDay = calendar[Calendar.DAY_OF_MONTH]
val datePicker = DatePicker(context)
datePicker.init(
initialYear, initialMonth, initialDay
) { _, year, monthOfYear, dayOfMonth ->
onDateSelected(
year, monthOfYear + 1, dayOfMonth
)
}
val builder = AlertDialog.Builder(context).setTitle(getString(R.string.selectDate))
.setView(datePicker)
.setPositiveButton(getString(R.string.accept)) { _, _ ->
showTimePickerDialog(requireContext(), editTextSelected) { hour, minute ->
editTextSelected.setText(
getString(
R.string.dateTime,
editTextSelected.text,
hour,
minute
)
)
}
}.setNegativeButton(getString(R.string.cancel)) { _, _ ->
editTextSelected.setText("")
}
val dialog = builder.create()
dialog.show()
}
private fun showTimePickerDialog(
context: Context,
editTextSelected: EditText,
onTimeSelected: (Int, Int) -> Unit
) {
val timePicker = TimePicker(context)
timePicker.setIs24HourView(true)
timePicker.setOnTimeChangedListener { _, hour, minute ->
onTimeSelected(hour, minute)
}
val builder = AlertDialog.Builder(context).setTitle(getString(R.string.selectHour))
.setView(timePicker)
.setPositiveButton(getString(R.string.accept)) { _, _ ->
}
.setNegativeButton(getString(R.string.cancel)) { _, _ ->
editTextSelected.setText("")
}
val dialog = builder.create()
dialog.show()
}
}

View File

@ -0,0 +1,309 @@
package es.verdnatura.presentation.view.feature.roadmap.fragment
import android.Manifest
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.graphics.drawable.Drawable
import android.net.Uri
import android.os.Build
import android.text.Editable
import android.text.TextWatcher
import android.view.Gravity
import android.view.View
import android.widget.PopupMenu
import androidx.annotation.RequiresApi
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import androidx.core.content.res.ResourcesCompat
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
import es.verdnatura.databinding.FragmentStopmapTruckListBinding
import es.verdnatura.domain.notNull
import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.GeneralAdapter
import es.verdnatura.presentation.common.GeneralItem
import es.verdnatura.presentation.common.OnGeneralItemRowClickListener
import es.verdnatura.presentation.common.OnOptionsSelectedListener
import es.verdnatura.presentation.common.OnStopMapClickListener
import es.verdnatura.presentation.common.TAG
import es.verdnatura.presentation.common.addFragment
import es.verdnatura.presentation.view.component.CustomDialogList
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.pasillero.fragment.PasilleroFragment
import es.verdnatura.presentation.view.feature.roadmap.adapter.StopMapListAdapter
import es.verdnatura.presentation.view.feature.roadmap.model.RoadMapTruck
import es.verdnatura.presentation.view.feature.roadmap.model.RoadStopMapTruck
import es.verdnatura.presentation.view.feature.roadmap.model.RoadStopMapTruckList
import es.verdnatura.presentation.view.feature.roadmap.model.TruckAction
class StopMapListFragment(
private var title: String,
private var roadMap: RoadMapTruck
) : BaseFragment<FragmentStopmapTruckListBinding, RoadMapListViewModel>(
RoadMapListViewModel::class
) {
private var adapter: StopMapListAdapter? = null
private var onStopMapClickListener: OnStopMapClickListener? = null
private var originalList = listOf<RoadStopMapTruck>()
companion object {
fun newInstance(title: String, roadMap: RoadMapTruck) = StopMapListFragment(title, roadMap)
private const val REQUEST_CALL_PERMISSION = 1
}
override fun onAttach(context: Context) {
if (context is OnStopMapClickListener) onStopMapClickListener = context
super.onAttach(context)
}
override fun getLayoutId(): Int = R.layout.fragment_stopmap_truck_list
override fun init() {
binding.mainToolbar.toolbarTitle.text =
getString(R.string.doublePointText, title, roadMap.trailerPlate)
binding.mainToolbar.backButton.setOnClickListener {
ma.onMyBackPressed()
}
setToolBar()
viewModel.getStopMapTruckList(roadMap.id)
super.init()
}
private fun setFilter() {
binding.filterTxt.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(
s: CharSequence?, start: Int, count: Int, after: Int
) {
}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
}
override fun afterTextChanged(s: Editable?) {
adapter!!.setList(originalList.filter { stopMapTruck ->
stopMapTruck.toString().contains(
s.toString(), ignoreCase = true
)
})
}
})
binding.filterTxt.requestFocus()
}
private fun setToolBar() {
val listIcons: ArrayList<Drawable> = ArrayList()
val iconReload: Drawable = ResourcesCompat.getDrawable(
resources, R.drawable.ic_autorenew_black_24dp, null
)!!
val iconSettings: Drawable = ResourcesCompat.getDrawable(
resources, R.drawable.ic_setting_ui, null
)!!
listIcons.add(iconReload)
listIcons.add(iconSettings)
binding.mainToolbar.toolbarIcons.adapter =
ToolBarAdapter(listIcons, object : OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
when (item) {
iconReload -> viewModel.getStopMapTruckList(roadMap.id)
iconSettings -> {
ma.addFragment(
RoadMapSettingsFragment.newInstance(roadMap),
R.id.main_frame_layout,
PasilleroFragment.TAG,
true
)
}
}
}
})
binding.mainToolbar.toolbarIcons.layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
}
override fun observeViewModel() {
with(viewModel) {
loadStopMapTruckList.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull { showRoadMapList(it) }
}
}
}
private fun showRoadMapList(it: RoadStopMapTruckList) {
val lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
originalList = it.list
adapter = StopMapListAdapter(originalList,
object : OnStopMapClickListener {
@RequiresApi(Build.VERSION_CODES.Q)
override fun onStopMapClickListener(
item: RoadStopMapTruck,
entryPoint: String,
action: TruckAction,
view: View?
) {
when (action) {
TruckAction.UNLOAD -> {
ma.addFragmentOnTop(
StopMapPalletListFragment.newInstance(
title = item.description ?: "", item, action
)
)
}
TruckAction.LOAD -> {
ma.addFragmentOnTop(
StopMapPalletListFragment.newInstance(
title = item.description ?: "", item, action
)
)
}
TruckAction.GOTOMAPS -> {
val uri =
"geo:0,0?q=" + item.warehouse?.address?.nickname + " " + item.warehouse?.address?.street + " " + item.warehouse?.address?.city + " " + item.warehouse?.address?.postalCode
val locationIntent = Intent(Intent.ACTION_VIEW, Uri.parse(uri))
startActivity(locationIntent)
}
TruckAction.CALL -> {
showPhones(item)
}
TruckAction.OPTIONS -> {
val popupMenu = PopupMenu(requireContext(), view, Gravity.END)
popupMenu.inflate(R.menu.menu_options)
popupMenu.setForceShowIcon(true)
popupMenu.setOnMenuItemClickListener { itemOption ->
when (itemOption.itemId) {
R.id.maps -> {
if (item.warehouse?.address?.street == null) {
getString(R.string.errorLocation).toast(requireContext())
val uri =
"geo:0,0?q=" + item.warehouse?.address?.nickname + " " + item.warehouse?.address?.street + " " + item.warehouse?.address?.city + " " + item.warehouse?.address?.postalCode
val locationIntent =
Intent(Intent.ACTION_VIEW, Uri.parse(uri))
startActivity(locationIntent)
}
true
}
R.id.call -> {
showPhones(item)
true
}
else -> false
}
}
popupMenu.show()
}
}
}
})
binding.stopmapTruckRecyclerview.adapter = adapter
binding.stopmapTruckRecyclerview.layoutManager = lm
setFilter()
}
private fun showPhones(item: RoadStopMapTruck) {
val customDialogList = CustomDialogList(requireContext())
val phones: MutableList<GeneralItem> = mutableListOf()
//Tarea 6275
if (!item.warehouse?.address?.mobile.isNullOrBlank()) {
phones.add(
GeneralItem(
text = "${item.warehouse?.address?.mobile}",
code = item.warehouse?.address?.mobile
)
)
}
if (!item.warehouse?.address?.phone.isNullOrBlank()) {
phones.add(
GeneralItem(
text = "${item.warehouse?.address?.phone}",
code = item.warehouse?.address?.phone
)
)
}
if (!item.warehouse?.address?.client?.phone.isNullOrBlank()) {
phones.add(
GeneralItem(
text = "${item.warehouse?.address?.client?.phone}",
code = item.warehouse?.address?.client?.phone
)
)
}
customDialogList.setValueVisibility(View.GONE)
customDialogList.setTitle(getString(R.string.phones)).setKoButton(
getString(
R.string.cancel
)
) {
customDialogList.dismiss()
}.hideDialog().show()
val listPhonesAdapter = GeneralAdapter(phones, object : OnGeneralItemRowClickListener {
override fun OnGeneralItemRowClickListener(item: GeneralItem) {
phones.forEach {
if (it.code == item.code) {
if (ContextCompat.checkSelfPermission(
requireContext(), Manifest.permission.CALL_PHONE
) == PackageManager.PERMISSION_GRANTED
) {
val callIntent = Intent(Intent.ACTION_CALL)
callIntent.data = Uri.parse("tel:${it.code}")
startActivity(callIntent)
return@forEach
}
} else {
ActivityCompat.requestPermissions(
context as Activity,
arrayOf(Manifest.permission.CALL_PHONE),
REQUEST_CALL_PERMISSION
)
}
customDialogList.dismiss()
}
}
})
customDialogList.getRecyclerView().adapter = listPhonesAdapter
customDialogList.getRecyclerView().layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
}
}

View File

@ -1,4 +1,4 @@
package es.verdnatura.presentation.view.feature.truck.fragment
package es.verdnatura.presentation.view.feature.roadmap.fragment
import android.content.Context
import android.graphics.drawable.Drawable
@ -14,15 +14,15 @@ import es.verdnatura.presentation.common.OnOptionsSelectedListener
import es.verdnatura.presentation.common.OnPrintClickListener
import es.verdnatura.presentation.common.OnStopMapClickListener
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.truck.adapter.StopMapPalletListAdapter
import es.verdnatura.presentation.view.feature.truck.model.StopMapTruck
import es.verdnatura.presentation.view.feature.truck.model.StopMapTruckPallet
import es.verdnatura.presentation.view.feature.truck.model.StopMapTruckPalletList
import es.verdnatura.presentation.view.feature.truck.model.TruckAction
import es.verdnatura.presentation.view.feature.roadmap.adapter.StopMapPalletListAdapter
import es.verdnatura.presentation.view.feature.roadmap.model.RoadStopMapTruck
import es.verdnatura.presentation.view.feature.roadmap.model.StopMapTruckPallet
import es.verdnatura.presentation.view.feature.roadmap.model.StopMapTruckPalletList
import es.verdnatura.presentation.view.feature.roadmap.model.TruckAction
class StopMapPalletListFragment(
private var title: String,
private var stopMap: StopMapTruck,
private var stopMap: RoadStopMapTruck,
private var actionTruck: TruckAction
) : BaseFragment<FragmentStopmapTruckPalletListBinding, RoadMapListViewModel>(
RoadMapListViewModel::class
@ -34,7 +34,7 @@ class StopMapPalletListFragment(
private var indexPalletScanned = -1
companion object {
fun newInstance(title: String, roadMap: StopMapTruck, truckAction: TruckAction) =
fun newInstance(title: String, roadMap: RoadStopMapTruck, truckAction: TruckAction) =
StopMapPalletListFragment(title, roadMap, truckAction)
}

View File

@ -0,0 +1,104 @@
package es.verdnatura.presentation.view.feature.roadmap.model
import es.verdnatura.domain.isoToString
import es.verdnatura.presentation.common.getHourDay
data class RoadMapTruck(
var id: Int,
var trailerPlate: String?,
var observations: String?,
var driverName: String?,
var kmStart: Int?,
var kmEnd : Int?,
) {
var etd: String? = null
get() {
return (getHourDay(field.isoToString()))
}
var started: String? = null
get() {
return (field.isoToString())
}
var finished: String? = null
get() {
return (field.isoToString())
}
override fun toString(): String {
return "$etd$id$trailerPlate$observations$driverName"
}
}
data class RoadMapTruckList(
var list: List<RoadMapTruck> = listOf()
)
data class RoadStopMapTruck(
var id: Int,
var description: String?,
var warehouseFk: Int?,
var warehouse:Warehouse?,
) {
var eta: String? = null
get() {
return (getHourDay(field.isoToString()))
}
override fun toString(): String {
return "$description$id$warehouse$"
}
}
data class Warehouse(
var name:String?,
var address:Address?
)
data class Address(
var nickname:String?,
var street:String?,
var city:String?,
var postalCode:String?,
var phone:String?,
var mobile:String?,
var latitude:Double?,
var longitude:Double?,
var client:Client?,
)
data class Client(
var phone:String
)
data class RoadStopMapTruckList(
var list: List<RoadStopMapTruck> = listOf()
)
data class StopMapTruckPallet(
//var id :Int cuando esté acabado
var Pallet: Int,
var isScanned: Boolean = false
)
data class StopMapTruckPalletList(
var list: List<StopMapTruckPallet> = listOf()
)
enum class TruckAction {
LOAD,
UNLOAD,
CALL,
GOTOMAPS,
OPTIONS
}

View File

@ -1,119 +0,0 @@
package es.verdnatura.presentation.view.feature.truck.fragment
import android.content.Context
import android.graphics.drawable.Drawable
import android.text.Editable
import android.text.TextWatcher
import androidx.core.content.res.ResourcesCompat
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
import es.verdnatura.databinding.FragmentStopmapTruckListBinding
import es.verdnatura.domain.notNull
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnOptionsSelectedListener
import es.verdnatura.presentation.common.OnStopMapClickListener
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.truck.adapter.StopMapListAdapter
import es.verdnatura.presentation.view.feature.truck.model.RoadMapTruck
import es.verdnatura.presentation.view.feature.truck.model.StopMapTruck
import es.verdnatura.presentation.view.feature.truck.model.StopMapTruckList
class StopMapListFragment(
private var title: String,
private var roadMap: RoadMapTruck
) : BaseFragment<FragmentStopmapTruckListBinding, RoadMapListViewModel>(
RoadMapListViewModel::class
) {
private var adapter: StopMapListAdapter? = null
private var onStopMapClickListener: OnStopMapClickListener? = null
private var originalList = listOf<StopMapTruck>()
companion object {
fun newInstance(title: String, roadMap: RoadMapTruck) = StopMapListFragment(title, roadMap)
}
override fun onAttach(context: Context) {
if (context is OnStopMapClickListener) onStopMapClickListener = context
super.onAttach(context)
}
override fun getLayoutId(): Int = R.layout.fragment_stopmap_truck_list
override fun init() {
binding.mainToolbar.toolbarTitle.text =
getString(R.string.doublePointText, title, roadMap.trailerPlate)
binding.mainToolbar.backButton.setOnClickListener {
ma.onMyBackPressed()
}
setToolBar()
viewModel.getStopMapTruckList(roadMap.id)
super.init()
}
private fun setFilter() {
binding.filterTxt.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(
s: CharSequence?, start: Int, count: Int, after: Int
) {
}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
}
override fun afterTextChanged(s: Editable?) {
adapter!!.setList(originalList.filter { stopMapTruck ->
stopMapTruck.toString().contains(
s.toString(), ignoreCase = true
)
})
}
})
binding.filterTxt.requestFocus()
}
private fun setToolBar() {
val listIcons: ArrayList<Drawable> = ArrayList()
val iconReload: Drawable = ResourcesCompat.getDrawable(
resources, R.drawable.ic_autorenew_black_24dp, null
)!!
listIcons.add(iconReload)
binding.mainToolbar.toolbarIcons.adapter =
ToolBarAdapter(listIcons, object : OnOptionsSelectedListener {
override fun onOptionsItemSelected(item: Drawable) {
when (item) {
iconReload -> viewModel.getStopMapTruckList(roadMap.id)
}
}
})
binding.mainToolbar.toolbarIcons.layoutManager =
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
}
override fun observeViewModel() {
with(viewModel) {
loadStopMapTruckList.observe(viewLifecycleOwner) { event ->
event.getContentIfNotHandled().notNull { showRoadMapList(it) }
}
}
}
private fun showRoadMapList(it: StopMapTruckList) {
val lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
originalList = it.list
adapter = StopMapListAdapter(originalList, onStopMapClickListener!!)
binding.stopmapTruckRecyclerview.adapter = adapter
binding.stopmapTruckRecyclerview.layoutManager = lm
setFilter()
}
}

View File

@ -1,58 +0,0 @@
package es.verdnatura.presentation.view.feature.truck.model
import es.verdnatura.domain.isoToString
import es.verdnatura.presentation.common.getHourDay
data class RoadMapTruck(
var id: Int, var trailerPlate: String?, var observations: String?
) {
var etd: String? = null
get() {
return (getHourDay(field.isoToString()))
}
override fun toString(): String {
return "$etd$id$trailerPlate$observations"
}
}
data class RoadMapTruckList(
var list: List<RoadMapTruck> = listOf()
)
data class StopMapTruck(
var id: Int, var description: String?, var warehouse: Int?
) {
var eta: String? = null
get() {
return (getHourDay(field.isoToString()))
}
override fun toString(): String {
return "$description$id$warehouse$"
}
}
data class StopMapTruckList(
var list: List<StopMapTruck> = listOf()
)
data class StopMapTruckPallet(
//var id :Int cuando esté acabado
var Pallet: Int,
var isScanned: Boolean = false
)
data class StopMapTruckPalletList(
var list: List<StopMapTruckPallet> = listOf()
)
enum class TruckAction {
LOAD,
UNLOAD
}

View File

@ -0,0 +1,386 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/verdnatura_black">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/scan_input"
style="@style/ScanLineTextSearch"
android:layout_width="match_parent"
android:textColorHint="@android:color/white"
android:hint="@string/Escaneaetiqueta"
android:inputType="textVisiblePassword"
android:lines="1"
android:maxLines="1"
android:visibility="visible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/main_toolbar"/>
<include
android:id="@+id/main_toolbar"
layout="@layout/toolbar_fragment"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:id="@+id/layout_km_hour"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="visible"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/scan_input"
app:layout_constraintTop_toBottomOf="@+id/scan_input"
>
<TextView
android:id="@+id/textkm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:text="@string/km"
android:textAllCaps="true"
android:textColor="@color/verdnatura_white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/layout_km_hour" />
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:background="@color/colorPrimary"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView20" />
<LinearLayout
android:id="@+id/linearLayout6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout2">
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/km_init"
android:textColor="@color/verdnatura_white" />
<EditText
android:id="@+id/km_start"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@color/verdnatura_white"
android:ems="10"
android:gravity="center"
android:imeOptions="actionDone"
android:inputType="number"
android:maxLines="1"
android:padding="5dp"
android:autofillHints="phone"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout7"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout6">
<TextView
android:id="@+id/textView21"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/km_end"
android:textColor="@color/verdnatura_white" />
<EditText
android:id="@+id/km_end"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@color/verdnatura_white"
android:ems="10"
android:gravity="center"
android:imeOptions="actionDone"
android:inputType="number"
android:maxLines="1"
android:padding="5dp"
android:autofillHints="phone"/>
</LinearLayout>
<TextView
android:id="@+id/textHour"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:text="@string/hours"
android:textAllCaps="true"
android:visibility="gone"
android:textColor="@color/verdnatura_white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout7" />
<LinearLayout
android:id="@+id/linearLayout8"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:background="@color/colorPrimary"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView28" />
<LinearLayout
android:id="@+id/linearLayoutDateStart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:orientation="horizontal"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout8">
<TextView
android:id="@+id/textDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Hora de inicio"
android:textColor="@color/verdnatura_white" />
<EditText
android:id="@+id/hourStart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@color/verdnatura_white"
android:ems="10"
android:gravity="center"
android:imeOptions="actionDone"
android:maxLines="1"
android:padding="5dp"
android:inputType="number"
android:text="@string/zeroHour"
android:autofillHints="phone"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout9">
<TextView
android:id="@+id/textViewHours"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Hora de fin"
android:visibility="gone"
android:textColor="@color/verdnatura_white" />
<EditText
android:id="@+id/hourEnd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@color/verdnatura_white"
android:ems="10"
android:focusable="true"
android:gravity="center"
android:imeOptions="actionDone"
android:maxLines="1"
android:padding="5dp"
android:inputType="number"
android:visibility="gone"
android:text="@string/zeroHour"
android:autofillHints="phone"/>
</LinearLayout>
<TextView
android:id="@+id/textDateStart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="8dp"
android:text="FECHAS y HORAS"
android:textAllCaps="true"
android:textColor="@color/verdnatura_white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/hourEnd" />
<LinearLayout
android:id="@+id/linearDays"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:background="@color/colorPrimary"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView28" />
<LinearLayout
android:id="@+id/linearLayout9"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout8">
<TextView
android:id="@+id/textView212"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Fecha/Hora de inicio"
android:textColor="@color/verdnatura_white" />
<EditText
android:id="@+id/dateInit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@color/verdnatura_white"
android:ems="10"
android:gravity="center"
android:imeOptions="actionDone"
android:maxLines="1"
android:padding="5dp"
android:inputType="text"
android:autofillHints="phone"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayout9">
<TextView
android:id="@+id/textView2123"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Fecha/Hora de fin"
android:textColor="@color/verdnatura_white" />
<EditText
android:id="@+id/dateEnd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@color/verdnatura_white"
android:ems="10"
android:focusable="true"
android:gravity="center"
android:imeOptions="actionDone"
android:maxLines="1"
android:padding="5dp"
android:inputType="text"
android:autofillHints="phone"/>
</LinearLayout>
<TextView
android:id="@+id/saveButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="16dp"
android:text="@string/save"
android:textAlignment="center"
android:textColor="@color/verdnatura_pumpkin_orange"
android:textSize="@dimen/h7"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<CalendarView
android:id="@+id/calendarView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="visible"/>
<TextClock
android:id="@+id/textClock"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View File

@ -56,6 +56,14 @@
android:text="@string/Matrícula"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@string/driver"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2" />
</LinearLayout>

View File

@ -1,48 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
>
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
<variable
name="item"
type="es.verdnatura.presentation.view.feature.truck.model.RoadMapTruck" />
type="es.verdnatura.presentation.view.feature.roadmap.model.RoadMapTruck" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/item_row_layout"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/verdnatura_black_5"
android:orientation="horizontal"
android:paddingStart="@dimen/layout_margin_min"
android:paddingEnd="@dimen/layout_margin_min"
android:paddingTop="@dimen/pasilleros_margin_main_menu"
android:paddingEnd="@dimen/layout_margin_min"
android:paddingBottom="@dimen/pasilleros_margin_main_menu">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{String.valueOf(item.etd)}"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="center"/>
android:gravity="center"
android:text="@{String.valueOf(item.etd)}"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{item.trailerPlate}"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="center"/>
android:gravity="center"
android:text="@{item.trailerPlate}"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="@{item.driverName}"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"

View File

@ -6,7 +6,7 @@
<variable
name="item"
type="es.verdnatura.presentation.view.feature.truck.model.StopMapTruckPallet" />
type="es.verdnatura.presentation.view.feature.roadmap.model.StopMapTruckPallet" />
</data>
<LinearLayout
android:layout_width="match_parent"

View File

@ -6,7 +6,7 @@
<variable
name="item"
type="es.verdnatura.presentation.view.feature.truck.model.StopMapTruck" />
type="es.verdnatura.presentation.view.feature.roadmap.model.RoadStopMapTruck" />
</data>
<LinearLayout
@ -35,7 +35,7 @@
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="start"
android:gravity="center"
android:text="@{String.valueOf(item.eta)}"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2" />
@ -45,21 +45,37 @@
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="start"
android:gravity="center"
android:text="@{item.description}"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2" />
</LinearLayout>
<ImageView
android:id="@+id/ic_call"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginEnd="16dp"
android:contentDescription="@string/palletTruckUnLoad"
android:tooltipText="@string/palletTruckUnLoad"
android:visibility="gone"
app:srcCompat="@drawable/ic_phone" />
<ImageView
android:id="@+id/ubication"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginEnd="16dp"
android:contentDescription="@string/palletTruckUnLoad"
android:tooltipText="@string/palletTruckUnLoad"
android:visibility="gone"
app:srcCompat="@drawable/ic_location" />
<ImageView
android:id="@+id/loadPallet"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:contentDescription="@string/palletTruckLoad"
android:tag="1"
android:tooltipText="@string/palletTruckLoad"
app:srcCompat="@drawable/camion" />
@ -69,9 +85,16 @@
android:layout_height="32dp"
android:layout_marginEnd="16dp"
android:contentDescription="@string/palletTruckUnLoad"
android:tag="2"
android:tooltipText="@string/palletTruckUnLoad"
app:srcCompat="@drawable/camion_descarga" />
<ImageView
android:id="@+id/moreActions"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginEnd="16dp"
android:contentDescription="@string/actions"
android:tooltipText="@string/actions"
app:srcCompat="@drawable/ic_more_vert_black_24dp" />
</LinearLayout>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/call"
android:title="@string/call"
android:icon="@drawable/ic_phone"
android:iconTint="@color/verdnatura_orange_salix"
android:iconTintMode="multiply"
/>
<item
android:id="@+id/maps"
android:title="@string/showLocation"
android:icon="@drawable/ic_location"
android:iconTint="@color/verdnatura_orange_salix"
/>
</menu>

View File

@ -816,5 +816,16 @@
<string name="quantityBigger">La cantidad no puede ser mayor</string>
<string name="errorChangeCategory">Error al cambiar categoría</string>
<string name="palletNotFound">Pallet no encontrado</string>
<string name="driver">Conductor</string>
<string name="entryInputImage">Es necesario añadir alguna foto</string>
<string name="errorNotification">No se ha podido enviar notificación. Vuelva a intentarlo</string>
<string name="done">HECHO</string>
<string name="roadMapSettings">Ajustes roadMap</string>
<string name="call">Llamar</string>
<string name="showLocation">Ver ubicación</string>
<string name="errorLocation">No se puede mostrar ubicación</string>
<string name="selectDate">Seleccionar Fecha</string>
<string name="selectHour">Seleccionar Hora</string>
<string name="dateTime">%1$s %2$d:%3$d</string>
</resources>

View File

@ -818,5 +818,16 @@
<string name="quantityBigger">La cantidad no puede ser mayor</string>
<string name="errorChangeCategory">Error al cambiar categoría</string>
<string name="palletNotFound">Pallet no encontrado</string>
<string name="driver">Conductor</string>
<string name="entryInputImage">Es necesario añadir alguna foto</string>
<string name="errorNotification">No se ha podido enviar notificación. Vuelva a intentarlo</string>
<string name="done">HECHO</string>
<string name="roadMapSettings">Ajustes roadMap</string>
<string name="call">Llamar</string>
<string name="showLocation">Ver ubicación</string>
<string name="errorLocation">No se puede mostrar ubicación</string>
<string name="selectDate">Seleccionar Fecha</string>
<string name="selectHour">Seleccionar Hora</string>
<string name="dateTime">%1$s %2$d:%3$d</string>
</resources>