<?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.gnj.unload.add.GnjUnloadAddViewModel" />
    </data>

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

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

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="80dp"
            android:gravity="center">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="航班日期："
                android:textColor="@color/text_normal"
                android:textSize="22sp"
                android:textStyle="bold" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@{viewModel.flight.fdate}"
                android:textColor="@color/text_normal"
                android:textSize="22sp"
                android:textStyle="bold" />

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

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="航班号："
                android:textColor="@color/text_normal"
                android:textSize="22sp"
                android:textStyle="bold" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@{viewModel.flight.fno}"
                android:textColor="@color/text_normal"
                android:textSize="22sp"
                android:textStyle="bold" />

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

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="航程："
                android:textColor="@color/text_normal"
                android:textSize="22sp"
                android:textStyle="bold" />


            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@{viewModel.flight.hangCheng}"
                android:textColor="@color/text_normal"
                android:textSize="22sp"
                android:textStyle="bold" />


            <!--<com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
                hint='@{"请选择货物类型"}'
                list="@{viewModel.cargoTypeList}"
                type="@{SearchLayoutType.SPINNER}"
                value="@={viewModel.cargoType}"
                android:layout_width="160dp"
                android:layout_height="wrap_content" />-->


        </LinearLayout>

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

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

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:background="@color/color_bottom_layout"
            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/white"
                android:textSize="18sp"
                android:textStyle="bold" />

            <CheckBox
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_marginRight="20dp"
                android:textColor="@color/white"
                android:buttonTint="@color/white"
                android:textSize="18sp"
                android:text="业务袋"
                android:checked="@={viewModel.check}"/>

            <LinearLayout
                android:layout_width="240dp"
                android:layout_height="40dp"
                android:layout_marginRight="10dp"
                android:background="@drawable/bg_search_row">
                <TextView
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="1.4"
                    android:background="@null"
                    android:hint="请选择货物类型"
                    android:gravity="center_vertical"
                    android:text="@={viewModel.cargoTypeString}"
                    android:onClick="@{()-> viewModel.onCargoTypeClick()}"/>

                <ImageView
                    visible="@{viewModel.clearable}"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="0.2"
                    android:src="@drawable/delete"
                    android:onClick="@{()-> viewModel.clearChecked()}"/>

                <ImageView
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="0.2"
                    android:src="@drawable/arrow_down"
                    android:onClick="@{()-> viewModel.onCargoTypeClick()}"/>
            </LinearLayout>

            <com.lukouguoji.module_base.ui.weight.search.layout.PadSearchLayout
                android:id="@+id/psl_car"
                hint='@{"请输入平板车号"}'
                icon="@{@drawable/img_scan}"
                setOnIconClickListener="@{()-> viewModel.onScanCarClick()}"
                setRefreshCallBack="@{viewModel::onCarInputFinished}"
                value="@={viewModel.car}"
                android:layout_width="240dp"
                android:layout_height="wrap_content" />

            <TextView
                style="@style/tv_bottom_btn"
                android:onClick="@{()-> viewModel.setFlightClick()}"
                android:text="录入航班" />

            <TextView
                style="@style/tv_bottom_btn"
                android:onClick="@{()-> viewModel.confirmClick()}"
                android:text="确定" />

        </LinearLayout>

    </LinearLayout>
</layout>