package com.example.chemical.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 com.example.chemical.R
import com.rc.httpcore.apk.ChemicalExpire

//化学品信息
class TimeoutAdapter :
    BaseQuickAdapter<ChemicalExpire, BaseViewHolder>(R.layout.item_timeout) {

    override fun convert(holder: BaseViewHolder, item: ChemicalExpire) {
        holder.setText(R.id.chemicalName, "${item.chemicalName}")
        holder.setText(R.id.tagCode, "-${item.tagCode}")
        if (item.position != null) {
            holder.setText(R.id.position, "${item.position}")
        } else {
            holder.getView<TextView>(R.id.position).visibility = View.GONE
        }
        if (item.belongName != null) {
            holder.setText(R.id.belongName, "归属人：${item.belongName}")
        }
        holder.setText(R.id.normsNum, "规格：${item.normsNum}")
        holder.setText(R.id.surplus, "余量：${item.surplus}")
        holder.setText(R.id.expireTime, "过期时间：${item.expireTime}")
    }
}