feat: regularizar Parking #7817

This commit is contained in:
Sergio De la torre 2024-09-02 07:50:39 +02:00
parent f3882c7f9a
commit f569c45f80
3 changed files with 19 additions and 12 deletions

View File

@ -42,8 +42,8 @@ fun EditText.toInt(): Int {
}
fun String.isParking(): Boolean {
val regex = Regex("[\\S-\\S]{5}")
return regex.matches(this)
val regex = Regex("^[^ ]+-[^ ]+$")
return this.length > 4 && regex.matches(this)
}
fun String.isShelving(): Boolean {
val regex = Regex("\\S{0,4}")

View File

@ -48,15 +48,25 @@ class ExpeditionPalletDetailFragment(
override fun init() {
customDialog = CustomDialog(requireContext())
binding.expeditionPalletDetailPallet.text =
getString(R.string.pallet) + " " + itemPallet!!.Pallet
buildString {
append(getString(R.string.pallet))
append(" ")
append(itemPallet!!.Pallet)
}
ma.hideBottomNavigation(View.GONE)
binding.mainToolbar.toolbarTitle.text =
itemExpeditionTruckVO!!.eta.toString() + " " + if (itemExpeditionTruckVO!!.Destino.isNullOrEmpty()) {
buildString {
append(itemExpeditionTruckVO!!.eta)
append(" ")
append(
if (itemExpeditionTruckVO!!.Destino.isNullOrEmpty()) {
itemExpeditionTruckVO!!.description
} else {
itemExpeditionTruckVO!!.Destino
}
)
}
setToolBar()
setEvents()

View File

@ -6,6 +6,7 @@ import android.view.inputmethod.EditorInfo
import androidx.recyclerview.widget.LinearLayoutManager
import es.verdnatura.R
import es.verdnatura.databinding.FragmentParkingBinding
import es.verdnatura.domain.isParking
import es.verdnatura.domain.toast
import es.verdnatura.presentation.base.BaseFragment
import es.verdnatura.presentation.common.OnBarcodeRowClickListener
@ -103,7 +104,6 @@ class ParkingFragment(var menuOrigin: String) :
override fun onBarcodeRowClickListener(item: BarcodeVO) {
try {
val position = scanerList.indexOf(item)
println("parking $position")
if (position != -1) {
scanerList.removeAt(position)
adapter!!.notifyItemRangeChanged(position,scanerList.size-position+1)
@ -121,11 +121,8 @@ class ParkingFragment(var menuOrigin: String) :
}
private fun checkScan(txtScan: String) {
println("txtScan $txtScan")
var isParking = false
if (txtScan.trim().length == 4 && isLetter(txtScan.substring(txtScan.length - 1)) || txtScan.contains(
"-"
)
if (txtScan.isParking()
) {
isParking = true
}