<?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>
        <variable
            name="productForm"
            type="com.yono.messeripos.models.ProductModels" />

        <variable
            name="photo"
            type="String" />
    </data>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true">

        <com.google.android.material.appbar.MaterialToolbar android:id="@+id/topAppBarForm"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:elevation="0dp"
            android:paddingTop="20dp"
            android:background="@color/colorPrimary"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            style="@style/Widget.MaterialComponents.Toolbar.Primary"
            xmlns:android="http://schemas.android.com/apk/res/android">

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

        <com.google.android.material.card.MaterialCardView
            android:id="@+id/cvProduct"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_margin="10dp"
            app:cardCornerRadius="80dp"
            app:layout_constraintTop_toBottomOf="@id/topAppBarForm"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintBottom_toTopOf="@id/tfName">

            <ImageView
                android:id="@+id/ivProduct"
                android:layout_width="160dp"
                android:layout_height="160dp"
                android:scaleType="centerCrop"
                app:path="@{photo}"
                android:src="@drawable/ic_meser_create" />

        </com.google.android.material.card.MaterialCardView>

        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/tfName"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:hint="@string/name"
            android:textColor="#fff"
            style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
            app:layout_constraintTop_toBottomOf="@+id/cvProduct"
            tools:ignore="MissingConstraints">

            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/etName"
                android:text="@{productForm.productName}"
                android:layout_width="match_parent"
                android:inputType="text"
                android:imeOptions="actionNext"
                android:layout_height="wrap_content" />

        </com.google.android.material.textfield.TextInputLayout>


        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/tfPrice"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:hint="@string/price"
            android:textColor="#fff"
            style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
            app:layout_constraintTop_toBottomOf="@id/tfName">

            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/etPrice"
                android:text="@{productForm.priceProduct+``}"
                android:layout_width="match_parent"
                android:inputType="number"
                android:imeOptions="actionNext"
                android:layout_height="wrap_content" />

        </com.google.android.material.textfield.TextInputLayout>

        <com.google.android.material.textfield.TextInputLayout
            android:id="@+id/tfStock"
            style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:hint="@string/stock"
            android:textColor="#fff"
            app:layout_constraintTop_toBottomOf="@id/tfPrice"
            tools:layout_editor_absoluteX="10dp">

            <com.google.android.material.textfield.TextInputEditText
                android:id="@+id/etStock"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@{productForm.stockProduct+``}"
                android:inputType="number"
                android:imeOptions="actionNext" />

        </com.google.android.material.textfield.TextInputLayout>

        <com.jaredrummler.materialspinner.MaterialSpinner
            android:id="@+id/listCategory"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:background="@drawable/stroke_spinner"
            app:layout_constraintTop_toBottomOf="@+id/tfStock"
            app:layout_constraintEnd_toStartOf="@id/btnAddCategory"
            app:ms_dropdown_height="wrap_content"
            app:ms_dropdown_max_height="350dp"
            app:layout_constraintStart_toStartOf="parent"
            app:ms_background_selector="0xFFFFFF"
            tools:layout_editor_absoluteX="0dp" />

        <com.google.android.material.button.MaterialButton
            android:id="@+id/btnAddCategory"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:foregroundGravity="bottom"
            android:text="@string/add"
            android:padding="14dp"
            android:backgroundTint="@color/colorAccent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="@id/listCategory"
            app:layout_constraintBottom_toBottomOf="@id/listCategory"
            tools:layout_editor_absoluteX="16dp" />

        <com.google.android.material.button.MaterialButton
            android:id="@+id/btnAdd"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:foregroundGravity="bottom"
            android:text="@string/add"
            android:padding="16dp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintVertical_bias="1.0"
            tools:ignore="MissingConstraints"
            tools:layout_editor_absoluteX="16dp" />


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