mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-08-31 15:30:42 +02:00
Added dropdowns for quick generating labels for different profiles.
This commit is contained in:
parent
747962884a
commit
48ff81a6d1
8 changed files with 118 additions and 3 deletions
14
templates/LabelSystem/dropdown_macro.html.twig
Normal file
14
templates/LabelSystem/dropdown_macro.html.twig
Normal file
|
@ -0,0 +1,14 @@
|
|||
{% macro profile_dropdown(type, id = null, include_text = true, btn_type = 'btn-secondary') %}
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn {{ btn_type }} dropdown-toggle" title="{% trans %}label_generator.label_btn{% endtrans %}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="fas fa-fw fa-qrcode"></i> {% if include_text %}{% trans %}label_generator.label_btn{% endtrans %}{% endif %}
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
{% for profile in label_profile_dropdown_helper.dropdownProfiles(type) %}
|
||||
<a class="dropdown-item" href="{{ path('label_dialog_profile', {'profile': profile.id, 'target_type': type, 'target_id': id, 'generate': true}) }}">{{ profile.name }}</a>
|
||||
{% endfor %}
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="{{ path('label_dialog', {'target_type': type, 'target_id': id}) }}">{% trans %}label_generator.label_empty{% endtrans %}</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endmacro %}
|
|
@ -1,4 +1,5 @@
|
|||
{% import "helper.twig" as helper %}
|
||||
{% import "LabelSystem/dropdown_macro.html.twig" as dropdown %}
|
||||
|
||||
<table class="table table-striped table-hover table-responsive-sm">
|
||||
<thead>
|
||||
|
@ -7,6 +8,7 @@
|
|||
<th>{% trans %}part_lots.storage_location{% endtrans %}</th>
|
||||
<th>{% trans %}part_lots.amount{% endtrans %}</th>
|
||||
<th></th> {# Tags row #}
|
||||
<th></th> {# Button row #}
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
|
@ -55,6 +57,9 @@
|
|||
{% endif %}
|
||||
</h6>
|
||||
</td>
|
||||
<td>
|
||||
{{ dropdown.profile_dropdown('part_lot', lot.id, false) }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
{% import "LabelSystem/dropdown_macro.html.twig" as dropdown %}
|
||||
|
||||
{% if is_granted('edit', part) %}
|
||||
<a href="{{ part|entityURL('edit') }}" class="btn btn-primary mt-3">
|
||||
<i class="fas fa-fw fa-edit"></i>
|
||||
|
@ -46,4 +48,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
|
||||
{{ dropdown.profile_dropdown('part', part.id) }}
|
Loading…
Add table
Add a link
Reference in a new issue