in app/src/main/java/org/apache/fineract/ui/online/loanaccounts/loandetails/CustomerLoanDetailsFragment.java [164:247]
public void showLoanAccountDetails(LoanAccount loanAccount) {
this.loanAccount = loanAccount;
ncvCustomerLoanDetails.setVisibility(View.VISIBLE);
layoutError.setVisibility(View.GONE);
setToolbarTitle(loanAccount.getIdentifier());
tvPaymentAmount.setText(
String.valueOf(loanAccount.getLoanParameters().getMaximumBalance()));
String term = loanAccount.getLoanParameters().getTermRange().getMaximum() + " " +
loanAccount.getLoanParameters().getTermRange().getTemporalUnit();
tvTerm.setText(term);
PaymentCycle paymentCycle = loanAccount.getLoanParameters().getPaymentCycle();
LoanAccount.RepayUnitType repayUnitType =
LoanAccount.RepayUnitType.valueOf(paymentCycle.getTemporalUnit());
switch (repayUnitType) {
case WEEKS:
tvPaymentCycle.setText(
getString(R.string.payment_cycle_week, paymentCycle.getPeriod(),
paymentCycle.getTemporalUnit().toLowerCase(),
weeksName[paymentCycle.getAlignmentDay()]));
break;
case MONTHS:
if (paymentCycle.getAlignmentWeek() == null) {
tvPaymentCycle.setText(
getString(R.string.payment_cycle_month_day, paymentCycle.getPeriod(),
paymentCycle.getTemporalUnit().toLowerCase(),
repayOnMonths[paymentCycle.getAlignmentDay()]));
} else {
tvPaymentCycle.setText(
getString(R.string.payment_cycle_month_day_week,
paymentCycle.getPeriod(),
paymentCycle.getTemporalUnit().toLowerCase(),
timeSlots[paymentCycle.getAlignmentWeek()],
weeksName[paymentCycle.getAlignmentDay()]));
}
break;
case YEARS:
if (paymentCycle.getAlignmentWeek() == null) {
tvPaymentCycle.setText(
getString(R.string.payment_cycle_month_day, paymentCycle.getPeriod(),
paymentCycle.getTemporalUnit().toLowerCase(),
repayOnMonths[paymentCycle.getAlignmentDay()]));
} else {
tvPaymentCycle.setText(
getString(R.string.payment_cycle_year_day_week,
paymentCycle.getPeriod(),
paymentCycle.getTemporalUnit().toLowerCase(),
timeSlots[paymentCycle.getAlignmentWeek()],
weeksName[paymentCycle.getAlignmentDay()],
monthsName[paymentCycle.getAlignmentMonth()]));
}
break;
}
tvLoanCurrentStatus.setText(loanAccount.getCurrentState().name());
StatusUtils.setLoanAccountStatusIcon(loanAccount.getCurrentState(),
ivLoanCurrentStatus, getActivity());
if (loanAccount.getCurrentState() == LoanAccount.State.APPROVED) {
clAlertMessage.setVisibility(View.VISIBLE);
tvAlertText1.setText(getString(R.string.customer_loan_approved));
tvAlertText2.setText(getString(R.string.to_activate_loan_disburse));
}
if (loanAccount.getAccountAssignments().size() != 0) {
tvCustomerDepositAccount.setText(
loanAccount.getAccountAssignments().get(0).getAccountIdentifier());
} else {
tvCustomerDepositAccount.setText(R.string.no_deposit_account);
}
tvCreatedBy.setText(getString(R.string.loan_created_by, loanAccount.getCreatedBy(),
DateUtils.getDateTime(loanAccount.getCreatedOn())));
tvLastModifiedBy.setText(getString(R.string.loan_last_modified_by,
loanAccount.getLastModifiedBy(),
DateUtils.getDateTime(loanAccount.getLastModifiedOn())));
if (loanAccount.getCurrentState() == LoanAccount.State.APPROVED ||
loanAccount.getCurrentState() == LoanAccount.State.CLOSED) {
hideEditMenu(menu);
}
}