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

{% block js %}
    {{ form.media }}
{% endblock %}

{% block content %}
<div class="container py-4">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card shadow-sm border border-secondary border-opacity-20">
                <div class="card-header bg-primary text-white py-3">
                    <h4 class="mb-0"><i class="bi bi-person-plus me-2"></i>Create Trainee</h4>
                </div>
                <div class="card-body p-4">
                    <p class="text-muted mb-4">Use this form to create a user. Only existing supervisors can be added (if they don't exist, <a href="{% url 'generic:supervisor_create' %}" class="fw-bold">create them first</a> and refresh this page or add them later).</p>
                    
                    {% if errors %}
                        <div class="alert alert-danger" role="alert">
                            <i class="bi bi-exclamation-triangle-fill me-2"></i>{{ errors }}
                        </div>
                    {% endif %}
                    
                    <form action="" method="post" enctype="multipart/form-data" id="condition-form">
                        {% csrf_token %}
                        {{ form|crispy }}
                        <div class="mt-4 d-flex justify-content-between">
                            <a href="{% url 'accounts_list' %}" class="btn btn-outline-secondary">
                                <i class="bi bi-x-lg me-1"></i>Cancel
                            </a>
                            <button type="submit" class="btn btn-primary px-4">
                                <i class="bi bi-check-lg me-1"></i>Create Trainee
                            </button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}