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

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

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

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

        <variable
            name="item"
            type="it.integry.integrywmsnative.core.rest.model.giacenza.InstantItemSituationIncomingItemDto" />

    </data>


    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center_vertical"
        android:orientation="horizontal"
        android:paddingVertical="8dp">

        <androidx.appcompat.widget.LinearLayoutCompat
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_toStartOf="@id/qta_box"
            android:gravity="center_vertical"
            android:orientation="vertical">


            <androidx.appcompat.widget.AppCompatTextView
                style="@style/AppTheme.NewMaterial.Text.Medium"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@{UtilityDate.formatDate(item.dataCons, UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN)}"
                android:textStyle="bold"
                tools:text="Data cons" />


            <androidx.appcompat.widget.AppCompatTextView
                style="@style/TextAppearance.AppCompat.Small"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:maxLines="2"
                android:text="@{UtilityString.isNull(item.descrizione, &quot;Nessuna descrizione&quot;)}"
                tools:text="Descrizione lunga articolo" />
        </androidx.appcompat.widget.LinearLayoutCompat>


        <androidx.appcompat.widget.LinearLayoutCompat
            android:id="@+id/qta_box"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true"
            android:layout_centerVertical="true"
            android:layout_marginStart="8dp"
            android:background="@drawable/badge_round_corner"
            android:backgroundTint="@color/colorPrimary"
            android:gravity="center_horizontal"
            android:orientation="vertical"
            android:padding="6dp"
            android:visibility="@{item.qtaOrd != null ? View.VISIBLE : View.GONE}">


            <androidx.appcompat.widget.AppCompatTextView
                style="@style/TextAppearance.AppCompat.Small"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:backgroundTint="@color/colorPrimary"
                android:gravity="center"
                android:text="@{UtilityNumber.decimalToString(item.numCnf, 0)}"
                android:textAllCaps="true"
                android:textColor="@android:color/white"
                android:textStyle="bold"
                app:visibility="@{UntMisUtils.shouldBeShowInColli(item.mtbAart)}"
                tools:text="280"
                tools:visibility="gone"/>


            <androidx.appcompat.widget.AppCompatTextView
                style="@style/TextAppearance.AppCompat.Small"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="@string/unt_mis_col"
                android:textAllCaps="true"
                android:textColor="@android:color/white"
                android:textStyle="bold"
                app:visibility="@{UntMisUtils.shouldBeShowInColli(item.mtbAart)}"
                tools:text="CONF"
                tools:visibility="gone" />


            <androidx.appcompat.widget.AppCompatTextView
                style="@style/TextAppearance.AppCompat.Small"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:backgroundTint="@color/colorPrimary"
                android:gravity="center"
                android:text="@{UtilityNumber.decimalToString(item.qtaOrd, item.mtbAart.firstUntMis.cifreDec.intValue())}"
                android:textAllCaps="true"
                android:textColor="@android:color/white"
                android:textStyle="bold"
                app:reverse_visibility="@{UntMisUtils.shouldBeShowInColli(item.mtbAart)}"
                tools:text="280.45" />

            <androidx.appcompat.widget.AppCompatTextView
                style="@style/TextAppearance.AppCompat.Small"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="@{item.untMis}"
                android:textAllCaps="true"
                android:textColor="@android:color/white"
                android:textStyle="bold"
                app:reverse_visibility="@{UntMisUtils.shouldBeShowInColli(item.mtbAart)}"
                tools:text="CONF" />

        </androidx.appcompat.widget.LinearLayoutCompat>

    </RelativeLayout>


</layout>