Make tables in part info vertically scrollable on small displays

This commit is contained in:
Jan Böhmer 2023-01-09 23:48:36 +01:00
parent 4c9c9cf227
commit faf346806b
2 changed files with 79 additions and 77 deletions

View file

@ -1,4 +1,4 @@
<div class=""> <div class="table-responsive">
<table class="table table-striped table-header table-hover"> <table class="table table-striped table-header table-hover">
<thead> <thead>
<tr> <tr>

View file

@ -3,93 +3,95 @@
{% include "Parts/info/_withdraw_modal.html.twig" %} {% include "Parts/info/_withdraw_modal.html.twig" %}
<table class="table table-striped table-hover table-responsive-sm"> <div class="table-responsive">
<thead> <table class="table table-striped table-hover">
<tr> <thead>
<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 #}
</tr>
</thead>
<tbody>
{% for lot in part.partLots %}
<tr> <tr>
<td>{{ lot.description }}</td> <th>{% trans %}part_lots.description{% endtrans %}</th>
<td> <th>{% trans %}part_lots.storage_location{% endtrans %}</th>
{% if lot.storageLocation %} <th>{% trans %}part_lots.amount{% endtrans %}</th>
{{ helper.structural_entity_link(lot.storageLocation) }} <th></th> {# Tags row #}
{% else %} <th></th>
<span class="badge rounded-pill bg-warning"> <th></th> {# Button row #}
</tr>
</thead>
<tbody>
{% for lot in part.partLots %}
<tr>
<td>{{ lot.description }}</td>
<td>
{% if lot.storageLocation %}
{{ helper.structural_entity_link(lot.storageLocation) }}
{% else %}
<span class="badge rounded-pill bg-warning">
<i class="fas fa-question-circle fa-fw"></i> {% trans %}part_lots.location_unknown{% endtrans %} <i class="fas fa-question-circle fa-fw"></i> {% trans %}part_lots.location_unknown{% endtrans %}
</span> </span>
{% endif %} {% endif %}
</td> </td>
<td> <td>
{% if lot.instockUnknown %} {% if lot.instockUnknown %}
<span class="badge rounded-pill bg-warning"> <span class="badge rounded-pill bg-warning">
<i class="fas fa-question-circle fa-fw"></i> {% trans %}part_lots.instock_unknown{% endtrans %} <i class="fas fa-question-circle fa-fw"></i> {% trans %}part_lots.instock_unknown{% endtrans %}
</span> </span>
{% else %} {% else %}
{{ lot.amount | format_amount(part.partUnit, {'decimals': 5}) }} {{ lot.amount | format_amount(part.partUnit, {'decimals': 5}) }}
{% endif %} {% endif %}
</td> </td>
<td> <td>
<h6> <h6>
{% if lot.expirationDate %} {% if lot.expirationDate %}
<span class="badge bg-info" title="{% trans %}part_lots.expiration_date{% endtrans %}"> <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() }} <i class="fas fa-calendar-alt fa-fw"></i> {{ lot.expirationDate | format_date() }}
</span> </span>
{% endif %} {% endif %}
{% if lot.expired %} {% if lot.expired %}
<br> <br>
<span class="badge bg-warning"> <span class="badge bg-warning">
<i class="fas fa-exclamation-circle fa-fw"></i> <i class="fas fa-exclamation-circle fa-fw"></i>
{% trans %}part_lots.is_expired{% endtrans %} {% trans %}part_lots.is_expired{% endtrans %}
</span> </span>
{% endif %} {% endif %}
{% if lot.needsRefill %} {% if lot.needsRefill %}
<br> <br>
<span class="badge bg-warning"> <span class="badge bg-warning">
<i class="fas fa-dolly fa-fw"></i> <i class="fas fa-dolly fa-fw"></i>
{% trans %}part_lots.need_refill{% endtrans %} {% trans %}part_lots.need_refill{% endtrans %}
</span> </span>
{% endif %} {% endif %}
</h6> </h6>
</td> </td>
<td> <td>
<div class="btn-group" role="group"> <div class="btn-group" role="group">
<button type="button" class="btn btn-outline-primary" data-bs-toggle="modal" data-bs-target="#withdraw-modal" <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 }}" data-action="withdraw" data-lot-id="{{ lot.id }}" data-lot-amount="{{ lot.amount }}"
title="{% trans %}part.info.withdraw_modal.title.withdraw{% endtrans %}" title="{% trans %}part.info.withdraw_modal.title.withdraw{% endtrans %}"
{% if not is_granted('withdraw', lot) or not withdraw_add_helper.canWithdraw(lot) %}disabled{% endif %} {% if not is_granted('withdraw', lot) or not withdraw_add_helper.canWithdraw(lot) %}disabled{% endif %}
> >
<i class="fa-solid fa-minus fa-fw"></i> <i class="fa-solid fa-minus fa-fw"></i>
</button> </button>
<button type="button" class="btn btn-outline-primary" data-bs-toggle="modal" data-bs-target="#withdraw-modal" <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 }}" data-action="add" data-lot-id="{{ lot.id }}" data-lot-amount="{{ lot.amount }}"
title="{% trans %}part.info.withdraw_modal.title.add{% endtrans %}" title="{% trans %}part.info.withdraw_modal.title.add{% endtrans %}"
{% if not is_granted('add', lot) or not withdraw_add_helper.canAdd(lot) %}disabled{% endif %} {% if not is_granted('add', lot) or not withdraw_add_helper.canAdd(lot) %}disabled{% endif %}
> >
<i class="fa-solid fa-plus fa-fw"></i> <i class="fa-solid fa-plus fa-fw"></i>
</button> </button>
<button type="button" class="btn btn-outline-primary" data-bs-toggle="modal" data-bs-target="#withdraw-modal" <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 }}" data-action="move" data-lot-id="{{ lot.id }}" data-lot-amount="{{ lot.amount }}"
title="{% trans %}part.info.withdraw_modal.title.move{% endtrans %}" 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 %} {% 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> <i class="fa-solid fa-right-left fa-fw"></i>
</button> </button>
</div> </div>
</td> </td>
<td> <td>
{{ dropdown.profile_dropdown('part_lot', lot.id, false) }} {{ dropdown.profile_dropdown('part_lot', lot.id, false) }}
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
</div>