Compare commits
91 Commits
Author | SHA1 | Date |
---|---|---|
|
75258f1763 | |
|
091b597f34 | |
|
b26cf1b76f | |
|
d3679ae52c | |
|
3ec49358ad | |
|
028d0b85aa | |
|
e78dfdac0e | |
|
f499915ef4 | |
|
3844855b19 | |
|
4ceb51b59e | |
|
4524e3a887 | |
|
ad370ba09a | |
|
889dcd1fe8 | |
|
097db01ac3 | |
|
49d6e2801d | |
|
41993fdd07 | |
|
dd8894ff39 | |
|
2f639cc1c0 | |
|
983043382d | |
|
5153bf62a2 | |
|
54a679f0ce | |
|
36f8a43f34 | |
|
6af6f92192 | |
|
2a0b251b14 | |
|
bf5cbf37a8 | |
|
aede2d4051 | |
|
16b84ce2ec | |
|
31c715c40d | |
|
c72c76bdb3 | |
|
ebf09db00d | |
|
44053fa039 | |
|
f9e19bb9ca | |
|
c3ea43e7e1 | |
|
04380327ab | |
|
8d1110d09e | |
|
12e5241a10 | |
|
612b2ac8f2 | |
|
ad42096eca | |
|
a7f476417e | |
|
a6ad406623 | |
|
fbd7a8d95c | |
|
009c221de3 | |
|
1689d100d5 | |
|
feedd08879 | |
|
1ab7280d66 | |
|
24ec314f34 | |
|
c3a4366d7d | |
|
6d4277cf91 | |
|
54687e2e05 | |
|
e0b148ddfd | |
|
0b42a3c61b | |
|
d49d6cf0ba | |
|
df8dc7cc77 | |
|
0c8df1c7a1 | |
|
5d600359fa | |
|
f55bd3768f | |
|
6233545418 | |
|
2295497e62 | |
|
aae791f721 | |
|
f96d809afe | |
|
6f155fbe36 | |
|
a97b823695 | |
|
1943296492 | |
|
568c3e687b | |
|
ab262dc328 | |
|
ed6171da78 | |
|
b6115837ae | |
|
103df4e31e | |
|
2d9870a930 | |
|
884d6abdd9 | |
|
136d2de399 | |
|
455f72c352 | |
|
d9abe0ab08 | |
|
ff9849589e | |
|
43b1d828e8 | |
|
26151605fa | |
|
b03d1c48c5 | |
|
ab064e52aa | |
|
0fe4c3c7d3 | |
|
a0ae1e37f1 | |
|
361ebddd2f | |
|
611e6d2993 | |
|
18ebdfc92a | |
|
0cdec41ca0 | |
|
0709fe3127 | |
|
298e17210a | |
|
df764e0960 | |
|
8e413e7f60 | |
|
083317beb2 | |
|
bdbe219549 | |
|
657deb8541 |
|
@ -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>
|
||||||
|
|
|
@ -0,0 +1,169 @@
|
||||||
|
apply plugin: 'com.android.application'
|
||||||
|
apply plugin: 'kotlin-android'
|
||||||
|
apply plugin: 'kotlin-kapt'
|
||||||
|
apply plugin: 'com.google.gms.google-services'
|
||||||
|
apply plugin: 'com.google.firebase.crashlytics'
|
||||||
|
apply plugin: 'com.google.devtools.ksp'
|
||||||
|
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace = "es.verdnatura"
|
||||||
|
compileSdk 34
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "es.verdnatura"
|
||||||
|
minSdkVersion 26
|
||||||
|
targetSdkVersion 33 // se deja con target si no Play Protect la bloquea
|
||||||
|
versionCode 330
|
||||||
|
versionName = "24.38"
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
/*debuggable false
|
||||||
|
shrinkResources true
|
||||||
|
minifyEnabled true*/
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
|
||||||
|
//package de la app general = "package_name": "es.verdnatura"
|
||||||
|
//package de la app beta = "package_name": "es.verdnatura.sfusion"
|
||||||
|
|
||||||
|
applicationVariants.all { variant ->
|
||||||
|
variant.outputs.all { output ->
|
||||||
|
def flavorName = variant.productFlavors[0].name
|
||||||
|
def apkName
|
||||||
|
|
||||||
|
if (flavorName == "beta") {
|
||||||
|
apkName = "vn-pickingBeta.apk"
|
||||||
|
} else if (flavorName == "general") {
|
||||||
|
apkName = "vn-picking.apk"
|
||||||
|
} else {
|
||||||
|
apkName = "vn-picking.apk"
|
||||||
|
}
|
||||||
|
|
||||||
|
output.outputFileName = apkName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
flavorDimensions += "version"
|
||||||
|
productFlavors {
|
||||||
|
create("beta") {
|
||||||
|
applicationIdSuffix = ".sfusion"
|
||||||
|
}
|
||||||
|
create("general") {
|
||||||
|
//versionNameSuffix = "General"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buildFeatures {
|
||||||
|
viewBinding = true
|
||||||
|
|
||||||
|
}
|
||||||
|
/*kotlinOptions {
|
||||||
|
jvmTarget = "1.8"
|
||||||
|
}
|
||||||
|
buildFeatures {
|
||||||
|
compose = true
|
||||||
|
}
|
||||||
|
kotlin {
|
||||||
|
jvmToolchain(8)
|
||||||
|
}
|
||||||
|
composeOptions {
|
||||||
|
kotlinCompilerExtensionVersion = "1.4.3"
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
dataBinding {
|
||||||
|
enabled = true
|
||||||
|
}
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_17
|
||||||
|
targetCompatibility JavaVersion.VERSION_17
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
implementation 'com.google.firebase:firebase-crashlytics-ktx:19.0.3'
|
||||||
|
implementation 'com.google.firebase:firebase-analytics-ktx:22.0.2'
|
||||||
|
implementation 'com.google.android.gms:play-services-location:21.3.0'
|
||||||
|
implementation 'androidx.navigation:navigation-fragment-ktx:2.7.7'
|
||||||
|
implementation 'androidx.navigation:navigation-ui-ktx:2.7.7'
|
||||||
|
implementation 'androidx.core:core-ktx:1.13.1'
|
||||||
|
kapt "androidx.room:room-compiler:2.6.1"
|
||||||
|
implementation 'androidx.room:room-ktx:2.6.1'
|
||||||
|
debugImplementation fileTree(dir: 'libs/debug', include: ['*.jar'])
|
||||||
|
releaseImplementation fileTree(dir: 'libs/release', include: ['*.jar'])
|
||||||
|
|
||||||
|
//canvas
|
||||||
|
implementation 'com.simplify:ink:1.0.0'
|
||||||
|
|
||||||
|
// Kotlin and Android
|
||||||
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||||
|
implementation 'androidx.appcompat:appcompat:1.7.0'
|
||||||
|
implementation 'androidx.core:core-ktx:1.13.1'
|
||||||
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||||
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
|
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
||||||
|
|
||||||
|
//tests
|
||||||
|
testImplementation 'junit:junit:4.13.2'
|
||||||
|
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
|
||||||
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
|
||||||
|
implementation 'com.google.android.material:material:1.12.0'
|
||||||
|
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
|
||||||
|
implementation 'com.squareup.retrofit2:converter-gson:2.0.2'
|
||||||
|
implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
|
||||||
|
implementation "com.airbnb.android:lottie:$lottieVersion"
|
||||||
|
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
|
||||||
|
|
||||||
|
//Fragments
|
||||||
|
implementation("androidx.fragment:fragment-ktx:1.8.2")
|
||||||
|
|
||||||
|
// Architecture components
|
||||||
|
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.4"
|
||||||
|
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.8.4"
|
||||||
|
implementation "androidx.legacy:legacy-support-v4:1.0.0"
|
||||||
|
|
||||||
|
//Koin new resolve
|
||||||
|
implementation "io.insert-koin:koin-core:$koin"
|
||||||
|
implementation "io.insert-koin:koin-android:$koin"
|
||||||
|
implementation "io.insert-koin:koin-androidx-scope:$koin"
|
||||||
|
implementation "io.insert-koin:koin-androidx-viewmodel:$koin"
|
||||||
|
|
||||||
|
// Image libraries
|
||||||
|
implementation "io.coil-kt:coil:$coil"
|
||||||
|
implementation "com.github.bumptech.glide:glide:$glide"
|
||||||
|
implementation "com.github.bumptech.glide:okhttp3-integration:$glide"
|
||||||
|
//kapt "com.github.bumptech.glide:compiler:$glide"
|
||||||
|
ksp("com.github.bumptech.glide:ksp:$glide")
|
||||||
|
|
||||||
|
// Add the Firebase Crashlytics SDK.
|
||||||
|
implementation 'com.google.firebase:firebase-analytics:22.0.2'
|
||||||
|
|
||||||
|
//search
|
||||||
|
implementation 'com.github.mirrajabi:search-dialog:1.1'
|
||||||
|
|
||||||
|
//logs
|
||||||
|
implementation 'com.jakewharton.timber:timber:4.7.1'
|
||||||
|
|
||||||
|
//pickerImage
|
||||||
|
implementation 'com.github.esafirm:android-image-picker:3.0.0-beta5'
|
||||||
|
|
||||||
|
//preferences
|
||||||
|
implementation("androidx.datastore:datastore-preferences:1.1.1")
|
||||||
|
implementation 'androidx.datastore:datastore-core:1.1.1'
|
||||||
|
|
||||||
|
|
||||||
|
// Compose
|
||||||
|
/* implementation(platform("androidx.compose:compose-bom:2024.02.01"))
|
||||||
|
implementation("androidx.compose.ui:ui")
|
||||||
|
implementation("androidx.compose.material:material")
|
||||||
|
implementation("androidx.compose.runtime:runtime")
|
||||||
|
implementation("androidx.activity:activity-compose:1.8.2")
|
||||||
|
implementation("androidx.compose.ui:ui-graphics")
|
||||||
|
implementation("androidx.compose.ui:ui-tooling-preview")*/
|
||||||
|
}
|
|
@ -5,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 = 405
|
||||||
versionName = "24.51"
|
versionName = "25.12" // REvisor para reservas
|
||||||
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,33 @@ 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)
|
|
||||||
/* implementation("androidx.compose.ui:ui")
|
val composeBom = platform("androidx.compose:compose-bom:2024.10.01")
|
||||||
implementation("androidx.compose.material:material")
|
implementation(composeBom)
|
||||||
implementation("androidx.compose.runtime:runtime")
|
androidTestImplementation(composeBom)
|
||||||
implementation("androidx.activity:activity-compose:1.8.2")
|
// Choose one of the following:
|
||||||
implementation("androidx.compose.ui:ui-graphics")
|
// Material Design 3
|
||||||
implementation("androidx.compose.ui:ui-tooling-preview") */
|
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)
|
||||||
|
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>
|
|
@ -7,6 +7,7 @@ import android.media.MediaPlayer
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
|
import android.widget.Toast
|
||||||
import es.verdnatura.dataStore.DataStoreLocal
|
import es.verdnatura.dataStore.DataStoreLocal
|
||||||
import es.verdnatura.di.viewModelModule
|
import es.verdnatura.di.viewModelModule
|
||||||
import es.verdnatura.domain.ConstAndValues
|
import es.verdnatura.domain.ConstAndValues
|
||||||
|
@ -120,7 +121,8 @@ class MobileApplication : Application(), InteceptorListener {
|
||||||
Color.RED
|
Color.RED
|
||||||
} else {
|
} else {
|
||||||
Color.BLUE
|
Color.BLUE
|
||||||
}
|
},
|
||||||
|
duration = if (isError) Toast.LENGTH_LONG else Toast.LENGTH_SHORT
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,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
|
||||||
|
@ -13,10 +14,9 @@ import es.verdnatura.presentation.view.feature.collection.fragment.CollectionVie
|
||||||
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoViewModel
|
import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlVehiculoViewModel
|
||||||
import es.verdnatura.presentation.view.feature.delivery.viewmodels.DeliveryViewModel
|
import es.verdnatura.presentation.view.feature.delivery.viewmodels.DeliveryViewModel
|
||||||
import es.verdnatura.presentation.view.feature.diadeventa.fragment.DayOfSaleViewModel
|
import es.verdnatura.presentation.view.feature.diadeventa.fragment.DayOfSaleViewModel
|
||||||
|
import es.verdnatura.presentation.view.feature.diadeventa.fragment.DayOfSaleViewModelCompose
|
||||||
import es.verdnatura.presentation.view.feature.historicoarticulo.fragment.HistoricoArticuloViewModel
|
import es.verdnatura.presentation.view.feature.historicoarticulo.fragment.HistoricoArticuloViewModel
|
||||||
import es.verdnatura.presentation.view.feature.historicoshelving.fragment.ItemShelvingLogViewModel
|
|
||||||
import es.verdnatura.presentation.view.feature.historicoshelvinglog.fragment.ShelvingLogViewModel
|
import es.verdnatura.presentation.view.feature.historicoshelvinglog.fragment.ShelvingLogViewModel
|
||||||
import es.verdnatura.presentation.view.feature.historicovehiculo.fragment.HistoricoVehiculoViewModel
|
|
||||||
import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryViewModel
|
import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryViewModel
|
||||||
import es.verdnatura.presentation.view.feature.login.fragment.LoginViewModel
|
import es.verdnatura.presentation.view.feature.login.fragment.LoginViewModel
|
||||||
import es.verdnatura.presentation.view.feature.packaging.fragment.SupplierViewModel
|
import es.verdnatura.presentation.view.feature.packaging.fragment.SupplierViewModel
|
||||||
|
@ -24,6 +24,7 @@ import es.verdnatura.presentation.view.feature.packingHolland.fragment.PackingHo
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.CmrExpeditionPalletViewModel
|
import es.verdnatura.presentation.view.feature.paletizador.fragment.CmrExpeditionPalletViewModel
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionPalletDetailViewModel
|
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionPalletDetailViewModel
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionScanSorterViewModel
|
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionScanSorterViewModel
|
||||||
|
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionScanSorterViewModelCompose
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionScanViewModel
|
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionScanViewModel
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionStateViewModel
|
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionStateViewModel
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionTruckListViewModel
|
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionTruckListViewModel
|
||||||
|
@ -37,15 +38,17 @@ import es.verdnatura.presentation.view.feature.sacador.fragment.SacadorViewModel
|
||||||
import es.verdnatura.presentation.view.feature.sacador.fragment.showticket.ShowTicketViewModel
|
import es.verdnatura.presentation.view.feature.sacador.fragment.showticket.ShowTicketViewModel
|
||||||
import es.verdnatura.presentation.view.feature.ticket.fragment.TicketViewModel
|
import es.verdnatura.presentation.view.feature.ticket.fragment.TicketViewModel
|
||||||
import es.verdnatura.presentation.view.feature.ubicador.fragment.UbicadorViewModel
|
import es.verdnatura.presentation.view.feature.ubicador.fragment.UbicadorViewModel
|
||||||
|
import es.verdnatura.presentation.view.feature.workermistake.fragment.WorkerMistakeViewModel
|
||||||
|
import org.koin.android.ext.koin.androidApplication
|
||||||
import org.koin.android.ext.koin.androidContext
|
import org.koin.android.ext.koin.androidContext
|
||||||
import org.koin.androidx.viewmodel.dsl.viewModel
|
import org.koin.androidx.viewmodel.dsl.viewModel
|
||||||
import org.koin.dsl.module
|
import org.koin.dsl.module
|
||||||
|
|
||||||
val viewModelModule = module {
|
val viewModelModule = module {
|
||||||
|
|
||||||
/* viewModel {
|
viewModel {
|
||||||
WorkermistakeViewModel()
|
WorkerMistakeViewModel(androidApplication())
|
||||||
}*/
|
}
|
||||||
|
|
||||||
// Login
|
// Login
|
||||||
viewModel {
|
viewModel {
|
||||||
|
@ -60,6 +63,9 @@ val viewModelModule = module {
|
||||||
viewModel {
|
viewModel {
|
||||||
DayOfSaleViewModel(androidContext())
|
DayOfSaleViewModel(androidContext())
|
||||||
}
|
}
|
||||||
|
viewModel {
|
||||||
|
DayOfSaleViewModelCompose(androidApplication())
|
||||||
|
}
|
||||||
|
|
||||||
// Pasilleros / Item Card
|
// Pasilleros / Item Card
|
||||||
viewModel {
|
viewModel {
|
||||||
|
@ -76,6 +82,10 @@ val viewModelModule = module {
|
||||||
BuscarItemViewModel(androidContext())
|
BuscarItemViewModel(androidContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
viewModel {
|
||||||
|
BuscarItemComposeViewModel(androidApplication())
|
||||||
|
}
|
||||||
|
|
||||||
// Pasilleros / Buscar Item 2
|
// Pasilleros / Buscar Item 2
|
||||||
|
|
||||||
viewModel {
|
viewModel {
|
||||||
|
@ -103,6 +113,10 @@ val viewModelModule = module {
|
||||||
ExpeditionScanSorterViewModel(androidContext())
|
ExpeditionScanSorterViewModel(androidContext())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
viewModel {
|
||||||
|
ExpeditionScanSorterViewModelCompose(androidApplication())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
viewModel {
|
viewModel {
|
||||||
CmrExpeditionPalletViewModel(androidContext())
|
CmrExpeditionPalletViewModel(androidContext())
|
||||||
|
@ -158,13 +172,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,10 @@ object ConstAndValues {
|
||||||
const val LIMITRECORDSSHELVINGLOG = 50
|
const val LIMITRECORDSSHELVINGLOG = 50
|
||||||
const val RESERVATIONMODE = "operatorReservationMode"
|
const val RESERVATIONMODE = "operatorReservationMode"
|
||||||
const val MODELWORKERTYPEACTIVITY = "APP"
|
const val MODELWORKERTYPEACTIVITY = "APP"
|
||||||
|
const val FLINGTHRESHOLDVELOCITY = 2000f
|
||||||
|
const val FLINGTHRESHOLDVERTICAL = 500f
|
||||||
|
const val SCANNER_THRESHOLD_SPEED: Int = 60
|
||||||
|
const val HUMAN_CHARACTERS_SECOND: Int = 100
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
package es.verdnatura.domain
|
package es.verdnatura.domain
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.graphics.drawable.GradientDrawable
|
import android.graphics.drawable.GradientDrawable
|
||||||
import android.os.Build
|
|
||||||
import android.text.Html
|
import android.text.Html
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.view.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)
|
||||||
val background = GradientDrawable().apply {
|
background = GradientDrawable().apply {
|
||||||
setColor(Color.parseColor("#000000"))
|
setColor(Color.BLACK)
|
||||||
cornerRadius = 16f
|
cornerRadius = 16f
|
||||||
|
alpha = 220
|
||||||
}
|
}
|
||||||
layout.background = background
|
layoutParams = FrameLayout.LayoutParams(
|
||||||
|
ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||||
|
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||||
|
).apply { gravity = Gravity.CENTER }
|
||||||
|
alpha = 0f
|
||||||
|
|
||||||
Toast(this).apply {
|
(rootView as ViewGroup).addView(this)
|
||||||
duration = Toast.LENGTH_LONG
|
|
||||||
view = layout
|
animate().alpha(1f).setDuration(300).withEndAction {
|
||||||
setGravity(Gravity.CENTER, 0, 0)
|
animate().alpha(0f).setStartDelay(1000).setDuration(300)
|
||||||
show()
|
.withEndAction { (rootView).removeView(this) }
|
||||||
|
.start()
|
||||||
|
}.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
|
||||||
|
@ -51,7 +50,7 @@ abstract class SalixCallback<T>(val context: Context) : Callback<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun defaultErrorHandler(t: Throwable) {
|
fun defaultErrorHandler(t: Throwable) {
|
||||||
//println("ErrorSalixx${t.message}")
|
//println("ErrorSalixx${t.message}")
|
||||||
// (nameofFunction((this)) + t.message).toast(context)
|
// (nameofFunction((this)) + t.message).toast(context)
|
||||||
(context as MobileApplication).messageToast(
|
(context as MobileApplication).messageToast(
|
||||||
|
@ -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
|
||||||
|
@ -210,6 +210,11 @@ interface SalixService {
|
||||||
|
|
||||||
): Call<Any>
|
): Call<Any>
|
||||||
|
|
||||||
|
@GET("Sips/findOne")
|
||||||
|
fun sipGetExtension(
|
||||||
|
@Query("filter") filter: String,
|
||||||
|
): Call<Any>
|
||||||
|
|
||||||
@GET("Workers/Summary")
|
@GET("Workers/Summary")
|
||||||
fun getNameWorker(
|
fun getNameWorker(
|
||||||
@Query("filter") filter: String
|
@Query("filter") filter: String
|
||||||
|
@ -403,7 +408,8 @@ interface SalixService {
|
||||||
fun addSale(
|
fun addSale(
|
||||||
@Path("id") id: Number,
|
@Path("id") id: Number,
|
||||||
@Query("quantity") quantity: Number,
|
@Query("quantity") quantity: Number,
|
||||||
@Query("barcode") barcode: String
|
@Query("barcode") barcode: String,
|
||||||
|
@Query("isAdded") isAdded: Boolean = true
|
||||||
): Call<Any>
|
): Call<Any>
|
||||||
|
|
||||||
@POST("Collections/assign")
|
@POST("Collections/assign")
|
||||||
|
@ -414,6 +420,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 +445,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 +457,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 +481,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 +526,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 +548,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 +616,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 +685,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",
|
||||||
|
@ -935,6 +898,11 @@ interface SalixService {
|
||||||
@Body parms: PackingSiteSalix
|
@Body parms: PackingSiteSalix
|
||||||
): Call<Unit>
|
): Call<Unit>
|
||||||
|
|
||||||
|
@GET("Tickets/{id}/exists")
|
||||||
|
fun ticketExists(
|
||||||
|
@Path("id") id: Number,
|
||||||
|
): Call<JsonObject>
|
||||||
|
|
||||||
@PUT("ItemBarCodes")
|
@PUT("ItemBarCodes")
|
||||||
fun barcodesEdit(
|
fun barcodesEdit(
|
||||||
@Body params: ItemBarCodeSalix
|
@Body params: ItemBarCodeSalix
|
||||||
|
@ -960,6 +928,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 +1040,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
|
||||||
|
@ -1077,10 +1055,16 @@ interface SalixService {
|
||||||
@Path("id") id: Number
|
@Path("id") id: Number
|
||||||
): Call<ItemShelving>
|
): Call<ItemShelving>
|
||||||
|
|
||||||
@POST("ItemShelvingSales/itemShelvingSale_addByCollection")
|
@POST("Applications/itemShelvingSale_addByCollection/execute-proc")
|
||||||
|
fun itemShelvingSaleAddByCollection(
|
||||||
|
@Query("schema") schema: String = "vn",
|
||||||
|
@Query("params") params: Any? = null
|
||||||
|
): Call<Any>
|
||||||
|
|
||||||
|
/* @POST("ItemShelvingSales/itemShelvingSale_addByCollection")
|
||||||
fun itemShelvingSaleAddByCollection(
|
fun itemShelvingSaleAddByCollection(
|
||||||
@Body params: Any,
|
@Body params: Any,
|
||||||
): Call<Any>
|
): Call<Any>*/
|
||||||
|
|
||||||
@POST("ItemShelvings/getInventory")
|
@POST("ItemShelvings/getInventory")
|
||||||
fun getInventoryParking(
|
fun getInventoryParking(
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package es.verdnatura.domain.userCases
|
package es.verdnatura.domain.userCases
|
||||||
|
|
||||||
import es.verdnatura.domain.SalixService
|
import es.verdnatura.domain.SalixService
|
||||||
|
import es.verdnatura.presentation.view.feature.packaging.model.NotificationQueue
|
||||||
|
import es.verdnatura.presentation.view.feature.pasillero.model.WorkerActionSalix
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
|
|
||||||
class GetItemFromBarcodeUseCase(private val salixService: SalixService) {
|
class GetItemFromBarcodeUseCase(private val salixService: SalixService) {
|
||||||
|
@ -18,3 +20,24 @@ class GetItemPrintItemUseCase(private val salixService: SalixService) {
|
||||||
return salixService.buyGetLastWithoutInventory(params)
|
return salixService.buyGetLastWithoutInventory(params)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class NotiticationUseCase(private val salixService: SalixService) {
|
||||||
|
fun executeSendNotification(notificationQueue: NotificationQueue): Call<Void> {
|
||||||
|
return salixService.notificationQueues(notificationQueue)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class WorkerActivityUseCase(private val salixService: SalixService) {
|
||||||
|
fun addWorkerActivity(workerActionSalix: WorkerActionSalix): Call<Any> {
|
||||||
|
return salixService.workerActivityAdd(workerActionSalix)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class OperatorUseCase(private val salixService: SalixService) {
|
||||||
|
fun updateOperator(workerFk: Number, update: HashMap<String, Number>): Call<Unit> {
|
||||||
|
return salixService.updateOperator(
|
||||||
|
id = workerFk,
|
||||||
|
params = update
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,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
|
||||||
|
@ -135,6 +136,8 @@ abstract class BaseFragment<T : ViewDataBinding, V : BaseViewModel>(
|
||||||
R.drawable.ic_sign_ticket -> getString(R.string.signed)
|
R.drawable.ic_sign_ticket -> getString(R.string.signed)
|
||||||
R.drawable.ic_send -> getString(R.string.sendDriverRoute)
|
R.drawable.ic_send -> getString(R.string.sendDriverRoute)
|
||||||
R.drawable.ic_add_multiple -> getString(R.string.addItemMultipleShelvings)
|
R.drawable.ic_add_multiple -> getString(R.string.addItemMultipleShelvings)
|
||||||
|
R.drawable.ic_clean_shelving -> getString(R.string.activityOrganize)
|
||||||
|
R.drawable.ic_booking -> getString(R.string.bookingNewSalesCollection)
|
||||||
else -> {
|
else -> {
|
||||||
""
|
""
|
||||||
}
|
}
|
||||||
|
@ -170,7 +173,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
|
||||||
|
|
||||||
|
}
|
|
@ -4,13 +4,18 @@ import android.app.AlertDialog
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.text.InputType
|
import android.text.InputType
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.view.inputmethod.EditorInfo
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.domain.toast
|
import es.verdnatura.domain.toast
|
||||||
|
import es.verdnatura.presentation.view.component.CustomDialogInput
|
||||||
import es.verdnatura.presentation.view.component.CustomDialogList
|
import es.verdnatura.presentation.view.component.CustomDialogList
|
||||||
|
|
||||||
class PrinterDialogManager(private val context: Context) {
|
class PrinterDialogManager(private val context: Context) {
|
||||||
fun showPrintDialog(
|
fun showPrintDialog(
|
||||||
item: Long, itemName: String, onPrintClick: (Long, String, Int?, Int) -> Unit
|
item: Long,
|
||||||
|
itemName: String,
|
||||||
|
onPrintClick: (Long, String, Int?, Int) -> Unit,
|
||||||
|
onPrintChange: (String) -> Unit
|
||||||
) {
|
) {
|
||||||
val customDialogList = CustomDialogList(context)
|
val customDialogList = CustomDialogList(context)
|
||||||
customDialogList.getEditText().setRawInputType(InputType.TYPE_CLASS_NUMBER)
|
customDialogList.getEditText().setRawInputType(InputType.TYPE_CLASS_NUMBER)
|
||||||
|
@ -23,7 +28,9 @@ class PrinterDialogManager(private val context: Context) {
|
||||||
}.setOkTwoButton(context.getString(R.string.printBarcode)) {
|
}.setOkTwoButton(context.getString(R.string.printBarcode)) {
|
||||||
handlePrintClick(item, customDialogList, onPrintClick, "barcode")
|
handlePrintClick(item, customDialogList, onPrintClick, "barcode")
|
||||||
customDialogList.dismiss()
|
customDialogList.dismiss()
|
||||||
|
//Tarea 7823
|
||||||
|
}.setOkThreeButton(context.getString(R.string.changePrinter)) {
|
||||||
|
readQrPrinter(onPrintChange)
|
||||||
}.setKoButton(context.getString(R.string.cancel)) {
|
}.setKoButton(context.getString(R.string.cancel)) {
|
||||||
customDialogList.dismiss()
|
customDialogList.dismiss()
|
||||||
}.setHintValueThree(context.getString(R.string.labelNumber))
|
}.setHintValueThree(context.getString(R.string.labelNumber))
|
||||||
|
@ -32,6 +39,30 @@ class PrinterDialogManager(private val context: Context) {
|
||||||
customDialogList.getFocusThree()
|
customDialogList.getFocusThree()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun readQrPrinter(onPrintChange: (String) -> Unit) {
|
||||||
|
val customDialogInput = CustomDialogInput(context)
|
||||||
|
|
||||||
|
customDialogInput.setTitle(context.getString(R.string.changePrinter))
|
||||||
|
.setDescription(context.getString(R.string.scanQrPrinter))
|
||||||
|
.setOkButton(context.getString(R.string.save)) {
|
||||||
|
onPrintChange(customDialogInput.getValue())
|
||||||
|
customDialogInput.dismiss()
|
||||||
|
|
||||||
|
}.setKoButton(context.getString(R.string.cancel)) {
|
||||||
|
customDialogInput.dismiss()
|
||||||
|
}.setValue("").show()
|
||||||
|
customDialogInput.getEditText().requestFocus()
|
||||||
|
customDialogInput.getEditText().setOnEditorActionListener { _, actionId, _ ->
|
||||||
|
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||||
|
onPrintChange(customDialogInput.getValue())
|
||||||
|
println("printerrr ${customDialogInput.getValue()}")
|
||||||
|
customDialogInput.dismiss()
|
||||||
|
return@setOnEditorActionListener true
|
||||||
|
}
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun handlePrintClick(
|
private fun handlePrintClick(
|
||||||
item: Long,
|
item: Long,
|
||||||
customDialogList: CustomDialogList,
|
customDialogList: CustomDialogList,
|
||||||
|
|
|
@ -26,9 +26,9 @@ data class SaleTrackingSalix(
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
class PackingSiteSalix(
|
data class PackingSiteSalix(
|
||||||
var ticketFk: Int,
|
val ticketFk: Number,
|
||||||
var workerFk: Int
|
val workerFk: Number
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -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)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -55,10 +55,15 @@ fun itemScanValue(value: String, table: Array<String>, field: String): Any {
|
||||||
"more" -> return item.more
|
"more" -> return item.more
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"expeditionPallet" -> {
|
"expeditionPallet" -> {
|
||||||
return item.id
|
return item.id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"printer" -> {
|
||||||
|
return item.id
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw Exception("QR no válido")
|
throw Exception("QR no válido")
|
||||||
|
|
|
@ -0,0 +1,264 @@
|
||||||
|
package es.verdnatura.presentation.composable
|
||||||
|
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.border
|
||||||
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.wrapContentSize
|
||||||
|
import androidx.compose.foundation.lazy.LazyRow
|
||||||
|
import androidx.compose.foundation.lazy.items
|
||||||
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
|
import androidx.compose.foundation.text.KeyboardActions
|
||||||
|
import androidx.compose.foundation.text.KeyboardOptions
|
||||||
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
|
import androidx.compose.material3.HorizontalDivider
|
||||||
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.IconButton
|
||||||
|
import androidx.compose.material3.PlainTooltip
|
||||||
|
import androidx.compose.material3.Switch
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.material3.TextField
|
||||||
|
import androidx.compose.material3.TextFieldDefaults
|
||||||
|
import androidx.compose.material3.TooltipBox
|
||||||
|
import androidx.compose.material3.TooltipDefaults
|
||||||
|
import androidx.compose.material3.rememberTooltipState
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.runtime.setValue
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Alignment.Companion.CenterVertically
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
||||||
|
import androidx.compose.ui.res.colorResource
|
||||||
|
import androidx.compose.ui.res.dimensionResource
|
||||||
|
import androidx.compose.ui.res.painterResource
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.text.TextStyle
|
||||||
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
|
import androidx.compose.ui.text.input.ImeAction
|
||||||
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
import es.verdnatura.R
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
|
@Composable
|
||||||
|
fun CustomToolbar(
|
||||||
|
title: String,
|
||||||
|
subtitle: String? = null,
|
||||||
|
showBackButton: Boolean = true,
|
||||||
|
showSwitch: Boolean = false,
|
||||||
|
iconList: List<IconToolBar> = emptyList(),
|
||||||
|
onBackClick: () -> Unit = {},
|
||||||
|
onSwitchChange: (Boolean) -> Unit = {},
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.background(Color.Black)
|
||||||
|
) {
|
||||||
|
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.height(56.dp),
|
||||||
|
verticalAlignment = CenterVertically,
|
||||||
|
horizontalArrangement = Arrangement.SpaceBetween
|
||||||
|
|
||||||
|
) {
|
||||||
|
if (showBackButton) {
|
||||||
|
IconButton(
|
||||||
|
onClick = { onBackClick() },
|
||||||
|
modifier = Modifier.padding(start = 0.dp),
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
painter = painterResource(id = R.drawable.ic_chevron_left),
|
||||||
|
contentDescription = "Back",
|
||||||
|
tint = Color.White
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Text(
|
||||||
|
modifier = Modifier.weight(1f),
|
||||||
|
text = title,
|
||||||
|
color = Color.White,
|
||||||
|
fontSize = dimensionResource(id = R.dimen.title).value.sp,
|
||||||
|
fontWeight = FontWeight.Bold,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
if (!subtitle.isNullOrEmpty()) {
|
||||||
|
Text(
|
||||||
|
modifier = Modifier.weight(1f),
|
||||||
|
text = subtitle,
|
||||||
|
color = Color.White.copy(alpha = 0.7f),
|
||||||
|
fontSize = dimensionResource(id = R.dimen.subtitle).value.sp
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iconList.isNotEmpty()) {
|
||||||
|
LazyRow(
|
||||||
|
horizontalArrangement = Arrangement.End, // Esto asegura que los iconos estén a la derecha
|
||||||
|
) {
|
||||||
|
items(iconList) { iconToolBar ->
|
||||||
|
TooltipBox(
|
||||||
|
positionProvider = TooltipDefaults.rememberPlainTooltipPositionProvider(),
|
||||||
|
tooltip = {
|
||||||
|
PlainTooltip {
|
||||||
|
Text(iconToolBar.toolTip)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
state = rememberTooltipState()
|
||||||
|
) {
|
||||||
|
IconButton(
|
||||||
|
onClick = { iconToolBar.onClickIcon() },
|
||||||
|
) {
|
||||||
|
|
||||||
|
Icon(
|
||||||
|
painter = painterResource(id = iconToolBar.idRes),
|
||||||
|
contentDescription = iconToolBar.toolTip,
|
||||||
|
tint = Color.White
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (showSwitch) {
|
||||||
|
var switchState by remember { mutableStateOf(false) }
|
||||||
|
Switch(
|
||||||
|
checked = switchState,
|
||||||
|
onCheckedChange = {
|
||||||
|
switchState = it
|
||||||
|
onSwitchChange(it)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HorizontalDivider(
|
||||||
|
thickness = 1.dp,
|
||||||
|
color = colorResource(id = R.color.verdnatura_brown_grey)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
data class IconToolBar(
|
||||||
|
val idRes: Int,
|
||||||
|
val toolTip: String = "",
|
||||||
|
val tint: Color = Color.White,
|
||||||
|
val onClickIcon: () -> Unit,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun ScanLineTextSearch(
|
||||||
|
value: String,
|
||||||
|
onValueChange: (String) -> Unit,
|
||||||
|
onImeAction: () -> Unit,
|
||||||
|
modifier: Modifier = Modifier.wrapContentSize(),
|
||||||
|
) {
|
||||||
|
|
||||||
|
val keyboardController = LocalSoftwareKeyboardController.current
|
||||||
|
|
||||||
|
Box(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
TextField(
|
||||||
|
value = value,
|
||||||
|
onValueChange = onValueChange,
|
||||||
|
textStyle = TextStyle(
|
||||||
|
color = Color.White,
|
||||||
|
textAlign = TextAlign.Center
|
||||||
|
),
|
||||||
|
placeholder = {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = stringResource(id = R.string.Escaneaetiqueta),
|
||||||
|
textAlign = TextAlign.Center,
|
||||||
|
color = Color.White,
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
singleLine = true,
|
||||||
|
keyboardActions = KeyboardActions(
|
||||||
|
onDone = {
|
||||||
|
onImeAction()
|
||||||
|
keyboardController?.hide()
|
||||||
|
}
|
||||||
|
|
||||||
|
),
|
||||||
|
keyboardOptions = KeyboardOptions.Default.copy(
|
||||||
|
imeAction = ImeAction.Done
|
||||||
|
),
|
||||||
|
colors = TextFieldDefaults.colors(
|
||||||
|
focusedContainerColor = Color.DarkGray, // Fondo cuando está enfocado
|
||||||
|
unfocusedContainerColor = Color.DarkGray, // Fondo cuando NO está enfocado
|
||||||
|
cursorColor = Color.White, // Color del cursor
|
||||||
|
focusedTextColor = Color.White, // Color del texto cuando está enfocado
|
||||||
|
unfocusedTextColor = Color.White, // Color del texto cuando NO está enfocado
|
||||||
|
focusedPlaceholderColor = Color.Black, // Color del placeholder cuando está enfocado
|
||||||
|
unfocusedPlaceholderColor = Color.Black // Color del placeholder cuando NO está enfocado
|
||||||
|
),
|
||||||
|
modifier = modifier
|
||||||
|
.fillMaxWidth(fraction = 0.67f)
|
||||||
|
.border(2.dp, Color.White, RoundedCornerShape(8.dp))
|
||||||
|
.height(52.dp)
|
||||||
|
/* .onFocusEvent {
|
||||||
|
if (it.isFocused) {
|
||||||
|
keyboardController?.hide()
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Preview
|
||||||
|
@Composable
|
||||||
|
fun PreviewToolbar() {
|
||||||
|
CustomToolbar(
|
||||||
|
title = "Mi Toolbar",
|
||||||
|
subtitle = "10/20",
|
||||||
|
showBackButton = true,
|
||||||
|
showSwitch = true,
|
||||||
|
iconList = listOf(
|
||||||
|
IconToolBar(
|
||||||
|
R.drawable.ic_parking_ui, "", tint = Color.Blue,
|
||||||
|
onClickIcon = { }
|
||||||
|
)
|
||||||
|
),
|
||||||
|
onBackClick = { /* Acción de volver atrás */ },
|
||||||
|
onSwitchChange = { /* Acción del switch */ }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Preview
|
||||||
|
@Composable
|
||||||
|
fun PreviewScanLineTextSearch() {
|
||||||
|
ScanLineTextSearch(
|
||||||
|
value = stringResource(R.string.scanLabel),
|
||||||
|
onValueChange = {},
|
||||||
|
onImeAction = {})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -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") {}
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package es.verdnatura.presentation.composable
|
||||||
|
|
||||||
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
|
import androidx.compose.animation.fadeIn
|
||||||
|
import androidx.compose.animation.fadeOut
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.wrapContentWidth
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.res.dimensionResource
|
||||||
|
import com.airbnb.lottie.compose.LottieAnimation
|
||||||
|
import com.airbnb.lottie.compose.LottieCompositionSpec
|
||||||
|
import com.airbnb.lottie.compose.LottieConstants
|
||||||
|
import com.airbnb.lottie.compose.rememberLottieComposition
|
||||||
|
import es.verdnatura.R
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun LottieLoadingAnimation(isVisible: Boolean = true) {
|
||||||
|
AnimatedVisibility(
|
||||||
|
visible = isVisible,
|
||||||
|
enter = fadeIn(),
|
||||||
|
exit = fadeOut()
|
||||||
|
) {
|
||||||
|
val composition by rememberLottieComposition(
|
||||||
|
spec = LottieCompositionSpec.RawRes(R.raw.orange_loading)
|
||||||
|
)
|
||||||
|
|
||||||
|
LottieAnimation(
|
||||||
|
composition = composition,
|
||||||
|
iterations = LottieConstants.IterateForever,
|
||||||
|
speed = 2f,
|
||||||
|
modifier = Modifier
|
||||||
|
.wrapContentWidth()
|
||||||
|
.height(dimensionResource(id = R.dimen.verdnatura_logo_large_height))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
package es.verdnatura.presentation.composable.ui
|
||||||
|
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
|
||||||
|
object VerdnaturaColors {
|
||||||
|
|
||||||
|
val OrangeSalix = Color(0xFFEC8916)
|
||||||
|
val BlackCustomDialog = Color(0xFF1A1A1A)
|
||||||
|
val BlackTextInput = Color(0xFF666666)
|
||||||
|
val White = Color(0xFFFFFFFF)
|
||||||
|
|
||||||
|
// Colores principales
|
||||||
|
val ColorPrimary = Color(0xFFF7931E)
|
||||||
|
val ColorPrimaryDark = Color(0xFF8B4200)
|
||||||
|
|
||||||
|
// Negros
|
||||||
|
/* val Black = Color(0xFF000000)
|
||||||
|
val Black1 = Color(0xFF1D1D1D)
|
||||||
|
val Black2 = Color(0xFF171717)
|
||||||
|
val Black3 = Color(0xFF292929)
|
||||||
|
val Black4 = Color(0xFF242424)
|
||||||
|
val Black5 = Color(0xFF323232)
|
||||||
|
val Black6 = Color(0xFF333333)
|
||||||
|
val Black7 = Color(0xFF282828)
|
||||||
|
val Black8 = Color(0xFF1A1A1A)
|
||||||
|
val BlackCustomDialog = Color(0xFF464446)
|
||||||
|
val Black8Alpha6 = Color(0x991A1A1A) // Con transparencia
|
||||||
|
|
||||||
|
// Grises
|
||||||
|
val WarmGrey = Color(0xFF707070)
|
||||||
|
val BrownGrey = Color(0xFF8F8F8F)
|
||||||
|
val BrownGreyLight = Color(0xFFB8ADAD)
|
||||||
|
|
||||||
|
// Colores vivos
|
||||||
|
val Red = Color(0xFFE74C3C)
|
||||||
|
val WarmBrown = Color(0xFF8B4200)
|
||||||
|
val PumpkinOrange = Color(0xFFF7931E)
|
||||||
|
val PumpkinLight = Color(0xFFF77956)
|
||||||
|
val PinkSalix = Color(0xFFFF99CC)
|
||||||
|
val SunflowerYellow = Color(0xFFFFD400)
|
||||||
|
val DarkSkyBlue = Color(0xFF4AB4E6)
|
||||||
|
val DarkGreenVerdnatura = Color(0xFFA3D131)
|
||||||
|
val DarkMint = Color(0xFF50BE87)
|
||||||
|
val DarkMintLight = Color(0xFF80BE87)
|
||||||
|
val DarkMintLightPrecontrolled = Color(0xFFB8DABA)
|
||||||
|
val LightTeal = Color(0xFFB8ECD6)
|
||||||
|
val White = Color(0xFFFFFFFF)
|
||||||
|
val RedSalix = Color(0xFFFB5252)
|
||||||
|
val OrangeSalix = Color(0xFFEC8916)
|
||||||
|
|
||||||
|
// Fondos
|
||||||
|
val BackgroundItemPicker = Color(0xFF4D4D4D)
|
||||||
|
val BackgroundSubtitleSettings = Color(0xFF1A1A1A)
|
||||||
|
val BackgroundItemsMenus = Color(0xFF333333)
|
||||||
|
|
||||||
|
// Colores SALIX
|
||||||
|
val SalixSuccessLight = Color(0xFFA3D131)
|
||||||
|
val ColorHeader = Color(0xFF3D3D3D)
|
||||||
|
val ColorMenuHeader = Color(0xFF3D3D3D)
|
||||||
|
val ColorBg = Color(0xFF222222)
|
||||||
|
val ColorBgDark = Color(0xFF222222)
|
||||||
|
val ColorActive = Color(0xFF666666)
|
||||||
|
val ColorActiveFont = Color(0xFFFFFFFF)
|
||||||
|
val ColorBgPanel = Color(0xFF3C3B3B)
|
||||||
|
val ColorMain = ColorPrimary
|
||||||
|
val ColorMarginal = Color(0xFF222222)
|
||||||
|
val ColorSuccess = Color(0xFFA3D131)
|
||||||
|
val ColorNotice = Color(0xFF32B1CE)
|
||||||
|
val ColorAlert = Color(0xFFFA3939)
|
||||||
|
val ColorPink = Color(0xFFFF99CC)
|
||||||
|
val ColorYellow = Color(0xFFFFFF00)*/
|
||||||
|
}
|
|
@ -0,0 +1,168 @@
|
||||||
|
package es.verdnatura.presentation.composable.ui
|
||||||
|
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.border
|
||||||
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.text.KeyboardActions
|
||||||
|
import androidx.compose.foundation.text.KeyboardOptions
|
||||||
|
import androidx.compose.material3.Button
|
||||||
|
import androidx.compose.material3.ButtonDefaults
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.material3.TextField
|
||||||
|
import androidx.compose.material3.TextFieldDefaults
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.focus.FocusRequester
|
||||||
|
import androidx.compose.ui.focus.focusRequester
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
||||||
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
|
import androidx.compose.ui.text.input.ImeAction
|
||||||
|
import androidx.compose.ui.text.input.KeyboardType
|
||||||
|
import androidx.compose.ui.text.input.TextFieldValue
|
||||||
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun DefaultButtonCustomDialog(
|
||||||
|
text: String,
|
||||||
|
onClick: () -> Unit = {},
|
||||||
|
enabled: Boolean = true,
|
||||||
|
leadingIcon: @Composable (() -> Unit)? = null
|
||||||
|
) {
|
||||||
|
Button(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
onClick = onClick,
|
||||||
|
enabled = enabled,
|
||||||
|
contentPadding = PaddingValues(
|
||||||
|
start = if (leadingIcon == null) 16.dp else 8.dp,
|
||||||
|
end = 16.dp
|
||||||
|
),
|
||||||
|
shape = MaterialTheme.shapes.small,
|
||||||
|
colors = ButtonDefaults.buttonColors(
|
||||||
|
containerColor = VerdnaturaColors.ColorPrimary,
|
||||||
|
contentColor = VerdnaturaColors.White
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
if (leadingIcon != null) {
|
||||||
|
leadingIcon()
|
||||||
|
}
|
||||||
|
|
||||||
|
Text(
|
||||||
|
text = text.uppercase(),
|
||||||
|
fontSize = 14.sp,
|
||||||
|
fontWeight = FontWeight.Bold,
|
||||||
|
textAlign = TextAlign.Center,
|
||||||
|
maxLines = 1,
|
||||||
|
overflow = TextOverflow.Ellipsis
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun TitleTextCustomDialog(
|
||||||
|
title: String,
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = title,
|
||||||
|
style = MaterialTheme.typography.titleLarge.copy(
|
||||||
|
fontWeight = FontWeight.Bold
|
||||||
|
),
|
||||||
|
color = VerdnaturaColors.White,
|
||||||
|
textAlign = TextAlign.Center,
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(bottom = 8.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun DescriptionTextCustomDialog(
|
||||||
|
description: String,
|
||||||
|
) {
|
||||||
|
Text(
|
||||||
|
text = description,
|
||||||
|
color = VerdnaturaColors.White,
|
||||||
|
style = MaterialTheme.typography.bodyLarge,
|
||||||
|
modifier = Modifier.padding(bottom = 8.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun ScanTextCustomDialog(
|
||||||
|
value: TextFieldValue,
|
||||||
|
onValueChange: (TextFieldValue) -> Unit,
|
||||||
|
hint: String,
|
||||||
|
onEnterPressed: (String) -> Unit = {},
|
||||||
|
focusRequester: FocusRequester
|
||||||
|
) {
|
||||||
|
val keyboardController = LocalSoftwareKeyboardController.current
|
||||||
|
|
||||||
|
TextField(
|
||||||
|
value = value,
|
||||||
|
onValueChange = onValueChange,
|
||||||
|
label = {
|
||||||
|
Text(
|
||||||
|
text = hint,
|
||||||
|
textAlign = TextAlign.Center,
|
||||||
|
color = Color.White,
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(horizontal = 16.dp),
|
||||||
|
)
|
||||||
|
},
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.focusRequester(focusRequester)
|
||||||
|
.border(1.dp, Color.White, shape = MaterialTheme.shapes.small)
|
||||||
|
.background(Color.Transparent)
|
||||||
|
.height(VerdnaturaDimens.minHeight),
|
||||||
|
textStyle = CustomTextStyle,
|
||||||
|
keyboardOptions =
|
||||||
|
KeyboardOptions.Default.copy(
|
||||||
|
imeAction = ImeAction.Done,
|
||||||
|
keyboardType = KeyboardType.Number
|
||||||
|
),
|
||||||
|
singleLine = true,
|
||||||
|
keyboardActions = KeyboardActions(
|
||||||
|
onDone = {
|
||||||
|
onEnterPressed(value.text)
|
||||||
|
onValueChange(TextFieldValue(""))
|
||||||
|
keyboardController?.hide()
|
||||||
|
}
|
||||||
|
),
|
||||||
|
colors = TextFieldDefaults.colors(
|
||||||
|
focusedContainerColor = Color.Transparent,
|
||||||
|
unfocusedContainerColor = Color.Transparent,
|
||||||
|
focusedTextColor = VerdnaturaColors.White,
|
||||||
|
unfocusedTextColor = VerdnaturaColors.White
|
||||||
|
)
|
||||||
|
)
|
||||||
|
LaunchedEffect(Unit) {
|
||||||
|
focusRequester.requestFocus()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Preview(showBackground = true)
|
||||||
|
@Composable
|
||||||
|
fun PreviewCustomTextField() {
|
||||||
|
val sampleText = remember { mutableStateOf(TextFieldValue("Texto de ejemplo")) }
|
||||||
|
val focusRequester = remember { FocusRequester() }
|
||||||
|
ScanTextCustomDialog(
|
||||||
|
value = sampleText.value,
|
||||||
|
onValueChange = { sampleText.value = it },
|
||||||
|
hint = "Escribe algo...",
|
||||||
|
onEnterPressed = { text -> println("Texto ingresado: $text") },
|
||||||
|
focusRequester = focusRequester
|
||||||
|
)
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package es.verdnatura.presentation.composable.ui
|
||||||
|
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
|
||||||
|
object VerdnaturaDimens {
|
||||||
|
|
||||||
|
/* val h1 = 96.sp
|
||||||
|
val h2 = 60.sp
|
||||||
|
val h3 = 48.sp
|
||||||
|
val h4 = 34.sp
|
||||||
|
val h5 = 24.sp
|
||||||
|
val h6 = 20.sp
|
||||||
|
val h7 = 18.sp
|
||||||
|
val h9 = 14.sp*/
|
||||||
|
|
||||||
|
// Text sizes
|
||||||
|
val fontSizeCustomDialogs = 16.sp
|
||||||
|
|
||||||
|
// Height Scan Text
|
||||||
|
val minHeight = 48.dp
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package es.verdnatura.presentation.composable.ui
|
||||||
|
|
||||||
|
import androidx.compose.ui.text.TextStyle
|
||||||
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
|
|
||||||
|
val CustomTextStyle = TextStyle(
|
||||||
|
color = VerdnaturaColors.White,
|
||||||
|
fontSize = VerdnaturaDimens.fontSizeCustomDialogs,
|
||||||
|
textAlign = TextAlign.Center
|
||||||
|
)
|
|
@ -16,7 +16,8 @@ import es.verdnatura.domain.toast
|
||||||
class SearchableAdapter(
|
class SearchableAdapter(
|
||||||
private var listElements: MutableList<NameWithId>,
|
private var listElements: MutableList<NameWithId>,
|
||||||
private var context: Context,
|
private var context: Context,
|
||||||
private val onItemClick: (NameWithId) -> Unit,
|
private val listColorElements: List<Int> = listOf(),
|
||||||
|
private val onItemClick: (NameWithId) -> Unit
|
||||||
) : RecyclerView.Adapter<SearchableAdapter.NameViewHolder>() {
|
) : RecyclerView.Adapter<SearchableAdapter.NameViewHolder>() {
|
||||||
|
|
||||||
private var listElementsFiltered = listElements.toMutableList()
|
private var listElementsFiltered = listElements.toMutableList()
|
||||||
|
@ -48,6 +49,13 @@ class SearchableAdapter(
|
||||||
} catch (ex: Exception) {
|
} catch (ex: Exception) {
|
||||||
ex.message?.toast(context)
|
ex.message?.toast(context)
|
||||||
}
|
}
|
||||||
|
if (listColorElements.isNotEmpty()) {
|
||||||
|
if (nameWithId.id in listColorElements) {
|
||||||
|
nameText.setTextColor(Color.BLACK)
|
||||||
|
} else {
|
||||||
|
nameText.setTextColor(Color.GRAY)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,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
|
||||||
val webSettings = binding.webView.settings
|
useWideViewPort = true
|
||||||
webSettings.javaScriptEnabled = true
|
builtInZoomControls = true
|
||||||
webSettings.domStorageEnabled = true
|
displayZoomControls = false
|
||||||
webSettings.loadWithOverviewMode = true
|
setSupportZoom(true)
|
||||||
webSettings.useWideViewPort = true
|
allowFileAccess = true
|
||||||
webSettings.builtInZoomControls = true
|
|
||||||
webSettings.displayZoomControls = false
|
|
||||||
webSettings.setSupportZoom(true)
|
|
||||||
webSettings.allowFileAccess = true
|
|
||||||
|
|
||||||
binding.webView.setOnTouchListener { v, event ->
|
|
||||||
gestureDetector.onTouchEvent(event)
|
|
||||||
}
|
}
|
||||||
binding.webView.webViewClient = object : WebViewClient() {
|
|
||||||
|
setOnTouchListener { _, event ->
|
||||||
|
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) // velocidad en píxeles por segundo
|
||||||
|
val velocityX = tracker.xVelocity
|
||||||
|
val velocityY = abs(tracker.yVelocity)
|
||||||
|
|
||||||
|
if (velocityX > FLINGTHRESHOLDVELOCITY &&
|
||||||
|
velocityY < FLINGTHRESHOLDVERTICAL
|
||||||
|
) {
|
||||||
|
binding.webView.goBack()
|
||||||
|
return@setOnTouchListener true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MotionEvent.ACTION_CANCEL -> {
|
||||||
|
velocityTracker?.recycle()
|
||||||
|
velocityTracker = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
webViewClient = object : WebViewClient() {
|
||||||
override fun shouldOverrideUrlLoading(
|
override fun shouldOverrideUrlLoading(
|
||||||
view: WebView?, request: WebResourceRequest?
|
view: WebView?,
|
||||||
|
request: WebResourceRequest?
|
||||||
): Boolean {
|
): Boolean {
|
||||||
binding.webView.loadUrl(request?.url.toString())
|
request?.url?.toString()?.let { loadUrl(it) }
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val dataScanned = JSONObject(entryPoint)
|
val dataScanned = JSONObject(entryPoint)
|
||||||
|
|
||||||
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())
|
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
|
||||||
|
@ -90,6 +96,13 @@ class CustomDialogList(context: Context) : Dialog(context, R.style.DialogTheme)
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun setOkThreeButton(text: String, onButtonClicked: () -> Unit): CustomDialogList {
|
||||||
|
binding.customDialogButtonOkThree.visibility = View.VISIBLE
|
||||||
|
binding.customDialogButtonOkThree.text = text
|
||||||
|
binding.customDialogButtonOkThree.setOnClickListener { onButtonClicked() }
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
fun setKoButton(text: String, onButtonClicked: () -> Unit): CustomDialogList {
|
fun setKoButton(text: String, onButtonClicked: () -> Unit): CustomDialogList {
|
||||||
binding.customDialogButtonKo.visibility = View.VISIBLE
|
binding.customDialogButtonKo.visibility = View.VISIBLE
|
||||||
binding.customDialogButtonKo.text = text
|
binding.customDialogButtonKo.text = text
|
||||||
|
@ -148,4 +161,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
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,130 @@
|
||||||
|
package es.verdnatura.presentation.view.component
|
||||||
|
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.clickable
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.wrapContentWidth
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
|
import androidx.compose.foundation.lazy.items
|
||||||
|
import androidx.compose.material3.HorizontalDivider
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.runtime.setValue
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.focus.FocusRequester
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
||||||
|
import androidx.compose.ui.text.input.TextFieldValue
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.window.Dialog
|
||||||
|
import es.verdnatura.presentation.composable.ui.DefaultButtonCustomDialog
|
||||||
|
import es.verdnatura.presentation.composable.ui.DescriptionTextCustomDialog
|
||||||
|
import es.verdnatura.presentation.composable.ui.ScanTextCustomDialog
|
||||||
|
import es.verdnatura.presentation.composable.ui.TitleTextCustomDialog
|
||||||
|
import es.verdnatura.presentation.composable.ui.VerdnaturaColors
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun CustomDialogListComposable(
|
||||||
|
title: String = "",
|
||||||
|
description: String = "",
|
||||||
|
buttonOkText: String = "",
|
||||||
|
onOkClick: () -> Unit = {},
|
||||||
|
showRecyclerView: Boolean = true,
|
||||||
|
recyclerViewItems: List<Any> = listOf(),
|
||||||
|
onItemSelected: (Any) -> Unit = {},
|
||||||
|
hintOne: String = "",
|
||||||
|
showTextInput: Boolean = true,
|
||||||
|
onEnterPressed: (String) -> Unit = {}
|
||||||
|
) {
|
||||||
|
var valueOne by remember { mutableStateOf(TextFieldValue()) }
|
||||||
|
val showDialog = remember { mutableStateOf(true) }
|
||||||
|
val keyboardController = LocalSoftwareKeyboardController.current
|
||||||
|
val focusRequester = remember { FocusRequester() }
|
||||||
|
|
||||||
|
if (showDialog.value) {
|
||||||
|
Dialog(
|
||||||
|
onDismissRequest = { showDialog.value = false },
|
||||||
|
) {
|
||||||
|
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.background(VerdnaturaColors.BlackCustomDialog)
|
||||||
|
.padding(16.dp),
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
|
) {
|
||||||
|
if (title.isNotEmpty()) {
|
||||||
|
TitleTextCustomDialog(title)
|
||||||
|
}
|
||||||
|
if (description.isNotEmpty()) {
|
||||||
|
DescriptionTextCustomDialog(description)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showTextInput)
|
||||||
|
ScanTextCustomDialog(
|
||||||
|
value = valueOne,
|
||||||
|
onValueChange = { valueOne = it },
|
||||||
|
hint = hintOne,
|
||||||
|
onEnterPressed = onEnterPressed,
|
||||||
|
focusRequester = focusRequester
|
||||||
|
)
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
|
||||||
|
if (showRecyclerView && recyclerViewItems.isNotEmpty()) {
|
||||||
|
LazyColumn(
|
||||||
|
modifier = Modifier.wrapContentWidth(align = Alignment.CenterHorizontally)
|
||||||
|
) {
|
||||||
|
items(recyclerViewItems) { item ->
|
||||||
|
HorizontalDivider(thickness = 1.dp, color = Color.DarkGray)
|
||||||
|
Text(
|
||||||
|
text = item.toString(),
|
||||||
|
style = MaterialTheme.typography.bodyLarge,
|
||||||
|
color = VerdnaturaColors.White,
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(16.dp)
|
||||||
|
.clickable {
|
||||||
|
onItemSelected(item.toString())
|
||||||
|
}
|
||||||
|
.align(Alignment.CenterHorizontally)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DefaultButtonCustomDialog(buttonOkText, onClick = {
|
||||||
|
onOkClick()
|
||||||
|
keyboardController?.hide()
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Preview
|
||||||
|
@Composable
|
||||||
|
fun PreviewCustomDialogList() {
|
||||||
|
|
||||||
|
CustomDialogListComposable(
|
||||||
|
title = "Custom Dialog Title",
|
||||||
|
description = "This is a description.",
|
||||||
|
buttonOkText = "OK",
|
||||||
|
onOkClick = { /* Handle OK click */ },
|
||||||
|
showRecyclerView = true,
|
||||||
|
recyclerViewItems = listOf(1, 2, 3),
|
||||||
|
onItemSelected = { item -> println("Item selected: $item") },
|
||||||
|
hintOne = "Hint for input one",
|
||||||
|
|
||||||
|
)
|
||||||
|
}
|
|
@ -1,12 +1,16 @@
|
||||||
package es.verdnatura.presentation.view.feature.ajustes.fragment
|
package es.verdnatura.presentation.view.feature.ajustes.fragment
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.app.AlertDialog
|
import android.app.AlertDialog
|
||||||
|
import android.content.Intent
|
||||||
import android.content.pm.PackageInfo
|
import android.content.pm.PackageInfo
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.os.Handler
|
||||||
|
import android.os.Looper
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.ArrayAdapter
|
import android.widget.ArrayAdapter
|
||||||
|
@ -42,6 +46,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
|
||||||
|
@ -82,12 +87,19 @@ class AjustesFragment :
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setSearchable(listNames: MutableList<NameWithId>) {
|
private fun setSearchable(
|
||||||
|
listNames: MutableList<NameWithId>,
|
||||||
|
type: String = "sector",
|
||||||
|
listColorsElements: List<Int> = listOf()
|
||||||
|
) {
|
||||||
val adapter =
|
val adapter =
|
||||||
SearchableAdapter(
|
SearchableAdapter(
|
||||||
listElements = listNames,
|
listElements = listNames,
|
||||||
context = requireContext()
|
context = requireContext(),
|
||||||
|
listColorElements = listColorsElements,
|
||||||
) { elementSelected ->
|
) { elementSelected ->
|
||||||
|
when (type) {
|
||||||
|
"sector" -> {
|
||||||
sectorListVO.forEach {
|
sectorListVO.forEach {
|
||||||
if (it.id == elementSelected.id) {
|
if (it.id == elementSelected.id) {
|
||||||
runBlocking {
|
runBlocking {
|
||||||
|
@ -116,25 +128,60 @@ class AjustesFragment :
|
||||||
return@forEach
|
return@forEach
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
"printer" -> {
|
||||||
|
println("selected $elementSelected")
|
||||||
|
val printer = printersList.find { it.name == elementSelected.name }
|
||||||
|
println("selected printer $elementSelected")
|
||||||
|
if (printer != null) {
|
||||||
|
if (printer.sector?.backupPrinterFk == printer.id) {
|
||||||
|
showWarningPrinter(printer.name, printer.id)
|
||||||
|
} else {
|
||||||
|
savePrinter(printer.name, printer.id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printersList.clear()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val searchView =
|
||||||
|
binding.searchableRecyclerView.findViewById<androidx.appcompat.widget.SearchView>(
|
||||||
|
R.id.search_view
|
||||||
|
)
|
||||||
|
searchView?.setQuery("", false)
|
||||||
binding.searchableRecyclerView.visibility = View.GONE
|
binding.searchableRecyclerView.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.searchableRecyclerView.setAdapter(adapter, listNames)
|
binding.searchableRecyclerView.setAdapter(adapter, listNames)
|
||||||
binding.searchableRecyclerView.visibility = View.VISIBLE
|
binding.searchableRecyclerView.visibility = View.VISIBLE
|
||||||
binding.searchableRecyclerView.setSearchHint(getString(R.string.sectorSearch))
|
binding.searchableRecyclerView.setSearchHint(
|
||||||
|
if (type == "sector") getString(R.string.sectorSearch) else
|
||||||
|
getString(R.string.printerSearch)
|
||||||
|
)
|
||||||
ma.hideKeyboard(binding.searchableRecyclerView)
|
ma.hideKeyboard(binding.searchableRecyclerView)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setToolBar() {
|
private fun setToolBar() {
|
||||||
|
|
||||||
val listIcons: ArrayList<ImageView> = ArrayList()
|
val listIcons: ArrayList<ImageView> = ArrayList()
|
||||||
|
|
||||||
val iconInfo = ImageView(context)
|
val iconInfo = ImageView(context)
|
||||||
iconInfo.setImageResource(R.drawable.ic_info_delivery)
|
iconInfo.setImageResource(R.drawable.ic_info_delivery)
|
||||||
|
|
||||||
val iconLogout = ImageView(context)
|
val iconLogout = ImageView(context)
|
||||||
iconLogout.setImageResource(R.drawable.ic_logout)
|
iconLogout.setImageResource(R.drawable.ic_logout)
|
||||||
|
|
||||||
|
val iconPhone = ImageView(context)
|
||||||
|
iconPhone.setImageResource(R.drawable.phone_call)
|
||||||
|
|
||||||
|
val iconSettings = ImageView(context)
|
||||||
|
iconSettings.setImageResource(R.drawable.ic_setting_ui)
|
||||||
|
|
||||||
listIcons.add(iconInfo)
|
listIcons.add(iconInfo)
|
||||||
listIcons.add(iconLogout)
|
listIcons.add(iconLogout)
|
||||||
|
// listIcons.add(iconPhone)
|
||||||
|
//listIcons.add(iconSettings)
|
||||||
|
|
||||||
binding.mainToolbar.toolbarIcons.adapter =
|
binding.mainToolbar.toolbarIcons.adapter =
|
||||||
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
|
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
|
||||||
override fun onOptionsItemSelected(item: Drawable) {
|
override fun onOptionsItemSelected(item: Drawable) {
|
||||||
|
@ -165,8 +212,60 @@ class AjustesFragment :
|
||||||
}
|
}
|
||||||
|
|
||||||
iconLogout.drawable -> {
|
iconLogout.drawable -> {
|
||||||
|
/* println("test incoming warehouse close")
|
||||||
|
val intent = Intent("org.linphone.CLOSE_APP")
|
||||||
|
intent.setPackage("org.linphone.incomingcall") // Reemplaza con el paquete de la app receptora
|
||||||
|
requireContext().sendBroadcast(intent)*/
|
||||||
ma.onMyBackPressed()
|
ma.onMyBackPressed()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
iconSettings.drawable -> {
|
||||||
|
println("test incoming warehouse opening")
|
||||||
|
val intent = Intent()
|
||||||
|
intent.setClassName(
|
||||||
|
"org.linphone.incomingcall",
|
||||||
|
"org.linphone.incomingcall.IncomingCallActivity"
|
||||||
|
)
|
||||||
|
intent.putExtra("server", "pbx.verdnatura.es")
|
||||||
|
intent.putExtra("username", "1007")
|
||||||
|
intent.putExtra("password", "delatorre.1234")
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||||
|
startActivity(intent)
|
||||||
|
|
||||||
|
Handler(Looper.getMainLooper()).postDelayed({
|
||||||
|
val intentIncoming =
|
||||||
|
Intent(requireContext(), MainActivity::class.java)
|
||||||
|
intentIncoming.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
|
||||||
|
startActivity(intentIncoming)
|
||||||
|
}, 2000)
|
||||||
|
}
|
||||||
|
|
||||||
|
iconPhone.drawable -> {
|
||||||
|
println("test incoming warehouse calling")
|
||||||
|
val intentIncoming =
|
||||||
|
Intent(requireContext(), MainActivity::class.java)
|
||||||
|
intentIncoming.putExtra(
|
||||||
|
"phoneNumber",
|
||||||
|
"sip:651353889@pbx.verdnatura.es"
|
||||||
|
)
|
||||||
|
|
||||||
|
/* intentIncoming.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
|
||||||
|
startActivity(intentIncoming)*/
|
||||||
|
val intent = Intent("org.linphone.CALLING")
|
||||||
|
intent.setClassName(
|
||||||
|
"org.linphone.incomingcall",
|
||||||
|
"org.linphone.incomingcall.IncomingCallActivity"
|
||||||
|
)
|
||||||
|
intent.putExtra("server", "pbx.verdnatura.es")
|
||||||
|
intent.putExtra("username", "1007")
|
||||||
|
intent.putExtra("password", "*******")
|
||||||
|
intent.putExtra("phoneNumber", "sip:651353889@pbx.verdnatura.es")
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
|
||||||
|
startActivity(intent)
|
||||||
|
requireContext().sendBroadcast(intent)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -205,11 +304,7 @@ class AjustesFragment :
|
||||||
getString(R.string.closeSession) -> ma.onMyBackPressed()
|
getString(R.string.closeSession) -> ma.onMyBackPressed()
|
||||||
getString(R.string.printerLabel) -> {
|
getString(R.string.printerLabel) -> {
|
||||||
messagePrinter = getString(R.string.SelectPrinter)
|
messagePrinter = getString(R.string.SelectPrinter)
|
||||||
viewModel.printerGet(
|
viewModel.printerGet()
|
||||||
mobileApplication.dataStoreApp.readDataStoreKey(
|
|
||||||
SECTORFK
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(R.string.vehicleControl) -> ma.onPasillerosItemClickListener(
|
getString(R.string.vehicleControl) -> ma.onPasillerosItemClickListener(
|
||||||
|
@ -253,7 +348,7 @@ class AjustesFragment :
|
||||||
event.getContentIfNotHandled().notNull {
|
event.getContentIfNotHandled().notNull {
|
||||||
messagePrinter =
|
messagePrinter =
|
||||||
getString(R.string.SelectPrinter) + "\n" + getString(R.string.printerRemoved)
|
getString(R.string.SelectPrinter) + "\n" + getString(R.string.printerRemoved)
|
||||||
viewModel.printerGet(mobileApplication.dataStoreApp.readDataStoreKey(SECTORFK))
|
viewModel.printerGet()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,20 +410,53 @@ class AjustesFragment :
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loadPrintersList.observe(viewLifecycleOwner) { event ->
|
loadPrintersList.observe(viewLifecycleOwner) { event ->
|
||||||
event.getContentIfNotHandled().notNull { it ->
|
event.getContentIfNotHandled()?.let { it ->
|
||||||
|
|
||||||
if (it.list.isNotEmpty()) {
|
if (it.list.isNotEmpty()) {
|
||||||
val listPrinters: ArrayList<String> = ArrayList()
|
val listPrinters: ArrayList<String> = ArrayList()
|
||||||
it.list.forEach {
|
printersList.clear()
|
||||||
listPrinters.add(it.name)
|
|
||||||
|
|
||||||
|
printersList.addAll(it.list.sortedWith(compareBy(
|
||||||
|
{ printer ->
|
||||||
|
when {
|
||||||
|
printer.sector?.id == mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
||||||
|
SECTORFK
|
||||||
|
) -> 0
|
||||||
|
|
||||||
|
printer.sector?.id != null -> 1
|
||||||
|
else -> 2
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{ printer -> printer.name }
|
||||||
|
)))
|
||||||
|
|
||||||
|
printersList.forEach { printer ->
|
||||||
|
listPrinters.add(printer.name)
|
||||||
|
}
|
||||||
|
|
||||||
val array = arrayOfNulls<String>(listPrinters.size)
|
val array = arrayOfNulls<String>(listPrinters.size)
|
||||||
printersList = it.list
|
// showDialogForAll(listPrinters.toArray(array), messagePrinter ?: "")
|
||||||
showDialogForAll(listPrinters.toArray(array), messagePrinter ?: "")
|
//Tarea7823
|
||||||
|
val listColorsElements = printersList.mapIndexed { _, printer ->
|
||||||
|
if (printer.sector?.id == mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
||||||
|
SECTORFK
|
||||||
|
)
|
||||||
|
) printer.id else null
|
||||||
|
}.filterNotNull()
|
||||||
|
|
||||||
|
setSearchable(printersList.map {
|
||||||
|
NameWithId(
|
||||||
|
id = it.id,
|
||||||
|
name = it.name
|
||||||
|
)
|
||||||
|
} as MutableList<NameWithId>,
|
||||||
|
type = "printer",
|
||||||
|
listColorsElements = listColorsElements)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
viewModel.settingsItem[2].selected = getString(R.string.noprinter)
|
viewModel.settingsItem[2].selected = getString(R.string.noprinter)
|
||||||
settingsAdapter!!.notifyItemChanged(2)
|
settingsAdapter?.notifyItemChanged(2)
|
||||||
customDialog.setTitle(getString(R.string.printers))
|
customDialog.setTitle(getString(R.string.printers))
|
||||||
.setDescription(getString(R.string.Noprinters))
|
.setDescription(getString(R.string.Noprinters))
|
||||||
.setOkButton(getString(R.string.Close)) {
|
.setOkButton(getString(R.string.Close)) {
|
||||||
|
@ -336,7 +464,6 @@ class AjustesFragment :
|
||||||
handleUserCall()
|
handleUserCall()
|
||||||
}.show()
|
}.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loadTrainList.observe(viewLifecycleOwner) { event ->
|
loadTrainList.observe(viewLifecycleOwner) { event ->
|
||||||
|
@ -361,14 +488,19 @@ class AjustesFragment :
|
||||||
super.observeViewModel()
|
super.observeViewModel()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NotifyDataSetChanged")
|
||||||
private fun getUserData() {
|
private fun getUserData() {
|
||||||
|
|
||||||
loginViewModel = LoginViewModel(requireActivity().applicationContext)
|
loginViewModel = LoginViewModel(requireActivity().applicationContext)
|
||||||
handleUserCall()
|
handleUserCall()
|
||||||
loginViewModel.handleUserResponse.observe(this@AjustesFragment) { iti ->
|
loginViewModel.handleUserResponse.observe(this@AjustesFragment) { iti ->
|
||||||
runBlocking { mobileApplication.dataStoreApp.saveWorkerData(iti) }
|
runBlocking {
|
||||||
}
|
mobileApplication.dataStoreApp.saveWorkerData(iti)
|
||||||
setSettings()
|
setSettings()
|
||||||
|
binding.setttingsItems.adapter!!.notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleUserCall() {
|
private fun handleUserCall() {
|
||||||
|
@ -436,12 +568,26 @@ class AjustesFragment :
|
||||||
val positionPrinterEmergency =
|
val positionPrinterEmergency =
|
||||||
printersList.indexOfFirst { printer -> printer.sector?.backupPrinterFk == printer.id }
|
printersList.indexOfFirst { printer -> printer.sector?.backupPrinterFk == printer.id }
|
||||||
|
|
||||||
if (position == positionPrinterEmergency) {
|
val positions = printersList.mapIndexed { index, printer ->
|
||||||
|
if (printer.sector?.id == mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
||||||
|
SECTORFK
|
||||||
|
)
|
||||||
|
) index else null
|
||||||
|
}.filterNotNull()
|
||||||
|
|
||||||
|
when (position) {
|
||||||
|
positionPrinterEmergency -> {
|
||||||
textView.setTextColor(Color.RED)
|
textView.setTextColor(Color.RED)
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
in positions -> {
|
||||||
textView.setTextColor(Color.BLACK)
|
textView.setTextColor(Color.BLACK)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
textView.setTextColor(Color.GRAY)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,9 +156,10 @@ class AjustesViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun printerGet(sectorFk: Int) {
|
fun printerGet() {
|
||||||
|
//Tarea 7823*/
|
||||||
salix.getprinters(
|
salix.getprinters(
|
||||||
"""{"fields":["id","name","sectorFk"],"where":{"sectorFk":$sectorFk,"isLabeler":{"neq":false}},"include": [ { "relation": "sector", "scope": { "fields": ["backupPrinterFk"]}}]}"""
|
"""{"fields":["id","name","sectorFk"],"where":{"isLabeler":{"neq":false}},"include": [ { "relation": "sector", "scope": { "fields": ["backupPrinterFk"]}}]}"""
|
||||||
).enqueue(object : SalixCallback<MutableList<Printers>>(context) {
|
).enqueue(object : SalixCallback<MutableList<Printers>>(context) {
|
||||||
override fun onSuccess(response: Response<MutableList<Printers>>) {
|
override fun onSuccess(response: Response<MutableList<Printers>>) {
|
||||||
_printerList.value = response.body()?.let { PrintersList(it) }
|
_printerList.value = response.body()?.let { PrintersList(it) }
|
||||||
|
|
|
@ -9,8 +9,6 @@ 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 {
|
||||||
|
@ -20,12 +18,9 @@ class ImageViewActivity : BaseActivity<ActivityImageviewBinding>(){
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
binding.mainToolbar.backButton.setOnClickListener {
|
binding.mainToolbar.backButton.setOnClickListener {
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,10 @@ import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
||||||
import es.verdnatura.presentation.common.PrinterDialogManager
|
import es.verdnatura.presentation.common.PrinterDialogManager
|
||||||
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
||||||
import es.verdnatura.presentation.common.hideKeyboard
|
import es.verdnatura.presentation.common.hideKeyboard
|
||||||
|
import es.verdnatura.presentation.common.itemScanIsQr
|
||||||
import es.verdnatura.presentation.common.itemScanValue
|
import es.verdnatura.presentation.common.itemScanValue
|
||||||
import es.verdnatura.presentation.common.loadUrl
|
import es.verdnatura.presentation.common.loadUrl
|
||||||
|
import es.verdnatura.presentation.composable.ImageViewActivityComposable
|
||||||
import es.verdnatura.presentation.view.component.CustomDialogDynamicButtons
|
import es.verdnatura.presentation.view.component.CustomDialogDynamicButtons
|
||||||
import es.verdnatura.presentation.view.component.CustomDialogInput
|
import es.verdnatura.presentation.view.component.CustomDialogInput
|
||||||
import es.verdnatura.presentation.view.component.CustomDialogList
|
import es.verdnatura.presentation.view.component.CustomDialogList
|
||||||
|
@ -39,6 +41,7 @@ import es.verdnatura.presentation.view.feature.articulo.model.ItemCardRowVO
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemCardVO
|
||||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
|
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||||
|
import kotlinx.coroutines.runBlocking
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
|
||||||
class ItemCardFragment(
|
class ItemCardFragment(
|
||||||
|
@ -132,10 +135,36 @@ class ItemCardFragment(
|
||||||
val printerDialogManager = PrinterDialogManager(requireContext())
|
val printerDialogManager = PrinterDialogManager(requireContext())
|
||||||
printerDialogManager.showPrintDialog(
|
printerDialogManager.showPrintDialog(
|
||||||
buyToPrint ?: itemInfoG!!.id.toLong(),
|
buyToPrint ?: itemInfoG!!.id.toLong(),
|
||||||
itemInfoG?.longName ?: ""
|
itemInfoG?.longName ?: "",
|
||||||
) { id, labelType, copies, packing ->
|
onPrintClick = { id, labelType, copies, packing ->
|
||||||
printItem(id, labelType, copies, packing)
|
printItem(id, labelType, copies, packing)
|
||||||
|
},
|
||||||
|
onPrintChange = { text ->
|
||||||
|
if (itemScanIsQr(text)) {
|
||||||
|
val labeler = itemScanValue(
|
||||||
|
text,
|
||||||
|
arrayOf("printer"),
|
||||||
|
"id"
|
||||||
|
).toString().toInt()
|
||||||
|
viewModel.operatorUpdate(
|
||||||
|
workerFk = mobileApplication.userId!!,
|
||||||
|
labelerFK = labeler
|
||||||
|
)
|
||||||
|
runBlocking {
|
||||||
|
mobileApplication.dataStoreApp.editDataStoreKey(
|
||||||
|
PRINTERFK,
|
||||||
|
labeler
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
ma.messageWithSound(
|
||||||
|
getString(R.string.qrPrinterNotvalid),
|
||||||
|
isPlayed = true,
|
||||||
|
isError = true,
|
||||||
|
isToasted = false
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
} else ma.messageWithSound(
|
} else ma.messageWithSound(
|
||||||
getString(R.string.errorPrintBuy),
|
getString(R.string.errorPrintBuy),
|
||||||
isError = true,
|
isError = true,
|
||||||
|
@ -272,7 +301,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)
|
||||||
|
@ -340,6 +371,17 @@ class ItemCardFragment(
|
||||||
buyToPrint = it
|
buyToPrint = it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadChangePrinterResponse.observe(viewLifecycleOwner) { event ->
|
||||||
|
event.getContentIfNotHandled().notNull {
|
||||||
|
runBlocking {
|
||||||
|
mobileApplication.dataStoreApp.editDataStoreKey(
|
||||||
|
PRINTERFK,
|
||||||
|
it
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,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.OperatorUseCase
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
import es.verdnatura.presentation.common.Event
|
import es.verdnatura.presentation.common.Event
|
||||||
import es.verdnatura.presentation.common.ItemBarCodeSalix
|
import es.verdnatura.presentation.common.ItemBarCodeSalix
|
||||||
|
@ -27,6 +28,7 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
|
|
||||||
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
|
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
|
||||||
private val printItemUseCase = GetItemPrintItemUseCase(salix)
|
private val printItemUseCase = GetItemPrintItemUseCase(salix)
|
||||||
|
private val operatorUseCase = OperatorUseCase(salix)
|
||||||
|
|
||||||
private val _itemCard by lazy { MutableLiveData<ItemCardVO>() }
|
private val _itemCard by lazy { MutableLiveData<ItemCardVO>() }
|
||||||
val itemCard: LiveData<ItemCardVO>
|
val itemCard: LiveData<ItemCardVO>
|
||||||
|
@ -54,6 +56,10 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
val buyUltimateResponse: LiveData<Long> = _buyUltimateResponse
|
val buyUltimateResponse: LiveData<Long> = _buyUltimateResponse
|
||||||
val loadBuyUltimateResponse: LiveData<Event<Long>> = _buyUltimateResponse.map { Event(it) }
|
val loadBuyUltimateResponse: LiveData<Event<Long>> = _buyUltimateResponse.map { Event(it) }
|
||||||
|
|
||||||
|
private val _changePrinterResponse by lazy { MutableLiveData<Int>() }
|
||||||
|
val changePrinterResponse: LiveData<Int> = _changePrinterResponse
|
||||||
|
val loadChangePrinterResponse: LiveData<Event<Int>> = _changePrinterResponse.map { Event(it) }
|
||||||
|
|
||||||
fun getItemCard(
|
fun getItemCard(
|
||||||
itemFk: Number,
|
itemFk: Number,
|
||||||
warehouseFk: Int,
|
warehouseFk: Int,
|
||||||
|
@ -69,6 +75,18 @@ class ItemCardViewModel(var context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun operatorUpdate(workerFk: Number, labelerFK: Number) {
|
||||||
|
|
||||||
|
operatorUseCase.updateOperator(workerFk = workerFk, hashMapOf("labelerFk" to labelerFK))
|
||||||
|
.enqueue(object : SalixCallback<Unit>(context) {
|
||||||
|
override fun onSuccess(response: Response<Unit>) {
|
||||||
|
super.onSuccess(response)
|
||||||
|
_changePrinterResponse.value = labelerFK.toInt()
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
fun printItem(
|
fun printItem(
|
||||||
reportName: String,
|
reportName: String,
|
||||||
printerFk: Int,
|
printerFk: Int,
|
||||||
|
|
|
@ -2,19 +2,20 @@ 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)
|
||||||
|
@ -26,8 +27,19 @@ class LocationAdapter (
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -35,8 +47,7 @@ class LocationAdapter (
|
||||||
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,62 @@
|
||||||
|
package es.verdnatura.presentation.view.feature.buscaritem.fragment
|
||||||
|
|
||||||
|
import es.verdnatura.domain.SalixCallback
|
||||||
|
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
||||||
|
import es.verdnatura.presentation.base.BaseViewModelCompose
|
||||||
|
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemShelvings
|
||||||
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
|
import kotlinx.coroutines.flow.asStateFlow
|
||||||
|
import kotlinx.coroutines.flow.update
|
||||||
|
import retrofit2.Response
|
||||||
|
|
||||||
|
data class UiState(
|
||||||
|
val itemFk: String? = null,
|
||||||
|
val items: List<ItemShelvings> = emptyList(),
|
||||||
|
val isLoading: Boolean = false
|
||||||
|
)
|
||||||
|
|
||||||
|
class BuscarItemComposeViewModel(var application: android.app.Application) :
|
||||||
|
BaseViewModelCompose(application) {
|
||||||
|
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
|
||||||
|
|
||||||
|
private val _uiState = MutableStateFlow(UiState())
|
||||||
|
val uiState = _uiState.asStateFlow()
|
||||||
|
|
||||||
|
fun getIdFromCodeSalix(code: String) {
|
||||||
|
_uiState.update { it.copy(itemFk = code, isLoading = true) }
|
||||||
|
getItemFromBarcodeUseCase.execute(code)
|
||||||
|
.enqueue(object : SalixCallback<Int?>(application.applicationContext) {
|
||||||
|
override fun onSuccess(response: Response<Int?>) {
|
||||||
|
response.body()?.let { id ->
|
||||||
|
itemshelvingsGet(id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError(t: Throwable) {
|
||||||
|
super.onError(t)
|
||||||
|
_uiState.update { it.copy(isLoading = false) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun itemshelvingsGet(itemFk: Any) {
|
||||||
|
salix.itemShelvingsGet(
|
||||||
|
filter = """{"where":{"itemFk":$itemFk},"fields":["created","visible","available","shelvingFk"],
|
||||||
|
|"include":[{"relation":"shelving","scope":{"fields":["code","priority","parkingFk"],
|
||||||
|
|"include":{"relation":"parking","scope":{"fields":["code","sectorFk"]}}}}]}""".trimMargin()
|
||||||
|
)
|
||||||
|
.enqueue(object : SalixCallback<List<ItemShelvings>>(application.applicationContext) {
|
||||||
|
override fun onSuccess(response: Response<List<ItemShelvings>>) {
|
||||||
|
response.body()?.let { list ->
|
||||||
|
_uiState.update { it.copy(items = list, isLoading = false) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError(t: Throwable) {
|
||||||
|
super.onError(t)
|
||||||
|
_uiState.update { it.copy(isLoading = false) }
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,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(
|
||||||
|
@ -85,6 +91,7 @@ class BuscarItemFragment(
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
} catch (ex: Exception) {
|
} catch (ex: Exception) {
|
||||||
|
println("errorrrr ${ex.message}")
|
||||||
ma.messageWithSound(
|
ma.messageWithSound(
|
||||||
message = ex.message.toString(),
|
message = ex.message.toString(),
|
||||||
isError = true,
|
isError = true,
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
package es.verdnatura.presentation.view.feature.buscaritem.fragment
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.compose.ui.platform.ComposeView
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import es.verdnatura.R
|
||||||
|
import es.verdnatura.domain.toast
|
||||||
|
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||||
|
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||||
|
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||||
|
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||||
|
|
||||||
|
class BuscarItemFragmentCompose(
|
||||||
|
var itemFk: Any? = null
|
||||||
|
) : Fragment() {
|
||||||
|
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
|
||||||
|
private val viewModel: BuscarItemComposeViewModel by viewModel()
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun newInstance(entryPoint: Int?) = BuscarItemFragmentCompose(entryPoint)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onAttach(context: Context) {
|
||||||
|
super.onAttach(context)
|
||||||
|
if (context is OnPasillerosItemClickListener) pasillerosItemClickListener = context
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreateView(
|
||||||
|
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||||
|
): View {
|
||||||
|
return ComposeView(requireContext()).apply {
|
||||||
|
setContent {
|
||||||
|
BuscarItemScreen(
|
||||||
|
viewModel = viewModel,
|
||||||
|
onBackClick = { (context as MainActivity).onMyBackPressed() },
|
||||||
|
onItemLongClick = { sector -> sector.toast(requireContext()) },
|
||||||
|
onItemClick = { shelving ->
|
||||||
|
pasillerosItemClickListener?.onPasillerosItemClickListener(
|
||||||
|
PasillerosItemVO(title = R.string.titleUbicator),
|
||||||
|
shelving
|
||||||
|
)
|
||||||
|
},
|
||||||
|
title = getString(R.string.getubication)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
itemFk?.let {
|
||||||
|
viewModel.getIdFromCodeSalix(it.toString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun showSector(item: LocationItem) {
|
||||||
|
item.sector.toast(requireContext())
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun openUbicadorFragment(item: LocationItem) {
|
||||||
|
pasillerosItemClickListener!!.onPasillerosItemClickListener(
|
||||||
|
PasillerosItemVO(
|
||||||
|
title =
|
||||||
|
R.string.titleUbicator
|
||||||
|
), item.matricula
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -5,24 +5,49 @@ 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 {
|
||||||
|
val filteredList = it.filter { itemShelving ->
|
||||||
|
itemShelving.shelving.parking != null
|
||||||
|
}
|
||||||
|
ItemShelvingsList(filteredList)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -0,0 +1,378 @@
|
||||||
|
package es.verdnatura.presentation.view.feature.buscaritem.fragment
|
||||||
|
|
||||||
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.combinedClickable
|
||||||
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
|
import androidx.compose.foundation.lazy.items
|
||||||
|
import androidx.compose.material3.HorizontalDivider
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.runtime.setValue
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.focus.FocusRequester
|
||||||
|
import androidx.compose.ui.focus.focusRequester
|
||||||
|
import androidx.compose.ui.focus.onFocusEvent
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
|
import es.verdnatura.R
|
||||||
|
import es.verdnatura.presentation.composable.CustomToolbar
|
||||||
|
import es.verdnatura.presentation.composable.LottieLoadingAnimation
|
||||||
|
import es.verdnatura.presentation.composable.ScanLineTextSearch
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun BuscarItemScreen(
|
||||||
|
viewModel: BuscarItemComposeViewModel,
|
||||||
|
onBackClick: () -> Unit,
|
||||||
|
onItemLongClick: (sector: String) -> Unit,
|
||||||
|
onItemClick: (matricula: String) -> Unit,
|
||||||
|
title: String
|
||||||
|
) {
|
||||||
|
val uiState by viewModel.uiState.collectAsStateWithLifecycle()
|
||||||
|
|
||||||
|
val locationItems = uiState.items
|
||||||
|
.filter { it.shelving.parking != null }
|
||||||
|
.map {
|
||||||
|
LocationItem(
|
||||||
|
parking = it.shelving.parking!!.code,
|
||||||
|
matricula = it.shelving.code,
|
||||||
|
visible = it.visible.toString(),
|
||||||
|
reserve = it.available.toString(),
|
||||||
|
priority = it.shelving.priority.toString(),
|
||||||
|
fecha = it.created,
|
||||||
|
sector = it.shelving.parking.sector.description
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
LocationScreenContent(
|
||||||
|
items = locationItems,
|
||||||
|
isLoading = uiState.isLoading,
|
||||||
|
titleToolBar = if (uiState.itemFk != null) {
|
||||||
|
LocalContext.current.getString(
|
||||||
|
R.string.itemsTotal,
|
||||||
|
uiState.itemFk,
|
||||||
|
LocalContext.current.getString(R.string.visibleTotal),
|
||||||
|
uiState.items
|
||||||
|
.filter { it.shelving.parking != null }
|
||||||
|
.sumOf { it.visible }
|
||||||
|
)
|
||||||
|
} else title,
|
||||||
|
onTextChange = { input -> viewModel.getIdFromCodeSalix(input) },
|
||||||
|
onBackClick = onBackClick,
|
||||||
|
onLongClick = onItemLongClick,
|
||||||
|
onClick = onItemClick,
|
||||||
|
modifier = Modifier
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun LocationScreenContent(
|
||||||
|
items: List<LocationItem>,
|
||||||
|
isLoading: Boolean,
|
||||||
|
titleToolBar: String,
|
||||||
|
onTextChange: (String) -> Unit,
|
||||||
|
onBackClick: () -> Unit,
|
||||||
|
onLongClick: (String) -> Unit,
|
||||||
|
onClick: (String) -> Unit,
|
||||||
|
modifier: Modifier
|
||||||
|
) {
|
||||||
|
var searchText by remember { mutableStateOf("") }
|
||||||
|
val focusRequester = remember { FocusRequester() }
|
||||||
|
val keyboardController = LocalSoftwareKeyboardController.current
|
||||||
|
|
||||||
|
val onImeAction: () -> Unit = {
|
||||||
|
onTextChange(searchText)
|
||||||
|
searchText = ""
|
||||||
|
keyboardController?.hide()
|
||||||
|
}
|
||||||
|
Box(
|
||||||
|
modifier = modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.background(Color.Black)
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
modifier = modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.background(Color.Black)
|
||||||
|
|
||||||
|
) {
|
||||||
|
|
||||||
|
CustomToolbar(
|
||||||
|
title = titleToolBar,
|
||||||
|
subtitle = "",
|
||||||
|
showBackButton = true,
|
||||||
|
showSwitch = false,
|
||||||
|
iconList = listOf(),
|
||||||
|
onBackClick = onBackClick,
|
||||||
|
onSwitchChange = { },
|
||||||
|
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
|
||||||
|
|
||||||
|
ScanLineTextSearch(
|
||||||
|
value = searchText,
|
||||||
|
onValueChange = {
|
||||||
|
searchText = it
|
||||||
|
},
|
||||||
|
onImeAction,
|
||||||
|
modifier = Modifier
|
||||||
|
.focusRequester(focusRequester)
|
||||||
|
.onFocusEvent {
|
||||||
|
if (it.isFocused) {
|
||||||
|
keyboardController?.hide() // Asegura que el teclado no se abra
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
LaunchedEffect(Unit) {
|
||||||
|
focusRequester.requestFocus()
|
||||||
|
keyboardController?.hide()
|
||||||
|
}
|
||||||
|
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(vertical = 8.dp),
|
||||||
|
horizontalArrangement = Arrangement.Start
|
||||||
|
) {
|
||||||
|
listOf(
|
||||||
|
R.string.parking,
|
||||||
|
R.string.Matrícula,
|
||||||
|
R.string.Visible,
|
||||||
|
R.string.reserve,
|
||||||
|
R.string.priority,
|
||||||
|
R.string.date
|
||||||
|
).forEach { textRes ->
|
||||||
|
Text(
|
||||||
|
text = stringResource(id = textRes),
|
||||||
|
color = Color.White,
|
||||||
|
fontSize = 14.sp,
|
||||||
|
modifier = Modifier.weight(1f)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HorizontalDivider(thickness = 1.dp, color = Color.White)
|
||||||
|
LazyColumn(
|
||||||
|
modifier = Modifier.fillMaxSize()
|
||||||
|
) {
|
||||||
|
|
||||||
|
items(items) { item ->
|
||||||
|
|
||||||
|
LocationRow(
|
||||||
|
item = item,
|
||||||
|
onLongClick = { selectedItem ->
|
||||||
|
onLongClick(selectedItem.sector)
|
||||||
|
},
|
||||||
|
onClick = { selectedItem ->
|
||||||
|
onClick(selectedItem.matricula)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
HorizontalDivider(thickness = 1.dp, color = Color.White)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isLoading) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.background(Color.Black.copy(alpha = 0.7f)),
|
||||||
|
contentAlignment = Alignment.Center
|
||||||
|
) {
|
||||||
|
LottieLoadingAnimation(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Como estaba
|
||||||
|
|
||||||
|
/*@Composable
|
||||||
|
fun LocationScreen(
|
||||||
|
//viewModel: ViewModel?, // Falta ver de arreglar con koin o viewmodel → No necesario, en el Fragment observa
|
||||||
|
items: List<LocationItem>,
|
||||||
|
onTextChange: (String) -> Unit,
|
||||||
|
titleToolBar: String,
|
||||||
|
onBackClick: () -> Unit = {},
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
onLongClick: (LocationItem) -> Unit,
|
||||||
|
onClick: (LocationItem) -> Unit
|
||||||
|
) {
|
||||||
|
|
||||||
|
var searchText by remember { mutableStateOf("") }
|
||||||
|
val focusRequester = remember { FocusRequester() }
|
||||||
|
val keyboardController = LocalSoftwareKeyboardController.current
|
||||||
|
var showLoading by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
|
val onImeAction: () -> Unit = {
|
||||||
|
onTextChange(searchText)
|
||||||
|
searchText = ""
|
||||||
|
keyboardController?.hide()
|
||||||
|
}
|
||||||
|
Box(
|
||||||
|
modifier = modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.background(Color.Black)
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
modifier = modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.background(Color.Black)
|
||||||
|
|
||||||
|
) {
|
||||||
|
if (showLoading) {
|
||||||
|
LottieLoadingAnimation(true)
|
||||||
|
}
|
||||||
|
CustomToolbar(
|
||||||
|
title = titleToolBar,
|
||||||
|
subtitle = "",
|
||||||
|
showBackButton = true,
|
||||||
|
showSwitch = false,
|
||||||
|
iconList = listOf(),
|
||||||
|
onBackClick = onBackClick,
|
||||||
|
onSwitchChange = { },
|
||||||
|
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
|
||||||
|
|
||||||
|
ScanLineTextSearch(
|
||||||
|
value = searchText,
|
||||||
|
onValueChange = {
|
||||||
|
searchText = it
|
||||||
|
showLoading = true
|
||||||
|
},
|
||||||
|
onImeAction,
|
||||||
|
modifier = Modifier
|
||||||
|
.focusRequester(focusRequester)
|
||||||
|
.onFocusEvent {
|
||||||
|
if (it.isFocused) {
|
||||||
|
keyboardController?.hide() // Asegura que el teclado no se abra
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
LaunchedEffect(Unit) {
|
||||||
|
focusRequester.requestFocus()
|
||||||
|
keyboardController?.hide()
|
||||||
|
}
|
||||||
|
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(vertical = 8.dp),
|
||||||
|
horizontalArrangement = Arrangement.Start
|
||||||
|
) {
|
||||||
|
listOf(
|
||||||
|
R.string.parking,
|
||||||
|
R.string.Matrícula,
|
||||||
|
R.string.Visible,
|
||||||
|
R.string.reserve,
|
||||||
|
R.string.priority,
|
||||||
|
R.string.date
|
||||||
|
).forEach { textRes ->
|
||||||
|
Text(
|
||||||
|
text = stringResource(id = textRes),
|
||||||
|
color = Color.White,
|
||||||
|
fontSize = 14.sp,
|
||||||
|
modifier = Modifier.weight(1f)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HorizontalDivider(thickness = 1.dp, color = Color.White)
|
||||||
|
LazyColumn(
|
||||||
|
modifier = Modifier.fillMaxSize()
|
||||||
|
) {
|
||||||
|
|
||||||
|
items(items) { item ->
|
||||||
|
|
||||||
|
LocationRow(
|
||||||
|
item = item,
|
||||||
|
onLongClick = { selectedItem ->
|
||||||
|
onLongClick(selectedItem)
|
||||||
|
},
|
||||||
|
onClick = { selectedItem ->
|
||||||
|
onClick(selectedItem)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
HorizontalDivider(thickness = 1.dp, color = Color.White)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
showLoading = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
@OptIn(ExperimentalFoundationApi::class)
|
||||||
|
@Composable
|
||||||
|
fun LocationRow(
|
||||||
|
item: LocationItem, onLongClick: (LocationItem) -> Unit, onClick: (LocationItem) -> Unit
|
||||||
|
) {
|
||||||
|
Row(modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(vertical = 4.dp)
|
||||||
|
.combinedClickable(onClick = { onClick(item) }, onLongClick = { onLongClick(item) }
|
||||||
|
|
||||||
|
), horizontalArrangement = Arrangement.SpaceEvenly) {
|
||||||
|
Text(text = item.parking, color = Color.White, modifier = Modifier.weight(1f))
|
||||||
|
Text(text = item.matricula, color = Color.White, modifier = Modifier.weight(1f))
|
||||||
|
Text(text = item.visible, color = Color.White, modifier = Modifier.weight(1f))
|
||||||
|
Text(text = item.reserve, color = Color.White, modifier = Modifier.weight(1f))
|
||||||
|
Text(text = item.priority, color = Color.White, modifier = Modifier.weight(1f))
|
||||||
|
Text(
|
||||||
|
text = item.fecha,
|
||||||
|
color = Color.White,
|
||||||
|
modifier = Modifier.weight(1f),
|
||||||
|
textAlign = TextAlign.Center
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Modelo de datos
|
||||||
|
data class LocationItem(
|
||||||
|
val parking: String,
|
||||||
|
val matricula: String,
|
||||||
|
val visible: String,
|
||||||
|
val reserve: String,
|
||||||
|
val priority: String,
|
||||||
|
val fecha: String,
|
||||||
|
val sector: String
|
||||||
|
)
|
||||||
|
|
||||||
|
// Vista previa
|
||||||
|
/*@Preview(showBackground = true)
|
||||||
|
@Composable
|
||||||
|
fun PreviewLocationScreen() {
|
||||||
|
LocationScreen(
|
||||||
|
items = listOf(
|
||||||
|
LocationItem("P1", "1234ABC", "Sí", "No", "Alta", "12/02/2025", "previa"),
|
||||||
|
LocationItem("P2", "5678DEF", "No", "Sí", "Baja", "13/02/2025", "previa")
|
||||||
|
),
|
||||||
|
onTextChange = {},
|
||||||
|
titleToolBar = "Buscar Item",
|
||||||
|
onBackClick = {},
|
||||||
|
onLongClick = {},
|
||||||
|
onClick = {})
|
||||||
|
|
||||||
|
}*/
|
|
@ -2,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(),
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,18 +1,21 @@
|
||||||
package es.verdnatura.presentation.view.feature.collection.adapter
|
package es.verdnatura.presentation.view.feature.collection.adapter
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.graphics.Paint
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.ItemPlacementRowBinding
|
import es.verdnatura.databinding.ItemPlacementRowBinding
|
||||||
|
import es.verdnatura.domain.ConstAndValues.CONTROLADOR
|
||||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.PlacementVO
|
import es.verdnatura.presentation.view.feature.sacador.model.PlacementVO
|
||||||
|
|
||||||
class PlacementAdapter(
|
class PlacementAdapter(
|
||||||
private val items: List<PlacementVO>,
|
private val items: List<PlacementVO>,
|
||||||
private val onPasillerosItemClickListener: OnPasillerosItemClickListener
|
private val onPasillerosItemClickListener: OnPasillerosItemClickListener,
|
||||||
|
private val type: String? = null
|
||||||
) : RecyclerView.Adapter<PlacementAdapter.AjustesItemHolder>() {
|
) : RecyclerView.Adapter<PlacementAdapter.AjustesItemHolder>() {
|
||||||
var context: Context? = null
|
var context: Context? = null
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AjustesItemHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AjustesItemHolder {
|
||||||
|
@ -33,16 +36,23 @@ class PlacementAdapter (
|
||||||
) : RecyclerView.ViewHolder(binding.root) {
|
) : RecyclerView.ViewHolder(binding.root) {
|
||||||
fun bind(placement: PlacementVO) {
|
fun bind(placement: PlacementVO) {
|
||||||
binding.apply {
|
binding.apply {
|
||||||
if (placement.placement.isNullOrEmpty())
|
if (placement.placement.isNullOrEmpty()) placement.placement = placement.parking
|
||||||
placement.placement = placement.parking
|
if (placement.visible.isNullOrEmpty()) placement.visible =
|
||||||
if (placement.visible.isNullOrEmpty())
|
"(" + placement.stockTotal + ")"
|
||||||
placement.visible = "("+placement.stockTotal+")"
|
|
||||||
this.item = placement
|
this.item = placement
|
||||||
|
|
||||||
itemRootLayout.setOnClickListener {
|
itemRootLayout.setOnClickListener {
|
||||||
onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title =
|
onPasillerosItemClickListener.onPasillerosItemClickListener(
|
||||||
R.string.titleUbicator),placement.shelving)
|
PasillerosItemVO(
|
||||||
}
|
title = R.string.titleUbicator
|
||||||
|
), placement.shelving
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (type == CONTROLADOR) {
|
||||||
|
placementcode.paintFlags = placementcode.paintFlags or Paint.UNDERLINE_TEXT_FLAG
|
||||||
|
placementcode.paintFlags = placementcode.paintFlags or Paint.UNDERLINE_TEXT_FLAG
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,10 +3,12 @@ package es.verdnatura.presentation.view.feature.collection.adapter
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.res.ColorStateList
|
import android.content.res.ColorStateList
|
||||||
import android.graphics.Color
|
import android.graphics.Color
|
||||||
|
import android.graphics.Paint
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.View.GONE
|
import android.view.View.GONE
|
||||||
|
import android.view.View.INVISIBLE
|
||||||
import android.view.View.VISIBLE
|
import android.view.View.VISIBLE
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.core.content.ContextCompat.getColor
|
import androidx.core.content.ContextCompat.getColor
|
||||||
|
@ -83,7 +85,7 @@ class SaleAdapter(
|
||||||
|
|
||||||
itemArticlePlacements.apply {
|
itemArticlePlacements.apply {
|
||||||
layoutManager = childLayoutManager
|
layoutManager = childLayoutManager
|
||||||
adapter = PlacementAdapter(sale.placements, onPasillerosItemClickListener)
|
adapter = PlacementAdapter(sale.placements, onPasillerosItemClickListener, type)
|
||||||
}
|
}
|
||||||
|
|
||||||
//CLICK EVENTS
|
//CLICK EVENTS
|
||||||
|
@ -132,9 +134,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 +150,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 +162,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 +283,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 +313,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 +377,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 +388,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 +400,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 {
|
||||||
|
@ -418,13 +423,15 @@ class SaleAdapter(
|
||||||
itemTicketColor.setOnClickListener {
|
itemTicketColor.setOnClickListener {
|
||||||
onTicketColorClickListener?.onTicketColorListener(sale)
|
onTicketColorClickListener?.onTicketColorListener(sale)
|
||||||
}
|
}
|
||||||
if (type == SACADOR || type == CONTROLADOR) {
|
if (type == CONTROLADOR) {
|
||||||
itemTicketColor.tooltipText = context!!.getString(R.string.filterLevelColor)
|
itemTicketColor.tooltipText = context!!.getString(R.string.filterLevelColor)
|
||||||
|
ticketFk.paintFlags = ticketFk.paintFlags or Paint.UNDERLINE_TEXT_FLAG
|
||||||
|
itemArticleItemFk.paintFlags =
|
||||||
|
itemArticleItemFk.paintFlags or Paint.UNDERLINE_TEXT_FLAG
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ticketFk.paintFlags = ticketFk.paintFlags or Paint.UNDERLINE_TEXT_FLAG
|
|
||||||
itemArticleItemFk.paintFlags =
|
|
||||||
itemArticleItemFk.paintFlags or Paint.UNDERLINE_TEXT_FLAG*/
|
|
||||||
|
|
||||||
|
|
||||||
this.sale = sale
|
this.sale = sale
|
||||||
|
@ -503,8 +510,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,366 @@
|
||||||
|
package es.verdnatura.presentation.view.feature.collection.adapter
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.res.ColorStateList
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.graphics.drawable.Drawable
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View.GONE
|
||||||
|
import android.view.View.INVISIBLE
|
||||||
|
import android.view.View.VISIBLE
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.core.content.ContextCompat.getColor
|
||||||
|
import androidx.core.graphics.drawable.DrawableCompat
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import es.verdnatura.R
|
||||||
|
import es.verdnatura.databinding.SaleRowFragmentReserveBinding
|
||||||
|
import es.verdnatura.domain.ConstAndValues.PREITEMPICKERTEST
|
||||||
|
import es.verdnatura.domain.ConstAndValues.PREPARED
|
||||||
|
import es.verdnatura.domain.ConstAndValues.SACADOR
|
||||||
|
import es.verdnatura.presentation.common.OnAddItemClickListener
|
||||||
|
import es.verdnatura.presentation.common.OnMistakeClickListener
|
||||||
|
import es.verdnatura.presentation.common.OnPackingClickSaleListener
|
||||||
|
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||||
|
import es.verdnatura.presentation.common.OnSaleClickSaleListener
|
||||||
|
import es.verdnatura.presentation.common.OnSaleReserveClickListener
|
||||||
|
import es.verdnatura.presentation.common.OnTicketClickSaleListener
|
||||||
|
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||||
|
import es.verdnatura.presentation.view.feature.sacador.model.Sale
|
||||||
|
|
||||||
|
class SaleAdapterReserve(
|
||||||
|
private val items: List<Sale>,
|
||||||
|
private val onPasillerosItemClickListener: OnPasillerosItemClickListener,
|
||||||
|
private val onSaleClickListener: OnSaleClickSaleListener,
|
||||||
|
private val onMistakeClickListener: OnMistakeClickListener,
|
||||||
|
private val onPackingClick: OnPackingClickSaleListener,
|
||||||
|
private var onTicketClick: OnTicketClickSaleListener? = null,
|
||||||
|
private var saleAdapter: SaleAdapterReserve? = null,
|
||||||
|
private var onReserveSaleClick: OnSaleReserveClickListener? = null,
|
||||||
|
private var onAddItemClickListener: OnAddItemClickListener? = null,
|
||||||
|
private var type: String? = null,
|
||||||
|
|
||||||
|
) : RecyclerView.Adapter<SaleAdapterReserve.AjustesItemHolder>() {
|
||||||
|
var context: Context? = null
|
||||||
|
var position: Int = 0
|
||||||
|
|
||||||
|
var isExpanded: Boolean = type == "PRECHECKER"
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AjustesItemHolder {
|
||||||
|
this.context = parent.context
|
||||||
|
|
||||||
|
|
||||||
|
return AjustesItemHolder(
|
||||||
|
|
||||||
|
SaleRowFragmentReserveBinding.inflate(
|
||||||
|
LayoutInflater.from(parent.context), parent, false
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getItemCount() = items.size
|
||||||
|
|
||||||
|
override fun onBindViewHolder(holder: AjustesItemHolder, position: Int) {
|
||||||
|
this.position = position
|
||||||
|
val item = items[position]
|
||||||
|
val calculatedValues = precalculateDisplayValues(item)
|
||||||
|
holder.bind(item, calculatedValues)
|
||||||
|
}
|
||||||
|
|
||||||
|
inner class AjustesItemHolder(
|
||||||
|
val binding: SaleRowFragmentReserveBinding
|
||||||
|
) : RecyclerView.ViewHolder(binding.root) {
|
||||||
|
fun bind(sale: Sale, calculatedValues: Pair<String, String>) {
|
||||||
|
binding.apply {
|
||||||
|
println("type $type ")
|
||||||
|
println("type isExpanded $isExpanded")
|
||||||
|
/* val childLayoutManager =
|
||||||
|
LinearLayoutManager(context!!, RecyclerView.HORIZONTAL, false)
|
||||||
|
*/
|
||||||
|
val childLayoutManagerV =
|
||||||
|
LinearLayoutManager(context!!, RecyclerView.VERTICAL, false)
|
||||||
|
|
||||||
|
/* itemArticlePlacements.apply {
|
||||||
|
layoutManager = childLayoutManager
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
|
//CLICK EVENTS
|
||||||
|
contentLayout.setOnClickListener {
|
||||||
|
if (!sale.isParent) {
|
||||||
|
onSaleClickListener.onSaleClick(sale)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
txtColor.setOnClickListener {
|
||||||
|
if (!sale.isParent) {
|
||||||
|
onSaleClickListener.onSaleClick(sale)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
txtDescrip.setOnClickListener {
|
||||||
|
if (!sale.isParent) {
|
||||||
|
onSaleClickListener.onSaleClick(sale)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ticketFk.setOnClickListener {
|
||||||
|
onTicketClick?.onTicketClickListener(sale)
|
||||||
|
}
|
||||||
|
|
||||||
|
txtParking.setOnClickListener {
|
||||||
|
onPasillerosItemClickListener.onPasillerosItemClickListener(
|
||||||
|
PasillerosItemVO(
|
||||||
|
title = R.string.titleItemSearch
|
||||||
|
), sale.itemFk.toString()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
txtShelving.setOnClickListener {
|
||||||
|
onPackingClick.onPackingClick(sale)
|
||||||
|
}
|
||||||
|
|
||||||
|
txtItem.setOnClickListener {
|
||||||
|
onPasillerosItemClickListener.onPasillerosItemClickListener(
|
||||||
|
PasillerosItemVO(
|
||||||
|
title = R.string.titleItemConsult
|
||||||
|
), sale.itemFk.toString()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
//ERROR
|
||||||
|
|
||||||
|
if (sale.originalQuantity != sale.saleQuantity && sale.originalQuantity != null && !sale.isParent) {
|
||||||
|
layoutError.visibility = VISIBLE
|
||||||
|
txtError.text =
|
||||||
|
binding.root.context.getString(R.string.originalQuantity) + sale.originalQuantity
|
||||||
|
binding.addItem.visibility = VISIBLE
|
||||||
|
|
||||||
|
} else {
|
||||||
|
layoutError.visibility = GONE
|
||||||
|
binding.addItem.visibility = GONE
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.deleteReserve.visibility = if (sale.isAdded == 1) VISIBLE else GONE
|
||||||
|
|
||||||
|
if (sale.isAdded == 1) {
|
||||||
|
layoutError.visibility = VISIBLE
|
||||||
|
txtError.text = binding.root.context.getString(R.string.newItem)
|
||||||
|
binding.deleteReserve.setOnClickListener {
|
||||||
|
onReserveSaleClick!!.onSaleReserveListener(sale)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (isExpanded) {
|
||||||
|
itemArticlePlacements.visibility = VISIBLE
|
||||||
|
ivArrow.setImageResource(R.drawable.ic_arrow_down)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
itemArticlePlacements.visibility = GONE
|
||||||
|
ivArrow.setImageResource(R.drawable.ic_arrow_up)
|
||||||
|
}
|
||||||
|
|
||||||
|
itemArticlePlacements.visibility = if (isExpanded) VISIBLE else {
|
||||||
|
GONE
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sale.isParent) {
|
||||||
|
txtQuantity.visibility = INVISIBLE
|
||||||
|
txtQuantityReserved.visibility = INVISIBLE
|
||||||
|
txtReserveToComplete.visibility = GONE
|
||||||
|
imageErrorMessage.visibility = GONE
|
||||||
|
ivArrow.visibility = VISIBLE
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
imageErrorMessage.visibility = GONE
|
||||||
|
if (type != SACADOR && type != PREITEMPICKERTEST) {
|
||||||
|
val colorRes =
|
||||||
|
if (sale.hasMistake == true) R.color.verdnatura_red_salix else R.color.verdnatura_black
|
||||||
|
imageErrorMessage.imageTintList =
|
||||||
|
ColorStateList.valueOf(getColor(context!!, colorRes))
|
||||||
|
imageErrorMessage.visibility = VISIBLE
|
||||||
|
} else {
|
||||||
|
imageErrorMessage.visibility = GONE
|
||||||
|
}
|
||||||
|
ivArrow.visibility = INVISIBLE
|
||||||
|
}
|
||||||
|
println("sonSales ${sale.sonSales}")
|
||||||
|
|
||||||
|
if (!sale.sonSales.isNullOrEmpty()) {
|
||||||
|
|
||||||
|
itemArticlePlacements.apply {
|
||||||
|
layoutManager = childLayoutManagerV
|
||||||
|
adapter = SaleAdapterReserve(
|
||||||
|
sale.sonSales,
|
||||||
|
onPasillerosItemClickListener,
|
||||||
|
onSaleClickListener,
|
||||||
|
onMistakeClickListener,
|
||||||
|
onPackingClick,
|
||||||
|
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
itemArticlePlacements.visibility = VISIBLE
|
||||||
|
}
|
||||||
|
|
||||||
|
ivArrow.setOnClickListener {
|
||||||
|
|
||||||
|
if (isExpanded) {
|
||||||
|
ivArrow.setImageResource(R.drawable.ic_arrow_up)
|
||||||
|
itemArticlePlacements.visibility = GONE
|
||||||
|
} else {
|
||||||
|
ivArrow.setImageResource(R.drawable.ic_arrow_down)
|
||||||
|
itemArticlePlacements.visibility = VISIBLE
|
||||||
|
}
|
||||||
|
isExpanded = !isExpanded
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sale.saleGroupFk == null) {
|
||||||
|
previous.visibility = INVISIBLE
|
||||||
|
} else {
|
||||||
|
previous.visibility = VISIBLE
|
||||||
|
previous.text = "PREV:${sale.saleGroupFk}"
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.txtQuantityReserved.text = calculatedValues.first
|
||||||
|
if (sale.totalItemShelving > 1) {
|
||||||
|
binding.txtQuantityReserved.text = calculatedValues.first
|
||||||
|
binding.txtQuantity.text = calculatedValues.second
|
||||||
|
binding.txtReserveToComplete.text =
|
||||||
|
"${sale.currentItemShelving}/${sale.totalItemShelving}"
|
||||||
|
binding.txtReserveToComplete.visibility = VISIBLE
|
||||||
|
binding.txtQuantity.text =
|
||||||
|
"${sale.reservedQuantity}"
|
||||||
|
} else {
|
||||||
|
binding.txtQuantity.text =
|
||||||
|
if (sale.itemShelvingFk == 0 && sale.itemShelvingSaleFk == 0) {
|
||||||
|
"${sale.saleQuantity}"
|
||||||
|
} else "${sale.reservedQuantity}"
|
||||||
|
binding.txtReserveToComplete.visibility = GONE
|
||||||
|
|
||||||
|
}
|
||||||
|
binding.txtReserveToComplete.text =
|
||||||
|
"${sale.currentItemShelving}/${sale.totalItemShelving}"
|
||||||
|
|
||||||
|
//COLORES
|
||||||
|
paintTicketcolor(sale.rgb, binding.itemTicketColor.background)
|
||||||
|
if (sale.isPicked == 1) {
|
||||||
|
if (type == PREPARED) {
|
||||||
|
contentLayout.setBackgroundColor(
|
||||||
|
|
||||||
|
if (sale.saleGroupFk == null) {
|
||||||
|
getColor(
|
||||||
|
context!!, R.color.verdnatura_orange_salix
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
println("stateCode ${sale.stateCode}")
|
||||||
|
if (sale.stateCode != null && sale.stateCode == "PREPARED") {
|
||||||
|
getColor(
|
||||||
|
context!!, R.color.verdnatura_orange_salix
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
if (sale.stateCode != null && sale.stateCode == "OK PREVIOUS") {
|
||||||
|
getColor(
|
||||||
|
context!!, R.color.verdnatura_dark_sky_blue
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
if (sale.stateCode != null && sale.stateCode == "PREVIOUS_CONTROLLED") {
|
||||||
|
getColor(
|
||||||
|
context!!, R.color.verdnatura_dark_mint_light
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
getColor(
|
||||||
|
context!!, R.color.verdnatura_black
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
contentLayout.setBackgroundColor(
|
||||||
|
getColor(
|
||||||
|
context!!, R.color.verdnatura_dark_sky_blue
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
contentLayout.setBackgroundColor(
|
||||||
|
getColor(
|
||||||
|
context!!, R.color.verdnatura_black
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.txtParking.text =
|
||||||
|
// if (type == PREPARED) sale.parkingCodePrevia else sale.parkingCode
|
||||||
|
sale.parkingCode ?: sale.parkingCodePrevia
|
||||||
|
|
||||||
|
binding.addItem.setOnClickListener {
|
||||||
|
onAddItemClickListener!!.onAddItemClickListener(sale)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == PREITEMPICKERTEST) {
|
||||||
|
binding.level.visibility = GONE
|
||||||
|
binding.levelTxt.visibility = GONE
|
||||||
|
binding.ticketOrder.visibility = VISIBLE
|
||||||
|
binding.txtPoints.visibility = GONE
|
||||||
|
} else {
|
||||||
|
binding.level.visibility = VISIBLE
|
||||||
|
binding.levelTxt.visibility = VISIBLE
|
||||||
|
binding.ticketOrder.visibility = GONE
|
||||||
|
binding.txtPoints.visibility = VISIBLE
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
this.sale = sale
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun paintTicketcolor(color: String?, backgroundDrawableTicket: Drawable) {
|
||||||
|
|
||||||
|
if (color.isNullOrBlank()) {
|
||||||
|
DrawableCompat.setTint(
|
||||||
|
backgroundDrawableTicket, Color.TRANSPARENT
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
DrawableCompat.setTint(
|
||||||
|
backgroundDrawableTicket, Color.parseColor(color)
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun precalculateDisplayValues(sale: Sale): Pair<String, String> {
|
||||||
|
try {
|
||||||
|
val result = sale.reservedQuantity % (sale.packing ?: (sale.saleQuantity + 1))
|
||||||
|
val textToConcat = if (result != 0) {
|
||||||
|
"${sale.reservedQuantity / (sale.grouping ?: 1)} x ${sale.grouping ?: "1"}"
|
||||||
|
} else {
|
||||||
|
"${sale.reservedQuantity / (sale.packing ?: 1)} pack de ${sale.packing ?: "1"}"
|
||||||
|
}
|
||||||
|
|
||||||
|
val result2 = sale.accumulatedQuantity % (sale.packing ?: (sale.saleQuantity + 1))
|
||||||
|
val textToConcat2 = if (result2 != 0) {
|
||||||
|
"${(sale.saleQuantity - sale.accumulatedQuantity) / (sale.grouping ?: 1)} x ${sale.grouping ?: "1"}"
|
||||||
|
} else {
|
||||||
|
"${(sale.saleQuantity - sale.accumulatedQuantity) / (sale.packing ?: 1)} pack de ${sale.packing ?: "1"}"
|
||||||
|
}
|
||||||
|
return if (sale.itemShelvingSaleFk == 0 && sale.itemShelvingFk == 0) Pair(
|
||||||
|
"-",
|
||||||
|
"0"
|
||||||
|
) else {
|
||||||
|
Pair(textToConcat, textToConcat2)
|
||||||
|
}
|
||||||
|
} catch (ex: Exception) {
|
||||||
|
return Pair("Error", "Error")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,367 @@
|
||||||
|
package es.verdnatura.presentation.view.feature.collection.adapter
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.res.ColorStateList
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.graphics.drawable.Drawable
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View.GONE
|
||||||
|
import android.view.View.INVISIBLE
|
||||||
|
import android.view.View.VISIBLE
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import androidx.core.content.ContextCompat.getColor
|
||||||
|
import androidx.core.graphics.drawable.DrawableCompat
|
||||||
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import es.verdnatura.R
|
||||||
|
import es.verdnatura.databinding.SaleRowFragmentReserveSacadorBinding
|
||||||
|
import es.verdnatura.domain.ConstAndValues.PREITEMPICKERTEST
|
||||||
|
import es.verdnatura.domain.ConstAndValues.PREPARED
|
||||||
|
import es.verdnatura.domain.ConstAndValues.SACADOR
|
||||||
|
import es.verdnatura.presentation.common.OnAddItemClickListener
|
||||||
|
import es.verdnatura.presentation.common.OnMistakeClickListener
|
||||||
|
import es.verdnatura.presentation.common.OnPackingClickSaleListener
|
||||||
|
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||||
|
import es.verdnatura.presentation.common.OnSaleClickSaleListener
|
||||||
|
import es.verdnatura.presentation.common.OnSaleReserveClickListener
|
||||||
|
import es.verdnatura.presentation.common.OnTicketClickSaleListener
|
||||||
|
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||||
|
import es.verdnatura.presentation.view.feature.sacador.model.Sale
|
||||||
|
|
||||||
|
class SaleAdapterReserveSacador(
|
||||||
|
private val items: List<Sale>,
|
||||||
|
private val onPasillerosItemClickListener: OnPasillerosItemClickListener,
|
||||||
|
private val onSaleClickListener: OnSaleClickSaleListener,
|
||||||
|
private val onMistakeClickListener: OnMistakeClickListener,
|
||||||
|
private val onPackingClick: OnPackingClickSaleListener,
|
||||||
|
private var onTicketClick: OnTicketClickSaleListener? = null,
|
||||||
|
private var saleAdapter: SaleAdapterReserveSacador? = null,
|
||||||
|
private var onReserveSaleClick: OnSaleReserveClickListener? = null,
|
||||||
|
private var onAddItemClickListener: OnAddItemClickListener? = null,
|
||||||
|
private var type: String? = null,
|
||||||
|
|
||||||
|
) : RecyclerView.Adapter<SaleAdapterReserveSacador.AjustesItemHolder>() {
|
||||||
|
var context: Context? = null
|
||||||
|
var position: Int = 0
|
||||||
|
|
||||||
|
var isExpanded: Boolean = false
|
||||||
|
|
||||||
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AjustesItemHolder {
|
||||||
|
this.context = parent.context
|
||||||
|
|
||||||
|
|
||||||
|
return AjustesItemHolder(
|
||||||
|
|
||||||
|
SaleRowFragmentReserveSacadorBinding.inflate(
|
||||||
|
LayoutInflater.from(parent.context), parent, false
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getItemCount() = items.size
|
||||||
|
|
||||||
|
override fun onBindViewHolder(holder: AjustesItemHolder, position: Int) {/* this.position = position
|
||||||
|
holder.bind(items[position])*/
|
||||||
|
this.position = position
|
||||||
|
val item = items[position]
|
||||||
|
val calculatedValues = precalculateDisplayValues(item)
|
||||||
|
holder.bind(item, calculatedValues)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
inner class AjustesItemHolder(
|
||||||
|
val binding: SaleRowFragmentReserveSacadorBinding
|
||||||
|
) : RecyclerView.ViewHolder(binding.root) {
|
||||||
|
fun bind(sale: Sale, calculatedValues: Pair<String, String>) {
|
||||||
|
binding.apply {
|
||||||
|
|
||||||
|
val childLayoutManagerV =
|
||||||
|
LinearLayoutManager(context!!, RecyclerView.VERTICAL, false)
|
||||||
|
|
||||||
|
//CLICK EVENTS
|
||||||
|
contentLayout.setOnClickListener {
|
||||||
|
if (!sale.isParent) {
|
||||||
|
onSaleClickListener.onSaleClick(sale)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
txtColor.setOnClickListener {
|
||||||
|
if (!sale.isParent) {
|
||||||
|
onSaleClickListener.onSaleClick(sale)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
txtDescrip.setOnClickListener {
|
||||||
|
if (!sale.isParent) {
|
||||||
|
onSaleClickListener.onSaleClick(sale)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ticketFk.setOnClickListener {
|
||||||
|
onTicketClick?.onTicketClickListener(sale)
|
||||||
|
}
|
||||||
|
|
||||||
|
txtParking.setOnClickListener {
|
||||||
|
onPasillerosItemClickListener.onPasillerosItemClickListener(
|
||||||
|
PasillerosItemVO(
|
||||||
|
title = R.string.titleItemSearch
|
||||||
|
), sale.itemFk.toString()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
txtShelving.setOnClickListener {
|
||||||
|
onPackingClick.onPackingClick(sale)
|
||||||
|
}
|
||||||
|
|
||||||
|
txtItem.setOnClickListener {
|
||||||
|
onPasillerosItemClickListener.onPasillerosItemClickListener(
|
||||||
|
PasillerosItemVO(
|
||||||
|
title = R.string.titleItemConsult
|
||||||
|
), sale.itemFk.toString()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
//ERROR
|
||||||
|
|
||||||
|
if (sale.originalQuantity != sale.saleQuantity && sale.originalQuantity != null && !sale.isParent) {
|
||||||
|
layoutError.visibility = VISIBLE
|
||||||
|
txtError.text =
|
||||||
|
binding.root.context.getString(R.string.originalQuantity) + sale.originalQuantity
|
||||||
|
binding.addItem.visibility = VISIBLE
|
||||||
|
|
||||||
|
} else {
|
||||||
|
layoutError.visibility = GONE
|
||||||
|
binding.addItem.visibility = GONE
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.deleteReserve.visibility = if (sale.isAdded == 1) VISIBLE else GONE
|
||||||
|
|
||||||
|
if (sale.isAdded == 1) {
|
||||||
|
layoutError.visibility = VISIBLE
|
||||||
|
txtError.text = binding.root.context.getString(R.string.newItem)
|
||||||
|
binding.deleteReserve.setOnClickListener {
|
||||||
|
onReserveSaleClick!!.onSaleReserveListener(sale)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (sale.isParent) {
|
||||||
|
txtQuantity.visibility = INVISIBLE
|
||||||
|
txtQuantityReserved.visibility = INVISIBLE
|
||||||
|
txtReserveToComplete.visibility = GONE
|
||||||
|
imageErrorMessage.visibility = GONE
|
||||||
|
ivArrow.visibility = VISIBLE
|
||||||
|
sale.color = sale.username ?: "" //mostrar en campo del colo el usuario
|
||||||
|
} else {
|
||||||
|
|
||||||
|
imageErrorMessage.visibility = GONE
|
||||||
|
if (type != SACADOR && type != PREITEMPICKERTEST) {
|
||||||
|
val colorRes =
|
||||||
|
if (sale.hasMistake == true) R.color.verdnatura_red_salix else R.color.verdnatura_black
|
||||||
|
imageErrorMessage.imageTintList =
|
||||||
|
ColorStateList.valueOf(getColor(context!!, colorRes))
|
||||||
|
imageErrorMessage.visibility = VISIBLE
|
||||||
|
} else {
|
||||||
|
imageErrorMessage.visibility = GONE
|
||||||
|
}
|
||||||
|
ivArrow.visibility = INVISIBLE
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!sale.sonSales.isNullOrEmpty()) {
|
||||||
|
|
||||||
|
itemArticlePlacements.apply {
|
||||||
|
layoutManager = childLayoutManagerV
|
||||||
|
adapter = SaleAdapterReserveSacadorSaleGroup(
|
||||||
|
sale.sonSales,
|
||||||
|
onPasillerosItemClickListener,
|
||||||
|
onSaleClickListener,
|
||||||
|
onMistakeClickListener,
|
||||||
|
onPackingClick,
|
||||||
|
type = "PREPARED"
|
||||||
|
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
itemArticlePlacements.visibility = GONE
|
||||||
|
}
|
||||||
|
if (isExpanded) {
|
||||||
|
if (sale.isParent) {
|
||||||
|
itemArticlePlacements.visibility = VISIBLE
|
||||||
|
} else {
|
||||||
|
itemArticlePlacements.visibility = GONE
|
||||||
|
}
|
||||||
|
ivArrow.setImageResource(R.drawable.ic_arrow_down)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
itemArticlePlacements.visibility = GONE
|
||||||
|
ivArrow.setImageResource(R.drawable.ic_arrow_up)
|
||||||
|
}
|
||||||
|
|
||||||
|
itemArticlePlacements.visibility = if (isExpanded) VISIBLE else {
|
||||||
|
GONE
|
||||||
|
}
|
||||||
|
ivArrow.setOnClickListener {
|
||||||
|
|
||||||
|
if (isExpanded) {
|
||||||
|
ivArrow.setImageResource(R.drawable.ic_arrow_up)
|
||||||
|
itemArticlePlacements.visibility = GONE
|
||||||
|
|
||||||
|
} else {
|
||||||
|
ivArrow.setImageResource(R.drawable.ic_arrow_down)
|
||||||
|
if (sale.isParent) {
|
||||||
|
itemArticlePlacements.visibility = VISIBLE
|
||||||
|
} else {
|
||||||
|
itemArticlePlacements.visibility = GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
isExpanded = !isExpanded
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sale.saleGroupFk == null) {
|
||||||
|
previous.visibility = INVISIBLE
|
||||||
|
} else {
|
||||||
|
previous.visibility = VISIBLE
|
||||||
|
previous.text = "PREV:${sale.saleGroupFk}"
|
||||||
|
|
||||||
|
}
|
||||||
|
binding.txtQuantityReserved.text = calculatedValues.first
|
||||||
|
if (sale.totalItemShelving > 1) {
|
||||||
|
binding.txtQuantityReserved.text = calculatedValues.first
|
||||||
|
binding.txtQuantity.text = calculatedValues.second
|
||||||
|
binding.txtReserveToComplete.text =
|
||||||
|
"${sale.currentItemShelving}/${sale.totalItemShelving}"
|
||||||
|
binding.txtReserveToComplete.visibility = VISIBLE
|
||||||
|
binding.txtQuantity.text = "${sale.reservedQuantity}"
|
||||||
|
} else {
|
||||||
|
binding.txtQuantity.text =
|
||||||
|
if (sale.itemShelvingFk == 0 && sale.itemShelvingSaleFk == 0) {
|
||||||
|
"${sale.saleQuantity}"
|
||||||
|
} else "${sale.reservedQuantity}"
|
||||||
|
binding.txtReserveToComplete.visibility = GONE
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.txtReserveToComplete.text =
|
||||||
|
"${sale.currentItemShelving}/${sale.totalItemShelving}"
|
||||||
|
|
||||||
|
//COLORES
|
||||||
|
paintTicketcolor(sale.rgb, binding.itemTicketColor.background)
|
||||||
|
if (sale.isPicked == 1) {
|
||||||
|
if (type == PREPARED) {
|
||||||
|
contentLayout.setBackgroundColor(
|
||||||
|
|
||||||
|
if (sale.saleGroupFk == null) {
|
||||||
|
getColor(
|
||||||
|
context!!, R.color.verdnatura_orange_salix
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (sale.stateCode != null && sale.stateCode == "PREPARED") {
|
||||||
|
getColor(
|
||||||
|
context!!, R.color.verdnatura_orange_salix
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
if (sale.stateCode != null && sale.stateCode == "OK PREVIOUS") {
|
||||||
|
getColor(
|
||||||
|
context!!, R.color.verdnatura_dark_sky_blue
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
if (sale.stateCode != null && sale.stateCode == "PREVIOUS_CONTROLLED") {
|
||||||
|
getColor(
|
||||||
|
context!!,
|
||||||
|
R.color.verdnatura_dark_mint_light_precontrolled
|
||||||
|
)/* getColor(
|
||||||
|
context!!, R.color.verdnatura_dark_sky_blue
|
||||||
|
)*/
|
||||||
|
} else {
|
||||||
|
getColor(
|
||||||
|
context!!, R.color.verdnatura_black
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
contentLayout.setBackgroundColor(
|
||||||
|
getColor(
|
||||||
|
context!!, R.color.verdnatura_dark_sky_blue
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
contentLayout.setBackgroundColor(
|
||||||
|
getColor(
|
||||||
|
context!!, R.color.verdnatura_black
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.txtParking.text =
|
||||||
|
// if (type == PREPARED) sale.parkingCodePrevia else sale.parkingCode
|
||||||
|
sale.parkingCode ?: sale.parkingCodePrevia
|
||||||
|
|
||||||
|
binding.addItem.setOnClickListener {
|
||||||
|
onAddItemClickListener!!.onAddItemClickListener(sale)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == PREITEMPICKERTEST) {
|
||||||
|
binding.level.visibility = GONE
|
||||||
|
binding.levelTxt.visibility = GONE
|
||||||
|
binding.ticketOrder.visibility = VISIBLE
|
||||||
|
binding.txtPoints.visibility = GONE
|
||||||
|
} else {
|
||||||
|
binding.level.visibility = VISIBLE
|
||||||
|
binding.levelTxt.visibility = VISIBLE
|
||||||
|
binding.ticketOrder.visibility = GONE
|
||||||
|
binding.txtPoints.visibility = VISIBLE
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
this.sale = sale
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun paintTicketcolor(color: String?, backgroundDrawableTicket: Drawable) {
|
||||||
|
|
||||||
|
if (color.isNullOrBlank()) {
|
||||||
|
DrawableCompat.setTint(
|
||||||
|
backgroundDrawableTicket, Color.TRANSPARENT
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
DrawableCompat.setTint(
|
||||||
|
backgroundDrawableTicket, Color.parseColor(color)
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun precalculateDisplayValues(sale: Sale): Pair<String, String> {
|
||||||
|
try {
|
||||||
|
val result = sale.reservedQuantity % (sale.packing ?: (sale.saleQuantity + 1))
|
||||||
|
val textToConcat = if (result != 0) {
|
||||||
|
"${sale.reservedQuantity / (sale.grouping ?: 1)} x ${sale.grouping ?: "1"}"
|
||||||
|
} else {
|
||||||
|
"${sale.reservedQuantity / (sale.packing ?: 1)} pack de ${sale.packing ?: "1"}"
|
||||||
|
}
|
||||||
|
|
||||||
|
val result2 = sale.accumulatedQuantity % (sale.packing ?: (sale.saleQuantity + 1))
|
||||||
|
val textToConcat2 = if (result2 != 0) {
|
||||||
|
"${(sale.saleQuantity - sale.accumulatedQuantity) / (sale.grouping ?: 1)} x ${sale.grouping ?: "1"}"
|
||||||
|
} else {
|
||||||
|
"${(sale.saleQuantity - sale.accumulatedQuantity) / (sale.packing ?: 1)} pack de ${sale.packing ?: "1"}"
|
||||||
|
}
|
||||||
|
println("reserva sale $sale")
|
||||||
|
return if (sale.itemShelvingSaleFk == 0 && sale.itemShelvingFk == 0) Pair(
|
||||||
|
"-",
|
||||||
|
"0"
|
||||||
|
) else {
|
||||||
|
Pair(textToConcat, textToConcat2)
|
||||||
|
}
|
||||||
|
} catch (ex: Exception) {
|
||||||
|
return Pair("Error", "Error")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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,25 +8,28 @@ import com.google.gson.JsonObject
|
||||||
import es.verdnatura.MobileApplication
|
import es.verdnatura.MobileApplication
|
||||||
import es.verdnatura.domain.SalixCallback
|
import es.verdnatura.domain.SalixCallback
|
||||||
import es.verdnatura.domain.formatWithQuotes
|
import es.verdnatura.domain.formatWithQuotes
|
||||||
|
import es.verdnatura.domain.getMessageFromAllResponse
|
||||||
|
import es.verdnatura.domain.nameofFunction
|
||||||
import es.verdnatura.domain.toast
|
import es.verdnatura.domain.toast
|
||||||
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
|
||||||
import es.verdnatura.presentation.common.Event
|
import es.verdnatura.presentation.common.Event
|
||||||
import es.verdnatura.presentation.common.PickupResponse
|
|
||||||
import es.verdnatura.presentation.common.SaleTrackingReplaceSalix
|
import es.verdnatura.presentation.common.SaleTrackingReplaceSalix
|
||||||
|
import es.verdnatura.presentation.common.TicketPickupResponse
|
||||||
import es.verdnatura.presentation.common.TicketState
|
import es.verdnatura.presentation.common.TicketState
|
||||||
import es.verdnatura.presentation.view.feature.collection.SalixSaleQuantity
|
import es.verdnatura.presentation.view.feature.collection.SalixSaleQuantity
|
||||||
import es.verdnatura.presentation.view.feature.collection.mapper.map
|
import es.verdnatura.presentation.view.feature.collection.mapper.map
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeListVO
|
import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeListVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeVO
|
import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeVO
|
||||||
|
import es.verdnatura.presentation.view.feature.ticket.fragment.TicketViewModel
|
||||||
import es.verdnatura.presentation.view.feature.workermistake.model.SaleMistakeSalix
|
import es.verdnatura.presentation.view.feature.workermistake.model.SaleMistakeSalix
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class CollectionCheckerViewModel(val context: Context) : BaseViewModel(context) {
|
class CollectionCheckerViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
|
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
|
||||||
|
private val collectionViewModelChecker = CollectionViewModel(context)
|
||||||
|
private val ticketViewModel = TicketViewModel(context)
|
||||||
|
|
||||||
//var isPaused: Boolean = false
|
//var isPaused: Boolean = false
|
||||||
|
|
||||||
|
@ -303,22 +306,21 @@ 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",
|
|
||||||
"scope": {
|
|
||||||
"fields": ["id", "agencyModeFk"],
|
|
||||||
"include": {
|
|
||||||
"relation": "agencyMode",
|
"relation": "agencyMode",
|
||||||
"scope": {
|
"scope": {
|
||||||
"fields": ["id", "deliveryMethodFk", "code"],
|
"fields": ["id", "deliveryMethodFk", "code"],
|
||||||
"where": {"code": "REC_ALG"},
|
"where": {
|
||||||
|
"code": { "inq": ["REC_ALG", "PICKUP"] }
|
||||||
|
},
|
||||||
"include": {
|
"include": {
|
||||||
"relation": "deliveryMethod",
|
"relation": "deliveryMethod",
|
||||||
"scope": {
|
"scope": {
|
||||||
|
@ -327,17 +329,14 @@ class CollectionCheckerViewModel(val context: Context) : BaseViewModel(context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}""".trim()
|
}""".trim()
|
||||||
|
).enqueue(object : SalixCallback<List<TicketPickupResponse>>(context) {
|
||||||
).enqueue(object : SalixCallback<List<PickupResponse>>(context) {
|
override fun onSuccess(response: Response<List<TicketPickupResponse>>) {
|
||||||
override fun onSuccess(response: Response<List<PickupResponse>>) {
|
|
||||||
|
|
||||||
_responseTicketIsPickup.value =
|
_responseTicketIsPickup.value =
|
||||||
response.body()
|
response.body()
|
||||||
?.firstOrNull()?.route?.agencyMode?.deliveryMethod?.code == "PICKUP"
|
?.firstOrNull()?.agencyMode?.deliveryMethod?.code == "PICKUP"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,4 +358,18 @@ class CollectionCheckerViewModel(val context: Context) : BaseViewModel(context)
|
||||||
_isPaused.value = paused
|
_isPaused.value = paused
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun itemShelvingSaleBySale(
|
||||||
|
saleFk: Number, quantityDiff: Int
|
||||||
|
|
||||||
|
) {
|
||||||
|
collectionViewModelChecker.itemShelvingSaleBySale(
|
||||||
|
saleFk = saleFk,
|
||||||
|
quantityDiff = quantityDiff
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun ticketAdvance(ticketFk: Number, workerFk: Number) {
|
||||||
|
ticketViewModel.ticketExits(ticketFk, workerFk)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -20,6 +20,7 @@ import es.verdnatura.databinding.FragmentCollectionBinding
|
||||||
import es.verdnatura.domain.ConstAndValues
|
import es.verdnatura.domain.ConstAndValues
|
||||||
import es.verdnatura.domain.ConstAndValues.CONTROLADOR
|
import es.verdnatura.domain.ConstAndValues.CONTROLADOR
|
||||||
import es.verdnatura.domain.ConstAndValues.PRINTERNAME
|
import es.verdnatura.domain.ConstAndValues.PRINTERNAME
|
||||||
|
import es.verdnatura.domain.ConstAndValues.SECTORFK
|
||||||
import es.verdnatura.domain.notNull
|
import es.verdnatura.domain.notNull
|
||||||
import es.verdnatura.domain.showToastCenterWithBackground
|
import es.verdnatura.domain.showToastCenterWithBackground
|
||||||
import es.verdnatura.domain.toast
|
import es.verdnatura.domain.toast
|
||||||
|
@ -54,7 +55,6 @@ import es.verdnatura.presentation.view.feature.sacador.model.PlacementVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.SaleVO
|
import es.verdnatura.presentation.view.feature.sacador.model.SaleVO
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
|
||||||
// FALTA TESTEAR REVISORES DESPUÉS DE CAMPAÑA Y VER HOLDPOSITION
|
|
||||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||||
class CollectionFragmentChecker(
|
class CollectionFragmentChecker(
|
||||||
var collection: CollectionVO = CollectionVO(0), var type: String = CONTROLADOR
|
var collection: CollectionVO = CollectionVO(0), var type: String = CONTROLADOR
|
||||||
|
@ -79,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
|
||||||
|
@ -123,6 +124,7 @@ class CollectionFragmentChecker(
|
||||||
if (collection.tickets.isNotEmpty()) {
|
if (collection.tickets.isNotEmpty()) {
|
||||||
createCollectionList()
|
createCollectionList()
|
||||||
}
|
}
|
||||||
|
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +139,7 @@ class CollectionFragmentChecker(
|
||||||
binding.mainToolbar.toolbarSubtitle.visibility = VISIBLE
|
binding.mainToolbar.toolbarSubtitle.visibility = VISIBLE
|
||||||
binding.mainToolbar.toolbarIcons.visibility = VISIBLE
|
binding.mainToolbar.toolbarIcons.visibility = VISIBLE
|
||||||
binding.mainToolbar.backButton.visibility = VISIBLE
|
binding.mainToolbar.backButton.visibility = VISIBLE
|
||||||
binding.previaButton.visibility = INVISIBLE
|
|
||||||
binding.mainToolbar.toolbarTitle.text =
|
binding.mainToolbar.toolbarTitle.text =
|
||||||
if (collection.collectionFk == 0) getString(R.string.review) else collection.collectionFk.toString()
|
if (collection.collectionFk == 0) getString(R.string.review) else collection.collectionFk.toString()
|
||||||
|
|
||||||
|
@ -166,10 +168,11 @@ class CollectionFragmentChecker(
|
||||||
listIcons.add(iconWorker)
|
listIcons.add(iconWorker)
|
||||||
listIcons.add(iconAdd)
|
listIcons.add(iconAdd)
|
||||||
binding.previaButton.setOnClickListener {
|
binding.previaButton.setOnClickListener {
|
||||||
showPrevia()
|
showDialog(isAdvanceTicket = false)
|
||||||
|
}
|
||||||
|
binding.ticketAdvanceButton.setOnClickListener {
|
||||||
|
showDialog(isAdvanceTicket = true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
binding.mainToolbar.toolbarIcons.adapter =
|
binding.mainToolbar.toolbarIcons.adapter =
|
||||||
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
|
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
|
||||||
override fun onOptionsItemSelected(item: Drawable) {
|
override fun onOptionsItemSelected(item: Drawable) {
|
||||||
|
@ -209,11 +212,20 @@ class CollectionFragmentChecker(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showPrevia() {
|
private fun showDialog(isAdvanceTicket: Boolean) {
|
||||||
customDialogList.getEditText().setRawInputType(TYPE_CLASS_NUMBER)
|
customDialogList.getEditText().setRawInputType(TYPE_CLASS_NUMBER)
|
||||||
customDialogList.setTitle(getString(R.string.scanPreviousTicket))
|
customDialogList.setTitle(
|
||||||
|
if (isAdvanceTicket) getString(R.string.ticketAdvance) else getString(
|
||||||
|
R.string.scanPreviousTicket
|
||||||
|
)
|
||||||
|
)
|
||||||
.setOkButton(getString(R.string.end)) {
|
.setOkButton(getString(R.string.end)) {
|
||||||
takeActionPrevia(customDialogList)
|
if (customDialogList.getValue().isNotEmpty()) {
|
||||||
|
takeAction(customDialogList, isAdvanceTicket)
|
||||||
|
} else {
|
||||||
|
ma.hideKeyboard(customDialogList.getEditText())
|
||||||
|
customDialogList.dismiss()
|
||||||
|
}
|
||||||
|
|
||||||
}.setValue("").show()
|
}.setValue("").show()
|
||||||
|
|
||||||
|
@ -225,7 +237,8 @@ class CollectionFragmentChecker(
|
||||||
if (customDialogList.getValue().isNotEmpty()) {
|
if (customDialogList.getValue().isNotEmpty()) {
|
||||||
isScanned =
|
isScanned =
|
||||||
event != null && event.action == ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER
|
event != null && event.action == ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER
|
||||||
takeActionPrevia(customDialogList)
|
takeAction(customDialogList, isAdvanceTicket)
|
||||||
|
ma.hideKeyboard(customDialogList.getEditText())
|
||||||
}
|
}
|
||||||
customDialogList.setValue("")
|
customDialogList.setValue("")
|
||||||
ma.hideKeyboard(customDialogList.getEditText())
|
ma.hideKeyboard(customDialogList.getEditText())
|
||||||
|
@ -236,14 +249,18 @@ class CollectionFragmentChecker(
|
||||||
hideKeyboard()
|
hideKeyboard()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun takeActionPrevia(customDialogList: CustomDialogList) {
|
private fun takeAction(customDialogList: CustomDialogList, isAdvanceTicket: Boolean) {
|
||||||
ma.hideKeyboard(customDialogList.getEditText())
|
ma.hideKeyboard(customDialogList.getEditText())
|
||||||
try {
|
try {
|
||||||
val saleGroupScanned = itemScanValue(
|
val itemScanned = itemScanValue(
|
||||||
customDialogList.getValue(), arrayOf("saleGroup"), "id"
|
customDialogList.getValue(), if (isAdvanceTicket) {
|
||||||
|
arrayOf("ticket")
|
||||||
|
} else arrayOf("saleGroup"), "id"
|
||||||
).toString()
|
).toString()
|
||||||
|
|
||||||
markPrevia(saleGroupScanned)
|
if (isAdvanceTicket) {
|
||||||
|
viewModel.ticketAdvance(itemScanned.toInt(), mobileApplication.userId!!)
|
||||||
|
} else markPrevia(itemScanned)
|
||||||
customDialogList.dismiss()
|
customDialogList.dismiss()
|
||||||
} catch (ex: Exception) {
|
} catch (ex: Exception) {
|
||||||
ma.messageWithSound(
|
ma.messageWithSound(
|
||||||
|
@ -304,8 +321,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" -> {
|
||||||
|
if (sales.any { it.saleGroupFk == myQr.id.toString() }) {
|
||||||
markPrevia(myQr.id.toString())
|
markPrevia(myQr.id.toString())
|
||||||
|
} else {
|
||||||
|
findSale(myQr.id.toString())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"buy" -> binding.scanInput.setText(myQr.more)
|
"buy" -> binding.scanInput.setText(myQr.more)
|
||||||
|
@ -354,6 +376,7 @@ class CollectionFragmentChecker(
|
||||||
if (it.tickets.isNotEmpty()) {
|
if (it.tickets.isNotEmpty()) {
|
||||||
collection = it
|
collection = it
|
||||||
binding.previaButton.visibility = VISIBLE
|
binding.previaButton.visibility = VISIBLE
|
||||||
|
binding.ticketAdvanceButton.visibility = VISIBLE
|
||||||
binding.fragmentSacadorCollections.visibility = VISIBLE
|
binding.fragmentSacadorCollections.visibility = VISIBLE
|
||||||
createCollectionList()
|
createCollectionList()
|
||||||
} else {
|
} else {
|
||||||
|
@ -362,6 +385,7 @@ class CollectionFragmentChecker(
|
||||||
getString(R.string.summaryCount, 0, 0)
|
getString(R.string.summaryCount, 0, 0)
|
||||||
binding.fragmentSacadorCollections.visibility = INVISIBLE
|
binding.fragmentSacadorCollections.visibility = INVISIBLE
|
||||||
binding.previaButton.visibility = INVISIBLE
|
binding.previaButton.visibility = INVISIBLE
|
||||||
|
binding.ticketAdvanceButton.visibility = INVISIBLE
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
customDialog.setTitle(getString(R.string.error))
|
customDialog.setTitle(getString(R.string.error))
|
||||||
|
@ -549,15 +573,48 @@ class CollectionFragmentChecker(
|
||||||
observations.takeIf { it.isNotBlank() }?.plus(" ${ticket.observations}") ?: ""
|
observations.takeIf { it.isNotBlank() }?.plus(" ${ticket.observations}") ?: ""
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!buttonPushedGetCollection) {
|
val isOnReservationMode = mobileApplication.dataStoreApp.readDataStoreKey<Boolean>(
|
||||||
sales = salesList.sortedWith(compareBy { it.picked })
|
ConstAndValues.RESERVATIONMODE
|
||||||
myGroupList = groupSaleGroup(salesList).sortedWith(compareBy { it.picked })
|
) || (mobileApplication.dataStoreApp.readDataStoreKey<Boolean?>(
|
||||||
|
ConstAndValues.SECTORISONRESERVATIONMODE
|
||||||
|
) == true)
|
||||||
|
|
||||||
|
sales = if (isOnReservationMode) {
|
||||||
|
salesList.filter {
|
||||||
|
it.sectorFk == mobileApplication.dataStoreApp.readDataStoreKey<Int>(SECTORFK)
|
||||||
|
}.sortedWith(compareBy({ it.saleOrder }))
|
||||||
} else {
|
} else {
|
||||||
sales = salesList.sortedWith(
|
salesList.filter {
|
||||||
|
it.sectorFk == mobileApplication.dataStoreApp.readDataStoreKey<Int>(SECTORFK)
|
||||||
|
}.sortedWith(compareBy({ it.picked }))
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!buttonPushedGetCollection) {
|
||||||
|
println("Reorden lineas sin boton pulsado")
|
||||||
|
sales =
|
||||||
|
if (!isOnReservationMode) salesList.sortedWith(compareBy { it.picked }) else salesList.sortedWith(
|
||||||
|
compareBy { it.pickedOrder })
|
||||||
|
myGroupList =
|
||||||
|
if (!isOnReservationMode) groupSaleGroup(salesList).sortedWith(compareBy { it.picked }) else groupSaleGroup(
|
||||||
|
salesList
|
||||||
|
).sortedWith(compareBy { it.pickedOrder })
|
||||||
|
|
||||||
|
for (m in myGroupList) {
|
||||||
|
println("Linea ${m.itemFk}-${m.pickedOrder} ")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sales = if (!isOnReservationMode) salesList.sortedWith(
|
||||||
compareBy({ it.isControlled }, { it.picked })
|
compareBy({ it.isControlled }, { it.picked })
|
||||||
|
) else salesList.sortedWith(
|
||||||
|
compareBy({ it.isControlled }, { it.pickedOrder })
|
||||||
)
|
)
|
||||||
myGroupList = groupSaleGroup(salesList).sortedWith(
|
|
||||||
|
//para la nueva revisión : hay que poner el saleOrder si no no podrán revisar correctamente
|
||||||
|
println("Reorden lineas con boton pulsado")
|
||||||
|
myGroupList = if (!isOnReservationMode) groupSaleGroup(salesList).sortedWith(
|
||||||
compareBy({ it.isControlled }, { it.picked })
|
compareBy({ it.isControlled }, { it.picked })
|
||||||
|
) else groupSaleGroup(salesList).sortedWith(
|
||||||
|
compareBy({ it.isControlled }, { it.pickedOrder })
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1101,28 +1158,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) {
|
||||||
|
myGroupList[parentIndex].quantity = quantityIncrease
|
||||||
|
// myGroupList[positionIncreaseQuantity].quantity = quantityIncrease
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}/* } else {
|
}
|
||||||
myGroupList[positionIncreaseQuantity].quantity = quantityIncrease
|
}
|
||||||
saleAdapter?.notifyDataSetChanged()
|
viewModel.itemShelvingSaleBySale(saleFk = saleFk, quantityDiff = quantityIncreaseDiff)
|
||||||
}*/
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.message!!.toast(requireContext())
|
e.message!!.toast(requireContext())
|
||||||
}
|
}
|
||||||
|
saleAdapter?.notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun increaseQuantity(position: Int, quantity: Int) {
|
private fun increaseQuantity(position: Int, quantity: Int) {
|
||||||
positionIncreaseQuantity = position
|
positionIncreaseQuantity = position
|
||||||
quantityIncrease = quantity
|
quantityIncrease = quantity
|
||||||
|
quantityIncreaseDiff = (myGroupList[position].quantity!!.minus(quantity))
|
||||||
viewModel.collectionIncreaseQuantitySalix(
|
viewModel.collectionIncreaseQuantitySalix(
|
||||||
saleFk = myGroupList[position].saleFk, quantity = quantity.toString()
|
saleFk = myGroupList[position].saleFk, quantity = quantity.toString()
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package es.verdnatura.presentation.view.feature.collection.fragment
|
package es.verdnatura.presentation.view.feature.collection.fragment
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.graphics.PorterDuff
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.media.MediaPlayer
|
import android.media.MediaPlayer
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
|
@ -18,6 +19,7 @@ import android.view.inputmethod.InputMethodManager
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.annotation.RequiresApi
|
import androidx.annotation.RequiresApi
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
@ -62,6 +64,8 @@ import es.verdnatura.presentation.view.feature.articulo.model.BarcodeVO
|
||||||
import es.verdnatura.presentation.view.feature.collection.ItemVO
|
import es.verdnatura.presentation.view.feature.collection.ItemVO
|
||||||
import es.verdnatura.presentation.view.feature.collection.adapter.SaleAdapter
|
import es.verdnatura.presentation.view.feature.collection.adapter.SaleAdapter
|
||||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||||
|
import es.verdnatura.presentation.view.feature.pasillero.model.CleanAction
|
||||||
|
import es.verdnatura.presentation.view.feature.pasillero.model.CodeWorkerAction
|
||||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeVO
|
import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeVO
|
||||||
|
@ -69,6 +73,7 @@ import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyList
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO
|
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.PlacementVO
|
import es.verdnatura.presentation.view.feature.sacador.model.PlacementVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.SaleVO
|
import es.verdnatura.presentation.view.feature.sacador.model.SaleVO
|
||||||
|
import kotlinx.coroutines.runBlocking
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
|
||||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||||
|
@ -134,6 +139,7 @@ class CollectionFragmentPicker(
|
||||||
private var isVerifiedCollection = false
|
private var isVerifiedCollection = false
|
||||||
|
|
||||||
private var hasFilterByLevel = false
|
private var hasFilterByLevel = false
|
||||||
|
private lateinit var iconClean: ImageView
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun newInstance(collection: CollectionVO, type: String) =
|
fun newInstance(collection: CollectionVO, type: String) =
|
||||||
|
@ -207,8 +213,8 @@ class CollectionFragmentPicker(
|
||||||
collection.collectionFk.let {
|
collection.collectionFk.let {
|
||||||
binding.mainToolbar.toolbarTitle.text = collection.collectionFk.toString()
|
binding.mainToolbar.toolbarTitle.text = collection.collectionFk.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
val listIcons: ArrayList<ImageView> = ArrayList()
|
val listIcons: ArrayList<ImageView> = ArrayList()
|
||||||
|
|
||||||
val iconPrint = ImageView(context)
|
val iconPrint = ImageView(context)
|
||||||
iconPrint.setImageResource(R.drawable.ic_print_black_24dp)
|
iconPrint.setImageResource(R.drawable.ic_print_black_24dp)
|
||||||
val iconAdd = ImageView(context)
|
val iconAdd = ImageView(context)
|
||||||
|
@ -221,6 +227,9 @@ class CollectionFragmentPicker(
|
||||||
iconPhone.setImageResource(R.drawable.phone_call)
|
iconPhone.setImageResource(R.drawable.phone_call)
|
||||||
val iconParking = ImageView(context)
|
val iconParking = ImageView(context)
|
||||||
iconParking.setImageResource(R.drawable.ic_local_parking_black_24dp)
|
iconParking.setImageResource(R.drawable.ic_local_parking_black_24dp)
|
||||||
|
iconClean = ImageView(context)
|
||||||
|
iconClean.setImageResource(R.drawable.ic_clean_shelving)
|
||||||
|
|
||||||
val iconUpdate = ImageView(context)
|
val iconUpdate = ImageView(context)
|
||||||
iconUpdate.setImageResource(R.drawable.ic_autorenew_black_24dp)
|
iconUpdate.setImageResource(R.drawable.ic_autorenew_black_24dp)
|
||||||
|
|
||||||
|
@ -231,7 +240,7 @@ class CollectionFragmentPicker(
|
||||||
iconPhone.tooltipText = getTooltip(R.drawable.phone_call)
|
iconPhone.tooltipText = getTooltip(R.drawable.phone_call)
|
||||||
iconParking.tooltipText = getTooltip(R.drawable.ic_local_parking_black_24dp)
|
iconParking.tooltipText = getTooltip(R.drawable.ic_local_parking_black_24dp)
|
||||||
iconUpdate.tooltipText = getTooltip(R.drawable.ic_autorenew_black_24dp)
|
iconUpdate.tooltipText = getTooltip(R.drawable.ic_autorenew_black_24dp)
|
||||||
|
iconClean.tooltipText = getTooltip(R.drawable.ic_clean_shelving)
|
||||||
}
|
}
|
||||||
listIcons.add(iconPrint)
|
listIcons.add(iconPrint)
|
||||||
if (type == CONTROLADOR) {
|
if (type == CONTROLADOR) {
|
||||||
|
@ -246,6 +255,8 @@ class CollectionFragmentPicker(
|
||||||
listIcons.add(iconAdd)
|
listIcons.add(iconAdd)
|
||||||
|
|
||||||
if (type == SACADOR) {
|
if (type == SACADOR) {
|
||||||
|
//Tarea 8624
|
||||||
|
listIcons.add(iconClean)
|
||||||
listIcons.add(iconUpdate)
|
listIcons.add(iconUpdate)
|
||||||
listIcons.remove(iconWorker)
|
listIcons.remove(iconWorker)
|
||||||
}
|
}
|
||||||
|
@ -260,6 +271,7 @@ class CollectionFragmentPicker(
|
||||||
override fun onOptionsItemSelected(item: Drawable) {
|
override fun onOptionsItemSelected(item: Drawable) {
|
||||||
|
|
||||||
when (item) {
|
when (item) {
|
||||||
|
iconClean.drawable -> clean()
|
||||||
iconPrint.drawable -> print()
|
iconPrint.drawable -> print()
|
||||||
iconAdd.drawable -> addItem()
|
iconAdd.drawable -> addItem()
|
||||||
iconWorker.drawable -> showUser()
|
iconWorker.drawable -> showUser()
|
||||||
|
@ -272,9 +284,86 @@ class CollectionFragmentPicker(
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
binding.mainToolbar.toolbarIcons.layoutManager =
|
binding.mainToolbar.toolbarIcons.layoutManager =
|
||||||
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||||
|
updateIconColor()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun updateIconColor() {
|
||||||
|
val newColor =
|
||||||
|
ContextCompat.getColor(
|
||||||
|
requireContext(),
|
||||||
|
if (mobileApplication.dataStoreApp.readDataStoreKey<String>("SHELVINGACTION")
|
||||||
|
.isNotBlank()
|
||||||
|
) R.color.verdnatura_orange_salix else R.color.verdnatura_white
|
||||||
|
)
|
||||||
|
iconClean.setColorFilter(newColor, PorterDuff.Mode.SRC_IN)
|
||||||
|
binding.mainToolbar.toolbarIcons.adapter?.notifyDataSetChanged()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun addWorkerActivity(codeWorkerAction: CodeWorkerAction, shelving: String) {
|
||||||
|
viewModel.addWorkerActivity(
|
||||||
|
CleanAction(
|
||||||
|
codeWorkerAction = codeWorkerAction,
|
||||||
|
shelving = shelving.uppercase(),
|
||||||
|
description = shelving.uppercase()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun clean() {
|
||||||
|
|
||||||
|
val shelving = mobileApplication.dataStoreApp.readDataStoreKey<String>(
|
||||||
|
"SHELVINGACTION"
|
||||||
|
)
|
||||||
|
if (
|
||||||
|
shelving.isNotBlank()
|
||||||
|
) {
|
||||||
|
addWorkerActivity(
|
||||||
|
CodeWorkerAction.SHELVING_CLEAN_STOP,
|
||||||
|
shelving = shelving
|
||||||
|
)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
customDialogInput.setTitle(getString(R.string.titleCleanShelving))
|
||||||
|
.setDescription(getString(R.string.descripOrganize))
|
||||||
|
.setOkButton(getString(R.string.organize)) {
|
||||||
|
ma.hideKeyboard(customDialogInput.getEditText())
|
||||||
|
actionOrganizeClean(customDialogInput.getValue())
|
||||||
|
|
||||||
|
}.setKoButton(getString(R.string.cancel)) {
|
||||||
|
customDialogInput.dismiss()
|
||||||
|
}.setValue("").show()
|
||||||
|
customDialogInput.getEditText().requestFocus()
|
||||||
|
customDialogInput.getEditText().setOnEditorActionListener { _, actionId, _ ->
|
||||||
|
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
||||||
|
|
||||||
|
actionOrganizeClean(customDialogInput.getValue())
|
||||||
|
return@setOnEditorActionListener true
|
||||||
|
}
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun actionOrganizeClean(input: String) {
|
||||||
|
if (input.isShelving()) {
|
||||||
|
addWorkerActivity(
|
||||||
|
CodeWorkerAction.SHELVING_CLEAN_START,
|
||||||
|
shelving = input
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
ma.messageWithSound(
|
||||||
|
message = getString(R.string.errorInput),
|
||||||
|
isError = true,
|
||||||
|
isPlayed = true,
|
||||||
|
isToasted = true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
customDialogInput.dismiss()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateScreen() {
|
private fun updateScreen() {
|
||||||
|
@ -331,9 +420,7 @@ class CollectionFragmentPicker(
|
||||||
ma.hideKeyboard(customDialogList.getEditText())
|
ma.hideKeyboard(customDialogList.getEditText())
|
||||||
try {
|
try {
|
||||||
val saleGroupScanned = itemScanValue(
|
val saleGroupScanned = itemScanValue(
|
||||||
customDialogList.getValue(),
|
customDialogList.getValue(), arrayOf("saleGroup"), "id"
|
||||||
arrayOf("saleGroup"),
|
|
||||||
"id"
|
|
||||||
).toString()
|
).toString()
|
||||||
isScanned =
|
isScanned =
|
||||||
event != null && event.action == KeyEvent.ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER
|
event != null && event.action == KeyEvent.ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER
|
||||||
|
@ -464,7 +551,22 @@ class CollectionFragmentPicker(
|
||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.O)
|
@RequiresApi(Build.VERSION_CODES.O)
|
||||||
override fun observeViewModel() {
|
override fun observeViewModel() {
|
||||||
|
|
||||||
with(viewModel) {
|
with(viewModel) {
|
||||||
|
loadResponseActivity.observe(viewLifecycleOwner) { event ->
|
||||||
|
event.getContentIfNotHandled().notNull {
|
||||||
|
|
||||||
|
println("shelvinAction ${it}")
|
||||||
|
runBlocking {
|
||||||
|
mobileApplication.dataStoreApp.editDataStoreKey(
|
||||||
|
"SHELVINGACTION",
|
||||||
|
if (it.codeWorkerAction == CodeWorkerAction.SHELVING_CLEAN_START) it.shelving else ""
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
updateIconColor()
|
||||||
|
}
|
||||||
|
}
|
||||||
collectionTicketList.observe(viewLifecycleOwner, Observer {
|
collectionTicketList.observe(viewLifecycleOwner, Observer {
|
||||||
|
|
||||||
if (!it.isError) {
|
if (!it.isError) {
|
||||||
|
@ -844,7 +946,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(),
|
||||||
|
@ -928,8 +1031,7 @@ class CollectionFragmentPicker(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
saleAdapter = SaleAdapter(
|
saleAdapter = SaleAdapter(myGroupList as MutableList,
|
||||||
myGroupList as MutableList,
|
|
||||||
pasillerosItemClickListener!!,
|
pasillerosItemClickListener!!,
|
||||||
object : OnQuantityClickListener {
|
object : OnQuantityClickListener {
|
||||||
|
|
||||||
|
@ -1007,18 +1109,9 @@ class CollectionFragmentPicker(
|
||||||
type = type,
|
type = type,
|
||||||
onTicketColorClickListener = object : OnTicketColorListener {
|
onTicketColorClickListener = object : OnTicketColorListener {
|
||||||
override fun onTicketColorListener(sale: SaleVO) {
|
override fun onTicketColorListener(sale: SaleVO) {
|
||||||
hasFilterByLevel = !hasFilterByLevel
|
|
||||||
|
|
||||||
if (hasFilterByLevel) {
|
|
||||||
saleAdapter!!.updateSales(myGroupList.filter { it.level == sale.level } as MutableList)
|
|
||||||
myGroupList = myGroupList.filter { it.level == sale.level }
|
|
||||||
} else {
|
|
||||||
createCollectionList()
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||||
|
@ -1046,7 +1139,7 @@ class CollectionFragmentPicker(
|
||||||
}
|
}
|
||||||
|
|
||||||
printObservations(observations)
|
printObservations(observations)
|
||||||
if (!isVerifiedCollection) {
|
if (!isVerifiedCollection && mobileApplication.userId != 19591) {
|
||||||
binding.fragmentSacadorCollections.visibility = View.INVISIBLE
|
binding.fragmentSacadorCollections.visibility = View.INVISIBLE
|
||||||
verifyCollection()
|
verifyCollection()
|
||||||
}
|
}
|
||||||
|
@ -1923,6 +2016,7 @@ class CollectionFragmentPicker(
|
||||||
if (listPlacementSupply.size == 1) {
|
if (listPlacementSupply.size == 1) {
|
||||||
ticketSelected = listPlacementSupply[0].code!!.toInt()
|
ticketSelected = listPlacementSupply[0].code!!.toInt()
|
||||||
}
|
}
|
||||||
|
customDialogList = CustomDialogList(requireContext())
|
||||||
customDialogList.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
|
customDialogList.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
|
||||||
customDialogList.getEditTextTwo().inputType = InputType.TYPE_CLASS_NUMBER
|
customDialogList.getEditTextTwo().inputType = InputType.TYPE_CLASS_NUMBER
|
||||||
customDialogList.getEditText().setRawInputType(InputType.TYPE_CLASS_NUMBER)
|
customDialogList.getEditText().setRawInputType(InputType.TYPE_CLASS_NUMBER)
|
||||||
|
@ -2354,18 +2448,15 @@ class CollectionFragmentPicker(
|
||||||
}
|
}
|
||||||
if (isTicket) {
|
if (isTicket) {
|
||||||
val labelDialogHelper = LabelDialogHelper(requireContext())
|
val labelDialogHelper = LabelDialogHelper(requireContext())
|
||||||
labelDialogHelper.showLabelDialog(
|
labelDialogHelper.showLabelDialog(onItemSelected = { labelCount ->
|
||||||
onItemSelected = { labelCount ->
|
|
||||||
viewModel.collectionStickerPrint(
|
viewModel.collectionStickerPrint(
|
||||||
collectionFk = collection.collectionFk,
|
collectionFk = collection.collectionFk, labelCount = labelCount
|
||||||
labelCount = labelCount
|
|
||||||
)
|
)
|
||||||
|
|
||||||
(getString(R.string.Imprimiendo) + mobileApplication.dataStoreApp.readDataStoreKey<String>(
|
(getString(R.string.Imprimiendo) + mobileApplication.dataStoreApp.readDataStoreKey<String>(
|
||||||
PRINTERNAME
|
PRINTERNAME
|
||||||
)).toast(requireContext())
|
)).toast(requireContext())
|
||||||
}
|
})
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
viewModel.collectionStickerPrint(
|
viewModel.collectionStickerPrint(
|
||||||
collectionFk = collection.collectionFk, null
|
collectionFk = collection.collectionFk, null
|
||||||
|
|
|
@ -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)
|
||||||
|
@ -336,6 +342,7 @@ class CollectionFragmentPickerPreviousNew(
|
||||||
lm!!.scrollToPositionWithOffset(positionConfirm, 0)
|
lm!!.scrollToPositionWithOffset(positionConfirm, 0)
|
||||||
//lm!!.scrollToPositionWithOffset(storedBackPosition + 1, 0)
|
//lm!!.scrollToPositionWithOffset(storedBackPosition + 1, 0)
|
||||||
setTotalLines()
|
setTotalLines()
|
||||||
|
saleAdapter!!.notifyItemChanged(positionConfirm)
|
||||||
} else {
|
} else {
|
||||||
updateScreen()
|
updateScreen()
|
||||||
}
|
}
|
||||||
|
@ -358,8 +365,7 @@ class CollectionFragmentPickerPreviousNew(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loadResponseReserveAddPrevOK.observe(viewLifecycleOwner) { event ->
|
loadResponseReserveAddPrevOK.observe(viewLifecycleOwner) { event ->
|
||||||
event.getContentIfNotHandled().notNull {
|
event.getContentIfNotHandled().notNull {}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
loadSetStateResponse.observe(viewLifecycleOwner) { event ->
|
loadSetStateResponse.observe(viewLifecycleOwner) { event ->
|
||||||
event.getContentIfNotHandled().notNull {
|
event.getContentIfNotHandled().notNull {
|
||||||
|
@ -395,6 +401,18 @@ class CollectionFragmentPickerPreviousNew(
|
||||||
binding.mainToolbar.toolbarTitle.text = collection.collectionFk.toString()
|
binding.mainToolbar.toolbarTitle.text = collection.collectionFk.toString()
|
||||||
|
|
||||||
collection.map(requireContext())
|
collection.map(requireContext())
|
||||||
|
|
||||||
|
val sectorFk = mobileApplication.dataStoreApp.readDataStoreKey<Int>(SECTORFK)
|
||||||
|
if (collection.sectorFk != null && collection.sectorFk != sectorFk) {
|
||||||
|
|
||||||
|
ma.messageWithSound(
|
||||||
|
getString(R.string.cambia_el_sector_vas_a_preparar_una_previa_que_no_es_de_tu_sector),
|
||||||
|
isError = true,
|
||||||
|
isPlayed = true,
|
||||||
|
isToasted = false
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
|
||||||
val salesList: ArrayList<Sale> = ArrayList()
|
val salesList: ArrayList<Sale> = ArrayList()
|
||||||
|
|
||||||
tickets = ArrayList()
|
tickets = ArrayList()
|
||||||
|
@ -403,7 +421,8 @@ class CollectionFragmentPickerPreviousNew(
|
||||||
val myPickingTo = mobileApplication.dataStoreApp.readDataStoreKey<Int>("PICKING_TO")
|
val myPickingTo = mobileApplication.dataStoreApp.readDataStoreKey<Int>("PICKING_TO")
|
||||||
collection.tickets.forEach { ticket ->
|
collection.tickets.forEach { ticket ->
|
||||||
|
|
||||||
if (observations.isNotEmpty()) observations = observations + " " + ticket.observations
|
if (observations.isNotEmpty()) observations =
|
||||||
|
observations + " " + ticket.observations
|
||||||
ticket.sales.forEach { sale ->
|
ticket.sales.forEach { sale ->
|
||||||
|
|
||||||
if (hasPickingOrder) {
|
if (hasPickingOrder) {
|
||||||
|
@ -433,19 +452,28 @@ 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 {
|
||||||
|
|
||||||
|
if (sale.itemShelvingSaleFk == 0 && sale.itemShelvingFk == 0 && sale.code.isNullOrEmpty())
|
||||||
|
showManagement(sale)
|
||||||
|
else {
|
||||||
showScanner(position, sale)
|
showScanner(position, sale)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//TODO desmarcamos una linea de previa ?
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -507,6 +535,7 @@ class CollectionFragmentPickerPreviousNew(
|
||||||
verifyCollection()
|
verifyCollection()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun showDeleteItemShelving(sale: Sale) {
|
private fun showDeleteItemShelving(sale: Sale) {
|
||||||
customDialog.setTitle(getString(R.string.deleteSale)).setDescription(
|
customDialog.setTitle(getString(R.string.deleteSale)).setDescription(
|
||||||
|
@ -559,14 +588,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 +632,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 +753,18 @@ 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,8 +776,9 @@ class CollectionFragmentPickerPreviousNew(
|
||||||
customDialogList.dismiss()
|
customDialogList.dismiss()
|
||||||
scanRequest()
|
scanRequest()
|
||||||
|
|
||||||
}.setHintValue(getString(R.string.quantitySelect)).setValue(totalReserved.toString())
|
}.setHintValue(getString(R.string.quantitySelect)).setTextSize(20f)
|
||||||
.setHintValueTwo(getString(R.string.scanItem)).setValueTwo("").show()
|
.setValue(totalReserved.toString()).setHintValueTwo(getString(R.string.scanItem))
|
||||||
|
.setValueTwo("").show()
|
||||||
|
|
||||||
customDialogList.getEditTextTwo().setOnEditorActionListener { v, actionId, event ->
|
customDialogList.getEditTextTwo().setOnEditorActionListener { v, actionId, event ->
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
||||||
|
@ -784,7 +840,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 {
|
||||||
|
@ -1057,18 +1117,22 @@ class CollectionFragmentPickerPreviousNew(
|
||||||
println("No hay salegroup")
|
println("No hay salegroup")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (distinctSaleGroups.isNotEmpty())
|
try {
|
||||||
distinctSaleGroups.forEach { saleGroup ->
|
if (distinctSaleGroups.isNotEmpty()) distinctSaleGroups.forEach { saleGroup ->
|
||||||
setStateSaleGroup(saleGroup)
|
setStateSaleGroup(saleGroup, stateCodeId!!)
|
||||||
}
|
}
|
||||||
|
} catch (ex: Exception) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 +1187,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 +1209,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 +1273,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 {
|
||||||
|
@ -1272,4 +1341,40 @@ class CollectionFragmentPickerPreviousNew(
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun showManagement(sale: Sale) {
|
||||||
|
customDialogThreeButtons = CustomDialogThreeButtons(requireContext())
|
||||||
|
customDialogThreeButtons.setCustomDialogValue(View.GONE)
|
||||||
|
customDialogThreeButtons.setTitle("Gestionar línea artículo ${sale.itemFk}")
|
||||||
|
.setDescription("Selecciona RESERVAR para añadir reserva y que muestre ubicación")
|
||||||
|
.setOkButton("Reservar") {
|
||||||
|
viewModel.itemShelvingSaleAddByCollection(collection.collectionFk)
|
||||||
|
closeCustomDialogManagement(binding.scanInput, customDialogThreeButtons)
|
||||||
|
}/*.setOkButtonTwo("Poner a cero la cantidad") {
|
||||||
|
viewModel.collectionIncreaseQuantitySalix(sale.saleFk, "0")
|
||||||
|
closeCustomDialogManagement(binding.scanInput, customDialogThreeButtons)
|
||||||
|
}*/
|
||||||
|
.setKoButton(getString(R.string.cancel)) {
|
||||||
|
closeCustomDialogManagement(binding.scanInput, customDialogThreeButtons)
|
||||||
|
}.setValue("").show()
|
||||||
|
|
||||||
|
/* customDialogThreeButtons.getEditText().setOnEditorActionListener { v, actionId, event ->
|
||||||
|
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||||
|
findSaleAction(index, sale)
|
||||||
|
return@setOnEditorActionListener false
|
||||||
|
}
|
||||||
|
false
|
||||||
|
}*/
|
||||||
|
customDialogThreeButtons.getEditText().requestFocus()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun closeCustomDialogManagement(
|
||||||
|
scanInput: EditText,
|
||||||
|
customDialogInput: CustomDialogThreeButtons
|
||||||
|
) {
|
||||||
|
requireContext().hideKeyboard(customDialogInput.getEditText())
|
||||||
|
scanInput.requestFocus()
|
||||||
|
customDialogInput.dismiss()
|
||||||
|
scanInput.requestFocus()
|
||||||
|
}
|
||||||
}
|
}
|
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
|
||||||
|
@ -687,7 +688,8 @@ class CollectionFragmentPreChecker(
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
responseIncQuantity.observe(viewLifecycleOwner, Observer {
|
loadIncQuantity.observe(viewLifecycleOwner) { event ->
|
||||||
|
event.getContentIfNotHandled().notNull {
|
||||||
|
|
||||||
if (it.isError) {
|
if (it.isError) {
|
||||||
ma.messageWithSound(it.errorMessage, isError = true, true)
|
ma.messageWithSound(it.errorMessage, isError = true, true)
|
||||||
|
@ -700,7 +702,8 @@ class CollectionFragmentPreChecker(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
}
|
||||||
|
}
|
||||||
|
|
||||||
responseSaleMistakeAdd.observe(viewLifecycleOwner, Observer {
|
responseSaleMistakeAdd.observe(viewLifecycleOwner, Observer {
|
||||||
|
|
||||||
|
@ -981,10 +984,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,10 +1092,11 @@ class CollectionFragmentPreChecker(
|
||||||
setListPosition(storedBackPosition, true)
|
setListPosition(storedBackPosition, true)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
// }
|
||||||
|
|
||||||
printObservations(observations)
|
printObservations(observations)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun setScrollListener(lm: LinearLayoutManager) {
|
private fun setScrollListener(lm: LinearLayoutManager) {
|
||||||
binding.fragmentSacadorCollections.clearOnScrollListeners()
|
binding.fragmentSacadorCollections.clearOnScrollListeners()
|
||||||
|
@ -1533,7 +1538,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 +1634,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,8 +2028,22 @@ 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 +2105,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,
|
|
||||||
customDialogThreeButtons.getValue(),
|
|
||||||
getString(R.string.Agregar)
|
|
||||||
)*/
|
|
||||||
increaseQuantity(position, customDialogThreeButtons.getValue().toInt())
|
increaseQuantity(position, customDialogThreeButtons.getValue().toInt())
|
||||||
scanRequest()
|
scanRequest()
|
||||||
customDialogThreeButtons.dismiss()
|
customDialogThreeButtons.dismiss()
|
||||||
|
} else {
|
||||||
|
ma.messageWithSound(
|
||||||
|
getString(R.string.errorInputQuantity),
|
||||||
|
isError = true,
|
||||||
|
isPlayed = true,
|
||||||
|
isToasted = true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
}.setKoButton(getString(R.string.cancel)) {
|
}.setKoButton(getString(R.string.cancel)) {
|
||||||
scanRequest()
|
scanRequest()
|
||||||
|
@ -2175,15 +2163,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,15 @@ import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.map
|
import androidx.lifecycle.map
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import es.verdnatura.MobileApplication
|
import es.verdnatura.MobileApplication
|
||||||
|
import es.verdnatura.R
|
||||||
import es.verdnatura.domain.SalixCallback
|
import es.verdnatura.domain.SalixCallback
|
||||||
import es.verdnatura.domain.formatWithQuotes
|
import es.verdnatura.domain.formatWithQuotes
|
||||||
|
import es.verdnatura.domain.getMessageFromAllResponse
|
||||||
|
import es.verdnatura.domain.nameofFunction
|
||||||
import es.verdnatura.domain.toast
|
import es.verdnatura.domain.toast
|
||||||
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
||||||
|
import es.verdnatura.domain.userCases.WorkerActivityUseCase
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
|
||||||
import es.verdnatura.presentation.common.Event
|
import es.verdnatura.presentation.common.Event
|
||||||
import es.verdnatura.presentation.common.ItemShelving
|
import es.verdnatura.presentation.common.ItemShelving
|
||||||
import es.verdnatura.presentation.common.ResponseItemVO
|
import es.verdnatura.presentation.common.ResponseItemVO
|
||||||
|
@ -22,18 +24,23 @@ import es.verdnatura.presentation.common.TicketState
|
||||||
import es.verdnatura.presentation.view.feature.collection.ItemVO
|
import es.verdnatura.presentation.view.feature.collection.ItemVO
|
||||||
import es.verdnatura.presentation.view.feature.collection.SalixSaleQuantity
|
import es.verdnatura.presentation.view.feature.collection.SalixSaleQuantity
|
||||||
import es.verdnatura.presentation.view.feature.collection.mapper.map
|
import es.verdnatura.presentation.view.feature.collection.mapper.map
|
||||||
|
import es.verdnatura.presentation.view.feature.pasillero.model.CleanAction
|
||||||
|
import es.verdnatura.presentation.view.feature.pasillero.model.WorkerActionSalix
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionTicket
|
import es.verdnatura.presentation.view.feature.sacador.model.CollectionTicket
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||||
|
import es.verdnatura.presentation.view.feature.sacador.model.ItemShelvingSale
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeListVO
|
import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeListVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeVO
|
import es.verdnatura.presentation.view.feature.sacador.model.MistakeTypeVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyListVO
|
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyListVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO
|
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO
|
||||||
|
import es.verdnatura.presentation.view.feature.ubicador.model.ItemUbicador
|
||||||
import es.verdnatura.presentation.view.feature.workermistake.model.SaleMistakeSalix
|
import es.verdnatura.presentation.view.feature.workermistake.model.SaleMistakeSalix
|
||||||
import es.verdnatura.presentation.view.feature.workermistake.model.SaleTrackingDelSalix
|
import es.verdnatura.presentation.view.feature.workermistake.model.SaleTrackingDelSalix
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
|
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
|
||||||
|
private val getWokerActivityUseCase = WorkerActivityUseCase(salix)
|
||||||
private val contextApp = context
|
private val contextApp = context
|
||||||
|
|
||||||
private val _responseState by lazy { MutableLiveData<ResponseItemVO>() }
|
private val _responseState by lazy { MutableLiveData<ResponseItemVO>() }
|
||||||
|
@ -192,6 +199,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
|
||||||
|
@ -225,6 +237,16 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
val loadSetStateResponse: LiveData<Event<Boolean>> =
|
val loadSetStateResponse: LiveData<Event<Boolean>> =
|
||||||
_setStateResponse.map { Event(it) }
|
_setStateResponse.map { Event(it) }
|
||||||
|
|
||||||
|
private val _responseActivity by lazy { MutableLiveData<CleanAction>() }
|
||||||
|
val responseActivity: LiveData<CleanAction> = _responseActivity
|
||||||
|
val loadResponseActivity: LiveData<Event<CleanAction>> =
|
||||||
|
_responseActivity.map { Event(it) }
|
||||||
|
|
||||||
|
private val _itemShelvingSaleAddByCollection by lazy { MutableLiveData<Boolean>() }
|
||||||
|
val itemShelvingSaleAddByCollection: LiveData<Boolean> = _itemShelvingSaleAddByCollection
|
||||||
|
val loadItemShelvingSaleAddByCollection: LiveData<Event<Boolean>> =
|
||||||
|
_itemShelvingSaleAddByCollection.map { Event(it) }
|
||||||
|
|
||||||
fun getSales(
|
fun getSales(
|
||||||
collectionFk: Number, print: String, source: String
|
collectionFk: Number, print: String, source: String
|
||||||
|
|
||||||
|
@ -347,6 +369,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 +572,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 +593,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
|
||||||
) {
|
) {
|
||||||
|
@ -802,10 +890,17 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getIdFromCodeSalix(code: String) {
|
fun addWorkerActivity(activity: CleanAction) {
|
||||||
getItemFromBarcodeUseCase.execute(code).enqueue(object : SalixCallback<Int?>(context) {
|
getWokerActivityUseCase.addWorkerActivity(
|
||||||
override fun onSuccess(response: Response<Int?>) {
|
WorkerActionSalix(
|
||||||
_responseCode.value = response.body()
|
code = activity.codeWorkerAction.toString(),
|
||||||
|
description = activity.description
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.enqueue(object : SalixCallback<Any>(context) {
|
||||||
|
override fun onSuccess(response: Response<Any>) {
|
||||||
|
println("shelvinAction onResposne${activity}")
|
||||||
|
_responseActivity.value = activity
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -1052,4 +1147,23 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getIdFromCodeSalix(code: String) {
|
||||||
|
getItemFromBarcodeUseCase.execute(code).enqueue(object : SalixCallback<Int?>(context) {
|
||||||
|
override fun onSuccess(response: Response<Int?>) {
|
||||||
|
_responseCode.value = response.body()
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fun itemShelvingSaleAddByCollection(collection: Number) {
|
||||||
|
salix.itemShelvingSaleAddByCollection(params = collection)
|
||||||
|
.enqueue(
|
||||||
|
object :
|
||||||
|
SalixCallback<Any>(context) {
|
||||||
|
override fun onSuccess(response: Response<Any>) {
|
||||||
|
_itemShelvingSaleAddByCollection.value = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,11 +8,11 @@ import com.google.gson.JsonObject
|
||||||
import es.verdnatura.MobileApplication
|
import es.verdnatura.MobileApplication
|
||||||
import es.verdnatura.domain.SalixCallback
|
import es.verdnatura.domain.SalixCallback
|
||||||
import es.verdnatura.domain.formatWithQuotes
|
import es.verdnatura.domain.formatWithQuotes
|
||||||
|
import es.verdnatura.domain.getMessageFromAllResponse
|
||||||
|
import es.verdnatura.domain.nameofFunction
|
||||||
import es.verdnatura.domain.toast
|
import es.verdnatura.domain.toast
|
||||||
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
||||||
import es.verdnatura.presentation.base.BaseViewModel
|
import es.verdnatura.presentation.base.BaseViewModel
|
||||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
|
||||||
import es.verdnatura.presentation.base.nameofFunction
|
|
||||||
import es.verdnatura.presentation.common.Event
|
import es.verdnatura.presentation.common.Event
|
||||||
import es.verdnatura.presentation.common.ResponseItemExistsItemShelvingSale
|
import es.verdnatura.presentation.common.ResponseItemExistsItemShelvingSale
|
||||||
import es.verdnatura.presentation.common.ResponseItemVO
|
import es.verdnatura.presentation.common.ResponseItemVO
|
||||||
|
|
|
@ -22,6 +22,7 @@ import es.verdnatura.presentation.common.OnPackingClickListener
|
||||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||||
import es.verdnatura.presentation.common.OnQuantityClickListener
|
import es.verdnatura.presentation.common.OnQuantityClickListener
|
||||||
import es.verdnatura.presentation.common.OnSaleClickListener
|
import es.verdnatura.presentation.common.OnSaleClickListener
|
||||||
|
import es.verdnatura.presentation.common.OnTicketColorListener
|
||||||
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
||||||
import es.verdnatura.presentation.common.hideKeyboard
|
import es.verdnatura.presentation.common.hideKeyboard
|
||||||
import es.verdnatura.presentation.common.itemScanValue
|
import es.verdnatura.presentation.common.itemScanValue
|
||||||
|
@ -43,6 +44,7 @@ class CollectionShowTicketFragment(
|
||||||
|
|
||||||
private var lastScanned: Int = 0
|
private var lastScanned: Int = 0
|
||||||
private var buttonPushedGetCollection = false
|
private var buttonPushedGetCollection = false
|
||||||
|
private var hasFilterByLevel = false
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun newInstance(collection: CollectionVO, type: String) =
|
fun newInstance(collection: CollectionVO, type: String) =
|
||||||
|
@ -300,6 +302,18 @@ class CollectionShowTicketFragment(
|
||||||
override fun onPackingClick(sale: SaleVO) {
|
override fun onPackingClick(sale: SaleVO) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}, onTicketColorClickListener = object : OnTicketColorListener {
|
||||||
|
override fun onTicketColorListener(sale: SaleVO) {
|
||||||
|
hasFilterByLevel = !hasFilterByLevel
|
||||||
|
|
||||||
|
if (hasFilterByLevel) {
|
||||||
|
if (buttonPushedGetCollection) {
|
||||||
|
saleAdapter!!.updateSales(salesList.filter { it.level == sale.level } as MutableList)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
createCollectionList()
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
lm = LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||||
|
|
|
@ -5,9 +5,9 @@ import es.verdnatura.R
|
||||||
import es.verdnatura.presentation.common.convertToDateString
|
import es.verdnatura.presentation.common.convertToDateString
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionTicket
|
import es.verdnatura.presentation.view.feature.sacador.model.CollectionTicket
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyVO
|
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
fun CollectionVO.map(context: Context): CollectionVO {
|
fun CollectionVO.map(context: Context): CollectionVO {
|
||||||
try {
|
try {
|
||||||
|
@ -20,7 +20,6 @@ fun CollectionVO.map(context: Context): CollectionVO {
|
||||||
it.ticketFk = ticket.ticketFk
|
it.ticketFk = ticket.ticketFk
|
||||||
it.level = ticket.level
|
it.level = ticket.level
|
||||||
it.rgb = ticket.rgb
|
it.rgb = ticket.rgb
|
||||||
it.salePersonFk = ticket.salesPersonFk
|
|
||||||
it.agencyName = ticket.agencyName
|
it.agencyName = ticket.agencyName
|
||||||
it.isNew = it.isAdded == "1"
|
it.isNew = it.isAdded == "1"
|
||||||
it.code = it.cel3
|
it.code = it.cel3
|
||||||
|
@ -65,38 +64,31 @@ fun CollectionVO.map(context: Context): CollectionVO {
|
||||||
|
|
||||||
fun CollectionTicket.map(context: Context): CollectionTicket {
|
fun CollectionTicket.map(context: Context): CollectionTicket {
|
||||||
try {
|
try {
|
||||||
this.tickets.forEach { ticket ->
|
val allSalesAreNullOrEmpty = tickets.all { it.sales.isNullOrEmpty() }
|
||||||
ticket.sales.forEach {
|
if (!allSalesAreNullOrEmpty) {
|
||||||
|
this.tickets?.forEach { ticket ->
|
||||||
|
ticket.sales?.forEach {
|
||||||
it.level = ticket.level ?: ""
|
it.level = ticket.level ?: ""
|
||||||
it.rgb = ticket.rgb ?: ""
|
it.rgb = ticket.rgb ?: ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
this.isError = true
|
this.isError = true
|
||||||
if (this.tickets.isNullOrEmpty()) {
|
if (this.tickets.isEmpty()) {
|
||||||
this.errorMessage = context.getString(R.string.collectionNoTicketsError)
|
this.errorMessage = context.getString(R.string.collectionNoTicketsError)
|
||||||
} else {
|
} else {
|
||||||
this.errorMessage =
|
this.errorMessage =
|
||||||
context.getString(R.string.collectionErrorBuilding) + context.getString(R.string.reviewSector)
|
context.getString(R.string.collectionErrorBuilding) + context.getString(R.string.reviewSector)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getCalendarFromDate(date: String, context: Context): Calendar {
|
private fun getCalendarFromDate(date: String, context: Context): Calendar {
|
||||||
val sdf = SimpleDateFormat(context.getString(R.string.dateFormat))
|
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()
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -52,7 +52,6 @@ class ControlVehiculoUsuarioFragment(
|
||||||
|
|
||||||
if (userFk == vUserFK) {
|
if (userFk == vUserFK) {
|
||||||
val androidId: String = mobileApplication.dataStoreApp.readDataStoreKey(ANDROID_ID)
|
val androidId: String = mobileApplication.dataStoreApp.readDataStoreKey(ANDROID_ID)
|
||||||
// viewModel.machineGetWorkerPlate(mobileApplication.userId!!)
|
|
||||||
viewModel.deviceProductionGetnameDevice(
|
viewModel.deviceProductionGetnameDevice(
|
||||||
androidId
|
androidId
|
||||||
)
|
)
|
||||||
|
@ -64,7 +63,6 @@ class ControlVehiculoUsuarioFragment(
|
||||||
binding.userInformation.visibility = INVISIBLE
|
binding.userInformation.visibility = INVISIBLE
|
||||||
binding.nameVehiclecontrol.visibility = INVISIBLE
|
binding.nameVehiclecontrol.visibility = INVISIBLE
|
||||||
binding.userImage.setOnClickListener { binding.mainToolbar.backButton.performClick() }
|
binding.userImage.setOnClickListener { binding.mainToolbar.backButton.performClick() }
|
||||||
// viewModel.machineGetWorkerPlate(mobileApplication.userId!!)
|
|
||||||
binding.nameVehiclecontrol.visibility = VISIBLE
|
binding.nameVehiclecontrol.visibility = VISIBLE
|
||||||
viewModel.getNameWorker(userFk)
|
viewModel.getNameWorker(userFk)
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,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) {
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,8 @@ import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.KeyEvent
|
import android.text.Editable
|
||||||
|
import android.text.TextWatcher
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
|
@ -16,6 +17,8 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentExpeditionLoadunloadDeliveryBinding
|
import es.verdnatura.databinding.FragmentExpeditionLoadunloadDeliveryBinding
|
||||||
import es.verdnatura.db.DeliveryDatabase
|
import es.verdnatura.db.DeliveryDatabase
|
||||||
|
import es.verdnatura.domain.ConstAndValues.HUMAN_CHARACTERS_SECOND
|
||||||
|
import es.verdnatura.domain.ConstAndValues.SCANNER_THRESHOLD_SPEED
|
||||||
import es.verdnatura.domain.toDateString
|
import es.verdnatura.domain.toDateString
|
||||||
import es.verdnatura.domain.toast
|
import es.verdnatura.domain.toast
|
||||||
import es.verdnatura.presentation.base.BaseFragment
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
|
@ -44,7 +47,8 @@ class LoadUnloadFragment(
|
||||||
private var title: String = "",
|
private var title: String = "",
|
||||||
private var state: String = "",
|
private var state: String = "",
|
||||||
private var entryPoint: String,
|
private var entryPoint: String,
|
||||||
private var clientTicketList: ArrayList<ClientTicketSalix>?
|
private var clientTicketList: ArrayList<ClientTicketSalix>?,
|
||||||
|
private var startInputTime: Long = 0L,
|
||||||
|
|
||||||
) : BaseFragment<FragmentExpeditionLoadunloadDeliveryBinding, DeliveryViewModel>(
|
) : BaseFragment<FragmentExpeditionLoadunloadDeliveryBinding, DeliveryViewModel>(
|
||||||
DeliveryViewModel::class
|
DeliveryViewModel::class
|
||||||
|
@ -85,6 +89,24 @@ class LoadUnloadFragment(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
binding.scanInput.addTextChangedListener(object : TextWatcher {
|
||||||
|
override fun afterTextChanged(s: Editable?) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
||||||
|
if (before == 0 && count > 0) {
|
||||||
|
startInputTime = System.currentTimeMillis()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getLayoutId(): Int = R.layout.fragment_expedition_loadunload_delivery
|
override fun getLayoutId(): Int = R.layout.fragment_expedition_loadunload_delivery
|
||||||
|
@ -179,30 +201,16 @@ class LoadUnloadFragment(
|
||||||
|
|
||||||
private fun setExpeditionsState(list: MutableList<ExpeditionInfoLoadUnload>, state: String) {
|
private fun setExpeditionsState(list: MutableList<ExpeditionInfoLoadUnload>, state: String) {
|
||||||
scanning(false)
|
scanning(false)
|
||||||
/* val mlist = mutableListOf<ExpeditionSalix>()
|
|
||||||
for (l in list) {
|
|
||||||
mlist.add(
|
|
||||||
ExpeditionSalix(
|
|
||||||
expeditionFk = l.id,
|
|
||||||
stateCode = if (l.code != state && l.code != "FOUND" && l.code != "DELIVERED") {
|
|
||||||
if (state == "ON DELIVERY") "NOT SCANNED" else "LOST"
|
|
||||||
} else {
|
|
||||||
l.code
|
|
||||||
},
|
|
||||||
isScanned = l.isScanned
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}*/
|
|
||||||
val mlistPosition = mutableListOf<ExpeditionSalixPosition>()
|
val mlistPosition = mutableListOf<ExpeditionSalixPosition>()
|
||||||
for (l in list) {
|
for (l in list) {
|
||||||
mlistPosition.add(
|
mlistPosition.add(
|
||||||
ExpeditionSalixPosition(
|
ExpeditionSalixPosition(
|
||||||
expeditionFk = l.id,
|
expeditionFk = l.id,
|
||||||
stateCode = if (l.code == "FOUND") (l.code) else {
|
stateCode = if (l.code == "FOUND") (l.code) else {
|
||||||
if (state == "ON DELIVERY" && l.code != "ON DELIVERY" && l.code != "DELIVERED" && l.code != "LOST") {
|
if (state == "ON DELIVERY" && l.code != "ON DELIVERY" && l.code != "DELIVERED" && l.code != "LOST" && l.code != "PENDING" && l.code != "STORED") {
|
||||||
"NOT SCANNED"
|
"NOT SCANNED"
|
||||||
} else {
|
} else {
|
||||||
if (state == "DELIVERED" && l.code != "DELIVERED") "LOST" else l.code
|
if (state == "DELIVERED" && l.code != "DELIVERED" && l.code != "STORED") "PENDING" else l.code
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isScanned = l.isScanned,
|
isScanned = l.isScanned,
|
||||||
|
@ -273,12 +281,16 @@ 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()) {
|
||||||
|
|
||||||
|
val totalTime = (System.currentTimeMillis() - startInputTime)
|
||||||
|
val charsPerSecond = (binding.scanInput.text!!.length * 1000.0) / totalTime
|
||||||
val isScanned =
|
val isScanned =
|
||||||
event != null && event.action == KeyEvent.ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER
|
charsPerSecond > HUMAN_CHARACTERS_SECOND && totalTime < SCANNER_THRESHOLD_SPEED
|
||||||
|
|
||||||
//Tarea 8152
|
//Tarea 8152
|
||||||
// showconfirmExpedition(binding.scanInput.text.toString().toInt(), isScanned)
|
// showconfirmExpedition(binding.scanInput.text.toString().toInt(), isScanned)
|
||||||
try {
|
try {
|
||||||
|
@ -478,7 +490,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 +607,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)) {
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package es.verdnatura.presentation.view.feature.delivery.fragments
|
package es.verdnatura.presentation.view.feature.delivery.fragments
|
||||||
|
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.view.KeyEvent
|
import android.os.Bundle
|
||||||
|
import android.text.Editable
|
||||||
|
import android.text.TextWatcher
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
|
@ -11,6 +13,8 @@ import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import es.verdnatura.R
|
import es.verdnatura.R
|
||||||
import es.verdnatura.databinding.FragmentExpeditionSummaryBinding
|
import es.verdnatura.databinding.FragmentExpeditionSummaryBinding
|
||||||
|
import es.verdnatura.domain.ConstAndValues.HUMAN_CHARACTERS_SECOND
|
||||||
|
import es.verdnatura.domain.ConstAndValues.SCANNER_THRESHOLD_SPEED
|
||||||
import es.verdnatura.domain.toast
|
import es.verdnatura.domain.toast
|
||||||
import es.verdnatura.presentation.base.BaseFragment
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
import es.verdnatura.presentation.common.AdapterCallback
|
import es.verdnatura.presentation.common.AdapterCallback
|
||||||
|
@ -44,6 +48,7 @@ class SummaryFragment(
|
||||||
private var routeSelected = 0
|
private var routeSelected = 0
|
||||||
private var isScanning = false
|
private var isScanning = false
|
||||||
private var positionSelected = -1
|
private var positionSelected = -1
|
||||||
|
private var startInputTime: Long = 0L
|
||||||
|
|
||||||
override fun getPosition(): Int {
|
override fun getPosition(): Int {
|
||||||
return positionSelected
|
return positionSelected
|
||||||
|
@ -67,6 +72,26 @@ class SummaryFragment(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
binding.scanInput.addTextChangedListener(object : TextWatcher {
|
||||||
|
override fun afterTextChanged(s: Editable?) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
||||||
|
if (before == 0 && count > 0) {
|
||||||
|
startInputTime = System.currentTimeMillis()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
if (binding.mainToolbar.toolbarTitle.text != getString(R.string.titleDeliverySummary)) {
|
if (binding.mainToolbar.toolbarTitle.text != getString(R.string.titleDeliverySummary)) {
|
||||||
binding.scanInput.isEnabled = true
|
binding.scanInput.isEnabled = true
|
||||||
|
@ -151,10 +176,10 @@ class SummaryFragment(
|
||||||
val listExpedition = list.filter { it.addressFk == address }.map { l ->
|
val listExpedition = list.filter { it.addressFk == address }.map { l ->
|
||||||
ExpeditionSalixPosition(
|
ExpeditionSalixPosition(
|
||||||
expeditionFk = l.id, stateCode = if (l.code == "FOUND") (l.code) else {
|
expeditionFk = l.id, stateCode = if (l.code == "FOUND") (l.code) else {
|
||||||
if (state == "ON DELIVERY" && l.code != "ON DELIVERY" && l.code != "DELIVERED" && l.code != "LOST") {
|
if (state == "ON DELIVERY" && l.code != "ON DELIVERY" && l.code != "DELIVERED" && l.code != "LOST" && l.code != "PENDING" && l.code != "STORED") {
|
||||||
"NOT SCANNED"
|
"NOT SCANNED"
|
||||||
} else {
|
} else {
|
||||||
if (state == "DELIVERED" && l.code != "DELIVERED") "LOST" else l.code
|
if (state == "DELIVERED" && l.code != "DELIVERED" && l.code != "STORED") "PENDING" else l.code
|
||||||
}
|
}
|
||||||
}, isScanned = l.isScanned, scanOrder = l.scanOrder
|
}, isScanned = l.isScanned, scanOrder = l.scanOrder
|
||||||
|
|
||||||
|
@ -200,8 +225,12 @@ class SummaryFragment(
|
||||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||||
if (!binding.scanInput.text.isNullOrEmpty()) {
|
if (!binding.scanInput.text.isNullOrEmpty()) {
|
||||||
isScanning = true
|
isScanning = true
|
||||||
|
/* val isScanned =
|
||||||
|
event != null && event.action == KeyEvent.ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER*/
|
||||||
|
val totalTime = (System.currentTimeMillis() - startInputTime)
|
||||||
|
val charsPerSecond = (binding.scanInput.text!!.length * 1000.0) / totalTime
|
||||||
val isScanned =
|
val isScanned =
|
||||||
event != null && event.action == KeyEvent.ACTION_DOWN && event.keyCode == KeyEvent.KEYCODE_ENTER
|
charsPerSecond > HUMAN_CHARACTERS_SECOND && totalTime < SCANNER_THRESHOLD_SPEED
|
||||||
try {
|
try {
|
||||||
markExpedition(
|
markExpedition(
|
||||||
binding.scanInput.text.toString().toInt(),
|
binding.scanInput.text.toString().toInt(),
|
||||||
|
@ -233,14 +262,6 @@ class SummaryFragment(
|
||||||
found = true
|
found = true
|
||||||
exped.code = state
|
exped.code = state
|
||||||
exped.isScanned = isScanned
|
exped.isScanned = isScanned
|
||||||
|
|
||||||
println(
|
|
||||||
"scanOrder markExpedition${
|
|
||||||
myList.filter { it.addressFk == addressFkSelected }
|
|
||||||
.filter { it.code == state }.size
|
|
||||||
}"
|
|
||||||
)
|
|
||||||
|
|
||||||
exped.scanOrder = myList.filter { it.addressFk == addressFkSelected }
|
exped.scanOrder = myList.filter { it.addressFk == addressFkSelected }
|
||||||
.filter { it.code == state }.size
|
.filter { it.code == state }.size
|
||||||
break
|
break
|
||||||
|
|
|
@ -429,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(
|
|
||||||
mutableMapOf(
|
|
||||||
"entryPoint" to route.id,
|
|
||||||
"web" to "${
|
|
||||||
mobileApplication.dataStoreApp.getServerSalix()
|
|
||||||
}/api/Cmrs/${item.cmrFk}/print?access_token=${
|
|
||||||
mobileApplication.dataStoreApp.readDataStoreKey<String>(
|
mobileApplication.dataStoreApp.readDataStoreKey<String>(
|
||||||
TOKEN
|
TOKEN
|
||||||
)
|
)
|
||||||
}"
|
}"
|
||||||
)
|
|
||||||
)
|
val intent = Intent(Intent.ACTION_QUICK_VIEW, Uri.parse(url))
|
||||||
)
|
intent.setDataAndType(Uri.parse(url), "application/pdf")
|
||||||
|
startActivity(intent)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,10 @@ data class ClientTicketSalix(
|
||||||
var postalCode: String,
|
var postalCode: String,
|
||||||
var city: String,
|
var city: String,
|
||||||
var warehouseName: String?,
|
var warehouseName: String?,
|
||||||
var salePersonPhone: String?,
|
@SerializedName(
|
||||||
|
value = "salePersonPhone",
|
||||||
|
alternate = ["departmentPhone"]
|
||||||
|
) var salePersonPhone: String?,
|
||||||
@SerializedName(value = "ticketObservation", alternate = ["observationDelivery"])
|
@SerializedName(value = "ticketObservation", alternate = ["observationDelivery"])
|
||||||
var observationDelivery: String?,
|
var observationDelivery: String?,
|
||||||
var observationDropOff: String?,
|
var observationDropOff: String?,
|
||||||
|
|
|
@ -0,0 +1,137 @@
|
||||||
|
package es.verdnatura.presentation.view.feature.diadeventa.fragment
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.view.inputmethod.EditorInfo
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.ui.platform.ComposeView
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
|
import es.verdnatura.R
|
||||||
|
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||||
|
import es.verdnatura.presentation.composable.IconToolBar
|
||||||
|
import es.verdnatura.presentation.view.component.CustomDialog
|
||||||
|
import es.verdnatura.presentation.view.component.CustomDialogList
|
||||||
|
import es.verdnatura.presentation.view.feature.diadeventa.adapter.DayOfSaleAdapter
|
||||||
|
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||||
|
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||||
|
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||||
|
|
||||||
|
class DayOfSaleFragmentCompose(
|
||||||
|
var title: String = ""
|
||||||
|
) : Fragment() {
|
||||||
|
private val viewModel: DayOfSaleViewModelCompose by viewModel()
|
||||||
|
|
||||||
|
private lateinit var customDialogList: CustomDialogList
|
||||||
|
private lateinit var customDialog: CustomDialog
|
||||||
|
private var adapter: DayOfSaleAdapter? = null
|
||||||
|
private var itemScan = ""
|
||||||
|
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun newInstance(title: String) = DayOfSaleFragmentCompose(title)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onAttach(context: Context) {
|
||||||
|
if (context is OnPasillerosItemClickListener) pasillerosItemClickListener = context
|
||||||
|
super.onAttach(context)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onCreateView(
|
||||||
|
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||||
|
): View {
|
||||||
|
return ComposeView(requireContext()).apply {
|
||||||
|
setContent {
|
||||||
|
SetView()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun SetView() {
|
||||||
|
val uiState by viewModel.uiState.collectAsStateWithLifecycle()
|
||||||
|
|
||||||
|
val columnActions = listOf<(List<String>) -> Unit>(
|
||||||
|
// { item -> println("Producto seleccionado: ${item[0]}") }, // Acción para la primera columna
|
||||||
|
// { item -> println("Stock: ${item[1]}") }, // Acción para la segunda columna
|
||||||
|
// { item -> println("Visible: ${item[2]}") } // Acción para la tercera columna
|
||||||
|
)
|
||||||
|
|
||||||
|
GenericListScreen(
|
||||||
|
uiState.items.map { item ->
|
||||||
|
listOf(
|
||||||
|
item.itemFk?.toString() ?: "",
|
||||||
|
item.longName ?: "",
|
||||||
|
item.dated,
|
||||||
|
item.visible?.toString() ?: "",
|
||||||
|
item.stock?.toString() ?: ""
|
||||||
|
)
|
||||||
|
},
|
||||||
|
columnActions = columnActions,
|
||||||
|
headers = listOf(
|
||||||
|
getString(R.string.itemfk),
|
||||||
|
getString(R.string.name),
|
||||||
|
getString(R.string.date),
|
||||||
|
getString(R.string.visible),
|
||||||
|
getString(R.string.stock)
|
||||||
|
),
|
||||||
|
onTextChange = { input ->
|
||||||
|
viewModel.itemShelvingGetSaleDate(input)
|
||||||
|
},
|
||||||
|
titleToolBar =
|
||||||
|
if (uiState.shelvingCode.isNullOrEmpty()) title else title + " " + uiState.shelvingCode,
|
||||||
|
onBackClick = { (context as MainActivity).onMyBackPressed() },
|
||||||
|
onLongClick = { },
|
||||||
|
onClick = { item -> openSearchItemFragment(item[0]) },
|
||||||
|
listIconToolBar = listOf(
|
||||||
|
IconToolBar(
|
||||||
|
idRes = R.drawable.ic_local_parking_black_24dp,
|
||||||
|
toolTip = getString(R.string.allowParking),
|
||||||
|
onClickIcon = { showParking() },
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun showParking() {
|
||||||
|
|
||||||
|
customDialogList = CustomDialogList(requireContext())
|
||||||
|
customDialogList.setTitle(getString(R.string.showParking))
|
||||||
|
.setOkButton(getString(R.string.close)) {
|
||||||
|
|
||||||
|
customDialogList.dismiss()
|
||||||
|
}.setValue("").show()
|
||||||
|
|
||||||
|
customDialogList.getEditText().requestFocus()
|
||||||
|
customDialogList.getEditText().setOnEditorActionListener { _, actionId, _ ->
|
||||||
|
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
||||||
|
if (customDialogList.getValue().isNotEmpty()) {
|
||||||
|
viewModel.setParking(
|
||||||
|
parking = customDialogList.getValue(),
|
||||||
|
scanItem = itemScan
|
||||||
|
)
|
||||||
|
|
||||||
|
customDialogList.dismiss()
|
||||||
|
}
|
||||||
|
customDialogList.setValue("")
|
||||||
|
return@setOnEditorActionListener true
|
||||||
|
}
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun openSearchItemFragment(item: String) {
|
||||||
|
pasillerosItemClickListener!!.onPasillerosItemClickListener(
|
||||||
|
PasillerosItemVO(
|
||||||
|
title =
|
||||||
|
R.string.titleItemConsult
|
||||||
|
), item
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
package es.verdnatura.presentation.view.feature.diadeventa.fragment
|
||||||
|
|
||||||
|
import es.verdnatura.domain.SalixCallback
|
||||||
|
import es.verdnatura.domain.formatWithQuotes
|
||||||
|
import es.verdnatura.presentation.base.BaseViewModelCompose
|
||||||
|
import es.verdnatura.presentation.view.feature.diadeventa.model.ItemShelvingSaleDate
|
||||||
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
|
import kotlinx.coroutines.flow.asStateFlow
|
||||||
|
import kotlinx.coroutines.flow.update
|
||||||
|
import retrofit2.Response
|
||||||
|
|
||||||
|
data class UiState(
|
||||||
|
val shelvingCode: String? = null,
|
||||||
|
val items: List<ItemShelvingSaleDate> = emptyList()
|
||||||
|
)
|
||||||
|
|
||||||
|
class DayOfSaleViewModelCompose(var application: android.app.Application) :
|
||||||
|
BaseViewModelCompose(application) {
|
||||||
|
|
||||||
|
private val _uiState = MutableStateFlow(UiState())
|
||||||
|
val uiState = _uiState.asStateFlow()
|
||||||
|
|
||||||
|
fun itemShelvingGetSaleDate(vShelvingFK: String) {
|
||||||
|
_uiState.update { it.copy(shelvingCode = vShelvingFK) }
|
||||||
|
salix.itemShelvingGetSaleDate(params = listOf(vShelvingFK).formatWithQuotes())
|
||||||
|
.enqueue(object :
|
||||||
|
SalixCallback<List<ItemShelvingSaleDate>>(application.applicationContext) {
|
||||||
|
|
||||||
|
override fun onSuccess(response: Response<List<ItemShelvingSaleDate>>) {
|
||||||
|
|
||||||
|
response.body()?.let { list ->
|
||||||
|
_uiState.update { it.copy(items = list) }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setParking(scanItem: String, parking: String) {
|
||||||
|
salix.setParking(arrayListOf(scanItem, parking).formatWithQuotes())
|
||||||
|
.enqueue(object : SalixCallback<Any>(application.applicationContext) {})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,215 @@
|
||||||
|
package es.verdnatura.presentation.view.feature.diadeventa.fragment
|
||||||
|
|
||||||
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.clickable
|
||||||
|
import androidx.compose.foundation.combinedClickable
|
||||||
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
|
import androidx.compose.foundation.lazy.items
|
||||||
|
import androidx.compose.material3.HorizontalDivider
|
||||||
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.runtime.setValue
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.focus.FocusRequester
|
||||||
|
import androidx.compose.ui.focus.focusRequester
|
||||||
|
import androidx.compose.ui.focus.onFocusEvent
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
|
import es.verdnatura.R
|
||||||
|
import es.verdnatura.presentation.composable.CustomToolbar
|
||||||
|
import es.verdnatura.presentation.composable.IconToolBar
|
||||||
|
import es.verdnatura.presentation.composable.LottieLoadingAnimation
|
||||||
|
import es.verdnatura.presentation.composable.ScanLineTextSearch
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.Date
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun GenericListScreen(
|
||||||
|
items: List<List<String>>, // Lista de listas de strings para los datos
|
||||||
|
headers: List<String>,// Lista de encabezados
|
||||||
|
columnActions: List<(List<String>) -> Unit>, // Lista de acciones
|
||||||
|
onTextChange: (String) -> Unit,
|
||||||
|
titleToolBar: String,
|
||||||
|
onBackClick: () -> Unit = {},
|
||||||
|
onLongClick: (List<String>) -> Unit,
|
||||||
|
onClick: (List<String>) -> Unit,
|
||||||
|
listIconToolBar: List<IconToolBar> = listOf()
|
||||||
|
) {
|
||||||
|
var searchText by remember { mutableStateOf("") }
|
||||||
|
val focusRequester = remember { FocusRequester() }
|
||||||
|
val keyboardController = LocalSoftwareKeyboardController.current
|
||||||
|
var showLoading by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
|
val onImeAction: () -> Unit = {
|
||||||
|
onTextChange(searchText)
|
||||||
|
searchText = ""
|
||||||
|
keyboardController?.hide()
|
||||||
|
}
|
||||||
|
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.background(Color.Black)
|
||||||
|
) {
|
||||||
|
Column(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.background(Color.Black)
|
||||||
|
) {
|
||||||
|
if (showLoading) {
|
||||||
|
LottieLoadingAnimation(true)
|
||||||
|
}
|
||||||
|
CustomToolbar(
|
||||||
|
title = titleToolBar,
|
||||||
|
subtitle = "",
|
||||||
|
showBackButton = true,
|
||||||
|
showSwitch = false,
|
||||||
|
iconList = listIconToolBar,
|
||||||
|
onBackClick = onBackClick,
|
||||||
|
onSwitchChange = { }
|
||||||
|
)
|
||||||
|
Spacer(modifier = Modifier.height(8.dp))
|
||||||
|
|
||||||
|
ScanLineTextSearch(
|
||||||
|
value = searchText,
|
||||||
|
onValueChange = {
|
||||||
|
searchText = it
|
||||||
|
showLoading = true
|
||||||
|
},
|
||||||
|
onImeAction,
|
||||||
|
modifier = Modifier
|
||||||
|
.focusRequester(focusRequester)
|
||||||
|
.onFocusEvent {
|
||||||
|
if (it.isFocused) {
|
||||||
|
keyboardController?.hide()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
LaunchedEffect(Unit) {
|
||||||
|
focusRequester.requestFocus()
|
||||||
|
keyboardController?.hide()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Encabezados
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(vertical = 8.dp),
|
||||||
|
horizontalArrangement = Arrangement.SpaceEvenly
|
||||||
|
) {
|
||||||
|
headers.forEach { text ->
|
||||||
|
Text(
|
||||||
|
text = text,
|
||||||
|
color = Color.White,
|
||||||
|
fontSize = 14.sp,
|
||||||
|
modifier = Modifier.weight(1f)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HorizontalDivider(thickness = 1.dp, color = Color.White)
|
||||||
|
|
||||||
|
LazyColumn(modifier = Modifier.fillMaxSize()) {
|
||||||
|
items(items) { item ->
|
||||||
|
GenericRow(
|
||||||
|
values = item,
|
||||||
|
onLongClick = { onLongClick(item) },
|
||||||
|
onClick = { onClick(item) },
|
||||||
|
columnActions = columnActions
|
||||||
|
)
|
||||||
|
HorizontalDivider(thickness = 1.dp, color = Color.White)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
showLoading = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalFoundationApi::class)
|
||||||
|
@Composable
|
||||||
|
fun GenericRow(
|
||||||
|
values: List<String>,
|
||||||
|
onLongClick: () -> Unit,
|
||||||
|
onClick: () -> Unit,
|
||||||
|
columnActions: List<(List<String>) -> Unit>
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(vertical = 8.dp)
|
||||||
|
.combinedClickable(onClick = onClick, onLongClick = onLongClick),
|
||||||
|
horizontalArrangement = Arrangement.SpaceEvenly
|
||||||
|
) {
|
||||||
|
values.forEachIndexed { index, value ->
|
||||||
|
val sdf = SimpleDateFormat(stringResource(R.string.dateFormat), Locale.getDefault())
|
||||||
|
val currentDate = sdf.format(Date())
|
||||||
|
|
||||||
|
val context = LocalContext.current // Accediendo al contexto
|
||||||
|
|
||||||
|
val customOrange = ContextCompat.getColor(context, R.color.verdnatura_pumpkin_orange)
|
||||||
|
val customWhite = ContextCompat.getColor(context, R.color.verdnatura_white)
|
||||||
|
val color = if (value == currentDate) Color(customOrange) else Color(customWhite)
|
||||||
|
|
||||||
|
Text(
|
||||||
|
text = value,
|
||||||
|
color = color,
|
||||||
|
textAlign = TextAlign.Center,
|
||||||
|
modifier = Modifier
|
||||||
|
.weight(1f)
|
||||||
|
.then(if (index < columnActions.size) Modifier.clickable {
|
||||||
|
columnActions[index](values)
|
||||||
|
} else Modifier)
|
||||||
|
.align(Alignment.CenterVertically)
|
||||||
|
.padding(4.dp)
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun TextDayOfSale(
|
||||||
|
values: List<String>,
|
||||||
|
value: String,
|
||||||
|
index: Int,
|
||||||
|
columnActions: List<(List<String>) -> Unit>
|
||||||
|
) {
|
||||||
|
val sdf = SimpleDateFormat(stringResource(R.string.dateFormat), Locale.getDefault())
|
||||||
|
val currentDate = sdf.format(Date())
|
||||||
|
|
||||||
|
val context = LocalContext.current
|
||||||
|
val customOrange = ContextCompat.getColor(context, R.color.verdnatura_pumpkin_orange)
|
||||||
|
val customWhite = ContextCompat.getColor(context, R.color.verdnatura_white)
|
||||||
|
val color = if (value == currentDate) Color(customOrange) else Color(customWhite)
|
||||||
|
|
||||||
|
Text(
|
||||||
|
text = value,
|
||||||
|
color = color,
|
||||||
|
modifier = Modifier
|
||||||
|
.then(if (index < columnActions.size) Modifier.clickable {
|
||||||
|
columnActions[index](values)
|
||||||
|
} else Modifier)
|
||||||
|
)
|
||||||
|
}
|
|
@ -7,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,12 +39,12 @@ 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(
|
||||||
ContextCompat.getColor(
|
ContextCompat.getColor(
|
||||||
historicoDate.context, if (currentDate == item.shipped) {
|
historicoDate.context, if (item.shipped.contains(currentDate)) {
|
||||||
R.color.verdnatura_pumpkin_orange
|
R.color.verdnatura_pumpkin_orange
|
||||||
} else {
|
} else {
|
||||||
R.color.verdnatura_black_5
|
R.color.verdnatura_black_5
|
||||||
|
@ -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(
|
||||||
|
|
|
@ -13,9 +13,11 @@ import es.verdnatura.R.color.verdnatura_white
|
||||||
import es.verdnatura.databinding.FragmentHistoricoBinding
|
import es.verdnatura.databinding.FragmentHistoricoBinding
|
||||||
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFK
|
import es.verdnatura.domain.ConstAndValues.WAREHOUSEFK
|
||||||
import es.verdnatura.domain.notNull
|
import es.verdnatura.domain.notNull
|
||||||
|
import es.verdnatura.domain.toast
|
||||||
import es.verdnatura.presentation.base.BaseFragment
|
import es.verdnatura.presentation.base.BaseFragment
|
||||||
import es.verdnatura.presentation.common.OnClientHistoricItemClickListener
|
import es.verdnatura.presentation.common.OnClientHistoricItemClickListener
|
||||||
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
||||||
|
import es.verdnatura.presentation.common.OnOutQuantityHistoricItemClickListener
|
||||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||||
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
||||||
import es.verdnatura.presentation.view.component.CustomDialog
|
import es.verdnatura.presentation.view.component.CustomDialog
|
||||||
|
@ -23,6 +25,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
|
||||||
|
@ -191,8 +194,12 @@ class HistoricoArticuloFragment(
|
||||||
listHistoric.add(it)
|
listHistoric.add(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
listHistoric.sortWith { item1, item2 ->
|
/* listHistoric.sortWith { item1, item2 ->
|
||||||
val compareShipped = item1.shipped.compareTo(item2.shipped)
|
|
||||||
|
val date1 = item1.shipped.split(" ")[0]
|
||||||
|
val date2 = item2.shipped.split(" ")[0]
|
||||||
|
|
||||||
|
val compareShipped = date1.compareTo(date2)
|
||||||
//comentar con ivanm
|
//comentar con ivanm
|
||||||
if (compareShipped == 0) {
|
if (compareShipped == 0) {
|
||||||
if (item1.order == null && item2.order == null) {
|
if (item1.order == null && item2.order == null) {
|
||||||
|
@ -207,7 +214,7 @@ class HistoricoArticuloFragment(
|
||||||
} else {
|
} else {
|
||||||
compareShipped
|
compareShipped
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
adapter = HistoricoAdapter(listHistoric, object : OnClientHistoricItemClickListener {
|
adapter = HistoricoAdapter(listHistoric, object : OnClientHistoricItemClickListener {
|
||||||
|
|
||||||
override fun onClientHistoricItemClickListener(item: ItemHistoricoVO) {
|
override fun onClientHistoricItemClickListener(item: ItemHistoricoVO) {
|
||||||
|
@ -242,6 +249,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 =
|
||||||
|
@ -253,13 +325,22 @@ class HistoricoArticuloFragment(
|
||||||
|
|
||||||
private fun navigateToToday(it: ItemHistoricoListVO) {
|
private fun navigateToToday(it: ItemHistoricoListVO) {
|
||||||
var positionToday = 0
|
var positionToday = 0
|
||||||
val sdf = SimpleDateFormat(getString(R.string.dateFormat), Locale.getDefault())
|
|
||||||
val currentDate = sdf.format(Date())
|
val inputFormat = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault())
|
||||||
|
val outputFormat = SimpleDateFormat(getString(R.string.dateFormat), Locale.getDefault())
|
||||||
|
val currentDate = outputFormat.format(Date())
|
||||||
|
|
||||||
for (item in it.list) {
|
for (item in it.list) {
|
||||||
if (currentDate == item.shipped) {
|
try {
|
||||||
|
val shippedDate = inputFormat.parse(item.shipped)
|
||||||
|
val formattedShippedDate = shippedDate?.let { date -> outputFormat.format(date) }
|
||||||
|
if (currentDate == formattedShippedDate) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
getString(R.string.errorOrderList).toast(requireContext())
|
||||||
|
}
|
||||||
|
|
||||||
positionToday += 1
|
positionToday += 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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,
|
||||||
|
@ -34,6 +36,7 @@ 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 = "",
|
||||||
|
|
|
@ -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,6 +326,8 @@ class LoginFragment() :
|
||||||
if (binding.edittextServer.text.toString() == "Producción") {
|
if (binding.edittextServer.text.toString() == "Producción") {
|
||||||
mobileApplication.clearApplicationData()
|
mobileApplication.clearApplicationData()
|
||||||
}
|
}
|
||||||
|
//Tarea 8212 serialMuber is obtaines from back when PDA is registered, updated scaleFusion
|
||||||
|
if (it.serialNumber.isEmpty()) {
|
||||||
customDialog.setTitle(getString(R.string.Actualizar))
|
customDialog.setTitle(getString(R.string.Actualizar))
|
||||||
.setDescription(getString(R.string.updatemng)).setOkButton(
|
.setDescription(getString(R.string.updatemng)).setOkButton(
|
||||||
getString(
|
getString(
|
||||||
|
@ -380,6 +353,9 @@ class LoginFragment() :
|
||||||
}
|
}
|
||||||
customDialog.show()
|
customDialog.show()
|
||||||
|
|
||||||
|
} else {
|
||||||
|
goToMain()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
@ -58,7 +56,7 @@ import es.verdnatura.presentation.view.feature.articulo.fragment.ItemProposalFra
|
||||||
import es.verdnatura.presentation.view.feature.boxPicking.BoxPickingFragment
|
import es.verdnatura.presentation.view.feature.boxPicking.BoxPickingFragment
|
||||||
import es.verdnatura.presentation.view.feature.buffer.fragment.BufferFragment
|
import es.verdnatura.presentation.view.feature.buffer.fragment.BufferFragment
|
||||||
import es.verdnatura.presentation.view.feature.buffer.fragment.BufferLoadFragment
|
import es.verdnatura.presentation.view.feature.buffer.fragment.BufferLoadFragment
|
||||||
import es.verdnatura.presentation.view.feature.buscaritem.fragment.BuscarItemFragment
|
import es.verdnatura.presentation.view.feature.buscaritem.fragment.BuscarItemFragmentCompose
|
||||||
import es.verdnatura.presentation.view.feature.category.ChangeCategoryFragment
|
import es.verdnatura.presentation.view.feature.category.ChangeCategoryFragment
|
||||||
import es.verdnatura.presentation.view.feature.claim.fragment.reubication.fragment.ReubicationCollectionFragment
|
import es.verdnatura.presentation.view.feature.claim.fragment.reubication.fragment.ReubicationCollectionFragment
|
||||||
import es.verdnatura.presentation.view.feature.claim.fragment.reubication.fragment.ReubicationFragment
|
import es.verdnatura.presentation.view.feature.claim.fragment.reubication.fragment.ReubicationFragment
|
||||||
|
@ -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
|
||||||
|
@ -81,12 +79,10 @@ import es.verdnatura.presentation.view.feature.delivery.fragments.SalaryCompleme
|
||||||
import es.verdnatura.presentation.view.feature.delivery.fragments.SummaryFragment
|
import es.verdnatura.presentation.view.feature.delivery.fragments.SummaryFragment
|
||||||
import es.verdnatura.presentation.view.feature.delivery.fragments.TicketsFragment
|
import es.verdnatura.presentation.view.feature.delivery.fragments.TicketsFragment
|
||||||
import es.verdnatura.presentation.view.feature.delivery.model.ClientTicketSalix
|
import es.verdnatura.presentation.view.feature.delivery.model.ClientTicketSalix
|
||||||
import es.verdnatura.presentation.view.feature.diadeventa.fragment.DayOfSaleFragment
|
import es.verdnatura.presentation.view.feature.diadeventa.fragment.DayOfSaleFragmentCompose
|
||||||
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
|
||||||
|
@ -103,7 +99,7 @@ import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionPa
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionPalletFragment
|
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionPalletFragment
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionPreparedStateFragment
|
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionPreparedStateFragment
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionScanFragment
|
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionScanFragment
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionScanSorterFragment
|
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionScanSorterFragmentCompose
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionStateFragment
|
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionStateFragment
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionTruckListFragment
|
import es.verdnatura.presentation.view.feature.paletizador.fragment.ExpeditionTruckListFragment
|
||||||
import es.verdnatura.presentation.view.feature.paletizador.fragment.PalletScanFragment
|
import es.verdnatura.presentation.view.feature.paletizador.fragment.PalletScanFragment
|
||||||
|
@ -135,9 +131,9 @@ import es.verdnatura.presentation.view.feature.sacador.model.CollectionTicket
|
||||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||||
import es.verdnatura.presentation.view.feature.ticket.fragment.TicketAdvanceFragment
|
import es.verdnatura.presentation.view.feature.ticket.fragment.TicketAdvanceFragment
|
||||||
import es.verdnatura.presentation.view.feature.ubicador.fragment.AutomaticAddItemFragment
|
import es.verdnatura.presentation.view.feature.ubicador.fragment.AutomaticAddItemFragment
|
||||||
import es.verdnatura.presentation.view.feature.ubicador.fragment.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.WorkermistakeFragmentCompose
|
||||||
import kotlinx.coroutines.DelicateCoroutinesApi
|
import kotlinx.coroutines.DelicateCoroutinesApi
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.GlobalScope
|
import kotlinx.coroutines.GlobalScope
|
||||||
|
@ -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) -> {
|
||||||
|
@ -586,7 +575,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(R.string.titleScanExpedition) -> {
|
getString(R.string.titleScanExpedition) -> {
|
||||||
addFragmentOnTop(ExpeditionScanSorterFragment.newInstance(itemTitle))
|
//addFragmentOnTop(ExpeditionScanSorterFragment.newInstance(itemTitle))
|
||||||
|
addFragmentOnTop(ExpeditionScanSorterFragmentCompose.newInstance(itemTitle))
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(R.string.titleBufferManegement) -> {
|
getString(R.string.titleBufferManegement) -> {
|
||||||
|
@ -615,21 +605,15 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* getString(R.string.titlePrePicker) -> {
|
|
||||||
addFragmentOnTop(PreSacadorFragment.newInstance())
|
|
||||||
}*/
|
|
||||||
getString(R.string.titleDayOfSale) -> {
|
getString(R.string.titleDayOfSale) -> {
|
||||||
addFragmentOnTop(DayOfSaleFragment(itemTitle))
|
//addFragmentOnTop(DayOfSaleFragment(itemTitle))
|
||||||
|
addFragmentOnTop(DayOfSaleFragmentCompose(itemTitle))
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(R.string.titleShowTicket) -> {
|
getString(R.string.titleShowTicket) -> {
|
||||||
addFragmentOnTop(ShowTicketFragment.newInstance(getString(R.string.titleCorridors)))
|
addFragmentOnTop(ShowTicketFragment.newInstance(getString(R.string.titleCorridors)))
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(R.string.titleHistoricalVehicle) -> {
|
|
||||||
addFragmentOnTop(ControlVehiculoFragment.newInstance(HistoricoVehiculoFragment.TAG))
|
|
||||||
}
|
|
||||||
|
|
||||||
getString(R.string.titleItemConsult) -> {
|
getString(R.string.titleItemConsult) -> {
|
||||||
addFragmentOnTop(ItemCardFragment.newInstance(entryPoint))
|
addFragmentOnTop(ItemCardFragment.newInstance(entryPoint))
|
||||||
}
|
}
|
||||||
|
@ -638,19 +622,15 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
addFragmentOnTop(ItemProposalFragment.newInstance(entryPoint.toInt()))
|
addFragmentOnTop(ItemProposalFragment.newInstance(entryPoint.toInt()))
|
||||||
}
|
}
|
||||||
|
|
||||||
//segio: esta opción no se muestra, solo es accesible para añadir fragmentos de otras partes.
|
|
||||||
getString(R.string.titleHistoricalHide) -> {
|
|
||||||
addFragmentOnTop(HistoricoVehiculoFragment.newInstance(entryPoint))
|
|
||||||
}
|
|
||||||
|
|
||||||
getString(R.string.Parking) -> {
|
getString(R.string.Parking) -> {
|
||||||
addFragmentOnTop(ParkingFragment.newInstance(""))
|
addFragmentOnTop(ParkingFragment.newInstance(""))
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(R.string.titleItemSearch) -> {
|
getString(R.string.titleItemSearch) -> {
|
||||||
|
|
||||||
|
//JETPACKCOMPOSE
|
||||||
addFragmentOnTop(
|
addFragmentOnTop(
|
||||||
BuscarItemFragment.newInstance(
|
BuscarItemFragmentCompose.newInstance(
|
||||||
if (entryPoint == "") {
|
if (entryPoint == "") {
|
||||||
null
|
null
|
||||||
} else {
|
} else {
|
||||||
|
@ -658,6 +638,16 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/* addFragmentOnTop(
|
||||||
|
BuscarItemFragment.newInstance(
|
||||||
|
if (entryPoint == "") {
|
||||||
|
null
|
||||||
|
} else {
|
||||||
|
entryPoint.toInt()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)*/
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(R.string.titleHistorical) -> {
|
getString(R.string.titleHistorical) -> {
|
||||||
|
@ -673,13 +663,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 +703,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 +745,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))
|
||||||
|
@ -774,7 +759,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(R.string.titleWorkerMistake) -> {
|
getString(R.string.titleWorkerMistake) -> {
|
||||||
addFragmentOnTop(WorkermistakeFragment.newInstance(itemTitle))
|
//addFragmentOnTop(WorkermistakeFragment.newInstance(itemTitle))
|
||||||
|
addFragmentOnTop(WorkermistakeFragmentCompose.newInstance(itemTitle))
|
||||||
}
|
}
|
||||||
|
|
||||||
getString(R.string.deleteExpedition) -> {
|
getString(R.string.deleteExpedition) -> {
|
||||||
|
@ -785,7 +771,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 +820,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 +946,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 +1062,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 +1111,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 +1120,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 +1202,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 ?: ""
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue