homelog/asset/templates/asset/asset_list.html

76 lines
3.2 KiB
HTML

{% extends "base.html" %}
{% load static %}
{% block title %}Asset: {{ asset.named_id }}{% endblock %}
{% block content %}
<div class="container">
{% if asset_list %}
<table class="table table-striped table-hover">
<thead>
<tr>
<th scope="col">Asset</th><th scope="col">Quantity</th><th scope="col">Action</th>
</tr>
</thead>
<tbody>
{% for asset in asset_list %}
<tr>
<td><a href="{% url 'asset:update' asset.id %}"><div>{{ asset.named_id }}: {{ asset.description }}</div></a></td>
<td>{{ asset.quantity }}</td>
<td><a class="btn btn-outline-primary btn-sm" href="{% url 'asset:delete' asset.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 new assets are available.</p>
{% endif %}
</div>
<div class="row p-4"></div>
<!-- Action buttons -->
<div class="row">
<form method="post" action="{% url 'asset:add-by-gtin' %}">
{% csrf_token %}
<div class="col-sm-12">
<div class="col-4">
<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 class="col-4">
<div class="input-group">
<input type="text" class="form-control" name="gtin" placeholder="EAN, UPC or GTIN" maxlength="20">
<div class="input-group-append">
<button class="btn btn-primary" type="submit" id="assetFromGtin">+Asset from GTIN</button>
</div>
</div>
</div>
</div>
</form>
</div>
<!-- End Action buttons -->
</div>
{% endblock content %}