item shelvig radar

This commit is contained in:
Enrique Blasco 2020-05-12 08:20:17 +02:00
parent 0e8c1a84ee
commit 57b04a9309
22 changed files with 937 additions and 6 deletions

View File

@ -3,6 +3,7 @@ package es.verdnatura.di
import es.verdnatura.presentation.view.feature.ajustes.fragment.AjustesViewModel
import es.verdnatura.presentation.view.feature.articulo.fragment.ItemCardViewModel
import es.verdnatura.presentation.view.feature.buscaritem.fragment.BuscarItemViewModel
import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryViewModel
import es.verdnatura.presentation.view.feature.login.fragment.LoginViewModel
import es.verdnatura.presentation.view.feature.pasillero.fragment.PasilleroViewModel
import org.koin.androidx.viewmodel.dsl.viewModel
@ -29,6 +30,11 @@ val viewModelModule = module{
BuscarItemViewModel()
}
// Pasilleros / Inventario
viewModel {
InventaryViewModel()
}
// Ajustes
viewModel {
AjustesViewModel()

View File

@ -1,16 +1,33 @@
package es.verdnatura.domain
import okhttp3.OkHttpClient
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import java.util.concurrent.TimeUnit
class ApiUtils {
companion object {
const val BASE_URL:String = "http://192.168.1.108:8000/"
//const val BASE_URL:String = "https://app.verdnatura.es/"
fun getApiService():VerdnaturaService{
val retrofit = Retrofit.Builder().baseUrl(BASE_URL).addConverterFactory(
GsonConverterFactory.create()).build()
val retrofit = Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.client(getRequestHeader())
.build()
return retrofit.create(VerdnaturaService::class.java)
}
fun getRequestHeader(): OkHttpClient? {
val client = OkHttpClient.Builder()
.connectTimeout(10, TimeUnit.SECONDS)
.writeTimeout(10, TimeUnit.SECONDS)
.readTimeout(30, TimeUnit.SECONDS)
.build()
return client
}
}
}

View File

@ -0,0 +1,14 @@
package es.verdnatura.domain
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
import retrofit2.Call
class GetInventaryUserCase : RestClient() {
fun itemShelvingRadar(usuario:String,password:String,sectorFk:String) : Call<List<ItemInventaryVO>> {
val params:ArrayList<String> = ArrayList();
params.add(sectorFk)
return restClient!!.itemShelvingRadar("json","1",usuario,password,"application/json",params = params)!!
}
}

View File

@ -4,6 +4,7 @@ package es.verdnatura.domain
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
import retrofit2.Call
import retrofit2.http.Body
import retrofit2.http.Header
@ -118,4 +119,15 @@ interface VerdnaturaService {
@Body params: List<String>):
Call<List<ItemLocationVO>>
//INVENTARIO ========================================================================>
@POST("almacenv2/itemShelvingRadar")
fun itemShelvingRadar(@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<List<ItemInventaryVO>>
}

View File

@ -1,11 +1,17 @@
package es.verdnatura.presentation.common
import android.graphics.drawable.Drawable
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.buscaritem.model.ItemLocationVO
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
interface OnOptionsSelectedListener {
fun onOptionsItemSelected(item: Drawable)
}
interface OnPasillerosItemClickListener {
fun onPasillerosItemClickListener(item: PasillerosItemVO)
}
@ -25,4 +31,8 @@ interface OnBarcodeRowClickListener {
interface OnLocationRowClickListener {
fun onLocationRowClickListener(item: ItemLocationVO)
}
interface OnInvetoryNichoClickListener {
fun onInvetoryNichoClickListener(item: ItemInventaryVO)
}

View File

@ -0,0 +1,49 @@
package es.verdnatura.presentation.view.component
import android.app.Dialog
import android.content.Context
import android.view.View
import es.verdnatura.R
import kotlinx.android.synthetic.main.component_custom_two_dialog.*
class CustomDialogTwoButtons (context: Context) : Dialog(context, R.style.DialogTheme) {
init {
setContentView(R.layout.component_custom_two_dialog)
}
fun setTitle(title: String): CustomDialogTwoButtons {
custom_dialog_title.visibility = View.VISIBLE
custom_dialog_title.text = title
return this
}
fun setDescription(description: String): CustomDialogTwoButtons {
custom_dialog_description.visibility = View.VISIBLE
custom_dialog_description.text = description
return this
}
fun setOkButton(text: String, onButtonClicked: () -> Unit): CustomDialogTwoButtons {
custom_dialog_button_ok.visibility = View.VISIBLE
custom_dialog_button_ok.text = text
custom_dialog_button_ok.setOnClickListener { onButtonClicked() }
return this
}
fun setOkButtonTwo(text: String, onButtonClicked: () -> Unit): CustomDialogTwoButtons {
custom_dialog_button_ok_two.visibility = View.VISIBLE
custom_dialog_button_ok_two.text = text
custom_dialog_button_ok_two.setOnClickListener { onButtonClicked() }
return this
}
fun setKoButton(text: String, onButtonClicked: () -> Unit): CustomDialogTwoButtons {
custom_dialog_button_ko.visibility = View.VISIBLE
custom_dialog_button_ko.text = text
custom_dialog_button_ko.setOnClickListener { onButtonClicked() }
return this
}
}

View File

@ -17,6 +17,7 @@ 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.component.CustomDialogTwoButtons
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
@ -47,6 +48,7 @@ class ItemCardFragment : BaseFragment<FragmentItemCardBinding,ItemCardViewModel>
private lateinit var customDialog: CustomDialog
private lateinit var customDialogInput: CustomDialogInput
private lateinit var customDialogList: CustomDialogList
private lateinit var customDialogTwo: CustomDialogTwoButtons
override fun getLayoutId(): Int = R.layout.fragment_item_card
@ -58,6 +60,7 @@ class ItemCardFragment : BaseFragment<FragmentItemCardBinding,ItemCardViewModel>
customDialog = CustomDialog(requireContext())
customDialogInput = CustomDialogInput(requireContext())
customDialogList = CustomDialogList(requireContext())
customDialogTwo = CustomDialogTwoButtons(requireContext())
super.init()
}
@ -185,7 +188,7 @@ class ItemCardFragment : BaseFragment<FragmentItemCardBinding,ItemCardViewModel>
}
false
}
}else{
}else if(item.action == "toBarcode"){
//BARCODE ROW
prepareBarcodeDialog(item)
}
@ -207,13 +210,14 @@ class ItemCardFragment : BaseFragment<FragmentItemCardBinding,ItemCardViewModel>
private fun editItemCardRow(item:ItemCardRowVO,value:String){
when (item.action){
"itemStockUpdate" -> viewModel.itemStockUpdate(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = value,isTrash = "0")
"itemStockUpdate" -> prepareItemStockUpdate(item,value)
"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, listBarcodes)
if(item.action != "itemStockUpdate")
changeOfflineValue(item,value, listBarcodes)
}
private fun changeOfflineValue(item:ItemCardRowVO,newValue:String, barcodes:List<BarcodeVO>){
@ -230,6 +234,30 @@ class ItemCardFragment : BaseFragment<FragmentItemCardBinding,ItemCardViewModel>
adapter?.notifyDataSetChanged()
}
private fun prepareItemStockUpdate(itemB:ItemCardRowVO,value:String){
if (itemB.value!!.toInt() > value.toInt()) {
customDialogTwo.setTitle(itemB.title!!).setDescription("Indica la causa de eliminar stock:").setOkButton("Falta"){
viewModel.itemStockUpdate(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = value,isTrash = "0")
changeOfflineValue(itemB,value, listBarcodes)
customDialogTwo.hide()
}.setOkButtonTwo("Basura"){
viewModel.itemStockUpdate(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = value,isTrash = "1")
changeOfflineValue(itemB,value, listBarcodes)
customDialogTwo.hide()
}.setKoButton("Cancelar"){
customDialogTwo.hide()
}.show()
}else{
changeOfflineValue(itemB,value, listBarcodes)
viewModel.itemStockUpdate(itemFk = itemFk,warehouseFk = warehouseFk,user = user,password = password,newValue = value,isTrash = "0")
}
}
private fun prepareBarcodeDialog(itemB:ItemCardRowVO){
customDialogList.setTitle("Barcodes").setOkButton("Guardar"){

View File

@ -0,0 +1,48 @@
package es.verdnatura.presentation.view.feature.inventario.adapter
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.databinding.ItemInventaryRowBinding
import es.verdnatura.presentation.common.OnInvetoryNichoClickListener
import es.verdnatura.presentation.common.OnItemCardRowClickListener
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
class InventoryAdapter (
private val items: List<ItemInventaryVO>,
private val onInvetoryNichoClickListener: OnInvetoryNichoClickListener
): RecyclerView.Adapter<InventoryAdapter.ItemHolder> () {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
return ItemHolder(
ItemInventaryRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
)
}
override fun getItemCount() =items.size
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
holder.bind(items[position])
}
inner class ItemHolder(
val binding: ItemInventaryRowBinding
) : RecyclerView.ViewHolder(binding.root){
private val res = binding.root.context.resources
fun bind(item: ItemInventaryVO) {
binding.apply {
this.item = item
if(item.producer.isNullOrEmpty()){
itemProducer.visibility = View.GONE
}else{
itemProducer.visibility = View.VISIBLE
}
itemNicho.setOnClickListener {
onInvetoryNichoClickListener.onInvetoryNichoClickListener(item)
}
}
}
}
}

View File

@ -0,0 +1,45 @@
package es.verdnatura.presentation.view.feature.inventario.adapter
import android.graphics.drawable.Drawable
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import es.verdnatura.databinding.ItemInventaryRowBinding
import es.verdnatura.databinding.ItemToolbarRowBinding
import es.verdnatura.presentation.common.OnInvetoryNichoClickListener
import es.verdnatura.presentation.common.OnOptionsSelectedListener
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
class ToolBarAdapter (
private val items: List<Drawable>,
private val onOptionsSelectedListener: OnOptionsSelectedListener
): RecyclerView.Adapter<ToolBarAdapter.ItemHolder> () {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
return ItemHolder(
ItemToolbarRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
)
}
override fun getItemCount() =items.size
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
holder.bind(items[position])
}
inner class ItemHolder(
val binding: ItemToolbarRowBinding
) : RecyclerView.ViewHolder(binding.root){
private val res = binding.root.context.resources
fun bind(item: Drawable) {
binding.apply {
imagebuttonIcon.setImageDrawable(item)
imagebuttonIcon.setOnClickListener {
onOptionsSelectedListener.onOptionsItemSelected(item)
}
}
}
}
}

