{% extends "ereuse_devicehub/base_site.html" %}
{% block main %}

<div class="pagetitle">
  <h1>Inventory</h1>
  <nav>
    <ol class="breadcrumb">
      <li class="breadcrumb-item active">{{ page_title }}</li>
    </ol>
  </nav>
</div><!-- End Page Title -->

<section class="section profile">
  <div class="row">

    <div class="col-xl-12">

      <div class="card">
        <div class="card-body pt-3">
          <!-- Bordered Tabs -->

            <div class="btn-group dropdown ml-1">
              <a href="{{ url_for('labels.tag_add')}}" type="button" class="btn btn-primary">
                <i class="bi bi-plus"></i>
                Create Named Tag
                <span class="caret"></span>
              </a>
            </div>

            <div class="btn-group dropdown ml-1" uib-dropdown="">
              <a href="{{ url_for('labels.tag_unnamed_add')}}" type="button" class="btn btn-primary">
                <i class="bi bi-plus"></i>
                Create UnNamed Tag
                <span class="caret"></span>
              </a>
            </div>

          <div class="tab-content pt-2">

            <div class="tab-pane fade show active profile-overview" id="profile-overview">

              <h5 class="card-title">Computers</h5>
                <table class="table">
                  <thead>
                    <tr>
                      <th scope="col">Code</th>
                      <th scope="col">Type</th>
                      <th scope="col">Provider</th>
                      <th scope="col">Device</th>
                    </tr>
                  </thead>
                  <tbody>
                    {% for tag in tags %}
                    <tr>
                      <td><a href="{{ url_for('labels.label_details', id=tag.id) }}">{{ tag.id }}</a></td>
                      <td>{% if tag.provider %}Unnamed tag {% else %}Named tag{% endif %}</td>
                      <td>{{ tag.get_provider }}</td>
                      <td>
                        {% if tag.device %}
                        <a href={{ url_for('inventory.device_details', id=tag.device.devicehub_id)}}>
                          {{ tag.device.verbose_name }}
                        </a>
                        {% endif %}
                      </td>
                    </tr>
                    {% endfor %}
                  </tbody>
                </table>

          </div><!-- End Bordered Tabs -->

        </div>
      </div>

    </div>
  </div>
</section>

<!-- Custom Code -->
<script>
  const table = new simpleDatatables.DataTable("table")
</script>
{% endblock main %}