<?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:tools="http://schemas.android.com/tools">

    <data>

        <import type="com.gingersoft.gsa.delivery_pick_mode.model.viewModel.PageViewModel" />

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

    <androidx.coordinatorlayout.widget.CoordinatorLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:keepScreenOn="true"
        android:background="@color/color_f0"
        tools:context=".ui.activity.DeliveryOrderMainActivity">

        <com.google.android.material.appbar.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/color_f0"
            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/white"
                app:tabPaddingEnd="-1dp"
                app:tabPaddingStart="-1dp" />
            <!--item無法填滿左右時，加入下面這兩個-->
            <!--        app:tabPaddingStart="-1dp"-->
            <!--        app:tabPaddingEnd="-1dp"-->

            <LinearLayout
                android:id="@+id/cl_order_info"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="@dimen/dp_6"
                android:layout_marginTop="@dimen/dp_10"
                android:layout_marginRight="@dimen/dp_6"
                android:background="@drawable/shape_dialog_bg"
                android:focusable="true"
                android:focusableInTouchMode="true"
                android:orientation="vertical">

                <androidx.constraintlayout.widget.ConstraintLayout
                    android:id="@+id/layout_search_info"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:focusable="true"
                    android:focusableInTouchMode="true"
                    android:padding="@dimen/dp_10"
                    app:layout_constraintTop_toTopOf="parent">

                    <ProgressBar
                        android:id="@+id/sb_takeaway"
                        style="?android:attr/progressBarStyleHorizontal"
                        android:layout_width="0dp"
                        android:layout_height="@dimen/dp_5"
                        android:layout_marginRight="@dimen/dp_5"
                        android:progress="@{data.takeawayOrderNumber}"
                        android:progressDrawable="@drawable/shape_seekbar_bg"
                        app:layout_constraintCircleRadius="@dimen/dp_5"
                        app:layout_constraintLeft_toLeftOf="parent"
                        app:layout_constraintRight_toLeftOf="@id/dividing_line"
                        app:layout_constraintTop_toTopOf="parent"
                        app:qmui_background_color="@color/color_e4"
                        app:qmui_progress_color="@color/theme_color"
                        app:qmui_stroke_round_cap="true"
                        app:qmui_type="type_rect" />

                    <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_a9"
                        android:textSize="@dimen/dp_12"
                        app:layout_constraintRight_toLeftOf="@id/tv_month_takeaway_num"
                        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.takeawayOrderNumber + @string/slash + data.maxOrderTakeaway)}"
                        android:textColor="@color/color_a9"
                        android:textSize="@dimen/dp_12"
                        app:layout_constraintRight_toRightOf="@id/sb_takeaway"
                        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/color_cf"
                        app:layout_constraintBottom_toBottomOf="@id/sb_takeaway"
                        app:layout_constraintLeft_toLeftOf="parent"
                        app:layout_constraintRight_toRightOf="parent"
                        app:layout_constraintTop_toTopOf="@id/sb_takeaway" />

                    <ProgressBar
                        android:id="@+id/sb_self"
                        style="?android:attr/progressBarStyleHorizontal"
                        android:layout_width="0dp"
                        android:layout_height="@dimen/dp_5"
                        android:layout_marginLeft="@dimen/dp_5"
                        android:max="@{data.maxOrderSelf}"
                        android:progress="@{data.selfCollectionOrderNumber}"
                        android:progressDrawable="@drawable/shape_seekbar_bg"
                        app:layout_constraintCircleRadius="@dimen/dp_5"
                        app:layout_constraintLeft_toRightOf="@id/dividing_line"
                        app:layout_constraintRight_toRightOf="parent"
                        app:layout_constraintTop_toTopOf="parent"
                        app:qmui_background_color="@color/color_e4"
                        app:qmui_progress_color="@color/theme_color"
                        app:qmui_type="type_circle" />

                    <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_a9"
                        android:textSize="@dimen/dp_12"
                        app:layout_constraintRight_toLeftOf="@id/tv_month_self_num"
                        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.selfCollectionOrderNumber + @string/slash +data.maxOrderSelf)}"
                        android:textColor="@color/color_a9"
                        android:textSize="@dimen/dp_12"
                        app:layout_constraintRight_toRightOf="@id/sb_self"
                        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_35"
                        android:layout_marginTop="@dimen/dp_10"
                        android:layout_marginRight="@dimen/dp_10"
                        android:background="@drawable/shape_search_bg"
                        android:hint="請輸入手機號或訂單號"
                        android:inputType="number"
                        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/tv_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_10"
                        android:src="@drawable/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" />


                    <TextView
                        android:id="@+id/tv_restaurant_state"
                        style="@style/otherOrder_restaurant_state_style"
                        android:background="@drawable/shape_restaurant_state_bg"
                        android:text="營業中 "
                        app:layout_constraintBottom_toBottomOf="@id/ed_order_num_search"
                        app:layout_constraintRight_toLeftOf="@id/cb_takeaway_auto_receiving_orders"
                        app:layout_constraintTop_toTopOf="@id/ed_order_num_search" />

                    <ImageView
                        android:layout_width="@dimen/dp_10"
                        android:layout_height="@dimen/dp_5"
                        android:layout_centerVertical="true"
                        android:layout_marginRight="@dimen/dp_4"
                        android:src="@drawable/qmui_popup_arrow_down"
                        app:layout_constraintBottom_toBottomOf="@id/tv_restaurant_state"
                        app:layout_constraintRight_toRightOf="@id/tv_restaurant_state"
                        app:layout_constraintTop_toTopOf="@id/tv_restaurant_state" />

                    <androidx.appcompat.widget.AppCompatCheckBox
                        android:id="@+id/cb_takeaway_auto_receiving_orders"
                        style="@style/MyCheckbox_style"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layoutDirection="ltr"
                        android:text="自動接單"
                        android:textColor="@color/color_a9"
                        app:layout_constraintBottom_toBottomOf="@id/ed_order_num_search"
                        app:layout_constraintRight_toRightOf="parent"
                        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="@dimen/dp_40"-->
                    <!--                        android:textColor="@color/white"-->
                    <!--                        android:textSize="@dimen/dp_12"-->
                    <!--                        app:kswBackColor="@color/selector_switch_button"-->
                    <!--                        app:kswBackRadius="@dimen/dp_20"-->
                    <!--                        app:kswTextOff="@string/resting"-->
                    <!--                        app:kswTextOn="@string/open"-->
                    <!--                        app:kswThumbColor="@color/white"-->
                    <!--                        app:kswThumbMarginBottom="@dimen/dp_4"-->
                    <!--                        app:kswThumbMarginTop="@dimen/dp_4"-->
                    <!--                        app:layout_constraintBottom_toBottomOf="@id/ed_order_num_search"-->
                    <!--                        app:layout_constraintRight_toRightOf="parent"-->
                    <!--                        app:layout_constraintTop_toTopOf="@id/ed_order_num_search" />-->

                </androidx.constraintlayout.widget.ConstraintLayout>

                <TextView
                    android:id="@+id/tv_balance"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:padding="@dimen/dp_10"
                    android:text="餘額："
                    android:textColor="@color/theme_333_color"
                    android:textSize="@dimen/dp_16" />

                <androidx.constraintlayout.widget.ConstraintLayout
                    android:id="@+id/layout_today_order_info"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@color/white"
                    app:layout_constraintTop_toBottomOf="@id/layout_search_info">

                    <TextView
                        android:id="@+id/tv_today_order_num_text"
                        style="@style/otherOrderInfoDialogTextStyle_font_style_twelve"
                        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_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.sumOrderNumber)}"
                        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_details_info"
                        android:layout_width="0dp"
                        android:layout_height="@dimen/dp_0_5"
                        android:layout_marginTop="@dimen/dp_10"
                        android:background="@color/grey_400"
                        app:layout_constraintLeft_toLeftOf="parent"
                        app:layout_constraintRight_toRightOf="parent"
                        app:layout_constraintTop_toBottomOf="@id/tv_today_order_num" />


                    <View
                        android:id="@+id/line_today_order_info"
                        android:layout_width="@dimen/dp_0_5"
                        android:layout_height="0dp"
                        android:layout_marginTop="@dimen/dp_10"
                        android:background="@color/grey_400"
                        app:layout_constraintBottom_toBottomOf="@id/tv_takeaway_num"
                        app:layout_constraintLeft_toLeftOf="parent"
                        app:layout_constraintRight_toLeftOf="@id/line_today_info"
                        app:layout_constraintTop_toBottomOf="@id/line_details_info" />

                    <TextView
                        android:id="@+id/tv_takeaway_text"
                        style="@style/otherOrderInfoDialogTextStyle_font_style_twelve"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="外送"
                        app:layout_constraintLeft_toLeftOf="parent"
                        app:layout_constraintRight_toLeftOf="@id/line_today_order_info"
                        app:layout_constraintTop_toTopOf="@id/line_today_order_info" />

                    <TextView
                        android:id="@+id/tv_takeaway_num"
                        style="@style/otherOrderInfoDialogTextStyle_font_style_twelve"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginBottom="@dimen/dp_10"
                        android:text="@{String.valueOf(data.takeoutType.dayOrderNumber)}"
                        app:layout_constraintBottom_toBottomOf="parent"
                        app:layout_constraintLeft_toLeftOf="parent"
                        app:layout_constraintRight_toLeftOf="@id/line_today_order_info"
                        app:layout_constraintTop_toBottomOf="@id/tv_takeaway_text" />

                    <TextView
                        android:id="@+id/tv_self_text"
                        style="@style/otherOrderInfoDialogTextStyle_font_style_twelve"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="自取"
                        app:layout_constraintHorizontal_chainStyle="packed"
                        app:layout_constraintLeft_toRightOf="@id/line_today_order_info"
                        app:layout_constraintRight_toRightOf="@id/line_today_info"
                        app:layout_constraintTop_toTopOf="@id/line_today_order_info" />

                    <TextView
                        android:id="@+id/tv_today_self_order_num"
                        style="@style/otherOrderInfoDialogTextStyle_font_style_twelve"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@{String.valueOf(data.selfCollectionType.dayOrderNumber)}"
                        app:layout_constraintLeft_toRightOf="@id/line_today_order_info"
                        app:layout_constraintRight_toRightOf="@id/line_today_info"
                        app:layout_constraintTop_toBottomOf="@id/tv_self_text" />

                    <View
                        android:id="@+id/line_today_info"
                        android:layout_width="@dimen/dp_0_5"
                        android:layout_height="0dp"
                        android:background="@color/grey_400"
                        app:layout_constraintBottom_toBottomOf="parent"
                        app:layout_constraintLeft_toLeftOf="parent"
                        app:layout_constraintRight_toRightOf="parent"
                        app:layout_constraintTop_toTopOf="parent" />


                    <TextView
                        android:id="@+id/tv_today_amount_text"
                        style="@style/otherOrderInfoDialogTextStyle_font_style_twelve"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="今日營業總金額"
                        app:layout_constraintLeft_toRightOf="@id/line_today_info"
                        app:layout_constraintRight_toRightOf="parent"
                        app:layout_constraintTop_toTopOf="@id/tv_today_order_num_text" />

                    <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.sumTotalAmount}"
                        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_0_5"
                        android:layout_height="0dp"
                        android:layout_marginTop="@dimen/dp_10"
                        android:background="@color/grey_400"
                        app:layout_constraintBottom_toBottomOf="@id/tv_takeaway_amount"
                        app:layout_constraintLeft_toRightOf="@id/line_today_info"
                        app:layout_constraintRight_toRightOf="parent"
                        app:layout_constraintTop_toBottomOf="@id/line_details_info" />

                    <TextView
                        android:id="@+id/tv_takeaway_amount_text"
                        style="@style/otherOrderInfoDialogTextStyle_font_style_twelve"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="外送"
                        app:layout_constraintHorizontal_chainStyle="packed"
                        app:layout_constraintLeft_toRightOf="@id/line_today_info"
                        app:layout_constraintRight_toLeftOf="@id/line_today_amount_info"
                        app:layout_constraintTop_toTopOf="@id/line_today_amount_info" />

                    <TextView
                        android:id="@+id/tv_takeaway_amount"
                        style="@style/otherOrderInfoDialogTextStyle_font_style_twelve"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@{@string/amount_unit + data.takeoutType.totalAmount}"
                        app:layout_constraintLeft_toLeftOf="@id/tv_takeaway_amount_text"
                        app:layout_constraintRight_toRightOf="@id/tv_takeaway_amount_text"
                        app:layout_constraintTop_toBottomOf="@id/tv_takeaway_amount_text" />

                    <TextView
                        android:id="@+id/tv_self_amount_text"
                        style="@style/otherOrderInfoDialogTextStyle_font_style_twelve"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="自取"
                        app:layout_constraintHorizontal_chainStyle="packed"
                        app:layout_constraintLeft_toRightOf="@id/line_today_amount_info"
                        app:layout_constraintRight_toRightOf="parent"
                        app:layout_constraintTop_toTopOf="@id/line_today_amount_info" />

                    <TextView
                        android:id="@+id/tv_today_self_amount_num"
                        style="@style/otherOrderInfoDialogTextStyle_font_style_twelve"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@{@string/amount_unit + data.selfCollectionType.totalAmount}"
                        app:layout_constraintLeft_toLeftOf="@id/tv_self_amount_text"
                        app:layout_constraintRight_toRightOf="@id/tv_self_amount_text"
                        app:layout_constraintTop_toBottomOf="@id/tv_self_amount_text" />
                </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:layout_marginBottom="@dimen/dp_5"
                    android:background="@drawable/shape_white_bottom_border"
                    android:gravity="center"
                    android:text="點擊收起"
                    android:textColor="@color/color_a9"
                    android:textSize="@dimen/dp_12"
                    app:layout_constraintTop_toBottomOf="@id/layout_today_order_info" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/layout_order_type"
                android:layout_width="match_parent"
                android:layout_height="@dimen/button_height"
                android:layout_marginLeft="@dimen/dp_6"
                android:layout_marginTop="@dimen/dp_10"
                android:layout_marginRight="@dimen/dp_6"
                android:orientation="horizontal">

                <RelativeLayout
                    android:id="@+id/layout_immediate_order"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:background="@drawable/shape_left_themecolor_radius_btn"
                    android:orientation="horizontal">

                    <TextView
                        android:id="@+id/tv_immediate_order"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_centerInParent="true"
                        android:layout_gravity="center_horizontal"
                        android:text="即時單"
                        android:textColor="@color/white"
                        android:textSize="@dimen/dp_16" />

                    <TextView
                        android:id="@+id/tv_immediate_order_num"
                        android:layout_centerVertical="true"
                        android:layout_gravity="center_horizontal"
                        android:layout_marginLeft="@dimen/dp_5"
                        android:layout_toRightOf="@id/tv_immediate_order"
                        android:background="@drawable/ui_shape_red_oval"
                        android:layout_width="@dimen/dp_20"
                        android:layout_height="@dimen/dp_20"
                        android:gravity="center"
                        android:textColor="@color/white"
                        android:textSize="@dimen/dp_12" />

                </RelativeLayout>

                <RelativeLayout
                    android:id="@+id/layout_booking_order"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:background="@drawable/shape_right_white_radius_btn"
                    android:orientation="horizontal">

                    <TextView
                        android:id="@+id/tv_booking_order"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_centerInParent="true"
                        android:layout_gravity="center_horizontal"
                        android:text="預約單"
                        android:textColor="@color/theme_333_color"
                        android:textSize="@dimen/dp_16" />

                    <TextView
                        android:id="@+id/tv_booking_order_num"
                        android:layout_width="@dimen/dp_20"
                        android:layout_height="@dimen/dp_20"
                        android:layout_centerVertical="true"
                        android:layout_gravity="center_horizontal"
                        android:layout_marginLeft="@dimen/dp_5"
                        android:layout_toRightOf="@id/tv_booking_order"
                        android:background="@drawable/ui_shape_red_oval"
                        android:gravity="center"
                        android:textColor="@color/white"
                        android:textSize="@dimen/dp_12" />
                </RelativeLayout>
            </LinearLayout>

        </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>