{% extends "base.html" %} {% block content %}

Loan Admin Dashboard

Pending Approvals
{{ metrics.pending_count or 0 }}
Total Outstanding
₹{{ metrics.total_outstanding or 0 }}
This Month EMI
₹{{ metrics.month_emi_total or 0 }}
Overdue EMIs
{{ metrics.overdue_emi_count or 0 }}
Active Loan Summary Employee-wise snapshot (amount, paid, outstanding, next due, overdue)
{% if summary_rows %} {% for r in summary_rows %} {% set st = (r.status or '')|lower %} {% endfor %} {% else %} {% endif %}
# Employee Department Loan Type Status Amount EMI Paid Outstanding Next Due Overdue Action
{{ loop.index }}
{{ r.employee_name }}
{{ r.employee_code or '' }}
{{ r.department_name or '-' }} {{ r.loan_type or '-' }} {% if st in ['requested','under_review'] %} Pending {% elif st in ['approved','active'] %} Active {% elif st == 'closed' %} Closed {% elif st == 'rejected' %} Rejected {% elif st == 'cancelled' %} Cancelled {% else %} {{ r.status or '-' }} {% endif %} ₹{{ "%.2f"|format(r.amount or 0) }} ₹{{ "%.2f"|format(r.emi or 0) }} ₹{{ "%.2f"|format(r.total_paid or 0) }} ₹{{ "%.2f"|format(r.outstanding or 0) }} {% if r.next_due_date %} {{ r.next_due_date.strftime("%d-%m-%Y") }} {% else %} - {% endif %} {% if r.overdue_count and r.overdue_count > 0 %} {{ r.overdue_count }} {% else %} 0 {% endif %} View
No active loans found.
Pending Loan Approvals {# ✅ FIXED: real statuses + keep other filters #}
{% if pending_loans %} {% for loan in pending_loans %} {% set display_amount = loan.sanctioned_amount if loan.sanctioned_amount is not none else loan.requested_amount %} {% endfor %} {% else %} {% endif %}
# Employee Loan Type Amount Applied On
{{ loop.index }}
{{ loan.employee.full_name }}
{{ loan.employee.employee_code }} {% if loan.employee.department %} · {{ loan.employee.department.name }} {% endif %}
{{ loan.display_loan_type or loan.loan_type or "-" }} ₹{{ "%.2f"|format(display_amount or 0) }} {{ loan.requested_on.strftime("%d-%m-%Y") if loan.requested_on else "-" }} Review
No pending approvals.
Quick Filters
Recent Loan Activity
{% if recent_loans %} {% for loan in recent_loans %} {% set display_amount = loan.sanctioned_amount if loan.sanctioned_amount is not none else loan.requested_amount %}
{{ loan.employee.full_name }}
{{ loan.display_loan_type or loan.loan_type or "Loan" }} · ₹{{ "%.2f"|format(display_amount or 0) }}
{{ loan.requested_on.strftime("%d-%m-%Y") if loan.requested_on else "-" }} {% set st = (loan.status or '').lower() %} {% if st in ['requested','under_review'] %} Pending {% elif st in ['approved','active'] %} Approved / Active {% elif st == 'rejected' %} Rejected {% elif st == 'closed' %} Closed {% endif %}
{% endfor %} {% else %}
No recent activity.
{% endif %}
{# NEW ROW: Skip EMI + Extra Payment Requests #}
Skip EMI Requests
{% if skip_requests %} {% for r in skip_requests %} {% endfor %} {% else %} {% endif %}
# Employee EMI Month Amount Reason Actions
{{ loop.index }}
{{ r.loan.employee.full_name }}
{{ r.loan.employee.employee_code }}
{{ r.request_month.strftime("%b %Y") if r.request_month else "-" }} ₹{{ "%.2f"|format(r.emi.amount if r.emi and r.emi.amount else 0) }} {{ r.reason or "-" }}
{% if csrf_token is defined %}{{ csrf_token() }}{% endif %}
{% if csrf_token is defined %}{{ csrf_token() }}{% endif %}
No pending skip EMI requests.
Extra / Manual Payment Requests
{% if extra_pay_requests %} {% for r in extra_pay_requests %} {% endfor %} {% else %} {% endif %}
# Employee Amount Mode / Ref Actions
{{ loop.index }}
{{ r.loan.employee.full_name }}
{{ r.loan.employee.employee_code }}
₹{{ "%.2f"|format(r.amount or 0) }} {{ r.payment_mode or "-" }}
{{ r.payment_ref or "" }}
{% if csrf_token is defined %}{{ csrf_token() }}{% endif %}
{% if csrf_token is defined %}{{ csrf_token() }}{% endif %}
No pending extra payment requests.
{% endblock %}