edit barcodes
This commit is contained in:
parent
5761dd4144
commit
e115da9370
|
@ -37,4 +37,27 @@ class GetItemCardUserCase : RestClient() {
|
|||
params.add(warehouseFk)
|
||||
return restClient!!.updateGrouping("json","1",usuario,password,"application/json",params = params)!!
|
||||
}
|
||||
|
||||
fun updatePacking(usuario:String,password:String,itemFk:String,value:String ,warehouseFk:String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
params.add(itemFk)
|
||||
params.add(value)
|
||||
params.add(warehouseFk)
|
||||
return restClient!!.updatePacking("json","1",usuario,password,"application/json",params = params)!!
|
||||
}
|
||||
|
||||
fun itemSaveMin(usuario:String,password:String,itemFk:String,value:String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
params.add(itemFk)
|
||||
params.add(value)
|
||||
return restClient!!.itemSaveMin("json","1",usuario,password,"application/json",params = params)!!
|
||||
}
|
||||
|
||||
fun barcodes_edit(usuario:String,password:String,itemFk:String,value:String, delete:String) : Call<String> {
|
||||
val params:ArrayList<String> = ArrayList();
|
||||
params.add(value)
|
||||
params.add(itemFk)
|
||||
params.add(delete)
|
||||
return restClient!!.barcodes_edit("json","1",usuario,password,"application/json",params = params)!!
|
||||
}
|
||||
}
|
|
@ -77,4 +77,32 @@ interface VerdnaturaService {
|
|||
@Body params: List<String>):
|
||||
Call<String>
|
||||
|
||||
@POST("almacenv2/buy_updatePacking")
|
||||
fun updatePacking(@Header("aplicacion") aplicacion: String,
|
||||
@Header("version") version: String,
|
||||
@Header("user") user: String,
|
||||
@Header("pass") pass: String,
|
||||
@Header("Content-Type") content_type: String,
|
||||
@Body params: List<String>):
|
||||
Call<String>
|
||||
|
||||
@POST("almacenv2/itemSaveMin")
|
||||
fun itemSaveMin(@Header("aplicacion") aplicacion: String,
|
||||
@Header("version") version: String,
|
||||
@Header("user") user: String,
|
||||
@Header("pass") pass: String,
|
||||
@Header("Content-Type") content_type: String,
|
||||
@Body params: List<String>):
|
||||
Call<String>
|
||||
|
||||
|
||||
@POST("almacenv2/barcodes_edit")
|
||||
fun barcodes_edit(@Header("aplicacion") aplicacion: String,
|
||||
@Header("version") version: String,
|
||||
@Header("user") user: String,
|
||||
@Header("pass") pass: String,
|
||||
@Header("Content-Type") content_type: String,
|
||||
@Body params: List<String>):
|
||||
Call<String>
|
||||
|
||||
}
|
|
@ -1,7 +1,5 @@
|
|||
package es.verdnatura.presentation.common
|
||||
|
||||
import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
|
||||
|
||||
class ResponseItemVO (
|
||||
var response:String = "",
|
||||
var isError: Boolean = false,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package es.verdnatura.presentation.common
|
||||
|
||||
import es.verdnatura.presentation.view.feature.ajustes.model.AjustesItemVO
|
||||
import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
|
||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardRowVO
|
||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||
|
||||
|
@ -15,4 +16,8 @@ interface OnAjustesItemClickListener {
|
|||
|
||||
interface OnItemCardRowClickListener {
|
||||
fun onItemCardRowClickListener(item: ItemCardRowVO)
|
||||
}
|
||||
|
||||
interface OnBarcodeRowClickListener {
|
||||
fun onBarcodeRowClickListener(item: BarcodeVO)
|
||||
}
|
|
@ -3,10 +3,8 @@ package es.verdnatura.presentation.view.component
|
|||
import android.app.Dialog
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import android.widget.EditText
|
||||
import com.google.android.material.textfield.TextInputEditText
|
||||
import es.verdnatura.R
|
||||
import kotlinx.android.synthetic.main.component_custom_dialog.*
|
||||
import kotlinx.android.synthetic.main.component_custom_dialog.custom_dialog_button_ko
|
||||
import kotlinx.android.synthetic.main.component_custom_dialog.custom_dialog_button_ok
|
||||
import kotlinx.android.synthetic.main.component_custom_dialog.custom_dialog_description
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
package es.verdnatura.presentation.view.component
|
||||
|
||||
import android.app.Dialog
|
||||
import android.content.Context
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.google.android.material.textfield.TextInputEditText
|
||||
import es.verdnatura.R
|
||||
import kotlinx.android.synthetic.main.component_custom_list_dialog.*
|
||||
|
||||
|
||||
class CustomDialogList (context: Context) : Dialog(context, R.style.DialogTheme) {
|
||||
|
||||
init {
|
||||
setContentView(R.layout.component_custom_list_dialog)
|
||||
}
|
||||
|
||||
fun getRecyclerView() : RecyclerView {
|
||||
return item_recyclerview
|
||||
}
|
||||
|
||||
fun getEditText() : TextInputEditText {
|
||||
return custom_dialog_value
|
||||
}
|
||||
|
||||
fun getValue() : String {
|
||||
return custom_dialog_value.text.toString()
|
||||
}
|
||||
|
||||
fun setValue(value : String): CustomDialogList{
|
||||
custom_dialog_value.setText(value)
|
||||
custom_dialog_value.visibility = View.VISIBLE
|
||||
return this
|
||||
}
|
||||
|
||||
fun setTitle(title: String): CustomDialogList {
|
||||
custom_dialog_title.visibility = View.VISIBLE
|
||||
custom_dialog_title.text = title
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
fun setOkButton(text: String, onButtonClicked: () -> Unit): CustomDialogList {
|
||||
custom_dialog_button_ok.visibility = View.VISIBLE
|
||||
custom_dialog_button_ok.text = text
|
||||
custom_dialog_button_ok.setOnClickListener { onButtonClicked() }
|
||||
return this
|
||||
}
|
||||
|
||||
fun setKoButton(text: String, onButtonClicked: () -> Unit): CustomDialogList {
|
||||
custom_dialog_button_ko.visibility = View.VISIBLE
|
||||
custom_dialog_button_ko.text = text
|
||||
custom_dialog_button_ko.setOnClickListener { onButtonClicked() }
|
||||
return this
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package es.verdnatura.presentation.view.feature.articulo.adapter
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import es.verdnatura.databinding.ItemBarcodeRowBinding
|
||||
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
|
||||
import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
|
||||
|
||||
class BarcodeAdapter(
|
||||
private val items: List<BarcodeVO>,
|
||||
private val onBarcodeRowClickListener: OnBarcodeRowClickListener
|
||||
): RecyclerView.Adapter<BarcodeAdapter.ItemHolder> () {
|
||||
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
|
||||
return ItemHolder(
|
||||
ItemBarcodeRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
|
||||
)
|
||||
}
|
||||
|
||||
override fun getItemCount() =items.size
|
||||
|
||||
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
|
||||
holder.bind(items[position])
|
||||
|
||||
holder.binding.root.setOnClickListener {
|
||||
onBarcodeRowClickListener.onBarcodeRowClickListener(items[position])
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class ItemHolder(
|
||||
val binding: ItemBarcodeRowBinding
|
||||
) : RecyclerView.ViewHolder(binding.root){
|
||||
private val res = binding.root.context.resources
|
||||
fun bind(item: BarcodeVO) {
|
||||
binding.apply {
|
||||
this.item = item
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,12 +5,8 @@ import android.view.View
|
|||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.ItemAjustesRowBinding
|
||||
import es.verdnatura.databinding.ItemCardRowBinding
|
||||
import es.verdnatura.presentation.common.OnAjustesItemClickListener
|
||||
import es.verdnatura.presentation.common.OnItemCardRowClickListener
|
||||
import es.verdnatura.presentation.view.feature.ajustes.adapter.AjustesAdapter
|
||||
import es.verdnatura.presentation.view.feature.ajustes.model.AjustesItemVO
|
||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardRowVO
|
||||
|
||||
class ItemCardAdapter (
|
||||
|
@ -44,6 +40,7 @@ class ItemCardAdapter (
|
|||
fun bind(item: ItemCardRowVO) {
|
||||
binding.apply {
|
||||
if (item.barcodes.isNotEmpty()){
|
||||
item.value = ""
|
||||
item.barcodes.forEach {
|
||||
item.value = item.value + it.code + "\n"
|
||||
}
|
||||
|
|
|
@ -3,9 +3,7 @@ package es.verdnatura.presentation.view.feature.articulo.fragment
|
|||
|
||||
|
||||
import android.content.Intent
|
||||
import android.content.LocusId
|
||||
import android.content.SharedPreferences
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import androidx.lifecycle.Observer
|
||||
|
@ -13,12 +11,15 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
|||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentItemCardBinding
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
|
||||
import es.verdnatura.presentation.common.OnItemCardRowClickListener
|
||||
import es.verdnatura.presentation.common.addFragment
|
||||
import es.verdnatura.presentation.common.loadUrl
|
||||
import es.verdnatura.presentation.view.component.CustomDialog
|
||||
import es.verdnatura.presentation.view.component.CustomDialogInput
|
||||
import es.verdnatura.presentation.view.component.CustomDialogList
|
||||
import es.verdnatura.presentation.view.feature.articulo.adapter.BarcodeAdapter
|
||||
import es.verdnatura.presentation.view.feature.articulo.adapter.ItemCardAdapter
|
||||
import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
|
||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardRowVO
|
||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
|
||||
import es.verdnatura.presentation.view.feature.imageview.activity.ImageViewActivity
|
||||
|
@ -36,13 +37,16 @@ class ItemCardFragment : BaseFragment<FragmentItemCardBinding,ItemCardViewModel>
|
|||
private var warehouseFk = ""
|
||||
private var itemFk = ""
|
||||
private var adapter : ItemCardAdapter? = null
|
||||
private var barcodeAdapter : BarcodeAdapter? = null
|
||||
private var listItemsRow:ArrayList<ItemCardRowVO> = ArrayList()
|
||||
private var listBarcodes:ArrayList<BarcodeVO> = ArrayList()
|
||||
|
||||
companion object {
|
||||
fun newInstance() = ItemCardFragment()
|
||||
}
|
||||
private lateinit var customDialog: CustomDialog
|
||||
private lateinit var customDialogInput: CustomDialogInput
|
||||
private lateinit var customDialogList: CustomDialogList
|
||||
|
||||
override fun getLayoutId(): Int = R.layout.fragment_item_card
|
||||
|
||||
|
@ -53,6 +57,7 @@ class ItemCardFragment : BaseFragment<FragmentItemCardBinding,ItemCardViewModel>
|
|||
toolbar_title.text = "ItemCard"
|
||||
customDialog = CustomDialog(requireContext())
|
||||
customDialogInput = CustomDialogInput(requireContext())
|
||||
customDialogList = CustomDialogList(requireContext())
|
||||
super.init()
|
||||
}
|
||||
|
||||
|
@ -143,39 +148,48 @@ class ItemCardFragment : BaseFragment<FragmentItemCardBinding,ItemCardViewModel>
|
|||
listItemsRow.add(ItemCardRowVO(title = "Total",value = itemInfo.total,isEditable = false))
|
||||
listItemsRow.add(ItemCardRowVO(title = "Disponible",value = itemInfo.available,isEditable = false))
|
||||
listItemsRow.add(ItemCardRowVO(title = "Ubicado",value = itemInfo.enAltillo,isEditable = false))
|
||||
//EDITABLES
|
||||
|
||||
//EDITABLES
|
||||
listItemsRow.add(ItemCardRowVO(title = "SIN UBICAR",value = itemInfo.enNicho,isEditable = true, action = "itemStockUpdate"))
|
||||
listItemsRow.add(ItemCardRowVO(title = "NICHO",value = itemInfo.nicho,isEditable = true, action = "itemPlacementSave"))
|
||||
listItemsRow.add(ItemCardRowVO(title = "RESERVA",value = itemInfo.reserva,isEditable = true, action = "itemPlacementSave"))
|
||||
listItemsRow.add(ItemCardRowVO(title = "GROUPING",value = itemInfo.grouping,isEditable = true, action = "updateGrouping"))
|
||||
listItemsRow.add(ItemCardRowVO(title = "PACKING",value = itemInfo.packing,isEditable = true))
|
||||
listItemsRow.add(ItemCardRowVO(title = "MINIMO",value = itemInfo.min,isEditable = true))
|
||||
listItemsRow.add(ItemCardRowVO(title = "BARCODE",barcodes = itemInfo.barcodes,isEditable = true))
|
||||
listItemsRow.add(ItemCardRowVO(title = "PACKING",value = itemInfo.packing,isEditable = true, action = "updatePacking"))
|
||||
listItemsRow.add(ItemCardRowVO(title = "MINIMO",value = itemInfo.min,isEditable = true, action = "itemSaveMin"))
|
||||
listItemsRow.add(ItemCardRowVO(title = "BARCODE",barcodes = itemInfo.barcodes,isEditable = true, action = "toBarcode"))
|
||||
listBarcodes = itemInfo.barcodes as ArrayList<BarcodeVO>
|
||||
|
||||
adapter = ItemCardAdapter(listItemsRow,object: OnItemCardRowClickListener{
|
||||
override fun onItemCardRowClickListener(item: ItemCardRowVO) {
|
||||
customDialogInput.setTitle(item.title!!).setDescription("Valor actual: "+item.value!!).setOkButton("Guardar"){
|
||||
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
|
||||
editItemCardRow(item,customDialogInput.getValue())
|
||||
customDialogInput.hide()
|
||||
|
||||
}.setKoButton("Cancelar"){
|
||||
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
|
||||
customDialogInput.hide()
|
||||
}.setValue("").show()
|
||||
customDialogInput.getEditText().requestFocus()
|
||||
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
if (!customDialogInput.getValue().isNullOrEmpty())
|
||||
editItemCardRow(item,customDialogInput.getValue())
|
||||
customDialogInput.setValue("")
|
||||
customDialogInput.hide()
|
||||
|
||||
if(item.action != "toBarcode"){
|
||||
customDialogInput.setTitle(item.title!!).setDescription("Valor actual: "+item.value!!).setOkButton("Guardar"){
|
||||
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
|
||||
return@setOnEditorActionListener true
|
||||
editItemCardRow(item,customDialogInput.getValue())
|
||||
customDialogInput.hide()
|
||||
|
||||
}.setKoButton("Cancelar"){
|
||||
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
|
||||
customDialogInput.hide()
|
||||
}.setValue("").show()
|
||||
customDialogInput.getEditText().requestFocus()
|
||||
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
if (!customDialogInput.getValue().isNullOrEmpty())
|
||||
editItemCardRow(item,customDialogInput.getValue())
|
||||
customDialogInput.setValue("")
|
||||
customDialogInput.hide()
|
||||
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
false
|
||||
}else{
|
||||
//BARCODE ROW
|
||||
prepareBarcodeDialog(item)
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
itemcard_recyclerview.adapter = adapter
|
||||
|
@ -196,11 +210,13 @@ class ItemCardFragment : BaseFragment<FragmentItemCardBinding,ItemCardViewModel>
|
|||
"itemStockUpdate" -> viewModel.itemStockUpdate(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = value,isTrash = "0")
|
||||
"itemPlacementSave" -> viewModel.itemPlacementSave(itemFk = itemFk, warehouseFk = warehouseFk, user = user, password = password, value = value)
|
||||
"updateGrouping" -> viewModel.updateGrouping(itemFk = itemFk, user = user, password = password, value = value,warehouseFk = warehouseFk)
|
||||
"updatePacking" -> viewModel.updatePacking(itemFk = itemFk, user = user, password = password, value = value,warehouseFk = warehouseFk)
|
||||
"itemSaveMin" -> viewModel.itemSaveMin(itemFk = itemFk, user = user, password = password, value = value)
|
||||
}
|
||||
changeOfflineValue(item,value)
|
||||
changeOfflineValue(item,value, listBarcodes)
|
||||
}
|
||||
|
||||
private fun changeOfflineValue(item:ItemCardRowVO,newValue:String){
|
||||
private fun changeOfflineValue(item:ItemCardRowVO,newValue:String, barcodes:List<BarcodeVO>){
|
||||
var i = 0
|
||||
var position = 0
|
||||
listItemsRow.forEach {
|
||||
|
@ -209,9 +225,65 @@ class ItemCardFragment : BaseFragment<FragmentItemCardBinding,ItemCardViewModel>
|
|||
}
|
||||
i = i.plus(1)
|
||||
}
|
||||
listItemsRow.get(position).value = newValue
|
||||
if (listItemsRow.get(position).title != "BARCODE") listItemsRow.get(position).value = newValue
|
||||
else listItemsRow.get(position).barcodes = barcodes
|
||||
adapter?.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
private fun prepareBarcodeDialog(itemB:ItemCardRowVO){
|
||||
|
||||
customDialogList.setTitle("Barcodes").setOkButton("Guardar"){
|
||||
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
|
||||
if (!customDialogList.getValue().isNullOrEmpty())
|
||||
updateBarcode(customDialogList.getValue(),"0",itemB)
|
||||
customDialogList.hide()
|
||||
|
||||
}.setKoButton("Cerrar"){
|
||||
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
|
||||
customDialogList.hide()
|
||||
}.setValue("").show()
|
||||
|
||||
|
||||
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
|
||||
customDialogList.getEditText().setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
if (!customDialogList.getValue().isNullOrEmpty())
|
||||
updateBarcode(customDialogList.getValue(),"0",itemB)
|
||||
customDialogList.setValue("")
|
||||
customDialogList.hide()
|
||||
(activity as MainActivity).hideKeyboard(customDialogList.getEditText())
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
barcodeAdapter = BarcodeAdapter(listBarcodes,object: OnBarcodeRowClickListener{
|
||||
override fun onBarcodeRowClickListener(item: BarcodeVO) {
|
||||
updateBarcode(item.code!!,"1",itemB)
|
||||
}
|
||||
})
|
||||
customDialogList.getRecyclerView().adapter = barcodeAdapter
|
||||
|
||||
customDialogList.getRecyclerView().layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
}
|
||||
|
||||
|
||||
private fun updateBarcode(code:String,delete:String,item:ItemCardRowVO){
|
||||
if (delete == "1"){
|
||||
var i = 0
|
||||
var posDelete = 0
|
||||
listBarcodes.forEach {
|
||||
if (it.code == code)
|
||||
posDelete = i
|
||||
i+=1
|
||||
}
|
||||
listBarcodes.removeAt(posDelete)
|
||||
}else{
|
||||
listBarcodes.add(BarcodeVO(code))
|
||||
}
|
||||
viewModel.barcodesEdit(itemFk = itemFk, user = user, password = password, value = code, delete = delete)
|
||||
barcodeAdapter!!.notifyDataSetChanged()
|
||||
changeOfflineValue(item,"", listBarcodes)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ class ItemCardViewModel : BaseViewModel() {
|
|||
fun getItemCard(itemFk:String,warehouseFk:String,user:String,password:String) {
|
||||
getItemCardUserCase.getItemCard(user,password,itemFk,warehouseFk).enqueue(object :Callback<ItemCardVO>{
|
||||
override fun onFailure(call: Call<ItemCardVO>, t: Throwable) {
|
||||
_itemcard.value = ItemCardVO(isError = true,errorMessage = t.message!!)
|
||||
_itemcard.value = ItemCardVO(isError = true,errorMessage = "Error al OBTENER "+itemFk+ " Respuesta:"+t.message!!)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<ItemCardVO>, response: Response<ItemCardVO>) {
|
||||
|
@ -44,7 +44,7 @@ class ItemCardViewModel : BaseViewModel() {
|
|||
fun itemStockUpdate(itemFk:String,warehouseFk:String,user:String,password:String,newValue:String,isTrash:String){
|
||||
getItemCardUserCase.itemStockUpdate(user,password,itemFk,warehouseFk,newValue,isTrash).enqueue(object : Callback<String>{
|
||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = t.message!!)
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al guardar STOCK "+itemFk+ " Respuesta:"+t.message!!)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<String>, response: Response<String>) {
|
||||
|
@ -62,12 +62,12 @@ class ItemCardViewModel : BaseViewModel() {
|
|||
fun itemPlacementSave(itemFk:String,warehouseFk:String,user:String,password:String,value:String){
|
||||
getItemCardUserCase.itemPlacementSave(user,password,itemFk,warehouseFk,value).enqueue(object : Callback<String>{
|
||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = t.message!!)
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage ="Error al guardar NICHO "+itemFk+ " Respuesta:"+t.message!!)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<String>, response: Response<String>) {
|
||||
if (response.body() == null){
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemStockUpdate")
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemPlacementSave")
|
||||
}else{
|
||||
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
|
||||
}
|
||||
|
@ -80,12 +80,66 @@ class ItemCardViewModel : BaseViewModel() {
|
|||
fun updateGrouping(itemFk:String,user:String,password:String,value:String,warehouseFk: String){
|
||||
getItemCardUserCase.updateGrouping(user,password,itemFk,value,warehouseFk).enqueue(object : Callback<String>{
|
||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = t.message!!)
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al guardar GROUPING "+itemFk+ " Respuesta:"+t.message!!)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<String>, response: Response<String>) {
|
||||
if (response.body() == null){
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemStockUpdate")
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada updateGrouping")
|
||||
}else{
|
||||
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun updatePacking(itemFk:String,user:String,password:String,value:String,warehouseFk: String){
|
||||
getItemCardUserCase.updatePacking(user,password,itemFk,value,warehouseFk).enqueue(object : Callback<String>{
|
||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al guardar PACKING "+itemFk+ " Respuesta:"+t.message!!)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<String>, response: Response<String>) {
|
||||
if (response.body() == null){
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada updatePacking")
|
||||
}else{
|
||||
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun itemSaveMin(itemFk:String,user:String,password:String,value:String){
|
||||
getItemCardUserCase.itemSaveMin(user,password,itemFk,value).enqueue(object : Callback<String>{
|
||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al guardar MIN "+itemFk+ " Respuesta:"+t.message!!)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<String>, response: Response<String>) {
|
||||
if (response.body() == null){
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada updatePacking")
|
||||
}else{
|
||||
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun barcodesEdit(itemFk:String,user:String,password:String,value:String,delete:String){
|
||||
getItemCardUserCase.barcodes_edit(user,password,itemFk,value,delete).enqueue(object : Callback<String>{
|
||||
override fun onFailure(call: Call<String>, t: Throwable) {
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = "Error al guardar BARCODES "+itemFk+ " Respuesta:"+t.message!!)
|
||||
}
|
||||
|
||||
override fun onResponse(call: Call<String>, response: Response<String>) {
|
||||
if (response.body() == null){
|
||||
_response.value = ResponseItemVO(isError = true,errorMessage = "Error en la llamada itemBarcode_update")
|
||||
}else{
|
||||
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
|
||||
}
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
package es.verdnatura.presentation.view.feature.imageview.activity
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.drawable.Drawable
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.request.target.CustomTarget
|
||||
import com.bumptech.glide.request.transition.Transition
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.ActivityImageviewBinding
|
||||
import es.verdnatura.presentation.base.BaseActivity
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FFFFFF" android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2V7H6v12zM19,4h-3.5l-1,-1h-5l-1,1H5v2h14V4z"/>
|
||||
</vector>
|
|
@ -60,6 +60,7 @@
|
|||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/custom_dialog_button_ok"
|
||||
style="@style/DefaultButton.NormalButton"
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
style="@style/DialogTheme"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="@dimen/layout_margin_1"
|
||||
app:cardBackgroundColor="@color/verdnatura_black_8"
|
||||
app:cardCornerRadius="@dimen/dialog_radius">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/default_layout_margin"
|
||||
android:descendantFocusability="beforeDescendants"
|
||||
android:focusableInTouchMode="true">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/custom_dialog_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/layout_margin_1"
|
||||
android:layout_marginBottom="@dimen/layout_margin_min"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="@dimen/h6"
|
||||
android:textStyle="bold"
|
||||
android:visibility="gone"
|
||||
tools:text="¿Estás seguro de que deseas eliminar el dispositivo de celia?"
|
||||
tools:visibility="visible" />
|
||||
|
||||
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/textinputlayout_username"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColorHint="@android:color/darker_gray"
|
||||
android:layout_marginTop="@dimen/layout_margin_min">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/custom_dialog_value"
|
||||
style="@style/InputLineTextSearch"
|
||||
android:layout_width="match_parent"
|
||||
android:backgroundTint="@android:color/white"
|
||||
android:hint="Nuevo valor"
|
||||
android:inputType="text"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textColorHint="@android:color/darker_gray" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/item_recyclerview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:clipToPadding="false"
|
||||
tools:listitem="@layout/item_barcode_row"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/custom_dialog_button_ok"
|
||||
style="@style/DefaultButton.NormalButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginTop="@dimen/default_layout_margin"
|
||||
android:visibility="gone"
|
||||
tools:text="Eliminar"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/custom_dialog_button_ko"
|
||||
style="@style/DefaultButton.TransparentButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginTop="@dimen/default_layout_margin"
|
||||
android:layout_marginBottom="@dimen/default_layout_margin"
|
||||
android:visibility="gone"
|
||||
tools:text="Cancelar"
|
||||
tools:visibility="visible" />
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tool="http://schemas.android.com/tools">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="item"
|
||||
type="es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO" />
|
||||
</data>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:id="@+id/item_row_layout"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/verdnatura_black_5"
|
||||
android:padding="@dimen/pasilleros_margin_main_menu">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@{item.code}"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="@dimen/h7"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/pasilleros_margin_main_menu"
|
||||
android:textStyle="bold"/>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:layout_marginLeft="@dimen/default_layout_margin"
|
||||
android:id="@+id/item_image"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="27dp"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/ic_delete_black_24dp" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="@color/verdnatura_black_9"/>
|
||||
</LinearLayout>
|
||||
</layout>
|
|
@ -28,7 +28,7 @@
|
|||
android:layout_weight="1"
|
||||
android:text="@{item.title}"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="@dimen/h7"
|
||||
android:textSize="@dimen/h8"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/pasilleros_margin_main_menu"
|
||||
android:textStyle="bold"/>
|
||||
|
@ -39,7 +39,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:text="@{item.value}"
|
||||
android:textColor="@color/verdnatura_pumpkin_orange"
|
||||
android:textSize="@dimen/h7"
|
||||
android:textSize="@dimen/h8"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/pasilleros_margin_main_menu"/>
|
||||
|
||||
|
|
Loading…
Reference in New Issue