<?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="androidx.core.content.ContextCompat" />
        <import type="it.integry.integrywmsnative.R" />
        <import type="it.integry.integrywmsnative.core.utility.UntMisUtils" />

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

        <variable
            name="item"
            type="it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.info_situazione_articolo.ui.DialogInfoSituazioneArticoloAvailableListItem" />

    </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="@{&quot;UL &quot; + item.numCollo.toString() + &quot; del &quot; + UtilityDate.formatDate(item.dataCollo, UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN)}"
                android:textStyle="bold"
                tools:text="UL 109467 del 17 mar 2023" />


            <!--            <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.descrizioneEstesa, &quot;Nessuna descrizione&quot;)}"-->
            <!--                tools:text="Descrizione lunga articolo" />-->

            <androidx.appcompat.widget.LinearLayoutCompat
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="4dp"
                android:background="@drawable/badge_round_corner_without_padding"
                android:backgroundTint="@color/green_200"
                android:gravity="center_vertical"
                android:orientation="horizontal"
                android:visibility="@{item.partitaMag != null ? View.VISIBLE : View.GONE}">

                <androidx.appcompat.widget.LinearLayoutCompat
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_margin="4dp"
                    android:background="@drawable/badge_round_corner"
                    android:backgroundTint="@{ContextCompat.getColor(context, item.partitaMagMatch ? R.color.green_200 : R.color.white)}"
                    android:gravity="center_vertical"
                    android:orientation="horizontal">

                    <androidx.appcompat.widget.AppCompatImageView
                        android:layout_width="12dp"
                        android:layout_height="12dp"
                        android:src="@drawable/ic_info_78dp"
                        android:tint="@android:color/black" />

                    <androidx.appcompat.widget.AppCompatTextView
                        style="@style/AppTheme.NewMaterial.Text.Small"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="4dp"
                        android:text="@{item.partitaMag}"
                        android:textColor="@android:color/black"
                        tools:text="PARTITA" />

                    <androidx.appcompat.widget.AppCompatImageView
                        android:layout_width="12dp"
                        android:layout_height="12dp"
                        android:layout_marginStart="8dp"
                        android:visibility="@{item.dataScad != null ? View.VISIBLE : View.GONE}"
                        android:src="@drawable/ic_calendar_schedule"
                        android:tint="@android:color/black" />

                    <androidx.appcompat.widget.AppCompatTextView
                        style="@style/AppTheme.NewMaterial.Text.Small"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="4dp"
                        android:visibility="@{item.dataScad != null ? View.VISIBLE : View.GONE}"
                        android:text="@{UtilityDate.formatDate(item.dataScad, UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN)}"
                        android:textColor="@android:color/black"
                        tools:text="17 mag 2023" />
                </androidx.appcompat.widget.LinearLayoutCompat>
            </androidx.appcompat.widget.LinearLayoutCompat>

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

                <androidx.appcompat.widget.LinearLayoutCompat
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="4dp"
                    android:background="@drawable/badge_round_corner_without_padding"
                    android:backgroundTint="@color/light_blue_500"
                    android:gravity="center_vertical"
                    android:visibility="@{item.posizione != null ? View.VISIBLE : View.GONE}">

                    <androidx.appcompat.widget.LinearLayoutCompat
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_margin="4dp"
                        android:background="@drawable/badge_round_corner"
                        android:backgroundTint="@color/light_blue_500"
                        android:gravity="center_vertical"
                        android:orientation="horizontal">

                        <androidx.appcompat.widget.AppCompatImageView
                            android:id="@+id/position_label_icon"
                            android:layout_width="12dp"
                            android:layout_height="12dp"
                            android:src="@drawable/ic_location_24"
                            android:tint="@android:color/black"
                            app:layout_constraintBottom_toBottomOf="parent"
                            app:layout_constraintTop_toTopOf="parent" />

                        <androidx.appcompat.widget.AppCompatTextView
                            style="@style/AppTheme.NewMaterial.Text.Small"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginStart="4dp"
                            android:text="@{item.posizione}"
                            app:layout_constraintStart_toEndOf="@id/position_label_icon"
                            tools:text="POSIZIONE" />

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

                <androidx.appcompat.widget.LinearLayoutCompat
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="4dp"
                    android:layout_marginTop="4dp"
                    android:background="@drawable/badge_round_corner_without_padding"
                    android:backgroundTint="@color/red_300"
                    android:gravity="center_vertical"
                    android:orientation="horizontal"
                    android:visibility="@{item.codJcom != null ? View.VISIBLE : View.GONE}">

                    <androidx.appcompat.widget.LinearLayoutCompat
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_margin="4dp"
                        android:background="@drawable/badge_round_corner"
                        android:backgroundTint="@{ContextCompat.getColor(context, item.commessaMatch ? R.color.red_300 : R.color.white)}"
                        android:gravity="center_vertical"
                        android:orientation="horizontal">

                        <androidx.appcompat.widget.AppCompatImageView
                            android:layout_width="12dp"
                            android:layout_height="12dp"
                            android:src="@drawable/ic_tag"
                            android:tint="@android:color/black" />

                        <androidx.appcompat.widget.AppCompatTextView
                            style="@style/AppTheme.NewMaterial.Text.Small"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginStart="4dp"
                            android:text="@{item.codJcom}"
                            tools:text="COMMESSA" />
                    </androidx.appcompat.widget.LinearLayoutCompat>
                </androidx.appcompat.widget.LinearLayoutCompat>
            </androidx.appcompat.widget.LinearLayoutCompat>

        </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.qtaCol != 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.qtaCol, 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>