<?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>

        <variable
            name="viewModel"
            type="com.lukouguoji.gnc.page.distribution.home.GncDistributionHomeViewModel" />

        <import type="com.lukouguoji.module_base.ui.weight.search.layout.SearchLayoutType" />

    </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.startDate}"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1" />
            <View
                android:layout_width="10dp"
                android:background="@color/gray"
                android:layout_height="1dp"/>

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

            <com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
                hint='@{"请输入航班号"}'
                value="@={viewModel.flightNo}"
                setTextAllCaps="@{true}"
                setRefreshCallBack="@{viewModel::onFnoChange}"
                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.distributionStatusList}"
                type="@{SearchLayoutType.SPINNER}"
                value="@={viewModel.distributionStatus}"
                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.distributionStatusList}"
                type="@{SearchLayoutType.SPINNER}"
                value="@={viewModel.distributionStatus}"
                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}"
                setOnIconClickListener="@{viewModel::carScan}"
                value="@={viewModel.car}"
                setTextAllCaps="@{true}"
                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" />

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

            </LinearLayout>

        </LinearLayout>

        <androidx.appcompat.widget.LinearLayoutCompat
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center_vertical"
            android:paddingTop="10dp">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="15dp"
                android:onClick="@{()->viewModel.onAllSelectClick()}"
                android:text="全选" />

            <ImageView
                android:id="@+id/checkIcon"
                android:layout_width="30dp"
                android:layout_height="30dp"
                android:layout_marginLeft="5dp"
                android:onClick="@{()->viewModel.onAllSelectClick()}"
                android:src="@drawable/img_check_all" />

            <View
                android:layout_width="0dp"
                android:layout_height="0dp"
                android:layout_weight="1" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginRight="15dp"
                android:text="说明：平板车背景色黄色为优先配，字体红色为特货"
                android:textColor="@color/red"
                android:textSize="15sp" />

        </androidx.appcompat.widget.LinearLayoutCompat>

        <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.GridLayoutManager"
                app:spanCount="3"
                tools:listitem="@layout/item_gnc_distribution" />

        </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 +"辆"}'
                tools:text="平板车：6辆"
                android:textColor="@color/white"
                android:textSize="18sp"
                android:textStyle="bold" />


            <TextView
                style="@style/tv_bottom_btn"
                android:onClick="@{()->viewModel.onAddCargo()}"
                android:text="加货" />

            <TextView
                style="@style/tv_bottom_btn"
                android:onClick="@{()->viewModel.onSupplementClick()}"
                android:text="补充机位" />

            <TextView
                style="@style/tv_bottom_btn"
                android:onClick="@{()->viewModel.onHandoverClick()}"
                android:text="单证交接" />

            <TextView
                style="@style/tv_bottom_btn"
                android:onClick="@{()->viewModel.onDistributionClick()}"
                android:text="分配司机" />

        </LinearLayout>

    </LinearLayout>
</layout>