feat notesDelivery #refs 6921
This commit is contained in:
parent
6e2a57cdb8
commit
d20f300a43
|
@ -5,7 +5,6 @@ import androidx.lifecycle.LiveData
|
|||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.map
|
||||
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.common.ResponseItemVO
|
||||
|
@ -24,7 +23,6 @@ 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.RouteList
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.Ticket
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.TicketObservation
|
||||
import okhttp3.MediaType
|
||||
import okhttp3.MultipartBody
|
||||
import okhttp3.RequestBody
|
||||
|
@ -74,6 +72,11 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
private val _responseSign by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responseSign: LiveData<ResponseItemVO> = _responseSign
|
||||
|
||||
private val _responseNotes by lazy { MutableLiveData<Boolean>() }
|
||||
val responseNotes: LiveData<Boolean> = _responseNotes
|
||||
var loadNotes: LiveData<Event<Boolean>> = _responseNotes.map { Event(it) }
|
||||
|
||||
|
||||
private val _expeditionList by lazy { MutableLiveData<ExpeditionList>() }
|
||||
val expeditionList: LiveData<ExpeditionList> = _expeditionList
|
||||
|
||||
|
@ -176,12 +179,12 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
]
|
||||
}""".trim()
|
||||
).enqueue(object : SalixCallback<List<RouteDelivery>>(context) {
|
||||
override fun onSuccess(response: Response<List<RouteDelivery>>) {
|
||||
override fun onSuccess(response: Response<List<RouteDelivery>>) {
|
||||
|
||||
_routeInfoList.value = response.body()?.let { RouteDeliveryList(it) }
|
||||
_routeInfoList.value = response.body()?.let { RouteDeliveryList(it) }
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
@ -299,23 +302,7 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun addNotes(
|
||||
listTickets: MutableList<Ticket>, note: String
|
||||
|
||||
) {
|
||||
salix.addNote(
|
||||
arrayListOf(listTickets[0].Id, note).formatWithQuotes()
|
||||
).enqueue(object : SalixCallback<Any>(context) {})
|
||||
}
|
||||
|
||||
fun addNotesFromDropOff(
|
||||
ticketObservation: TicketObservation
|
||||
|
||||
) {
|
||||
salix.addNoteFromDropOff(
|
||||
ticketObservation
|
||||
).enqueue(object : SalixCallback<Any>(context) {})
|
||||
}
|
||||
|
||||
fun updateNotesFromDropOff(
|
||||
ticketFK: Long, description: String
|
||||
|
@ -324,7 +311,29 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
salix.updateNoteFromDropOff(
|
||||
where = """{"ticketFk" : $ticketFK,"observationTypeFk":10}""",
|
||||
params = hashMapOf("description" to description)
|
||||
).enqueue(object : SalixCallback<Any>(context) {})
|
||||
).enqueue(object : SalixCallback<Any>(context) {
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_responseNotes.value = true
|
||||
super.onSuccess(response)
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun addFropOff(
|
||||
ticketFK: Long, note: String
|
||||
|
||||
) {
|
||||
salix.addFropOff(
|
||||
ticketFK, note
|
||||
|
||||
).enqueue(object : SalixCallback<Any>(context) {
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_responseNotes.value = true
|
||||
super.onSuccess(response)
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun imageUpload(
|
||||
|
|
Loading…
Reference in New Issue