package com.wd.workoffice.ui.adapter;


import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.wd.workoffice.R;
import com.wd.workoffice.bean.OrderBean;

import java.util.List;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

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

public class WorkWarehouseOrderDetailAdapter extends BaseQuickAdapter<OrderBean.OrderItemsBean, BaseViewHolder> {

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


    @Override
    protected void convert(BaseViewHolder helper, OrderBean.OrderItemsBean item) {
        helper.setText(R.id.tv_name, item.getProductName());
        helper.setText(R.id.tv_code, item.getProductSoleCode());
        helper.setText(R.id.tv_img_code, item.getProductSimpleCode());
        helper.setText(R.id.tv_price, String.valueOf(item.getOuterPrice()));
        RecyclerView rvData = helper.getView(R.id.rv_data);
        rvData.setLayoutManager(new LinearLayoutManager(helper.itemView.getContext(), RecyclerView.VERTICAL, false));
        WorkWarehouseOrderStockAdapter workWarehouseOrderStockAdapter = new WorkWarehouseOrderStockAdapter(R.layout.item_warehoust_order_stock, item.getStockQuantityDetailMaps());
        workWarehouseOrderStockAdapter.bindToRecyclerView(rvData);
    }
}

