Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
|
83d1361085 | |
|
2b7440168a |
|
@ -1,4 +1,3 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="DesignSurface">
|
<component name="DesignSurface">
|
||||||
<option name="filePathToZoomLevelMap">
|
<option name="filePathToZoomLevelMap">
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
<component name="AndroidLayouts">
|
<component name="AndroidLayouts">
|
||||||
<shared>
|
<shared>
|
||||||
<config>
|
<config>
|
||||||
<device id="pixel_6a" />
|
|
||||||
<locale>es</locale>
|
<locale>es</locale>
|
||||||
<pickBest>false</pickBest>
|
<pickBest>false</pickBest>
|
||||||
<target>android-27</target>
|
<target>android-27</target>
|
||||||
|
@ -286,11 +285,6 @@
|
||||||
<theme>@style/AppTheme</theme>
|
<theme>@style/AppTheme</theme>
|
||||||
</config>
|
</config>
|
||||||
</layout>
|
</layout>
|
||||||
<layout url="file://$PROJECT_DIR$/app/src/main/res/layout/fragment_web.xml">
|
|
||||||
<config>
|
|
||||||
<theme>@style/AppTheme</theme>
|
|
||||||
</config>
|
|
||||||
</layout>
|
|
||||||
<layout url="file://$PROJECT_DIR$/app/src/main/res/layout/fragment_workermistake.xml">
|
<layout url="file://$PROJECT_DIR$/app/src/main/res/layout/fragment_workermistake.xml">
|
||||||
<config>
|
<config>
|
||||||
<theme>@style/AppTheme</theme>
|
<theme>@style/AppTheme</theme>
|
||||||
|
@ -437,11 +431,6 @@
|
||||||
<theme>@style/AppTheme</theme>
|
<theme>@style/AppTheme</theme>
|
||||||
</config>
|
</config>
|
||||||
</layout>
|
</layout>
|
||||||
<layout url="file://$PROJECT_DIR$/app/src/main/res/layout/sale_row_fragment_reserve.xml">
|
|
||||||
<config>
|
|
||||||
<theme>@style/AppTheme</theme>
|
|
||||||
</config>
|
|
||||||
</layout>
|
|
||||||
<layout url="file://$PROJECT_DIR$/app/src/main/res/layout/searchable_dialog.xml">
|
<layout url="file://$PROJECT_DIR$/app/src/main/res/layout/searchable_dialog.xml">
|
||||||
<config>
|
<config>
|
||||||
<theme>@style/AppTheme</theme>
|
<theme>@style/AppTheme</theme>
|
||||||
|
@ -504,24 +493,12 @@
|
||||||
</select>
|
</select>
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="fa688d1c-dbee-4864-9e33-4d84ef9afca8" name="Default Changelist" comment="feat: refs#6861 reservas">
|
<list default="true" id="fa688d1c-dbee-4864-9e33-4d84ef9afca8" name="Default Changelist" comment="feat: refs#6845 userInterface">
|
||||||
<change afterPath="$PROJECT_DIR$/app/lint-baseline.xml" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/CHANGELOG.md" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/app/src/main/res/layout/sale_row_fragment_reserve.xml" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/changeLog.sh" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/deploymentTargetSelector.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/deploymentTargetSelector.xml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/gradle.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/gradle.xml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/render.experimental.xml" beforeDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/app/build.gradle.kts" beforeDir="false" afterPath="$PROJECT_DIR$/app/build.gradle.kts" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/app/build.gradle.kts" beforeDir="false" afterPath="$PROJECT_DIR$/app/build.gradle.kts" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/app/general/release/baselineProfiles/0/app-general-release.dm" beforeDir="false" afterPath="$PROJECT_DIR$/app/general/release/baselineProfiles/0/app-general-release.dm" 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/general/release/baselineProfiles/1/app-general-release.dm" beforeDir="false" afterPath="$PROJECT_DIR$/app/general/release/baselineProfiles/1/app-general-release.dm" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/model/ItemUbicadorVO.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/ubicador/model/ItemUbicadorVO.kt" 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/domain/Extensions.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/Extensions.kt" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/commom/WebFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/commom/WebFragment.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/workermistake/fragment/PackingMistakeFragment.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/workermistake/fragment/PackingMistakeFragment.kt" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/app/src/main/res/layout/fragment_web.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/res/layout/fragment_web.xml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/build.gradle.kts" beforeDir="false" afterPath="$PROJECT_DIR$/build.gradle.kts" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/gradle/libs.versions.toml" beforeDir="false" afterPath="$PROJECT_DIR$/gradle/libs.versions.toml" afterDir="false" />
|
|
||||||
</list>
|
</list>
|
||||||
<list id="7b98f93d-6980-4bf1-8e61-c7afd10e56f2" name="Change_category" comment="Change_category" />
|
<list id="7b98f93d-6980-4bf1-8e61-c7afd10e56f2" name="Change_category" comment="Change_category" />
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
|
@ -536,7 +513,7 @@
|
||||||
<component name="CodeInsightWorkspaceSettings">
|
<component name="CodeInsightWorkspaceSettings">
|
||||||
<option name="optimizeImportsOnTheFly" value="true" />
|
<option name="optimizeImportsOnTheFly" value="true" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ExecutionTargetManager" SELECTED_TARGET="device_and_snapshot_combo_box_target[DeviceId(pluginId=PhysicalDevice, isTemplate=false, identifier=serial=21114523025303)]" />
|
<component name="ExecutionTargetManager" SELECTED_TARGET="device_and_snapshot_combo_box_target[DeviceId(pluginId=LocalEmulator, isTemplate=false, identifier=path=C:\Users\sergiodt\.android\avd\Pixel_7a_API_30.avd)]" />
|
||||||
<component name="ExportToHTMLSettings">
|
<component name="ExportToHTMLSettings">
|
||||||
<option name="OPEN_IN_BROWSER" value="true" />
|
<option name="OPEN_IN_BROWSER" value="true" />
|
||||||
<option name="OUTPUT_DIRECTORY" value="C:\Program Files\Android\Android Studio\inspections" />
|
<option name="OUTPUT_DIRECTORY" value="C:\Program Files\Android\Android Studio\inspections" />
|
||||||
|
@ -626,7 +603,7 @@
|
||||||
</option>
|
</option>
|
||||||
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
||||||
<map>
|
<map>
|
||||||
<entry key="$PROJECT_DIR$" value="devLinphone" />
|
<entry key="$PROJECT_DIR$" value="dev_6078" />
|
||||||
</map>
|
</map>
|
||||||
</option>
|
</option>
|
||||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||||
|
@ -687,60 +664,60 @@
|
||||||
<option name="showLibraryContents" value="true" />
|
<option name="showLibraryContents" value="true" />
|
||||||
<option name="showMembers" value="true" />
|
<option name="showMembers" value="true" />
|
||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent"><![CDATA[{
|
<component name="PropertiesComponent">{
|
||||||
"keyToString": {
|
"keyToString": {
|
||||||
"Android App.app.executor": "Run",
|
"Android App.app.executor": "Run",
|
||||||
"ApkExportedModule": "Gestor_Almacén.app",
|
"ApkExportedModule": "Gestor_Almacén.app",
|
||||||
"DEBUGGABLE_DEVICE": "honeywell-eda52-23086B3FFD",
|
"DEBUGGABLE_DEVICE": "zebra_technologies-tc21-21114523025303",
|
||||||
"DEBUGGABLE_PROCESS": "es.verdnatura.sfusion",
|
"DEBUGGABLE_PROCESS": "es.verdnatura.sfusion",
|
||||||
"DEBUGGER_ID": "Auto",
|
"DEBUGGER_ID": "Auto",
|
||||||
"ExportApk.ApkPathForGestor_Almacén.app": "C:\\Users\\sergiodt\\AndroidStudioProjects\\vn-warehouseManager\\app",
|
"ExportApk.ApkPathForGestor_Almacén.app": "C:\\Users\\sergiodt\\AndroidStudioProjects\\vn-warehouseManager\\app",
|
||||||
"Gradle.vn-warehouseManager [clean].executor": "Run",
|
"Gradle.vn-warehouseManager [clean].executor": "Run",
|
||||||
"Gradle.vn-warehouseManager.executor": "Run",
|
"Gradle.vn-warehouseManager.executor": "Run",
|
||||||
"KotlinFunctionFindUsagesOptions.isSearchForTextOccurrences": "true",
|
"KotlinFunctionFindUsagesOptions.isSearchForTextOccurrences": "true",
|
||||||
"PROJECT_TRUSTED_KEY": "true",
|
"PROJECT_TRUSTED_KEY": "true",
|
||||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
"RunOnceActivity.cidr.known.project.marker": "true",
|
"RunOnceActivity.cidr.known.project.marker": "true",
|
||||||
"RunOnceActivity.readMode.enableVisualFormatting": "true",
|
"RunOnceActivity.readMode.enableVisualFormatting": "true",
|
||||||
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||||
"SHOW_ALL_PROCESSES": "false",
|
"SHOW_ALL_PROCESSES": "false",
|
||||||
"ScreenRecorder.SavePath": "C:\\Users\\sergiodt",
|
"ScreenRecorder.SavePath": "C:\\Users\\sergiodt",
|
||||||
"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",
|
"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",
|
||||||
"android-custom-viewC:/Users/sergiodt/AppData/Local/Android/Sdk/sources/android-29/android/widget/TextView.java_SELECTED": "TextView",
|
"android-custom-viewC:/Users/sergiodt/AppData/Local/Android/Sdk/sources/android-29/android/widget/TextView.java_SELECTED": "TextView",
|
||||||
"android-custom-viewC:/Users/sergiodt/AppData/Local/Android/Sdk/sources/android-33/android/view/View.java_SELECTED": "View",
|
"android-custom-viewC:/Users/sergiodt/AppData/Local/Android/Sdk/sources/android-33/android/view/View.java_SELECTED": "View",
|
||||||
"android-custom-viewC:/Users/sergiodt/AppData/Local/Android/Sdk/sources/android-34/android/view/View.java_SELECTED": "View",
|
"android-custom-viewC:/Users/sergiodt/AppData/Local/Android/Sdk/sources/android-34/android/view/View.java_SELECTED": "View",
|
||||||
"android-custom-viewC:/Users/sergiodt/AppData/Local/Android/Sdk/sources/android-34/android/widget/CompoundButton.java_SELECTED": "CompoundButton",
|
"android-custom-viewC:/Users/sergiodt/AppData/Local/Android/Sdk/sources/android-34/android/widget/CompoundButton.java_SELECTED": "CompoundButton",
|
||||||
"android-custom-viewC:/Users/sergiodt/AppData/Local/Android/Sdk/sources/android-34/android/widget/TextView.java_SELECTED": "TextView",
|
"android-custom-viewC:/Users/sergiodt/AppData/Local/Android/Sdk/sources/android-34/android/widget/TextView.java_SELECTED": "TextView",
|
||||||
"cf.first.check.clang-format": "false",
|
"cf.first.check.clang-format": "false",
|
||||||
"cidr.known.project.marker": "true",
|
"cidr.known.project.marker": "true",
|
||||||
"com.developerphil.adbidea.selecteddevices": "G65TY9DQN7X4BIE6",
|
"com.developerphil.adbidea.selecteddevices": "G65TY9DQN7X4BIE6",
|
||||||
"com.google.services.firebase.aqiPopupShown": "true",
|
"com.google.services.firebase.aqiPopupShown": "true",
|
||||||
"git-widget-placeholder": "dev",
|
"git-widget-placeholder": "dev",
|
||||||
"ignore.virus.scanning.warn.message": "true",
|
"ignore.virus.scanning.warn.message": "true",
|
||||||
"kotlin-language-version-configured": "true",
|
"kotlin-language-version-configured": "true",
|
||||||
"last_directory_selection": "C:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable",
|
"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",
|
"last_opened_file_path": "C:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout",
|
||||||
"project.structure.last.edited": "Dependencies",
|
"project.structure.last.edited": "Modules",
|
||||||
"project.structure.proportion": "0.17",
|
"project.structure.proportion": "0.17",
|
||||||
"project.structure.side.proportion": "0.2",
|
"project.structure.side.proportion": "0.2",
|
||||||
"rearrange.code.on.save": "true",
|
"rearrange.code.on.save": "true",
|
||||||
"run.code.analysis.last.selected.profile": "pProject Default",
|
"run.code.analysis.last.selected.profile": "pProject Default",
|
||||||
"settings.editor.selected.configurable": "reference.settingsdialog.project.gradle"
|
"settings.editor.selected.configurable": "preferences.pluginManager"
|
||||||
},
|
},
|
||||||
"keyToStringList": {
|
"keyToStringList": {
|
||||||
"ExportApk.BuildVariants": [
|
"ExportApk.BuildVariants": [
|
||||||
"generalRelease"
|
"generalRelease"
|
||||||
],
|
],
|
||||||
"com.android.tools.idea.sqlite.queryhistory": [
|
"com.android.tools.idea.sqlite.queryhistory": [
|
||||||
"select * from expedition where routeFk=182933;",
|
"select * from expedition where routeFk=182933;",
|
||||||
"select * from expedition;",
|
"select * from expedition;",
|
||||||
"select * from expeditionPending;",
|
"select * from expeditionPending;",
|
||||||
"select * from expedition where id = 7753995;\n\n",
|
"select * from expedition where id = 7753995;\n\n",
|
||||||
"\nselect * from expedition where id = 7753995;"
|
"\nselect * from expedition where id = 7753995;"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}]]></component>
|
}</component>
|
||||||
<component name="PsdUISettings">
|
<component name="PsdUISettings">
|
||||||
<option name="MODULE_TAB" value="Properties" />
|
<option name="MODULE_TAB" value="Properties" />
|
||||||
<option name="LAST_EDITED_SIGNING_CONFIG" value="debug" />
|
<option name="LAST_EDITED_SIGNING_CONFIG" value="debug" />
|
||||||
|
@ -1288,7 +1265,7 @@
|
||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1709725795643</updated>
|
<updated>1709725795643</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="377" />
|
<option name="localTasksCounter" value="373" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="Vcs.Log.History.Properties">
|
<component name="Vcs.Log.History.Properties">
|
||||||
|
@ -1428,6 +1405,10 @@
|
||||||
</component>
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
|
<option name="ADD_EXTERNAL_FILES_SILENTLY" value="true" />
|
||||||
|
<MESSAGE value="feat getAddress #refs 7622" />
|
||||||
|
<MESSAGE value="feat claimObservation refs #7541" />
|
||||||
|
<MESSAGE value="feat reservas refs #6861" />
|
||||||
|
<MESSAGE value="version 24.30" />
|
||||||
<MESSAGE value="feat itemGetBalance refs #6769" />
|
<MESSAGE value="feat itemGetBalance refs #6769" />
|
||||||
<MESSAGE value="feat: boxPickingPrepared refs #7855" />
|
<MESSAGE value="feat: boxPickingPrepared refs #7855" />
|
||||||
<MESSAGE value="feat: refactorResponse PasillerosItem refs #7827" />
|
<MESSAGE value="feat: refactorResponse PasillerosItem refs #7827" />
|
||||||
|
@ -1449,11 +1430,7 @@
|
||||||
<MESSAGE value="feat: refs #7922 scanOrder" />
|
<MESSAGE value="feat: refs #7922 scanOrder" />
|
||||||
<MESSAGE value="feat: refs #7920 itemShelvingGet" />
|
<MESSAGE value="feat: refs #7920 itemShelvingGet" />
|
||||||
<MESSAGE value="feat: refs#6845 userInterface" />
|
<MESSAGE value="feat: refs#6845 userInterface" />
|
||||||
<MESSAGE value="linphoneVersion" />
|
<option name="LAST_COMMIT_MESSAGE" value="feat: refs#6845 userInterface" />
|
||||||
<MESSAGE value="feat: refs#8301 deprecatedOlderItem" />
|
|
||||||
<MESSAGE value="feat: refs#6413 refactorUbicador" />
|
|
||||||
<MESSAGE value="feat: refs#6861 reservas" />
|
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="feat: refs#6861 reservas" />
|
|
||||||
</component>
|
</component>
|
||||||
<component name="XDebuggerManager">
|
<component name="XDebuggerManager">
|
||||||
<breakpoint-manager>
|
<breakpoint-manager>
|
||||||
|
@ -1466,14 +1443,6 @@
|
||||||
</properties>
|
</properties>
|
||||||
<option name="timeStamp" value="11" />
|
<option name="timeStamp" value="11" />
|
||||||
</line-breakpoint>
|
</line-breakpoint>
|
||||||
<line-breakpoint enabled="true" type="kotlin-function">
|
|
||||||
<url>file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/collection/fragment/CollectionFragmentPickerPreviousNew.kt</url>
|
|
||||||
<line>764</line>
|
|
||||||
<properties class="es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentPickerPreviousNew" method="customDialogTakeAction">
|
|
||||||
<option name="WATCH_EXIT" value="false" />
|
|
||||||
</properties>
|
|
||||||
<option name="timeStamp" value="17" />
|
|
||||||
</line-breakpoint>
|
|
||||||
<line-breakpoint enabled="true" type="kotlin-line">
|
<line-breakpoint enabled="true" type="kotlin-line">
|
||||||
<url>file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/SalixCallback.kt</url>
|
<url>file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/SalixCallback.kt</url>
|
||||||
<line>86</line>
|
<line>86</line>
|
||||||
|
@ -1489,11 +1458,6 @@
|
||||||
<line>87</line>
|
<line>87</line>
|
||||||
<option name="timeStamp" value="14" />
|
<option name="timeStamp" value="14" />
|
||||||
</line-breakpoint>
|
</line-breakpoint>
|
||||||
<line-breakpoint enabled="true" type="kotlin-line">
|
|
||||||
<url>file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/delivery/fragments/TicketsFragment.kt</url>
|
|
||||||
<line>450</line>
|
|
||||||
<option name="timeStamp" value="18" />
|
|
||||||
</line-breakpoint>
|
|
||||||
</breakpoints>
|
</breakpoints>
|
||||||
</breakpoint-manager>
|
</breakpoint-manager>
|
||||||
<pin-to-top-manager>
|
<pin-to-top-manager>
|
||||||
|
|
169
app/build.gradle
169
app/build.gradle
|
@ -1,169 +0,0 @@
|
||||||
apply plugin: 'com.android.application'
|
|
||||||
apply plugin: 'kotlin-android'
|
|
||||||
apply plugin: 'kotlin-kapt'
|
|
||||||
apply plugin: 'com.google.gms.google-services'
|
|
||||||
apply plugin: 'com.google.firebase.crashlytics'
|
|
||||||
apply plugin: 'com.google.devtools.ksp'
|
|
||||||
|
|
||||||
|
|
||||||
android {
|
|
||||||
namespace = "es.verdnatura"
|
|
||||||
compileSdk 34
|
|
||||||
defaultConfig {
|
|
||||||
applicationId "es.verdnatura"
|
|
||||||
minSdkVersion 26
|
|
||||||
targetSdkVersion 33 // se deja con target si no Play Protect la bloquea
|
|
||||||
versionCode 330
|
|
||||||
versionName = "24.38"
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
||||||
}
|
|
||||||
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
/*debuggable false
|
|
||||||
shrinkResources true
|
|
||||||
minifyEnabled true*/
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
||||||
}
|
|
||||||
|
|
||||||
//package de la app general = "package_name": "es.verdnatura"
|
|
||||||
//package de la app beta = "package_name": "es.verdnatura.sfusion"
|
|
||||||
|
|
||||||
applicationVariants.all { variant ->
|
|
||||||
variant.outputs.all { output ->
|
|
||||||
def flavorName = variant.productFlavors[0].name
|
|
||||||
def apkName
|
|
||||||
|
|
||||||
if (flavorName == "beta") {
|
|
||||||
apkName = "vn-pickingBeta.apk"
|
|
||||||
} else if (flavorName == "general") {
|
|
||||||
apkName = "vn-picking.apk"
|
|
||||||
} else {
|
|
||||||
apkName = "vn-picking.apk"
|
|
||||||
}
|
|
||||||
|
|
||||||
output.outputFileName = apkName
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
flavorDimensions += "version"
|
|
||||||
productFlavors {
|
|
||||||
create("beta") {
|
|
||||||
applicationIdSuffix = ".sfusion"
|
|
||||||
}
|
|
||||||
create("general") {
|
|
||||||
//versionNameSuffix = "General"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
buildFeatures {
|
|
||||||
viewBinding = true
|
|
||||||
|
|
||||||
}
|
|
||||||
/*kotlinOptions {
|
|
||||||
jvmTarget = "1.8"
|
|
||||||
}
|
|
||||||
buildFeatures {
|
|
||||||
compose = true
|
|
||||||
}
|
|
||||||
kotlin {
|
|
||||||
jvmToolchain(8)
|
|
||||||
}
|
|
||||||
composeOptions {
|
|
||||||
kotlinCompilerExtensionVersion = "1.4.3"
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
dataBinding {
|
|
||||||
enabled = true
|
|
||||||
}
|
|
||||||
|
|
||||||
compileOptions {
|
|
||||||
sourceCompatibility JavaVersion.VERSION_17
|
|
||||||
targetCompatibility JavaVersion.VERSION_17
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
||||||
implementation 'com.google.firebase:firebase-crashlytics-ktx:19.0.3'
|
|
||||||
implementation 'com.google.firebase:firebase-analytics-ktx:22.0.2'
|
|
||||||
implementation 'com.google.android.gms:play-services-location:21.3.0'
|
|
||||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.7.7'
|
|
||||||
implementation 'androidx.navigation:navigation-ui-ktx:2.7.7'
|
|
||||||
implementation 'androidx.core:core-ktx:1.13.1'
|
|
||||||
kapt "androidx.room:room-compiler:2.6.1"
|
|
||||||
implementation 'androidx.room:room-ktx:2.6.1'
|
|
||||||
debugImplementation fileTree(dir: 'libs/debug', include: ['*.jar'])
|
|
||||||
releaseImplementation fileTree(dir: 'libs/release', include: ['*.jar'])
|
|
||||||
|
|
||||||
//canvas
|
|
||||||
implementation 'com.simplify:ink:1.0.0'
|
|
||||||
|
|
||||||
// Kotlin and Android
|
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
||||||
implementation 'androidx.appcompat:appcompat:1.7.0'
|
|
||||||
implementation 'androidx.core:core-ktx:1.13.1'
|
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
|
||||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
|
||||||
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
|
||||||
|
|
||||||
//tests
|
|
||||||
testImplementation 'junit:junit:4.13.2'
|
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
|
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
|
|
||||||
implementation 'com.google.android.material:material:1.12.0'
|
|
||||||
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
|
|
||||||
implementation 'com.squareup.retrofit2:converter-gson:2.0.2'
|
|
||||||
implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
|
|
||||||
implementation "com.airbnb.android:lottie:$lottieVersion"
|
|
||||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
|
|
||||||
|
|
||||||
//Fragments
|
|
||||||
implementation("androidx.fragment:fragment-ktx:1.8.2")
|
|
||||||
|
|
||||||
// Architecture components
|
|
||||||
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.4"
|
|
||||||
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.8.4"
|
|
||||||
implementation "androidx.legacy:legacy-support-v4:1.0.0"
|
|
||||||
|
|
||||||
//Koin new resolve
|
|
||||||
implementation "io.insert-koin:koin-core:$koin"
|
|
||||||
implementation "io.insert-koin:koin-android:$koin"
|
|
||||||
implementation "io.insert-koin:koin-androidx-scope:$koin"
|
|
||||||
implementation "io.insert-koin:koin-androidx-viewmodel:$koin"
|
|
||||||
|
|
||||||
// Image libraries
|
|
||||||
implementation "io.coil-kt:coil:$coil"
|
|
||||||
implementation "com.github.bumptech.glide:glide:$glide"
|
|
||||||
implementation "com.github.bumptech.glide:okhttp3-integration:$glide"
|
|
||||||
//kapt "com.github.bumptech.glide:compiler:$glide"
|
|
||||||
ksp("com.github.bumptech.glide:ksp:$glide")
|
|
||||||
|
|
||||||
// Add the Firebase Crashlytics SDK.
|
|
||||||
implementation 'com.google.firebase:firebase-analytics:22.0.2'
|
|
||||||
|
|
||||||
//search
|
|
||||||
implementation 'com.github.mirrajabi:search-dialog:1.1'
|
|
||||||
|
|
||||||
//logs
|
|
||||||
implementation 'com.jakewharton.timber:timber:4.7.1'
|
|
||||||
|
|
||||||
//pickerImage
|
|
||||||
implementation 'com.github.esafirm:android-image-picker:3.0.0-beta5'
|
|
||||||
|
|
||||||
//preferences
|
|
||||||
implementation("androidx.datastore:datastore-preferences:1.1.1")
|
|
||||||
implementation 'androidx.datastore:datastore-core:1.1.1'
|
|
||||||
|
|
||||||
|
|
||||||
// Compose
|
|
||||||
/* implementation(platform("androidx.compose:compose-bom:2024.02.01"))
|
|
||||||
implementation("androidx.compose.ui:ui")
|
|
||||||
implementation("androidx.compose.material:material")
|
|
||||||
implementation("androidx.compose.runtime:runtime")
|
|
||||||
implementation("androidx.activity:activity-compose:1.8.2")
|
|
||||||
implementation("androidx.compose.ui:ui-graphics")
|
|
||||||
implementation("androidx.compose.ui:ui-tooling-preview")*/
|
|
||||||
}
|
|
|
@ -5,7 +5,6 @@ plugins {
|
||||||
id("com.google.gms.google-services")
|
id("com.google.gms.google-services")
|
||||||
id("com.google.firebase.crashlytics")
|
id("com.google.firebase.crashlytics")
|
||||||
id("com.google.devtools.ksp")
|
id("com.google.devtools.ksp")
|
||||||
id("org.jetbrains.kotlin.plugin.compose")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
@ -16,8 +15,8 @@ android {
|
||||||
applicationId = "es.verdnatura"
|
applicationId = "es.verdnatura"
|
||||||
minSdk = 26
|
minSdk = 26
|
||||||
targetSdk = 33 // se deja con target si no Play Protect la bloquea
|
targetSdk = 33 // se deja con target si no Play Protect la bloquea
|
||||||
versionCode = 405
|
versionCode = 374
|
||||||
versionName = "25.12" // REvisor para reservas
|
versionName = "24.51"
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,14 +59,7 @@ android {
|
||||||
}
|
}
|
||||||
create("general") {}
|
create("general") {}
|
||||||
}
|
}
|
||||||
kapt {
|
|
||||||
correctErrorTypes = true
|
|
||||||
useBuildCache = true
|
|
||||||
|
|
||||||
kotlinOptions {
|
|
||||||
languageVersion = "1.9"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
buildFeatures {
|
buildFeatures {
|
||||||
viewBinding = true
|
viewBinding = true
|
||||||
//compose = true
|
//compose = true
|
||||||
|
@ -84,9 +76,6 @@ android {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
dataBinding = true
|
dataBinding = true
|
||||||
|
|
||||||
compose = true
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
|
@ -113,9 +102,7 @@ android {
|
||||||
implementation(libs.androidx.core.ktx)
|
implementation(libs.androidx.core.ktx)
|
||||||
implementation(libs.androidx.recyclerview)
|
implementation(libs.androidx.recyclerview)
|
||||||
implementation(libs.androidx.room.ktx)
|
implementation(libs.androidx.room.ktx)
|
||||||
//kapt(libs.androidx.room.compiler)
|
kapt(libs.androidx.room.compiler)
|
||||||
ksp(libs.androidx.room.compiler)
|
|
||||||
implementation(libs.androidx.room.runtime)
|
|
||||||
implementation(libs.ink)
|
implementation(libs.ink)
|
||||||
implementation(libs.kotlin.stdlib.jdk7)
|
implementation(libs.kotlin.stdlib.jdk7)
|
||||||
implementation(libs.androidx.appcompat)
|
implementation(libs.androidx.appcompat)
|
||||||
|
@ -146,33 +133,15 @@ android {
|
||||||
implementation(libs.androidx.datastore.core)
|
implementation(libs.androidx.datastore.core)
|
||||||
implementation(libs.zxing.android.embedded) { isTransitive = false }
|
implementation(libs.zxing.android.embedded) { isTransitive = false }
|
||||||
implementation(libs.core)
|
implementation(libs.core)
|
||||||
//implementation(libs.koin.androidx.compose)
|
|
||||||
|
|
||||||
// Compose
|
// Compose
|
||||||
|
//implementation(libs.androidx.compose.bom)
|
||||||
val composeBom = platform("androidx.compose:compose-bom:2024.10.01")
|
/* implementation("androidx.compose.ui:ui")
|
||||||
implementation(composeBom)
|
implementation("androidx.compose.material:material")
|
||||||
androidTestImplementation(composeBom)
|
implementation("androidx.compose.runtime:runtime")
|
||||||
// Choose one of the following:
|
implementation("androidx.activity:activity-compose:1.8.2")
|
||||||
// Material Design 3
|
implementation("androidx.compose.ui:ui-graphics")
|
||||||
implementation(libs.androidx.material3)
|
implementation("androidx.compose.ui:ui-tooling-preview") */
|
||||||
implementation(libs.androidx.ui)
|
|
||||||
// Android Studio Preview support
|
|
||||||
implementation(libs.androidx.ui.tooling.preview)
|
|
||||||
debugImplementation(libs.androidx.ui.tooling)
|
|
||||||
// UI Tests
|
|
||||||
androidTestImplementation(libs.androidx.ui.test.junit4)
|
|
||||||
debugImplementation(libs.androidx.ui.test.manifest)
|
|
||||||
// custom design system based on Foundation)
|
|
||||||
//implementation(libs.androidx.material.icons.core)
|
|
||||||
// Optional - Add full set of material icons
|
|
||||||
implementation(libs.androidx.material.icons.extended)
|
|
||||||
// Optional - Add window size utils
|
|
||||||
implementation(libs.androidx.adaptive)
|
|
||||||
implementation(libs.androidx.activity.compose)
|
|
||||||
implementation(libs.androidx.lifecycle.viewmodel.compose)
|
|
||||||
implementation(libs.lottie.compose)
|
|
||||||
testImplementation(libs.junit)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,12 +27,6 @@
|
||||||
android:name=".presentation.view.feature.articulo.fragment.ImageViewActivity"
|
android:name=".presentation.view.feature.articulo.fragment.ImageViewActivity"
|
||||||
android:configChanges="orientation"
|
android:configChanges="orientation"
|
||||||
android:screenOrientation="portrait" />
|
android:screenOrientation="portrait" />
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".presentation.composable.ImageViewActivityComposable"
|
|
||||||
android:configChanges="orientation"
|
|
||||||
android:exported="false"
|
|
||||||
android:screenOrientation="portrait" />
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".presentation.view.feature.restaurant.RestaurantActivity"
|
android:name=".presentation.view.feature.restaurant.RestaurantActivity"
|
||||||
android:configChanges="orientation"
|
android:configChanges="orientation"
|
||||||
|
@ -75,8 +69,6 @@
|
||||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||||
android:resource="@xml/file_paths" />
|
android:resource="@xml/file_paths" />
|
||||||
</provider>
|
</provider>
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
|
@ -7,7 +7,6 @@ import android.media.MediaPlayer
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import android.widget.Toast
|
|
||||||
import es.verdnatura.dataStore.DataStoreLocal
|
import es.verdnatura.dataStore.DataStoreLocal
|
||||||
import es.verdnatura.di.viewModelModule
|
import es.verdnatura.di.viewModelModule
|
||||||
import es.verdnatura.domain.ConstAndValues
|
import es.verdnatura.domain.ConstAndValues
|
||||||
|
@ -121,8 +120,7 @@ class MobileApplication : Application(), InteceptorListener {
|
||||||
Color.RED
|
Color.RED
|
||||||
} else {
|
} else {
|
||||||
Color.BLUE
|
Color.BLUE
|
||||||
},
|
}
|
||||||
duration = if (isError) Toast.LENGTH_LONG else Toast.LENGTH_SHORT
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,9 +17,7 @@ import es.verdnatura.domain.ConstAndValues.BASEURLLILIUM
|
||||||
import es.verdnatura.domain.ConstAndValues.BASEURLSALIX
|
import es.verdnatura.domain.ConstAndValues.BASEURLSALIX
|
||||||
import es.verdnatura.domain.ConstAndValues.BASE_URL_LILIUM
|
import es.verdnatura.domain.ConstAndValues.BASE_URL_LILIUM
|
||||||
import es.verdnatura.domain.ConstAndValues.BASE_URL_SALIX
|
import es.verdnatura.domain.ConstAndValues.BASE_URL_SALIX
|
||||||
import es.verdnatura.domain.ConstAndValues.COMPANYFK
|
|
||||||
import es.verdnatura.domain.ConstAndValues.ENTRYID
|
import es.verdnatura.domain.ConstAndValues.ENTRYID
|
||||||
import es.verdnatura.domain.ConstAndValues.ENTRYNUMBERIMAGES
|
|
||||||
import es.verdnatura.domain.ConstAndValues.ENTRYOBSERVATIONORIGINAL
|
import es.verdnatura.domain.ConstAndValues.ENTRYOBSERVATIONORIGINAL
|
||||||
import es.verdnatura.domain.ConstAndValues.ENTRYOBSERVATIONS
|
import es.verdnatura.domain.ConstAndValues.ENTRYOBSERVATIONS
|
||||||
import es.verdnatura.domain.ConstAndValues.ITEMPACKING
|
import es.verdnatura.domain.ConstAndValues.ITEMPACKING
|
||||||
|
@ -263,13 +261,11 @@ class DataStoreLocal(var mobileApplication: MobileApplication) {
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun deleteEntryPackaging() {
|
suspend fun deleteEntryPackaging() {
|
||||||
mobileApplication.dataStoreApp.editDataStoreKey(ENTRYID, -1)
|
mobileApplication.dataStoreApp.editDataStoreKey(ENTRYID, "")
|
||||||
mobileApplication.dataStoreApp.editDataStoreKey(SUPPLIERID, -1)
|
mobileApplication.dataStoreApp.editDataStoreKey(SUPPLIERID, "")
|
||||||
mobileApplication.dataStoreApp.editDataStoreKey(SUPPLIERNAME, "")
|
mobileApplication.dataStoreApp.editDataStoreKey(SUPPLIERNAME, "")
|
||||||
mobileApplication.dataStoreApp.editDataStoreKey(ENTRYOBSERVATIONORIGINAL, "")
|
mobileApplication.dataStoreApp.editDataStoreKey(ENTRYOBSERVATIONORIGINAL, "")
|
||||||
mobileApplication.dataStoreApp.editDataStoreKey(ENTRYOBSERVATIONS, "")
|
mobileApplication.dataStoreApp.editDataStoreKey(ENTRYOBSERVATIONS, "")
|
||||||
mobileApplication.dataStoreApp.editDataStoreKey(ENTRYNUMBERIMAGES, 0)
|
|
||||||
mobileApplication.dataStoreApp.editDataStoreKey(COMPANYFK, -1)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ import androidx.room.Database
|
||||||
import androidx.room.Delete
|
import androidx.room.Delete
|
||||||
import androidx.room.Insert
|
import androidx.room.Insert
|
||||||
import androidx.room.OnConflictStrategy
|
import androidx.room.OnConflictStrategy
|
||||||
import androidx.room.ProvidedTypeConverter
|
|
||||||
import androidx.room.Query
|
import androidx.room.Query
|
||||||
import androidx.room.Room
|
import androidx.room.Room
|
||||||
import androidx.room.RoomDatabase
|
import androidx.room.RoomDatabase
|
||||||
|
@ -47,10 +46,7 @@ abstract class DeliveryDatabase : RoomDatabase() {
|
||||||
return INSTANCE ?: synchronized(this) {
|
return INSTANCE ?: synchronized(this) {
|
||||||
val instance = Room.databaseBuilder(
|
val instance = Room.databaseBuilder(
|
||||||
context.applicationContext, DeliveryDatabase::class.java, "expedition_database"
|
context.applicationContext, DeliveryDatabase::class.java, "expedition_database"
|
||||||
).fallbackToDestructiveMigration(true)
|
).fallbackToDestructiveMigration().build()
|
||||||
.addTypeConverter(MapTypeConverter())
|
|
||||||
.fallbackToDestructiveMigration(true)
|
|
||||||
.build()
|
|
||||||
INSTANCE = instance
|
INSTANCE = instance
|
||||||
instance
|
instance
|
||||||
}
|
}
|
||||||
|
@ -139,7 +135,6 @@ interface ClientTicketDao {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ProvidedTypeConverter
|
|
||||||
class MapTypeConverter {
|
class MapTypeConverter {
|
||||||
private val gson = Gson()
|
private val gson = Gson()
|
||||||
|
|
||||||
|
@ -187,24 +182,13 @@ class MapTypeConverter {
|
||||||
}
|
}
|
||||||
|
|
||||||
@TypeConverter
|
@TypeConverter
|
||||||
fun fromTickets(tickets: MutableList<Ticket>): String? {
|
fun fromTickets(tickets: MutableList<Ticket?>): String? {
|
||||||
return gson.toJson(tickets)
|
return gson.toJson(tickets)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TypeConverter
|
@TypeConverter
|
||||||
fun toTickets(json: String?): MutableList<Ticket> {
|
fun toTickets(json: String?): MutableList<Ticket?> {
|
||||||
val type = object : TypeToken<MutableList<Ticket>>() {}.type
|
val type = object : TypeToken<MutableList<Ticket>>() {}.type
|
||||||
return gson.fromJson(json, type)
|
return gson.fromJson(json, type)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TypeConverter
|
|
||||||
fun fromNullableMap(map: MutableMap<String?, String?>): String {
|
|
||||||
return gson.toJson(map)
|
|
||||||
}
|
|
||||||
|
|
||||||
@TypeConverter
|
|
||||||
fun toNullableMap(json: String): MutableMap<String?, String?> {
|
|
||||||
val type = object : TypeToken<MutableMap<String?, String?>>() {}.type
|
|
||||||
return gson.fromJson(json, type)
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4,7 +4,6 @@ import es.verdnatura.presentation.view.feature.ajustes.fragment.AjustesViewModel
|
||||||
import es.verdnatura.presentation.view.feature.articulo.fragment.ItemCardViewModel
|
import es.verdnatura.presentation.view.feature.articulo.fragment.ItemCardViewModel
|
||||||
import es.verdnatura.presentation.view.feature.boxPicking.BoxPickingViewModel
|
import es.verdnatura.presentation.view.feature.boxPicking.BoxPickingViewModel
|
||||||
import es.verdnatura.presentation.view.feature.buffer.fragment.BufferFragmentViewModel
|
import es.verdnatura.presentation.view.feature.buffer.fragment.BufferFragmentViewModel
|
||||||
import es.verdnatura.presentation.view.feature.buscaritem.fragment.BuscarItemComposeViewModel
|
|
||||||
import es.verdnatura.presentation.view.feature.buscaritem.fragment.BuscarItemViewModel
|
import es.verdnatura.presentation.view.feature.buscaritem.fragment.BuscarItemViewModel
|
||||||
import es.verdnatura.presentation.view.feature.category.ChangeCategoryViewModel
|
import es.verdnatura.presentation.view.feature.category.ChangeCategoryViewModel
|
||||||
import es.verdnatura.presentation.view.feature.claim.fragment.ubication.ClaimViewModel
|
import es.verdnatura.presentation.view.feature.claim.fragment.ubication.ClaimViewModel
|
||||||
|
@ -14,9 +13,10 @@ import es.verdnatura.presentation.view.feature.collection.fragment.CollectionVie
|
||||||
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoViewModel
|
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoViewModel
|
||||||
import es.verdnatura.presentation.view.feature.delivery.viewmodels.DeliveryViewModel
|
import es.verdnatura.presentation.view.feature.delivery.viewmodels.DeliveryViewModel
|
||||||
import es.verdnatura.presentation.view.feature.diadeventa.fragment.DayOfSaleViewModel
|
import es.verdnatura.presentation.view.feature.diadeventa.fragment.DayOfSaleViewModel
|
||||||
import es.verdnatura.presentation.view.feature.diadeventa.fragment.DayOfSaleViewModelCompose
|
|
||||||
import es.verdnatura.presentation.view.feature.historicoarticulo.fragment.HistoricoArticuloViewModel
|
import es.verdnatura.presentation.view.feature.historicoarticulo.fragment.HistoricoArticuloViewModel
|
||||||
|
import es.verdnatura.presentation.view.feature.historicoshelving.fragment.ItemShelvingLogViewModel
|
||||||
import es.verdnatura.presentation.view.feature.historicoshelvinglog.fragment.ShelvingLogViewModel
|
import es.verdnatura.presentation.view.feature.historicoshelvinglog.fragment.ShelvingLogViewModel
|
||||||
|
import es.verdnatura.presentation.view.feature.historicovehiculo.fragment.HistoricoVehiculoViewModel
|
||||||
import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryViewModel
|
import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryViewModel
|
||||||
import es.verdnatura.presentation.view.feature.login.fragment.LoginViewModel
|
import es.verdnatura.presentation.view.feature.login.fragment.LoginViewModel
|
||||||
import es.verdnatura.presentation.view.feature.packaging.fragment.SupplierViewModel
|
import es.verdnatura.presentation.view.feature.packaging.fragment.SupplierViewModel
|
||||||
|
@ -24,7 +24,6 @@ import es.verdnatura.presentation.view.feature.packingHolland.fragment.PackingHo
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.CmrExpeditionPalletViewModel
|
import es.verdnatura.presentation.view.feature.paletizador.fragment.CmrExpeditionPalletViewModel
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionPalletDetailViewModel
|
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionPalletDetailViewModel
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionScanSorterViewModel
|
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionScanSorterViewModel
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionScanSorterViewModelCompose
|
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionScanViewModel
|
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionScanViewModel
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionStateViewModel
|
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionStateViewModel
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionTruckListViewModel
|
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionTruckListViewModel
|
||||||
|
@ -38,17 +37,15 @@ import es.verdnatura.presentation.view.feature.sacador.fragment.SacadorViewModel
|
||||||
import es.verdnatura.presentation.view.feature.sacador.fragment.showticket.ShowTicketViewModel
|
import es.verdnatura.presentation.view.feature.sacador.fragment.showticket.ShowTicketViewModel
|
||||||
import es.verdnatura.presentation.view.feature.ticket.fragment.TicketViewModel
|
import es.verdnatura.presentation.view.feature.ticket.fragment.TicketViewModel
|
||||||
import es.verdnatura.presentation.view.feature.ubicador.fragment.UbicadorViewModel
|
import es.verdnatura.presentation.view.feature.ubicador.fragment.UbicadorViewModel
|
||||||
import es.verdnatura.presentation.view.feature.workermistake.fragment.WorkerMistakeViewModel
|
|
||||||
import org.koin.android.ext.koin.androidApplication
|
|
||||||
import org.koin.android.ext.koin.androidContext
|
import org.koin.android.ext.koin.androidContext
|
||||||
import org.koin.androidx.viewmodel.dsl.viewModel
|
import org.koin.androidx.viewmodel.dsl.viewModel
|
||||||
import org.koin.dsl.module
|
import org.koin.dsl.module
|
||||||
|
|
||||||
val viewModelModule = module {
|
val viewModelModule = module {
|
||||||
|
|
||||||
viewModel {
|
/* viewModel {
|
||||||
WorkerMistakeViewModel(androidApplication())
|
WorkermistakeViewModel()
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// Login
|
// Login
|
||||||
viewModel {
|
viewModel {
|
||||||
|
@ -63,9 +60,6 @@ val viewModelModule = module {
|
||||||
viewModel {
|
viewModel {
|
||||||
DayOfSaleViewModel(androidContext())
|
DayOfSaleViewModel(androidContext())
|
||||||
}
|
}
|
||||||
viewModel {
|
|
||||||
DayOfSaleViewModelCompose(androidApplication())
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pasilleros / Item Card
|
// Pasilleros / Item Card
|
||||||
viewModel {
|
viewModel {
|
||||||
|
@ -82,10 +76,6 @@ val viewModelModule = module {
|
||||||
BuscarItemViewModel(androidContext())
|
BuscarItemViewModel(androidContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModel {
|
|
||||||
BuscarItemComposeViewModel(androidApplication())
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pasilleros / Buscar Item 2
|
// Pasilleros / Buscar Item 2
|
||||||
|
|
||||||
viewModel {
|
viewModel {
|
||||||
|
@ -113,10 +103,6 @@ val viewModelModule = module {
|
||||||
ExpeditionScanSorterViewModel(androidContext())
|
ExpeditionScanSorterViewModel(androidContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModel {
|
|
||||||
ExpeditionScanSorterViewModelCompose(androidApplication())
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
viewModel {
|
viewModel {
|
||||||
CmrExpeditionPalletViewModel(androidContext())
|
CmrExpeditionPalletViewModel(androidContext())
|
||||||
|
@ -172,6 +158,13 @@ val viewModelModule = module {
|
||||||
ControlVehiculoViewModel(androidContext())
|
ControlVehiculoViewModel(androidContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
viewModel {
|
||||||
|
HistoricoVehiculoViewModel(androidContext())
|
||||||
|
}
|
||||||
|
|
||||||
|
viewModel {
|
||||||
|
ItemShelvingLogViewModel(androidContext())
|
||||||
|
}
|
||||||
viewModel {
|
viewModel {
|
||||||
ShelvingLogViewModel(androidContext())
|
ShelvingLogViewModel(androidContext())
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,6 @@ object ConstAndValues {
|
||||||
const val SUPPLIERID = "SUPPLIERID"
|
const val SUPPLIERID = "SUPPLIERID"
|
||||||
const val SUPPLIERNAME = "SUPPLIERNAME"
|
const val SUPPLIERNAME = "SUPPLIERNAME"
|
||||||
const val ENTRYID = "ENTRYID"
|
const val ENTRYID = "ENTRYID"
|
||||||
const val COMPANYFK = "COMPANYFK"
|
|
||||||
const val ENTRYOBSERVATIONORIGINAL = "ENTRYOBSERVATIONORIGINAL"
|
const val ENTRYOBSERVATIONORIGINAL = "ENTRYOBSERVATIONORIGINAL"
|
||||||
const val ITEMPACKING = "itemPackingType"
|
const val ITEMPACKING = "itemPackingType"
|
||||||
const val ITEMPACKINGFK = "itemPackingTypeFk"
|
const val ITEMPACKINGFK = "itemPackingTypeFk"
|
||||||
|
@ -71,10 +70,6 @@ object ConstAndValues {
|
||||||
const val LIMITRECORDSSHELVINGLOG = 50
|
const val LIMITRECORDSSHELVINGLOG = 50
|
||||||
const val RESERVATIONMODE = "operatorReservationMode"
|
const val RESERVATIONMODE = "operatorReservationMode"
|
||||||
const val MODELWORKERTYPEACTIVITY = "APP"
|
const val MODELWORKERTYPEACTIVITY = "APP"
|
||||||
const val FLINGTHRESHOLDVELOCITY = 2000f
|
|
||||||
const val FLINGTHRESHOLDVERTICAL = 500f
|
|
||||||
const val SCANNER_THRESHOLD_SPEED: Int = 60
|
|
||||||
const val HUMAN_CHARACTERS_SECOND: Int = 100
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
package es.verdnatura.domain
|
package es.verdnatura.domain
|
||||||
|
|
||||||
import android.app.Activity
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.graphics.drawable.GradientDrawable
|
import android.graphics.drawable.GradientDrawable
|
||||||
|
import android.os.Build
|
||||||
import android.text.Html
|
import android.text.Html
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.view.ViewGroup
|
import android.view.LayoutInflater
|
||||||
import android.widget.EditText
|
import android.widget.EditText
|
||||||
import android.widget.FrameLayout
|
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
|
import androidx.annotation.RequiresApi
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.time.ZonedDateTime
|
import java.time.ZonedDateTime
|
||||||
|
@ -30,6 +30,7 @@ fun List<Any?>.formatWithQuotes(): String {
|
||||||
} + "]"
|
} + "]"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequiresApi(Build.VERSION_CODES.N)
|
||||||
fun Any.toast(
|
fun Any.toast(
|
||||||
context: Context?,
|
context: Context?,
|
||||||
duration: Int = Toast.LENGTH_SHORT,
|
duration: Int = Toast.LENGTH_SHORT,
|
||||||
|
@ -40,37 +41,30 @@ fun Any.toast(
|
||||||
Html.fromHtml("<font color='$color' ><b>$this</b></font>", 0),
|
Html.fromHtml("<font color='$color' ><b>$this</b></font>", 0),
|
||||||
duration
|
duration
|
||||||
)
|
)
|
||||||
|
//toast2.setGravity(Gravity.TOP, 0, 0)
|
||||||
toast.show()
|
toast.show()
|
||||||
return toast.apply { show() }
|
return toast.apply { show() }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Context.showToastCenterWithBackground(textToShow: String) {
|
fun Context.showToastCenterWithBackground(textToShow: String) {
|
||||||
(this as? Activity)?.window?.decorView?.let { rootView ->
|
val inflater = LayoutInflater.from(this)
|
||||||
TextView(this).apply {
|
val layout = inflater.inflate(R.layout.ticket_toast_layout, null)
|
||||||
text = textToShow
|
val text = layout.findViewById<TextView>(R.id.toast_text)
|
||||||
setTextColor(getColor(R.color.verdnatura_orange_salix))
|
text.text = "$textToShow"
|
||||||
textSize = 22f
|
text.setTextColor(this.getColor(R.color.verdnatura_orange_salix))
|
||||||
gravity = Gravity.CENTER
|
text.textSize = 18f
|
||||||
setPadding(32, 16, 32, 16)
|
|
||||||
background = GradientDrawable().apply {
|
|
||||||
setColor(Color.BLACK)
|
|
||||||
cornerRadius = 16f
|
|
||||||
alpha = 220
|
|
||||||
}
|
|
||||||
layoutParams = FrameLayout.LayoutParams(
|
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
|
||||||
).apply { gravity = Gravity.CENTER }
|
|
||||||
alpha = 0f
|
|
||||||
|
|
||||||
(rootView as ViewGroup).addView(this)
|
val background = GradientDrawable().apply {
|
||||||
|
setColor(Color.parseColor("#000000"))
|
||||||
|
cornerRadius = 16f
|
||||||
|
}
|
||||||
|
layout.background = background
|
||||||
|
|
||||||
animate().alpha(1f).setDuration(300).withEndAction {
|
Toast(this).apply {
|
||||||
animate().alpha(0f).setStartDelay(1000).setDuration(300)
|
duration = Toast.LENGTH_LONG
|
||||||
.withEndAction { (rootView).removeView(this) }
|
view = layout
|
||||||
.start()
|
setGravity(Gravity.CENTER, 0, 0)
|
||||||
}.start()
|
show()
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,6 +95,7 @@ fun toDateString(date: Date): String {
|
||||||
return format.format(date)
|
return format.format(date)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
fun String?.isoToString(returnOnlyDate: Boolean = false): String {
|
fun String?.isoToString(returnOnlyDate: Boolean = false): String {
|
||||||
|
|
||||||
return if (!this.isNullOrEmpty() && this.contains("T")) {
|
return if (!this.isNullOrEmpty() && this.contains("T")) {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.google.gson.Gson
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import es.verdnatura.MobileApplication
|
import es.verdnatura.MobileApplication
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
|
import es.verdnatura.presentation.base.nameofFunction
|
||||||
import es.verdnatura.presentation.view.feature.login.activity.LoginActivity
|
import es.verdnatura.presentation.view.feature.login.activity.LoginActivity
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
|
@ -50,7 +51,7 @@ abstract class SalixCallback<T>(val context: Context) : Callback<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun defaultErrorHandler(t: Throwable) {
|
private fun defaultErrorHandler(t: Throwable) {
|
||||||
//println("ErrorSalixx${t.message}")
|
//println("ErrorSalixx${t.message}")
|
||||||
// (nameofFunction((this)) + t.message).toast(context)
|
// (nameofFunction((this)) + t.message).toast(context)
|
||||||
(context as MobileApplication).messageToast(
|
(context as MobileApplication).messageToast(
|
||||||
|
@ -95,24 +96,3 @@ abstract class SalixCallback<T>(val context: Context) : Callback<T> {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun nameofFunction(function: Any): String {
|
|
||||||
return try {
|
|
||||||
function.javaClass.enclosingMethod!!.name + "->"
|
|
||||||
} catch (e: Exception) {
|
|
||||||
"ActivityMain->"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getMessageFromAllResponse(callFunction: String, responseMessage: String): String {
|
|
||||||
|
|
||||||
var messageFromError: String = try {
|
|
||||||
val answerError = JSONObject(responseMessage)
|
|
||||||
answerError.get("Message").toString()
|
|
||||||
} catch (e: Exception) {
|
|
||||||
responseMessage
|
|
||||||
}
|
|
||||||
|
|
||||||
return "$messageFromError.\r${"Callback: $callFunction."}"
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -5,8 +5,8 @@ import es.verdnatura.presentation.common.ExpeditionPrintOut
|
||||||
import es.verdnatura.presentation.common.ItemBarCodeSalix
|
import es.verdnatura.presentation.common.ItemBarCodeSalix
|
||||||
import es.verdnatura.presentation.common.ItemShelving
|
import es.verdnatura.presentation.common.ItemShelving
|
||||||
import es.verdnatura.presentation.common.PackingSiteSalix
|
import es.verdnatura.presentation.common.PackingSiteSalix
|
||||||
|
import es.verdnatura.presentation.common.PickupResponse
|
||||||
import es.verdnatura.presentation.common.SaleTrackingSalix
|
import es.verdnatura.presentation.common.SaleTrackingSalix
|
||||||
import es.verdnatura.presentation.common.TicketPickupResponse
|
|
||||||
import es.verdnatura.presentation.common.TicketState
|
import es.verdnatura.presentation.common.TicketState
|
||||||
import es.verdnatura.presentation.view.feature.ajustes.model.Printers
|
import es.verdnatura.presentation.view.feature.ajustes.model.Printers
|
||||||
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
||||||
|
@ -16,7 +16,7 @@ import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemDetails
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemDetails
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemProposal
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemProposal
|
||||||
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemShelvings
|
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO
|
||||||
import es.verdnatura.presentation.view.feature.calidad.model.Buyer
|
import es.verdnatura.presentation.view.feature.calidad.model.Buyer
|
||||||
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
|
import es.verdnatura.presentation.view.feature.calidad.model.BuyerVO
|
||||||
import es.verdnatura.presentation.view.feature.claim.fragment.reubication.model.Reubication
|
import es.verdnatura.presentation.view.feature.claim.fragment.reubication.model.Reubication
|
||||||
|
@ -36,7 +36,9 @@ import es.verdnatura.presentation.view.feature.delivery.model.RouteInfo
|
||||||
import es.verdnatura.presentation.view.feature.delivery.model.TicketObservation
|
import es.verdnatura.presentation.view.feature.delivery.model.TicketObservation
|
||||||
import es.verdnatura.presentation.view.feature.diadeventa.model.ItemShelvingSaleDate
|
import es.verdnatura.presentation.view.feature.diadeventa.model.ItemShelvingSaleDate
|
||||||
import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoVO
|
import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoVO
|
||||||
|
import es.verdnatura.presentation.view.feature.historicoshelving.model.ItemShelvingLog
|
||||||
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLogSalix
|
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLogSalix
|
||||||
|
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculo
|
||||||
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
|
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
|
||||||
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventoryParking
|
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventoryParking
|
||||||
import es.verdnatura.presentation.view.feature.login.model.AccessConfigSalix
|
import es.verdnatura.presentation.view.feature.login.model.AccessConfigSalix
|
||||||
|
@ -50,7 +52,6 @@ import es.verdnatura.presentation.view.feature.login.model.OperatorSalix
|
||||||
import es.verdnatura.presentation.view.feature.login.model.RenewToken
|
import es.verdnatura.presentation.view.feature.login.model.RenewToken
|
||||||
import es.verdnatura.presentation.view.feature.login.model.VersionApp
|
import es.verdnatura.presentation.view.feature.login.model.VersionApp
|
||||||
import es.verdnatura.presentation.view.feature.login.model.WorkerData
|
import es.verdnatura.presentation.view.feature.login.model.WorkerData
|
||||||
import es.verdnatura.presentation.view.feature.packaging.model.DmsType
|
|
||||||
import es.verdnatura.presentation.view.feature.packaging.model.EntrySalix
|
import es.verdnatura.presentation.view.feature.packaging.model.EntrySalix
|
||||||
import es.verdnatura.presentation.view.feature.packaging.model.ItemSupplier
|
import es.verdnatura.presentation.view.feature.packaging.model.ItemSupplier
|
||||||
import es.verdnatura.presentation.view.feature.packaging.model.NotificationQueue
|
import es.verdnatura.presentation.view.feature.packaging.model.NotificationQueue
|
||||||
|
@ -69,7 +70,6 @@ import es.verdnatura.presentation.view.feature.roadmap.model.RoadStopMapTruck
|
||||||
import es.verdnatura.presentation.view.feature.roadmap.model.StopMapTruckPallet
|
import es.verdnatura.presentation.view.feature.roadmap.model.StopMapTruckPallet
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionTicket
|
import es.verdnatura.presentation.view.feature.sacador.model.CollectionTicket
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.ItemShelvingSale
|
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeVO
|
import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO
|
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.TicketStateSalix
|
import es.verdnatura.presentation.view.feature.sacador.model.TicketStateSalix
|
||||||
|
@ -210,11 +210,6 @@ interface SalixService {
|
||||||
|
|
||||||
): Call<Any>
|
): Call<Any>
|
||||||
|
|
||||||
@GET("Sips/findOne")
|
|
||||||
fun sipGetExtension(
|
|
||||||
@Query("filter") filter: String,
|
|
||||||
): Call<Any>
|
|
||||||
|
|
||||||
@GET("Workers/Summary")
|
@GET("Workers/Summary")
|
||||||
fun getNameWorker(
|
fun getNameWorker(
|
||||||
@Query("filter") filter: String
|
@Query("filter") filter: String
|
||||||
|
@ -408,8 +403,7 @@ interface SalixService {
|
||||||
fun addSale(
|
fun addSale(
|
||||||
@Path("id") id: Number,
|
@Path("id") id: Number,
|
||||||
@Query("quantity") quantity: Number,
|
@Query("quantity") quantity: Number,
|
||||||
@Query("barcode") barcode: String,
|
@Query("barcode") barcode: String
|
||||||
@Query("isAdded") isAdded: Boolean = true
|
|
||||||
): Call<Any>
|
): Call<Any>
|
||||||
|
|
||||||
@POST("Collections/assign")
|
@POST("Collections/assign")
|
||||||
|
@ -420,11 +414,6 @@ interface SalixService {
|
||||||
fun collectionAssigned(
|
fun collectionAssigned(
|
||||||
): Call<Int>
|
): Call<Int>
|
||||||
|
|
||||||
@GET("ItemShelvings")
|
|
||||||
fun itemShelvingsGet(
|
|
||||||
@Query("filter") filter: String
|
|
||||||
): Call<List<ItemShelvings>>
|
|
||||||
|
|
||||||
@POST("ItemShelvings/updateFromSale")
|
@POST("ItemShelvings/updateFromSale")
|
||||||
fun itemShelvingUpdateFromSale(
|
fun itemShelvingUpdateFromSale(
|
||||||
@Body params: Any
|
@Body params: Any
|
||||||
|
@ -445,6 +434,16 @@ interface SalixService {
|
||||||
@Body params: Any
|
@Body params: Any
|
||||||
): Call<Any>
|
): Call<Any>
|
||||||
|
|
||||||
|
@POST("MachineWorkers/updateInTime")
|
||||||
|
fun machineWorkerUpdateInTime(
|
||||||
|
@Body params: Any
|
||||||
|
): Call<Any>
|
||||||
|
|
||||||
|
@POST("MachineWorkers/add")
|
||||||
|
fun machineWorkerAdd(
|
||||||
|
@Query("plate") plate: Any
|
||||||
|
): Call<Any>
|
||||||
|
|
||||||
@POST("SaleTrackings/updateTracking")
|
@POST("SaleTrackings/updateTracking")
|
||||||
fun saleTrackingUpdate(
|
fun saleTrackingUpdate(
|
||||||
@Body params: Any
|
@Body params: Any
|
||||||
|
@ -457,7 +456,7 @@ interface SalixService {
|
||||||
|
|
||||||
@GET("ItemShelvings/getAlternative")
|
@GET("ItemShelvings/getAlternative")
|
||||||
fun itemShelvingAlternative(
|
fun itemShelvingAlternative(
|
||||||
@Query("shelvingCode") shelvingFk: String
|
@Query("shelvingFk") shelvingFk: String
|
||||||
): Call<ArrayList<Reubication>>
|
): Call<ArrayList<Reubication>>
|
||||||
|
|
||||||
@GET("MobileAppVersionControls/getVersion")
|
@GET("MobileAppVersionControls/getVersion")
|
||||||
|
@ -481,6 +480,11 @@ interface SalixService {
|
||||||
@Query("params") params: Any? = null, @Query("schema") schema: String = "vn"
|
@Query("params") params: Any? = null, @Query("schema") schema: String = "vn"
|
||||||
): Call<List<PlacementSupplyVO>>
|
): Call<List<PlacementSupplyVO>>
|
||||||
|
|
||||||
|
@POST("Applications/machineWorker_getHistorical/execute-proc")
|
||||||
|
fun machineWorkerGetHistorical(
|
||||||
|
@Query("params") params: Any? = null, @Query("schema") schema: String = "vn"
|
||||||
|
): Call<List<ItemHistoricoVehiculo>>
|
||||||
|
|
||||||
@POST("Applications/expedition_getFromRoute/execute-proc")
|
@POST("Applications/expedition_getFromRoute/execute-proc")
|
||||||
fun expeditionGetFromRoute(
|
fun expeditionGetFromRoute(
|
||||||
@Query("params") params: Any? = null, @Query("schema") schema: String = "vn"
|
@Query("params") params: Any? = null, @Query("schema") schema: String = "vn"
|
||||||
|
@ -526,6 +530,18 @@ interface SalixService {
|
||||||
@Query("params") params: Any? = null, @Query("schema") schema: String = "vn"
|
@Query("params") params: Any? = null, @Query("schema") schema: String = "vn"
|
||||||
): Call<Any>
|
): Call<Any>
|
||||||
|
|
||||||
|
@GET("ItemShelvings/getListItemNewer")
|
||||||
|
fun getListItemNewer(
|
||||||
|
@Query("shelvingFk") shelvingFkIn: Any, @Query("parking") parking: Any? = null
|
||||||
|
): Call<List<ItemShelvingNewer>>
|
||||||
|
|
||||||
|
@GET("ItemShelvings/getListItemNewer")
|
||||||
|
fun getListItemNewerNew(
|
||||||
|
@Query("shelvingFk") shelvingFkIn: Any,
|
||||||
|
@Query("parking") parking: Any? = null,
|
||||||
|
@Query("itemFk") itemFk: Any? = null
|
||||||
|
): Call<List<ItemShelvingNewer>>
|
||||||
|
|
||||||
@GET("ItemShelvings/getItemsByReviewOrder")
|
@GET("ItemShelvings/getItemsByReviewOrder")
|
||||||
fun getItemsByReviewOrder(
|
fun getItemsByReviewOrder(
|
||||||
@Query("shelving") shelvingFkIn: Any,
|
@Query("shelving") shelvingFkIn: Any,
|
||||||
|
@ -548,6 +564,11 @@ interface SalixService {
|
||||||
@Query("params") params: Any? = null, @Query("schema") schema: String = "vn"
|
@Query("params") params: Any? = null, @Query("schema") schema: String = "vn"
|
||||||
): Call<Any>
|
): Call<Any>
|
||||||
|
|
||||||
|
/* @POST("Applications/machine_getWorkerPlate/execute-proc")
|
||||||
|
fun machineGetWorkerPlate(
|
||||||
|
@Query("params") params: Any? = null, @Query("schema") schema: String = "vn"
|
||||||
|
): Call<List<JsonObject>>*/
|
||||||
|
|
||||||
@POST("Applications/sectorCollection_get/execute-proc")
|
@POST("Applications/sectorCollection_get/execute-proc")
|
||||||
fun sectorCollectionGet(
|
fun sectorCollectionGet(
|
||||||
@Query("params") params: Any? = null, @Query("schema") schema: String = "vn"
|
@Query("params") params: Any? = null, @Query("schema") schema: String = "vn"
|
||||||
|
@ -616,7 +637,12 @@ interface SalixService {
|
||||||
@GET("Tickets")
|
@GET("Tickets")
|
||||||
fun ticketIsPickup(
|
fun ticketIsPickup(
|
||||||
@Query("filter") filter: Any, @Query("schema") schema: String = "vn"
|
@Query("filter") filter: Any, @Query("schema") schema: String = "vn"
|
||||||
): Call<List<TicketPickupResponse>>
|
): Call<List<PickupResponse>>
|
||||||
|
|
||||||
|
@POST("Applications/workerMachinery_isRegistered/execute-func")
|
||||||
|
fun workerMachineryIsRegistered(
|
||||||
|
@Query("params") params: Any, @Query("schema") schema: String = "vn"
|
||||||
|
): Call<String>
|
||||||
|
|
||||||
@POST("Applications/ticket_printLabelPrevious/execute-proc")
|
@POST("Applications/ticket_printLabelPrevious/execute-proc")
|
||||||
fun ticketPrintLabelPrevious(
|
fun ticketPrintLabelPrevious(
|
||||||
|
@ -685,6 +711,17 @@ interface SalixService {
|
||||||
@Query("params") params: Any,
|
@Query("params") params: Any,
|
||||||
): Call<Any>
|
): Call<Any>
|
||||||
|
|
||||||
|
@GET("ItemShelvingLogs")
|
||||||
|
fun itemShelvingLogGet(
|
||||||
|
@Query("filter") filter: String,
|
||||||
|
): Call<List<ItemShelvingLog>>
|
||||||
|
|
||||||
|
@POST("Applications/itemshelving_getInfo/execute-proc")
|
||||||
|
fun itemshelvingGetInfo(
|
||||||
|
@Query("schema") schema: String = "vn",
|
||||||
|
@Query("params") params: Any,
|
||||||
|
): Call<List<ItemLocationVO>>
|
||||||
|
|
||||||
@POST("Applications/itemShelving_get/execute-proc")
|
@POST("Applications/itemShelving_get/execute-proc")
|
||||||
fun itemShelvingListNew(
|
fun itemShelvingListNew(
|
||||||
@Query("schema") schema: String = "vn",
|
@Query("schema") schema: String = "vn",
|
||||||
|
@ -898,11 +935,6 @@ interface SalixService {
|
||||||
@Body parms: PackingSiteSalix
|
@Body parms: PackingSiteSalix
|
||||||
): Call<Unit>
|
): Call<Unit>
|
||||||
|
|
||||||
@GET("Tickets/{id}/exists")
|
|
||||||
fun ticketExists(
|
|
||||||
@Path("id") id: Number,
|
|
||||||
): Call<JsonObject>
|
|
||||||
|
|
||||||
@PUT("ItemBarCodes")
|
@PUT("ItemBarCodes")
|
||||||
fun barcodesEdit(
|
fun barcodesEdit(
|
||||||
@Body params: ItemBarCodeSalix
|
@Body params: ItemBarCodeSalix
|
||||||
|
@ -928,11 +960,6 @@ interface SalixService {
|
||||||
fun getWithPackaging(
|
fun getWithPackaging(
|
||||||
): Call<List<Supplier>>
|
): Call<List<Supplier>>
|
||||||
|
|
||||||
@GET("DmsTypes/findOne")
|
|
||||||
fun getDmsType(
|
|
||||||
@Query("filter") filter: String
|
|
||||||
): Call<DmsType>
|
|
||||||
|
|
||||||
@GET("Entries")
|
@GET("Entries")
|
||||||
fun getEntriesFromSupplier(
|
fun getEntriesFromSupplier(
|
||||||
@Query("filter") filter: String
|
@Query("filter") filter: String
|
||||||
|
@ -1040,11 +1067,6 @@ interface SalixService {
|
||||||
@Path("id") id: Number,
|
@Path("id") id: Number,
|
||||||
): Call<JsonObject>
|
): Call<JsonObject>
|
||||||
|
|
||||||
@GET("ItemShelvingSales")
|
|
||||||
fun itemShelvingSaleTotalBySale(
|
|
||||||
@Query("filter") filter: String,
|
|
||||||
): Call<List<ItemShelvingSale>>
|
|
||||||
|
|
||||||
@PATCH("ItemShelvingSales/{id}")
|
@PATCH("ItemShelvingSales/{id}")
|
||||||
fun itemShelvingsReservedUpdate(
|
fun itemShelvingsReservedUpdate(
|
||||||
@Path("id") id: Number, @Body params: Any
|
@Path("id") id: Number, @Body params: Any
|
||||||
|
@ -1055,17 +1077,11 @@ interface SalixService {
|
||||||
@Path("id") id: Number
|
@Path("id") id: Number
|
||||||
): Call<ItemShelving>
|
): Call<ItemShelving>
|
||||||
|
|
||||||
@POST("Applications/itemShelvingSale_addByCollection/execute-proc")
|
@POST("ItemShelvingSales/itemShelvingSale_addByCollection")
|
||||||
fun itemShelvingSaleAddByCollection(
|
fun itemShelvingSaleAddByCollection(
|
||||||
@Query("schema") schema: String = "vn",
|
@Body params: Any,
|
||||||
@Query("params") params: Any? = null
|
|
||||||
): Call<Any>
|
): Call<Any>
|
||||||
|
|
||||||
/* @POST("ItemShelvingSales/itemShelvingSale_addByCollection")
|
|
||||||
fun itemShelvingSaleAddByCollection(
|
|
||||||
@Body params: Any,
|
|
||||||
): Call<Any>*/
|
|
||||||
|
|
||||||
@POST("ItemShelvings/getInventory")
|
@POST("ItemShelvings/getInventory")
|
||||||
fun getInventoryParking(
|
fun getInventoryParking(
|
||||||
@Query("parkingFrom") parkingFrom: String, @Query("parkingTo") parkingTo: String
|
@Query("parkingFrom") parkingFrom: String, @Query("parkingTo") parkingTo: String
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package es.verdnatura.domain.userCases
|
package es.verdnatura.domain.userCases
|
||||||
|
|
||||||
import es.verdnatura.domain.SalixService
|
import es.verdnatura.domain.SalixService
|
||||||
import es.verdnatura.presentation.view.feature.packaging.model.NotificationQueue
|
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.WorkerActionSalix
|
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
|
|
||||||
class GetItemFromBarcodeUseCase(private val salixService: SalixService) {
|
class GetItemFromBarcodeUseCase(private val salixService: SalixService) {
|
||||||
|
@ -20,24 +18,3 @@ class GetItemPrintItemUseCase(private val salixService: SalixService) {
|
||||||
return salixService.buyGetLastWithoutInventory(params)
|
return salixService.buyGetLastWithoutInventory(params)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class NotiticationUseCase(private val salixService: SalixService) {
|
|
||||||
fun executeSendNotification(notificationQueue: NotificationQueue): Call<Void> {
|
|
||||||
return salixService.notificationQueues(notificationQueue)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class WorkerActivityUseCase(private val salixService: SalixService) {
|
|
||||||
fun addWorkerActivity(workerActionSalix: WorkerActionSalix): Call<Any> {
|
|
||||||
return salixService.workerActivityAdd(workerActionSalix)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class OperatorUseCase(private val salixService: SalixService) {
|
|
||||||
fun updateOperator(workerFk: Number, update: HashMap<String, Number>): Call<Unit> {
|
|
||||||
return salixService.updateOperator(
|
|
||||||
id = workerFk,
|
|
||||||
params = update
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -17,7 +17,6 @@ import es.verdnatura.MobileApplication
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.ToolbarFragmentBinding
|
import es.verdnatura.databinding.ToolbarFragmentBinding
|
||||||
import es.verdnatura.db.DeliveryDatabase
|
import es.verdnatura.db.DeliveryDatabase
|
||||||
import es.verdnatura.db.MapTypeConverter
|
|
||||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
|
@ -136,8 +135,6 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(
|
||||||
R.drawable.ic_sign_ticket -> getString(R.string.signed)
|
R.drawable.ic_sign_ticket -> getString(R.string.signed)
|
||||||
R.drawable.ic_send -> getString(R.string.sendDriverRoute)
|
R.drawable.ic_send -> getString(R.string.sendDriverRoute)
|
||||||
R.drawable.ic_add_multiple -> getString(R.string.addItemMultipleShelvings)
|
R.drawable.ic_add_multiple -> getString(R.string.addItemMultipleShelvings)
|
||||||
R.drawable.ic_clean_shelving -> getString(R.string.activityOrganize)
|
|
||||||
R.drawable.ic_booking -> getString(R.string.bookingNewSalesCollection)
|
|
||||||
else -> {
|
else -> {
|
||||||
""
|
""
|
||||||
}
|
}
|
||||||
|
@ -173,8 +170,7 @@ fun database(myContext: Context): DeliveryDatabase {
|
||||||
return Room.databaseBuilder(
|
return Room.databaseBuilder(
|
||||||
myContext,
|
myContext,
|
||||||
DeliveryDatabase::class.java, "expediciones.db"
|
DeliveryDatabase::class.java, "expediciones.db"
|
||||||
).addTypeConverter(MapTypeConverter())
|
).build()
|
||||||
.build()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import androidx.lifecycle.LifecycleObserver
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import es.verdnatura.MobileApplication
|
import es.verdnatura.MobileApplication
|
||||||
import es.verdnatura.domain.SalixService
|
import es.verdnatura.domain.SalixService
|
||||||
|
import org.json.JSONObject
|
||||||
|
|
||||||
abstract class BaseViewModel : ViewModel, LifecycleObserver {
|
abstract class BaseViewModel : ViewModel, LifecycleObserver {
|
||||||
lateinit var app: MobileApplication
|
lateinit var app: MobileApplication
|
||||||
|
@ -17,3 +18,23 @@ abstract class BaseViewModel : ViewModel, LifecycleObserver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun nameofFunction(function: Any): String {
|
||||||
|
return try {
|
||||||
|
function.javaClass.enclosingMethod!!.name + "->"
|
||||||
|
} catch (e: Exception) {
|
||||||
|
"ActivityMain->"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getMessageFromAllResponse(callFunction: String, responseMessage: String): String {
|
||||||
|
|
||||||
|
var messageFromError: String = try {
|
||||||
|
val answerError = JSONObject(responseMessage)
|
||||||
|
answerError.get("Message").toString()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
responseMessage
|
||||||
|
}
|
||||||
|
|
||||||
|
return "$messageFromError.\r${"Callback: $callFunction."}"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
package es.verdnatura.presentation.base
|
|
||||||
|
|
||||||
import android.app.Application
|
|
||||||
import androidx.lifecycle.LifecycleObserver
|
|
||||||
import androidx.lifecycle.ViewModel
|
|
||||||
import es.verdnatura.MobileApplication
|
|
||||||
import es.verdnatura.domain.SalixService
|
|
||||||
|
|
||||||
abstract class BaseViewModelCompose(application: Application) : ViewModel(), LifecycleObserver {
|
|
||||||
protected val app: MobileApplication = application as MobileApplication
|
|
||||||
protected val salix: SalixService = app.salix
|
|
||||||
|
|
||||||
}
|
|
|
@ -4,18 +4,13 @@ import android.app.AlertDialog
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.text.InputType
|
import android.text.InputType
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.inputmethod.EditorInfo
|
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.domain.toast
|
import es.verdnatura.domain.toast
|
||||||
import es.verdnatura.presentation.view.component.CustomDialogInput
|
|
||||||
import es.verdnatura.presentation.view.component.CustomDialogList
|
import es.verdnatura.presentation.view.component.CustomDialogList
|
||||||
|
|
||||||
class PrinterDialogManager(private val context: Context) {
|
class PrinterDialogManager(private val context: Context) {
|
||||||
fun showPrintDialog(
|
fun showPrintDialog(
|
||||||
item: Long,
|
item: Long, itemName: String, onPrintClick: (Long, String, Int?, Int) -> Unit
|
||||||
itemName: String,
|
|
||||||
onPrintClick: (Long, String, Int?, Int) -> Unit,
|
|
||||||
onPrintChange: (String) -> Unit
|
|
||||||
) {
|
) {
|
||||||
val customDialogList = CustomDialogList(context)
|
val customDialogList = CustomDialogList(context)
|
||||||
customDialogList.getEditText().setRawInputType(InputType.TYPE_CLASS_NUMBER)
|
customDialogList.getEditText().setRawInputType(InputType.TYPE_CLASS_NUMBER)
|
||||||
|
@ -28,9 +23,7 @@ class PrinterDialogManager(private val context: Context) {
|
||||||
}.setOkTwoButton(context.getString(R.string.printBarcode)) {
|
}.setOkTwoButton(context.getString(R.string.printBarcode)) {
|
||||||
handlePrintClick(item, customDialogList, onPrintClick, "barcode")
|
handlePrintClick(item, customDialogList, onPrintClick, "barcode")
|
||||||
customDialogList.dismiss()
|
customDialogList.dismiss()
|
||||||
//Tarea 7823
|
|
||||||
}.setOkThreeButton(context.getString(R.string.changePrinter)) {
|
|
||||||
readQrPrinter(onPrintChange)
|
|
||||||
}.setKoButton(context.getString(R.string.cancel)) {
|
}.setKoButton(context.getString(R.string.cancel)) {
|
||||||
customDialogList.dismiss()
|
customDialogList.dismiss()
|
||||||
}.setHintValueThree(context.getString(R.string.labelNumber))
|
}.setHintValueThree(context.getString(R.string.labelNumber))
|
||||||
|
@ -39,30 +32,6 @@ class PrinterDialogManager(private val context: Context) {
|
||||||
customDialogList.getFocusThree()
|
customDialogList.getFocusThree()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun readQrPrinter(onPrintChange: (String) -> Unit) {
|
|
||||||
val customDialogInput = CustomDialogInput(context)
|
|
||||||
|
|
||||||
customDialogInput.setTitle(context.getString(R.string.changePrinter))
|
|
||||||
.setDescription(context.getString(R.string.scanQrPrinter))
|
|
||||||
.setOkButton(context.getString(R.string.save)) {
|
|
||||||
onPrintChange(customDialogInput.getValue())
|
|
||||||
customDialogInput.dismiss()
|
|
||||||
|
|
||||||
}.setKoButton(context.getString(R.string.cancel)) {
|
|
||||||
customDialogInput.dismiss()
|
|
||||||
}.setValue("").show()
|
|
||||||
customDialogInput.getEditText().requestFocus()
|
|
||||||
customDialogInput.getEditText().setOnEditorActionListener { _, actionId, _ ->
|
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
|
||||||
onPrintChange(customDialogInput.getValue())
|
|
||||||
println("printerrr ${customDialogInput.getValue()}")
|
|
||||||
customDialogInput.dismiss()
|
|
||||||
return@setOnEditorActionListener true
|
|
||||||
}
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun handlePrintClick(
|
private fun handlePrintClick(
|
||||||
item: Long,
|
item: Long,
|
||||||
customDialogList: CustomDialogList,
|
customDialogList: CustomDialogList,
|
||||||
|
|
|
@ -26,9 +26,9 @@ data class SaleTrackingSalix(
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
data class PackingSiteSalix(
|
class PackingSiteSalix(
|
||||||
val ticketFk: Number,
|
var ticketFk: Int,
|
||||||
val workerFk: Number
|
var workerFk: Int
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -43,10 +43,7 @@ data class ItemShelving(
|
||||||
var itemFk: Int,
|
var itemFk: Int,
|
||||||
var shelvingFk: String,
|
var shelvingFk: String,
|
||||||
var position: Int,
|
var position: Int,
|
||||||
var quantity: Int,
|
var quantity: Int
|
||||||
var visible: Int? = null,
|
|
||||||
var available: Int? = null
|
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
data class ItemShelvingSalix(
|
data class ItemShelvingSalix(
|
||||||
|
@ -101,8 +98,14 @@ data class ExpeditionPrintOut(
|
||||||
val isChecked: Boolean
|
val isChecked: Boolean
|
||||||
)
|
)
|
||||||
|
|
||||||
data class TicketPickupResponse(
|
data class PickupResponse(
|
||||||
|
val routeFk: Int,
|
||||||
|
val route: Route?
|
||||||
|
)
|
||||||
|
|
||||||
|
data class Route(
|
||||||
val id: Int,
|
val id: Int,
|
||||||
|
val agencyModeFk: Int,
|
||||||
val agencyMode: AgencyMode?
|
val agencyMode: AgencyMode?
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import es.verdnatura.presentation.view.feature.ajustes.model.AjustesItemVO
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
|
import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardRowVO
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardRowVO
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemProposal
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemProposal
|
||||||
|
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO
|
||||||
import es.verdnatura.presentation.view.feature.claim.fragment.reubication.model.Reubication
|
import es.verdnatura.presentation.view.feature.claim.fragment.reubication.model.Reubication
|
||||||
import es.verdnatura.presentation.view.feature.delivery.model.ClientTicketSalix
|
import es.verdnatura.presentation.view.feature.delivery.model.ClientTicketSalix
|
||||||
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoSummary
|
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoSummary
|
||||||
|
@ -139,6 +140,10 @@ interface OnTrashItemRowClickListener {
|
||||||
fun onTrashItemRowClickListener(item: WorkForms)
|
fun onTrashItemRowClickListener(item: WorkForms)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface OnLocationRowClickListener {
|
||||||
|
fun onLocationRowClickListener(item: ItemLocationVO)
|
||||||
|
}
|
||||||
|
|
||||||
interface OnInvetoryNichoClickListener {
|
interface OnInvetoryNichoClickListener {
|
||||||
fun onInvetoryNichoClickListener(item: ItemInventaryVO)
|
fun onInvetoryNichoClickListener(item: ItemInventaryVO)
|
||||||
}
|
}
|
||||||
|
@ -155,10 +160,6 @@ interface OnClientHistoricItemClickListener {
|
||||||
fun onClientHistoricItemClickListener(item: ItemHistoricoVO)
|
fun onClientHistoricItemClickListener(item: ItemHistoricoVO)
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OnOutQuantityHistoricItemClickListener {
|
|
||||||
fun onOutQuantityHistoricItemClickListener(item: ItemHistoricoVO)
|
|
||||||
}
|
|
||||||
|
|
||||||
interface OnVisibleClickListener {
|
interface OnVisibleClickListener {
|
||||||
fun onVisibleClickListener(item: ItemUbicadorVO)
|
fun onVisibleClickListener(item: ItemUbicadorVO)
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
|
import android.text.InputType
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.ViewTreeObserver
|
import android.view.ViewTreeObserver
|
||||||
|
@ -168,7 +169,7 @@ fun Context.hideKeyboard(view: View) {
|
||||||
|
|
||||||
fun Context.showKeyboard() {
|
fun Context.showKeyboard() {
|
||||||
val imm = getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager?
|
val imm = getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager?
|
||||||
imm!!.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0)
|
imm!!.toggleSoftInput(InputType.TYPE_CLASS_NUMBER, 0)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import java.text.SimpleDateFormat
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
class FunctionUtils {
|
class FunctionUtils{
|
||||||
fun getMessageFromJSON(json: String): String {
|
fun getMessageFromJSON(json: String): String {
|
||||||
val gson = Gson()
|
val gson = Gson()
|
||||||
var message = ""
|
var message = ""
|
||||||
|
@ -38,11 +38,9 @@ class FunctionUtils {
|
||||||
|
|
||||||
private fun getCurdate(date: String, context: Context): String {
|
private fun getCurdate(date: String, context: Context): String {
|
||||||
val c = Calendar.getInstance()
|
val c = Calendar.getInstance()
|
||||||
val df =
|
val df = SimpleDateFormat(context.getString(R.string.dateCompleteFormat), Locale.getDefault())
|
||||||
SimpleDateFormat(context.getString(R.string.dateCompleteFormat), Locale.getDefault())
|
|
||||||
val df2 = SimpleDateFormat(context.getString(R.string.timeFormat), Locale.getDefault())
|
val df2 = SimpleDateFormat(context.getString(R.string.timeFormat), Locale.getDefault())
|
||||||
c.time = df.parse(date)!!
|
c.time = df.parse(date)!!
|
||||||
return df2.format(c.time)
|
return df2.format(c.time)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -55,15 +55,10 @@ fun itemScanValue(value: String, table: Array<String>, field: String): Any {
|
||||||
"more" -> return item.more
|
"more" -> return item.more
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"expeditionPallet" -> {
|
"expeditionPallet" -> {
|
||||||
return item.id
|
return item.id
|
||||||
}
|
}
|
||||||
|
|
||||||
"printer" -> {
|
|
||||||
return item.id
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw Exception("QR no válido")
|
throw Exception("QR no válido")
|
||||||
|
|
|
@ -1,264 +0,0 @@
|
||||||
package es.verdnatura.presentation.composable
|
|
||||||
|
|
||||||
import androidx.compose.foundation.background
|
|
||||||
import androidx.compose.foundation.border
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
|
||||||
import androidx.compose.foundation.layout.Box
|
|
||||||
import androidx.compose.foundation.layout.Column
|
|
||||||
import androidx.compose.foundation.layout.Row
|
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
|
||||||
import androidx.compose.foundation.layout.height
|
|
||||||
import androidx.compose.foundation.layout.padding
|
|
||||||
import androidx.compose.foundation.layout.wrapContentSize
|
|
||||||
import androidx.compose.foundation.lazy.LazyRow
|
|
||||||
import androidx.compose.foundation.lazy.items
|
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
||||||
import androidx.compose.foundation.text.KeyboardActions
|
|
||||||
import androidx.compose.foundation.text.KeyboardOptions
|
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
|
||||||
import androidx.compose.material3.HorizontalDivider
|
|
||||||
import androidx.compose.material3.Icon
|
|
||||||
import androidx.compose.material3.IconButton
|
|
||||||
import androidx.compose.material3.PlainTooltip
|
|
||||||
import androidx.compose.material3.Switch
|
|
||||||
import androidx.compose.material3.Text
|
|
||||||
import androidx.compose.material3.TextField
|
|
||||||
import androidx.compose.material3.TextFieldDefaults
|
|
||||||
import androidx.compose.material3.TooltipBox
|
|
||||||
import androidx.compose.material3.TooltipDefaults
|
|
||||||
import androidx.compose.material3.rememberTooltipState
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.runtime.getValue
|
|
||||||
import androidx.compose.runtime.mutableStateOf
|
|
||||||
import androidx.compose.runtime.remember
|
|
||||||
import androidx.compose.runtime.setValue
|
|
||||||
import androidx.compose.ui.Alignment
|
|
||||||
import androidx.compose.ui.Alignment.Companion.CenterVertically
|
|
||||||
import androidx.compose.ui.Modifier
|
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
|
||||||
import androidx.compose.ui.res.colorResource
|
|
||||||
import androidx.compose.ui.res.dimensionResource
|
|
||||||
import androidx.compose.ui.res.painterResource
|
|
||||||
import androidx.compose.ui.res.stringResource
|
|
||||||
import androidx.compose.ui.text.TextStyle
|
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
|
||||||
import androidx.compose.ui.text.input.ImeAction
|
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import androidx.compose.ui.unit.sp
|
|
||||||
import es.verdnatura.R
|
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
|
||||||
@Composable
|
|
||||||
fun CustomToolbar(
|
|
||||||
title: String,
|
|
||||||
subtitle: String? = null,
|
|
||||||
showBackButton: Boolean = true,
|
|
||||||
showSwitch: Boolean = false,
|
|
||||||
iconList: List<IconToolBar> = emptyList(),
|
|
||||||
onBackClick: () -> Unit = {},
|
|
||||||
onSwitchChange: (Boolean) -> Unit = {},
|
|
||||||
) {
|
|
||||||
Column(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.background(Color.Black)
|
|
||||||
) {
|
|
||||||
|
|
||||||
Row(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.height(56.dp),
|
|
||||||
verticalAlignment = CenterVertically,
|
|
||||||
horizontalArrangement = Arrangement.SpaceBetween
|
|
||||||
|
|
||||||
) {
|
|
||||||
if (showBackButton) {
|
|
||||||
IconButton(
|
|
||||||
onClick = { onBackClick() },
|
|
||||||
modifier = Modifier.padding(start = 0.dp),
|
|
||||||
) {
|
|
||||||
Icon(
|
|
||||||
painter = painterResource(id = R.drawable.ic_chevron_left),
|
|
||||||
contentDescription = "Back",
|
|
||||||
tint = Color.White
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Text(
|
|
||||||
modifier = Modifier.weight(1f),
|
|
||||||
text = title,
|
|
||||||
color = Color.White,
|
|
||||||
fontSize = dimensionResource(id = R.dimen.title).value.sp,
|
|
||||||
fontWeight = FontWeight.Bold,
|
|
||||||
|
|
||||||
)
|
|
||||||
|
|
||||||
if (!subtitle.isNullOrEmpty()) {
|
|
||||||
Text(
|
|
||||||
modifier = Modifier.weight(1f),
|
|
||||||
text = subtitle,
|
|
||||||
color = Color.White.copy(alpha = 0.7f),
|
|
||||||
fontSize = dimensionResource(id = R.dimen.subtitle).value.sp
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (iconList.isNotEmpty()) {
|
|
||||||
LazyRow(
|
|
||||||
horizontalArrangement = Arrangement.End, // Esto asegura que los iconos estén a la derecha
|
|
||||||
) {
|
|
||||||
items(iconList) { iconToolBar ->
|
|
||||||
TooltipBox(
|
|
||||||
positionProvider = TooltipDefaults.rememberPlainTooltipPositionProvider(),
|
|
||||||
tooltip = {
|
|
||||||
PlainTooltip {
|
|
||||||
Text(iconToolBar.toolTip)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
state = rememberTooltipState()
|
|
||||||
) {
|
|
||||||
IconButton(
|
|
||||||
onClick = { iconToolBar.onClickIcon() },
|
|
||||||
) {
|
|
||||||
|
|
||||||
Icon(
|
|
||||||
painter = painterResource(id = iconToolBar.idRes),
|
|
||||||
contentDescription = iconToolBar.toolTip,
|
|
||||||
tint = Color.White
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (showSwitch) {
|
|
||||||
var switchState by remember { mutableStateOf(false) }
|
|
||||||
Switch(
|
|
||||||
checked = switchState,
|
|
||||||
onCheckedChange = {
|
|
||||||
switchState = it
|
|
||||||
onSwitchChange(it)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
HorizontalDivider(
|
|
||||||
thickness = 1.dp,
|
|
||||||
color = colorResource(id = R.color.verdnatura_brown_grey)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
data class IconToolBar(
|
|
||||||
val idRes: Int,
|
|
||||||
val toolTip: String = "",
|
|
||||||
val tint: Color = Color.White,
|
|
||||||
val onClickIcon: () -> Unit,
|
|
||||||
|
|
||||||
)
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun ScanLineTextSearch(
|
|
||||||
value: String,
|
|
||||||
onValueChange: (String) -> Unit,
|
|
||||||
onImeAction: () -> Unit,
|
|
||||||
modifier: Modifier = Modifier.wrapContentSize(),
|
|
||||||
) {
|
|
||||||
|
|
||||||
val keyboardController = LocalSoftwareKeyboardController.current
|
|
||||||
|
|
||||||
Box(
|
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
contentAlignment = Alignment.Center
|
|
||||||
) {
|
|
||||||
TextField(
|
|
||||||
value = value,
|
|
||||||
onValueChange = onValueChange,
|
|
||||||
textStyle = TextStyle(
|
|
||||||
color = Color.White,
|
|
||||||
textAlign = TextAlign.Center
|
|
||||||
),
|
|
||||||
placeholder = {
|
|
||||||
Box(
|
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
contentAlignment = Alignment.Center
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
text = stringResource(id = R.string.Escaneaetiqueta),
|
|
||||||
textAlign = TextAlign.Center,
|
|
||||||
color = Color.White,
|
|
||||||
modifier = Modifier.fillMaxWidth()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
singleLine = true,
|
|
||||||
keyboardActions = KeyboardActions(
|
|
||||||
onDone = {
|
|
||||||
onImeAction()
|
|
||||||
keyboardController?.hide()
|
|
||||||
}
|
|
||||||
|
|
||||||
),
|
|
||||||
keyboardOptions = KeyboardOptions.Default.copy(
|
|
||||||
imeAction = ImeAction.Done
|
|
||||||
),
|
|
||||||
colors = TextFieldDefaults.colors(
|
|
||||||
focusedContainerColor = Color.DarkGray, // Fondo cuando está enfocado
|
|
||||||
unfocusedContainerColor = Color.DarkGray, // Fondo cuando NO está enfocado
|
|
||||||
cursorColor = Color.White, // Color del cursor
|
|
||||||
focusedTextColor = Color.White, // Color del texto cuando está enfocado
|
|
||||||
unfocusedTextColor = Color.White, // Color del texto cuando NO está enfocado
|
|
||||||
focusedPlaceholderColor = Color.Black, // Color del placeholder cuando está enfocado
|
|
||||||
unfocusedPlaceholderColor = Color.Black // Color del placeholder cuando NO está enfocado
|
|
||||||
),
|
|
||||||
modifier = modifier
|
|
||||||
.fillMaxWidth(fraction = 0.67f)
|
|
||||||
.border(2.dp, Color.White, RoundedCornerShape(8.dp))
|
|
||||||
.height(52.dp)
|
|
||||||
/* .onFocusEvent {
|
|
||||||
if (it.isFocused) {
|
|
||||||
keyboardController?.hide()
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Preview
|
|
||||||
@Composable
|
|
||||||
fun PreviewToolbar() {
|
|
||||||
CustomToolbar(
|
|
||||||
title = "Mi Toolbar",
|
|
||||||
subtitle = "10/20",
|
|
||||||
showBackButton = true,
|
|
||||||
showSwitch = true,
|
|
||||||
iconList = listOf(
|
|
||||||
IconToolBar(
|
|
||||||
R.drawable.ic_parking_ui, "", tint = Color.Blue,
|
|
||||||
onClickIcon = { }
|
|
||||||
)
|
|
||||||
),
|
|
||||||
onBackClick = { /* Acción de volver atrás */ },
|
|
||||||
onSwitchChange = { /* Acción del switch */ }
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Preview
|
|
||||||
@Composable
|
|
||||||
fun PreviewScanLineTextSearch() {
|
|
||||||
ScanLineTextSearch(
|
|
||||||
value = stringResource(R.string.scanLabel),
|
|
||||||
onValueChange = {},
|
|
||||||
onImeAction = {})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
package es.verdnatura.presentation.composable
|
|
||||||
|
|
||||||
import android.os.Bundle
|
|
||||||
import androidx.activity.ComponentActivity
|
|
||||||
import androidx.activity.compose.setContent
|
|
||||||
import es.verdnatura.R
|
|
||||||
|
|
||||||
class ImageViewActivityComposable : ComponentActivity() {
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
|
||||||
super.onCreate(savedInstanceState)
|
|
||||||
setContent {
|
|
||||||
val imageUrl = intent.getStringExtra(getString(R.string.url)) ?: ""
|
|
||||||
val title = intent.getStringExtra(getString(R.string.title)) ?: ""
|
|
||||||
ImageViewScreen(imageUrl = imageUrl, titleToolBar = title, onBackClick = { finish() })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,59 +0,0 @@
|
||||||
package es.verdnatura.presentation.composable
|
|
||||||
|
|
||||||
import android.widget.ImageView
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
|
||||||
import androidx.compose.foundation.layout.Column
|
|
||||||
import androidx.compose.foundation.layout.Spacer
|
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
|
||||||
import androidx.compose.foundation.layout.height
|
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.ui.Alignment
|
|
||||||
import androidx.compose.ui.Modifier
|
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import com.bumptech.glide.Glide
|
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
|
||||||
@Composable
|
|
||||||
fun ImageViewScreen(imageUrl: String, titleToolBar:String ="",onBackClick: () -> Unit ) {
|
|
||||||
|
|
||||||
CustomToolbar(
|
|
||||||
title = titleToolBar,
|
|
||||||
subtitle = "",
|
|
||||||
showBackButton = true,
|
|
||||||
showSwitch = false,
|
|
||||||
iconList = listOf(),
|
|
||||||
onBackClick = onBackClick ,
|
|
||||||
onSwitchChange = { }
|
|
||||||
)
|
|
||||||
Column(
|
|
||||||
modifier = Modifier.fillMaxSize(),
|
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
|
||||||
verticalArrangement = Arrangement.Top
|
|
||||||
) {
|
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
|
||||||
GlideImage(imageUrl = imageUrl)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun GlideImage(imageUrl: String) {
|
|
||||||
androidx.compose.ui.viewinterop.AndroidView(
|
|
||||||
factory = { context ->
|
|
||||||
ImageView(context).apply {
|
|
||||||
Glide.with(context)
|
|
||||||
.load(imageUrl)
|
|
||||||
.into(this)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
modifier = Modifier.fillMaxSize()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Preview(showBackground = true)
|
|
||||||
@Composable
|
|
||||||
fun DefaultPreview() {
|
|
||||||
ImageViewScreen(imageUrl = "https://example.com/image.jpg", "titleToolbar") {}
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
package es.verdnatura.presentation.composable
|
|
||||||
|
|
||||||
import androidx.compose.animation.AnimatedVisibility
|
|
||||||
import androidx.compose.animation.fadeIn
|
|
||||||
import androidx.compose.animation.fadeOut
|
|
||||||
import androidx.compose.foundation.layout.height
|
|
||||||
import androidx.compose.foundation.layout.wrapContentWidth
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.runtime.getValue
|
|
||||||
import androidx.compose.ui.Modifier
|
|
||||||
import androidx.compose.ui.res.dimensionResource
|
|
||||||
import com.airbnb.lottie.compose.LottieAnimation
|
|
||||||
import com.airbnb.lottie.compose.LottieCompositionSpec
|
|
||||||
import com.airbnb.lottie.compose.LottieConstants
|
|
||||||
import com.airbnb.lottie.compose.rememberLottieComposition
|
|
||||||
import es.verdnatura.R
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun LottieLoadingAnimation(isVisible: Boolean = true) {
|
|
||||||
AnimatedVisibility(
|
|
||||||
visible = isVisible,
|
|
||||||
enter = fadeIn(),
|
|
||||||
exit = fadeOut()
|
|
||||||
) {
|
|
||||||
val composition by rememberLottieComposition(
|
|
||||||
spec = LottieCompositionSpec.RawRes(R.raw.orange_loading)
|
|
||||||
)
|
|
||||||
|
|
||||||
LottieAnimation(
|
|
||||||
composition = composition,
|
|
||||||
iterations = LottieConstants.IterateForever,
|
|
||||||
speed = 2f,
|
|
||||||
modifier = Modifier
|
|
||||||
.wrapContentWidth()
|
|
||||||
.height(dimensionResource(id = R.dimen.verdnatura_logo_large_height))
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,72 +0,0 @@
|
||||||
package es.verdnatura.presentation.composable.ui
|
|
||||||
|
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
|
|
||||||
object VerdnaturaColors {
|
|
||||||
|
|
||||||
val OrangeSalix = Color(0xFFEC8916)
|
|
||||||
val BlackCustomDialog = Color(0xFF1A1A1A)
|
|
||||||
val BlackTextInput = Color(0xFF666666)
|
|
||||||
val White = Color(0xFFFFFFFF)
|
|
||||||
|
|
||||||
// Colores principales
|
|
||||||
val ColorPrimary = Color(0xFFF7931E)
|
|
||||||
val ColorPrimaryDark = Color(0xFF8B4200)
|
|
||||||
|
|
||||||
// Negros
|
|
||||||
/* val Black = Color(0xFF000000)
|
|
||||||
val Black1 = Color(0xFF1D1D1D)
|
|
||||||
val Black2 = Color(0xFF171717)
|
|
||||||
val Black3 = Color(0xFF292929)
|
|
||||||
val Black4 = Color(0xFF242424)
|
|
||||||
val Black5 = Color(0xFF323232)
|
|
||||||
val Black6 = Color(0xFF333333)
|
|
||||||
val Black7 = Color(0xFF282828)
|
|
||||||
val Black8 = Color(0xFF1A1A1A)
|
|
||||||
val BlackCustomDialog = Color(0xFF464446)
|
|
||||||
val Black8Alpha6 = Color(0x991A1A1A) // Con transparencia
|
|
||||||
|
|
||||||
// Grises
|
|
||||||
val WarmGrey = Color(0xFF707070)
|
|
||||||
val BrownGrey = Color(0xFF8F8F8F)
|
|
||||||
val BrownGreyLight = Color(0xFFB8ADAD)
|
|
||||||
|
|
||||||
// Colores vivos
|
|
||||||
val Red = Color(0xFFE74C3C)
|
|
||||||
val WarmBrown = Color(0xFF8B4200)
|
|
||||||
val PumpkinOrange = Color(0xFFF7931E)
|
|
||||||
val PumpkinLight = Color(0xFFF77956)
|
|
||||||
val PinkSalix = Color(0xFFFF99CC)
|
|
||||||
val SunflowerYellow = Color(0xFFFFD400)
|
|
||||||
val DarkSkyBlue = Color(0xFF4AB4E6)
|
|
||||||
val DarkGreenVerdnatura = Color(0xFFA3D131)
|
|
||||||
val DarkMint = Color(0xFF50BE87)
|
|
||||||
val DarkMintLight = Color(0xFF80BE87)
|
|
||||||
val DarkMintLightPrecontrolled = Color(0xFFB8DABA)
|
|
||||||
val LightTeal = Color(0xFFB8ECD6)
|
|
||||||
val White = Color(0xFFFFFFFF)
|
|
||||||
val RedSalix = Color(0xFFFB5252)
|
|
||||||
val OrangeSalix = Color(0xFFEC8916)
|
|
||||||
|
|
||||||
// Fondos
|
|
||||||
val BackgroundItemPicker = Color(0xFF4D4D4D)
|
|
||||||
val BackgroundSubtitleSettings = Color(0xFF1A1A1A)
|
|
||||||
val BackgroundItemsMenus = Color(0xFF333333)
|
|
||||||
|
|
||||||
// Colores SALIX
|
|
||||||
val SalixSuccessLight = Color(0xFFA3D131)
|
|
||||||
val ColorHeader = Color(0xFF3D3D3D)
|
|
||||||
val ColorMenuHeader = Color(0xFF3D3D3D)
|
|
||||||
val ColorBg = Color(0xFF222222)
|
|
||||||
val ColorBgDark = Color(0xFF222222)
|
|
||||||
val ColorActive = Color(0xFF666666)
|
|
||||||
val ColorActiveFont = Color(0xFFFFFFFF)
|
|
||||||
val ColorBgPanel = Color(0xFF3C3B3B)
|
|
||||||
val ColorMain = ColorPrimary
|
|
||||||
val ColorMarginal = Color(0xFF222222)
|
|
||||||
val ColorSuccess = Color(0xFFA3D131)
|
|
||||||
val ColorNotice = Color(0xFF32B1CE)
|
|
||||||
val ColorAlert = Color(0xFFFA3939)
|
|
||||||
val ColorPink = Color(0xFFFF99CC)
|
|
||||||
val ColorYellow = Color(0xFFFFFF00)*/
|
|
||||||
}
|
|
|
@ -1,168 +0,0 @@
|
||||||
package es.verdnatura.presentation.composable.ui
|
|
||||||
|
|
||||||
import androidx.compose.foundation.background
|
|
||||||
import androidx.compose.foundation.border
|
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
|
||||||
import androidx.compose.foundation.layout.height
|
|
||||||
import androidx.compose.foundation.layout.padding
|
|
||||||
import androidx.compose.foundation.text.KeyboardActions
|
|
||||||
import androidx.compose.foundation.text.KeyboardOptions
|
|
||||||
import androidx.compose.material3.Button
|
|
||||||
import androidx.compose.material3.ButtonDefaults
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
|
||||||
import androidx.compose.material3.Text
|
|
||||||
import androidx.compose.material3.TextField
|
|
||||||
import androidx.compose.material3.TextFieldDefaults
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
|
||||||
import androidx.compose.runtime.mutableStateOf
|
|
||||||
import androidx.compose.runtime.remember
|
|
||||||
import androidx.compose.ui.Modifier
|
|
||||||
import androidx.compose.ui.focus.FocusRequester
|
|
||||||
import androidx.compose.ui.focus.focusRequester
|
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
|
||||||
import androidx.compose.ui.text.input.ImeAction
|
|
||||||
import androidx.compose.ui.text.input.KeyboardType
|
|
||||||
import androidx.compose.ui.text.input.TextFieldValue
|
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import androidx.compose.ui.unit.sp
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun DefaultButtonCustomDialog(
|
|
||||||
text: String,
|
|
||||||
onClick: () -> Unit = {},
|
|
||||||
enabled: Boolean = true,
|
|
||||||
leadingIcon: @Composable (() -> Unit)? = null
|
|
||||||
) {
|
|
||||||
Button(
|
|
||||||
modifier = Modifier.fillMaxWidth(),
|
|
||||||
onClick = onClick,
|
|
||||||
enabled = enabled,
|
|
||||||
contentPadding = PaddingValues(
|
|
||||||
start = if (leadingIcon == null) 16.dp else 8.dp,
|
|
||||||
end = 16.dp
|
|
||||||
),
|
|
||||||
shape = MaterialTheme.shapes.small,
|
|
||||||
colors = ButtonDefaults.buttonColors(
|
|
||||||
containerColor = VerdnaturaColors.ColorPrimary,
|
|
||||||
contentColor = VerdnaturaColors.White
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
if (leadingIcon != null) {
|
|
||||||
leadingIcon()
|
|
||||||
}
|
|
||||||
|
|
||||||
Text(
|
|
||||||
text = text.uppercase(),
|
|
||||||
fontSize = 14.sp,
|
|
||||||
fontWeight = FontWeight.Bold,
|
|
||||||
textAlign = TextAlign.Center,
|
|
||||||
maxLines = 1,
|
|
||||||
overflow = TextOverflow.Ellipsis
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun TitleTextCustomDialog(
|
|
||||||
title: String,
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
text = title,
|
|
||||||
style = MaterialTheme.typography.titleLarge.copy(
|
|
||||||
fontWeight = FontWeight.Bold
|
|
||||||
),
|
|
||||||
color = VerdnaturaColors.White,
|
|
||||||
textAlign = TextAlign.Center,
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(bottom = 8.dp)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun DescriptionTextCustomDialog(
|
|
||||||
description: String,
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
text = description,
|
|
||||||
color = VerdnaturaColors.White,
|
|
||||||
style = MaterialTheme.typography.bodyLarge,
|
|
||||||
modifier = Modifier.padding(bottom = 8.dp)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun ScanTextCustomDialog(
|
|
||||||
value: TextFieldValue,
|
|
||||||
onValueChange: (TextFieldValue) -> Unit,
|
|
||||||
hint: String,
|
|
||||||
onEnterPressed: (String) -> Unit = {},
|
|
||||||
focusRequester: FocusRequester
|
|
||||||
) {
|
|
||||||
val keyboardController = LocalSoftwareKeyboardController.current
|
|
||||||
|
|
||||||
TextField(
|
|
||||||
value = value,
|
|
||||||
onValueChange = onValueChange,
|
|
||||||
label = {
|
|
||||||
Text(
|
|
||||||
text = hint,
|
|
||||||
textAlign = TextAlign.Center,
|
|
||||||
color = Color.White,
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(horizontal = 16.dp),
|
|
||||||
)
|
|
||||||
},
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.focusRequester(focusRequester)
|
|
||||||
.border(1.dp, Color.White, shape = MaterialTheme.shapes.small)
|
|
||||||
.background(Color.Transparent)
|
|
||||||
.height(VerdnaturaDimens.minHeight),
|
|
||||||
textStyle = CustomTextStyle,
|
|
||||||
keyboardOptions =
|
|
||||||
KeyboardOptions.Default.copy(
|
|
||||||
imeAction = ImeAction.Done,
|
|
||||||
keyboardType = KeyboardType.Number
|
|
||||||
),
|
|
||||||
singleLine = true,
|
|
||||||
keyboardActions = KeyboardActions(
|
|
||||||
onDone = {
|
|
||||||
onEnterPressed(value.text)
|
|
||||||
onValueChange(TextFieldValue(""))
|
|
||||||
keyboardController?.hide()
|
|
||||||
}
|
|
||||||
),
|
|
||||||
colors = TextFieldDefaults.colors(
|
|
||||||
focusedContainerColor = Color.Transparent,
|
|
||||||
unfocusedContainerColor = Color.Transparent,
|
|
||||||
focusedTextColor = VerdnaturaColors.White,
|
|
||||||
unfocusedTextColor = VerdnaturaColors.White
|
|
||||||
)
|
|
||||||
)
|
|
||||||
LaunchedEffect(Unit) {
|
|
||||||
focusRequester.requestFocus()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Preview(showBackground = true)
|
|
||||||
@Composable
|
|
||||||
fun PreviewCustomTextField() {
|
|
||||||
val sampleText = remember { mutableStateOf(TextFieldValue("Texto de ejemplo")) }
|
|
||||||
val focusRequester = remember { FocusRequester() }
|
|
||||||
ScanTextCustomDialog(
|
|
||||||
value = sampleText.value,
|
|
||||||
onValueChange = { sampleText.value = it },
|
|
||||||
hint = "Escribe algo...",
|
|
||||||
onEnterPressed = { text -> println("Texto ingresado: $text") },
|
|
||||||
focusRequester = focusRequester
|
|
||||||
)
|
|
||||||
}
|
|
|
@ -1,23 +0,0 @@
|
||||||
package es.verdnatura.presentation.composable.ui
|
|
||||||
|
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import androidx.compose.ui.unit.sp
|
|
||||||
|
|
||||||
object VerdnaturaDimens {
|
|
||||||
|
|
||||||
/* val h1 = 96.sp
|
|
||||||
val h2 = 60.sp
|
|
||||||
val h3 = 48.sp
|
|
||||||
val h4 = 34.sp
|
|
||||||
val h5 = 24.sp
|
|
||||||
val h6 = 20.sp
|
|
||||||
val h7 = 18.sp
|
|
||||||
val h9 = 14.sp*/
|
|
||||||
|
|
||||||
// Text sizes
|
|
||||||
val fontSizeCustomDialogs = 16.sp
|
|
||||||
|
|
||||||
// Height Scan Text
|
|
||||||
val minHeight = 48.dp
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,10 +0,0 @@
|
||||||
package es.verdnatura.presentation.composable.ui
|
|
||||||
|
|
||||||
import androidx.compose.ui.text.TextStyle
|
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
|
||||||
|
|
||||||
val CustomTextStyle = TextStyle(
|
|
||||||
color = VerdnaturaColors.White,
|
|
||||||
fontSize = VerdnaturaDimens.fontSizeCustomDialogs,
|
|
||||||
textAlign = TextAlign.Center
|
|
||||||
)
|
|
|
@ -16,8 +16,7 @@ import es.verdnatura.domain.toast
|
||||||
class SearchableAdapter(
|
class SearchableAdapter(
|
||||||
private var listElements: MutableList<NameWithId>,
|
private var listElements: MutableList<NameWithId>,
|
||||||
private var context: Context,
|
private var context: Context,
|
||||||
private val listColorElements: List<Int> = listOf(),
|
private val onItemClick: (NameWithId) -> Unit,
|
||||||
private val onItemClick: (NameWithId) -> Unit
|
|
||||||
) : RecyclerView.Adapter<SearchableAdapter.NameViewHolder>() {
|
) : RecyclerView.Adapter<SearchableAdapter.NameViewHolder>() {
|
||||||
|
|
||||||
private var listElementsFiltered = listElements.toMutableList()
|
private var listElementsFiltered = listElements.toMutableList()
|
||||||
|
@ -49,13 +48,6 @@ class SearchableAdapter(
|
||||||
} catch (ex: Exception) {
|
} catch (ex: Exception) {
|
||||||
ex.message?.toast(context)
|
ex.message?.toast(context)
|
||||||
}
|
}
|
||||||
if (listColorElements.isNotEmpty()) {
|
|
||||||
if (nameWithId.id in listColorElements) {
|
|
||||||
nameText.setTextColor(Color.BLACK)
|
|
||||||
} else {
|
|
||||||
nameText.setTextColor(Color.GRAY)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
package es.verdnatura.presentation.view.commom.webview
|
package es.verdnatura.presentation.view.commom
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
|
import android.content.Context
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.print.PrintAttributes
|
||||||
|
import android.print.PrintManager
|
||||||
|
import android.view.GestureDetector
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.MotionEvent
|
import android.view.MotionEvent
|
||||||
import android.view.VelocityTracker
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.webkit.WebChromeClient
|
import android.webkit.WebChromeClient
|
||||||
|
@ -15,13 +18,12 @@ import android.webkit.WebViewClient
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import androidx.activity.OnBackPressedCallback
|
import androidx.activity.OnBackPressedCallback
|
||||||
import androidx.activity.OnBackPressedDispatcher
|
import androidx.activity.OnBackPressedDispatcher
|
||||||
|
import androidx.core.view.GestureDetectorCompat
|
||||||
import androidx.databinding.DataBindingUtil
|
import androidx.databinding.DataBindingUtil
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentWebBinding
|
import es.verdnatura.databinding.FragmentWebBinding
|
||||||
import es.verdnatura.domain.ConstAndValues.FLINGTHRESHOLDVELOCITY
|
|
||||||
import es.verdnatura.domain.ConstAndValues.FLINGTHRESHOLDVERTICAL
|
|
||||||
import es.verdnatura.presentation.common.OnBackPressedListener
|
import es.verdnatura.presentation.common.OnBackPressedListener
|
||||||
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
||||||
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
||||||
|
@ -30,14 +32,15 @@ import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
|
|
||||||
|
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||||
class WebFragment(
|
class WebFragment(
|
||||||
var entryPoint: String = ""
|
var entryPoint: String = ""
|
||||||
) : Fragment(), OnBackPressedListener {
|
) : Fragment(), OnBackPressedListener {
|
||||||
|
private lateinit var gestureDetector: GestureDetectorCompat
|
||||||
fun getLayoutId(): Int = R.layout.fragment_web
|
fun getLayoutId(): Int = R.layout.fragment_web
|
||||||
private lateinit var customDialog: CustomDialog
|
private lateinit var customDialog: CustomDialog
|
||||||
private lateinit var backDispatcher: OnBackPressedDispatcher
|
private lateinit var backDispatcher: OnBackPressedDispatcher
|
||||||
private lateinit var binding: FragmentWebBinding
|
private lateinit var binding: FragmentWebBinding
|
||||||
private var velocityTracker: VelocityTracker? = null
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun newInstance(entryPoint: String) = WebFragment(entryPoint)
|
fun newInstance(entryPoint: String) = WebFragment(entryPoint)
|
||||||
|
@ -47,11 +50,12 @@ class WebFragment(
|
||||||
customDialog = CustomDialog(requireContext())
|
customDialog = CustomDialog(requireContext())
|
||||||
setToolbar()
|
setToolbar()
|
||||||
setWeb()
|
setWeb()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||||
): View {
|
): View? {
|
||||||
binding = DataBindingUtil.inflate(inflater, R.layout.fragment_web, container, false)
|
binding = DataBindingUtil.inflate(inflater, R.layout.fragment_web, container, false)
|
||||||
binding.lifecycleOwner = this
|
binding.lifecycleOwner = this
|
||||||
return binding.root
|
return binding.root
|
||||||
|
@ -59,6 +63,7 @@ class WebFragment(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
requireActivity().onBackPressedDispatcher.addCallback(viewLifecycleOwner,
|
requireActivity().onBackPressedDispatcher.addCallback(viewLifecycleOwner,
|
||||||
|
@ -71,104 +76,132 @@ class WebFragment(
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
init()
|
gestureDetector = GestureDetectorCompat(requireActivity(),
|
||||||
|
object : GestureDetector.SimpleOnGestureListener() {
|
||||||
|
override fun onFling(
|
||||||
|
e1: MotionEvent?, e2: MotionEvent, velocityX: Float, velocityY: Float
|
||||||
|
): Boolean {
|
||||||
|
val deltaX = (e2.x - e1?.x!!)
|
||||||
|
val deltaY = (e2.y - e1.y)
|
||||||
|
val deltaAbsX = abs(deltaX)
|
||||||
|
val deltaAbsY = abs(deltaY)
|
||||||
|
if (deltaAbsX > deltaAbsY) {
|
||||||
|
if (velocityX > 2000 && velocityY < 500 && velocityY >= 0) {
|
||||||
|
|
||||||
|
binding.webView.goBack()
|
||||||
|
return true
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
init()
|
||||||
|
super.onViewCreated(view, savedInstanceState)
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("ClickableViewAccessibility", "javaScriptEnabled")
|
@SuppressLint("ClickableViewAccessibility", "SetJavaScriptEnabled")
|
||||||
private fun setWeb() {
|
private fun setWeb() {
|
||||||
binding.webView.apply {
|
|
||||||
webChromeClient = WebChromeClient()
|
|
||||||
|
|
||||||
settings.apply {
|
binding.webView.webChromeClient = WebChromeClient(
|
||||||
javaScriptEnabled = true
|
|
||||||
domStorageEnabled = true
|
|
||||||
loadWithOverviewMode = true
|
|
||||||
useWideViewPort = true
|
|
||||||
builtInZoomControls = true
|
|
||||||
displayZoomControls = false
|
|
||||||
setSupportZoom(true)
|
|
||||||
allowFileAccess = true
|
|
||||||
}
|
|
||||||
|
|
||||||
setOnTouchListener { _, event ->
|
)
|
||||||
when (event.actionMasked) {
|
|
||||||
MotionEvent.ACTION_DOWN -> {
|
|
||||||
velocityTracker?.clear()
|
|
||||||
velocityTracker = velocityTracker ?: VelocityTracker.obtain()
|
|
||||||
velocityTracker?.addMovement(event)
|
|
||||||
}
|
|
||||||
|
|
||||||
MotionEvent.ACTION_MOVE -> {
|
val webSettings = binding.webView.settings
|
||||||
velocityTracker?.addMovement(event)
|
webSettings.javaScriptEnabled = true
|
||||||
}
|
webSettings.domStorageEnabled = true
|
||||||
|
webSettings.loadWithOverviewMode = true
|
||||||
|
webSettings.useWideViewPort = true
|
||||||
|
webSettings.builtInZoomControls = true
|
||||||
|
webSettings.displayZoomControls = false
|
||||||
|
webSettings.setSupportZoom(true)
|
||||||
|
webSettings.allowFileAccess = true
|
||||||
|
|
||||||
MotionEvent.ACTION_UP -> {
|
binding.webView.setOnTouchListener { v, event ->
|
||||||
velocityTracker?.let { tracker ->
|
gestureDetector.onTouchEvent(event)
|
||||||
tracker.computeCurrentVelocity(1000) // velocidad en píxeles por segundo
|
}
|
||||||
val velocityX = tracker.xVelocity
|
binding.webView.webViewClient = object : WebViewClient() {
|
||||||
val velocityY = abs(tracker.yVelocity)
|
override fun shouldOverrideUrlLoading(
|
||||||
|
view: WebView?, request: WebResourceRequest?
|
||||||
if (velocityX > FLINGTHRESHOLDVELOCITY &&
|
): Boolean {
|
||||||
velocityY < FLINGTHRESHOLDVERTICAL
|
binding.webView.loadUrl(request?.url.toString())
|
||||||
) {
|
return true
|
||||||
binding.webView.goBack()
|
|
||||||
return@setOnTouchListener true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MotionEvent.ACTION_CANCEL -> {
|
|
||||||
velocityTracker?.recycle()
|
|
||||||
velocityTracker = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
webViewClient = object : WebViewClient() {
|
|
||||||
override fun shouldOverrideUrlLoading(
|
|
||||||
view: WebView?,
|
|
||||||
request: WebResourceRequest?
|
|
||||||
): Boolean {
|
|
||||||
request?.url?.toString()?.let { loadUrl(it) }
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val dataScanned = JSONObject(entryPoint)
|
val dataScanned = JSONObject(entryPoint)
|
||||||
binding.webView.loadUrl(dataScanned.get("web").toString())
|
|
||||||
|
if (dataScanned.toString().contains("cmr?")) {
|
||||||
|
val pdfUrl = "${dataScanned.get("web")}"
|
||||||
|
val googleDocsViewerUrl = "https://docs.google.com/gview?embedded=true&url=$pdfUrl"
|
||||||
|
binding.webView.loadUrl(googleDocsViewerUrl)
|
||||||
|
} else {
|
||||||
|
binding.webView.loadUrl(dataScanned.get("web").toString())
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setToolbar() {
|
private fun setToolbar() {
|
||||||
|
|
||||||
binding.mainToolbar.toolbarTitle.text = buildString {
|
binding.mainToolbar.toolbarTitle.text = buildString {
|
||||||
append(getString(R.string.item))
|
append(getString(R.string.item))
|
||||||
append(JSONObject(entryPoint).get("entryPoint").toString())
|
append(JSONObject(entryPoint).get("entryPoint").toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
val listIcons: ArrayList<ImageView> = ArrayList()
|
val listIcons: ArrayList<ImageView> = ArrayList()
|
||||||
|
val iconPrint = ImageView(context)
|
||||||
|
iconPrint.setImageResource(R.drawable.ic_print_black_24dp)
|
||||||
|
iconPrint.tooltipText = getString(R.string.print)
|
||||||
|
|
||||||
|
//listIcons.add(iconPrint)
|
||||||
|
|
||||||
binding.mainToolbar.toolbarIcons.adapter =
|
binding.mainToolbar.toolbarIcons.adapter =
|
||||||
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
|
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
|
||||||
override fun onOptionsItemSelected(item: Drawable) {
|
override fun onOptionsItemSelected(item: Drawable) {
|
||||||
|
|
||||||
|
when (item) {
|
||||||
|
iconPrint.drawable -> createWebPrintJob(binding.webView)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
binding.mainToolbar.toolbarIcons.layoutManager =
|
binding.mainToolbar.toolbarIcons.layoutManager =
|
||||||
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun createWebPrintJob(webView: WebView) {
|
||||||
|
|
||||||
|
// Get a PrintManager instance
|
||||||
|
(activity?.getSystemService(Context.PRINT_SERVICE) as? PrintManager)?.let { printManager ->
|
||||||
|
|
||||||
|
val jobName = "${getString(R.string.app_name)} Document"
|
||||||
|
|
||||||
|
// Get a print adapter instance
|
||||||
|
val printAdapter = webView.createPrintDocumentAdapter(jobName)
|
||||||
|
|
||||||
|
// Create a print job with name and adapter instance
|
||||||
|
printManager.print(
|
||||||
|
jobName, printAdapter, PrintAttributes.Builder().build()
|
||||||
|
).also { printJob ->
|
||||||
|
println("job printed")
|
||||||
|
// Save the job object for later status checking
|
||||||
|
// printJobs += printJob
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBackPressedHandled(): Boolean {
|
override fun onBackPressedHandled(): Boolean {
|
||||||
|
|
||||||
if (binding.webView.canGoBack()) {
|
if (binding.webView.canGoBack()) {
|
||||||
binding.webView.goBack()
|
binding.webView.goBack()
|
||||||
} else {
|
} else {
|
||||||
(context as MainActivity).onMyBackPressed()
|
(context as MainActivity).onMyBackPressed()
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
|
||||||
super.onDestroy()
|
|
||||||
velocityTracker?.recycle()
|
|
||||||
velocityTracker = null
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,180 +0,0 @@
|
||||||
package es.verdnatura.presentation.view.commom.webview
|
|
||||||
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.MotionEvent
|
|
||||||
import android.view.VelocityTracker
|
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import android.webkit.WebResourceRequest
|
|
||||||
import android.webkit.WebView
|
|
||||||
import android.webkit.WebViewClient
|
|
||||||
import androidx.activity.OnBackPressedCallback
|
|
||||||
import androidx.activity.OnBackPressedDispatcher
|
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
|
||||||
import androidx.compose.runtime.getValue
|
|
||||||
import androidx.compose.ui.platform.ComposeView
|
|
||||||
import androidx.fragment.app.Fragment
|
|
||||||
import androidx.fragment.app.viewModels
|
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
|
||||||
import es.verdnatura.presentation.common.OnBackPressedListener
|
|
||||||
import es.verdnatura.presentation.view.commom.webview.data.WebViewEvent
|
|
||||||
import es.verdnatura.presentation.view.commom.webview.data.WebViewScreen
|
|
||||||
import org.json.JSONObject
|
|
||||||
import kotlin.math.abs
|
|
||||||
|
|
||||||
class WebFragmentCompose(
|
|
||||||
var entryPoint: String = ""
|
|
||||||
) : Fragment(), OnBackPressedListener {
|
|
||||||
private val viewModel: WebViewViewModel by viewModels()
|
|
||||||
private var velocityTracker: VelocityTracker? = null
|
|
||||||
private lateinit var backDispatcher: OnBackPressedDispatcher
|
|
||||||
private var webView: WebView? = null
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private const val FLING_THRESHOLD_VELOCITY = 2000
|
|
||||||
private const val FLING_THRESHOLD_VERTICAL = 1000
|
|
||||||
fun newInstance(entryPoint: String) = WebFragmentCompose(entryPoint)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreateView(
|
|
||||||
inflater: LayoutInflater,
|
|
||||||
container: ViewGroup?,
|
|
||||||
savedInstanceState: Bundle?
|
|
||||||
): View {
|
|
||||||
return ComposeView(requireContext()).apply {
|
|
||||||
setContent {
|
|
||||||
val state by viewModel.state.collectAsStateWithLifecycle()
|
|
||||||
|
|
||||||
// Recolectar acciones del ViewModel
|
|
||||||
LaunchedEffect(Unit) {
|
|
||||||
viewModel.webViewActions.collect { event ->
|
|
||||||
when (event) {
|
|
||||||
is WebViewEvent.OnBackGesture -> {
|
|
||||||
webView?.goBack()
|
|
||||||
}
|
|
||||||
// Manejar otros eventos si es necesario
|
|
||||||
is WebViewEvent.LoadUrl -> println("")
|
|
||||||
is WebViewEvent.OnPageFinished -> println("")
|
|
||||||
is WebViewEvent.OnUrlLoading -> println("")
|
|
||||||
is WebViewEvent.ToggleToolbar -> println("")
|
|
||||||
is WebViewEvent.UpdateTitle -> println("")
|
|
||||||
else -> {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
WebViewScreen(
|
|
||||||
state = state,
|
|
||||||
onWebViewCreated = { webView ->
|
|
||||||
this@WebFragmentCompose.webView = webView
|
|
||||||
setupWebView(webView)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setupWebView(webView: WebView) {
|
|
||||||
webView.webViewClient = object : WebViewClient() {
|
|
||||||
override fun shouldOverrideUrlLoading(
|
|
||||||
view: WebView?,
|
|
||||||
request: WebResourceRequest?
|
|
||||||
): Boolean {
|
|
||||||
request?.url?.toString()?.let {
|
|
||||||
viewModel.processEvent(WebViewEvent.OnUrlLoading(it))
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPageFinished(view: WebView?, url: String?) {
|
|
||||||
super.onPageFinished(view, url)
|
|
||||||
viewModel.processEvent(WebViewEvent.OnPageFinished(url ?: ""))
|
|
||||||
viewModel.processEvent(WebViewEvent.UpdateTitle(webView.title ?: ""))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
webView.setOnTouchListener { _, event ->
|
|
||||||
handleTouchEvent(event)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cargar URL inicial si existe
|
|
||||||
// if (state.value.initialUrl.isNotEmpty()) {
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun handleTouchEvent(event: MotionEvent): Boolean {
|
|
||||||
when (event.actionMasked) {
|
|
||||||
MotionEvent.ACTION_DOWN -> {
|
|
||||||
velocityTracker?.clear()
|
|
||||||
velocityTracker = velocityTracker ?: VelocityTracker.obtain()
|
|
||||||
velocityTracker?.addMovement(event)
|
|
||||||
}
|
|
||||||
|
|
||||||
MotionEvent.ACTION_MOVE -> {
|
|
||||||
velocityTracker?.addMovement(event)
|
|
||||||
}
|
|
||||||
|
|
||||||
MotionEvent.ACTION_UP -> {
|
|
||||||
velocityTracker?.let { tracker ->
|
|
||||||
tracker.computeCurrentVelocity(1000)
|
|
||||||
val velocityX = tracker.xVelocity
|
|
||||||
val velocityY = abs(tracker.yVelocity)
|
|
||||||
|
|
||||||
if (velocityX > FLING_THRESHOLD_VELOCITY &&
|
|
||||||
velocityY < FLING_THRESHOLD_VERTICAL &&
|
|
||||||
webView?.canGoBack() == true
|
|
||||||
) {
|
|
||||||
viewModel.processEvent(WebViewEvent.OnBackGesture)
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MotionEvent.ACTION_CANCEL -> {
|
|
||||||
velocityTracker?.recycle()
|
|
||||||
velocityTracker = null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
||||||
super.onViewCreated(view, savedInstanceState)
|
|
||||||
|
|
||||||
requireActivity().onBackPressedDispatcher.addCallback(viewLifecycleOwner,
|
|
||||||
object : OnBackPressedCallback(true) {
|
|
||||||
override fun handleOnBackPressed() {
|
|
||||||
if (!onBackPressedHandled()) {
|
|
||||||
isEnabled = false
|
|
||||||
requireActivity().onBackPressedDispatcher
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
val dataScanned = JSONObject(entryPoint)
|
|
||||||
viewModel.setInitialUrl(dataScanned.get("web").toString())
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDestroy() {
|
|
||||||
super.onDestroy()
|
|
||||||
velocityTracker?.recycle()
|
|
||||||
velocityTracker = null
|
|
||||||
webView = null
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onBackPressedHandled(): Boolean {
|
|
||||||
|
|
||||||
viewModel.processEvent(WebViewEvent.OnBackGesture)
|
|
||||||
|
|
||||||
/* if (webView!!.canGoBack()) {
|
|
||||||
webView!!.goBack()
|
|
||||||
} else {
|
|
||||||
(context as MainActivity).onMyBackPressed()
|
|
||||||
}*/
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,64 +0,0 @@
|
||||||
package es.verdnatura.presentation.view.commom.webview
|
|
||||||
|
|
||||||
import androidx.lifecycle.ViewModel
|
|
||||||
import androidx.lifecycle.viewModelScope
|
|
||||||
import es.verdnatura.presentation.view.commom.webview.data.WebViewEvent
|
|
||||||
import es.verdnatura.presentation.view.commom.webview.data.WebViewState
|
|
||||||
import kotlinx.coroutines.channels.Channel
|
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
|
||||||
import kotlinx.coroutines.flow.asStateFlow
|
|
||||||
import kotlinx.coroutines.flow.receiveAsFlow
|
|
||||||
import kotlinx.coroutines.flow.update
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
|
|
||||||
class WebViewViewModel : ViewModel() {
|
|
||||||
private val _state = MutableStateFlow(WebViewState())
|
|
||||||
val state = _state.asStateFlow()
|
|
||||||
|
|
||||||
private val _webViewActions = Channel<WebViewEvent>()
|
|
||||||
val webViewActions = _webViewActions.receiveAsFlow()
|
|
||||||
|
|
||||||
fun processEvent(event: WebViewEvent) {
|
|
||||||
when (event) {
|
|
||||||
is WebViewEvent.LoadUrl -> {
|
|
||||||
_state.update { it.copy(url = event.url, isLoading = true) }
|
|
||||||
viewModelScope.launch {
|
|
||||||
_webViewActions.send(event)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
is WebViewEvent.UpdateTitle -> {
|
|
||||||
_state.update { it.copy(title = event.title) }
|
|
||||||
}
|
|
||||||
|
|
||||||
is WebViewEvent.OnPageFinished -> {
|
|
||||||
_state.update { it.copy(isLoading = false) }
|
|
||||||
}
|
|
||||||
|
|
||||||
is WebViewEvent.ToggleToolbar -> {
|
|
||||||
_state.update { it.copy(showToolbar = event.show) }
|
|
||||||
}
|
|
||||||
|
|
||||||
is WebViewEvent.OnBackGesture -> {
|
|
||||||
viewModelScope.launch {
|
|
||||||
_webViewActions.send(event)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
is WebViewEvent.OnUrlLoading -> {
|
|
||||||
processEvent(WebViewEvent.LoadUrl(event.url))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setInitialUrl(webURL: String) {
|
|
||||||
try {
|
|
||||||
|
|
||||||
println("webURL $webURL")
|
|
||||||
_state.update { it.copy(initialUrl = webURL) }
|
|
||||||
processEvent(WebViewEvent.LoadUrl("https://salix.verdnatura.es"))
|
|
||||||
} catch (e: Exception) {
|
|
||||||
// Manejar error
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,67 +0,0 @@
|
||||||
package es.verdnatura.presentation.view.commom.webview.data
|
|
||||||
|
|
||||||
import android.webkit.WebChromeClient
|
|
||||||
import android.webkit.WebView
|
|
||||||
import androidx.compose.foundation.layout.Box
|
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
|
||||||
import androidx.compose.foundation.layout.statusBarsPadding
|
|
||||||
import androidx.compose.material3.CircularProgressIndicator
|
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
|
||||||
import androidx.compose.material3.Surface
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.ui.Alignment
|
|
||||||
import androidx.compose.ui.Modifier
|
|
||||||
import androidx.compose.ui.viewinterop.AndroidView
|
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
|
||||||
@Composable
|
|
||||||
fun WebViewScreen(
|
|
||||||
state: WebViewState,
|
|
||||||
onWebViewCreated: (WebView) -> Unit
|
|
||||||
) {
|
|
||||||
Surface(
|
|
||||||
modifier = Modifier.fillMaxSize() // Asegura que ocupe toda la pantalla
|
|
||||||
) {
|
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxSize()
|
|
||||||
.statusBarsPadding() // Evita que la WebView quede debajo de la barra de estado
|
|
||||||
) {
|
|
||||||
AndroidView(
|
|
||||||
modifier = Modifier.fillMaxSize(),
|
|
||||||
factory = { context ->
|
|
||||||
WebView(context).apply {
|
|
||||||
settings.apply {
|
|
||||||
javaScriptEnabled = true
|
|
||||||
domStorageEnabled = true
|
|
||||||
loadWithOverviewMode = true
|
|
||||||
useWideViewPort = true
|
|
||||||
builtInZoomControls = true
|
|
||||||
displayZoomControls = false
|
|
||||||
setSupportZoom(true)
|
|
||||||
allowFileAccess = true
|
|
||||||
}
|
|
||||||
webChromeClient = object : WebChromeClient() {
|
|
||||||
override fun onProgressChanged(view: WebView?, newProgress: Int) {
|
|
||||||
super.onProgressChanged(view, newProgress)
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onWebViewCreated(this)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
update = { webView ->
|
|
||||||
if (state.url.isNotEmpty() && state.url != webView.url) {
|
|
||||||
webView.loadUrl(state.url)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
if (state.isLoading) {
|
|
||||||
CircularProgressIndicator(
|
|
||||||
modifier = Modifier.align(Alignment.Center)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
package es.verdnatura.presentation.view.commom.webview.data
|
|
||||||
|
|
||||||
data class WebViewState(
|
|
||||||
val title: String = "",
|
|
||||||
val url: String = "",
|
|
||||||
val isLoading: Boolean = false,
|
|
||||||
val showToolbar: Boolean = true,
|
|
||||||
val initialUrl: String = ""
|
|
||||||
)
|
|
||||||
|
|
||||||
sealed class WebViewEvent {
|
|
||||||
data class LoadUrl(val url: String) : WebViewEvent()
|
|
||||||
data class UpdateTitle(val title: String) : WebViewEvent()
|
|
||||||
data class OnPageFinished(val url: String) : WebViewEvent()
|
|
||||||
data class ToggleToolbar(val show: Boolean) : WebViewEvent()
|
|
||||||
data object OnBackGesture : WebViewEvent()
|
|
||||||
data class OnUrlLoading(val url: String) : WebViewEvent()
|
|
||||||
}
|
|
|
@ -100,15 +100,15 @@ class CustomDialogInput(context: Context) : Dialog(context, R.style.DialogTheme)
|
||||||
fun setFocusText() {
|
fun setFocusText() {
|
||||||
binding.customDialogValue.requestFocus()
|
binding.customDialogValue.requestFocus()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setFocusTextTwo() {
|
fun setFocusTextTwo() {
|
||||||
binding.customDialogValueTwo.requestFocus()
|
binding.customDialogValueTwo.requestFocus()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun plusTextButton(view: View) {
|
fun plusTextButton(view: View) {
|
||||||
|
|
||||||
|
var sum = 0
|
||||||
try {
|
try {
|
||||||
val sum = getValue().toInt() + Integer.parseInt(view.tag.toString())
|
sum = getValue().toInt() + Integer.parseInt(view.tag.toString())
|
||||||
setValue(sum.toString())
|
setValue(sum.toString())
|
||||||
} catch (ex: Exception) {
|
} catch (ex: Exception) {
|
||||||
setValue(view.tag.toString())
|
setValue(view.tag.toString())
|
||||||
|
|
|
@ -69,12 +69,6 @@ class CustomDialogList(context: Context) : Dialog(context, R.style.DialogTheme)
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setTitleSpannable(title: CharSequence): CustomDialogList {
|
|
||||||
binding.customDialogTitle.visibility = View.VISIBLE
|
|
||||||
binding.customDialogTitle.text = title
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setDescription(title: String): CustomDialogList {
|
fun setDescription(title: String): CustomDialogList {
|
||||||
binding.customDialogDescription.visibility = View.VISIBLE
|
binding.customDialogDescription.visibility = View.VISIBLE
|
||||||
binding.customDialogDescription.text = title
|
binding.customDialogDescription.text = title
|
||||||
|
@ -96,13 +90,6 @@ class CustomDialogList(context: Context) : Dialog(context, R.style.DialogTheme)
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setOkThreeButton(text: String, onButtonClicked: () -> Unit): CustomDialogList {
|
|
||||||
binding.customDialogButtonOkThree.visibility = View.VISIBLE
|
|
||||||
binding.customDialogButtonOkThree.text = text
|
|
||||||
binding.customDialogButtonOkThree.setOnClickListener { onButtonClicked() }
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setKoButton(text: String, onButtonClicked: () -> Unit): CustomDialogList {
|
fun setKoButton(text: String, onButtonClicked: () -> Unit): CustomDialogList {
|
||||||
binding.customDialogButtonKo.visibility = View.VISIBLE
|
binding.customDialogButtonKo.visibility = View.VISIBLE
|
||||||
binding.customDialogButtonKo.text = text
|
binding.customDialogButtonKo.text = text
|
||||||
|
@ -161,9 +148,4 @@ class CustomDialogList(context: Context) : Dialog(context, R.style.DialogTheme)
|
||||||
fun getFocusThree() {
|
fun getFocusThree() {
|
||||||
binding.customDialogValueThree.requestFocus()
|
binding.customDialogValueThree.requestFocus()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setTextSize(size: Float): CustomDialogList {
|
|
||||||
binding.customDialogValue.textSize = size
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,130 +0,0 @@
|
||||||
package es.verdnatura.presentation.view.component
|
|
||||||
|
|
||||||
import androidx.compose.foundation.background
|
|
||||||
import androidx.compose.foundation.clickable
|
|
||||||
import androidx.compose.foundation.layout.Column
|
|
||||||
import androidx.compose.foundation.layout.Spacer
|
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
|
||||||
import androidx.compose.foundation.layout.height
|
|
||||||
import androidx.compose.foundation.layout.padding
|
|
||||||
import androidx.compose.foundation.layout.wrapContentWidth
|
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
|
||||||
import androidx.compose.foundation.lazy.items
|
|
||||||
import androidx.compose.material3.HorizontalDivider
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
|
||||||
import androidx.compose.material3.Text
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.runtime.getValue
|
|
||||||
import androidx.compose.runtime.mutableStateOf
|
|
||||||
import androidx.compose.runtime.remember
|
|
||||||
import androidx.compose.runtime.setValue
|
|
||||||
import androidx.compose.ui.Alignment
|
|
||||||
import androidx.compose.ui.Modifier
|
|
||||||
import androidx.compose.ui.focus.FocusRequester
|
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
|
||||||
import androidx.compose.ui.text.input.TextFieldValue
|
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import androidx.compose.ui.window.Dialog
|
|
||||||
import es.verdnatura.presentation.composable.ui.DefaultButtonCustomDialog
|
|
||||||
import es.verdnatura.presentation.composable.ui.DescriptionTextCustomDialog
|
|
||||||
import es.verdnatura.presentation.composable.ui.ScanTextCustomDialog
|
|
||||||
import es.verdnatura.presentation.composable.ui.TitleTextCustomDialog
|
|
||||||
import es.verdnatura.presentation.composable.ui.VerdnaturaColors
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun CustomDialogListComposable(
|
|
||||||
title: String = "",
|
|
||||||
description: String = "",
|
|
||||||
buttonOkText: String = "",
|
|
||||||
onOkClick: () -> Unit = {},
|
|
||||||
showRecyclerView: Boolean = true,
|
|
||||||
recyclerViewItems: List<Any> = listOf(),
|
|
||||||
onItemSelected: (Any) -> Unit = {},
|
|
||||||
hintOne: String = "",
|
|
||||||
showTextInput: Boolean = true,
|
|
||||||
onEnterPressed: (String) -> Unit = {}
|
|
||||||
) {
|
|
||||||
var valueOne by remember { mutableStateOf(TextFieldValue()) }
|
|
||||||
val showDialog = remember { mutableStateOf(true) }
|
|
||||||
val keyboardController = LocalSoftwareKeyboardController.current
|
|
||||||
val focusRequester = remember { FocusRequester() }
|
|
||||||
|
|
||||||
if (showDialog.value) {
|
|
||||||
Dialog(
|
|
||||||
onDismissRequest = { showDialog.value = false },
|
|
||||||
) {
|
|
||||||
|
|
||||||
Column(
|
|
||||||
modifier = Modifier
|
|
||||||
.background(VerdnaturaColors.BlackCustomDialog)
|
|
||||||
.padding(16.dp),
|
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
|
||||||
) {
|
|
||||||
if (title.isNotEmpty()) {
|
|
||||||
TitleTextCustomDialog(title)
|
|
||||||
}
|
|
||||||
if (description.isNotEmpty()) {
|
|
||||||
DescriptionTextCustomDialog(description)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (showTextInput)
|
|
||||||
ScanTextCustomDialog(
|
|
||||||
value = valueOne,
|
|
||||||
onValueChange = { valueOne = it },
|
|
||||||
hint = hintOne,
|
|
||||||
onEnterPressed = onEnterPressed,
|
|
||||||
focusRequester = focusRequester
|
|
||||||
)
|
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
|
||||||
|
|
||||||
if (showRecyclerView && recyclerViewItems.isNotEmpty()) {
|
|
||||||
LazyColumn(
|
|
||||||
modifier = Modifier.wrapContentWidth(align = Alignment.CenterHorizontally)
|
|
||||||
) {
|
|
||||||
items(recyclerViewItems) { item ->
|
|
||||||
HorizontalDivider(thickness = 1.dp, color = Color.DarkGray)
|
|
||||||
Text(
|
|
||||||
text = item.toString(),
|
|
||||||
style = MaterialTheme.typography.bodyLarge,
|
|
||||||
color = VerdnaturaColors.White,
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(16.dp)
|
|
||||||
.clickable {
|
|
||||||
onItemSelected(item.toString())
|
|
||||||
}
|
|
||||||
.align(Alignment.CenterHorizontally)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DefaultButtonCustomDialog(buttonOkText, onClick = {
|
|
||||||
onOkClick()
|
|
||||||
keyboardController?.hide()
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Preview
|
|
||||||
@Composable
|
|
||||||
fun PreviewCustomDialogList() {
|
|
||||||
|
|
||||||
CustomDialogListComposable(
|
|
||||||
title = "Custom Dialog Title",
|
|
||||||
description = "This is a description.",
|
|
||||||
buttonOkText = "OK",
|
|
||||||
onOkClick = { /* Handle OK click */ },
|
|
||||||
showRecyclerView = true,
|
|
||||||
recyclerViewItems = listOf(1, 2, 3),
|
|
||||||
onItemSelected = { item -> println("Item selected: $item") },
|
|
||||||
hintOne = "Hint for input one",
|
|
||||||
|
|
||||||
)
|
|
||||||
}
|
|
|
@ -1,16 +1,12 @@
|
||||||
package es.verdnatura.presentation.view.feature.ajustes.fragment
|
package es.verdnatura.presentation.view.feature.ajustes.fragment
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.app.AlertDialog
|
import android.app.AlertDialog
|
||||||
import android.content.Intent
|
|
||||||
import android.content.pm.PackageInfo
|
import android.content.pm.PackageInfo
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Handler
|
|
||||||
import android.os.Looper
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.ArrayAdapter
|
import android.widget.ArrayAdapter
|
||||||
|
@ -46,7 +42,6 @@ import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
||||||
import es.verdnatura.presentation.view.feature.ajustes.model.Train
|
import es.verdnatura.presentation.view.feature.ajustes.model.Train
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
|
||||||
import es.verdnatura.presentation.view.feature.login.fragment.LoginViewModel
|
import es.verdnatura.presentation.view.feature.login.fragment.LoginViewModel
|
||||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.fragment.PasilleroViewModel
|
import es.verdnatura.presentation.view.feature.pasillero.fragment.PasilleroViewModel
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.CodeWorkerAction
|
import es.verdnatura.presentation.view.feature.pasillero.model.CodeWorkerAction
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||||
|
@ -87,101 +82,59 @@ class AjustesFragment :
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setSearchable(
|
private fun setSearchable(listNames: MutableList<NameWithId>) {
|
||||||
listNames: MutableList<NameWithId>,
|
|
||||||
type: String = "sector",
|
|
||||||
listColorsElements: List<Int> = listOf()
|
|
||||||
) {
|
|
||||||
val adapter =
|
val adapter =
|
||||||
SearchableAdapter(
|
SearchableAdapter(
|
||||||
listElements = listNames,
|
listElements = listNames,
|
||||||
context = requireContext(),
|
context = requireContext()
|
||||||
listColorElements = listColorsElements,
|
|
||||||
) { elementSelected ->
|
) { elementSelected ->
|
||||||
when (type) {
|
sectorListVO.forEach {
|
||||||
"sector" -> {
|
if (it.id == elementSelected.id) {
|
||||||
sectorListVO.forEach {
|
runBlocking {
|
||||||
if (it.id == elementSelected.id) {
|
mobileApplication.dataStoreApp.editDataStoreKey(
|
||||||
runBlocking {
|
PRINTERNAME, getString(R.string.noprinter)
|
||||||
mobileApplication.dataStoreApp.editDataStoreKey(
|
)
|
||||||
PRINTERNAME, getString(R.string.noprinter)
|
mobileApplication.dataStoreApp.editDataStoreKey(PRINTERFK, -1)
|
||||||
)
|
mobileApplication.dataStoreApp.editDataStoreKey(
|
||||||
mobileApplication.dataStoreApp.editDataStoreKey(PRINTERFK, -1)
|
SECTORDESCRIP, it.description
|
||||||
mobileApplication.dataStoreApp.editDataStoreKey(
|
)
|
||||||
SECTORDESCRIP, it.description
|
mobileApplication.dataStoreApp.editDataStoreKey(
|
||||||
)
|
SECTORFK, it.id
|
||||||
mobileApplication.dataStoreApp.editDataStoreKey(
|
)
|
||||||
SECTORFK, it.id
|
it.warehouseFk?.let { it1 ->
|
||||||
)
|
mobileApplication.dataStoreApp.editDataStoreKey(
|
||||||
it.warehouseFk?.let { it1 ->
|
WAREHOUSEFK, it1
|
||||||
mobileApplication.dataStoreApp.editDataStoreKey(
|
|
||||||
WAREHOUSEFK, it1
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
viewModel.settingsItem[0].sectorFk = it.id
|
|
||||||
viewModel.settingsItem[0].selected = it.description
|
|
||||||
viewModel.workerUpdateOperatorSalix(
|
|
||||||
"sector", mobileApplication.userId!!, it.id, null
|
|
||||||
)
|
)
|
||||||
settingsAdapter!!.notifyItemChanged(0)
|
|
||||||
return@forEach
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
viewModel.settingsItem[0].sectorFk = it.id
|
||||||
|
viewModel.settingsItem[0].selected = it.description
|
||||||
"printer" -> {
|
viewModel.workerUpdateOperatorSalix(
|
||||||
println("selected $elementSelected")
|
"sector", mobileApplication.userId!!, it.id, null
|
||||||
val printer = printersList.find { it.name == elementSelected.name }
|
)
|
||||||
println("selected printer $elementSelected")
|
settingsAdapter!!.notifyItemChanged(0)
|
||||||
if (printer != null) {
|
return@forEach
|
||||||
if (printer.sector?.backupPrinterFk == printer.id) {
|
|
||||||
showWarningPrinter(printer.name, printer.id)
|
|
||||||
} else {
|
|
||||||
savePrinter(printer.name, printer.id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
printersList.clear()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val searchView =
|
|
||||||
binding.searchableRecyclerView.findViewById<androidx.appcompat.widget.SearchView>(
|
|
||||||
R.id.search_view
|
|
||||||
)
|
|
||||||
searchView?.setQuery("", false)
|
|
||||||
binding.searchableRecyclerView.visibility = View.GONE
|
binding.searchableRecyclerView.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.searchableRecyclerView.setAdapter(adapter, listNames)
|
binding.searchableRecyclerView.setAdapter(adapter, listNames)
|
||||||
binding.searchableRecyclerView.visibility = View.VISIBLE
|
binding.searchableRecyclerView.visibility = View.VISIBLE
|
||||||
binding.searchableRecyclerView.setSearchHint(
|
binding.searchableRecyclerView.setSearchHint(getString(R.string.sectorSearch))
|
||||||
if (type == "sector") getString(R.string.sectorSearch) else
|
|
||||||
getString(R.string.printerSearch)
|
|
||||||
)
|
|
||||||
ma.hideKeyboard(binding.searchableRecyclerView)
|
ma.hideKeyboard(binding.searchableRecyclerView)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setToolBar() {
|
private fun setToolBar() {
|
||||||
|
|
||||||
val listIcons: ArrayList<ImageView> = ArrayList()
|
val listIcons: ArrayList<ImageView> = ArrayList()
|
||||||
|
|
||||||
val iconInfo = ImageView(context)
|
val iconInfo = ImageView(context)
|
||||||
iconInfo.setImageResource(R.drawable.ic_info_delivery)
|
iconInfo.setImageResource(R.drawable.ic_info_delivery)
|
||||||
|
|
||||||
val iconLogout = ImageView(context)
|
val iconLogout = ImageView(context)
|
||||||
iconLogout.setImageResource(R.drawable.ic_logout)
|
iconLogout.setImageResource(R.drawable.ic_logout)
|
||||||
|
|
||||||
val iconPhone = ImageView(context)
|
|
||||||
iconPhone.setImageResource(R.drawable.phone_call)
|
|
||||||
|
|
||||||
val iconSettings = ImageView(context)
|
|
||||||
iconSettings.setImageResource(R.drawable.ic_setting_ui)
|
|
||||||
|
|
||||||
listIcons.add(iconInfo)
|
listIcons.add(iconInfo)
|
||||||
listIcons.add(iconLogout)
|
listIcons.add(iconLogout)
|
||||||
// listIcons.add(iconPhone)
|
|
||||||
//listIcons.add(iconSettings)
|
|
||||||
|
|
||||||
binding.mainToolbar.toolbarIcons.adapter =
|
binding.mainToolbar.toolbarIcons.adapter =
|
||||||
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
|
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
|
||||||
override fun onOptionsItemSelected(item: Drawable) {
|
override fun onOptionsItemSelected(item: Drawable) {
|
||||||
|
@ -212,60 +165,8 @@ class AjustesFragment :
|
||||||
}
|
}
|
||||||
|
|
||||||
iconLogout.drawable -> {
|
iconLogout.drawable -> {
|
||||||
/* println("test incoming warehouse close")
|
|
||||||
val intent = Intent("org.linphone.CLOSE_APP")
|
|
||||||
intent.setPackage("org.linphone.incomingcall") // Reemplaza con el paquete de la app receptora
|
|
||||||
requireContext().sendBroadcast(intent)*/
|
|
||||||
ma.onMyBackPressed()
|
ma.onMyBackPressed()
|
||||||
}
|
}
|
||||||
|
|
||||||
iconSettings.drawable -> {
|
|
||||||
println("test incoming warehouse opening")
|
|
||||||
val intent = Intent()
|
|
||||||
intent.setClassName(
|
|
||||||
"org.linphone.incomingcall",
|
|
||||||
"org.linphone.incomingcall.IncomingCallActivity"
|
|
||||||
)
|
|
||||||
intent.putExtra("server", "pbx.verdnatura.es")
|
|
||||||
intent.putExtra("username", "1007")
|
|
||||||
intent.putExtra("password", "delatorre.1234")
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
|
||||||
startActivity(intent)
|
|
||||||
|
|
||||||
Handler(Looper.getMainLooper()).postDelayed({
|
|
||||||
val intentIncoming =
|
|
||||||
Intent(requireContext(), MainActivity::class.java)
|
|
||||||
intentIncoming.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
|
|
||||||
startActivity(intentIncoming)
|
|
||||||
}, 2000)
|
|
||||||
}
|
|
||||||
|
|
||||||
iconPhone.drawable -> {
|
|
||||||
println("test incoming warehouse calling")
|
|
||||||
val intentIncoming =
|
|
||||||
Intent(requireContext(), MainActivity::class.java)
|
|
||||||
intentIncoming.putExtra(
|
|
||||||
"phoneNumber",
|
|
||||||
"sip:651353889@pbx.verdnatura.es"
|
|
||||||
)
|
|
||||||
|
|
||||||
/* intentIncoming.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
|
|
||||||
startActivity(intentIncoming)*/
|
|
||||||
val intent = Intent("org.linphone.CALLING")
|
|
||||||
intent.setClassName(
|
|
||||||
"org.linphone.incomingcall",
|
|
||||||
"org.linphone.incomingcall.IncomingCallActivity"
|
|
||||||
)
|
|
||||||
intent.putExtra("server", "pbx.verdnatura.es")
|
|
||||||
intent.putExtra("username", "1007")
|
|
||||||
intent.putExtra("password", "*******")
|
|
||||||
intent.putExtra("phoneNumber", "sip:651353889@pbx.verdnatura.es")
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
|
|
||||||
startActivity(intent)
|
|
||||||
requireContext().sendBroadcast(intent)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -304,7 +205,11 @@ class AjustesFragment :
|
||||||
getString(R.string.closeSession) -> ma.onMyBackPressed()
|
getString(R.string.closeSession) -> ma.onMyBackPressed()
|
||||||
getString(R.string.printerLabel) -> {
|
getString(R.string.printerLabel) -> {
|
||||||
messagePrinter = getString(R.string.SelectPrinter)
|
messagePrinter = getString(R.string.SelectPrinter)
|
||||||
viewModel.printerGet()
|
viewModel.printerGet(
|
||||||
|
mobileApplication.dataStoreApp.readDataStoreKey(
|
||||||
|
SECTORFK
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(R.string.vehicleControl) -> ma.onPasillerosItemClickListener(
|
getString(R.string.vehicleControl) -> ma.onPasillerosItemClickListener(
|
||||||
|
@ -348,7 +253,7 @@ class AjustesFragment :
|
||||||
event.getContentIfNotHandled().notNull {
|
event.getContentIfNotHandled().notNull {
|
||||||
messagePrinter =
|
messagePrinter =
|
||||||
getString(R.string.SelectPrinter) + "\n" + getString(R.string.printerRemoved)
|
getString(R.string.SelectPrinter) + "\n" + getString(R.string.printerRemoved)
|
||||||
viewModel.printerGet()
|
viewModel.printerGet(mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,53 +315,20 @@ class AjustesFragment :
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loadPrintersList.observe(viewLifecycleOwner) { event ->
|
loadPrintersList.observe(viewLifecycleOwner) { event ->
|
||||||
event.getContentIfNotHandled()?.let { it ->
|
event.getContentIfNotHandled().notNull { it ->
|
||||||
|
|
||||||
if (it.list.isNotEmpty()) {
|
if (it.list.isNotEmpty()) {
|
||||||
val listPrinters: ArrayList<String> = ArrayList()
|
val listPrinters: ArrayList<String> = ArrayList()
|
||||||
printersList.clear()
|
it.list.forEach {
|
||||||
|
listPrinters.add(it.name)
|
||||||
|
|
||||||
printersList.addAll(it.list.sortedWith(compareBy(
|
|
||||||
{ printer ->
|
|
||||||
when {
|
|
||||||
printer.sector?.id == mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
|
||||||
SECTORFK
|
|
||||||
) -> 0
|
|
||||||
|
|
||||||
printer.sector?.id != null -> 1
|
|
||||||
else -> 2
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{ printer -> printer.name }
|
|
||||||
)))
|
|
||||||
|
|
||||||
printersList.forEach { printer ->
|
|
||||||
listPrinters.add(printer.name)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val array = arrayOfNulls<String>(listPrinters.size)
|
val array = arrayOfNulls<String>(listPrinters.size)
|
||||||
// showDialogForAll(listPrinters.toArray(array), messagePrinter ?: "")
|
printersList = it.list
|
||||||
//Tarea7823
|
showDialogForAll(listPrinters.toArray(array), messagePrinter ?: "")
|
||||||
val listColorsElements = printersList.mapIndexed { _, printer ->
|
|
||||||
if (printer.sector?.id == mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
|
||||||
SECTORFK
|
|
||||||
)
|
|
||||||
) printer.id else null
|
|
||||||
}.filterNotNull()
|
|
||||||
|
|
||||||
setSearchable(printersList.map {
|
|
||||||
NameWithId(
|
|
||||||
id = it.id,
|
|
||||||
name = it.name
|
|
||||||
)
|
|
||||||
} as MutableList<NameWithId>,
|
|
||||||
type = "printer",
|
|
||||||
listColorsElements = listColorsElements)
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
viewModel.settingsItem[2].selected = getString(R.string.noprinter)
|
viewModel.settingsItem[2].selected = getString(R.string.noprinter)
|
||||||
settingsAdapter?.notifyItemChanged(2)
|
settingsAdapter!!.notifyItemChanged(2)
|
||||||
customDialog.setTitle(getString(R.string.printers))
|
customDialog.setTitle(getString(R.string.printers))
|
||||||
.setDescription(getString(R.string.Noprinters))
|
.setDescription(getString(R.string.Noprinters))
|
||||||
.setOkButton(getString(R.string.Close)) {
|
.setOkButton(getString(R.string.Close)) {
|
||||||
|
@ -464,6 +336,7 @@ class AjustesFragment :
|
||||||
handleUserCall()
|
handleUserCall()
|
||||||
}.show()
|
}.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loadTrainList.observe(viewLifecycleOwner) { event ->
|
loadTrainList.observe(viewLifecycleOwner) { event ->
|
||||||
|
@ -488,19 +361,14 @@ class AjustesFragment :
|
||||||
super.observeViewModel()
|
super.observeViewModel()
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("NotifyDataSetChanged")
|
|
||||||
private fun getUserData() {
|
private fun getUserData() {
|
||||||
|
|
||||||
loginViewModel = LoginViewModel(requireActivity().applicationContext)
|
loginViewModel = LoginViewModel(requireActivity().applicationContext)
|
||||||
handleUserCall()
|
handleUserCall()
|
||||||
loginViewModel.handleUserResponse.observe(this@AjustesFragment) { iti ->
|
loginViewModel.handleUserResponse.observe(this@AjustesFragment) { iti ->
|
||||||
runBlocking {
|
runBlocking { mobileApplication.dataStoreApp.saveWorkerData(iti) }
|
||||||
mobileApplication.dataStoreApp.saveWorkerData(iti)
|
|
||||||
setSettings()
|
|
||||||
binding.setttingsItems.adapter!!.notifyDataSetChanged()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
setSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleUserCall() {
|
private fun handleUserCall() {
|
||||||
|
@ -568,27 +436,13 @@ class AjustesFragment :
|
||||||
val positionPrinterEmergency =
|
val positionPrinterEmergency =
|
||||||
printersList.indexOfFirst { printer -> printer.sector?.backupPrinterFk == printer.id }
|
printersList.indexOfFirst { printer -> printer.sector?.backupPrinterFk == printer.id }
|
||||||
|
|
||||||
val positions = printersList.mapIndexed { index, printer ->
|
if (position == positionPrinterEmergency) {
|
||||||
if (printer.sector?.id == mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
textView.setTextColor(Color.RED)
|
||||||
SECTORFK
|
} else {
|
||||||
)
|
textView.setTextColor(Color.BLACK)
|
||||||
) index else null
|
|
||||||
}.filterNotNull()
|
|
||||||
|
|
||||||
when (position) {
|
|
||||||
positionPrinterEmergency -> {
|
|
||||||
textView.setTextColor(Color.RED)
|
|
||||||
}
|
|
||||||
|
|
||||||
in positions -> {
|
|
||||||
textView.setTextColor(Color.BLACK)
|
|
||||||
}
|
|
||||||
|
|
||||||
else -> {
|
|
||||||
textView.setTextColor(Color.GRAY)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,10 +156,9 @@ class AjustesViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun printerGet() {
|
fun printerGet(sectorFk: Int) {
|
||||||
//Tarea 7823*/
|
|
||||||
salix.getprinters(
|
salix.getprinters(
|
||||||
"""{"fields":["id","name","sectorFk"],"where":{"isLabeler":{"neq":false}},"include": [ { "relation": "sector", "scope": { "fields": ["backupPrinterFk"]}}]}"""
|
"""{"fields":["id","name","sectorFk"],"where":{"sectorFk":$sectorFk,"isLabeler":{"neq":false}},"include": [ { "relation": "sector", "scope": { "fields": ["backupPrinterFk"]}}]}"""
|
||||||
).enqueue(object : SalixCallback<MutableList<Printers>>(context) {
|
).enqueue(object : SalixCallback<MutableList<Printers>>(context) {
|
||||||
override fun onSuccess(response: Response<MutableList<Printers>>) {
|
override fun onSuccess(response: Response<MutableList<Printers>>) {
|
||||||
_printerList.value = response.body()?.let { PrintersList(it) }
|
_printerList.value = response.body()?.let { PrintersList(it) }
|
||||||
|
|
|
@ -6,21 +6,26 @@ import es.verdnatura.domain.toast
|
||||||
import es.verdnatura.presentation.base.BaseActivity
|
import es.verdnatura.presentation.base.BaseActivity
|
||||||
import es.verdnatura.presentation.common.loadUrl
|
import es.verdnatura.presentation.common.loadUrl
|
||||||
|
|
||||||
class ImageViewActivity : BaseActivity<ActivityImageviewBinding>() {
|
class ImageViewActivity : BaseActivity<ActivityImageviewBinding>(){
|
||||||
|
|
||||||
override fun getLayoutId(): Int = R.layout.activity_imageview
|
override fun getLayoutId(): Int = R.layout.activity_imageview
|
||||||
|
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
binding.mainToolbar.toolbarTitle.text = intent.getStringExtra(getString(R.string.title))
|
binding.mainToolbar.toolbarTitle.text = intent.getStringExtra(getString(R.string.title))
|
||||||
try {
|
try {
|
||||||
binding.imgView.loadUrl(intent.getStringExtra(getString(R.string.url))!!)
|
binding.imgView.loadUrl(intent.getStringExtra(getString(R.string.url))!!)
|
||||||
} catch (ex: Exception) {
|
}catch(ex:Exception){
|
||||||
getString(R.string.errorImage).toast(this)
|
getString(R.string.errorImage).toast(this)
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
binding.mainToolbar.backButton.setOnClickListener {
|
binding.mainToolbar.backButton.setOnClickListener {
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,10 +25,8 @@ import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
||||||
import es.verdnatura.presentation.common.PrinterDialogManager
|
import es.verdnatura.presentation.common.PrinterDialogManager
|
||||||
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
||||||
import es.verdnatura.presentation.common.hideKeyboard
|
import es.verdnatura.presentation.common.hideKeyboard
|
||||||
import es.verdnatura.presentation.common.itemScanIsQr
|
|
||||||
import es.verdnatura.presentation.common.itemScanValue
|
import es.verdnatura.presentation.common.itemScanValue
|
||||||
import es.verdnatura.presentation.common.loadUrl
|
import es.verdnatura.presentation.common.loadUrl
|
||||||
import es.verdnatura.presentation.composable.ImageViewActivityComposable
|
|
||||||
import es.verdnatura.presentation.view.component.CustomDialogDynamicButtons
|
import es.verdnatura.presentation.view.component.CustomDialogDynamicButtons
|
||||||
import es.verdnatura.presentation.view.component.CustomDialogInput
|
import es.verdnatura.presentation.view.component.CustomDialogInput
|
||||||
import es.verdnatura.presentation.view.component.CustomDialogList
|
import es.verdnatura.presentation.view.component.CustomDialogList
|
||||||
|
@ -41,7 +39,6 @@ import es.verdnatura.presentation.view.feature.articulo.model.ItemCardRowVO
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||||
import kotlinx.coroutines.runBlocking
|
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
|
||||||
class ItemCardFragment(
|
class ItemCardFragment(
|
||||||
|
@ -135,36 +132,10 @@ class ItemCardFragment(
|
||||||
val printerDialogManager = PrinterDialogManager(requireContext())
|
val printerDialogManager = PrinterDialogManager(requireContext())
|
||||||
printerDialogManager.showPrintDialog(
|
printerDialogManager.showPrintDialog(
|
||||||
buyToPrint ?: itemInfoG!!.id.toLong(),
|
buyToPrint ?: itemInfoG!!.id.toLong(),
|
||||||
itemInfoG?.longName ?: "",
|
itemInfoG?.longName ?: ""
|
||||||
onPrintClick = { id, labelType, copies, packing ->
|
) { id, labelType, copies, packing ->
|
||||||
printItem(id, labelType, copies, packing)
|
printItem(id, labelType, copies, packing)
|
||||||
},
|
}
|
||||||
onPrintChange = { text ->
|
|
||||||
if (itemScanIsQr(text)) {
|
|
||||||
val labeler = itemScanValue(
|
|
||||||
text,
|
|
||||||
arrayOf("printer"),
|
|
||||||
"id"
|
|
||||||
).toString().toInt()
|
|
||||||
viewModel.operatorUpdate(
|
|
||||||
workerFk = mobileApplication.userId!!,
|
|
||||||
labelerFK = labeler
|
|
||||||
)
|
|
||||||
runBlocking {
|
|
||||||
mobileApplication.dataStoreApp.editDataStoreKey(
|
|
||||||
PRINTERFK,
|
|
||||||
labeler
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ma.messageWithSound(
|
|
||||||
getString(R.string.qrPrinterNotvalid),
|
|
||||||
isPlayed = true,
|
|
||||||
isError = true,
|
|
||||||
isToasted = false
|
|
||||||
)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else ma.messageWithSound(
|
} else ma.messageWithSound(
|
||||||
getString(R.string.errorPrintBuy),
|
getString(R.string.errorPrintBuy),
|
||||||
isError = true,
|
isError = true,
|
||||||
|
@ -301,9 +272,7 @@ class ItemCardFragment(
|
||||||
}
|
}
|
||||||
binding.itemcardImage.setOnClickListener {
|
binding.itemcardImage.setOnClickListener {
|
||||||
|
|
||||||
//JETPACKCOMPOSE
|
val i = Intent(activity, ImageViewActivity::class.java)
|
||||||
// val i = Intent(activity, ImageViewActivity::class.java)
|
|
||||||
val i = Intent(activity, ImageViewActivityComposable::class.java)
|
|
||||||
i.putExtra(getString(R.string.url), urlLarge)
|
i.putExtra(getString(R.string.url), urlLarge)
|
||||||
i.putExtra(getString(R.string.title), titleImage)
|
i.putExtra(getString(R.string.title), titleImage)
|
||||||
startActivity(i)
|
startActivity(i)
|
||||||
|
@ -371,17 +340,6 @@ class ItemCardFragment(
|
||||||
buyToPrint = it
|
buyToPrint = it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loadChangePrinterResponse.observe(viewLifecycleOwner) { event ->
|
|
||||||
event.getContentIfNotHandled().notNull {
|
|
||||||
runBlocking {
|
|
||||||
mobileApplication.dataStoreApp.editDataStoreKey(
|
|
||||||
PRINTERFK,
|
|
||||||
it
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ import es.verdnatura.domain.SalixCallback
|
||||||
import es.verdnatura.domain.formatWithQuotes
|
import es.verdnatura.domain.formatWithQuotes
|
||||||
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
||||||
import es.verdnatura.domain.userCases.GetItemPrintItemUseCase
|
import es.verdnatura.domain.userCases.GetItemPrintItemUseCase
|
||||||
import es.verdnatura.domain.userCases.OperatorUseCase
|
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
import es.verdnatura.presentation.common.Event
|
import es.verdnatura.presentation.common.Event
|
||||||
import es.verdnatura.presentation.common.ItemBarCodeSalix
|
import es.verdnatura.presentation.common.ItemBarCodeSalix
|
||||||
|
@ -28,7 +27,6 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
|
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
|
||||||
private val printItemUseCase = GetItemPrintItemUseCase(salix)
|
private val printItemUseCase = GetItemPrintItemUseCase(salix)
|
||||||
private val operatorUseCase = OperatorUseCase(salix)
|
|
||||||
|
|
||||||
private val _itemCard by lazy { MutableLiveData<ItemCardVO>() }
|
private val _itemCard by lazy { MutableLiveData<ItemCardVO>() }
|
||||||
val itemCard: LiveData<ItemCardVO>
|
val itemCard: LiveData<ItemCardVO>
|
||||||
|
@ -56,10 +54,6 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
val buyUltimateResponse: LiveData<Long> = _buyUltimateResponse
|
val buyUltimateResponse: LiveData<Long> = _buyUltimateResponse
|
||||||
val loadBuyUltimateResponse: LiveData<Event<Long>> = _buyUltimateResponse.map { Event(it) }
|
val loadBuyUltimateResponse: LiveData<Event<Long>> = _buyUltimateResponse.map { Event(it) }
|
||||||
|
|
||||||
private val _changePrinterResponse by lazy { MutableLiveData<Int>() }
|
|
||||||
val changePrinterResponse: LiveData<Int> = _changePrinterResponse
|
|
||||||
val loadChangePrinterResponse: LiveData<Event<Int>> = _changePrinterResponse.map { Event(it) }
|
|
||||||
|
|
||||||
fun getItemCard(
|
fun getItemCard(
|
||||||
itemFk: Number,
|
itemFk: Number,
|
||||||
warehouseFk: Int,
|
warehouseFk: Int,
|
||||||
|
@ -75,18 +69,6 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun operatorUpdate(workerFk: Number, labelerFK: Number) {
|
|
||||||
|
|
||||||
operatorUseCase.updateOperator(workerFk = workerFk, hashMapOf("labelerFk" to labelerFK))
|
|
||||||
.enqueue(object : SalixCallback<Unit>(context) {
|
|
||||||
override fun onSuccess(response: Response<Unit>) {
|
|
||||||
super.onSuccess(response)
|
|
||||||
_changePrinterResponse.value = labelerFK.toInt()
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fun printItem(
|
fun printItem(
|
||||||
reportName: String,
|
reportName: String,
|
||||||
printerFk: Int,
|
printerFk: Int,
|
||||||
|
|
|
@ -2,52 +2,41 @@ package es.verdnatura.presentation.view.feature.buscaritem.adapter
|
||||||
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.ItemLocationRowBinding
|
import es.verdnatura.databinding.ItemLocationRowBinding
|
||||||
import es.verdnatura.domain.toast
|
|
||||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||||
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemShelvings
|
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||||
|
|
||||||
class LocationAdapter(
|
class LocationAdapter (
|
||||||
private val items: List<ItemShelvings>,
|
private val items: List<ItemLocationVO>,
|
||||||
private val onPasillerosItemClickListener: OnPasillerosItemClickListener
|
private val onPasillerosItemClickListener: OnPasillerosItemClickListener
|
||||||
) : RecyclerView.Adapter<LocationAdapter.ItemHolder>() {
|
): RecyclerView.Adapter<LocationAdapter.ItemHolder> () {
|
||||||
|
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
|
||||||
return ItemHolder(
|
return ItemHolder(
|
||||||
ItemLocationRowBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
ItemLocationRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getItemCount() = items.size
|
override fun getItemCount() =items.size
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
|
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
|
||||||
holder.bind(items[position])
|
holder.bind(items[position])
|
||||||
holder.binding.root.setOnClickListener {
|
holder.binding.root.setOnClickListener {
|
||||||
onPasillerosItemClickListener.onPasillerosItemClickListener(
|
onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title =
|
||||||
PasillerosItemVO(
|
R.string.titleUbicator),items[position].Matricula)
|
||||||
title =
|
|
||||||
R.string.titleUbicator
|
|
||||||
), items[position].shelving.code
|
|
||||||
)
|
|
||||||
}
|
|
||||||
holder.binding.root.setOnLongClickListener {
|
|
||||||
items[position].shelving.parking!!.sector.description.toast(
|
|
||||||
holder.binding.root.context,
|
|
||||||
Toast.LENGTH_SHORT
|
|
||||||
)
|
|
||||||
true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ItemHolder(
|
class ItemHolder(
|
||||||
val binding: ItemLocationRowBinding
|
val binding: ItemLocationRowBinding
|
||||||
) : RecyclerView.ViewHolder(binding.root) {
|
) : RecyclerView.ViewHolder(binding.root){
|
||||||
fun bind(item: ItemShelvings) {
|
//private val res = binding.root.context.resources
|
||||||
|
fun bind(item: ItemLocationVO) {
|
||||||
binding.apply {
|
binding.apply {
|
||||||
this.item = item
|
this.item = item
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,62 +0,0 @@
|
||||||
package es.verdnatura.presentation.view.feature.buscaritem.fragment
|
|
||||||
|
|
||||||
import es.verdnatura.domain.SalixCallback
|
|
||||||
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
|
||||||
import es.verdnatura.presentation.base.BaseViewModelCompose
|
|
||||||
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemShelvings
|
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
|
||||||
import kotlinx.coroutines.flow.asStateFlow
|
|
||||||
import kotlinx.coroutines.flow.update
|
|
||||||
import retrofit2.Response
|
|
||||||
|
|
||||||
data class UiState(
|
|
||||||
val itemFk: String? = null,
|
|
||||||
val items: List<ItemShelvings> = emptyList(),
|
|
||||||
val isLoading: Boolean = false
|
|
||||||
)
|
|
||||||
|
|
||||||
class BuscarItemComposeViewModel(var application: android.app.Application) :
|
|
||||||
BaseViewModelCompose(application) {
|
|
||||||
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
|
|
||||||
|
|
||||||
private val _uiState = MutableStateFlow(UiState())
|
|
||||||
val uiState = _uiState.asStateFlow()
|
|
||||||
|
|
||||||
fun getIdFromCodeSalix(code: String) {
|
|
||||||
_uiState.update { it.copy(itemFk = code, isLoading = true) }
|
|
||||||
getItemFromBarcodeUseCase.execute(code)
|
|
||||||
.enqueue(object : SalixCallback<Int?>(application.applicationContext) {
|
|
||||||
override fun onSuccess(response: Response<Int?>) {
|
|
||||||
response.body()?.let { id ->
|
|
||||||
itemshelvingsGet(id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onError(t: Throwable) {
|
|
||||||
super.onError(t)
|
|
||||||
_uiState.update { it.copy(isLoading = false) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun itemshelvingsGet(itemFk: Any) {
|
|
||||||
salix.itemShelvingsGet(
|
|
||||||
filter = """{"where":{"itemFk":$itemFk},"fields":["created","visible","available","shelvingFk"],
|
|
||||||
|"include":[{"relation":"shelving","scope":{"fields":["code","priority","parkingFk"],
|
|
||||||
|"include":{"relation":"parking","scope":{"fields":["code","sectorFk"]}}}}]}""".trimMargin()
|
|
||||||
)
|
|
||||||
.enqueue(object : SalixCallback<List<ItemShelvings>>(application.applicationContext) {
|
|
||||||
override fun onSuccess(response: Response<List<ItemShelvings>>) {
|
|
||||||
response.body()?.let { list ->
|
|
||||||
_uiState.update { it.copy(items = list, isLoading = false) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onError(t: Throwable) {
|
|
||||||
super.onError(t)
|
|
||||||
_uiState.update { it.copy(isLoading = false) }
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -10,7 +10,6 @@ import es.verdnatura.presentation.base.BaseFragment
|
||||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||||
import es.verdnatura.presentation.common.itemScanValue
|
import es.verdnatura.presentation.common.itemScanValue
|
||||||
import es.verdnatura.presentation.view.feature.buscaritem.adapter.LocationAdapter
|
import es.verdnatura.presentation.view.feature.buscaritem.adapter.LocationAdapter
|
||||||
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemShelvings
|
|
||||||
|
|
||||||
class BuscarItemFragment(
|
class BuscarItemFragment(
|
||||||
var itemFk: Any? = null
|
var itemFk: Any? = null
|
||||||
|
@ -31,10 +30,10 @@ class BuscarItemFragment(
|
||||||
override fun getLayoutId(): Int = R.layout.fragment_buscar_item
|
override fun getLayoutId(): Int = R.layout.fragment_buscar_item
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
binding.mainToolbar.toolbarTitle.text = getString(R.string.getubication)
|
binding.mainToolbar.toolbarTitle.text = getString(R.string.getubicaition)
|
||||||
setEvents()
|
setEvents()
|
||||||
if (itemFk != null) {
|
if (itemFk != null) {
|
||||||
viewModel.getIdFromCodeSalix(itemFk!!.toString())
|
getLocations(itemFk!!)
|
||||||
}
|
}
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
@ -67,22 +66,17 @@ class BuscarItemFragment(
|
||||||
|
|
||||||
private fun getLocations(itemFk: Any) {
|
private fun getLocations(itemFk: Any) {
|
||||||
this.itemFk = itemFk
|
this.itemFk = itemFk
|
||||||
viewModel.getIdFromCodeSalix(itemFk.toString())
|
viewModel.itemshelvingGetInfo(itemFk)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun observeViewModel() {
|
override fun observeViewModel() {
|
||||||
with(viewModel) {
|
with(viewModel) {
|
||||||
|
loadLocationList.observe(viewLifecycleOwner) { event ->
|
||||||
loadItemShelvingsList.observe(viewLifecycleOwner) { event ->
|
|
||||||
|
|
||||||
event.getContentIfNotHandled().notNull { itemResponse ->
|
event.getContentIfNotHandled().notNull { itemResponse ->
|
||||||
|
|
||||||
try {
|
try {
|
||||||
val sortedList = itemResponse.list.sortedWith(
|
adapter = LocationAdapter(itemResponse.list, pasillerosItemClickListener!!)
|
||||||
compareByDescending<ItemShelvings> { it.shelving.priority }
|
|
||||||
.thenBy { it.created }
|
|
||||||
)
|
|
||||||
adapter = LocationAdapter(sortedList, pasillerosItemClickListener!!)
|
|
||||||
binding.locationRecyclerview.adapter = adapter
|
binding.locationRecyclerview.adapter = adapter
|
||||||
binding.locationRecyclerview.layoutManager =
|
binding.locationRecyclerview.layoutManager =
|
||||||
LinearLayoutManager(
|
LinearLayoutManager(
|
||||||
|
@ -91,7 +85,6 @@ class BuscarItemFragment(
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
} catch (ex: Exception) {
|
} catch (ex: Exception) {
|
||||||
println("errorrrr ${ex.message}")
|
|
||||||
ma.messageWithSound(
|
ma.messageWithSound(
|
||||||
message = ex.message.toString(),
|
message = ex.message.toString(),
|
||||||
isError = true,
|
isError = true,
|
||||||
|
|
|
@ -1,74 +0,0 @@
|
||||||
package es.verdnatura.presentation.view.feature.buscaritem.fragment
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.compose.ui.platform.ComposeView
|
|
||||||
import androidx.fragment.app.Fragment
|
|
||||||
import es.verdnatura.R
|
|
||||||
import es.verdnatura.domain.toast
|
|
||||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
|
||||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
|
||||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
|
||||||
|
|
||||||
class BuscarItemFragmentCompose(
|
|
||||||
var itemFk: Any? = null
|
|
||||||
) : Fragment() {
|
|
||||||
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
|
|
||||||
private val viewModel: BuscarItemComposeViewModel by viewModel()
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
fun newInstance(entryPoint: Int?) = BuscarItemFragmentCompose(entryPoint)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onAttach(context: Context) {
|
|
||||||
super.onAttach(context)
|
|
||||||
if (context is OnPasillerosItemClickListener) pasillerosItemClickListener = context
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreateView(
|
|
||||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
|
||||||
): View {
|
|
||||||
return ComposeView(requireContext()).apply {
|
|
||||||
setContent {
|
|
||||||
BuscarItemScreen(
|
|
||||||
viewModel = viewModel,
|
|
||||||
onBackClick = { (context as MainActivity).onMyBackPressed() },
|
|
||||||
onItemLongClick = { sector -> sector.toast(requireContext()) },
|
|
||||||
onItemClick = { shelving ->
|
|
||||||
pasillerosItemClickListener?.onPasillerosItemClickListener(
|
|
||||||
PasillerosItemVO(title = R.string.titleUbicator),
|
|
||||||
shelving
|
|
||||||
)
|
|
||||||
},
|
|
||||||
title = getString(R.string.getubication)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
||||||
super.onViewCreated(view, savedInstanceState)
|
|
||||||
itemFk?.let {
|
|
||||||
viewModel.getIdFromCodeSalix(it.toString())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun showSector(item: LocationItem) {
|
|
||||||
item.sector.toast(requireContext())
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun openUbicadorFragment(item: LocationItem) {
|
|
||||||
pasillerosItemClickListener!!.onPasillerosItemClickListener(
|
|
||||||
PasillerosItemVO(
|
|
||||||
title =
|
|
||||||
R.string.titleUbicator
|
|
||||||
), item.matricula
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -5,49 +5,24 @@ import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.map
|
import androidx.lifecycle.map
|
||||||
import es.verdnatura.domain.SalixCallback
|
import es.verdnatura.domain.SalixCallback
|
||||||
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
import es.verdnatura.domain.formatWithQuotes
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
import es.verdnatura.presentation.common.Event
|
import es.verdnatura.presentation.common.Event
|
||||||
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemShelvings
|
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO
|
||||||
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemShelvingsList
|
import es.verdnatura.presentation.view.feature.buscaritem.model.LocationListVO
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class BuscarItemViewModel(val context: Context) : BaseViewModel(context) {
|
class BuscarItemViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
private val _locationList by lazy { MutableLiveData<LocationListVO>() }
|
||||||
|
val locationList: LiveData<LocationListVO>
|
||||||
|
get() = _locationList
|
||||||
|
val loadLocationList: LiveData<Event<LocationListVO>> = _locationList.map { Event(it) }
|
||||||
|
|
||||||
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
|
fun itemshelvingGetInfo(itemFk: Any) {
|
||||||
|
salix.itemshelvingGetInfo(params = arrayListOf(itemFk).formatWithQuotes())
|
||||||
private val _itemShelvingsList by lazy { MutableLiveData<ItemShelvingsList>() }
|
.enqueue(object : SalixCallback<List<ItemLocationVO>>(context) {
|
||||||
val itemShelvingsList: LiveData<ItemShelvingsList> = _itemShelvingsList
|
override fun onSuccess(response: Response<List<ItemLocationVO>>) {
|
||||||
val loadItemShelvingsList: LiveData<Event<ItemShelvingsList>> =
|
_locationList.value = response.body()?.let { LocationListVO(it) }
|
||||||
_itemShelvingsList.map { Event(it) }
|
|
||||||
|
|
||||||
fun getIdFromCodeSalix(code: String) {
|
|
||||||
getItemFromBarcodeUseCase.execute(code)
|
|
||||||
.enqueue(object : SalixCallback<Int?>(context) {
|
|
||||||
|
|
||||||
override fun onSuccess(response: Response<Int?>) {
|
|
||||||
if (response.body() != null) {
|
|
||||||
itemshelvingsGet(response.body()!!)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fun itemshelvingsGet(itemFk: Any) {
|
|
||||||
salix.itemShelvingsGet(
|
|
||||||
filter = """{"where":{"itemFk":$itemFk},"fields":["created","visible","available","shelvingFk"],
|
|
||||||
|"include":[{"relation":"shelving","scope":{"fields":["code","priority","parkingFk"],
|
|
||||||
|"include":{"relation":"parking","scope":{"fields":["code","sectorFk"]}}}}]}""".trimMargin()
|
|
||||||
)
|
|
||||||
.enqueue(object : SalixCallback<List<ItemShelvings>>(context) {
|
|
||||||
override fun onSuccess(response: Response<List<ItemShelvings>>) {
|
|
||||||
_itemShelvingsList.value = response.body()?.let {
|
|
||||||
val filteredList = it.filter { itemShelving ->
|
|
||||||
itemShelving.shelving.parking != null
|
|
||||||
}
|
|
||||||
ItemShelvingsList(filteredList)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,378 +0,0 @@
|
||||||
package es.verdnatura.presentation.view.feature.buscaritem.fragment
|
|
||||||
|
|
||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
|
||||||
import androidx.compose.foundation.background
|
|
||||||
import androidx.compose.foundation.combinedClickable
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
|
||||||
import androidx.compose.foundation.layout.Box
|
|
||||||
import androidx.compose.foundation.layout.Column
|
|
||||||
import androidx.compose.foundation.layout.Row
|
|
||||||
import androidx.compose.foundation.layout.Spacer
|
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
|
||||||
import androidx.compose.foundation.layout.height
|
|
||||||
import androidx.compose.foundation.layout.padding
|
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
|
||||||
import androidx.compose.foundation.lazy.items
|
|
||||||
import androidx.compose.material3.HorizontalDivider
|
|
||||||
import androidx.compose.material3.Text
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
|
||||||
import androidx.compose.runtime.getValue
|
|
||||||
import androidx.compose.runtime.mutableStateOf
|
|
||||||
import androidx.compose.runtime.remember
|
|
||||||
import androidx.compose.runtime.setValue
|
|
||||||
import androidx.compose.ui.Alignment
|
|
||||||
import androidx.compose.ui.Modifier
|
|
||||||
import androidx.compose.ui.focus.FocusRequester
|
|
||||||
import androidx.compose.ui.focus.focusRequester
|
|
||||||
import androidx.compose.ui.focus.onFocusEvent
|
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import androidx.compose.ui.platform.LocalContext
|
|
||||||
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
|
||||||
import androidx.compose.ui.res.stringResource
|
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import androidx.compose.ui.unit.sp
|
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
|
||||||
import es.verdnatura.R
|
|
||||||
import es.verdnatura.presentation.composable.CustomToolbar
|
|
||||||
import es.verdnatura.presentation.composable.LottieLoadingAnimation
|
|
||||||
import es.verdnatura.presentation.composable.ScanLineTextSearch
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun BuscarItemScreen(
|
|
||||||
viewModel: BuscarItemComposeViewModel,
|
|
||||||
onBackClick: () -> Unit,
|
|
||||||
onItemLongClick: (sector: String) -> Unit,
|
|
||||||
onItemClick: (matricula: String) -> Unit,
|
|
||||||
title: String
|
|
||||||
) {
|
|
||||||
val uiState by viewModel.uiState.collectAsStateWithLifecycle()
|
|
||||||
|
|
||||||
val locationItems = uiState.items
|
|
||||||
.filter { it.shelving.parking != null }
|
|
||||||
.map {
|
|
||||||
LocationItem(
|
|
||||||
parking = it.shelving.parking!!.code,
|
|
||||||
matricula = it.shelving.code,
|
|
||||||
visible = it.visible.toString(),
|
|
||||||
reserve = it.available.toString(),
|
|
||||||
priority = it.shelving.priority.toString(),
|
|
||||||
fecha = it.created,
|
|
||||||
sector = it.shelving.parking.sector.description
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
LocationScreenContent(
|
|
||||||
items = locationItems,
|
|
||||||
isLoading = uiState.isLoading,
|
|
||||||
titleToolBar = if (uiState.itemFk != null) {
|
|
||||||
LocalContext.current.getString(
|
|
||||||
R.string.itemsTotal,
|
|
||||||
uiState.itemFk,
|
|
||||||
LocalContext.current.getString(R.string.visibleTotal),
|
|
||||||
uiState.items
|
|
||||||
.filter { it.shelving.parking != null }
|
|
||||||
.sumOf { it.visible }
|
|
||||||
)
|
|
||||||
} else title,
|
|
||||||
onTextChange = { input -> viewModel.getIdFromCodeSalix(input) },
|
|
||||||
onBackClick = onBackClick,
|
|
||||||
onLongClick = onItemLongClick,
|
|
||||||
onClick = onItemClick,
|
|
||||||
modifier = Modifier
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
private fun LocationScreenContent(
|
|
||||||
items: List<LocationItem>,
|
|
||||||
isLoading: Boolean,
|
|
||||||
titleToolBar: String,
|
|
||||||
onTextChange: (String) -> Unit,
|
|
||||||
onBackClick: () -> Unit,
|
|
||||||
onLongClick: (String) -> Unit,
|
|
||||||
onClick: (String) -> Unit,
|
|
||||||
modifier: Modifier
|
|
||||||
) {
|
|
||||||
var searchText by remember { mutableStateOf("") }
|
|
||||||
val focusRequester = remember { FocusRequester() }
|
|
||||||
val keyboardController = LocalSoftwareKeyboardController.current
|
|
||||||
|
|
||||||
val onImeAction: () -> Unit = {
|
|
||||||
onTextChange(searchText)
|
|
||||||
searchText = ""
|
|
||||||
keyboardController?.hide()
|
|
||||||
}
|
|
||||||
Box(
|
|
||||||
modifier = modifier
|
|
||||||
.fillMaxSize()
|
|
||||||
.background(Color.Black)
|
|
||||||
) {
|
|
||||||
Column(
|
|
||||||
modifier = modifier
|
|
||||||
.fillMaxSize()
|
|
||||||
.background(Color.Black)
|
|
||||||
|
|
||||||
) {
|
|
||||||
|
|
||||||
CustomToolbar(
|
|
||||||
title = titleToolBar,
|
|
||||||
subtitle = "",
|
|
||||||
showBackButton = true,
|
|
||||||
showSwitch = false,
|
|
||||||
iconList = listOf(),
|
|
||||||
onBackClick = onBackClick,
|
|
||||||
onSwitchChange = { },
|
|
||||||
|
|
||||||
)
|
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
|
||||||
|
|
||||||
|
|
||||||
ScanLineTextSearch(
|
|
||||||
value = searchText,
|
|
||||||
onValueChange = {
|
|
||||||
searchText = it
|
|
||||||
},
|
|
||||||
onImeAction,
|
|
||||||
modifier = Modifier
|
|
||||||
.focusRequester(focusRequester)
|
|
||||||
.onFocusEvent {
|
|
||||||
if (it.isFocused) {
|
|
||||||
keyboardController?.hide() // Asegura que el teclado no se abra
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
LaunchedEffect(Unit) {
|
|
||||||
focusRequester.requestFocus()
|
|
||||||
keyboardController?.hide()
|
|
||||||
}
|
|
||||||
|
|
||||||
Row(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(vertical = 8.dp),
|
|
||||||
horizontalArrangement = Arrangement.Start
|
|
||||||
) {
|
|
||||||
listOf(
|
|
||||||
R.string.parking,
|
|
||||||
R.string.Matrícula,
|
|
||||||
R.string.Visible,
|
|
||||||
R.string.reserve,
|
|
||||||
R.string.priority,
|
|
||||||
R.string.date
|
|
||||||
).forEach { textRes ->
|
|
||||||
Text(
|
|
||||||
text = stringResource(id = textRes),
|
|
||||||
color = Color.White,
|
|
||||||
fontSize = 14.sp,
|
|
||||||
modifier = Modifier.weight(1f)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HorizontalDivider(thickness = 1.dp, color = Color.White)
|
|
||||||
LazyColumn(
|
|
||||||
modifier = Modifier.fillMaxSize()
|
|
||||||
) {
|
|
||||||
|
|
||||||
items(items) { item ->
|
|
||||||
|
|
||||||
LocationRow(
|
|
||||||
item = item,
|
|
||||||
onLongClick = { selectedItem ->
|
|
||||||
onLongClick(selectedItem.sector)
|
|
||||||
},
|
|
||||||
onClick = { selectedItem ->
|
|
||||||
onClick(selectedItem.matricula)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
HorizontalDivider(thickness = 1.dp, color = Color.White)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isLoading) {
|
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxSize()
|
|
||||||
.background(Color.Black.copy(alpha = 0.7f)),
|
|
||||||
contentAlignment = Alignment.Center
|
|
||||||
) {
|
|
||||||
LottieLoadingAnimation(true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Como estaba
|
|
||||||
|
|
||||||
/*@Composable
|
|
||||||
fun LocationScreen(
|
|
||||||
//viewModel: ViewModel?, // Falta ver de arreglar con koin o viewmodel → No necesario, en el Fragment observa
|
|
||||||
items: List<LocationItem>,
|
|
||||||
onTextChange: (String) -> Unit,
|
|
||||||
titleToolBar: String,
|
|
||||||
onBackClick: () -> Unit = {},
|
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
onLongClick: (LocationItem) -> Unit,
|
|
||||||
onClick: (LocationItem) -> Unit
|
|
||||||
) {
|
|
||||||
|
|
||||||
var searchText by remember { mutableStateOf("") }
|
|
||||||
val focusRequester = remember { FocusRequester() }
|
|
||||||
val keyboardController = LocalSoftwareKeyboardController.current
|
|
||||||
var showLoading by remember { mutableStateOf(false) }
|
|
||||||
|
|
||||||
val onImeAction: () -> Unit = {
|
|
||||||
onTextChange(searchText)
|
|
||||||
searchText = ""
|
|
||||||
keyboardController?.hide()
|
|
||||||
}
|
|
||||||
Box(
|
|
||||||
modifier = modifier
|
|
||||||
.fillMaxSize()
|
|
||||||
.background(Color.Black)
|
|
||||||
) {
|
|
||||||
Column(
|
|
||||||
modifier = modifier
|
|
||||||
.fillMaxSize()
|
|
||||||
.background(Color.Black)
|
|
||||||
|
|
||||||
) {
|
|
||||||
if (showLoading) {
|
|
||||||
LottieLoadingAnimation(true)
|
|
||||||
}
|
|
||||||
CustomToolbar(
|
|
||||||
title = titleToolBar,
|
|
||||||
subtitle = "",
|
|
||||||
showBackButton = true,
|
|
||||||
showSwitch = false,
|
|
||||||
iconList = listOf(),
|
|
||||||
onBackClick = onBackClick,
|
|
||||||
onSwitchChange = { },
|
|
||||||
|
|
||||||
)
|
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
|
||||||
|
|
||||||
|
|
||||||
ScanLineTextSearch(
|
|
||||||
value = searchText,
|
|
||||||
onValueChange = {
|
|
||||||
searchText = it
|
|
||||||
showLoading = true
|
|
||||||
},
|
|
||||||
onImeAction,
|
|
||||||
modifier = Modifier
|
|
||||||
.focusRequester(focusRequester)
|
|
||||||
.onFocusEvent {
|
|
||||||
if (it.isFocused) {
|
|
||||||
keyboardController?.hide() // Asegura que el teclado no se abra
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
LaunchedEffect(Unit) {
|
|
||||||
focusRequester.requestFocus()
|
|
||||||
keyboardController?.hide()
|
|
||||||
}
|
|
||||||
|
|
||||||
Row(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(vertical = 8.dp),
|
|
||||||
horizontalArrangement = Arrangement.Start
|
|
||||||
) {
|
|
||||||
listOf(
|
|
||||||
R.string.parking,
|
|
||||||
R.string.Matrícula,
|
|
||||||
R.string.Visible,
|
|
||||||
R.string.reserve,
|
|
||||||
R.string.priority,
|
|
||||||
R.string.date
|
|
||||||
).forEach { textRes ->
|
|
||||||
Text(
|
|
||||||
text = stringResource(id = textRes),
|
|
||||||
color = Color.White,
|
|
||||||
fontSize = 14.sp,
|
|
||||||
modifier = Modifier.weight(1f)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HorizontalDivider(thickness = 1.dp, color = Color.White)
|
|
||||||
LazyColumn(
|
|
||||||
modifier = Modifier.fillMaxSize()
|
|
||||||
) {
|
|
||||||
|
|
||||||
items(items) { item ->
|
|
||||||
|
|
||||||
LocationRow(
|
|
||||||
item = item,
|
|
||||||
onLongClick = { selectedItem ->
|
|
||||||
onLongClick(selectedItem)
|
|
||||||
},
|
|
||||||
onClick = { selectedItem ->
|
|
||||||
onClick(selectedItem)
|
|
||||||
},
|
|
||||||
)
|
|
||||||
HorizontalDivider(thickness = 1.dp, color = Color.White)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
showLoading = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
@OptIn(ExperimentalFoundationApi::class)
|
|
||||||
@Composable
|
|
||||||
fun LocationRow(
|
|
||||||
item: LocationItem, onLongClick: (LocationItem) -> Unit, onClick: (LocationItem) -> Unit
|
|
||||||
) {
|
|
||||||
Row(modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(vertical = 4.dp)
|
|
||||||
.combinedClickable(onClick = { onClick(item) }, onLongClick = { onLongClick(item) }
|
|
||||||
|
|
||||||
), horizontalArrangement = Arrangement.SpaceEvenly) {
|
|
||||||
Text(text = item.parking, color = Color.White, modifier = Modifier.weight(1f))
|
|
||||||
Text(text = item.matricula, color = Color.White, modifier = Modifier.weight(1f))
|
|
||||||
Text(text = item.visible, color = Color.White, modifier = Modifier.weight(1f))
|
|
||||||
Text(text = item.reserve, color = Color.White, modifier = Modifier.weight(1f))
|
|
||||||
Text(text = item.priority, color = Color.White, modifier = Modifier.weight(1f))
|
|
||||||
Text(
|
|
||||||
text = item.fecha,
|
|
||||||
color = Color.White,
|
|
||||||
modifier = Modifier.weight(1f),
|
|
||||||
textAlign = TextAlign.Center
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Modelo de datos
|
|
||||||
data class LocationItem(
|
|
||||||
val parking: String,
|
|
||||||
val matricula: String,
|
|
||||||
val visible: String,
|
|
||||||
val reserve: String,
|
|
||||||
val priority: String,
|
|
||||||
val fecha: String,
|
|
||||||
val sector: String
|
|
||||||
)
|
|
||||||
|
|
||||||
// Vista previa
|
|
||||||
/*@Preview(showBackground = true)
|
|
||||||
@Composable
|
|
||||||
fun PreviewLocationScreen() {
|
|
||||||
LocationScreen(
|
|
||||||
items = listOf(
|
|
||||||
LocationItem("P1", "1234ABC", "Sí", "No", "Alta", "12/02/2025", "previa"),
|
|
||||||
LocationItem("P2", "5678DEF", "No", "Sí", "Baja", "13/02/2025", "previa")
|
|
||||||
),
|
|
||||||
onTextChange = {},
|
|
||||||
titleToolBar = "Buscar Item",
|
|
||||||
onBackClick = {},
|
|
||||||
onLongClick = {},
|
|
||||||
onClick = {})
|
|
||||||
|
|
||||||
}*/
|
|
|
@ -2,27 +2,21 @@ package es.verdnatura.presentation.view.feature.buscaritem.model
|
||||||
|
|
||||||
import es.verdnatura.domain.isoToString
|
import es.verdnatura.domain.isoToString
|
||||||
|
|
||||||
class ItemShelvingsList(
|
class ItemLocationVO(
|
||||||
var list: List<ItemShelvings> = listOf()
|
var Parking: String = "",
|
||||||
)
|
var Matricula: String = "",
|
||||||
|
var visible: Int = 0,
|
||||||
|
var itemFk: Int = 0,
|
||||||
|
var priority: Int = 0
|
||||||
|
|
||||||
data class ItemShelvings(
|
|
||||||
val visible: Int, val available: Int, val shelving: Shelving
|
|
||||||
) {
|
) {
|
||||||
var created: String = ""
|
var created: String = ""
|
||||||
get() {
|
get() {
|
||||||
return field.isoToString()
|
return field.isoToString()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
data class Shelving(
|
class LocationListVO(
|
||||||
val code: String, val priority: Int, val parking: Parking?
|
var list: List<ItemLocationVO> = listOf()
|
||||||
)
|
|
||||||
|
|
||||||
data class Parking(
|
|
||||||
val code: String, val sector: Sector
|
|
||||||
)
|
|
||||||
|
|
||||||
data class Sector(
|
|
||||||
val description: String
|
|
||||||
)
|
)
|
|
@ -181,11 +181,9 @@ class ReubicationCollectionFragment(
|
||||||
private fun customDialogMerge(itemReubication: Reubication) {
|
private fun customDialogMerge(itemReubication: Reubication) {
|
||||||
|
|
||||||
if (customDialogInputTwoValues.getValueTwo().isNotEmpty()) {
|
if (customDialogInputTwoValues.getValueTwo().isNotEmpty()) {
|
||||||
viewModel.getMergeFromCode(
|
viewModel.itemShelvingMerge(
|
||||||
itemReubication.id,
|
itemReubication.id, customDialogInputTwoValues.getValueTwo().uppercase()
|
||||||
customDialogInputTwoValues.getValueTwo().uppercase()
|
|
||||||
)
|
)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ma.messageWithSound(
|
ma.messageWithSound(
|
||||||
getString(R.string.returnScan), isError = true, isPlayed = true, isToasted = true
|
getString(R.string.returnScan), isError = true, isPlayed = true, isToasted = true
|
||||||
|
|
|
@ -56,8 +56,6 @@ class ReubicationFragment(var entrypoint: String) :
|
||||||
if (!binding.scanInput.text.isNullOrEmpty()) {
|
if (!binding.scanInput.text.isNullOrEmpty()) {
|
||||||
|
|
||||||
shelvingScaned = binding.scanInput.text.toString()
|
shelvingScaned = binding.scanInput.text.toString()
|
||||||
|
|
||||||
|
|
||||||
viewModel.itemShelvingAlternative(
|
viewModel.itemShelvingAlternative(
|
||||||
shelvingFk = binding.scanInput.text.toString(),
|
shelvingFk = binding.scanInput.text.toString(),
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,31 +1,28 @@
|
||||||
package es.verdnatura.presentation.view.feature.collection.adapter
|
package es.verdnatura.presentation.view.feature.collection.adapter
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Paint
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.ItemPlacementRowBinding
|
import es.verdnatura.databinding.ItemPlacementRowBinding
|
||||||
import es.verdnatura.domain.ConstAndValues.CONTROLADOR
|
|
||||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.PlacementVO
|
import es.verdnatura.presentation.view.feature.sacador.model.PlacementVO
|
||||||
|
|
||||||
class PlacementAdapter(
|
class PlacementAdapter (
|
||||||
private val items: List<PlacementVO>,
|
private val items: List<PlacementVO>,
|
||||||
private val onPasillerosItemClickListener: OnPasillerosItemClickListener,
|
private val onPasillerosItemClickListener: OnPasillerosItemClickListener
|
||||||
private val type: String? = null
|
): RecyclerView.Adapter<PlacementAdapter.AjustesItemHolder> () {
|
||||||
) : RecyclerView.Adapter<PlacementAdapter.AjustesItemHolder>() {
|
|
||||||
var context: Context? = null
|
var context: Context? = null
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AjustesItemHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AjustesItemHolder {
|
||||||
this.context = parent.context
|
this.context = parent.context
|
||||||
return AjustesItemHolder(
|
return AjustesItemHolder(
|
||||||
ItemPlacementRowBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
ItemPlacementRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getItemCount() = items.size
|
override fun getItemCount() =items.size
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: AjustesItemHolder, position: Int) {
|
override fun onBindViewHolder(holder: AjustesItemHolder, position: Int) {
|
||||||
holder.bind(items[position])
|
holder.bind(items[position])
|
||||||
|
@ -33,26 +30,19 @@ class PlacementAdapter(
|
||||||
|
|
||||||
inner class AjustesItemHolder(
|
inner class AjustesItemHolder(
|
||||||
val binding: ItemPlacementRowBinding
|
val binding: ItemPlacementRowBinding
|
||||||
) : RecyclerView.ViewHolder(binding.root) {
|
) : RecyclerView.ViewHolder(binding.root){
|
||||||
fun bind(placement: PlacementVO) {
|
fun bind(placement: PlacementVO) {
|
||||||
binding.apply {
|
binding.apply {
|
||||||
if (placement.placement.isNullOrEmpty()) placement.placement = placement.parking
|
if (placement.placement.isNullOrEmpty())
|
||||||
if (placement.visible.isNullOrEmpty()) placement.visible =
|
placement.placement = placement.parking
|
||||||
"(" + placement.stockTotal + ")"
|
if (placement.visible.isNullOrEmpty())
|
||||||
|
placement.visible = "("+placement.stockTotal+")"
|
||||||
this.item = placement
|
this.item = placement
|
||||||
|
|
||||||
itemRootLayout.setOnClickListener {
|
itemRootLayout.setOnClickListener {
|
||||||
onPasillerosItemClickListener.onPasillerosItemClickListener(
|
onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title =
|
||||||
PasillerosItemVO(
|
R.string.titleUbicator),placement.shelving)
|
||||||
title = R.string.titleUbicator
|
|
||||||
), placement.shelving
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
if (type == CONTROLADOR) {
|
|
||||||
placementcode.paintFlags = placementcode.paintFlags or Paint.UNDERLINE_TEXT_FLAG
|
|
||||||
placementcode.paintFlags = placementcode.paintFlags or Paint.UNDERLINE_TEXT_FLAG
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,12 +3,10 @@ package es.verdnatura.presentation.view.feature.collection.adapter
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.res.ColorStateList
|
import android.content.res.ColorStateList
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.graphics.Paint
|
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.View.GONE
|
import android.view.View.GONE
|
||||||
import android.view.View.INVISIBLE
|
|
||||||
import android.view.View.VISIBLE
|
import android.view.View.VISIBLE
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.core.content.ContextCompat.getColor
|
import androidx.core.content.ContextCompat.getColor
|
||||||
|
@ -85,7 +83,7 @@ class SaleAdapter(
|
||||||
|
|
||||||
itemArticlePlacements.apply {
|
itemArticlePlacements.apply {
|
||||||
layoutManager = childLayoutManager
|
layoutManager = childLayoutManager
|
||||||
adapter = PlacementAdapter(sale.placements, onPasillerosItemClickListener, type)
|
adapter = PlacementAdapter(sale.placements, onPasillerosItemClickListener)
|
||||||
}
|
}
|
||||||
|
|
||||||
//CLICK EVENTS
|
//CLICK EVENTS
|
||||||
|
@ -134,12 +132,9 @@ class SaleAdapter(
|
||||||
|
|
||||||
//ERROR
|
//ERROR
|
||||||
if (sale.originalQuantity != sale.quantity) {
|
if (sale.originalQuantity != sale.quantity) {
|
||||||
layoutError.visibility = VISIBLE
|
layoutError.visibility = View.VISIBLE
|
||||||
txtError.text =
|
txtError.text =
|
||||||
buildString {
|
binding.root.context.getString(R.string.originalQuantity) + sale.originalQuantity
|
||||||
append(binding.root.context.getString(R.string.originalQuantity))
|
|
||||||
append(sale.originalQuantity)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -150,7 +145,7 @@ class SaleAdapter(
|
||||||
// d("VERDNATURA::","La quantity de ${sale.saleFk} es ${sale.pickedQuantity} y está ${sale.isPrepared}")
|
// d("VERDNATURA::","La quantity de ${sale.saleFk} es ${sale.pickedQuantity} y está ${sale.isPrepared}")
|
||||||
|
|
||||||
if (sale.isNew) {
|
if (sale.isNew) {
|
||||||
layoutError.visibility = VISIBLE
|
layoutError.visibility = View.VISIBLE
|
||||||
txtError.text = binding.root.context.getString(R.string.newItem)
|
txtError.text = binding.root.context.getString(R.string.newItem)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -162,7 +157,7 @@ class SaleAdapter(
|
||||||
val backgroundDrawableCon: Drawable = binding.itemArticleRowSemaforoCon.background
|
val backgroundDrawableCon: Drawable = binding.itemArticleRowSemaforoCon.background
|
||||||
|
|
||||||
if (!sale.isNew && sale.originalQuantity == sale.quantity) {
|
if (!sale.isNew && sale.originalQuantity == sale.quantity) {
|
||||||
layoutError.visibility = GONE
|
layoutError.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
//SEMAFORO
|
//SEMAFORO
|
||||||
|
@ -283,10 +278,10 @@ class SaleAdapter(
|
||||||
)*/
|
)*/
|
||||||
} else if (sale.isPreviousPrepared == "1") {
|
} else if (sale.isPreviousPrepared == "1") {
|
||||||
contentLayout.setBackgroundColor(
|
contentLayout.setBackgroundColor(
|
||||||
if (sale.picked == null) getColor(
|
getColor(
|
||||||
context!!,
|
context!!,
|
||||||
R.color.verdnatura_black
|
R.color.verdnatura_dark_sky_blue
|
||||||
) else getColor(context!!, R.color.verdnatura_dark_sky_blue)
|
)
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
contentLayout.setBackgroundColor(getColor(context!!, R.color.verdnatura_black))
|
contentLayout.setBackgroundColor(getColor(context!!, R.color.verdnatura_black))
|
||||||
|
@ -313,53 +308,53 @@ class SaleAdapter(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isExpanded) {
|
if (isExpanded) {
|
||||||
itemArticlePlacements.visibility = VISIBLE
|
itemArticlePlacements.visibility = View.VISIBLE
|
||||||
ivArrow.setImageResource(R.drawable.ic_arrow_down)
|
ivArrow.setImageResource(R.drawable.ic_arrow_down)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
itemArticlePlacements.visibility = GONE
|
itemArticlePlacements.visibility = View.GONE
|
||||||
ivArrow.setImageResource(R.drawable.ic_arrow_up)
|
ivArrow.setImageResource(R.drawable.ic_arrow_up)
|
||||||
}
|
}
|
||||||
|
|
||||||
itemArticlePlacements.visibility = if (isExpanded) VISIBLE else {
|
itemArticlePlacements.visibility = if (isExpanded) View.VISIBLE else {
|
||||||
GONE
|
View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sale.isParent) {
|
if (sale.isParent) {
|
||||||
itemArticleItemFk.visibility = INVISIBLE
|
itemArticleItemFk.visibility = View.INVISIBLE
|
||||||
//itemPackingText.visibility = View.INVISIBLE
|
//itemPackingText.visibility = View.INVISIBLE
|
||||||
//itemPackingItemFk.visibility = View.INVISIBLE
|
//itemPackingItemFk.visibility = View.INVISIBLE
|
||||||
itemArticleCel1.visibility = INVISIBLE
|
itemArticleCel1.visibility = View.INVISIBLE
|
||||||
itemArticleCel2.visibility = INVISIBLE
|
itemArticleCel2.visibility = View.INVISIBLE
|
||||||
itemArticleCel3.visibility = INVISIBLE
|
itemArticleCel3.visibility = View.INVISIBLE
|
||||||
itemArticleQuantity.visibility = INVISIBLE
|
itemArticleQuantity.visibility = View.INVISIBLE
|
||||||
txtdeNew.visibility = INVISIBLE
|
txtdeNew.visibility = View.INVISIBLE
|
||||||
itemArticleQuantityPicked.visibility = INVISIBLE
|
itemArticleQuantityPicked.visibility = View.INVISIBLE
|
||||||
itemArticleQuantityLine3.visibility = VISIBLE
|
itemArticleQuantityLine3.visibility = View.VISIBLE
|
||||||
imageErrorMessage.visibility = INVISIBLE
|
imageErrorMessage.visibility = View.INVISIBLE
|
||||||
ivArrow.visibility = VISIBLE
|
ivArrow.visibility = View.VISIBLE
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
itemArticleItemFk.visibility = VISIBLE
|
itemArticleItemFk.visibility = View.VISIBLE
|
||||||
//itemPackingText.visibility = View.VISIBLE
|
//itemPackingText.visibility = View.VISIBLE
|
||||||
//itemPackingItemFk.visibility = View.VISIBLE
|
//itemPackingItemFk.visibility = View.VISIBLE
|
||||||
itemArticleCel1.visibility = VISIBLE
|
itemArticleCel1.visibility = View.VISIBLE
|
||||||
itemArticleCel2.visibility = VISIBLE
|
itemArticleCel2.visibility = View.VISIBLE
|
||||||
itemArticleCel3.visibility = VISIBLE
|
itemArticleCel3.visibility = View.VISIBLE
|
||||||
itemArticleQuantity.visibility = VISIBLE
|
itemArticleQuantity.visibility = View.VISIBLE
|
||||||
txtdeNew.visibility = VISIBLE
|
txtdeNew.visibility = View.VISIBLE
|
||||||
itemArticleQuantityPicked.visibility = VISIBLE
|
itemArticleQuantityPicked.visibility = View.VISIBLE
|
||||||
itemArticleQuantityLine3.visibility = VISIBLE
|
itemArticleQuantityLine3.visibility = View.VISIBLE
|
||||||
if (type != SACADOR) {
|
if (type != SACADOR) {
|
||||||
val colorRes =
|
val colorRes =
|
||||||
if (sale.hasMistake == true || sale.hasMistake == 1) R.color.verdnatura_red_salix else R.color.verdnatura_black
|
if (sale.hasMistake == true || sale.hasMistake == 1) R.color.verdnatura_red_salix else R.color.verdnatura_black
|
||||||
imageErrorMessage.imageTintList =
|
imageErrorMessage.imageTintList =
|
||||||
ColorStateList.valueOf(getColor(context!!, colorRes))
|
ColorStateList.valueOf(getColor(context!!, colorRes))
|
||||||
imageErrorMessage.visibility = VISIBLE
|
imageErrorMessage.visibility = View.VISIBLE
|
||||||
} else {
|
} else {
|
||||||
imageErrorMessage.visibility = INVISIBLE
|
imageErrorMessage.visibility = View.INVISIBLE
|
||||||
}
|
}
|
||||||
ivArrow.visibility = INVISIBLE
|
ivArrow.visibility = View.INVISIBLE
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sale.sonSales.isNullOrEmpty()) {
|
if (!sale.sonSales.isNullOrEmpty()) {
|
||||||
|
@ -377,7 +372,7 @@ class SaleAdapter(
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//revisar porque incosistencia
|
//revisar porque incosistencia
|
||||||
itemArticlePlacements.visibility = VISIBLE
|
itemArticlePlacements.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
|
|
||||||
/* rvHeadlines.adapter=SaleAdapter(sale.sonSales,onPasillerosItemClickListener,onQuantityClick,onSaleClickListener,onMistakeClickListener,onPackingClick)
|
/* rvHeadlines.adapter=SaleAdapter(sale.sonSales,onPasillerosItemClickListener,onQuantityClick,onSaleClickListener,onMistakeClickListener,onPackingClick)
|
||||||
|
@ -388,11 +383,11 @@ class SaleAdapter(
|
||||||
|
|
||||||
if (isExpanded) {
|
if (isExpanded) {
|
||||||
ivArrow.setImageResource(R.drawable.ic_arrow_up)
|
ivArrow.setImageResource(R.drawable.ic_arrow_up)
|
||||||
itemArticlePlacements.visibility = GONE
|
itemArticlePlacements.visibility = View.GONE
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
ivArrow.setImageResource(R.drawable.ic_arrow_down)
|
ivArrow.setImageResource(R.drawable.ic_arrow_down)
|
||||||
itemArticlePlacements.visibility = VISIBLE
|
itemArticlePlacements.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
isExpanded = !isExpanded
|
isExpanded = !isExpanded
|
||||||
|
|
||||||
|
@ -400,7 +395,7 @@ class SaleAdapter(
|
||||||
}
|
}
|
||||||
|
|
||||||
//Tarea 6607
|
//Tarea 6607
|
||||||
itemArticleCel2Count.visibility = GONE
|
itemArticleCel2Count.visibility = View.GONE
|
||||||
/*itemArticleCel2Count.visibility = if (type == CONTROLADOR) {
|
/*itemArticleCel2Count.visibility = if (type == CONTROLADOR) {
|
||||||
View.VISIBLE
|
View.VISIBLE
|
||||||
} else {
|
} else {
|
||||||
|
@ -423,15 +418,13 @@ class SaleAdapter(
|
||||||
itemTicketColor.setOnClickListener {
|
itemTicketColor.setOnClickListener {
|
||||||
onTicketColorClickListener?.onTicketColorListener(sale)
|
onTicketColorClickListener?.onTicketColorListener(sale)
|
||||||
}
|
}
|
||||||
if (type == CONTROLADOR) {
|
if (type == SACADOR || type == CONTROLADOR) {
|
||||||
itemTicketColor.tooltipText = context!!.getString(R.string.filterLevelColor)
|
itemTicketColor.tooltipText = context!!.getString(R.string.filterLevelColor)
|
||||||
ticketFk.paintFlags = ticketFk.paintFlags or Paint.UNDERLINE_TEXT_FLAG
|
|
||||||
itemArticleItemFk.paintFlags =
|
|
||||||
itemArticleItemFk.paintFlags or Paint.UNDERLINE_TEXT_FLAG
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ticketFk.paintFlags = ticketFk.paintFlags or Paint.UNDERLINE_TEXT_FLAG
|
||||||
|
itemArticleItemFk.paintFlags =
|
||||||
|
itemArticleItemFk.paintFlags or Paint.UNDERLINE_TEXT_FLAG*/
|
||||||
|
|
||||||
|
|
||||||
this.sale = sale
|
this.sale = sale
|
||||||
|
@ -510,4 +503,8 @@ class SaleAdapter(
|
||||||
notifyDataSetChanged() // Notifica al adaptador que los datos han cambiado
|
notifyDataSetChanged() // Notifica al adaptador que los datos han cambiado
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun orderSales(newSales: List<SaleVO>) {
|
||||||
|
|
||||||
|
notifyDataSetChanged() // Notifica al adaptador que los datos han cambiado
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -354,15 +354,7 @@ class SaleAdapterNew(
|
||||||
|
|
||||||
println("parkingCodePrevia ${sale.parkingCodePrevia}")
|
println("parkingCodePrevia ${sale.parkingCodePrevia}")
|
||||||
println("parkingCode ${sale.parkingCode}")
|
println("parkingCode ${sale.parkingCode}")
|
||||||
if (type == PREITEMPICKERTEST) {
|
|
||||||
binding.level.visibility = GONE
|
|
||||||
binding.levelTxt.visibility = GONE
|
|
||||||
binding.ticketOrder.visibility = VISIBLE
|
|
||||||
} else {
|
|
||||||
binding.level.visibility = VISIBLE
|
|
||||||
binding.levelTxt.visibility = VISIBLE
|
|
||||||
binding.ticketOrder.visibility = GONE
|
|
||||||
}
|
|
||||||
this.sale = sale
|
this.sale = sale
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,366 +0,0 @@
|
||||||
package es.verdnatura.presentation.view.feature.collection.adapter
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.res.ColorStateList
|
|
||||||
import android.graphics.Color
|
|
||||||
import android.graphics.drawable.Drawable
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View.GONE
|
|
||||||
import android.view.View.INVISIBLE
|
|
||||||
import android.view.View.VISIBLE
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.core.content.ContextCompat.getColor
|
|
||||||
import androidx.core.graphics.drawable.DrawableCompat
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
|
||||||
import es.verdnatura.R
|
|
||||||
import es.verdnatura.databinding.SaleRowFragmentReserveBinding
|
|
||||||
import es.verdnatura.domain.ConstAndValues.PREITEMPICKERTEST
|
|
||||||
import es.verdnatura.domain.ConstAndValues.PREPARED
|
|
||||||
import es.verdnatura.domain.ConstAndValues.SACADOR
|
|
||||||
import es.verdnatura.presentation.common.OnAddItemClickListener
|
|
||||||
import es.verdnatura.presentation.common.OnMistakeClickListener
|
|
||||||
import es.verdnatura.presentation.common.OnPackingClickSaleListener
|
|
||||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
|
||||||
import es.verdnatura.presentation.common.OnSaleClickSaleListener
|
|
||||||
import es.verdnatura.presentation.common.OnSaleReserveClickListener
|
|
||||||
import es.verdnatura.presentation.common.OnTicketClickSaleListener
|
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.Sale
|
|
||||||
|
|
||||||
class SaleAdapterReserve(
|
|
||||||
private val items: List<Sale>,
|
|
||||||
private val onPasillerosItemClickListener: OnPasillerosItemClickListener,
|
|
||||||
private val onSaleClickListener: OnSaleClickSaleListener,
|
|
||||||
private val onMistakeClickListener: OnMistakeClickListener,
|
|
||||||
private val onPackingClick: OnPackingClickSaleListener,
|
|
||||||
private var onTicketClick: OnTicketClickSaleListener? = null,
|
|
||||||
private var saleAdapter: SaleAdapterReserve? = null,
|
|
||||||
private var onReserveSaleClick: OnSaleReserveClickListener? = null,
|
|
||||||
private var onAddItemClickListener: OnAddItemClickListener? = null,
|
|
||||||
private var type: String? = null,
|
|
||||||
|
|
||||||
) : RecyclerView.Adapter<SaleAdapterReserve.AjustesItemHolder>() {
|
|
||||||
var context: Context? = null
|
|
||||||
var position: Int = 0
|
|
||||||
|
|
||||||
var isExpanded: Boolean = type == "PRECHECKER"
|
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AjustesItemHolder {
|
|
||||||
this.context = parent.context
|
|
||||||
|
|
||||||
|
|
||||||
return AjustesItemHolder(
|
|
||||||
|
|
||||||
SaleRowFragmentReserveBinding.inflate(
|
|
||||||
LayoutInflater.from(parent.context), parent, false
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getItemCount() = items.size
|
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: AjustesItemHolder, position: Int) {
|
|
||||||
this.position = position
|
|
||||||
val item = items[position]
|
|
||||||
val calculatedValues = precalculateDisplayValues(item)
|
|
||||||
holder.bind(item, calculatedValues)
|
|
||||||
}
|
|
||||||
|
|
||||||
inner class AjustesItemHolder(
|
|
||||||
val binding: SaleRowFragmentReserveBinding
|
|
||||||
) : RecyclerView.ViewHolder(binding.root) {
|
|
||||||
fun bind(sale: Sale, calculatedValues: Pair<String, String>) {
|
|
||||||
binding.apply {
|
|
||||||
println("type $type ")
|
|
||||||
println("type isExpanded $isExpanded")
|
|
||||||
/* val childLayoutManager =
|
|
||||||
LinearLayoutManager(context!!, RecyclerView.HORIZONTAL, false)
|
|
||||||
*/
|
|
||||||
val childLayoutManagerV =
|
|
||||||
LinearLayoutManager(context!!, RecyclerView.VERTICAL, false)
|
|
||||||
|
|
||||||
/* itemArticlePlacements.apply {
|
|
||||||
layoutManager = childLayoutManager
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
//CLICK EVENTS
|
|
||||||
contentLayout.setOnClickListener {
|
|
||||||
if (!sale.isParent) {
|
|
||||||
onSaleClickListener.onSaleClick(sale)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
txtColor.setOnClickListener {
|
|
||||||
if (!sale.isParent) {
|
|
||||||
onSaleClickListener.onSaleClick(sale)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
txtDescrip.setOnClickListener {
|
|
||||||
if (!sale.isParent) {
|
|
||||||
onSaleClickListener.onSaleClick(sale)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ticketFk.setOnClickListener {
|
|
||||||
onTicketClick?.onTicketClickListener(sale)
|
|
||||||
}
|
|
||||||
|
|
||||||
txtParking.setOnClickListener {
|
|
||||||
onPasillerosItemClickListener.onPasillerosItemClickListener(
|
|
||||||
PasillerosItemVO(
|
|
||||||
title = R.string.titleItemSearch
|
|
||||||
), sale.itemFk.toString()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
txtShelving.setOnClickListener {
|
|
||||||
onPackingClick.onPackingClick(sale)
|
|
||||||
}
|
|
||||||
|
|
||||||
txtItem.setOnClickListener {
|
|
||||||
onPasillerosItemClickListener.onPasillerosItemClickListener(
|
|
||||||
PasillerosItemVO(
|
|
||||||
title = R.string.titleItemConsult
|
|
||||||
), sale.itemFk.toString()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
//ERROR
|
|
||||||
|
|
||||||
if (sale.originalQuantity != sale.saleQuantity && sale.originalQuantity != null && !sale.isParent) {
|
|
||||||
layoutError.visibility = VISIBLE
|
|
||||||
txtError.text =
|
|
||||||
binding.root.context.getString(R.string.originalQuantity) + sale.originalQuantity
|
|
||||||
binding.addItem.visibility = VISIBLE
|
|
||||||
|
|
||||||
} else {
|
|
||||||
layoutError.visibility = GONE
|
|
||||||
binding.addItem.visibility = GONE
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.deleteReserve.visibility = if (sale.isAdded == 1) VISIBLE else GONE
|
|
||||||
|
|
||||||
if (sale.isAdded == 1) {
|
|
||||||
layoutError.visibility = VISIBLE
|
|
||||||
txtError.text = binding.root.context.getString(R.string.newItem)
|
|
||||||
binding.deleteReserve.setOnClickListener {
|
|
||||||
onReserveSaleClick!!.onSaleReserveListener(sale)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (isExpanded) {
|
|
||||||
itemArticlePlacements.visibility = VISIBLE
|
|
||||||
ivArrow.setImageResource(R.drawable.ic_arrow_down)
|
|
||||||
|
|
||||||
} else {
|
|
||||||
itemArticlePlacements.visibility = GONE
|
|
||||||
ivArrow.setImageResource(R.drawable.ic_arrow_up)
|
|
||||||
}
|
|
||||||
|
|
||||||
itemArticlePlacements.visibility = if (isExpanded) VISIBLE else {
|
|
||||||
GONE
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sale.isParent) {
|
|
||||||
txtQuantity.visibility = INVISIBLE
|
|
||||||
txtQuantityReserved.visibility = INVISIBLE
|
|
||||||
txtReserveToComplete.visibility = GONE
|
|
||||||
imageErrorMessage.visibility = GONE
|
|
||||||
ivArrow.visibility = VISIBLE
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
imageErrorMessage.visibility = GONE
|
|
||||||
if (type != SACADOR && type != PREITEMPICKERTEST) {
|
|
||||||
val colorRes =
|
|
||||||
if (sale.hasMistake == true) R.color.verdnatura_red_salix else R.color.verdnatura_black
|
|
||||||
imageErrorMessage.imageTintList =
|
|
||||||
ColorStateList.valueOf(getColor(context!!, colorRes))
|
|
||||||
imageErrorMessage.visibility = VISIBLE
|
|
||||||
} else {
|
|
||||||
imageErrorMessage.visibility = GONE
|
|
||||||
}
|
|
||||||
ivArrow.visibility = INVISIBLE
|
|
||||||
}
|
|
||||||
println("sonSales ${sale.sonSales}")
|
|
||||||
|
|
||||||
if (!sale.sonSales.isNullOrEmpty()) {
|
|
||||||
|
|
||||||
itemArticlePlacements.apply {
|
|
||||||
layoutManager = childLayoutManagerV
|
|
||||||
adapter = SaleAdapterReserve(
|
|
||||||
sale.sonSales,
|
|
||||||
onPasillerosItemClickListener,
|
|
||||||
onSaleClickListener,
|
|
||||||
onMistakeClickListener,
|
|
||||||
onPackingClick,
|
|
||||||
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemArticlePlacements.visibility = VISIBLE
|
|
||||||
}
|
|
||||||
|
|
||||||
ivArrow.setOnClickListener {
|
|
||||||
|
|
||||||
if (isExpanded) {
|
|
||||||
ivArrow.setImageResource(R.drawable.ic_arrow_up)
|
|
||||||
itemArticlePlacements.visibility = GONE
|
|
||||||
} else {
|
|
||||||
ivArrow.setImageResource(R.drawable.ic_arrow_down)
|
|
||||||
itemArticlePlacements.visibility = VISIBLE
|
|
||||||
}
|
|
||||||
isExpanded = !isExpanded
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sale.saleGroupFk == null) {
|
|
||||||
previous.visibility = INVISIBLE
|
|
||||||
} else {
|
|
||||||
previous.visibility = VISIBLE
|
|
||||||
previous.text = "PREV:${sale.saleGroupFk}"
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.txtQuantityReserved.text = calculatedValues.first
|
|
||||||
if (sale.totalItemShelving > 1) {
|
|
||||||
binding.txtQuantityReserved.text = calculatedValues.first
|
|
||||||
binding.txtQuantity.text = calculatedValues.second
|
|
||||||
binding.txtReserveToComplete.text =
|
|
||||||
"${sale.currentItemShelving}/${sale.totalItemShelving}"
|
|
||||||
binding.txtReserveToComplete.visibility = VISIBLE
|
|
||||||
binding.txtQuantity.text =
|
|
||||||
"${sale.reservedQuantity}"
|
|
||||||
} else {
|
|
||||||
binding.txtQuantity.text =
|
|
||||||
if (sale.itemShelvingFk == 0 && sale.itemShelvingSaleFk == 0) {
|
|
||||||
"${sale.saleQuantity}"
|
|
||||||
} else "${sale.reservedQuantity}"
|
|
||||||
binding.txtReserveToComplete.visibility = GONE
|
|
||||||
|
|
||||||
}
|
|
||||||
binding.txtReserveToComplete.text =
|
|
||||||
"${sale.currentItemShelving}/${sale.totalItemShelving}"
|
|
||||||
|
|
||||||
//COLORES
|
|
||||||
paintTicketcolor(sale.rgb, binding.itemTicketColor.background)
|
|
||||||
if (sale.isPicked == 1) {
|
|
||||||
if (type == PREPARED) {
|
|
||||||
contentLayout.setBackgroundColor(
|
|
||||||
|
|
||||||
if (sale.saleGroupFk == null) {
|
|
||||||
getColor(
|
|
||||||
context!!, R.color.verdnatura_orange_salix
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
println("stateCode ${sale.stateCode}")
|
|
||||||
if (sale.stateCode != null && sale.stateCode == "PREPARED") {
|
|
||||||
getColor(
|
|
||||||
context!!, R.color.verdnatura_orange_salix
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
if (sale.stateCode != null && sale.stateCode == "OK PREVIOUS") {
|
|
||||||
getColor(
|
|
||||||
context!!, R.color.verdnatura_dark_sky_blue
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
if (sale.stateCode != null && sale.stateCode == "PREVIOUS_CONTROLLED") {
|
|
||||||
getColor(
|
|
||||||
context!!, R.color.verdnatura_dark_mint_light
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
getColor(
|
|
||||||
context!!, R.color.verdnatura_black
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
contentLayout.setBackgroundColor(
|
|
||||||
getColor(
|
|
||||||
context!!, R.color.verdnatura_dark_sky_blue
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
contentLayout.setBackgroundColor(
|
|
||||||
getColor(
|
|
||||||
context!!, R.color.verdnatura_black
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.txtParking.text =
|
|
||||||
// if (type == PREPARED) sale.parkingCodePrevia else sale.parkingCode
|
|
||||||
sale.parkingCode ?: sale.parkingCodePrevia
|
|
||||||
|
|
||||||
binding.addItem.setOnClickListener {
|
|
||||||
onAddItemClickListener!!.onAddItemClickListener(sale)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type == PREITEMPICKERTEST) {
|
|
||||||
binding.level.visibility = GONE
|
|
||||||
binding.levelTxt.visibility = GONE
|
|
||||||
binding.ticketOrder.visibility = VISIBLE
|
|
||||||
binding.txtPoints.visibility = GONE
|
|
||||||
} else {
|
|
||||||
binding.level.visibility = VISIBLE
|
|
||||||
binding.levelTxt.visibility = VISIBLE
|
|
||||||
binding.ticketOrder.visibility = GONE
|
|
||||||
binding.txtPoints.visibility = VISIBLE
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
this.sale = sale
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun paintTicketcolor(color: String?, backgroundDrawableTicket: Drawable) {
|
|
||||||
|
|
||||||
if (color.isNullOrBlank()) {
|
|
||||||
DrawableCompat.setTint(
|
|
||||||
backgroundDrawableTicket, Color.TRANSPARENT
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
DrawableCompat.setTint(
|
|
||||||
backgroundDrawableTicket, Color.parseColor(color)
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun precalculateDisplayValues(sale: Sale): Pair<String, String> {
|
|
||||||
try {
|
|
||||||
val result = sale.reservedQuantity % (sale.packing ?: (sale.saleQuantity + 1))
|
|
||||||
val textToConcat = if (result != 0) {
|
|
||||||
"${sale.reservedQuantity / (sale.grouping ?: 1)} x ${sale.grouping ?: "1"}"
|
|
||||||
} else {
|
|
||||||
"${sale.reservedQuantity / (sale.packing ?: 1)} pack de ${sale.packing ?: "1"}"
|
|
||||||
}
|
|
||||||
|
|
||||||
val result2 = sale.accumulatedQuantity % (sale.packing ?: (sale.saleQuantity + 1))
|
|
||||||
val textToConcat2 = if (result2 != 0) {
|
|
||||||
"${(sale.saleQuantity - sale.accumulatedQuantity) / (sale.grouping ?: 1)} x ${sale.grouping ?: "1"}"
|
|
||||||
} else {
|
|
||||||
"${(sale.saleQuantity - sale.accumulatedQuantity) / (sale.packing ?: 1)} pack de ${sale.packing ?: "1"}"
|
|
||||||
}
|
|
||||||
return if (sale.itemShelvingSaleFk == 0 && sale.itemShelvingFk == 0) Pair(
|
|
||||||
"-",
|
|
||||||
"0"
|
|
||||||
) else {
|
|
||||||
Pair(textToConcat, textToConcat2)
|
|
||||||
}
|
|
||||||
} catch (ex: Exception) {
|
|
||||||
return Pair("Error", "Error")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,367 +0,0 @@
|
||||||
package es.verdnatura.presentation.view.feature.collection.adapter
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.res.ColorStateList
|
|
||||||
import android.graphics.Color
|
|
||||||
import android.graphics.drawable.Drawable
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View.GONE
|
|
||||||
import android.view.View.INVISIBLE
|
|
||||||
import android.view.View.VISIBLE
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.core.content.ContextCompat.getColor
|
|
||||||
import androidx.core.graphics.drawable.DrawableCompat
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
|
||||||
import es.verdnatura.R
|
|
||||||
import es.verdnatura.databinding.SaleRowFragmentReserveSacadorBinding
|
|
||||||
import es.verdnatura.domain.ConstAndValues.PREITEMPICKERTEST
|
|
||||||
import es.verdnatura.domain.ConstAndValues.PREPARED
|
|
||||||
import es.verdnatura.domain.ConstAndValues.SACADOR
|
|
||||||
import es.verdnatura.presentation.common.OnAddItemClickListener
|
|
||||||
import es.verdnatura.presentation.common.OnMistakeClickListener
|
|
||||||
import es.verdnatura.presentation.common.OnPackingClickSaleListener
|
|
||||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
|
||||||
import es.verdnatura.presentation.common.OnSaleClickSaleListener
|
|
||||||
import es.verdnatura.presentation.common.OnSaleReserveClickListener
|
|
||||||
import es.verdnatura.presentation.common.OnTicketClickSaleListener
|
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.Sale
|
|
||||||
|
|
||||||
class SaleAdapterReserveSacador(
|
|
||||||
private val items: List<Sale>,
|
|
||||||
private val onPasillerosItemClickListener: OnPasillerosItemClickListener,
|
|
||||||
private val onSaleClickListener: OnSaleClickSaleListener,
|
|
||||||
private val onMistakeClickListener: OnMistakeClickListener,
|
|
||||||
private val onPackingClick: OnPackingClickSaleListener,
|
|
||||||
private var onTicketClick: OnTicketClickSaleListener? = null,
|
|
||||||
private var saleAdapter: SaleAdapterReserveSacador? = null,
|
|
||||||
private var onReserveSaleClick: OnSaleReserveClickListener? = null,
|
|
||||||
private var onAddItemClickListener: OnAddItemClickListener? = null,
|
|
||||||
private var type: String? = null,
|
|
||||||
|
|
||||||
) : RecyclerView.Adapter<SaleAdapterReserveSacador.AjustesItemHolder>() {
|
|
||||||
var context: Context? = null
|
|
||||||
var position: Int = 0
|
|
||||||
|
|
||||||
var isExpanded: Boolean = false
|
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AjustesItemHolder {
|
|
||||||
this.context = parent.context
|
|
||||||
|
|
||||||
|
|
||||||
return AjustesItemHolder(
|
|
||||||
|
|
||||||
SaleRowFragmentReserveSacadorBinding.inflate(
|
|
||||||
LayoutInflater.from(parent.context), parent, false
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getItemCount() = items.size
|
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: AjustesItemHolder, position: Int) {/* this.position = position
|
|
||||||
holder.bind(items[position])*/
|
|
||||||
this.position = position
|
|
||||||
val item = items[position]
|
|
||||||
val calculatedValues = precalculateDisplayValues(item)
|
|
||||||
holder.bind(item, calculatedValues)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
inner class AjustesItemHolder(
|
|
||||||
val binding: SaleRowFragmentReserveSacadorBinding
|
|
||||||
) : RecyclerView.ViewHolder(binding.root) {
|
|
||||||
fun bind(sale: Sale, calculatedValues: Pair<String, String>) {
|
|
||||||
binding.apply {
|
|
||||||
|
|
||||||
val childLayoutManagerV =
|
|
||||||
LinearLayoutManager(context!!, RecyclerView.VERTICAL, false)
|
|
||||||
|
|
||||||
//CLICK EVENTS
|
|
||||||
contentLayout.setOnClickListener {
|
|
||||||
if (!sale.isParent) {
|
|
||||||
onSaleClickListener.onSaleClick(sale)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
txtColor.setOnClickListener {
|
|
||||||
if (!sale.isParent) {
|
|
||||||
onSaleClickListener.onSaleClick(sale)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
txtDescrip.setOnClickListener {
|
|
||||||
if (!sale.isParent) {
|
|
||||||
onSaleClickListener.onSaleClick(sale)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ticketFk.setOnClickListener {
|
|
||||||
onTicketClick?.onTicketClickListener(sale)
|
|
||||||
}
|
|
||||||
|
|
||||||
txtParking.setOnClickListener {
|
|
||||||
onPasillerosItemClickListener.onPasillerosItemClickListener(
|
|
||||||
PasillerosItemVO(
|
|
||||||
title = R.string.titleItemSearch
|
|
||||||
), sale.itemFk.toString()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
txtShelving.setOnClickListener {
|
|
||||||
onPackingClick.onPackingClick(sale)
|
|
||||||
}
|
|
||||||
|
|
||||||
txtItem.setOnClickListener {
|
|
||||||
onPasillerosItemClickListener.onPasillerosItemClickListener(
|
|
||||||
PasillerosItemVO(
|
|
||||||
title = R.string.titleItemConsult
|
|
||||||
), sale.itemFk.toString()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
//ERROR
|
|
||||||
|
|
||||||
if (sale.originalQuantity != sale.saleQuantity && sale.originalQuantity != null && !sale.isParent) {
|
|
||||||
layoutError.visibility = VISIBLE
|
|
||||||
txtError.text =
|
|
||||||
binding.root.context.getString(R.string.originalQuantity) + sale.originalQuantity
|
|
||||||
binding.addItem.visibility = VISIBLE
|
|
||||||
|
|
||||||
} else {
|
|
||||||
layoutError.visibility = GONE
|
|
||||||
binding.addItem.visibility = GONE
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.deleteReserve.visibility = if (sale.isAdded == 1) VISIBLE else GONE
|
|
||||||
|
|
||||||
if (sale.isAdded == 1) {
|
|
||||||
layoutError.visibility = VISIBLE
|
|
||||||
txtError.text = binding.root.context.getString(R.string.newItem)
|
|
||||||
binding.deleteReserve.setOnClickListener {
|
|
||||||
onReserveSaleClick!!.onSaleReserveListener(sale)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (sale.isParent) {
|
|
||||||
txtQuantity.visibility = INVISIBLE
|
|
||||||
txtQuantityReserved.visibility = INVISIBLE
|
|
||||||
txtReserveToComplete.visibility = GONE
|
|
||||||
imageErrorMessage.visibility = GONE
|
|
||||||
ivArrow.visibility = VISIBLE
|
|
||||||
sale.color = sale.username ?: "" //mostrar en campo del colo el usuario
|
|
||||||
} else {
|
|
||||||
|
|
||||||
imageErrorMessage.visibility = GONE
|
|
||||||
if (type != SACADOR && type != PREITEMPICKERTEST) {
|
|
||||||
val colorRes =
|
|
||||||
if (sale.hasMistake == true) R.color.verdnatura_red_salix else R.color.verdnatura_black
|
|
||||||
imageErrorMessage.imageTintList =
|
|
||||||
ColorStateList.valueOf(getColor(context!!, colorRes))
|
|
||||||
imageErrorMessage.visibility = VISIBLE
|
|
||||||
} else {
|
|
||||||
imageErrorMessage.visibility = GONE
|
|
||||||
}
|
|
||||||
ivArrow.visibility = INVISIBLE
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sale.sonSales.isNullOrEmpty()) {
|
|
||||||
|
|
||||||
itemArticlePlacements.apply {
|
|
||||||
layoutManager = childLayoutManagerV
|
|
||||||
adapter = SaleAdapterReserveSacadorSaleGroup(
|
|
||||||
sale.sonSales,
|
|
||||||
onPasillerosItemClickListener,
|
|
||||||
onSaleClickListener,
|
|
||||||
onMistakeClickListener,
|
|
||||||
onPackingClick,
|
|
||||||
type = "PREPARED"
|
|
||||||
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
itemArticlePlacements.visibility = GONE
|
|
||||||
}
|
|
||||||
if (isExpanded) {
|
|
||||||
if (sale.isParent) {
|
|
||||||
itemArticlePlacements.visibility = VISIBLE
|
|
||||||
} else {
|
|
||||||
itemArticlePlacements.visibility = GONE
|
|
||||||
}
|
|
||||||
ivArrow.setImageResource(R.drawable.ic_arrow_down)
|
|
||||||
|
|
||||||
} else {
|
|
||||||
itemArticlePlacements.visibility = GONE
|
|
||||||
ivArrow.setImageResource(R.drawable.ic_arrow_up)
|
|
||||||
}
|
|
||||||
|
|
||||||
itemArticlePlacements.visibility = if (isExpanded) VISIBLE else {
|
|
||||||
GONE
|
|
||||||
}
|
|
||||||
ivArrow.setOnClickListener {
|
|
||||||
|
|
||||||
if (isExpanded) {
|
|
||||||
ivArrow.setImageResource(R.drawable.ic_arrow_up)
|
|
||||||
itemArticlePlacements.visibility = GONE
|
|
||||||
|
|
||||||
} else {
|
|
||||||
ivArrow.setImageResource(R.drawable.ic_arrow_down)
|
|
||||||
if (sale.isParent) {
|
|
||||||
itemArticlePlacements.visibility = VISIBLE
|
|
||||||
} else {
|
|
||||||
itemArticlePlacements.visibility = GONE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
isExpanded = !isExpanded
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sale.saleGroupFk == null) {
|
|
||||||
previous.visibility = INVISIBLE
|
|
||||||
} else {
|
|
||||||
previous.visibility = VISIBLE
|
|
||||||
previous.text = "PREV:${sale.saleGroupFk}"
|
|
||||||
|
|
||||||
}
|
|
||||||
binding.txtQuantityReserved.text = calculatedValues.first
|
|
||||||
if (sale.totalItemShelving > 1) {
|
|
||||||
binding.txtQuantityReserved.text = calculatedValues.first
|
|
||||||
binding.txtQuantity.text = calculatedValues.second
|
|
||||||
binding.txtReserveToComplete.text =
|
|
||||||
"${sale.currentItemShelving}/${sale.totalItemShelving}"
|
|
||||||
binding.txtReserveToComplete.visibility = VISIBLE
|
|
||||||
binding.txtQuantity.text = "${sale.reservedQuantity}"
|
|
||||||
} else {
|
|
||||||
binding.txtQuantity.text =
|
|
||||||
if (sale.itemShelvingFk == 0 && sale.itemShelvingSaleFk == 0) {
|
|
||||||
"${sale.saleQuantity}"
|
|
||||||
} else "${sale.reservedQuantity}"
|
|
||||||
binding.txtReserveToComplete.visibility = GONE
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.txtReserveToComplete.text =
|
|
||||||
"${sale.currentItemShelving}/${sale.totalItemShelving}"
|
|
||||||
|
|
||||||
//COLORES
|
|
||||||
paintTicketcolor(sale.rgb, binding.itemTicketColor.background)
|
|
||||||
if (sale.isPicked == 1) {
|
|
||||||
if (type == PREPARED) {
|
|
||||||
contentLayout.setBackgroundColor(
|
|
||||||
|
|
||||||
if (sale.saleGroupFk == null) {
|
|
||||||
getColor(
|
|
||||||
context!!, R.color.verdnatura_orange_salix
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if (sale.stateCode != null && sale.stateCode == "PREPARED") {
|
|
||||||
getColor(
|
|
||||||
context!!, R.color.verdnatura_orange_salix
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
if (sale.stateCode != null && sale.stateCode == "OK PREVIOUS") {
|
|
||||||
getColor(
|
|
||||||
context!!, R.color.verdnatura_dark_sky_blue
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
if (sale.stateCode != null && sale.stateCode == "PREVIOUS_CONTROLLED") {
|
|
||||||
getColor(
|
|
||||||
context!!,
|
|
||||||
R.color.verdnatura_dark_mint_light_precontrolled
|
|
||||||
)/* getColor(
|
|
||||||
context!!, R.color.verdnatura_dark_sky_blue
|
|
||||||
)*/
|
|
||||||
} else {
|
|
||||||
getColor(
|
|
||||||
context!!, R.color.verdnatura_black
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
contentLayout.setBackgroundColor(
|
|
||||||
getColor(
|
|
||||||
context!!, R.color.verdnatura_dark_sky_blue
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
contentLayout.setBackgroundColor(
|
|
||||||
getColor(
|
|
||||||
context!!, R.color.verdnatura_black
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.txtParking.text =
|
|
||||||
// if (type == PREPARED) sale.parkingCodePrevia else sale.parkingCode
|
|
||||||
sale.parkingCode ?: sale.parkingCodePrevia
|
|
||||||
|
|
||||||
binding.addItem.setOnClickListener {
|
|
||||||
onAddItemClickListener!!.onAddItemClickListener(sale)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type == PREITEMPICKERTEST) {
|
|
||||||
binding.level.visibility = GONE
|
|
||||||
binding.levelTxt.visibility = GONE
|
|
||||||
binding.ticketOrder.visibility = VISIBLE
|
|
||||||
binding.txtPoints.visibility = GONE
|
|
||||||
} else {
|
|
||||||
binding.level.visibility = VISIBLE
|
|
||||||
binding.levelTxt.visibility = VISIBLE
|
|
||||||
binding.ticketOrder.visibility = GONE
|
|
||||||
binding.txtPoints.visibility = VISIBLE
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
this.sale = sale
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun paintTicketcolor(color: String?, backgroundDrawableTicket: Drawable) {
|
|
||||||
|
|
||||||
if (color.isNullOrBlank()) {
|
|
||||||
DrawableCompat.setTint(
|
|
||||||
backgroundDrawableTicket, Color.TRANSPARENT
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
DrawableCompat.setTint(
|
|
||||||
backgroundDrawableTicket, Color.parseColor(color)
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun precalculateDisplayValues(sale: Sale): Pair<String, String> {
|
|
||||||
try {
|
|
||||||
val result = sale.reservedQuantity % (sale.packing ?: (sale.saleQuantity + 1))
|
|
||||||
val textToConcat = if (result != 0) {
|
|
||||||
"${sale.reservedQuantity / (sale.grouping ?: 1)} x ${sale.grouping ?: "1"}"
|
|
||||||
} else {
|
|
||||||
"${sale.reservedQuantity / (sale.packing ?: 1)} pack de ${sale.packing ?: "1"}"
|
|
||||||
}
|
|
||||||
|
|
||||||
val result2 = sale.accumulatedQuantity % (sale.packing ?: (sale.saleQuantity + 1))
|
|
||||||
val textToConcat2 = if (result2 != 0) {
|
|
||||||
"${(sale.saleQuantity - sale.accumulatedQuantity) / (sale.grouping ?: 1)} x ${sale.grouping ?: "1"}"
|
|
||||||
} else {
|
|
||||||
"${(sale.saleQuantity - sale.accumulatedQuantity) / (sale.packing ?: 1)} pack de ${sale.packing ?: "1"}"
|
|
||||||
}
|
|
||||||
println("reserva sale $sale")
|
|
||||||
return if (sale.itemShelvingSaleFk == 0 && sale.itemShelvingFk == 0) Pair(
|
|
||||||
"-",
|
|
||||||
"0"
|
|
||||||
) else {
|
|
||||||
Pair(textToConcat, textToConcat2)
|
|
||||||
}
|
|
||||||
} catch (ex: Exception) {
|
|
||||||
return Pair("Error", "Error")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,308 +0,0 @@
|
||||||
package es.verdnatura.presentation.view.feature.collection.adapter
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.res.ColorStateList
|
|
||||||
import android.graphics.Color
|
|
||||||
import android.graphics.drawable.Drawable
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View.GONE
|
|
||||||
import android.view.View.INVISIBLE
|
|
||||||
import android.view.View.VISIBLE
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import androidx.core.content.ContextCompat.getColor
|
|
||||||
import androidx.core.graphics.drawable.DrawableCompat
|
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
|
||||||
import es.verdnatura.R
|
|
||||||
import es.verdnatura.databinding.SaleRowFragmentReserveSacadorBinding
|
|
||||||
import es.verdnatura.domain.ConstAndValues.PREITEMPICKERTEST
|
|
||||||
import es.verdnatura.domain.ConstAndValues.PREPARED
|
|
||||||
import es.verdnatura.domain.ConstAndValues.SACADOR
|
|
||||||
import es.verdnatura.domain.toast
|
|
||||||
import es.verdnatura.presentation.common.OnAddItemClickListener
|
|
||||||
import es.verdnatura.presentation.common.OnMistakeClickListener
|
|
||||||
import es.verdnatura.presentation.common.OnPackingClickSaleListener
|
|
||||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
|
||||||
import es.verdnatura.presentation.common.OnSaleClickSaleListener
|
|
||||||
import es.verdnatura.presentation.common.OnSaleReserveClickListener
|
|
||||||
import es.verdnatura.presentation.common.OnTicketClickSaleListener
|
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.Sale
|
|
||||||
|
|
||||||
class SaleAdapterReserveSacadorSaleGroup(
|
|
||||||
private val items: List<Sale>,
|
|
||||||
private val onPasillerosItemClickListener: OnPasillerosItemClickListener,
|
|
||||||
private val onSaleClickListener: OnSaleClickSaleListener,
|
|
||||||
private val onMistakeClickListener: OnMistakeClickListener,
|
|
||||||
private val onPackingClick: OnPackingClickSaleListener,
|
|
||||||
private var onTicketClick: OnTicketClickSaleListener? = null,
|
|
||||||
private var saleAdapter: SaleAdapterReserveSacadorSaleGroup? = null,
|
|
||||||
private var onReserveSaleClick: OnSaleReserveClickListener? = null,
|
|
||||||
private var onAddItemClickListener: OnAddItemClickListener? = null,
|
|
||||||
private var type: String? = null,
|
|
||||||
|
|
||||||
) : RecyclerView.Adapter<SaleAdapterReserveSacadorSaleGroup.AjustesItemHolder>() {
|
|
||||||
var context: Context? = null
|
|
||||||
var position: Int = 0
|
|
||||||
|
|
||||||
var isExpanded: Boolean = false
|
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AjustesItemHolder {
|
|
||||||
this.context = parent.context
|
|
||||||
|
|
||||||
|
|
||||||
return AjustesItemHolder(
|
|
||||||
|
|
||||||
SaleRowFragmentReserveSacadorBinding.inflate(
|
|
||||||
LayoutInflater.from(parent.context), parent, false
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getItemCount() = items.size
|
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: AjustesItemHolder, position: Int) {
|
|
||||||
this.position = position
|
|
||||||
holder.bind(items[position])
|
|
||||||
}
|
|
||||||
|
|
||||||
inner class AjustesItemHolder(
|
|
||||||
val binding: SaleRowFragmentReserveSacadorBinding
|
|
||||||
) : RecyclerView.ViewHolder(binding.root) {
|
|
||||||
fun bind(sale: Sale) {
|
|
||||||
binding.apply {
|
|
||||||
|
|
||||||
//CLICK EVENTS
|
|
||||||
contentLayout.setOnClickListener {
|
|
||||||
if (!sale.isParent) {
|
|
||||||
onSaleClickListener.onSaleClick(sale)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
txtColor.setOnClickListener {
|
|
||||||
if (!sale.isParent) {
|
|
||||||
onSaleClickListener.onSaleClick(sale)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
txtDescrip.setOnClickListener {
|
|
||||||
if (!sale.isParent) {
|
|
||||||
onSaleClickListener.onSaleClick(sale)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ticketFk.setOnClickListener {
|
|
||||||
onTicketClick?.onTicketClickListener(sale)
|
|
||||||
}
|
|
||||||
|
|
||||||
txtParking.setOnClickListener {
|
|
||||||
onPasillerosItemClickListener.onPasillerosItemClickListener(
|
|
||||||
PasillerosItemVO(
|
|
||||||
title = R.string.titleItemSearch
|
|
||||||
), sale.itemFk.toString()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
txtShelving.setOnClickListener {
|
|
||||||
onPackingClick.onPackingClick(sale)
|
|
||||||
}
|
|
||||||
|
|
||||||
txtItem.setOnClickListener {
|
|
||||||
onPasillerosItemClickListener.onPasillerosItemClickListener(
|
|
||||||
PasillerosItemVO(
|
|
||||||
title = R.string.titleItemConsult
|
|
||||||
), sale.itemFk.toString()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
//ERROR
|
|
||||||
|
|
||||||
if (sale.originalQuantity != sale.saleQuantity && sale.originalQuantity != null && !sale.isParent) {
|
|
||||||
layoutError.visibility = VISIBLE
|
|
||||||
txtError.text =
|
|
||||||
binding.root.context.getString(R.string.originalQuantity) + sale.originalQuantity
|
|
||||||
binding.addItem.visibility = VISIBLE
|
|
||||||
|
|
||||||
} else {
|
|
||||||
layoutError.visibility = GONE
|
|
||||||
binding.addItem.visibility = GONE
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.deleteReserve.visibility = if (sale.isAdded == 1) VISIBLE else GONE
|
|
||||||
|
|
||||||
if (sale.isAdded == 1) {
|
|
||||||
layoutError.visibility = VISIBLE
|
|
||||||
txtError.text = binding.root.context.getString(R.string.newItem)
|
|
||||||
binding.deleteReserve.setOnClickListener {
|
|
||||||
onReserveSaleClick!!.onSaleReserveListener(sale)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (sale.isParent) {
|
|
||||||
txtQuantity.visibility = INVISIBLE
|
|
||||||
txtQuantityReserved.visibility = INVISIBLE
|
|
||||||
txtReserveToComplete.visibility = GONE
|
|
||||||
imageErrorMessage.visibility = GONE
|
|
||||||
ivArrow.visibility = VISIBLE
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
imageErrorMessage.visibility = GONE
|
|
||||||
if (type != SACADOR && type != PREITEMPICKERTEST) {
|
|
||||||
val colorRes =
|
|
||||||
if (sale.hasMistake == true) R.color.verdnatura_red_salix else R.color.verdnatura_black
|
|
||||||
imageErrorMessage.imageTintList =
|
|
||||||
ColorStateList.valueOf(getColor(context!!, colorRes))
|
|
||||||
imageErrorMessage.visibility = VISIBLE
|
|
||||||
} else {
|
|
||||||
imageErrorMessage.visibility = GONE
|
|
||||||
}
|
|
||||||
ivArrow.visibility = INVISIBLE
|
|
||||||
}
|
|
||||||
println("sonSales RESERVESACADORSALEGROUP ${sale.sonSales}")
|
|
||||||
|
|
||||||
|
|
||||||
if (sale.saleGroupFk == null) {
|
|
||||||
previous.visibility = INVISIBLE
|
|
||||||
} else {
|
|
||||||
previous.visibility = VISIBLE
|
|
||||||
previous.text = "PREV:${sale.saleGroupFk}"
|
|
||||||
}
|
|
||||||
|
|
||||||
val result: Int
|
|
||||||
val textToConcat: String
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
result = sale.reservedQuantity % (sale.packing ?: (sale.saleQuantity + 1))
|
|
||||||
textToConcat = if (result != 0) {
|
|
||||||
"${sale.reservedQuantity / (sale.grouping ?: 1)} x ${sale.grouping ?: "1"}"
|
|
||||||
} else {
|
|
||||||
"${sale.reservedQuantity / (sale.packing ?: 1)} pack de ${sale.packing ?: "1"}"
|
|
||||||
}
|
|
||||||
binding.txtQuantityReserved.text = textToConcat
|
|
||||||
|
|
||||||
val textToConcat2: String
|
|
||||||
|
|
||||||
val result2: Int =
|
|
||||||
sale.accumulatedQuantity % (sale.packing ?: (sale.saleQuantity + 1))
|
|
||||||
textToConcat2 = if (result2 != 0) {
|
|
||||||
"${(sale.saleQuantity - sale.accumulatedQuantity) / (sale.grouping ?: 1)} x ${sale.grouping ?: "1"}"
|
|
||||||
} else {
|
|
||||||
"${(sale.saleQuantity - sale.accumulatedQuantity) / (sale.packing ?: 1)} pack de ${sale.packing ?: "1"}"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (sale.totalItemShelving > 1) {
|
|
||||||
binding.txtQuantityReserved.text = textToConcat
|
|
||||||
binding.txtQuantity.text = textToConcat2
|
|
||||||
binding.txtReserveToComplete.text =
|
|
||||||
"${sale.currentItemShelving}/${sale.totalItemShelving}"
|
|
||||||
binding.txtReserveToComplete.visibility = VISIBLE
|
|
||||||
binding.txtQuantity.text =
|
|
||||||
"${sale.reservedQuantity}"
|
|
||||||
} else {
|
|
||||||
binding.txtQuantity.text = "${sale.reservedQuantity}"
|
|
||||||
binding.txtReserveToComplete.visibility = GONE
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (ex: Exception) {
|
|
||||||
ex.message!!.toast(context)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
binding.txtReserveToComplete.text =
|
|
||||||
"${sale.currentItemShelving}/${sale.totalItemShelving}"
|
|
||||||
|
|
||||||
//COLORES
|
|
||||||
paintTicketcolor(sale.rgb, binding.itemTicketColor.background)
|
|
||||||
if (sale.isPicked == 1) {
|
|
||||||
if (type == PREPARED) {
|
|
||||||
contentLayout.setBackgroundColor(
|
|
||||||
|
|
||||||
if (sale.saleGroupFk == null) {
|
|
||||||
getColor(
|
|
||||||
context!!, R.color.verdnatura_orange_salix
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
println("stateCode ${sale.stateCode}")
|
|
||||||
if (sale.stateCode != null && sale.stateCode == "PREPARED") {
|
|
||||||
getColor(
|
|
||||||
context!!, R.color.verdnatura_orange_salix
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
if (sale.stateCode != null && sale.stateCode == "OK PREVIOUS") {
|
|
||||||
getColor(
|
|
||||||
context!!, R.color.verdnatura_dark_sky_blue
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
if (sale.stateCode != null && sale.stateCode == "PREVIOUS_CONTROLLED") {
|
|
||||||
getColor(
|
|
||||||
context!!, R.color.verdnatura_dark_mint_light
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
getColor(
|
|
||||||
context!!, R.color.verdnatura_black
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
contentLayout.setBackgroundColor(
|
|
||||||
getColor(
|
|
||||||
context!!, R.color.verdnatura_dark_sky_blue
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
contentLayout.setBackgroundColor(
|
|
||||||
getColor(
|
|
||||||
context!!, R.color.verdnatura_black
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
binding.txtParking.text =
|
|
||||||
// if (type == PREPARED) sale.parkingCodePrevia else sale.parkingCode
|
|
||||||
sale.parkingCode ?: sale.parkingCodePrevia
|
|
||||||
|
|
||||||
binding.addItem.setOnClickListener {
|
|
||||||
onAddItemClickListener!!.onAddItemClickListener(sale)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type == PREITEMPICKERTEST) {
|
|
||||||
binding.level.visibility = GONE
|
|
||||||
binding.levelTxt.visibility = GONE
|
|
||||||
binding.ticketOrder.visibility = VISIBLE
|
|
||||||
binding.txtPoints.visibility = GONE
|
|
||||||
} else {
|
|
||||||
binding.level.visibility = VISIBLE
|
|
||||||
binding.levelTxt.visibility = VISIBLE
|
|
||||||
binding.ticketOrder.visibility = GONE
|
|
||||||
binding.txtPoints.visibility = VISIBLE
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
this.sale = sale
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun paintTicketcolor(color: String?, backgroundDrawableTicket: Drawable) {
|
|
||||||
|
|
||||||
if (color.isNullOrBlank()) {
|
|
||||||
DrawableCompat.setTint(
|
|
||||||
backgroundDrawableTicket, Color.TRANSPARENT
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
DrawableCompat.setTint(
|
|
||||||
backgroundDrawableTicket, Color.parseColor(color)
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -8,28 +8,25 @@ import com.google.gson.JsonObject
|
||||||
import es.verdnatura.MobileApplication
|
import es.verdnatura.MobileApplication
|
||||||
import es.verdnatura.domain.SalixCallback
|
import es.verdnatura.domain.SalixCallback
|
||||||
import es.verdnatura.domain.formatWithQuotes
|
import es.verdnatura.domain.formatWithQuotes
|
||||||
import es.verdnatura.domain.getMessageFromAllResponse
|
|
||||||
import es.verdnatura.domain.nameofFunction
|
|
||||||
import es.verdnatura.domain.toast
|
import es.verdnatura.domain.toast
|
||||||
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
|
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||||
|
import es.verdnatura.presentation.base.nameofFunction
|
||||||
import es.verdnatura.presentation.common.Event
|
import es.verdnatura.presentation.common.Event
|
||||||
|
import es.verdnatura.presentation.common.PickupResponse
|
||||||
import es.verdnatura.presentation.common.SaleTrackingReplaceSalix
|
import es.verdnatura.presentation.common.SaleTrackingReplaceSalix
|
||||||
import es.verdnatura.presentation.common.TicketPickupResponse
|
|
||||||
import es.verdnatura.presentation.common.TicketState
|
import es.verdnatura.presentation.common.TicketState
|
||||||
import es.verdnatura.presentation.view.feature.collection.SalixSaleQuantity
|
import es.verdnatura.presentation.view.feature.collection.SalixSaleQuantity
|
||||||
import es.verdnatura.presentation.view.feature.collection.mapper.map
|
import es.verdnatura.presentation.view.feature.collection.mapper.map
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeListVO
|
import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeListVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeVO
|
import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeVO
|
||||||
import es.verdnatura.presentation.view.feature.ticket.fragment.TicketViewModel
|
|
||||||
import es.verdnatura.presentation.view.feature.workermistake.model.SaleMistakeSalix
|
import es.verdnatura.presentation.view.feature.workermistake.model.SaleMistakeSalix
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class CollectionCheckerViewModel(val context: Context) : BaseViewModel(context) {
|
class CollectionCheckerViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
|
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
|
||||||
private val collectionViewModelChecker = CollectionViewModel(context)
|
|
||||||
private val ticketViewModel = TicketViewModel(context)
|
|
||||||
|
|
||||||
//var isPaused: Boolean = false
|
//var isPaused: Boolean = false
|
||||||
|
|
||||||
|
@ -306,37 +303,41 @@ class CollectionCheckerViewModel(val context: Context) : BaseViewModel(context)
|
||||||
fun ticketIsPickup(
|
fun ticketIsPickup(
|
||||||
ticketFk: Number
|
ticketFk: Number
|
||||||
) {
|
) {
|
||||||
|
|
||||||
salix.ticketIsPickup(
|
salix.ticketIsPickup(
|
||||||
"""{
|
"""{
|
||||||
"where": {
|
"where": {
|
||||||
"id": $ticketFk
|
"id": $ticketFk
|
||||||
},
|
},
|
||||||
"fields": ["id", "agencyModeFk"],
|
"fields": ["id", "routeFk"],
|
||||||
"include": [
|
"include": [
|
||||||
{
|
{
|
||||||
"relation": "agencyMode",
|
"relation": "route",
|
||||||
"scope": {
|
"scope": {
|
||||||
"fields": ["id", "deliveryMethodFk", "code"],
|
"fields": ["id", "agencyModeFk"],
|
||||||
"where": {
|
|
||||||
"code": { "inq": ["REC_ALG", "PICKUP"] }
|
|
||||||
},
|
|
||||||
"include": {
|
"include": {
|
||||||
"relation": "deliveryMethod",
|
"relation": "agencyMode",
|
||||||
"scope": {
|
"scope": {
|
||||||
|
"fields": ["id", "deliveryMethodFk","code"],
|
||||||
|
"where": {"code": "REC_ALG"},
|
||||||
|
"include": {
|
||||||
|
"relation": "deliveryMethod",
|
||||||
|
"scope": {
|
||||||
"fields": ["id", "code"]
|
"fields": ["id", "code"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
]
|
}""".trim()
|
||||||
}""".trim()
|
|
||||||
).enqueue(object : SalixCallback<List<TicketPickupResponse>>(context) {
|
).enqueue(object : SalixCallback<List<PickupResponse>>(context) {
|
||||||
override fun onSuccess(response: Response<List<TicketPickupResponse>>) {
|
override fun onSuccess(response: Response<List<PickupResponse>>) {
|
||||||
|
|
||||||
_responseTicketIsPickup.value =
|
_responseTicketIsPickup.value =
|
||||||
response.body()
|
response.body()
|
||||||
?.firstOrNull()?.agencyMode?.deliveryMethod?.code == "PICKUP"
|
?.firstOrNull()?.route?.agencyMode?.deliveryMethod?.code == "PICKUP"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -358,18 +359,4 @@ class CollectionCheckerViewModel(val context: Context) : BaseViewModel(context)
|
||||||
_isPaused.value = paused
|
_isPaused.value = paused
|
||||||
}
|
}
|
||||||
|
|
||||||
fun itemShelvingSaleBySale(
|
|
||||||
saleFk: Number, quantityDiff: Int
|
|
||||||
|
|
||||||
) {
|
|
||||||
collectionViewModelChecker.itemShelvingSaleBySale(
|
|
||||||
saleFk = saleFk,
|
|
||||||
quantityDiff = quantityDiff
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun ticketAdvance(ticketFk: Number, workerFk: Number) {
|
|
||||||
ticketViewModel.ticketExits(ticketFk, workerFk)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -20,7 +20,6 @@ import es.verdnatura.databinding.FragmentCollectionBinding
|
||||||
import es.verdnatura.domain.ConstAndValues
|
import es.verdnatura.domain.ConstAndValues
|
||||||
import es.verdnatura.domain.ConstAndValues.CONTROLADOR
|
import es.verdnatura.domain.ConstAndValues.CONTROLADOR
|
||||||
import es.verdnatura.domain.ConstAndValues.PRINTERNAME
|
import es.verdnatura.domain.ConstAndValues.PRINTERNAME
|
||||||
import es.verdnatura.domain.ConstAndValues.SECTORFK
|
|
||||||
import es.verdnatura.domain.notNull
|
import es.verdnatura.domain.notNull
|
||||||
import es.verdnatura.domain.showToastCenterWithBackground
|
import es.verdnatura.domain.showToastCenterWithBackground
|
||||||
import es.verdnatura.domain.toast
|
import es.verdnatura.domain.toast
|
||||||
|
@ -55,6 +54,7 @@ import es.verdnatura.presentation.view.feature.sacador.model.PlacementVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.SaleVO
|
import es.verdnatura.presentation.view.feature.sacador.model.SaleVO
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
|
||||||
|
// FALTA TESTEAR REVISORES DESPUÉS DE CAMPAÑA Y VER HOLDPOSITION
|
||||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||||
class CollectionFragmentChecker(
|
class CollectionFragmentChecker(
|
||||||
var collection: CollectionVO = CollectionVO(0), var type: String = CONTROLADOR
|
var collection: CollectionVO = CollectionVO(0), var type: String = CONTROLADOR
|
||||||
|
@ -79,7 +79,6 @@ class CollectionFragmentChecker(
|
||||||
private var mistakeSale: SaleVO? = null
|
private var mistakeSale: SaleVO? = null
|
||||||
private var positionIncreaseQuantity = 0
|
private var positionIncreaseQuantity = 0
|
||||||
private var quantityIncrease: Int = 0
|
private var quantityIncrease: Int = 0
|
||||||
private var quantityIncreaseDiff: Int = 0
|
|
||||||
private var isMarking = false
|
private var isMarking = false
|
||||||
private lateinit var ticketScanTxt: String
|
private lateinit var ticketScanTxt: String
|
||||||
private var lastScanned: Int = 0
|
private var lastScanned: Int = 0
|
||||||
|
@ -124,7 +123,6 @@ class CollectionFragmentChecker(
|
||||||
if (collection.tickets.isNotEmpty()) {
|
if (collection.tickets.isNotEmpty()) {
|
||||||
createCollectionList()
|
createCollectionList()
|
||||||
}
|
}
|
||||||
|
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +137,7 @@ class CollectionFragmentChecker(
|
||||||
binding.mainToolbar.toolbarSubtitle.visibility = VISIBLE
|
binding.mainToolbar.toolbarSubtitle.visibility = VISIBLE
|
||||||
binding.mainToolbar.toolbarIcons.visibility = VISIBLE
|
binding.mainToolbar.toolbarIcons.visibility = VISIBLE
|
||||||
binding.mainToolbar.backButton.visibility = VISIBLE
|
binding.mainToolbar.backButton.visibility = VISIBLE
|
||||||
|
binding.previaButton.visibility = INVISIBLE
|
||||||
binding.mainToolbar.toolbarTitle.text =
|
binding.mainToolbar.toolbarTitle.text =
|
||||||
if (collection.collectionFk == 0) getString(R.string.review) else collection.collectionFk.toString()
|
if (collection.collectionFk == 0) getString(R.string.review) else collection.collectionFk.toString()
|
||||||
|
|
||||||
|
@ -168,11 +166,10 @@ class CollectionFragmentChecker(
|
||||||
listIcons.add(iconWorker)
|
listIcons.add(iconWorker)
|
||||||
listIcons.add(iconAdd)
|
listIcons.add(iconAdd)
|
||||||
binding.previaButton.setOnClickListener {
|
binding.previaButton.setOnClickListener {
|
||||||
showDialog(isAdvanceTicket = false)
|
showPrevia()
|
||||||
}
|
|
||||||
binding.ticketAdvanceButton.setOnClickListener {
|
|
||||||
showDialog(isAdvanceTicket = true)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
binding.mainToolbar.toolbarIcons.adapter =
|
binding.mainToolbar.toolbarIcons.adapter =
|
||||||
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
|
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
|
||||||
override fun onOptionsItemSelected(item: Drawable) {
|
override fun onOptionsItemSelected(item: Drawable) {
|
||||||
|
@ -212,20 +209,11 @@ class CollectionFragmentChecker(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showDialog(isAdvanceTicket: Boolean) {
|
private fun showPrevia() {
|
||||||
customDialogList.getEditText().setRawInputType(TYPE_CLASS_NUMBER)
|
customDialogList.getEditText().setRawInputType(TYPE_CLASS_NUMBER)
|
||||||
customDialogList.setTitle(
|
customDialogList.setTitle(getString(R.string.scanPreviousTicket))
|
||||||
if (isAdvanceTicket) getString(R.string.ticketAdvance) else getString(
|
|
||||||
R.string.scanPreviousTicket
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.setOkButton(getString(R.string.end)) {
|
.setOkButton(getString(R.string.end)) {
|
||||||
if (customDialogList.getValue().isNotEmpty()) {
|
takeActionPrevia(customDialogList)
|
||||||
takeAction(customDialogList, isAdvanceTicket)
|
|
||||||
} else {
|
|
||||||
ma.hideKeyboard(customDialogList.getEditText())
|
|
||||||
customDialogList.dismiss()
|
|
||||||
}
|
|
||||||
|
|
||||||
}.setValue("").show()
|
}.setValue("").show()
|
||||||
|
|
||||||
|
@ -237,8 +225,7 @@ class CollectionFragmentChecker(
|
||||||
if (customDialogList.getValue().isNotEmpty()) {
|
if (customDialogList.getValue().isNotEmpty()) {
|
||||||
isScanned =
|
isScanned =
|
||||||
event != null && event.action == ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER
|
event != null && event.action == ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER
|
||||||
takeAction(customDialogList, isAdvanceTicket)
|
takeActionPrevia(customDialogList)
|
||||||
ma.hideKeyboard(customDialogList.getEditText())
|
|
||||||
}
|
}
|
||||||
customDialogList.setValue("")
|
customDialogList.setValue("")
|
||||||
ma.hideKeyboard(customDialogList.getEditText())
|
ma.hideKeyboard(customDialogList.getEditText())
|
||||||
|
@ -249,18 +236,14 @@ class CollectionFragmentChecker(
|
||||||
hideKeyboard()
|
hideKeyboard()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun takeAction(customDialogList: CustomDialogList, isAdvanceTicket: Boolean) {
|
private fun takeActionPrevia(customDialogList: CustomDialogList) {
|
||||||
ma.hideKeyboard(customDialogList.getEditText())
|
ma.hideKeyboard(customDialogList.getEditText())
|
||||||
try {
|
try {
|
||||||
val itemScanned = itemScanValue(
|
val saleGroupScanned = itemScanValue(
|
||||||
customDialogList.getValue(), if (isAdvanceTicket) {
|
customDialogList.getValue(), arrayOf("saleGroup"), "id"
|
||||||
arrayOf("ticket")
|
|
||||||
} else arrayOf("saleGroup"), "id"
|
|
||||||
).toString()
|
).toString()
|
||||||
|
|
||||||
if (isAdvanceTicket) {
|
markPrevia(saleGroupScanned)
|
||||||
viewModel.ticketAdvance(itemScanned.toInt(), mobileApplication.userId!!)
|
|
||||||
} else markPrevia(itemScanned)
|
|
||||||
customDialogList.dismiss()
|
customDialogList.dismiss()
|
||||||
} catch (ex: Exception) {
|
} catch (ex: Exception) {
|
||||||
ma.messageWithSound(
|
ma.messageWithSound(
|
||||||
|
@ -321,13 +304,8 @@ class CollectionFragmentChecker(
|
||||||
val myQr = ItemScanned(JSONObject(binding.scanInput.text.toString()))
|
val myQr = ItemScanned(JSONObject(binding.scanInput.text.toString()))
|
||||||
|
|
||||||
when (myQr.table) {
|
when (myQr.table) {
|
||||||
|
|
||||||
"saleGroup" -> {
|
"saleGroup" -> {
|
||||||
if (sales.any { it.saleGroupFk == myQr.id.toString() }) {
|
markPrevia(myQr.id.toString())
|
||||||
markPrevia(myQr.id.toString())
|
|
||||||
} else {
|
|
||||||
findSale(myQr.id.toString())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
"buy" -> binding.scanInput.setText(myQr.more)
|
"buy" -> binding.scanInput.setText(myQr.more)
|
||||||
|
@ -376,7 +354,6 @@ class CollectionFragmentChecker(
|
||||||
if (it.tickets.isNotEmpty()) {
|
if (it.tickets.isNotEmpty()) {
|
||||||
collection = it
|
collection = it
|
||||||
binding.previaButton.visibility = VISIBLE
|
binding.previaButton.visibility = VISIBLE
|
||||||
binding.ticketAdvanceButton.visibility = VISIBLE
|
|
||||||
binding.fragmentSacadorCollections.visibility = VISIBLE
|
binding.fragmentSacadorCollections.visibility = VISIBLE
|
||||||
createCollectionList()
|
createCollectionList()
|
||||||
} else {
|
} else {
|
||||||
|
@ -385,7 +362,6 @@ class CollectionFragmentChecker(
|
||||||
getString(R.string.summaryCount, 0, 0)
|
getString(R.string.summaryCount, 0, 0)
|
||||||
binding.fragmentSacadorCollections.visibility = INVISIBLE
|
binding.fragmentSacadorCollections.visibility = INVISIBLE
|
||||||
binding.previaButton.visibility = INVISIBLE
|
binding.previaButton.visibility = INVISIBLE
|
||||||
binding.ticketAdvanceButton.visibility = INVISIBLE
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
customDialog.setTitle(getString(R.string.error))
|
customDialog.setTitle(getString(R.string.error))
|
||||||
|
@ -573,48 +549,15 @@ class CollectionFragmentChecker(
|
||||||
observations.takeIf { it.isNotBlank() }?.plus(" ${ticket.observations}") ?: ""
|
observations.takeIf { it.isNotBlank() }?.plus(" ${ticket.observations}") ?: ""
|
||||||
}
|
}
|
||||||
|
|
||||||
val isOnReservationMode = mobileApplication.dataStoreApp.readDataStoreKey<Boolean>(
|
|
||||||
ConstAndValues.RESERVATIONMODE
|
|
||||||
) || (mobileApplication.dataStoreApp.readDataStoreKey<Boolean?>(
|
|
||||||
ConstAndValues.SECTORISONRESERVATIONMODE
|
|
||||||
) == true)
|
|
||||||
|
|
||||||
sales = if (isOnReservationMode) {
|
|
||||||
salesList.filter {
|
|
||||||
it.sectorFk == mobileApplication.dataStoreApp.readDataStoreKey<Int>(SECTORFK)
|
|
||||||
}.sortedWith(compareBy({ it.saleOrder }))
|
|
||||||
} else {
|
|
||||||
salesList.filter {
|
|
||||||
it.sectorFk == mobileApplication.dataStoreApp.readDataStoreKey<Int>(SECTORFK)
|
|
||||||
}.sortedWith(compareBy({ it.picked }))
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!buttonPushedGetCollection) {
|
if (!buttonPushedGetCollection) {
|
||||||
println("Reorden lineas sin boton pulsado")
|
sales = salesList.sortedWith(compareBy { it.picked })
|
||||||
sales =
|
myGroupList = groupSaleGroup(salesList).sortedWith(compareBy { it.picked })
|
||||||
if (!isOnReservationMode) salesList.sortedWith(compareBy { it.picked }) else salesList.sortedWith(
|
|
||||||
compareBy { it.pickedOrder })
|
|
||||||
myGroupList =
|
|
||||||
if (!isOnReservationMode) groupSaleGroup(salesList).sortedWith(compareBy { it.picked }) else groupSaleGroup(
|
|
||||||
salesList
|
|
||||||
).sortedWith(compareBy { it.pickedOrder })
|
|
||||||
|
|
||||||
for (m in myGroupList) {
|
|
||||||
println("Linea ${m.itemFk}-${m.pickedOrder} ")
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
sales = if (!isOnReservationMode) salesList.sortedWith(
|
sales = salesList.sortedWith(
|
||||||
compareBy({ it.isControlled }, { it.picked })
|
compareBy({ it.isControlled }, { it.picked })
|
||||||
) else salesList.sortedWith(
|
|
||||||
compareBy({ it.isControlled }, { it.pickedOrder })
|
|
||||||
)
|
)
|
||||||
|
myGroupList = groupSaleGroup(salesList).sortedWith(
|
||||||
//para la nueva revisión : hay que poner el saleOrder si no no podrán revisar correctamente
|
|
||||||
println("Reorden lineas con boton pulsado")
|
|
||||||
myGroupList = if (!isOnReservationMode) groupSaleGroup(salesList).sortedWith(
|
|
||||||
compareBy({ it.isControlled }, { it.picked })
|
compareBy({ it.isControlled }, { it.picked })
|
||||||
) else groupSaleGroup(salesList).sortedWith(
|
|
||||||
compareBy({ it.isControlled }, { it.pickedOrder })
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1158,30 +1101,28 @@ class CollectionFragmentChecker(
|
||||||
if (listItemSon.saleFk == saleFk) {
|
if (listItemSon.saleFk == saleFk) {
|
||||||
myGroupList[parentIndex].sonSales[childIndex].quantity =
|
myGroupList[parentIndex].sonSales[childIndex].quantity =
|
||||||
quantityIncrease
|
quantityIncrease
|
||||||
|
saleAdapter?.notifyDataSetChanged()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (myGroupList[parentIndex].saleFk == saleFk) myGroupList[parentIndex].quantity =
|
||||||
if (myGroupList[parentIndex].saleFk == saleFk) {
|
quantityIncrease
|
||||||
myGroupList[parentIndex].quantity = quantityIncrease
|
break
|
||||||
// myGroupList[positionIncreaseQuantity].quantity = quantityIncrease
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}/* } else {
|
||||||
viewModel.itemShelvingSaleBySale(saleFk = saleFk, quantityDiff = quantityIncreaseDiff)
|
myGroupList[positionIncreaseQuantity].quantity = quantityIncrease
|
||||||
|
saleAdapter?.notifyDataSetChanged()
|
||||||
|
}*/
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.message!!.toast(requireContext())
|
e.message!!.toast(requireContext())
|
||||||
}
|
}
|
||||||
saleAdapter?.notifyDataSetChanged()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun increaseQuantity(position: Int, quantity: Int) {
|
private fun increaseQuantity(position: Int, quantity: Int) {
|
||||||
positionIncreaseQuantity = position
|
positionIncreaseQuantity = position
|
||||||
quantityIncrease = quantity
|
quantityIncrease = quantity
|
||||||
quantityIncreaseDiff = (myGroupList[position].quantity!!.minus(quantity))
|
|
||||||
viewModel.collectionIncreaseQuantitySalix(
|
viewModel.collectionIncreaseQuantitySalix(
|
||||||
saleFk = myGroupList[position].saleFk, quantity = quantity.toString()
|
saleFk = myGroupList[position].saleFk, quantity = quantity.toString()
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package es.verdnatura.presentation.view.feature.collection.fragment
|
package es.verdnatura.presentation.view.feature.collection.fragment
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.PorterDuff
|
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.media.MediaPlayer
|
import android.media.MediaPlayer
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
|
@ -19,7 +18,6 @@ import android.view.inputmethod.InputMethodManager
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.annotation.RequiresApi
|
import androidx.annotation.RequiresApi
|
||||||
import androidx.core.content.ContextCompat
|
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
@ -64,8 +62,6 @@ import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
|
||||||
import es.verdnatura.presentation.view.feature.collection.ItemVO
|
import es.verdnatura.presentation.view.feature.collection.ItemVO
|
||||||
import es.verdnatura.presentation.view.feature.collection.adapter.SaleAdapter
|
import es.verdnatura.presentation.view.feature.collection.adapter.SaleAdapter
|
||||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.CleanAction
|
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.CodeWorkerAction
|
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeVO
|
import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeVO
|
||||||
|
@ -73,7 +69,6 @@ import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyList
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO
|
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.PlacementVO
|
import es.verdnatura.presentation.view.feature.sacador.model.PlacementVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.SaleVO
|
import es.verdnatura.presentation.view.feature.sacador.model.SaleVO
|
||||||
import kotlinx.coroutines.runBlocking
|
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
|
||||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||||
|
@ -139,7 +134,6 @@ class CollectionFragmentPicker(
|
||||||
private var isVerifiedCollection = false
|
private var isVerifiedCollection = false
|
||||||
|
|
||||||
private var hasFilterByLevel = false
|
private var hasFilterByLevel = false
|
||||||
private lateinit var iconClean: ImageView
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun newInstance(collection: CollectionVO, type: String) =
|
fun newInstance(collection: CollectionVO, type: String) =
|
||||||
|
@ -213,8 +207,8 @@ class CollectionFragmentPicker(
|
||||||
collection.collectionFk.let {
|
collection.collectionFk.let {
|
||||||
binding.mainToolbar.toolbarTitle.text = collection.collectionFk.toString()
|
binding.mainToolbar.toolbarTitle.text = collection.collectionFk.toString()
|
||||||
}
|
}
|
||||||
val listIcons: ArrayList<ImageView> = ArrayList()
|
|
||||||
|
|
||||||
|
val listIcons: ArrayList<ImageView> = ArrayList()
|
||||||
val iconPrint = ImageView(context)
|
val iconPrint = ImageView(context)
|
||||||
iconPrint.setImageResource(R.drawable.ic_print_black_24dp)
|
iconPrint.setImageResource(R.drawable.ic_print_black_24dp)
|
||||||
val iconAdd = ImageView(context)
|
val iconAdd = ImageView(context)
|
||||||
|
@ -227,9 +221,6 @@ class CollectionFragmentPicker(
|
||||||
iconPhone.setImageResource(R.drawable.phone_call)
|
iconPhone.setImageResource(R.drawable.phone_call)
|
||||||
val iconParking = ImageView(context)
|
val iconParking = ImageView(context)
|
||||||
iconParking.setImageResource(R.drawable.ic_local_parking_black_24dp)
|
iconParking.setImageResource(R.drawable.ic_local_parking_black_24dp)
|
||||||
iconClean = ImageView(context)
|
|
||||||
iconClean.setImageResource(R.drawable.ic_clean_shelving)
|
|
||||||
|
|
||||||
val iconUpdate = ImageView(context)
|
val iconUpdate = ImageView(context)
|
||||||
iconUpdate.setImageResource(R.drawable.ic_autorenew_black_24dp)
|
iconUpdate.setImageResource(R.drawable.ic_autorenew_black_24dp)
|
||||||
|
|
||||||
|
@ -240,7 +231,7 @@ class CollectionFragmentPicker(
|
||||||
iconPhone.tooltipText = getTooltip(R.drawable.phone_call)
|
iconPhone.tooltipText = getTooltip(R.drawable.phone_call)
|
||||||
iconParking.tooltipText = getTooltip(R.drawable.ic_local_parking_black_24dp)
|
iconParking.tooltipText = getTooltip(R.drawable.ic_local_parking_black_24dp)
|
||||||
iconUpdate.tooltipText = getTooltip(R.drawable.ic_autorenew_black_24dp)
|
iconUpdate.tooltipText = getTooltip(R.drawable.ic_autorenew_black_24dp)
|
||||||
iconClean.tooltipText = getTooltip(R.drawable.ic_clean_shelving)
|
|
||||||
}
|
}
|
||||||
listIcons.add(iconPrint)
|
listIcons.add(iconPrint)
|
||||||
if (type == CONTROLADOR) {
|
if (type == CONTROLADOR) {
|
||||||
|
@ -255,8 +246,6 @@ class CollectionFragmentPicker(
|
||||||
listIcons.add(iconAdd)
|
listIcons.add(iconAdd)
|
||||||
|
|
||||||
if (type == SACADOR) {
|
if (type == SACADOR) {
|
||||||
//Tarea 8624
|
|
||||||
listIcons.add(iconClean)
|
|
||||||
listIcons.add(iconUpdate)
|
listIcons.add(iconUpdate)
|
||||||
listIcons.remove(iconWorker)
|
listIcons.remove(iconWorker)
|
||||||
}
|
}
|
||||||
|
@ -271,7 +260,6 @@ class CollectionFragmentPicker(
|
||||||
override fun onOptionsItemSelected(item: Drawable) {
|
override fun onOptionsItemSelected(item: Drawable) {
|
||||||
|
|
||||||
when (item) {
|
when (item) {
|
||||||
iconClean.drawable -> clean()
|
|
||||||
iconPrint.drawable -> print()
|
iconPrint.drawable -> print()
|
||||||
iconAdd.drawable -> addItem()
|
iconAdd.drawable -> addItem()
|
||||||
iconWorker.drawable -> showUser()
|
iconWorker.drawable -> showUser()
|
||||||
|
@ -284,86 +272,9 @@ class CollectionFragmentPicker(
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
binding.mainToolbar.toolbarIcons.layoutManager =
|
binding.mainToolbar.toolbarIcons.layoutManager =
|
||||||
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||||
updateIconColor()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun updateIconColor() {
|
|
||||||
val newColor =
|
|
||||||
ContextCompat.getColor(
|
|
||||||
requireContext(),
|
|
||||||
if (mobileApplication.dataStoreApp.readDataStoreKey<String>("SHELVINGACTION")
|
|
||||||
.isNotBlank()
|
|
||||||
) R.color.verdnatura_orange_salix else R.color.verdnatura_white
|
|
||||||
)
|
|
||||||
iconClean.setColorFilter(newColor, PorterDuff.Mode.SRC_IN)
|
|
||||||
binding.mainToolbar.toolbarIcons.adapter?.notifyDataSetChanged()
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun addWorkerActivity(codeWorkerAction: CodeWorkerAction, shelving: String) {
|
|
||||||
viewModel.addWorkerActivity(
|
|
||||||
CleanAction(
|
|
||||||
codeWorkerAction = codeWorkerAction,
|
|
||||||
shelving = shelving.uppercase(),
|
|
||||||
description = shelving.uppercase()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun clean() {
|
|
||||||
|
|
||||||
val shelving = mobileApplication.dataStoreApp.readDataStoreKey<String>(
|
|
||||||
"SHELVINGACTION"
|
|
||||||
)
|
|
||||||
if (
|
|
||||||
shelving.isNotBlank()
|
|
||||||
) {
|
|
||||||
addWorkerActivity(
|
|
||||||
CodeWorkerAction.SHELVING_CLEAN_STOP,
|
|
||||||
shelving = shelving
|
|
||||||
)
|
|
||||||
|
|
||||||
} else {
|
|
||||||
customDialogInput.setTitle(getString(R.string.titleCleanShelving))
|
|
||||||
.setDescription(getString(R.string.descripOrganize))
|
|
||||||
.setOkButton(getString(R.string.organize)) {
|
|
||||||
ma.hideKeyboard(customDialogInput.getEditText())
|
|
||||||
actionOrganizeClean(customDialogInput.getValue())
|
|
||||||
|
|
||||||
}.setKoButton(getString(R.string.cancel)) {
|
|
||||||
customDialogInput.dismiss()
|
|
||||||
}.setValue("").show()
|
|
||||||
customDialogInput.getEditText().requestFocus()
|
|
||||||
customDialogInput.getEditText().setOnEditorActionListener { _, actionId, _ ->
|
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
|
||||||
|
|
||||||
actionOrganizeClean(customDialogInput.getValue())
|
|
||||||
return@setOnEditorActionListener true
|
|
||||||
}
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun actionOrganizeClean(input: String) {
|
|
||||||
if (input.isShelving()) {
|
|
||||||
addWorkerActivity(
|
|
||||||
CodeWorkerAction.SHELVING_CLEAN_START,
|
|
||||||
shelving = input
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
ma.messageWithSound(
|
|
||||||
message = getString(R.string.errorInput),
|
|
||||||
isError = true,
|
|
||||||
isPlayed = true,
|
|
||||||
isToasted = true
|
|
||||||
)
|
|
||||||
}
|
|
||||||
customDialogInput.dismiss()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateScreen() {
|
private fun updateScreen() {
|
||||||
|
@ -420,7 +331,9 @@ class CollectionFragmentPicker(
|
||||||
ma.hideKeyboard(customDialogList.getEditText())
|
ma.hideKeyboard(customDialogList.getEditText())
|
||||||
try {
|
try {
|
||||||
val saleGroupScanned = itemScanValue(
|
val saleGroupScanned = itemScanValue(
|
||||||
customDialogList.getValue(), arrayOf("saleGroup"), "id"
|
customDialogList.getValue(),
|
||||||
|
arrayOf("saleGroup"),
|
||||||
|
"id"
|
||||||
).toString()
|
).toString()
|
||||||
isScanned =
|
isScanned =
|
||||||
event != null && event.action == KeyEvent.ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER
|
event != null && event.action == KeyEvent.ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER
|
||||||
|
@ -551,22 +464,7 @@ class CollectionFragmentPicker(
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
override fun observeViewModel() {
|
override fun observeViewModel() {
|
||||||
|
|
||||||
with(viewModel) {
|
with(viewModel) {
|
||||||
loadResponseActivity.observe(viewLifecycleOwner) { event ->
|
|
||||||
event.getContentIfNotHandled().notNull {
|
|
||||||
|
|
||||||
println("shelvinAction ${it}")
|
|
||||||
runBlocking {
|
|
||||||
mobileApplication.dataStoreApp.editDataStoreKey(
|
|
||||||
"SHELVINGACTION",
|
|
||||||
if (it.codeWorkerAction == CodeWorkerAction.SHELVING_CLEAN_START) it.shelving else ""
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
updateIconColor()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
collectionTicketList.observe(viewLifecycleOwner, Observer {
|
collectionTicketList.observe(viewLifecycleOwner, Observer {
|
||||||
|
|
||||||
if (!it.isError) {
|
if (!it.isError) {
|
||||||
|
@ -946,8 +844,7 @@ class CollectionFragmentPicker(
|
||||||
} else {
|
} else {
|
||||||
// pintar línea
|
// pintar línea
|
||||||
saleAdapter!!.notifyDataSetChanged()
|
saleAdapter!!.notifyDataSetChanged()
|
||||||
//se modifica tenia storedBackPosition
|
myPosition = storedBackPosition
|
||||||
myPosition = storedPosition
|
|
||||||
|
|
||||||
ReviewQuantityForRefreshingAndSorting(
|
ReviewQuantityForRefreshingAndSorting(
|
||||||
sales[storedPosition].quantity!!.toInt(),
|
sales[storedPosition].quantity!!.toInt(),
|
||||||
|
@ -1031,7 +928,8 @@ class CollectionFragmentPicker(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
saleAdapter = SaleAdapter(myGroupList as MutableList,
|
saleAdapter = SaleAdapter(
|
||||||
|
myGroupList as MutableList,
|
||||||
pasillerosItemClickListener!!,
|
pasillerosItemClickListener!!,
|
||||||
object : OnQuantityClickListener {
|
object : OnQuantityClickListener {
|
||||||
|
|
||||||
|
@ -1109,9 +1007,18 @@ class CollectionFragmentPicker(
|
||||||
type = type,
|
type = type,
|
||||||
onTicketColorClickListener = object : OnTicketColorListener {
|
onTicketColorClickListener = object : OnTicketColorListener {
|
||||||
override fun onTicketColorListener(sale: SaleVO) {
|
override fun onTicketColorListener(sale: SaleVO) {
|
||||||
|
hasFilterByLevel = !hasFilterByLevel
|
||||||
|
|
||||||
|
if (hasFilterByLevel) {
|
||||||
|
saleAdapter!!.updateSales(myGroupList.filter { it.level == sale.level } as MutableList)
|
||||||
|
myGroupList = myGroupList.filter { it.level == sale.level }
|
||||||
|
} else {
|
||||||
|
createCollectionList()
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||||
|
@ -1139,7 +1046,7 @@ class CollectionFragmentPicker(
|
||||||
}
|
}
|
||||||
|
|
||||||
printObservations(observations)
|
printObservations(observations)
|
||||||
if (!isVerifiedCollection && mobileApplication.userId != 19591) {
|
if (!isVerifiedCollection) {
|
||||||
binding.fragmentSacadorCollections.visibility = View.INVISIBLE
|
binding.fragmentSacadorCollections.visibility = View.INVISIBLE
|
||||||
verifyCollection()
|
verifyCollection()
|
||||||
}
|
}
|
||||||
|
@ -2016,7 +1923,6 @@ class CollectionFragmentPicker(
|
||||||
if (listPlacementSupply.size == 1) {
|
if (listPlacementSupply.size == 1) {
|
||||||
ticketSelected = listPlacementSupply[0].code!!.toInt()
|
ticketSelected = listPlacementSupply[0].code!!.toInt()
|
||||||
}
|
}
|
||||||
customDialogList = CustomDialogList(requireContext())
|
|
||||||
customDialogList.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
|
customDialogList.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
|
||||||
customDialogList.getEditTextTwo().inputType = InputType.TYPE_CLASS_NUMBER
|
customDialogList.getEditTextTwo().inputType = InputType.TYPE_CLASS_NUMBER
|
||||||
customDialogList.getEditText().setRawInputType(InputType.TYPE_CLASS_NUMBER)
|
customDialogList.getEditText().setRawInputType(InputType.TYPE_CLASS_NUMBER)
|
||||||
|
@ -2448,15 +2354,18 @@ class CollectionFragmentPicker(
|
||||||
}
|
}
|
||||||
if (isTicket) {
|
if (isTicket) {
|
||||||
val labelDialogHelper = LabelDialogHelper(requireContext())
|
val labelDialogHelper = LabelDialogHelper(requireContext())
|
||||||
labelDialogHelper.showLabelDialog(onItemSelected = { labelCount ->
|
labelDialogHelper.showLabelDialog(
|
||||||
viewModel.collectionStickerPrint(
|
onItemSelected = { labelCount ->
|
||||||
collectionFk = collection.collectionFk, labelCount = labelCount
|
viewModel.collectionStickerPrint(
|
||||||
)
|
collectionFk = collection.collectionFk,
|
||||||
|
labelCount = labelCount
|
||||||
|
)
|
||||||
|
|
||||||
(getString(R.string.Imprimiendo) + mobileApplication.dataStoreApp.readDataStoreKey<String>(
|
(getString(R.string.Imprimiendo) + mobileApplication.dataStoreApp.readDataStoreKey<String>(
|
||||||
PRINTERNAME
|
PRINTERNAME
|
||||||
)).toast(requireContext())
|
)).toast(requireContext())
|
||||||
})
|
}
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
viewModel.collectionStickerPrint(
|
viewModel.collectionStickerPrint(
|
||||||
collectionFk = collection.collectionFk, null
|
collectionFk = collection.collectionFk, null
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -7,11 +7,7 @@ import android.os.Bundle
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import android.text.InputType
|
import android.text.InputType
|
||||||
import android.text.Spannable
|
|
||||||
import android.text.SpannableString
|
|
||||||
import android.text.style.AbsoluteSizeSpan
|
|
||||||
import android.util.Log.d
|
import android.util.Log.d
|
||||||
import android.util.TypedValue
|
|
||||||
import android.view.KeyEvent
|
import android.view.KeyEvent
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.View.VISIBLE
|
import android.view.View.VISIBLE
|
||||||
|
@ -59,7 +55,7 @@ import es.verdnatura.presentation.view.component.CustomDialogThreeButtons
|
||||||
import es.verdnatura.presentation.view.feature.articulo.adapter.BarcodeAdapter
|
import es.verdnatura.presentation.view.feature.articulo.adapter.BarcodeAdapter
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
|
import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
|
||||||
import es.verdnatura.presentation.view.feature.collection.ItemVO
|
import es.verdnatura.presentation.view.feature.collection.ItemVO
|
||||||
import es.verdnatura.presentation.view.feature.collection.adapter.SaleAdapterReserve
|
import es.verdnatura.presentation.view.feature.collection.adapter.SaleAdapterNew
|
||||||
import es.verdnatura.presentation.view.feature.collection.mapper.map
|
import es.verdnatura.presentation.view.feature.collection.mapper.map
|
||||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||||
|
@ -82,7 +78,7 @@ import org.json.JSONObject
|
||||||
variables:
|
variables:
|
||||||
isVerifiedCollection
|
isVerifiedCollection
|
||||||
*/
|
*/
|
||||||
class CollectionFragmentPickerPreviousNewInterface(
|
class CollectionFragmentPickerPreviousNew(
|
||||||
var collection: CollectionTicket,
|
var collection: CollectionTicket,
|
||||||
var type: String = PRESACADOR,
|
var type: String = PRESACADOR,
|
||||||
private var hasPickingOrder: Boolean = false
|
private var hasPickingOrder: Boolean = false
|
||||||
|
@ -90,7 +86,7 @@ class CollectionFragmentPickerPreviousNewInterface(
|
||||||
CollectionViewModel::class
|
CollectionViewModel::class
|
||||||
) {
|
) {
|
||||||
private var sales: List<Sale> = listOf()
|
private var sales: List<Sale> = listOf()
|
||||||
private var saleAdapter: SaleAdapterReserve? = null
|
private var saleAdapter: SaleAdapterNew? = null
|
||||||
private var lm: LinearLayoutManager? = null
|
private var lm: LinearLayoutManager? = null
|
||||||
private var storedPosition: Int = 0
|
private var storedPosition: Int = 0
|
||||||
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
|
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
|
||||||
|
@ -119,7 +115,7 @@ class CollectionFragmentPickerPreviousNewInterface(
|
||||||
companion object {
|
companion object {
|
||||||
fun newInstance(
|
fun newInstance(
|
||||||
collection: CollectionTicket, type: String, hasPickingOrder: Boolean = false
|
collection: CollectionTicket, type: String, hasPickingOrder: Boolean = false
|
||||||
) = CollectionFragmentPickerPreviousNewInterface(collection, type, hasPickingOrder)
|
) = CollectionFragmentPickerPreviousNew(collection, type, hasPickingOrder)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onAttach(context: Context) {
|
override fun onAttach(context: Context) {
|
||||||
|
@ -141,7 +137,6 @@ class CollectionFragmentPickerPreviousNewInterface(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
println("El tipo es $type ")
|
|
||||||
customDialogList = CustomDialogList(requireContext())
|
customDialogList = CustomDialogList(requireContext())
|
||||||
customDialogInput = CustomDialogInput(requireContext())
|
customDialogInput = CustomDialogInput(requireContext())
|
||||||
customDialog = CustomDialog(requireContext())
|
customDialog = CustomDialog(requireContext())
|
||||||
|
@ -159,9 +154,9 @@ class CollectionFragmentPickerPreviousNewInterface(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setToolBar() {
|
private fun setToolBar() {
|
||||||
binding.mainToolbar.toolbarSubtitle.visibility = VISIBLE
|
binding.mainToolbar.toolbarSubtitle.visibility = View.VISIBLE
|
||||||
binding.mainToolbar.toolbarIcons.visibility = VISIBLE
|
binding.mainToolbar.toolbarIcons.visibility = View.VISIBLE
|
||||||
binding.mainToolbar.backButton.visibility = VISIBLE
|
binding.mainToolbar.backButton.visibility = View.VISIBLE
|
||||||
collection.collectionFk.let {
|
collection.collectionFk.let {
|
||||||
binding.mainToolbar.toolbarTitle.text = collection.collectionFk.toString()
|
binding.mainToolbar.toolbarTitle.text = collection.collectionFk.toString()
|
||||||
}
|
}
|
||||||
|
@ -238,7 +233,6 @@ class CollectionFragmentPickerPreviousNewInterface(
|
||||||
when (myQr.table) {
|
when (myQr.table) {
|
||||||
"saleGroup" -> {
|
"saleGroup" -> {
|
||||||
binding.scanInput.setText(myQr.id.toString())
|
binding.scanInput.setText(myQr.id.toString())
|
||||||
findSale(binding.scanInput.text.toString())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
"buy" -> binding.scanInput.setText(myQr.more)
|
"buy" -> binding.scanInput.setText(myQr.more)
|
||||||
|
@ -342,7 +336,6 @@ class CollectionFragmentPickerPreviousNewInterface(
|
||||||
lm!!.scrollToPositionWithOffset(positionConfirm, 0)
|
lm!!.scrollToPositionWithOffset(positionConfirm, 0)
|
||||||
//lm!!.scrollToPositionWithOffset(storedBackPosition + 1, 0)
|
//lm!!.scrollToPositionWithOffset(storedBackPosition + 1, 0)
|
||||||
setTotalLines()
|
setTotalLines()
|
||||||
saleAdapter!!.notifyItemChanged(positionConfirm)
|
|
||||||
} else {
|
} else {
|
||||||
updateScreen()
|
updateScreen()
|
||||||
}
|
}
|
||||||
|
@ -365,7 +358,8 @@ class CollectionFragmentPickerPreviousNewInterface(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loadResponseReserveAddPrevOK.observe(viewLifecycleOwner) { event ->
|
loadResponseReserveAddPrevOK.observe(viewLifecycleOwner) { event ->
|
||||||
event.getContentIfNotHandled().notNull {}
|
event.getContentIfNotHandled().notNull {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
loadSetStateResponse.observe(viewLifecycleOwner) { event ->
|
loadSetStateResponse.observe(viewLifecycleOwner) { event ->
|
||||||
event.getContentIfNotHandled().notNull {
|
event.getContentIfNotHandled().notNull {
|
||||||
|
@ -401,139 +395,116 @@ class CollectionFragmentPickerPreviousNewInterface(
|
||||||
binding.mainToolbar.toolbarTitle.text = collection.collectionFk.toString()
|
binding.mainToolbar.toolbarTitle.text = collection.collectionFk.toString()
|
||||||
|
|
||||||
collection.map(requireContext())
|
collection.map(requireContext())
|
||||||
|
val salesList: ArrayList<Sale> = ArrayList()
|
||||||
|
|
||||||
val sectorFk = mobileApplication.dataStoreApp.readDataStoreKey<Int>(SECTORFK)
|
tickets = ArrayList()
|
||||||
if (collection.sectorFk != null && collection.sectorFk != sectorFk) {
|
var observations = ""
|
||||||
|
val myPickingFrom = mobileApplication.dataStoreApp.readDataStoreKey<Int>("PICKING_FROM")
|
||||||
|
val myPickingTo = mobileApplication.dataStoreApp.readDataStoreKey<Int>("PICKING_TO")
|
||||||
|
collection.tickets.forEach { ticket ->
|
||||||
|
|
||||||
ma.messageWithSound(
|
if (observations.isNotEmpty()) observations = observations + " " + ticket.observations
|
||||||
getString(R.string.cambia_el_sector_vas_a_preparar_una_previa_que_no_es_de_tu_sector),
|
ticket.sales.forEach { sale ->
|
||||||
isError = true,
|
|
||||||
isPlayed = true,
|
|
||||||
isToasted = false
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
|
|
||||||
val salesList: ArrayList<Sale> = ArrayList()
|
if (hasPickingOrder) {
|
||||||
|
if (sale.pickingOrder != null && sale.pickingOrder in myPickingFrom..myPickingTo) {
|
||||||
tickets = ArrayList()
|
|
||||||
var observations = ""
|
|
||||||
val myPickingFrom = mobileApplication.dataStoreApp.readDataStoreKey<Int>("PICKING_FROM")
|
|
||||||
val myPickingTo = mobileApplication.dataStoreApp.readDataStoreKey<Int>("PICKING_TO")
|
|
||||||
collection.tickets.forEach { ticket ->
|
|
||||||
|
|
||||||
if (observations.isNotEmpty()) observations =
|
|
||||||
observations + " " + ticket.observations
|
|
||||||
ticket.sales.forEach { sale ->
|
|
||||||
|
|
||||||
if (hasPickingOrder) {
|
|
||||||
if (sale.pickingOrder != null && sale.pickingOrder in myPickingFrom..myPickingTo) {
|
|
||||||
salesList.add(sale)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
salesList.add(sale)
|
salesList.add(sale)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
}
|
salesList.add(sale)
|
||||||
}
|
|
||||||
// sales = salesList.sortedWith(compareBy<Sale> { it.pickingOrderPrevia }.thenBy { it.itemFk })
|
|
||||||
//quitar comentarios FALTA AGRUPAR LAS PREVIAS
|
|
||||||
|
|
||||||
when (type) {
|
|
||||||
PREITEMPICKERTEST -> {
|
|
||||||
myGroupList =
|
|
||||||
salesList.sortedWith(compareBy<Sale> { it.pickingOrder }.thenBy { it.itemFk })
|
|
||||||
}
|
|
||||||
|
|
||||||
SACADOR -> {
|
|
||||||
myGroupList =
|
|
||||||
groupSaleGroup(salesList).sortedWith(compareBy<Sale> { it.pickingOrder }.thenBy { it.itemFk })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// sales = salesList.sortedWith(compareBy<Sale> { it.pickingOrderPrevia }.thenBy { it.itemFk })
|
||||||
|
//quitar comentarios FALTA AGRUPAR LAS PREVIAS
|
||||||
|
|
||||||
|
when (type) {
|
||||||
|
PREITEMPICKERTEST -> {
|
||||||
|
myGroupList =
|
||||||
|
salesList.sortedWith(compareBy<Sale> { it.pickingOrder }.thenBy { it.itemFk })
|
||||||
|
}
|
||||||
|
|
||||||
|
SACADOR -> {
|
||||||
|
myGroupList =
|
||||||
|
groupSaleGroup(salesList).sortedWith(compareBy<Sale> { it.pickingOrder }.thenBy { it.itemFk })
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
saleAdapter = SaleAdapterReserve(myGroupList, pasillerosItemClickListener!!,
|
saleAdapter = SaleAdapterNew(myGroupList, pasillerosItemClickListener!!,
|
||||||
|
|
||||||
object : OnSaleClickSaleListener {
|
object : OnSaleClickSaleListener {
|
||||||
override fun onSaleClick(sale: Sale) {
|
override fun onSaleClick(sale: Sale) {
|
||||||
|
|
||||||
println("sale ${sale.saleFk} ${sale.itemFk} ${sale.isPicked}")
|
val position =
|
||||||
val position =
|
myGroupList.indexOfFirst { it.itemShelvingSaleFk == sale.itemShelvingSaleFk }
|
||||||
myGroupList.indexOfFirst { it.itemShelvingSaleFk == sale.itemShelvingSaleFk }
|
if (position > -1) {
|
||||||
if (position > -1 && !myGroupList[position].isParent) {
|
if (sale.isPicked == 1) {
|
||||||
if (sale.isPicked == 1) {
|
unMarkLine(position, myGroupList[position])
|
||||||
unMarkLine(position, myGroupList[position])
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if (sale.itemShelvingSaleFk == 0 && sale.itemShelvingFk == 0 && sale.code.isNullOrEmpty())
|
|
||||||
showManagement(sale)
|
|
||||||
else {
|
|
||||||
showScanner(position, sale)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
//TODO desmarcamos una linea de previa ?
|
showScanner(position, sale)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}, object : OnMistakeClickListener {
|
}
|
||||||
override fun onMistakeClickListener(sale: SaleVO) {
|
|
||||||
}
|
|
||||||
}, object : OnPackingClickSaleListener {
|
|
||||||
override fun onPackingClick(sale: Sale) {
|
|
||||||
|
|
||||||
if (!sale.code.isNullOrEmpty()) ma.onPasillerosItemClickListener(
|
}, object : OnMistakeClickListener {
|
||||||
PasillerosItemVO(
|
override fun onMistakeClickListener(sale: SaleVO) {
|
||||||
title = R.string.titleUbicator,
|
}
|
||||||
), entryPoint = sale.code
|
}, object : OnPackingClickSaleListener {
|
||||||
|
override fun onPackingClick(sale: Sale) {
|
||||||
|
|
||||||
|
if (!sale.code.isNullOrEmpty()) ma.onPasillerosItemClickListener(
|
||||||
|
PasillerosItemVO(
|
||||||
|
title = R.string.titleUbicator,
|
||||||
|
), entryPoint = sale.code
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}, object : OnTicketClickSaleListener {
|
||||||
|
override fun onTicketClickListener(sale: Sale) {
|
||||||
|
val entryPoint = Gson().toJson(
|
||||||
|
mutableMapOf(
|
||||||
|
"entryPoint" to sale.ticketFk, "web" to "${
|
||||||
|
mobileApplication.dataStoreApp.readDataStoreKey<String>(
|
||||||
|
BASEURLSALIX
|
||||||
|
)
|
||||||
|
}/#!/ticket/${sale.ticketFk}/sale"
|
||||||
)
|
)
|
||||||
}
|
)
|
||||||
}, object : OnTicketClickSaleListener {
|
ma.onPasillerosItemClickListener(
|
||||||
override fun onTicketClickListener(sale: Sale) {
|
PasillerosItemVO(
|
||||||
val entryPoint = Gson().toJson(
|
title = R.string.titleWebViewer,
|
||||||
mutableMapOf(
|
), entryPoint = entryPoint
|
||||||
"entryPoint" to sale.ticketFk, "web" to "${
|
)
|
||||||
mobileApplication.dataStoreApp.readDataStoreKey<String>(
|
}
|
||||||
BASEURLSALIX
|
}, onReserveSaleClick = object : OnSaleReserveClickListener {
|
||||||
)
|
override fun onSaleReserveListener(sale: Sale) {
|
||||||
}/#!/ticket/${sale.ticketFk}/sale"
|
showDeleteItemShelving(sale)
|
||||||
)
|
}
|
||||||
)
|
|
||||||
ma.onPasillerosItemClickListener(
|
|
||||||
PasillerosItemVO(
|
|
||||||
title = R.string.titleWebViewer,
|
|
||||||
), entryPoint = entryPoint
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}, onReserveSaleClick = object : OnSaleReserveClickListener {
|
|
||||||
override fun onSaleReserveListener(sale: Sale) {
|
|
||||||
showDeleteItemShelving(sale)
|
|
||||||
}
|
|
||||||
|
|
||||||
}, onAddItemClickListener = object : OnAddItemClickListener {
|
}, onAddItemClickListener = object : OnAddItemClickListener {
|
||||||
|
|
||||||
override fun onAddItemClickListener(sale: Sale) {
|
override fun onAddItemClickListener(sale: Sale) {
|
||||||
customDialogAddItemFromSale(sale)
|
customDialogAddItemFromSale(sale)
|
||||||
}
|
}
|
||||||
|
|
||||||
}, type = type
|
}, type = type
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||||
binding.fragmentSacadorCollections.adapter = saleAdapter
|
binding.fragmentSacadorCollections.adapter = saleAdapter
|
||||||
binding.fragmentSacadorCollections.layoutManager = lm
|
binding.fragmentSacadorCollections.layoutManager = lm
|
||||||
|
|
||||||
setTotalLines()
|
setTotalLines()
|
||||||
setListPosition()
|
setListPosition()
|
||||||
setScrollListener(lm!!)
|
setScrollListener(lm!!)
|
||||||
printObservations(observations)
|
printObservations(observations)
|
||||||
if (!isVerifiedCollection && type == PREPARED) {
|
if (!isVerifiedCollection && type == PREPARED) {
|
||||||
binding.fragmentSacadorCollections.visibility = View.INVISIBLE
|
binding.fragmentSacadorCollections.visibility = View.INVISIBLE
|
||||||
verifyCollection()
|
verifyCollection()
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -588,27 +559,14 @@ class CollectionFragmentPickerPreviousNewInterface(
|
||||||
isFoundSale = true
|
isFoundSale = true
|
||||||
storedPosition = indice
|
storedPosition = indice
|
||||||
viewModel.itemShelvingSaleSetSaleGroup(txtscan.toInt())
|
viewModel.itemShelvingSaleSetSaleGroup(txtscan.toInt())
|
||||||
//actualizamos padre
|
setStateSaleGroup(txtscan.toInt())
|
||||||
myGroupList[indice].stateCode =
|
myGroupList[indice].stateCode =
|
||||||
if (myGroupList[indice].stateCode == "PREPARED") {
|
if (myGroupList[indice].stateCode == "PREPARED") {
|
||||||
"OK PREVIOUS"
|
"OK PREVIOUS"
|
||||||
} else {
|
} else {
|
||||||
"PREPARED"
|
"PREPARED"
|
||||||
}
|
}
|
||||||
//actualizamos hijos
|
saleAdapter!!.notifyDataSetChanged()
|
||||||
myGroupList[indice].sonSales.forEach {
|
|
||||||
it.stateCode = myGroupList[indice].stateCode
|
|
||||||
}
|
|
||||||
//actualizamos saleGroup
|
|
||||||
setStateSaleGroup(
|
|
||||||
txtscan.toInt(), if (myGroupList[indice].stateCode == "PREPARED") {
|
|
||||||
14
|
|
||||||
} else {
|
|
||||||
28
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
// saleAdapter!!.notifyDataSetChanged()
|
|
||||||
break
|
break
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -632,10 +590,7 @@ class CollectionFragmentPickerPreviousNewInterface(
|
||||||
for (indice in sales.indices) {
|
for (indice in sales.indices) {
|
||||||
if (sales[indice].saleGroupFk != null && sales[indice].saleGroupFk == saleGroupScanned.toInt()) {
|
if (sales[indice].saleGroupFk != null && sales[indice].saleGroupFk == saleGroupScanned.toInt()) {
|
||||||
viewModel.itemShelvingSaleSetSaleGroup(saleGroupScanned.toInt())
|
viewModel.itemShelvingSaleSetSaleGroup(saleGroupScanned.toInt())
|
||||||
setStateSaleGroup(
|
setStateSaleGroup(saleGroupScanned.toInt())
|
||||||
saleGroupScanned.toInt(),
|
|
||||||
if (sales[indice].stateCode == "PREPARED") 28 else 14
|
|
||||||
)
|
|
||||||
storedPosition = indice
|
storedPosition = indice
|
||||||
mpok!!.start()
|
mpok!!.start()
|
||||||
return true
|
return true
|
||||||
|
@ -753,18 +708,8 @@ class CollectionFragmentPickerPreviousNewInterface(
|
||||||
val longName = myGroupList[pos].longName
|
val longName = myGroupList[pos].longName
|
||||||
val totalReserved = myGroupList[pos].reservedQuantity
|
val totalReserved = myGroupList[pos].reservedQuantity
|
||||||
|
|
||||||
val spannable = SpannableString("$item\n$longName")
|
|
||||||
|
|
||||||
spannable.setSpan(
|
|
||||||
AbsoluteSizeSpan(
|
|
||||||
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 16f, resources.displayMetrics)
|
|
||||||
.toInt(), true
|
|
||||||
), 0, item.toString().length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
|
|
||||||
)
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
customDialogList.setTitleSpannable(spannable)
|
customDialogList.setTitle("$shelving($item) $totalReserved de $longName").setOkButton(
|
||||||
customDialogList.setOkButton(
|
|
||||||
getString(
|
getString(
|
||||||
R.string.take
|
R.string.take
|
||||||
)
|
)
|
||||||
|
@ -776,9 +721,8 @@ class CollectionFragmentPickerPreviousNewInterface(
|
||||||
customDialogList.dismiss()
|
customDialogList.dismiss()
|
||||||
scanRequest()
|
scanRequest()
|
||||||
|
|
||||||
}.setHintValue(getString(R.string.quantitySelect)).setTextSize(20f)
|
}.setHintValue(getString(R.string.quantitySelect)).setValue(totalReserved.toString())
|
||||||
.setValue(totalReserved.toString()).setHintValueTwo(getString(R.string.scanItem))
|
.setHintValueTwo(getString(R.string.scanItem)).setValueTwo("").show()
|
||||||
.setValueTwo("").show()
|
|
||||||
|
|
||||||
customDialogList.getEditTextTwo().setOnEditorActionListener { v, actionId, event ->
|
customDialogList.getEditTextTwo().setOnEditorActionListener { v, actionId, event ->
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
||||||
|
@ -840,11 +784,7 @@ class CollectionFragmentPickerPreviousNewInterface(
|
||||||
mpok?.start()
|
mpok?.start()
|
||||||
ma.hideKeyboard(customDialogList.getEditTextTwo())
|
ma.hideKeyboard(customDialogList.getEditTextTwo())
|
||||||
customDialogList.dismiss()
|
customDialogList.dismiss()
|
||||||
requireContext().showToastCenterWithBackground(
|
requireContext().showToastCenterWithBackground(myGroupList[position].ticketFk.toString())
|
||||||
if (type == PREITEMPICKERTEST) "(" + myGroupList[position].ticketOrder + ")" + myGroupList[position].ticketFk.toString() else {
|
|
||||||
myGroupList[position].ticketFk.toString()
|
|
||||||
}
|
|
||||||
)
|
|
||||||
scanRequest()
|
scanRequest()
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -1117,22 +1057,18 @@ class CollectionFragmentPickerPreviousNewInterface(
|
||||||
println("No hay salegroup")
|
println("No hay salegroup")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
if (distinctSaleGroups.isNotEmpty())
|
||||||
if (distinctSaleGroups.isNotEmpty()) distinctSaleGroups.forEach { saleGroup ->
|
distinctSaleGroups.forEach { saleGroup ->
|
||||||
setStateSaleGroup(saleGroup, stateCodeId!!)
|
setStateSaleGroup(saleGroup)
|
||||||
}
|
}
|
||||||
} catch (ex: Exception) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setStateSaleGroup(saleGroup: Number, stateCode: Number) {
|
private fun setStateSaleGroup(saleGroup: Number) {
|
||||||
viewModel.saleGroupUpdateState(saleGroup, stateCode)
|
viewModel.saleGroupUpdateState(saleGroup, stateCodeId!!)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showScanner(index: Int, sale: Sale) {
|
private fun showScanner(index: Int, sale: Sale) {
|
||||||
|
@ -1187,8 +1123,6 @@ class CollectionFragmentPickerPreviousNewInterface(
|
||||||
}
|
}
|
||||||
} else { // si tiene saleGroup se crea el padre con el tamaño e indicando que es padre, como ejemplo se toma el primer elemento
|
} else { // si tiene saleGroup se crea el padre con el tamaño e indicando que es padre, como ejemplo se toma el primer elemento
|
||||||
/*crea padre*/
|
/*crea padre*/
|
||||||
|
|
||||||
println("saleGroup $key lineas ${value.size}")
|
|
||||||
if (value.size > 1) {
|
if (value.size > 1) {
|
||||||
val mySale = //= value[0]
|
val mySale = //= value[0]
|
||||||
Sale(
|
Sale(
|
||||||
|
@ -1209,11 +1143,8 @@ class CollectionFragmentPickerPreviousNewInterface(
|
||||||
origin = value[0].origin,
|
origin = value[0].origin,
|
||||||
size = value[0].size,
|
size = value[0].size,
|
||||||
itemShelvingSaleFk = value[0].itemShelvingSaleFk,
|
itemShelvingSaleFk = value[0].itemShelvingSaleFk,
|
||||||
longName = value[0].parkingCodePrevia ?: "",
|
longName = value[0].parkingCode ?: "",
|
||||||
itemShelvingFk = 0,
|
itemShelvingFk = 0
|
||||||
ticketOrder = value[0].ticketOrder ?: null,
|
|
||||||
parkingCodePrevia = value[0].parkingCodePrevia,
|
|
||||||
stateCode = value[0].stateCode
|
|
||||||
)
|
)
|
||||||
|
|
||||||
//prime elemento//hay que hacer una copia si no queda la referencia
|
//prime elemento//hay que hacer una copia si no queda la referencia
|
||||||
|
@ -1273,7 +1204,7 @@ class CollectionFragmentPickerPreviousNewInterface(
|
||||||
if (foundTicketInCollection != null) {
|
if (foundTicketInCollection != null) {
|
||||||
isVerifiedCollection = true
|
isVerifiedCollection = true
|
||||||
ma.hideKeyboard(customDialogList.getEditText())
|
ma.hideKeyboard(customDialogList.getEditText())
|
||||||
binding.fragmentSacadorCollections.visibility = VISIBLE
|
binding.fragmentSacadorCollections.visibility = View.VISIBLE
|
||||||
customDialogList.dismiss()
|
customDialogList.dismiss()
|
||||||
binding.scanInput.requestFocus()
|
binding.scanInput.requestFocus()
|
||||||
} else {
|
} else {
|
||||||
|
@ -1341,40 +1272,4 @@ class CollectionFragmentPickerPreviousNewInterface(
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showManagement(sale: Sale) {
|
|
||||||
customDialogThreeButtons = CustomDialogThreeButtons(requireContext())
|
|
||||||
customDialogThreeButtons.setCustomDialogValue(View.GONE)
|
|
||||||
customDialogThreeButtons.setTitle("Gestionar línea artículo ${sale.itemFk}")
|
|
||||||
.setDescription("Selecciona RESERVAR para añadir reserva y que muestre ubicación")
|
|
||||||
.setOkButton("Reservar") {
|
|
||||||
viewModel.itemShelvingSaleAddByCollection(collection.collectionFk)
|
|
||||||
closeCustomDialogManagement(binding.scanInput, customDialogThreeButtons)
|
|
||||||
}/*.setOkButtonTwo("Poner a cero la cantidad") {
|
|
||||||
viewModel.collectionIncreaseQuantitySalix(sale.saleFk, "0")
|
|
||||||
closeCustomDialogManagement(binding.scanInput, customDialogThreeButtons)
|
|
||||||
}*/
|
|
||||||
.setKoButton(getString(R.string.cancel)) {
|
|
||||||
closeCustomDialogManagement(binding.scanInput, customDialogThreeButtons)
|
|
||||||
}.setValue("").show()
|
|
||||||
|
|
||||||
/* customDialogThreeButtons.getEditText().setOnEditorActionListener { v, actionId, event ->
|
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
|
||||||
findSaleAction(index, sale)
|
|
||||||
return@setOnEditorActionListener false
|
|
||||||
}
|
|
||||||
false
|
|
||||||
}*/
|
|
||||||
customDialogThreeButtons.getEditText().requestFocus()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun closeCustomDialogManagement(
|
|
||||||
scanInput: EditText,
|
|
||||||
customDialogInput: CustomDialogThreeButtons
|
|
||||||
) {
|
|
||||||
requireContext().hideKeyboard(customDialogInput.getEditText())
|
|
||||||
scanInput.requestFocus()
|
|
||||||
customDialogInput.dismiss()
|
|
||||||
scanInput.requestFocus()
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -103,7 +103,6 @@ class CollectionFragmentPreChecker(
|
||||||
private var positionIncreaseQuantity = 0
|
private var positionIncreaseQuantity = 0
|
||||||
private var positionReject = 0
|
private var positionReject = 0
|
||||||
private var quantityIncrease: Int = 0
|
private var quantityIncrease: Int = 0
|
||||||
private var quantityIncreaseDiff: Int = 0
|
|
||||||
private var quantityReject = ""
|
private var quantityReject = ""
|
||||||
private var typeCollectionMissing = ""
|
private var typeCollectionMissing = ""
|
||||||
private var positionCollectionMissing = 0
|
private var positionCollectionMissing = 0
|
||||||
|
@ -688,22 +687,20 @@ class CollectionFragmentPreChecker(
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
loadIncQuantity.observe(viewLifecycleOwner) { event ->
|
responseIncQuantity.observe(viewLifecycleOwner, Observer {
|
||||||
event.getContentIfNotHandled().notNull {
|
|
||||||
|
|
||||||
if (it.isError) {
|
if (it.isError) {
|
||||||
ma.messageWithSound(it.errorMessage, isError = true, true)
|
ma.messageWithSound(it.errorMessage, isError = true, true)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (!goBack) {
|
||||||
|
incresaseSuccesful()
|
||||||
} else {
|
} else {
|
||||||
if (!goBack) {
|
goBack = false
|
||||||
incresaseSuccesful()
|
|
||||||
} else {
|
|
||||||
goBack = false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
})
|
||||||
|
|
||||||
responseSaleMistakeAdd.observe(viewLifecycleOwner, Observer {
|
responseSaleMistakeAdd.observe(viewLifecycleOwner, Observer {
|
||||||
|
|
||||||
|
@ -984,11 +981,10 @@ class CollectionFragmentPreChecker(
|
||||||
sales = salesList.sortedWith(compareBy({ it.picked }))
|
sales = salesList.sortedWith(compareBy({ it.picked }))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
saleAdapter =
|
saleAdapter =
|
||||||
SaleAdapter(
|
SaleAdapter(
|
||||||
if (sales.isEmpty()) sales.toMutableList() else {
|
sales as MutableList,
|
||||||
sales as MutableList
|
|
||||||
},
|
|
||||||
pasillerosItemClickListener!!,
|
pasillerosItemClickListener!!,
|
||||||
object : OnQuantityClickListener {
|
object : OnQuantityClickListener {
|
||||||
|
|
||||||
|
@ -1092,10 +1088,9 @@ class CollectionFragmentPreChecker(
|
||||||
setListPosition(storedBackPosition, true)
|
setListPosition(storedBackPosition, true)
|
||||||
|
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
printObservations(observations)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printObservations(observations)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setScrollListener(lm: LinearLayoutManager) {
|
private fun setScrollListener(lm: LinearLayoutManager) {
|
||||||
|
@ -1538,6 +1533,7 @@ class CollectionFragmentPreChecker(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
private fun printShelvingResult(placementSupplyListVO: PlacementSupplyListVO) {
|
private fun printShelvingResult(placementSupplyListVO: PlacementSupplyListVO) {
|
||||||
var shelving = ""
|
var shelving = ""
|
||||||
var item = ""
|
var item = ""
|
||||||
|
@ -1634,7 +1630,7 @@ class CollectionFragmentPreChecker(
|
||||||
requireActivity().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
requireActivity().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||||
lManager.hideSoftInputFromWindow(
|
lManager.hideSoftInputFromWindow(
|
||||||
customDialogList.getEditTextTwo().windowToken,
|
customDialogList.getEditTextTwo().windowToken,
|
||||||
InputMethodManager.HIDE_IMPLICIT_ONLY
|
InputMethodManager.SHOW_IMPLICIT
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2028,21 +2024,7 @@ class CollectionFragmentPreChecker(
|
||||||
|
|
||||||
changeTicketState()
|
changeTicketState()
|
||||||
|
|
||||||
//cambiamos estado de previas para saber que está PREVIOUS_CONTROLLED
|
|
||||||
val distinctSaleGroups = mutableSetOf<Int>()
|
|
||||||
sales.forEach { sale ->
|
|
||||||
sale.saleGroupFk?.let {
|
|
||||||
distinctSaleGroups.add(it.toInt())
|
|
||||||
} ?: run {
|
|
||||||
println("No hay salegroup")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (distinctSaleGroups.isNotEmpty())
|
|
||||||
distinctSaleGroups.forEach { saleGroup ->
|
|
||||||
viewModel.saleGroupUpdateState(saleGroup, 37)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun ticketCollection_setUsedShelves() {
|
private fun ticketCollection_setUsedShelves() {
|
||||||
|
@ -2105,19 +2087,49 @@ class CollectionFragmentPreChecker(
|
||||||
private fun showQuantityDialog(position: Int) {
|
private fun showQuantityDialog(position: Int) {
|
||||||
customDialogThreeButtons.setDescription(getString(R.string.itemSaleQuantity))
|
customDialogThreeButtons.setDescription(getString(R.string.itemSaleQuantity))
|
||||||
.setValue("")
|
.setValue("")
|
||||||
|
|
||||||
|
//Tarea4495
|
||||||
|
// if (type != SACADOR) {
|
||||||
|
/* customDialogThreeButtons.setOkButton(getString(R.string.titleFaults)) {
|
||||||
|
checkAndCall(
|
||||||
|
position,
|
||||||
|
customDialogThreeButtons.getValue(),
|
||||||
|
getString(R.string.titleFaults)
|
||||||
|
)
|
||||||
|
|
||||||
|
}.setOkButtonTwo(getString(R.string.BasuraRechazar)) {
|
||||||
|
|
||||||
|
checkAndCall(
|
||||||
|
position,
|
||||||
|
customDialogThreeButtons.getValue(),
|
||||||
|
getString(R.string.BasuraRechazar)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
// }
|
||||||
|
|
||||||
|
customDialogThreeButtons.setOkButtonThree(getString(R.string.Reject)) {
|
||||||
|
checkAndCall(
|
||||||
|
position,
|
||||||
|
customDialogThreeButtons.getValue(),
|
||||||
|
getString(R.string.Reject)
|
||||||
|
)
|
||||||
|
|
||||||
|
}.setOkButtonFour(getString(R.string.Split)) {
|
||||||
|
checkAndCall(
|
||||||
|
position,
|
||||||
|
customDialogThreeButtons.getValue(),
|
||||||
|
getString(R.string.Split)
|
||||||
|
)*/
|
||||||
|
|
||||||
.setOkButtonAdd(getString(R.string.Agregar)) {
|
.setOkButtonAdd(getString(R.string.Agregar)) {
|
||||||
if (customDialogThreeButtons.getValue().isNotEmpty()) {
|
/* checkAndCall(
|
||||||
increaseQuantity(position, customDialogThreeButtons.getValue().toInt())
|
position,
|
||||||
scanRequest()
|
customDialogThreeButtons.getValue(),
|
||||||
customDialogThreeButtons.dismiss()
|
getString(R.string.Agregar)
|
||||||
} else {
|
)*/
|
||||||
ma.messageWithSound(
|
increaseQuantity(position, customDialogThreeButtons.getValue().toInt())
|
||||||
getString(R.string.errorInputQuantity),
|
scanRequest()
|
||||||
isError = true,
|
customDialogThreeButtons.dismiss()
|
||||||
isPlayed = true,
|
|
||||||
isToasted = true
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
}.setKoButton(getString(R.string.cancel)) {
|
}.setKoButton(getString(R.string.cancel)) {
|
||||||
scanRequest()
|
scanRequest()
|
||||||
|
@ -2163,21 +2175,15 @@ class CollectionFragmentPreChecker(
|
||||||
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
}
|
}
|
||||||
|
|
||||||
sales[positionIncreaseQuantity].originalQuantity = quantityIncrease
|
|
||||||
saleAdapter?.notifyDataSetChanged()
|
saleAdapter?.notifyDataSetChanged()
|
||||||
|
|
||||||
viewModel.itemShelvingSaleBySale(
|
sales[positionIncreaseQuantity].originalQuantity = quantityIncrease
|
||||||
sales[positionIncreaseQuantity].saleFk,
|
|
||||||
quantityIncreaseDiff
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun increaseQuantity(position: Int, quantity: Int) {
|
private fun increaseQuantity(position: Int, quantity: Int) {
|
||||||
positionIncreaseQuantity = position
|
positionIncreaseQuantity = position
|
||||||
quantityIncrease = quantity
|
quantityIncrease = quantity
|
||||||
quantityIncreaseDiff = sales[position].quantity!!.minus(quantityIncrease)
|
|
||||||
|
|
||||||
viewModel.collectionIncreaseQuantitySalix(
|
viewModel.collectionIncreaseQuantitySalix(
|
||||||
saleFk = sales[position].saleFk,
|
saleFk = sales[position].saleFk,
|
||||||
|
|
|
@ -6,15 +6,13 @@ import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.map
|
import androidx.lifecycle.map
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import es.verdnatura.MobileApplication
|
import es.verdnatura.MobileApplication
|
||||||
import es.verdnatura.R
|
|
||||||
import es.verdnatura.domain.SalixCallback
|
import es.verdnatura.domain.SalixCallback
|
||||||
import es.verdnatura.domain.formatWithQuotes
|
import es.verdnatura.domain.formatWithQuotes
|
||||||
import es.verdnatura.domain.getMessageFromAllResponse
|
|
||||||
import es.verdnatura.domain.nameofFunction
|
|
||||||
import es.verdnatura.domain.toast
|
import es.verdnatura.domain.toast
|
||||||
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
||||||
import es.verdnatura.domain.userCases.WorkerActivityUseCase
|
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
|
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||||
|
import es.verdnatura.presentation.base.nameofFunction
|
||||||
import es.verdnatura.presentation.common.Event
|
import es.verdnatura.presentation.common.Event
|
||||||
import es.verdnatura.presentation.common.ItemShelving
|
import es.verdnatura.presentation.common.ItemShelving
|
||||||
import es.verdnatura.presentation.common.ResponseItemVO
|
import es.verdnatura.presentation.common.ResponseItemVO
|
||||||
|
@ -24,23 +22,18 @@ import es.verdnatura.presentation.common.TicketState
|
||||||
import es.verdnatura.presentation.view.feature.collection.ItemVO
|
import es.verdnatura.presentation.view.feature.collection.ItemVO
|
||||||
import es.verdnatura.presentation.view.feature.collection.SalixSaleQuantity
|
import es.verdnatura.presentation.view.feature.collection.SalixSaleQuantity
|
||||||
import es.verdnatura.presentation.view.feature.collection.mapper.map
|
import es.verdnatura.presentation.view.feature.collection.mapper.map
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.CleanAction
|
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.WorkerActionSalix
|
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionTicket
|
import es.verdnatura.presentation.view.feature.sacador.model.CollectionTicket
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.ItemShelvingSale
|
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeListVO
|
import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeListVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeVO
|
import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyListVO
|
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyListVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO
|
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO
|
||||||
import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicador
|
|
||||||
import es.verdnatura.presentation.view.feature.workermistake.model.SaleMistakeSalix
|
import es.verdnatura.presentation.view.feature.workermistake.model.SaleMistakeSalix
|
||||||
import es.verdnatura.presentation.view.feature.workermistake.model.SaleTrackingDelSalix
|
import es.verdnatura.presentation.view.feature.workermistake.model.SaleTrackingDelSalix
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
|
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
|
||||||
private val getWokerActivityUseCase = WorkerActivityUseCase(salix)
|
|
||||||
private val contextApp = context
|
private val contextApp = context
|
||||||
|
|
||||||
private val _responseState by lazy { MutableLiveData<ResponseItemVO>() }
|
private val _responseState by lazy { MutableLiveData<ResponseItemVO>() }
|
||||||
|
@ -199,11 +192,6 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
val responseStateId: LiveData<Number> = _responseStateId
|
val responseStateId: LiveData<Number> = _responseStateId
|
||||||
val loadResponseStateId: LiveData<Event<Number>> = _responseStateId.map { Event(it) }
|
val loadResponseStateId: LiveData<Event<Number>> = _responseStateId.map { Event(it) }
|
||||||
|
|
||||||
private val _responseStatePreparedId by lazy { MutableLiveData<Number>() }
|
|
||||||
val responseStatePreparedId: LiveData<Number> = _responseStatePreparedId
|
|
||||||
val loadResponseStatePreparedId: LiveData<Event<Number>> =
|
|
||||||
_responseStatePreparedId.map { Event(it) }
|
|
||||||
|
|
||||||
private val _mistakeList by lazy { MutableLiveData<MistakeTypeListVO>() }
|
private val _mistakeList by lazy { MutableLiveData<MistakeTypeListVO>() }
|
||||||
val mistakeList: LiveData<MistakeTypeListVO>
|
val mistakeList: LiveData<MistakeTypeListVO>
|
||||||
get() = _mistakeList
|
get() = _mistakeList
|
||||||
|
@ -237,16 +225,6 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
val loadSetStateResponse: LiveData<Event<Boolean>> =
|
val loadSetStateResponse: LiveData<Event<Boolean>> =
|
||||||
_setStateResponse.map { Event(it) }
|
_setStateResponse.map { Event(it) }
|
||||||
|
|
||||||
private val _responseActivity by lazy { MutableLiveData<CleanAction>() }
|
|
||||||
val responseActivity: LiveData<CleanAction> = _responseActivity
|
|
||||||
val loadResponseActivity: LiveData<Event<CleanAction>> =
|
|
||||||
_responseActivity.map { Event(it) }
|
|
||||||
|
|
||||||
private val _itemShelvingSaleAddByCollection by lazy { MutableLiveData<Boolean>() }
|
|
||||||
val itemShelvingSaleAddByCollection: LiveData<Boolean> = _itemShelvingSaleAddByCollection
|
|
||||||
val loadItemShelvingSaleAddByCollection: LiveData<Event<Boolean>> =
|
|
||||||
_itemShelvingSaleAddByCollection.map { Event(it) }
|
|
||||||
|
|
||||||
fun getSales(
|
fun getSales(
|
||||||
collectionFk: Number, print: String, source: String
|
collectionFk: Number, print: String, source: String
|
||||||
|
|
||||||
|
@ -369,54 +347,6 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun itemShelvingSaleBySale(
|
|
||||||
saleFk: Number, quantityDiff: Int
|
|
||||||
|
|
||||||
) {
|
|
||||||
salix.itemShelvingSaleTotalBySale(
|
|
||||||
filter = """{"where":{"saleFk":$saleFk},"limit":2}"""
|
|
||||||
).enqueue(object : SalixCallback<List<ItemShelvingSale>>(context) {
|
|
||||||
|
|
||||||
override fun onSuccess(response: Response<List<ItemShelvingSale>>) {
|
|
||||||
|
|
||||||
if (!response.body().isNullOrEmpty()) {
|
|
||||||
if (response.body()!!.size == 1) {
|
|
||||||
val itemList = response.body()
|
|
||||||
val itemShelvingFk = itemList?.firstOrNull()?.itemShelvingFk
|
|
||||||
salix.itemShelvingGet(
|
|
||||||
id = itemShelvingFk!!
|
|
||||||
).enqueue(object : SalixCallback<ItemShelving>(context) {
|
|
||||||
|
|
||||||
override fun onSuccess(response: Response<ItemShelving>) {
|
|
||||||
|
|
||||||
if (response.body() != null) {
|
|
||||||
val visible = response.body()!!.visible!!.toInt()
|
|
||||||
val differenceVisible = (visible + quantityDiff)
|
|
||||||
val available = response.body()!!.available!!.toInt()
|
|
||||||
val differenceAvailable = (available + quantityDiff)
|
|
||||||
|
|
||||||
val updateParams = mapOf(
|
|
||||||
"visible" to (differenceVisible),
|
|
||||||
"available" to (differenceAvailable)
|
|
||||||
)
|
|
||||||
|
|
||||||
salix.itemShelvingUpdate(
|
|
||||||
id = itemShelvingFk, params = updateParams
|
|
||||||
).enqueue(object : SalixCallback<ItemUbicador?>(context) {
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fun itemShelvingGet(
|
fun itemShelvingGet(
|
||||||
itemShelvingFk: Number, position: Int, quantity: Int
|
itemShelvingFk: Number, position: Int, quantity: Int
|
||||||
|
|
||||||
|
@ -572,10 +502,6 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
_responseCollectionAddItem.value = true
|
_responseCollectionAddItem.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onError(t: Throwable) {
|
|
||||||
|
|
||||||
super.onError(Throwable(context.getString(R.string.errorAddItemReserva)))
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -593,20 +519,6 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getStatePreparedId(stateCode: String) {
|
|
||||||
|
|
||||||
salix.getStateId(
|
|
||||||
filter = """{"where":{"code":"$stateCode"}, "fields":["id"]}""".trimMargin()
|
|
||||||
).enqueue(object : SalixCallback<JsonObject>(context) {
|
|
||||||
override fun onSuccess(response: Response<JsonObject>) {
|
|
||||||
_responseStatePreparedId.value =
|
|
||||||
response.body()?.get("id").toString().toInt()
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setStateSaleGroup(
|
fun setStateSaleGroup(
|
||||||
saleGroups: List<Number>, stateCode: Int
|
saleGroups: List<Number>, stateCode: Int
|
||||||
) {
|
) {
|
||||||
|
@ -890,20 +802,13 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addWorkerActivity(activity: CleanAction) {
|
fun getIdFromCodeSalix(code: String) {
|
||||||
getWokerActivityUseCase.addWorkerActivity(
|
getItemFromBarcodeUseCase.execute(code).enqueue(object : SalixCallback<Int?>(context) {
|
||||||
WorkerActionSalix(
|
override fun onSuccess(response: Response<Int?>) {
|
||||||
code = activity.codeWorkerAction.toString(),
|
_responseCode.value = response.body()
|
||||||
description = activity.description
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.enqueue(object : SalixCallback<Any>(context) {
|
|
||||||
override fun onSuccess(response: Response<Any>) {
|
|
||||||
println("shelvinAction onResposne${activity}")
|
|
||||||
_responseActivity.value = activity
|
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun saleGroupUpdateState(saleGroup: Number, codeState: Number) {
|
fun saleGroupUpdateState(saleGroup: Number, codeState: Number) {
|
||||||
|
@ -1147,23 +1052,4 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getIdFromCodeSalix(code: String) {
|
|
||||||
getItemFromBarcodeUseCase.execute(code).enqueue(object : SalixCallback<Int?>(context) {
|
|
||||||
override fun onSuccess(response: Response<Int?>) {
|
|
||||||
_responseCode.value = response.body()
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fun itemShelvingSaleAddByCollection(collection: Number) {
|
|
||||||
salix.itemShelvingSaleAddByCollection(params = collection)
|
|
||||||
.enqueue(
|
|
||||||
object :
|
|
||||||
SalixCallback<Any>(context) {
|
|
||||||
override fun onSuccess(response: Response<Any>) {
|
|
||||||
_itemShelvingSaleAddByCollection.value = true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,11 +8,11 @@ import com.google.gson.JsonObject
|
||||||
import es.verdnatura.MobileApplication
|
import es.verdnatura.MobileApplication
|
||||||
import es.verdnatura.domain.SalixCallback
|
import es.verdnatura.domain.SalixCallback
|
||||||
import es.verdnatura.domain.formatWithQuotes
|
import es.verdnatura.domain.formatWithQuotes
|
||||||
import es.verdnatura.domain.getMessageFromAllResponse
|
|
||||||
import es.verdnatura.domain.nameofFunction
|
|
||||||
import es.verdnatura.domain.toast
|
import es.verdnatura.domain.toast
|
||||||
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
|
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||||
|
import es.verdnatura.presentation.base.nameofFunction
|
||||||
import es.verdnatura.presentation.common.Event
|
import es.verdnatura.presentation.common.Event
|
||||||
import es.verdnatura.presentation.common.ResponseItemExistsItemShelvingSale
|
import es.verdnatura.presentation.common.ResponseItemExistsItemShelvingSale
|
||||||
import es.verdnatura.presentation.common.ResponseItemVO
|
import es.verdnatura.presentation.common.ResponseItemVO
|
||||||
|
|
|
@ -22,7 +22,6 @@ import es.verdnatura.presentation.common.OnPackingClickListener
|
||||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||||
import es.verdnatura.presentation.common.OnQuantityClickListener
|
import es.verdnatura.presentation.common.OnQuantityClickListener
|
||||||
import es.verdnatura.presentation.common.OnSaleClickListener
|
import es.verdnatura.presentation.common.OnSaleClickListener
|
||||||
import es.verdnatura.presentation.common.OnTicketColorListener
|
|
||||||
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
||||||
import es.verdnatura.presentation.common.hideKeyboard
|
import es.verdnatura.presentation.common.hideKeyboard
|
||||||
import es.verdnatura.presentation.common.itemScanValue
|
import es.verdnatura.presentation.common.itemScanValue
|
||||||
|
@ -44,7 +43,6 @@ class CollectionShowTicketFragment(
|
||||||
|
|
||||||
private var lastScanned: Int = 0
|
private var lastScanned: Int = 0
|
||||||
private var buttonPushedGetCollection = false
|
private var buttonPushedGetCollection = false
|
||||||
private var hasFilterByLevel = false
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun newInstance(collection: CollectionVO, type: String) =
|
fun newInstance(collection: CollectionVO, type: String) =
|
||||||
|
@ -302,18 +300,6 @@ class CollectionShowTicketFragment(
|
||||||
override fun onPackingClick(sale: SaleVO) {
|
override fun onPackingClick(sale: SaleVO) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}, onTicketColorClickListener = object : OnTicketColorListener {
|
|
||||||
override fun onTicketColorListener(sale: SaleVO) {
|
|
||||||
hasFilterByLevel = !hasFilterByLevel
|
|
||||||
|
|
||||||
if (hasFilterByLevel) {
|
|
||||||
if (buttonPushedGetCollection) {
|
|
||||||
saleAdapter!!.updateSales(salesList.filter { it.level == sale.level } as MutableList)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
createCollectionList()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||||
|
|
|
@ -5,9 +5,9 @@ import es.verdnatura.R
|
||||||
import es.verdnatura.presentation.common.convertToDateString
|
import es.verdnatura.presentation.common.convertToDateString
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionTicket
|
import es.verdnatura.presentation.view.feature.sacador.model.CollectionTicket
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||||
|
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
import java.util.Locale
|
|
||||||
|
|
||||||
fun CollectionVO.map(context: Context): CollectionVO {
|
fun CollectionVO.map(context: Context): CollectionVO {
|
||||||
try {
|
try {
|
||||||
|
@ -20,6 +20,7 @@ fun CollectionVO.map(context: Context): CollectionVO {
|
||||||
it.ticketFk = ticket.ticketFk
|
it.ticketFk = ticket.ticketFk
|
||||||
it.level = ticket.level
|
it.level = ticket.level
|
||||||
it.rgb = ticket.rgb
|
it.rgb = ticket.rgb
|
||||||
|
it.salePersonFk = ticket.salesPersonFk
|
||||||
it.agencyName = ticket.agencyName
|
it.agencyName = ticket.agencyName
|
||||||
it.isNew = it.isAdded == "1"
|
it.isNew = it.isAdded == "1"
|
||||||
it.code = it.cel3
|
it.code = it.cel3
|
||||||
|
@ -64,31 +65,38 @@ fun CollectionVO.map(context: Context): CollectionVO {
|
||||||
|
|
||||||
fun CollectionTicket.map(context: Context): CollectionTicket {
|
fun CollectionTicket.map(context: Context): CollectionTicket {
|
||||||
try {
|
try {
|
||||||
val allSalesAreNullOrEmpty = tickets.all { it.sales.isNullOrEmpty() }
|
this.tickets.forEach { ticket ->
|
||||||
if (!allSalesAreNullOrEmpty) {
|
ticket.sales.forEach {
|
||||||
this.tickets?.forEach { ticket ->
|
it.level = ticket.level ?: ""
|
||||||
ticket.sales?.forEach {
|
it.rgb = ticket.rgb ?: ""
|
||||||
it.level = ticket.level ?: ""
|
|
||||||
it.rgb = ticket.rgb ?: ""
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
this.isError = true
|
this.isError = true
|
||||||
if (this.tickets.isEmpty()) {
|
if (this.tickets.isNullOrEmpty()) {
|
||||||
this.errorMessage = context.getString(R.string.collectionNoTicketsError)
|
this.errorMessage = context.getString(R.string.collectionNoTicketsError)
|
||||||
} else {
|
} else {
|
||||||
this.errorMessage =
|
this.errorMessage =
|
||||||
context.getString(R.string.collectionErrorBuilding) + context.getString(R.string.reviewSector)
|
context.getString(R.string.collectionErrorBuilding) + context.getString(R.string.reviewSector)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getCalendarFromDate(date: String, context: Context): Calendar {
|
private fun getCalendarFromDate(date: String, context: Context): Calendar {
|
||||||
val sdf = SimpleDateFormat(context.getString(R.string.dateFormat), Locale.getDefault())
|
val sdf = SimpleDateFormat(context.getString(R.string.dateFormat))
|
||||||
val cal = Calendar.getInstance()
|
val cal = Calendar.getInstance()
|
||||||
cal.time = sdf.parse(date)!!
|
cal.time = sdf.parse(date)!!
|
||||||
return cal
|
return cal
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// para cuando se pase a Salix el modelo
|
||||||
|
//Tarea 5134
|
||||||
|
fun PlacementSupplyVO.proposal(context: Context): PlacementSupplyVO {
|
||||||
|
try {
|
||||||
|
} catch (ex: Exception) {
|
||||||
|
}
|
||||||
|
return this
|
||||||
|
}
|
|
@ -0,0 +1,356 @@
|
||||||
|
package es.verdnatura.presentation.view.feature.controlvehiculo.fragment
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.graphics.drawable.Drawable
|
||||||
|
import android.util.TypedValue
|
||||||
|
import android.view.View.GONE
|
||||||
|
import android.view.inputmethod.EditorInfo
|
||||||
|
import android.widget.ImageView
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import es.verdnatura.R
|
||||||
|
import es.verdnatura.databinding.FragmentVehiclecontrolBinding
|
||||||
|
import es.verdnatura.domain.toast
|
||||||
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
|
import es.verdnatura.presentation.common.OnCollectionSelectedListener
|
||||||
|
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
||||||
|
import es.verdnatura.presentation.common.TAG
|
||||||
|
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
||||||
|
import es.verdnatura.presentation.common.hideKeyboard
|
||||||
|
import es.verdnatura.presentation.view.component.CustomDialog
|
||||||
|
import es.verdnatura.presentation.view.component.CustomDialogInput
|
||||||
|
import es.verdnatura.presentation.view.component.CustomDialogThreeButtons
|
||||||
|
import es.verdnatura.presentation.view.feature.historicovehiculo.fragment.HistoricoVehiculoFragment
|
||||||
|
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||||
|
import es.verdnatura.presentation.view.feature.sacador.fragment.SacadorFragment
|
||||||
|
|
||||||
|
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||||
|
class ControlVehiculoFragment(
|
||||||
|
private var tagName: String = ""
|
||||||
|
) : BaseFragment<FragmentVehiclecontrolBinding, ControlVehiculoViewModel>(
|
||||||
|
ControlVehiculoViewModel::class
|
||||||
|
) {
|
||||||
|
|
||||||
|
private var goBack: Boolean = false
|
||||||
|
private var onCollectionSelectedListener: OnCollectionSelectedListener? = null
|
||||||
|
override fun getLayoutId(): Int = R.layout.fragment_vehiclecontrol
|
||||||
|
private lateinit var customDialog: CustomDialog
|
||||||
|
private var isWorkedTimed = "UNREGISTERED"
|
||||||
|
private lateinit var customDialogInput: CustomDialogInput
|
||||||
|
private lateinit var customDialogThreeButtons: CustomDialogThreeButtons
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun newInstance(tagName: String) = ControlVehiculoFragment(tagName)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onAttach(context: Context) {
|
||||||
|
super.onAttach(context)
|
||||||
|
if (context is OnCollectionSelectedListener) onCollectionSelectedListener = context
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun init() {
|
||||||
|
|
||||||
|
customDialog = CustomDialog(requireContext())
|
||||||
|
customDialogInput = CustomDialogInput(requireContext())
|
||||||
|
customDialogThreeButtons = CustomDialogThreeButtons(requireContext())
|
||||||
|
goBack = false
|
||||||
|
if (tagName == HistoricoVehiculoFragment.TAG) {
|
||||||
|
setToolBar("HISTORY")
|
||||||
|
showScanner(getString(R.string.scanShelvingHistorical), "HISTORY")
|
||||||
|
} else {
|
||||||
|
|
||||||
|
checkControlTimeVehicle()
|
||||||
|
setToolBar("ALL")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
setEvents()
|
||||||
|
super.init()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onPause() {
|
||||||
|
goBack = true
|
||||||
|
super.onPause()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setToolBar(direction: String?) {
|
||||||
|
|
||||||
|
binding.mainToolbar.toolbarTitle.text = getString(R.string.vehiclecontrol)
|
||||||
|
binding.mainToolbar.toolbarTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13F)
|
||||||
|
|
||||||
|
val listIcons: ArrayList<ImageView> = ArrayList()
|
||||||
|
val iconHistory = ImageView(context)
|
||||||
|
iconHistory.setImageResource(R.drawable.ic_history_black_24dp)
|
||||||
|
val iconVehicleIn = ImageView(context)
|
||||||
|
iconVehicleIn.setImageResource(R.drawable.car)
|
||||||
|
val iconVehicleOut = ImageView(context)
|
||||||
|
iconVehicleOut.setImageResource(R.drawable.car_off)
|
||||||
|
|
||||||
|
iconHistory.tooltipText = getTooltip(R.drawable.ic_history_black_24dp)
|
||||||
|
iconVehicleIn.tooltipText = getTooltip(R.drawable.car)
|
||||||
|
iconVehicleOut.tooltipText = getTooltip(R.drawable.car_off)
|
||||||
|
|
||||||
|
when (direction) {
|
||||||
|
"OUT" -> {
|
||||||
|
listIcons.remove(iconVehicleIn)
|
||||||
|
listIcons.add(iconVehicleOut)
|
||||||
|
listIcons.add(iconHistory)
|
||||||
|
}
|
||||||
|
|
||||||
|
"IN" -> {
|
||||||
|
listIcons.remove(iconVehicleOut)
|
||||||
|
listIcons.add(iconVehicleIn)
|
||||||
|
listIcons.add(iconHistory)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
binding.mainToolbar.toolbarIcons.adapter =
|
||||||
|
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
|
||||||
|
override fun onOptionsItemSelected(item: Drawable) {
|
||||||
|
|
||||||
|
when (item) {
|
||||||
|
iconHistory.drawable -> showScanner(
|
||||||
|
getString(R.string.scanShelvingHistorical), "HISTORY"
|
||||||
|
)
|
||||||
|
|
||||||
|
iconVehicleIn.drawable -> showScanner(getString(R.string.scanPlate), "IN")
|
||||||
|
iconVehicleOut.drawable -> showScanner(
|
||||||
|
getString(R.string.scanPlateTakeoff), "OUT"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
binding.mainToolbar.toolbarIcons.layoutManager =
|
||||||
|
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun showScanner(description: String, action: String) {
|
||||||
|
|
||||||
|
customDialogInput.setTitle(getString(R.string.vehiclecontrol)).setDescription(description)
|
||||||
|
.setOkButton(getString(R.string.accept)) {
|
||||||
|
if (customDialogInput.getValue().isNotEmpty()) {
|
||||||
|
insertControlTimeVehicle(customDialogInput.getValue(), action)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.setKoButton(getString(R.string.cancel)) {
|
||||||
|
customDialogInput.dismiss()
|
||||||
|
if (tagName == HistoricoVehiculoFragment.TAG) {
|
||||||
|
ma.onMyBackPressed()
|
||||||
|
}
|
||||||
|
|
||||||
|
}.setValue("").show()
|
||||||
|
|
||||||
|
customDialogInput.setFocusText()
|
||||||
|
|
||||||
|
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
|
||||||
|
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||||
|
|
||||||
|
if (customDialogInput.getValue().isNotEmpty()) {
|
||||||
|
insertControlTimeVehicle(customDialogInput.getValue(), action)
|
||||||
|
}
|
||||||
|
return@setOnEditorActionListener true
|
||||||
|
}
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun checkControlTimeVehicle() {
|
||||||
|
|
||||||
|
if (!goBack) {
|
||||||
|
try {
|
||||||
|
viewModel.workerMachineryIsRegistered(mobileApplication.userId!!)
|
||||||
|
} catch (ex: Exception) {
|
||||||
|
ma.messageWithSound(
|
||||||
|
message = getString(R.string.errorUserId),
|
||||||
|
isError = true,
|
||||||
|
isToasted = true,
|
||||||
|
isPlayed = true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun insertControlTimeVehicle(plateNumber: String, direction: String) {
|
||||||
|
|
||||||
|
when (direction) {
|
||||||
|
"HISTORY" -> {
|
||||||
|
ma.onPasillerosItemClickListener(
|
||||||
|
PasillerosItemVO(title = R.string.titleHistoricalHide), plateNumber
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
"IN" -> {
|
||||||
|
viewModel.machineWorkerUpdate(plateNumber)
|
||||||
|
}
|
||||||
|
|
||||||
|
"OUT" -> {
|
||||||
|
viewModel.machineWorkerUpdate(plateNumber)
|
||||||
|
}
|
||||||
|
|
||||||
|
"" -> {
|
||||||
|
ma.openFragmentPickers(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
customDialogInput.setValue("")
|
||||||
|
scanRequest()
|
||||||
|
customDialogInput.dismiss()
|
||||||
|
hideKeyboards()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun scanRequest() {
|
||||||
|
binding.scanInput.requestFocus()
|
||||||
|
hideKeyboards()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun hideKeyboards() {
|
||||||
|
try {
|
||||||
|
requireActivity().hideKeyboard()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
println(e.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setEvents() {
|
||||||
|
|
||||||
|
binding.mainToolbar.backButton.setOnClickListener {
|
||||||
|
ma.openFragmentPickers(true)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.scanInput.requestFocus()
|
||||||
|
binding.scanInput.setOnEditorActionListener { v, actionId, event ->
|
||||||
|
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||||
|
if (!binding.scanInput.text.isNullOrEmpty()) {
|
||||||
|
|
||||||
|
if (tagName == HistoricoVehiculoFragment.TAG) {
|
||||||
|
showOptionsHistorical(binding.scanInput.text.toString())
|
||||||
|
} else {
|
||||||
|
showOptionsVehicleControl(binding.scanInput.text.toString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
binding.scanInput.setText("")
|
||||||
|
ma.hideKeyboard(binding.scanInput)
|
||||||
|
return@setOnEditorActionListener true
|
||||||
|
}
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun showOptionsVehicleControl(plate: String) {
|
||||||
|
|
||||||
|
customDialogThreeButtons.setCustomDialogValue(GONE)
|
||||||
|
|
||||||
|
customDialogThreeButtons.setDescription(getString(R.string.doVehiclePlate) + plate + "?")
|
||||||
|
.setValue(plate)
|
||||||
|
if (isWorkedTimed == "UNREGISTERED") {
|
||||||
|
customDialogThreeButtons.setOkButtonTwo("COGER") {
|
||||||
|
if (customDialogThreeButtons.getValue().trim().isEmpty()) {
|
||||||
|
getString(R.string.returnScan).toast(requireContext())
|
||||||
|
} else {
|
||||||
|
customDialogThreeButtons.dismiss()
|
||||||
|
insertControlTimeVehicle(customDialogThreeButtons.getValue(), "IN")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
customDialogThreeButtons.setOkButtonThree("DEJAR") {
|
||||||
|
if (customDialogThreeButtons.getValue().trim().isEmpty()) {
|
||||||
|
getString(R.string.returnScan).toast(requireContext())
|
||||||
|
} else {
|
||||||
|
customDialogThreeButtons.dismiss()
|
||||||
|
insertControlTimeVehicle(customDialogThreeButtons.getValue(), "OUT")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.setOkButtonFour(getString(R.string.historical)) {
|
||||||
|
if (customDialogThreeButtons.getValue().trim().isEmpty()) {
|
||||||
|
getString(R.string.returnScan).toast(requireContext())
|
||||||
|
} else {
|
||||||
|
customDialogThreeButtons.dismiss()
|
||||||
|
insertControlTimeVehicle(customDialogThreeButtons.getValue(), "HISTORY")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}.setKoButton(getString(R.string.cancel)) {
|
||||||
|
scanRequest()
|
||||||
|
customDialogThreeButtons.dismiss()
|
||||||
|
}.show()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun showOptionsHistorical(plate: String) {
|
||||||
|
|
||||||
|
customDialogThreeButtons.setCustomDialogValue(GONE)
|
||||||
|
|
||||||
|
customDialogThreeButtons.setDescription(getString(R.string.doVehiclePlate) + plate + "?")
|
||||||
|
|
||||||
|
.setValue(plate)
|
||||||
|
|
||||||
|
.setOkButtonFour(getString(R.string.historical)) {
|
||||||
|
if (customDialogThreeButtons.getValue().trim().isEmpty()) {
|
||||||
|
getString(R.string.returnScan).toast(requireContext())
|
||||||
|
} else {
|
||||||
|
customDialogThreeButtons.dismiss()
|
||||||
|
insertControlTimeVehicle(customDialogThreeButtons.getValue(), "HISTORY")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}.setKoButton(getString(R.string.cancel)) {
|
||||||
|
scanRequest()
|
||||||
|
customDialogThreeButtons.dismiss()
|
||||||
|
}.show()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun observeViewModel() {
|
||||||
|
|
||||||
|
with(viewModel) {
|
||||||
|
responseUpdate.observe(viewLifecycleOwner) {
|
||||||
|
ma.openFragmentPickers(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
responseControl.observe(viewLifecycleOwner) {
|
||||||
|
|
||||||
|
if (it == "1") {
|
||||||
|
isWorkedTimed = "REGISTERED"
|
||||||
|
setToolBar("OUT")
|
||||||
|
|
||||||
|
if (tagName != SacadorFragment.TAG) {
|
||||||
|
ma.openFragmentPickers(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (it == "0") {
|
||||||
|
setToolBar("IN")
|
||||||
|
|
||||||
|
customDialogInput.setTitle(getString(R.string.vehiclecontrol))
|
||||||
|
.setDescription(getString(R.string.scanPlate))
|
||||||
|
.setOkButton(getString(R.string.takeVehicle)) {
|
||||||
|
if (customDialogInput.getValue().isNotEmpty()) {
|
||||||
|
insertControlTimeVehicle(customDialogInput.getValue(), "IN")
|
||||||
|
}
|
||||||
|
customDialogInput.setValue("")
|
||||||
|
scanRequest()
|
||||||
|
customDialogInput.dismiss()
|
||||||
|
hideKeyboards()
|
||||||
|
}
|
||||||
|
|
||||||
|
.setKoButton(getString(R.string.noVehicle)) {
|
||||||
|
customDialogInput.dismiss()
|
||||||
|
ma.openFragmentPickers(true)
|
||||||
|
|
||||||
|
}.setValue("").show()
|
||||||
|
|
||||||
|
customDialogInput.setFocusText()
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -52,6 +52,7 @@ class ControlVehiculoUsuarioFragment(
|
||||||
|
|
||||||
if (userFk == vUserFK) {
|
if (userFk == vUserFK) {
|
||||||
val androidId: String = mobileApplication.dataStoreApp.readDataStoreKey(ANDROID_ID)
|
val androidId: String = mobileApplication.dataStoreApp.readDataStoreKey(ANDROID_ID)
|
||||||
|
// viewModel.machineGetWorkerPlate(mobileApplication.userId!!)
|
||||||
viewModel.deviceProductionGetnameDevice(
|
viewModel.deviceProductionGetnameDevice(
|
||||||
androidId
|
androidId
|
||||||
)
|
)
|
||||||
|
@ -63,6 +64,7 @@ class ControlVehiculoUsuarioFragment(
|
||||||
binding.userInformation.visibility = INVISIBLE
|
binding.userInformation.visibility = INVISIBLE
|
||||||
binding.nameVehiclecontrol.visibility = INVISIBLE
|
binding.nameVehiclecontrol.visibility = INVISIBLE
|
||||||
binding.userImage.setOnClickListener { binding.mainToolbar.backButton.performClick() }
|
binding.userImage.setOnClickListener { binding.mainToolbar.backButton.performClick() }
|
||||||
|
// viewModel.machineGetWorkerPlate(mobileApplication.userId!!)
|
||||||
binding.nameVehiclecontrol.visibility = VISIBLE
|
binding.nameVehiclecontrol.visibility = VISIBLE
|
||||||
viewModel.getNameWorker(userFk)
|
viewModel.getNameWorker(userFk)
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,12 +16,44 @@ import retrofit2.Response
|
||||||
|
|
||||||
class ControlVehiculoViewModel(val context: Context) : BaseViewModel(context) {
|
class ControlVehiculoViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
|
private val _responseUpdate by lazy { MutableLiveData<Any>() }
|
||||||
|
val responseUpdate: LiveData<Any>
|
||||||
|
get() = _responseUpdate
|
||||||
|
|
||||||
|
private val _responseControl by lazy { MutableLiveData<String>() }
|
||||||
|
val responseControl: LiveData<String>
|
||||||
|
get() = _responseControl
|
||||||
|
|
||||||
private val _responseMachine by lazy { MutableLiveData<ResponseItemMachineControl>() }
|
private val _responseMachine by lazy { MutableLiveData<ResponseItemMachineControl>() }
|
||||||
val responseMachine: LiveData<ResponseItemMachineControl>
|
val responseMachine: LiveData<ResponseItemMachineControl>
|
||||||
get() = _responseMachine
|
get() = _responseMachine
|
||||||
|
|
||||||
private val _responseGetName by lazy { MutableLiveData<NameWorker>() }
|
private val _responseGetName by lazy { MutableLiveData<NameWorker>() }
|
||||||
val responseGetName: LiveData<NameWorker> = _responseGetName
|
val responseGetName: LiveData<NameWorker> = _responseGetName
|
||||||
|
fun machineWorkerUpdate(
|
||||||
|
plate: String
|
||||||
|
) {
|
||||||
|
salix.machineWorkerUpdateInTime(hashMapOf("plate" to plate))
|
||||||
|
.enqueue(object : SalixCallback<Any>(context) {
|
||||||
|
|
||||||
|
override fun onSuccess(response: Response<Any>) {
|
||||||
|
|
||||||
|
_responseUpdate.value = response.body()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fun workerMachineryIsRegistered(userId: Int) {
|
||||||
|
salix.workerMachineryIsRegistered(arrayListOf(userId))
|
||||||
|
.enqueue(object : SalixCallback<String>(context) {
|
||||||
|
override fun onSuccess(response: Response<String>) {
|
||||||
|
_responseControl.value =
|
||||||
|
response.body()!!
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
fun deviceProductionGetnameDevice(androidId: String) {
|
fun deviceProductionGetnameDevice(androidId: String) {
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,7 @@ import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.Editable
|
import android.view.KeyEvent
|
||||||
import android.text.TextWatcher
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
|
@ -17,8 +16,6 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentExpeditionLoadunloadDeliveryBinding
|
import es.verdnatura.databinding.FragmentExpeditionLoadunloadDeliveryBinding
|
||||||
import es.verdnatura.db.DeliveryDatabase
|
import es.verdnatura.db.DeliveryDatabase
|
||||||
import es.verdnatura.domain.ConstAndValues.HUMAN_CHARACTERS_SECOND
|
|
||||||
import es.verdnatura.domain.ConstAndValues.SCANNER_THRESHOLD_SPEED
|
|
||||||
import es.verdnatura.domain.toDateString
|
import es.verdnatura.domain.toDateString
|
||||||
import es.verdnatura.domain.toast
|
import es.verdnatura.domain.toast
|
||||||
import es.verdnatura.presentation.base.BaseFragment
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
|
@ -47,10 +44,9 @@ class LoadUnloadFragment(
|
||||||
private var title: String = "",
|
private var title: String = "",
|
||||||
private var state: String = "",
|
private var state: String = "",
|
||||||
private var entryPoint: String,
|
private var entryPoint: String,
|
||||||
private var clientTicketList: ArrayList<ClientTicketSalix>?,
|
private var clientTicketList: ArrayList<ClientTicketSalix>?
|
||||||
private var startInputTime: Long = 0L,
|
|
||||||
|
|
||||||
) : BaseFragment<FragmentExpeditionLoadunloadDeliveryBinding, DeliveryViewModel>(
|
) : BaseFragment<FragmentExpeditionLoadunloadDeliveryBinding, DeliveryViewModel>(
|
||||||
DeliveryViewModel::class
|
DeliveryViewModel::class
|
||||||
), OnBackPressedListener {
|
), OnBackPressedListener {
|
||||||
|
|
||||||
|
@ -89,24 +85,6 @@ class LoadUnloadFragment(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
binding.scanInput.addTextChangedListener(object : TextWatcher {
|
|
||||||
override fun afterTextChanged(s: Editable?) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
|
||||||
if (before == 0 && count > 0) {
|
|
||||||
startInputTime = System.currentTimeMillis()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getLayoutId(): Int = R.layout.fragment_expedition_loadunload_delivery
|
override fun getLayoutId(): Int = R.layout.fragment_expedition_loadunload_delivery
|
||||||
|
@ -201,16 +179,30 @@ class LoadUnloadFragment(
|
||||||
|
|
||||||
private fun setExpeditionsState(list: MutableList<ExpeditionInfoLoadUnload>, state: String) {
|
private fun setExpeditionsState(list: MutableList<ExpeditionInfoLoadUnload>, state: String) {
|
||||||
scanning(false)
|
scanning(false)
|
||||||
|
/* val mlist = mutableListOf<ExpeditionSalix>()
|
||||||
|
for (l in list) {
|
||||||
|
mlist.add(
|
||||||
|
ExpeditionSalix(
|
||||||
|
expeditionFk = l.id,
|
||||||
|
stateCode = if (l.code != state && l.code != "FOUND" && l.code != "DELIVERED") {
|
||||||
|
if (state == "ON DELIVERY") "NOT SCANNED" else "LOST"
|
||||||
|
} else {
|
||||||
|
l.code
|
||||||
|
},
|
||||||
|
isScanned = l.isScanned
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}*/
|
||||||
val mlistPosition = mutableListOf<ExpeditionSalixPosition>()
|
val mlistPosition = mutableListOf<ExpeditionSalixPosition>()
|
||||||
for (l in list) {
|
for (l in list) {
|
||||||
mlistPosition.add(
|
mlistPosition.add(
|
||||||
ExpeditionSalixPosition(
|
ExpeditionSalixPosition(
|
||||||
expeditionFk = l.id,
|
expeditionFk = l.id,
|
||||||
stateCode = if (l.code == "FOUND") (l.code) else {
|
stateCode = if (l.code == "FOUND") (l.code) else {
|
||||||
if (state == "ON DELIVERY" && l.code != "ON DELIVERY" && l.code != "DELIVERED" && l.code != "LOST" && l.code != "PENDING" && l.code != "STORED") {
|
if (state == "ON DELIVERY" && l.code != "ON DELIVERY" && l.code != "DELIVERED" && l.code != "LOST") {
|
||||||
"NOT SCANNED"
|
"NOT SCANNED"
|
||||||
} else {
|
} else {
|
||||||
if (state == "DELIVERED" && l.code != "DELIVERED" && l.code != "STORED") "PENDING" else l.code
|
if (state == "DELIVERED" && l.code != "DELIVERED") "LOST" else l.code
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isScanned = l.isScanned,
|
isScanned = l.isScanned,
|
||||||
|
@ -281,16 +273,12 @@ class LoadUnloadFragment(
|
||||||
ma.onMyBackPressed()
|
ma.onMyBackPressed()
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.scanInput.setOnEditorActionListener { _, actionId, event ->
|
binding.scanInput.setOnEditorActionListener { v, actionId, event ->
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == EditorInfo.IME_ACTION_NEXT) {
|
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == EditorInfo.IME_ACTION_NEXT) {
|
||||||
|
|
||||||
if (!binding.scanInput.text.isNullOrEmpty()) {
|
if (!binding.scanInput.text.isNullOrEmpty()) {
|
||||||
|
|
||||||
val totalTime = (System.currentTimeMillis() - startInputTime)
|
|
||||||
val charsPerSecond = (binding.scanInput.text!!.length * 1000.0) / totalTime
|
|
||||||
val isScanned =
|
val isScanned =
|
||||||
charsPerSecond > HUMAN_CHARACTERS_SECOND && totalTime < SCANNER_THRESHOLD_SPEED
|
event != null && event.action == KeyEvent.ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER
|
||||||
|
|
||||||
//Tarea 8152
|
//Tarea 8152
|
||||||
// showconfirmExpedition(binding.scanInput.text.toString().toInt(), isScanned)
|
// showconfirmExpedition(binding.scanInput.text.toString().toInt(), isScanned)
|
||||||
try {
|
try {
|
||||||
|
@ -490,7 +478,7 @@ class LoadUnloadFragment(
|
||||||
code = if (item.code == "DELIVERED" || item.code == "ON DELIVERY") {
|
code = if (item.code == "DELIVERED" || item.code == "ON DELIVERY") {
|
||||||
item.code
|
item.code
|
||||||
} else {
|
} else {
|
||||||
"PENDING"
|
"LOST"
|
||||||
},
|
},
|
||||||
nickname = item.nickname,
|
nickname = item.nickname,
|
||||||
postalCode = item.postalCode
|
postalCode = item.postalCode
|
||||||
|
@ -607,7 +595,7 @@ class LoadUnloadFragment(
|
||||||
override fun onBackPressedHandled(): Boolean {
|
override fun onBackPressedHandled(): Boolean {
|
||||||
|
|
||||||
if (scanned) {
|
if (scanned) {
|
||||||
val customDialog = CustomDialog(requireContext())
|
var customDialog = CustomDialog(requireContext())
|
||||||
customDialog.setTitle(getString(R.string.packagesNotScanned))
|
customDialog.setTitle(getString(R.string.packagesNotScanned))
|
||||||
.setDescription(getString(R.string.savePackages))
|
.setDescription(getString(R.string.savePackages))
|
||||||
.setOkButton(getString(R.string.yes)) {
|
.setOkButton(getString(R.string.yes)) {
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
package es.verdnatura.presentation.view.feature.delivery.fragments
|
package es.verdnatura.presentation.view.feature.delivery.fragments
|
||||||
|
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.os.Bundle
|
import android.view.KeyEvent
|
||||||
import android.text.Editable
|
|
||||||
import android.text.TextWatcher
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
|
@ -13,8 +11,6 @@ import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentExpeditionSummaryBinding
|
import es.verdnatura.databinding.FragmentExpeditionSummaryBinding
|
||||||
import es.verdnatura.domain.ConstAndValues.HUMAN_CHARACTERS_SECOND
|
|
||||||
import es.verdnatura.domain.ConstAndValues.SCANNER_THRESHOLD_SPEED
|
|
||||||
import es.verdnatura.domain.toast
|
import es.verdnatura.domain.toast
|
||||||
import es.verdnatura.presentation.base.BaseFragment
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
import es.verdnatura.presentation.common.AdapterCallback
|
import es.verdnatura.presentation.common.AdapterCallback
|
||||||
|
@ -48,7 +44,6 @@ class SummaryFragment(
|
||||||
private var routeSelected = 0
|
private var routeSelected = 0
|
||||||
private var isScanning = false
|
private var isScanning = false
|
||||||
private var positionSelected = -1
|
private var positionSelected = -1
|
||||||
private var startInputTime: Long = 0L
|
|
||||||
|
|
||||||
override fun getPosition(): Int {
|
override fun getPosition(): Int {
|
||||||
return positionSelected
|
return positionSelected
|
||||||
|
@ -72,26 +67,6 @@ class SummaryFragment(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
||||||
super.onViewCreated(view, savedInstanceState)
|
|
||||||
binding.scanInput.addTextChangedListener(object : TextWatcher {
|
|
||||||
override fun afterTextChanged(s: Editable?) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
|
||||||
if (before == 0 && count > 0) {
|
|
||||||
startInputTime = System.currentTimeMillis()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
if (binding.mainToolbar.toolbarTitle.text != getString(R.string.titleDeliverySummary)) {
|
if (binding.mainToolbar.toolbarTitle.text != getString(R.string.titleDeliverySummary)) {
|
||||||
binding.scanInput.isEnabled = true
|
binding.scanInput.isEnabled = true
|
||||||
|
@ -176,10 +151,10 @@ class SummaryFragment(
|
||||||
val listExpedition = list.filter { it.addressFk == address }.map { l ->
|
val listExpedition = list.filter { it.addressFk == address }.map { l ->
|
||||||
ExpeditionSalixPosition(
|
ExpeditionSalixPosition(
|
||||||
expeditionFk = l.id, stateCode = if (l.code == "FOUND") (l.code) else {
|
expeditionFk = l.id, stateCode = if (l.code == "FOUND") (l.code) else {
|
||||||
if (state == "ON DELIVERY" && l.code != "ON DELIVERY" && l.code != "DELIVERED" && l.code != "LOST" && l.code != "PENDING" && l.code != "STORED") {
|
if (state == "ON DELIVERY" && l.code != "ON DELIVERY" && l.code != "DELIVERED" && l.code != "LOST") {
|
||||||
"NOT SCANNED"
|
"NOT SCANNED"
|
||||||
} else {
|
} else {
|
||||||
if (state == "DELIVERED" && l.code != "DELIVERED" && l.code != "STORED") "PENDING" else l.code
|
if (state == "DELIVERED" && l.code != "DELIVERED") "LOST" else l.code
|
||||||
}
|
}
|
||||||
}, isScanned = l.isScanned, scanOrder = l.scanOrder
|
}, isScanned = l.isScanned, scanOrder = l.scanOrder
|
||||||
|
|
||||||
|
@ -225,12 +200,8 @@ class SummaryFragment(
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||||
if (!binding.scanInput.text.isNullOrEmpty()) {
|
if (!binding.scanInput.text.isNullOrEmpty()) {
|
||||||
isScanning = true
|
isScanning = true
|
||||||
/* val isScanned =
|
|
||||||
event != null && event.action == KeyEvent.ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER*/
|
|
||||||
val totalTime = (System.currentTimeMillis() - startInputTime)
|
|
||||||
val charsPerSecond = (binding.scanInput.text!!.length * 1000.0) / totalTime
|
|
||||||
val isScanned =
|
val isScanned =
|
||||||
charsPerSecond > HUMAN_CHARACTERS_SECOND && totalTime < SCANNER_THRESHOLD_SPEED
|
event != null && event.action == KeyEvent.ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER
|
||||||
try {
|
try {
|
||||||
markExpedition(
|
markExpedition(
|
||||||
binding.scanInput.text.toString().toInt(),
|
binding.scanInput.text.toString().toInt(),
|
||||||
|
@ -262,6 +233,14 @@ class SummaryFragment(
|
||||||
found = true
|
found = true
|
||||||
exped.code = state
|
exped.code = state
|
||||||
exped.isScanned = isScanned
|
exped.isScanned = isScanned
|
||||||
|
|
||||||
|
println(
|
||||||
|
"scanOrder markExpedition${
|
||||||
|
myList.filter { it.addressFk == addressFkSelected }
|
||||||
|
.filter { it.code == state }.size
|
||||||
|
}"
|
||||||
|
)
|
||||||
|
|
||||||
exped.scanOrder = myList.filter { it.addressFk == addressFkSelected }
|
exped.scanOrder = myList.filter { it.addressFk == addressFkSelected }
|
||||||
.filter { it.code == state }.size
|
.filter { it.code == state }.size
|
||||||
break
|
break
|
||||||
|
|
|
@ -429,17 +429,22 @@ class TicketsFragment : BaseFragment<FragmentTicketsBinding, DeliveryViewModel>(
|
||||||
override fun onItemButtonCMRRowClickListener(
|
override fun onItemButtonCMRRowClickListener(
|
||||||
item: Ticket
|
item: Ticket
|
||||||
) {
|
) {
|
||||||
|
ma.onPasillerosItemClickListener(
|
||||||
val url =
|
PasillerosItemVO(
|
||||||
"${mobileApplication.dataStoreApp.getServerLilium()}/api/Cmrs/${item.cmrFk}/print?access_token=${
|
title = R.string.titleWebViewer,
|
||||||
mobileApplication.dataStoreApp.readDataStoreKey<String>(
|
), entryPoint = Gson().toJson(
|
||||||
TOKEN
|
mutableMapOf(
|
||||||
|
"entryPoint" to route.id,
|
||||||
|
"web" to "${
|
||||||
|
mobileApplication.dataStoreApp.getServerSalix()
|
||||||
|
}/api/Cmrs/${item.cmrFk}/print?access_token=${
|
||||||
|
mobileApplication.dataStoreApp.readDataStoreKey<String>(
|
||||||
|
TOKEN
|
||||||
|
)
|
||||||
|
}"
|
||||||
)
|
)
|
||||||
}"
|
)
|
||||||
|
)
|
||||||
val intent = Intent(Intent.ACTION_QUICK_VIEW, Uri.parse(url))
|
|
||||||
intent.setDataAndType(Uri.parse(url), "application/pdf")
|
|
||||||
startActivity(intent)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -24,10 +24,7 @@ data class ClientTicketSalix(
|
||||||
var postalCode: String,
|
var postalCode: String,
|
||||||
var city: String,
|
var city: String,
|
||||||
var warehouseName: String?,
|
var warehouseName: String?,
|
||||||
@SerializedName(
|
var salePersonPhone: String?,
|
||||||
value = "salePersonPhone",
|
|
||||||
alternate = ["departmentPhone"]
|
|
||||||
) var salePersonPhone: String?,
|
|
||||||
@SerializedName(value = "ticketObservation", alternate = ["observationDelivery"])
|
@SerializedName(value = "ticketObservation", alternate = ["observationDelivery"])
|
||||||
var observationDelivery: String?,
|
var observationDelivery: String?,
|
||||||
var observationDropOff: String?,
|
var observationDropOff: String?,
|
||||||
|
|
|
@ -1,137 +0,0 @@
|
||||||
package es.verdnatura.presentation.view.feature.diadeventa.fragment
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import android.view.inputmethod.EditorInfo
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.runtime.getValue
|
|
||||||
import androidx.compose.ui.platform.ComposeView
|
|
||||||
import androidx.fragment.app.Fragment
|
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
|
||||||
import es.verdnatura.R
|
|
||||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
|
||||||
import es.verdnatura.presentation.composable.IconToolBar
|
|
||||||
import es.verdnatura.presentation.view.component.CustomDialog
|
|
||||||
import es.verdnatura.presentation.view.component.CustomDialogList
|
|
||||||
import es.verdnatura.presentation.view.feature.diadeventa.adapter.DayOfSaleAdapter
|
|
||||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
|
||||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
|
||||||
|
|
||||||
class DayOfSaleFragmentCompose(
|
|
||||||
var title: String = ""
|
|
||||||
) : Fragment() {
|
|
||||||
private val viewModel: DayOfSaleViewModelCompose by viewModel()
|
|
||||||
|
|
||||||
private lateinit var customDialogList: CustomDialogList
|
|
||||||
private lateinit var customDialog: CustomDialog
|
|
||||||
private var adapter: DayOfSaleAdapter? = null
|
|
||||||
private var itemScan = ""
|
|
||||||
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
fun newInstance(title: String) = DayOfSaleFragmentCompose(title)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onAttach(context: Context) {
|
|
||||||
if (context is OnPasillerosItemClickListener) pasillerosItemClickListener = context
|
|
||||||
super.onAttach(context)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreateView(
|
|
||||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
|
||||||
): View {
|
|
||||||
return ComposeView(requireContext()).apply {
|
|
||||||
setContent {
|
|
||||||
SetView()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
private fun SetView() {
|
|
||||||
val uiState by viewModel.uiState.collectAsStateWithLifecycle()
|
|
||||||
|
|
||||||
val columnActions = listOf<(List<String>) -> Unit>(
|
|
||||||
// { item -> println("Producto seleccionado: ${item[0]}") }, // Acción para la primera columna
|
|
||||||
// { item -> println("Stock: ${item[1]}") }, // Acción para la segunda columna
|
|
||||||
// { item -> println("Visible: ${item[2]}") } // Acción para la tercera columna
|
|
||||||
)
|
|
||||||
|
|
||||||
GenericListScreen(
|
|
||||||
uiState.items.map { item ->
|
|
||||||
listOf(
|
|
||||||
item.itemFk?.toString() ?: "",
|
|
||||||
item.longName ?: "",
|
|
||||||
item.dated,
|
|
||||||
item.visible?.toString() ?: "",
|
|
||||||
item.stock?.toString() ?: ""
|
|
||||||
)
|
|
||||||
},
|
|
||||||
columnActions = columnActions,
|
|
||||||
headers = listOf(
|
|
||||||
getString(R.string.itemfk),
|
|
||||||
getString(R.string.name),
|
|
||||||
getString(R.string.date),
|
|
||||||
getString(R.string.visible),
|
|
||||||
getString(R.string.stock)
|
|
||||||
),
|
|
||||||
onTextChange = { input ->
|
|
||||||
viewModel.itemShelvingGetSaleDate(input)
|
|
||||||
},
|
|
||||||
titleToolBar =
|
|
||||||
if (uiState.shelvingCode.isNullOrEmpty()) title else title + " " + uiState.shelvingCode,
|
|
||||||
onBackClick = { (context as MainActivity).onMyBackPressed() },
|
|
||||||
onLongClick = { },
|
|
||||||
onClick = { item -> openSearchItemFragment(item[0]) },
|
|
||||||
listIconToolBar = listOf(
|
|
||||||
IconToolBar(
|
|
||||||
idRes = R.drawable.ic_local_parking_black_24dp,
|
|
||||||
toolTip = getString(R.string.allowParking),
|
|
||||||
onClickIcon = { showParking() },
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun showParking() {
|
|
||||||
|
|
||||||
customDialogList = CustomDialogList(requireContext())
|
|
||||||
customDialogList.setTitle(getString(R.string.showParking))
|
|
||||||
.setOkButton(getString(R.string.close)) {
|
|
||||||
|
|
||||||
customDialogList.dismiss()
|
|
||||||
}.setValue("").show()
|
|
||||||
|
|
||||||
customDialogList.getEditText().requestFocus()
|
|
||||||
customDialogList.getEditText().setOnEditorActionListener { _, actionId, _ ->
|
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
|
||||||
if (customDialogList.getValue().isNotEmpty()) {
|
|
||||||
viewModel.setParking(
|
|
||||||
parking = customDialogList.getValue(),
|
|
||||||
scanItem = itemScan
|
|
||||||
)
|
|
||||||
|
|
||||||
customDialogList.dismiss()
|
|
||||||
}
|
|
||||||
customDialogList.setValue("")
|
|
||||||
return@setOnEditorActionListener true
|
|
||||||
}
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun openSearchItemFragment(item: String) {
|
|
||||||
pasillerosItemClickListener!!.onPasillerosItemClickListener(
|
|
||||||
PasillerosItemVO(
|
|
||||||
title =
|
|
||||||
R.string.titleItemConsult
|
|
||||||
), item
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,53 +0,0 @@
|
||||||
package es.verdnatura.presentation.view.feature.diadeventa.fragment
|
|
||||||
|
|
||||||
import es.verdnatura.domain.SalixCallback
|
|
||||||
import es.verdnatura.domain.formatWithQuotes
|
|
||||||
import es.verdnatura.presentation.base.BaseViewModelCompose
|
|
||||||
import es.verdnatura.presentation.view.feature.diadeventa.model.ItemShelvingSaleDate
|
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
|
||||||
import kotlinx.coroutines.flow.asStateFlow
|
|
||||||
import kotlinx.coroutines.flow.update
|
|
||||||
import retrofit2.Response
|
|
||||||
|
|
||||||
data class UiState(
|
|
||||||
val shelvingCode: String? = null,
|
|
||||||
val items: List<ItemShelvingSaleDate> = emptyList()
|
|
||||||
)
|
|
||||||
|
|
||||||
class DayOfSaleViewModelCompose(var application: android.app.Application) :
|
|
||||||
BaseViewModelCompose(application) {
|
|
||||||
|
|
||||||
private val _uiState = MutableStateFlow(UiState())
|
|
||||||
val uiState = _uiState.asStateFlow()
|
|
||||||
|
|
||||||
fun itemShelvingGetSaleDate(vShelvingFK: String) {
|
|
||||||
_uiState.update { it.copy(shelvingCode = vShelvingFK) }
|
|
||||||
salix.itemShelvingGetSaleDate(params = listOf(vShelvingFK).formatWithQuotes())
|
|
||||||
.enqueue(object :
|
|
||||||
SalixCallback<List<ItemShelvingSaleDate>>(application.applicationContext) {
|
|
||||||
|
|
||||||
override fun onSuccess(response: Response<List<ItemShelvingSaleDate>>) {
|
|
||||||
|
|
||||||
response.body()?.let { list ->
|
|
||||||
_uiState.update { it.copy(items = list) }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setParking(scanItem: String, parking: String) {
|
|
||||||
salix.setParking(arrayListOf(scanItem, parking).formatWithQuotes())
|
|
||||||
.enqueue(object : SalixCallback<Any>(application.applicationContext) {})
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,215 +0,0 @@
|
||||||
package es.verdnatura.presentation.view.feature.diadeventa.fragment
|
|
||||||
|
|
||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
|
||||||
import androidx.compose.foundation.background
|
|
||||||
import androidx.compose.foundation.clickable
|
|
||||||
import androidx.compose.foundation.combinedClickable
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
|
||||||
import androidx.compose.foundation.layout.Box
|
|
||||||
import androidx.compose.foundation.layout.Column
|
|
||||||
import androidx.compose.foundation.layout.Row
|
|
||||||
import androidx.compose.foundation.layout.Spacer
|
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
|
||||||
import androidx.compose.foundation.layout.height
|
|
||||||
import androidx.compose.foundation.layout.padding
|
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
|
||||||
import androidx.compose.foundation.lazy.items
|
|
||||||
import androidx.compose.material3.HorizontalDivider
|
|
||||||
import androidx.compose.material3.Text
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
|
||||||
import androidx.compose.runtime.getValue
|
|
||||||
import androidx.compose.runtime.mutableStateOf
|
|
||||||
import androidx.compose.runtime.remember
|
|
||||||
import androidx.compose.runtime.setValue
|
|
||||||
import androidx.compose.ui.Alignment
|
|
||||||
import androidx.compose.ui.Modifier
|
|
||||||
import androidx.compose.ui.focus.FocusRequester
|
|
||||||
import androidx.compose.ui.focus.focusRequester
|
|
||||||
import androidx.compose.ui.focus.onFocusEvent
|
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import androidx.compose.ui.platform.LocalContext
|
|
||||||
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
|
||||||
import androidx.compose.ui.res.stringResource
|
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import androidx.compose.ui.unit.sp
|
|
||||||
import androidx.core.content.ContextCompat
|
|
||||||
import es.verdnatura.R
|
|
||||||
import es.verdnatura.presentation.composable.CustomToolbar
|
|
||||||
import es.verdnatura.presentation.composable.IconToolBar
|
|
||||||
import es.verdnatura.presentation.composable.LottieLoadingAnimation
|
|
||||||
import es.verdnatura.presentation.composable.ScanLineTextSearch
|
|
||||||
import java.text.SimpleDateFormat
|
|
||||||
import java.util.Date
|
|
||||||
import java.util.Locale
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun GenericListScreen(
|
|
||||||
items: List<List<String>>, // Lista de listas de strings para los datos
|
|
||||||
headers: List<String>,// Lista de encabezados
|
|
||||||
columnActions: List<(List<String>) -> Unit>, // Lista de acciones
|
|
||||||
onTextChange: (String) -> Unit,
|
|
||||||
titleToolBar: String,
|
|
||||||
onBackClick: () -> Unit = {},
|
|
||||||
onLongClick: (List<String>) -> Unit,
|
|
||||||
onClick: (List<String>) -> Unit,
|
|
||||||
listIconToolBar: List<IconToolBar> = listOf()
|
|
||||||
) {
|
|
||||||
var searchText by remember { mutableStateOf("") }
|
|
||||||
val focusRequester = remember { FocusRequester() }
|
|
||||||
val keyboardController = LocalSoftwareKeyboardController.current
|
|
||||||
var showLoading by remember { mutableStateOf(false) }
|
|
||||||
|
|
||||||
val onImeAction: () -> Unit = {
|
|
||||||
onTextChange(searchText)
|
|
||||||
searchText = ""
|
|
||||||
keyboardController?.hide()
|
|
||||||
}
|
|
||||||
|
|
||||||
Box(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxSize()
|
|
||||||
.background(Color.Black)
|
|
||||||
) {
|
|
||||||
Column(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxSize()
|
|
||||||
.background(Color.Black)
|
|
||||||
) {
|
|
||||||
if (showLoading) {
|
|
||||||
LottieLoadingAnimation(true)
|
|
||||||
}
|
|
||||||
CustomToolbar(
|
|
||||||
title = titleToolBar,
|
|
||||||
subtitle = "",
|
|
||||||
showBackButton = true,
|
|
||||||
showSwitch = false,
|
|
||||||
iconList = listIconToolBar,
|
|
||||||
onBackClick = onBackClick,
|
|
||||||
onSwitchChange = { }
|
|
||||||
)
|
|
||||||
Spacer(modifier = Modifier.height(8.dp))
|
|
||||||
|
|
||||||
ScanLineTextSearch(
|
|
||||||
value = searchText,
|
|
||||||
onValueChange = {
|
|
||||||
searchText = it
|
|
||||||
showLoading = true
|
|
||||||
},
|
|
||||||
onImeAction,
|
|
||||||
modifier = Modifier
|
|
||||||
.focusRequester(focusRequester)
|
|
||||||
.onFocusEvent {
|
|
||||||
if (it.isFocused) {
|
|
||||||
keyboardController?.hide()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
LaunchedEffect(Unit) {
|
|
||||||
focusRequester.requestFocus()
|
|
||||||
keyboardController?.hide()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Encabezados
|
|
||||||
Row(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(vertical = 8.dp),
|
|
||||||
horizontalArrangement = Arrangement.SpaceEvenly
|
|
||||||
) {
|
|
||||||
headers.forEach { text ->
|
|
||||||
Text(
|
|
||||||
text = text,
|
|
||||||
color = Color.White,
|
|
||||||
fontSize = 14.sp,
|
|
||||||
modifier = Modifier.weight(1f)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HorizontalDivider(thickness = 1.dp, color = Color.White)
|
|
||||||
|
|
||||||
LazyColumn(modifier = Modifier.fillMaxSize()) {
|
|
||||||
items(items) { item ->
|
|
||||||
GenericRow(
|
|
||||||
values = item,
|
|
||||||
onLongClick = { onLongClick(item) },
|
|
||||||
onClick = { onClick(item) },
|
|
||||||
columnActions = columnActions
|
|
||||||
)
|
|
||||||
HorizontalDivider(thickness = 1.dp, color = Color.White)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
showLoading = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@OptIn(ExperimentalFoundationApi::class)
|
|
||||||
@Composable
|
|
||||||
fun GenericRow(
|
|
||||||
values: List<String>,
|
|
||||||
onLongClick: () -> Unit,
|
|
||||||
onClick: () -> Unit,
|
|
||||||
columnActions: List<(List<String>) -> Unit>
|
|
||||||
) {
|
|
||||||
Row(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(vertical = 8.dp)
|
|
||||||
.combinedClickable(onClick = onClick, onLongClick = onLongClick),
|
|
||||||
horizontalArrangement = Arrangement.SpaceEvenly
|
|
||||||
) {
|
|
||||||
values.forEachIndexed { index, value ->
|
|
||||||
val sdf = SimpleDateFormat(stringResource(R.string.dateFormat), Locale.getDefault())
|
|
||||||
val currentDate = sdf.format(Date())
|
|
||||||
|
|
||||||
val context = LocalContext.current // Accediendo al contexto
|
|
||||||
|
|
||||||
val customOrange = ContextCompat.getColor(context, R.color.verdnatura_pumpkin_orange)
|
|
||||||
val customWhite = ContextCompat.getColor(context, R.color.verdnatura_white)
|
|
||||||
val color = if (value == currentDate) Color(customOrange) else Color(customWhite)
|
|
||||||
|
|
||||||
Text(
|
|
||||||
text = value,
|
|
||||||
color = color,
|
|
||||||
textAlign = TextAlign.Center,
|
|
||||||
modifier = Modifier
|
|
||||||
.weight(1f)
|
|
||||||
.then(if (index < columnActions.size) Modifier.clickable {
|
|
||||||
columnActions[index](values)
|
|
||||||
} else Modifier)
|
|
||||||
.align(Alignment.CenterVertically)
|
|
||||||
.padding(4.dp)
|
|
||||||
)
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun TextDayOfSale(
|
|
||||||
values: List<String>,
|
|
||||||
value: String,
|
|
||||||
index: Int,
|
|
||||||
columnActions: List<(List<String>) -> Unit>
|
|
||||||
) {
|
|
||||||
val sdf = SimpleDateFormat(stringResource(R.string.dateFormat), Locale.getDefault())
|
|
||||||
val currentDate = sdf.format(Date())
|
|
||||||
|
|
||||||
val context = LocalContext.current
|
|
||||||
val customOrange = ContextCompat.getColor(context, R.color.verdnatura_pumpkin_orange)
|
|
||||||
val customWhite = ContextCompat.getColor(context, R.color.verdnatura_white)
|
|
||||||
val color = if (value == currentDate) Color(customOrange) else Color(customWhite)
|
|
||||||
|
|
||||||
Text(
|
|
||||||
text = value,
|
|
||||||
color = color,
|
|
||||||
modifier = Modifier
|
|
||||||
.then(if (index < columnActions.size) Modifier.clickable {
|
|
||||||
columnActions[index](values)
|
|
||||||
} else Modifier)
|
|
||||||
)
|
|
||||||
}
|
|
|
@ -7,16 +7,13 @@ import androidx.recyclerview.widget.RecyclerView
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.ItemHistoricoRowBinding
|
import es.verdnatura.databinding.ItemHistoricoRowBinding
|
||||||
import es.verdnatura.presentation.common.OnClientHistoricItemClickListener
|
import es.verdnatura.presentation.common.OnClientHistoricItemClickListener
|
||||||
import es.verdnatura.presentation.common.OnOutQuantityHistoricItemClickListener
|
|
||||||
import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoVO
|
import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoVO
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
import java.util.Locale
|
|
||||||
|
|
||||||
class HistoricoAdapter(
|
class HistoricoAdapter(
|
||||||
private val items: List<ItemHistoricoVO>,
|
private val items: List<ItemHistoricoVO>,
|
||||||
private val onClientHistoricItemClickListener: OnClientHistoricItemClickListener,
|
private val onClientHistoricItemClickListener: OnClientHistoricItemClickListener
|
||||||
private val onOutQuantityHistoricItemClickListener: OnOutQuantityHistoricItemClickListener
|
|
||||||
) : RecyclerView.Adapter<HistoricoAdapter.ItemHolder>() {
|
) : RecyclerView.Adapter<HistoricoAdapter.ItemHolder>() {
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
|
||||||
|
@ -39,12 +36,12 @@ class HistoricoAdapter(
|
||||||
binding.apply {
|
binding.apply {
|
||||||
this.item = item
|
this.item = item
|
||||||
|
|
||||||
val sdf = SimpleDateFormat(res.getString(R.string.dateFormat), Locale.getDefault())
|
val sdf = SimpleDateFormat(res.getString(R.string.dateFormat))
|
||||||
val currentDate = sdf.format(Date())
|
val currentDate = sdf.format(Date())
|
||||||
|
|
||||||
historicoDate.setBackgroundColor(
|
historicoDate.setBackgroundColor(
|
||||||
ContextCompat.getColor(
|
ContextCompat.getColor(
|
||||||
historicoDate.context, if (item.shipped.contains(currentDate)) {
|
historicoDate.context, if (currentDate == item.shipped) {
|
||||||
R.color.verdnatura_pumpkin_orange
|
R.color.verdnatura_pumpkin_orange
|
||||||
} else {
|
} else {
|
||||||
R.color.verdnatura_black_5
|
R.color.verdnatura_black_5
|
||||||
|
@ -79,14 +76,6 @@ class HistoricoAdapter(
|
||||||
clientName.setOnClickListener {
|
clientName.setOnClickListener {
|
||||||
onClientHistoricItemClickListener.onClientHistoricItemClickListener(item)
|
onClientHistoricItemClickListener.onClientHistoricItemClickListener(item)
|
||||||
}
|
}
|
||||||
outQuantity.setOnClickListener {
|
|
||||||
//tarea 8455
|
|
||||||
if (item.out != null && item.isTicket == 1) {
|
|
||||||
onOutQuantityHistoricItemClickListener.onOutQuantityHistoricItemClickListener(
|
|
||||||
item
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,6 +86,7 @@ class HistoricoAdapter(
|
||||||
binding: ItemHistoricoRowBinding,
|
binding: ItemHistoricoRowBinding,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
|
||||||
when (stateName?.lowercase()) {
|
when (stateName?.lowercase()) {
|
||||||
"preparado", "en preparación", "autoimpreso", "impreso" -> {
|
"preparado", "en preparación", "autoimpreso", "impreso" -> {
|
||||||
binding.clientName.setBackgroundColor(
|
binding.clientName.setBackgroundColor(
|
||||||
|
|
|
@ -13,11 +13,9 @@ import es.verdnatura.R.color.verdnatura_white
|
||||||
import es.verdnatura.databinding.FragmentHistoricoBinding
|
import es.verdnatura.databinding.FragmentHistoricoBinding
|
||||||
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFK
|
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFK
|
||||||
import es.verdnatura.domain.notNull
|
import es.verdnatura.domain.notNull
|
||||||
import es.verdnatura.domain.toast
|
|
||||||
import es.verdnatura.presentation.base.BaseFragment
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
import es.verdnatura.presentation.common.OnClientHistoricItemClickListener
|
import es.verdnatura.presentation.common.OnClientHistoricItemClickListener
|
||||||
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
||||||
import es.verdnatura.presentation.common.OnOutQuantityHistoricItemClickListener
|
|
||||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||||
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
||||||
import es.verdnatura.presentation.view.component.CustomDialog
|
import es.verdnatura.presentation.view.component.CustomDialog
|
||||||
|
@ -25,7 +23,6 @@ import es.verdnatura.presentation.view.feature.historicoarticulo.adapter.Histori
|
||||||
import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoListVO
|
import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoListVO
|
||||||
import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoVO
|
import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoVO
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||||
import java.net.URLEncoder
|
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
@ -194,27 +191,23 @@ class HistoricoArticuloFragment(
|
||||||
listHistoric.add(it)
|
listHistoric.add(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* listHistoric.sortWith { item1, item2 ->
|
listHistoric.sortWith { item1, item2 ->
|
||||||
|
val compareShipped = item1.shipped.compareTo(item2.shipped)
|
||||||
val date1 = item1.shipped.split(" ")[0]
|
//comentar con ivanm
|
||||||
val date2 = item2.shipped.split(" ")[0]
|
if (compareShipped == 0) {
|
||||||
|
if (item1.order == null && item2.order == null) {
|
||||||
val compareShipped = date1.compareTo(date2)
|
item2.balance!!.compareTo(item1.balance!!) // Comparar por balance cuando ambos órdenes son nulos
|
||||||
//comentar con ivanm
|
} else if (item1.order == null) {
|
||||||
if (compareShipped == 0) {
|
-1
|
||||||
if (item1.order == null && item2.order == null) {
|
} else if (item2.order == null) {
|
||||||
item2.balance!!.compareTo(item1.balance!!) // Comparar por balance cuando ambos órdenes son nulos
|
1
|
||||||
} else if (item1.order == null) {
|
} else {
|
||||||
-1
|
item2.order!!.compareTo(item1.order!!) // Invertir el orden
|
||||||
} else if (item2.order == null) {
|
}
|
||||||
1
|
} else {
|
||||||
} else {
|
compareShipped
|
||||||
item2.order!!.compareTo(item1.order!!) // Invertir el orden
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
compareShipped
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
adapter = HistoricoAdapter(listHistoric, object : OnClientHistoricItemClickListener {
|
adapter = HistoricoAdapter(listHistoric, object : OnClientHistoricItemClickListener {
|
||||||
|
|
||||||
override fun onClientHistoricItemClickListener(item: ItemHistoricoVO) {
|
override fun onClientHistoricItemClickListener(item: ItemHistoricoVO) {
|
||||||
|
@ -249,71 +242,6 @@ class HistoricoArticuloFragment(
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, object : OnOutQuantityHistoricItemClickListener {
|
|
||||||
override fun onOutQuantityHistoricItemClickListener(item: ItemHistoricoVO) {
|
|
||||||
|
|
||||||
val baseUrl =
|
|
||||||
"${mobileApplication.dataStoreApp.getServerLilium()}/#/ticket/${item.originId}/log"
|
|
||||||
val logsJson = """
|
|
||||||
{
|
|
||||||
"filter": {
|
|
||||||
"limit": 20,
|
|
||||||
"fields": [
|
|
||||||
"id",
|
|
||||||
"originFk",
|
|
||||||
"userFk",
|
|
||||||
"action",
|
|
||||||
"changedModel",
|
|
||||||
"oldInstance",
|
|
||||||
"newInstance",
|
|
||||||
"creationDate",
|
|
||||||
"changedModelId",
|
|
||||||
"changedModelValue",
|
|
||||||
"description",
|
|
||||||
"summaryId"
|
|
||||||
],
|
|
||||||
"where": {
|
|
||||||
"and": [
|
|
||||||
{
|
|
||||||
"originFk": "${item.originId}"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"or": [
|
|
||||||
{
|
|
||||||
"oldJson": {
|
|
||||||
"like": "%${itemFk}%"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"newJson": {
|
|
||||||
"like": "%${itemFk}%"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"description": {
|
|
||||||
"like": "%${itemFk}%"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"skip": 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
""".trimIndent()
|
|
||||||
val encodedJson = URLEncoder.encode(logsJson, "UTF-8")
|
|
||||||
val entryPoint = Gson().toJson(
|
|
||||||
mutableMapOf(
|
|
||||||
"entryPoint" to item.entityId, "web" to "$baseUrl?logs=$encodedJson"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
ma.onPasillerosItemClickListener(
|
|
||||||
PasillerosItemVO(
|
|
||||||
title = R.string.titleWebViewer,
|
|
||||||
), entryPoint = entryPoint
|
|
||||||
)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
binding.historicoRecyclerview.adapter = adapter
|
binding.historicoRecyclerview.adapter = adapter
|
||||||
binding.historicoRecyclerview.layoutManager =
|
binding.historicoRecyclerview.layoutManager =
|
||||||
|
@ -325,22 +253,13 @@ class HistoricoArticuloFragment(
|
||||||
|
|
||||||
private fun navigateToToday(it: ItemHistoricoListVO) {
|
private fun navigateToToday(it: ItemHistoricoListVO) {
|
||||||
var positionToday = 0
|
var positionToday = 0
|
||||||
|
val sdf = SimpleDateFormat(getString(R.string.dateFormat), Locale.getDefault())
|
||||||
val inputFormat = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault())
|
val currentDate = sdf.format(Date())
|
||||||
val outputFormat = SimpleDateFormat(getString(R.string.dateFormat), Locale.getDefault())
|
|
||||||
val currentDate = outputFormat.format(Date())
|
|
||||||
|
|
||||||
for (item in it.list) {
|
for (item in it.list) {
|
||||||
try {
|
if (currentDate == item.shipped) {
|
||||||
val shippedDate = inputFormat.parse(item.shipped)
|
break
|
||||||
val formattedShippedDate = shippedDate?.let { date -> outputFormat.format(date) }
|
|
||||||
if (currentDate == formattedShippedDate) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
|
||||||
getString(R.string.errorOrderList).toast(requireContext())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
positionToday += 1
|
positionToday += 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
package es.verdnatura.presentation.view.feature.historicoshelving.adapter
|
||||||
|
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import es.verdnatura.R
|
||||||
|
import es.verdnatura.databinding.ItemShelvinglogRowBinding
|
||||||
|
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||||
|
import es.verdnatura.presentation.view.feature.historicoshelving.model.ItemShelvingLog
|
||||||
|
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||||
|
|
||||||
|
class ItemShelvingLogAdapter(
|
||||||
|
private var items: List<ItemShelvingLog>,
|
||||||
|
private val onPasillerosItemClickListener: OnPasillerosItemClickListener
|
||||||
|
) : RecyclerView.Adapter<ItemShelvingLogAdapter.ItemHolder>() {
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
|
||||||
|
return ItemHolder(
|
||||||
|
ItemShelvinglogRowBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getItemCount() = items.size
|
||||||
|
|
||||||
|
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
|
||||||
|
holder.bind(items[position])
|
||||||
|
holder.binding.root.setOnClickListener {
|
||||||
|
|
||||||
|
if (!items[position].shelvingFk.isNullOrEmpty()) {
|
||||||
|
|
||||||
|
onPasillerosItemClickListener.onPasillerosItemClickListener(
|
||||||
|
PasillerosItemVO(
|
||||||
|
title =
|
||||||
|
R.string.titleUbicator
|
||||||
|
), items[position].shelvingFk!!
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fun addList(list:List<ItemShelvingLog>){
|
||||||
|
items = list
|
||||||
|
notifyDataSetChanged()
|
||||||
|
|
||||||
|
}
|
||||||
|
inner class ItemHolder(
|
||||||
|
val binding: ItemShelvinglogRowBinding
|
||||||
|
) : RecyclerView.ViewHolder(binding.root) {
|
||||||
|
private val res = binding.root.context.resources
|
||||||
|
fun bind(item: ItemShelvingLog) {
|
||||||
|
binding.apply {
|
||||||
|
|
||||||
|
binding.txtNickname.setOnClickListener {
|
||||||
|
if (item.worker?.id != null) openWorker(binding, item.worker?.id!!)
|
||||||
|
}
|
||||||
|
binding.txtVisible.setOnClickListener {
|
||||||
|
if (item.worker?.id != null) openWorker(binding, item.worker?.id!!)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
this.item = item
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun openWorker(binding: ItemShelvinglogRowBinding, id: Int) {
|
||||||
|
onPasillerosItemClickListener.onPasillerosItemClickListener(
|
||||||
|
PasillerosItemVO(title = R.string.titleUserControlVehicle),
|
||||||
|
id.toString()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,153 @@
|
||||||
|
package es.verdnatura.presentation.view.feature.historicoshelving.fragment
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.os.Handler
|
||||||
|
import android.os.Looper
|
||||||
|
import android.view.View
|
||||||
|
import android.view.inputmethod.EditorInfo
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import es.verdnatura.R
|
||||||
|
import es.verdnatura.databinding.FragmentItemshelvinglogBinding
|
||||||
|
import es.verdnatura.domain.ConstAndValues.LIMITRECORDSSHELVINGLOG
|
||||||
|
import es.verdnatura.domain.toLong
|
||||||
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
|
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||||
|
import es.verdnatura.presentation.view.component.CustomDialog
|
||||||
|
import es.verdnatura.presentation.view.feature.historicoshelving.adapter.ItemShelvingLogAdapter
|
||||||
|
|
||||||
|
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||||
|
class ItemShelvingLogFragment(
|
||||||
|
var entryPoint: String = ""
|
||||||
|
) : BaseFragment<FragmentItemshelvinglogBinding, ItemShelvingLogViewModel>(ItemShelvingLogViewModel::class) {
|
||||||
|
|
||||||
|
private var adapter: ItemShelvingLogAdapter? = null
|
||||||
|
private var itemScan = ""
|
||||||
|
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
|
||||||
|
private var records: Int = LIMITRECORDSSHELVINGLOG
|
||||||
|
private var shelving: String = ""
|
||||||
|
private var positionScroll = 0
|
||||||
|
private var positionToReturn = 0
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun newInstance(entryPoint: String) = ItemShelvingLogFragment(entryPoint)
|
||||||
|
}
|
||||||
|
|
||||||
|
private lateinit var customDialog: CustomDialog
|
||||||
|
|
||||||
|
override fun getLayoutId(): Int = R.layout.fragment_itemshelvinglog
|
||||||
|
|
||||||
|
override fun init() {
|
||||||
|
|
||||||
|
customDialog = CustomDialog(requireContext())
|
||||||
|
setEvents()
|
||||||
|
setToolBar(getString(R.string.itemShelvingLog))
|
||||||
|
setAdapter()
|
||||||
|
super.init()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setAdapter() {
|
||||||
|
binding.itemshelvinglogRecyclerview.layoutManager =
|
||||||
|
LinearLayoutManager(
|
||||||
|
requireContext(),
|
||||||
|
LinearLayoutManager.VERTICAL,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
adapter = ItemShelvingLogAdapter(
|
||||||
|
listOf(),
|
||||||
|
onPasillerosItemClickListener = pasillerosItemClickListener!!
|
||||||
|
)
|
||||||
|
binding.itemshelvinglogRecyclerview.adapter = adapter
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onAttach(context: Context) {
|
||||||
|
if (context is OnPasillerosItemClickListener) pasillerosItemClickListener = context
|
||||||
|
super.onAttach(context)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setToolBar(title: String) {
|
||||||
|
binding.mainToolbar.toolbarTitle.text = title
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setEvents() {
|
||||||
|
val scrollView = binding.scrollView
|
||||||
|
scrollView.setOnScrollChangeListener { _, _, scrollY, _, _->
|
||||||
|
positionScroll = scrollY
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
binding.scanInput.requestFocus()
|
||||||
|
binding.loadMoreButton.setOnClickListener {
|
||||||
|
positionToReturn = positionScroll
|
||||||
|
records += LIMITRECORDSSHELVINGLOG
|
||||||
|
try {
|
||||||
|
viewModel.getIdFromCodeSalix(shelving.toLong().toString(), records)
|
||||||
|
} catch (ex: Exception) {
|
||||||
|
|
||||||
|
viewModel.itemShelvingLogGet(
|
||||||
|
shelving,
|
||||||
|
records
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
binding.scanInput.setOnEditorActionListener { v, actionId, event ->
|
||||||
|
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
||||||
|
if (binding.scanInput.text.toString().isNotEmpty()) {
|
||||||
|
//Tarea 7168
|
||||||
|
shelving = binding.scanInput.text.toString()
|
||||||
|
records = LIMITRECORDSSHELVINGLOG
|
||||||
|
try {
|
||||||
|
viewModel.getIdFromCodeSalix(binding.scanInput.toLong().toString(), records)
|
||||||
|
} catch (ex: Exception) {
|
||||||
|
viewModel.itemShelvingLogGet(
|
||||||
|
shelving,
|
||||||
|
records
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
binding.scanInput.setText("")
|
||||||
|
ma.hideKeyboard(binding.scanInput)
|
||||||
|
return@setOnEditorActionListener true
|
||||||
|
}
|
||||||
|
false
|
||||||
|
}
|
||||||
|
binding.mainToolbar.backButton.setOnClickListener {
|
||||||
|
ma.onMyBackPressed()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun observeViewModel() {
|
||||||
|
with(viewModel) {
|
||||||
|
|
||||||
|
itemShelvingLogList.observe(viewLifecycleOwner) {
|
||||||
|
|
||||||
|
if (it.list.isEmpty()) {
|
||||||
|
customDialog.setTitle(getString(R.string.noResults))
|
||||||
|
.setDescription(getString(R.string.noDataLabelScanned))
|
||||||
|
.setOkButton(getString(R.string.close)) {
|
||||||
|
customDialog.dismiss()
|
||||||
|
}.show()
|
||||||
|
} else {
|
||||||
|
|
||||||
|
//TAREA 7168
|
||||||
|
if (it.list.size == records) {
|
||||||
|
binding.loadMoreButton.visibility = View.VISIBLE
|
||||||
|
} else {
|
||||||
|
binding.loadMoreButton.visibility = View.GONE
|
||||||
|
}
|
||||||
|
adapter!!.addList(it.list)
|
||||||
|
setToolBar(getString(R.string.itemShelvingLog) + ":" + itemScan)
|
||||||
|
|
||||||
|
val handler = Handler(Looper.getMainLooper())
|
||||||
|
handler.postDelayed({
|
||||||
|
binding.scrollView.smoothScrollTo(0, positionToReturn)
|
||||||
|
}, 1000)
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
package es.verdnatura.presentation.view.feature.historicoshelving.fragment
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import androidx.lifecycle.LiveData
|
||||||
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import es.verdnatura.domain.ConstAndValues.LIMITRECORDSSHELVINGLOG
|
||||||
|
import es.verdnatura.domain.SalixCallback
|
||||||
|
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
||||||
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
|
import es.verdnatura.presentation.view.feature.historicoshelving.model.ItemShelvingLog
|
||||||
|
import es.verdnatura.presentation.view.feature.historicoshelving.model.ItemShelvingLogList
|
||||||
|
import retrofit2.Response
|
||||||
|
|
||||||
|
class ItemShelvingLogViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
|
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
|
||||||
|
|
||||||
|
private val _itemShelvingLogList by lazy { MutableLiveData<ItemShelvingLogList>() }
|
||||||
|
val itemShelvingLogList: LiveData<ItemShelvingLogList> = _itemShelvingLogList
|
||||||
|
|
||||||
|
private val _responseCode by lazy { MutableLiveData<Int?>() }
|
||||||
|
val responseCode: LiveData<Int?> = _responseCode
|
||||||
|
|
||||||
|
fun itemShelvingLogGet(shelvingOrItem: String, records: Int = LIMITRECORDSSHELVINGLOG) {
|
||||||
|
//tarea 7168
|
||||||
|
salix.itemShelvingLogGet(
|
||||||
|
filter = """{ "where": { "or": [ {"shelvingFk": "$shelvingOrItem"}, {"itemFk": "$shelvingOrItem"} ] },
|
||||||
|
"limit": $records,
|
||||||
|
"order": "created DESC",
|
||||||
|
"include": [ { "relation": "worker", "scope": { "fields": ["code"]} },
|
||||||
|
{ "relation": "item", "scope": { "fields": ["longName"] } } ] }
|
||||||
|
""".trim()
|
||||||
|
)
|
||||||
|
.enqueue(object :
|
||||||
|
SalixCallback<List<ItemShelvingLog>>(context) {
|
||||||
|
override fun onSuccess(response: Response<List<ItemShelvingLog>>) {
|
||||||
|
_itemShelvingLogList.value = response.body()?.let {
|
||||||
|
ItemShelvingLogList(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getIdFromCodeSalix(code: String, records: Int) {
|
||||||
|
getItemFromBarcodeUseCase.execute (code)
|
||||||
|
.enqueue(object : SalixCallback<Int?>(context) {
|
||||||
|
|
||||||
|
override fun onSuccess(response: Response<Int?>) {
|
||||||
|
itemShelvingLogGet(response.body()!!.toString(), records)
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
package es.verdnatura.presentation.view.feature.historicoshelving.model
|
||||||
|
|
||||||
|
import es.verdnatura.domain.isoToString
|
||||||
|
|
||||||
|
|
||||||
|
data class ItemShelvingLog(
|
||||||
|
var itemFk: Int? = null,
|
||||||
|
var longName: String? = null,
|
||||||
|
var shelvingFk: String? = null,
|
||||||
|
var visible: Int? = null,
|
||||||
|
var accion: String? = null,
|
||||||
|
var code: String? = null,
|
||||||
|
var worker: Worker? = null,
|
||||||
|
var item:ItemSalix? = null
|
||||||
|
) {
|
||||||
|
var created: String = ""
|
||||||
|
get() {
|
||||||
|
return field.isoToString(returnOnlyDate = false)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
data class ItemSalix(var longName: String?)
|
||||||
|
|
||||||
|
data class ItemShelvingSaleDateList(
|
||||||
|
var list: List<ItemShelvingLog> = listOf()
|
||||||
|
)
|
||||||
|
|
||||||
|
data class ItemShelvingLogList(
|
||||||
|
var list: List<ItemShelvingLog> = listOf()
|
||||||
|
)
|
||||||
|
|
||||||
|
data class Worker(
|
||||||
|
var id:Int? ,
|
||||||
|
var code: String,
|
||||||
|
)
|
|
@ -0,0 +1,48 @@
|
||||||
|
package es.verdnatura.presentation.view.feature.historicovehiculo.adapter
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import es.verdnatura.R
|
||||||
|
import es.verdnatura.databinding.ItemHistoricovehiculoRowBinding
|
||||||
|
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculo
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class HistoricoVehiculoAdapter (
|
||||||
|
private val items: List<ItemHistoricoVehiculo>
|
||||||
|
): RecyclerView.Adapter<HistoricoVehiculoAdapter.ItemHolder> () {
|
||||||
|
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
|
||||||
|
return ItemHolder(
|
||||||
|
ItemHistoricovehiculoRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getItemCount() =items.size
|
||||||
|
|
||||||
|
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
|
||||||
|
holder.bind(items[position])
|
||||||
|
}
|
||||||
|
|
||||||
|
inner class ItemHolder(
|
||||||
|
val binding: ItemHistoricovehiculoRowBinding
|
||||||
|
) : RecyclerView.ViewHolder(binding.root){
|
||||||
|
private val res = binding.root.context.resources
|
||||||
|
fun bind(item: ItemHistoricoVehiculo) {
|
||||||
|
binding.apply {
|
||||||
|
this.item = item
|
||||||
|
val sdf = SimpleDateFormat(binding.root.context.getString(R.string.dateFormat))
|
||||||
|
val currentDate = sdf.format(Date())
|
||||||
|
if (currentDate == item.inTimed){
|
||||||
|
historicoDate.setBackgroundColor(ContextCompat.getColor(historicoDate.context,R.color.verdnatura_pumpkin_orange))
|
||||||
|
}else{
|
||||||
|
historicoDate.setBackgroundColor(ContextCompat.getColor(historicoDate.context,R.color.verdnatura_black_5))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,93 @@
|
||||||
|
package es.verdnatura.presentation.view.feature.historicovehiculo.fragment
|
||||||
|
|
||||||
|
import android.view.View
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import es.verdnatura.R
|
||||||
|
import es.verdnatura.databinding.FragmentHistoricovehiculoBinding
|
||||||
|
import es.verdnatura.domain.notNull
|
||||||
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
|
import es.verdnatura.presentation.view.feature.historicovehiculo.adapter.HistoricoVehiculoAdapter
|
||||||
|
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculoList
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.Date
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
|
class HistoricoVehiculoFragment(
|
||||||
|
private var numberPlate: String = ""
|
||||||
|
) : BaseFragment<FragmentHistoricovehiculoBinding, HistoricoVehiculoViewModel>(
|
||||||
|
HistoricoVehiculoViewModel::class
|
||||||
|
) {
|
||||||
|
|
||||||
|
private var adapter: HistoricoVehiculoAdapter? = null
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun newInstance(entryPoint: String) = HistoricoVehiculoFragment(entryPoint)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getLayoutId(): Int = R.layout.fragment_historicovehiculo
|
||||||
|
|
||||||
|
|
||||||
|
override fun init() {
|
||||||
|
|
||||||
|
ma.hideBottomNavigation(View.GONE)
|
||||||
|
viewModel.machineWorkeGetHistorical(numberPlate,mobileApplication.userId!!)
|
||||||
|
binding.mainToolbar.toolbarTitle.text = getString(R.string.vehiclediary)
|
||||||
|
setEvents()
|
||||||
|
super.init()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setEvents() {
|
||||||
|
binding.mainToolbar.backButton.setOnClickListener {
|
||||||
|
ma.onMyBackPressed()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun observeViewModel() {
|
||||||
|
with(viewModel) {
|
||||||
|
loadHistoricoVehiculoList.observe(viewLifecycleOwner) { event ->
|
||||||
|
event.getContentIfNotHandled().notNull {
|
||||||
|
|
||||||
|
if (it.list.isEmpty()) {
|
||||||
|
ma.messageWithSound(
|
||||||
|
getString(R.string.lookWithpermission),
|
||||||
|
isError = true,
|
||||||
|
isPlayed = true,
|
||||||
|
getString(
|
||||||
|
R.string.info
|
||||||
|
)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
adapter = HistoricoVehiculoAdapter(it.list)
|
||||||
|
binding.historicovehiculoRecyclerview.adapter = adapter
|
||||||
|
binding.historicovehiculoRecyclerview.layoutManager =
|
||||||
|
LinearLayoutManager(
|
||||||
|
requireContext(),
|
||||||
|
LinearLayoutManager.VERTICAL,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
navigateToToday(it)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun navigateToToday(it: ItemHistoricoVehiculoList) {
|
||||||
|
var positionToday = 0
|
||||||
|
val sdf = SimpleDateFormat(getString(R.string.dateFormat), Locale.getDefault())
|
||||||
|
val currentDate = sdf.format(Date())
|
||||||
|
|
||||||
|
for (item in it.list) {
|
||||||
|
if (currentDate == item.inTimed) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
positionToday += 1
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.historicovehiculoRecyclerview.scrollToPosition(positionToday)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package es.verdnatura.presentation.view.feature.historicovehiculo.fragment
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import androidx.lifecycle.LiveData
|
||||||
|
import androidx.lifecycle.MutableLiveData
|
||||||
|
import androidx.lifecycle.map
|
||||||
|
import es.verdnatura.domain.SalixCallback
|
||||||
|
import es.verdnatura.domain.formatWithQuotes
|
||||||
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
|
import es.verdnatura.presentation.common.Event
|
||||||
|
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculo
|
||||||
|
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculoList
|
||||||
|
import retrofit2.Response
|
||||||
|
|
||||||
|
class HistoricoVehiculoViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
|
private val _historicovehiculoList by lazy { MutableLiveData<ItemHistoricoVehiculoList>() }
|
||||||
|
val loadHistoricoVehiculoList: LiveData<Event<ItemHistoricoVehiculoList>> = _historicovehiculoList.map { Event(it) }
|
||||||
|
|
||||||
|
fun machineWorkeGetHistorical(plateNumber: String, workerId:Int) {
|
||||||
|
salix.machineWorkerGetHistorical(arrayListOf(plateNumber,workerId).formatWithQuotes())
|
||||||
|
.enqueue(object :
|
||||||
|
SalixCallback<List<ItemHistoricoVehiculo>>(context) {
|
||||||
|
override fun onSuccess(response: Response<List<ItemHistoricoVehiculo>>) {
|
||||||
|
_historicovehiculoList.value =
|
||||||
|
response.body()?.let { ItemHistoricoVehiculoList(it) }
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package es.verdnatura.presentation.view.feature.historicovehiculo.model
|
||||||
|
|
||||||
|
import es.verdnatura.domain.isoToString
|
||||||
|
|
||||||
|
class ItemHistoricoVehiculo(
|
||||||
|
var workerName: String? = null,
|
||||||
|
|
||||||
|
) {
|
||||||
|
var inTimed: String = ""
|
||||||
|
get() {
|
||||||
|
return field.isoToString()
|
||||||
|
}
|
||||||
|
var outTimed: String = ""
|
||||||
|
get() {
|
||||||
|
return field.isoToString()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class ItemHistoricoVehiculoList(
|
||||||
|
var list: List<ItemHistoricoVehiculo> = listOf()
|
||||||
|
)
|
|
@ -1,81 +0,0 @@
|
||||||
package es.verdnatura.presentation.view.feature.indoor
|
|
||||||
|
|
||||||
import android.Manifest
|
|
||||||
import android.content.pm.PackageManager
|
|
||||||
import android.location.Location
|
|
||||||
import android.location.LocationListener
|
|
||||||
import android.location.LocationManager
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.widget.TextView
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import androidx.core.app.ActivityCompat
|
|
||||||
import androidx.core.content.ContextCompat
|
|
||||||
import es.verdnatura.R
|
|
||||||
|
|
||||||
class MainActivityIndoor : AppCompatActivity(), LocationListener {
|
|
||||||
|
|
||||||
private lateinit var locationManager: LocationManager
|
|
||||||
private lateinit var textView: TextView
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
|
||||||
super.onCreate(savedInstanceState)
|
|
||||||
setContentView(R.layout.indoor_activity_main)
|
|
||||||
|
|
||||||
textView = findViewById(R.id.textViewLocation)
|
|
||||||
|
|
||||||
locationManager = getSystemService(LOCATION_SERVICE) as LocationManager
|
|
||||||
|
|
||||||
// Verificar permisos
|
|
||||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION)
|
|
||||||
!= PackageManager.PERMISSION_GRANTED
|
|
||||||
) {
|
|
||||||
|
|
||||||
ActivityCompat.requestPermissions(
|
|
||||||
this,
|
|
||||||
arrayOf(Manifest.permission.ACCESS_COARSE_LOCATION), 1
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
startLocationUpdates()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun startLocationUpdates() {
|
|
||||||
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION)
|
|
||||||
== PackageManager.PERMISSION_GRANTED
|
|
||||||
) {
|
|
||||||
|
|
||||||
locationManager.requestLocationUpdates(
|
|
||||||
LocationManager.NETWORK_PROVIDER,
|
|
||||||
5000, // Tiempo mínimo de actualización (5 segundos)
|
|
||||||
10f, // Distancia mínima de actualización (10 metros)
|
|
||||||
this
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onLocationChanged(location: Location) {
|
|
||||||
val latitude = location.latitude
|
|
||||||
val longitude = location.longitude
|
|
||||||
textView.text = "Lat: $latitude\nLon: $longitude"
|
|
||||||
println(" $latitude:$longitude")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onRequestPermissionsResult(
|
|
||||||
requestCode: Int,
|
|
||||||
permissions: Array<out String>,
|
|
||||||
grantResults: IntArray
|
|
||||||
) {
|
|
||||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
|
||||||
if (requestCode == 1 && grantResults.isNotEmpty()
|
|
||||||
&& grantResults[0] == PackageManager.PERMISSION_GRANTED
|
|
||||||
) {
|
|
||||||
startLocationUpdates()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStatusChanged(provider: String?, status: Int, extras: Bundle?) {}
|
|
||||||
|
|
||||||
override fun onProviderEnabled(provider: String) {}
|
|
||||||
|
|
||||||
override fun onProviderDisabled(provider: String) {}
|
|
||||||
}
|
|
|
@ -44,7 +44,7 @@ class InventaryFragment :
|
||||||
private lateinit var itemClicked: ItemInventaryVO
|
private lateinit var itemClicked: ItemInventaryVO
|
||||||
private var buyerId: Number = -1
|
private var buyerId: Number = -1
|
||||||
private var filterItemType: String? = null
|
private var filterItemType: String? = null
|
||||||
private var myListBuyers = mutableListOf<Buyer>()
|
private var myListBuyers = listOf<Buyer>()
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun newInstance() = InventaryFragment()
|
fun newInstance() = InventaryFragment()
|
||||||
|
@ -82,7 +82,6 @@ class InventaryFragment :
|
||||||
}
|
}
|
||||||
.distinct()
|
.distinct()
|
||||||
.sortedBy { it.name }
|
.sortedBy { it.name }
|
||||||
|
|
||||||
setSearchable(distinctPackingTypes as MutableList<NameWithId>)
|
setSearchable(distinctPackingTypes as MutableList<NameWithId>)
|
||||||
binding.searchableRecyclerView.visibility = View.VISIBLE
|
binding.searchableRecyclerView.visibility = View.VISIBLE
|
||||||
binding.searchableRecyclerView.setSearchHint(getString(R.string.BuyerSearch))
|
binding.searchableRecyclerView.setSearchHint(getString(R.string.BuyerSearch))
|
||||||
|
@ -236,7 +235,7 @@ class InventaryFragment :
|
||||||
with(viewModel) {
|
with(viewModel) {
|
||||||
|
|
||||||
buyersByItemPackingList.observe(viewLifecycleOwner) { list ->
|
buyersByItemPackingList.observe(viewLifecycleOwner) { list ->
|
||||||
myListBuyers = list.list.toMutableList()
|
myListBuyers = list.list
|
||||||
val distinctPackingTypes =
|
val distinctPackingTypes =
|
||||||
list?.list?.map {
|
list?.list?.map {
|
||||||
NameWithId(
|
NameWithId(
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package es.verdnatura.presentation.view.feature.inventario.model
|
package es.verdnatura.presentation.view.feature.inventario.model
|
||||||
|
|
||||||
import com.google.gson.annotations.SerializedName
|
|
||||||
|
|
||||||
class ItemInventaryVO(
|
class ItemInventaryVO(
|
||||||
var itemFk: Int? = null,
|
var itemFk: Int? = null,
|
||||||
var longName: String? = null,
|
var longName: String? = null,
|
||||||
|
@ -11,7 +9,7 @@ class ItemInventaryVO(
|
||||||
var upstairs: Int? = null,
|
var upstairs: Int? = null,
|
||||||
var nicho: Int? = null,
|
var nicho: Int? = null,
|
||||||
var itemColour: String = "",
|
var itemColour: String = "",
|
||||||
var pendingAmount: Long? = null
|
var pendingAmount :Long? = null
|
||||||
)
|
)
|
||||||
|
|
||||||
class InventaryListVO(
|
class InventaryListVO(
|
||||||
|
@ -29,14 +27,13 @@ class ItemShelvingVisibleZero(
|
||||||
|
|
||||||
class ItemShelvingChecked(
|
class ItemShelvingChecked(
|
||||||
var isChecked: Boolean?,
|
var isChecked: Boolean?,
|
||||||
var userFk: Int
|
var userFk : Int
|
||||||
)
|
)
|
||||||
|
|
||||||
data class ItemInventoryParking(
|
data class ItemInventoryParking(
|
||||||
var id: Long = 0,
|
var id: Long = 0,
|
||||||
var pickingOrder: Int = 0,
|
var pickingOrder: Int = 0,
|
||||||
var parking: String = "",
|
var parking: String = "",
|
||||||
@SerializedName(value = "shelvingFk", alternate = ["code"])
|
|
||||||
var shelvingFk: String = "",
|
var shelvingFk: String = "",
|
||||||
var itemFk: Int = 0,
|
var itemFk: Int = 0,
|
||||||
var longName: String = "",
|
var longName: String = "",
|
||||||
|
@ -45,8 +42,8 @@ data class ItemInventoryParking(
|
||||||
var buyer: String = "",
|
var buyer: String = "",
|
||||||
var isChecked: Int? = null,
|
var isChecked: Int? = null,
|
||||||
var priority: Int = 0,
|
var priority: Int = 0,
|
||||||
var url: String? = null,
|
var url:String? = null,
|
||||||
var image: String? = null
|
var image:String? = null
|
||||||
)
|
)
|
||||||
|
|
||||||
class InventoryParkingList(
|
class InventoryParkingList(
|
||||||
|
|
|
@ -43,7 +43,7 @@ import kotlinx.coroutines.runBlocking
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
import kotlin.system.exitProcess
|
import kotlin.system.exitProcess
|
||||||
|
|
||||||
class LoginFragment :
|
class LoginFragment() :
|
||||||
BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginViewModel::class) {
|
BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginViewModel::class) {
|
||||||
|
|
||||||
private lateinit var customDialogInput: CustomDialogInput
|
private lateinit var customDialogInput: CustomDialogInput
|
||||||
|
@ -157,7 +157,6 @@ class LoginFragment :
|
||||||
}
|
}
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setSwitch() {
|
private fun setSwitch() {
|
||||||
|
@ -171,6 +170,36 @@ class LoginFragment :
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* private fun getDevicePDA(): Int? {
|
||||||
|
return try {
|
||||||
|
Settings.Global.getString(
|
||||||
|
mobileApplication.contentResolver, Settings.Global.DEVICE_NAME
|
||||||
|
).toInt()
|
||||||
|
} catch (ex: Exception) {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/* private fun createFolderSerial() {
|
||||||
|
|
||||||
|
val directory = File(
|
||||||
|
requireContext().getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS), "/dataSerial"
|
||||||
|
)
|
||||||
|
|
||||||
|
if (!directory.exists()) {
|
||||||
|
directory.mkdirs()
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
val filename = "serial.txt"
|
||||||
|
val file = File(directory, filename)
|
||||||
|
mobileApplication.serialNumber = file.readText()
|
||||||
|
} catch (ex: Exception) {
|
||||||
|
d("VERDNATURA:", getString(R.string.errorFile))
|
||||||
|
}
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
private fun setAdapter(listWorkForms: List<WorkForms>) {
|
private fun setAdapter(listWorkForms: List<WorkForms>) {
|
||||||
|
|
||||||
workFormAdapter = WorkFormAdapter(listWorkForms, object : OnWorkFormsItemRowClickListener {
|
workFormAdapter = WorkFormAdapter(listWorkForms, object : OnWorkFormsItemRowClickListener {
|
||||||
|
@ -326,36 +355,31 @@ class LoginFragment :
|
||||||
if (binding.edittextServer.text.toString() == "Producción") {
|
if (binding.edittextServer.text.toString() == "Producción") {
|
||||||
mobileApplication.clearApplicationData()
|
mobileApplication.clearApplicationData()
|
||||||
}
|
}
|
||||||
//Tarea 8212 serialMuber is obtaines from back when PDA is registered, updated scaleFusion
|
customDialog.setTitle(getString(R.string.Actualizar))
|
||||||
if (it.serialNumber.isEmpty()) {
|
.setDescription(getString(R.string.updatemng)).setOkButton(
|
||||||
customDialog.setTitle(getString(R.string.Actualizar))
|
getString(
|
||||||
.setDescription(getString(R.string.updatemng)).setOkButton(
|
R.string.Actualizar
|
||||||
getString(
|
)
|
||||||
R.string.Actualizar
|
) {
|
||||||
)
|
try {
|
||||||
) {
|
val openURL = Intent(Intent.ACTION_VIEW)
|
||||||
try {
|
openURL.data = Uri.parse(it.url)
|
||||||
val openURL = Intent(Intent.ACTION_VIEW)
|
startActivity(openURL)
|
||||||
openURL.data = Uri.parse(it.url)
|
} catch (ex: Exception) {
|
||||||
startActivity(openURL)
|
getString(R.string.problemUpdate).toast(requireActivity())
|
||||||
} catch (ex: Exception) {
|
}
|
||||||
getString(R.string.problemUpdate).toast(requireActivity())
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
if (it.isVersionCritical) {
|
|
||||||
customDialog.setDescription(getString(R.string.updatecritical))
|
|
||||||
} else {
|
|
||||||
customDialog.setKoButton(getString(R.string.cancel)) {
|
|
||||||
customDialog.dismiss()
|
|
||||||
goToMain()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
customDialog.show()
|
if (it.isVersionCritical) {
|
||||||
|
customDialog.setDescription(getString(R.string.updatecritical))
|
||||||
} else {
|
} else {
|
||||||
goToMain()
|
customDialog.setKoButton(getString(R.string.cancel)) {
|
||||||
|
customDialog.dismiss()
|
||||||
|
goToMain()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
customDialog.show()
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,9 @@ import es.verdnatura.domain.ConstAndValues.TOKENCREATED
|
||||||
import es.verdnatura.domain.ConstAndValues.TTL
|
import es.verdnatura.domain.ConstAndValues.TTL
|
||||||
import es.verdnatura.domain.SalixCallback
|
import es.verdnatura.domain.SalixCallback
|
||||||
import es.verdnatura.domain.formatWithQuotes
|
import es.verdnatura.domain.formatWithQuotes
|
||||||
import es.verdnatura.domain.getMessageFromAllResponse
|
|
||||||
import es.verdnatura.domain.nameofFunction
|
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
|
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||||
|
import es.verdnatura.presentation.base.nameofFunction
|
||||||
import es.verdnatura.presentation.common.Event
|
import es.verdnatura.presentation.common.Event
|
||||||
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.DeviceLogSalix
|
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.DeviceLogSalix
|
||||||
import es.verdnatura.presentation.view.feature.login.model.AccessConfigSalix
|
import es.verdnatura.presentation.view.feature.login.model.AccessConfigSalix
|
||||||
|
|
|
@ -3,6 +3,7 @@ package es.verdnatura.presentation.view.feature.main.activity
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.media.MediaPlayer
|
import android.media.MediaPlayer
|
||||||
|
import android.os.Build
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.util.Log.e
|
import android.util.Log.e
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
|
@ -10,6 +11,7 @@ import android.view.View
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.activity.OnBackPressedCallback
|
import androidx.activity.OnBackPressedCallback
|
||||||
import androidx.activity.OnBackPressedDispatcherOwner
|
import androidx.activity.OnBackPressedDispatcherOwner
|
||||||
|
import androidx.annotation.RequiresApi
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.FragmentManager
|
import androidx.fragment.app.FragmentManager
|
||||||
|
@ -48,7 +50,7 @@ import es.verdnatura.presentation.common.OnStopMapClickListener
|
||||||
import es.verdnatura.presentation.common.OnTruckClickListener
|
import es.verdnatura.presentation.common.OnTruckClickListener
|
||||||
import es.verdnatura.presentation.common.TAG
|
import es.verdnatura.presentation.common.TAG
|
||||||
import es.verdnatura.presentation.common.addFragment
|
import es.verdnatura.presentation.common.addFragment
|
||||||
import es.verdnatura.presentation.view.commom.webview.WebFragment
|
import es.verdnatura.presentation.view.commom.WebFragment
|
||||||
import es.verdnatura.presentation.view.component.CustomDialogMainActivity
|
import es.verdnatura.presentation.view.component.CustomDialogMainActivity
|
||||||
import es.verdnatura.presentation.view.feature.ajustes.fragment.AjustesFragment
|
import es.verdnatura.presentation.view.feature.ajustes.fragment.AjustesFragment
|
||||||
import es.verdnatura.presentation.view.feature.articulo.fragment.ItemCardFragment
|
import es.verdnatura.presentation.view.feature.articulo.fragment.ItemCardFragment
|
||||||
|
@ -56,7 +58,7 @@ import es.verdnatura.presentation.view.feature.articulo.fragment.ItemProposalFra
|
||||||
import es.verdnatura.presentation.view.feature.boxPicking.BoxPickingFragment
|
import es.verdnatura.presentation.view.feature.boxPicking.BoxPickingFragment
|
||||||
import es.verdnatura.presentation.view.feature.buffer.fragment.BufferFragment
|
import es.verdnatura.presentation.view.feature.buffer.fragment.BufferFragment
|
||||||
import es.verdnatura.presentation.view.feature.buffer.fragment.BufferLoadFragment
|
import es.verdnatura.presentation.view.feature.buffer.fragment.BufferLoadFragment
|
||||||
import es.verdnatura.presentation.view.feature.buscaritem.fragment.BuscarItemFragmentCompose
|
import es.verdnatura.presentation.view.feature.buscaritem.fragment.BuscarItemFragment
|
||||||
import es.verdnatura.presentation.view.feature.category.ChangeCategoryFragment
|
import es.verdnatura.presentation.view.feature.category.ChangeCategoryFragment
|
||||||
import es.verdnatura.presentation.view.feature.claim.fragment.reubication.fragment.ReubicationCollectionFragment
|
import es.verdnatura.presentation.view.feature.claim.fragment.reubication.fragment.ReubicationCollectionFragment
|
||||||
import es.verdnatura.presentation.view.feature.claim.fragment.reubication.fragment.ReubicationFragment
|
import es.verdnatura.presentation.view.feature.claim.fragment.reubication.fragment.ReubicationFragment
|
||||||
|
@ -66,10 +68,10 @@ import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFra
|
||||||
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentChecker
|
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentChecker
|
||||||
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentCheckerPreviousNew
|
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentCheckerPreviousNew
|
||||||
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentPicker
|
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentPicker
|
||||||
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentPickerPreviousNewInterface
|
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentPickerPreviousNew
|
||||||
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentPickerPreviousNewInterfaceSacador
|
|
||||||
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentPreChecker
|
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentPreChecker
|
||||||
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionShowTicketFragment
|
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionShowTicketFragment
|
||||||
|
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoFragment
|
||||||
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoUsuarioFragment
|
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoUsuarioFragment
|
||||||
import es.verdnatura.presentation.view.feature.delivery.fragments.InfoFragment
|
import es.verdnatura.presentation.view.feature.delivery.fragments.InfoFragment
|
||||||
import es.verdnatura.presentation.view.feature.delivery.fragments.LoadUnloadFragment
|
import es.verdnatura.presentation.view.feature.delivery.fragments.LoadUnloadFragment
|
||||||
|
@ -79,10 +81,12 @@ import es.verdnatura.presentation.view.feature.delivery.fragments.SalaryCompleme
|
||||||
import es.verdnatura.presentation.view.feature.delivery.fragments.SummaryFragment
|
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.fragments.TicketsFragment
|
||||||
import es.verdnatura.presentation.view.feature.delivery.model.ClientTicketSalix
|
import es.verdnatura.presentation.view.feature.delivery.model.ClientTicketSalix
|
||||||
import es.verdnatura.presentation.view.feature.diadeventa.fragment.DayOfSaleFragmentCompose
|
import es.verdnatura.presentation.view.feature.diadeventa.fragment.DayOfSaleFragment
|
||||||
import es.verdnatura.presentation.view.feature.historicoarticulo.fragment.HistoricoArticuloFragment
|
import es.verdnatura.presentation.view.feature.historicoarticulo.fragment.HistoricoArticuloFragment
|
||||||
|
import es.verdnatura.presentation.view.feature.historicoshelving.fragment.ItemShelvingLogFragment
|
||||||
import es.verdnatura.presentation.view.feature.historicoshelvinglog.fragment.ShelvingLogFragment
|
import es.verdnatura.presentation.view.feature.historicoshelvinglog.fragment.ShelvingLogFragment
|
||||||
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.LogType
|
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.LogType
|
||||||
|
import es.verdnatura.presentation.view.feature.historicovehiculo.fragment.HistoricoVehiculoFragment
|
||||||
import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryFragment
|
import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryFragment
|
||||||
import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryParkingFragment
|
import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryParkingFragment
|
||||||
import es.verdnatura.presentation.view.feature.login.fragment.LoginViewModel
|
import es.verdnatura.presentation.view.feature.login.fragment.LoginViewModel
|
||||||
|
@ -99,7 +103,7 @@ import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionPa
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionPalletFragment
|
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionPalletFragment
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionPreparedStateFragment
|
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionPreparedStateFragment
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionScanFragment
|
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionScanFragment
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionScanSorterFragmentCompose
|
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionScanSorterFragment
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionStateFragment
|
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionStateFragment
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionTruckListFragment
|
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionTruckListFragment
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.PalletScanFragment
|
import es.verdnatura.presentation.view.feature.paletizador.fragment.PalletScanFragment
|
||||||
|
@ -131,9 +135,9 @@ import es.verdnatura.presentation.view.feature.sacador.model.CollectionTicket
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||||
import es.verdnatura.presentation.view.feature.ticket.fragment.TicketAdvanceFragment
|
import es.verdnatura.presentation.view.feature.ticket.fragment.TicketAdvanceFragment
|
||||||
import es.verdnatura.presentation.view.feature.ubicador.fragment.AutomaticAddItemFragment
|
import es.verdnatura.presentation.view.feature.ubicador.fragment.AutomaticAddItemFragment
|
||||||
import es.verdnatura.presentation.view.feature.ubicador.fragment.UbicadorFragment
|
import es.verdnatura.presentation.view.feature.ubicador.fragment.UbicadorFragment6869
|
||||||
import es.verdnatura.presentation.view.feature.workermistake.fragment.PackingMistakeFragment
|
import es.verdnatura.presentation.view.feature.workermistake.fragment.PackingMistakeFragment
|
||||||
import es.verdnatura.presentation.view.feature.workermistake.fragment.WorkermistakeFragmentCompose
|
import es.verdnatura.presentation.view.feature.workermistake.fragment.WorkermistakeFragment
|
||||||
import kotlinx.coroutines.DelicateCoroutinesApi
|
import kotlinx.coroutines.DelicateCoroutinesApi
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.GlobalScope
|
import kotlinx.coroutines.GlobalScope
|
||||||
|
@ -172,6 +176,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
try {
|
try {
|
||||||
|
@ -200,8 +205,9 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
return super.onCreateView(name, context, attrs)
|
return super.onCreateView(name, context, attrs)
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(DelicateCoroutinesApi::class)
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
override fun init() {
|
override fun init() {
|
||||||
|
|
||||||
mperror = MediaPlayer.create((this), R.raw.error)
|
mperror = MediaPlayer.create((this), R.raw.error)
|
||||||
mpok = MediaPlayer.create((this), R.raw.ok)
|
mpok = MediaPlayer.create((this), R.raw.ok)
|
||||||
mpErrorRepeat = MediaPlayer.create((this), R.raw.errorrepeat)
|
mpErrorRepeat = MediaPlayer.create((this), R.raw.errorrepeat)
|
||||||
|
@ -241,10 +247,11 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
networkUtils = NetworkUtilsApp(this, application as MobileApplication)
|
networkUtils = NetworkUtilsApp(this, application as MobileApplication)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
private fun startRepeatingTask(myInterval: Long) {
|
private fun startRepeatingTask(myInterval: Long) {
|
||||||
|
|
||||||
scheduledExecutor = Executors.newSingleThreadScheduledExecutor()
|
scheduledExecutor = Executors.newSingleThreadScheduledExecutor()
|
||||||
scheduledFuture = scheduledExecutor?.scheduleWithFixedDelay(
|
scheduledFuture = scheduledExecutor?.scheduleAtFixedRate(
|
||||||
{
|
{
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
checkTokenRenew()
|
checkTokenRenew()
|
||||||
|
@ -253,11 +260,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
scheduledExecutor?.shutdown()
|
scheduledExecutor?.shutdown()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
private fun setFragments() {
|
private fun setFragments() {
|
||||||
try {
|
try {
|
||||||
val uriImage = intent.data
|
val uriImage = intent.data
|
||||||
|
@ -405,7 +414,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
|
|
||||||
getString(R.string.titleCorridors) -> {
|
getString(R.string.titleCorridors) -> {
|
||||||
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||||
deleteFragments()
|
delete_Fragments()
|
||||||
addFragment(
|
addFragment(
|
||||||
PasilleroFragment.newInstance(getString(R.string.main), true),
|
PasilleroFragment.newInstance(getString(R.string.main), true),
|
||||||
R.id.main_frame_layout,
|
R.id.main_frame_layout,
|
||||||
|
@ -417,7 +426,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
|
|
||||||
getString(R.string.verticket) -> {
|
getString(R.string.verticket) -> {
|
||||||
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||||
deleteFragments()
|
delete_Fragments()
|
||||||
addFragment(
|
addFragment(
|
||||||
ShowTicketFragment.newInstance(getString(R.string.main)),
|
ShowTicketFragment.newInstance(getString(R.string.main)),
|
||||||
R.id.main_frame_layout,
|
R.id.main_frame_layout,
|
||||||
|
@ -429,7 +438,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
|
|
||||||
getString(R.string.Parking) -> {
|
getString(R.string.Parking) -> {
|
||||||
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||||
deleteFragments()
|
delete_Fragments()
|
||||||
addFragment(
|
addFragment(
|
||||||
ParkingFragment.newInstance(getString(R.string.main)),
|
ParkingFragment.newInstance(getString(R.string.main)),
|
||||||
R.id.main_frame_layout,
|
R.id.main_frame_layout,
|
||||||
|
@ -441,7 +450,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
|
|
||||||
getString(R.string.Ajustes) -> {
|
getString(R.string.Ajustes) -> {
|
||||||
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||||
deleteFragments()
|
delete_Fragments()
|
||||||
addFragment(
|
addFragment(
|
||||||
AjustesFragment.newInstance(),
|
AjustesFragment.newInstance(),
|
||||||
R.id.main_frame_layout,
|
R.id.main_frame_layout,
|
||||||
|
@ -460,7 +469,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
|
|
||||||
getString(R.string.titleCorridors) -> {
|
getString(R.string.titleCorridors) -> {
|
||||||
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||||
deleteFragments()
|
delete_Fragments()
|
||||||
addFragment(
|
addFragment(
|
||||||
PasilleroFragment.newInstance(getString(R.string.main), true),
|
PasilleroFragment.newInstance(getString(R.string.main), true),
|
||||||
R.id.main_frame_layout,
|
R.id.main_frame_layout,
|
||||||
|
@ -476,7 +485,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun deleteFragments() {
|
fun delete_Fragments() {
|
||||||
fm.fragments.forEach {
|
fm.fragments.forEach {
|
||||||
val fragment: Fragment? = supportFragmentManager.findFragmentByTag(it.tag.toString())
|
val fragment: Fragment? = supportFragmentManager.findFragmentByTag(it.tag.toString())
|
||||||
if (fragment != null) supportFragmentManager.beginTransaction().remove(fragment)
|
if (fragment != null) supportFragmentManager.beginTransaction().remove(fragment)
|
||||||
|
@ -484,10 +493,12 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
override fun onPasillerosItemClickListener(
|
override fun onPasillerosItemClickListener(
|
||||||
item: PasillerosItemVO, entryPoint: String, param: Any?
|
item: PasillerosItemVO, entryPoint: String, param: Any?
|
||||||
) {
|
) {
|
||||||
when (val itemTitle = getString(item.title!!)) {
|
val itemTitle = getString(item.title!!)
|
||||||
|
when (itemTitle) {
|
||||||
|
|
||||||
//BUFFERS
|
//BUFFERS
|
||||||
getString(R.string.titlePalletizar) -> {
|
getString(R.string.titlePalletizar) -> {
|
||||||
|
@ -575,8 +586,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(R.string.titleScanExpedition) -> {
|
getString(R.string.titleScanExpedition) -> {
|
||||||
//addFragmentOnTop(ExpeditionScanSorterFragment.newInstance(itemTitle))
|
addFragmentOnTop(ExpeditionScanSorterFragment.newInstance(itemTitle))
|
||||||
addFragmentOnTop(ExpeditionScanSorterFragmentCompose.newInstance(itemTitle))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(R.string.titleBufferManegement) -> {
|
getString(R.string.titleBufferManegement) -> {
|
||||||
|
@ -605,15 +615,21 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* getString(R.string.titlePrePicker) -> {
|
||||||
|
addFragmentOnTop(PreSacadorFragment.newInstance())
|
||||||
|
}*/
|
||||||
getString(R.string.titleDayOfSale) -> {
|
getString(R.string.titleDayOfSale) -> {
|
||||||
//addFragmentOnTop(DayOfSaleFragment(itemTitle))
|
addFragmentOnTop(DayOfSaleFragment(itemTitle))
|
||||||
addFragmentOnTop(DayOfSaleFragmentCompose(itemTitle))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(R.string.titleShowTicket) -> {
|
getString(R.string.titleShowTicket) -> {
|
||||||
addFragmentOnTop(ShowTicketFragment.newInstance(getString(R.string.titleCorridors)))
|
addFragmentOnTop(ShowTicketFragment.newInstance(getString(R.string.titleCorridors)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getString(R.string.titleHistoricalVehicle) -> {
|
||||||
|
addFragmentOnTop(ControlVehiculoFragment.newInstance(HistoricoVehiculoFragment.TAG))
|
||||||
|
}
|
||||||
|
|
||||||
getString(R.string.titleItemConsult) -> {
|
getString(R.string.titleItemConsult) -> {
|
||||||
addFragmentOnTop(ItemCardFragment.newInstance(entryPoint))
|
addFragmentOnTop(ItemCardFragment.newInstance(entryPoint))
|
||||||
}
|
}
|
||||||
|
@ -622,15 +638,19 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
addFragmentOnTop(ItemProposalFragment.newInstance(entryPoint.toInt()))
|
addFragmentOnTop(ItemProposalFragment.newInstance(entryPoint.toInt()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//segio: esta opción no se muestra, solo es accesible para añadir fragmentos de otras partes.
|
||||||
|
getString(R.string.titleHistoricalHide) -> {
|
||||||
|
addFragmentOnTop(HistoricoVehiculoFragment.newInstance(entryPoint))
|
||||||
|
}
|
||||||
|
|
||||||
getString(R.string.Parking) -> {
|
getString(R.string.Parking) -> {
|
||||||
addFragmentOnTop(ParkingFragment.newInstance(""))
|
addFragmentOnTop(ParkingFragment.newInstance(""))
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(R.string.titleItemSearch) -> {
|
getString(R.string.titleItemSearch) -> {
|
||||||
|
|
||||||
//JETPACKCOMPOSE
|
|
||||||
addFragmentOnTop(
|
addFragmentOnTop(
|
||||||
BuscarItemFragmentCompose.newInstance(
|
BuscarItemFragment.newInstance(
|
||||||
if (entryPoint == "") {
|
if (entryPoint == "") {
|
||||||
null
|
null
|
||||||
} else {
|
} else {
|
||||||
|
@ -638,16 +658,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
/* addFragmentOnTop(
|
|
||||||
BuscarItemFragment.newInstance(
|
|
||||||
if (entryPoint == "") {
|
|
||||||
null
|
|
||||||
} else {
|
|
||||||
entryPoint.toInt()
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(R.string.titleHistorical) -> {
|
getString(R.string.titleHistorical) -> {
|
||||||
|
@ -663,9 +673,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(R.string.titleUbicator) -> {
|
getString(R.string.titleUbicator) -> {
|
||||||
|
//addFragmentOnTop(UbicadorFragmentNew.newInstance(entryPoint))
|
||||||
addFragmentOnTop(UbicadorFragment.newInstance(entryPoint))
|
addFragmentOnTop(UbicadorFragment6869.newInstance(entryPoint))
|
||||||
}
|
}
|
||||||
|
//Tarea 6869
|
||||||
|
/* getString(R.string.ubicatorNew) -> {
|
||||||
|
addFragmentOnTop(UbicadorFragment6869.newInstance(entryPoint))
|
||||||
|
}*/
|
||||||
|
|
||||||
//Tarea 7855
|
//Tarea 7855
|
||||||
getString(R.string.scanPreparedExpedition) -> {
|
getString(R.string.scanPreparedExpedition) -> {
|
||||||
|
@ -703,8 +717,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
|
|
||||||
getString(R.string.titleWebViewer) -> {
|
getString(R.string.titleWebViewer) -> {
|
||||||
// el entryPoint de WebFragment se le pasa un JSON del tipo {"entryPoint":"itemScanned","web":"www.google.com}
|
// el entryPoint de WebFragment se le pasa un JSON del tipo {"entryPoint":"itemScanned","web":"www.google.com}
|
||||||
//JETPACKCOMPOSE
|
|
||||||
//addFragmentOnTop(WebFragmentCompose.newInstance(entryPoint))
|
|
||||||
addFragmentOnTop(WebFragment.newInstance(entryPoint))
|
addFragmentOnTop(WebFragment.newInstance(entryPoint))
|
||||||
}
|
}
|
||||||
//Menu qr
|
//Menu qr
|
||||||
|
@ -745,6 +757,9 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
addFragmentOnTop(CollectionFragmentCheckerPreviousNew.newInstance())
|
addFragmentOnTop(CollectionFragmentCheckerPreviousNew.newInstance())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getString(R.string.titleShelvingHistorical) -> {
|
||||||
|
addFragmentOnTop(ItemShelvingLogFragment.newInstance(itemTitle))
|
||||||
|
}
|
||||||
//Tarea 7920
|
//Tarea 7920
|
||||||
getString(R.string.titleShelvingHistNew) -> {
|
getString(R.string.titleShelvingHistNew) -> {
|
||||||
addFragmentOnTop(ShelvingLogFragment.newInstance(itemTitle, LogType.ITEMSHELVING))
|
addFragmentOnTop(ShelvingLogFragment.newInstance(itemTitle, LogType.ITEMSHELVING))
|
||||||
|
@ -759,8 +774,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(R.string.titleWorkerMistake) -> {
|
getString(R.string.titleWorkerMistake) -> {
|
||||||
//addFragmentOnTop(WorkermistakeFragment.newInstance(itemTitle))
|
addFragmentOnTop(WorkermistakeFragment.newInstance(itemTitle))
|
||||||
addFragmentOnTop(WorkermistakeFragmentCompose.newInstance(itemTitle))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(R.string.deleteExpedition) -> {
|
getString(R.string.deleteExpedition) -> {
|
||||||
|
@ -771,11 +785,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
addFragmentOnTop(PackingMistakeFragment.newInstance(itemTitle))
|
addFragmentOnTop(PackingMistakeFragment.newInstance(itemTitle))
|
||||||
}
|
}
|
||||||
|
|
||||||
/* getString(R.string.titlePrePickerTest) -> {
|
getString(R.string.titlePrePickerTest) -> {
|
||||||
addFragmentOnTop(SacadorFragmentNew.newInstance("PREITEMPICKERTEST"))
|
|
||||||
}*/
|
|
||||||
|
|
||||||
getString(R.string.preSacadorInterfaz) -> {
|
|
||||||
addFragmentOnTop(SacadorFragmentNew.newInstance("PREITEMPICKERTEST"))
|
addFragmentOnTop(SacadorFragmentNew.newInstance("PREITEMPICKERTEST"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -820,7 +830,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(R.string.selfConsumption) -> {
|
getString(R.string.selfConsumption) -> {
|
||||||
addFragmentOnTop(UbicadorFragment.newInstance(entryPoint, true))
|
// addFragmentOnTop(UbicadorFragmentNew.newInstance(entryPoint, true))
|
||||||
|
addFragmentOnTop(UbicadorFragment6869.newInstance(entryPoint, true))
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(R.string.titlePackingHolland) -> {
|
getString(R.string.titlePackingHolland) -> {
|
||||||
|
@ -946,15 +957,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
}
|
}
|
||||||
|
|
||||||
"PREITEMPICKERTEST" -> {
|
"PREITEMPICKERTEST" -> {
|
||||||
|
|
||||||
addFragmentOnTop(
|
addFragmentOnTop(
|
||||||
CollectionFragmentPickerPreviousNewInterface.newInstance(
|
CollectionFragmentPickerPreviousNew.newInstance(
|
||||||
CollectionTicket(collectionFk = entryPoint.toInt()),
|
CollectionTicket(collectionFk = entryPoint.toInt()),
|
||||||
"PREITEMPICKERTEST",
|
"PREITEMPICKERTEST",
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1062,11 +1071,15 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
//Misma pantalla para los dos scador y prescador
|
//Misma pantalla para los dos scador y prescador
|
||||||
SACADOR -> {
|
SACADOR -> {
|
||||||
addFragmentOnTop(
|
addFragmentOnTop(
|
||||||
CollectionFragmentPickerPreviousNewInterfaceSacador.newInstance(
|
CollectionFragmentPickerPreviousNew.newInstance(
|
||||||
collection, type, hasPicking
|
collection, type, hasPicking
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
/* addFragmentOnTop(
|
||||||
|
CollectionFragmentPickerNew.newInstance(
|
||||||
|
collection, type, hasPicking
|
||||||
|
)
|
||||||
|
)*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1111,6 +1124,19 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//sergio:se llama al pulsar sobre el coche IN desde Sacador
|
||||||
|
fun onVehicleSelected(tag: String) {
|
||||||
|
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||||
|
|
||||||
|
// se pone a true en la pila para que cuando se vuelva atrás permanezca ya que se borran todos los fragmentos desde otras opciones
|
||||||
|
addFragment(
|
||||||
|
ControlVehiculoFragment.newInstance(tag),
|
||||||
|
R.id.main_frame_layout,
|
||||||
|
ControlVehiculoFragment.TAG,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
fun openSummaryFragment(route: Int, state: String) {
|
fun openSummaryFragment(route: Int, state: String) {
|
||||||
addFragmentOnTop(
|
addFragmentOnTop(
|
||||||
SummaryFragment.newInstance(
|
SummaryFragment.newInstance(
|
||||||
|
@ -1120,10 +1146,10 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
}
|
}
|
||||||
|
|
||||||
fun openFragmentPickers(delete: Boolean) {
|
fun openFragmentPickers(delete: Boolean) {
|
||||||
//deleteFragments()
|
//delete_Fragments()
|
||||||
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||||
if (delete) {
|
if (delete) {
|
||||||
deleteFragments()
|
delete_Fragments()
|
||||||
}
|
}
|
||||||
addFragment(
|
addFragment(
|
||||||
SacadorFragment.newInstance("PREPARED"),
|
SacadorFragment.newInstance("PREPARED"),
|
||||||
|
@ -1202,13 +1228,14 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
userFk = (application as MobileApplication).userId!!
|
userFk = (application as MobileApplication).userId!!
|
||||||
)
|
)
|
||||||
} catch (ex: Exception) {
|
} catch (ex: Exception) {
|
||||||
ex.message?.toast(this)
|
ex.message!!.toast(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkTokenRenew() {
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
|
fun checkTokenRenew() {
|
||||||
val renewPeriod = mobileApplication.dataStoreApp.readDataStoreKey<Long>(RENEWPERIOD)
|
val renewPeriod = mobileApplication.dataStoreApp.readDataStoreKey<Long>(RENEWPERIOD)
|
||||||
val min = minOf(mobileApplication.dataStoreApp.readDataStoreKey(TTL), renewPeriod) * 1000
|
val min = minOf(mobileApplication.dataStoreApp.readDataStoreKey(TTL), renewPeriod) * 1000
|
||||||
if (Date().time < (min + mobileApplication.dataStoreApp.readDataStoreKey<Long>(TOKENCREATED))) {
|
if (Date().time < (min + mobileApplication.dataStoreApp.readDataStoreKey<Long>(TOKENCREATED))) {
|
||||||
|
|
|
@ -18,7 +18,6 @@ import com.esafirm.imagepicker.features.registerImagePicker
|
||||||
import com.esafirm.imagepicker.model.Image
|
import com.esafirm.imagepicker.model.Image
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentPackagingObsBinding
|
import es.verdnatura.databinding.FragmentPackagingObsBinding
|
||||||
import es.verdnatura.domain.ConstAndValues.COMPANYFK
|
|
||||||
import es.verdnatura.domain.ConstAndValues.ENTRYID
|
import es.verdnatura.domain.ConstAndValues.ENTRYID
|
||||||
import es.verdnatura.domain.ConstAndValues.ENTRYNUMBERIMAGES
|
import es.verdnatura.domain.ConstAndValues.ENTRYNUMBERIMAGES
|
||||||
import es.verdnatura.domain.ConstAndValues.ENTRYOBSERVATIONORIGINAL
|
import es.verdnatura.domain.ConstAndValues.ENTRYOBSERVATIONORIGINAL
|
||||||
|
@ -61,7 +60,6 @@ class ObservFragment(
|
||||||
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
|
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
|
||||||
private var layoutManager: LinearLayoutManager? = null
|
private var layoutManager: LinearLayoutManager? = null
|
||||||
private lateinit var customDialogList: CustomDialogList
|
private lateinit var customDialogList: CustomDialogList
|
||||||
private var dmsType: Int? = null
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun newInstance(entryPoint: String) = ObservFragment(entryPoint)
|
fun newInstance(entryPoint: String) = ObservFragment(entryPoint)
|
||||||
|
@ -81,7 +79,6 @@ class ObservFragment(
|
||||||
setEvents()
|
setEvents()
|
||||||
setObservations()
|
setObservations()
|
||||||
loadImages()
|
loadImages()
|
||||||
viewModel.getTypeDMS()
|
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,8 +244,8 @@ class ObservFragment(
|
||||||
warehouseId = mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
warehouseId = mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
||||||
WAREHOUSEFK
|
WAREHOUSEFK
|
||||||
),
|
),
|
||||||
companyId = mobileApplication.dataStoreApp.readDataStoreKey<Int>(COMPANYFK),
|
companyId = 442,
|
||||||
dmsTypeId = dmsType!!,
|
dmsTypeId = 27,
|
||||||
reference = mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
reference = mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
||||||
ENTRYID
|
ENTRYID
|
||||||
).toString(),
|
).toString(),
|
||||||
|
@ -269,18 +266,6 @@ class ObservFragment(
|
||||||
openSummary()
|
openSummary()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dmsTypeId.observe(viewLifecycleOwner) {
|
|
||||||
if (it.id == 0) {
|
|
||||||
ma.messageWithSound(
|
|
||||||
message = getString(R.string.errorDMS),
|
|
||||||
isError = true,
|
|
||||||
isPlayed = true
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
dmsType = it.id
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,14 +278,13 @@ class ObservFragment(
|
||||||
val drawable = getDrawableFromImageUri(requireContext(), (item as Image).uri)
|
val drawable = getDrawableFromImageUri(requireContext(), (item as Image).uri)
|
||||||
val bitmap = drawable!!.toBitmap()
|
val bitmap = drawable!!.toBitmap()
|
||||||
|
|
||||||
|
|
||||||
viewModel.entryUploadPhotoSalix(
|
viewModel.entryUploadPhotoSalix(
|
||||||
idEntry = mobileApplication.dataStoreApp.readDataStoreKey<Int>(ENTRYID),
|
idEntry = mobileApplication.dataStoreApp.readDataStoreKey<Int>(ENTRYID),
|
||||||
warehouseId = mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
warehouseId = mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
||||||
WAREHOUSEFK
|
WAREHOUSEFK
|
||||||
),
|
),
|
||||||
companyId = mobileApplication.dataStoreApp.readDataStoreKey<Int>(COMPANYFK),
|
companyId = 442,
|
||||||
dmsTypeId = dmsType!!,
|
dmsTypeId = 27,
|
||||||
reference = mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
reference = mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
||||||
ENTRYID
|
ENTRYID
|
||||||
).toString(),
|
).toString(),
|
||||||
|
@ -310,6 +294,7 @@ class ObservFragment(
|
||||||
hasFile = false,
|
hasFile = false,
|
||||||
urlImage = saveBitmapAsTempFile(requireContext(), bitmap)
|
urlImage = saveBitmapAsTempFile(requireContext(), bitmap)
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}, object : OnImageTrashClickListener {
|
}, object : OnImageTrashClickListener {
|
||||||
|
|
|
@ -49,15 +49,8 @@ class PackagingCountFragment(
|
||||||
override fun init() {
|
override fun init() {
|
||||||
|
|
||||||
viewModel.getItemsPackaging(
|
viewModel.getItemsPackaging(
|
||||||
mobileApplication.dataStoreApp.readDataStoreKey<Int>(SUPPLIERID),
|
mobileApplication.dataStoreApp.readDataStoreKey(SUPPLIERID),
|
||||||
mobileApplication.dataStoreApp.readDataStoreKey<Int>(ENTRYID)
|
mobileApplication.dataStoreApp.readDataStoreKey(ENTRYID)
|
||||||
)
|
|
||||||
println(
|
|
||||||
"EntryId ${mobileApplication.dataStoreApp.readDataStoreKey<Int>(ENTRYID)} \n SupplierId ${
|
|
||||||
mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
|
||||||
SUPPLIERID
|
|
||||||
)
|
|
||||||
}"
|
|
||||||
)
|
)
|
||||||
customDialogInput = CustomDialogInput(requireContext())
|
customDialogInput = CustomDialogInput(requireContext())
|
||||||
customDialog = CustomDialog(requireContext())
|
customDialog = CustomDialog(requireContext())
|
||||||
|
@ -113,8 +106,8 @@ class PackagingCountFragment(
|
||||||
event.getContentIfNotHandled().notNull {
|
event.getContentIfNotHandled().notNull {
|
||||||
|
|
||||||
viewModel.getItemsPackaging(
|
viewModel.getItemsPackaging(
|
||||||
mobileApplication.dataStoreApp.readDataStoreKey<Int>(SUPPLIERID),
|
mobileApplication.dataStoreApp.readDataStoreKey(SUPPLIERID),
|
||||||
mobileApplication.dataStoreApp.readDataStoreKey<Int>(ENTRYID)
|
mobileApplication.dataStoreApp.readDataStoreKey(ENTRYID)
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,8 +48,8 @@ class PackagingSummaryFragment(
|
||||||
|
|
||||||
|
|
||||||
viewModel.getItemsPackaging(
|
viewModel.getItemsPackaging(
|
||||||
mobileApplication.dataStoreApp.readDataStoreKey<Int>(SUPPLIERID),
|
mobileApplication.dataStoreApp.readDataStoreKey(SUPPLIERID),
|
||||||
mobileApplication.dataStoreApp.readDataStoreKey<Int>(ENTRYID)
|
mobileApplication.dataStoreApp.readDataStoreKey(ENTRYID)
|
||||||
)
|
)
|
||||||
|
|
||||||
ma.hideBottomNavigation(View.GONE)
|
ma.hideBottomNavigation(View.GONE)
|
||||||
|
|
|
@ -6,7 +6,6 @@ import android.view.View
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentPackagingBinding
|
import es.verdnatura.databinding.FragmentPackagingBinding
|
||||||
import es.verdnatura.domain.ConstAndValues.COMPANYFK
|
|
||||||
import es.verdnatura.domain.ConstAndValues.ENTRYID
|
import es.verdnatura.domain.ConstAndValues.ENTRYID
|
||||||
import es.verdnatura.domain.ConstAndValues.ENTRYOBSERVATIONORIGINAL
|
import es.verdnatura.domain.ConstAndValues.ENTRYOBSERVATIONORIGINAL
|
||||||
import es.verdnatura.domain.ConstAndValues.SUPPLIERID
|
import es.verdnatura.domain.ConstAndValues.SUPPLIERID
|
||||||
|
@ -109,19 +108,11 @@ class SupplierFragment(
|
||||||
context = requireContext()
|
context = requireContext()
|
||||||
) { elementSelected ->
|
) { elementSelected ->
|
||||||
binding.filterEntry.text = elementSelected.name
|
binding.filterEntry.text = elementSelected.name
|
||||||
|
|
||||||
runBlocking {
|
runBlocking {
|
||||||
mobileApplication.dataStoreApp.editDataStoreKey(
|
mobileApplication.dataStoreApp.editDataStoreKey(
|
||||||
ENTRYID,
|
ENTRYID,
|
||||||
elementSelected.id.toInt()
|
elementSelected.id
|
||||||
)
|
)
|
||||||
mobileApplication.dataStoreApp.editDataStoreKey(
|
|
||||||
COMPANYFK,
|
|
||||||
entries.find { it.id == elementSelected.id }!!.companyFk.toInt()
|
|
||||||
)
|
|
||||||
var element = entries.find { it.id == elementSelected.id }!!.companyFk
|
|
||||||
println("companyFk $element")
|
|
||||||
|
|
||||||
mobileApplication.dataStoreApp.editDataStoreKey(
|
mobileApplication.dataStoreApp.editDataStoreKey(
|
||||||
ENTRYOBSERVATIONORIGINAL,
|
ENTRYOBSERVATIONORIGINAL,
|
||||||
entries.find { it.id == elementSelected.id }?.observation ?: ""
|
entries.find { it.id == elementSelected.id }?.observation ?: ""
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue