From a86c3cb849d7cbffcfc7f5bd72dbf7aa62f0b913 Mon Sep 17 00:00:00 2001 From: LZRS <12814349+LZRS@users.noreply.github.com> Date: Wed, 27 Oct 2021 16:43:20 +0300 Subject: [PATCH] LMH1-73: grey out form next/save when form fields missing --- .../org/smartregister/chw/application/ChwApplicationFlv.java | 5 +++++ .../smartregister/chw/activity/FamilyRegisterActivity.java | 3 +++ .../org/smartregister/chw/application/ChwApplication.java | 2 ++ .../chw/application/DefaultChwApplicationFlv.java | 5 +++++ 4 files changed, 15 insertions(+) diff --git a/opensrp-chw/src/lmh/java/org/smartregister/chw/application/ChwApplicationFlv.java b/opensrp-chw/src/lmh/java/org/smartregister/chw/application/ChwApplicationFlv.java index 3a9725d5e3..595e80dfbd 100644 --- a/opensrp-chw/src/lmh/java/org/smartregister/chw/application/ChwApplicationFlv.java +++ b/opensrp-chw/src/lmh/java/org/smartregister/chw/application/ChwApplicationFlv.java @@ -200,4 +200,9 @@ public boolean onFamilySaveGoToProfile() { public boolean onChildProfileHomeGoToChildRegister() { return false; } + + @Override + public boolean greyOutFormActionsIfInvalid() { + return true; + } } 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 94ce107a89..bc1d1a334d 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,7 +79,10 @@ 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; } } \ No newline at end of file diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/application/ChwApplication.java b/opensrp-chw/src/main/java/org/smartregister/chw/application/ChwApplication.java index 1548749728..f2bd125b76 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/application/ChwApplication.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/application/ChwApplication.java @@ -459,6 +459,8 @@ public interface Flavor { boolean onChildProfileHomeGoToChildRegister(); + boolean greyOutFormActionsIfInvalid(); + } } diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/application/DefaultChwApplicationFlv.java b/opensrp-chw/src/main/java/org/smartregister/chw/application/DefaultChwApplicationFlv.java index f7bd0c6681..cea4ee628f 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/application/DefaultChwApplicationFlv.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/application/DefaultChwApplicationFlv.java @@ -258,4 +258,9 @@ public boolean onFamilySaveGoToProfile() { public boolean onChildProfileHomeGoToChildRegister() { return true; } + + @Override + public boolean greyOutFormActionsIfInvalid() { + return false; + } }