Version 8.2 obligatorio sector para imprimir, Desmarcar sacador ok. Cambiado texto DiadeVenta.Añadido icono Parking previa. Actualiza datos en Previa. Nuevo diseño INVISIBLE
This commit is contained in:
parent
1341e08efe
commit
0595654d86
|
@ -0,0 +1,24 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import android.content.Context
|
||||
import retrofit2.Call
|
||||
|
||||
class GetClaimUserCase(context: Context) : RestClient(context) {
|
||||
|
||||
fun itemShelving_addByClaim(usuario: String, password: String,claimFK:String, shelvingFk: String): Call<Void> {
|
||||
val params: ArrayList<String> = ArrayList()
|
||||
params.add(claimFK)
|
||||
params.add(shelvingFk)
|
||||
return restClient!!.itemShelving_addByClaim(
|
||||
"json",
|
||||
"1",
|
||||
usuario,
|
||||
password,
|
||||
"application/json",
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,220 @@
|
|||
package es.verdnatura.presentation.view.feature.claim.fragment
|
||||
|
||||
|
||||
import android.view.View
|
||||
import android.view.View.GONE
|
||||
import android.view.View.VISIBLE
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentGeneralBlackBinding
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.common.GeneralAdapter
|
||||
import es.verdnatura.presentation.common.GeneralItem
|
||||
import es.verdnatura.presentation.common.OnGeneralItemRowClickListener
|
||||
import es.verdnatura.presentation.common.hideKeyboard
|
||||
import es.verdnatura.presentation.view.component.CustomDialog
|
||||
import es.verdnatura.presentation.view.component.CustomDialogList
|
||||
import es.verdnatura.presentation.view.feature.smarttag.model.SmartTag
|
||||
|
||||
class ClaimFragment(
|
||||
var entryPoint: String = ""
|
||||
) : BaseFragment<FragmentGeneralBlackBinding, ClaimViewModel>(
|
||||
ClaimViewModel::class
|
||||
) {
|
||||
|
||||
private var goBack: Boolean = false
|
||||
|
||||
override fun getLayoutId(): Int = R.layout.fragment_general_black
|
||||
private lateinit var customDialog: CustomDialog
|
||||
private lateinit var customDialogList: CustomDialogList
|
||||
private var listClaims: ArrayList<GeneralItem> = ArrayList()
|
||||
private var claimAdapter: GeneralAdapter? = null
|
||||
|
||||
|
||||
|
||||
companion object {
|
||||
fun newInstance(entryPoint: String) = ClaimFragment(entryPoint)
|
||||
}
|
||||
|
||||
|
||||
override fun init() {
|
||||
|
||||
customDialog = CustomDialog(requireContext())
|
||||
customDialogList = CustomDialogList(requireContext())
|
||||
goBack = false
|
||||
ma.hideBottomNavigation(GONE)
|
||||
binding.splashProgress.visibility = GONE
|
||||
|
||||
setEvents()
|
||||
setToolBar()
|
||||
setAdapter()
|
||||
showInputClaim()
|
||||
super.init()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
goBack = true
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
private fun setToolBar() {
|
||||
|
||||
binding.mainToolbar.toolbarTitle.text = entryPoint
|
||||
|
||||
}
|
||||
private fun setAdapter(){
|
||||
claimAdapter = GeneralAdapter(listClaims, object : OnGeneralItemRowClickListener {
|
||||
|
||||
override fun OnGeneralItemRowClickListener(item: GeneralItem) {
|
||||
|
||||
}
|
||||
})
|
||||
customDialogList.getRecyclerView().adapter = claimAdapter
|
||||
customDialogList.getRecyclerView().layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
}
|
||||
|
||||
private fun itemShelving_addByClaim(shelvingOrSmarttag: String) {
|
||||
|
||||
binding.splashProgress.visibility = VISIBLE
|
||||
viewModel.itemShelving_addByClaim(getData(USER),getData(PASSWORD),listClaims.first().toString(),shelvingOrSmarttag)
|
||||
customDialogList.dismiss()
|
||||
}
|
||||
|
||||
|
||||
private fun hideKeyboards() {
|
||||
try {
|
||||
requireActivity().hideKeyboard()
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
}
|
||||
|
||||
private fun setEvents() {
|
||||
|
||||
binding.mainToolbar.backButton.setOnClickListener {
|
||||
|
||||
customDialogList.dismiss()
|
||||
requireActivity().onBackPressed()
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
override fun observeViewModel() {
|
||||
|
||||
|
||||
with(viewModel) {
|
||||
binding.splashProgress.visibility = GONE
|
||||
|
||||
|
||||
responseadd.observe(viewLifecycleOwner, Observer {
|
||||
|
||||
if (it.isError) {
|
||||
customDialogList.dismiss()
|
||||
listClaims.clear()
|
||||
claimAdapter!!.notifyDataSetChanged()
|
||||
showInputClaim()
|
||||
ma.messageWithSound(it.errorMessage,true,false)
|
||||
} else {
|
||||
customDialogList.dismiss()
|
||||
ma.messageWithSound("Reclamación ${listClaims.first().code} guardada con matrícula ${listClaims.get(1).code}",false,true)
|
||||
listClaims.clear()
|
||||
claimAdapter!!.notifyDataSetChanged()
|
||||
showInputClaim()
|
||||
|
||||
|
||||
}
|
||||
binding.splashProgress.visibility = GONE
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun getTextToPosition(TagsScaned: Int): String {
|
||||
var message = "Datos completos"
|
||||
|
||||
when (TagsScaned) {
|
||||
1 -> message = "Escanea matrícula"
|
||||
|
||||
}
|
||||
|
||||
|
||||
return message
|
||||
|
||||
}
|
||||
|
||||
private fun getTextScaned(TagScaned: Int): String {
|
||||
var message = ""
|
||||
|
||||
when (TagScaned) {
|
||||
1 -> message = "Reclamación:"
|
||||
2 -> message = "Matrícula:"
|
||||
|
||||
}
|
||||
|
||||
return message
|
||||
|
||||
}
|
||||
|
||||
private fun add_item(itemScaned:String){
|
||||
var nameClaim: String
|
||||
|
||||
nameClaim =
|
||||
getTextScaned(listClaims.size + 1) + itemScaned
|
||||
customDialogList.setTitle(getTextToPosition(listClaims.size + 1))
|
||||
|
||||
listClaims.add(GeneralItem(itemScaned, nameClaim))
|
||||
claimAdapter!!.notifyDataSetChanged()
|
||||
//customDialogList.setValue("")
|
||||
|
||||
}
|
||||
|
||||
private fun showInputClaim() {
|
||||
|
||||
customDialogList.setTitle("Inserta el código de reclamación.")
|
||||
.setOkButton("Finalizar") {
|
||||
|
||||
ma.hideKeyboard(customDialogList.getEditText())
|
||||
|
||||
customDialogList.dismiss()
|
||||
requireActivity().onBackPressed()
|
||||
|
||||
|
||||
}.setValue("").show()
|
||||
|
||||
customDialogList.getEditText().requestFocus()
|
||||
ma.hideKeyboard(customDialogList.getEditText())
|
||||
|
||||
customDialogList.getEditText().setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5 || actionId == 6) {
|
||||
if (!customDialogList.getValue().isNullOrEmpty()) {
|
||||
|
||||
//listClaims.add(GeneralItem(customDialogList.getValue(),customDialogList.getValue()))
|
||||
add_item(customDialogList.getValue())
|
||||
|
||||
if (listClaims.size >1) {
|
||||
|
||||
itemShelving_addByClaim(customDialogList.getValue().uppercase())
|
||||
}
|
||||
|
||||
}
|
||||
customDialogList.setValue("")
|
||||
ma.hideKeyboard(customDialogList.getEditText())
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
hideKeyboard()
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
package es.verdnatura.presentation.view.feature.claim.fragment
|
||||
|
||||
|
||||
import android.content.Context
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import es.verdnatura.domain.GetClaimUserCase
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
class ClaimViewModel(context: Context) : BaseViewModel() {
|
||||
|
||||
private val GetClaimUserCase: GetClaimUserCase = GetClaimUserCase(context)
|
||||
|
||||
|
||||
private val _responseadd by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responseadd: LiveData<ResponseItemVO>
|
||||
get() = _responseadd
|
||||
|
||||
|
||||
|
||||
fun itemShelving_addByClaim(usuario:String,password:String,claimFK:String,shelvingFK:String){
|
||||
GetClaimUserCase.itemShelving_addByClaim(usuario,password,claimFK,shelvingFK).enqueue(object : Callback<Void>{
|
||||
override fun onFailure(call: Call<Void>, t: Throwable) {
|
||||
|
||||
_responseadd.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(
|
||||
nameofFunction(this),t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<Void>, response: Response<Void>) {
|
||||
|
||||
if (!response.isSuccessful){
|
||||
_responseadd.value = ResponseItemVO(isError = true,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
|
||||
}else{
|
||||
_responseadd.value = ResponseItemVO(isError = false,errorMessage = getMessageFromAllResponse(nameofFunction(this),response.message()))
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun messageError(message: String,call: String ): ResponseItemVO? {
|
||||
return ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = "Error al llamar a " + call + " . Descripción del error:" + message
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="@color/verdnatura_pumpkin_orange">
|
||||
|
||||
<item android:id="@android:id/mask">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/verdnatura_white" />
|
||||
<corners android:radius="10dp" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
|
||||
</ripple>
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="1024dp"
|
||||
android:height="1024dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:fillColor="#F7931E"
|
||||
android:pathData="M694.4,966.4c12.8,-28.8 38.4,-51.2 73.6,-51.2v-57.6c-64,0 -118.4,48 -131.2,108.8h-54.4c9.6,-96 89.6,-166.4 185.6,-166.4v-57.6c-76.8,0 -144,35.2 -188.8,92.8v-262.4c57.6,-6.4 115.2,-35.2 156.8,-80 51.2,-51.2 76.8,-118.4 76.8,-192v-28.8h-28.8c-70.4,0 -134.4,28.8 -185.6,80 -6.4,9.6 -16,16 -22.4,25.6v-204.8c0,-48 -16,-89.6 -48,-124.8 -32,-32 -73.6,-51.2 -118.4,-51.2 -83.2,3.2 -153.6,67.2 -166.4,150.4 -86.4,12.8 -153.6,89.6 -153.6,185.6v198.4l112,-83.2 67.2,67.2 73.6,-67.2 108.8,86.4v-201.6c0,-92.8 -64,-169.6 -147.2,-182.4 12.8,-51.2 57.6,-89.6 108.8,-89.6 28.8,0 57.6,12.8 80,35.2s32,51.2 32,83.2v691.2c-28.8,-28.8 -70.4,-44.8 -115.2,-44.8v57.6c54.4,0 99.2,38.4 112,89.6h-342.4v51.2h755.2v-57.6h-240zM640,393.6c32,-32 70.4,-54.4 115.2,-60.8 -6.4,44.8 -28.8,86.4 -57.6,118.4 -32,32 -70.4,54.4 -115.2,60.8 3.2,-44.8 25.6,-86.4 57.6,-118.4zM393.6,332.8v83.2l-51.2,-41.6 -70.4,60.8 -60.8,-60.8 -64,44.8v-86.4c0,-70.4 54.4,-128 124.8,-128 64,0 121.6,57.6 121.6,128z"/>
|
||||
</vector>
|
|
@ -0,0 +1,43 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/verdnatura_black">
|
||||
|
||||
<include
|
||||
android:id="@+id/main_toolbar"
|
||||
layout="@layout/toolbar"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/splash_progress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/verdnatura_black_8_alpha_6"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:visibility="visible">
|
||||
|
||||
<com.airbnb.lottie.LottieAnimationView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/verdnatura_logo_large_height"
|
||||
app:lottie_autoPlay="true"
|
||||
app:lottie_loop="true"
|
||||
app:lottie_rawRes="@raw/orange_loading"
|
||||
app:lottie_speed="2" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
Loading…
Reference in New Issue