package com.example.administrator.zhapp.adapter;

import android.content.Context;
import android.widget.TextView;

import com.example.administrator.zhapp.BaseListViewAdapter.CommonAdapter;
import com.example.administrator.zhapp.BaseListViewAdapter.ViewHolder;
import com.example.administrator.zhapp.R;
import com.example.administrator.zhapp.entity.XsDqgzBgListBean;
import com.example.administrator.zhapp.entity.XsDqgzTjListBean;

import java.util.List;

/**
 * Created by Rehome-rjb1 on 2017/7/17.
 */

public class XsDqgzTjListAdapter extends CommonAdapter<XsDqgzTjListBean.DataBean> {


    private List<XsDqgzTjListBean.DataBean> datas;

    public XsDqgzTjListAdapter(Context context, List<XsDqgzTjListBean.DataBean> datas) {
        super(context, R.layout.item_dqgz_tj, datas);
        this.datas = datas;
    }

    @Override
    protected void convert(ViewHolder viewHolder, XsDqgzTjListBean.DataBean item, int position) {


        TextView tvJhmc = viewHolder.getView(R.id.tv_jhmc);
        TextView tvZxsj = viewHolder.getView(R.id.tv_zxsj);
        TextView tvZxr = viewHolder.getView(R.id.tv_zxr);
        TextView tvZxqk = viewHolder.getView(R.id.tv_zxqk);

        tvJhmc.setText("计划名称：" + item.getJhmc());
        tvZxsj.setText("执行时间：" + item.getZxsj());
        tvZxr.setText("执行人：" + item.getZxr());
        tvZxqk.setText("执行情况：" + item.getZxqk());


        //执行状态（0:未执行、1:工作完成、2:工作取消，3.延期执行，4.申请中）
        //申请中的执行记录，不允许再做变更操作

        String status = "";

        switch (item.getZxzt()) {
            case "0":
                status = "未执行";
                break;
            case "1":
                status = "工作完成";
                break;
            case "2":
                status = "工作取消";
                break;
            case "3":
                status = "延期执行";
                break;
            case "4":
                status = "申请中";
                break;
        }

        viewHolder.setText(R.id.tv_zxzt, status);
    }
}
