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

{% block title %}Расписание {{ instructor.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 'instructor:list' %}">Инструкторы</a></li>
                    <li class="breadcrumb-item"><a href="{% url 'instructor:detail' instructor.pk %}">{{ instructor.user.get_full_name }}</a></li>
                    <li class="breadcrumb-item active">Расписание</li>
                </ol>
            </nav>
        </div>
    </div>

    <div class="row">
        <div class="col">
            <div class="card shadow">
                <div class="card-header bg-success text-white">
                    <h4 class="mb-0">
                        <i class="fas fa-calendar-alt me-2"></i>Расписание занятий
                    </h4>
                </div>
                <div class="card-body">
                    {% if lessons %}
                        <div class="table-responsive">
                            <table class="table table-hover">
                                <thead>
                                    <tr>
                                        <th>Дата</th>
                                        <th>Время</th>
                                        <th>Курс</th>
                                        <th>Место</th>
                                        <th>Студенты</th>
                                        <th>Действия</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    {% for lesson in lessons %}
                                        <tr>
                                            <td>{{ lesson.date|date:"d.m.Y" }}</td>
                                            <td>{{ lesson.start_time|time:"H:i" }} - {{ lesson.end_time|time:"H:i" }}</td>
                                            <td>{{ lesson.course.title }}</td>
                                            <td>{{ lesson.location }}</td>
                                            <td>{{ lesson.enrolled_students.count }}</td>
                                            <td>
                                                <a href="{% url 'schedule:detail' lesson.pk %}" class="btn btn-sm btn-primary">
                                                    <i class="fas fa-info-circle"></i>
                                                </a>
                                            </td>
                                        </tr>
                                    {% endfor %}
                                </tbody>
                            </table>
                        </div>
                    {% else %}
                        <div class="alert alert-info">
                            <i class="fas fa-info-circle me-2"></i>У инструктора пока нет запланированных занятий.
                        </div>
                    {% endif %}
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %} 