{% extends 'base.html' %}

{% load static %}

{% block title %} 
  {{ block.super }} {{title}}
{% endblock title %} 

{% block content %}
    <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>
          </tr>
        </thead>
        <tbody class="text-center">
          {% for item in objects %}
          <tr>
            <td class="text-end align-item-bottom">{{ forloop.counter }}.</td>
            <td><a href=" {{item.get_absolute_url}}">{{ item.number}}</a></td>
            <td>
              <a href="{{item.client.get_absolute_url}}">{{item.client}}</a>
              {% if item.customer %}
              <br> Заказчик:
              <a href="{{item.customer.get_absolute_url}}">{{item.customer}}</a>
              {% endif %}
            </td>
            <td>{{item.agreement_date|date:"SHORT_DATE_FORMAT"}}</td>
            <td>с {{item.start_date|date:"SHORT_DATE_FORMAT"}} по {{item.end_date|date:"SHORT_DATE_FORMAT"}}</td>
            <td><a href=" {{item.group.get_absolute_url}}">{{ item.group }}</a></td>
            {% if item.scan %}
              <td><a href="{{ item.scan.url }}" target="_blank"><span data-feather="file-text" class="align-text-bottom"></span></a></td>
            {% else %}
              <td></td>
            {% endif %}
          </tr>
          {% endfor %}
        </tbody>
      </table>
      
      <div class="row ">
        <div class="col text-center p-1">
            {% comment %} <a href="{% url 'order' object.pk %}" class="btn btn-outline-primary btn-block" target="_blank">Распечатать</a> {% endcomment %}
        </div>
        <div class="col text-center p-1">
            <a href="{{ object.gen_absolute_url }}" class="btn btn-outline-primary btn-block">Сохранить</a>
        </div>
      </div>
    </div>



{% endblock content %}


