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

    <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="mtbColr"
            type="it.integry.integrywmsnative.core.model.MtbColr" />
    </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">


        <LinearLayout
            android:id="@+id/linearLayout"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintEnd_toStartOf="@+id/qta_box"
            app:layout_constraintStart_toStartOf="parent">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <androidx.appcompat.widget.AppCompatTextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@{mtbColr.codMart}"
                    android:textColor="@color/colorPrimary"
                    android:textSize="14sp"
                    android:textStyle="bold"
                    style="@style/AppTheme.NewMaterial.Text.Small"
                    tools:text="COD MART" />

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

            </RelativeLayout>

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentStart="true"
                android:layout_toStartOf="@id/posizione_collo"
                android:ellipsize="end"
                android:maxLines="1"
                android:text="@{mtbColr.getDescrizione()}"
                android:textColor="@android:color/black"
                android:textSize="16sp"
                style="@style/AppTheme.NewMaterial.Text.Small"
                tools:text="Descrizione lunga articolo" />


            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@{`Lotto: ` + mtbColr.getPartitaMag()}"
                android:textSize="14sp"
                android:visibility="@{UtilityString.isNullOrEmpty(mtbColr.getPartitaMag()) ? View.INVISIBLE : View.VISIBLE}"
                style="@style/AppTheme.NewMaterial.Text.Small"
                tools:text="Lotto: ABCDE" />

        </LinearLayout>


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

            <androidx.appcompat.widget.AppCompatTextView
                android:id="@+id/qta_textview"
                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:textSize="16sp"
                android:textColor="@android:color/white"
                android:textStyle="bold"
                android:textAllCaps="true"
                style="@style/AppTheme.NewMaterial.Text.Small"
                tools:text="280.45\nCONF" />

        </RelativeLayout>

    </androidx.constraintlayout.widget.ConstraintLayout>


</layout>
