<?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="com.lukouguoji.module_base.ui.weight.search.layout.SearchLayoutType" />
        <variable
            name="viewModel"
            type="com.lukouguoji.aerologic.page.uld.list.UldListViewModel" />
    </data>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/color_f2"
        android:orientation="vertical">

        <include layout="@layout/title_tool_bar" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginHorizontal="10dp"
            android:layout_marginTop="10dp"
            android:gravity="center_vertical">

            <com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
                hint='@{"选择状态"}'
                list="@{viewModel.statusList}"
                type="@{SearchLayoutType.SPINNER}"
                value="@={viewModel.status}"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="0.33" />

            <com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
                hint='@{"选择所属航司"}'
                list="@{viewModel.carrierList}"
                type="@{SearchLayoutType.SPINNER}"
                value="@={viewModel.uldSuffix}"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="0.33" />

            <com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
                hint='@{"请输入ULD编号"}'
                icon="@{@drawable/img_scan}"
                setOnIconClickListener="@{()-> viewModel.onUldScanClick()}"
                type="@{SearchLayoutType.INPUT}"
                value="@={viewModel.uldNo}"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="0.33" />

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:gravity="center_vertical|start"
                android:orientation="horizontal"
                android:paddingHorizontal="24dp">

                <ImageView
                    android:layout_width="36dp"
                    android:layout_height="36dp"
                    android:onClick="@{()-> viewModel.refresh()}"
                    android:padding="2dp"
                    android:src="@drawable/img_search" />

                <ImageView
                    android:layout_width="40dp"
                    android:layout_height="40dp"
                    android:layout_marginLeft="16dp"
                    android:onClick="@{()-> viewModel.onAddClick()}"
                    android:src="@drawable/img_add" />

            </LinearLayout>

        </LinearLayout>

        <com.scwang.smart.refresh.layout.SmartRefreshLayout
            android:id="@+id/srl"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1">

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/rv"
                itemLayoutId="@{viewModel.itemLayoutId}"
                viewHolder="@{viewModel.itemViewHolder}"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
                tools:listitem="@layout/item_uld_list" />

        </com.scwang.smart.refresh.layout.SmartRefreshLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:background="@color/white"
            android:gravity="center_vertical"
            android:paddingHorizontal="15dp">

            <TextView
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text='@{"合计：" + viewModel.count + "条"}'
                android:textColor="@color/bottom_tool_tips_text_color"
                android:textSize="18sp"
                android:textStyle="bold" />

        </LinearLayout>

    </LinearLayout>
</layout>
