<?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:tools="http://schemas.android.com/tools">

    <data>

        <import type="it.integry.integrywmsnative.core.utility.UtilityString" />

        <import type="it.integry.integrywmsnative.core.utility.UtilityNumber" />

        <import type="it.integry.integrywmsnative.core.settings.SettingsManager" />

        <import type="android.view.View" />

        <variable
            name="item"
            type="it.integry.integrywmsnative.core.model.MtbColr" />
    </data>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="?attr/selectableItemBackground"
        android:orientation="horizontal"
        android:padding="8dp">


        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/linearLayout"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            app:layout_constraintEnd_toStartOf="@id/qta_textview"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            android:layout_marginRight="8dp">

            <androidx.constraintlayout.widget.ConstraintLayout
                android:id="@+id/first_line"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent">

                <androidx.appcompat.widget.AppCompatTextView
                    android:id="@+id/cod_mart"
                    style="@style/AppTheme.NewMaterial.Text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@{item.codMart}"
                    android:textColor="@color/colorPrimary"
                    android:textSize="14sp"
                    android:textStyle="bold"
                    app:layout_constraintStart_toStartOf="parent"
                    app:layout_constraintTop_toTopOf="parent"
                    tools:text="COD MART" />

                <androidx.appcompat.widget.AppCompatTextView
                    android:id="@+id/diacod"
                    style="@style/AppTheme.NewMaterial.Text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="8dp"
                    android:layout_toEndOf="@id/cod_mart"
                    android:text="@{`(` + item.mtbAart.diacod + `)`}"
                    android:textColor="@color/red_600"
                    android:textSize="13sp"
                    android:textStyle="bold"
                    android:visibility="@{(item.mtbAart != null &amp;&amp; !UtilityString.isNullOrEmpty(item.mtbAart.diacod)) ? View.VISIBLE : View.GONE}"
                    app:layout_constraintStart_toEndOf="@id/cod_mart"
                    app:layout_constraintTop_toTopOf="parent"
                    tools:text="(12345)" />


                <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.qtaCol) + item.mtbAart.untMis}"
                    android:textColor="@android:color/white"
                    android:textSize="14sp"
                    android:textStyle="bold"
                    android:visibility="@{SettingsManager.iDB().isFlagForceAllToColli() || (item.mtbAart != null &amp;&amp; !item.mtbAart.flagQtaCnfFissaBoolean) ? View.VISIBLE : View.GONE}"
                    app:layout_constraintEnd_toEndOf="parent"
                    app:layout_constraintTop_toTopOf="parent"
                    tools:text="PESO KG" />

            </androidx.constraintlayout.widget.ConstraintLayout>


            <androidx.appcompat.widget.AppCompatTextView
                android:id="@+id/second_line"
                style="@style/AppTheme.NewMaterial.Text.Small"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:maxLines="1"
                android:text="@{item.getDescrizione()}"
                android:textColor="@android:color/black"
                android:textSize="16sp"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/first_line"
                tools:text="Descrizione lunga articolo" />


            <androidx.appcompat.widget.AppCompatTextView
                style="@style/AppTheme.NewMaterial.Text.Small"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@{`Lotto: ` + item.getPartitaMag()}"
                android:visibility="@{UtilityString.isNullOrEmpty(item.getPartitaMag()) ? View.INVISIBLE : View.VISIBLE}"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@id/second_line"
                tools:text="Lotto: ABCDE" />

        </androidx.constraintlayout.widget.ConstraintLayout>


        <androidx.appcompat.widget.AppCompatTextView
            android:id="@+id/qta_textview"
            style="@style/AppTheme.NewMaterial.Text"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginHorizontal="16dp"
            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"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            tools:text="280.45\nCONF" />


    </androidx.constraintlayout.widget.ConstraintLayout>

</layout>