{% extends 'base.html' %}
{% block title %}Apply Discount to Student - Rapha-Bethel BNPS{% endblock %}
{% block content %}
<div class="container-fluid">
    <div class="d-flex justify-content-between align-items-center mb-4">
        <h1 class="h3 mb-0">Apply Discount to Student</h1>
        <a href="{% url 'finance:discount_list' %}" class="btn btn-outline-secondary"><i class="fas fa-arrow-left me-2"></i>Back</a>
    </div>
    <div class="row justify-content-center">
        <div class="col-md-7">
            <div class="card shadow">
                <div class="card-header py-3 bg-warning text-dark"><h6 class="m-0"><i class="fas fa-user-tag me-2"></i>Student Discount Application</h6></div>
                <div class="card-body">
                    <form method="post">
                        {% csrf_token %}
                        {% if form.errors %}<div class="alert alert-danger">Please correct the errors below.</div>{% endif %}
                        <div class="mb-3"><label class="form-label fw-bold">Student <span class="text-danger">*</span></label>{{ form.student }}</div>
                        <div class="mb-3"><label class="form-label fw-bold">Discount <span class="text-danger">*</span></label>{{ form.discount }}</div>
                        <div class="row mb-3">
                            <div class="col-md-6"><label class="form-label fw-bold">Academic Year</label>{{ form.academic_year }}</div>
                            <div class="col-md-6"><label class="form-label fw-bold">Term</label>{{ form.term }}</div>
                        </div>
                        <div class="mb-3"><label class="form-label fw-bold">Reason</label>{{ form.reason }}</div>
                        <div class="d-flex justify-content-end gap-2 mt-4">
                            <a href="{% url 'finance:discount_list' %}" class="btn btn-secondary">Cancel</a>
                            <button type="submit" class="btn btn-warning text-dark"><i class="fas fa-save me-2"></i>Apply Discount</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% block extra_js %}
<script>document.querySelectorAll('input:not(.form-check-input):not([type="submit"]), select, textarea').forEach(el => { el.classList.add(el.tagName === 'SELECT' ? 'form-select' : 'form-control'); });</script>
{% endblock %}
{% endblock %}
