<?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="androidx.databinding.ObservableList" />
        <import type="it.integry.integrywmsnative.R" />
        <import type="it.integry.integrywmsnative.core.utility.UtilityDate" />
        <import type="android.text.Html" />
        <import type="androidx.core.content.ContextCompat" />

        <variable
            name="view"
            type="it.integry.integrywmsnative.gest.contab_doc_interni.DocInterniFragment" />

        <variable
            name="viewModel"
            type="it.integry.integrywmsnative.gest.contab_doc_interni.DocInterniViewModel" />


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


    </data>

    <androidx.coordinatorlayout.widget.CoordinatorLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <androidx.appcompat.widget.LinearLayoutCompat
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@color/full_white"
            android:orientation="vertical">


            <androidx.cardview.widget.CardView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="12dp"
                app:cardCornerRadius="16dp"
                app:cardElevation="4dp">

                <androidx.appcompat.widget.LinearLayoutCompat
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@color/colorPrimary"
                    android:orientation="horizontal"
                    android:padding="16dp">

                    <androidx.appcompat.widget.AppCompatImageView
                        android:layout_width="30dp"
                        android:layout_height="30dp"
                        android:layout_gravity="center_vertical"
                        android:layout_marginEnd="16dp"
                        android:adjustViewBounds="true"
                        android:src="@drawable/ic_documents_outline"
                        android:tint="@color/white" />


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

                        <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.TextBoxLittleDashboard"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="Tipo doc:" />

                            <androidx.appcompat.widget.AppCompatTextView
                                style="@style/AppTheme.NewMaterial.Text.TextBoxLittleDashboard"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginStart="4dp"
                                android:text="Non definito"
                                android:textStyle="italic"
                                app:visibility="@{viewModel.dtbTipi.codDtip.empty}"
                                tools:visibility="gone"/>

                            <androidx.appcompat.widget.AppCompatTextView
                                style="@style/AppTheme.NewMaterial.Text.TextBoxLittleDashboard"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginStart="4dp"
                                android:text="@{viewModel.dtbTipi.codDtip}"
                                app:reverse_visibility="@{viewModel.dtbTipi.codDtip.empty}"
                                tools:text="114" />

                            <androidx.appcompat.widget.AppCompatTextView
                                style="@style/AppTheme.NewMaterial.Text.TextBoxLittleDashboard"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginStart="4dp"
                                android:ellipsize="end"
                                android:maxLines="1"
                                android:text="@{viewModel.dtbTipi.descrizione}"
                                app:reverse_visibility="@{viewModel.dtbTipi.codDtip.empty}"
                                tools:text="PERDITA" />
                        </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"
                            app:reverse_visibility="@{viewModel.fornitore == null}">

                            <androidx.appcompat.widget.AppCompatTextView
                                style="@style/AppTheme.NewMaterial.Text.TextBoxLittleDashboard"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="Fornitore:" />

                            <androidx.appcompat.widget.AppCompatTextView
                                style="@style/AppTheme.NewMaterial.Text.TextBoxLittleDashboard"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginStart="4dp"
                                android:text="@{viewModel.fornitore.label}"
                                tools:text="F0000 - CARELLI" />

                        </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"
                            app:reverse_visibility="@{UtilityString.isNullOrEmpty(viewModel.numDoc)}">

                            <androidx.appcompat.widget.AppCompatTextView
                                style="@style/AppTheme.NewMaterial.Text.TextBoxLittleDashboard"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="Documento:" />

                            <androidx.appcompat.widget.AppCompatTextView
                                style="@style/AppTheme.NewMaterial.Text.TextBoxLittleDashboard"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginStart="4dp"
                                android:text="@{Html.fromHtml(context.getString(R.string.doc_testata, viewModel.numDoc, UtilityDate.formatDate(viewModel.dataDoc, UtilityDate.COMMONS_DATE_FORMATS.DMY_HUMAN)))}"
                                tools:text="n. 123 del 29/03/2023" />

                        </androidx.appcompat.widget.LinearLayoutCompat>

                    </androidx.appcompat.widget.LinearLayoutCompat>

                </androidx.appcompat.widget.LinearLayoutCompat>

            </androidx.cardview.widget.CardView>


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

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/doc_interni_main_list"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginTop="16dp"
                    android:background="@color/full_white"
                    android:paddingStart="2dp"
                    android:paddingEnd="2dp"
                    tools:itemCount="5"
                    tools:listitem="@layout/doc_interni_list_model" />

                <androidx.constraintlayout.widget.ConstraintLayout
                    android:id="@+id/doc_interni_empty_view"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:alpha="0.3">

                    <androidx.constraintlayout.widget.Guideline
                        android:id="@+id/guideline_empty_top"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:orientation="horizontal"
                        app:layout_constraintGuide_percent="0.2" />

                    <androidx.constraintlayout.widget.Guideline
                        android:id="@+id/guideline_empty_left"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:orientation="vertical"
                        app:layout_constraintGuide_percent="0.15" />

                    <androidx.constraintlayout.widget.Guideline
                        android:id="@+id/guideline_empty_right"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:orientation="vertical"
                        app:layout_constraintGuide_percent="0.85" />

                    <LinearLayout
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:gravity="center_horizontal"
                        android:orientation="vertical"

                        app:layout_constraintEnd_toStartOf="@id/guideline_empty_right"
                        app:layout_constraintStart_toEndOf="@id/guideline_empty_left"
                        app:layout_constraintTop_toTopOf="@id/guideline_empty_top">

                        <androidx.appcompat.widget.AppCompatImageView
                            android:layout_width="72dp"
                            android:layout_height="wrap_content"
                            android:adjustViewBounds="true"
                            android:src="@drawable/ic_playlist_add_check_24dp" />

                        <androidx.appcompat.widget.AppCompatTextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:gravity="center_horizontal"
                            android:text="@string/no_doc_found_message"
                            android:textColor="@android:color/black"
                            android:textSize="18sp" />
                    </LinearLayout>

                </androidx.constraintlayout.widget.ConstraintLayout>


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


        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">


            <androidx.constraintlayout.widget.Guideline
                android:id="@+id/free_picking__suggestion_1__guideline_top"
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:orientation="horizontal"
                app:layout_constraintGuide_percent="0.3" />

            <androidx.constraintlayout.widget.Guideline
                android:id="@+id/free_picking__suggestion_1__guideline_left"
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:orientation="vertical"
                app:layout_constraintGuide_percent="0.2" />

            <androidx.constraintlayout.widget.Guideline
                android:id="@+id/free_picking__suggestion_1__guideline_right"
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:orientation="vertical"
                app:layout_constraintGuide_percent="0.8" />

        </androidx.constraintlayout.widget.ConstraintLayout>


        <com.google.android.material.floatingactionbutton.FloatingActionButton
            android:id="@+id/main_fab"
            style="?attr/floatingActionButtonPrimaryStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom|end"
            android:layout_margin="16dp"
            android:visibility="visible"
            app:singleClick="@{viewModel::newDocument}"
            app:srcCompat="@drawable/ic_add_24dp" />
    </androidx.coordinatorlayout.widget.CoordinatorLayout>

</layout>