diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a93b6fe9..958b01ee 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -83,12 +83,8 @@
-
-
+
-
-
-
@@ -402,13 +398,6 @@
1618825571576
-
- 1662699501924
-
-
-
- 1662699501924
-
1662982877783
@@ -745,7 +734,14 @@
1679575710293
-
+
+ 1679905259957
+
+
+
+ 1679905259957
+
+
@@ -846,7 +842,6 @@
-
@@ -871,7 +866,8 @@
-
+
+
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/InitPreSacadorFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/InitPreSacadorFragment.kt
index 8f11fad1..884cbadd 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/InitPreSacadorFragment.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/InitPreSacadorFragment.kt
@@ -4,6 +4,7 @@ import android.content.Context
import android.graphics.drawable.Drawable
import android.os.Build
import android.view.View
+import android.view.inputmethod.EditorInfo
import android.widget.ImageView
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
@@ -84,8 +85,8 @@ class InitPreSacadorFragment(
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
iconAdd.tooltipText = getTooltip(R.drawable.ic_add_black_24dp)
- // Tarea 4731
- // iconPrint.tooltipText = getTooltip(R.drawable.ic_print_black_24dp)
+ // Tarea 4731
+ // iconPrint.tooltipText = getTooltip(R.drawable.ic_print_black_24dp)
}
@@ -113,6 +114,18 @@ class InitPreSacadorFragment(
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
}
+ private fun print() {
+ if (ma.havePrinter()) {
+ binding.splashProgress.visibility = View.VISIBLE
+ viewModel.ticket_printLabelPrevious(customDialogInput.getValue().toInt())
+ (getString(R.string.Imprimiendo) + getData(PRINTERNAME)).toast(
+ requireContext()
+ )
+ } else {
+ getString(R.string.selectPrinter).toast(requireContext())
+ }
+ }
+
private fun showPrintPrevious() {
customDialogInput.setInputText()
@@ -121,19 +134,38 @@ class InitPreSacadorFragment(
.setValue("")
.setOkButton(getString(R.string.print)) {
try {
- binding.splashProgress.visibility = View.VISIBLE
- viewModel.ticket_printLabelPrevious(customDialogInput.getValue().toInt())
- (getString(R.string.Imprimiendo) + getData(PRINTERNAME)).toast(
- requireContext())
+ if (customDialogInput.getValue().isNotEmpty()
+ ) {
+ print()
+ }
} catch (ex: Exception) {
-
+ getString(R.string.errorInput)
}
- customDialogInput.dismiss()
+ customDialogInput.setValue("")
}.setKoButton(getString(R.string.cancel)) {
customDialogInput.dismiss()
}.show()
customDialogInput.setFocusText()
+
+
+ customDialogInput.setFocusText()
+ ma.hideKeyboard(customDialogInput.getEditText())
+
+ customDialogInput.getEditText().setOnEditorActionListener { _, actionId, _ ->
+ if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5 || actionId == 6) {
+
+ if (customDialogInput.getValue().isNotEmpty()
+ ) {
+ print()
+ }
+
+ return@setOnEditorActionListener true
+ }
+ false
+ }
+
+
}
private fun setEvents() {
diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorViewModel.kt
index 2ab5a970..55404a7b 100644
--- a/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorViewModel.kt
+++ b/app/src/main/java/es/verdnatura/presentation/view/feature/presacador/fragment/PreSacadorViewModel.kt
@@ -456,9 +456,9 @@ class PreSacadorViewModel(val context: Context) : BaseViewModel(context) {
}
- fun ticket_printLabelPrevious(saleGroup: Int) {
+ fun ticket_printLabelPrevious(ticketFk: Int) {
- silex.ticket_printLabelPrevious(saleGroup).enqueue(object : SilexCallback(context) {
+ silex.ticket_printLabelPrevious(ticketFk).enqueue(object : SilexCallback(context) {
override fun onError(t: Throwable) {
_response.value = ResponseItemVO(
isError = true,
diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml
index a7e63e28..3e18a1c3 100644
--- a/app/src/main/res/values-es/strings.xml
+++ b/app/src/main/res/values-es/strings.xml
@@ -548,5 +548,6 @@
No es posible actualizar. Problema con la descarga de la app
Introduce el número de previa a imprimir
Imprimir
+ Elemento introducido no válido
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index cbe3a343..4ef9ebb7 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -242,6 +242,7 @@
Information
Accept
You have to select a printer
+ Input no valid
New truck
PScan:
Shelvings saved