package in.techware.carrefour.activity.merchandise;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.RadioGroup;

import in.techware.carrefour.R;

public class PrintLabelActivity extends AppCompatActivity implements View.OnClickListener {

    RadioGroup mPrintRadioGroup;
    RadioButton mRadioButton;
    Button mBackButton;
    Button mModifyButton;
    String selectedSubMenu;

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

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

        mPrintRadioGroup = findViewById(R.id.radio_group_label);
        mBackButton = findViewById(R.id.btn_back);
        mModifyButton = findViewById(R.id.btn_modify);

        mBackButton.setOnClickListener(this);
        mModifyButton.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.btn_back:
                finish();
                break;

            case R.id.btn_modify:
                int selId = mPrintRadioGroup.getCheckedRadioButtonId();
                mRadioButton = findViewById(selId);
                String printType = mRadioButton.getText().toString();
                Intent intent = new Intent(getApplicationContext(), in.techware.carrefour.activity.it.PrintLabelActivity.class);
                intent.putExtra("print_type", printType);
                startActivity(intent);
                break;
        }
    }
}
