package com.wd.workoffice.ui.adapter;


import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.wd.workoffice.R;
import com.wd.workoffice.bean.WarehouseStockBean;
import com.wd.workoffice.bean.workEnum.PagePermissionType;
import com.wd.workoffice.util.WorkUtils;

import java.util.List;

/**
 * Created by flexible on 2018/8/13.
 */

public class WorkWarhosutStockAdapter extends BaseQuickAdapter<WarehouseStockBean.RecordsBean, BaseViewHolder> {

    public WorkWarhosutStockAdapter(int layoutResId, List data) {
        super(layoutResId, data);
    }


    @Override
    protected void convert(BaseViewHolder helper, WarehouseStockBean.RecordsBean item) {
        helper.setText(R.id.tv_name, item.getProductName());
        helper.setText(R.id.tv_code, "品名:".concat(item.getProductSoleCode()));
        helper.setText(R.id.tv_img_code, "图号:".concat(item.getProductSimpleCode()));
        helper.setText(R.id.tv_num, String.valueOf(item.getQuantity()));
        helper.addOnClickListener(R.id.ll_num);
        helper.addOnClickListener(R.id.tv_detail);
        helper.addOnClickListener(R.id.tv_flow);
        if (!WorkUtils.hasPermission(PagePermissionType.STOCK_QUANTITY_DETAIL.getPermission())) {
            helper.setGone(R.id.tv_detail, false);
        }
        if (!WorkUtils.hasPermission(PagePermissionType.STOCK_QUANTITY_FLOW.getPermission())) {
            helper.setGone(R.id.tv_flow, false);
        }
    }
}

