shimatta-kenkyusho/shimatta_kenkyusho/templates/parts/stocks.html

89 lines
5.1 KiB
HTML

{% extends 'base.html' %}
{% block content %}
<div class="container">
<div class="row">
<div class="col-md">
<h1>Low Stocks</h1>
<div class="list-group">
{% for low in low_stocks %}
<a href="{% url 'parts-stocks-detail' uuid=low.storage.id %}" class="text-decoration-none">
<li class="list-group-item list-group-item-action d-flex justify-content-between align-items-center">
<div class="flex-shrink-0">
{% if low.component.get_resolved_image %}
<img src="{{low.component.get_resolved_image}}" style="max-width:64px;max-height:64px;" alt="{{ low.component.name }}" class="mr-3">
{% else %}
{% load static %}
<img src="{% static 'css/icons/card-image.svg' %}" style="width:64px;max-height:64px;" alt="{{ low.component.name }}" class="mr-3">
{% endif %}
</div>
<div class="flex-grow-1 ms-3">
<h5 class="mt-0">{{ low.component.name }} in {{ low.component.package }}</h5>
{{ low.storage }}
</div>
{% if low.storage.responsible.username == view.request.user.username %}
<span class="badge bg-danger rounded-pill">{{low.amount}} / {{low.watermark}}</span>
{% else %}
<span class="badge bg-primary rounded-pill">{{low.amount}} / {{low.watermark}}</span>
{% endif %}
</li></a>
{% endfor %}
</div>
<nav aria-label="Low Stock Navigation">
<ul class="pagination">
{% if low_stocks.number > 1 %}
<li class="page-item"><a class="page-link" href="?low_stock_page={{low_stocks.previous_page_number}}">&laquo;</a></li>
<li class="page-item"><a class="page-link" href="?low_stock_page={{low_stocks.previous_page_number}}">{{low_stocks.previous_page_number}}</a></li>
{% else %}
<li class="page-item disabled"><span class="page-link">&laquo;</span></li>
{% endif %}
<li class="page-item active"><span class="page-link">{{low_stocks.number}}</span></li>
{% if low_stocks.paginator.num_pages > low_stocks.number %}
<li class="page-item"><a class="page-link" href="?low_stock_page={{low_stocks.next_page_number}}">{{low_stocks.next_page_number}}</a></li>
<li class="page-item"><a class="page-link" href="?low_stock_page={{low_stocks.next_page_number}}">&raquo;</a></li>
{% else %}
<li class="page-item disabled"><span class="page-link">&raquo;</span></li>
{% endif %}
</ul>
</nav>
</div>
<div class="col-md">
<h1>Storages</h1>
<div class="list-group">
{% for storage in storages %}
<a href="{% url 'parts-stocks-detail' uuid=storage.id %}" class="text-decoration-none">
<li class="list-group-item list-group-item-action justify-content-between align-items-center d-flex">
<div>
<h5>{{storage.name}}</h5>
Responsible: {{ storage.responsible }}
</div>
<span class="badge bg-primary rounded-pill">{{storage.get_total_stock_amount}}</span>
</li>
</a>
{% endfor %}
</div>
<nav aria-label="Storage Navigation">
<ul class="pagination">
{% if storages.number > 1 %}
<li class="page-item"><a class="page-link" href="?storage_page={{storages.previous_page_number}}">&laquo;</a></li>
<li class="page-item"><a class="page-link" href="?storage_page={{storages.previous_page_number}}">{{storages.previous_page_number}}</a></li>
{% else %}
<li class="page-item disabled"><span class="page-link">&laquo;</span></li>
{% endif %}
<li class="page-item active"><span class="page-link">{{storages.number}}</span></li>
{% if storages.paginator.num_pages > storages.number %}
<li class="page-item"><a class="page-link" href="?storage_page={{storages.next_page_number}}">{{storages.next_page_number}}</a></li>
<li class="page-item"><a class="page-link" href="?storage_page={{storages.next_page_number}}">&raquo;</a></li>
{% else %}
<li class="page-item disabled"><span class="page-link">&raquo;</span></li>
{% endif %}
</ul>
</nav>
</div>
</div>
</div>
{% endblock content %}