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

Loan Approval – #{{ loan.id }}

{{ loan.display_loan_type or loan.loan_type or "Loan" }} · Employee: {{ loan.employee.full_name if loan.employee else "-" }}
{% set st = (loan.status or '').lower() %} {% if st in ['approved', 'active'] %} Approved / Active {% elif st in ['requested', 'pending', 'under_review'] %} Pending Approval {% elif st == 'rejected' %} Rejected {% elif st == 'closed' %} Closed {% else %} {{ loan.status or "Unknown" }} {% endif %} Back to Loan Dashboard
Loan Amount
₹{{ "%.2f"|format(loan_amount or 0) }}
Tenure
{{ tenure_months or "-" }} months
Monthly EMI
₹{{ "%.2f"|format(emi_amount or 0) }}
Outstanding
₹{{ "%.2f"|format(outstanding or 0) }}
Employee Details
{{ loan.employee.full_name if loan.employee else "-" }}
Code: {{ loan.employee.employee_code if loan.employee else "-" }}
Department: {{ loan.employee.department.name if loan.employee and loan.employee.department else "-" }}
Email: {{ loan.employee.email if loan.employee else "-" }}
Loan Request Details
Type
{{ loan.display_loan_type or loan.loan_type or "-" }}
Requested Amount
₹{{ "%.2f"|format(loan.requested_amount or 0) }}
Requested Tenure
{{ loan.requested_tenure_months or "-" }} months
Requested On
{{ loan.requested_on.strftime("%d-%b-%Y") if loan.requested_on else "-" }}
Start Month
{{ loan.start_month.strftime("%b %Y") if loan.start_month else "-" }}
{# NEW: Status + Approved By #}
Status
{{ (loan.status or "Unknown")|replace("_"," ")|title }}
Approved By
{{ loan.approved_by.full_name if loan.approved_by else "-" }}
{% if loan.reason %}
Reason:
{{ loan.reason }}
{% endif %}
Approve / Reject Loan
{{ csrf_token() if csrf_token is defined }}
{% set base_amt = loan.sanctioned_amount or loan.requested_amount %} {% set base_ten = loan.tenure_months or loan.requested_tenure_months %} {% if loan.emi_amount %} {% set base_emi = loan.emi_amount %} {% elif base_amt and base_ten %} {% set base_emi = base_amt / base_ten %} {% else %} {% set base_emi = '' %} {% endif %}
{% set start_val = '' %} {% if loan.start_month %} {% set start_val = loan.start_month.strftime('%Y-%m') %} {% elif loan.requested_on %} {% set start_val = loan.requested_on.strftime('%Y-%m') %} {% endif %}
You can adjust amount, tenure, and start month before approval. EMI schedule will be rebuilt automatically.
On approval, EMI schedule & disbursement transaction will be created automatically.
EMI Schedule
{% if emi_schedule %} {% for emi in emi_schedule %} {% set status = emi.status %} {% endfor %} {% else %} {% endif %}
# Month Due Date Amount (₹) Status
{{ loop.index }} {{ emi.month_label }} {{ emi.due_date_label }} ₹{{ "%.2f"|format(emi.amount or 0) }} {% if status == 'paid' or emi.paid %} Paid {% elif status == 'skipped' %} Skipped {% elif emi.is_overdue and status == 'pending' %} Overdue {% else %} Pending {% endif %}
EMI schedule will be created on approval.
Skip EMI Requests
{% if skip_requests %} {% for r in skip_requests %}
{{ r.request_month.strftime("%b %Y") if r.request_month else "-" }}
{% if r.status == 'approved' %} Approved {% elif r.status == 'rejected' %} Rejected {% else %} Pending {% endif %}
{% if r.reason %}
Reason: {{ r.reason }}
{% endif %} {% if r.remarks %}
HR Remarks: {{ r.remarks }}
{% endif %}
{% endfor %} {% else %}
No skip requests for this loan.
{% endif %}
Extra / Offline Payment Requests
{% if extra_payment_requests %} {% for r in extra_payment_requests %}
₹{{ "%.2f"|format(r.amount or 0) }} {% if r.payment_mode %} · {{ r.payment_mode }} {% endif %}
{% if r.status == 'approved' %} Approved {% elif r.status == 'rejected' %} Rejected {% else %} Pending {% endif %}
{% if r.payment_ref %}
Ref: {{ r.payment_ref }}
{% endif %} {% if r.remarks %}
HR Remarks: {{ r.remarks }}
{% endif %}
{% endfor %} {% else %}
No extra payment requests for this loan.
{% endif %}
{% if previous_loans %}
Previous Loans for this Employee
{% for row in previous_loans %} {% endfor %}
ID Type Amount (₹) Tenure Paid (₹) Outstanding (₹) Last EMI Paid
#{{ row.loan.id }} {{ row.loan.display_loan_type or row.loan.loan_type }} {{ "%.2f"|format(row.loan_amount or 0) }} {{ row.tenure_months or '-' }} {{ "%.2f"|format(row.paid_amount or 0) }} {{ "%.2f"|format(row.outstanding_amount or 0) }} {% if row.last_paid_emi_date %} {{ row.last_paid_emi_date.strftime('%d-%b-%Y') }} {% else %} – {% endif %}
{% endif %}
{% endblock %}