package com.grkj.iscs_mc.view.fragment

import com.grkj.iscs_mc.R
import com.grkj.iscs_mc.databinding.FragmentMaterialReplacementRecordBinding
import com.grkj.iscs_mc.extentions.navigateUp
import com.grkj.iscs_mc.view.base.BaseMvpFragment
import com.grkj.iscs_mc.view.iview.IMaterialReplacementRecordView
import com.grkj.iscs_mc.view.presenter.MaterialReplacementRecordPresenter
import com.zhy.adapter.recyclerview.CommonAdapter
import com.zhy.adapter.recyclerview.base.ViewHolder

/**
 * 物资更换记录页
 */
class MaterialReplacementRecordFragment :
    BaseMvpFragment<IMaterialReplacementRecordView, MaterialReplacementRecordPresenter, FragmentMaterialReplacementRecordBinding>() {

    override val viewBinding: FragmentMaterialReplacementRecordBinding
        get() = FragmentMaterialReplacementRecordBinding.inflate(layoutInflater)

    override fun initView() {
        mBinding?.cbBack?.setOnClickListener { navigateUp() }

        mBinding?.rvRecord?.adapter = object : CommonAdapter<String>(
            requireContext(),
            R.layout.item_rv_replacement_record,
            mutableListOf()
        ) {
            override fun convert(holder: ViewHolder, t: String, position: Int) {
                val recyclerView =
                    holder.getView<androidx.recyclerview.widget.RecyclerView>(R.id.rv_record_detail)
                recyclerView.adapter = object : CommonAdapter<String>(
                    requireContext(),
                    R.layout.item_rv_replacement,
                    mutableListOf()
                ) {
                    override fun convert(holder: ViewHolder, t: String, position: Int) {

                    }
                }
            }
        }
    }

    override fun initPresenter(): MaterialReplacementRecordPresenter {
        return MaterialReplacementRecordPresenter()
    }
}