package in.techware.carrefour.activity.order;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

import in.techware.carrefour.R;
import in.techware.carrefour.util.AppConstants;

public class NewOrderActivity extends AppCompatActivity {

    EditText avgEditText;
    EditText qtyOrderedEditText;
    EditText qtyDeliverEditText;
    EditText ordDaysEditText;
    EditText asstCodeEditText;
    EditText incrementEditText;
    EditText itemStatusEditText;
    EditText minStockEditText;
    EditText stkQtyEditText;
    EditText itemDescEditText;
    EditText qtyEditText;
    EditText barcodeEditText;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_new_order);
        initViews();
        handleKeyboard();

    }

    private void initViews() {
        avgEditText = findViewById(R.id.etxt_avg_sales);
        qtyOrderedEditText = findViewById(R.id.etxt_qty_order);
        qtyDeliverEditText = findViewById(R.id.etxt_qty_deliver);
        ordDaysEditText = findViewById(R.id.etxt_ord_days);
        asstCodeEditText = findViewById(R.id.etxt_asst_code);
        incrementEditText = findViewById(R.id.etxt_increment);
        itemStatusEditText = findViewById(R.id.etxt_item_stat);
        minStockEditText = findViewById(R.id.etxt_min_stk);
        stkQtyEditText = findViewById(R.id.etxt_stk_qty);
        itemDescEditText = findViewById(R.id.etxt_item_desc);
        qtyEditText = findViewById(R.id.etxt_waste_quantity);
        barcodeEditText = findViewById(R.id.etxt_barcode);
    }

    private void handleKeyboard() {
        if (getSharedPreferences(AppConstants.PREF_FILE, 0).getBoolean(AppConstants.KEYBOARD_STATUS, false)){
            barcodeEditText.setFocusableInTouchMode(true);
            qtyOrderedEditText.setFocusableInTouchMode(true);
            qtyDeliverEditText.setFocusableInTouchMode(true);
            ordDaysEditText.setFocusableInTouchMode(true);
            asstCodeEditText.setFocusableInTouchMode(true);
            incrementEditText.setFocusableInTouchMode(true);
            itemStatusEditText.setFocusableInTouchMode(true);
            minStockEditText.setFocusableInTouchMode(true);
            stkQtyEditText.setFocusableInTouchMode(true);
            itemDescEditText.setFocusableInTouchMode(true);
            avgEditText.setFocusableInTouchMode(true);
        }
    }

    public void onBackClicked(View v){
        finish();
    }

    public void onModifyClicked(View v){

    }
}
