2021-08-07 17:37:36 +02:00
|
|
|
{% 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 %}
|
2021-10-31 20:57:28 +01:00
|
|
|
<a href="{% url 'parts-stocks-detail' uuid=low.storage.id %}?search={{low.component.id|urlencode}}" class="text-decoration-none">
|
2021-08-07 17:37:36 +02:00
|
|
|
<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">
|
2021-10-31 20:57:28 +01:00
|
|
|
<h5 class="mt-0">{{ low.component.name }}{% if low.component.package %} in {{ low.component.package }}{% endif %}</h5>
|
2021-08-07 17:37:36 +02:00
|
|
|
{{ 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>
|
2021-08-14 02:20:45 +02:00
|
|
|
{% include 'paginator.html' with paginator=low_stocks get_param='low_stock_page' aria_label='Low Stock Page Navigation' %}
|
2021-08-07 17:37:36 +02:00
|
|
|
</div>
|
|
|
|
<div class="col-md">
|
2021-10-25 19:31:50 +02:00
|
|
|
<h1>Storages <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#add-sub-modal"><i class="bi bi-plus-circle"></i></button></h1>
|
2021-08-14 02:20:45 +02:00
|
|
|
<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>
|
|
|
|
{% include 'paginator.html' with paginator=storages get_param='storage_page' aria_label='Storage Page Navigation'%}
|
2021-08-07 17:37:36 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-10-25 19:31:50 +02:00
|
|
|
|
|
|
|
<!-- Add storage modal form -->
|
|
|
|
{% with add_storage_form as form %}
|
2024-11-10 20:46:45 +01:00
|
|
|
{% include 'parts/modals/substorage-modal.html' %}
|
2021-10-25 19:31:50 +02:00
|
|
|
{% endwith %}
|
|
|
|
|
2021-08-07 17:37:36 +02:00
|
|
|
</div>
|
2021-10-25 19:31:50 +02:00
|
|
|
{% endblock content %}
|
|
|
|
|
|
|
|
{% block custom_scripts %}
|
|
|
|
<script type="text/javascript">
|
2021-10-29 21:18:20 +02:00
|
|
|
{% if add_storage_form.errors %}
|
2021-10-25 19:31:50 +02:00
|
|
|
var addSubStorageModal = document.querySelector('#add-sub-modal');
|
|
|
|
var modal = bootstrap.Modal.getOrCreateInstance(addSubStorageModal);
|
|
|
|
modal.show();
|
2021-10-29 21:18:20 +02:00
|
|
|
{% endif %}
|
2024-11-10 20:46:45 +01:00
|
|
|
|
2021-10-25 19:31:50 +02:00
|
|
|
</script>
|
|
|
|
{% endblock custom_scripts %}
|
|
|
|
|