Merge branch 'dev' into test
This commit is contained in:
commit
56879ba3a8
|
@ -1,3 +1,4 @@
|
||||||
|
<?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,6 +34,7 @@
|
||||||
<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>
|
||||||
|
@ -285,6 +286,11 @@
|
||||||
<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>
|
||||||
|
@ -431,6 +437,11 @@
|
||||||
<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>
|
||||||
|
@ -493,12 +504,24 @@
|
||||||
</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#6845 userInterface">
|
<list default="true" id="fa688d1c-dbee-4864-9e33-4d84ef9afca8" name="Default Changelist" comment="feat: refs#6861 reservas">
|
||||||
<change afterPath="$PROJECT_DIR$/CHANGELOG.md" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/app/lint-baseline.xml" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/changeLog.sh" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/app/src/main/res/layout/sale_row_fragment_reserve.xml" 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/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/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/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/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/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" />
|
||||||
|
@ -513,7 +536,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=LocalEmulator, isTemplate=false, identifier=path=C:\Users\sergiodt\.android\avd\Pixel_7a_API_30.avd)]" />
|
<component name="ExecutionTargetManager" SELECTED_TARGET="device_and_snapshot_combo_box_target[DeviceId(pluginId=PhysicalDevice, isTemplate=false, identifier=serial=21114523025303)]" />
|
||||||
<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" />
|
||||||
|
@ -603,7 +626,7 @@
|
||||||
</option>
|
</option>
|
||||||
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
||||||
<map>
|
<map>
|
||||||
<entry key="$PROJECT_DIR$" value="dev_6078" />
|
<entry key="$PROJECT_DIR$" value="devLinphone" />
|
||||||
</map>
|
</map>
|
||||||
</option>
|
</option>
|
||||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||||
|
@ -664,60 +687,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">{
|
<component name="PropertiesComponent"><![CDATA[{
|
||||||
"keyToString": {
|
"keyToString": {
|
||||||
"Android App.app.executor": "Run",
|
"Android App.app.executor": "Run",
|
||||||
"ApkExportedModule": "Gestor_Almacén.app",
|
"ApkExportedModule": "Gestor_Almacén.app",
|
||||||
"DEBUGGABLE_DEVICE": "zebra_technologies-tc21-21114523025303",
|
"DEBUGGABLE_DEVICE": "honeywell-eda52-23086B3FFD",
|
||||||
"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": "Modules",
|
"project.structure.last.edited": "Dependencies",
|
||||||
"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": "preferences.pluginManager"
|
"settings.editor.selected.configurable": "reference.settingsdialog.project.gradle"
|
||||||
},
|
},
|
||||||
"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" />
|
||||||
|
@ -1265,7 +1288,7 @@
|
||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1709725795643</updated>
|
<updated>1709725795643</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="373" />
|
<option name="localTasksCounter" value="377" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="Vcs.Log.History.Properties">
|
<component name="Vcs.Log.History.Properties">
|
||||||
|
@ -1405,10 +1428,6 @@
|
||||||
</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" />
|
||||||
|
@ -1430,7 +1449,11 @@
|
||||||
<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" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="feat: refs#6845 userInterface" />
|
<MESSAGE value="linphoneVersion" />
|
||||||
|
<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>
|
||||||
|
@ -1443,6 +1466,14 @@
|
||||||
</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>
|
||||||
|
@ -1458,6 +1489,11 @@
|
||||||
<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>
|
||||||
|
|
|
@ -5,6 +5,7 @@ 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 {
|
||||||
|
@ -15,8 +16,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 = 374
|
versionCode = 397 //JAF 393 en informatica
|
||||||
versionName = "24.51"
|
versionName = "25.6"
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +60,14 @@ android {
|
||||||
}
|
}
|
||||||
create("general") {}
|
create("general") {}
|
||||||
}
|
}
|
||||||
|
kapt {
|
||||||
|
correctErrorTypes = true
|
||||||
|
useBuildCache = true
|
||||||
|
|
||||||
|
kotlinOptions {
|
||||||
|
languageVersion = "1.9"
|
||||||
|
}
|
||||||
|
}
|
||||||
buildFeatures {
|
buildFeatures {
|
||||||
viewBinding = true
|
viewBinding = true
|
||||||
//compose = true
|
//compose = true
|
||||||
|
@ -76,6 +84,9 @@ android {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
dataBinding = true
|
dataBinding = true
|
||||||
|
|
||||||
|
compose = true
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
|
@ -102,7 +113,9 @@ 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)
|
||||||
|
@ -133,15 +146,39 @@ 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)
|
dependencies {
|
||||||
/* implementation("androidx.compose.ui:ui")
|
|
||||||
implementation("androidx.compose.material:material")
|
val composeBom = platform("androidx.compose:compose-bom:2024.10.01")
|
||||||
implementation("androidx.compose.runtime:runtime")
|
implementation(composeBom)
|
||||||
implementation("androidx.activity:activity-compose:1.8.2")
|
androidTestImplementation(composeBom)
|
||||||
implementation("androidx.compose.ui:ui-graphics")
|
|
||||||
implementation("androidx.compose.ui:ui-tooling-preview") */
|
// Choose one of the following:
|
||||||
|
// Material Design 3
|
||||||
|
implementation(libs.androidx.material3)
|
||||||
|
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)
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
dependencies {
|
||||||
|
testImplementation(libs.junit)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,12 @@
|
||||||
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"
|
||||||
|
@ -69,6 +75,8 @@
|
||||||
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>
|
|
@ -17,7 +17,9 @@ 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
|
||||||
|
@ -261,11 +263,13 @@ class DataStoreLocal(var mobileApplication: MobileApplication) {
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun deleteEntryPackaging() {
|
suspend fun deleteEntryPackaging() {
|
||||||
mobileApplication.dataStoreApp.editDataStoreKey(ENTRYID, "")
|
mobileApplication.dataStoreApp.editDataStoreKey(ENTRYID, -1)
|
||||||
mobileApplication.dataStoreApp.editDataStoreKey(SUPPLIERID, "")
|
mobileApplication.dataStoreApp.editDataStoreKey(SUPPLIERID, -1)
|
||||||
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,6 +6,7 @@ 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
|
||||||
|
@ -46,7 +47,10 @@ 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().build()
|
).fallbackToDestructiveMigration(true)
|
||||||
|
.addTypeConverter(MapTypeConverter())
|
||||||
|
.fallbackToDestructiveMigration(true)
|
||||||
|
.build()
|
||||||
INSTANCE = instance
|
INSTANCE = instance
|
||||||
instance
|
instance
|
||||||
}
|
}
|
||||||
|
@ -135,6 +139,7 @@ interface ClientTicketDao {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ProvidedTypeConverter
|
||||||
class MapTypeConverter {
|
class MapTypeConverter {
|
||||||
private val gson = Gson()
|
private val gson = Gson()
|
||||||
|
|
||||||
|
@ -182,13 +187,24 @@ 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,6 +4,7 @@ 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 +15,7 @@ import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlV
|
||||||
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.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
|
||||||
|
@ -37,6 +36,7 @@ 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 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
|
||||||
|
@ -76,6 +76,10 @@ val viewModelModule = module {
|
||||||
BuscarItemViewModel(androidContext())
|
BuscarItemViewModel(androidContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
viewModel {
|
||||||
|
BuscarItemComposeViewModel(androidApplication())
|
||||||
|
}
|
||||||
|
|
||||||
// Pasilleros / Buscar Item 2
|
// Pasilleros / Buscar Item 2
|
||||||
|
|
||||||
viewModel {
|
viewModel {
|
||||||
|
@ -158,13 +162,6 @@ val viewModelModule = module {
|
||||||
ControlVehiculoViewModel(androidContext())
|
ControlVehiculoViewModel(androidContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModel {
|
|
||||||
HistoricoVehiculoViewModel(androidContext())
|
|
||||||
}
|
|
||||||
|
|
||||||
viewModel {
|
|
||||||
ItemShelvingLogViewModel(androidContext())
|
|
||||||
}
|
|
||||||
viewModel {
|
viewModel {
|
||||||
ShelvingLogViewModel(androidContext())
|
ShelvingLogViewModel(androidContext())
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ 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"
|
||||||
|
@ -70,6 +71,8 @@ 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
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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.LayoutInflater
|
import android.view.ViewGroup
|
||||||
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,7 +30,6 @@ 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,
|
||||||
|
@ -41,30 +40,37 @@ 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) {
|
||||||
val inflater = LayoutInflater.from(this)
|
(this as? Activity)?.window?.decorView?.let { rootView ->
|
||||||
val layout = inflater.inflate(R.layout.ticket_toast_layout, null)
|
TextView(this).apply {
|
||||||
val text = layout.findViewById<TextView>(R.id.toast_text)
|
text = textToShow
|
||||||
text.text = "$textToShow"
|
setTextColor(getColor(R.color.verdnatura_orange_salix))
|
||||||
text.setTextColor(this.getColor(R.color.verdnatura_orange_salix))
|
textSize = 22f
|
||||||
text.textSize = 18f
|
gravity = Gravity.CENTER
|
||||||
|
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
|
||||||
|
|
||||||
val background = GradientDrawable().apply {
|
(rootView as ViewGroup).addView(this)
|
||||||
setColor(Color.parseColor("#000000"))
|
|
||||||
cornerRadius = 16f
|
|
||||||
}
|
|
||||||
layout.background = background
|
|
||||||
|
|
||||||
Toast(this).apply {
|
animate().alpha(1f).setDuration(300).withEndAction {
|
||||||
duration = Toast.LENGTH_LONG
|
animate().alpha(0f).setStartDelay(1000).setDuration(300)
|
||||||
view = layout
|
.withEndAction { (rootView).removeView(this) }
|
||||||
setGravity(Gravity.CENTER, 0, 0)
|
.start()
|
||||||
show()
|
}.start()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +101,6 @@ 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,7 +6,6 @@ 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
|
||||||
|
@ -96,3 +95,24 @@ 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.ItemLocationVO
|
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemShelvings
|
||||||
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,9 +36,7 @@ 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
|
||||||
|
@ -52,6 +50,7 @@ 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
|
||||||
|
@ -70,6 +69,7 @@ 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
|
||||||
|
@ -414,6 +414,11 @@ 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
|
||||||
|
@ -434,16 +439,6 @@ 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
|
||||||
|
@ -456,7 +451,7 @@ interface SalixService {
|
||||||
|
|
||||||
@GET("ItemShelvings/getAlternative")
|
@GET("ItemShelvings/getAlternative")
|
||||||
fun itemShelvingAlternative(
|
fun itemShelvingAlternative(
|
||||||
@Query("shelvingFk") shelvingFk: String
|
@Query("shelvingCode") shelvingFk: String
|
||||||
): Call<ArrayList<Reubication>>
|
): Call<ArrayList<Reubication>>
|
||||||
|
|
||||||
@GET("MobileAppVersionControls/getVersion")
|
@GET("MobileAppVersionControls/getVersion")
|
||||||
|
@ -480,11 +475,6 @@ 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"
|
||||||
|
@ -530,18 +520,6 @@ 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,
|
||||||
|
@ -564,11 +542,6 @@ 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"
|
||||||
|
@ -637,12 +610,7 @@ 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<PickupResponse>>
|
): Call<List<TicketPickupResponse>>
|
||||||
|
|
||||||
@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(
|
||||||
|
@ -711,17 +679,6 @@ 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",
|
||||||
|
@ -960,6 +917,11 @@ 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
|
||||||
|
@ -1067,6 +1029,11 @@ 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
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
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 retrofit2.Call
|
import retrofit2.Call
|
||||||
|
|
||||||
class GetItemFromBarcodeUseCase(private val salixService: SalixService) {
|
class GetItemFromBarcodeUseCase(private val salixService: SalixService) {
|
||||||
|
@ -18,3 +19,9 @@ 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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ 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
|
||||||
|
@ -170,7 +171,8 @@ fun database(myContext: Context): DeliveryDatabase {
|
||||||
return Room.databaseBuilder(
|
return Room.databaseBuilder(
|
||||||
myContext,
|
myContext,
|
||||||
DeliveryDatabase::class.java, "expediciones.db"
|
DeliveryDatabase::class.java, "expediciones.db"
|
||||||
).build()
|
).addTypeConverter(MapTypeConverter())
|
||||||
|
.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ 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
|
||||||
|
@ -18,23 +17,3 @@ 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."}"
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
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
|
||||||
|
|
||||||
|
}
|
|
@ -43,7 +43,10 @@ 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(
|
||||||
|
@ -98,14 +101,8 @@ data class ExpeditionPrintOut(
|
||||||
val isChecked: Boolean
|
val isChecked: Boolean
|
||||||
)
|
)
|
||||||
|
|
||||||
data class PickupResponse(
|
data class TicketPickupResponse(
|
||||||
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,7 +6,6 @@ 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
|
||||||
|
@ -140,10 +139,6 @@ 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)
|
||||||
}
|
}
|
||||||
|
@ -160,6 +155,10 @@ 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,7 +12,6 @@ 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
|
||||||
|
@ -169,7 +168,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(InputType.TYPE_CLASS_NUMBER, 0)
|
imm!!.toggleSoftInput(InputMethodManager.SHOW_FORCED, 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,9 +38,11 @@ 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 = SimpleDateFormat(context.getString(R.string.dateCompleteFormat), Locale.getDefault())
|
val df =
|
||||||
|
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)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,220 @@
|
||||||
|
package es.verdnatura.presentation.composable
|
||||||
|
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.border
|
||||||
|
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.HorizontalDivider
|
||||||
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.IconButton
|
||||||
|
import androidx.compose.material3.Switch
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.material3.TextField
|
||||||
|
import androidx.compose.material3.TextFieldDefaults
|
||||||
|
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.focus.onFocusEvent
|
||||||
|
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
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun CustomToolbar(
|
||||||
|
title: String,
|
||||||
|
subtitle: String? = null,
|
||||||
|
showBackButton: Boolean = true,
|
||||||
|
showSwitch: Boolean = false,
|
||||||
|
iconList: List<Int> = emptyList(),
|
||||||
|
onBackClick: () -> Unit = {},
|
||||||
|
onSwitchChange: (Boolean) -> Unit = {}
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.background(Color.Black)
|
||||||
|
) {
|
||||||
|
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.height(56.dp),
|
||||||
|
verticalAlignment = CenterVertically,
|
||||||
|
|
||||||
|
) {
|
||||||
|
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(
|
||||||
|
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 {
|
||||||
|
items(iconList) { iconRes ->
|
||||||
|
IconButton(onClick = { /* Acción del icono */ }) {
|
||||||
|
Icon(
|
||||||
|
painter = painterResource(id = iconRes),
|
||||||
|
contentDescription = "Icon",
|
||||||
|
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)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@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 = {
|
||||||
|
Text(
|
||||||
|
text = stringResource(id = R.string.Escaneaetiqueta),
|
||||||
|
textAlign = TextAlign.Center,
|
||||||
|
color = Color.White,
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
)
|
||||||
|
},
|
||||||
|
singleLine = true,
|
||||||
|
keyboardActions = KeyboardActions(
|
||||||
|
onDone = {
|
||||||
|
onImeAction()
|
||||||
|
}
|
||||||
|
|
||||||
|
),
|
||||||
|
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(54.dp)
|
||||||
|
.padding(bottom = 4.dp)
|
||||||
|
.onFocusEvent {
|
||||||
|
if (it.isFocused) {
|
||||||
|
keyboardController?.hide()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Preview
|
||||||
|
@Composable
|
||||||
|
fun PreviewToolbar() {
|
||||||
|
CustomToolbar(
|
||||||
|
title = "Mi Toolbar",
|
||||||
|
subtitle = "10/20",
|
||||||
|
showBackButton = true,
|
||||||
|
showSwitch = true,
|
||||||
|
iconList = listOf(R.drawable.ic_launcher_foreground, R.drawable.ic_launcher_foreground),
|
||||||
|
onBackClick = { /* Acción de volver atrás */ },
|
||||||
|
onSwitchChange = { /* Acción del switch */ }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Preview
|
||||||
|
@Composable
|
||||||
|
fun PreviewScanLineTextSearch() {
|
||||||
|
ScanLineTextSearch(
|
||||||
|
value = "Escanea etiqueta",
|
||||||
|
onValueChange = {},
|
||||||
|
onImeAction = {})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
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() })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
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,14 +1,11 @@
|
||||||
package es.verdnatura.presentation.view.commom
|
package es.verdnatura.presentation.view.commom.webview
|
||||||
|
|
||||||
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
|
||||||
|
@ -18,12 +15,13 @@ 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
|
||||||
|
@ -32,15 +30,14 @@ 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)
|
||||||
|
@ -50,12 +47,11 @@ 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
|
||||||
|
@ -63,7 +59,6 @@ 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,
|
||||||
|
@ -76,132 +71,104 @@ class WebFragment(
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
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()
|
init()
|
||||||
super.onViewCreated(view, savedInstanceState)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("ClickableViewAccessibility", "SetJavaScriptEnabled")
|
@SuppressLint("ClickableViewAccessibility", "javaScriptEnabled")
|
||||||
private fun setWeb() {
|
private fun setWeb() {
|
||||||
|
binding.webView.apply {
|
||||||
|
webChromeClient = WebChromeClient()
|
||||||
|
|
||||||
binding.webView.webChromeClient = WebChromeClient(
|
settings.apply {
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
val webSettings = binding.webView.settings
|
MotionEvent.ACTION_MOVE -> {
|
||||||
webSettings.javaScriptEnabled = true
|
velocityTracker?.addMovement(event)
|
||||||
webSettings.domStorageEnabled = true
|
}
|
||||||
webSettings.loadWithOverviewMode = true
|
|
||||||
webSettings.useWideViewPort = true
|
|
||||||
webSettings.builtInZoomControls = true
|
|
||||||
webSettings.displayZoomControls = false
|
|
||||||
webSettings.setSupportZoom(true)
|
|
||||||
webSettings.allowFileAccess = true
|
|
||||||
|
|
||||||
binding.webView.setOnTouchListener { v, event ->
|
MotionEvent.ACTION_UP -> {
|
||||||
gestureDetector.onTouchEvent(event)
|
velocityTracker?.let { tracker ->
|
||||||
}
|
tracker.computeCurrentVelocity(1000) // velocidad en píxeles por segundo
|
||||||
binding.webView.webViewClient = object : WebViewClient() {
|
val velocityX = tracker.xVelocity
|
||||||
override fun shouldOverrideUrlLoading(
|
val velocityY = abs(tracker.yVelocity)
|
||||||
view: WebView?, request: WebResourceRequest?
|
|
||||||
): Boolean {
|
if (velocityX > FLINGTHRESHOLDVELOCITY &&
|
||||||
binding.webView.loadUrl(request?.url.toString())
|
velocityY < FLINGTHRESHOLDVERTICAL
|
||||||
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,180 @@
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
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)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
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()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun plusTextButton(view: View) {
|
private fun plusTextButton(view: View) {
|
||||||
|
|
||||||
var sum = 0
|
|
||||||
try {
|
try {
|
||||||
sum = getValue().toInt() + Integer.parseInt(view.tag.toString())
|
val 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,6 +69,12 @@ 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
|
||||||
|
@ -148,4 +154,9 @@ 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,12 +1,15 @@
|
||||||
package es.verdnatura.presentation.view.feature.ajustes.fragment
|
package es.verdnatura.presentation.view.feature.ajustes.fragment
|
||||||
|
|
||||||
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
|
||||||
|
@ -42,6 +45,7 @@ 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
|
||||||
|
@ -128,13 +132,24 @@ class AjustesFragment :
|
||||||
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) {
|
||||||
|
@ -165,8 +180,53 @@ 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.putExtra("server", "pbx.verdnatura.es")
|
||||||
|
intent.putExtra("username", "1007")
|
||||||
|
intent.putExtra("password", "delatorre.1234")
|
||||||
|
intent.putExtra("phoneNumber", "sip:651353889@pbx.verdnatura.es")
|
||||||
|
requireContext().sendBroadcast(intent)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -6,26 +6,21 @@ 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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ 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
|
||||||
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
|
||||||
|
@ -272,7 +273,9 @@ class ItemCardFragment(
|
||||||
}
|
}
|
||||||
binding.itemcardImage.setOnClickListener {
|
binding.itemcardImage.setOnClickListener {
|
||||||
|
|
||||||
val i = Intent(activity, ImageViewActivity::class.java)
|
//JETPACKCOMPOSE
|
||||||
|
// 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)
|
||||||
|
|
|
@ -2,41 +2,52 @@ 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.ItemLocationVO
|
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemShelvings
|
||||||
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<ItemLocationVO>,
|
private val items: List<ItemShelvings>,
|
||||||
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(PasillerosItemVO(title =
|
onPasillerosItemClickListener.onPasillerosItemClickListener(
|
||||||
R.string.titleUbicator),items[position].Matricula)
|
PasillerosItemVO(
|
||||||
|
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) {
|
||||||
//private val res = binding.root.context.resources
|
fun bind(item: ItemShelvings) {
|
||||||
fun bind(item: ItemLocationVO) {
|
|
||||||
binding.apply {
|
binding.apply {
|
||||||
this.item = item
|
this.item = item
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
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()
|
||||||
|
)
|
||||||
|
|
||||||
|
class BuscarItemComposeViewModel(var application: android.app.Application) :
|
||||||
|
BaseViewModelCompose(application) {
|
||||||
|
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
|
||||||
|
|
||||||
|
private val _uiState = MutableStateFlow(UiState())
|
||||||
|
val uiState = _uiState.asStateFlow()
|
||||||
|
|
||||||
|
/* private val _itemFk = MutableStateFlow<String?>(null)
|
||||||
|
val itemFk = _itemFk.asStateFlow()*/
|
||||||
|
|
||||||
|
/* private val _itemShelvingsList = MutableStateFlow<ItemShelvingsList?>(null)
|
||||||
|
val itemShelvingsList = _itemShelvingsList.asStateFlow()*/
|
||||||
|
|
||||||
|
/*val loadItemShelvingsList = _itemShelvingsList.map {
|
||||||
|
it?.let { Event(it) }
|
||||||
|
}.stateIn(
|
||||||
|
scope = viewModelScope,
|
||||||
|
started = SharingStarted.WhileSubscribed(5000),
|
||||||
|
initialValue = null
|
||||||
|
)*/
|
||||||
|
|
||||||
|
fun getIdFromCodeSalix(code: String) {
|
||||||
|
_uiState.update { it.copy(itemFk = code) }
|
||||||
|
//_itemFk.value = code
|
||||||
|
getItemFromBarcodeUseCase.execute(code)
|
||||||
|
.enqueue(object : SalixCallback<Int?>(application.applicationContext) {
|
||||||
|
override fun onSuccess(response: Response<Int?>) {
|
||||||
|
response.body()?.let { id ->
|
||||||
|
itemshelvingsGet(id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
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 ->
|
||||||
|
//_itemShelvingsList.value = ItemShelvingsList(list)
|
||||||
|
_uiState.update { it.copy(items = list) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,6 +10,7 @@ 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
|
||||||
|
@ -30,10 +31,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.getubicaition)
|
binding.mainToolbar.toolbarTitle.text = getString(R.string.getubication)
|
||||||
setEvents()
|
setEvents()
|
||||||
if (itemFk != null) {
|
if (itemFk != null) {
|
||||||
getLocations(itemFk!!)
|
viewModel.getIdFromCodeSalix(itemFk!!.toString())
|
||||||
}
|
}
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
@ -66,17 +67,22 @@ class BuscarItemFragment(
|
||||||
|
|
||||||
private fun getLocations(itemFk: Any) {
|
private fun getLocations(itemFk: Any) {
|
||||||
this.itemFk = itemFk
|
this.itemFk = itemFk
|
||||||
viewModel.itemshelvingGetInfo(itemFk)
|
viewModel.getIdFromCodeSalix(itemFk.toString())
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
||||||
adapter = LocationAdapter(itemResponse.list, pasillerosItemClickListener!!)
|
val sortedList = itemResponse.list.sortedWith(
|
||||||
|
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(
|
||||||
|
|
|
@ -0,0 +1,118 @@
|
||||||
|
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.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.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 {
|
||||||
|
SetView()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun SetView() {
|
||||||
|
val uiState by viewModel.uiState.collectAsStateWithLifecycle()
|
||||||
|
|
||||||
|
LocationScreen(
|
||||||
|
items = uiState.items.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
|
||||||
|
)
|
||||||
|
},
|
||||||
|
onTextChange = { input ->
|
||||||
|
viewModel.getIdFromCodeSalix(input)
|
||||||
|
},
|
||||||
|
titleToolBar = if (uiState.items.isNotEmpty()) {
|
||||||
|
getString(
|
||||||
|
R.string.itemsTotal,
|
||||||
|
uiState.itemFk,
|
||||||
|
getString(R.string.visibleTotal),
|
||||||
|
uiState.items.sumOf { it.visible }
|
||||||
|
)
|
||||||
|
} else getString(R.string.getubication),
|
||||||
|
onBackClick = { (context as MainActivity).onMyBackPressed() },
|
||||||
|
onLongClick = { item -> item.sector.toast(requireContext()) },
|
||||||
|
onClick = { item ->
|
||||||
|
pasillerosItemClickListener?.onPasillerosItemClickListener(
|
||||||
|
PasillerosItemVO(title = R.string.titleUbicator),
|
||||||
|
item.matricula
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
class BuscarItemViewModelFactory(private val context: Application) : ViewModelProvider.Factory {
|
||||||
|
override fun <T : ViewModel> create(modelClass: Class<T>): T {
|
||||||
|
if (modelClass.isAssignableFrom(BuscarItemComposeViewModel::class.java)) {
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
return BuscarItemComposeViewModel(context) as T
|
||||||
|
}
|
||||||
|
throw IllegalArgumentException("Unknown ViewModel class")
|
||||||
|
}
|
||||||
|
}*/
|
|
@ -5,24 +5,44 @@ 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.formatWithQuotes
|
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
||||||
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.ItemLocationVO
|
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemShelvings
|
||||||
import es.verdnatura.presentation.view.feature.buscaritem.model.LocationListVO
|
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemShelvingsList
|
||||||
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) }
|
|
||||||
|
|
||||||
fun itemshelvingGetInfo(itemFk: Any) {
|
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
|
||||||
salix.itemshelvingGetInfo(params = arrayListOf(itemFk).formatWithQuotes())
|
|
||||||
.enqueue(object : SalixCallback<List<ItemLocationVO>>(context) {
|
private val _itemShelvingsList by lazy { MutableLiveData<ItemShelvingsList>() }
|
||||||
override fun onSuccess(response: Response<List<ItemLocationVO>>) {
|
val itemShelvingsList: LiveData<ItemShelvingsList> = _itemShelvingsList
|
||||||
_locationList.value = response.body()?.let { LocationListVO(it) }
|
val loadItemShelvingsList: LiveData<Event<ItemShelvingsList>> =
|
||||||
|
_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 { ItemShelvingsList(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -0,0 +1,207 @@
|
||||||
|
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.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.LocalSoftwareKeyboardController
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
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
|
||||||
|
import es.verdnatura.presentation.composable.CustomToolbar
|
||||||
|
import es.verdnatura.presentation.composable.ScanLineTextSearch
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun LocationScreen(
|
||||||
|
//viewModel: BuscarItemComposeViewModel = 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.Fecha
|
||||||
|
).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(
|
||||||
|
// viewModel = null,
|
||||||
|
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 = {})
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package es.verdnatura.presentation.view.feature.buscaritem.fragment
|
||||||
|
|
||||||
|
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))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,21 +2,27 @@ package es.verdnatura.presentation.view.feature.buscaritem.model
|
||||||
|
|
||||||
import es.verdnatura.domain.isoToString
|
import es.verdnatura.domain.isoToString
|
||||||
|
|
||||||
class ItemLocationVO(
|
class ItemShelvingsList(
|
||||||
var Parking: String = "",
|
var list: List<ItemShelvings> = listOf()
|
||||||
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()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class LocationListVO(
|
data class Shelving(
|
||||||
var list: List<ItemLocationVO> = listOf()
|
val code: String, val priority: Int, val parking: Parking
|
||||||
|
)
|
||||||
|
|
||||||
|
data class Parking(
|
||||||
|
val code: String, val sector: Sector
|
||||||
|
)
|
||||||
|
|
||||||
|
data class Sector(
|
||||||
|
val description: String
|
||||||
)
|
)
|
|
@ -181,9 +181,11 @@ class ReubicationCollectionFragment(
|
||||||
private fun customDialogMerge(itemReubication: Reubication) {
|
private fun customDialogMerge(itemReubication: Reubication) {
|
||||||
|
|
||||||
if (customDialogInputTwoValues.getValueTwo().isNotEmpty()) {
|
if (customDialogInputTwoValues.getValueTwo().isNotEmpty()) {
|
||||||
viewModel.itemShelvingMerge(
|
viewModel.getMergeFromCode(
|
||||||
itemReubication.id, customDialogInputTwoValues.getValueTwo().uppercase()
|
itemReubication.id,
|
||||||
|
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,6 +56,8 @@ 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(),
|
||||||
)
|
)
|
||||||
|
|
|
@ -7,6 +7,7 @@ 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
|
||||||
|
@ -132,9 +133,12 @@ class SaleAdapter(
|
||||||
|
|
||||||
//ERROR
|
//ERROR
|
||||||
if (sale.originalQuantity != sale.quantity) {
|
if (sale.originalQuantity != sale.quantity) {
|
||||||
layoutError.visibility = View.VISIBLE
|
layoutError.visibility = VISIBLE
|
||||||
txtError.text =
|
txtError.text =
|
||||||
binding.root.context.getString(R.string.originalQuantity) + sale.originalQuantity
|
buildString {
|
||||||
|
append(binding.root.context.getString(R.string.originalQuantity))
|
||||||
|
append(sale.originalQuantity)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -145,7 +149,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 = View.VISIBLE
|
layoutError.visibility = VISIBLE
|
||||||
txtError.text = binding.root.context.getString(R.string.newItem)
|
txtError.text = binding.root.context.getString(R.string.newItem)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -157,7 +161,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 = View.GONE
|
layoutError.visibility = GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
//SEMAFORO
|
//SEMAFORO
|
||||||
|
@ -278,10 +282,10 @@ class SaleAdapter(
|
||||||
)*/
|
)*/
|
||||||
} else if (sale.isPreviousPrepared == "1") {
|
} else if (sale.isPreviousPrepared == "1") {
|
||||||
contentLayout.setBackgroundColor(
|
contentLayout.setBackgroundColor(
|
||||||
getColor(
|
if (sale.picked == null) getColor(
|
||||||
context!!,
|
context!!,
|
||||||
R.color.verdnatura_dark_sky_blue
|
R.color.verdnatura_black
|
||||||
)
|
) 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))
|
||||||
|
@ -308,53 +312,53 @@ class SaleAdapter(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isExpanded) {
|
if (isExpanded) {
|
||||||
itemArticlePlacements.visibility = View.VISIBLE
|
itemArticlePlacements.visibility = VISIBLE
|
||||||
ivArrow.setImageResource(R.drawable.ic_arrow_down)
|
ivArrow.setImageResource(R.drawable.ic_arrow_down)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
itemArticlePlacements.visibility = View.GONE
|
itemArticlePlacements.visibility = GONE
|
||||||
ivArrow.setImageResource(R.drawable.ic_arrow_up)
|
ivArrow.setImageResource(R.drawable.ic_arrow_up)
|
||||||
}
|
}
|
||||||
|
|
||||||
itemArticlePlacements.visibility = if (isExpanded) View.VISIBLE else {
|
itemArticlePlacements.visibility = if (isExpanded) VISIBLE else {
|
||||||
View.GONE
|
GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sale.isParent) {
|
if (sale.isParent) {
|
||||||
itemArticleItemFk.visibility = View.INVISIBLE
|
itemArticleItemFk.visibility = INVISIBLE
|
||||||
//itemPackingText.visibility = View.INVISIBLE
|
//itemPackingText.visibility = View.INVISIBLE
|
||||||
//itemPackingItemFk.visibility = View.INVISIBLE
|
//itemPackingItemFk.visibility = View.INVISIBLE
|
||||||
itemArticleCel1.visibility = View.INVISIBLE
|
itemArticleCel1.visibility = INVISIBLE
|
||||||
itemArticleCel2.visibility = View.INVISIBLE
|
itemArticleCel2.visibility = INVISIBLE
|
||||||
itemArticleCel3.visibility = View.INVISIBLE
|
itemArticleCel3.visibility = INVISIBLE
|
||||||
itemArticleQuantity.visibility = View.INVISIBLE
|
itemArticleQuantity.visibility = INVISIBLE
|
||||||
txtdeNew.visibility = View.INVISIBLE
|
txtdeNew.visibility = INVISIBLE
|
||||||
itemArticleQuantityPicked.visibility = View.INVISIBLE
|
itemArticleQuantityPicked.visibility = INVISIBLE
|
||||||
itemArticleQuantityLine3.visibility = View.VISIBLE
|
itemArticleQuantityLine3.visibility = VISIBLE
|
||||||
imageErrorMessage.visibility = View.INVISIBLE
|
imageErrorMessage.visibility = INVISIBLE
|
||||||
ivArrow.visibility = View.VISIBLE
|
ivArrow.visibility = VISIBLE
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
itemArticleItemFk.visibility = View.VISIBLE
|
itemArticleItemFk.visibility = VISIBLE
|
||||||
//itemPackingText.visibility = View.VISIBLE
|
//itemPackingText.visibility = View.VISIBLE
|
||||||
//itemPackingItemFk.visibility = View.VISIBLE
|
//itemPackingItemFk.visibility = View.VISIBLE
|
||||||
itemArticleCel1.visibility = View.VISIBLE
|
itemArticleCel1.visibility = VISIBLE
|
||||||
itemArticleCel2.visibility = View.VISIBLE
|
itemArticleCel2.visibility = VISIBLE
|
||||||
itemArticleCel3.visibility = View.VISIBLE
|
itemArticleCel3.visibility = VISIBLE
|
||||||
itemArticleQuantity.visibility = View.VISIBLE
|
itemArticleQuantity.visibility = VISIBLE
|
||||||
txtdeNew.visibility = View.VISIBLE
|
txtdeNew.visibility = VISIBLE
|
||||||
itemArticleQuantityPicked.visibility = View.VISIBLE
|
itemArticleQuantityPicked.visibility = VISIBLE
|
||||||
itemArticleQuantityLine3.visibility = View.VISIBLE
|
itemArticleQuantityLine3.visibility = 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 = View.VISIBLE
|
imageErrorMessage.visibility = VISIBLE
|
||||||
} else {
|
} else {
|
||||||
imageErrorMessage.visibility = View.INVISIBLE
|
imageErrorMessage.visibility = INVISIBLE
|
||||||
}
|
}
|
||||||
ivArrow.visibility = View.INVISIBLE
|
ivArrow.visibility = INVISIBLE
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sale.sonSales.isNullOrEmpty()) {
|
if (!sale.sonSales.isNullOrEmpty()) {
|
||||||
|
@ -372,7 +376,7 @@ class SaleAdapter(
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//revisar porque incosistencia
|
//revisar porque incosistencia
|
||||||
itemArticlePlacements.visibility = View.VISIBLE
|
itemArticlePlacements.visibility = VISIBLE
|
||||||
}
|
}
|
||||||
|
|
||||||
/* rvHeadlines.adapter=SaleAdapter(sale.sonSales,onPasillerosItemClickListener,onQuantityClick,onSaleClickListener,onMistakeClickListener,onPackingClick)
|
/* rvHeadlines.adapter=SaleAdapter(sale.sonSales,onPasillerosItemClickListener,onQuantityClick,onSaleClickListener,onMistakeClickListener,onPackingClick)
|
||||||
|
@ -383,11 +387,11 @@ class SaleAdapter(
|
||||||
|
|
||||||
if (isExpanded) {
|
if (isExpanded) {
|
||||||
ivArrow.setImageResource(R.drawable.ic_arrow_up)
|
ivArrow.setImageResource(R.drawable.ic_arrow_up)
|
||||||
itemArticlePlacements.visibility = View.GONE
|
itemArticlePlacements.visibility = GONE
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
ivArrow.setImageResource(R.drawable.ic_arrow_down)
|
ivArrow.setImageResource(R.drawable.ic_arrow_down)
|
||||||
itemArticlePlacements.visibility = View.VISIBLE
|
itemArticlePlacements.visibility = VISIBLE
|
||||||
}
|
}
|
||||||
isExpanded = !isExpanded
|
isExpanded = !isExpanded
|
||||||
|
|
||||||
|
@ -395,7 +399,7 @@ class SaleAdapter(
|
||||||
}
|
}
|
||||||
|
|
||||||
//Tarea 6607
|
//Tarea 6607
|
||||||
itemArticleCel2Count.visibility = View.GONE
|
itemArticleCel2Count.visibility = GONE
|
||||||
/*itemArticleCel2Count.visibility = if (type == CONTROLADOR) {
|
/*itemArticleCel2Count.visibility = if (type == CONTROLADOR) {
|
||||||
View.VISIBLE
|
View.VISIBLE
|
||||||
} else {
|
} else {
|
||||||
|
@ -503,8 +507,4 @@ 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,7 +354,15 @@ 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
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,365 @@
|
||||||
|
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.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 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
|
||||||
|
holder.bind(items[position])
|
||||||
|
}
|
||||||
|
|
||||||
|
inner class AjustesItemHolder(
|
||||||
|
val binding: SaleRowFragmentReserveBinding
|
||||||
|
) : RecyclerView.ViewHolder(binding.root) {
|
||||||
|
fun bind(sale: Sale) {
|
||||||
|
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}"
|
||||||
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,363 @@
|
||||||
|
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.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 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])
|
||||||
|
}
|
||||||
|
|
||||||
|
inner class AjustesItemHolder(
|
||||||
|
val binding: SaleRowFragmentReserveSacadorBinding
|
||||||
|
) : RecyclerView.ViewHolder(binding.root) {
|
||||||
|
fun bind(sale: Sale) {
|
||||||
|
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}"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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 {
|
||||||
|
|
||||||
|
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)
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,308 @@
|
||||||
|
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,14 +8,14 @@ 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
|
||||||
|
@ -27,6 +27,7 @@ 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)
|
||||||
|
|
||||||
//var isPaused: Boolean = false
|
//var isPaused: Boolean = false
|
||||||
|
|
||||||
|
@ -303,41 +304,37 @@ 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", "routeFk"],
|
"fields": ["id", "agencyModeFk"],
|
||||||
"include": [
|
"include": [
|
||||||
{
|
{
|
||||||
"relation": "route",
|
"relation": "agencyMode",
|
||||||
"scope": {
|
"scope": {
|
||||||
"fields": ["id", "agencyModeFk"],
|
"fields": ["id", "deliveryMethodFk", "code"],
|
||||||
|
"where": {
|
||||||
|
"code": { "inq": ["REC_ALG", "PICKUP"] }
|
||||||
|
},
|
||||||
"include": {
|
"include": {
|
||||||
"relation": "agencyMode",
|
"relation": "deliveryMethod",
|
||||||
"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<PickupResponse>>(context) {
|
).enqueue(object : SalixCallback<List<TicketPickupResponse>>(context) {
|
||||||
override fun onSuccess(response: Response<List<PickupResponse>>) {
|
override fun onSuccess(response: Response<List<TicketPickupResponse>>) {
|
||||||
|
|
||||||
_responseTicketIsPickup.value =
|
_responseTicketIsPickup.value =
|
||||||
response.body()
|
response.body()
|
||||||
?.firstOrNull()?.route?.agencyMode?.deliveryMethod?.code == "PICKUP"
|
?.firstOrNull()?.agencyMode?.deliveryMethod?.code == "PICKUP"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,4 +356,14 @@ 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
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -79,6 +79,7 @@ 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
|
||||||
|
@ -304,8 +305,13 @@ 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" -> {
|
||||||
markPrevia(myQr.id.toString())
|
if (sales.any { it.saleGroupFk == myQr.id.toString() }) {
|
||||||
|
markPrevia(myQr.id.toString())
|
||||||
|
} else {
|
||||||
|
findSale(myQr.id.toString())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"buy" -> binding.scanInput.setText(myQr.more)
|
"buy" -> binding.scanInput.setText(myQr.more)
|
||||||
|
@ -556,6 +562,8 @@ class CollectionFragmentChecker(
|
||||||
sales = salesList.sortedWith(
|
sales = salesList.sortedWith(
|
||||||
compareBy({ it.isControlled }, { it.picked })
|
compareBy({ it.isControlled }, { it.picked })
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//para la nueva revisión : hay que poner el saleOrder si no no podrán revisar correctamente
|
||||||
myGroupList = groupSaleGroup(salesList).sortedWith(
|
myGroupList = groupSaleGroup(salesList).sortedWith(
|
||||||
compareBy({ it.isControlled }, { it.picked })
|
compareBy({ it.isControlled }, { it.picked })
|
||||||
)
|
)
|
||||||
|
@ -1101,28 +1109,30 @@ 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 =
|
|
||||||
quantityIncrease
|
if (myGroupList[parentIndex].saleFk == saleFk) {
|
||||||
break
|
myGroupList[parentIndex].quantity = quantityIncrease
|
||||||
|
// myGroupList[positionIncreaseQuantity].quantity = quantityIncrease
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}/* } else {
|
}
|
||||||
myGroupList[positionIncreaseQuantity].quantity = quantityIncrease
|
viewModel.itemShelvingSaleBySale(saleFk = saleFk, quantityDiff = quantityIncreaseDiff)
|
||||||
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()
|
||||||
)
|
)
|
||||||
|
|
|
@ -844,7 +844,8 @@ class CollectionFragmentPicker(
|
||||||
} else {
|
} else {
|
||||||
// pintar línea
|
// pintar línea
|
||||||
saleAdapter!!.notifyDataSetChanged()
|
saleAdapter!!.notifyDataSetChanged()
|
||||||
myPosition = storedBackPosition
|
//se modifica tenia storedBackPosition
|
||||||
|
myPosition = storedPosition
|
||||||
|
|
||||||
ReviewQuantityForRefreshingAndSorting(
|
ReviewQuantityForRefreshingAndSorting(
|
||||||
sales[storedPosition].quantity!!.toInt(),
|
sales[storedPosition].quantity!!.toInt(),
|
||||||
|
@ -1007,15 +1008,7 @@ 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()
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -7,7 +7,11 @@ 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
|
||||||
|
@ -55,7 +59,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.SaleAdapterNew
|
import es.verdnatura.presentation.view.feature.collection.adapter.SaleAdapterReserve
|
||||||
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
|
||||||
|
@ -78,7 +82,7 @@ import org.json.JSONObject
|
||||||
variables:
|
variables:
|
||||||
isVerifiedCollection
|
isVerifiedCollection
|
||||||
*/
|
*/
|
||||||
class CollectionFragmentPickerPreviousNew(
|
class CollectionFragmentPickerPreviousNewInterface(
|
||||||
var collection: CollectionTicket,
|
var collection: CollectionTicket,
|
||||||
var type: String = PRESACADOR,
|
var type: String = PRESACADOR,
|
||||||
private var hasPickingOrder: Boolean = false
|
private var hasPickingOrder: Boolean = false
|
||||||
|
@ -86,7 +90,7 @@ class CollectionFragmentPickerPreviousNew(
|
||||||
CollectionViewModel::class
|
CollectionViewModel::class
|
||||||
) {
|
) {
|
||||||
private var sales: List<Sale> = listOf()
|
private var sales: List<Sale> = listOf()
|
||||||
private var saleAdapter: SaleAdapterNew? = null
|
private var saleAdapter: SaleAdapterReserve? = 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
|
||||||
|
@ -115,7 +119,7 @@ class CollectionFragmentPickerPreviousNew(
|
||||||
companion object {
|
companion object {
|
||||||
fun newInstance(
|
fun newInstance(
|
||||||
collection: CollectionTicket, type: String, hasPickingOrder: Boolean = false
|
collection: CollectionTicket, type: String, hasPickingOrder: Boolean = false
|
||||||
) = CollectionFragmentPickerPreviousNew(collection, type, hasPickingOrder)
|
) = CollectionFragmentPickerPreviousNewInterface(collection, type, hasPickingOrder)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onAttach(context: Context) {
|
override fun onAttach(context: Context) {
|
||||||
|
@ -137,6 +141,7 @@ class CollectionFragmentPickerPreviousNew(
|
||||||
}
|
}
|
||||||
|
|
||||||
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())
|
||||||
|
@ -154,9 +159,9 @@ class CollectionFragmentPickerPreviousNew(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setToolBar() {
|
private fun setToolBar() {
|
||||||
binding.mainToolbar.toolbarSubtitle.visibility = View.VISIBLE
|
binding.mainToolbar.toolbarSubtitle.visibility = VISIBLE
|
||||||
binding.mainToolbar.toolbarIcons.visibility = View.VISIBLE
|
binding.mainToolbar.toolbarIcons.visibility = VISIBLE
|
||||||
binding.mainToolbar.backButton.visibility = View.VISIBLE
|
binding.mainToolbar.backButton.visibility = VISIBLE
|
||||||
collection.collectionFk.let {
|
collection.collectionFk.let {
|
||||||
binding.mainToolbar.toolbarTitle.text = collection.collectionFk.toString()
|
binding.mainToolbar.toolbarTitle.text = collection.collectionFk.toString()
|
||||||
}
|
}
|
||||||
|
@ -233,6 +238,7 @@ class CollectionFragmentPickerPreviousNew(
|
||||||
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)
|
||||||
|
@ -433,19 +439,22 @@ class CollectionFragmentPickerPreviousNew(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
saleAdapter = SaleAdapterNew(myGroupList, pasillerosItemClickListener!!,
|
saleAdapter = SaleAdapterReserve(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 {
|
} else {
|
||||||
showScanner(position, sale)
|
showScanner(position, sale)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
//TODO desmarcamos una linea de previa ?
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -559,14 +568,27 @@ class CollectionFragmentPickerPreviousNew(
|
||||||
isFoundSale = true
|
isFoundSale = true
|
||||||
storedPosition = indice
|
storedPosition = indice
|
||||||
viewModel.itemShelvingSaleSetSaleGroup(txtscan.toInt())
|
viewModel.itemShelvingSaleSetSaleGroup(txtscan.toInt())
|
||||||
setStateSaleGroup(txtscan.toInt())
|
//actualizamos padre
|
||||||
myGroupList[indice].stateCode =
|
myGroupList[indice].stateCode =
|
||||||
if (myGroupList[indice].stateCode == "PREPARED") {
|
if (myGroupList[indice].stateCode == "PREPARED") {
|
||||||
"OK PREVIOUS"
|
"OK PREVIOUS"
|
||||||
} else {
|
} else {
|
||||||
"PREPARED"
|
"PREPARED"
|
||||||
}
|
}
|
||||||
saleAdapter!!.notifyDataSetChanged()
|
//actualizamos hijos
|
||||||
|
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
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -590,7 +612,10 @@ class CollectionFragmentPickerPreviousNew(
|
||||||
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(saleGroupScanned.toInt())
|
setStateSaleGroup(
|
||||||
|
saleGroupScanned.toInt(),
|
||||||
|
if (sales[indice].stateCode == "PREPARED") 28 else 14
|
||||||
|
)
|
||||||
storedPosition = indice
|
storedPosition = indice
|
||||||
mpok!!.start()
|
mpok!!.start()
|
||||||
return true
|
return true
|
||||||
|
@ -708,8 +733,21 @@ class CollectionFragmentPickerPreviousNew(
|
||||||
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.setTitle("$shelving($item) $totalReserved de $longName").setOkButton(
|
customDialogList.setTitleSpannable(spannable)
|
||||||
|
customDialogList.setOkButton(
|
||||||
getString(
|
getString(
|
||||||
R.string.take
|
R.string.take
|
||||||
)
|
)
|
||||||
|
@ -721,7 +759,9 @@ class CollectionFragmentPickerPreviousNew(
|
||||||
customDialogList.dismiss()
|
customDialogList.dismiss()
|
||||||
scanRequest()
|
scanRequest()
|
||||||
|
|
||||||
}.setHintValue(getString(R.string.quantitySelect)).setValue(totalReserved.toString())
|
}.setHintValue(getString(R.string.quantitySelect))
|
||||||
|
.setTextSize(20f)
|
||||||
|
.setValue(totalReserved.toString())
|
||||||
.setHintValueTwo(getString(R.string.scanItem)).setValueTwo("").show()
|
.setHintValueTwo(getString(R.string.scanItem)).setValueTwo("").show()
|
||||||
|
|
||||||
customDialogList.getEditTextTwo().setOnEditorActionListener { v, actionId, event ->
|
customDialogList.getEditTextTwo().setOnEditorActionListener { v, actionId, event ->
|
||||||
|
@ -784,7 +824,11 @@ class CollectionFragmentPickerPreviousNew(
|
||||||
mpok?.start()
|
mpok?.start()
|
||||||
ma.hideKeyboard(customDialogList.getEditTextTwo())
|
ma.hideKeyboard(customDialogList.getEditTextTwo())
|
||||||
customDialogList.dismiss()
|
customDialogList.dismiss()
|
||||||
requireContext().showToastCenterWithBackground(myGroupList[position].ticketFk.toString())
|
requireContext().showToastCenterWithBackground(
|
||||||
|
if (type == PREITEMPICKERTEST) "(" + myGroupList[position].ticketOrder + ")" + myGroupList[position].ticketFk.toString() else {
|
||||||
|
myGroupList[position].ticketFk.toString()
|
||||||
|
}
|
||||||
|
)
|
||||||
scanRequest()
|
scanRequest()
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -1059,7 +1103,7 @@ class CollectionFragmentPickerPreviousNew(
|
||||||
}
|
}
|
||||||
if (distinctSaleGroups.isNotEmpty())
|
if (distinctSaleGroups.isNotEmpty())
|
||||||
distinctSaleGroups.forEach { saleGroup ->
|
distinctSaleGroups.forEach { saleGroup ->
|
||||||
setStateSaleGroup(saleGroup)
|
setStateSaleGroup(saleGroup, stateCodeId!!)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1067,8 +1111,8 @@ class CollectionFragmentPickerPreviousNew(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setStateSaleGroup(saleGroup: Number) {
|
private fun setStateSaleGroup(saleGroup: Number, stateCode: Number) {
|
||||||
viewModel.saleGroupUpdateState(saleGroup, stateCodeId!!)
|
viewModel.saleGroupUpdateState(saleGroup, stateCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showScanner(index: Int, sale: Sale) {
|
private fun showScanner(index: Int, sale: Sale) {
|
||||||
|
@ -1123,6 +1167,8 @@ class CollectionFragmentPickerPreviousNew(
|
||||||
}
|
}
|
||||||
} 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(
|
||||||
|
@ -1143,8 +1189,11 @@ class CollectionFragmentPickerPreviousNew(
|
||||||
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].parkingCode ?: "",
|
longName = value[0].parkingCodePrevia ?: "",
|
||||||
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
|
||||||
|
@ -1204,7 +1253,7 @@ class CollectionFragmentPickerPreviousNew(
|
||||||
if (foundTicketInCollection != null) {
|
if (foundTicketInCollection != null) {
|
||||||
isVerifiedCollection = true
|
isVerifiedCollection = true
|
||||||
ma.hideKeyboard(customDialogList.getEditText())
|
ma.hideKeyboard(customDialogList.getEditText())
|
||||||
binding.fragmentSacadorCollections.visibility = View.VISIBLE
|
binding.fragmentSacadorCollections.visibility = VISIBLE
|
||||||
customDialogList.dismiss()
|
customDialogList.dismiss()
|
||||||
binding.scanInput.requestFocus()
|
binding.scanInput.requestFocus()
|
||||||
} else {
|
} else {
|
File diff suppressed because it is too large
Load Diff
|
@ -103,6 +103,7 @@ 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
|
||||||
|
@ -981,10 +982,11 @@ class CollectionFragmentPreChecker(
|
||||||
sales = salesList.sortedWith(compareBy({ it.picked }))
|
sales = salesList.sortedWith(compareBy({ it.picked }))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
saleAdapter =
|
saleAdapter =
|
||||||
SaleAdapter(
|
SaleAdapter(
|
||||||
sales as MutableList,
|
if (sales.isEmpty()) sales.toMutableList() else {
|
||||||
|
sales as MutableList
|
||||||
|
},
|
||||||
pasillerosItemClickListener!!,
|
pasillerosItemClickListener!!,
|
||||||
object : OnQuantityClickListener {
|
object : OnQuantityClickListener {
|
||||||
|
|
||||||
|
@ -1088,9 +1090,10 @@ class CollectionFragmentPreChecker(
|
||||||
setListPosition(storedBackPosition, true)
|
setListPosition(storedBackPosition, true)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
// }
|
||||||
|
|
||||||
printObservations(observations)
|
printObservations(observations)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setScrollListener(lm: LinearLayoutManager) {
|
private fun setScrollListener(lm: LinearLayoutManager) {
|
||||||
|
@ -1533,7 +1536,6 @@ 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 = ""
|
||||||
|
@ -1630,7 +1632,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.SHOW_IMPLICIT
|
InputMethodManager.HIDE_IMPLICIT_ONLY
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2024,7 +2026,21 @@ 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() {
|
||||||
|
@ -2087,49 +2103,19 @@ 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)) {
|
||||||
/* checkAndCall(
|
if (customDialogThreeButtons.getValue().isNotEmpty()) {
|
||||||
position,
|
increaseQuantity(position, customDialogThreeButtons.getValue().toInt())
|
||||||
customDialogThreeButtons.getValue(),
|
scanRequest()
|
||||||
getString(R.string.Agregar)
|
customDialogThreeButtons.dismiss()
|
||||||
)*/
|
} else {
|
||||||
increaseQuantity(position, customDialogThreeButtons.getValue().toInt())
|
ma.messageWithSound(
|
||||||
scanRequest()
|
getString(R.string.errorInputQuantity),
|
||||||
customDialogThreeButtons.dismiss()
|
isError = true,
|
||||||
|
isPlayed = true,
|
||||||
|
isToasted = true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
}.setKoButton(getString(R.string.cancel)) {
|
}.setKoButton(getString(R.string.cancel)) {
|
||||||
scanRequest()
|
scanRequest()
|
||||||
|
@ -2175,15 +2161,21 @@ class CollectionFragmentPreChecker(
|
||||||
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
}
|
}
|
||||||
saleAdapter?.notifyDataSetChanged()
|
|
||||||
|
|
||||||
sales[positionIncreaseQuantity].originalQuantity = quantityIncrease
|
sales[positionIncreaseQuantity].originalQuantity = quantityIncrease
|
||||||
|
saleAdapter?.notifyDataSetChanged()
|
||||||
|
|
||||||
|
viewModel.itemShelvingSaleBySale(
|
||||||
|
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,13 +6,14 @@ 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.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,10 +25,12 @@ 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.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
|
||||||
|
@ -192,6 +195,11 @@ 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
|
||||||
|
@ -347,6 +355,54 @@ 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
|
||||||
|
|
||||||
|
@ -502,6 +558,10 @@ 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)))
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -519,6 +579,20 @@ 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
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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 {
|
||||||
|
@ -86,17 +86,8 @@ fun CollectionTicket.map(context: Context): CollectionTicket {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getCalendarFromDate(date: String, context: Context): Calendar {
|
private fun getCalendarFromDate(date: String, context: Context): Calendar {
|
||||||
val sdf = SimpleDateFormat(context.getString(R.string.dateFormat))
|
val sdf = SimpleDateFormat(context.getString(R.string.dateFormat), Locale.getDefault())
|
||||||
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
|
|
||||||
}
|
|
|
@ -1,356 +0,0 @@
|
||||||
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()
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -16,44 +16,12 @@ 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) {
|
||||||
|
|
||||||
|
|
|
@ -199,10 +199,10 @@ class LoadUnloadFragment(
|
||||||
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") {
|
if (state == "ON DELIVERY" && l.code != "ON DELIVERY" && l.code != "DELIVERED" && l.code != "LOST" && l.code != "PENDING") {
|
||||||
"NOT SCANNED"
|
"NOT SCANNED"
|
||||||
} else {
|
} else {
|
||||||
if (state == "DELIVERED" && l.code != "DELIVERED") "LOST" else l.code
|
if (state == "DELIVERED" && l.code != "DELIVERED") "PENDING" else l.code
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isScanned = l.isScanned,
|
isScanned = l.isScanned,
|
||||||
|
@ -273,7 +273,7 @@ class LoadUnloadFragment(
|
||||||
ma.onMyBackPressed()
|
ma.onMyBackPressed()
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.scanInput.setOnEditorActionListener { v, actionId, event ->
|
binding.scanInput.setOnEditorActionListener { _, 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()) {
|
||||||
|
@ -478,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 {
|
||||||
"LOST"
|
"PENDING"
|
||||||
},
|
},
|
||||||
nickname = item.nickname,
|
nickname = item.nickname,
|
||||||
postalCode = item.postalCode
|
postalCode = item.postalCode
|
||||||
|
@ -595,7 +595,7 @@ class LoadUnloadFragment(
|
||||||
override fun onBackPressedHandled(): Boolean {
|
override fun onBackPressedHandled(): Boolean {
|
||||||
|
|
||||||
if (scanned) {
|
if (scanned) {
|
||||||
var customDialog = CustomDialog(requireContext())
|
val 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)) {
|
||||||
|
|
|
@ -429,22 +429,17 @@ class TicketsFragment : BaseFragment<FragmentTicketsBinding, DeliveryViewModel>(
|
||||||
override fun onItemButtonCMRRowClickListener(
|
override fun onItemButtonCMRRowClickListener(
|
||||||
item: Ticket
|
item: Ticket
|
||||||
) {
|
) {
|
||||||
ma.onPasillerosItemClickListener(
|
|
||||||
PasillerosItemVO(
|
val url =
|
||||||
title = R.string.titleWebViewer,
|
"${mobileApplication.dataStoreApp.getServerLilium()}/api/Cmrs/${item.cmrFk}/print?access_token=${
|
||||||
), entryPoint = Gson().toJson(
|
mobileApplication.dataStoreApp.readDataStoreKey<String>(
|
||||||
mutableMapOf(
|
TOKEN
|
||||||
"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)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -7,13 +7,16 @@ 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 {
|
||||||
|
@ -36,7 +39,7 @@ class HistoricoAdapter(
|
||||||
binding.apply {
|
binding.apply {
|
||||||
this.item = item
|
this.item = item
|
||||||
|
|
||||||
val sdf = SimpleDateFormat(res.getString(R.string.dateFormat))
|
val sdf = SimpleDateFormat(res.getString(R.string.dateFormat), Locale.getDefault())
|
||||||
val currentDate = sdf.format(Date())
|
val currentDate = sdf.format(Date())
|
||||||
|
|
||||||
historicoDate.setBackgroundColor(
|
historicoDate.setBackgroundColor(
|
||||||
|
@ -76,6 +79,14 @@ 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
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,7 +97,6 @@ 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(
|
||||||
|
|
|
@ -16,6 +16,7 @@ import es.verdnatura.domain.notNull
|
||||||
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
|
||||||
|
@ -23,6 +24,7 @@ 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
|
||||||
|
@ -242,6 +244,71 @@ 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 =
|
||||||
|
|
|
@ -1,73 +0,0 @@
|
||||||
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()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,153 +0,0 @@
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,64 +0,0 @@
|
||||||
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)
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
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,
|
|
||||||
)
|
|
|
@ -1,48 +0,0 @@
|
||||||
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))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,93 +0,0 @@
|
||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
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) }
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
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()
|
|
||||||
)
|
|
|
@ -0,0 +1,81 @@
|
||||||
|
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 = listOf<Buyer>()
|
private var myListBuyers = mutableListOf<Buyer>()
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun newInstance() = InventaryFragment()
|
fun newInstance() = InventaryFragment()
|
||||||
|
@ -82,6 +82,7 @@ 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))
|
||||||
|
@ -235,7 +236,7 @@ class InventaryFragment :
|
||||||
with(viewModel) {
|
with(viewModel) {
|
||||||
|
|
||||||
buyersByItemPackingList.observe(viewLifecycleOwner) { list ->
|
buyersByItemPackingList.observe(viewLifecycleOwner) { list ->
|
||||||
myListBuyers = list.list
|
myListBuyers = list.list.toMutableList()
|
||||||
val distinctPackingTypes =
|
val distinctPackingTypes =
|
||||||
list?.list?.map {
|
list?.list?.map {
|
||||||
NameWithId(
|
NameWithId(
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
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,
|
||||||
|
@ -9,7 +11,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(
|
||||||
|
@ -27,13 +29,14 @@ 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 = "",
|
||||||
|
@ -42,8 +45,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,6 +157,7 @@ class LoginFragment() :
|
||||||
}
|
}
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setSwitch() {
|
private fun setSwitch() {
|
||||||
|
@ -170,36 +171,6 @@ 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 {
|
||||||
|
@ -355,31 +326,36 @@ class LoginFragment() :
|
||||||
if (binding.edittextServer.text.toString() == "Producción") {
|
if (binding.edittextServer.text.toString() == "Producción") {
|
||||||
mobileApplication.clearApplicationData()
|
mobileApplication.clearApplicationData()
|
||||||
}
|
}
|
||||||
customDialog.setTitle(getString(R.string.Actualizar))
|
//Tarea 8212 serialMuber is obtaines from back when PDA is registered, updated scaleFusion
|
||||||
.setDescription(getString(R.string.updatemng)).setOkButton(
|
if (it.serialNumber.isEmpty()) {
|
||||||
getString(
|
customDialog.setTitle(getString(R.string.Actualizar))
|
||||||
R.string.Actualizar
|
.setDescription(getString(R.string.updatemng)).setOkButton(
|
||||||
)
|
getString(
|
||||||
) {
|
R.string.Actualizar
|
||||||
try {
|
)
|
||||||
val openURL = Intent(Intent.ACTION_VIEW)
|
) {
|
||||||
openURL.data = Uri.parse(it.url)
|
try {
|
||||||
startActivity(openURL)
|
val openURL = Intent(Intent.ACTION_VIEW)
|
||||||
} catch (ex: Exception) {
|
openURL.data = Uri.parse(it.url)
|
||||||
getString(R.string.problemUpdate).toast(requireActivity())
|
startActivity(openURL)
|
||||||
|
} 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()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (it.isVersionCritical) {
|
customDialog.show()
|
||||||
customDialog.setDescription(getString(R.string.updatecritical))
|
|
||||||
} else {
|
} else {
|
||||||
customDialog.setKoButton(getString(R.string.cancel)) {
|
goToMain()
|
||||||
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,7 +3,6 @@ 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
|
||||||
|
@ -11,7 +10,6 @@ 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
|
||||||
|
@ -50,7 +48,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.WebFragment
|
import es.verdnatura.presentation.view.commom.webview.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
|
||||||
|
@ -68,10 +66,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.CollectionFragmentPickerPreviousNew
|
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentPickerPreviousNewInterface
|
||||||
|
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
|
||||||
|
@ -83,10 +81,8 @@ import es.verdnatura.presentation.view.feature.delivery.fragments.TicketsFragmen
|
||||||
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.DayOfSaleFragment
|
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
|
||||||
|
@ -135,7 +131,7 @@ 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.UbicadorFragment6869
|
import es.verdnatura.presentation.view.feature.ubicador.fragment.UbicadorFragment
|
||||||
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.WorkermistakeFragment
|
import es.verdnatura.presentation.view.feature.workermistake.fragment.WorkermistakeFragment
|
||||||
import kotlinx.coroutines.DelicateCoroutinesApi
|
import kotlinx.coroutines.DelicateCoroutinesApi
|
||||||
|
@ -176,7 +172,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
try {
|
try {
|
||||||
|
@ -205,9 +200,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
return super.onCreateView(name, context, attrs)
|
return super.onCreateView(name, context, attrs)
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
@OptIn(DelicateCoroutinesApi::class)
|
||||||
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)
|
||||||
|
@ -247,11 +241,10 @@ 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?.scheduleAtFixedRate(
|
scheduledFuture = scheduledExecutor?.scheduleWithFixedDelay(
|
||||||
{
|
{
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
checkTokenRenew()
|
checkTokenRenew()
|
||||||
|
@ -260,13 +253,11 @@ 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
|
||||||
|
@ -414,7 +405,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)
|
||||||
delete_Fragments()
|
deleteFragments()
|
||||||
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,
|
||||||
|
@ -426,7 +417,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)
|
||||||
delete_Fragments()
|
deleteFragments()
|
||||||
addFragment(
|
addFragment(
|
||||||
ShowTicketFragment.newInstance(getString(R.string.main)),
|
ShowTicketFragment.newInstance(getString(R.string.main)),
|
||||||
R.id.main_frame_layout,
|
R.id.main_frame_layout,
|
||||||
|
@ -438,7 +429,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)
|
||||||
delete_Fragments()
|
deleteFragments()
|
||||||
addFragment(
|
addFragment(
|
||||||
ParkingFragment.newInstance(getString(R.string.main)),
|
ParkingFragment.newInstance(getString(R.string.main)),
|
||||||
R.id.main_frame_layout,
|
R.id.main_frame_layout,
|
||||||
|
@ -450,7 +441,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)
|
||||||
delete_Fragments()
|
deleteFragments()
|
||||||
addFragment(
|
addFragment(
|
||||||
AjustesFragment.newInstance(),
|
AjustesFragment.newInstance(),
|
||||||
R.id.main_frame_layout,
|
R.id.main_frame_layout,
|
||||||
|
@ -469,7 +460,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)
|
||||||
delete_Fragments()
|
deleteFragments()
|
||||||
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,
|
||||||
|
@ -485,7 +476,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun delete_Fragments() {
|
private fun deleteFragments() {
|
||||||
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)
|
||||||
|
@ -493,12 +484,10 @@ 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?
|
||||||
) {
|
) {
|
||||||
val itemTitle = getString(item.title!!)
|
when (val itemTitle = getString(item.title!!)) {
|
||||||
when (itemTitle) {
|
|
||||||
|
|
||||||
//BUFFERS
|
//BUFFERS
|
||||||
getString(R.string.titlePalletizar) -> {
|
getString(R.string.titlePalletizar) -> {
|
||||||
|
@ -615,9 +604,6 @@ 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))
|
||||||
}
|
}
|
||||||
|
@ -626,10 +612,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
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))
|
||||||
}
|
}
|
||||||
|
@ -638,17 +620,23 @@ 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(
|
||||||
|
BuscarItemFragmentCompose.newInstance(
|
||||||
|
if (entryPoint == "") {
|
||||||
|
null
|
||||||
|
} else {
|
||||||
|
entryPoint.toInt()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)*/
|
||||||
|
|
||||||
addFragmentOnTop(
|
addFragmentOnTop(
|
||||||
BuscarItemFragment.newInstance(
|
BuscarItemFragment.newInstance(
|
||||||
if (entryPoint == "") {
|
if (entryPoint == "") {
|
||||||
|
@ -673,13 +661,9 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(R.string.titleUbicator) -> {
|
getString(R.string.titleUbicator) -> {
|
||||||
//addFragmentOnTop(UbicadorFragmentNew.newInstance(entryPoint))
|
|
||||||
addFragmentOnTop(UbicadorFragment6869.newInstance(entryPoint))
|
addFragmentOnTop(UbicadorFragment.newInstance(entryPoint))
|
||||||
}
|
}
|
||||||
//Tarea 6869
|
|
||||||
/* getString(R.string.ubicatorNew) -> {
|
|
||||||
addFragmentOnTop(UbicadorFragment6869.newInstance(entryPoint))
|
|
||||||
}*/
|
|
||||||
|
|
||||||
//Tarea 7855
|
//Tarea 7855
|
||||||
getString(R.string.scanPreparedExpedition) -> {
|
getString(R.string.scanPreparedExpedition) -> {
|
||||||
|
@ -717,6 +701,8 @@ 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
|
||||||
|
@ -757,9 +743,6 @@ 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))
|
||||||
|
@ -785,7 +768,11 @@ 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"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -830,8 +817,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(R.string.selfConsumption) -> {
|
getString(R.string.selfConsumption) -> {
|
||||||
// addFragmentOnTop(UbicadorFragmentNew.newInstance(entryPoint, true))
|
addFragmentOnTop(UbicadorFragment.newInstance(entryPoint, true))
|
||||||
addFragmentOnTop(UbicadorFragment6869.newInstance(entryPoint, true))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(R.string.titlePackingHolland) -> {
|
getString(R.string.titlePackingHolland) -> {
|
||||||
|
@ -957,13 +943,15 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
}
|
}
|
||||||
|
|
||||||
"PREITEMPICKERTEST" -> {
|
"PREITEMPICKERTEST" -> {
|
||||||
|
|
||||||
addFragmentOnTop(
|
addFragmentOnTop(
|
||||||
CollectionFragmentPickerPreviousNew.newInstance(
|
CollectionFragmentPickerPreviousNewInterface.newInstance(
|
||||||
CollectionTicket(collectionFk = entryPoint.toInt()),
|
CollectionTicket(collectionFk = entryPoint.toInt()),
|
||||||
"PREITEMPICKERTEST",
|
"PREITEMPICKERTEST",
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1071,15 +1059,11 @@ 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(
|
||||||
CollectionFragmentPickerPreviousNew.newInstance(
|
CollectionFragmentPickerPreviousNewInterfaceSacador.newInstance(
|
||||||
collection, type, hasPicking
|
collection, type, hasPicking
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
/* addFragmentOnTop(
|
|
||||||
CollectionFragmentPickerNew.newInstance(
|
|
||||||
collection, type, hasPicking
|
|
||||||
)
|
|
||||||
)*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1124,19 +1108,6 @@ 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(
|
||||||
|
@ -1146,10 +1117,10 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
}
|
}
|
||||||
|
|
||||||
fun openFragmentPickers(delete: Boolean) {
|
fun openFragmentPickers(delete: Boolean) {
|
||||||
//delete_Fragments()
|
//deleteFragments()
|
||||||
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||||
if (delete) {
|
if (delete) {
|
||||||
delete_Fragments()
|
deleteFragments()
|
||||||
}
|
}
|
||||||
addFragment(
|
addFragment(
|
||||||
SacadorFragment.newInstance("PREPARED"),
|
SacadorFragment.newInstance("PREPARED"),
|
||||||
|
@ -1228,14 +1199,13 @@ 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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
private fun checkTokenRenew() {
|
||||||
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,6 +18,7 @@ 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
|
||||||
|
@ -60,6 +61,7 @@ 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)
|
||||||
|
@ -79,6 +81,7 @@ class ObservFragment(
|
||||||
setEvents()
|
setEvents()
|
||||||
setObservations()
|
setObservations()
|
||||||
loadImages()
|
loadImages()
|
||||||
|
viewModel.getTypeDMS()
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,8 +247,8 @@ class ObservFragment(
|
||||||
warehouseId = mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
warehouseId = mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
||||||
WAREHOUSEFK
|
WAREHOUSEFK
|
||||||
),
|
),
|
||||||
companyId = 442,
|
companyId = mobileApplication.dataStoreApp.readDataStoreKey<Int>(COMPANYFK),
|
||||||
dmsTypeId = 27,
|
dmsTypeId = dmsType!!,
|
||||||
reference = mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
reference = mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
||||||
ENTRYID
|
ENTRYID
|
||||||
).toString(),
|
).toString(),
|
||||||
|
@ -266,6 +269,18 @@ 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
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,13 +293,14 @@ 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 = 442,
|
companyId = mobileApplication.dataStoreApp.readDataStoreKey<Int>(COMPANYFK),
|
||||||
dmsTypeId = 27,
|
dmsTypeId = dmsType!!,
|
||||||
reference = mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
reference = mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
||||||
ENTRYID
|
ENTRYID
|
||||||
).toString(),
|
).toString(),
|
||||||
|
@ -294,7 +310,6 @@ class ObservFragment(
|
||||||
hasFile = false,
|
hasFile = false,
|
||||||
urlImage = saveBitmapAsTempFile(requireContext(), bitmap)
|
urlImage = saveBitmapAsTempFile(requireContext(), bitmap)
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}, object : OnImageTrashClickListener {
|
}, object : OnImageTrashClickListener {
|
||||||
|
|
|
@ -49,8 +49,15 @@ class PackagingCountFragment(
|
||||||
override fun init() {
|
override fun init() {
|
||||||
|
|
||||||
viewModel.getItemsPackaging(
|
viewModel.getItemsPackaging(
|
||||||
mobileApplication.dataStoreApp.readDataStoreKey(SUPPLIERID),
|
mobileApplication.dataStoreApp.readDataStoreKey<Int>(SUPPLIERID),
|
||||||
mobileApplication.dataStoreApp.readDataStoreKey(ENTRYID)
|
mobileApplication.dataStoreApp.readDataStoreKey<Int>(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())
|
||||||
|
@ -106,8 +113,8 @@ class PackagingCountFragment(
|
||||||
event.getContentIfNotHandled().notNull {
|
event.getContentIfNotHandled().notNull {
|
||||||
|
|
||||||
viewModel.getItemsPackaging(
|
viewModel.getItemsPackaging(
|
||||||
mobileApplication.dataStoreApp.readDataStoreKey(SUPPLIERID),
|
mobileApplication.dataStoreApp.readDataStoreKey<Int>(SUPPLIERID),
|
||||||
mobileApplication.dataStoreApp.readDataStoreKey(ENTRYID)
|
mobileApplication.dataStoreApp.readDataStoreKey<Int>(ENTRYID)
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,8 +48,8 @@ class PackagingSummaryFragment(
|
||||||
|
|
||||||
|
|
||||||
viewModel.getItemsPackaging(
|
viewModel.getItemsPackaging(
|
||||||
mobileApplication.dataStoreApp.readDataStoreKey(SUPPLIERID),
|
mobileApplication.dataStoreApp.readDataStoreKey<Int>(SUPPLIERID),
|
||||||
mobileApplication.dataStoreApp.readDataStoreKey(ENTRYID)
|
mobileApplication.dataStoreApp.readDataStoreKey<Int>(ENTRYID)
|
||||||
)
|
)
|
||||||
|
|
||||||
ma.hideBottomNavigation(View.GONE)
|
ma.hideBottomNavigation(View.GONE)
|
||||||
|
|
|
@ -6,6 +6,7 @@ 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
|
||||||
|
@ -108,11 +109,19 @@ 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
|
elementSelected.id.toInt()
|
||||||
)
|
)
|
||||||
|
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 ?: ""
|
||||||
|
|
|
@ -7,6 +7,7 @@ import androidx.lifecycle.map
|
||||||
import es.verdnatura.domain.SalixCallback
|
import es.verdnatura.domain.SalixCallback
|
||||||
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.packaging.model.DmsType
|
||||||
import es.verdnatura.presentation.view.feature.packaging.model.EntryList
|
import es.verdnatura.presentation.view.feature.packaging.model.EntryList
|
||||||
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
|
||||||
|
@ -34,6 +35,9 @@ class SupplierViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
val supplierList: LiveData<SupplierList>
|
val supplierList: LiveData<SupplierList>
|
||||||
get() = _supplierList
|
get() = _supplierList
|
||||||
|
|
||||||
|
private val _dmsTypeId by lazy { MutableLiveData<DmsType>() }
|
||||||
|
val dmsTypeId: MutableLiveData<DmsType> = _dmsTypeId
|
||||||
|
|
||||||
private val _entryList by lazy { MutableLiveData<EntryList>() }
|
private val _entryList by lazy { MutableLiveData<EntryList>() }
|
||||||
val entryList: LiveData<EntryList>
|
val entryList: LiveData<EntryList>
|
||||||
get() = _entryList
|
get() = _entryList
|
||||||
|
@ -70,6 +74,23 @@ class SupplierViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getTypeDMS() {
|
||||||
|
salix.getDmsType(
|
||||||
|
filter = """{"where":{"code":"entry"}}"""
|
||||||
|
).enqueue(object : SalixCallback<DmsType>(context) {
|
||||||
|
|
||||||
|
override fun onSuccess(response: Response<DmsType>) {
|
||||||
|
_dmsTypeId.value = response.body()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError(t: Throwable) {
|
||||||
|
_dmsTypeId.value = DmsType(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
fun getEntriesFromSupplier(supplier: Number) {
|
fun getEntriesFromSupplier(supplier: Number) {
|
||||||
val calendar = Calendar.getInstance()
|
val calendar = Calendar.getInstance()
|
||||||
calendar.add(Calendar.DAY_OF_YEAR, 0)
|
calendar.add(Calendar.DAY_OF_YEAR, 0)
|
||||||
|
|
|
@ -9,7 +9,7 @@ data class EntrySalix(
|
||||||
var created: String? = null,
|
var created: String? = null,
|
||||||
var supplierFk: Number? = null,
|
var supplierFk: Number? = null,
|
||||||
var travelFk: Number? = null,
|
var travelFk: Number? = null,
|
||||||
var companyFk: Number? = null,
|
var companyFk: Number,
|
||||||
var observation: String? = null,
|
var observation: String? = null,
|
||||||
var travel: TravelSalix? = null,
|
var travel: TravelSalix? = null,
|
||||||
var isError: Boolean = false,
|
var isError: Boolean = false,
|
||||||
|
@ -29,7 +29,8 @@ fun List<EntrySalix>.toDateFormat(): ArrayList<EntrySalix> {
|
||||||
entries.add(
|
entries.add(
|
||||||
EntrySalix(
|
EntrySalix(
|
||||||
dated = convertToDateString(it.dated),
|
dated = convertToDateString(it.dated),
|
||||||
created = convertToDateString(it.created)
|
created = convertToDateString(it.created),
|
||||||
|
companyFk = it.companyFk
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -46,3 +47,7 @@ data class NotificationQueue(
|
||||||
val authorFk: Int,
|
val authorFk: Int,
|
||||||
val params: String
|
val params: String
|
||||||
)
|
)
|
||||||
|
|
||||||
|
data class DmsType(
|
||||||
|
val id: Int
|
||||||
|
)
|
||||||
|
|
|
@ -282,12 +282,22 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
|
||||||
)
|
)
|
||||||
//sacador
|
//sacador
|
||||||
if (isOnReservationModeSector == true || (!existSectorOnReservationMode && isOnReservationMode)) {
|
if (isOnReservationModeSector == true || (!existSectorOnReservationMode && isOnReservationMode)) {
|
||||||
|
|
||||||
_pasillerositem.add(
|
_pasillerositem.add(
|
||||||
PasillerosItemVO(
|
PasillerosItemVO(
|
||||||
R.drawable.ic_picker_ui, R.string.sacador_test, R.string.sacador_test
|
R.drawable.ic_picker_ui, R.string.sacador_test, R.string.sacador_test
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//a quitar
|
||||||
|
_pasillerositem.add(
|
||||||
|
PasillerosItemVO(
|
||||||
|
R.drawable.ic_picker_ui, R.string.titlePickers, R.string.titlePickersDescrip
|
||||||
|
|
||||||
|
)
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
_pasillerositem.add(
|
_pasillerositem.add(
|
||||||
PasillerosItemVO(
|
PasillerosItemVO(
|
||||||
R.drawable.ic_picker_ui, R.string.titlePickers, R.string.titlePickersDescrip
|
R.drawable.ic_picker_ui, R.string.titlePickers, R.string.titlePickersDescrip
|
||||||
|
@ -418,21 +428,25 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
|
||||||
workerActivityAdd(CodeWorkerAction.PREVIOUS)
|
workerActivityAdd(CodeWorkerAction.PREVIOUS)
|
||||||
|
|
||||||
if (isOnReservationModeSector == true || (!existSectorOnReservationMode && isOnReservationMode)) {
|
if (isOnReservationModeSector == true || (!existSectorOnReservationMode && isOnReservationMode)) {
|
||||||
|
|
||||||
_pasillerositem.add(
|
_pasillerositem.add(
|
||||||
PasillerosItemVO(
|
PasillerosItemVO(
|
||||||
R.drawable.ic_previous_presacador,
|
R.drawable.ic_previous_presacador,
|
||||||
R.string.titlePrePickerTest,
|
R.string.preSacadorInterfaz,
|
||||||
R.string.titlePickerDescrip
|
R.string.preSacadorInterfaz
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
_pasillerositem.add(
|
_pasillerositem.add(
|
||||||
PasillerosItemVO(
|
PasillerosItemVO(
|
||||||
R.drawable.ic_previous_presacador,
|
R.drawable.ic_previous_presacador,
|
||||||
R.string.titlePrePicker,
|
R.string.titlePrePicker,
|
||||||
R.string.titlePickerDescrip
|
R.string.titlePrePicker
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -542,13 +556,6 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
/* _pasillerositem.add(
|
|
||||||
PasillerosItemVO(
|
|
||||||
R.drawable.revision_icon,
|
|
||||||
R.string.titleShelvingHistorical,
|
|
||||||
R.string.titleShelvingHistDescrip
|
|
||||||
)
|
|
||||||
)*/
|
|
||||||
|
|
||||||
_pasillerositem.add(
|
_pasillerositem.add(
|
||||||
PasillerosItemVO(
|
PasillerosItemVO(
|
||||||
|
|
|
@ -365,7 +365,7 @@ class EndSacadorFragment(
|
||||||
responseCode.observe(viewLifecycleOwner, Observer {
|
responseCode.observe(viewLifecycleOwner, Observer {
|
||||||
|
|
||||||
if (!goBack2) {
|
if (!goBack2) {
|
||||||
if (it==null) {
|
if (it == null) {
|
||||||
customDialog.setTitle(getString(R.string.error))
|
customDialog.setTitle(getString(R.string.error))
|
||||||
.setDescription(getString(R.string.itemNotValid))
|
.setDescription(getString(R.string.itemNotValid))
|
||||||
.setKoButton(getString(R.string.close)) {
|
.setKoButton(getString(R.string.close)) {
|
||||||
|
@ -609,7 +609,6 @@ class EndSacadorFragment(
|
||||||
|
|
||||||
private fun findSale(txtscan: String, position: Int) {
|
private fun findSale(txtscan: String, position: Int) {
|
||||||
var index = 0
|
var index = 0
|
||||||
var isBreak = false
|
|
||||||
var isOk = false
|
var isOk = false
|
||||||
|
|
||||||
val saleVO = sales[position]
|
val saleVO = sales[position]
|
||||||
|
@ -622,7 +621,6 @@ class EndSacadorFragment(
|
||||||
if (mpok != null) mpok!!.start()
|
if (mpok != null) mpok!!.start()
|
||||||
isOk = true
|
isOk = true
|
||||||
showShelving(position, shelvingIndex)
|
showShelving(position, shelvingIndex)
|
||||||
isBreak = true
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
shelvingIndex += 1
|
shelvingIndex += 1
|
||||||
|
@ -703,14 +701,13 @@ class EndSacadorFragment(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
|
||||||
private fun printShelvingResult(placementSupplyListVO: PlacementSupplyListVO) {
|
private fun printShelvingResult(placementSupplyListVO: PlacementSupplyListVO) {
|
||||||
var shelving = ""
|
var shelving = ""
|
||||||
var item = ""
|
var item = ""
|
||||||
var longName = ""
|
var longName = ""
|
||||||
var total = "0"
|
var total = "0"
|
||||||
var itemShelvingFk = 0
|
var itemShelvingFk = 0
|
||||||
if (!placementSupplyListVO.list.isEmpty()) {
|
if (placementSupplyListVO.list.isNotEmpty()) {
|
||||||
val placement = placementSupplyListVO.list[0]
|
val placement = placementSupplyListVO.list[0]
|
||||||
shelving = placement.shelving
|
shelving = placement.shelving
|
||||||
item = placement.itemFk
|
item = placement.itemFk
|
||||||
|
@ -775,7 +772,7 @@ class EndSacadorFragment(
|
||||||
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.SHOW_IMPLICIT
|
InputMethodManager.HIDE_IMPLICIT_ONLY
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -928,11 +925,8 @@ class EndSacadorFragment(
|
||||||
val iconEraser = ImageView(context)
|
val iconEraser = ImageView(context)
|
||||||
iconEraser.setImageResource(R.drawable.previous_delete)
|
iconEraser.setImageResource(R.drawable.previous_delete)
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
iconParking.tooltipText = getTooltip(R.drawable.ic_local_parking_black_24dp)
|
||||||
iconParking.tooltipText = getTooltip(R.drawable.ic_local_parking_black_24dp)
|
iconEraser.tooltipText = getTooltip(R.drawable.previous_delete)
|
||||||
iconEraser.tooltipText = getTooltip(R.drawable.previous_delete)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//listIcons.add(iconEraser)
|
//listIcons.add(iconEraser)
|
||||||
listIcons.add(iconParking)
|
listIcons.add(iconParking)
|
||||||
|
@ -1005,11 +999,10 @@ class EndSacadorFragment(
|
||||||
increaseQuantity(position, customDialogThreeButtons.getValue().toInt())
|
increaseQuantity(position, customDialogThreeButtons.getValue().toInt())
|
||||||
scanRequest()
|
scanRequest()
|
||||||
customDialogThreeButtons.dismiss()
|
customDialogThreeButtons.dismiss()
|
||||||
}catch (_:Exception){
|
} catch (_: Exception) {
|
||||||
getString(R.string.errorInput).toast(requireContext())
|
getString(R.string.errorInput).toast(requireContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}.setKoButton(getString(R.string.cancel)) {
|
}.setKoButton(getString(R.string.cancel)) {
|
||||||
scanRequest()
|
scanRequest()
|
||||||
customDialogThreeButtons.dismiss()
|
customDialogThreeButtons.dismiss()
|
||||||
|
|
|
@ -6,10 +6,10 @@ 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.formatWithQuotes
|
import es.verdnatura.domain.formatWithQuotes
|
||||||
|
import es.verdnatura.domain.getMessageFromAllResponse
|
||||||
|
import es.verdnatura.domain.nameofFunction
|
||||||
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.ResponseItemVO
|
import es.verdnatura.presentation.common.ResponseItemVO
|
||||||
import es.verdnatura.presentation.view.feature.collection.SalixSaleQuantity
|
import es.verdnatura.presentation.view.feature.collection.SalixSaleQuantity
|
||||||
|
|
|
@ -2,6 +2,7 @@ package es.verdnatura.presentation.view.feature.sacador.fragment
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
|
import android.os.Bundle
|
||||||
import android.text.InputType
|
import android.text.InputType
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
|
@ -16,16 +17,13 @@ import es.verdnatura.domain.toast
|
||||||
import es.verdnatura.presentation.base.BaseFragment
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
import es.verdnatura.presentation.common.OnCollectionSelectedListener
|
import es.verdnatura.presentation.common.OnCollectionSelectedListener
|
||||||
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
||||||
import es.verdnatura.presentation.common.TAG
|
|
||||||
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
|
||||||
import es.verdnatura.presentation.view.component.CustomDialogInput
|
import es.verdnatura.presentation.view.component.CustomDialogInput
|
||||||
import es.verdnatura.presentation.view.feature.sacador.adapter.CollectionAdapter
|
import es.verdnatura.presentation.view.feature.sacador.adapter.CollectionAdapter
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||||
|
|
||||||
class SacadorFragment(
|
class SacadorFragment :
|
||||||
var type: String
|
|
||||||
) :
|
|
||||||
BaseFragment<FragmentSacadorBinding, SacadorViewModel>(SacadorViewModel::class) {
|
BaseFragment<FragmentSacadorBinding, SacadorViewModel>(SacadorViewModel::class) {
|
||||||
|
|
||||||
private var onCollectionSelectedListener: OnCollectionSelectedListener? = null
|
private var onCollectionSelectedListener: OnCollectionSelectedListener? = null
|
||||||
|
@ -35,9 +33,16 @@ class SacadorFragment(
|
||||||
private lateinit var customDialogInput: CustomDialogInput
|
private lateinit var customDialogInput: CustomDialogInput
|
||||||
private var collectionsList: ArrayList<CollectionVO> = ArrayList()
|
private var collectionsList: ArrayList<CollectionVO> = ArrayList()
|
||||||
private var adapter: CollectionAdapter? = null
|
private var adapter: CollectionAdapter? = null
|
||||||
|
private var type: String = ""
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun newInstance(type: String) = SacadorFragment(type)
|
private const val ARG_TYPE = "arg_type"
|
||||||
|
|
||||||
|
fun newInstance(type: String) = SacadorFragment().apply {
|
||||||
|
arguments = Bundle().apply {
|
||||||
|
putString(ARG_TYPE, type)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onAttach(context: Context) {
|
override fun onAttach(context: Context) {
|
||||||
|
@ -45,6 +50,11 @@ class SacadorFragment(
|
||||||
if (context is OnCollectionSelectedListener) onCollectionSelectedListener = context
|
if (context is OnCollectionSelectedListener) onCollectionSelectedListener = context
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
type = arguments?.getString(ARG_TYPE) ?: ""
|
||||||
|
}
|
||||||
|
|
||||||
override fun getLayoutId(): Int = R.layout.fragment_sacador
|
override fun getLayoutId(): Int = R.layout.fragment_sacador
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
|
@ -132,7 +142,6 @@ class SacadorFragment(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
iconVehicleIn.drawable -> ma.onVehicleSelected(SacadorFragment.TAG)
|
|
||||||
iconPrint.drawable -> {
|
iconPrint.drawable -> {
|
||||||
showPrintPrevious()
|
showPrintPrevious()
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ import es.verdnatura.domain.toast
|
||||||
import es.verdnatura.presentation.base.BaseFragment
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
import es.verdnatura.presentation.common.OnCollectionTicketSelectedListener
|
import es.verdnatura.presentation.common.OnCollectionTicketSelectedListener
|
||||||
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
||||||
import es.verdnatura.presentation.common.TAG
|
|
||||||
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
||||||
import es.verdnatura.presentation.common.convertToDateString
|
import es.verdnatura.presentation.common.convertToDateString
|
||||||
import es.verdnatura.presentation.view.component.CustomDialog
|
import es.verdnatura.presentation.view.component.CustomDialog
|
||||||
|
@ -134,7 +133,6 @@ class SacadorFragmentNew(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
iconVehicleIn.drawable -> ma.onVehicleSelected(SacadorFragment.TAG)
|
|
||||||
iconPrint.drawable -> {
|
iconPrint.drawable -> {
|
||||||
showPrintPrevious()
|
showPrintPrevious()
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,9 @@ 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.domain.SalixCallback
|
import es.verdnatura.domain.SalixCallback
|
||||||
|
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.common.ResponseItemVO
|
import es.verdnatura.presentation.common.ResponseItemVO
|
||||||
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLogSalixList
|
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLogSalixList
|
||||||
|
|
|
@ -38,7 +38,7 @@ data class Sale(
|
||||||
val longName: String,
|
val longName: String,
|
||||||
val size: Int,
|
val size: Int,
|
||||||
var semaphore: String?,
|
var semaphore: String?,
|
||||||
val color: String = "",
|
var color: String = "",
|
||||||
val productor: String? = "",
|
val productor: String? = "",
|
||||||
val origin: String = "",
|
val origin: String = "",
|
||||||
val concept: String = "",
|
val concept: String = "",
|
||||||
|
@ -69,7 +69,9 @@ data class Sale(
|
||||||
var accumulatedQuantity: Int = 0,
|
var accumulatedQuantity: Int = 0,
|
||||||
var totalItemShelving: Int = 0,
|
var totalItemShelving: Int = 0,
|
||||||
var currentItemShelving: Int = 0,
|
var currentItemShelving: Int = 0,
|
||||||
var stateCode: String? = ""
|
var stateCode: String? = "",
|
||||||
|
var ticketOrder: Int? = null,
|
||||||
|
val username: String? = null
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -305,3 +307,5 @@ data class TicketStateSalix(
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data class ItemShelvingSale(val saleFk: Number, val itemShelvingFk: Number)
|
||||||
|
|
|
@ -17,7 +17,7 @@ class AutomaticAdapter(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateItems( list: List<Long>){
|
fun updateItems(list: List<Long>) {
|
||||||
items = list
|
items = list
|
||||||
notifyDataSetChanged()
|
notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
@ -26,9 +26,6 @@ class AutomaticAdapter(
|
||||||
|
|
||||||
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 {
|
|
||||||
onAutomaticItemClickListener.onAutomaticItemClickListener(position)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inner class ItemHolder(
|
inner class ItemHolder(
|
||||||
|
@ -37,10 +34,12 @@ class AutomaticAdapter(
|
||||||
private val res = binding.root.context.resources
|
private val res = binding.root.context.resources
|
||||||
fun bind(item: Long) {
|
fun bind(item: Long) {
|
||||||
binding.itemfkText.text = item.toString()
|
binding.itemfkText.text = item.toString()
|
||||||
|
binding.deleteItem.setOnClickListener {
|
||||||
|
onAutomaticItemClickListener.onAutomaticItemClickListener(
|
||||||
|
layoutPosition
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
/* binding.apply {
|
|
||||||
this.item = item
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -24,10 +24,8 @@ class AutomaticAddItemFragment(
|
||||||
) : BaseFragment<FragmentAutomaticAddItemBinding, UbicadorViewModel>(
|
) : BaseFragment<FragmentAutomaticAddItemBinding, UbicadorViewModel>(
|
||||||
UbicadorViewModel::class
|
UbicadorViewModel::class
|
||||||
) {
|
) {
|
||||||
|
|
||||||
private var adapter: AutomaticAdapter? = null
|
private var adapter: AutomaticAdapter? = null
|
||||||
private var listItems: ArrayList<Long> = ArrayList()
|
private var listItems: ArrayList<Long> = ArrayList()
|
||||||
private var contador = 0
|
|
||||||
private lateinit var customDialogList: CustomDialogList
|
private lateinit var customDialogList: CustomDialogList
|
||||||
private var listShelvings: ArrayList<BarcodeVO> = ArrayList()
|
private var listShelvings: ArrayList<BarcodeVO> = ArrayList()
|
||||||
private var listShelvingsAdapter: BarcodeAdapter? = null
|
private var listShelvingsAdapter: BarcodeAdapter? = null
|
||||||
|
@ -54,19 +52,22 @@ class AutomaticAddItemFragment(
|
||||||
|
|
||||||
private fun setSubtitle() {
|
private fun setSubtitle() {
|
||||||
binding.mainToolbar.toolbarSubtitle.text =
|
binding.mainToolbar.toolbarSubtitle.text =
|
||||||
getString(R.string.doubleText, getString(R.string.labels), contador.toString())
|
getString(
|
||||||
|
R.string.doubleText,
|
||||||
|
getString(R.string.labels),
|
||||||
|
(listItems.size).toString()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setViews() {
|
private fun setViews() {
|
||||||
adapter = AutomaticAdapter(listItems, object : OnAutomaticItemClickListener {
|
adapter = AutomaticAdapter(listItems, object : OnAutomaticItemClickListener {
|
||||||
override fun onAutomaticItemClickListener(position: Int) {
|
override fun onAutomaticItemClickListener(position: Int) {
|
||||||
contador -= 1
|
|
||||||
setSubtitle()
|
|
||||||
if (listItems.size > position) {
|
if (listItems.size > position) {
|
||||||
listItems.removeAt(position)
|
listItems.removeAt(position)
|
||||||
adapter!!.notifyDataSetChanged()
|
adapter!!.notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
setSubtitle()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
binding.itemsRecyclerview.adapter = adapter
|
binding.itemsRecyclerview.adapter = adapter
|
||||||
|
@ -80,8 +81,6 @@ class AutomaticAddItemFragment(
|
||||||
|
|
||||||
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) {
|
||||||
if (binding.editMatricula.text.toString().isNotEmpty()) {
|
if (binding.editMatricula.text.toString().isNotEmpty()) {
|
||||||
contador += 1
|
|
||||||
setSubtitle()
|
|
||||||
try {
|
try {
|
||||||
listItems.add(
|
listItems.add(
|
||||||
0,
|
0,
|
||||||
|
@ -92,6 +91,7 @@ class AutomaticAddItemFragment(
|
||||||
).toString().toLong()
|
).toString().toLong()
|
||||||
|
|
||||||
)
|
)
|
||||||
|
setSubtitle()
|
||||||
adapter!!.notifyItemInserted(0)
|
adapter!!.notifyItemInserted(0)
|
||||||
binding.itemsRecyclerview.scrollToPosition(0)
|
binding.itemsRecyclerview.scrollToPosition(0)
|
||||||
} catch (ex: Exception) {
|
} catch (ex: Exception) {
|
||||||
|
|
|
@ -57,7 +57,7 @@ import java.util.Locale
|
||||||
import kotlin.math.ceil
|
import kotlin.math.ceil
|
||||||
|
|
||||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||||
class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewModel>(
|
class UbicadorFragment : BaseFragment<FragmentUbicadorBinding, UbicadorViewModel>(
|
||||||
UbicadorViewModel::class
|
UbicadorViewModel::class
|
||||||
) {
|
) {
|
||||||
private var shelvingFk: String = ""
|
private var shelvingFk: String = ""
|
||||||
|
@ -89,7 +89,7 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
||||||
private const val ARG_SHELVINGFK = "shelvingFk"
|
private const val ARG_SHELVINGFK = "shelvingFk"
|
||||||
private const val ARG_ISAUTOSELF = "autoSelf"
|
private const val ARG_ISAUTOSELF = "autoSelf"
|
||||||
fun newInstance(shelvingFk: String, isAutoSelf: Boolean = false) =
|
fun newInstance(shelvingFk: String, isAutoSelf: Boolean = false) =
|
||||||
UbicadorFragment6869().apply {
|
UbicadorFragment().apply {
|
||||||
arguments = Bundle().apply {
|
arguments = Bundle().apply {
|
||||||
putString(ARG_SHELVINGFK, shelvingFk)
|
putString(ARG_SHELVINGFK, shelvingFk)
|
||||||
putBoolean(ARG_ISAUTOSELF, isAutoSelf)
|
putBoolean(ARG_ISAUTOSELF, isAutoSelf)
|
||||||
|
@ -105,10 +105,6 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*fun newInstance(entryPoint: String, autoSelf: Boolean = false) =
|
|
||||||
UbicadorFragmentNew(entryPoint, autoSelf)
|
|
||||||
}*/
|
|
||||||
|
|
||||||
override fun getLayoutId(): Int = R.layout.fragment_ubicador
|
override fun getLayoutId(): Int = R.layout.fragment_ubicador
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
super.onPause()
|
super.onPause()
|
||||||
|
@ -155,8 +151,8 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
||||||
private fun setDialogs() {
|
private fun setDialogs() {
|
||||||
customDialogInput = CustomDialogInput(requireContext())
|
customDialogInput = CustomDialogInput(requireContext())
|
||||||
customDialog = CustomDialog(requireContext())
|
customDialog = CustomDialog(requireContext())
|
||||||
customDialogOlder = CustomDialog(requireContext())
|
// customDialogOlder = CustomDialog(requireContext())
|
||||||
customDialogTwoButtons = CustomDialogTwoButtons(requireContext())
|
// customDialogTwoButtons = CustomDialogTwoButtons(requireContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setToolBar() {
|
private fun setToolBar() {
|
||||||
|
@ -259,8 +255,9 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
||||||
customDialogReset.setTitle(getString(R.string.checkItemShelvingDescrip))
|
customDialogReset.setTitle(getString(R.string.checkItemShelvingDescrip))
|
||||||
.setDescription(getString(R.string.checkItemShelving))
|
.setDescription(getString(R.string.checkItemShelving))
|
||||||
.setOkButton(getString(R.string.ok)) {
|
.setOkButton(getString(R.string.ok)) {
|
||||||
if (listItems.isNotEmpty())
|
if (listItems.isNotEmpty()) viewModel.itemShelvingDeleteChecked(
|
||||||
viewModel.itemShelvingDeleteChecked(listItems[0].shelvingFk)
|
listItems[0].shelvingFk
|
||||||
|
)
|
||||||
customDialogReset.dismiss()
|
customDialogReset.dismiss()
|
||||||
}.setKoButton(getString(R.string.cancel)) {
|
}.setKoButton(getString(R.string.cancel)) {
|
||||||
customDialogReset.dismiss()
|
customDialogReset.dismiss()
|
||||||
|
@ -479,15 +476,15 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
||||||
private fun customDialogActionChange() {
|
private fun customDialogActionChange() {
|
||||||
|
|
||||||
//Tarea 7920
|
//Tarea 7920
|
||||||
/* if (listItems.isNotEmpty()) {
|
|
||||||
viewModel.shelvingChangeSalix(
|
if (listItems.isNotEmpty()) {
|
||||||
shelvingFk, customDialogInput.getValue()
|
viewModel.getShelvingFkFromCode(
|
||||||
)
|
listItems[0].shelvingFk, customDialogInput.getValue()
|
||||||
} else {*/
|
)
|
||||||
viewModel.getShelvingFkFromCode(
|
} else {
|
||||||
listItems[0].shelvingFk, customDialogInput.getValue()
|
getString(R.string.shelvingItems).toast(requireContext())
|
||||||
)
|
}
|
||||||
// }
|
|
||||||
shelvingFk = customDialogInput.getValue()
|
shelvingFk = customDialogInput.getValue()
|
||||||
|
|
||||||
customDialogInput.dismiss()
|
customDialogInput.dismiss()
|
||||||
|
@ -597,6 +594,16 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
responseItemShelvingSaleReserve.observe(viewLifecycleOwner) {
|
||||||
|
ma.messageWithSound(
|
||||||
|
getString(R.string.messageItemReserve),
|
||||||
|
isError = true,
|
||||||
|
isPlayed = true,
|
||||||
|
titleWithError = "",
|
||||||
|
true
|
||||||
|
)
|
||||||
}
|
}
|
||||||
responseLogAdd.observe(viewLifecycleOwner) {
|
responseLogAdd.observe(viewLifecycleOwner) {
|
||||||
isShelvinLogfromMainScreen = false
|
isShelvinLogfromMainScreen = false
|
||||||
|
@ -642,7 +649,7 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
||||||
event.getContentIfNotHandled().notNull {
|
event.getContentIfNotHandled().notNull {
|
||||||
|
|
||||||
if (it.list.isNotEmpty()) {
|
if (it.list.isNotEmpty()) {
|
||||||
|
customDialogOlder = CustomDialog(requireContext())
|
||||||
val oldList = it.list.filter { item ->
|
val oldList = it.list.filter { item ->
|
||||||
item.itemCreated!!.contains("old", ignoreCase = true)
|
item.itemCreated!!.contains("old", ignoreCase = true)
|
||||||
}.map { item ->
|
}.map { item ->
|
||||||
|
@ -679,47 +686,64 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
||||||
|
|
||||||
var finalOutput = ""
|
var finalOutput = ""
|
||||||
if (oldList.isNotEmpty()) {
|
if (oldList.isNotEmpty()) {
|
||||||
finalOutput =
|
finalOutput = getString(R.string.ubicationItemNewer, resultStringOld)
|
||||||
getString(R.string.ubicationItemNewer, resultStringOld)
|
|
||||||
}
|
}
|
||||||
if (newList.isNotEmpty()) {
|
if (newList.isNotEmpty()) {
|
||||||
finalOutput += getString(R.string.ubicationItemOlder, resultStringNew)
|
finalOutput += getString(R.string.ubicationItemOlder, resultStringNew)
|
||||||
}
|
}
|
||||||
customDialogOlder.setTitle(getString(R.string.info))
|
customDialogOlder.setTitle(getString(R.string.info)).setDescription(
|
||||||
.setDescription(
|
finalOutput
|
||||||
finalOutput
|
).setOkButton(
|
||||||
).setOkButton(
|
getString(R.string.ok)
|
||||||
getString(R.string.ok)
|
) {
|
||||||
) {
|
when (it.originalAction) {
|
||||||
when (it.originalAction) {
|
Action.PARKINEAR -> viewModel.setParking(
|
||||||
Action.PARKINEAR -> viewModel.setParking(
|
it.originalShelvingFk, it.originalParking
|
||||||
it.originalShelvingFk, it.originalParking
|
)
|
||||||
|
|
||||||
|
Action.TRANSFERIR -> {
|
||||||
|
viewModel.itemShelvingTransfer(
|
||||||
|
it.itemShelvingFk!!, it.originalShelvingFk
|
||||||
)
|
)
|
||||||
|
|
||||||
Action.TRANSFERIR -> {
|
|
||||||
println("transfer item ${it.itemShelvingFk}")
|
|
||||||
println("transfer carro ${it.originalShelvingFk}")
|
|
||||||
viewModel.itemShelvingTransfer(
|
|
||||||
it.itemShelvingFk!!,
|
|
||||||
it.originalShelvingFk
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
null -> d("", "no action")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
null -> d("", "no action")
|
||||||
|
}
|
||||||
|
|
||||||
customDialogOlder.dismiss()
|
//tarea 7412
|
||||||
|
viewModel.notificationQueues(
|
||||||
|
notification = "misallocation-warehouse",
|
||||||
|
workerfk = mobileApplication.userId!!,
|
||||||
|
body = if (it.originalAction == Action.PARKINEAR) {
|
||||||
|
getString(
|
||||||
|
R.string.actionParking,
|
||||||
|
it.originalAction,
|
||||||
|
it.originalShelvingFk,
|
||||||
|
it.originalParking,
|
||||||
|
mobileApplication.userName!!
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
getString(
|
||||||
|
R.string.tansferItem,
|
||||||
|
it.originalAction,
|
||||||
|
it.originalItem,
|
||||||
|
it.originalParking,
|
||||||
|
mobileApplication.userName!!
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
customDialogOlder.dismiss()
|
||||||
|
|
||||||
}.setKoButton(getString(R.string.cancel)) {
|
}.setKoButton(getString(R.string.cancel)) {
|
||||||
customDialogOlder.dismiss()
|
customDialogOlder.dismiss()
|
||||||
}.setCancelable(true)
|
}.setCancelable(true)
|
||||||
customDialogOlder.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
|
customDialogOlder.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
|
||||||
|
|
||||||
|
|
||||||
|
Handler(Looper.getMainLooper()).postDelayed({
|
||||||
|
if (finalOutput != "") customDialogOlder.show()
|
||||||
|
}, 1000)
|
||||||
}
|
}
|
||||||
Handler(Looper.getMainLooper()).postDelayed({
|
|
||||||
customDialogOlder.show()
|
|
||||||
}, 1000)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -869,7 +893,6 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
||||||
.setItemValue(itemUbicador.item.id.toString())
|
.setItemValue(itemUbicador.item.id.toString())
|
||||||
.setPackingValue(itemUbicador.packing.toString())
|
.setPackingValue(itemUbicador.packing.toString())
|
||||||
.setVisibleValue(itemUbicador.visible.toString())
|
.setVisibleValue(itemUbicador.visible.toString())
|
||||||
//.setEtiquetaValue((itemUbicador.visible / (itemUbicador.packing ?: 0)).toString())
|
|
||||||
.setEtiquetaValue(itemUbicador.stickers.toString()).setUnits(
|
.setEtiquetaValue(itemUbicador.stickers.toString()).setUnits(
|
||||||
if (itemUbicador.stickers != null && itemUbicador.stickers != 0) {
|
if (itemUbicador.stickers != null && itemUbicador.stickers != 0) {
|
||||||
(itemUbicador.visible % itemUbicador.stickers!!).toString()
|
(itemUbicador.visible % itemUbicador.stickers!!).toString()
|
||||||
|
@ -1103,12 +1126,12 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
||||||
customDialogUbicador.setVisibleValue("")
|
customDialogUbicador.setVisibleValue("")
|
||||||
customDialogUbicador.setVisibleValue(
|
customDialogUbicador.setVisibleValue(
|
||||||
(((customDialogUbicador.getEtiquetaValue().toIntOrNull()
|
(((customDialogUbicador.getEtiquetaValue().toIntOrNull()
|
||||||
?: 0) * (customDialogUbicador.getPackingValue().toIntOrNull()
|
?: 0) * (customDialogUbicador.getPackingValue().toIntOrNull() ?: 0))).toString()
|
||||||
?: 0)) + (customDialogUbicador.getUnitsValue().toIntOrNull() ?: 0)).toString()
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showMoreOptions(item: ItemShelving) {
|
private fun showMoreOptions(item: ItemShelving) {
|
||||||
|
customDialogTwoButtons = CustomDialogTwoButtons(requireContext())
|
||||||
customDialogTwoButtons.setTitle(item.item.id.toString())
|
customDialogTwoButtons.setTitle(item.item.id.toString())
|
||||||
.setDescription(getString(R.string.selectAction))
|
.setDescription(getString(R.string.selectAction))
|
||||||
.setOkButton(getString(R.string.transfer)) {
|
.setOkButton(getString(R.string.transfer)) {
|
||||||
|
@ -1140,8 +1163,8 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
||||||
}
|
}
|
||||||
).setOkButton(getString(R.string.delete)) {
|
).setOkButton(getString(R.string.delete)) {
|
||||||
if (!isAutoSelf) {
|
if (!isAutoSelf) {
|
||||||
listItems.remove(item)
|
// listItems.remove(item)
|
||||||
adapter!!.notifyItemRemoved(listItems.indexOf(item))
|
//adapter!!.notifyItemRemoved(listItems.indexOf(item))
|
||||||
viewModel.itemShelvingDelete(
|
viewModel.itemShelvingDelete(
|
||||||
item.id
|
item.id
|
||||||
)
|
)
|
||||||
|
@ -1164,8 +1187,7 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
||||||
.setOkButtonThree(getString(R.string.print)) {
|
.setOkButtonThree(getString(R.string.print)) {
|
||||||
val printerDialogManager = PrinterDialogManager(requireContext())
|
val printerDialogManager = PrinterDialogManager(requireContext())
|
||||||
printerDialogManager.showPrintDialog(
|
printerDialogManager.showPrintDialog(
|
||||||
item.item.id,
|
item.item.id, item.description ?: ""
|
||||||
item.description ?: ""
|
|
||||||
) { id, labelType, packing, copies ->
|
) { id, labelType, packing, copies ->
|
||||||
|
|
||||||
if (item.buyFk == null) {
|
if (item.buyFk == null) {
|
||||||
|
@ -1174,10 +1196,9 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
||||||
warehouseFk = mobileApplication.dataStoreApp.readDataStoreKey(
|
warehouseFk = mobileApplication.dataStoreApp.readDataStoreKey(
|
||||||
WAREHOUSEFK
|
WAREHOUSEFK
|
||||||
),
|
),
|
||||||
dated = LocalDate.now()
|
dated = LocalDate.now().format(
|
||||||
.format(
|
DateTimeFormatter.ofPattern("yyyy-dd-MM")
|
||||||
DateTimeFormatter.ofPattern("yyyy-dd-MM")
|
),
|
||||||
),
|
|
||||||
reportName = "LabelBuy",
|
reportName = "LabelBuy",
|
||||||
printerFk = mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
printerFk = mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
||||||
ConstAndValues.PRINTERFK
|
ConstAndValues.PRINTERFK
|
||||||
|
@ -1191,37 +1212,14 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
||||||
customDialogTwoButtons.dismiss()
|
customDialogTwoButtons.dismiss()
|
||||||
} else {
|
} else {
|
||||||
printItem(
|
printItem(
|
||||||
item.buyFk!!, labelType, packing, copies
|
item.buyFk, labelType, packing, copies
|
||||||
)
|
)
|
||||||
customDialogTwoButtons.dismiss()
|
customDialogTwoButtons.dismiss()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
customDialogInput.getEditText().requestFocus()
|
customDialogInput.getEditText().requestFocus()
|
||||||
}
|
}
|
||||||
//Tarea 7763
|
|
||||||
/*
|
|
||||||
.setOkButtonThree(getString(R.string.rename)) {
|
|
||||||
customDialogInput.setTitle(getString(R.string.itemNew))
|
|
||||||
.setDescription(getString(R.string.scanItem)).setValue("")
|
|
||||||
.setOkButton(getString(R.string.rename)) {
|
|
||||||
|
|
||||||
actionRename(item, customDialogInput.getValue())
|
|
||||||
|
|
||||||
}.setKoButton(getString(R.string.cancel)) {
|
|
||||||
customDialogInput.dismiss()
|
|
||||||
customDialogTwoButtons.dismiss()
|
|
||||||
}.show()
|
|
||||||
customDialogInput.getEditText().setOnEditorActionListener { _, actionId, _ ->
|
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
|
||||||
|
|
||||||
actionRename(item, customDialogInput.getValue())
|
|
||||||
return@setOnEditorActionListener true
|
|
||||||
}
|
|
||||||
false
|
|
||||||
}
|
|
||||||
customDialogInput.getEditText().requestFocus()
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
customDialogTwoButtons.setKoButton(getString(R.string.cancel)) {
|
customDialogTwoButtons.setKoButton(getString(R.string.cancel)) {
|
||||||
customDialogTwoButtons.dismiss()
|
customDialogTwoButtons.dismiss()
|
||||||
}
|
}
|
||||||
|
@ -1281,14 +1279,7 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
||||||
|
|
||||||
private fun customDialogTransferAction(item: ItemShelving) {
|
private fun customDialogTransferAction(item: ItemShelving) {
|
||||||
if (customDialogInput.getValue().isNotEmpty()) {
|
if (customDialogInput.getValue().isNotEmpty()) {
|
||||||
/*tearea 6964*/
|
|
||||||
// }
|
|
||||||
/* viewModel.hasItemOlder(
|
|
||||||
shelvingFk = shelvingFk,
|
|
||||||
parking = customDialogInput.getValue(),
|
|
||||||
itemFk = item.id,
|
|
||||||
action = Action.TRANSFERIR
|
|
||||||
)*/
|
|
||||||
viewModel.getParkingToTransfer(
|
viewModel.getParkingToTransfer(
|
||||||
shelvingFkTo = customDialogInput.getValue(),
|
shelvingFkTo = customDialogInput.getValue(),
|
||||||
itemShelvingFk = item.id,
|
itemShelvingFk = item.id,
|
||||||
|
@ -1296,8 +1287,7 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
||||||
shelvingFkFrom = shelvingFk
|
shelvingFkFrom = shelvingFk
|
||||||
)
|
)
|
||||||
println("transfer item ${item.id}")
|
println("transfer item ${item.id}")
|
||||||
println("transfer carro ${customDialogInput.getValue()}")
|
println("transfer carro ${customDialogInput.getValue()}")/* viewModel.itemShelvingTransfer(
|
||||||
/* viewModel.itemShelvingTransfer(
|
|
||||||
item.id, customDialogInput.getValue()
|
item.id, customDialogInput.getValue()
|
||||||
)*/
|
)*/
|
||||||
listItems.remove(item)
|
listItems.remove(item)
|
File diff suppressed because it is too large
Load Diff
|
@ -11,6 +11,7 @@ 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.NotiticationUseCase
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
import es.verdnatura.presentation.common.Action
|
import es.verdnatura.presentation.common.Action
|
||||||
import es.verdnatura.presentation.common.Event
|
import es.verdnatura.presentation.common.Event
|
||||||
|
@ -18,6 +19,8 @@ import es.verdnatura.presentation.common.ItemShelvingSalix
|
||||||
import es.verdnatura.presentation.common.ResponseHasOlder
|
import es.verdnatura.presentation.common.ResponseHasOlder
|
||||||
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.claim.fragment.reubication.model.ReubicationList
|
import es.verdnatura.presentation.view.feature.claim.fragment.reubication.model.ReubicationList
|
||||||
|
import es.verdnatura.presentation.view.feature.packaging.model.NotificationQueue
|
||||||
|
import es.verdnatura.presentation.view.feature.sacador.model.ItemShelvingSale
|
||||||
import es.verdnatura.presentation.view.feature.ubicador.model.ItemBuy
|
import es.verdnatura.presentation.view.feature.ubicador.model.ItemBuy
|
||||||
import es.verdnatura.presentation.view.feature.ubicador.model.ItemShelvingNewer
|
import es.verdnatura.presentation.view.feature.ubicador.model.ItemShelvingNewer
|
||||||
import es.verdnatura.presentation.view.feature.ubicador.model.ItemShelvingNewerList
|
import es.verdnatura.presentation.view.feature.ubicador.model.ItemShelvingNewerList
|
||||||
|
@ -28,15 +31,23 @@ import es.verdnatura.presentation.view.feature.workermistake.model.MakeMultiSali
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.Calendar
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
class UbicadorViewModel(val 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 notificationUseCase = NotiticationUseCase(salix)
|
||||||
|
|
||||||
private val _responseUbicator by lazy { MutableLiveData<Boolean>() }
|
private val _responseUbicator by lazy { MutableLiveData<Boolean>() }
|
||||||
val responseUbicator: LiveData<Boolean>
|
val responseUbicator: LiveData<Boolean>
|
||||||
get() = _responseUbicator
|
get() = _responseUbicator
|
||||||
|
|
||||||
|
private val _responseItemShelvingSaleReserve by lazy { MutableLiveData<Boolean>() }
|
||||||
|
val responseItemShelvingSaleReserve: LiveData<Boolean>
|
||||||
|
get() = _responseItemShelvingSaleReserve
|
||||||
|
|
||||||
private val _responseHasOlder by lazy { MutableLiveData<ResponseHasOlder>() }
|
private val _responseHasOlder by lazy { MutableLiveData<ResponseHasOlder>() }
|
||||||
val responseHasOlder: LiveData<ResponseHasOlder>
|
val responseHasOlder: LiveData<ResponseHasOlder>
|
||||||
get() = _responseHasOlder
|
get() = _responseHasOlder
|
||||||
|
@ -247,47 +258,6 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun hasItemOlder(
|
|
||||||
shelvingFk: String,
|
|
||||||
parking: String?,
|
|
||||||
itemFk: Int?,
|
|
||||||
action: Action?,
|
|
||||||
itemShelvingFk: Number? = null
|
|
||||||
|
|
||||||
) {
|
|
||||||
salix.getListItemNewerNew(shelvingFk, parking, itemFk)
|
|
||||||
//salix.getListItemNewer(shelvingFk, parking)
|
|
||||||
.enqueue(object : SalixCallback<List<ItemShelvingNewer>>(context) {
|
|
||||||
|
|
||||||
override fun onSuccess(response: Response<List<ItemShelvingNewer>>) {
|
|
||||||
|
|
||||||
if (response.body()!!.isEmpty()) {
|
|
||||||
when (action) {
|
|
||||||
Action.PARKINEAR -> setParking(shelvingFk, parking!!)
|
|
||||||
Action.TRANSFERIR -> {
|
|
||||||
itemShelvingTransfer(itemShelvingFk!!, shelvingFk)
|
|
||||||
}
|
|
||||||
|
|
||||||
null -> setParking(shelvingFk, parking!!)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
_shelvingListItemNewer.value =
|
|
||||||
response.body()?.let {
|
|
||||||
ItemShelvingNewerList(
|
|
||||||
it,
|
|
||||||
originalShelvingFk = shelvingFk,
|
|
||||||
originalParking = parking!!,
|
|
||||||
originalItem = itemFk,
|
|
||||||
originalAction = action
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getItemsByReviewOrder(
|
fun getItemsByReviewOrder(
|
||||||
shelving: String,
|
shelving: String,
|
||||||
parking: String?,
|
parking: String?,
|
||||||
|
@ -310,7 +280,7 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
Action.PARKINEAR -> setParking(shelving, parking!!)
|
Action.PARKINEAR -> setParking(shelving, parking!!)
|
||||||
Action.TRANSFERIR -> {
|
Action.TRANSFERIR -> {
|
||||||
|
|
||||||
itemShelvingTransfer(itemShelvingFk!!, shelving!!)
|
itemShelvingTransfer(itemShelvingFk!!, shelving)
|
||||||
}
|
}
|
||||||
|
|
||||||
null -> d("", "No action")
|
null -> d("", "No action")
|
||||||
|
@ -380,6 +350,26 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getMergeFromCode(
|
||||||
|
vShelft: Int, shelvingCode: String
|
||||||
|
|
||||||
|
) {
|
||||||
|
|
||||||
|
salix.shelvingGetFromCode(
|
||||||
|
filter = """{"where":{"code":"$shelvingCode"}}"""
|
||||||
|
).enqueue(object : SalixCallback<ItemUbicador>(context) {
|
||||||
|
|
||||||
|
override fun onSuccess(response: Response<ItemUbicador>) {
|
||||||
|
val myItemCode = response.body().let { it as ItemUbicador }
|
||||||
|
|
||||||
|
itemShelvingMerge(
|
||||||
|
vShelft, myItemCode.id.toString()
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
fun itemShelvingMerge(
|
fun itemShelvingMerge(
|
||||||
vShelf: Int, shelvingFk: String
|
vShelf: Int, shelvingFk: String
|
||||||
|
|
||||||
|
@ -502,24 +492,6 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun shelvingChangeSalix(
|
|
||||||
shelvingFkIn: String, shelvingFkOut: String
|
|
||||||
|
|
||||||
) {
|
|
||||||
salix.itemShelvingsUpdate(
|
|
||||||
where = JsonObject().apply {
|
|
||||||
addProperty("shelvingFk", shelvingFkIn)
|
|
||||||
},
|
|
||||||
hashMapOf("shelvingFk" to shelvingFkOut)
|
|
||||||
).enqueue(object : SalixCallback<Any>(context) {
|
|
||||||
|
|
||||||
override fun onSuccess(response: Response<Any>) {
|
|
||||||
_responseUbicator.value = true
|
|
||||||
super.onSuccess(response)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
//tarea 7920
|
//tarea 7920
|
||||||
fun shelvingChangeSalixNew(
|
fun shelvingChangeSalixNew(
|
||||||
shelvingFkIn: Number, shelvingFkOut: Number
|
shelvingFkIn: Number, shelvingFkOut: Number
|
||||||
|
@ -557,6 +529,26 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun itemShelvingAlternativeFromCode(
|
||||||
|
shelvingCode: String
|
||||||
|
|
||||||
|
) {
|
||||||
|
|
||||||
|
salix.shelvingGetFromCode(
|
||||||
|
filter = """{"where":{"code":"$shelvingCode"}}"""
|
||||||
|
).enqueue(object : SalixCallback<ItemUbicador>(context) {
|
||||||
|
|
||||||
|
override fun onSuccess(response: Response<ItemUbicador>) {
|
||||||
|
val myItemCode = response.body().let { it as ItemUbicador }
|
||||||
|
|
||||||
|
itemShelvingAlternative(
|
||||||
|
myItemCode.id.toString()
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
fun itemShelvingTransfer(
|
fun itemShelvingTransfer(
|
||||||
itemShelvingFk: Number, shelvingFk: String
|
itemShelvingFk: Number, shelvingFk: String
|
||||||
|
|
||||||
|
@ -572,13 +564,33 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun itemShelvingDelete(itemShelvingFk: Int) {
|
fun itemShelvingDelete(itemShelvingFk: Int) {
|
||||||
salix.itemShelvingsDelete(itemShelvingFk).enqueue(object : SalixCallback<Any>(context) {
|
|
||||||
|
|
||||||
override fun onSuccess(response: Response<Any>) {
|
val calendar = Calendar.getInstance()
|
||||||
_responseUbicator.value = true
|
calendar.add(Calendar.DAY_OF_YEAR, 0)
|
||||||
|
val dateFormat = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault())
|
||||||
|
val today = dateFormat.format(calendar.time)
|
||||||
|
|
||||||
|
salix.itemShelvingSaleTotalBySale(
|
||||||
|
filter = """
|
||||||
|
{"where":{"itemShelvingFk":$itemShelvingFk,"created":{"gte":"$today"}},"limit":10}
|
||||||
|
""".trimIndent()
|
||||||
|
).enqueue(object : SalixCallback<List<ItemShelvingSale>>(context) {
|
||||||
|
override fun onSuccess(response: Response<List<ItemShelvingSale>>) {
|
||||||
|
if (response.body()!!.isEmpty())
|
||||||
|
salix.itemShelvingsDelete(itemShelvingFk)
|
||||||
|
.enqueue(object : SalixCallback<Any>(context) {
|
||||||
|
|
||||||
|
override fun onSuccess(response: Response<Any>) {
|
||||||
|
_responseUbicator.value = true
|
||||||
|
|
||||||
|
}
|
||||||
|
}) else {
|
||||||
|
_responseItemShelvingSaleReserve.value = false
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun itemShelvingSelfConsumption(shelvingFk: String, itemFk: Number, quantity: Int) {
|
fun itemShelvingSelfConsumption(shelvingFk: String, itemFk: Number, quantity: Int) {
|
||||||
|
@ -605,6 +617,18 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun notificationQueues(notification: String, workerfk: Int, body: String) {
|
||||||
|
notificationUseCase.executeSendNotification(
|
||||||
|
NotificationQueue(
|
||||||
|
notification,
|
||||||
|
workerfk,
|
||||||
|
body
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.enqueue(object : SalixCallback<Void>(context) {
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
fun printItem(
|
fun printItem(
|
||||||
reportName: String,
|
reportName: String,
|
||||||
printerFk: Int,
|
printerFk: Int,
|
||||||
|
|
|
@ -12,7 +12,7 @@ import es.verdnatura.presentation.base.BaseFragment
|
||||||
import es.verdnatura.presentation.common.GeneralAdapter
|
import es.verdnatura.presentation.common.GeneralAdapter
|
||||||
import es.verdnatura.presentation.common.GeneralItem
|
import es.verdnatura.presentation.common.GeneralItem
|
||||||
import es.verdnatura.presentation.common.OnCollectionSelectedListener
|
import es.verdnatura.presentation.common.OnCollectionSelectedListener
|
||||||
import es.verdnatura.presentation.common.OnGeneralItemRowClickListener
|
import es.verdnatura.presentation.common.OnGeneralRowClickListener
|
||||||
import es.verdnatura.presentation.view.component.CustomDialogList
|
import es.verdnatura.presentation.view.component.CustomDialogList
|
||||||
import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryViewModel
|
import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryViewModel
|
||||||
import es.verdnatura.presentation.view.feature.workermistake.model.MistakeType
|
import es.verdnatura.presentation.view.feature.workermistake.model.MistakeType
|
||||||
|
@ -118,9 +118,11 @@ class PackingMistakeFragment(var menuOrigin: String) :
|
||||||
|
|
||||||
|
|
||||||
listMistakesAdapter =
|
listMistakesAdapter =
|
||||||
GeneralAdapter(listMistakes, object : OnGeneralItemRowClickListener {
|
GeneralAdapter(listMistakes, onRowClickListener = object : OnGeneralRowClickListener {
|
||||||
override fun onGeneralItemRowClickListener(item: GeneralItem) {
|
|
||||||
|
override fun onRowClickListener(item: GeneralItem) {
|
||||||
list.forEach {
|
list.forEach {
|
||||||
|
|
||||||
if (it.description == item.text) {
|
if (it.description == item.text) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -140,11 +142,12 @@ class PackingMistakeFragment(var menuOrigin: String) :
|
||||||
customDialogList.dismiss()
|
customDialogList.dismiss()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
customDialogList.getRecyclerView().adapter = listMistakesAdapter
|
customDialogList.getRecyclerView().adapter = listMistakesAdapter
|
||||||
customDialogList.getRecyclerView().layoutManager =
|
customDialogList.getRecyclerView().layoutManager =
|
||||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||||
|
|
|
@ -63,6 +63,15 @@
|
||||||
android:textColor="@color/verdnatura_white"
|
android:textColor="@color/verdnatura_white"
|
||||||
android:textSize="@dimen/body2" />
|
android:textSize="@dimen/body2" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/reserve"
|
||||||
|
android:textColor="@color/verdnatura_white"
|
||||||
|
android:textSize="@dimen/body2" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
|
@ -1,17 +1,14 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<layout xmlns:tools="http://schemas.android.com/tools"
|
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:clickable="false">
|
android:clickable="false">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/verdnatura_black"
|
android:background="@color/verdnatura_black">
|
||||||
>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
|
@ -19,27 +16,26 @@
|
||||||
style="@style/ScanLineTextSearch"
|
style="@style/ScanLineTextSearch"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:autofillHints="text"
|
||||||
android:hint="@string/Escaner"
|
android:hint="@string/Escaner"
|
||||||
android:inputType="textVisiblePassword"
|
android:inputType="textVisiblePassword"
|
||||||
android:lines="1"
|
android:lines="1"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:autofillHints="text"
|
android:paddingStart="@dimen/default_layout_margin"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@+id/main_toolbar"
|
app:layout_constraintTop_toTopOf="@+id/main_toolbar" />
|
||||||
android:paddingStart="@dimen/default_layout_margin"/>
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/previaButton"
|
android:id="@+id/previaButton"
|
||||||
android:layout_width="32dp"
|
android:layout_width="32dp"
|
||||||
android:layout_height="32dp"
|
android:layout_height="32dp"
|
||||||
android:visibility="invisible"
|
|
||||||
android:tooltipText="@string/allowMarkSalesPrevia"
|
|
||||||
android:contentDescription="@string/previousCollected"
|
android:contentDescription="@string/previousCollected"
|
||||||
app:srcCompat="@drawable/ic_streetview_black_24dp"
|
android:tooltipText="@string/allowMarkSalesPrevia"
|
||||||
|
android:visibility="invisible"
|
||||||
app:layout_constraintStart_toEndOf="@+id/scan_input"
|
app:layout_constraintStart_toEndOf="@+id/scan_input"
|
||||||
app:layout_constraintTop_toTopOf="@+id/scan_input"
|
app:layout_constraintTop_toTopOf="@+id/scan_input"
|
||||||
/>
|
app:srcCompat="@drawable/ic_streetview_black_24dp" />
|
||||||
|
|
||||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
android:id="@+id/collection_swipe"
|
android:id="@+id/collection_swipe"
|
||||||
|
@ -52,12 +48,11 @@
|
||||||
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/fragment_sacador_collections"
|
android:id="@+id/fragment_sacador_collections"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
tools:listitem="@layout/sale_row_fragment" />
|
tools:listitem="@layout/sale_row_fragment_reserve_sacador" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||||
|
|
|
@ -1,75 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:paddingTop="@dimen/toolbar_height"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="@dimen/layout_margin_min"
|
|
||||||
android:layout_marginBottom="@dimen/layout_margin_1"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:paddingStart="@dimen/layout_margin_min"
|
|
||||||
android:paddingEnd="@dimen/layout_margin_min">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="start"
|
|
||||||
android:text="@string/Worker"
|
|
||||||
android:textColor="@color/verdnatura_white"
|
|
||||||
android:textSize="@dimen/body2" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="start"
|
|
||||||
android:text="@string/InTimed"
|
|
||||||
android:textColor="@color/verdnatura_white"
|
|
||||||
android:textSize="@dimen/body2" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="@string/OutTimed"
|
|
||||||
android:textColor="@color/verdnatura_white"
|
|
||||||
android:textSize="@dimen/body2" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/historicovehiculo_recyclerview"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:clipToPadding="false"
|
|
||||||
tools:listitem="@layout/item_historicovehiculo_row" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<include
|
|
||||||
android:id="@+id/main_toolbar"
|
|
||||||
layout="@layout/toolbar_fragment"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
</layout>
|
|
|
@ -1,117 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<ScrollView
|
|
||||||
android:id="@+id/scroll_view"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
|
||||||
android:id="@+id/scan_input"
|
|
||||||
style="@style/ScanLineTextSearch"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:hint="@string/Escaneaetiqueta"
|
|
||||||
android:inputType="text"
|
|
||||||
android:lines="1"
|
|
||||||
android:maxLines="1" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="@dimen/layout_margin_min"
|
|
||||||
android:layout_marginBottom="@dimen/layout_margin_1"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:paddingStart="@dimen/layout_margin_min"
|
|
||||||
android:paddingEnd="@dimen/layout_margin_min">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="@string/itemfk"
|
|
||||||
android:textColor="@color/verdnatura_white"
|
|
||||||
android:textSize="@dimen/body2" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="@string/name"
|
|
||||||
android:textColor="@color/verdnatura_white"
|
|
||||||
android:textSize="@dimen/body2" />
|
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="2"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="@string/wagoon"
|
|
||||||
android:textColor="@color/verdnatura_white"
|
|
||||||
android:textSize="@dimen/body2" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="end"
|
|
||||||
android:text="@string/quantity"
|
|
||||||
android:textColor="@color/verdnatura_white"
|
|
||||||
android:textSize="@dimen/body2" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:descendantFocusability="blocksDescendants">
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/itemshelvinglog_recyclerview"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:clipToPadding="false"
|
|
||||||
android:visibility="visible"
|
|
||||||
tools:listitem="@layout/item_shelvinglog_row" />
|
|
||||||
<Button
|
|
||||||
android:id="@+id/load_more_button"
|
|
||||||
android:layout_width="200dp"
|
|
||||||
android:layout_height="40dp"
|
|
||||||
android:text="Cargar más resultados"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:background="@color/verdnatura_orange_salix"
|
|
||||||
android:textColor="@color/verdnatura_white"
|
|
||||||
android:layout_below="@id/itemshelvinglog_recyclerview"
|
|
||||||
android:layout_marginTop="16dp"
|
|
||||||
android:visibility="gone" />
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
|
|
||||||
</ScrollView>
|
|
||||||
|
|
||||||
<include
|
|
||||||
android:id="@+id/main_toolbar"
|
|
||||||
layout="@layout/toolbar_fragment"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
</layout>
|
|
|
@ -22,8 +22,7 @@
|
||||||
android:id="@+id/webView"
|
android:id="@+id/webView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginTop="0dp"
|
android:layout_marginTop="0dp" />
|
||||||
/>
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</layout>
|
</layout>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue