package xn.hxp.ui.adapter

import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import xn.hxp.R
import com.rc.httpcore.bean.HxpStockWaitListBean
import xn.hxp.weidith.TextTool

//可用化学品列表
class UseListAdapter :
    BaseQuickAdapter<HxpStockWaitListBean, BaseViewHolder>(R.layout.item_use_list) {

    override fun convert(holder: BaseViewHolder, item: HxpStockWaitListBean) {
        holder.setText(R.id.chemicalName, "${item.chemicalName}")
        if (item.chemicalPurity != null) {
            holder.setText(R.id.chemicalPurity, "${item.chemicalPurity}")
        }
        val chemicalNameView = holder.getView<TextView>(R.id.chemicalName);
        chemicalNameView.setOnClickListener {
            TextTool.showPop(context, chemicalNameView)
        }
        holder.setText(R.id.surplus, "${item.surplus}${item.specUnit}")
        holder.setText(R.id.chemicalNumber, "${item.chemicalNumber}")
        holder.setText(R.id.cabinetName_doorName, "${item.cabinetName}-${item.doorName}")
    }
}