{% extends 'base.html' %}

{% load static %}

{% load stud_tags %}

{% block content %}

<h2 class="text-center">Ближайшие события.</h2>
{{ request.user.last_login }}
{{ request.user.is_superuser }}
{{ request.user }}


{% comment %} <canvas class="my-4 w-100" id="myChart" width="900" height="380"></canvas> {% endcomment %}

{% for item in objects %}
<div class="row shadow p-2 rounded bg-body mt-2 border border-dark">
  <div class="text-center container">
    <h4 >
      <a href="{{ item.get_absolute_url }}" class="nav-link text-primary">Группа {{ item.title }}</a>
      <p>
        Осталось до выпуска - {{ item.graduation_date|timeuntil }}
      </p>
    </h4>
    {% get_cbg item.pk as contracts %}
    <div class="row">
      {% for item in contracts %}
      <div class="col-xxl-4 col-xl-6 col-lg-6 px-1 py-1">
        <div class="shadow-sm border py-1">
          <div class="row  border-danger mx-auto container-fluid p-0">

            <div class="col-md-3 border-info">
              <img src="
                {% if item.client.photo %}
                  {{ item.client.photo.url }}
                {% else %}
                  {% static 'img/blank.png' %}
                {% endif %}
              " class="img-fluid mx-auto d-block rounded shadow border" />
            </div>
            <div class="col-md-9 p-0 m-0">
              <a href=" {{ item.client.get_absolute_url }} " class=" fs-6 nav-link">{{ item.client.surname }} {{ item.client.name }} {{item.client.patronymic}} </a>
              <p>
                <a href=" {{ item.get_absolute_url }} " class=" fs-6 nav-link">Договор №{{ item.number }} </a>
              </p>              
              <p>
                {% if item.degree_work.title %}
                  "{{ item.degree_work.title }}" <br>
                  Руководитель - {{ item.degree_work.adviser }} <br>
                  {% comment %} Протокол - {{ item.degree_work.protocol }} {% endcomment %}
                {% endif %}
                </p>
            </div>
          </div>
        </div>
      </div>
      {% endfor %}
    </div>

  </div>

</div>
{% endfor %}

  

{% endblock content %}