<?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.base.utils.time.TimeUtils" />

        <import type="com.gingersoft.gsa.cloud.base.utils.MoneyUtil" />

        <import type="android.view.View" />

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

    </data>
    <!--    OrderList.DataBeanX.DataBean-->
    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/shape_dialog_bg"
        android:orientation="vertical"
        android:padding="@dimen/dp_10">

        <TextView
            android:id="@+id/tv_order_name"
            style="@style/otherOrderInfoDialogBoldTextStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="H5訂單"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            style="@style/otherOrderInfoDialogBoldTextStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/dp_10"
            android:text="訂單號："
            app:layout_constraintHorizontal_bias="1"
            app:layout_constraintLeft_toRightOf="@id/tv_order_name"
            app:layout_constraintRight_toLeftOf="@id/tv_order_num"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/tv_order_num"
            style="@style/otherOrderInfoDialogTextStyle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@{data.oRDER_NO}"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <View
            android:id="@+id/line_info_top"
            android:layout_width="match_parent"
            android:layout_height="@dimen/dp_1"
            android:layout_marginTop="@dimen/dp_5"
            android:background="@color/color_ccc"
            app:layout_constraintTop_toBottomOf="@id/tv_order_num" />

        <androidx.core.widget.NestedScrollView
            android:id="@+id/scroll_order_info"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:fillViewport="true"
            app:layout_constraintBottom_toTopOf="@id/btn_assign_shipping"
            app:layout_constraintTop_toBottomOf="@id/line_info_top">

            <androidx.constraintlayout.widget.ConstraintLayout
                android:id="@+id/cl_order_info"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/dp_10"
                android:orientation="vertical"
                android:paddingBottom="@dimen/dp_10">

                <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_create_time_text,tv_receiver_text,tv_receive_phone_text,tv_receive_time_text,tv_receive_address_text,tv_receive_address_text" />

                <TextView
                    android:id="@+id/tv_create_time_text"
                    style="@style/otherOrderInfoDialogBoldTextStyle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/dp_10"
                    android:text="下單時間："
                    app:layout_constraintLeft_toLeftOf="parent"
                    app:layout_constraintTop_toTopOf="parent" />

                <TextView
                    android:id="@+id/tv_create_time"
                    style="@style/otherOrderInfoDialogTextStyle"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:text="@{TimeUtils.parseTimeRepeat(data.cREATE_TIME,TimeUtils.DEFAULT_DATE_FORMAT)}"
                    app:layout_constraintLeft_toRightOf="@id/tv_create_time_text"
                    app:layout_constraintRight_toRightOf="parent"
                    app:layout_constraintTop_toTopOf="@id/tv_create_time_text" />


                <TextView
                    android:id="@+id/tv_receiver_text"
                    style="@style/otherOrderInfoDialogBoldTextStyle"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/dp_5"
                    android:gravity="right"
                    android:text="收貨人："
                    app:layout_constraintLeft_toLeftOf="parent"
                    app:layout_constraintRight_toLeftOf="@id/barrier_order_info"
                    app:layout_constraintTop_toBottomOf="@id/tv_create_time" />

                <TextView
                    android:id="@+id/tv_receiver"
                    style="@style/otherOrderInfoDialogTextStyle"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:text="@{data.rECEIVER}"
                    app:layout_constraintLeft_toRightOf="@id/barrier_order_info"
                    app:layout_constraintRight_toRightOf="parent"
                    app:layout_constraintTop_toTopOf="@id/tv_receiver_text" />


                <TextView
                    android:id="@+id/tv_receive_phone_text"
                    style="@style/otherOrderInfoDialogBoldTextStyle"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/dp_10"
                    android:text="收貨電話："
                    app:layout_constraintLeft_toLeftOf="parent"
                    app:layout_constraintRight_toLeftOf="@id/barrier_order_info"
                    app:layout_constraintTop_toBottomOf="@id/tv_receiver" />

                <TextView
                    android:id="@+id/tv_receive_phone"
                    style="@style/otherOrderInfoDialogTextStyle"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:text="@{data.pHONE}"
                    app:layout_constraintLeft_toRightOf="@id/barrier_order_info"
                    app:layout_constraintRight_toRightOf="parent"
                    app:layout_constraintTop_toTopOf="@id/tv_receive_phone_text" />


                <TextView
                    android:id="@+id/tv_receive_time_text"
                    style="@style/otherOrderInfoDialogBoldTextStyle"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/dp_10"
                    android:gravity="right"
                    android:text="收貨時間："
                    app:layout_constraintLeft_toLeftOf="parent"
                    app:layout_constraintRight_toLeftOf="@id/barrier_order_info"
                    app:layout_constraintTop_toBottomOf="@id/tv_receive_phone" />

                <TextView
                    android:id="@+id/tv_receive_time"
                    style="@style/otherOrderInfoDialogTextStyle"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:text="@{data.sEND_TIME}"
                    app:layout_constraintLeft_toRightOf="@id/barrier_order_info"
                    app:layout_constraintRight_toRightOf="parent"
                    app:layout_constraintTop_toTopOf="@id/tv_receive_time_text" />

                <TextView
                    android:id="@+id/tv_receive_address_text"
                    style="@style/otherOrderInfoDialogBoldTextStyle"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/dp_10"
                    android:gravity="right"
                    android:text="收貨地址："
                    app:layout_constraintLeft_toLeftOf="parent"
                    app:layout_constraintRight_toLeftOf="@id/barrier_order_info"
                    app:layout_constraintTop_toBottomOf="@id/tv_receive_time" />

                <TextView
                    android:id="@+id/tv_receive_address"
                    style="@style/otherOrderInfoDialogTextStyle"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:text="@{data.addressDetail}"
                    app:layout_constraintLeft_toRightOf="@id/barrier_order_info"
                    app:layout_constraintRight_toRightOf="parent"
                    app:layout_constraintTop_toTopOf="@id/tv_receive_address_text" />

                <View
                    android:id="@+id/line_info_bottom"
                    android:layout_width="match_parent"
                    android:layout_height="@dimen/dp_1"
                    android:layout_marginTop="@dimen/dp_5"
                    android:background="@color/color_ccc"
                    app:layout_constraintTop_toBottomOf="@id/tv_receive_address" />

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/rv_food"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    app:layout_constraintTop_toBottomOf="@id/line_info_bottom" />


                <View
                    android:id="@+id/line_food_bottom"
                    android:layout_width="match_parent"
                    android:layout_height="@dimen/dp_1"
                    android:layout_marginTop="@dimen/dp_5"
                    android:background="@color/color_ccc"
                    app:layout_constraintTop_toBottomOf="@id/rv_food" />


                <TextView
                    android:id="@+id/tv_total_text"
                    style="@style/otherOrderInfoDialogBoldTextStyle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/dp_10"
                    android:text="合計"
                    app:layout_constraintLeft_toLeftOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/line_food_bottom" />

                <TextView
                    android:id="@+id/tv_total"
                    style="@style/otherOrderInfoDialogBoldTextStyle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@{@string/amount_unit + MoneyUtil.sub(MoneyUtil.sub(Double.parseDouble(data.tOTAL_AMOUNT), data.lunchbox),data.dELIVERY_CHARGE)}"
                    app:layout_constraintRight_toRightOf="parent"
                    app:layout_constraintTop_toTopOf="@id/tv_total_text" />


                <TextView
                    android:id="@+id/tv_lunchbox_cost_text"
                    style="@style/otherOrderInfoDialogBoldTextStyle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/dp_10"
                    android:text="餐盒費"
                    android:visibility="@{data.lunchbox==0?View.GONE:View.VISIBLE}"
                    app:layout_constraintLeft_toLeftOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/tv_total" />

                <TextView
                    android:id="@+id/tv_lunchbox_cost"
                    style="@style/otherOrderInfoDialogBoldTextStyle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@{@string/amount_unit + data.lunchbox}"
                    android:visibility="@{data.lunchbox==0?View.GONE:View.VISIBLE}"
                    app:layout_constraintRight_toRightOf="parent"
                    app:layout_constraintTop_toTopOf="@id/tv_lunchbox_cost_text" />


                <TextView
                    android:id="@+id/tv_delivery_fee_text"
                    style="@style/otherOrderInfoDialogBoldTextStyle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/dp_10"
                    android:text="配送費"
                    android:visibility="@{data.dELIVERY_CHARGE==0?View.GONE:View.VISIBLE}"
                    app:layout_constraintLeft_toLeftOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/tv_lunchbox_cost" />

                <TextView
                    android:id="@+id/tv_delivery_fee"
                    style="@style/otherOrderInfoDialogBoldTextStyle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@{@string/amount_unit + data.dELIVERY_CHARGE}"
                    android:visibility="@{data.dELIVERY_CHARGE==0?View.GONE:View.VISIBLE}"
                    app:layout_constraintRight_toRightOf="parent"
                    app:layout_constraintTop_toTopOf="@id/tv_delivery_fee_text" />


                <TextView
                    android:id="@+id/tv_discount_text"
                    style="@style/otherOrderInfoDialogBoldTextStyle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/dp_10"
                    android:text="折扣"
                    android:visibility="@{data.discount_amount==0?View.GONE:View.VISIBLE}"
                    app:layout_constraintLeft_toLeftOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/tv_delivery_fee" />

                <TextView
                    android:id="@+id/tv_discount"
                    style="@style/otherOrderInfoDialogBoldTextStyle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@{@string/amount_unit + data.discount_amount}"
                    android:visibility="@{data.discount_amount==0?View.GONE:View.VISIBLE}"
                    app:layout_constraintRight_toRightOf="parent"
                    app:layout_constraintTop_toTopOf="@id/tv_discount_text" />


                <TextView
                    android:id="@+id/tv_total_amount_text"
                    style="@style/otherOrderInfoDialogBoldTextStyle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/dp_10"
                    android:text="總金額"
                    app:layout_constraintLeft_toLeftOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/tv_discount" />

                <TextView
                    android:id="@+id/tv_total_amount"
                    style="@style/otherOrderInfoDialogBoldTextStyle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@{@string/amount_unit + data.tOTAL_AMOUNT}"
                    app:layout_constraintRight_toRightOf="parent"
                    app:layout_constraintTop_toTopOf="@id/tv_total_amount_text" />


                <TextView
                    android:id="@+id/tv_pay_amount_text"
                    style="@style/otherOrderInfoDialogBoldTextStyle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/dp_10"
                    android:text="支付金額"
                    app:layout_constraintLeft_toLeftOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/tv_total_amount_text" />

                <TextView
                    android:id="@+id/tv_pay_amount"
                    style="@style/otherOrderInfoDialogBoldTextStyle"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@{@string/amount_unit + MoneyUtil.sub(data.pAY_AMOUNT, data.discount_amount)}"
                    android:textColor="#FF0000"
                    app:layout_constraintRight_toRightOf="parent"
                    app:layout_constraintTop_toTopOf="@id/tv_pay_amount_text" />
            </androidx.constraintlayout.widget.ConstraintLayout>
        </androidx.core.widget.NestedScrollView>

        <Button
            android:id="@+id/btn_assign_shipping"
            android:layout_width="match_parent"
            android:layout_height="@dimen/dp_40"
            android:background="@color/theme_color"
            android:text="指派送貨"
            android:textColor="@color/white"
            android:textSize="@dimen/dp_14"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintTop_toBottomOf="@id/scroll_order_info"
            app:layout_constraintVertical_bias="1" />

    </androidx.constraintlayout.widget.ConstraintLayout>
</layout>