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

{% block title %}Container: {{ container.named_id }}{% endblock %}

{% block content %}
<div class="container">
  {% if container_list %}
      <table class="table table-striped table-hover">
          <thead>
              <tr>
                  <th scope="col">Container</th>
                  <th scope="col">Type</th>
                  <th scope="col">Size (mm)</th>
                  <th scope="col">Cover</th>
                  <th scope="col">Color</th>
                  <th scope="col">Description</th>
                  <th scope="col">Changed</th>
                  <th scope="col">Action</th>
              </tr>
          </thead>
          <tbody>
              {% for container in container_list %}
                  <tr>
                      <td><a href="{% url 'container:update' container.id %}"><div>{{ container.named_id }}</div></a></td>
                      <td><div>{{ container.container_type.named_id }}</div></td>
                      <td><div>{{ container.container_type.width }}x{{ container.container_type.length }}x{{ container.container_type.height }}</div></td>
                      <td><div>{% if container.container_type.has_cover %}yes{%else %}--{% endif %}</div></td>
                      <td><div>{{ container.color }}</div></td>
                      <td><div>{{ container.description }}</div></td>
                      <td><div>{{ container.changed_ts | date:'H:i:s d.m.Y' }}</div></td>
                      <td>
                          <a class="btn btn-outline-primary btn-sm" href="{% url 'container:delete' container.id %}" role="button">Delete</a>
                          <a class="btn btn-outline-primary btn-sm" href="{% url 'container:detail' container.id %}" role="button">View</a>
                          <a class="btn btn-outline-primary btn-sm" href="{% url 'container:print_label' container.id %}" role="button">Label</a>
                      </td>
                  </tr>
              {% endfor %}
          </tbody>
      </table>
      <nav aria-label="Page navigation">
          <ul class="pagination">
            {% if page_obj.has_previous %}
                <li class="page-item"><a class="page-link" href="?page={{ page_obj.previous_page_number }}">previous</a></li>
            {% else %}
                <li class="page-item disabled"><a class="page-link" href="#" aria-disabled="true">previous</a></li>
            {% endif %}
            <li class="page-item"><a class="page-link" href="?page=1">1 |&lt;&lt;</a></li>
            <li class="page-item disabled"><a class="page-link" href="#" aria-disabled="true">...</a></li>
            <li class="page-item"><a class="page-link" href="#" aria-disabled="true">{{ page_obj.number }}</a></li>
            <li class="page-item disabled"><a class="page-link" href="#" aria-disabled="true">...</a></li>
            <li class="page-item"><a class="page-link" href="?page={{ paginator.num_pages }}">&gt;&gt;| {{ paginator.num_pages }}</a></li>
            {% if page_obj.has_next %}
                <li class="page-item"><a class="page-link" href="?page={{ page_obj.next_page_number }}">next</a></li>
            {% else %}
                <li class="page-item disabled"><a class="page-link" href="#" aria-disabled="true">next</a></li>
            {% endif %}
          </ul>
      </nav>
  {% else %}
      <p>No new assets are available.</p>
  {% endif %}
  </div>
<div class="row p-4"></div>
  <!-- Action buttons -->
  <div class="row">

    <div class="col-sm-12">
      <a class="btn btn-primary" href="{% url 'asset:add' %}" role="button">+ Asset</a>
      <a class="btn btn-primary" href="{% url 'container:add' %}" role="button">+ Container</a>
    </div>

  </div>
  <!-- End Action buttons -->

</div>
{% endblock content %}

