diff --git a/app/src/main/java/es/verdnatura/domain/SalixService.kt b/app/src/main/java/es/verdnatura/domain/SalixService.kt index c77dac17..eaf77dd7 100644 --- a/app/src/main/java/es/verdnatura/domain/SalixService.kt +++ b/app/src/main/java/es/verdnatura/domain/SalixService.kt @@ -899,7 +899,7 @@ interface SalixService { @Query("filter") filter: String = """{"where": {"isActive": true}}""" ): Call> - @GET("RoadMapStops") + @GET("RoadmapStops") fun roadMapStopGet( @Query("filter") filter: String ): Call> @@ -915,7 +915,7 @@ interface SalixService { @Body params: Any ): Call - @GET("RoadMapStops") + @GET("RoadmapStops") fun getStopMapTruckList( @Query("filter") filter: String ): Call> @@ -928,7 +928,7 @@ interface SalixService { @GET("RoadmapStops/getPalletMatchState") fun getPalletMatchState( - @Query("roadMapStopFk") roadMapStopFk: Int, + @Query("truckFk") roadMapStopFk: Int, @Query("state") state: String ): Call> diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/roadmap/fragment/RoadMapListViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/roadmap/fragment/RoadMapListViewModel.kt index f6a72fe6..81a40338 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/roadmap/fragment/RoadMapListViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/roadmap/fragment/RoadMapListViewModel.kt @@ -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", diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/roadmap/fragment/StopMapListFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/roadmap/fragment/StopMapListFragment.kt index 13d0b087..00d5f763 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/roadmap/fragment/StopMapListFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/roadmap/fragment/StopMapListFragment.kt @@ -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 = 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 ) ) } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/roadmap/model/RoadMap.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/roadmap/model/RoadMap.kt index 5e70ecf8..b83dac5b 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/roadmap/model/RoadMap.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/roadmap/model/RoadMap.kt @@ -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?,