{% extends 'base.html' %} {% load humanize %} {% load utils_filters %} {% block title %}Approve Loan Application - Haven Grazuri Investment Limited{% endblock %} {% block content %}
{% if application.borrower.status != 'active' %}
⚠️

Client Status Warning

This client is currently marked as {{ application.borrower.get_status_display }}. {% if application.borrower.status == 'blacklisted' %} Blacklisted clients cannot receive loan approvals. {% elif application.borrower.status == 'suspended' %} Suspended clients cannot receive loan approvals. {% elif application.borrower.status == 'inactive' %} Inactive clients cannot receive loan approvals. {% endif %}

{% endif %}

Loan Application Review

Application #{{ application.application_number }}

{{ application.get_status_display }} {% if application.auto_approved %} Auto-Approved {% endif %}

👤 Borrower Information

Full Name
{{ application.borrower.get_full_name }}
Phone Number
{{ application.borrower.phone_number }}
Email
{{ application.borrower.email }}
Business Name
{{ application.borrower.business_name|default:"-" }}
Credit Score
{% if application.credit_score %} {{ application.credit_score }} {% else %} Not Available {% endif %}
Previous Loans
{{ application.borrower.loans.count }} {% with defaulted=defaulted_loans %} {% if defaulted > 0 %} ({{ defaulted }} defaulted) {% endif %} {% endwith %}

Loan Details (Editable)

KES
KES
KES
KES

📄 Supporting Documents

{% if application.supporting_documents %}
{% for document in application.supporting_documents.all %}
📄

{{ document.filename }}

{{ document.file.size|filesizeformat }}

⬇️ View
{% endfor %}
{% else %}

No supporting documents provided

{% endif %}

📈 Risk Assessment

Credit Score Rating
{% if application.credit_score %}
{% if application.credit_score >= 700 %}
Excellent ({{ application.credit_score }}) {% elif application.credit_score >= 600 %}
⚠️
Fair ({{ application.credit_score }}) {% else %}
Poor ({{ application.credit_score }}) {% endif %}
{% else %} Not Available {% endif %}
Payment History
{% with total_loans=application.borrower.loans.count %} {% with paid_loans=paid_loans %} {% if total_loans > 0 %}
{% if paid_loans == total_loans %}
Perfect Payment History {% elif paid_loans >= total_loans|multiply:0.7 %}
⚠️
Good Payment History {% else %}
Poor Payment History {% endif %}
{% else %} No Previous Loans {% endif %} {% endwith %} {% endwith %}
Debt-to-Income Ratio
{% if application.borrower.monthly_income %} {% with dti_ratio=application.total_amount|divide:application.borrower.monthly_income|multiply:100 %}
{% if dti_ratio <= 40 %}
Good ({{ dti_ratio|floatformat:1 }}%) {% elif dti_ratio <= 50 %}
⚠️
Fair ({{ dti_ratio|floatformat:1 }}%) {% else %}
High ({{ dti_ratio|floatformat:1 }}%) {% endif %}
{% endwith %} {% else %} Monthly income not provided {% endif %}
Risk Level
{% with risk_score=application.calculate_risk_score %}
{% if risk_score >= 80 %}
Low Risk {% elif risk_score >= 60 %}
Medium Risk {% else %}
High Risk {% endif %}
{% endwith %}

Previous Loans & Repayment History

Total Loans
{{ previous_loans|length|default:0 }}
Active Loans
{{ active_loans_count|default:0 }}
Completed
{{ completed_loans_count|default:0 }}
Total Borrowed
KES {{ total_borrowed|floatformat:0|default:"0"|intcomma }}
Total Repaid
KES {{ total_repaid|floatformat:0|default:"0"|intcomma }}
{% if previous_loans %}
{% for loan in previous_loans %} {% endfor %}
Loan Number Amount Disbursed Total Repaid Outstanding Status Repayment
{{ loan.loan_number }} KES {{ loan.principal_amount|floatformat:2|intcomma }} {{ loan.disbursement_date|date:"Y-m-d" }} KES {{ loan.amount_paid|floatformat:2|intcomma }} KES {{ loan.outstanding_amount|floatformat:2|intcomma }} {% if loan.status == 'active' %} Active {% elif loan.status == 'paid' %} Paid {% elif loan.status == 'defaulted' %} Defaulted {% else %} {{ loan.status|title }} {% endif %} {% if loan.status == 'paid' %} 100% {% elif loan.status == 'active' %} {{ loan.repayment_percentage|default:"0" }}% {% elif loan.status == 'defaulted' %} {{ loan.repayment_percentage|default:"0" }}% {% else %} {{ loan.repayment_percentage|default:"0" }}% {% endif %}
{% else %}
📥

No previous loan history

This will be the borrower's first loan

{% endif %}
{% csrf_token %}

Select the actual date when the loan was/will be disbursed

Cancel {% if application.borrower.status == 'active' %} {% else %} {% endif %}
{% endblock %}