<?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="android.view.View" />

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

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

        <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
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="8dp">

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

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


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

                    <androidx.appcompat.widget.AppCompatTextView
                        style="@style/AppTheme.NewMaterial.Text.Small"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@{mtbColr.codMart}"
                        android:textColor="@color/colorPrimary"
                        android:textSize="14sp"
                        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(mtbColr.qtaCol) + mtbColr.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>

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


                <TextView
                    style="@style/AppTheme.NewMaterial.Text.Small"
                    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}"
                    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_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.Small"
                    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"
                    tools:text="280.45\nCONF" />

            </RelativeLayout>
        </androidx.constraintlayout.widget.ConstraintLayout>


        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginEnd="10dp"
            android:visibility="@{mtbColr.numColloRif != null ? View.VISIBLE : View.GONE}"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/art_detail">

            <androidx.appcompat.widget.LinearLayoutCompat
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="8dp"
                android:background="@drawable/badge_round_corner"
                android:backgroundTint="@color/green_600"
                android:orientation="horizontal"
                android:padding="2dp">

                <androidx.appcompat.widget.LinearLayoutCompat
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@drawable/badge_round_corner"
                    android:backgroundTint="@android:color/white"
                    android:orientation="horizontal"
                    android:padding="0dp">

                    <androidx.appcompat.widget.LinearLayoutCompat
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:orientation="vertical"
                        android:paddingStart="2dp"
                        android:paddingEnd="4dp">

                        <androidx.appcompat.widget.AppCompatImageView
                            android:id="@+id/image"
                            android:layout_width="24dp"
                            android:layout_height="24dp"
                            android:layout_gravity="center_horizontal"
                            android:layout_marginStart="8dp"
                            android:layout_marginTop="8dp"
                            android:layout_marginEnd="8dp"
                            android:layout_marginBottom="8dp"
                            android:src="@drawable/ic_box"
                            android:tint="@color/green_600" />


                        <androidx.appcompat.widget.AppCompatTextView
                            android:id="@+id/refs_title"
                            style="@style/AppTheme.NewMaterial.Text.Small"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="Prelevato da"
                            android:textColor="@color/green_600"
                            android:textStyle="bold" />
                    </androidx.appcompat.widget.LinearLayoutCompat>

                    <androidx.appcompat.widget.AppCompatImageView
                        android:layout_width="2dp"
                        android:layout_height="match_parent"
                        android:background="@color/green_600" />

                    <androidx.appcompat.widget.LinearLayoutCompat
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:orientation="horizontal"
                        android:padding="10dp"
                        android:weightSum="2">

                        <androidx.appcompat.widget.LinearLayoutCompat
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_weight="1"
                            android:orientation="vertical">

                            <androidx.appcompat.widget.LinearLayoutCompat
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:orientation="horizontal">

                                <androidx.appcompat.widget.AppCompatTextView
                                    style="@style/AppTheme.NewMaterial.Text.Small"
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:text="Num: "
                                    android:textColor="@android:color/black" />

                                <androidx.appcompat.widget.AppCompatTextView
                                    style="@style/AppTheme.NewMaterial.Text.Small"
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:text="@{mtbColr.numColloRif.toString()}"
                                    android:textColor="@android:color/black"
                                    android:textStyle="bold"
                                    tools:text="5230" />
                            </androidx.appcompat.widget.LinearLayoutCompat>

                            <androidx.appcompat.widget.LinearLayoutCompat
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginTop="2dp"
                                android:orientation="horizontal">

                                <androidx.appcompat.widget.AppCompatTextView
                                    style="@style/AppTheme.NewMaterial.Text.Small"
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:text="Gest: "
                                    android:textColor="@android:color/black" />

                                <androidx.appcompat.widget.AppCompatTextView
                                    style="@style/AppTheme.NewMaterial.Text.Small"
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:text="@{mtbColr.gestioneRif}"
                                    android:textColor="@android:color/black"
                                    android:textStyle="bold"
                                    tools:text="V" />
                            </androidx.appcompat.widget.LinearLayoutCompat>
                        </androidx.appcompat.widget.LinearLayoutCompat>


                        <androidx.appcompat.widget.LinearLayoutCompat
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_weight="0"
                            android:orientation="vertical">

                            <androidx.appcompat.widget.LinearLayoutCompat
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:orientation="horizontal">

                                <androidx.appcompat.widget.AppCompatTextView
                                    style="@style/AppTheme.NewMaterial.Text.Small"
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:text="Data: "
                                    android:textColor="@android:color/black" />

                                <androidx.appcompat.widget.AppCompatTextView
                                    style="@style/AppTheme.NewMaterial.Text.Small"
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:text="@{UtilityDate.formatDate(mtbColr.dataColloRifD, UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN)}"
                                    android:textColor="@android:color/black"
                                    android:textStyle="bold"
                                    tools:text="02 mar 2020" />
                            </androidx.appcompat.widget.LinearLayoutCompat>

                            <androidx.appcompat.widget.LinearLayoutCompat
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginTop="2dp"
                                android:orientation="horizontal">

                                <androidx.appcompat.widget.AppCompatTextView
                                    style="@style/AppTheme.NewMaterial.Text.Small"
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:text="Serie: "
                                    android:textColor="@android:color/black" />

                                <androidx.appcompat.widget.AppCompatTextView
                                    style="@style/AppTheme.NewMaterial.Text.Small"
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:text="@{mtbColr.serColloRif}"
                                    android:textColor="@android:color/black"
                                    android:textStyle="bold"
                                    tools:text="UL" />
                            </androidx.appcompat.widget.LinearLayoutCompat>
                        </androidx.appcompat.widget.LinearLayoutCompat>


                    </androidx.appcompat.widget.LinearLayoutCompat>
                </androidx.appcompat.widget.LinearLayoutCompat>
            </androidx.appcompat.widget.LinearLayoutCompat>


        </RelativeLayout>

    </androidx.constraintlayout.widget.ConstraintLayout>
</layout>