package com.ifavine.pay.adapter;

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

import com.ifavine.pay.R;
import com.ifavine.pay.ui.base.ListBaseAdapter;
import com.ifavine.pay.ui.base.SuperViewHolder;
import com.ifavine.pay.vo.LocalRecordReport;
import com.ifavine.pay.vo.MonthRecordReport;

/**
 * Created by Administrator on 2018/10/25.
 */

public class LocalRecordReportAdapter extends ListBaseAdapter<LocalRecordReport> {


    public LocalRecordReportAdapter(Context context) {
        super(context);
    }


    @Override
    public int getLayoutId() {
        return R.layout.item_local_report;
    }

    @Override
    public void onBindItemHolder(SuperViewHolder holder, final int position) {
        LocalRecordReport q = mDataList.get(position);

        TextView V_no = holder.getView(R.id.V_no);
        TextView V_AllowanceAmount = holder.getView(R.id.V_AllowanceAmount);
        TextView V_CanteenName = holder.getView(R.id.V_CanteenName);
        TextView V_Consumption = holder.getView(R.id.V_Consumption);
        TextView V_ConsumptionDate = holder.getView(R.id.V_ConsumptionDate);
        TextView V_Department = holder.getView(R.id.V_Department);
        TextView V_DinnerAmount = holder.getView(R.id.V_DinnerAmount);
        TextView V_DinnerType = holder.getView(R.id.V_DinnerType);
        TextView V_EmpName = holder.getView(R.id.V_EmpName);
        TextView V_EmpNo = holder.getView(R.id.V_EmpNo);
        TextView V_Post = holder.getView(R.id.V_Post);
        TextView V_Remark = holder.getView(R.id.V_Remark);
        TextView V_TransactionNo = holder.getView(R.id.V_TransactionNo);
        TextView V_WindowName = holder.getView(R.id.V_WindowName);
        V_no.setText((position + 1) + "");
        V_AllowanceAmount.setText(q.AllowanceAmount);
        V_CanteenName.setText(q.CanteenName);
        V_Consumption.setText(q.Consumption);
        if (q.ConsumptionDate != null && q.ConsumptionDate.length() > 19) {
            q.ConsumptionDate = q.ConsumptionDate.substring(0, 19);
        }
        V_ConsumptionDate.setText(q.ConsumptionDate.replaceAll("T", " "));
        V_Department.setText(q.Department);
        V_DinnerAmount.setText(q.DinnerAmount);
        V_DinnerType.setText(q.DinnerType);
        V_EmpName.setText(q.EmpName);
        V_EmpNo.setText(q.EmpNo);
        V_Post.setText(q.Post);
        V_Remark.setText(q.Remark);
        V_TransactionNo.setText(q.TransactionNo);
        V_WindowName.setText(q.WindowName);
        if (!TextUtils.isEmpty(q.Remark)) {
            V_no.setTextColor(mContext.getResources().getColor(R.color.red));
            V_AllowanceAmount.setTextColor(mContext.getResources().getColor(R.color.red));
            V_Consumption.setTextColor(mContext.getResources().getColor(R.color.red));
            V_ConsumptionDate.setTextColor(mContext.getResources().getColor(R.color.red));
            V_Department.setTextColor(mContext.getResources().getColor(R.color.red));
            V_DinnerAmount.setTextColor(mContext.getResources().getColor(R.color.red));
            V_DinnerType.setTextColor(mContext.getResources().getColor(R.color.red));
            V_EmpName.setTextColor(mContext.getResources().getColor(R.color.red));
            V_EmpNo.setTextColor(mContext.getResources().getColor(R.color.red));
            V_Post.setTextColor(mContext.getResources().getColor(R.color.red));
            V_Remark.setTextColor(mContext.getResources().getColor(R.color.red));
            V_TransactionNo.setTextColor(mContext.getResources().getColor(R.color.red));
            V_WindowName.setTextColor(mContext.getResources().getColor(R.color.red));
            V_CanteenName.setTextColor(mContext.getResources().getColor(R.color.red));
        } else {
            V_no.setTextColor(mContext.getResources().getColor(R.color.font_black_20));
            V_AllowanceAmount.setTextColor(mContext.getResources().getColor(R.color.font_black_20));
            V_Consumption.setTextColor(mContext.getResources().getColor(R.color.font_black_20));
            V_ConsumptionDate.setTextColor(mContext.getResources().getColor(R.color.font_black_20));
            V_Department.setTextColor(mContext.getResources().getColor(R.color.font_black_20));
            V_DinnerAmount.setTextColor(mContext.getResources().getColor(R.color.font_black_20));
            V_DinnerType.setTextColor(mContext.getResources().getColor(R.color.font_black_20));
            V_EmpName.setTextColor(mContext.getResources().getColor(R.color.font_black_20));
            V_EmpNo.setTextColor(mContext.getResources().getColor(R.color.font_black_20));
            V_Post.setTextColor(mContext.getResources().getColor(R.color.font_black_20));
            V_Remark.setTextColor(mContext.getResources().getColor(R.color.font_black_20));
            V_TransactionNo.setTextColor(mContext.getResources().getColor(R.color.font_black_20));
            V_WindowName.setTextColor(mContext.getResources().getColor(R.color.font_black_20));
            V_CanteenName.setTextColor(mContext.getResources().getColor(R.color.font_black_20));
        }
    }
}
