<?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"
    xmlns:bind="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools">

    <data>

        <import type="com.gingersoft.gsa.other_order_mode.ui.main.PageViewModel" />

        <variable
            name="data"
            type="PageViewModel" />

        <variable
            name="switchBtn"
            type="com.gingersoft.gsa.cloud.ui.view.SwitchButton" />
    </data>

    <androidx.coordinatorlayout.widget.CoordinatorLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".OtherOrderActivity">

        <com.google.android.material.appbar.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:elevation="@dimen/dp_0">

            <com.qmuiteam.qmui.widget.QMUITopBar
                android:id="@+id/qm_other_order_bar"
                android:layout_width="match_parent"
                android:layout_height="@dimen/head_height"
                android:fitsSystemWindows="true"
                app:qmui_topbar_text_btn_color_state_list="@color/theme_white_color"
                app:qmui_topbar_title_color="@color/theme_white_color" />

            <com.google.android.material.tabs.TabLayout
                android:id="@+id/tabs"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/color_f0"
                app:tabPaddingEnd="-1dp"
                app:tabPaddingStart="-1dp" />
            <!--item無法填滿左右時，加入下面這兩個-->
            <!--        app:tabPaddingStart="-1dp"-->
            <!--        app:tabPaddingEnd="-1dp"-->

            <androidx.constraintlayout.widget.ConstraintLayout
                android:id="@+id/cl_order_info"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/white"
                android:paddingLeft="@dimen/dp_10"
                android:paddingTop="@dimen/dp_2"
                android:paddingRight="@dimen/dp_10"
                android:paddingBottom="@dimen/dp_10">

                <com.qmuiteam.qmui.widget.QMUIProgressBar
                    android:id="@+id/sb_takeaway"
                    android:layout_width="0dp"
                    android:layout_height="@dimen/dp_8"
                    android:layout_marginRight="@dimen/dp_5"
                    app:layout_constraintLeft_toLeftOf="parent"
                    app:layout_constraintRight_toLeftOf="@id/dividing_line"
                    app:layout_constraintTop_toTopOf="parent"
                    app:qmui_background_color="#E4E4E4"
                    app:qmui_progress_color="#FFCC33" />

                <TextView
                    android:id="@+id/tv_month_takeaway_num_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/dp_5"
                    android:text="本月外賣訂單數："
                    android:textColor="@color/color_ccc"
                    android:textSize="@dimen/dp_12"
                    app:layout_constraintLeft_toLeftOf="parent"
                    app:layout_constraintTop_toBottomOf="@id/sb_takeaway" />

                <TextView
                    android:id="@+id/tv_month_takeaway_num"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@{String.valueOf(data.otherInfo.num + @string/slash + data.otherInfo.maxOrder)}"
                    android:textColor="@color/color_ccc"
                    android:textSize="@dimen/dp_12"
                    app:layout_constraintLeft_toRightOf="@id/tv_month_takeaway_num_text"
                    app:layout_constraintTop_toTopOf="@id/tv_month_takeaway_num_text" />


                <View
                    android:id="@+id/dividing_line"
                    android:layout_width="@dimen/dp_1"
                    android:layout_height="0dp"
                    android:background="@color/theme_333_color"
                    app:layout_constraintBottom_toBottomOf="@id/sb_takeaway"
                    app:layout_constraintLeft_toLeftOf="parent"
                    app:layout_constraintRight_toRightOf="parent"
                    app:layout_constraintTop_toTopOf="@id/sb_takeaway" />

                <com.qmuiteam.qmui.widget.QMUIProgressBar
                    android:id="@+id/sb_self"
                    android:layout_width="0dp"
                    android:layout_height="@dimen/dp_8"
                    android:layout_marginLeft="@dimen/dp_5"
                    android:background="@drawable/shape_seekbar_bg"
                    app:layout_constraintLeft_toRightOf="@id/dividing_line"
                    app:layout_constraintRight_toRightOf="parent"
                    app:layout_constraintTop_toTopOf="parent"
                    app:qmui_background_color="#E4E4E4"
                    app:qmui_progress_color="#FFCC33" />

                <TextView
                    android:id="@+id/tv_month_self_num_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/dp_5"
                    android:text="本月自取訂單數："
                    android:textColor="@color/color_ccc"
                    android:textSize="@dimen/dp_12"
                    app:layout_constraintLeft_toLeftOf="@id/sb_self"
                    app:layout_constraintTop_toBottomOf="@id/sb_self" />

                <TextView
                    android:id="@+id/tv_month_self_num"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@{String.valueOf(data.otherInfo.selflNum + @string/slash +data.otherInfo.maxOrderSelf)}"
                    android:textColor="@color/color_ccc"
                    android:textSize="@dimen/dp_12"
                    app:layout_constraintLeft_toRightOf="@id/tv_month_self_num_text"
                    app:layout_constraintTop_toTopOf="@id/tv_month_self_num_text" />

                <EditText
                    android:id="@+id/ed_order_num_search"
                    android:layout_width="0dp"
                    android:layout_height="@dimen/dp_40"
                    android:layout_marginTop="@dimen/dp_10"
                    android:layout_marginRight="@dimen/dp_10"
                    android:background="@drawable/shape_search_bg"
                    android:hint="請輸入手機號或訂單號"
                    android:paddingLeft="@dimen/dp_10"
                    android:paddingRight="@dimen/dp_50"
                    android:textColor="@color/theme_333_color"
                    android:textColorHint="@color/color_ccc"
                    android:textSize="@dimen/dp_14"
                    app:layout_constraintLeft_toLeftOf="parent"
                    app:layout_constraintRight_toLeftOf="@id/btn_switch_restaurant_state"
                    app:layout_constraintTop_toBottomOf="@id/tv_month_takeaway_num_text" />

                <ImageView
                    android:id="@+id/iv_search_order"
                    android:layout_width="@dimen/dp_50"
                    android:layout_height="0dp"
                    android:padding="@dimen/dp_11"
                    android:src="@mipmap/ic_search"
                    app:layout_constraintBottom_toBottomOf="@id/ed_order_num_search"
                    app:layout_constraintRight_toRightOf="@id/ed_order_num_search"
                    app:layout_constraintTop_toTopOf="@id/ed_order_num_search" />


                <com.gingersoft.gsa.cloud.ui.view.SwitchButton
                    android:id="@+id/btn_switch_restaurant_state"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textColor="@color/white"
                    android:textSize="@dimen/dp_16"
                    app:elevation="0dp"
                    app:layout_constraintBottom_toBottomOf="@id/ed_order_num_search"
                    app:layout_constraintRight_toRightOf="parent"
                    app:layout_constraintTop_toTopOf="@id/ed_order_num_search"
                    app:switcherBtn_height="@dimen/dp_30"
                    app:switcherBtn_width="@dimen/dp_72"
                    bind:OnCheckChangedListener="@{(state)-> data.setRestaurantState(state)}" />

                <TextView
                    android:id="@+id/tv_restaurant_state"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textColor="@color/white"
                    android:textSize="@dimen/dp_12"
                    app:layout_constraintBottom_toBottomOf="@id/btn_switch_restaurant_state"
                    app:layout_constraintLeft_toLeftOf="@id/btn_switch_restaurant_state"
                    app:layout_constraintRight_toRightOf="@id/btn_switch_restaurant_state"
                    app:layout_constraintTop_toTopOf="@id/btn_switch_restaurant_state" />

                <androidx.constraintlayout.widget.ConstraintLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/dp_10"
                    android:background="@drawable/shape_ccc_border"
                    android:padding="@dimen/dp_10"
                    app:layout_constraintTop_toBottomOf="@id/ed_order_num_search">

                    <TextView
                        android:id="@+id/tv_today_order_num_text"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="今日總訂單數"
                        android:textColor="@color/theme_333_color"
                        android:textSize="@dimen/dp_16"
                        android:textStyle="bold"
                        app:layout_constraintLeft_toLeftOf="parent"
                        app:layout_constraintRight_toLeftOf="@id/line_today_info"
                        app:layout_constraintTop_toTopOf="parent" />

                    <TextView
                        android:id="@+id/tv_today_order_num"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="@dimen/dp_5"
                        android:text="@{String.valueOf(data.otherInfo.dayOrderNum)}"
                        android:textColor="@color/theme_333_color"
                        android:textSize="@dimen/dp_16"
                        android:textStyle="bold"
                        app:layout_constraintLeft_toLeftOf="parent"
                        app:layout_constraintRight_toLeftOf="@id/line_today_info"
                        app:layout_constraintTop_toBottomOf="@id/tv_today_order_num_text" />

                    <View
                        android:id="@+id/line_today_order_info"
                        android:layout_width="@dimen/dp_1"
                        android:layout_height="0dp"
                        android:layout_marginTop="@dimen/dp_5"
                        android:background="@color/theme_333_color"
                        app:layout_constraintBottom_toBottomOf="parent"
                        app:layout_constraintLeft_toLeftOf="parent"
                        app:layout_constraintRight_toLeftOf="@id/line_today_info"
                        app:layout_constraintTop_toBottomOf="@id/tv_today_order_num" />

                    <TextView
                        android:id="@+id/tv_takeaway_text"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="外賣："
                        android:textColor="@color/theme_333_color"
                        android:textSize="@dimen/dp_14"
                        app:layout_constraintHorizontal_chainStyle="packed"
                        app:layout_constraintLeft_toLeftOf="parent"
                        app:layout_constraintRight_toLeftOf="@id/tv_takeaway_num"
                        app:layout_constraintTop_toTopOf="@id/line_today_order_info" />

                    <TextView
                        android:id="@+id/tv_takeaway_num"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text=""
                        android:textColor="@color/theme_333_color"
                        android:textSize="@dimen/dp_14"
                        app:layout_constraintLeft_toRightOf="@id/tv_takeaway_text"
                        app:layout_constraintRight_toLeftOf="@id/line_today_order_info"
                        app:layout_constraintTop_toTopOf="@id/line_today_order_info" />

                    <TextView
                        android:id="@+id/tv_self_text"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="自取："
                        android:textColor="@color/theme_333_color"
                        android:textSize="@dimen/dp_14"
                        app:layout_constraintHorizontal_chainStyle="packed"
                        app:layout_constraintLeft_toRightOf="@id/line_today_order_info"
                        app:layout_constraintRight_toLeftOf="@id/tv_today_self_order_num"
                        app:layout_constraintTop_toTopOf="@id/line_today_order_info" />

                    <TextView
                        android:id="@+id/tv_today_self_order_num"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text=""
                        android:textColor="@color/theme_333_color"
                        android:textSize="@dimen/dp_14"
                        app:layout_constraintLeft_toRightOf="@id/tv_self_text"
                        app:layout_constraintRight_toLeftOf="@id/line_today_info"
                        app:layout_constraintTop_toTopOf="@id/line_today_order_info" />

                    <View
                        android:id="@+id/line_today_info"
                        android:layout_width="@dimen/dp_1"
                        android:layout_height="0dp"
                        android:background="@color/color_ccc"
                        app:layout_constraintBottom_toTopOf="@id/line_today_order_info"
                        app:layout_constraintLeft_toLeftOf="parent"
                        app:layout_constraintRight_toRightOf="parent"
                        app:layout_constraintTop_toTopOf="parent" />

                    <TextView
                        android:id="@+id/tv_today_amount_text"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="今日營業總金額"
                        android:textColor="@color/theme_333_color"
                        android:textSize="@dimen/dp_16"
                        android:textStyle="bold"
                        app:layout_constraintLeft_toRightOf="@id/line_today_info"
                        app:layout_constraintRight_toRightOf="parent"
                        app:layout_constraintTop_toTopOf="parent" />

                    <TextView
                        android:id="@+id/tv_today_amount"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="@dimen/dp_5"
                        android:text="@{@string/amount_unit + data.otherInfo.totalAmount}"
                        android:textColor="@color/theme_333_color"
                        android:textSize="@dimen/dp_16"
                        android:textStyle="bold"
                        app:layout_constraintLeft_toRightOf="@id/line_today_info"
                        app:layout_constraintRight_toRightOf="parent"
                        app:layout_constraintTop_toBottomOf="@id/tv_today_amount_text" />


                    <View
                        android:id="@+id/line_today_amount_info"
                        android:layout_width="@dimen/dp_1"
                        android:layout_height="0dp"
                        android:layout_marginTop="@dimen/dp_5"
                        android:background="@color/theme_333_color"
                        app:layout_constraintBottom_toBottomOf="parent"
                        app:layout_constraintLeft_toRightOf="@id/line_today_info"
                        app:layout_constraintRight_toRightOf="parent"
                        app:layout_constraintTop_toBottomOf="@id/tv_today_amount" />

                    <TextView
                        android:id="@+id/tv_takeaway_amount_text"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="外賣："
                        android:textColor="@color/theme_333_color"
                        android:textSize="@dimen/dp_14"
                        app:layout_constraintHorizontal_chainStyle="packed"
                        app:layout_constraintLeft_toRightOf="@id/line_today_info"
                        app:layout_constraintRight_toLeftOf="@id/tv_takeaway_amount"
                        app:layout_constraintTop_toTopOf="@id/line_today_amount_info" />

                    <TextView
                        android:id="@+id/tv_takeaway_amount"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text=""
                        android:textColor="@color/theme_333_color"
                        android:textSize="@dimen/dp_14"
                        app:layout_constraintLeft_toRightOf="@id/tv_takeaway_amount_text"
                        app:layout_constraintRight_toLeftOf="@id/line_today_amount_info"
                        app:layout_constraintTop_toTopOf="@id/line_today_amount_info" />

                    <TextView
                        android:id="@+id/tv_self_amount_text"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="自取："
                        android:textColor="@color/theme_333_color"
                        android:textSize="@dimen/dp_14"
                        app:layout_constraintHorizontal_chainStyle="packed"
                        app:layout_constraintLeft_toRightOf="@id/line_today_amount_info"
                        app:layout_constraintRight_toLeftOf="@id/tv_today_self_amount_num"
                        app:layout_constraintTop_toTopOf="@id/line_today_amount_info" />

                    <TextView
                        android:id="@+id/tv_today_self_amount_num"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text=""
                        android:textColor="@color/theme_333_color"
                        android:textSize="@dimen/dp_14"
                        app:layout_constraintLeft_toRightOf="@id/tv_self_amount_text"
                        app:layout_constraintRight_toRightOf="parent"
                        app:layout_constraintTop_toTopOf="@id/line_today_amount_info" />
                </androidx.constraintlayout.widget.ConstraintLayout>


            </androidx.constraintlayout.widget.ConstraintLayout>

            <Button
                android:id="@+id/btn_open_or_close_info"
                android:layout_width="match_parent"
                android:layout_height="@dimen/dp_30"
                android:background="@color/color_e4"
                android:gravity="center"
                android:text="點擊收起"
                android:textColor="@color/white"
                android:textSize="@dimen/dp_14" />

        </com.google.android.material.appbar.AppBarLayout>

        <androidx.viewpager.widget.ViewPager
            android:id="@+id/view_pager"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_behavior="@string/appbar_scrolling_view_behavior" />

    </androidx.coordinatorlayout.widget.CoordinatorLayout>
</layout>