package in.techware.carrefour.activity.elie;

import android.content.Intent;
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.activity.FileTransferActivity;
import in.techware.carrefour.util.AppConstants;

public class ExpiredActionActivity extends AppCompatActivity {

    EditText mLocationTypeEditText;
    EditText mLocationEditText;
    EditText mBarcodeEditText;
    EditText mQtyEditText;

    String selectedSubMenu;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_expired_action);
        mLocationTypeEditText = findViewById(R.id.etxt_loc_type);
        mLocationEditText = findViewById(R.id.etxt_location);
        mBarcodeEditText = findViewById(R.id.etxt_barcode);
        mQtyEditText = findViewById(R.id.etxt_waste_quantity);

        if (getIntent() != null && getIntent().getStringExtra("submenu") != null)
            selectedSubMenu = getIntent().getStringExtra("submenu");

        handleKeyboard();
    }

    private void handleKeyboard() {
        if (getSharedPreferences(AppConstants.PREF_FILE, 0).getBoolean(AppConstants.KEYBOARD_STATUS, false)){
            mLocationTypeEditText.setFocusableInTouchMode(true);
            mLocationEditText.setFocusableInTouchMode(true);
            mBarcodeEditText.setFocusableInTouchMode(true);
            mQtyEditText.setFocusableInTouchMode(true);
        }
    }

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

    public void clickModifyListener(View v){
        Intent intent = new Intent(getApplicationContext(), FileTransferActivity.class);
        intent.putExtra("submenu",selectedSubMenu);
        startActivity(intent);
    }

    public  void clickChangeListener(View v){
        mLocationTypeEditText.setEnabled(true);
    }
}
