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

85 lines
No EOL
4.6 KiB
Twig

<table class="table table-striped table-sm table-hover table-responsive-sm">
<thead>
<tr>
<th></th>
<th>{% trans %}attachment.name{% endtrans %}</th>
<th>{% trans %}attachment.attachment_type{% endtrans %}</th>
<th>{% trans %}attachment.file_name{% endtrans %}</th>
<th>{% trans %}attachment.file_size{% endtrans %}</th>
<th></th>
</tr>
</thead>
<tbody>
{% for attachment in part.attachments %}
<tr>
<td>
{% import "components/attachments.macro.html.twig" as attachments %}
{{ attachments.attachment_icon(attachment, attachment_manager) }}
</td>
<td class="align-middle">{{ attachment.name }}</td>
<td class="align-middle">{{ attachment.attachmentType.fullPath }}</td>
<td class="align-middle">
{% if attachment.external %}
<a href="{{ attachment.uRL }}" rel="noopener" target="_blank" class="link-external">{{ attachment.host }}</a>
{% else %}
{{ attachment.filename }}
{% endif %}
</td>
<td class="align-middle h6">
{% if attachment.external %}
<span class="badge bg-primary">
<i class="fas fa-fw fa-globe"></i> {% trans %}attachment.external{% endtrans %}
</span>
{% elseif attachment_manager.fileExisting(attachment) %}
<span class="badge bg-secondary">
<i class="fas fa-hdd fa-fw"></i> {{ attachment_manager.humanFileSize(attachment) }}
</span>
{% else %}
<span class="badge bg-warning">
<i class="fas fa-exclamation-circle fa-fw"></i> {% trans %}attachment.file_not_found{% endtrans %}
</span>
{% endif %}
{% if attachment.secure %}
<br><span class="badge bg-success">
<i class="fas fa-fw fa-shield-alt"></i> {% trans %}attachment.secure{% endtrans %}
</span>
{% endif %}
{% if attachment == part.masterPictureAttachment %}
<br>
<span class="badge bg-primary">
<i class="fas fa-id-card"></i> {% trans %}attachment.preview{% endtrans %}
</span>
{% endif %}
</td>
<td><div class="btn-group" role="group" aria-label="">
<a {% if attachment_manager.fileExisting(attachment) %}href="{{ entity_url(attachment, 'file_view') }}"{% endif %} target="_blank"
class="btn btn-secondary {% if not attachment_manager.fileExisting(attachment) or (attachment.secure and not is_granted("show_secure", attachment)) %}disabled{% endif %}"
data-turbo="false" title="{% trans %}attachment.view{% endtrans %}" rel="noopener">
<i class="fas fa-eye fa-fw"></i>
</a>
<a {% if attachment_manager.fileExisting(attachment) %}href="{{ entity_url(attachment, 'file_download') }}"{% endif %} data-turbo="false"
class="btn btn-secondary {% if not attachment_manager.fileExisting(attachment) or (attachment.secure and not is_granted("show_secure", attachment)) %}disabled{% endif %}"
title="{% trans %}attachment.download{% endtrans %}">
<i class="fas fa-download fa-fw"></i>
</a>
<div class="btn-group" role="group">
<button id="btnGroupDrop1" type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-boundary="window">
</button>
<div class="dropdown-menu" aria-labelledby="btnGroupDrop1">
<span class="text-muted dropdown-item-text" ><i class="fas fa-lightbulb fa-fw"></i> <b>ID:</b> {{ attachment.iD }}</span>
<span class="text-muted dropdown-item-text" ><i class="fas fa-calendar fa-fw"></i> <b>{% trans %}createdAt{% endtrans %}:</b> {{ attachment.addedDate | format_datetime("short")}}</span>
<span class="text-muted dropdown-item-text" ><i class="fas fa-history fa-fw"></i> <b>{% trans %}createdAt{% endtrans %}:</b> {{ attachment.addedDate | format_datetime("short")}}</span>
</div>
</div>
</div></td>
</tr>
{% endfor %}
</tbody>
</table>