<?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="row"
            type="it.integry.integrywmsnative.gest.contab_doc_interni.dto.DialogChooseRowFromListaDocRowsListModel" />
    </data>


    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:background="@drawable/bg_checked_layout"
        app:backgroundTintResID="@{row.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="@{() -> row.toggleCheck()}">

        <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="@{row.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.AppCompatImageView
                    android:id="@+id/bottom_sheet_actions_delete_btn"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentEnd="true"
                    android:background="@android:color/white"
                    android:paddingStart="6dp"
                    android:paddingEnd="6dp"
                    android:src="@drawable/ic_baseline_new_24"
                    android:textSize="14sp"
                    android:tint="@color/orange_600"
                    android:visibility="@{row.isNew ? View.VISIBLE : View.GONE}" />

                <androidx.appcompat.widget.AppCompatTextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@{row.codMart}"
                    android:textColor="@color/colorPrimary"
                    android:textSize="14sp"
                    android:textStyle="bold"
                    tools:text="COD MART" />

            </RelativeLayout>

            <androidx.appcompat.widget.AppCompatTextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@{row.barcode}"
                android:textColor="@color/red_600"
                android:textSize="14sp"
                android:textStyle="bold"
                tools:text="0000000000000" />


            <androidx.appcompat.widget.AppCompatTextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:ellipsize="end"
                android:maxLines="2"
                android:text="@{row.descrizione}"
                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/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"
                android:text="@{row.qtaOrdReadable}"
                tools:text="280.45\nCONF" />

        </RelativeLayout>


    </RelativeLayout>
</layout>