<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/background_grey">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <LinearLayout
            android:id="@+id/header"
            android:layout_width="match_parent"
            android:layout_height="56dp"
            android:background="@color/primary_dark"
            android:gravity="center_vertical"
            android:paddingStart="16dp"
            android:paddingEnd="16dp">

            <ImageButton
                android:id="@+id/btnHamburger"
                android:layout_width="48dp"
                android:layout_height="48dp"
                android:src="@drawable/baseline_menu_36"
                android:background="?attr/selectableItemBackgroundBorderless"
                android:contentDescription="Open menu"/>

            <TextView
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:text="Sales"
                android:textColor="@color/white"
                android:textSize="20sp"
                android:textStyle="bold"
                android:layout_marginStart="8dp"/>

            <ImageButton
                android:id="@+id/btnToggleFilter"
                android:layout_width="48dp"
                android:layout_height="48dp"
                android:src="@android:drawable/ic_menu_search"
                android:background="?attr/selectableItemBackgroundBorderless"
                app:tint="@color/white"
                android:contentDescription="Toggle filter"/>

        </LinearLayout>

        <LinearLayout
            android:id="@+id/layoutFilter"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:paddingStart="12dp"
            android:paddingEnd="12dp"
            android:paddingTop="10dp"
            android:paddingBottom="10dp"
            android:visibility="gone"
            android:background="@color/primary_dark"
            android:elevation="4dp">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="44dp"
                android:background="@drawable/bg_search_bar"
                android:gravity="center_vertical"
                android:paddingStart="12dp"
                android:paddingEnd="12dp">

                <ImageView
                    android:layout_width="18dp"
                    android:layout_height="18dp"
                    android:src="@android:drawable/ic_menu_search"
                    android:alpha="0.6"/>

                <EditText
                    android:id="@+id/etSearchSale"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:hint="Search by employee or store..."
                    android:inputType="text"
                    android:background="@android:color/transparent"
                    android:textColor="@color/text_dark"
                    android:textColorHint="#99000000"
                    android:textSize="14sp"
                    android:paddingStart="8dp"
                    android:paddingEnd="8dp"/>

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:layout_marginTop="8dp"
                android:gravity="center_vertical">

                <Spinner
                    android:id="@+id/spinnerStore"
                    android:layout_width="0dp"
                    android:layout_height="44dp"
                    android:layout_weight="1"
                    android:background="@drawable/bg_spinner"
                    android:paddingStart="12dp"
                    android:paddingEnd="8dp"
                    android:layout_marginEnd="4dp"/>

                <Spinner
                    android:id="@+id/spinnerPaymentMethod"
                    android:layout_width="0dp"
                    android:layout_height="44dp"
                    android:layout_weight="1"
                    android:background="@drawable/bg_spinner"
                    android:paddingStart="12dp"
                    android:paddingEnd="8dp"
                    android:layout_marginStart="4dp"/>
            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:layout_marginTop="8dp"
                android:gravity="center_vertical">

                <Spinner
                    android:id="@+id/spinnerRefundStatus"
                    android:layout_width="0dp"
                    android:layout_height="44dp"
                    android:layout_weight="1"
                    android:background="@drawable/bg_spinner"
                    android:paddingStart="12dp"
                    android:paddingEnd="8dp"
                    android:layout_marginEnd="4dp"/>

                <Button
                    android:id="@+id/btnOpenRefund"
                    android:layout_width="0dp"
                    android:layout_height="44dp"
                    android:layout_weight="1"
                    android:text="Process Refund"
                    android:backgroundTint="@color/accent_coral"
                    android:textColor="@color/white"
                    android:textSize="12sp"
                    android:insetTop="0dp"
                    android:insetBottom="0dp"
                    android:layout_marginStart="4dp"/>
            </LinearLayout>

        </LinearLayout>

        <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
            android:id="@+id/swipeRefreshSale"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/recyclerViewSales"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:padding="8dp"
                android:clipToPadding="false"/>

        </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

    </LinearLayout>

    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/fabAddSale"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="16dp"
        android:backgroundTint="@color/accent_coral"
        android:contentDescription="Add Sale"
        app:srcCompat="@android:drawable/ic_input_add"
        app:tint="@color/white"/>

</androidx.coordinatorlayout.widget.CoordinatorLayout>