View File

@ -0,0 +1,196 @@
package es.verdnatura.presentation.view.feature.inventario.fragment
import android.content.SharedPreferences
import android.graphics.drawable.Drawable
import android.os.Bundle
import android.util.Log
import android.view.View
import android.view.inputmethod.EditorInfo
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
import es.verdnatura.databinding.FragmentInventaryBinding
import es.verdnatura.domain.notNull
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnInvetoryNichoClickListener
import es.verdnatura.presentation.common.OnLocationRowClickListener
import es.verdnatura.presentation.common.OnOptionsSelectedListener
import es.verdnatura.presentation.common.TAG
import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.component.CustomDialogInput
import es.verdnatura.presentation.view.feature.buscaritem.adapter.LocationAdapter
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO
import es.verdnatura.presentation.view.feature.inventario.adapter.InventoryAdapter
import es.verdnatura.presentation.view.feature.inventario.adapter.ToolBarAdapter
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.fragment_buscar_item.*
import kotlinx.android.synthetic.main.fragment_buscar_item.location_recyclerview
import kotlinx.android.synthetic.main.fragment_buscar_item.splash_progress
import kotlinx.android.synthetic.main.fragment_inventary.*
import kotlinx.android.synthetic.main.toolbar.*
class InventaryFragment : BaseFragment<FragmentInventaryBinding,InventaryViewModel>(InventaryViewModel::class) {
private var user = ""
private var password = ""
private var sectorFk = ""
private var warehouseFk = ""
private var adapter : InventoryAdapter? = null
private lateinit var customDialogInput: CustomDialogInput
private var listInvetory:ArrayList<ItemInventaryVO> = ArrayList()
private var listInvetoryAux:ArrayList<ItemInventaryVO> = ArrayList()
private lateinit var customDialog: CustomDialog
companion object {
fun newInstance() = InventaryFragment()
}
override fun getLayoutId(): Int = R.layout.fragment_inventary
override fun init() {
activity!!.main_bottom_navigation.visibility = View.GONE
toolbar_title.text = "itemShelvingRadar"
setToolBar()
val prefs: SharedPreferences = activity!!.getSharedPreferences(PREFS_USER,0)
user = prefs.getString(USER,"").toString()
password = prefs.getString(PASSWORD,"").toString()
sectorFk = prefs.getInt(SECTORFK,1).toString()
warehouseFk = prefs.getInt(WAREHOUSEFK,1).toString()
viewModel.getInventory(user,password,sectorFk)
customDialogInput = CustomDialogInput(requireContext())
customDialog = CustomDialog(requireContext())
setEvents()
super.init()
}
private fun setToolBar(){
val listIcons:ArrayList<Drawable> = ArrayList()
val iconReload : Drawable = resources.getDrawable(R.drawable.ic_autorenew_black_24dp,resources.newTheme())
listIcons.add(iconReload)
toolbar_icons.adapter = ToolBarAdapter(listIcons,object: OnOptionsSelectedListener{
override fun onOptionsItemSelected(item: Drawable) {
if (item == iconReload){
splash_progress.visibility = View.VISIBLE
viewModel.getInventory(user,password,sectorFk)
}
}
})
toolbar_icons.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
}
private fun setEvents(){
backButton.setOnClickListener {
activity!!.onBackPressed()
}
filter_itemFk.setOnKeyListener { v, keyCode, event ->
if (filter_itemFk.text.toString().isNullOrEmpty()){
if (listInvetory.size != listInvetoryAux.size){
listInvetory.removeAll(listInvetoryAux)
listInvetoryAux.forEach {
listInvetory.add(it)
}
}
}else{
listInvetory.removeAll(listInvetoryAux)
listInvetoryAux.forEach {
if (it.itemFk.contains(filter_itemFk.text.toString(),true)){
listInvetory.add(it)
}
}
}
adapter!!.notifyDataSetChanged()
return@setOnKeyListener false
}
}
override fun observeViewModel() {
with(viewModel){
loadInventaryList.observe(viewLifecycleOwner, Observer { event ->
splash_progress.visibility = View.GONE
event.getContentIfNotHandled().notNull {
listInvetory = ArrayList()
listInvetoryAux = ArrayList()
it.list.forEach {
if (it.nicho != "0"){
listInvetory.add(it)
listInvetoryAux.add(it)
}
}
adapter = InventoryAdapter(listInvetory,object: OnInvetoryNichoClickListener{
override fun onInvetoryNichoClickListener(item: ItemInventaryVO) {
customDialogInput.setTitle(item.itemFk+"\n"+item.longName+" "+item.size).setDescription("Cantidad real("+item.nicho+")").setOkButton("Tirar"){
viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,customDialogInput.getValue(),"0")
changeOfflineValue(item)
customDialogInput.hide()
}.setKoButton("Cancelar"){
customDialogInput.hide()
}.setValue("0").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()){
viewModel.itemStockUpdate(item.itemFk,warehouseFk,user,password,customDialogInput.getValue(),"0")
changeOfflineValue(item)
}
customDialogInput.setValue("")
customDialogInput.hide()
(activity as MainActivity).hideKeyboard(customDialogInput.getEditText())
return@setOnEditorActionListener true
}
false
}
}
})
location_recyclerview.adapter = adapter
location_recyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
}
})
response.observe(viewLifecycleOwner, Observer {
if (it.isError){
customDialog.setTitle("Error").setDescription(it.errorMessage).setOkButton("Cerrar"){
customDialog.hide()
}.show()
}
})
}
}
private fun changeOfflineValue(item:ItemInventaryVO){
var i = 0
var position = 0
listInvetory.forEach {
if (it.itemFk == item.itemFk) {
position = i
}
i = i.plus(1)
}
listInvetory.removeAt(position)
i = 0
position = 0
listInvetoryAux.forEach {
if (it.itemFk == item.itemFk) {
position = i
}
i = i.plus(1)
}
listInvetoryAux.removeAt(position)
adapter?.notifyDataSetChanged()
}
}

