|
|
@@ -84,45 +84,17 @@ class JobProgressFragment(val goBack: () -> Unit) :
|
|
|
mUserList.addAll(it.colockUserList!!)
|
|
|
mBinding?.rvPoint?.adapter?.notifyDataSetChanged()
|
|
|
mBinding?.rvColocker?.adapter?.notifyDataSetChanged()
|
|
|
+ handleActionBtnVisibility()
|
|
|
}
|
|
|
presenter?.getTicketDetail(pageChangeBO.ticketId) {
|
|
|
mBinding?.tvTitle?.text = it?.ticketName
|
|
|
}
|
|
|
|
|
|
- presenter?.getStepDetail(pageChangeBO.ticketId!!) {
|
|
|
- mBinding?.tvWorker?.text = "${it?.get(2)?.userNum}/${it?.get(4)?.userNum}/${it?.get(7)?.userNum}"
|
|
|
- mBinding?.tvLock?.text = "${it?.get(2)?.lockNum}/${it?.get(4)?.lockNum}/${it?.get(7)?.lockNum}"
|
|
|
-
|
|
|
- it?.filter { it.stepStatus == "1" }?.maxByOrNull { it.stepIndex!! }?.stepIndex?.let {
|
|
|
- mStep = it
|
|
|
- }
|
|
|
- if (mStep == 4) {
|
|
|
- mBinding?.cbAction?.visibility = View.VISIBLE
|
|
|
- } else if (mStep == 7) {
|
|
|
- mBinding?.cbAction?.visibility = View.VISIBLE
|
|
|
- mBinding?.cbAction?.setIcon(R.mipmap.ticket_unlocked)
|
|
|
- mBinding?.cbAction?.setText(getString(R.string.go_unlocking))
|
|
|
- } else {
|
|
|
- mBinding?.cbAction?.visibility = View.GONE
|
|
|
- }
|
|
|
- }
|
|
|
+ getStepDetail(pageChangeBO.ticketId!!)
|
|
|
}
|
|
|
|
|
|
fun getCardNo(cardNo: String) {
|
|
|
- presenter?.getStepDetail(mPageChangeBO?.ticketId!!) {
|
|
|
- it?.filter { it.stepStatus == "1" }?.maxByOrNull { it.stepIndex!! }?.stepIndex?.let {
|
|
|
- mStep = it
|
|
|
- }
|
|
|
- if (mStep == 4) {
|
|
|
- mBinding?.cbAction?.visibility = View.VISIBLE
|
|
|
- } else if (mStep == 7) {
|
|
|
- mBinding?.cbAction?.visibility = View.VISIBLE
|
|
|
- mBinding?.cbAction?.setIcon(R.mipmap.ticket_unlocked)
|
|
|
- mBinding?.cbAction?.setText(getString(R.string.go_unlocking))
|
|
|
- } else {
|
|
|
- mBinding?.cbAction?.visibility = View.GONE
|
|
|
- }
|
|
|
- }
|
|
|
+ getStepDetail(mPageChangeBO?.ticketId!!)
|
|
|
|
|
|
presenter?.getCardInfoByNfc(cardNo) {
|
|
|
if (it == null) {
|
|
|
@@ -154,6 +126,39 @@ class JobProgressFragment(val goBack: () -> Unit) :
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private fun getStepDetail(ticketId: Long) {
|
|
|
+ presenter?.getStepDetail(ticketId) {
|
|
|
+ mBinding?.tvWorker?.text = "${it?.get(2)?.userNum}/${it?.get(4)?.userNum}/${it?.get(7)?.userNum}"
|
|
|
+ mBinding?.tvLock?.text = "${it?.get(2)?.lockNum}/${it?.get(4)?.lockNum}/${it?.get(7)?.lockNum}"
|
|
|
+
|
|
|
+ it?.filter { it.stepStatus == "1" }?.maxByOrNull { it.stepIndex!! }?.stepIndex?.let {
|
|
|
+ mStep = it
|
|
|
+ }
|
|
|
+ handleActionBtnVisibility()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private fun handleActionBtnVisibility() {
|
|
|
+ when (mStep) {
|
|
|
+ 4 -> {
|
|
|
+ if (!mPointList.all { it.pointStatus == "1" }) {
|
|
|
+ mBinding?.cbAction?.visibility = View.VISIBLE
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 7 -> {
|
|
|
+ if (!mPointList.all { it.pointStatus == "2" }) {
|
|
|
+ mBinding?.cbAction?.visibility = View.VISIBLE
|
|
|
+ mBinding?.cbAction?.setIcon(R.mipmap.ticket_unlocked)
|
|
|
+ mBinding?.cbAction?.setText(getString(R.string.go_unlocking))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else -> {
|
|
|
+ mBinding?.cbAction?.visibility = View.GONE
|
|
|
+ }
|
|
|
+ }
|
|
|
+ mBinding?.cbAction?.isEnabled = mBinding?.cbAction?.visibility == View.VISIBLE
|
|
|
+ }
|
|
|
+
|
|
|
override fun onPause() {
|
|
|
super.onPause()
|
|
|
mStep = 0
|