Функционал механика ч.5

This commit is contained in:
Azat Sagutdinov 2024-06-04 16:17:38 +03:00
parent 0392253128
commit eea1b4d4f3
35 changed files with 608 additions and 69 deletions

View File

@ -290,6 +290,7 @@
<string name="title_task_number">Номер задания</string>
<string name="status">Статус</string>
<string name="main">Проведение измерения</string>
<string name="tech">Проведение Тех. осмотра</string>
<string name="message_select_route">Выберите путевой лист или задание</string>

View File

@ -285,6 +285,7 @@
<string name="title_task_number">Номер задания</string>
<string name="status">Статус</string>
<string name="main">Проведение измерения</string>
<string name="tech">Проведение Тех. осмотра</string>
<string name="message_select_route">Выберите путевой лист или задание</string>

View File

@ -1 +1 @@
package ru.tele2med.mobile.data.api.entity.response import ru.tele2med.mobile.domain.entity.* data class CheckupShowListResponse( val af: String, val status: String, val message: String, val data: List<DataCheckupShow> )
package ru.tele2med.mobile.data.api.entity.response import ru.tele2med.mobile.domain.entity.* data class CheckupShowListResponse( val af: String, val status: String, val message: String, val data: DataCheckListUpdate )

View File

@ -51,6 +51,7 @@ import ru.tele2med.mobile.presentation.ui.menu.items.tech.TechPresenter
import ru.tele2med.mobile.presentation.ui.menu.items.tech.list.TechListPresenter
import ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup.TechCheckupPresenter
import ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup.info.TechCheckupInfoPresenter
import ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup.info.sign.SignPresenter
import ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup.tests.TechCheckupTestsPresenter
import ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup.tests.test.TestPresenter
import ru.tele2med.mobile.presentation.ui.menu.items.tech.park.ParkPresenter
@ -84,6 +85,11 @@ fun presenterModule() = Kodein.Module(name = "presenterModule") {
TestPresenter(instance(), instance())
}
bind() from provider {
SignPresenter(instance(), instance())
}
bind() from provider {
TechPresenter()
}
@ -93,9 +99,6 @@ fun presenterModule() = Kodein.Module(name = "presenterModule") {
}
bind() from provider {
QrReviewPresenter(instance(), instance(), instance())
}

View File

@ -4,5 +4,5 @@ data class CheckupShowList(
val af: String,
val status: String,
val message: String,
val data: List<DataCheckupShow>
val data: DataCheckListUpdate
)

View File

@ -0,0 +1,13 @@
package ru.tele2med.mobile.domain.entity
data class DataCheckListUpdate(
val count_all: String,
val count_checked: Int?,
val check_positive: Int?,
val check_negative: Int?,
val exam_state_description: String?,
val exam_state: Int?,
val exam_state_name: String?
)

View File

@ -1,5 +1,6 @@
package ru.tele2med.mobile.presentation.router
import ru.tele2med.mobile.domain.entity.CheckupShowList
import ru.tele2med.mobile.domain.entity.DataQR
import ru.tele2med.mobile.domain.entity.DataShow
import ru.tele2med.mobile.domain.entity.DataTech
@ -124,8 +125,12 @@ class NavRouter : Router() {
navigateTo(NavScreens.getTechCheckup(dataTech))
}
fun openTestCheckupScreen(test: DataShow, uniq_id: String, dataTech: DataTech) {
navigateTo(NavScreens.getTestCheckup(test, uniq_id, dataTech))
fun openTestCheckupScreen(test: DataShow, uniq_id: String, dataTech: DataTech, checkupShowList: CheckupShowList?) {
navigateTo(NavScreens.getTestCheckup(test, uniq_id, dataTech, checkupShowList?: null))
}
fun openSignScreen(dataTech: DataTech) {
navigateTo(NavScreens.getSign(dataTech))
}
fun openMedicalCheckupsScreen() {

View File

@ -1,5 +1,6 @@
package ru.tele2med.mobile.presentation.router
import ru.tele2med.mobile.domain.entity.CheckupShowList
import ru.tele2med.mobile.domain.entity.DataQR
import ru.tele2med.mobile.domain.entity.DataShow
import ru.tele2med.mobile.domain.entity.DataTech
@ -41,6 +42,7 @@ import ru.tele2med.mobile.presentation.ui.menu.items.stats.StatsScreen
import ru.tele2med.mobile.presentation.ui.menu.items.status.StatusesScreen
import ru.tele2med.mobile.presentation.ui.menu.items.tech.TechScreen
import ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup.TechCheckupScreen
import ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup.info.sign.SignScreen
import ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup.tests.test.TestScreen
import ru.tele2med.mobile.presentation.ui.menu.items.tonometr.TonScreen
@ -95,7 +97,9 @@ object NavScreens {
fun getTechCheckup(dataTech: DataTech): TechCheckupScreen = TechCheckupScreen(dataTech)
fun getTestCheckup(test: DataShow, uniq_id: String, dataTech: DataTech): TestScreen = TestScreen(test, uniq_id, dataTech)
fun getTestCheckup(test: DataShow, uniq_id: String, dataTech: DataTech, checkupShowList: CheckupShowList?): TestScreen = TestScreen(test, uniq_id, dataTech, checkupShowList)
fun getSign(dataTech: DataTech): SignScreen = SignScreen(dataTech)
fun getTechCheckupInfo(dataTech: DataTech): TechCheckupScreen = TechCheckupScreen(dataTech)

View File

@ -47,6 +47,7 @@ abstract class BaseFragment : MvpAppCompatFragment(), BaseView, KodeinAware {
override fun showLoading() {
progressDialog?.dismiss()
progressDialog = null
progressDialog = ProgressDialog.show(activity, null, getString(R.string.loading), true)
}

View File

@ -240,6 +240,7 @@ class DrawerAdapter(
ScreenType.TASKS_FOR_TODAY -> image.setImageResource(R.drawable.ic_rectangle)
ScreenType.NOTIFICATIONS -> image.setImageResource(R.drawable.ic_rectangle)
ScreenType.MAIN -> image.setImageResource(R.drawable.ic_rectangle)
ScreenType.TECH -> image.setImageResource(R.drawable.ic_rectangle)
ScreenType.STATUS -> image.setImageResource(R.drawable.ic_rectangle)
ScreenType.HISTORY -> image.setImageResource(R.drawable.ic_rectangle)
ScreenType.CHAT -> image.setImageResource(R.drawable.ic_rectangle)

View File

@ -363,11 +363,42 @@ class DrawerPresenter(
listOf(
defaultHeader,
ListItem(
/* ListItem(
ScreenType.MAIN,
true,
R.string.main,
header = true
), */
ListItem(
ScreenType.REVIEW,
false,
R.string.review_toolbar,
header = true
),
ListItem(
ScreenType.SETTING,
false,
R.string.settings_toolbar,
header = true
)
// ButtonItem
// ButtonItem
)
private var listTechCheckup: List<DrawerItem> =
listOf(
defaultHeader,
ListItem(
ScreenType.TECH,
true,
R.string.tech,
header = true
),
@ -391,6 +422,7 @@ class DrawerPresenter(
)
override fun onFirstViewAttach() {
super.onFirstViewAttach()
disposable += changes
@ -416,7 +448,12 @@ class DrawerPresenter(
} else {
viewState.showList(listB)
}
} else {
}
if (screenType == ScreenType.MAIN) {
viewState.showList(listTechCheckup)
}
else {
if (prefs.getLcMenu() == "true") {
viewState.showList(listCoordinatesA)
} else {

View File

@ -14,6 +14,7 @@ enum class ScreenType {
WITHOUT_BORDER,
SELECT_ROUTE,
QR,
TECH,
PRINT,
DASHBOARD,
SELECT_TASK,

View File

@ -230,7 +230,12 @@ class MenuActivity : BaseDrawerActivity(), MenuView {
override fun onResumeFragments() {
navigationHolder.setNavigator(navigator)
if (webSocketClient.isClosed) {
webSocketClient.connect()
try {
webSocketClient.connect()
}
catch (e: Exception) {
Log.v("LOG", "e = ${e.message}")
}
}
super.onResumeFragments()
@ -330,6 +335,7 @@ class MenuActivity : BaseDrawerActivity(), MenuView {
settings.setOnClickListener {
presenter.onSettingsClick()
}
}

View File

@ -16,7 +16,7 @@ import ru.tele2med.mobile.presentation.util.providePresenter
class TechFragment : BaseMenuFragment(), TechView {
override val screenType: ScreenType
get() = ScreenType.TASKS_FOR_TODAY
get() = ScreenType.TECH
@InjectPresenter
lateinit var presenter: TechPresenter

View File

@ -25,7 +25,7 @@ import ru.tele2med.mobile.domain.entity.DataTechCheckup
class TechListFragment : BaseMenuFragment(), TechListView {
override val screenType: ScreenType
get() = ScreenType.HELLO
get() = ScreenType.TECH
@InjectPresenter
lateinit var presenter: TechListPresenter

View File

@ -7,6 +7,10 @@ import com.arellomobile.mvp.presenter.InjectPresenter
import com.arellomobile.mvp.presenter.ProvidePresenter
import com.google.gson.Gson
import kotlinx.android.synthetic.main.fragment_tasks.*
import kotlinx.android.synthetic.main.toolbar_with_help.*
import org.jetbrains.anko.clearTask
import org.jetbrains.anko.intentFor
import org.jetbrains.anko.newTask
import ru.tele2med.mobile.R
import ru.tele2med.mobile.domain.entity.DataTech
import ru.tele2med.mobile.presentation.ui.base.BasePresenter
@ -19,7 +23,7 @@ import ru.tele2med.mobile.presentation.util.providePresenter
class TechCheckupFragment : BaseMenuFragment(), TechCheckupView {
override val screenType: ScreenType
get() = ScreenType.TASKS_FOR_TODAY
get() = ScreenType.TECH
@InjectPresenter
lateinit var presenter: TechCheckupPresenter
@ -38,6 +42,12 @@ class TechCheckupFragment : BaseMenuFragment(), TechCheckupView {
super.onViewCreated(view, savedInstanceState)
(activity as MenuActivity).apply {
var dataString = arguments?.getString(DATA_QR)
close.visibility = View.VISIBLE
close.setOnClickListener {
startActivity(intentFor<MenuActivity>().newTask().clearTask())
}
phone.visibility = View.GONE
settings.visibility = View.GONE
val gson = Gson()
val data = gson.fromJson(dataString, DataTech::class.java)

View File

@ -24,6 +24,9 @@ import ru.tele2med.mobile.presentation.ui.menu.base.BaseMenuFragment
import ru.tele2med.mobile.presentation.util.providePresenter
import kotlinx.android.synthetic.main.fragment_tech_checkup.*
import kotlinx.android.synthetic.main.toolbar_with_help.*
import org.jetbrains.anko.clearTask
import org.jetbrains.anko.intentFor
import org.jetbrains.anko.newTask
import ru.tele2med.mobile.domain.entity.DataTech
import ru.tele2med.mobile.presentation.ui.menu.items.medicalCheckup.MedicalCheckupFragment
@ -31,7 +34,7 @@ import ru.tele2med.mobile.presentation.ui.menu.items.medicalCheckup.MedicalCheck
class TechCheckupInfoFragment : BaseMenuFragment(), TechCheckupInfoView {
override val screenType: ScreenType
get() = ScreenType.QR
get() = ScreenType.TECH
@InjectPresenter
lateinit var presenter: TechCheckupInfoPresenter
@ -63,6 +66,12 @@ class TechCheckupInfoFragment : BaseMenuFragment(), TechCheckupInfoView {
is MenuActivity -> {
(activity as MenuActivity).apply {
// addDrawerToggle()
close.visibility = View.VISIBLE
close.setOnClickListener {
startActivity(intentFor<MenuActivity>().newTask().clearTask())
}
phone.visibility = View.GONE
settings.visibility = View.GONE
showOrHideHelpButton(false)
title = ""
}
@ -74,16 +83,25 @@ class TechCheckupInfoFragment : BaseMenuFragment(), TechCheckupInfoView {
Log.v("DATA", "data 32 = $DATA_QR")
val gson = Gson()
val data = gson.fromJson(dataString, DataTech::class.java)
val data = gson.fromJson(DATA_QR, DataTech::class.java)
signButton.setOnClickListener {
presenter.goToSign(data)
}
notTest.setOnClickListener {
presenter.goToSign(data)
}
startTest.setOnClickListener {
presenter.updateTech(, data.uniq_id, data)
presenter.updateTech(data.uniq_id, data)
}
// tvDriverTitle.focusable
// tvDriverTitle.requestFocus()
presenter.showCheckUp()
presenter.showCheckUp(data.uniq_id)
initRecycler()
@ -97,20 +115,18 @@ class TechCheckupInfoFragment : BaseMenuFragment(), TechCheckupInfoView {
private fun initRecycler() {
println("initRecycler")
val args = arguments
val index = args?.toString() // getString("data", "")
val args = requireArguments().getString(DATA_QR)
Log.v(
"TechCheckupInfoFragment", "data = $index ${args?.getString("data")}"
"TechCheckupInfoFragment", "Z $DATA_QR"
)
Log.v("TechCheckupInfoFragment", "args = ${arguments?.getString("data")}")
val gson = Gson()
val data = gson.fromJson(DATA_QR, DataTech::class.java)
fillData(data)
refresh.setOnRefreshListener {
println("setOnRefreshListener")
presenter.showCheckUp()
presenter.showCheckUp(data.uniq_id)
}
@ -120,6 +136,29 @@ class TechCheckupInfoFragment : BaseMenuFragment(), TechCheckupInfoView {
@SuppressLint("StringFormatInvalid")
override fun fillData(dataTech: DataTech) {
when (dataTech.exam_state) {
"1" -> {
notTest.visibility = View.GONE
signButton.visibility = View.GONE
startTest.text = "Начать проверки"
}
"2" -> {
notTest.visibility = View.GONE
signButton.visibility = View.GONE
startTest.text = "Продолжить проверки"
}
"3" -> {
startTest.visibility = View.GONE
}
"4" -> {
startTest.visibility = View.GONE
notTest.visibility = View.GONE
signButton.visibility = View.GONE
}
else -> startTest.text = "Начать проверки"
}
println("СЕРВЕР = ${dataTech.mechanic_name}")
var profilePhoto: String
var profilePhotoUrl: Uri
@ -148,21 +187,22 @@ class TechCheckupInfoFragment : BaseMenuFragment(), TechCheckupInfoView {
private var DATA_QR = "DATA_QR"
fun getInstance(data: DataTech): TechCheckupInfoFragment {
Log.v("getInstance", "data DataTech = $data")
val gson = Gson()
val string: String = gson.toJson(data)
Log.v("COMP", "data = $data")
this.DATA_QR = string
DATA_QR = string
return TechCheckupInfoFragment().also {
Log.v("COMP", "data2 = $data")
DATA_QR = string
it.arguments = Bundle().apply {
Log.v("COMP", "data3 = $data")
putString(DATA_QR, string)
}
Log.v("COMP", "data4 = ${it.requireArguments().getString(DATA_QR)}")
Log.v("getInstance", "data DataTech = ${it.requireArguments().getString(DATA_QR)}")
}
}

View File

@ -5,11 +5,9 @@ import com.arellomobile.mvp.InjectViewState
import com.google.gson.Gson
import ru.tele2med.mobile.presentation.ui.base.BasePresenter
import ru.tele2med.mobile.presentation.ui.base.entity.RestApiCodes
import ru.tele2med.mobile.presentation.util.Prefs
import ru.tele2med.mobile.presentation.util.ioToMain
import io.reactivex.rxkotlin.plusAssign
import ru.tele2med.mobile.data.api.entity.exception.ApiException
import ru.tele2med.mobile.domain.entity.DataShow
import ru.tele2med.mobile.domain.entity.DataTech
import ru.tele2med.mobile.domain.interactor.TechInteractor
import ru.tele2med.mobile.presentation.router.NavRouter
@ -21,22 +19,69 @@ class TechCheckupInfoPresenter(
private val stringId: String
) : BasePresenter<TechCheckupInfoView>() {
fun onRefresh() {
override fun onFirstViewAttach() {
super.onFirstViewAttach()
Log.v(
"LOG",
"onFirstViewAttach in TechCheckupInfoPresenter"
)
}
fun updateTech(test: DataShow, uniq_id: String, dataTech: DataTech) {
navRouter.openTestCheckupScreen(test, uniq_id, dataTech)
fun goToSign(dataTech: DataTech) {
Log.v(
"LOG",
"goToSign carName = ${dataTech.vehicle_name}"
)
navRouter.openSignScreen(dataTech)
}
fun updateTech(uniq_id: String, dataTech: DataTech) {
Log.v(
"LOG",
"showTech uniq_id = $uniq_id,"
)
disposable += techInteractor
.showTech(uniq_id)
.ioToMain()
.doOnSubscribe {
Log.v("LOG", "it 2 = $it")
viewState.showLoading()
}
.doAfterTerminate {
viewState.hideLoading()
}
.subscribe({ it ->
var test = it.data.data.first()
navRouter.openTestCheckupScreen(test, uniq_id, dataTech, null)
}, {
if (it is ApiException) {
if (it.code == RestApiCodes.NotFound.code) {
} else {
this.handleError(it)
}
} else {
this.handleError(it)
}
})
}
fun showCheckUp() {
fun showCheckUp(id: String) {
val gson = Gson()
val data = gson.fromJson(stringId, DataTech::class.java)
println("data RoleName = ${data}")
println("data RoleName = ${id}")
get(id)
// viewState.fillData(data)
viewState.setRefreshing(false)
//viewState.setRefreshing(false)
}
fun get(code: String) {
@ -52,7 +97,7 @@ class TechCheckupInfoPresenter(
viewState.hideLoading()
}
.subscribe({
viewState.fillData(it.data)
}, {
if (it is ApiException) {

View File

@ -0,0 +1,118 @@
package ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup.info.sign
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.util.Log
import android.view.View
import com.arellomobile.mvp.presenter.InjectPresenter
import com.arellomobile.mvp.presenter.ProvidePresenter
import com.google.gson.Gson
import kotlinx.android.synthetic.main.fragment_checkup_test.*
import kotlinx.android.synthetic.main.fragment_checkup_test.falseBtn
import kotlinx.android.synthetic.main.fragment_checkup_test.trueBtn
import kotlinx.android.synthetic.main.fragment_checkup_test.tvComment
import kotlinx.android.synthetic.main.fragment_checkup_test.tvStatusName
import kotlinx.android.synthetic.main.fragment_checkup_test.tvTestName
import kotlinx.android.synthetic.main.fragment_sign.*
import ru.tele2med.mobile.R
import ru.tele2med.mobile.domain.entity.DataShow
import ru.tele2med.mobile.domain.entity.DataTech
import ru.tele2med.mobile.presentation.ui.base.BasePresenter
import ru.tele2med.mobile.presentation.ui.drawer.entity.ScreenType
import ru.tele2med.mobile.presentation.ui.menu.MenuActivity
import ru.tele2med.mobile.presentation.ui.menu.base.BaseMenuFragment
import ru.tele2med.mobile.presentation.util.providePresenter
class SignFragment : BaseMenuFragment(), SignView {
override val screenType: ScreenType
get() = ScreenType.TECH
@InjectPresenter
lateinit var presenter: SignPresenter
private var errorDialog: androidx.appcompat.app.AlertDialog? = null
@ProvidePresenter
fun initPresenter(): SignPresenter = providePresenter()
override fun getPresenter(): BasePresenter<*>? = presenter
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
(activity as MenuActivity).apply {
addDrawerToggle()
title = getString(R.string.test_toolbar)
}
// val args = arguments
// val data = args?.toString() // getString("data", "")
Log.v("TestFragment", "args = ${arguments?.getString(TEST)}")
val gson = Gson()
var stringTech = arguments?.getString(TECH)
val dataTech = gson.fromJson(stringTech, DataTech::class.java)
fillData(dataTech)
}
private fun fillData(data: DataTech) {
Log.v("TestFragment", "data = data.name = ${data.vehicle_name}")
tvCarName.text = data.vehicle_name
tvResult.text = data.result_name?: ""
signBtn.setOnClickListener {
presenter.sign(data)
}
}
override fun toBack() {
activity?.onBackPressed()
}
private fun actions(data: DataShow, uniq_id: String, dataTech: DataTech) {
trueBtn.setOnClickListener {
presenter.setValue(uniq_id, data.uniq_id, data, "1", dataTech)
}
falseBtn.setOnClickListener {
presenter.setValue(uniq_id, data.uniq_id, data, "0", dataTech)
}
}
override val layoutId: Int
get() = R.layout.fragment_sign
companion object {
private var TEST = "TEST"
private var UNIQ_ID = "UNIQ_ID"
private var TECH = "TECH"
fun getInstance(dataTech: DataTech): SignFragment {
val gson = Gson()
val stringTech: String = gson.toJson(dataTech)
TECH = stringTech
return SignFragment().also {
it.arguments = Bundle().apply {
putString(TECH, stringTech)
}
}
}
}
}

View File

@ -0,0 +1,125 @@
package ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup.info.sign
import android.util.Log
import com.arellomobile.mvp.InjectViewState
import io.reactivex.rxkotlin.plusAssign
import ru.tele2med.mobile.data.api.entity.exception.ApiException
import ru.tele2med.mobile.domain.entity.CheckupData
import ru.tele2med.mobile.domain.entity.DataShow
import ru.tele2med.mobile.domain.entity.DataTech
import ru.tele2med.mobile.domain.entity.Position
import ru.tele2med.mobile.domain.interactor.TechInteractor
import ru.tele2med.mobile.presentation.router.NavRouter
import ru.tele2med.mobile.presentation.ui.base.entity.RestApiCodes
import ru.tele2med.mobile.presentation.ui.menu.base.BaseMenuPresenter
import ru.tele2med.mobile.presentation.util.ioToMain
@InjectViewState
class SignPresenter(
private val techInteractor: TechInteractor,
private val navRouter: NavRouter,
) : BaseMenuPresenter<SignView>() {
private var position: Position? = null
override fun onFirstViewAttach() {
super.onFirstViewAttach()
}
fun sign(dataTech: DataTech) {
Log.v("SIGN", "Подписание с данными ${dataTech.vehicle_name}")
}
fun setValue(
uniq_id: String,
id: String,
dataShow: DataShow,
value: String,
dataTech: DataTech
) {
var checkup = CheckupData(id, dataShow.name ?: "", value, dataShow.type_id ?: "")
var data: List<CheckupData> = listOf(checkup)
Log.v("LOG", "it checkup = $uniq_id, data = $data")
disposable += techInteractor
.updateCheckList(uniq_id, id, data)
.ioToMain()
.doOnSubscribe {
Log.v("LOG", "it 2 = $it")
viewState.showLoading()
}
.doAfterTerminate {
viewState.hideLoading()
// viewState.toBack()
}
.subscribe({
Log.v("LOG", "it = $it ${it.data}")
showTech(uniq_id, dataTech)
}, {
if (it is ApiException) {
if (it.code == RestApiCodes.NotFound.code) {
} else {
this.handleError(it)
}
} else {
this.handleError(it)
}
})
//router.openPhoneEnterScreen()
}
fun showTech(uniq_id: String, dataTech: DataTech) {
Log.v(
"LOG",
"showTech uniq_id = $uniq_id,"
)
disposable += techInteractor
.showTech(uniq_id)
.ioToMain()
.doOnSubscribe {
Log.v("LOG", "it 2 = $it")
viewState.showLoading()
}
.doAfterTerminate {
viewState.hideLoading()
}
.subscribe({ it ->
Log.v("LOG", "showTech ${it.data.data}")
val newShowTech = mutableListOf<DataShow>()
it.data.data.forEach {
Log.v("LOG", "showTech forEach ${it}")
if ((it.value != "1") && (it.value != "0")) {
newShowTech.add(it)
Log.v("LOG", "showTech openTestCheckupScreen ${newShowTech}")
}
}
if (newShowTech.isNotEmpty()) {
navRouter.openTestCheckupScreen(newShowTech.first(), uniq_id, dataTech, null)
} else {
viewState.toBack()
}
// viewState.showCheckups(it.data.data)
}, {
if (it is ApiException) {
if (it.code == RestApiCodes.NotFound.code) {
} else {
this.handleError(it)
}
} else {
this.handleError(it)
}
})
}
}

View File

@ -0,0 +1,19 @@
package ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup.info.sign
import androidx.fragment.app.Fragment
import ru.tele2med.mobile.domain.entity.DataShow
import ru.tele2med.mobile.domain.entity.DataTech
import ru.terrakok.cicerone.android.support.SupportAppScreen
class SignScreen(val dataTech: DataTech) : SupportAppScreen() {
override fun getFragment(): Fragment {
return SignFragment.getInstance(
dataTech
)
}
override fun getScreenKey(): String {
return SignFragment::class.java.name
}
}

View File

@ -0,0 +1,18 @@
package ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup.info.sign
import com.arellomobile.mvp.viewstate.strategy.OneExecutionStateStrategy
import com.arellomobile.mvp.viewstate.strategy.SkipStrategy
import com.arellomobile.mvp.viewstate.strategy.StateStrategyType
import ru.tele2med.mobile.domain.entity.DataShow
import ru.tele2med.mobile.presentation.ui.base.BaseView
interface SignView : BaseView {
fun bindTest(test: DataShow) {
}
@StateStrategyType(OneExecutionStateStrategy::class)
fun toBack()
}

View File

@ -26,7 +26,11 @@ import ru.tele2med.mobile.presentation.util.providePresenter
import kotlinx.android.synthetic.main.fragment_test_list.*
import kotlinx.android.synthetic.main.fragment_test_list.recyclerView
import kotlinx.android.synthetic.main.toolbar_with_help.*
import org.jetbrains.anko.clearTask
import org.jetbrains.anko.intentFor
import org.jetbrains.anko.newTask
import ru.tele2med.mobile.domain.entity.*
import ru.tele2med.mobile.presentation.router.NavScreens
import ru.tele2med.mobile.presentation.ui.common.EndlessRecyclerViewScrollListener
@ -79,6 +83,12 @@ class TechCheckupTestsFragment : BaseMenuFragment(), TechCheckupTestsView {
}
is MenuActivity -> {
(activity as MenuActivity).apply {
close.visibility = View.VISIBLE
close.setOnClickListener {
startActivity(intentFor<MenuActivity>().newTask().clearTask())
}
phone.visibility = View.GONE
settings.visibility = View.GONE
// addDrawerToggle()
showOrHideHelpButton(false)
title = ""
@ -118,7 +128,7 @@ class TechCheckupTestsFragment : BaseMenuFragment(), TechCheckupTestsView {
override fun setRefreshing(flag: Boolean) {
println("setRefreshing = $flag")
refresh.isRefreshing = flag
// refresh.isRefreshing = flag
}
private fun initRecycler() {

View File

@ -40,10 +40,11 @@ class TechCheckupTestsPresenter(
}
.doAfterTerminate {
viewState.hideLoading()
viewState.setRefreshing(false)
}
.subscribe({
viewState.hideLoading()
Log.v("LOG", "it = $it ${it.data.data}")
viewState.showCheckups(it.data.data)
@ -61,7 +62,7 @@ class TechCheckupTestsPresenter(
fun get(test: DataShow, uniq_id: String, dataTech: DataTech) {
println("TechCheckupTestsPresenter ${test.uniq_id}")
navRouter.openTestCheckupScreen(test, uniq_id, dataTech)
navRouter.openTestCheckupScreen(test, uniq_id, dataTech, null)
}

View File

@ -9,25 +9,21 @@ import com.arellomobile.mvp.presenter.InjectPresenter
import com.arellomobile.mvp.presenter.ProvidePresenter
import com.google.gson.Gson
import kotlinx.android.synthetic.main.fragment_checkup_test.*
import kotlinx.android.synthetic.main.toolbar_with_help.*
import ru.tele2med.mobile.R
import ru.tele2med.mobile.di.module.navigationModule
import ru.tele2med.mobile.domain.entity.Data
import ru.tele2med.mobile.domain.entity.CheckupShowList
import ru.tele2med.mobile.domain.entity.DataShow
import ru.tele2med.mobile.domain.entity.DataTech
import ru.tele2med.mobile.presentation.ui.base.BasePresenter
import ru.tele2med.mobile.presentation.ui.drawer.entity.ScreenType
import ru.tele2med.mobile.presentation.ui.menu.MenuActivity
import ru.tele2med.mobile.presentation.ui.menu.base.BaseMenuFragment
import ru.tele2med.mobile.presentation.ui.menu.items.result.ResFragment
import ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup.TechCheckupFragment
import ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup.info.TechCheckupInfoFragment
import ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup.tests.TechCheckupTestsFragment
import ru.tele2med.mobile.presentation.util.providePresenter
class TestFragment : BaseMenuFragment(), TestView {
override val screenType: ScreenType
get() = ScreenType.WITHOUT_BORDER
get() = ScreenType.TECH
@InjectPresenter
lateinit var presenter: TestPresenter
@ -45,6 +41,7 @@ class TestFragment : BaseMenuFragment(), TestView {
(activity as MenuActivity).apply {
addDrawerToggle()
title = getString(R.string.test_toolbar)
close.visibility = View.VISIBLE
}
// val args = arguments
@ -67,6 +64,9 @@ class TestFragment : BaseMenuFragment(), TestView {
var dataString = arguments?.getString(TEST)
val data = gson.fromJson(dataString, DataShow::class.java)
var checkupShowList = arguments?.getString(CHECKUP)
val datacheckupShowList = gson.fromJson(checkupShowList, CheckupShowList::class.java)
var uniq_id = arguments?.getString(UNIQ_ID)
@ -74,18 +74,19 @@ class TestFragment : BaseMenuFragment(), TestView {
// val dataTest = gson.fromJson(TEST, DataShow::class.java)
fillData(data)
fillData(data, datacheckupShowList)
actions(data, uniq_id ?: "", dataTech)
}
}
private fun fillData(data: DataShow) {
private fun fillData(data: DataShow, checkupShowList: CheckupShowList?) {
Log.v("TestFragment", "data = data.name = ${data.name}")
tvTestName.text = data.name
tvComment.text = data.comment
tvStatusName.text = "Проверка ${data.order}"
tvStatusName.text = checkupShowList?.data?.exam_state_description?: "Вопрос №${data.order+1}"
}
@ -112,15 +113,19 @@ class TestFragment : BaseMenuFragment(), TestView {
private var TEST = "TEST"
private var UNIQ_ID = "UNIQ_ID"
private var TECH = "TECH"
private var CHECKUP = "CHECKUP"
fun getInstance(test: DataShow, uniq_id: String, dataTech: DataTech): TestFragment {
fun getInstance(test: DataShow, uniq_id: String, dataTech: DataTech, checkupShowList: CheckupShowList?): TestFragment {
val gson = Gson()
val string: String = gson.toJson(test)
this.TEST = string
val stringTech: String = gson.toJson(dataTech)
this.TECH = stringTech
val checkupShowListCommon: String = gson.toJson(checkupShowList)
this.CHECKUP = checkupShowListCommon
return TestFragment().also {
@ -128,6 +133,7 @@ class TestFragment : BaseMenuFragment(), TestView {
putString(TEST, string)
putString(UNIQ_ID, uniq_id)
putString(TECH, stringTech)
putString(CHECKUP, checkupShowListCommon)
}
}

View File

@ -4,10 +4,7 @@ import android.util.Log
import com.arellomobile.mvp.InjectViewState
import io.reactivex.rxkotlin.plusAssign
import ru.tele2med.mobile.data.api.entity.exception.ApiException
import ru.tele2med.mobile.domain.entity.CheckupData
import ru.tele2med.mobile.domain.entity.DataShow
import ru.tele2med.mobile.domain.entity.DataTech
import ru.tele2med.mobile.domain.entity.Position
import ru.tele2med.mobile.domain.entity.*
import ru.tele2med.mobile.domain.interactor.TechInteractor
import ru.tele2med.mobile.presentation.router.NavRouter
import ru.tele2med.mobile.presentation.ui.base.entity.RestApiCodes
@ -42,7 +39,7 @@ class TestPresenter(
.ioToMain()
.doOnSubscribe {
Log.v("LOG", "it 2 = $it")
viewState.showLoading()
// viewState.showLoading()
}
.doAfterTerminate {
viewState.hideLoading()
@ -50,7 +47,14 @@ class TestPresenter(
}
.subscribe({
Log.v("LOG", "it = $it ${it.data}")
showTech(uniq_id, dataTech)
if (it.data.count_checked != it.data.count_all.toInt()) {
showTech(uniq_id, dataTech, it)
}
else {
viewState.toBack()
}
}, {
if (it is ApiException) {
@ -66,7 +70,7 @@ class TestPresenter(
//router.openPhoneEnterScreen()
}
fun showTech(uniq_id: String, dataTech: DataTech) {
fun showTech(uniq_id: String, dataTech: DataTech, checkupShowList: CheckupShowList) {
Log.v(
"LOG",
"showTech uniq_id = $uniq_id,"
@ -96,7 +100,7 @@ class TestPresenter(
}
}
if (newShowTech.isNotEmpty()) {
navRouter.openTestCheckupScreen(newShowTech.first(), uniq_id, dataTech)
navRouter.openTestCheckupScreen(newShowTech.first(), uniq_id, dataTech, checkupShowList)
} else {
viewState.toBack()
}

View File

@ -1,14 +1,15 @@
package ru.tele2med.mobile.presentation.ui.menu.items.tech.list.techCheckup.tests.test
import androidx.fragment.app.Fragment
import ru.tele2med.mobile.domain.entity.CheckupShowList
import ru.tele2med.mobile.domain.entity.DataShow
import ru.tele2med.mobile.domain.entity.DataTech
import ru.terrakok.cicerone.android.support.SupportAppScreen
class TestScreen(val test: DataShow, val uniq_id: String, val dataTech: DataTech) : SupportAppScreen() {
class TestScreen(val test: DataShow, val uniq_id: String, val dataTech: DataTech, val checkupShowList: CheckupShowList?) : SupportAppScreen() {
override fun getFragment(): Fragment {
return TestFragment.getInstance(test, uniq_id, dataTech)
return TestFragment.getInstance(test, uniq_id, dataTech, checkupShowList)
}
override fun getScreenKey(): String {

View File

@ -14,7 +14,7 @@ import ru.tele2med.mobile.presentation.util.providePresenter
class ParkFragment : BaseMenuFragment(), ParkView {
override val screenType: ScreenType
get() = ScreenType.WITHOUT_BORDER
get() = ScreenType.TECH
@InjectPresenter
lateinit var presenter: ParkPresenter

View File

@ -36,6 +36,18 @@
android:layout_marginEnd="20dp"
tools:visibility="visible"
android:layout_marginTop="10dp"
app:layout_constraintEnd_toStartOf="@+id/close"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/close"
android:layout_width="26dp"
android:layout_height="26dp"
android:layout_marginEnd="20dp"
android:layout_marginTop="10dp"
android:visibility="gone"
android:src="@drawable/ic_xmark_solid"
tools:visibility="visible"
app:layout_constraintEnd_toStartOf="@+id/settings"
app:layout_constraintTop_toTopOf="parent" />
@ -51,6 +63,8 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/logo"
android:layout_width="188dp"

View File

@ -37,9 +37,22 @@
android:layout_marginEnd="20dp"
android:src="@drawable/ic_help_green"
android:visibility="gone"
app:layout_constraintEnd_toStartOf="@+id/close"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/close"
android:layout_width="26dp"
android:layout_height="26dp"
android:layout_marginTop="10dp"
tools:visibility="visible"
android:layout_marginEnd="20dp"
android:src="@drawable/ic_xmark_solid"
android:visibility="gone"
app:layout_constraintEnd_toStartOf="@+id/settings"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/settings"
android:layout_width="26dp"

View File

@ -233,6 +233,34 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/cvMainInfoContainer" />
<Button
android:id="@+id/signButton"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:text="Допустить и подписать"
android:textColor="@color/white"
android:textSize="12sp"
android:background="@drawable/btn_rounded_blue"
android:layout_marginTop="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/startTest" />
<Button
android:id="@+id/notTest"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:text="Не допустить и подписать"
android:textColor="@color/white"
android:textSize="12sp"
android:background="@drawable/btn_rounded_blue"
android:layout_marginTop="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/signButton" />

View File

@ -10,8 +10,8 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:background="@color/white"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:background="@color/white">
<TextView
@ -26,8 +26,8 @@
android:id="@+id/ivEye"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
android:layout_marginEnd="10dp"
android:visibility="gone"
app:layout_constraintEnd_toStartOf="@+id/tvStatus"
app:layout_constraintTop_toTopOf="parent"
tools:src="@drawable/ic_green_eye" />
@ -36,9 +36,9 @@
android:id="@+id/ivBattery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@+id/tvFio"
app:layout_constraintEnd_toEndOf="parent"
android:visibility="gone"
app:layout_constraintTop_toTopOf="@+id/tvFio"
tools:src="@drawable/ic_battery_low" />
@ -51,7 +51,7 @@
android:textColor="@color/gray_checkups"
android:textSize="18sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvStatus"
tools:text="Х727ХХ716 (Aurus)" />
<ImageView

View File

@ -35,6 +35,18 @@
android:src="@drawable/ic_help_green"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/close"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
<ImageView
android:id="@+id/close"
android:layout_width="26dp"
android:layout_height="26dp"
android:layout_marginEnd="10dp"
android:src="@drawable/ic_xmark_solid"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/settings"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />

View File

@ -286,6 +286,7 @@
<string name="status">Статус</string>
<string name="main">Проведение измерения</string>
<string name="tech">Проведение Тех. осмотра</string>
<string name="message_select_route">Выберите путевой лист или задание</string>
<string name="message_select_task">Выберите путевой лист</string>

View File

@ -286,6 +286,7 @@
<string name="status">Статус</string>
<string name="main">Проведение измерения</string>
<string name="tech">Проведение Тех. осмотра</string>
<string name="message_select_route">Выберите путевой лист или задание</string>
<string name="message_select_task">Выберите путевой лист</string>