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

    <data>

        <import type="com.gingersoft.gsa.cloud.common.utils.time.TimeUtils" />

        <variable
            name="data"
            type="com.gingersoft.gsa.delivery_pick_mode.data.model.bean.HistoryOrderBean.DataBean" />

        <variable
            name="orderingMethod"
            type="String" />

        <variable
            name="payMethod"
            type="String" />

        <variable
            name="orderingMethodBg"
            type="android.graphics.drawable.Drawable" />

        <variable
            name="payMethodBg"
            type="android.graphics.drawable.Drawable" />

    </data>

    <com.lihang.ShadowLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="@dimen/dp_7"
        android:layout_marginTop="@dimen/dp_7"
        android:layout_marginRight="@dimen/dp_7"
        app:hl_cornerRadius="@dimen/dp_8"
        app:hl_shadowLimit="@dimen/dp_3">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingLeft="@dimen/dp_10"
            android:paddingTop="@dimen/dp_5"
            android:paddingRight="@dimen/dp_10"
            android:paddingBottom="@dimen/dp_10">

            <TextView
                android:id="@+id/tv_payment_method"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@{payMethodBg}"
                android:paddingLeft="@dimen/dp_5"
                android:paddingTop="@dimen/dp_1"
                android:paddingRight="@dimen/dp_5"
                android:paddingBottom="@dimen/dp_1"
                android:text="@{payMethod}"
                android:textColor="@color/white"
                android:textSize="@dimen/sp_14"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toTopOf="parent" />

            <TextView
                android:id="@+id/tv_ordering_method"
                android:layout_width="@dimen/dp_20"
                android:layout_height="@dimen/dp_20"
                android:layout_marginLeft="@dimen/dp_8"
                android:background="@{orderingMethodBg}"
                android:gravity="center"
                android:text="@{orderingMethod}"
                android:textColor="@color/white"
                android:textSize="@dimen/sp_14"
                app:layout_constraintLeft_toRightOf="@id/tv_payment_method"
                app:layout_constraintTop_toTopOf="parent" />

            <TextView
                android:id="@+id/tv_order_user_name"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/dp_5"
                android:text="@{data.rECEIVER}"
                android:textColor="@color/theme_333_color"
                android:textSize="@dimen/sp_14"
                android:textStyle="bold"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintRight_toLeftOf="@id/tv_order_time"
                app:layout_constraintTop_toBottomOf="@id/tv_ordering_method" />

            <TextView
                android:id="@+id/tv_order_time"
                style="@style/otherOrder_item_create_time_textStyle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="@dimen/dp_5"
                android:text="@{TimeUtils.parseTimeRepeat(data.cREATE_TIME,TimeUtils.DEFAULT_DATE_FORMAT)}"
                app:layout_constraintRight_toRightOf="parent"
                app:layout_constraintTop_toTopOf="@id/tv_order_user_name" />

            <ImageView
                android:id="@+id/iv_end"
                android:layout_width="wrap_content"
                android:layout_height="0dp"
                android:src="@drawable/ic_has_end"
                app:layout_constraintBottom_toTopOf="@id/tv_order_amount"
                app:layout_constraintRight_toRightOf="parent"
                app:layout_constraintTop_toBottomOf="@id/tv_order_time" />


            <androidx.constraintlayout.widget.Barrier
                android:id="@+id/barrier_order_info"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                app:barrierDirection="right"
                app:constraint_referenced_ids="tv_address_text,tv_cellphone_num_text,tv_order_num_text" />

            <TextView
                android:id="@+id/tv_cellphone_num_text"
                style="@style/otherOrder_item_info_title_textStyle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/dp_5"
                android:text="手機號:"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toBottomOf="@id/tv_order_user_name" />

            <TextView
                android:id="@+id/tv_cellphone_num"
                style="@style/otherOrder_item_info_textStyle"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginLeft="@dimen/dp_5"
                android:text="@{data.PHONE}"
                app:layout_constraintLeft_toRightOf="@id/barrier_order_info"
                app:layout_constraintRight_toLeftOf="@id/iv_end"
                app:layout_constraintTop_toTopOf="@id/tv_cellphone_num_text" />

            <TextView
                android:id="@+id/tv_order_num_text"
                style="@style/otherOrder_item_info_title_textStyle"

                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="@dimen/dp_2"
                android:layout_marginTop="@dimen/dp_5"
                android:text="訂單號:"
                app:layout_constraintLeft_toLeftOf="@id/tv_cellphone_num_text"
                app:layout_constraintTop_toBottomOf="@id/tv_cellphone_num_text" />

            <TextView
                android:id="@+id/tv_order_num"
                style="@style/otherOrder_item_info_textStyle"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:text="@{data.ORDER_NO}"
                app:layout_constraintLeft_toLeftOf="@id/tv_cellphone_num"
                app:layout_constraintRight_toLeftOf="@id/iv_end"
                app:layout_constraintTop_toTopOf="@id/tv_order_num_text" />


            <TextView
                android:id="@+id/tv_address_text"
                style="@style/otherOrder_item_info_title_textStyle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="@dimen/dp_2"
                android:layout_marginTop="@dimen/dp_5"
                android:text="@{data.order_type==7?@string/meal_code:@string/address}"
                app:layout_constraintLeft_toLeftOf="parent"
                app:layout_constraintTop_toBottomOf="@id/tv_order_num_text" />

            <TextView
                android:id="@+id/tv_address"
                style="@style/otherOrder_item_info_textStyle"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:text="@{data.order_type==7?data.takeFoodCode:data.ADDRESS_DETAIL}"
                app:layout_constraintLeft_toLeftOf="@id/tv_cellphone_num"
                app:layout_constraintRight_toLeftOf="@id/iv_end"
                app:layout_constraintTop_toTopOf="@id/tv_address_text" />

            <TextView
                android:id="@+id/tv_order_amount"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@{@string/amount_unit + data.PAY_AMOUNT}"
                android:textColor="@color/red_600"
                android:textSize="@dimen/sp_14"
                app:layout_constraintBottom_toBottomOf="@id/tv_address"
                app:layout_constraintRight_toRightOf="parent"
                app:layout_constraintTop_toBottomOf="@id/tv_address" />
        </androidx.constraintlayout.widget.ConstraintLayout>
    </com.lihang.ShadowLayout>
</layout>