Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Group session session number #620

Merged
merged 4 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions opensrp-chw/src/kk/assets/json.form/group_session.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@
"openmrs_entity_id": "session_date",
"type": "hidden"
},
{
"key": "session_number",
"openmrs_entity_parent": "",
"openmrs_entity": "concept",
"openmrs_entity_id": "session_number",
"type": "hidden"
},
{
"key": "session_place",
"openmrs_entity_parent": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public class GcRegistrationStageFragment extends BaseGroupSessionRegisterFragmen

//New sessions implementation
private TextInputEditText etSessionDate;

private TextInputEditText etSessionNumber;
private AppCompatSpinner spTypeOfPlace;
private AppCompatSpinner spDidSessionTakePlace;
private LinearLayoutCompat llNoSessionContainer;
Expand Down Expand Up @@ -151,6 +153,13 @@ private boolean validateFirstStepFields() {
etSessionDate.setError(null);
}

if (etSessionNumber.getText().toString().isEmpty()) {
etSessionNumber.setError(getString(R.string.session_number_required));
isStepValid = false;
} else {
etSessionNumber.setError(null);
}

// Validate session place
if (spTypeOfPlace.getSelectedItemPosition() == 0) {
isStepValid = false;
Expand Down Expand Up @@ -198,6 +207,9 @@ public void setupViews(View view) {
spNoSessionSpinner = view.findViewById(R.id.sp_no_session_reason);

etSessionDate = view.findViewById(R.id.editTextSessionDate);
etSessionNumber = view.findViewById(R.id.editTextSessionNumber);
etSessionNumber.setFocusable(true);
etSessionNumber.setClickable(true);
spTypeOfPlace = view.findViewById(R.id.spinnerTypeOfPlace);
etGps = view.findViewById(R.id.editTextGps);
etDuration = view.findViewById(R.id.editTextDuration);
Expand Down Expand Up @@ -245,6 +257,8 @@ public void getSessionDetails(){
//long sessionDateValue = DateUtil.getMillis(selectedDateTime);
sessionModel.setSessionDate(getFormattedSessionDate(selectedDateTime));

sessionModel.setSessionNumber(Objects.requireNonNull(etSessionNumber.getText()).toString());

String sessionPlaceString = spTypeOfPlace.getSelectedItem().toString();
sessionModel.setSessionPlace(sessionPlaceString);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public class GroupSessionModel {
private int durationInMinutes;
private boolean childrenDividedInGroups;

private String sessionNumber;

private Location gpsLocation;
public GroupSessionModel(){

Expand Down Expand Up @@ -194,4 +196,12 @@ public void setDurationInMinutes(int minutes) {
public int getDurationInMinutes() {
return durationInMinutes;
}

public void setSessionNumber(String sessionNumber) {
this.sessionNumber = sessionNumber;
}

public String getSessionNumber() {
return sessionNumber;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ public static class GCJsonKeys {

public static final String GC_SESSION_DATE = "session_date";

public static final String GC_SESSION_NUMBER = "session_number";

public static final String GC_SESSION_NOT_DONE_REASON = "session_not_done_reason";

public static final String GC_SESSION_NOT_DONE_OTHER_REASON = "session_not_done_reason_other";
Expand Down
89 changes: 62 additions & 27 deletions opensrp-chw/src/kk/res/layout/gc_register_contents.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:paddingHorizontal="24dp"
android:paddingVertical="8dp"
android:paddingVertical="5dp"
android:layout_marginTop="8dp"
android:id="@+id/ll_sessions_summary">

Expand All @@ -28,7 +28,7 @@
<RelativeLayout
android:id="@+id/rl_sessions_summary_number"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_height="45dp"
android:layout_weight="1"
android:background="@color/red_overlay">

Expand Down Expand Up @@ -56,7 +56,7 @@
app:layout_constraintTop_toBottomOf="@+id/ll_sessions_summary"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginTop="16dp"/>
android:layout_marginTop="14dp"/>

<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
Expand All @@ -66,7 +66,7 @@
app:layout_constraintTop_toBottomOf="@+id/summary_separator"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginTop="8dp"
android:layout_marginTop="6dp"
android:paddingLeft="24dp"
android:paddingRight="24dp">

Expand All @@ -75,7 +75,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/did_the_session_take_place"
android:layout_marginTop="16dp"
android:layout_marginTop="8dp"
android:textSize="16sp"
android:textColor="@color/black"
android:fontFamily="@font/google_sans_medium"/>
Expand All @@ -84,11 +84,11 @@
android:id="@+id/sp_session_took_place"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginTop="8dp"
android:background="@drawable/spinner_background"
android:fontFamily="@font/google_sans_regular"
android:paddingLeft="4dp"
android:textSize="16sp"
android:textSize="14sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/editTextSessionDateLayout"/>
Expand Down Expand Up @@ -200,31 +200,66 @@
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent">

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/editTextSessionDateLayout"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="24dp"
android:layout_marginEnd="16dp"
android:hint="@string/select_session_date"
android:textColorHint="?android:attr/textColorPrimary"
android:layout_marginTop="5dp"
android:id="@+id/ll_session_date"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
app:layout_constraintTop_toTopOf="parent"
android:orientation="horizontal">

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/editTextSessionDateLayout"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:id="@+id/editTextSessionDate"
android:inputType="text"
android:textSize="16sp"
android:focusable="false"
android:fontFamily="@font/google_sans_regular"
android:textColor="?android:attr/textColorPrimary" />
android:layout_marginStart="16dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="4dp"
android:hint="@string/select_session_date"
android:textColorHint="?android:attr/textColorPrimary">


<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/editTextSessionDate"
android:inputType="text"
android:textSize="16sp"
android:focusable="false"
android:fontFamily="@font/google_sans_regular"
android:textColor="?android:attr/textColorPrimary" />

</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/editTextSessionNumberLayout"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginStart="4dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="16dp"
android:hint="@string/select_session_number"
android:textColorHint="?android:attr/textColorPrimary">

</com.google.android.material.textfield.TextInputLayout>

<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/editTextSessionNumber"
android:inputType="number"
android:textSize="16sp"
android:fontFamily="@font/google_sans_regular"
android:textColor="?android:attr/textColorPrimary" />

</com.google.android.material.textfield.TextInputLayout>


</LinearLayout>

<androidx.appcompat.widget.AppCompatSpinner
android:id="@+id/spinnerTypeOfPlace"
Expand All @@ -239,7 +274,7 @@
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/editTextSessionDateLayout"/>
app:layout_constraintTop_toBottomOf="@+id/ll_session_date"/>

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/editTextGps"
Expand Down
2 changes: 2 additions & 0 deletions opensrp-chw/src/kk/res/values-sw/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
<string name="select_child_for_gs">Chagua Mtoto Aliyehudhuria</string>
<string name="did_you_divide_children_age_groups">Je uliwatenganisha watoto kwenye makundi tofauti?</string>
<string name="select_session_date">Tarehe ya kipindi</string>
<string name="select_session_number">Namba ya kipindi</string>
<string name="records_of_sessions_this_month">Mafunzo ya vikundi mwezi huu</string>
<string name="did_the_session_take_place">Je kipindi kilitokea?</string>
<string name="did_another_session_take_place">Je kipindi kingine kilitokea?</string>
Expand Down Expand Up @@ -224,4 +225,5 @@
<string name="child_safety_year_ii">Usalama wa mtoto: Kuzuia ajali</string>
<string name="family_member_involvement">Kuwahusisha wanafamila wengine</string>
<string name="family_member_involvement_next_visit">Kuwakumbusha wanafamila kuhudhuria tembeleo lijalo</string>
<string name="session_number_required">Namba ya kipindi inatakiwa</string>
</resources>
2 changes: 2 additions & 0 deletions opensrp-chw/src/kk/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
<string name="select_child_for_gs">Select Child Present</string>
<string name="did_you_divide_children_age_groups">Did you divide children into different age groups?</string>
<string name="select_session_date">Select session date</string>
<string name="select_session_number">Session number</string>
<string name="records_of_sessions_this_month">Records of sessions this month</string>
<string name="did_the_session_take_place">Did the session take place</string>
<string name="did_another_session_take_place">Did another session take place</string>
Expand Down Expand Up @@ -243,4 +244,5 @@
<string name="child_safety_year_ii">Child safety observation and counselling: Prevention of Accidents</string>
<string name="family_member_involvement">Family members involvement</string>
<string name="family_member_involvement_next_visit">Family members involvement: Reminder for next visit</string>
<string name="session_number_required">Session number is required</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,9 @@ private void processPopulatableFields(JSONObject field, GroupSessionModel sessio
case KkConstants.GCJsonKeys.GC_SESSION_DATE:
field.put(org.smartregister.chw.util.JsonFormUtils.VALUE, sessionModel.getSessionDate());
break;
case KkConstants.GCJsonKeys.GC_SESSION_NUMBER:
field.put(org.smartregister.chw.util.JsonFormUtils.VALUE, sessionModel.getSessionNumber());
break;
case KkConstants.GCJsonKeys.GC_SESSION_ID:
field.put(org.smartregister.chw.util.JsonFormUtils.VALUE, sessionModel.getSessionId());
break;
Expand Down