Skip to content
This repository has been archived by the owner on Jan 11, 2024. It is now read-only.

add expiry status for identification card #176

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.apache.fineract.ui.adapters;

import android.content.Context;

import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
Expand Down Expand Up @@ -58,6 +59,16 @@ public void onBindViewHolder(ViewHolder holder, int position) {
calendar.set(Calendar.MONTH, identification.getExpirationDate().getMonth() - 1);
calendar.set(Calendar.DAY_OF_MONTH, identification.getExpirationDate().getDay());
holder.tvExpirationDate.setText(DateUtils.convertServerDate(calendar));

if (calendar.getTime().after(Calendar.getInstance().getTime())) {
holder.tvExpiryStatus.setText(context.getResources().getString(R.string.active));
holder.tvExpiryStatus.setTextColor(
context.getResources().getColor(R.color.deposit_green));
} else {
holder.tvExpiryStatus.setText(context.getResources().getString(R.string.expired));
holder.tvExpiryStatus.setTextColor(
context.getResources().getColor(R.color.red_dark));
}
}

@Override
Expand Down Expand Up @@ -93,6 +104,9 @@ public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickL
@BindView(R.id.ll_identifier_card)
LinearLayout cvCustomer;

@BindView(R.id.tv_expiration_status)
TextView tvExpiryStatus;

public ViewHolder(View v) {
super(v);
ButterKnife.bind(this, v);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import android.view.ViewGroup;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.TextView;

import com.stepstone.stepper.Step;
import com.stepstone.stepper.VerificationError;
Expand Down Expand Up @@ -60,6 +61,9 @@ public class FormIdentificationDetailsFragment extends FineractBaseFragment impl
@BindView(R.id.et_expiration_date)
EditText etExpirationDate;

@BindView(R.id.tv_expiration_status_for_create)
TextView tvExpiryStatus;

@BindView(R.id.til_issuer)
TextInputLayout tilIssuer;

Expand Down Expand Up @@ -153,6 +157,7 @@ private void setDateOfBirth() {
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT, Locale.ENGLISH);
etExpirationDate.setText(sdf.format(calendar.getTime()));
validateExpirationDate();
showExpiryStatus(calendar);
}

@Override
Expand Down Expand Up @@ -256,4 +261,14 @@ public void onAttach(Context context) {
+ " must implement OnNavigationBarListener.IdentificationCard");
}
}

