package com.lukouguoji.gjc.activity

import android.content.Context
import android.content.Intent
import android.os.Bundle
import com.lukouguoji.gjc.R
import com.lukouguoji.gjc.databinding.ActivityGjcBoxWeighingAddBinding
import com.lukouguoji.gjc.viewModel.GjcBoxWeighingAddViewModel
import com.lukouguoji.module_base.base.BaseBindingActivity
import com.lukouguoji.module_base.bean.GjcUldUseBean
import com.lukouguoji.module_base.common.Constant
import com.lukouguoji.module_base.ktx.setUpperCaseAlphanumericFilter

/**
 * 国际出港板箱过磅添加页面
 */
class GjcBoxWeighingAddActivity :
    BaseBindingActivity<ActivityGjcBoxWeighingAddBinding, GjcBoxWeighingAddViewModel>() {

    override fun layoutId() = R.layout.activity_gjc_box_weighing_add

    override fun viewModelClass() = GjcBoxWeighingAddViewModel::class.java

    override fun initOnCreate(savedInstanceState: Bundle?) {
        setBackArrow("国际出港板箱过磅")
        binding.viewModel = viewModel
        viewModel.initOnCreated(this, intent)

        // 为架子车号、ULD编码、IMP代码、航班号添加大写字母和数字的输入限制
        binding.carIdInput.et.setUpperCaseAlphanumericFilter()
        binding.uldNoInput.et.setUpperCaseAlphanumericFilter()
        binding.impCodeInput.et.setUpperCaseAlphanumericFilter()
        binding.flightNoInput.et.setUpperCaseAlphanumericFilter()
    }

    companion object {
        @JvmStatic
        fun startForAdd(context: Context) {
            val starter = Intent(context, GjcBoxWeighingAddActivity::class.java)
            context.startActivity(starter)
        }

        @JvmStatic
        fun startForEdit(context: Context, bean: GjcUldUseBean) {
            val starter = Intent(context, GjcBoxWeighingAddActivity::class.java)
                .putExtra(Constant.Key.BEAN, bean)
            context.startActivity(starter)
        }
    }
}
