diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml new file mode 100644 index 00000000..2850b67a --- /dev/null +++ b/.idea/deploymentTargetDropDown.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 1fd47289..0cc2ca2e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,8 +6,8 @@ apply plugin: 'com.google.gms.google-services' android { - def appVersionCode = 240 - def appVersionName = '1.18.10' + def appVersionCode = 242 + def appVersionName = '1.19.1' signingConfigs { release { @@ -103,12 +103,12 @@ dependencies { implementation 'com.google.android.gms:play-services-basement:17.6.0' - implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'androidx.appcompat:appcompat:1.3.1' implementation 'androidx.legacy:legacy-support-v4:1.0.0' - implementation 'com.google.android.material:material:1.3.0' - implementation 'androidx.constraintlayout:constraintlayout:2.0.4' + implementation 'com.google.android.material:material:1.4.0' + implementation 'androidx.constraintlayout:constraintlayout:2.1.1' implementation 'androidx.cardview:cardview:1.0.0' - implementation 'androidx.recyclerview:recyclerview:1.2.0' + implementation 'androidx.recyclerview:recyclerview:1.2.1' implementation 'androidx.preference:preference-ktx:1.1.1' implementation 'com.squareup.okhttp3:okhttp:4.9.1' implementation 'com.squareup.retrofit2:retrofit:2.9.0' @@ -120,7 +120,7 @@ dependencies { implementation 'org.apache.commons:commons-text:1.9' //MVVM - def dagger2_version = '2.29.1' + def dagger2_version = '2.35.1' api "com.google.dagger:dagger:$dagger2_version" annotationProcessor "com.google.dagger:dagger-compiler:$dagger2_version" api "com.google.dagger:dagger-android:$dagger2_version" @@ -156,6 +156,10 @@ dependencies { implementation project(':keyobardemulatorscannerlibrary') androidTestImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.1' androidTestImplementation 'org.testng:testng:7.4.0' + + + implementation 'com.github.RaviKoradiya:LiveAdapter:1.3.4' + implementation 'org.reflections:reflections:0.10.2' } repositories { diff --git a/app/src/main/java/it/integry/integrywmsnative/MainApplicationModule.java b/app/src/main/java/it/integry/integrywmsnative/MainApplicationModule.java index 4bb1cddb..2f7859b2 100644 --- a/app/src/main/java/it/integry/integrywmsnative/MainApplicationModule.java +++ b/app/src/main/java/it/integry/integrywmsnative/MainApplicationModule.java @@ -81,14 +81,14 @@ public class MainApplicationModule { @Provides @Singleton - ArticoloRESTConsumer provideArticoloRESTConsumer() { - return new ArticoloRESTConsumer(); + ArticoloRESTConsumer provideArticoloRESTConsumer(SystemRESTConsumer systemRESTConsumer) { + return new ArticoloRESTConsumer(systemRESTConsumer); } @Provides @Singleton - DepositoRESTConsumer provideDepositoRESTConsumer(EntityRESTConsumer entityRESTConsumer) { - return new DepositoRESTConsumer(entityRESTConsumer); + DepositoRESTConsumer provideDepositoRESTConsumer(EntityRESTConsumer entityRESTConsumer, SystemRESTConsumer systemRESTConsumer) { + return new DepositoRESTConsumer(entityRESTConsumer, systemRESTConsumer); } @Provides diff --git a/app/src/main/java/it/integry/integrywmsnative/core/context/AppContext.java b/app/src/main/java/it/integry/integrywmsnative/core/context/AppContext.java index b50df297..1b05a43e 100644 --- a/app/src/main/java/it/integry/integrywmsnative/core/context/AppContext.java +++ b/app/src/main/java/it/integry/integrywmsnative/core/context/AppContext.java @@ -50,7 +50,6 @@ public class AppContext { } - private void initSettings() { Stash.init(mApplicationContext); SettingsManager.init(mApplicationContext); @@ -80,5 +79,4 @@ public class AppContext { Logger.addLogAdapter(new AndroidLogAdapter()); } - } diff --git a/app/src/main/java/it/integry/integrywmsnative/core/di/BindableBoolean.java b/app/src/main/java/it/integry/integrywmsnative/core/di/BindableBoolean.java index b32ac914..7bc7649f 100644 --- a/app/src/main/java/it/integry/integrywmsnative/core/di/BindableBoolean.java +++ b/app/src/main/java/it/integry/integrywmsnative/core/di/BindableBoolean.java @@ -104,5 +104,9 @@ public class BindableBoolean implements Observable { notifyChange(); } } + + public void toggle() { + set(!get()); + } } diff --git a/app/src/main/java/it/integry/integrywmsnative/core/di/Converters.java b/app/src/main/java/it/integry/integrywmsnative/core/di/Converters.java index d36e21a0..5c9814a0 100644 --- a/app/src/main/java/it/integry/integrywmsnative/core/di/Converters.java +++ b/app/src/main/java/it/integry/integrywmsnative/core/di/Converters.java @@ -477,7 +477,7 @@ public class Converters { @BindingAdapter("visibility") - public static void bindView(View view, final ObservableField bindableBoolean) { + public static void bindViewVisibility(View view, final ObservableField bindableBoolean) { if (view.getTag(R.id.bound_observable) != bindableBoolean) { view.setTag(R.id.bound_observable, bindableBoolean); } @@ -492,6 +492,38 @@ public class Converters { } + @BindingAdapter({"reverse_visibility"}) + public static void bindViewReverseVisibility(View view, final BindableBoolean bindableBoolean) { + if (view.getTag(R.id.bound_observable) != bindableBoolean) { + view.setTag(R.id.bound_observable, bindableBoolean); + } + bindableBoolean.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() { + @Override + public void onPropertyChanged(Observable sender, int propertyId) { + view.setVisibility(bindableBoolean.get() ? View.GONE : View.VISIBLE); + } + }); + + view.setVisibility(bindableBoolean.get() ? View.GONE : View.VISIBLE); + } + + + @BindingAdapter("reverse_visibility") + public static void bindViewReverseVisibility(View view, final ObservableField bindableBoolean) { + if (view.getTag(R.id.bound_observable) != bindableBoolean) { + view.setTag(R.id.bound_observable, bindableBoolean); + } + bindableBoolean.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() { + @Override + public void onPropertyChanged(Observable sender, int propertyId) { + view.setVisibility(bindableBoolean.get() ? View.GONE : View.VISIBLE); + } + }); + + view.setVisibility(bindableBoolean.get() ? View.GONE : View.VISIBLE); + } + + @BindingAdapter("android:layout_weight") public static void setLayoutWeight(View view, final Float weight) { diff --git a/app/src/main/java/it/integry/integrywmsnative/core/expansion/OnGeneralChangedCallback.java b/app/src/main/java/it/integry/integrywmsnative/core/expansion/OnGeneralChangedCallback.java new file mode 100644 index 00000000..90362be7 --- /dev/null +++ b/app/src/main/java/it/integry/integrywmsnative/core/expansion/OnGeneralChangedCallback.java @@ -0,0 +1,14 @@ +package it.integry.integrywmsnative.core.expansion; + +import androidx.databinding.Observable; + +public abstract class OnGeneralChangedCallback extends Observable.OnPropertyChangedCallback implements Runnable{ + + @Override + public void onPropertyChanged(Observable sender, int propertyId) { + run(); + } + +// public abstract void run(); + +} diff --git a/app/src/main/java/it/integry/integrywmsnative/core/model/MtbDepo.java b/app/src/main/java/it/integry/integrywmsnative/core/model/MtbDepo.java index affe2ccd..bc720675 100644 --- a/app/src/main/java/it/integry/integrywmsnative/core/model/MtbDepo.java +++ b/app/src/main/java/it/integry/integrywmsnative/core/model/MtbDepo.java @@ -36,12 +36,12 @@ public class MtbDepo extends EntityBase implements Parcelable { private String flagTipoNegozio; private String codMdepReso; + public MtbDepo() { type = "mtb_depo"; } protected MtbDepo(Parcel in) { - type = "mtb_depo"; codMdep = in.readString(); descrizione = in.readString(); flagVal = in.readString(); @@ -357,4 +357,19 @@ public class MtbDepo extends EntityBase implements Parcelable { this.codMdepReso = codMdepReso; return this; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + MtbDepo mtbDepo = (MtbDepo) o; + + return getCodMdep().equals(mtbDepo.getCodMdep()); + } + + @Override + public int hashCode() { + return getCodMdep().hashCode(); + } } diff --git a/app/src/main/java/it/integry/integrywmsnative/core/model/MtbGrup.java b/app/src/main/java/it/integry/integrywmsnative/core/model/MtbGrup.java new file mode 100644 index 00000000..28e83607 --- /dev/null +++ b/app/src/main/java/it/integry/integrywmsnative/core/model/MtbGrup.java @@ -0,0 +1,69 @@ +package it.integry.integrywmsnative.core.model; + +public class MtbGrup extends EntityBase { + + private String codMgrp; + private String descrizione; + private String flagValMag; + private String logoWeb; + private String criterioVal; + private String tipoMgrp; + + public MtbGrup() { + this.type = "mtb_grup"; + } + + public String getCodMgrp() { + return codMgrp; + } + + public MtbGrup setCodMgrp(String codMgrp) { + this.codMgrp = codMgrp; + return this; + } + + public String getDescrizione() { + return descrizione; + } + + public MtbGrup setDescrizione(String descrizione) { + this.descrizione = descrizione; + return this; + } + + public String getFlagValMag() { + return flagValMag; + } + + public MtbGrup setFlagValMag(String flagValMag) { + this.flagValMag = flagValMag; + return this; + } + + public String getLogoWeb() { + return logoWeb; + } + + public MtbGrup setLogoWeb(String logoWeb) { + this.logoWeb = logoWeb; + return this; + } + + public String getCriterioVal() { + return criterioVal; + } + + public MtbGrup setCriterioVal(String criterioVal) { + this.criterioVal = criterioVal; + return this; + } + + public String getTipoMgrp() { + return tipoMgrp; + } + + public MtbGrup setTipoMgrp(String tipoMgrp) { + this.tipoMgrp = tipoMgrp; + return this; + } +} diff --git a/app/src/main/java/it/integry/integrywmsnative/core/rest/RESTBuilder.java b/app/src/main/java/it/integry/integrywmsnative/core/rest/RESTBuilder.java index e3678e0a..a08edd42 100644 --- a/app/src/main/java/it/integry/integrywmsnative/core/rest/RESTBuilder.java +++ b/app/src/main/java/it/integry/integrywmsnative/core/rest/RESTBuilder.java @@ -3,6 +3,7 @@ package it.integry.integrywmsnative.core.rest; import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import java.lang.reflect.Modifier; import java.util.concurrent.TimeUnit; import it.integry.integrywmsnative.core.settings.SettingsManager; @@ -50,6 +51,7 @@ public class RESTBuilder { Gson gson = new GsonBuilder() .setDateFormat("dd/MM/yyyy HH:mm:ss") + .excludeFieldsWithModifiers(Modifier.TRANSIENT) .create(); Retrofit retrofit = new Retrofit.Builder() diff --git a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/ArticoloRESTConsumer.java b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/ArticoloRESTConsumer.java index 185de530..23eda756 100644 --- a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/ArticoloRESTConsumer.java +++ b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/ArticoloRESTConsumer.java @@ -2,15 +2,21 @@ package it.integry.integrywmsnative.core.rest.consumers; import com.annimon.stream.Collectors; import com.annimon.stream.Stream; +import com.google.gson.reflect.TypeToken; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import javax.inject.Singleton; -import it.integry.integrywmsnative.core.rest.RESTBuilder; -import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse; import it.integry.integrywmsnative.core.expansion.RunnableArgs; import it.integry.integrywmsnative.core.model.MtbAart; +import it.integry.integrywmsnative.core.model.MtbGrup; +import it.integry.integrywmsnative.core.rest.RESTBuilder; +import it.integry.integrywmsnative.core.rest.model.ServiceRESTResponse; +import it.integry.integrywmsnative.core.utility.UtilityQuery; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; @@ -18,6 +24,11 @@ import retrofit2.Response; @Singleton public class ArticoloRESTConsumer extends _BaseRESTConsumer { + private final SystemRESTConsumer systemRESTConsumer; + + public ArticoloRESTConsumer(SystemRESTConsumer systemRESTConsumer) { + this.systemRESTConsumer = systemRESTConsumer; + } public void getByBarcodeProd(String barcodeProd, RunnableArgs> onComplete, RunnableArgs onFailed) { ArticoloRESTConsumerService articoloRESTConsumerService = RESTBuilder.getService(ArticoloRESTConsumerService.class); @@ -86,4 +97,21 @@ public class ArticoloRESTConsumer extends _BaseRESTConsumer { }); } + + public void getArtsGroups(List groupsToFind, RunnableArgs> onComplete, RunnableArgs onFailed) { + var whereCondMap = Stream.of(groupsToFind) + .map(x -> { + HashMap vars = new HashMap<>(); + vars.put("cod_mgrp", x); + return vars; + }) + .toList(); + + var whereCond = " WHERE " + UtilityQuery.concatFieldListInWhereCond(whereCondMap); + + Type typeOfObjectsList = new TypeToken>() {}.getType(); + this.systemRESTConsumer.processSql("SELECT * FROM mtb_grup " + whereCond, typeOfObjectsList, onComplete, onFailed); + + } + } diff --git a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/DepositoRESTConsumer.java b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/DepositoRESTConsumer.java index ef61ef87..ad4bb337 100644 --- a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/DepositoRESTConsumer.java +++ b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/DepositoRESTConsumer.java @@ -1,5 +1,9 @@ package it.integry.integrywmsnative.core.rest.consumers; +import com.google.gson.reflect.TypeToken; + +import java.lang.reflect.Type; +import java.util.ArrayList; import java.util.List; import javax.inject.Singleton; @@ -12,9 +16,17 @@ import it.integry.integrywmsnative.core.model.MtbDepo; public class DepositoRESTConsumer extends _BaseRESTConsumer { private final EntityRESTConsumer entityRESTConsumer; + private final SystemRESTConsumer systemRESTConsumer; - public DepositoRESTConsumer(EntityRESTConsumer entityRESTConsumer) { + public DepositoRESTConsumer(EntityRESTConsumer entityRESTConsumer, SystemRESTConsumer systemRESTConsumer) { this.entityRESTConsumer = entityRESTConsumer; + this.systemRESTConsumer = systemRESTConsumer; + } + + public void getAll(RunnableArgs> onComplete, RunnableArgs onFailed) { + Type typeOfObjectsList = new TypeToken>() { + }.getType(); + this.systemRESTConsumer.processSql("SELECT * FROM mtb_depo", typeOfObjectsList, onComplete, onFailed); } public void getDepoByCodMdep(String codMdep, RunnableArgs onComplete, RunnableArgs onFailed) { diff --git a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/_BaseRESTConsumer.java b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/_BaseRESTConsumer.java index 62a5620b..8d8c0d8f 100644 --- a/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/_BaseRESTConsumer.java +++ b/app/src/main/java/it/integry/integrywmsnative/core/rest/consumers/_BaseRESTConsumer.java @@ -39,7 +39,7 @@ public class _BaseRESTConsumer { } } else { if (response.code() == 404) { - Log.e(logTitle, "Errore " + response.code() + ": risorsa non trovata"); + Log.e(logTitle, "Errore " + response.code() + ": risorsa non trovata (" + response.raw().request().url().toString() + ")"); onFailed.run(new Exception("Errore " + response.code() + ": risorsa non trovata (" + logTitle + ")")); } else { Log.e(logTitle, "Status " + response.code() + ": " + response.message()); diff --git a/app/src/main/java/it/integry/integrywmsnative/core/rest/model/OrdineUscitaInevasoDTO.java b/app/src/main/java/it/integry/integrywmsnative/core/rest/model/OrdineUscitaInevasoDTO.java index a3b90989..4f3d63a4 100644 --- a/app/src/main/java/it/integry/integrywmsnative/core/rest/model/OrdineUscitaInevasoDTO.java +++ b/app/src/main/java/it/integry/integrywmsnative/core/rest/model/OrdineUscitaInevasoDTO.java @@ -3,6 +3,7 @@ package it.integry.integrywmsnative.core.rest.model; import java.math.BigDecimal; import java.text.ParseException; import java.util.Date; +import java.util.List; import it.integry.integrywmsnative.core.model.OrdineInevasoDTO; import it.integry.integrywmsnative.core.utility.UtilityDate; @@ -43,9 +44,7 @@ public class OrdineUscitaInevasoDTO extends OrdineInevasoDTO { private boolean flagEvaso; private String nomeAgente; private String codJfas; - - - + private List availableClassMerc; public Integer getIdViaggio() { return idViaggio; @@ -363,6 +362,16 @@ public class OrdineUscitaInevasoDTO extends OrdineInevasoDTO { return this; } + public List getAvailableClassMerc() { + return availableClassMerc; + } + + public OrdineUscitaInevasoDTO setAvailableClassMerc(List availableClassMerc) { + this.availableClassMerc = availableClassMerc; + return this; + } + + @Override public boolean equals(Object o) { if (this == o) return true; @@ -382,4 +391,28 @@ public class OrdineUscitaInevasoDTO extends OrdineInevasoDTO { result = 31 * result + getGestione().hashCode(); return result; } + + public static class AvailableClassMerc { + + private String codMgrp; + private List codMsgr; + + public String getCodMgrp() { + return codMgrp; + } + + public AvailableClassMerc setCodMgrp(String codMgrp) { + this.codMgrp = codMgrp; + return this; + } + + public List getCodMsgr() { + return codMsgr; + } + + public AvailableClassMerc setCodMsgr(List codMsgr) { + this.codMsgr = codMsgr; + return this; + } + } } diff --git a/app/src/main/java/it/integry/integrywmsnative/core/utility/UtilityBoolean.java b/app/src/main/java/it/integry/integrywmsnative/core/utility/UtilityBoolean.java new file mode 100644 index 00000000..9bb722dd --- /dev/null +++ b/app/src/main/java/it/integry/integrywmsnative/core/utility/UtilityBoolean.java @@ -0,0 +1,9 @@ +package it.integry.integrywmsnative.core.utility; + +public class UtilityBoolean { + + public static int toInt(boolean bool) { + return bool ? 1 : 0; + } + +} diff --git a/app/src/main/java/it/integry/integrywmsnative/core/utility/UtilityExceptions.java b/app/src/main/java/it/integry/integrywmsnative/core/utility/UtilityExceptions.java index 739b8acb..0b1b6e37 100644 --- a/app/src/main/java/it/integry/integrywmsnative/core/utility/UtilityExceptions.java +++ b/app/src/main/java/it/integry/integrywmsnative/core/utility/UtilityExceptions.java @@ -7,6 +7,7 @@ import android.text.Html; import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentManager; +import com.annimon.stream.Stream; import com.google.firebase.crashlytics.FirebaseCrashlytics; import com.orhanobut.logger.Logger; @@ -16,6 +17,9 @@ import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView; public class UtilityExceptions { + private static final Class[] FIREBASE_IGNORED_EXCEPTIONS = new Class[] { + + }; public static void defaultException(Context context, Exception ex, Dialog progressDialog) { defaultException(context, ex); @@ -55,7 +59,10 @@ public class UtilityExceptions { .show(fm, "tag"); } - if (!BuildConfig.DEBUG) { + boolean toIgnore = ex.getClass().getName().startsWith("it.integry.integrywmsnative") || + Stream.of(FIREBASE_IGNORED_EXCEPTIONS).anyMatch(x -> x.isAssignableFrom(ex.getClass())); + + if (!BuildConfig.DEBUG && !toIgnore) { if (sendEmail) UtilityLogger.errorMe(ex); FirebaseCrashlytics.getInstance().recordException(ex); } diff --git a/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/OrdiniUscitaElencoBindings.java b/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/OrdiniUscitaElencoBindings.java new file mode 100644 index 00000000..2b93d181 --- /dev/null +++ b/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/OrdiniUscitaElencoBindings.java @@ -0,0 +1,88 @@ +package it.integry.integrywmsnative.gest.ordini_uscita_elenco; + +import java.util.HashMap; + +import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterAgenteLayoutView; +import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterAutomezzoLayoutView; +import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterClienteLayoutView; +import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterDepositoLayoutView; +import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterGruppoMercLayoutView; +import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterNumeroOrdineLayoutView; +import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterPaeseLayoutView; +import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterTermConsLayoutView; +import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterVettoreLayoutView; +import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterViaggioLayoutView; +import it.integry.integrywmsnative.ui.filter_chips.FilterChipDTO; + +public class OrdiniUscitaElencoBindings { + + + public static final int DEPOSITO_FILTER_ID = 0; + public static final int VIAGGIO_FILTER_ID = 1; + public static final int NUM_ORD_FILTER_ID = 2; + public static final int CLIENTE_FILTER_ID = 3; + public static final int VETTORE_FILTER_ID = 4; + public static final int AUTOMEZZO_FILTER_ID = 5; + public static final int PAESE_FILTER_ID = 6; + public static final int AGENTE_FILTER_ID = 7; + public static final int TERM_CONS_FILTER_ID = 8; + public static final int DATA_CONS_FILTER_ID = 9; + public static final int GRUPPO_MERC_FILTER_ID = 10; + + public static final HashMap AVAILABLE_FILTERS = new HashMap<>() {{ + put(DEPOSITO_FILTER_ID, new FilterChipDTO() + .setID(DEPOSITO_FILTER_ID) + .setFilterChipText("Deposito") + .setFilterLayoutView(new FilterDepositoLayoutView())); + + put(VIAGGIO_FILTER_ID, new FilterChipDTO() + .setID(VIAGGIO_FILTER_ID) + .setFilterChipText("Viaggio") + .setFilterLayoutView(new FilterViaggioLayoutView())); + + put(NUM_ORD_FILTER_ID, new FilterChipDTO() + .setID(NUM_ORD_FILTER_ID) + .setFilterChipText("Numero ordine") + .setFilterLayoutView(new FilterNumeroOrdineLayoutView())); + + put(CLIENTE_FILTER_ID, new FilterChipDTO() + .setID(CLIENTE_FILTER_ID) + .setFilterChipText("Cliente") + .setFilterLayoutView(new FilterClienteLayoutView())); + + put(VETTORE_FILTER_ID, new FilterChipDTO() + .setID(VETTORE_FILTER_ID) + .setFilterChipText("Vettore") + .setFilterLayoutView(new FilterVettoreLayoutView())); + + put(AUTOMEZZO_FILTER_ID, new FilterChipDTO() + .setID(AUTOMEZZO_FILTER_ID) + .setFilterChipText("Automezzo") + .setFilterLayoutView(new FilterAutomezzoLayoutView())); + + put(PAESE_FILTER_ID, new FilterChipDTO() + .setID(PAESE_FILTER_ID) + .setFilterChipText("Paese") + .setFilterLayoutView(new FilterPaeseLayoutView())); + + put(AGENTE_FILTER_ID, new FilterChipDTO() + .setID(AGENTE_FILTER_ID) + .setFilterChipText("Agente") + .setFilterLayoutView(new FilterAgenteLayoutView())); + + put(TERM_CONS_FILTER_ID, new FilterChipDTO() + .setID(TERM_CONS_FILTER_ID) + .setFilterChipText("Termini consegna") + .setFilterLayoutView(new FilterTermConsLayoutView())); + + put(DATA_CONS_FILTER_ID, new FilterChipDTO() + .setID(DATA_CONS_FILTER_ID) + .setFilterChipText("Data consegna")); + + put(GRUPPO_MERC_FILTER_ID, new FilterChipDTO() + .setID(GRUPPO_MERC_FILTER_ID) + .setFilterChipText("Gruppo merceologico") + .setFilterLayoutView(new FilterGruppoMercLayoutView())); + }}; + +} diff --git a/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/OrdiniUscitaElencoFragment.java b/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/OrdiniUscitaElencoFragment.java index 442e7b19..d29e096d 100644 --- a/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/OrdiniUscitaElencoFragment.java +++ b/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/OrdiniUscitaElencoFragment.java @@ -15,9 +15,12 @@ import androidx.recyclerview.widget.LinearLayoutManager; import com.annimon.stream.ComparatorCompat; import com.annimon.stream.Stream; +import com.google.android.material.datepicker.MaterialDatePicker; import java.util.ArrayList; +import java.util.Date; import java.util.List; +import java.util.Objects; import javax.inject.Inject; @@ -29,33 +32,55 @@ import it.integry.integrywmsnative.core.barcode_reader.BarcodeManager; import it.integry.integrywmsnative.core.data_cache.DataCache; import it.integry.integrywmsnative.core.di.BindableBoolean; import it.integry.integrywmsnative.core.expansion.BaseFragment; +import it.integry.integrywmsnative.core.expansion.OnGeneralChangedCallback; import it.integry.integrywmsnative.core.expansion.RunnableArgs; -import it.integry.integrywmsnative.core.interfaces.IFilterableFragment; import it.integry.integrywmsnative.core.interfaces.IScrollableFragment; import it.integry.integrywmsnative.core.interfaces.ISelectAllFragment; import it.integry.integrywmsnative.core.interfaces.ITitledFragment; import it.integry.integrywmsnative.core.model.MtbColr; import it.integry.integrywmsnative.core.model.MtbColt; +import it.integry.integrywmsnative.core.model.MtbDepo; +import it.integry.integrywmsnative.core.model.MtbGrup; import it.integry.integrywmsnative.core.model.secondary.GestioneEnum; +import it.integry.integrywmsnative.core.rest.consumers.ArticoloRESTConsumer; +import it.integry.integrywmsnative.core.rest.consumers.DepositoRESTConsumer; import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO; import it.integry.integrywmsnative.core.rest.model.SitArtOrdDTO; import it.integry.integrywmsnative.core.settings.SettingsManager; import it.integry.integrywmsnative.core.utility.UtilityDate; import it.integry.integrywmsnative.core.utility.UtilityExceptions; +import it.integry.integrywmsnative.core.utility.UtilityString; import it.integry.integrywmsnative.databinding.FragmentMainOrdiniUscitaBinding; -import it.integry.integrywmsnative.gest.ordini_uscita_elenco.dialogs.DialogVenditaFiltroAvanzatoView; -import it.integry.integrywmsnative.gest.ordini_uscita_elenco.dialogs.DialogVenditaFiltroAvanzatoViewModel; +import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterAgenteLayoutView; +import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterAutomezzoLayoutView; +import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterClienteLayoutView; +import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterDepositoLayoutView; +import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterGruppoMercLayoutView; +import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterNumeroOrdineLayoutView; +import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterPaeseLayoutView; +import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterTermConsLayoutView; +import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterVettoreLayoutView; +import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.FilterViaggioLayoutView; +import it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters.VenditaFiltroOrdiniViewModel; import it.integry.integrywmsnative.gest.ordini_uscita_elenco.ui.OrdiniUscitaElencoAdapter; import it.integry.integrywmsnative.gest.ordini_uscita_elenco.ui.OrdiniUscitaElencoListModel; import it.integry.integrywmsnative.gest.spedizione.SpedizioneActivity; import it.integry.integrywmsnative.gest.spedizione.dialogs.row_info.BaseDialogRowInfoView; import it.integry.integrywmsnative.ui.ElevatedToolbar; +import it.integry.integrywmsnative.ui.filter_chips.FilterChipDTO; +import it.integry.integrywmsnative.ui.filter_chips.FilterChipView; import it.integry.integrywmsnative.view.dialogs.base.DialogSimpleMessageView; -public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledFragment, IScrollableFragment, ISelectAllFragment, IFilterableFragment, OrdiniUscitaElencoViewModel.Listener { +public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledFragment, IScrollableFragment, ISelectAllFragment, OrdiniUscitaElencoViewModel.Listener { public BindableBoolean fabVisible = new BindableBoolean(false); + @Inject + DepositoRESTConsumer mDepositoRESTConsumer; + + @Inject + ArticoloRESTConsumer mArticoloRESTConsumer; + @Inject OrdiniUscitaElencoViewModel mViewModel; @@ -73,6 +98,8 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF private int barcodeScannerIstanceID = -1; + private List mtbDepoCache; + private List mtbGrupCache; public OrdiniUscitaElencoFragment() { // Required empty public constructor @@ -125,15 +152,21 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF this.initRecyclerView(); this.initBarcodeReader(); + this.initFilters(); + return mBindings.getRoot(); } @Override public void onStart() { super.onStart(); + this.onLoadingStarted(); + + this.initMtbDepoCache(() -> { + String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep(); + mViewModel.init(codMdep, mCurrentGestioneOrd, mCurrentGestioneCol, mCurrentSegnoCol); + }); - String codMdep = SettingsManager.i().getUserSession().getDepo().getCodMdep(); - mViewModel.init(codMdep, mCurrentGestioneOrd, mCurrentGestioneCol, mCurrentSegnoCol); } @Override @@ -151,7 +184,12 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF boolean canSelectMultipleOrdini = SettingsManager.iDB().isFlagSpedizioneCanSelectMultipleOrders(); boolean canSelectMultipleClienti = SettingsManager.iDB().isFlagMultiClienteOrdV(); - this.mViewModel.getOrderList().observe(getViewLifecycleOwner(), v -> this.refreshList(null)); + this.mViewModel.getOrderList().observe(getViewLifecycleOwner(), v -> { + this.onLoadingStarted(); + this.initMtbGrupsCache(this::onLoadingEnded); + + this.refreshList(null); + }); OrdiniUscitaElencoAdapter ordiniUscitaElencoAdapter = new OrdiniUscitaElencoAdapter(getActivity(), mOrdiniInevasiMutableData) @@ -187,8 +225,8 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF this.mBindings.venditaMainList.setAdapter(ordiniUscitaElencoAdapter); this.mBindings.venditaMainList.setLayoutManager(new LinearLayoutManager(getActivity())); - if (mToolbar != null) - mToolbar.setRecyclerView(this.mBindings.venditaMainList); +// if (mToolbar != null) +// mToolbar.setRecyclerView(this.mBindings.venditaMainList); } private void initBarcodeReader() { @@ -199,6 +237,444 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF BarcodeManager.enable(); } + private void initFilters() { + var onPredicateChanged = new OnGeneralChangedCallback() { + @Override + public void run() { + refreshList(null); + } + }; + + mAppliedFilterViewModel.getCurrentDepositoPredicate().addOnPropertyChangedCallback(onPredicateChanged); + mAppliedFilterViewModel.getCurrentIdViaggioPredicate().addOnPropertyChangedCallback(onPredicateChanged); + mAppliedFilterViewModel.getCurrentNumOrdsPredicate().addOnPropertyChangedCallback(onPredicateChanged); + mAppliedFilterViewModel.getCurrentClientePredicate().addOnPropertyChangedCallback(onPredicateChanged); + mAppliedFilterViewModel.getCurrentVettorePredicate().addOnPropertyChangedCallback(onPredicateChanged); + mAppliedFilterViewModel.getCurrentAutomezzoPredicate().addOnPropertyChangedCallback(onPredicateChanged); + mAppliedFilterViewModel.getCurrentPaesePredicate().addOnPropertyChangedCallback(onPredicateChanged); + mAppliedFilterViewModel.getCurrentAgentePredicate().addOnPropertyChangedCallback(onPredicateChanged); + mAppliedFilterViewModel.getCurrentTermConsPredicate().addOnPropertyChangedCallback(onPredicateChanged); + mAppliedFilterViewModel.getCurrentDataConsPredicate().addOnPropertyChangedCallback(onPredicateChanged); + mAppliedFilterViewModel.getCurrentGruppoMercPredicate().addOnPropertyChangedCallback(onPredicateChanged); + + for (var filterChipDTO : OrdiniUscitaElencoBindings.AVAILABLE_FILTERS.entrySet()) { + + FilterChipView filterChipView = new FilterChipView( + requireActivity(), + filterChipDTO.getValue().getFilterChipText(), + v -> initBottomSheetDialogFilter(filterChipDTO.getValue())); + + switch (filterChipDTO.getKey()) { + case OrdiniUscitaElencoBindings.DEPOSITO_FILTER_ID: + mAppliedFilterViewModel.getCurrentDepositoPredicate().addOnPropertyChangedCallback(new OnGeneralChangedCallback() { + @Override + public void run() { + if (mAppliedFilterViewModel.getCurrentDepositoPredicate().get() == null) { + filterChipView.disableCloseIcon(); + + mBindings.filterChipsGroup.removeView(filterChipView); + mBindings.filterChipsGroup.addView(filterChipView); + mBindings.filterChips.smoothScrollTo(0, 0); + } else { + filterChipView.enableCloseIcon(); + + mBindings.filterChipsGroup.removeView(filterChipView); + mBindings.filterChipsGroup.addView(filterChipView, 0); + mBindings.filterChips.smoothScrollTo(0, 0); + } + } + }); + filterChipView.setOnResetClicked(() -> mAppliedFilterViewModel.getCurrentDepositoPredicate().set(null)); + break; + + case OrdiniUscitaElencoBindings.VIAGGIO_FILTER_ID: + mAppliedFilterViewModel.getCurrentIdViaggioPredicate().addOnPropertyChangedCallback(new OnGeneralChangedCallback() { + @Override + public void run() { + if (mAppliedFilterViewModel.getCurrentIdViaggioPredicate().get() == null) { + filterChipView.disableCloseIcon(); + + mBindings.filterChipsGroup.removeView(filterChipView); + mBindings.filterChipsGroup.addView(filterChipView); + mBindings.filterChips.smoothScrollTo(0, 0); + } else { + filterChipView.enableCloseIcon(); + + mBindings.filterChipsGroup.removeView(filterChipView); + mBindings.filterChipsGroup.addView(filterChipView, 0); + mBindings.filterChips.smoothScrollTo(0, 0); + } + } + }); + filterChipView.setOnResetClicked(() -> mAppliedFilterViewModel.getCurrentIdViaggioPredicate().set(null)); + break; + + case OrdiniUscitaElencoBindings.NUM_ORD_FILTER_ID: + mAppliedFilterViewModel.getCurrentNumOrdsPredicate().addOnPropertyChangedCallback(new OnGeneralChangedCallback() { + @Override + public void run() { + if (mAppliedFilterViewModel.getCurrentNumOrdsPredicate().get() == null) { + filterChipView.disableCloseIcon(); + + mBindings.filterChipsGroup.removeView(filterChipView); + mBindings.filterChipsGroup.addView(filterChipView); + mBindings.filterChips.smoothScrollTo(0, 0); + } else { + filterChipView.enableCloseIcon(); + + mBindings.filterChipsGroup.removeView(filterChipView); + mBindings.filterChipsGroup.addView(filterChipView, 0); + mBindings.filterChips.smoothScrollTo(0, 0); + } + } + }); + filterChipView.setOnResetClicked(() -> mAppliedFilterViewModel.getCurrentNumOrdsPredicate().set(null)); + break; + + case OrdiniUscitaElencoBindings.CLIENTE_FILTER_ID: + mAppliedFilterViewModel.getCurrentClientePredicate().addOnPropertyChangedCallback(new OnGeneralChangedCallback() { + @Override + public void run() { + if (mAppliedFilterViewModel.getCurrentClientePredicate().get() == null) { + filterChipView.disableCloseIcon(); + + mBindings.filterChipsGroup.removeView(filterChipView); + mBindings.filterChipsGroup.addView(filterChipView); + mBindings.filterChips.smoothScrollTo(0, 0); + } else { + filterChipView.enableCloseIcon(); + + mBindings.filterChipsGroup.removeView(filterChipView); + mBindings.filterChipsGroup.addView(filterChipView, 0); + mBindings.filterChips.smoothScrollTo(0, 0); + } + } + }); + filterChipView.setOnResetClicked(() -> mAppliedFilterViewModel.getCurrentClientePredicate().set(null)); + break; + + case OrdiniUscitaElencoBindings.VETTORE_FILTER_ID: + mAppliedFilterViewModel.getCurrentVettorePredicate().addOnPropertyChangedCallback(new OnGeneralChangedCallback() { + @Override + public void run() { + if (mAppliedFilterViewModel.getCurrentVettorePredicate().get() == null) { + filterChipView.disableCloseIcon(); + + mBindings.filterChipsGroup.removeView(filterChipView); + mBindings.filterChipsGroup.addView(filterChipView); + mBindings.filterChips.smoothScrollTo(0, 0); + } else { + filterChipView.enableCloseIcon(); + + mBindings.filterChipsGroup.removeView(filterChipView); + mBindings.filterChipsGroup.addView(filterChipView, 0); + mBindings.filterChips.smoothScrollTo(0, 0); + } + } + }); + filterChipView.setOnResetClicked(() -> mAppliedFilterViewModel.getCurrentVettorePredicate().set(null)); + break; + + case OrdiniUscitaElencoBindings.AUTOMEZZO_FILTER_ID: + mAppliedFilterViewModel.getCurrentAutomezzoPredicate().addOnPropertyChangedCallback(new OnGeneralChangedCallback() { + @Override + public void run() { + if (mAppliedFilterViewModel.getCurrentAutomezzoPredicate().get() == null) { + filterChipView.disableCloseIcon(); + + mBindings.filterChipsGroup.removeView(filterChipView); + mBindings.filterChipsGroup.addView(filterChipView); + mBindings.filterChips.smoothScrollTo(0, 0); + } else { + filterChipView.enableCloseIcon(); + + mBindings.filterChipsGroup.removeView(filterChipView); + mBindings.filterChipsGroup.addView(filterChipView, 0); + mBindings.filterChips.smoothScrollTo(0, 0); + } + } + }); + filterChipView.setOnResetClicked(() -> mAppliedFilterViewModel.getCurrentAutomezzoPredicate().set(null)); + break; + + case OrdiniUscitaElencoBindings.PAESE_FILTER_ID: + mAppliedFilterViewModel.getCurrentPaesePredicate().addOnPropertyChangedCallback(new OnGeneralChangedCallback() { + @Override + public void run() { + if (mAppliedFilterViewModel.getCurrentPaesePredicate().get() == null) { + filterChipView.disableCloseIcon(); + + mBindings.filterChipsGroup.removeView(filterChipView); + mBindings.filterChipsGroup.addView(filterChipView); + mBindings.filterChips.smoothScrollTo(0, 0); + } else { + filterChipView.enableCloseIcon(); + + mBindings.filterChipsGroup.removeView(filterChipView); + mBindings.filterChipsGroup.addView(filterChipView, 0); + mBindings.filterChips.smoothScrollTo(0, 0); + } + } + }); + filterChipView.setOnResetClicked(() -> mAppliedFilterViewModel.getCurrentPaesePredicate().set(null)); + break; + + case OrdiniUscitaElencoBindings.AGENTE_FILTER_ID: + mAppliedFilterViewModel.getCurrentAgentePredicate().addOnPropertyChangedCallback(new OnGeneralChangedCallback() { + @Override + public void run() { + if (mAppliedFilterViewModel.getCurrentAgentePredicate().get() == null) { + filterChipView.disableCloseIcon(); + + mBindings.filterChipsGroup.removeView(filterChipView); + mBindings.filterChipsGroup.addView(filterChipView); + mBindings.filterChips.smoothScrollTo(0, 0); + } else { + filterChipView.enableCloseIcon(); + + mBindings.filterChipsGroup.removeView(filterChipView); + mBindings.filterChipsGroup.addView(filterChipView, 0); + mBindings.filterChips.smoothScrollTo(0, 0); + } + } + }); + filterChipView.setOnResetClicked(() -> mAppliedFilterViewModel.getCurrentAgentePredicate().set(null)); + break; + + case OrdiniUscitaElencoBindings.TERM_CONS_FILTER_ID: + mAppliedFilterViewModel.getCurrentTermConsPredicate().addOnPropertyChangedCallback(new OnGeneralChangedCallback() { + @Override + public void run() { + if (mAppliedFilterViewModel.getCurrentTermConsPredicate().get() == null) { + filterChipView.disableCloseIcon(); + + mBindings.filterChipsGroup.removeView(filterChipView); + mBindings.filterChipsGroup.addView(filterChipView); + mBindings.filterChips.smoothScrollTo(0, 0); + } else { + filterChipView.enableCloseIcon(); + + mBindings.filterChipsGroup.removeView(filterChipView); + mBindings.filterChipsGroup.addView(filterChipView, 0); + mBindings.filterChips.smoothScrollTo(0, 0); + } + } + }); + filterChipView.setOnResetClicked(() -> mAppliedFilterViewModel.getCurrentTermConsPredicate().set(null)); + break; + + case OrdiniUscitaElencoBindings.DATA_CONS_FILTER_ID: + mAppliedFilterViewModel.getCurrentDataConsPredicate().addOnPropertyChangedCallback(new OnGeneralChangedCallback() { + @Override + public void run() { + if (mAppliedFilterViewModel.getCurrentDataConsPredicate().get() == null) { + filterChipView.disableCloseIcon(); + + mBindings.filterChipsGroup.removeView(filterChipView); + mBindings.filterChipsGroup.addView(filterChipView); + mBindings.filterChips.smoothScrollTo(0, 0); + } else { + filterChipView.enableCloseIcon(); + + mBindings.filterChipsGroup.removeView(filterChipView); + mBindings.filterChipsGroup.addView(filterChipView, 0); + mBindings.filterChips.smoothScrollTo(0, 0); + } + } + }); + filterChipView.setOnResetClicked(() -> { + mAppliedFilterViewModel.setDataConsegnaFilter(null); + mAppliedFilterViewModel.getCurrentDataConsPredicate().set(null); + }); + break; + + case OrdiniUscitaElencoBindings.GRUPPO_MERC_FILTER_ID: + mAppliedFilterViewModel.getCurrentGruppoMercPredicate().addOnPropertyChangedCallback(new OnGeneralChangedCallback() { + @Override + public void run() { + if (mAppliedFilterViewModel.getCurrentGruppoMercPredicate().get() == null) { + filterChipView.disableCloseIcon(); + + mBindings.filterChipsGroup.removeView(filterChipView); + mBindings.filterChipsGroup.addView(filterChipView); + mBindings.filterChips.smoothScrollTo(0, 0); + } else { + filterChipView.enableCloseIcon(); + + mBindings.filterChipsGroup.removeView(filterChipView); + mBindings.filterChipsGroup.addView(filterChipView, 0); + mBindings.filterChips.smoothScrollTo(0, 0); + } + } + }); + filterChipView.setOnResetClicked(() -> { + mAppliedFilterViewModel.setGruppoMercFilter(null); + mAppliedFilterViewModel.getCurrentGruppoMercPredicate().set(null); + }); + break; + + } + + this.mBindings.filterChipsGroup.addView(filterChipView); + } + + + } + + private void initBottomSheetDialogFilter(FilterChipDTO filterChipDTO) { + if (filterChipDTO.getID() == OrdiniUscitaElencoBindings.DATA_CONS_FILTER_ID) { + var datePicker = + MaterialDatePicker.Builder.datePicker() + .setTitleText(filterChipDTO.getFilterChipText()) + .setSelection(this.mAppliedFilterViewModel.getSelectedDataCons() != null ? this.mAppliedFilterViewModel.getSelectedDataCons().getTime() : null) + .build(); + + datePicker.addOnPositiveButtonClickListener(selection -> { + this.mAppliedFilterViewModel.setDataConsegnaFilter(new Date(selection)); + }); + datePicker.show(requireActivity().getSupportFragmentManager(), "TAG"); + return; + } + + filterChipDTO + .getFilterLayoutView() + .setFilterName(filterChipDTO.getFilterChipText()) + .setContext(requireActivity()); + + var filterLayoutView = filterChipDTO + .getFilterLayoutView(); + + switch (filterChipDTO.getID()) { + case OrdiniUscitaElencoBindings.DEPOSITO_FILTER_ID: + ((FilterDepositoLayoutView) filterLayoutView) + .setAllCodMdeps(mAppliedFilterViewModel.getAllCodMdeps(mtbDepoCache)) + .setAvailableCodMdeps(mAppliedFilterViewModel.getAvailableCodMdeps(mtbDepoCache)) + .setOnFilterApplied(mAppliedFilterViewModel::setDepositoFilter) + .setPreSelectedCodMdeps(Stream.of(Objects.requireNonNull(mViewModel.getOrderList().getValue())) + .filter(mAppliedFilterViewModel.getCurrentDepositoPredicate().get() == null ? + x -> false : + mAppliedFilterViewModel.getCurrentDepositoPredicate().get()) + .map(x -> Stream.of(mtbDepoCache).filter(y -> x.getCodMdep().equalsIgnoreCase(y.getCodMdep())).findFirst().get()) + .toList()); + break; + + case OrdiniUscitaElencoBindings.VIAGGIO_FILTER_ID: + ((FilterViaggioLayoutView) filterLayoutView) + .setAllIDViaggio(mAppliedFilterViewModel.getAllIDViaggio()) + .setAvailableIDViaggio(mAppliedFilterViewModel.getAvailableIDViaggio()) + .setOnFilterApplied(mAppliedFilterViewModel::setIDViaggioFilter) + .setPreSelectedIDViaggio(Stream.of(Objects.requireNonNull(mViewModel.getOrderList().getValue())) + .filter(mAppliedFilterViewModel.getCurrentIdViaggioPredicate().get() == null ? + x -> false : + mAppliedFilterViewModel.getCurrentIdViaggioPredicate().get()) + .map(OrdineUscitaInevasoDTO::getIdViaggio) + .toList()); + break; + + case OrdiniUscitaElencoBindings.NUM_ORD_FILTER_ID: + ((FilterNumeroOrdineLayoutView) filterLayoutView) + .setAllNumOrds(mAppliedFilterViewModel.getAllNumOrds()) + .setAvailableNumOrds(mAppliedFilterViewModel.getAvailableNumOrds()) + .setOnFilterApplied(mAppliedFilterViewModel::setNumOrdFilter) + .setPreSelectedNumOrds(Stream.of(Objects.requireNonNull(mViewModel.getOrderList().getValue())) + .filter(mAppliedFilterViewModel.getCurrentNumOrdsPredicate().get() == null ? + x -> false : + mAppliedFilterViewModel.getCurrentNumOrdsPredicate().get()) + .map(OrdineUscitaInevasoDTO::getNumOrd) + .toList()); + break; + + case OrdiniUscitaElencoBindings.CLIENTE_FILTER_ID: + ((FilterClienteLayoutView) filterLayoutView) + .setAllClienti(mAppliedFilterViewModel.getAllClienti()) + .setAvailableClienti(mAppliedFilterViewModel.getAvailableClienti()) + .setOnFilterApplied(mAppliedFilterViewModel::setClienteFilter) + .setPreSelectedClienti(Stream.of(Objects.requireNonNull(mViewModel.getOrderList().getValue())) + .filter(mAppliedFilterViewModel.getCurrentClientePredicate().get() == null ? + x -> false : + mAppliedFilterViewModel.getCurrentClientePredicate().get()) + .map(OrdineUscitaInevasoDTO::getRagSocOrd) + .toList()); + break; + + case OrdiniUscitaElencoBindings.VETTORE_FILTER_ID: + ((FilterVettoreLayoutView) filterLayoutView) + .setAllVettori(mAppliedFilterViewModel.getAllVettori()) + .setAvailableVettori(mAppliedFilterViewModel.getAvailableVettori()) + .setOnFilterApplied(mAppliedFilterViewModel::setVettoreFilter) + .setPreSelectedVettori(Stream.of(Objects.requireNonNull(mViewModel.getOrderList().getValue())) + .filter(mAppliedFilterViewModel.getCurrentVettorePredicate().get() == null ? + x -> false : + mAppliedFilterViewModel.getCurrentVettorePredicate().get()) + .map(x -> x.getCodVvet() + (!UtilityString.isNullOrEmpty(x.getCodVvet()) ? " - " + x.getDescrizioneVettore() : "")) + .toList()); + break; + + case OrdiniUscitaElencoBindings.AUTOMEZZO_FILTER_ID: + ((FilterAutomezzoLayoutView) filterLayoutView) + .setAllAutomezzi(mAppliedFilterViewModel.getAllAutomezzi()) + .setAvailableAutomezzi(mAppliedFilterViewModel.getAvailableAutomezzi()) + .setOnFilterApplied(mAppliedFilterViewModel::setAutomezzoFilter) + .setPreSelectedAutomezzi(Stream.of(Objects.requireNonNull(mViewModel.getOrderList().getValue())) + .filter(mAppliedFilterViewModel.getCurrentAutomezzoPredicate().get() == null ? + x -> false : + mAppliedFilterViewModel.getCurrentAutomezzoPredicate().get()) + .map(OrdineUscitaInevasoDTO::getDescrizioneAuto) + .toList()); + break; + + case OrdiniUscitaElencoBindings.PAESE_FILTER_ID: + ((FilterPaeseLayoutView) filterLayoutView) + .setAllPaesi(mAppliedFilterViewModel.getAllPaesi()) + .setAvailablePaesi(mAppliedFilterViewModel.getAvailablePaesi()) + .setOnFilterApplied(mAppliedFilterViewModel::setPaeseFilter) + .setPreSelectedPaesi(Stream.of(Objects.requireNonNull(mViewModel.getOrderList().getValue())) + .filter(mAppliedFilterViewModel.getCurrentPaesePredicate().get() == null ? + x -> false : + mAppliedFilterViewModel.getCurrentPaesePredicate().get()) + .map(OrdineUscitaInevasoDTO::getCitta) + .toList()); + break; + + case OrdiniUscitaElencoBindings.AGENTE_FILTER_ID: + ((FilterAgenteLayoutView) filterLayoutView) + .setAllAgenti(mAppliedFilterViewModel.getAllAgenti()) + .setAvailableAgenti(mAppliedFilterViewModel.getAvailableAgenti()) + .setOnFilterApplied(mAppliedFilterViewModel::setAgenteFilter) + .setPreSelectedAgenti(Stream.of(Objects.requireNonNull(mViewModel.getOrderList().getValue())) + .filter(mAppliedFilterViewModel.getCurrentAgentePredicate().get() == null ? + x -> false : + mAppliedFilterViewModel.getCurrentAgentePredicate().get()) + .map(OrdineUscitaInevasoDTO::getCitta) + .toList()); + break; + + case OrdiniUscitaElencoBindings.TERM_CONS_FILTER_ID: + ((FilterTermConsLayoutView) filterLayoutView) + .setAllTermCons(mAppliedFilterViewModel.getAllTermCons()) + .setAvailableTermCons(mAppliedFilterViewModel.getAvailableTermCons()) + .setOnFilterApplied(mAppliedFilterViewModel::setTerminiConsegnaFilter) + .setPreSelectedTermCons(Stream.of(Objects.requireNonNull(mViewModel.getOrderList().getValue())) + .filter(mAppliedFilterViewModel.getCurrentTermConsPredicate().get() == null ? + x -> false : + mAppliedFilterViewModel.getCurrentTermConsPredicate().get()) + .map(OrdineUscitaInevasoDTO::getCitta) + .toList()); + break; + + case OrdiniUscitaElencoBindings.GRUPPO_MERC_FILTER_ID: + ((FilterGruppoMercLayoutView) filterLayoutView) + .setAllGroupMerc(mAppliedFilterViewModel.getAllGruppoMerc(mtbGrupCache)) + .setAvailableGroupMerc(mAppliedFilterViewModel.getAvailableGruppoMerc(mtbGrupCache)) + .setOnFilterApplied(mAppliedFilterViewModel::setGruppoMercFilter) + .setPreSelectedGroupMerc(mAppliedFilterViewModel.getSelectedMtbGrup()); + break; + } + + filterLayoutView.show(requireActivity().getSupportFragmentManager(), "TAG"); + } + + private final RunnableArgs onScanSuccessful = data -> { BarcodeManager.disable(); this.openProgress(); @@ -210,20 +686,35 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF }; private void refreshList(List filteredList) { - List tmpList = null; + this.onLoadingStarted(); - if(filteredList != null) { - tmpList = filteredList; - } else if (mAppliedFilterViewModel != null) { - mAppliedFilterViewModel.init(mViewModel.getOrderList().getValue()); - mAppliedFilterViewModel.applyAllTests(); - tmpList = mAppliedFilterViewModel.getMutableFilteredOrderList().getValue(); - } else { - tmpList = mViewModel.getOrderList().getValue(); - } + //new Thread(() -> { + +// requireActivity().runOnUiThread(() -> { + List tmpList; + + if (filteredList != null) { + tmpList = filteredList; + } else if (mAppliedFilterViewModel != null) { + mAppliedFilterViewModel.init(mViewModel.getOrderList().getValue()); + mAppliedFilterViewModel.applyAllTests(); + tmpList = mAppliedFilterViewModel.getMutableFilteredOrderList().getValue(); + } else { + tmpList = mViewModel.getOrderList().getValue(); + } + + var list = convertDataModelToListModel(tmpList); + + this.mOrdiniInevasiMutableData.clear(); + this.mOrdiniInevasiMutableData.addAll(list); + + fabVisible.set(Stream.of(mOrdiniInevasiMutableData) + .anyMatch(y -> y.getSelectedObservable().get())); +// }); + + this.onLoadingEnded(); + //}).start(); - this.mOrdiniInevasiMutableData.clear(); - this.mOrdiniInevasiMutableData.addAll(convertDataModelToListModel(tmpList)); } private List convertDataModelToListModel(List dataList) { @@ -285,7 +776,7 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF .map(OrdiniUscitaElencoListModel::getOriginalModel) .toList(); - this.mViewModel.loadPicking(selectedOrders); + this.mViewModel.loadPicking(selectedOrders, this.mAppliedFilterViewModel.getSelectedMtbGrup()); } @Override @@ -334,25 +825,46 @@ public class OrdiniUscitaElencoFragment extends BaseFragment implements ITitledF } - private DialogVenditaFiltroAvanzatoViewModel mAppliedFilterViewModel; + private final VenditaFiltroOrdiniViewModel mAppliedFilterViewModel = new VenditaFiltroOrdiniViewModel(); - @Override - public void onFilterClick() { - DialogVenditaFiltroAvanzatoView.make( - getActivity(), - this.mViewModel.getOrderList().getValue(), - mAppliedFilterViewModel, - - filter -> { - - mAppliedFilterViewModel = filter; - refreshList(null); - - }).show(); - } +// @Override +// public void onFilterClick() { +// DialogVenditaFiltroAvanzatoView.make( +// getActivity(), +// this.mViewModel.getOrderList().getValue(), +// mAppliedFilterViewModel, +// +// filter -> { +// +// mAppliedFilterViewModel = filter; +// refreshList(null); +// +// }).show(); +// } @Override public void addOnPreDestroy(Runnable onPreDestroy) { this.mOnPreDestroyList.add(onPreDestroy); } + + + private void initMtbDepoCache(Runnable onComplete) { + this.mDepositoRESTConsumer.getAll(mtbDepos -> { + this.mtbDepoCache = mtbDepos; + onComplete.run(); + }, this::onError); + } + + + private void initMtbGrupsCache(Runnable onComplete) { + var codMgrpArts = Stream.of(Objects.requireNonNull(this.mViewModel.getOrderList().getValue())) + .flatMap(x -> Stream.of(x.getAvailableClassMerc())) + .map(OrdineUscitaInevasoDTO.AvailableClassMerc::getCodMgrp) + .toList(); + + this.mArticoloRESTConsumer.getArtsGroups(codMgrpArts, mtbGrupCache -> { + this.mtbGrupCache = mtbGrupCache; + onComplete.run(); + }, this::onError); + } } diff --git a/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/OrdiniUscitaElencoViewModel.java b/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/OrdiniUscitaElencoViewModel.java index ac86b7d6..2a990e53 100644 --- a/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/OrdiniUscitaElencoViewModel.java +++ b/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/OrdiniUscitaElencoViewModel.java @@ -21,6 +21,7 @@ import it.integry.integrywmsnative.core.expansion.RunnableArgs; import it.integry.integrywmsnative.core.interfaces.viewmodel_listeners.ILoadingListener; import it.integry.integrywmsnative.core.model.DtbOrdt; import it.integry.integrywmsnative.core.model.MtbColt; +import it.integry.integrywmsnative.core.model.MtbGrup; import it.integry.integrywmsnative.core.model.OrdineInevasoDTO; import it.integry.integrywmsnative.core.model.secondary.GestioneEnum; import it.integry.integrywmsnative.core.rest.consumers.BarcodeRESTConsumer; @@ -81,7 +82,7 @@ public class OrdiniUscitaElencoViewModel { long forcedDelaySecs = (new Date().getTime() - loadingStartDate.getTime()) / 1000; - if(2 - forcedDelaySecs > 0) { + if (2 - forcedDelaySecs > 0) { try { Thread.sleep((2 - forcedDelaySecs) * 1000); } catch (Exception ignored) { @@ -96,14 +97,14 @@ public class OrdiniUscitaElencoViewModel { } - public void loadPicking(List selectedOrders) { + public void loadPicking(List selectedOrders, List mtbGrupToFilter) { List foundGestioni = Stream.of(selectedOrders) .map(OrdineUscitaInevasoDTO::getGestioneEnum) .withoutNulls() .distinct() .toList(); - if(foundGestioni != null && foundGestioni.size() > 1) { + if (foundGestioni != null && foundGestioni.size() > 1) { this.sendError(new InvalidLUMultiGestioneException()); return; } @@ -115,7 +116,7 @@ public class OrdiniUscitaElencoViewModel { .distinct() .toList(); - if(foundCodMdep != null && foundCodMdep.size() > 1) { + if (foundCodMdep != null && foundCodMdep.size() > 1) { this.sendError(new InvalidLUMultiCodMdepException()); return; } @@ -129,12 +130,20 @@ public class OrdiniUscitaElencoViewModel { this.mOrdiniRESTConsumer.retrieveListaArticoliFromOrdiniUscita(selectedOrdersBase, sitArts -> { + if(mtbGrupToFilter != null && !mtbGrupToFilter.isEmpty()) { + sitArts = Stream.of(sitArts) + .filter(x -> Stream.of(mtbGrupToFilter).map(MtbGrup::getCodMgrp).anyMatch(y -> y.equalsIgnoreCase(x.getCodMgrp()))) + .toList(); + } + + List finalSitArts = sitArts; + this.mOrdiniRESTConsumer.getBancaliGiaRegistrati( Stream.of(selectedOrdersBase).map(x -> (OrdineInevasoDTO) x).toList(), mCurrentGestioneCol, mCurrentSegnoCol, mtbColtList -> { - this.sendOnOrdersDispatched(selectedOrdersBase, sitArts, mtbColtList); + this.sendOnOrdersDispatched(selectedOrdersBase, finalSitArts, mtbColtList); this.sendOnLoadingEnded(); }, this::sendError); @@ -149,11 +158,11 @@ public class OrdiniUscitaElencoViewModel { this.sendOnOrderFiltered(orderList); }; - if(UtilityBarcode.isBarcodeOrdineV(barcodeScanDTO)) { + if (UtilityBarcode.isBarcodeOrdineV(barcodeScanDTO)) { this.executeEtichettaOrdineV(barcodeScanDTO.getStringValue(), onBarcodeScanComplete); - } else if(UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) { + } else if (UtilityBarcode.isEtichettaAnonima(barcodeScanDTO)) { this.executeEtichettaLU(barcodeScanDTO.getStringValue(), onBarcodeScanComplete); - } else if(UtilityBarcode.isEtichetta128(barcodeScanDTO)){ + } else if (UtilityBarcode.isEtichetta128(barcodeScanDTO)) { this.executeEtichettaEan128(barcodeScanDTO, onBarcodeScanComplete); } else { onComplete.run(); @@ -161,7 +170,6 @@ public class OrdiniUscitaElencoViewModel { } - private void executeEtichettaOrdineV(String barcode, RunnableArgs> onComplete) { String gestione = ""; @@ -198,13 +206,13 @@ public class OrdiniUscitaElencoViewModel { private void executeEtichettaLU(String SSCC, RunnableArgs> onComplete) { this.mColliMagazzinoRESTConsumer.getBySSCC(SSCC, true, false, mtbColt -> { - if(mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) { + if (mtbColt != null && mtbColt.getMtbColr() != null && mtbColt.getMtbColr().size() > 0) { - if(mtbColt.getGestioneEnum() == GestioneEnum.ACQUISTO || mtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE) { + if (mtbColt.getGestioneEnum() == GestioneEnum.ACQUISTO || mtbColt.getGestioneEnum() == GestioneEnum.LAVORAZIONE) { //GET BY COMMESSA COLLO this.mOrdiniUscitaElencoRESTConsumer.getOrdiniFromCommessaCollo(mCurrentCodMdep, mtbColt, orderList -> { - if(orderList != null && orderList.size() > 0) { + if (orderList != null && orderList.size() > 0) { List numOrds = Stream.of(orderList) .map(DtbOrdt::getNumOrd) .toList(); @@ -235,14 +243,15 @@ public class OrdiniUscitaElencoViewModel { this.mBarcodeRESTConsumer.decodeEan128(barcodeScanDTO, ean128Model -> { String barcodeProd = null; - if(!UtilityString.isNullOrEmpty(ean128Model.Sscc)) barcodeProd = ean128Model.Sscc; - if(!UtilityString.isNullOrEmpty(ean128Model.Gtin)) barcodeProd = ean128Model.Gtin; - if(!UtilityString.isNullOrEmpty(ean128Model.Content)) barcodeProd = ean128Model.Content; + if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) barcodeProd = ean128Model.Sscc; + if (!UtilityString.isNullOrEmpty(ean128Model.Gtin)) barcodeProd = ean128Model.Gtin; + if (!UtilityString.isNullOrEmpty(ean128Model.Content)) + barcodeProd = ean128Model.Content; - if(!UtilityString.isNullOrEmpty(barcodeProd)) { + if (!UtilityString.isNullOrEmpty(barcodeProd)) { - if(!UtilityString.isNullOrEmpty(ean128Model.Sscc)){ + if (!UtilityString.isNullOrEmpty(ean128Model.Sscc)) { this.executeEtichettaLU(ean128Model.Sscc, onComplete); } else { this.sendError(new NoLUFoundException()); @@ -280,7 +289,8 @@ public class OrdiniUscitaElencoViewModel { } private void sendOnOrdersDispatched(List orders, List sitArts, List alreadyRegisteredMtbColts) { - if (this.mListener != null) mListener.onOrdersDispatched(orders, sitArts, alreadyRegisteredMtbColts); + if (this.mListener != null) + mListener.onOrdersDispatched(orders, sitArts, alreadyRegisteredMtbColts); } public interface Listener extends ILoadingListener { diff --git a/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/FilterAgenteLayoutView.java b/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/FilterAgenteLayoutView.java new file mode 100644 index 00000000..e1416ecd --- /dev/null +++ b/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/FilterAgenteLayoutView.java @@ -0,0 +1,165 @@ +package it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.databinding.DataBindingUtil; +import androidx.lifecycle.MutableLiveData; + +import com.annimon.stream.ComparatorCompat; +import com.annimon.stream.Stream; +import com.ravikoradiya.liveadapter.LiveAdapter; + +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.Objects; + +import it.integry.integrywmsnative.BR; +import it.integry.integrywmsnative.R; +import it.integry.integrywmsnative.core.di.BindableBoolean; +import it.integry.integrywmsnative.core.expansion.RunnableArgs; +import it.integry.integrywmsnative.core.utility.UtilityBoolean; +import it.integry.integrywmsnative.databinding.LayoutFilterAgenteBinding; +import it.integry.integrywmsnative.ui.filter_chips.FilterLayoutView; + +public class FilterAgenteLayoutView extends FilterLayoutView { + + protected LayoutFilterAgenteBinding mBindings; + + private List allAgenti; + private List availableAgenti; + private List preSelectedAgenti = new ArrayList<>(); + private List hiddenAgenti = new ArrayList<>(); + private final MutableLiveData> listModel = new MutableLiveData<>(); + + private RunnableArgs> onFilterApplied; + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + mBindings = DataBindingUtil.inflate(inflater, R.layout.layout_filter_agente, container, false); + this.mBindings.setView(this); + + refreshList(); + + this.setSearchView(this.mBindings.searchView, newFilter -> { + hiddenAgenti = Stream.of(allAgenti) + .filter(x -> !x.toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT))) + .toList(); + + refreshList(); + }); + + + new LiveAdapter(listModel, getViewLifecycleOwner(), BR.item) + .map(ListModel.class, R.layout.layout_filter_agente__list_item) + .into(this.mBindings.recyclerview); + + return mBindings.getRoot(); + } + + private void refreshList() { + ComparatorCompat c = + ComparatorCompat + .chain(new ComparatorCompat((x, y) -> UtilityBoolean.toInt(x.getSelected().get()) - UtilityBoolean.toInt(y.getSelected().get()))) + .thenComparing(new ComparatorCompat<>((x, y) -> UtilityBoolean.toInt(x.getEnabled().get()) - UtilityBoolean.toInt(y.getEnabled().get()))) + .thenComparing(new ComparatorCompat<>((x, y) -> y.getOriginalModel().compareTo(x.getOriginalModel()))) + .reversed(); + + listModel.setValue(Stream.of(getAllAgenti()) + .filter(x -> !hiddenAgenti.contains(x)) + .map(x -> new ListModel() + .setSelected(new BindableBoolean(preSelectedAgenti.contains(x))) + .setEnabled(new BindableBoolean(availableAgenti.contains(x))) + .setOriginalModel(x)) + .sorted(c) + .toList()); + } + + + public void onConfirm() { + if (onFilterApplied == null) return; + + this.onFilterApplied.run(Stream.of(Objects.requireNonNull(listModel.getValue())) + .filter(x -> x.selected.get()) + .map(x -> x.originalModel) + .toList()); + + dismiss(); + } + + public List getAllAgenti() { + return allAgenti; + } + + public FilterAgenteLayoutView setAllAgenti(List allAgenti) { + this.allAgenti = allAgenti; + return this; + } + + public List getAvailableAgenti() { + return availableAgenti; + } + + public FilterAgenteLayoutView setAvailableAgenti(List availableAgenti) { + this.availableAgenti = availableAgenti; + return this; + } + + public List getPreSelectedAgenti() { + return preSelectedAgenti; + } + + public FilterAgenteLayoutView setPreSelectedAgenti(List preSelectedAgenti) { + this.preSelectedAgenti = preSelectedAgenti; + return this; + } + + public RunnableArgs> getOnFilterApplied() { + return onFilterApplied; + } + + public FilterAgenteLayoutView setOnFilterApplied(RunnableArgs> onFilterApplied) { + this.onFilterApplied = onFilterApplied; + return this; + } + + public static class ListModel { + private BindableBoolean selected = new BindableBoolean(); + private BindableBoolean enabled = new BindableBoolean(); + private String originalModel; + + public BindableBoolean getSelected() { + return selected; + } + + public ListModel setSelected(BindableBoolean selected) { + this.selected = selected; + return this; + } + + public BindableBoolean getEnabled() { + return enabled; + } + + public ListModel setEnabled(BindableBoolean enabled) { + this.enabled = enabled; + return this; + } + + public String getOriginalModel() { + return originalModel; + } + + public ListModel setOriginalModel(String originalModel) { + this.originalModel = originalModel; + return this; + } + } + +} diff --git a/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/FilterAutomezzoLayoutView.java b/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/FilterAutomezzoLayoutView.java new file mode 100644 index 00000000..74ba99be --- /dev/null +++ b/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/FilterAutomezzoLayoutView.java @@ -0,0 +1,164 @@ +package it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.databinding.DataBindingUtil; +import androidx.lifecycle.MutableLiveData; + +import com.annimon.stream.ComparatorCompat; +import com.annimon.stream.Stream; +import com.ravikoradiya.liveadapter.LiveAdapter; + +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.Objects; + +import it.integry.integrywmsnative.BR; +import it.integry.integrywmsnative.R; +import it.integry.integrywmsnative.core.di.BindableBoolean; +import it.integry.integrywmsnative.core.expansion.RunnableArgs; +import it.integry.integrywmsnative.core.utility.UtilityBoolean; +import it.integry.integrywmsnative.databinding.LayoutFilterAutomezzoBinding; +import it.integry.integrywmsnative.ui.filter_chips.FilterLayoutView; + +public class FilterAutomezzoLayoutView extends FilterLayoutView { + + protected LayoutFilterAutomezzoBinding mBindings; + + private List allAutomezzi; + private List availableAutomezzi; + private List preSelectedAutomezzi = new ArrayList<>(); + private List hiddenAutomezzi = new ArrayList<>(); + private MutableLiveData> listModel = new MutableLiveData<>(); + + private RunnableArgs> onFilterApplied; + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + mBindings = DataBindingUtil.inflate(inflater, R.layout.layout_filter_automezzo, container, false); + this.mBindings.setView(this); + + refreshList(); + + this.setSearchView(this.mBindings.searchView, newFilter -> { + hiddenAutomezzi = Stream.of(allAutomezzi) + .filter(x -> !x.toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT))) + .toList(); + + refreshList(); + }); + + new LiveAdapter(listModel, getViewLifecycleOwner(), BR.item) + .map(ListModel.class, R.layout.layout_filter_automezzo__list_item) + .into(this.mBindings.recyclerview); + + return mBindings.getRoot(); + } + + private void refreshList() { + ComparatorCompat c = + ComparatorCompat + .chain(new ComparatorCompat((x, y) -> UtilityBoolean.toInt(x.getSelected().get()) - UtilityBoolean.toInt(y.getSelected().get()))) + .thenComparing(new ComparatorCompat<>((x, y) -> UtilityBoolean.toInt(x.getEnabled().get()) - UtilityBoolean.toInt(y.getEnabled().get()))) + .thenComparing(new ComparatorCompat<>((x, y) -> y.getOriginalModel().compareTo(x.getOriginalModel()))) + .reversed(); + + listModel.setValue(Stream.of(getAllAutomezzi()) + .filter(x -> !hiddenAutomezzi.contains(x)) + .map(x -> new ListModel() + .setSelected(new BindableBoolean(preSelectedAutomezzi.contains(x))) + .setEnabled(new BindableBoolean(availableAutomezzi.contains(x))) + .setOriginalModel(x)) + .sorted(c) + .toList()); + } + + + public void onConfirm() { + if (onFilterApplied == null) return; + + this.onFilterApplied.run(Stream.of(Objects.requireNonNull(listModel.getValue())) + .filter(x -> x.selected.get()) + .map(x -> x.originalModel) + .toList()); + + dismiss(); + } + + public List getAllAutomezzi() { + return allAutomezzi; + } + + public FilterAutomezzoLayoutView setAllAutomezzi(List allAutomezzi) { + this.allAutomezzi = allAutomezzi; + return this; + } + + public List getAvailableAutomezzi() { + return availableAutomezzi; + } + + public FilterAutomezzoLayoutView setAvailableAutomezzi(List availableAutomezzi) { + this.availableAutomezzi = availableAutomezzi; + return this; + } + + public List getPreSelectedAutomezzi() { + return preSelectedAutomezzi; + } + + public FilterAutomezzoLayoutView setPreSelectedAutomezzi(List preSelectedAutomezzi) { + this.preSelectedAutomezzi = preSelectedAutomezzi; + return this; + } + + public RunnableArgs> getOnFilterApplied() { + return onFilterApplied; + } + + public FilterAutomezzoLayoutView setOnFilterApplied(RunnableArgs> onFilterApplied) { + this.onFilterApplied = onFilterApplied; + return this; + } + + public static class ListModel { + private BindableBoolean selected = new BindableBoolean(); + private BindableBoolean enabled = new BindableBoolean(); + private String originalModel; + + public BindableBoolean getSelected() { + return selected; + } + + public ListModel setSelected(BindableBoolean selected) { + this.selected = selected; + return this; + } + + public BindableBoolean getEnabled() { + return enabled; + } + + public ListModel setEnabled(BindableBoolean enabled) { + this.enabled = enabled; + return this; + } + + public String getOriginalModel() { + return originalModel; + } + + public ListModel setOriginalModel(String originalModel) { + this.originalModel = originalModel; + return this; + } + } + +} diff --git a/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/FilterClienteLayoutView.java b/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/FilterClienteLayoutView.java new file mode 100644 index 00000000..883b0ded --- /dev/null +++ b/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/FilterClienteLayoutView.java @@ -0,0 +1,164 @@ +package it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.databinding.DataBindingUtil; +import androidx.lifecycle.MutableLiveData; + +import com.annimon.stream.ComparatorCompat; +import com.annimon.stream.Stream; +import com.ravikoradiya.liveadapter.LiveAdapter; + +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.Objects; + +import it.integry.integrywmsnative.BR; +import it.integry.integrywmsnative.R; +import it.integry.integrywmsnative.core.di.BindableBoolean; +import it.integry.integrywmsnative.core.expansion.RunnableArgs; +import it.integry.integrywmsnative.core.utility.UtilityBoolean; +import it.integry.integrywmsnative.databinding.LayoutFilterClienteBinding; +import it.integry.integrywmsnative.ui.filter_chips.FilterLayoutView; + +public class FilterClienteLayoutView extends FilterLayoutView { + + protected LayoutFilterClienteBinding mBindings; + + private List allClienti; + private List availableClienti; + private List preSelectedClienti = new ArrayList<>(); + private List hiddenClienti = new ArrayList<>(); + private final MutableLiveData> listModel = new MutableLiveData<>(); + + private RunnableArgs> onFilterApplied; + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + mBindings = DataBindingUtil.inflate(inflater, R.layout.layout_filter_cliente, container, false); + this.mBindings.setView(this); + + refreshList(); + + this.setSearchView(this.mBindings.searchView, newFilter -> { + hiddenClienti = Stream.of(allClienti) + .filter(x -> !x.toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT))) + .toList(); + + refreshList(); + }); + + new LiveAdapter(listModel, getViewLifecycleOwner(), BR.item) + .map(ListModel.class, R.layout.layout_filter_cliente__list_item) + .into(this.mBindings.recyclerview); + + return mBindings.getRoot(); + } + + private void refreshList() { + ComparatorCompat c = + ComparatorCompat + .chain(new ComparatorCompat((x, y) -> UtilityBoolean.toInt(x.getSelected().get()) - UtilityBoolean.toInt(y.getSelected().get()))) + .thenComparing(new ComparatorCompat<>((x, y) -> UtilityBoolean.toInt(x.getEnabled().get()) - UtilityBoolean.toInt(y.getEnabled().get()))) + .thenComparing(new ComparatorCompat<>((x, y) -> y.getOriginalModel().compareTo(x.getOriginalModel()))) + .reversed(); + + listModel.setValue(Stream.of(getAllClienti()) + .filter(x -> !hiddenClienti.contains(x)) + .map(x -> new ListModel() + .setSelected(new BindableBoolean(preSelectedClienti.contains(x))) + .setEnabled(new BindableBoolean(availableClienti.contains(x))) + .setOriginalModel(x)) + .sorted(c) + .toList()); + } + + + public void onConfirm() { + if (onFilterApplied == null) return; + + this.onFilterApplied.run(Stream.of(Objects.requireNonNull(listModel.getValue())) + .filter(x -> x.selected.get()) + .map(x -> x.originalModel) + .toList()); + + dismiss(); + } + + public List getAllClienti() { + return allClienti; + } + + public FilterClienteLayoutView setAllClienti(List allClienti) { + this.allClienti = allClienti; + return this; + } + + public List getAvailableClienti() { + return availableClienti; + } + + public FilterClienteLayoutView setAvailableClienti(List availableClienti) { + this.availableClienti = availableClienti; + return this; + } + + public List getPreSelectedClienti() { + return preSelectedClienti; + } + + public FilterClienteLayoutView setPreSelectedClienti(List preSelectedClienti) { + this.preSelectedClienti = preSelectedClienti; + return this; + } + + public RunnableArgs> getOnFilterApplied() { + return onFilterApplied; + } + + public FilterClienteLayoutView setOnFilterApplied(RunnableArgs> onFilterApplied) { + this.onFilterApplied = onFilterApplied; + return this; + } + + public static class ListModel { + private BindableBoolean selected = new BindableBoolean(); + private BindableBoolean enabled = new BindableBoolean(); + private String originalModel; + + public BindableBoolean getSelected() { + return selected; + } + + public ListModel setSelected(BindableBoolean selected) { + this.selected = selected; + return this; + } + + public BindableBoolean getEnabled() { + return enabled; + } + + public ListModel setEnabled(BindableBoolean enabled) { + this.enabled = enabled; + return this; + } + + public String getOriginalModel() { + return originalModel; + } + + public ListModel setOriginalModel(String originalModel) { + this.originalModel = originalModel; + return this; + } + } + +} diff --git a/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/FilterDepositoLayoutView.java b/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/FilterDepositoLayoutView.java new file mode 100644 index 00000000..6e22d61c --- /dev/null +++ b/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/FilterDepositoLayoutView.java @@ -0,0 +1,167 @@ +package it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.databinding.DataBindingUtil; +import androidx.lifecycle.MutableLiveData; + +import com.annimon.stream.ComparatorCompat; +import com.annimon.stream.Stream; +import com.ravikoradiya.liveadapter.LiveAdapter; + +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.Objects; + +import it.integry.integrywmsnative.BR; +import it.integry.integrywmsnative.R; +import it.integry.integrywmsnative.core.di.BindableBoolean; +import it.integry.integrywmsnative.core.expansion.RunnableArgs; +import it.integry.integrywmsnative.core.model.MtbDepo; +import it.integry.integrywmsnative.core.utility.UtilityBoolean; +import it.integry.integrywmsnative.databinding.LayoutFilterDepositoBinding; +import it.integry.integrywmsnative.ui.filter_chips.FilterLayoutView; + +public class FilterDepositoLayoutView extends FilterLayoutView { + + protected LayoutFilterDepositoBinding mBindings; + + private List allCodMdeps; + private List availableCodMdeps; + private List preSelectedCodMdeps = new ArrayList<>(); + private List hiddenDepos = new ArrayList<>(); + private final MutableLiveData> listModel = new MutableLiveData<>(); + + private RunnableArgs> onFilterApplied; + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + mBindings = DataBindingUtil.inflate(inflater, R.layout.layout_filter_deposito, container, false); + this.mBindings.setView(this); + + refreshList(); + + this.setSearchView(this.mBindings.searchView, newFilter -> { + hiddenDepos = Stream.of(allCodMdeps) + .filter(x -> !x.getCodMdep().toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT)) && + !x.getDescrizione().toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT))) + .toList(); + + refreshList(); + }); + + + new LiveAdapter(listModel, getViewLifecycleOwner(), BR.item) + .map(ListModel.class, R.layout.layout_filter_deposito__list_item) + .into(this.mBindings.recyclerviewDepositi); + + return mBindings.getRoot(); + } + + + public void onConfirm() { + if (onFilterApplied == null) return; + + this.onFilterApplied.run(Stream.of(Objects.requireNonNull(listModel.getValue())) + .filter(x -> x.selected.get()) + .map(x -> x.originalModel) + .toList()); + + dismiss(); + } + + private void refreshList() { + ComparatorCompat c = + ComparatorCompat + .chain(new ComparatorCompat((x, y) -> UtilityBoolean.toInt(x.getSelected().get()) - UtilityBoolean.toInt(y.getSelected().get()))) + .thenComparing(new ComparatorCompat<>((x, y) -> UtilityBoolean.toInt(x.getEnabled().get()) - UtilityBoolean.toInt(y.getEnabled().get()))) + .thenComparing(new ComparatorCompat<>((x, y) -> y.getOriginalModel().getCodMdep().compareToIgnoreCase(x.getOriginalModel().getCodMdep()))) + .reversed(); + + + listModel.setValue(Stream.of(getAllCodMdeps()) + .filter(x -> !hiddenDepos.contains(x)) + .map(x -> new ListModel() + .setSelected(new BindableBoolean(preSelectedCodMdeps.contains(x))) + .setEnabled(new BindableBoolean(availableCodMdeps.contains(x))) + .setOriginalModel(x)) + .sorted(c) + .toList()); + } + + public List getAllCodMdeps() { + return allCodMdeps; + } + + public FilterDepositoLayoutView setAllCodMdeps(List allCodMdeps) { + this.allCodMdeps = allCodMdeps; + return this; + } + + public List getAvailableCodMdeps() { + return availableCodMdeps; + } + + public FilterDepositoLayoutView setAvailableCodMdeps(List availableCodMdeps) { + this.availableCodMdeps = availableCodMdeps; + return this; + } + + public List getPreSelectedCodMdeps() { + return preSelectedCodMdeps; + } + + public FilterDepositoLayoutView setPreSelectedCodMdeps(List preSelectedCodMdeps) { + this.preSelectedCodMdeps = preSelectedCodMdeps; + return this; + } + + public RunnableArgs> getOnFilterApplied() { + return onFilterApplied; + } + + public FilterDepositoLayoutView setOnFilterApplied(RunnableArgs> onFilterApplied) { + this.onFilterApplied = onFilterApplied; + return this; + } + + public static class ListModel { + private BindableBoolean selected = new BindableBoolean(); + private BindableBoolean enabled = new BindableBoolean(); + private MtbDepo originalModel; + + public BindableBoolean getSelected() { + return selected; + } + + public ListModel setSelected(BindableBoolean selected) { + this.selected = selected; + return this; + } + + public BindableBoolean getEnabled() { + return enabled; + } + + public ListModel setEnabled(BindableBoolean enabled) { + this.enabled = enabled; + return this; + } + + public MtbDepo getOriginalModel() { + return originalModel; + } + + public ListModel setOriginalModel(MtbDepo originalModel) { + this.originalModel = originalModel; + return this; + } + } +} diff --git a/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/FilterGruppoMercLayoutView.java b/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/FilterGruppoMercLayoutView.java new file mode 100644 index 00000000..d2645667 --- /dev/null +++ b/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/FilterGruppoMercLayoutView.java @@ -0,0 +1,167 @@ +package it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.databinding.DataBindingUtil; +import androidx.lifecycle.MutableLiveData; + +import com.annimon.stream.ComparatorCompat; +import com.annimon.stream.Stream; +import com.ravikoradiya.liveadapter.LiveAdapter; + +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.Objects; + +import it.integry.integrywmsnative.BR; +import it.integry.integrywmsnative.R; +import it.integry.integrywmsnative.core.di.BindableBoolean; +import it.integry.integrywmsnative.core.expansion.RunnableArgs; +import it.integry.integrywmsnative.core.model.MtbGrup; +import it.integry.integrywmsnative.core.utility.UtilityBoolean; +import it.integry.integrywmsnative.databinding.LayoutFilterGruppoMercBinding; +import it.integry.integrywmsnative.ui.filter_chips.FilterLayoutView; + +public class FilterGruppoMercLayoutView extends FilterLayoutView { + + protected LayoutFilterGruppoMercBinding mBindings; + + private List allGroupMerc; + private List availableGroupMerc; + private List preSelectedGroupMerc = new ArrayList<>(); + private List hiddenGroupMerc = new ArrayList<>(); + private final MutableLiveData> listModel = new MutableLiveData<>(); + + private RunnableArgs> onFilterApplied; + + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + mBindings = DataBindingUtil.inflate(inflater, R.layout.layout_filter_gruppo_merc, container, false); + this.mBindings.setView(this); + + refreshList(); + + this.setSearchView(this.mBindings.searchView, newFilter -> { + hiddenGroupMerc = Stream.of(allGroupMerc) + .filter(x -> !x.getCodMgrp().toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT)) && + !x.getDescrizione().toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT))) + .toList(); + + refreshList(); + }); + + + new LiveAdapter(listModel, getViewLifecycleOwner(), BR.item) + .map(ListModel.class, R.layout.layout_filter_gruppo_merc__list_item) + .into(this.mBindings.recyclerview); + + return mBindings.getRoot(); + } + + private void refreshList() { + ComparatorCompat c = + ComparatorCompat + .chain(new ComparatorCompat((x, y) -> UtilityBoolean.toInt(x.getSelected().get()) - UtilityBoolean.toInt(y.getSelected().get()))) + .thenComparing(new ComparatorCompat<>((x, y) -> UtilityBoolean.toInt(x.getEnabled().get()) - UtilityBoolean.toInt(y.getEnabled().get()))) + .thenComparing(new ComparatorCompat<>((x, y) -> y.getOriginalModel().getCodMgrp().compareTo(x.getOriginalModel().getCodMgrp()))) + .reversed(); + + listModel.setValue(Stream.of(getAllGroupMerc()) + .filter(x -> !hiddenGroupMerc.contains(x)) + .map(x -> new ListModel() + .setSelected(new BindableBoolean(preSelectedGroupMerc.contains(x))) + .setEnabled(new BindableBoolean(availableGroupMerc.contains(x))) + .setOriginalModel(x)) + .sorted(c) + .toList()); + } + + + public void onConfirm() { + if (onFilterApplied == null) return; + + this.onFilterApplied.run(Stream.of(Objects.requireNonNull(listModel.getValue())) + .filter(x -> x.selected.get()) + .map(x -> x.originalModel) + .toList()); + + dismiss(); + } + + public List getAllGroupMerc() { + return allGroupMerc; + } + + public FilterGruppoMercLayoutView setAllGroupMerc(List allGroupMerc) { + this.allGroupMerc = allGroupMerc; + return this; + } + + public List getAvailableGroupMerc() { + return availableGroupMerc; + } + + public FilterGruppoMercLayoutView setAvailableGroupMerc(List availableGroupMerc) { + this.availableGroupMerc = availableGroupMerc; + return this; + } + + public List getPreSelectedGroupMerc() { + return preSelectedGroupMerc; + } + + public FilterGruppoMercLayoutView setPreSelectedGroupMerc(List preSelectedGroupMerc) { + this.preSelectedGroupMerc = preSelectedGroupMerc; + return this; + } + + public RunnableArgs> getOnFilterApplied() { + return onFilterApplied; + } + + public FilterGruppoMercLayoutView setOnFilterApplied(RunnableArgs> onFilterApplied) { + this.onFilterApplied = onFilterApplied; + return this; + } + + public static class ListModel { + private BindableBoolean selected = new BindableBoolean(); + private BindableBoolean enabled = new BindableBoolean(); + private MtbGrup originalModel; + + public BindableBoolean getSelected() { + return selected; + } + + public ListModel setSelected(BindableBoolean selected) { + this.selected = selected; + return this; + } + + public BindableBoolean getEnabled() { + return enabled; + } + + public ListModel setEnabled(BindableBoolean enabled) { + this.enabled = enabled; + return this; + } + + public MtbGrup getOriginalModel() { + return originalModel; + } + + public ListModel setOriginalModel(MtbGrup originalModel) { + this.originalModel = originalModel; + return this; + } + } +} diff --git a/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/FilterNumeroOrdineLayoutView.java b/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/FilterNumeroOrdineLayoutView.java new file mode 100644 index 00000000..31418c67 --- /dev/null +++ b/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/FilterNumeroOrdineLayoutView.java @@ -0,0 +1,164 @@ +package it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.databinding.DataBindingUtil; +import androidx.lifecycle.MutableLiveData; + +import com.annimon.stream.ComparatorCompat; +import com.annimon.stream.Stream; +import com.ravikoradiya.liveadapter.LiveAdapter; + +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.Objects; + +import it.integry.integrywmsnative.BR; +import it.integry.integrywmsnative.R; +import it.integry.integrywmsnative.core.di.BindableBoolean; +import it.integry.integrywmsnative.core.expansion.RunnableArgs; +import it.integry.integrywmsnative.core.utility.UtilityBoolean; +import it.integry.integrywmsnative.databinding.LayoutFilterNumeroOrdineBinding; +import it.integry.integrywmsnative.ui.filter_chips.FilterLayoutView; + +public class FilterNumeroOrdineLayoutView extends FilterLayoutView { + + protected LayoutFilterNumeroOrdineBinding mBindings; + + private List allNumOrds; + private List availableNumOrds; + private List preSelectedNumOrds = new ArrayList<>(); + private List hiddenNumOrds = new ArrayList<>(); + private final MutableLiveData> listModel = new MutableLiveData<>(); + + private RunnableArgs> onFilterApplied; + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + mBindings = DataBindingUtil.inflate(inflater, R.layout.layout_filter_numero_ordine, container, false); + this.mBindings.setView(this); + + refreshList(); + + this.setSearchView(this.mBindings.searchView, newFilter -> { + hiddenNumOrds = Stream.of(allNumOrds) + .filter(x -> !x.toString().contains(newFilter.toUpperCase(Locale.ROOT))) + .toList(); + + refreshList(); + }); + + + new LiveAdapter(listModel, getViewLifecycleOwner(), BR.item) + .map(ListModel.class, R.layout.layout_filter_numero_ordine__list_item) + .into(this.mBindings.recyclerview); + + return mBindings.getRoot(); + } + + private void refreshList() { + ComparatorCompat c = + ComparatorCompat + .chain(new ComparatorCompat((x, y) -> UtilityBoolean.toInt(x.getSelected().get()) - UtilityBoolean.toInt(y.getSelected().get()))) + .thenComparing(new ComparatorCompat<>((x, y) -> UtilityBoolean.toInt(x.getEnabled().get()) - UtilityBoolean.toInt(y.getEnabled().get()))) + .thenComparing(new ComparatorCompat<>((x, y) -> y.getOriginalModel().compareTo(x.getOriginalModel()))) + .reversed(); + + listModel.setValue(Stream.of(getAllNumOrds()) + .filter(x -> !hiddenNumOrds.contains(x)) + .map(x -> new ListModel() + .setSelected(new BindableBoolean(preSelectedNumOrds.contains(x))) + .setEnabled(new BindableBoolean(availableNumOrds.contains(x))) + .setOriginalModel(x)) + .sorted(c) + .toList()); + } + + + public void onConfirm() { + if (onFilterApplied == null) return; + + this.onFilterApplied.run(Stream.of(Objects.requireNonNull(listModel.getValue())) + .filter(x -> x.selected.get()) + .map(x -> x.originalModel) + .toList()); + + dismiss(); + } + + public List getAllNumOrds() { + return allNumOrds; + } + + public FilterNumeroOrdineLayoutView setAllNumOrds(List allIDViaggio) { + this.allNumOrds = allIDViaggio; + return this; + } + + public List getAvailableNumOrds() { + return availableNumOrds; + } + + public FilterNumeroOrdineLayoutView setAvailableNumOrds(List availableIDViaggio) { + this.availableNumOrds = availableIDViaggio; + return this; + } + + public List getPreSelectedNumOrds() { + return preSelectedNumOrds; + } + + public FilterNumeroOrdineLayoutView setPreSelectedNumOrds(List preSelectedIDViaggio) { + this.preSelectedNumOrds = preSelectedIDViaggio; + return this; + } + + public RunnableArgs> getOnFilterApplied() { + return onFilterApplied; + } + + public FilterNumeroOrdineLayoutView setOnFilterApplied(RunnableArgs> onFilterApplied) { + this.onFilterApplied = onFilterApplied; + return this; + } + + public static class ListModel { + private BindableBoolean selected = new BindableBoolean(); + private BindableBoolean enabled = new BindableBoolean(); + private Integer originalModel; + + public BindableBoolean getSelected() { + return selected; + } + + public ListModel setSelected(BindableBoolean selected) { + this.selected = selected; + return this; + } + + public BindableBoolean getEnabled() { + return enabled; + } + + public ListModel setEnabled(BindableBoolean enabled) { + this.enabled = enabled; + return this; + } + + public Integer getOriginalModel() { + return originalModel; + } + + public ListModel setOriginalModel(Integer originalModel) { + this.originalModel = originalModel; + return this; + } + } +} diff --git a/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/FilterPaeseLayoutView.java b/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/FilterPaeseLayoutView.java new file mode 100644 index 00000000..1a61c331 --- /dev/null +++ b/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/FilterPaeseLayoutView.java @@ -0,0 +1,165 @@ +package it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.databinding.DataBindingUtil; +import androidx.lifecycle.MutableLiveData; + +import com.annimon.stream.ComparatorCompat; +import com.annimon.stream.Stream; +import com.ravikoradiya.liveadapter.LiveAdapter; + +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.Objects; + +import it.integry.integrywmsnative.BR; +import it.integry.integrywmsnative.R; +import it.integry.integrywmsnative.core.di.BindableBoolean; +import it.integry.integrywmsnative.core.expansion.RunnableArgs; +import it.integry.integrywmsnative.core.utility.UtilityBoolean; +import it.integry.integrywmsnative.databinding.LayoutFilterPaeseBinding; +import it.integry.integrywmsnative.ui.filter_chips.FilterLayoutView; + +public class FilterPaeseLayoutView extends FilterLayoutView { + + protected LayoutFilterPaeseBinding mBindings; + + private List allPaesi; + private List availablePaesi; + private List preSelectedPaesi = new ArrayList<>(); + private List hiddenPaesi = new ArrayList<>(); + private final MutableLiveData> listModel = new MutableLiveData<>(); + + private RunnableArgs> onFilterApplied; + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + mBindings = DataBindingUtil.inflate(inflater, R.layout.layout_filter_paese, container, false); + this.mBindings.setView(this); + + refreshList(); + + this.setSearchView(this.mBindings.searchView, newFilter -> { + hiddenPaesi = Stream.of(allPaesi) + .filter(x -> !x.toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT))) + .toList(); + + refreshList(); + }); + + + new LiveAdapter(listModel, getViewLifecycleOwner(), BR.item) + .map(ListModel.class, R.layout.layout_filter_paese__list_item) + .into(this.mBindings.recyclerview); + + return mBindings.getRoot(); + } + + private void refreshList() { + ComparatorCompat c = + ComparatorCompat + .chain(new ComparatorCompat((x, y) -> UtilityBoolean.toInt(x.getSelected().get()) - UtilityBoolean.toInt(y.getSelected().get()))) + .thenComparing(new ComparatorCompat<>((x, y) -> UtilityBoolean.toInt(x.getEnabled().get()) - UtilityBoolean.toInt(y.getEnabled().get()))) + .thenComparing(new ComparatorCompat<>((x, y) -> y.getOriginalModel().compareTo(x.getOriginalModel()))) + .reversed(); + + listModel.setValue(Stream.of(getAllPaesi()) + .filter(x -> !hiddenPaesi.contains(x)) + .map(x -> new ListModel() + .setSelected(new BindableBoolean(preSelectedPaesi.contains(x))) + .setEnabled(new BindableBoolean(availablePaesi.contains(x))) + .setOriginalModel(x)) + .sorted(c) + .toList()); + } + + + public void onConfirm() { + if (onFilterApplied == null) return; + + this.onFilterApplied.run(Stream.of(Objects.requireNonNull(listModel.getValue())) + .filter(x -> x.selected.get()) + .map(x -> x.originalModel) + .toList()); + + dismiss(); + } + + public List getAllPaesi() { + return allPaesi; + } + + public FilterPaeseLayoutView setAllPaesi(List allPaesi) { + this.allPaesi = allPaesi; + return this; + } + + public List getAvailablePaesi() { + return availablePaesi; + } + + public FilterPaeseLayoutView setAvailablePaesi(List availablePaesi) { + this.availablePaesi = availablePaesi; + return this; + } + + public List getPreSelectedPaesi() { + return preSelectedPaesi; + } + + public FilterPaeseLayoutView setPreSelectedPaesi(List preSelectedPaesi) { + this.preSelectedPaesi = preSelectedPaesi; + return this; + } + + public RunnableArgs> getOnFilterApplied() { + return onFilterApplied; + } + + public FilterPaeseLayoutView setOnFilterApplied(RunnableArgs> onFilterApplied) { + this.onFilterApplied = onFilterApplied; + return this; + } + + public static class ListModel { + private BindableBoolean selected = new BindableBoolean(); + private BindableBoolean enabled = new BindableBoolean(); + private String originalModel; + + public BindableBoolean getSelected() { + return selected; + } + + public ListModel setSelected(BindableBoolean selected) { + this.selected = selected; + return this; + } + + public BindableBoolean getEnabled() { + return enabled; + } + + public ListModel setEnabled(BindableBoolean enabled) { + this.enabled = enabled; + return this; + } + + public String getOriginalModel() { + return originalModel; + } + + public ListModel setOriginalModel(String originalModel) { + this.originalModel = originalModel; + return this; + } + } + +} diff --git a/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/FilterTermConsLayoutView.java b/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/FilterTermConsLayoutView.java new file mode 100644 index 00000000..2a581d63 --- /dev/null +++ b/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/FilterTermConsLayoutView.java @@ -0,0 +1,165 @@ +package it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.databinding.DataBindingUtil; +import androidx.lifecycle.MutableLiveData; + +import com.annimon.stream.ComparatorCompat; +import com.annimon.stream.Stream; +import com.ravikoradiya.liveadapter.LiveAdapter; + +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.Objects; + +import it.integry.integrywmsnative.BR; +import it.integry.integrywmsnative.R; +import it.integry.integrywmsnative.core.di.BindableBoolean; +import it.integry.integrywmsnative.core.expansion.RunnableArgs; +import it.integry.integrywmsnative.core.utility.UtilityBoolean; +import it.integry.integrywmsnative.databinding.LayoutFilterTermConsBinding; +import it.integry.integrywmsnative.ui.filter_chips.FilterLayoutView; + +public class FilterTermConsLayoutView extends FilterLayoutView { + + protected LayoutFilterTermConsBinding mBindings; + + private List allTermCons; + private List availableTermCons; + private List preSelectedTermCons = new ArrayList<>(); + private List hiddenSelectedTermCons = new ArrayList<>(); + private final MutableLiveData> listModel = new MutableLiveData<>(); + + private RunnableArgs> onFilterApplied; + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + mBindings = DataBindingUtil.inflate(inflater, R.layout.layout_filter_term_cons, container, false); + this.mBindings.setView(this); + + refreshList(); + + this.setSearchView(this.mBindings.searchView, newFilter -> { + hiddenSelectedTermCons = Stream.of(allTermCons) + .filter(x -> !x.toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT))) + .toList(); + + refreshList(); + }); + + + new LiveAdapter(listModel, getViewLifecycleOwner(), BR.item) + .map(ListModel.class, R.layout.layout_filter_term_cons__list_item) + .into(this.mBindings.recyclerview); + + return mBindings.getRoot(); + } + + private void refreshList() { + ComparatorCompat c = + ComparatorCompat + .chain(new ComparatorCompat((x, y) -> UtilityBoolean.toInt(x.getSelected().get()) - UtilityBoolean.toInt(y.getSelected().get()))) + .thenComparing(new ComparatorCompat<>((x, y) -> UtilityBoolean.toInt(x.getEnabled().get()) - UtilityBoolean.toInt(y.getEnabled().get()))) + .thenComparing(new ComparatorCompat<>((x, y) -> y.getOriginalModel().compareTo(x.getOriginalModel()))) + .reversed(); + + listModel.setValue(Stream.of(getAllTermCons()) + .filter(x -> !hiddenSelectedTermCons.contains(x)) + .map(x -> new ListModel() + .setSelected(new BindableBoolean(preSelectedTermCons.contains(x))) + .setEnabled(new BindableBoolean(availableTermCons.contains(x))) + .setOriginalModel(x)) + .sorted(c) + .toList()); + } + + + public void onConfirm() { + if (onFilterApplied == null) return; + + this.onFilterApplied.run(Stream.of(Objects.requireNonNull(listModel.getValue())) + .filter(x -> x.selected.get()) + .map(x -> x.originalModel) + .toList()); + + dismiss(); + } + + public List getAllTermCons() { + return allTermCons; + } + + public FilterTermConsLayoutView setAllTermCons(List allTermCons) { + this.allTermCons = allTermCons; + return this; + } + + public List getAvailableTermCons() { + return availableTermCons; + } + + public FilterTermConsLayoutView setAvailableTermCons(List availableTermCons) { + this.availableTermCons = availableTermCons; + return this; + } + + public List getPreSelectedTermCons() { + return preSelectedTermCons; + } + + public FilterTermConsLayoutView setPreSelectedTermCons(List preSelectedTermCons) { + this.preSelectedTermCons = preSelectedTermCons; + return this; + } + + public RunnableArgs> getOnFilterApplied() { + return onFilterApplied; + } + + public FilterTermConsLayoutView setOnFilterApplied(RunnableArgs> onFilterApplied) { + this.onFilterApplied = onFilterApplied; + return this; + } + + public static class ListModel { + private BindableBoolean selected = new BindableBoolean(); + private BindableBoolean enabled = new BindableBoolean(); + private String originalModel; + + public BindableBoolean getSelected() { + return selected; + } + + public ListModel setSelected(BindableBoolean selected) { + this.selected = selected; + return this; + } + + public BindableBoolean getEnabled() { + return enabled; + } + + public ListModel setEnabled(BindableBoolean enabled) { + this.enabled = enabled; + return this; + } + + public String getOriginalModel() { + return originalModel; + } + + public ListModel setOriginalModel(String originalModel) { + this.originalModel = originalModel; + return this; + } + } + +} diff --git a/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/FilterVettoreLayoutView.java b/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/FilterVettoreLayoutView.java new file mode 100644 index 00000000..399f682f --- /dev/null +++ b/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/FilterVettoreLayoutView.java @@ -0,0 +1,166 @@ +package it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.databinding.DataBindingUtil; +import androidx.lifecycle.MutableLiveData; + +import com.annimon.stream.ComparatorCompat; +import com.annimon.stream.Stream; +import com.ravikoradiya.liveadapter.LiveAdapter; + +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.Objects; + +import it.integry.integrywmsnative.BR; +import it.integry.integrywmsnative.R; +import it.integry.integrywmsnative.core.di.BindableBoolean; +import it.integry.integrywmsnative.core.expansion.RunnableArgs; +import it.integry.integrywmsnative.core.utility.UtilityBoolean; +import it.integry.integrywmsnative.databinding.LayoutFilterVettoreBinding; +import it.integry.integrywmsnative.ui.filter_chips.FilterLayoutView; + +public class FilterVettoreLayoutView extends FilterLayoutView { + + protected LayoutFilterVettoreBinding mBindings; + + private List allVettori; + private List availableVettori; + private List preSelectedVettori = new ArrayList<>(); + private List hiddenSelectedVettori = new ArrayList<>(); + private final MutableLiveData> listModel = new MutableLiveData<>(); + + private RunnableArgs> onFilterApplied; + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + mBindings = DataBindingUtil.inflate(inflater, R.layout.layout_filter_vettore, container, false); + this.mBindings.setView(this); + + refreshList(); + + this.setSearchView(this.mBindings.searchView, newFilter -> { + hiddenSelectedVettori = Stream.of(allVettori) + .filter(x -> !x.toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT))) + .toList(); + + refreshList(); + }); + + + + new LiveAdapter(listModel, getViewLifecycleOwner(), BR.item) + .map(ListModel.class, R.layout.layout_filter_vettore__list_item) + .into(this.mBindings.recyclerview); + + return mBindings.getRoot(); + } + + private void refreshList() { + ComparatorCompat c = + ComparatorCompat + .chain(new ComparatorCompat((x, y) -> UtilityBoolean.toInt(x.getSelected().get()) - UtilityBoolean.toInt(y.getSelected().get()))) + .thenComparing(new ComparatorCompat<>((x, y) -> UtilityBoolean.toInt(x.getEnabled().get()) - UtilityBoolean.toInt(y.getEnabled().get()))) + .thenComparing(new ComparatorCompat<>((x, y) -> y.getOriginalModel().compareTo(x.getOriginalModel()))) + .reversed(); + + listModel.setValue(Stream.of(getAllVettori()) + .filter(x -> !hiddenSelectedVettori.contains(x)) + .map(x -> new ListModel() + .setSelected(new BindableBoolean(preSelectedVettori.contains(x))) + .setEnabled(new BindableBoolean(availableVettori.contains(x))) + .setOriginalModel(x)) + .sorted(c) + .toList()); + } + + + public void onConfirm() { + if (onFilterApplied == null) return; + + this.onFilterApplied.run(Stream.of(Objects.requireNonNull(listModel.getValue())) + .filter(x -> x.selected.get()) + .map(x -> x.originalModel) + .toList()); + + dismiss(); + } + + public List getAllVettori() { + return allVettori; + } + + public FilterVettoreLayoutView setAllVettori(List allVettori) { + this.allVettori = allVettori; + return this; + } + + public List getAvailableVettori() { + return availableVettori; + } + + public FilterVettoreLayoutView setAvailableVettori(List availableVettori) { + this.availableVettori = availableVettori; + return this; + } + + public List getPreSelectedVettori() { + return preSelectedVettori; + } + + public FilterVettoreLayoutView setPreSelectedVettori(List preSelectedVettori) { + this.preSelectedVettori = preSelectedVettori; + return this; + } + + public RunnableArgs> getOnFilterApplied() { + return onFilterApplied; + } + + public FilterVettoreLayoutView setOnFilterApplied(RunnableArgs> onFilterApplied) { + this.onFilterApplied = onFilterApplied; + return this; + } + + public static class ListModel { + private BindableBoolean selected = new BindableBoolean(); + private BindableBoolean enabled = new BindableBoolean(); + private String originalModel; + + public BindableBoolean getSelected() { + return selected; + } + + public ListModel setSelected(BindableBoolean selected) { + this.selected = selected; + return this; + } + + public BindableBoolean getEnabled() { + return enabled; + } + + public ListModel setEnabled(BindableBoolean enabled) { + this.enabled = enabled; + return this; + } + + public String getOriginalModel() { + return originalModel; + } + + public ListModel setOriginalModel(String originalModel) { + this.originalModel = originalModel; + return this; + } + } + +} diff --git a/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/FilterViaggioLayoutView.java b/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/FilterViaggioLayoutView.java new file mode 100644 index 00000000..4a6d5933 --- /dev/null +++ b/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/FilterViaggioLayoutView.java @@ -0,0 +1,165 @@ +package it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.databinding.DataBindingUtil; +import androidx.lifecycle.MutableLiveData; + +import com.annimon.stream.ComparatorCompat; +import com.annimon.stream.Stream; +import com.ravikoradiya.liveadapter.LiveAdapter; + +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import java.util.Objects; + +import it.integry.integrywmsnative.BR; +import it.integry.integrywmsnative.R; +import it.integry.integrywmsnative.core.di.BindableBoolean; +import it.integry.integrywmsnative.core.expansion.RunnableArgs; +import it.integry.integrywmsnative.core.utility.UtilityBoolean; +import it.integry.integrywmsnative.databinding.LayoutFilterViaggioBinding; +import it.integry.integrywmsnative.ui.filter_chips.FilterLayoutView; + +public class FilterViaggioLayoutView extends FilterLayoutView { + + protected LayoutFilterViaggioBinding mBindings; + + private List allIDViaggio; + private List availableIDViaggio; + private List preSelectedIDViaggio = new ArrayList<>(); + private List hiddenIDViaggio = new ArrayList<>(); + private MutableLiveData> listModel = new MutableLiveData<>(); + + private RunnableArgs> onFilterApplied; + + @Nullable + @Override + public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { + mBindings = DataBindingUtil.inflate(inflater, R.layout.layout_filter_viaggio, container, false); + this.mBindings.setView(this); + + refreshList(); + + this.setSearchView(this.mBindings.searchView, newFilter -> { + hiddenIDViaggio = Stream.of(allIDViaggio) + .filter(x -> !x.toString().toUpperCase(Locale.ROOT).contains(newFilter.toUpperCase(Locale.ROOT))) + .toList(); + + refreshList(); + }); + + + new LiveAdapter(listModel, getViewLifecycleOwner(), BR.item) + .map(ListModel.class, R.layout.layout_filter_viaggio__list_item) + .into(this.mBindings.recyclerview); + + return mBindings.getRoot(); + } + + private void refreshList() { + ComparatorCompat c = + ComparatorCompat + .chain(new ComparatorCompat((x, y) -> UtilityBoolean.toInt(x.getSelected().get()) - UtilityBoolean.toInt(y.getSelected().get()))) + .thenComparing(new ComparatorCompat<>((x, y) -> UtilityBoolean.toInt(x.getEnabled().get()) - UtilityBoolean.toInt(y.getEnabled().get()))) + .thenComparing(new ComparatorCompat<>((x, y) -> y.getOriginalModel().compareTo(x.getOriginalModel()))) + .reversed(); + + listModel.setValue(Stream.of(getAllIDViaggio()) + .filter(x -> !hiddenIDViaggio.contains(x)) + .map(x -> new ListModel() + .setSelected(new BindableBoolean(preSelectedIDViaggio.contains(x))) + .setEnabled(new BindableBoolean(availableIDViaggio.contains(x))) + .setOriginalModel(x)) + .sorted(c) + .toList()); + } + + + public void onConfirm() { + if (onFilterApplied == null) return; + + this.onFilterApplied.run(Stream.of(Objects.requireNonNull(listModel.getValue())) + .filter(x -> x.selected.get()) + .map(x -> x.originalModel) + .toList()); + + dismiss(); + } + + public List getAllIDViaggio() { + return allIDViaggio; + } + + public FilterViaggioLayoutView setAllIDViaggio(List allIDViaggio) { + this.allIDViaggio = allIDViaggio; + return this; + } + + public List getAvailableIDViaggio() { + return availableIDViaggio; + } + + public FilterViaggioLayoutView setAvailableIDViaggio(List availableIDViaggio) { + this.availableIDViaggio = availableIDViaggio; + return this; + } + + public List getPreSelectedIDViaggio() { + return preSelectedIDViaggio; + } + + public FilterViaggioLayoutView setPreSelectedIDViaggio(List preSelectedIDViaggio) { + this.preSelectedIDViaggio = preSelectedIDViaggio; + return this; + } + + public RunnableArgs> getOnFilterApplied() { + return onFilterApplied; + } + + public FilterViaggioLayoutView setOnFilterApplied(RunnableArgs> onFilterApplied) { + this.onFilterApplied = onFilterApplied; + return this; + } + + public static class ListModel { + private BindableBoolean selected = new BindableBoolean(); + private BindableBoolean enabled = new BindableBoolean(); + private Integer originalModel; + + public BindableBoolean getSelected() { + return selected; + } + + public ListModel setSelected(BindableBoolean selected) { + this.selected = selected; + return this; + } + + public BindableBoolean getEnabled() { + return enabled; + } + + public ListModel setEnabled(BindableBoolean enabled) { + this.enabled = enabled; + return this; + } + + public Integer getOriginalModel() { + return originalModel; + } + + public ListModel setOriginalModel(Integer originalModel) { + this.originalModel = originalModel; + return this; + } + } + +} diff --git a/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/VenditaFiltroOrdiniViewModel.java b/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/VenditaFiltroOrdiniViewModel.java new file mode 100644 index 00000000..11629b15 --- /dev/null +++ b/app/src/main/java/it/integry/integrywmsnative/gest/ordini_uscita_elenco/filters/VenditaFiltroOrdiniViewModel.java @@ -0,0 +1,708 @@ +package it.integry.integrywmsnative.gest.ordini_uscita_elenco.filters; + +import androidx.databinding.ObservableField; +import androidx.lifecycle.MutableLiveData; + +import com.annimon.stream.Stream; +import com.annimon.stream.function.Predicate; + +import org.apache.commons.lang3.time.DateUtils; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Objects; + +import it.integry.integrywmsnative.core.model.MtbDepo; +import it.integry.integrywmsnative.core.model.MtbGrup; +import it.integry.integrywmsnative.core.model.OrdineInevasoDTO; +import it.integry.integrywmsnative.core.rest.model.OrdineUscitaInevasoDTO; +import it.integry.integrywmsnative.core.utility.UtilityString; +import it.integry.integrywmsnative.gest.ordini_uscita_elenco.OrdiniUscitaElencoDTO; + +public class VenditaFiltroOrdiniViewModel { + + private final ObservableField> currentDepositoPredicate = new ObservableField<>(); + private final ObservableField> currentIdViaggioPredicate = new ObservableField<>(); + private final ObservableField> currentNumOrdsPredicate = new ObservableField<>(); + private final ObservableField> currentClientePredicate = new ObservableField<>(); + private final ObservableField> currentDataConsPredicate = new ObservableField<>(); + private final ObservableField> currentTermConsPredicate = new ObservableField<>(); + private final ObservableField> currentVettorePredicate = new ObservableField<>(); + private final ObservableField> currentAgentePredicate = new ObservableField<>(); + private final ObservableField> currentAutomezzoPredicate = new ObservableField<>(); + private final ObservableField> currentPaesePredicate = new ObservableField<>(); + private final ObservableField> currentGruppoMercPredicate = new ObservableField<>(); + + private Date selectedDataCons = null; + private List selectedMtbGrup = new ArrayList<>(); + + private List initialOrderList; + private final MutableLiveData> currentFilteredOrderList = new MutableLiveData<>(); + + public void init(List initialList) { + this.initialOrderList = initialList; + this.currentFilteredOrderList.setValue(this.initialOrderList); + } + + public MutableLiveData> getMutableFilteredOrderList() { + return this.currentFilteredOrderList; + } + + public void setIDViaggioFilter(List idViaggio) { + if (idViaggio == null || idViaggio.isEmpty()) currentIdViaggioPredicate.set(null); + else { + currentIdViaggioPredicate.set(o -> idViaggio.contains(o.getIdViaggio())); + } + } + + public void setDepositoFilter(List mtbDepoList) { + if (mtbDepoList == null || mtbDepoList.isEmpty()) currentDepositoPredicate.set(null); + else { + List codMdeps = Stream.of(mtbDepoList).map(MtbDepo::getCodMdep).toList(); + currentDepositoPredicate.set(o -> codMdeps.contains(o.getCodMdep())); + } + } + + public void setNumOrdFilter(List numOrds) { + if (numOrds == null || numOrds.isEmpty()) currentNumOrdsPredicate.set(null); + else { + currentNumOrdsPredicate.set(o -> numOrds.contains(o.getNumOrd())); + } + } + + public void setClienteFilter(List clienti) { + if (clienti == null || clienti.isEmpty()) currentClientePredicate.set(null); + else { + currentClientePredicate.set(o -> clienti.contains(o.getRagSocOrd())); + } + } + + public void setTerminiConsegnaFilter(List terminiConsegna) { + if (terminiConsegna == null || terminiConsegna.isEmpty()) + currentTermConsPredicate.set(null); + else { + currentTermConsPredicate.set(o -> terminiConsegna.contains(o.getTermCons())); + } + } + + public void setVettoreFilter(List vettore) { + if (vettore == null || vettore.isEmpty()) currentVettorePredicate.set(null); + else { + currentVettorePredicate.set(o -> vettore.contains(o.getCodVvet() + (!UtilityString.isNullOrEmpty(o.getCodVvet()) ? " - " + o.getDescrizioneVettore() : ""))); + } + } + + public void setAutomezzoFilter(List automezzi) { + if (automezzi == null || automezzi.isEmpty()) currentAutomezzoPredicate.set(null); + else { + currentAutomezzoPredicate.set(o -> automezzi.contains(o.getDescrizioneAuto())); + } + } + + public void setDataConsegnaFilter(Date dataConsegna) { + this.selectedDataCons = dataConsegna; + + if (dataConsegna == null) currentDataConsPredicate.set(null); + else { + currentDataConsPredicate.set(o -> DateUtils.isSameDay(o.getDataConsD(), dataConsegna)); + } + } + + public void setAgenteFilter(List agenti) { + if (agenti == null || agenti.isEmpty()) currentAgentePredicate.set(null); + else { + currentAgentePredicate.set(o -> agenti.contains(o.getNomeAgente())); + } + } + + public void setPaeseFilter(List paesi) { + if (paesi == null || paesi.isEmpty()) currentPaesePredicate.set(null); + else { + currentPaesePredicate.set(o -> paesi.contains(o.getCitta())); + } + } + + public void setGruppoMercFilter(List mtbGrupList) { + if (mtbGrupList == null || mtbGrupList.isEmpty()) { + currentGruppoMercPredicate.set(null); + this.selectedMtbGrup = new ArrayList<>(); + } + else { + this.selectedMtbGrup = mtbGrupList; + var mtbGrups = Stream.of(mtbGrupList).map(MtbGrup::getCodMgrp).toList(); + currentGruppoMercPredicate.set(o -> Stream.of(o.getAvailableClassMerc()) + .anyMatch(x -> mtbGrups.contains(x.getCodMgrp()))); + } + } + + + public Date getSelectedDataCons() { + return selectedDataCons; + } + + public List getSelectedMtbGrup() { + return selectedMtbGrup; + } + + public void applyAllTests() { + + List returnList = null; + + if (currentNumOrdsPredicate.get() == null && + currentClientePredicate.get() == null && + currentDataConsPredicate.get() == null && + currentTermConsPredicate.get() == null && + currentVettorePredicate.get() == null && + currentAutomezzoPredicate.get() == null && + currentDepositoPredicate.get() == null && + currentIdViaggioPredicate.get() == null && + currentAgentePredicate.get() == null && + currentPaesePredicate.get() == null && + currentGruppoMercPredicate.get() == null + ) { + returnList = this.initialOrderList; + } else { + Stream tmpStream = Stream.of(this.initialOrderList) + .filter(x -> + (currentNumOrdsPredicate.get() == null || (currentNumOrdsPredicate.get().test(x))) && + (currentClientePredicate.get() == null || (currentClientePredicate.get().test(x))) && + (currentDataConsPredicate.get() == null || (currentDataConsPredicate.get().test(x))) && + (currentTermConsPredicate.get() == null || (currentTermConsPredicate.get().test(x))) && + (currentVettorePredicate.get() == null || (currentVettorePredicate.get().test(x))) && + (currentAutomezzoPredicate.get() == null || (currentAutomezzoPredicate.get().test(x))) && + (currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) && + (currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) && + (currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) && + (currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) && + (currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) + ); + + returnList = tmpStream.toList(); + } + + this.currentFilteredOrderList.setValue(returnList); + } + + public ObservableField> getCurrentDepositoPredicate() { + return currentDepositoPredicate; + } + + public ObservableField> getCurrentIdViaggioPredicate() { + return currentIdViaggioPredicate; + } + + public ObservableField> getCurrentNumOrdsPredicate() { + return currentNumOrdsPredicate; + } + + public ObservableField> getCurrentClientePredicate() { + return currentClientePredicate; + } + + public ObservableField> getCurrentDataConsPredicate() { + return currentDataConsPredicate; + } + + public ObservableField> getCurrentTermConsPredicate() { + return currentTermConsPredicate; + } + + public ObservableField> getCurrentVettorePredicate() { + return currentVettorePredicate; + } + + public ObservableField> getCurrentAgentePredicate() { + return currentAgentePredicate; + } + + public ObservableField> getCurrentAutomezzoPredicate() { + return currentAutomezzoPredicate; + } + + public ObservableField> getCurrentPaesePredicate() { + return currentPaesePredicate; + } + + public ObservableField> getCurrentGruppoMercPredicate() { + return currentGruppoMercPredicate; + } + + public List getAllCodMdeps(List mtbDepoFullList) { + List codMdeps = Stream.of(initialOrderList) + .map(OrdineInevasoDTO::getCodMdep) + .distinct() + .toList(); + + return Stream.of(Objects.requireNonNull(mtbDepoFullList)) + .filter(x -> codMdeps.contains(x.getCodMdep())) + .distinct() + .withoutNulls() + .sortBy(MtbDepo::getCodMdep) + .toList(); + } + + public List getAvailableCodMdeps(List mtbDepoFullList) { + + if (currentNumOrdsPredicate.get() == null && + currentClientePredicate.get() == null && + currentDataConsPredicate.get() == null && + currentTermConsPredicate.get() == null && + currentVettorePredicate.get() == null && + currentAutomezzoPredicate.get() == null && + currentIdViaggioPredicate.get() == null && + currentAgentePredicate.get() == null && + currentPaesePredicate.get() == null && + currentGruppoMercPredicate.get() == null + ) { + return getAllCodMdeps(mtbDepoFullList); + } else { + List availableCodMdeps = Stream.of(this.initialOrderList) + .filter(x -> + (currentNumOrdsPredicate.get() == null || (currentNumOrdsPredicate.get().test(x))) && + (currentClientePredicate.get() == null || (currentClientePredicate.get().test(x))) && + (currentDataConsPredicate.get() == null || (currentDataConsPredicate.get().test(x))) && + (currentTermConsPredicate.get() == null || (currentTermConsPredicate.get().test(x))) && + (currentVettorePredicate.get() == null || (currentVettorePredicate.get().test(x))) && + (currentAutomezzoPredicate.get() == null || (currentAutomezzoPredicate.get().test(x))) && + (currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) && + (currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) && + (currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) && + (currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) + ) + .map(OrdineInevasoDTO::getCodMdep) + .distinct() + .toList(); + + return Stream.of(Objects.requireNonNull(mtbDepoFullList)) + .filter(x -> availableCodMdeps.contains(x.getCodMdep())) + .distinct() + .withoutNulls() + .sortBy(MtbDepo::getCodMdep) + .toList(); + } + } + + + public List getAllIDViaggio() { + return Stream + .of(Objects.requireNonNull(initialOrderList)) + .filter(x -> x.getIdViaggio() != null) + .sortBy(x -> -x.getIdViaggio()) + .map(x -> x.getIdViaggio() != null ? x.getIdViaggio() : null) + .distinct() + .toList(); + } + + public List getAvailableIDViaggio() { + + if (currentNumOrdsPredicate.get() == null && + currentClientePredicate.get() == null && + currentDataConsPredicate.get() == null && + currentTermConsPredicate.get() == null && + currentVettorePredicate.get() == null && + currentAutomezzoPredicate.get() == null && + currentDepositoPredicate.get() == null && + currentAgentePredicate.get() == null && + currentPaesePredicate.get() == null && + currentGruppoMercPredicate.get() == null + ) { + return getAllIDViaggio(); + } else { + return Stream.of(this.initialOrderList) + .filter(x -> + (currentNumOrdsPredicate.get() == null || (currentNumOrdsPredicate.get().test(x))) && + (currentClientePredicate.get() == null || (currentClientePredicate.get().test(x))) && + (currentDataConsPredicate.get() == null || (currentDataConsPredicate.get().test(x))) && + (currentTermConsPredicate.get() == null || (currentTermConsPredicate.get().test(x))) && + (currentVettorePredicate.get() == null || (currentVettorePredicate.get().test(x))) && + (currentAutomezzoPredicate.get() == null || (currentAutomezzoPredicate.get().test(x))) && + (currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) && + (currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) && + (currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) && + (currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) + ) + .map(OrdineUscitaInevasoDTO::getIdViaggio) + .distinct() + .toList(); + } + } + + + public List getAllNumOrds() { + return Stream + .of(Objects.requireNonNull(initialOrderList)) + .filter(x -> x.getNumOrd() != null) + .sortBy(x -> -x.getNumOrd()) + .map(x -> x.getNumOrd() != null ? x.getNumOrd() : null) + .distinct() + .toList(); + } + + public List getAvailableNumOrds() { + + if (currentIdViaggioPredicate.get() == null && + currentClientePredicate.get() == null && + currentDataConsPredicate.get() == null && + currentTermConsPredicate.get() == null && + currentVettorePredicate.get() == null && + currentAutomezzoPredicate.get() == null && + currentDepositoPredicate.get() == null && + currentAgentePredicate.get() == null && + currentPaesePredicate.get() == null && + currentGruppoMercPredicate.get() == null + ) { + return getAllNumOrds(); + } else { + return Stream.of(this.initialOrderList) + .filter(x -> + (currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) && + (currentClientePredicate.get() == null || (currentClientePredicate.get().test(x))) && + (currentDataConsPredicate.get() == null || (currentDataConsPredicate.get().test(x))) && + (currentTermConsPredicate.get() == null || (currentTermConsPredicate.get().test(x))) && + (currentVettorePredicate.get() == null || (currentVettorePredicate.get().test(x))) && + (currentAutomezzoPredicate.get() == null || (currentAutomezzoPredicate.get().test(x))) && + (currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) && + (currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) && + (currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) && + (currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) + ) + .map(OrdineUscitaInevasoDTO::getNumOrd) + .distinct() + .toList(); + } + } + + + public List getAllClienti() { + return Stream + .of(Objects.requireNonNull(initialOrderList)) + .filter(x -> !UtilityString.isNullOrEmpty(x.getRagSocOrd())) + .sortBy(OrdineUscitaInevasoDTO::getRagSocOrd) + .map(OrdineUscitaInevasoDTO::getRagSocOrd) + .distinct() + .toList(); + } + + public List getAvailableClienti() { + + if (currentIdViaggioPredicate.get() == null && + currentNumOrdsPredicate.get() == null && + currentDataConsPredicate.get() == null && + currentTermConsPredicate.get() == null && + currentVettorePredicate.get() == null && + currentAutomezzoPredicate.get() == null && + currentDepositoPredicate.get() == null && + currentAgentePredicate.get() == null && + currentPaesePredicate.get() == null && + currentGruppoMercPredicate.get() == null + ) { + return getAllClienti(); + } else { + return Stream.of(this.initialOrderList) + .filter(x -> + (currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) && + (currentNumOrdsPredicate.get() == null || (currentNumOrdsPredicate.get().test(x))) && + (currentDataConsPredicate.get() == null || (currentDataConsPredicate.get().test(x))) && + (currentTermConsPredicate.get() == null || (currentTermConsPredicate.get().test(x))) && + (currentVettorePredicate.get() == null || (currentVettorePredicate.get().test(x))) && + (currentAutomezzoPredicate.get() == null || (currentAutomezzoPredicate.get().test(x))) && + (currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) && + (currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) && + (currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) && + (currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) + ) + .map(OrdineUscitaInevasoDTO::getRagSocOrd) + .distinct() + .toList(); + } + } + + + public List getAllVettori() { + return Stream + .of(Objects.requireNonNull(initialOrderList)) + .filter(x -> !UtilityString.isNullOrEmpty(x.getCodVvet())) + .sortBy(OrdineUscitaInevasoDTO::getCodVvet) + .map(x -> x.getCodVvet() + (!UtilityString.isNullOrEmpty(x.getCodVvet()) ? " - " + x.getDescrizioneVettore() : "")) + .distinct() + .toList(); + } + + public List getAvailableVettori() { + + if (currentIdViaggioPredicate.get() == null && + currentNumOrdsPredicate.get() == null && + currentDataConsPredicate.get() == null && + currentTermConsPredicate.get() == null && + currentClientePredicate.get() == null && + currentAutomezzoPredicate.get() == null && + currentDepositoPredicate.get() == null && + currentAgentePredicate.get() == null && + currentPaesePredicate.get() == null && + currentGruppoMercPredicate.get() == null + ) { + return getAllVettori(); + } else { + return Stream.of(this.initialOrderList) + .filter(x -> + (currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) && + (currentNumOrdsPredicate.get() == null || (currentNumOrdsPredicate.get().test(x))) && + (currentDataConsPredicate.get() == null || (currentDataConsPredicate.get().test(x))) && + (currentTermConsPredicate.get() == null || (currentTermConsPredicate.get().test(x))) && + (currentClientePredicate.get() == null || (currentClientePredicate.get().test(x))) && + (currentAutomezzoPredicate.get() == null || (currentAutomezzoPredicate.get().test(x))) && + (currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) && + (currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) && + (currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) && + (currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) + ) + .map(x -> x.getCodVvet() + (!UtilityString.isNullOrEmpty(x.getCodVvet()) ? " - " + x.getDescrizioneVettore() : "")) + .distinct() + .toList(); + } + } + + + public List getAllAutomezzi() { + return Stream + .of(Objects.requireNonNull(initialOrderList)) + .filter(x -> !UtilityString.isNullOrEmpty(x.getDescrizioneAuto())) + .sortBy(OrdineUscitaInevasoDTO::getDescrizioneAuto) + .map(OrdineUscitaInevasoDTO::getDescrizioneAuto) + .distinct() + .toList(); + } + + public List getAvailableAutomezzi() { + + if (currentIdViaggioPredicate.get() == null && + currentNumOrdsPredicate.get() == null && + currentDataConsPredicate.get() == null && + currentTermConsPredicate.get() == null && + currentClientePredicate.get() == null && + currentVettorePredicate.get() == null && + currentDepositoPredicate.get() == null && + currentAgentePredicate.get() == null && + currentPaesePredicate.get() == null && + currentGruppoMercPredicate.get() == null + ) { + return getAllAutomezzi(); + } else { + return Stream.of(this.initialOrderList) + .filter(x -> + (currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) && + (currentNumOrdsPredicate.get() == null || (currentNumOrdsPredicate.get().test(x))) && + (currentDataConsPredicate.get() == null || (currentDataConsPredicate.get().test(x))) && + (currentTermConsPredicate.get() == null || (currentTermConsPredicate.get().test(x))) && + (currentClientePredicate.get() == null || (currentClientePredicate.get().test(x))) && + (currentVettorePredicate.get() == null || (currentVettorePredicate.get().test(x))) && + (currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) && + (currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) && + (currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) && + (currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) + ) + .map(OrdineUscitaInevasoDTO::getDescrizioneAuto) + .distinct() + .toList(); + } + } + + + public List getAllPaesi() { + return Stream + .of(Objects.requireNonNull(initialOrderList)) + .filter(x -> !UtilityString.isNullOrEmpty(x.getCitta())) + .sortBy(OrdineUscitaInevasoDTO::getCitta) + .map(OrdineUscitaInevasoDTO::getCitta) + .distinct() + .toList(); + } + + public List getAvailablePaesi() { + + if (currentIdViaggioPredicate.get() == null && + currentNumOrdsPredicate.get() == null && + currentDataConsPredicate.get() == null && + currentTermConsPredicate.get() == null && + currentClientePredicate.get() == null && + currentVettorePredicate.get() == null && + currentDepositoPredicate.get() == null && + currentAgentePredicate.get() == null && + currentAutomezzoPredicate.get() == null && + currentGruppoMercPredicate.get() == null + ) { + List all = getAllPaesi(); + return all; + } else { + return Stream.of(this.initialOrderList) + .filter(x -> + (currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) && + (currentNumOrdsPredicate.get() == null || (currentNumOrdsPredicate.get().test(x))) && + (currentDataConsPredicate.get() == null || (currentDataConsPredicate.get().test(x))) && + (currentTermConsPredicate.get() == null || (currentTermConsPredicate.get().test(x))) && + (currentClientePredicate.get() == null || (currentClientePredicate.get().test(x))) && + (currentVettorePredicate.get() == null || (currentVettorePredicate.get().test(x))) && + (currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) && + (currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) && + (currentAutomezzoPredicate.get() == null || (currentAutomezzoPredicate.get().test(x))) && + (currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) + ) + .map(OrdineUscitaInevasoDTO::getCitta) + .distinct() + .toList(); + } + } + + + public List getAllAgenti() { + return Stream + .of(Objects.requireNonNull(initialOrderList)) + .filter(x -> !UtilityString.isNullOrEmpty(x.getNomeAgente())) + .sortBy(OrdineUscitaInevasoDTO::getNomeAgente) + .map(OrdineUscitaInevasoDTO::getNomeAgente) + .distinct() + .toList(); + } + + public List getAvailableAgenti() { + + if (currentIdViaggioPredicate.get() == null && + currentNumOrdsPredicate.get() == null && + currentDataConsPredicate.get() == null && + currentTermConsPredicate.get() == null && + currentClientePredicate.get() == null && + currentVettorePredicate.get() == null && + currentDepositoPredicate.get() == null && + currentPaesePredicate.get() == null && + currentAutomezzoPredicate.get() == null && + currentGruppoMercPredicate.get() == null + ) { + List all = getAllAgenti(); + return all; + } else { + return Stream.of(this.initialOrderList) + .filter(x -> + (currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) && + (currentNumOrdsPredicate.get() == null || (currentNumOrdsPredicate.get().test(x))) && + (currentDataConsPredicate.get() == null || (currentDataConsPredicate.get().test(x))) && + (currentTermConsPredicate.get() == null || (currentTermConsPredicate.get().test(x))) && + (currentClientePredicate.get() == null || (currentClientePredicate.get().test(x))) && + (currentVettorePredicate.get() == null || (currentVettorePredicate.get().test(x))) && + (currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) && + (currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) && + (currentAutomezzoPredicate.get() == null || (currentAutomezzoPredicate.get().test(x))) && + (currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) + ) + .map(OrdineUscitaInevasoDTO::getNomeAgente) + .distinct() + .toList(); + } + } + + + public List getAllTermCons() { + return Stream + .of(Objects.requireNonNull(initialOrderList)) + .filter(x -> !UtilityString.isNullOrEmpty(x.getTermCons())) + .sortBy(OrdineUscitaInevasoDTO::getTermCons) + .map(OrdineUscitaInevasoDTO::getTermCons) + .distinct() + .toList(); + } + + public List getAvailableTermCons() { + + if (currentIdViaggioPredicate.get() == null && + currentNumOrdsPredicate.get() == null && + currentDataConsPredicate.get() == null && + currentAgentePredicate.get() == null && + currentClientePredicate.get() == null && + currentVettorePredicate.get() == null && + currentDepositoPredicate.get() == null && + currentPaesePredicate.get() == null && + currentAutomezzoPredicate.get() == null && + currentGruppoMercPredicate.get() == null + ) { + return getAllTermCons(); + } else { + return Stream.of(this.initialOrderList) + .filter(x -> + (currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) && + (currentNumOrdsPredicate.get() == null || (currentNumOrdsPredicate.get().test(x))) && + (currentDataConsPredicate.get() == null || (currentDataConsPredicate.get().test(x))) && + (currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) && + (currentClientePredicate.get() == null || (currentClientePredicate.get().test(x))) && + (currentVettorePredicate.get() == null || (currentVettorePredicate.get().test(x))) && + (currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) && + (currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) && + (currentAutomezzoPredicate.get() == null || (currentAutomezzoPredicate.get().test(x))) && + (currentGruppoMercPredicate.get() == null || (currentGruppoMercPredicate.get().test(x))) + ) + .map(OrdineUscitaInevasoDTO::getTermCons) + .distinct() + .toList(); + } + } + + + public List getAllGruppoMerc(List mtbGrupFullList) { + var codMgrp = Stream.of(initialOrderList) + .flatMap(ordiniUscitaElencoDTO -> Stream.of(ordiniUscitaElencoDTO.getAvailableClassMerc())) + .map(OrdineUscitaInevasoDTO.AvailableClassMerc::getCodMgrp) + .withoutNulls() + .distinct() + .toList(); + + return Stream.of(Objects.requireNonNull(mtbGrupFullList)) + .filter(x -> codMgrp.contains(x.getCodMgrp())) + .distinct() + .withoutNulls() + .sortBy(MtbGrup::getDescrizione) + .toList(); + } + + public List getAvailableGruppoMerc(List mtbGrupFullList) { + + if (currentNumOrdsPredicate.get() == null && + currentClientePredicate.get() == null && + currentDataConsPredicate.get() == null && + currentTermConsPredicate.get() == null && + currentVettorePredicate.get() == null && + currentAutomezzoPredicate.get() == null && + currentIdViaggioPredicate.get() == null && + currentAgentePredicate.get() == null && + currentPaesePredicate.get() == null && + currentDepositoPredicate.get() == null + ) { + return getAllGruppoMerc(mtbGrupFullList); + } else { + List availableCodMgrups = Stream.of(this.initialOrderList) + .filter(x -> + (currentNumOrdsPredicate.get() == null || (currentNumOrdsPredicate.get().test(x))) && + (currentClientePredicate.get() == null || (currentClientePredicate.get().test(x))) && + (currentDataConsPredicate.get() == null || (currentDataConsPredicate.get().test(x))) && + (currentTermConsPredicate.get() == null || (currentTermConsPredicate.get().test(x))) && + (currentVettorePredicate.get() == null || (currentVettorePredicate.get().test(x))) && + (currentAutomezzoPredicate.get() == null || (currentAutomezzoPredicate.get().test(x))) && + (currentIdViaggioPredicate.get() == null || (currentIdViaggioPredicate.get().test(x))) && + (currentAgentePredicate.get() == null || (currentAgentePredicate.get().test(x))) && + (currentPaesePredicate.get() == null || (currentPaesePredicate.get().test(x))) && + (currentDepositoPredicate.get() == null || (currentDepositoPredicate.get().test(x))) + ) + .flatMap(x -> Stream.of(x.getAvailableClassMerc())) + .map(OrdineUscitaInevasoDTO.AvailableClassMerc::getCodMgrp) + .distinct() + .toList(); + + return Stream.of(Objects.requireNonNull(mtbGrupFullList)) + .filter(x -> availableCodMgrups.contains(x.getCodMgrp())) + .distinct() + .withoutNulls() + .sortBy(MtbGrup::getDescrizione) + .toList(); + } + } + + +} diff --git a/app/src/main/java/it/integry/integrywmsnative/gest/spedizione/SpedizioneActivity.java b/app/src/main/java/it/integry/integrywmsnative/gest/spedizione/SpedizioneActivity.java index e4055aa8..8c317ed9 100644 --- a/app/src/main/java/it/integry/integrywmsnative/gest/spedizione/SpedizioneActivity.java +++ b/app/src/main/java/it/integry/integrywmsnative/gest/spedizione/SpedizioneActivity.java @@ -775,7 +775,7 @@ public class SpedizioneActivity extends BaseActivity implements SpedizioneViewMo if (ex instanceof InvalidPesoKGException) { UtilityToast.showToast(ex.getMessage()); } else { - UtilityExceptions.defaultException(this, ex, mCurrentProgress); + UtilityExceptions.defaultException(this, ex); } BarcodeManager.enable(); diff --git a/app/src/main/java/it/integry/integrywmsnative/ui/filter_chips/FilterChipDTO.java b/app/src/main/java/it/integry/integrywmsnative/ui/filter_chips/FilterChipDTO.java new file mode 100644 index 00000000..78572dfb --- /dev/null +++ b/app/src/main/java/it/integry/integrywmsnative/ui/filter_chips/FilterChipDTO.java @@ -0,0 +1,35 @@ +package it.integry.integrywmsnative.ui.filter_chips; + +public class FilterChipDTO { + + private int ID; + private String filterChipText; + private FilterLayoutView filterLayoutView; + + public int getID() { + return ID; + } + + public FilterChipDTO setID(int ID) { + this.ID = ID; + return this; + } + + public String getFilterChipText() { + return filterChipText; + } + + public FilterChipDTO setFilterChipText(String filterChipText) { + this.filterChipText = filterChipText; + return this; + } + + public FilterLayoutView getFilterLayoutView() { + return filterLayoutView; + } + + public FilterChipDTO setFilterLayoutView(FilterLayoutView filterLayoutView) { + this.filterLayoutView = filterLayoutView; + return this; + } +} diff --git a/app/src/main/java/it/integry/integrywmsnative/ui/filter_chips/FilterChipView.java b/app/src/main/java/it/integry/integrywmsnative/ui/filter_chips/FilterChipView.java new file mode 100644 index 00000000..77ecb181 --- /dev/null +++ b/app/src/main/java/it/integry/integrywmsnative/ui/filter_chips/FilterChipView.java @@ -0,0 +1,71 @@ +package it.integry.integrywmsnative.ui.filter_chips; + +import android.content.Context; +import android.content.res.ColorStateList; + +import androidx.core.content.ContextCompat; + +import com.google.android.material.chip.Chip; + +import it.integry.integrywmsnative.R; +import it.integry.integrywmsnative.core.di.BindableString; +import it.integry.integrywmsnative.core.expansion.RunnableArgs; + +public class FilterChipView extends Chip { + + public BindableString primaryText = new BindableString(); + + private final Context mContext; + private Runnable onResetClicked; + + private final ColorStateList defaultChipBackgroundColor; + private final ColorStateList defaultChipTextColor; + + public FilterChipView(Context context, String text, RunnableArgs onClicked) { + super(context); + this.mContext = context; + super.setText(text); + + this.defaultChipBackgroundColor = getChipBackgroundColor(); + this.defaultChipTextColor = getTextColors(); + + setShapeAppearanceModel( + getShapeAppearanceModel() + .withCornerSize(4) + .toBuilder() + .build()); + + setChipMinHeight(getChipMinHeight() * 1.25f); + + setOnCloseIconClickListener(v -> { + if (onResetClicked != null) onResetClicked.run(); + }); + setOnClickListener(v -> onClicked.run(this)); + + } + + + public void enableCloseIcon() { + setCloseIconVisible(true); + setTextColor(ContextCompat.getColor(this.mContext, android.R.color.white)); + setChipBackgroundColor(ColorStateList.valueOf(ContextCompat.getColor(this.mContext, R.color.colorPrimary))); + setCloseIconTint(ColorStateList.valueOf(ContextCompat.getColor(this.mContext, android.R.color.white))); + } + + public void disableCloseIcon() { + setCloseIconVisible(false); + setTextColor(defaultChipTextColor); + setChipBackgroundColor(defaultChipBackgroundColor); +// setCloseIconTint(ColorStateList.valueOf(ContextCompat.getColor(this.mContext, R.color.colorPrimary))); + } + + + public Runnable getOnResetClicked() { + return onResetClicked; + } + + public FilterChipView setOnResetClicked(Runnable onResetClicked) { + this.onResetClicked = onResetClicked; + return this; + } +} diff --git a/app/src/main/java/it/integry/integrywmsnative/ui/filter_chips/FilterLayoutView.java b/app/src/main/java/it/integry/integrywmsnative/ui/filter_chips/FilterLayoutView.java new file mode 100644 index 00000000..132d0694 --- /dev/null +++ b/app/src/main/java/it/integry/integrywmsnative/ui/filter_chips/FilterLayoutView.java @@ -0,0 +1,105 @@ +package it.integry.integrywmsnative.ui.filter_chips; + +import android.content.Context; +import android.os.Bundle; +import android.view.View; +import android.widget.RelativeLayout; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.widget.SearchView; + +import com.google.android.material.bottomsheet.BottomSheetDialogFragment; + +import it.integry.integrywmsnative.core.di.BindableBoolean; +import it.integry.integrywmsnative.core.di.BindableString; +import it.integry.integrywmsnative.core.expansion.RunnableArgs; + +public abstract class FilterLayoutView extends BottomSheetDialogFragment { + + protected Context mContext; + private final BindableString filterName = new BindableString(); + private final BindableBoolean enabledSearch = new BindableBoolean(); + + private SearchView mSearchView; + private RunnableArgs mOnFilterChanged; + + + @Override + public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + + if (mSearchView != null) this.initSearchView(); + } + + protected void initSearchView() { + + mSearchView.setOnSearchClickListener(v -> { + this.setEnabledSearch(true); + mSearchView.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT)); + }); + + mSearchView.setOnCloseListener(() -> { + setEnabledSearch(false); + var layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); + layoutParams.addRule(RelativeLayout.ALIGN_PARENT_END); + + mSearchView.setLayoutParams(layoutParams); + return false; + }); + + this.mSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { + @Override + public boolean onQueryTextSubmit(String query) { + return false; + } + + @Override + public boolean onQueryTextChange(String newText) { + if (mOnFilterChanged != null) mOnFilterChanged.run(newText); + + return false; + } + }); + +// mSearchView.setQuery("", true); +// mSearchView.setIconified(true); +// mSearchView.clearFocus(); +// +// mSearchView.getRootView().invalidate(); + } + + + public Context getContext() { + return mContext; + } + + public FilterLayoutView setContext(Context mContext) { + this.mContext = mContext; + return this; + } + + public BindableString getFilterName() { + return filterName; + } + + public FilterLayoutView setFilterName(String filterName) { + this.filterName.set(filterName); + return this; + } + + public BindableBoolean getEnabledSearch() { + return enabledSearch; + } + + public FilterLayoutView setEnabledSearch(boolean enabledSearch) { + this.enabledSearch.set(enabledSearch); + return this; + } + + public FilterLayoutView setSearchView(SearchView searchView, RunnableArgs onFilterChanged) { + this.mSearchView = searchView; + this.mOnFilterChanged = onFilterChanged; + return this; + } +} diff --git a/app/src/main/res/drawable/material_text_color.xml b/app/src/main/res/drawable/material_text_color.xml new file mode 100644 index 00000000..661953ea --- /dev/null +++ b/app/src/main/res/drawable/material_text_color.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_main_ordini_uscita.xml b/app/src/main/res/layout/fragment_main_ordini_uscita.xml index a08342a6..d2d969af 100644 --- a/app/src/main/res/layout/fragment_main_ordini_uscita.xml +++ b/app/src/main/res/layout/fragment_main_ordini_uscita.xml @@ -28,11 +28,78 @@ android:layout_width="match_parent" android:layout_height="match_parent"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + android:layout_height="match_parent" + android:layout_below="@id/filter_chips"/> + android:adjustViewBounds="true" + android:src="@drawable/ic_playlist_add_check_24dp" /> + android:textSize="18sp" /> diff --git a/app/src/main/res/layout/fragment_main_ordini_uscita__list_model.xml b/app/src/main/res/layout/fragment_main_ordini_uscita__list_model.xml index bc092ceb..054d7c6e 100644 --- a/app/src/main/res/layout/fragment_main_ordini_uscita__list_model.xml +++ b/app/src/main/res/layout/fragment_main_ordini_uscita__list_model.xml @@ -1,16 +1,16 @@ - - - - + - + - + diff --git a/app/src/main/res/layout/layout_filter_agente.xml b/app/src/main/res/layout/layout_filter_agente.xml new file mode 100644 index 00000000..e0d28e0f --- /dev/null +++ b/app/src/main/res/layout/layout_filter_agente.xml @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/layout_filter_agente__list_item.xml b/app/src/main/res/layout/layout_filter_agente__list_item.xml new file mode 100644 index 00000000..12c3f5ad --- /dev/null +++ b/app/src/main/res/layout/layout_filter_agente__list_item.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/layout_filter_automezzo.xml b/app/src/main/res/layout/layout_filter_automezzo.xml new file mode 100644 index 00000000..086397ba --- /dev/null +++ b/app/src/main/res/layout/layout_filter_automezzo.xml @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/layout_filter_automezzo__list_item.xml b/app/src/main/res/layout/layout_filter_automezzo__list_item.xml new file mode 100644 index 00000000..602987cc --- /dev/null +++ b/app/src/main/res/layout/layout_filter_automezzo__list_item.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/layout_filter_cliente.xml b/app/src/main/res/layout/layout_filter_cliente.xml new file mode 100644 index 00000000..b024395c --- /dev/null +++ b/app/src/main/res/layout/layout_filter_cliente.xml @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/layout_filter_cliente__list_item.xml b/app/src/main/res/layout/layout_filter_cliente__list_item.xml new file mode 100644 index 00000000..9392951c --- /dev/null +++ b/app/src/main/res/layout/layout_filter_cliente__list_item.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/layout_filter_deposito.xml b/app/src/main/res/layout/layout_filter_deposito.xml new file mode 100644 index 00000000..6dcced83 --- /dev/null +++ b/app/src/main/res/layout/layout_filter_deposito.xml @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/layout_filter_deposito__list_item.xml b/app/src/main/res/layout/layout_filter_deposito__list_item.xml new file mode 100644 index 00000000..a4864391 --- /dev/null +++ b/app/src/main/res/layout/layout_filter_deposito__list_item.xml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/layout_filter_gruppo_merc.xml b/app/src/main/res/layout/layout_filter_gruppo_merc.xml new file mode 100644 index 00000000..398fd1e8 --- /dev/null +++ b/app/src/main/res/layout/layout_filter_gruppo_merc.xml @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/layout_filter_gruppo_merc__list_item.xml b/app/src/main/res/layout/layout_filter_gruppo_merc__list_item.xml new file mode 100644 index 00000000..5681fe31 --- /dev/null +++ b/app/src/main/res/layout/layout_filter_gruppo_merc__list_item.xml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/layout_filter_numero_ordine.xml b/app/src/main/res/layout/layout_filter_numero_ordine.xml new file mode 100644 index 00000000..82c7b472 --- /dev/null +++ b/app/src/main/res/layout/layout_filter_numero_ordine.xml @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/layout_filter_numero_ordine__list_item.xml b/app/src/main/res/layout/layout_filter_numero_ordine__list_item.xml new file mode 100644 index 00000000..20962c9a --- /dev/null +++ b/app/src/main/res/layout/layout_filter_numero_ordine__list_item.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/layout_filter_paese.xml b/app/src/main/res/layout/layout_filter_paese.xml new file mode 100644 index 00000000..35a934f6 --- /dev/null +++ b/app/src/main/res/layout/layout_filter_paese.xml @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/layout_filter_paese__list_item.xml b/app/src/main/res/layout/layout_filter_paese__list_item.xml new file mode 100644 index 00000000..e03d77ae --- /dev/null +++ b/app/src/main/res/layout/layout_filter_paese__list_item.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/layout_filter_term_cons.xml b/app/src/main/res/layout/layout_filter_term_cons.xml new file mode 100644 index 00000000..09bfbab1 --- /dev/null +++ b/app/src/main/res/layout/layout_filter_term_cons.xml @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/layout_filter_term_cons__list_item.xml b/app/src/main/res/layout/layout_filter_term_cons__list_item.xml new file mode 100644 index 00000000..119602ed --- /dev/null +++ b/app/src/main/res/layout/layout_filter_term_cons__list_item.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/layout_filter_vettore.xml b/app/src/main/res/layout/layout_filter_vettore.xml new file mode 100644 index 00000000..875d9554 --- /dev/null +++ b/app/src/main/res/layout/layout_filter_vettore.xml @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/layout_filter_vettore__list_item.xml b/app/src/main/res/layout/layout_filter_vettore__list_item.xml new file mode 100644 index 00000000..dd349d52 --- /dev/null +++ b/app/src/main/res/layout/layout_filter_vettore__list_item.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/layout_filter_viaggio.xml b/app/src/main/res/layout/layout_filter_viaggio.xml new file mode 100644 index 00000000..a2f6eefe --- /dev/null +++ b/app/src/main/res/layout/layout_filter_viaggio.xml @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/layout_filter_viaggio__list_item.xml b/app/src/main/res/layout/layout_filter_viaggio__list_item.xml new file mode 100644 index 00000000..cf1be509 --- /dev/null +++ b/app/src/main/res/layout/layout_filter_viaggio__list_item.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/single_filter_chip_view.xml b/app/src/main/res/layout/single_filter_chip_view.xml new file mode 100644 index 00000000..a8e0c866 --- /dev/null +++ b/app/src/main/res/layout/single_filter_chip_view.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index bbd38fa4..a0ae114a 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -63,6 +63,7 @@ #1b5e20 + #FAFAFA #F5F5F5 #eeeeee #e0e0e0 diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index ac5e290c..87ff63f8 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -10,6 +10,13 @@ @font/google_sans_regular + + @style/Widget.MaterialComponents.MaterialCalendar + @style/ThemeOverlay.MaterialComponents.MaterialCalendar.Fullscreen + @style/ThemeOverlay.MaterialComponents.MaterialCalendar + + @style/CustomBottomSheetDialog + @@ -193,7 +206,21 @@ @style/AppTheme.NewMaterial.Text.ToolbarTitle + + + +