EntrySalix

This commit is contained in:
Sergio De la torre 2023-03-23 13:48:30 +01:00
parent db8ce4725f
commit 7b1508eed0
4 changed files with 60 additions and 11 deletions

View File

@ -83,12 +83,11 @@
</select> </select>
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="fa688d1c-dbee-4864-9e33-4d84ef9afca8" name="Default Changelist" comment="refs #4923 previas"> <list default="true" id="fa688d1c-dbee-4864-9e33-4d84ef9afca8" name="Default Changelist" comment="Version 23.10Beta">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginFragment.kt" afterDir="false" /> <change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/SalixService.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/SalixService.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/login/model/LoginItemVO.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/login/model/LoginItemVO.kt" afterDir="false" /> <change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/packaging/fragment/PackagingViewModel/SupplierViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/packaging/fragment/PackagingViewModel/SupplierViewModel.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/res/values-es/strings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values-es/strings.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/packaging/model/EntrySalix.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/packaging/model/EntrySalix.kt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/src/main/res/values/strings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values/strings.xml" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -185,7 +184,7 @@
</option> </option>
<option name="RECENT_BRANCH_BY_REPOSITORY"> <option name="RECENT_BRANCH_BY_REPOSITORY">
<map> <map>
<entry key="$PROJECT_DIR$" value="testBeta_5336" /> <entry key="$PROJECT_DIR$" value="testBeta" />
</map> </map>
</option> </option>
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
@ -783,7 +782,7 @@
<entry key="branch"> <entry key="branch">
<value> <value>
<list> <list>
<option value="testBeta_5109_Agrupar_sales_exandible_simple" /> <option value="4021_embalajes" />
</list> </list>
</value> </value>
</entry> </entry>

View File

@ -124,6 +124,16 @@ interface SalixService {
): ):
Call<List<Supplier>> Call<List<Supplier>>
fun getEntries(
//@Body params:JSONObject=JSONObject("""filter"={"fields":{"id":true,"name":true},"include":[{"relation":"contacts","scope":{"fields":["email"],"order":"id DESC","limit":1,"where":{"email":{"neq":null}}}}]}""")
/* @Query("filter") filter:String="{\"fields\":{\"id\":true,\"name\":true},\"include\":[{\"relation\":\"contacts\"," +
"\"scope\":{" +
"\"fields\":[\"email\"],\"order\":\"id DESC\",\"limit\":1," +
"\"where\":{ \"email\":{\"neq\":null } }}}]})"*/
):
Call<List<EntrySalix>>
@PUT("Entries")//REVISADA @PUT("Entries")//REVISADA
fun Entries( fun Entries(
@Body entry: EntrySalix @Body entry: EntrySalix

View File

@ -72,6 +72,46 @@ class PackagingViewModel(val context: Context) : BaseViewModel(context) {
}) })
} }
fun getEntries() {
salix.getSuppliers()
.enqueue(object :
SilexCallback<List<Supplier>>(context) {
override fun onError(t: Throwable) {
val listError: ArrayList<Supplier> = ArrayList()
listError.add(
Supplier(
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
t.message!!
)
)
)
_supplierList.value = SupplierList(listError)
}
override fun onSuccess(response: Response<List<Supplier>>) {
if (response.body() != null) {
_supplierList.value = response.body()?.let { SupplierList(it) }
} else {
val listError: ArrayList<Supplier> = ArrayList()
listError.add(
Supplier(
isError = true,
errorMessage = getMessageFromAllResponse(
nameofFunction(this),
response.message()
)
)
)
_supplierList.value = SupplierList(listError)
}
}
})
}
fun supplier_getItems(supplierFk: Any) { fun supplier_getItems(supplierFk: Any) {
silex.supplier_getItems(supplierFk) silex.supplier_getItems(supplierFk)

View File

@ -1,10 +1,10 @@
package es.verdnatura.presentation.view.feature.packaging.model package es.verdnatura.presentation.view.feature.packaging.model
class EntrySalix( class EntrySalix(
var id: String? = null, var id: Int? = null,
var supplierFk: String? = null, var supplierFk: Int? = null,
var travelFk: String? = null, var travelFk: Int? = null,
var companyFk: String? = null, var companyFk: Int? = null,
var isError: Boolean? = null, var isError: Boolean? = null,
var errorMessage: String? = null var errorMessage: String? = null
) )