View File

@ -0,0 +1,82 @@
package es.verdnatura.presentation.view.feature.inventario.fragment
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.Transformations
import es.verdnatura.domain.GetBuscarItemUserCase
import es.verdnatura.domain.GetInventaryUserCase
import es.verdnatura.domain.GetItemCardUserCase
import es.verdnatura.presentation.base.BaseViewModel
import es.verdnatura.presentation.common.Event
import es.verdnatura.presentation.common.ResponseItemVO
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO
import es.verdnatura.presentation.view.feature.buscaritem.model.LocationListVO
import es.verdnatura.presentation.view.feature.inventario.model.InventaryListVO
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
class InventaryViewModel : BaseViewModel() {
private val getInventaryUserCase: GetInventaryUserCase = GetInventaryUserCase()
private val getItemCardUserCase: GetItemCardUserCase = GetItemCardUserCase()
private val _inventaryList by lazy { MutableLiveData<InventaryListVO>() }
val inventaryList: LiveData<InventaryListVO>
get() = _inventaryList
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
val response: LiveData<ResponseItemVO>
get() = _response
val loadInventaryList = Transformations.map(_inventaryList) { Event(it) }
fun getInventory(user:String,password:String,sectorFk:String){
getInventaryUserCase.itemShelvingRadar(user,password,sectorFk).enqueue(object :
Callback<List<ItemInventaryVO>> {
override fun onFailure(call: Call<List<ItemInventaryVO>>, t: Throwable) {
val listError:ArrayList<ItemInventaryVO> = ArrayList()
listError.add(ItemInventaryVO(isError = true,errorMessage = t.message!!))
_inventaryList.value = InventaryListVO(listError)
}
override fun onResponse(
call: Call<List<ItemInventaryVO>>,
response: Response<List<ItemInventaryVO>>
) {
if (response.body() != null){
_inventaryList.value = response.body()?.let { InventaryListVO(it) }
}else{
val listError:ArrayList<ItemInventaryVO> = ArrayList()
listError.add(ItemInventaryVO(isError = true,errorMessage = "Error en la llamada de itemShelvingRadar"))
_inventaryList.value = InventaryListVO(listError)
}
}
})
}
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 = "Error al guardar STOCK "+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")
}else{
_response.value = ResponseItemVO(isError = false,response = response.body()!!)
}
}
})
}
}

