diff --git a/bidan-cloudant/src/main/java/org/smartregister/bidan_cloudant/activity/KANCSmartRegisterActivity.java b/bidan-cloudant/src/main/java/org/smartregister/bidan_cloudant/activity/KANCSmartRegisterActivity.java index ae50bf2..07508a6 100644 --- a/bidan-cloudant/src/main/java/org/smartregister/bidan_cloudant/activity/KANCSmartRegisterActivity.java +++ b/bidan-cloudant/src/main/java/org/smartregister/bidan_cloudant/activity/KANCSmartRegisterActivity.java @@ -43,6 +43,14 @@ import butterknife.ButterKnife; import util.BidanFormUtils; +import static org.smartregister.bidan_cloudant.utils.AllConstantsINA.FormNames.KARTU_IBU_ANC_CLOSE; +import static org.smartregister.bidan_cloudant.utils.AllConstantsINA.FormNames.KARTU_IBU_ANC_REGISTRATION; +import static org.smartregister.bidan_cloudant.utils.AllConstantsINA.FormNames.KARTU_IBU_ANC_RENCANA_PERSALINAN; +import static org.smartregister.bidan_cloudant.utils.AllConstantsINA.FormNames.KARTU_IBU_ANC_VISIT; +import static org.smartregister.bidan_cloudant.utils.AllConstantsINA.FormNames.KARTU_IBU_ANC_VISIT_INTEGRASI; +import static org.smartregister.bidan_cloudant.utils.AllConstantsINA.FormNames.KARTU_IBU_ANC_VISIT_LABTEST; +import static org.smartregister.bidan_cloudant.utils.AllConstantsINA.FormNames.KOHORT_PNC_REGISTRATION; + public class KANCSmartRegisterActivity extends SecuredNativeSmartRegisterActivity implements LocationSelectorDialogFragment.OnLocationSelectedListener, DisplayFormListener{ @@ -174,17 +182,6 @@ public void saveFormSubmission(String formSubmission, String id, String formName context().formSubmissionRouter().handleSubmission(submission, formName); switchToBaseFragment(formSubmission); // Unnecessary!! passing on data - if(formName.equals("registrasi_ibu")) { - Log.d(TAG, "saveFormSubmission: it was registrasi_ibu form"); - // FieldOverrides fieldOverrides = new FieldOverrides(combined.toString()); - - fieldOverrides.put("ibuCaseId",submission.entityId()); - FieldOverrides fo = new FieldOverrides(fieldOverrides.toString()); - - activatingOtherForm("registrasi_anak", null, fo.getJSONString()); - /// activatingForm("registrasi_anak", null, fo.getJSONString()); - } - //end capture flurry log for FS String end = timer.format(new Date()); Map FS = new HashMap(); @@ -199,8 +196,6 @@ public void saveFormSubmission(String formSubmission, String id, String formName e.printStackTrace(); } - - } public void activatingOtherForm(final String formName, final String entityId, final String metaData) { @@ -245,7 +240,7 @@ public void OnLocationSelected(String locationJSONString) { if (combined != null) { FieldOverrides fieldOverrides = new FieldOverrides(combined.toString()); - startFormActivity("registrasi_ibu", null, fieldOverrides.getJSONString()); + startFormActivity(KARTU_IBU_ANC_REGISTRATION, null, fieldOverrides.getJSONString()); } } @@ -389,10 +384,13 @@ public void onBackPressed() { private String[] buildFormNameList(){ List formNames = new ArrayList(); - formNames.add("registrasi_ibu"); - formNames.add("registrasi_anak"); - formNames.add("close_form"); - formNames.add("kohort_bayi_immunization"); + formNames.add(KARTU_IBU_ANC_VISIT); + formNames.add(KARTU_IBU_ANC_VISIT_INTEGRASI); + formNames.add(KARTU_IBU_ANC_VISIT_LABTEST); + formNames.add(KARTU_IBU_ANC_RENCANA_PERSALINAN); + formNames.add(KOHORT_PNC_REGISTRATION); + formNames.add(KARTU_IBU_ANC_CLOSE); + return formNames.toArray(new String[formNames.size()]); } diff --git a/bidan-cloudant/src/main/java/org/smartregister/bidan_cloudant/activity/KChildSmartRegisterActivity.java b/bidan-cloudant/src/main/java/org/smartregister/bidan_cloudant/activity/KChildSmartRegisterActivity.java index 3f430e8..ff81041 100644 --- a/bidan-cloudant/src/main/java/org/smartregister/bidan_cloudant/activity/KChildSmartRegisterActivity.java +++ b/bidan-cloudant/src/main/java/org/smartregister/bidan_cloudant/activity/KChildSmartRegisterActivity.java @@ -43,6 +43,14 @@ import butterknife.ButterKnife; import util.BidanFormUtils; +import static org.smartregister.bidan_cloudant.utils.AllConstantsINA.FormNames.KOHORT_CHILD_REGISTRATION; +import static org.smartregister.bidan_cloudant.utils.AllConstantsINA.FormNames.KARTU_IBU_ANC_CLOSE; +import static org.smartregister.bidan_cloudant.utils.AllConstantsINA.FormNames.KARTU_IBU_ANC_RENCANA_PERSALINAN; +import static org.smartregister.bidan_cloudant.utils.AllConstantsINA.FormNames.KARTU_IBU_ANC_VISIT; +import static org.smartregister.bidan_cloudant.utils.AllConstantsINA.FormNames.KARTU_IBU_ANC_VISIT_INTEGRASI; +import static org.smartregister.bidan_cloudant.utils.AllConstantsINA.FormNames.KARTU_IBU_ANC_VISIT_LABTEST; +import static org.smartregister.bidan_cloudant.utils.AllConstantsINA.FormNames.KOHORT_PNC_REGISTRATION; + public class KChildSmartRegisterActivity extends SecuredNativeSmartRegisterActivity implements LocationSelectorDialogFragment.OnLocationSelectedListener, DisplayFormListener{ @@ -175,17 +183,6 @@ public void saveFormSubmission(String formSubmission, String id, String formName context().formSubmissionRouter().handleSubmission(submission, formName); switchToBaseFragment(formSubmission); // Unnecessary!! passing on data - if(formName.equals("registrasi_ibu")) { - Log.d(TAG, "saveFormSubmission: it was registrasi_ibu form"); - // FieldOverrides fieldOverrides = new FieldOverrides(combined.toString()); - - fieldOverrides.put("ibuCaseId",submission.entityId()); - FieldOverrides fo = new FieldOverrides(fieldOverrides.toString()); - - activatingOtherForm("registrasi_anak", null, fo.getJSONString()); - /// activatingForm("registrasi_anak", null, fo.getJSONString()); - } - //end capture flurry log for FS String end = timer.format(new Date()); Map FS = new HashMap(); @@ -246,7 +243,7 @@ public void OnLocationSelected(String locationJSONString) { if (combined != null) { FieldOverrides fieldOverrides = new FieldOverrides(combined.toString()); - startFormActivity("registrasi_ibu", null, fieldOverrides.getJSONString()); + startFormActivity(KOHORT_CHILD_REGISTRATION, null, fieldOverrides.getJSONString()); } } @@ -390,10 +387,12 @@ public void onBackPressed() { private String[] buildFormNameList(){ List formNames = new ArrayList(); - formNames.add("registrasi_ibu"); - formNames.add("registrasi_anak"); - formNames.add("close_form"); - formNames.add("kohort_bayi_immunization"); + formNames.add(KARTU_IBU_ANC_VISIT); + formNames.add(KARTU_IBU_ANC_VISIT_INTEGRASI); + formNames.add(KARTU_IBU_ANC_VISIT_LABTEST); + formNames.add(KARTU_IBU_ANC_RENCANA_PERSALINAN); + formNames.add(KOHORT_PNC_REGISTRATION); + formNames.add(KARTU_IBU_ANC_CLOSE); return formNames.toArray(new String[formNames.size()]); } diff --git a/bidan-cloudant/src/main/java/org/smartregister/bidan_cloudant/activity/KFPSmartRegisterActivity.java b/bidan-cloudant/src/main/java/org/smartregister/bidan_cloudant/activity/KFPSmartRegisterActivity.java index 65383b6..c486603 100644 --- a/bidan-cloudant/src/main/java/org/smartregister/bidan_cloudant/activity/KFPSmartRegisterActivity.java +++ b/bidan-cloudant/src/main/java/org/smartregister/bidan_cloudant/activity/KFPSmartRegisterActivity.java @@ -43,6 +43,10 @@ import butterknife.ButterKnife; import util.BidanFormUtils; +import static org.smartregister.bidan_cloudant.utils.AllConstantsINA.FormNames.KOHORT_KB_CLOSE; +import static org.smartregister.bidan_cloudant.utils.AllConstantsINA.FormNames.KOHORT_KB_REGISTRATION; +import static org.smartregister.bidan_cloudant.utils.AllConstantsINA.FormNames.KOHORT_KB_UPDATE; + public class KFPSmartRegisterActivity extends SecuredNativeSmartRegisterActivity implements LocationSelectorDialogFragment.OnLocationSelectedListener, DisplayFormListener{ @@ -175,17 +179,6 @@ public void saveFormSubmission(String formSubmission, String id, String formName context().formSubmissionRouter().handleSubmission(submission, formName); switchToBaseFragment(formSubmission); // Unnecessary!! passing on data - if(formName.equals("registrasi_ibu")) { - Log.d(TAG, "saveFormSubmission: it was registrasi_ibu form"); - // FieldOverrides fieldOverrides = new FieldOverrides(combined.toString()); - - fieldOverrides.put("ibuCaseId",submission.entityId()); - FieldOverrides fo = new FieldOverrides(fieldOverrides.toString()); - - activatingOtherForm("registrasi_anak", null, fo.getJSONString()); - /// activatingForm("registrasi_anak", null, fo.getJSONString()); - } - //end capture flurry log for FS String end = timer.format(new Date()); Map FS = new HashMap(); @@ -246,7 +239,7 @@ public void OnLocationSelected(String locationJSONString) { if (combined != null) { FieldOverrides fieldOverrides = new FieldOverrides(combined.toString()); - startFormActivity("registrasi_ibu", null, fieldOverrides.getJSONString()); + startFormActivity(KOHORT_KB_REGISTRATION, null, fieldOverrides.getJSONString()); } } @@ -390,10 +383,9 @@ public void onBackPressed() { private String[] buildFormNameList(){ List formNames = new ArrayList(); - formNames.add("registrasi_ibu"); - formNames.add("registrasi_anak"); - formNames.add("close_form"); - formNames.add("kohort_bayi_immunization"); + formNames.add(KOHORT_KB_REGISTRATION); + formNames.add(KOHORT_KB_UPDATE); + formNames.add(KOHORT_KB_CLOSE); return formNames.toArray(new String[formNames.size()]); } diff --git a/bidan-cloudant/src/main/java/org/smartregister/bidan_cloudant/activity/KMotherSmartRegisterActivity.java b/bidan-cloudant/src/main/java/org/smartregister/bidan_cloudant/activity/KMotherSmartRegisterActivity.java index c073410..7bd38de 100644 --- a/bidan-cloudant/src/main/java/org/smartregister/bidan_cloudant/activity/KMotherSmartRegisterActivity.java +++ b/bidan-cloudant/src/main/java/org/smartregister/bidan_cloudant/activity/KMotherSmartRegisterActivity.java @@ -9,6 +9,7 @@ import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.util.Log; +import android.widget.Toast; import com.flurry.android.FlurryAgent; @@ -42,6 +43,13 @@ import butterknife.Bind; import butterknife.ButterKnife; import util.BidanFormUtils; +import util.formula.Support; + +import static org.smartregister.bidan_cloudant.utils.AllConstantsINA.FormNames.ANAK_BAYI_REGISTRATION; +import static org.smartregister.bidan_cloudant.utils.AllConstantsINA.FormNames.KARTU_IBU_ANC_REGISTRATION; +import static org.smartregister.bidan_cloudant.utils.AllConstantsINA.FormNames.KARTU_IBU_CLOSE; +import static org.smartregister.bidan_cloudant.utils.AllConstantsINA.FormNames.KOHORT_MOTHER_REGISTRATION; +import static org.smartregister.bidan_cloudant.utils.AllConstantsINA.FormNames.KOHORT_KB_PELAYANAN; public class KMotherSmartRegisterActivity extends SecuredNativeSmartRegisterActivity implements LocationSelectorDialogFragment.OnLocationSelectedListener, DisplayFormListener{ @@ -174,15 +182,9 @@ public void saveFormSubmission(String formSubmission, String id, String formName context().formSubmissionRouter().handleSubmission(submission, formName); switchToBaseFragment(formSubmission); // Unnecessary!! passing on data - if(formName.equals("kartu_ibu_registration")) { - Log.d(TAG, "saveFormSubmission: it was kartu_ibu_registration form"); - - fieldOverrides.put("ibuCaseId",submission.entityId()); - FieldOverrides fo = new FieldOverrides(fieldOverrides.toString()); - -// activatingOtherForm("registrasi_anak", null, fo.getJSONString()); - - } +// if(formName.equals("kartu_ibu_registration")){ +// saveuniqueid(); +// } //end capture flurry log for FS String end = timer.format(new Date()); @@ -205,6 +207,11 @@ public void saveFormSubmission(String formSubmission, String id, String formName @Override public void OnLocationSelected(String locationJSONString) { + if(Support.ONSYNC) { + Toast.makeText(this,"Data still Synchronizing, please wait",Toast.LENGTH_SHORT).show(); + return; + } + JSONObject combined = null; try { @@ -226,7 +233,7 @@ public void OnLocationSelected(String locationJSONString) { if (combined != null) { FieldOverrides fieldOverrides = new FieldOverrides(combined.toString()); - startFormActivity("registrasi_ibu", null, fieldOverrides.getJSONString()); + startFormActivity(KOHORT_MOTHER_REGISTRATION, null, fieldOverrides.getJSONString()); } } @@ -369,14 +376,16 @@ public void onBackPressed() { } private String[] buildFormNameList(){ - List formNames = new ArrayList(); - formNames.add("registrasi_ibu"); - formNames.add("registrasi_anak"); - formNames.add("close_form"); - formNames.add("kohort_bayi_immunization"); + List formNames = new ArrayList<>(); + formNames.add(KOHORT_MOTHER_REGISTRATION); + formNames.add(KOHORT_KB_PELAYANAN); + formNames.add(KARTU_IBU_ANC_REGISTRATION); + formNames.add(ANAK_BAYI_REGISTRATION); + formNames.add(KARTU_IBU_CLOSE); return formNames.toArray(new String[formNames.size()]); } + @Override protected void onPause() { super.onPause(); @@ -435,5 +444,15 @@ public void onClick(DialogInterface dialog, int which) { } }; + public void saveuniqueid() { +// try { +// JSONObject uniqueId = new JSONObject(LoginActivity.generator.uniqueIdController().getUniqueIdJson()); +// String uniq = uniqueId.getString("unique_id"); +// LoginActivity.generator.uniqueIdController().updateCurrentUniqueId(uniq); +// } catch (JSONException e) { +// e.printStackTrace(); +// } + } + } diff --git a/bidan-cloudant/src/main/java/org/smartregister/bidan_cloudant/activity/KPNCSmartRegisterActivity.java b/bidan-cloudant/src/main/java/org/smartregister/bidan_cloudant/activity/KPNCSmartRegisterActivity.java index 0b6715d..14f2419 100644 --- a/bidan-cloudant/src/main/java/org/smartregister/bidan_cloudant/activity/KPNCSmartRegisterActivity.java +++ b/bidan-cloudant/src/main/java/org/smartregister/bidan_cloudant/activity/KPNCSmartRegisterActivity.java @@ -43,6 +43,12 @@ import butterknife.ButterKnife; import util.BidanFormUtils; +import static org.smartregister.bidan_cloudant.utils.AllConstantsINA.FormNames.KARTU_IBU_PNC_CLOSE; +import static org.smartregister.bidan_cloudant.utils.AllConstantsINA.FormNames.KARTU_IBU_PNC_OA; +import static org.smartregister.bidan_cloudant.utils.AllConstantsINA.FormNames.KARTU_IBU_PNC_POSPARTUM_KB; +import static org.smartregister.bidan_cloudant.utils.AllConstantsINA.FormNames.KOHORT_PNC_REGISTRATION; +import static org.smartregister.bidan_cloudant.utils.AllConstantsINA.FormNames.KARTU_IBU_PNC_VISIT; + public class KPNCSmartRegisterActivity extends SecuredNativeSmartRegisterActivity implements LocationSelectorDialogFragment.OnLocationSelectedListener, DisplayFormListener{ @@ -246,7 +252,7 @@ public void OnLocationSelected(String locationJSONString) { if (combined != null) { FieldOverrides fieldOverrides = new FieldOverrides(combined.toString()); - startFormActivity("registrasi_ibu", null, fieldOverrides.getJSONString()); + startFormActivity(KOHORT_PNC_REGISTRATION, null, fieldOverrides.getJSONString()); } } @@ -389,11 +395,13 @@ public void onBackPressed() { } private String[] buildFormNameList(){ - List formNames = new ArrayList(); - formNames.add("registrasi_ibu"); - formNames.add("registrasi_anak"); - formNames.add("close_form"); - formNames.add("kohort_bayi_immunization"); + List formNames = new ArrayList<>(); + formNames.add(KARTU_IBU_PNC_VISIT); + formNames.add(KARTU_IBU_PNC_POSPARTUM_KB); + formNames.add(KARTU_IBU_PNC_CLOSE); + formNames.add(KARTU_IBU_PNC_OA); + formNames.add(KARTU_IBU_PNC_CLOSE); + return formNames.toArray(new String[formNames.size()]); } diff --git a/bidan-cloudant/src/main/java/org/smartregister/bidan_cloudant/utils/AllConstantsINA.java b/bidan-cloudant/src/main/java/org/smartregister/bidan_cloudant/utils/AllConstantsINA.java index 8336db5..e613bb8 100644 --- a/bidan-cloudant/src/main/java/org/smartregister/bidan_cloudant/utils/AllConstantsINA.java +++ b/bidan-cloudant/src/main/java/org/smartregister/bidan_cloudant/utils/AllConstantsINA.java @@ -18,6 +18,84 @@ public class AllConstantsINA { public static final String ANCPNC_TABLE_NAME = "ec_ibu"; public static final String PNC_TABLE_NAME = "ec_pnc"; + public class FormNames { + public static final String EC_REGISTRATION = "ec_registration"; + public static final String FP_COMPLICATIONS = "fp_complications"; + public static final String FP_CHANGE = "fp_change"; + public static final String RENEW_FP_PRODUCT = "renew_fp_product"; + public static final String EC_CLOSE = "ec_close"; + public static final String ANC_REGISTRATION = "anc_registration"; + public static final String ANC_REGISTRATION_OA = "anc_registration_oa"; + public static final String ANC_VISIT = "anc_visit"; + public static final String ANC_CLOSE = "anc_close"; + public static final String TT = "tt"; + public static final String TT_BOOSTER = "tt_booster"; + public static final String TT_1 = "tt_1"; + public static final String TT_2 = "tt_2"; + public static final String IFA = "ifa"; + public static final String HB_TEST = "hb_test"; + public static final String DELIVERY_OUTCOME = "delivery_outcome"; + public static final String PNC_REGISTRATION_OA = "pnc_registration_oa"; + public static final String PNC_CLOSE = "pnc_close"; + public static final String PNC_VISIT = "pnc_visit"; + public static final String PNC_POSTPARTUM_FAMILY_PLANNING = "postpartum_family_planning"; + public static final String CHILD_IMMUNIZATIONS = "child_immunizations"; + public static final String KOHORT_CHILD_REGISTRATION = "child_registration_ec"; + public static final String CHILD_REGISTRATION_OA = "child_registration_oa"; + public static final String CHILD_CLOSE = "child_close"; + public static final String CHILD_ILLNESS = "child_illness"; + public static final String VITAMIN_A = "vitamin_a"; + public static final String DELIVERY_PLAN = "delivery_plan"; + public static final String EC_EDIT = "ec_edit"; + public static final String ANC_INVESTIGATIONS = "anc_investigations"; + public static final String RECORD_ECPS = "record_ecps"; + public static final String FP_REFERRAL_FOLLOWUP = "fp_referral_followup"; + public static final String FP_FOLLOWUP = "fp_followup"; + + // KOHORT IBU + public static final String KOHORT_MOTHER_REGISTRATION = "kartu_ibu_registration"; + public static final String KARTU_IBU_EDIT = "kartu_ibu_edit"; + public static final String KARTU_IBU_CLOSE = "kartu_ibu_close"; + + // ANC + public static final String KARTU_IBU_ANC_REGISTRATION = "kartu_anc_registration"; + public static final String KARTU_IBU_ANC_OA="kartu_anc_registration_oa"; + public static final String KARTU_IBU_ANC_RENCANA_PERSALINAN = "kartu_anc_rencana_persalinan"; + public static final String KARTU_IBU_ANC_EDIT="kartu_anc_visit_edit"; + public static final String KARTU_IBU_ANC_CLOSE="kartu_anc_close"; + public static final String KARTU_IBU_ANC_VISIT="kartu_anc_visit"; + public static final String KARTU_IBU_ANC_VISIT_INTEGRASI = "kartu_anc_visit_integrasi"; + public static final String KARTU_IBU_ANC_VISIT_LABTEST = "kartu_anc_visit_labTest"; + + // PNC + public static final String KARTU_IBU_PNC_EDIT="kartu_pnc_edit"; + public static final String KOHORT_PNC_REGISTRATION = "kartu_pnc_dokumentasi_persalinan"; + public static final String KARTU_IBU_PNC_CLOSE="kartu_pnc_close"; + public static final String KARTU_IBU_PNC_OA="kartu_pnc_regitration_oa"; + public static final String KARTU_IBU_PNC_VISIT="kartu_pnc_visit"; + public static final String KARTU_IBU_PNC_POSPARTUM_KB="kartu_pnc_pospartum_kb"; + + // ANAK + public static final String KOHORT_BAYI_KUNJUNGAN="kohort_bayi_kunjungan"; + public static final String KARTU_IBU_ANAK_CLOSE="kohort_anak_tutup"; + public static final String BALITA_KUNJUNGAN="kohort_balita_kunjungan"; + public static final String BAYI_IMUNISASI="kohort_bayi_immunization"; + public static final String BAYI_NEONATAL_PERIOD="kohort_bayi_neonatal_period"; + public static final String KOHORT_BAYI_EDIT="kohort_bayi_edit"; + public static final String ANAK_BAYI_REGISTRATION = "kohort_bayi_registration"; + public static final String ANAK_NEW_REGISTRATION="kohort_bayi_registration_oa"; + + // KB + public static final String KOHORT_KB_REGISTRATION ="kohort_kb_registration"; + public static final String KOHORT_KB_PELAYANAN="kohort_kb_pelayanan"; + public static final String KOHORT_KB_CLOSE="kohort_kb_close"; + public static final String KOHORT_KB_UPDATE="kohort_kb_update"; + // public static final String KOHORT_KB_EDIT="kohort_kb_edit"; + + public static final String FEEDBACK_BIDAN = "feedback_bidan"; + } + + public static final boolean TIME_CHECK = BuildConfig.TIME_CHECK; public static final long MAX_SERVER_TIME_DIFFERENCE = BuildConfig.MAX_SERVER_TIME_DIFFERENCE;