refs #5135: refactor animation
This commit is contained in:
parent
f950dd0bd7
commit
c1d281348b
|
@ -12,7 +12,7 @@ import es.verdnatura.presentation.view.feature.delivery.viewmodels.DeliveryViewM
|
||||||
import es.verdnatura.presentation.view.feature.diadeventa.fragment.DayOfSaleViewModel
|
import es.verdnatura.presentation.view.feature.diadeventa.fragment.DayOfSaleViewModel
|
||||||
import es.verdnatura.presentation.view.feature.historicoarticulo.fragment.HistoricoArticuloViewModel
|
import es.verdnatura.presentation.view.feature.historicoarticulo.fragment.HistoricoArticuloViewModel
|
||||||
import es.verdnatura.presentation.view.feature.historicoshelving.fragment.ItemShelvingLogViewModel
|
import es.verdnatura.presentation.view.feature.historicoshelving.fragment.ItemShelvingLogViewModel
|
||||||
import es.verdnatura.presentation.view.feature.historicoshelvinglog.fragment.shelvingLogViewModel
|
import es.verdnatura.presentation.view.feature.historicoshelvinglog.fragment.ShelvingLogViewModel
|
||||||
import es.verdnatura.presentation.view.feature.historicovehiculo.fragment.HistoricoVehiculoViewModel
|
import es.verdnatura.presentation.view.feature.historicovehiculo.fragment.HistoricoVehiculoViewModel
|
||||||
import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryViewModel
|
import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryViewModel
|
||||||
import es.verdnatura.presentation.view.feature.login.fragment.LoginViewModel
|
import es.verdnatura.presentation.view.feature.login.fragment.LoginViewModel
|
||||||
|
@ -174,7 +174,7 @@ val viewModelModule = module {
|
||||||
ItemShelvingLogViewModel(androidContext())
|
ItemShelvingLogViewModel(androidContext())
|
||||||
}
|
}
|
||||||
viewModel {
|
viewModel {
|
||||||
shelvingLogViewModel(androidContext())
|
ShelvingLogViewModel(androidContext())
|
||||||
}
|
}
|
||||||
viewModel {
|
viewModel {
|
||||||
ClaimViewModel(androidContext())
|
ClaimViewModel(androidContext())
|
||||||
|
|
|
@ -6,6 +6,7 @@ import android.content.Intent
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import es.verdnatura.MobileApplication
|
import es.verdnatura.MobileApplication
|
||||||
|
import es.verdnatura.R
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
import es.verdnatura.presentation.base.nameofFunction
|
||||||
import es.verdnatura.presentation.view.feature.login.activity.LoginActivity
|
import es.verdnatura.presentation.view.feature.login.activity.LoginActivity
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
@ -14,7 +15,6 @@ import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
import kotlin.system.exitProcess
|
import kotlin.system.exitProcess
|
||||||
|
|
||||||
|
|
||||||
abstract class SalixCallback<T>(val context: Context) : Callback<T> {
|
abstract class SalixCallback<T>(val context: Context) : Callback<T> {
|
||||||
|
|
||||||
override fun onResponse(call: Call<T>, response: Response<T>) {
|
override fun onResponse(call: Call<T>, response: Response<T>) {
|
||||||
|
@ -61,7 +61,11 @@ abstract class SalixCallback<T>(val context: Context) : Callback<T> {
|
||||||
|
|
||||||
open fun onSuccess(response: Response<T>) {
|
open fun onSuccess(response: Response<T>) {
|
||||||
// (nameofFunction((this)) + context.getString(R.string.operationSuccessful)).toast(context)
|
// (nameofFunction((this)) + context.getString(R.string.operationSuccessful)).toast(context)
|
||||||
//(context as MobileApplication).playSoundIsOK(true)
|
|
||||||
|
(context as MobileApplication).messageToast(
|
||||||
|
isError = false,
|
||||||
|
message = context.getString(R.string.operationSuccessful)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun onError(t: Throwable) {
|
open fun onError(t: Throwable) {
|
||||||
|
|
|
@ -14,17 +14,17 @@ import es.verdnatura.presentation.view.feature.historicoshelvinglog.adapter.Shel
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||||
|
|
||||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||||
class shelvingLogFragment(
|
class ShelvingLogFragment(
|
||||||
var entryPoint: String = ""
|
var entryPoint: String = ""
|
||||||
|
|
||||||
) : BaseFragment<FragmentShelvinglogBinding, shelvingLogViewModel>(
|
) : BaseFragment<FragmentShelvinglogBinding, ShelvingLogViewModel>(
|
||||||
shelvingLogViewModel::class
|
ShelvingLogViewModel::class
|
||||||
) {
|
) {
|
||||||
private var adapter: ShelvingLogAdapter? = null
|
private var adapter: ShelvingLogAdapter? = null
|
||||||
private var itemScan = ""
|
private var itemScan = ""
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun newInstance(entryPoint: String) = shelvingLogFragment(entryPoint)
|
fun newInstance(entryPoint: String) = ShelvingLogFragment(entryPoint)
|
||||||
}
|
}
|
||||||
|
|
||||||
private lateinit var customDialog: CustomDialog
|
private lateinit var customDialog: CustomDialog
|
||||||
|
@ -51,8 +51,7 @@ class shelvingLogFragment(
|
||||||
binding.scanInput.setOnEditorActionListener { v, actionId, event ->
|
binding.scanInput.setOnEditorActionListener { v, actionId, event ->
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
||||||
if (!binding.scanInput.text.toString().isNullOrEmpty()) {
|
if (!binding.scanInput.text.toString().isNullOrEmpty()) {
|
||||||
shelvingLog_get(binding.scanInput.text.toString())
|
viewModel.shelvings((binding.scanInput.text.toString()))
|
||||||
|
|
||||||
itemScan = binding.scanInput.text.toString()
|
itemScan = binding.scanInput.text.toString()
|
||||||
}
|
}
|
||||||
binding.scanInput.setText("")
|
binding.scanInput.setText("")
|
||||||
|
@ -62,39 +61,21 @@ class shelvingLogFragment(
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
binding.mainToolbar.backButton.setOnClickListener {
|
binding.mainToolbar.backButton.setOnClickListener {
|
||||||
requireActivity().onBackPressed()
|
requireActivity().onBackPressed()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun shelvingLog_get(vShelvingFK: String) {
|
|
||||||
binding.splashProgress.visibility = View.VISIBLE
|
|
||||||
viewModel.Shelvings(setFilter(vShelvingFK))
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setFilter(vShlevingFK: String): String {
|
|
||||||
|
|
||||||
return "{\"where\": {\"code\": \"$vShlevingFK\"}}"
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
override fun observeViewModel() {
|
override fun observeViewModel() {
|
||||||
with(viewModel) {
|
with(viewModel) {
|
||||||
|
|
||||||
loadShelvingLogSalixList.observe(viewLifecycleOwner, Observer { event ->
|
loadShelvingLogSalixList.observe(viewLifecycleOwner, Observer { event ->
|
||||||
event.getContentIfNotHandled().notNull {
|
event.getContentIfNotHandled().notNull {
|
||||||
binding.splashProgress.visibility = View.GONE
|
|
||||||
//adapter = ShelvingLogAdapter(it.list)
|
|
||||||
binding.itemshelvinglogRecyclerview.adapter = adapter
|
binding.itemshelvinglogRecyclerview.adapter = adapter
|
||||||
binding.itemshelvinglogRecyclerview.layoutManager =
|
binding.itemshelvinglogRecyclerview.layoutManager =
|
||||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||||
setToolBar(getString(R.string.shelvingLog) + ":" + itemScan)
|
setToolBar(getString(R.string.shelvingLog) + ":" + itemScan)
|
||||||
|
|
||||||
if (it.list.isEmpty()) {
|
if (it.list.isEmpty()) {
|
||||||
customDialog.setTitle(getString(R.string.noResults))
|
customDialog.setTitle(getString(R.string.noResults))
|
||||||
.setDescription(getString(R.string.noDataLabelScanned))
|
.setDescription(getString(R.string.noDataLabelScanned))
|
||||||
|
@ -102,17 +83,6 @@ class shelvingLogFragment(
|
||||||
customDialog.dismiss()
|
customDialog.dismiss()
|
||||||
}.show()
|
}.show()
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (it.list.get(0).isError == true) {
|
|
||||||
it.list.get(0).errorMessage?.let { it1 ->
|
|
||||||
customDialog.setTitle(getString(R.string.error))
|
|
||||||
.setDescription(it1)
|
|
||||||
.setOkButton(getString(R.string.close)) {
|
|
||||||
customDialog.dismiss()
|
|
||||||
}.show()
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
|
|
||||||
val itemId = it.list[0].id
|
val itemId = it.list[0].id
|
||||||
ma.onPasillerosItemClickListener(
|
ma.onPasillerosItemClickListener(
|
||||||
PasillerosItemVO(
|
PasillerosItemVO(
|
||||||
|
@ -128,13 +98,9 @@ class shelvingLogFragment(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,59 +1,27 @@
|
||||||
package es.verdnatura.presentation.view.feature.historicoshelvinglog.fragment
|
package es.verdnatura.presentation.view.feature.historicoshelvinglog.fragment
|
||||||
|
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.Transformations
|
import androidx.lifecycle.Transformations
|
||||||
import es.verdnatura.domain.SilexCallback
|
import es.verdnatura.domain.SalixCallback
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
|
||||||
import es.verdnatura.presentation.common.Event
|
import es.verdnatura.presentation.common.Event
|
||||||
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLogSalix
|
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLogSalix
|
||||||
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLogSalixList
|
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLogSalixList
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
|
class ShelvingLogViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
class shelvingLogViewModel(val context: Context) : BaseViewModel(context) {
|
|
||||||
|
|
||||||
private val _itemShelvingLogSalixList by lazy { MutableLiveData<ShelvingLogSalixList>() }
|
private val _itemShelvingLogSalixList by lazy { MutableLiveData<ShelvingLogSalixList>() }
|
||||||
val loadShelvingLogSalixList = Transformations.map(_itemShelvingLogSalixList) { Event(it) }
|
val loadShelvingLogSalixList = Transformations.map(_itemShelvingLogSalixList) { Event(it) }
|
||||||
|
|
||||||
fun Shelvings(vShelvingFK: String) {
|
fun shelvings(vShelvingFK: String) {
|
||||||
salix.Shelvings(vShelvingFK).enqueue(object :
|
salix.Shelvings("""{"where": {"code": "$vShelvingFK"}}""").enqueue(object :
|
||||||
SilexCallback<List<ShelvingLogSalix>>(context) {
|
SalixCallback<List<ShelvingLogSalix>>(context) {
|
||||||
override fun onError(t: Throwable) {
|
|
||||||
|
|
||||||
val listError: ArrayList<ShelvingLogSalix> = ArrayList()
|
|
||||||
listError.add(
|
|
||||||
ShelvingLogSalix(
|
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
_itemShelvingLogSalixList.value = ShelvingLogSalixList(listError)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onSuccess(response: Response<List<ShelvingLogSalix>>) {
|
override fun onSuccess(response: Response<List<ShelvingLogSalix>>) {
|
||||||
|
|
||||||
if (response.body() != null) {
|
|
||||||
_itemShelvingLogSalixList.value = response.body()?.let {
|
_itemShelvingLogSalixList.value = response.body()?.let {
|
||||||
ShelvingLogSalixList(it)
|
ShelvingLogSalixList(it)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
val listError: ArrayList<ShelvingLogSalix> = ArrayList()
|
|
||||||
listError.add(
|
|
||||||
ShelvingLogSalix(
|
|
||||||
isError = true,
|
|
||||||
errorMessage = getMessageFromAllResponse(
|
|
||||||
nameofFunction(this),
|
|
||||||
response.message()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
_itemShelvingLogSalixList.value = ShelvingLogSalixList(listError)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package es.verdnatura.presentation.view.feature.workermistake.adapter
|
package es.verdnatura.presentation.view.feature.workermistake.fragment
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
@ -7,6 +7,7 @@ import androidx.core.widget.addTextChangedListener
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentWorkermistakeBinding
|
import es.verdnatura.databinding.FragmentWorkermistakeBinding
|
||||||
|
import es.verdnatura.domain.toast
|
||||||
import es.verdnatura.presentation.base.BaseFragment
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
|
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
|
||||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||||
|
@ -18,6 +19,7 @@ import es.verdnatura.presentation.view.feature.articulo.adapter.BarcodeAdapter
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
|
import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
|
||||||
import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryViewModel
|
import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryViewModel
|
||||||
import es.verdnatura.presentation.view.feature.inventario.fragment.SearchDepartmentModel
|
import es.verdnatura.presentation.view.feature.inventario.fragment.SearchDepartmentModel
|
||||||
|
import es.verdnatura.presentation.view.feature.workermistake.adapter.WorkermistakeAdapter
|
||||||
import es.verdnatura.presentation.view.feature.workermistake.model.DepartmentMistake
|
import es.verdnatura.presentation.view.feature.workermistake.model.DepartmentMistake
|
||||||
import es.verdnatura.presentation.view.feature.workermistake.model.MistakeType
|
import es.verdnatura.presentation.view.feature.workermistake.model.MistakeType
|
||||||
import es.verdnatura.presentation.view.feature.workermistake.model.WorkerFromMistake
|
import es.verdnatura.presentation.view.feature.workermistake.model.WorkerFromMistake
|
||||||
|
@ -30,7 +32,6 @@ class WorkermistakeFragment(
|
||||||
) : BaseFragment<FragmentWorkermistakeBinding, InventaryViewModel>(
|
) : BaseFragment<FragmentWorkermistakeBinding, InventaryViewModel>(
|
||||||
InventaryViewModel::class
|
InventaryViewModel::class
|
||||||
) {
|
) {
|
||||||
|
|
||||||
private var adapterworker: WorkermistakeAdapter? = null
|
private var adapterworker: WorkermistakeAdapter? = null
|
||||||
private lateinit var customDialogInput: CustomDialogInput
|
private lateinit var customDialogInput: CustomDialogInput
|
||||||
private var listWorker: MutableList<WorkerFromMistake> = ArrayList()
|
private var listWorker: MutableList<WorkerFromMistake> = ArrayList()
|
||||||
|
@ -42,7 +43,6 @@ class WorkermistakeFragment(
|
||||||
private var listMistakes: ArrayList<BarcodeVO> = ArrayList()
|
private var listMistakes: ArrayList<BarcodeVO> = ArrayList()
|
||||||
private var listMistakesAdapter: BarcodeAdapter? = null
|
private var listMistakesAdapter: BarcodeAdapter? = null
|
||||||
private var workerMistakeName: WorkerFromMistake? = null
|
private var workerMistakeName: WorkerFromMistake? = null
|
||||||
|
|
||||||
private val departments = ArrayList<SearchDepartmentModel>()
|
private val departments = ArrayList<SearchDepartmentModel>()
|
||||||
private lateinit var departmentId: String
|
private lateinit var departmentId: String
|
||||||
|
|
||||||
|
@ -58,61 +58,51 @@ class WorkermistakeFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
viewModel.departmentGetHasMistake()
|
||||||
viewModel.department_getHasMistake()
|
|
||||||
|
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
|
|
||||||
binding.filterDepartment.setText(getData(DEPARTMENTMISTAKE))
|
binding.filterDepartment.text = getData(DEPARTMENTMISTAKE)
|
||||||
binding.splashProgress.visibility = View.VISIBLE
|
|
||||||
departmentId = getData(DEPARTMENTMISTAKEID)
|
departmentId = getData(DEPARTMENTMISTAKEID)
|
||||||
|
|
||||||
customDialogList = CustomDialogList(requireContext())
|
customDialogList = CustomDialogList(requireContext())
|
||||||
|
|
||||||
if (!departmentId.isEmpty()) {
|
if (departmentId.isNotEmpty()) {
|
||||||
viewModel.workerGetFromHasMistake(
|
viewModel.workerGetFromHasMistake(
|
||||||
getData(DEPARTMENTMISTAKEID).toInt()
|
getData(DEPARTMENTMISTAKEID).toInt()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.filterDepartment.setOnClickListener {
|
binding.filterDepartment.setOnClickListener {
|
||||||
SimpleSearchDialogCompat(context,
|
SimpleSearchDialogCompat(
|
||||||
|
context,
|
||||||
getString(R.string.departamentos),
|
getString(R.string.departamentos),
|
||||||
getString(R.string.escribirparteNombre),
|
getString(R.string.escribirparteNombre),
|
||||||
null,
|
null,
|
||||||
departments,
|
departments
|
||||||
{ baseSearchDialogCompat, nombre, position ->
|
) { baseSearchDialogCompat, nombre, position ->
|
||||||
|
|
||||||
binding.filterDepartment.setText((nombre.title))
|
|
||||||
|
|
||||||
|
binding.filterDepartment.text = (nombre.title)
|
||||||
saveData(DEPARTMENTMISTAKE, nombre.getDepartmentName())
|
saveData(DEPARTMENTMISTAKE, nombre.getDepartmentName())
|
||||||
saveData(DEPARTMENTMISTAKEID, nombre.getDepartmentId())
|
saveData(DEPARTMENTMISTAKEID, nombre.getDepartmentId())
|
||||||
viewModel.workerGetFromHasMistake(
|
viewModel.workerGetFromHasMistake(
|
||||||
nombre.getDepartmentId()
|
nombre.getDepartmentId()
|
||||||
)
|
)
|
||||||
binding.splashProgress.visibility = View.VISIBLE
|
|
||||||
binding.filterItemFk.isEnabled = true
|
binding.filterItemFk.isEnabled = true
|
||||||
baseSearchDialogCompat.dismiss()
|
baseSearchDialogCompat.dismiss()
|
||||||
}).show()
|
}.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
customDialogInput = CustomDialogInput(requireContext())
|
customDialogInput = CustomDialogInput(requireContext())
|
||||||
customDialog = CustomDialog(requireContext())
|
customDialog = CustomDialog(requireContext())
|
||||||
ma.hideBottomNavigation(View.GONE)
|
ma.hideBottomNavigation(View.GONE)
|
||||||
binding.splashProgress.visibility = View.VISIBLE
|
|
||||||
setToolBar()
|
setToolBar()
|
||||||
setEvents()
|
setEvents()
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setToolBar() {
|
private fun setToolBar() {
|
||||||
|
|
||||||
binding.mainToolbar.toolbarTitle.text = entryPoint
|
binding.mainToolbar.toolbarTitle.text = entryPoint
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setEvents() {
|
private fun setEvents() {
|
||||||
|
@ -141,38 +131,20 @@ class WorkermistakeFragment(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* override fun onPause() {
|
|
||||||
super.onPause()
|
|
||||||
firstVisiblePosition = layoutManager?.findFirstVisibleItemPosition() ?: 0
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/* override fun onResume() {
|
|
||||||
super.onResume()
|
|
||||||
if (binding.workermistakeRecyclerview.layoutManager != null){
|
|
||||||
if (firstVisiblePosition <= listInvetory.size){
|
|
||||||
binding.workermistakeRecyclerview.layoutManager!!.scrollToPosition(firstVisiblePosition)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
override fun observeViewModel() {
|
override fun observeViewModel() {
|
||||||
with(viewModel) {
|
with(viewModel) {
|
||||||
mistakeDepartmentList.observe(viewLifecycleOwner) {
|
mistakeDepartmentList.observe(viewLifecycleOwner) {
|
||||||
binding.splashProgress.visibility = View.GONE
|
|
||||||
createDepartmentList(it.list)
|
createDepartmentList(it.list)
|
||||||
}
|
}
|
||||||
|
|
||||||
workerFromMistakeList.observe(viewLifecycleOwner) {
|
workerFromMistakeList.observe(viewLifecycleOwner) {
|
||||||
binding.splashProgress.visibility = View.GONE
|
|
||||||
createWorkerList(it.list)
|
createWorkerList(it.list)
|
||||||
adapterworker =
|
adapterworker =
|
||||||
WorkermistakeAdapter(listWorker, object : onMistakeWorkerClickListener {
|
WorkermistakeAdapter(listWorker, object : onMistakeWorkerClickListener {
|
||||||
override fun onMistakeWorkerClickListener(item: WorkerFromMistake) {
|
override fun onMistakeWorkerClickListener(item: WorkerFromMistake) {
|
||||||
viewModel.workerMistakeType_get(
|
viewModel.workerMistakeTypeGet(
|
||||||
)
|
)
|
||||||
workerMistakeName =
|
workerMistakeName =
|
||||||
WorkerFromMistake(item.id, item.firstName, item.lastName, true, "")
|
WorkerFromMistake(item.id, item.firstName, item.lastName, true, "")
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
binding.workermistakeRecyclerview.adapter = adapterworker
|
binding.workermistakeRecyclerview.adapter = adapterworker
|
||||||
|
@ -182,40 +154,24 @@ class WorkermistakeFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
mistakeWorkerList.observe(viewLifecycleOwner) {
|
mistakeWorkerList.observe(viewLifecycleOwner) {
|
||||||
binding.splashProgress.visibility = View.GONE
|
|
||||||
showMistakeList(it.list)
|
showMistakeList(it.list)
|
||||||
}
|
}
|
||||||
|
/*responseAddMistake.observe(viewLifecycleOwner) {
|
||||||
responseAddMistake.observe(viewLifecycleOwner) {
|
|
||||||
ma.messageWithSound(
|
ma.messageWithSound(
|
||||||
if (it.isError) {
|
message = getString(R.string.errorCauseRegistered),
|
||||||
if (it.codeError == 403) {
|
it.isError,
|
||||||
getString(R.string.userNotPermission)
|
true,
|
||||||
} else {
|
isToasted = true
|
||||||
it.errorMessage
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
getString(R.string.errorCauseRegistered)
|
|
||||||
}, it.isError, true, isToasted = true
|
|
||||||
)
|
)
|
||||||
}
|
}*/
|
||||||
|
|
||||||
response.observe(viewLifecycleOwner) {
|
|
||||||
if (it.isError) {
|
|
||||||
ma.messageWithSound(it.errorMessage, true, false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showMistakeList(list: List<MistakeType>) {
|
private fun showMistakeList(list: List<MistakeType>) {
|
||||||
binding.splashProgress.visibility = View.GONE
|
|
||||||
listMistakes = ArrayList()
|
listMistakes = ArrayList()
|
||||||
list.forEach {
|
list.forEach {
|
||||||
listMistakes.add(BarcodeVO(code = it.description))
|
listMistakes.add(BarcodeVO(code = it.description))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
customDialogList.setTitle(getString(R.string.errorCause) + workerMistakeName!!.firstName)
|
customDialogList.setTitle(getString(R.string.errorCause) + workerMistakeName!!.firstName)
|
||||||
.setKoButton(
|
.setKoButton(
|
||||||
getString(
|
getString(
|
||||||
|
@ -225,13 +181,12 @@ class WorkermistakeFragment(
|
||||||
customDialogList.dismiss()
|
customDialogList.dismiss()
|
||||||
}.hideDialog().show()
|
}.hideDialog().show()
|
||||||
|
|
||||||
|
|
||||||
listMistakesAdapter =
|
listMistakesAdapter =
|
||||||
BarcodeAdapter(listMistakes, object : OnBarcodeRowClickListener {
|
BarcodeAdapter(listMistakes, object : OnBarcodeRowClickListener {
|
||||||
override fun onBarcodeRowClickListener(item: BarcodeVO) {
|
override fun onBarcodeRowClickListener(item: BarcodeVO) {
|
||||||
list.forEach {
|
list.forEach {
|
||||||
if (it.description == item.code) {
|
if (it.description == item.code) {
|
||||||
viewModel.workerMistake_Add(
|
viewModel.workerMistakeAdd(
|
||||||
vUserFk = workerMistakeName!!.id!!,
|
vUserFk = workerMistakeName!!.id!!,
|
||||||
vTypeFk = it.code
|
vTypeFk = it.code
|
||||||
)
|
)
|
||||||
|
@ -243,7 +198,6 @@ class WorkermistakeFragment(
|
||||||
}, showDelete = false)
|
}, showDelete = false)
|
||||||
|
|
||||||
customDialogList.getRecyclerView().adapter = listMistakesAdapter
|
customDialogList.getRecyclerView().adapter = listMistakesAdapter
|
||||||
|
|
||||||
customDialogList.getRecyclerView().layoutManager =
|
customDialogList.getRecyclerView().layoutManager =
|
||||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||||
|
|
||||||
|
@ -256,6 +210,7 @@ class WorkermistakeFragment(
|
||||||
try {
|
try {
|
||||||
departments.add(SearchDepartmentModel(department.name, department.id))
|
departments.add(SearchDepartmentModel(department.name, department.id))
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
e.message!!.toast(requireContext())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -265,11 +220,11 @@ class WorkermistakeFragment(
|
||||||
listWorker.clear()
|
listWorker.clear()
|
||||||
|
|
||||||
list.forEach { worker ->
|
list.forEach { worker ->
|
||||||
|
|
||||||
if (!worker.isError) {
|
if (!worker.isError) {
|
||||||
try {
|
try {
|
||||||
listWorker.add(worker)
|
listWorker.add(worker)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
e.message!!.toast(requireContext())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -691,6 +691,8 @@
|
||||||
<string name="yes">SI</string>
|
<string name="yes">SI</string>
|
||||||
<string name="no">NO</string>
|
<string name="no">NO</string>
|
||||||
<string name="add">Añadir...</string>
|
<string name="add">Añadir...</string>
|
||||||
|
<string name="surname">Apellidos</string>
|
||||||
|
<string name="confirmReserv">Confirmada reserva</string>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -489,7 +489,7 @@
|
||||||
<string name="workFormDescrip">Proporciona un nombre y url de los servidores a los que la app se conectará</string>
|
<string name="workFormDescrip">Proporciona un nombre y url de los servidores a los que la app se conectará</string>
|
||||||
<string name="silexServer">Servidor Silex</string>
|
<string name="silexServer">Servidor Silex</string>
|
||||||
<string name="salixServer">Servidor Salix</string>
|
<string name="salixServer">Servidor Salix</string>
|
||||||
<string name="name">Nombre</string>
|
<string name="name">Nom</string>
|
||||||
<string name="deleteWorkForm">Borrar forma trabajo</string>
|
<string name="deleteWorkForm">Borrar forma trabajo</string>
|
||||||
<string name="deleteWorkFormConfirmation">¿Desea borrar definitivamente la forma de trabajo?</string>
|
<string name="deleteWorkFormConfirmation">¿Desea borrar definitivamente la forma de trabajo?</string>
|
||||||
<string name="icViewCollection">Ver colección o último ticket</string>
|
<string name="icViewCollection">Ver colección o último ticket</string>
|
||||||
|
@ -691,6 +691,8 @@
|
||||||
<string name="yes">OUI</string>
|
<string name="yes">OUI</string>
|
||||||
<string name="no">NON</string>
|
<string name="no">NON</string>
|
||||||
<string name="add">Añadir...</string>
|
<string name="add">Añadir...</string>
|
||||||
|
<string name="surname">Nom de famille</string>
|
||||||
|
<string name="confirmReserv">Confirmada reserva</string>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -489,7 +489,7 @@
|
||||||
<string name="workFormDescrip">Proporciona un nombre y url de los servidores a los que la app se conectará</string>
|
<string name="workFormDescrip">Proporciona un nombre y url de los servidores a los que la app se conectará</string>
|
||||||
<string name="silexServer">Servidor Silex</string>
|
<string name="silexServer">Servidor Silex</string>
|
||||||
<string name="salixServer">Servidor Salix</string>
|
<string name="salixServer">Servidor Salix</string>
|
||||||
<string name="name">Nombre</string>
|
<string name="name">Nome</string>
|
||||||
<string name="deleteWorkForm">Borrar forma trabajo</string>
|
<string name="deleteWorkForm">Borrar forma trabajo</string>
|
||||||
<string name="deleteWorkFormConfirmation">¿Desea borrar definitivamente la forma de trabajo?</string>
|
<string name="deleteWorkFormConfirmation">¿Desea borrar definitivamente la forma de trabajo?</string>
|
||||||
<string name="icViewCollection">Ver colección o último ticket</string>
|
<string name="icViewCollection">Ver colección o último ticket</string>
|
||||||
|
@ -691,6 +691,8 @@
|
||||||
<string name="yes">SIM</string>
|
<string name="yes">SIM</string>
|
||||||
<string name="no">NÃO</string>
|
<string name="no">NÃO</string>
|
||||||
<string name="add">Añadir...</string>
|
<string name="add">Añadir...</string>
|
||||||
|
<string name="surname">Sobrenome</string>
|
||||||
|
<string name="confirmReserv">Confirmada reserva</string>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -690,5 +690,7 @@
|
||||||
<string name="yes">YES</string>
|
<string name="yes">YES</string>
|
||||||
<string name="no">NO</string>
|
<string name="no">NO</string>
|
||||||
<string name="add">Añadir...</string>
|
<string name="add">Añadir...</string>
|
||||||
|
<string name="surname">Surname</string>
|
||||||
|
<string name="confirmReserv">Confirmada reserva</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in New Issue