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

    <data>
        <import type="it.integry.integrywmsnative.R" />
        <import type="android.view.View" />
        <import type="it.integry.integrywmsnative.core.utility.UtilityString" />
        <import type="it.integry.integrywmsnative.core.utility.UtilityNumber" />
        <variable
            name="checkableMtbColr"
            type="it.integry.integrywmsnative.core.model.CheckableMtbColr"/>
    </data>


    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:background="@drawable/bg_checked_layout"
        app:backgroundTintResID="@{checkableMtbColr.checked.get() ? R.color.bg_checked_layout : android.R.color.transparent}"
        android:layout_marginTop="2dp"
        android:layout_marginStart="4dp"
        android:layout_marginBottom="2dp"
        android:paddingStart="8dp"
        android:paddingEnd="8dp"
        android:paddingTop="8dp"
        android:paddingBottom="8dp"
        android:onClick="@{() -> checkableMtbColr.toggleCheck()}">

        <androidx.appcompat.widget.AppCompatCheckBox
            android:id="@+id/checkbox"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginEnd="8dp"
            android:layout_centerVertical="true"
            app:checked="@{checkableMtbColr.checked}"/>

            <LinearLayout
                android:id="@+id/linearLayout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:layout_toEndOf="@id/checkbox"
                android:layout_toStartOf="@id/qta_box">


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


                    <androidx.appcompat.widget.AppCompatTextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@{checkableMtbColr.item.mtbColr.mtbAart.getCodMart()}"
                        android:textColor="@color/colorPrimary"
                        android:textSize="14sp"
                        android:textStyle="bold"
                        tools:text="COD MART" />



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

                </RelativeLayout>

                <androidx.appcompat.widget.AppCompatTextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@{checkableMtbColr.item.mtbColr.mtbAart.getDiacod()}"
                    android:textColor="@color/red_600"
                    android:textSize="14sp"
                    android:textStyle="bold"
                    android:visibility="@{UtilityString.isNullOrEmpty(checkableMtbColr.item.mtbColr.mtbAart.diacod) ? View.GONE : View.VISIBLE}"
                    tools:text="DIACOD" />


                <androidx.appcompat.widget.AppCompatTextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:ellipsize="end"
                    android:maxLines="2"
                    android:text="@{checkableMtbColr.item.mtbColr.mtbAart.descrizioneEstesa}"
                    android:textColor="@android:color/black"
                    android:textSize="16sp"
                    tools:text="Descrizione lunga articolo" />


            </LinearLayout>




            <RelativeLayout
                android:id="@+id/qta_box"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:paddingStart="12dp"
                android:layout_alignParentEnd="true"
                android:layout_centerVertical="true">

                <androidx.appcompat.widget.AppCompatTextView
                    android:id="@+id/qta_textview"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@drawable/badge1_round_corner"
                    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"
                    tools:text="280.45\nCONF" />

            </RelativeLayout>




    </RelativeLayout>
</layout>