2019-08-02 14:44:58 +02:00
|
|
|
{% macro boolean(value) %}
|
|
|
|
{% if value %}
|
|
|
|
{% trans %}bool.true{% endtrans %}
|
|
|
|
{% else %}
|
|
|
|
{% trans %}bool.false{% endtrans %}
|
|
|
|
{% endif %}
|
2019-08-10 19:04:47 +02:00
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
{% macro attachment_icon(attachment, attachment_helper, class = "fa-fw fas fa-3x", link = true) %}
|
2020-03-30 16:56:58 +02:00
|
|
|
{% set disabled = attachment.secure and not is_granted("show_secure", attachment) %}
|
2019-08-10 19:04:47 +02:00
|
|
|
{% if not attachment_helper or attachment_helper.fileExisting(attachment) %}
|
2020-03-30 16:56:58 +02:00
|
|
|
{% if link and not disabled %}
|
2022-07-24 16:03:07 +02:00
|
|
|
<a target="_blank" data-turbo="false" rel="noopener" href="{{ attachment|entityURL('file_view') }}">
|
2020-03-30 16:56:58 +02:00
|
|
|
{% endif %}
|
2019-08-11 17:24:54 +02:00
|
|
|
{% if attachment.picture %}
|
2020-05-27 22:06:32 +02:00
|
|
|
<img class="hoverpic" data-thumbnail="{{ attachment|entityURL('file_view') }}" src="{{ attachment|entityURL('file_view') }}">
|
2019-08-11 17:24:54 +02:00
|
|
|
{% else %}
|
2019-11-10 18:19:06 +01:00
|
|
|
<i class="text-dark {{ class }} {{ ext_to_fa_icon(attachment.extension) }}"></i>
|
2019-08-11 17:24:54 +02:00
|
|
|
{% endif %}
|
2020-03-30 16:56:58 +02:00
|
|
|
{% if link and not disabled %}
|
2019-08-10 19:04:47 +02:00
|
|
|
</a>
|
2020-03-30 16:56:58 +02:00
|
|
|
{% endif %}
|
2019-08-10 19:04:47 +02:00
|
|
|
{% elseif not attachment_helper.fileExisting(attachment) %}
|
2020-05-27 22:06:32 +02:00
|
|
|
<i class="{{ class }} fa-exclamation-triangle text-danger" title="{% trans %}attachment.file_not_found{% endtrans %}"></i>
|
2019-08-10 19:04:47 +02:00
|
|
|
{% endif %}
|
2019-08-15 22:59:34 +02:00
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
{% macro string_to_tags(string, class="badge badge-info") %}
|
|
|
|
{% for tag in string|split(',') %}
|
2019-09-05 22:27:18 +02:00
|
|
|
<a href="{{ url('part_list_tags', {'tag': tag | trim}) }}" class="{{ class }}" >{{ tag | trim }}</a>
|
2019-08-15 22:59:34 +02:00
|
|
|
{% endfor %}
|
2019-09-02 18:41:57 +02:00
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
{% macro m_status_to_badge(status, class="badge") %}
|
|
|
|
{% if status is not empty %}
|
|
|
|
{% set color = " badge-secondary" %}
|
|
|
|
|
|
|
|
{% if status == "active" %}
|
|
|
|
{% set color = " badge-success" %}
|
|
|
|
{% elseif status == "nrfnd" %}
|
|
|
|
{% set color = " badge-warning" %}
|
|
|
|
{% elseif status == "eol" %}
|
|
|
|
{% set color = " badge-warning" %}
|
|
|
|
{% elseif status == "discontinued" %}
|
|
|
|
{% set color = " badge-danger" %}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<span class="{{ class ~ color}}" title="{{ ("m_status." ~ status ~ ".help") | trans }}">
|
|
|
|
<i class="fa-fw fas fa-info-circle"></i>
|
|
|
|
{{ ("m_status." ~ status) | trans }}
|
|
|
|
</span>
|
|
|
|
{% endif %}
|
2019-09-08 16:20:53 +02:00
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
{% macro structural_entity_link(entity, link_type = "list_parts") %}
|
|
|
|
{# @var entity \App\Entity\Base\StructuralDBElement #}
|
|
|
|
{% if entity %}
|
|
|
|
<ul class="structural_link d-inline">
|
|
|
|
{% for e in entity.pathArray %}
|
|
|
|
<li>
|
2019-09-16 13:27:53 +02:00
|
|
|
{% if link_type is not empty and e.id is not null %}
|
2019-09-08 16:20:53 +02:00
|
|
|
<a href="{{ e | entityURL(link_type) }}">{{ e.name }}</a>
|
|
|
|
{% else %}
|
|
|
|
{{ e.name }}
|
|
|
|
{% endif %}
|
|
|
|
</li>
|
|
|
|
{% endfor %}
|
|
|
|
</ul>
|
|
|
|
{% else %}
|
|
|
|
-
|
|
|
|
{% endif %}
|
2019-09-08 16:29:56 +02:00
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
{% macro breadcrumb_entity_link(entity, link_type = "list_parts") %}
|
|
|
|
<nav aria-label="breadcrumb">
|
|
|
|
<ol class="breadcrumb">
|
|
|
|
{% for e in entity.pathArray %}
|
|
|
|
<li class="breadcrumb-item {% if loop.last %}active{% endif %}">
|
2019-09-16 13:27:53 +02:00
|
|
|
{% if link_type is not empty and not loop.last and e.id is not null %}
|
2019-09-08 16:29:56 +02:00
|
|
|
<a href="{{ e | entityURL(link_type) }}">{{ e.name }}</a>
|
|
|
|
{% else %}
|
|
|
|
{{ e.name }}
|
|
|
|
{% endif %}
|
|
|
|
</li>
|
|
|
|
{% endfor %}
|
|
|
|
</ol>
|
|
|
|
</nav>
|
2019-12-29 20:04:52 +01:00
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
{% macro bool_icon(bool) %}
|
|
|
|
{% if bool %}
|
|
|
|
<i class="fas fa-check-circle fa-fw" title="{% trans %}Yes{% endtrans %}"></i>
|
|
|
|
{% else %}
|
|
|
|
<i class="fas fa-times-circle fa-fw" title="{% trans %}No{% endtrans %}"></i>
|
|
|
|
{% endif %}
|
2020-02-06 19:22:01 +01:00
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
{% macro date_user_combination(entity, lastModified, datetime_format = "short") %}
|
|
|
|
{% if lastModified == true %}
|
|
|
|
{{ entity.lastModified | format_datetime(datetime_format) }}
|
|
|
|
{% else %}
|
|
|
|
{{ entity.addedDate | format_datetime(datetime_format) }}
|
|
|
|
{% endif %}
|
|
|
|
{% if is_granted('show_users', entity) %}
|
|
|
|
{% if lastModified == true %}
|
|
|
|
{% set user = getLastEditingUser(entity) %}
|
|
|
|
{% else %}
|
|
|
|
{% set user = getCreatingUser(entity) %}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if user is not null %}
|
|
|
|
{% if user.fullName is not empty %}
|
|
|
|
<a href="{{ url('user_info', {"id": user.id}) }}" title="@{{ user.name }}"><i>({{ user.fullName }})</i></a>
|
|
|
|
{% else %}
|
|
|
|
<a href="{{ url('user_info', {"id": user.id}) }}" title="@{{ user.name }}"><i>(@{{ user.name }})</i></a>
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
2020-03-24 15:08:56 +01:00
|
|
|
{% endmacro %}
|
|
|
|
|
|
|
|
{% macro parameters_table(parameters) %}
|
|
|
|
<table class="table table-hover table-striped table-sm">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>{% trans %}specifications.property{% endtrans %}</th>
|
|
|
|
<th>{% trans %}specifications.value{% endtrans %}</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{% for param in parameters %}
|
|
|
|
<tr>
|
2022-03-06 15:49:09 +01:00
|
|
|
<td>{{ param.name }} {% if param.symbol is not empty %}<span class="latex" data-controller="common--latex">${{ param.symbol }}$</span>{% endif %}</td>
|
2020-03-24 15:08:56 +01:00
|
|
|
<td>{{ param.formattedValue }}</td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
{% endmacro parameters_table %}
|