package cn.dankal.yunlaboratory.ui.activity;

import android.content.Intent;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.OnClick;
import cn.dankal.basiclib.DKUserManager;
import cn.dankal.basiclib.base.activity.BaseActivity;
import cn.dankal.basiclib.base.mvp.BasePresenter;
import cn.dankal.basiclib.model.SampleRecordBody;
import cn.dankal.basiclib.model.SubmitRecordModel;
import cn.dankal.basiclib.model.UserModel;
import cn.dankal.basiclib.util.GlideUtils;
import cn.dankal.yunlaboratory.R;
import cn.dankal.yunlaboratory.ui.widget.MainButton;

/**
 * 取回样本
 */
public class GetSampleActivity extends BaseActivity {
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.tv_person_name)
    TextView tvPersonName;
    @BindView(R.id.tv_person_no)
    TextView tvPersonNo;
    @BindView(R.id.tv_time)
    TextView tvTime;
    @BindView(R.id.tv_choose)
    MainButton tvChoose;

    private SubmitRecordModel recordModel;



    @Override
    public BasePresenter createPresenter() {
        return null;
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_get_sample;
    }

    @Override
    protected void initComponents() {
        recordModel= (SubmitRecordModel) getIntent().getSerializableExtra("data");
        tvTitle.setText("取回样本");





        tvChoose.setEnabled(true);

        initView();
    }

    private void initView(){
        if (DKUserManager.getUserInfo() != null) {
            UserModel userModel = DKUserManager.getUserInfo();

            tvPersonName.setText(userModel.getName());
            tvPersonNo.setText(userModel.getEmployee_id());

            tvTime.setText(recordModel.getCreated_at());

        }
    }

    @OnClick({R.id.iv_onback, R.id.tv_choose})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.iv_onback:
                finish();
                break;
            case R.id.tv_choose:
                Intent intent=new Intent(this,StartTestActivity.class);
                intent.putExtra("data",recordModel);

                startActivity(intent);
                finish();
                break;
        }
    }
}
