From 5b4020bc91e35fe009d0c1edf74e56b6ca6beef4 Mon Sep 17 00:00:00 2001 From: LZRS <12814349+LZRS@users.noreply.github.com> Date: Wed, 27 Oct 2021 18:40:09 +0300 Subject: [PATCH] LMH1-73: grey out save for family member forms --- .../AboveFiveChildProfileActivity.java | 8 ++++++ .../chw/activity/ChildProfileActivity.java | 9 +++++++ .../chw/activity/ChildRegisterActivity.java | 1 + .../FamilyOtherMemberProfileActivity.java | 10 ++++++++ .../chw/activity/FamilyProfileActivity.java | 25 +++++++++++++++++++ .../chw/activity/FamilyRegisterActivity.java | 2 -- 6 files changed, 53 insertions(+), 2 deletions(-) diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/activity/AboveFiveChildProfileActivity.java b/opensrp-chw/src/main/java/org/smartregister/chw/activity/AboveFiveChildProfileActivity.java index d1693f035c..26cc6ce4e6 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/activity/AboveFiveChildProfileActivity.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/activity/AboveFiveChildProfileActivity.java @@ -10,6 +10,8 @@ import android.view.View; import android.widget.LinearLayout; +import com.vijay.jsonwizard.domain.Form; + import org.smartregister.chw.BuildConfig; import org.smartregister.chw.R; import org.smartregister.chw.application.ChwApplication; @@ -174,4 +176,10 @@ public void setDueTodayServices() { textViewDueToday.setVisibility(View.GONE); } + @Override + public Form getForm() { + Form currentFormConfig = super.getForm(); + currentFormConfig.setGreyOutSaveWhenFormInvalid(ChwApplication.getApplicationFlavor().greyOutFormActionsIfInvalid()); + return currentFormConfig; + } } diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/activity/ChildProfileActivity.java b/opensrp-chw/src/main/java/org/smartregister/chw/activity/ChildProfileActivity.java index c5c2d90ca0..07449df08c 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/activity/ChildProfileActivity.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/activity/ChildProfileActivity.java @@ -19,6 +19,8 @@ import android.widget.RelativeLayout; import android.widget.TextView; +import com.vijay.jsonwizard.domain.Form; + import org.json.JSONObject; import org.smartregister.chw.BuildConfig; import org.smartregister.chw.R; @@ -287,6 +289,13 @@ public void setLastVisitRowView(String days) { } + @Override + public Form getForm() { + Form currentFormConfig = super.getForm(); + currentFormConfig.setGreyOutSaveWhenFormInvalid(ChwApplication.getApplicationFlavor().greyOutFormActionsIfInvalid()); + return currentFormConfig; + } + @Override public void setFamilyHasNothingElseDue() { layoutFamilyHasRow.setVisibility(View.VISIBLE); diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/activity/ChildRegisterActivity.java b/opensrp-chw/src/main/java/org/smartregister/chw/activity/ChildRegisterActivity.java index f3e29155f1..1a820413cb 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/activity/ChildRegisterActivity.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/activity/ChildRegisterActivity.java @@ -60,6 +60,7 @@ public Form getFormConfig() { currentConfig.setHideNextIcon(true); currentConfig.setHidePreviousIcon(true); } + currentConfig.setGreyOutSaveWhenFormInvalid(ChwApplication.getApplicationFlavor().greyOutFormActionsIfInvalid()); return currentConfig; } } diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyOtherMemberProfileActivity.java b/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyOtherMemberProfileActivity.java index 2252fe1e2c..9f17c736a1 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyOtherMemberProfileActivity.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyOtherMemberProfileActivity.java @@ -7,8 +7,11 @@ import androidx.annotation.Nullable; import androidx.viewpager.widget.ViewPager; +import com.vijay.jsonwizard.domain.Form; + import org.json.JSONObject; import org.smartregister.chw.R; +import org.smartregister.chw.application.ChwApplication; import org.smartregister.chw.core.activity.CoreFamilyOtherMemberProfileActivity; import org.smartregister.chw.core.activity.CoreFamilyProfileActivity; import org.smartregister.chw.core.form_data.NativeFormsDataBinder; @@ -204,4 +207,11 @@ protected void startHfMalariaFollowupForm() { protected void setIndependentClient(boolean isIndependentClient) { super.isIndependent = isIndependentClient; } + + @Override + public Form getForm() { + Form currentFormConfig = super.getForm(); + currentFormConfig.setGreyOutSaveWhenFormInvalid(ChwApplication.getApplicationFlavor().greyOutFormActionsIfInvalid()); + return currentFormConfig; + } } diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyProfileActivity.java b/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyProfileActivity.java index 628bbcc938..2d4a79ba8e 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyProfileActivity.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyProfileActivity.java @@ -12,7 +12,11 @@ import androidx.fragment.app.Fragment; import androidx.viewpager.widget.ViewPager; +import com.vijay.jsonwizard.domain.Form; + import org.joda.time.DateTime; +import org.json.JSONObject; +import org.smartregister.chw.R; import org.smartregister.chw.anc.activity.BaseAncMemberProfileActivity; import org.smartregister.chw.anc.domain.MemberObject; import org.smartregister.chw.application.ChwApplication; @@ -254,4 +258,25 @@ public void goToChildProfileActivity(CommonPersonObjectClient patient, Bundle bu intent.putExtra(org.smartregister.chw.anc.util.Constants.ANC_MEMBER_OBJECTS.MEMBER_PROFILE_OBJECT, memberObject); startActivity(intent); } + + @Override + public Form getFormConfig() { + Form currentConfig = new Form(); + if (ChwApplication.getApplicationFlavor().hideFamilyRegisterPreviousNextIcons()){ + currentConfig.setHidePreviousIcon(true); + currentConfig.setHideNextIcon(true); + } + if (ChwApplication.getApplicationFlavor().showFamilyRegisterNextInToolbar()){ + currentConfig.setHideNextButton(true); + currentConfig.setNextLabel(getString(R.string.next)); + currentConfig.setShowNextInToolbarWhenWizard(true); + } + currentConfig.setGreyOutSaveWhenFormInvalid(ChwApplication.getApplicationFlavor().greyOutFormActionsIfInvalid()); + return currentConfig; + } + + @Override + public void startFormActivity(JSONObject jsonForm) { + super.startFormActivity(jsonForm); + } } diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyRegisterActivity.java b/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyRegisterActivity.java index bc1d1a334d..c5e346a40b 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyRegisterActivity.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/activity/FamilyRegisterActivity.java @@ -79,8 +79,6 @@ public Form getFormConfig() { currentConfig.setHideNextButton(true); currentConfig.setNextLabel(getString(R.string.next)); currentConfig.setShowNextInToolbarWhenWizard(true); - - currentConfig.setGreyOutSaveWhenFormInvalid(true); } currentConfig.setGreyOutSaveWhenFormInvalid(ChwApplication.getApplicationFlavor().greyOutFormActionsIfInvalid()); return currentConfig;