<?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.car.add.CarDetailsViewModel" />
    </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
                enable="@{viewModel.pageType != DetailsPageType.Details}"
                required="@{viewModel.pageType != DetailsPageType.Details}"
                title='@{"平板车号："}'
                titleLength="@{5}"
                type="@{DataLayoutType.INPUT}"
                value='@={viewModel.carBean.carId}'
                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.statusList}"
                required="@{viewModel.pageType != DetailsPageType.Details}"
                title='@{"状态："}'
                titleLength="@{5}"
                type="@{DataLayoutType.SPINNER}"
                value='@={viewModel.carBean.status}'
                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="@{3}"
                type="@{DataLayoutType.INPUT}"
                value='@={viewModel.carBean.carWeight}'
                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.carBean.signWeight}'
                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.carBean.maxWeight}'
                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.locationList}"
                title='@{"位置："}'
                titleLength="@{3}"
                type="@{DataLayoutType.SPINNER}"
                value='@={viewModel.carBean.position}'
                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.carBean.remark}'
                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="@color/color_bottom_layout"
            android:gravity="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>