Merge branch 'dev' into test
This commit is contained in:
commit
56879ba3a8
|
@ -1,3 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DesignSurface">
|
||||
<option name="filePathToZoomLevelMap">
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
<component name="AndroidLayouts">
|
||||
<shared>
|
||||
<config>
|
||||
<device id="pixel_6a" />
|
||||
<locale>es</locale>
|
||||
<pickBest>false</pickBest>
|
||||
<target>android-27</target>
|
||||
|
@ -285,6 +286,11 @@
|
|||
<theme>@style/AppTheme</theme>
|
||||
</config>
|
||||
</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">
|
||||
<config>
|
||||
<theme>@style/AppTheme</theme>
|
||||
|
@ -431,6 +437,11 @@
|
|||
<theme>@style/AppTheme</theme>
|
||||
</config>
|
||||
</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">
|
||||
<config>
|
||||
<theme>@style/AppTheme</theme>
|
||||
|
@ -493,12 +504,24 @@
|
|||
</select>
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="fa688d1c-dbee-4864-9e33-4d84ef9afca8" name="Default Changelist" comment="feat: refs#6845 userInterface">
|
||||
<change afterPath="$PROJECT_DIR$/CHANGELOG.md" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/changeLog.sh" afterDir="false" />
|
||||
<list default="true" id="fa688d1c-dbee-4864-9e33-4d84ef9afca8" name="Default Changelist" comment="feat: refs#6861 reservas">
|
||||
<change afterPath="$PROJECT_DIR$/app/lint-baseline.xml" 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/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/main/activity/MainActivity.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/src/main/java/es/verdnatura/presentation/view/feature/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/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/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 id="7b98f93d-6980-4bf1-8e61-c7afd10e56f2" name="Change_category" comment="Change_category" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
|
@ -513,7 +536,7 @@
|
|||
<component name="CodeInsightWorkspaceSettings">
|
||||
<option name="optimizeImportsOnTheFly" value="true" />
|
||||
</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">
|
||||
<option name="OPEN_IN_BROWSER" value="true" />
|
||||
<option name="OUTPUT_DIRECTORY" value="C:\Program Files\Android\Android Studio\inspections" />
|
||||
|
@ -603,7 +626,7 @@
|
|||
</option>
|
||||
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
||||
<map>
|
||||
<entry key="$PROJECT_DIR$" value="dev_6078" />
|
||||
<entry key="$PROJECT_DIR$" value="devLinphone" />
|
||||
</map>
|
||||
</option>
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
|
@ -664,60 +687,60 @@
|
|||
<option name="showLibraryContents" value="true" />
|
||||
<option name="showMembers" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"Android App.app.executor": "Run",
|
||||
"ApkExportedModule": "Gestor_Almacén.app",
|
||||
"DEBUGGABLE_DEVICE": "zebra_technologies-tc21-21114523025303",
|
||||
"DEBUGGABLE_PROCESS": "es.verdnatura.sfusion",
|
||||
"DEBUGGER_ID": "Auto",
|
||||
"ExportApk.ApkPathForGestor_Almacén.app": "C:\\Users\\sergiodt\\AndroidStudioProjects\\vn-warehouseManager\\app",
|
||||
"Gradle.vn-warehouseManager [clean].executor": "Run",
|
||||
"Gradle.vn-warehouseManager.executor": "Run",
|
||||
"KotlinFunctionFindUsagesOptions.isSearchForTextOccurrences": "true",
|
||||
"PROJECT_TRUSTED_KEY": "true",
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.cidr.known.project.marker": "true",
|
||||
"RunOnceActivity.readMode.enableVisualFormatting": "true",
|
||||
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||
"SHOW_ALL_PROCESSES": "false",
|
||||
"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/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-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/TextView.java_SELECTED": "TextView",
|
||||
"cf.first.check.clang-format": "false",
|
||||
"cidr.known.project.marker": "true",
|
||||
"com.developerphil.adbidea.selecteddevices": "G65TY9DQN7X4BIE6",
|
||||
"com.google.services.firebase.aqiPopupShown": "true",
|
||||
"git-widget-placeholder": "dev",
|
||||
"ignore.virus.scanning.warn.message": "true",
|
||||
"kotlin-language-version-configured": "true",
|
||||
"last_directory_selection": "C:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable",
|
||||
"last_opened_file_path": "C:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout",
|
||||
"project.structure.last.edited": "Modules",
|
||||
"project.structure.proportion": "0.17",
|
||||
"project.structure.side.proportion": "0.2",
|
||||
"rearrange.code.on.save": "true",
|
||||
"run.code.analysis.last.selected.profile": "pProject Default",
|
||||
"settings.editor.selected.configurable": "preferences.pluginManager"
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"Android App.app.executor": "Run",
|
||||
"ApkExportedModule": "Gestor_Almacén.app",
|
||||
"DEBUGGABLE_DEVICE": "honeywell-eda52-23086B3FFD",
|
||||
"DEBUGGABLE_PROCESS": "es.verdnatura.sfusion",
|
||||
"DEBUGGER_ID": "Auto",
|
||||
"ExportApk.ApkPathForGestor_Almacén.app": "C:\\Users\\sergiodt\\AndroidStudioProjects\\vn-warehouseManager\\app",
|
||||
"Gradle.vn-warehouseManager [clean].executor": "Run",
|
||||
"Gradle.vn-warehouseManager.executor": "Run",
|
||||
"KotlinFunctionFindUsagesOptions.isSearchForTextOccurrences": "true",
|
||||
"PROJECT_TRUSTED_KEY": "true",
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.cidr.known.project.marker": "true",
|
||||
"RunOnceActivity.readMode.enableVisualFormatting": "true",
|
||||
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||
"SHOW_ALL_PROCESSES": "false",
|
||||
"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/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-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/TextView.java_SELECTED": "TextView",
|
||||
"cf.first.check.clang-format": "false",
|
||||
"cidr.known.project.marker": "true",
|
||||
"com.developerphil.adbidea.selecteddevices": "G65TY9DQN7X4BIE6",
|
||||
"com.google.services.firebase.aqiPopupShown": "true",
|
||||
"git-widget-placeholder": "dev",
|
||||
"ignore.virus.scanning.warn.message": "true",
|
||||
"kotlin-language-version-configured": "true",
|
||||
"last_directory_selection": "C:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/drawable",
|
||||
"last_opened_file_path": "C:/Users/sergiodt/AndroidStudioProjects/vn-warehouseManager/app/src/main/res/layout",
|
||||
"project.structure.last.edited": "Dependencies",
|
||||
"project.structure.proportion": "0.17",
|
||||
"project.structure.side.proportion": "0.2",
|
||||
"rearrange.code.on.save": "true",
|
||||
"run.code.analysis.last.selected.profile": "pProject Default",
|
||||
"settings.editor.selected.configurable": "reference.settingsdialog.project.gradle"
|
||||
},
|
||||
"keyToStringList": {
|
||||
"ExportApk.BuildVariants": [
|
||||
"generalRelease"
|
||||
"keyToStringList": {
|
||||
"ExportApk.BuildVariants": [
|
||||
"generalRelease"
|
||||
],
|
||||
"com.android.tools.idea.sqlite.queryhistory": [
|
||||
"select * from expedition where routeFk=182933;",
|
||||
"select * from expedition;",
|
||||
"select * from expeditionPending;",
|
||||
"select * from expedition where id = 7753995;\n\n",
|
||||
"\nselect * from expedition where id = 7753995;"
|
||||
"com.android.tools.idea.sqlite.queryhistory": [
|
||||
"select * from expedition where routeFk=182933;",
|
||||
"select * from expedition;",
|
||||
"select * from expeditionPending;",
|
||||
"select * from expedition where id = 7753995;\n\n",
|
||||
"\nselect * from expedition where id = 7753995;"
|
||||
]
|
||||
}
|
||||
}</component>
|
||||
}]]></component>
|
||||
<component name="PsdUISettings">
|
||||
<option name="MODULE_TAB" value="Properties" />
|
||||
<option name="LAST_EDITED_SIGNING_CONFIG" value="debug" />
|
||||
|
@ -1265,7 +1288,7 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1709725795643</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="373" />
|
||||
<option name="localTasksCounter" value="377" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.History.Properties">
|
||||
|
@ -1405,10 +1428,6 @@
|
|||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<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: boxPickingPrepared refs #7855" />
|
||||
<MESSAGE value="feat: refactorResponse PasillerosItem refs #7827" />
|
||||
|
@ -1430,7 +1449,11 @@
|
|||
<MESSAGE value="feat: refs #7922 scanOrder" />
|
||||
<MESSAGE value="feat: refs #7920 itemShelvingGet" />
|
||||
<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 name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
|
@ -1443,6 +1466,14 @@
|
|||
</properties>
|
||||
<option name="timeStamp" value="11" />
|
||||
</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">
|
||||
<url>file://$PROJECT_DIR$/app/src/main/java/es/verdnatura/domain/SalixCallback.kt</url>
|
||||
<line>86</line>
|
||||
|
@ -1458,6 +1489,11 @@
|
|||
<line>87</line>
|
||||
<option name="timeStamp" value="14" />
|
||||
</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>
|
||||
</breakpoint-manager>
|
||||
<pin-to-top-manager>
|
||||
|
|
|
@ -5,6 +5,7 @@ plugins {
|
|||
id("com.google.gms.google-services")
|
||||
id("com.google.firebase.crashlytics")
|
||||
id("com.google.devtools.ksp")
|
||||
id("org.jetbrains.kotlin.plugin.compose")
|
||||
}
|
||||
|
||||
android {
|
||||
|
@ -15,8 +16,8 @@ android {
|
|||
applicationId = "es.verdnatura"
|
||||
minSdk = 26
|
||||
targetSdk = 33 // se deja con target si no Play Protect la bloquea
|
||||
versionCode = 374
|
||||
versionName = "24.51"
|
||||
versionCode = 397 //JAF 393 en informatica
|
||||
versionName = "25.6"
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
|
@ -59,7 +60,14 @@ android {
|
|||
}
|
||||
create("general") {}
|
||||
}
|
||||
kapt {
|
||||
correctErrorTypes = true
|
||||
useBuildCache = true
|
||||
|
||||
kotlinOptions {
|
||||
languageVersion = "1.9"
|
||||
}
|
||||
}
|
||||
buildFeatures {
|
||||
viewBinding = true
|
||||
//compose = true
|
||||
|
@ -76,6 +84,9 @@ android {
|
|||
}
|
||||
*/
|
||||
dataBinding = true
|
||||
|
||||
compose = true
|
||||
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
|
@ -102,7 +113,9 @@ android {
|
|||
implementation(libs.androidx.core.ktx)
|
||||
implementation(libs.androidx.recyclerview)
|
||||
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.kotlin.stdlib.jdk7)
|
||||
implementation(libs.androidx.appcompat)
|
||||
|
@ -133,15 +146,39 @@ android {
|
|||
implementation(libs.androidx.datastore.core)
|
||||
implementation(libs.zxing.android.embedded) { isTransitive = false }
|
||||
implementation(libs.core)
|
||||
//implementation(libs.koin.androidx.compose)
|
||||
|
||||
// Compose
|
||||
//implementation(libs.androidx.compose.bom)
|
||||
/* 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") */
|
||||
dependencies {
|
||||
|
||||
val composeBom = platform("androidx.compose:compose-bom:2024.10.01")
|
||||
implementation(composeBom)
|
||||
androidTestImplementation(composeBom)
|
||||
|
||||
// Choose one of the following:
|
||||
// Material Design 3
|
||||
implementation(libs.androidx.material3)
|
||||
implementation(libs.androidx.ui)
|
||||
// Android Studio Preview support
|
||||
implementation(libs.androidx.ui.tooling.preview)
|
||||
debugImplementation(libs.androidx.ui.tooling)
|
||||
// UI Tests
|
||||
androidTestImplementation(libs.androidx.ui.test.junit4)
|
||||
debugImplementation(libs.androidx.ui.test.manifest)
|
||||
// custom design system based on Foundation)
|
||||
//implementation(libs.androidx.material.icons.core)
|
||||
// Optional - Add full set of material icons
|
||||
implementation(libs.androidx.material.icons.extended)
|
||||
// Optional - Add window size utils
|
||||
implementation(libs.androidx.adaptive)
|
||||
implementation(libs.androidx.activity.compose)
|
||||
implementation(libs.androidx.lifecycle.viewmodel.compose)
|
||||
implementation(libs.lottie.compose)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
testImplementation(libs.junit)
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,12 @@
|
|||
android:name=".presentation.view.feature.articulo.fragment.ImageViewActivity"
|
||||
android:configChanges="orientation"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name=".presentation.composable.ImageViewActivityComposable"
|
||||
android:configChanges="orientation"
|
||||
android:exported="false"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".presentation.view.feature.restaurant.RestaurantActivity"
|
||||
android:configChanges="orientation"
|
||||
|
@ -69,6 +75,8 @@
|
|||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/file_paths" />
|
||||
</provider>
|
||||
|
||||
</application>
|
||||
|
||||
|
||||
</manifest>
|
|
@ -17,7 +17,9 @@ import es.verdnatura.domain.ConstAndValues.BASEURLLILIUM
|
|||
import es.verdnatura.domain.ConstAndValues.BASEURLSALIX
|
||||
import es.verdnatura.domain.ConstAndValues.BASE_URL_LILIUM
|
||||
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.ENTRYNUMBERIMAGES
|
||||
import es.verdnatura.domain.ConstAndValues.ENTRYOBSERVATIONORIGINAL
|
||||
import es.verdnatura.domain.ConstAndValues.ENTRYOBSERVATIONS
|
||||
import es.verdnatura.domain.ConstAndValues.ITEMPACKING
|
||||
|
@ -261,11 +263,13 @@ class DataStoreLocal(var mobileApplication: MobileApplication) {
|
|||
}
|
||||
|
||||
suspend fun deleteEntryPackaging() {
|
||||
mobileApplication.dataStoreApp.editDataStoreKey(ENTRYID, "")
|
||||
mobileApplication.dataStoreApp.editDataStoreKey(SUPPLIERID, "")
|
||||
mobileApplication.dataStoreApp.editDataStoreKey(ENTRYID, -1)
|
||||
mobileApplication.dataStoreApp.editDataStoreKey(SUPPLIERID, -1)
|
||||
mobileApplication.dataStoreApp.editDataStoreKey(SUPPLIERNAME, "")
|
||||
mobileApplication.dataStoreApp.editDataStoreKey(ENTRYOBSERVATIONORIGINAL, "")
|
||||
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.Insert
|
||||
import androidx.room.OnConflictStrategy
|
||||
import androidx.room.ProvidedTypeConverter
|
||||
import androidx.room.Query
|
||||
import androidx.room.Room
|
||||
import androidx.room.RoomDatabase
|
||||
|
@ -46,7 +47,10 @@ abstract class DeliveryDatabase : RoomDatabase() {
|
|||
return INSTANCE ?: synchronized(this) {
|
||||
val instance = Room.databaseBuilder(
|
||||
context.applicationContext, DeliveryDatabase::class.java, "expedition_database"
|
||||
).fallbackToDestructiveMigration().build()
|
||||
).fallbackToDestructiveMigration(true)
|
||||
.addTypeConverter(MapTypeConverter())
|
||||
.fallbackToDestructiveMigration(true)
|
||||
.build()
|
||||
INSTANCE = instance
|
||||
instance
|
||||
}
|
||||
|
@ -135,6 +139,7 @@ interface ClientTicketDao {
|
|||
|
||||
}
|
||||
|
||||
@ProvidedTypeConverter
|
||||
class MapTypeConverter {
|
||||
private val gson = Gson()
|
||||
|
||||
|
@ -182,13 +187,24 @@ class MapTypeConverter {
|
|||
}
|
||||
|
||||
@TypeConverter
|
||||
fun fromTickets(tickets: MutableList<Ticket?>): String? {
|
||||
fun fromTickets(tickets: MutableList<Ticket>): String? {
|
||||
return gson.toJson(tickets)
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
fun toTickets(json: String?): MutableList<Ticket?> {
|
||||
fun toTickets(json: String?): MutableList<Ticket> {
|
||||
val type = object : TypeToken<MutableList<Ticket>>() {}.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.boxPicking.BoxPickingViewModel
|
||||
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.category.ChangeCategoryViewModel
|
||||
import es.verdnatura.presentation.view.feature.claim.fragment.ubication.ClaimViewModel
|
||||
|
@ -14,9 +15,7 @@ import es.verdnatura.presentation.view.feature.controlvehiculo.fragment.ControlV
|
|||
import es.verdnatura.presentation.view.feature.delivery.viewmodels.DeliveryViewModel
|
||||
import es.verdnatura.presentation.view.feature.diadeventa.fragment.DayOfSaleViewModel
|
||||
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.historicovehiculo.fragment.HistoricoVehiculoViewModel
|
||||
import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryViewModel
|
||||
import es.verdnatura.presentation.view.feature.login.fragment.LoginViewModel
|
||||
import es.verdnatura.presentation.view.feature.packaging.fragment.SupplierViewModel
|
||||
|
@ -37,6 +36,7 @@ import es.verdnatura.presentation.view.feature.sacador.fragment.SacadorViewModel
|
|||
import es.verdnatura.presentation.view.feature.sacador.fragment.showticket.ShowTicketViewModel
|
||||
import es.verdnatura.presentation.view.feature.ticket.fragment.TicketViewModel
|
||||
import es.verdnatura.presentation.view.feature.ubicador.fragment.UbicadorViewModel
|
||||
import org.koin.android.ext.koin.androidApplication
|
||||
import org.koin.android.ext.koin.androidContext
|
||||
import org.koin.androidx.viewmodel.dsl.viewModel
|
||||
import org.koin.dsl.module
|
||||
|
@ -76,6 +76,10 @@ val viewModelModule = module {
|
|||
BuscarItemViewModel(androidContext())
|
||||
}
|
||||
|
||||
viewModel {
|
||||
BuscarItemComposeViewModel(androidApplication())
|
||||
}
|
||||
|
||||
// Pasilleros / Buscar Item 2
|
||||
|
||||
viewModel {
|
||||
|
@ -158,13 +162,6 @@ val viewModelModule = module {
|
|||
ControlVehiculoViewModel(androidContext())
|
||||
}
|
||||
|
||||
viewModel {
|
||||
HistoricoVehiculoViewModel(androidContext())
|
||||
}
|
||||
|
||||
viewModel {
|
||||
ItemShelvingLogViewModel(androidContext())
|
||||
}
|
||||
viewModel {
|
||||
ShelvingLogViewModel(androidContext())
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ object ConstAndValues {
|
|||
const val SUPPLIERID = "SUPPLIERID"
|
||||
const val SUPPLIERNAME = "SUPPLIERNAME"
|
||||
const val ENTRYID = "ENTRYID"
|
||||
const val COMPANYFK = "COMPANYFK"
|
||||
const val ENTRYOBSERVATIONORIGINAL = "ENTRYOBSERVATIONORIGINAL"
|
||||
const val ITEMPACKING = "itemPackingType"
|
||||
const val ITEMPACKINGFK = "itemPackingTypeFk"
|
||||
|
@ -70,6 +71,8 @@ object ConstAndValues {
|
|||
const val LIMITRECORDSSHELVINGLOG = 50
|
||||
const val RESERVATIONMODE = "operatorReservationMode"
|
||||
const val MODELWORKERTYPEACTIVITY = "APP"
|
||||
const val FLINGTHRESHOLDVELOCITY = 2000f
|
||||
const val FLINGTHRESHOLDVERTICAL = 500f
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
package es.verdnatura.domain
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.os.Build
|
||||
import android.text.Html
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import android.widget.EditText
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.RequiresApi
|
||||
import es.verdnatura.R
|
||||
import java.text.SimpleDateFormat
|
||||
import java.time.ZonedDateTime
|
||||
|
@ -30,7 +30,6 @@ fun List<Any?>.formatWithQuotes(): String {
|
|||
} + "]"
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
fun Any.toast(
|
||||
context: Context?,
|
||||
duration: Int = Toast.LENGTH_SHORT,
|
||||
|
@ -41,30 +40,37 @@ fun Any.toast(
|
|||
Html.fromHtml("<font color='$color' ><b>$this</b></font>", 0),
|
||||
duration
|
||||
)
|
||||
//toast2.setGravity(Gravity.TOP, 0, 0)
|
||||
toast.show()
|
||||
return toast.apply { show() }
|
||||
}
|
||||
|
||||
fun Context.showToastCenterWithBackground(textToShow: String) {
|
||||
val inflater = LayoutInflater.from(this)
|
||||
val layout = inflater.inflate(R.layout.ticket_toast_layout, null)
|
||||
val text = layout.findViewById<TextView>(R.id.toast_text)
|
||||
text.text = "$textToShow"
|
||||
text.setTextColor(this.getColor(R.color.verdnatura_orange_salix))
|
||||
text.textSize = 18f
|
||||
|
||||
val background = GradientDrawable().apply {
|
||||
setColor(Color.parseColor("#000000"))
|
||||
(this as? Activity)?.window?.decorView?.let { rootView ->
|
||||
TextView(this).apply {
|
||||
text = textToShow
|
||||
setTextColor(getColor(R.color.verdnatura_orange_salix))
|
||||
textSize = 22f
|
||||
gravity = Gravity.CENTER
|
||||
setPadding(32, 16, 32, 16)
|
||||
background = GradientDrawable().apply {
|
||||
setColor(Color.BLACK)
|
||||
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 {
|
||||
duration = Toast.LENGTH_LONG
|
||||
view = layout
|
||||
setGravity(Gravity.CENTER, 0, 0)
|
||||
show()
|
||||
(rootView as ViewGroup).addView(this)
|
||||
|
||||
animate().alpha(1f).setDuration(300).withEndAction {
|
||||
animate().alpha(0f).setStartDelay(1000).setDuration(300)
|
||||
.withEndAction { (rootView).removeView(this) }
|
||||
.start()
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,7 +101,6 @@ fun toDateString(date: Date): String {
|
|||
return format.format(date)
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
fun String?.isoToString(returnOnlyDate: Boolean = false): String {
|
||||
|
||||
return if (!this.isNullOrEmpty() && this.contains("T")) {
|
||||
|
|
|
@ -6,7 +6,6 @@ import com.google.gson.Gson
|
|||
import com.google.gson.JsonObject
|
||||
import es.verdnatura.MobileApplication
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
import es.verdnatura.presentation.view.feature.login.activity.LoginActivity
|
||||
import org.json.JSONObject
|
||||
import retrofit2.Call
|
||||
|
@ -96,3 +95,24 @@ abstract class SalixCallback<T>(val context: Context) : Callback<T> {
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
fun nameofFunction(function: Any): String {
|
||||
return try {
|
||||
function.javaClass.enclosingMethod!!.name + "->"
|
||||
} catch (e: Exception) {
|
||||
"ActivityMain->"
|
||||
}
|
||||
}
|
||||
|
||||
fun getMessageFromAllResponse(callFunction: String, responseMessage: String): String {
|
||||
|
||||
var messageFromError: String = try {
|
||||
val answerError = JSONObject(responseMessage)
|
||||
answerError.get("Message").toString()
|
||||
} catch (e: Exception) {
|
||||
responseMessage
|
||||
}
|
||||
|
||||
return "$messageFromError.\r${"Callback: $callFunction."}"
|
||||
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@ import es.verdnatura.presentation.common.ExpeditionPrintOut
|
|||
import es.verdnatura.presentation.common.ItemBarCodeSalix
|
||||
import es.verdnatura.presentation.common.ItemShelving
|
||||
import es.verdnatura.presentation.common.PackingSiteSalix
|
||||
import es.verdnatura.presentation.common.PickupResponse
|
||||
import es.verdnatura.presentation.common.SaleTrackingSalix
|
||||
import es.verdnatura.presentation.common.TicketPickupResponse
|
||||
import es.verdnatura.presentation.common.TicketState
|
||||
import es.verdnatura.presentation.view.feature.ajustes.model.Printers
|
||||
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.ItemPackingType
|
||||
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.BuyerVO
|
||||
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.diadeventa.model.ItemShelvingSaleDate
|
||||
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.historicovehiculo.model.ItemHistoricoVehiculo
|
||||
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventaryVO
|
||||
import es.verdnatura.presentation.view.feature.inventario.model.ItemInventoryParking
|
||||
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.VersionApp
|
||||
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.ItemSupplier
|
||||
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.sacador.model.CollectionTicket
|
||||
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.PlacementSupplyVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.TicketStateSalix
|
||||
|
@ -414,6 +414,11 @@ interface SalixService {
|
|||
fun collectionAssigned(
|
||||
): Call<Int>
|
||||
|
||||
@GET("ItemShelvings")
|
||||
fun itemShelvingsGet(
|
||||
@Query("filter") filter: String
|
||||
): Call<List<ItemShelvings>>
|
||||
|
||||
@POST("ItemShelvings/updateFromSale")
|
||||
fun itemShelvingUpdateFromSale(
|
||||
@Body params: Any
|
||||
|
@ -434,16 +439,6 @@ interface SalixService {
|
|||
@Body params: 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")
|
||||
fun saleTrackingUpdate(
|
||||
@Body params: Any
|
||||
|
@ -456,7 +451,7 @@ interface SalixService {
|
|||
|
||||
@GET("ItemShelvings/getAlternative")
|
||||
fun itemShelvingAlternative(
|
||||
@Query("shelvingFk") shelvingFk: String
|
||||
@Query("shelvingCode") shelvingFk: String
|
||||
): Call<ArrayList<Reubication>>
|
||||
|
||||
@GET("MobileAppVersionControls/getVersion")
|
||||
|
@ -480,11 +475,6 @@ interface SalixService {
|
|||
@Query("params") params: Any? = null, @Query("schema") schema: String = "vn"
|
||||
): 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")
|
||||
fun expeditionGetFromRoute(
|
||||
@Query("params") params: Any? = null, @Query("schema") schema: String = "vn"
|
||||
|
@ -530,18 +520,6 @@ interface SalixService {
|
|||
@Query("params") params: Any? = null, @Query("schema") schema: String = "vn"
|
||||
): 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")
|
||||
fun getItemsByReviewOrder(
|
||||
@Query("shelving") shelvingFkIn: Any,
|
||||
|
@ -564,11 +542,6 @@ interface SalixService {
|
|||
@Query("params") params: Any? = null, @Query("schema") schema: String = "vn"
|
||||
): 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")
|
||||
fun sectorCollectionGet(
|
||||
@Query("params") params: Any? = null, @Query("schema") schema: String = "vn"
|
||||
|
@ -637,12 +610,7 @@ interface SalixService {
|
|||
@GET("Tickets")
|
||||
fun ticketIsPickup(
|
||||
@Query("filter") filter: Any, @Query("schema") schema: String = "vn"
|
||||
): Call<List<PickupResponse>>
|
||||
|
||||
@POST("Applications/workerMachinery_isRegistered/execute-func")
|
||||
fun workerMachineryIsRegistered(
|
||||
@Query("params") params: Any, @Query("schema") schema: String = "vn"
|
||||
): Call<String>
|
||||
): Call<List<TicketPickupResponse>>
|
||||
|
||||
@POST("Applications/ticket_printLabelPrevious/execute-proc")
|
||||
fun ticketPrintLabelPrevious(
|
||||
|
@ -711,17 +679,6 @@ interface SalixService {
|
|||
@Query("params") params: 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")
|
||||
fun itemShelvingListNew(
|
||||
@Query("schema") schema: String = "vn",
|
||||
|
@ -960,6 +917,11 @@ interface SalixService {
|
|||
fun getWithPackaging(
|
||||
): Call<List<Supplier>>
|
||||
|
||||
@GET("DmsTypes/findOne")
|
||||
fun getDmsType(
|
||||
@Query("filter") filter: String
|
||||
): Call<DmsType>
|
||||
|
||||
@GET("Entries")
|
||||
fun getEntriesFromSupplier(
|
||||
@Query("filter") filter: String
|
||||
|
@ -1067,6 +1029,11 @@ interface SalixService {
|
|||
@Path("id") id: Number,
|
||||
): Call<JsonObject>
|
||||
|
||||
@GET("ItemShelvingSales")
|
||||
fun itemShelvingSaleTotalBySale(
|
||||
@Query("filter") filter: String,
|
||||
): Call<List<ItemShelvingSale>>
|
||||
|
||||
@PATCH("ItemShelvingSales/{id}")
|
||||
fun itemShelvingsReservedUpdate(
|
||||
@Path("id") id: Number, @Body params: Any
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package es.verdnatura.domain.userCases
|
||||
|
||||
import es.verdnatura.domain.SalixService
|
||||
import es.verdnatura.presentation.view.feature.packaging.model.NotificationQueue
|
||||
import retrofit2.Call
|
||||
|
||||
class GetItemFromBarcodeUseCase(private val salixService: SalixService) {
|
||||
|
@ -18,3 +19,9 @@ class GetItemPrintItemUseCase(private val salixService: SalixService) {
|
|||
return salixService.buyGetLastWithoutInventory(params)
|
||||
}
|
||||
}
|
||||
|
||||
class NotiticationUseCase(private val salixService: SalixService) {
|
||||
fun executeSendNotification(notificationQueue: NotificationQueue): Call<Void> {
|
||||
return salixService.notificationQueues(notificationQueue)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import es.verdnatura.MobileApplication
|
|||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.ToolbarFragmentBinding
|
||||
import es.verdnatura.db.DeliveryDatabase
|
||||
import es.verdnatura.db.MapTypeConverter
|
||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||
import kotlin.reflect.KClass
|
||||
|
@ -170,7 +171,8 @@ fun database(myContext: Context): DeliveryDatabase {
|
|||
return Room.databaseBuilder(
|
||||
myContext,
|
||||
DeliveryDatabase::class.java, "expediciones.db"
|
||||
).build()
|
||||
).addTypeConverter(MapTypeConverter())
|
||||
.build()
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ import androidx.lifecycle.LifecycleObserver
|
|||
import androidx.lifecycle.ViewModel
|
||||
import es.verdnatura.MobileApplication
|
||||
import es.verdnatura.domain.SalixService
|
||||
import org.json.JSONObject
|
||||
|
||||
abstract class BaseViewModel : ViewModel, LifecycleObserver {
|
||||
lateinit var app: MobileApplication
|
||||
|
@ -18,23 +17,3 @@ abstract class BaseViewModel : ViewModel, LifecycleObserver {
|
|||
}
|
||||
}
|
||||
|
||||
fun nameofFunction(function: Any): String {
|
||||
return try {
|
||||
function.javaClass.enclosingMethod!!.name + "->"
|
||||
} catch (e: Exception) {
|
||||
"ActivityMain->"
|
||||
}
|
||||
}
|
||||
|
||||
fun getMessageFromAllResponse(callFunction: String, responseMessage: String): String {
|
||||
|
||||
var messageFromError: String = try {
|
||||
val answerError = JSONObject(responseMessage)
|
||||
answerError.get("Message").toString()
|
||||
} catch (e: Exception) {
|
||||
responseMessage
|
||||
}
|
||||
|
||||
return "$messageFromError.\r${"Callback: $callFunction."}"
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package es.verdnatura.presentation.base
|
||||
|
||||
import android.app.Application
|
||||
import androidx.lifecycle.LifecycleObserver
|
||||
import androidx.lifecycle.ViewModel
|
||||
import es.verdnatura.MobileApplication
|
||||
import es.verdnatura.domain.SalixService
|
||||
|
||||
abstract class BaseViewModelCompose(application: Application) : ViewModel(), LifecycleObserver {
|
||||
protected val app: MobileApplication = application as MobileApplication
|
||||
protected val salix: SalixService = app.salix
|
||||
|
||||
}
|
|
@ -43,7 +43,10 @@ data class ItemShelving(
|
|||
var itemFk: Int,
|
||||
var shelvingFk: String,
|
||||
var position: Int,
|
||||
var quantity: Int
|
||||
var quantity: Int,
|
||||
var visible: Int? = null,
|
||||
var available: Int? = null
|
||||
|
||||
)
|
||||
|
||||
data class ItemShelvingSalix(
|
||||
|
@ -98,14 +101,8 @@ data class ExpeditionPrintOut(
|
|||
val isChecked: Boolean
|
||||
)
|
||||
|
||||
data class PickupResponse(
|
||||
val routeFk: Int,
|
||||
val route: Route?
|
||||
)
|
||||
|
||||
data class Route(
|
||||
data class TicketPickupResponse(
|
||||
val id: Int,
|
||||
val agencyModeFk: Int,
|
||||
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.ItemCardRowVO
|
||||
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.delivery.model.ClientTicketSalix
|
||||
import es.verdnatura.presentation.view.feature.delivery.model.ExpeditionInfoSummary
|
||||
|
@ -140,10 +139,6 @@ interface OnTrashItemRowClickListener {
|
|||
fun onTrashItemRowClickListener(item: WorkForms)
|
||||
}
|
||||
|
||||
interface OnLocationRowClickListener {
|
||||
fun onLocationRowClickListener(item: ItemLocationVO)
|
||||
}
|
||||
|
||||
interface OnInvetoryNichoClickListener {
|
||||
fun onInvetoryNichoClickListener(item: ItemInventaryVO)
|
||||
}
|
||||
|
@ -160,6 +155,10 @@ interface OnClientHistoricItemClickListener {
|
|||
fun onClientHistoricItemClickListener(item: ItemHistoricoVO)
|
||||
}
|
||||
|
||||
interface OnOutQuantityHistoricItemClickListener {
|
||||
fun onOutQuantityHistoricItemClickListener(item: ItemHistoricoVO)
|
||||
}
|
||||
|
||||
interface OnVisibleClickListener {
|
||||
fun onVisibleClickListener(item: ItemUbicadorVO)
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import android.os.Build
|
|||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.text.InputType
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.ViewTreeObserver
|
||||
|
@ -169,7 +168,7 @@ fun Context.hideKeyboard(view: View) {
|
|||
|
||||
fun Context.showKeyboard() {
|
||||
val imm = getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager?
|
||||
imm!!.toggleSoftInput(InputType.TYPE_CLASS_NUMBER, 0)
|
||||
imm!!.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0)
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.text.SimpleDateFormat
|
|||
import java.util.Calendar
|
||||
import java.util.Locale
|
||||
|
||||
class FunctionUtils{
|
||||
class FunctionUtils {
|
||||
fun getMessageFromJSON(json: String): String {
|
||||
val gson = Gson()
|
||||
var message = ""
|
||||
|
@ -38,9 +38,11 @@ class FunctionUtils{
|
|||
|
||||
private fun getCurdate(date: String, context: Context): String {
|
||||
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())
|
||||
c.time = df.parse(date)!!
|
||||
return df2.format(c.time)
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,220 @@
|
|||
package es.verdnatura.presentation.composable
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.wrapContentSize
|
||||
import androidx.compose.foundation.lazy.LazyRow
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.text.KeyboardActions
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.material3.HorizontalDivider
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.Switch
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextField
|
||||
import androidx.compose.material3.TextFieldDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Alignment.Companion.CenterVertically
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.focus.onFocusEvent
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
||||
import androidx.compose.ui.res.colorResource
|
||||
import androidx.compose.ui.res.dimensionResource
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.input.ImeAction
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import es.verdnatura.R
|
||||
|
||||
@Composable
|
||||
fun CustomToolbar(
|
||||
title: String,
|
||||
subtitle: String? = null,
|
||||
showBackButton: Boolean = true,
|
||||
showSwitch: Boolean = false,
|
||||
iconList: List<Int> = emptyList(),
|
||||
onBackClick: () -> Unit = {},
|
||||
onSwitchChange: (Boolean) -> Unit = {}
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.background(Color.Black)
|
||||
) {
|
||||
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(56.dp),
|
||||
verticalAlignment = CenterVertically,
|
||||
|
||||
) {
|
||||
if (showBackButton) {
|
||||
IconButton(
|
||||
onClick = { onBackClick() },
|
||||
modifier = Modifier.padding(start = 0.dp),
|
||||
) {
|
||||
Icon(
|
||||
painter = painterResource(id = R.drawable.ic_chevron_left),
|
||||
contentDescription = "Back",
|
||||
tint = Color.White
|
||||
)
|
||||
}
|
||||
}
|
||||
Text(
|
||||
text = title,
|
||||
color = Color.White,
|
||||
fontSize = dimensionResource(id = R.dimen.title).value.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
|
||||
)
|
||||
|
||||
if (!subtitle.isNullOrEmpty()) {
|
||||
Text(
|
||||
modifier = Modifier.weight(1f),
|
||||
text = subtitle,
|
||||
color = Color.White.copy(alpha = 0.7f),
|
||||
fontSize = dimensionResource(id = R.dimen.subtitle).value.sp
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (iconList.isNotEmpty()) {
|
||||
LazyRow {
|
||||
items(iconList) { iconRes ->
|
||||
IconButton(onClick = { /* Acción del icono */ }) {
|
||||
Icon(
|
||||
painter = painterResource(id = iconRes),
|
||||
contentDescription = "Icon",
|
||||
tint = Color.White
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (showSwitch) {
|
||||
var switchState by remember { mutableStateOf(false) }
|
||||
Switch(
|
||||
checked = switchState,
|
||||
onCheckedChange = {
|
||||
switchState = it
|
||||
onSwitchChange(it)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
HorizontalDivider(
|
||||
thickness = 1.dp,
|
||||
color = colorResource(id = R.color.verdnatura_brown_grey)
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun ScanLineTextSearch(
|
||||
value: String,
|
||||
onValueChange: (String) -> Unit,
|
||||
onImeAction: () -> Unit,
|
||||
modifier: Modifier = Modifier.wrapContentSize(),
|
||||
) {
|
||||
|
||||
val keyboardController = LocalSoftwareKeyboardController.current
|
||||
|
||||
Box(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
TextField(
|
||||
value = value,
|
||||
onValueChange = onValueChange,
|
||||
textStyle = TextStyle(
|
||||
color = Color.White,
|
||||
textAlign = TextAlign.Center
|
||||
),
|
||||
placeholder = {
|
||||
Text(
|
||||
text = stringResource(id = R.string.Escaneaetiqueta),
|
||||
textAlign = TextAlign.Center,
|
||||
color = Color.White,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
},
|
||||
singleLine = true,
|
||||
keyboardActions = KeyboardActions(
|
||||
onDone = {
|
||||
onImeAction()
|
||||
}
|
||||
|
||||
),
|
||||
keyboardOptions = KeyboardOptions.Default.copy(
|
||||
imeAction = ImeAction.Done
|
||||
),
|
||||
colors = TextFieldDefaults.colors(
|
||||
focusedContainerColor = Color.DarkGray, // Fondo cuando está enfocado
|
||||
unfocusedContainerColor = Color.DarkGray, // Fondo cuando NO está enfocado
|
||||
cursorColor = Color.White, // Color del cursor
|
||||
focusedTextColor = Color.White, // Color del texto cuando está enfocado
|
||||
unfocusedTextColor = Color.White, // Color del texto cuando NO está enfocado
|
||||
focusedPlaceholderColor = Color.Black, // Color del placeholder cuando está enfocado
|
||||
unfocusedPlaceholderColor = Color.Black // Color del placeholder cuando NO está enfocado
|
||||
),
|
||||
modifier = modifier
|
||||
.fillMaxWidth(fraction = 0.67f)
|
||||
.border(2.dp, Color.White, RoundedCornerShape(8.dp))
|
||||
.height(54.dp)
|
||||
.padding(bottom = 4.dp)
|
||||
.onFocusEvent {
|
||||
if (it.isFocused) {
|
||||
keyboardController?.hide()
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
fun PreviewToolbar() {
|
||||
CustomToolbar(
|
||||
title = "Mi Toolbar",
|
||||
subtitle = "10/20",
|
||||
showBackButton = true,
|
||||
showSwitch = true,
|
||||
iconList = listOf(R.drawable.ic_launcher_foreground, R.drawable.ic_launcher_foreground),
|
||||
onBackClick = { /* Acción de volver atrás */ },
|
||||
onSwitchChange = { /* Acción del switch */ }
|
||||
)
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
fun PreviewScanLineTextSearch() {
|
||||
ScanLineTextSearch(
|
||||
value = "Escanea etiqueta",
|
||||
onValueChange = {},
|
||||
onImeAction = {})
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package es.verdnatura.presentation.composable
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.activity.compose.setContent
|
||||
import es.verdnatura.R
|
||||
|
||||
class ImageViewActivityComposable : ComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContent {
|
||||
val imageUrl = intent.getStringExtra(getString(R.string.url)) ?: ""
|
||||
val title = intent.getStringExtra(getString(R.string.title)) ?: ""
|
||||
ImageViewScreen(imageUrl = imageUrl, titleToolBar = title, onBackClick = { finish() })
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package es.verdnatura.presentation.composable
|
||||
|
||||
import android.widget.ImageView
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.bumptech.glide.Glide
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun ImageViewScreen(imageUrl: String, titleToolBar:String ="",onBackClick: () -> Unit ) {
|
||||
|
||||
CustomToolbar(
|
||||
title = titleToolBar,
|
||||
subtitle = "",
|
||||
showBackButton = true,
|
||||
showSwitch = false,
|
||||
iconList = listOf(),
|
||||
onBackClick = onBackClick ,
|
||||
onSwitchChange = { }
|
||||
)
|
||||
Column(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.Top
|
||||
) {
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
GlideImage(imageUrl = imageUrl)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun GlideImage(imageUrl: String) {
|
||||
androidx.compose.ui.viewinterop.AndroidView(
|
||||
factory = { context ->
|
||||
ImageView(context).apply {
|
||||
Glide.with(context)
|
||||
.load(imageUrl)
|
||||
.into(this)
|
||||
}
|
||||
},
|
||||
modifier = Modifier.fillMaxSize()
|
||||
)
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun DefaultPreview() {
|
||||
ImageViewScreen(imageUrl = "https://example.com/image.jpg", "titleToolbar") {}
|
||||
}
|
|
@ -1,14 +1,11 @@
|
|||
package es.verdnatura.presentation.view.commom
|
||||
package es.verdnatura.presentation.view.commom.webview
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.os.Bundle
|
||||
import android.print.PrintAttributes
|
||||
import android.print.PrintManager
|
||||
import android.view.GestureDetector
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MotionEvent
|
||||
import android.view.VelocityTracker
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.webkit.WebChromeClient
|
||||
|
@ -18,12 +15,13 @@ import android.webkit.WebViewClient
|
|||
import android.widget.ImageView
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.activity.OnBackPressedDispatcher
|
||||
import androidx.core.view.GestureDetectorCompat
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import es.verdnatura.R
|
||||
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.OnOptionsSelectedListener
|
||||
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
||||
|
@ -32,15 +30,14 @@ import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
|||
import org.json.JSONObject
|
||||
import kotlin.math.abs
|
||||
|
||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||
class WebFragment(
|
||||
var entryPoint: String = ""
|
||||
) : Fragment(), OnBackPressedListener {
|
||||
private lateinit var gestureDetector: GestureDetectorCompat
|
||||
fun getLayoutId(): Int = R.layout.fragment_web
|
||||
private lateinit var customDialog: CustomDialog
|
||||
private lateinit var backDispatcher: OnBackPressedDispatcher
|
||||
private lateinit var binding: FragmentWebBinding
|
||||
private var velocityTracker: VelocityTracker? = null
|
||||
|
||||
companion object {
|
||||
fun newInstance(entryPoint: String) = WebFragment(entryPoint)
|
||||
|
@ -50,12 +47,11 @@ class WebFragment(
|
|||
customDialog = CustomDialog(requireContext())
|
||||
setToolbar()
|
||||
setWeb()
|
||||
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||
): View? {
|
||||
): View {
|
||||
binding = DataBindingUtil.inflate(inflater, R.layout.fragment_web, container, false)
|
||||
binding.lifecycleOwner = this
|
||||
return binding.root
|
||||
|
@ -63,7 +59,6 @@ class WebFragment(
|
|||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
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()
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility", "SetJavaScriptEnabled")
|
||||
@SuppressLint("ClickableViewAccessibility", "javaScriptEnabled")
|
||||
private fun setWeb() {
|
||||
binding.webView.apply {
|
||||
webChromeClient = WebChromeClient()
|
||||
|
||||
binding.webView.webChromeClient = WebChromeClient(
|
||||
|
||||
)
|
||||
|
||||
val webSettings = binding.webView.settings
|
||||
webSettings.javaScriptEnabled = true
|
||||
webSettings.domStorageEnabled = true
|
||||
webSettings.loadWithOverviewMode = true
|
||||
webSettings.useWideViewPort = true
|
||||
webSettings.builtInZoomControls = true
|
||||
webSettings.displayZoomControls = false
|
||||
webSettings.setSupportZoom(true)
|
||||
webSettings.allowFileAccess = true
|
||||
|
||||
binding.webView.setOnTouchListener { v, event ->
|
||||
gestureDetector.onTouchEvent(event)
|
||||
settings.apply {
|
||||
javaScriptEnabled = true
|
||||
domStorageEnabled = true
|
||||
loadWithOverviewMode = true
|
||||
useWideViewPort = true
|
||||
builtInZoomControls = true
|
||||
displayZoomControls = false
|
||||
setSupportZoom(true)
|
||||
allowFileAccess = true
|
||||
}
|
||||
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(
|
||||
view: WebView?, request: WebResourceRequest?
|
||||
view: WebView?,
|
||||
request: WebResourceRequest?
|
||||
): Boolean {
|
||||
binding.webView.loadUrl(request?.url.toString())
|
||||
request?.url?.toString()?.let { loadUrl(it) }
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun setToolbar() {
|
||||
|
||||
binding.mainToolbar.toolbarTitle.text = buildString {
|
||||
append(getString(R.string.item))
|
||||
append(JSONObject(entryPoint).get("entryPoint").toString())
|
||||
}
|
||||
|
||||
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 =
|
||||
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
|
||||
override fun onOptionsItemSelected(item: Drawable) {
|
||||
|
||||
when (item) {
|
||||
iconPrint.drawable -> createWebPrintJob(binding.webView)
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
binding.mainToolbar.toolbarIcons.layoutManager =
|
||||
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 {
|
||||
|
||||
if (binding.webView.canGoBack()) {
|
||||
binding.webView.goBack()
|
||||
} else {
|
||||
(context as MainActivity).onMyBackPressed()
|
||||
}
|
||||
|
||||
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() {
|
||||
binding.customDialogValue.requestFocus()
|
||||
}
|
||||
|
||||
fun setFocusTextTwo() {
|
||||
binding.customDialogValueTwo.requestFocus()
|
||||
}
|
||||
|
||||
fun plusTextButton(view: View) {
|
||||
private fun plusTextButton(view: View) {
|
||||
|
||||
var sum = 0
|
||||
try {
|
||||
sum = getValue().toInt() + Integer.parseInt(view.tag.toString())
|
||||
val sum = getValue().toInt() + Integer.parseInt(view.tag.toString())
|
||||
setValue(sum.toString())
|
||||
} catch (ex: Exception) {
|
||||
setValue(view.tag.toString())
|
||||
|
|
|
@ -69,6 +69,12 @@ class CustomDialogList(context: Context) : Dialog(context, R.style.DialogTheme)
|
|||
return this
|
||||
}
|
||||
|
||||
fun setTitleSpannable(title: CharSequence): CustomDialogList {
|
||||
binding.customDialogTitle.visibility = View.VISIBLE
|
||||
binding.customDialogTitle.text = title
|
||||
return this
|
||||
}
|
||||
|
||||
fun setDescription(title: String): CustomDialogList {
|
||||
binding.customDialogDescription.visibility = View.VISIBLE
|
||||
binding.customDialogDescription.text = title
|
||||
|
@ -148,4 +154,9 @@ class CustomDialogList(context: Context) : Dialog(context, R.style.DialogTheme)
|
|||
fun getFocusThree() {
|
||||
binding.customDialogValueThree.requestFocus()
|
||||
}
|
||||
|
||||
fun setTextSize(size: Float): CustomDialogList {
|
||||
binding.customDialogValue.textSize = size
|
||||
return this
|
||||
}
|
||||
}
|
|
@ -1,12 +1,15 @@
|
|||
package es.verdnatura.presentation.view.feature.ajustes.fragment
|
||||
|
||||
import android.app.AlertDialog
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageInfo
|
||||
import android.content.pm.PackageManager
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ArrayAdapter
|
||||
|
@ -42,6 +45,7 @@ import es.verdnatura.presentation.view.feature.ajustes.model.SectorItemVO
|
|||
import es.verdnatura.presentation.view.feature.ajustes.model.Train
|
||||
import es.verdnatura.presentation.view.feature.articulo.model.ItemPackingType
|
||||
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.model.CodeWorkerAction
|
||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||
|
@ -128,13 +132,24 @@ class AjustesFragment :
|
|||
private fun setToolBar() {
|
||||
|
||||
val listIcons: ArrayList<ImageView> = ArrayList()
|
||||
|
||||
val iconInfo = ImageView(context)
|
||||
iconInfo.setImageResource(R.drawable.ic_info_delivery)
|
||||
|
||||
val iconLogout = ImageView(context)
|
||||
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(iconLogout)
|
||||
// listIcons.add(iconPhone)
|
||||
// listIcons.add(iconSettings)
|
||||
|
||||
binding.mainToolbar.toolbarIcons.adapter =
|
||||
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
|
||||
override fun onOptionsItemSelected(item: Drawable) {
|
||||
|
@ -165,8 +180,53 @@ class AjustesFragment :
|
|||
}
|
||||
|
||||
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()
|
||||
}
|
||||
|
||||
iconSettings.drawable -> {
|
||||
println("test incoming warehouse opening")
|
||||
val intent = Intent()
|
||||
intent.setClassName(
|
||||
"org.linphone.incomingcall",
|
||||
"org.linphone.incomingcall.IncomingCallActivity"
|
||||
)
|
||||
intent.putExtra("server", "pbx.verdnatura.es")
|
||||
intent.putExtra("username", "1007")
|
||||
intent.putExtra("password", "delatorre.1234")
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
startActivity(intent)
|
||||
|
||||
Handler(Looper.getMainLooper()).postDelayed({
|
||||
val intentIncoming =
|
||||
Intent(requireContext(), MainActivity::class.java)
|
||||
intentIncoming.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
|
||||
startActivity(intentIncoming)
|
||||
}, 2000)
|
||||
}
|
||||
|
||||
iconPhone.drawable -> {
|
||||
println("test incoming warehouse calling")
|
||||
val intentIncoming =
|
||||
Intent(requireContext(), MainActivity::class.java)
|
||||
intentIncoming.putExtra(
|
||||
"phoneNumber",
|
||||
"sip:651353889@pbx.verdnatura.es"
|
||||
)
|
||||
/* intentIncoming.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
|
||||
startActivity(intentIncoming)*/
|
||||
val intent = Intent("org.linphone.CALLING")
|
||||
intent.putExtra("server", "pbx.verdnatura.es")
|
||||
intent.putExtra("username", "1007")
|
||||
intent.putExtra("password", "delatorre.1234")
|
||||
intent.putExtra("phoneNumber", "sip:651353889@pbx.verdnatura.es")
|
||||
requireContext().sendBroadcast(intent)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -6,26 +6,21 @@ import es.verdnatura.domain.toast
|
|||
import es.verdnatura.presentation.base.BaseActivity
|
||||
import es.verdnatura.presentation.common.loadUrl
|
||||
|
||||
class ImageViewActivity : BaseActivity<ActivityImageviewBinding>(){
|
||||
class ImageViewActivity : BaseActivity<ActivityImageviewBinding>() {
|
||||
|
||||
override fun getLayoutId(): Int = R.layout.activity_imageview
|
||||
|
||||
|
||||
override fun init() {
|
||||
binding.mainToolbar.toolbarTitle.text = intent.getStringExtra(getString(R.string.title))
|
||||
try {
|
||||
binding.imgView.loadUrl(intent.getStringExtra(getString(R.string.url))!!)
|
||||
}catch(ex:Exception){
|
||||
} catch (ex: Exception) {
|
||||
getString(R.string.errorImage).toast(this)
|
||||
finish()
|
||||
}
|
||||
|
||||
|
||||
binding.mainToolbar.backButton.setOnClickListener {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
|||
import es.verdnatura.presentation.common.hideKeyboard
|
||||
import es.verdnatura.presentation.common.itemScanValue
|
||||
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.CustomDialogInput
|
||||
import es.verdnatura.presentation.view.component.CustomDialogList
|
||||
|
@ -272,7 +273,9 @@ class ItemCardFragment(
|
|||
}
|
||||
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.title), titleImage)
|
||||
startActivity(i)
|
||||
|
|
|
@ -2,41 +2,52 @@ package es.verdnatura.presentation.view.feature.buscaritem.adapter
|
|||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.ItemLocationRowBinding
|
||||
import es.verdnatura.domain.toast
|
||||
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
|
||||
|
||||
class LocationAdapter (
|
||||
private val items: List<ItemLocationVO>,
|
||||
class LocationAdapter(
|
||||
private val items: List<ItemShelvings>,
|
||||
private val onPasillerosItemClickListener: OnPasillerosItemClickListener
|
||||
): RecyclerView.Adapter<LocationAdapter.ItemHolder> () {
|
||||
|
||||
) : RecyclerView.Adapter<LocationAdapter.ItemHolder>() {
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
|
||||
return ItemHolder(
|
||||
ItemLocationRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
|
||||
ItemLocationRowBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
)
|
||||
}
|
||||
|
||||
override fun getItemCount() =items.size
|
||||
override fun getItemCount() = items.size
|
||||
|
||||
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
|
||||
holder.bind(items[position])
|
||||
holder.binding.root.setOnClickListener {
|
||||
onPasillerosItemClickListener.onPasillerosItemClickListener(PasillerosItemVO(title =
|
||||
R.string.titleUbicator),items[position].Matricula)
|
||||
onPasillerosItemClickListener.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(
|
||||
title =
|
||||
R.string.titleUbicator
|
||||
), items[position].shelving.code
|
||||
)
|
||||
}
|
||||
holder.binding.root.setOnLongClickListener {
|
||||
items[position].shelving.parking.sector.description.toast(
|
||||
holder.binding.root.context,
|
||||
Toast.LENGTH_SHORT
|
||||
)
|
||||
true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ItemHolder(
|
||||
val binding: ItemLocationRowBinding
|
||||
) : RecyclerView.ViewHolder(binding.root){
|
||||
//private val res = binding.root.context.resources
|
||||
fun bind(item: ItemLocationVO) {
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
fun bind(item: ItemShelvings) {
|
||||
binding.apply {
|
||||
this.item = item
|
||||
}
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
package es.verdnatura.presentation.view.feature.buscaritem.fragment
|
||||
|
||||
import es.verdnatura.domain.SalixCallback
|
||||
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
||||
import es.verdnatura.presentation.base.BaseViewModelCompose
|
||||
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemShelvings
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.flow.update
|
||||
import retrofit2.Response
|
||||
|
||||
data class UiState(
|
||||
val itemFk: String? = null,
|
||||
val items: List<ItemShelvings> = emptyList()
|
||||
)
|
||||
|
||||
class BuscarItemComposeViewModel(var application: android.app.Application) :
|
||||
BaseViewModelCompose(application) {
|
||||
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
|
||||
|
||||
private val _uiState = MutableStateFlow(UiState())
|
||||
val uiState = _uiState.asStateFlow()
|
||||
|
||||
/* private val _itemFk = MutableStateFlow<String?>(null)
|
||||
val itemFk = _itemFk.asStateFlow()*/
|
||||
|
||||
/* private val _itemShelvingsList = MutableStateFlow<ItemShelvingsList?>(null)
|
||||
val itemShelvingsList = _itemShelvingsList.asStateFlow()*/
|
||||
|
||||
/*val loadItemShelvingsList = _itemShelvingsList.map {
|
||||
it?.let { Event(it) }
|
||||
}.stateIn(
|
||||
scope = viewModelScope,
|
||||
started = SharingStarted.WhileSubscribed(5000),
|
||||
initialValue = null
|
||||
)*/
|
||||
|
||||
fun getIdFromCodeSalix(code: String) {
|
||||
_uiState.update { it.copy(itemFk = code) }
|
||||
//_itemFk.value = code
|
||||
getItemFromBarcodeUseCase.execute(code)
|
||||
.enqueue(object : SalixCallback<Int?>(application.applicationContext) {
|
||||
override fun onSuccess(response: Response<Int?>) {
|
||||
response.body()?.let { id ->
|
||||
itemshelvingsGet(id)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun itemshelvingsGet(itemFk: Any) {
|
||||
salix.itemShelvingsGet(
|
||||
filter = """{"where":{"itemFk":$itemFk},"fields":["created","visible","available","shelvingFk"],
|
||||
|"include":[{"relation":"shelving","scope":{"fields":["code","priority","parkingFk"],
|
||||
|"include":{"relation":"parking","scope":{"fields":["code","sectorFk"]}}}}]}""".trimMargin()
|
||||
)
|
||||
.enqueue(object : SalixCallback<List<ItemShelvings>>(application.applicationContext) {
|
||||
override fun onSuccess(response: Response<List<ItemShelvings>>) {
|
||||
response.body()?.let { list ->
|
||||
//_itemShelvingsList.value = ItemShelvingsList(list)
|
||||
_uiState.update { it.copy(items = list) }
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
|
@ -10,6 +10,7 @@ import es.verdnatura.presentation.base.BaseFragment
|
|||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||
import es.verdnatura.presentation.common.itemScanValue
|
||||
import es.verdnatura.presentation.view.feature.buscaritem.adapter.LocationAdapter
|
||||
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemShelvings
|
||||
|
||||
class BuscarItemFragment(
|
||||
var itemFk: Any? = null
|
||||
|
@ -30,10 +31,10 @@ class BuscarItemFragment(
|
|||
override fun getLayoutId(): Int = R.layout.fragment_buscar_item
|
||||
|
||||
override fun init() {
|
||||
binding.mainToolbar.toolbarTitle.text = getString(R.string.getubicaition)
|
||||
binding.mainToolbar.toolbarTitle.text = getString(R.string.getubication)
|
||||
setEvents()
|
||||
if (itemFk != null) {
|
||||
getLocations(itemFk!!)
|
||||
viewModel.getIdFromCodeSalix(itemFk!!.toString())
|
||||
}
|
||||
super.init()
|
||||
}
|
||||
|
@ -66,17 +67,22 @@ class BuscarItemFragment(
|
|||
|
||||
private fun getLocations(itemFk: Any) {
|
||||
this.itemFk = itemFk
|
||||
viewModel.itemshelvingGetInfo(itemFk)
|
||||
viewModel.getIdFromCodeSalix(itemFk.toString())
|
||||
}
|
||||
|
||||
override fun observeViewModel() {
|
||||
with(viewModel) {
|
||||
loadLocationList.observe(viewLifecycleOwner) { event ->
|
||||
|
||||
loadItemShelvingsList.observe(viewLifecycleOwner) { event ->
|
||||
|
||||
event.getContentIfNotHandled().notNull { itemResponse ->
|
||||
|
||||
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.layoutManager =
|
||||
LinearLayoutManager(
|
||||
|
|
|
@ -0,0 +1,118 @@
|
|||
package es.verdnatura.presentation.view.feature.buscaritem.fragment
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.platform.ComposeView
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.domain.toast
|
||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||
import es.verdnatura.presentation.view.feature.main.activity.MainActivity
|
||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||
|
||||
class BuscarItemFragmentCompose(
|
||||
var itemFk: Any? = null
|
||||
) : Fragment() {
|
||||
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
|
||||
private val viewModel: BuscarItemComposeViewModel by viewModel()
|
||||
|
||||
companion object {
|
||||
fun newInstance(entryPoint: Int?) = BuscarItemFragmentCompose(entryPoint)
|
||||
}
|
||||
|
||||
override fun onAttach(context: Context) {
|
||||
super.onAttach(context)
|
||||
|
||||
if (context is OnPasillerosItemClickListener) pasillerosItemClickListener = context
|
||||
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||
): View {
|
||||
return ComposeView(requireContext()).apply {
|
||||
setContent {
|
||||
SetView()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
itemFk?.let {
|
||||
viewModel.getIdFromCodeSalix(it.toString())
|
||||
}
|
||||
}
|
||||
|
||||
private fun showSector(item: LocationItem) {
|
||||
item.sector.toast(requireContext())
|
||||
|
||||
}
|
||||
|
||||
private fun openUbicadorFragment(item: LocationItem) {
|
||||
pasillerosItemClickListener!!.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(
|
||||
title =
|
||||
R.string.titleUbicator
|
||||
), item.matricula
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun SetView() {
|
||||
val uiState by viewModel.uiState.collectAsStateWithLifecycle()
|
||||
|
||||
LocationScreen(
|
||||
items = uiState.items.map {
|
||||
LocationItem(
|
||||
parking = it.shelving.parking.code,
|
||||
matricula = it.shelving.code,
|
||||
visible = it.visible.toString(),
|
||||
reserve = it.available.toString(),
|
||||
priority = it.shelving.priority.toString(),
|
||||
fecha = it.created,
|
||||
sector = it.shelving.parking.sector.description
|
||||
)
|
||||
},
|
||||
onTextChange = { input ->
|
||||
viewModel.getIdFromCodeSalix(input)
|
||||
},
|
||||
titleToolBar = if (uiState.items.isNotEmpty()) {
|
||||
getString(
|
||||
R.string.itemsTotal,
|
||||
uiState.itemFk,
|
||||
getString(R.string.visibleTotal),
|
||||
uiState.items.sumOf { it.visible }
|
||||
)
|
||||
} else getString(R.string.getubication),
|
||||
onBackClick = { (context as MainActivity).onMyBackPressed() },
|
||||
onLongClick = { item -> item.sector.toast(requireContext()) },
|
||||
onClick = { item ->
|
||||
pasillerosItemClickListener?.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(title = R.string.titleUbicator),
|
||||
item.matricula
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
class BuscarItemViewModelFactory(private val context: Application) : ViewModelProvider.Factory {
|
||||
override fun <T : ViewModel> create(modelClass: Class<T>): T {
|
||||
if (modelClass.isAssignableFrom(BuscarItemComposeViewModel::class.java)) {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return BuscarItemComposeViewModel(context) as T
|
||||
}
|
||||
throw IllegalArgumentException("Unknown ViewModel class")
|
||||
}
|
||||
}*/
|
|
@ -5,24 +5,44 @@ import androidx.lifecycle.LiveData
|
|||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.map
|
||||
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.common.Event
|
||||
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemLocationVO
|
||||
import es.verdnatura.presentation.view.feature.buscaritem.model.LocationListVO
|
||||
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemShelvings
|
||||
import es.verdnatura.presentation.view.feature.buscaritem.model.ItemShelvingsList
|
||||
import retrofit2.Response
|
||||
|
||||
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) {
|
||||
salix.itemshelvingGetInfo(params = arrayListOf(itemFk).formatWithQuotes())
|
||||
.enqueue(object : SalixCallback<List<ItemLocationVO>>(context) {
|
||||
override fun onSuccess(response: Response<List<ItemLocationVO>>) {
|
||||
_locationList.value = response.body()?.let { LocationListVO(it) }
|
||||
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
|
||||
|
||||
private val _itemShelvingsList by lazy { MutableLiveData<ItemShelvingsList>() }
|
||||
val itemShelvingsList: LiveData<ItemShelvingsList> = _itemShelvingsList
|
||||
val loadItemShelvingsList: LiveData<Event<ItemShelvingsList>> =
|
||||
_itemShelvingsList.map { Event(it) }
|
||||
|
||||
fun getIdFromCodeSalix(code: String) {
|
||||
getItemFromBarcodeUseCase.execute(code)
|
||||
.enqueue(object : SalixCallback<Int?>(context) {
|
||||
|
||||
override fun onSuccess(response: Response<Int?>) {
|
||||
if (response.body() != null) {
|
||||
itemshelvingsGet(response.body()!!)
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun itemshelvingsGet(itemFk: Any) {
|
||||
salix.itemShelvingsGet(
|
||||
filter = """{"where":{"itemFk":$itemFk},"fields":["created","visible","available","shelvingFk"],
|
||||
|"include":[{"relation":"shelving","scope":{"fields":["code","priority","parkingFk"],
|
||||
|"include":{"relation":"parking","scope":{"fields":["code","sectorFk"]}}}}]}""".trimMargin()
|
||||
)
|
||||
.enqueue(object : SalixCallback<List<ItemShelvings>>(context) {
|
||||
override fun onSuccess(response: Response<List<ItemShelvings>>) {
|
||||
_itemShelvingsList.value = response.body()?.let { ItemShelvingsList(it) }
|
||||
}
|
||||
|
||||
})
|
||||
|
|
|
@ -0,0 +1,207 @@
|
|||
package es.verdnatura.presentation.view.feature.buscaritem.fragment
|
||||
|
||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.combinedClickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.material3.HorizontalDivider
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.focus.FocusRequester
|
||||
import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.ui.focus.onFocusEvent
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.presentation.composable.CustomToolbar
|
||||
import es.verdnatura.presentation.composable.ScanLineTextSearch
|
||||
|
||||
@Composable
|
||||
fun LocationScreen(
|
||||
//viewModel: BuscarItemComposeViewModel = viewModel(), // Falta ver de arreglar con koin o viewmodel → No necesario, en el Fragment observa
|
||||
items: List<LocationItem>,
|
||||
onTextChange: (String) -> Unit,
|
||||
titleToolBar: String,
|
||||
onBackClick: () -> Unit = {},
|
||||
modifier: Modifier = Modifier,
|
||||
onLongClick: (LocationItem) -> Unit,
|
||||
onClick: (LocationItem) -> Unit
|
||||
) {
|
||||
var searchText by remember { mutableStateOf("") }
|
||||
val focusRequester = remember { FocusRequester() }
|
||||
val keyboardController = LocalSoftwareKeyboardController.current
|
||||
var showLoading by remember { mutableStateOf(false) }
|
||||
|
||||
val onImeAction: () -> Unit = {
|
||||
onTextChange(searchText)
|
||||
searchText = ""
|
||||
keyboardController?.hide()
|
||||
}
|
||||
Box(
|
||||
modifier = modifier
|
||||
.fillMaxSize()
|
||||
.background(Color.Black)
|
||||
) {
|
||||
Column(
|
||||
modifier = modifier
|
||||
.fillMaxSize()
|
||||
.background(Color.Black)
|
||||
|
||||
) {
|
||||
if (showLoading) {
|
||||
LottieLoadingAnimation(true)
|
||||
}
|
||||
CustomToolbar(
|
||||
title = titleToolBar,
|
||||
subtitle = "",
|
||||
showBackButton = true,
|
||||
showSwitch = false,
|
||||
iconList = listOf(),
|
||||
onBackClick = onBackClick,
|
||||
onSwitchChange = { },
|
||||
|
||||
)
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
|
||||
|
||||
ScanLineTextSearch(
|
||||
value = searchText,
|
||||
onValueChange = {
|
||||
searchText = it
|
||||
showLoading = true
|
||||
},
|
||||
onImeAction,
|
||||
modifier = Modifier
|
||||
.focusRequester(focusRequester)
|
||||
.onFocusEvent {
|
||||
if (it.isFocused) {
|
||||
keyboardController?.hide() // Asegura que el teclado no se abra
|
||||
}
|
||||
}
|
||||
)
|
||||
LaunchedEffect(Unit) {
|
||||
focusRequester.requestFocus()
|
||||
keyboardController?.hide()
|
||||
}
|
||||
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 8.dp),
|
||||
horizontalArrangement = Arrangement.Start
|
||||
) {
|
||||
listOf(
|
||||
R.string.parking,
|
||||
R.string.Matrícula,
|
||||
R.string.Visible,
|
||||
R.string.reserve,
|
||||
R.string.priority,
|
||||
R.string.Fecha
|
||||
).forEach { textRes ->
|
||||
Text(
|
||||
text = stringResource(id = textRes),
|
||||
color = Color.White,
|
||||
fontSize = 14.sp,
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
HorizontalDivider(thickness = 1.dp, color = Color.White)
|
||||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
|
||||
items(items) { item ->
|
||||
|
||||
LocationRow(
|
||||
item = item,
|
||||
onLongClick = { selectedItem ->
|
||||
onLongClick(selectedItem)
|
||||
},
|
||||
onClick = { selectedItem ->
|
||||
onClick(selectedItem)
|
||||
},
|
||||
)
|
||||
HorizontalDivider(thickness = 1.dp, color = Color.White)
|
||||
}
|
||||
}
|
||||
showLoading = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalFoundationApi::class)
|
||||
@Composable
|
||||
fun LocationRow(
|
||||
item: LocationItem, onLongClick: (LocationItem) -> Unit, onClick: (LocationItem) -> Unit
|
||||
) {
|
||||
Row(modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 4.dp)
|
||||
.combinedClickable(onClick = { onClick(item) }, onLongClick = { onLongClick(item) }
|
||||
|
||||
), horizontalArrangement = Arrangement.SpaceEvenly) {
|
||||
Text(text = item.parking, color = Color.White, modifier = Modifier.weight(1f))
|
||||
Text(text = item.matricula, color = Color.White, modifier = Modifier.weight(1f))
|
||||
Text(text = item.visible, color = Color.White, modifier = Modifier.weight(1f))
|
||||
Text(text = item.reserve, color = Color.White, modifier = Modifier.weight(1f))
|
||||
Text(text = item.priority, color = Color.White, modifier = Modifier.weight(1f))
|
||||
Text(
|
||||
text = item.fecha,
|
||||
color = Color.White,
|
||||
modifier = Modifier.weight(1f),
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// Modelo de datos
|
||||
data class LocationItem(
|
||||
val parking: String,
|
||||
val matricula: String,
|
||||
val visible: String,
|
||||
val reserve: String,
|
||||
val priority: String,
|
||||
val fecha: String,
|
||||
val sector: String
|
||||
)
|
||||
|
||||
// Vista previa
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun PreviewLocationScreen() {
|
||||
LocationScreen(
|
||||
// viewModel = null,
|
||||
items = listOf(
|
||||
LocationItem("P1", "1234ABC", "Sí", "No", "Alta", "12/02/2025", "previa"),
|
||||
LocationItem("P2", "5678DEF", "No", "Sí", "Baja", "13/02/2025", "previa")
|
||||
),
|
||||
onTextChange = {},
|
||||
titleToolBar = "Buscar Item",
|
||||
onBackClick = {},
|
||||
onLongClick = {},
|
||||
onClick = {})
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package es.verdnatura.presentation.view.feature.buscaritem.fragment
|
||||
|
||||
import androidx.compose.animation.AnimatedVisibility
|
||||
import androidx.compose.animation.fadeIn
|
||||
import androidx.compose.animation.fadeOut
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.wrapContentWidth
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.dimensionResource
|
||||
import com.airbnb.lottie.compose.LottieAnimation
|
||||
import com.airbnb.lottie.compose.LottieCompositionSpec
|
||||
import com.airbnb.lottie.compose.LottieConstants
|
||||
import com.airbnb.lottie.compose.rememberLottieComposition
|
||||
import es.verdnatura.R
|
||||
|
||||
@Composable
|
||||
fun LottieLoadingAnimation(isVisible: Boolean = true) {
|
||||
AnimatedVisibility(
|
||||
visible = isVisible,
|
||||
enter = fadeIn(),
|
||||
exit = fadeOut()
|
||||
) {
|
||||
val composition by rememberLottieComposition(
|
||||
spec = LottieCompositionSpec.RawRes(R.raw.orange_loading)
|
||||
)
|
||||
|
||||
LottieAnimation(
|
||||
composition = composition,
|
||||
iterations = LottieConstants.IterateForever,
|
||||
speed = 2f,
|
||||
modifier = Modifier
|
||||
.wrapContentWidth()
|
||||
.height(dimensionResource(id = R.dimen.verdnatura_logo_large_height))
|
||||
)
|
||||
}
|
||||
}
|
|
@ -2,21 +2,27 @@ package es.verdnatura.presentation.view.feature.buscaritem.model
|
|||
|
||||
import es.verdnatura.domain.isoToString
|
||||
|
||||
class ItemLocationVO(
|
||||
var Parking: String = "",
|
||||
var Matricula: String = "",
|
||||
var visible: Int = 0,
|
||||
var itemFk: Int = 0,
|
||||
var priority: Int = 0
|
||||
class ItemShelvingsList(
|
||||
var list: List<ItemShelvings> = listOf()
|
||||
)
|
||||
|
||||
data class ItemShelvings(
|
||||
val visible: Int, val available: Int, val shelving: Shelving
|
||||
) {
|
||||
var created: String = ""
|
||||
get() {
|
||||
return field.isoToString()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class LocationListVO(
|
||||
var list: List<ItemLocationVO> = listOf()
|
||||
data class Shelving(
|
||||
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) {
|
||||
|
||||
if (customDialogInputTwoValues.getValueTwo().isNotEmpty()) {
|
||||
viewModel.itemShelvingMerge(
|
||||
itemReubication.id, customDialogInputTwoValues.getValueTwo().uppercase()
|
||||
viewModel.getMergeFromCode(
|
||||
itemReubication.id,
|
||||
customDialogInputTwoValues.getValueTwo().uppercase()
|
||||
)
|
||||
|
||||
} else {
|
||||
ma.messageWithSound(
|
||||
getString(R.string.returnScan), isError = true, isPlayed = true, isToasted = true
|
||||
|
|
|
@ -56,6 +56,8 @@ class ReubicationFragment(var entrypoint: String) :
|
|||
if (!binding.scanInput.text.isNullOrEmpty()) {
|
||||
|
||||
shelvingScaned = binding.scanInput.text.toString()
|
||||
|
||||
|
||||
viewModel.itemShelvingAlternative(
|
||||
shelvingFk = binding.scanInput.text.toString(),
|
||||
)
|
||||
|
|
|
@ -7,6 +7,7 @@ import android.graphics.drawable.Drawable
|
|||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
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
|
||||
|
@ -132,9 +133,12 @@ class SaleAdapter(
|
|||
|
||||
//ERROR
|
||||
if (sale.originalQuantity != sale.quantity) {
|
||||
layoutError.visibility = View.VISIBLE
|
||||
layoutError.visibility = VISIBLE
|
||||
txtError.text =
|
||||
binding.root.context.getString(R.string.originalQuantity) + sale.originalQuantity
|
||||
buildString {
|
||||
append(binding.root.context.getString(R.string.originalQuantity))
|
||||
append(sale.originalQuantity)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -145,7 +149,7 @@ class SaleAdapter(
|
|||
// d("VERDNATURA::","La quantity de ${sale.saleFk} es ${sale.pickedQuantity} y está ${sale.isPrepared}")
|
||||
|
||||
if (sale.isNew) {
|
||||
layoutError.visibility = View.VISIBLE
|
||||
layoutError.visibility = VISIBLE
|
||||
txtError.text = binding.root.context.getString(R.string.newItem)
|
||||
|
||||
}
|
||||
|
@ -157,7 +161,7 @@ class SaleAdapter(
|
|||
val backgroundDrawableCon: Drawable = binding.itemArticleRowSemaforoCon.background
|
||||
|
||||
if (!sale.isNew && sale.originalQuantity == sale.quantity) {
|
||||
layoutError.visibility = View.GONE
|
||||
layoutError.visibility = GONE
|
||||
}
|
||||
|
||||
//SEMAFORO
|
||||
|
@ -278,10 +282,10 @@ class SaleAdapter(
|
|||
)*/
|
||||
} else if (sale.isPreviousPrepared == "1") {
|
||||
contentLayout.setBackgroundColor(
|
||||
getColor(
|
||||
if (sale.picked == null) getColor(
|
||||
context!!,
|
||||
R.color.verdnatura_dark_sky_blue
|
||||
)
|
||||
R.color.verdnatura_black
|
||||
) else getColor(context!!, R.color.verdnatura_dark_sky_blue)
|
||||
)
|
||||
} else {
|
||||
contentLayout.setBackgroundColor(getColor(context!!, R.color.verdnatura_black))
|
||||
|
@ -308,53 +312,53 @@ class SaleAdapter(
|
|||
}
|
||||
|
||||
if (isExpanded) {
|
||||
itemArticlePlacements.visibility = View.VISIBLE
|
||||
itemArticlePlacements.visibility = VISIBLE
|
||||
ivArrow.setImageResource(R.drawable.ic_arrow_down)
|
||||
|
||||
} else {
|
||||
itemArticlePlacements.visibility = View.GONE
|
||||
itemArticlePlacements.visibility = GONE
|
||||
ivArrow.setImageResource(R.drawable.ic_arrow_up)
|
||||
}
|
||||
|
||||
itemArticlePlacements.visibility = if (isExpanded) View.VISIBLE else {
|
||||
View.GONE
|
||||
itemArticlePlacements.visibility = if (isExpanded) VISIBLE else {
|
||||
GONE
|
||||
}
|
||||
|
||||
if (sale.isParent) {
|
||||
itemArticleItemFk.visibility = View.INVISIBLE
|
||||
itemArticleItemFk.visibility = INVISIBLE
|
||||
//itemPackingText.visibility = View.INVISIBLE
|
||||
//itemPackingItemFk.visibility = View.INVISIBLE
|
||||
itemArticleCel1.visibility = View.INVISIBLE
|
||||
itemArticleCel2.visibility = View.INVISIBLE
|
||||
itemArticleCel3.visibility = View.INVISIBLE
|
||||
itemArticleQuantity.visibility = View.INVISIBLE
|
||||
txtdeNew.visibility = View.INVISIBLE
|
||||
itemArticleQuantityPicked.visibility = View.INVISIBLE
|
||||
itemArticleQuantityLine3.visibility = View.VISIBLE
|
||||
imageErrorMessage.visibility = View.INVISIBLE
|
||||
ivArrow.visibility = View.VISIBLE
|
||||
itemArticleCel1.visibility = INVISIBLE
|
||||
itemArticleCel2.visibility = INVISIBLE
|
||||
itemArticleCel3.visibility = INVISIBLE
|
||||
itemArticleQuantity.visibility = INVISIBLE
|
||||
txtdeNew.visibility = INVISIBLE
|
||||
itemArticleQuantityPicked.visibility = INVISIBLE
|
||||
itemArticleQuantityLine3.visibility = VISIBLE
|
||||
imageErrorMessage.visibility = INVISIBLE
|
||||
ivArrow.visibility = VISIBLE
|
||||
|
||||
} else {
|
||||
itemArticleItemFk.visibility = View.VISIBLE
|
||||
itemArticleItemFk.visibility = VISIBLE
|
||||
//itemPackingText.visibility = View.VISIBLE
|
||||
//itemPackingItemFk.visibility = View.VISIBLE
|
||||
itemArticleCel1.visibility = View.VISIBLE
|
||||
itemArticleCel2.visibility = View.VISIBLE
|
||||
itemArticleCel3.visibility = View.VISIBLE
|
||||
itemArticleQuantity.visibility = View.VISIBLE
|
||||
txtdeNew.visibility = View.VISIBLE
|
||||
itemArticleQuantityPicked.visibility = View.VISIBLE
|
||||
itemArticleQuantityLine3.visibility = View.VISIBLE
|
||||
itemArticleCel1.visibility = VISIBLE
|
||||
itemArticleCel2.visibility = VISIBLE
|
||||
itemArticleCel3.visibility = VISIBLE
|
||||
itemArticleQuantity.visibility = VISIBLE
|
||||
txtdeNew.visibility = VISIBLE
|
||||
itemArticleQuantityPicked.visibility = VISIBLE
|
||||
itemArticleQuantityLine3.visibility = VISIBLE
|
||||
if (type != SACADOR) {
|
||||
val colorRes =
|
||||
if (sale.hasMistake == true || sale.hasMistake == 1) R.color.verdnatura_red_salix else R.color.verdnatura_black
|
||||
imageErrorMessage.imageTintList =
|
||||
ColorStateList.valueOf(getColor(context!!, colorRes))
|
||||
imageErrorMessage.visibility = View.VISIBLE
|
||||
imageErrorMessage.visibility = VISIBLE
|
||||
} else {
|
||||
imageErrorMessage.visibility = View.INVISIBLE
|
||||
imageErrorMessage.visibility = INVISIBLE
|
||||
}
|
||||
ivArrow.visibility = View.INVISIBLE
|
||||
ivArrow.visibility = INVISIBLE
|
||||
}
|
||||
|
||||
if (!sale.sonSales.isNullOrEmpty()) {
|
||||
|
@ -372,7 +376,7 @@ class SaleAdapter(
|
|||
|
||||
} else {
|
||||
//revisar porque incosistencia
|
||||
itemArticlePlacements.visibility = View.VISIBLE
|
||||
itemArticlePlacements.visibility = VISIBLE
|
||||
}
|
||||
|
||||
/* rvHeadlines.adapter=SaleAdapter(sale.sonSales,onPasillerosItemClickListener,onQuantityClick,onSaleClickListener,onMistakeClickListener,onPackingClick)
|
||||
|
@ -383,11 +387,11 @@ class SaleAdapter(
|
|||
|
||||
if (isExpanded) {
|
||||
ivArrow.setImageResource(R.drawable.ic_arrow_up)
|
||||
itemArticlePlacements.visibility = View.GONE
|
||||
itemArticlePlacements.visibility = GONE
|
||||
} else {
|
||||
|
||||
ivArrow.setImageResource(R.drawable.ic_arrow_down)
|
||||
itemArticlePlacements.visibility = View.VISIBLE
|
||||
itemArticlePlacements.visibility = VISIBLE
|
||||
}
|
||||
isExpanded = !isExpanded
|
||||
|
||||
|
@ -395,7 +399,7 @@ class SaleAdapter(
|
|||
}
|
||||
|
||||
//Tarea 6607
|
||||
itemArticleCel2Count.visibility = View.GONE
|
||||
itemArticleCel2Count.visibility = GONE
|
||||
/*itemArticleCel2Count.visibility = if (type == CONTROLADOR) {
|
||||
View.VISIBLE
|
||||
} else {
|
||||
|
@ -503,8 +507,4 @@ class SaleAdapter(
|
|||
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("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
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,365 @@
|
|||
package es.verdnatura.presentation.view.feature.collection.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.content.res.ColorStateList
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View.GONE
|
||||
import android.view.View.INVISIBLE
|
||||
import android.view.View.VISIBLE
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.content.ContextCompat.getColor
|
||||
import androidx.core.graphics.drawable.DrawableCompat
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.SaleRowFragmentReserveBinding
|
||||
import es.verdnatura.domain.ConstAndValues.PREITEMPICKERTEST
|
||||
import es.verdnatura.domain.ConstAndValues.PREPARED
|
||||
import es.verdnatura.domain.ConstAndValues.SACADOR
|
||||
import es.verdnatura.domain.toast
|
||||
import es.verdnatura.presentation.common.OnAddItemClickListener
|
||||
import es.verdnatura.presentation.common.OnMistakeClickListener
|
||||
import es.verdnatura.presentation.common.OnPackingClickSaleListener
|
||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||
import es.verdnatura.presentation.common.OnSaleClickSaleListener
|
||||
import es.verdnatura.presentation.common.OnSaleReserveClickListener
|
||||
import es.verdnatura.presentation.common.OnTicketClickSaleListener
|
||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.Sale
|
||||
|
||||
class SaleAdapterReserve(
|
||||
private val items: List<Sale>,
|
||||
private val onPasillerosItemClickListener: OnPasillerosItemClickListener,
|
||||
private val onSaleClickListener: OnSaleClickSaleListener,
|
||||
private val onMistakeClickListener: OnMistakeClickListener,
|
||||
private val onPackingClick: OnPackingClickSaleListener,
|
||||
private var onTicketClick: OnTicketClickSaleListener? = null,
|
||||
private var saleAdapter: SaleAdapterReserve? = null,
|
||||
private var onReserveSaleClick: OnSaleReserveClickListener? = null,
|
||||
private var onAddItemClickListener: OnAddItemClickListener? = null,
|
||||
private var type: String? = null,
|
||||
|
||||
) : RecyclerView.Adapter<SaleAdapterReserve.AjustesItemHolder>() {
|
||||
var context: Context? = null
|
||||
var position: Int = 0
|
||||
|
||||
var isExpanded: Boolean = type == "PRECHECKER"
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AjustesItemHolder {
|
||||
this.context = parent.context
|
||||
|
||||
|
||||
return AjustesItemHolder(
|
||||
|
||||
SaleRowFragmentReserveBinding.inflate(
|
||||
LayoutInflater.from(parent.context), parent, false
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
override fun getItemCount() = items.size
|
||||
|
||||
override fun onBindViewHolder(holder: AjustesItemHolder, position: Int) {
|
||||
this.position = position
|
||||
holder.bind(items[position])
|
||||
}
|
||||
|
||||
inner class AjustesItemHolder(
|
||||
val binding: SaleRowFragmentReserveBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
fun bind(sale: Sale) {
|
||||
binding.apply {
|
||||
println("type $type ")
|
||||
println("type isExpanded $isExpanded")
|
||||
/* val childLayoutManager =
|
||||
LinearLayoutManager(context!!, RecyclerView.HORIZONTAL, false)
|
||||
*/
|
||||
val childLayoutManagerV =
|
||||
LinearLayoutManager(context!!, RecyclerView.VERTICAL, false)
|
||||
|
||||
/* itemArticlePlacements.apply {
|
||||
layoutManager = childLayoutManager
|
||||
|
||||
}*/
|
||||
|
||||
//CLICK EVENTS
|
||||
contentLayout.setOnClickListener {
|
||||
if (!sale.isParent) {
|
||||
onSaleClickListener.onSaleClick(sale)
|
||||
}
|
||||
}
|
||||
txtColor.setOnClickListener {
|
||||
if (!sale.isParent) {
|
||||
onSaleClickListener.onSaleClick(sale)
|
||||
}
|
||||
}
|
||||
txtDescrip.setOnClickListener {
|
||||
if (!sale.isParent) {
|
||||
onSaleClickListener.onSaleClick(sale)
|
||||
}
|
||||
}
|
||||
ticketFk.setOnClickListener {
|
||||
onTicketClick?.onTicketClickListener(sale)
|
||||
}
|
||||
|
||||
txtParking.setOnClickListener {
|
||||
onPasillerosItemClickListener.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(
|
||||
title = R.string.titleItemSearch
|
||||
), sale.itemFk.toString()
|
||||
)
|
||||
}
|
||||
txtShelving.setOnClickListener {
|
||||
onPackingClick.onPackingClick(sale)
|
||||
}
|
||||
|
||||
txtItem.setOnClickListener {
|
||||
onPasillerosItemClickListener.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(
|
||||
title = R.string.titleItemConsult
|
||||
), sale.itemFk.toString()
|
||||
)
|
||||
}
|
||||
|
||||
//ERROR
|
||||
|
||||
if (sale.originalQuantity != sale.saleQuantity && sale.originalQuantity != null && !sale.isParent) {
|
||||
layoutError.visibility = VISIBLE
|
||||
txtError.text =
|
||||
binding.root.context.getString(R.string.originalQuantity) + sale.originalQuantity
|
||||
binding.addItem.visibility = VISIBLE
|
||||
|
||||
} else {
|
||||
layoutError.visibility = GONE
|
||||
binding.addItem.visibility = GONE
|
||||
|
||||
}
|
||||
|
||||
binding.deleteReserve.visibility = if (sale.isAdded == 1) VISIBLE else GONE
|
||||
|
||||
if (sale.isAdded == 1) {
|
||||
layoutError.visibility = VISIBLE
|
||||
txtError.text = binding.root.context.getString(R.string.newItem)
|
||||
binding.deleteReserve.setOnClickListener {
|
||||
onReserveSaleClick!!.onSaleReserveListener(sale)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (isExpanded) {
|
||||
itemArticlePlacements.visibility = VISIBLE
|
||||
ivArrow.setImageResource(R.drawable.ic_arrow_down)
|
||||
|
||||
} else {
|
||||
itemArticlePlacements.visibility = GONE
|
||||
ivArrow.setImageResource(R.drawable.ic_arrow_up)
|
||||
}
|
||||
|
||||
itemArticlePlacements.visibility = if (isExpanded) VISIBLE else {
|
||||
GONE
|
||||
}
|
||||
|
||||
if (sale.isParent) {
|
||||
txtQuantity.visibility = INVISIBLE
|
||||
txtQuantityReserved.visibility = INVISIBLE
|
||||
txtReserveToComplete.visibility = GONE
|
||||
imageErrorMessage.visibility = GONE
|
||||
ivArrow.visibility = VISIBLE
|
||||
|
||||
} else {
|
||||
|
||||
imageErrorMessage.visibility = GONE
|
||||
if (type != SACADOR && type != PREITEMPICKERTEST) {
|
||||
val colorRes =
|
||||
if (sale.hasMistake == true) R.color.verdnatura_red_salix else R.color.verdnatura_black
|
||||
imageErrorMessage.imageTintList =
|
||||
ColorStateList.valueOf(getColor(context!!, colorRes))
|
||||
imageErrorMessage.visibility = VISIBLE
|
||||
} else {
|
||||
imageErrorMessage.visibility = GONE
|
||||
}
|
||||
ivArrow.visibility = INVISIBLE
|
||||
}
|
||||
println("sonSales ${sale.sonSales}")
|
||||
|
||||
if (!sale.sonSales.isNullOrEmpty()) {
|
||||
|
||||
itemArticlePlacements.apply {
|
||||
layoutManager = childLayoutManagerV
|
||||
adapter = SaleAdapterReserve(
|
||||
sale.sonSales,
|
||||
onPasillerosItemClickListener,
|
||||
onSaleClickListener,
|
||||
onMistakeClickListener,
|
||||
onPackingClick,
|
||||
|
||||
)
|
||||
}
|
||||
} else {
|
||||
itemArticlePlacements.visibility = VISIBLE
|
||||
}
|
||||
|
||||
ivArrow.setOnClickListener {
|
||||
|
||||
if (isExpanded) {
|
||||
ivArrow.setImageResource(R.drawable.ic_arrow_up)
|
||||
itemArticlePlacements.visibility = GONE
|
||||
} else {
|
||||
ivArrow.setImageResource(R.drawable.ic_arrow_down)
|
||||
itemArticlePlacements.visibility = VISIBLE
|
||||
}
|
||||
isExpanded = !isExpanded
|
||||
|
||||
}
|
||||
|
||||
if (sale.saleGroupFk == null) {
|
||||
previous.visibility = INVISIBLE
|
||||
} else {
|
||||
previous.visibility = VISIBLE
|
||||
previous.text = "PREV:${sale.saleGroupFk}"
|
||||
}
|
||||
|
||||
val result: Int
|
||||
val textToConcat: String
|
||||
|
||||
try {
|
||||
|
||||
result = sale.reservedQuantity % (sale.packing ?: (sale.saleQuantity + 1))
|
||||
textToConcat = if (result != 0) {
|
||||
"${sale.reservedQuantity / (sale.grouping ?: 1)} x ${sale.grouping ?: "1"}"
|
||||
} else {
|
||||
"${sale.reservedQuantity / (sale.packing ?: 1)} pack de ${sale.packing ?: "1"}"
|
||||
}
|
||||
binding.txtQuantityReserved.text = textToConcat
|
||||
|
||||
val textToConcat2: String
|
||||
|
||||
val result2: Int =
|
||||
sale.accumulatedQuantity % (sale.packing ?: (sale.saleQuantity + 1))
|
||||
textToConcat2 = if (result2 != 0) {
|
||||
"${(sale.saleQuantity - sale.accumulatedQuantity) / (sale.grouping ?: 1)} x ${sale.grouping ?: "1"}"
|
||||
} else {
|
||||
"${(sale.saleQuantity - sale.accumulatedQuantity) / (sale.packing ?: 1)} pack de ${sale.packing ?: "1"}"
|
||||
}
|
||||
|
||||
|
||||
if (sale.totalItemShelving > 1) {
|
||||
binding.txtQuantityReserved.text = textToConcat
|
||||
binding.txtQuantity.text = textToConcat2
|
||||
binding.txtReserveToComplete.text =
|
||||
"${sale.currentItemShelving}/${sale.totalItemShelving}"
|
||||
binding.txtReserveToComplete.visibility = VISIBLE
|
||||
binding.txtQuantity.text =
|
||||
"${sale.reservedQuantity}"
|
||||
} else {
|
||||
binding.txtQuantity.text = "${sale.reservedQuantity}"
|
||||
binding.txtReserveToComplete.visibility = GONE
|
||||
|
||||
}
|
||||
|
||||
} catch (ex: Exception) {
|
||||
ex.message!!.toast(context)
|
||||
}
|
||||
|
||||
|
||||
binding.txtReserveToComplete.text =
|
||||
"${sale.currentItemShelving}/${sale.totalItemShelving}"
|
||||
|
||||
//COLORES
|
||||
paintTicketcolor(sale.rgb, binding.itemTicketColor.background)
|
||||
if (sale.isPicked == 1) {
|
||||
if (type == PREPARED) {
|
||||
contentLayout.setBackgroundColor(
|
||||
|
||||
if (sale.saleGroupFk == null) {
|
||||
getColor(
|
||||
context!!, R.color.verdnatura_orange_salix
|
||||
)
|
||||
} else {
|
||||
println("stateCode ${sale.stateCode}")
|
||||
if (sale.stateCode != null && sale.stateCode == "PREPARED") {
|
||||
getColor(
|
||||
context!!, R.color.verdnatura_orange_salix
|
||||
)
|
||||
} else {
|
||||
if (sale.stateCode != null && sale.stateCode == "OK PREVIOUS") {
|
||||
getColor(
|
||||
context!!, R.color.verdnatura_dark_sky_blue
|
||||
)
|
||||
} else {
|
||||
if (sale.stateCode != null && sale.stateCode == "PREVIOUS_CONTROLLED") {
|
||||
getColor(
|
||||
context!!, R.color.verdnatura_dark_mint_light
|
||||
)
|
||||
} else {
|
||||
getColor(
|
||||
context!!, R.color.verdnatura_black
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
)
|
||||
} else {
|
||||
contentLayout.setBackgroundColor(
|
||||
getColor(
|
||||
context!!, R.color.verdnatura_dark_sky_blue
|
||||
)
|
||||
)
|
||||
}
|
||||
} else {
|
||||
contentLayout.setBackgroundColor(
|
||||
getColor(
|
||||
context!!, R.color.verdnatura_black
|
||||
)
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
binding.txtParking.text =
|
||||
// if (type == PREPARED) sale.parkingCodePrevia else sale.parkingCode
|
||||
sale.parkingCode ?: sale.parkingCodePrevia
|
||||
|
||||
binding.addItem.setOnClickListener {
|
||||
onAddItemClickListener!!.onAddItemClickListener(sale)
|
||||
}
|
||||
|
||||
if (type == PREITEMPICKERTEST) {
|
||||
binding.level.visibility = GONE
|
||||
binding.levelTxt.visibility = GONE
|
||||
binding.ticketOrder.visibility = VISIBLE
|
||||
binding.txtPoints.visibility = GONE
|
||||
} else {
|
||||
binding.level.visibility = VISIBLE
|
||||
binding.levelTxt.visibility = VISIBLE
|
||||
binding.ticketOrder.visibility = GONE
|
||||
binding.txtPoints.visibility = VISIBLE
|
||||
|
||||
}
|
||||
|
||||
|
||||
this.sale = sale
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun paintTicketcolor(color: String?, backgroundDrawableTicket: Drawable) {
|
||||
|
||||
if (color.isNullOrBlank()) {
|
||||
DrawableCompat.setTint(
|
||||
backgroundDrawableTicket, Color.TRANSPARENT
|
||||
)
|
||||
} else {
|
||||
DrawableCompat.setTint(
|
||||
backgroundDrawableTicket, Color.parseColor(color)
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,363 @@
|
|||
package es.verdnatura.presentation.view.feature.collection.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.content.res.ColorStateList
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View.GONE
|
||||
import android.view.View.INVISIBLE
|
||||
import android.view.View.VISIBLE
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.content.ContextCompat.getColor
|
||||
import androidx.core.graphics.drawable.DrawableCompat
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.SaleRowFragmentReserveSacadorBinding
|
||||
import es.verdnatura.domain.ConstAndValues.PREITEMPICKERTEST
|
||||
import es.verdnatura.domain.ConstAndValues.PREPARED
|
||||
import es.verdnatura.domain.ConstAndValues.SACADOR
|
||||
import es.verdnatura.domain.toast
|
||||
import es.verdnatura.presentation.common.OnAddItemClickListener
|
||||
import es.verdnatura.presentation.common.OnMistakeClickListener
|
||||
import es.verdnatura.presentation.common.OnPackingClickSaleListener
|
||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||
import es.verdnatura.presentation.common.OnSaleClickSaleListener
|
||||
import es.verdnatura.presentation.common.OnSaleReserveClickListener
|
||||
import es.verdnatura.presentation.common.OnTicketClickSaleListener
|
||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.Sale
|
||||
|
||||
class SaleAdapterReserveSacador(
|
||||
private val items: List<Sale>,
|
||||
private val onPasillerosItemClickListener: OnPasillerosItemClickListener,
|
||||
private val onSaleClickListener: OnSaleClickSaleListener,
|
||||
private val onMistakeClickListener: OnMistakeClickListener,
|
||||
private val onPackingClick: OnPackingClickSaleListener,
|
||||
private var onTicketClick: OnTicketClickSaleListener? = null,
|
||||
private var saleAdapter: SaleAdapterReserveSacador? = null,
|
||||
private var onReserveSaleClick: OnSaleReserveClickListener? = null,
|
||||
private var onAddItemClickListener: OnAddItemClickListener? = null,
|
||||
private var type: String? = null,
|
||||
|
||||
) : RecyclerView.Adapter<SaleAdapterReserveSacador.AjustesItemHolder>() {
|
||||
var context: Context? = null
|
||||
var position: Int = 0
|
||||
|
||||
var isExpanded: Boolean = false
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AjustesItemHolder {
|
||||
this.context = parent.context
|
||||
|
||||
|
||||
return AjustesItemHolder(
|
||||
|
||||
SaleRowFragmentReserveSacadorBinding.inflate(
|
||||
LayoutInflater.from(parent.context), parent, false
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
override fun getItemCount() = items.size
|
||||
|
||||
override fun onBindViewHolder(holder: AjustesItemHolder, position: Int) {
|
||||
this.position = position
|
||||
holder.bind(items[position])
|
||||
}
|
||||
|
||||
inner class AjustesItemHolder(
|
||||
val binding: SaleRowFragmentReserveSacadorBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
fun bind(sale: Sale) {
|
||||
binding.apply {
|
||||
|
||||
val childLayoutManagerV =
|
||||
LinearLayoutManager(context!!, RecyclerView.VERTICAL, false)
|
||||
|
||||
//CLICK EVENTS
|
||||
contentLayout.setOnClickListener {
|
||||
if (!sale.isParent) {
|
||||
onSaleClickListener.onSaleClick(sale)
|
||||
}
|
||||
}
|
||||
txtColor.setOnClickListener {
|
||||
if (!sale.isParent) {
|
||||
onSaleClickListener.onSaleClick(sale)
|
||||
}
|
||||
}
|
||||
txtDescrip.setOnClickListener {
|
||||
if (!sale.isParent) {
|
||||
onSaleClickListener.onSaleClick(sale)
|
||||
}
|
||||
}
|
||||
ticketFk.setOnClickListener {
|
||||
onTicketClick?.onTicketClickListener(sale)
|
||||
}
|
||||
|
||||
txtParking.setOnClickListener {
|
||||
onPasillerosItemClickListener.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(
|
||||
title = R.string.titleItemSearch
|
||||
), sale.itemFk.toString()
|
||||
)
|
||||
}
|
||||
txtShelving.setOnClickListener {
|
||||
onPackingClick.onPackingClick(sale)
|
||||
}
|
||||
|
||||
txtItem.setOnClickListener {
|
||||
onPasillerosItemClickListener.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(
|
||||
title = R.string.titleItemConsult
|
||||
), sale.itemFk.toString()
|
||||
)
|
||||
}
|
||||
|
||||
//ERROR
|
||||
|
||||
if (sale.originalQuantity != sale.saleQuantity && sale.originalQuantity != null && !sale.isParent) {
|
||||
layoutError.visibility = VISIBLE
|
||||
txtError.text =
|
||||
binding.root.context.getString(R.string.originalQuantity) + sale.originalQuantity
|
||||
binding.addItem.visibility = VISIBLE
|
||||
|
||||
} else {
|
||||
layoutError.visibility = GONE
|
||||
binding.addItem.visibility = GONE
|
||||
|
||||
}
|
||||
|
||||
binding.deleteReserve.visibility = if (sale.isAdded == 1) VISIBLE else GONE
|
||||
|
||||
if (sale.isAdded == 1) {
|
||||
layoutError.visibility = VISIBLE
|
||||
txtError.text = binding.root.context.getString(R.string.newItem)
|
||||
binding.deleteReserve.setOnClickListener {
|
||||
onReserveSaleClick!!.onSaleReserveListener(sale)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (sale.isParent) {
|
||||
txtQuantity.visibility = INVISIBLE
|
||||
txtQuantityReserved.visibility = INVISIBLE
|
||||
txtReserveToComplete.visibility = GONE
|
||||
imageErrorMessage.visibility = GONE
|
||||
ivArrow.visibility = VISIBLE
|
||||
sale.color = sale.username ?: "" //mostrar en campo del colo el usuario
|
||||
} else {
|
||||
|
||||
imageErrorMessage.visibility = GONE
|
||||
if (type != SACADOR && type != PREITEMPICKERTEST) {
|
||||
val colorRes =
|
||||
if (sale.hasMistake == true) R.color.verdnatura_red_salix else R.color.verdnatura_black
|
||||
imageErrorMessage.imageTintList =
|
||||
ColorStateList.valueOf(getColor(context!!, colorRes))
|
||||
imageErrorMessage.visibility = VISIBLE
|
||||
} else {
|
||||
imageErrorMessage.visibility = GONE
|
||||
}
|
||||
ivArrow.visibility = INVISIBLE
|
||||
}
|
||||
|
||||
if (!sale.sonSales.isNullOrEmpty()) {
|
||||
|
||||
itemArticlePlacements.apply {
|
||||
layoutManager = childLayoutManagerV
|
||||
adapter = SaleAdapterReserveSacadorSaleGroup(
|
||||
sale.sonSales,
|
||||
onPasillerosItemClickListener,
|
||||
onSaleClickListener,
|
||||
onMistakeClickListener,
|
||||
onPackingClick,
|
||||
type = "PREPARED"
|
||||
|
||||
)
|
||||
}
|
||||
} else {
|
||||
itemArticlePlacements.visibility = GONE
|
||||
}
|
||||
if (isExpanded) {
|
||||
if (sale.isParent) {
|
||||
itemArticlePlacements.visibility = VISIBLE
|
||||
} else {
|
||||
itemArticlePlacements.visibility = GONE
|
||||
}
|
||||
ivArrow.setImageResource(R.drawable.ic_arrow_down)
|
||||
|
||||
} else {
|
||||
itemArticlePlacements.visibility = GONE
|
||||
ivArrow.setImageResource(R.drawable.ic_arrow_up)
|
||||
}
|
||||
|
||||
itemArticlePlacements.visibility = if (isExpanded) VISIBLE else {
|
||||
GONE
|
||||
}
|
||||
ivArrow.setOnClickListener {
|
||||
|
||||
if (isExpanded) {
|
||||
ivArrow.setImageResource(R.drawable.ic_arrow_up)
|
||||
itemArticlePlacements.visibility = GONE
|
||||
|
||||
} else {
|
||||
ivArrow.setImageResource(R.drawable.ic_arrow_down)
|
||||
if (sale.isParent) {
|
||||
itemArticlePlacements.visibility = VISIBLE
|
||||
} else {
|
||||
itemArticlePlacements.visibility = GONE
|
||||
}
|
||||
}
|
||||
isExpanded = !isExpanded
|
||||
|
||||
}
|
||||
|
||||
if (sale.saleGroupFk == null) {
|
||||
previous.visibility = INVISIBLE
|
||||
} else {
|
||||
previous.visibility = VISIBLE
|
||||
previous.text = "PREV:${sale.saleGroupFk}"
|
||||
|
||||
}
|
||||
|
||||
val result: Int
|
||||
val textToConcat: String
|
||||
|
||||
try {
|
||||
|
||||
result = sale.reservedQuantity % (sale.packing ?: (sale.saleQuantity + 1))
|
||||
textToConcat = if (result != 0) {
|
||||
"${sale.reservedQuantity / (sale.grouping ?: 1)} x ${sale.grouping ?: "1"}"
|
||||
} else {
|
||||
"${sale.reservedQuantity / (sale.packing ?: 1)} pack de ${sale.packing ?: "1"}"
|
||||
}
|
||||
binding.txtQuantityReserved.text = textToConcat
|
||||
|
||||
val textToConcat2: String
|
||||
|
||||
val result2: Int =
|
||||
sale.accumulatedQuantity % (sale.packing ?: (sale.saleQuantity + 1))
|
||||
textToConcat2 = if (result2 != 0) {
|
||||
"${(sale.saleQuantity - sale.accumulatedQuantity) / (sale.grouping ?: 1)} x ${sale.grouping ?: "1"}"
|
||||
} else {
|
||||
"${(sale.saleQuantity - sale.accumulatedQuantity) / (sale.packing ?: 1)} pack de ${sale.packing ?: "1"}"
|
||||
}
|
||||
|
||||
|
||||
if (sale.totalItemShelving > 1) {
|
||||
binding.txtQuantityReserved.text = textToConcat
|
||||
binding.txtQuantity.text = textToConcat2
|
||||
binding.txtReserveToComplete.text =
|
||||
"${sale.currentItemShelving}/${sale.totalItemShelving}"
|
||||
binding.txtReserveToComplete.visibility = VISIBLE
|
||||
binding.txtQuantity.text =
|
||||
"${sale.reservedQuantity}"
|
||||
} else {
|
||||
binding.txtQuantity.text = "${sale.reservedQuantity}"
|
||||
binding.txtReserveToComplete.visibility = GONE
|
||||
|
||||
}
|
||||
|
||||
} catch (ex: Exception) {
|
||||
ex.message!!.toast(context)
|
||||
}
|
||||
|
||||
|
||||
binding.txtReserveToComplete.text =
|
||||
"${sale.currentItemShelving}/${sale.totalItemShelving}"
|
||||
|
||||
//COLORES
|
||||
paintTicketcolor(sale.rgb, binding.itemTicketColor.background)
|
||||
if (sale.isPicked == 1) {
|
||||
if (type == PREPARED) {
|
||||
contentLayout.setBackgroundColor(
|
||||
|
||||
if (sale.saleGroupFk == null) {
|
||||
getColor(
|
||||
context!!, R.color.verdnatura_orange_salix
|
||||
)
|
||||
} else {
|
||||
|
||||
if (sale.stateCode != null && sale.stateCode == "PREPARED") {
|
||||
getColor(
|
||||
context!!, R.color.verdnatura_orange_salix
|
||||
)
|
||||
} else {
|
||||
if (sale.stateCode != null && sale.stateCode == "OK PREVIOUS") {
|
||||
getColor(
|
||||
context!!, R.color.verdnatura_dark_sky_blue
|
||||
)
|
||||
} else {
|
||||
if (sale.stateCode != null && sale.stateCode == "PREVIOUS_CONTROLLED") {
|
||||
getColor(
|
||||
context!!, R.color.verdnatura_dark_mint_light
|
||||
)
|
||||
} else {
|
||||
getColor(
|
||||
context!!, R.color.verdnatura_black
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
)
|
||||
} else {
|
||||
contentLayout.setBackgroundColor(
|
||||
getColor(
|
||||
context!!, R.color.verdnatura_dark_sky_blue
|
||||
)
|
||||
)
|
||||
}
|
||||
} else {
|
||||
contentLayout.setBackgroundColor(
|
||||
getColor(
|
||||
context!!, R.color.verdnatura_black
|
||||
)
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
binding.txtParking.text =
|
||||
// if (type == PREPARED) sale.parkingCodePrevia else sale.parkingCode
|
||||
sale.parkingCode ?: sale.parkingCodePrevia
|
||||
|
||||
binding.addItem.setOnClickListener {
|
||||
onAddItemClickListener!!.onAddItemClickListener(sale)
|
||||
}
|
||||
|
||||
if (type == PREITEMPICKERTEST) {
|
||||
binding.level.visibility = GONE
|
||||
binding.levelTxt.visibility = GONE
|
||||
binding.ticketOrder.visibility = VISIBLE
|
||||
binding.txtPoints.visibility = GONE
|
||||
} else {
|
||||
binding.level.visibility = VISIBLE
|
||||
binding.levelTxt.visibility = VISIBLE
|
||||
binding.ticketOrder.visibility = GONE
|
||||
binding.txtPoints.visibility = VISIBLE
|
||||
|
||||
}
|
||||
|
||||
|
||||
this.sale = sale
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun paintTicketcolor(color: String?, backgroundDrawableTicket: Drawable) {
|
||||
|
||||
if (color.isNullOrBlank()) {
|
||||
DrawableCompat.setTint(
|
||||
backgroundDrawableTicket, Color.TRANSPARENT
|
||||
)
|
||||
} else {
|
||||
DrawableCompat.setTint(
|
||||
backgroundDrawableTicket, Color.parseColor(color)
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,308 @@
|
|||
package es.verdnatura.presentation.view.feature.collection.adapter
|
||||
|
||||
import android.content.Context
|
||||
import android.content.res.ColorStateList
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View.GONE
|
||||
import android.view.View.INVISIBLE
|
||||
import android.view.View.VISIBLE
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.content.ContextCompat.getColor
|
||||
import androidx.core.graphics.drawable.DrawableCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.SaleRowFragmentReserveSacadorBinding
|
||||
import es.verdnatura.domain.ConstAndValues.PREITEMPICKERTEST
|
||||
import es.verdnatura.domain.ConstAndValues.PREPARED
|
||||
import es.verdnatura.domain.ConstAndValues.SACADOR
|
||||
import es.verdnatura.domain.toast
|
||||
import es.verdnatura.presentation.common.OnAddItemClickListener
|
||||
import es.verdnatura.presentation.common.OnMistakeClickListener
|
||||
import es.verdnatura.presentation.common.OnPackingClickSaleListener
|
||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||
import es.verdnatura.presentation.common.OnSaleClickSaleListener
|
||||
import es.verdnatura.presentation.common.OnSaleReserveClickListener
|
||||
import es.verdnatura.presentation.common.OnTicketClickSaleListener
|
||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.Sale
|
||||
|
||||
class SaleAdapterReserveSacadorSaleGroup(
|
||||
private val items: List<Sale>,
|
||||
private val onPasillerosItemClickListener: OnPasillerosItemClickListener,
|
||||
private val onSaleClickListener: OnSaleClickSaleListener,
|
||||
private val onMistakeClickListener: OnMistakeClickListener,
|
||||
private val onPackingClick: OnPackingClickSaleListener,
|
||||
private var onTicketClick: OnTicketClickSaleListener? = null,
|
||||
private var saleAdapter: SaleAdapterReserveSacadorSaleGroup? = null,
|
||||
private var onReserveSaleClick: OnSaleReserveClickListener? = null,
|
||||
private var onAddItemClickListener: OnAddItemClickListener? = null,
|
||||
private var type: String? = null,
|
||||
|
||||
) : RecyclerView.Adapter<SaleAdapterReserveSacadorSaleGroup.AjustesItemHolder>() {
|
||||
var context: Context? = null
|
||||
var position: Int = 0
|
||||
|
||||
var isExpanded: Boolean = false
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AjustesItemHolder {
|
||||
this.context = parent.context
|
||||
|
||||
|
||||
return AjustesItemHolder(
|
||||
|
||||
SaleRowFragmentReserveSacadorBinding.inflate(
|
||||
LayoutInflater.from(parent.context), parent, false
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
override fun getItemCount() = items.size
|
||||
|
||||
override fun onBindViewHolder(holder: AjustesItemHolder, position: Int) {
|
||||
this.position = position
|
||||
holder.bind(items[position])
|
||||
}
|
||||
|
||||
inner class AjustesItemHolder(
|
||||
val binding: SaleRowFragmentReserveSacadorBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
fun bind(sale: Sale) {
|
||||
binding.apply {
|
||||
|
||||
//CLICK EVENTS
|
||||
contentLayout.setOnClickListener {
|
||||
if (!sale.isParent) {
|
||||
onSaleClickListener.onSaleClick(sale)
|
||||
}
|
||||
}
|
||||
txtColor.setOnClickListener {
|
||||
if (!sale.isParent) {
|
||||
onSaleClickListener.onSaleClick(sale)
|
||||
}
|
||||
}
|
||||
txtDescrip.setOnClickListener {
|
||||
if (!sale.isParent) {
|
||||
onSaleClickListener.onSaleClick(sale)
|
||||
}
|
||||
}
|
||||
ticketFk.setOnClickListener {
|
||||
onTicketClick?.onTicketClickListener(sale)
|
||||
}
|
||||
|
||||
txtParking.setOnClickListener {
|
||||
onPasillerosItemClickListener.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(
|
||||
title = R.string.titleItemSearch
|
||||
), sale.itemFk.toString()
|
||||
)
|
||||
}
|
||||
txtShelving.setOnClickListener {
|
||||
onPackingClick.onPackingClick(sale)
|
||||
}
|
||||
|
||||
txtItem.setOnClickListener {
|
||||
onPasillerosItemClickListener.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(
|
||||
title = R.string.titleItemConsult
|
||||
), sale.itemFk.toString()
|
||||
)
|
||||
}
|
||||
|
||||
//ERROR
|
||||
|
||||
if (sale.originalQuantity != sale.saleQuantity && sale.originalQuantity != null && !sale.isParent) {
|
||||
layoutError.visibility = VISIBLE
|
||||
txtError.text =
|
||||
binding.root.context.getString(R.string.originalQuantity) + sale.originalQuantity
|
||||
binding.addItem.visibility = VISIBLE
|
||||
|
||||
} else {
|
||||
layoutError.visibility = GONE
|
||||
binding.addItem.visibility = GONE
|
||||
|
||||
}
|
||||
|
||||
binding.deleteReserve.visibility = if (sale.isAdded == 1) VISIBLE else GONE
|
||||
|
||||
if (sale.isAdded == 1) {
|
||||
layoutError.visibility = VISIBLE
|
||||
txtError.text = binding.root.context.getString(R.string.newItem)
|
||||
binding.deleteReserve.setOnClickListener {
|
||||
onReserveSaleClick!!.onSaleReserveListener(sale)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (sale.isParent) {
|
||||
txtQuantity.visibility = INVISIBLE
|
||||
txtQuantityReserved.visibility = INVISIBLE
|
||||
txtReserveToComplete.visibility = GONE
|
||||
imageErrorMessage.visibility = GONE
|
||||
ivArrow.visibility = VISIBLE
|
||||
|
||||
} else {
|
||||
|
||||
imageErrorMessage.visibility = GONE
|
||||
if (type != SACADOR && type != PREITEMPICKERTEST) {
|
||||
val colorRes =
|
||||
if (sale.hasMistake == true) R.color.verdnatura_red_salix else R.color.verdnatura_black
|
||||
imageErrorMessage.imageTintList =
|
||||
ColorStateList.valueOf(getColor(context!!, colorRes))
|
||||
imageErrorMessage.visibility = VISIBLE
|
||||
} else {
|
||||
imageErrorMessage.visibility = GONE
|
||||
}
|
||||
ivArrow.visibility = INVISIBLE
|
||||
}
|
||||
println("sonSales RESERVESACADORSALEGROUP ${sale.sonSales}")
|
||||
|
||||
|
||||
if (sale.saleGroupFk == null) {
|
||||
previous.visibility = INVISIBLE
|
||||
} else {
|
||||
previous.visibility = VISIBLE
|
||||
previous.text = "PREV:${sale.saleGroupFk}"
|
||||
}
|
||||
|
||||
val result: Int
|
||||
val textToConcat: String
|
||||
|
||||
try {
|
||||
|
||||
result = sale.reservedQuantity % (sale.packing ?: (sale.saleQuantity + 1))
|
||||
textToConcat = if (result != 0) {
|
||||
"${sale.reservedQuantity / (sale.grouping ?: 1)} x ${sale.grouping ?: "1"}"
|
||||
} else {
|
||||
"${sale.reservedQuantity / (sale.packing ?: 1)} pack de ${sale.packing ?: "1"}"
|
||||
}
|
||||
binding.txtQuantityReserved.text = textToConcat
|
||||
|
||||
val textToConcat2: String
|
||||
|
||||
val result2: Int =
|
||||
sale.accumulatedQuantity % (sale.packing ?: (sale.saleQuantity + 1))
|
||||
textToConcat2 = if (result2 != 0) {
|
||||
"${(sale.saleQuantity - sale.accumulatedQuantity) / (sale.grouping ?: 1)} x ${sale.grouping ?: "1"}"
|
||||
} else {
|
||||
"${(sale.saleQuantity - sale.accumulatedQuantity) / (sale.packing ?: 1)} pack de ${sale.packing ?: "1"}"
|
||||
}
|
||||
|
||||
|
||||
if (sale.totalItemShelving > 1) {
|
||||
binding.txtQuantityReserved.text = textToConcat
|
||||
binding.txtQuantity.text = textToConcat2
|
||||
binding.txtReserveToComplete.text =
|
||||
"${sale.currentItemShelving}/${sale.totalItemShelving}"
|
||||
binding.txtReserveToComplete.visibility = VISIBLE
|
||||
binding.txtQuantity.text =
|
||||
"${sale.reservedQuantity}"
|
||||
} else {
|
||||
binding.txtQuantity.text = "${sale.reservedQuantity}"
|
||||
binding.txtReserveToComplete.visibility = GONE
|
||||
|
||||
}
|
||||
|
||||
} catch (ex: Exception) {
|
||||
ex.message!!.toast(context)
|
||||
}
|
||||
|
||||
|
||||
binding.txtReserveToComplete.text =
|
||||
"${sale.currentItemShelving}/${sale.totalItemShelving}"
|
||||
|
||||
//COLORES
|
||||
paintTicketcolor(sale.rgb, binding.itemTicketColor.background)
|
||||
if (sale.isPicked == 1) {
|
||||
if (type == PREPARED) {
|
||||
contentLayout.setBackgroundColor(
|
||||
|
||||
if (sale.saleGroupFk == null) {
|
||||
getColor(
|
||||
context!!, R.color.verdnatura_orange_salix
|
||||
)
|
||||
} else {
|
||||
println("stateCode ${sale.stateCode}")
|
||||
if (sale.stateCode != null && sale.stateCode == "PREPARED") {
|
||||
getColor(
|
||||
context!!, R.color.verdnatura_orange_salix
|
||||
)
|
||||
} else {
|
||||
if (sale.stateCode != null && sale.stateCode == "OK PREVIOUS") {
|
||||
getColor(
|
||||
context!!, R.color.verdnatura_dark_sky_blue
|
||||
)
|
||||
} else {
|
||||
if (sale.stateCode != null && sale.stateCode == "PREVIOUS_CONTROLLED") {
|
||||
getColor(
|
||||
context!!, R.color.verdnatura_dark_mint_light
|
||||
)
|
||||
} else {
|
||||
getColor(
|
||||
context!!, R.color.verdnatura_black
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
)
|
||||
} else {
|
||||
contentLayout.setBackgroundColor(
|
||||
getColor(
|
||||
context!!, R.color.verdnatura_dark_sky_blue
|
||||
)
|
||||
)
|
||||
}
|
||||
} else {
|
||||
contentLayout.setBackgroundColor(
|
||||
getColor(
|
||||
context!!, R.color.verdnatura_black
|
||||
)
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
binding.txtParking.text =
|
||||
// if (type == PREPARED) sale.parkingCodePrevia else sale.parkingCode
|
||||
sale.parkingCode ?: sale.parkingCodePrevia
|
||||
|
||||
binding.addItem.setOnClickListener {
|
||||
onAddItemClickListener!!.onAddItemClickListener(sale)
|
||||
}
|
||||
|
||||
if (type == PREITEMPICKERTEST) {
|
||||
binding.level.visibility = GONE
|
||||
binding.levelTxt.visibility = GONE
|
||||
binding.ticketOrder.visibility = VISIBLE
|
||||
binding.txtPoints.visibility = GONE
|
||||
} else {
|
||||
binding.level.visibility = VISIBLE
|
||||
binding.levelTxt.visibility = VISIBLE
|
||||
binding.ticketOrder.visibility = GONE
|
||||
binding.txtPoints.visibility = VISIBLE
|
||||
|
||||
}
|
||||
|
||||
this.sale = sale
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun paintTicketcolor(color: String?, backgroundDrawableTicket: Drawable) {
|
||||
|
||||
if (color.isNullOrBlank()) {
|
||||
DrawableCompat.setTint(
|
||||
backgroundDrawableTicket, Color.TRANSPARENT
|
||||
)
|
||||
} else {
|
||||
DrawableCompat.setTint(
|
||||
backgroundDrawableTicket, Color.parseColor(color)
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -8,14 +8,14 @@ import com.google.gson.JsonObject
|
|||
import es.verdnatura.MobileApplication
|
||||
import es.verdnatura.domain.SalixCallback
|
||||
import es.verdnatura.domain.formatWithQuotes
|
||||
import es.verdnatura.domain.getMessageFromAllResponse
|
||||
import es.verdnatura.domain.nameofFunction
|
||||
import es.verdnatura.domain.toast
|
||||
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
||||
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.PickupResponse
|
||||
import es.verdnatura.presentation.common.SaleTrackingReplaceSalix
|
||||
import es.verdnatura.presentation.common.TicketPickupResponse
|
||||
import es.verdnatura.presentation.common.TicketState
|
||||
import es.verdnatura.presentation.view.feature.collection.SalixSaleQuantity
|
||||
import es.verdnatura.presentation.view.feature.collection.mapper.map
|
||||
|
@ -27,6 +27,7 @@ import retrofit2.Response
|
|||
|
||||
class CollectionCheckerViewModel(val context: Context) : BaseViewModel(context) {
|
||||
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
|
||||
private val collectionViewModelChecker = CollectionViewModel(context)
|
||||
|
||||
//var isPaused: Boolean = false
|
||||
|
||||
|
@ -303,22 +304,21 @@ class CollectionCheckerViewModel(val context: Context) : BaseViewModel(context)
|
|||
fun ticketIsPickup(
|
||||
ticketFk: Number
|
||||
) {
|
||||
|
||||
salix.ticketIsPickup(
|
||||
"""{
|
||||
"where": {
|
||||
"id": $ticketFk
|
||||
},
|
||||
"fields": ["id", "routeFk"],
|
||||
"fields": ["id", "agencyModeFk"],
|
||||
"include": [
|
||||
{
|
||||
"relation": "route",
|
||||
"scope": {
|
||||
"fields": ["id", "agencyModeFk"],
|
||||
"include": {
|
||||
"relation": "agencyMode",
|
||||
"scope": {
|
||||
"fields": ["id", "deliveryMethodFk","code"],
|
||||
"where": {"code": "REC_ALG"},
|
||||
"fields": ["id", "deliveryMethodFk", "code"],
|
||||
"where": {
|
||||
"code": { "inq": ["REC_ALG", "PICKUP"] }
|
||||
},
|
||||
"include": {
|
||||
"relation": "deliveryMethod",
|
||||
"scope": {
|
||||
|
@ -327,17 +327,14 @@ class CollectionCheckerViewModel(val context: Context) : BaseViewModel(context)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}""".trim()
|
||||
|
||||
).enqueue(object : SalixCallback<List<PickupResponse>>(context) {
|
||||
override fun onSuccess(response: Response<List<PickupResponse>>) {
|
||||
).enqueue(object : SalixCallback<List<TicketPickupResponse>>(context) {
|
||||
override fun onSuccess(response: Response<List<TicketPickupResponse>>) {
|
||||
|
||||
_responseTicketIsPickup.value =
|
||||
response.body()
|
||||
?.firstOrNull()?.route?.agencyMode?.deliveryMethod?.code == "PICKUP"
|
||||
?.firstOrNull()?.agencyMode?.deliveryMethod?.code == "PICKUP"
|
||||
|
||||
}
|
||||
|
||||
|
@ -359,4 +356,14 @@ class CollectionCheckerViewModel(val context: Context) : BaseViewModel(context)
|
|||
_isPaused.value = paused
|
||||
}
|
||||
|
||||
fun itemShelvingSaleBySale(
|
||||
saleFk: Number, quantityDiff: Int
|
||||
|
||||
) {
|
||||
collectionViewModelChecker.itemShelvingSaleBySale(
|
||||
saleFk = saleFk,
|
||||
quantityDiff = quantityDiff
|
||||
)
|
||||
}
|
||||
|
||||
}
|
|
@ -79,6 +79,7 @@ class CollectionFragmentChecker(
|
|||
private var mistakeSale: SaleVO? = null
|
||||
private var positionIncreaseQuantity = 0
|
||||
private var quantityIncrease: Int = 0
|
||||
private var quantityIncreaseDiff: Int = 0
|
||||
private var isMarking = false
|
||||
private lateinit var ticketScanTxt: String
|
||||
private var lastScanned: Int = 0
|
||||
|
@ -304,8 +305,13 @@ class CollectionFragmentChecker(
|
|||
val myQr = ItemScanned(JSONObject(binding.scanInput.text.toString()))
|
||||
|
||||
when (myQr.table) {
|
||||
|
||||
"saleGroup" -> {
|
||||
if (sales.any { it.saleGroupFk == myQr.id.toString() }) {
|
||||
markPrevia(myQr.id.toString())
|
||||
} else {
|
||||
findSale(myQr.id.toString())
|
||||
}
|
||||
}
|
||||
|
||||
"buy" -> binding.scanInput.setText(myQr.more)
|
||||
|
@ -556,6 +562,8 @@ class CollectionFragmentChecker(
|
|||
sales = salesList.sortedWith(
|
||||
compareBy({ it.isControlled }, { it.picked })
|
||||
)
|
||||
|
||||
//para la nueva revisión : hay que poner el saleOrder si no no podrán revisar correctamente
|
||||
myGroupList = groupSaleGroup(salesList).sortedWith(
|
||||
compareBy({ it.isControlled }, { it.picked })
|
||||
)
|
||||
|
@ -1101,28 +1109,30 @@ class CollectionFragmentChecker(
|
|||
if (listItemSon.saleFk == saleFk) {
|
||||
myGroupList[parentIndex].sonSales[childIndex].quantity =
|
||||
quantityIncrease
|
||||
saleAdapter?.notifyDataSetChanged()
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (myGroupList[parentIndex].saleFk == saleFk) myGroupList[parentIndex].quantity =
|
||||
quantityIncrease
|
||||
|
||||
if (myGroupList[parentIndex].saleFk == saleFk) {
|
||||
myGroupList[parentIndex].quantity = quantityIncrease
|
||||
// myGroupList[positionIncreaseQuantity].quantity = quantityIncrease
|
||||
break
|
||||
}
|
||||
}/* } else {
|
||||
myGroupList[positionIncreaseQuantity].quantity = quantityIncrease
|
||||
saleAdapter?.notifyDataSetChanged()
|
||||
}*/
|
||||
}
|
||||
}
|
||||
viewModel.itemShelvingSaleBySale(saleFk = saleFk, quantityDiff = quantityIncreaseDiff)
|
||||
} catch (e: Exception) {
|
||||
e.message!!.toast(requireContext())
|
||||
}
|
||||
|
||||
saleAdapter?.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
private fun increaseQuantity(position: Int, quantity: Int) {
|
||||
positionIncreaseQuantity = position
|
||||
quantityIncrease = quantity
|
||||
quantityIncreaseDiff = (myGroupList[position].quantity!!.minus(quantity))
|
||||
viewModel.collectionIncreaseQuantitySalix(
|
||||
saleFk = myGroupList[position].saleFk, quantity = quantity.toString()
|
||||
)
|
||||
|
|
|
@ -844,7 +844,8 @@ class CollectionFragmentPicker(
|
|||
} else {
|
||||
// pintar línea
|
||||
saleAdapter!!.notifyDataSetChanged()
|
||||
myPosition = storedBackPosition
|
||||
//se modifica tenia storedBackPosition
|
||||
myPosition = storedPosition
|
||||
|
||||
ReviewQuantityForRefreshingAndSorting(
|
||||
sales[storedPosition].quantity!!.toInt(),
|
||||
|
@ -1007,15 +1008,7 @@ class CollectionFragmentPicker(
|
|||
type = type,
|
||||
onTicketColorClickListener = object : OnTicketColorListener {
|
||||
override fun onTicketColorListener(sale: SaleVO) {
|
||||
hasFilterByLevel = !hasFilterByLevel
|
||||
|
||||
if (hasFilterByLevel) {
|
||||
saleAdapter!!.updateSales(myGroupList.filter { it.level == sale.level } as MutableList)
|
||||
myGroupList = myGroupList.filter { it.level == sale.level }
|
||||
} else {
|
||||
createCollectionList()
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
|
@ -7,7 +7,11 @@ import android.os.Bundle
|
|||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
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.TypedValue
|
||||
import android.view.KeyEvent
|
||||
import android.view.View
|
||||
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.model.BarcodeVO
|
||||
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.main.activity.MainActivity
|
||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||
|
@ -78,7 +82,7 @@ import org.json.JSONObject
|
|||
variables:
|
||||
isVerifiedCollection
|
||||
*/
|
||||
class CollectionFragmentPickerPreviousNew(
|
||||
class CollectionFragmentPickerPreviousNewInterface(
|
||||
var collection: CollectionTicket,
|
||||
var type: String = PRESACADOR,
|
||||
private var hasPickingOrder: Boolean = false
|
||||
|
@ -86,7 +90,7 @@ class CollectionFragmentPickerPreviousNew(
|
|||
CollectionViewModel::class
|
||||
) {
|
||||
private var sales: List<Sale> = listOf()
|
||||
private var saleAdapter: SaleAdapterNew? = null
|
||||
private var saleAdapter: SaleAdapterReserve? = null
|
||||
private var lm: LinearLayoutManager? = null
|
||||
private var storedPosition: Int = 0
|
||||
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
|
||||
|
@ -115,7 +119,7 @@ class CollectionFragmentPickerPreviousNew(
|
|||
companion object {
|
||||
fun newInstance(
|
||||
collection: CollectionTicket, type: String, hasPickingOrder: Boolean = false
|
||||
) = CollectionFragmentPickerPreviousNew(collection, type, hasPickingOrder)
|
||||
) = CollectionFragmentPickerPreviousNewInterface(collection, type, hasPickingOrder)
|
||||
}
|
||||
|
||||
override fun onAttach(context: Context) {
|
||||
|
@ -137,6 +141,7 @@ class CollectionFragmentPickerPreviousNew(
|
|||
}
|
||||
|
||||
override fun init() {
|
||||
println("El tipo es $type ")
|
||||
customDialogList = CustomDialogList(requireContext())
|
||||
customDialogInput = CustomDialogInput(requireContext())
|
||||
customDialog = CustomDialog(requireContext())
|
||||
|
@ -154,9 +159,9 @@ class CollectionFragmentPickerPreviousNew(
|
|||
}
|
||||
|
||||
private fun setToolBar() {
|
||||
binding.mainToolbar.toolbarSubtitle.visibility = View.VISIBLE
|
||||
binding.mainToolbar.toolbarIcons.visibility = View.VISIBLE
|
||||
binding.mainToolbar.backButton.visibility = View.VISIBLE
|
||||
binding.mainToolbar.toolbarSubtitle.visibility = VISIBLE
|
||||
binding.mainToolbar.toolbarIcons.visibility = VISIBLE
|
||||
binding.mainToolbar.backButton.visibility = VISIBLE
|
||||
collection.collectionFk.let {
|
||||
binding.mainToolbar.toolbarTitle.text = collection.collectionFk.toString()
|
||||
}
|
||||
|
@ -233,6 +238,7 @@ class CollectionFragmentPickerPreviousNew(
|
|||
when (myQr.table) {
|
||||
"saleGroup" -> {
|
||||
binding.scanInput.setText(myQr.id.toString())
|
||||
findSale(binding.scanInput.text.toString())
|
||||
}
|
||||
|
||||
"buy" -> binding.scanInput.setText(myQr.more)
|
||||
|
@ -433,19 +439,22 @@ class CollectionFragmentPickerPreviousNew(
|
|||
}
|
||||
|
||||
|
||||
saleAdapter = SaleAdapterNew(myGroupList, pasillerosItemClickListener!!,
|
||||
saleAdapter = SaleAdapterReserve(myGroupList, pasillerosItemClickListener!!,
|
||||
|
||||
object : OnSaleClickSaleListener {
|
||||
override fun onSaleClick(sale: Sale) {
|
||||
|
||||
println("sale ${sale.saleFk} ${sale.itemFk} ${sale.isPicked}")
|
||||
val position =
|
||||
myGroupList.indexOfFirst { it.itemShelvingSaleFk == sale.itemShelvingSaleFk }
|
||||
if (position > -1) {
|
||||
if (position > -1 && !myGroupList[position].isParent) {
|
||||
if (sale.isPicked == 1) {
|
||||
unMarkLine(position, myGroupList[position])
|
||||
} else {
|
||||
showScanner(position, sale)
|
||||
}
|
||||
} else {
|
||||
//TODO desmarcamos una linea de previa ?
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -559,14 +568,27 @@ class CollectionFragmentPickerPreviousNew(
|
|||
isFoundSale = true
|
||||
storedPosition = indice
|
||||
viewModel.itemShelvingSaleSetSaleGroup(txtscan.toInt())
|
||||
setStateSaleGroup(txtscan.toInt())
|
||||
//actualizamos padre
|
||||
myGroupList[indice].stateCode =
|
||||
if (myGroupList[indice].stateCode == "PREPARED") {
|
||||
"OK PREVIOUS"
|
||||
} else {
|
||||
"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
|
||||
|
||||
}
|
||||
|
@ -590,7 +612,10 @@ class CollectionFragmentPickerPreviousNew(
|
|||
for (indice in sales.indices) {
|
||||
if (sales[indice].saleGroupFk != null && sales[indice].saleGroupFk == saleGroupScanned.toInt()) {
|
||||
viewModel.itemShelvingSaleSetSaleGroup(saleGroupScanned.toInt())
|
||||
setStateSaleGroup(saleGroupScanned.toInt())
|
||||
setStateSaleGroup(
|
||||
saleGroupScanned.toInt(),
|
||||
if (sales[indice].stateCode == "PREPARED") 28 else 14
|
||||
)
|
||||
storedPosition = indice
|
||||
mpok!!.start()
|
||||
return true
|
||||
|
@ -708,8 +733,21 @@ class CollectionFragmentPickerPreviousNew(
|
|||
val longName = myGroupList[pos].longName
|
||||
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 {
|
||||
customDialogList.setTitle("$shelving($item) $totalReserved de $longName").setOkButton(
|
||||
customDialogList.setTitleSpannable(spannable)
|
||||
customDialogList.setOkButton(
|
||||
getString(
|
||||
R.string.take
|
||||
)
|
||||
|
@ -721,7 +759,9 @@ class CollectionFragmentPickerPreviousNew(
|
|||
customDialogList.dismiss()
|
||||
scanRequest()
|
||||
|
||||
}.setHintValue(getString(R.string.quantitySelect)).setValue(totalReserved.toString())
|
||||
}.setHintValue(getString(R.string.quantitySelect))
|
||||
.setTextSize(20f)
|
||||
.setValue(totalReserved.toString())
|
||||
.setHintValueTwo(getString(R.string.scanItem)).setValueTwo("").show()
|
||||
|
||||
customDialogList.getEditTextTwo().setOnEditorActionListener { v, actionId, event ->
|
||||
|
@ -784,7 +824,11 @@ class CollectionFragmentPickerPreviousNew(
|
|||
mpok?.start()
|
||||
ma.hideKeyboard(customDialogList.getEditTextTwo())
|
||||
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()
|
||||
|
||||
} else {
|
||||
|
@ -1059,7 +1103,7 @@ class CollectionFragmentPickerPreviousNew(
|
|||
}
|
||||
if (distinctSaleGroups.isNotEmpty())
|
||||
distinctSaleGroups.forEach { saleGroup ->
|
||||
setStateSaleGroup(saleGroup)
|
||||
setStateSaleGroup(saleGroup, stateCodeId!!)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1067,8 +1111,8 @@ class CollectionFragmentPickerPreviousNew(
|
|||
}
|
||||
}
|
||||
|
||||
private fun setStateSaleGroup(saleGroup: Number) {
|
||||
viewModel.saleGroupUpdateState(saleGroup, stateCodeId!!)
|
||||
private fun setStateSaleGroup(saleGroup: Number, stateCode: Number) {
|
||||
viewModel.saleGroupUpdateState(saleGroup, stateCode)
|
||||
}
|
||||
|
||||
private fun showScanner(index: Int, sale: Sale) {
|
||||
|
@ -1123,6 +1167,8 @@ class CollectionFragmentPickerPreviousNew(
|
|||
}
|
||||
} else { // si tiene saleGroup se crea el padre con el tamaño e indicando que es padre, como ejemplo se toma el primer elemento
|
||||
/*crea padre*/
|
||||
|
||||
println("saleGroup $key lineas ${value.size}")
|
||||
if (value.size > 1) {
|
||||
val mySale = //= value[0]
|
||||
Sale(
|
||||
|
@ -1143,8 +1189,11 @@ class CollectionFragmentPickerPreviousNew(
|
|||
origin = value[0].origin,
|
||||
size = value[0].size,
|
||||
itemShelvingSaleFk = value[0].itemShelvingSaleFk,
|
||||
longName = value[0].parkingCode ?: "",
|
||||
itemShelvingFk = 0
|
||||
longName = value[0].parkingCodePrevia ?: "",
|
||||
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
|
||||
|
@ -1204,7 +1253,7 @@ class CollectionFragmentPickerPreviousNew(
|
|||
if (foundTicketInCollection != null) {
|
||||
isVerifiedCollection = true
|
||||
ma.hideKeyboard(customDialogList.getEditText())
|
||||
binding.fragmentSacadorCollections.visibility = View.VISIBLE
|
||||
binding.fragmentSacadorCollections.visibility = VISIBLE
|
||||
customDialogList.dismiss()
|
||||
binding.scanInput.requestFocus()
|
||||
} else {
|
File diff suppressed because it is too large
Load Diff
|
@ -103,6 +103,7 @@ class CollectionFragmentPreChecker(
|
|||
private var positionIncreaseQuantity = 0
|
||||
private var positionReject = 0
|
||||
private var quantityIncrease: Int = 0
|
||||
private var quantityIncreaseDiff: Int = 0
|
||||
private var quantityReject = ""
|
||||
private var typeCollectionMissing = ""
|
||||
private var positionCollectionMissing = 0
|
||||
|
@ -981,10 +982,11 @@ class CollectionFragmentPreChecker(
|
|||
sales = salesList.sortedWith(compareBy({ it.picked }))
|
||||
}
|
||||
}
|
||||
|
||||
saleAdapter =
|
||||
SaleAdapter(
|
||||
sales as MutableList,
|
||||
if (sales.isEmpty()) sales.toMutableList() else {
|
||||
sales as MutableList
|
||||
},
|
||||
pasillerosItemClickListener!!,
|
||||
object : OnQuantityClickListener {
|
||||
|
||||
|
@ -1088,10 +1090,11 @@ class CollectionFragmentPreChecker(
|
|||
setListPosition(storedBackPosition, true)
|
||||
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
printObservations(observations)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setScrollListener(lm: LinearLayoutManager) {
|
||||
binding.fragmentSacadorCollections.clearOnScrollListeners()
|
||||
|
@ -1533,7 +1536,6 @@ class CollectionFragmentPreChecker(
|
|||
)
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
private fun printShelvingResult(placementSupplyListVO: PlacementSupplyListVO) {
|
||||
var shelving = ""
|
||||
var item = ""
|
||||
|
@ -1630,7 +1632,7 @@ class CollectionFragmentPreChecker(
|
|||
requireActivity().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
lManager.hideSoftInputFromWindow(
|
||||
customDialogList.getEditTextTwo().windowToken,
|
||||
InputMethodManager.SHOW_IMPLICIT
|
||||
InputMethodManager.HIDE_IMPLICIT_ONLY
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -2024,8 +2026,22 @@ class CollectionFragmentPreChecker(
|
|||
|
||||
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() {
|
||||
|
||||
|
@ -2087,49 +2103,19 @@ class CollectionFragmentPreChecker(
|
|||
private fun showQuantityDialog(position: Int) {
|
||||
customDialogThreeButtons.setDescription(getString(R.string.itemSaleQuantity))
|
||||
.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)) {
|
||||
/* checkAndCall(
|
||||
position,
|
||||
customDialogThreeButtons.getValue(),
|
||||
getString(R.string.Agregar)
|
||||
)*/
|
||||
if (customDialogThreeButtons.getValue().isNotEmpty()) {
|
||||
increaseQuantity(position, customDialogThreeButtons.getValue().toInt())
|
||||
scanRequest()
|
||||
customDialogThreeButtons.dismiss()
|
||||
} else {
|
||||
ma.messageWithSound(
|
||||
getString(R.string.errorInputQuantity),
|
||||
isError = true,
|
||||
isPlayed = true,
|
||||
isToasted = true
|
||||
)
|
||||
}
|
||||
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
scanRequest()
|
||||
|
@ -2175,15 +2161,21 @@ class CollectionFragmentPreChecker(
|
|||
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
saleAdapter?.notifyDataSetChanged()
|
||||
|
||||
sales[positionIncreaseQuantity].originalQuantity = quantityIncrease
|
||||
saleAdapter?.notifyDataSetChanged()
|
||||
|
||||
viewModel.itemShelvingSaleBySale(
|
||||
sales[positionIncreaseQuantity].saleFk,
|
||||
quantityIncreaseDiff
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
private fun increaseQuantity(position: Int, quantity: Int) {
|
||||
positionIncreaseQuantity = position
|
||||
quantityIncrease = quantity
|
||||
quantityIncreaseDiff = sales[position].quantity!!.minus(quantityIncrease)
|
||||
|
||||
viewModel.collectionIncreaseQuantitySalix(
|
||||
saleFk = sales[position].saleFk,
|
||||
|
|
|
@ -6,13 +6,14 @@ import androidx.lifecycle.MutableLiveData
|
|||
import androidx.lifecycle.map
|
||||
import com.google.gson.JsonObject
|
||||
import es.verdnatura.MobileApplication
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.domain.SalixCallback
|
||||
import es.verdnatura.domain.formatWithQuotes
|
||||
import es.verdnatura.domain.getMessageFromAllResponse
|
||||
import es.verdnatura.domain.nameofFunction
|
||||
import es.verdnatura.domain.toast
|
||||
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
||||
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.ItemShelving
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
|
@ -24,10 +25,12 @@ import es.verdnatura.presentation.view.feature.collection.SalixSaleQuantity
|
|||
import es.verdnatura.presentation.view.feature.collection.mapper.map
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionTicket
|
||||
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.MistakeTypeVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.PlacementSupplyListVO
|
||||
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.SaleTrackingDelSalix
|
||||
import retrofit2.Response
|
||||
|
@ -192,6 +195,11 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
val responseStateId: LiveData<Number> = _responseStateId
|
||||
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>() }
|
||||
val mistakeList: LiveData<MistakeTypeListVO>
|
||||
get() = _mistakeList
|
||||
|
@ -347,6 +355,54 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun itemShelvingSaleBySale(
|
||||
saleFk: Number, quantityDiff: Int
|
||||
|
||||
) {
|
||||
salix.itemShelvingSaleTotalBySale(
|
||||
filter = """{"where":{"saleFk":$saleFk},"limit":2}"""
|
||||
).enqueue(object : SalixCallback<List<ItemShelvingSale>>(context) {
|
||||
|
||||
override fun onSuccess(response: Response<List<ItemShelvingSale>>) {
|
||||
|
||||
if (!response.body().isNullOrEmpty()) {
|
||||
if (response.body()!!.size == 1) {
|
||||
val itemList = response.body()
|
||||
val itemShelvingFk = itemList?.firstOrNull()?.itemShelvingFk
|
||||
salix.itemShelvingGet(
|
||||
id = itemShelvingFk!!
|
||||
).enqueue(object : SalixCallback<ItemShelving>(context) {
|
||||
|
||||
override fun onSuccess(response: Response<ItemShelving>) {
|
||||
|
||||
if (response.body() != null) {
|
||||
val visible = response.body()!!.visible!!.toInt()
|
||||
val differenceVisible = (visible + quantityDiff)
|
||||
val available = response.body()!!.available!!.toInt()
|
||||
val differenceAvailable = (available + quantityDiff)
|
||||
|
||||
val updateParams = mapOf(
|
||||
"visible" to (differenceVisible),
|
||||
"available" to (differenceAvailable)
|
||||
)
|
||||
|
||||
salix.itemShelvingUpdate(
|
||||
id = itemShelvingFk, params = updateParams
|
||||
).enqueue(object : SalixCallback<ItemUbicador?>(context) {
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun itemShelvingGet(
|
||||
itemShelvingFk: Number, position: Int, quantity: Int
|
||||
|
||||
|
@ -502,6 +558,10 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
_responseCollectionAddItem.value = true
|
||||
}
|
||||
|
||||
override fun onError(t: Throwable) {
|
||||
|
||||
super.onError(Throwable(context.getString(R.string.errorAddItemReserva)))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -519,6 +579,20 @@ class CollectionViewModel(val context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun getStatePreparedId(stateCode: String) {
|
||||
|
||||
salix.getStateId(
|
||||
filter = """{"where":{"code":"$stateCode"}, "fields":["id"]}""".trimMargin()
|
||||
).enqueue(object : SalixCallback<JsonObject>(context) {
|
||||
override fun onSuccess(response: Response<JsonObject>) {
|
||||
_responseStatePreparedId.value =
|
||||
response.body()?.get("id").toString().toInt()
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun setStateSaleGroup(
|
||||
saleGroups: List<Number>, stateCode: Int
|
||||
) {
|
||||
|
|
|
@ -8,11 +8,11 @@ import com.google.gson.JsonObject
|
|||
import es.verdnatura.MobileApplication
|
||||
import es.verdnatura.domain.SalixCallback
|
||||
import es.verdnatura.domain.formatWithQuotes
|
||||
import es.verdnatura.domain.getMessageFromAllResponse
|
||||
import es.verdnatura.domain.nameofFunction
|
||||
import es.verdnatura.domain.toast
|
||||
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
||||
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.ResponseItemExistsItemShelvingSale
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
|
|
|
@ -5,9 +5,9 @@ import es.verdnatura.R
|
|||
import es.verdnatura.presentation.common.convertToDateString
|
||||
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.PlacementSupplyVO
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Calendar
|
||||
import java.util.Locale
|
||||
|
||||
fun CollectionVO.map(context: Context): CollectionVO {
|
||||
try {
|
||||
|
@ -86,17 +86,8 @@ fun CollectionTicket.map(context: Context): CollectionTicket {
|
|||
}
|
||||
|
||||
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()
|
||||
cal.time = sdf.parse(date)!!
|
||||
return cal
|
||||
}
|
||||
|
||||
// para cuando se pase a Salix el modelo
|
||||
//Tarea 5134
|
||||
fun PlacementSupplyVO.proposal(context: Context): PlacementSupplyVO {
|
||||
try {
|
||||
} catch (ex: Exception) {
|
||||
}
|
||||
return this
|
||||
}
|
|
@ -1,356 +0,0 @@
|
|||
package es.verdnatura.presentation.view.feature.controlvehiculo.fragment
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.util.TypedValue
|
||||
import android.view.View.GONE
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import android.widget.ImageView
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentVehiclecontrolBinding
|
||||
import es.verdnatura.domain.toast
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.common.OnCollectionSelectedListener
|
||||
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
||||
import es.verdnatura.presentation.common.TAG
|
||||
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
||||
import es.verdnatura.presentation.common.hideKeyboard
|
||||
import es.verdnatura.presentation.view.component.CustomDialog
|
||||
import es.verdnatura.presentation.view.component.CustomDialogInput
|
||||
import es.verdnatura.presentation.view.component.CustomDialogThreeButtons
|
||||
import es.verdnatura.presentation.view.feature.historicovehiculo.fragment.HistoricoVehiculoFragment
|
||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||
import es.verdnatura.presentation.view.feature.sacador.fragment.SacadorFragment
|
||||
|
||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||
class ControlVehiculoFragment(
|
||||
private var tagName: String = ""
|
||||
) : BaseFragment<FragmentVehiclecontrolBinding, ControlVehiculoViewModel>(
|
||||
ControlVehiculoViewModel::class
|
||||
) {
|
||||
|
||||
private var goBack: Boolean = false
|
||||
private var onCollectionSelectedListener: OnCollectionSelectedListener? = null
|
||||
override fun getLayoutId(): Int = R.layout.fragment_vehiclecontrol
|
||||
private lateinit var customDialog: CustomDialog
|
||||
private var isWorkedTimed = "UNREGISTERED"
|
||||
private lateinit var customDialogInput: CustomDialogInput
|
||||
private lateinit var customDialogThreeButtons: CustomDialogThreeButtons
|
||||
|
||||
companion object {
|
||||
fun newInstance(tagName: String) = ControlVehiculoFragment(tagName)
|
||||
}
|
||||
|
||||
override fun onAttach(context: Context) {
|
||||
super.onAttach(context)
|
||||
if (context is OnCollectionSelectedListener) onCollectionSelectedListener = context
|
||||
}
|
||||
|
||||
override fun init() {
|
||||
|
||||
customDialog = CustomDialog(requireContext())
|
||||
customDialogInput = CustomDialogInput(requireContext())
|
||||
customDialogThreeButtons = CustomDialogThreeButtons(requireContext())
|
||||
goBack = false
|
||||
if (tagName == HistoricoVehiculoFragment.TAG) {
|
||||
setToolBar("HISTORY")
|
||||
showScanner(getString(R.string.scanShelvingHistorical), "HISTORY")
|
||||
} else {
|
||||
|
||||
checkControlTimeVehicle()
|
||||
setToolBar("ALL")
|
||||
}
|
||||
|
||||
|
||||
setEvents()
|
||||
super.init()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
goBack = true
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
private fun setToolBar(direction: String?) {
|
||||
|
||||
binding.mainToolbar.toolbarTitle.text = getString(R.string.vehiclecontrol)
|
||||
binding.mainToolbar.toolbarTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13F)
|
||||
|
||||
val listIcons: ArrayList<ImageView> = ArrayList()
|
||||
val iconHistory = ImageView(context)
|
||||
iconHistory.setImageResource(R.drawable.ic_history_black_24dp)
|
||||
val iconVehicleIn = ImageView(context)
|
||||
iconVehicleIn.setImageResource(R.drawable.car)
|
||||
val iconVehicleOut = ImageView(context)
|
||||
iconVehicleOut.setImageResource(R.drawable.car_off)
|
||||
|
||||
iconHistory.tooltipText = getTooltip(R.drawable.ic_history_black_24dp)
|
||||
iconVehicleIn.tooltipText = getTooltip(R.drawable.car)
|
||||
iconVehicleOut.tooltipText = getTooltip(R.drawable.car_off)
|
||||
|
||||
when (direction) {
|
||||
"OUT" -> {
|
||||
listIcons.remove(iconVehicleIn)
|
||||
listIcons.add(iconVehicleOut)
|
||||
listIcons.add(iconHistory)
|
||||
}
|
||||
|
||||
"IN" -> {
|
||||
listIcons.remove(iconVehicleOut)
|
||||
listIcons.add(iconVehicleIn)
|
||||
listIcons.add(iconHistory)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
binding.mainToolbar.toolbarIcons.adapter =
|
||||
ToolBarAdapterTooltip(listIcons, object : OnOptionsSelectedListener {
|
||||
override fun onOptionsItemSelected(item: Drawable) {
|
||||
|
||||
when (item) {
|
||||
iconHistory.drawable -> showScanner(
|
||||
getString(R.string.scanShelvingHistorical), "HISTORY"
|
||||
)
|
||||
|
||||
iconVehicleIn.drawable -> showScanner(getString(R.string.scanPlate), "IN")
|
||||
iconVehicleOut.drawable -> showScanner(
|
||||
getString(R.string.scanPlateTakeoff), "OUT"
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
binding.mainToolbar.toolbarIcons.layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||
}
|
||||
|
||||
private fun showScanner(description: String, action: String) {
|
||||
|
||||
customDialogInput.setTitle(getString(R.string.vehiclecontrol)).setDescription(description)
|
||||
.setOkButton(getString(R.string.accept)) {
|
||||
if (customDialogInput.getValue().isNotEmpty()) {
|
||||
insertControlTimeVehicle(customDialogInput.getValue(), action)
|
||||
}
|
||||
}
|
||||
|
||||
.setKoButton(getString(R.string.cancel)) {
|
||||
customDialogInput.dismiss()
|
||||
if (tagName == HistoricoVehiculoFragment.TAG) {
|
||||
ma.onMyBackPressed()
|
||||
}
|
||||
|
||||
}.setValue("").show()
|
||||
|
||||
customDialogInput.setFocusText()
|
||||
|
||||
customDialogInput.getEditText().setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
|
||||
if (customDialogInput.getValue().isNotEmpty()) {
|
||||
insertControlTimeVehicle(customDialogInput.getValue(), action)
|
||||
}
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun checkControlTimeVehicle() {
|
||||
|
||||
if (!goBack) {
|
||||
try {
|
||||
viewModel.workerMachineryIsRegistered(mobileApplication.userId!!)
|
||||
} catch (ex: Exception) {
|
||||
ma.messageWithSound(
|
||||
message = getString(R.string.errorUserId),
|
||||
isError = true,
|
||||
isToasted = true,
|
||||
isPlayed = true
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private fun insertControlTimeVehicle(plateNumber: String, direction: String) {
|
||||
|
||||
when (direction) {
|
||||
"HISTORY" -> {
|
||||
ma.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(title = R.string.titleHistoricalHide), plateNumber
|
||||
)
|
||||
}
|
||||
|
||||
"IN" -> {
|
||||
viewModel.machineWorkerUpdate(plateNumber)
|
||||
}
|
||||
|
||||
"OUT" -> {
|
||||
viewModel.machineWorkerUpdate(plateNumber)
|
||||
}
|
||||
|
||||
"" -> {
|
||||
ma.openFragmentPickers(true)
|
||||
}
|
||||
}
|
||||
|
||||
customDialogInput.setValue("")
|
||||
scanRequest()
|
||||
customDialogInput.dismiss()
|
||||
hideKeyboards()
|
||||
}
|
||||
|
||||
private fun scanRequest() {
|
||||
binding.scanInput.requestFocus()
|
||||
hideKeyboards()
|
||||
}
|
||||
|
||||
private fun hideKeyboards() {
|
||||
try {
|
||||
requireActivity().hideKeyboard()
|
||||
} catch (e: Exception) {
|
||||
println(e.message)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setEvents() {
|
||||
|
||||
binding.mainToolbar.backButton.setOnClickListener {
|
||||
ma.openFragmentPickers(true)
|
||||
|
||||
}
|
||||
|
||||
binding.scanInput.requestFocus()
|
||||
binding.scanInput.setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0) {
|
||||
if (!binding.scanInput.text.isNullOrEmpty()) {
|
||||
|
||||
if (tagName == HistoricoVehiculoFragment.TAG) {
|
||||
showOptionsHistorical(binding.scanInput.text.toString())
|
||||
} else {
|
||||
showOptionsVehicleControl(binding.scanInput.text.toString())
|
||||
}
|
||||
}
|
||||
binding.scanInput.setText("")
|
||||
ma.hideKeyboard(binding.scanInput)
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
private fun showOptionsVehicleControl(plate: String) {
|
||||
|
||||
customDialogThreeButtons.setCustomDialogValue(GONE)
|
||||
|
||||
customDialogThreeButtons.setDescription(getString(R.string.doVehiclePlate) + plate + "?")
|
||||
.setValue(plate)
|
||||
if (isWorkedTimed == "UNREGISTERED") {
|
||||
customDialogThreeButtons.setOkButtonTwo("COGER") {
|
||||
if (customDialogThreeButtons.getValue().trim().isEmpty()) {
|
||||
getString(R.string.returnScan).toast(requireContext())
|
||||
} else {
|
||||
customDialogThreeButtons.dismiss()
|
||||
insertControlTimeVehicle(customDialogThreeButtons.getValue(), "IN")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
customDialogThreeButtons.setOkButtonThree("DEJAR") {
|
||||
if (customDialogThreeButtons.getValue().trim().isEmpty()) {
|
||||
getString(R.string.returnScan).toast(requireContext())
|
||||
} else {
|
||||
customDialogThreeButtons.dismiss()
|
||||
insertControlTimeVehicle(customDialogThreeButtons.getValue(), "OUT")
|
||||
}
|
||||
}
|
||||
}.setOkButtonFour(getString(R.string.historical)) {
|
||||
if (customDialogThreeButtons.getValue().trim().isEmpty()) {
|
||||
getString(R.string.returnScan).toast(requireContext())
|
||||
} else {
|
||||
customDialogThreeButtons.dismiss()
|
||||
insertControlTimeVehicle(customDialogThreeButtons.getValue(), "HISTORY")
|
||||
|
||||
}
|
||||
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
scanRequest()
|
||||
customDialogThreeButtons.dismiss()
|
||||
}.show()
|
||||
}
|
||||
|
||||
private fun showOptionsHistorical(plate: String) {
|
||||
|
||||
customDialogThreeButtons.setCustomDialogValue(GONE)
|
||||
|
||||
customDialogThreeButtons.setDescription(getString(R.string.doVehiclePlate) + plate + "?")
|
||||
|
||||
.setValue(plate)
|
||||
|
||||
.setOkButtonFour(getString(R.string.historical)) {
|
||||
if (customDialogThreeButtons.getValue().trim().isEmpty()) {
|
||||
getString(R.string.returnScan).toast(requireContext())
|
||||
} else {
|
||||
customDialogThreeButtons.dismiss()
|
||||
insertControlTimeVehicle(customDialogThreeButtons.getValue(), "HISTORY")
|
||||
|
||||
}
|
||||
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
scanRequest()
|
||||
customDialogThreeButtons.dismiss()
|
||||
}.show()
|
||||
}
|
||||
|
||||
override fun observeViewModel() {
|
||||
|
||||
with(viewModel) {
|
||||
responseUpdate.observe(viewLifecycleOwner) {
|
||||
ma.openFragmentPickers(false)
|
||||
}
|
||||
|
||||
responseControl.observe(viewLifecycleOwner) {
|
||||
|
||||
if (it == "1") {
|
||||
isWorkedTimed = "REGISTERED"
|
||||
setToolBar("OUT")
|
||||
|
||||
if (tagName != SacadorFragment.TAG) {
|
||||
ma.openFragmentPickers(false)
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (it == "0") {
|
||||
setToolBar("IN")
|
||||
|
||||
customDialogInput.setTitle(getString(R.string.vehiclecontrol))
|
||||
.setDescription(getString(R.string.scanPlate))
|
||||
.setOkButton(getString(R.string.takeVehicle)) {
|
||||
if (customDialogInput.getValue().isNotEmpty()) {
|
||||
insertControlTimeVehicle(customDialogInput.getValue(), "IN")
|
||||
}
|
||||
customDialogInput.setValue("")
|
||||
scanRequest()
|
||||
customDialogInput.dismiss()
|
||||
hideKeyboards()
|
||||
}
|
||||
|
||||
.setKoButton(getString(R.string.noVehicle)) {
|
||||
customDialogInput.dismiss()
|
||||
ma.openFragmentPickers(true)
|
||||
|
||||
}.setValue("").show()
|
||||
|
||||
customDialogInput.setFocusText()
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -16,44 +16,12 @@ import retrofit2.Response
|
|||
|
||||
class ControlVehiculoViewModel(val context: Context) : BaseViewModel(context) {
|
||||
|
||||
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>() }
|
||||
val responseMachine: LiveData<ResponseItemMachineControl>
|
||||
get() = _responseMachine
|
||||
|
||||
private val _responseGetName by lazy { MutableLiveData<NameWorker>() }
|
||||
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) {
|
||||
|
||||
|
|
|
@ -199,10 +199,10 @@ class LoadUnloadFragment(
|
|||
ExpeditionSalixPosition(
|
||||
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") {
|
||||
"NOT SCANNED"
|
||||
} else {
|
||||
if (state == "DELIVERED" && l.code != "DELIVERED") "LOST" else l.code
|
||||
if (state == "DELIVERED" && l.code != "DELIVERED") "PENDING" else l.code
|
||||
}
|
||||
},
|
||||
isScanned = l.isScanned,
|
||||
|
@ -273,7 +273,7 @@ class LoadUnloadFragment(
|
|||
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 (!binding.scanInput.text.isNullOrEmpty()) {
|
||||
|
@ -478,7 +478,7 @@ class LoadUnloadFragment(
|
|||
code = if (item.code == "DELIVERED" || item.code == "ON DELIVERY") {
|
||||
item.code
|
||||
} else {
|
||||
"LOST"
|
||||
"PENDING"
|
||||
},
|
||||
nickname = item.nickname,
|
||||
postalCode = item.postalCode
|
||||
|
@ -595,7 +595,7 @@ class LoadUnloadFragment(
|
|||
override fun onBackPressedHandled(): Boolean {
|
||||
|
||||
if (scanned) {
|
||||
var customDialog = CustomDialog(requireContext())
|
||||
val customDialog = CustomDialog(requireContext())
|
||||
customDialog.setTitle(getString(R.string.packagesNotScanned))
|
||||
.setDescription(getString(R.string.savePackages))
|
||||
.setOkButton(getString(R.string.yes)) {
|
||||
|
|
|
@ -429,22 +429,17 @@ class TicketsFragment : BaseFragment<FragmentTicketsBinding, DeliveryViewModel>(
|
|||
override fun onItemButtonCMRRowClickListener(
|
||||
item: Ticket
|
||||
) {
|
||||
ma.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(
|
||||
title = R.string.titleWebViewer,
|
||||
), entryPoint = Gson().toJson(
|
||||
mutableMapOf(
|
||||
"entryPoint" to route.id,
|
||||
"web" to "${
|
||||
mobileApplication.dataStoreApp.getServerSalix()
|
||||
}/api/Cmrs/${item.cmrFk}/print?access_token=${
|
||||
|
||||
val url =
|
||||
"${mobileApplication.dataStoreApp.getServerLilium()}/api/Cmrs/${item.cmrFk}/print?access_token=${
|
||||
mobileApplication.dataStoreApp.readDataStoreKey<String>(
|
||||
TOKEN
|
||||
)
|
||||
}"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
val intent = Intent(Intent.ACTION_QUICK_VIEW, Uri.parse(url))
|
||||
intent.setDataAndType(Uri.parse(url), "application/pdf")
|
||||
startActivity(intent)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -7,13 +7,16 @@ import androidx.recyclerview.widget.RecyclerView
|
|||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.ItemHistoricoRowBinding
|
||||
import es.verdnatura.presentation.common.OnClientHistoricItemClickListener
|
||||
import es.verdnatura.presentation.common.OnOutQuantityHistoricItemClickListener
|
||||
import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoVO
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
|
||||
class HistoricoAdapter(
|
||||
private val items: List<ItemHistoricoVO>,
|
||||
private val onClientHistoricItemClickListener: OnClientHistoricItemClickListener
|
||||
private val onClientHistoricItemClickListener: OnClientHistoricItemClickListener,
|
||||
private val onOutQuantityHistoricItemClickListener: OnOutQuantityHistoricItemClickListener
|
||||
) : RecyclerView.Adapter<HistoricoAdapter.ItemHolder>() {
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
|
||||
|
@ -36,7 +39,7 @@ class HistoricoAdapter(
|
|||
binding.apply {
|
||||
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())
|
||||
|
||||
historicoDate.setBackgroundColor(
|
||||
|
@ -76,6 +79,14 @@ class HistoricoAdapter(
|
|||
clientName.setOnClickListener {
|
||||
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,
|
||||
) {
|
||||
|
||||
|
||||
when (stateName?.lowercase()) {
|
||||
"preparado", "en preparación", "autoimpreso", "impreso" -> {
|
||||
binding.clientName.setBackgroundColor(
|
||||
|
|
|
@ -16,6 +16,7 @@ import es.verdnatura.domain.notNull
|
|||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.common.OnClientHistoricItemClickListener
|
||||
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
||||
import es.verdnatura.presentation.common.OnOutQuantityHistoricItemClickListener
|
||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
||||
import es.verdnatura.presentation.view.component.CustomDialog
|
||||
|
@ -23,6 +24,7 @@ import es.verdnatura.presentation.view.feature.historicoarticulo.adapter.Histori
|
|||
import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoListVO
|
||||
import es.verdnatura.presentation.view.feature.historicoarticulo.model.ItemHistoricoVO
|
||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||
import java.net.URLEncoder
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
|
@ -242,6 +244,71 @@ class HistoricoArticuloFragment(
|
|||
|
||||
}
|
||||
}
|
||||
}, object : OnOutQuantityHistoricItemClickListener {
|
||||
override fun onOutQuantityHistoricItemClickListener(item: ItemHistoricoVO) {
|
||||
|
||||
val baseUrl =
|
||||
"${mobileApplication.dataStoreApp.getServerLilium()}/#/ticket/${item.originId}/log"
|
||||
val logsJson = """
|
||||
{
|
||||
"filter": {
|
||||
"limit": 20,
|
||||
"fields": [
|
||||
"id",
|
||||
"originFk",
|
||||
"userFk",
|
||||
"action",
|
||||
"changedModel",
|
||||
"oldInstance",
|
||||
"newInstance",
|
||||
"creationDate",
|
||||
"changedModelId",
|
||||
"changedModelValue",
|
||||
"description",
|
||||
"summaryId"
|
||||
],
|
||||
"where": {
|
||||
"and": [
|
||||
{
|
||||
"originFk": "${item.originId}"
|
||||
},
|
||||
{
|
||||
"or": [
|
||||
{
|
||||
"oldJson": {
|
||||
"like": "%${itemFk}%"
|
||||
}
|
||||
},
|
||||
{
|
||||
"newJson": {
|
||||
"like": "%${itemFk}%"
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": {
|
||||
"like": "%${itemFk}%"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"skip": 0
|
||||
}
|
||||
}
|
||||
""".trimIndent()
|
||||
val encodedJson = URLEncoder.encode(logsJson, "UTF-8")
|
||||
val entryPoint = Gson().toJson(
|
||||
mutableMapOf(
|
||||
"entryPoint" to item.entityId, "web" to "$baseUrl?logs=$encodedJson"
|
||||
)
|
||||
)
|
||||
ma.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(
|
||||
title = R.string.titleWebViewer,
|
||||
), entryPoint = entryPoint
|
||||
)
|
||||
}
|
||||
})
|
||||
binding.historicoRecyclerview.adapter = adapter
|
||||
binding.historicoRecyclerview.layoutManager =
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
package es.verdnatura.presentation.view.feature.historicoshelving.adapter
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.ItemShelvinglogRowBinding
|
||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||
import es.verdnatura.presentation.view.feature.historicoshelving.model.ItemShelvingLog
|
||||
import es.verdnatura.presentation.view.feature.pasillero.model.PasillerosItemVO
|
||||
|
||||
class ItemShelvingLogAdapter(
|
||||
private var items: List<ItemShelvingLog>,
|
||||
private val onPasillerosItemClickListener: OnPasillerosItemClickListener
|
||||
) : RecyclerView.Adapter<ItemShelvingLogAdapter.ItemHolder>() {
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
|
||||
return ItemHolder(
|
||||
ItemShelvinglogRowBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
)
|
||||
}
|
||||
|
||||
override fun getItemCount() = items.size
|
||||
|
||||
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
|
||||
holder.bind(items[position])
|
||||
holder.binding.root.setOnClickListener {
|
||||
|
||||
if (!items[position].shelvingFk.isNullOrEmpty()) {
|
||||
|
||||
onPasillerosItemClickListener.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(
|
||||
title =
|
||||
R.string.titleUbicator
|
||||
), items[position].shelvingFk!!
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
fun addList(list:List<ItemShelvingLog>){
|
||||
items = list
|
||||
notifyDataSetChanged()
|
||||
|
||||
}
|
||||
inner class ItemHolder(
|
||||
val binding: ItemShelvinglogRowBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
private val res = binding.root.context.resources
|
||||
fun bind(item: ItemShelvingLog) {
|
||||
binding.apply {
|
||||
|
||||
binding.txtNickname.setOnClickListener {
|
||||
if (item.worker?.id != null) openWorker(binding, item.worker?.id!!)
|
||||
}
|
||||
binding.txtVisible.setOnClickListener {
|
||||
if (item.worker?.id != null) openWorker(binding, item.worker?.id!!)
|
||||
}
|
||||
|
||||
|
||||
this.item = item
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun openWorker(binding: ItemShelvinglogRowBinding, id: Int) {
|
||||
onPasillerosItemClickListener.onPasillerosItemClickListener(
|
||||
PasillerosItemVO(title = R.string.titleUserControlVehicle),
|
||||
id.toString()
|
||||
)
|
||||
}
|
||||
}
|
|
@ -1,153 +0,0 @@
|
|||
package es.verdnatura.presentation.view.feature.historicoshelving.fragment
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.view.View
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentItemshelvinglogBinding
|
||||
import es.verdnatura.domain.ConstAndValues.LIMITRECORDSSHELVINGLOG
|
||||
import es.verdnatura.domain.toLong
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.common.OnPasillerosItemClickListener
|
||||
import es.verdnatura.presentation.view.component.CustomDialog
|
||||
import es.verdnatura.presentation.view.feature.historicoshelving.adapter.ItemShelvingLogAdapter
|
||||
|
||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||
class ItemShelvingLogFragment(
|
||||
var entryPoint: String = ""
|
||||
) : BaseFragment<FragmentItemshelvinglogBinding, ItemShelvingLogViewModel>(ItemShelvingLogViewModel::class) {
|
||||
|
||||
private var adapter: ItemShelvingLogAdapter? = null
|
||||
private var itemScan = ""
|
||||
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
|
||||
private var records: Int = LIMITRECORDSSHELVINGLOG
|
||||
private var shelving: String = ""
|
||||
private var positionScroll = 0
|
||||
private var positionToReturn = 0
|
||||
|
||||
companion object {
|
||||
fun newInstance(entryPoint: String) = ItemShelvingLogFragment(entryPoint)
|
||||
}
|
||||
|
||||
private lateinit var customDialog: CustomDialog
|
||||
|
||||
override fun getLayoutId(): Int = R.layout.fragment_itemshelvinglog
|
||||
|
||||
override fun init() {
|
||||
|
||||
customDialog = CustomDialog(requireContext())
|
||||
setEvents()
|
||||
setToolBar(getString(R.string.itemShelvingLog))
|
||||
setAdapter()
|
||||
super.init()
|
||||
|
||||
}
|
||||
|
||||
private fun setAdapter() {
|
||||
binding.itemshelvinglogRecyclerview.layoutManager =
|
||||
LinearLayoutManager(
|
||||
requireContext(),
|
||||
LinearLayoutManager.VERTICAL,
|
||||
false
|
||||
)
|
||||
adapter = ItemShelvingLogAdapter(
|
||||
listOf(),
|
||||
onPasillerosItemClickListener = pasillerosItemClickListener!!
|
||||
)
|
||||
binding.itemshelvinglogRecyclerview.adapter = adapter
|
||||
}
|
||||
|
||||
override fun onAttach(context: Context) {
|
||||
if (context is OnPasillerosItemClickListener) pasillerosItemClickListener = context
|
||||
super.onAttach(context)
|
||||
}
|
||||
|
||||
private fun setToolBar(title: String) {
|
||||
binding.mainToolbar.toolbarTitle.text = title
|
||||
}
|
||||
|
||||
private fun setEvents() {
|
||||
val scrollView = binding.scrollView
|
||||
scrollView.setOnScrollChangeListener { _, _, scrollY, _, _->
|
||||
positionScroll = scrollY
|
||||
}
|
||||
|
||||
|
||||
binding.scanInput.requestFocus()
|
||||
binding.loadMoreButton.setOnClickListener {
|
||||
positionToReturn = positionScroll
|
||||
records += LIMITRECORDSSHELVINGLOG
|
||||
try {
|
||||
viewModel.getIdFromCodeSalix(shelving.toLong().toString(), records)
|
||||
} catch (ex: Exception) {
|
||||
|
||||
viewModel.itemShelvingLogGet(
|
||||
shelving,
|
||||
records
|
||||
)
|
||||
}
|
||||
}
|
||||
binding.scanInput.setOnEditorActionListener { v, actionId, event ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
||||
if (binding.scanInput.text.toString().isNotEmpty()) {
|
||||
//Tarea 7168
|
||||
shelving = binding.scanInput.text.toString()
|
||||
records = LIMITRECORDSSHELVINGLOG
|
||||
try {
|
||||
viewModel.getIdFromCodeSalix(binding.scanInput.toLong().toString(), records)
|
||||
} catch (ex: Exception) {
|
||||
viewModel.itemShelvingLogGet(
|
||||
shelving,
|
||||
records
|
||||
)
|
||||
}
|
||||
}
|
||||
binding.scanInput.setText("")
|
||||
ma.hideKeyboard(binding.scanInput)
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
binding.mainToolbar.backButton.setOnClickListener {
|
||||
ma.onMyBackPressed()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun observeViewModel() {
|
||||
with(viewModel) {
|
||||
|
||||
itemShelvingLogList.observe(viewLifecycleOwner) {
|
||||
|
||||
if (it.list.isEmpty()) {
|
||||
customDialog.setTitle(getString(R.string.noResults))
|
||||
.setDescription(getString(R.string.noDataLabelScanned))
|
||||
.setOkButton(getString(R.string.close)) {
|
||||
customDialog.dismiss()
|
||||
}.show()
|
||||
} else {
|
||||
|
||||
//TAREA 7168
|
||||
if (it.list.size == records) {
|
||||
binding.loadMoreButton.visibility = View.VISIBLE
|
||||
} else {
|
||||
binding.loadMoreButton.visibility = View.GONE
|
||||
}
|
||||
adapter!!.addList(it.list)
|
||||
setToolBar(getString(R.string.itemShelvingLog) + ":" + itemScan)
|
||||
|
||||
val handler = Handler(Looper.getMainLooper())
|
||||
handler.postDelayed({
|
||||
binding.scrollView.smoothScrollTo(0, positionToReturn)
|
||||
}, 1000)
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
package es.verdnatura.presentation.view.feature.historicoshelving.fragment
|
||||
|
||||
import android.content.Context
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import es.verdnatura.domain.ConstAndValues.LIMITRECORDSSHELVINGLOG
|
||||
import es.verdnatura.domain.SalixCallback
|
||||
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.view.feature.historicoshelving.model.ItemShelvingLog
|
||||
import es.verdnatura.presentation.view.feature.historicoshelving.model.ItemShelvingLogList
|
||||
import retrofit2.Response
|
||||
|
||||
class ItemShelvingLogViewModel(val context: Context) : BaseViewModel(context) {
|
||||
|
||||
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
|
||||
|
||||
private val _itemShelvingLogList by lazy { MutableLiveData<ItemShelvingLogList>() }
|
||||
val itemShelvingLogList: LiveData<ItemShelvingLogList> = _itemShelvingLogList
|
||||
|
||||
private val _responseCode by lazy { MutableLiveData<Int?>() }
|
||||
val responseCode: LiveData<Int?> = _responseCode
|
||||
|
||||
fun itemShelvingLogGet(shelvingOrItem: String, records: Int = LIMITRECORDSSHELVINGLOG) {
|
||||
//tarea 7168
|
||||
salix.itemShelvingLogGet(
|
||||
filter = """{ "where": { "or": [ {"shelvingFk": "$shelvingOrItem"}, {"itemFk": "$shelvingOrItem"} ] },
|
||||
"limit": $records,
|
||||
"order": "created DESC",
|
||||
"include": [ { "relation": "worker", "scope": { "fields": ["code"]} },
|
||||
{ "relation": "item", "scope": { "fields": ["longName"] } } ] }
|
||||
""".trim()
|
||||
)
|
||||
.enqueue(object :
|
||||
SalixCallback<List<ItemShelvingLog>>(context) {
|
||||
override fun onSuccess(response: Response<List<ItemShelvingLog>>) {
|
||||
_itemShelvingLogList.value = response.body()?.let {
|
||||
ItemShelvingLogList(it)
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun getIdFromCodeSalix(code: String, records: Int) {
|
||||
getItemFromBarcodeUseCase.execute (code)
|
||||
.enqueue(object : SalixCallback<Int?>(context) {
|
||||
|
||||
override fun onSuccess(response: Response<Int?>) {
|
||||
itemShelvingLogGet(response.body()!!.toString(), records)
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
package es.verdnatura.presentation.view.feature.historicoshelving.model
|
||||
|
||||
import es.verdnatura.domain.isoToString
|
||||
|
||||
|
||||
data class ItemShelvingLog(
|
||||
var itemFk: Int? = null,
|
||||
var longName: String? = null,
|
||||
var shelvingFk: String? = null,
|
||||
var visible: Int? = null,
|
||||
var accion: String? = null,
|
||||
var code: String? = null,
|
||||
var worker: Worker? = null,
|
||||
var item:ItemSalix? = null
|
||||
) {
|
||||
var created: String = ""
|
||||
get() {
|
||||
return field.isoToString(returnOnlyDate = false)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
data class ItemSalix(var longName: String?)
|
||||
|
||||
data class ItemShelvingSaleDateList(
|
||||
var list: List<ItemShelvingLog> = listOf()
|
||||
)
|
||||
|
||||
data class ItemShelvingLogList(
|
||||
var list: List<ItemShelvingLog> = listOf()
|
||||
)
|
||||
|
||||
data class Worker(
|
||||
var id:Int? ,
|
||||
var code: String,
|
||||
)
|
|
@ -1,48 +0,0 @@
|
|||
package es.verdnatura.presentation.view.feature.historicovehiculo.adapter
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.ItemHistoricovehiculoRowBinding
|
||||
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculo
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
|
||||
|
||||
class HistoricoVehiculoAdapter (
|
||||
private val items: List<ItemHistoricoVehiculo>
|
||||
): RecyclerView.Adapter<HistoricoVehiculoAdapter.ItemHolder> () {
|
||||
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemHolder {
|
||||
return ItemHolder(
|
||||
ItemHistoricovehiculoRowBinding.inflate(LayoutInflater.from(parent.context),parent,false)
|
||||
)
|
||||
}
|
||||
|
||||
override fun getItemCount() =items.size
|
||||
|
||||
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
|
||||
holder.bind(items[position])
|
||||
}
|
||||
|
||||
inner class ItemHolder(
|
||||
val binding: ItemHistoricovehiculoRowBinding
|
||||
) : RecyclerView.ViewHolder(binding.root){
|
||||
private val res = binding.root.context.resources
|
||||
fun bind(item: ItemHistoricoVehiculo) {
|
||||
binding.apply {
|
||||
this.item = item
|
||||
val sdf = SimpleDateFormat(binding.root.context.getString(R.string.dateFormat))
|
||||
val currentDate = sdf.format(Date())
|
||||
if (currentDate == item.inTimed){
|
||||
historicoDate.setBackgroundColor(ContextCompat.getColor(historicoDate.context,R.color.verdnatura_pumpkin_orange))
|
||||
}else{
|
||||
historicoDate.setBackgroundColor(ContextCompat.getColor(historicoDate.context,R.color.verdnatura_black_5))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
package es.verdnatura.presentation.view.feature.historicovehiculo.fragment
|
||||
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentHistoricovehiculoBinding
|
||||
import es.verdnatura.domain.notNull
|
||||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.view.feature.historicovehiculo.adapter.HistoricoVehiculoAdapter
|
||||
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculoList
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
|
||||
class HistoricoVehiculoFragment(
|
||||
private var numberPlate: String = ""
|
||||
) : BaseFragment<FragmentHistoricovehiculoBinding, HistoricoVehiculoViewModel>(
|
||||
HistoricoVehiculoViewModel::class
|
||||
) {
|
||||
|
||||
private var adapter: HistoricoVehiculoAdapter? = null
|
||||
|
||||
companion object {
|
||||
fun newInstance(entryPoint: String) = HistoricoVehiculoFragment(entryPoint)
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int = R.layout.fragment_historicovehiculo
|
||||
|
||||
|
||||
override fun init() {
|
||||
|
||||
ma.hideBottomNavigation(View.GONE)
|
||||
viewModel.machineWorkeGetHistorical(numberPlate,mobileApplication.userId!!)
|
||||
binding.mainToolbar.toolbarTitle.text = getString(R.string.vehiclediary)
|
||||
setEvents()
|
||||
super.init()
|
||||
}
|
||||
|
||||
private fun setEvents() {
|
||||
binding.mainToolbar.backButton.setOnClickListener {
|
||||
ma.onMyBackPressed()
|
||||
}
|
||||
}
|
||||
|
||||
override fun observeViewModel() {
|
||||
with(viewModel) {
|
||||
loadHistoricoVehiculoList.observe(viewLifecycleOwner) { event ->
|
||||
event.getContentIfNotHandled().notNull {
|
||||
|
||||
if (it.list.isEmpty()) {
|
||||
ma.messageWithSound(
|
||||
getString(R.string.lookWithpermission),
|
||||
isError = true,
|
||||
isPlayed = true,
|
||||
getString(
|
||||
R.string.info
|
||||
)
|
||||
)
|
||||
} else {
|
||||
adapter = HistoricoVehiculoAdapter(it.list)
|
||||
binding.historicovehiculoRecyclerview.adapter = adapter
|
||||
binding.historicovehiculoRecyclerview.layoutManager =
|
||||
LinearLayoutManager(
|
||||
requireContext(),
|
||||
LinearLayoutManager.VERTICAL,
|
||||
false
|
||||
)
|
||||
navigateToToday(it)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun navigateToToday(it: ItemHistoricoVehiculoList) {
|
||||
var positionToday = 0
|
||||
val sdf = SimpleDateFormat(getString(R.string.dateFormat), Locale.getDefault())
|
||||
val currentDate = sdf.format(Date())
|
||||
|
||||
for (item in it.list) {
|
||||
if (currentDate == item.inTimed) {
|
||||
break
|
||||
}
|
||||
positionToday += 1
|
||||
}
|
||||
|
||||
binding.historicovehiculoRecyclerview.scrollToPosition(positionToday)
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
package es.verdnatura.presentation.view.feature.historicovehiculo.fragment
|
||||
|
||||
import android.content.Context
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.map
|
||||
import es.verdnatura.domain.SalixCallback
|
||||
import es.verdnatura.domain.formatWithQuotes
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.common.Event
|
||||
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculo
|
||||
import es.verdnatura.presentation.view.feature.historicovehiculo.model.ItemHistoricoVehiculoList
|
||||
import retrofit2.Response
|
||||
|
||||
class HistoricoVehiculoViewModel(var context: Context) : BaseViewModel(context) {
|
||||
|
||||
private val _historicovehiculoList by lazy { MutableLiveData<ItemHistoricoVehiculoList>() }
|
||||
val loadHistoricoVehiculoList: LiveData<Event<ItemHistoricoVehiculoList>> = _historicovehiculoList.map { Event(it) }
|
||||
|
||||
fun machineWorkeGetHistorical(plateNumber: String, workerId:Int) {
|
||||
salix.machineWorkerGetHistorical(arrayListOf(plateNumber,workerId).formatWithQuotes())
|
||||
.enqueue(object :
|
||||
SalixCallback<List<ItemHistoricoVehiculo>>(context) {
|
||||
override fun onSuccess(response: Response<List<ItemHistoricoVehiculo>>) {
|
||||
_historicovehiculoList.value =
|
||||
response.body()?.let { ItemHistoricoVehiculoList(it) }
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
package es.verdnatura.presentation.view.feature.historicovehiculo.model
|
||||
|
||||
import es.verdnatura.domain.isoToString
|
||||
|
||||
class ItemHistoricoVehiculo(
|
||||
var workerName: String? = null,
|
||||
|
||||
) {
|
||||
var inTimed: String = ""
|
||||
get() {
|
||||
return field.isoToString()
|
||||
}
|
||||
var outTimed: String = ""
|
||||
get() {
|
||||
return field.isoToString()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ItemHistoricoVehiculoList(
|
||||
var list: List<ItemHistoricoVehiculo> = listOf()
|
||||
)
|
|
@ -0,0 +1,81 @@
|
|||
package es.verdnatura.presentation.view.feature.indoor
|
||||
|
||||
import android.Manifest
|
||||
import android.content.pm.PackageManager
|
||||
import android.location.Location
|
||||
import android.location.LocationListener
|
||||
import android.location.LocationManager
|
||||
import android.os.Bundle
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import es.verdnatura.R
|
||||
|
||||
class MainActivityIndoor : AppCompatActivity(), LocationListener {
|
||||
|
||||
private lateinit var locationManager: LocationManager
|
||||
private lateinit var textView: TextView
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.indoor_activity_main)
|
||||
|
||||
textView = findViewById(R.id.textViewLocation)
|
||||
|
||||
locationManager = getSystemService(LOCATION_SERVICE) as LocationManager
|
||||
|
||||
// Verificar permisos
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION)
|
||||
!= PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
|
||||
ActivityCompat.requestPermissions(
|
||||
this,
|
||||
arrayOf(Manifest.permission.ACCESS_COARSE_LOCATION), 1
|
||||
)
|
||||
} else {
|
||||
startLocationUpdates()
|
||||
}
|
||||
}
|
||||
|
||||
private fun startLocationUpdates() {
|
||||
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION)
|
||||
== PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
|
||||
locationManager.requestLocationUpdates(
|
||||
LocationManager.NETWORK_PROVIDER,
|
||||
5000, // Tiempo mínimo de actualización (5 segundos)
|
||||
10f, // Distancia mínima de actualización (10 metros)
|
||||
this
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onLocationChanged(location: Location) {
|
||||
val latitude = location.latitude
|
||||
val longitude = location.longitude
|
||||
textView.text = "Lat: $latitude\nLon: $longitude"
|
||||
println(" $latitude:$longitude")
|
||||
}
|
||||
|
||||
override fun onRequestPermissionsResult(
|
||||
requestCode: Int,
|
||||
permissions: Array<out String>,
|
||||
grantResults: IntArray
|
||||
) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||
if (requestCode == 1 && grantResults.isNotEmpty()
|
||||
&& grantResults[0] == PackageManager.PERMISSION_GRANTED
|
||||
) {
|
||||
startLocationUpdates()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStatusChanged(provider: String?, status: Int, extras: Bundle?) {}
|
||||
|
||||
override fun onProviderEnabled(provider: String) {}
|
||||
|
||||
override fun onProviderDisabled(provider: String) {}
|
||||
}
|
|
@ -44,7 +44,7 @@ class InventaryFragment :
|
|||
private lateinit var itemClicked: ItemInventaryVO
|
||||
private var buyerId: Number = -1
|
||||
private var filterItemType: String? = null
|
||||
private var myListBuyers = listOf<Buyer>()
|
||||
private var myListBuyers = mutableListOf<Buyer>()
|
||||
|
||||
companion object {
|
||||
fun newInstance() = InventaryFragment()
|
||||
|
@ -82,6 +82,7 @@ class InventaryFragment :
|
|||
}
|
||||
.distinct()
|
||||
.sortedBy { it.name }
|
||||
|
||||
setSearchable(distinctPackingTypes as MutableList<NameWithId>)
|
||||
binding.searchableRecyclerView.visibility = View.VISIBLE
|
||||
binding.searchableRecyclerView.setSearchHint(getString(R.string.BuyerSearch))
|
||||
|
@ -235,7 +236,7 @@ class InventaryFragment :
|
|||
with(viewModel) {
|
||||
|
||||
buyersByItemPackingList.observe(viewLifecycleOwner) { list ->
|
||||
myListBuyers = list.list
|
||||
myListBuyers = list.list.toMutableList()
|
||||
val distinctPackingTypes =
|
||||
list?.list?.map {
|
||||
NameWithId(
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package es.verdnatura.presentation.view.feature.inventario.model
|
||||
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
class ItemInventaryVO(
|
||||
var itemFk: Int? = null,
|
||||
var longName: String? = null,
|
||||
|
@ -9,7 +11,7 @@ class ItemInventaryVO(
|
|||
var upstairs: Int? = null,
|
||||
var nicho: Int? = null,
|
||||
var itemColour: String = "",
|
||||
var pendingAmount :Long? = null
|
||||
var pendingAmount: Long? = null
|
||||
)
|
||||
|
||||
class InventaryListVO(
|
||||
|
@ -27,13 +29,14 @@ class ItemShelvingVisibleZero(
|
|||
|
||||
class ItemShelvingChecked(
|
||||
var isChecked: Boolean?,
|
||||
var userFk : Int
|
||||
var userFk: Int
|
||||
)
|
||||
|
||||
data class ItemInventoryParking(
|
||||
var id: Long = 0,
|
||||
var pickingOrder: Int = 0,
|
||||
var parking: String = "",
|
||||
@SerializedName(value = "shelvingFk", alternate = ["code"])
|
||||
var shelvingFk: String = "",
|
||||
var itemFk: Int = 0,
|
||||
var longName: String = "",
|
||||
|
@ -42,8 +45,8 @@ data class ItemInventoryParking(
|
|||
var buyer: String = "",
|
||||
var isChecked: Int? = null,
|
||||
var priority: Int = 0,
|
||||
var url:String? = null,
|
||||
var image:String? = null
|
||||
var url: String? = null,
|
||||
var image: String? = null
|
||||
)
|
||||
|
||||
class InventoryParkingList(
|
||||
|
|
|
@ -43,7 +43,7 @@ import kotlinx.coroutines.runBlocking
|
|||
import java.util.Date
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
class LoginFragment() :
|
||||
class LoginFragment :
|
||||
BaseFragment<FragmentLoginBinding, LoginViewModel>(LoginViewModel::class) {
|
||||
|
||||
private lateinit var customDialogInput: CustomDialogInput
|
||||
|
@ -157,6 +157,7 @@ class LoginFragment() :
|
|||
}
|
||||
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
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>) {
|
||||
|
||||
workFormAdapter = WorkFormAdapter(listWorkForms, object : OnWorkFormsItemRowClickListener {
|
||||
|
@ -355,6 +326,8 @@ class LoginFragment() :
|
|||
if (binding.edittextServer.text.toString() == "Producción") {
|
||||
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))
|
||||
.setDescription(getString(R.string.updatemng)).setOkButton(
|
||||
getString(
|
||||
|
@ -380,6 +353,9 @@ class LoginFragment() :
|
|||
}
|
||||
customDialog.show()
|
||||
|
||||
} else {
|
||||
goToMain()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@ import es.verdnatura.domain.ConstAndValues.TOKENCREATED
|
|||
import es.verdnatura.domain.ConstAndValues.TTL
|
||||
import es.verdnatura.domain.SalixCallback
|
||||
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.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
import es.verdnatura.presentation.common.Event
|
||||
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.DeviceLogSalix
|
||||
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.Intent
|
||||
import android.media.MediaPlayer
|
||||
import android.os.Build
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log.e
|
||||
import android.view.Menu
|
||||
|
@ -11,7 +10,6 @@ import android.view.View
|
|||
import android.widget.Toast
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.activity.OnBackPressedDispatcherOwner
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
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.TAG
|
||||
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.feature.ajustes.fragment.AjustesFragment
|
||||
import es.verdnatura.presentation.view.feature.articulo.fragment.ItemCardFragment
|
||||
|
@ -68,10 +66,10 @@ import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFra
|
|||
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentChecker
|
||||
import es.verdnatura.presentation.view.feature.collection.fragment.CollectionFragmentCheckerPreviousNew
|
||||
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.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.delivery.fragments.InfoFragment
|
||||
import es.verdnatura.presentation.view.feature.delivery.fragments.LoadUnloadFragment
|
||||
|
@ -83,10 +81,8 @@ import es.verdnatura.presentation.view.feature.delivery.fragments.TicketsFragmen
|
|||
import es.verdnatura.presentation.view.feature.delivery.model.ClientTicketSalix
|
||||
import es.verdnatura.presentation.view.feature.diadeventa.fragment.DayOfSaleFragment
|
||||
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.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.InventaryParkingFragment
|
||||
import es.verdnatura.presentation.view.feature.login.fragment.LoginViewModel
|
||||
|
@ -135,7 +131,7 @@ import es.verdnatura.presentation.view.feature.sacador.model.CollectionTicket
|
|||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
import es.verdnatura.presentation.view.feature.ticket.fragment.TicketAdvanceFragment
|
||||
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.WorkermistakeFragment
|
||||
import kotlinx.coroutines.DelicateCoroutinesApi
|
||||
|
@ -176,7 +172,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
try {
|
||||
|
@ -205,9 +200,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
return super.onCreateView(name, context, attrs)
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
@OptIn(DelicateCoroutinesApi::class)
|
||||
override fun init() {
|
||||
|
||||
mperror = MediaPlayer.create((this), R.raw.error)
|
||||
mpok = MediaPlayer.create((this), R.raw.ok)
|
||||
mpErrorRepeat = MediaPlayer.create((this), R.raw.errorrepeat)
|
||||
|
@ -247,11 +241,10 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
networkUtils = NetworkUtilsApp(this, application as MobileApplication)
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
private fun startRepeatingTask(myInterval: Long) {
|
||||
|
||||
scheduledExecutor = Executors.newSingleThreadScheduledExecutor()
|
||||
scheduledFuture = scheduledExecutor?.scheduleAtFixedRate(
|
||||
scheduledFuture = scheduledExecutor?.scheduleWithFixedDelay(
|
||||
{
|
||||
runOnUiThread {
|
||||
checkTokenRenew()
|
||||
|
@ -260,13 +253,11 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
)
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
scheduledExecutor?.shutdown()
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
private fun setFragments() {
|
||||
try {
|
||||
val uriImage = intent.data
|
||||
|
@ -414,7 +405,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
|
||||
getString(R.string.titleCorridors) -> {
|
||||
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
delete_Fragments()
|
||||
deleteFragments()
|
||||
addFragment(
|
||||
PasilleroFragment.newInstance(getString(R.string.main), true),
|
||||
R.id.main_frame_layout,
|
||||
|
@ -426,7 +417,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
|
||||
getString(R.string.verticket) -> {
|
||||
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
delete_Fragments()
|
||||
deleteFragments()
|
||||
addFragment(
|
||||
ShowTicketFragment.newInstance(getString(R.string.main)),
|
||||
R.id.main_frame_layout,
|
||||
|
@ -438,7 +429,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
|
||||
getString(R.string.Parking) -> {
|
||||
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
delete_Fragments()
|
||||
deleteFragments()
|
||||
addFragment(
|
||||
ParkingFragment.newInstance(getString(R.string.main)),
|
||||
R.id.main_frame_layout,
|
||||
|
@ -450,7 +441,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
|
||||
getString(R.string.Ajustes) -> {
|
||||
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
delete_Fragments()
|
||||
deleteFragments()
|
||||
addFragment(
|
||||
AjustesFragment.newInstance(),
|
||||
R.id.main_frame_layout,
|
||||
|
@ -469,7 +460,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
|
||||
getString(R.string.titleCorridors) -> {
|
||||
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
delete_Fragments()
|
||||
deleteFragments()
|
||||
addFragment(
|
||||
PasilleroFragment.newInstance(getString(R.string.main), true),
|
||||
R.id.main_frame_layout,
|
||||
|
@ -485,7 +476,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
}
|
||||
}
|
||||
|
||||
fun delete_Fragments() {
|
||||
private fun deleteFragments() {
|
||||
fm.fragments.forEach {
|
||||
val fragment: Fragment? = supportFragmentManager.findFragmentByTag(it.tag.toString())
|
||||
if (fragment != null) supportFragmentManager.beginTransaction().remove(fragment)
|
||||
|
@ -493,12 +484,10 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
}
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
override fun onPasillerosItemClickListener(
|
||||
item: PasillerosItemVO, entryPoint: String, param: Any?
|
||||
) {
|
||||
val itemTitle = getString(item.title!!)
|
||||
when (itemTitle) {
|
||||
when (val itemTitle = getString(item.title!!)) {
|
||||
|
||||
//BUFFERS
|
||||
getString(R.string.titlePalletizar) -> {
|
||||
|
@ -615,9 +604,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
|
||||
}
|
||||
|
||||
/* getString(R.string.titlePrePicker) -> {
|
||||
addFragmentOnTop(PreSacadorFragment.newInstance())
|
||||
}*/
|
||||
getString(R.string.titleDayOfSale) -> {
|
||||
addFragmentOnTop(DayOfSaleFragment(itemTitle))
|
||||
}
|
||||
|
@ -626,10 +612,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
addFragmentOnTop(ShowTicketFragment.newInstance(getString(R.string.titleCorridors)))
|
||||
}
|
||||
|
||||
getString(R.string.titleHistoricalVehicle) -> {
|
||||
addFragmentOnTop(ControlVehiculoFragment.newInstance(HistoricoVehiculoFragment.TAG))
|
||||
}
|
||||
|
||||
getString(R.string.titleItemConsult) -> {
|
||||
addFragmentOnTop(ItemCardFragment.newInstance(entryPoint))
|
||||
}
|
||||
|
@ -638,17 +620,23 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
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) -> {
|
||||
addFragmentOnTop(ParkingFragment.newInstance(""))
|
||||
}
|
||||
|
||||
getString(R.string.titleItemSearch) -> {
|
||||
|
||||
//JETPACKCOMPOSE
|
||||
/* addFragmentOnTop(
|
||||
BuscarItemFragmentCompose.newInstance(
|
||||
if (entryPoint == "") {
|
||||
null
|
||||
} else {
|
||||
entryPoint.toInt()
|
||||
}
|
||||
)
|
||||
)*/
|
||||
|
||||
addFragmentOnTop(
|
||||
BuscarItemFragment.newInstance(
|
||||
if (entryPoint == "") {
|
||||
|
@ -673,13 +661,9 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
}
|
||||
|
||||
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
|
||||
getString(R.string.scanPreparedExpedition) -> {
|
||||
|
@ -717,6 +701,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
|
||||
getString(R.string.titleWebViewer) -> {
|
||||
// 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))
|
||||
}
|
||||
//Menu qr
|
||||
|
@ -757,9 +743,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
addFragmentOnTop(CollectionFragmentCheckerPreviousNew.newInstance())
|
||||
}
|
||||
|
||||
getString(R.string.titleShelvingHistorical) -> {
|
||||
addFragmentOnTop(ItemShelvingLogFragment.newInstance(itemTitle))
|
||||
}
|
||||
//Tarea 7920
|
||||
getString(R.string.titleShelvingHistNew) -> {
|
||||
addFragmentOnTop(ShelvingLogFragment.newInstance(itemTitle, LogType.ITEMSHELVING))
|
||||
|
@ -785,7 +768,11 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
addFragmentOnTop(PackingMistakeFragment.newInstance(itemTitle))
|
||||
}
|
||||
|
||||
getString(R.string.titlePrePickerTest) -> {
|
||||
/* getString(R.string.titlePrePickerTest) -> {
|
||||
addFragmentOnTop(SacadorFragmentNew.newInstance("PREITEMPICKERTEST"))
|
||||
}*/
|
||||
|
||||
getString(R.string.preSacadorInterfaz) -> {
|
||||
addFragmentOnTop(SacadorFragmentNew.newInstance("PREITEMPICKERTEST"))
|
||||
}
|
||||
|
||||
|
@ -830,8 +817,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
}
|
||||
|
||||
getString(R.string.selfConsumption) -> {
|
||||
// addFragmentOnTop(UbicadorFragmentNew.newInstance(entryPoint, true))
|
||||
addFragmentOnTop(UbicadorFragment6869.newInstance(entryPoint, true))
|
||||
addFragmentOnTop(UbicadorFragment.newInstance(entryPoint, true))
|
||||
}
|
||||
|
||||
getString(R.string.titlePackingHolland) -> {
|
||||
|
@ -957,13 +943,15 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
}
|
||||
|
||||
"PREITEMPICKERTEST" -> {
|
||||
|
||||
addFragmentOnTop(
|
||||
CollectionFragmentPickerPreviousNew.newInstance(
|
||||
CollectionFragmentPickerPreviousNewInterface.newInstance(
|
||||
CollectionTicket(collectionFk = entryPoint.toInt()),
|
||||
"PREITEMPICKERTEST",
|
||||
false
|
||||
)
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1071,15 +1059,11 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
//Misma pantalla para los dos scador y prescador
|
||||
SACADOR -> {
|
||||
addFragmentOnTop(
|
||||
CollectionFragmentPickerPreviousNew.newInstance(
|
||||
CollectionFragmentPickerPreviousNewInterfaceSacador.newInstance(
|
||||
collection, type, hasPicking
|
||||
)
|
||||
)
|
||||
/* addFragmentOnTop(
|
||||
CollectionFragmentPickerNew.newInstance(
|
||||
collection, type, hasPicking
|
||||
)
|
||||
)*/
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1124,19 +1108,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
|
||||
}
|
||||
|
||||
//sergio:se llama al pulsar sobre el coche IN desde Sacador
|
||||
fun onVehicleSelected(tag: String) {
|
||||
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
|
||||
// se pone a true en la pila para que cuando se vuelva atrás permanezca ya que se borran todos los fragmentos desde otras opciones
|
||||
addFragment(
|
||||
ControlVehiculoFragment.newInstance(tag),
|
||||
R.id.main_frame_layout,
|
||||
ControlVehiculoFragment.TAG,
|
||||
true
|
||||
)
|
||||
}
|
||||
|
||||
fun openSummaryFragment(route: Int, state: String) {
|
||||
addFragmentOnTop(
|
||||
SummaryFragment.newInstance(
|
||||
|
@ -1146,10 +1117,10 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
}
|
||||
|
||||
fun openFragmentPickers(delete: Boolean) {
|
||||
//delete_Fragments()
|
||||
//deleteFragments()
|
||||
fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE)
|
||||
if (delete) {
|
||||
delete_Fragments()
|
||||
deleteFragments()
|
||||
}
|
||||
addFragment(
|
||||
SacadorFragment.newInstance("PREPARED"),
|
||||
|
@ -1228,14 +1199,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), OnPasillerosItemClickL
|
|||
userFk = (application as MobileApplication).userId!!
|
||||
)
|
||||
} catch (ex: Exception) {
|
||||
ex.message!!.toast(this)
|
||||
ex.message?.toast(this)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
fun checkTokenRenew() {
|
||||
private fun checkTokenRenew() {
|
||||
val renewPeriod = mobileApplication.dataStoreApp.readDataStoreKey<Long>(RENEWPERIOD)
|
||||
val min = minOf(mobileApplication.dataStoreApp.readDataStoreKey(TTL), renewPeriod) * 1000
|
||||
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 es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentPackagingObsBinding
|
||||
import es.verdnatura.domain.ConstAndValues.COMPANYFK
|
||||
import es.verdnatura.domain.ConstAndValues.ENTRYID
|
||||
import es.verdnatura.domain.ConstAndValues.ENTRYNUMBERIMAGES
|
||||
import es.verdnatura.domain.ConstAndValues.ENTRYOBSERVATIONORIGINAL
|
||||
|
@ -60,6 +61,7 @@ class ObservFragment(
|
|||
private var pasillerosItemClickListener: OnPasillerosItemClickListener? = null
|
||||
private var layoutManager: LinearLayoutManager? = null
|
||||
private lateinit var customDialogList: CustomDialogList
|
||||
private var dmsType: Int? = null
|
||||
|
||||
companion object {
|
||||
fun newInstance(entryPoint: String) = ObservFragment(entryPoint)
|
||||
|
@ -79,6 +81,7 @@ class ObservFragment(
|
|||
setEvents()
|
||||
setObservations()
|
||||
loadImages()
|
||||
viewModel.getTypeDMS()
|
||||
super.init()
|
||||
}
|
||||
|
||||
|
@ -244,8 +247,8 @@ class ObservFragment(
|
|||
warehouseId = mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
||||
WAREHOUSEFK
|
||||
),
|
||||
companyId = 442,
|
||||
dmsTypeId = 27,
|
||||
companyId = mobileApplication.dataStoreApp.readDataStoreKey<Int>(COMPANYFK),
|
||||
dmsTypeId = dmsType!!,
|
||||
reference = mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
||||
ENTRYID
|
||||
).toString(),
|
||||
|
@ -266,6 +269,18 @@ class ObservFragment(
|
|||
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 bitmap = drawable!!.toBitmap()
|
||||
|
||||
|
||||
viewModel.entryUploadPhotoSalix(
|
||||
idEntry = mobileApplication.dataStoreApp.readDataStoreKey<Int>(ENTRYID),
|
||||
warehouseId = mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
||||
WAREHOUSEFK
|
||||
),
|
||||
companyId = 442,
|
||||
dmsTypeId = 27,
|
||||
companyId = mobileApplication.dataStoreApp.readDataStoreKey<Int>(COMPANYFK),
|
||||
dmsTypeId = dmsType!!,
|
||||
reference = mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
||||
ENTRYID
|
||||
).toString(),
|
||||
|
@ -294,7 +310,6 @@ class ObservFragment(
|
|||
hasFile = false,
|
||||
urlImage = saveBitmapAsTempFile(requireContext(), bitmap)
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
}, object : OnImageTrashClickListener {
|
||||
|
|
|
@ -49,8 +49,15 @@ class PackagingCountFragment(
|
|||
override fun init() {
|
||||
|
||||
viewModel.getItemsPackaging(
|
||||
mobileApplication.dataStoreApp.readDataStoreKey(SUPPLIERID),
|
||||
mobileApplication.dataStoreApp.readDataStoreKey(ENTRYID)
|
||||
mobileApplication.dataStoreApp.readDataStoreKey<Int>(SUPPLIERID),
|
||||
mobileApplication.dataStoreApp.readDataStoreKey<Int>(ENTRYID)
|
||||
)
|
||||
println(
|
||||
"EntryId ${mobileApplication.dataStoreApp.readDataStoreKey<Int>(ENTRYID)} \n SupplierId ${
|
||||
mobileApplication.dataStoreApp.readDataStoreKey<Int>(
|
||||
SUPPLIERID
|
||||
)
|
||||
}"
|
||||
)
|
||||
customDialogInput = CustomDialogInput(requireContext())
|
||||
customDialog = CustomDialog(requireContext())
|
||||
|
@ -106,8 +113,8 @@ class PackagingCountFragment(
|
|||
event.getContentIfNotHandled().notNull {
|
||||
|
||||
viewModel.getItemsPackaging(
|
||||
mobileApplication.dataStoreApp.readDataStoreKey(SUPPLIERID),
|
||||
mobileApplication.dataStoreApp.readDataStoreKey(ENTRYID)
|
||||
mobileApplication.dataStoreApp.readDataStoreKey<Int>(SUPPLIERID),
|
||||
mobileApplication.dataStoreApp.readDataStoreKey<Int>(ENTRYID)
|
||||
)
|
||||
|
||||
}
|
||||
|
|
|
@ -48,8 +48,8 @@ class PackagingSummaryFragment(
|
|||
|
||||
|
||||
viewModel.getItemsPackaging(
|
||||
mobileApplication.dataStoreApp.readDataStoreKey(SUPPLIERID),
|
||||
mobileApplication.dataStoreApp.readDataStoreKey(ENTRYID)
|
||||
mobileApplication.dataStoreApp.readDataStoreKey<Int>(SUPPLIERID),
|
||||
mobileApplication.dataStoreApp.readDataStoreKey<Int>(ENTRYID)
|
||||
)
|
||||
|
||||
ma.hideBottomNavigation(View.GONE)
|
||||
|
|
|
@ -6,6 +6,7 @@ import android.view.View
|
|||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import es.verdnatura.R
|
||||
import es.verdnatura.databinding.FragmentPackagingBinding
|
||||
import es.verdnatura.domain.ConstAndValues.COMPANYFK
|
||||
import es.verdnatura.domain.ConstAndValues.ENTRYID
|
||||
import es.verdnatura.domain.ConstAndValues.ENTRYOBSERVATIONORIGINAL
|
||||
import es.verdnatura.domain.ConstAndValues.SUPPLIERID
|
||||
|
@ -108,11 +109,19 @@ class SupplierFragment(
|
|||
context = requireContext()
|
||||
) { elementSelected ->
|
||||
binding.filterEntry.text = elementSelected.name
|
||||
|
||||
runBlocking {
|
||||
mobileApplication.dataStoreApp.editDataStoreKey(
|
||||
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(
|
||||
ENTRYOBSERVATIONORIGINAL,
|
||||
entries.find { it.id == elementSelected.id }?.observation ?: ""
|
||||
|
|
|
@ -7,6 +7,7 @@ import androidx.lifecycle.map
|
|||
import es.verdnatura.domain.SalixCallback
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.common.Event
|
||||
import es.verdnatura.presentation.view.feature.packaging.model.DmsType
|
||||
import es.verdnatura.presentation.view.feature.packaging.model.EntryList
|
||||
import es.verdnatura.presentation.view.feature.packaging.model.EntrySalix
|
||||
import es.verdnatura.presentation.view.feature.packaging.model.ItemSupplier
|
||||
|
@ -34,6 +35,9 @@ class SupplierViewModel(val context: Context) : BaseViewModel(context) {
|
|||
val supplierList: LiveData<SupplierList>
|
||||
get() = _supplierList
|
||||
|
||||
private val _dmsTypeId by lazy { MutableLiveData<DmsType>() }
|
||||
val dmsTypeId: MutableLiveData<DmsType> = _dmsTypeId
|
||||
|
||||
private val _entryList by lazy { MutableLiveData<EntryList>() }
|
||||
val entryList: LiveData<EntryList>
|
||||
get() = _entryList
|
||||
|
@ -70,6 +74,23 @@ class SupplierViewModel(val context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun getTypeDMS() {
|
||||
salix.getDmsType(
|
||||
filter = """{"where":{"code":"entry"}}"""
|
||||
).enqueue(object : SalixCallback<DmsType>(context) {
|
||||
|
||||
override fun onSuccess(response: Response<DmsType>) {
|
||||
_dmsTypeId.value = response.body()
|
||||
|
||||
}
|
||||
|
||||
override fun onError(t: Throwable) {
|
||||
_dmsTypeId.value = DmsType(0)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun getEntriesFromSupplier(supplier: Number) {
|
||||
val calendar = Calendar.getInstance()
|
||||
calendar.add(Calendar.DAY_OF_YEAR, 0)
|
||||
|
|
|
@ -9,7 +9,7 @@ data class EntrySalix(
|
|||
var created: String? = null,
|
||||
var supplierFk: Number? = null,
|
||||
var travelFk: Number? = null,
|
||||
var companyFk: Number? = null,
|
||||
var companyFk: Number,
|
||||
var observation: String? = null,
|
||||
var travel: TravelSalix? = null,
|
||||
var isError: Boolean = false,
|
||||
|
@ -29,7 +29,8 @@ fun List<EntrySalix>.toDateFormat(): ArrayList<EntrySalix> {
|
|||
entries.add(
|
||||
EntrySalix(
|
||||
dated = convertToDateString(it.dated),
|
||||
created = convertToDateString(it.created)
|
||||
created = convertToDateString(it.created),
|
||||
companyFk = it.companyFk
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -46,3 +47,7 @@ data class NotificationQueue(
|
|||
val authorFk: Int,
|
||||
val params: String
|
||||
)
|
||||
|
||||
data class DmsType(
|
||||
val id: Int
|
||||
)
|
||||
|
|
|
@ -282,12 +282,22 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
|
|||
)
|
||||
//sacador
|
||||
if (isOnReservationModeSector == true || (!existSectorOnReservationMode && isOnReservationMode)) {
|
||||
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(
|
||||
R.drawable.ic_picker_ui, R.string.sacador_test, R.string.sacador_test
|
||||
)
|
||||
)
|
||||
|
||||
//a quitar
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(
|
||||
R.drawable.ic_picker_ui, R.string.titlePickers, R.string.titlePickersDescrip
|
||||
|
||||
)
|
||||
)
|
||||
} else {
|
||||
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(
|
||||
R.drawable.ic_picker_ui, R.string.titlePickers, R.string.titlePickersDescrip
|
||||
|
@ -418,21 +428,25 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
|
|||
workerActivityAdd(CodeWorkerAction.PREVIOUS)
|
||||
|
||||
if (isOnReservationModeSector == true || (!existSectorOnReservationMode && isOnReservationMode)) {
|
||||
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(
|
||||
R.drawable.ic_previous_presacador,
|
||||
R.string.titlePrePickerTest,
|
||||
R.string.titlePickerDescrip
|
||||
R.string.preSacadorInterfaz,
|
||||
R.string.preSacadorInterfaz
|
||||
)
|
||||
)
|
||||
|
||||
} else {
|
||||
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(
|
||||
R.drawable.ic_previous_presacador,
|
||||
R.string.titlePrePicker,
|
||||
R.string.titlePickerDescrip
|
||||
R.string.titlePrePicker
|
||||
)
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -542,13 +556,6 @@ class PasilleroViewModel(context: Context) : BaseViewModel(context) {
|
|||
)
|
||||
)
|
||||
|
||||
/* _pasillerositem.add(
|
||||
PasillerosItemVO(
|
||||
R.drawable.revision_icon,
|
||||
R.string.titleShelvingHistorical,
|
||||
R.string.titleShelvingHistDescrip
|
||||
)
|
||||
)*/
|
||||
|
||||
_pasillerositem.add(
|
||||
PasillerosItemVO(
|
||||
|
|
|
@ -365,7 +365,7 @@ class EndSacadorFragment(
|
|||
responseCode.observe(viewLifecycleOwner, Observer {
|
||||
|
||||
if (!goBack2) {
|
||||
if (it==null) {
|
||||
if (it == null) {
|
||||
customDialog.setTitle(getString(R.string.error))
|
||||
.setDescription(getString(R.string.itemNotValid))
|
||||
.setKoButton(getString(R.string.close)) {
|
||||
|
@ -609,7 +609,6 @@ class EndSacadorFragment(
|
|||
|
||||
private fun findSale(txtscan: String, position: Int) {
|
||||
var index = 0
|
||||
var isBreak = false
|
||||
var isOk = false
|
||||
|
||||
val saleVO = sales[position]
|
||||
|
@ -622,7 +621,6 @@ class EndSacadorFragment(
|
|||
if (mpok != null) mpok!!.start()
|
||||
isOk = true
|
||||
showShelving(position, shelvingIndex)
|
||||
isBreak = true
|
||||
break
|
||||
}
|
||||
shelvingIndex += 1
|
||||
|
@ -703,14 +701,13 @@ class EndSacadorFragment(
|
|||
)
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
private fun printShelvingResult(placementSupplyListVO: PlacementSupplyListVO) {
|
||||
var shelving = ""
|
||||
var item = ""
|
||||
var longName = ""
|
||||
var total = "0"
|
||||
var itemShelvingFk = 0
|
||||
if (!placementSupplyListVO.list.isEmpty()) {
|
||||
if (placementSupplyListVO.list.isNotEmpty()) {
|
||||
val placement = placementSupplyListVO.list[0]
|
||||
shelving = placement.shelving
|
||||
item = placement.itemFk
|
||||
|
@ -775,7 +772,7 @@ class EndSacadorFragment(
|
|||
requireActivity().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
lManager.hideSoftInputFromWindow(
|
||||
customDialogList.getEditTextTwo().windowToken,
|
||||
InputMethodManager.SHOW_IMPLICIT
|
||||
InputMethodManager.HIDE_IMPLICIT_ONLY
|
||||
)
|
||||
})
|
||||
|
||||
|
@ -928,12 +925,9 @@ class EndSacadorFragment(
|
|||
val iconEraser = ImageView(context)
|
||||
iconEraser.setImageResource(R.drawable.previous_delete)
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
iconParking.tooltipText = getTooltip(R.drawable.ic_local_parking_black_24dp)
|
||||
iconEraser.tooltipText = getTooltip(R.drawable.previous_delete)
|
||||
|
||||
}
|
||||
|
||||
//listIcons.add(iconEraser)
|
||||
listIcons.add(iconParking)
|
||||
|
||||
|
@ -1005,11 +999,10 @@ class EndSacadorFragment(
|
|||
increaseQuantity(position, customDialogThreeButtons.getValue().toInt())
|
||||
scanRequest()
|
||||
customDialogThreeButtons.dismiss()
|
||||
}catch (_:Exception){
|
||||
} catch (_: Exception) {
|
||||
getString(R.string.errorInput).toast(requireContext())
|
||||
}
|
||||
|
||||
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
scanRequest()
|
||||
customDialogThreeButtons.dismiss()
|
||||
|
|
|
@ -6,10 +6,10 @@ import androidx.lifecycle.MutableLiveData
|
|||
import androidx.lifecycle.map
|
||||
import es.verdnatura.domain.SalixCallback
|
||||
import es.verdnatura.domain.formatWithQuotes
|
||||
import es.verdnatura.domain.getMessageFromAllResponse
|
||||
import es.verdnatura.domain.nameofFunction
|
||||
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
||||
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.ResponseItemVO
|
||||
import es.verdnatura.presentation.view.feature.collection.SalixSaleQuantity
|
||||
|
|
|
@ -2,6 +2,7 @@ package es.verdnatura.presentation.view.feature.sacador.fragment
|
|||
|
||||
import android.content.Context
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.os.Bundle
|
||||
import android.text.InputType
|
||||
import android.view.View
|
||||
import android.view.inputmethod.EditorInfo
|
||||
|
@ -16,16 +17,13 @@ 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.view.component.CustomDialog
|
||||
import es.verdnatura.presentation.view.component.CustomDialogInput
|
||||
import es.verdnatura.presentation.view.feature.sacador.adapter.CollectionAdapter
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.CollectionVO
|
||||
|
||||
class SacadorFragment(
|
||||
var type: String
|
||||
) :
|
||||
class SacadorFragment :
|
||||
BaseFragment<FragmentSacadorBinding, SacadorViewModel>(SacadorViewModel::class) {
|
||||
|
||||
private var onCollectionSelectedListener: OnCollectionSelectedListener? = null
|
||||
|
@ -35,9 +33,16 @@ class SacadorFragment(
|
|||
private lateinit var customDialogInput: CustomDialogInput
|
||||
private var collectionsList: ArrayList<CollectionVO> = ArrayList()
|
||||
private var adapter: CollectionAdapter? = null
|
||||
private var type: String = ""
|
||||
|
||||
companion object {
|
||||
fun newInstance(type: String) = SacadorFragment(type)
|
||||
private const val ARG_TYPE = "arg_type"
|
||||
|
||||
fun newInstance(type: String) = SacadorFragment().apply {
|
||||
arguments = Bundle().apply {
|
||||
putString(ARG_TYPE, type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAttach(context: Context) {
|
||||
|
@ -45,6 +50,11 @@ class SacadorFragment(
|
|||
if (context is OnCollectionSelectedListener) onCollectionSelectedListener = context
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
type = arguments?.getString(ARG_TYPE) ?: ""
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int = R.layout.fragment_sacador
|
||||
|
||||
override fun init() {
|
||||
|
@ -132,7 +142,6 @@ class SacadorFragment(
|
|||
|
||||
}
|
||||
|
||||
iconVehicleIn.drawable -> ma.onVehicleSelected(SacadorFragment.TAG)
|
||||
iconPrint.drawable -> {
|
||||
showPrintPrevious()
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ import es.verdnatura.domain.toast
|
|||
import es.verdnatura.presentation.base.BaseFragment
|
||||
import es.verdnatura.presentation.common.OnCollectionTicketSelectedListener
|
||||
import es.verdnatura.presentation.common.OnOptionsSelectedListener
|
||||
import es.verdnatura.presentation.common.TAG
|
||||
import es.verdnatura.presentation.common.ToolBarAdapterTooltip
|
||||
import es.verdnatura.presentation.common.convertToDateString
|
||||
import es.verdnatura.presentation.view.component.CustomDialog
|
||||
|
@ -134,7 +133,6 @@ class SacadorFragmentNew(
|
|||
|
||||
}
|
||||
|
||||
iconVehicleIn.drawable -> ma.onVehicleSelected(SacadorFragment.TAG)
|
||||
iconPrint.drawable -> {
|
||||
showPrintPrevious()
|
||||
}
|
||||
|
|
|
@ -6,9 +6,9 @@ import androidx.lifecycle.MutableLiveData
|
|||
import androidx.lifecycle.map
|
||||
import com.google.gson.JsonObject
|
||||
import es.verdnatura.domain.SalixCallback
|
||||
import es.verdnatura.domain.getMessageFromAllResponse
|
||||
import es.verdnatura.domain.nameofFunction
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.base.getMessageFromAllResponse
|
||||
import es.verdnatura.presentation.base.nameofFunction
|
||||
import es.verdnatura.presentation.common.Event
|
||||
import es.verdnatura.presentation.common.ResponseItemVO
|
||||
import es.verdnatura.presentation.view.feature.historicoshelvinglog.model.ShelvingLogSalixList
|
||||
|
|
|
@ -38,7 +38,7 @@ data class Sale(
|
|||
val longName: String,
|
||||
val size: Int,
|
||||
var semaphore: String?,
|
||||
val color: String = "",
|
||||
var color: String = "",
|
||||
val productor: String? = "",
|
||||
val origin: String = "",
|
||||
val concept: String = "",
|
||||
|
@ -69,7 +69,9 @@ data class Sale(
|
|||
var accumulatedQuantity: Int = 0,
|
||||
var totalItemShelving: Int = 0,
|
||||
var currentItemShelving: Int = 0,
|
||||
var stateCode: String? = ""
|
||||
var stateCode: String? = "",
|
||||
var ticketOrder: Int? = null,
|
||||
val username: String? = null
|
||||
|
||||
)
|
||||
|
||||
|
@ -305,3 +307,5 @@ data class TicketStateSalix(
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
data class ItemShelvingSale(val saleFk: Number, val itemShelvingFk: Number)
|
||||
|
|
|
@ -17,7 +17,7 @@ class AutomaticAdapter(
|
|||
)
|
||||
}
|
||||
|
||||
fun updateItems( list: List<Long>){
|
||||
fun updateItems(list: List<Long>) {
|
||||
items = list
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
@ -26,9 +26,6 @@ class AutomaticAdapter(
|
|||
|
||||
override fun onBindViewHolder(holder: ItemHolder, position: Int) {
|
||||
holder.bind(items[position])
|
||||
holder.binding.root.setOnClickListener {
|
||||
onAutomaticItemClickListener.onAutomaticItemClickListener(position)
|
||||
}
|
||||
}
|
||||
|
||||
inner class ItemHolder(
|
||||
|
@ -37,10 +34,12 @@ class AutomaticAdapter(
|
|||
private val res = binding.root.context.resources
|
||||
fun bind(item: Long) {
|
||||
binding.itemfkText.text = item.toString()
|
||||
binding.deleteItem.setOnClickListener {
|
||||
onAutomaticItemClickListener.onAutomaticItemClickListener(
|
||||
layoutPosition
|
||||
)
|
||||
}
|
||||
|
||||
/* binding.apply {
|
||||
this.item = item
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
|
@ -24,10 +24,8 @@ class AutomaticAddItemFragment(
|
|||
) : BaseFragment<FragmentAutomaticAddItemBinding, UbicadorViewModel>(
|
||||
UbicadorViewModel::class
|
||||
) {
|
||||
|
||||
private var adapter: AutomaticAdapter? = null
|
||||
private var listItems: ArrayList<Long> = ArrayList()
|
||||
private var contador = 0
|
||||
private lateinit var customDialogList: CustomDialogList
|
||||
private var listShelvings: ArrayList<BarcodeVO> = ArrayList()
|
||||
private var listShelvingsAdapter: BarcodeAdapter? = null
|
||||
|
@ -54,19 +52,22 @@ class AutomaticAddItemFragment(
|
|||
|
||||
private fun setSubtitle() {
|
||||
binding.mainToolbar.toolbarSubtitle.text =
|
||||
getString(R.string.doubleText, getString(R.string.labels), contador.toString())
|
||||
getString(
|
||||
R.string.doubleText,
|
||||
getString(R.string.labels),
|
||||
(listItems.size).toString()
|
||||
)
|
||||
}
|
||||
|
||||
private fun setViews() {
|
||||
adapter = AutomaticAdapter(listItems, object : OnAutomaticItemClickListener {
|
||||
override fun onAutomaticItemClickListener(position: Int) {
|
||||
contador -= 1
|
||||
setSubtitle()
|
||||
|
||||
if (listItems.size > position) {
|
||||
listItems.removeAt(position)
|
||||
adapter!!.notifyDataSetChanged()
|
||||
}
|
||||
|
||||
setSubtitle()
|
||||
}
|
||||
})
|
||||
binding.itemsRecyclerview.adapter = adapter
|
||||
|
@ -80,8 +81,6 @@ class AutomaticAddItemFragment(
|
|||
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
||||
if (binding.editMatricula.text.toString().isNotEmpty()) {
|
||||
contador += 1
|
||||
setSubtitle()
|
||||
try {
|
||||
listItems.add(
|
||||
0,
|
||||
|
@ -92,6 +91,7 @@ class AutomaticAddItemFragment(
|
|||
).toString().toLong()
|
||||
|
||||
)
|
||||
setSubtitle()
|
||||
adapter!!.notifyItemInserted(0)
|
||||
binding.itemsRecyclerview.scrollToPosition(0)
|
||||
} catch (ex: Exception) {
|
||||
|
|
|
@ -57,7 +57,7 @@ import java.util.Locale
|
|||
import kotlin.math.ceil
|
||||
|
||||
@Suppress("UNUSED_ANONYMOUS_PARAMETER")
|
||||
class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewModel>(
|
||||
class UbicadorFragment : BaseFragment<FragmentUbicadorBinding, UbicadorViewModel>(
|
||||
UbicadorViewModel::class
|
||||
) {
|
||||
private var shelvingFk: String = ""
|
||||
|
@ -89,7 +89,7 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
|||
private const val ARG_SHELVINGFK = "shelvingFk"
|
||||
private const val ARG_ISAUTOSELF = "autoSelf"
|
||||
fun newInstance(shelvingFk: String, isAutoSelf: Boolean = false) =
|
||||
UbicadorFragment6869().apply {
|
||||
UbicadorFragment().apply {
|
||||
arguments = Bundle().apply {
|
||||
putString(ARG_SHELVINGFK, shelvingFk)
|
||||
putBoolean(ARG_ISAUTOSELF, isAutoSelf)
|
||||
|
@ -105,10 +105,6 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
|||
}
|
||||
}
|
||||
|
||||
/*fun newInstance(entryPoint: String, autoSelf: Boolean = false) =
|
||||
UbicadorFragmentNew(entryPoint, autoSelf)
|
||||
}*/
|
||||
|
||||
override fun getLayoutId(): Int = R.layout.fragment_ubicador
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
|
@ -155,8 +151,8 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
|||
private fun setDialogs() {
|
||||
customDialogInput = CustomDialogInput(requireContext())
|
||||
customDialog = CustomDialog(requireContext())
|
||||
customDialogOlder = CustomDialog(requireContext())
|
||||
customDialogTwoButtons = CustomDialogTwoButtons(requireContext())
|
||||
// customDialogOlder = CustomDialog(requireContext())
|
||||
// customDialogTwoButtons = CustomDialogTwoButtons(requireContext())
|
||||
}
|
||||
|
||||
private fun setToolBar() {
|
||||
|
@ -259,8 +255,9 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
|||
customDialogReset.setTitle(getString(R.string.checkItemShelvingDescrip))
|
||||
.setDescription(getString(R.string.checkItemShelving))
|
||||
.setOkButton(getString(R.string.ok)) {
|
||||
if (listItems.isNotEmpty())
|
||||
viewModel.itemShelvingDeleteChecked(listItems[0].shelvingFk)
|
||||
if (listItems.isNotEmpty()) viewModel.itemShelvingDeleteChecked(
|
||||
listItems[0].shelvingFk
|
||||
)
|
||||
customDialogReset.dismiss()
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
customDialogReset.dismiss()
|
||||
|
@ -479,15 +476,15 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
|||
private fun customDialogActionChange() {
|
||||
|
||||
//Tarea 7920
|
||||
/* if (listItems.isNotEmpty()) {
|
||||
viewModel.shelvingChangeSalix(
|
||||
shelvingFk, customDialogInput.getValue()
|
||||
)
|
||||
} else {*/
|
||||
|
||||
if (listItems.isNotEmpty()) {
|
||||
viewModel.getShelvingFkFromCode(
|
||||
listItems[0].shelvingFk, customDialogInput.getValue()
|
||||
)
|
||||
// }
|
||||
} else {
|
||||
getString(R.string.shelvingItems).toast(requireContext())
|
||||
}
|
||||
|
||||
shelvingFk = customDialogInput.getValue()
|
||||
|
||||
customDialogInput.dismiss()
|
||||
|
@ -597,6 +594,16 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
|||
)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
responseItemShelvingSaleReserve.observe(viewLifecycleOwner) {
|
||||
ma.messageWithSound(
|
||||
getString(R.string.messageItemReserve),
|
||||
isError = true,
|
||||
isPlayed = true,
|
||||
titleWithError = "",
|
||||
true
|
||||
)
|
||||
}
|
||||
responseLogAdd.observe(viewLifecycleOwner) {
|
||||
isShelvinLogfromMainScreen = false
|
||||
|
@ -642,7 +649,7 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
|||
event.getContentIfNotHandled().notNull {
|
||||
|
||||
if (it.list.isNotEmpty()) {
|
||||
|
||||
customDialogOlder = CustomDialog(requireContext())
|
||||
val oldList = it.list.filter { item ->
|
||||
item.itemCreated!!.contains("old", ignoreCase = true)
|
||||
}.map { item ->
|
||||
|
@ -679,14 +686,12 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
|||
|
||||
var finalOutput = ""
|
||||
if (oldList.isNotEmpty()) {
|
||||
finalOutput =
|
||||
getString(R.string.ubicationItemNewer, resultStringOld)
|
||||
finalOutput = getString(R.string.ubicationItemNewer, resultStringOld)
|
||||
}
|
||||
if (newList.isNotEmpty()) {
|
||||
finalOutput += getString(R.string.ubicationItemOlder, resultStringNew)
|
||||
}
|
||||
customDialogOlder.setTitle(getString(R.string.info))
|
||||
.setDescription(
|
||||
customDialogOlder.setTitle(getString(R.string.info)).setDescription(
|
||||
finalOutput
|
||||
).setOkButton(
|
||||
getString(R.string.ok)
|
||||
|
@ -697,18 +702,36 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
|||
)
|
||||
|
||||
Action.TRANSFERIR -> {
|
||||
println("transfer item ${it.itemShelvingFk}")
|
||||
println("transfer carro ${it.originalShelvingFk}")
|
||||
viewModel.itemShelvingTransfer(
|
||||
it.itemShelvingFk!!,
|
||||
it.originalShelvingFk
|
||||
it.itemShelvingFk!!, it.originalShelvingFk
|
||||
)
|
||||
}
|
||||
|
||||
null -> d("", "no action")
|
||||
}
|
||||
|
||||
|
||||
//tarea 7412
|
||||
viewModel.notificationQueues(
|
||||
notification = "misallocation-warehouse",
|
||||
workerfk = mobileApplication.userId!!,
|
||||
body = if (it.originalAction == Action.PARKINEAR) {
|
||||
getString(
|
||||
R.string.actionParking,
|
||||
it.originalAction,
|
||||
it.originalShelvingFk,
|
||||
it.originalParking,
|
||||
mobileApplication.userName!!
|
||||
)
|
||||
} else {
|
||||
getString(
|
||||
R.string.tansferItem,
|
||||
it.originalAction,
|
||||
it.originalItem,
|
||||
it.originalParking,
|
||||
mobileApplication.userName!!
|
||||
)
|
||||
}
|
||||
)
|
||||
customDialogOlder.dismiss()
|
||||
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
|
@ -716,12 +739,13 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
|||
}.setCancelable(true)
|
||||
customDialogOlder.window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
|
||||
|
||||
}
|
||||
|
||||
Handler(Looper.getMainLooper()).postDelayed({
|
||||
customDialogOlder.show()
|
||||
if (finalOutput != "") customDialogOlder.show()
|
||||
}, 1000)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
loadResponseHasOlder.observe(viewLifecycleOwner) { event ->
|
||||
event.getContentIfNotHandled().notNull {
|
||||
|
@ -869,7 +893,6 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
|||
.setItemValue(itemUbicador.item.id.toString())
|
||||
.setPackingValue(itemUbicador.packing.toString())
|
||||
.setVisibleValue(itemUbicador.visible.toString())
|
||||
//.setEtiquetaValue((itemUbicador.visible / (itemUbicador.packing ?: 0)).toString())
|
||||
.setEtiquetaValue(itemUbicador.stickers.toString()).setUnits(
|
||||
if (itemUbicador.stickers != null && itemUbicador.stickers != 0) {
|
||||
(itemUbicador.visible % itemUbicador.stickers!!).toString()
|
||||
|
@ -1103,12 +1126,12 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
|||
customDialogUbicador.setVisibleValue("")
|
||||
customDialogUbicador.setVisibleValue(
|
||||
(((customDialogUbicador.getEtiquetaValue().toIntOrNull()
|
||||
?: 0) * (customDialogUbicador.getPackingValue().toIntOrNull()
|
||||
?: 0)) + (customDialogUbicador.getUnitsValue().toIntOrNull() ?: 0)).toString()
|
||||
?: 0) * (customDialogUbicador.getPackingValue().toIntOrNull() ?: 0))).toString()
|
||||
)
|
||||
}
|
||||
|
||||
private fun showMoreOptions(item: ItemShelving) {
|
||||
customDialogTwoButtons = CustomDialogTwoButtons(requireContext())
|
||||
customDialogTwoButtons.setTitle(item.item.id.toString())
|
||||
.setDescription(getString(R.string.selectAction))
|
||||
.setOkButton(getString(R.string.transfer)) {
|
||||
|
@ -1140,8 +1163,8 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
|||
}
|
||||
).setOkButton(getString(R.string.delete)) {
|
||||
if (!isAutoSelf) {
|
||||
listItems.remove(item)
|
||||
adapter!!.notifyItemRemoved(listItems.indexOf(item))
|
||||
// listItems.remove(item)
|
||||
//adapter!!.notifyItemRemoved(listItems.indexOf(item))
|
||||
viewModel.itemShelvingDelete(
|
||||
item.id
|
||||
)
|
||||
|
@ -1164,8 +1187,7 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
|||
.setOkButtonThree(getString(R.string.print)) {
|
||||
val printerDialogManager = PrinterDialogManager(requireContext())
|
||||
printerDialogManager.showPrintDialog(
|
||||
item.item.id,
|
||||
item.description ?: ""
|
||||
item.item.id, item.description ?: ""
|
||||
) { id, labelType, packing, copies ->
|
||||
|
||||
if (item.buyFk == null) {
|
||||
|
@ -1174,8 +1196,7 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
|||
warehouseFk = mobileApplication.dataStoreApp.readDataStoreKey(
|
||||
WAREHOUSEFK
|
||||
),
|
||||
dated = LocalDate.now()
|
||||
.format(
|
||||
dated = LocalDate.now().format(
|
||||
DateTimeFormatter.ofPattern("yyyy-dd-MM")
|
||||
),
|
||||
reportName = "LabelBuy",
|
||||
|
@ -1191,37 +1212,14 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
|||
customDialogTwoButtons.dismiss()
|
||||
} else {
|
||||
printItem(
|
||||
item.buyFk!!, labelType, packing, copies
|
||||
item.buyFk, labelType, packing, copies
|
||||
)
|
||||
customDialogTwoButtons.dismiss()
|
||||
}
|
||||
}
|
||||
customDialogInput.getEditText().requestFocus()
|
||||
}
|
||||
//Tarea 7763
|
||||
/*
|
||||
.setOkButtonThree(getString(R.string.rename)) {
|
||||
customDialogInput.setTitle(getString(R.string.itemNew))
|
||||
.setDescription(getString(R.string.scanItem)).setValue("")
|
||||
.setOkButton(getString(R.string.rename)) {
|
||||
|
||||
actionRename(item, customDialogInput.getValue())
|
||||
|
||||
}.setKoButton(getString(R.string.cancel)) {
|
||||
customDialogInput.dismiss()
|
||||
customDialogTwoButtons.dismiss()
|
||||
}.show()
|
||||
customDialogInput.getEditText().setOnEditorActionListener { _, actionId, _ ->
|
||||
if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || actionId == 0 || actionId == 5) {
|
||||
|
||||
actionRename(item, customDialogInput.getValue())
|
||||
return@setOnEditorActionListener true
|
||||
}
|
||||
false
|
||||
}
|
||||
customDialogInput.getEditText().requestFocus()
|
||||
}
|
||||
*/
|
||||
customDialogTwoButtons.setKoButton(getString(R.string.cancel)) {
|
||||
customDialogTwoButtons.dismiss()
|
||||
}
|
||||
|
@ -1281,14 +1279,7 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
|||
|
||||
private fun customDialogTransferAction(item: ItemShelving) {
|
||||
if (customDialogInput.getValue().isNotEmpty()) {
|
||||
/*tearea 6964*/
|
||||
// }
|
||||
/* viewModel.hasItemOlder(
|
||||
shelvingFk = shelvingFk,
|
||||
parking = customDialogInput.getValue(),
|
||||
itemFk = item.id,
|
||||
action = Action.TRANSFERIR
|
||||
)*/
|
||||
|
||||
viewModel.getParkingToTransfer(
|
||||
shelvingFkTo = customDialogInput.getValue(),
|
||||
itemShelvingFk = item.id,
|
||||
|
@ -1296,8 +1287,7 @@ class UbicadorFragment6869 : BaseFragment<FragmentUbicadorBinding, UbicadorViewM
|
|||
shelvingFkFrom = shelvingFk
|
||||
)
|
||||
println("transfer item ${item.id}")
|
||||
println("transfer carro ${customDialogInput.getValue()}")
|
||||
/* viewModel.itemShelvingTransfer(
|
||||
println("transfer carro ${customDialogInput.getValue()}")/* viewModel.itemShelvingTransfer(
|
||||
item.id, customDialogInput.getValue()
|
||||
)*/
|
||||
listItems.remove(item)
|
File diff suppressed because it is too large
Load Diff
|
@ -11,6 +11,7 @@ import es.verdnatura.domain.SalixCallback
|
|||
import es.verdnatura.domain.formatWithQuotes
|
||||
import es.verdnatura.domain.userCases.GetItemFromBarcodeUseCase
|
||||
import es.verdnatura.domain.userCases.GetItemPrintItemUseCase
|
||||
import es.verdnatura.domain.userCases.NotiticationUseCase
|
||||
import es.verdnatura.presentation.base.BaseViewModel
|
||||
import es.verdnatura.presentation.common.Action
|
||||
import es.verdnatura.presentation.common.Event
|
||||
|
@ -18,6 +19,8 @@ import es.verdnatura.presentation.common.ItemShelvingSalix
|
|||
import es.verdnatura.presentation.common.ResponseHasOlder
|
||||
import es.verdnatura.presentation.view.feature.claim.fragment.reubication.model.Reubication
|
||||
import es.verdnatura.presentation.view.feature.claim.fragment.reubication.model.ReubicationList
|
||||
import es.verdnatura.presentation.view.feature.packaging.model.NotificationQueue
|
||||
import es.verdnatura.presentation.view.feature.sacador.model.ItemShelvingSale
|
||||
import es.verdnatura.presentation.view.feature.ubicador.model.ItemBuy
|
||||
import es.verdnatura.presentation.view.feature.ubicador.model.ItemShelvingNewer
|
||||
import es.verdnatura.presentation.view.feature.ubicador.model.ItemShelvingNewerList
|
||||
|
@ -28,15 +31,23 @@ import es.verdnatura.presentation.view.feature.workermistake.model.MakeMultiSali
|
|||
import org.json.JSONObject
|
||||
import retrofit2.Call
|
||||
import retrofit2.Response
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Calendar
|
||||
import java.util.Locale
|
||||
|
||||
class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
||||
private val getItemFromBarcodeUseCase = GetItemFromBarcodeUseCase(salix)
|
||||
private val printItemUseCase = GetItemPrintItemUseCase(salix)
|
||||
private val notificationUseCase = NotiticationUseCase(salix)
|
||||
|
||||
private val _responseUbicator by lazy { MutableLiveData<Boolean>() }
|
||||
val responseUbicator: LiveData<Boolean>
|
||||
get() = _responseUbicator
|
||||
|
||||
private val _responseItemShelvingSaleReserve by lazy { MutableLiveData<Boolean>() }
|
||||
val responseItemShelvingSaleReserve: LiveData<Boolean>
|
||||
get() = _responseItemShelvingSaleReserve
|
||||
|
||||
private val _responseHasOlder by lazy { MutableLiveData<ResponseHasOlder>() }
|
||||
val responseHasOlder: LiveData<ResponseHasOlder>
|
||||
get() = _responseHasOlder
|
||||
|
@ -247,47 +258,6 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun hasItemOlder(
|
||||
shelvingFk: String,
|
||||
parking: String?,
|
||||
itemFk: Int?,
|
||||
action: Action?,
|
||||
itemShelvingFk: Number? = null
|
||||
|
||||
) {
|
||||
salix.getListItemNewerNew(shelvingFk, parking, itemFk)
|
||||
//salix.getListItemNewer(shelvingFk, parking)
|
||||
.enqueue(object : SalixCallback<List<ItemShelvingNewer>>(context) {
|
||||
|
||||
override fun onSuccess(response: Response<List<ItemShelvingNewer>>) {
|
||||
|
||||
if (response.body()!!.isEmpty()) {
|
||||
when (action) {
|
||||
Action.PARKINEAR -> setParking(shelvingFk, parking!!)
|
||||
Action.TRANSFERIR -> {
|
||||
itemShelvingTransfer(itemShelvingFk!!, shelvingFk)
|
||||
}
|
||||
|
||||
null -> setParking(shelvingFk, parking!!)
|
||||
}
|
||||
} else {
|
||||
_shelvingListItemNewer.value =
|
||||
response.body()?.let {
|
||||
ItemShelvingNewerList(
|
||||
it,
|
||||
originalShelvingFk = shelvingFk,
|
||||
originalParking = parking!!,
|
||||
originalItem = itemFk,
|
||||
originalAction = action
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun getItemsByReviewOrder(
|
||||
shelving: String,
|
||||
parking: String?,
|
||||
|
@ -310,7 +280,7 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
Action.PARKINEAR -> setParking(shelving, parking!!)
|
||||
Action.TRANSFERIR -> {
|
||||
|
||||
itemShelvingTransfer(itemShelvingFk!!, shelving!!)
|
||||
itemShelvingTransfer(itemShelvingFk!!, shelving)
|
||||
}
|
||||
|
||||
null -> d("", "No action")
|
||||
|
@ -380,6 +350,26 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun getMergeFromCode(
|
||||
vShelft: Int, shelvingCode: String
|
||||
|
||||
) {
|
||||
|
||||
salix.shelvingGetFromCode(
|
||||
filter = """{"where":{"code":"$shelvingCode"}}"""
|
||||
).enqueue(object : SalixCallback<ItemUbicador>(context) {
|
||||
|
||||
override fun onSuccess(response: Response<ItemUbicador>) {
|
||||
val myItemCode = response.body().let { it as ItemUbicador }
|
||||
|
||||
itemShelvingMerge(
|
||||
vShelft, myItemCode.id.toString()
|
||||
)
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun itemShelvingMerge(
|
||||
vShelf: Int, shelvingFk: String
|
||||
|
||||
|
@ -502,24 +492,6 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun shelvingChangeSalix(
|
||||
shelvingFkIn: String, shelvingFkOut: String
|
||||
|
||||
) {
|
||||
salix.itemShelvingsUpdate(
|
||||
where = JsonObject().apply {
|
||||
addProperty("shelvingFk", shelvingFkIn)
|
||||
},
|
||||
hashMapOf("shelvingFk" to shelvingFkOut)
|
||||
).enqueue(object : SalixCallback<Any>(context) {
|
||||
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_responseUbicator.value = true
|
||||
super.onSuccess(response)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
//tarea 7920
|
||||
fun shelvingChangeSalixNew(
|
||||
shelvingFkIn: Number, shelvingFkOut: Number
|
||||
|
@ -557,6 +529,26 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun itemShelvingAlternativeFromCode(
|
||||
shelvingCode: String
|
||||
|
||||
) {
|
||||
|
||||
salix.shelvingGetFromCode(
|
||||
filter = """{"where":{"code":"$shelvingCode"}}"""
|
||||
).enqueue(object : SalixCallback<ItemUbicador>(context) {
|
||||
|
||||
override fun onSuccess(response: Response<ItemUbicador>) {
|
||||
val myItemCode = response.body().let { it as ItemUbicador }
|
||||
|
||||
itemShelvingAlternative(
|
||||
myItemCode.id.toString()
|
||||
)
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun itemShelvingTransfer(
|
||||
itemShelvingFk: Number, shelvingFk: String
|
||||
|
||||
|
@ -572,13 +564,33 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
}
|
||||
|
||||
fun itemShelvingDelete(itemShelvingFk: Int) {
|
||||
salix.itemShelvingsDelete(itemShelvingFk).enqueue(object : SalixCallback<Any>(context) {
|
||||
|
||||
val calendar = Calendar.getInstance()
|
||||
calendar.add(Calendar.DAY_OF_YEAR, 0)
|
||||
val dateFormat = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault())
|
||||
val today = dateFormat.format(calendar.time)
|
||||
|
||||
salix.itemShelvingSaleTotalBySale(
|
||||
filter = """
|
||||
{"where":{"itemShelvingFk":$itemShelvingFk,"created":{"gte":"$today"}},"limit":10}
|
||||
""".trimIndent()
|
||||
).enqueue(object : SalixCallback<List<ItemShelvingSale>>(context) {
|
||||
override fun onSuccess(response: Response<List<ItemShelvingSale>>) {
|
||||
if (response.body()!!.isEmpty())
|
||||
salix.itemShelvingsDelete(itemShelvingFk)
|
||||
.enqueue(object : SalixCallback<Any>(context) {
|
||||
|
||||
override fun onSuccess(response: Response<Any>) {
|
||||
_responseUbicator.value = true
|
||||
|
||||
}
|
||||
}) else {
|
||||
_responseItemShelvingSaleReserve.value = false
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
fun itemShelvingSelfConsumption(shelvingFk: String, itemFk: Number, quantity: Int) {
|
||||
|
@ -605,6 +617,18 @@ class UbicadorViewModel(val context: Context) : BaseViewModel(context) {
|
|||
})
|
||||
}
|
||||
|
||||
fun notificationQueues(notification: String, workerfk: Int, body: String) {
|
||||
notificationUseCase.executeSendNotification(
|
||||
NotificationQueue(
|
||||
notification,
|
||||
workerfk,
|
||||
body
|
||||
)
|
||||
)
|
||||
.enqueue(object : SalixCallback<Void>(context) {
|
||||
})
|
||||
}
|
||||
|
||||
fun printItem(
|
||||
reportName: String,
|
||||
printerFk: Int,
|
||||
|
|
|
@ -12,7 +12,7 @@ import es.verdnatura.presentation.base.BaseFragment
|
|||
import es.verdnatura.presentation.common.GeneralAdapter
|
||||
import es.verdnatura.presentation.common.GeneralItem
|
||||
import es.verdnatura.presentation.common.OnCollectionSelectedListener
|
||||
import es.verdnatura.presentation.common.OnGeneralItemRowClickListener
|
||||
import es.verdnatura.presentation.common.OnGeneralRowClickListener
|
||||
import es.verdnatura.presentation.view.component.CustomDialogList
|
||||
import es.verdnatura.presentation.view.feature.inventario.fragment.InventaryViewModel
|
||||
import es.verdnatura.presentation.view.feature.workermistake.model.MistakeType
|
||||
|
@ -118,9 +118,11 @@ class PackingMistakeFragment(var menuOrigin: String) :
|
|||
|
||||
|
||||
listMistakesAdapter =
|
||||
GeneralAdapter(listMistakes, object : OnGeneralItemRowClickListener {
|
||||
override fun onGeneralItemRowClickListener(item: GeneralItem) {
|
||||
GeneralAdapter(listMistakes, onRowClickListener = object : OnGeneralRowClickListener {
|
||||
|
||||
override fun onRowClickListener(item: GeneralItem) {
|
||||
list.forEach {
|
||||
|
||||
if (it.description == item.text) {
|
||||
|
||||
try {
|
||||
|
@ -140,11 +142,12 @@ class PackingMistakeFragment(var menuOrigin: String) :
|
|||
customDialogList.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
customDialogList.getRecyclerView().adapter = listMistakesAdapter
|
||||
customDialogList.getRecyclerView().layoutManager =
|
||||
LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false)
|
||||
|
|
|
@ -63,6 +63,15 @@
|
|||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="@dimen/body2" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="@string/reserve"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="@dimen/body2" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:clickable="false">
|
||||
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/verdnatura_black"
|
||||
>
|
||||
|
||||
android:background="@color/verdnatura_black">
|
||||
|
||||
|
||||
<EditText
|
||||
|
@ -19,27 +16,26 @@
|
|||
style="@style/ScanLineTextSearch"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:autofillHints="text"
|
||||
android:hint="@string/Escaner"
|
||||
android:inputType="textVisiblePassword"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:autofillHints="text"
|
||||
android:paddingStart="@dimen/default_layout_margin"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/main_toolbar"
|
||||
android:paddingStart="@dimen/default_layout_margin"/>
|
||||
app:layout_constraintTop_toTopOf="@+id/main_toolbar" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/previaButton"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:visibility="invisible"
|
||||
android:tooltipText="@string/allowMarkSalesPrevia"
|
||||
android:contentDescription="@string/previousCollected"
|
||||
app:srcCompat="@drawable/ic_streetview_black_24dp"
|
||||
android:tooltipText="@string/allowMarkSalesPrevia"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintStart_toEndOf="@+id/scan_input"
|
||||
app:layout_constraintTop_toTopOf="@+id/scan_input"
|
||||
/>
|
||||
app:srcCompat="@drawable/ic_streetview_black_24dp" />
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/collection_swipe"
|
||||
|
@ -56,8 +52,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="8dp"
|
||||
tools:listitem="@layout/sale_row_fragment" />
|
||||
|
||||
tools:listitem="@layout/sale_row_fragment_reserve_sacador" />
|
||||
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
|
|
@ -1,75 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="@dimen/toolbar_height"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/layout_margin_min"
|
||||
android:layout_marginBottom="@dimen/layout_margin_1"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="@dimen/layout_margin_min"
|
||||
android:paddingEnd="@dimen/layout_margin_min">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="start"
|
||||
android:text="@string/Worker"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="@dimen/body2" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="start"
|
||||
android:text="@string/InTimed"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="@dimen/body2" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="@string/OutTimed"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="@dimen/body2" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/historicovehiculo_recyclerview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipToPadding="false"
|
||||
tools:listitem="@layout/item_historicovehiculo_row" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include
|
||||
android:id="@+id/main_toolbar"
|
||||
layout="@layout/toolbar_fragment"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
|
@ -1,117 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scroll_view"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/scan_input"
|
||||
style="@style/ScanLineTextSearch"
|
||||
android:layout_width="match_parent"
|
||||
android:hint="@string/Escaneaetiqueta"
|
||||
android:inputType="text"
|
||||
android:lines="1"
|
||||
android:maxLines="1" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/layout_margin_min"
|
||||
android:layout_marginBottom="@dimen/layout_margin_1"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="@dimen/layout_margin_min"
|
||||
android:paddingEnd="@dimen/layout_margin_min">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/itemfk"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="@dimen/body2" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:text="@string/name"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="@dimen/body2" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2"
|
||||
android:gravity="center"
|
||||
android:text="@string/wagoon"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="@dimen/body2" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:text="@string/quantity"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:textSize="@dimen/body2" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:descendantFocusability="blocksDescendants">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/itemshelvinglog_recyclerview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipToPadding="false"
|
||||
android:visibility="visible"
|
||||
tools:listitem="@layout/item_shelvinglog_row" />
|
||||
<Button
|
||||
android:id="@+id/load_more_button"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="40dp"
|
||||
android:text="Cargar más resultados"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="@color/verdnatura_orange_salix"
|
||||
android:textColor="@color/verdnatura_white"
|
||||
android:layout_below="@id/itemshelvinglog_recyclerview"
|
||||
android:layout_marginTop="16dp"
|
||||
android:visibility="gone" />
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</ScrollView>
|
||||
|
||||
<include
|
||||
android:id="@+id/main_toolbar"
|
||||
layout="@layout/toolbar_fragment"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
|
@ -22,8 +22,7 @@
|
|||
android:id="@+id/webView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="0dp"
|
||||
/>
|
||||
android:layout_marginTop="0dp" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</layout>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue