Skip to content

Commit

Permalink
Merge pull request #89 from OpenSRP/forms_available
Browse files Browse the repository at this point in the history
Make Forms available based on clients profile
  • Loading branch information
manutarus authored Dec 11, 2019
2 parents a3f4dc1 + 41de013 commit f365db1
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 18 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=1.1.11-SNAPSHOT
VERSION_NAME=1.1.12-SNAPSHOT
VERSION_CODE=1
GROUP=org.smartregister
POM_SETTING_DESCRIPTION=OpenSRP Client Chw Core Library
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ public boolean onOptionsItemSelected(MenuItem item) {
} else if (i == R.id.action_malaria_registration) {
startMalariaRegister();
return true;
}else if (i == R.id.action_malaria_followup_visit) {
startMalariaFollowUpVisit();
return true;
} else if (i == R.id.action_registration) {
startFormForEdit(R.string.edit_member_form_title);
return true;
Expand All @@ -164,6 +167,8 @@ public CoreFamilyOtherMemberActivityPresenter presenter() {

protected abstract void startMalariaRegister();

protected abstract void startMalariaFollowUpVisit();

public void startFormForEdit(Integer title_resource) {

CommonRepository commonRepository = Utils.context().commonrepository(Utils.metadata().familyMemberRegister.tableName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,18 @@ public boolean onOptionsItemSelected(MenuItem item) {
}
return true;

} else if (itemId == R.id.action_malaria_confirmation) {
} else if (itemId == R.id.action_malaria_registration) {
startMalariaRegister();
return true;
} else if (itemId == R.id.action_malaria_followup_visit) {
startMalariaFollowUpVisit();
return true;
} else if (itemId == R.id.action_fp_initiation) {
startFpRegister();
return true;
}else if (itemId == R.id.action_fp_change) {
startFpChangeMethod();
return true;
} else if (itemId == R.id.action__pnc_remove_member) {
removePncMember();
return true;
Expand Down Expand Up @@ -148,4 +154,8 @@ public void setFamilyStatus(AlertStatus status) {
protected abstract void startMalariaRegister();

protected abstract void startFpRegister();

protected abstract void startFpChangeMethod();

protected abstract void startMalariaFollowUpVisit();
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.smartregister.chw.core.dao;

import org.jetbrains.annotations.Nullable;
import org.smartregister.chw.malaria.domain.MemberObject;
import org.smartregister.dao.AbstractDao;

Expand All @@ -9,7 +8,6 @@

public class MalariaDao extends AbstractDao {

@Nullable
public static Date getMalariaTestDate(String baseEntityID) {
String sql = "select malaria_test_date from ec_malaria_confirmation where base_entity_id = '" + baseEntityID + "'";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ public static class JSON_FORM {
private static final String ANC_REFERRAL_FORM = "anc_referral_form";
private static final String PNC_REFERRAL_FORM = "pnc_referral_form";
private static final String FAMILY_PLANNING_REGISTRATION_FORM = "family_planning_registration";
private static final String FAMILY_PLANNING_CHANGE_METHOD_FORM = "family_planning_change_method";
public static AssetManager assetManager;
public static Locale locale;

Expand Down Expand Up @@ -232,10 +233,14 @@ public static String getMalariaConfirmation() {
return Utils.getLocalForm(MALARIA_CONFIRMATION, locale, assetManager);
}

public static String getFpRegistration() {
public static String getFpRegistrationForm() {
return Utils.getLocalForm(FAMILY_PLANNING_REGISTRATION_FORM, locale, assetManager);
}

public static String getFpChengeMethodForm() {
return Utils.getLocalForm(FAMILY_PLANNING_CHANGE_METHOD_FORM, locale, assetManager);
}

public static boolean isMultiPartForm(JSONObject jsonForm) {
String encounterType = jsonForm.optString(ENCOUNTER_TYPE);
return !encounterType.equals(MALARIA_FOLLOW_UP_VISIT);
Expand Down
12 changes: 11 additions & 1 deletion opensrp-chw-core/src/main/res/menu/other_member_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,28 @@
<item
android:id="@+id/action_fp_initiation"
android:enabled="true"
android:title="@string/fp_initiation"
android:title="@string/family_planning_initiation"
android:visible="false"
app:showAsAction="never" />

<item
android:id="@+id/action_fp_change"
android:enabled="true"
android:title="@string/family_planning_change"
android:visible="false"
app:showAsAction="never" />

<item
android:id="@+id/action_malaria_registration"
android:enabled="true"
android:title="@string/malaria_registration"
android:visible="false"
app:showAsAction="never" />
<item
android:id="@+id/action_malaria_followup_visit"
android:enabled="true"
android:title="@string/follow_up_visit"
android:visible="false"
app:showAsAction="never" />
<item
android:id="@+id/action_sick_child_follow_up"
Expand Down
29 changes: 19 additions & 10 deletions opensrp-chw-core/src/main/res/menu/pnc_member_profile_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,31 @@
app:showAsAction="never" />

<item
android:id="@+id/action_malaria_confirmation"
android:id="@+id/action_fp_initiation"
android:enabled="true"
android:title="@string/family_planning_initiation"
android:visible="false"
app:showAsAction="never" />

<item
android:id="@+id/action_fp_change"
android:enabled="true"
android:title="@string/family_planning_change"
android:visible="false"
app:showAsAction="never" />

<item
android:id="@+id/action_malaria_registration"
android:enabled="true"
android:title="@string/malaria_registration"
android:visible="false"
app:showAsAction="never" />

<item
android:id="@+id/action_fp_initiation"
android:id="@+id/action_malaria_followup_visit"
android:enabled="true"
android:title="@string/fp_initiation"
android:visible="false"
android:title="@string/hf_malaria_follow_up"
app:showAsAction="never" />

<item
Expand All @@ -46,11 +62,4 @@
android:title="@string/malaria_diagnosis"
app:showAsAction="never" />

<item
android:id="@+id/action_malaria_followup_visit"
android:enabled="true"
android:visible="false"
android:title="@string/hf_malaria_follow_up"
app:showAsAction="never" />

</menu>
2 changes: 1 addition & 1 deletion opensrp-chw-core/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@
<string name="remove_this_person">Remove this person</string>
<string name="registration_info">Registration info</string>
<string name="anc_registration">ANC Registration</string>
<string name="fp_initiation">FP initiation</string>
<string name="malaria_registration">Malaria Confirmation</string>
<string name="fp_registration">Family planning registration</string>
<string name="malaria_follow_up">Follow-up Visit</string>
Expand Down Expand Up @@ -421,6 +420,7 @@
<string name="permanent_vasectomy"> Permanent (Vasectomy)</string>
<string name="hf_malaria_follow_up">Malaria follow-up</string>
<string name="family_planning_initiation">FP initiation</string>
<string name="family_planning_change">FP method change</string>
<string name="pregnancy_confirmation">Pregnancy confirmation</string>
<string name="pnc_danger_sign_outcome">PNC danger signs outcome</string>
<string name="anc_danger_signs_outcome">ANC danger signs outcome</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ protected void startFpRegister() {

@Override
protected void startMalariaRegister() {
//TODO implement start anc malaria for HF
//TODO implement start malaria register for HF
}

@Override
protected void startMalariaFollowUpVisit() {
//TODO implement start malaria follow-up visit for HF
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ protected void startFpRegister() {
//TODO implement start FP register for HF
}

@Override
protected void startFpChangeMethod() {
//TODO implement start FP change method for HF
}

public void setReferralTasks(Set<Task> taskList) {
if (referralRecyclerView != null && taskList.size() > 0) {
RecyclerView.Adapter mAdapter = new ReferralCardViewAdapter(taskList, this, memberObject, getFamilyHeadName(),
Expand Down Expand Up @@ -204,6 +209,11 @@ protected Class<? extends CorePncRegisterActivity> getPncRegisterActivityClass()
return PncRegisterActivity.class;
}

@Override
protected void startMalariaFollowUpVisit() {
// TODO implement functionality to malaria home visit
}

public PncMemberProfileContract.Presenter pncMemberProfilePresenter() {
if (pncMemberProfilePresenter == null) {
pncMemberProfilePresenter = new PncMemberProfilePresenter(this, new PncMemberProfileInteractor(), memberObject);
Expand Down

0 comments on commit f365db1

Please sign in to comment.