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

{% block title %}Container Type List{% endblock %}

{% block content %}
<div class="container">
  {% if container_type_list %}
      <table class="table table-striped table-hover">
          <thead>
              <tr>
                  <th scope="col">Container Type</th>
                  <th scope="col">Description</th>
                  <th scope="col">Size (mm)</th>
                  <th scope="col">Inner Size (mm)</th>
                  <th scope="col">Cover</th>
                  <th scope="col">holds Container</th>
                  <th scope="col">Changed</th>
                  <th scope="col">Action</th>
              </tr>
          </thead>
          <tbody>
              {% for ctype in container_type_list %}
                  <tr>
                      <td><a href="{% url 'container:container_type_update' ctype.id %}"><div>{{ ctype.named_id }}</div></a></td>
                      <td><div>{{ ctype.description }}</div></td>
                      <td><div>{% if ctype.width %}{{ ctype.width }}x{{ ctype.length }}x{{ ctype.height }}{% endif %}</div></td>
                      <td><div>{% if ctype.inner_width %}{{ ctype.inner_width }}x{{ ctype.inner_length }}x{{ ctype.inner_height }}{% endif %}</div></td>
                      <td><div>{% if ctype.has_cover %}yes{%else %}--{% endif %}</div></td>
                      <td><div>{% if ctype.contains_container %}yes{%else %}--{% endif %}</div></td>
                      <td><div>{{ ctype.changed_ts | date:'H:i:s d.m.Y' }}</div></td>
                      <td><a class="btn btn-outline-primary btn-sm" href="{% url 'container:container_type_delete' ctype.id %}" role="button">Delete</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 container types 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 'container:container_type_add' %}" role="button">+ Container Type</a>
      <a class="btn btn-primary" href="{% url 'container:add' %}" role="button">+ Container</a>
      <a class="btn btn-primary" href="{% url 'asset:add' %}" role="button">+ Asset</a>
    </div>
    <div class="col-sm-12">
      <a class="btn btn-primary" href="{% url 'container:container_type_import' %}" role="button">Import Container Types</a>
    </div>

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

</div>
{% endblock content %}