View File

@ -0,0 +1,18 @@
package es.verdnatura.presentation.view.feature.inventario.model
class ItemInventaryVO (
var itemFk:String = "",
var longName:String= "",
var size:String= "",
var producer:String= "",
var downstairs:String= "",
var upstairs:String= "",
var nicho:String= "",
var isError:Boolean = false,
var errorMessage:String = ""
)
class InventaryListVO (
var list: List<ItemInventaryVO> = listOf()
)

View File

@ -17,6 +17,7 @@ import es.verdnatura.presentation.view.component.CustomDialog
import es.verdnatura.presentation.view.feature.ajustes.fragment.AjustesFragment
import es.verdnatura.presentation.view.feature.articulo.fragment.ItemCardFragment
import es.verdnatura.presentation.view.feature.buscaritem.fragment.BuscarItemFragment
import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryFragment
import es.verdnatura.presentation.view.feature.main.model.ItemMenuVO
import es.verdnatura.presentation.view.feature.pasillero.fragment.PasilleroFragment
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
@ -143,6 +144,9 @@ class MainActivity : BaseActivity<ActivityMainBinding>() , OnPasillerosItemClick
"Buscar item" -> {
addFragmentOnTop(BuscarItemFragment.newInstance())
}
"Inventario" -> {
addFragmentOnTop(InventaryFragment.newInstance())
}
}
Log.i("Item: ",item.title)
}

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/verdnatura_dark_sky_blue" />
<corners
android:bottomLeftRadius="@dimen/btn_radius"
android:bottomRightRadius="@dimen/btn_radius"
android:topLeftRadius="@dimen/btn_radius"
android:topRightRadius="@dimen/btn_radius" />
</shape>

