<?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.R" />

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

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

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

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

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

        <import type="android.text.Html" />

        <variable
            name="listModel"
            type="it.integry.integrywmsnative.gest.prod_versamento_materiale.dto.VersamentoMerceOrdineLavListModel" />

    </data>


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

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

        <androidx.appcompat.widget.LinearLayoutCompat

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

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

                <androidx.appcompat.widget.AppCompatTextView
                    style="@style/AppTheme.NewMaterial.Text.Medium"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@{Html.fromHtml(listModel.preDescriptionText)}"
                    android:textColor="@color/colorPrimary"
                    android:textSize="14sp"
                    android:textStyle="bold"
                    tools:text="N° X del dd/mm/yyyy" />

                <androidx.appcompat.widget.AppCompatTextView
                    android:id="@+id/peso_kg"
                    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="@{context.getColor(listModel.selected.get() ? R.color.orange_600 : R.color.gray_500)}"
                    android:paddingStart="6dp"
                    android:paddingEnd="6dp"
                    android:textColor="@android:color/white"
                    android:textSize="14sp"
                    android:textStyle="bold"
                    android:visibility="@{SettingsManager.iDB().isFlagForceAllToColli() || (listModel.originalMtbAart != null &amp;&amp; !listModel.originalMtbAart.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="@{Html.fromHtml(listModel.descriptionText)}"
                android:textColor="@android:color/secondary_text_light"
                tools:text="150303-010 CAVOLO VERZA 6 PZ PL NERA 604018" />

            <androidx.appcompat.widget.AppCompatTextView
                style="@style/AppTheme.NewMaterial.Text.Small"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:maxLines="2"
                android:text="@{Html.fromHtml(listModel.subDescriptionText)}"
                tools:text="Lotto: 35119F0038" />

            <androidx.appcompat.widget.AppCompatTextView
                style="@style/AppTheme.NewMaterial.Text.Small"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:maxLines="2"
                android:visibility="@{!UtilityString.isNullOrEmpty(listModel.subDescription2Text) ? View.VISIBLE : View.GONE}"
                android:text="@{Html.fromHtml(listModel.subDescription2Text)}"
                tools:text="note: prova" />


        </androidx.appcompat.widget.LinearLayoutCompat>


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

            <androidx.appcompat.widget.AppCompatTextView
                android:id="@+id/qta_textview"
                style="@style/AppTheme.NewMaterial.Text.Small"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/badge_round_corner"
                android:backgroundTint="@{context.getColor(listModel.selected.get() ? R.color.colorPrimary : R.color.gray_500)}"
                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"
                tools:backgroundTint="@color/colorPrimary"
                tools:text="280.45\nCONF" />

        </RelativeLayout>


    </RelativeLayout>
</layout>