Show attachments in part info

WIP: viewing and downloading attachments is not possible yet.
This commit is contained in:
Jan Böhmer 2019-08-06 18:47:09 +02:00
parent 717b257778
commit 01a83d388b
8 changed files with 269 additions and 16 deletions

View file

@ -0,0 +1,59 @@
<table class="table table-striped table-hover">
<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>
{% if attachment_helper.fileExisting(attachment) %}
<i class="fas fa-file fa-3x"></i>
{% else %}
<i class="fas fa-exclamation-triangle fa-3x text-danger"></i>
{% endif %}
</td>
<td class="align-middle">{{ attachment.name }}</td>
<td class="align-middle">{{ attachment.type.fullPath }}</td>
<td class="align-middle">{{ attachment.filename }}</td>
<td class="align-middle">
{% if attachment_helper.fileExisting(attachment) %}
{{ attachment_helper.humanFileSize(attachment) }}
{% else %}
<b class="text-danger">{% trans %}attachment.file_not_found{% endtrans %}</b>
{% endif %}
</td>
<td><div class="btn-group" role="group" aria-label="Button group with nested dropdown">
<button type="button" class="btn btn-secondary" title="{% trans %}attachment.view{% endtrans %}"><i class="fas fa-eye fa-fw"></i></button>
<button type="button" class="btn btn-secondary" title="{% trans %}attachment.download{% endtrans %}"><i class="fas fa-download fa-fw"></i></button>
<div class="btn-group" role="group">
<button id="btnGroupDrop1" type="button" class="btn btn-secondary dropdown-toggle" data-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 | localizeddate("short")}}</span>
<span class="text-muted dropdown-item-text" ><i class="fas fa-history fa-fw"></i> <b>{% trans %}createdAt{% endtrans %}:</b> {{ attachment.addedDate | localizeddate("short")}}</span>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">{% trans %}attachment.edit{% endtrans %}</a>
<a class="dropdown-item" href="#">{% trans %}attachment.delete{% endtrans %}</a>
</div>
</div>
</div></td>
</tr>
{% endfor %}
</tbody>
</table>

View file

@ -32,7 +32,7 @@
</h6>
<h6 title="{% trans %}part.avg_price.label{% endtrans %}">
<i class="fas fa-money-bill-alt fa-fw"></i>
<span class="text-muted">{{ part.averagePrice | moneyFormat }}</span>
<span class="text-muted">{% if part.averagePrice is not null %}{{ part.averagePrice | moneyFormat }}{% else %}-{% endif %}</span>
</h6>
{#
{% if part.comment != "" %}