package xn.hxp.ui.adapter

import android.view.View
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.blankj.utilcode.util.LogUtils
import com.rc.httpcore.bean.HxpStockWaitListBean
import xn.hxp.weidith.TextTool


//查询-详情
class InquiryItemAdapter :
    BaseQuickAdapter<HxpStockWaitListBean, BaseViewHolder>(R.layout.item_inquiry) {

    override fun convert(holder: BaseViewHolder, item: HxpStockWaitListBean) {
        holder.setText(R.id.chemicalName, "${item.chemicalName}")
        val chemicalNameView = holder.getView<TextView>(R.id.chemicalName)
        chemicalNameView.setOnClickListener(View.OnClickListener {
            TextTool.showPop(context, chemicalNameView)
        })
        LogUtils.i("===${holder.adapterPosition}====${item.casNum}")
        if (item.casNum != null) {
            holder.setText(R.id.casNum, "${item.casNum}")
        }
        holder.setText(R.id.chemicalCategoryName, "${item.chemicalCategoryName}")
        holder.setText(R.id.chemicalLevelName, "${item.chemicalLevelName}")
        LogUtils.i("===${holder.adapterPosition}====${item.chemicalPurity}")
        if (item.chemicalPurity != null) {
            holder.setText(R.id.chemicalPurity, "${item.chemicalPurity}")
        }
        holder.setText(R.id.surplus, "${item.surplus}${item.specUnit}")
        holder.setText(R.id.chemicalNumber, "${item.chemicalNumber}")
    }
}