feat roadMap #refs 7195

This commit is contained in:
Sergio De la torre 2024-07-05 13:26:06 +02:00
parent e8a169e274
commit 7a16d32d26
4 changed files with 29 additions and 43 deletions

View File

@ -899,7 +899,7 @@ interface SalixService {
@Query("filter") filter: String = """{"where": {"isActive": true}}"""
): Call<List<ItemPackingType>>
@GET("RoadMapStops")
@GET("RoadmapStops")
fun roadMapStopGet(
@Query("filter") filter: String
): Call<List<ItemExpeditionTruckVO>>
@ -915,7 +915,7 @@ interface SalixService {
@Body params: Any
): Call<Any>
@GET("RoadMapStops")
@GET("RoadmapStops")
fun getStopMapTruckList(
@Query("filter") filter: String
): Call<List<RoadStopMapTruck>>
@ -928,7 +928,7 @@ interface SalixService {
@GET("RoadmapStops/getPalletMatchState")
fun getPalletMatchState(
@Query("roadMapStopFk") roadMapStopFk: Int,
@Query("truckFk") roadMapStopFk: Int,
@Query("state") state: String
): Call<List<StopMapTruckPallet>>

View File

@ -62,29 +62,12 @@ class RoadMapListViewModel(val context: Context) : BaseViewModel(context) {
}
fun getStopMapTruckList(roadMap: Int) {
salix.getStopMapTruckList(
"""{
"where": {
"roadmapFk": $roadMap
},
"fields": ["id", "eta", "description", "addressFk"],
"include": [
{
"relation": "address",
"scope": {
"fields": ["id","nickname", "street", "city", "postalCode", "latitude", "longitude", "mobile", "phone", "address", "clientFk"],
"include": [
{
"relation": "client",
"scope": {
"fields": ["phone"]
}
}
]
}
}
]
}"""
"""{ "where": { "roadmapFk": $roadMap }, "fields": ["id", "eta", "description", "addressFk"],
|"include": [ { "relation":"address", "scope":{ "fields":["addressFk"],
|"include":{ "relation": "address", "scope": { "fields": ["id","nickname", "street", "city", "postalCode", "latitude", "longitude", "mobile", "phone", "address", "clientFk"],
|"include": [ { "relation": "client", "scope": { "fields": ["phone"] } } ] } }}} ] }""".trimMargin()
/* """{ "where":{"roadMapFk":$roadMap},
| "fields": [ "id","eta","description","addressFk"],
| "include": [ { "relation": "address",

View File

@ -145,8 +145,8 @@ class StopMapListFragment(
println("llista addressFk ${item.addressFk}")
println("llista id" + item.id)
println("llista address" +item.address)
println("llista client id" +item.address?.client)
println("llista mobile " +item.address?.mobile)
println("llista client id" +item.address?.address?.client)
println("llista mobile " +item.address?.address?.mobile)
}
showRoadMapList(it) }
}
@ -192,7 +192,7 @@ class StopMapListFragment(
println("locationMaps")
val uri =
"geo:0,0?q=" + item.address?.nickname + " " + item.address?.street + " " + item.address?.city + " " + item.address?.postalCode
"geo:0,0?q=" + item.address?.address?.nickname + " " + item.address?.address?.street + " " + item.address?.address?.city + " " + item.address?.address?.postalCode
val locationIntent = Intent(Intent.ACTION_VIEW, Uri.parse(uri))
startActivity(locationIntent)
}
@ -211,17 +211,16 @@ class StopMapListFragment(
R.id.maps -> {
val uri:String
if (item.address?.street != null) {
getString(R.string.errorLocation).toast(requireContext())
uri = "geo:0,0?q=" + item.address?.nickname + " " + item.address?.street + " " + item.address?.city + " " + item.address?.postalCode
if (item.address?.address?.street != null) {
uri = "geo:0,0?q=" + item.address?.address?.nickname + " " + item.address?.address?.street + " " + item.address?.address?.city + " " + item.address?.address?.postalCode
val locationIntent =
Intent(Intent.ACTION_VIEW, Uri.parse(uri))
startActivity(locationIntent)
}else{
if (item.address?.latitude == null || item.address?.longitude == null){
if (item.address?.address?.latitude == null || item.address?.address?.longitude == null){
getString(R.string.errorLocation).toast(requireContext())
}else{
uri = "geo:${item.address?.latitude},${item.address?.longitude}"
uri = "geo:${item.address?.address?.latitude},${item.address?.address?.longitude}"
val locationIntent =
Intent(Intent.ACTION_VIEW, Uri.parse(uri))
startActivity(locationIntent)}
@ -259,27 +258,27 @@ class StopMapListFragment(
val phones: MutableList<GeneralItem> = mutableListOf()
//Tarea 6275
if (!item.address?.mobile.isNullOrBlank()) {
if (!item.address?.address?.mobile.isNullOrBlank()) {
phones.add(
GeneralItem(
text = "${item.address?.mobile}",
code = item.address?.mobile
text = "${item.address?.address?.mobile}",
code = item.address?.address?.mobile
)
)
}
if (!item.address?.phone.isNullOrBlank()) {
if (!item.address?.address?.phone.isNullOrBlank()) {
phones.add(
GeneralItem(
text = "${item.address?.phone}",
code = item.address?.phone
text = "${item.address?.address?.phone}",
code = item.address?.address?.phone
)
)
}
if (!item.address?.client?.phone.isNullOrBlank()) {
if (!item.address?.address?.client?.phone.isNullOrBlank()) {
phones.add(
GeneralItem(
text = "${item.address?.client?.phone}",
code = item.address?.client?.phone
text = "${item.address?.address?.client?.phone}",
code = item.address?.address?.client?.phone
)
)
}

View File

@ -50,7 +50,7 @@ data class RoadStopMapTruck(
}
override fun toString(): String {
return "$description$id${address?.nickname}$"
return "$description$id${address?.address?.nickname}$"
}
}
@ -62,6 +62,10 @@ data class RoadStopMapTruck(
)*/
data class Address(
var id: Int,
var address:AddressData
)
data class AddressData(
var nickname:String?,
var street:String?,
var city:String?,