Part-DB-server/templates/Parts/info/_part_lots.html.twig

95 lines
4.5 KiB
Twig
Raw Normal View History

{% import "helper.twig" as helper %}
{% import "LabelSystem/dropdown_macro.html.twig" as dropdown %}
{% include "Parts/info/_withdraw_modal.html.twig" %}
<table class="table table-striped table-hover table-responsive-sm">
2019-08-16 22:54:23 +02:00
<thead>
<tr>
<th>{% trans %}part_lots.description{% endtrans %}</th>
<th>{% trans %}part_lots.storage_location{% endtrans %}</th>
<th>{% trans %}part_lots.amount{% endtrans %}</th>
<th></th> {# Tags row #}
<th></th>
<th></th> {# Button row #}
2019-08-16 22:54:23 +02:00
</tr>
</thead>
<tbody>
{% for lot in part.partLots %}
<tr>
<td>{{ lot.description }}</td>
<td>
{% if lot.storageLocation %}
{{ helper.structural_entity_link(lot.storageLocation) }}
{% else %}
2022-07-24 22:39:32 +02:00
<span class="badge rounded-pill bg-warning">
<i class="fas fa-question-circle fa-fw"></i> {% trans %}part_lots.location_unknown{% endtrans %}
</span>
{% endif %}
2019-08-16 22:54:23 +02:00
</td>
<td>
{% if lot.instockUnknown %}
2022-07-24 22:39:32 +02:00
<span class="badge rounded-pill bg-warning">
2019-08-16 22:54:23 +02:00
<i class="fas fa-question-circle fa-fw"></i> {% trans %}part_lots.instock_unknown{% endtrans %}
</span>
{% else %}
2022-09-18 17:50:25 +02:00
{{ lot.amount | format_amount(part.partUnit, {'decimals': 5}) }}
2019-08-16 22:54:23 +02:00
{% endif %}
</td>
<td>
<h6>
{% if lot.expirationDate %}
2022-07-24 22:39:32 +02:00
<span class="badge bg-info" title="{% trans %}part_lots.expiration_date{% endtrans %}">
<i class="fas fa-calendar-alt fa-fw"></i> {{ lot.expirationDate | format_date() }}
2019-08-16 22:54:23 +02:00
</span>
{% endif %}
{% if lot.expired %}
<br>
2022-07-24 22:39:32 +02:00
<span class="badge bg-warning">
2019-08-16 22:54:23 +02:00
<i class="fas fa-exclamation-circle fa-fw"></i>
{% trans %}part_lots.is_expired{% endtrans %}
</span>
{% endif %}
{% if lot.needsRefill %}
<br>
2022-07-24 22:39:32 +02:00
<span class="badge bg-warning">
2019-08-16 22:54:23 +02:00
<i class="fas fa-dolly fa-fw"></i>
{% trans %}part_lots.need_refill{% endtrans %}
</span>
{% endif %}
</h6>
</td>
<td>
<div class="btn-group" role="group">
<button type="button" class="btn btn-outline-primary" data-bs-toggle="modal" data-bs-target="#withdraw-modal"
data-action="withdraw" data-lot-id="{{ lot.id }}" data-lot-amount="{{ lot.amount }}"
title="{% trans %}part.info.withdraw_modal.title.withdraw{% endtrans %}"
{% if not is_granted('withdraw', lot) or not withdraw_add_helper.canWithdraw(lot) %}disabled{% endif %}
>
<i class="fa-solid fa-minus fa-fw"></i>
</button>
<button type="button" class="btn btn-outline-primary" data-bs-toggle="modal" data-bs-target="#withdraw-modal"
data-action="add" data-lot-id="{{ lot.id }}" data-lot-amount="{{ lot.amount }}"
title="{% trans %}part.info.withdraw_modal.title.add{% endtrans %}"
{% if not is_granted('add', lot) or not withdraw_add_helper.canAdd(lot) %}disabled{% endif %}
>
<i class="fa-solid fa-plus fa-fw"></i>
</button>
<button type="button" class="btn btn-outline-primary" data-bs-toggle="modal" data-bs-target="#withdraw-modal"
data-action="move" data-lot-id="{{ lot.id }}" data-lot-amount="{{ lot.amount }}"
title="{% trans %}part.info.withdraw_modal.title.move{% endtrans %}"
{% if not is_granted('move', lot) or not withdraw_add_helper.canWithdraw(lot) or part.partLots.count == 1 %}disabled{% endif %}
>
<i class="fa-solid fa-right-left fa-fw"></i>
</button>
</div>
</td>
<td>
{{ dropdown.profile_dropdown('part_lot', lot.id, false) }}
</td>
2019-08-16 22:54:23 +02:00
</tr>
{% endfor %}
</tbody>
</table>