{% extends "generic/supervisor_base.html" %}
{% load crispy_forms_tags %}

{% block content %}
    <div class="row justify-content-center mt-3">
        <div class="col-12 col-md-8 col-lg-6">
            <div class="card border-secondary bg-dark text-white shadow-sm mb-4">
                <div class="card-body p-4">
                    <h2 class="card-title mb-3">
                        {% if object %}
                            Edit Supervisor
                        {% else %}
                            Create Supervisor
                        {% endif %}
                    </h2>
                    <p class="text-muted small mb-4">
                        Use this form to manage the supervisor account details. Trainees can be assigned to a supervisor by editing the trainee's profile.
                    </p>

                    {% if errors %}
                        <div class="alert alert-danger border-danger bg-dark text-danger" role="alert">
                            {{ errors }}
                        </div>
                    {% endif %}

                    <form action="" method="post" enctype="multipart/form-data" id="supervisor-form">
                        {% csrf_token %}
                        {{ form|crispy }}
                        <div class="mt-4 d-flex gap-2">
                            <button type="submit" class="btn btn-primary" name="submit">
                                <i class="bi bi-check-circle me-1"></i>Save changes
                            </button>
                            <a href="{% url 'generic:supervisor' %}" class="btn btn-outline-secondary">
                                Cancel
                            </a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
{% endblock %}