private void showExpiryStatus(Calendar calendar) {
if (calendar.getTime().after(Calendar.getInstance().getTime())) {
tvExpiryStatus.setText(getResources().getString(R.string.active));
tvExpiryStatus.setTextColor(getResources().getColor(R.color.deposit_green));
} else {
tvExpiryStatus.setText(getResources().getString(R.string.expired));
tvExpiryStatus.setTextColor(getResources().getColor(R.color.red_dark));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ public class IdentificationDetailsFragment extends FineractBaseFragment
@BindView(R.id.tv_scans_status)
TextView tvScansStatus;

@BindView(R.id.tv_expiration_status_for_details)
TextView tvExpiryStatus;

@BindView(R.id.rv_scans_uploaded)
RecyclerView rvScansUploaded;

Expand Down Expand Up @@ -169,6 +172,7 @@ public void showUserInterface() {
calendar.set(Calendar.MONTH, identificationCard.getExpirationDate().getMonth() - 1);
calendar.set(Calendar.DAY_OF_MONTH, identificationCard.getExpirationDate().getDay());
tvExpirationDate.setText(DateUtils.convertServerDate(calendar));
showExpiryStatus(calendar);
}

@Override
Expand Down Expand Up @@ -334,4 +338,14 @@ public void onDestroyView() {
hideMifosProgressDialog();
identificationDetailsPresenter.detachView();
}

private void showExpiryStatus(Calendar calendar) {
if (calendar.getTime().after(Calendar.getInstance().getTime())) {
tvExpiryStatus.setText(getResources().getString(R.string.active));
tvExpiryStatus.setTextColor(getResources().getColor(R.color.deposit_green));
} else {
tvExpiryStatus.setText(getResources().getString(R.string.expired));
tvExpiryStatus.setTextColor(getResources().getColor(R.color.red_dark));
}
}
}
47 changes: 33 additions & 14 deletions app/src/main/res/layout/fragment_form_identification_details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,42 @@
android:layout_width="match_parent"/>
</com.google.android.material.textfield.TextInputLayout>

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/til_expiration_date"
android:layout_height="wrap_content"
<LinearLayout
android:layout_width="match_parent"
app:errorEnabled="true">
android:layout_height="wrap_content"
android:orientation="horizontal">

<EditText
android:drawableLeft="@drawable/ic_event_black_24dp"
android:drawablePadding="@dimen/layout_padding_16dp"
android:drawableStart="@drawable/ic_event_black_24dp"
android:hint="@string/required_expiration_date"
android:id="@+id/et_expiration_date"
android:inputType="date"
android:focusable="false"
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/til_expiration_date"
android:layout_height="wrap_content"
android:layout_width="match_parent"/>
</com.google.android.material.textfield.TextInputLayout>
android:layout_width="match_parent"
app:errorEnabled="true"
android:layout_weight="0.5">

<EditText
android:drawableLeft="@drawable/ic_event_black_24dp"
android:drawablePadding="@dimen/layout_padding_16dp"
android:drawableStart="@drawable/ic_event_black_24dp"
android:hint="@string/required_expiration_date"
android:id="@+id/et_expiration_date"
android:inputType="date"
android:focusable="false"
android:layout_height="wrap_content"
android:layout_width="match_parent" />
</com.google.android.material.textfield.TextInputLayout>

<TextView
android:id="@+id/tv_expiration_status_for_create"
style="@style/Base.TextAppearance.AppCompat.Small"
android:gravity="end|center_vertical"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_weight="0.5"
android:paddingEnd="@dimen/layout_padding_16dp"
android:paddingStart="@dimen/layout_padding_16dp"
android:paddingRight="@dimen/layout_padding_16dp"
android:textStyle="bold"/>
</LinearLayout>

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/til_issuer"
Expand Down
14 changes: 12 additions & 2 deletions app/src/main/res/layout/fragment_identification_details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/layout_padding_8dp"
android:layout_marginStart="@dimen/layout_padding_8dp"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:orientation="vertical">

<TextView
Expand All @@ -140,7 +140,17 @@

</LinearLayout>


<TextView
android:id="@+id/tv_expiration_status_for_details"
style="@style/Base.TextAppearance.AppCompat.Small"
android:gravity="end|center_vertical"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_weight="1"
android:paddingEnd="@dimen/layout_padding_16dp"
android:paddingStart="@dimen/layout_padding_16dp"
android:paddingRight="@dimen/layout_padding_16dp"
android:textStyle="bold"/>
</LinearLayout>

<View
Expand Down
32 changes: 24 additions & 8 deletions app/src/main/res/layout/item_identification.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,30 @@

</LinearLayout>

<TextView
style="@style/Base.TextAppearance.AppCompat.Small"
android:id="@+id/tv_identification_issuer"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:paddingTop="@dimen/layout_padding_4dp"
android:textColor="@color/gray_dark"
tools:text="Issuer: Government"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">

<TextView
style="@style/Base.TextAppearance.AppCompat.Small"
android:id="@+id/tv_identification_issuer"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:paddingTop="@dimen/layout_padding_4dp"
android:textColor="@color/gray_dark"
tools:text="Issuer: Government"/>

<TextView
android:id="@+id/tv_expiration_status"
style="@style/Base.TextAppearance.AppCompat.Small"
android:gravity="end"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:paddingEnd="@dimen/layout_padding_16dp"
android:paddingStart="@dimen/layout_padding_16dp"
android:paddingRight="@dimen/layout_padding_16dp"
android:textStyle="bold"/>
</LinearLayout>

<View
android:layout_width="wrap_content"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-ml-rIN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@
<string name="pending">തീരുമാനിക്കപ്പെടാത്ത</string>
<string name="locked">തടഞ്ഞു</string>
<string name="closed">അടച്ചു</string>
<string name="expired">കാലഹരണപ്പെട്ടു</string>
<string name="error_tenant_identifier_required">കുടിയാൻ ഐഡന്റിഫയർ ആവശ്യമാണ്</string>
<string name="error_username_required">ഉപയോക്തൃനാമം ആവശ്യമാണ്</string>
<string name="error_password_required">പാസ്വേഡ് ആവശ്യമാണ്</string>
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,9 @@
<string name="locked">LOCKED</string>
<string name="closed">CLOSED</string>

<!--Identification Card status-->
<string name="expired">Expired</string>

<!-- Review Screen Count-->
<string name="one">1</string>
<string name="two">2</string>
Expand Down