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

    <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.aerologic.page.gnj.manifest.add.GnjManifestAddViewModel" />
    </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="wrap_content"
            android:layout_margin="10dp">

            <com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayout
                android:id="@+id/pdl_waybill"
                enable="@{viewModel.pageType != DetailsPageType.Details}"
                required="@{viewModel.pageType != DetailsPageType.Details}"
                title='@{"运单号："}'
                maxLength="@{11}"
                setRefreshCallBack="@{viewModel::waybillChanged}"
                titleLength="@{5}"
                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.agentList}"
                required="@{viewModel.pageType != DetailsPageType.Details}"
                title='@{"代理人："}'
                titleLength="@{5}"
                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}"
                hint='@{" "}'
                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" />

        </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}"
                required="@{viewModel.pageType != DetailsPageType.Details}"
                title='@{"运单件数："}'
                titleLength="@{5}"
                type="@{DataLayoutType.INPUT}"
                value='@={viewModel.dataBean.totalPc}'
                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" />

            <com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayout
                enable="@{viewModel.pageType != DetailsPageType.Details}"
                required="@{viewModel.pageType != DetailsPageType.Details}"
                title='@{"实到重量："}'
                titleLength="@{6}"
                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="@{viewModel.pageType != DetailsPageType.Details}"
                required="@{viewModel.pageType != DetailsPageType.Details}"
                title='@{"计费重量："}'
                titleLength="@{5}"
                type="@{DataLayoutType.INPUT}"
                value='@={viewModel.dataBean.cashWeight}'
                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}"
                maxLength="@{3}"
                required="@{viewModel.pageType != DetailsPageType.Details}"
                title='@{"始发港："}'
                titleLength="@{5}"
                setTextAllCaps="@{true}"
                type="@{DataLayoutType.INPUT}"
                value='@={viewModel.dataBean.origin}'
                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}"
                maxLength="@{3}"
                required="@{viewModel.pageType != DetailsPageType.Details}"
                title='@{"目的港："}'
                setTextAllCaps="@{true}"
                titleLength="@{6}"
                type="@{DataLayoutType.INPUT}"
                value='@={viewModel.dataBean.dest}'
                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.waybillTypeList}"
                title='@{"运单类型："}'
                titleLength="@{5}"
                type="@{DataLayoutType.SPINNER}"
                value='@={viewModel.dataBean.awbType}'
                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.businessTypeList}"
                title='@{"业务类型："}'
                titleLength="@{5}"
                type="@{DataLayoutType.SPINNER}"
                value='@={viewModel.dataBean.businessType}'
                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.wxKuList}"
                title='@{"危险品库位："}'
                titleLength="@{6}"
                type="@{DataLayoutType.SPINNER}"
                value='@={viewModel.dataBean.dgrLocation}'
                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}"
                required="@{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="2" />

            <com.lukouguoji.module_base.ui.weight.data.layout.PadDataLayout
                enable="@{viewModel.pageType != DetailsPageType.Details}"
                hint='@{" "}'
                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" />

        </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}"
                title='@{"备注："}'
                titleLength="@{5}"
                type="@{DataLayoutType.INPUT}"
                value='@={viewModel.dataBean.remark}'
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="2" />

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

        </LinearLayout>

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

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:background="#5c6890"
            android:gravity="center_vertical|end"
            android:paddingHorizontal="15dp">

            <TextView
                style="@style/tv_bottom_btn"
                visible="@{viewModel.pageType != DetailsPageType.Details}"
                android:onClick="@{()-> viewModel.onCancelClick()}"
                android:text="取消" />

            <TextView
                style="@style/tv_bottom_btn"
                visible="@{viewModel.pageType != DetailsPageType.Details}"
                android:onClick="@{()-> viewModel.onSaveClick()}"
                android:text="保存" />

        </LinearLayout>

    </LinearLayout>
</layout>