View File

@ -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="M12,6v3l4,-4 -4,-4v3c-4.42,0 -8,3.58 -8,8 0,1.57 0.46,3.03 1.24,4.26L6.7,14.8c-0.45,-0.83 -0.7,-1.79 -0.7,-2.8 0,-3.31 2.69,-6 6,-6zM18.76,7.74L17.3,9.2c0.44,0.84 0.7,1.79 0.7,2.8 0,3.31 -2.69,6 -6,6v-3l-4,4 4,4v-3c4.42,0 8,-3.58 8,-8 0,-1.57 -0.46,-3.03 -1.24,-4.26z"/>
</vector>

View File

@ -0,0 +1,70 @@
<?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="wrap_content"
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">
<TextView
android:id="@+id/custom_dialog_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/layout_margin_3"
android:layout_marginBottom="@dimen/default_layout_margin"
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" />
<TextView
android:id="@+id/custom_dialog_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body1"
android:visibility="gone"
tools:text="Este cambio no podrá deshacerse a no ser que vuelvas a vincular el dispositivo"
tools:visibility="visible" />
<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="Falta"
tools:visibility="visible" />
<Button
android:id="@+id/custom_dialog_button_ok_two"
style="@style/DefaultButton.NormalButtonTwo"
android:layout_width="match_parent"
android:layout_marginTop="@dimen/default_layout_margin"
android:visibility="gone"
tools:text="Basura"
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>

