{% extends 'base.html' %}
{% load humanize %}

{% block title %}Reject Loan Application - Haven Grazuri Investment Limited{% endblock %}

{% block content %}
<div class="max-w-3xl mx-auto py-8">
    <div class="bg-white shadow sm:rounded-lg">
        <div class="px-4 py-5 sm:p-6">
            <h3 class="text-lg font-medium leading-6 text-gray-900">Reject Loan Application</h3>
            <div class="mt-2 max-w-xl text-sm text-gray-500">
                <p>You are about to reject the loan application for {{ application.borrower.get_full_name }}.</p>
                <div class="mt-4">
                    <p><strong>Application Details:</strong></p>
                    <ul class="mt-2 list-disc list-inside">
                        <li>Application Number: {{ application.application_number }}</li>
                        <li>Requested Amount: KES {{ application.requested_amount|floatformat:2 }}</li>
                        <li>Product Type: {{ application.loan_product.get_product_type_display }}</li>
                        <li>Submitted: {{ application.submitted_at|date:"Y-m-d H:i" }}</li>
                    </ul>
                </div>
            </div>

            <form method="post" class="mt-5">
                {% csrf_token %}
                <div class="mb-4">
                    <label for="rejection_reason" class="block text-sm font-medium text-gray-700">Rejection Reason</label>
                    <div class="mt-1">
                        <textarea
                            id="rejection_reason"
                            name="rejection_reason"
                            rows="3"
                            class="shadow-sm block w-full sm:text-sm border-gray-300 rounded-md"
                            placeholder="Please provide a reason for rejecting this application"
                            required
                        ></textarea>
                    </div>
                </div>

                <div class="mt-5 flex justify-end gap-3">
                    <a href="{% url 'loans:loans' %}" 
                       class="inline-flex items-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50">
                        Cancel
                    </a>
                    <button type="submit"
                            class="inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-red-600 hover:bg-red-700">
                        Reject Application
                    </button>
                </div>
            </form>
        </div>
    </div>
</div>
{% endblock %} 