<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <data>

        <import type="com.lukouguoji.module_base.ui.weight.data.layout.DataLayoutType" />

        <import type="com.lukouguoji.module_base.common.DetailsPageType" />

        <variable
            name="viewModel"
            type="com.lukouguoji.gnc.page.shouyun.details.GncShouYunDetailsViewModel" />
    </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" />

        <androidx.core.widget.NestedScrollView
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal">

                    <LinearLayout
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_margin="10dp"
                        android:layout_weight="2"
                        android:orientation="vertical">

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content">

                            <com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayout
                                enable="@{viewModel.pageType != DetailsPageType.Details}"
                                icon="@{@drawable/img_scan}"
                                required="@{viewModel.pageType != DetailsPageType.Details}"
                                setOnIconClickListener="@{()-> viewModel.waybillScanClick()}"
                                setRefreshCallBack="@{viewModel::getDetails}"
                                title='@{"运单号："}'
                                titleLength="@{6}"
                                type="@{DataLayoutType.INPUT}"
                                value="@={viewModel.dataBean.wbNo}"
                                android:layout_width="0dp"
                                android:layout_height="wrap_content"
                                android:layout_weight="1" />

                            <com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayout
                                enable="@{viewModel.pageType != DetailsPageType.Details}"
                                hint='@{" "}'
                                list="@{viewModel.channelList}"
                                required="@{viewModel.pageType != DetailsPageType.Details}"
                                title='@{"通道号："}'
                                titleLength="@{6}"
                                type="@{DataLayoutType.SPINNER}"
                                value="@={viewModel.channel}"
                                android:layout_width="0dp"
                                android:layout_height="wrap_content"
                                android:layout_weight="1" />

                        </LinearLayout>

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="20dp">

                            <com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayout
                                enable="@{viewModel.pageType != DetailsPageType.Details}"
                                icon="@{@drawable/img_scan}"
                                setOnIconClickListener="@{()-> viewModel.carScanClick()}"
                                setRefreshCallBack="@{viewModel::getCarInfo}"
                                title='@{"平板车："}'
                                titleLength="@{6}"
                                type="@{DataLayoutType.INPUT}"
                                value="@={viewModel.dataBean.carNo}"
                                android:layout_width="0dp"
                                android:layout_height="wrap_content"
                                android:layout_weight="1" />

                            <com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayout
                                enable="@{false}"
                                title='@{"平板车自重："}'
                                titleLength="@{6}"
                                type="@{DataLayoutType.INPUT}"
                                value="@={viewModel.dataBean.carWeight}"
                                android:layout_width="0dp"
                                android:layout_height="wrap_content"
                                android:layout_weight="1" />

                        </LinearLayout>

                    </LinearLayout>

                    <LinearLayout
                        android:layout_width="0dp"
                        android:layout_height="match_parent"
                        android:layout_marginVertical="15dp"
                        android:layout_weight="1"
                        android:background="@drawable/bg_gray_borad"
                        android:orientation="vertical">

                        <TextView
                            android:layout_width="match_parent"
                            android:layout_height="50dp"
                            android:layout_marginHorizontal="1dp"
                            android:layout_marginTop="1dp"
                            android:background="@drawable/bg_shouyun_dbcz"
                            android:gravity="center"
                            android:text="地磅称重"
                            android:textColor="@color/text_normal"
                            android:textSize="25sp"
                            android:textStyle="bold" />

                        <RelativeLayout
                            android:layout_width="match_parent"
                            android:layout_height="0dp"
                            android:layout_margin="1dp"
                            android:layout_weight="1"
                            android:background="@drawable/bg_shouyun_dbzl">

                            <TextView
                                visible="@{!viewModel.showWeightEdit}"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:layout_centerInParent="true"
                                android:background="@null"
                                android:gravity="center"
                                android:onLongClick="@{()-> viewModel.onWeightLongClick()}"
                                android:text="@{viewModel.diBangModel.weight}"
                                android:textColor="@color/red"
                                android:textSize="40sp"
                                android:textStyle="bold"
                                tools:text="0.00" />

                            <EditText
                                visible="@{viewModel.showWeightEdit}"
                                android:layout_width="match_parent"
                                android:layout_height="wrap_content"
                                android:layout_centerInParent="true"
                                android:background="@null"
                                android:gravity="center"
                                android:text="@={viewModel.diBangModel.weight}"
                                android:textColor="@color/red"
                                android:textSize="40sp"
                                android:textStyle="bold"
                                android:visibility="gone"
                                tools:text="0.00" />

                            <TextView
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_alignParentRight="true"
                                android:layout_centerVertical="true"
                                android:layout_marginRight="5dp"
                                android:text="KG"
                                android:textColor="@color/red"
                                android:textSize="30sp" />

                        </RelativeLayout>

                    </LinearLayout>

                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_margin="10dp">

                    <com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayout
                        enable="@{viewModel.pageType != DetailsPageType.Details}"
                        icon="@{@drawable/img_scan}"
                        setOnIconClickListener="@{()-> viewModel.uldScanClick()}"
                        setRefreshCallBack="@{viewModel::getUldInfo}"
                        title='@{"ULD编号："}'
                        titleLength="@{6}"
                        type="@{DataLayoutType.INPUT}"
                        value="@={viewModel.dataBean.uld}"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />

                    <com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayout
                        enable="@{false}"
                        title='@{"ULD自重："}'
                        titleLength="@{6}"
                        type="@{DataLayoutType.INPUT}"
                        value="@={viewModel.dataBean.uldWeight}"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />

                    <com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayout
                        enable="@{false}"
                        title='@{"预配件数："}'
                        titleLength="@{5}"
                        type="@{DataLayoutType.INPUT}"
                        value="@={viewModel.dataBean.apc}"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />

                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_margin="10dp">

                    <com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayout
                        enable="@{viewModel.pageType != DetailsPageType.Details}"
                        list="@{viewModel.agentList}"
                        required="@{viewModel.pageType != DetailsPageType.Details}"
                        title='@{"代理人："}'
                        titleLength="@{6}"
                        type="@{DataLayoutType.SPINNER}"
                        value="@={viewModel.dataBean.agentCode}"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />

                    <com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayout
                        enable="@{viewModel.pageType != DetailsPageType.Details}"
                        list="@{viewModel.spCodeList}"
                        required="@{viewModel.pageType != DetailsPageType.Details}"
                        title='@{"特码："}'
                        titleLength="@{6}"
                        type="@{DataLayoutType.SPINNER}"
                        value="@={viewModel.dataBean.spCode}"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />

                    <com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayout
                        enable="@{viewModel.pageType != DetailsPageType.Details}"
                        required="@{viewModel.pageType != DetailsPageType.Details}"
                        title='@{"件数："}'
                        titleLength="@{5}"
                        type="@{DataLayoutType.INPUT}"
                        value="@={viewModel.dataBean.pc}"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />


                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_margin="10dp">

                    <com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayout
                        enable="@{false}"
                        required="@{viewModel.pageType != DetailsPageType.Details}"
                        title='@{"承运人："}'
                        titleLength="@{6}"
                        type="@{DataLayoutType.INPUT}"
                        value="@={viewModel.dataBean.carrier}"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />

                    <com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayout
                        enable="@{viewModel.pageType != DetailsPageType.Details}"
                        title='@{"体积明细："}'
                        titleLength="@{6}"
                        type="@{DataLayoutType.INPUT}"
                        value="@={viewModel.dataBean.volDetail}"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />


                    <com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayout
                        enable="@{viewModel.pageType != DetailsPageType.Details}"
                        required="@{viewModel.pageType != DetailsPageType.Details}"
                        title='@{"重量："}'
                        titleLength="@{5}"
                        type="@{DataLayoutType.INPUT}"
                        value="@={viewModel.dataBean.weight}"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />


                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_margin="10dp">

                    <com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayout
                        enable="@{false}"
                        required="@{viewModel.pageType != DetailsPageType.Details}"
                        title='@{"计划航班："}'
                        titleLength="@{6}"
                        type="@{DataLayoutType.INPUT}"
                        value="@={viewModel.dataBean.flight}"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />

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

                        <LinearLayout
                            android:layout_width="match_parent"
                            android:layout_height="50dp"
                            android:layout_margin="5dp"
                            android:gravity="center_vertical"
                            android:orientation="horizontal">

                            <TextView
                                completeSpace="@{6}"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:text="航程："
                                android:textColor="@color/text_gray"
                                tools:text="标题" />

                            <LinearLayout
                                setEnable="@{false}"
                                android:layout_width="0dp"
                                android:layout_height="match_parent"
                                android:layout_marginLeft="10dp"
                                android:layout_weight="1"
                                android:background="@drawable/bg_data_layout"
                                android:gravity="center_vertical">

                                <TextView
                                    android:layout_width="0dp"
                                    android:layout_height="match_parent"
                                    android:layout_weight="1"
                                    android:gravity="center_vertical"
                                    android:paddingStart="10dp"
                                    android:text="@{viewModel.dataBean.rangeFirst}"
                                    android:textColor="@color/text_normal"
                                    android:textColorHint="@color/text_gray_l"
                                    android:textSize="14sp" />

                            </LinearLayout>

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

                            <LinearLayout
                                setEnable="@{false}"
                                android:layout_width="0dp"
                                android:layout_height="match_parent"
                                android:layout_marginLeft="10dp"
                                android:layout_weight="1"
                                android:background="@drawable/bg_data_layout"
                                android:gravity="center_vertical">

                                <TextView
                                    android:layout_width="0dp"
                                    android:layout_height="match_parent"
                                    android:layout_weight="1"
                                    android:gravity="center_vertical"
                                    android:paddingStart="10dp"
                                    android:text="@{viewModel.dataBean.rangeSecond}"
                                    android:textColor="@color/text_normal"
                                    android:textColorHint="@color/text_gray_l"
                                    android:textSize="14sp" />

                            </LinearLayout>

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

                            <LinearLayout
                                android:layout_width="0dp"
                                android:layout_height="match_parent"
                                android:layout_marginLeft="10dp"
                                android:layout_weight="1"
                                android:background="@drawable/bg_data_layout"
                                android:gravity="center_vertical">

                                <EditText
                                    android:layout_width="0dp"
                                    android:layout_height="match_parent"
                                    android:layout_weight="1"
                                    android:background="@null"
                                    android:maxLength="3"
                                    android:paddingStart="10dp"
                                    android:text="@={viewModel.dataBean.dest2}"
                                    android:textColor="@color/text_normal"
                                    android:textColorHint="@color/text_gray"
                                    android:textSize="14sp" />

                            </LinearLayout>

                            <TextView
                                android:id="@+id/tv_m"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_marginLeft="5dp"
                                android:text="*"
                                android:textColor="@color/red"
                                android:textSize="16sp" />

                        </LinearLayout>

                    </FrameLayout>


                    <com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayout
                        enable="@{viewModel.pageType != DetailsPageType.Details}"
                        required="@{viewModel.pageType != DetailsPageType.Details}"
                        title='@{"体积："}'
                        titleLength="@{5}"
                        type="@{DataLayoutType.INPUT}"
                        value="@={viewModel.dataBean.volume}"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />

                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_margin="10dp">

                    <com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayout
                        enable="@{viewModel.pageType != DetailsPageType.Details}"
                        list="@{viewModel.wxDescList}"
                        title='@{"危险品描述："}'
                        titleLength="@{6}"
                        type="@{DataLayoutType.SPINNER}"
                        value="@={viewModel.dataBean.dgrDetail}"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />


                    <com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayout
                        enable="@{viewModel.pageType != DetailsPageType.Details}"
                        list="@{viewModel.packageTypeList}"
                        title='@{"包装类型："}'
                        titleLength="@{6}"
                        type="@{DataLayoutType.SPINNER}"
                        value="@={viewModel.dataBean.packageType}"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />


                    <com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayout
                        enable="@{viewModel.pageType != DetailsPageType.Details}"
                        title='@{"品名："}'
                        titleLength="@{5}"
                        type="@{DataLayoutType.INPUT}"
                        value="@={viewModel.dataBean.goods}"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />


                </LinearLayout>

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_margin="10dp">

                    <com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayout
                        enable="@{viewModel.pageType != DetailsPageType.Details}"
                        list="@{viewModel.wxKuList}"
                        title='@{"危险品库："}'
                        titleLength="@{6}"
                        type="@{DataLayoutType.SPINNER}"
                        value="@={viewModel.dataBean.dgrLocation}"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />

                    <com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayout
                        enable="@{viewModel.pageType != DetailsPageType.Details}"
                        title='@{"备注："}'
                        titleLength="@{6}"
                        type="@{DataLayoutType.INPUT}"
                        value="@={viewModel.dataBean.remark}"
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1" />
                    <TextView
                        android:layout_width="0dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"/>
                </LinearLayout>

            </LinearLayout>

        </androidx.core.widget.NestedScrollView>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="20dp"
            android:gravity="center">

            <!--<CheckBox
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:checked="@={viewModel.print}"
                android:text="打印挂签" />-->

            <TextView
                style="@style/tv_bottom_btn"
                android:layout_marginLeft="30dp"
                android:onClick="@{()-> viewModel.verifyClick()}"
                android:text="校验" />

            <TextView
                style="@style/tv_bottom_btn"
                android:layout_marginLeft="30dp"
                android:onClick="@{()-> viewModel.printClick()}"
                android:text="打印挂签" />

            <TextView
                style="@style/tv_bottom_btn"
                android:layout_marginLeft="30dp"
                android:onClick="@{()-> viewModel.apartClick()}"
                android:text="分斗" />

            <TextView
                style="@style/tv_bottom_btn"
                android:layout_marginLeft="30dp"
                android:onClick="@{()-> viewModel.confirmClick()}"
                android:text="完成收运" />

        </LinearLayout>

    </LinearLayout>
</layout>