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

{% block title %}{{ student.user.get_full_name }} | Автошкола{% endblock %}

{% block content %}
<div class="container">
    <div class="row mb-4">
        <div class="col">
            <nav aria-label="breadcrumb">
                <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="{% url 'student:list' %}">Студенты</a></li>
                    <li class="breadcrumb-item active">{{ student.user.get_full_name }}</li>
                </ol>
            </nav>
        </div>
    </div>

    <div class="row">
        <div class="col-md-8">
            <div class="card shadow mb-4">
                <div class="card-header bg-primary text-white">
                    <h4 class="mb-0">Информация о студенте</h4>
                </div>
                <div class="card-body">
                    <h5 class="card-title">{{ student.user.get_full_name }}</h5>
                    <p class="card-text">
                        <i class="fas fa-envelope me-2"></i>{{ student.user.email }}<br>
                        <i class="fas fa-phone me-2"></i>{{ student.phone_number }}<br>
                        <i class="fas fa-calendar-alt me-2"></i>Дата регистрации: {{ student.user.date_joined|date:"d.m.Y" }}
                    </p>
                </div>
            </div>

            <div class="card shadow">
                <div class="card-header bg-success text-white">
                    <h4 class="mb-0">Записанные занятия</h4>
                </div>
                <div class="card-body">
                    {% if enrolled_lessons %}
                        <div class="list-group">
                            {% for lesson in enrolled_lessons %}
                                <a href="{% url 'schedule:detail' lesson.pk %}" class="list-group-item list-group-item-action">
                                    <div class="d-flex w-100 justify-content-between">
                                        <h5 class="mb-1">{{ lesson.course.title }}</h5>
                                        <small>{{ lesson.date|date:"d.m.Y" }} {{ lesson.start_time|time:"H:i" }}</small>
                                    </div>
                                    <p class="mb-1">
                                        <i class="fas fa-user me-2"></i>{{ lesson.instructor.user.get_full_name }}<br>
                                        <i class="fas fa-map-marker-alt me-2"></i>{{ lesson.location }}
                                    </p>
                                </a>
                            {% endfor %}
                        </div>
                    {% else %}
                        <div class="alert alert-info">
                            <i class="fas fa-info-circle me-2"></i>Студент еще не записан ни на одно занятие.
                        </div>
                    {% endif %}
                </div>
            </div>
        </div>

        <div class="col-md-4">
            <div class="card shadow">
                <div class="card-body">
                    <a href="{% url 'student:schedule' student.pk %}" class="btn btn-success w-100 mb-2">
                        <i class="fas fa-calendar-alt me-2"></i>Расписание занятий
                    </a>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %} 