feat: refs #8085 restaurant

This commit is contained in:
Sergio De la torre 2024-10-08 08:20:48 +02:00
parent c4bbffc98f
commit aa04349845
4 changed files with 251 additions and 10 deletions

View File

@ -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

View File

@ -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<ActivityRestaurantViewBinding>() {
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() {
}
}

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorPrimary">
<path
android:fillColor="@android:color/white"
android:pathData="M280,880L280,514Q229,500 194.5,458Q160,416 160,360L160,80L240,80L240,360L280,360L280,80L360,80L360,360L400,360L400,80L480,80L480,360Q480,416 445.5,458Q411,500 360,514L360,880L280,880ZM680,880L680,560L560,560L560,280Q560,197 618.5,138.5Q677,80 760,80L760,880L680,880Z"/>
</vector>

View File

@ -0,0 +1,151 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/verdnatura_black">
<include
android:id="@+id/main_toolbar"
layout="@layout/toolbar_fragment"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/scan_input"
style="@style/ScanLineTextSearch"
android:layout_width="match_parent"
android:hint="@string/Escaneaetiqueta"
android:inputType="textVisiblePassword"
android:lines="1"
android:maxLines="1"
android:textColorHint="@android:color/white"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/main_toolbar" /> <!-- Ajustar a la toolbar -->
<!-- Primer botón debajo del scan_input -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/scan_input">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/scan_input">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<Button
android:id="@+id/button1"
style="@style/DefaultButton.DynamicButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/layout_margin_min"
android:onClick="generateQr"
android:tag="1"
android:text="@string/lunch"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/scan_input" />
<Button
android:id="@+id/button2"
style="@style/DefaultButton.DynamicButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_bottom_dynamic"
android:onClick="generateQr"
android:tag="2"
android:text="@string/halfLunch"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/scan_input" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<Button
android:id="@+id/button3"
style="@style/DefaultButton.DynamicButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/layout_margin_min"
android:onClick="generateQr"
android:tag="3"
android:text="@string/menu"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/scan_input" />
<Button
android:id="@+id/button4"
style="@style/DefaultButton.DynamicButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/margin_bottom_dynamic"
android:onClick="generateQr"
android:tag="4"
android:text="@string/halfMenu"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/scan_input" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="@dimen/layout_margin_prepicker"
android:layout_weight="1"
android:baselineAligned="false"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/scan_input">
<ImageView
android:id="@+id/imageQr"
android:layout_width="match_parent"
android:layout_height="336dp"
android:visibility="invisible" />
<TextView
android:id="@+id/txtOption"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="@color/verdnatura_white"
android:visibility="invisible">
</TextView>
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>