refs #4677 delivery→picking
This commit is contained in:
parent
5523041678
commit
0267427113
|
@ -19,8 +19,8 @@
|
|||
<option name="values">
|
||||
<map>
|
||||
<entry key="assetSourceType" value="FILE" />
|
||||
<entry key="outputName" value="reset_all" />
|
||||
<entry key="sourceFile" value="C:\Users\sergiodt\Downloads\restart_alt_FILL0_wght400_GRAD0_opsz48.svg" />
|
||||
<entry key="outputName" value="ic_sort" />
|
||||
<entry key="sourceFile" value="C:\Users\sergiodt\Downloads\wand.svg" />
|
||||
</map>
|
||||
</option>
|
||||
</PersistentState>
|
||||
|
|
|
@ -82,39 +82,52 @@
|
|||
</select>
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="fa688d1c-dbee-4864-9e33-4d84ef9afca8" name="Default Changelist" comment="refs #5891 inventoryParking">
|
||||
<change afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/component/CustomDialogInputNotes.kt" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/adapters/TicketAdapter.kt" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/fragments/TicketsFragment.kt" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/model/ClientTicket.kt" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/adapter/AutomaticAdapterTEST.kt" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/fragment/AutomaticAddItemFragmentTEST.kt" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app/src/main/res/drawable/ic_location.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app/src/main/res/drawable/ic_note.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app/src/main/res/drawable/ic_note_add.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app/src/main/res/drawable/ic_phone.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app/src/main/res/layout/component_custom_edit_dialog_notes.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app/src/main/res/layout/fragment_route_config.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app/src/main/res/layout/fragment_tickets.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app/src/main/res/layout/item_ticket_row.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app/src/main/res/layout/item_ticket_sub_row.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/deploymentTargetDropDown.xml" beforeDir="false" />
|
||||
<list default="true" id="fa688d1c-dbee-4864-9e33-4d84ef9afca8" name="Default Changelist" comment="refs #5996 cmrAdd">
|
||||
<change afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/SalixCallback.kt" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/activity/SignedActivity.kt" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app/src/main/res/drawable/ic_sign.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app/src/main/res/drawable/ic_sign_ticket.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app/src/main/res/drawable/ic_sort.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/app/src/main/res/layout/activity_sign.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/assetWizardSettings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/assetWizardSettings.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/beta/release/output-metadata.json" beforeDir="false" afterPath="$PROJECT_DIR$/app/beta/release/output-metadata.json" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/build.gradle" beforeDir="false" afterPath="$PROJECT_DIR$/app/build.gradle" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/AndroidManifest.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/AndroidManifest.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/db/database.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/db/database.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/SalixService.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/SalixService.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/SilexCallback.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/SilexCallback.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/VerdnaturaService.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/base/BaseActivity.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/base/BaseActivity.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/base/BaseFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/base/BaseFragment.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/common/ToolBarAdapterTooltip.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/common/ToolBarAdapterTooltip.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/common/UICallbacks.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/common/UICallbacks.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/common/UIExtensions.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/common/UIExtensions.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoUsuarioFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/controlvehiculo/fragment/ControlVehiculoUsuarioFragment.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/adapters/RouteAdapter.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/adapters/RouteAdapter.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/adapters/TicketAdapter.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/adapters/TicketAdapter.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/fragments/LoadUnloadFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/fragments/LoadUnloadFragment.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/fragments/RoutesFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/fragments/RoutesFragment.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/fragments/TicketsFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/fragments/TicketsFragment.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/model/ClientTicket.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/model/ClientTicket.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/model/InfoCompany.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/model/InfoCompany.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/viewmodels/DatabaseViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/viewmodels/DatabaseViewModel.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/viewmodels/DeliveryViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/viewmodels/DeliveryViewModel.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryParkingFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryParkingFragment.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/fragment/InventaryViewModel.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/model/ItemInventaryVO.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/inventario/model/ItemInventaryVO.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/pasillero/fragment/PasilleroViewModel.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/res/layout/item_escaner_row.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/item_escaner_row.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/packaging/fragment/SupplierFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/packaging/fragment/SupplierFragment.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/res/layout/fragment_inventory_parking.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/fragment_inventory_parking.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/res/layout/fragment_tickets.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/fragment_tickets.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/res/layout/item_route_row.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/item_route_row.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/res/layout/item_ticket_row.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/item_ticket_row.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/res/layout/item_ticket_sub_row.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/item_ticket_sub_row.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/res/values-es/strings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values-es/strings.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/res/values-fr/strings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values-fr/strings.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/res/values-pt/strings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values-pt/strings.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/res/values/strings.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values/strings.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/res/values/styles.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/values/styles.xml" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -270,41 +283,41 @@
|
|||
<option name="showLibraryContents" value="true" />
|
||||
<option name="showMembers" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"ApkExportedModule": "Gestor_Almacén.app",
|
||||
"ExportApk.ApkPathForGestor_Almacén.app": "C:\\Users\\sergiodt\\AndroidStudioProjects\\vn-warehouseManager\\app",
|
||||
"PROJECT_TRUSTED_KEY": "true",
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.cidr.known.project.marker": "true",
|
||||
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||
"ScreenRecorder.SavePath": "C:\\Users\\sergiodt\\device-2023-03-17-114045.mp4",
|
||||
"android-custom-viewC:/Users/sergiodt/.gradle/caches/modules-2/files-2.1/androidx.recyclerview/recyclerview/1.2.1/f0f93e67af3f7417bdd560d5142f6dec4fe629c3/recyclerview-1.2.1-sources.jar!/androidx/recyclerview/widget/RecyclerView.java_SELECTED": "RecyclerView",
|
||||
"cidr.known.project.marker": "true",
|
||||
"com.developerphil.adbidea.selecteddevices": "21114523025303",
|
||||
"com.google.services.firebase.aqiPopupShown": "true",
|
||||
"last_directory_selection": "C:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable",
|
||||
"last_opened_file_path": "C:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout",
|
||||
"project.structure.last.edited": "Project",
|
||||
"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"
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"ApkExportedModule": "Gestor_Almacén.app",
|
||||
"ExportApk.ApkPathForGestor_Almacén.app": "C:\\Users\\sergiodt\\AndroidStudioProjects\\vn-warehouseManager\\app",
|
||||
"PROJECT_TRUSTED_KEY": "true",
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.cidr.known.project.marker": "true",
|
||||
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||
"ScreenRecorder.SavePath": "C:\\Users\\sergiodt\\device-2023-03-17-114045.mp4",
|
||||
"android-custom-viewC:/Users/sergiodt/.gradle/caches/modules-2/files-2.1/androidx.recyclerview/recyclerview/1.2.1/f0f93e67af3f7417bdd560d5142f6dec4fe629c3/recyclerview-1.2.1-sources.jar!/androidx/recyclerview/widget/RecyclerView.java_SELECTED": "RecyclerView",
|
||||
"cidr.known.project.marker": "true",
|
||||
"com.developerphil.adbidea.selecteddevices": "21114523025303",
|
||||
"com.google.services.firebase.aqiPopupShown": "true",
|
||||
"last_directory_selection": "C:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable",
|
||||
"last_opened_file_path": "C:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout",
|
||||
"project.structure.last.edited": "Project",
|
||||
"project.structure.proportion": "0.17",
|
||||
"project.structure.side.proportion": "0.2",
|
||||
"run.code.analysis.last.selected.profile": "pProject Default",
|
||||
"settings.editor.selected.configurable": "com.obiscr.chatgpt.settings.OpenAISettings"
|
||||
},
|
||||
"keyToStringList": {
|
||||
"ExportApk.BuildVariants": [
|
||||
"betaRelease"
|
||||
"keyToStringList": {
|
||||
"ExportApk.BuildVariants": [
|
||||
"betaRelease"
|
||||
],
|
||||
"com.android.tools.idea.sqlite.queryhistory": [
|
||||
"select * from expedition e where e.addressFk= 34915",
|
||||
"select * from expedition e where e.id= 6872921",
|
||||
"select count(*) from expeditionPending\n",
|
||||
"select count(*) from expedition\n",
|
||||
"select count(*) from expedition"
|
||||
"com.android.tools.idea.sqlite.queryhistory": [
|
||||
"delete from expedition;",
|
||||
"select * from expedition where id = 7101969\n",
|
||||
"select * from expedition",
|
||||
"select * from expedition e where e.addressFk= 34915",
|
||||
"select * from expedition e where e.id= 6872921"
|
||||
]
|
||||
}
|
||||
}</component>
|
||||
}]]></component>
|
||||
<component name="PsdUISettings">
|
||||
<option name="MODULE_TAB" value="Properties" />
|
||||
<option name="LAST_EDITED_SIGNING_CONFIG" value="debug" />
|
||||
|
@ -334,10 +347,13 @@
|
|||
</key>
|
||||
<key name="CopyKotlinDeclarationDialog.RECENTS_KEY">
|
||||
<recent name="es.verdnatura.presentation.view.component" />
|
||||
<recent name="es.verdnatura.domain" />
|
||||
<recent name="es.verdnatura.presentation.view.feature.delivery.activity" />
|
||||
<recent name="es.verdnatura.presentation.view.feature.ubicador.adapter" />
|
||||
<recent name="es.verdnatura.presentation.view.feature.ubicador.fragment" />
|
||||
<recent name="es.verdnatura.presentation.view.feature.delivery.adapters" />
|
||||
<recent name="es.verdnatura.presentation.view.feature.delivery.fragments" />
|
||||
</key>
|
||||
<key name="CopyClassDialog.RECENTS_KEY">
|
||||
<recent name="es.verdnatura.presentation.view.feature.delivery.activity" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunManager" selected="Android App.app">
|
||||
|
@ -447,41 +463,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1618825571576</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00126" summary="refs varios">
|
||||
<created>1681967763126</created>
|
||||
<option name="number" value="00126" />
|
||||
<option name="presentableId" value="LOCAL-00126" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1681967763127</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00127" summary="refs Precontrol activado">
|
||||
<created>1681970676491</created>
|
||||
<option name="number" value="00127" />
|
||||
<option name="presentableId" value="LOCAL-00127" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1681970676491</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00128" summary="refs #5004">
|
||||
<created>1682053807286</created>
|
||||
<option name="number" value="00128" />
|
||||
<option name="presentableId" value="LOCAL-00128" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1682053807287</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00129" summary="version 23.14.1">
|
||||
<created>1682056950573</created>
|
||||
<option name="number" value="00129" />
|
||||
<option name="presentableId" value="LOCAL-00129" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1682056950573</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00130" summary="refs #5004">
|
||||
<created>1682575636304</created>
|
||||
<option name="number" value="00130" />
|
||||
<option name="presentableId" value="LOCAL-00130" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1682575636304</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00131" summary="refs #4979">
|
||||
<created>1682575765188</created>
|
||||
<option name="number" value="00131" />
|
||||
|
@ -790,7 +771,42 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1690456054648</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="175" />
|
||||
<task id="LOCAL-00175" summary="refs #4677 delivery→picking">
|
||||
<created>1690467514784</created>
|
||||
<option name="number" value="00175" />
|
||||
<option name="presentableId" value="LOCAL-00175" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1690467514785</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00176" summary="test ubicador">
|
||||
<created>1690467529203</created>
|
||||
<option name="number" value="00176" />
|
||||
<option name="presentableId" value="LOCAL-00176" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1690467529203</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00177" summary="version 23.30Beta">
|
||||
<created>1690467556690</created>
|
||||
<option name="number" value="00177" />
|
||||
<option name="presentableId" value="LOCAL-00177" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1690467556690</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00178" summary="refs #5652 add dynamic buttons for mermas">
|
||||
<created>1691048336702</created>
|
||||
<option name="number" value="00178" />
|
||||
<option name="presentableId" value="LOCAL-00178" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1691048336702</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00179" summary="refs #5996 cmrAdd">
|
||||
<created>1691481694750</created>
|
||||
<option name="number" value="00179" />
|
||||
<option name="presentableId" value="LOCAL-00179" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1691481694750</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="180" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.History.Properties">
|
||||
|
@ -891,11 +907,6 @@
|
|||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
|
||||
<MESSAGE value="refs lentitud al leer codigos y fallo al volver atrás" />
|
||||
<MESSAGE value="refs #4678 preparar fallo conexión" />
|
||||
<MESSAGE value="version alfa" />
|
||||
<MESSAGE value="Modificado IntvsLong" />
|
||||
<MESSAGE value="refs #5764" />
|
||||
<MESSAGE value="refs #5764 Añadir onclick pantalla Día de venta" />
|
||||
<MESSAGE value="refs #5322 Nature" />
|
||||
<MESSAGE value="strings" />
|
||||
|
@ -916,7 +927,12 @@
|
|||
<MESSAGE value="refs ##5613 login" />
|
||||
<MESSAGE value="version 23.28 general y beta" />
|
||||
<MESSAGE value="refs #5891 inventoryParking" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="refs #5891 inventoryParking" />
|
||||
<MESSAGE value="refs #4677 delivery→picking" />
|
||||
<MESSAGE value="test ubicador" />
|
||||
<MESSAGE value="version 23.30Beta" />
|
||||
<MESSAGE value="refs #5652 add dynamic buttons for mermas" />
|
||||
<MESSAGE value="refs #5996 cmrAdd" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="refs #5996 cmrAdd" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
|
@ -947,9 +963,14 @@
|
|||
<option name="timeStamp" value="18" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="kotlin-line">
|
||||
<url>file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/login/fragment/LoginViewModel.kt</url>
|
||||
<line>91</line>
|
||||
<option name="timeStamp" value="19" />
|
||||
<url>file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/articulo/fragment/ItemCardFragment.kt</url>
|
||||
<line>259</line>
|
||||
<option name="timeStamp" value="52" />
|
||||
</line-breakpoint>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<url>jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.squareup.retrofit2/retrofit/2.3.0/76f3c69879d3e01c082f49d8661c5590838148e1/retrofit-2.3.0-sources.jar!/retrofit2/Response.java</url>
|
||||
<line>29</line>
|
||||
<option name="timeStamp" value="29" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 220,
|
||||
"versionName": "23.30Beta",
|
||||
"versionCode": 223,
|
||||
"versionName": "23.30.1Beta",
|
||||
"outputFile": "app-beta-release.apk"
|
||||
}
|
||||
],
|
||||
|
|
|
@ -13,8 +13,8 @@ android {
|
|||
applicationId "es.verdnatura"
|
||||
minSdkVersion 24 //21
|
||||
targetSdkVersion 33
|
||||
versionCode 220
|
||||
versionName = "23.30Beta" //Esta rama viene de esta version
|
||||
versionCode 223
|
||||
versionName = "23.30.1Beta" //Esta rama viene de esta version
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,7 @@ dependencies {
|
|||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation 'com.google.firebase:firebase-crashlytics-ktx:18.2.9'
|
||||
implementation 'com.google.firebase:firebase-analytics-ktx:20.1.2'
|
||||
implementation 'com.google.android.gms:play-services-location:19.0.1'
|
||||
kapt "androidx.room:room-compiler:2.5.1"
|
||||
implementation 'androidx.room:room-ktx:2.5.1'
|
||||
debugImplementation fileTree(dir: 'libs/debug', include: ['*.jar'])
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
<uses-feature
|
||||
android:name="android.hardware.telephony"
|
||||
android:required="false" />
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.CALL_PHONE" />
|
||||
<uses-permission android:name="android.permission.PREVENT_POWER_KEY" />
|
||||
|
@ -43,6 +44,12 @@
|
|||
android:configChanges="orientation"
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="true"/>
|
||||
<activity
|
||||
android:name=".presentation.view.feature.delivery.activity.SignedActivity"
|
||||
android:windowSoftInputMode="stateHidden|adjustResize"
|
||||
android:configChanges="orientation"
|
||||
android:screenOrientation="portrait"
|
||||
android:exported="true"/>
|
||||
<activity
|
||||
android:name=".presentation.view.feature.login.activity.LoginActivity"
|
||||
android:configChanges="orientation"
|
||||
|
|
|
@ -2,24 +2,41 @@ package es.verdnatura.db
|
|||
|
||||
import android.content.Context
|
||||
import androidx.room.*
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ClientTicket
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoLoadUnload
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoPending
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.MyLocation
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.RouteInfo
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.RouteLoaded
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.SignedTickets
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.Ticket
|
||||
import java.util.Date
|
||||
|
||||
|
||||
// Clase que representa la base de datos
|
||||
@Database(entities = [ExpeditionInfoLoadUnload::class,ExpeditionInfoPending::class], version = 1)
|
||||
abstract class ExpedicionDatabase : RoomDatabase() {
|
||||
@Database(
|
||||
entities = [ExpeditionInfoLoadUnload::class, ExpeditionInfoPending::class, SignedTickets::class, RouteInfo::class, ClientTicket::class, RouteLoaded::class],
|
||||
version = 1
|
||||
)
|
||||
@TypeConverters(MapTypeConverter::class)
|
||||
abstract class DeliveryDatabase : RoomDatabase() {
|
||||
abstract fun expedicionDao(): ExpedicionDao
|
||||
abstract fun signedTicketDao(): SignedTicketDao
|
||||
abstract fun routesDao(): RoutesDao
|
||||
|
||||
abstract fun clienTicketDao(): ClientTicketDao
|
||||
|
||||
companion object {
|
||||
@Volatile
|
||||
private var INSTANCE: ExpedicionDatabase? = null
|
||||
private var INSTANCE: DeliveryDatabase? = null
|
||||
|
||||
fun getInstance(context: Context): ExpedicionDatabase {
|
||||
fun getInstance(context: Context): DeliveryDatabase {
|
||||
return INSTANCE ?: synchronized(this) {
|
||||
val instance = Room.databaseBuilder(
|
||||
context.applicationContext,
|
||||
ExpedicionDatabase::class.java,
|
||||
DeliveryDatabase::class.java,
|
||||
"expedition_database"
|
||||
)
|
||||
.fallbackToDestructiveMigration()
|
||||
|
@ -31,22 +48,138 @@ abstract class ExpedicionDatabase : RoomDatabase() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Interfaz que define los métodos de acceso a datos para Expedicion
|
||||
@Dao
|
||||
interface ExpedicionDao {
|
||||
@Query("SELECT * FROM expedition e WHERE e.routeFk = :parametro1")
|
||||
suspend fun getAll(parametro1:Int): List<ExpeditionInfoLoadUnload>
|
||||
|
||||
/* @Query("SELECT * FROM expeditionPending")
|
||||
suspend fun getAllPending(): List<ExpeditionInfoLoadUnload>*/
|
||||
suspend fun getAll(parametro1: Int): MutableList<ExpeditionInfoLoadUnload>
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
suspend fun insert(expedition:List<ExpeditionInfoLoadUnload>)
|
||||
suspend fun insert(expedition: MutableList<ExpeditionInfoLoadUnload>)
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
suspend fun insertPending(expeditionPending:MutableList<ExpeditionInfoPending>)
|
||||
suspend fun insertPending(expeditionPending: MutableList<ExpeditionInfoPending>)
|
||||
|
||||
@Query("SELECT * FROM expeditionPending ep WHERE ep.routeFk=:routeFk")
|
||||
suspend fun getAllPending(routeFk: Int): MutableList<ExpeditionInfoLoadUnload>
|
||||
|
||||
@Query("SELECT * FROM expeditionPending")
|
||||
suspend fun getAllPendingExpeditions(): MutableList<ExpeditionInfoPending>
|
||||
|
||||
@Delete
|
||||
fun delete(expedition: ExpeditionInfoLoadUnload)
|
||||
|
||||
@Query("DELETE FROM expeditionPending WHERE code = :codeState")
|
||||
suspend fun getDeleteByState(codeState:String)
|
||||
}
|
||||
|
||||
@Dao
|
||||
interface SignedTicketDao {
|
||||
@Query("SELECT * FROM signedPending ")
|
||||
suspend fun getAll(): List<SignedTickets>
|
||||
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
suspend fun insert(signedTicketPending: SignedTickets)
|
||||
|
||||
|
||||
@Query("DELETE FROM signedPending WHERE fileName = :nameFile")
|
||||
fun deleteByNameFile(nameFile: String)
|
||||
}
|
||||
|
||||
@Dao
|
||||
interface RoutesDao {
|
||||
@Query("SELECT * FROM routes ")
|
||||
suspend fun getAll(): List<RouteInfo>
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
suspend fun insert(routes: List<RouteInfo>)
|
||||
|
||||
@Query("DELETE FROM routes ")
|
||||
suspend fun delete()
|
||||
|
||||
@Query("DELETE FROM routes WHERE id = :routeId")
|
||||
suspend fun deleteByNameFile(routeId: String)
|
||||
|
||||
@Query("SELECT * FROM routesLoaded ")
|
||||
suspend fun getAllLoaded(): List<RouteLoaded>
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
suspend fun insertLoaded(routeLoaded: RouteLoaded)
|
||||
|
||||
@Query("DELETE FROM routes WHERE created != :today")
|
||||
suspend fun deleteLoaded(today: String)
|
||||
|
||||
}
|
||||
@Dao
|
||||
interface ClientTicketDao {
|
||||
@Query("SELECT * FROM clientTickets ")
|
||||
suspend fun getAll(): List<ClientTicket>
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
suspend fun insert(routes: List<ClientTicket>)
|
||||
|
||||
@Query("DELETE FROM clientTickets ")
|
||||
suspend fun delete()
|
||||
|
||||
@Query("DELETE FROM clientTickets WHERE id = :ticketId")
|
||||
suspend fun deleteById(ticketId: Int)
|
||||
|
||||
}
|
||||
|
||||
class MapTypeConverter {
|
||||
private val gson = Gson()
|
||||
|
||||
@TypeConverter
|
||||
fun fromMap(map: Map<String, String>): String {
|
||||
return gson.toJson(map)
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
fun toMap(json: String): Map<String, String> {
|
||||
val type = object : TypeToken<Map<String, String>>() {}.type
|
||||
return gson.fromJson(json, type)
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
fun fromDate(date: Date): Long {
|
||||
return date.time
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
fun toDate(timestamp: Long): Date {
|
||||
return Date(timestamp)
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
fun fromMyLocation(location: MyLocation?): String? {
|
||||
return gson.toJson(location)
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
fun toMyLocation(json: String?): MyLocation?{
|
||||
val type = object : TypeToken<MyLocation>() {}.type
|
||||
return gson.fromJson(json, type)
|
||||
}
|
||||
@TypeConverter
|
||||
fun fromPhones(phones: List<String>): String {
|
||||
return gson.toJson(phones)
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
fun toPhones(json: String): List<String> {
|
||||
val type = object : TypeToken<List<String>>() {}.type
|
||||
return gson.fromJson(json, type)
|
||||
}
|
||||
@TypeConverter
|
||||
fun fromTickets(tickets: MutableList<Ticket?>): String? {
|
||||
return gson.toJson(tickets)
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
fun toTickets(json: String?): MutableList<Ticket?> {
|
||||
val type = object : TypeToken<MutableList<Ticket>>() {}.type
|
||||
return gson.fromJson(json, type)
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import android.app.ActivityManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
import es.verdnatura.presentation.view.feature.login.activity.LoginActivity
|
||||
import org.json.JSONObject
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
|
||||
abstract class SalixCallback<T>(val context: Context) : Callback<T> {
|
||||
|
||||
override fun onResponse(call: Call<T>, response: Response<T>) {
|
||||
if (response.isSuccessful) {
|
||||
onSuccess(response)
|
||||
} else {
|
||||
try {
|
||||
if (response.code() == 555) {
|
||||
var message = JSONObject(response.message()).getString("Message")
|
||||
onError(Error(message))
|
||||
} else if (response.code() == 401) {
|
||||
if (!isActivityRunning(context, LoginActivity::class.java)) {
|
||||
val intent = Intent(context, LoginActivity::class.java)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
context.startActivity(intent)
|
||||
exitProcess(0)
|
||||
} else {
|
||||
onError(Error(response.message().toString()))
|
||||
}
|
||||
} else {
|
||||
println("message:"+response.errorBody()!!.source())
|
||||
println("message::"+response.errorBody() as okhttp3.ResponseBody)
|
||||
var m= response.errorBody() as okhttp3.ResponseBody
|
||||
println("Message2::"+m.source().toString())
|
||||
/* var r = response as okhttp3.Response
|
||||
println("message" + r.body() )
|
||||
println("message" + r.message() )
|
||||
println(response.raw().message().toString())
|
||||
println(response.raw().message())*/
|
||||
|
||||
onError(Error(response.message().toString()))
|
||||
}
|
||||
} catch (t: Throwable) {
|
||||
defaultErrorHandler(t)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<T>, t: Throwable) {
|
||||
try {
|
||||
onError(t)
|
||||
} catch (t: Throwable) {
|
||||
defaultErrorHandler(t)
|
||||
}
|
||||
}
|
||||
|
||||
private fun defaultErrorHandler(t: Throwable) {
|
||||
(nameofFunction((this)) + t.message).toast(context)
|
||||
//(context as MobileApplication).playSoundIsOK(false)
|
||||
}
|
||||
|
||||
open fun onSuccess(response: Response<T>) {
|
||||
// (nameofFunction((this)) + context.getString(R.string.operationSuccessful)).toast(context)
|
||||
//(context as MobileApplication).playSoundIsOK(true)
|
||||
}
|
||||
|
||||
open fun onError(t: Throwable) {
|
||||
throw t
|
||||
}
|
||||
|
||||
fun isActivityRunning(context: Context, activityClass: Class<*>): Boolean {
|
||||
val packageName = context.packageName
|
||||
val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
|
||||
val runningActivities = activityManager.getRunningTasks(Int.MAX_VALUE)
|
||||
|
||||
for (taskInfo in runningActivities) {
|
||||
if (taskInfo.baseActivity?.className == activityClass.name && taskInfo.topActivity?.packageName == packageName) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
|
@ -87,6 +87,27 @@ interface SalixService {
|
|||
):
|
||||
Call<Any>
|
||||
|
||||
@Multipart
|
||||
@POST("dms/uploadFile")
|
||||
fun imageUpload(
|
||||
@Query("warehouseId") warehouseId: Number,
|
||||
@Query("companyId") companyId: Number,
|
||||
@Query("dmsTypeId") dmsTypeId: Number,
|
||||
@Query("reference") reference: String,
|
||||
@Query("description") description: String,
|
||||
@Query("hasFile") hasFile: Boolean,
|
||||
@Part file: MultipartBody.Part,
|
||||
):
|
||||
Call<Any>
|
||||
|
||||
@Multipart
|
||||
@POST("/api/Tickets/saveSign")
|
||||
fun saveSign(
|
||||
@Part file: MultipartBody.Part?,
|
||||
@QueryMap(encoded = true) queryMap: Map<String?, String?>
|
||||
): Call<Any>
|
||||
|
||||
|
||||
@POST("Entries/{id}/addFromBuy")
|
||||
fun addFromBuy(
|
||||
@Path("id") id: Number,
|
||||
|
@ -249,7 +270,7 @@ interface SalixService {
|
|||
):
|
||||
Call<List<ItemInventoryParking>>
|
||||
|
||||
@POST("Routes/{id}")
|
||||
@PATCH("Routes/{id}")
|
||||
fun routeUpdate(
|
||||
@Path("id") id: Number,
|
||||
@Body route: RouteInfo,
|
||||
|
|
|
@ -3,6 +3,8 @@ package es.verdnatura.domain
|
|||
import android.app.ActivityManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.JsonObject
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
import es.verdnatura.presentation.view.feature.login.activity.LoginActivity
|
||||
import org.json.JSONObject
|
||||
|
@ -44,7 +46,9 @@ abstract class SilexCallback<T>(val context: Context) : Callback<T> {
|
|||
onError(Error(response.message().toString()))
|
||||
}
|
||||
} else {
|
||||
onError(Error(response.message().toString()))
|
||||
|
||||
onError(Error(errorSalixMessage(response)))
|
||||
// onError(Error(response.message().toString()))
|
||||
}
|
||||
} catch (t: Throwable) {
|
||||
defaultErrorHandler(t)
|
||||
|
@ -88,4 +92,17 @@ abstract class SilexCallback<T>(val context: Context) : Callback<T> {
|
|||
return false
|
||||
}
|
||||
|
||||
private fun errorSalixMessage(response: Response<T>): String {
|
||||
|
||||
val messageResponse = response.errorBody()!!.string()
|
||||
return try {
|
||||
|
||||
val jsonObject = Gson().fromJson(messageResponse, JsonObject::class.java)
|
||||
jsonObject?.getAsJsonObject("error")?.get("message")?.asString.toString()
|
||||
|
||||
} catch (ex: Exception) {
|
||||
response.message()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -866,7 +866,7 @@ interface VerdnaturaService {
|
|||
@POST("/delivery/getExpeditionFromRoute")
|
||||
fun getExpeditionFromRoute(
|
||||
@Body vararg params: Any
|
||||
): Call<List<ExpeditionInfoLoadUnload>>
|
||||
): Call<MutableList<ExpeditionInfoLoadUnload>>
|
||||
|
||||
@POST("/delivery/route_getExpeditionSummary")
|
||||
fun route_getExpeditionSummary(
|
||||
|
|
|
@ -1,19 +1,49 @@
|
|||
package es.verdnatura.presentation.base
|
||||
|
||||
import android.Manifest
|
||||
import android.content.Context
|
||||
import android.content.pm.PackageManager
|
||||
import android.location.LocationRequest
|
||||
import android.os.Bundle
|
||||
import android.os.Looper
|
||||
import android.view.View
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import androidx.annotation.LayoutRes
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.databinding.ViewDataBinding
|
||||
import com.google.android.gms.location.FusedLocationProviderClient
|
||||
import com.google.android.gms.location.LocationCallback
|
||||
import com.google.android.gms.location.LocationResult
|
||||
|
||||
|
||||
interface LocationUpdateCallback {
|
||||
fun onLocationReceived(location: LocationResult)
|
||||
}
|
||||
|
||||
abstract class BaseActivity<T : ViewDataBinding> : AppCompatActivity() {
|
||||
|
||||
private val locationCallback = object : LocationCallback() {
|
||||
override fun onLocationResult(location: LocationResult) {
|
||||
locationUpdateCallback?.onLocationReceived(location)
|
||||
}
|
||||
}
|
||||
|
||||
var locationUpdateCallback: LocationUpdateCallback? = null
|
||||
|
||||
protected lateinit var binding: T
|
||||
|
||||
private lateinit var fusedLocationClient: com.google.android.gms.location.FusedLocationProviderClient
|
||||
private val locationRequest: com.google.android.gms.location.LocationRequest =
|
||||
com.google.android.gms.location.LocationRequest.create().apply {
|
||||
interval =
|
||||
10000
|
||||
fastestInterval =
|
||||
5000
|
||||
priority =
|
||||
LocationRequest.QUALITY_LOW_POWER
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
@ -34,10 +64,57 @@ abstract class BaseActivity<T : ViewDataBinding> : AppCompatActivity() {
|
|||
addBindingVariables()
|
||||
}
|
||||
|
||||
fun hideKeyboard(view: View){
|
||||
fun hideKeyboard(view: View) {
|
||||
val imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
imm.hideSoftInputFromWindow(view.windowToken, 0)
|
||||
}
|
||||
|
||||
fun checkLocationPermission(): Boolean {
|
||||
return ContextCompat.checkSelfPermission(
|
||||
this,
|
||||
Manifest.permission.ACCESS_FINE_LOCATION
|
||||
) == PackageManager.PERMISSION_GRANTED
|
||||
}
|
||||
|
||||
}
|
||||
fun requestLocationUpdates(
|
||||
fusedLocationClient: FusedLocationProviderClient
|
||||
) {
|
||||
if (ActivityCompat.checkSelfPermission(
|
||||
this,
|
||||
Manifest.permission.ACCESS_FINE_LOCATION
|
||||
) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(
|
||||
this,
|
||||
Manifest.permission.ACCESS_COARSE_LOCATION
|
||||
) != PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
/*Debes aceptar permisos*/
|
||||
ActivityCompat.requestPermissions(
|
||||
this,
|
||||
arrayOf(Manifest.permission.ACCESS_FINE_LOCATION),
|
||||
1
|
||||
)
|
||||
|
||||
return
|
||||
}
|
||||
println("location running")
|
||||
fusedLocationClient.requestLocationUpdates(
|
||||
locationRequest,
|
||||
locationCallback,
|
||||
Looper.getMainLooper()
|
||||
)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
if (::fusedLocationClient.isInitialized) {
|
||||
fusedLocationClient.removeLocationUpdates(locationCallback)
|
||||
}
|
||||
locationUpdateCallback = null
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
fun stopLocationUpdates() {
|
||||
locationCallback?.let {
|
||||
fusedLocationClient.removeLocationUpdates(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import com.google.gson.reflect.TypeToken
|
|||
import es.verdnatura.MobileApplication
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.ToolbarFragmentBinding
|
||||
import es.verdnatura.db.ExpedicionDatabase
|
||||
import es.verdnatura.db.DeliveryDatabase
|
||||
import es.verdnatura.domain.ConstAndValues.SECTORFKDEFAULT
|
||||
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFKDEFAULT
|
||||
import es.verdnatura.presentation.view.feature.login.model.WorkForms
|
||||
|
@ -231,7 +231,8 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
|
|||
R.drawable.ic_filter_inventory -> getString(R.string.filterNoReview)
|
||||
R.drawable.ic_remove_checks->getString(R.string.resetReviewItems)
|
||||
R.drawable.ic_eye_inventory -> getString(R.string.inventoryShowParking)
|
||||
|
||||
R.drawable.ic_sort->getString(R.string.sortRouteSalix)
|
||||
R.drawable.ic_sign_ticket->getString(R.string.signed)
|
||||
else -> {
|
||||
""
|
||||
}
|
||||
|
@ -645,14 +646,13 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(viewModelCla
|
|||
return list
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
fun database(myContext: Context): ExpedicionDatabase {
|
||||
fun database(myContext: Context): DeliveryDatabase {
|
||||
|
||||
val db = Room.databaseBuilder(
|
||||
myContext,
|
||||
ExpedicionDatabase::class.java, "expediciones.db"
|
||||
DeliveryDatabase::class.java, "expediciones.db"
|
||||
).build()
|
||||
return db
|
||||
}
|
||||
|
|
|
@ -1,58 +1,61 @@
|
|||
package es.verdnatura.presentation.common
|
||||
import android.graphics.drawable.Drawable
|
||||
|
||||
import android.os.Build
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.ItemToolbarRowBinding
|
||||
|
||||
class ToolBarAdapterTooltip (
|
||||
class ToolBarAdapterTooltip(
|
||||
|
||||
private val items: List<ImageView>,
|
||||
private val onOptionsSelectedListener: OnOptionsSelectedListener
|
||||
) : RecyclerView.Adapter<ToolBarAdapterTooltip.ItemHolder>() {
|
||||
private var items: List<ImageView>,
|
||||
private val onOptionsSelectedListener: OnOptionsSelectedListener
|
||||
) : RecyclerView.Adapter<ToolBarAdapterTooltip.ItemHolder>() {
|
||||
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
|
||||
return ItemHolder(
|
||||
ItemToolbarRowBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
)
|
||||
}
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
|
||||
return ItemHolder(
|
||||
ItemToolbarRowBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
)
|
||||
}
|
||||
|
||||
override fun getItemCount() = items.size
|
||||
override fun getItemCount() = items.size
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
|
||||
holder.bind(items[position])
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
|
||||
holder.bind(items[position])
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
fun setItemsList(itemsNewList: List<ImageView>) {
|
||||
items = itemsNewList
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
inner class ItemHolder(
|
||||
val binding: ItemToolbarRowBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
private val res = binding.root.context.resources
|
||||
inner class ItemHolder(
|
||||
val binding: ItemToolbarRowBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
private val res = binding.root.context.resources
|
||||
|
||||
|
||||
fun bind(item: ImageView) {
|
||||
binding.apply {
|
||||
imagebuttonIcon.setImageDrawable(item.drawable)
|
||||
|
||||
imagebuttonIcon.setOnClickListener {
|
||||
onOptionsSelectedListener.onOptionsItemSelected(item.drawable)
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
imagebuttonIcon.tooltipText=item.tooltipText
|
||||
}
|
||||
fun bind(item: ImageView) {
|
||||
binding.apply {
|
||||
imagebuttonIcon.setImageDrawable(item.drawable)
|
||||
|
||||
imagebuttonIcon.setOnClickListener {
|
||||
onOptionsSelectedListener.onOptionsItemSelected(item.drawable)
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
imagebuttonIcon.tooltipText = item.tooltipText
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ interface OnOptionsSelectedListener {
|
|||
|
||||
|
||||
interface OnPasillerosItemClickListener {
|
||||
fun onPasillerosItemClickListener(item: PasillerosItemVO, entryPoint: String)
|
||||
fun onPasillerosItemClickListener(item: PasillerosItemVO, entryPoint: String,param:Any? =null)
|
||||
}
|
||||
|
||||
interface onMistakeWorkerClickListener {
|
||||
|
|
|
@ -24,6 +24,9 @@ import androidx.recyclerview.widget.RecyclerView
|
|||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.request.target.CustomTarget
|
||||
import com.bumptech.glide.request.transition.Transition
|
||||
import java.text.DecimalFormat
|
||||
import java.text.ParseException
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
|
||||
|
@ -183,9 +186,32 @@ val AudioManager.mediaMaxVolume: Int
|
|||
val AudioManager.mediaCurrentVolume: Int
|
||||
get() = this.getStreamVolume(AudioManager.STREAM_MUSIC)
|
||||
|
||||
fun getHourDay(date: String): String? {
|
||||
val format = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
|
||||
val cal = Calendar.getInstance()
|
||||
return try {
|
||||
cal.time = format.parse(date)
|
||||
val f = DecimalFormat("00")
|
||||
"" + f.format(cal[Calendar.HOUR_OF_DAY]) + ":" + f.format(cal[Calendar.MINUTE])
|
||||
} catch (e: ParseException) {
|
||||
e.printStackTrace()
|
||||
"00:00"
|
||||
}
|
||||
}
|
||||
|
||||
fun addDateToTime(time: String): String {
|
||||
val currentTime = Calendar.getInstance()
|
||||
val dateFormat = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault())
|
||||
val currentDate = dateFormat.format(currentTime.time)
|
||||
|
||||
return "$currentDate $time"
|
||||
}
|
||||
|
||||
|
||||
|
||||
fun PackageManager.getPackageInfoCompat(packageName: String, flags: Int = 0): PackageInfo =
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
getPackageInfo(packageName, PackageManager.PackageInfoFlags.of(flags.toLong()))
|
||||
} else {
|
||||
@Suppress("DEPRECATION") getPackageInfo(packageName, flags)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,232 @@
|
|||
package es.verdnatura.presentation.view.feature.delivery.activity
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import android.location.Location
|
||||
import android.view.View
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.google.android.gms.location.LocationResult
|
||||
import com.google.android.gms.location.LocationServices
|
||||
import com.google.gson.Gson
|
||||
import es.verdnatura.MobileApplication
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.ActivitySignBinding
|
||||
import es.verdnatura.db.DeliveryDatabase
|
||||
import es.verdnatura.domain.toast
|
||||
import es.verdnatura.presentation.base.BaseActivity
|
||||
import es.verdnatura.presentation.base.LocationUpdateCallback
|
||||
import es.verdnatura.presentation.base.database
|
||||
import es.verdnatura.presentation.view.component.CustomDialog
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ClientTicket
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.MyLocation
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.SignedTickets
|
||||
import es.verdnatura.presentation.view.feature.delivery.viewmodels.DeliveryViewModel
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
import java.io.IOException
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
|
||||
|
||||
class SignedActivity : BaseActivity<ActivitySignBinding>(), LocationUpdateCallback {
|
||||
|
||||
override fun getLayoutId(): Int = R.layout.activity_sign
|
||||
|
||||
private lateinit var fusedLocationClient: com.google.android.gms.location.FusedLocationProviderClient
|
||||
private var lastLocationCurrent: MyLocation = MyLocation(0.0, 0.0)
|
||||
private lateinit var ticketsSet: HashSet<Long>
|
||||
private lateinit var clientTicket: ClientTicket
|
||||
private lateinit var db: DeliveryDatabase
|
||||
|
||||
override fun init() {
|
||||
|
||||
when (intent.getStringExtra("objectSigned")) {
|
||||
|
||||
"ticket" -> {
|
||||
binding.mainToolbar.toolbarTitle.text = getString(R.string.sign)
|
||||
clientTicket = intent.extras!!.getSerializable("clientTicketList") as ClientTicket
|
||||
setViews(clientTicket)
|
||||
setLocation()
|
||||
}
|
||||
|
||||
}
|
||||
setEvents()
|
||||
|
||||
binding.splashProgress.visibility = View.GONE
|
||||
db = database(this.applicationContext)
|
||||
}
|
||||
|
||||
private fun setToolBar() {
|
||||
binding.mainToolbar.toolbarTitle.text = getString(R.string.sign)
|
||||
}
|
||||
|
||||
private fun showDialogConfirm() {
|
||||
val customDialog = CustomDialog(this)
|
||||
customDialog.setTitle(getString(R.string.confirm))
|
||||
.setDescription(getString(R.string.sureSign))
|
||||
.setOkButton(getString(R.string.ok)) {
|
||||
|
||||
reviewDistance()
|
||||
customDialog.dismiss()
|
||||
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
customDialog.dismiss()
|
||||
}
|
||||
.show()
|
||||
}
|
||||
|
||||
private fun reviewDistance() {
|
||||
|
||||
val locationCurrent = Location("").apply {
|
||||
this.latitude = lastLocationCurrent.Latitude
|
||||
this.longitude = lastLocationCurrent.Longitude
|
||||
}
|
||||
val locationClient = Location("").apply {
|
||||
this.latitude = clientTicket.Latitude ?: 0.0
|
||||
this.longitude = clientTicket.Longitude ?: 0.0
|
||||
}
|
||||
|
||||
|
||||
if (locationCurrent.distanceTo(locationClient) > 100 && locationClient.latitude != null && locationClient.longitude != null) {
|
||||
|
||||
val customDialogDistance = CustomDialog(this)
|
||||
customDialogDistance.setTitle(getString(R.string.confirm))
|
||||
.setDescription(getString(R.string.locationDiferent))
|
||||
.setOkButton(getString(R.string.keep)) {
|
||||
|
||||
uploadImage(MyLocation(locationClient.latitude, locationClient.longitude))
|
||||
customDialogDistance.dismiss()
|
||||
|
||||
}.setKoButton(getString(R.string.modify)) {
|
||||
uploadImage(lastLocationCurrent)
|
||||
customDialogDistance.dismiss()
|
||||
}
|
||||
.show()
|
||||
} else {
|
||||
if (locationClient.latitude != null && locationClient.longitude != null) {
|
||||
uploadImage(MyLocation(locationClient.longitude, locationClient.latitude))
|
||||
} else {
|
||||
uploadImage(MyLocation(locationCurrent.longitude, locationCurrent.latitude))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setEvents() {
|
||||
binding.btnSave.setOnClickListener {
|
||||
showDialogConfirm()
|
||||
}
|
||||
binding.mainToolbar.backButton.setOnClickListener {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun setViews(clientTicketList: ClientTicket) {
|
||||
|
||||
if (clientTicketList != null) {
|
||||
|
||||
binding.nameAddress.text = clientTicketList.ClientName
|
||||
ticketsSet = HashSet()
|
||||
var sum = 0
|
||||
for (exp in clientTicketList.tickets) {
|
||||
ticketsSet.add(exp.Id)
|
||||
sum += exp.Packages
|
||||
}
|
||||
binding.idTickets.text = ticketsSet.toList().toString()
|
||||
binding.totalPackages.text = sum.toString()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun uploadImage(location: MyLocation) {
|
||||
|
||||
val deliveryViewModel = DeliveryViewModel(application as MobileApplication)
|
||||
val drawing = binding.ink.bitmap
|
||||
val file = File(BitMapToString(drawing, tickets = ticketsSet.toList()))
|
||||
val queryMap: MutableMap<String?, String?> = HashMap()
|
||||
queryMap["tickets"] = ticketsSet.toString()
|
||||
queryMap["location"] = Gson().toJson(location)
|
||||
queryMap["signedTime"] =
|
||||
SimpleDateFormat("yyyy-LL-dd HH:mm", Locale.getDefault()).format(
|
||||
Date()
|
||||
)
|
||||
|
||||
var mySign =
|
||||
SignedTickets(
|
||||
queryMap,
|
||||
baseContext.externalCacheDir.toString() + "/" + file.name
|
||||
)
|
||||
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
deliveryViewModel.saveSign(
|
||||
mySign.fileName, mySign.queryMapList,
|
||||
)
|
||||
|
||||
deliveryViewModel.responseSign.observe(this) {
|
||||
binding.splashProgress.visibility = View.GONE
|
||||
if (!it.isError) {
|
||||
getString(R.string.ok).toast(this)
|
||||
finish()
|
||||
} else {
|
||||
it.errorMessage.toast(this)
|
||||
lifecycleScope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
db.signedTicketDao().insert(mySign)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
fun BitMapToString(bitmap: Bitmap, tickets: List<Long>): String {
|
||||
var fileNameSign = baseContext.externalCacheDir.toString() + "/sign"
|
||||
for (ticket in tickets) {
|
||||
fileNameSign += "_$ticket"
|
||||
}
|
||||
//Create a file to write bitmap data
|
||||
val f = File("$fileNameSign.png")
|
||||
f.createNewFile()
|
||||
|
||||
//Convert bitmap to byte array
|
||||
val baos = ByteArrayOutputStream()
|
||||
bitmap.compress(Bitmap.CompressFormat.PNG, 100, baos)
|
||||
val b = baos.toByteArray()
|
||||
|
||||
//write the bytes in file
|
||||
val fos = FileOutputStream(f)
|
||||
fos.write(b)
|
||||
fos.flush()
|
||||
fos.close()
|
||||
return "$fileNameSign.png"
|
||||
}
|
||||
|
||||
private fun setLocation() {
|
||||
fusedLocationClient = LocationServices.getFusedLocationProviderClient(this)
|
||||
locationUpdateCallback = this
|
||||
if (checkLocationPermission()) {
|
||||
requestLocationUpdates(fusedLocationClient)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onLocationReceived(location: LocationResult) {
|
||||
if (location.locations.isNotEmpty()) {
|
||||
lastLocationCurrent.Longitude = location.locations.last().longitude
|
||||
lastLocationCurrent.Latitude = location.locations.last().latitude
|
||||
println("ubicación - Latitud: $lastLocationCurrent.Latitude, Longitud: $lastLocationCurrent.Longitude")
|
||||
} else {
|
||||
println("ubicación vacía")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -14,11 +14,13 @@ import es.verdnatura.presentation.common.OnItemImageLoadRowClickListener
|
|||
import es.verdnatura.presentation.common.OnItemImageRouteRowClickListener
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoSummary
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.RouteInfo
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.RouteLoaded
|
||||
|
||||
|
||||
class RouteAdapter(
|
||||
private var items: MutableList<RouteInfo>,
|
||||
private val OnItemImageRouteRowClickListener: OnItemImageRouteRowClickListener,
|
||||
private val routeLoaded: List<RouteLoaded> = listOf()
|
||||
) : RecyclerView.Adapter<RouteAdapter.ItemHolder>() {
|
||||
|
||||
|
||||
|
@ -90,6 +92,12 @@ class RouteAdapter(
|
|||
|
||||
|
||||
}
|
||||
|
||||
if (routeLoaded.filter { it.id == item.id }.isNotEmpty()){
|
||||
imageLoadVan.visibility = View.INVISIBLE
|
||||
}else{
|
||||
imageLoadVan.visibility = View.VISIBLE
|
||||
}
|
||||
this.item = item
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package es.verdnatura.presentation.view.feature.delivery.adapters
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View.INVISIBLE
|
||||
import android.view.ViewGroup
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
|
@ -8,6 +9,7 @@ import androidx.core.content.ContextCompat
|
|||
import androidx.recyclerview.widget.RecyclerView
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.ItemTicketRowBinding
|
||||
import es.verdnatura.presentation.common.OnItemButtonCMRRowClickListener
|
||||
import es.verdnatura.presentation.common.OnItemButtonTicketRowClickListener
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ClientTicket
|
||||
|
||||
|
@ -15,6 +17,8 @@ import es.verdnatura.presentation.view.feature.delivery.model.ClientTicket
|
|||
class TicketAdapter(
|
||||
private var items: MutableList<ClientTicket>,
|
||||
private val onItemButtonTicketRowClickListener: OnItemButtonTicketRowClickListener,
|
||||
private val onItemButtonCMRRowClickListener: OnItemButtonCMRRowClickListener
|
||||
|
||||
) : RecyclerView.Adapter<TicketAdapter.ItemHolder>() {
|
||||
|
||||
|
||||
|
@ -42,7 +46,7 @@ class TicketAdapter(
|
|||
}
|
||||
|
||||
fun updateList(newList: MutableList<ClientTicket>) {
|
||||
// items = setHeaders(newList)
|
||||
items = newList
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
|
@ -66,8 +70,13 @@ class TicketAdapter(
|
|||
val txtTicket = v.findViewById<TextView>(R.id.txtTicket)
|
||||
val txtPackage = v.findViewById<TextView>(R.id.packages)
|
||||
val txtPackingType = v.findViewById<TextView>(R.id.packingType)
|
||||
|
||||
// Bind the ticket data to the views
|
||||
val txtCmr = v.findViewById<TextView>(R.id.btnCmr)
|
||||
if (ticket.cmrFk == null) {
|
||||
txtCmr.visibility = INVISIBLE
|
||||
}
|
||||
txtCmr.setOnClickListener {
|
||||
onItemButtonCMRRowClickListener.onItemButtonCMRRowClickListener(ticket)
|
||||
}
|
||||
txtTicket.text = ticket.Id.toString()
|
||||
txtPackage.text = ticket.Packages.toString()
|
||||
txtPackingType.text = ticket.PackingType
|
||||
|
@ -83,28 +92,6 @@ class TicketAdapter(
|
|||
fun bind(item: ClientTicket) {
|
||||
binding.apply {
|
||||
|
||||
|
||||
/* showTickets.setOnClickListener {
|
||||
OnItemImageRouteRowClickListener.onItemImageRouteRowClickListener(item,"showTickets")
|
||||
}
|
||||
imageLoadVan.setOnClickListener {
|
||||
OnItemImageRouteRowClickListener.onItemImageRouteRowClickListener(item,"loadVan")
|
||||
}
|
||||
linearLayoutShowTickets.setOnClickListener {
|
||||
OnItemImageRouteRowClickListener.onItemImageRouteRowClickListener(item,"showTickets")
|
||||
}
|
||||
linearLayoutLoadVan.setOnClickListener {
|
||||
OnItemImageRouteRowClickListener.onItemImageRouteRowClickListener(item,"loadVan")
|
||||
}
|
||||
|
||||
if (item.header){
|
||||
headerRouteLayout.visibility = View.VISIBLE
|
||||
headerRoute.text = toDateString(item.created)
|
||||
}else{
|
||||
headerRouteLayout.visibility = View.GONE
|
||||
|
||||
|
||||
}*/
|
||||
if (!item.Note.isNullOrEmpty()) {
|
||||
note.setColorFilter(
|
||||
ContextCompat.getColor(
|
||||
|
|
|
@ -15,25 +15,32 @@ import androidx.lifecycle.lifecycleScope
|
|||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentExpeditionLoadunloadDeliveryBinding
|
||||
import es.verdnatura.db.ExpedicionDatabase
|
||||
import es.verdnatura.db.DeliveryDatabase
|
||||
import es.verdnatura.domain.toDateString
|
||||
import es.verdnatura.domain.toast
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.base.database
|
||||
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
||||
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
||||
import es.verdnatura.presentation.view.feature.delivery.activity.SignedActivity
|
||||
import es.verdnatura.presentation.view.feature.delivery.adapters.ExpeditionLoadUnloadAdapter
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ClientTicket
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoLoadUnload
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoPending
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.RouteLoaded
|
||||
import es.verdnatura.presentation.view.feature.delivery.viewmodels.DeliveryViewModel
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.json.JSONObject
|
||||
import java.util.Date
|
||||
|
||||
|
||||
class LoadUnloadFragment(
|
||||
var title: String = "",
|
||||
var state: String = "",
|
||||
var entryPoint: String
|
||||
var entryPoint: String,
|
||||
var clientTicketList: ArrayList<ClientTicket>?
|
||||
|
||||
) : BaseFragment<FragmentExpeditionLoadunloadDeliveryBinding, DeliveryViewModel>(
|
||||
DeliveryViewModel::class
|
||||
|
@ -46,11 +53,16 @@ class LoadUnloadFragment(
|
|||
private var counterResponse = 0
|
||||
private var route = 0
|
||||
private var addressFk = 0
|
||||
private lateinit var db: ExpedicionDatabase
|
||||
private lateinit var db: DeliveryDatabase
|
||||
|
||||
companion object {
|
||||
fun newInstance(title: String, state: String, entryPoint: String) =
|
||||
LoadUnloadFragment(title, state, entryPoint)
|
||||
fun newInstance(
|
||||
title: String,
|
||||
state: String,
|
||||
entryPoint: String,
|
||||
clientTicketList: ArrayList<ClientTicket>? = null
|
||||
) =
|
||||
LoadUnloadFragment(title, state, entryPoint, clientTicketList)
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int = R.layout.fragment_expedition_loadunload_delivery
|
||||
|
@ -94,11 +106,23 @@ class LoadUnloadFragment(
|
|||
|
||||
val listIcons: ArrayList<ImageView> = ArrayList()
|
||||
val iconConfirm = ImageView(context)
|
||||
val iconSign = ImageView(context)
|
||||
|
||||
iconConfirm.setImageResource(R.drawable.ic_confirm)
|
||||
iconSign.setImageResource(R.drawable.ic_sign)
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
iconConfirm.tooltipText = getTooltip(R.drawable.ic_confirm)
|
||||
}
|
||||
listIcons.add(iconConfirm)
|
||||
|
||||
listIcons.add(
|
||||
if (state == "DELIVERED") {
|
||||
iconSign
|
||||
} else {
|
||||
iconConfirm
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
binding.mainToolbar.toolbarIcons.adapter =
|
||||
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
|
||||
|
@ -107,8 +131,14 @@ class LoadUnloadFragment(
|
|||
|
||||
when (item) {
|
||||
iconConfirm.drawable -> {
|
||||
saveLoaded()
|
||||
setExpeditionsState(myList, state)
|
||||
}
|
||||
|
||||
iconSign.drawable -> {
|
||||
setExpeditionsState(myList, state)
|
||||
//openSignActivity()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -118,51 +148,74 @@ class LoadUnloadFragment(
|
|||
binding.mainToolbar.toolbarIcons.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
private fun setExpeditionsState(list: MutableList<ExpeditionInfoLoadUnload>, state: String) {
|
||||
|
||||
|
||||
if (list.filter { it.code == state }.size == list.size) {
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
viewModel.expeditionState_add(list.filter { it.code == state }, state)
|
||||
counterCalls = 1
|
||||
} else {
|
||||
val alertDialog = android.app.AlertDialog.Builder(requireContext()).create()
|
||||
alertDialog.setTitle(getString(R.string.info))
|
||||
alertDialog.setMessage(getString(R.string.expeditionTotal))
|
||||
alertDialog.setButton(
|
||||
android.app.AlertDialog.BUTTON_NEUTRAL, getString(R.string.save)
|
||||
) { dialog, which ->
|
||||
counterCalls = 2
|
||||
if (list.filter { it.code == state }.isEmpty()){
|
||||
counterCalls--
|
||||
}else{
|
||||
viewModel.expeditionState_add(list.filter { it.code == state }, state)
|
||||
}
|
||||
if (list.filter { it.code != state && it.code != "FOUND" }.isEmpty()){
|
||||
counterCalls--
|
||||
}else{
|
||||
viewModel.expeditionState_add(
|
||||
list.filter { it.code != state && it.code != "FOUND" },
|
||||
"LOST"
|
||||
)
|
||||
}
|
||||
/*viewModel.expeditionState_add(list.filter { it.code == state }, state)
|
||||
viewModel.expeditionState_add(
|
||||
list.filter { it.code != state && it.code != "FOUND" },
|
||||
"LOST"
|
||||
)*/
|
||||
private fun saveLoaded() {
|
||||
lifecycleScope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
db.routesDao().insertLoaded(RouteLoaded(route.toLong(), toDateString(Date())))
|
||||
}
|
||||
alertDialog.setButton(
|
||||
android.app.AlertDialog.BUTTON_POSITIVE, getString(R.string.ordenar)
|
||||
) { dialog, which ->
|
||||
createList(list.sortedByDescending { it.code })
|
||||
}
|
||||
alertDialog.show()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private fun setExpeditionsState(list: MutableList<ExpeditionInfoLoadUnload>, state: String) {
|
||||
|
||||
if (list.filter { it.code == state }.isNotEmpty()) {
|
||||
if (list.filter { it.code == state }.size == list.size) {
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
viewModel.expeditionState_add(list.filter { it.code == state }, state)
|
||||
counterCalls = 1
|
||||
} else {
|
||||
val alertDialog = android.app.AlertDialog.Builder(requireContext()).create()
|
||||
alertDialog.setTitle(getString(R.string.info))
|
||||
alertDialog.setMessage(getString(R.string.expeditionTotal))
|
||||
alertDialog.setButton(
|
||||
android.app.AlertDialog.BUTTON_NEUTRAL, getString(R.string.save)
|
||||
) { dialog, which ->
|
||||
|
||||
counterCalls = 2
|
||||
if (list.filter { it.code == state }.isEmpty()) {
|
||||
counterCalls--
|
||||
} else {
|
||||
viewModel.expeditionState_add(list.filter { it.code == state }, state)
|
||||
}
|
||||
if (list.filter { it.code != state && it.code != "FOUND" }.isEmpty()) {
|
||||
counterCalls--
|
||||
} else {
|
||||
viewModel.expeditionState_add(
|
||||
list.filter { it.code != state && it.code != "FOUND" },
|
||||
"LOST"
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
alertDialog.setButton(
|
||||
android.app.AlertDialog.BUTTON_POSITIVE, getString(R.string.ordenar)
|
||||
) { dialog, which ->
|
||||
createList(list.sortedByDescending { it.code } as MutableList<ExpeditionInfoLoadUnload>)
|
||||
}
|
||||
alertDialog.show()
|
||||
}
|
||||
} else {
|
||||
openSignActivity()
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun openSignActivity() {
|
||||
val intent = Intent(requireContext(), SignedActivity::class.java)
|
||||
|
||||
intent.putExtra(
|
||||
"clientTicketList",
|
||||
clientTicketList!!.first()
|
||||
)
|
||||
|
||||
intent.putExtra("objectSigned", "ticket") //cmr
|
||||
startActivity(intent)
|
||||
requireActivity().onBackPressed()
|
||||
}
|
||||
|
||||
private fun openAppDelivery() {
|
||||
val i = Intent()
|
||||
val manager: PackageManager = requireContext().packageManager
|
||||
|
@ -203,13 +256,15 @@ class LoadUnloadFragment(
|
|||
},
|
||||
|
||||
)
|
||||
binding.mainToolbar.toolbarTitle.text =
|
||||
if (!binding.mainToolbar.switchButton.isChecked) {
|
||||
getString(R.string.loading)
|
||||
} else {
|
||||
getString(R.string.unloading)
|
||||
}
|
||||
if (state != "DELIVERED") {
|
||||
|
||||
binding.mainToolbar.toolbarTitle.text =
|
||||
if (!binding.mainToolbar.switchButton.isChecked) {
|
||||
getString(R.string.loading)
|
||||
} else {
|
||||
getString(R.string.unloading)
|
||||
}
|
||||
}
|
||||
|
||||
} catch (ex: Exception) {
|
||||
getString(R.string.errorExpedition).toast(context, Toast.LENGTH_SHORT)
|
||||
|
@ -260,7 +315,7 @@ class LoadUnloadFragment(
|
|||
with(viewModel) {
|
||||
expeditionInfoLoadUnloadList.observe(viewLifecycleOwner) {
|
||||
binding.splashProgress.visibility = View.GONE
|
||||
createList(it.list)
|
||||
createList(it.list as MutableList<ExpeditionInfoLoadUnload>)
|
||||
}
|
||||
routeInfoList.observe(viewLifecycleOwner) {
|
||||
binding.splashProgress.visibility = View.GONE
|
||||
|
@ -280,19 +335,67 @@ class LoadUnloadFragment(
|
|||
if (counterResponse == counterCalls) {
|
||||
// viewModel.getExpeditionFromRoute(route)
|
||||
if (!binding.mainToolbar.switchButton.isChecked) {
|
||||
requireActivity().onBackPressed()
|
||||
if (state == "DELIVERED") {
|
||||
openSignActivity()
|
||||
} else {
|
||||
requireActivity().onBackPressed()
|
||||
}
|
||||
} else {
|
||||
binding.mainToolbar.switchButton.isChecked = false
|
||||
}
|
||||
counterResponse = 0
|
||||
counterCalls = 0
|
||||
}
|
||||
} else {
|
||||
ma.messageWithSound(it.errorMessage, true, true, "Error", true)
|
||||
openSignActivity()
|
||||
}
|
||||
|
||||
}
|
||||
responseStateList.observe(viewLifecycleOwner) {
|
||||
binding.splashProgress.visibility = View.GONE
|
||||
ma.messageWithSound(it.errorMessage, true, true, "", true)
|
||||
savePendingExpeditions()
|
||||
openSignActivity()
|
||||
}
|
||||
|
||||
responseLoadList.observe(viewLifecycleOwner) {
|
||||
binding.splashProgress.visibility = View.GONE
|
||||
createList(mutableListOf(), true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun savePendingExpeditions() {
|
||||
lifecycleScope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
|
||||
var myListPending = myList.map { item ->
|
||||
ExpeditionInfoPending(
|
||||
id = item.id,
|
||||
ticketFk = item.ticketFk,
|
||||
routeFk = item.routeFk,
|
||||
addressFk = item.addressFk,
|
||||
itemPackingTypeConcat = item.itemPackingTypeConcat,
|
||||
city = item.city,
|
||||
street = item.street,
|
||||
code = if (item.code == "DELIVERED" || item.code == "ON DELIVERY") {
|
||||
item.code
|
||||
} else {
|
||||
"LOST"
|
||||
},
|
||||
nickname = item.nickname,
|
||||
postalCode = item.postalCode
|
||||
)
|
||||
} as MutableList<ExpeditionInfoPending>
|
||||
|
||||
db.expedicionDao().insertPending(myListPending)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
private fun setSwitchButon() {
|
||||
binding.mainToolbar.switchButton.tooltipText = getString(R.string.expeditionMarkLost)
|
||||
|
@ -313,21 +416,28 @@ class LoadUnloadFragment(
|
|||
|
||||
}
|
||||
|
||||
private fun createList(list: List<ExpeditionInfoLoadUnload>) {
|
||||
private fun createList(list: MutableList<ExpeditionInfoLoadUnload>, getSaved: Boolean = false) {
|
||||
|
||||
/* if (list.isEmpty()) {
|
||||
getExpeditionTable(route)
|
||||
} else {
|
||||
updateExpeditionTable(list)
|
||||
getExpeditionTable(route)
|
||||
}*/
|
||||
|
||||
lifecycleScope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
db.expedicionDao().insert(list.filter { it.routeFk == route }
|
||||
)
|
||||
myList = db.expedicionDao().getAll(route) as MutableList<ExpeditionInfoLoadUnload>
|
||||
// myList = list as MutableList<ExpeditionInfoLoadUnload>
|
||||
|
||||
|
||||
if (getSaved) {
|
||||
myList =
|
||||
db.expedicionDao()
|
||||
.getAllPending(route)
|
||||
if (myList.isEmpty()) {
|
||||
myList =
|
||||
db.expedicionDao()
|
||||
.getAll(route)
|
||||
}
|
||||
|
||||
} else {
|
||||
db.expedicionDao().insert(list)
|
||||
myList = list
|
||||
}
|
||||
|
||||
}
|
||||
if (addressFk != 0) {
|
||||
myList =
|
||||
|
@ -358,7 +468,7 @@ class LoadUnloadFragment(
|
|||
lifecycleScope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
db.expedicionDao().insert(list.filter { it.routeFk == route }
|
||||
.filter { it.addressFk == addressFk })
|
||||
.filter { it.addressFk == addressFk } as MutableList<ExpeditionInfoLoadUnload>)
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -368,7 +478,8 @@ class LoadUnloadFragment(
|
|||
private fun getExpeditionTable(myRoute: Int) {
|
||||
lifecycleScope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
myList = db.expedicionDao().getAll(myRoute) as MutableList<ExpeditionInfoLoadUnload>
|
||||
myList =
|
||||
db.expedicionDao().getAll(myRoute) as MutableList<ExpeditionInfoLoadUnload>
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,19 +10,30 @@ import android.text.TextWatcher
|
|||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.google.gson.Gson
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentRouteBinding
|
||||
import es.verdnatura.db.DeliveryDatabase
|
||||
import es.verdnatura.domain.notNull
|
||||
import es.verdnatura.domain.toDateString
|
||||
import es.verdnatura.domain.toast
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.base.database
|
||||
import es.verdnatura.presentation.common.*
|
||||
import es.verdnatura.presentation.view.feature.delivery.adapters.RouteAdapter
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoLoadUnload
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.RouteInfo
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.RouteLoaded
|
||||
import es.verdnatura.presentation.view.feature.delivery.viewmodels.DeliveryViewModel
|
||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
|
||||
|
||||
class RoutesFragment(
|
||||
|
@ -34,6 +45,8 @@ class RoutesFragment(
|
|||
private var adapter: RouteAdapter? = null
|
||||
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
|
||||
private lateinit var myListRoute: MutableList<RouteInfo>
|
||||
private lateinit var db: DeliveryDatabase
|
||||
private lateinit var myListRouteLoaded:List <RouteLoaded>
|
||||
|
||||
companion object {
|
||||
fun newInstance(title: String) =
|
||||
|
@ -48,10 +61,78 @@ class RoutesFragment(
|
|||
setEvents()
|
||||
setToolBar()
|
||||
binding.scanInput.requestFocus()
|
||||
pendingOperations()
|
||||
callBack(viewModel.getRoutes(mobileApplication.userId!!))
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private fun pendingOperations() {
|
||||
db = database(requireContext().applicationContext)
|
||||
if (mobileApplication.hasNetwork) {
|
||||
lifecycleScope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
val pending = db.signedTicketDao().getAll()
|
||||
for (p in pending) {
|
||||
viewModel.saveSign(p.fileName, p.queryMapList)
|
||||
}
|
||||
val pendingExpedition =
|
||||
db.expedicionDao().getAllPendingExpeditions()
|
||||
|
||||
if (pendingExpedition.filter { it.code == "DELIVERED" }.isNotEmpty()) {
|
||||
viewModel.expeditionState_add(
|
||||
pendingExpedition.filter { it.code == "DELIVERED" },
|
||||
"DELIVERED"
|
||||
)
|
||||
}
|
||||
|
||||
if (pendingExpedition.filter { it.code == "ON DELIVERY" }.isNotEmpty()) {
|
||||
viewModel.expeditionState_add(
|
||||
pendingExpedition.filter { it.code == "ON DELIVERY" },
|
||||
"ON DELIVERY"
|
||||
)
|
||||
}
|
||||
if (pendingExpedition.filter { it.code == "LOST" }.isNotEmpty()) {
|
||||
viewModel.expeditionState_add(
|
||||
pendingExpedition.filter { it.code == "LOST" },
|
||||
"LOST"
|
||||
)
|
||||
}
|
||||
if (pendingExpedition.filter { it.code == "FOUND" }.isNotEmpty()) {
|
||||
viewModel.expeditionState_add(
|
||||
pendingExpedition.filter { it.code == "FOUND" },
|
||||
"FOUND"
|
||||
)
|
||||
}
|
||||
}
|
||||
db.routesDao().deleteLoaded(toDateString(Date()))
|
||||
myListRouteLoaded = db.routesDao().getAllLoaded()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun deleteSignTickets(nameFileSigned: String) {
|
||||
lifecycleScope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
db.signedTicketDao().deleteByNameFile(nameFileSigned)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private fun deleteExpeditionsPending(codeState: String) {
|
||||
lifecycleScope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
db.expedicionDao().getDeleteByState(codeState)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun callBack(callBackEndPoint: Unit) {
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
return callBackEndPoint
|
||||
|
@ -204,54 +285,96 @@ class RoutesFragment(
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
responseSign.observe(viewLifecycleOwner) {
|
||||
|
||||
if (it.isError) {
|
||||
binding.mainToolbar.toolbarIcons.visibility = View.VISIBLE
|
||||
ma.messageWithSound(it.errorMessage, false, false, "", true)
|
||||
} else {
|
||||
deleteSignTickets(it.response)
|
||||
}
|
||||
}
|
||||
|
||||
responseLoadList.observe(viewLifecycleOwner) {
|
||||
binding.splashProgress.visibility = View.GONE
|
||||
ma.messageWithSound(getString(R.string.offline), false, false, "", true)
|
||||
createListRoutes(mutableListOf(), getSaved = true)
|
||||
}
|
||||
|
||||
responseStateAdd.observe(viewLifecycleOwner) {
|
||||
|
||||
if (!it.isError) {
|
||||
binding.mainToolbar.toolbarIcons.visibility = View.VISIBLE
|
||||
|
||||
deleteExpeditionsPending(it.response)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private fun createListRoutes(list: MutableList<RouteInfo>) {
|
||||
private fun createListRoutes(list: MutableList<RouteInfo>, getSaved: Boolean = false) {
|
||||
|
||||
myListRoute = list
|
||||
adapter = RouteAdapter(
|
||||
myListRoute,
|
||||
object : OnItemImageRouteRowClickListener {
|
||||
|
||||
override fun onItemImageRouteRowClickListener(item: RouteInfo, action: String) {
|
||||
when (action) {
|
||||
"loadVan" -> {
|
||||
binding.scanInput.isEnabled = true
|
||||
ma.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(title = getString(R.string.titleDeliverySummary)),
|
||||
item.id.toString()
|
||||
)
|
||||
}
|
||||
|
||||
"showTickets" -> {
|
||||
//println("La ruta de los tickets es: " + item.id)
|
||||
//openAppDelivery(item)
|
||||
ma.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(title = getString(R.string.tickets)),
|
||||
Gson().toJson(item)
|
||||
)
|
||||
}
|
||||
}
|
||||
lifecycleScope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
|
||||
myListRoute = if (getSaved) {
|
||||
db.routesDao().getAll() as MutableList<RouteInfo>
|
||||
} else {
|
||||
db.routesDao().delete()
|
||||
db.routesDao().insert(list!!)
|
||||
list
|
||||
}
|
||||
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
binding.routeRecyclerview.addItemDecoration(
|
||||
ItemDescorationCustomized(
|
||||
resources.getDimensionPixelSize(
|
||||
R.dimen.vertical_spacing
|
||||
// myListRoute = list
|
||||
adapter = RouteAdapter(
|
||||
myListRoute,
|
||||
object : OnItemImageRouteRowClickListener {
|
||||
|
||||
override fun onItemImageRouteRowClickListener(item: RouteInfo, action: String) {
|
||||
when (action) {
|
||||
"loadVan" -> {
|
||||
binding.scanInput.isEnabled = true
|
||||
ma.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(title = getString(R.string.titleDeliverySummary)),
|
||||
item.id.toString()
|
||||
)
|
||||
}
|
||||
|
||||
"showTickets" -> {
|
||||
//println("La ruta de los tickets es: " + item.id)
|
||||
//openAppDelivery(item)
|
||||
ma.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(title = getString(R.string.tickets)),
|
||||
Gson().toJson(item)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},myListRouteLoaded
|
||||
)
|
||||
|
||||
binding.routeRecyclerview.addItemDecoration(
|
||||
ItemDescorationCustomized(
|
||||
resources.getDimensionPixelSize(
|
||||
R.dimen.vertical_spacing
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
binding.routeRecyclerview.adapter = adapter
|
||||
binding.routeRecyclerview.layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
adapter!!.notifyDataSetChanged()
|
||||
binding.routeRecyclerview.adapter = adapter
|
||||
binding.routeRecyclerview.layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
adapter!!.notifyDataSetChanged()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -16,13 +16,16 @@ import android.widget.TextView
|
|||
import androidx.annotation.RequiresApi
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.google.gson.Gson
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentTicketsBinding
|
||||
import es.verdnatura.db.DeliveryDatabase
|
||||
import es.verdnatura.domain.notNull
|
||||
import es.verdnatura.domain.toast
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.base.database
|
||||
import es.verdnatura.presentation.common.*
|
||||
import es.verdnatura.presentation.view.component.CustomDialogInputNotes
|
||||
import es.verdnatura.presentation.view.feature.delivery.adapters.TicketAdapter
|
||||
|
@ -32,6 +35,9 @@ import es.verdnatura.presentation.view.feature.delivery.model.RouteInfo
|
|||
import es.verdnatura.presentation.view.feature.delivery.model.Ticket
|
||||
import es.verdnatura.presentation.view.feature.delivery.viewmodels.DeliveryViewModel
|
||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import java.util.Calendar
|
||||
|
||||
|
||||
|
@ -45,6 +51,10 @@ class TicketsFragment(
|
|||
private var adapter: TicketAdapter? = null
|
||||
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
|
||||
private lateinit var myListClientTicket: MutableList<ClientTicket>
|
||||
private var showSigned = false
|
||||
private var showSettings = false
|
||||
private lateinit var db: DeliveryDatabase
|
||||
private var isBack = false
|
||||
|
||||
companion object {
|
||||
fun newInstance(title: String, entryPoint: String) =
|
||||
|
@ -62,8 +72,8 @@ class TicketsFragment(
|
|||
setEvents()
|
||||
setToolBar()
|
||||
binding.mainToolbar.toolbarTitle.text = route.name
|
||||
println("La ruta es: " + route.toString())
|
||||
callBack(viewModel.getTickets(route.id))
|
||||
db = database(requireContext().applicationContext)
|
||||
|
||||
}
|
||||
|
||||
|
@ -94,17 +104,26 @@ class TicketsFragment(
|
|||
|
||||
val listIcons: ArrayList<ImageView> = ArrayList()
|
||||
val iconSettings = ImageView(context)
|
||||
|
||||
val iconSort = ImageView(context)
|
||||
val iconSigned = ImageView(context)
|
||||
|
||||
|
||||
iconSettings.setImageResource(R.drawable.ic_setting_ui)
|
||||
iconSort.setImageResource(R.drawable.ic_sort)
|
||||
iconSigned.setImageResource(R.drawable.ic_sign_ticket)
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
iconSettings.tooltipText = getTooltip(R.drawable.ic_setting_ui)
|
||||
iconSort.tooltipText = getTooltip(R.drawable.ic_sort)
|
||||
iconSigned.tooltipText = getTooltip(R.drawable.ic_sign_ticket)
|
||||
|
||||
}
|
||||
listIcons.add(iconSigned)
|
||||
listIcons.add(iconSettings)
|
||||
listIcons.add(iconSort)
|
||||
|
||||
changeColorIcon(iconSigned.drawable, showSigned)
|
||||
changeColorIcon(iconSettings.drawable, showSigned)
|
||||
|
||||
binding.mainToolbar.toolbarIcons.adapter =
|
||||
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
|
||||
|
@ -113,15 +132,43 @@ class TicketsFragment(
|
|||
|
||||
when (item) {
|
||||
iconSettings.drawable -> {
|
||||
/* //binding.itemcardLayout.visibility = View.GONE
|
||||
binding.itemcardLayout.visibility = View.GONE
|
||||
binding.ticketsRecyclerview.visibility = View.GONE
|
||||
binding.layoutKmHour.visibility = View.VISIBLE
|
||||
binding.kmStart.setText(binding.kmStart.toString())
|
||||
binding.kmEnd.setText(binding.kmEnd.toString())
|
||||
*/
|
||||
showSigned = !showSigned
|
||||
changeVisibleSettings(showSigned)
|
||||
changeColorIcon(iconSettings.drawable, showSigned)
|
||||
binding.kmStart.setText(route?.kmStart?.toString())
|
||||
binding.kmEnd.setText(route?.kmEnd?.toString())
|
||||
|
||||
}
|
||||
|
||||
iconSort.drawable -> {
|
||||
ma.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(
|
||||
title = getString(R.string.titleWebViewer),
|
||||
),
|
||||
entryPoint = Gson().toJson(
|
||||
mutableMapOf(
|
||||
"entryPoint" to route.id,
|
||||
"web" to "${getData("base_urlSalix")}#!/route/${route.id}/tickets"
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
iconSigned.drawable -> {
|
||||
|
||||
showSigned = !showSigned
|
||||
|
||||
if (::myListClientTicket.isInitialized) {
|
||||
adapter!!.updateList(
|
||||
if (showSigned) {
|
||||
myListClientTicket.filter { it.Signed == 1 } as MutableList<ClientTicket>
|
||||
} else {
|
||||
myListClientTicket.filter { it.Signed == 0 } as MutableList<ClientTicket>
|
||||
})
|
||||
}
|
||||
changeColorIcon(iconSigned.drawable, showSigned)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -132,6 +179,29 @@ class TicketsFragment(
|
|||
binding.mainToolbar.toolbarIcons.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
private fun changeColorIcon(icon: Drawable, isActivated: Boolean) {
|
||||
icon.setTint(
|
||||
ContextCompat.getColor(
|
||||
requireContext(),
|
||||
if (isActivated) R.color.verdnatura_pumpkin_orange else R.color.verdnatura_white
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
isBack = true
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
if (isBack){
|
||||
callBack(viewModel.getTickets(route.id))
|
||||
isBack = false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun openAppDelivery(item: RouteInfo) {
|
||||
val i = Intent()
|
||||
val manager: PackageManager = requireContext().packageManager
|
||||
|
@ -172,38 +242,9 @@ class TicketsFragment(
|
|||
|
||||
private fun setEvents() {
|
||||
binding.mainToolbar.backButton.setOnClickListener {
|
||||
|
||||
if (binding.layoutKmHour.visibility == View.VISIBLE) {
|
||||
binding.ticketsRecyclerview.visibility = View.VISIBLE
|
||||
binding.itemcardLayout.visibility = View.VISIBLE
|
||||
binding.layoutKmHour.visibility = View.GONE
|
||||
} else {
|
||||
requireActivity().onBackPressed()
|
||||
}
|
||||
binding.saveButton.setOnClickListener {
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
route.kmStart = binding.kmStart.text.toString().toLong()
|
||||
route.kmEnd = binding.kmEnd.text.toString().toLong()
|
||||
viewModel.routeUpdate(route)
|
||||
}
|
||||
binding.hourInit.setOnFocusChangeListener { view, b ->
|
||||
if (b) {
|
||||
showTimePicker(binding.hourInit)
|
||||
}
|
||||
}
|
||||
binding.hourInit.setText("asdfasdf")
|
||||
binding.buttonPicker.setOnClickListener {
|
||||
println("hour start")
|
||||
// showTimePicker(binding.hourEnd)
|
||||
println("hour start")
|
||||
}
|
||||
binding.hourEnd.setOnClickListener {
|
||||
println("hour end")
|
||||
// showTimePicker(binding.hourEnd)
|
||||
}
|
||||
setSettingsRoute()
|
||||
}
|
||||
|
||||
|
||||
setSettingsRoute()
|
||||
/* binding.scanInput.addTextChangedListener(object : TextWatcher {
|
||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
||||
}
|
||||
|
@ -223,6 +264,32 @@ class TicketsFragment(
|
|||
*/
|
||||
}
|
||||
|
||||
private fun setSettingsRoute() {
|
||||
|
||||
binding.kmStart.setText(route.kmStart.toString())
|
||||
binding.kmEnd.setText(route.kmEnd.toString())
|
||||
binding.hourInit.setText(getHourDay(route.started))
|
||||
binding.hourEnd.setText(getHourDay(route.finished))
|
||||
|
||||
binding.saveButton.setOnClickListener {
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
route.kmStart = binding.kmStart.text.toString().toLong()
|
||||
route.kmEnd = binding.kmEnd.text.toString().toLong()
|
||||
route.started = addDateToTime(binding.hourInit.text.toString())
|
||||
route.finished = addDateToTime(binding.hourEnd.text.toString())
|
||||
viewModel.routeUpdate(route)
|
||||
}
|
||||
binding.hourInit.setOnFocusChangeListener { view, b ->
|
||||
if (b) {
|
||||
showTimePicker(binding.hourInit)
|
||||
}
|
||||
}
|
||||
|
||||
binding.hourEnd.setOnClickListener {
|
||||
showTimePicker(binding.hourEnd)
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
override fun observeViewModel() {
|
||||
with(viewModel) {
|
||||
|
@ -238,7 +305,7 @@ class TicketsFragment(
|
|||
binding.splashProgress.visibility = View.GONE
|
||||
if (it.list.isNotEmpty()) {
|
||||
createLisTickets(it.list)
|
||||
setTitle()
|
||||
|
||||
}
|
||||
}
|
||||
responseStateAdd.observe(viewLifecycleOwner) {
|
||||
|
@ -247,91 +314,178 @@ class TicketsFragment(
|
|||
response.observe(viewLifecycleOwner) {
|
||||
binding.splashProgress.visibility = View.GONE
|
||||
}
|
||||
responseUpdateRoute.observe(viewLifecycleOwner) {
|
||||
binding.splashProgress.visibility = View.GONE
|
||||
if (it.isError) {
|
||||
ma.messageWithSound(it.errorMessage, true, true, "", true)
|
||||
} else {
|
||||
showSigned = !showSigned
|
||||
changeVisibleSettings(false)
|
||||
setToolBar()
|
||||
ma.messageWithSound("", false, true, "", false)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
responseLoadList.observe(viewLifecycleOwner) {
|
||||
binding.splashProgress.visibility = View.GONE
|
||||
ma.messageWithSound(getString(R.string.offline), true, false, "", true)
|
||||
createLisTickets(mutableListOf(), getSaved = true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun createLisTickets(list: MutableList<ClientTicket>) {
|
||||
private fun changeVisibleSettings(isVisible: Boolean) {
|
||||
|
||||
var myListClientTicketAux = list.distinctBy { it.Address }
|
||||
|
||||
for (clientTicket in myListClientTicketAux) {
|
||||
val addressId = clientTicket.Address
|
||||
val ticketsForClient = list.filter { it.Address == addressId }
|
||||
val mappedTickets = ticketsForClient.map { ticket ->
|
||||
Ticket(ticket.Id, ticket.Packages, ticket.PackingType, ticket.Note)
|
||||
}
|
||||
clientTicket.tickets = mappedTickets as MutableList<Ticket>
|
||||
if (isVisible) {
|
||||
binding.itemcardLayout.visibility = View.GONE
|
||||
binding.ticketsRecyclerview.visibility = View.GONE
|
||||
binding.layoutKmHour.visibility = View.VISIBLE
|
||||
} else {
|
||||
binding.itemcardLayout.visibility = View.VISIBLE
|
||||
binding.ticketsRecyclerview.visibility = View.VISIBLE
|
||||
binding.layoutKmHour.visibility = View.GONE
|
||||
}
|
||||
|
||||
myListClientTicket = myListClientTicketAux as MutableList<ClientTicket>
|
||||
}
|
||||
|
||||
for (m in myListClientTicket) {
|
||||
println("address" + m.Address)
|
||||
for (mt in m.tickets) {
|
||||
println("address ${m.Address}tickets" + mt.Id)
|
||||
}
|
||||
}
|
||||
adapter = TicketAdapter(
|
||||
myListClientTicket,
|
||||
object : OnItemButtonTicketRowClickListener {
|
||||
private fun createLisTickets(list: MutableList<ClientTicket>, getSaved: Boolean = false) {
|
||||
|
||||
override fun onItemButtonTicketRowClickListener(
|
||||
item: ClientTicket,
|
||||
action: String
|
||||
) {
|
||||
when (action) {
|
||||
"unload" -> {
|
||||
ma.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(title = getString(R.string.titleDeliverySummary)),
|
||||
route.id.toString()
|
||||
var myListClientTicketAux: MutableList<ClientTicket> = mutableListOf()
|
||||
|
||||
lifecycleScope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
if (getSaved) {
|
||||
myListClientTicketAux = db.clienTicketDao().getAll()
|
||||
.filter { route.id == it.route }
|
||||
.toMutableList()
|
||||
} else {
|
||||
myListClientTicketAux =
|
||||
list.distinctBy { it.Address } as MutableList<ClientTicket>
|
||||
|
||||
for (clientTicket in myListClientTicketAux) {
|
||||
val addressId = clientTicket.Address
|
||||
val ticketsForClient = list.filter { it.Address == addressId }
|
||||
val mappedTickets = ticketsForClient.map { ticket ->
|
||||
Ticket(
|
||||
ticket.Id,
|
||||
ticket.Packages,
|
||||
ticket.PackingType,
|
||||
ticket.Note,
|
||||
ticket.cmrFk
|
||||
)
|
||||
}
|
||||
clientTicket.tickets = mappedTickets as MutableList<Ticket>
|
||||
}
|
||||
|
||||
"map" -> {
|
||||
goMaps(item)
|
||||
}
|
||||
//db.clienTicketDao().delete()
|
||||
myListClientTicketAux.forEach{
|
||||
it.route = route.id
|
||||
}
|
||||
db.clienTicketDao().insert(myListClientTicketAux)
|
||||
|
||||
"note" -> {
|
||||
showNotes(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
myListClientTicket = myListClientTicketAux
|
||||
|
||||
"addNote" -> {
|
||||
addNotes(item)
|
||||
}
|
||||
val myListFiltered = if (showSigned) {
|
||||
myListClientTicket.filter { it.Signed == 1 }
|
||||
} else {
|
||||
myListClientTicket.filter { it.Signed == 0 }
|
||||
}
|
||||
adapter = TicketAdapter(
|
||||
myListFiltered as MutableList<ClientTicket>,
|
||||
object : OnItemButtonTicketRowClickListener {
|
||||
|
||||
override fun onItemButtonTicketRowClickListener(
|
||||
item: ClientTicket,
|
||||
action: String
|
||||
) {
|
||||
when (action) {
|
||||
"unload" -> {
|
||||
|
||||
val entryPoint = Gson().toJson(
|
||||
mutableMapOf(
|
||||
"route" to route.id.toString(),
|
||||
"address" to item.Address
|
||||
)
|
||||
)
|
||||
ma.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(title = getString(R.string.titleUnLoadTruck)),
|
||||
entryPoint, myListClientTicket.filter { it.Id == item.Id }
|
||||
)
|
||||
|
||||
|
||||
/* val intent = Intent(requireContext(), SignedActivity::class.java)
|
||||
startActivity(intent)*/
|
||||
}
|
||||
|
||||
"map" -> {
|
||||
goMaps(item)
|
||||
}
|
||||
|
||||
"note" -> {
|
||||
showNotes(item)
|
||||
}
|
||||
|
||||
"addNote" -> {
|
||||
addNotes(item)
|
||||
}
|
||||
|
||||
"call" -> {
|
||||
showPhones(item)
|
||||
}
|
||||
|
||||
"call" -> {
|
||||
showPhones(item)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}, object : OnItemButtonCMRRowClickListener {
|
||||
override fun onItemButtonCMRRowClickListener(
|
||||
item: Ticket
|
||||
) {
|
||||
|
||||
ma.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(
|
||||
title = getString(R.string.titleWebViewer),
|
||||
),
|
||||
entryPoint = Gson().toJson(
|
||||
mutableMapOf(
|
||||
"entryPoint" to route.id,
|
||||
"web" to "${getData("base_urlSalix")}/api/Routes/${item.cmrFk}/cmr?access_token=${
|
||||
getData(
|
||||
TOKEN
|
||||
)
|
||||
}"
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
},
|
||||
)
|
||||
|
||||
binding.ticketsRecyclerview.addItemDecoration(
|
||||
ItemDescorationCustomized(
|
||||
resources.getDimensionPixelSize(
|
||||
R.dimen.vertical_spacing
|
||||
binding.ticketsRecyclerview.addItemDecoration(
|
||||
ItemDescorationCustomized(
|
||||
resources.getDimensionPixelSize(
|
||||
R.dimen.vertical_spacing
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
binding.ticketsRecyclerview.adapter = adapter
|
||||
binding.ticketsRecyclerview.layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
adapter!!.notifyDataSetChanged()
|
||||
|
||||
binding.ticketsRecyclerview.adapter = adapter
|
||||
binding.ticketsRecyclerview.layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
adapter!!.notifyDataSetChanged()
|
||||
setTitle()
|
||||
}
|
||||
}
|
||||
|
||||
private fun addNotes(itemClient: ClientTicket) {
|
||||
|
||||
var customDialogInput = CustomDialogInputNotes(requireContext())
|
||||
val customDialogInput = CustomDialogInputNotes(requireContext())
|
||||
customDialogInput.setTitle("Notas")
|
||||
|
||||
var adapter: GeneralAdapter
|
||||
var itemsNotes: List<GeneralItem> = listOf(
|
||||
val adapter: GeneralAdapter
|
||||
val itemsNotes: List<GeneralItem> = listOf(
|
||||
GeneralItem(code = "", text = getString(R.string.clientNot)),
|
||||
GeneralItem(code = "", text = getString(R.string.clientAuthorization)),
|
||||
GeneralItem(code = "", text = getString(R.string.clientReject)),
|
||||
|
@ -403,43 +557,47 @@ class TicketsFragment(
|
|||
|
||||
fun showPhones(clientClicked: ClientTicket) {
|
||||
|
||||
val phones = mutableListOf<String>().apply {
|
||||
addAll(clientClicked.Phones)
|
||||
add(clientClicked.SalePersonPhone)
|
||||
}
|
||||
val builder = AlertDialog.Builder(context)
|
||||
builder.setTitle(getString(R.string.phones))
|
||||
val listPhones = phones.toTypedArray()
|
||||
builder.setItems(listPhones) { dialog, which ->
|
||||
|
||||
if (ContextCompat.checkSelfPermission(
|
||||
requireContext(),
|
||||
Manifest.permission.CALL_PHONE
|
||||
) == PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
val callIntent = Intent(Intent.ACTION_CALL)
|
||||
callIntent.data = Uri.parse("tel:$which]")
|
||||
startActivity(callIntent)
|
||||
} else {
|
||||
ActivityCompat.requestPermissions(
|
||||
context as Activity,
|
||||
arrayOf(Manifest.permission.CALL_PHONE),
|
||||
REQUEST_CALL_PERMISSION
|
||||
)
|
||||
if (!clientClicked.Phones.isNullOrEmpty()) {
|
||||
val phones = mutableListOf<String>().apply {
|
||||
addAll(clientClicked.Phones!!)
|
||||
if (!clientClicked.SalePersonPhone.isNullOrEmpty())
|
||||
add(clientClicked.SalePersonPhone!!)
|
||||
}
|
||||
val builder = AlertDialog.Builder(context)
|
||||
builder.setTitle(getString(R.string.phones))
|
||||
val listPhones = phones.toTypedArray()
|
||||
builder.setItems(listPhones) { dialog, which ->
|
||||
|
||||
if (ContextCompat.checkSelfPermission(
|
||||
requireContext(),
|
||||
Manifest.permission.CALL_PHONE
|
||||
) == PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
val callIntent = Intent(Intent.ACTION_CALL)
|
||||
callIntent.data = Uri.parse("tel:$which]")
|
||||
startActivity(callIntent)
|
||||
} else {
|
||||
ActivityCompat.requestPermissions(
|
||||
context as Activity,
|
||||
arrayOf(Manifest.permission.CALL_PHONE),
|
||||
REQUEST_CALL_PERMISSION
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
val dialog = builder.create()
|
||||
dialog.show()
|
||||
} else {
|
||||
getString(R.string.no_phones).toast(requireContext())
|
||||
}
|
||||
val dialog = builder.create()
|
||||
dialog.show()
|
||||
|
||||
}
|
||||
|
||||
fun goMaps(item: ClientTicket) {
|
||||
|
||||
if (isGoogleMapsInstalled()) {
|
||||
|
||||
var uri: String
|
||||
val uri: String
|
||||
if (item.Latitude != null) {
|
||||
uri = "geo:${item.Latitude},${item.Longitude}?q=" + item.ClientName +
|
||||
" " + item.AddressName +
|
||||
|
@ -490,11 +648,11 @@ class TicketsFragment(
|
|||
|
||||
private fun showTimePicker(textV: TextView) {
|
||||
|
||||
var mcurrentTime = Calendar.getInstance()
|
||||
var hour = mcurrentTime[Calendar.HOUR_OF_DAY]
|
||||
var minute = mcurrentTime[Calendar.MINUTE]
|
||||
val mcurrentTime = Calendar.getInstance()
|
||||
val hour = mcurrentTime[Calendar.HOUR_OF_DAY]
|
||||
val minute = mcurrentTime[Calendar.MINUTE]
|
||||
|
||||
var mTimePicker = TimePickerDialog(
|
||||
val mTimePicker = TimePickerDialog(
|
||||
requireContext(),
|
||||
{ _, selectedHour, selectedMinute -> textV.text = "$selectedHour:$selectedMinute" },
|
||||
hour,
|
||||
|
|
|
@ -1,14 +1,20 @@
|
|||
package es.verdnatura.presentation.view.feature.delivery.model
|
||||
|
||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
|
||||
import androidx.room.Entity
|
||||
import androidx.room.PrimaryKey
|
||||
import androidx.room.TypeConverters
|
||||
import es.verdnatura.db.MapTypeConverter
|
||||
import java.io.Serializable
|
||||
|
||||
|
||||
class ClientTicketList(
|
||||
var list: MutableList<ClientTicket> = mutableListOf()
|
||||
)
|
||||
|
||||
|
||||
@Entity(tableName = "clientTickets")
|
||||
data class ClientTicket(
|
||||
var Id: Int,
|
||||
@PrimaryKey var Id: Long,
|
||||
var Client: Int,
|
||||
var ClientName: String,
|
||||
var Address: Int,
|
||||
|
@ -17,26 +23,38 @@ data class ClientTicket(
|
|||
var PostalCode: String,
|
||||
var City: String,
|
||||
var Warehouse: String?,
|
||||
var SalePersonPhone: String,
|
||||
var SalePersonPhone: String?,
|
||||
var Note: String?,
|
||||
var Phones: List<String>,
|
||||
var Location: Location,
|
||||
@TypeConverters(MapTypeConverter::class) var Phones: List<String>?,
|
||||
@TypeConverters(MapTypeConverter::class) var Location: MyLocation?,
|
||||
var Signed: Int,
|
||||
var Latitude: String,
|
||||
var Longitude: String,
|
||||
var Polizon: Any?,
|
||||
var PackingType: String,
|
||||
var tickets: MutableList<Ticket>
|
||||
)
|
||||
var Latitude: Double?,
|
||||
var Longitude: Double?,
|
||||
var Polizon: String?,
|
||||
var PackingType: String?,
|
||||
@TypeConverters(MapTypeConverter::class) var tickets: MutableList<Ticket>,
|
||||
//Tarea 5996, falta mostrar o no si no es null
|
||||
var cmrFk: Int? = null,
|
||||
var route:Long? = null
|
||||
) : Serializable
|
||||
|
||||
data class MyLocation(
|
||||
var Longitude: Double,
|
||||
var Latitude: Double
|
||||
) : Serializable
|
||||
|
||||
data class Location(
|
||||
var Longitude: String,
|
||||
var Latitude: String
|
||||
)
|
||||
data class Ticket(
|
||||
var Id: Int,
|
||||
var Id: Long,
|
||||
var Packages: Int,
|
||||
var PackingType: String?,
|
||||
var Note:String?
|
||||
var Note: String?,
|
||||
var cmrFk: Int? = null
|
||||
) : Serializable
|
||||
|
||||
@Entity(tableName = "signedPending")
|
||||
data class SignedTickets(
|
||||
@TypeConverters(MapTypeConverter::class) val queryMapList: MutableMap<String?, String?>,
|
||||
@PrimaryKey
|
||||
val fileName: String
|
||||
)
|
||||
|
||||
)
|
|
@ -2,6 +2,9 @@ package es.verdnatura.presentation.view.feature.delivery.model
|
|||
|
||||
import androidx.room.Entity
|
||||
import androidx.room.PrimaryKey
|
||||
import androidx.room.TypeConverters
|
||||
import es.verdnatura.db.MapTypeConverter
|
||||
import java.io.Serializable
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
|
@ -22,7 +25,7 @@ class DeliveryInfo(
|
|||
var postCode: Int = 0
|
||||
)
|
||||
|
||||
class ExpeditionInfoList(
|
||||
class ExpeditionInfoList (
|
||||
var list: List<ExpeditionInfoLog> = listOf()
|
||||
)
|
||||
|
||||
|
@ -71,8 +74,7 @@ class ExpeditionInfoLoadUnload(
|
|||
var code: String?,
|
||||
var nickname: String,
|
||||
var postalCode: Int,
|
||||
var isError: Boolean = false
|
||||
)
|
||||
) : Serializable
|
||||
|
||||
@Entity(tableName = "expeditionPending")
|
||||
class ExpeditionInfoPending(
|
||||
|
@ -86,7 +88,8 @@ class ExpeditionInfoPending(
|
|||
var code: String?,
|
||||
var nickname: String,
|
||||
var postalCode: Int
|
||||
)
|
||||
|
||||
):Serializable
|
||||
|
||||
|
||||
class ExpeditionSummaryList(
|
||||
|
@ -106,12 +109,17 @@ class ExpeditionInfoSummary(
|
|||
class RouteList(
|
||||
var list: MutableList<RouteInfo> = mutableListOf()
|
||||
)
|
||||
@Entity(tableName = "routesLoaded")
|
||||
class RouteLoaded(
|
||||
@PrimaryKey var id: Long,
|
||||
var created: String)
|
||||
|
||||
@Entity(tableName = "routes")
|
||||
class RouteInfo(
|
||||
var id: Long,
|
||||
@PrimaryKey var id: Long,
|
||||
var driver: String,
|
||||
var hour: String,
|
||||
var created: Date,
|
||||
var hour: String?,
|
||||
@TypeConverters(MapTypeConverter::class) var created: Date,
|
||||
var m3: Double,
|
||||
var numberPlate: String,
|
||||
var name: String,
|
||||
|
@ -120,7 +128,7 @@ class RouteInfo(
|
|||
var started: String,
|
||||
var finished: String,
|
||||
var header :Boolean = false
|
||||
) {
|
||||
):Serializable {
|
||||
override fun toString(): String {
|
||||
return "$driver$id$name$numberPlate$m3$created$hour$"
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package es.verdnatura.presentation.view.feature.delivery.viewmodels
|
|||
import android.content.Context
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import es.verdnatura.db.ExpedicionDatabase
|
||||
import es.verdnatura.db.DeliveryDatabase
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoLoadUnload
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
|
@ -11,23 +11,22 @@ import kotlinx.coroutines.launch
|
|||
import kotlinx.coroutines.withContext
|
||||
|
||||
|
||||
|
||||
class DatabaseViewModel(val context: Context) : BaseViewModel(context) {
|
||||
|
||||
|
||||
private val db = ExpedicionDatabase.getInstance(context)
|
||||
val expediciones = MutableLiveData<List<ExpeditionInfoLoadUnload>>()
|
||||
|
||||
fun cargarExpediciones() {
|
||||
viewModelScope.launch {
|
||||
val expedicionesList = withContext(Dispatchers.IO) {
|
||||
db.expedicionDao().getAll(123)
|
||||
}
|
||||
expediciones.postValue(expedicionesList)
|
||||
private val db = DeliveryDatabase.getInstance(context)
|
||||
val expediciones = MutableLiveData<List<ExpeditionInfoLoadUnload>>()
|
||||
|
||||
fun cargarExpediciones() {
|
||||
viewModelScope.launch {
|
||||
val expedicionesList = withContext(Dispatchers.IO) {
|
||||
db.expedicionDao().getAll(123)
|
||||
}
|
||||
expediciones.postValue(expedicionesList)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -24,9 +24,14 @@ import es.verdnatura.presentation.view.feature.delivery.model.RouteDeliveryList
|
|||
import es.verdnatura.presentation.view.feature.delivery.model.RouteInfo
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.RouteList
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.Ticket
|
||||
import okhttp3.MediaType
|
||||
import okhttp3.MultipartBody
|
||||
import okhttp3.RequestBody
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import retrofit2.Call
|
||||
import retrofit2.Response
|
||||
import java.io.File
|
||||
|
||||
class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
|
||||
|
||||
|
@ -58,16 +63,28 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
val responseStateAdd: LiveData<ResponseItemVO>
|
||||
get() = _responseStateAdd
|
||||
|
||||
private val _responseUpdateRoute by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responseUpdateRoute: LiveData<ResponseItemVO>
|
||||
get() = _responseUpdateRoute
|
||||
|
||||
private val _response by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val response: LiveData<ResponseItemVO> = _response
|
||||
|
||||
private val _responseSign by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responseSign: LiveData<ResponseItemVO> = _responseSign
|
||||
|
||||
private val _expeditionList by lazy { MutableLiveData<ExpeditionList>() }
|
||||
val expeditionList: LiveData<ExpeditionList> = _expeditionList
|
||||
|
||||
val loadRouteList = Transformations.map(_routeList) { Event(it) }
|
||||
|
||||
|
||||
private val _responseLoadList by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responseLoadList: LiveData<ResponseItemVO> = _responseLoadList
|
||||
|
||||
private val _responseStateList by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responseStateList: LiveData<ResponseItemVO> = _responseStateList
|
||||
|
||||
fun getInfoCompany(
|
||||
userId: Int
|
||||
) {
|
||||
|
@ -122,9 +139,9 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
) {
|
||||
|
||||
silex.getExpeditionFromRoute(route)
|
||||
.enqueue(object : SilexCallback<List<ExpeditionInfoLoadUnload>>(context) {
|
||||
.enqueue(object : SilexCallback<MutableList<ExpeditionInfoLoadUnload>>(context) {
|
||||
|
||||
override fun onSuccess(response: Response<List<ExpeditionInfoLoadUnload>>) {
|
||||
override fun onSuccess(response: Response<MutableList<ExpeditionInfoLoadUnload>>) {
|
||||
|
||||
if (response.body() != null) {
|
||||
_expeditionInfoLoadUnloadList.value =
|
||||
|
@ -135,8 +152,7 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
|
||||
override fun onError(t: Throwable) {
|
||||
_expeditionInfoLoadUnloadList.value = ExpeditionList()
|
||||
super.onError(t)
|
||||
_responseLoadList.value = ResponseItemVO("", true, t.message.toString(), 0)
|
||||
|
||||
}
|
||||
})
|
||||
|
@ -171,13 +187,19 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
silex.expeditionState_add(expeditions, state)
|
||||
.enqueue(object : SilexCallback<Void>(context) {
|
||||
override fun onSuccess(response: Response<Void>) {
|
||||
_responseStateAdd.value = ResponseItemVO()
|
||||
_responseStateAdd.value = ResponseItemVO(state,false,"",0)
|
||||
}
|
||||
|
||||
override fun onError(t: Throwable) {
|
||||
super.onError(t)
|
||||
_responseStateAdd.value = ResponseItemVO()
|
||||
}
|
||||
|
||||
override fun onFailure(call: Call<Void>, t: Throwable) {
|
||||
_responseStateList.value = ResponseItemVO("", true, t.message.toString(), 0)
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -247,8 +269,9 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
|
||||
override fun onError(t: Throwable) {
|
||||
_routeList.value = RouteList()
|
||||
super.onError(t)
|
||||
//_routeList.value = RouteList()
|
||||
_responseLoadList.value = ResponseItemVO("", true, t.message.toString(), 0)
|
||||
//super.onError(t)
|
||||
|
||||
}
|
||||
})
|
||||
|
@ -271,8 +294,9 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
|
||||
override fun onError(t: Throwable) {
|
||||
_clientTicketList.value = ClientTicketList()
|
||||
super.onError(t)
|
||||
// _clientTicketList.value = ClientTicketList()
|
||||
_responseLoadList.value = ResponseItemVO("", true, t.message.toString(), 0)
|
||||
// super.onError(t)
|
||||
|
||||
}
|
||||
})
|
||||
|
@ -304,12 +328,12 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
.enqueue(object : SilexCallback<Any>(context) {
|
||||
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_response.value = ResponseItemVO()
|
||||
_responseUpdateRoute.value = ResponseItemVO()
|
||||
|
||||
}
|
||||
|
||||
override fun onError(t: Throwable) {
|
||||
_response.value = ResponseItemVO()
|
||||
_responseUpdateRoute.value = ResponseItemVO()
|
||||
super.onError(t)
|
||||
|
||||
}
|
||||
|
@ -322,9 +346,12 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
|
||||
|
||||
) {
|
||||
silex.addNotes( mapOf(
|
||||
"Tickets" to listTickets.map { it.Id },
|
||||
"note" to note))
|
||||
silex.addNotes(
|
||||
mapOf(
|
||||
"Tickets" to listTickets.map { it.Id },
|
||||
"note" to note
|
||||
)
|
||||
)
|
||||
.enqueue(object : SilexCallback<Any>(context) {
|
||||
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
|
@ -339,21 +366,66 @@ class DeliveryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
})
|
||||
}
|
||||
fun createJSONObject(listTickets: MutableList<Ticket>, note: String): String {
|
||||
// Supongamos que tienes la lista de tickets y el valor como los siguientes:
|
||||
// val listTickets: List<String> = listOf("4255452", "5454515")
|
||||
// val note: String = "Mi nota"
|
||||
|
||||
// Crear el objeto JSON
|
||||
val jsonObject = JSONObject()
|
||||
val jsonArrayTickets = JSONArray(listTickets)
|
||||
jsonObject.put("tickets", jsonArrayTickets)
|
||||
jsonObject.put("note", note)
|
||||
|
||||
// Convertir el objeto JSON a un String
|
||||
return jsonObject.toString()
|
||||
fun imageUpload(
|
||||
warehouseId: Number,
|
||||
companyId: Number,
|
||||
dmsTypeId: Number,
|
||||
reference: String,
|
||||
description: String,
|
||||
hasFile: Boolean,
|
||||
file: MultipartBody.Part
|
||||
) {
|
||||
salix.imageUpload(warehouseId, companyId, dmsTypeId, reference, description, hasFile, file)
|
||||
.enqueue(object : SilexCallback<Any>(context) {})
|
||||
}
|
||||
|
||||
fun saveSign(filePath: String, mapQuery: Map<String?, String?>) {
|
||||
val filePart = MultipartBody.Part.createFormData(
|
||||
"file",
|
||||
File(filePath).name,
|
||||
RequestBody.create(
|
||||
MediaType.parse("image/png"),
|
||||
File(filePath)
|
||||
)
|
||||
)
|
||||
salix.saveSign(filePart, mapQuery)
|
||||
.enqueue(object : SilexCallback<Any>(context) {
|
||||
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_responseSign.value = ResponseItemVO(filePath, false, "", 0)
|
||||
|
||||
}
|
||||
|
||||
//Otro fallo
|
||||
override fun onError(t: Throwable) {
|
||||
_responseSign.value = ResponseItemVO("", true, "Tickets:"+File(filePath).name + "→"+ t.message.toString(), 0)
|
||||
// super.onError(t)
|
||||
}
|
||||
|
||||
//Fallo de red
|
||||
override fun onFailure(call: Call<Any>, t: Throwable) {
|
||||
_responseSign.value = ResponseItemVO("NetWork Error", true, t.message.toString(),0)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fun createJSONObject(listTickets: MutableList<Ticket>, note: String): String {
|
||||
// Supongamos que tienes la lista de tickets y el valor como los siguientes:
|
||||
// val listTickets: List<String> = listOf("4255452", "5454515")
|
||||
// val note: String = "Mi nota"
|
||||
|
||||
// Crear el objeto JSON
|
||||
val jsonObject = JSONObject()
|
||||
val jsonArrayTickets = JSONArray(listTickets)
|
||||
jsonObject.put("tickets", jsonArrayTickets)
|
||||
jsonObject.put("note", note)
|
||||
|
||||
// Convertir el objeto JSON a un String
|
||||
return jsonObject.toString()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package es.verdnatura.presentation.view.feature.inventario.fragment
|
|||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.media.MediaPlayer
|
||||
import android.os.Build
|
||||
import android.text.InputType
|
||||
import android.view.View.GONE
|
||||
|
@ -30,6 +29,7 @@ import es.verdnatura.presentation.view.feature.inventario.adapter.InventoryParki
|
|||
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventoryParking
|
||||
import es.verdnatura.presentation.view.feature.inventario.model.ItemShelvingChecked
|
||||
import es.verdnatura.presentation.view.feature.inventario.model.ItemShelvingVisible
|
||||
import es.verdnatura.presentation.view.feature.inventario.model.ItemShelvingVisibleZero
|
||||
import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicadorVO
|
||||
|
||||
|
||||
|
@ -42,22 +42,10 @@ class InventaryParkingFragment(
|
|||
|
||||
private var adapter: InventoryParkingAdapter? = null
|
||||
private lateinit var customDialogInput: CustomDialogInput
|
||||
private lateinit var customDialogTwoButtons: CustomDialogTwoButtons
|
||||
private lateinit var customDialogList: CustomDialogList
|
||||
private var listItems: MutableList<ItemUbicadorVO> = mutableListOf()
|
||||
private var listLocalItems: ArrayList<ItemUbicadorVO> = ArrayList()
|
||||
private lateinit var customDialog: CustomDialog
|
||||
private var deep: Int = 1
|
||||
private var parking: String = ""
|
||||
private var etiquetas: String = "0"
|
||||
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
|
||||
private var isShelvinLogfromMainScreen = false
|
||||
private var modeCheckUbication = false
|
||||
private var itemScannedScreen = 0
|
||||
private var shelvingFk: String = ""
|
||||
var mperror: MediaPlayer? = null
|
||||
var mpok: MediaPlayer? = null
|
||||
var isBack = false
|
||||
|
||||
private var isBack = false
|
||||
private lateinit var myListInventory: MutableList<ItemInventoryParking>
|
||||
private var listParkings: ArrayList<BarcodeVO> = ArrayList()
|
||||
private var listWagonsAdapter: BarcodeAdapter? = null
|
||||
|
@ -67,6 +55,8 @@ class InventaryParkingFragment(
|
|||
private var parkingFrom = ""
|
||||
private var parkingTo = ""
|
||||
private var filterActivated = false
|
||||
private var shelvingSaved = ""
|
||||
val listIcons: ArrayList<ImageView> = ArrayList()
|
||||
|
||||
companion object {
|
||||
fun newInstance(title: String) =
|
||||
|
@ -80,7 +70,7 @@ class InventaryParkingFragment(
|
|||
val layoutManager =
|
||||
binding.inventoryParkingRecyclerview.layoutManager as LinearLayoutManager
|
||||
scrollPosition = layoutManager.findFirstVisibleItemPosition()
|
||||
}catch (exception:Exception){
|
||||
} catch (exception: Exception) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -99,8 +89,6 @@ class InventaryParkingFragment(
|
|||
override fun init() {
|
||||
|
||||
customDialogInput = CustomDialogInput(requireContext())
|
||||
customDialog = CustomDialog(requireContext())
|
||||
customDialogTwoButtons = CustomDialogTwoButtons(requireContext())
|
||||
customDialogList = CustomDialogList(requireContext())
|
||||
|
||||
ma.hideBottomNavigation(GONE)
|
||||
|
@ -129,7 +117,6 @@ class InventaryParkingFragment(
|
|||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
private fun setToolBar() {
|
||||
|
||||
val listIcons: ArrayList<ImageView> = ArrayList()
|
||||
|
||||
val iconAdd = ImageView(context)
|
||||
iconAdd.setImageResource(R.drawable.ic_add_black_24dp)
|
||||
|
@ -154,10 +141,17 @@ class InventaryParkingFragment(
|
|||
iconFilter.tooltipText = getTooltip(R.drawable.ic_filter_inventory)
|
||||
|
||||
}
|
||||
listIcons.add(iconParkingFrom)
|
||||
listIcons.add(iconFilter)
|
||||
listIcons.add(iconReset)
|
||||
|
||||
if (listIcons.isEmpty()) {
|
||||
listIcons.add(iconParkingFrom)
|
||||
listIcons.add(iconFilter)
|
||||
listIcons.add(iconReset)
|
||||
} else {
|
||||
listIcons.clear()
|
||||
listIcons.add(iconParkingFrom)
|
||||
listIcons.add(iconFilter)
|
||||
listIcons.add(iconReset)
|
||||
}
|
||||
|
||||
binding.mainToolbar.toolbarIcons.adapter =
|
||||
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
|
||||
|
@ -192,7 +186,7 @@ class InventaryParkingFragment(
|
|||
binding.textinputlayoutMatricula.visibility = VISIBLE
|
||||
showResetShelving()
|
||||
} else {
|
||||
"La lista del inventario está vacía".toast(requireContext())
|
||||
getString(R.string.listInventoryEmpty).toast(requireContext())
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -206,12 +200,27 @@ class InventaryParkingFragment(
|
|||
}
|
||||
|
||||
})
|
||||
chageListAdapter(listIcons.filter { it != iconReset })
|
||||
binding.mainToolbar.toolbarIcons.layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||
}
|
||||
|
||||
private fun filterList() {
|
||||
TODO("Not yet implemented")
|
||||
|
||||
private fun chageListAdapter(filterList: List<ImageView>, removeReset: Boolean = false) {
|
||||
if (!removeReset) {
|
||||
(binding.mainToolbar.toolbarIcons.adapter as ToolBarAdapterTooltip).setItemsList(
|
||||
filterList
|
||||
)
|
||||
} else {
|
||||
(binding.mainToolbar.toolbarIcons.adapter as ToolBarAdapterTooltip).setItemsList(
|
||||
filterList.filter {
|
||||
it.drawable.constantState?.equals(
|
||||
context?.getDrawable(
|
||||
R.drawable.ic_remove_checks
|
||||
)?.constantState
|
||||
) != true
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private fun showResetShelving() {
|
||||
|
@ -256,7 +265,7 @@ class InventaryParkingFragment(
|
|||
|
||||
filter.add("id", JsonObject().apply { add("inq", inqValues) })
|
||||
binding.splashProgress.visibility = VISIBLE
|
||||
viewModel.itemShelvingsUpdate(
|
||||
viewModel.itemShelvingsReset(
|
||||
filter,
|
||||
ItemShelvingChecked(null, mobileApplication.userId!!)
|
||||
)
|
||||
|
@ -272,31 +281,7 @@ class InventaryParkingFragment(
|
|||
binding.textinputlayoutMatricula.visibility = VISIBLE
|
||||
customDialogList.setTitle(getString(R.string.selectParkingsCheckin))
|
||||
customDialogList.setDescription(getString(R.string.selectParkingsFrom))
|
||||
|
||||
/* .setOkButton(
|
||||
getString(R.string.review)
|
||||
) {
|
||||
ma.hideKeyboard(customDialogList.getEditText())
|
||||
|
||||
if (listParkings.size == 2) {
|
||||
|
||||
callGetInventory(
|
||||
listParkings.first().code!!.uppercase(),
|
||||
customDialogList.getValue().uppercase()
|
||||
)
|
||||
|
||||
ma.hideKeyboard(customDialogList.getEditText())
|
||||
listParkings.clear()
|
||||
customDialogList.dismiss()
|
||||
binding.editMatricula.requestFocus()
|
||||
} else {
|
||||
listParkings.add(0, BarcodeVO(code = customDialogList.getValue()))
|
||||
customDialogList.setValue("")
|
||||
customDialogList.setDescription(getString(R.string.selectParkingsTo))
|
||||
}
|
||||
|
||||
|
||||
}*/.setKoButton(getString(R.string.cancel)) {
|
||||
.setKoButton(getString(R.string.cancel)) {
|
||||
ma.hideKeyboard(customDialogList.getEditText())
|
||||
listParkings = ArrayList()
|
||||
customDialogList.dismiss()
|
||||
|
@ -374,7 +359,30 @@ class InventaryParkingFragment(
|
|||
requireActivity().onBackPressed()
|
||||
}
|
||||
|
||||
setTooltips()
|
||||
binding.inventorySwipe.setOnRefreshListener {
|
||||
|
||||
positionShelvingChecking = -1
|
||||
positionItemChecking = -1
|
||||
shelvingSaved = ""
|
||||
|
||||
binding.splashProgress.visibility = VISIBLE
|
||||
viewModel.getInventoryParking(
|
||||
parkingFrom,
|
||||
parkingTo
|
||||
)
|
||||
|
||||
binding.editMatricula.hint = getString(R.string.scanShelving)
|
||||
chageListAdapter(listIcons.filter {
|
||||
it.drawable.constantState?.equals(
|
||||
context?.getDrawable(
|
||||
R.drawable.ic_remove_checks
|
||||
)?.constantState
|
||||
) != true
|
||||
})
|
||||
|
||||
binding.inventorySwipe.isRefreshing = false
|
||||
|
||||
}
|
||||
binding.editMatricula.requestFocus()
|
||||
binding.editMatricula.setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
||||
|
@ -399,17 +407,57 @@ class InventaryParkingFragment(
|
|||
positionShelvingChecking = myListInventory.indexOfFirst { item ->
|
||||
item.shelvingFk == binding.editMatricula.text.toString()
|
||||
}
|
||||
if (positionShelvingChecking != -1) {
|
||||
shelvingSaved = myListInventory[positionShelvingChecking].shelvingFk
|
||||
}
|
||||
|
||||
if (positionShelvingChecking == -1) {
|
||||
var allChecked = if (positionShelvingChecking != -1) {
|
||||
myListInventory.filter { it.shelvingFk == myListInventory[positionShelvingChecking].shelvingFk }
|
||||
.all { item ->
|
||||
item.isChecked != null && item.isChecked!! > 0
|
||||
}
|
||||
} else {
|
||||
false
|
||||
}
|
||||
|
||||
if (allChecked) {
|
||||
ma.messageWithSound(
|
||||
getString(R.string.shelvingNotFound),
|
||||
true,
|
||||
"Matrícula ya revisada",
|
||||
false,
|
||||
true,
|
||||
"",
|
||||
true
|
||||
isToasted = true
|
||||
)
|
||||
chageListAdapter(listIcons)
|
||||
adapter!!.setItems(myListInventory.filter { it.shelvingFk == myListInventory[positionShelvingChecking].shelvingFk })
|
||||
positionShelvingChecking = -1
|
||||
positionItemChecking = -1
|
||||
shelvingSaved = ""
|
||||
binding.editMatricula.hint = getString(R.string.scanShelving)
|
||||
binding.textinputlayoutMatricula.hint = getString(R.string.scanShelving)
|
||||
|
||||
|
||||
} else {
|
||||
binding.editMatricula.hint = getString(R.string.scanItemForChecking)
|
||||
|
||||
if (positionShelvingChecking == -1) {
|
||||
ma.messageWithSound(
|
||||
getString(R.string.shelvingNotFound),
|
||||
true,
|
||||
true,
|
||||
"",
|
||||
true
|
||||
)
|
||||
} else {
|
||||
|
||||
chageListAdapter(listIcons)
|
||||
adapter!!.setItems(myListInventory.filter { it.shelvingFk == myListInventory[positionShelvingChecking].shelvingFk })
|
||||
|
||||
binding.editMatricula.hint = getString(R.string.scanItemForChecking)
|
||||
binding.textinputlayoutMatricula.hint =
|
||||
getString(R.string.scanItemForChecking)
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
|
@ -423,64 +471,10 @@ class InventaryParkingFragment(
|
|||
).toString()
|
||||
)
|
||||
|
||||
|
||||
/* binding.editMatricula.setText(
|
||||
itemScanValue(
|
||||
binding.editMatricula.text.toString(),
|
||||
"buy",
|
||||
"more"
|
||||
).toString()
|
||||
)*/
|
||||
|
||||
|
||||
/* positionItemChecking = myListInventory.indexOfFirst { item ->
|
||||
item.itemFk == binding.editMatricula.text.toString()
|
||||
.toInt() && item.shelvingFk == myListInventory[positionShelvingChecking].shelvingFk && item.isChecked == null
|
||||
}*/
|
||||
} catch (ex: Exception) {
|
||||
ma.messageWithSound(ex.message!!, true, true, "", null)
|
||||
}
|
||||
|
||||
//fun checkItem al obterner el code de Salix
|
||||
|
||||
/* if (positionItemChecking == -1) {
|
||||
ma.messageWithSound(
|
||||
getString(R.string.itemNotFoundScanAgain),
|
||||
true,
|
||||
true,
|
||||
"",
|
||||
true
|
||||
)
|
||||
positionShelvingChecking = -1
|
||||
binding.editMatricula.hint = getString(R.string.scanShelvingAgain)
|
||||
} else {
|
||||
|
||||
try {
|
||||
binding.splashProgress.visibility = VISIBLE
|
||||
|
||||
//SE pone en el response
|
||||
viewModel.itemShelvingUpdate(
|
||||
myListInventory[positionItemChecking].id,
|
||||
ItemShelvingChecked(true, mobileApplication.userId!!)
|
||||
)
|
||||
myListInventory[positionItemChecking].isChecked = 1
|
||||
adapter!!.notifyDataSetChanged()
|
||||
binding.editMatricula.hint = getString(R.string.scanShelving)
|
||||
positionItemChecking = -1
|
||||
positionShelvingChecking = -1
|
||||
|
||||
/* viewModel.getIdFromCodeSalix(
|
||||
code = itemScanValue(
|
||||
binding.editMatricula.text.toString(),
|
||||
"buy",
|
||||
"more"
|
||||
).toString())*/
|
||||
|
||||
} catch (Ex: Exception) {
|
||||
ma.messageWithSound(Ex.message.toString(), true, true)
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
}
|
||||
binding.editMatricula.setText("")
|
||||
|
@ -510,14 +504,13 @@ class InventaryParkingFragment(
|
|||
"",
|
||||
true
|
||||
)
|
||||
|
||||
positionShelvingChecking = -1
|
||||
binding.editMatricula.hint = getString(R.string.scanShelvingAgain)
|
||||
} else {
|
||||
|
||||
try {
|
||||
binding.splashProgress.visibility = VISIBLE
|
||||
|
||||
//SE pone en el response
|
||||
viewModel.itemShelvingUpdate(
|
||||
myListInventory[positionItemChecking].id,
|
||||
ItemShelvingChecked(true, mobileApplication.userId!!)
|
||||
|
@ -525,55 +518,29 @@ class InventaryParkingFragment(
|
|||
myListInventory[positionItemChecking].isChecked = 1
|
||||
adapter!!.notifyDataSetChanged()
|
||||
binding.editMatricula.hint = getString(R.string.scanShelving)
|
||||
|
||||
var allChecked =
|
||||
myListInventory.filter { it.shelvingFk == myListInventory[positionShelvingChecking].shelvingFk }
|
||||
.all { item ->
|
||||
item.isChecked != null && item.isChecked!! > 0
|
||||
}
|
||||
if (allChecked) {
|
||||
shelvingSaved = ""
|
||||
}
|
||||
positionItemChecking = -1
|
||||
positionShelvingChecking = -1
|
||||
|
||||
|
||||
} catch (ex: Exception) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun setTooltips() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
binding.editImg.tooltipText = getTooltip(R.drawable.ic_mode_edit_black_24dp)
|
||||
binding.deleteImg.tooltipText =
|
||||
getTooltip(R.drawable.ic_delete_forever_black_24dp)
|
||||
binding.editPrioridad.tooltipText =
|
||||
getString(R.string.changePriority)
|
||||
binding.parkingImg.tooltipText =
|
||||
getTooltip(R.drawable.ic_local_parking_black_24dp)
|
||||
binding.automaticImg.tooltipText =
|
||||
getTooltip(R.drawable.ic_flash_auto_black_24dp)
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun observeViewModel() {
|
||||
|
||||
with(viewModel) {
|
||||
|
||||
/* loadInventaryParkingList.observe(viewLifecycleOwner) { event ->
|
||||
event.getContentIfNotHandled().notNull {
|
||||
binding.splashProgress.visibility = GONE
|
||||
if (it.list[0].isError) {
|
||||
ma.messageWithSound(
|
||||
it.list[0].errorMessage,
|
||||
it.list[0].isError,
|
||||
false
|
||||
)
|
||||
|
||||
} else {
|
||||
myListInventory = it.list as MutableList<ItemInventoryParking>
|
||||
createListInventoryParking(myListInventory)
|
||||
|
||||
}
|
||||
}
|
||||
}*/
|
||||
inventoryListParking.observe(viewLifecycleOwner, Observer {
|
||||
binding.splashProgress.visibility = GONE
|
||||
|
||||
|
@ -587,7 +554,7 @@ class InventaryParkingFragment(
|
|||
|
||||
} else {
|
||||
myListInventory = it.list as MutableList<ItemInventoryParking>
|
||||
createListInventoryParking(myListInventory)
|
||||
createListInventoryParking()
|
||||
customDialogInput.dismiss()
|
||||
binding.textinputlayoutMatricula.visibility = VISIBLE
|
||||
binding.editMatricula.requestFocus()
|
||||
|
@ -596,34 +563,6 @@ class InventaryParkingFragment(
|
|||
}
|
||||
})
|
||||
|
||||
|
||||
/* loadInventaryParkingList.observe(viewLifecycleOwner) { event ->
|
||||
event.getContentIfNotHandled().notNull {
|
||||
binding.splashProgress.visibility = GONE
|
||||
try {
|
||||
|
||||
|
||||
if (it.list.isNotEmpty()) {
|
||||
if (it.list[0].isError) {
|
||||
ma.messageWithSound(
|
||||
it.list[0].errorMessage,
|
||||
it.list[0].isError,
|
||||
false
|
||||
)
|
||||
|
||||
} else {
|
||||
myListInventory = it.list as MutableList<ItemInventoryParking>
|
||||
createListInventoryParking(myListInventory)
|
||||
|
||||
}
|
||||
}}catch (
|
||||
ex:Exception
|
||||
){
|
||||
ex.message!!.toast(requireContext())
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
loadReponseCode.observe(viewLifecycleOwner) { event ->
|
||||
event.getContentIfNotHandled().notNull {
|
||||
binding.splashProgress.visibility = GONE
|
||||
|
@ -637,47 +576,61 @@ class InventaryParkingFragment(
|
|||
}
|
||||
}
|
||||
|
||||
/* responseCode.observe(viewLifecycleOwner, Observer {
|
||||
binding.splashProgress.visibility = GONE
|
||||
if (it.isError) {
|
||||
ma.messageWithSound(it.errorMessage, it.isError, true)
|
||||
|
||||
} else {
|
||||
checkItem(it.response)
|
||||
|
||||
}
|
||||
})*/
|
||||
response.observe(viewLifecycleOwner, Observer {
|
||||
binding.splashProgress.visibility = GONE
|
||||
if (it.isError) {
|
||||
ma.messageWithSound(it.errorMessage, it.isError, true)
|
||||
|
||||
} else {
|
||||
ma.messageWithSound("", it.isError, true, isToasted = false)
|
||||
chageListAdapter(listIcons, true)
|
||||
callGetInventory(
|
||||
parkingFrom,
|
||||
parkingTo
|
||||
)
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
responseReset.observe(viewLifecycleOwner, Observer {
|
||||
binding.splashProgress.visibility = GONE
|
||||
if (it.isError) {
|
||||
ma.messageWithSound(it.errorMessage, it.isError, true)
|
||||
|
||||
} else {
|
||||
ma.messageWithSound("", it.isError, true, isToasted = false)
|
||||
callGetInventory(
|
||||
parkingFrom,
|
||||
parkingTo
|
||||
)
|
||||
|
||||
|
||||
chageListAdapter(listIcons, true)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun createListInventoryParking(
|
||||
list: List<ItemInventoryParking>,
|
||||
sort: String? = null
|
||||
) {
|
||||
println("El filtro es " + filterActivated)
|
||||
println("El filtro shelving es " + positionShelvingChecking)
|
||||
println("El filtro shelving guardado " + shelvingSaved)
|
||||
|
||||
adapter = InventoryParkingAdapter(
|
||||
if (filterActivated) {
|
||||
myListInventory.filter { it.isChecked == null || it.isChecked == 0 }
|
||||
(if (filterActivated) {
|
||||
if (!shelvingSaved.isNullOrEmpty()) {
|
||||
myListInventory.filter { (it.isChecked == null || it.isChecked == 0) && it.shelvingFk == shelvingSaved }
|
||||
} else {
|
||||
myListInventory.filter { it.isChecked == null || it.isChecked == 0 }
|
||||
}
|
||||
|
||||
} else {
|
||||
myListInventory
|
||||
},
|
||||
if (!shelvingSaved.isNullOrEmpty()) {
|
||||
myListInventory.filter { it.shelvingFk == shelvingSaved }
|
||||
} else {
|
||||
myListInventory
|
||||
}
|
||||
}) as List<ItemInventoryParking>,
|
||||
onPasillerosItemClickListener = pasillerosItemClickListener!!,
|
||||
onVisibleInventoryClickListener = object : OnVisibleInventoryClickListener {
|
||||
override fun onVisibleInventoryClickListener(item: ItemInventoryParking) {
|
||||
|
@ -687,7 +640,7 @@ class InventaryParkingFragment(
|
|||
},
|
||||
onMoreClickListener = object : OnMoreClickListener {
|
||||
override fun onMoreClickListener(item: ItemUbicadorVO) {
|
||||
showMoreOptions(item)
|
||||
// showMoreOptions(item)
|
||||
}
|
||||
|
||||
})
|
||||
|
@ -715,7 +668,11 @@ class InventaryParkingFragment(
|
|||
binding.splashProgress.visibility = VISIBLE
|
||||
viewModel.itemShelvingUpdate(
|
||||
item.id,
|
||||
ItemShelvingVisible(customDialogInput.getValue().toInt())
|
||||
if (customDialogInput.getValue().toInt() == 0) {
|
||||
ItemShelvingVisibleZero(customDialogInput.getValue().toInt(), true)
|
||||
} else {
|
||||
ItemShelvingVisible(customDialogInput.getValue().toInt())
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
|
@ -735,59 +692,59 @@ class InventaryParkingFragment(
|
|||
}
|
||||
|
||||
|
||||
private fun showMoreOptions(item: ItemUbicadorVO) {
|
||||
customDialogTwoButtons.setTitle(item.item.toString())
|
||||
.setDescription(getString(R.string.selectAction))
|
||||
.setOkButton(getString(R.string.transfer)) {
|
||||
customDialogInput.setTitle(getString(R.string.shelvingNew))
|
||||
.setDescription(getString(R.string.selectDestiny) + item.item)
|
||||
.setValue("")
|
||||
.setOkButton(getString(R.string.transfer)) {
|
||||
if (customDialogInput.getValue().isNotEmpty()) {
|
||||
binding.splashProgress.visibility = VISIBLE
|
||||
/* private fun showMoreOptions(item: ItemUbicadorVO) {
|
||||
customDialogTwoButtons.setTitle(item.item.toString())
|
||||
.setDescription(getString(R.string.selectAction))
|
||||
.setOkButton(getString(R.string.transfer)) {
|
||||
customDialogInput.setTitle(getString(R.string.shelvingNew))
|
||||
.setDescription(getString(R.string.selectDestiny) + item.item)
|
||||
.setValue("")
|
||||
.setOkButton(getString(R.string.transfer)) {
|
||||
if (customDialogInput.getValue().isNotEmpty()) {
|
||||
binding.splashProgress.visibility = VISIBLE
|
||||
|
||||
listItems.remove(item)
|
||||
adapter!!.notifyDataSetChanged()
|
||||
customDialogInput.dismiss()
|
||||
} else {
|
||||
getString(R.string.wagonIncorrect).toast(requireContext())
|
||||
listItems.remove(item)
|
||||
adapter!!.notifyDataSetChanged()
|
||||
customDialogInput.dismiss()
|
||||
} else {
|
||||
getString(R.string.wagonIncorrect).toast(requireContext())
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
customDialogInput.dismiss()
|
||||
}.show()
|
||||
customDialogInput.getEditText().requestFocus()
|
||||
ma.hideKeyboard(customDialogInput.getEditText())
|
||||
customDialogInput.getEditText()
|
||||
.setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
customDialogInput.dismiss()
|
||||
}.show()
|
||||
customDialogInput.getEditText().requestFocus()
|
||||
ma.hideKeyboard(customDialogInput.getEditText())
|
||||
customDialogInput.getEditText()
|
||||
.setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
|
||||
listItems.remove(item)
|
||||
adapter!!.notifyDataSetChanged()
|
||||
customDialogInput.dismiss()
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
customDialogTwoButtons.dismiss()
|
||||
}.setOkButtonTwo(getString(R.string.delete)) {
|
||||
customDialog.setTitle(getString(R.string.confirm))
|
||||
.setDescription(
|
||||
listItems.remove(item)
|
||||
adapter!!.notifyDataSetChanged()
|
||||
customDialogInput.dismiss()
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
customDialogTwoButtons.dismiss()
|
||||
}.setOkButtonTwo(getString(R.string.delete)) {
|
||||
customDialog.setTitle(getString(R.string.confirm))
|
||||
.setDescription(
|
||||
|
||||
getString(R.string.deleteQuantity) + item.item
|
||||
getString(R.string.deleteQuantity) + item.item
|
||||
|
||||
)
|
||||
.setOkButton(getString(R.string.delete)) {
|
||||
)
|
||||
.setOkButton(getString(R.string.delete)) {
|
||||
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
customDialog.dismiss()
|
||||
customDialogTwoButtons.dismiss()
|
||||
}.show()
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
customDialog.dismiss()
|
||||
customDialogTwoButtons.dismiss()
|
||||
}.show()
|
||||
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
customDialogTwoButtons.dismiss()
|
||||
}.show()
|
||||
}
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
customDialogTwoButtons.dismiss()
|
||||
}.show()
|
||||
}*/
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,9 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
val response: LiveData<ResponseItemVO>
|
||||
get() = _response
|
||||
|
||||
private val _responseReset by lazy { MutableLiveData<ResponseItemVO>() }
|
||||
val responseReset: LiveData<ResponseItemVO>
|
||||
get() = _responseReset
|
||||
|
||||
private val _buyersList by lazy { MutableLiveData<BuyerListVO>() }
|
||||
val buyersList: LiveData<BuyerListVO>
|
||||
|
@ -174,7 +177,7 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun itemShelvingsUpdate(
|
||||
fun itemShelvingsReset(
|
||||
where: JsonObject,
|
||||
params: Any,
|
||||
|
||||
|
@ -185,14 +188,14 @@ class InventaryViewModel(val context: Context) : BaseViewModel(context) {
|
|||
.enqueue(object : SilexCallback<Any>(context) {
|
||||
|
||||
override fun onError(t: Throwable) {
|
||||
_response.value = ResponseItemVO(
|
||||
_responseReset.value = ResponseItemVO(
|
||||
isError = true,
|
||||
errorMessage = getMessageFromAllResponse(nameofFunction(this), t.message!!)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_response.value =
|
||||
_responseReset.value =
|
||||
ResponseItemVO(isError = false, response = response.message())
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,11 @@ class ItemShelvingVisible(
|
|||
var visible: Int
|
||||
)
|
||||
|
||||
class ItemShelvingVisibleZero(
|
||||
var visible: Int,
|
||||
var isChecked: Boolean?
|
||||
)
|
||||
|
||||
class ItemShelvingChecked(
|
||||
var isChecked: Boolean?,
|
||||
var userFk : Int
|
||||
|
|
|
@ -6,7 +6,6 @@ package es.verdnatura.presentation.view.feature.main.activity
|
|||
import NetworkUtils
|
||||
import PhotosFragment
|
||||
import android.content.SharedPreferences
|
||||
import android.graphics.Color
|
||||
import android.media.MediaPlayer
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
|
@ -49,6 +48,7 @@ import es.verdnatura.presentation.view.feature.delivery.fragments.LogExpeditionF
|
|||
import es.verdnatura.presentation.view.feature.delivery.fragments.RoutesFragment
|
||||
import es.verdnatura.presentation.view.feature.delivery.fragments.SummaryFragment
|
||||
import es.verdnatura.presentation.view.feature.delivery.fragments.TicketsFragment
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ClientTicket
|
||||
import es.verdnatura.presentation.view.feature.diadeventa.fragment.DayOfSaleFragment
|
||||
import es.verdnatura.presentation.view.feature.historicoarticulo.fragment.HistoricoArticuloFragment
|
||||
import es.verdnatura.presentation.view.feature.historicoshelving.fragment.itemShelvingLogFragment
|
||||
|
@ -131,9 +131,9 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
try {
|
||||
if (scheduledFuture?.isCancelled == true) {
|
||||
var prefs = (application as MobileApplication).getPrefsShared()
|
||||
startRepeatingTask(prefs.getLong("renewInterval",0))
|
||||
startRepeatingTask(prefs.getLong("renewInterval", 0))
|
||||
}
|
||||
networkUtils.registerNetworkCallback()
|
||||
networkUtils.registerNetworkCallback()
|
||||
} catch (e: Exception) {
|
||||
e.message.toString().toast(baseContext)
|
||||
}
|
||||
|
@ -528,7 +528,11 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
}
|
||||
}
|
||||
|
||||
override fun onPasillerosItemClickListener(item: PasillerosItemVO, entryPoint: String) {
|
||||
override fun onPasillerosItemClickListener(
|
||||
item: PasillerosItemVO,
|
||||
entryPoint: String,
|
||||
param: Any?
|
||||
) {
|
||||
|
||||
when (item.title) {
|
||||
|
||||
|
@ -656,12 +660,12 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
}
|
||||
|
||||
getString(R.string.titleAuto) -> {
|
||||
/* if ( (application as MobileApplication).userId== 19591){
|
||||
"Testeo rayo".toast(this, Color.RED)*/
|
||||
addFragmentOnTop(AutomaticAddItemFragmentTEST.newInstance(entryPoint, item.title))
|
||||
/* }else{
|
||||
addFragmentOnTop(AutomaticAddItemFragment.newInstance(entryPoint, item.title))
|
||||
}*/
|
||||
/* if ( (application as MobileApplication).userId== 19591){
|
||||
"Testeo rayo".toast(this, Color.RED)*/
|
||||
addFragmentOnTop(AutomaticAddItemFragmentTEST.newInstance(entryPoint, item.title))
|
||||
/* }else{
|
||||
addFragmentOnTop(AutomaticAddItemFragment.newInstance(entryPoint, item.title))
|
||||
}*/
|
||||
}
|
||||
|
||||
getString(R.string.titleChecker) -> {
|
||||
|
@ -831,12 +835,21 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
getString(R.string.titleUnLoadTruck) -> {
|
||||
|
||||
addFragmentOnTop(
|
||||
LoadUnloadFragment.newInstance(item.title, "DELIVERED", entryPoint),
|
||||
LoadUnloadFragment.newInstance(
|
||||
item.title,
|
||||
"DELIVERED",
|
||||
entryPoint,
|
||||
if (param != null) {
|
||||
param as ArrayList<ClientTicket>
|
||||
} else {
|
||||
null
|
||||
}
|
||||
),
|
||||
if (comeFromDelivery == true) {
|
||||
getString(R.string.titleUnLoadTruck)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}, delete = true
|
||||
)
|
||||
|
||||
}
|
||||
|
@ -890,19 +903,30 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
}
|
||||
|
||||
getString(R.string.tickets) -> {
|
||||
addFragmentOnTop(TicketsFragment.newInstance(item.title,entryPoint))
|
||||
addFragmentOnTop(TicketsFragment.newInstance(item.title, entryPoint))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun addFragmentOnTop(fragment: Fragment?, name: String? = null) {
|
||||
fun addFragmentOnTop(fragment: Fragment?, name: String? = null, delete: Boolean = false) {
|
||||
|
||||
if (delete) {
|
||||
supportFragmentManager.beginTransaction().apply {
|
||||
|
||||
val currentFragment =
|
||||
supportFragmentManager.findFragmentById(R.id.main_frame_layout)
|
||||
currentFragment?.let {
|
||||
remove(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
supportFragmentManager
|
||||
.beginTransaction()
|
||||
.replace(R.id.main_frame_layout, fragment!!)
|
||||
.addToBackStack(name)
|
||||
.commitAllowingStateLoss()
|
||||
|
||||
}
|
||||
|
||||
override fun onBackPressed() {
|
||||
|
@ -1065,6 +1089,24 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
|
||||
}
|
||||
|
||||
fun openFragmentUnload(delete: Boolean) {
|
||||
//delete_Fragments()
|
||||
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
if (delete) {
|
||||
delete_Fragments()
|
||||
}
|
||||
addFragment(
|
||||
SacadorFragment.newInstance("PREPARED"),
|
||||
R.id.main_frame_layout,
|
||||
SacadorFragment.TAG,
|
||||
true
|
||||
|
||||
|
||||
)
|
||||
//addFragmentOnTop(SacadorFragment.newInstance())
|
||||
|
||||
}
|
||||
|
||||
fun openFragmentExpeditionState() {
|
||||
//delete_Fragments()
|
||||
// fm.popBackStack(null,FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
|
@ -1138,7 +1180,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
//Tarea 5613
|
||||
fun checkTokenRenew() {
|
||||
val prefs = (application as MobileApplication).getPrefsShared()
|
||||
val renewPeriod = prefs.getLong("renewPeriod",0)
|
||||
val renewPeriod = prefs.getLong("renewPeriod", 0)
|
||||
|
||||
var min = minOf(prefs.getLong("ttl", 0), renewPeriod) * 1000
|
||||
/* println("Renovar: ****************************")
|
||||
|
@ -1153,7 +1195,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
*/
|
||||
if (Date().time < (min + prefs.getLong("tokenCreated", 0))) {
|
||||
val loginViewModel = LoginViewModel(application as MobileApplication)
|
||||
loginViewModel.renewToken()
|
||||
|
||||
loginViewModel.renewTokenResponse.observe(this) { renewToken ->
|
||||
if (!renewToken.isError) {
|
||||
|
@ -1164,6 +1205,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
prefsEditor.apply()
|
||||
}
|
||||
}
|
||||
loginViewModel.renewToken()
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package es.verdnatura.presentation.view.feature.packaging.fragment
|
||||
|
||||
import android.content.ContentResolver
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
|
@ -48,25 +46,25 @@ class SupplierFragment(
|
|||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
||||
/* viewModel.getSuppliers(
|
||||
)*/
|
||||
/* viewModel.getSuppliers(
|
||||
)*/
|
||||
|
||||
val drawableId: Int =
|
||||
R.drawable.background_test // Reemplaza "mi_drawable" con el nombre de tu recurso Drawable
|
||||
|
||||
|
||||
/* val uri: Uri = Uri.parse(
|
||||
ContentResolver.SCHEME_ANDROID_RESOURCE + "://" +
|
||||
context!!.resources.getResourcePackageName(drawableId) + '/' +
|
||||
context!!.resources.getResourceTypeName(drawableId) + '/' +
|
||||
context!!.resources.getResourceEntryName(drawableId)
|
||||
)
|
||||
/* val uri: Uri = Uri.parse(
|
||||
ContentResolver.SCHEME_ANDROID_RESOURCE + "://" +
|
||||
context!!.resources.getResourcePackageName(drawableId) + '/' +
|
||||
context!!.resources.getResourceTypeName(drawableId) + '/' +
|
||||
context!!.resources.getResourceEntryName(drawableId)
|
||||
)
|
||||
|
||||
val rutaAbsoluta: String = uri.toString()*/
|
||||
val rutaAbsoluta: String = uri.toString()*/
|
||||
|
||||
|
||||
|
||||
val file = File("/storage/emulated/0/Android/data/es.verdnatura.sfusion/files/Pictures/test.png")
|
||||
val file =
|
||||
File("/storage/emulated/0/Android/data/es.verdnatura.sfusion/files/Pictures/test.png")
|
||||
val filePart = MultipartBody.Part.createFormData(
|
||||
"file",
|
||||
file.name,
|
||||
|
@ -106,8 +104,8 @@ class SupplierFragment(
|
|||
binding.filterSupplier.setText((nombre.getName()))
|
||||
binding.radiobuttonTypePackaging.visibility = View.VISIBLE
|
||||
saveData("SUPPLIERNAME", nombre.getName())
|
||||
println("el id es "+nombre.getId())
|
||||
println("el nombre es "+nombre.getName())
|
||||
println("el id es " + nombre.getId())
|
||||
println("el nombre es " + nombre.getName())
|
||||
saveDataInt("SUPPLIERID", nombre.getId().toInt())
|
||||
baseSearchDialogCompat.dismiss()
|
||||
}.show()
|
||||
|
@ -136,6 +134,7 @@ class SupplierFragment(
|
|||
saveData("ENTRYTYPE", "Rec")
|
||||
|
||||
}
|
||||
|
||||
R.id.radioButtonDev -> {
|
||||
|
||||
saveData("ENTRYTYPE", "Dev")
|
||||
|
@ -143,9 +142,9 @@ class SupplierFragment(
|
|||
|
||||
}
|
||||
if (!onBack) {
|
||||
binding.splashProgress.visibility=View.VISIBLE
|
||||
binding.splashProgress.visibility = View.VISIBLE
|
||||
|
||||
//viewModel.addFromPackaging(getDataInt("SUPPLIERID"), getData("ENTRYTYPE")=="Rec")
|
||||
//viewModel.addFromPackaging(getDataInt("SUPPLIERID"), getData("ENTRYTYPE")=="Rec")
|
||||
|
||||
}
|
||||
onBack = false
|
||||
|
@ -168,14 +167,14 @@ class SupplierFragment(
|
|||
}
|
||||
}
|
||||
entry.observe(viewLifecycleOwner) {
|
||||
binding.splashProgress.visibility=View.GONE
|
||||
binding.splashProgress.visibility = View.GONE
|
||||
println("Entrada")
|
||||
if (it.isError) {
|
||||
ma.messageWithSound(it.errorMessage, true, false)
|
||||
|
||||
}else{
|
||||
} else {
|
||||
saveDataInt("ENTRY", it.id!!)
|
||||
println("Entrada"+it.id)
|
||||
println("Entrada" + it.id)
|
||||
ma.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(title = getString(R.string.titlePackagingCount)),
|
||||
getString(R.string.titlePackagingCount)
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="48dp"
|
||||
android:height="48dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960"
|
||||
android:tint="#FFF">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M499,701L863,338Q863,338 863,338Q863,338 863,338L782,258Q782,258 782,258Q782,258 782,258L419,621L499,701ZM219,749Q131,743 85.5,708.5Q40,674 40,611Q40,551 91,513Q142,475 233,467Q277,463 298.5,451Q320,439 320,418Q320,389 291,373.5Q262,358 194,351L199,291Q288,300 334,332Q380,364 380,418Q380,464 342.5,493Q305,522 238,527Q169,532 134.5,553Q100,574 100,611Q100,646 130.5,665.5Q161,685 222,689L219,749ZM518,767L353,602L751,205Q765,191 782.5,191.5Q800,192 814,205L916,306Q930,320 930,338Q930,356 916,370L518,767ZM359,800Q342,804 329,791Q316,778 320,761L353,602L518,767L359,800Z"/>
|
||||
</vector>
|
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="48dp"
|
||||
android:height="48dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960"
|
||||
android:tint="#FFF">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M560,840Q548,840 539,831Q530,822 530,810Q530,797 539,788.5Q548,780 560,780Q619,780 659.5,756Q700,732 700,700Q700,677 670.5,655Q641,633 591,621L638,574Q701,593 730.5,626.5Q760,660 760,700Q760,767 699,803.5Q638,840 560,840ZM240,546Q176,532 148,502Q120,472 120,440Q120,405 146,377Q172,349 266,315Q332,291 351,276Q370,261 370,241Q370,216 348,198Q326,180 280,180Q253,180 234,187Q215,194 200,209Q192,217 179.5,218.5Q167,220 157,212Q146,204 145.5,192Q145,180 153,171Q170,149 204,134.5Q238,120 280,120Q348,120 389,152.5Q430,185 430,241Q430,282 401.5,310.5Q373,339 290,370Q223,395 201.5,409.5Q180,424 180,440Q180,456 207,470.5Q234,485 288,498L240,546ZM736,392L608,264L653,219Q671,201 693,201Q715,201 733,219L781,267Q799,285 799,307Q799,329 781,347L736,392ZM220,780L262,780L607,435L565,393L220,738L220,780ZM160,840L160,712L565,307L693,435L288,840L160,840ZM565,393L565,393L565,393L607,435L607,435L565,393Z"/>
|
||||
</vector>
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="32dp"
|
||||
android:height="32dp"
|
||||
android:viewportWidth="32"
|
||||
android:viewportHeight="32">
|
||||
<path
|
||||
android:fillColor="#FFF"
|
||||
android:pathData="M25.927,12.343l-0.588,1.567 -1.567,0.588 1.567,0.588 0.588,1.567 0.588,-1.567 1.567,-0.588 -1.567,-0.588 -0.588,-1.567zM19.527,2.808l-1.11,-2.808 -1.045,2.808 -2.808,1.11 2.808,1.045 1.045,2.808 1.045,-2.808 2.873,-1.045 -2.808,-1.11zM30.302,4.375l-0.653,-1.698 -0.653,1.698 -1.633,0.653 1.633,0.653 0.653,1.633 0.653,-1.633 1.698,-0.653 -1.698,-0.653zM24.49,9.731l-2.22,-2.22c-0.131,-0.131 -0.261,-0.131 -0.392,-0.131s-0.261,0.065 -0.392,0.131l-21.29,21.29c0,0 0,0 0,0v0c-0.196,0.196 -0.196,0.588 0,0.784l2.22,2.22c0.196,0.196 0.522,0.196 0.718,0v0c0,0 0,0 0,0l21.355,-21.355c0.196,-0.196 0.196,-0.522 0,-0.718zM19.592,14.171l-1.763,-1.763 4.049,-4.049 1.763,1.763 -4.049,4.049z"/>
|
||||
</vector>
|
|
@ -0,0 +1,171 @@
|
|||
<?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">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="@dimen/toolbar_height"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layoutInfoTicket"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/layout_margin_min"
|
||||
android:layout_marginBottom="@dimen/layout_margin_1"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/layout_margin_min"
|
||||
android:paddingRight="@dimen/layout_margin_min">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/nameAddress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="left"
|
||||
android:text="@string/Cliente"
|
||||
android:textColor="@color/verdnatura_pumpkin_orange"
|
||||
android:textSize="@dimen/body1" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="left"
|
||||
android:text="@string/tickets"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="@dimen/body2"
|
||||
/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/idTickets"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="left"
|
||||
android:text="@string/Entrada"
|
||||
android:textColor="@color/verdnatura_pumpkin_orange"
|
||||
android:textSize="@dimen/body1" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="left"
|
||||
android:text="@string/packages"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="@dimen/body2" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/totalPackages"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="left"
|
||||
android:text="@string/packages"
|
||||
android:textColor="@color/verdnatura_pumpkin_orange"
|
||||
android:textSize="@dimen/body1" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.simplify.ink.InkView
|
||||
android:id="@+id/ink"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/verdnatura_white"
|
||||
app:inkFlags="interpolation|responsiveWeight"
|
||||
app:layout_constraintBottom_toTopOf="@+id/textView36"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/linearLayout4" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/btnSave"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:gravity="center"
|
||||
android:onClick="saveSign"
|
||||
android:text="@string/save"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/verdnatura_pumpkin_orange"
|
||||
android:textSize="16dp" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
'
|
||||
|
||||
<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" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/splash_progress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/verdnatura_black_8_alpha_6"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:visibility="visible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
|
||||
<com.airbnb.lottie.LottieAnimationView
|
||||
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/verdnatura_logo_large_height"
|
||||
|
||||
app:lottie_autoPlay="true"
|
||||
app:lottie_loop="true"
|
||||
app:lottie_rawRes="@raw/orange_loading"
|
||||
app:lottie_speed="2" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
@ -12,39 +12,42 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="@dimen/toolbar_height"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:paddingTop="@dimen/toolbar_height">
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/textinputlayout_matricula"
|
||||
style="@style/LargeHintText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:visibility="invisible"
|
||||
android:textColorHint="@android:color/darker_gray">
|
||||
|
||||
android:textColorHint="@android:color/darker_gray"
|
||||
android:visibility="gone">
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/edit_matricula"
|
||||
style="@style/InputLineTextSearch"
|
||||
android:layout_width="match_parent"
|
||||
android:backgroundTint="@android:color/white"
|
||||
android:gravity="center"
|
||||
android:hint="@string/Escaneamatricula"
|
||||
android:inputType="text"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
|
||||
android:textColorHint="@android:color/darker_gray" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
android:textColorHint="@android:color/holo_orange_light" />
|
||||
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/textinputlayout_prioridad"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -65,52 +68,60 @@
|
|||
android:textColor="@color/verdnatura_white"
|
||||
android:textColorHint="@android:color/darker_gray" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/delete_img"
|
||||
android:layout_width="@dimen/options_image_width"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@drawable/ic_delete_forever_black_24dp"
|
||||
android:padding="@dimen/options_image_padding"
|
||||
android:visibility="gone"/>
|
||||
android:src="@drawable/ic_delete_forever_black_24dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/edit_img"
|
||||
android:layout_width="@dimen/options_image_width"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@drawable/ic_mode_edit_black_24dp"
|
||||
android:padding="@dimen/options_image_padding"
|
||||
android:visibility="gone"/>
|
||||
android:src="@drawable/ic_mode_edit_black_24dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/parking_img"
|
||||
android:layout_width="@dimen/options_image_width"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@drawable/ic_local_parking_black_24dp"
|
||||
android:padding="@dimen/options_image_padding"
|
||||
android:visibility="gone"/>
|
||||
android:src="@drawable/ic_local_parking_black_24dp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/automatic_img"
|
||||
android:layout_width="@dimen/options_image_width"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@drawable/ic_flash_auto_black_24dp"
|
||||
android:padding="@dimen/options_image_padding"
|
||||
android:visibility="gone"/>
|
||||
android:src="@drawable/ic_flash_auto_black_24dp"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/inventory_parking_recyclerview"
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/inventory_swipe"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipToPadding="false"
|
||||
tools:listitem="@layout/item_inventory_parking_row"/>
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/scan_input">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/inventory_parking_recyclerview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipToPadding="false"
|
||||
tools:listitem="@layout/item_inventory_parking_row" />
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
' <include
|
||||
<include
|
||||
android:id="@+id/main_toolbar"
|
||||
layout="@layout/toolbar_fragment"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
@ -118,19 +129,18 @@
|
|||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/splash_progress"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/verdnatura_black_8_alpha_6"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:gravity="center">
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<com.airbnb.lottie.LottieAnimationView
|
||||
|
||||
|
@ -144,7 +154,5 @@
|
|||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
|
@ -91,7 +91,8 @@
|
|||
android:padding="5dp"
|
||||
android:text="0"
|
||||
android:imeOptions="actionDone"
|
||||
android:maxLines="1"/>
|
||||
android:maxLines="1"
|
||||
android:gravity="center"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -128,7 +129,8 @@
|
|||
android:padding="5dp"
|
||||
android:text="0"
|
||||
android:imeOptions="actionDone"
|
||||
android:maxLines="1"/>
|
||||
android:maxLines="1"
|
||||
android:gravity="center"/>
|
||||
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
|
@ -190,14 +192,9 @@
|
|||
android:text="00:00"
|
||||
android:imeOptions="actionDone"
|
||||
android:maxLines="1"
|
||||
android:gravity="center"
|
||||
/>
|
||||
<ImageButton
|
||||
android:id="@+id/buttonPicker"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="30dp"
|
||||
android:layout_weight="1"
|
||||
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -230,7 +227,8 @@
|
|||
android:text="00:00"
|
||||
android:imeOptions="actionDone"
|
||||
android:maxLines="1"
|
||||
android:focusable="true"/>
|
||||
android:focusable="true"
|
||||
android:gravity="center"/>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
|
@ -276,7 +274,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:clipToPadding="false"
|
||||
android:visibility="visible"
|
||||
tools:listitem="@layout/item_ticket_row" />
|
||||
tools:listitem="@layout/item_ticket_row"
|
||||
tools:visibility="gone"/>
|
||||
|
||||
<TextClock
|
||||
android:id="@+id/textClock"
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
android:paddingTop="1dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingRight="5dp"
|
||||
|
||||
android:layout_marginBottom="5dp"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
|
@ -236,7 +236,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingBottom="5dp"
|
||||
android:paddingBottom="1dp"
|
||||
android:text="@string/showTickets"
|
||||
android:textColor="@color/colorPrimary"/>
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/linearLayout3"
|
||||
|
|
|
@ -41,6 +41,14 @@
|
|||
android:text="2041368"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="18sp" />
|
||||
<TextView
|
||||
android:id="@+id/btnCmr"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/cmrTicket"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="18sp" />
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
|
|
@ -640,5 +640,18 @@
|
|||
<string name="clientReject">CLIENTE RECHAZA PEDIDO</string>
|
||||
<string name="packagesMissing">FALTAN BULTOS:</string>
|
||||
<string name="clientDevolution">RECOGER DEVOLUCIÓN, NÚMERO DE RECLAMACIÓN:</string>
|
||||
<string name="listInventoryEmpty">La lista del inventario está vacía</string>
|
||||
<string name="sureSign">¿Estás seguro de firmar?</string>
|
||||
<string name="locationDiferent">La última posición \nobtenida es distinta \na la actual. ¿Quieres modificar la posición o mantener la registrada?</string>
|
||||
<string name="keep">Mantener</string>
|
||||
<string name="sign">Firmar tickets</string>
|
||||
<string name="signCmr">Firmar CMR</string>
|
||||
<string name="sortRouteSalix">Permite ordenar las rutas a través de Salix</string>
|
||||
<string name="signCmrDescrip">Permite firmar el Cmr de la ruta</string>
|
||||
<string name="cmrTicket">cmr</string>
|
||||
<string name="signed">Ver firmados</string>
|
||||
<string name="offline">Offline</string>
|
||||
<string name="no_phones">No hay teléfonos</string>
|
||||
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -640,5 +640,17 @@
|
|||
<string name="clientReject">CLIENT REFUSE LA COMMANDE</string>
|
||||
<string name="packagesMissing">COLIS MANQUANTS :</string>
|
||||
<string name="clientDevolution">RECUEILLIR UN RETOUR, NUMÉRO DE RÉCLAMATION :</string>
|
||||
<string name="listInventoryEmpty">La lista del inventario está vacía</string>
|
||||
<string name="sureSign">Êtes-vous sûr de vouloir signer ?</string>
|
||||
<string name="locationDiferent">La dernière position obtenue est différente de la position actuelle. Voulez-vous modifier la position ou la conserver enregistrée?</string>
|
||||
<string name="keep">Maintenir</string>
|
||||
<string name="sign">Signature tickets</string>
|
||||
<string name="signCmr">Signature CMR</string>
|
||||
<string name="sortRouteSalix">Permite ordenar las rutas a través de Salix</string>
|
||||
<string name="signCmrDescrip">Permite firmar el Cmr de la ruta</string>
|
||||
<string name="cmrTicket">cmr</string>
|
||||
<string name="signed">Voir les tickets signés</string>
|
||||
<string name="offline">Offline</string>
|
||||
<string name="no_phones">Téléphone absent</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -640,5 +640,17 @@
|
|||
<string name="clientReject">CLIENTE REJEITA PEDIDO</string>
|
||||
<string name="packagesMissing">FALTAM VOLUMES:</string>
|
||||
<string name="clientDevolution">\"LEVANTAR DEVOLUÇÃO, NUMERO DE RECLAMAÇÃO: \"</string>
|
||||
<string name="listInventoryEmpty">La lista del inventario está vacía</string>
|
||||
<string name="sureSign">Tens certeza que queres assinar?</string>
|
||||
<string name="locationDiferent">A última posição obtida é diferente à atual. Queres modificar a posição ou manter a registrada?</string>
|
||||
<string name="keep">Manter</string>
|
||||
<string name="sign">Assinatura tickets</string>
|
||||
<string name="signCmr">Assinatura CMR</string>
|
||||
<string name="sortRouteSalix">Permite ordenar las rutas a través de Salix</string>
|
||||
<string name="signCmrDescrip">Permite firmar el Cmr de la ruta</string>
|
||||
<string name="cmrTicket">cmr</string>
|
||||
<string name="signed">Ver assinados</string>
|
||||
<string name="offline">Offline</string>
|
||||
<string name="no_phones">No telefone</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -639,4 +639,17 @@
|
|||
<string name="clientReject">CLIENTE RECHAZA PEDIDO</string>
|
||||
<string name="packagesMissing">FALTAN BULTOS:</string>
|
||||
<string name="clientDevolution">RECOGER DEVOLUCIÓN, NÚMERO DE RECLAMACIÓN:</string>
|
||||
<string name="listInventoryEmpty">La lista del inventario está vacía</string>
|
||||
<string name="sureSign">Are you ready for signing ?</string>
|
||||
<string name="locationDiferent">The last position is different from the current one. Do you want to modify the position or keep the registered one?</string>
|
||||
<string name="keep">Keep</string>
|
||||
<string name="sign">Sign tickets</string>
|
||||
<string name="signCmr">Sign CMR</string>
|
||||
<string name="sortRouteSalix">Permite ordenar las rutas a través de Salix</string>
|
||||
<string name="signCmrDescrip">Permite firmar el Cmr de la ruta</string>
|
||||
<string name="cmrTicket">cmr</string>
|
||||
<string name="signed">Show signed tickets</string>
|
||||
<string name="offline">App Offline</string>
|
||||
<string name="no_phones">Not phones</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -30,6 +30,24 @@
|
|||
<item name="android:drawablePadding">8dp</item>
|
||||
</style>
|
||||
|
||||
<style name="DefaultButton.DynamicButton" parent="DefaultButton">
|
||||
<item name="android:background">@drawable/btn_orange</item>
|
||||
<item name="android:textColor">@color/verdnatura_white</item>
|
||||
<item name="android:minWidth">64dp</item>
|
||||
<item name="android:layout_height">36dp</item>
|
||||
<item name="android:paddingStart">16dp</item>
|
||||
<item name="android:paddingEnd">16dp</item>
|
||||
<item name="android:textAllCaps">true</item>
|
||||
<item name="android:textSize">14sp</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
<item name="android:gravity">center</item>
|
||||
<item name="android:focusable">true</item>
|
||||
<item name="android:lines">1</item>
|
||||
<item name="android:ellipsize">end</item>
|
||||
<item name="android:clickable">true</item>
|
||||
<item name="android:drawablePadding">8dp</item>
|
||||
|
||||
</style>
|
||||
|
||||
<style name="DefaultButton.NormalButton" parent="DefaultButton">
|
||||
<item name="android:background">@drawable/btn_orange</item>
|
||||
|
@ -40,6 +58,7 @@
|
|||
<item name="android:background">@drawable/btn_blue</item>
|
||||
<item name="android:textColor">@color/verdnatura_white</item>
|
||||
</style>
|
||||
|
||||
<style name="ToolPickerImage" parent="AppTheme">
|
||||
<item name="colorPrimary">@color/verdnatura_black</item>
|
||||
<item name="colorPrimaryDark">@color/verdnatura_black</item>
|
||||
|
@ -98,6 +117,10 @@
|
|||
</style>
|
||||
|
||||
|
||||
<style name="LargeHintText" parent="Widget.MaterialComponents.TextInputLayout.FilledBox">
|
||||
<item name="android:textSize">20sp</item>
|
||||
</style>
|
||||
|
||||
<style name="ScanLineTextSearch" parent="DialogTheme">
|
||||
<item name="android:background">@drawable/background_round</item>
|
||||
<item name="android:textColor">@color/verdnatura_white</item>
|
||||
|
@ -129,12 +152,11 @@
|
|||
<style name="LayoutClickable">
|
||||
<item name="android:focusable">true</item>
|
||||
<item name="android:clickable">true</item>
|
||||
<!-- <item name="android:foreground">?android:attr/selectableItemBackground</item> -->
|
||||
<!-- <item name="android:foreground">?android:attr/selectableItemBackground</item> -->
|
||||
<item name="android:foreground">@drawable/custom_ripple</item>
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<!--Progress Bar-->
|
||||
<style name="HorizontalProgressBar" parent="Widget.AppCompat.ProgressBar.Horizontal">
|
||||
<item name="android:layout_height">5dp</item>
|
||||
|
@ -161,6 +183,7 @@
|
|||
<item name="android:textSize">10sp</item>
|
||||
<item name="android:textStyle">normal</item>
|
||||
</style>
|
||||
|
||||
<style name="Divider">
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">1dp</item>
|
||||
|
|
Loading…
Reference in New Issue