<?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.gnc.page.query.list.GncQueryListViewModel" />
    </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='@{"请选择查询日期"}'
                icon="@{@drawable/img_date}"
                type="@{SearchLayoutType.DATE}"
                value="@={viewModel.date}"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1" />

            <View
                android:layout_width="10dp"
                android:layout_height="1dp"
                android:background="@color/gray" />

            <com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
                hint='@{"请选择查询日期"}'
                icon="@{@drawable/img_date}"
                type="@{SearchLayoutType.DATE}"
                value="@={viewModel.dateEnd}"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1" />

            <com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
                list="@{viewModel.dateTypeList}"
                type="@{SearchLayoutType.SPINNER}"
                value="@={viewModel.dateType}"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1" />

            <com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
                hint='@{"请选择特码"}'
                list="@{viewModel.spCodeList}"
                type="@{SearchLayoutType.SPINNER}"
                value="@={viewModel.spCode}"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1" />

            <com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
                hint='@{"请输入运单号"}'
                icon="@{@drawable/img_scan}"
                setInputWaybill="@{true}"
                setOnIconClickListener="@{()->viewModel.onScanClick()}"
                setRefreshCallBack="@{viewModel::refresh}"
                type="@{SearchLayoutType.INPUT}"
                value="@={viewModel.waybill}"
                setSearchListRefresh="@{viewModel::getWayBillList}"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1" />

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1">

                <ImageView
                    style="@style/iv_search_action"
                    android:onClick="@{()-> viewModel.refresh()}"
                    android:src="@drawable/img_search" />

                <ImageView
                    style="@style/iv_search_action"
                    android:onClick="@{()-> viewModel.onFilterClick()}"
                    android:src="@drawable/img_filter" />

            </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_gnc_query_list" />

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

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:background="#5c6890"
            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+"条，总件数："+viewModel.number+"，总重量："+viewModel.weight+"KG"}'
                android:textColor="@color/white"
                android:textSize="18sp"
                android:textStyle="bold"
                tools:text="合计：3条，总件数：212，总重量：342KG" />

        </LinearLayout>

    </LinearLayout>
</layout>