feat: refs #7920 itemShelvingGet

This commit is contained in:
Sergio De la torre 2024-12-10 07:55:33 +01:00
parent 7e738a50d8
commit 32edc951f2
4 changed files with 143 additions and 70 deletions

View File

@ -24,6 +24,7 @@ object ConstAndValues {
const val USER = "user"
const val PASSWORD = "password"
const val TOKEN = "token"
const val TOKENMULTIMEDIA = "tokenMultimedia"
const val TTL = "ttl"
const val TOKENCREATED = "tokenCreated"
const val SECTORDESCRIP = "sectordescrip"

View File

@ -3,6 +3,7 @@ package es.verdnatura.presentation.view.feature.articulo.fragment
import android.content.Intent
import android.graphics.drawable.Drawable
import android.text.InputType
import android.view.MotionEvent
import android.view.View
import android.view.View.GONE
import android.view.inputmethod.EditorInfo
@ -12,6 +13,7 @@ import com.google.gson.Gson
import es.verdnatura.R
import es.verdnatura.databinding.FragmentItemCardBinding
import es.verdnatura.domain.ConstAndValues.PRINTERFK
import es.verdnatura.domain.ConstAndValues.TOKENMULTIMEDIA
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFK
import es.verdnatura.domain.notNull
import es.verdnatura.domain.toast
@ -205,8 +207,39 @@ class ItemCardFragment(
hideKeyboard()
}
private fun setEvents() {
private fun openWebViewer(param: String) {
//variableWeb = if (itemScan is Number) "var-itemFk=$param" else "var-shelvingCode=$param"
ma.onPasillerosItemClickListener(
PasillerosItemVO(
title = R.string.titleWebViewer,
),
Gson().toJson(
mutableMapOf(
"entryPoint" to param,
"web" to "https://grafana.verdnatura.es/d/ce4b8ymvex4owa?var-itemFk=$param&var-vnToken=${
mobileApplication.dataStoreApp.readDataStoreKey<String>(
TOKENMULTIMEDIA
)
}"
)
), param = ""
)
}
private fun setEvents() {
binding.editItemFk.setOnTouchListener { v, event ->
if (event.action == MotionEvent.ACTION_UP) {
val drawableRight = binding.editItemFk.compoundDrawables[2]
if (drawableRight != null && event.x >= v.width - drawableRight.bounds.width()) {
openWebViewer(itemInfoG?.id?.toString() ?: "")
return@setOnTouchListener true
}
}
false
}
binding.editItemFk.requestFocus()
binding.editItemFk.setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
<?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">
<layout 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">
<androidx.constraintlayout.widget.ConstraintLayout
@ -20,20 +20,20 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
android:orientation="vertical">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/edit_itemFk"
style="@style/ScanLineTextSearch"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_gravity="center"
android:drawableEnd="@drawable/ic_grafana"
android:gravity="center"
android:hint="@string/Escaneaetiqueta"
android:inputType="text"
android:textColor="@color/verdnatura_white"
android:textColorHint="@color/verdnatura_white"
/>
android:textColorHint="@color/verdnatura_white" />
<LinearLayout
@ -46,34 +46,38 @@
android:id="@+id/itemcard_image"
android:layout_width="match_parent"
android:layout_height="@dimen/itemcard_image"
android:scaleType="centerCrop"
android:contentDescription="@string/selectImage"
android:scaleType="centerCrop"
android:src="@drawable/loadphoto" />
<!-- TAGS ======================================================================================================= -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="@dimen/layout_margin_min"
android:layout_marginBottom="@dimen/layout_margin_min"
android:baselineAligned="false"
android:layout_marginBottom="@dimen/layout_margin_min">
android:orientation="horizontal"
android:padding="@dimen/layout_margin_min">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1.25">
android:layout_weight="1.25"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/layout_margin_min"
android:text="@string/Tamaño"
android:textColor="@color/verdnatura_brown_grey"
android:textSize="@dimen/body2"
android:textStyle="bold"
android:layout_marginEnd="@dimen/layout_margin_min"/>
android:textStyle="bold" />
<TextView
android:id="@+id/itemcard_tag1"
android:layout_width="wrap_content"
@ -83,18 +87,21 @@
android:textSize="@dimen/body2"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/layout_margin_min"
android:text="@string/Longitud"
android:textColor="@color/verdnatura_brown_grey"
android:textSize="@dimen/body2"
android:textStyle="bold"
android:layout_marginEnd="@dimen/layout_margin_min"/>
android:textStyle="bold" />
<TextView
android:id="@+id/itemcard_tag2"
android:layout_width="wrap_content"
@ -110,20 +117,23 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1.1">
android:layout_weight="1.1"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/layout_margin_min"
android:text="@string/Color"
android:textColor="@color/verdnatura_brown_grey"
android:textSize="@dimen/body2"
android:textStyle="bold"
android:layout_marginEnd="@dimen/layout_margin_min"/>
android:textStyle="bold" />
<TextView
android:id="@+id/itemcard_tag3"
android:layout_width="wrap_content"
@ -133,18 +143,21 @@
android:textSize="@dimen/body2"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/layout_margin_min"
android:text="@string/Origen"
android:textColor="@color/verdnatura_brown_grey"
android:textSize="@dimen/body2"
android:textStyle="bold"
android:layout_marginEnd="@dimen/layout_margin_min"/>
android:textStyle="bold" />
<TextView
android:id="@+id/itemcard_tag4"
android:layout_width="wrap_content"
@ -152,60 +165,62 @@
android:text=""
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2"
android:textStyle="bold"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/buyer"
android:textColor="@color/verdnatura_brown_grey"
android:textSize="@dimen/body2"
android:textStyle="bold"
android:layout_marginEnd="@dimen/layout_margin_min"/>
<TextView
android:id="@+id/itemcard_buyer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/buyer"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/layout_margin_min"
android:text="@string/buyer"
android:textColor="@color/verdnatura_brown_grey"
android:textSize="@dimen/body2"
android:textStyle="bold" />
<TextView
android:id="@+id/itemcard_buyer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/buyer"
android:textColor="@color/verdnatura_white"
android:textSize="@dimen/body2"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<!-- VALORES ================================================================================================== -->
<RelativeLayout
</LinearLayout>
<!-- VALORES ================================================================================================== -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/itemcard_recyclerview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants">
android:clipToPadding="false"
tools:listitem="@layout/item_card_row" />
</RelativeLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/itemcard_recyclerview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
tools:listitem="@layout/item_card_row" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
<include
android:id="@+id/main_toolbar"
layout="@layout/toolbar_fragment"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
android:id="@+id/main_toolbar"
layout="@layout/toolbar_fragment"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>