refs #6921 feat:dropOffNotes
This commit is contained in:
parent
5f39620f69
commit
9e2d2f167e
|
@ -76,7 +76,7 @@ class TicketAdapter(
|
||||||
fun bind(item: ClientTicketSalix) {
|
fun bind(item: ClientTicketSalix) {
|
||||||
binding.apply {
|
binding.apply {
|
||||||
|
|
||||||
if (!item.ticketObservation.isNullOrEmpty()) {
|
if (!item.observationDelivery.isNullOrEmpty() && !item.observationDelivery!!.toString().contains("null")){
|
||||||
note.setColorFilter(
|
note.setColorFilter(
|
||||||
ContextCompat.getColor(
|
ContextCompat.getColor(
|
||||||
note.context, R.color.verdnatura_white
|
note.context, R.color.verdnatura_white
|
||||||
|
|
|
@ -2,7 +2,6 @@ package es.verdnatura.presentation.view.feature.delivery.fragments
|
||||||
|
|
||||||
import android.Manifest
|
import android.Manifest
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.app.AlertDialog
|
|
||||||
import android.app.TimePickerDialog
|
import android.app.TimePickerDialog
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
|
@ -317,7 +316,7 @@ class TicketsFragment(
|
||||||
ticket.id,
|
ticket.id,
|
||||||
ticket.packages,
|
ticket.packages,
|
||||||
ticket.ipt,
|
ticket.ipt,
|
||||||
ticket.ticketObservation,
|
ticket.observationDelivery,
|
||||||
ticket.cmrFk
|
ticket.cmrFk
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -425,6 +424,7 @@ class TicketsFragment(
|
||||||
|
|
||||||
val customDialogInput = CustomDialogInputNotes(requireContext())
|
val customDialogInput = CustomDialogInputNotes(requireContext())
|
||||||
customDialogInput.setTitle(getString(R.string.notes))
|
customDialogInput.setTitle(getString(R.string.notes))
|
||||||
|
//customDialogInput.setDescription(itemClient.observationDelivery.toString())
|
||||||
|
|
||||||
val adapter: GeneralAdapter
|
val adapter: GeneralAdapter
|
||||||
val itemsNotes: List<GeneralItem> = listOf(
|
val itemsNotes: List<GeneralItem> = listOf(
|
||||||
|
@ -449,6 +449,21 @@ class TicketsFragment(
|
||||||
customDialogInput.getRecyclerView().layoutManager =
|
customDialogInput.getRecyclerView().layoutManager =
|
||||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||||
customDialogInput.setOkButton(getString(R.string.save)) {
|
customDialogInput.setOkButton(getString(R.string.save)) {
|
||||||
|
//tarea 6921
|
||||||
|
/*if (itemClient.observationDropOff == null) {
|
||||||
|
viewModel.addNotesFromDropOff(
|
||||||
|
TicketObservation(
|
||||||
|
ticketFk = itemClient.id,
|
||||||
|
description = customDialogInput.getValue(),
|
||||||
|
observationTypeFk = 10
|
||||||
|
)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
viewModel.updateNotesFromDropOff(
|
||||||
|
itemClient.id,
|
||||||
|
description = customDialogInput.getValue()
|
||||||
|
)
|
||||||
|
}*/
|
||||||
viewModel.addNotes(itemClient.tickets, customDialogInput.getValue())
|
viewModel.addNotes(itemClient.tickets, customDialogInput.getValue())
|
||||||
customDialogInput.dismiss()
|
customDialogInput.dismiss()
|
||||||
}.setKoButton(getString(R.string.cancel)) {
|
}.setKoButton(getString(R.string.cancel)) {
|
||||||
|
@ -459,15 +474,48 @@ class TicketsFragment(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showNotes(item: ClientTicketSalix) {
|
fun showNotes(clientClicked: ClientTicketSalix) {
|
||||||
|
val ticketNotes: MutableList<GeneralItem> = mutableListOf()
|
||||||
|
//Tarea 6275
|
||||||
|
if (!clientClicked.observationDelivery.isNullOrBlank()) {
|
||||||
|
|
||||||
val alertDialog = AlertDialog.Builder(requireContext()).create()
|
ticketNotes.add(
|
||||||
alertDialog.setTitle(getString(R.string.info))
|
GeneralItem(
|
||||||
alertDialog.setMessage(item.ticketObservation)
|
text = "Reparto:${clientClicked.observationDelivery}",
|
||||||
alertDialog.setButton(
|
code = ""
|
||||||
AlertDialog.BUTTON_NEUTRAL, getString(R.string.close)
|
)
|
||||||
) { dialog, _ -> dialog.dismiss() }
|
)
|
||||||
alertDialog.show()
|
}
|
||||||
|
if (!clientClicked.observationDropOff.isNullOrBlank()) {
|
||||||
|
|
||||||
|
ticketNotes.add(
|
||||||
|
GeneralItem(
|
||||||
|
text = "Repartidor:${clientClicked.observationDropOff}",
|
||||||
|
code = ""
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
customDialogList.setValueVisibility(View.GONE)
|
||||||
|
customDialogList.setTitle(getString(R.string.ticketNotes)).setKoButton(
|
||||||
|
getString(
|
||||||
|
R.string.cancel
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
customDialogList.dismiss()
|
||||||
|
}.hideDialog().show()
|
||||||
|
|
||||||
|
val listPhonesAdapter = GeneralAdapter(ticketNotes, object : OnGeneralItemRowClickListener {
|
||||||
|
override fun OnGeneralItemRowClickListener(item: GeneralItem) {
|
||||||
|
|
||||||
|
customDialogList.dismiss()
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
customDialogList.getRecyclerView().adapter = listPhonesAdapter
|
||||||
|
customDialogList.getRecyclerView().layoutManager =
|
||||||
|
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ import es.verdnatura.presentation.view.feature.delivery.model.RouteDeliveryList
|
||||||
import es.verdnatura.presentation.view.feature.delivery.model.RouteInfo
|
import es.verdnatura.presentation.view.feature.delivery.model.RouteInfo
|
||||||
import es.verdnatura.presentation.view.feature.delivery.model.RouteList
|
import es.verdnatura.presentation.view.feature.delivery.model.RouteList
|
||||||
import es.verdnatura.presentation.view.feature.delivery.model.Ticket
|
import es.verdnatura.presentation.view.feature.delivery.model.Ticket
|
||||||
|
import es.verdnatura.presentation.view.feature.delivery.model.TicketObservation
|
||||||
import okhttp3.MediaType
|
import okhttp3.MediaType
|
||||||
import okhttp3.MultipartBody
|
import okhttp3.MultipartBody
|
||||||
import okhttp3.RequestBody
|
import okhttp3.RequestBody
|
||||||
|
@ -328,6 +329,23 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
arrayListOf(listTickets[0].Id, note).formatWithQuotes()
|
arrayListOf(listTickets[0].Id, note).formatWithQuotes()
|
||||||
).enqueue(object : SalixCallback<Any>(context) {})
|
).enqueue(object : SalixCallback<Any>(context) {})
|
||||||
}
|
}
|
||||||
|
fun addNotesFromDropOff(
|
||||||
|
ticketObservation: TicketObservation
|
||||||
|
|
||||||
|
) {
|
||||||
|
salix.addNoteFromDropOff(
|
||||||
|
ticketObservation
|
||||||
|
).enqueue(object : SalixCallback<Any>(context) {})
|
||||||
|
}
|
||||||
|
fun updateNotesFromDropOff(
|
||||||
|
ticketFK:Long, description:String
|
||||||
|
|
||||||
|
) {
|
||||||
|
salix.updateNoteFromDropOff(
|
||||||
|
where ="""{"ticketFk" : $ticketFK,"observationTypeFk":10}""" , params= hashMapOf("description" to description)
|
||||||
|
).enqueue(object : SalixCallback<Any>(context) {})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
fun imageUpload(
|
fun imageUpload(
|
||||||
warehouseId: Number,
|
warehouseId: Number,
|
||||||
|
|
Loading…
Reference in New Issue