{% extends 'base/base.html' %}

{% load static %}

{% block title %}{{ pagename }}{% endblock %}

{% block heading %}Управление правами{% endblock %}

{% block extra_css %}
<link rel="stylesheet" href="{% static 'main/css/work.css' %}" xmlns="http://www.w3.org/1999/html">
<link rel="stylesheet" href="{% static 'modules/notifications/dist/notifications.css' %}">
{% endblock %}
{% block extra_scripts %}
<script src="{% static 'modules/notifications/dist/notifications.js' %}"></script>
<script src="{% static 'main/js/notifications.js' %}"></script>
{% endblock %}

{% block content %}

<p class="row page-description">Свободных Мест: {{ licences_remaining }}</p>

<div class="row justify-content-center new-section">
  <div class="col-10 py-3">
    <h3 class="py-4 text-center font-weight-bold">Список сотрудников с правами инженера</h3>
    <table class="table table-dark">
      <thead>
      <th>Email</th>
      <th>Name</th>
      </thead>
      <tbody>
      {% for engineer in engineers %}
      <tr>
        <td>{{ engineer.email }}</td>
        <td>{{ engineer.name }}</td>
      </tr>
      {% endfor %}
      </tbody>
    </table>
  </div>
</div>
<div class="row justify-content-center new-section">
  <div class="col-5">
    <div class="info">
      <div class="info-row">
        <div class="info-target px-4"><h6>инженеров:</h6></div>
        <div class="info-quantity">
          <div class="status-circle-small light-green"></div>
          <span class="info-quantity-value">{{ engineers|length }}</span>
        </div>
      </div>
      <div class="info-row">
        <div class="info-target px-4"><h6>легких агентов:</h6></div>
        <div class="info-quantity">
          <div class="status-circle-small light-yellow"></div>
          <span class="info-quantity-value">{{ agents|length }}</span>
        </div>

      </div>
    </div>
  </div>
  <div class="col-5 mb-3 py-1">
    <div class="row mb-2">
      <div class="col">
        <a href="/work/become_engineer" class="btn btn-success btn-block py-3">Получить права инженера</a>
      </div>
    </div>
    <div class="row mb-2 py-1">
      <div class="col">
        <a href="/work/hand_over" class="btn  btn-danger btn-block py-3">Сдать права инженера</a>
      </div>
    </div>

    <form class="row g-3 align-items-center" method="GET" action="/work/get_tickets">
      <div class="col-2">
        <input class="form-control" type="number" min="1" value="1" name="count_tickets">
      </div>
      <div class="col-10">
        <button type="submit" class="btn default-button btn-warning btn-block btn-sm py-3">Взять тикеты в работу</button>
      </div>
    </form>
  </div>
</div>

{% for message in messages %}
<script>create_notification('{{message}}','','{{message.tags}}',5000)</script>
{% endfor %}
{% endblock %}

