{% extends 'base.html' %} 

{% load static %}
{% load stud_tags %}

{% block title %} 
  {{ block.super }} {{title}}
{% endblock title %} Студенты

{% block content %}
     {% comment %} <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
      <h1 class="h2">Dashboard</h1>
      <div class="btn-toolbar mb-2 mb-md-0">
        <div class="btn-group me-2">
          <button type="button" class="btn btn-sm btn-outline-secondary">Share</button>
          <button type="button" class="btn btn-sm btn-outline-secondary">Export</button>
        </div>
        <button type="button" class="btn btn-sm btn-outline-secondary dropdown-toggle">
          <span data-feather="calendar" class="align-text-bottom"></span>
          This week
        </button>
      </div>
    </div> {% endcomment %}

    <h2 class="text-center">{{t_title}}:</h2>
    <div class="table-responsive">
      <table class="table table-striped table-sm table-hover table-bordered">
        <thead class="text-center table-secondary">
          <tr>
            <th scope="col" class="text-end">№</th>
            <th scope="col">Фото</th>
            <th scope="col">ФИО</th>
            <th scope="col">Пол</th>
            <th scope="col">Телефон</th>
            <th scope="col">Обучается</th>
            <th scope="col">Возраст</th>
            <th scope="col">Тема ВКР</th>
          </tr>
        </thead>
        <tbody class="text-center">
          {% for item in objects %}
          <tr class="align-middle">
            <td class="text-end align-item-bottom">{{ forloop.counter }}.</td>
            <td>
              {% if item.client.photo %}
              <img src="{{ item.client.photo.url }}" height="75" />
              {% else %}
              <img src="{% static 'img/blank.png' %}" height="75" />
              {% endif %}
            </td>
            <td><a href=" {{ item.client.get_absolute_url }} ">{{ item.client.surname }} {{ item.client.name }} {{item.client.patronymic}}</a></td>
            <td>{{item.client.gender}}</td>
            <td>{{item.client.phone}}</td>
            <td> 
              <a href=" {{ item.get_absolute_url }} ">{{ item.number }} </a> <br>
              с {{item.start_date|date:"SHORT_DATE_FORMAT"}} по {{item.end_date|date:"SHORT_DATE_FORMAT"}} 
            </td>
            <td>{{ item.client.birthdate|timesince }}</td>
            <td>{{ item.degree_work.title }}</td>
          </tr>
          {% endfor %}
        </tbody>
      </table>
    </div>
    <div class="row container-fluid pt-2 pb-4">
      <div class="col-1"></div>
      <div class="col-4 mx-auto d-grid">
          <a href="{% url 'gen_list_students' group_id=group_id %}" class="btn btn-primary"> Список #доделать#</a>
      </div>
      <div class="col-2"></div>
      <div class="col-4 mx-auto d-grid">
          <a href="{% url 'gen_list_sdo' group_id=group_id %}" class="btn btn-primary">Список для SDO</a>        
      </div>
      <div class="col-1"></div>
    </div>
{% endblock content %}

