package com.rv.rvmine.traveler;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
import android.widget.EditText;

import com.ruiwenliu.wrapper.base.BaseBean;
import com.ruiwenliu.wrapper.base.BaseStatusActivity;
import com.ruiwenliu.wrapper.weight.TitleView;
import com.rv.home.rv.module.basic.presenter.CommonPresenter;
import com.rv.rvmine.R;
import com.rv.rvmine.R2;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * 添加出游人
 */
public class AddAVisitorActivity extends BaseStatusActivity<CommonPresenter> {


    @BindView(R2.id.cb_adult)
    CheckBox cbAdult;
    @BindView(R2.id.cb_child)
    CheckBox cbChild;
    @BindView(R2.id.et_traveler_name)
    EditText etTravelerName;
    @BindView(R2.id.cb_man)
    CheckBox cbMan;
    @BindView(R2.id.cb_girl)
    CheckBox cbGirl;
    @BindView(R2.id.et_id_card)
    EditText etIdCard;
    @BindView(R2.id.et_phone)
    EditText etPhone;

    private int identityType = 0;
    private int setType = 0;


    public static Intent getIntent(Context context) {
        return new Intent(context, AddAVisitorActivity.class);
    }

    @Override
    protected int setLayout() {
        return R.layout.activity_add_avisitor;
    }

    @Override
    protected void initView(Bundle savedInstanceState, TitleView titleView, Intent intent) {
        titleView.setTitle(getString(R.string.add_a_visitor_title));
        titleView.setText(R.id.tv_title_right,getString(R.string.rv_save));
        titleView.setChildClickListener(R.id.tv_title_right, new View.OnClickListener() {
            @Override
            public void onClick(View v) {

            }
        });
    }

    @Override
    public void onShowResult(int requestType, BaseBean result) {

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }

    @OnClick({R2.id.cb_adult, R2.id.cb_child, R2.id.cb_man, R2.id.cb_girl})
    public void onViewClicked(View view) {
        int id = view.getId();
        if (id == R.id.cb_adult) {
            //成人
            cbAdult.setChecked(true);
            cbChild.setChecked(false);
            identityType = 0;
        } else if (id == R.id.cb_child) {
            //儿童
            cbAdult.setChecked(false);
            cbChild.setChecked(true);
            identityType = 1;
        } else if (id == R.id.cb_man) {
            //男
            cbMan.setChecked(true);
            cbGirl.setChecked(false);
            setType = 0;
        } else if (id == R.id.cb_girl) {
            //女
            cbMan.setChecked(false);
            cbGirl.setChecked(true);
            setType = 1;
        }
    }
}
