From aa04349845358f3ffc14616b6155521a30f2b08e Mon Sep 17 00:00:00 2001 From: Sergio De la torre Date: Tue, 8 Oct 2024 08:20:48 +0200 Subject: [PATCH] feat: refs #8085 restaurant --- .../pasillero/fragment/PasilleroViewModel.kt | 39 +++-- .../feature/restaurant/RestaurantActivity.kt | 61 +++++++ app/src/main/res/drawable/ic_restaurant.xml | 10 ++ .../res/layout/activity_restaurant_view.xml | 151 ++++++++++++++++++ 4 files changed, 251 insertions(+), 10 deletions(-) create mode 100644 app/src/main/java/es/verdnatura/presentation/view/feature/restaurant/RestaurantActivity.kt create mode 100644 app/src/main/res/drawable/ic_restaurant.xml create mode 100644 app/src/main/res/layout/activity_restaurant_view.xml diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt index fb9eed9a..2db81abc 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt @@ -264,23 +264,22 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) { ) ) - //val working_in_testMenu = false - if (userId == 19591) { + if (userId == 19591 || isOnReservationMode) { _pasillerositem.add( PasillerosItemVO( R.drawable.ic_picker_ui, R.string.sacador_test, R.string.sacador_test ) ) - if (userId == 19591) { - _pasillerositem.add( - PasillerosItemVO( - R.drawable.ic_picker_helper, - R.string.pickerHelper, - R.string.pickerHelperDescrip - ) + } + if (userId == 19591) { + _pasillerositem.add( + PasillerosItemVO( + R.drawable.ic_picker_helper, + R.string.pickerHelper, + R.string.pickerHelperDescrip ) - } + ) } _pasillerositem.add( @@ -423,6 +422,17 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) { ) ) + /* Para preControl de reservas, faltan cosas no se puede todavía. + if (userId == 19591) { + _pasillerositem.add( + PasillerosItemVO( + R.drawable.ic_previous_precontrol, R.string.preControlNew, + + R.string.preControlNew + ) + ) + }*/ + _pasillerositem.add( PasillerosItemVO( R.drawable.ic_ticket, R.string.titleShowTicket, R.string.titleShowTicketDescrip @@ -441,6 +451,7 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) { ) ) + _pasillerositem.add( PasillerosItemVO( R.drawable.ic_review_boxpicking, @@ -470,6 +481,14 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) { fun inititializeDefaultOther() { + _pasillerositem.add( + PasillerosItemVO( + R.drawable.ic_restaurant, + R.string.titleRestaurant, + R.string.resturantDescrip + ) + ) + _pasillerositem.add( PasillerosItemVO( R.drawable.ic_packaging, R.string.titlePackingHolland, R.string.titleUbicatorDescrip diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/restaurant/RestaurantActivity.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/restaurant/RestaurantActivity.kt new file mode 100644 index 00000000..3e95ea3e --- /dev/null +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/restaurant/RestaurantActivity.kt @@ -0,0 +1,61 @@ +package es.verdnatura.presentation.view.feature.restaurant + +import android.view.View +import android.widget.Button +import com.google.gson.Gson +import com.google.zxing.BarcodeFormat +import com.journeyapps.barcodescanner.BarcodeEncoder +import es.verdnatura.R +import es.verdnatura.databinding.ActivityRestaurantViewBinding +import es.verdnatura.domain.toast +import es.verdnatura.presentation.base.BaseActivity +import es.verdnatura.presentation.view.feature.restaurant.model.UserMenu + +class RestaurantActivity : BaseActivity() { + + override fun getLayoutId(): Int = R.layout.activity_restaurant_view + + override fun init() { + binding.mainToolbar.toolbarTitle.text = getString(R.string.selectMenu) + /* try { + binding.imgView.loadUrl(intent.getStringExtra(getString(R.string.url))!!) + } catch (ex: Exception) { + getString(R.string.errorImage).toast(this) + finish() + }*/ + + binding.mainToolbar.backButton.setOnClickListener { + finish() + } + } + + fun generateQr(view: View) { + binding.imageQr.visibility = View.VISIBLE + binding.txtOption.visibility = View.VISIBLE + binding.txtOption.text = (view as Button).text.toString() + val userMenu = UserMenu( + user = mobileApplication.userId!!, + menu_id = view.tag.toString().toInt(), + menu = view.text.toString(), + name = mobileApplication.userName!! + ) + try { + val barcodeEncoder = BarcodeEncoder() + val bitmap = barcodeEncoder.encodeBitmap( + Gson().toJson(userMenu), + BarcodeFormat.QR_CODE, + 400, + 400 + ) + val imageViewQrCode = binding.imageQr + imageViewQrCode.setImageBitmap(bitmap) + } catch (e: Exception) { + e.toString().toast(this) + } + + } + + private fun showQr() { + + } +} \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_restaurant.xml b/app/src/main/res/drawable/ic_restaurant.xml new file mode 100644 index 00000000..b6a55b6c --- /dev/null +++ b/app/src/main/res/drawable/ic_restaurant.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/layout/activity_restaurant_view.xml b/app/src/main/res/layout/activity_restaurant_view.xml new file mode 100644 index 00000000..dd031854 --- /dev/null +++ b/app/src/main/res/layout/activity_restaurant_view.xml @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + +