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

{% block title %}Reject Expense - HAVEN GRAZURI ADVANCE{% endblock %}

{% block content %}
<div class="max-w-2xl mx-auto">
    <div class="mb-6">
        <a href="{% url 'expenses:expense_detail' expense.pk %}" class="inline-flex items-center text-sm text-gray-500 hover:text-gray-700">
            <span>←</span> Back to Expense
        </a>
    </div>

    <div class="bg-white shadow-lg rounded-lg overflow-hidden">
        <div class="px-6 py-4 bg-red-600 border-b border-gray-200">
            <h2 class="text-xl font-semibold text-white">
                <span>✕</span> Reject Expense
            </h2>
        </div>

        <div class="px-6 py-6">
            <div class="mb-6">
                <p class="text-sm text-gray-600 mb-4">
                    You are about to reject the following expense:
                </p>
                
                <div class="bg-gray-50 rounded-lg p-4 space-y-3 mb-6">
                    <div class="flex justify-between">
                        <span class="text-sm font-medium text-gray-500">Title:</span>
                        <span class="text-sm text-gray-900">{{ expense.title }}</span>
                    </div>
                    <div class="flex justify-between">
                        <span class="text-sm font-medium text-gray-500">Amount:</span>
                        <span class="text-sm font-bold text-gray-900">KES {{ expense.amount|floatformat:2|intcomma }}</span>
                    </div>
                    <div class="flex justify-between">
                        <span class="text-sm font-medium text-gray-500">Requested By:</span>
                        <span class="text-sm text-gray-900">{{ expense.staff.get_full_name }}</span>
                    </div>
                </div>

                <form method="post">
                    {% csrf_token %}
                    <div class="mb-4">
                        <label for="reason" class="block text-sm font-medium text-gray-700 mb-2">
                            Reason for Rejection <span class="text-red-500">*</span>
                        </label>
                        <textarea 
                            name="reason" 
                            id="reason" 
                            rows="4" 
                            required
                            class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-red-500 focus:ring-red-500 sm:text-sm"
                            placeholder="Please provide a reason for rejecting this expense..."></textarea>
                    </div>

                    <div class="flex items-center justify-end gap-x-4">
                        <a href="{% url 'expenses:expense_detail' expense.pk %}" class="rounded-md bg-white px-4 py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50">
                            Cancel
                        </a>
                        <button type="submit" class="rounded-md bg-red-600 px-4 py-2 text-sm font-semibold text-white shadow-sm hover:bg-red-700">
                            <span>✕</span> Confirm Rejection
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{% endblock %}
