diff --git a/opensrp-gizi/src/main/java/org/smartregister/gizi/fragment/GiziSmartRegisterFragment.java b/opensrp-gizi/src/main/java/org/smartregister/gizi/fragment/GiziSmartRegisterFragment.java index fd0dd74..face923 100644 --- a/opensrp-gizi/src/main/java/org/smartregister/gizi/fragment/GiziSmartRegisterFragment.java +++ b/opensrp-gizi/src/main/java/org/smartregister/gizi/fragment/GiziSmartRegisterFragment.java @@ -319,7 +319,7 @@ public void startRegistration() { ft.addToBackStack(null); LocationSelectorDialogFragment - .newInstance((GiziSmartRegisterActivity) getActivity(), new EditDialogOptionModel(), context().anmLocationController().get(), "registrasi_gizi") + .newInstance((GiziSmartRegisterActivity) getActivity(), new EditDialogOptionModel(), context().anmLocationController().get(), "registrasi_ibu") .show(ft, locationDialogTAG); } diff --git a/opensrp-gizi/src/main/java/org/smartregister/gizi/provider/ChildSmartClientsProvider.java b/opensrp-gizi/src/main/java/org/smartregister/gizi/provider/ChildSmartClientsProvider.java index 8c2a919..6e9f847 100644 --- a/opensrp-gizi/src/main/java/org/smartregister/gizi/provider/ChildSmartClientsProvider.java +++ b/opensrp-gizi/src/main/java/org/smartregister/gizi/provider/ChildSmartClientsProvider.java @@ -13,12 +13,14 @@ import org.apache.commons.lang3.StringUtils; import org.joda.time.DateTime; +import org.smartregister.commonregistry.AllCommonsRepository; import org.smartregister.commonregistry.CommonPersonObject; import org.smartregister.commonregistry.CommonPersonObjectClient; import org.smartregister.commonregistry.CommonRepository; import org.smartregister.cursoradapter.SmartRegisterCLientsProviderForCursorAdapter; import org.smartregister.domain.Alert; import org.smartregister.gizi.R; +import org.smartregister.repository.DetailsRepository; import org.smartregister.service.AlertService; import org.smartregister.util.DateUtil; import org.smartregister.util.OpenSRPImageLoader; @@ -40,6 +42,7 @@ import java.util.concurrent.TimeUnit; import util.GiziConstants; +import util.formula.Support; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import static org.smartregister.util.Utils.fillValue; @@ -73,16 +76,27 @@ public ChildSmartClientsProvider(Context context, View.OnClickListener onClickLi public void getView(Cursor cursor, SmartRegisterClient client, final View convertView) { CommonPersonObjectClient pc = (CommonPersonObjectClient) client; -/* viewHolder.name = (TextView)convertView.findViewById(R.id.txt_child_name); - viewHolder.fatherName = (TextView) convertView.findViewById(R.id.ParentName); - viewHolder.subVillage = (TextView) convertView.findViewById(R.id.txt_child_subVillage);*/ - - //fillValue((TextView) convertView.findViewById(R.id.child_zeir_id), getValue(pc.getColumnmaps(), GiziConstants.KEY.ZEIR_ID, false)); + DetailsRepository detailsRepository = org.smartregister.Context.getInstance().detailsRepository(); + detailsRepository.updateDetails(pc); String firstName = getValue(pc.getColumnmaps(), "namaBayi", true); - fillValue((TextView) convertView.findViewById(R.id.txt_child_name), firstName); + // get parent + AllCommonsRepository childRepository = org.smartregister.Context.getInstance().allCommonsRepositoryobjects("ec_anak"); + CommonPersonObject childobject = childRepository.findByCaseID(pc.entityId()); + Log.d("IDssssssssssssss",pc.entityId()); + AllCommonsRepository kirep = org.smartregister.Context.getInstance().allCommonsRepositoryobjects("ec_kartu_ibu"); + final CommonPersonObject kiparent = kirep.findByCaseID(getValue(pc.getColumnmaps(), "relational_id", true)); + Log.d("22222222222222",getValue(pc.getColumnmaps(), "relational_id", true)); + if(kiparent != null) { + detailsRepository.updateDetails(kiparent); + String namaayah = getValue(kiparent.getColumnmaps(), "namaSuami", true); + String namaibu = getValue(kiparent.getColumnmaps(), "namalengkap", true); + fillValue((TextView) convertView.findViewById(R.id.ParentName), namaibu+","+namaayah); + + } + /*String lastName = getValue(pc.getColumnmaps(), GiziConstants.KEY.LAST_NAME, true); String childName = getName(firstName, lastName); diff --git a/opensrp-gizi/src/main/res/layout/smart_register_gizi_client.xml b/opensrp-gizi/src/main/res/layout/smart_register_gizi_client.xml index ca564bd..18ef0e8 100644 --- a/opensrp-gizi/src/main/res/layout/smart_register_gizi_client.xml +++ b/opensrp-gizi/src/main/res/layout/smart_register_gizi_client.xml @@ -36,7 +36,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> - - - - - - - - - - - -