<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools">

    <data>
        <import type="android.view.View" />
        <import type="it.integry.integrywmsnative.core.utility.UtilityString" />
        <import type="it.integry.integrywmsnative.core.utility.UtilityNumber" />
        <import type="it.integry.integrywmsnative.core.settings.SettingsManager" />

        <variable
            name="item"
            type="it.integry.integrywmsnative.core.data_store.db.entity.InventarioRowRoomDTO" />
    </data>

    <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="8dp"
        android:background="?attr/selectableItemBackground">


        <androidx.appcompat.widget.LinearLayoutCompat
            android:id="@+id/linearLayout"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            app:layout_constraintEnd_toStartOf="@+id/qta_box"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            android:layout_marginEnd="8dp">


            <RelativeLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <androidx.appcompat.widget.AppCompatTextView
                    android:id="@+id/cod_mart"
                    style="@style/AppTheme.NewMaterial.Text.Small"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@{item.codMart}"
                    android:textStyle="bold"
                    tools:text="COD MART" />


<!--                <androidx.appcompat.widget.AppCompatTextView-->
<!--                    style="@style/AppTheme.NewMaterial.Text.Small"-->
<!--                    android:layout_width="wrap_content"-->
<!--                    android:layout_height="wrap_content"-->
<!--                    android:layout_alignParentEnd="true"-->
<!--                    android:background="@drawable/badge_round_corner"-->
<!--                    android:backgroundTint="@color/orange_600"-->
<!--                    android:paddingStart="6dp"-->
<!--                    android:paddingEnd="6dp"-->
<!--                    android:text="@{UtilityNumber.decimalToString(item.qtaInv) + item.mtbAart.untMis}"-->
<!--                    android:textColor="@android:color/white"-->
<!--                    android:textSize="14sp"-->
<!--                    android:textStyle="bold"-->
<!--                    android:visibility="@{SettingsManager.iDB().isFlagForceAllToColli() || (mtbColr.mtbAart != null &amp;&amp; !mtbColr.mtbAart.flagQtaCnfFissaBoolean) ? View.VISIBLE : View.GONE}"-->
<!--                    tools:text="PESO KG" />-->

            </RelativeLayout>


            <androidx.appcompat.widget.AppCompatTextView
                style="@style/AppTheme.NewMaterial.Text.Medium"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:maxLines="2"
                android:text="@{item.descrizione}"
                android:visibility="@{UtilityString.isNullOrEmpty(item.descrizione) ? View.GONE : View.VISIBLE}"
                tools:text="Descrizione lunga articolo" />


            <androidx.appcompat.widget.AppCompatTextView
                style="@style/AppTheme.NewMaterial.Text.Medium"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:maxLines="2"
                android:enabled="false"
                android:text="@{`Barcode: ` + item.scanCodBarre}"
                android:visibility="@{UtilityString.isNullOrEmpty(item.descrizione) ? View.VISIBLE : View.GONE}" />


            <androidx.appcompat.widget.AppCompatTextView
                style="@style/AppTheme.NewMaterial.Text.Small"

                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@{`Lotto: ` + item.partitaMag}"
                android:enabled="false"
                android:visibility="@{UtilityString.isNullOrEmpty(item.partitaMag) ? View.GONE : View.VISIBLE}"
                tools:text="Lotto: ABCDE" />

        </androidx.appcompat.widget.LinearLayoutCompat>


        <RelativeLayout
            android:id="@+id/qta_box"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="parent">

            <androidx.appcompat.widget.AppCompatTextView
                android:id="@+id/qta_textview"
                style="@style/AppTheme.NewMaterial.Text"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/badge_round_corner"
                android:backgroundTint="@color/colorPrimary"
                android:gravity="center"
                android:paddingLeft="6dp"
                android:paddingTop="2dp"
                android:paddingRight="6dp"
                android:paddingBottom="2dp"
                android:textAllCaps="true"
                android:textColor="@android:color/white"
                android:textSize="16sp"
                android:textStyle="bold"
                android:text="@{UtilityNumber.decimalToString(item.qta) + `\n` + item.untMis}"
                tools:text="280.45\nCONF" />

        </RelativeLayout>

    </androidx.constraintlayout.widget.ConstraintLayout>


</layout>