View File

@ -0,0 +1,129 @@
<?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">
<data>
<variable
name="viewModel"
type="es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:paddingTop="@dimen/toolbar_height">
<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">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/filter_itemFk"
style="@style/InputLineTextSearch"
android:layout_width="match_parent"
android:backgroundTint="@android:color/white"
android:hint="Filtro"
android:inputType="number"
android:lines="1"
android:maxLines="1"
android:textColor="@color/verdnatura_white"
android:textColorHint="@android:color/darker_gray" />
</com.google.android.material.textfield.TextInputLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="@dimen/layout_margin_min"
android:layout_marginBottom="@dimen/layout_margin_1"
android:paddingLeft="@dimen/layout_margin_min"
android:paddingRight="@dimen/layout_margin_min">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Downstairs"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="center"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Upstairs"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="center"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Nicho"
android:textSize="@dimen/body2"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="center"/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/location_recyclerview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
tools:listitem="@layout/item_inventary_row"/>
</LinearLayout>
<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:visibility="visible"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/verdnatura_black_8_alpha_6"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:gravity="center">
<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>

View File

@ -0,0 +1,162 @@
<?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.inventario.model.ItemInventaryVO" />
</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:paddingLeft="@dimen/pasilleros_margin_main_menu"
android:paddingRight="@dimen/pasilleros_margin_main_menu"
android:paddingTop="@dimen/pasilleros_margin_main_menu">
<TextView
android:id="@+id/item_fk"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{item.itemFk}"
android:textSize="@dimen/h7"
android:textStyle="bold"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="left"
tool:text="31100"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/verdnatura_black_5"
android:paddingLeft="@dimen/pasilleros_margin_main_menu"
android:paddingRight="@dimen/pasilleros_margin_main_menu">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{item.longName}"
android:textSize="@dimen/body2"
android:textStyle="bold"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="left"
tool:text="Alstromeria Blanca"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/verdnatura_black_5"
android:paddingLeft="@dimen/pasilleros_margin_main_menu"
android:paddingRight="@dimen/pasilleros_margin_main_menu">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{item.size}"
android:textSize="@dimen/body2"
android:textStyle="bold"
android:textColor="@color/verdnatura_white"
android:layout_weight="2"
android:gravity="left"
tool:text="80" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/verdnatura_black_5"
android:paddingLeft="@dimen/pasilleros_margin_main_menu"
android:paddingRight="@dimen/pasilleros_margin_main_menu"
android:paddingBottom="@dimen/pasilleros_margin_main_menu">
<TextView
android:id="@+id/item_producer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{item.producer}"
android:textSize="@dimen/body2"
android:textStyle="bold"
android:textColor="@color/verdnatura_white"
android:layout_weight="1"
android:gravity="left"
tool:text="Benchmark"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/verdnatura_black_5"
android:paddingLeft="@dimen/pasilleros_margin_main_menu"
android:paddingRight="@dimen/pasilleros_margin_main_menu"
android:paddingBottom="@dimen/pasilleros_margin_main_menu">
<TextView
android:id="@+id/item_down"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{item.downstairs}"
android:textSize="@dimen/h6"
android:textStyle="bold"
android:textColor="@color/verdnatura_pumpkin_orange"
android:layout_weight="1"
android:gravity="center"
tool:text="730"/>
<TextView
android:id="@+id/item_up"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{item.upstairs}"
android:textSize="@dimen/h6"
android:textStyle="bold"
android:textColor="@color/verdnatura_pumpkin_orange"
android:layout_weight="1"
android:gravity="center"
tool:text="0" />
<TextView
android:id="@+id/item_nicho"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{item.nicho}"
android:textSize="@dimen/h6"
android:textStyle="bold"
android:textColor="@color/verdnatura_red"
android:layout_weight="1"
android:gravity="center"
tool:text="-50" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/verdnatura_black_9"/>
</LinearLayout>
</layout>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<layout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tool="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
tool:background="@color/verdnatura_black"
>
<ImageButton
style="@style/ImageButton"
android:id="@+id/imagebutton_icon"/>
</LinearLayout>
</layout>

