package com.dahe.pass.adapter

import android.view.View
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.dahe.pass.R
import com.dahe.pass.bean.ApplyBean

/**
 * @ClassName ApplyAdapter
 * @Author 用户
 * @Date 2022/1/13 15:18
 * @Description TODO
 */
class ApplyAdapter(layoutResId: Int) : BaseQuickAdapter<ApplyBean, BaseViewHolder>(R.layout.item_apply) {
    override fun convert(holder: BaseViewHolder, item: ApplyBean) {
        holder.setText(R.id.tvTitle,item.enterpriseName)
            .setText(R.id.tvTime,"""${item.passUsageStartTime}至${item.passUsageEndTime}""")
            .setText(R.id.tvSqs,item.numberOfPassesRequired)
            .setText(R.id.tvSps,item.numberOfPasses)
            .setText(R.id.tvTbr,item.enterpriseContact)
            .setText(R.id.tvDh,item.enterpriseContactPhone)
            .setText(R.id.tvSqsj,item.createTime)
            .setText(R.id.tvSpsj,item.updateTime)
            .setText(R.id.tvType,"""(${item.chargeType})""")
            .setTextColorRes(R.id.tvType,if (item.chargeType.contains("收费")) R.color.color_down_time else R.color.color_green)
            .setGone(R.id.ivType,if ("0"==item.status) true else false)
            .setBackgroundResource(R.id.ivType,if ("1"==item.status) R.drawable.ok_pass else R.drawable.no_pass)
    }
}