From 83cd10e83dbeaacb26ef879d86853549d479abcc Mon Sep 17 00:00:00 2001 From: Sergio De la torre Date: Thu, 23 Feb 2023 08:36:57 +0100 Subject: [PATCH] refs #4679 menus reparto --- .idea/assetWizardSettings.xml | 4 +- .idea/misc.xml | 2 +- .idea/workspace.xml | 70 ++++--- .../java/es/verdnatura/di/viewModelModule.kt | 11 +- .../es/verdnatura/domain/VerdnaturaService.kt | 8 +- .../view/feature/delivery/InfoFragment.kt | 65 ++++++ .../view/feature/delivery/InfoViewModel.kt | 43 ++++ .../feature/delivery/model/InfoCompany.kt | 10 + .../feature/main/activity/MainActivity.kt | 18 +- .../pasillero/fragment/PasilleroFragment.kt | 2 + .../pasillero/fragment/PasilleroViewModel.kt | 37 ++++ app/src/main/res/drawable/expedition_find.xml | 8 + app/src/main/res/drawable/ic_info.xml | 8 + app/src/main/res/layout/fragment_info.xml | 195 ++++++++++++++++++ app/src/main/res/values-es/strings.xml | 7 +- app/src/main/res/values/strings.xml | 6 + 16 files changed, 453 insertions(+), 41 deletions(-) create mode 100644 app/src/main/java/es/verdnatura/presentation/view/feature/delivery/InfoFragment.kt create mode 100644 app/src/main/java/es/verdnatura/presentation/view/feature/delivery/InfoViewModel.kt create mode 100644 app/src/main/java/es/verdnatura/presentation/view/feature/delivery/model/InfoCompany.kt create mode 100644 app/src/main/res/drawable/expedition_find.xml create mode 100644 app/src/main/res/drawable/ic_info.xml create mode 100644 app/src/main/res/layout/fragment_info.xml diff --git a/.idea/assetWizardSettings.xml b/.idea/assetWizardSettings.xml index caa3055d..ca43f75b 100644 --- a/.idea/assetWizardSettings.xml +++ b/.idea/assetWizardSettings.xml @@ -19,8 +19,8 @@ diff --git a/.idea/misc.xml b/.idea/misc.xml index 97b3f254..63d3027a 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -276,7 +276,7 @@ - + diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 2b2b18a1..6f656965 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -83,20 +83,23 @@ - - - - - - - + + + + + + + + + - - - - - - + + + + + + + - { - "keyToString": { - "ApkExportedModule": "Gestor_Almacén.app", - "ExportApk.ApkPathForGestor_Almacén.app": "C:\\Users\\sergiodt\\AndroidStudioProjects\\vn-warehouseManager\\app", - "RunOnceActivity.cidr.known.project.marker": "true", - "cidr.known.project.marker": "true", - "com.google.services.firebase.aqiPopupShown": "true", - "last_opened_file_path": "C:/Users/sergiodt/proyectos/Rocket.Chat.ReactNative/android/app", - "project.structure.last.edited": "Modules", - "project.structure.proportion": "0.17", - "project.structure.side.proportion": "0.2", - "run.code.analysis.last.selected.profile": "pProject Default", - "settings.editor.selected.configurable": "reference.settingsdialog.project.gradle" + +}]]> - + + - @@ -287,6 +292,7 @@ + diff --git a/app/src/main/java/es/verdnatura/di/viewModelModule.kt b/app/src/main/java/es/verdnatura/di/viewModelModule.kt index 1717a803..038f5c8e 100644 --- a/app/src/main/java/es/verdnatura/di/viewModelModule.kt +++ b/app/src/main/java/es/verdnatura/di/viewModelModule.kt @@ -1,4 +1,5 @@ package es.verdnatura.di + import es.verdnatura.presentation.view.feature.ajustes.fragment.AjustesViewModel import es.verdnatura.presentation.view.feature.articulo.fragment.ItemCardViewModel import es.verdnatura.presentation.view.feature.buffer.fragment.BufferFragmentViewModel @@ -9,6 +10,7 @@ import es.verdnatura.presentation.view.feature.claim.fragment.ClaimViewModel import es.verdnatura.presentation.view.feature.collection.fragment.CollectionViewModel import es.verdnatura.presentation.view.feature.controlador.fragment.ControladorViewModel import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoViewModel +import es.verdnatura.presentation.view.feature.delivery.InfoViewModel import es.verdnatura.presentation.view.feature.diadeventa.fragment.DayOfSaleViewModel import es.verdnatura.presentation.view.feature.faltas.fragment.FaltasViewModel import es.verdnatura.presentation.view.feature.historicoarticulo.fragment.HistoricoArticuloViewModel @@ -36,9 +38,9 @@ import org.koin.dsl.module val viewModelModule = module { - /* viewModel { - WorkermistakeViewModel() - }*/ + /* viewModel { + WorkermistakeViewModel() + }*/ // Login viewModel { @@ -199,4 +201,7 @@ val viewModelModule = module { viewModel { PackagingViewModel(androidContext()) } + viewModel { + InfoViewModel(androidContext()) + } } \ No newline at end of file diff --git a/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt b/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt index 1adf6cff..8e22f660 100644 --- a/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt +++ b/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt @@ -12,6 +12,7 @@ import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO import es.verdnatura.presentation.view.feature.calidad.model.ItemBuyerVO import es.verdnatura.presentation.view.feature.collection.SalesModified +import es.verdnatura.presentation.view.feature.delivery.model.DeliveryInfo import es.verdnatura.presentation.view.feature.diadeventa.model.ItemShelvingSaleDate import es.verdnatura.presentation.view.feature.faltas.model.ItemFaltasVO import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoVO @@ -876,4 +877,9 @@ interface VerdnaturaService { ): Call> -} + @POST("delivery/getInfoCompany")//NO SALIX + fun getInfoCompany( + @Body vararg params: Any + ): + Call +} \ No newline at end of file diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/InfoFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/InfoFragment.kt new file mode 100644 index 00000000..ccacda33 --- /dev/null +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/InfoFragment.kt @@ -0,0 +1,65 @@ +package es.verdnatura.presentation.view.feature.delivery + +import android.content.SharedPreferences +import android.util.Log.d +import android.view.View +import es.verdnatura.R +import es.verdnatura.databinding.FragmentInfoBinding +import es.verdnatura.presentation.base.BaseFragment +import es.verdnatura.presentation.view.component.CustomDialog +import es.verdnatura.presentation.view.feature.ajustes.adapter.AjustesAdapter +import es.verdnatura.presentation.view.feature.ajustes.model.Printers +import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO +import es.verdnatura.presentation.view.feature.ajustes.model.Train +import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType +import es.verdnatura.presentation.view.feature.delivery.model.DeliveryInfo + +class InfoFragment(var title: String) : + BaseFragment(InfoViewModel::class) { + + private lateinit var customDialog: CustomDialog + private var sectorListVO: List = listOf() + private var printersList: List = listOf() + private var trainsList: List = listOf() + private var prefs: SharedPreferences? = null + private var ajustesAdapter: AjustesAdapter? = null + private var isWorkerAllowed: Boolean = false + private var itemPackingList: List = listOf() + private var messagePrinter: String? = null + + companion object { + fun newInstance(title: String) = InfoFragment(title) + + } + + override fun getLayoutId(): Int = R.layout.fragment_info + + override fun init() { + + super.init() + + binding.mainToolbar.toolbarTitle.text = title + binding.splashProgress.visibility = View.VISIBLE + viewModel.getInfoCompany(getDataInt(USER)) + + + } + + + override fun observeViewModel() { + with(viewModel) { + + + companyInfo.observe(viewLifecycleOwner) { + binding.splashProgress.visibility = View.GONE + + d("VERDNATURA::", "" + it.toString()) + //saveDataInt(NUMBEROFWAGONS, it.response!!) + + } + + + } + + } +} diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/InfoViewModel.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/InfoViewModel.kt new file mode 100644 index 00000000..370730f1 --- /dev/null +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/InfoViewModel.kt @@ -0,0 +1,43 @@ +package es.verdnatura.presentation.view.feature.delivery + + +import android.content.Context +import androidx.lifecycle.LiveData +import androidx.lifecycle.MutableLiveData +import es.verdnatura.domain.SilexCallback +import es.verdnatura.presentation.base.BaseViewModel +import es.verdnatura.presentation.view.feature.delivery.model.DeliveryInfo +import retrofit2.Response + + +class InfoViewModel(val context: Context) : BaseViewModel(context) { + + + private val _companyInfo by lazy { MutableLiveData() } + val companyInfo: LiveData = _companyInfo + + fun getInfoCompany( + userId:Int + ) { + + silex.getInfoCompany(userId) + .enqueue(object : SilexCallback(context) { + + override fun onSuccess(response: Response) { + + _companyInfo.value = + DeliveryInfo(response.body()!!) + + } + + override fun onError(t: Throwable) { + _companyInfo.value = + DeliveryInfo() + super.onError(t) + } + }) + } + + +} + diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/model/InfoCompany.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/model/InfoCompany.kt new file mode 100644 index 00000000..b240055a --- /dev/null +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/model/InfoCompany.kt @@ -0,0 +1,10 @@ +package es.verdnatura.presentation.view.feature.delivery.model + + +class DeliveryInfo( + private val name: DeliveryInfo? = null, + private val street: String? = null, + private val city: String? = null, + private val nif: String? = null, + private val postCode: String? = null +) \ No newline at end of file diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt index bc4094c7..d8689414 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt @@ -34,6 +34,7 @@ import es.verdnatura.presentation.view.feature.controlador.fragment.ControladorF import es.verdnatura.presentation.view.feature.controlador.fragment.WebFragment import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoFragment import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoUsuarioFragment +import es.verdnatura.presentation.view.feature.delivery.InfoFragment import es.verdnatura.presentation.view.feature.diadeventa.fragment.DayOfSaleFragment import es.verdnatura.presentation.view.feature.faltas.fragment.FaltasFragment import es.verdnatura.presentation.view.feature.historicoarticulo.fragment.HistoricoArticuloFragment @@ -532,7 +533,22 @@ class MainActivity : BaseActivity(), OnPasillerosItemClickL addFragmentOnTop(PackagingSummaryFragment.newInstance(item.title)) } - getString(R.string.testing) -> { + getString(R.string.titleDelivery) -> { + addFragmentOnTop( + PasilleroFragment.newInstance( + getString(R.string.titleDelivery), + isInitMenu = false + ) + ) + } + getString(R.string.titleInfo) -> { + addFragmentOnTop( + InfoFragment.newInstance(item.title)) + + } + + + getString(R.string.testing) -> { addFragmentOnTop(testPrint.newInstance(item.title)) } } diff --git a/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroFragment.kt b/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroFragment.kt index 4cbe8fbc..0c059629 100644 --- a/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroFragment.kt +++ b/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroFragment.kt @@ -81,6 +81,8 @@ class PasilleroFragment( getString(R.string.titleBufferManegement) -> viewModel.inititializeDefaultBuffer() getString(R.string.main) -> viewModel.inititializeDefaultDataInit() getString(R.string.titleClaims) -> viewModel.inititializeDefaultClaim() + getString(R.string.titleDelivery) -> viewModel.inititializeDefaultDelivery() + } 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 ccfbbd76..6c4dabb0 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 @@ -510,6 +510,16 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) { ) ) + //#tarea4679 + _pasillerositem.add( + PasillerosItemVO( + 6, + R.drawable.ic_delivery, + contextApp.getString(R.string.titleDelivery), + R.string.titleDelivery, + contextApp.getString(R.string.titleDeliveryDescrip) + ) + ) //#tarea4021 /* _pasillerositem.add( @@ -551,5 +561,32 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) { ) + } + fun inititializeDefaultDelivery() { + + _pasillerositem.add( + PasillerosItemVO( + 30, + R.drawable.expedition_find, + contextApp.getString(R.string.titleLog), + R.string.titleLog, + contextApp.getString( + R.string.titleLogDescrip + ) + ) + ) + _pasillerositem.add( + PasillerosItemVO( + 30, + R.drawable.ic_info, + contextApp.getString(R.string.titleInfo), + R.string.titleInfo, + contextApp.getString( + R.string.titleInfoDescription + ) + ) + ) + + } } diff --git a/app/src/main/res/drawable/expedition_find.xml b/app/src/main/res/drawable/expedition_find.xml new file mode 100644 index 00000000..87b80ee0 --- /dev/null +++ b/app/src/main/res/drawable/expedition_find.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_info.xml b/app/src/main/res/drawable/ic_info.xml new file mode 100644 index 00000000..69588874 --- /dev/null +++ b/app/src/main/res/drawable/ic_info.xml @@ -0,0 +1,8 @@ + + + diff --git a/app/src/main/res/layout/fragment_info.xml b/app/src/main/res/layout/fragment_info.xml new file mode 100644 index 00000000..007814c5 --- /dev/null +++ b/app/src/main/res/layout/fragment_info.xml @@ -0,0 +1,195 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 640a51f3..2ac3f691 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -193,7 +193,6 @@ Problemas con la velocidad de internet. No se puede usar la voz Permite aparcar ticket/carro Permite dejar el vehículo - Genera colección para sacar Ver filtro Ver movimientos de Faltas @@ -530,5 +529,11 @@ Autoconsumo Autoconsumo Permite consumo de materiales del almacén + Reparto + Accede a las opciones de reparto + Ver datos expedición + Ver datos empresa + Muestra información empresa + Log y ruta de una expedición diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9f4910ea..e6b142a1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -166,6 +166,9 @@ Packing mistake Find department Claim Ubication + Show company information + Show company information + Show data expedition Claims done successful Settings @@ -368,6 +371,7 @@ Buffer management Claims Suppliers + Delivery Packaging Observations Summary @@ -471,6 +475,8 @@ Access the palletizers menu: palletize, buffer… Access the claims menu Access the packaging menu + Access to the delivery menu + Show log and route from expedition Claims Location Error building collection. Error description: Main