View File

@ -46,7 +46,8 @@
android:id="@+id/toolbar_icons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/layout_margin_1" />
android:layout_marginEnd="@dimen/layout_margin_1"
tool:listitem="@layout/item_toolbar_row"/>
</LinearLayout>

View File

@ -14,6 +14,7 @@
<color name="verdnatura_black_9">#464446</color>
<color name="verdnatura_warm_grey">#707070</color>
<color name="verdnatura_brown_grey">#8f8f8f</color>
<color name="verdnatura_red">#e74c3c</color>
<color name="verdnatura_warm_brown">#8b4200</color>
<color name="verdnatura_pumpkin_orange">#f7931e</color>
<color name="verdnatura_sunflower_yellow">#ffd400</color>
@ -22,4 +23,5 @@
<color name="verdnatura_light_teal">#b8ecd6</color>
<color name="verdnatura_white">#ffffff</color>
<color name="verdnatura_black_8_alpha_6">#991A1A1A</color>
</resources>

View File

@ -34,6 +34,11 @@
<item name="android:textColor">@color/verdnatura_white</item>
</style>
<style name="DefaultButton.NormalButtonTwo" parent="DefaultButton">
<item name="android:background">@drawable/btn_blue</item>
<item name="android:textColor">@color/verdnatura_white</item>
</style>
<style name="DefaultButton.TransparentButton" parent="DefaultButton">
<item name="android:background">@drawable/btn_white_transparent</item>
<item name="android:textColor">@color/verdnatura_white</item>